| Name | PyAVM JSON |
| Version |
0.9.6
JSON |
| download |
| home_page | |
| Summary | Simple pure-python AVM meta-data handling |
| upload_time | 2023-09-21 20:34:42 |
| maintainer | |
| docs_url | None |
| author | |
| requires_python | >=3.8 |
| license | MIT |
| keywords |
scientific/engineering
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
|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
Raw data
{
"_id": null,
"home_page": "",
"name": "PyAVM",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "Scientific/Engineering",
"author": "",
"author_email": "Thomas Robitaille <thomas.robitaille@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c7/9d/0f5fbf2030a83a9ca23f2801eeb27f4407675f17622208491118bdfc207c/PyAVM-0.9.6.tar.gz",
"platform": null,
"description": "|Build Status| |Coverage Status|\n\nAbout\n-----\n\nPyAVM is a module to represent, read, and write metadata following the\n`*Astronomy Visualization\nMetadata* <http://www.virtualastronomy.org/avm_metadata.php>`__ (AVM)\nstandard.\n\nRequirements\n------------\n\nPyAVM supports Python 2.7 and 3.5+. No other dependencies are needed\nsimply to read and embed AVM meta-data.\n\nHowever, the following optional dependencies are needed for more\nadvanced functionality:\n\n- `Numpy <http://www.numpy.org>`__ 1.10 or later\n- `Astropy <http://www.astropy.org>`__ to handle WCS objects and FITS\n headers\n- `py.test <http://www.pytest.org>`__ and\n `PIL <http://www.pythonware.com/products/pil/>`__ for tests\n\nInstalling and Reporting issues\n-------------------------------\n\nPyAVM can be installed with pip::\n\n pip install pyavm\n\nPlease report any issues you encounter via the `issue\ntracker <https://github.com/astrofrog/pyavm/issues>`__ on GitHub.\n\nUsing PyAVM\n-----------\n\nImporting\n~~~~~~~~~\n\nPyAVM provides the ``AVM`` class to represent AVM meta-data, and is\nimported as follows:\n\n.. code:: python\n\n >>> from pyavm import AVM\n\nParsing files\n~~~~~~~~~~~~~\n\nTo parse AVM meta-data from an existing image, simply call the\n``from_image`` class method using the filename of the image (or any\nfile-like object):\n\n.. code:: python\n\n >>> avm = AVM.from_image('myexample.jpg')\n\nOnly JPEG and PNG files are properly supported in that the parsing\nfollows the JPEG and PNG specification. For other file formats, PyAVM\nwill simply scan the contents of the file, looking for an XMP packet.\nThis method is less reliable, but should work in most real-life cases.\n\nAccessing and setting the meta-data\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nYou can view the contents of the AVM object by using\n\n.. code:: python\n\n >>> print(avm)\n\nThe AVM meta-data can be accessed using the attribute notation:\n\n.. code:: python\n\n >>> avm.Spatial.Equinox\n 'J2000'\n >>> avm.Publisher\n 'Chandra X-ray Observatory'\n\nTags can be modified:\n\n.. code:: python\n\n >>> avm.Spatial.Equinox = \"B1950\"\n >>> avm.Spatial.Notes = \"The WCS information was updated on 04/02/2010\"\n\nCreating an AVM object from scratch\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo create an empty AVM meta-data holder, simply call ``AVM()`` without\nany arguments:\n\n.. code:: python\n\n >>> avm = AVM()\n\nNote that this will create an AVM object following the 1.2\nspecification. If necessary, you can specify which version of the\nstandard to use:\n\n.. code:: python\n\n >>> avm = AVM(version=1.1)\n\nConverting to a WCS object\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIt is possible to create an Astropy WCS object from the AVM meta-data:\n\n.. code:: python\n\n >>> wcs = avm.to_wcs()\n\nBy default, ``Spatial.FITSheader`` will be used if available, but if\nnot, the WCS information is extracted from the other ``Spatial.*`` tags.\nTo force PyAVM to not try ``Spatial.FITSheader``, use:\n\n.. code:: python\n\n >>> wcs = avm.to_wcs(use_full_header=False)\n\nInitializing from a FITS header\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo create an AVM meta-data object from a FITS header, simply pass the\nheader (as an Astropy Header instance) to the ``from_header`` class\nmethod:\n\n.. code:: python\n\n >>> from astropy.io import fits\n >>> header = fits.getheader('image.fits')\n >>> avm = AVM.from_header(header)\n\nBy default, the AVM tag ``Spatial.FITSheader`` will be created,\ncontaining the full header (in addition to the other ``Spatial.*``\ntags). This can be disabled with:\n\n.. code:: python\n\n >>> avm = AVM.from_header(header, include_full_header=False)\n\nInitializing from a WCS object\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nSimilarly, it is possible to create an AVM meta-data object from an\nAstropy WCS instance:\n\n.. code:: python\n\n >>> from astropy.wcs import WCS\n >>> from pyavm import AVM\n >>> wcs = WCS('image.fits')\n >>> avm = AVM.from_wcs(wcs)\n\nTagging images with AVM meta-data\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIt is possible to embed AVM meta-data into an image file:\n\n.. code:: python\n\n >>> avm.embed('original_image.jpg', 'tagged_image.jpg')\n\nAt this time, only JPG and PNG files are supported for embedding.\n\n.. |Build Status| image:: https://travis-ci.org/astrofrog/pyavm.svg?branch=master\n :target: https://travis-ci.org/astrofrog/pyavm\n.. |Coverage Status| image:: https://coveralls.io/repos/astrofrog/pyavm/badge.svg?branch=master\n :target: https://coveralls.io/r/astrofrog/pyavm?branch=master\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simple pure-python AVM meta-data handling",
"version": "0.9.6",
"project_urls": {
"documentation": "http://astrofrog.github.io/pyavm/",
"homepage": "http://astrofrog.github.io/pyavm/",
"repository": "https://github.com/astrofrog/pyavm"
},
"split_keywords": [
"scientific/engineering"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "061fc59626570fda6e5579631ec35c40b9e32ce1a828400b246acc7d18d054dc",
"md5": "8bfe76dcc58741766324569f6537498e",
"sha256": "fcb2c5881b5612415ab4acc895b5b2edd7d2b8fe295fcfbe5c773ecf4c55c1ba"
},
"downloads": -1,
"filename": "PyAVM-0.9.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8bfe76dcc58741766324569f6537498e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 378937,
"upload_time": "2023-09-21T20:34:40",
"upload_time_iso_8601": "2023-09-21T20:34:40.575333Z",
"url": "https://files.pythonhosted.org/packages/06/1f/c59626570fda6e5579631ec35c40b9e32ce1a828400b246acc7d18d054dc/PyAVM-0.9.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c79d0f5fbf2030a83a9ca23f2801eeb27f4407675f17622208491118bdfc207c",
"md5": "880a1efd4e875460f2bb8a6bee38bd1a",
"sha256": "b3b78b3e80070db63db4fb77440e73260f8db93b5557f4aaa54511dcdac6f26d"
},
"downloads": -1,
"filename": "PyAVM-0.9.6.tar.gz",
"has_sig": false,
"md5_digest": "880a1efd4e875460f2bb8a6bee38bd1a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 223098,
"upload_time": "2023-09-21T20:34:42",
"upload_time_iso_8601": "2023-09-21T20:34:42.641761Z",
"url": "https://files.pythonhosted.org/packages/c7/9d/0f5fbf2030a83a9ca23f2801eeb27f4407675f17622208491118bdfc207c/PyAVM-0.9.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-21 20:34:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "astrofrog",
"github_project": "pyavm",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "pyavm"
}