mirror of
https://github.com/davrot/gevi.git
synced 2025-04-20 22:26:43 +02:00
Delete stage_6_convert_roi.py
This commit is contained in:
parent
d3d79c0607
commit
d8688a156a
1 changed files with 0 additions and 55 deletions
|
@ -1,55 +0,0 @@
|
|||
import json
|
||||
import os
|
||||
import argh
|
||||
from jsmin import jsmin # type:ignore
|
||||
import numpy as np
|
||||
import h5py
|
||||
|
||||
|
||||
def converter(config_filename: str = "config.json") -> None:
|
||||
|
||||
filename: str = config_filename
|
||||
|
||||
if os.path.isfile(filename) is False:
|
||||
print(f"{filename} is missing")
|
||||
exit()
|
||||
|
||||
with open(filename, "r") as file:
|
||||
config = json.loads(jsmin(file.read()))
|
||||
|
||||
raw_data_path: str = os.path.join(
|
||||
config["basic_path"],
|
||||
config["recoding_data"],
|
||||
config["mouse_identifier"],
|
||||
config["raw_path"],
|
||||
)
|
||||
|
||||
if os.path.isdir(raw_data_path) is False:
|
||||
print(f"ERROR: could not find raw directory {raw_data_path}!!!!")
|
||||
exit()
|
||||
|
||||
roi_path: str = os.path.join(
|
||||
config["basic_path"], config["recoding_data"], config["mouse_identifier"]
|
||||
)
|
||||
roi_control_mat: str = os.path.join(roi_path, "ROI_control.mat")
|
||||
roi_sdarken_mat: str = os.path.join(roi_path, "ROI_sDarken.mat")
|
||||
|
||||
if os.path.isfile(roi_control_mat):
|
||||
hf = h5py.File(roi_control_mat, "r")
|
||||
roi_control = np.array(hf["roi"]).T
|
||||
filename_out: str = f"roi_control{config["mouse_identifier"]}.npy"
|
||||
np.save(filename_out, roi_control)
|
||||
else:
|
||||
print("ROI Control not found")
|
||||
|
||||
if os.path.isfile(roi_sdarken_mat):
|
||||
hf = h5py.File(roi_sdarken_mat, "r")
|
||||
roi_darken = np.array(hf["roi"]).T
|
||||
filename_out = f"roi_sdarken{config["mouse_identifier"]}.npy"
|
||||
np.save(filename_out, roi_darken)
|
||||
else:
|
||||
print("ROI sDarken not found")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
argh.dispatch_command(converter)
|
Loading…
Add table
Reference in a new issue