daxa 0.0.2__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.
daxa-0.0.2/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2022, David J Turner
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
daxa-0.0.2/MANIFEST.in ADDED
@@ -0,0 +1,3 @@
1
+ # include versioneer.py
2
+ # include daxa/_version.py
3
+ recursive-include daxa/files *
daxa-0.0.2/PKG-INFO ADDED
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.1
2
+ Name: daxa
3
+ Version: 0.0.2
4
+ Summary: Democratising Astronomy X-ray Archives (DAXA) is an easy-to-use Python module which enables the simple processing and reduction of archives of X-ray telescope observations.
5
+ Home-page: https://github.com/DavidT3/DAXA
6
+ Author: David J Turner
7
+ Author-email: turne540@msu.edu
8
+ License: BSD 3
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: numpy==1.23.4
13
+ Requires-Dist: astroquery==0.4.6
14
+ Requires-Dist: pandas==1.5.1
15
+ Requires-Dist: astropy==5.1.1
16
+ Requires-Dist: packaging==21.3
17
+ Requires-Dist: tqdm==4.64.1
18
+ Requires-Dist: exceptiongroup==1.0.4
19
+ Requires-Dist: scipy==1.1.0
20
+ Requires-Dist: tabulate==0.9.0
21
+ Requires-Dist: unlzw3==0.2.2
22
+
23
+ <p align="center">
24
+ <img src="https://raw.githubusercontent.com/DavidT3/DAXA/master/daxa/files/daxa-high-resolution-logo-black-on-white-background.png" width="500">
25
+ </p>
26
+
27
+ [![Documentation Status](https://readthedocs.org/projects/daxa/badge/?version=latest)](https://daxa.readthedocs.io/en/latest/?badge=latest)
28
+
29
+ # What is Democratising Archival X-ray Astronomy (DAXA)?
30
+
31
+ DAXA is a Python module designed to make the acquisition and processing of archives of X-ray astronomy data as
32
+ painless as possible. It provides a consistent interface to the downloading and cleaning processes of each telescope,
33
+ allowing the user to easily create multi-mission X-ray archives, allowing for the community to make better use of
34
+ archival X-ray data. This process can be as simple or as in-depth as the user requires; if the default settings are
35
+ used then data can be acquired and processed into an archive in only a few lines of code.
36
+
37
+ As the missions (i.e. telescopes) that should be included in the archive are defined, the user can filter the desired
38
+ observations based on a unique identifier (i.e. observation ID), on whether observations are near to a coordinate (or
39
+ set of coordinates), and the time frame in which the observations were taken. As such it is possible to very quickly
40
+ identify what archival data might be available for a set of objects you wish to study. It is also possible to place
41
+ no filters on the desired observations, and as such process every observation available for a set of missions.
42
+
43
+ Documentation is available on ReadTheDocs, and [can be found here](https://daxa.readthedocs.io), or
44
+ accessed by clicking on the documentation build status at the top of the README. The source for the documentation can
45
+ be found in the 'docs' directory in this repository.
46
+
47
+ # Which missions are supported?
48
+
49
+ **_DAXA is still in an early stage of development, and as such the list of supported telescopes is currently
50
+ limited. Support for more telescopes is either currently under development or being actively planned._**
51
+
52
+ * XMM-Newton Pointed
53
+ * eROSITA Commissioning
54
+ * eROSITA All-Sky Survey DR1 (German Half)
55
+ * **_[Under Development - data acquisition implemented]_** NuSTAR
56
+ * **_[Under Development - data acquisition implemented]_** Chandra
57
+ * **_[Under Development - RASS/pointed data acquisition implemented]_** ROSAT
58
+ * **_[Under Development - XRT/BAT/UVOT data acquisition implemented]_** Swift
59
+ * **_[Under Development - data acquisition implemented]_** Suzaku
60
+ * **_[Under Development - data acquisition implemented]_** ASCA
61
+ * **_[Under Development - data acquisition implemented]_** INTEGRAL
62
+
63
+ _If you would like to help with any of the telescopes above, or adding another X-ray telescope, please get in contact!_
64
+
65
+ # Required telescope-specific software
66
+
67
+ DAXA makes significant use of existing processing software released by the telescope teams, and as such there are some
68
+ specific non-Python dependencies that need to be installed if that mission is to be included in a DAXA generated archive.
69
+
70
+ ## An alternative to installing the dependencies yourself
71
+
72
+ **_[Under Development]_** - A docker image containing relevant telescope-specific software is being created. The
73
+ built image will be released on DockerHub (or some other convenient platform), and the actual dockerfile used for
74
+ building the image will also be released for anyone to use/modify. The dockerfile is heavily inspired by/based off of
75
+ the HEASoft docker image.
76
+
77
+ ## XMM-Newton
78
+ Science Analysis System (SAS) - v14 or higher
79
+
80
+ ##
81
+
82
+ # Analysing the processed archives
83
+ Once an archive of cleaned X-ray data has been created, it can be analysed in all the standard ways, however you may
84
+ also wish to consider [X-ray: Generate and Analyse (XGA)](https://github.com/DavidT3/XGA), a companion module to DAXA.
85
+
86
+ XGA is also completely open source, and is a generalised tool for the analysis of X-ray emission from astrophysical
87
+ sources. The software operates on a 'source based' paradigm, where the user declares sources or samples of objects
88
+ which are analogous to astrophysical sources in the sky, with XGA determining which data (if any) are relevant to a
89
+ particular source, and providing a powerful (but easy to use) interface for the generation and analysis of data
90
+ products. The module is fully documented, with tutorials and API documentation available (**support for telescopes
91
+ other than XMM is still under development**).
92
+
93
+ # Problems and Questions
94
+ If you encounter a bug, or would like to make a feature request, please use the GitHub
95
+ [issues](https://github.com/DavidT3/DAXA/issues) page, it really helps to keep track of everything.
96
+
97
+ However, if you have further questions, or just want to make doubly sure I notice the issue, feel free to send
98
+ me an email at turne540@msu.edu
99
+
100
+
101
+
102
+
103
+
daxa-0.0.2/README.md ADDED
@@ -0,0 +1,81 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/DavidT3/DAXA/master/daxa/files/daxa-high-resolution-logo-black-on-white-background.png" width="500">
3
+ </p>
4
+
5
+ [![Documentation Status](https://readthedocs.org/projects/daxa/badge/?version=latest)](https://daxa.readthedocs.io/en/latest/?badge=latest)
6
+
7
+ # What is Democratising Archival X-ray Astronomy (DAXA)?
8
+
9
+ DAXA is a Python module designed to make the acquisition and processing of archives of X-ray astronomy data as
10
+ painless as possible. It provides a consistent interface to the downloading and cleaning processes of each telescope,
11
+ allowing the user to easily create multi-mission X-ray archives, allowing for the community to make better use of
12
+ archival X-ray data. This process can be as simple or as in-depth as the user requires; if the default settings are
13
+ used then data can be acquired and processed into an archive in only a few lines of code.
14
+
15
+ As the missions (i.e. telescopes) that should be included in the archive are defined, the user can filter the desired
16
+ observations based on a unique identifier (i.e. observation ID), on whether observations are near to a coordinate (or
17
+ set of coordinates), and the time frame in which the observations were taken. As such it is possible to very quickly
18
+ identify what archival data might be available for a set of objects you wish to study. It is also possible to place
19
+ no filters on the desired observations, and as such process every observation available for a set of missions.
20
+
21
+ Documentation is available on ReadTheDocs, and [can be found here](https://daxa.readthedocs.io), or
22
+ accessed by clicking on the documentation build status at the top of the README. The source for the documentation can
23
+ be found in the 'docs' directory in this repository.
24
+
25
+ # Which missions are supported?
26
+
27
+ **_DAXA is still in an early stage of development, and as such the list of supported telescopes is currently
28
+ limited. Support for more telescopes is either currently under development or being actively planned._**
29
+
30
+ * XMM-Newton Pointed
31
+ * eROSITA Commissioning
32
+ * eROSITA All-Sky Survey DR1 (German Half)
33
+ * **_[Under Development - data acquisition implemented]_** NuSTAR
34
+ * **_[Under Development - data acquisition implemented]_** Chandra
35
+ * **_[Under Development - RASS/pointed data acquisition implemented]_** ROSAT
36
+ * **_[Under Development - XRT/BAT/UVOT data acquisition implemented]_** Swift
37
+ * **_[Under Development - data acquisition implemented]_** Suzaku
38
+ * **_[Under Development - data acquisition implemented]_** ASCA
39
+ * **_[Under Development - data acquisition implemented]_** INTEGRAL
40
+
41
+ _If you would like to help with any of the telescopes above, or adding another X-ray telescope, please get in contact!_
42
+
43
+ # Required telescope-specific software
44
+
45
+ DAXA makes significant use of existing processing software released by the telescope teams, and as such there are some
46
+ specific non-Python dependencies that need to be installed if that mission is to be included in a DAXA generated archive.
47
+
48
+ ## An alternative to installing the dependencies yourself
49
+
50
+ **_[Under Development]_** - A docker image containing relevant telescope-specific software is being created. The
51
+ built image will be released on DockerHub (or some other convenient platform), and the actual dockerfile used for
52
+ building the image will also be released for anyone to use/modify. The dockerfile is heavily inspired by/based off of
53
+ the HEASoft docker image.
54
+
55
+ ## XMM-Newton
56
+ Science Analysis System (SAS) - v14 or higher
57
+
58
+ ##
59
+
60
+ # Analysing the processed archives
61
+ Once an archive of cleaned X-ray data has been created, it can be analysed in all the standard ways, however you may
62
+ also wish to consider [X-ray: Generate and Analyse (XGA)](https://github.com/DavidT3/XGA), a companion module to DAXA.
63
+
64
+ XGA is also completely open source, and is a generalised tool for the analysis of X-ray emission from astrophysical
65
+ sources. The software operates on a 'source based' paradigm, where the user declares sources or samples of objects
66
+ which are analogous to astrophysical sources in the sky, with XGA determining which data (if any) are relevant to a
67
+ particular source, and providing a powerful (but easy to use) interface for the generation and analysis of data
68
+ products. The module is fully documented, with tutorials and API documentation available (**support for telescopes
69
+ other than XMM is still under development**).
70
+
71
+ # Problems and Questions
72
+ If you encounter a bug, or would like to make a feature request, please use the GitHub
73
+ [issues](https://github.com/DavidT3/DAXA/issues) page, it really helps to keep track of everything.
74
+
75
+ However, if you have further questions, or just want to make doubly sure I notice the issue, feel free to send
76
+ me an email at turne540@msu.edu
77
+
78
+
79
+
80
+
81
+
@@ -0,0 +1,5 @@
1
+ # This code is a part of the Democratising Archival X-ray Astronomy (DAXA) module.
2
+ # Last modified by David J Turner (turne540@msu.edu) 15/04/2024, 14:49. Copyright (c) The Contributors
3
+
4
+ from .config import daxa_conf, OUTPUT, NUM_CORES, sb_rate
5
+ from .mission.xmm import *
@@ -0,0 +1,88 @@
1
+ # This code is a part of the Democratising Archival X-ray Astronomy (DAXA) module.
2
+ # Last modified by David J Turner (turne540@msu.edu) 15/04/2024, 14:49. Copyright (c) The Contributors
3
+
4
+ import os
5
+ from configparser import ConfigParser
6
+ from warnings import warn
7
+
8
+ import pandas as pd
9
+ import pkg_resources
10
+ from astropy.units import def_unit, ct, deg, s
11
+ from numpy import floor
12
+
13
+ from .exceptions import DAXAConfigError
14
+
15
+ # If XDG_CONFIG_HOME is set, then use that, otherwise use this default config path
16
+ CONFIG_PATH = os.environ.get('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), '.config', 'daxa'))
17
+ # DAXA config file path
18
+ CONFIG_FILE = os.path.join(CONFIG_PATH, 'daxa.cfg')
19
+ # Section of the config file for setting up the DAXA module
20
+ DAXA_CONFIG = {"daxa_save_path": "daxa_output/",
21
+ "num_cores": -1}
22
+
23
+ if not os.path.exists(CONFIG_PATH):
24
+ os.makedirs(CONFIG_PATH)
25
+
26
+ # If first DAXA run, creates default config file
27
+ if not os.path.exists(CONFIG_FILE):
28
+ daxa_default = ConfigParser()
29
+ daxa_default.add_section("DAXA_SETUP")
30
+ daxa_default["DAXA_SETUP"] = DAXA_CONFIG
31
+ with open(CONFIG_FILE, 'w') as new_cfg:
32
+ daxa_default.write(new_cfg)
33
+
34
+ # First time run triggers this message
35
+ warn("A configuration file has been created ({}); you can use it to control where DAXA "
36
+ "stores data by default.".format(CONFIG_FILE), stacklevel=2)
37
+
38
+ daxa_conf = ConfigParser()
39
+ # It would be nice to do configparser interpolation, but it wouldn't handle the lists of energy values
40
+ daxa_conf.read(CONFIG_FILE)
41
+
42
+ try:
43
+ cfg_cores = daxa_conf['DAXA_SETUP'].getint('num_cores')
44
+ except ValueError:
45
+ raise DAXAConfigError("The 'num_cores' configuration parameter must be an integer, with -1 corresponding "
46
+ "to a null value and meaning that DAXA will determine the number of cores to use itself.")
47
+
48
+ # As it turns out, the ConfigParser class is a pain to work with, so we're converting to a dict here
49
+ # Addressing works just the same
50
+ daxa_conf = {str(sect): dict(daxa_conf[str(sect)]) for sect in daxa_conf}
51
+
52
+ if cfg_cores != -1 and cfg_cores <= os.cpu_count():
53
+ # If the user has set a number of cores in the config file then we'll use that.
54
+ NUM_CORES = int(daxa_conf["DAXA_SETUP"]["num_cores"])
55
+ elif cfg_cores != -1:
56
+ raise DAXAConfigError("You have set a num_cores values that is greater than the number of cores available in"
57
+ " the current system ({}).".format(os.cpu_count()))
58
+ else:
59
+ # Going to allow multi-core processing to use 90% of available cores by default, but
60
+ # this can be over-ridden in individual SAS calls.
61
+ NUM_CORES = max(int(floor(os.cpu_count() * 0.9)), 1) # Makes sure that at least one core is used
62
+
63
+
64
+ # This is the default output directory for archives setup by DAXA, though it can be overridden on
65
+ # a mission level
66
+ OUTPUT = os.path.abspath(daxa_conf["DAXA_SETUP"]["daxa_save_path"]) + "/"
67
+
68
+ # Here we read in files that list the errors and warnings in SAS
69
+ errors = pd.read_csv(pkg_resources.resource_filename(__name__, "files/sas_errors.csv"), header="infer")
70
+ warnings = pd.read_csv(pkg_resources.resource_filename(__name__, "files/sas_warnings.csv"), header="infer")
71
+ # Just the names of the errors in two handy constants
72
+ SASERROR_LIST = errors["ErrName"].values
73
+ SASWARNING_LIST = warnings["WarnName"].values
74
+
75
+ # Reading in the file with information on the eROSITA observations that were made available in the
76
+ # eROSITA CalPV release
77
+ EROSITA_CALPV_INFO = pd.read_csv(pkg_resources.resource_filename(__name__, "files/erosita_calpv_info.csv"),
78
+ header="infer", dtype={'ObsID': str})
79
+ # TODO This may end up changing when we get access to the DR1 release - it could be in a format that makes this
80
+ # a bad way of doing it
81
+ # Then doing the same thing, but for the German eRASS:1 release
82
+ ERASS_DE_DR1_INFO = pd.read_csv(pkg_resources.resource_filename(__name__, "files/erass_de_dr1_info.csv"),
83
+ header="infer", dtype={'ObsID': str, 'FIELD1': str, 'FIELD2': str, 'FIELD3': str,
84
+ 'FIELD4': str, 'FIELD5': str, 'FIELD6': str, 'FIELD7': str,
85
+ 'FIELD8': str, 'FIELD9': str})
86
+
87
+ # We define a surface brightness rate astropy unit for use in flaregti to measure thresholds in
88
+ sb_rate = def_unit('sb_rate', ct / (deg**2 * s))