예제 #1
0
    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)

    # balanced epochs
    epochs = preproc.get_pupil_balanced_epochs(rec, rec_sp, rec_bp)
    rec_bp = rec_bp.and_mask(epochs)
    rec_sp = rec_sp.and_mask(epochs)
    rec_bp = rec_bp.apply_mask(reset_epochs=True)
    rec_sp = rec_sp.apply_mask(reset_epochs=True)

    # Compute coarse MI for each neuron, over all stimuli (balanced)
    Rbig = rec_bp['resp'].extract_epoch('REFERENCE').mean(0).mean(-1)
    Rsmall = rec_sp['resp'].extract_epoch('REFERENCE').mean(0).mean(-1)

    MI = (Rbig - Rsmall) / (Rbig + Rsmall)

    df = pd.DataFrame(index=rec['resp'].chans, data=MI, columns=['MI'])

    if pupil_regress:
        df.to_csv(path+site+'_pr_MI.csv')
예제 #2
0
    '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 = preproc.generate_psth(rec)

if balance_stims:
    epochs = preproc.get_pupil_balanced_epochs(rec)
    rec = rec.and_mask(epochs)
    rec = rec.apply_mask(reset_epochs=True)
if evoked_only:
    rec = rec.and_mask(['PreStimSilence', 'PostStimSilence'], invert=True)
    rec = rec.apply_mask(reset_epochs=True)

pup_ops = {'state': 'big', 'epoch': ['REFERENCE'], 'collapse': True}
rec_bp = preproc.create_pupil_mask(rec.copy(), **pup_ops)
pup_ops['state'] = 'small'
rec_sp = preproc.create_pupil_mask(rec.copy(), **pup_ops)
big_mask = rec_bp['mask']
small_mask = rec_sp['mask']

# Now, fit the model for the range of alpha2 values