chain_core
Classes¤
ChainCore ¤
ChainCore(
working_dir="",
distribution_file="generator.in",
run_file="photo_track.in",
log_dir="log",
log_file_name="log.log",
console_log=False,
logger_name=None,
n_parallel=5,
chain_output_file="chain_output_file.xlsx",
)
Bases: Core
Parameters:
Name | Type | Description | Default |
---|---|---|---|
working_dir |
str | Path
|
Working dir in which to perform the scan. Defaults to "". |
''
|
distribution_file |
str | Path
|
Name of the distribution file. Defaults to "generator.in". |
'generator.in'
|
run_file |
str | Path
|
Name of the run file. Defaults to "photo_track.in". |
'photo_track.in'
|
log_dir |
str | Path
|
Path to the log directory. Defaults to "log". |
'log'
|
log_file_name |
str | Path
|
Name of the log file. Defaults to "log.log". |
'log.log'
|
console_log |
bool
|
Option if to log to console. Defaults to False. |
False
|
logger_name |
str | Path
|
Name of the logger. If set to None, new logger will be created. Defaults to None. |
None
|
n_parallel |
int
|
Number of parallel runs. Defaults to 5. |
5
|
chain_output_file |
str | Path
|
Name of the chain output file. Defaults to "chain_output_file.xlsx". |
'chain_output_file.xlsx'
|
Source code in common/chain_core.py
Functions¤
_check_correct_number_of_steps_in_layer ¤
Method to check if there is the same number of steps in all layers with the same layer index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer_idx |
int
|
index of the layers |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if all layers with the same layer index have the same number of steps, else False |
Source code in common/chain_core.py
add_layer ¤
Adds a layer into the chain scan. Layers are stored in the order they were provided or a layer index can be specified. When layer is not specified, new one will be created automatically.
There are multiple options how to define the range of the parameter to be scanned:
- Full values list (
values
) - Start and end values (
start
,end
) + step size (step
) - Start and end values (
start
,end
) + number of steps (n_steps
)
This list also corresponds to the order at which the definition of the parameter is checked. Once the parameter is fully defined (one of the points above is fulfilled), the rest of the values may be internally overwritten to match the calculated values from the full definition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter |
str
|
Name of the scanning parameter. |
required |
values |
list
|
Full list of values to be scanned. If specified, defines fully the parameter. Defaults to None. |
None
|
start |
float
|
Starting value of the scan. Will be taken into account only if |
None
|
end |
float
|
Final value of the scan. Will be taken into account only if |
None
|
step |
float | list
|
Step size to be performed. For constant step size, use |
None
|
n_steps |
int
|
Number of constant steps to be performed. Will be taken into account only if |
None
|
layer_idx |
int
|
Index of the layer: to be used when multiple parameters should be included in the given layer (provided that they have the same number of values to be scanned). Defaults to None -> automatically set. |
None
|
Source code in common/chain_core.py
get_same_index_layers ¤
Method to get all the layers in the layer_idx.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer_idx |
int
|
index of the layer |
required |
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
list of layers (layer is represented by a dictionary) |
Source code in common/chain_core.py
write_presets_to_output_file ¤
Method to write the preset values for each parallel scan to an output file for later use.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
presets |
list
|
List of dictionaries that define the values in each layer. |
required |
Source code in common/chain_core.py
Created: October 31, 2023