示例#1
0
    def test_save_and_load(self):
        """Saving and loading a self.simdex object should return exactly the same object"""

        self.simdex.save('Test_save.dat')
        loaded = load_simdex('Test_save.dat')
        for attr in self.simdex.__dict__:
            exec("s = self.simdex." + attr)
            exec("l = loaded." + attr)

            if isinstance(s, np.ndarray):
                self.assertTrue((l == s).all())
            else:
                self.assertEqual(s, l)
 def test_save_and_load(self):
     """Saving and loading a self.simdex object should return exactly the same object"""
     
     self.simdex.save('Test_save.dat')
     loaded = load_simdex('Test_save.dat')
     for attr in self.simdex.__dict__:
         exec("s = self.simdex." + attr)
         exec("l = loaded." + attr)
                
         if isinstance(s, np.ndarray):
             self.assertTrue((l == s).all())
         else: 
             self.assertEqual(s, l)
print s1
s1.parametermap

s1.exist('c2')  # returns a list with 2 lists by default: parameters matching
# the regex, and variables matching the regex.
s1.get(u'c1.C')

# filter options ##############################################################
# based on identity
s3 = s1.filter_similar('SID0002')
# returns a new simdex with all simulations that have the same set of
# parameters (even if they have different values)

# based on parametervalues
fltr = {'c1.C': 800}
s4 = s1.filter(fltr)

# add a paramter to the filter
fltr2 = {'newParameter': ''}
s4 = s1.filter(fltr2)

# plotting
s3.plot('c1.T')
s3.scatterplot('c1.T', 'c2.T')

# saving a specific simdex
s2 = s1.filter(fltr)
s2.save('simdex2')

s = load_simdex('simdex2')
s.plot('r.heatPort_b.Q_flow')
s1.exist('c2')  # returns a list with 2 lists by default: parameters matching 
                # the regex, and variables matching the regex. 
s1.get(u'c1.C')

# filter options ##############################################################
# based on identity
s3 = s1.filter_similar('SID0002')
    # returns a new simdex with all simulations that have the same set of 
    # parameters (even if they have different values)

# based on parametervalues
fltr = {'c1.C':800}
s4 = s1.filter(fltr)

# add a paramter to the filter
fltr2 = {'newParameter' : ''}
s4 = s1.filter(fltr2)

# plotting
s3.plot('c1.T')
s3.scatterplot('c1.T', 'c2.T')

# saving a specific simdex
s2 = s1.filter(fltr)
s2.save('simdex2')



s = load_simdex('simdex2')
s.plot('r.heatPort_b.Q_flow')