Example #1
0
    'pupil': True,
    'stim': False,
    'rasterfs': rasterfs
}
length = 4 * 5.5  # X stims * 5.5 sec (trial len)
start = int(rasterfs * 240)
end = start + int(length * rasterfs)
twin = (start, end)  # a chunk of data
prestim = 2  #0.25
poststim = 0.5  #0.25
duration = 3
#soundpath = '/auto/users/hellerc/code/baphy/Config/lbhb/SoundObjects/@NaturalSounds/sounds_set4/'
soundpath = '/auto/users/hellerc/code/baphy/Config/lbhb/SoundObjects/@NaturalSounds/sounds/'

rec = nb.baphy_load_recording_file(**options)
rec = preproc.mask_high_repetion_stims(rec)
rec = rec.apply_mask(reset_epochs=True)
rec['resp'] = rec['resp'].extract_channels(rec.meta['cells_to_extract'])

epochs = rec.epochs[rec.epochs.name.str.contains('STIM_')]
epochs = epochs[(epochs.end <= (twin[1] / rasterfs)) & \
                            (epochs.end >= (twin[0] / rasterfs))]

stims = epochs.name
t = epochs[['start', 'end']].values.tolist()
stimulus = []
spk_times = []
# for saving the highlighted data
stim1 = []
stim2 = []
stim3 = []
Example #2
0
    log.info('Computing mod index for site: {0}'.format(site))

    log.info("Saving results to: {}".format(path))

    batch = 289
    fs = 4

    log.info("Load recording")
    ops = {'batch': batch, 'siteid': site, 'rasterfs': fs, 'pupil': 1, 'rem': 1,
        'stim': 1}
    uri = nb.baphy_load_recording_uri(**ops)
    rec = Recording.load(uri)
    rec['resp'] = rec['resp'].rasterize()
    rec['stim'] = rec['stim'].rasterize()
    rec = mask_high_repetion_stims(rec)
    rec = rec.apply_mask(reset_epochs=True)
    rec = rec.create_mask(True)

    if pupil_regress:
         rec = preproc.regress_state2(rec, state_sigs=['pupil'], regress=['pupil'])


    rec = rec.and_mask(['PreStimSilence', 'PostStimSilence'], invert=True)
    rec = rec.apply_mask(reset_epochs=True)

    # Create pupil masks
    p_ops = {'state': 'big', 'epoch': ['REFERENCE'], 'collapse': True}
    rec_bp = preproc.create_pupil_mask(rec, **p_ops)
    p_ops['state'] = 'small'
    rec_sp = preproc.create_pupil_mask(rec, **p_ops)
Example #3
0
win = 15  # total window size (non overlapping across data)
subwin = 0.25  # sub window size (mean rate across all / sd across all)
# CV = sd of spike counts across all subwindows divided by the mean across all sub windows
# If all neurons are Poisson and statistically independent, then the CV of the population rate will approach zero

site = 'TAR010c'
batch = 289

manager = BAPHYExperiment(cellid=site, batch=batch)
options = {'rasterfs': 4, 'resp': True, 'stim': False, 'pupil': True}
rec = manager.get_recording(**options)
rec['resp'] = rec['resp'].rasterize()
if batch == 331:
    rec = nems_preproc.fix_cpn_epochs(rec)
else:
    rec = nems_preproc.mask_high_repetion_stims(rec)
rec = generate_psth_from_resp(rec)

# extract continuous data (subtract psth?)
data = rec.apply_mask()['resp']._data  #- rec.apply_mask()['psth_sp']._data
pupil = rec.apply_mask()['pupil']._data

# divide into bins
win_bin = int(rec['resp'].fs * win)
subwin_bin = int(rec['resp'].fs * subwin)
CV = []
bpupil = []
i = 0
while ((i * win_bin) <= data.shape[-1]):
    mean = data[:, int(i * win_bin):int((i + 1) * win_bin)].mean()
    sd = data[:, int(i * win_bin):int((i + 1) * win_bin)].std()