calibration_config
This module contains all derived classes required to represent Ph2ACF xml and txt config files.
Generally xml config nodes are represented by subclasses of XmlConfigObject, and the text config is handled by RD53TextConfig, RD53TextConfigRegister and RD53TextConfigHeader, the first of which inherits from ConfigObjectBase.
For the base classes and OneOrMany pattern, see the calibration_config_base module.
Classes
|
Represents <BeBoard> xml config node. |
|
Represents <Detector> xml config node. |
|
Represents <Hybrid> xml config node. |
|
Represents <Monitoring> xml config node. |
|
Represents <MonitoringElement> xml config node. |
|
Represents <MonitoringSettings> xml config node. |
|
<MonitoringSleepTime> node; copies behaviour from SettingConfig. |
|
Represents <OpticalGroup> xml config node. |
|
Represents <RD53A> xml config node. |
|
Parser (encoder/decoder) and representative object for RD53 txt config file. |
|
Represents <RD53B> xml config node. |
|
Parser (encoder/decoder) and representative object for RD53 txt config file. |
|
Header row for RD53 txt config file. |
|
Representative object for text file register line. |
|
Represents <Register> xml config node. |
|
Represents <Setting> xml config node. |
|
Represents <Settings> xml config node. |
|
Represents <lpGBT> xml config node. |
BeBoardConfig
- class module_testing.config.calibration_config.BeBoardConfig(xml_root, id, parent)
Bases:
XmlConfigObject
Represents <BeBoard> xml config node.
<OpticalGroup> nodes are dynamically generated as a one-or-many selector under self.OpticalGroup(…).
<Register> nodes are dynamically generated as a one-or-many selector under self.Register(…).
This node type contains the connection property as self.connection.
- __init__(xml_root, id, parent)
- Parameters:
xml_tree – lxml etree node for this BeBoard.
id – BeBoard ID number.
parent – parent Detector object.
- property Detector
- Returns:
parent Detector config node.
DetectorConfig
- class module_testing.config.calibration_config.DetectorConfig(xml_tree, id=None, parent=None)
Bases:
XmlConfigObject
Represents <Detector> xml config node.
<BeBoard> nodes are dynamically generated as a one-or-many selector under self.BeBoard(…).
- __init__(xml_tree, id=None, parent=None)
- Parameters:
xml_tree – lxml etree node for this detector.
id – detector ID number.
parent – parent config object.
- DIFF_START = 264
Differential FE start column
- LIN_START = 128
Linear FE start column
- property MonitoringSettings
- Returns:
<MonitoringSettings> node.
- RD53A_COLS = 400
Number of columns in pixel matrix
- RD53A_ROWS = 192
Number of rows in pixel matrix
- RD53B_COLS = 432
Number of columns in pixel matrix
- RD53B_ROWS = 336
Number of rows in pixel matrix
- SYNC_START = 0
Synchronous FE start column
- property Settings
- Returns:
<Settings> node.
- disable_all()
Disables all frontends, selects no columns (0 to 0).
- disable_differential()
Disables DIFF frontend on all hybrids.
- disable_linear()
Disables LIN frontend on all hybrids.
- disable_synchronous()
Disables SYNC frontend on all hybrids.
- enable_differential()
Enables DIFF frontend on all hybrids and selects correct columns.
- enable_linear()
Enables LIN frontend on all hybrids and selects correct columns.
- enable_synchronous()
Enables SYNC frontend on all hybrids and selects correct columns.
- set_col_range(start, stop)
Sets COLstart and COLstop settings in <Settings>.
- Parameters:
start – start col.
stop – stop col.
- set_row_range(start, stop)
Sets ROWstart and ROWstop settings in <Settings>.
- Parameters:
start – start row.
stop – stop row.
HybridConfig
- class module_testing.config.calibration_config.HybridConfig(xml_root, id, parent)
Bases:
XmlConfigObject
Represents <Hybrid> xml config node.
<RD53> nodes are dynamically generated as a one-or-many selector under self.RD53(…).
This node type contains the RD53_Files property as self.RD53_Files.
This node type contains the Global property as self.Global.
- __init__(xml_root, id, parent)
- Parameters:
xml_tree – lxml etree node for this Hybrid.
id – Hybrid ID number.
parent – parent OpticalGroup object.
num_RD53B – counter for number of RD53B chips in this hybrid
num_RD53A – counter for number of RD53A chips in this hybrid
- property BeBoard
- Returns:
parent BeBoard config node.
- property Detector
- Returns:
parent Detector config node.
- property OpticalGroup
- Returns:
parent OpticalGroup config node.
- disable_all()
Disable all frontends for this Hybrid.
- disable_differential()
Disable DIFF frontend for this Hybrid.
- disable_linear()
Disable LIN frontend for this Hybrid.
- disable_synchronous()
Disable SYNC frontend for this Hybrid.
- enable_differential()
Enable DIFF frontend for this Hybrid.
- enable_linear()
Enable LIN frontend for this Hybrid.
- enable_synchronous()
Enable SYNC frontend for this Hybrid.
MonitoringConfig
- class module_testing.config.calibration_config.MonitoringConfig(xml_root, id=None, parent=None)
Bases:
XmlConfigObject
Represents <Monitoring> xml config node.
- __init__(xml_root, id=None, parent=None)
- Parameters:
xml_tree – lxml etree node for this RD53 Settings object.
id – unused.
parent – parent RD53 object.
- property MonitoringSleepTime
- Returns:
child <MonitoringSleepTime> node.
MonitoringElementConfig
- class module_testing.config.calibration_config.MonitoringElementConfig(xml_root, id=None, parent=None)
Bases:
XmlConfigObject
Represents <MonitoringElement> xml config node.
- __init__(xml_root, id=None, parent=None)
- Parameters:
xml_tree – lxml etree node for this RD53 setting/register.
id – setting/register name.
parent – parent Hybrid object.
- get()
Get value of this setting (as string).
- Returns:
value of setting (str).
- set(value)
Set value of this setting to value (as string).
- Parameters:
value – new value for setting (str).
MonitoringSettingsConfig
- class module_testing.config.calibration_config.MonitoringSettingsConfig(xml_root, id=None, parent=None)
Bases:
XmlConfigObject
Represents <MonitoringSettings> xml config node.
- __init__(xml_root, id=None, parent=None)
- Parameters:
xml_tree – lxml etree node for this RD53 Settings object.
id – unused.
parent – parent RD53 object.
- property Monitoring
- Returns:
child <Monitoring> node.
MonitoringSleepTime
- class module_testing.config.calibration_config.MonitoringSleepTime(xml_root, id=None, parent=None)
Bases:
SettingConfig
<MonitoringSleepTime> node; copies behaviour from SettingConfig.
- __init__(xml_root, id=None, parent=None)
- Parameters:
xml_tree – lxml etree node for this RD53 Settings object.
id – unused.
parent – parent RD53 object.
OpticalGroupConfig
- class module_testing.config.calibration_config.OpticalGroupConfig(xml_root, id, parent)
Bases:
XmlConfigObject
Represents <OpticalGroup> xml config node.
<lpGBT> nodes are dynamically generated as a one-or-many selector under self.lpGBT(…).
<Hybrid> nodes are dynamically generated as a one-or-many selector under self.Hybrid(…).
This node type contains the lpGBT_Files property as self.lpGBT_Files.
- __init__(xml_root, id, parent)
- Parameters:
xml_tree – lxml etree node for this OpticalGroup.
id – OpticalGroup ID number.
parent – parent BeBoard object.
- property BeBoard
- Returns:
parent BeBoard config node.
- property Detector
- Returns:
parent Detector config node.
RD53AConfig
- class module_testing.config.calibration_config.RD53AConfig(xml_root, id, parent, path)
Bases:
XmlConfigObject
Represents <RD53A> xml config node.
This node type contains the Settings property as self.Settings.
- __init__(xml_root, id, parent, path)
- Parameters:
xml_tree – lxml etree node for this RD53.
id – RD53 ID number.
parent – parent Hybrid object.
- property BeBoard
- Returns:
parent BeBoard config node.
- property Detector
- Returns:
parent Detector config node.
- property Hybrid
- Returns:
parent Hybrid config node.
- property OpticalGroup
- Returns:
parent OpticalGroup config node.
- patch_all_from_text()
Copy values of all registers from txt config to xml override.
- patch_all_from_xml()
Copy values of all registers from xml override to txt config.
- patch_from_text(field)
Copy value of register from txt config to xml override.
- Parameters:
field – name of register to copy value.
- Returns:
patched value.
- patch_from_text_to(fieldIn, fieldOut)
Copy value of register from txt config fieldIn to xml override fieldOut.
- Parameters:
fieldIn – name of register to copy value.
fieldOut – name of register to copy calue to.
- Returns:
patched value.
- patch_from_xml(field)
Copy value of register from xml override to txt config.
- Parameters:
field – name of register to copy value.
- Returns:
patched value.
- property text_file
- Returns:
path to txt config file for this ROC (read-only).
RD53ATextConfig
- class module_testing.config.calibration_config.RD53ATextConfig(fp, id, parent)
Bases:
ConfigObjectBase
Parser (encoder/decoder) and representative object for RD53 txt config file.
get()/set() can be used to access both registers (as RD53TextConfigRegister objects) and masks (as Numpy matrices).
- __init__(fp, id, parent)
- Parameters:
fp – open file handle for text config file.
id – RD53 chip/ROC id.
parent – parent RD53 config object.
- COLNUM_PADSIZE = 3
Column number zero-padded field size.
- COLS = 400
Number of cols in pixel matrix
- COL_DELIMITER = 'COL'
Column delimiter.
- COL_END_DELIMITER = '\n'
Column line end delimeter.
- COL_PADSIZE = 21
Column whitespace padded field size.
- DATA_DELIMITER = ','
Data delimiter/separator.
- DATA_END_DELIMITER = '\n'
End of data delimiter.
- classmethod DEFAULT_ENABLE()
- Returns:
default values for ENABLE mask (all ones).
- classmethod DEFAULT_HITBUS()
- Returns:
default values for HITBUS mask (LIN FE only ones; others zeroes).
- classmethod DEFAULT_INJEN()
- Returns:
default values for INJEN mask (all zeroes).
- classmethod DEFAULT_TDAC()
- Returns:
default values for TDAC mask (7 for LIN, SYNC; 15 for DIFF).
- DIFF_START = 264
Differential FE start column
- classmethod FEM_DIFF_ENABLE()
- Returns:
FRONTEND EVALUATION MODE mask for differential frontend.
- classmethod FPM_DIFF_ENABLE()
- Returns:
FULL PIXEL MATRIX mode mask for differential frontend.
- LIN_START = 128
Linear FE start column
- MASKS = ('ENABLE', 'HITBUS', 'INJEN', 'TDAC')
Tuple of all mask types
- classmethod MASK_EFFICIENCY()
- Returns:
default mask EFFICIENCY (ask Vasilije Perovic what this is meant to be…).
- classmethod MASK_EFFICIENCY_SMALL()
- Returns:
default mask EFFICIENCY_SMALL (ask Vasilije Perovic what this is meant to be…).
- MASK_NAME_PADSIZE = 7
Mask name whitespace padded field size.
- MASK_START = 'PIXELCONFIGURATION'
Line marking start of pixel masks.
- ROWS = 192
Number of rows in pixel matrix
- SYNC_START = 0
Synchronous FE start column
- classmethod UNIFORM_TDAC_LIN(setting)
- Parameters:
setting – TDAC value to set in LIN frontend.
- Returns:
TDAC mask with value setting in LIN frontend and default elsewhere.
- property dirty
Whether interal object state matches text config file.
If True, need to call _encode() to update self._data string representation of internal state.
- Returns:
bool.
- get(name)
Alias for getattr(self, name).
- Returns:
RD53TextConfigRegister for register, Numpy matrix for mask.
- keys()
- Returns:
iterator/generator of all registers in this text config.
- classmethod operator_mask_and(mask_a, mask_b)
Operator function to AND two binary masks.
- Parameters:
mask_a – input mask A.
mask_b – input mask B.
- Returns:
resulting mask after operation.
- classmethod operator_mask_not(mask_a)
Operator function to invert binary mask.
- Parameters:
mask – input mask.
- Returns:
resulting mask after operation.
- classmethod operator_mask_or(mask_a, mask_b)
Operator function to OR two binary masks
- Parameters:
mask_a – input mask A.
mask_b – input mask B.
- Returns:
resulting mask after operation.
- classmethod operator_mask_xor(mask_a, mask_b)
Operator function to XOR two binary masks
- Parameters:
mask_a – input mask A.
mask_b – input mask B.
- Returns:
resulting mask after operation.
- classmethod operator_shift_lin(mask, rows, columns)
Operator function to shift mask linearly by rows, columns.
- Parameters:
mask – input mask.
rows – number of rows to shift by (int).
cols – number of columns to shift by (int).
- Returns:
resulting mask after operation.
- set(name, value)
Universal value setter for both registers and masks.
Sets register value if accessed attribute is register, overwrites mask if accessed attribute is a mask.
- Parameters:
name – name of register/mask to set value for.
value – value to set (int for register, numpy matrix for mask).
- write(fp)
Write current internal state to file.
Calls _encode(), then writes resulting string to fp.
- Parameters:
fp – open writetable file handle to save to.
- Returns:
result of fp.write(…) call.
RD53BConfig
- class module_testing.config.calibration_config.RD53BConfig(xml_root, id, parent, path)
Bases:
XmlConfigObject
Represents <RD53B> xml config node.
This node type contains the Settings property as self.Settings.
- __init__(xml_root, id, parent, path)
- Parameters:
xml_tree – lxml etree node for this RD53.
id – RD53 ID number.
parent – parent Hybrid object.
- property BeBoard
- Returns:
parent BeBoard config node.
- property Detector
- Returns:
parent Detector config node.
- property Hybrid
- Returns:
parent Hybrid config node.
- property OpticalGroup
- Returns:
parent OpticalGroup config node.
- patch_all_from_text()
Copy values of all registers from txt config to xml override.
- patch_all_from_xml()
Copy values of all registers from xml override to txt config.
- patch_from_text(field)
Copy value of register from txt config to xml override.
- Parameters:
field – name of register to copy value.
- Returns:
patched value.
- patch_from_text_to(fieldIn, fieldOut)
Copy value of register from txt config fieldIn to xml override fieldOut.
- Parameters:
fieldIn – name of register to copy value.
fieldOut – name of register to copy value to.
- Returns:
patched value.
- patch_from_xml(field)
Copy value of register from xml override to txt config.
- Parameters:
field – name of register to copy value.
- Returns:
patched value.
- property text_file
- Returns:
path to txt config file for this ROC (read-only).
- property text_file_object
- Returns:
path to txt config file for this ROC (read-only).
RD53BTextConfig
- class module_testing.config.calibration_config.RD53BTextConfig(fp, id, parent)
Bases:
ConfigObjectBase
Parser (encoder/decoder) and representative object for RD53 txt config file.
get()/set() can be used to access both registers (as RD53TextConfigRegister objects) and masks (as Numpy matrices).
- __init__(fp, id, parent)
- Parameters:
fp – open file handle for text config file.
id – RD53 chip/ROC id.
parent – parent RD53 config object.
- COLNUM_PADSIZE = 3
Column number zero-padded field size.
- COLS = 432
Number of cols in pixel matrix
- COL_DELIMITER = 'COL'
Column delimiter.
- COL_END_DELIMITER = '\n'
Column line end delimeter.
- COL_PADSIZE = 21
Column whitespace padded field size.
- DATA_DELIMITER = ','
Data delimiter/separator.
- DATA_END_DELIMITER = '\n'
End of data delimiter.
- classmethod DEFAULT_ENABLE()
- Returns:
default values for ENABLE mask (all ones).
- classmethod DEFAULT_HITBUS()
- Returns:
default values for HITBUS mask (all ones).
- classmethod DEFAULT_INJEN()
- Returns:
default values for INJEN mask (all zeroes).
- classmethod DEFAULT_TDAC()
- Returns:
default values for TDAC mask (15 all).
- MASKS = ('ENABLE', 'HITBUS', 'INJEN', 'TDAC')
Tuple of all mask types
- MASK_NAME_PADSIZE = 7
Mask name whitespace padded field size.
- MASK_START = 'PIXELCONFIGURATION'
Line marking start of pixel masks.
- ROWS = 336
Number of rows in pixel matrix
- property dirty
Whether interal object state matches text config file.
If True, need to call _encode() to update self._data string representation of internal state.
- Returns:
bool.
- get(name)
Alias for getattr(self, name).
- Returns:
RD53TextConfigRegister for register, Numpy matrix for mask.
- keys()
- Returns:
iterator/generator of all registers in this text config.
- classmethod operator_mask_and(mask_a, mask_b)
Operator function to AND two binary masks.
- Parameters:
mask_a – input mask A.
mask_b – input mask B.
- Returns:
resulting mask after operation.
- classmethod operator_mask_not(mask_a)
Operator function to invert binary mask.
- Parameters:
mask – input mask.
- Returns:
resulting mask after operation.
- classmethod operator_mask_or(mask_a, mask_b)
Operator function to OR two binary masks
- Parameters:
mask_a – input mask A.
mask_b – input mask B.
- Returns:
resulting mask after operation.
- classmethod operator_mask_xor(mask_a, mask_b)
Operator function to XOR two binary masks
- Parameters:
mask_a – input mask A.
mask_b – input mask B.
- Returns:
resulting mask after operation.
- set(name, value)
Universal value setter for both registers and masks.
Sets register value if accessed attribute is register, overwrites mask if accessed attribute is a mask.
- Parameters:
name – name of register/mask to set value for.
value – value to set (int for register, numpy matrix for mask).
- write(fp)
Write current internal state to file.
Calls _encode(), then writes resulting string to fp.
- Parameters:
fp – open writetable file handle to save to.
- Returns:
result of fp.write(…) call.
RD53TextConfigHeader
RD53TextConfigRegister
- class module_testing.config.calibration_config.RD53TextConfigRegister(name, address, default_value, value, bitsize)
Bases:
object
Representative object for text file register line.
- __init__(name, address, default_value, value, bitsize)
- Parameters:
name – register name (str).
address – register address (str).
default_value – register default value (str).
value – register value (str).
bitsize – register bitsize (str).
- ADDR_PADSIZE = 14
Whitespace padded field size for register addresses.
- BASE_CONVERTER = {'b': 2, 'd': 10, 'o': 8, 'x': 16}
Conversion from symbol to number for register value bases.
- BITSIZE_PADSIZE = 2
Whitespace padded field size for register bitsize fields.
- DEFVAL_PADSIZE = 24
Whitespace padded field size for register default value fields.
- NAME_PADSIZE = 26
Whitespace padded field size for register names.
- VAL_PADSIZE = 35
Whitespace padded field size for register val fields.
- property address
- Returns:
register address (as int; readonly).
- property bitsize
- Returns:
register bitsize (as str; readonly).
- property default_value
- Returns:
register default value (as int; readonly).
- classmethod from_string(string)
Create RD53TextConfigRegister from txt config line.
- Str:
txt config line describing a register.
- property name
- Returns:
register name (readonly).
- str()
Get txt config register line.
- Returns:
correctly formatted register line for txt config file.
- property value
Getter/setter dynamically convert to/from int.
- Returns:
register default value (as int).
- Parameters:
value – register value to set (int).
RegisterConfig
- class module_testing.config.calibration_config.RegisterConfig(xml_root, id=None, parent=None)
Bases:
XmlConfigObject
Represents <Register> xml config node.
Child <Register> nodes are dynamically generated as a one-or-many selector under self.Register(…).
Attributes may be accessed as self.<attr>.
- __init__(xml_root, id=None, parent=None)
- Parameters:
xml_root – lxml etree node.
id – id of xml object (e.g. chip id for chips, or register name for registers).
parent – parent config node.
SettingConfig
- class module_testing.config.calibration_config.SettingConfig(xml_root, id=None, parent=None)
Bases:
XmlConfigObject
Represents <Setting> xml config node.
These usually correspond to registers on the RD53 ROC, and use get/set to access values (as strings).
- __init__(xml_root, id=None, parent=None)
- Parameters:
xml_tree – lxml etree node for this RD53 setting/register.
id – setting/register name.
parent – parent Hybrid object.
- get()
Get value of this setting (as string).
- Returns:
value of setting (str).
- set(value)
Set value of this setting to value (as string).
- Parameters:
value – new value for setting (str).
SettingsConfig
- class module_testing.config.calibration_config.SettingsConfig(xml_root, id=None, parent=None)
Bases:
XmlConfigObject
Represents <Settings> xml config node.
<Setting> nodes are dynamically generated as a one-or-many selector under self.Setting(…), addressed by setting name (not ID number).
- __init__(xml_root, id=None, parent=None)
- Parameters:
xml_tree – lxml etree node for this RD53 Settings object.
id – unused.
parent – parent RD53 object.
lpGBTConfig
- class module_testing.config.calibration_config.lpGBTConfig(xml_root, id=None, parent=None)
Bases:
XmlConfigObject
Represents <lpGBT> xml config node.
- __init__(xml_root, id=None, parent=None)
- Parameters:
xml_root – lxml etree node.
id – id of xml object (e.g. chip id for chips, or register name for registers).
parent – parent config node.
- property BeBoard
- Returns:
parent BeBoard config node.
- property Detector
- Returns:
parent Detector config node.
- property OpticalGroup
- Returns:
parent OpticalGroup config node.