Utils module

append_data_to_file(filename, data)

Appends a data frame to an (possibly) existing tsv file :param filename: path to the file :type filename: str :param data: data to be appended to the file :type data: dataframe

dircheck(path2dir)

Checks if a directory exists! if it does not exist, it creates it :param dir_path: path to the directory you want to be created :type dir_path: str, path

get_task_class(const, class_name)

Searches for the task class in the list of task modules and returns it :param const: constant.py object containing the list of task modules to search for the task class :type const: constant object :param class_name: name of the task class to be searched for :type class_name: str

Returns:

TaskClass (class) – the task class that was searched for

get_task_file_class(const, class_name)

Searches for the TaskFile class in the list of task modules and returns it. Mirrors get_task_class but for the file-generation side. Custom TaskFile classes follow a ‘<class>File’ naming convention so they can coexist with their matching Task class in the same module (e.g. SilentWord and SilentWordFile in my_tasks.py).

Parameters:
  • const (constant object) – constants.py object containing the task_modules list

  • class_name (str) – base class name from task_table.tsv (e.g. ‘SilentWord’)

Returns:

TaskFileClass (class) – the TaskFile class that was searched for

get_task_table(exp_dir=None)

Reads the task_table.tsv file from the experimental directory and the package direction and concatenates them, avoiding duplicates :param exp_dir: path to the experiment directory. If None, returns only the general table. :type exp_dir: str, path, optional

Returns:

task_table (dataframe) – dataframe containing the task table