New Upstream Snapshot - pyavm
Ready changes
Summary
Merged new upstream version: 0.9.4+git20210909.1.7d5d6d2 (was: 0.9.4).
Resulting package
Built on 2022-12-30T21:36 (took 10m25s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots python3-pyavm
Lintian Result
Diff
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index c6a68bb..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-build/
-.DS_Store
-*.pyc
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index f3d0a6f..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-language: python
-
-sudo: false
-
-python:
- - 2.7
- - 3.5
- - 3.6
-
-env:
- matrix:
- - PIP_DEPENDENCIES='pytest coveralls pytest-cov pillow numpy>=1.10 astropy'
- - PIP_DEPENDENCIES='pytest coveralls pytest-cov'
-
-install:
- - export PYTHONIOENCODING=UTF8 # just in case
- - pip install pip --upgrade
- - pip install $PIP_DEPENDENCIES
-
-script:
- - py.test pyavm -p no:warnings --cov pyavm
-
-after_success:
- - coveralls
diff --git a/CHANGES b/CHANGES
index 80d240d..42f35fe 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,16 @@
CHANGES
-------
+Version 0.9.6
+
+ No changes yet
+
+Version 0.9.5
+
+ Add `target_shape` argument to `AVM.to_wcs()`
+
+ Fix compatibility with Python 3.8
+
Version 0.9.4
Properly extract scale and rotation for arbitrary WCS objects.
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..dcf3008
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,188 @@
+Metadata-Version: 2.1
+Name: PyAVM
+Version: 0.9.6.dev0
+Summary: Simple pure-python AVM meta-data handling
+Home-page: http://astrofrog.github.io/pyavm/
+Author: Thomas Robitaille
+Author-email: thomas.robitaille@gmail.com
+License: MIT
+Keywords: Scientific/Engineering
+Classifier: Development Status :: 4 - Beta
+Classifier: Programming Language :: Python
+Classifier: License :: OSI Approved :: MIT License
+Provides: pyavm
+License-File: LICENSE
+
+|Build Status| |Coverage Status|
+
+About
+-----
+
+PyAVM is a module to represent, read, and write metadata following the
+`*Astronomy Visualization
+Metadata* <http://www.virtualastronomy.org/avm_metadata.php>`__ (AVM)
+standard.
+
+Requirements
+------------
+
+PyAVM supports Python 2.7 and 3.5+. No other dependencies are needed
+simply to read and embed AVM meta-data.
+
+However, the following optional dependencies are needed for more
+advanced functionality:
+
+- `Numpy <http://www.numpy.org>`__ 1.10 or later
+- `Astropy <http://www.astropy.org>`__ to handle WCS objects and FITS
+ headers
+- `py.test <http://www.pytest.org>`__ and
+ `PIL <http://www.pythonware.com/products/pil/>`__ for tests
+
+Installing and Reporting issues
+-------------------------------
+
+PyAVM can be installed with pip::
+
+ pip install pyavm
+
+Please report any issues you encounter via the `issue
+tracker <https://github.com/astrofrog/pyavm/issues>`__ on GitHub.
+
+Using PyAVM
+-----------
+
+Importing
+~~~~~~~~~
+
+PyAVM provides the ``AVM`` class to represent AVM meta-data, and is
+imported as follows:
+
+.. code:: python
+
+ >>> from pyavm import AVM
+
+Parsing files
+~~~~~~~~~~~~~
+
+To parse AVM meta-data from an existing image, simply call the
+``from_image`` class method using the filename of the image (or any
+file-like object):
+
+.. code:: python
+
+ >>> avm = AVM.from_image('myexample.jpg')
+
+Only JPEG and PNG files are properly supported in that the parsing
+follows the JPEG and PNG specification. For other file formats, PyAVM
+will simply scan the contents of the file, looking for an XMP packet.
+This method is less reliable, but should work in most real-life cases.
+
+Accessing and setting the meta-data
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can view the contents of the AVM object by using
+
+.. code:: python
+
+ >>> print(avm)
+
+The AVM meta-data can be accessed using the attribute notation:
+
+.. code:: python
+
+ >>> avm.Spatial.Equinox
+ 'J2000'
+ >>> avm.Publisher
+ 'Chandra X-ray Observatory'
+
+Tags can be modified:
+
+.. code:: python
+
+ >>> avm.Spatial.Equinox = "B1950"
+ >>> avm.Spatial.Notes = "The WCS information was updated on 04/02/2010"
+
+Creating an AVM object from scratch
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To create an empty AVM meta-data holder, simply call ``AVM()`` without
+any arguments:
+
+.. code:: python
+
+ >>> avm = AVM()
+
+Note that this will create an AVM object following the 1.2
+specification. If necessary, you can specify which version of the
+standard to use:
+
+.. code:: python
+
+ >>> avm = AVM(version=1.1)
+
+Converting to a WCS object
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+It is possible to create an Astropy WCS object from the AVM meta-data:
+
+.. code:: python
+
+ >>> wcs = avm.to_wcs()
+
+By default, ``Spatial.FITSheader`` will be used if available, but if
+not, the WCS information is extracted from the other ``Spatial.*`` tags.
+To force PyAVM to not try ``Spatial.FITSheader``, use:
+
+.. code:: python
+
+ >>> wcs = avm.to_wcs(use_full_header=False)
+
+Initializing from a FITS header
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To create an AVM meta-data object from a FITS header, simply pass the
+header (as an Astropy Header instance) to the ``from_header`` class
+method:
+
+.. code:: python
+
+ >>> from astropy.io import fits
+ >>> header = fits.getheader('image.fits')
+ >>> avm = AVM.from_header(header)
+
+By default, the AVM tag ``Spatial.FITSheader`` will be created,
+containing the full header (in addition to the other ``Spatial.*``
+tags). This can be disabled with:
+
+.. code:: python
+
+ >>> avm = AVM.from_header(header, include_full_header=False)
+
+Initializing from a WCS object
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Similarly, it is possible to create an AVM meta-data object from an
+Astropy WCS instance:
+
+.. code:: python
+
+ >>> from astropy.wcs import WCS
+ >>> from pyavm import AVM
+ >>> wcs = WCS('image.fits')
+ >>> avm = AVM.from_wcs(wcs)
+
+Tagging images with AVM meta-data
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+It is possible to embed AVM meta-data into an image file:
+
+.. code:: python
+
+ >>> avm.embed('original_image.jpg', 'tagged_image.jpg')
+
+At this time, only JPG and PNG files are supported for embedding.
+
+.. |Build Status| image:: https://travis-ci.org/astrofrog/pyavm.svg?branch=master
+ :target: https://travis-ci.org/astrofrog/pyavm
+.. |Coverage Status| image:: https://coveralls.io/repos/astrofrog/pyavm/badge.svg?branch=master
+ :target: https://coveralls.io/r/astrofrog/pyavm?branch=master
diff --git a/PyAVM.egg-info/PKG-INFO b/PyAVM.egg-info/PKG-INFO
new file mode 100644
index 0000000..dcf3008
--- /dev/null
+++ b/PyAVM.egg-info/PKG-INFO
@@ -0,0 +1,188 @@
+Metadata-Version: 2.1
+Name: PyAVM
+Version: 0.9.6.dev0
+Summary: Simple pure-python AVM meta-data handling
+Home-page: http://astrofrog.github.io/pyavm/
+Author: Thomas Robitaille
+Author-email: thomas.robitaille@gmail.com
+License: MIT
+Keywords: Scientific/Engineering
+Classifier: Development Status :: 4 - Beta
+Classifier: Programming Language :: Python
+Classifier: License :: OSI Approved :: MIT License
+Provides: pyavm
+License-File: LICENSE
+
+|Build Status| |Coverage Status|
+
+About
+-----
+
+PyAVM is a module to represent, read, and write metadata following the
+`*Astronomy Visualization
+Metadata* <http://www.virtualastronomy.org/avm_metadata.php>`__ (AVM)
+standard.
+
+Requirements
+------------
+
+PyAVM supports Python 2.7 and 3.5+. No other dependencies are needed
+simply to read and embed AVM meta-data.
+
+However, the following optional dependencies are needed for more
+advanced functionality:
+
+- `Numpy <http://www.numpy.org>`__ 1.10 or later
+- `Astropy <http://www.astropy.org>`__ to handle WCS objects and FITS
+ headers
+- `py.test <http://www.pytest.org>`__ and
+ `PIL <http://www.pythonware.com/products/pil/>`__ for tests
+
+Installing and Reporting issues
+-------------------------------
+
+PyAVM can be installed with pip::
+
+ pip install pyavm
+
+Please report any issues you encounter via the `issue
+tracker <https://github.com/astrofrog/pyavm/issues>`__ on GitHub.
+
+Using PyAVM
+-----------
+
+Importing
+~~~~~~~~~
+
+PyAVM provides the ``AVM`` class to represent AVM meta-data, and is
+imported as follows:
+
+.. code:: python
+
+ >>> from pyavm import AVM
+
+Parsing files
+~~~~~~~~~~~~~
+
+To parse AVM meta-data from an existing image, simply call the
+``from_image`` class method using the filename of the image (or any
+file-like object):
+
+.. code:: python
+
+ >>> avm = AVM.from_image('myexample.jpg')
+
+Only JPEG and PNG files are properly supported in that the parsing
+follows the JPEG and PNG specification. For other file formats, PyAVM
+will simply scan the contents of the file, looking for an XMP packet.
+This method is less reliable, but should work in most real-life cases.
+
+Accessing and setting the meta-data
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can view the contents of the AVM object by using
+
+.. code:: python
+
+ >>> print(avm)
+
+The AVM meta-data can be accessed using the attribute notation:
+
+.. code:: python
+
+ >>> avm.Spatial.Equinox
+ 'J2000'
+ >>> avm.Publisher
+ 'Chandra X-ray Observatory'
+
+Tags can be modified:
+
+.. code:: python
+
+ >>> avm.Spatial.Equinox = "B1950"
+ >>> avm.Spatial.Notes = "The WCS information was updated on 04/02/2010"
+
+Creating an AVM object from scratch
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To create an empty AVM meta-data holder, simply call ``AVM()`` without
+any arguments:
+
+.. code:: python
+
+ >>> avm = AVM()
+
+Note that this will create an AVM object following the 1.2
+specification. If necessary, you can specify which version of the
+standard to use:
+
+.. code:: python
+
+ >>> avm = AVM(version=1.1)
+
+Converting to a WCS object
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+It is possible to create an Astropy WCS object from the AVM meta-data:
+
+.. code:: python
+
+ >>> wcs = avm.to_wcs()
+
+By default, ``Spatial.FITSheader`` will be used if available, but if
+not, the WCS information is extracted from the other ``Spatial.*`` tags.
+To force PyAVM to not try ``Spatial.FITSheader``, use:
+
+.. code:: python
+
+ >>> wcs = avm.to_wcs(use_full_header=False)
+
+Initializing from a FITS header
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To create an AVM meta-data object from a FITS header, simply pass the
+header (as an Astropy Header instance) to the ``from_header`` class
+method:
+
+.. code:: python
+
+ >>> from astropy.io import fits
+ >>> header = fits.getheader('image.fits')
+ >>> avm = AVM.from_header(header)
+
+By default, the AVM tag ``Spatial.FITSheader`` will be created,
+containing the full header (in addition to the other ``Spatial.*``
+tags). This can be disabled with:
+
+.. code:: python
+
+ >>> avm = AVM.from_header(header, include_full_header=False)
+
+Initializing from a WCS object
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Similarly, it is possible to create an AVM meta-data object from an
+Astropy WCS instance:
+
+.. code:: python
+
+ >>> from astropy.wcs import WCS
+ >>> from pyavm import AVM
+ >>> wcs = WCS('image.fits')
+ >>> avm = AVM.from_wcs(wcs)
+
+Tagging images with AVM meta-data
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+It is possible to embed AVM meta-data into an image file:
+
+.. code:: python
+
+ >>> avm.embed('original_image.jpg', 'tagged_image.jpg')
+
+At this time, only JPG and PNG files are supported for embedding.
+
+.. |Build Status| image:: https://travis-ci.org/astrofrog/pyavm.svg?branch=master
+ :target: https://travis-ci.org/astrofrog/pyavm
+.. |Coverage Status| image:: https://coveralls.io/repos/astrofrog/pyavm/badge.svg?branch=master
+ :target: https://coveralls.io/r/astrofrog/pyavm?branch=master
diff --git a/PyAVM.egg-info/SOURCES.txt b/PyAVM.egg-info/SOURCES.txt
new file mode 100644
index 0000000..a9d920c
--- /dev/null
+++ b/PyAVM.egg-info/SOURCES.txt
@@ -0,0 +1,103 @@
+CHANGES
+LICENSE
+MANIFEST.in
+README.rst
+setup.py
+PyAVM.egg-info/PKG-INFO
+PyAVM.egg-info/SOURCES.txt
+PyAVM.egg-info/dependency_links.txt
+PyAVM.egg-info/top_level.txt
+pyavm/__init__.py
+pyavm/avm.py
+pyavm/cv.py
+pyavm/datatypes.py
+pyavm/embed.py
+pyavm/exceptions.py
+pyavm/extract.py
+pyavm/jpeg.py
+pyavm/png.py
+pyavm/specs.py
+pyavm/wcs_utils.py
+pyavm/tests/__init__.py
+pyavm/tests/test_avm.py
+pyavm/tests/test_header.py
+pyavm/tests/test_io.py
+pyavm/tests/test_main.py
+pyavm/tests/test_specs.py
+pyavm/tests/test_wcs_utils.py
+pyavm/tests/data/3c321.avm.xml
+pyavm/tests/data/a3627_wcs_metadata.xml
+pyavm/tests/data/eso_eso1723a_320.jpg
+pyavm/tests/data/eso_eso1723a_320.png
+pyavm/tests/data/example_header.hdr
+pyavm/tests/data/heic0409a.xml
+pyavm/tests/data/heic0515a.xml
+pyavm/tests/data/kes75.xml
+pyavm/tests/data/n132d.xml
+pyavm/tests/data/opo0613a.xml
+pyavm/tests/data/sig05-002a.xml
+pyavm/tests/data/sig05-003a.xml
+pyavm/tests/data/sig05-004a.xml
+pyavm/tests/data/sig05-011.xml
+pyavm/tests/data/sig05-013.xml
+pyavm/tests/data/sig05-014.xml
+pyavm/tests/data/sig05-015.xml
+pyavm/tests/data/sig05-016.xml
+pyavm/tests/data/sig05-017.xml
+pyavm/tests/data/sig05-019b.xml
+pyavm/tests/data/sig05-019d.xml
+pyavm/tests/data/sig05-021-alpha.xml
+pyavm/tests/data/sig05-021.xml
+pyavm/tests/data/sig05-028a.xml
+pyavm/tests/data/sig05-028b.xml
+pyavm/tests/data/sig05-028c.xml
+pyavm/tests/data/sig06-003.xml
+pyavm/tests/data/sig06-010.xml
+pyavm/tests/data/sig06-012b.xml
+pyavm/tests/data/sig06-012c.xml
+pyavm/tests/data/sig06-013.xml
+pyavm/tests/data/sig06-021a.xml
+pyavm/tests/data/sig06-027.xml
+pyavm/tests/data/sig07-006.xml
+pyavm/tests/data/sig07-009.xml
+pyavm/tests/data/sig07-016.xml
+pyavm/tests/data/snr0509_xray.xml
+pyavm/tests/data/ssc2003-06b1.xml
+pyavm/tests/data/ssc2003-06b2.xml
+pyavm/tests/data/ssc2003-06c1.xml
+pyavm/tests/data/ssc2003-06d1.xml
+pyavm/tests/data/ssc2003-06d3.xml
+pyavm/tests/data/ssc2003-06d4.xml
+pyavm/tests/data/ssc2003-06d5.xml
+pyavm/tests/data/ssc2004-04a1.xml
+pyavm/tests/data/ssc2004-04a3.xml
+pyavm/tests/data/ssc2004-04a4.xml
+pyavm/tests/data/ssc2004-06a1-alpha.xml
+pyavm/tests/data/ssc2004-06a1.xml
+pyavm/tests/data/ssc2004-06b1-alpha.xml
+pyavm/tests/data/ssc2004-06b1.xml
+pyavm/tests/data/ssc2004-12a1.xml
+pyavm/tests/data/ssc2004-12a2.xml
+pyavm/tests/data/ssc2004-12a3.xml
+pyavm/tests/data/ssc2004-19a2.xml
+pyavm/tests/data/ssc2004-20a2.xml
+pyavm/tests/data/ssc2005-02a2.xml
+pyavm/tests/data/ssc2005-02a4.xml
+pyavm/tests/data/ssc2005-11a1.xml
+pyavm/tests/data/ssc2005-11a3.xml
+pyavm/tests/data/ssc2005-23a1.xml
+pyavm/tests/data/ssc2005-24a1.xml
+pyavm/tests/data/ssc2006-01a1.xml
+pyavm/tests/data/ssc2006-09a1.xml
+pyavm/tests/data/ssc2006-11a1.xml
+pyavm/tests/data/ssc2006-16a1.xml
+pyavm/tests/data/ssc2006-16b1.xml
+pyavm/tests/data/ssc2006-21a1.xml
+pyavm/tests/data/ssc2007-03a1.xml
+pyavm/tests/data/ssc2007-07a1.xml
+pyavm/tests/data/ssc2007-07b1.xml
+pyavm/tests/data/ssc2007-08a1.xml
+pyavm/tests/data/ssc2007-08b1.xml
+pyavm/tests/data/ssc2007-10a1.xml
+pyavm/tests/data/ssc2007-13b1.xml
+pyavm/tests/data/wd2.xml
\ No newline at end of file
diff --git a/PyAVM.egg-info/dependency_links.txt b/PyAVM.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/PyAVM.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/PyAVM.egg-info/top_level.txt b/PyAVM.egg-info/top_level.txt
new file mode 100644
index 0000000..d3c57b2
--- /dev/null
+++ b/PyAVM.egg-info/top_level.txt
@@ -0,0 +1 @@
+pyavm
diff --git a/debian/changelog b/debian/changelog
index c179316..bb82340 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+pyavm (0.9.4+git20210909.1.7d5d6d2-1) UNRELEASED; urgency=low
+
+ * New upstream snapshot.
+ * Drop patch Fix-comparison-with-literal.patch, present upstream.
+
+ -- Debian Janitor <janitor@jelmer.uk> Fri, 30 Dec 2022 21:29:53 -0000
+
pyavm (0.9.4-7) unstable; urgency=medium
* Mark autopkgtest as superficial (Closes: #969854)
diff --git a/debian/patches/Fix-comparison-with-literal.patch b/debian/patches/Fix-comparison-with-literal.patch
deleted file mode 100644
index 2c38055..0000000
--- a/debian/patches/Fix-comparison-with-literal.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From: Matthias Klose <doko@ubuntu.com>
-Date: Thu, 30 Jan 2020 10:26:50 +0100
-Subject: Fix comparison with literal
-Forwarded: yes
-Applied-Upstream: https://github.com/astrofrog/pyavm/commit/18cf294313affdb9ab98dc1bfa95f7962e7d52b6
-Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=950222
-
----
- pyavm/datatypes.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/pyavm/datatypes.py b/pyavm/datatypes.py
-index 6394b4b..7430337 100644
---- a/pyavm/datatypes.py
-+++ b/pyavm/datatypes.py
-@@ -344,7 +344,7 @@ class AVMUnorderedList(AVMData):
- for value in values:
- value = value
- length += len(value)
-- if value is "":
-+ if value == "":
- value = "-"
- checked_data.append(value)
-
diff --git a/debian/patches/series b/debian/patches/series
index bd15910..e69de29 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +0,0 @@
-Fix-comparison-with-literal.patch
diff --git a/pyavm/__init__.py b/pyavm/__init__.py
index 94eee98..e703d7b 100644
--- a/pyavm/__init__.py
+++ b/pyavm/__init__.py
@@ -1,3 +1,3 @@
from .avm import AVM, NoAVMPresent # noqa
-__version__ = "0.9.4"
+__version__ = "0.9.6.dev0"
diff --git a/pyavm/avm.py b/pyavm/avm.py
index bccfb17..b84fe35 100644
--- a/pyavm/avm.py
+++ b/pyavm/avm.py
@@ -379,8 +379,6 @@ class AVM(AVMContainer):
# Get XMP data from file
xmp = extract_xmp(filename, xmp_packet_index=xmp_packet_index)
- print(xmp)
-
# Extract XML
start = xmp.index(b"<?xpacket begin=")
start = xmp.index(b"?>", start) + 2
@@ -395,7 +393,8 @@ class AVM(AVMContainer):
"""
Instantiate an AVM object from an xml file.
"""
- return cls.from_xml(open(filename, 'rb').read())
+ with open(filename, 'rb') as f:
+ return cls.from_xml(f.read())
@classmethod
def from_xml(cls, xml):
@@ -430,13 +429,9 @@ class AVM(AVMContainer):
else:
self._items[avm_name] = content
- else:
-
- warnings.warn("ignoring tag %s:%s" % (tag, name))
-
return self
- def to_wcs(self, use_full_header=False, target_image=None):
+ def to_wcs(self, use_full_header=False, target_image=None, target_shape=None):
"""
Convert AVM projection information into a Astropy WCS object.
@@ -451,6 +446,11 @@ class AVM(AVMContainer):
the AVM was defined. The `target_image` option can be used to pass
the path of an image from which the size will be used to re-scale
the WCS.
+ target_shape : tuple of ``(nx: int, ny: int)``, optional
+ Serves the same function as `target_image`, but for cases where the
+ target dimensions are known without having to open and read an image
+ file. If both this and `target_image` are specified, `target_image`
+ takes precedence.
"""
if not astropy_installed:
@@ -460,7 +460,6 @@ class AVM(AVMContainer):
raise NoSpatialInformation("AVM meta-data does not contain any spatial information")
if use_full_header and self.Spatial.FITSheader is not None:
- print("Using full FITS header from Spatial.FITSheader")
header = fits.Header(txtfile=BytesIO(self.Spatial.FITSheader))
return WCS(header)
@@ -548,17 +547,16 @@ class AVM(AVMContainer):
# If `target_image` is set, we have to rescale the reference pixel and
# the scale
if target_image is not None:
-
- # Find target image size
from PIL import Image
- nx, ny = Image.open(target_image).size
+ target_shape = Image.open(target_image).size
+ if target_shape is not None:
if self.Spatial.ReferenceDimension is None:
raise ValueError("Spatial.ReferenceDimension should be set in order to determine scale in target image")
# Find scale in x and y
- scale_x = nx / float(wcs_naxis1)
- scale_y = ny / float(wcs_naxis2)
+ scale_x = target_shape[0] / float(wcs_naxis1)
+ scale_y = target_shape[1] / float(wcs_naxis2)
# Check that scales are consistent
if abs(scale_x - scale_y) / (scale_x + scale_y) * 2. < 0.01:
@@ -570,8 +568,8 @@ class AVM(AVMContainer):
wcs.wcs.crpix *= scale
if hasattr(wcs, 'naxis1'): # PyWCS and Astropy < 0.4
- wcs.naxis1 = nx
- wcs.naxis2 = ny
+ wcs.naxis1 = target_shape[0]
+ wcs.naxis2 = target_shape[1]
return wcs
diff --git a/pyavm/datatypes.py b/pyavm/datatypes.py
index 6394b4b..7430337 100644
--- a/pyavm/datatypes.py
+++ b/pyavm/datatypes.py
@@ -344,7 +344,7 @@ class AVMUnorderedList(AVMData):
for value in values:
value = value
length += len(value)
- if value is "":
+ if value == "":
value = "-"
checked_data.append(value)
diff --git a/pyavm/tests/test_main.py b/pyavm/tests/test_main.py
index ddac1aa..6078036 100644
--- a/pyavm/tests/test_main.py
+++ b/pyavm/tests/test_main.py
@@ -58,6 +58,15 @@ def test_to_wcs_target_image(filename, tmpdir):
a.to_wcs(target_image=image_file)
+@pytest.mark.parametrize('filename', XML_FILES_WCS)
+def test_to_wcs_target_shape(filename, tmpdir):
+ pytest.importorskip('PIL')
+ pytest.importorskip('astropy')
+ a = AVM.from_xml_file(filename)
+ a.Spatial.ReferenceDimension = (30, 30)
+ a.to_wcs(target_shape=(2, 2))
+
+
@pytest.mark.parametrize('filename', NO_WCS)
def test_to_wcs_nowcs(filename):
pytest.importorskip('astropy')
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..8bfd5a1
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,4 @@
+[egg_info]
+tag_build =
+tag_date = 0
+
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/lib/python3/dist-packages/PyAVM-0.9.6.dev0.egg-info/PKG-INFO -rw-r--r-- root/root /usr/lib/python3/dist-packages/PyAVM-0.9.6.dev0.egg-info/dependency_links.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/PyAVM-0.9.6.dev0.egg-info/top_level.txt
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/lib/python3/dist-packages/PyAVM-0.9.4.egg-info/PKG-INFO -rw-r--r-- root/root /usr/lib/python3/dist-packages/PyAVM-0.9.4.egg-info/dependency_links.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/PyAVM-0.9.4.egg-info/top_level.txt
No differences were encountered in the control files