exc,
                                             force_replace=True,
                                             win=10)

# %%

pns = dataloc.raw_csv(newbase, inc[0], exc[0])
if not isinstance(pns, list):
    pns = [pns]
saveit = True
closeit = True
for pn in pns:
    df, meta = ethovision_tools.csv_load(pn, columns='All', method='preproc')
    plots.plot_openloop_day(df,
                            meta,
                            save=saveit,
                            close=closeit,
                            save_dir=pn.parent)

# %%

analysis = 'Str_A2a_ChR2_1mw'
behavior_str = '10x'

fn = '%s_openloop_data' % analysis
qans = [
    'AG3233_5',
    'AG3233_4',
    'AG3488_7',
]
inc, exc, color, example_mouse = dataloc.experiment_selector(
ethovision_tools.unify_raw_to_csv(basepath,
                                  inc,
                                  exc,
                                  force_replace=False,
                                  win=10)
ethovision_tools.raw_csv_to_preprocessed_csv(basepath,
                                             inc,
                                             exc,
                                             force_replace=False,
                                             win=10)
for ii, ee in zip(inc, exc):
    pns = dataloc.raw_csv(basepath, ii, ee)
    for pn in pns:
        temp = {}
        raw, meta = ethovision_tools.csv_load(pn, method='preproc')
        plots.plot_openloop_day(raw, meta)
# %%

# def test_batch_analyze(inc,exc):

data = pd.DataFrame([],
                    columns=[
                        'anid', 'proto', 'cell_area_opsin', 'amb_vel',
                        'amb_meander', 'amb_bouts', 'amb_directed'
                    ])
temp = data
min_bout = 1
use_dlc = False
use_cols = ['time', 'vel', 'im', 'dir', 'ambulation', 'meander']
for ii, ee in zip(inc, exc):
    pns = dataloc.raw_csv(basepath, ii, ee)
Example #3
0
inc = [
    [
        'AG',
        '10x10_gpe_pbs',
    ],
]
exc = [ex0]
basepath = '/home/brian/Dropbox/Gittis Lab Data/OptoBehavior/'

for ii, ee in zip(inc, exc):
    pns = dataloc.raw_csv(basepath, ii, ee)

    for pn in pns:
        temp = {}
        raw, meta = ethovision_tools.csv_load(pn, method='preproc')
        plots.plot_openloop_day(raw, meta, save=True, close=False)

# %% Combined openloop day summary:
inc = [
    [
        'AG',
        '10x10_gpe_pbs',
    ],
]
exc = [[
    'exclude', 'and_GPe', 'and_Str', 'Left', 'Right', 'Other XLS', 'Exclude',
    'mW', 'mw', 'AG6343'
]]
data = behavior.open_loop_summary_collect(basepath, [inc[0]], [exc[0]])
# %%
fig = plots.plot_openloop_mouse_summary(data)
import time

# %% Plot one 10x30 experiment day
inc = [['AG', 'Str', 'A2A', 'Ai32', 'hm4di_cno', '10x10']]
exc = [['exclude', '_and_Str', 'Left', 'Right', 'Other XLS', 'Exclude']]
basepath = '/home/brian/Dropbox/Gittis Lab Data/OptoBehavior/'
pns = dataloc.raw_csv(basepath, inc[0], exc[0])
# a=time.time()
df, meta = ethovision_tools.csv_load(pns[2], columns='All', method='raw')
df, meta = behavior.preproc_raw(df, meta)
# b=time.time()
print('%2.2f seconds to load' % (b - a))
# raw=ethovision_tools.add_amb_to_raw(raw,meta)

#The magic:
plots.plot_openloop_day(df, meta, save=True)

# %% Debug new metric: meander
#DLC Measure:
dir_smooth = behavior.smooth_direction(raw, meta, use_dlc=True)
dir_smooth_etho = behavior.smooth_direction(raw, meta)

diff_angle = signal.angle_vector_delta(dir_smooth[0:-1],
                                       dir_smooth[1:],
                                       thresh=20,
                                       fs=meta['fs'][0])
meander = behavior.measure_meander(raw, meta, use_dlc=True)
dist = raw['vel'] * (1 / meta.fs[0])
plt.close('all')
fig = plt.figure(figsize=(5, 10))
ax1 = plt.subplot(3, 1, 1)
Example #5
0
# exc=[ex0]
# inc=[['AG','Str','A2A','Ai32','10x10','0p25mw']]

analysis = 'GPe_A2a_ChR2_2mw'
b = '10x'
inc, exc, color, example_mouse = dataloc.experiment_selector(analysis,
                                                             behavior_str=b)
inc = inc[1] + ['AG7192']
pns = dataloc.raw_csv(basepath, inc[0], exc[0])
if not isinstance(pns, list):
    pns = [pns]
saveit = True
closeit = False
for pn in pns:
    df, meta = ethovision_tools.csv_load(pn, columns='All', method='preproc')
    plots.plot_openloop_day(df, meta, save=saveit, close=closeit)

# %% Plot zone day
# inc=[['AG','Str','A2A','Ai32','zone_2','_0p5mw']]

analysis = 'GPe_A2a_ChR2_0p25mw'
behavior_str = 'zone_'  #'10x'
inc, exc, color, example_mouse = dataloc.experiment_selector(
    analysis, behavior_str=behavior_str)
inc[1] += ['AG7128']
pns = dataloc.raw_csv(basepath, inc[0], exc[0])

if not isinstance(pns, list):
    pns = [pns]
saveit = True
closeit = False