slitflow.tbl.convert module
- class SortCols(info_path=None)[source]
Bases:
TableChange column depths and sort values.
If you want to change from [“img_no”, “trj_no”, “frm_no”] to [“frm_no”, “img_no”, “trj_no”], set new_depths = [2,3,1].
- Parameters:
- Returns:
Sorted Table
- Return type:
- static process(reqs, param)[source]
Sort values of the table by column names.
- Parameters:
reqs[0] (pandas.DataFrame) – Table for sorting.
- Returns:
Sorted table
- Return type:
- class AddColumn(info_path=None)[source]
Bases:
TableAdd new columns with explicit values to a table.
Caution
Do not split the input table. TODO: col_values should have the same length as the input table.
- Parameters:
reqs[0] (Table) – The input table to add columns to.
param["col_info"] (list) – Information about the new column. The list should contain [depth, name, type, unit, description] or list of it.
param["col_values"] (list) – The values of the new column. The length of the list should be equal to the length of the “col_info” list.
param["split_depth"] (int) – The file split depth number.
- Returns:
The table with the new column.
- Return type:
- static process(reqs, param)[source]
Add new columns with explicit values to a table.
- Parameters:
reqs[0] (pandas.DataFrame) – The input table to add columns to.
param["col_name"] (str) – The names of the columns to add.
param["col_values"] (list) – The values of the new column. The length of the list should be equal to the length of the “col_name” list.
- Returns:
The table with the new column.
- Return type:
- class Obs2Depth(info_path=None)[source]
Bases:
TableMerge tables from different observations into a top level depth.
Caution
This class only works when used in a Pipeline object. Running process method or creating a Data object does not work appropriately.
Observation names for merging should be listed into obs_name argument of
add()in Pipeline class.- Parameters:
param["col_name"] (str, optional) – New column name for observation numbers. Defaults to “obs_no”.
param["col_description"] (str, optional) – New column description. Defaults to “Observation number”.
param["obs_name"] (str) – New observation name.
param["split_depth"] (int) – File split depth number.
- Returns:
Merged Table
- Return type:
- static process(reqs, param)[source]
Merge different Observations into the top level depth.
- Parameters:
reqs (list of pandas.DataFrame) – Tables from different observations.
param["col_name"] (str, optional) – New column name for observation numbers.
- Returns:
Merged table
- Return type: