def get_result(self, ref_name="reference", est_name="estimate"): """ Wrap the result in Result object. :param ref_name: optional, label of the reference data :param est_name: optional, label of the estimated data :return: """ result = Result() metric_name = self.__class__.__name__ unit_name = self.unit.value if self.unit is not None else "" result.add_info({ "title": str(self), "ref_name": ref_name, "est_name": est_name, "label": "{} {}".format(metric_name, "({})".format(unit_name) if unit_name else "") }) result.add_stats(self.get_all_statistics()) if hasattr(self, "error"): result.add_np_array("error_array", self.error) return result
def test_write_read_integrity(self): result_out = Result() result_out.add_np_array("test-array", np.ones(1000)) result_out.add_info({"name": "test", "number": 666}) result_out.add_trajectory("traj", helpers.fake_trajectory(1000, 0.1)) file_interface.save_res_file(self.mock_file, result_out) result_in = file_interface.load_res_file(self.mock_file, load_trajectories=True) self.assertEqual(result_in, result_out)
def get_result(self, ref_name="reference", est_name="estimate"): """ Wrap the result in Result object. :param ref_name: optional, label of the reference data :param est_name: optional, label of the estimated data :return: """ result = Result() metric_name = self.__class__.__name__ unit_name = self.unit.value if self.unit is not None else "" result.add_info({ "title": str(self), "ref_name": ref_name, "est_name": est_name, "label": "{} {}".format( metric_name, "({})".format(unit_name) if unit_name else "") }) result.add_stats(self.get_all_statistics()) if hasattr(self, "error"): result.add_np_array("error_array", self.error) return result