""" Filename: shareddata.py Description: Shared constants and methods other files depend on Note: Compliant with pylance strict type checking Author: Tyler de Zeeuw License: GPL-3.0 """ # Built-in imports import os import sys import platform CURRENT_VERSION = "1.7.1" APP_NAME = "flares" APP_NAME_EXPANDED = "fNIRS Lightweight Analysis, Research, & Evaluation Suite" API_URL = f"https://git.research.dezeeuw.ca/api/v1/repos/tyler/{APP_NAME}/releases" API_URL_SECONDARY = f"https://git.research2.dezeeuw.ca/api/v1/repos/tyler/{APP_NAME}/releases" PLATFORM_NAME = platform.system().lower() CHANGELOG_URL = f"https://git.research.dezeeuw.ca/tyler/{APP_NAME}/raw/branch/main/changelog_major.md" WIKI_URL = f"https://git.research.dezeeuw.ca/tyler/{APP_NAME}/wiki" PLUGINS_URL = f"https://git.research.dezeeuw.ca/tyler/{APP_NAME}-plugins/raw/branch/main/plugins.json" PIPELINE_STAGES = [ "Preprocessing", "Trimming", "Verify Optode Placement", "Short/Long Channels", "Heart Rate", "Scalp Coupling Index", "Signal to Noise Ratio", "Peak Spectral Power", "Cross Validation", "Median Absolute Deviation", "Power Spectral Density Noise", "Channel Variance", "Bad Channels Handling", "Optical Density", "Temporal Derivative Distribution Repair Filtering", "Wavelet Filtering", "Haemoglobin Concentration", "Enhance Negative Correlation", "Filter", "Extracting Events", "Epoch Calculations", "Design Matrix", "General Linear Model", "Generate GLM Results", "Generate Channel Results", "Generate Region of Interest Results", "Generate Contrast Results", "Finishing Up" ] DATA_SCHEMA = [ {"key": "raw_haemo_dict", "help": "Dict[file_path, MNE RawArray]: Haemodynamic raw data"}, {"key": "epochs_dict", "help": "Dict[file_path, MNE Epochs]: Time-locked epoch data"}, {"key": "cha_dict", "help": "Dict[file_path, DataFrame]: Channel analysis results"}, {"key": "df_ind_dict", "help": "Dict[file_path, DataFrame]: Individual-level data/ROI results"}, {"key": "design_matrix_dict", "help": "Dict[file_path, DataFrame]: GLM design matrices"}, {"key": "config_dict", "help": "Dict[file_path, dict]: Processing configuration parameters"}, {"key": "fig_bytes_dict", "help": "Dict[file_path, dict]: Serialized figure data"}, {"key": "contrast_results_dict", "help": "Dict[file_path, dict]: Calculated contrast statistical results"}, {"key": "roi_channel_map_dict", "help": "Dict[file_path, dict]: ROI channel mappings"}, {"key": "fir_feature_dict", "help": "Dict[file_path, dict]: Extracted FIR waveform features (features, names, channels)"}, {"key": "qc_dict", "help": "Dict[file_path, dict]: Quality control metrics"}, {"key": "valid_dict", "help": "Dict[file_path, bool]: Boolean validity status per file"} ] def resource_path(relative_path: str) -> str: """Get absolute path to resource regardless of running directly or packaged using PyInstaller""" base_path = getattr(sys, "_MEIPASS", os.path.abspath(".")) return os.path.join(base_path, relative_path) def get_app_dir() -> str: """Returns the root directory of the application executable or working directory.""" if getattr(sys, 'frozen', False): return os.path.dirname(sys.executable) return os.getcwd()