Skip to content

Commit eee9be7

Browse files
authored
Merge pull request #152 from JuliaMath/nh/fixDocs
Fix doctests
2 parents 7cbb569 + 8b6a09e commit eee9be7

File tree

7 files changed

+144
-182
lines changed

7 files changed

+144
-182
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ jobs:
6363
- uses: julia-actions/setup-julia@v2
6464
with:
6565
version: '1'
66-
- name: Install subpackages
67-
shell: julia --color=yes --project=. {0}
68-
run: |
69-
using Pkg
70-
Pkg.add(PackageSpec(path=pwd(), subdir="AbstractNFFTs"))
71-
Pkg.add(PackageSpec(path=pwd(), subdir="NFFTTools"))
72-
- uses: julia-actions/julia-buildpkg@latest
73-
- uses: julia-actions/julia-docdeploy@latest
66+
- run: |
67+
julia --project=docs -e '
68+
using Pkg
69+
Pkg.add(PackageSpec(path=pwd()))
70+
Pkg.add(PackageSpec(path=pwd(), subdir="AbstractNFFTs"))
71+
Pkg.add(PackageSpec(path=pwd(), subdir="NFFTTools"))
72+
Pkg.instantiate()'
73+
- run: julia --project=docs docs/make.jl
7474
env:
7575
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76-
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
76+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

AbstractNFFTs/src/AbstractNFFTs.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export AbstractFTPlan, AbstractRealFTPlan, AbstractComplexFTPlan,
2121
export deconvolve!, deconvolve_transpose!, convolve!, convolve_transpose!
2222

2323
# derived
24-
export nfft, nfft_transpose, nfft_adjoint, ndft, ndft_adjoint,
25-
nfct, nfct_transpose, nftct_adjoint, ndct, ndct_transpose,
26-
nfst, nfst_transpose, nfst_adjoint
24+
export nfft, nfft_adjoint, ndft, ndft_adjoint,
25+
nfct, nfct_transpose, ndct, ndct_transpose,
26+
nfst, nfst_transpose
2727

2828
# misc
2929
export TimingStats, accuracyParams, reltolToParams, paramsToReltol,

AbstractNFFTs/src/derived.jl

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,6 @@ julia> with(nfft_backend => NonuniformFFTs.backend()) do
8888
```
8989
"""
9090
nfft_adjoint
91-
"""
92-
nfft_transpose(k, N, fHat, rest...; kwargs...)
93-
nfft_transpose(backend, k, N, fHat, rest...; kwargs...)
94-
95-
calculates the transpose nfft of the vector `fHat` for the nodes contained in the matrix `k`.
96-
The output is an array of size `N`.
97-
98-
Uses the active AbstractNFFTs `backend` if no `backend` argument is provided. Backends can be activated with `BackendModule.activate!()`.
99-
Backends can also be set with a scoped value overriding the current active backend within a scope:
100-
101-
```julia
102-
julia> NFFT.activate!()
103-
104-
julia> nfft_transpose(k, N, fHat, rest...; kwargs...) # uses NFFT
105-
106-
julia> with(nfft_backend => NonuniformFFTs.backend()) do
107-
nfft_transpose(k, N, fHat, rest...; kwargs...) # uses NonuniformFFTs
108-
end
109-
```
110-
"""
111-
nfft_transpose
11291

11392
"""
11493
nfct(k, f, rest...; kwargs...)
@@ -120,16 +99,6 @@ The output is a vector of length M=`size(nodes,2)`.
12099
Uses the active AbstractNFFTs `backend` if no `backend` argument is provided. Backends can be activated with `BackendModule.activate!()`.
121100
"""
122101
nfct
123-
"""
124-
nfct_adjoint(k, N, fHat, rest...; kwargs...)
125-
nfct_adjoint(backend, k, N, fHat, rest...; kwargs...)
126-
127-
calculates the adjoint nfct of the vector `fHat` for the nodes contained in the matrix `k`.
128-
The output is an array of size `N`.
129-
130-
Uses the active AbstractNFFTs `backend` if no `backend` argument is provided. Backends can be activated with `BackendModule.activate!()`.
131-
"""
132-
nfct_adjoint
133102
"""
134103
nfct_transpose(k, N, fHat, rest...; kwargs...)
135104
nfct_transpose(backend, k, N, fHat, rest...; kwargs...)
@@ -151,16 +120,6 @@ The output is a vector of length M=`size(nodes,2)`.
151120
Uses the active AbstractNFFTs `backend` if no `backend` argument is provided. Backends can be activated with `BackendModule.activate!()`.
152121
"""
153122
nfst
154-
"""
155-
nfst_adjoint(k, N, fHat, rest...; kwargs...)
156-
nfst_adjoint(backend, k, N, fHat, rest...; kwargs...)
157-
158-
calculates the adjoint nfst of the vector `fHat` for the nodes contained in the matrix `k`.
159-
The output is an array of size `N`.
160-
161-
Uses the active AbstractNFFTs `backend` if no `backend` argument is provided. Backends can be activated with `BackendModule.activate!()`.
162-
"""
163-
nfst_adjoint
164123
"""
165124
nfst_transpose(k, N, fHat, rest...; kwargs...)
166125
nfst_transpose(backend, k, N, fHat, rest...; kwargs...)

NFFTTools/src/Toeplitz.jl

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -20,58 +20,58 @@ Calculate the kernel for an implementation of the Gram matrix that utilizes its
2020
- `kwargs`: Passed on to [`plan_fft!`](https://juliamath.github.io/AbstractFFTs.jl/stable/api/#AbstractFFTs.plan_fft!) via `NFFTPlan`; can be used to modify the flags `flags=FFTW.ESTIMATE, timelimit=Inf`.
2121
2222
# Examples
23-
```jldoctest; output = false, setup = :(using NFFT, NFFTTools, Random; Random.seed!(1))
23+
```jldoctest; output = false, setup = :(using NFFT, NFFTTools, StableRNGs, Random; rng = StableRNG(1); Random.seed!(rng, 1); Random.seed!(rng, 1))
2424
julia> Nx = 32;
2525
26-
julia> trj = Float32.(rand(2, 1000) .- 0.5);
26+
julia> trj = Float32.(rand(rng, 2, 1000) .- 0.5);
2727
2828
julia> λ = calculateToeplitzKernel((Nx, Nx), trj)
2929
64×64 Matrix{ComplexF32}:
30-
-432.209+297.833im 271.68-526.348im3044.35+34.6322im
31-
990.057-244.569im -582.825+473.084im 45.7631-87.8965im
32-
1922.01+223.525im 9248.63-452.04im 3649.78+108.941im
33-
-402.371-3.37619im 496.815+231.891im 322.646-329.089im
34-
-482.346-121.534im 559.756-106.981im 155.183+454.0im
35-
3293.8+194.388im -3361.43+34.1272im2672.16-526.853im
36-
-936.331+172.246im 4394.11-400.762im -1121.04+160.219im
37-
-135.828+169.448im 3509.17+59.0678im 3883.84-501.913im
38-
395.143+158.638im 24.4377-387.153im 5731.3+173.827im
39-
925.902-117.765im 2935.3+346.28im -1414.12-214.701im
30+
-1528.64-170.936im -622.032+56.4626im2570.27-41.6055im
31+
3685.0+276.482im 2282.33-162.009im 2142.57-63.9413im
32+
-125.272-342.877im 819.441+228.404im 4293.36+130.336im
33+
940.796+31.5781im -852.504+82.8948im 2681.78+180.963im
34+
445.039-252.226im -1552.49+137.753im -2037.24+39.6851im
35+
493.161+173.293im 664.534-58.8202im1463.51+39.2481im
36+
332.265-180.768im -2650.6+66.2951im -2778.37-31.7731im
37+
2079.48-127.658im 4891.04+242.131im 3734.65+340.2im
38+
120.836-265.792im 10931.5+151.319im 4528.12+53.2504im
39+
-1247.63+356.045im -198.919-241.572im 46.912-143.504im
4040
⋮ ⋱
41-
2239.72-295.883im 490.442+524.399im2028.84-36.5824im
42-
-1108.11+227.146im 24.7403-455.661im -549.699+105.319im
43-
1323.78+110.713im -321.052+117.802im 651.944-443.178im
44-
-52.1597+288.0im -326.042-516.516im 3619.1+44.4651im
45-
1180.56+73.3666im -26.1233+155.148im -869.065-405.832im
46-
3555.36+649.527im -198.245-878.042im 1198.83-317.062im
47-
-368.958-177.954im -360.343+406.469im -1478.96-154.512im
48-
4861.29+38.9623im 6082.55-267.478im 2519.09+293.503im
49-
1022.55-185.869im 177.426+414.384im 3650.56-146.597im
41+
-340.961+142.965im 6010.83-28.4918im2779.73+69.5765im
42+
-1826.62-161.638im 1103.42+47.1655im 2479.09-50.9026im
43+
2267.81+80.567im 1044.85+33.9058im 2327.04+131.974im
44+
1467.38-89.7949im 3410.85-24.6781im 1980.45-122.746im
45+
167.15+342.008im 1476.08-227.535im 2143.39-129.466im
46+
-724.138-204.324im 1686.02+89.8505im-244.694-8.21769im
47+
237.304-84.753im -1067.19+199.226im -128.015+297.294im
48+
1848.84+50.5511im 1926.33-165.024im -937.614-263.092im
49+
1912.83-152.94im 741.748+267.413im -343.194+365.481im
5050
5151
julia> y = randn(ComplexF32, Nx, Nx);
5252
5353
julia> convolveToeplitzKernel!(y, λ)
5454
32×32 Matrix{ComplexF32}:
55-
177.717-52.0493im 10.6059+20.7185im 746.131+330.005im
56-
-311.858+988.219im -1216.83-1295.14im 410.732+751.925im
57-
-1082.27+872.968im 1023.97-1556.45im -923.699+478.63im
58-
-999.035-525.161im -1694.59-658.558im -521.044+607.005im
59-
-342.999+1481.82im -1729.18-2712.81im 56.5212+1394.81im
60-
-1187.65-1979.55im 1389.67+970.033im2968.93-744.264im
61-
-666.533+485.511im -1315.83+409.855im -610.146+132.258im
62-
1159.57+64.6059im -299.169-569.622im 663.802+396.827im
63-
-795.112-1464.63im -462.43+2442.77im -1622.72+1701.27im
64-
-1047.67+31.5578im -1127.65-936.043im 474.071+797.911im
55+
-718.038+2035.75im -1771.79+191.592im-1087.95+260.256im
56+
-472.432+473.74im -1894.01+1138.22im -295.522-647.603im
57+
139.463+1137.28im 184.53+228.995im 788.817-355.36im
58+
2966.54-1767.96im 255.169+590.332im 341.963+94.7469im
59+
-594.67-538.93im 180.487-566.905im 69.4853+481.47im
60+
-1004.42-111.931im 2439.67-323.525im-448.47+1459.57im
61+
-341.784+49.591im -268.101-750.184im 1309.23-108.091im
62+
189.394+638.56im -821.709+121.441im 100.152-914.375im
63+
-192.401-702.179im -1564.33-536.778im 1448.4-971.389im
64+
492.427-1121.14im -3270.99+249.791im -245.744+1659.15im
6565
⋮ ⋱
66-
327.345+2191.71im -904.635+558.786im -1449.32-276.721im
67-
-1047.2-71.362im 363.109+567.346im -1974.0-2348.36im
68-
-1540.45+1661.77im 1175.75+1279.75im 1110.61+653.234im
69-
-526.832-435.297im -265.021-2019.08im 68.5607-323.086im
70-
-1076.52-2719.16im -477.005+2232.06im -155.59-1275.66im
71-
1143.76-735.966im -380.489+2485.78im 1812.17-261.191im
72-
1685.44-1243.29im 1911.16-1157.72im -991.639-42.8214im
73-
1054.11-1282.41im 66.9358-588.991im … -952.238+1026.35im
74-
-417.276-273.367im -946.698+1971.77im -890.339-882.05im
66+
1309.34+98.404im 73.0096-1181.38im 557.821-1096.24im
67+
907.312+129.232im -44.5222+1075.8im -879.056-180.416im
68+
-1020.87-671.83im -1019.44-778.932im-878.007+2165.44im
69+
-392.366-745.654im -279.611-1023.18im 804.285-51.4734im
70+
-1139.86-549.792im -1135.39+1236.09im 538.431+1891.79im
71+
391.965+974.582im -1445.21-1113.64im 1172.98+116.43im
72+
-870.086-1002.25im 1100.69+846.779im -377.282-602.989im
73+
928.376-163.128im -1009.71+1075.25im … -444.653-140.651im
74+
268.106+635.919im 919.454-170.406im 233.847-1058.75im
7575
7676
```
7777
"""
@@ -96,12 +96,12 @@ Calculate the kernel for an implementation of the Gram matrix that utilizes its
9696
- `fftplan`: plan for the final FFT of the kernel from image to k-space. Therefore, it has to have twice the size of the original image. Calculate, e.g., with `fftplan = plan_fft(zeros(Complex{T}, 2 .* shape); flags=FFTW.MEASURE)`, where `shape` is the size of the reconstructed image.
9797
9898
# Examples
99-
```jldoctest; output = false, setup = :(using NFFT, NFFTTools, Random; Random.seed!(1))
100-
julia> using FFTW
99+
```jldoctest; output = false, setup = :(using NFFT, NFFTTools, NFFTTools.FFTW, StableRNGs, Random; rng = StableRNG(1); Random.seed!(rng, 1); Random.seed!(rng, 1))
100+
julia> using NFFTTools.FFTW
101101
102102
julia> Nx = 32;
103103
104-
julia> trj = Float32.(rand(2, 1000) .- 0.5);
104+
julia> trj = Float32.(rand(rng, 2, 1000) .- 0.5);
105105
106106
julia> p = plan_nfft(trj, (2Nx,2Nx))
107107
NFFTPlan with 1000 sampling points for an input array of size(64, 64) and an output array of size(1000,) with dims 1:2
@@ -112,7 +112,7 @@ julia> λ = Array{ComplexF32}(undef, 2Nx, 2Nx);
112112
113113
julia> calculateToeplitzKernel!(λ, p, trj, fftplan);
114114
115-
julia> y = randn(ComplexF32, Nx, Nx);
115+
julia> y = randn(rng, ComplexF32, Nx, Nx);
116116
117117
julia> convolveToeplitzKernel!(y, λ);
118118
@@ -175,12 +175,12 @@ Convolves the image `y` with the Toeplitz kernel `λ` and overwrites `y` with th
175175
- `xOS2`: pre-allocated array of the size of `λ`. Pre-allocate with `xOS2 = similar(λ)`.
176176
177177
# Examples
178-
```jldoctest; output = false, setup = :(using NFFT, NFFTTools, Random; Random.seed!(1))
179-
julia> using FFTW
178+
```jldoctest; output = false, setup = :(using NFFT, NFFTTools, NFFTTools.FFTW, StableRNGs, Random; rng = StableRNG(1); Random.seed!(rng, 1))
179+
julia> using NFFTTools.FFTW
180180
181181
julia> Nx = 32;
182182
183-
julia> trj = Float32.(rand(2, 1000) .- 0.5);
183+
julia> trj = Float32.(rand(rng, 2, 1000) .- 0.5);
184184
185185
julia> λ = calculateToeplitzKernel((Nx, Nx), trj);
186186
@@ -192,30 +192,30 @@ julia> fftplan = plan_fft(xOS1; flags=FFTW.MEASURE);
192192
193193
julia> ifftplan = plan_ifft(xOS1; flags=FFTW.MEASURE);
194194
195-
julia> y = randn(ComplexF32, Nx, Nx);
195+
julia> y = randn(rng, ComplexF32, Nx, Nx);
196196
197197
julia> convolveToeplitzKernel!(y, λ, fftplan, ifftplan, xOS1, xOS2)
198198
32×32 Matrix{ComplexF32}:
199-
177.717-52.0493im 10.6059+20.7185im746.131+330.005im
200-
-311.858+988.219im -1216.83-1295.14im 410.732+751.925im
201-
-1082.27+872.968im 1023.97-1556.45im -923.699+478.63im
202-
-999.035-525.161im -1694.59-658.558im -521.044+607.005im
203-
-342.999+1481.82im -1729.18-2712.81im 56.5212+1394.81im
204-
-1187.65-1979.55im 1389.67+970.033im 2968.93-744.264im
205-
-666.533+485.511im -1315.83+409.855im -610.146+132.258im
206-
1159.57+64.6059im -299.169-569.622im 663.802+396.827im
207-
-795.112-1464.63im -462.43+2442.77im -1622.72+1701.27im
208-
-1047.67+31.5578im -1127.65-936.043im 474.071+797.911im
199+
-783.38-230.709im -41.2715-196.622im1051.97+1655.19im
200+
306.303+931.416im -212.223-960.781im -270.816-4.68915im
201+
1018.79+974.724im 1204.28-1286.06im 398.504+298.177im
202+
138.68+346.405im 225.016-586.742im 397.565-205.818im
203+
402.152+725.267im 731.119-307.097im 810.773-244.329im
204+
680.202-682.887im -7.59145-254.964im-1219.87-1119.43im
205+
-64.0526-909.241im 61.5645+1199.98im 253.19-630.097im
206+
-835.246-993.775im -1561.78+969.924im -7.08272+1755.43im
207+
163.15-212.155im 1282.88+250.916im 819.356+1184.85im
208+
71.7218-933.054im 772.495-39.3827im 495.359+2949.17im
209209
⋮ ⋱
210-
327.345+2191.71im -904.635+558.786im -1449.32-276.721im
211-
-1047.2-71.362im 363.109+567.346im -1974.0-2348.36im
212-
-1540.45+1661.77im 1175.75+1279.75im 1110.61+653.234im
213-
-526.832-435.297im -265.021-2019.08im 68.5607-323.086im
214-
-1076.52-2719.16im -477.005+2232.06im -155.59-1275.66im
215-
1143.76-735.966im -380.489+2485.78im 1812.17-261.191im
216-
1685.44-1243.29im 1911.16-1157.72im -991.639-42.8214im
217-
1054.11-1282.41im 66.9358-588.991im -952.238+1026.35im
218-
-417.276-273.367im -946.698+1971.77im -890.339-882.05im
210+
-499.452-192.12im -589.649+1561.74im 1544.92+126.5im
211+
-347.838+791.432im -112.339+269.57im -1068.77+452.493im
212+
1861.73-494.369im 416.406+499.465im-1856.07-211.381im
213+
176.94+984.977im 874.282+41.8216im -1717.71+1169.11im
214+
516.513+270.692im 531.069+1907.76im -697.752+42.6127im
215+
-65.358-411.893im -1299.86-868.781im -285.473-1803.2im
216+
-15.1395+439.582im 84.4428+2026.06im 13.6334+24.6603im
217+
-1146.97+1632.87im -208.162+1114.2im -295.39+854.479im
218+
502.986+591.013im -1013.11+97.8801im 617.683+17.4492im
219219
220220
```
221221
"""

docs/Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
33
NFFTTools = "7424e34d-94f7-41d6-98a0-85abaf1b6c91"
4+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
45

56
[compat]
6-
Documenter = "0.25"
7+
Documenter = "1"
8+
StableRNGs = "1"

docs/make.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ DocMeta.setdocmeta!(NFFT, :DocTestSetup, :(using NFFT, NFFTTools); recursive=tru
1010
DocMeta.setdocmeta!(NFFTTools, :DocTestSetup, :(using NFFT, NFFTTools); recursive=true)
1111

1212
makedocs(;
13-
doctest = true,
1413
#strict = :doctest,
1514
modules = [NFFT,NFFTTools],
1615
sitename = "NFFT",
@@ -30,7 +29,9 @@ makedocs(;
3029
#"Implementation" => "implementation.md",
3130
"AbstractNFFTs" => "abstract.md",
3231
"API" => "api.md",
33-
]
32+
],
33+
doctestfilters = [r"(\d*)\.(\d{1})\d*" => s"\1.\2***"],
34+
doctest = false
3435
)
3536

3637
deploydocs(repo = "github.com/JuliaMath/NFFT.jl.git")

0 commit comments

Comments
 (0)