Skip to content

Commit

Permalink
Prepare for waveorder==1.0.0 release (#114)
Browse files Browse the repository at this point in the history
* Remove io folder and tests

* remove multiprocessing examples

* np.int to int

* maintain examples/2D_QLIPP_simulation

* maintain `3D_PODT_phase_simulation`

* local file names

* np.int to int

* clean PTI_simulation

* simple CI/CD for testing examples

* add PTI examples to automated tests

* turn off GPU for tests

* reorganize folders and add README

* fix tests

* make default PTI simulation smaller

* remove pdb

* typo

* docs typo

* remove unmaintained python scripts

* remove unused imports and variables

* depend on numpy >= 1.21

* fix formatting

* naming fix

* refactor example tests
  • Loading branch information
talonchandler authored Apr 18, 2023
1 parent 4b3b133 commit 5e05b1c
Show file tree
Hide file tree
Showing 63 changed files with 110 additions and 16,697 deletions.
457 changes: 0 additions & 457 deletions examples/2D_QLIPP_simulation/2D_QLIPP_forward.ipynb

This file was deleted.

16 changes: 8 additions & 8 deletions examples/2D_QLIPP_simulation/2D_QLIPP_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import waveorder as wo

# ### Key parameters
# Key parameters
N = 256 # number of pixel in y dimension
M = 256 # number of pixel in x dimension
mag = 40 # magnification
Expand All @@ -29,7 +29,7 @@
z_defocus = (np.r_[:5] - 2) * 1.757 # a set of defocus plane
chi = 0.03 * 2 * np.pi # swing of Polscope analyzer

# ## Sample : star with uniform phase, uniform retardance, and radial orientation
# Sample : star with uniform phase, uniform retardance, and radial orientation
# generate Siemens star pattern
star, theta, _ = wo.genStarTarget(N, M)
wo.plot_multicolumn(np.array([star, theta]), num_col=2, size=5)
Expand All @@ -54,8 +54,8 @@
)
plt.show()

# ## Forward model of QLIPP <br> (polarization-diverse and depth-diverse acquisition)
# #### Source pupil
# Forward model of QLIPP <br> (polarization-diverse and depth-diverse acquisition)
# Source pupil
# Subsample source pattern for speed

xx, yy, fxx, fyy = wo.gen_coordinate((N, M), ps)
Expand All @@ -67,7 +67,7 @@
plt.imshow(fftshift(Source_discrete), cmap="gray")
plt.show()

# #### Initialize microscope simulator with above source pattern and uniform imaging pupil
# Initialize microscope simulator with above source pattern and uniform imaging pupil
# Microscope object generation

simulator = wo.waveorder_microscopy_simulator(
Expand All @@ -83,7 +83,7 @@
Source=Source_discrete,
)

# ## Compute image volumes and Stokes volumes
# Compute image volumes and Stokes volumes
I_meas, Stokes_out = simulator.simulate_waveorder_measurements(
t_eigen, sa, multiprocess=False
)
Expand All @@ -96,8 +96,8 @@
np.random.poisson(I_meas / np.max(I_meas) * photon_count + const_bg)
).astype("float64")

# #### Save simulation
output_file = "/data_sm/home/lihao/project/Polscope/Simulation/3D_Pol_Phase/PTI_repo_demo/2D_QLIPP_simulation"
# Save simulation
output_file = "./2D_QLIPP_simulation.npz"
np.savez(
output_file,
I_meas=I_meas_noise,
Expand Down
482 changes: 0 additions & 482 deletions examples/2D_QLIPP_simulation/2D_QLIPP_recon.ipynb

This file was deleted.

2 changes: 1 addition & 1 deletion examples/2D_QLIPP_simulation/2D_QLIPP_recon.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Load simulations


file_name = "/data_sm/home/lihao/project/Polscope/Simulation/3D_Pol_Phase/PTI_repo_demo/2D_QLIPP_simulation.npz"
file_name = "./2D_QLIPP_simulation.npz"

array_loaded = np.load(file_name)
list_of_array_names = sorted(array_loaded)
Expand Down
421 changes: 0 additions & 421 deletions examples/3D_PODT_phase_simulation/3D_PODT_Phase_forward.ipynb

This file was deleted.

8 changes: 4 additions & 4 deletions examples/3D_PODT_phase_simulation/3D_PODT_Phase_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from numpy.fft import fft, ifft, fft2, ifft2, fftshift, ifftshift, fftn, ifftn
import waveorder as wo

# ### Experiment parameters
# Experiment parameters
N = 256 # number of pixel in y dimension
M = 256 # number of pixel in x dimension
L = 100 # number of layers in z dimension
Expand All @@ -27,7 +27,7 @@
NA_obj = 1.2 # objective NA
NA_illu = 0.9 # illumination NA

# ### Sample creation
# Sample creation
radius = 5
blur_size = 2 * ps
sphere, _, _ = wo.gen_sphere_target((N, M, L), ps, psz, radius, blur_size)
Expand All @@ -53,7 +53,7 @@
)
plt.show()

# ### Setup acquisition
# Setup acquisition
# Subsampled Source pattern

xx, yy, fxx, fyy = wo.gen_coordinate((N, M), ps)
Expand Down Expand Up @@ -155,7 +155,7 @@


# Save simulations
output_file = "/data_sm/home/lihao/project/Polscope/Simulation/3D_Pol_Phase/PTI_repo_demo/3D_PODT_simulation"
output_file = "./3D_PODT_simulation.npz"
np.savez(
output_file,
I_meas=I_meas,
Expand Down
278 changes: 0 additions & 278 deletions examples/3D_PODT_phase_simulation/3D_PODT_Phase_recon.ipynb

This file was deleted.

6 changes: 3 additions & 3 deletions examples/3D_PODT_phase_simulation/3D_PODT_Phase_recon.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

import waveorder as wo

# ### Load data
# Load data
# Load simulations
file_name = "/data_sm/home/lihao/project/Polscope/Simulation/3D_Pol_Phase/PTI_repo_demo/3D_PODT_simulation.npz"
file_name = "./3D_PODT_simulation.npz"
array_loaded = np.load(file_name)
list_of_array_names = sorted(array_loaded)
for array_name in list_of_array_names:
Expand All @@ -30,7 +30,7 @@
N, M, L = I_meas.shape


# ### Refractive index reconstruction
# Refractive index reconstruction
z_defocus = (np.r_[:L] - L // 2) * psz
chi = 0.1 * 2 * np.pi
setup = wo.waveorder_microscopy(
Expand Down
Loading

0 comments on commit 5e05b1c

Please sign in to comment.