AMS-BP 0.2.0__py3-none-any.whl → 0.3.1__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.2.0"
13
+ __version__ = "0.3.1"
@@ -37,7 +37,7 @@ class BuddingCell(BaseCell):
37
37
  bud_distance: float
38
38
  neck_radius: float
39
39
 
40
- def is_point_inside(
40
+ def contains_point_fallback(
41
41
  self, x: float, y: float, z: float, tolerance: float = 1e-3
42
42
  ) -> bool:
43
43
  """
@@ -40,7 +40,7 @@ _CELL_CREATION_MAP: Dict[CellType, Tuple[Callable, List[str]]] = {
40
40
  CellType.RECTANGULAR: (make_RectangularCell, ["bounds"]),
41
41
  CellType.OVOID: (
42
42
  make_OvoidCell,
43
- ["center", "direction", "xradius", "yradius", "zradius"],
43
+ ["center", "xradius", "yradius", "zradius"],
44
44
  ),
45
45
  CellType.BUDDINGYEAST: (
46
46
  make_BuddingCell,
@@ -1,4 +1,4 @@
1
- from typing import Any, Dict, List, Literal, Union
1
+ from typing import Any, Dict, List, Literal, Optional, Union
2
2
 
3
3
  import numpy as np
4
4
  from pydantic import BaseModel, Field, field_validator
@@ -85,8 +85,8 @@ class OutputParameters(BaseModel):
85
85
 
86
86
 
87
87
  class ConfigList(BaseModel):
88
- CellParameters: CellParameters
89
- MoleculeParameters: MoleculeParameters
90
- GlobalParameters: GlobalParameters
91
- CondensateParameters: CondensateParameters
92
- OutputParameters: OutputParameters
88
+ CellParameter: Optional[CellParameters] = None
89
+ MoleculeParameter: Optional[MoleculeParameters] = None
90
+ GlobalParameter: GlobalParameters
91
+ CondensateParameter: Optional[CondensateParameters] = None
92
+ OutputParameter: Optional[OutputParameters] = None
@@ -647,11 +647,11 @@ class ConfigLoader:
647
647
  # base config
648
648
  self.populate_dataclass_schema()
649
649
  base_config = ConfigList(
650
- CellParameters=self.cell_params,
651
- MoleculeParameters=self.molecule_params,
652
- GlobalParameters=self.global_params,
653
- CondensateParameters=self.condensate_params,
654
- OutputParameters=self.output_params,
650
+ CellParameter=self.cell_params,
651
+ MoleculeParameter=self.molecule_params,
652
+ GlobalParameter=self.global_params,
653
+ CondensateParameter=self.condensate_params,
654
+ OutputParameter=self.output_params,
655
655
  )
656
656
 
657
657
  # fluorophore config
@@ -666,41 +666,41 @@ class ConfigLoader:
666
666
  detector, qe = self.create_detector_from_config(self.config)
667
667
 
668
668
  # make cell
669
- cell = make_cell(cell_params=base_config.CellParameters)
669
+ cell = make_cell(cell_params=base_config.CellParameter)
670
670
 
671
671
  # make initial sample plane
672
672
  sample_plane = make_sample(
673
- global_params=base_config.GlobalParameters,
673
+ global_params=base_config.GlobalParameter,
674
674
  cell=cell,
675
675
  )
676
676
 
677
677
  # make condensates_dict
678
678
  condensates_dict = make_condensatedict(
679
- condensate_params=base_config.CondensateParameters, cell=cell
679
+ condensate_params=base_config.CondensateParameter, cell=cell
680
680
  )
681
681
 
682
682
  # make sampling function
683
683
  sampling_functions = make_samplingfunction(
684
- condensate_params=base_config.CondensateParameters, cell=cell
684
+ condensate_params=base_config.CondensateParameter, cell=cell
685
685
  )
686
686
 
687
687
  # create initial positions
688
688
  initial_molecule_positions = gen_initial_positions(
689
- molecule_params=base_config.MoleculeParameters,
689
+ molecule_params=base_config.MoleculeParameter,
690
690
  cell=cell,
691
- condensate_params=base_config.CondensateParameters,
691
+ condensate_params=base_config.CondensateParameter,
692
692
  sampling_functions=sampling_functions,
693
693
  )
694
694
 
695
695
  # create the track generator
696
696
  track_generators = create_track_generator(
697
- global_params=base_config.GlobalParameters, cell=cell
697
+ global_params=base_config.GlobalParameter, cell=cell
698
698
  )
699
699
 
700
700
  # get all the tracks
701
701
  tracks, points_per_time = get_tracks(
702
- molecule_params=base_config.MoleculeParameters,
703
- global_params=base_config.GlobalParameters,
702
+ molecule_params=base_config.MoleculeParameter,
703
+ global_params=base_config.GlobalParameter,
704
704
  initial_positions=initial_molecule_positions,
705
705
  track_generator=track_generators,
706
706
  )
@@ -196,7 +196,7 @@ def run_cell_simulation(
196
196
 
197
197
  # save
198
198
  save_config_frames(
199
- metadata, frames, setup_config["base_config"].OutputParameters
199
+ metadata, frames, setup_config["base_config"].OutputParameter
200
200
  )
201
201
 
202
202
  progress.update(task_2, completed=None)
AMS_BP/sim_microscopy.py CHANGED
@@ -132,8 +132,8 @@ class VirtualMicroscope:
132
132
  self._set_laser_positions(laser_positions=laser_position)
133
133
 
134
134
  duration_total, exposure_time, interval_time = timeValidator(
135
- self.config.GlobalParameters.exposure_time,
136
- self.config.GlobalParameters.interval_time,
135
+ self.config.GlobalParameter.exposure_time,
136
+ self.config.GlobalParameter.interval_time,
137
137
  self.sample_plane.dt,
138
138
  self.sample_plane.t_end,
139
139
  self._time,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AMS_BP
3
- Version: 0.2.0
3
+ Version: 0.3.1
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
@@ -9,7 +9,7 @@ Maintainer-email: Baljyot Singh Parmar <baljyotparmar@hotmail.com>
9
9
  License-File: LICENSE
10
10
  Keywords: SMS
11
11
  Requires-Python: >=3.12
12
- Requires-Dist: boundedfbm>=0.2.0
12
+ Requires-Dist: boundedfbm>=0.4.0
13
13
  Requires-Dist: jsonschema>=4.23.0
14
14
  Requires-Dist: numpy>=1.21.2
15
15
  Requires-Dist: pydantic>=2.9.2
@@ -29,8 +29,24 @@ Description-Content-Type: text/markdown
29
29
 
30
30
  AMS-BP is a powerful simulation tool for advanced fluorescence microscopy experiments. This guide covers both command-line usage and library integration.
31
31
 
32
- > **_NOTE:_** Please note that this application DOES NOT currently model the process of stimulated emission, and as such is not suitable for simulating stimulated emission microscopy ([STED](https://en.wikipedia.org/wiki/STED_microscopy))-type experiments. Work in this area is ongoing.
32
+ ## Overview of Simulation Workflow
33
+ <img align = "left" src="./docs/assets/figures/Fig1_Schema.svg" width="500"/>
34
+
35
+ *A ground truth is created, **a**, with $`f_{n}`$ fluorophore types of $`N_{f_{n}}`$ molecules each. If applicable, the motion of these molecules is modelled using a 3D bounded FBM with fluctuating generalized diffusion coefficients and Hurst parameters. Variations are modelled as a Markov Chain and require rate constants as parameters. Different fluorophores can have different motion models. The resolution of the motion models is $`\Delta t`$ and cannot be smaller than 1 ms (for computational efficiency). Given the microscope parameters specific to the experimental procedure to simulate, at every time $`t_{j}`$, the excitation intensity for each channel (**b**) is calculated at each fluorophore's location, **c**. For $`t_{j} \rightarrow t_{j+\Delta t}`$, the photophysical state trajectory of the fluorophore is simulated using the light intensity at the molecule's location as input for any light-dependent transition rates, **d**. For the duration that the shutter is open and light is emitted from the sample, emission filters for each channel are applied before the convolution with PSF models, **e**. The incident photons on the detector are then converted to photoelectrons and finally to digital units using the detector models provided, **f**.*
36
+
37
+ ## API Reference and Docs
38
+ Find detailed API references for the library at: [joemans3/github.io/AMS_BP](https://joemans3.github.io/AMS_BP/)
39
+ > A more detailed example is provided in the jupyter notebook in the examples. For starters refer to the [VisualizingIndividualModules](examples/VisualizingIndividualModules/modules_explained.ipynb). Then head over to the [laser modulation module](examples/VisualizingIndividualModules/laser_modulation.ipynb) which will show how to change the laser power over time in the simulations. Then view an example of a complex experiment setup for [FRAP](examples/QuantitativeExperiments/FRAP/FRAP_methods.ipynb) which is possible by the use of compositions of modules in this simulation library.
33
40
 
41
+ ## Examples (Click on the image buttons to be taken to the Jupyter notebooks):
42
+
43
+ > !!ATTENTION!! - Please note that you NEED to install the developmental dependencies to run the examples in full. This is mainly for installing the Jupyter notebook extensions, matplotlib and other visualization packages.
44
+
45
+ [<img src="./docs/assets/buttons/ButtonFigure_FRAP.svg" width="300" height="120"/>](./examples/QuantitativeExperiments/FRAP/FRAP_methods.ipynb) [<img src="./docs/assets/buttons/ButtonFigure_fPALM_NPC.svg" width="300"/>](./examples/QuantitativeExperiments/FRAP/FRAP_methods.ipynb)
46
+
47
+ [<img src="./docs/assets/buttons/ButtonFigure_zstack_twocolor_widefield.svg" width="300"/>](./examples/QuantitativeExperiments/TwoColor/Widefield/widefield_twocolor.ipynb) [<img src="./docs/assets/buttons/ButtonFigure_zstack_twocolor_confocal.svg" width="300"/>](./examples/QuantitativeExperiments/TwoColor/Confocal/confocal_twocolor.ipynb)
48
+
49
+ [<img align="middle" src="./docs/assets/buttons/ButtonFigure_sptPALM_mmaple.svg" width="300"/>](./examples/QuantitativeExperiments/PALM/sptPALM/motionmodels_sptmmaple.ipynb)
34
50
  ## Table of Contents
35
51
  - [Installation](#installation)
36
52
  - [Command Line Interface](#command-line-interface)
@@ -81,13 +97,6 @@ run_AMS_BP runsim CONFIG_FILE
81
97
  - `-o, --output_path PATH`: Specify the output directory for the configuration file
82
98
  - `-r, --recursive_o`: Create output directory if it doesn't exist
83
99
 
84
- ## Overview of Simulation Workflow
85
- ![Overview Schematic](./docs/assets/figures/Fig1_Schema.svg)
86
- *A ground truth is created, **a**, with $`f_{n}`$ fluorophore types of $`N_{f_{n}}`$ molecules each. If applicable, the motion of these molecules is modelled using a 3D bounded FBM with fluctuating generalized diffusion coefficients and Hurst parameters. Variations are modelled as a Markov Chain and require rate constants as parameters. Different fluorophores can have different motion models. The resolution of the motion models is $`\Delta t`$ and cannot be smaller than 1 ms (for computational efficiency). Given the microscope parameters specific to the experimental procedure to simulate, at every time $`t_{j}`$, the excitation intensity for each channel (**b**) is calculated at each fluorophore's location, **c**. For $`t_{j} \rightarrow t_{j+\Delta t}`$, the photophysical state trajectory of the fluorophore is simulated using the light intensity at the molecule's location as input for any light-dependent transition rates, **d**. For the duration that the shutter is open and light is emitted from the sample, emission filters for each channel are applied before the convolution with PSF models, **e**. The incident photons on the detector are then converted to photoelectrons and finally to digital units using the detector models provided, **f**.*
87
-
88
-
89
-
90
-
91
100
 
92
101
  ## Configuration File
93
102
 
@@ -155,7 +164,17 @@ laser_names_active = ["red", "blue"]
155
164
  laser_powers_active = [0.5, 0.05]
156
165
  laser_positions_active = [[5, 5, 0], [5, 5, 0]]
157
166
  ```
158
-
167
+ To run the default configuration:
168
+ 1. Make sure you followed the uv tool installation.
169
+ 2. Make a copy of the default configuration file using the command:
170
+ ```bash
171
+ run_AMS_BP config
172
+ ```
173
+ 3. Run the sim:
174
+ ```bash
175
+ run_AMS_BP runsim sim_config.toml
176
+ ```
177
+ 4. View the results in the newly created folder, whose name is defined in the config file.
159
178
  ## Advanced Usage
160
179
 
161
180
  ### Using AMS-BP as a Library
@@ -181,13 +200,10 @@ frames, metadata = function_exp(microscope=microscope, config=config_exp)
181
200
  from AMS_BP.configio.saving import save_config_frames
182
201
  save_config_frames(metadata, frames, setup_config["base_config"].OutputParameters)
183
202
  ```
184
-
185
- ## API Reference and Docs
186
- Find detailed API references for the library at: [joemans3/github.io/AMS_BP](https://joemans3.github.io/AMS_BP/)
187
- > A more detailed example is provided in the jupyter notebook in the examples. For starters refer to the [VisualizingIndividualModules](examples/VisualizingIndividualModules/modules_explained.ipynb). Then head over to the [laser modulation module](examples/VisualizingIndividualModules/laser_modulation.ipynb) which will show how to change the laser power over time in the simulations. Then view an example of a complex experiment setup for [FRAP](examples/QuantitativeExperiments/FRAP_methods.ipynb) which is possible by the use of compositions of modules in this simulation library.
203
+ > **_NOTE:_** Please note that this application DOES NOT currently model the process of stimulated emission, and as such is not suitable for simulating stimulated emission microscopy ([STED](https://en.wikipedia.org/wiki/STED_microscopy))-type experiments. Work in this area is ongoing.
188
204
 
189
205
  ## High Priority Features
190
- 1. Irregular cell shapes with motion models
206
+ ~~1. Irregular cell shapes with motion models~~ (supported with release of v0.2.0)
191
207
  2. Stimulated Emission models
192
208
  3. STORM workflow examples
193
209
  4. CTRW motion models
@@ -1,13 +1,13 @@
1
- AMS_BP/__init__.py,sha256=pj8JaDmWwnqBAxuQAgDPFFVkI2FOkCRpIN4GlyKBTQw,326
2
- AMS_BP/run_cell_simulation.py,sha256=7InopFikjo0HfaLO2siXskBIbyCIte9avG4YXjjaWCI,7420
1
+ AMS_BP/__init__.py,sha256=H6Hnoehl90XIkGR-l7GpvZiYTQ6AEXD3EfzjFTtS2Sc,326
2
+ AMS_BP/run_cell_simulation.py,sha256=P_0fHB7S7SQibqXaaqOxRC1UqSunGZdJXs-4thC6DUI,7419
3
3
  AMS_BP/sim_config.toml,sha256=G0wW9qsxciZA1Y0Zm6YgZ00ZDBEBBLw_XXq4gsVRjSY,11778
4
- AMS_BP/sim_microscopy.py,sha256=Vsga9lTWqP0pjEnfFj0qKaSz7YZ_F4E3TqsaErwhi3E,19991
4
+ AMS_BP/sim_microscopy.py,sha256=3BYrFLzjcAevlyBQXAM0PixHM8GA5BnnAHouGVDNbMw,19989
5
5
  AMS_BP/cells/__init__.py,sha256=Rd2gpWWUZJxW2u_piI2ZcIqLtYkzVOr_MjU3upiUv8Q,866
6
- AMS_BP/cells/budding_yeast_cell.py,sha256=BiZ_rML5xjcS8NMP785VzUPVxo41yhihsbvbwSYLQvM,9440
7
- AMS_BP/cells/cell_factory.py,sha256=Mhk-0KzLVfaub81Asj5PibOcps0s8I24iC4qZs0VVK4,4435
6
+ AMS_BP/cells/budding_yeast_cell.py,sha256=_n0jhiRvrMcPddfoR8Vi4RdOJQTo_nR4JF7ydsrCF98,9448
7
+ AMS_BP/cells/cell_factory.py,sha256=a-M5xHDkYDHoMv3vbQyn4x0KQ-lshO2CEdfrStLGSOU,4422
8
8
  AMS_BP/configio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- AMS_BP/configio/configmodels.py,sha256=9rPXIYh228fEEf4tDGcE0kSC_RB97VocBaIobhCeuBQ,2998
10
- AMS_BP/configio/convertconfig.py,sha256=Np2xKMnAKMkqPip_uqGYOUmp7_5BWn1ZnUBesfkyvis,34588
9
+ AMS_BP/configio/configmodels.py,sha256=pp4haDLjGCMoERKq995v6lBXGhpen0-qE3ZWnd99bjM,3071
10
+ AMS_BP/configio/convertconfig.py,sha256=18Xg3nrE0mI0em610FEJxI1dU_N24EQf06EqDstsAVk,34574
11
11
  AMS_BP/configio/experiments.py,sha256=HdfaSi0gPPJ_wLF87XcW5ICja19Uezx7-ygFEwNzi30,3995
12
12
  AMS_BP/configio/saving.py,sha256=596QgAadV32rzsN4B2FngGFcBWCzCDnLFN-qtQsv3bM,857
13
13
  AMS_BP/groundtruth_generators/__init__.py,sha256=UPVmhiB81OfyqAes5LoN-n6XgQuBCYCqRPAGd2jpMfc,99
@@ -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=9Qlr4kjY04fObktR8TrzB0IgoG1yXtcmxPRX9AN34mM,9671
51
- ams_bp-0.2.0.dist-info/METADATA,sha256=GJLdow0hQ3y6LLNubb0q0xfzw00oSeftbRgfnr_K4u8,7658
52
- ams_bp-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
- ams_bp-0.2.0.dist-info/entry_points.txt,sha256=MFUK9bZWW61djfsavqopMqiVPVn4lJtt6v8qzyEFyNM,76
54
- ams_bp-0.2.0.dist-info/licenses/LICENSE,sha256=k_-JV1DQKvO0FR8WjvOisqdTl0kp6VJ7RFM3YZhao0c,1071
55
- ams_bp-0.2.0.dist-info/RECORD,,
51
+ ams_bp-0.3.1.dist-info/METADATA,sha256=mU78kPY_FuQsUMkTcr-JaNB9k2jnAw8gFZOByanZ-Iw,9153
52
+ ams_bp-0.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
+ ams_bp-0.3.1.dist-info/entry_points.txt,sha256=MFUK9bZWW61djfsavqopMqiVPVn4lJtt6v8qzyEFyNM,76
54
+ ams_bp-0.3.1.dist-info/licenses/LICENSE,sha256=k_-JV1DQKvO0FR8WjvOisqdTl0kp6VJ7RFM3YZhao0c,1071
55
+ ams_bp-0.3.1.dist-info/RECORD,,
File without changes