Пример #1
0
    def test_two_ramps_smoke_test(self):
        mdl = goodVehicle()

        V = np.hstack((np.r_[0:100:2], np.r_[100:0:-2]))
        mdl['cycle_run'] = {'v_target': V}

        experiment = Experiment(mdl)
        mdl = experiment.run()
Пример #2
0
    def test_two_ramps_smoke_test(self):
        mdl = goodVehicle()

        V = np.hstack((np.r_[0:100:2], np.r_[100:0:-2]))
        mdl['cycle_run'] = {'v_target': V}

        experiment = Experiment(mdl)
        mdl = experiment.run()
Пример #3
0
    def test_badCycle(self):
        mdl = goodVehicle()

        mdl['params'] = params = {}
        mdl['cycle_run'] = 1

        with assertRaisesRegex(self, PandasError, 'DataFrame constructor not properly called'):
            experiment = Experiment(mdl)
            mdl = experiment.run()
Пример #4
0
    def test_badCycle(self):
        mdl = goodVehicle()

        mdl['params'] = params = {}
        mdl['cycle_run'] = 1

        with assertRaisesRegex(self, PandasError,
                               'DataFrame constructor not properly called'):
            experiment = Experiment(mdl)
            mdl = experiment.run()
Пример #5
0
    def test_two_ramps_with_slope(self):
        V = np.hstack((np.r_[0:100:2], np.r_[100:0:-2]))
        SLOPE = np.random.rand(V.shape[0])
        v_columns = ('v_class', 'v_target')
        for col in v_columns:
            mdl = goodVehicle()

            mdl['cycle_run'] = pd.DataFrame({
                col: V,
                'slope': SLOPE,
            })
            proc = Experiment(mdl)
            mdl = proc.run()

            #print(pd.DataFrame(mdl['cycle_run']))

            cycle_run = mdl['cycle_run']
            self.assertIn('slope', cycle_run)
            self.assertIn('gears', cycle_run)
            for vcol in v_columns:
                npt.assert_array_equal(V, cycle_run[vcol], "V_Column(%s) not overriden!"%vcol)
Пример #6
0
    def test_two_ramps_with_slope(self):
        V = np.hstack((np.r_[0:100:2], np.r_[100:0:-2]))
        SLOPE = np.random.rand(V.shape[0])
        v_columns = ('v_class', 'v_target')
        for col in v_columns:
            mdl = goodVehicle()

            mdl['cycle_run'] = pd.DataFrame({
                col: V,
                'slope': SLOPE,
            })
            proc = Experiment(mdl)
            mdl = proc.run()

            #print(pd.DataFrame(mdl['cycle_run']))

            cycle_run = mdl['cycle_run']
            self.assertIn('slope', cycle_run)
            self.assertIn('gears', cycle_run)
            for vcol in v_columns:
                npt.assert_array_equal(V, cycle_run[vcol],
                                       "V_Column(%s) not overriden!" % vcol)