Closed jthermiz closed 3 years ago
Hi @jthermiz, could you try running scripts/generate_nwb.py
, replacing with the line that has use_htk=True
option in the build()
step?
@jihyunbak I did notice that keyword agrument and set it to True,
but the error happens before I call nwb_bulder.build
. The constructor NWBBuilder
fails bc I'm not feeding a a required keyword agrument, nwb_metadata: MetadataManager
. Here's my test case and the error message that's thrown.
Should we modify the NWBBuilder
to make nwb_metadata
an optional arg or have an use_htk
argument for nwb_builder
?
def test_build_nwb_case3_htk(self):
''' build NWB but do not write file to disk '''
animal_name = 'R56'
block = 'B13'
block_name = '{}_{}'.format(animal_name, block)
# create a builder for the block
nwb_builder = NWBBuilder( # <------ Error happens here!
animal_name=animal_name,
block=block,
data_path=self.data_path,
out_path=self.out_path
)
# build the NWB file content
nwb_content = nwb_builder.build(use_htk=True, process_stim=False)
Error Message
Traceback (most recent call last): File "/home/jhermiz/software/nsds_lab_to_nwb/tests/test_build_nwb.py", line 76, in test_build_nwb_case3_htk nwb_builder = NWBBuilder( TypeError: init() missing 1 required positional argument: 'nwb_metadata'
Hi John, the metadata is actually essential for the builder, so we need it for an end-to-end test. Can you add a few lines that creates nwb_metadata
and pass it to the builder? Maybe something like this...
def test_build_nwb_case3_old_htk(self):
''' build NWB but do not write file to disk '''
animal_name = 'R56'
block = 'B13'
block_name = '{}_{}'.format(animal_name, block)
# link to metadata files
block_metadata_path = os.path.join(PWD, f'../yaml/{animal_name}/{animal_name}_{block}.yaml')
library_path = os.path.join(USER_HOME, 'Src/NSDSLab-NWB-metadata/')
# collect metadata needed to build the NWB file
nwb_metadata = MetadataManager(block_name=block_name,
block_metadata_path=block_metadata_path,
library_path=library_path)
# create a builder for the block
nwb_builder = NWBBuilder(
animal_name=animal_name,
block=block,
data_path=self.data_path,
out_path=self.out_path,
nwb_metadata=nwb_metadata
)
# build the NWB file content
nwb_content = nwb_builder.build()
Note that block_name
is a new optional input to MetadataManager, required for the new pipeline (the old pipeline will also accept the input but ignore it).
@jihyun.bak@gmail.com @VBaratham I looked for an existing nwb from htk and I couldn't find one. Does one exist?
I also tried to create one, but I ran into a roadblock. The NWBBuilder requires a MetadataManager object, but I couldn't find how to create one for an htk dataset. Am I missing something trivial?