pysiaf


Namepysiaf JSON
Version 0.23.3 PyPI version JSON
download
home_pageNone
SummaryHandling of Science Instrument Aperture Files (SIAF) for space telescopes
upload_time2024-09-13 21:46:58
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseBSD 3-Clause License Copyright (c) 2018, Space Telescope Science Institute, AURA All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Build Status](https://github.com/spacetelescope/pysiaf/workflows/pysiaf%20CI/badge.svg)](https://github.com/spacetelescope/pysiaf/actions)
[![Documentation Status](https://readthedocs.org/projects/pysiaf/badge/?version=latest)](https://pysiaf.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://badge.fury.io/py/pysiaf.svg)](https://badge.fury.io/py/pysiaf)
[![PyPI - License](https://img.shields.io/pypi/l/Django.svg)](https://github.com/spacetelescope/pysiaf/blob/master/LICENSE.md)
[![DOI](https://zenodo.org/badge/122391513.svg)](https://zenodo.org/badge/latestdoi/122391513)


# pysiaf
Handling of Science Instrument Aperture Files (SIAF) for space telescopes. SIAF files contain detailed geometric focal plane descriptions and relationships for the science instruments. They are maintained in the JWST/HST PRD (Project Reference Database).  
pysiaf is a python package to access, interpret, maintain, and generate SIAF, in particular for JWST. Tools for applying the frame transformations, plotting, comparison, and validation are provided.  

### Functionalities
* Captures current PRD content, i.e. pysiaf includes a copy of the SIAF XML files. These are maintained to be synchronized with the PRD.
* Transformations between the SIAF frames (Detector, Science, Ideal, Telelescope/V) are pre-loaded and easily accessible.
* Tools for plotting, validation, and comparison of SIAF apertures and files.
* Support for implementing transformations between celestial (RA, Dec) and telescope/V (V2, V3) coordinate systems is provided.
* Input/output: reading SIAF XML, writing XML/Excel/csv etc.
* Captures SI source data and code to generate the SIAF apertures
* Standard python package with installation script, unit tests, documentation.
* Supports working with HST SIAF (read-only).


### Example usage
Check which PRD version is in use:  
    `print(pysiaf.JWST_PRD_VERSION)`

Frame transformations (`det`, `sci`, `idl`, `tel` are supported frames):  
````
    import pysiaf
    instrument = 'NIRISS'

    # read SIAFXML
    siaf = pysiaf.Siaf(instrument)  

    # select single aperture by name
    nis_cen = siaf['NIS_CEN']  

    # access SIAF parameters
    print('{} V2Ref = {}'.format(nis_cen.AperName, nis_cen.V2Ref))
    print('{} V3Ref = {}'.format(nis_cen.AperName, nis_cen.V3Ref))

    for attribute in ['InstrName', 'AperShape']:
        print('{} {} = {}'.format(nis_cen.AperName, attribute, getattr(nis_cen, attribute)))


    # coordinates in Science frame
    sci_x = np.array([0, 2047, 2047, 0])
    sci_y = np.array([0, 0, 2047, 2047])  

    # transform from Science frame to Ideal frame
    idl_x, idl_y = nis_cen.sci_to_idl(sci_x, sci_y)
````    
Plotting (only a small subset of options is illustrated):  
<p align="center">
  <img src="examples/figures/NIRISS_apertures.png" width="200"/>
  <img src="examples/figures/JWST_master_apertures.png" width="430"/>
  <img src="examples/figures/HST_apertures.png" width="230"/>
</p>

````
    import matplotlib.pyplot as plt

    plt.figure(figsize=(4, 4), facecolor='w', edgecolor='k'); plt.clf()

    # plot single aperture
    nis_cen.plot()

    # plot all apertures in SIAF
    for aperture_name, aperture in siaf.apertures.items():
        aperture.plot()
    plt.show()
````
````
    # plot 'master' apertures
    from pysiaf.siaf import plot_master_apertures
    plt.figure(figsize=(8, 8), facecolor='w', edgecolor='k'); plt.clf()
    plot_master_apertures(mark_ref=True)
    plt.show()
````
````
    # plot HST apertures
    siaf = pysiaf.Siaf('HST')
    aperture_names = ['FGS1', 'FGS2', 'FGS3', 'IUVIS1FIX', 'IUVIS2FIX', 'JWFC1FIX', 'JWFC2FIX']

    plt.figure(figsize=(4, 4), facecolor='w', edgecolor='k')
    for aperture_name in aperture_names:
        siaf[aperture_name].plot(color='r', fill_color='darksalmon', mark_ref=True)
    ax = plt.gca()
    ax.set_aspect('equal')
    ax.invert_yaxis()
    plt.show()

````

### Documentation
The primary reference for a description of JWST SIAF is Cox & Lallo, 2017, JWST-STScI-001550: *Description and Use of the JWST Science Instrument Aperture File*, available at https://jwst.stsci.edu/documentation/technical-documents.

pysiaf is documented at https://pysiaf.readthedocs.io/  

### Citation
If you find this package useful, please consider citing the Zenodo record using the DOI badge above.
Please find additional citation instructions in [CITATION](CITATION).


### Disclaimer

All parameter values in pysiaf are subject to change. JWST values are preliminary until the JWST observatory commissioning has concluded.    

Distortion and other transformations in pysiaf are of sufficient accuracy for operations, but do not necessarily have science-grade quality. For instance, generally only one filter solution is carried per aperture.
For science-grade transformations, please consult the science pipelines and their reference files (see  https://jwst-docs.stsci.edu/jwst-data-reduction-pipeline)     

For science observation planning, the focal plane geometry implemented in the latest APT (http://www.stsci.edu/hst/proposing/apt) takes precedence.  
The STScI Telescopes Branch provides full support of pysiaf for S&OC operational systems only.


### Contributing
Please open a new issue or new pull request for bugs, feedback, or new features you would like to see. If there is an issue you would like to work on, please leave a comment and we will be happy to assist. New contributions and contributors are very welcome!   
 Do you have feedback and feature requests? Is there something missing you would like to see? Please open an issue or send an email to the maintainers. This package follows the Space Telescope [Code of Conduct](CODE_OF_CONDUCT.md) strives to provide a welcoming community to all of our users and contributors.

The following describes the typical work flow for contributing to the pysiaf project (adapted from JWQL):
0. Do not commit any sensitive information (e.g. STScI-internal path structures, machine names, user names, passwords, etc.) to this public repository. Git history cannot be erased.
1. Create a fork off of the `spacetelescope` `pysiaf` repository on your personal github space.
2. Make a local clone of your fork.
3. Ensure your personal fork is pointing `upstream` to https://github.com/spacetelescope/pysiaf
4. Open an issue on `spacetelescope` `pysiaf` that describes the need for and nature of the changes you plan to make. This is not necessary for minor changes and fixes.
5. Create a branch on that personal fork.
6. Make your software changes.
7. Push that branch to your personal GitHub repository, i.e. to `origin`.
8. On the `spacetelescope` `pysiaf` repository, create a pull request that merges the branch into `spacetelescope:master`.
9. Assign a reviewer from the team for the pull request.
10. Iterate with the reviewer over any needed changes until the reviewer accepts and merges your branch.
11. Delete your local copy of your branch.

### Installation  
This package is supported in python 3.10+

`pip install pysiaf`

Clone the repository:  
`git clone https://github.com/spacetelescope/pysiaf`  
Install pysiaf:  
`cd pysiaf`  
`pip install .`

Install in Develop Mode
`pip install -e .`

### Known installation issues

If you get an error upon  
`import pysiaf`  
that traces back to       
`import lxml.etree as ET`      
and states   
    `ImportError [...] Library not loaded: libxml2.2.dylib   
    Reason: Incompatible library version: etree.[...] requires version 12.0.0 or later,
    but libxml2.2.dylib provides version 10.0.0`,       
this can probably be fixed by downgrading the version of lxml, e.g.      
    `pip uninstall lxml`  
    `pip install lxml==3.6.4`

pyqt5 installation issues:
    If using MacOS Mojave, it causes matplotlib to fail without pyqt5. Please take appropriate action to make sure pyqt5 is installed for

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pysiaf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "STScI <help@stsci.edu>",
    "download_url": "https://files.pythonhosted.org/packages/f6/5c/6e262d824812467464240eb838ac5d96671e2553a2c5c0f3ec892a19d852/pysiaf-0.23.3.tar.gz",
    "platform": null,
    "description": "[![Build Status](https://github.com/spacetelescope/pysiaf/workflows/pysiaf%20CI/badge.svg)](https://github.com/spacetelescope/pysiaf/actions)\n[![Documentation Status](https://readthedocs.org/projects/pysiaf/badge/?version=latest)](https://pysiaf.readthedocs.io/en/latest/?badge=latest)\n[![PyPI version](https://badge.fury.io/py/pysiaf.svg)](https://badge.fury.io/py/pysiaf)\n[![PyPI - License](https://img.shields.io/pypi/l/Django.svg)](https://github.com/spacetelescope/pysiaf/blob/master/LICENSE.md)\n[![DOI](https://zenodo.org/badge/122391513.svg)](https://zenodo.org/badge/latestdoi/122391513)\n\n\n# pysiaf\nHandling of Science Instrument Aperture Files (SIAF) for space telescopes. SIAF files contain detailed geometric focal plane descriptions and relationships for the science instruments. They are maintained in the JWST/HST PRD (Project Reference Database).  \npysiaf is a python package to access, interpret, maintain, and generate SIAF, in particular for JWST. Tools for applying the frame transformations, plotting, comparison, and validation are provided.  \n\n### Functionalities\n* Captures current PRD content, i.e. pysiaf includes a copy of the SIAF XML files. These are maintained to be synchronized with the PRD.\n* Transformations between the SIAF frames (Detector, Science, Ideal, Telelescope/V) are pre-loaded and easily accessible.\n* Tools for plotting, validation, and comparison of SIAF apertures and files.\n* Support for implementing transformations between celestial (RA, Dec) and telescope/V (V2, V3) coordinate systems is provided.\n* Input/output: reading SIAF XML, writing XML/Excel/csv etc.\n* Captures SI source data and code to generate the SIAF apertures\n* Standard python package with installation script, unit tests, documentation.\n* Supports working with HST SIAF (read-only).\n\n\n### Example usage\nCheck which PRD version is in use:  \n    `print(pysiaf.JWST_PRD_VERSION)`\n\nFrame transformations (`det`, `sci`, `idl`, `tel` are supported frames):  \n````\n    import pysiaf\n    instrument = 'NIRISS'\n\n    # read SIAFXML\n    siaf = pysiaf.Siaf(instrument)  \n\n    # select single aperture by name\n    nis_cen = siaf['NIS_CEN']  \n\n    # access SIAF parameters\n    print('{} V2Ref = {}'.format(nis_cen.AperName, nis_cen.V2Ref))\n    print('{} V3Ref = {}'.format(nis_cen.AperName, nis_cen.V3Ref))\n\n    for attribute in ['InstrName', 'AperShape']:\n        print('{} {} = {}'.format(nis_cen.AperName, attribute, getattr(nis_cen, attribute)))\n\n\n    # coordinates in Science frame\n    sci_x = np.array([0, 2047, 2047, 0])\n    sci_y = np.array([0, 0, 2047, 2047])  \n\n    # transform from Science frame to Ideal frame\n    idl_x, idl_y = nis_cen.sci_to_idl(sci_x, sci_y)\n````    \nPlotting (only a small subset of options is illustrated):  \n<p align=\"center\">\n  <img src=\"examples/figures/NIRISS_apertures.png\" width=\"200\"/>\n  <img src=\"examples/figures/JWST_master_apertures.png\" width=\"430\"/>\n  <img src=\"examples/figures/HST_apertures.png\" width=\"230\"/>\n</p>\n\n````\n    import matplotlib.pyplot as plt\n\n    plt.figure(figsize=(4, 4), facecolor='w', edgecolor='k'); plt.clf()\n\n    # plot single aperture\n    nis_cen.plot()\n\n    # plot all apertures in SIAF\n    for aperture_name, aperture in siaf.apertures.items():\n        aperture.plot()\n    plt.show()\n````\n````\n    # plot 'master' apertures\n    from pysiaf.siaf import plot_master_apertures\n    plt.figure(figsize=(8, 8), facecolor='w', edgecolor='k'); plt.clf()\n    plot_master_apertures(mark_ref=True)\n    plt.show()\n````\n````\n    # plot HST apertures\n    siaf = pysiaf.Siaf('HST')\n    aperture_names = ['FGS1', 'FGS2', 'FGS3', 'IUVIS1FIX', 'IUVIS2FIX', 'JWFC1FIX', 'JWFC2FIX']\n\n    plt.figure(figsize=(4, 4), facecolor='w', edgecolor='k')\n    for aperture_name in aperture_names:\n        siaf[aperture_name].plot(color='r', fill_color='darksalmon', mark_ref=True)\n    ax = plt.gca()\n    ax.set_aspect('equal')\n    ax.invert_yaxis()\n    plt.show()\n\n````\n\n### Documentation\nThe primary reference for a description of JWST SIAF is Cox & Lallo, 2017, JWST-STScI-001550: *Description and Use of the JWST Science Instrument Aperture File*, available at https://jwst.stsci.edu/documentation/technical-documents.\n\npysiaf is documented at https://pysiaf.readthedocs.io/  \n\n### Citation\nIf you find this package useful, please consider citing the Zenodo record using the DOI badge above.\nPlease find additional citation instructions in [CITATION](CITATION).\n\n\n### Disclaimer\n\nAll parameter values in pysiaf are subject to change. JWST values are preliminary until the JWST observatory commissioning has concluded.    \n\nDistortion and other transformations in pysiaf are of sufficient accuracy for operations, but do not necessarily have science-grade quality. For instance, generally only one filter solution is carried per aperture.\nFor science-grade transformations, please consult the science pipelines and their reference files (see  https://jwst-docs.stsci.edu/jwst-data-reduction-pipeline)     \n\nFor science observation planning, the focal plane geometry implemented in the latest APT (http://www.stsci.edu/hst/proposing/apt) takes precedence.  \nThe STScI Telescopes Branch provides full support of pysiaf for S&OC operational systems only.\n\n\n### Contributing\nPlease open a new issue or new pull request for bugs, feedback, or new features you would like to see. If there is an issue you would like to work on, please leave a comment and we will be happy to assist. New contributions and contributors are very welcome!   \n Do you have feedback and feature requests? Is there something missing you would like to see? Please open an issue or send an email to the maintainers. This package follows the Space Telescope [Code of Conduct](CODE_OF_CONDUCT.md) strives to provide a welcoming community to all of our users and contributors.\n\nThe following describes the typical work flow for contributing to the pysiaf project (adapted from JWQL):\n0. Do not commit any sensitive information (e.g. STScI-internal path structures, machine names, user names, passwords, etc.) to this public repository. Git history cannot be erased.\n1. Create a fork off of the `spacetelescope` `pysiaf` repository on your personal github space.\n2. Make a local clone of your fork.\n3. Ensure your personal fork is pointing `upstream` to https://github.com/spacetelescope/pysiaf\n4. Open an issue on `spacetelescope` `pysiaf` that describes the need for and nature of the changes you plan to make. This is not necessary for minor changes and fixes.\n5. Create a branch on that personal fork.\n6. Make your software changes.\n7. Push that branch to your personal GitHub repository, i.e. to `origin`.\n8. On the `spacetelescope` `pysiaf` repository, create a pull request that merges the branch into `spacetelescope:master`.\n9. Assign a reviewer from the team for the pull request.\n10. Iterate with the reviewer over any needed changes until the reviewer accepts and merges your branch.\n11. Delete your local copy of your branch.\n\n### Installation  \nThis package is supported in python 3.10+\n\n`pip install pysiaf`\n\nClone the repository:  \n`git clone https://github.com/spacetelescope/pysiaf`  \nInstall pysiaf:  \n`cd pysiaf`  \n`pip install .`\n\nInstall in Develop Mode\n`pip install -e .`\n\n### Known installation issues\n\nIf you get an error upon  \n`import pysiaf`  \nthat traces back to       \n`import lxml.etree as ET`      \nand states   \n    `ImportError [...] Library not loaded: libxml2.2.dylib   \n    Reason: Incompatible library version: etree.[...] requires version 12.0.0 or later,\n    but libxml2.2.dylib provides version 10.0.0`,       \nthis can probably be fixed by downgrading the version of lxml, e.g.      \n    `pip uninstall lxml`  \n    `pip install lxml==3.6.4`\n\npyqt5 installation issues:\n    If using MacOS Mojave, it causes matplotlib to fail without pyqt5. Please take appropriate action to make sure pyqt5 is installed for\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2018, Space Telescope Science Institute, AURA All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "Handling of Science Instrument Aperture Files (SIAF) for space telescopes",
    "version": "0.23.3",
    "project_urls": {
        "documentation": "https://pysiaf.readthedocs.io/en/latest/",
        "repository": "https://github.com/spacetelescope/pysiaf"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1780f6b799dda5ab6a254b25fed01db1de7b717c5e33c01efb0e47f3600f683c",
                "md5": "c362ea03399c32e773deaab0bb40ae9b",
                "sha256": "199a6cee2cfcbdb844902053e18e4a4b1f71109a54317e0dbf0672d86caec923"
            },
            "downloads": -1,
            "filename": "pysiaf-0.23.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c362ea03399c32e773deaab0bb40ae9b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 67837192,
            "upload_time": "2024-09-13T21:46:52",
            "upload_time_iso_8601": "2024-09-13T21:46:52.142108Z",
            "url": "https://files.pythonhosted.org/packages/17/80/f6b799dda5ab6a254b25fed01db1de7b717c5e33c01efb0e47f3600f683c/pysiaf-0.23.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f65c6e262d824812467464240eb838ac5d96671e2553a2c5c0f3ec892a19d852",
                "md5": "4942e509a20f950d59471b4d7dd253cb",
                "sha256": "282f1369e37117e0dfebc62350ec057c7c75fe89800085e2c85cf0256c790b9b"
            },
            "downloads": -1,
            "filename": "pysiaf-0.23.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4942e509a20f950d59471b4d7dd253cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 67160380,
            "upload_time": "2024-09-13T21:46:58",
            "upload_time_iso_8601": "2024-09-13T21:46:58.802063Z",
            "url": "https://files.pythonhosted.org/packages/f6/5c/6e262d824812467464240eb838ac5d96671e2553a2c5c0f3ec892a19d852/pysiaf-0.23.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-13 21:46:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "spacetelescope",
    "github_project": "pysiaf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pysiaf"
}
        
Elapsed time: 0.72066s