base module

base_class

class pysmurf.client.base.base_class.SmurfBase(log=None, epics_root=None, offline=False, pub_root=None, script_id=None, **kwargs)[source]

Base class for common things

Parameters
  • log (log file or None, optional, default None) – The log file to write to. If None, creates a new log file.

  • epics_root (str or None, optional, default None) – The name of the epics root. For example “test_epics”.

  • offline (bool, optional, default False) – Whether to run in offline mode (no rogue) or not. This will break many things. Default is False.

  • pub_root (str or None, optional, default None) – Root of environment vars to set publisher options. If None, the default root will be SMURFPUB_.

  • script_id (str or None, optional, default None) – Script id included with publisher messages. For example, the script or operation name.

LOG_ERROR = 0

Only log errors

LOG_INFO = 1

Extra high-level information. Configuration notices that happen once

LOG_TASK = 2

Overall progress on a task

LOG_USER = 0

Default log level for user code. DO NOT USE in library

init_log(verbose=0, logger=<class 'pysmurf.client.base.logger.SmurfLogger'>, logfile=None, log_timestamp=True, log_prefix=None, **kwargs)[source]

Initialize the logger from the input keyword arguments.

Parameters
  • logger (logging class, optional) – Class to initialize, should be a subclass of SmurfLogger or equivalent.

  • verbose (bool, int, or string; optional) – Verbosity level, non-negative. Default: 0 (print user-level messages only). String options are ‘info’, ‘time’, ‘gd’, or ‘samp’.

  • logfile (string, optional) – Logging output filename. Default: None (print to sys.stdout)

  • log_timestamp (bool, optional) – If True, add timestamps to log entries. Default: True

  • log_prefix (string, optional) – If supplied, this prefix will be pre-pended to log strings, before the timestamp.

Returns

log – Initialized logging object

Return type

log object

set_logfile(logfile=None)[source]

Change the location where logs are written. If logfile is None, log to STDOUT.

set_verbose(level)[source]

Change verbosity level. Can be an integer or a string name. Valid strings are ‘info’, ‘time’, ‘gd’ or ‘samp’.

logger

class pysmurf.client.base.logger.Logger(verbosity=0, indent=True, logfile=None)[source]

Basic prioritized logger, by M. Hasselfield.

__call__(*args, **kwargs)[source]

Log a message.

Parameters
  • msg (string) – The message to log.

  • level (int, optional) – The verbosity level of the message. If at or below the set level, the message will be logged.

format(s, level=0)[source]

Format the input for writing to the logfile.

set_logfile(logfile=None)[source]

Change the location where logs are written. If logfile is None, log to STDOUT.

set_verbose(level)[source]

Change the verbosity level of the logger.

set_verbosity(level)[source]

Change the verbosity level of the logger.

class pysmurf.client.base.logger.SmurfLogger(**kwargs)[source]

Basic logger with timestamps and named logging levels.

format(s, level=0)[source]

Format the input for writing to the logfile.

set_verbosity(v)[source]

Change the verbosity level of the logger.

smurf_config

Defines the SmurfConfig class.

class pysmurf.client.base.smurf_config.SmurfConfig(filename=None, validate=True)[source]

Read, manipulate or write a pysmurf config file.

Class for loading pysmurf configuration files. In addition to functions for reading and writing pysmurf configuration files, contains helper functions for manipulating configuration variables which are stored internally in a class instance attribute dictionary named config.

pysmurf configuration files must be in the JSON format 1. On instantiation, attempts to read the pysmurf configuration file at the path provided by the filename argument into the config dictionary. If the filename argument is not provided, no configuration file is loaded and the config attribute is None.

If a pysmurf configuration file is successfully loaded and the validate constructor argument is True (which is the default behavior), the parameters in the configuration file will be validated using the 3rd party schema python library 2 using the rules specified in the validate_config() class method. If the configuration file data is valid, parameters are loaded into the config dictionary.

If validate is False, the pysmurf configuration data will be loaded without schema validation. Use at your own risk!

Parameters
  • filename (str or None, optional, default None) – Path to pysmurf configuration file to load.

  • validate (bool, optional, default True) – Whether or not to run schema validation on the pysmurf configuration file data. If schema validation fails, a SchemaError exception will be raised.

Variables
  • filename (str or None) – Path to loaded pysmurf configuration file, or configuration file to load. None if no pysmurf configuration file has been loaded.

  • config (dict or None) – Loaded dictionary of pysmurf configuration data. None if no pysmurf configuration file has been loaded.

See also

validate_config()

Run schema validation on loaded configuration dictionary.

References

1

https://www.json.org/json-en.html

2

https://github.com/keleshev/schema

get(key)[source]

Return entry in config dictionary for requested key.

Parameters

key (any) – Key whose config dictionary entry to retrieve.

Returns

Returns value for requested key from config dictionary. Returns None if key is not present in the config dictionary.

Return type

any or None

get_subkey(key, subkey)[source]

Get config dictionary subkey value.

Parameters
  • key (any) – Key in config dictionary.

  • subkey (any) – Subkey in config dictionary.

Returns

Returns value for requested subkey from config dictionary. Returns None if either key or subkey are not present in the config dictionary.

Return type

any or None

has(key)[source]

Report if configuration has requested key.

Parameters

key (any) – Key to check for in config dictionary.

Returns

Returns True if key is in the config dictionary, False if it is not.

Return type

bool

read(update=False, validate=True)[source]

Read config file and update the config dictionary.

Reads raw configuration parameters from configuration file at the path specified by the filename class instance attribute using the read_json() method.

If the validate argument is True (which is the default behavior), the loaded configuration parameters are validated using the validate_config() routine.

The config class instance attribute is only updated with the loaded configuration parameters if the update argument is True (it is False by default). Either way, the loaded configuration parameter dictionary is returned.

Parameters
  • update (bool, optional, default False) – Whether or not to update the configuration.

  • validate (bool, optional, default True) – Whether or not to run schema validation on the pysmurf configuration file data. If schema validation fails, a SchemaError exception will be raised.

Returns

config – The loaded dictionary of pysmurf configuration parameters.

Return type

dict

See also

read_json()

Reads raw configuration file into a dictionary.

validate_config()

Run schema validation on loaded configuration dictionary.

static read_json(filename, comment_char='#')[source]

Read a pysmurf configuration file.

Opens configuration file at the path provided by the filename argument, strips off all lines that start with the character provided by the comment_char argument, and then parses the remaining lines in the pysmurf configuration file into a dictionary using the json.loads() routine. Any text after the comment_char on a line is also ignored.

Parameters
  • filename (str) – Path to pysmurf configuration file to load.

  • comment_char (str, optional, default '#') – Comments that start with this character will be ignored.

Returns

loaded_config – Dictionary of loaded pysmurf configuration parameters.

Return type

dict

Raises
  • FileNotFoundError – Raised if the configuration file does not exist.

  • JSONDecodeError – Raised if the loaded configuration file data is not in JSON format.

update(key, val)[source]

Update a single key in the config dictionary.

Parameters
  • key (any) – Key to update in the config dictionary.

  • val (any) – Value to assign to the given key

update_subkey(key, subkey, val)[source]

Set config dictionary subkey value.

Parameters
  • key (any) – Key in config dictionary.

  • subkey (any) – Subkey in config dictionary

  • val (any) – Value to write to config dictionary subkey.

static validate_config(loaded_config)[source]

Validate pysmurf configuration dictionary.

Validates the parameters in the configuration dictionary provided by the loaded_config argument using the 3rd party schema python library. If the configuration data is valid, parameters are returned as a dictionary.

schema validation does several important things to raw data loaded from the pysmurf configuration file:

  • Checks that all mandatory configuration variables are defined.

  • Conditions all configuration variables into the correct type (e.g. float, int, str, etc.).

  • Automatically fills in the values for missing optional parameters. Optional parameters are typically parameters which almost never change from SMuRF system to SMuRF system.

  • Checks if parameters have valid values (e.g., some parameters can only be either 0 or 1, or must be in a predefined interval, etc.).

  • Performs validation of some known higher level configuration data interdependencies (e.g. prevents the user from defining an RTM DAC as both a TES bias and an RF amplifier bias).

If validation fails, schema will raise a SchemaError exception and fail to load the configuration data, forcing the user to fix the cause of the SchemaError exception before the configuration file can be loaded and used.

Parameters

loaded_config (dict) – Dictionary of pysmurf configuration parameters to run schema validation on.

Returns

validated_config – Dictionary of validated configuration parameters. Parameter values are conditioned by schema to conform to the specified types.

Return type

dict

Raises

SchemaError – Raised if the configuration data fails schema validation.

write(outputfile)[source]

Dump the current config to a file.

Writes the config dictionary to file at the path provided by the outputfile argument using the json.dumps() routine.

Parameters

outputfile (str) – The name of the file to save the configuration to.

smurf_control

Defines the SmurfControl class.

class pysmurf.client.base.smurf_control.SmurfControl(epics_root=None, cfg_file=None, data_dir=None, name=None, make_logfile=True, setup=False, offline=False, smurf_cmd_mode=False, no_dir=False, shelf_manager='shm-smrf-sp01', validate_config=True, data_path_id=None, **kwargs)[source]

Base class for controlling SMuRF.

Loads all the mixins. NEED LONGER DESCRIPTION OF THE SMURF CONTROL CLASS HERE. Inherits from the following mixins:

Parameters
  • epics_root (str, optional, default None) – The epics root to be used.

  • cfg_file (str, optional, default None) – Config file path. Must be provided if not on offline mode.

  • data_dir (str, optional, default None) – Path to the data directory.

  • name (str, optional, default None) – The name of the output directory. If None, it will use the current timestamp as the output directory name.

  • make_logfile (bool, optional, default True) – Whether to make a log file. If False, outputs will go to the screen.

  • setup (bool, optional, default False) – Whether to run the setup step.

  • offline (bool, optional, default False) – Whether or not to instantiate in offline mode.

  • smurf_cmd_mode (bool, optional, default False) – This mode tells the system that the input is coming in from the command line (rather than a python session). Everything implemented here are in smurf_cmd.py.

  • no_dir (bool, optional, default False) – Whether to make a skip making a directory.

  • shelf_manager (str, optional, default 'shm-smrf-sp01') – Shelf manager ip or network name. Usually each SMuRF server is connected one-to-one with a SMuRF crate, and the default shelf manager name is configured to be ‘shm-smrf-sp01’

  • validate_config (bool, optional, default True) – Whether to check if the input config file is correct.

Variables
Raises

ValueError – If not offline and cfg_file is None.

See also

initialize

add_output(key, val)[source]

Adds key/value pair to pysmurf configuration dictionary.

NEED LONGER DESCRIPTION OF ADD OUTPUT MEMBER FUNCTION HERE.

Parameters
  • key (any) – The name of the key to update.

  • val (any) – The value to assign to the key.

get_timestamp(as_int=False)[source]

Gets the current unix time timestamp.

Gets the number of seconds that have elapsed since the Unix epoch, that is the time 00:00:00 UTC on 1 January 1970, minus leap seconds.

Parameters

as_int (bool, optional, default False) – Whether to return the timestamp as an integer. If False, timestamp is returned as an integer.

Returns

timestamp – Timestamp as a string, unless optional argument as_int=True, in which case returns timestamp as an integer.

Return type

str or int

initialize(data_dir=None, name=None, make_logfile=True, setup=False, smurf_cmd_mode=False, no_dir=False, publish=False, payload_size=2048, data_path_id=None, **kwargs)[source]

Initializes SMuRF system.

Longer description of initialize routine here.

Parameters
  • data_dir (str, optional, default None) – Path to the data directory.

  • name (str, optional, default None) – The name of the output directory. If None, it will use the current timestamp as the output directory name.

  • make_logfile (bool, optional, default True) – Whether to make a log file. If False, outputs will go to the screen.

  • setup (bool, optional, default False) – Whether to run the setup step.

  • smurf_cmd_mode (bool, optional, default False) – This mode tells the system that the input is coming in from the command line (rather than a python session). Everything implemented here are in smurf_cmd.py.

  • no_dir (bool, optional, default False) – Whether to make a skip making a directory.

  • publish (bool, optional, default False) – Whether to send messages to the OCS publisher.

  • payload_size (int, optional, default 2048) – The payload size to set on setup.

  • data_path_id (str, optional, default None) – If set, this will add the path-id to the output and plot dir paths to avoid possible collisions between multiple smurf instances running simultaneously. For instance, if set to crate1slot2 the outputs directory will be:: <data_dir>/<date>/crate1slot2/<ctime>/outputs

See also

setup

make_dir(directory)[source]

Create directory on file system at the specified path.

Checks if a directory exists on the file system. If directory does not already exist on the file system, creates it.

Parameters

directory (str) – Full path of directory to create on the file system.

setup(write_log=True, payload_size=2048, force_configure=False, **kwargs)[source]

Configures SMuRF system.

Sets up the SMuRF system by first loading hardware register defaults followed by overriding the hardware default register values with defaults from the pysmurf configuration file.

Setup steps (in order of execution):

  • Disables hardware logging if it’s active (to avoid register access collisions).

  • Sets FPGA OT limit (if one is specified in pysmurf cfg).

  • Resets the RF DACs on AMCs in use.

  • Sets hardware defaults using set_defaults_pv().

  • Checks if JESD is locked using set_check_jesd().

  • Overrides hardware defaults register values for subset of registers controlled by the pysmurf configuration file.

  • Resets the RTM CPLD.

  • Turns off flux ramp, but configures based on values for reset rate and fraction full scale provided in pysmurf configuration file.

  • Enables data streaming.

  • Sets mask and payload size to a single channel.

  • Sets RF amplifier biases (without enabling drain voltages).

  • Configures timing based on pysmurf configuration file settings.

  • Resumes hardware logging if it was active at beginning.

If system configuration fails, returns False, otherwise returns True. Failure modes (which will return False) are as follows:

  • set_defaults_pv() fails (only supported for pysmurf core code versions >=4.1.0). If failure is detected, doesn’t attempt to execute the subsequent setup steps.

  • set_check_jesd() fails (only supported for Rogue ZIP file versions >=0.3.0). If failure is detected, doesn’t attempt to execute the subsequent setup steps.

Parameters
  • write_log (bool, optional, default True) – Whether to write to the log file.

  • payload_size (int, optional, default 2048) – The starting size of the payload.

  • force_configure (bool, optional, default False) – Whether or not to force configure if system has already been configured once by the currently running Rogue server.

  • **kwargs – Arbitrary keyword arguments. Passed to many, but not all, of the _caput calls.

Returns

success – Returns True if system setup succeeded, otherwise False. Also returns False if system has already been configured by the currently running Rogue server and force_configure=False.

Return type

bool

See also

set_defaults_pv()

Loads the hardware defaults.

write_output(filename=None)[source]

Writes internal pysmurf configuration to disk.

Dump the current configuration to a file. This wraps around the config file writing in the config object. Files are timestamped and dumped to the S.output_dir by default.

Parameters

filename (str, optional, default None) – Full path of output configuration file to write to disk.

smurf_config_properties

Defines the mixin class SmurfConfigPropertiesMixin.

class pysmurf.client.base.smurf_config_properties.SmurfConfigPropertiesMixin(*args, **kwargs)[source]

Mixin for loading pysmurf configuration parameters.

Defines properties used by pysmurf whose values are specified in the pysmurf configuration file. More details on python properties can be found in the documentation for python “Built-in Functions” 3.

The SmurfConfigPropertiesMixin class has only one method copy_config_to_properties() which can populate the properties from a provided SmurfConfig class instance. copy_config_to_properties() can be called by the user at any time, but it is called once to populate all of the SmurfConfigPropertiesMixin attributes by a call to the initialize() method in the SmurfControl constructor (unless the SmurfControl instance is not instantiated with a configuration file).

Warning

If a user changes the value of a property but then writes the internal pysmurf configuration to disk with the write_output() function, the value written to the file will not reflect the user’s change.

Examples

Taking the pA_per_phi0 property as an example, if S is a SmurfControl class instance, once the property has been set with a call to the copy_config_to_properties() routine, its value can be retrieved like this:

>>> S.pA_per_phi0
9000000.0

and it can be set like this:

>>> S.pA_per_phi0 = 9000000.0

Each property has a corresponding class instance internal attribute that the property get/set operates on and which is used internally in all pysmurf functions that rely on the property. The internal attributes corresponding to each property have the same name as the property but with an underscore preceding the property name. E.g. the internal attribute corresponding to the pA_per_phi0 property is called _pA_per_phi0. Users should never set or get the internal attribute directly.

See also

initialize()

References

3

https://docs.python.org/3/library/functions.html#property

property R_sh

Resistance of the TES shunt resistors.

Gets or sets the resistance of the TES shunt resistors. Assumes the same shunt resistance for every channel. Units are Ohms.

Specified in the pysmurf configuration file as R_sh.

Returns

Resistance of the TES shunt resistors in Ohms.

Return type

float

property all_groups

Which TES bias groups are in use.

Gets or sets the list of TES bias groups in use. Each element of this list must be an integer corresponding to a TES bias group and in [0,16). bias_group_to_pair() encodes the mapping from TES bias group number to bipolar RTM DAC pair.

Specified in the pysmurf configuration file as all_bias_groups.

property amplitude_scale

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as amplitude_scale.

See also

?

property att_dc

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as att_dc.

See also

?

property att_uc

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as att_uc.

See also

?

property attenuator

Map between the 500MHz bands and their RF attenuators.

Gets or sets the assumed hardware correspondence between the 500 MHz attenuators and their UC and DC RF attenuator numbers. Only the mapping for bands 0-3 should be specified, since the mapping is assumed to be identical for the two carrier AMC bays (e.g. the mapping is identical from band to attenuator number for band % 4). Unitless.

Specified in the pysmurf configuration file as attenuator.

Returns

A dictionary with two keys, ‘band’ and ‘att’, which map to two numpy.ndarray of integers corresponding to the UC and DC attenuator numbers and their corresponding 500 MHz band numbers, in the same order.

Return type

dict

Examples

The attenuator mapping is specified as a dictionary in the pysmurf configuration file like this:

"attenuator" : {
   "att1" : 0,
   "att2" : 1,
   "att3" : 2,
   "att4" : 3
},

where the keys (e.g. “att1”) specify which attenuator maps to which 500 MHz band (the integer value). The mapping is stored in a very different format inside pysmurf - loading the above attenuator mapping results in the following value for the attenuator property (here S is a SmurfControl class instance):

>>> print(S.attenuator)
{'band': array([0, 1, 2, 3]), 'att': array([1, 2, 3, 4])}
property bad_mask

Resonator frequency ranges to ignore when relocking.

Gets or sets the list of RF frequency intervals in which to ignore resonator candidates in calls to relock() Frequencies are in units of MHz. relock() is called at the end of many tuning functions including setup_notches() and track_and_check().

Specified in the pysmurf configuration file as bad_mask.

See also

relock()

Examples

The bad_mask property is specified as a dictionary in the pysmurf configuration file like this (where the ellipsis denotes additional possible bad_mask entries):

"bad_mask" : {
   "0" : [5000, 5100],
   "1" : [5500, 5750],
   ...
},

where the keys are ignored (but must be unique) and the values specify intervals of RF frequencies in MHz over which to discard resonator candidates when relocking. The frequency ranges are stored in pysmurf in the bad_mask property as a numpy.ndarray of numpy.ndarray.

For example, the above would result in the following value for the bad_mask property (here S is a SmurfControl class instance and the ellipsis denotes additional possible entries):

>>> import pprint
>>> pprint.pprint(S.bad_mask)
array([[5000., 5100.], [5500., 5750.], ...])
property band_delay_us

Total compensation for system latency - cable, ADC/DAC, and DSP

Returns

Adjustment for (analog + digital) round-trip delay in micro seconds.

Return type

double

See also

estimate_phase_delay()

Measures band_delay_us.

property bands

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:bands.

See also

?

property bias_group_to_pair

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as bias_group_to_pair.

See also

?

property bias_line_resistance

Total low current mode TES bias line resistance.

Gets or sets the total low current mode TES bias line resistance. Assumes the same resistance for every TES bias line. Includes the inline resistance on the cryostat card (with the cryostat card relays set to the low current operation mode position) and cryocable impedance (including any cold resistors). Technically includes the resistance added by the connected TES+shunt resistor chain, but that is typically negligible compared to the cryostat card and cryocable impedances. Units are Ohms.

Specified in the pysmurf configuration file as bias_line_resistance.

Returns

Total low current mode TES bias line resistance in Ohms.

Return type

float

copy_config_to_properties(config)[source]

Copy values from SmurfConfig instance to properties.

MORE EXPLANATION HERE. USES PROPERTY SETTERS IN CASE WE EVER WANT TO IMPOSE ANY CONDITIONS IN THEM.

Parameters

config (SmurfConfig) – Select values in the provided SmurfConfig will be copied into properties in this SmurfConfigPropertiesMixin instance.

property data_out_mux

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as data_out_mux.

See also

?

property default_data_dir

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as smurf_to_mce:default_data_dir.

See also

?

property default_tune

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as smurf_to_mce:default_tune.

See also

?

property delta_freq

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:delta_freq.

See also

?

property dsp_enable

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as dsp_enable.

See also

?

property epics_root

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as smurf_to_mce:epics_root.

See also

?

property eta_scan_averages

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:eta_scan_averages.

See also

?

property eta_scan_del_f

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:eta_scan_del_f.

See also

?

property feedback_enable

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as feedback_enable.

See also

?

property feedback_end_frac

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as smurf_to_mce:feedback_end_frac.

See also

?

property feedback_gain

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as feedback_gain.

See also

?

property feedback_limit_khz

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as feedback_limit_khz.

See also

?

property feedback_polarity

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as feedback_polarity.

See also

?

property feedback_start_frac

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as smurf_to_mce:feedback_start_frac.

See also

?

property fiftyk_Id_offset

50K amplifier drain current offset in mA.

Gets or sets the 50K RF amplifier drain current is measured before the regulator that steps the main RF6.0V supply down to the lower 50K RF amplifier drain voltage using an inline resistor (see fiftyk_amp_Vd_series_resistor()), so the total measured current through the series resistor includes both the drain current drawn by the 50K RF amplifier and any additional current drawn by the DC/DC regulator. An accurate measurement of the 50K amplifier drain current requires subtracting the current drawn by that regulator from the measured total current. This is the offset to subtract off the measured value. Units are milliamperes.

Specified in the pysmurf configuration file as amplifier:50k_Id_offset.

Returns

50K LNA drain current offset in milliamperes.

Return type

float

See also

get_50k_amp_drain_current()

property fiftyk_Vg

50K LNA Gate Voltage.

Gets or sets the desired value for the 50K LNA Gate voltage at the output of the cryostat card. Units are Volts.

Specified in the pysmurf configuration file as amplifier:LNA_Vg.

Returns

50K LNA gate voltage in Volts.

Return type

float

See also

set_amplifier_bias()

property fiftyk_amp_Vd_series_resistor

50K LNA drain current measurement resistor in Ohms.

Gets or sets the resistance of the resistor that is inline with the 50K LNA drain voltage source which is used to infer the 50K RF amplifier drain current. This resistor is inline with but before the regulator that steps the main RF6.0V supply down to the lower 50K LNA drain voltage, so the current flowing through this resistor includes both the drain current drawn by the 50K RF amplifier and any additional current drawn by the DC/DC regulator. The default value of 10 Ohm is the standard value loaded onto cryostat card revision C02 (PC-248-103-02-C02). The resistor on that revision of the cryostat card is R54. Units are Ohms.

Specified in the pysmurf configuration file as amplifier:50K_amp_Vd_series_resistor.

Returns

Resistance in Ohms of the inline resistor used to measure the 50K LNA drain current.

Return type

float

See also

get_50k_amp_drain_current()

property fiftyk_bit_to_V

Bit to volts conversion for 50K LNA gate DAC.

Gets or set the conversion from bits (the digital value the RTM DAC is set to) to Volts for the 50K LNA gate (specified at the output of the cryostat card). An important dependency is the voltage division on the cryostat card, which can be different from cryostat card to cryostat card. Units are Volts/bit.

Specified in the pysmurf configuration file as amplifier:bit_to_V_50k.

Returns

Conversion factor from bits to volts for the 50K LNA gate in Volts/bit.

Return type

float

See also

set_50k_amp_gate_voltage(), get_50k_amp_gate_voltage()

property fiftyk_dac_num

RTM DAC number wired to the 50K LNA gate.

Gets or sets the DAC number of the DAC on the RTM that is wired to the 50K LNA gate. Must be an integer between 1 and 32, at least for RTM main board revision C01 (PC-379-396-32-C01). The DAC number corresponds to the number on the RTM schematic (e.g. see the nets named DAC1,…,DAC32. The connection between an RTM DAC and the 50K LNA gate is made on the cryostat card. The default RTM DAC that’s wired to the 50K LNA gate for cryostat card revision C02 (PC-248-103-02-C02) is DAC32 (if JMP4 on the cryostat card is populated correctly).

Specified in the pysmurf configuration file as amplifier:dac_num_50k.

Returns

DAC number of RTM DAC wired to the 50K LNA gate.

Return type

int

See also

set_50k_amp_gate_voltage(), get_50k_amp_gate_voltage(), set_50k_amp_enable()

property fraction_full_scale

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:fraction_full_scale.

See also

?

property fs

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as fs.

See also

?

property gradient_descent_averages

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:gradient_descent_averages.

See also

?

property gradient_descent_beta

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:gradient_descent_beta.

See also

?

property gradient_descent_converge_hz

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:gradient_descent_converge_hz.

See also

?

property gradient_descent_gain

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:gradient_descent_gain.

See also

?

property gradient_descent_momentum

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:gradient_descent_momentum.

See also

?

property gradient_descent_step_hz

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:gradient_descent_step_hz.

See also

?

property hemt_Id_offset

4K HEMT drain current offset in mA.

Gets or sets the 4K HEMT drain current is measured before the regulator that steps the main RF6.0V supply down to the lower 4K HEMT drain voltage using an inline resistor (see hemt_Vd_series_resistor()), so the total measured current through the series resistor includes both the drain current drawn by the 4K HEMT and any additional current drawn by the DC/DC regulator. An accurate measurement of the 4K amplifier drain current requires subtracting the current drawn by that regulator from the measured total current. This is the offset to subtract off the measured value. Units are milliamperes.

Specified in the pysmurf configuration file as amplifier:hemt_Id_offset.

Returns

4K HEMT drain current offset in milliamperes.

Return type

float

See also

get_hemt_drain_current()

property hemt_Vd_series_resistor

4K HEMT drain current measurement resistor in Ohms.

Gets or sets the resistance of the resistor that is inline with the 4K HEMT amplifier drain voltage source which is used to infer the 4K HEMT amplifier drain current. This resistor is inline with but before the regulator that steps the main RF6.0V supply down to the lower 4K HEMT drain voltage, so the current flowing through this resistor includes both the drain current drawn by the 4K HEMT and any additional current drawn by the DC/DC regulator. The default value of 200 Ohm is the standard value loaded onto cryostat card revision C02 (PC-248-103-02-C02). The resistor on that revision of the cryostat card is R44. Units are Ohms.

Specified in the pysmurf configuration file as amplifier:hemt_Vd_series_resistor.

Returns

Resistance in Ohms of the inline resistor used to measure the 4K HEMT amplifier drain current.

Return type

float

See also

get_hemt_drain_current()

property hemt_Vg

4K HEMT gate voltage in volts.

Gets or sets the desired value for the 4K HEMT gate voltage at the output of the cryostat card. Units are Volts.

Specified in the pysmurf configuration file as amplifier:hemt_Vg.

Returns

4K HEMT gate voltage in Volts.

Return type

float

See also

set_amplifier_bias()

property hemt_bit_to_V

Bit to volts conversion for 4K HEMT gate DAC.

Gets or sets the conversion from bits (the digital value the RTM DAC is set to) to Volts for the 4K amplifier gate (specified at the output of the cryostat card). An important dependency is the voltage division on the cryostat card, which can be different from cryostat card to cryostat card. Units are Volts/bit.

Specified in the pysmurf configuration file as amplifier:bit_to_V_hemt.

Returns

Conversion factor from bits to volts for the 4K amplifier gate in Volts/bit.

Return type

float

See also

set_hemt_gate_voltage(), get_hemt_gate_voltage()

property hemt_gate_max_voltage

4K HEMT gate voltage maximum software limit.

Gets or sets the maximum voltage the 4K HEMT gate voltage can be set to using the set_hemt_gate_voltage() function unless this software limit is overriden with the boolean override argument of set_hemt_gate_voltage(). Units are Volts.

Specified in the pysmurf configuration file as amplifier:hemt_gate_max_voltage.

Returns

Software limit on maximum 4K HEMT gate voltage user can apply, in Volts.

Return type

float

See also

set_hemt_gate_voltage()

property hemt_gate_min_voltage

4K HEMT gate voltage minimum software limit.

Gets or sets the minimum voltage the 4K HEMT gate voltage can be set to using the set_hemt_gate_voltage() function unless this software limit is overriden with the boolean override argument of set_hemt_gate_voltage(). Units are Volts.

Specified in the pysmurf configuration file as amplifier:hemt_gate_min_voltage.

Returns

Software limit on minimum 4K HEMT gate voltage user can apply, in Volts.

Return type

float

See also

set_hemt_gate_voltage()

property high_current_mode_bool

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as high_current_mode_bool.

See also

?

property high_low_current_ratio

Current ratio between low- to high-current modes.

Gets or sets the ratio of currents sourced by the cryostat card for the same applied TES bias voltage (from the RTM, at the input to the cryostat card) in high- versus low-current cryostat card TES bias relay modes. In typical applications, this ratio is >1, since otherwise the currents sourced in high-current mode wouldn’t be higher than the currents sourced in low current mode! Assumes the same ratio for every TES bias line. In typical applications, this ratio is well approximated by the ratio of the resistances on the cryostat card alone (computed as the total resistance for the relay in the low-current mode position divided by the total resistance for the relay in the high-current mode position). Unitless.

Specified in the pysmurf configuration file as high_low_current_ratio.

Returns

The ratio of currents sourced by the cryostat card for the same applied TES bias voltage (from the RTM, at the input to the cryostat card) in high- versus low-current modes (unitless).

Return type

float

property iq_swap_in

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as iq_swap_in.

See also

?

property iq_swap_out

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as iq_swap_out.

See also

?

property lms_delay

DEPRECATED

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as lms_delay.

See also

?

property lms_freq_hz

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as ?.

See also

?

property lms_gain

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as ?.

See also

?

property n_bias_groups

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as ?.

See also

?

property num_flux_ramp_counter_bits

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as flux_ramp:num_flux_ramp_counter_bits.

See also

?

property pA_per_phi0

Demodulated SQUID phase to TES current conversion factor.

Gets or sets the conversion factor between the demodulated SQUID phase for every SMuRF channel and the equivalent TES current. Units are picoamperes per Phi0, with Phi0 the magnetic flux quantum.

Specified in the pysmurf configuration file as constant:pA_per_phi0.

Returns

Conversion factor between demodulated SQUID phase and equivalent TES current in picoamperes per Phi0.

Return type

float

property pic_to_bias_group

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as pic_to_bias_group.

See also

?

property ref_phase_delay

DEPRECATED Coarse (analog + digital) round-trip delay.

Gets or sets the coarse (analog + digital) round-trip delay. This is the total time it takes a tone to traverse the synthesis filter bank, get generated by the DAC, propagate through the external analog RF circuit (e.g. through a cold RF chain including MUX chips), get digitized by the ADC, and then traverse the analysis filter bank. This register is named refPhaseDelay in firmware.

Unit-less unsigned integer. Each step is a clock tick whose frequency is given by get_channel_frequency_mhz() in MHz. Different carrier firmware versions support different ranges.

This delay is applied to the phase of each generated tone, and an overall phase rotation of (etaPhase - refPhaseDelay) is applied to each tone after demodulation and downmix. refPhaseDelay can be measured using the estimate_phase_delay() routine.

The total effective delay can be fine tuned by also setting the refPhaseDelayFine register (see ref_phase_delay_fine()) which adjusts the compensated delay more finely by 307.2 MHz ticks (although they way refPhaseDelayFine compensates for delay in firmware is not the same as refPhaseDelay - see the docstring for the ref_phase_delay_fine() property for more details).

Specified in the pysmurf configuration file as init:band_#:refPhaseDelay with # the SMuRF 500 MHz band number e.g. init:band_0:refPhaseDelay for band 0.

Warning

Because refPhaseDelay and refPhaseDelayFine include the digital delay, it will vary for different firmware versions.

Examples

For firmware where refPhaseDelay is measured in 2.4 MHz ticks, if refPhaseDelay is 6 that corresponds to a time delay of 6/(2.4 MHz) = 2.5 microseconds. For example, a 2 microsecond delay for a 100 kHz phi0 rate corresponds to an ~1 rad phase shift – so it’s particularly important to set refPhaseDelay correctly if running at high phi0 rates (10 kHz or higher).

Returns

Coarse (analog + digital) round-trip delay. Unit-less unsigned integer. Each step is a clock tick whose rate is given by get_channel_frequency_mhz() in MHz. Different carrier firmware versions support different ranges.

Return type

int

See also

estimate_phase_delay()

Measures ref_phase_delay and ref_phase_delay_fine.

ref_phase_delay_fine()

Fine adjustment for system roundtrip delay.

lms_delay()

System roundtrip delay including the tracking algorithm.

property ref_phase_delay_fine

DEPRECATED

Fine adjust for (analog + digital) round-trip delay.

Gets or sets fine adjustment for the total (analog + digital) round-trip delay. This allows for fine adjustment of the total effective system round-trip delay on top of the coarser correction provided by programming the refPhaseDelay register (see ref_phase_delay() and set_ref_phase_delay() for more details).

Unit-less unsigned integer. Each step is a 307.2 MHz tick (3.255 ns), for all firmware versions. Different carrier firmware versions support different ranges.

This register is named refPhaseDelayFine in firmware and is implemented differently than refPhaseDelay : setting refPhaseDelayFine only adds a time lag to the RF DAC output. refPhaseDelayFine can be measured using the estimate_phase_delay() routine.

Specified in the pysmurf configuration file as init:band_#:refPhaseDelayFine with # the SMuRF 500 MHz band number e.g. init:band_0:refPhaseDelayFine for band 0.

Warning

Because refPhaseDelay and refPhaseDelayFine include the digital delay, it will vary for different firmware versions.

Examples

Say the total delay measured using estimate_phase_delay() is 2.3 microseconds. To program this delay, you’d first set refPhaseDelay to 6, which is 2.5 microseconds (assuming that refPhaseDelay is measured in 2.4 MHz ticks, and so 6/(2.4 MHz) = 2.5 microseconds). Because refPhaseDelayFine adds time lag to the RF DAC output, it subtracts from the total delay (so it compensates in the opposite direction that refPhaseDelay does). So setting refPhaseDelayFine to 61 would result in a programmed delay of:

refPhaseDelay/(2.4 MHz) - refPhaseDelayFine/(307.2 MHz)
= 6/(2.4 MHz) - 61/(307.2 MHz)
= 2.30143 microseconds

which is as close to 2.3 microseconds as we can program the delay, given the clock rates.

Returns

Fine adjustment for (analog + digital) round-trip delay. Unit-less unsigned integer. Each step is a 307.2 MHz tick. Different carrier firmware versions support different ranges.

Return type

int

See also

estimate_phase_delay()

Measures ref_phase_delay and ref_phase_delay_fine.

ref_phase_delay()

Coarse system roundtrip delay.

lms_delay()

System roundtrip delay including the tracking algorithm.

property reset_rate_khz

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as tune_band:reset_rate_khz.

See also

?

property smurf_cmd_dir

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as smurf_to_mce:smurf_cmd_dir.

See also

?

property status_dir

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as smurf_to_mce:status_dir.

See also

?

property timing_reference

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as smurf_to_mce:timing_reference.

See also

?

property trigger_reset_delay

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as trigger_reset_delay.

See also

?

property tune_dir

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as smurf_to_mce:tune_dir.

See also

?

property ultrascale_temperature_limit_degC

Short description.

Gets or sets ?. Units are ?.

Specified in the pysmurf configuration file as smurf_to_mce:ultrascale_temperature_limit_degC.

See also

?