MCFlowMace / CRESana

Analytic CRES signal modeling
2 stars 1 forks source link

Inconsistent use of sampling rate, n samples, t_max #3

Closed renereimann closed 11 months ago

renereimann commented 1 year ago

While Simulation() takes sr as parameter, AnalyticSimulation() takes n_samples and t_max as parameters. Sampling rate, n_sample and t_max are not independent but given by n_sample = sampling rate t_max. Inconsistent use of them leads to random issues in the simulation. In AnalyticSimulation() the sampling rate is calculated based on n_samples and t_max. If the user does not pay attention to relating the three quantities together the output may be random, e.g. if n_sample > srt_max the array contains the singal of length sr*t_max followed by zeros or random things.

If Simulation and AnalyticSimulation takes the same set of parameters the confusion may be reduced. If the consistency is checked explicitly the consistent use is enforced and the user can not produce random things.

MCFlowMace commented 11 months ago

Think issue is addressed if users stick to the CRESanaModel class. AnalyticSimulation does not take sampling rate as parameter by design because the trajectory needs to be oversampled compared to the sampling of the antenna and thus the Electron simulation sampling rate should be different.