Skip to content

Commit

Permalink
#2 Modify the unit of psf_depth_cutoff
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizu committed Mar 4, 2019
1 parent 45b8a60 commit d18c902
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/defaults.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[all]
psf_depth_cutoff = 1000
psf_depth_cutoff = 1000e-9
shutter_switch = True
detector_dark_count = 0
image_resolution = 1.6e-07
Expand Down
2 changes: 1 addition & 1 deletion scopyon/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ psf_normalization = 1.00
psf_intensity_noise = 0.50
psf_width = (200, 200) # Gaussian function (radial width, lateral width) [nm]
psf_radial_cutoff = 1000
psf_depth_cutoff = 1000
psf_depth_cutoff = 1000e-9
psf_min_wave_length = 300
psf_max_wave_length = 1000

Expand Down
20 changes: 10 additions & 10 deletions scopyon/epifm.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def initialize(self, config, rng=None):
rng = numpy.random.RandomState()

self.radial = numpy.arange(config.psf_radial_cutoff, dtype=float)
self.depth = numpy.arange(config.psf_depth_cutoff, dtype=float)
# self.depth = numpy.arange(config.psf_depth_cutoff, dtype=float)
print(config.psf_depth_cutoff)
self.depth = numpy.arange(0.0, config.psf_depth_cutoff, 1e-9, dtype=float)

self.wave_length = numpy.arange(config.psf_min_wave_length, config.psf_max_wave_length, dtype=int)
N = len(self.wave_length)
self.wave_number = 2 * numpy.pi / self.wave_length
Expand Down Expand Up @@ -414,9 +417,6 @@ def set_illumination_path(self, focal_point, focal_norm):
# self.set_PSF_detector()

def get_PSF_detector(self):
r = self.radial
z = self.depth

wave_length = self.psf_wavelength

# Fluorophores Emission Intensity (wave_length)
Expand All @@ -438,14 +438,14 @@ def get_PSF_detector(self):

# Ir = sum(list(map(lambda x: x * numpy.exp(-0.5 * (r / self.psf_width[0]) ** 2), norm)))
# Iz = sum(list(map(lambda x: x * numpy.exp(-0.5 * (z / self.psf_width[1]) ** 2), norm)))
Ir = norm * numpy.exp(-0.5 * numpy.power(r / self.psf_width[0], 2))
Iz = norm * numpy.exp(-0.5 * numpy.power(r / self.psf_width[1], 2))
Ir = norm * numpy.exp(-0.5 * numpy.power(self.radial / self.psf_width[0], 2))
Iz = norm * numpy.exp(-0.5 * numpy.power(self.radial / self.psf_width[1], 2))

psf_fl = numpy.sum(I) * numpy.array(list(map(lambda x: Ir * x, Iz)))

else:
# make the norm and wave_length array shorter
psf_fl = numpy.sum(I) * self.get_PSF_fluorophore(r, z, wave_length)
psf_fl = numpy.sum(I) * self.get_PSF_fluorophore(self.radial, self.depth, wave_length)

psf_fl *= self.psf_normalization

Expand Down Expand Up @@ -473,7 +473,7 @@ def get_PSF_fluorophore(r, z, wave_length):
rho = numpy.arange(1, N + 1) * drho

J0 = numpy.array(list(map(lambda x: j0(x * alpha * rho), r)))
Y = numpy.array(list(map(lambda x: numpy.exp(-2 * 1.j * x * gamma * rho * rho) * rho * drho, z)))
Y = numpy.array(list(map(lambda x: numpy.exp(-2 * 1.j * x * gamma * rho * rho) * rho * drho, z / 1e-9)))
I = numpy.array(list(map(lambda x: x * J0, Y)))
I_sum = I.sum(axis=2)

Expand Down Expand Up @@ -1011,7 +1011,7 @@ def __overlay_signal(self, camera, signal, p_i, p_0):

def __get_signal(self, amplitude, radial, depth, p_state, unit_time, fluo_psfs=None):
# fluorophore axial position
fluo_depth = depth if depth < len(self.configs.depth) else -1
fluo_depth = depth if depth < (self.configs.depth[-1] / 1e-9 + 1.0) else -1

# get fluorophore PSF
psf_depth = (fluo_psfs or self.fluo_psf)[int(fluo_depth)]
Expand Down Expand Up @@ -1458,7 +1458,7 @@ def __get_fluo_psfs(self, data):
p_i, _, depth = _rotate_coordinate(p_i, p_0)

# fluorophore axial position
fluo_depth = int(depth) if depth < len(self.configs.depth) else -1
fluo_depth = int(depth) if depth < (self.configs.depth[-1] / 1e-9 + 1.0) else -1

depths.append(fluo_depth)

Expand Down

0 comments on commit d18c902

Please sign in to comment.