slitflow.tbl.stat module

class Mean(info_path=None)[source]

Bases: Table

Averaged value of a specific column.

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

  • param["calc_col"] (str) – Column name for averaging.

  • param["index_cols"] (list of str, optional) – Column names to gather rows. If you set [“img_no”], average values are calculated for each image number.

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

Returns:

Summarized Table containing average, std, sem and count columns

Return type:

Table

Examples

Calculate the Ensemble-averaged MSD.

# D3 is from the trj.msd.Each example
D4 = sf.tbl.stat.Mean()
D4.run([D3],{"calc_col": "msd", "index_cols": ["interval"],
             "split_depth": 0})
print(D4.data[0])
#    interval       msd       std       sem  count       sum
# 0       0.0  0.000000  0.000000  0.000000      6  0.000000
# 1       0.1  0.034335  0.014093  0.005754      6  0.206012
# 2       0.2  0.065532  0.023673  0.009665      6  0.393195
# 3       0.3  0.116515  0.031346  0.012797      6  0.699089
# 4       0.4  0.138391  0.066066  0.026971      6  0.830347
# 5       0.5  0.153488  0.112978  0.046123      6  0.920926
set_info(param={})[source]

Copy info from req[0] and add columns and params.

static process(reqs, param)[source]

Averaged value of a specific column.

Parameters:
  • reqs[0] (pandas.DataFrame) – Target table for averaging.

  • param["calc_col"] (str) – Column name for averaging.

  • param["index_cols"] (list of str, optional) – Column names to gather rows. If you set [“img_no”], average values are calculated for each image number.

Returns:

Summarized table containing average, std, sem and count columns

Return type:

pandas.DataFrame

class Test(info_path=None)[source]

Bases: Table

Statistics test suite.

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

  • param["sample_col"] (str) – Sample column name.

  • param["replicate_col"] (str) – Replicate column name.

  • param["calc_col"] (str) – Column name to values for test.

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

Returns:

Test result Table

Return type:

Table

set_info(param={})[source]

Convert input information to Info object.

This method creates columns and parameters information. The columns information is used to handle data structure. The parameter dictionaries are set as param of process(). This method is called before run(). Implemented in subclass.

Parameters:

param (dict, optional) – Parameters for columns or params.

static process(reqs, param)[source]

Statistics test suite.

Parameters:
  • reqs[0] (pandas.DataFrame) – Sample table.

  • param["sample_col"] (str) – Sample column name.

  • param["replicate_col"] (str) – Replicate column name.

  • param["calc_col"] (str) – Column name to values for test.

Returns:

Test result table

Return type:

pandas.DataFrame

ftest(x1, x2)[source]