Skip to content
Snippets Groups Projects
Commit 89e76d93 authored by Ryan Godwin's avatar Ryan Godwin
Browse files

UPdating docs and submodule (config_utils)

parent 313aedbd
No related branches found
No related tags found
1 merge request!1Progress toward getting the evaluation integrated
import json
from urllib.request import urlopen
import numpy as np
def load_json_from_url(url):
"""
It loads JSON data from a URL
Args:
url: The URL to load JSON data from.
Returns:
A dictionary of the JSON data.
"""
data = json.loads(urlopen(url).read())
return data
def load_dict(filepath):
"""
Load a dictionary from a JSON's filepath.
Args:
filepath: The filepath to the JSON file.
Returns:
A dictionary.
"""
with open(filepath, "r") as fp:
d = json.load(fp)
return d
def save_dict(d, filepath, cls=None, sortkeys=False):
"""
It saves a dictionary to a specific location.
Args:
d: The dictionary to save.
filepath: The path to the file to save the dictionary to.
cls: A custom JSONEncoder subclass. If specified, the object will use this encoder instead of the
default.
sortkeys: If True, the keys of the dictionary are sorted before writing. Defaults to False
"""
with open(filepath, "w") as fp:
json.dump(d, indent=2, fp=fp, cls=cls, sort_keys=sortkeys)
def set_seeds(seed=42):
"""
`set_seeds` sets the seed for reproducibility
Args:
seed: The seed for the random number generator. Defaults to 42
"""
# Set seeds
seed = np.random.seed(seed)
return seed
......@@ -6,12 +6,12 @@ nav:
- Home: index.md
- workflows:
- main: hrvmeg/main.md
- postpacu:
- hrvmeg:
- data: hrvmeg/data.md
- evaluate: hrvmeg/evaluate.md
- predict: hrvmeg/predict.md
- train: hrvmeg/train.md
- utils: hrvmeg/utils.md
- train: hrvmeg/config_utils.md
- utils: utils/meg_to_ica.md
theme: readthedocs
plugins:
- mkdocstrings
......
py_utils @ a00ec79c
Subproject commit febb0d22cda57f280a40d4089efef292dd266004
Subproject commit a00ec79c6d32c78a7a6be7efc5fe3bed599ffa42
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment