コード例 #1
0
ファイル: test_ui.py プロジェクト: anetasie/anetasie-sherpa
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)"
コード例 #2
0
ファイル: test_ui.py プロジェクト: anetasie/anetasie-sherpa
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]
コード例 #3
0
ファイル: test_ui.py プロジェクト: anetasie/anetasie-sherpa
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"]
コード例 #4
0
ファイル: test_ui.py プロジェクト: linearregression/sherpa
 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
コード例 #5
0
ファイル: test_ui.py プロジェクト: linearregression/sherpa
 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
コード例 #6
0
ファイル: test_ui.py プロジェクト: wsf1990/sherpa
 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
コード例 #7
0
ファイル: test_ui.py プロジェクト: spidersaint/sherpa
 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
コード例 #8
0
ファイル: test_ui.py プロジェクト: spidersaint/sherpa
 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
コード例 #9
0
 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
コード例 #10
0
ファイル: test_ui.py プロジェクト: anetasie/anetasie-sherpa
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)
コード例 #11
0
ファイル: test_ui.py プロジェクト: anetasie/anetasie-sherpa
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, )
コード例 #12
0
ファイル: test_ui.py プロジェクト: spidersaint/sherpa
 def test_set_full_model(self):
     ui.load_psf('psf1', 'gauss2d.g1')
     ui.set_full_model('psf1(gauss2d.g2)+const2d.c1')
     ui.get_model()
コード例 #13
0
ファイル: test_ui.py プロジェクト: anetasie/anetasie-sherpa
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()
コード例 #14
0
ファイル: test_ui.py プロジェクト: anetasie/anetasie-sherpa
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()
コード例 #15
0
ファイル: test_ui.py プロジェクト: linearregression/sherpa
 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()
コード例 #16
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()
コード例 #17
0
ファイル: test.ui.py プロジェクト: wsf1990/sherpa
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)