mocktracegenerator

mocktracegenerator.mocktracegenerator

Module Description

The mocktracegenerator module provides functionalities for generating mock voltage time traces. It includes a class Mock_trace_generator that allows users to generate mock voltage traces based on voltage-to-density conversion values as a function of sidereal time and frequency.

The module uses interpolation functions for the hardware response and impedance, along with additional noise, to create realistic mock time traces. It also supports adding non-background interference (NBI) to the traces and temperature-varying additional noise.

Users can specify various parameters, such as the size of the time trace, sampling frequency, temperature range, and more, to customize the generated mock traces. The module is useful for testing and simulating voltage time traces for antenna pattern analysis and other related applications.

class Mock_trace_generator(sidereal_voltage2_density_DF: DataFrame, hw_response_func: interp1d, impedance_func: interp1d, voltage2ADC: int = 2048, time_trace_size: int = 2048, sampling_frequency_MHz: float = 250)[source]

Bases: object

A class that generates mock voltage time traces.

Parameters

sidereal_voltage2_density_DFpandas.DataFrame

Dataframe containing the voltage-to-density conversion values as a function of sidereal time and frequency.

hw_response_funcinterp1d

Interpolator function for the hardware response as a function of frequency.

impedance_funcinterp1d

Interpolator function for the impedance as a function of frequency.

voltage2ADCint, optional

The maximum voltage (in volts) corresponds to half of the ADC range. Default is 2048.

time_trace_sizeint, optional

The size of the time trace. Default is 2048.

sampling_frequency_MHzfloat, optional

The sampling frequency of the trace in MHz. Default is 250.

Returns

None

generate_mock_trace(size: int = 1, return_debug_dict: bool = False, *args, **kwargs) Union[DataFrame, dict][source]

Generate a mock voltage time trace.

Parameters

sizeint, optional

The number of traces to generate. Default is 1.

return_debug_dictbool, optional

If True, returns a dictionary with debug information in addition to the time trace. Default is False.

‘*’argsany

Additional positional arguments to be passed to the ‘_generate_mock_trace’ method.

‘**’kwargsany

Additional keyword arguments to be passed to the ‘_generate_mock_trace’ method.

Returns

pd.DataFrame or dict

If return_debug_dict is False, returns a pandas DataFrame containing the time trace data. If return_debug_dict is True, returns a dictionary containing both the time trace and debug information.

get_frequency_bins()[source]

Return the frequency bins used in generating the mock trace.

Returns

numpy.ndarray

An array of frequency values in MHz.