Changeset 13801


Ignore:
Timestamp:
Oct 22, 2019 1:42:46 PM (4 weeks ago)
Author:
randersson
Message:

#5819 Removed keyword 'places' because it was already in 3rd order but with numpy it is called decimal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-5819/Python/src/tests_jmodelica/simulation/test_assimulo_interface_fmi.py

    r13800 r13801  
    749749        res = model.simulate(final_time=3.5, input=input_object,options=opts)
    750750       
    751         N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,places=2)
    752         N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,places=2)
    753         nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,places=2)
    754         nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,places=2)
    755         nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,places=2)
    756         nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,places=2)
    757         N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,places=2)
     751        N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,2)
     752        N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,2)
     753        nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,2)
     754        nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,2)
     755        nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,2)
     756        nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,2)
     757        N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,2)
    758758       
    759759    @testattr(stddist_full = True)
     
    764764        res = model.simulate(final_time=3.5, input=input_object,options=opts)
    765765       
    766         N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,places=2)
    767         N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,places=2)
    768         nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,places=2)
    769         nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,places=2)
    770         nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,places=2)
    771         nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,places=2)
    772         N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,places=2)
     766        N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,2)
     767        N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,2)
     768        nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,2)
     769        nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,2)
     770        nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,2)
     771        nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,2)
     772        N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,2)
    773773       
    774774    @testattr(stddist_full = True)
     
    779779        res = model.simulate(final_time=3.5, input=input_object,options=opts)
    780780       
    781         N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,places=2)
    782         N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,places=2)
    783         nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,places=2)
    784         nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,places=2)
    785         nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,places=2)
    786         nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,places=2)
    787         N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,places=2)
     781        N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,2)
     782        N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,2)
     783        nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,2)
     784        nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,2)
     785        nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,2)
     786        nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,2)
     787        N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,2)
    788788       
    789789    @testattr(stddist_full = True)
     
    794794        res = model.simulate(final_time=3.5, input=input_object,options=opts)
    795795       
    796         N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,places=2)
    797         N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,places=2)
    798         nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,places=2)
    799         nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,places=2)
    800         nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,places=2)
    801         nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,places=2)
    802         N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,places=2)
     796        N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,2)
     797        N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,2)
     798        nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,2)
     799        nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,2)
     800        nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,2)
     801        nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,2)
     802        N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,2)
    803803       
    804804    @testattr(stddist_full = True)
     
    808808        res = model.simulate(final_time=0.1)
    809809       
    810         N.testing.assert_almost_equal(res.initial("x"),1.0,places=3)
    811         N.testing.assert_almost_equal(res.initial("y"),0.0,places=3)
     810        N.testing.assert_almost_equal(res.initial("x"),1.0,3)
     811        N.testing.assert_almost_equal(res.initial("y"),0.0,3)
    812812       
    813813    @testattr(stddist_full = True)
     
    817817        res = model.simulate(final_time=0.1)
    818818       
    819         N.testing.assert_almost_equal(res.initial("x"),0.0,places=3)
    820         N.testing.assert_almost_equal(res.initial("y"),1.0,places=3)
     819        N.testing.assert_almost_equal(res.initial("x"),0.0,3)
     820        N.testing.assert_almost_equal(res.initial("y"),1.0,3)
    821821
    822822    @testattr(stddist_full = True)
     
    826826        res = model.simulate(final_time=10)
    827827       
    828         N.testing.assert_almost_equal(N.interp(3.00,res["time"],res["der(v1)"]),1.0,places=3)
    829         N.testing.assert_almost_equal(N.interp(3.40,res["time"],res["der(v1)"]),0.0,places=3)
    830         N.testing.assert_almost_equal(N.interp(8.00,res["time"],res["der(v1)"]),0.0,places=3)
    831         N.testing.assert_almost_equal(N.interp(8.25,res["time"],res["der(v1)"]),1.0,places=3)
    832         N.testing.assert_almost_equal(N.interp(4.00,res["time"],res["der(v2)"]),1.0,places=3)
    833         N.testing.assert_almost_equal(N.interp(4.20,res["time"],res["der(v2)"]),0.0,places=3)
    834         N.testing.assert_almost_equal(N.interp(7.00,res["time"],res["der(v2)"]),0.0,places=3)
    835         N.testing.assert_almost_equal(N.interp(7.20,res["time"],res["der(v2)"]),1.0,places=3)
     828        N.testing.assert_almost_equal(N.interp(3.00,res["time"],res["der(v1)"]),1.0,3)
     829        N.testing.assert_almost_equal(N.interp(3.40,res["time"],res["der(v1)"]),0.0,3)
     830        N.testing.assert_almost_equal(N.interp(8.00,res["time"],res["der(v1)"]),0.0,3)
     831        N.testing.assert_almost_equal(N.interp(8.25,res["time"],res["der(v1)"]),1.0,3)
     832        N.testing.assert_almost_equal(N.interp(4.00,res["time"],res["der(v2)"]),1.0,3)
     833        N.testing.assert_almost_equal(N.interp(4.20,res["time"],res["der(v2)"]),0.0,3)
     834        N.testing.assert_almost_equal(N.interp(7.00,res["time"],res["der(v2)"]),0.0,3)
     835        N.testing.assert_almost_equal(N.interp(7.20,res["time"],res["der(v2)"]),1.0,3)
    836836
    837837class Test_NonLinear_Systems:
     
    916916
    917917        for i,iv in enumerate(ivs):
    918             N.testing.assert_almost_equal(fprime(iv) ,df[i], places=12) 
     918            N.testing.assert_almost_equal(fprime(iv) ,df[i], 12) 
    919919           
    920920    @testattr(stddist_base = True)
     
    19391939        solver = res.solver
    19401940       
    1941         N.testing.assert_almost_equal(solver.t, 1.856045, places=3)   
     1941        N.testing.assert_almost_equal(solver.t, 1.856045, 3)   
    19421942       
    19431943    @testattr(windows_full = True)
     
    19511951        solver = res.solver
    19521952       
    1953         N.testing.assert_almost_equal(solver.t, 1.856045, places=3)       
     1953        N.testing.assert_almost_equal(solver.t, 1.856045, 3)       
    19541954
    19551955    @testattr(noncompliantfmi = True)
Note: See TracChangeset for help on using the changeset viewer.