tscfat.Utils package

Submodules

tscfat.Utils.analysis_parameters module

Created on Mon Mar 22 11:26:36 2021

@author: ikaheia1

A helper class for storing the parameters used in the analysis. The parameters are stored in the __dict__ dictionary by using an alias name as the key.

class tscfat.Utils.analysis_parameters.AnalysisParameters[source]

Bases: object

add(alias, parameter)[source]

Adds a new key : value pair in __dict__ dictionary.

Parameters
  • alias (str) – Alias name / key for the parameter

  • parameter (str / int / list) – A parameter used as an argument for analysis functions.

Returns

Return type

None.

list_parameters()[source]

Return a dictionaty containing the key : value pairs used as function parameters.

Returns

names – key : value pairs used as function arguments.

Return type

dict

tscfat.Utils.argument_loader module

Created on Fri Nov 20 14:31:11 2020

@author: ikaheia1

Helper functions for pytest test data loading. Load a csv file and convert it using separate loading functions for:

  1. Numpy array format

  2. Pandas series format

  3. Pandas dataframe format

tscfat.Utils.argument_loader.setup_np()[source]

Load the test data and convert the values into 1D numpy array.

Returns

A 1D numpy array containing the test data time series.

Return type

_ = numpy array

tscfat.Utils.argument_loader.setup_pd()[source]

Load the test data and convert the values into pandas DataFrame.

Returns

A pandas DataFrame containing the test data time series.

Return type

_ = pandas DataFrame

tscfat.Utils.argument_loader.setup_ps()[source]

Load the test data and convert the values into pandas Series.

Returns

A pandas series containing the test data time series.

Return type

_ = pandas Series

tscfat.Utils.doi2int module

Created on Tue Mar 23 11:46:24 2021

@author: ikaheia1

A helper function for converting the datetime to indices used for plotting.

tscfat.Utils.doi2int.doi2index(doi, df)[source]

Convert given range given in datetime objects into corresponding Matplotlib indices, that are used to highligh the region in analysis figures.

Parameters
  • doi (tuple) – Contain two datetime objects.

  • df (pandas DataFrame) – A dataframe with datetime index.

Returns

  • ind_s (float) – Starting index. Number of days since the unix time epoch.

  • ind_e (float) – End index. Number of days since the unix time epoch.

tscfat.Utils.file_names module

Created on Mon Mar 22 11:26:36 2021

@author: ikaheia1

A helper class for storing the filenames / paths used in the analysis. The filenames are stored in the __dict__ dictionary by using an alias name as the key.

class tscfat.Utils.file_names.FileNames[source]

Bases: object

add(alias, filename)[source]

Adds a new key : value pair in __dict__ dictionary.

Parameters
  • alias (str) – Alias name / key for the filename

  • parameter (str / Path) – A parameter used as a filename / Path for saving the figures.

Returns

Return type

None.

list_filenames()[source]

Return a dictionaty containing the key : value pairs used as filenames or paths for data loading and saving the plotted figures.

Returns

names – key : value pairs used as filenames.

Return type

dict

tscfat.Utils.plot_decorator module

Created on Fri Jan 8 15:49:55 2021

@author: ikaheia1

Function wrapper for handling the plotting of figure or saving it to the destined folder.

tscfat.Utils.plot_decorator.plot_decorator(func)[source]

Save the plot figure if savename and path are in function keyword arguments.

Parameters

func (function) – Plotting function to be decorated.

Raises

Exception – Requested folder does not exist og the agruments are not given in correct way.

Returns

wrapper – Wrapped plotting function.

Return type

function wrapper

tscfat.Utils.process_decorator module

Created on Thu Mar 25 10:23:43 2021

@author: arsi

Function wrapper for iterating dataframe columns.

tscfat.Utils.process_decorator.process_decorator(func)[source]

Calls the wrapped function for all the dataframe columns given in the list.

Parameters

func (function) – Function used in iteration.

Returns

wrapper – A wrapped function

Return type

function wrapped

Module contents