Exemplo n.º 1
0
def test_RedshiftScaleFactor_inverse_bounding_box():
    model = models.RedshiftScaleFactor(2)
    model.bounding_box = (1, 5)
    assert model.bounding_box == (1, 5)

    inverse_model = model.inverse
    assert inverse_model.bounding_box == (3, 15)
    assert_allclose(inverse_model(model(4, with_bounding_box=True), with_bounding_box=True), 4)
Exemplo n.º 2
0
def test_RedshiftScaleFactor():
    """Like ``test_ScaleModel()``."""

    # Scale by a scalar
    m = models.RedshiftScaleFactor(0.4)
    assert m(0) == 0
    assert_array_equal(m([1, 2]), [1.4, 2.8])

    assert_allclose(m.inverse(m([1, 2])), [1, 2])

    # Scale by a list
    m = models.RedshiftScaleFactor([-0.5, 0, 0.5], n_models=3)
    assert_array_equal(m(0), 0)
    assert_array_equal(m([1, 2], model_set_axis=False),
                       [[0.5, 1], [1, 2], [1.5, 3]])

    assert_allclose(m.inverse(m([1, 2], model_set_axis=False)),
                    [[1, 2], [1, 2], [1, 2]])
Exemplo n.º 3
0
def test_RedshiftScaleFactor_model_levmar_fit():
    """Test fitting RedshiftScaleFactor model with LevMarLSQFitter."""

    init_model = models.RedshiftScaleFactor()

    x = np.arange(10)
    y = 2.7174 * x

    fitter = fitting.LevMarLSQFitter()
    fitted_model = fitter(init_model, x, y)

    assert_allclose(fitted_model.parameters, [1.7174])
Exemplo n.º 4
0
def test_RedshiftScaleFactor_inverse():
    m = models.RedshiftScaleFactor(1.2345)
    assert_allclose(m.inverse(m(6.789)), 6.789)
Exemplo n.º 5
0
 astmodels.Ellipse2D(amplitude=10., x_0=0.5, y_0=1.5, a=2., b=4.,
                     theta=0.1),
 astmodels.Exponential1D(amplitude=10., tau=3.5),
 astmodels.Gaussian1D(amplitude=10., mean=5., stddev=3.),
 astmodels.Gaussian2D(amplitude=10.,
                      x_mean=5.,
                      y_mean=5.,
                      x_stddev=3.,
                      y_stddev=3.),
 astmodels.KingProjectedAnalytic1D(amplitude=10., r_core=5., r_tide=2.),
 astmodels.Logarithmic1D(amplitude=10., tau=3.5),
 astmodels.Lorentz1D(amplitude=10., x_0=0.5, fwhm=2.5),
 astmodels.Moffat1D(amplitude=10., x_0=0.5, gamma=1.2, alpha=2.5),
 astmodels.Moffat2D(amplitude=10., x_0=0.5, y_0=1.5, gamma=1.2, alpha=2.5),
 astmodels.Planar2D(slope_x=0.5, slope_y=1.2, intercept=2.5),
 astmodels.RedshiftScaleFactor(z=2.5),
 astmodels.RickerWavelet1D(amplitude=10., x_0=0.5, sigma=1.2),
 astmodels.RickerWavelet2D(amplitude=10., x_0=0.5, y_0=1.5, sigma=1.2),
 astmodels.Ring2D(amplitude=10., x_0=0.5, y_0=1.5, r_in=5., width=10.),
 astmodels.Sersic1D(amplitude=10., r_eff=1., n=4.),
 astmodels.Sersic2D(amplitude=10.,
                    r_eff=1.,
                    n=4.,
                    x_0=0.5,
                    y_0=1.5,
                    ellip=0.0,
                    theta=0.0),
 astmodels.Sine1D(amplitude=10., frequency=0.5, phase=1.),
 astmodels.Cosine1D(amplitude=10., frequency=0.5, phase=1.),
 astmodels.Tangent1D(amplitude=10., frequency=0.5, phase=1.),
 astmodels.ArcSine1D(amplitude=10., frequency=0.5, phase=1.),
Exemplo n.º 6
0
                           y_stddev=3.),
 astropy_models.KingProjectedAnalytic1D(amplitude=10., r_core=5.,
                                        r_tide=2.),
 astropy_models.Linear1D(slope=2.0, intercept=1.5),
 astropy_models.Logarithmic1D(amplitude=10., tau=3.5),
 astropy_models.Lorentz1D(amplitude=10., x_0=0.5, fwhm=2.5),
 astropy_models.Moffat1D(amplitude=10., x_0=0.5, gamma=1.2, alpha=2.5),
 astropy_models.Moffat2D(amplitude=10.,
                         x_0=0.5,
                         y_0=1.5,
                         gamma=1.2,
                         alpha=2.5),
 astropy_models.Multiply(3),
 astropy_models.Multiply(10 * u.m),
 astropy_models.Planar2D(slope_x=0.5, slope_y=1.2, intercept=2.5),
 astropy_models.RedshiftScaleFactor(z=2.5),
 astropy_models.RickerWavelet1D(amplitude=10., x_0=0.5, sigma=1.2),
 astropy_models.RickerWavelet2D(amplitude=10., x_0=0.5, y_0=1.5, sigma=1.2),
 astropy_models.Ring2D(amplitude=10., x_0=0.5, y_0=1.5, r_in=5., width=10.),
 astropy_models.Scale(3.4),
 astropy_models.Sersic1D(amplitude=10., r_eff=1., n=4.),
 astropy_models.Sersic2D(amplitude=10.,
                         r_eff=1.,
                         n=4.,
                         x_0=0.5,
                         y_0=1.5,
                         ellip=0.0,
                         theta=0.0),
 astropy_models.Shift(2.),
 astropy_models.Shift(2. * u.deg),
 astropy_models.Scale(3.4 * u.deg),