-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 73-add-hexel-channel-location-figure-alongsi…
…de-expression-plots
- Loading branch information
Showing
15 changed files
with
630 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,21 @@ | ||
from pathlib import Path | ||
|
||
from kymata.io.yaml import load_config | ||
from kymata.io.config import load_config, get_root_dir | ||
from kymata.preproc.data_cleansing import estimate_noise_cov | ||
|
||
|
||
# noinspection DuplicatedCode | ||
def main(): | ||
config = load_config(str(Path(Path(__file__).parent.parent, "kymata", "config", "dataset4.yaml"))) | ||
|
||
if config['data_location'] == "local": | ||
data_root_dir = str(Path(Path(__file__).parent.parent, "kymata-toolbox-data", "emeg_study_data")) + "/" | ||
elif config['data_location'] == "cbu": | ||
data_root_dir = '/imaging/projects/cbu/kymata/data/' | ||
elif config['data_location'] == "cbu-local": | ||
data_root_dir = '//cbsu/data/imaging/projects/cbu/kymata/data/' | ||
else: | ||
raise Exception("The 'data_location' parameter in the config file must be either 'cbu' or 'local' or 'cbu-local'.") | ||
|
||
estimate_noise_cov( data_root_dir = data_root_dir, | ||
estimate_noise_cov(data_root_dir = get_root_dir(config), | ||
emeg_machine_used_to_record_data = config['emeg_machine_used_to_record_data'], | ||
list_of_participants = config['list_of_participants'], | ||
dataset_directory_name = config['dataset_directory_name'], | ||
n_runs = config['number_of_runs'], | ||
cov_method = config['cov_method'], | ||
duration_emp = config['duration'], | ||
reg_method = config['reg_method'] | ||
) | ||
reg_method = config['reg_method']) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from pathlib import Path | ||
|
||
import yaml | ||
|
||
from file import path_type, file_type, open_or_use | ||
|
||
|
||
def load_config(config_location: path_type | file_type): | ||
"""Load config parameters""" | ||
with open_or_use(config_location) as stream: | ||
return yaml.safe_load(stream) | ||
|
||
|
||
def modify_param_config(config_location: str, key: str, value): | ||
with open(config_location, 'r') as stream: | ||
"""Load config parameter""" | ||
data = yaml.safe_load(stream) | ||
data[key] = value | ||
yaml.emitter.Emitter.process_tag = lambda self, *args, **kw: None | ||
with open(config_location, 'w') as file: | ||
yaml.dump(data, | ||
file, | ||
sort_keys = False) | ||
|
||
|
||
def get_root_dir(config: dict) -> str: | ||
if config['data_location'] == "local": | ||
return str(Path(Path(__file__).parent.parent, "kymata-toolbox-data", "emeg_study_data")) + "/" | ||
elif config['data_location'] == "cbu": | ||
return '/imaging/projects/cbu/kymata/data/' | ||
elif config['data_location'] == "cbu-local": | ||
return '//cbsu/data/imaging/projects/cbu/kymata/data/' | ||
else: | ||
raise ValueError( | ||
"The `data_location` parameter in the config file must be either 'cbu' or 'local' or 'cbu-local'.") |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.