rizer.electrical_model.components.generator#

Classes#

BaseGenerator

An ideal voltage waveform generator.

TrapezoidalGenerator

Trapezoidal generator.

GaussianGenerator

Gaussian generator.

ConstantGenerator

Constant generator.

RepetitivePulseGenerator

A pulse train: one single-pulse waveform repeated at a fixed PRF.

FromMeasurementGenerator

Generator voltage from an experimentally-measured trace.

Functions#

get_generator_from_input(→ BaseGenerator)

Get a generator object from the input dictionary.

Module Contents#

class rizer.electrical_model.components.generator.BaseGenerator#

Bases: abc.ABC

An ideal voltage waveform generator.

Carries no source impedance of its own – see ResistiveSourceCircuit for a generator paired with a source resistance \(R_g\).

abstractmethod generator_voltage(t: float) → float#

Voltage of the generator.

The generator voltage can depend on the time. This function should be implemented in the derived class.

Parameters:

t (float) – Time in seconds.

Returns:

Generator voltage in Volts.

Return type:

float

class rizer.electrical_model.components.generator.TrapezoidalGenerator(U_off: float = 0.0, U_on: float = 10000.0, t_rise: float = 3e-09, t_on: float = 1e-08, t_fall: float = 3e-09)#

Bases: BaseGenerator

Trapezoidal generator.

The generator voltage is a trapezoidal pulse.

Parameters:
  • U_off (float, optional) – Voltage when the pulser is turned off, by default 0.0 V.

  • U_on (float, optional) – Voltage when the pulser is turned on, by default 5e3 V.

  • t_rise (float, optional) – Time to go from U_off to U_on, by default 3e-9 s.

  • t_on (float, optional) – Time to stay at U_on, by default 10e-9 s.

  • t_fall (float, optional) – Time to go from U_on to U_off, by default 3e-9 s.

generator_voltage(t: float) → float#

Trapezoidal voltage pulse.

First, the voltage is at U_off. Then, it rises to U_on in t_rise seconds. Next, it stays at U_on for t_on second. Finally, it falls to U_off in t_fall seconds.

Parameters:

t (float) – Time in seconds.

Returns:

Generator voltage in Volts.

Return type:

float

pulse_end_time() → float#

Time at which the pulse is back at U_off [s].

class rizer.electrical_model.components.generator.GaussianGenerator(height: float, mean: float, FWHM: float)#

Bases: BaseGenerator

Gaussian generator.

The generator voltage is a Gaussian pulse.

Parameters:
  • height (float) – Height of the Gaussian pulse [V].

  • mean (float) – Mean (center) of the Gaussian pulse [s].

  • FWHM (float) – Full width at half maximum of the Gaussian pulse [s].

generator_voltage(t: float) → float#

Return the generator voltage as a Gaussian pulse.

Parameters:

t (float) – Time in seconds.

Returns:

Generator voltage in Volts.

Return type:

float

static gaussian(t: float, height: float, mean: float, FWHM: float) → float#

Return a Gaussian pulse.

Parameters:
  • t (float) – Time in seconds.

  • height (float) – Height of the Gaussian pulse [V].

  • mean (float) – Mean of the Gaussian pulse [s].

  • FWHM (float) – Full width at half maximum of the Gaussian pulse [s].

Returns:

Value of the Gaussian pulse at time t [V].

Return type:

float

class rizer.electrical_model.components.generator.ConstantGenerator(U_g: float)#

Bases: BaseGenerator

Constant generator.

Parameters:

U_g (float) – Voltage of the generator [V].

U_g#
generator_voltage(t: float) → float#

Return the generator voltage.

Parameters:

t (float) – Time in seconds.

Returns:

Generator voltage in Volts.

Return type:

float

class rizer.electrical_model.components.generator.RepetitivePulseGenerator(pulse: BaseGenerator, pulse_repetition_frequency: float, nb_pulses: int)#

Bases: BaseGenerator

A pulse train: one single-pulse waveform repeated at a fixed PRF.

The waveform of pulse \(k\) is the single-pulse waveform shifted by \(k / f_{PRF}\):

\[U(t) = U_{pulse}\left(t - \frac{k}{f_{PRF}}\right), \qquad k = \min\left(\lfloor t\, f_{PRF} \rfloor, N - 1\right)\]

so the train is off after the last of its \(N\) pulses.

Parameters:
  • pulse (BaseGenerator) – The single-pulse waveform, fired at t = 0.

  • pulse_repetition_frequency (float) – PRF [Hz]. Its inverse is the pulse period, which must be longer than the pulse itself (checked when the pulse exposes pulse_end_time).

  • nb_pulses (int) – Number of pulses in the train.

Examples

>>> pulse = TrapezoidalGenerator(U_on=1.0e3, t_rise=1e-9, t_on=2e-9, t_fall=1e-9)
>>> train = RepetitivePulseGenerator(pulse, 1e8, nb_pulses=2)  # 10 ns period
>>> train.generator_voltage(2e-9)  # plateau of the first pulse
1000.0
>>> train.generator_voltage(12e-9)  # plateau of the second pulse
1000.0
>>> train.generator_voltage(22e-9)  # the train is over
0.0
pulse#
pulse_repetition_frequency#
nb_pulses#
pulse_period#
generator_voltage(t: float) → float#

Voltage [V] of the pulse currently in flight, 0 between pulses.

pulse_end_time() → float#

End of the first pulse [s] (later ones are found by sampling).

class rizer.electrical_model.components.generator.FromMeasurementGenerator(times: numpy.ndarray, voltages: numpy.ndarray)#

Bases: BaseGenerator

Generator voltage from an experimentally-measured trace.

Plays the role of generator_voltage(t) exactly like any other BaseGenerator – pair with a ResistiveSourceCircuit’s own R_g (chosen independently). There is no single correct convention for what a measured trace represents – a true open-circuit EMF, a terminal voltage, a mid-cable probe reading that already reflects some attenuation – picking R_g consistent with where the measurement was actually taken is the caller’s responsibility.

Parameters:
  • times (numpy.ndarray) – Strictly increasing sample times [s], starting at t=0.

  • voltages (numpy.ndarray) – Measured voltage at each time in times [V].

times#
voltages#
generator_voltage(t: float) → float#

Measured voltage at t; 0.0 outside the measured time range.

rizer.electrical_model.components.generator.get_generator_from_input(generator_input: dict[str, Any]) → BaseGenerator#

Get a generator object from the input dictionary.

Parameters:

generator_input (dict of str and str or float) –

A dictionary containing the parameters of the generator. Expected keys are:

  • ”type”: Type of the generator. Supported types are “from_measurement”, “gaussian”, “trapezoidal”, “constant”, “repetitive”.

  • For “gaussian” type:
    • ”height”: Height of the Gaussian pulse in Volts.

    • ”mean”: Mean of the Gaussian pulse in seconds.

    • ”FWHM”: Full width at half maximum of the Gaussian pulse in seconds.

  • For “constant” type:
    • ”U_g”: Voltage of the generator in Volts.

  • For “trapezoidal” type:
    • ”U_off”: Voltage level when the generator is off, in Volts.

    • ”U_on”: Voltage level when the generator is on, in Volts.

    • ”t_rise”: Rise time of the trapezoidal pulse in seconds.

    • ”t_on”: Duration for which the generator is on (at U_on) in seconds.

    • ”t_fall”: Fall time of the trapezoidal pulse in seconds.

  • For “repetitive” type (a train of identical pulses):
    • ”pulse_repetition_frequency”: PRF of the train in Hz.

    • ”nb_pulses”: Number of pulses in the train.

    • ”pulse”: Nested generator input describing one pulse.

  • For “from_measurement” type (an experimentally-measured trace):
    • ”path”: Path to an experiment .npz, relative to data/experiments/.

    • ”t_start”, “t_end”: Optional window bounds [s] in the file’s own time axis; see load_experiment_trace_window().

Returns:

An instance of the generator class corresponding to the specified type, initialized with the parameters from the input dictionary.

Return type:

BaseGenerator

Raises:

ValueError – If the generator type is unknown or if required parameters are missing for the specified type.