Esempio n. 1
0
def test_aper_phot(capsys):
    """Make sure aper phot executes and returns expected text."""
    out_text = """xc=49.500000	yc=49.500000
x              y              radius         flux           mag(zpt=25.00)                 sky           fwhm
49.50          49.50          5              134.73         19.68                         1.34           27.54
"""
    plots = Imexamine()
    plots.set_data(test_data)
    plots.aper_phot(50, 50)
    out, err = capsys.readouterr()
    print(out)
    print(out_text)
    assert out == out_text
Esempio n. 2
0
def test_curve_of_growth():
    """Test the cog functionality."""
    from astropy.convolution import Gaussian2DKernel
    data = Gaussian2DKernel(1.5, x_size=25, y_size=25)
    plots = Imexamine()
    plots.set_data(data.array)
    rad_out, flux_out = plots.curve_of_growth(12, 12, genplot=False)

    rads = [1, 2, 3, 4, 5, 6, 7, 8]
    flux = []
    # Run the aperture phot on this to build up the expected fluxes
    plots.aper_phot_pars['genplot'][0] = False
    plots.aper_phot_pars['subsky'][0] = False

    for rad in rads:
        plots.aper_phot_pars['radius'][0] = rad
        plots.aper_phot(12, 12)
        flux.append(plots.total_flux)

    assert_array_equal(rads, rad_out)
    assert_allclose(flux, flux_out, 1e-6)
Esempio n. 3
0
def test_curve_of_growth():
    """Test the curve of growth functionality."""
    from astropy.convolution import Gaussian2DKernel
    data = Gaussian2DKernel(1.5, x_size=25, y_size=25)
    plots = Imexamine()
    plots.set_data(data.array)
    rad_out, flux_out = plots.curve_of_growth(12, 12, genplot=False)

    rads = [1, 2, 3, 4, 5, 6, 7, 8]
    flux = []

    # Run the aperture phot on this to build up the expected fluxes
    plots.aper_phot_pars['genplot'][0] = False
    plots.aper_phot_pars['subsky'][0] = False

    for rad in rads:
        plots.aper_phot_pars['radius'][0] = rad
        plots.aper_phot(12, 12)
        flux.append(plots.total_flux)

    assert_array_equal(rads, rad_out)
    assert_allclose(flux, flux_out, 1e-6)