Radar Control

The radar_control package contains a single module, radar_control, that is a standalone program.

radar_control process

Radar_control is the process that runs the radar (sends pulses to the driver with timing information and sends processing information to the signal processing process). Experiment_handler provides the experiment for radar_control to run. It iterates through the interface_class_base objects to control the radar.

copyright

2018 SuperDARN Canada

author

Marci Detwiller

src.radar_control.data_to_driver(radctrl_to_driver, driver_to_radctrl_iden, samples_array, txctrfreq, rxctrfreq, txrate, rxrate, numberofreceivesamples, seqtime, SOB, EOB, timing, seqnum, align_sequences, repeat=False)[source]

Place data in the driver packet and send it via zeromq to the driver.

Parameters
  • radctrl_to_driver – the sender socket for sending the driverpacket

  • driver_to_radctrl_iden – the reciever socket identity on the driver side

  • samples_array – this is a list of length main_antenna_count from the config file. It contains one numpy array of complex values per antenna. If the antenna will not be transmitted on, it contains a numpy array of zeros of the same length as the rest. All arrays will have the same length according to the pulse length.

  • txctrfreq – the transmit center frequency to tune to.

  • rxctrfreq – the receive center frequency to tune to. With rx_sample_rate from config.ini file, this determines the received signal band.

  • txrate – the tx sampling rate (Hz).

  • rxrate – the rx sampling rate (Hz).

  • numberofreceivesamples – number of samples to receive at the rx_sample_rate from config.ini file. This determines length of Scope Sync GPIO being high for this sequence.

  • seqtime – relative timing offset

  • SOB – start of burst boolean, true for first pulse in sequence.

  • EOB – end of burst boolean, true for last pulse in sequence.

  • timing – in us, the time past timezero to send this pulse. Timezero is the start of the sequence.

  • seqnum – the sequence number. This is a unique identifier for the sequence that is always increasing with increasing sequences while radar_control is running. It is only reset when program restarts.

  • align_sequences – a boolean indicating whether to align the start of the sequence to a clean tenth of a second.

  • repeat – a boolean indicating whether the pulse is the exact same as the last pulse in the sequence, in which case we will save the time and not send the samples list and other params that will be the same.

src.radar_control.main()[source]

Run the radar with the experiment supplied by experiment_handler.

Receives an instance of an experiment. Iterates through the Scans, AveragingPeriods, Sequences, and pulses of the experiment.

For every pulse, samples and other control information are sent to the n200_driver.

For every pulse sequence, processing information is sent to the signal processing block.

After every averaging period, the experiment block is given the opportunity to change the experiment (not currently implemented). If a new experiment is sent, radar will halt the old one and begin with the new experiment.

src.radar_control.round_up_time(dt=None, round_to=60)[source]

Round a datetime object to any time lapse in seconds

Parameters
  • dt – datetime.datetime object, default now.

  • round_to – Closest number of seconds to round to, default 1 minute.

Author

Thierry Husson 2012 - Use it as you want but don’t blame me.

Modified

K.Kotyk 2019

Will round to the nearest minute mark. Adds one minute if rounded down.

src.radar_control.search_for_experiment(radar_control_to_exp_handler, exphan_to_radctrl_iden, status)[source]

Check for new experiments from the experiment handler

Parameters
  • radar_control_to_exp_handler – TODO

  • exphan_to_radctrl_iden – The TODO

  • status – status string (EXP_NEEDED or NO_ERROR).

Returns new_experiment_received

boolean (True for new experiment received)

Returns experiment

experiment instance (or None if there is no new experiment)

src.radar_control.send_datawrite_metadata(radctrl_to_datawrite, datawrite_radctrl_iden, seqnum, num_sequences, scan_flag, inttime, sequences, beam_iter, experiment_id, experiment_name, scheduling_mode, output_sample_rate, experiment_comment, filter_scaling_factors, rx_center_freq, debug_samples=None)[source]

Send the metadata about this averaging period to datawrite so that it can be recorded.

Parameters
  • radctrl_to_datawrite – The socket to send the packet on.

  • datawrite_radctrl_iden – Identity of datawrite on the socket.

  • seqnum – The last sequence number (identifier) that is valid for this averaging period. Used to verify and synchronize driver, dsp, datawrite.

  • num_sequences – The number of sequences that were sent in this averaging period. (number of sequences to average together).

  • scan_flag – True if this averaging period is the first in a scan.

  • inttime – The time that expired during this averaging period.

  • sequences – The sequences of class Sequence for this averaging period (AveragingPeriod).

  • beam_iter – The beam iterator of this averaging period.

  • experiment_id – the ID of the experiment that is running

  • experiment_name – the experiment name to be placed in the data files.

  • scheduling_mode – the type of scheduling mode running at this time, to write to file.

  • output_sample_rate – The output sample rate of the output data, defined by the experiment, in Hz.

  • experiment_comment – The comment string for the experiment, user-defined.

  • filter_scaling_factors – The decimation scheme scaling factors used for the experiment, to get the scaling for the data for accurate power measurements between experiments.

  • rx_center_freq – The receive center frequency (kHz)

  • debug_samples – the debug samples for this averaging period, to be written to the file if debug is set. This is a list of dictionaries for each Sequence in the AveragingPeriod. The dictionary is set up in the sample_building module function create_debug_sequence_samples. The keys are ‘txrate’, ‘txctrfreq’, ‘pulse_timing’, ‘pulse_sample_start’, ‘sequence_samples’, ‘decimated_sequence’, and ‘dmrate’. The ‘sequence_samples’ and ‘decimated_samples’ values are themselves dictionaries, where the keys are the antenna numbers (there is a sample set for each transmit antenna).

src.radar_control.send_dsp_metadata(radctrl_to_dsp, dsp_radctrl_iden, radctrl_to_brian, brian_radctrl_iden, rxrate, output_sample_rate, seqnum, slice_ids, slice_dict, beam_dict, sequence_time, first_rx_sample_start, rxctrfreq, pulse_phase_offsets, decimation_scheme=None)[source]

Place data in the receiver packet and send it via zeromq to the signal processing unit and brian. Happens every sequence.

Parameters
  • radctrl_to_dsp – The sender socket for sending data to dsp

  • dsp_radctrl_iden – The receiver socket identity on the dsp side

  • radctrl_to_brian – The sender socket for sending data to brian

  • brian_radctrl_iden – The receiver socket identity on the brian side

  • rxrate – The receive sampling rate (Hz).

  • output_sample_rate – The output sample rate desired for the output data (Hz).

  • seqnum – the sequence number. This is a unique identifier for the sequence that is always increasing with increasing sequences while radar_control is running. It is only reset when program restarts.

  • slice_ids – The identifiers of the slices that are combined in this sequence. These IDs tell us where to look in the beam dictionary and slice dictionary for frequency information and beam direction information about this sequence to give to the signal processing unit.

  • slice_dict – The slice dictionary, which contains information about all slices and will be referenced for information about the slices in this sequence. Namely, we get the frequency we want to receive at, the number of ranges and the first range information.

  • beam_dict – The dictionary containing beam directions for each slice.

  • sequence_time – entire duration of sequence, including receive time after all transmissions.

  • first_rx_sample_start – The sample where the first rx sample will start relative to the tx data.

  • rxctrfreq – the center frequency of receiving.

  • pulse_phase_offsets – Phase offsets (degrees) applied to each pulse in the sequence

  • decimation_scheme – object of type DecimationScheme that has all decimation and filtering data.

src.radar_control.setup_driver(radctrl_to_driver, driver_to_radctrl_iden, txctrfreq, rxctrfreq, txrate, rxrate)[source]

First packet sent to driver for setup.

Parameters
  • radctrl_to_driver – the sender socket for sending the driverpacket

  • driver_to_radctrl_iden – the receiver socket identity on the driver side

  • txctrfreq – the transmit center frequency to tune to, kHz.

  • rxctrfreq – the receive center frequency to tune to. With rx_sample_rate from config.ini file, this determines the received signal band, kHz.

  • txrate – the tx sampling rate (Hz).

  • rxrate – the rx sampling rate (Hz).