hera_sim.sigchain.vary_gains_in_time

hera_sim.sigchain.vary_gains_in_time(gains, times, freqs=None, delays=None, parameter='amp', variation_ref_time=None, variation_timescale=None, variation_amp=0.05, variation_mode='linear', rng=None)[source]

Vary gain amplitudes, phases, or delays in time.

Notes

If the gains initially have the form

\[g(\nu) = g_0(\nu)\exp(i 2\pi\nu\tau + i\phi)\]

then the output gains have the form

\[g(\nu,t) = g_0(\nu,t)\exp \bigl( i2\pi\nu\tau(t) + i\phi(t)\bigr).\]
Parameters:
  • gains (dict) – Dictionary mapping antenna numbers to gain spectra/waterfalls.

  • times (array-like of float) – Times at which to simulate time variation. Should be the same length as the data to which the gains will be applied. Should also be in the same units as variation_ref_time and variation_timescale.

  • freqs (array-like of float, optional) – Frequencies at which the gains are evaluated, in GHz. Only needs to be specified for adding time variation to the delays.

  • delays (dict, optional) – Dictionary mapping antenna numbers to gain delays, in ns.

  • parameter (str, optional) – Which gain parameter to vary; must be one of (“amp”, “phs”, “dly”).

  • variation_ref_time (float or array-like of float, optional) – Reference time(s) used for generating time variation. For linear and sinusoidal variation, this is the time where the gains are equal to their original, time-independent values. Should be in the same units as the times array. Default is to use the center of the times provided.

  • variation_timescale (float or array-like of float, optional) – Timescale(s) for one cycle of the variation(s), in the same units as the provided times. Default is to use the duration of the entire times array.

  • variation_amp (float or array-like of float, optional) – Amplitude(s) of the variation(s) introduced. This is not the peak-to-peak amplitude! This also does not have exactly the same interpretation for each type of variation mode. For amplitude and delay variation, this represents the amplitude of modulations–so it can be interpreted as a fractional variation. For phase variation, this represents an absolute, time-dependent phase offset to introduce to the gains; however, it is still not a peak-to-peak amplitude.

  • variation_mode (str or array-like of str, optional) – Which type(s) of variation to simulate. Supported modes are “linear”, “sinusoidal”, and “noiselike”. Default is “linear”. Note that the “linear” mode produces a triangle wave variation with period twice the corresponding timescale; this ensures that the gains vary linearly over the entire set of provided times if the default variation timescale is used.

  • rng (np.random.Generator, optional) – Random number generator.

Returns:

time_varied_gains (dict) – Dictionary mapping antenna numbers to gain waterfalls.