"""
Show selective ref/Tar enhancement by active engagement 
and ref/ref enhancement by arousal.

Do ref/Tar with grouping ref, but could also do refs independently...
"""

import loading as ld
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import charlieTools.plotting as cplt

ap_df = ld.load_dprime('refTar_pca3_dprime_act_pass_sim2_LDA_binPreLick')
apb_df = ld.load_dprime('refTar_pca3_dprime_bigPass_smallPass_sim2_LDA_binPreLick')
aps_df = ld.load_dprime('refTar_pca3_dprime_act_smallPass_sim2_LDA_binPreLick')

# remove outliers
all_dprime = pd.concat([ap_df['dprime'], apb_df['dprime'], aps_df['dprime']], axis=1)
iv_mask = (all_dprime > 3 * np.nanstd(all_dprime.values)).sum(axis=1) | np.isnan(all_dprime).sum(axis=1).astype(bool)
print("removing {} percent of results".format(round(100 * iv_mask.sum() / all_dprime.shape[0], 3)))

a_axis = 'ssa'
p_axis = 'ssa'
pb_axis = 'ssa'
ps_axis = 'ssa'
metric = 'dprime'

ap_df = ap_df[~iv_mask]
apb_df = apb_df[~iv_mask]
aps_df = aps_df[~iv_mask]
예제 #2
0
"""
Raw dprime results for a vs. bp, bp vs. sp, ref/tar and ref/ref. 
Scatter plots (2x2), two bar plots (one for ref/tar one for ref/ref), 
two bars each (one for act/big and one for big/small)
"""
import loading as ld
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import charlieTools.plotting as cplt
import matplotlib as mp
mp.rcParams.update({'svg.fonttype': 'none'})

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

ap_df = ld.load_dprime('refTar_pca4_dprime_act_bigPass_sim2_binPreLick')
pbps_df = ld.load_dprime(
    'refTar_pca4_dprime_bigPass_smallPass_sim2_binPreLick')

f, ax = plt.subplots(2, 3, figsize=(8, 6))

axis = 'ssa'
metric = 'dprime'
sd_cut = 3.5
ylim = 10
xlim = 10
vmin = 0
vmax = ylim

ap_df = ap_df[ap_df['axis'] == axis]
pbps_df = pbps_df[pbps_df['axis'] == axis]
예제 #3
0
    2nd order simulation
    Full simulation
Focus only on the big passive vs. active condtion
"""

import loading as ld
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import charlieTools.plotting as cplt
import matplotlib as mp
mp.rcParams.update({'svg.fonttype': 'none'})

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

ap_df = ld.load_dprime('refTar_pca4_dprime_act_bigPass_LDA_binPreLick')
pbps_df = ld.load_dprime('refTar_pca4_dprime_bigPass_smallPass_LDA_binPreLick')
ap_df_sim1 = ld.load_dprime('refTar_pca4_dprime_act_bigPass_uMatch_sim1_LDA_binPreLick')
pbps_df_sim1 = ld.load_dprime('refTar_pca4_dprime_bigPass_smallPass_uMatch_sim1_LDA_binPreLick')
ap_df_sim2 = ld.load_dprime('refTar_pca4_dprime_act_bigPass_uMatch_sim2_LDA_binPreLick')
pbps_df_sim2 = ld.load_dprime('refTar_pca4_dprime_bigPass_smallPass_uMatch_sim2_LDA_binPreLick')
ap_df_sim12 = ld.load_dprime('refTar_pca4_dprime_act_bigPass_uMatch_sim12_LDA_binPreLick')
pbps_df_sim12 = ld.load_dprime('refTar_pca4_dprime_bigPass_smallPass_uMatch_sim12_LDA_binPreLick')

axis = 'ssa'
metric = 'dprime'
sd_cut = 3.5
ylim = 10
xlim = 10
vmin = 0
vmax = ylim
import matplotlib as mp
mp.rcParams.update({'svg.fonttype': 'none'})

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

# ===================== load behavior for each site ===================================
behavior = pd.read_pickle(
    '/auto/users/hellerc/code/projects/Cosyne2020_poster/behavior/results.pickle'
)
DI_collapse = [np.mean(di) for di in behavior['all_DI']]
dprime_collapse = [np.mean(di) for di in behavior['all_dprime']]
behavior['DI_collapse'] = DI_collapse
behavior['dprime_collapse'] = dprime_collapse

# ====================== load dprime for each site ====================================
apb_df = ld.load_dprime(
    'refTar_pca4_dprime_act_bigPass_uMatch_sim1_binPreLick')
pbps_df = ld.load_dprime(
    'refTar_pca4_dprime_bigPass_smallPass_uMatch_sim1_binPreLick')

sites = ap_df['site'].unique()

axis = 'ssa'
metric = 'dprime'
behave_metric = 'DI_collapse'
sd_cut = 3.5
normalize = True

apb_df = apb_df[apb_df['axis'] == axis]
pbps_df = pbps_df[pbps_df['axis'] == axis]

# compare active vs. big pupil
예제 #5
0
'''
Compare dprime in active vs. passive vs. passive big pupil
'''

import loading as ld
import charlieTools.plotting as cplt
import matplotlib.pyplot as plt
import numpy as np

# analysis over all prelick period (coarse binning)
# coarse target too (combine all targets)
ap_df = ld.load_dprime('refTar_dprime_act_pass_binPreLick')
# using 'TARGET not in i' assures that a different axis is used for each target, but we
# still collapse across each target dprime for the coarse view here
filt = [i for i in ap_df.index if ('TARGET' not in i) and ('REFERENCE' in i)]
ap_df = ap_df[ap_df.index.isin(filt)]

f, ax = plt.subplots(3, 1, figsize=(5, 8))

mi = ap_df.groupby(by=['site', 'axis', 'state']).mean()['dprime'].min()
ma = ap_df.groupby(by=['site', 'axis', 'state']).mean()['dprime'].max()
# active decoding axis
y = ap_df[(ap_df['axis'] == 'ssa')
          & (ap_df['state'] == 'active')].groupby(by='site').mean()['dprime']
x = ap_df[(ap_df['axis'] == 'soa')
          & (ap_df['state'] == 'passive')].groupby(by='site').mean()['dprime']

ax[0].set_title('Active decoding axis', fontsize=8)
ax[0].scatter(x, y, color='k', edgecolor='white')
ax[0].plot([mi, ma], [mi, ma], '--', color='grey')
ax[0].set_xlabel('passive', fontsize=8)
"""
In spirit of NAT paper, plot the change in decoding for each site
as a function of where on the heatmap they lie
"""

import loading as ld
import charlieTools.plotting as cplt
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as ss
import matplotlib.pyplot as plt

# analysis over all prelick period (coarse binning)
# coarse target too (combine all targets)
ap_df = ld.load_dprime('refTar_dprime_bigPass_smallPass_binPreLick')
# using 'TARGET not in i' assures that a different axis is used for each target, but we
# still collapse across each target dprime for the coarse view here
#filt = [i for i in ap_df.index if ('TARGET' in i) and ('REFERENCE' in i)]
filt = [
    i for i in ap_df.index if ('TORC' in i)
    & (('TARGET' not in i) & ('TAR_' not in i) & ('REFERENCE' not in i))
]
ap_df = ap_df[ap_df.index.isin(filt)]

a_axis = 'sia'
p_axis = 'sia'
active = ap_df[(ap_df['state'] == 'big_passive') & (ap_df['axis'] == a_axis)]
passive = ap_df[(ap_df['state'] == 'small_passive')
                & (ap_df['axis'] == p_axis)]
nbins = 10
"""
Show selective ref/Tar enhancement by active engagement 
and ref/ref enhancement by arousal.

Do ref/Tar with grouping ref, but could also do refs independently...
"""

import loading as ld
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import charlieTools.plotting as cplt

ap_df = ld.load_dprime('refTar_pca4_dprime_pr_br_act_pass_binPreLick')
apb_df = ld.load_dprime(
    'refTar_pca4_dprime_pr_br_bigPass_smallPass_binPreLick')
aps_df = ld.load_dprime('refTar_pca4_dprime_pr_br_act_smallPass_binPreLick')

# remove outliers
all_dprime = pd.concat([ap_df['dprime'], apb_df['dprime'], aps_df['dprime']],
                       axis=1)
iv_mask = (all_dprime > 3 * np.nanstd(all_dprime.values)).sum(
    axis=1) | np.isnan(all_dprime).sum(axis=1).astype(bool)
print("removing {} percent of results".format(
    round(100 * iv_mask.sum() / all_dprime.shape[0], 3)))

a_axis = 'ssa'
p_axis = 'ssa'
pb_axis = 'ssa'
ps_axis = 'ssa'
metric = 'dprime'