예제 #1
0
 def get_SCAT(self):
     slope = self.pars['specimen_b'] 
     x_mean, y_mean = self.x_Arai_mean, self.y_Arai_mean
     x_Arai_segment, y_Arai_segment = self.x_Arai_segment, self.y_Arai_segment
     box = lib_arai.get_SCAT_box(slope, x_mean, y_mean)
     low_bound, high_bound, x_max, y_max, low_line, high_line = box[0], box[1], box[2], box[3], box[4], box[5]
     # getting SCAT points
     x_Arai_segment, y_Arai_segment = self.x_Arai_segment, self.y_Arai_segment
     tmin, tmax = self.tmin, self.tmax
     ptrm_checks_temps, ptrm_checks_starting_temps = self.ptrm_checks_temperatures, self.ptrm_checks_starting_temperatures
     x_ptrm_check, y_ptrm_check =  self.x_ptrm_check, self.y_ptrm_check
     tail_checks_temps, tail_checks_starting_temps =  self.tail_checks_temperatures, self.tail_checks_starting_temperatures
     x_tail_check, y_tail_check = self.x_tail_check, self.y_tail_check
     points, fancy_points = lib_arai.get_SCAT_points(x_Arai_segment, y_Arai_segment, tmin, tmax, 
                                       ptrm_checks_temps, ptrm_checks_starting_temps, 
                                       x_ptrm_check, y_ptrm_check, tail_checks_temps, 
                                       tail_checks_starting_temps, x_tail_check, y_tail_check)
     # checking each point
     SCAT = lib_arai.get_SCAT(points, low_bound, high_bound, x_max, y_max)
     fancy_SCAT, SCATs = lib_arai.fancy_SCAT(fancy_points, low_bound, high_bound, x_max, y_max)
     #'SCAT_arai': False, 'SCAT_tail': True, 'SCAT_ptrm': True})
     self.pars['SCAT'] = fancy_SCAT
     self.pars['fail_arai_beta_box_scatter'] = SCATs['SCAT_arai']
     self.pars["fail_ptrm_beta_box_scatter"] = SCATs['SCAT_ptrm']
     self.pars["fail_tail_beta_box_scatter"] = SCATs['SCAT_tail']
     self.pars['scat_bounding_line_high'] = high_line # [y_int, slope]
     self.pars['scat_bounding_line_low'] = low_line # [y_int, slope]
     return fancy_SCAT
예제 #2
0
 def test_SCAT_points(self):
     x_Arai_segment = [1.0, 2.0]
     y_Arai_segment = [4.5, 1.0]
     tmin = 20.0
     tmax = 40.0
     ptrm_checks_temperatures = [10, 20, 30, 40]
     ptrm_checks_starting_temperatures = [20, 30, 40, 50]
     x_ptrm_check = [1, 2, 3, 4]
     y_ptrm_check = [4.0, 3.0, 2.0, 0.0]
     tail_checks_temperatures = [15.0, 25.0, 35.0, 45.0]
     tail_checks_starting_temperatures = [25.0, 35.0, 45.0, 55.0]
     x_tail_check = [1.5, 2.5, 3.5, 4.5]
     y_tail_check = [4.5, 3.5, 2.5, 1.5]
     ref_points = [(1.0, 4.5), (2.0, 1.0), (2.0, 3.0), (3.0, 2.0), (2.5, 3.5)]
     result = lib_arai.get_SCAT_points(
         x_Arai_segment,
         y_Arai_segment,
         tmin,
         tmax,
         ptrm_checks_temperatures,
         ptrm_checks_starting_temperatures,
         x_ptrm_check,
         y_ptrm_check,
         tail_checks_temperatures,
         tail_checks_starting_temperatures,
         x_tail_check,
         y_tail_check,
     )
     print "result (in test_SCAT_points)", result
     for xy in result[0]:
         self.assertIn(xy, ref_points)
예제 #3
0
 def get_SCAT(self):
     if (
             len(set(self.y_Arai_segment)) == 1
     ):  # prevents divide by zero, i.e. if all y values in segment are the same [1,1,1]
         self.pars['SCAT'] = 0  #float('nan')
         self.pars['fail_arai_beta_box_scatter'] = 0  # float('nan')
         self.pars["fail_ptrm_beta_box_scatter"] = 0  #float('nan')
         self.pars["fail_tail_beta_box_scatter"] = 0  #float('nan')
         self.pars['scat_bounding_line_high'] = 0  # float('nan')
         self.pars['scat_bounding_line_low'] = 0  #float('nan')
         return 0
     slope = self.pars['specimen_b']
     x_mean, y_mean = self.x_Arai_mean, self.y_Arai_mean
     x_Arai_segment, y_Arai_segment = self.x_Arai_segment, self.y_Arai_segment
     if 'specimen_b_beta' in self.acceptance_criteria:
         box = lib_arai.get_SCAT_box(
             slope,
             x_mean,
             y_mean,
             beta_threshold=self.acceptance_criteria['specimen_b_beta']
             ['value'])
     else:
         box = lib_arai.get_SCAT_box(slope, x_mean, y_mean)
     low_bound, high_bound, x_max, y_max, low_line, high_line = box[0], box[
         1], box[2], box[3], box[4], box[5]
     # getting SCAT points
     x_Arai_segment, y_Arai_segment = self.x_Arai_segment, self.y_Arai_segment
     tmin, tmax = self.tmin, self.tmax
     ptrm_checks_temps, ptrm_checks_starting_temps = self.ptrm_checks_temperatures, self.ptrm_checks_starting_temperatures
     x_ptrm_check, y_ptrm_check = self.x_ptrm_check, self.y_ptrm_check
     tail_checks_temps, tail_checks_starting_temps = self.tail_checks_temperatures, self.tail_checks_starting_temperatures
     x_tail_check, y_tail_check = self.x_tail_check, self.y_tail_check
     points, fancy_points = lib_arai.get_SCAT_points(
         x_Arai_segment, y_Arai_segment, tmin, tmax, ptrm_checks_temps,
         ptrm_checks_starting_temps, x_ptrm_check, y_ptrm_check,
         tail_checks_temps, tail_checks_starting_temps, x_tail_check,
         y_tail_check)
     # checking each point
     SCAT = lib_arai.get_SCAT(points, low_bound, high_bound, x_max, y_max)
     fancy_SCAT, SCATs = lib_arai.fancy_SCAT(fancy_points, low_bound,
                                             high_bound, x_max, y_max)
     #'SCAT_arai': False, 'SCAT_tail': True, 'SCAT_ptrm': True})
     if fancy_SCAT.upper() == 'PASS':
         self.pars['SCAT'] = 't'
     else:
         self.pars['SCAT'] = 'f'
     #self.pars['SCAT'] = fancy_SCAT
     # set self.pars['SCAT'] to 'g' or 'b' here?
     self.pars['fail_arai_beta_box_scatter'] = SCATs['SCAT_arai']
     self.pars["fail_ptrm_beta_box_scatter"] = SCATs['SCAT_ptrm']
     self.pars["fail_tail_beta_box_scatter"] = SCATs['SCAT_tail']
     self.pars['scat_bounding_line_high'] = high_line  # [y_int, slope]
     self.pars['scat_bounding_line_low'] = low_line  # [y_int, slope]
     return fancy_SCAT
예제 #4
0
 def test_SCAT_points(self):
     x_Arai_segment = [1., 2.]
     y_Arai_segment = [4.5, 1.]
     tmin = 20.
     tmax = 40.
     ptrm_checks_temperatures = [10, 20, 30, 40]
     ptrm_checks_starting_temperatures = [20, 30, 40, 50]
     x_ptrm_check = [1, 2, 3, 4]
     y_ptrm_check = [4., 3., 2., 0.]
     tail_checks_temperatures = [15., 25., 35., 45.]
     tail_checks_starting_temperatures = [25., 35., 45., 55.]
     x_tail_check = [1.5, 2.5, 3.5, 4.5]
     y_tail_check = [4.5, 3.5, 2.5, 1.5]
     ref_points = [(1., 4.5), (2., 1.), (2., 3.), (3., 2.), (2.5, 3.5)]
     result = lib_arai.get_SCAT_points(x_Arai_segment, y_Arai_segment, tmin, tmax, ptrm_checks_temperatures, ptrm_checks_starting_temperatures, x_ptrm_check, y_ptrm_check, tail_checks_temperatures, tail_checks_starting_temperatures, x_tail_check, y_tail_check)
     #print "result (in test_SCAT_points)", result
     for xy in result[0]:
         self.assertIn(xy, ref_points)
예제 #5
0
파일: spd.py 프로젝트: CrabGit334/PmagPy
 def get_SCAT(self):
     if (len(set(self.y_Arai_segment)) == 1): # prevents divide by zero, i.e. if all y values in segment are the same [1,1,1]
         self.pars['SCAT'] = 0 #float('nan')
         self.pars['fail_arai_beta_box_scatter'] = 0# float('nan')
         self.pars["fail_ptrm_beta_box_scatter"] = 0#float('nan')
         self.pars["fail_tail_beta_box_scatter"] = 0#float('nan')
         self.pars['scat_bounding_line_high'] = 0# float('nan')
         self.pars['scat_bounding_line_low'] = 0#float('nan')
         return 0
     slope = self.pars['specimen_b']
     x_mean, y_mean = self.x_Arai_mean, self.y_Arai_mean
     x_Arai_segment, y_Arai_segment = self.x_Arai_segment, self.y_Arai_segment
     if 'specimen_b_beta' in self.acceptance_criteria:
         box = lib_arai.get_SCAT_box(slope, x_mean, y_mean, beta_threshold=self.acceptance_criteria['specimen_b_beta']['value'])
     else:
         box = lib_arai.get_SCAT_box(slope, x_mean, y_mean)
     low_bound, high_bound, x_max, y_max, low_line, high_line = box[0], box[1], box[2], box[3], box[4], box[5]
     # getting SCAT points
     x_Arai_segment, y_Arai_segment = self.x_Arai_segment, self.y_Arai_segment
     tmin, tmax = self.tmin, self.tmax
     ptrm_checks_temps, ptrm_checks_starting_temps = self.ptrm_checks_temperatures, self.ptrm_checks_starting_temperatures
     x_ptrm_check, y_ptrm_check =  self.x_ptrm_check, self.y_ptrm_check
     tail_checks_temps, tail_checks_starting_temps =  self.tail_checks_temperatures, self.tail_checks_starting_temperatures
     x_tail_check, y_tail_check = self.x_tail_check, self.y_tail_check
     points, fancy_points = lib_arai.get_SCAT_points(x_Arai_segment, y_Arai_segment, tmin, tmax,
                                       ptrm_checks_temps, ptrm_checks_starting_temps,
                                       x_ptrm_check, y_ptrm_check, tail_checks_temps,
                                       tail_checks_starting_temps, x_tail_check, y_tail_check)
     # checking each point
     SCAT = lib_arai.get_SCAT(points, low_bound, high_bound, x_max, y_max)
     fancy_SCAT, SCATs = lib_arai.fancy_SCAT(fancy_points, low_bound, high_bound, x_max, y_max)
     #'SCAT_arai': False, 'SCAT_tail': True, 'SCAT_ptrm': True})
     if fancy_SCAT.upper() == 'PASS':
         self.pars['SCAT'] = 't'
     else:
         self.pars['SCAT'] = 'f'
     #self.pars['SCAT'] = fancy_SCAT
     # set self.pars['SCAT'] to 'g' or 'b' here?
     self.pars['fail_arai_beta_box_scatter'] = SCATs['SCAT_arai']
     self.pars["fail_ptrm_beta_box_scatter"] = SCATs['SCAT_ptrm']
     self.pars["fail_tail_beta_box_scatter"] = SCATs['SCAT_tail']
     self.pars['scat_bounding_line_high'] = high_line # [y_int, slope]
     self.pars['scat_bounding_line_low'] = low_line # [y_int, slope]
     return fancy_SCAT