Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
def main():
    # the values for ns_builder are auto-generated from your cookiecutter inputs
    ns_builder = NWBNamespaceBuilder(doc='An NWB:N extension',
                                     name='ndx-experimenters',
                                     version='0.1.0',
                                     author='Ben Dichter',
                                     contact='*****@*****.**')

    # see https://pynwb.readthedocs.io/en/latest/extensions.html#extending-nwb for more information

    nwbfile = NWBGroupSpec(neurodata_type_def='NWBFile_experimenters',
                           neurodata_type_inc='NWBFile',
                           doc='Top level of NWB file.')
    general = nwbfile.add_group(
        name='general',
        doc=
        "Experimental metadata, including protocol, notes and description of hardware"
        "device(s).  COMMENT: The metadata stored in this section should be used to"
        "describe the experiment. Metadata necessary for interpreting the data is stored"
        "with the data. MORE_INFO: General experimental metadata, including animal"
        "strain, experimental protocols, experimenter, devices, etc, are stored under"
        "'general'. Core metadata (e.g., that required to interpret data fields) is"
        "stored with the data itself, and implicitly defined by the file specification"
        "is to use free-form text fields, such as would appear in sentences or paragraphs"
        "from a Methods section. Metadata fields are text to enable them to be more"
        "general, for example to represent ranges instead of numerical values. Machine-readable"
        "metadata is stored as attributes to these free-form datasets. All entries"
        "in the below table are to be included when data is present. Unused groups"
        "(e.g., intracellular_ephys in an optophysiology experiment) should not be"
        "created unless there is data to store within them.")
    general.add_dataset(name='experimenters',
                        shape=(None, ),
                        dtype='text',
                        doc='holds multiple experimenters')

    new_data_types = [nwbfile]

    ns_builder.include_type('NWBFile', namespace='core')

    export_spec(ns_builder, new_data_types)
def main():
    # these arguments were auto-generated from your cookiecutter inputs
    ns_builder = NWBNamespaceBuilder(
        doc='An NWB:N extension for storing bipolar schema',
        name='ndx-bipolar-scheme',
        version='0.1.0',
        author=list(map(str.strip, 'Ben Dichter'.split(','))),
        contact=list(map(str.strip, '*****@*****.**'.split(','))))

    for type_name in ('LabMetaData', 'DynamicTableRegion', 'DynamicTable',
                      'VectorIndex'):
        ns_builder.include_type(type_name, namespace='core')

    ecephys_ext = NWBGroupSpec(
        name='extracellular_ephys_extensions',
        neurodata_type_def='EcephysExt',
        neurodata_type_inc='LabMetaData',
        doc=
        'Group that holds proposed extracellular electrophysiology extensions.'
    )
    bipolar_scheme = ecephys_ext.add_group(
        name='bipolar_scheme',
        neurodata_type_inc='DynamicTable',
        doc='Table that holds information about the bipolar scheme used')
    bipolar_scheme.add_dataset(name='anodes',
                               neurodata_type_inc='DynamicTableRegion',
                               doc='references the electrodes table')
    bipolar_scheme.add_dataset(name='cathode',
                               neurodata_type_inc='DynamicTableRegion',
                               doc='references the electrodes table')

    new_data_types = [ecephys_ext]

    # 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)
Esempio n. 5
0
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)
Esempio n. 6
0
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)
Esempio n. 7
0
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)
Esempio n. 8
0
def main():
    # these arguments were auto-generated from your cookiecutter inputs
    ns_builder = NWBNamespaceBuilder(doc='Data types for recording data from multiple compartments of multiple '
                                         'neurons in a single TimeSeries.',
                                     name='ndx-simulation-output',
                                     version='0.2.6',
                                     author='Ben Dichter',
                                     contact='*****@*****.**')

    types_to_include = ['TimeSeries', 'VectorData', 'VectorIndex', 'DynamicTable', 'LabMetaData']
    for ndtype in types_to_include:
        ns_builder.include_type(ndtype, namespace='core')

    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='Index that 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='Index for 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='Metadata about compartments in this CompartmentSeries.')

    SimulationMetaData = NWBGroupSpec(name='simulation',
                                      neurodata_type_def='SimulationMetaData',
                                      neurodata_type_inc='LabMetaData',
                                      doc='Group that holds metadata for simulations.')
    SimulationMetaData.add_group(name='compartments',
                                 neurodata_type_inc='Compartments',
                                 doc='Table that holds information about what places are being recorded.')

    new_data_types = [Compartments, CompartmentsSeries, SimulationMetaData]

    # 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)