Base#

class baecon.base.Measurement_Settings(acquisition_devices: dict = <factory>, scan_devices: dict = <factory>, scan_collection: dict = <factory>, averages: int = 1)#
Data structure for holding measurement settings.

The four measurement settings are acquisition devices, scan devices, scan collection, and averages (repeats) of the scan to perform. These four settings are all that is needed to run a meaurement.

acquisition_devices#

Dictionary holding the acquisition devices to be used during the measurement.

Entries are of the form: {working_name: device} where the working name is a nickname used to differentiate devices of the same type.

Type

dict

scan_devices#

Dictionary holding the scan devices to be used during the measurement.

Entries are of the form: {working_name: device}.

Type

dict

scan_collection#

Dictionary holding the scans to perform during the measurement.

Entries are of the form: {scan_name: scan_settings}. The scan_name is a combination of the scan device for that scan, and the device parameter that is being scanned, e.g., SG1-frequency.

Type

dict

averages#

Number of times to repeat the measurement. No averaging is done in the measurement function, but is instead handled when by baecon.data.

Type

int

baecon.base.add_device(device_config: dict, devices: dict) None#
Constructs a device from device_config, addig it to devices.

This dictionary will be the Measurement_Settings.acquisition_devices or Measurement_Settings.scan_devices.

Parameters
  • device_config (dict) – Configuration for the device to add.

  • devices (dict) – Dictionary of devices in measurement, either acquisition

  • devices. (or scan) –

baecon.base.add_scan(scan_settings: dict, scan_device: baecon.device.device.Device, ms: baecon.base.Measurement_Settings) None#
Make and add scan to Measurement_Settings.scan_collection.

Makes scan collection based on scan_settings and scan_device and adds this collection to ms.

Parameters
  • scan_settings (dict) – Dictionary of settings for the scan.

  • scan_device (Device) – Device which will be scanned.

  • ms (Measurement_Settings) – Settings for the measurement.

baecon.base.custom_schedule(note: str) numpy.ndarray#
Create a custom scan schedule from a saved file.

The file to load will be specified in the note setting as custom: file_name. File type should be .txt or .npy.

Todo

The method can be expand with other file types. May want to change to 'custom' using a method supplied by 'note'.

Parameters

note (str) – JSON parsable string from the note field in a scan collection

Returns

Numpy arrary for the scan schedule.

Return type

numpy.ndarray

baecon.base.define_scan_settings()#
Function used to define the possible scan settings. Might be best to put

this in utils with a function on how to update it.

Returns

Parameters that define a scan.

Return type

scan_settings (dict)

baecon.base.generate_measurement_config(ms: baecon.base.Measurement_Settings) dict#
Make configuration dictionary from Measurement_Settings object.

Configuration file will be a dict like file (e.g., json, yaml, toml) with structure:

{'acquisition_devices': {'device_name': configuration, ...}, 'scan_devices': {'device_name': configuration, ...}, 'scan_collections': {'scan_name': settings, ...} }

Parameters
  • ms (Measurement_Settings) – Measurement settings from which to generate

  • configuration. (the) –

Returns

Full dictionary need to specify a measurement.

can be dumped to a file with baecon.utils.dump_config().

Return type

meas_config (dict)

baecon.base.load_custom_scan_file()#

Todo

Need to specify where to look for custom scan file. Possibly put in the engine directory

baecon.base.make_device(config: dict) dict#
Create a Device object from the supplied configuration.

The module specified in config[‘device’] is imported and makes an device of that module type (e.g., SG380).

Returns a dictionary of configurations, now with the device object as the value of the ‘device’ entry.

Parameters

config (dict) – Configuration required to create a Device object.

Returns

New device configuration with device object.

Return type

dict

baecon.base.make_measurement_settings(meas_config: dict) baecon.base.Measurement_Settings#
Make a Measurement_Settings object from configurations in the meas_configs dictionary.

The dictionary has keys acquisition_devices, scan_devices, scan_collection, and averages (i.e., the attributes of a Measurement settings object).

Parameters

meas_configs (dict) –

Dictionary with configurations for

Returns

Measurement_Settings object.

Return type

Measurement_Settings

baecon.base.make_scan(scan_settings: dict, device: baecon.device.device.Device) dict#
Makes a scan collection from scan_settings and device.

Returns a dictionary element to add to Measurement_Settings.scan_collection.

Parameters

scan_settings (dict) – Settings for a single scan.

Returns

Scan dictionary to add to Measurement_Settings.scan_collection.

Return type

dict

baecon.base.make_scan_schedule(scan_settings: dict) numpy.ndarray#
Makes scan schedule to add to the scan colletion.

The schedule is the order of parameter values to scan through based on the scan settings ‘min’, ‘max’, ‘points’, and ‘repititions’. Returns a numpy.ndarray with the schedule.

The schedules has four default scales: linear, log, custom, and constant. The scales linear and log generate schedules in linear or log space, custom uses a schedule from the user defined custom_schedule method, and constant generates a single value based on the ‘min’ parameter. ‘repetitions’ determines how many times the schedule is repeated. ‘random’ is utilized while the measurement is running.

For example, the settings

scan_settings = {'name': 'SG1', 'device': 'SG380', 'parameter': frequency, 'min': 1, 'max': 2, 'points': 5, 'repetitions': 2, 'randomize': False, 'note': ''}

yields the schedule:

np.ndarray([1.0, 1.25, 1.5, 1.75, 2.0, 1.0, 1.25, 1.5, 1.75, 2.0])

Parameters

scan_settings (dict) – Scan settings

Returns

np.ndarray with scan schedule

Return type

np.ndarray