コード例 #1
0
 def setUp(self):
     data1 = np.c_[[2., 3, 4, 5], [0, 10, 20, 30], [0, 1, 2, 3]]
     data2 = np.c_[[1., 2, 3, 4], [0, 5, 10, 20], [0, 1, 2, 3]]
     dataset1 = xye.XYEDataset(data1)
     dataset2 = xye.XYEDataset(data2)
     we1 = DatasetWithWavelength(dataset=dataset1, x=1.5)
     we2 = DatasetWithWavelength(dataset=dataset2, x=0.5)
     self.data_plus_scale_sets = [we1, we2]
コード例 #2
0
 def setUp(self):
     data1 = np.c_[[1, 4, 7], [2, 5, 8], [3, 6, 9]]
     data2 = np.c_[[10, 13, 16, 19], [11, 14, 18, 20], [12, 15, 17, 21]]
     xye1 = xye.XYEDataset(data=data1, name='test_data_0001.xye')
     create_datasetui(xye1)
     xye1.metadata['ui'].active = True
     xye2 = xye.XYEDataset(data=data2, name='test_data_0002.xye')
     create_datasetui(xye2)
     xye2.metadata['ui'].active = True
     self.datasets = [xye1, xye2]
コード例 #3
0
 def normalise_data_test(self):
     # test that normalisation leaves the x-data untouched and rescales the y and e correctly
     DETECTOR_COUNTS = 3.0
     COUNT_KEY = 'Integrated Ion Chamber Count(counts)'
     data1 = np.c_[[0., 1, 2, 3], [0, 10, 20, 30], [0, 1, 2, 3]]
     data2 = np.c_[[1., 2, 3, 4], [0, 5, 10, 20], [0, 1, 2, 3]]
     dataset1 = xye.XYEDataset(data1, metadata={COUNT_KEY: 1.0}, name='d1')
     dataset2 = xye.XYEDataset(data2,
                               metadata={COUNT_KEY: 1.0 / DETECTOR_COUNTS},
                               name='d2')
     dataset_pair = (dataset1, dataset2)
     result = processing.normalise_dataset(dataset_pair)
     print result
     print data2
     self.assertTrue(np.allclose(result[:, 0], data2[:, 0]))  # check x's
     self.assertTrue(
         np.allclose(result[:, 1],
                     data2[:, 1] * DETECTOR_COUNTS))  # check y's
     self.assertTrue(
         np.allclose(result[:, 2],
                     data2[:, 2] * np.sqrt(DETECTOR_COUNTS)))  # check e's