fitgrid.tools module

class fitgrid.tools.BLAS(cdll, kind)[source]

Bases: object

fitgrid.tools.deduplicate_list(lst)[source]
fitgrid.tools.design_matrix_is_constant(df, columns, time)[source]

Check that values in columns of df do not change within any epoch.

See Notes for more details.

Parameters
  • df (pandas.DataFrame) – dataframe to check

  • columns (list of str) – list of column names to be checked

  • time (str) – name of the time column

Returns

result – True if values in specified columns don’t change, False otherwise

Return type

bool

Notes

We check that from timepoint to timepoint, each epoch has the same value in a given column:

epoch1

A

B

1

x

1

x

1

x

1

x

1

x

epoch2

A

B

2

y

2

y

2

y

2

y

2

y

This is helpful when performing linear regression on an epochs table where the predictors vary with epochs (as they are expected to) but stay constant from sample to sample, because we can do our modeling much faster.

fitgrid.tools.get_blas(numpy_module)[source]

Return BLAS object or None if neither MKL nor OpenBLAS is found.

fitgrid.tools.get_blas_osys(numpy_module, osys)[source]
fitgrid.tools.get_first_group(groupby)[source]
fitgrid.tools.get_index_duplicates_table(df, level)[source]

Return a string table of duplicate index values and their locations.

class fitgrid.tools.single_threaded(numpy_module)[source]

Bases: object