xsnap


Namexsnap JSON
Version 0.2.5 PyPI version JSON
download
home_pageNone
SummaryA Python-based pipeline module to easily handle data calibration from Chandra, Swift-XRT, XMM-Newton, and NuSTAR data. Additionally, spectral fitting and analysis are available with the help of XSPEC
upload_time2025-08-05 05:05:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT License Copyright (c) 2025 Ferdinand Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords astronomy xray spectroscopy pipeline supernova
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI - Version](https://img.shields.io/pypi/v/xsnap)](https://pypi.org/project/xsnap/) 
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/xsnap)](https://pypi.org/project/xsnap/)
[![Downloads](https://img.shields.io/pepy/dt/xsnap)](https://pepy.tech/project/xsnap)

<p align="center">
  <picture>
    <img src="https://raw.githubusercontent.com/fercananything/xsnap/main/docs/_static/logo/xsnap_logo_icon_crop.jpeg" alt="My Project logo" width="200px" />
  </picture>
</p>

# XSNAP: X-ray Supernova Analysis Pipeline

XSNAP (X-ray Supernova Analysis Pipeline) is a Python-based pipeline module that automates every step of X-ray supernova data reduction and analysis, from raw event processing and region selection to spectral fitting. XSNAP provides dedicated standard data calibration and spectral extraction scripts for Chandra X-ray Observatory (CXO), Swift-XRT, XMM-Newton, and NuSTAR data.

XSNAP, with the help of PyXspec, is able to model and fit spectra using a wide range of astrophysical models (e.g., Thermal-Bremsstrahlung and Powerlaw). Additionally, XSNAP can generate photometric data through the fitted spectra. 

A follow-up analysis using the Thermal-Bremsstrahlung model can be made, specifically for Type II Supernova. From luminosity fitting to estimating Circumstellar Medium (CSM) densities and mass-loss rates of the supernova progenitors, XSNAP streamines the workflow so you can spend less time on rewriting each analysis manually.

More analysis functions can be made upon requests :)

## Contents

1. [Introduction](#xsnap-x-ray-supernova-analysis-pipeline)  
2. [Installation](#installing-xsnap)  
3. [Dependencies](#required-dependencies)  
4. [Usage and Example](#how-to-use-the-module)  
   - [CLI Scripts](#command-line-scripts)  
   - [Python API](#built-in-module--python-api)  
5. [Problems and Questions](#problems-and-questions) 

## Installing XSNAP

We strongly recommend that you make use of Python virtual environments, or (even better) Conda virtual environments when installing XSNAP. 

Currently, [XSNAP](https://pypi.org/p/xsnap) is available for download in the popular Python Package Index (PyPI).
```shell script
pip install xsnap
```

Additionally, XSNAP should be able to be downloaded by cloning this Github repository and run:
```shell script
git clone https://github.com/fercananything/XSNAP/
cd XNAP
python -m pip install .
```

## Dependencies
### Required Dependencies

XSNAP analysis depends heavily on two non-Python softwares:
* [HEASOFT](https://heasarc.gsfc.nasa.gov/docs/software/lheasoft/download.html) - Version 6.35. Other recent versions should be compatible even if I have yet to test it.
* [HEASOFT's PyXspec](https://heasarc.gsfc.nasa.gov/docs/xanadu/xspec/python/html/buildinstall.html) - Version 2.1.4 (or XSPEC - Version 12.15.0). Other recent versions should be compatible even if I have yet to test it. Additionally, PyXspec should be automatically installed when you install HEASOFT.

### Recommended Dependencies

While it's not necessarily required, it is strongly recommended to download these non-Python softwares:

* [Chandra Interactive Analysis of Observations (CIAO)](https://cxc.harvard.edu/ciao/download/index.html) - Version 4.17. CIAO is needed if you want to do the spectral extraction from CXO data. It is recommended to install CIAO using the `conda create` command, i.e. install on a different Python/Conda virtual environment. This is to seperate HEASOFT (and XSPEC) with CIAO and avoid clashes between modules. 
* [XMM Science Analysis System (SAS)](https://www.cosmos.esa.int/web/xmm-newton/sas-download) - Version 22.1. However, other recent versions should still be compatible. SAS is needed if you want to do data calibration and spectral extraction for XMM-Newton. A few extra steps for SAS installation can be found [here](https://www.cosmos.esa.int/web/xmm-newton/sas-thread-startup#).
* [HEASARC Calibration Database (CALDB)](https://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/install.html) - Version 2009 Aug 04. The HEASARC CALDB is needed if you want to do data calibration and spectral extraction for Swift-XRT and NuSTAR.
* [CALDB Files for Swift-XRT and NuSTAR](https://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/caldb_supported_missions.html). In addition to the CALDB, the CALDB files are needed to be downloaded too. These files are needed if you want to do data calibration and spectral extraction for Swift-XRT and NuSTAR.

_Keep in mind, without these softwares, you are only able to import the spectra fitting and analysis modules. These softwares help with the scripts dealing for data calibration and spectral extraction._

### Optional Dependencies

This software is completely optional and has minimal impact on the user experience.
* [DS9](https://sites.google.com/cfa.harvard.edu/saoimageds9) - Version 4.1 and above. DS9 is needed to help user's interactivity in making region files.

## How to use the module

XSNAP is organized into two main parts: command-line scripts (where users can invoke on the shell or jupyter notebook) and a built-in module or Python API (where you can import functions and classes).

There are six scripts available for users to run:
| Script             | Description                                              |
|--------------------|----------------------------------------------------------|
| `extract-chandra`  | Calibrate & extract spectrum from Chandra observations. |
| `extract-swift`    | Calibrate & extract spectrum from Swift-XRT (PC/WT mode available).     |
| `swift-stack-pc`   | Bin & stack Swift-XRT PC-mode data (default 1-day bins). |
| `extract-xmm`      | Calibrate & extract spectrum from XMM-Newton.           |
| `extract-nustar`      | Calibrate & extract spectrum from NuSTAR.           |
| `make-region`      | Generate ICRS source/background region files. (Physical region files will also be made if user has DS9)       |

A short tutorial on how to use XSNAP is available in jupyter notebooks [here](https://github.com/fercananything/XSNAP/tree/main/notebook)

## Problems and Questions
If you encounter a bug, or would like to make a feature request, please use the GitHub
[issues](https://github.com/fercananything/XSNAP/issues) page.

In addition, if you have further questions, feel free to send me an email at support@xsnap.org

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "xsnap",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": "Ferdinand <support@xsnap.org>",
    "keywords": "astronomy, xray, spectroscopy, pipeline, supernova",
    "author": null,
    "author_email": "Ferdinand <support@xsnap.org>",
    "download_url": "https://files.pythonhosted.org/packages/57/14/21b3d048e73ec3022d197cdffbcca07beccb4f0c459c6c60962e3e27f50a/xsnap-0.2.5.tar.gz",
    "platform": null,
    "description": "[![PyPI - Version](https://img.shields.io/pypi/v/xsnap)](https://pypi.org/project/xsnap/) \n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/xsnap)](https://pypi.org/project/xsnap/)\n[![Downloads](https://img.shields.io/pepy/dt/xsnap)](https://pepy.tech/project/xsnap)\n\n<p align=\"center\">\n  <picture>\n    <img src=\"https://raw.githubusercontent.com/fercananything/xsnap/main/docs/_static/logo/xsnap_logo_icon_crop.jpeg\" alt=\"My Project logo\" width=\"200px\" />\n  </picture>\n</p>\n\n# XSNAP: X-ray Supernova Analysis Pipeline\n\nXSNAP (X-ray Supernova Analysis Pipeline) is a Python-based pipeline module that automates every step of X-ray supernova data reduction and analysis, from raw event processing and region selection to spectral fitting. XSNAP provides dedicated standard data calibration and spectral extraction scripts for Chandra X-ray Observatory (CXO), Swift-XRT, XMM-Newton, and NuSTAR data.\n\nXSNAP, with the help of PyXspec, is able to model and fit spectra using a wide range of astrophysical models (e.g., Thermal-Bremsstrahlung and Powerlaw). Additionally, XSNAP can generate photometric data through the fitted spectra. \n\nA follow-up analysis using the Thermal-Bremsstrahlung model can be made, specifically for Type II Supernova. From luminosity fitting to estimating Circumstellar Medium (CSM) densities and mass-loss rates of the supernova progenitors, XSNAP streamines the workflow so you can spend less time on rewriting each analysis manually.\n\nMore analysis functions can be made upon requests :)\n\n## Contents\n\n1. [Introduction](#xsnap-x-ray-supernova-analysis-pipeline)  \n2. [Installation](#installing-xsnap)  \n3. [Dependencies](#required-dependencies)  \n4. [Usage and Example](#how-to-use-the-module)  \n   - [CLI Scripts](#command-line-scripts)  \n   - [Python API](#built-in-module--python-api)  \n5. [Problems and Questions](#problems-and-questions) \n\n## Installing XSNAP\n\nWe strongly recommend that you make use of Python virtual environments, or (even better) Conda virtual environments when installing XSNAP. \n\nCurrently, [XSNAP](https://pypi.org/p/xsnap) is available for download in the popular Python Package Index (PyPI).\n```shell script\npip install xsnap\n```\n\nAdditionally, XSNAP should be able to be downloaded by cloning this Github repository and run:\n```shell script\ngit clone https://github.com/fercananything/XSNAP/\ncd XNAP\npython -m pip install .\n```\n\n## Dependencies\n### Required Dependencies\n\nXSNAP analysis depends heavily on two non-Python softwares:\n* [HEASOFT](https://heasarc.gsfc.nasa.gov/docs/software/lheasoft/download.html) - Version 6.35. Other recent versions should be compatible even if I have yet to test it.\n* [HEASOFT's PyXspec](https://heasarc.gsfc.nasa.gov/docs/xanadu/xspec/python/html/buildinstall.html) - Version 2.1.4 (or XSPEC - Version 12.15.0). Other recent versions should be compatible even if I have yet to test it. Additionally, PyXspec should be automatically installed when you install HEASOFT.\n\n### Recommended Dependencies\n\nWhile it's not necessarily required, it is strongly recommended to download these non-Python softwares:\n\n* [Chandra Interactive Analysis of Observations (CIAO)](https://cxc.harvard.edu/ciao/download/index.html) - Version 4.17. CIAO is needed if you want to do the spectral extraction from CXO data. It is recommended to install CIAO using the `conda create` command, i.e. install on a different Python/Conda virtual environment. This is to seperate HEASOFT (and XSPEC) with CIAO and avoid clashes between modules. \n* [XMM Science Analysis System (SAS)](https://www.cosmos.esa.int/web/xmm-newton/sas-download) - Version 22.1. However, other recent versions should still be compatible. SAS is needed if you want to do data calibration and spectral extraction for XMM-Newton. A few extra steps for SAS installation can be found [here](https://www.cosmos.esa.int/web/xmm-newton/sas-thread-startup#).\n* [HEASARC Calibration Database (CALDB)](https://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/install.html) - Version 2009 Aug 04. The HEASARC CALDB is needed if you want to do data calibration and spectral extraction for Swift-XRT and NuSTAR.\n* [CALDB Files for Swift-XRT and NuSTAR](https://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/caldb_supported_missions.html). In addition to the CALDB, the CALDB files are needed to be downloaded too. These files are needed if you want to do data calibration and spectral extraction for Swift-XRT and NuSTAR.\n\n_Keep in mind, without these softwares, you are only able to import the spectra fitting and analysis modules. These softwares help with the scripts dealing for data calibration and spectral extraction._\n\n### Optional Dependencies\n\nThis software is completely optional and has minimal impact on the user experience.\n* [DS9](https://sites.google.com/cfa.harvard.edu/saoimageds9) - Version 4.1 and above. DS9 is needed to help user's interactivity in making region files.\n\n## How to use the module\n\nXSNAP is organized into two main parts: command-line scripts (where users can invoke on the shell or jupyter notebook) and a built-in module or Python API (where you can import functions and classes).\n\nThere are six scripts available for users to run:\n| Script             | Description                                              |\n|--------------------|----------------------------------------------------------|\n| `extract-chandra`  | Calibrate & extract spectrum from Chandra observations. |\n| `extract-swift`    | Calibrate & extract spectrum from Swift-XRT (PC/WT mode available).     |\n| `swift-stack-pc`   | Bin & stack Swift-XRT PC-mode data (default 1-day bins). |\n| `extract-xmm`      | Calibrate & extract spectrum from XMM-Newton.           |\n| `extract-nustar`      | Calibrate & extract spectrum from NuSTAR.           |\n| `make-region`      | Generate ICRS source/background region files. (Physical region files will also be made if user has DS9)       |\n\nA short tutorial on how to use XSNAP is available in jupyter notebooks [here](https://github.com/fercananything/XSNAP/tree/main/notebook)\n\n## Problems and Questions\nIf you encounter a bug, or would like to make a feature request, please use the GitHub\n[issues](https://github.com/fercananything/XSNAP/issues) page.\n\nIn addition, if you have further questions, feel free to send me an email at support@xsnap.org\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 Ferdinand\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        ",
    "summary": "A Python-based pipeline module to easily handle data calibration from Chandra, Swift-XRT, XMM-Newton, and NuSTAR data. Additionally, spectral fitting and analysis are available with the help of XSPEC",
    "version": "0.2.5",
    "project_urls": {
        "Changelog": "https://github.com/fercananything/XSNAP/blob/main/CHANGELOG.md",
        "Homepage": "https://xsnap.org/",
        "Issues": "https://github.com/fercananything/XSNAP/issues",
        "Repository": "https://github.com/fercananything/XSNAP/"
    },
    "split_keywords": [
        "astronomy",
        " xray",
        " spectroscopy",
        " pipeline",
        " supernova"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d7a6d155acec1285cda3982a71c78af0d03b7f682b69a40af7bccd677ebf77a5",
                "md5": "0561377dd485db504911108ef4bc454d",
                "sha256": "79636eb859d6648eda9f1a61bc0a247bdcb10a20df64a33f62c2c448457f80c8"
            },
            "downloads": -1,
            "filename": "xsnap-0.2.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0561377dd485db504911108ef4bc454d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 57894,
            "upload_time": "2025-08-05T05:05:27",
            "upload_time_iso_8601": "2025-08-05T05:05:27.590610Z",
            "url": "https://files.pythonhosted.org/packages/d7/a6/d155acec1285cda3982a71c78af0d03b7f682b69a40af7bccd677ebf77a5/xsnap-0.2.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "571421b3d048e73ec3022d197cdffbcca07beccb4f0c459c6c60962e3e27f50a",
                "md5": "55a579d0bcf01da313cbb92afcff9804",
                "sha256": "1150b2416b40a93474634caaefd030fc34b5adf0aa64ab600fea51d45892f305"
            },
            "downloads": -1,
            "filename": "xsnap-0.2.5.tar.gz",
            "has_sig": false,
            "md5_digest": "55a579d0bcf01da313cbb92afcff9804",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 55989,
            "upload_time": "2025-08-05T05:05:29",
            "upload_time_iso_8601": "2025-08-05T05:05:29.326085Z",
            "url": "https://files.pythonhosted.org/packages/57/14/21b3d048e73ec3022d197cdffbcca07beccb4f0c459c6c60962e3e27f50a/xsnap-0.2.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-05 05:05:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fercananything",
    "github_project": "XSNAP",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "xsnap"
}
        
Elapsed time: 1.80014s