cait.simulate

cait.simulate.generate_ps_par(h)[source]

Simulate PS parameters modelled after the TUM40 phonon detector.

Parameters

h (1D array) – Array of pulse heights.

Returns

(t0, An, At, tau_n, tau_in, tau_t)

Return type

list of 6 1D arrays

cait.simulate.simulate_baselines(path_h5, size, rms_thresholds, lamb=0.01, kde=True, sim_poly=True, verb=False)[source]

Creates fake baselines with given nps and drift structure.

Parameters
  • path_h5 (string) – Path to the file from which nps and bl drifts come.

  • size (int) – Nmbr of baselines to simulate.

  • rms_thresholds (list of two ints) – Threshold for the bl rms fit error above which they get not included in the nps and drifts.

  • lamb (float) – Parameter for the noise simulation method.

  • kde (bool) – If True we sample the coefficients of the bl fit with a kernel density estimation.

  • sim_poly (pool) – If True we simulate the polynomials for the baselines.

  • verb (bool) – If true feedback about progress in code.

Returns

(ch_nmbr, size bl, rec_len) of the simulated baselines, (ch_nmbr, size bl, rec_len) of the simulated polynomials.

Type

tuple (3D array, 3D array)

cait.simulate.simulate_events(path_h5, type, name_appendix, size, record_length, nmbr_channels, ph_intervals=[(0, 1), (0, 1)], discrete_ph=None, exceptional_sev_naming=None, channels_exceptional_sev=[0], t0_interval=(- 20, 20), fake_noise=True, use_bl_from_idx=0, take_idx=None, rms_thresholds=[1, 1], lamb=0.01, sample_length=0.04, saturation=False, reuse_bl=False, ps_dev=False)[source]

Simulates pulses on a noise baseline.

Options are to take measured noise baselines or fake bl, sev of events or testpulses, pulse heights, onset intervals.

Parameters
  • path_h5 (string) – Path of the dataset on which the sim is based on.

  • type (string) – Either events, testpulses or noise - what type of event is simulated; if testpulses the other channels than the first will beignored for the PHs.

  • size (integer > 0) – Size of the simulated dataset, if fake_noise is False it must be smaller than the number of noise baselines in the hdf5 file.

  • record_length (integer) – Length of the record window in the hdf5 datset.

  • nmbr_channels (integer) – The number of channels in the hdf5 dataset.

  • ph_intervals (list of c intervals) – Intervals for the simulated pulse heights, with c the nmbr_channels; the heights are samples uniformly from these intervals.

  • discrete_ph (list of intervals) – c Lists of values for the pulse heights for the c channels or None for ph intervals; the heights are sampled uniformly for the list.

  • exceptional_sev_naming (string) – If set, this is full group name in the HDF5 set for the sev used for the simulation of events - by setting this, e.g. carrier events can be simulated.

  • channel_exceptional_sev (list of ints) – The channels for that the exceptional sev is used, e.g. if only for phonon channel, choose [0], if for botch phonon and light, choose [0,1].

  • t0_interval (tuple) – Interval (l,u) with l lower bound for onset and u upper bound. The onsets are sampled uniformly from the interval. In ms.

  • fake_noise (bool) – If true use simulated noise baselines, otherwise measured ones.

  • use_bl_from_idx (int) – The start index of the baselines that are used.

  • take_idx (list) – The event indices which we want to use for the simulation.

  • rms_threshold (float) – Above which value noise baselines are excluded for the distribution of polynomial coefficients; also, a cut value for the baselines if not the fake ones but the ones from the h5 set are taken.

  • lamb (float) – The parameter for the bl simulation method.

  • sample_length (float) – The length in ms of one sample from an event.

  • saturation (bool) – If True the logistic curve is applied to the pulses.

  • reuse_bl (bool) – If True the same baselines are used multiple times to have enough of them (use this with care to not have identical copies of events).

  • ps_dev (bool) – If True the pulse shape parameters are modelled with deviations.

Returns

The simulated events, the true pulse heights, the onsets of the events.

Return type

(3D array of size (nmbr channels, size, record_length), the simulated events, 2D array of size (nmbr channels, size), the true pulse heights, 1D array (size), the onsets of the events)