From 57e9994e06425bfc70e3b14661c0916ce6889a8a Mon Sep 17 00:00:00 2001 From: arielleleon <54869022+arielleleon@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:23:48 -0800 Subject: [PATCH] 11 change json where epoch locations are pulled from (#12) * Edited extraction.py * Edited metadata.yml * Update metadata.yml --- code/extraction.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/extraction.py b/code/extraction.py index 14e4690..7add1a5 100644 --- a/code/extraction.py +++ b/code/extraction.py @@ -220,15 +220,15 @@ def bergamo_segmentation(motion_corr_fp: Path, session: dict, temp_dir: Path) -> path to motion corrected h5 file """ motion_dir = motion_corr_fp.parent - tiff_stem_locs = next(motion_dir.glob("tiff_stem_locations.json")) - with open(tiff_stem_locs, "r") as j: - tiff_stem_locations = json.load(j) + epoch_loc_fp = next(motion_dir.glob("epoch_locations.json")) + with open(epoch_loc_fp, "r") as j: + epoch_locations = json.load(j) valid_epoch_stems = [ i["output_parameters"]["tiff_stem"] for i in session["stimulus_epochs"] if i["stimulus_name"] != "2p photostimulation" ] - frame_locations = [tiff_stem_locations[i] for i in valid_epoch_stems] + frame_locations = [epoch_locations[i] for i in valid_epoch_stems] frames_length = sum([(i[1] - i[0] + 1) for i in frame_locations]) return create_virtual_dataset( @@ -236,6 +236,7 @@ def bergamo_segmentation(motion_corr_fp: Path, session: dict, temp_dir: Path) -> ) + def get_metdata(input_dir: Path) -> Tuple[dict, dict, dict]: """Get the session and data description metadata from the input directory