waveorder 1.0.0rc1__tar.gz → 1.0.0rc3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. waveorder-1.0.0rc3/.git-blame-ignore-revs +4 -0
  2. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/PKG-INFO +6 -3
  3. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/README.md +2 -2
  4. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/examples/2D_QLIPP_simulation/2D_QLIPP_forward.py +8 -8
  5. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/examples/2D_QLIPP_simulation/2D_QLIPP_recon.py +1 -1
  6. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/examples/3D_PODT_phase_simulation/3D_PODT_Phase_forward.py +4 -4
  7. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/examples/3D_PODT_phase_simulation/3D_PODT_Phase_recon.py +3 -3
  8. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/examples/PTI_simulation/PTI_Simulation_Forward_2D3D.py +15 -11
  9. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/examples/PTI_simulation/PTI_Simulation_Recon2D.py +9 -8
  10. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/examples/PTI_simulation/PTI_Simulation_Recon3D.py +12 -12
  11. waveorder-1.0.0rc3/examples/README.md +12 -0
  12. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/setup.cfg +1 -2
  13. waveorder-1.0.0rc3/tests/test_examples.py +40 -0
  14. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder/_version.py +1 -2
  15. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder/util.py +0 -50
  16. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder/visual.py +24 -45
  17. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder/waveorder_reconstructor.py +1 -1
  18. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder.egg-info/PKG-INFO +6 -3
  19. waveorder-1.0.0rc3/waveorder.egg-info/SOURCES.txt +49 -0
  20. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder.egg-info/requires.txt +1 -2
  21. waveorder-1.0.0rc1/examples/2D_QLIPP_simulation/2D_QLIPP_forward.ipynb +0 -457
  22. waveorder-1.0.0rc1/examples/2D_QLIPP_simulation/2D_QLIPP_recon.ipynb +0 -482
  23. waveorder-1.0.0rc1/examples/3D_PODT_phase_simulation/3D_PODT_Phase_forward.ipynb +0 -421
  24. waveorder-1.0.0rc1/examples/3D_PODT_phase_simulation/3D_PODT_Phase_recon.ipynb +0 -278
  25. waveorder-1.0.0rc1/examples/PTI_experiment/PTI_Experiment_Recon3D_anisotropic_target_small.py +0 -619
  26. waveorder-1.0.0rc1/examples/PTI_experiment/PTI_full_FOV_anisotropic_target.py +0 -572
  27. waveorder-1.0.0rc1/examples/PTI_experiment/PTI_full_FOV_cardiac_muscle.py +0 -754
  28. waveorder-1.0.0rc1/examples/PTI_experiment/PTI_full_FOV_cardiomyocyte_infected_1.py +0 -715
  29. waveorder-1.0.0rc1/examples/PTI_experiment/PTI_full_FOV_cardiomyocyte_infected_2.py +0 -717
  30. waveorder-1.0.0rc1/examples/PTI_experiment/PTI_full_FOV_cardiomyocyte_mock.py +0 -720
  31. waveorder-1.0.0rc1/examples/PTI_experiment/PTI_full_FOV_human_uterus.py +0 -758
  32. waveorder-1.0.0rc1/examples/PTI_experiment/PTI_full_FOV_mouse_brain_aco.py +0 -685
  33. waveorder-1.0.0rc1/examples/PTI_simulation/PTI_Simulation_Forward_2D3D.ipynb +0 -1816
  34. waveorder-1.0.0rc1/examples/PTI_simulation/PTI_Simulation_Recon2D.ipynb +0 -886
  35. waveorder-1.0.0rc1/examples/PTI_simulation/PTI_Simulation_Recon3D.ipynb +0 -1279
  36. waveorder-1.0.0rc1/examples/Reader_Writer_Examples/Writer_Example.ipynb +0 -883
  37. waveorder-1.0.0rc1/examples/multiProcessing/Deconvolve_Phase3D_Fluor_waveorder.py +0 -138
  38. waveorder-1.0.0rc1/examples/multiProcessing/Phase3D_fluor_deconv_waveorder_all_channels.py +0 -153
  39. waveorder-1.0.0rc1/examples/multiProcessing/QLIPP_4_states_fluor_deconv_waveorder.py +0 -173
  40. waveorder-1.0.0rc1/tests/conftest.py +0 -176
  41. waveorder-1.0.0rc1/tests/reader/test_multipagetiff.py +0 -157
  42. waveorder-1.0.0rc1/tests/reader/test_pycromanager.py +0 -76
  43. waveorder-1.0.0rc1/tests/reader/test_reader.py +0 -408
  44. waveorder-1.0.0rc1/tests/reader/test_singlepagetiff.py +0 -155
  45. waveorder-1.0.0rc1/tests/reader/test_zarrfile.py +0 -97
  46. waveorder-1.0.0rc1/tests/reconstructor/__init__.py +0 -0
  47. waveorder-1.0.0rc1/tests/writer/__init__.py +0 -0
  48. waveorder-1.0.0rc1/tests/writer/test_default_writer.py +0 -192
  49. waveorder-1.0.0rc1/tests/writer/test_hcs_writer.py +0 -214
  50. waveorder-1.0.0rc1/waveorder/io/__init__.py +0 -5
  51. waveorder-1.0.0rc1/waveorder/io/multipagetiff.py +0 -377
  52. waveorder-1.0.0rc1/waveorder/io/pycromanager.py +0 -170
  53. waveorder-1.0.0rc1/waveorder/io/reader.py +0 -287
  54. waveorder-1.0.0rc1/waveorder/io/reader_base.py +0 -33
  55. waveorder-1.0.0rc1/waveorder/io/singlepagetiff.py +0 -383
  56. waveorder-1.0.0rc1/waveorder/io/upti.py +0 -197
  57. waveorder-1.0.0rc1/waveorder/io/writer.py +0 -176
  58. waveorder-1.0.0rc1/waveorder/io/writer_structures.py +0 -644
  59. waveorder-1.0.0rc1/waveorder/io/zarrfile.py +0 -315
  60. waveorder-1.0.0rc1/waveorder.egg-info/SOURCES.txt +0 -85
  61. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/.github/workflows/pytests.yml +0 -0
  62. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/.gitignore +0 -0
  63. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/CITATION.cff +0 -0
  64. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/Fig_Readme.png +0 -0
  65. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/LICENSE +0 -0
  66. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/examples/PTI_simulation/PTI_formulation.html +0 -0
  67. {waveorder-1.0.0rc1/examples → waveorder-1.0.0rc3/examples/experimental_reconstructions}/PTI_experiment/PTI_Experiment_Recon3D_anisotropic_target_small.ipynb +0 -0
  68. {waveorder-1.0.0rc1/examples → waveorder-1.0.0rc3/examples/experimental_reconstructions}/PTI_experiment/PTI_full_FOV_anisotropic_target.ipynb +0 -0
  69. {waveorder-1.0.0rc1/examples → waveorder-1.0.0rc3/examples/experimental_reconstructions}/PTI_experiment/PTI_full_FOV_cardiac_muscle.ipynb +0 -0
  70. {waveorder-1.0.0rc1/examples → waveorder-1.0.0rc3/examples/experimental_reconstructions}/PTI_experiment/PTI_full_FOV_cardiomyocyte_infected_1.ipynb +0 -0
  71. {waveorder-1.0.0rc1/examples → waveorder-1.0.0rc3/examples/experimental_reconstructions}/PTI_experiment/PTI_full_FOV_cardiomyocyte_infected_2.ipynb +0 -0
  72. {waveorder-1.0.0rc1/examples → waveorder-1.0.0rc3/examples/experimental_reconstructions}/PTI_experiment/PTI_full_FOV_cardiomyocyte_mock.ipynb +0 -0
  73. {waveorder-1.0.0rc1/examples → waveorder-1.0.0rc3/examples/experimental_reconstructions}/PTI_experiment/PTI_full_FOV_human_uterus.ipynb +0 -0
  74. {waveorder-1.0.0rc1/examples → waveorder-1.0.0rc3/examples/experimental_reconstructions}/PTI_experiment/PTI_full_FOV_mouse_brain_aco.ipynb +0 -0
  75. {waveorder-1.0.0rc1/examples → waveorder-1.0.0rc3/examples/experimental_reconstructions}/QLIPP_experiment/2D_QLIPP_recon_experiment.ipynb +0 -0
  76. {waveorder-1.0.0rc1/examples → waveorder-1.0.0rc3/examples/experimental_reconstructions}/QLIPP_experiment/3D_QLIPP_recon_experiment.ipynb +0 -0
  77. {waveorder-1.0.0rc1/examples → waveorder-1.0.0rc3/examples/experimental_reconstructions}/fluorescence_deconvolution/fluorescence_deconv.ipynb +0 -0
  78. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/pyproject.toml +0 -0
  79. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/setup.py +0 -0
  80. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/tests/__init__.py +0 -0
  81. {waveorder-1.0.0rc1/tests/reader → waveorder-1.0.0rc3/tests/reconstructor}/__init__.py +0 -0
  82. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/tests/reconstructor/test_2D_QLIPP_recon.py +0 -0
  83. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/tests/test_focus_estimator.py +0 -0
  84. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder/__init__.py +0 -0
  85. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder/background_estimator.py +0 -0
  86. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder/focus.py +0 -0
  87. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder/optics.py +0 -0
  88. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder/waveorder_simulator.py +0 -0
  89. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder.egg-info/dependency_links.txt +0 -0
  90. {waveorder-1.0.0rc1 → waveorder-1.0.0rc3}/waveorder.egg-info/top_level.txt +0 -0
@@ -0,0 +1,4 @@
1
+ # .git-blame-ignore-revs
2
+ # created as described in: https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
3
+ # black-format files
4
+ 07517c3353c392106cabae003d589946ea25918a
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: waveorder
3
- Version: 1.0.0rc1
3
+ Version: 1.0.0rc3
4
4
  Summary: Wave optical simulations and deconvolution of optical properties
5
5
  Home-page: https://github.com/mehta-lab/waveorder
6
6
  Author: Computational Microscopy Platform, CZ Biohub
@@ -10,6 +10,7 @@ Project-URL: Bug Tracker, https://github.com/mehta-lab/waveorder/issues
10
10
  Project-URL: Documentation, https://github.com/mehta-lab/waveorder
11
11
  Project-URL: Source Code, https://github.com/mehta-lab/waveorder
12
12
  Project-URL: User Support, https://github.com/mehta-lab/waveorder/issues
13
+ Platform: UNKNOWN
13
14
  Classifier: Development Status :: 4 - Beta
14
15
  Classifier: Intended Audience :: Science/Research
15
16
  Classifier: License :: OSI Approved :: BSD License
@@ -62,7 +63,7 @@ PTI provides volumetric reconstructions of mean permittivity ($\propto$ material
62
63
 
63
64
  ![Data_flow](https://github.com/mehta-lab/waveorder/blob/main/Fig_Readme.png?raw=true)
64
65
 
65
- The [example notebooks](examples/) illustrate simulations and reconstruction for 2D QLIPP, 3D PODT, and 2D/3D PTI methods.
66
+ The [example notebooks](https://github.com/mehta-lab/waveorder/tree/main/examples) illustrate simulations and reconstruction for 2D QLIPP, 3D PODT, and 2D/3D PTI methods.
66
67
 
67
68
  If you are interested in deploying QLIPP or PODT for label-free imaging at scale, checkout our [napari plugin](https://www.napari-hub.org/plugins/recOrder-napari), [`recOrder-napari`](https://github.com/mehta-lab/recOrder).
68
69
 
@@ -72,7 +73,7 @@ In addition to label-free reconstruction algorithms, `waveorder` also implements
72
73
 
73
74
  1. Correlative measurements of biomolecular density and orientation from polarization-diverse widefield imaging ([multimodal Instant PolScope](https://opg.optica.org/boe/fulltext.cfm?uri=boe-13-5-3102&id=472350))
74
75
 
75
- We provide an [example notebook](examples/fluorescence_deconvolution/) for widefield fluorescence deconvolution.
76
+ We provide an [example notebook](https://github.com/mehta-lab/waveorder/blob/main/examples/experimental_reconstructions/fluorescence_deconvolution/fluorescence_deconv.ipynb) for widefield fluorescence deconvolution.
76
77
 
77
78
  ## Citation
78
79
 
@@ -116,3 +117,5 @@ python
116
117
  ```
117
118
 
118
119
  To use GPUs in `waveorder` set ```use_gpu=True``` when initializing the simulator and reconstructor classes.
120
+
121
+
@@ -29,7 +29,7 @@ PTI provides volumetric reconstructions of mean permittivity ($\propto$ material
29
29
 
30
30
  ![Data_flow](https://github.com/mehta-lab/waveorder/blob/main/Fig_Readme.png?raw=true)
31
31
 
32
- The [example notebooks](examples/) illustrate simulations and reconstruction for 2D QLIPP, 3D PODT, and 2D/3D PTI methods.
32
+ The [example notebooks](https://github.com/mehta-lab/waveorder/tree/main/examples) illustrate simulations and reconstruction for 2D QLIPP, 3D PODT, and 2D/3D PTI methods.
33
33
 
34
34
  If you are interested in deploying QLIPP or PODT for label-free imaging at scale, checkout our [napari plugin](https://www.napari-hub.org/plugins/recOrder-napari), [`recOrder-napari`](https://github.com/mehta-lab/recOrder).
35
35
 
@@ -39,7 +39,7 @@ In addition to label-free reconstruction algorithms, `waveorder` also implements
39
39
 
40
40
  1. Correlative measurements of biomolecular density and orientation from polarization-diverse widefield imaging ([multimodal Instant PolScope](https://opg.optica.org/boe/fulltext.cfm?uri=boe-13-5-3102&id=472350))
41
41
 
42
- We provide an [example notebook](examples/fluorescence_deconvolution/) for widefield fluorescence deconvolution.
42
+ We provide an [example notebook](https://github.com/mehta-lab/waveorder/blob/main/examples/experimental_reconstructions/fluorescence_deconvolution/fluorescence_deconv.ipynb) for widefield fluorescence deconvolution.
43
43
 
44
44
  ## Citation
45
45
 
@@ -16,7 +16,7 @@ from numpy.fft import fft2, ifft2, fftshift, ifftshift
16
16
 
17
17
  import waveorder as wo
18
18
 
19
- # ### Key parameters
19
+ # Key parameters
20
20
  N = 256 # number of pixel in y dimension
21
21
  M = 256 # number of pixel in x dimension
22
22
  mag = 40 # magnification
@@ -29,7 +29,7 @@ NA_illu_in = 0.4 # illumination NA (phase contrast inner ring)
29
29
  z_defocus = (np.r_[:5] - 2) * 1.757 # a set of defocus plane
30
30
  chi = 0.03 * 2 * np.pi # swing of Polscope analyzer
31
31
 
32
- # ## Sample : star with uniform phase, uniform retardance, and radial orientation
32
+ # Sample : star with uniform phase, uniform retardance, and radial orientation
33
33
  # generate Siemens star pattern
34
34
  star, theta, _ = wo.genStarTarget(N, M)
35
35
  wo.plot_multicolumn(np.array([star, theta]), num_col=2, size=5)
@@ -54,8 +54,8 @@ wo.plot_multicolumn(
54
54
  )
55
55
  plt.show()
56
56
 
57
- # ## Forward model of QLIPP <br> (polarization-diverse and depth-diverse acquisition)
58
- # #### Source pupil
57
+ # Forward model of QLIPP <br> (polarization-diverse and depth-diverse acquisition)
58
+ # Source pupil
59
59
  # Subsample source pattern for speed
60
60
 
61
61
  xx, yy, fxx, fyy = wo.gen_coordinate((N, M), ps)
@@ -67,7 +67,7 @@ plt.figure(figsize=(10, 10))
67
67
  plt.imshow(fftshift(Source_discrete), cmap="gray")
68
68
  plt.show()
69
69
 
70
- # #### Initialize microscope simulator with above source pattern and uniform imaging pupil
70
+ # Initialize microscope simulator with above source pattern and uniform imaging pupil
71
71
  # Microscope object generation
72
72
 
73
73
  simulator = wo.waveorder_microscopy_simulator(
@@ -83,7 +83,7 @@ simulator = wo.waveorder_microscopy_simulator(
83
83
  Source=Source_discrete,
84
84
  )
85
85
 
86
- # ## Compute image volumes and Stokes volumes
86
+ # Compute image volumes and Stokes volumes
87
87
  I_meas, Stokes_out = simulator.simulate_waveorder_measurements(
88
88
  t_eigen, sa, multiprocess=False
89
89
  )
@@ -96,8 +96,8 @@ I_meas_noise = (
96
96
  np.random.poisson(I_meas / np.max(I_meas) * photon_count + const_bg)
97
97
  ).astype("float64")
98
98
 
99
- # #### Save simulation
100
- output_file = "/data_sm/home/lihao/project/Polscope/Simulation/3D_Pol_Phase/PTI_repo_demo/2D_QLIPP_simulation"
99
+ # Save simulation
100
+ output_file = "./2D_QLIPP_simulation.npz"
101
101
  np.savez(
102
102
  output_file,
103
103
  I_meas=I_meas_noise,
@@ -19,7 +19,7 @@ import waveorder as wo
19
19
  # Load simulations
20
20
 
21
21
 
22
- file_name = "/data_sm/home/lihao/project/Polscope/Simulation/3D_Pol_Phase/PTI_repo_demo/2D_QLIPP_simulation.npz"
22
+ file_name = "./2D_QLIPP_simulation.npz"
23
23
 
24
24
  array_loaded = np.load(file_name)
25
25
  list_of_array_names = sorted(array_loaded)
@@ -15,7 +15,7 @@ import matplotlib.pyplot as plt
15
15
  from numpy.fft import fft, ifft, fft2, ifft2, fftshift, ifftshift, fftn, ifftn
16
16
  import waveorder as wo
17
17
 
18
- # ### Experiment parameters
18
+ # Experiment parameters
19
19
  N = 256 # number of pixel in y dimension
20
20
  M = 256 # number of pixel in x dimension
21
21
  L = 100 # number of layers in z dimension
@@ -27,7 +27,7 @@ lambda_illu = 0.532 # wavelength
27
27
  NA_obj = 1.2 # objective NA
28
28
  NA_illu = 0.9 # illumination NA
29
29
 
30
- # ### Sample creation
30
+ # Sample creation
31
31
  radius = 5
32
32
  blur_size = 2 * ps
33
33
  sphere, _, _ = wo.gen_sphere_target((N, M, L), ps, psz, radius, blur_size)
@@ -53,7 +53,7 @@ plt.imshow(
53
53
  )
54
54
  plt.show()
55
55
 
56
- # ### Setup acquisition
56
+ # Setup acquisition
57
57
  # Subsampled Source pattern
58
58
 
59
59
  xx, yy, fxx, fyy = wo.gen_coordinate((N, M), ps)
@@ -155,7 +155,7 @@ plt.show()
155
155
 
156
156
 
157
157
  # Save simulations
158
- output_file = "/data_sm/home/lihao/project/Polscope/Simulation/3D_Pol_Phase/PTI_repo_demo/3D_PODT_simulation"
158
+ output_file = "./3D_PODT_simulation.npz"
159
159
  np.savez(
160
160
  output_file,
161
161
  I_meas=I_meas,
@@ -18,9 +18,9 @@ from numpy.fft import fft, ifft, fft2, ifft2, fftn, ifftn, fftshift, ifftshift
18
18
 
19
19
  import waveorder as wo
20
20
 
21
- # ### Load data
21
+ # Load data
22
22
  # Load simulations
23
- file_name = "/data_sm/home/lihao/project/Polscope/Simulation/3D_Pol_Phase/PTI_repo_demo/3D_PODT_simulation.npz"
23
+ file_name = "./3D_PODT_simulation.npz"
24
24
  array_loaded = np.load(file_name)
25
25
  list_of_array_names = sorted(array_loaded)
26
26
  for array_name in list_of_array_names:
@@ -30,7 +30,7 @@ print(list_of_array_names)
30
30
  N, M, L = I_meas.shape
31
31
 
32
32
 
33
- # ### Refractive index reconstruction
33
+ # Refractive index reconstruction
34
34
  z_defocus = (np.r_[:L] - L // 2) * psz
35
35
  chi = 0.1 * 2 * np.pi
36
36
  setup = wo.waveorder_microscopy(
@@ -43,11 +43,11 @@ import waveorder as wo
43
43
  ### Parameters of sample
44
44
 
45
45
  sample_type = "2D" # 2D or 3D
46
- N = 200 # number of pixel in y dimension
47
- M = 200 # number of pixel in x dimension
48
- L = 100 # number of layers in z dimension
49
- z_layer = 50 # default z-slice to display in XY views.
50
- y_layer = 100 # default y-slice to display in XZ views.
46
+ N = 50 # number of pixel in y dimension
47
+ M = 50 # number of pixel in x dimension
48
+ L = 26 # number of layers in z dimension
49
+ z_layer = L // 2 # default z-slice to display in XY views.
50
+ y_layer = M // 2 # default y-slice to display in XZ views.
51
51
 
52
52
  ### Parameters of imaging system
53
53
 
@@ -60,7 +60,7 @@ NA_obj = 1.47 # objective NA
60
60
  NA_illu = 1.4 # illumination NA
61
61
  chi = 0.25 * 2 * np.pi # swing of the microscope
62
62
  z_defocus = (np.r_[:L] - L // 2) * psz # defocus position
63
- use_gpu = True # option to use gpu
63
+ use_gpu = False # option to use gpu
64
64
  gpu_id = 0 # gpu to be used
65
65
 
66
66
  ### Sample pattern
@@ -80,21 +80,25 @@ if sample_type == "3D":
80
80
  azimuth = np.round(azimuth / np.pi / 2 * 16) / 16 * np.pi * 2
81
81
  elif sample_type == "2D":
82
82
  ## 2D spoke pattern, azimuth aligned with spokes, and the inclination set to 60 degrees ##
83
- target, azimuth, _ = wo.genStarTarget(N, M, blur_px=1 * ps, margin=60)
83
+ target, azimuth, _ = wo.genStarTarget(N, M, blur_px=1 * ps, margin=10)
84
84
  inclination = np.ones_like(target) * np.pi / 3
85
85
  azimuth = azimuth % (np.pi * 2)
86
86
  azimuth = np.round(azimuth / np.pi / 2 * 16) / 16 * np.pi * 2
87
87
 
88
88
  # pad zero in the z direction outside of the focal plane to mimic thin specimens
89
89
  target = np.pad(
90
- target[:, :, np.newaxis], ((0, 0), (0, 0), (50, 49)), mode="constant"
90
+ target[:, :, np.newaxis],
91
+ ((0, 0), (0, 0), (L // 2, L // 2 - 1)),
92
+ mode="constant",
91
93
  )
92
94
  azimuth = np.pad(
93
- azimuth[:, :, np.newaxis], ((0, 0), (0, 0), (50, 49)), mode="constant"
95
+ azimuth[:, :, np.newaxis],
96
+ ((0, 0), (0, 0), (L // 2, L // 2 - 1)),
97
+ mode="constant",
94
98
  )
95
99
  inclination = np.pad(
96
100
  inclination[:, :, np.newaxis],
97
- ((0, 0), (0, 0), (50, 49)),
101
+ ((0, 0), (0, 0), (L // 2, L // 2 - 1)),
98
102
  mode="constant",
99
103
  )
100
104
  else:
@@ -470,7 +474,7 @@ I_meas_noise = I_meas_SEAGLE / np.mean(I_meas_SEAGLE) * photon_count
470
474
 
471
475
  # Save simulations
472
476
 
473
- output_dir = "/home/lihao.yeh/Desktop/recorder_test/processed_data/"
477
+ output_dir = "./"
474
478
 
475
479
  if sample_type == "3D":
476
480
  output_file = "PTI_simulation_data_NA_det_147_NA_illu_140_3D_spoke_discrete_no_1528_ne_1553_no_noise_Born"
@@ -19,7 +19,7 @@ import waveorder as wo
19
19
  ## Initialization
20
20
  ## Load simulated images and parameters
21
21
 
22
- file_name = "/data_sm/home/lihao/project/Polscope/Simulation/3D_Pol_Phase/PTI_repo_demo/PTI_simulation_data_NA_det_147_NA_illu_140_2D_spoke_discrete_no_1528_ne_1553_no_noise_Born.npz"
22
+ file_name = "./PTI_simulation_data_NA_det_147_NA_illu_140_2D_spoke_discrete_no_1528_ne_1553_no_noise_Born.npz"
23
23
 
24
24
  array_loaded = np.load(file_name)
25
25
  list_of_array_names = sorted(array_loaded)
@@ -29,7 +29,8 @@ for array_name in list_of_array_names:
29
29
 
30
30
  print(list_of_array_names)
31
31
 
32
- I_meas = np.transpose(I_meas[:, :, :, :, 50], (0, 2, 3, 1))
32
+ L = I_meas.shape[-1]
33
+ I_meas = np.transpose(I_meas[:, :, :, :, L // 2], (0, 2, 3, 1))
33
34
  z_defocus = np.array([0])
34
35
 
35
36
  I_meas = I_meas[1:]
@@ -41,7 +42,7 @@ print(I_meas.shape)
41
42
  _, N, M, _ = I_meas.shape
42
43
  cali = False
43
44
  bg_option = "global"
44
- use_gpu = True
45
+ use_gpu = False
45
46
  gpu_id = 0
46
47
 
47
48
  # chi = pi/2
@@ -166,13 +167,13 @@ phase_nm, absorption_nm, retardance_pr_nm = [
166
167
  )
167
168
  ]
168
169
 
169
- # clean up GPU memory leftorver
170
+ # # clean up GPU memory leftorver
170
171
 
171
- import gc
172
- import cupy as cp
172
+ # import gc
173
+ # import cupy as cp
173
174
 
174
- gc.collect()
175
- cp.get_default_memory_pool().free_all_blocks()
175
+ # gc.collect()
176
+ # cp.get_default_memory_pool().free_all_blocks()
176
177
 
177
178
  ## Visualize reconstructed physical properties of simulated sample
178
179
  ### Phase, principal retardance, azimuth, inclination, and optic sign
@@ -16,7 +16,7 @@ import waveorder as wo
16
16
  ## Initialization
17
17
  ## Load simulated images and parameters
18
18
 
19
- file_name = "/data_sm/home/lihao/project/Polscope/Simulation/3D_Pol_Phase/PTI_repo_demo/PTI_simulation_data_NA_det_147_NA_illu_140_2D_spoke_discrete_no_1528_ne_1553_no_noise_Born.npz"
19
+ file_name = "./PTI_simulation_data_NA_det_147_NA_illu_140_2D_spoke_discrete_no_1528_ne_1553_no_noise_Born.npz"
20
20
 
21
21
  array_loaded = np.load(file_name)
22
22
  list_of_array_names = sorted(array_loaded)
@@ -32,7 +32,7 @@ print(I_meas.shape)
32
32
  _, _, N, M, L = I_meas.shape
33
33
  cali = False
34
34
  bg_option = "global"
35
- use_gpu = True
35
+ use_gpu = False
36
36
  gpu_id = 0
37
37
 
38
38
 
@@ -169,11 +169,11 @@ phase_PT, absorption_PT, retardance_pr_PT = [
169
169
 
170
170
  # clean up GPU memory leftorver
171
171
 
172
- import gc
173
- import cupy as cp
172
+ # import gc
173
+ # import cupy as cp
174
174
 
175
- gc.collect()
176
- cp.get_default_memory_pool().free_all_blocks()
175
+ # gc.collect()
176
+ # cp.get_default_memory_pool().free_all_blocks()
177
177
 
178
178
  ## Visualize reconstructed physical properties of simulated sample
179
179
  ### Reconstructed phase, absorption, principal retardance, azimuth, and inclination assuming (+) and (-) optic sign
@@ -225,9 +225,9 @@ plt.show()
225
225
  ######################################
226
226
 
227
227
  ## display parameters for 2D dataset ##
228
- z_layer = 50
229
- y_layer = 100
230
- x_layer = 100
228
+ z_layer = L // 2
229
+ y_layer = M // 2
230
+ x_layer = N // 2
231
231
  phase_min = -0.012
232
232
  phase_max = 0.012
233
233
  ret_min = 0
@@ -499,9 +499,9 @@ z_step = psz
499
499
 
500
500
  ### select slices to plot ###
501
501
  spacing = 4
502
- z_layer = 50
503
- x_layer = 100
504
- y_layer = 100
502
+ z_layer = L // 2
503
+ x_layer = N // 2
504
+ y_layer = M // 2
505
505
  linelength_scale = 20
506
506
  #########################
507
507
 
@@ -0,0 +1,12 @@
1
+ This folder of examples consists of:
2
+
3
+ 1) A set of simulations that will run as is. Any of the files in these folders
4
+ can be run with `python <script-name>.py`, and these files are included in
5
+ `waveorder`'s automated testing.
6
+ - `/2D_QLIPP_simulation/`
7
+ - `/3D_PODT_Phase_simulation/`
8
+ - `/PTI_simulation/`
9
+
10
+ 2) A set of data-dependent reconstructions in `/experimental_reconstructions/`.
11
+ These files serve as a form of documentation for the types of reconstructions
12
+ that `waveorder` can perform.
@@ -36,12 +36,11 @@ include_package_data = True
36
36
  python_requires = >=3.8
37
37
  setup_requires = setuptools_scm
38
38
  install_requires =
39
- numpy>=1.17.4
39
+ numpy>=1.21
40
40
  matplotlib>=3.1.1
41
41
  scipy>=1.3.0
42
42
  pywavelets>=1.1.1
43
43
  ipywidgets>=7.5.1
44
- opencv-python>=3.4.1
45
44
  tifffile>=2021.11.2
46
45
  zarr>=2.6.1
47
46
  natsort>=7.1.1
@@ -0,0 +1,40 @@
1
+ import subprocess
2
+ import os
3
+ from pathlib import Path
4
+
5
+
6
+ def _run_scripts(scripts):
7
+ for script in scripts:
8
+ path = os.path.join(os.getcwd(), "examples/", script)
9
+ completed_process = subprocess.run(["python", path])
10
+ assert completed_process.returncode == 0
11
+
12
+
13
+ # Currently, these tests will run in the background if no screen is available
14
+ # If you do have a screen available, plots will appear, and you'll need to
15
+ # close them to make the tests pass.
16
+ # TODO: see if we can make these run locally w/o showing matplotlib
17
+ # @patch("matplotlib.pyplot.show")
18
+ def test_qlipp_examples():
19
+ scripts = [
20
+ "2D_QLIPP_simulation/2D_QLIPP_forward.py",
21
+ "2D_QLIPP_simulation/2D_QLIPP_recon.py",
22
+ ]
23
+ _run_scripts(scripts)
24
+
25
+
26
+ def test_phase_examples():
27
+ scripts = [
28
+ "3D_PODT_phase_simulation/3D_PODT_Phase_forward.py",
29
+ "3D_PODT_phase_simulation/3D_PODT_Phase_recon.py",
30
+ ]
31
+ _run_scripts(scripts)
32
+
33
+
34
+ def test_pti_examples():
35
+ scripts = [
36
+ "PTI_simulation/PTI_Simulation_Forward_2D3D.py",
37
+ "PTI_simulation/PTI_Simulation_Recon2D.py",
38
+ "PTI_simulation/PTI_Simulation_Recon3D.py",
39
+ ]
40
+ _run_scripts(scripts)
@@ -1,5 +1,4 @@
1
- # coding: utf-8
2
1
  # file generated by setuptools_scm
3
2
  # don't change, don't track in version control
4
- __version__ = version = '1.0.0rc1'
3
+ __version__ = version = '1.0.0rc3'
5
4
  __version_tuple__ = version_tuple = (1, 0, 0)