utils

Functions

active_last_24_hours(value)

Return True if every hour in the last 24 h was scheduled as active.

change_directory_settings(new_path)

Update all directory settings based on a new project root path.

change_system_directory_settings()

Updates the system directory setting and renames the directory if it changed.

create_directories()

Create all necessary system directories if they do not exist.

create_directories_from_path(p)

Creates a standard directory structure rooted at the given path.

create_pixmap(fig)

Creates a QPixmap from a matplotlib Figure.

delete_all_elements_from_layout(layout)

Recursively removes all widgets and sub-layouts from a QLayout.

download_github_repositories(repositories)

Clone a list of GitHub repositories into the user's village_projects directory.

get_x_value_interp(x, y, y_target)

Find the x-value corresponding to a target y-value using interpolation.

has_low_disk_space([threshold_gb])

Checks if the root partition has low disk space.

interpolate(x, y[, points])

Perform PCHIP interpolation on specific data points.

is_active(value)

Return True if the current hour is within the scheduled active hours.

is_active_regular(value)

Return True if the current calendar day is scheduled as active.

reformat_trial_data(data, date, trial, ...)

Reformats raw trial data into a flattened dictionary structure.

setup_logging(logs_subdirectory)

Configure the logging system to write to a timestamped file.

transform_raw_to_clean(df)

Transforms raw Bpod trial data into a clean, wide-format DataFrame.

validate_subject_name(name)

Returns an error message if the name is invalid, None if valid.