AMS-BP 0.0.31__py3-none-any.whl → 0.0.251__py3-none-any.whl
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.
- AMS_BP/__init__.py +1 -1
- AMS_BP/motion/movement/fbm_BP.py +5 -4
- AMS_BP/motion/track_gen.py +6 -6
- AMS_BP/optics/lasers/laser_profiles.py +10 -11
- AMS_BP/optics/psf/psf_engine.py +8 -25
- AMS_BP/photophysics/photon_physics.py +4 -4
- {ams_bp-0.0.31.dist-info → ams_bp-0.0.251.dist-info}/METADATA +1 -1
- {ams_bp-0.0.31.dist-info → ams_bp-0.0.251.dist-info}/RECORD +11 -11
- {ams_bp-0.0.31.dist-info → ams_bp-0.0.251.dist-info}/WHEEL +0 -0
- {ams_bp-0.0.31.dist-info → ams_bp-0.0.251.dist-info}/entry_points.txt +0 -0
- {ams_bp-0.0.31.dist-info → ams_bp-0.0.251.dist-info}/licenses/LICENSE +0 -0
AMS_BP/__init__.py
CHANGED
AMS_BP/motion/movement/fbm_BP.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import numpy as np
|
2
|
-
|
2
|
+
from .boundary_conditions import _refecting_boundary, _absorbing_boundary
|
3
3
|
from ...probabilityfuncs.markov_chain import MCMC_state_selection
|
4
|
-
from .boundary_conditions import _absorbing_boundary, _refecting_boundary
|
5
4
|
|
6
5
|
BOUNDARY_CONDITIONS = {
|
7
6
|
"reflecting": _refecting_boundary,
|
@@ -162,8 +161,10 @@ class FBM_BP:
|
|
162
161
|
phi = np.zeros(self.n)
|
163
162
|
psi = np.zeros(self.n)
|
164
163
|
# construct a gaussian noise vector
|
165
|
-
gn =
|
166
|
-
|
164
|
+
gn = (
|
165
|
+
np.random.normal(0, 1, self.n)
|
166
|
+
* np.sqrt(self.dt * 2 * self._diff_a_n)
|
167
|
+
* (self.dt ** (2 * self._hurst_n))
|
167
168
|
)
|
168
169
|
# catch is all hurst are 0.5 then use the gaussian noise vector corresponding to the scale defined by the diffusion parameter
|
169
170
|
if np.all(self._hurst_n == 0.5):
|
AMS_BP/motion/track_gen.py
CHANGED
@@ -124,12 +124,12 @@ class Track_generator:
|
|
124
124
|
rel_space_lim[i] = self.space_lim[i] - initials[i]
|
125
125
|
|
126
126
|
# convert the diffusion_coefficients
|
127
|
-
|
128
|
-
|
129
|
-
|
127
|
+
diffusion_coefficient = self._convert_diffcoef_um2s_um2xms(
|
128
|
+
diffusion_coefficient
|
129
|
+
)
|
130
130
|
fbm = FBM_BP(
|
131
131
|
n=track_length,
|
132
|
-
dt=
|
132
|
+
dt=1,
|
133
133
|
hurst_parameters=[hurst_exponent],
|
134
134
|
diffusion_parameters=[diffusion_coefficient],
|
135
135
|
diffusion_parameter_transition_matrix=[1],
|
@@ -216,11 +216,11 @@ class Track_generator:
|
|
216
216
|
for i in range(3):
|
217
217
|
rel_space_lim[i] = self.space_lim[i] - initials[i]
|
218
218
|
# convert the diffusion_coefficients
|
219
|
-
|
219
|
+
diffusion_parameters = self._convert_diffcoef_um2s_um2xms(diffusion_parameters)
|
220
220
|
# initialize the fbm class
|
221
221
|
fbm = FBM_BP(
|
222
222
|
n=track_length,
|
223
|
-
dt=
|
223
|
+
dt=1,
|
224
224
|
hurst_parameters=hurst_parameters,
|
225
225
|
diffusion_parameters=diffusion_parameters,
|
226
226
|
diffusion_parameter_transition_matrix=diffusion_transition_matrix,
|
@@ -371,16 +371,15 @@ class WidefieldBeam(LaserProfile):
|
|
371
371
|
Returns:
|
372
372
|
Intensity scaling factor between 0 and 1
|
373
373
|
"""
|
374
|
-
#
|
375
|
-
#
|
376
|
-
|
377
|
-
|
378
|
-
#
|
379
|
-
|
380
|
-
|
381
|
-
#
|
382
|
-
|
383
|
-
return 1.0
|
374
|
+
# Use error function for smooth transition at DoF boundaries
|
375
|
+
# Scale factor determines how sharp the transition is
|
376
|
+
scale_factor = 2.0 # Adjust this to change transition sharpness
|
377
|
+
|
378
|
+
# Normalize z by DoF and create smooth falloff
|
379
|
+
normalized_z = scale_factor * (np.abs(z) - self.dof / 2) / self.dof
|
380
|
+
|
381
|
+
# Use sigmoid function for smooth transition
|
382
|
+
return 1 / (1 + np.exp(normalized_z))
|
384
383
|
|
385
384
|
def calculate_intensity(
|
386
385
|
self,
|
@@ -417,7 +416,7 @@ class WidefieldBeam(LaserProfile):
|
|
417
416
|
base_intensity = power / (np.pi * self.max_radius**2)
|
418
417
|
|
419
418
|
# Apply radial intensity profile with smooth falloff at edges
|
420
|
-
edge_width = self.max_radius * 0.00001
|
419
|
+
edge_width = self.max_radius * 0.00001
|
421
420
|
radial_profile = 0.5 * (1 - np.tanh((r - self.max_radius) / edge_width))
|
422
421
|
# Apply DoF-based axial intensity profile
|
423
422
|
axial_profile = self._calculate_dof_profile(z_shifted)
|
AMS_BP/optics/psf/psf_engine.py
CHANGED
@@ -85,19 +85,15 @@ class PSFEngine:
|
|
85
85
|
self._grid_xy = _generate_grid(self._psf_size, self.params.pixel_size)
|
86
86
|
|
87
87
|
# Pre-calculate normalized sigma values
|
88
|
-
self._norm_sigma_xy = self._sigma_xy / 2.
|
89
|
-
self._norm_sigma_z = self._sigma_z / 2.
|
88
|
+
self._norm_sigma_xy = self._sigma_xy / 2.355
|
89
|
+
self._norm_sigma_z = self._sigma_z / 2.355
|
90
90
|
|
91
91
|
# Generate pinhole mask if specified
|
92
92
|
if self.params.pinhole_radius is not None:
|
93
93
|
if self.params.pinhole_radius < AIRYFACTOR * self._sigma_xy:
|
94
|
-
|
94
|
+
raise ValueError(
|
95
95
|
f"Pinhole size ({self.params.pinhole_radius} um) is smaller than {AIRYFACTOR} times the Airy lobe. This will diffract the emission light in the pinhole; an ideal pinhole size for this setup is {self._sigma_xy} um."
|
96
96
|
)
|
97
|
-
#
|
98
|
-
# raise ValueError(
|
99
|
-
# f"Pinhole size ({self.params.pinhole_radius} um) is smaller than {AIRYFACTOR} times the Airy lobe. This will diffract the emission light in the pinhole; an ideal pinhole size for this setup is {self._sigma_xy} um."
|
100
|
-
# )
|
101
97
|
self._pinhole_mask = self._generate_pinhole_mask()
|
102
98
|
else:
|
103
99
|
self._pinhole_mask = None
|
@@ -120,9 +116,7 @@ class PSFEngine:
|
|
120
116
|
return (r <= self.params.pinhole_radius).astype(np.float64)
|
121
117
|
|
122
118
|
@lru_cache(maxsize=128)
|
123
|
-
def psf_z(
|
124
|
-
self, x_val: float, y_val: float, z_val: float, norm_scale: bool = True
|
125
|
-
) -> NDArray[np.float64]:
|
119
|
+
def psf_z(self, z_val: float) -> NDArray[np.float64]:
|
126
120
|
"""Calculate the PSF at the detector for a point source at z_val.
|
127
121
|
|
128
122
|
This represents how light from a point source at position z_val
|
@@ -130,28 +124,17 @@ class PSFEngine:
|
|
130
124
|
detector. If a pinhole is present, it spatially filters this pattern.
|
131
125
|
|
132
126
|
Args:
|
133
|
-
x_val: x-position of the point source in micrometers
|
134
|
-
y_val: y-position of the point source in micrometers
|
135
127
|
z_val: Z-position of the point source in micrometers
|
136
128
|
|
137
129
|
Returns:
|
138
130
|
2D array containing the light intensity pattern at the detector
|
139
131
|
"""
|
140
132
|
x, y = self._grid_xy
|
141
|
-
sigma_xy_z_squared = (self._norm_sigma_xy**2) * (
|
142
|
-
1 + (z_val / self._norm_sigma_z) ** 2
|
143
|
-
)
|
144
133
|
|
145
134
|
# Calculate how light from the point source diffracts through collection optics
|
146
|
-
r_squared = (x
|
147
|
-
|
148
|
-
|
149
|
-
psf_at_detector = np.exp(-0.5 * (r_squared / sigma_xy_z_squared))
|
150
|
-
|
151
|
-
if norm_scale:
|
152
|
-
psf_at_detector = self.normalize_psf(
|
153
|
-
psf_at_detector, mode="sum"
|
154
|
-
) * self.psf_z_xy0(z_val)
|
135
|
+
r_squared = (x / self._norm_sigma_xy) ** 2 + (y / self._norm_sigma_xy) ** 2
|
136
|
+
z_term = (z_val / self._norm_sigma_z) ** 2
|
137
|
+
psf_at_detector = np.exp(-0.5 * (r_squared + z_term))
|
155
138
|
|
156
139
|
if self._pinhole_mask is not None:
|
157
140
|
# Apply pinhole's spatial filtering
|
@@ -269,7 +252,7 @@ def calculate_psf_size(
|
|
269
252
|
Tuple of dimensions (z,y,x) or (y,x) for the PSF calculation
|
270
253
|
"""
|
271
254
|
# Calculate radius to capture important features (2x Airy radius)
|
272
|
-
r_psf =
|
255
|
+
r_psf = 2 * sigma_xy
|
273
256
|
|
274
257
|
# Convert to pixels and ensure odd number
|
275
258
|
pixels_xy = int(np.ceil(r_psf / pixel_size))
|
@@ -168,11 +168,11 @@ class incident_photons:
|
|
168
168
|
photons_n = self.transmission_photon_rate.values[i] * dt
|
169
169
|
photons += photons_n
|
170
170
|
psf_gen = (
|
171
|
-
self.generator[i].
|
172
|
-
|
173
|
-
|
174
|
-
z_val=self.position[2],
|
171
|
+
self.generator[i].normalize_psf(
|
172
|
+
self.generator[i].psf_z(z_val=self.position[2]),
|
173
|
+
mode="sum",
|
175
174
|
)
|
175
|
+
* self.generator[i].psf_z_xy0(z_val=self.position[2])
|
176
176
|
* photons_n
|
177
177
|
)
|
178
178
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: AMS_BP
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.251
|
4
4
|
Summary: Advanced Microscopy Simulations developed for the Weber Lab by Baljyot Singh Parmar
|
5
5
|
Project-URL: Documentation, https://joemans3.github.io/AMS_BP/
|
6
6
|
Project-URL: Source code, https://github.com/joemans3/AMS_BP
|
@@ -1,4 +1,4 @@
|
|
1
|
-
AMS_BP/__init__.py,sha256=
|
1
|
+
AMS_BP/__init__.py,sha256=qv5C9LGYuQzZP9NQ_ST5KH4IuqGwi8PVl44IypUo97w,328
|
2
2
|
AMS_BP/run_cell_simulation.py,sha256=7InopFikjo0HfaLO2siXskBIbyCIte9avG4YXjjaWCI,7420
|
3
3
|
AMS_BP/sim_config.toml,sha256=3IqOQIJYmP5g4okk15nqQiNZb3ij7Pt63HbpI-5tySw,11672
|
4
4
|
AMS_BP/sim_microscopy.py,sha256=u60ApTA6MTUmqSAd7EsAxweKya_Typput8NumDq9fp8,18697
|
@@ -16,10 +16,10 @@ AMS_BP/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
AMS_BP/metadata/metadata.py,sha256=YDumjc5sI3lY_UZx8f0ZhMqbG2qKQkysXwl7CY4ZtnY,2927
|
17
17
|
AMS_BP/motion/__init__.py,sha256=cy3W-wCRjjlN1DrTqYc-JltYwcE8SZCXMVPJ2o6q_BQ,178
|
18
18
|
AMS_BP/motion/condensate_movement.py,sha256=eig4WtD7o1cvIafWMjOk6pqxyhe_IIucgLcBEoDvasU,11648
|
19
|
-
AMS_BP/motion/track_gen.py,sha256=
|
19
|
+
AMS_BP/motion/track_gen.py,sha256=Z3QJLVMP1gX4SlgOXFxBg8sJhBG0Xq25ixnBoEHEAZI,19462
|
20
20
|
AMS_BP/motion/movement/__init__.py,sha256=PqovpG4dAuFFIP9M2_kt-6egQJX3P5ig4MMWVzNaswg,278
|
21
21
|
AMS_BP/motion/movement/boundary_conditions.py,sha256=jpfK3AEUY8btrTsu19bpUfx-jri7_HfyxqMFjMoxAVM,2200
|
22
|
-
AMS_BP/motion/movement/fbm_BP.py,sha256=
|
22
|
+
AMS_BP/motion/movement/fbm_BP.py,sha256=dH-JZiAInnIaZXH1wAAo8dOIX9zafclqnZ4dOhKtnO0,9327
|
23
23
|
AMS_BP/optics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
24
|
AMS_BP/optics/camera/__init__.py,sha256=eCoDUFHcoCWgbgYdLn8EH7AULM53A3XWTXNZnV8QxeY,182
|
25
25
|
AMS_BP/optics/camera/detectors.py,sha256=_815Ovo7Aj375OZh5Xim8pFuZEEcSVtSdnLRYFqb3_8,10355
|
@@ -29,11 +29,11 @@ AMS_BP/optics/filters/filters.py,sha256=-iw7eqmDO77SEqlFTv5jJNVwpA8y93TLsjy5hhsA
|
|
29
29
|
AMS_BP/optics/filters/channels/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
30
|
AMS_BP/optics/filters/channels/channelschema.py,sha256=SConyA5yVdfnI_8sgcxVC8SV7S8tGUJYPPC6jn7lglU,906
|
31
31
|
AMS_BP/optics/lasers/__init__.py,sha256=T7dHohhyLf_pBw4TidarYHWmiwxVXGE71-Bf1aeBbuc,564
|
32
|
-
AMS_BP/optics/lasers/laser_profiles.py,sha256=
|
32
|
+
AMS_BP/optics/lasers/laser_profiles.py,sha256=DM3YDh6JccgQk8fjBRh6J3bDpTChm8Im_AE5z9EK3EI,17101
|
33
33
|
AMS_BP/optics/psf/__init__.py,sha256=ezrKPgpTeR4gTHOvF0mhF6u2zMMTd8Bgp8PGeOf11fA,121
|
34
|
-
AMS_BP/optics/psf/psf_engine.py,sha256=
|
34
|
+
AMS_BP/optics/psf/psf_engine.py,sha256=Do54D1jMbSrj5uljdTrrEttCvxq3qbVT74acRuOk15c,9434
|
35
35
|
AMS_BP/photophysics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
|
-
AMS_BP/photophysics/photon_physics.py,sha256=
|
36
|
+
AMS_BP/photophysics/photon_physics.py,sha256=QRG_QIZ4csJ3g5qGP9Wtk7kzqm8_MUbVHfFef6cMtHQ,6671
|
37
37
|
AMS_BP/photophysics/state_kinetics.py,sha256=IdZtlHCLs--iSjLwDu2IQA617qXC4la8VpqosrM-vgQ,5401
|
38
38
|
AMS_BP/probabilityfuncs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
39
|
AMS_BP/probabilityfuncs/markov_chain.py,sha256=LV6KGr8Lv4NIvBPJqsR0CEynssa_mPH30qLaK85GObA,4339
|
@@ -48,8 +48,8 @@ AMS_BP/utils/decorators.py,sha256=4qFdvzPJne0dhkhD1znPxRln1Rfr5NX8rdcCDcbATRU,62
|
|
48
48
|
AMS_BP/utils/errors.py,sha256=7BOd-L4_YeKmWn3Q4EOdTnNF3Bj_exDa3eg5X0yCZrc,759
|
49
49
|
AMS_BP/utils/maskMaker.py,sha256=2ca3n2nc8rFtUh1LurKXOJJsUmhrOpWbRnVX7fjRVvs,335
|
50
50
|
AMS_BP/utils/util_functions.py,sha256=jI6WBh09_khdABnEoVK7SK1WRvCLHuw40f5ALyflzlc,9478
|
51
|
-
ams_bp-0.0.
|
52
|
-
ams_bp-0.0.
|
53
|
-
ams_bp-0.0.
|
54
|
-
ams_bp-0.0.
|
55
|
-
ams_bp-0.0.
|
51
|
+
ams_bp-0.0.251.dist-info/METADATA,sha256=lSmQVE_Aaw13hf692nC4MuTZplqmg5vBqjap8PTnow0,5870
|
52
|
+
ams_bp-0.0.251.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
53
|
+
ams_bp-0.0.251.dist-info/entry_points.txt,sha256=MFUK9bZWW61djfsavqopMqiVPVn4lJtt6v8qzyEFyNM,76
|
54
|
+
ams_bp-0.0.251.dist-info/licenses/LICENSE,sha256=k_-JV1DQKvO0FR8WjvOisqdTl0kp6VJ7RFM3YZhao0c,1071
|
55
|
+
ams_bp-0.0.251.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|