Пример #1
0
    def test_upload_analysis_result(self):
        """Test uploading an analysis result."""
        ref_result = self.provider.experiment.analysis_results()[0]
        device_comp = self.device_components[0]
        new_experiment = self._create_experiment(device_comp.backend_name)
        new_result = AnalysisResult(experiment_uuid=new_experiment.uuid,
                                    fit=ref_result.fit,
                                    result_type=ref_result.type,
                                    device_components=[device_comp.type],
                                    quality='No Information',
                                    tags=['qiskit-test'],
                                    chisq=ref_result.chisq)
        self.provider.experiment.upload_analysis_result(new_result)
        self.results_to_delete.append(new_result.uuid)

        rresult = self.provider.experiment.retrieve_analysis_result(
            new_result.uuid)
        sub_tests = [(new_result, 'local result'),
                     (rresult, 'retrieved result')]
        self.log.debug("Verifying analysis result %s", new_result.uuid)
        for res, name in sub_tests:
            with self.subTest(sub_test_name=name):
                self.assertIsNotNone(res.uuid)
                self.assertTrue(res.creation_datetime.tzinfo)
                self.assertEqual(res.experiment_uuid, new_experiment.uuid)
                self.assertEqual(res.fit.to_dict(), ref_result.fit.to_dict())
                self.assertEqual(res.type, ref_result.type)
                self.assertEqual(res.device_components, [device_comp.type])
                self.assertEqual(res.quality.value, 'No Information')
                self.assertEqual(res.tags, ['qiskit-test'])
Пример #2
0
 def _create_analysis_result(self):
     device_comp = self.device_components[0]
     new_experiment = self._create_experiment(device_comp.backend_name)
     fit = Fit(41.456, 4.051)
     new_result = AnalysisResult(experiment_uuid=new_experiment.uuid,
                                 fit=fit,
                                 result_type="T1",
                                 device_components=[device_comp.type],
                                 tags=['qiskit-test'])
     self.provider.experiment.upload_analysis_result(new_result)
     self.results_to_delete.append(new_result.uuid)
     return new_result