slitflow.tbl.proc module

This process module includes classes that change table structure such as rows and columns.

class MaskFromParam(info_path=None)[source]

Bases: Table

Create a mask column based on explicit param values.

Parameters:
  • reqs[0] (Table) – The image to select from.

  • param["index"] (list of tuple) – A list of tuples that contains the indices to select. The tuple should be (index of depth=1, index of depth=2, …). If index is None, all indices of the depth are selected.

  • param["mask_col"] (str, optional) – The name of the mask column. Defaults to “mask”.

  • param["split_depth"] (int) – The file split depth number.

Returns:

A table containing the mask column.

Return type:

Table

set_info(param={})[source]

Copy info from reqs[0] and add param.

static process(reqs, param)[source]

Create a mask column based on explicit param values.

If the element of the tuple is one, a comma must be added.

Parameters:
  • reqs[0] (Table) – The image to select from.

  • param["index"] (list of tuple) – A list of tuples that contains the indices to select. The tuple should be (index of depth=1, index of depth=2, …). If index is None, all indices of the depth are selected.

  • param["index_cols"] (list of str) – The index column names.

  • param["mask_col"] (str, optional) – The name of the mask column. Defaults to “mask”.

Returns:

A table containing the mask column.

Return type:

pandas.DataFrame

class SelectParam(info_path=None)[source]

Bases: MaskFromParam

Select rows using explicit param values.

This class creates a mask column based on explicit param values using slitflow.tbl.filter.MaskFromParam and selects rows using the mask column.

Parameters:
  • reqs[0] (Table) – Table for selection.

  • param["index"] (list of tuple) – List of tuples of index numbers to select. Each tuple should be (index of depth=1, index of depth=2, …). If index is None, all indices of the depth is selected.

  • param["mask_col"] (str, optional) – Column name of the mask column. Defaults to “mask”.

  • param["split_depth"] (int) – File split depth number.

Returns:

Selected Table.

Return type:

Table

set_info(param={})[source]

Copy info from reqs[0] and add param.

static process(reqs, param)[source]

Select rows using explicit param values.

Parameters:
  • reqs[0] (pandas.DataFrame) – Table for selection.

  • param["index"] (list of tuple) – List of tuple of index numbers to select. The tuple should be (index of depth=1, index of depth=2, …). If index is None, all indices of the depth is selected.

  • param["mask_col"] (str, optional) – Column name of the mask column. Defaults to “mask”.

  • param["index_cols"] (list of str) – The index column names.

Returns:

Selected Table.

Return type:

Table

post_run()[source]

Remove empty data

set_index()[source]

Set the index based on the saved temporal index.

File numbers of the _temp_index are added before selecting the index not to skip the numbers that is not selected during saving.