Ejemplo n.º 1
0
def test_spectral():
    obj = BaseStatisticMixIn()

    obj.header = header

    obj._spectral_size
    obj._spectral_equiv
Ejemplo n.º 2
0
def test_distance_no_header():

    obj = BaseStatisticMixIn()

    obj.distance = 1 * u.cm

    obj.distance
Ejemplo n.º 3
0
def test_header():

    obj = BaseStatisticMixIn()

    obj.header = header

    obj.header
Ejemplo n.º 4
0
def test_header():

    obj = BaseStatisticMixIn()

    obj.header = header

    obj.header
Ejemplo n.º 5
0
def test_distance_no_header():

    obj = BaseStatisticMixIn()

    obj.distance = 1 * u.cm

    obj.distance
Ejemplo n.º 6
0
def test_spectral():
    obj = BaseStatisticMixIn()

    obj.header = header

    obj._spectral_size
    obj._spectral_equiv
Ejemplo n.º 7
0
def test_angles():

    obj = BaseStatisticMixIn()

    obj.header = header

    obj._ang_size

    obj._angular_equiv
Ejemplo n.º 8
0
def test_angles():

    obj = BaseStatisticMixIn()

    obj.header = header

    obj._ang_size

    obj._angular_equiv
Ejemplo n.º 9
0
def test_distance():

    obj = BaseStatisticMixIn()

    obj.header = header
    obj.distance = 1 * u.cm

    obj.distance
    obj._physical_equiv
    obj._physical_size
Ejemplo n.º 10
0
def test_no_spectral():
    obj = BaseStatisticMixIn()

    from astropy.wcs import WCS

    celestial_header = WCS(header).celestial.to_header()

    obj.header = celestial_header

    obj._spectral_size
Ejemplo n.º 11
0
def test_no_spectral():
    obj = BaseStatisticMixIn()

    from astropy.wcs import WCS

    celestial_header = WCS(header).celestial.to_header()

    obj.header = celestial_header

    obj._spectral_size
Ejemplo n.º 12
0
def test_distance():

    obj = BaseStatisticMixIn()

    obj.header = header
    obj.distance = 1 * u.cm

    obj.distance
    obj._physical_equiv
    obj._physical_size
Ejemplo n.º 13
0
def test_pixel_to_spectral_conversions():

    obj = BaseStatisticMixIn()

    obj.header = header

    assert_allclose(obj._to_spectral(1 * u.pix, u.m / u.s),
                    np.abs(header["CDELT3"]) * u.m / u.s)

    assert_allclose(obj._to_spectral(np.abs(header["CDELT3"]) * u.m / u.s, u.pix),
                    1 * u.pix)
Ejemplo n.º 14
0
def test_pixel_to_spectral_freq_conversions():

    obj = BaseStatisticMixIn()

    obj.header = header

    assert_allclose(1 / obj._spectral_freq_unit_conversion(1 / u.pix, u.s / u.m),
                    np.abs(header["CDELT3"]) * u.m / u.s)

    assert_allclose(obj._spectral_freq_unit_conversion( 1/ (np.abs(header["CDELT3"]) * u.m / u.s), 1 / u.pix),
                    1 / u.pix)
Ejemplo n.º 15
0
def test_pixel_to_spectral_conversions():

    obj = BaseStatisticMixIn()

    obj.header = header

    assert_allclose(obj._to_spectral(1 * u.pix, u.m / u.s),
                    np.abs(header["CDELT3"]) * u.m / u.s)

    assert_allclose(
        obj._to_spectral(np.abs(header["CDELT3"]) * u.m / u.s, u.pix),
        1 * u.pix)
Ejemplo n.º 16
0
def test_pixel_to_spectral_freq_conversions():

    obj = BaseStatisticMixIn()

    obj.header = header

    assert_allclose(
        1 / obj._spectral_freq_unit_conversion(1 / u.pix, u.s / u.m),
        np.abs(header["CDELT3"]) * u.m / u.s)

    assert_allclose(
        obj._spectral_freq_unit_conversion(
            1 / (np.abs(header["CDELT3"]) * u.m / u.s), 1 / u.pix), 1 / u.pix)
Ejemplo n.º 17
0
def test_pixel_to_spatial_freq_conversions():

    obj = BaseStatisticMixIn()

    obj.header = header
    obj.distance = 1 * u.pc

    assert_allclose(obj._spatial_freq_unit_conversion(1 / u.pix, 1 / u.deg),
                    1 / (header["CDELT2"] * u.deg))

    assert_allclose(obj._spatial_freq_unit_conversion(1 / u.pix, 1 / u.pc),
                    1 / ((header["CDELT2"] * np.pi / 180.) * u.pc))

    assert_allclose(obj._to_pixel_freq(1 / (header["CDELT2"] * u.deg)),
                    1 / u.pix)

    assert_allclose(
        obj._to_pixel_freq(1 / ((header["CDELT2"] * np.pi / 180.) * u.pc)),
        1 / u.pix)
Ejemplo n.º 18
0
def test_pixel_to_spatial_freq_conversions():

    obj = BaseStatisticMixIn()

    obj.header = header
    obj.distance = 1 * u.pc

    assert_allclose(obj._spatial_freq_unit_conversion(1 / u.pix, 1 / u.deg),
                    1 / (header["CDELT2"] * u.deg))

    assert_allclose(obj._spatial_freq_unit_conversion(1 / u.pix, 1 / u.pc),
                    1 / ((header["CDELT2"] * np.pi / 180.) * u.pc))

    assert_allclose(obj._to_pixel_freq(1 / (header["CDELT2"] * u.deg)),
                    1 / u.pix)

    assert_allclose(obj._to_pixel_freq(1 / ((header["CDELT2"] * np.pi / 180.) * u.pc)),
                    1 / u.pix)
Ejemplo n.º 19
0
def test_bad_distance_unit():

    obj = BaseStatisticMixIn()

    obj.header = header
    obj.distance = 1 * u.K
Ejemplo n.º 20
0
def test_no_distance():

    obj = BaseStatisticMixIn()

    obj.distance
Ejemplo n.º 21
0
def test_bad_distance_unit():

    obj = BaseStatisticMixIn()

    obj.header = header
    obj.distance = 1 * u.K
Ejemplo n.º 22
0
def test_pixel_to_spatial_conversions():

    obj = BaseStatisticMixIn()

    obj.header = header
    obj.distance = 1 * u.pc

    assert_allclose(obj._to_angular(1 * u.pix, u.deg),
                    header["CDELT2"] * u.deg)

    assert_allclose(obj._to_physical(1 * u.pix, u.pc),
                    (header["CDELT2"] * np.pi / 180.) * u.pc)

    assert_allclose(obj._spatial_unit_conversion(1 * u.pix, u.deg),
                    header["CDELT2"] * u.deg)

    assert_allclose(obj._spatial_unit_conversion(1 * u.pix, u.pc),
                    (header["CDELT2"] * np.pi / 180.) * u.pc)

    assert_allclose(obj._to_pixel(header["CDELT2"] * u.deg), 1.0 * u.pix)

    assert_allclose(obj._to_pixel((header["CDELT2"] * np.pi / 180.) * u.pc),
                    1.0 * u.pix)

    # Now area conversions
    assert_allclose(obj._to_pixel_area((header["CDELT2"] * u.deg)**2),
                    1.0 * u.pix**2)

    assert_allclose(
        obj._to_pixel_area(((header["CDELT2"] * np.pi / 180.) * u.pc)**2),
        1.0 * u.pix**2)
Ejemplo n.º 23
0
def test_pixel_to_spatial_conversions():

    obj = BaseStatisticMixIn()

    obj.header = header
    obj.distance = 1 * u.pc

    assert_allclose(obj._to_angular(1 * u.pix, u.deg),
                    header["CDELT2"] * u.deg)

    assert_allclose(obj._to_physical(1 * u.pix, u.pc),
                    (header["CDELT2"] * np.pi / 180.) * u.pc)

    assert_allclose(obj._spatial_unit_conversion(1 * u.pix, u.deg),
                    header["CDELT2"] * u.deg)

    assert_allclose(obj._spatial_unit_conversion(1 * u.pix, u.pc),
                    (header["CDELT2"] * np.pi / 180.) * u.pc)

    assert_allclose(obj._to_pixel(header["CDELT2"] * u.deg),
                    1.0 * u.pix)

    assert_allclose(obj._to_pixel((header["CDELT2"] * np.pi / 180.) * u.pc),
                    1.0 * u.pix)

    # Now area conversions
    assert_allclose(obj._to_pixel_area((header["CDELT2"] * u.deg)**2),
                    1.0 * u.pix**2)

    assert_allclose(obj._to_pixel_area(((header["CDELT2"] * np.pi / 180.) * u.pc)**2),
                    1.0 * u.pix**2)