# Load data
nonjumpers = str.format("subject not in {0}",jumpers)
steps = pd.read_hdf(lesionshamcache,stepfeatures_key).query(nonjumpers)
cr = pd.read_hdf(lesionshamcache,crossings_key).query(nonjumpers)
cract = pd.read_hdf(lesionshamcache,crossingactivity_random_key)
cract.reset_index(['subject','session','crossing'],inplace=True)
info = pd.read_hdf(lesionshamcache, info_key).query(nonjumpers)
info = info.query("subject != 'JPAK_20'")

# Select data
group = list(names(info))
controls = list(names(control(info)))
lesions = list(names(lesion(info)))
matched = list(cagemates(lesion(info)))
small = list(names(smalllesion(info)))
selection = str.format("subject in {0}",group)
random = '(session == 13 and trial > 20) or (14 <= session < 17)'
steps = steps.query(random).query(selection)
cr = cr.query(random).query(selection)
steps = joinstepactivity(steps,cr,cract)
steps = getballistictrials(steps)

for i in range(21,22):
    offact = crossingoffset(cract,steps,i)
    offact.set_index(['subject','session'],inplace=True)
    normalizeposition(offact,inplace=True)
    stablebias,unstablebias = posturebias(offact,n=2)
    
    fig, (ax1,ax2) = plt.subplots(1,2)
    colors = ['b','cyan','orange','r']
示例#2
0
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import linregress
from activitytables import flipleftwards, info_key
from shuttlingplots import speedhistogram, speedcorrelation, scatterhistaxes
from datapath import jumpers, lesionshamcache, stepfeatures_key
from infotables import names, control, lesion, smalllesion, anylesion

# Load data
stable = '(3 <= session < 5)'
unstable = '(9 <= session < 11)'
nonjumpers = str.format("subject not in {0}", jumpers)
sessions = str.format("{0} or {1}", stable, unstable)
info = pd.read_hdf(lesionshamcache, info_key)
lesions = str.format("subject in {0}", list(names(lesion(info))))
smalllesions = str.format("subject in {0}", list(names(smalllesion(info))))
alllesions = str.format("subject in {0}", list(names(anylesion(info))))
controls = str.format("subject in {0}", list(names(control(info))))
steps = pd.read_hdf(lesionshamcache, stepfeatures_key).query(nonjumpers)
steps.xhead_speed[steps.side == 'leftwards'] *= -1
steps.xhead = flipleftwards(steps.xhead, steps.side)
steps = steps.query(sessions)

# Plot functions
rangex = (steps.xhead_speed.min(), steps.xhead_speed.max())
rangey = (steps.yhead_speed.min(), steps.yhead_speed.max())


def histogramcomparison(steps, title):
    axes = scatterhistaxes()
    axScatter, axHistx, axHisty = axes
import pandas as pd
import scipy.stats as stats
import matplotlib.pyplot as plt
from activitytables import normalize, mediannorm, flipleftwards, info_key
from shuttlingplots import posturehistogram, scatterhistaxes
from datapath import jumpers, lesionshamcache, stepfeatures_key
from infotables import control, lesion, smalllesion, anylesion
from infotables import names, cagemates, lesionordermap

# Load data
nonjumpers = str.format("subject not in {0}", jumpers)
steps = pd.read_hdf(lesionshamcache, stepfeatures_key).query(nonjumpers)
info = pd.read_hdf(lesionshamcache, info_key)
lesionmap = lesionordermap(info)
lesions = str.format("subject in {0}", list(names(lesion(info))))
smallnames = names(smalllesion(info))
smalllesions = str.format("subject in {0}", list(smallnames))
smalllesion_A = str.format("subject in ['{0}']", smallnames[0])
smalllesion_B = str.format("subject in ['{0}']", smallnames[1])
smallcontrols = str.format("subject in {0}",
                           list(cagemates(smalllesion(info))))
alllesions = str.format("subject in {0}", list(names(anylesion(info))))
controls = str.format("subject in {0}", list(names(control(info))))

# Select data
random = '(session == 13 and trial > 20) or (14 <= session < 17)'
randomstable = str.format('({0}) and stepstate3', random)
randomunstable = str.format('({0}) and not stepstate3', random)
steps = steps.query(random)
steps.xhead = flipleftwards(steps.xhead, steps.side)
normalize(steps, mediannorm, ['xhead', 'yhead'], level=['subject'])