def test_mean_hologram_value(self): accumulator = Accumulator() data = _load_example_data_backgrounds() for holo in data: accumulator.push(holo) numpy_mean = np.mean([holo.values for holo in data], axis=0) self.assertTrue(np.allclose(numpy_mean, accumulator.mean().values))
def test_mean_hologram_type(self): import xarray expected_type = xarray.core.dataarray.DataArray accumulator = Accumulator() data = _load_example_data_backgrounds() for holo in data: accumulator.push(holo) self.assertTrue(isinstance(accumulator.mean(), expected_type))
def test_calculate_hologram_noise_sd(self): accumulator = Accumulator() refimg = _load_raw_example_data() paths = get_example_data_path(['bg01.jpg', 'bg02.jpg', 'bg03.jpg']) bg = load_average(paths, refimg) # This value is from the legacy version of load_average self.assertTrue(np.allclose(bg.noise_sd, 0.00709834))
def test_cv_no_data(self): accumulator = Accumulator() self.assertTrue(accumulator.cv() is None)
def test_cv(self): accumulator = Accumulator() data = np.arange(10) for point in data: accumulator.push(point) self.assertTrue(accumulator.cv() == np.std(data) / np.mean(data))
def test_std_no_data(self): accumulator = Accumulator() self.assertTrue(accumulator._std() is None)
def test_push_hologram(self): accumulator = Accumulator() data = _load_example_data_backgrounds() for holo in data: accumulator.push(holo) self.assertTrue(accumulator._n == 3)
def test_push(self): accumulator = Accumulator() data = np.arange(10) for point in data: accumulator.push(point) self.assertTrue(accumulator._n == 10)