コード例 #1
0
def main():
    ns_builder = NWBNamespaceBuilder(doc='data type for holding power or phase spectra for a signal',
                                     name='ndx-spectrum',
                                     version='0.2.2',
                                     author='Ben Dichter',
                                     contact='*****@*****.**')

    ns_builder.include_type('NWBDataInterface', namespace='core')
    ns_builder.include_type('TimeSeries', namespace='core')
    ns_builder.include_type('DynamicTableRegion', namespace='core')

    Spectrum = NWBGroupSpec(
        neurodata_type_def='Spectrum',
        neurodata_type_inc='NWBDataInterface',
        doc='type for storing power or phase of spectrum')

    for data_name in ('power', 'phase'):
        Spectrum.add_dataset(
            name=data_name,
            doc='spectrum values',
            dims=(('frequency',), ('frequency', 'channel')),
            shape=((None,), (None, None)),
            dtype='float',
            quantity='?')

    Spectrum.add_dataset(name='frequencies',
                         doc='frequencies of spectrum',
                         dims=('frequency',),
                         shape=(None,),
                         dtype='float')

    Spectrum.add_link(target_type='TimeSeries',
                      doc='timeseries that this spectrum describes',
                      quantity='?',
                      name='source_timeseries')

    Spectrum.add_dataset(name='electrodes',
                         doc='the electrodes that this series was generated from',
                         neurodata_type_inc='DynamicTableRegion',
                         quantity='?')

    new_data_types = [Spectrum]

    # 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)
コード例 #2
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)
コード例 #3
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)
コード例 #4
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)