def saveErrors(self):
        if self.n_traj == 0:
            return
        abs_fn = os.path.join(self.save_results_dir,
                              'mt_abs_err_' + self.align_str + '.yaml')
        for et, label in zip(self.kAbsMetrics, self.kAbsMetricLabels):
            rw.update_and_save_stats(self.abs_errors[et + '_stats'], label,
                                     abs_fn)
            np.savetxt(
                os.path.join(self.save_results_dir,
                             'mt_' + et + '_all_' + self.align_str + '.txt'),
                np.array(self.abs_errors[et]))

        for dist in self.rel_errors:
            cur_err = self.rel_errors[dist]
            dist_str = "{:3.1f}".format(dist).replace('.', '_')
            dist_fn = os.path.join(self.save_results_dir,
                                   'mt_rel_err_' + dist_str + '.yaml')
            for et, label in zip(kRelMetrics, kRelMetricLables):
                rw.update_and_save_stats(cur_err[et + '_stats'], label,
                                         dist_fn)

        overall_rel_fn = os.path.join(self.save_results_dir,
                                      'mt_rel_err_overall' + '.yaml')
        for et, label in zip(kRelMetrics, kRelMetricLables):
            rw.update_and_save_stats(self.overall_rel_errors[et], label,
                                     overall_rel_fn)

        np.savetxt(os.path.join(self.save_results_dir,
                                'mt_success_indices' + '.txt'),
                   np.array(self.success_indices).astype(int),
                   fmt='%i')
Esempio n. 2
0
    def write_errors_to_yaml(self):
        self.abs_err_stats_fn = os.path.join(
            self.saved_results_dir, 'absolute_err_statistics' + '_' +
            self.align_str + self.suffix_str + '.yaml')
        res_writer.update_and_save_stats(self.abs_errors['abs_e_trans_stats'],
                                         'trans', self.abs_err_stats_fn)
        res_writer.update_and_save_stats(self.abs_errors['abs_e_rot_stats'],
                                         'rot', self.abs_err_stats_fn)
        res_writer.update_and_save_stats(self.abs_errors['abs_e_scale_stats'],
                                         'scale', self.abs_err_stats_fn)

        self.rel_error_stats_fns = []
        for dist in self.rel_errors:
            cur_err = self.rel_errors[dist]
            dist_str = "{:3.1f}".format(dist).replace('.', '_')
            dist_fn = os.path.join(
                self.saved_results_dir, Trajectory.rel_error_prefix +
                dist_str + self.suffix_str + '.yaml')
            for et, label in zip(kRelMetrics, kRelMetricLables):
                res_writer.update_and_save_stats(cur_err[et + '_stats'], label,
                                                 dist_fn)

            self.rel_error_stats_fns.append(dist_fn)
    def write_errors_to_yaml(self):
        self.abs_err_stats_fn = os.path.join(
            self.saved_results_dir, 'absolute_err_statistics'+'_' + 
            self.align_str+'.yaml')
        res_writer.update_and_save_stats(
            self.abs_errors['abs_e_trans_stats'], 'trans',
            self.abs_err_stats_fn)
        res_writer.update_and_save_stats(
            self.abs_errors['abs_e_rot_stats'], 'rot',
            self.abs_err_stats_fn)
        res_writer.update_and_save_stats(
            self.abs_errors['abs_e_scale_stats'], 'scale',
            self.abs_err_stats_fn)

        self.rel_error_stats_fns = []
        for dist in self.rel_errors:
            cur_err = self.rel_errors[dist]
            dist_str = "{:3.1f}".format(dist).replace('.', '_')
            dist_fn = os.path.join(
                self.saved_results_dir,
                Trajectory.rel_error_prefix+dist_str+'.yaml')
            res_writer.update_and_save_stats(
                cur_err['rel_trans_stats'], 'trans', dist_fn)
            res_writer.update_and_save_stats(
                cur_err['rel_rot_stats'], 'rot', dist_fn)
            res_writer.update_and_save_stats(
                cur_err['rel_trans_perc_stats'], 'trans_perc', dist_fn)
            res_writer.update_and_save_stats(
                cur_err['rel_yaw_stats'], 'yaw', dist_fn)
            res_writer.update_and_save_stats(
                cur_err['rel_gravity_stats'], 'gravity', dist_fn)
            self.rel_error_stats_fns.append(dist_fn)