gondola.algo#

Dedicated module for variaous algorithms

Functions

fit_sine_simple(xs, ys)

Simple, analystyc line fit to fit a a sine function (e.g. as to TOF ch 9 sine wave data).

get_max_value_idx(value, start_idx, n_idx)

Return the index of the maximum value in an array of floats.

interpolate_time(voltages, nanoseconds, ...)

Linear interpolation of the time within a single bin of a TOF waveform

gondola.algo.get_max_value_idx(value, start_idx, n_idx)#

Return the index of the maximum value in an array of floats. This works also for numbers which don't implement Ord, only PartialOrd is required.

# Arguments:
  • start_idx : start the search within the input array-like at this index

  • n_idx : restrict the search to the last index of start_idx + n_idx

gondola.algo.interpolate_time(voltages, nanoseconds, threshold, idx, size)#

Linear interpolation of the time within a single bin of a TOF waveform

# Arguments:
  • voltages : Waveform in mV

  • nanoseconds : Calibrated time for the waveform bins in ns

  • thresholdThreshold in mV which is supposed to be crossed

    within the bin

  • idxTogether with size define a range for the search for

    the bin which should have the implementation applied to [voltages[idx], voltages[idx + size]]

  • sizeTogether with idx define a range for the search for

    the bin which should have the implementation applied to [voltages[idx], voltages[idx + size]]

gondola.algo.fit_sine_simple(xs, ys)#

Simple, analystyc line fit to fit a a sine function (e.g. as to TOF ch 9 sine wave data)

# Arguments:
  • volts : y-values

  • times : x-values

# Returns:

tuple : ( amplitude, frequency, phase)