Beispiel #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"])
Beispiel #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"]))
Beispiel #3
0
 def testStaibDatC2Size(self):
     """C2 array should be the correct size."""
     SD = StaibDat(self.filename)
     self.assertEqual(SD["C2"].shape[0], SD["DataPoints"])
Beispiel #4
0
 def testStaibDatC2Array(self):
     """C2 data should be a numpy array."""
     SD = StaibDat(self.filename)
     self.assertEqual(type(SD["C2"]), numpy.ndarray)
Beispiel #5
0
 def testStaibDatC2Exist(self):
     """C2 key should exist."""
     SD = StaibDat(self.filename)
     self.assertTrue("C2" in SD)
Beispiel #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])
Beispiel #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])
Beispiel #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")
Beispiel #9
0
 def testStaibDatfileTextStr(self):
     """fileText data should be a string."""
     SD = StaibDat(self.filename)
     self.assertEqual(type(SD["fileText"]), type(list()))
Beispiel #10
0
 def testStaibDatfilenameVal(self):
     """filename data should match instantiating string."""
     SD = StaibDat(self.filename)
     self.assertEqual(SD["filename"], self.filename)
Beispiel #11
0
 def testStaibDatfileTextExist(self):
     """fileText key should exist."""
     SD = StaibDat(self.filename)
     self.assertTrue("fileText" in SD)
Beispiel #12
0
 def testStaibDatfilenameStr(self):
     """filename data should be a string."""
     SD = StaibDat(self.filename)
     self.assertEqual(type(SD["filename"]), type(str()))
Beispiel #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])
Beispiel #14
0
 def testStaibDatdifferentiateArray(self):
   """differentiate should return a numpy array"""
   SD = StaibDat(self.filename)
   self.assertEqual(type(SD.differentiate("C1")),numpy.ndarray)
Beispiel #15
0
 def testStaibDatsmoothArray(self):
     """smooth should return a numpy array"""
     SD = StaibDat(self.filename)
     self.assertEqual(type(SD.smooth("C1")), numpy.ndarray)
Beispiel #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"]))
Beispiel #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])
Beispiel #18
0
 def testStaibDatBEExist(self):
     """BE key should exist."""
     SD = StaibDat(self.filename)
     self.assertTrue("BE" in SD)
Beispiel #19
0
 def testStaibDatdifferentiateArray(self):
     """differentiate should return a numpy array"""
     SD = StaibDat(self.filename)
     self.assertEqual(type(SD.differentiate("C1")), numpy.ndarray)
Beispiel #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"]))
Beispiel #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")
Beispiel #22
0
 def testStaibDatsmoothArray(self):
   """smooth should return a numpy array"""
   SD = StaibDat(self.filename)
   self.assertEqual(type(SD.smooth("C1")),numpy.ndarray)