def main(): ns_builder = NWBNamespaceBuilder(doc='transcriptions and other speech-related data', name='speech', version='0.1.1', author='Ben Dichter', contact='*****@*****.**') Transcription = NWBGroupSpec(neurodata_type_def='Transcription', neurodata_type_inc='NWBDataInterface', name='transcription', doc='holds tiers for different levels of transcription (e.g. sentence, word, phoneme)') Transcription.add_attribute(name='help', dtype='text', value='holds tiers for different levels of transcription', doc='doc') Transcription.add_attribute(name='settings', dtype='text', required=False, doc='text field for entering any algorithms and settings used for automatic transcription') for feature_type in ('phoneme_features', 'phonemes', 'syllables', 'words', 'sentences'): intervals = Transcription.add_group(name=feature_type, neurodata_type_inc='TimeIntervals', quantity='?', doc='label, start, and stop times for ' + feature_type) intervals.add_attribute(name='help', dtype='text', value='holds ' + feature_type + ' tier times', doc='doc') new_data_types = [Transcription] ns_builder.include_type('NWBDataInterface', namespace='core') ns_builder.include_type('TimeIntervals', namespace='core') export_spec(ns_builder, new_data_types)
def main(): ns_builder = NWBNamespaceBuilder( doc='holds metadata relevant for miniscope acquisition', name='ndx-miniscope', version='0.2.2', author='Ben Dichter', contact='*****@*****.**') Miniscope = NWBGroupSpec( neurodata_type_def='Miniscope', neurodata_type_inc='Device', doc='extension of Device to hold metadata specific to Miniscopes') Miniscope.add_attribute(name='excitation', doc='magnitude of excitation', dtype='int', required=False) Miniscope.add_attribute(name='msCamExposure', doc='exposure of camera (max=255)', dtype='int', required=False) ns_builder.include_type('Device', namespace='core') export_spec(ns_builder, [Miniscope])
def main(): # the values for ns_builder are auto-generated from your cookiecutter inputs ns_builder = NamespaceBuilder(doc='General framework for storing nonrigid motion correction of optical imaging in ' 'NWB:N 2.0', name='ndx-nonrigid-motion-correction', version='0.1.0', author='Ben Dichter', contact='*****@*****.**') # see https://pynwb.readthedocs.io/en/latest/extensions.html#extending-nwb for more information nmc = NWBGroupSpec( neurodata_type_def='NonrigidMotionCorrection', neurodata_type_inc='NWBDataInterface', doc='General framework for storing nonrigid motion correction of optical imaging in NWB:N 2.0', ) # I think it may make more sense to store pixel_map as an x*y*z array and convert to your form nmc.add_dataset(name='pixel_map', dtype='int', shape=((None, None), (None, None, None)), dims=(('x', 'y'), ('x', 'y', 'z')), doc="A mapping function of pixels onto basis variables. To be fully general, this is a sparse " "matrix (AxBxC) (number of voxels in each of the spatial dimensions). In standard " "blockwise motion correction, this matrix is a matrix of ones. In CNMF's patches, this matrix " "is a labels each non-overlapping patch with a unique int") nmc.add_dataset(name='data', dtype='float', shape=(None, None), dims=('time', 'nblocks * ndims'), doc="A set of (NxM) basis variables where N is the number of blocks, M is the number of spatial " "dimensions (1 to 3) each defined for a set of times T (for the number of time-steps). In " "standard block-wise motion correction, N = 1, in line-by-line motion correction, N = number of" " lines, in CNMF's non-rigid motion correction, N = number of patches") nmc.add_attribute(name='interpolation_type', dtype='text', doc="the relationship between expected shifts and the estimated movie value. This will frequently" " be either nearest neighbor (common), 1 pixel local interpolation (most common), or some " "other interpolation function (least common, such as MATLAB's 3d gridded interpolation)", default_value='local_interpolation') nmc.add_attribute(name='spatial_dimensions', dtype='int', shape=((2,), (3,)), dims=('x, y', 'x, y, z'), doc='number of pixels in each spatial dimension') nmc.add_attribute(name='nblocks', dtype='int', doc='number of blocks') new_data_types = [nmc] ns_builder.include_type('TimeSeries', namespace='core') export_spec(ns_builder, new_data_types)
# Create a builder for the namespace ns_builder = NWBNamespaceBuilder(doc='Extension for uobrainflex metadata', name='uobrainflex_metadata', version='1.0', author='Santiago Jaramillo') # Create extension LabMetaData_ext = NWBGroupSpec( doc='Extension for uobrainflex metadata', neurodata_type_def='LabMetaData_ext', neurodata_type_inc='LabMetaData', ) LabMetaData_ext.add_attribute( name='rig', doc='Rig where data was collected.', dtype='text', shape=None, ) LabMetaData_ext.add_attribute( name='session_type', doc='Type of behavior session.', dtype='text', shape=None, ) LabMetaData_ext.add_attribute( name='training_stage', doc='Stage of behavioral training.', dtype='text', shape=None,
def main(): ns_builder = NWBNamespaceBuilder(doc='type for storing time-varying FRET data', name='ndx-fret', version='0.2.1', author=['Luiz Tauffer', 'Ben Dichter'], contact=['*****@*****.**', '*****@*****.**']) ns_builder.include_type('NWBDataInterface', namespace='core') ns_builder.include_type('ImageSeries', namespace='core') ns_builder.include_type('OpticalChannel', namespace='core') ns_builder.include_type('Device', namespace='core') # Define FRETSeries, type that stores Donor/Acceptor specific information FRETSeries = NWBGroupSpec( neurodata_type_def='FRETSeries', neurodata_type_inc='ImageSeries', doc='Donor/Acceptor specific information.', ) FRETSeries.add_attribute( name='fluorophore', doc='Fluorophore name.', dtype='text', shape=None, ) FRETSeries.add_group( name='optical_channel', doc='Group storing channel specific data', neurodata_type_inc='OpticalChannel', ) FRETSeries.add_link( name='device', doc='The device that was used to record.', target_type='Device', ) # Defines FRET, DataInterface that holds metadata and data for FRET experiments FRET = NWBGroupSpec( doc='type for storing time-varying FRET data', neurodata_type_def='FRET', neurodata_type_inc='NWBDataInterface', ) FRET.add_attribute( name='excitation_lambda', doc='Excitation wavelength in nm.', dtype='float', shape=None, ) FRET.add_attribute( name='location', doc='Location of imaging field.', dtype='text', shape=None, required=False, ) FRET.add_group( name='donor', doc='Group storing donor data', neurodata_type_inc='FRETSeries', ) FRET.add_group( name='acceptor', doc='Group storing acceptor data', neurodata_type_inc='FRETSeries', ) new_data_types = [FRET, FRETSeries] # export the spec to yaml files in the spec folder output_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'spec')) export_spec(ns_builder, new_data_types, output_dir)
def main(): ns_builder = NWBNamespaceBuilder( doc='type for storing metadata for Tank lab', name='ndx-tank-metadata', version='0.1.0', author=['Szonja Weigl', 'Luiz Tauffer', 'Ben Dichter'], contact=['*****@*****.**']) ns_builder.include_type('LabMetaData', namespace='core') ns_builder.include_type('DynamicTable', namespace='core') LabMetaDataExtension = NWBGroupSpec( doc='type for storing metadata for Tank lab', neurodata_type_def='LabMetaDataExtension', neurodata_type_inc='LabMetaData', ) LabMetaDataExtension.add_attribute( name='experiment_name', doc='name of experiment run', dtype='text', ) LabMetaDataExtension.add_attribute( name='world_file_name', doc='name of world file run', dtype='text', ) LabMetaDataExtension.add_attribute( name='protocol_name', doc='name of protocol run', dtype='text', ) LabMetaDataExtension.add_attribute( name='stimulus_bank_path', doc='path of stimulus bank file', dtype='text', ) LabMetaDataExtension.add_attribute( name='commit_id', doc='Commit id for session run', dtype='text', ) LabMetaDataExtension.add_attribute( name='location', doc='Name of rig where session was run', dtype='text', ) LabMetaDataExtension.add_attribute( name='session_performance', doc='Performance of correct responses in %', dtype='float', required=False) LabMetaDataExtension.add_attribute( name='session_end_time', doc='Datetime when session ended', dtype='text', # temporary solution until datetime is fixed ) LabMetaDataExtension.add_attribute( name='num_trials', doc='Number of trials during the session', dtype='int', ) RigExtension = NWBGroupSpec( doc='type for storing rig information', neurodata_type_def='RigExtension', neurodata_type_inc='LabMetaData', ) rig_attr = [('rig', 'text'), ('simulationMode', 'int'), ('hasDAQ', 'int'), ('hasSyncComm', 'int'), ('minIterationDT', 'float'), ('arduinoPort', 'text'), ('sensorDotsPerRev', 'float'), ('ballCircumference', 'float'), ('toroidXFormP1', 'float'), ('toroidXFormP2', 'float'), ('colorAdjustment', 'float'), ('soundAdjustment', 'float'), ('nidaqDevice', 'int'), ('nidaqPort', 'int'), ('nidaqLines', 'int'), ('syncClockChannel', 'int'), ('syncDataChannel', 'int'), ('rewardChannel', 'int'), ('rewardSize', 'float'), ('rewardDuration', 'float'), ('laserChannel', 'int'), ('rightPuffChannel', 'int'), ('leftPuffChannel', 'int'), ('webcam_name', 'text')] for attr in rig_attr: if attr[0] in ['sensorDotsPerRev', 'colorAdjustment', 'nidaqLines']: RigExtension.add_attribute(name=attr[0], doc='rig information', dtype=attr[1], shape=(None, ), required=False) else: RigExtension.add_attribute(name=attr[0], doc='rig information', dtype=attr[1], required=False) LabMetaDataExtension.add_group( name='rig', neurodata_type_inc='RigExtension', doc='type for storing rig information', ) MazeExtension = NWBGroupSpec( doc='type for storing maze information', neurodata_type_def='MazeExtension', neurodata_type_inc='DynamicTable', ) LabMetaDataExtension.add_group( name='mazes', neurodata_type_inc='MazeExtension', doc='type for storing maze information', ) # export the extension to yaml files in the spec folder output_dir = os.path.abspath( os.path.join(os.path.dirname(__file__), '..', '..', 'spec')) export_spec(ns_builder, [LabMetaDataExtension, RigExtension, MazeExtension], output_dir)
def main(): ns_builder = NWBNamespaceBuilder( doc= 'Holds structures for recording data from multiple compartments of multiple ' 'neurons in a single TimeSeries', name='ndx-simulation-output', version='0.2.2', author='Ben Dichter', contact='*****@*****.**') Compartments = NWBGroupSpec( default_name='compartments', neurodata_type_def='Compartments', neurodata_type_inc='DynamicTable', doc='table that holds information about what places are being recorded' ) Compartments.add_dataset( name='number', neurodata_type_inc='VectorData', dtype='int', doc='cell compartment ids corresponding to a each column in the data') Compartments.add_dataset(name='number_index', neurodata_type_inc='VectorIndex', doc='maps cell to compartments', quantity='?') Compartments.add_dataset( name='position', neurodata_type_inc='VectorData', dtype='float', quantity='?', doc= 'position of recording within a compartment. 0 is close to soma, 1 is other end' ) Compartments.add_dataset(name='position_index', neurodata_type_inc='VectorIndex', doc='indexes position', quantity='?') Compartments.add_dataset(name='label', neurodata_type_inc='VectorData', doc='labels for compartments', dtype='text', quantity='?') Compartments.add_dataset(name='label_index', neurodata_type_inc='VectorIndex', doc='indexes label', quantity='?') CompartmentsSeries = NWBGroupSpec( neurodata_type_def='CompartmentSeries', neurodata_type_inc='TimeSeries', doc='Stores continuous data from cell compartments') CompartmentsSeries.add_link( name='compartments', target_type='Compartments', quantity='?', doc='meta-data about compartments in this CompartmentSeries') SimulationMetaData = NWBGroupSpec( name='simulation', neurodata_type_def='SimulationMetaData', neurodata_type_inc='LabMetaData', doc='group that holds metadata for simulation') SimulationMetaData.add_group( name='compartments', neurodata_type_inc='Compartments', doc='table that holds information about what places are being recorded' ) SimulationMetaData.add_attribute( name='help', dtype='text', doc='help', value='container for simulation meta-data that goes in /general') new_data_types = [Compartments, CompartmentsSeries, SimulationMetaData] types_to_include = [ 'TimeSeries', 'VectorData', 'VectorIndex', 'DynamicTable', 'LabMetaData' ] for ndtype in types_to_include: ns_builder.include_type(ndtype, namespace='core') export_spec(ns_builder, new_data_types)
def main(): # the values for ns_builder are auto-generated from your cookiecutter inputs ns_builder = NWBNamespaceBuilder(doc='An NWB:N extension', name='ndx-task', version='0.1.0', author='Ben Dichter', contact='*****@*****.**') # see https://pynwb.readthedocs.io/en/latest/extensions.html#extending-nwb for more information task = NWBGroupSpec(neurodata_type_def='Task', neurodata_type_inc='NWBDataInterface', doc='task information') task.add_attribute(name='description', doc='describe the task', dtype='text', required=True) task.add_attribute(name='category', doc='free category field', dtype='text', required=False) task.add_attribute(name='help', doc='help', dtype='text', value='stores data about a specific task') task.add_attribute(name='auditory', doc='experiment involves auditory stimuli', dtype='bool', required=False) task.add_attribute(name='visual', doc='experiment involves visual stimuli', dtype='bool', required=False) task.add_attribute(name='decision', doc='experiment involves decision making', dtype='bool', required=False) task.add_attribute(name='navigation', doc='experiment involves a navigation task', dtype='bool', required=False) task.add_attribute(name='rest', doc='experiment involves no task or stimuli', dtype='bool', required=False) task.add_attribute(name='motor', doc='experiment involves a fine motor task', dtype='bool', required=False) task.add_attribute(name='olfactory', doc='experiment involves olfactory stimuli', dtype='bool', required=False) task.add_attribute(name='speech production', doc='experiment involves speaking', dtype='bool', required=False) task.add_attribute(name='speech perception', doc='experiment involves ', dtype='bool', required=False) tasks = NWBGroupSpec(neurodata_type_def='Tasks', neurodata_type_inc='LabMetaData', doc='holds task objects') tasks.add_group(neurodata_type_inc='Tasks', quantity='*', doc='task information') tasks.add_attribute(name='help', doc='help', dtype='text', value='stores Task objects') new_data_types = [task, tasks] ns_builder.include_type('NWBDataInterface', namespace='core') ns_builder.include_type('LabMetaData', namespace='core') export_spec(ns_builder, new_data_types)