Coverage for src/driada/experiment/synthetic/utils.py: 57.14%
7 statements
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-25 15:40 +0300
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-25 15:40 +0300
1"""
2Utility functions for synthetic data generation.
3"""
5def get_effective_decay_time(decay_time, duration, verbose=True):
6 """
7 Calculate effective decay time for experiments to ensure valid shuffle positions.
9 For short duration experiments, the decay time is reduced to prevent
10 the shuffle mask from excluding all timepoints.
12 Parameters
13 ----------
14 decay_time : float
15 Original calcium decay time in seconds.
16 duration : float
17 Experiment duration in seconds.
18 verbose : bool
19 Whether to print adjustment messages.
21 Returns
22 -------
23 float
24 Effective decay time to use.
25 """
26 # For short durations, use smaller decay_time to reduce shuffle exclusion
27 if duration <= 30: # 30 seconds or less
28 effective_decay_time = min(decay_time, 0.5) # Max 0.5s for short tests
29 if verbose and effective_decay_time < decay_time:
30 print(f' Using reduced decay time {effective_decay_time}s for short duration experiment')
31 else:
32 effective_decay_time = decay_time
34 return effective_decay_time