IQ demodulation post-processing¶
Post-processing plugin to perform IQ demodulation
-
class
place.plugins.iq_demod.iq_demod.
IQDemodulation
(config)[source]¶ Subclass of PLACE PostProcessing.
This class performs IQ demodulation on trace data from PLACE
-
config
(metadata, total_updates)[source]¶ Configuration for IQ demodulation
IQ demodulation requires the following configuration data (accessible as self._config[‘key’]):
Key Type Meaning field_ending string the ending of the field to be post-processed plot bool true if the post-processed data should be plotted remove_trace_data bool true if the original trace data should be removed (saving space); false if all data should be retained y_shift float an amount to shift all data points to put the zero point at zero (mostly used for data that is unsigned)
-
update
(update_number, data)[source]¶ Update the data by performing post-processing on one or more fields.
Called one or more times during an experiment. During this method, the post-processing module will receive a numpy array containing all the data recorded by PLACE so far during this update only. It can be thought of as one row of the total data collected by PLACE during the experiment.
The data will be stored in a NumPy structured array, meaning that it will have labelled headings. Most post-processing will generally target one field in this one row of data. This can be thought of as a cell in a spreadsheet. During each update cycle, PLACE is collecting cell data to populate one row. So, generally, this function will be looking for a specific cell in the row of data sent as input. This cell will be removed, processed, and re-inserted into the data - then returned to PLACE. For example, if you want to post-process trace data collected by the Alazartech ATS9440 during this update, you will use the named heading (probably ‘ATS9440-trace’) and row 0.
Here is an example of how a typical update occurs when post-processing data:
import numpy as np from numpy.lib import recfunctions as rfn # our target field name field = 'ATS9440-trace' # each update only has 1 row, so this is always 0 row = 0 # copy the desired cell out of the data data_to_process = data[field][row].copy() # delete the cell from the data, but save the other data (optional) other_data = rfn.drop_fields(data, field, usemask=False) # perform post-processing - should return a NumPy array with shape (1,) processed_data = self._post_processing(data_to_process) # insert and return the new data return rfn.merge_arrays([other_data, processed_data], flatten=True, usemask=False)
Note
It is important that the data returned by this function be the same size every time it gets called. For example, if an array of 256 64-bit floats is returned during the first update, then 256 64-bit floats must be returned during each subsequent update.
Parameters: - update_number (int) – The count of the current update. This will start at 0.
- data (numpy.array, structured array of shape (1,)) – row data collected so far from other instruments
Raises: NotImplementedError – if not implemented
-
cleanup
(abort=False)[source]¶ Called at the end of an experiment, or if there is an error along the way.
When this is called, the module should stop any activities and cleanup resources.
If the abort parameter is set, this indicates that the experiment is being abandoned, perhaps due to a safety concern, such as a problem with one of the instruments. In this case, halting all real world activity should be prioritized, and tasks regarding plotting, software resources or data integrity can be skipped.
Raises: NotImplementedError – if not implemented
-