def test0(self): R = { 'd': [ 9.0, 8.0, 6.0, 8.0, 10.0, 4.0, 6.0, 5.0, 7.0, 7.0, 7.0, 9.0, 6.0, 6.0, 6.0, 11.0, 6.0, 3.0, 8.0, 7.0, 11.0, 13.0, 8.0, 6.0, 14.0, 11.0, 13.0, 13.0, 10.0, 11.0, 12.0, 11.0, 16.0, 11.0, 9.0, 23.0, 12.0, 10.0, 19.0, 11.0, 10.0, 19.0, 14.0, 5.0, 10.0, 11.0, 14.0, 15.0, 11.0, 11.0, 8.0, 6.0, 4.0, 6.0, 7.0, 6.0, 5.0, 7.0, 9.0, 7.0, 10.0, 7.0, 8.0, 10.0, 4.0, 7.0, 10.0, 6.0, 7.0, 7.0, 14.0, 11.0, 18.0, 14.0, 13.0, 22.0, 17.0, 16.0, 12.0, 11.0, 20.0, 16.0, 16.0, 15.0, 18.0, 16.0, 20.0, 22.0, 14.0, 19.0, 21.0, 19.0, 17.0, 15.0, 22.0, 16.0, 22.0, 22.0, 18.0, 21.0 ], 'fname': 'output\\box(WORDS).png', 'maintitle': 'WORDS', 'val': 'WORDS' } df = DataFrame() df.TESTMODE = True df.read_tbl('data/words~ageXcondition.csv') D = df.box_plot('WORDS', output_dir='output') self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['val'], R['val']) for d, r in zip(np.array(D['d']).flat, np.array(R['d']).flat): self.assertAlmostEqual(d, r)
def test1(self): R = {'d': [np.array([ 9, 8, 6, 8, 10, 4, 6, 5, 7, 7, 7, 9, 6, 6, 6, 11, 6, 3, 8, 7, 11, 13, 8, 6, 14, 11, 13, 13, 10, 11, 12, 11, 16, 11, 9, 23, 12, 10, 19, 11, 10, 19, 14, 5, 10, 11, 14, 15, 11, 11]), np.array([ 8, 6, 4, 6, 7, 6, 5, 7, 9, 7, 10, 7, 8, 10, 4, 7, 10, 6, 7, 7, 14, 11, 18, 14, 13, 22, 17, 16, 12, 11, 20, 16, 16, 15, 18, 16, 20, 22, 14, 19, 21, 19, 17, 15, 22, 16, 22, 22, 18, 21])], 'fname': 'output\\box(WORDS~AGE).png', 'maintitle': 'WORDS by AGE', 'xlabels': [u'AGE = old', u'AGE = young']} df=DataFrame() df.TESTMODE=True df.read_tbl('data/words~ageXcondition.csv') D=df.box_plot('WORDS',['AGE'], output_dir='output') self.assertEqual(D['fname'],R['fname']) self.assertEqual(D['maintitle'],R['maintitle']) self.assertEqual(D['xlabels'],R['xlabels']) for d,r in zip(np.array(D['d']).flat, np.array(R['d']).flat): self.assertAlmostEqual(d,r)
def test01(self): df = DataFrame() df.TESTMODE = True df.read_tbl('data/iqbrainsize.txt', delimiter='\t') D = df.scatter_plot('TOTVOL', 'FIQ', output_dir='output') self.assertEqual(None, D['trend'])
def test1(self): R = { 'd': [ np.array([ 9, 8, 6, 8, 10, 4, 6, 5, 7, 7, 7, 9, 6, 6, 6, 11, 6, 3, 8, 7, 11, 13, 8, 6, 14, 11, 13, 13, 10, 11, 12, 11, 16, 11, 9, 23, 12, 10, 19, 11, 10, 19, 14, 5, 10, 11, 14, 15, 11, 11 ]), np.array([ 8, 6, 4, 6, 7, 6, 5, 7, 9, 7, 10, 7, 8, 10, 4, 7, 10, 6, 7, 7, 14, 11, 18, 14, 13, 22, 17, 16, 12, 11, 20, 16, 16, 15, 18, 16, 20, 22, 14, 19, 21, 19, 17, 15, 22, 16, 22, 22, 18, 21 ]) ], 'fname': 'output\\box(WORDS~AGE).png', 'maintitle': 'WORDS by AGE', 'xlabels': ['AGE = old', 'AGE = young'] } df = DataFrame() df.TESTMODE = True df.read_tbl('data/words~ageXcondition.csv') D = df.box_plot('WORDS', ['AGE'], output_dir='output') self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['xlabels'], R['xlabels']) for d, r in zip(np.array(D['d']).flat, np.array(R['d']).flat): self.assertAlmostEqual(d, r)
def test0(self): R = {'d': [9.0, 8.0, 6.0, 8.0, 10.0, 4.0, 6.0, 5.0, 7.0, 7.0, 7.0, 9.0, 6.0, 6.0, 6.0, 11.0, 6.0, 3.0, 8.0, 7.0, 11.0, 13.0, 8.0, 6.0, 14.0, 11.0, 13.0, 13.0, 10.0, 11.0, 12.0, 11.0, 16.0, 11.0, 9.0, 23.0, 12.0, 10.0, 19.0, 11.0, 10.0, 19.0, 14.0, 5.0, 10.0, 11.0, 14.0, 15.0, 11.0, 11.0, 8.0, 6.0, 4.0, 6.0, 7.0, 6.0, 5.0, 7.0, 9.0, 7.0, 10.0, 7.0, 8.0, 10.0, 4.0, 7.0, 10.0, 6.0, 7.0, 7.0, 14.0, 11.0, 18.0, 14.0, 13.0, 22.0, 17.0, 16.0, 12.0, 11.0, 20.0, 16.0, 16.0, 15.0, 18.0, 16.0, 20.0, 22.0, 14.0, 19.0, 21.0, 19.0, 17.0, 15.0, 22.0, 16.0, 22.0, 22.0, 18.0, 21.0], 'fname': 'output\\box(WORDS).png', 'maintitle': 'WORDS', 'val': 'WORDS'} df=DataFrame() df.TESTMODE=True df.read_tbl('data/words~ageXcondition.csv') D=df.box_plot('WORDS', output_dir='output') self.assertEqual(D['fname'],R['fname']) self.assertEqual(D['maintitle'],R['maintitle']) self.assertEqual(D['val'],R['val']) for d,r in zip(np.array(D['d']).flat, np.array(R['d']).flat): self.assertAlmostEqual(d,r)
def test1(self): df = DataFrame() df.TESTMODE = True df.read_tbl('data/words~ageXcondition.csv') D = df.histogram_plot('WORDS', cumulative=True, output_dir='output') self.assertEqual(D['fname'], 'output\\hist(WORDS,cumulative=True).png')
def test1(self): df=DataFrame() df.TESTMODE=True df.read_tbl('data/words~ageXcondition.csv') D=df.histogram_plot('WORDS', cumulative=True, output_dir='output') self.assertEqual(D['fname'],'output\\hist(WORDS,cumulative=True).png')
def test01(self): df=DataFrame() df.TESTMODE = True df.read_tbl('data/iqbrainsize.txt', delimiter='\t') D = df.scatter_plot('TOTVOL','FIQ', output_dir='output') self.assertEqual(None, D['trend'])
def test3(self): R = {'aggregate': 'ci', 'clevels': ['I', 'II'], 'fname': 'output\\whereGROUPnotLAB.png', 'maintitle': 'SUPPRESSION by CYCLE * AGE * PHASE * GROUP', 'numcols': 2, 'numrows': 2, 'rlevels': ['AA', 'AB'], 'subplot_titles': ['GROUP = AA, PHASE = AA', 'GROUP = AA, PHASE = AA', 'GROUP = AB, PHASE = AB', 'GROUP = AB, PHASE = AB'], 'xmaxs': [4.1500000000000004, 4.1500000000000004, 4.1500000000000004, 4.1500000000000004], 'xmins': [0.84999999999999998, 0.84999999999999998, 0.84999999999999998, 0.84999999999999998], 'y': [[[ 17.75 , 22.375, 23.125, 20.25 ], [ 8.675, 10.225, 10.5 , 9.925]], [[ 20.875, 28.125, 20.75 , 24.25 ], [ 8.3 , 10.25 , 9.525, 11.1 ]], [[ 12.625, 23.5 , 20. , 15.625], [ 5.525, 8.825, 9.125, 7.75 ]], [[ 22.75 , 41.125, 46.125, 51.75 ], [ 8.675, 13.1 , 14.475, 12.85 ]]], 'ymax': 64.8719707118471, 'ymin': 0.0} # separate y plots and separate x plots df=DataFrame() df.TESTMODE = True df.read_tbl('data\suppression~subjectXgroupXageXcycleXphase.csv') D = df.interaction_plot('SUPPRESSION','CYCLE', seplines='AGE', sepxplots='PHASE', sepyplots='GROUP',yerr='ci', where=[('GROUP','not in',['LAB'])], fname='whereGROUPnotLAB.png', output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d,r in zip(np.array(D['y']).flat,np.array(R['y']).flat): self.assertAlmostEqual(d,r)
def test2(self): R = { 'aggregate': 'ci', 'clevels': [1], 'fname': 'output\\interaction_plot(SUPPRESSION~CYCLE_X_AGE_X_PHASE,yerr=95% ci).png', 'maintitle': 'SUPPRESSION by CYCLE * AGE * PHASE', 'numcols': 1, 'numrows': 2, 'rlevels': ['I', 'II'], 'subplot_titles': ['I', 'II'], 'xmaxs': [4.1749999999999998, 4.1749999999999998], 'xmins': [0.32499999999999996, 0.32499999999999996], 'y': [[[17.33333333, 22.41666667, 22.29166667, 20.75], [7.34166667, 9.65, 9.70833333, 9.10833333]], [[26.625, 38.70833333, 39.08333333, 40.83333333], [10.24166667, 12.575, 13.19166667, 12.79166667]]], 'yerr': [[1.81325589, 1.44901936, 1.60883063, 1.57118871], [2.49411239, 1.34873573, 1.95209851, 1.35412572]], 'ymax': 64.8719707118471, 'ymin': 0.0 } # generate yerr df = DataFrame() df.TESTMODE = True df.read_tbl('data\suppression~subjectXgroupXageXcycleXphase.csv') D = df.interaction_plot('SUPPRESSION', 'CYCLE', seplines='AGE', sepyplots='PHASE', yerr='ci', output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d, r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d, r) for d, r in zip(np.array(D['yerr']).flat, np.array(R['yerr']).flat): self.assertAlmostEqual(d, r)
def test1(self): R = { 'aggregate': None, 'clevels': ['M1', 'M2', 'M3'], 'fname': 'output\\interaction_plot(ERROR~TIMEOFDAY_X_COURSE_X_MODEL,yerr=1.0).png', 'maintitle': 'ERROR by TIMEOFDAY * COURSE * MODEL', 'numcols': 3, 'numrows': 1, 'rlevels': [1], 'subplot_titles': ['M1', 'M2', 'M3'], 'xmaxs': [1.5, 1.5, 1.5], 'xmins': [-0.5, -0.5, -0.5], 'y': [[[9., 4.33333333], [8.66666667, 3.66666667], [4.66666667, 1.66666667]], [[7.5, 2.66666667], [6., 2.66666667], [5., 1.66666667]], [[5., 2.66666667], [3.5, 2.33333333], [2.33333333, 1.33333333]]], 'yerr': [[1.0, 1.0], [1.0, 1.0], [1.0, 1.0]], 'ymax': 11.119188627248182, 'ymin': 0.0 } # specify yerr df = DataFrame() df.TESTMODE = True df.read_tbl('data/error~subjectXtimeofdayXcourseXmodel_MISSING.csv') D = df.interaction_plot('ERROR', 'TIMEOFDAY', seplines='COURSE', sepxplots='MODEL', yerr=1., output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d, r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d, r) for d, r in zip(np.array(D['yerr']).flat, np.array(R['yerr']).flat): self.assertAlmostEqual(d, r)
def test4(self): R = {'aggregate': None, 'clevels': ['adjective', 'counting', 'imagery', 'intention', 'rhyming'], 'fname': 'output\\interaction_plot(WORDS~AGE_X_CONDITION).png', 'maintitle': 'WORDS by AGE * CONDITION', 'numcols': 5, 'numrows': 1, 'rlevels': [1], 'subplot_titles': ['adjective', 'counting', 'imagery', 'intention', 'rhyming'], 'xmaxs': [1.5, 1.5, 1.5, 1.5, 1.5], 'xmins': [-0.5, -0.5, -0.5, -0.5, -0.5], 'y': [[ 11. , 14.8], [ 7. , 6.5], [ 13.4, 17.6], [ 12. , 19.3], [ 6.9, 7.6]], 'yerr': [[], [], [], [], []], 'ymax': 27.183257964740832, 'ymin': 0.0} # a simple plot df=DataFrame() df.TESTMODE = True df.read_tbl('data/words~ageXcondition.csv') D = df.interaction_plot('WORDS','AGE', sepxplots='CONDITION', output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d,r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d,r) for d,r in zip(np.array(D['yerr']).flat, np.array(R['yerr']).flat): self.assertAlmostEqual(d,r)
def test1(self): R = {'aggregate': None, 'clevels': ['M1', 'M2', 'M3'], 'fname': 'output\\interaction_plot(ERROR~TIMEOFDAY_X_COURSE_X_MODEL,yerr=1.0).png', 'maintitle': 'ERROR by TIMEOFDAY * COURSE * MODEL', 'numcols': 3, 'numrows': 1, 'rlevels': [1], 'subplot_titles': ['M1', 'M2', 'M3'], 'xmaxs': [1.5, 1.5, 1.5], 'xmins': [-0.5, -0.5, -0.5], 'y': [[[ 9. , 4.33333333], [ 8.66666667, 3.66666667], [ 4.66666667, 1.66666667]], [[ 7.5 , 2.66666667], [ 6. , 2.66666667], [ 5. , 1.66666667]], [[ 5. , 2.66666667], [ 3.5 , 2.33333333], [ 2.33333333, 1.33333333]]], 'yerr': [[1.0, 1.0], [1.0, 1.0], [1.0, 1.0]], 'ymax': 11.119188627248182, 'ymin': 0.0} # specify yerr df=DataFrame() df.TESTMODE = True df.read_tbl('data/error~subjectXtimeofdayXcourseXmodel_MISSING.csv') D=df.interaction_plot('ERROR','TIMEOFDAY', seplines='COURSE', sepxplots='MODEL', yerr=1., output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d,r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d,r) for d,r in zip(np.array(D['yerr']).flat, np.array(R['yerr']).flat): self.assertAlmostEqual(d,r)
def test01(self): """confidence interval error bars specified""" R = { 'aggregate': 'ci', 'clevels': [1], 'fname': 'output\\interaction_plot(WORDS~AGE_X_CONDITION,yerr=95% ci).png', 'maintitle': 'WORDS by AGE * CONDITION', 'numcols': 1, 'numrows': 1, 'rlevels': [1], 'subplot_titles': [''], 'xmaxs': [1.5], 'xmins': [-0.5], 'y': [[[11.0, 14.8], [7.0, 6.5], [13.4, 17.6], [12.0, 19.3], [6.9, 7.6]]], 'yerr': [[]], 'ymin': 0.0, 'ymax': 27.183257964740832 } # a simple plot df = DataFrame() df.TESTMODE = True df.read_tbl('data/words~ageXcondition.csv') D = df.interaction_plot('WORDS', 'AGE', seplines='CONDITION', output_dir='output', yerr='ci') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d, r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d, r) for d, r in zip(np.array(D['yerr']).flat, np.array(R['yerr']).flat): self.assertAlmostEqual(d, r)
def test6(self): R = { 'aggregate': 'ci', 'clevels': [1], 'fname': 'output\\interaction_plot(SUPPRESSION~CYCLE_X_PHASE,yerr=95% ci).png', 'maintitle': 'SUPPRESSION by CYCLE * PHASE', 'numcols': 1, 'numrows': 2, 'rlevels': ['I', 'II'], 'subplot_titles': ['I', 'II'], 'xmaxs': [4.1749999999999998, 4.1749999999999998], 'xmins': [0.82499999999999996, 0.82499999999999996], 'y': [[12.3375, 16.03333333, 16., 14.92916667], [18.43333333, 25.64166667, 26.1375, 26.8125]], 'yerr': [[3.18994762, 3.20528834, 3.26882751, 3.53477953], [3.98429064, 4.5950803, 4.9514978, 4.97429769]], 'ymax': 64.8719707118471, 'ymin': 0.0 } # generate yerr df = DataFrame() df.TESTMODE = True df.read_tbl('data\suppression~subjectXgroupXageXcycleXphase.csv') D = df.interaction_plot('SUPPRESSION', 'CYCLE', sepyplots='PHASE', yerr='ci', output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d, r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d, r) for d, r in zip(np.array(D['yerr']).flat, np.array(R['yerr']).flat): self.assertAlmostEqual(d, r)
def test4(self): R = { 'aggregate': None, 'clevels': ['adjective', 'counting', 'imagery', 'intention', 'rhyming'], 'fname': 'output\\interaction_plot(WORDS~AGE_X_CONDITION).png', 'maintitle': 'WORDS by AGE * CONDITION', 'numcols': 5, 'numrows': 1, 'rlevels': [1], 'subplot_titles': ['adjective', 'counting', 'imagery', 'intention', 'rhyming'], 'xmaxs': [1.5, 1.5, 1.5, 1.5, 1.5], 'xmins': [-0.5, -0.5, -0.5, -0.5, -0.5], 'y': [[11., 14.8], [7., 6.5], [13.4, 17.6], [12., 19.3], [6.9, 7.6]], 'yerr': [[], [], [], [], []], 'ymax': 27.183257964740832, 'ymin': 0.0 } # a simple plot df = DataFrame() df.TESTMODE = True df.read_tbl('data/words~ageXcondition.csv') D = df.interaction_plot('WORDS', 'AGE', sepxplots='CONDITION', output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d, r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d, r) for d, r in zip(np.array(D['yerr']).flat, np.array(R['yerr']).flat): self.assertAlmostEqual(d, r)
def test31(self): # separate y plots and separate x plots df=DataFrame() df.TESTMODE = True df.read_tbl('data\suppression~subjectXgroupXageXcycleXphase.csv') D = df.interaction_plot('SUPPRESSION','CYCLE', seplines='AGE', sepxplots='GROUP', sepyplots='PHASE', yerr='sem', output_dir='output')
def test31(self): # separate y plots and separate x plots df = DataFrame() df.TESTMODE = True df.read_tbl('data\suppression~subjectXgroupXageXcycleXphase.csv') D = df.interaction_plot('SUPPRESSION', 'CYCLE', seplines='AGE', sepxplots='GROUP', sepyplots='PHASE', yerr='sem', output_dir='output')
def test01(self): """confidence interval error bars specified""" R = {'aggregate': 'ci', 'clevels': [1], 'fname': 'output\\interaction_plot(WORDS~AGE_X_CONDITION,yerr=95% ci).png', 'maintitle': 'WORDS by AGE * CONDITION', 'numcols': 1, 'numrows': 1, 'rlevels': [1], 'subplot_titles': [''], 'xmaxs': [1.5], 'xmins': [-0.5], 'y': [[[11.0, 14.8], [7.0, 6.5], [13.4, 17.6], [12.0, 19.3], [6.9, 7.6]]], 'yerr': [[]], 'ymin': 0.0, 'ymax': 27.183257964740832} # a simple plot df=DataFrame() df.TESTMODE=True df.read_tbl('data/words~ageXcondition.csv') D=df.interaction_plot('WORDS','AGE', seplines='CONDITION', output_dir='output', yerr='ci') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d,r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d,r) for d,r in zip(np.array(D['yerr']).flat, np.array(R['yerr']).flat): self.assertAlmostEqual(d,r)
def test0(self): R = {'bins': np.array([ 4, 14, 17, 12, 15, 10, 9, 5, 6, 8]), 'counts': np.array([ 3., 5., 7., 9., 11., 13., 15., 17., 19., 21., 23.]), 'fname': 'output\\hist(WORDS).png'} df=DataFrame() df.TESTMODE=True df.read_tbl('data/words~ageXcondition.csv') D=df.histogram_plot('WORDS', output_dir='output') self.assertEqual(D['fname'],R['fname']) for d,r in zip(D['bins'].flat,R['bins'].flat): self.assertAlmostEqual(d,r) for d,r in zip(D['counts'].flat,R['counts'].flat): self.assertAlmostEqual(d,r)
def test2(self): R = {'aggregate': 'ci', 'clevels': [1], 'fname': 'output\\interaction_plot(SUPPRESSION~CYCLE_X_AGE_X_PHASE,yerr=95% ci).png', 'maintitle': 'SUPPRESSION by CYCLE * AGE * PHASE', 'numcols': 1, 'numrows': 2, 'rlevels': ['I', 'II'], 'subplot_titles': ['I', 'II'], 'xmaxs': [4.1749999999999998, 4.1749999999999998], 'xmins': [0.32499999999999996, 0.32499999999999996], 'y': [[[ 17.33333333, 22.41666667, 22.29166667, 20.75 ], [ 7.34166667, 9.65 , 9.70833333, 9.10833333]], [[ 26.625 , 38.70833333, 39.08333333, 40.83333333], [ 10.24166667, 12.575 , 13.19166667, 12.79166667]]], 'yerr': [[ 1.81325589, 1.44901936, 1.60883063, 1.57118871], [ 2.49411239, 1.34873573, 1.95209851, 1.35412572]], 'ymax': 64.8719707118471, 'ymin': 0.0} # generate yerr df=DataFrame() df.TESTMODE = True df.read_tbl('data\suppression~subjectXgroupXageXcycleXphase.csv') D = df.interaction_plot('SUPPRESSION','CYCLE', seplines='AGE', sepyplots='PHASE', yerr='ci', output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d,r in zip(np.array(D['y']).flat,np.array(R['y']).flat): self.assertAlmostEqual(d,r) for d,r in zip(np.array(D['yerr']).flat,np.array(R['yerr']).flat): self.assertAlmostEqual(d,r)
def test6(self): R = {'aggregate': 'ci', 'clevels': [1], 'fname': 'output\\interaction_plot(SUPPRESSION~CYCLE_X_PHASE,yerr=95% ci).png', 'maintitle': 'SUPPRESSION by CYCLE * PHASE', 'numcols': 1, 'numrows': 2, 'rlevels': ['I', 'II'], 'subplot_titles': ['I', 'II'], 'xmaxs': [4.1749999999999998, 4.1749999999999998], 'xmins': [0.82499999999999996, 0.82499999999999996], 'y': [[ 12.3375 , 16.03333333, 16. , 14.92916667], [ 18.43333333, 25.64166667, 26.1375 , 26.8125 ]], 'yerr': [[ 3.18994762, 3.20528834, 3.26882751, 3.53477953], [ 3.98429064, 4.5950803 , 4.9514978 , 4.97429769]], 'ymax': 64.8719707118471, 'ymin': 0.0} # generate yerr df=DataFrame() df.TESTMODE = True df.read_tbl('data\suppression~subjectXgroupXageXcycleXphase.csv') D = df.interaction_plot('SUPPRESSION','CYCLE', sepyplots='PHASE', yerr='ci', output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d,r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d,r) for d,r in zip(np.array(D['yerr']).flat, np.array(R['yerr']).flat): self.assertAlmostEqual(d,r)
def test2(self): R = { 'd': [ np.array([11, 13, 8, 6, 14, 11, 13, 13, 10, 11]), np.array([9, 8, 6, 8, 10, 4, 6, 5, 7, 7]), np.array([12, 11, 16, 11, 9, 23, 12, 10, 19, 11]), np.array([10, 19, 14, 5, 10, 11, 14, 15, 11, 11]), np.array([7, 9, 6, 6, 6, 11, 6, 3, 8, 7]), np.array([14, 11, 18, 14, 13, 22, 17, 16, 12, 11]), np.array([8, 6, 4, 6, 7, 6, 5, 7, 9, 7]), np.array([20, 16, 16, 15, 18, 16, 20, 22, 14, 19]), np.array([21, 19, 17, 15, 22, 16, 22, 22, 18, 21]), np.array([10, 7, 8, 10, 4, 7, 10, 6, 7, 7]) ], 'fname': 'output\\box(WORDS~AGE_X_CONDITION).png', 'maintitle': 'WORDS by AGE * CONDITION', 'xlabels': [ 'AGE = old\nCONDITION = adjective', 'AGE = old\nCONDITION = counting', 'AGE = old\nCONDITION = imagery', 'AGE = old\nCONDITION = intention', 'AGE = old\nCONDITION = rhyming', 'AGE = young\nCONDITION = adjective', 'AGE = young\nCONDITION = counting', 'AGE = young\nCONDITION = imagery', 'AGE = young\nCONDITION = intention', 'AGE = young\nCONDITION = rhyming' ] } df = DataFrame() df.TESTMODE = True df.read_tbl('data/words~ageXcondition.csv') D = df.box_plot('WORDS', ['AGE', 'CONDITION'], output_dir='output') self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['xlabels'], R['xlabels']) for d, r in zip(np.array(D['d']).flat, np.array(R['d']).flat): self.assertAlmostEqual(d, r)
def test0(self): R = { 'bins': np.array([4, 14, 17, 12, 15, 10, 9, 5, 6, 8]), 'counts': np.array([3., 5., 7., 9., 11., 13., 15., 17., 19., 21., 23.]), 'fname': 'output\\hist(WORDS).png' } df = DataFrame() df.TESTMODE = True df.read_tbl('data/words~ageXcondition.csv') D = df.histogram_plot('WORDS', output_dir='output') self.assertEqual(D['fname'], R['fname']) for d, r in zip(D['bins'].flat, R['bins'].flat): self.assertAlmostEqual(d, r) for d, r in zip(D['counts'].flat, R['counts'].flat): self.assertAlmostEqual(d, r)
def test2(self): R = {'d': [np.array([11, 13, 8, 6, 14, 11, 13, 13, 10, 11]), np.array([ 9, 8, 6, 8, 10, 4, 6, 5, 7, 7]), np.array([12, 11, 16, 11, 9, 23, 12, 10, 19, 11]), np.array([10, 19, 14, 5, 10, 11, 14, 15, 11, 11]), np.array([ 7, 9, 6, 6, 6, 11, 6, 3, 8, 7]), np.array([14, 11, 18, 14, 13, 22, 17, 16, 12, 11]), np.array([8, 6, 4, 6, 7, 6, 5, 7, 9, 7]), np.array([20, 16, 16, 15, 18, 16, 20, 22, 14, 19]), np.array([21, 19, 17, 15, 22, 16, 22, 22, 18, 21]), np.array([10, 7, 8, 10, 4, 7, 10, 6, 7, 7])], 'fname': 'output\\box(WORDS~AGE_X_CONDITION).png', 'maintitle': 'WORDS by AGE * CONDITION', 'xlabels': [u'AGE = old\nCONDITION = adjective', u'AGE = old\nCONDITION = counting', u'AGE = old\nCONDITION = imagery', u'AGE = old\nCONDITION = intention', u'AGE = old\nCONDITION = rhyming', u'AGE = young\nCONDITION = adjective', u'AGE = young\nCONDITION = counting', u'AGE = young\nCONDITION = imagery', u'AGE = young\nCONDITION = intention', u'AGE = young\nCONDITION = rhyming']} df=DataFrame() df.TESTMODE=True df.read_tbl('data/words~ageXcondition.csv') D=df.box_plot('WORDS',['AGE','CONDITION'], output_dir='output') self.assertEqual(D['fname'],R['fname']) self.assertEqual(D['maintitle'],R['maintitle']) self.assertEqual(D['xlabels'],R['xlabels']) for d,r in zip(np.array(D['d']).flat, np.array(R['d']).flat): self.assertAlmostEqual(d,r)
def test3(self): R = { 'aggregate': 'ci', 'clevels': ['I', 'II'], 'fname': 'output\\whereGROUPnotLAB.png', 'maintitle': 'SUPPRESSION by CYCLE * AGE * PHASE * GROUP', 'numcols': 2, 'numrows': 2, 'rlevels': ['AA', 'AB'], 'subplot_titles': [ 'GROUP = AA, PHASE = AA', 'GROUP = AA, PHASE = AA', 'GROUP = AB, PHASE = AB', 'GROUP = AB, PHASE = AB' ], 'xmaxs': [ 4.1500000000000004, 4.1500000000000004, 4.1500000000000004, 4.1500000000000004 ], 'xmins': [ 0.84999999999999998, 0.84999999999999998, 0.84999999999999998, 0.84999999999999998 ], 'y': [[[17.75, 22.375, 23.125, 20.25], [8.675, 10.225, 10.5, 9.925]], [[20.875, 28.125, 20.75, 24.25], [8.3, 10.25, 9.525, 11.1]], [[12.625, 23.5, 20., 15.625], [5.525, 8.825, 9.125, 7.75]], [[22.75, 41.125, 46.125, 51.75], [8.675, 13.1, 14.475, 12.85]]], 'ymax': 64.8719707118471, 'ymin': 0.0 } # separate y plots and separate x plots df = DataFrame() df.TESTMODE = True df.read_tbl('data\suppression~subjectXgroupXageXcycleXphase.csv') D = df.interaction_plot('SUPPRESSION', 'CYCLE', seplines='AGE', sepxplots='PHASE', sepyplots='GROUP', yerr='ci', where=[('GROUP', 'not in', ['LAB'])], fname='whereGROUPnotLAB.png', output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d, r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d, r)
def test7(self): R = { 'aggregate': 'ci', 'clevels': ['I', 'II'], 'fname': 'output\\interaction_plot(SUPPRESSION~CYCLE_X_PHASE_X_GROUP,yerr=95% ci).png', 'maintitle': 'SUPPRESSION by CYCLE * PHASE * GROUP', 'numcols': 2, 'numrows': 2, 'rlevels': ['AA', 'AB'], 'subplot_titles': [ 'GROUP = AA, PHASE = AA', 'GROUP = AA, PHASE = AA', 'GROUP = AB, PHASE = AB', 'GROUP = AB, PHASE = AB' ], 'xmaxs': [ 4.1500000000000004, 4.1500000000000004, 4.1500000000000004, 4.1500000000000004 ], 'xmins': [ 0.84999999999999998, 0.84999999999999998, 0.84999999999999998, 0.84999999999999998 ], 'y': [[13.2125, 16.3, 16.8125, 15.0875], [14.5875, 19.1875, 15.1375, 17.675], [9.075, 16.1625, 14.5625, 11.6875], [15.7125, 27.1125, 30.3, 32.3]], 'yerr': [[6.41377058, 4.90274323, 6.52638491, 4.723284], [7.98351964, 7.01554694, 5.50066923, 4.7712851], [4.06006718, 6.15225848, 4.21669129, 6.23708923], [4.55687267, 7.52964629, 8.43210133, 10.3156968]], 'ymax': 64.8719707118471, 'ymin': 0.0 } # separate y plots and separate x plots df = DataFrame() df.TESTMODE = True df.read_tbl('data\suppression~subjectXgroupXageXcycleXphase.csv') D = df.interaction_plot('SUPPRESSION', 'CYCLE', sepxplots='PHASE', sepyplots='GROUP', yerr='ci', where=[('GROUP', 'not in', ['LAB'])], output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d, r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d, r) for d, r in zip(np.array(D['yerr']).flat, np.array(R['yerr']).flat): self.assertAlmostEqual(d, r)
def test7(self): R = {'aggregate': 'ci', 'clevels': ['I', 'II'], 'fname': 'output\\interaction_plot(SUPPRESSION~CYCLE_X_PHASE_X_GROUP,yerr=95% ci).png', 'maintitle': 'SUPPRESSION by CYCLE * PHASE * GROUP', 'numcols': 2, 'numrows': 2, 'rlevels': ['AA', 'AB'], 'subplot_titles': ['GROUP = AA, PHASE = AA', 'GROUP = AA, PHASE = AA', 'GROUP = AB, PHASE = AB', 'GROUP = AB, PHASE = AB'], 'xmaxs': [4.1500000000000004, 4.1500000000000004, 4.1500000000000004, 4.1500000000000004], 'xmins': [0.84999999999999998, 0.84999999999999998, 0.84999999999999998, 0.84999999999999998], 'y': [[ 13.2125, 16.3 , 16.8125, 15.0875], [ 14.5875, 19.1875, 15.1375, 17.675 ], [ 9.075 , 16.1625, 14.5625, 11.6875], [ 15.7125, 27.1125, 30.3 , 32.3 ]], 'yerr': [[ 6.41377058, 4.90274323, 6.52638491, 4.723284 ], [ 7.98351964, 7.01554694, 5.50066923, 4.7712851 ], [ 4.06006718, 6.15225848, 4.21669129, 6.23708923], [ 4.55687267, 7.52964629, 8.43210133, 10.3156968 ]], 'ymax': 64.8719707118471, 'ymin': 0.0} # separate y plots and separate x plots df=DataFrame() df.TESTMODE = True df.read_tbl('data\suppression~subjectXgroupXageXcycleXphase.csv') D = df.interaction_plot('SUPPRESSION','CYCLE', sepxplots='PHASE', sepyplots='GROUP', yerr='ci', where=[('GROUP','not in',['LAB'])], output_dir='output') self.assertEqual(D['aggregate'], R['aggregate']) self.assertEqual(D['clevels'], R['clevels']) self.assertEqual(D['rlevels'], R['rlevels']) self.assertEqual(D['numcols'], R['numcols']) self.assertEqual(D['numrows'], R['numrows']) self.assertEqual(D['fname'], R['fname']) self.assertEqual(D['maintitle'], R['maintitle']) self.assertEqual(D['subplot_titles'], R['subplot_titles']) self.assertAlmostEqual(D['ymin'], R['ymin']) self.assertAlmostEqual(D['ymax'], R['ymax']) for d,r in zip(np.array(D['y']).flat, np.array(R['y']).flat): self.assertAlmostEqual(d,r) for d,r in zip(np.array(D['yerr']).flat, np.array(R['yerr']).flat): self.assertAlmostEqual(d,r)