xsnap 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
xsnap-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ferdinand
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
xsnap-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: xsnap
3
+ Version: 0.2.0
4
+ 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
5
+ Author-email: Ferdinand <ferdinand.1238073@gmail.com>
6
+ Maintainer-email: Ferdinand <ferdinand.1238073@gmail.com>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2025 Ferdinand
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Project-URL: Homepage, https://github.com/fercananything/XSNAP/
30
+ Project-URL: Repository, https://github.com/fercananything/XSNAP/
31
+ Project-URL: Issues, https://github.com/fercananything/XSNAP/issues
32
+ Project-URL: Changelog, https://github.com/fercananything/XSNAP/blob/main/CHANGELOG.md
33
+ Keywords: astronomy,xray,spectroscopy,pipeline,supernova
34
+ Classifier: Development Status :: 3 - Alpha
35
+ Classifier: Intended Audience :: Science/Research
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
39
+ Classifier: Topic :: Scientific/Engineering :: Physics
40
+ Requires-Python: >=3.12
41
+ Description-Content-Type: text/markdown
42
+ License-File: LICENSE
43
+ Requires-Dist: astropy>=7.0.0
44
+ Requires-Dist: corner>=2.2.2
45
+ Requires-Dist: emcee>=3.1.6
46
+ Requires-Dist: matplotlib>=3.10.3
47
+ Requires-Dist: numpy<2.0.0
48
+ Requires-Dist: pandas>=2.2.3
49
+ Requires-Dist: scipy>=1.15.1
50
+ Dynamic: license-file
51
+
52
+ <p align="center">
53
+ <picture>
54
+ <img src="https://raw.githubusercontent.com/fercananything/xsnap/main/docs/_static/logo/xsnap_logo_icon_crop.jpeg" alt="My Project logo" width="200px" />
55
+ </picture>
56
+ </p>
57
+
58
+ # XSNAP: X-ray Supernova Analysis Pipeline
59
+
60
+ 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.
61
+
62
+ 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.
63
+
64
+ 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.
65
+
66
+ More analysis functions can be made upon requests :)
67
+
68
+ ## Contents
69
+
70
+ 1. [Introduction](#xsnap-x-ray-supernova-analysis-pipeline)
71
+ 2. [Installation](#installing-xsnap)
72
+ 3. [Dependencies](#required-dependencies)
73
+ 4. [Usage and Example](#how-to-use-the-module)
74
+ - [CLI Scripts](#command-line-scripts)
75
+ - [Python API](#built-in-module--python-api)
76
+ 5. [Problems and Questions](#problems-and-questions)
77
+
78
+ ## Installing XSNAP
79
+
80
+ We strongly recommend that you make use of Python virtual environments, or (even better) Conda virtual environments when installing XSNAP.
81
+
82
+ Currently, XSNAP is in its development phase. It is available for download at the Testing Python Package Index (TestPyPI) in [here](https://test.pypi.org/project/xsnap/).
83
+ ```shell script
84
+ pip install -i https://test.pypi.org/simple/ xsnap
85
+ ```
86
+
87
+ Additionally, XSNAP should be able to be downloaded by cloning this Github repository and run:
88
+ ```shell script
89
+ git clone https://github.com/fercananything/XSNAP/
90
+ cd XNAP
91
+ python -m pip install .
92
+ ```
93
+
94
+ <!--
95
+ XSNAP is available on the popular Python Package Index (PyPI), and can be installed like this:
96
+ ```shell script
97
+ pip install xsnap
98
+ ```
99
+ -->
100
+
101
+ ## Dependencies
102
+ ### Required Dependencies
103
+
104
+ XSNAP analysis depends heavily on two non-Python softwares:
105
+ * [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.
106
+ * [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.
107
+
108
+ ### Recommended Dependencies
109
+
110
+ While it's not necessarily required, it is strongly recommended to download these non-Python softwares:
111
+
112
+ * [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.
113
+ * [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#).
114
+ * [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.
115
+ * [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.
116
+
117
+ _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._
118
+
119
+ ### Optional Dependencies
120
+
121
+ This software is completely optional and has minimal impact on the user experience.
122
+ * [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.
123
+
124
+ ## How to use the module
125
+
126
+ 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).
127
+
128
+ There are six scripts available for users to run:
129
+ | Script | Description |
130
+ |--------------------|----------------------------------------------------------|
131
+ | `extract-chandra` | Calibrate & extract spectrum from Chandra observations. |
132
+ | `extract-swift` | Calibrate & extract spectrum from Swift-XRT (PC/WT mode available). |
133
+ | `swift-stack-pc` | Bin & stack Swift-XRT PC-mode data (default 1-day bins). |
134
+ | `extract-xmm` | Calibrate & extract spectrum from XMM-Newton. |
135
+ | `extract-nustar` | Calibrate & extract spectrum from NuSTAR. |
136
+ | `make-region` | Generate ICRS source/background region files. (Physical region files will also be made if user has DS9) |
137
+
138
+ A short tutorial on how to use XSNAP is available in jupyter notebooks [here](https://github.com/fercananything/XSNAP/tree/main/notebook)
139
+
140
+ ## Problems and Questions
141
+ If you encounter a bug, or would like to make a feature request, please use the GitHub
142
+ [issues](https://github.com/fercananything/XSNAP/issues) page.
143
+
144
+ In addition, if you have further questions, feel free to send me an email at ferdinand.1238073@gmail.com or ff10@illinois.edu
xsnap-0.2.0/README.md ADDED
@@ -0,0 +1,93 @@
1
+ <p align="center">
2
+ <picture>
3
+ <img src="https://raw.githubusercontent.com/fercananything/xsnap/main/docs/_static/logo/xsnap_logo_icon_crop.jpeg" alt="My Project logo" width="200px" />
4
+ </picture>
5
+ </p>
6
+
7
+ # XSNAP: X-ray Supernova Analysis Pipeline
8
+
9
+ 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.
10
+
11
+ 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.
12
+
13
+ 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.
14
+
15
+ More analysis functions can be made upon requests :)
16
+
17
+ ## Contents
18
+
19
+ 1. [Introduction](#xsnap-x-ray-supernova-analysis-pipeline)
20
+ 2. [Installation](#installing-xsnap)
21
+ 3. [Dependencies](#required-dependencies)
22
+ 4. [Usage and Example](#how-to-use-the-module)
23
+ - [CLI Scripts](#command-line-scripts)
24
+ - [Python API](#built-in-module--python-api)
25
+ 5. [Problems and Questions](#problems-and-questions)
26
+
27
+ ## Installing XSNAP
28
+
29
+ We strongly recommend that you make use of Python virtual environments, or (even better) Conda virtual environments when installing XSNAP.
30
+
31
+ Currently, XSNAP is in its development phase. It is available for download at the Testing Python Package Index (TestPyPI) in [here](https://test.pypi.org/project/xsnap/).
32
+ ```shell script
33
+ pip install -i https://test.pypi.org/simple/ xsnap
34
+ ```
35
+
36
+ Additionally, XSNAP should be able to be downloaded by cloning this Github repository and run:
37
+ ```shell script
38
+ git clone https://github.com/fercananything/XSNAP/
39
+ cd XNAP
40
+ python -m pip install .
41
+ ```
42
+
43
+ <!--
44
+ XSNAP is available on the popular Python Package Index (PyPI), and can be installed like this:
45
+ ```shell script
46
+ pip install xsnap
47
+ ```
48
+ -->
49
+
50
+ ## Dependencies
51
+ ### Required Dependencies
52
+
53
+ XSNAP analysis depends heavily on two non-Python softwares:
54
+ * [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.
55
+ * [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.
56
+
57
+ ### Recommended Dependencies
58
+
59
+ While it's not necessarily required, it is strongly recommended to download these non-Python softwares:
60
+
61
+ * [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.
62
+ * [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#).
63
+ * [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.
64
+ * [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.
65
+
66
+ _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._
67
+
68
+ ### Optional Dependencies
69
+
70
+ This software is completely optional and has minimal impact on the user experience.
71
+ * [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.
72
+
73
+ ## How to use the module
74
+
75
+ 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).
76
+
77
+ There are six scripts available for users to run:
78
+ | Script | Description |
79
+ |--------------------|----------------------------------------------------------|
80
+ | `extract-chandra` | Calibrate & extract spectrum from Chandra observations. |
81
+ | `extract-swift` | Calibrate & extract spectrum from Swift-XRT (PC/WT mode available). |
82
+ | `swift-stack-pc` | Bin & stack Swift-XRT PC-mode data (default 1-day bins). |
83
+ | `extract-xmm` | Calibrate & extract spectrum from XMM-Newton. |
84
+ | `extract-nustar` | Calibrate & extract spectrum from NuSTAR. |
85
+ | `make-region` | Generate ICRS source/background region files. (Physical region files will also be made if user has DS9) |
86
+
87
+ A short tutorial on how to use XSNAP is available in jupyter notebooks [here](https://github.com/fercananything/XSNAP/tree/main/notebook)
88
+
89
+ ## Problems and Questions
90
+ If you encounter a bug, or would like to make a feature request, please use the GitHub
91
+ [issues](https://github.com/fercananything/XSNAP/issues) page.
92
+
93
+ In addition, if you have further questions, feel free to send me an email at ferdinand.1238073@gmail.com or ff10@illinois.edu
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "xsnap"
7
+ version = "0.2.0"
8
+ description = "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"
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = {file = "LICENSE"}
12
+ authors = [{name = "Ferdinand", email = "ferdinand.1238073@gmail.com"}]
13
+ maintainers = [{name = "Ferdinand", email = "ferdinand.1238073@gmail.com"}]
14
+ keywords = ["astronomy", "xray", "spectroscopy", "pipeline", "supernova"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Science/Research",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3",
20
+ "Topic :: Scientific/Engineering :: Astronomy",
21
+ "Topic :: Scientific/Engineering :: Physics"
22
+ ]
23
+
24
+ # ---- runtime dependencies ----
25
+ dependencies = [
26
+ "astropy>=7.0.0",
27
+ "corner>=2.2.2",
28
+ "emcee>=3.1.6",
29
+ "matplotlib>=3.10.3",
30
+ "numpy < 2.0.0",
31
+ "pandas>=2.2.3",
32
+ "scipy>=1.15.1",
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/fercananything/XSNAP/"
37
+ Repository = "https://github.com/fercananything/XSNAP/"
38
+ Issues = "https://github.com/fercananything/XSNAP/issues"
39
+ Changelog = "https://github.com/fercananything/XSNAP/blob/main/CHANGELOG.md"
40
+
41
+ # ---- CLI entry-points ----
42
+ [project.scripts]
43
+ extract-chandra = "xsnap.chandra.extract:cli"
44
+ swift-stack-pc = "xsnap.swiftxrt.stack_pc:cli"
45
+ extract-swift = "xsnap.swiftxrt.extract:cli"
46
+ extract-xmm = "xsnap.xmm.extract:cli"
47
+ extract-nustar = "xsnap.nustar.extract:cli"
48
+ make-region = "xsnap.make_region:cli"
49
+
50
+ # ---- tell setuptools where to find the code ----
51
+ [tool.setuptools.packages.find]
52
+ where = ["src"]
xsnap-0.2.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,9 @@
1
+ """
2
+ xray_pipeline
3
+ =============
4
+
5
+ Modular pipeline for extracting, stacking and fitting X-ray spectra
6
+ from Chandra, Swift-XRT and XMM-Newton.
7
+ """
8
+ __all__ = ["chandra", "swiftxrt", "xmm", "nustar"]
9
+ __version__ = "0.2.0"