Add files via upload

This commit is contained in:
David Rotermund 2024-08-12 11:45:06 +02:00 committed by GitHub
parent ee9f9904ab
commit a053ef3935
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 85 deletions

View file

@ -1,68 +1,45 @@
import numpy as np import numpy as np
import os import os
import json
from jsmin import jsmin # type:ignore
import argh import argh
from functions.get_trials import get_trials
from functions.get_experiments import get_experiments
# mouse:int = 0, 1, 2, 3, 4 def loader(
def loader(mouse: int = 0, fpath: str = "/data_1/hendrik/gevi") -> None: filename: str = "config_M_Sert_Cre_49.json", fpath: str = "/data_1/hendrik/gevi"
) -> None:
mouse_name = [ if os.path.isfile(filename) is False:
"M_Sert_Cre_41", print(f"{filename} is missing")
"M_Sert_Cre_42", exit()
"M_Sert_Cre_45",
"M_Sert_Cre_46",
"M_Sert_Cre_49",
]
n_tris = [ with open(filename, "r") as file:
[ config = json.loads(jsmin(file.read()))
15,
15,
30,
30,
30,
30,
], # 0 in cond 7
[
15,
15,
30,
30,
30,
30,
], # 0 in cond 7
[
15,
15,
30,
30,
30,
30,
], # 0 in cond 7
[
20,
40,
20,
20,
], # 0, 0, 0 in cond 5-7
[
20,
40,
20,
20,
], # 0, 0, 0 in cond 5-7
]
n_exp = len(n_tris[mouse]) raw_data_path: str = os.path.join(
config["basic_path"],
config["recoding_data"],
config["mouse_identifier"],
config["raw_path"],
)
for i_exp in range(n_exp): experiments = get_experiments(raw_data_path).numpy()
n_tri = n_tris[mouse][i_exp] n_exp = experiments.shape[0]
for i_tri in range(n_tri):
experiment_name: str = f"Exp{i_exp + 1:03d}_Trial{i_tri + 1:03d}" for i_exp in range(0, n_exp):
trials = get_trials(raw_data_path, experiments[i_exp]).numpy()
n_tri = trials.shape[0]
for i_tri in range(0, n_tri):
experiment_name: str = (
f"Exp{experiments[i_exp]:03d}_Trial{trials[i_tri]:03d}"
)
tmp_fname = os.path.join( tmp_fname = os.path.join(
fpath, fpath,
"output_" + mouse_name[mouse], "output_" + config["mouse_identifier"],
experiment_name + "_acceptor_donor.npz", experiment_name + "_acceptor_donor.npz",
) )
print(f'Processing file "{tmp_fname}"...') print(f'Processing file "{tmp_fname}"...')
@ -76,12 +53,14 @@ def loader(mouse: int = 0, fpath: str = "/data_1/hendrik/gevi") -> None:
new_shape = [n_exp, *tmp_data_sequence.shape] new_shape = [n_exp, *tmp_data_sequence.shape]
data_sequence = np.zeros(new_shape) data_sequence = np.zeros(new_shape)
light_signal = np.zeros(new_shape) light_signal = np.zeros(new_shape)
# Here you might want to use the exp fit and removal...
data_sequence[i_exp] += tmp_data_sequence / n_tri data_sequence[i_exp] += tmp_data_sequence / n_tri
light_signal[i_exp] += tmp_light_signal / n_tri light_signal[i_exp] += tmp_light_signal / n_tri
np.save("dsq_" + mouse_name[mouse], data_sequence) np.save("dsq_" + config["mouse_identifier"], data_sequence)
np.save("lsq_" + mouse_name[mouse], light_signal) np.save("lsq_" + config["mouse_identifier"], light_signal)
np.save("msq_" + mouse_name[mouse], mask) np.save("msq_" + config["mouse_identifier"], mask)
if __name__ == "__main__": if __name__ == "__main__":

View file

@ -27,35 +27,6 @@ def plot(
fit_power: bool = False, # True => -ax^b ; False => exp(-b) fit_power: bool = False, # True => -ax^b ; False => exp(-b)
) -> None: ) -> None:
# lbs = [
# [
# "control",
# "visual control",
# "op20 50 5",
# "op20 100 5",
# "op20 50 grat",
# "op20 100 grat",
# ],
# [
# "control",
# "visual control",
# "op20 50 5",
# "op20 100 5",
# "op20 50 grat",
# "op20 100 grat",
# ],
# [
# "control",
# "visual control",
# "op20 50 5",
# "op20 100 5",
# "op20 50 grat",
# "op20 100 grat",
# ],
# ["control", "visual control", "op20 50 5", "op20 100 5"],
# ["control", "visual control", "op20 50 5", "op20 100 5"],
# ]
if os.path.isfile(filename) is False: if os.path.isfile(filename) is False:
print(f"{filename} is missing") print(f"{filename} is missing")
exit() exit()