-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from catalystneuro/convert_all_sessions_Lohani22
Add all sessions conversion script for Lohani22
- Loading branch information
Showing
7 changed files
with
63 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 40 additions & 11 deletions
51
src/higley_lab_to_nwb/lohani_2022/lohani_2022_convert_all_sessions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,54 @@ | ||
"""Primary script to run to convert an entire session for of data using the NWBConverter.""" | ||
|
||
from pathlib import Path | ||
from typing import Union | ||
import os | ||
from .lohani_2022_convert_session import session_to_nwb | ||
|
||
from parse import parse | ||
from lohani_2022_convert_session import session_to_nwb | ||
|
||
from nwbinspector import inspect_all | ||
from nwbinspector.inspector_tools import save_report, format_messages | ||
|
||
# Parameters for conversion | ||
root_path = Path("/media/amtra/Samsung_T5/CN_data") | ||
root_path = Path("F:") | ||
data_dir_path = root_path / "Higley-CN-data-share" | ||
output_dir_path = root_path / "Higley-conversion_nwb/" | ||
stub_test = False | ||
verbose = True | ||
|
||
session_folder_format = "{date_string}_{subject_id}_{behavior_type}" | ||
|
||
raw_imaging_dir_path = data_dir_path / "Lohani22 Meso Data" | ||
for folder_path in raw_imaging_dir_path.iterdir(): | ||
if folder_path.is_dir(): | ||
session_id = folder_path.name | ||
metadata = parse(session_folder_format, session_id) | ||
if verbose: | ||
print("-" * 80) | ||
print(f"Converting session {session_id}") | ||
|
||
session_ids = os.listdir(data_dir_path) | ||
stub_test = True | ||
for session_id in session_ids: | ||
session_folder = data_dir_path / Path(session_id) | ||
if os.path.isdir(session_folder): | ||
subject_id = metadata["subject_id"] | ||
parcellation_folder_path = ( | ||
data_dir_path | ||
/ "Lohani22 Parcellated data" | ||
/ f"{subject_id.replace('AM', '')}" | ||
/ "imaging with 575 excitation" | ||
/ session_id | ||
) | ||
session_to_nwb( | ||
folder_path=session_folder, | ||
folder_path=folder_path, | ||
parcellation_folder_path=parcellation_folder_path, | ||
output_dir_path=output_dir_path, | ||
session_id=session_id, | ||
stub_test=stub_test, | ||
verbose=verbose, | ||
) | ||
|
||
report_path = output_dir_path / "inspector_result.txt" | ||
if not report_path.exists(): | ||
results = list(inspect_all(path=output_dir_path)) | ||
save_report( | ||
report_file_path=report_path, | ||
formatted_messages=format_messages( | ||
results, | ||
levels=["importance", "file_path"], | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
src/higley_lab_to_nwb/lohani_2022/lohani_2022_requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
nwb-conversion-tools==0.11.1 # Example of specific pinned dependecy | ||
some-extra-package==1.11.3 # Example of another extra package that's necessary for the current conversion | ||
roiextractors | ||
neuroconv @ git+https://github.com/catalystneuro/neuroconv.git@facemap | ||
ndx-facemap-motionsvd @ git+https://github.com/catalystneuro/ndx-facemap-motionsvd.git@main | ||
neo | ||
ndx-facemap-motionsvd@git+https://github.com/catalystneuro/ndx-facemap-motionsvd.git@main | ||
spikeinterface | ||
ndx-events@git+https://github.com/rly/ndx-events.git@main | ||
sonpy | ||
opencv-python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters