Compare commits

...

25 commits

Author SHA1 Message Date
6609a37a97
Add files via upload 2025-03-19 18:36:14 +01:00
6d8a7fbbbc
Update stage_5_convert_metadata.py 2025-03-19 18:35:14 +01:00
a33172f38b
Update README.md 2025-03-19 18:34:08 +01:00
d0b8ff58d2
Add files via upload 2025-03-19 18:32:36 +01:00
1946ecc343
Delete README.md 2025-03-19 18:32:03 +01:00
d798311b0d
Delete stage_4_process.py 2025-03-19 18:29:54 +01:00
2e36e9013c
Delete stage_4b_inspect.py 2025-03-19 18:29:46 +01:00
c1caff162d
Delete stage_4c_viewer.py 2025-03-19 18:29:39 +01:00
a3fe0e9d5f
Delete stage_3_refine_mask.py 2025-03-19 18:29:29 +01:00
580a85b964
Delete stage_2_make_heartbeat_mask.py 2025-03-19 18:29:19 +01:00
2d1772b948
Delete stage_1_get_ref_image.py 2025-03-19 18:29:09 +01:00
389251826d
Delete stage_5_convert_metadata.py 2025-03-19 18:29:01 +01:00
d8688a156a
Delete stage_6_convert_roi.py 2025-03-19 18:28:54 +01:00
d3d79c0607
Delete geci_plot.py 2025-03-19 18:28:46 +01:00
1b12b32a7d
Delete geci_loader.py 2025-03-19 18:28:39 +01:00
943a0a09a0
Delete config_fatma_gevi_M0134M_SessionA2_Test.json 2025-03-19 18:28:29 +01:00
c8b9fadade
Delete config_M_Sert_Cre_49.json 2025-03-19 18:28:19 +01:00
0bb8964e1c
Delete config_M_Sert_Cre_46.json 2025-03-19 18:28:06 +01:00
1902722901
Delete config_M_Sert_Cre_45.json 2025-03-19 18:27:57 +01:00
2e1906fd64
Delete config_M_Sert_Cre_42.json 2025-03-19 18:27:49 +01:00
f7f286689e
Delete config_M_Sert_Cre_41.json 2025-03-19 18:27:41 +01:00
34eb1044d0
Delete config_M3879M_2021-10-05.json 2025-03-19 18:27:33 +01:00
cfe688b0a3
Delete callum_config_M3905F.json 2025-03-19 18:27:19 +01:00
a32fd9be39
Delete callum_config_M0134M.json 2025-03-19 18:27:10 +01:00
859a945ac4
Delete functions directory 2025-03-19 18:26:40 +01:00
29 changed files with 942 additions and 64 deletions

View file

@ -11,3 +11,49 @@ Ruhr-Universität Bochum, Universitätsbibliothek
08.02.2024
[https://doi.org/10.13154/294-11032](https://doi.org/10.13154/294-11032)
-----------------------------------------------------------------------------------------------------
Updated: 19.03.2025
Files are now organized in subdirectories to distinguish better between code for GEVI or GECI analysis.
```
gevi-geci/
stage_1*, stage_2*, stage_3*, stage_4*, stage_5*
-> main stages for data preprocessing
-> use e.g.: python stage_1_get_ref_image.py -c config_example_GEVI.json
functions/
-> functions used by the main stages
gevi-geci/gevi/
config_example_GEVI.json
-> typical config file for GEVI (compare to gevi-geci/geci/config_example_GECI.json)
config_M0134M*, config_M3905F*
-> config files for a few recordings (adjust directory names, if necessary!)
example_load_gevi.py
-> simple script demonstrating how to load data
gevi-geci/geci/
config_example_GECI.json
-> typical config file for GECI (compare to gevi-geci/gevi/config_example_GEVI.json)
config_M_Sert_Cre_4*
-> config files for a few recordings (adjust directory names, if necessary!)
stage_6_convert_roi.py
-> additional stage for the analysis of Hendrik's recordings
-> use e.g.: python stage_6_convert_roi.py -f config_M_Sert_Cre_41.json
geci_loader.py, geci_plot.py
-> additional code for summarizing the results and plotting with the ROIs
-> use e.g. python geci_loader.py --filename config_M_Sert_Cre_41.json
gevi-geci/other/
stage_4b_inspect.py, stage_4c_viewer.py
-> temporary code for assisting search for implantation electrode
```

View file

@ -3,14 +3,14 @@
"recoding_data": "2023-07-17",
"mouse_identifier": "M_Sert_Cre_41",
"raw_path": "raw",
"export_path": "output_M_Sert_Cre_41",
"ref_image_path": "ref_images_M_Sert_Cre_41",
"heartbeat_remove": false,
"gevi": false, // true => gevi, false => geci
"export_path": "output/M_Sert_Cre_41",
"ref_image_path": "ref_images/M_Sert_Cre_41",
"heartbeat_remove": true,
"gevi": false, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
//"target_camera_acceptor": "acceptor",
// EMPTY FOR GECI "target_camera_acceptor": "acceptor",
"target_camera_acceptor": "",
"regressor_cameras_acceptor": [
"oxygenation",
@ -18,7 +18,7 @@
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
// "oxygenation",
// REMOVED FOR GECI "oxygenation",
"volume"
],
// binning
@ -52,6 +52,11 @@
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
@ -59,4 +64,4 @@
"oxygenation",
"volume"
]
}
}

View file

@ -3,14 +3,14 @@
"recoding_data": "2023-07-18",
"mouse_identifier": "M_Sert_Cre_42",
"raw_path": "raw",
"export_path": "output_M_Sert_Cre_42",
"ref_image_path": "ref_images_M_Sert_Cre_42",
"heartbeat_remove": false,
"gevi": false, // true => gevi, false => geci
"export_path": "output/M_Sert_Cre_42",
"ref_image_path": "ref_images/M_Sert_Cre_42",
"heartbeat_remove": true,
"gevi": false, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
//"target_camera_acceptor": "acceptor",
// EMPTY FOR GECI "target_camera_acceptor": "acceptor",
"target_camera_acceptor": "",
"regressor_cameras_acceptor": [
"oxygenation",
@ -18,7 +18,7 @@
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
// "oxygenation",
// REMOVED FOR GECI "oxygenation",
"volume"
],
// binning
@ -52,6 +52,11 @@
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",

View file

@ -3,14 +3,14 @@
"recoding_data": "2023-07-18",
"mouse_identifier": "M_Sert_Cre_45",
"raw_path": "raw",
"export_path": "output_M_Sert_Cre_45",
"ref_image_path": "ref_images_M_Sert_Cre_45",
"heartbeat_remove": false,
"gevi": false, // true => gevi, false => geci
"export_path": "output/M_Sert_Cre_45",
"ref_image_path": "ref_images/M_Sert_Cre_45",
"heartbeat_remove": true,
"gevi": false, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
//"target_camera_acceptor": "acceptor",
// EMPTY FOR GECI "target_camera_acceptor": "acceptor",
"target_camera_acceptor": "",
"regressor_cameras_acceptor": [
"oxygenation",
@ -18,7 +18,7 @@
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
// "oxygenation",
// REMOVED FOR GECI "oxygenation",
"volume"
],
// binning
@ -52,6 +52,11 @@
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",

View file

@ -3,14 +3,14 @@
"recoding_data": "2023-03-16",
"mouse_identifier": "M_Sert_Cre_46",
"raw_path": "raw",
"export_path": "output_M_Sert_Cre_46",
"ref_image_path": "ref_images_M_Sert_Cre_46",
"heartbeat_remove": false,
"gevi": false, // true => gevi, false => geci
"export_path": "output/M_Sert_Cre_46",
"ref_image_path": "ref_images/M_Sert_Cre_46",
"heartbeat_remove": true,
"gevi": false, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
//"target_camera_acceptor": "acceptor",
// EMPTY FOR GECI "target_camera_acceptor": "acceptor",
"target_camera_acceptor": "",
"regressor_cameras_acceptor": [
"oxygenation",
@ -18,7 +18,7 @@
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
// "oxygenation",
// REMOVED FOR GECI "oxygenation",
"volume"
],
// binning
@ -52,6 +52,11 @@
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",

View file

@ -3,14 +3,14 @@
"recoding_data": "2023-03-15",
"mouse_identifier": "M_Sert_Cre_49",
"raw_path": "raw",
"export_path": "output_M_Sert_Cre_49",
"ref_image_path": "ref_images_M_Sert_Cre_49",
"heartbeat_remove": false,
"gevi": false, // true => gevi, false => geci
"export_path": "output/M_Sert_Cre_49",
"ref_image_path": "ref_images/M_Sert_Cre_49",
"heartbeat_remove": true,
"gevi": false, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
//"target_camera_acceptor": "acceptor",
// EMPTY FOR GECI "target_camera_acceptor": "acceptor",
"target_camera_acceptor": "",
"regressor_cameras_acceptor": [
"oxygenation",
@ -18,7 +18,7 @@
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
// "oxygenation",
// REMOVED FOR GECI "oxygenation",
"volume"
],
// binning
@ -52,6 +52,11 @@
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
@ -59,4 +64,4 @@
"oxygenation",
"volume"
]
}
}

View file

@ -0,0 +1,67 @@
{
"basic_path": "/data_1/hendrik",
"recoding_data": "2023-07-17",
"mouse_identifier": "M_Sert_Cre_41",
"raw_path": "raw",
"export_path": "output/M_Sert_Cre_41",
"ref_image_path": "ref_images/M_Sert_Cre_41",
"heartbeat_remove": true,
"gevi": false, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
// EMPTY FOR GECI "target_camera_acceptor": "acceptor",
"target_camera_acceptor": "",
"regressor_cameras_acceptor": [
"oxygenation",
"volume"
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
// REMOVED FOR GECI "oxygenation",
"volume"
],
// binning
"binning_enable": true,
"binning_at_the_end": false,
"binning_kernel_size": 4,
"binning_stride": 4,
"binning_divisor_override": 1,
// alignment
"alignment_batch_size": 200,
"rotation_stabilization_threshold_factor": 3.0, // >= 1.0
"rotation_stabilization_threshold_border": 0.9, // <= 1.0
// Heart beat detection
"lower_freqency_bandpass": 5.0, // Hz
"upper_freqency_bandpass": 14.0, // Hz
"heartbeat_filtfilt_chuck_size": 10,
// Gauss smear
"gauss_smear_spatial_width": 8,
"gauss_smear_temporal_width": 0.1,
"gauss_smear_use_matlab_mask": false,
// LED Ramp on
"skip_frames_in_the_beginning": 100, // Frames
// PyTorch
"dtype": "float32",
"force_to_cpu": false,
// Save
"save_as_python": true, // produces .npz files (compressed)
"save_as_matlab": false, // produces .hd5 file (compressed)
// Save extra information
"save_alignment": false,
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
"donor",
"oxygenation",
"volume"
]
}

View file

@ -6,9 +6,7 @@ import numpy as np
import h5py
def converter(config_filename: str = "config.json") -> None:
filename: str = config_filename
def converter(filename: str = "config_M_Sert_Cre_49.json") -> None:
if os.path.isfile(filename) is False:
print(f"{filename} is missing")
@ -37,7 +35,7 @@ def converter(config_filename: str = "config.json") -> None:
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"
filename_out: str = f"roi_control{config['mouse_identifier']}.npy"
np.save(filename_out, roi_control)
else:
print("ROI Control not found")
@ -45,7 +43,7 @@ def converter(config_filename: str = "config.json") -> None:
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"
filename_out: str = f"roi_sdarken{config['mouse_identifier']}.npy"
np.save(filename_out, roi_darken)
else:
print("ROI sDarken not found")

View file

@ -1,12 +1,13 @@
{
"basic_path": "/data_1/fatma/GEVI",
"recoding_data": "2024-10-16",
"mouse_identifier": "M0134M_SessionA2_Test",
"export_path": "output_2024-10-16_M0134M_SessionA2_Test",
"ref_image_path": "ref_images_2024-10-16_M0134M_SessionA2_Test",
"basic_path": "/data_1/fatma/GEVI/",
"recoding_data": "2024-11-06",
"mouse_identifier": "M0134M_SessionA",
"raw_path": "raw",
"heartbeat_remove": true, // if gevi must be true; geci: who knows...
"gevi": true, // true => gevi, false => geci
"export_path": "output/M0134M_2024-11-06_SessionA",
"ref_image_path": "ref_images/M0134M_2024-11-06_SessionA",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
@ -51,6 +52,11 @@
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",

View file

@ -0,0 +1,67 @@
{
"basic_path": "/data_1/fatma/GEVI/",
"recoding_data": "2024-11-06",
"mouse_identifier": "M0134M_SessionB",
"raw_path": "raw",
"export_path": "output/M0134M_2024-11-06_SessionB",
"ref_image_path": "ref_images/M0134M_2024-11-06_SessionB",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
"target_camera_acceptor": "acceptor",
"regressor_cameras_acceptor": [
"oxygenation",
"volume"
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
"oxygenation",
"volume"
],
// binning
"binning_enable": true,
"binning_at_the_end": false,
"binning_kernel_size": 4,
"binning_stride": 4,
"binning_divisor_override": 1,
// alignment
"alignment_batch_size": 200,
"rotation_stabilization_threshold_factor": 3.0, // >= 1.0
"rotation_stabilization_threshold_border": 0.9, // <= 1.0
// Heart beat detection
"lower_freqency_bandpass": 5.0, // Hz
"upper_freqency_bandpass": 14.0, // Hz
"heartbeat_filtfilt_chuck_size": 10,
// Gauss smear
"gauss_smear_spatial_width": 8,
"gauss_smear_temporal_width": 0.1,
"gauss_smear_use_matlab_mask": false,
// LED Ramp on
"skip_frames_in_the_beginning": 100, // Frames
// PyTorch
"dtype": "float32",
"force_to_cpu": false,
// Save
"save_as_python": true, // produces .npz files (compressed)
"save_as_matlab": false, // produces .hd5 file (compressed)
// Save extra information
"save_alignment": false,
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
"donor",
"oxygenation",
"volume"
]
}

View file

@ -0,0 +1,67 @@
{
"basic_path": "/data_1/fatma/GEVI/",
"recoding_data": "2024-11-07",
"mouse_identifier": "M0134M_SessionA",
"raw_path": "raw",
"export_path": "output/M0134M_2024-11-07_SessionA",
"ref_image_path": "ref_images/M0134M_2024-11-07_SessionA",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
"target_camera_acceptor": "acceptor",
"regressor_cameras_acceptor": [
"oxygenation",
"volume"
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
"oxygenation",
"volume"
],
// binning
"binning_enable": true,
"binning_at_the_end": false,
"binning_kernel_size": 4,
"binning_stride": 4,
"binning_divisor_override": 1,
// alignment
"alignment_batch_size": 200,
"rotation_stabilization_threshold_factor": 3.0, // >= 1.0
"rotation_stabilization_threshold_border": 0.9, // <= 1.0
// Heart beat detection
"lower_freqency_bandpass": 5.0, // Hz
"upper_freqency_bandpass": 14.0, // Hz
"heartbeat_filtfilt_chuck_size": 10,
// Gauss smear
"gauss_smear_spatial_width": 8,
"gauss_smear_temporal_width": 0.1,
"gauss_smear_use_matlab_mask": false,
// LED Ramp on
"skip_frames_in_the_beginning": 100, // Frames
// PyTorch
"dtype": "float32",
"force_to_cpu": false,
// Save
"save_as_python": true, // produces .npz files (compressed)
"save_as_matlab": false, // produces .hd5 file (compressed)
// Save extra information
"save_alignment": false,
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
"donor",
"oxygenation",
"volume"
]
}

View file

@ -0,0 +1,67 @@
{
"basic_path": "/data_1/fatma/GEVI/",
"recoding_data": "2024-11-07",
"mouse_identifier": "M0134M_SessionB",
"raw_path": "raw",
"export_path": "output/M0134M_2024-11-07_SessionB",
"ref_image_path": "ref_images/M0134M_2024-11-07_SessionB",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
"target_camera_acceptor": "acceptor",
"regressor_cameras_acceptor": [
"oxygenation",
"volume"
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
"oxygenation",
"volume"
],
// binning
"binning_enable": true,
"binning_at_the_end": false,
"binning_kernel_size": 4,
"binning_stride": 4,
"binning_divisor_override": 1,
// alignment
"alignment_batch_size": 200,
"rotation_stabilization_threshold_factor": 3.0, // >= 1.0
"rotation_stabilization_threshold_border": 0.9, // <= 1.0
// Heart beat detection
"lower_freqency_bandpass": 5.0, // Hz
"upper_freqency_bandpass": 14.0, // Hz
"heartbeat_filtfilt_chuck_size": 10,
// Gauss smear
"gauss_smear_spatial_width": 8,
"gauss_smear_temporal_width": 0.1,
"gauss_smear_use_matlab_mask": false,
// LED Ramp on
"skip_frames_in_the_beginning": 100, // Frames
// PyTorch
"dtype": "float32",
"force_to_cpu": false,
// Save
"save_as_python": true, // produces .npz files (compressed)
"save_as_matlab": false, // produces .hd5 file (compressed)
// Save extra information
"save_alignment": false,
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
"donor",
"oxygenation",
"volume"
]
}

View file

@ -0,0 +1,67 @@
{
"basic_path": "/data_1/fatma/GEVI/",
"recoding_data": "2024-11-13",
"mouse_identifier": "M0134M_SessionA",
"raw_path": "raw",
"export_path": "output/M0134M_2024-11-13_SessionA",
"ref_image_path": "ref_images/M0134M_2024-11-13_SessionA",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
"target_camera_acceptor": "acceptor",
"regressor_cameras_acceptor": [
"oxygenation",
"volume"
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
"oxygenation",
"volume"
],
// binning
"binning_enable": true,
"binning_at_the_end": false,
"binning_kernel_size": 4,
"binning_stride": 4,
"binning_divisor_override": 1,
// alignment
"alignment_batch_size": 200,
"rotation_stabilization_threshold_factor": 3.0, // >= 1.0
"rotation_stabilization_threshold_border": 0.9, // <= 1.0
// Heart beat detection
"lower_freqency_bandpass": 5.0, // Hz
"upper_freqency_bandpass": 14.0, // Hz
"heartbeat_filtfilt_chuck_size": 10,
// Gauss smear
"gauss_smear_spatial_width": 8,
"gauss_smear_temporal_width": 0.1,
"gauss_smear_use_matlab_mask": false,
// LED Ramp on
"skip_frames_in_the_beginning": 100, // Frames
// PyTorch
"dtype": "float32",
"force_to_cpu": false,
// Save
"save_as_python": true, // produces .npz files (compressed)
"save_as_matlab": false, // produces .hd5 file (compressed)
// Save extra information
"save_alignment": false,
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
"donor",
"oxygenation",
"volume"
]
}

View file

@ -0,0 +1,67 @@
{
"basic_path": "/data_1/fatma/GEVI/",
"recoding_data": "2024-11-13",
"mouse_identifier": "M0134M_SessionB",
"raw_path": "raw",
"export_path": "output/M0134M_2024-11-13_SessionB",
"ref_image_path": "ref_images/M0134M_2024-11-13_SessionB",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
"target_camera_acceptor": "acceptor",
"regressor_cameras_acceptor": [
"oxygenation",
"volume"
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
"oxygenation",
"volume"
],
// binning
"binning_enable": true,
"binning_at_the_end": false,
"binning_kernel_size": 4,
"binning_stride": 4,
"binning_divisor_override": 1,
// alignment
"alignment_batch_size": 200,
"rotation_stabilization_threshold_factor": 3.0, // >= 1.0
"rotation_stabilization_threshold_border": 0.9, // <= 1.0
// Heart beat detection
"lower_freqency_bandpass": 5.0, // Hz
"upper_freqency_bandpass": 14.0, // Hz
"heartbeat_filtfilt_chuck_size": 10,
// Gauss smear
"gauss_smear_spatial_width": 8,
"gauss_smear_temporal_width": 0.1,
"gauss_smear_use_matlab_mask": false,
// LED Ramp on
"skip_frames_in_the_beginning": 100, // Frames
// PyTorch
"dtype": "float32",
"force_to_cpu": false,
// Save
"save_as_python": true, // produces .npz files (compressed)
"save_as_matlab": false, // produces .hd5 file (compressed)
// Save extra information
"save_alignment": false,
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
"donor",
"oxygenation",
"volume"
]
}

View file

@ -0,0 +1,67 @@
{
"basic_path": "/data_1/fatma/GEVI/",
"recoding_data": "2024-11-15",
"mouse_identifier": "M0134M_SessionA",
"raw_path": "raw",
"export_path": "output/M0134M_2024-11-15_SessionA",
"ref_image_path": "ref_images/M0134M_2024-11-15_SessionA",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
"target_camera_acceptor": "acceptor",
"regressor_cameras_acceptor": [
"oxygenation",
"volume"
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
"oxygenation",
"volume"
],
// binning
"binning_enable": true,
"binning_at_the_end": false,
"binning_kernel_size": 4,
"binning_stride": 4,
"binning_divisor_override": 1,
// alignment
"alignment_batch_size": 200,
"rotation_stabilization_threshold_factor": 3.0, // >= 1.0
"rotation_stabilization_threshold_border": 0.9, // <= 1.0
// Heart beat detection
"lower_freqency_bandpass": 5.0, // Hz
"upper_freqency_bandpass": 14.0, // Hz
"heartbeat_filtfilt_chuck_size": 10,
// Gauss smear
"gauss_smear_spatial_width": 8,
"gauss_smear_temporal_width": 0.1,
"gauss_smear_use_matlab_mask": false,
// LED Ramp on
"skip_frames_in_the_beginning": 100, // Frames
// PyTorch
"dtype": "float32",
"force_to_cpu": false,
// Save
"save_as_python": true, // produces .npz files (compressed)
"save_as_matlab": false, // produces .hd5 file (compressed)
// Save extra information
"save_alignment": false,
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
"donor",
"oxygenation",
"volume"
]
}

View file

@ -0,0 +1,67 @@
{
"basic_path": "/data_1/fatma/GEVI/",
"recoding_data": "2024-11-15",
"mouse_identifier": "M0134M_SessionB",
"raw_path": "raw",
"export_path": "output/M0134M_2024-11-15_SessionB",
"ref_image_path": "ref_images/M0134M_2024-11-15_SessionB",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
"target_camera_acceptor": "acceptor",
"regressor_cameras_acceptor": [
"oxygenation",
"volume"
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
"oxygenation",
"volume"
],
// binning
"binning_enable": true,
"binning_at_the_end": false,
"binning_kernel_size": 4,
"binning_stride": 4,
"binning_divisor_override": 1,
// alignment
"alignment_batch_size": 200,
"rotation_stabilization_threshold_factor": 3.0, // >= 1.0
"rotation_stabilization_threshold_border": 0.9, // <= 1.0
// Heart beat detection
"lower_freqency_bandpass": 5.0, // Hz
"upper_freqency_bandpass": 14.0, // Hz
"heartbeat_filtfilt_chuck_size": 10,
// Gauss smear
"gauss_smear_spatial_width": 8,
"gauss_smear_temporal_width": 0.1,
"gauss_smear_use_matlab_mask": false,
// LED Ramp on
"skip_frames_in_the_beginning": 100, // Frames
// PyTorch
"dtype": "float32",
"force_to_cpu": false,
// Save
"save_as_python": true, // produces .npz files (compressed)
"save_as_matlab": false, // produces .hd5 file (compressed)
// Save extra information
"save_alignment": false,
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
"donor",
"oxygenation",
"volume"
]
}

View file

@ -3,8 +3,8 @@
"recoding_data": "2024-11-18",
"mouse_identifier": "M0134M_SessionA",
"raw_path": "raw",
"export_path": "output_M0134M_SessionA",
"ref_image_path": "ref_images_M0134M_SessionA",
"export_path": "output/M0134M_2024-11-18_SessionA",
"ref_image_path": "ref_images/M0134M_2024-11-18_SessionA",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
@ -56,6 +56,7 @@
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",

View file

@ -0,0 +1,67 @@
{
"basic_path": "/data_1/fatma/GEVI/",
"recoding_data": "2024-11-18",
"mouse_identifier": "M0134M_SessionB",
"raw_path": "raw",
"export_path": "output/M0134M_2024-11-18_SessionB",
"ref_image_path": "ref_images/M0134M_2024-11-18_SessionB",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
"target_camera_acceptor": "acceptor",
"regressor_cameras_acceptor": [
"oxygenation",
"volume"
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
"oxygenation",
"volume"
],
// binning
"binning_enable": true,
"binning_at_the_end": false,
"binning_kernel_size": 4,
"binning_stride": 4,
"binning_divisor_override": 1,
// alignment
"alignment_batch_size": 200,
"rotation_stabilization_threshold_factor": 3.0, // >= 1.0
"rotation_stabilization_threshold_border": 0.9, // <= 1.0
// Heart beat detection
"lower_freqency_bandpass": 5.0, // Hz
"upper_freqency_bandpass": 14.0, // Hz
"heartbeat_filtfilt_chuck_size": 10,
// Gauss smear
"gauss_smear_spatial_width": 8,
"gauss_smear_temporal_width": 0.1,
"gauss_smear_use_matlab_mask": false,
// LED Ramp on
"skip_frames_in_the_beginning": 100, // Frames
// PyTorch
"dtype": "float32",
"force_to_cpu": false,
// Save
"save_as_python": true, // produces .npz files (compressed)
"save_as_matlab": false, // produces .hd5 file (compressed)
// Save extra information
"save_alignment": false,
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
"donor",
"oxygenation",
"volume"
]
}

View file

@ -0,0 +1,67 @@
{
"basic_path": "/data_1/fatma/GEVI/",
"recoding_data": "2024-12-04",
"mouse_identifier": "M0134M_SessionA",
"raw_path": "raw",
"export_path": "output/M0134M_2024-12-04_SessionA",
"ref_image_path": "ref_images/M0134M_2024-12-04_SessionA",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
"target_camera_acceptor": "acceptor",
"regressor_cameras_acceptor": [
"oxygenation",
"volume"
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
"oxygenation",
"volume"
],
// binning
"binning_enable": true,
"binning_at_the_end": false,
"binning_kernel_size": 4,
"binning_stride": 4,
"binning_divisor_override": 1,
// alignment
"alignment_batch_size": 200,
"rotation_stabilization_threshold_factor": 3.0, // >= 1.0
"rotation_stabilization_threshold_border": 0.9, // <= 1.0
// Heart beat detection
"lower_freqency_bandpass": 5.0, // Hz
"upper_freqency_bandpass": 14.0, // Hz
"heartbeat_filtfilt_chuck_size": 10,
// Gauss smear
"gauss_smear_spatial_width": 8,
"gauss_smear_temporal_width": 0.1,
"gauss_smear_use_matlab_mask": false,
// LED Ramp on
"skip_frames_in_the_beginning": 100, // Frames
// PyTorch
"dtype": "float32",
"force_to_cpu": false,
// Save
"save_as_python": true, // produces .npz files (compressed)
"save_as_matlab": false, // produces .hd5 file (compressed)
// Save extra information
"save_alignment": false,
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
"donor",
"oxygenation",
"volume"
]
}

View file

@ -0,0 +1,67 @@
{
"basic_path": "/data_1/fatma/GEVI/",
"recoding_data": "2024-12-04",
"mouse_identifier": "M0134M_SessionB",
"raw_path": "raw",
"export_path": "output/M0134M_2024-12-04_SessionB",
"ref_image_path": "ref_images/M0134M_2024-12-04_SessionB",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
"target_camera_acceptor": "acceptor",
"regressor_cameras_acceptor": [
"oxygenation",
"volume"
],
"target_camera_donor": "donor",
"regressor_cameras_donor": [
"oxygenation",
"volume"
],
// binning
"binning_enable": true,
"binning_at_the_end": false,
"binning_kernel_size": 4,
"binning_stride": 4,
"binning_divisor_override": 1,
// alignment
"alignment_batch_size": 200,
"rotation_stabilization_threshold_factor": 3.0, // >= 1.0
"rotation_stabilization_threshold_border": 0.9, // <= 1.0
// Heart beat detection
"lower_freqency_bandpass": 5.0, // Hz
"upper_freqency_bandpass": 14.0, // Hz
"heartbeat_filtfilt_chuck_size": 10,
// Gauss smear
"gauss_smear_spatial_width": 8,
"gauss_smear_temporal_width": 0.1,
"gauss_smear_use_matlab_mask": false,
// LED Ramp on
"skip_frames_in_the_beginning": 100, // Frames
// PyTorch
"dtype": "float32",
"force_to_cpu": false,
// Save
"save_as_python": true, // produces .npz files (compressed)
"save_as_matlab": false, // produces .hd5 file (compressed)
// Save extra information
"save_alignment": false,
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",
"donor",
"oxygenation",
"volume"
]
}

View file

@ -3,8 +3,8 @@
"recoding_data": "session_B",
"mouse_identifier": "M3905F",
"raw_path": "raw",
"export_path": "output_M3905F_session_B",
"ref_image_path": "ref_images_M3905F_session_B",
"export_path": "output/M3905F_SessionB",
"ref_image_path": "ref_images/M3905F_SessionB",
"raw_path": "raw",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
@ -54,8 +54,9 @@
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": true,
"save_oxyvol_as_matlab": true,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",

View file

@ -1,12 +1,12 @@
{
"basic_path": "/data_1/robert",
"recoding_data": "2021-10-05",
"mouse_identifier": "M3879M",
"basic_path": "/data_1/fatma/GEVI_GECI_ES",
"recoding_data": "session_B",
"mouse_identifier": "M3905F",
"raw_path": "raw",
"export_path": "output_M3879M_2021-10-05",
"ref_image_path": "ref_images_M3879M_2021-10-05",
"heartbeat_remove": true, // if gevi must be true; geci: who knows...
"gevi": true, // true => gevi, false => geci
"export_path": "output/M3905F_SessionB",
"ref_image_path": "ref_images/M3905F_SessionB",
"heartbeat_remove": true,
"gevi": true, // true => gevi, false => geci
// Ratio Sequence
"classical_ratio_mode": true, // true: a/d false: 1+a-d
// Regression
@ -51,6 +51,11 @@
"save_heartbeat": false,
"save_factors": false,
"save_regression_coefficients": false,
"save_aligned_as_python": false,
"save_aligned_as_matlab": false,
"save_oxyvol_as_python": false,
"save_oxyvol_as_matlab": false,
"save_gevi_with_donor_acceptor": true,
// Not important parameter
"required_order": [
"acceptor",

56
gevi/example_load_gevi.py Normal file
View file

@ -0,0 +1,56 @@
# %%
import numpy as np
import matplotlib.pyplot as plt
import os
output_path = 'output'
recording_name = 'M0134M_2024-12-04_SessionA'
n_trials_per_experiment = [30, 0, 30, 30, 30, 30, 30, 30, 30,]
name_experiment = ['none', 'visual', '2 uA', '5 uA', '7 uA', '10 uA', '15 uA', '30 uA', '60 uA']
# recording_name = 'M0134M_2024-11-06_SessionB'
# n_trials_per_experiment = [15, 15,]
# name_experiment = ['none', 'visual',]
i_experiment = 8
r_avg = None
ad_avg = None
for i_trial in range(n_trials_per_experiment[i_experiment]):
folder = output_path + os.sep + recording_name
file = f"Exp{i_experiment + 1:03}_Trial{i_trial + 1:03}_ratio_sequence.npz"
fullpath = folder + os.sep + file
print(f'Loading file "{fullpath}"...')
data = np.load(fullpath)
print(f"FIle contents: {data.files}")
ratio_sequence = data["ratio_sequence"]
if 'data_acceptor' in data.files:
data_acceptor = data["data_acceptor"]
data_donor = data["data_donor"]
mask = data["mask"][:, :, np.newaxis]
if i_trial == 0:
r_avg = ratio_sequence
if 'data_acceptor' in data.files:
ad_avg = (data_acceptor / data_donor) * mask + 1 - mask
else:
r_avg += ratio_sequence
if 'data_acceptor' in data.files:
ad_avg += (data_acceptor / data_donor) * mask + 1 - mask
if r_avg is not None:
r_avg /= n_trials_per_experiment[i_experiment]
if ad_avg is not None:
ad_avg /= n_trials_per_experiment[i_experiment]
# %%
for t in range(200, 300, 5):
plt.imshow(r_avg[:, :, t], vmin=0.99, vmax=1.01, cmap='seismic')
plt.colorbar()
plt.show()

BIN
preprocessing.pdf Normal file

Binary file not shown.

View file

@ -6,15 +6,13 @@ from functions.get_trials import get_trials
from functions.get_experiments import get_experiments
def converter(config_filename: str = "config.json") -> None:
def converter(config_filename: str = "config_M_Sert_Cre_49.json") -> None:
filename: str = config_filename
if os.path.isfile(filename) is False:
print(f"{filename} is missing")
if os.path.isfile(config_filename) is False:
print(f"{config_filename} is missing")
exit()
with open(filename, "r") as file:
with open(config_filename, "r") as file:
config = json.loads(jsmin(file.read()))
raw_data_path: str = os.path.join(
@ -30,6 +28,8 @@ def converter(config_filename: str = "config.json") -> None:
experiments = get_experiments(raw_data_path).numpy()
os.makedirs(config["export_path"], exist_ok=True)
for experiment in experiments:
trials = get_trials(raw_data_path, experiment).numpy()
@ -44,7 +44,10 @@ def converter(config_filename: str = "config.json") -> None:
) as file:
metadata = json.loads(jsmin(file.read()))
filename_out: str = f"meta_{config["mouse_identifier"]}_exp{experiment:03d}.json"
filename_out: str = os.path.join(
config["export_path"],
f"metadata_exp{experiment:03d}.json",
)
with open(filename_out, 'w') as file:
json.dump(metadata, file)