Name | astrodata JSON |
Version |
2.9.4
JSON |
| download |
home_page | None |
Summary | A package for managing astronomical data through a uniform interface |
upload_time | 2024-08-28 20:51:20 |
maintainer | None |
docs_url | None |
author | D. J. Teal |
requires_python | <4.0,>=3.10 |
license | BSD3 |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[DRAGONS link]: https://github.com/GeminiDRSoftware/DRAGONS
[astrodata docs]: https://geminidrsoftware.github.io/astrodata/
[astrodata repo]: https://github.com/GeminiDRSoftware/astrodata/
[astropy link]: https://astropy.org
[pypi link]: https://pypi.org/project/astrodata
[citation link]: https://github.com/GeminiDRSoftware/astrodata/blob/main/CITATION.md
[DRAGONS citation]: https://zenodo.org/records/10841622
[coverage badge]: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/teald/d2f3af2a279efc1f6e90d457a3c50e47/raw/covbadge.json
[docs build badge]: https://github.com/GeminiDRSoftware/astrodata/actions/workflows/documentation.yml/badge.svg
[pypi packaging badge]: https://github.com/GeminiDRSoftware/astrodata/actions/workflows/publish_pypi.yml/badge.svg
[pypi package version badge]: https://badge.fury.io/py/astrodata.svg
[source test status badge]: https://github.com/GeminiDRSoftware/astrodata/actions/workflows/source_tests.yml/badge.svg
[build test status badge]: https://github.com/GeminiDRSoftware/astrodata/actions/workflows/build_tests.yml/badge.svg
`astrodata`
=============
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/static/logo.svg">
<img
alt="A logo of a stylized blue dragon inside a similarly blue shell. A yellow star lies at the center, together with the dragon shape forming a stylized letter A."
src="docs/static/logo_dark.svg"
align="left"
height=200
style="padding-right: 10; padding-bottom: 10; border: none;"
>
</picture>
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
![Supported python versions -- 3.10, 3.11, and 3.12](https://img.shields.io/badge/3.10|3.11|3.12-%234b8bbe?logo=Python&logoColor=%234b8bbe&label=For%20Python%3A)
[![PyPI version badge][pypi package version badge]](https://badge.fury.io/py/astrodata)
### Tests
![A badge displaying the testing coverage percentage of this repository.][coverage badge]
![Source test status badge][source test status badge]
![Build/Release test status badge][build test status badge]
### Building & Publishing
![Documentation build status badge][docs build badge]
![pypi packaging status badge][pypi packaging badge]
<!-- Clearing the logo for the next header -->
<br clear="left">
Making astronomical data consistent and approachable
--------------------------------------------------------------------
`astrodata` is a package for managing astronomical data through a uniform
interface. It is designed to be used with the
[Astropy package][astropy link]. `astrodata` was created
for use as part of the [`DRAGONS`][DRAGONS link] data reduction pipeline, but it is now
implemented to be useful for any astronomical data reduction or analysis
project.
Unlike managing files using the ``astropy.io.fits`` package alone, ``astrodata``
is designed to be extendible to any data format, and to parse, respond to, and
store metadata in a consistent, intentional way. This makes it especially
useful for managing data from multiple instruments, telescopes, and data
generation utilities.
**Note:** If you are trying to reduce Gemini data, please use [`DRAGONS`][DRAGONS link].
Interaction with this package directly is primarily suited for developers, and
does not come with any tools for data reduction on any specific instrument or
data.
Installation
------------
`astrodata` is available on the [Python Package Index][pypi link] and
can be installed using `pip`:
```
python -m pip install astrodata
```
Documentation
-------------
Documentation for ``astrodata`` is available on our [GitHub pages site][astrodata docs]. This documentation includes a
user and programmer's guide, as well as a full API reference.
Usage
-----
The most basic usage of ``astrodata`` is to extend the ``astrodata.AstroData``
class, which includes some basic FITS file handling methods by default:
```python
from astrodata import AstroData, astro_data_descriptor, factory, from_file
class MyData(AstroData):
@astro_data_descriptor
def color(self):
# The color filter used for our image is stored in a few different
# ways, let's unify them.
blue_labels = {"blue", "bl", "b"}
green_labels = {"green", "gr", "g"}
red_labels = {"red", "re", "r"}
header_value = self.phu.get("COLOR", None).casefold()
if header_value in blue_labels:
return "BLUE"
if header_value in green_labels:
return "GREEN"
if header_value in red_labels:
return "RED"
if header_value is None:
raise ValueError("No color found")
# Unrecognized color
raise ValueError(f"Did not recognize COLOR value: {header_value}")
# Now, define our instruments with nuanced, individual data formats
class MyInstrument1(MyData):
# These use a special method to resolve the metadata and apply the correct
# class.
@staticmethod
def _matches_data(source):
return source[0].header.get("INSTRUME", "").upper() == "MYINSTRUMENT1"
class MyInstrument2(MyData):
@staticmethod
def _matches_data(source):
return source[0].header.get("INSTRUME", "").upper() == "MYINSTRUMENT2"
class MyInstrument3(MyData):
@staticmethod
def _matches_data(source):
return source[0].header.get("INSTRUME", "").upper() == "MYINSTRUMENT3"
for cls in [MyInstrument1, MyInstrument2, MyInstrument3]:
factory.add_class(cls)
# my_file.fits has some color data depending on the instrument it comes from,
# but now we can access it and handle a single value.
data = from_file("README_example.fits")
# the astrodata factory has already resolved the correct class for us.
print(f"File used to create class: {data.__class__.__name__}")
if data.color() == "BLUE":
print("I used the blue filter!")
else:
print("I used a red or green filter!")
# Get all the info about the astrodata object.
data.info()
```
This will print out the filter used as extracted from the header of the FITS
file. `data.info()` offers a more complete look at the file's data including
the filename and path of the file (as it does for `astropy.io.fits` objects).
`astrodata` is designed to be extensible, so you can add your own methods to
analyze and process data based on your specific needs and use cases.
`astrodata` also has a number of built in features, including:
+ Operator support for arithmetic operations
+ Uncertainty propagation
+ Slicing
+ Windowing (reading and operating on subsets of data)
+ Metadata management and access
[user Manual]: https://geminidrsoftware.github.io/astrodata/manuals/usermanual/index.html
[prog manual]: https://geminidrsoftware.github.io/astrodata/manuals/progmanual/index.html
For a complete example, see the
[Quickstart](https://geminidrsoftware.github.io/astrodata/quickstart.html) in
our documentation. For more advanced usage, see the [User Manual][user manual]
or [Programmer's Manual][prog manual].
Installing development dependencies
-----------------------------------
``astrodata`` uses [Poetry](https://github.com/python-poetry/poetry) for build
and package management. Our documentation includes an [installation guide for
`astrodata`
developers](https://geminidrsoftware.github.io/astrodata/developer/index.html)
Contributing
------------
See [our contributing guidelines](CONTRIBUTING.md) for information on
contributing. If you're worried about contributing, or feel intimidated, please
remember that your contribution is immensely appreciated---no matter how small!
License
-------
This project is Copyright 2024 (c) and licensed under the terms of a modified
BSD 3-clause license through AURA astronomy. This package is based upon the
[Openastronomy packaging
guide](https://github.com/OpenAstronomy/packaging-guide) which is licensed
under the standard BSD 3-clause license. See the LICENSE file for more
information.
Citations
---------
To cite `astrodata` in your work, please see [CITATION.md][citation link]
for complete information, including a `bibtex` example.
For ease of reference, the current citation to use is:
[Simpson et al. 2024][DRAGONS citation].
Raw data
{
"_id": null,
"home_page": null,
"name": "astrodata",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "D. J. Teal",
"author_email": "dillon.teal@noirlab.com",
"download_url": "https://files.pythonhosted.org/packages/da/24/fd630ea60406cf27abd08f6def71fe65c60689db8ac15b55e9ad17caabcf/astrodata-2.9.4.tar.gz",
"platform": null,
"description": "[DRAGONS link]: https://github.com/GeminiDRSoftware/DRAGONS\n[astrodata docs]: https://geminidrsoftware.github.io/astrodata/\n[astrodata repo]: https://github.com/GeminiDRSoftware/astrodata/\n[astropy link]: https://astropy.org\n[pypi link]: https://pypi.org/project/astrodata\n[citation link]: https://github.com/GeminiDRSoftware/astrodata/blob/main/CITATION.md\n[DRAGONS citation]: https://zenodo.org/records/10841622\n\n[coverage badge]: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/teald/d2f3af2a279efc1f6e90d457a3c50e47/raw/covbadge.json\n[docs build badge]: https://github.com/GeminiDRSoftware/astrodata/actions/workflows/documentation.yml/badge.svg\n[pypi packaging badge]: https://github.com/GeminiDRSoftware/astrodata/actions/workflows/publish_pypi.yml/badge.svg\n[pypi package version badge]: https://badge.fury.io/py/astrodata.svg\n[source test status badge]: https://github.com/GeminiDRSoftware/astrodata/actions/workflows/source_tests.yml/badge.svg\n[build test status badge]: https://github.com/GeminiDRSoftware/astrodata/actions/workflows/build_tests.yml/badge.svg\n\n`astrodata`\n=============\n\n<picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"docs/static/logo.svg\">\n <img\n alt=\"A logo of a stylized blue dragon inside a similarly blue shell. A yellow star lies at the center, together with the dragon shape forming a stylized letter A.\"\n src=\"docs/static/logo_dark.svg\"\n align=\"left\"\n height=200\n style=\"padding-right: 10; padding-bottom: 10; border: none;\"\n >\n</picture>\n\n[![Project Status: Active \u2013 The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n![Supported python versions -- 3.10, 3.11, and 3.12](https://img.shields.io/badge/3.10|3.11|3.12-%234b8bbe?logo=Python&logoColor=%234b8bbe&label=For%20Python%3A)\n[![PyPI version badge][pypi package version badge]](https://badge.fury.io/py/astrodata)\n\n### Tests\n![A badge displaying the testing coverage percentage of this repository.][coverage badge]\n![Source test status badge][source test status badge]\n![Build/Release test status badge][build test status badge]\n\n### Building & Publishing\n![Documentation build status badge][docs build badge]\n![pypi packaging status badge][pypi packaging badge]\n\n<!-- Clearing the logo for the next header -->\n<br clear=\"left\">\n\nMaking astronomical data consistent and approachable\n--------------------------------------------------------------------\n\n`astrodata` is a package for managing astronomical data through a uniform\ninterface. It is designed to be used with the\n[Astropy package][astropy link]. `astrodata` was created\nfor use as part of the [`DRAGONS`][DRAGONS link] data reduction pipeline, but it is now\nimplemented to be useful for any astronomical data reduction or analysis\nproject.\n\nUnlike managing files using the ``astropy.io.fits`` package alone, ``astrodata``\nis designed to be extendible to any data format, and to parse, respond to, and\nstore metadata in a consistent, intentional way. This makes it especially\nuseful for managing data from multiple instruments, telescopes, and data\ngeneration utilities.\n\n**Note:** If you are trying to reduce Gemini data, please use [`DRAGONS`][DRAGONS link].\nInteraction with this package directly is primarily suited for developers, and\ndoes not come with any tools for data reduction on any specific instrument or\ndata.\n\nInstallation\n------------\n\n`astrodata` is available on the [Python Package Index][pypi link] and\ncan be installed using `pip`:\n\n```\npython -m pip install astrodata\n```\n\nDocumentation\n-------------\n\nDocumentation for ``astrodata`` is available on our [GitHub pages site][astrodata docs]. This documentation includes a\nuser and programmer's guide, as well as a full API reference.\n\n\nUsage\n-----\n\nThe most basic usage of ``astrodata`` is to extend the ``astrodata.AstroData``\nclass, which includes some basic FITS file handling methods by default:\n\n```python\nfrom astrodata import AstroData, astro_data_descriptor, factory, from_file\n\n\nclass MyData(AstroData):\n @astro_data_descriptor\n def color(self):\n # The color filter used for our image is stored in a few different\n # ways, let's unify them.\n blue_labels = {\"blue\", \"bl\", \"b\"}\n green_labels = {\"green\", \"gr\", \"g\"}\n red_labels = {\"red\", \"re\", \"r\"}\n\n header_value = self.phu.get(\"COLOR\", None).casefold()\n\n if header_value in blue_labels:\n return \"BLUE\"\n\n if header_value in green_labels:\n return \"GREEN\"\n\n if header_value in red_labels:\n return \"RED\"\n\n if header_value is None:\n raise ValueError(\"No color found\")\n\n # Unrecognized color\n raise ValueError(f\"Did not recognize COLOR value: {header_value}\")\n\n\n# Now, define our instruments with nuanced, individual data formats\nclass MyInstrument1(MyData):\n # These use a special method to resolve the metadata and apply the correct\n # class.\n @staticmethod\n def _matches_data(source):\n return source[0].header.get(\"INSTRUME\", \"\").upper() == \"MYINSTRUMENT1\"\n\n\nclass MyInstrument2(MyData):\n @staticmethod\n def _matches_data(source):\n return source[0].header.get(\"INSTRUME\", \"\").upper() == \"MYINSTRUMENT2\"\n\n\nclass MyInstrument3(MyData):\n @staticmethod\n def _matches_data(source):\n return source[0].header.get(\"INSTRUME\", \"\").upper() == \"MYINSTRUMENT3\"\n\n\nfor cls in [MyInstrument1, MyInstrument2, MyInstrument3]:\n factory.add_class(cls)\n\n# my_file.fits has some color data depending on the instrument it comes from,\n# but now we can access it and handle a single value.\ndata = from_file(\"README_example.fits\")\n\n# the astrodata factory has already resolved the correct class for us.\nprint(f\"File used to create class: {data.__class__.__name__}\")\nif data.color() == \"BLUE\":\n print(\"I used the blue filter!\")\n\nelse:\n print(\"I used a red or green filter!\")\n\n# Get all the info about the astrodata object.\ndata.info()\n\n```\n\nThis will print out the filter used as extracted from the header of the FITS\nfile. `data.info()` offers a more complete look at the file's data including\nthe filename and path of the file (as it does for `astropy.io.fits` objects).\n\n`astrodata` is designed to be extensible, so you can add your own methods to\nanalyze and process data based on your specific needs and use cases.\n\n`astrodata` also has a number of built in features, including:\n\n+ Operator support for arithmetic operations\n+ Uncertainty propagation\n+ Slicing\n+ Windowing (reading and operating on subsets of data)\n+ Metadata management and access\n\n[user Manual]: https://geminidrsoftware.github.io/astrodata/manuals/usermanual/index.html\n[prog manual]: https://geminidrsoftware.github.io/astrodata/manuals/progmanual/index.html\n\nFor a complete example, see the\n[Quickstart](https://geminidrsoftware.github.io/astrodata/quickstart.html) in\nour documentation. For more advanced usage, see the [User Manual][user manual]\nor [Programmer's Manual][prog manual].\n\nInstalling development dependencies\n-----------------------------------\n\n``astrodata`` uses [Poetry](https://github.com/python-poetry/poetry) for build\nand package management. Our documentation includes an [installation guide for\n`astrodata`\ndevelopers](https://geminidrsoftware.github.io/astrodata/developer/index.html)\n\nContributing\n------------\n\nSee [our contributing guidelines](CONTRIBUTING.md) for information on\ncontributing. If you're worried about contributing, or feel intimidated, please\nremember that your contribution is immensely appreciated---no matter how small!\n\nLicense\n-------\n\nThis project is Copyright 2024 (c) and licensed under the terms of a modified\nBSD 3-clause license through AURA astronomy. This package is based upon the\n[Openastronomy packaging\nguide](https://github.com/OpenAstronomy/packaging-guide) which is licensed\nunder the standard BSD 3-clause license. See the LICENSE file for more\ninformation.\n\nCitations\n---------\n\nTo cite `astrodata` in your work, please see [CITATION.md][citation link]\nfor complete information, including a `bibtex` example.\n\nFor ease of reference, the current citation to use is:\n[Simpson et al. 2024][DRAGONS citation].\n",
"bugtrack_url": null,
"license": "BSD3",
"summary": "A package for managing astronomical data through a uniform interface",
"version": "2.9.4",
"project_urls": {
"Documentation": "https://geminidrsoftware.github.io/astrodata/",
"Homepage": "https://github.com/GeminiDRSoftware/astrodata/",
"Repository": "https://github.com/GeminiDRSoftware/astrodata/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7fa05856e1ef3b3ab595d38f1cdc2c6ff5475aa119ec900bea81501e8c049ced",
"md5": "71f7a2aa38a800fb5ac83d82a73a6b18",
"sha256": "aa30a4ceaea0f555275d4366283d076bf364ff07d00e71e30c6d8cb82c12abc7"
},
"downloads": -1,
"filename": "astrodata-2.9.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "71f7a2aa38a800fb5ac83d82a73a6b18",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 75903,
"upload_time": "2024-08-28T20:51:18",
"upload_time_iso_8601": "2024-08-28T20:51:18.743969Z",
"url": "https://files.pythonhosted.org/packages/7f/a0/5856e1ef3b3ab595d38f1cdc2c6ff5475aa119ec900bea81501e8c049ced/astrodata-2.9.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "da24fd630ea60406cf27abd08f6def71fe65c60689db8ac15b55e9ad17caabcf",
"md5": "97522e9b1cd36af6f50e9ed9c4857dcc",
"sha256": "89318d1280c693b946b115392c93597eaa745f16470cd39ad74842e54f45336e"
},
"downloads": -1,
"filename": "astrodata-2.9.4.tar.gz",
"has_sig": false,
"md5_digest": "97522e9b1cd36af6f50e9ed9c4857dcc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 74700,
"upload_time": "2024-08-28T20:51:20",
"upload_time_iso_8601": "2024-08-28T20:51:20.379880Z",
"url": "https://files.pythonhosted.org/packages/da/24/fd630ea60406cf27abd08f6def71fe65c60689db8ac15b55e9ad17caabcf/astrodata-2.9.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-28 20:51:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "GeminiDRSoftware",
"github_project": "astrodata",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "astrodata"
}