Esempio n. 1
0
    def global_std(self):
        '''Filters vectors by a multiple of the standard deviation.

        See Also
        --------
        openpiv.validation.global_std()
        '''
        result_fnames = []
        for i, f in enumerate(self.p['fnames']):
            data = np.loadtxt(f)
            u, v, mask = piv_vld.global_std(
                data[:, 2],
                data[:, 3],
                std_threshold=self.p['global_std_threshold'])
            save_fname = create_save_vec_fname(path=f, postfix='_std_thrhld')
            save(data[:, 0],
                 data[:, 1],
                 u,
                 v,
                 data[:, 4] + mask,
                 data[:, 5],
                 save_fname,
                 delimiter=delimiter)
            result_fnames.append(save_fname)
        return (result_fnames)
Esempio n. 2
0
    def global_val(self):
        '''Filter vectors based on a global min-max threshold.

        See:
            openpiv.validation.global_val()
        '''
        result_fnames = []
        for i, f in enumerate(self.p['fnames']):
            data = np.loadtxt(f)
            u, v, mask = piv_vld.global_val(data[:, 2],
                                            data[:, 3],
                                            u_thresholds=(self.p['MinU'],
                                                          self.p['MaxU']),
                                            v_thresholds=(self.p['MinV'],
                                                          self.p['MaxV']))
            save_fname = create_save_vec_fname(path=f, postfix='_glob_thrhld')
            save(data[:, 0],
                 data[:, 1],
                 u,
                 v,
                 data[:, 4] + mask,
                 data[:, 5],
                 save_fname,
                 delimiter=delimiter)
            result_fnames.append(save_fname)
        return (result_fnames)
Esempio n. 3
0
    def sig2noise(self):
        '''Filter vectors based on the signal to noise threshold.

        See:
            openpiv.validation.sig2noise_val()
        '''
        result_fnames = []
        for i, f in enumerate(self.p['fnames']):
            data = np.loadtxt(f)
            u, v, mask = piv_vld.sig2noise_val(
                data[:, 2],
                data[:, 3],
                data[:, 5],
                threshold=self.p['sig2noise_threshold'])

            save_fname = create_save_vec_fname(path=f, postfix='_sig2noise')

            save(data[:, 0],
                 data[:, 1],
                 u,
                 v,
                 data[:, 4] + mask,
                 sig2noise=data[:, 5],
                 filename=save_fname,
                 delimiter=delimiter)
            result_fnames.append(save_fname)
        return (result_fnames)
Esempio n. 4
0
    def local_median(self):
        '''Filter vectors based on a local median threshold.

        See Also
        --------
        openpiv.validation.local_median_val()
        '''
        result_fnames = []
        for i, f in enumerate(self.p['fnames']):
            data = np.loadtxt(f)
            u, v, mask = piv_vld.local_median_val(
                data[:, 2],
                data[:, 3],
                u_threshold=self.p['local_median_threshold'],
                v_threshold=self.p['local_median_threshold'],
                size=self.p['local_median_size'])
            save_fname = create_save_vec_fname(path=f, postfix='_med_thrhld')
            save(data[:, 0],
                 data[:, 1],
                 u,
                 v,
                 data[:, 4] + mask,
                 data[:, 5],
                 save_fname,
                 delimiter=delimiter)
            result_fnames.append(save_fname)
        return (result_fnames)
    def local_median(self):
        """
            Filter vectors based on a local median threshold.

            See Also
            --------
            openpiv.validation.local_median_val()
        """
        result_fnames = []
        for i, f in enumerate(self.p['fnames']):
            data = np.loadtxt(f)
            shape = get_dim(data)
            u, v, mask = piv_vld.local_median_val(
                np.reshape(data[:, 2], shape),
                np.reshape(data[:, 3], shape),
                self.p['local_median_threshold'],
                self.p['local_median_threshold'],
                size=self.p['local_median_size'])
            save_fname = create_save_vec_fname(
                path=f,
                postfix='_med_thrhld')
            n = len(data)
            save(data[:, 0],
                 data[:, 1],
                 np.reshape(u, (n,)),
                 np.reshape(v, (n,)),
                 data[:, 4] + np.reshape(mask, (n,)),
                 data[:, 5],
                 save_fname,
                 delimiter=self.delimiter)
            result_fnames.append(save_fname)
        return result_fnames
Esempio n. 6
0
 def repl_outliers(self):
     '''Replace outliers.'''
     result_fnames = []
     for i, f in enumerate(self.p['fnames']):
         data = np.loadtxt(f)
         u, v = piv_flt.replace_outliers(np.array([data[:, 2]]),
                                         np.array([data[:, 3]]),
                                         method=self.p['repl_method'],
                                         max_iter=self.p['repl_iter'],
                                         kernel_size=self.p['repl_kernel'])
         save_fname = create_save_vec_fname(path=f, postfix='_repl')
         save(data[:, 0],
              data[:, 1],
              u,
              v,
              data[:, 4],
              data[:, 5],
              save_fname,
              delimiter=delimiter)
         result_fnames.append(save_fname)
     return (result_fnames)
 def smoothn_r(self):
     """Smoothn postprocessing results."""
     result_fnames = []
     for i, f in enumerate(self.p['fnames']):
         data = np.loadtxt(f)
         u, _, _, _ = piv_smt.smoothn(
             data[:, 2], s=self.p['smoothn_val'], isrobust=self.p['robust'])
         v, _, _, _ = piv_smt.smoothn(
             data[:, 3], s=self.p['smoothn_val'], isrobust=self.p['robust'])
         save_fname = create_save_vec_fname(
             path=f,
             postfix='_smthn')
         save(data[:, 0],
              data[:, 1],
              u, v,
              data[:, 4],
              data[:, 5],
              save_fname,
              delimiter=self.delimiter)
         result_fnames.append(save_fname)
     return result_fnames