Exemple #1
0
def _setup(_name, has_masks=True):
    # Create files.
    prm = {'nfeatures': 3, 'waveforms_nsamples': 10, 'nchannels': 3,
           'sample_rate': 20000.,
           'nfeatures_per_channel': 1,
           'has_masks': has_masks
           }
    prb = {0:
        {
            'channels': [4, 6, 8],
            'graph': [[4, 6], [8, 4]],
            'geometry': {4: [0.4, 0.6], 6: [0.6, 0.8], 8: [0.8, 0.0]},
        }
    }
    create_files(_name, dir=DIRPATH, prm=prm, prb=prb)

    # Open the files.
    files = open_files(_name, dir=DIRPATH, mode='a')

    # Add data.
    add_recording(files,
                  sample_rate=20000.,
                  start_time=10.,
                  start_sample=200000.,
                  bit_depth=16,
                  band_high=100.,
                  band_low=500.,
                  nchannels=3,)
    add_event_type(files, 'myevents')
    add_cluster_group(files, channel_group_id='0', id='0', name='Noise')
    add_cluster(files, channel_group_id='0', cluster_group=0)

    # Close the files
    close_files(files)
Exemple #2
0
def _setup(_name, has_masks=True):
    # Create files.
    prm = {'nfeatures': 3, 'waveforms_nsamples': 10, 'nchannels': 3,
           'sample_rate': 20000.,
           'nfeatures_per_channel': 1,
           'has_masks': has_masks
           }
    prb = {0:
        {
            'channels': [4, 6, 8],
            'graph': [[4, 6], [8, 4]],
            'geometry': {4: [0.4, 0.6], 6: [0.6, 0.8], 8: [0.8, 0.0]},
        }
    }
    create_files(_name, dir=DIRPATH, prm=prm, prb=prb)
    
    # Open the files.
    files = open_files(_name, dir=DIRPATH, mode='a')
    
    # Add data.
    add_recording(files, 
                  sample_rate=20000.,
                  start_time=10., 
                  start_sample=200000.,
                  bit_depth=16,
                  band_high=100.,
                  band_low=500.,
                  nchannels=3,)
    add_event_type(files, 'myevents')
    add_cluster_group(files, channel_group_id='0', id='0', name='Noise')
    add_cluster(files, channel_group_id='0', cluster_group=0)
    
    # Close the files
    close_files(files)
def _setup(_name, has_masks=True):
    # Create files.
    prm = {
        'nfeatures': 3 * 3,
        'waveforms_nsamples': 10,
        'nchannels': 3,
        'sample_rate': 20000.,
        'nfeatures_per_channel': 3,
        'has_masks': has_masks
    }
    prb = {
        0: {
            'channels': [0, 1, 2],
            'graph': [[0, 1], [0, 2]],
            'geometry': {
                0: [0.4, 0.6],
                1: [0.6, 0.8],
                2: [0.8, 0.0]
            },
        }
    }
    create_files(_name, dir=DIRPATH, prm=prm, prb=prb)

    # Open the files.
    files = open_files(_name, dir=DIRPATH, mode='a')

    # Add data.
    add_recording(
        files,
        sample_rate=20000.,
        bit_depth=16,
        band_high=100.,
        band_low=500.,
        nchannels=3,
    )
    add_event_type(files, 'myevents')
    add_cluster_group(files, channel_group_id='0', id='0', name='Noise')
    add_cluster_group(files, channel_group_id='0', id='1', name='MUA')
    add_cluster_group(files, channel_group_id='0', id='2', name='Good')
    add_cluster_group(files, channel_group_id='0', id='3', name='Unsorted')
    add_cluster(files, channel_group_id='0', cluster_group=0)

    add_spikes(
        files,
        channel_group_id='0',
        cluster=np.random.randint(5, 10, 1000),
        time_samples=np.cumsum(np.random.randint(0, 1000,
                                                 1000)).astype(np.int64),
        features=np.random.randint(-30000, 30000, (1000, 9)).astype(np.int16),
        masks=np.random.randint(0, 2, (1000, 9)).astype(np.int16),
    )

    # Close the files
    close_files(files)
def _setup(_name, has_masks=True):
    # Create files.
    prm = {
        "nfeatures": 3 * 3,
        "waveforms_nsamples": 10,
        "nchannels": 3,
        "sample_rate": 20000.0,
        "nfeatures_per_channel": 3,
        "has_masks": has_masks,
    }
    prb = {
        0: {"channels": [0, 1, 2], "graph": [[0, 1], [0, 2]], "geometry": {0: [0.4, 0.6], 1: [0.6, 0.8], 2: [0.8, 0.0]}}
    }
    create_files(_name, dir=DIRPATH, prm=prm, prb=prb)

    # Open the files.
    files = open_files(_name, dir=DIRPATH, mode="a")

    # Add data.
    add_recording(files, sample_rate=20000.0, bit_depth=16, band_high=100.0, band_low=500.0, nchannels=3)
    add_event_type(files, "myevents")
    add_cluster_group(files, channel_group_id="0", id="0", name="Noise")
    add_cluster_group(files, channel_group_id="0", id="1", name="MUA")
    add_cluster_group(files, channel_group_id="0", id="2", name="Good")
    add_cluster_group(files, channel_group_id="0", id="3", name="Unsorted")
    add_cluster(files, channel_group_id="0", cluster_group=0)

    add_spikes(
        files,
        channel_group_id="0",
        cluster=np.random.randint(5, 10, 1000),
        time_samples=np.cumsum(np.random.randint(0, 1000, 1000)).astype(np.int64),
        features=np.random.randint(-30000, 30000, (1000, 9)).astype(np.int16),
        masks=np.random.randint(0, 2, (1000, 9)).astype(np.int16),
    )

    # Close the files
    close_files(files)