BouchardLab / nsds_lab_to_nwb

Python package to convert NSDS Lab data to NWB files.
https://nsds-lab-to-nwb.readthedocs.io/en/latest/
0 stars 4 forks source link

fix exp_note path parsing error in MetadataManager #98

Closed jihyunbak closed 3 years ago

jihyunbak commented 3 years ago

Another quick bug-fix PR. This fixes a path parsing error in MetadataManager, when it attempts to look for an Experiment_Notes file (when the block metadata yaml is not already available).

The (corrected) parsing code in MetadataReader.load_metadata_source() does

block_path_full, block_metadata_file = os.path.split(self.block_metadata_path)
experiment_path, _ = os.path.split(block_path_full)
...

For example if the block is RVG21_B10, the parsed paths are

block_metadata_path = '/somepath/RVG21/RVG21_B10/RVG21_B10.yaml'

# split once
block_path_full = '/somepath/RVG21/RVG21_B10/'
block_metadata_file = 'RVG21_B10.yaml'

# split again
experiment_path = '/somepath/RVG21/'

We are expecting to find a RVG21_Experiment_Notes.ods file under the experiment_path.

Before the fix, the experiment_path was incorrectly parsed to be /somepath/RVG21/RVG21_B10/ (split only once).