isgri 0.6.1__py3-none-any.whl → 0.7.1__py3-none-any.whl

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.
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.4
2
+ Name: isgri
3
+ Version: 0.7.1
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.9
9
+ Requires-Dist: astropy
10
+ Requires-Dist: click
11
+ Requires-Dist: joblib
12
+ Requires-Dist: numpy
13
+ Requires-Dist: platformdirs
14
+ Requires-Dist: tomli-w
15
+ Requires-Dist: tomli>=2.0.0; python_version < '3.11'
16
+ Description-Content-Type: text/markdown
17
+
18
+ # ISGRI
19
+
20
+ Python toolkit for INTEGRAL/ISGRI data analysis.
21
+
22
+ ## Features
23
+
24
+ ### Command Line Interface
25
+ Query catalogs directly from the terminal:
26
+ - Interactive and direct query modes
27
+ - Filter by time, position, quality, revolution
28
+ - Export results to FITS/CSV or SWID lists
29
+ - Update catalogs with new science windows from archive
30
+
31
+ ### SCW Catalog Query
32
+ Query INTEGRAL Science Window catalogs with a fluent Python API:
33
+ - Filter by time, position, quality, revolution
34
+ - Calculate detector offsets
35
+ - Export results to any auto detectable astropy table extension or in table aligned data for any other extension
36
+
37
+ ### Catalog Builder
38
+ Build and update INTEGRAL/ISGRI science window catalogs:
39
+ - Automatic discovery of new science windows in archive
40
+ - Parallel processing of quality metrics
41
+ - Optional light curve caching
42
+ - Incremental catalog updates
43
+
44
+ ### Light Curve Analysis
45
+ Extract and analyze ISGRI light curves:
46
+ - Load from file paths or SWID/source lookup
47
+ - PIF weighting with adjustable thresholds
48
+ - Custom time binning
49
+ - Module-by-module analysis
50
+ - Quality metrics (chi-squared tests)
51
+ - Time conversions (IJD to/from UTC)
52
+
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install isgri
58
+ ```
59
+
60
+ ## Quick Start
61
+
62
+ ### CLI Usage
63
+
64
+ ```bash
65
+ # Configure default paths (once)
66
+ isgri config-set --archive /path/to/archive --catalog ~/data/scw_catalog.fits --pif /path/to/pif
67
+
68
+ # View current config
69
+ isgri config
70
+
71
+ # Update catalog from archive
72
+ isgri update
73
+
74
+ # Interactive catalog query
75
+ isgri query
76
+ # query> time
77
+ # Start: 2010-01-01
78
+ # Stop: 2010-12-31
79
+ # → 1234 SCWs
80
+ # query> pos
81
+ # RA: 83.63
82
+ # Dec: 22.01
83
+ # ...
84
+
85
+ # Direct catalog query
86
+ isgri query --tstart 2010-01-01 --tstop 2010-12-31 --ra 83.63 --dec 22.01 --max-chi 2.0
87
+
88
+ # Get SWID list for batch processing
89
+ isgri query --tstart 3000 --tstop 3100 --list-swids > swids.txt
90
+
91
+ # Export results
92
+ isgri query --tstart 3000 --tstop 3100 --output results.fits
93
+ ```
94
+
95
+ ### Query SCW Catalog
96
+
97
+ ```python
98
+ from isgri.catalog import ScwQuery
99
+
100
+ # Load catalog
101
+ cat = ScwQuery("path_to_catalog.fits")
102
+
103
+ # Find Crab observations in 2010 with good quality
104
+ results = (cat
105
+ .time(tstart="2010-01-01", tstop="2010-12-31")
106
+ .quality(max_chi=2.0)
107
+ .position(ra=83.63, dec=22.01, fov_mode="full")
108
+ .get()
109
+ )
110
+
111
+ # Filter by revolution(s)
112
+ results = cat.revolution([1000, 1001, 1002]).get()
113
+
114
+ # Save selected columns
115
+ cat.write('results.fits', columns=['SWID', 'TSTART', 'TSTOP'])
116
+
117
+ # Get SWID list
118
+ swids = cat.get_swids()
119
+
120
+ print(f"Found {len(results)} observations")
121
+ ```
122
+
123
+ ### Build/Update SCW Catalog
124
+
125
+ #### Command Line
126
+
127
+ ```bash
128
+ # Update catalog using configured paths
129
+ isgri update
130
+
131
+ # Update with custom paths
132
+ isgri update --archive /anita/archivio/ --catalog ~/data/catalog.fits
133
+
134
+ # Enable light curve caching (15-1000 keV, 1s bins)
135
+ isgri update --cache ~/data/lightcurves/
136
+
137
+ # Limit CPU cores for parallel processing
138
+ isgri update --cores 4
139
+ ```
140
+
141
+ #### Python API
142
+
143
+ ```python
144
+ from isgri.catalog import CatalogBuilder
145
+
146
+ # Create builder instance
147
+ builder = CatalogBuilder(
148
+ archive_path="/path/to/archive",
149
+ catalog_path="scw_catalog.fits",
150
+ lightcurve_cache="/path/to/cache", # optional
151
+ n_cores=8
152
+ )
153
+
154
+ # Update catalog with new science windows
155
+ builder.update_catalog()
156
+
157
+ # Find all science windows in archive
158
+ swids, paths = builder.find_scws()
159
+ print(f"Found {len(swids)} science windows")
160
+ ```
161
+
162
+ The builder:
163
+ - Scans archive for new ScWs not in catalog
164
+ - Computes quality metrics (raw, sigma-clipped, GTI-filtered chi-squared)
165
+ - Processes in parallel by revolution
166
+ - Optionally caches 1s light curves (15-1000 keV)
167
+
168
+ ### Analyze Light Curves
169
+
170
+ ```python
171
+ from isgri.utils import LightCurve, QualityMetrics
172
+
173
+ # Method 1: Load from file paths
174
+ lc = LightCurve.load_data(
175
+ events_path="isgri_events.fits",
176
+ pif_path="source_model.fits",
177
+ use_pif=True,
178
+ pif_threshold=0.5
179
+ )
180
+
181
+ # Method 2: Load by SWID (requires config)
182
+ lc = LightCurve.load_data(swid="255900280010")
183
+
184
+ # Method 3: Load by SWID + source (auto-finds PIF)
185
+ lc = LightCurve.load_data(
186
+ swid="255900280010",
187
+ source="SGR1935",
188
+ use_pif=True,
189
+ pif_threshold=0.5
190
+ )
191
+
192
+ # Create binned lightcurve
193
+ time, counts = lc.rebin(binsize=1.0, emin=30, emax=100)
194
+
195
+ # Override PIF settings temporarily
196
+ time, counts = lc.rebin(binsize=1.0, emin=30, emax=100, use_pif=True, pif_threshold=0.8)
197
+
198
+ # Or change instance settings
199
+ lc.pif_threshold = 0.7
200
+ lc.use_pif = True
201
+ time, counts = lc.rebin(binsize=1.0, emin=30, emax=100)
202
+
203
+ # Module-by-module analysis
204
+ times, module_counts = lc.rebin_by_modules(binsize=1.0, emin=30, emax=300)
205
+
206
+ # Quality metrics
207
+ qm = QualityMetrics(lc, binsize=1.0, emin=30, emax=100)
208
+ chi_raw = qm.raw_chi_squared()
209
+ chi_clipped = qm.sigma_clip_chi_squared(sigma=1)
210
+ chi_gti = qm.gti_chi_squared()
211
+ print(f"Chisq/dof = {chi_raw:.2f}")
212
+
213
+ # Time conversions
214
+ from isgri.utils.time_conversion import ijd2utc, utc2ijd
215
+ print(f"Start time: {ijd2utc(lc.t0)}")
216
+ ```
217
+
218
+ ## Configuration
219
+
220
+ ISGRI stores configuration in default config folder for each system (see: platformdirs package)
221
+
222
+ ```bash
223
+ # View current config
224
+ isgri config
225
+
226
+ # Set paths
227
+ isgri config-set --archive /path/to/archive
228
+ isgri config-set --catalog /path/to/catalog.fits
229
+ isgri config-set --pif /path/to/pif
230
+
231
+ # Set all at once
232
+ isgri config-set --archive /path/to/archive --catalog /path/to/catalog.fits --pif /path/to/pif
233
+ ```
234
+
235
+ Config in Python:
236
+
237
+ ```python
238
+ from isgri.config import Config
239
+
240
+ cfg = Config()
241
+ print(cfg.archive_path)
242
+ print(cfg.catalog_path)
243
+ print(cfg.pif_path)
244
+
245
+ # Create new config programmatically
246
+ cfg.create_new(
247
+ archive_path="/path/to/archive",
248
+ catalog_path="/path/to/catalog.fits",
249
+ pif_path="/path/to/pif"
250
+ )
251
+ ```
252
+
253
+ Local config file `isgri_config.toml` in current directory overrides global config.
254
+
255
+
256
+ ## Documentation
257
+
258
+ - **CLI Reference**: Run `isgri --help` or `isgri <command> --help`
259
+ - **Catalog Tutorial**: [scwquery_walkthrough.ipynb](https://github.com/dominp/isgri/blob/main/demo/scwquery_walkthrough.ipynb)
260
+ - **Light Curve Tutorial**: [lightcurve_walkthrough.ipynb](https://github.com/dominp/isgri/blob/main/demo/lightcurve_walkthrough.ipynb)
261
+ - **API Reference**: Use `help()` in Python or see docstrings
262
+
263
+
264
+ ## License
265
+
266
+ MIT
@@ -0,0 +1,22 @@
1
+ isgri/__init__.py,sha256=V2hnOxXKcjMiusdGP8sOAR4QsBlWHQ0pZZMN2Cean6o,38
2
+ isgri/__version__.py,sha256=tUukPDbH9wVBvn9_DYqm0p_Q7TagQGM_2ZX042hSuUs,21
3
+ isgri/config.py,sha256=8hziHnQN_dnS3FkOtrPUUV1QLJ9HmGiPzDuAiq3GoXc,5044
4
+ isgri/catalog/__init__.py,sha256=IGfzGcGx1F1zplj7YIUuzE5Cvvxg7XJi0zu0aBXI0-A,113
5
+ isgri/catalog/builder.py,sha256=J1Z_p699hoQtiQjYw5-jvf0aSIIOcpe8djbCjh-NOng,15779
6
+ isgri/catalog/scwquery.py,sha256=v7nR6-6PmYaBunFeGtmDWPqDkUBUvwjv2jtM1RbGQx4,20397
7
+ isgri/catalog/wcs.py,sha256=mD6bZxiBxKYpuYCl8f2tSCc8uuWFzMRL2jf5SuFAhfg,5562
8
+ isgri/cli/__init__.py,sha256=SCIcTdOvfEkrZd1doOtOnvCj8PmdRuXu18YYJQxfFrs,24
9
+ isgri/cli/builder.py,sha256=dCp9ECl9MoThTRXAkXXazafHYSMQF0FLHKDzlWwT7vE,3494
10
+ isgri/cli/main.py,sha256=SQxx1NdYQ7WjLINgvtyO4-rPdcVLhXnixU00pDqgVg8,6436
11
+ isgri/cli/query.py,sha256=jIAJ8Ghr73OivSIqTjqYE-y-gn9hw4-QpEeH-z6Bny0,8012
12
+ isgri/utils/__init__.py,sha256=H83Al7urc6LNW5KUzUBRdtRBUTahiZmkehKFiK90RrU,183
13
+ isgri/utils/file_loaders.py,sha256=E4-0QA6r1QAX1gV1Dd5qhKPDXZIdSEk7AWdOQrovHGo,17423
14
+ isgri/utils/lightcurve.py,sha256=v_JNLzf1SBvFLzrU7ZXpSj44eRKaZChiO4gvS2_O35Y,17408
15
+ isgri/utils/pif.py,sha256=sAtzQhe3spLS41UkP1yZsqGPxe3IHLmIGA_d3bVg2v4,9121
16
+ isgri/utils/quality.py,sha256=7CbYaNstoX60AYz2_ym-xjMkiDLpkYgQfaTStYuQZtk,13409
17
+ isgri/utils/time_conversion.py,sha256=MNPVjrsrmwRDbCWmqdWN0xRs8PtHkFGli-H2cYwF9Ns,5204
18
+ isgri-0.7.1.dist-info/METADATA,sha256=1Wi7eyxKCtpzFek7iCRLI_JaQqsiPiEdxRWZiOQeF_o,6499
19
+ isgri-0.7.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
+ isgri-0.7.1.dist-info/entry_points.txt,sha256=aM2K4RGihbwsj9crjPG-BvWhErcdtZt3tJqT6AaOojU,46
21
+ isgri-0.7.1.dist-info/licenses/LICENSE,sha256=Q8oxmHR1cSnEXSHCjY3qeXMtupZI_1ZQZ1MBt4oeANE,1102
22
+ isgri-0.7.1.dist-info/RECORD,,
@@ -1,147 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: isgri
3
- Version: 0.6.1
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.9
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 any auto detectable astropy table extension or in table aligned data for any other extension.
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
- # Interactive method
59
- isgri query
60
-
61
- # Query by time range
62
- isgri query --tstart 2010-01-01 --tstop 2010-12-31
63
-
64
- # Query Crab with quality cut
65
- isgri query --ra 83.63 --dec 22.01 --max-chi 2.0 --fov full
66
-
67
- # Get list of SWIDs for processing
68
- isgri query --tstart 3000 --tstop 3100 --list-swids > swids.txt
69
-
70
- # Export results
71
- isgri query --tstart 3000 --tstop 3100 --output results.fits
72
- ```
73
-
74
- ### Query SCW Catalog
75
-
76
- ```python
77
- from isgri.catalog import ScwQuery
78
-
79
- # Load catalog
80
- cat = ScwQuery("path_to_catalog.fits")
81
-
82
- # Find Crab observations in 2010 with good quality
83
- results = (cat
84
- .time(tstart="2010-01-01", tstop="2010-12-31")
85
- .quality(max_chi=2.0)
86
- .position(ra=83.63, dec=22.01, fov_mode="full")
87
- .get()
88
- )
89
-
90
- # Save selected columns to the file
91
- cat.write('example_file.any_extension',columns=['SWID','TSTART','TSTOP'])
92
-
93
- print(f"Found {len(results)} observations")
94
- ```
95
-
96
- ### Analyze Light Curves
97
-
98
- ```python
99
- from isgri.utils import LightCurve, QualityMetrics
100
-
101
- # Load events with PIF weighting
102
- lc = LightCurve.load_data(
103
- events_path="isgri_events.fits",
104
- pif_path="source_model.fits",
105
- pif_threshold=0.5
106
- )
107
-
108
- # Create 1-second binned light curve
109
- time, counts = lc.rebin(binsize=1.0, emin=20, emax=100)
110
-
111
- # Compute quality metrics
112
- qm = QualityMetrics(lc, binsize=1.0, emin=20, emax=100)
113
- chi = qm.raw_chi_squared()
114
- print(f"Chisq/dof = {chi:.2f}")
115
- ```
116
-
117
- ## Configuration
118
-
119
- ISGRI stores configuration in default config folder for each system (see: platformdirs package)
120
-
121
- ```bash
122
- # View current config
123
- isgri config
124
-
125
- # Set paths
126
- isgri config-set --archive /path/to/archive --catalog /path/to/catalog.fits
127
- ```
128
-
129
- Config can also be used in Python:
130
-
131
- ```python
132
- from isgri.config import get_config
133
-
134
- cfg = get_config()
135
- print(cfg.archive_path)
136
- print(cfg.catalog_path)
137
- ```
138
-
139
- Local config file `isgri_config.toml` in current directory overrides global config.
140
-
141
-
142
- ## Documentation
143
-
144
- - **CLI Reference**: Run `isgri --help` or `isgri <command> --help`
145
- - **Catalog Tutorial**: [scwquery_walkthrough.ipynb](https://github.com/dominp/isgri/blob/main/demo/scwquery_walkthrough.ipynb)
146
- - **Light Curve Tutorial**: [lightcurve_walkthrough.ipynb](https://github.com/dominp/isgri/blob/main/demo/lightcurve_walkthrough.ipynb)
147
- - **API Reference**: Use `help()` in Python or see docstrings
@@ -1,21 +0,0 @@
1
- isgri/__init__.py,sha256=V2hnOxXKcjMiusdGP8sOAR4QsBlWHQ0pZZMN2Cean6o,38
2
- isgri/__version__.py,sha256=XvHFZM0padtrqitt9-p2enlBUGqc6vGvWNLx2iJv09g,21
3
- isgri/config.py,sha256=i1ibczZsmgqELv4ik2h2nWLnHyl68_5KGsz5Ec8Uf4E,4365
4
- isgri/catalog/__init__.py,sha256=CT9Zd1WISpv7kowf3bqagKewZ8SjLr1rZzVSFkwEj3o,58
5
- isgri/catalog/builder.py,sha256=Ure_erpyApjSiAmIvhJahuf6c11VNXBn5R6-nQzsDw4,3488
6
- isgri/catalog/scwquery.py,sha256=3X9Es79UNGedhsS7EvArNGo8KMAMuUU9hMQIsrfRuBs,20259
7
- isgri/catalog/wcs.py,sha256=mD6bZxiBxKYpuYCl8f2tSCc8uuWFzMRL2jf5SuFAhfg,5562
8
- isgri/cli/__init__.py,sha256=-bBNFYOq80A2Egtpo5V5zWJtYOxQfRZFQ_feve5lkFU,23
9
- isgri/cli/main.py,sha256=pOwTbJ7nuOC48cdVm-e84GGjlOFic1ZMEvU2e3yKP4k,5613
10
- isgri/cli/query.py,sha256=dUzLsEjjyzCQ1lbG3pVe0pvIWcDcNs-6T57ugUFUTdk,5542
11
- isgri/utils/__init__.py,sha256=H83Al7urc6LNW5KUzUBRdtRBUTahiZmkehKFiK90RrU,183
12
- isgri/utils/file_loaders.py,sha256=g-LUfYw35hPePlFeicymaL-NbZXzZWfNmM127XJjCKY,12497
13
- isgri/utils/lightcurve.py,sha256=Pjys-eIyKShDKHqFpGa9SZ0Dzz7LiLIwBpUkp_6s41g,14133
14
- isgri/utils/pif.py,sha256=LixlkShy1j_ymfdJLyCV8zl0EeHgfVDVjddSex18GLQ,8648
15
- isgri/utils/quality.py,sha256=Na-sNEX1E4xWQJx0FYe9vbOAgPrTcLohHeUAnmlKYSw,13348
16
- isgri/utils/time_conversion.py,sha256=MNPVjrsrmwRDbCWmqdWN0xRs8PtHkFGli-H2cYwF9Ns,5204
17
- isgri-0.6.1.dist-info/METADATA,sha256=89GNYk4YvwD6xxSHjFyZJbF9ZquuuSFND7jWj-DKu_k,3613
18
- isgri-0.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
19
- isgri-0.6.1.dist-info/entry_points.txt,sha256=aM2K4RGihbwsj9crjPG-BvWhErcdtZt3tJqT6AaOojU,46
20
- isgri-0.6.1.dist-info/licenses/LICENSE,sha256=Q8oxmHR1cSnEXSHCjY3qeXMtupZI_1ZQZ1MBt4oeANE,1102
21
- isgri-0.6.1.dist-info/RECORD,,
File without changes