qom.loopers.axes module¶
Module to handle axes loopers.
- class qom.loopers.axes.XLooper(func, params: dict, params_system: dict = {}, cb_update=None, parallel: bool = False, p_index: int = 0, p_start: float = None)¶
Bases:
BaseLooper
Class to interface a 1D looper.
- Parameters:
func (callable) – Function to loop, formatted as
func(system_params)
, wheresystem_params
is a dictionary of the updated parameters for the system for that iteration of the looper.params (dict) – Parameters of the looper containing the key
'X'
, each with the keys'var'
and'val'
(or'min'
,'max'
and'dim'
) for the name of the parameter to loop and its corresponding values (or minimum and maximum values along with dimension). Refer to Notes ofqom.loopers.base.BaseLooper
for all available options.params_system (dict, optional) – Parameters of the system. If not provided, new keys are created for the looper variables.
cb_update (callable, optional) – Callback function to update status and progress, formatted as
cb_update(status, progress, reset)
, wherestatus
is a string,progress
is a float andreset
is a boolean.parallel (bool, default=False) – Option to format outputs when running in parallel.
p_index (int, default=0) – Index of the process.
p_start (float, optional) – Time at which the process was started. If not provided, the value is initialized to current time.
- desc = '1D Looper'¶
Description of the looper.
- Type:
str
- loop()¶
Method to calculate the output of a given function for each X-axis point.
- Returns:
results – Axes and calculated values containing the keys
'X'
and'V'
.- Return type:
dict
- name = 'XLooper'¶
Name of the looper.
- Type:
str
- class qom.loopers.axes.XYLooper(func, params: dict, params_system: dict, cb_update=None, parallel: bool = False, p_index: int = 0, p_start: float = None)¶
Bases:
BaseLooper
Class to interface a 2D looper.
- Parameters:
func (callable) – Function to loop, formatted as
func(system_params)
, wheresystem_params
is a dictionary of the updated parameters for the system for that iteration of the looper.params (dict) – Parameters of the looper containing the key
'X'
and'Y'
, each with the keys'var'
and'val'
(or'min'
,'max'
and'dim'
) for the name of the parameter to loop and its corresponding values (or minimum and maximum values along with dimension). Refer to Notes ofqom.loopers.base.BaseLooper
for all available options.params_system (dict, optional) – Parameters of the system. If not provided, new keys are created for the looper variables.
cb_update (callable, optional) – Callback function to update status and progress, formatted as
cb_update(status, progress, reset)
, wherestatus
is a string,progress
is a float andreset
is a boolean.parallel (bool, default=False) – Option to format outputs when running in parallel.
p_index (int, default=0) – Index of the process.
p_start (float, optional) – Time at which the process was started. If not provided, the value is initialized to current time.
- desc = '2D Looper'¶
Description of the looper.
- Type:
str
- loop()¶
Method to calculate the output of a given function for each X-axis and Y-axis points.
- Returns:
results – Axes and calculated values containing the keys
'X'
,'Y'
and'V'
. If the value of the parameter'grad'
is set toTrue
and'grad_position'
is not'all'
, then the key'Y'
is not returned.- Return type:
dict
- name = 'XYLooper'¶
Name of the looper.
- Type:
str
- class qom.loopers.axes.XYZLooper(func, params: dict, params_system: dict, cb_update=None, parallel: bool = False, p_index: int = 0, p_start: float = None)¶
Bases:
BaseLooper
Class to interface a 3D looper.
- Parameters:
func (callable) – Function to loop, formatted as
func(system_params)
, wheresystem_params
is a dictionary of the updated parameters for the system for that iteration of the looper.params (dict) – Parameters of the looper containing the key
'X'
,'Y'
and'Z'
, each with the keys'var'
and'val'
(or'min'
,'max'
and'dim'
) for the name of the parameter to loop and its corresponding values (or minimum and maximum values along with dimension). Refer to Notes ofqom.loopers.base.BaseLooper
for all available options.params_system (dict, optional) – Parameters of the system. If not provided, new keys are created for the looper variables.
cb_update (callable, optional) – Callback function to update status and progress, formatted as
cb_update(status, progress, reset)
, wherestatus
is a string,progress
is a float andreset
is a boolean.parallel (bool, default=False) – Option to format outputs when running in parallel.
p_index (int, default=0) – Index of the process.
p_start (float, optional) – Time at which the process was started. If not provided, the value is initialized to current time.
- desc = '3D Looper'¶
Description of the looper.
- Type:
str
- loop()¶
Method to calculate the output of a given function for each X-axis, Y-axis and Z-axis points.
- Returns:
results – Axes and calculated values containing the keys
'X'
,'Y'
.'Z'
and'V'
. If the value of the parameter'grad'
is set toTrue
and'grad_position'
is not'all'
, then the key'Z'
is not returned.- Return type:
dict
- name = 'XYZLooper'¶
Name of the looper.
- Type:
str