Skip to content

Commit

Permalink
fixed sort_level issue (-->df.sort_index())
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Dunovan | Ntrepid Corp committed Feb 28, 2019
1 parent c332d4b commit 22f016e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion radd/__init__.py
Expand Up @@ -5,7 +5,7 @@
__all__ = [ os.path.basename(f)[:-3] for f in modules]

_package_dir = os.path.dirname(os.path.realpath(__file__))
__version__ = '0.5.4'
__version__ = '0.5.5'

def load_example_data(name='elife'):
""" load example data from elife (2015) or jneuro (2018) publications
Expand Down
2 changes: 1 addition & 1 deletion radd/dfhandler.py
Expand Up @@ -88,7 +88,7 @@ def make_observed_groupDFs(self):
data = self.data.copy()
ssdmethod = self.ssd_method
self.grpData = data.groupby(np.hstack(['idx', self.conds]).tolist())
datdf = self.grpData.apply(analyze.rangl_data, ssdmethod, self.quantiles).sortlevel(0)
datdf = self.grpData.apply(analyze.rangl_data, ssdmethod, self.quantiles).sort_index(0)
# self.datdf = datdf
groupvalues = datdf.reset_index()[self.groups].values
nan_data = np.zeros((groupvalues.shape[0], len(odf_header)), dtype=np.int64)
Expand Down
3 changes: 3 additions & 0 deletions radd/tools/analyze.py
Expand Up @@ -75,11 +75,13 @@ def rangl_data(data, ssd_method='all', quantiles=np.linspace(.01,.99,15), fit_on
goQuery = 'ttype=="go"'
stopQuery = 'ttype=="stop"'
gac = data.query(goQuery).acc.mean()

grt = data.query('response==1 & acc==1').rt.values
ert = data.query('response==1 & acc==0').rt.values
gq = mq(grt[grt<5.], prob=quantiles)
eq = mq(ert[ert<5.], prob=quantiles)
data_vector = [gac, gq, eq]

if 'ssd' in data.columns:
stopdf = data.query(stopQuery)
if 'probe' in stopdf.columns:
Expand All @@ -89,6 +91,7 @@ def rangl_data(data, ssd_method='all', quantiles=np.linspace(.01,.99,15), fit_on
elif ssd_method=='central':
sacc = np.array([stopdf.mean()['acc']])
data_vector.insert(1, sacc)

return np.hstack(data_vector)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -9,7 +9,7 @@

setup(
name='RADD',
version='0.5.4',
version='0.5.5',
author='Kyle Dunovan, Timothy Verstynen, Jeremy Huang',
author_email='dunovank@gmail.com',
url='http://github.com/CoAxLab/radd',
Expand Down

0 comments on commit 22f016e

Please sign in to comment.