spvctrl.scripts.test_data.make_adc_dataset#

make_adc_dataset(spv_A0_V: float = 0.15, spv_tau_s: float = 0.001, spv_offset_V: float = 0.005, diode_A0_V: float = 0.35, diode_tau_s: float = 1e-06, diode_offset_V: float = 0.007, n_pulses: int = 5, amplitude_step_V: float = 0.005, n_samples: int = 32768, n_pre_trigger: int = 1024, sample_rate_Hz: float = 65536.0) → dict[source]#

Generate a synthetic ADC pulse dataset, like an oscilloscope measurement would return it.

Each pulse is a pure exponential decay A*exp(-t/tau) + C per channel: the SPV channel with A0 = spv_A0_V, tau = spv_tau_s and C = spv_offset_V, the diode channel with the corresponding diode parameters. The amplitude A is increased by amplitude_step_V for every pulse. The record of each pulse holds n_pre_trigger pre-trigger samples followed by n_samples post-trigger samples, where the pre-trigger is filled with the tail of the pulse’s own decay (i.e. the last n_pre_trigger samples of the post-trigger window, wrapped around to the front; for tau much smaller than the record this is the constant offset C).

The voltages are quantized to int16 ADC counts with the +-1 V input range mapped to the full int16 scale (gain 1/32768 V/count, offset 0 V) for both channels.

Parameters:
  • spv_A0_V – SPV amplitude A of the first pulse in V.

  • spv_tau_s – SPV decay time constant in s.

  • spv_offset_V – SPV offset C in V.

  • diode_A0_V – Diode amplitude A of the first pulse in V.

  • diode_tau_s – Diode decay time constant in s.

  • diode_offset_V – Diode offset C in V.

  • n_pulses – Number of pulses to generate.

  • amplitude_step_V – Amplitude increase per pulse in V.

  • n_samples – Number of post-trigger samples per pulse.

  • n_pre_trigger – Number of pre-trigger samples per pulse.

  • sample_rate_Hz – Sampling rate in Hz.

Returns:

Dict with the keys U_spv_raw/U_diode_raw (int16 arrays of shape (n_pulses, n_samples + n_pre_trigger)), sample_rate_Hz, n_pre_trigger, n_pulses, conversion_spv/conversion_diode ((gain_V_per_count, offset_V) tuples) and t_s (the time axis of a single record in s).