oruebel / ndx-icephys-meta

NWB extensions for origanizing intracellular electrophysiology metadata
Other
6 stars 0 forks source link

API: add_intracellular_recording #34

Closed t-b closed 4 years ago

t-b commented 4 years ago
nwbfile.add_intracellular_recording(electrode=electrode,
                                    stimulus=stim,
                                    response=resp,
                                    id=sweep_number
                                    )

The valid combinations are:

if stimulus == timeseries and response == timeseries:
   pass
elif response == VoltageClampSeries:
   if stimulus != VoltageClampStimulusSeries:
     raise(...)
elif response == CurrentClampSeries:
   if stimulus != CurrentClampStimulusSeries:
     raise(...)
elif response == IZeroClampSeries:
  if stimulus is not None:
    raise(...)
else:
   raise(...)
bendichter commented 4 years ago

I like these checks, though this would create errors on read for pynwb files that are technically to spec but have one of these mistakes. If a file is written in MatNWB where these checks don't exist, then it may not be able to be read in pynwb. So maybe it's better if we throw warnings instead?

t-b commented 4 years ago

These checks are applied during write in pynwb only. So this should not be a problem for existing buggy data.