jaxspec 0.0.2__tar.gz → 0.0.4__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 (44) hide show
  1. {jaxspec-0.0.2 → jaxspec-0.0.4}/PKG-INFO +8 -4
  2. {jaxspec-0.0.2 → jaxspec-0.0.4}/README.md +2 -0
  3. {jaxspec-0.0.2 → jaxspec-0.0.4}/pyproject.toml +8 -6
  4. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/analysis/results.py +1 -1
  5. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/__init__.py +3 -0
  6. jaxspec-0.0.4/src/jaxspec/data/example_data/fakeit.pha +335 -1
  7. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/instrument.py +14 -9
  8. jaxspec-0.0.4/src/jaxspec/data/obsconf.py +188 -0
  9. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/observation.py +45 -18
  10. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/ogip.py +100 -40
  11. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/util.py +51 -47
  12. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/fit.py +19 -9
  13. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/model/abc.py +29 -6
  14. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/model/additive.py +87 -22
  15. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/model/background.py +5 -5
  16. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/model/multiplicative.py +56 -15
  17. jaxspec-0.0.2/src/jaxspec/data/obsconf.py +0 -130
  18. {jaxspec-0.0.2 → jaxspec-0.0.4}/LICENSE.md +0 -0
  19. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/__init__.py +0 -0
  20. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/analysis/__init__.py +0 -0
  21. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/analysis/compare.py +0 -0
  22. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/MOS1.arf +0 -0
  23. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/MOS1.pha +0 -0
  24. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/MOS1.rmf +0 -0
  25. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/MOS1_spectrum_grp.fits +0 -0
  26. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/MOS1background_spectrum.fits +0 -0
  27. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/MOS2.arf +0 -0
  28. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/MOS2.pha +0 -0
  29. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/MOS2.rmf +0 -0
  30. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/MOS2_spectrum_grp.fits +0 -0
  31. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/MOS2background_spectrum.fits +0 -0
  32. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/PN.arf +0 -0
  33. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/PN.pha +0 -0
  34. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/PN.rmf +0 -0
  35. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/PN_spectrum_grp20.fits +0 -0
  36. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/example_data/PNbackground_spectrum.fits +0 -0
  37. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/data/grouping.py +0 -0
  38. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/model/__init__.py +0 -0
  39. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/model/list.py +0 -0
  40. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/tables/xsect_phabs_aspl.fits +0 -0
  41. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/tables/xsect_tbabs_wilm.fits +0 -0
  42. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/tables/xsect_wabs_angr.fits +0 -0
  43. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/util/__init__.py +0 -0
  44. {jaxspec-0.0.2 → jaxspec-0.0.4}/src/jaxspec/util/integrate.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jaxspec
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: jaxspec is a bayesian spectral fitting library for X-ray astronomy.
5
5
  License: MIT
6
6
  Author: sdupourque
@@ -10,11 +10,11 @@ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
- Requires-Dist: arviz (>=0.17.0,<0.18.0)
13
+ Requires-Dist: arviz (>=0.17.1,<0.18.0)
14
14
  Requires-Dist: astropy (>=6.0.0,<7.0.0)
15
15
  Requires-Dist: chainconsumer (>=1.0.0,<2.0.0)
16
16
  Requires-Dist: cmasher (>=1.6.3,<2.0.0)
17
- Requires-Dist: dm-haiku (>=0.0.11,<0.0.12)
17
+ Requires-Dist: dm-haiku (>=0.0.11,<0.0.13)
18
18
  Requires-Dist: gpjax (>=0.8.0,<0.9.0)
19
19
  Requires-Dist: jax (>=0.4.23,<0.5.0)
20
20
  Requires-Dist: jaxlib (>=0.4.23,<0.5.0)
@@ -23,15 +23,19 @@ Requires-Dist: matplotlib (>=3.8.0,<4.0.0)
23
23
  Requires-Dist: mkdocstrings (>=0.24.0,<0.25.0)
24
24
  Requires-Dist: networkx (>=3.1,<4.0)
25
25
  Requires-Dist: numpy (>=1.26.1,<2.0.0)
26
- Requires-Dist: numpyro (>=0.13.2,<0.14.0)
26
+ Requires-Dist: numpyro (>=0.13.2,<0.15.0)
27
27
  Requires-Dist: pandas (>=2.2.0,<3.0.0)
28
+ Requires-Dist: scipy (<1.13)
28
29
  Requires-Dist: seaborn (>=0.13.1,<0.14.0)
29
30
  Requires-Dist: simpleeval (>=0.9.13,<0.10.0)
31
+ Requires-Dist: sparse (>=0.15.1,<0.16.0)
30
32
  Requires-Dist: tinygp (>=0.3.0,<0.4.0)
31
33
  Description-Content-Type: text/markdown
32
34
 
33
35
  # jaxspec
34
36
 
37
+ [![PyPI - Version](https://img.shields.io/pypi/v/jaxspec?style=for-the-badge&logo=pypi&color=rgb(37%2C%20150%2C%20190))](https://pypi.org/project/jaxspec/)
38
+ [![Python package](https://img.shields.io/pypi/pyversions/jaxspec?style=for-the-badge)](https://pypi.org/project/jaxspec/)
35
39
  [![Read the Docs](https://img.shields.io/readthedocs/jaxspec?style=for-the-badge)](https://jaxspec.readthedocs.io/en/latest/)
36
40
  [![Codecov](https://img.shields.io/codecov/c/github/renecotyfanboy/jaxspec?style=for-the-badge)](https://app.codecov.io/gh/renecotyfanboy/jaxspec)
37
41
  [![Slack](https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white)](https://join.slack.com/t/jaxspec/shared_invite/zt-2cuxkdl2f-t0EEAKP~HBEHKvIUZJL2sg)
@@ -1,5 +1,7 @@
1
1
  # jaxspec
2
2
 
3
+ [![PyPI - Version](https://img.shields.io/pypi/v/jaxspec?style=for-the-badge&logo=pypi&color=rgb(37%2C%20150%2C%20190))](https://pypi.org/project/jaxspec/)
4
+ [![Python package](https://img.shields.io/pypi/pyversions/jaxspec?style=for-the-badge)](https://pypi.org/project/jaxspec/)
3
5
  [![Read the Docs](https://img.shields.io/readthedocs/jaxspec?style=for-the-badge)](https://jaxspec.readthedocs.io/en/latest/)
4
6
  [![Codecov](https://img.shields.io/codecov/c/github/renecotyfanboy/jaxspec?style=for-the-badge)](https://app.codecov.io/gh/renecotyfanboy/jaxspec)
5
7
  [![Slack](https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white)](https://join.slack.com/t/jaxspec/shared_invite/zt-2cuxkdl2f-t0EEAKP~HBEHKvIUZJL2sg)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "jaxspec"
3
- version = "0.0.2"
3
+ version = "0.0.4"
4
4
  description = "jaxspec is a bayesian spectral fitting library for X-ray astronomy."
5
5
  authors = ["sdupourque <sdupourque@irap.omp.eu>"]
6
6
  license = "MIT"
@@ -13,11 +13,11 @@ jaxlib = "^0.4.23"
13
13
  numpy = "^1.26.1"
14
14
  pandas = "^2.2.0"
15
15
  astropy = "^6.0.0"
16
- numpyro = "^0.13.2"
17
- dm-haiku = "^0.0.11"
16
+ numpyro = ">=0.13.2,<0.15.0"
17
+ dm-haiku = ">=0.0.11,<0.0.13"
18
18
  networkx = "^3.1"
19
19
  matplotlib = "^3.8.0"
20
- arviz = "^0.17.0"
20
+ arviz = "^0.17.1"
21
21
  chainconsumer = "^1.0.0"
22
22
  simpleeval = "^0.9.13"
23
23
  cmasher = "^1.6.3"
@@ -26,6 +26,8 @@ jaxopt = "^0.8.1"
26
26
  tinygp = "^0.3.0"
27
27
  seaborn = "^0.13.1"
28
28
  mkdocstrings = "^0.24.0"
29
+ sparse = "^0.15.1"
30
+ scipy = "<1.13"
29
31
 
30
32
 
31
33
  [tool.poetry.group.docs.dependencies]
@@ -39,7 +41,7 @@ mkdocs-jupyter = "^0.24.6"
39
41
  chex = "^0.1.83"
40
42
  mktestdocs = "^0.2.1"
41
43
  coverage = "^7.3.2"
42
- pytest-cov = "^4.1.0"
44
+ pytest-cov = ">=4.1,<6.0"
43
45
  flake8 = "^7.0.0"
44
46
  pytest = "^8.0.0"
45
47
  testbook = "^0.4.2"
@@ -47,7 +49,7 @@ testbook = "^0.4.2"
47
49
 
48
50
  [tool.poetry.group.dev.dependencies]
49
51
  pre-commit = "^3.5.0"
50
- ruff = "^0.2.1"
52
+ ruff = ">=0.2.1,<0.4.0"
51
53
  jupyterlab = "^4.0.7"
52
54
  notebook = "^7.0.6"
53
55
  ipywidgets = "^8.1.1"
@@ -343,7 +343,7 @@ class ChainResult:
343
343
  folding_model.out_energies,
344
344
  y_observed=folding_model.folded_background.data,
345
345
  y_samples=bkg_count,
346
- denominator=denominator / folding_model.backratio.data,
346
+ denominator=denominator * folding_model.folded_backratio.data,
347
347
  color=(0.26787604, 0.60085972, 0.63302651),
348
348
  percentile=percentile,
349
349
  )
@@ -5,3 +5,6 @@ from .observation import Observation # noqa: F401
5
5
  import astropy.units as u
6
6
 
7
7
  u.add_enabled_aliases({"counts": u.count})
8
+ u.add_enabled_aliases({"channel": u.dimensionless_unscaled})
9
+ # Arbitrary units are found in .rsp files , let's hope it is compatible with what we would expect as the rmf x arf
10
+ # u.add_enabled_aliases({"au": u.dimensionless_unscaled})
@@ -0,0 +1,334 @@
1
+ SIMPLE = T / file does conform to FITS standard BITPIX = 8 / number of bits per data pixel NAXIS = 0 / number of data axes EXTEND = T / FITS dataset may contain extensions COMMENT FITS (Flexible Image Transport System) format is defined in 'AstronomyCOMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H END XTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / 8-bit bytes NAXIS = 2 / 2-dimensional binary table NAXIS1 = 12 / width of table in bytes NAXIS2 = 4096 / number of rows in table PCOUNT = 0 / size of special data area GCOUNT = 1 / one data group (required keyword) TFIELDS = 4 / number of fields in each row TTYPE1 = 'CHANNEL ' / label for field 1 TFORM1 = 'J ' / data format of field: 4-byte INTEGER TTYPE2 = 'COUNTS ' / label for field 2 TFORM2 = 'J ' / data format of field: 4-byte INTEGER TTYPE3 = 'QUALITY ' / label for field 3 TFORM3 = 'I ' / data format of field: 2-byte INTEGER TTYPE4 = 'GROUPING' / label for field 4 TFORM4 = 'I ' / data format of field: 2-byte INTEGER EXTNAME = 'SPECTRUM' / name of this binary table extension HDUCLASS= 'OGIP ' / format conforms to OGIP standard HDUCLAS1= 'SPECTRUM' / PHA dataset (OGIP memo OGIP-92-007) HDUVERS = '1.2.1 ' / Version of format (OGIP memo OGIP-92-007a) TELESCOP= 'XMM ' / mission/satellite name INSTRUME= 'EPN ' / instrument name DETNAM = 'UNKNOWN ' / detector name FILTER = 'Medium ' / filter name STOKESPR= 'UNKNOWN ' / Stokes parameter(s) STOKESWT= 'UNKNOWN ' / Stokes weighting CHANTYPE= 'PI ' / channel type (PHA, PI etc) DATE = '2024-03-20T11:51:55' / file creation date (YYYY-MM-DDThh:mm:ss UT) HISTORY Fake data file created by XSPEC version: 12.13.1 "fakeit" command FKSRC001= 'cutoffpl' FKRSP001= 'PN.rmf ' FKARF001= 'PN.arf ' RESPFILE= 'PN.rmf ' / associated redistrib matrix filename ANCRFILE= 'PN.arf ' / associated ancillary response filename CORRFILE= ' ' / associated correction filename CORRSCAL= 1. / correction file scaling factor BACKFILE= ' ' / associated background filename EXPOSURE= 10000. / exposure (in seconds) TLMIN1 = 0 / Lowest legal channel number TLMAX1 = 4095 / Highest legal channel number DETCHANS= 4096 / total number possible channels POISSERR= T / Pois. err assumed ? AREASCAL= 1. / area scaling factor BACKSCAL= 1. / background file scaling factor END �!�x��� ��a��$8 0�
2
+ ;{ D- L�
3
+ �����������8������<��H�����������~�������#��|�����n�����������������/�������X��"��_��i��-�� �����Z��������������������N�����q��<�����q��������������_��������������������A�����������a��������Y��2�����n�����d��������!���?�_�` ��
4
+ �� �+ �+
5
+ &�'��(��)��*�+�<,�-�Q.��/��0��1�02�3�4�^5��6�[7�8�(9�a:�H;~�<�=~>}??|c@|A|8B{�C{mDy�E{�F{HGyHymIy�JxtKy�Ly Mx�Nw�Ow�PxRQw�RxSvTv�UvtVu�WuXXv4Yu�ZuY[u�\u�]t�^t�_t,`s�ar�bqNcr�drBeq�fp�gpxhn�im�jm�kk�ll�mk�ni
6
+ oipg�qgUre�sd�tc�ub�v`�wa�x`�y`Oz^�{]�|]�}] ~]_\��[��]�\(�[��[F�Z��[�Z��Zn�ZH�Y��Y��X��YK�Y.�W��X�V��W��X�WN�X��W`�U��U��U��V�V&�U�T��T��T��Ty�T0�S�S�Sl�R'�R*�R��QZ�Q3�QA�P}�O��O��N��NR�L��L��K��K}�JN�I��H+�G,�F=�EI�E��D��C)�B,�Ap�@��?Z�=��=��<L�:��:X�9(�9 �7t�7��5�6��4��4#�3��3b�2{�2��2$�1��1q�0�/��/��0M�/��/|�0n�/��/��/��/5�/��/�.��/x�0,�0 �/�/��.��/��/D�.��/5�.��0�.��0,�/I�/e�/�/2�/d�/
7
+ .4 -� -�
8
+ � ��!
9
+ �!� �� �� �� �� ���� 1� �� >� x� � � u� �� 9� A� *� /��� �� �T� � �����_�v���i�q���n�v���'���:�'��������&��}�lm����Z �
10
+ . d �
11
+ I � �
12
+ !  
13
+ �q 3r
14
+ �s t u
15
+ �v w
16
+ �x $y z
17
+ �{
18
+ �|
19
+ �} (~
20
+ o
21
+ ��
22
+ f�
23
+ ��
24
+ ��
25
+ ��
26
+ �� �
27
+ ��
28
+ ��
29
+ Y�
30
+ ��
31
+ x�
32
+ t�
33
+ ,�
34
+ i�
35
+ H�
36
+ +�
37
+ ��
38
+ b�
39
+ u�
40
+ �
41
+ n�
42
+ *�
43
+ � ��
44
+ h�
45
+ � ��
46
+ �
47
+ �
48
+ � �� �� �� �� �� �� �� ��
49
+ "� �� W� �� �� �� �� `� l� 1� o� N� x� g� � I� i� C� 5� � �� =� <� j� %� i��� D� M� 1� <��� F������� L��������� ��� �[�x�����U���v���������=���p�I�]�0����:�}�������D���D�(� ���E����p�������"�����|���������������}� �
50
+ � D �
51
+ 0�1�2�3�4 5�6�7�8�9�:�;�<�=�>S?~@�A�B�C�DpE]FLGVHvI"JsK�L�MZN�O�P.Q_R'SST�UxVWX�YWZ�[�\R]�^�_R`9ab!c d�e�f�g�h�i�j�k:lm�n�o�p�q�r�s�t�u�v�w�x�y�z�{�|�}�~�����������~���g�������F�I�^�p�i�V�R�\�s�U�*�E�v�1�p� �=���E�����=���#����������8�'�.�M�������������������������� �����������������������������h�������������������o�u�r�p���S�w�9�j�G�i��������!��R����T��Z�7�>�-�i� �5�����+�
52
+ ��S���.�����;�360�� �
53
+ �  �
54
+ � � �
55
+ � � �
56
+ *
57
+ +
58
+ -
59
+ +
60
+ &
61
+ 3
62
+ '
63
+ &
64
+ 1
65
+ -
66
+
67
+ 1
68
+ &
69
+ -
70
+
71
+ !
72
+  
73
+ *
74
+ 
75
+ *
76
+ 
77
+ ,
78
+ '
79
+ ,
80
+ !
81
+ "
82
+ 1
83
+ (
84
+ )
85
+ *
86
+ %
87
+ '
88
+ /
89
+ 
90
+ !,
91
+ ",
92
+ #0
93
+ $)
94
+ %#
95
+ &
96
+ '
97
+ (,
98
+ )
99
+ *
100
+ +,
101
+ ,
102
+ -'
103
+ .
104
+ /!
105
+ 0
106
+ 1&
107
+ 2 
108
+ 3
109
+ 4%
110
+ 5
111
+ 6#
112
+ 7
113
+ 8
114
+ 9&
115
+ :
116
+ ;
117
+ <
118
+ =
119
+ >%
120
+ ?/
121
+ @
122
+ A"
123
+ B'
124
+ C'
125
+ D%
126
+ E
127
+ F
128
+ G
129
+ H(
130
+ I
131
+ J#
132
+ K
133
+ L
134
+ M-
135
+ N
136
+ O#
137
+ P
138
+ Q
139
+ R
140
+ S!
141
+ T
142
+ U
143
+ V%
144
+ W
145
+ X"
146
+ Y
147
+ Z
148
+ [
149
+ \
150
+ ]
151
+ ^
152
+ _
153
+ `
154
+ a 
155
+ b
156
+ c
157
+ d
158
+ e
159
+ f
160
+ g
161
+ h
162
+ i
163
+ j
164
+ k
165
+ l
166
+ m
167
+ n
168
+ o
169
+ p 
170
+ q
171
+ r
172
+ s
173
+ t
174
+ u
175
+ v
176
+ w
177
+ x
178
+ y
179
+ z
180
+ {
181
+ |
182
+ }
183
+ ~
184
+ 
185
+ �
186
+ �
187
+ �
188
+ �
189
+ �
190
+ �
191
+ �
192
+ �
193
+ �
194
+ �
195
+ �
196
+ �
197
+ �
198
+ �
199
+ �
200
+ �
201
+ �
202
+ �
203
+ �
204
+ �
205
+ �
206
+
207
+ �
208
+ �
209
+ �
210
+
211
+ �
212
+ �
213
+ �
214
+ �
215
+ �
216
+
217
+ �
218
+
219
+ �
220
+ �
221
+ � 
222
+ �
223
+ � 
224
+ �
225
+ �
226
+ �
227
+ �
228
+
229
+ �
230
+ �
231
+ �
232
+
233
+ �
234
+
235
+ 
236
+ � 
237
+ �
238
+ � 
239
+ �
240
+ �
241
+ � 
242
+ �
243
+ �
244
+ � 
245
+ � 
246
+
247
+ �
248
+ �
249
+ �
250
+ � 
251
+ �
252
+ �
253
+ �
254
+ �
255
+ �
256
+
257
+ 
258
+ �
259
+ � 
260
+ � 
261
+ � 
262
+ �
263
+ �
264
+ � 
265
+
266
+ � 
267
+ � 
268
+ � 
269
+ �
270
+
271
+
272
+ �
273
+ �
274
+ �
275
+ �
276
+ � 
277
+ �
278
+
279
+ 
280
+ �
281
+ � 
282
+ �
283
+ �
284
+ �
285
+ �
286
+
287
+ � 
288
+ � 
289
+
290
+
291
+ 
292
+ �
293
+ �
294
+ � 
295
+ �
296
+ � 
297
+ � 
298
+ �
299
+
300
+ � 
301
+
302
+ 
303
+ � 
304
+ �
305
+ �
306
+ � 
307
+ �
308
+ �
309
+ �
310
+ �
311
+ �
312
+ �
313
+ �
314
+ � 
315
+ � 
316
+ �
317
+ �           
318
+  
319
+  
320
+ 
321
+                
322
+    
323
+   
324
+   !
325
+  +  ,  - . /  0 1 2 3 4  5  6 7 8 9 : ; < = > ? @ A B C D
326
+  E F G  H
327
+  I J K L M N  O P Q  R
328
+  S T U V W X Y
329
+  Z [ \ ] ^ _ ` a b  c d e f g h i j k l m n o  p q r s t u
330
+  v w x y z { | } ~  � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �  � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �          
331
+   
332
+ 
333
  
334
+ 
1
- 
335
+   
336
+   
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import numpy as np
3
3
  import xarray as xr
4
+ from matplotlib import colors
4
5
  from .ogip import DataARF, DataRMF
5
6
 
6
7
 
@@ -64,21 +65,26 @@ class Instrument(xr.Dataset):
64
65
  )
65
66
 
66
67
  @classmethod
67
- def from_ogip_file(cls, arf_file: str | os.PathLike, rmf_file: str | os.PathLike, **kwargs):
68
+ def from_ogip_file(cls, rmf_path: str | os.PathLike, arf_path: str | os.PathLike = None):
68
69
  """
69
70
  Load the data from OGIP files.
70
71
 
71
72
  Parameters:
72
- arf_file: The ARF file path.
73
- rmf_file: The RMF file path.
73
+ rmf_path: The RMF file path.
74
+ arf_path: The ARF file path.
74
75
  exposure: The exposure time in second.
75
76
  grouping: The grouping matrix.
76
77
  """
77
78
 
78
- arf = DataARF.from_file(arf_file)
79
- rmf = DataRMF.from_file(rmf_file)
79
+ rmf = DataRMF.from_file(rmf_path)
80
80
 
81
- return cls.from_matrix(rmf.matrix, arf.specresp, rmf.energ_lo, rmf.energ_hi, rmf.e_min, rmf.e_max)
81
+ if arf_path is not None:
82
+ specresp = DataARF.from_file(arf_path).specresp
83
+
84
+ else:
85
+ specresp = np.ones(rmf.energ_lo.shape)
86
+
87
+ return cls.from_matrix(rmf.sparse_matrix, specresp, rmf.energ_lo, rmf.energ_hi, rmf.e_min, rmf.e_max)
82
88
 
83
89
  def plot_redistribution(self, **kwargs):
84
90
  """
@@ -95,9 +101,8 @@ class Instrument(xr.Dataset):
95
101
  y="e_max_channel",
96
102
  xscale="log",
97
103
  yscale="log",
98
- cmap=cmr.cosmic,
99
- vmin=0,
100
- vmax=0.075,
104
+ cmap=cmr.ember_r,
105
+ norm=colors.LogNorm(vmin=1e-6, vmax=1),
101
106
  add_labels=True,
102
107
  **kwargs,
103
108
  )