Esempio n. 1
0
 def testStaibDatfileTextVal(self):
     """fileText data should match the data in the file."""
     # open the data file and turn it into a list with readlines.
     datFile = open(self.filename, "r")
     fileTextList = datFile.readlines()
     datFile.close()
     SD = StaibDat(self.filename)
     self.assertEqual(fileTextList, SD["fileText"])
Esempio n. 2
0
 def testStaibDatC2Values(self):
     """C2 array should have the proper values."""
     SD = StaibDat(self.filename)
     C2Array = numpy.array(SD["Channel_2"]["value"])
     self.assertTrue(all(C2Array == SD["C2"]))
Esempio n. 3
0
 def testStaibDatC2Size(self):
     """C2 array should be the correct size."""
     SD = StaibDat(self.filename)
     self.assertEqual(SD["C2"].shape[0], SD["DataPoints"])
Esempio n. 4
0
 def testStaibDatC2Array(self):
     """C2 data should be a numpy array."""
     SD = StaibDat(self.filename)
     self.assertEqual(type(SD["C2"]), numpy.ndarray)
Esempio n. 5
0
 def testStaibDatC2Exist(self):
     """C2 key should exist."""
     SD = StaibDat(self.filename)
     self.assertTrue("C2" in SD)
Esempio n. 6
0
 def testStaibDatsmoothSize(self):
   """smooth should return an array of the same size as what it was given"""
   SD = StaibDat(self.filename)
   self.assertEqual(SD.smooth("C1").shape[0],SD["C1"].shape[0])
Esempio n. 7
0
 def testStaibDatdifferentiateSize(self):
     """differentiate should return an array of the same size as what it was given"""
     SD = StaibDat(self.filename)
     self.assertEqual(SD.differentiate("C1").shape[0], SD["C1"].shape[0])
Esempio n. 8
0
 def testStaibDatsmoothInvalidKey(self):
     """smooth should fail if its given a key that doesn't refer to a numpy array"""
     SD = StaibDat(self.filename)
     self.assertRaises(TypeError, StaibDat.smooth, "fileText")
Esempio n. 9
0
 def testStaibDatfileTextStr(self):
     """fileText data should be a string."""
     SD = StaibDat(self.filename)
     self.assertEqual(type(SD["fileText"]), type(list()))
Esempio n. 10
0
 def testStaibDatfilenameVal(self):
     """filename data should match instantiating string."""
     SD = StaibDat(self.filename)
     self.assertEqual(SD["filename"], self.filename)
Esempio n. 11
0
 def testStaibDatfileTextExist(self):
     """fileText key should exist."""
     SD = StaibDat(self.filename)
     self.assertTrue("fileText" in SD)
Esempio n. 12
0
 def testStaibDatfilenameStr(self):
     """filename data should be a string."""
     SD = StaibDat(self.filename)
     self.assertEqual(type(SD["filename"]), type(str()))
Esempio n. 13
0
 def testStaibDatdifferentiateSize(self):
   """differentiate should return an array of the same size as what it was given"""
   SD = StaibDat(self.filename)
   self.assertEqual(SD.differentiate("C1").shape[0],SD["C1"].shape[0])
Esempio n. 14
0
 def testStaibDatdifferentiateArray(self):
   """differentiate should return a numpy array"""
   SD = StaibDat(self.filename)
   self.assertEqual(type(SD.differentiate("C1")),numpy.ndarray)
Esempio n. 15
0
 def testStaibDatsmoothArray(self):
     """smooth should return a numpy array"""
     SD = StaibDat(self.filename)
     self.assertEqual(type(SD.smooth("C1")), numpy.ndarray)
Esempio n. 16
0
 def testStaibDatKEValues(self):
     """KE array should have the proper values."""
     SD = StaibDat(self.filename)
     KEArray = numpy.array(SD["Basis"]["value"]) / 1000
     self.assertTrue(all(KEArray == SD["KE"]))
Esempio n. 17
0
 def testStaibDatsmoothSize(self):
     """smooth should return an array of the same size as what it was given"""
     SD = StaibDat(self.filename)
     self.assertEqual(SD.smooth("C1").shape[0], SD["C1"].shape[0])
Esempio n. 18
0
 def testStaibDatBEExist(self):
     """BE key should exist."""
     SD = StaibDat(self.filename)
     self.assertTrue("BE" in SD)
Esempio n. 19
0
 def testStaibDatdifferentiateArray(self):
     """differentiate should return a numpy array"""
     SD = StaibDat(self.filename)
     self.assertEqual(type(SD.differentiate("C1")), numpy.ndarray)
Esempio n. 20
0
 def testStaibDatBEValues(self):
     """BE array should have the proper values."""
     SD = StaibDat(self.filename)
     BEArray = SD["SourceEnergy"] - (numpy.array(SD["Basis"]["value"]) /
                                     1000)
     self.assertTrue(all(BEArray == SD["BE"]))
Esempio n. 21
0
 def testStaibDatdifferentiateInvalidKey(self):
     """differentiate should fail if its given a key that doesn't refer to a numpy array"""
     SD = StaibDat(self.filename)
     self.assertRaises(TypeError, StaibDat.differentiate, "fileText")
Esempio n. 22
0
 def testStaibDatsmoothArray(self):
   """smooth should return a numpy array"""
   SD = StaibDat(self.filename)
   self.assertEqual(type(SD.smooth("C1")),numpy.ndarray)