nibcq.compensation.CompensationFile
- class nibcq.compensation.CompensationFile
Represents a compensation file.
- classmethod memory_to_file(compensation: Compensation, comment: str = '') CompensationFile
Converts the compensation data format to a stored one.
This converts the class used to store and calculate these between the one used in memory (AllCompensation), to the one what we use to save it to file (CompensationFile).
- Parameters:
compensation (Compensation)
comment (str)
- Return type:
- file_to_memory(method: nibcq.enums.CompensationMethod, file_path: str) Compensation
Converts this CompensationFile back to an in-memory AllCompensation.
- Parameters:
method (CompensationMethod) – The CompensationMethod to associate with the in-memory data.
file_path (str) – The source file path for this compensation content.
- Returns:
- An in-memory representation containing temperature and
a frequency to complex map of compensation values.
- Return type:
AllCompensation
- to_json() str
Convert to NI BCQ Toolkit Compensation File JSON schema.
- Returns:
JSON string in the correct format.
- Return type:
- classmethod from_json(data: str)
Creates a CompensationFile instance from a JSON string.
Supports the previously defined LabVIEW schema only, to enforce consistency.
- Parameters:
data (str)
- classmethod load_from_file(path: str) CompensationFile
Loads a compensation file from the specified path.
- Parameters:
path (str)
- Return type:
- save_to_file(path: str) None
Saves a compensation file to the specified path.
- Parameters:
path (str)
- Return type:
None
- static generate_file_path(compensation_method: nibcq.enums.CompensationMethod, serial_number: str) str
Generates the default file path for a compensation file.
- Parameters:
compensation_method (nibcq.enums.CompensationMethod) – The compensation method type (SHORT or GOLDEN_DUT only)
serial_number (str) – The device serial number
- Returns:
- The generated file path in format
”DEFAULT_COMPENSATION_DIR/z_{method}_SN{serial}_Ch0.json”
- Return type:
- Raises:
ValueError – If compensation_method is not SHORT or GOLDEN_DUT