コード例 #1
0
    def test_SCAT(self):
        #def get_SCAT(points, low_bound, high_bound, x_max, y_max):
        points = [(2., 1.9), (1., 4.5), (5., .2)]
        points1 = [(2., 1.9), (1., 4.5), (3.5, .1)]
        points2 = [(2., 1.9), (1., 4.5), (3.5, -.1)]
        points3 = [(2., 1.9), (1., 4.5), (4., 4.)]

        def low_bound(x):
            y = 3.5 / -4.3333335 * x + 3.5
            return y

        def high_bound(x):
            y = 6.5 / -7. * x + 6.5
            return y

        x_max = 7
        y_max = 6.5
        result = lib_arai.get_SCAT(points, low_bound, high_bound, x_max, y_max)
        result1 = lib_arai.get_SCAT(points1, low_bound, high_bound, x_max,
                                    y_max)
        result2 = lib_arai.get_SCAT(points2, low_bound, high_bound, x_max,
                                    y_max)
        result3 = lib_arai.get_SCAT(points3, low_bound, high_bound, x_max,
                                    y_max)
        self.assertTrue(result)
        self.assertFalse(result1)
        self.assertFalse(result2)
        self.assertFalse(result3)
コード例 #2
0
    def test_SCAT(self):
        # def get_SCAT(points, low_bound, high_bound, x_max, y_max):
        points = [(2.0, 1.9), (1.0, 4.5), (5.0, 0.2)]
        points1 = [(2.0, 1.9), (1.0, 4.5), (3.5, 0.1)]
        points2 = [(2.0, 1.9), (1.0, 4.5), (3.5, -0.1)]
        points3 = [(2.0, 1.9), (1.0, 4.5), (4.0, 4.0)]

        def low_bound(x):
            y = 3.5 / -4.3333335 * x + 3.5
            return y

        def high_bound(x):
            y = 6.5 / -7.0 * x + 6.5
            return y

        x_max = 7
        y_max = 6.5
        result = lib_arai.get_SCAT(points, low_bound, high_bound, x_max, y_max)
        result1 = lib_arai.get_SCAT(points1, low_bound, high_bound, x_max, y_max)
        result2 = lib_arai.get_SCAT(points2, low_bound, high_bound, x_max, y_max)
        result3 = lib_arai.get_SCAT(points3, low_bound, high_bound, x_max, y_max)
        self.assertTrue(result)
        self.assertFalse(result1)
        self.assertFalse(result2)
        self.assertFalse(result3)
コード例 #3
0
ファイル: spd.py プロジェクト: moonshoes87/SPD_project
 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
コード例 #4
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
コード例 #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