Data#

note

Most analysis will occur with specifically imported modules per experiment. Module will have a main function analyze_data that will return the reduced data to plot.

Need to think about how to pass data from the measurement thread to the data analysis and plotting thread. May need an object that is just the most recent data taken, and not the full xarrray.DataArray object.

Todo

  • add some basic analysis functions like averaging samples

  • Saving reduced data?? May want to make another data structure, the processed data may not have the same dimensions as the Measurement_Data.dataset

class baecon.data.Measurement_Data(data_template: xarray.core.dataarray.DataArray = <factory>, data_set: xarray.core.dataset.Dataset = <factory>, processed_data: xarray.core.dataset.Dataset = <factory>)#

Data structure for handling data in baecon.

data_template#

A template of how the data will be stored for the measurement. For each full scan collection a copy of the template is supplied for storing the data for that scan collection. One full scan will fill the entire array.

Type

xarrray.DataArray

data_set#

The full data for the measurement. After a scan collection, the xarrray.DataArray is added to the data_set. When taking multiple runs of the scan collection, i.e, Measurement_Settings.averages, each average will be an xarrray.DataArray within data_set. Additionally, all the measurement settings are are saved as metadtata held in the attributes of data.

Type

xarrray.Dataset

processed_data#

Processed data returned from data_from_module().

Type

xarrray.Dataset

assign_measurement_settings(:py:class:`baecon.base.Measurement_Settings`)#

creates and stores data_template, and stores the measurement settings in data_set.

baecon.data.create_data_template(Measurement_Setings: baecon.base.Measurement_Settings) xarray.core.dataarray.DataArray#
Creates an xarray.DataArray object based on the measurement settings.

The dimenions will be based on the parameters to scan in Measurement_Settings.scan_collection and the samples to read in Measurement_Settings.acquisition_devices. This template is used to create entries for storing the data in a Measurement_Data.data_set object.

Parameters

Measurement_Setings (Measurement_Settings) – Current settings of the measurement

Returns

xarray.DataArray object with dimenions of parameters to scan

and acquisition samples to read. Values are initialized to np.nan

Return type

xr.DataArray

baecon.data.data_from_module(data: baecon.data.Measurement_Data, file_name: str)#

Load module and perform its analysis.

This allows for different analysis to be performed (and plotted) during the measurement. This function is mostly useful for the GUI.

Parameters
Returns

_description_

Return type

_type_