slitflow.manager module
- class Pipeline(root_dir)[source]
Bases:
objectManage the sequential running of the Data class and file IO.
- df
Pipeline table consisting of a series of data classes.
- Type:
- save(sheet_name)[source]
Export the pipeline table as a CSV file.
The CSV file is saved in the g0_config folder.
- Parameters:
sheet_name (str) – Pipeline CSV file name without extension.
- load(sheet_names)[source]
Import pipeline table from the CSV file.
The CSV file is loaded from the g0_config folder.
- add(class_name, run_mode, address, grp_name, ana_name, obs_names, reqs_address, reqs_split, param)[source]
Add a task to the pipeline table.
- Parameters:
class_name (str) – Class name string.
run_mode (int) – Run mode (0=single data, single CPU; 1=single data , multi CPU; 2=multi data, multi CPU; 3=multi data, multi CPU).
address (tuple) – (group no, analysis no) to save the task.
grp_name (str) – Group name.
ana_name (str) – Analysis name.
obs_names (list of str) – List of observation names that are used for data file names.
reqs_address (list of tuple) – List of (group no, analysis no) of required data files.
reqs_split (list of int or list of list of int) – List of split depth of each required data. Each element should be [load_split, data_split]. If load_split and data_split are the same, it can be specified as [split]. That is, it is specified in the format [[load_split1, data_split1], [load_split2, data_split2], …] or [load_and_data_split1, load_and_data_split2,…].
param (dict) – Parameter dictionary.
- set_grp_name(address, grp_name)[source]
Check input group name.
Additional restrictions will be written here.
- set_ana_name(ana_name)[source]
Check input analysis name.
Additional restrictions will be written here.
- set_reqs_split(reqs_split, reqs_address)[source]
Check and convert split depth to resplit required data.
- Parameters:
- Returns:
List of
split_depthof required data- Return type:
- load_obs_names(obs_names, reqs_address)[source]
Get observation names from saved files if obs_names is empty list.
- convert_indices(indices=None)[source]
Standardize the indices argument of run method.
- Parameters:
indices (None or int or tuple or list) –
Task row indices to
None : run all rows.
int : run a row of selected directly.
list : run rows of selected directly.
tuple : run rows of selected by (start, end, step(optional)). tuple[1]==0 make select to the last row.
- Returns:
Task row indices to run
- Return type:
pandas.Int64Index
Examples
When index of self.df is reset:
>>> self.convert_indices() self.df.index >>> self.convert_indices(-1) pd.Index([self.df.index[-1]]) >>> self.convert_indices([1, -1]) pd.Index([self.df.index[1], self.df.index[-1]]) >>> self.convert_indices(range(3)) self.df.index[:3] >>> self.convert_indices((1, -1)) self.df.index[1:-1] >>> self.convert_indices((1, 0, 2)) self.df.index[1::2]
- run_one_data(class_name, reqs_split, reqs_address, obs_name, param, grp_name, ana_name, run_mode, address)[source]
Execute a task that is not split into multiple files.
- Parameters:
reqs_split (list) – List of split depth of each required data.
reqs_address (list of tuple) – List of required data address.
param (dict) – Parameter dictionary.
grp_name (str) – Group name.
ana_name (str) – Analysis name.
run_mode (int) – Run mode number. This should be 0 or 1.
address (tuple) – (group_no, analysis_no) of the result data.
- run_one_data_multi_obs(class_name, reqs_split, reqs_address, obs_names, param, grp_name, ana_name, run_mode, address)[source]
Execute a task that is not split into multiple files.
The first element of obs_names is used to the result file name.
- Parameters:
reqs_split (list) – List of split depth of each required data.
reqs_address (list of tuple) – List of required data address.
param (dict) – Parameter dictionary.
grp_name (str) – Group name.
ana_name (str) – Analysis name.
run_mode (int) – Run mode number. This should be 0 or 1.
address (tuple) – (group_no, analysis_no) of the result data.
- run_multi_data(class_name, reqs_split, reqs_address, obs_name, param, grp_name, ana_name, run_mode, address)[source]
Execute a task that is split into multiple files.
- Parameters:
reqs_split (list) – List of split depth of each required data.
reqs_address (list of tuple) – List of required data address.
param (dict) – Parameter dictionary.
grp_name (str) – Group name.
ana_name (str) – Analysis name.
run_mode (int) – Run mode number. This should be 0 or 1.
address (tuple) – (group_no, analysis_no) of the result data.
- run_Obs2Depth(class_name, reqs_split, reqs_address, obs_names, param, grp_name, ana_name, run_mode, address)[source]
Merge different observations into one observation with depth.
Caution
Currently only run_mode=0 is supported.
- Parameters:
reqs_split (list) – List of split depth of each required data.
reqs_address (list of tuple) – List of required data address.
param (dict) – Parameter dictionary.
grp_name (str) – Group name.
ana_name (str) – Analysis name.
run_mode (int) – Run mode number. This should be 0 or 1.
address (tuple) – (group_no, analysis_no) of the result data.
param – Parameter dictionary. This should have the below item.
param["obs_name"] (str) – Newly created observation name.
- run_delete(reqs_address, obs_names, param)[source]
Delete selected data.
- Parameters:
reqs_address (list of tuple) – List of (group name, analysis name) to delete.
param (dict, optional) – Parameter dictionary. param would have the below item.
param["keep"] (str, optional) –
Defines delete type.
info: Not delete information files.folder: Delete the information files but not the folder itself.
- run_copy(address, ana_name, grp_name, reqs_address, obs_names, param)[source]
Copy data from a different analysis.
- Parameters:
address (tuple) – (group_no, analysis_no) of copy destination.
ana_name (str) – Analysis name of copy destination.
grp_name (str) – Group name of copy destination.
reqs_address (list of tuple) – List containing only one data address of copy source.
obs_names (list of str) – List containing only one observation name of copy destination.
param (dict) – Parameter dictionary. This should have the below item.
param["obs_name"] (str, optional) – Observation name of copy source.
- run_index(class_name, reqs_address, obs_names, param, grp_name, ana_name, address)[source]
A specific run method for tbl.convert.Index class.
slitflow.tbl.convert.Indexclass is a class that create a index table from required Data object. The class loads only the index file of the required data. Therefore, the class does not need to load the required data.
- make_flowchart(fig_name, label_type, is_vertical=False, scale=(0.5, 1), format='png', dpi=300)[source]
Create workflow graph into the g0_config directory.
- Parameters:
fig_name (str) – Name of the flowchart file.
label_type (str) –
Description type. This should be
”class_desc” : shows the one-line class description from class docstring.
”grp_ana” : shows “grp_name (newline) ana_name”.
is_vertical (bool) – Flowchart direction. Defaults to False (horizontal).
format (str) – File save format. Defaults to “png”.
dpi (int) – Dot per inch of exporting file.