Example #1
0
sys.path.append('/auto/users/hellerc/code/projects/PTD/')
import ptd_utils as pu
import pandas as pd

sites = [
    'TAR010c', 'BRT026c', 'BRT033b', 'BRT034f', 'BRT036b', 'BRT037b',
    'BRT039c', 'bbl102d', 'AMT018a', 'AMT020a', 'AMT022c', 'AMT026a'
]

fs = 20
batch = 307
results = pd.DataFrame(
    index=sites, columns=['DI', 'dprime', 'targets', 'all_DI', 'all_dprime'])
for site in sites:
    rawid = tuple(pu.which_rawids(site))

    manager = BAPHYExperiment(batch=batch, siteid=site, rawid=rawid)

    options = {
        'rasterfs': fs,
        'batch': batch,
        'siteid': site,
        'keep_following_incorrect_trial': False,
        'keep_early_trials': False
    }
    correct_trials = manager.get_behavior_performance(**options)

    options = {
        'rasterfs': fs,
        'batch': batch,
Example #2
0
import ptd_utils as pu
import charlieTools.preprocessing as preproc
import charlieTools.discrimination_tools as di
import charlieTools.plotting as cplt
import charlieTools.simulate_data as sim
import matplotlib as mp

mp.rcParams.update({'svg.fonttype': 'none'})

fn = '/auto/users/hellerc/code/projects/Cosyne2020_poster/svgs/dec_cv_example.svg'

site = 'TAR010c'
nPCs = 4
batch = 307
fs = 20
rawid = pu.which_rawids(site)
ops = {
    'batch': batch,
    'pupil': 1,
    'rasterfs': fs,
    'siteid': site,
    'stim': 0,
    'rawid': rawid
}
uri = nb.baphy_load_recording_uri(**ops)
rec = Recording.load(uri)
rec['resp'] = rec['resp'].rasterize()
rec = rec.and_mask(['HIT_TRIAL', 'MISS_TRIAL', 'PASSIVE_EXPERIMENT'])

rec = rec.and_mask(['PreStimSilence', 'PostStimSilence'], invert=True)
rec = rec.apply_mask(reset_epochs=True)
sites = ['TAR010c', 'BRT026c', 'BRT033b', 'BRT034f', 'BRT036b', 'BRT037b',
    'BRT039c', 'bbl102d', 'AMT018a', 'AMT020a', 'AMT022c', 'AMT026a']
batch = 307
cells = [c for c in nd.get_batch_cells(batch).cellid if c[:7] in sites]
fs = 1000

save_fn = '/auto/users/hellerc/results/Cosyne2020_poster/single_cell_analyses/strfs/{}_cache.pickle'

df = pd.DataFrame(index=cells, columns=['BF', 'SNR', 'STRF', 'StimParms'])
dfa = pd.DataFrame(index=cells, columns=['BF', 'SNR', 'STRF', 'StimParms'])
dfp = pd.DataFrame(index=cells, columns=['BF', 'SNR', 'STRF', 'StimParms'])
dfpb = pd.DataFrame(index=cells, columns=['BF', 'SNR', 'STRF', 'StimParms'])
dfps = pd.DataFrame(index=cells, columns=['BF','SNR', 'STRF', 'StimParms'])
for s in sites:
    
    rawid = pu.which_rawids(s)
    ops = {'batch': batch, 'pupil': 1, 'rasterfs': fs, 'siteid': s, 'stim': 0,
            'rawid': rawid}
    uri = nb.baphy_load_recording_uri(**ops)
    rec = Recording.load(uri)
 
    rec = preproc.create_ptd_masks(rec)

    ra = rec.copy()
    ra['mask'] = ra['a_mask']
    ra = ra.apply_mask(reset_epochs=True)
    
    rp = rec.copy()
    rp['mask'] = rp['p_mask']
    rp = rp.apply_mask(reset_epochs=True)