From ab5a68294ae6c74bfa664069eb75f6132a2ffe31 Mon Sep 17 00:00:00 2001 From: Ji Hyun Bak Date: Thu, 12 Nov 2020 14:33:40 -0800 Subject: [PATCH] add method get_nwb_builder to RawToNWBBuilder --- .../processing/builder/raw_to_nwb_builder.py | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/rec_to_nwb/processing/builder/raw_to_nwb_builder.py b/rec_to_nwb/processing/builder/raw_to_nwb_builder.py index 8e2c08a5a..419b1d45b 100644 --- a/rec_to_nwb/processing/builder/raw_to_nwb_builder.py +++ b/rec_to_nwb/processing/builder/raw_to_nwb_builder.py @@ -160,18 +160,7 @@ def __build_nwb_file(self, process_mda_valid_time=True, process_mda_invalid_time os.makedirs(self.video_path, exist_ok=True) for date in self.dates: logger.info('Date: {}'.format(date)) - nwb_builder = NWBFileBuilder( - data_path=self.data_path, - animal_name=self.animal_name, - date=date, - nwb_metadata=self.nwb_metadata, - output_file=self.output_path + self.animal_name + date + ".nwb", - process_mda=self.extract_mda, - process_dio=self.extract_dio, - process_analog=self.extract_analog, - video_path=self.video_path, - reconfig_header=self.__is_rec_config_valid() - ) + nwb_builder = self.get_nwb_builder(date) content = nwb_builder.build() nwb_builder.write(content) self.append_to_nwb( @@ -182,6 +171,20 @@ def __build_nwb_file(self, process_mda_valid_time=True, process_mda_invalid_time process_pos_invalid_time=process_pos_invalid_time ) + def get_nwb_builder(self, date): + return NWBFileBuilder( + data_path=self.data_path, + animal_name=self.animal_name, + date=date, + nwb_metadata=self.nwb_metadata, + output_file=self.output_path + self.animal_name + date + ".nwb", + process_mda=self.extract_mda, + process_dio=self.extract_dio, + process_analog=self.extract_analog, + video_path=self.video_path, + reconfig_header=self.__is_rec_config_valid() + ) + def __preprocess_data(self): """process data with rec_to_binaries library"""