diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index 6eaf109a..e4ee926e 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -2,20 +2,47 @@ name: CompatHelper on: schedule: - - cron: '00 00 * * *' + - cron: 0 0 * * 0 # weekly workflow_dispatch: - +permissions: + contents: write + pull-requests: write jobs: CompatHelper: runs-on: ubuntu-latest steps: - - name: Pkg.add("CompatHelper") - run: julia -e 'using Pkg; Pkg.add("CompatHelper")' - - name: CompatHelper.main() + - name: Check if Julia is already available in the PATH + id: julia_in_path + run: which julia + continue-on-error: true + - name: Install Julia, but only if it is not already available in the PATH + uses: julia-actions/setup-julia@latest + with: + version: '1' + # arch: ${{ runner.arch }} + if: steps.julia_in_path.outcome != 'success' + - name: "Add the General registry via Git" + run: | + import Pkg + ENV["JULIA_PKG_SERVER"] = "" + Pkg.Registry.add("General") + shell: julia --color=yes {0} + - name: "Install CompatHelper" + run: | + import Pkg + name = "CompatHelper" + uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" + version = "3" + Pkg.add(; name, uuid, version) + shell: julia --color=yes {0} + - name: "Run CompatHelper" + run: | + import CompatHelper + CompatHelper.main() + shell: julia --color=yes {0} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} # optional - run: julia -e 'using CompatHelper; CompatHelper.main()' + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} # based on: # https://github.com/JuliaRegistries/CompatHelper.jl diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index 5bef0435..390476b2 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -21,7 +21,7 @@ jobs: with: version: '1' - name: CacheArtifacts - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-artifacts with: @@ -40,6 +40,7 @@ jobs: Pkg.instantiate()' - name: BuildAndDeploy env: +# https://juliadocs.github.io/Documenter.jl/stable/man/hosting/#Authentication:-GITHUB_TOKEN # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ssh: ${{ secrets.DOCUMENTER_KEY }} DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/SpellCheck.yml b/.github/workflows/SpellCheck.yml new file mode 100644 index 00000000..c344f6dd --- /dev/null +++ b/.github/workflows/SpellCheck.yml @@ -0,0 +1,13 @@ +name: Spell Check + +on: [pull_request] + +jobs: + typos-check: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Check spelling + uses: crate-ci/typos@master diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index f49313b6..6d2efc1c 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -1,9 +1,11 @@ name: TagBot + on: issue_comment: types: - created workflow_dispatch: + jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml new file mode 100644 index 00000000..fdbfb0b3 --- /dev/null +++ b/.github/workflows/clean.yml @@ -0,0 +1,28 @@ +# https://juliadocs.github.io/Documenter.jl/stable/man/hosting/#gh-pages-Branch + +name: DocPreviewCleanup + +on: + pull_request: + types: [closed] + +jobs: + doc-preview-cleanup: + runs-on: ubuntu-latest + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v4 + with: + ref: gh-pages + - name: Delete preview and history + push changes + run: | + if [ -d "previews/PR$PRNUM" ]; then + git config user.name "Documenter.jl" + git config user.email "documenter@juliadocs.github.io" + git rm -rf "previews/PR$PRNUM" + git commit -m "delete preview" + git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) + git push --force origin gh-pages-new:gh-pages + fi + env: + PRNUM: ${{ github.event.number }} diff --git a/Project.toml b/Project.toml index b967673a..4fccd5e4 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MIRT" uuid = "7035ae7a-3787-11e9-139a-5545ed3dc201" authors = ["fessler "] -version = "0.17.0" +version = "0.18" [deps] AVSfldIO = "b6189060-daf9-4c28-845a-cc0984b81781" @@ -25,14 +25,14 @@ Wavelets = "29a6e085-ba6d-5f35-a997-948ac2efa89a" [compat] AVSfldIO = "0.2" FFTW = "1" -FileIO = "1.9, 1.14" -FillArrays = "0.12, 0.13" -ImageFiltering = "0.6, 0.7" -ImageTransformations = "0.8, 0.9" -Interpolations = "0.12, 0.13, 0.14" -LazyGrids = "0.5" -LinearMapsAA = "0.11" +FileIO = "1" +FillArrays = "1" +ImageFiltering = "0.7" +ImageTransformations = "0.10" +Interpolations = "0.15" +LazyGrids = "1" +LinearMapsAA = "0.12" NFFT = "0.13" -SpecialFunctions = "1, 2" -Wavelets = "0.9" -julia = "1.8" +SpecialFunctions = "2" +Wavelets = "0.10" +julia = "1.10" diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 00000000..04422f44 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,9 @@ +[default] +extend-ignore-identifiers-re = [ + "allk", + "als", + "Nd", + "iy", + "pn", + "MIRTio", +] diff --git a/doc/start-juno.md b/doc/start-juno.md index aebc8453..ee024bd2 100644 --- a/doc/start-juno.md +++ b/doc/start-juno.md @@ -43,7 +43,7 @@ jim(x, title="test") * This test should produce a grayscale image of the famous [Shepp-Logan phantom](https://en.wikipedia.org/wiki/Shepp%E2%80%93Logan_phantom) in the Plots tab of Atom. * To learn about the jiffy image display function `jim`, type `?jim` at the REPL. -* Juno and Atom have lots of online documention. +* Juno and Atom have lots of online documentation. I use the `vim-mode-plus` key bindings, installed using Atom preferences. * To start a Jupyter notebook for Julia, type at the REPL: diff --git a/doc/start.md b/doc/start.md index 2596e9a1..518bca8f 100644 --- a/doc/start.md +++ b/doc/start.md @@ -1,17 +1,22 @@ -* Install Julia (1.5 or later recommended) from https://julialang.org/ -* Explore the extensive documentation at https://docs.julialang.org/ +* Install Julia (1.10 or later recommended) from https://julialang.org +* Explore the extensive documentation at https://docs.julialang.org * Launch Julia and use the `]` key to enter its package manager. * Add any packages needed for these notebooks using the `add` command. * For example `add Plots` to add the `Plots` package. * Other crucial standard packages are `FFTW` `FFTViews` * You will also need the package `IJulia` to run any Jupyter demo notebooks. * Add MIRT by typing `add MIRT` -(Automatically loads from https://github.com/JeffFessler/MIRT.jl because MIRT.jl is a registered package.) + (Automatically loads from https://github.com/JeffFessler/MIRT.jl + because MIRT.jl is a registered package.) * Type `precompile` to have Julia precompile the added packages. -* After you are done adding packages, press the backspace key to return to the REPL prompt. -* Later if you need to add more packages just type the `]` key again at the REPL prompt to enter the package manager. -* Julia is under active development so code is updated frequently. It is a wise to type `up` (short for `update`) at the package manager prompt every week or so to get automatic updates of any packages you have intalled. +* After you are done adding packages, press the backspace key + to return to the REPL prompt. +* Later if you need to add more packages just type the `]` key again + at the REPL prompt to enter the package manager. +* Julia is under active development so code is updated frequently. + It is a wise to type `up` (short for `update`) at the package manager prompt + every week or so to get automatic updates of any packages you have installed. * For some Julia tutorials see -http://web.eecs.umich.edu/~fessler/course/551/julia/tutor/ + http://web.eecs.umich.edu/~fessler/course/551/julia/tutor * For some signal processing demos in Julia see -http://web.eecs.umich.edu/~fessler/course/551/julia/demo/ + http://web.eecs.umich.edu/~fessler/course/551/julia/demo diff --git a/docs/make.jl b/docs/make.jl index c099e45d..432c576e 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -2,8 +2,8 @@ execute = isempty(ARGS) || ARGS[1] == "run" org, reps = :JeffFessler, :MIRT eval(:(using $reps)) -using Documenter -using Literate +import Documenter +import Literate #using DemoCards # examples_templates, examples_theme = cardtheme("grid") @@ -27,7 +27,7 @@ binder_root_url = repo = eval(:($reps)) -DocMeta.setdocmeta!(repo, :DocTestSetup, :(using $reps); recursive=true) +Documenter.DocMeta.setdocmeta!(repo, :DocTestSetup, :(using $reps); recursive=true) # preprocessing inc1 = "include(\"../../../inc/reproduce.jl\")" @@ -81,7 +81,7 @@ format = Documenter.HTML(; assets = ["assets/custom.css"], ) -makedocs(; +Documenter.makedocs(; modules = [repo], authors = "Jeff Fessler and contributors", sitename = "$repo.jl", @@ -96,7 +96,7 @@ makedocs(; # examples_cb() if isci - deploydocs(; + Documenter.deploydocs(; repo = "github.com/$base", devbranch = "main", devurl = "dev", diff --git a/src/algorithm/general/dot-curv.jl b/src/algorithm/general/dot-curv.jl index e7736bc8..68900856 100644 --- a/src/algorithm/general/dot-curv.jl +++ b/src/algorithm/general/dot-curv.jl @@ -10,7 +10,7 @@ _curv_type(Tf::Type{<:RealU}, Tx::Type{<:Number}) = """ - make_dot_curvf(curv::Function, [x, Tf::DataType; w = similar(x)]) + make_dot_curvf(curv::Function, [x, Tf::Type; w = similar(x)]) Make a function with arguments `(v, x)` that computes the dot product between @@ -53,7 +53,7 @@ Those units are relevant to defining the work array `w`. - `x` an array whose `size` and `eltype` is used to allocate `w` # option -- `Tf::DataType = typeof(one(eltype(x)))` +- `Tf::Type = typeof(one(eltype(x)))` Specify `eltype` of function `f(x)`, defaulting to unitless. - `w = similar(x, typeof(oneunit(Tf) / oneunit(eltype(x))^2))` work space for gradient calculation, with appropriate units (if needed). diff --git a/src/algorithm/general/dot-grad.jl b/src/algorithm/general/dot-grad.jl index 528a8f88..1b2be69f 100644 --- a/src/algorithm/general/dot-grad.jl +++ b/src/algorithm/general/dot-grad.jl @@ -10,7 +10,7 @@ _grad_type(Tf::Type{<:RealU}, Tx::Type{<:Number}) = """ - make_dot_gradf(grad::Function, [x, Tf::DataType; w = similar(x)]) + make_dot_gradf(grad::Function, [x, Tf::Type; w = similar(x)]) Make a function with arguments `(v, x)` that computes the dot product between @@ -44,7 +44,7 @@ Those units are relevant to defining the work array `w`. # in - `grad::Function` see above - `x` an array whose `size` and `eltype` is used to allocate `w` -- `Tf::DataType = typeof(one(eltype(x)))` +- `Tf::Type = typeof(one(eltype(x)))` Specify `eltype` of function `f(x)`, defaulting to unitless. # option diff --git a/src/algorithm/general/pogm_restart.jl b/src/algorithm/general/pogm_restart.jl index 47f9520e..40e9e3f0 100644 --- a/src/algorithm/general/pogm_restart.jl +++ b/src/algorithm/general/pogm_restart.jl @@ -71,7 +71,7 @@ iterate as below for given coefficients ``(\\alpha, \\beta_k, \\gamma_k)`` - ``x_{k+1} = y_{k+1} + \\beta_k (y_{k+1} - y_k) + \\gamma_k (y_{k+1} - x_k)`` : momentum update Proximal versions of the above for ``g(x) \\neq 0`` are in the below references, -and use the proximal operater +and use the proximal operator ``prox_g(z) = argmin_x {1/2\\|z-x\\|^2 + g(x)}``. - Proximal Gradient method (PGM or ISTA) - ``\\beta_k = \\gamma_k = 0``. [BT09] diff --git a/src/mri/kspace-spiral.jl b/src/mri/kspace-spiral.jl index 2602c030..7389d77e 100644 --- a/src/mri/kspace-spiral.jl +++ b/src/mri/kspace-spiral.jl @@ -17,7 +17,7 @@ using Interpolations Make k-space spiral trajectory based on GE 3T scanner constraints Option: -- `N` dimention of reconstructed image +- `N` dimension of reconstructed image - `Nt` # of time points - `fov` field of view in cm - `dt` time sampling interval out; default `5e-6` sec @@ -163,7 +163,7 @@ to gradients at 4us. Multi-shot spiral design uses Duyn's approximate slewrate limited design -augmented with archimedian `gmax` limit +augmented with archimedean `gmax` limit # in [args] * `D` = FOV; cm diff --git a/src/nufft/dtft.jl b/src/nufft/dtft.jl index c2c424e7..2f9eac73 100644 --- a/src/nufft/dtft.jl +++ b/src/nufft/dtft.jl @@ -11,7 +11,6 @@ see also MIRT/time/dtft.jl export dtft_init, dtft, dtft_adj -#using LinearAlgebra: norm using Distributed: @sync, @distributed, pmap using SharedArrays: SharedArray, sdata using LinearMapsAA: LinearMapAA, LinearMapAO @@ -35,7 +34,7 @@ using LinearMapsAA: LinearMapAA, LinearMapAO """ function dtft(w::AbstractVector{<:Real}, x::AbstractVector{<:Number} ; n_shift::Real = 0) - return dtft_loop_n(w, x ; n_shift=n_shift) + return dtft_loop_n(w, x ; n_shift) end @@ -59,7 +58,7 @@ where here `n` is a `CartesianIndex` function dtft(w::AbstractMatrix{<:Real}, x::AbstractMatrix{<:Number} ; n_shift::AbstractVector{<:Real} = zeros(Int, ndims(x)), ) - return dtft_loop_n(w, x ; n_shift=n_shift) + return dtft_loop_n(w, x ; n_shift) end @@ -74,7 +73,7 @@ For 1D DTFT # option - `n_shift::Real` often is N/2; default 0 -- `T::DataType` default `ComplexF64` for testing NUFFT accuracy +- `T::Type` default `ComplexF64` for testing NUFFT accuracy # out - `d::NamedTuple` with fields @@ -84,17 +83,17 @@ function dtft_init( w::AbstractVector{<:Real}, N::Int ; n_shift::Real = 0, - T::DataType = ComplexF64, + T::Type{<:Complex{<:AbstractFloat}} = ComplexF64, ) M = length(w) - forw = x -> dtft(w, x ; n_shift=n_shift) - back = y -> dtft_adj(w, y, N ; n_shift=n_shift) + forw = x -> dtft(w, x ; n_shift) + back = y -> dtft_adj(w, y, N ; n_shift) A = LinearMapAA(forw, back, (M, N), - (name="dtft1", N=(N,)) ; T = ComplexF64, + (name = "dtft1", N = (N,)) ; T = ComplexF64, operator = true, ) - return (dtft=forw, adjoint=back, A=A) + return (dtft=forw, adjoint=back, A) end @@ -108,7 +107,7 @@ for multi-dimensional DTFT (DSFT) # option - `n_shift::AbstractVector{<:Real}` often is N/2; default zeros(D) -- `T::DataType` default `ComplexF64` for testing NUFFT accuracy +- `T::Type` default `ComplexF64` for testing NUFFT accuracy # out - `d::NamedTuple` with fields @@ -124,13 +123,13 @@ function dtft_init( length(N) != D && throw(DimensionMismatch("length(N) vs D=$D")) length(n_shift) != D && throw(DimensionMismatch("length(n_shift) vs D=$D")) M = size(w,1) - forw = x -> dtft(w, x ; n_shift=n_shift) - back = y -> dtft_adj(w, y, N ; n_shift=n_shift) + forw = x -> dtft(w, x ; n_shift) + back = y -> dtft_adj(w, y, N ; n_shift) A = LinearMapAA(forw, back, (M, prod(N)), - (name="dtft$(length(N))", N=N) ; T = ComplexF64, + (name = "dtft$(length(N))", N) ; T = ComplexF64, operator = true, idim = N, ) - return (dtft=forw, adjoint=back, A=A) + return (dtft=forw, adjoint=back, A) end @@ -149,14 +148,14 @@ This is the *adjoint* (transpose) of `dtft`, not an *inverse* DTFT. # option - `n_shift::Real` often is N/2; default 0 -- `T::DataType` output data type; default `ComplexF64` +- `T::Type` output data type; default `ComplexF64` # out - `x::AbstractVector{<:Number} (N)` signal """ function dtft_adj(w::AbstractVector{<:Real}, X::AbstractVector{<:Number}, N::Int ; n_shift::Real = 0, - T::DataType = ComplexF64, + T::Type{<:Complex{<:AbstractFloat}} = ComplexF64, ) M = length(w) out = similar(X, T, N) @@ -183,7 +182,7 @@ where here `n` is a `CartesianIndex` # option - `n_shift::AbstractVector{<:Real}` often is `N/2`; default `zeros(D)` -- `T::DataType` default `(eltype(w) == Float64) ? ComplexF64 : ComplexF32` +- `T::Type` default `(eltype(w) == Float64) ? ComplexF64 : ComplexF32` # out - `x::AbstractArray{<:Number} [(N)]` `D`-dimensional signal @@ -193,7 +192,8 @@ function dtft_adj( X::AbstractVector{<:Number}, N::Dims ; n_shift::AbstractVector{<:Real} = zeros(Int, ndims(x)), - T::DataType = (eltype(w) == Float64) ? ComplexF64 : ComplexF32, + T::Type{<:Complex{<:AbstractFloat}} = + (eltype(w) == Float64) ? ComplexF64 : ComplexF32, ) M, D = size(w) @@ -203,8 +203,6 @@ function dtft_adj( for n in 1:prod(N) idx = CartesianIndices(N)[n] - tmp = cis.(w * (collect(Tuple(idx)) - nshift1)) - tmp = transpose(cis.(w * (collect(Tuple(idx)) - nshift1))) * X out[idx] = cis.(-w * (collect(Tuple(idx)) - nshift1))' * X end return out @@ -254,7 +252,7 @@ function dtft_loop_m( w::AbstractVector{<:Real}, x::AbstractVector{<:Number} ; n_shift::Real = 0, - T::DataType = ComplexF64, + T::Type{<:Complex{<:AbstractFloat}} = ComplexF64, ) M = length(w) N = length(x) @@ -296,7 +294,7 @@ function dtft_pmap_m( x::AbstractVector{<:Number} ; n_shift::Real = 0, ) - tmp = w -> dtft_one_w(w, x ; n_shift=n_shift) + tmp = w -> dtft_one_w(w, x ; n_shift) return pmap(tmp, w) end diff --git a/src/nufft/nufft.jl b/src/nufft/nufft.jl index 2f451145..b120b64f 100644 --- a/src/nufft/nufft.jl +++ b/src/nufft/nufft.jl @@ -18,7 +18,7 @@ _start = N -> isodd(N) ? (N-1)÷2 : N÷2 # where the NFFT sum starts """ - nufft_eltype(::DataType) + nufft_eltype(::Type) ensure plan_nfft eltype is Float32 or Float64 """ nufft_eltype(::Type{<:Integer}) = Float32 @@ -31,7 +31,7 @@ nufft_eltype(T::DataType) = throw("unknown type $T") # see https://github.com/tknopp/NFFT.jl/pull/33 # todo: may be unnecessary with future version of nfft() """ - nufft_typer(T::DataType, x::AbstractArray{<:Real} ; warn::Bool=true) + nufft_typer(T::Type, x::AbstractArray{<:Real} ; warn::Bool=true) type conversion wrapper for `nfft()` """ nufft_typer(::Type{T}, x::T ; warn::Bool=true) where {T} = x # cf convert() diff --git a/src/regularize/Aodwt.jl b/src/regularize/Aodwt.jl index ecadcaeb..5a7b6da2 100644 --- a/src/regularize/Aodwt.jl +++ b/src/regularize/Aodwt.jl @@ -21,7 +21,7 @@ Create orthogonal discrete wavelet transform (ODWT) `LinearMapAA` - `level::Int` # of levels; default 3 - `wt` wavelet transform type (see `Wavelets` package); default Haar - `operator::Bool=true` default to `LinearMapAO` -- `T::DataType` : `Float32` by default; use `ComplexF32` if needed +- `T::Type` : `Float32` by default; use `ComplexF32` if needed # out - `A` a `LinearMapAX` object @@ -33,7 +33,7 @@ which is useful when imposing scale-dependent regularization """ function Aodwt( dims::Dims ; - T::DataType = Float32, + T::Type{<:Complex{<:AbstractFloat}} = ComplexF32, level::Int = 3, wt = wavelet(WT.haar), operator::Bool = true, # ! diff --git a/src/regularize/diffl.jl b/src/regularize/diffl.jl index bd8ab91c..5886347a 100644 --- a/src/regularize/diffl.jl +++ b/src/regularize/diffl.jl @@ -1,6 +1,6 @@ #= diffl.jl -Left finite differences "in-place" (pre-allocated outpus) +Left finite differences "in-place" (pre-allocated outputs) Could use StaticKernels.jl for this; see timing test in ../../time. diff --git a/src/system/Afft.jl b/src/system/Afft.jl index 39511f6e..c1a6b9f9 100644 --- a/src/system/Afft.jl +++ b/src/system/Afft.jl @@ -25,7 +25,7 @@ In: - `fdim = 1:D` apply fft/bfft only along these dimensions Option: -- `T::DataType = ComplexF32` +- `T::Type = ComplexF32` - `operator::Bool = true` return a `LinearMapAO` set to `false` to return a `LinearMapAM` - `unitary::Bool = false` set to `true` for unitary DFT @@ -39,7 +39,7 @@ function Afft( xdim::Dims{D}, fdim = 1:D, ; - T::DataType = ComplexF32, + T::Type{<:Complex{<:AbstractFloat}} = ComplexF32, operator::Bool = true, # ! unitary::Bool = false, work::AbstractArray{Tw,D} = Array{T,D}(undef, xdim), @@ -109,7 +109,7 @@ using given sampling pattern `samp`. Especially for compressed sensing MRI with Cartesian sampling. Option: -- `T::DataType = ComplexF32` +- `T::Type = ComplexF32` - `dims = 1:D` apply fft/bfft only along these dimensions - `fft_forward::Bool = true` Use `false` to have `bfft!` in forward model. - `operator::Bool = true` set to `false` to return a `LinearMapAM` @@ -123,7 +123,7 @@ function Afft( samp::AbstractArray{<:Bool, D}, ; dims = 1:D, - T::DataType = ComplexF32, + T::Type{<:Complex{<:AbstractFloat}} = ComplexF32, operator::Bool = true, # ! work::AbstractArray{Tw,D} = similar(samp, T), fft_forward::Bool = true, diff --git a/src/system/Asense.jl b/src/system/Asense.jl index ca236fdd..ca15569f 100644 --- a/src/system/Asense.jl +++ b/src/system/Asense.jl @@ -26,7 +26,7 @@ or a Vector of `ncoil` arrays of size `size(samp)`. - `smaps::Vector{<:AbstractArray{<:Number}}` or `AbstractArray{<:Number}` # Option -- `T::DataType = ComplexF32` +- `T::Type = ComplexF32` - `dims = 1:D` apply fft/bfft only along these dimensions - `fft_forward::Bool = true` Use `false` to have `bfft!` in forward model. - `unitary::Bool = false` set to `true` for unitary DFT @@ -40,7 +40,7 @@ function Asense( smaps::Vector{<:AbstractArray{<:Number}}, ; dims = 1:D, - T::DataType = ComplexF32, + T::Type{<:Complex{<:AbstractFloat}} = ComplexF32, work1::AbstractArray{Tw,D} = similar(samp, T), work2::AbstractArray{Tw,D} = similar(samp, T), unitary::Bool = false, diff --git a/src/utility/downsample.jl b/src/utility/downsample.jl index 27c24ffc..8dced22f 100644 --- a/src/utility/downsample.jl +++ b/src/utility/downsample.jl @@ -93,7 +93,7 @@ Downsample by averaging by integer factors. # option - `warn::Bool` warn if noninteger multiple; default `isinteractive()` -- `T::DataType` specify output eltype; default `eltype(x[1] / down[1])` +- `T::Type` specify output eltype; default `eltype(x[1] / down[1])` # out - `y [nx/down ny/down]` @@ -102,7 +102,7 @@ function downsample2( x::AbstractMatrix{<:Number}, down::NTuple{2,Int} ; warn::Bool = isinteractive(), - T::DataType = eltype(x[1] / down[1]) + T::Type{<:Number} = eltype(x[1] / down[1]) ) idim = size(x) @@ -148,7 +148,7 @@ Downsample by averaging by integer factors. # option - `warn::Bool` warn if noninteger multiple; default true -- `T::DataType` specify output eltype; default `eltype(x[1] / down[1])` +- `T::Type` specify output eltype; default `eltype(x[1] / down[1])` # out - `y (nx/down,ny/down,nz/down)` @@ -157,7 +157,7 @@ function downsample3( x::AbstractArray{<:Number,3}, down::NTuple{3,Int} ; warn::Bool = isinteractive(), - T::DataType = eltype(x[1] / down[1]), + T::Type{<:Number} = eltype(x[1] / down[1]), ) idim = size(x) @@ -176,7 +176,7 @@ downsample3(x::AbstractArray{<:Number,3}, down::Int ; args...) = function downsample3_loop( x::AbstractArray{<:Number,3}, down::NTuple{3,Int} ; - T::DataType = eltype(x[1] / down[1]), + T::Type{<:Number} = eltype(x[1] / down[1]), ) odim = size(x) .÷ down diff --git a/test/mri/exp_xform.jl b/test/mri/exp_xform.jl index 90834e7d..68c12cd4 100644 --- a/test/mri/exp_xform.jl +++ b/test/mri/exp_xform.jl @@ -5,7 +5,7 @@ using Test: @test, @test_throws, @inferred # test for given data type -function exp_xform_test( ; T::DataType = ComplexF32) +function exp_xform_test( ; T::Type{<:Complex{<:AbstractFloat}} = ComplexF32) modes = (:element, :row, :column) diff --git a/test/nufft/nufft.jl b/test/nufft/nufft.jl index fd52eaea..fbfb5cc8 100644 --- a/test/nufft/nufft.jl +++ b/test/nufft/nufft.jl @@ -19,7 +19,8 @@ Simple 1D NUFFT tests. """ function nufft_test1( ; M::Int = 30, N::Int = 20, n_shift::Real = 1.7, - T::DataType = Float64, tol::Real = 7e-6, + T::Type{<:Number} = Float64, + tol::Real = 7e-6, ) w = (rand(M) .- 0.5) * 2π @@ -81,7 +82,8 @@ function nufft_test2( ; M::Int = 35, N::Dims = (10,8), n_shift::AbstractVector{<:Real} = [4,3], - T::DataType = Float64, tol::Real = 2e-6, + T::Type{<:Number} = Float64, + tol::Real = 2e-6, ) w = [] diff --git a/time/exp_xform.jl b/time/exp_xform.jl index 7d5cb07f..86063478 100644 --- a/time/exp_xform.jl +++ b/time/exp_xform.jl @@ -8,7 +8,7 @@ using BenchmarkTools: @btime # timing test -function exp_xform_time( ; T::DataType = ComplexF32) +function exp_xform_time( ; T::Type{<:Complex{<:AbstractFloat}} = ComplexF32) modes = (:element, :row, :column)