Allow user to specify output domain (fourier) for pipeline - #29
Conversation
|
Benchmark of the qpretrieve-only pipeline:
tests\test_bm\test_bm_oah_output_domain.py ... [100%]
---------------------------------------------------------------------------------------------------------- benchmark: 3 tests ----------------------------------------------------------------------------------------------------------
Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_bm_oah_output_domain_fourier[64] 576.6000 (1.0) 1,628.1000 (1.02) 639.0052 (1.0) 71.1883 (1.17) 625.7000 (1.0) 39.3750 (1.0) 93;99 1,564.9326 (1.0) 1145 1
test_bm_oah_output_domain_fourier_then_spatial[64] 882.6000 (1.53) 1,900.6000 (1.19) 954.7940 (1.49) 60.6353 (1.0) 935.2000 (1.49) 43.2000 (1.10) 108;71 1,047.3464 (0.67) 828 1
test_bm_oah_output_domain_spatial[64] 1,028.7000 (1.78) 1,599.9000 (1.0) 1,148.6064 (1.80) 94.5220 (1.56) 1,151.4000 (1.84) 124.9000 (3.17) 159;11 870.6202 (0.56) 466 1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
Benchmark of the qpretrieve+nrefocus pipeline (nrefocus branch is currently local).
tests\test_bm\test_bm_full_pipeline.py ... [100%]
------------------------------------------------------------------------------------------------------ benchmark: 3 tests ------------------------------------------------------------------------------------------------------
Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_bm_full_pipeline_fourier_no_finalize[64] 607.2000 (1.0) 4,476.8000 (2.66) 653.8315 (1.0) 105.4580 (1.16) 645.5000 (1.0) 19.4500 (1.0) 28;74 1.5294 (1.0) 1464 1
test_bm_full_pipeline_fourier[64] 739.0000 (1.22) 3,365.5000 (2.00) 878.5532 (1.34) 152.7670 (1.68) 814.8000 (1.26) 170.9000 (8.79) 133;40 1.1382 (0.74) 1206 1
test_bm_full_pipeline_spatial[64] 859.8000 (1.42) 1,682.1000 (1.0) 927.0214 (1.42) 91.1290 (1.0) 904.7000 (1.40) 26.6000 (1.37) 22;41 1.0787 (0.71) 322 1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
Some points and questions @paulmueller. I would like you input if you have time.
|
I would say
Makes sense.
I think this is good.
The linear tilt in the phase (left column) when padding is disabled might confuse the user. Do you know where this comes from? A tilt in the phase hints toward an incorrect frequency of the sideband detected for the hologram. |
The sideband is found correctly by qpretrieve (red dot in top row). Here is a plot with a square input (to allow padding=0), and with padding=1,2 also. The tilt occurs regardless of filter size. I guess the lack of padding combined with the off-axis acquisition results in this tilt. Thoughts? Python script: |
Comparing the spatial and fourier pipelines you get (with
The reason (afaik) that the paddded pipelines are different is that:
If you set
That the padded comparison bewteen spatial and fourier pipelines are not (as I expected) identical. |
I tried some alternative peak finding algorithms and they all appear to have issues with this sample. I think we can create an issue to track this. Right now, I would remove the example and instead clarify in the docs that the unpadded pipeline remains identical between spatial and fourier domains, whereas the padded version doesn't (esp. around the image edges, due to padding). Tracked in #30 |
|
Hey @paulmueller I am tracking the peak finding issue in #30. I made the above changes to the examples and docs. If sufficient please let me know and we can merge and release :) |



As described in #28, I want to allow the user to output the fourier-domain field directly without doing the final iFFT. This removes an unnecessary Fourier transform. When combined with nrefocus (branch-link here) this will remove two unnecessary Fourier transforms and is ~30% faster than the original "spatial" pipeline. The total pipeline (with nrefocus is about 20% faster #29 (comment)).
I went away from doing
skip_ifftas discussed in #28 becauseinput/output_domain='spatial/fourier'is broader and works in nrefocus nicely. I also thought this would be much simpler, but having the ability to keep the metadata with the outputted Fourier-domain field is important for the final iFFT.The final iFFT can be done with either qpretrieve or nrefocus (which calls the qpretrieve object in the background).
Ignoring propagation with nrefocus, the legacy (old) and direct (here, new) pipelines are always the same. When dealing with nrefocus, depending on the user's choice of qpretrieve input params, the old and new pipelines may or may not differ slightly. See the new example in the docs showing how padding effects the final output.
Todo
added version 0.6.xeverywhere necessary