Radar Control¶
The radar_control package contains a single module, radar_control, that is a standalone program.
Usage¶
usage: radar_control.py [-h] [--embargo] [--kwargs KWARGS [KWARGS ...]]
experiment_module scheduling_mode_type
Positional Arguments¶
- experiment_module
The name of the module in the experiment_prototype package that contains your Experiment class, e.g. normalscan
- scheduling_mode_type
The type of scheduling time for this experiment run, e.g. common, special, or discretionary.
Named Arguments¶
- --embargo
Embargo the file (makes the CPID negative)
Default:
False- --kwargs
Keyword arguments for the experiment. Each must be formatted as kw=val
Default:
''
API¶
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.
- src.radar_control.create_driver_message(
- radctrl_params,
- pulse_transmit_data,
- pulse_buffer,
Format data for sending to usrp_driver via zeromq
- Parameters:
radctrl_params –
The current averaging period parameters dataclass.The parameters extracted are:
sequence.txctrfreq- the transmit center frequency to tune tosequence.rxctrfreq- the receive center frequency to tune to. With rx_sample_rate from config.ini file, this determines the received signal bandexperiment.txrate- the tx sampling rate (Hz)experiment.rxrate- the rx sampling rate (Hz)sequence.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 sequencesequence.seqtime- relative timing offsetseqnum- 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. It is determined asseqnum_start+num_sequencessequence.align_sequences- a boolean indicating whether to align the start of the sequence to a clean tenth of a second.
pulse_transmit_data –
dictionary of current transmit pulse data. The message extracts:
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 lengthstartofburst- start of burst boolean, true for first pulse in sequenceendofburst- end of burst boolean, true for last pulse in sequencetiming- in us, the time past timezero to send this pulse. Timezero is the start of the sequenceisarepeat- 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
- Returns:
The compiled
DriverPacketmessage to send to the usrp driver- Return type:
dataclass
- src.radar_control.create_dsp_message(radctrl_params)[source]¶
Place data in the receiver packet and send it via zeromq to the signal processing unit and brian. Happens every sequence.
- Parameters:
radctrl_params –
The radar control parameter dataclass updated during the averaging period. The message grabs:
experiment.rxrate- The receiver sampling rate (Hz)experiment.output_rx_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. It is calculated fromseqnum_start+num_sequencessequence.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 unitsequence.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 informationbeam_dict- The dictionary containing beam directions for each slice, generated usingsequence.get_rx_phases(aveperiod.beam_iter)sequence.seqtime- entire duration of sequence, including receive time after all transmissionssequence.first_rx_sample_start- The sample where the first rx sample will start relative to the tx datasequence.rxctrfreq- the center frequency of receivingsequence.output_encodings- Phase offsets (degrees) applied to each pulse in the sequencedecimation_scheme- object of type DecimationScheme that has all decimation and filtering datacfs_scan_flag- flag indicating of sequence is a clear frequency search rx only sequence
- Returns:
The compiled
SequenceMetadataMessagemessage to send to rx signal processing- Return type:
dataclass
- src.radar_control.create_dw_message(radctrl_params)[source]¶
Send the metadata about this averaging period to datawrite so that it can be recorded.
- Parameters:
radctrl_params –
The radar control parameter dataclass updated during the aveperiod. The message grabs:
seqnum- The last sequence number (identifier) that is valid for this averaging period. Used to verify and synchronize driver, dsp, datawrite. Calculated withseqnum_start+num_sequencesnum_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 scanaveraging_period_time- The time that expired during this averaging periodaveperiod.sequences- The sequences of class Sequence for this averaging period (AveragingPeriod)aveperiod.beam_iter- The beam iterator of this averaging periodexperiment.cpid- the ID of the experiment that is runningexperiment.experiment_name- the experiment name to be placed in the data filesexperiment.scheduling_mode- the type of scheduling mode running at this time, to write to fileexperiment.output_rx_rate- The output sample rate of the output data, defined by the experiment, in Hzexperiment.comment_string- The comment string for the experiment, user-defineddecimation_scheme.filter_scaling_factors- The decimation scheme scaling factors used for the experiment, to get the scaling for the data for accurate power measurements between experimentsexperiment.slice_dict[0].rxctrfreq- 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 aretxrate,txctrfreq,pulse_timing`, ``pulse_sample_start,sequence_samples,decimated_sequence, anddmrate. Thesequence_samplesanddecimated_samplesvalues are themselves dictionaries, where the keys are the antenna numbers (there is a sample set for each transmit antenna)
- Returns:
The compiled
AveperiodMetadataMessagemessage to send to data write- Return type:
dataclass
- src.radar_control.driver_comms_thread(
- radctrl_driver_iden,
- driver_socket_iden,
- router_addr,
Thread for handling communication between radar_control and usrp_driver.
- src.radar_control.dsp_comms_thread(radctrl_dsp_iden, dsp_socket_iden, router_addr)[source]¶
Thread for handling communication between radar_control and rx_signal_processing.
- src.radar_control.dw_comms_thread(radctrl_dw_iden, dw_socket_iden, router_addr)[source]¶
Thread for handling communication between radar_control and data_write.
- src.radar_control.main(exp_name, scheduling_mode, embargo, **kwargs)[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 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.
- class src.radar_control.CFSParameters[source]¶
Parameters used to track clear frequency search data, each use of this class should be linked to a unique aveperiod.
- Parameters:
cfs_freq – list of frequencies sampled by CFS
cfs_mags – power measurements corresponding to cfs_freq, indexed by beam iterator then by slice order in an aveperiod
cfs_range – lower and upper frequency bound of CFS
cfs_masks – mask of frequencies in cfs range that cannot be used for tx, indexed by beam_iter, then slice_id
last_cfs_set_time – epoch time since a CFS scan was last run. Indexed by beam iterator
beam_frequency – last frequency assigned to a slice on a beam. Indexed first by the beam iterator, then by the slice_id
set_new_freq – boolean flag indicating if a new freq should be set for the slices on a beam. Indexed by beam iterator