Ejemplo n.º 1
0
def test_from_header():
    fname = 'tests/test_files/1904-66_SIN.fits'
    header = fits.getheader(fname)
    helper = WCSHelper.from_header(header)
    if helper.beam is None: raise AssertionError()
    del header['BMAJ'], header['BMIN'], header['BPA']
    helper = WCSHelper.from_header(header)
    if helper.beam is not None: raise AssertionError()
Ejemplo n.º 2
0
def test_from_header():
    """Test that we can make a beam from a fitsheader"""
    fname = 'tests/test_files/1904-66_SIN.fits'
    header = fits.getheader(fname)
    helper = WCSHelper.from_header(header)
    if helper.beam is None: raise AssertionError()
    del header['BMAJ'], header['BMIN'], header['BPA']
    helper = WCSHelper.from_header(header)
    if helper.beam is not None: raise AssertionError()
Ejemplo n.º 3
0
def test_from_header():
    """Test that we can make a beam from a fitsheader"""
    fname = 'tests/test_files/1904-66_SIN.fits'
    header = fits.getheader(fname)
    helper = WCSHelper.from_header(header)
    if helper.beam is None: raise AssertionError()
    del header['BMAJ'], header['BMIN'], header['BPA']
    # Raise an error when the beam information can't be determined
    try:
        _ = WCSHelper.from_header(header)
    except AssertionError as e:
        pass
    else:
        raise AssertionError(
            "Header with no beam information should thrown an exception.")
    return
Ejemplo n.º 4
0
def test_galactic_coords():
    """Test that we can work with galactic coordinates"""
    fname = 'tests/test_files/1904-66_SIN.lb.fits'
    header = fits.getheader(fname)
    try:
        helper = WCSHelper.from_header(header)
    except ValueError as e:
        raise AssertionError("galactic coordinates break WCSHelper")
    return
Ejemplo n.º 5
0
    src.island = 102
    src.peak_flux = 80 * noise
    cat.append(src)

    return cat


if __name__ == "__main__":
    # configure logging
    logging.basicConfig(format="%(module)s:%(levelname)s %(message)s")
    log = logging.getLogger("Aegean")
    logging_level = logging.DEBUG  # if options.debug else logging.INFO
    log.setLevel(logging_level)

    image, wcs = make_noise_image()
    header = wcs.to_header()
    header['BMAJ'] = psf[0] / 3600
    header['BMIN'] = psf[1] / 3600
    header['BPA'] = psf[2]
    hdu = fits.HDUList(hdus=[fits.PrimaryHDU(header=header, data=image)])
    header = hdu[0].header

    cat = make_catalogue()
    wcshelper = WCSHelper.from_header(header)
    hdu[0].data += AeRes.make_model(cat, image.shape, wcshelper)

    hdu.writeto('synthetic_test.fits', overwrite=True)

    psf_hdu = make_psf_map(hdu)
    psf_hdu.writeto('synthetic_test_psf.fits', overwrite=True)