示例#1
0
def test_mjdavg():
    w = _wcs._Wcsprm()
    assert np.isnan(w.mjdavg)
    w.mjdavg = 45.0
    assert w.mjdavg == 45.0
    del w.mjdavg
    assert np.isnan(w.mjdavg)
示例#2
0
def test_cel_offset():
    w = _wcs._Wcsprm()
    assert w.cel_offset is False
    w.cel_offset = 'foo'
    assert w.cel_offset is True
    w.cel_offset = 0
    assert w.cel_offset is False
示例#3
0
def test_velosys():
    w = _wcs._Wcsprm()
    assert np.isnan(w.velosys)
    w.velosys = 42.0
    assert w.velosys == 42.0
    del w.velosys
    assert np.isnan(w.velosys)
示例#4
0
def test_mjdobs():
    w = _wcs._Wcsprm()
    assert np.isnan(w.mjdobs)
    w.mjdobs = 45.0
    assert w.mjdobs == 45.0
    del w.mjdobs
    assert np.isnan(w.mjdobs)
示例#5
0
def test_phi0():
    w = _wcs._Wcsprm()
    assert np.isnan(w.phi0)
    w.phi0 = 42.0
    assert w.phi0 == 42.0
    del w.phi0
    assert np.isnan(w.phi0)
示例#6
0
def test_obsgeo():
    w = _wcs._Wcsprm()
    assert np.all(np.isnan(w.obsgeo))
    w.obsgeo = [1, 2, 3]
    assert_array_equal(w.obsgeo, [1, 2, 3])
    del w.obsgeo
    assert np.all(np.isnan(w.obsgeo))
示例#7
0
def test_velangl():
    w = _wcs._Wcsprm()
    assert w.velangl == 0.0
    w.velangl = 42.0
    assert w.velangl == 42.0
    del w.velangl
    assert np.isnan(w.velangl)
示例#8
0
def test_zsource():
    w = _wcs._Wcsprm()
    assert np.isnan(w.zsource)
    w.zsource = 42.0
    assert w.zsource == 42.0
    del w.zsource
    assert np.isnan(w.zsource)
示例#9
0
def test_crota_missing2():
    w = _wcs._Wcsprm()
    w.crota = [1, 0]
    assert w.has_crota() == True
    del w.crota
    assert w.has_crota() == False
    w.crota
示例#10
0
def test_lonpole():
    w = _wcs._Wcsprm()
    assert np.isnan(w.lonpole)
    w.lonpole = 45.0
    assert w.lonpole == 45.0
    del w.lonpole
    assert np.isnan(w.lonpole)
示例#11
0
def test_theta0():
    w = _wcs._Wcsprm()
    assert np.isnan(w.theta0)
    w.theta0 = 42.0
    assert w.theta0 == 42.0
    del w.theta0
    assert np.isnan(w.theta0)
示例#12
0
def test_equinox():
    w = _wcs._Wcsprm()
    assert np.isnan(w.equinox)
    w.equinox = 0
    assert w.equinox == 0
    del w.equinox
    assert np.isnan(w.equinox)
示例#13
0
def test_alt():
    w = _wcs._Wcsprm()
    assert w.alt == b(" ")
    w.alt = b("X")
    assert w.alt == b("X")
    del w.alt
    assert w.alt == b(" ")
示例#14
0
def test_cd_missing2():
    w = _wcs._Wcsprm()
    w.cd = [[1, 0], [0, 1]]
    assert w.has_cd() == True
    del w.cd
    assert w.has_cd() == False
    w.cd
示例#15
0
def test_csyer():
    w = _wcs._Wcsprm()
    assert w.crder.dtype == np.float
    assert np.all(np.isnan(w.crder))
    w.crder[0] = 0
    assert np.isnan(w.crder[1])
    assert w.crder[0] == 0
示例#16
0
def test_latpole():
    w = _wcs._Wcsprm()
    assert w.latpole == 90.0
    w.latpole = 45.0
    assert w.latpole == 45.0
    del w.latpole
    assert w.latpole == 90.0
示例#17
0
def test_colax():
    w = _wcs._Wcsprm()
    assert w.colax.dtype == np.intc
    assert_array_equal(w.colax, [0, 0])
    w.colax = [42, 54]
    assert_array_equal(w.colax, [42, 54])
    w.colax[0] = 0
    assert_array_equal(w.colax, [0, 54])
示例#18
0
def test_crval():
    w = _wcs._Wcsprm()
    assert w.crval.dtype == np.float
    assert_array_equal(w.crval, [0, 0])
    w.crval = [42, 54]
    assert_array_equal(w.crval, [42, 54])
    w.crval[0] = 0
    assert_array_equal(w.crval, [0, 54])
示例#19
0
def test_fix():
    w = _wcs._Wcsprm()
    assert w.fix() == {
        'cylfix': 'No change',
        'datfix': 'No change',
        'spcfix': 'No change',
        'unitfix': 'No change',
        'celfix': 'No change'}
示例#20
0
def test_cd():
    w = _wcs._Wcsprm()
    w.cd = [[1, 0], [0, 1]]
    assert w.cd.dtype == np.float
    assert w.has_cd() == True
    assert_array_equal(w.cd, [[1, 0], [0, 1]])
    del w.cd
    assert w.has_cd() == False
示例#21
0
def test_spcfix():
    # TODO: We need some data with broken spectral headers here to
    # really test
    header = open(os.path.join(ROOT_DIR, 'spectra', 'orion-velo-1.hdr'),
                  'rb').read()
    w = _wcs._Wcsprm(header)
    print(w.spcfix())
    assert w.spcfix() == 0
示例#22
0
def test_crpix():
    w = _wcs._Wcsprm()
    assert w.crpix.dtype == np.float
    assert_array_equal(w.crpix, [0, 0])
    w.crpix = [42, 54]
    assert_array_equal(w.crpix, [42, 54])
    w.crpix[0] = 0
    assert_array_equal(w.crpix, [0, 54])
示例#23
0
def test_cname():
    w = _wcs._Wcsprm()
    # Test that this works as an iterator
    for x in w.cname:
        assert x == b('')
    assert list(w.cname) == [b(''), b('')]
    w.cname = [b('foo'), b('bar')]
    assert list(w.cname) == [b('foo'), b('bar')]
示例#24
0
def test_crota():
    w = _wcs._Wcsprm()
    w.crota = [1, 0]
    assert w.crota.dtype == np.float
    assert w.has_crota() == True
    assert_array_equal(w.crota, [1, 0])
    del w.crota
    assert w.has_crota() == False
示例#25
0
def test_pc():
    w = _wcs._Wcsprm()
    assert w.has_pc()
    assert_array_equal(w.pc, [[1, 0], [0, 1]])
    w.cd = [[1, 0], [0, 1]]
    assert not w.has_pc()
    del w.cd
    assert w.has_pc()
    assert_array_equal(w.pc, [[1, 0], [0, 1]])
示例#26
0
def test_fix2():
    w = _wcs._Wcsprm()
    w.dateobs = b('31/12/99')
    assert w.fix() == {
        'cylfix': 'No change',
        'datfix': 'Success',
        'spcfix': 'No change',
        'unitfix': 'No change',
        'celfix': 'No change'}
    assert w.dateobs == b('1999-12-31')
    assert w.mjdobs == 51543.0
示例#27
0
def test_fix3():
    w = _wcs._Wcsprm()
    w.dateobs = b('31/12/F9')
    assert w.fix() == {
        'cylfix': 'No change',
        'datfix': "Invalid parameter value: invalid date '31/12/F9'",
        'spcfix': 'No change',
        'unitfix': 'No change',
        'celfix': 'No change'}
    assert w.dateobs == b('31/12/F9')
    assert np.isnan(w.mjdobs)
示例#28
0
def test_ctype():
    w = _wcs._Wcsprm()
    assert list(w.ctype) == [b(''), b('')]
    w.ctype = [b('RA---TAN'), b('DEC--TAN')]
    assert_array_equal(w.axis_types, [2200, 2201])
    assert w.lat == 1
    assert w.lng == 0
    assert w.lattyp == b('DEC')
    assert w.lngtyp == b('RA')
    assert list(w.ctype) == [b('RA---TAN'), b('DEC--TAN')]
    w.ctype = [b('foo'), b('bar')]
    assert_array_equal(w.axis_types, [0, 0])
    assert list(w.ctype) == [b('foo'), b('bar')]
    assert w.lat == -1
    assert w.lng == -1
    assert w.lattyp == b('DEC')
    assert w.lngtyp == b('RA')
示例#29
0
def test_cdelt_delete():
    w = _wcs._Wcsprm()
    del w.cdelt
示例#30
0
def test_cdelt():
    w = _wcs._Wcsprm()
    assert_array_equal(w.cdelt, [1, 1])
    w.cdelt = [42, 54]
    assert_array_equal(w.cdelt, [42, 54])