isgri 0.3.0__tar.gz → 0.5.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.
Files changed (43) hide show
  1. isgri-0.5.0/PKG-INFO +164 -0
  2. isgri-0.5.0/README.md +148 -0
  3. {isgri-0.3.0 → isgri-0.5.0}/demo/lightcurve_walkthrough.ipynb +398 -398
  4. isgri-0.5.0/demo/scwquery_walkthrough.ipynb +762 -0
  5. {isgri-0.3.0 → isgri-0.5.0}/pyproject.toml +9 -2
  6. isgri-0.5.0/src/isgri/__init__.py +1 -0
  7. isgri-0.5.0/src/isgri/__version__.py +1 -0
  8. isgri-0.5.0/src/isgri/catalog/__init__.py +3 -0
  9. isgri-0.5.0/src/isgri/catalog/builder.py +90 -0
  10. isgri-0.5.0/src/isgri/catalog/scwquery.py +524 -0
  11. isgri-0.5.0/src/isgri/catalog/wcs.py +190 -0
  12. isgri-0.5.0/src/isgri/cli.py +224 -0
  13. isgri-0.5.0/src/isgri/config.py +151 -0
  14. isgri-0.5.0/src/isgri/utils/file_loaders.py +392 -0
  15. {isgri-0.3.0 → isgri-0.5.0}/src/isgri/utils/lightcurve.py +409 -265
  16. isgri-0.5.0/src/isgri/utils/pif.py +286 -0
  17. isgri-0.5.0/src/isgri/utils/quality.py +389 -0
  18. isgri-0.5.0/src/isgri/utils/time_conversion.py +210 -0
  19. isgri-0.5.0/tests/catalog/test_scwquery.py +446 -0
  20. isgri-0.5.0/tests/catalog/test_wcs.py +235 -0
  21. isgri-0.5.0/tests/test_cli.py +243 -0
  22. isgri-0.5.0/tests/test_config.py +136 -0
  23. isgri-0.5.0/tests/utils/test_file_loaders.py +76 -0
  24. {isgri-0.3.0 → isgri-0.5.0}/tests/utils/test_lightcurve.py +286 -288
  25. {isgri-0.3.0 → isgri-0.5.0}/tests/utils/test_quality.py +268 -268
  26. isgri-0.3.0/PKG-INFO +0 -66
  27. isgri-0.3.0/README.md +0 -54
  28. isgri-0.3.0/src/isgri/utils/file_loaders.py +0 -159
  29. isgri-0.3.0/src/isgri/utils/pif.py +0 -41
  30. isgri-0.3.0/src/isgri/utils/quality.py +0 -182
  31. isgri-0.3.0/src/isgri/utils/time_conversion.py +0 -39
  32. isgri-0.3.0/tests/utils/__init__.py +0 -0
  33. isgri-0.3.0/tests/utils/test_file_loaders.py +0 -70
  34. {isgri-0.3.0 → isgri-0.5.0}/.gitignore +0 -0
  35. {isgri-0.3.0 → isgri-0.5.0}/.python-version +0 -0
  36. {isgri-0.3.0 → isgri-0.5.0}/LICENSE +0 -0
  37. {isgri-0.3.0 → isgri-0.5.0}/demo/data/255900280010_isgri_model.fits.gz +0 -0
  38. {isgri-0.3.0 → isgri-0.5.0}/demo/data/isgri_events.fits.gz +0 -0
  39. {isgri-0.3.0 → isgri-0.5.0}/src/isgri/utils/__init__.py +0 -0
  40. {isgri-0.3.0/src/isgri → isgri-0.5.0/tests}/__init__.py +0 -0
  41. {isgri-0.3.0/tests → isgri-0.5.0/tests/utils}/__init__.py +0 -0
  42. {isgri-0.3.0 → isgri-0.5.0}/tests/utils/test_pif.py +0 -0
  43. {isgri-0.3.0 → isgri-0.5.0}/tests/utils/test_time_conversion.py +0 -0
isgri-0.5.0/PKG-INFO ADDED
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.4
2
+ Name: isgri
3
+ Version: 0.5.0
4
+ Summary: Python package for INTEGRAL IBIS/ISGRI lightcurve analysis
5
+ Author: Dominik Patryk Pacholski
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.10
9
+ Requires-Dist: astropy
10
+ Requires-Dist: click
11
+ Requires-Dist: numpy
12
+ Requires-Dist: platformdirs
13
+ Requires-Dist: tomli-w
14
+ Requires-Dist: tomli>=2.0.0; python_version < '3.11'
15
+ Description-Content-Type: text/markdown
16
+
17
+ # ISGRI
18
+
19
+ Python toolkit for INTEGRAL/ISGRI data analysis.
20
+
21
+ ## Features
22
+
23
+ ### Command Line Interface
24
+ Query catalogs directly from the terminal:
25
+ - Filter by time, position, quality, revolution
26
+ - Export results to FITS/CSV
27
+ - List SWIDs for batch processing
28
+
29
+ ### SCW Catalog Query
30
+ Query INTEGRAL Science Window catalogs with a fluent Python API:
31
+ - Filter by time, position, quality, revolution
32
+ - Calculate detector offsets
33
+ - Export results to FITS/CSV
34
+
35
+ ### Light Curve Analysis
36
+ Extract and analyze ISGRI light curves:
37
+ - Event loading with PIF weighting
38
+ - Custom time binning
39
+ - Module-by-module analysis
40
+ - Quality metrics (chi-squared tests)
41
+ - Time conversions (IJD to/from UTC)
42
+
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install isgri
48
+ ```
49
+
50
+ ## Quick Start
51
+
52
+ ### CLI Usage
53
+
54
+ ```bash
55
+ # Configure default paths (once)
56
+ isgri config-set --catalog ~/data/scw_catalog.fits
57
+
58
+ # Query by time range
59
+ isgri query --tstart 2010-01-01 --tstop 2010-12-31
60
+
61
+ # Query Crab with quality cut
62
+ isgri query --ra 83.63 --dec 22.01 --max-chi 2.0 --fov full
63
+
64
+ # Get list of SWIDs for processing
65
+ isgri query --tstart 3000 --tstop 3100 --list-swids > swids.txt
66
+
67
+ # Export results
68
+ isgri query --tstart 3000 --tstop 3100 --output results.fits
69
+ ```
70
+
71
+ ### Query SCW Catalog
72
+
73
+ ```python
74
+ from isgri.catalog import ScwQuery
75
+
76
+ # Load catalog
77
+ cat = ScwQuery("path_to_catalog.fits")
78
+
79
+ # Find Crab observations in 2010 with good quality
80
+ results = (cat
81
+ .time(tstart="2010-01-01", tstop="2010-12-31")
82
+ .quality(max_chi=2.0)
83
+ .position(ra=83.63, dec=22.01, fov_mode="full")
84
+ .get()
85
+ )
86
+
87
+ print(f"Found {len(results)} observations")
88
+ ```
89
+
90
+ ### Analyze Light Curves
91
+
92
+ ```python
93
+ from isgri.utils import LightCurve, QualityMetrics
94
+
95
+ # Load events with PIF weighting
96
+ lc = LightCurve.load_data(
97
+ events_path="isgri_events.fits",
98
+ pif_path="source_model.fits",
99
+ pif_threshold=0.5
100
+ )
101
+
102
+ # Create 1-second binned light curve
103
+ time, counts = lc.rebin(binsize=1.0, emin=20, emax=100)
104
+
105
+ # Compute quality metrics
106
+ qm = QualityMetrics(lc, binsize=1.0, emin=20, emax=100)
107
+ chi = qm.raw_chi_squared()
108
+ print(f"Chisq/dof = {chi:.2f}")
109
+ ```
110
+
111
+ ## Configuration
112
+
113
+ ISGRI stores configuration in default config folder for each system (see: platformdirs package)
114
+
115
+ ```bash
116
+ # View current config
117
+ isgri config
118
+
119
+ # Set paths
120
+ isgri config-set --archive /path/to/archive --catalog /path/to/catalog.fits
121
+ ```
122
+
123
+ Config can also be used in Python:
124
+
125
+ ```python
126
+ from isgri.config import get_config
127
+
128
+ cfg = get_config()
129
+ print(cfg.archive_path)
130
+ print(cfg.catalog_path)
131
+ ```
132
+
133
+ Local config file `isgri_config.toml` in current directory overrides global config.
134
+
135
+
136
+ ## Documentation
137
+
138
+ - **CLI Reference**: Run `isgri --help` or `isgri <command> --help`
139
+ - **Catalog Tutorial**: [scwquery_walkthrough.ipynb](https://github.com/dominp/isgri/blob/main/demo/scwquery_walkthrough.ipynb)
140
+ - **Light Curve Tutorial**: [lightcurve_walkthrough.ipynb](https://github.com/dominp/isgri/blob/main/demo/lightcurve_walkthrough.ipynb)
141
+ - **API Reference**: Use `help()` in Python or see docstrings
142
+
143
+ ## Project Structure
144
+
145
+ ```
146
+ isgri/
147
+ ├── catalog/ # SCW catalog query tools
148
+ │ ├── scwquery.py # Main query interface
149
+ │ └── wcs.py # Coordinate transformations
150
+ ├── utils/ # Light curve analysis utilities
151
+ │ ├── lightcurve.py # Light curve class
152
+ │ ├── quality.py # Quality metrics
153
+ │ ├── pif.py # PIF tools
154
+ │ ├── file_loaders.py
155
+ │ └── time_conversion.py
156
+ ├── config.py # Configuration management
157
+ └── cli.py # Command line interface
158
+ ```
159
+
160
+ ## Requirements
161
+
162
+ - Python ≥ 3.10
163
+ - astropy
164
+ - numpy
isgri-0.5.0/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # ISGRI
2
+
3
+ Python toolkit for INTEGRAL/ISGRI data analysis.
4
+
5
+ ## Features
6
+
7
+ ### Command Line Interface
8
+ Query catalogs directly from the terminal:
9
+ - Filter by time, position, quality, revolution
10
+ - Export results to FITS/CSV
11
+ - List SWIDs for batch processing
12
+
13
+ ### SCW Catalog Query
14
+ Query INTEGRAL Science Window catalogs with a fluent Python API:
15
+ - Filter by time, position, quality, revolution
16
+ - Calculate detector offsets
17
+ - Export results to FITS/CSV
18
+
19
+ ### Light Curve Analysis
20
+ Extract and analyze ISGRI light curves:
21
+ - Event loading with PIF weighting
22
+ - Custom time binning
23
+ - Module-by-module analysis
24
+ - Quality metrics (chi-squared tests)
25
+ - Time conversions (IJD to/from UTC)
26
+
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ pip install isgri
32
+ ```
33
+
34
+ ## Quick Start
35
+
36
+ ### CLI Usage
37
+
38
+ ```bash
39
+ # Configure default paths (once)
40
+ isgri config-set --catalog ~/data/scw_catalog.fits
41
+
42
+ # Query by time range
43
+ isgri query --tstart 2010-01-01 --tstop 2010-12-31
44
+
45
+ # Query Crab with quality cut
46
+ isgri query --ra 83.63 --dec 22.01 --max-chi 2.0 --fov full
47
+
48
+ # Get list of SWIDs for processing
49
+ isgri query --tstart 3000 --tstop 3100 --list-swids > swids.txt
50
+
51
+ # Export results
52
+ isgri query --tstart 3000 --tstop 3100 --output results.fits
53
+ ```
54
+
55
+ ### Query SCW Catalog
56
+
57
+ ```python
58
+ from isgri.catalog import ScwQuery
59
+
60
+ # Load catalog
61
+ cat = ScwQuery("path_to_catalog.fits")
62
+
63
+ # Find Crab observations in 2010 with good quality
64
+ results = (cat
65
+ .time(tstart="2010-01-01", tstop="2010-12-31")
66
+ .quality(max_chi=2.0)
67
+ .position(ra=83.63, dec=22.01, fov_mode="full")
68
+ .get()
69
+ )
70
+
71
+ print(f"Found {len(results)} observations")
72
+ ```
73
+
74
+ ### Analyze Light Curves
75
+
76
+ ```python
77
+ from isgri.utils import LightCurve, QualityMetrics
78
+
79
+ # Load events with PIF weighting
80
+ lc = LightCurve.load_data(
81
+ events_path="isgri_events.fits",
82
+ pif_path="source_model.fits",
83
+ pif_threshold=0.5
84
+ )
85
+
86
+ # Create 1-second binned light curve
87
+ time, counts = lc.rebin(binsize=1.0, emin=20, emax=100)
88
+
89
+ # Compute quality metrics
90
+ qm = QualityMetrics(lc, binsize=1.0, emin=20, emax=100)
91
+ chi = qm.raw_chi_squared()
92
+ print(f"Chisq/dof = {chi:.2f}")
93
+ ```
94
+
95
+ ## Configuration
96
+
97
+ ISGRI stores configuration in default config folder for each system (see: platformdirs package)
98
+
99
+ ```bash
100
+ # View current config
101
+ isgri config
102
+
103
+ # Set paths
104
+ isgri config-set --archive /path/to/archive --catalog /path/to/catalog.fits
105
+ ```
106
+
107
+ Config can also be used in Python:
108
+
109
+ ```python
110
+ from isgri.config import get_config
111
+
112
+ cfg = get_config()
113
+ print(cfg.archive_path)
114
+ print(cfg.catalog_path)
115
+ ```
116
+
117
+ Local config file `isgri_config.toml` in current directory overrides global config.
118
+
119
+
120
+ ## Documentation
121
+
122
+ - **CLI Reference**: Run `isgri --help` or `isgri <command> --help`
123
+ - **Catalog Tutorial**: [scwquery_walkthrough.ipynb](https://github.com/dominp/isgri/blob/main/demo/scwquery_walkthrough.ipynb)
124
+ - **Light Curve Tutorial**: [lightcurve_walkthrough.ipynb](https://github.com/dominp/isgri/blob/main/demo/lightcurve_walkthrough.ipynb)
125
+ - **API Reference**: Use `help()` in Python or see docstrings
126
+
127
+ ## Project Structure
128
+
129
+ ```
130
+ isgri/
131
+ ├── catalog/ # SCW catalog query tools
132
+ │ ├── scwquery.py # Main query interface
133
+ │ └── wcs.py # Coordinate transformations
134
+ ├── utils/ # Light curve analysis utilities
135
+ │ ├── lightcurve.py # Light curve class
136
+ │ ├── quality.py # Quality metrics
137
+ │ ├── pif.py # PIF tools
138
+ │ ├── file_loaders.py
139
+ │ └── time_conversion.py
140
+ ├── config.py # Configuration management
141
+ └── cli.py # Command line interface
142
+ ```
143
+
144
+ ## Requirements
145
+
146
+ - Python ≥ 3.10
147
+ - astropy
148
+ - numpy