def test_calculatefirstderivative_yaxis(self):
     """Step4 - derivative: testing the first derivative calculation - axis y"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     peakfinder = PeakFinderDerivation(xdata, ydata, edata)
     [xdata_first, ydata_first] = peakfinder.getFirstDerivative()
     ydata10 = ydata_first[0:10]
     self.assertEqual(ydata10, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 1.0, -1.0])
예제 #2
0
 def test_calculate_first_derivative_xaxis_easy(self):
     '''Step1 - derivative: testing the first derivative calculation of easy data set - axis x'''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/easy_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     [xdata_first, ydata_first] = peakfinder.get_first_derivative()
     xdata10= xdata_first[0:10]
     self.assertEqual(xdata10, [0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5])
 def test_calculatefirstderivative_xaxis(self):
     """Step4 - derivative: testing the first derivative calculation - axis x"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     peakfinder = PeakFinderDerivation(xdata, ydata, edata)
     [xdata_first, ydata_first] = peakfinder.getFirstDerivative()
     xdata10 = xdata_first[0:10]
     self.assertEqual(xdata10, [0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5])
 def test_get5HighestPoints_ydata(self):
     """Step2 - 5highest points: using run 125682 to check calculation of 5 highest points - ydata """
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     peakfinder1 = PeakFinderDerivation(xdata, ydata, edata)
     [high_x, high_y] = peakfinder1.get5HighestPoints()
     high_y = high_y.tolist()
     self.assertEqual(high_y, [32351.0, 28999.0, 19351.0, 9503.0, 2796.0])
예제 #5
0
 def test_loadcsvfile_eaxis_easy(self):
     '''Step0 - Loading: checking that loadCsvFile works correctly on easy eaxis'''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/easy_data_set.csv')
     edata10 = edata[0:10]
     self.assertEqual(edata10,
                      [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 3.5])
예제 #6
0
 def test_loadcsvfile_yaxis_medium(self):
     '''Step0 - Loading: checking that loadCsvFile works correctly on medium yaxis'''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/medium_data_set.csv')
     ydata10 = ydata[0:10]
     self.assertEqual(ydata10,
                      [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 26.0])
 def test_get5HighestPoints_xdata(self):
     """Step2 - 5highest points: using run 125682 to check calculation of 5 highest points - xdata """
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     peakfinder1 = PeakFinderDerivation(xdata, ydata, edata)
     [high_x, high_y] = peakfinder1.get5HighestPoints()
     high_x = high_x.tolist()
     self.assertEqual(high_x, [155.0, 156.0, 154.0, 157.0, 153.0])
예제 #8
0
 def test_loadcsvfile_eaxis_medium(self):
     '''Step0 - Loading: checking that loadCsvFile works correctly on medium eaxis'''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/medium_data_set.csv')
     edata10 = edata[0:10]
     self.assertEqual(edata10,
                      [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.6, 5.1])
예제 #9
0
 def test_loadcsvfile_xaxis_hard(self):
     '''Step0 - Loading: checking that loadCsvFile works correctly on hard xaxis'''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     xdata10 = xdata[0:10]
     self.assertEqual(xdata10,
                      [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0])
예제 #10
0
 def test_loadcsvfile_yaxis_hard(self):
     '''Step0 - Loading: checking that loadCsvFile works correctly on hard yaxis'''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     ydata10 = ydata[0:10]
     self.assertEqual(ydata10,
                      [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 28.0, 18.0])
예제 #11
0
 def test_calculateLowResPixel_min_value_medium(self):
     ''''Step4 - assert the min value of low res for an medium data set '''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/medium_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     low_res_range = peakfinder.get_low_res()
     self.assertEqual(low_res_range[0], 89)
예제 #12
0
 def test_calculateLowResPixel_max_value_hard(self):
     ''''Step4 - assert the max value of low res for an hard data set '''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     low_res_range = peakfinder.get_low_res()
     self.assertEqual(low_res_range[1], 197)
예제 #13
0
 def test_calculatefirstderivative_yaxis_hard(self):
     '''Step1 - derivative: testing the first derivative calculation of hard data set - axis y'''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     [xdata_first, ydata_first] = peakfinder.get_first_derivative()
     ydata10= ydata_first[0:10]
     self.assertEqual(ydata10, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 28.0, -10.0, 18.0])
예제 #14
0
 def test_loadcsvfile_eaxis_hard(self):
     '''Step0- - Loading: checking that loadCsvFile works correctly on hard eaxis'''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     edata10 = edata[0:10]
     self.assertEqual(edata10,
                      [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 5.3, 4.2])
예제 #15
0
 def test_calculateMinMaxDervativePixels_minValuePixel_easy(self):
     '''Step2 - calculate Pixel of min derivative counts value of easy data set '''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/easy_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     min_derivative_value = peakfinder.get_min_derivation_pixel_value()
     self.assertEqual(min_derivative_value, 130.5)
예제 #16
0
 def test_calculateMinMaxDervativePixels_maxValue_hard(self):
     '''Step2 - calculate max derivative counts value of hard data set '''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     min_derivative_value = peakfinder.get_max_derivative_value()
     self.assertEqual(min_derivative_value, 324.0)
예제 #17
0
 def test_calculateMinMaxDervativePixels_minValue_medium(self):
     '''Step2 - calculate min derivative counts value of medium data set '''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/medium_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     min_derivative_value = peakfinder.get_min_derivative_value()
     self.assertEqual(min_derivative_value, -949.0)
예제 #18
0
 def test_calculateAvgAndStdDerivation_mean_counts_firstderi_hard(self):
     '''Step3 - calculate average of first derivation counts of hard data set'''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     mean_counts_firstderi = peakfinder.get_average_of_first_derivation_counts(
     )
     self.assertEqual(mean_counts_firstderi, 0)
예제 #19
0
 def test_calculatefirstderivative_yaxis_easy(self):
     '''Step1 - derivative: testing the first derivative calculation of easy data set - axis y'''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/easy_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     [xdata_first, ydata_first] = peakfinder.get_first_derivative()
     ydata10 = ydata_first[0:10]
     self.assertEqual(ydata10,
                      [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 11.0, 0.0])
예제 #20
0
 def test_calculate_first_derivative_xaxis_easy(self):
     '''Step1 - derivative: testing the first derivative calculation of easy data set - axis x'''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/easy_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     [xdata_first, ydata_first] = peakfinder.get_first_derivative()
     xdata10 = xdata_first[0:10]
     self.assertEqual(xdata10,
                      [0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5])
예제 #21
0
 def test_calculateAvgAndStdDerivation_std_deviation_counts_firstderi_hard(
         self):
     '''Step3 - calculate standard deviation of first derivation counts of hard data set'''
     [xdata, ydata,
      edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     std_deviation_counts_firstderi = peakfinder.get_std_deviation_of_first_derivation_counts(
     )
     self.assertAlmostEqual(std_deviation_counts_firstderi, 76.3, 0.1)
 def test_calculateMinMaxDervativePixels_minPixelValue(self):
     """Step5 - calculate pixel of min derivative counts value"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     peakfinder = PeakFinderDerivation(xdata, ydata, edata)
     min_pixel_derivative_value = peakfinder.getMinDerivationPixelValue()
     self.assertEqual(min_pixel_derivative_value, 153.5)
예제 #23
0
 def test_calculateMinMaxDervativePixels_minValuePixel_easy(self):
     '''Step2 - calculate Pixel of min derivative counts value of easy data set '''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/easy_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     min_derivative_value = peakfinder.get_min_derivation_pixel_value()
     self.assertEqual(min_derivative_value, 130.5)
예제 #24
0
 def test_calculateLowResPixel_min_value_medium(self):
     ''''Step4 - assert the min value of low res for an medium data set '''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/medium_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     low_res_range = peakfinder.get_low_res()
     self.assertEqual(low_res_range[0], 89)
 def test_case_medium_data_set(self):
     """Step7 - calculate final peak range using run 124211 (medium data set)"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/medium_data_set.csv")
     peakfinder1 = PeakFinderDerivation(xdata, ydata, edata)
     peaks = peakfinder1.getPeaks()
     self.assertEqual(peaks, [151, 159])
 def test_loadcsvfile_yaxis(self):
     """Step1 - Loading: checking that loadCsvFile works correctly on yaxis"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     ydata10 = ydata[0:10]
     self.assertEqual(ydata10, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 5.0])
 def test_calcuatePeakPixel_sumPeakCountTimePixel(self):
     """Step3 - calculate peak pixel using run 125682 to check calculation of 5 highest points - sum_ydata """
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     peakfinder1 = PeakFinderDerivation(xdata, ydata, edata)
     sum_five_highest_ydata = peakfinder1.getSumPeakCountsTimePixel()
     self.assertEqual(sum_five_highest_ydata, 14438061.0)
 def test_calculateMinMaxDervativePixels_maxValue(self):
     """Step5 - calculate max derivative counts value"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     peakfinder = PeakFinderDerivation(xdata, ydata, edata)
     max_derivative_value = peakfinder.getMaxDerivativeValue()
     self.assertEqual(max_derivative_value, 16555.0)
예제 #29
0
 def test_loadcsvfile_yaxis_hard(self):
     '''Step0 - Loading: checking that loadCsvFile works correctly on hard yaxis'''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     ydata10 = ydata[0:10]
     self.assertEqual(ydata10, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 28.0, 18.0])
예제 #30
0
 def test_loadcsvfile_xaxis_hard(self):
     '''Step0 - Loading: checking that loadCsvFile works correctly on hard xaxis'''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     xdata10 = xdata[0:10]
     self.assertEqual(xdata10, [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0])
예제 #31
0
 def test_loadcsvfile_eaxis_medium(self):
     '''Step0 - Loading: checking that loadCsvFile works correctly on medium eaxis'''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/medium_data_set.csv')
     edata10 = edata[0:10]
     self.assertEqual(edata10, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.6, 5.1])
 def test_calculateAvgAndStdDerivation_std_deviation_counts_firstderi(self):
     """Step6 - calculate standard deviation of first derivation counts"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     peakfinder = PeakFinderDerivation(xdata, ydata, edata)
     std_deviation_counts_firstderi = peakfinder.getStdDeviationOfFirstDerivationCounts()
     self.assertAlmostEqual(std_deviation_counts_firstderi, 1741.838, delta=0.001)
예제 #33
0
 def test_calculateLowResPixel_max_value_hard(self):
     ''''Step4 - assert the max value of low res for an hard data set '''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     low_res_range = peakfinder.get_low_res()
     self.assertEqual(low_res_range[1], 197)
 def test_loadcsvfile_xaxis(self):
     """Step1 - Loading: checking that loadCsvFile works correctly on xaxis"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     xdata10 = xdata[0:10]
     self.assertEqual(xdata10, [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0])
예제 #35
0
 def test_loadcsvfile_eaxis_hard(self):
     '''Step0- - Loading: checking that loadCsvFile works correctly on hard eaxis'''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     edata10 = edata[0:10]
     self.assertEqual(edata10, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 5.3, 4.2])
예제 #36
0
 def test_calculateAvgAndStdDerivation_mean_counts_firstderi_hard(self):
     '''Step3 - calculate average of first derivation counts of hard data set'''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     mean_counts_firstderi = peakfinder.get_average_of_first_derivation_counts()
     self.assertEqual(mean_counts_firstderi, 0)
 def test_calculatePeakPixel_peakPixelValue(self):
     """Step3 - calculate peak pixel value using run 125682"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     peakfinder1 = PeakFinderDerivation(xdata, ydata, edata)
     peak_pixel = peakfinder1.getPeakPixel()
     self.assertEqual(peak_pixel, 155.0)
예제 #38
0
 def test_calculateMinMaxDervativePixels_maxValue_hard(self):
     '''Step2 - calculate max derivative counts value of hard data set '''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     min_derivative_value = peakfinder.get_max_derivative_value()
     self.assertEqual(min_derivative_value, 324.0)
 def test_loadcsvfile_eaxis(self):
     """Step1 - Loading: checking that loadCsvFile works correctly on eaxis"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     edata10 = edata[0:10]
     self.assertEqual(edata10, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.236067977])
예제 #40
0
    # getters
    def get_average_of_first_derivation_counts(self):
        return self.mean_counts_firstderi

    def get_std_deviation_of_first_derivation_counts(self):
        return self.std_deviation_counts_firstderi

    def get_min_derivative_value(self):
        return self.deri_min

    def get_max_derivative_value(self):
        return self.deri_max

    def get_min_derivation_pixel_value(self):
        return self.deri_min_pixel_value

    def get_max_derivation_pixel_value(self):
        return self.deri_max_pixel_value

    def get_first_derivative(self):
        return [self.xdata_firstderi, self.ydata_firstderi]

    def get_low_res(self):
        return self.low_res


if __name__ == "__main__":
    from RefRed.file_loading_utility import loadCsvFile
    [xdata, ydata, edata] = loadCsvFile('easy_data_set.csv')
    peakfinder1 = LowResFinder(xdata, ydata, edata)
 def test_case_hard_data_set(self):
     """Step7 - calculate final peak range using run 124135 (hard data set)"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/hard_data_set.csv")
     peakfinder1 = PeakFinderDerivation(xdata, ydata, edata)
     peaks = peakfinder1.getPeaks()
     self.assertEqual(peaks, [145, 164])
예제 #42
0
 def test_calculateMinMaxDervativePixels_minValue_medium(self):
     '''Step2 - calculate min derivative counts value of medium data set '''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/medium_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     min_derivative_value = peakfinder.get_min_derivative_value()
     self.assertEqual(min_derivative_value, -949.0)
예제 #43
0
 def test_loadcsvfile_eaxis_easy(self):
     '''Step0 - Loading: checking that loadCsvFile works correctly on easy eaxis'''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/easy_data_set.csv')
     edata10 = edata[0:10]
     self.assertEqual(edata10, [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 3.5])
예제 #44
0
 def test_calculateAvgAndStdDerivation_std_deviation_counts_firstderi_hard(self):
     '''Step3 - calculate standard deviation of first derivation counts of hard data set'''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/hard_data_set.csv')
     peakfinder = LowResFinder(xdata, ydata, edata)
     std_deviation_counts_firstderi = peakfinder.get_std_deviation_of_first_derivation_counts()
     self.assertAlmostEqual(std_deviation_counts_firstderi, 76.3, 0.1)
예제 #45
0
 def test_loadcsvfile_yaxis_medium(self):
     '''Step0 - Loading: checking that loadCsvFile works correctly on medium yaxis'''
     [xdata, ydata, edata] = loadCsvFile(self.top_folder + '/medium_data_set.csv')
     ydata10 = ydata[0:10]
     self.assertEqual(ydata10, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 26.0])
 def test_calculateAvgAndStdDerivation_mean_counts_firstderi(self):
     """Step6 - calculate average of first derivation counts"""
     [xdata, ydata, edata] = loadCsvFile("peak_finder_algorithms/easy_data_set.csv")
     peakfinder = PeakFinderDerivation(xdata, ydata, edata)
     mean_counts_firstderi = peakfinder.getAverageOfFirstDerivationCounts()
     self.assertEqual(mean_counts_firstderi, 0)