catalight.analysis.user_inputs.DataExtractor

class catalight.analysis.user_inputs.DataExtractor(*args: Any, **kwargs: Any)

Bases: QDialog

User interface for selecting data folders.

Sweeps the starting directory for matching datafiles, then opens a UI showing paths matching data_depth. The user can select which paths they’d like, and provide a label for that data set using a table and tree widget.

Parameters:
  • starting_dir (str, optional) – Main directory to initialize gui in. The default is None.

  • target (str, optional) – String to identify as “has data”. The default is ‘avg_conc’.

  • suffix (str, optional) – File type to search for. The default is ‘.csv’.

  • data_depth (int, optional) –

    Depth between data and path to return. The default is 2. For example,

    data_depth

    path returned

    0

    user/reactions/experiment/Results/avg_conc.csv

    1

    user/reactions/experiment/Results

    2

    user/reactions/experiment

Return type:

None.

__init__(starting_dir=None, target='avg_conc', suffix='.csv', data_depth=2)

Initialize extraction gui.

Methods

__init__([starting_dir, target, suffix, ...])

Initialize extraction gui.

accept()

Redefine accept button.

cancel()

Restart init at picking starting directory.

getParentPath(item)

Get parent path of item.

get_expt_dirs()

Open file dialog and let user select directories to analyze.

get_output()

Get GUI input values.

initLayout()

Initialize layout of GUI.

populateTree(dataset)

Display files in a selection gui allowing user to pick relevant files.

accept()

Redefine accept button.

cancel()

Restart init at picking starting directory.

getParentPath(item)

Get parent path of item.

get_expt_dirs()

Open file dialog and let user select directories to analyze.

Then finds files matching target and suffix provided and calls populateTree() using those filepaths. Updates pathRoot.

Return type:

None.

get_output()

Get GUI input values.

Returns:

(file_list, data_labels) – Where file_list is the full path to the files specified by input parameters and data_labels is the matching strings provided in the GUI.

Return type:

tuple

initLayout()

Initialize layout of GUI.

populateTree(dataset)

Display files in a selection gui allowing user to pick relevant files.

The path shown in the selection tree will be altered by self.data_depth

Parameters:

dataset (list) – list of strings containing paths to data files