/usr/lib/python3/dist-packages/pyavm/tests/test_header.py is in python3-pyavm 0.9.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | try:
str
except:
str = str = str
import os
import pytest
from ..avm import AVM, NoSpatialInformation
ROOT = os.path.dirname(os.path.abspath(__file__))
def test_from_header():
from astropy.io import fits
header = fits.Header.fromtextfile(os.path.join(ROOT, 'data', 'example_header.hdr'))
a = AVM.from_header(header)
assert isinstance(a.Spatial.FITSheader, str)
assert a.Spatial.FITSheader == header
# assert a.Spatial.Equinox == 2000. # returns NaN at the moment
assert a.Spatial.CoordsystemProjection == 'CAR'
assert a.Spatial.ReferenceDimension[0] == 599
assert a.Spatial.ReferenceDimension[1] == 599
assert a.Spatial.ReferenceValue[0] == 0.
assert a.Spatial.ReferenceValue[1] == 0.
assert a.Spatial.ReferencePixel[0] == 299.628
assert a.Spatial.ReferencePixel[1] == 299.394
assert a.Spatial.Scale[0] == -0.001666666707
assert a.Spatial.Scale[1] == +0.001666666707
assert a.Spatial.Quality == 'Full'
def test_from_header_cd():
from astropy.io import fits
header = fits.Header.fromtextfile(os.path.join(ROOT, 'data', 'example_header.hdr'))
header['CD1_1'] = header.pop('CDELT1')
header['CD2_2'] = header.pop('CDELT2')
a = AVM.from_header(header)
assert isinstance(a.Spatial.FITSheader, str)
assert a.Spatial.FITSheader == header
# assert a.Spatial.Equinox == 2000. # returns NaN at the moment
assert a.Spatial.CoordsystemProjection == 'CAR'
assert a.Spatial.ReferenceDimension[0] == 599
assert a.Spatial.ReferenceDimension[1] == 599
assert a.Spatial.ReferenceValue[0] == 0.
assert a.Spatial.ReferenceValue[1] == 0.
assert a.Spatial.ReferencePixel[0] == 299.628
assert a.Spatial.ReferencePixel[1] == 299.394
assert a.Spatial.Scale[0] == -0.001666666707
assert a.Spatial.Scale[1] == +0.001666666707
assert a.Spatial.Quality == 'Full'
def test_wcs_1():
from astropy.io import fits
header = fits.Header.fromtextfile(os.path.join(ROOT, 'data', 'example_header.hdr'))
a = AVM.from_header(header)
b = AVM.from_wcs(a.to_wcs(), shape=(header['NAXIS2'], header['NAXIS1']))
# assert a.Spatial.Equinox == b.Spatial.Equinox # returns NaN at the moment
assert a.Spatial.CoordsystemProjection == b.Spatial.CoordsystemProjection
assert a.Spatial.ReferenceDimension[0] == b.Spatial.ReferenceDimension[0]
assert a.Spatial.ReferenceDimension[1] == b.Spatial.ReferenceDimension[1]
assert a.Spatial.ReferenceValue[0] == b.Spatial.ReferenceValue[0]
assert a.Spatial.ReferenceValue[1] == b.Spatial.ReferenceValue[1]
assert a.Spatial.ReferencePixel[0] == b.Spatial.ReferencePixel[0]
assert a.Spatial.ReferencePixel[1] == b.Spatial.ReferencePixel[1]
assert a.Spatial.Scale[0] == b.Spatial.Scale[0]
assert a.Spatial.Scale[1] == b.Spatial.Scale[1]
assert a.Spatial.Quality == b.Spatial.Quality
def test_wcs_2():
from astropy.io import fits
from astropy.wcs import WCS
header = fits.Header.fromtextfile(os.path.join(ROOT, 'data', 'example_header.hdr'))
a = WCS(header)
b = AVM.from_wcs(a).to_wcs()
# assert a.wcs.equinox == b.wcs.equinox
assert a.wcs.ctype[0] == b.wcs.ctype[0]
assert a.wcs.ctype[1] == b.wcs.ctype[1]
assert a.wcs.crval[0] == b.wcs.crval[0]
assert a.wcs.crval[1] == b.wcs.crval[1]
assert a.wcs.crpix[0] == b.wcs.crpix[0]
assert a.wcs.crpix[1] == b.wcs.crpix[1]
assert a.wcs.cdelt[0] == b.wcs.cdelt[0]
assert a.wcs.cdelt[1] == b.wcs.cdelt[1]
assert a.wcs.crota[0] == b.wcs.crota[0]
assert a.wcs.crota[1] == b.wcs.crota[1]
assert a.wcs.radesys == b.wcs.radesys
|