Exemplo n.º 1
0
 def test_RunSet___getitem__single_column(self):
     run1 = Run.read_csv(self.TEST_DATA_FILEPATH, name='run1')
     run2 = Run.read_csv(self.TEST_DATA_FILEPATH, name='run2')
     runset = RunSet([run1, run2])
     data = runset['A']
     data1 = data['run1'].squeeze().tolist()
     data2 = data['run2'].squeeze().tolist()
     expected = [1., 9., 6., 4., 7., 3., 5., 4.]
     self.assertAllClose(data1, expected)
     self.assertAllClose(data2, expected)
Exemplo n.º 2
0
 def test_RunSet___setitem__(self):
     run1 = Run.read_csv(self.TEST_DATA_FILEPATH, name='run1')
     run2 = Run.read_csv(self.TEST_DATA_FILEPATH, name='run2')
     runset = RunSet([run1, run2])
     runset['A'] = 3.
     a1 = runset.runs['run1']['A'].tolist()
     a2 = runset.runs['run2']['A'].tolist()
     expected = [3., 3., 3., 3., 3., 3., 3., 3.]
     self.assertAllClose(expected, a1)
     self.assertAllClose(expected, a2)
Exemplo n.º 3
0
 def test_RunSet_set_index(self):
     run1 = Run.read_csv(self.TEST_DATA_FILEPATH, name='run1')
     runset = RunSet([run1])
     runset.set_index('TIME')
     indices = run1.index.tolist()
     expected = [0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7]
     self.assertAllClose(expected, indices)
Exemplo n.º 4
0
 def from_file(cls,
               xname,
               yname,
               filepath,
               *args,
               name=None,
               description="",
               run_name=None,
               run_description="",
               run_kwargs={},
               **kwargs):
     run = Run.read_csv(filepath,
                        name=run_name,
                        description=run_description,
                        **run_kwargs)
     return Envelope(xname,
                     yname,
                     run,
                     *args,
                     name=name,
                     description=description,
                     **kwargs)
Exemplo n.º 5
0
 def test_RunSet_remove_run_does_not_delete_actual_run(self):
     run1 = Run.read_csv(self.TEST_DATA_FILEPATH, name='run1')
     runset = RunSet([run1])
     runset.remove_run('run1')
     self.assertEqual(run1['A'][0], 1.)
Exemplo n.º 6
0
 def test_RunSet_remove_run(self):
     run1 = Run.read_csv(self.TEST_DATA_FILEPATH, name='run1')
     runset = RunSet([run1])
     self.assertTrue('run1' in runset.runs)
     runset.remove_run('run1')
     self.assertFalse('run1' in runset.runs)
Exemplo n.º 7
0
 def test_RunSet_add_run(self):
     run1 = Run.read_csv(self.TEST_DATA_FILEPATH, name='run1')
     runset = RunSet()
     runset.add_run(run1)
     self.assertTrue('run1' in runset.runs)
Exemplo n.º 8
0
 def test_RunSet_constructor(self):
     run1 = Run.read_csv(self.TEST_DATA_FILEPATH, name='run1')
     run2 = Run.read_csv(self.TEST_DATA_FILEPATH, name='run2')
     runset = RunSet([run1, run2])
     self.assertTrue(isinstance(runset, RunSet))
Exemplo n.º 9
0
 def test_Run___setitem__whole_column(self):
     run = Run.read_csv(self.TEST_DATA_FILEPATH)
     run['A'] = [3., 3., 3., 3., 3., 3., 3., 3.]
     a = run['A'].tolist()
     expected = [3., 3., 3., 3., 3., 3., 3., 3.]
     self.assertAllClose(a, expected)
Exemplo n.º 10
0
 def test_Run___setitem__single_value(self):
     run = Run.read_csv(self.TEST_DATA_FILEPATH)
     run['A'] = 3.
     a = run['A'].tolist()
     expected = [3., 3., 3., 3., 3., 3., 3., 3.]
     self.assertAllClose(a, expected)
Exemplo n.º 11
0
 def test_read_csv_returns_run(self):
     run = Run.read_csv(self.TEST_DATA_FILEPATH)
     self.assertTrue(isinstance(run, Run))
Exemplo n.º 12
0
 def test_read_csv_returns_dataframe_instance(self):
     run = Run.read_csv(self.TEST_DATA_FILEPATH)
     self.assertTrue(isinstance(run, pd.DataFrame))
Exemplo n.º 13
0
 def setup_run2(self):
     return Run.read_csv(self.TEST_DATA2)
Exemplo n.º 14
0
 def setup2(self):
     run = Run.read_csv(self.TEST_DATA2)
     return run
Exemplo n.º 15
0
 def setup1(self):
     run = Run.read_csv(self.TEST_DATA1)
     return run