def setUp(self): self.holo = get_example_data('image0001') self.holograms = [ get_example_data('image0001'), get_example_data('image0002') ] self.tempdir = tempfile.mkdtemp()
def test_AlphaModelholo_likelihood(): holo = get_example_data('image0001') s = Sphere( prior.Gaussian(.5, .1), prior.Gaussian(1.6, .1), (prior.Gaussian(5, 1), prior.Gaussian(5, 1), prior.Gaussian(5, 1))) model = AlphaModel(s, alpha=prior.Gaussian(.7, .1), noise_sd=.01) assert_pickle_roundtrip(model)
def test_fit_mie_single(): holo = normalize(get_example_data('image0001.yaml')) parameters = [ Parameter(name='x', guess=.567e-5, limit=[0.0, 1e-5]), Parameter(name='y', guess=.576e-5, limit=[0, 1e-5]), Parameter(name='z', guess=15e-6, limit=[1e-5, 2e-5]), Parameter(name='n', guess=1.59, limit=[1, 2]), Parameter(name='r', guess=8.5e-7, limit=[1e-8, 1e-5]) ] def make_scatterer(x, y, z, r, n): return Sphere(n=n + 1e-4j, r=r, center=(x, y, z)) thry = Mie(False) model = Model(Parametrization(make_scatterer, parameters), thry.calc_holo, alpha=Parameter(name='alpha', guess=.6, limit=[.1, 1])) assert_raises(InvalidMinimizer, fit, model, holo, minimizer=Sphere) result = fit(model, holo) assert_obj_close(result.scatterer, gold_sphere, rtol=1e-3) assert_approx_equal(result.parameters['alpha'], gold_alpha, significant=3) assert_equal(model, result.model)
def test_reconstruction(): im = get_example_data('image0003') rec = propagate(im, 4e-6) verify(rec, 'recon_single') rec = propagate(im, [4e-6, 7e-6, 10e-6]) verify(rec, 'recon_multiple')
def test_image_io(): holo = get_example_data('image0001.yaml') t = tempfile.mkdtemp() filename = os.path.join(t, 'image0001.tif') save(filename, holo) l = load(filename) assert_obj_close(l, holo) # check that it defaults to saving as tif filename = os.path.join(t, 'image0002') save_image(filename, holo) l = load(filename + '.tif') assert_obj_close(l, holo) # check saving 16 bit filename = os.path.join(t, 'image0003') save_image(filename, holo, scaling=None, depth=16) l = load(filename + '.tif') assert_obj_close(l, holo) # test that yaml save works corretly with a string instead of a file filename = os.path.join(t, 'image0001.yaml') save(filename, holo) loaded = load(filename) assert_obj_close(loaded, holo) f = get_example_data_path('image0001.yaml') spacing = .1 optics = Optics(.66, 1.33, (1, 0)) with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') h = load(f, spacing=spacing, optics=optics) assert_obj_close(h.optics, optics) assert_equal(h.spacing, spacing) assert_equal(len(w), 1) assert "Overriding spacing and optics of loaded yaml" in w[-1].message with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') h = load(f, optics=optics) assert_obj_close(h.optics, optics) assert_equal(h.spacing, holo.spacing) assert_equal(len(w), 1) assert ("WARNING: overriding optics of loaded yaml without " "overriding spacing, this is probably incorrect." in w[-1].message) with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') h = load(f, spacing=spacing) assert_obj_close(h.optics, holo.optics) assert_equal(h.spacing, spacing) assert_equal(len(w), 1) assert ("WARNING: overriding spacing of loaded yaml without " "overriding optics, this is probably incorrect." in w[-1].message) shutil.rmtree(t)
def test_propagate_0_distance(): im = get_example_data('image0003') rec = propagate(im, 0) # propagating no distance should leave the image unchanged assert_obj_close(im, rec) rec = propagate(im, [0, 3e-6]) verify(rec, 'recon_multiple_with_0')
def test_subset_tempering(): holo = normalize(get_example_data('image0001')) scat = Sphere(r=0.65e-6,n=1.58,center=[5.5e-6,5.8e-6,14e-6]) mod = AlphaModel(scat,noise_sd=.1, alpha=prior.Gaussian(0.7,0.1)) with warnings.catch_warnings(): warnings.simplefilter('ignore') inf = sample.tempered_sample(mod, holo, nwalkers=4, samples=10, stages=1, stage_len=10, threads=None, seed=40) assert_obj_close(inf.MAP,gold_alpha, rtol=1e-3)
def test_emcee(): holo = get_example_data('image0001.yaml') s = Sphere( prior.Gaussian(.5, .1), prior.Gaussian(1.6, .1), (prior.Gaussian(5, 1), prior.Gaussian(5, 1), prior.Gaussian(5, 1))) model = AlphaModel(s, Mie, alpha=prior.Gaussian(.7, .1), noise_sd=.01) emcee = Emcee(model, holo) assert_pickle_roundtrip(emcee)
def test_ExactModelholo_likelihood(): holo = get_example_data('image0001') sphere_center = (prior.Gaussian(5, 1), prior.Gaussian(5, 1), prior.Gaussian(5, 1)) s = Sphere(n=prior.Gaussian(1.6, .1), r=prior.Gaussian(.5, .1), center=sphere_center) model = ExactModel(s, noise_sd=.01) assert_pickle_roundtrip(model)
def test_PerfectLensModelholo_likelihood(): holo = get_example_data('image0001') sphere_center = (prior.Gaussian(5, 1), prior.Gaussian(5, 1), prior.Gaussian(5, 1)) s = Sphere(n=prior.Gaussian(1.6, .1), r=prior.Gaussian(.5, .1), center=sphere_center) model = PerfectLensModel(s, noise_sd=0.01, lens_angle=0.8) assert_pickle_roundtrip(model)
def test_fft_ifft_2d_are_inverses(self): xarray = get_example_data('image0001') forward = fft(xarray) backward = ifft(forward) data_is_same = np.allclose(xarray.values, backward.values, atol=1e-13, rtol=1e-13) self.assertTrue(data_is_same)
def test_show(): d = get_example_data('image0001') try: hp.show(d) except RuntimeError: # this occurs on travis since there is no display raise SkipTest() with warnings.catch_warnings(): warnings.simplefilter('ignore'), (DeprecationWarning, UserWarning) plt.savefig(tempfile.TemporaryFile(suffix='.pdf'))
def test_subset_tempering(): np.random.seed(40) holo = normalize(get_example_data('image0001.yaml')) scat = Sphere(r=0.65e-6,n=1.58,center=[5.5e-6,5.8e-6,14e-6]) mod = AlphaModel(scat,Mie,noise_sd=.1,alpha=prior.Gaussian(0.7,0.1)) inf=mcmc.subset_tempering(mod,holo,final_len=10,nwalkers=4,stages=1,stage_len=10,threads=None, verbose=False,seed=40) assert_obj_close(inf.most_probable_values(),gold_alpha) assert_equal(inf.n_steps,gold_nsteps) assert_obj_close(inf.acceptance_fraction,gold_frac) assert_obj_close(float(inf.data_frame(burn_in=6)[1:2].alpha),gold_alpha)
def test_image_io(): holo = get_example_data('image0001.yaml') t = tempfile.mkdtemp() filename = os.path.join(t, 'image0001.tif') save(filename, holo) l = load(filename) assert_obj_close(l, holo) # check that it defaults to saving as tif filename = os.path.join(t, 'image0002') save_image(filename, holo) l = load(filename+'.tif') assert_obj_close(l, holo) # test that yaml save works corretly with a string instead of a file filename = os.path.join(t, 'image0001.yaml') save(filename, holo) loaded = load(filename) assert_obj_close(loaded, holo) f = get_example_data_path('image0001.yaml') spacing = .1 optics = Optics(.66, 1.33, (1,0)) with warnings.catch_warnings(record =True) as w: warnings.simplefilter('always') h = load(f, spacing = spacing, optics = optics) assert_obj_close(h.optics, optics) assert_equal(h.spacing, spacing) assert_equal(len(w), 1) assert "Overriding spacing and optics of loaded yaml" in w[-1].message with warnings.catch_warnings(record =True) as w: warnings.simplefilter('always') h = load(f, optics = optics) assert_obj_close(h.optics, optics) assert_equal(h.spacing, holo.spacing) assert_equal(len(w), 1) assert ("WARNING: overriding optics of loaded yaml without " "overriding spacing, this is probably incorrect." in w[-1].message) with warnings.catch_warnings(record =True) as w: warnings.simplefilter('always') h = load(f, spacing = spacing) assert_obj_close(h.optics, holo.optics) assert_equal(h.spacing, spacing) assert_equal(len(w), 1) assert ("WARNING: overriding spacing of loaded yaml without " "overriding optics, this is probably incorrect." in w[-1].message) shutil.rmtree(t)
def test_fit_multisphere_noisydimer_slow(): optics = Optics(wavelen=658e-9, polarization = [0., 1.0], divergence = 0., pixel_scale = [0.345e-6, 0.345e-6], index = 1.334) holo = normalize(get_example_data('image0002.yaml')) # Now construct the model, and fit parameters = [Parameter(name = 'x0', guess = 1.64155e-5, limit = [0, 1e-4]), Parameter(1.7247e-5, [0, 1e-4], 'y0'), Parameter(20.582e-6, [0, 1e-4], 'z0'), Parameter(.6856e-6, [1e-8, 1e-4], 'r0'), Parameter(1.6026, [1, 2], 'nr0'), Parameter(1.758e-5, [0, 1e-4], 'x1'), Parameter(1.753e-5, [0, 1e-4], 'y1'), Parameter(21.2698e-6, [1e-8, 1e-4], 'z1'), Parameter(.695e-6, [1e-8, 1e-4], 'r1'), Parameter(1.6026, [1, 2], 'nr1')] def make_scatterer(x0, x1, y0, y1, z0, z1, r0, r1, nr0, nr1): s = Spheres([ Sphere(center = (x0, y0, z0), r=r0, n = nr0+1e-5j), Sphere(center = (x1, y1, z1), r=r1, n = nr1+1e-5j)]) return s # initial guess #s1 = Sphere(n=1.6026+1e-5j, r = .6856e-6, # center=(1.64155e-05, 1.7247e-05, 20.582e-6)) #s2 = Sphere(n=1.6026+1e-5j, r = .695e-6, # center=(1.758e-05, 1.753e-05, 21.2698e-6)) #sc = Spheres([s1, s2]) #alpha = 0.99 #lb1 = Sphere(1+1e-5j, 1e-8, 0, 0, 0) #ub1 = Sphere(2+1e-5j, 1e-5, 1e-4, 1e-4, 1e-4) #step1 = Sphere(1e-4+1e-4j, 1e-8, 0, 0, 0) #lb = Spheres([lb1, lb1]), .1 #ub = Spheres([ub1, ub1]), 1 #step = Spheres([step1, step1]), 0 model = Model(parameters, Multisphere, make_scatterer=make_scatterer, alpha = Parameter(.99, [.1, 1.0], 'alpha')) result = fit(model, holo) print result.scatterer gold = np.array([1.642e-5, 1.725e-5, 2.058e-5, 1e-5, 1.603, 6.857e-7, 1.758e-5, 1.753e-5, 2.127e-5, 1e-5, 1.603, 6.964e-7]) gold_alpha = 1.0 assert_parameters_allclose(result.scatterer, gold, rtol=1e-2) # TODO: This test fails, alpha comes back as .9899..., where did # the gold come from? assert_approx_equal(result.alpha, gold_alpha, significant=2)
def test_alpha_subset_tempering(self): holo = normalize(get_example_data('image0001')) scat = Sphere(r=0.65e-6, n=1.58, center=[5.5e-6, 5.8e-6, 14e-6]) mod = AlphaModel(scat, noise_sd=.1, alpha=prior.Gaussian(0.7, 0.1)) strat = TemperedStrategy(nwalkers=4, nsamples=10, stages=1, stage_len=10, parallel=None, seed=40) with warnings.catch_warnings(): warnings.simplefilter('ignore') inference_result = strat.sample(mod, holo) desired_alpha = np.array([0.650348]) assert_allclose(inference_result._parameters, desired_alpha, rtol=5e-3)
def test_subset_data_fit_result_stores_model(self): model = self._make_model() holo = get_example_data('image0001') np.random.seed(40) fitter = NmpfitStrategy(npixels=100, maxiter=1) with warnings.catch_warnings(): warnings.simplefilter('ignore', UserWarning) # ignore not-converged warnings since we only do 2 iterations fitted = fitter.fit(model, holo) self.assertEqual(model, fitted.model)
def test_subset_data_fit_result_is_saveable(self): model = self._make_model() holo = get_example_data('image0001') np.random.seed(40) fitter = NmpfitStrategy(npixels=100, maxiter=1) with warnings.catch_warnings(): warnings.simplefilter('ignore', UserWarning) # ignore not-converged warnings since we only do 2 iterations fitted = fitter.fit(model, holo) result = fitted # was fix_flat(fitted) assert_read_matches_write(result)
def test_perfectlens_subset_tempering(self): data = normalize(get_example_data('image0001')) scatterer = Sphere(r=0.65e-6, n=1.58, center=[5.5e-6, 5.8e-6, 14e-6]) model = PerfectLensModel( scatterer, noise_sd=.1, lens_angle=prior.Gaussian(0.7, 0.1)) strat = TemperedStrategy(nwalkers=4, nsamples=10, stages=1, stage_len=10, parallel=None, seed=40) with warnings.catch_warnings(): warnings.simplefilter('ignore') inference_result = strat.sample(model, data) desired_lens_angle = np.array([0.7197887]) is_ok = np.allclose( inference_result._parameters, desired_lens_angle, rtol=1e-3) self.assertTrue(is_ok)
def test_returns_close_values(self): model = self._make_model() holo = normalize(get_example_data('image0001')) np.random.seed(40) result = NmpfitStrategy(npixels=1000).fit(model, holo) # TODO: figure out if it is a problem that alpha is frequently # coming out wrong in the 3rd decimal place. self.assertAlmostEqual(result.parameters['alpha'], gold_alpha, places=3) # TODO: this tolerance has to be rather large to pass, we should # probably track down if this is a sign of a problem assert_obj_close(result.scatterer, gold_sphere, rtol=1e-2)
def test_fit_single_openopt(): holo = normalize(get_example_data('image0001.yaml')) s = Sphere(center = (par(guess=.567e-5, limit=[.4e-5,.6e-5]), par(.567e-5, (.4e-5, .6e-5)), par(15e-6, (1.3e-5, 1.8e-5))), r = par(8.5e-7, (5e-7, 1e-6)), n = ComplexParameter(par(1.59, (1.5,1.8)), 1e-4j)) model = Model(s, Mie(False).calc_holo, alpha = par(.6, [.1,1])) try: minimizer = OpenOpt('scipy_slsqp') except ImportError: raise SkipTest result = fit(model, holo, minimizer = minimizer) assert_obj_close(result.scatterer, gold_sphere, rtol=1e-3) # TODO: see if we can get this back to 3 sig figs correct alpha assert_approx_equal(result.parameters['alpha'], gold_alpha, significant=3) assert_equal(model, result.model)
def test_fit_mie_par_scatterer(): holo = normalize(get_example_data('image0001')) s = Sphere(center=(Uniform(0, 1e-5, guess=.567e-5), Uniform(0, 1e-5, .567e-5), Uniform(1e-5, 2e-5)), r=Uniform(1e-8, 1e-5, 8.5e-7), n=ComplexPrior(Uniform(1, 2, 1.59), 1e-4)) thry = Mie(False) model = AlphaModel(s, theory=thry, alpha=Uniform(.1, 1, .6)) result = fix_flat(NmpfitStrategy().fit(model, holo)) assert_obj_close(result.scatterer, gold_sphere, rtol=1e-3) # TODO: see if we can get this back to 3 sig figs correct alpha assert_approx_equal(result.parameters['alpha'], gold_alpha, significant=3) assert_equal(model, result.model) assert_read_matches_write(result)
def test_fit_mie_par_scatterer(): holo = normalize(get_example_data('image0001.yaml')) s = Sphere(center = (par(guess=.567e-5, limit=[0,1e-5]), par(.567e-5, (0, 1e-5)), par(15e-6, (1e-5, 2e-5))), r = par(8.5e-7, (1e-8, 1e-5)), n = ComplexParameter(par(1.59, (1,2)), 1e-4j)) thry = Mie(False) model = Model(s, thry.calc_holo, alpha = par(.6, [.1,1])) result = fit(model, holo) assert_obj_close(result.scatterer, gold_sphere, rtol=1e-3) # TODO: see if we can get this back to 3 sig figs correct alpha assert_approx_equal(result.parameters['alpha'], gold_alpha, significant=3) assert_equal(model, result.model) assert_read_matches_write(result)
def test_fit_random_subset(): holo = normalize(get_example_data('image0001.yaml')) s = Sphere(center = (par(guess=.567e-5, limit=[0,1e-5]), par(.567e-5, (0, 1e-5)), par(15e-6, (1e-5, 2e-5))), r = par(8.5e-7, (1e-8, 1e-5)), n = ComplexParameter(par(1.59, (1,2)),1e-4)) model = Model(s, Mie(False).calc_holo, alpha = par(.6, [.1,1])) np.random.seed(40) result = fit(model, holo, random_subset=.1) # TODO: this tolerance has to be rather large to pass, we should # probably track down if this is a sign of a problem assert_obj_close(result.scatterer, gold_sphere, rtol=1e-2) # TODO: figure out if it is a problem that alpha is frequently coming out # wrong in the 3rd decimal place. assert_approx_equal(result.parameters['alpha'], gold_alpha, significant=3) assert_equal(model, result.model) assert_read_matches_write(result)
def test_fit_random_subset(): holo = normalize(get_example_data('image0001.yaml')) s = Sphere(center = (par(guess=.567e-5, limit=[0,1e-5]), par(.567e-5, (0, 1e-5)), par(15e-6, (1e-5, 2e-5))), r = par(8.5e-7, (1e-8, 1e-5)), n = ComplexParameter(par(1.59, (1,2)),1e-4j)) model = Model(s, Mie.calc_holo, alpha = par(.6, [.1,1])) np.random.seed(40) result = fit(model, holo, random_subset=.1) # we have to use a relatively loose tolerance here because the random # selection occasionally causes the fit to be a bit worse assert_obj_close(result.scatterer, gold_sphere, rtol=1e-3) # TODO: figure out if it is a problem that alpha is frequently coming out # wrong in the 3rd decimal place. assert_approx_equal(result.parameters['alpha'], gold_alpha, significant=3) assert_equal(model, result.model) assert_read_matches_write(result)
def test_fit_random_subset(): holo = normalize(get_example_data('image0001.yaml')) s = Sphere(center = (par(guess=.567e-5, limit=[0,1e-5]), par(.567e-5, (0, 1e-5)), par(15e-6, (1e-5, 2e-5))), r = par(8.5e-7, (1e-8, 1e-5)), n = ComplexParameter(par(1.59, (1,2)),1e-4j)) model = Model(s, Mie.calc_holo, alpha = par(.6, [.1,1])) np.random.seed(40) result = fit(model, holo, use_random_fraction=.1) # we have to use a relatively loose tolerance here because the random # selection occasionally causes the fit to be a bit worse assert_obj_close(result.scatterer, gold_sphere, rtol=1e-2) # TODO: figure out if it is a problem that alpha is frequently coming out # wrong in the 3rd decimal place. assert_approx_equal(result.parameters['alpha'], gold_alpha, significant=2) assert_equal(model, result.model) assert_read_matches_write(result)
def test_fit_random_subset(): holo = normalize(get_example_data('image0001.yaml')) s = Sphere(center=(par(guess=.567e-5, limit=[0, 1e-5]), par(.567e-5, (0, 1e-5)), par(15e-6, (1e-5, 2e-5))), r=par(8.5e-7, (1e-8, 1e-5)), n=ComplexParameter(par(1.59, (1, 2)), 1e-4)) model = Model(s, Mie(False).calc_holo, alpha=par(.6, [.1, 1])) np.random.seed(40) result = fit(model, holo, random_subset=.1) # TODO: this tolerance has to be rather large to pass, we should # probably track down if this is a sign of a problem assert_obj_close(result.scatterer, gold_sphere, rtol=1e-2) # TODO: figure out if it is a problem that alpha is frequently coming out # wrong in the 3rd decimal place. assert_approx_equal(result.parameters['alpha'], gold_alpha, significant=3) assert_equal(model, result.model) assert_read_matches_write(result)
def test_fit_random_subset(): holo = normalize(get_example_data('image0001')) s = Sphere(center=(Uniform(0, 1e-5, guess=.567e-5), Uniform(0, 1e-5, .567e-5), Uniform(1e-5, 2e-5)), r=Uniform(1e-8, 1e-5, 8.5e-7), n=ComplexPrior(Uniform(1, 2, 1.59), 1e-4)) model = AlphaModel(s, theory=Mie(False), alpha=Uniform(.1, 1, .6)) np.random.seed(40) result = fix_flat(NmpfitStrategy(npixels=1000).fit(model, holo)) # TODO: this tolerance has to be rather large to pass, we should # probably track down if this is a sign of a problem assert_obj_close(result.scatterer, gold_sphere, rtol=1e-2) # TODO: figure out if it is a problem that alpha is frequently coming out # wrong in the 3rd decimal place. assert_approx_equal(result.parameters['alpha'], gold_alpha, significant=3) assert_equal(model, result.model) assert_read_matches_write(result)
def test_fit_mie_single(): holo = normalize(get_example_data('image0001.yaml')) parameters = [Parameter(name='x', guess=.567e-5, limit = [0.0, 1e-5]), Parameter(name='y', guess=.576e-5, limit = [0, 1e-5]), Parameter(name='z', guess=15e-6, limit = [1e-5, 2e-5]), Parameter(name='n', guess=1.59, limit = [1, 2]), Parameter(name='r', guess=8.5e-7, limit = [1e-8, 1e-5])] def make_scatterer(x, y, z, r, n): return Sphere(n=n+1e-4j, r = r, center = (x, y, z)) thry = Mie(False) model = Model(Parametrization(make_scatterer, parameters), thry.calc_holo, alpha=Parameter(name='alpha', guess=.6, limit = [.1, 1])) assert_raises(InvalidMinimizer, fit, model, holo, minimizer=Sphere) result = fit(model, holo) assert_obj_close(result.scatterer, gold_sphere, rtol = 1e-3) assert_approx_equal(result.parameters['alpha'], gold_alpha, significant=3) assert_equal(model, result.model)
def test_fit_mie_single(): holo = normalize(get_example_data('image0001')) parameters = [ Uniform(0, 1e-5, name='x', guess=.567e-5), Uniform(0, 1e-5, name='y', guess=.576e-5), Uniform(1e-5, 2e-5, name='z', guess=15e-6), Uniform(1, 2, name='n', guess=1.59), Uniform(1e-8, 1e-5, name='r', guess=8.5e-7) ] def make_scatterer(parlist): return Sphere(n=parlist[3], r=parlist[4], center=parlist[0:3]) thry = Mie(False) model = AlphaModel(make_scatterer(parameters), theory=thry, alpha=Uniform(.1, 1, name='alpha', guess=.6)) result = NmpfitStrategy().fit(model, holo) assert_obj_close(result.scatterer, gold_sphere, rtol=1e-3) assert_approx_equal(result.parameters['alpha'], gold_alpha, significant=3) assert_equal(model, result.model)
def test_image(): holo = get_example_data('image0001') assert_pickle_roundtrip(holo)
def test_FoundLocation(): holo = get_example_data('image0001') location = center_find(holo, threshold=.25) assert_allclose(location, gold_location, atol=0.01)
def test_image(): holo = get_example_data('image0001.yaml') assert_pickle_roundtrip(holo)
def test_ifft_of_xarray_returns_xarray(self): xarray = get_example_data('image0001') forward = fft(xarray) backward = ifft(forward) self.assertIsInstance(backward, xr.DataArray)
def test_fft_of_xarray_returns_xarray(self): xarray = get_example_data('image0001') after_fft = fft(xarray) self.assertIsInstance(after_fft, xr.DataArray)
def test_hologram_io(): holo = normalize(get_example_data('image0001.yaml')) assert_read_matches_write(holo)
def test_show(): d = get_example_data('image0001.yaml') hp.show(d) with warnings.catch_warnings(): warnings.simplefilter('ignore', DeprecationWarning) plt.savefig(tempfile.TemporaryFile(suffix='.pdf'))
def test_show(): d = get_example_data('image0001.yaml') hp.show(d) plt.savefig(tempfile.TemporaryFile(suffix='.pdf'))
def test_AlphaModelholo_likelihood(): holo = get_example_data('image0001') s = Sphere(prior.Gaussian(.5, .1), prior.Gaussian(1.6, .1), (prior.Gaussian(5, 1), prior.Gaussian(5, 1), prior.Gaussian(5, 1))) model = AlphaModel(s, alpha = prior.Gaussian(.7, .1), noise_sd=.01) assert_pickle_roundtrip(model)
from numpy import linspace import holopy as hp from holopy.core import Optics from holopy.propagation import propagate from holopy.core.tests.common import get_example_data from holopy.core import load holo = get_example_data('image0001.yaml') rec_vol = propagate(holo, linspace(4e-6, 10e-6, 7)) hp.show(rec_vol)