AMS-BP 0.0.2__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 +13 -0
- AMS_BP/cells/__init__.py +5 -0
- AMS_BP/cells/base_cell.py +55 -0
- AMS_BP/cells/rectangular_cell.py +82 -0
- AMS_BP/cells/rod_cell.py +98 -0
- AMS_BP/cells/spherical_cell.py +74 -0
- AMS_BP/configio/__init__.py +0 -0
- AMS_BP/configio/configmodels.py +93 -0
- AMS_BP/configio/convertconfig.py +910 -0
- AMS_BP/configio/experiments.py +121 -0
- AMS_BP/configio/saving.py +32 -0
- AMS_BP/metadata/__init__.py +0 -0
- AMS_BP/metadata/metadata.py +87 -0
- AMS_BP/motion/__init__.py +4 -0
- AMS_BP/motion/condensate_movement.py +356 -0
- AMS_BP/motion/movement/__init__.py +10 -0
- AMS_BP/motion/movement/boundary_conditions.py +75 -0
- AMS_BP/motion/movement/fbm_BP.py +244 -0
- AMS_BP/motion/track_gen.py +541 -0
- AMS_BP/optics/__init__.py +0 -0
- AMS_BP/optics/camera/__init__.py +4 -0
- AMS_BP/optics/camera/detectors.py +320 -0
- AMS_BP/optics/camera/quantum_eff.py +66 -0
- AMS_BP/optics/filters/__init__.py +17 -0
- AMS_BP/optics/filters/channels/__init__.py +0 -0
- AMS_BP/optics/filters/channels/channelschema.py +27 -0
- AMS_BP/optics/filters/filters.py +184 -0
- AMS_BP/optics/lasers/__init__.py +28 -0
- AMS_BP/optics/lasers/laser_profiles.py +691 -0
- AMS_BP/optics/psf/__init__.py +7 -0
- AMS_BP/optics/psf/psf_engine.py +215 -0
- AMS_BP/photophysics/__init__.py +0 -0
- AMS_BP/photophysics/photon_physics.py +181 -0
- AMS_BP/photophysics/state_kinetics.py +146 -0
- AMS_BP/probabilityfuncs/__init__.py +0 -0
- AMS_BP/probabilityfuncs/markov_chain.py +143 -0
- AMS_BP/probabilityfuncs/probability_functions.py +350 -0
- AMS_BP/run_cell_simulation.py +217 -0
- AMS_BP/sample/__init__.py +0 -0
- AMS_BP/sample/flurophores/__init__.py +16 -0
- AMS_BP/sample/flurophores/flurophore_schema.py +290 -0
- AMS_BP/sample/sim_sampleplane.py +334 -0
- AMS_BP/sim_config.toml +418 -0
- AMS_BP/sim_microscopy.py +453 -0
- AMS_BP/utils/__init__.py +0 -0
- AMS_BP/utils/constants.py +11 -0
- AMS_BP/utils/decorators.py +227 -0
- AMS_BP/utils/errors.py +37 -0
- AMS_BP/utils/maskMaker.py +12 -0
- AMS_BP/utils/util_functions.py +319 -0
- ams_bp-0.0.2.dist-info/METADATA +173 -0
- ams_bp-0.0.2.dist-info/RECORD +55 -0
- ams_bp-0.0.2.dist-info/WHEEL +4 -0
- ams_bp-0.0.2.dist-info/entry_points.txt +2 -0
- ams_bp-0.0.2.dist-info/licenses/LICENSE +21 -0
AMS_BP/utils/errors.py
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# error base classes for SMS_BP
|
2
|
+
|
3
|
+
|
4
|
+
class HurstValueError(Exception):
|
5
|
+
"""Raised when the Hurst value is not within the range (0, 1)"""
|
6
|
+
|
7
|
+
pass
|
8
|
+
|
9
|
+
|
10
|
+
class SpaceLimitError(Exception):
|
11
|
+
"""Raised when the space limit is not within the range (-inf, inf)"""
|
12
|
+
|
13
|
+
pass
|
14
|
+
|
15
|
+
|
16
|
+
class DiffusionHighError(Exception):
|
17
|
+
"""Raised when the diffusion value is too high for the space limit"""
|
18
|
+
|
19
|
+
pass
|
20
|
+
|
21
|
+
|
22
|
+
class HurstHighError(Exception):
|
23
|
+
"""Raised when the Hurst value is too high for the space limit"""
|
24
|
+
|
25
|
+
pass
|
26
|
+
|
27
|
+
|
28
|
+
class ConfigValidationError(Exception):
|
29
|
+
"""Exception raised for errors in the configuration validation."""
|
30
|
+
|
31
|
+
pass
|
32
|
+
|
33
|
+
|
34
|
+
class ConfigConversionError(Exception):
|
35
|
+
"""Exception raised for errors in the configuration conversion process."""
|
36
|
+
|
37
|
+
pass
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import numpy as np
|
2
|
+
|
3
|
+
|
4
|
+
def mask_maker(
|
5
|
+
total_img_dims: np.ndarray, submask_coordinates: np.ndarray, mask_val: int
|
6
|
+
) -> np.ndarray:
|
7
|
+
img = np.zeros(total_img_dims)
|
8
|
+
img[
|
9
|
+
submask_coordinates[1][0] : submask_coordinates[1][1],
|
10
|
+
submask_coordinates[0][0] : submask_coordinates[0][1],
|
11
|
+
] = mask_val
|
12
|
+
return img
|
@@ -0,0 +1,319 @@
|
|
1
|
+
import json
|
2
|
+
import os
|
3
|
+
import pickle
|
4
|
+
|
5
|
+
import numpy as np
|
6
|
+
import skimage as skimage
|
7
|
+
from PIL import Image
|
8
|
+
|
9
|
+
from ..utils.decorators import cache
|
10
|
+
|
11
|
+
|
12
|
+
def convert_arrays_to_lists(obj: np.ndarray | dict) -> list | dict:
|
13
|
+
"""
|
14
|
+
Recursively convert NumPy arrays to lists.
|
15
|
+
|
16
|
+
Parameters:
|
17
|
+
-----------
|
18
|
+
obj : np.ndarray | dict
|
19
|
+
Object to be converted.
|
20
|
+
|
21
|
+
Returns:
|
22
|
+
--------
|
23
|
+
list | dict
|
24
|
+
Converted object with NumPy arrays replaced by lists.
|
25
|
+
"""
|
26
|
+
if isinstance(obj, np.ndarray):
|
27
|
+
return obj.tolist()
|
28
|
+
elif isinstance(obj, dict):
|
29
|
+
return {k: convert_arrays_to_lists(v) for k, v in obj.items()}
|
30
|
+
else:
|
31
|
+
return obj
|
32
|
+
|
33
|
+
|
34
|
+
# Function to recursively convert lists to NumPy arrays
|
35
|
+
def convert_lists_to_arrays(obj: list | dict) -> np.ndarray | dict:
|
36
|
+
"""
|
37
|
+
Recursively convert lists to NumPy arrays.
|
38
|
+
|
39
|
+
Parameters:
|
40
|
+
-----------
|
41
|
+
obj : list | dict
|
42
|
+
Object to be converted.
|
43
|
+
|
44
|
+
Returns:
|
45
|
+
--------
|
46
|
+
np.ndarray | dict
|
47
|
+
Converted object with lists replaced by NumPy arrays.
|
48
|
+
"""
|
49
|
+
if isinstance(obj, list):
|
50
|
+
return np.array(obj)
|
51
|
+
elif isinstance(obj, dict):
|
52
|
+
return {k: convert_lists_to_arrays(v) for k, v in obj.items()}
|
53
|
+
else:
|
54
|
+
return obj
|
55
|
+
|
56
|
+
|
57
|
+
def save_tiff(
|
58
|
+
image: np.ndarray, path: str, img_name: str | None = None, tifffile_args: dict = {}
|
59
|
+
) -> None:
|
60
|
+
"""
|
61
|
+
Save the image as a TIFF file.
|
62
|
+
|
63
|
+
Parameters:
|
64
|
+
-----------
|
65
|
+
image : np.ndarray
|
66
|
+
Image to be saved.
|
67
|
+
path : str
|
68
|
+
Path where the image will be saved.
|
69
|
+
img_name : str, optional
|
70
|
+
Name of the image file (without extension), by default None.
|
71
|
+
tifffile_args: dict(str, val)
|
72
|
+
named arguments passed to the tifffile plugin as a dict.
|
73
|
+
|
74
|
+
Returns:
|
75
|
+
--------
|
76
|
+
None
|
77
|
+
"""
|
78
|
+
if img_name is None:
|
79
|
+
skimage.io.imsave(path, image)
|
80
|
+
else:
|
81
|
+
skimage.io.imsave(
|
82
|
+
os.path.join(path, img_name + ".tiff"),
|
83
|
+
image,
|
84
|
+
plugin="tifffile",
|
85
|
+
plugin_args=tifffile_args,
|
86
|
+
)
|
87
|
+
return
|
88
|
+
|
89
|
+
|
90
|
+
def binning_array(
|
91
|
+
array_to_bin: np.ndarray, binning_size: int, mode: str = "sum"
|
92
|
+
) -> np.ndarray:
|
93
|
+
"""
|
94
|
+
Bin an N-dimensional array by summing values in each bin.
|
95
|
+
|
96
|
+
Parameters:
|
97
|
+
-----------
|
98
|
+
array_to_bin: numpy.ndarray
|
99
|
+
Input N-dimensional array to be binned
|
100
|
+
binning_size : int
|
101
|
+
Size of the binning window (e.g., 2 for 2x2 binning)
|
102
|
+
mode : str, optional
|
103
|
+
Method for binning. Currently only supports 'sum'
|
104
|
+
|
105
|
+
Returns:
|
106
|
+
--------
|
107
|
+
numpy.ndarray
|
108
|
+
Binned array with reduced dimensions
|
109
|
+
"""
|
110
|
+
if binning_size == 1:
|
111
|
+
return array_to_bin
|
112
|
+
if mode != "sum":
|
113
|
+
raise ValueError("Only 'sum' mode is currently supported")
|
114
|
+
|
115
|
+
# Get the shape of the input array
|
116
|
+
original_shape = np.array(array_to_bin.shape)
|
117
|
+
|
118
|
+
# Calculate the shape of the output array
|
119
|
+
# We need to handle both cases where the dimension is divisible by binning_size
|
120
|
+
# and where it's not
|
121
|
+
output_shape = np.ceil(original_shape / binning_size).astype(int)
|
122
|
+
|
123
|
+
# Calculate the effective shape that we can fully bin
|
124
|
+
# This handles cases where the array dimensions aren't perfectly divisible
|
125
|
+
effective_shape = (output_shape * binning_size) - original_shape
|
126
|
+
|
127
|
+
# Pad the array if necessary to make it divisible by binning_size
|
128
|
+
if np.any(effective_shape > 0):
|
129
|
+
pad_width = np.array([(0, int(s)) for s in effective_shape])
|
130
|
+
array_to_bin = np.pad(array_to_bin, pad_width, mode="constant")
|
131
|
+
|
132
|
+
# Generate slicing for the reshape operation
|
133
|
+
new_shape = []
|
134
|
+
for dim in array_to_bin.shape:
|
135
|
+
new_shape.extend([dim // binning_size, binning_size])
|
136
|
+
|
137
|
+
# Reshape and sum along the appropriate axes
|
138
|
+
reshaped = array_to_bin.reshape(new_shape)
|
139
|
+
|
140
|
+
# Calculate the axes to sum over
|
141
|
+
# For N dimensions, we want to sum over axes 1, 3, 5, etc.
|
142
|
+
sum_axes = tuple(range(1, len(new_shape), 2))
|
143
|
+
|
144
|
+
# Perform the binning by summing
|
145
|
+
binned = reshaped.sum(axis=sum_axes)
|
146
|
+
|
147
|
+
return binned
|
148
|
+
|
149
|
+
|
150
|
+
# function to perform the subsegmentation
|
151
|
+
def sub_segment(
|
152
|
+
img: np.ndarray,
|
153
|
+
subsegment_num: int,
|
154
|
+
img_name: str | None = None,
|
155
|
+
subsegment_type: str = "mean",
|
156
|
+
) -> list[np.ndarray]:
|
157
|
+
"""
|
158
|
+
Perform subsegmentation on the image.
|
159
|
+
|
160
|
+
Parameters:
|
161
|
+
-----------
|
162
|
+
img : np.ndarray
|
163
|
+
Image to be subsegmented.
|
164
|
+
subsegment_num : int
|
165
|
+
Number of subsegments to be created.
|
166
|
+
img_name : str, optional
|
167
|
+
Name of the image, by default None.
|
168
|
+
subsegment_type : str, optional
|
169
|
+
Type of subsegmentation to be performed. Options are "mean", "max", "std". Default is "mean".
|
170
|
+
|
171
|
+
Returns:
|
172
|
+
--------
|
173
|
+
list[np.ndarray]
|
174
|
+
List of subsegmented images.
|
175
|
+
|
176
|
+
Raises:
|
177
|
+
-------
|
178
|
+
ValueError
|
179
|
+
If the subsegment type is not supported.
|
180
|
+
"""
|
181
|
+
supported_subsegment_types = ["mean", "max", "std"]
|
182
|
+
if subsegment_type not in supported_subsegment_types:
|
183
|
+
raise ValueError(
|
184
|
+
f"Subsegment type {subsegment_type} is not supported. Supported types are {supported_subsegment_types}"
|
185
|
+
)
|
186
|
+
# get the dimensions of the image
|
187
|
+
dims = img.shape
|
188
|
+
# get the number of frames
|
189
|
+
num_frames = dims[0]
|
190
|
+
# find the number of frames per subsegment
|
191
|
+
frames_per_subsegment = int(num_frames / subsegment_num)
|
192
|
+
hold_img = []
|
193
|
+
for j in np.arange(subsegment_num):
|
194
|
+
if subsegment_type == "mean":
|
195
|
+
hold_img.append(
|
196
|
+
np.mean(
|
197
|
+
img[
|
198
|
+
int(j * frames_per_subsegment) : int(
|
199
|
+
(j + 1) * frames_per_subsegment
|
200
|
+
)
|
201
|
+
],
|
202
|
+
axis=0,
|
203
|
+
)
|
204
|
+
)
|
205
|
+
elif subsegment_type == "max":
|
206
|
+
hold_img.append(
|
207
|
+
np.max(
|
208
|
+
img[
|
209
|
+
int(j * frames_per_subsegment) : int(
|
210
|
+
(j + 1) * frames_per_subsegment
|
211
|
+
)
|
212
|
+
],
|
213
|
+
axis=0,
|
214
|
+
)
|
215
|
+
)
|
216
|
+
elif subsegment_type == "std":
|
217
|
+
hold_img.append(
|
218
|
+
np.std(
|
219
|
+
img[
|
220
|
+
int(j * frames_per_subsegment) : int(
|
221
|
+
(j + 1) * frames_per_subsegment
|
222
|
+
)
|
223
|
+
],
|
224
|
+
axis=0,
|
225
|
+
)
|
226
|
+
)
|
227
|
+
return hold_img
|
228
|
+
|
229
|
+
|
230
|
+
def make_directory_structure(
|
231
|
+
cd: str,
|
232
|
+
img_name: str,
|
233
|
+
img: np.ndarray,
|
234
|
+
subsegment_type: str,
|
235
|
+
subsegment_num: int,
|
236
|
+
**kwargs,
|
237
|
+
) -> list[np.ndarray]:
|
238
|
+
"""
|
239
|
+
Create the directory structure for the simulation, save the image, and perform subsegmentation.
|
240
|
+
|
241
|
+
Parameters:
|
242
|
+
-----------
|
243
|
+
cd : str
|
244
|
+
Directory where the simulation will be saved.
|
245
|
+
img_name : str
|
246
|
+
Name of the image.
|
247
|
+
img : np.ndarray
|
248
|
+
Image to be subsegmented.
|
249
|
+
subsegment_type : str
|
250
|
+
Type of subsegmentation to be performed.
|
251
|
+
subsegment_num : int
|
252
|
+
Number of subsegments to be created.
|
253
|
+
**kwargs : dict
|
254
|
+
Additional keyword arguments, including:
|
255
|
+
- data : dict (optional)
|
256
|
+
Dictionary of data to be saved, keys are "map", "tracks", "points_per_frame".
|
257
|
+
- parameters : dict (optional)
|
258
|
+
Parameters of the simulation to be saved.
|
259
|
+
|
260
|
+
Returns:
|
261
|
+
--------
|
262
|
+
list[np.ndarray]
|
263
|
+
List of subsegmented images.
|
264
|
+
|
265
|
+
Raises:
|
266
|
+
-------
|
267
|
+
None
|
268
|
+
"""
|
269
|
+
# make the directory if it does not exist
|
270
|
+
if not os.path.exists(cd):
|
271
|
+
os.makedirs(cd)
|
272
|
+
# track_pickle
|
273
|
+
track_pickle = os.path.join(cd, "Track_dump.pkl")
|
274
|
+
# params_pickle
|
275
|
+
params_pickle = os.path.join(cd, "params_dump.pkl")
|
276
|
+
# params_json
|
277
|
+
params_json = os.path.join(cd, "params_dump.json")
|
278
|
+
|
279
|
+
# saves the data if it is passed as a keyword argument (map,tracks,points_per_frame)
|
280
|
+
with open(track_pickle, "wb+") as f:
|
281
|
+
pickle.dump(kwargs.get("data", {}), f)
|
282
|
+
# saves the parameters used to generate the simulation
|
283
|
+
with open(params_pickle, "wb+") as f:
|
284
|
+
pickle.dump(kwargs.get("parameters", {}), f)
|
285
|
+
|
286
|
+
# in this directory, dump the parameters into a json file
|
287
|
+
with open(params_json, "w") as f:
|
288
|
+
# dump the parameters into a json file
|
289
|
+
# json.dump(convert_arrays_to_lists(kwargs.get("parameters", {})), f)
|
290
|
+
json.dump({}, f)
|
291
|
+
|
292
|
+
# make a diretory inside cd called Analysis if it does not exist
|
293
|
+
if not os.path.exists(os.path.join(cd, "Analysis")):
|
294
|
+
os.makedirs(os.path.join(cd, "Analysis"))
|
295
|
+
# save the img file with its name in the cd directory
|
296
|
+
save_tiff(img, cd, img_name=img_name)
|
297
|
+
# make a directory inside cd called segmented if it does not exist
|
298
|
+
if not os.path.exists(os.path.join(cd, "segmented")):
|
299
|
+
os.makedirs(os.path.join(cd, "segmented"))
|
300
|
+
# perform subsegmentation on the image
|
301
|
+
hold_img = sub_segment(
|
302
|
+
img, subsegment_num, img_name=img_name, subsegment_type=subsegment_type
|
303
|
+
)
|
304
|
+
# create the names for the subsegmented images
|
305
|
+
hold_name = []
|
306
|
+
for i in np.arange(subsegment_num):
|
307
|
+
hold_name.append(
|
308
|
+
os.path.join(cd, "segmented", str(int(i) + 1) + "_" + img_name + ".tif")
|
309
|
+
)
|
310
|
+
# save the subsegmented images
|
311
|
+
for i in np.arange(subsegment_num):
|
312
|
+
img = Image.fromarray(hold_img[i])
|
313
|
+
img.save(hold_name[i])
|
314
|
+
return hold_img
|
315
|
+
|
316
|
+
|
317
|
+
@cache
|
318
|
+
def ms_to_seconds(time: int | float) -> float:
|
319
|
+
return time * 1e-3
|
@@ -0,0 +1,173 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: AMS_BP
|
3
|
+
Version: 0.0.2
|
4
|
+
Summary: Advanced Microscopy Simulations developed for the Weber Lab by Baljyot Singh Parmar
|
5
|
+
Project-URL: Documentation, https://joemans3.github.io/AMS_BP/
|
6
|
+
Project-URL: Source code, https://github.com/joemans3/AMS_BP
|
7
|
+
Author-email: Baljyot Singh Parmar <baljyotparmar@hotmail.com>
|
8
|
+
Maintainer-email: Baljyot Singh Parmar <baljyotparmar@hotmail.com>
|
9
|
+
License-File: LICENSE
|
10
|
+
Keywords: SMS
|
11
|
+
Requires-Python: >=3.10
|
12
|
+
Requires-Dist: jsonschema>=4.23.0
|
13
|
+
Requires-Dist: matplotlib>=3.6.0
|
14
|
+
Requires-Dist: numpy>=1.21.2
|
15
|
+
Requires-Dist: pydantic>=2.9.2
|
16
|
+
Requires-Dist: scikit-image>=0.18.3
|
17
|
+
Requires-Dist: scipy>=1.7.1
|
18
|
+
Requires-Dist: tomli>=2.0.2
|
19
|
+
Requires-Dist: typer>=0.12.5
|
20
|
+
Description-Content-Type: text/markdown
|
21
|
+
|
22
|
+
# AMS-BP
|
23
|
+
<p>
|
24
|
+
<img src="./docs/assets/icons/drawing.svg" alt="AMS-BP Logo" width="500" height="200">
|
25
|
+
</p>
|
26
|
+
## Advanced Fluorescence Microscopy Simulation Tool
|
27
|
+
|
28
|
+
AMS-BP is a powerful simulation tool for advanced fluorescence microscopy experiments. This guide covers both command-line usage and library integration.
|
29
|
+
|
30
|
+
> **_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.
|
31
|
+
|
32
|
+
## Table of Contents
|
33
|
+
- [Installation](#installation)
|
34
|
+
- [Command Line Interface](#command-line-interface)
|
35
|
+
- [Configuration File](#configuration-file)
|
36
|
+
- [Running Experiments](#running-experiments)
|
37
|
+
- [Advanced Usage](#advanced-usage)
|
38
|
+
|
39
|
+
## Installation
|
40
|
+
|
41
|
+
|
42
|
+
### ***Installing the CLI tool using UV***
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
1. [Install UV](https://docs.astral.sh/uv/getting-started/installation/).
|
48
|
+
2. Run the command:
|
49
|
+
```bash
|
50
|
+
uv tool install AMS_BP
|
51
|
+
```
|
52
|
+
3. You will have access to two CLI commands (using the uv interface):
|
53
|
+
- `run_AMS_BP runsim` : This is the main entry point for the simulation. (see `run_AMS_BP runsim --help` for more details)
|
54
|
+
- `run_AMS_BP config` : This is a helper tool to generate a template config file for the simulation. (see `run_AMS_BP config --help` for more details)
|
55
|
+
- Note: using `run_AMS_BP --help` will show you all the available commands.
|
56
|
+
4. You can now use these tools (they are isolated in their own env created by uv, which is cool).
|
57
|
+
|
58
|
+
### ***PyPi***
|
59
|
+
|
60
|
+
1. Run:
|
61
|
+
```bash
|
62
|
+
pip install AMS_BP
|
63
|
+
```
|
64
|
+
|
65
|
+
## Command Line Interface
|
66
|
+
|
67
|
+
AMS-BP provides a command-line interface with two main commands:
|
68
|
+
|
69
|
+
```bash
|
70
|
+
# Generate a default configuration file
|
71
|
+
run_AMS_BP config [OPTIONS]
|
72
|
+
|
73
|
+
# Run a simulation using a configuration file
|
74
|
+
run_AMS_BP runsim CONFIG_FILE
|
75
|
+
```
|
76
|
+
|
77
|
+
### Config Command Options
|
78
|
+
|
79
|
+
- `-o, --output_path PATH`: Specify the output directory for the configuration file
|
80
|
+
- `-r, --recursive_o`: Create output directory if it doesn't exist
|
81
|
+
|
82
|
+
## Configuration File
|
83
|
+
|
84
|
+
The configuration file (sim_config.toml) is divided into several key sections:
|
85
|
+
|
86
|
+
#### For a detailed description of the configuration file, refer to the [Configuration File Reference](https://joemans3.github.io/AMS_BP/API_Documentation/sim_config/).
|
87
|
+
### Basic Units
|
88
|
+
```toml
|
89
|
+
version = "0.1"
|
90
|
+
length_unit = "um" # micrometers
|
91
|
+
time_unit = "ms" # milliseconds
|
92
|
+
diffusion_unit = "um^2/s" # diffusion coefficient units
|
93
|
+
```
|
94
|
+
|
95
|
+
### Key Configuration Sections
|
96
|
+
|
97
|
+
1. **Cell Parameters**
|
98
|
+
- Define cell space dimensions
|
99
|
+
- Set cell axial radius
|
100
|
+
|
101
|
+
2. **Molecule Parameters**
|
102
|
+
- Number of molecules per type
|
103
|
+
- Tracking types (constant/fbm)
|
104
|
+
- Diffusion coefficients
|
105
|
+
- State transition probabilities
|
106
|
+
|
107
|
+
3. **Global Parameters**
|
108
|
+
- Sample plane dimensions
|
109
|
+
- Cycle count -> Exposure time + Interval time
|
110
|
+
- Exposure and interval times
|
111
|
+
|
112
|
+
4. **Fluorophore Configuration**
|
113
|
+
- Any number of fluorophores
|
114
|
+
- Any number of States per fluorophore
|
115
|
+
- Fluorophore StateType: (bright, dark, bleached) -> All States must be one of these.
|
116
|
+
- Transition parameters
|
117
|
+
- Spectral properties
|
118
|
+
|
119
|
+
5. **Optical Configuration**
|
120
|
+
- PSF parameters
|
121
|
+
- Laser settings
|
122
|
+
- Channel configuration
|
123
|
+
- Camera settings
|
124
|
+
|
125
|
+
## Running Experiments
|
126
|
+
|
127
|
+
AMS-BP supports two types of experiments:
|
128
|
+
|
129
|
+
### 1. Time Series
|
130
|
+
```toml
|
131
|
+
[experiment]
|
132
|
+
experiment_type = "time-series"
|
133
|
+
z_position = 0.0
|
134
|
+
laser_names_active = ["red", "blue"]
|
135
|
+
laser_powers_active = [0.5, 0.05]
|
136
|
+
laser_positions_active = [[5, 5, 0], [5, 5, 0]]
|
137
|
+
```
|
138
|
+
|
139
|
+
### 2. Z-Stack
|
140
|
+
```toml
|
141
|
+
[experiment]
|
142
|
+
experiment_type = "z-stack"
|
143
|
+
z_position = [-0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5]
|
144
|
+
laser_names_active = ["red", "blue"]
|
145
|
+
laser_powers_active = [0.5, 0.05]
|
146
|
+
laser_positions_active = [[5, 5, 0], [5, 5, 0]]
|
147
|
+
```
|
148
|
+
|
149
|
+
## Advanced Usage
|
150
|
+
|
151
|
+
### Using AMS-BP as a Library
|
152
|
+
|
153
|
+
For programmatic control, you can import and use AMS-BP as a Python library:
|
154
|
+
|
155
|
+
```python
|
156
|
+
from AMS_BP.configio.convertconfig import ConfigLoader
|
157
|
+
|
158
|
+
# Configuration loader intialization
|
159
|
+
config_loader = ConfigLoader(config_path="path/to/config.toml")
|
160
|
+
|
161
|
+
# Setup microscope
|
162
|
+
setup_config = config_loader.setup_microscope()
|
163
|
+
microscope = setup_config["microscope"]
|
164
|
+
config_exp = setup_config["experiment_config"]
|
165
|
+
function_exp = setup_config["experiment_func"]
|
166
|
+
|
167
|
+
# Run simulation
|
168
|
+
frames, metadata = function_exp(microscope=microscope, config=config_exp)
|
169
|
+
|
170
|
+
# Save results
|
171
|
+
from AMS_BP.configio.saving import save_config_frames
|
172
|
+
save_config_frames(metadata, frames, setup_config["base_config"].OutputParameters)
|
173
|
+
```
|
@@ -0,0 +1,55 @@
|
|
1
|
+
AMS_BP/__init__.py,sha256=Uf1hFjP3Vh5NQoJm1cL3TnbYf94ZH26bCPr6jYrrSrc,326
|
2
|
+
AMS_BP/run_cell_simulation.py,sha256=fPU1Tuu7hBupGtMk07j2t8QYo_TjFLMJRU9fwmAgU9c,7502
|
3
|
+
AMS_BP/sim_config.toml,sha256=FD-OcSDAgRuNIalFe0pC8sbsaSwM-9DV2DNswds2q54,11976
|
4
|
+
AMS_BP/sim_microscopy.py,sha256=7JQ6NQlgNZCvFE-FC1f9Ehh6DoJgn7bLzeqS_Mamq9Y,18619
|
5
|
+
AMS_BP/cells/__init__.py,sha256=yWFScBC1uOGDkeC8i1m1ZBtIREcyt4JHxYa72LxbBZU,177
|
6
|
+
AMS_BP/cells/base_cell.py,sha256=FIPB9J8F40tb53vv7C6qG-SaAFLOI8-MGIk1mmZ-gnI,1503
|
7
|
+
AMS_BP/cells/rectangular_cell.py,sha256=5yGxvTXYvgldLXyWXpE_SD9Zx2NLerC-I2j02reHsJ0,2515
|
8
|
+
AMS_BP/cells/rod_cell.py,sha256=jQ1kLEk74Pv2rcXPRJ6-QJJhux-mYiDSytzqlxCNWfA,3181
|
9
|
+
AMS_BP/cells/spherical_cell.py,sha256=n3ou3tW0nCxXIwv6uLkVKHkYCfgoNn8VI6CVTLBIll0,2140
|
10
|
+
AMS_BP/configio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
+
AMS_BP/configio/configmodels.py,sha256=Isc6THk3RAIVdjEUBW4c_OD0I122dYufgEvAcGJQ5uo,3046
|
12
|
+
AMS_BP/configio/convertconfig.py,sha256=lS7FTDheESdbpaZ0K1LcE8rkdJOKLjzIvcmWpjeebSs,34654
|
13
|
+
AMS_BP/configio/experiments.py,sha256=HdfaSi0gPPJ_wLF87XcW5ICja19Uezx7-ygFEwNzi30,3995
|
14
|
+
AMS_BP/configio/saving.py,sha256=596QgAadV32rzsN4B2FngGFcBWCzCDnLFN-qtQsv3bM,857
|
15
|
+
AMS_BP/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
+
AMS_BP/metadata/metadata.py,sha256=_FwbSRsUhGwigY6YYffMgEx5hlXTT_vu-9AldMFPa6w,2923
|
17
|
+
AMS_BP/motion/__init__.py,sha256=cy3W-wCRjjlN1DrTqYc-JltYwcE8SZCXMVPJ2o6q_BQ,178
|
18
|
+
AMS_BP/motion/condensate_movement.py,sha256=cGLHIOL7VUJ7U-JrJXetcnUF2v9SepIBznoqu6AQPxU,13252
|
19
|
+
AMS_BP/motion/track_gen.py,sha256=Z3QJLVMP1gX4SlgOXFxBg8sJhBG0Xq25ixnBoEHEAZI,19462
|
20
|
+
AMS_BP/motion/movement/__init__.py,sha256=PqovpG4dAuFFIP9M2_kt-6egQJX3P5ig4MMWVzNaswg,278
|
21
|
+
AMS_BP/motion/movement/boundary_conditions.py,sha256=jpfK3AEUY8btrTsu19bpUfx-jri7_HfyxqMFjMoxAVM,2200
|
22
|
+
AMS_BP/motion/movement/fbm_BP.py,sha256=dH-JZiAInnIaZXH1wAAo8dOIX9zafclqnZ4dOhKtnO0,9327
|
23
|
+
AMS_BP/optics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
+
AMS_BP/optics/camera/__init__.py,sha256=eCoDUFHcoCWgbgYdLn8EH7AULM53A3XWTXNZnV8QxeY,182
|
25
|
+
AMS_BP/optics/camera/detectors.py,sha256=UJqi7owESw9nkFiQhoAe7Q1LIi_fYCzuvZLgtM3yAPk,10348
|
26
|
+
AMS_BP/optics/camera/quantum_eff.py,sha256=ZCvJ8dJESOUbjwblsJIBcCg_b-_DNdhDlkzd7HeGMDg,2378
|
27
|
+
AMS_BP/optics/filters/__init__.py,sha256=oYPk2_wuL4KrwbaZy3gktvO5biQUfdQLUColWhkU1lw,337
|
28
|
+
AMS_BP/optics/filters/filters.py,sha256=-iw7eqmDO77SEqlFTv5jJNVwpA8y93TLsjy5hhsAfiI,6406
|
29
|
+
AMS_BP/optics/filters/channels/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
|
+
AMS_BP/optics/filters/channels/channelschema.py,sha256=SConyA5yVdfnI_8sgcxVC8SV7S8tGUJYPPC6jn7lglU,906
|
31
|
+
AMS_BP/optics/lasers/__init__.py,sha256=T7dHohhyLf_pBw4TidarYHWmiwxVXGE71-Bf1aeBbuc,564
|
32
|
+
AMS_BP/optics/lasers/laser_profiles.py,sha256=J9czY646XcW8GzXx9Eb16mG7tQdWw4oVYveOrihZCeY,22745
|
33
|
+
AMS_BP/optics/psf/__init__.py,sha256=ezrKPgpTeR4gTHOvF0mhF6u2zMMTd8Bgp8PGeOf11fA,121
|
34
|
+
AMS_BP/optics/psf/psf_engine.py,sha256=ejmTwAKtEpXvKeMuUFcuz6HjJbEjQa_NvkE6a3hkVzk,6769
|
35
|
+
AMS_BP/photophysics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
|
+
AMS_BP/photophysics/photon_physics.py,sha256=QRG_QIZ4csJ3g5qGP9Wtk7kzqm8_MUbVHfFef6cMtHQ,6671
|
37
|
+
AMS_BP/photophysics/state_kinetics.py,sha256=0cc7Vc4LtAbEdGDeg22IJmRGLsONOty4c32hXHO-TSU,5281
|
38
|
+
AMS_BP/probabilityfuncs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
|
+
AMS_BP/probabilityfuncs/markov_chain.py,sha256=LV6KGr8Lv4NIvBPJqsR0CEynssa_mPH30qLaK85GObA,4339
|
40
|
+
AMS_BP/probabilityfuncs/probability_functions.py,sha256=j_rIxrupGBf_FKkQBh1TvEa34A44jAasaZQRg2u3FuY,11793
|
41
|
+
AMS_BP/sample/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
|
+
AMS_BP/sample/sim_sampleplane.py,sha256=A1BnGaFDnJ0VYaXUmpr0bLdZ01UzfZrATBTubGt3gjo,11525
|
43
|
+
AMS_BP/sample/flurophores/__init__.py,sha256=arLVUx1-yh5T41fH9Mr6RNY8Ao3ZioFQUtsfEZlzQkU,250
|
44
|
+
AMS_BP/sample/flurophores/flurophore_schema.py,sha256=j8jnr4w4ltuhXUkjd74IoyyuotyH52mn8FWkgahX5Vw,10886
|
45
|
+
AMS_BP/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
46
|
+
AMS_BP/utils/constants.py,sha256=-r3cnEiuxb-XzRgGhpOuJshYYhKnDu_hv0YSffkxAfc,273
|
47
|
+
AMS_BP/utils/decorators.py,sha256=4qFdvzPJne0dhkhD1znPxRln1Rfr5NX8rdcCDcbATRU,6224
|
48
|
+
AMS_BP/utils/errors.py,sha256=7BOd-L4_YeKmWn3Q4EOdTnNF3Bj_exDa3eg5X0yCZrc,759
|
49
|
+
AMS_BP/utils/maskMaker.py,sha256=2ca3n2nc8rFtUh1LurKXOJJsUmhrOpWbRnVX7fjRVvs,335
|
50
|
+
AMS_BP/utils/util_functions.py,sha256=jI6WBh09_khdABnEoVK7SK1WRvCLHuw40f5ALyflzlc,9478
|
51
|
+
ams_bp-0.0.2.dist-info/METADATA,sha256=3W89MwItnt2sZhSvLQpGF0u2Cr1aX_DzcM80V1RlNWM,5314
|
52
|
+
ams_bp-0.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
53
|
+
ams_bp-0.0.2.dist-info/entry_points.txt,sha256=MFUK9bZWW61djfsavqopMqiVPVn4lJtt6v8qzyEFyNM,76
|
54
|
+
ams_bp-0.0.2.dist-info/licenses/LICENSE,sha256=k_-JV1DQKvO0FR8WjvOisqdTl0kp6VJ7RFM3YZhao0c,1071
|
55
|
+
ams_bp-0.0.2.dist-info/RECORD,,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Baljyot Parmar
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|