def test_ui_set_full_model_checks_dimensions_match(clean_ui, setup_ui_2d): ui.load_psf('psf1', 'gauss2d.g1') with pytest.raises(ArgumentErr) as err: ui.set_full_model('psf1(gauss1d.g2)+const2d.c1') assert str( err.value ) == "invalid model expression: Models do not match: 2D (gauss2d.g1) and 1D (gauss1d.g2)"
def test_list_psf_ids_single(id, clean_ui): ui.dataspace1d(1, 10, id=id) ui.load_psf('psf1d', 'gauss1d.mdl') ui.set_psf(id, 'psf1d') if id is None: id = 1 assert ui.list_psf_ids() == [id]
def test_list_psf_ids_multi(clean_ui): ui.dataspace1d(1, 10) ui.dataspace1d(1, 10, id="2") ui.load_psf('psf1d', 'gauss1d.mdl') ui.set_psf('psf1d') ui.set_psf("2", 'psf1d') ans = ui.list_psf_ids() assert ans == [1, "2"]
def test_psf_model2d(self): ui.dataspace1d(1, 10) for model in self.models1d: try: ui.load_psf("psf1d", model + ".mdl") ui.set_psf("psf1d") mdl = ui.get_model_component("mdl") self.assert_((numpy.array(mdl.get_center()) == numpy.array([4])).all()) except: print model raise
def test_psf_model2d(self): ui.dataspace2d([216, 261]) for model in self.models2d: try: ui.load_psf("psf2d", model + ".mdl") ui.set_psf("psf2d") mdl = ui.get_model_component("mdl") self.assert_((numpy.array(mdl.get_center()) == numpy.array([108, 130])).all()) except: print model raise
def test_psf_model2d(self): ui.dataspace2d([216, 261]) for model in self.models2d: try: ui.load_psf('psf2d', model + '.mdl') ui.set_psf('psf2d') mdl = ui.get_model_component('mdl') self.assertTrue((numpy.array(mdl.get_center()) == numpy.array([108, 130])).all()) except: print(model) raise
def test_psf_model2d(self): ui.dataspace2d([216,261]) for model in self.models2d: try: ui.load_psf('psf2d', model+'.mdl') ui.set_psf('psf2d') mdl = ui.get_model_component('mdl') self.assertTrue((numpy.array(mdl.get_center()) == numpy.array([108,130])).all()) except: print model raise
def test_psf_model1d(self): ui.dataspace1d(1, 10) for model in self.models1d: try: ui.load_psf('psf1d', model+'.mdl') ui.set_psf('psf1d') mdl = ui.get_model_component('mdl') self.assertTrue((numpy.array(mdl.get_center()) == numpy.array([4])).all()) except: print model raise
def test_psf_model1d(self): ui.dataspace1d(1, 10) for model in self.models1d: try: ui.load_psf('psf1d', model + '.mdl') ui.set_psf('psf1d') mdl = ui.get_model_component('mdl') self.assertTrue( (numpy.array(mdl.get_center()) == numpy.array([4])).all()) except: print(model) raise
def test_psf_model2d(model): ui.dataspace2d([216, 261]) ui.load_psf('psf2d', model + '.mdl') ui.set_psf('psf2d') mdl = ui.get_model_component('mdl') assert mdl.get_center() == (108.0, 130.0)
def test_psf_model1d(model, clean_ui): ui.dataspace1d(1, 10) ui.load_psf('psf1d', model + '.mdl') ui.set_psf('psf1d') mdl = ui.get_model_component('mdl') assert mdl.get_center() == (4.0, )
def test_set_full_model(self): ui.load_psf('psf1', 'gauss2d.g1') ui.set_full_model('psf1(gauss2d.g2)+const2d.c1') ui.get_model()
def test_ui_set_full_model_2d_mismatch_1d(clean_ui, setup_ui_2d): ui.load_psf('psf1', 'gauss1d.g1') ui.set_full_model('psf1(gauss1d.g2 ) +const1d.c1') # Ideally this would fail but it currently does not ui.get_model()
def test_ui_set_full_model_2d(clean_ui, setup_ui_2d): ui.load_psf('psf1', 'gauss2d.g1') ui.set_full_model('psf1(gauss2d.g2 ) +const2d.c1') ui.get_model()
def test_set_full_model(self): ui.load_psf("psf1", "gauss2d.g1") ui.set_full_model("psf1(gauss2d.g2)+const2d.c1") ui.get_model() ui.get_source()
x1 = np.arange(-5.0, 30, 0.5) x2 = np.arange(1.0, 29.0, 0.2) ui.load_arrays(1, x1, x1 * 0, ui.Data1D) ui.load_arrays(2, x2, x2 * 0, ui.Data1D) ui.set_source(1, ui.box1d.box) box = ui.get_model_component('box') ui.set_source(2, box) box.xlow = 10.0 box.xhi = 20.0 # Copy all the objects just to make sure g1 = ui.gauss1d('g1') g1.fwhm = 3.0 g2 = ui.gauss1d('g2') g2.fwhm = 3.0 ui.load_psf('psf1', g1) ui.load_psf('psf2', g2) ui.set_psf(1, 'psf1') ui.set_psf(2, 'psf2') ui.plot_model(1) ui.plot_model(2, overplot=True)