示例#1
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
示例#2
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
示例#3
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
示例#4
0
    def test_SCAT_box(self):
#        def get_SCAT_box(slope, slope_err, x_mean, y_mean, beta_threshold = .1):
        ref_y_max = 6.5
        ref_x_max = 7.
        ref_low_bound_result = 1.8846153846153846
        ref_high_bound_result = 4.642857142857142
        result = lib_arai.get_SCAT_box(self.b, self.x_mean, self.y_mean, self.beta_threshold)
        self.assertAlmostEqual(ref_low_bound_result, result[0](2.))
        self.assertAlmostEqual(ref_high_bound_result, result[1](2.))
        self.assertAlmostEqual(ref_x_max, result[2])
        self.assertAlmostEqual(ref_y_max, result[3])
示例#5
0
    def test_in_SCAT_box(self):
        low_bound, high_bound, x_max, y_max, low_line, high_line = lib_arai.get_SCAT_box(self.b,
                self.x_mean, self.y_mean, self.beta_threshold)
        good = [(2., 1.9), (1., 5.), (5., 1.8)]
        bad = [(1., 2.), (3., 4), (7.1, .2)]
#        def in_SCAT_box(x, y, low_bound, high_bound, x_max, y_max):
        for xy in good:
            result = lib_arai.in_SCAT_box(xy[0], xy[1], low_bound, high_bound, x_max, y_max)
            self.assertTrue(result)
        for xy in bad:
            result = lib_arai.in_SCAT_box(xy[0], xy[1], low_bound, high_bound, x_max, y_max)
            self.assertFalse(result)