AMS-BP 0.0.22__py3-none-any.whl → 0.0.24__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 CHANGED
@@ -10,4 +10,4 @@ Last updated: 2024-12-16
10
10
 
11
11
  """
12
12
 
13
- __version__ = "0.0.22"
13
+ __version__ = "0.0.24"
@@ -21,9 +21,7 @@ class MoleculeParameters(BaseModel):
21
21
  diffusion_coefficient: List[List[float]] = Field(
22
22
  description="Diffusion coefficients in um^2/s"
23
23
  )
24
- diffusion_track_amount: List[List[float]]
25
24
  hurst_exponent: List[List[float]]
26
- hurst_track_amount: List[List[float]]
27
25
  allow_transition_probability: List[bool]
28
26
  transition_matrix_time_step: List[int] = Field(description="Time step in ms")
29
27
  diffusion_transition_matrix: List[List[List[float]]]
@@ -33,9 +31,7 @@ class MoleculeParameters(BaseModel):
33
31
 
34
32
  @field_validator(
35
33
  "diffusion_coefficient",
36
- "diffusion_track_amount",
37
34
  "hurst_exponent",
38
- "hurst_track_amount",
39
35
  "state_probability_diffusion",
40
36
  "state_probability_hurst",
41
37
  )
@@ -20,7 +20,6 @@ Usage:
20
20
  condensate(times, time_unit) -> dict{"Position":np.ndarray, "Scale":float}
21
21
  """
22
22
 
23
- import matplotlib.pyplot as plt
24
23
  import numpy as np
25
24
 
26
25
  from ..cells.rectangular_cell import RectangularCell
@@ -310,47 +309,3 @@ class Condensate:
310
309
  # make array of length time with the last scale
311
310
  scale = np.full(time.shape, last_scale)
312
311
  return scale
313
-
314
- def plot_condensate(self, ax, **kwargs):
315
- """
316
- Plots the condensate
317
-
318
- Parameters:
319
- -----------
320
- ax: plt.Axes
321
- Axes to plot the condensate on.
322
- **kwargs:
323
- Keyword arguments to pass to the plot function.
324
- """
325
- # check if the _condensate_positions exists
326
- if not hasattr(self, "_condensate_positions"):
327
- # if it doesn't then we need to generate the condensate positions
328
- self.times = np.array([self.initial_time])
329
- self.condensate_positions = np.array([self.initial_position])
330
- self.scale = np.array([self.initial_scale])
331
-
332
- # plot the condensate positions
333
- ax.plot(
334
- self.condensate_positions[:, 0], self.condensate_positions[:, 1], **kwargs
335
- )
336
-
337
- # plot a circle at all the positions with the scale as the radius
338
- for i in range(len(self.condensate_positions)):
339
- ax.add_patch(
340
- plt.Circle(
341
- self.condensate_positions[i], self.scale[i], color="r", fill=False
342
- )
343
- )
344
-
345
- # plot the initial position in a different colour
346
- ax.scatter(self.initial_position[0], self.initial_position[1], color="g")
347
- # plot the final position in a different colour
348
- ax.scatter(
349
- self.condensate_positions[-1][0],
350
- self.condensate_positions[-1][1],
351
- color="b",
352
- )
353
- if "save_path" in kwargs:
354
- plt.savefig(kwargs["save_path"])
355
- # plt.show()
356
- return ax
@@ -305,7 +305,7 @@ def create_binning_function(input_shape, binning_size, mode="sum"):
305
305
  numpy.ndarray
306
306
  Binned array
307
307
  """
308
- if array.shape != input_shape:
308
+ if array.shape != tuple(input_shape):
309
309
  raise ValueError(
310
310
  f"Input array shape {array.shape} does not match expected shape {input_shape}"
311
311
  )
@@ -96,7 +96,10 @@ class LaserParameters:
96
96
  Power in watts
97
97
  """
98
98
  if callable(self.power):
99
- return self.power(t)
99
+ power = self.power(t)
100
+ if power < 0:
101
+ raise ValueError("Laser Power Cannot be Negative")
102
+ return power
100
103
  return self.power
101
104
 
102
105
  def get_position(self, t: float) -> Tuple[float, float, float]:
@@ -100,12 +100,19 @@ class PSFEngine:
100
100
 
101
101
  def _generate_pinhole_mask(self) -> NDArray[np.float64]:
102
102
  """Generate a binary mask representing the pinhole's spatial filtering.
103
-
104
- The pinhole blocks emission light based on position in the image plane,
105
- affecting what portion of the diffracted light reaches the detector.
103
+ The pinhole is centered on the grid, blocking emission light based on position
104
+ in the image plane, affecting what portion of the diffracted light reaches
105
+ the detector.
106
106
  """
107
107
  x, y = self._grid_xy
108
- r = np.sqrt(x**2 + y**2)
108
+
109
+ # Calculate the grid center
110
+ x_center = (x.max() + x.min()) / 2
111
+ y_center = (y.max() + y.min()) / 2
112
+
113
+ # Calculate radial distance from grid center
114
+ r = np.sqrt((x - x_center) ** 2 + (y - y_center) ** 2)
115
+
109
116
  return (r <= self.params.pinhole_radius).astype(np.float64)
110
117
 
111
118
  @lru_cache(maxsize=128)
@@ -27,6 +27,7 @@ class StateTransitionCalculator:
27
27
  self.current_global_time = current_global_time # ms (oversample motion time)
28
28
  self.laser_intensity_generator = laser_intensity_generator
29
29
  self.fluorescent_state_history = {} # {fluorescent.state.name : [delta time (seconds), laser_intensites], ...}
30
+ self.current_global_time_s = self.current_global_time * 1e-3
30
31
 
31
32
  def __call__(
32
33
  self,
@@ -48,7 +49,9 @@ class StateTransitionCalculator:
48
49
  time = 0
49
50
  transitions = self.flurophoreobj.state_history[self.current_global_time][2]
50
51
  final_state_name = transitions[0].from_state
51
- laser_intensities = self._initialize_state_hist(self.current_global_time, time)
52
+ laser_intensities = self._initialize_state_hist(
53
+ self.current_global_time, time + self.current_global_time_s
54
+ )
52
55
 
53
56
  while time < self.time_duration:
54
57
  stateTransitionMatrixR = [
AMS_BP/sim_config.toml CHANGED
@@ -23,18 +23,8 @@ diffusion_coefficient = [
23
23
  0.0,
24
24
  ],
25
25
  ] # um^2/s, size of each index (eg. len(...[0]) is the # of diffusion coefficients the system can explore.
26
- diffusion_track_amount = [
27
- [
28
- 0.5,
29
- 0.5,
30
- ],
31
- [
32
- 0.5,
33
- 0.5,
34
- ],
35
- ] # only usefull for initial distribution of diffusion coefficients to trajectories.
26
+
36
27
  hurst_exponent = [[0.5], [0.5]]
37
- hurst_track_amount = [[1.0], [1.0]]
38
28
  allow_transition_probability = [true, true] # bool
39
29
  transition_matrix_time_step = [
40
30
  20,
@@ -193,12 +183,6 @@ to_state = "triplet"
193
183
  photon_dependent = false
194
184
  base_rate = 1 # 1/s
195
185
 
196
- [fluorophores.PAmCherry.transitions.triplet_to_bleached]
197
- from_state = "triplet"
198
- to_state = "bleached"
199
- photon_dependent = false
200
- base_rate = 1 # 1/s
201
-
202
186
  [fluorophores.PAmCherry.transitions.triplet_to_dark]
203
187
  from_state = "triplet"
204
188
  to_state = "dark"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AMS_BP
3
- Version: 0.0.22
3
+ Version: 0.0.24
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
@@ -10,7 +10,6 @@ License-File: LICENSE
10
10
  Keywords: SMS
11
11
  Requires-Python: >=3.10
12
12
  Requires-Dist: jsonschema>=4.23.0
13
- Requires-Dist: matplotlib>=3.6.0
14
13
  Requires-Dist: numpy>=1.21.2
15
14
  Requires-Dist: pydantic>=2.9.2
16
15
  Requires-Dist: scikit-image>=0.18.3
@@ -172,3 +171,5 @@ frames, metadata = function_exp(microscope=microscope, config=config_exp)
172
171
  from AMS_BP.configio.saving import save_config_frames
173
172
  save_config_frames(metadata, frames, setup_config["base_config"].OutputParameters)
174
173
  ```
174
+
175
+ > A more detailed example is provided in the jupyter notebook in the examples. For starters refer to the [VisualizingIndividualModules](examples/VisualizingIndividualModules/modules_explained.ipynb)
@@ -1,6 +1,6 @@
1
- AMS_BP/__init__.py,sha256=NlkysP1_GeDxvsm-dQaJIW9U1iNFB0jI_34DmCYn-bg,327
1
+ AMS_BP/__init__.py,sha256=_0wRoFCXiDI2esMHAgmC0k46izWDlMXa_aqJ_MoW48g,327
2
2
  AMS_BP/run_cell_simulation.py,sha256=7InopFikjo0HfaLO2siXskBIbyCIte9avG4YXjjaWCI,7420
3
- AMS_BP/sim_config.toml,sha256=LVpxp2zv-y6Ic-ve2AG7Ted1Fr_Tni-8yh8l5gp-7oM,12056
3
+ AMS_BP/sim_config.toml,sha256=3IqOQIJYmP5g4okk15nqQiNZb3ij7Pt63HbpI-5tySw,11672
4
4
  AMS_BP/sim_microscopy.py,sha256=0UZfyT44nrB4JdfnFnRPTVBm3tPbCyOnPXiBBZs8xIc,18617
5
5
  AMS_BP/cells/__init__.py,sha256=yWFScBC1uOGDkeC8i1m1ZBtIREcyt4JHxYa72LxbBZU,177
6
6
  AMS_BP/cells/base_cell.py,sha256=FIPB9J8F40tb53vv7C6qG-SaAFLOI8-MGIk1mmZ-gnI,1503
@@ -8,33 +8,33 @@ AMS_BP/cells/rectangular_cell.py,sha256=5yGxvTXYvgldLXyWXpE_SD9Zx2NLerC-I2j02reH
8
8
  AMS_BP/cells/rod_cell.py,sha256=jQ1kLEk74Pv2rcXPRJ6-QJJhux-mYiDSytzqlxCNWfA,3181
9
9
  AMS_BP/cells/spherical_cell.py,sha256=n3ou3tW0nCxXIwv6uLkVKHkYCfgoNn8VI6CVTLBIll0,2140
10
10
  AMS_BP/configio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- AMS_BP/configio/configmodels.py,sha256=Isc6THk3RAIVdjEUBW4c_OD0I122dYufgEvAcGJQ5uo,3046
11
+ AMS_BP/configio/configmodels.py,sha256=Gd2Qdut0u5zS0IpjPwGIB3ur-b4Dfa9e8SbhotBKymc,2894
12
12
  AMS_BP/configio/convertconfig.py,sha256=Fg9pOCZSxmWuHnrg-5xZRvhPEK6Qc1kXqu6LL9e9QYw,34741
13
13
  AMS_BP/configio/experiments.py,sha256=HdfaSi0gPPJ_wLF87XcW5ICja19Uezx7-ygFEwNzi30,3995
14
14
  AMS_BP/configio/saving.py,sha256=596QgAadV32rzsN4B2FngGFcBWCzCDnLFN-qtQsv3bM,857
15
15
  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
- AMS_BP/motion/condensate_movement.py,sha256=cGLHIOL7VUJ7U-JrJXetcnUF2v9SepIBznoqu6AQPxU,13252
18
+ AMS_BP/motion/condensate_movement.py,sha256=eig4WtD7o1cvIafWMjOk6pqxyhe_IIucgLcBEoDvasU,11648
19
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
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
- AMS_BP/optics/camera/detectors.py,sha256=UJqi7owESw9nkFiQhoAe7Q1LIi_fYCzuvZLgtM3yAPk,10348
25
+ AMS_BP/optics/camera/detectors.py,sha256=_815Ovo7Aj375OZh5Xim8pFuZEEcSVtSdnLRYFqb3_8,10355
26
26
  AMS_BP/optics/camera/quantum_eff.py,sha256=ZCvJ8dJESOUbjwblsJIBcCg_b-_DNdhDlkzd7HeGMDg,2378
27
27
  AMS_BP/optics/filters/__init__.py,sha256=oYPk2_wuL4KrwbaZy3gktvO5biQUfdQLUColWhkU1lw,337
28
28
  AMS_BP/optics/filters/filters.py,sha256=-iw7eqmDO77SEqlFTv5jJNVwpA8y93TLsjy5hhsAfiI,6406
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=J9czY646XcW8GzXx9Eb16mG7tQdWw4oVYveOrihZCeY,22745
32
+ AMS_BP/optics/lasers/laser_profiles.py,sha256=dLnobLB-zZIG9EyMkU4E2P9CDl3n3OLzgR8Tx5EAd2c,22864
33
33
  AMS_BP/optics/psf/__init__.py,sha256=ezrKPgpTeR4gTHOvF0mhF6u2zMMTd8Bgp8PGeOf11fA,121
34
- AMS_BP/optics/psf/psf_engine.py,sha256=wabdBszY4CcGUtt7ye8e3tQXQQxDJ8griGD7FMgAdIo,9192
34
+ AMS_BP/optics/psf/psf_engine.py,sha256=Do54D1jMbSrj5uljdTrrEttCvxq3qbVT74acRuOk15c,9434
35
35
  AMS_BP/photophysics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  AMS_BP/photophysics/photon_physics.py,sha256=QRG_QIZ4csJ3g5qGP9Wtk7kzqm8_MUbVHfFef6cMtHQ,6671
37
- AMS_BP/photophysics/state_kinetics.py,sha256=0cc7Vc4LtAbEdGDeg22IJmRGLsONOty4c32hXHO-TSU,5281
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
40
40
  AMS_BP/probabilityfuncs/probability_functions.py,sha256=j_rIxrupGBf_FKkQBh1TvEa34A44jAasaZQRg2u3FuY,11793
@@ -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.22.dist-info/METADATA,sha256=VQheoFTH5ZdmZTZwrb58UxP9YTowy8U7r6zW5kabIMI,5316
52
- ams_bp-0.0.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
- ams_bp-0.0.22.dist-info/entry_points.txt,sha256=MFUK9bZWW61djfsavqopMqiVPVn4lJtt6v8qzyEFyNM,76
54
- ams_bp-0.0.22.dist-info/licenses/LICENSE,sha256=k_-JV1DQKvO0FR8WjvOisqdTl0kp6VJ7RFM3YZhao0c,1071
55
- ams_bp-0.0.22.dist-info/RECORD,,
51
+ ams_bp-0.0.24.dist-info/METADATA,sha256=s8z9bcI32yK1EZINiomMaexx3UFZ1gGJZLDc7412oqk,5483
52
+ ams_bp-0.0.24.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
+ ams_bp-0.0.24.dist-info/entry_points.txt,sha256=MFUK9bZWW61djfsavqopMqiVPVn4lJtt6v8qzyEFyNM,76
54
+ ams_bp-0.0.24.dist-info/licenses/LICENSE,sha256=k_-JV1DQKvO0FR8WjvOisqdTl0kp6VJ7RFM3YZhao0c,1071
55
+ ams_bp-0.0.24.dist-info/RECORD,,