heapyx 0.2.1__tar.gz → 0.2.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 (58) hide show
  1. heapyx-0.2.4/PKG-INFO +165 -0
  2. heapyx-0.2.4/README.md +122 -0
  3. heapyx-0.2.4/heapy/__info__.py +1 -0
  4. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/auto/baseline.py +6 -22
  5. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/auto/polynomial.py +8 -20
  6. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/auto/signal.py +223 -55
  7. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/auto/signal_utils.py +8 -12
  8. heapyx-0.2.4/heapy/data/filefinder.py +545 -0
  9. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/data/retrieve.py +20 -12
  10. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/pipe/batpipe.py +6 -7
  11. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/pipe/event.py +34 -18
  12. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/pipe/image.py +6 -7
  13. heapyx-0.2.4/heapy/temp/cwt.py +418 -0
  14. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/temp/lag.py +251 -177
  15. heapyx-0.2.4/heapy/temp/mvt.py +431 -0
  16. heapyx-0.2.4/heapy/temp/temp_utils.py +1879 -0
  17. heapyx-0.2.4/heapy/temp/txx.py +687 -0
  18. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/util/data.py +123 -15
  19. heapyx-0.2.4/heapyx.egg-info/PKG-INFO +165 -0
  20. {heapyx-0.2.1 → heapyx-0.2.4}/heapyx.egg-info/SOURCES.txt +1 -2
  21. {heapyx-0.2.1 → heapyx-0.2.4}/heapyx.egg-info/requires.txt +4 -1
  22. {heapyx-0.2.1 → heapyx-0.2.4}/pyproject.toml +5 -1
  23. {heapyx-0.2.1 → heapyx-0.2.4}/setup.py +9 -6
  24. heapyx-0.2.1/PKG-INFO +0 -85
  25. heapyx-0.2.1/README.md +0 -45
  26. heapyx-0.2.1/heapy/__info__.py +0 -1
  27. heapyx-0.2.1/heapy/data/filefinder.py +0 -296
  28. heapyx-0.2.1/heapy/temp/mvt.py +0 -646
  29. heapyx-0.2.1/heapy/temp/mvt_cl.py +0 -970
  30. heapyx-0.2.1/heapy/temp/mvt_gm.py +0 -1104
  31. heapyx-0.2.1/heapy/temp/temp_utils.py +0 -347
  32. heapyx-0.2.1/heapy/temp/txx.py +0 -918
  33. heapyx-0.2.1/heapyx.egg-info/PKG-INFO +0 -85
  34. {heapyx-0.2.1 → heapyx-0.2.4}/LICENSE +0 -0
  35. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/__init__.py +0 -0
  36. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/auto/__init__.py +0 -0
  37. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/data/__init__.py +0 -0
  38. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/docs/McIlwainL_coeffs/McIlwainL_Coeffs.npy +0 -0
  39. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/docs/psf_model/fxt_psf.cod +0 -0
  40. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/docs/psf_model/fxt_psf.dat +0 -0
  41. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/docs/psf_model/xrt_psf.cod +0 -0
  42. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/geos/__init__.py +0 -0
  43. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/geos/detector.py +0 -0
  44. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/geos/geometry.py +0 -0
  45. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/geos/localization.py +0 -0
  46. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/geos/skymap.py +0 -0
  47. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/pipe/__init__.py +0 -0
  48. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/pipe/filter.py +0 -0
  49. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/temp/__init__.py +0 -0
  50. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/util/__init__.py +0 -0
  51. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/util/coord.py +0 -0
  52. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/util/file.py +0 -0
  53. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/util/significance.py +0 -0
  54. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/util/time.py +0 -0
  55. {heapyx-0.2.1 → heapyx-0.2.4}/heapy/util/tools.py +0 -0
  56. {heapyx-0.2.1 → heapyx-0.2.4}/heapyx.egg-info/dependency_links.txt +0 -0
  57. {heapyx-0.2.1 → heapyx-0.2.4}/heapyx.egg-info/top_level.txt +0 -0
  58. {heapyx-0.2.1 → heapyx-0.2.4}/setup.cfg +0 -0
heapyx-0.2.4/PKG-INFO ADDED
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.4
2
+ Name: heapyx
3
+ Version: 0.2.4
4
+ Summary: High-energy (X-ray and gamma-ray) astronomical data analysis tools
5
+ Home-page: https://github.com/jyangch/heapy
6
+ Author: Jun Yang
7
+ Author-email: jyang@smail.nju.edu.cn
8
+ License: GPLv3
9
+ Project-URL: Source Code, https://github.com/jyangch/heapy
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Classifier: Operating System :: MacOS
14
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: numpy>=1.20.4
19
+ Requires-Dist: pandas>=1.4.2
20
+ Requires-Dist: scipy>=1.8.0
21
+ Requires-Dist: astropy>=5.2.2
22
+ Requires-Dist: matplotlib>=3.2.1
23
+ Requires-Dist: tqdm>=4.64.1
24
+ Requires-Dist: plotly>=5.22.0
25
+ Requires-Dist: kaleido>=0.2.1
26
+ Requires-Dist: pybaselines>=1.1.0
27
+ Requires-Dist: pycwt>=0.3.0a22
28
+ Requires-Dist: scikit-learn>=1.0
29
+ Requires-Dist: healpy>=1.16
30
+ Requires-Dist: cartopy>=0.21
31
+ Dynamic: author
32
+ Dynamic: author-email
33
+ Dynamic: classifier
34
+ Dynamic: description
35
+ Dynamic: description-content-type
36
+ Dynamic: home-page
37
+ Dynamic: license
38
+ Dynamic: license-file
39
+ Dynamic: project-url
40
+ Dynamic: requires-dist
41
+ Dynamic: requires-python
42
+ Dynamic: summary
43
+
44
+ <h1 align="center">HEAPY</h1>
45
+
46
+ <p align="center">
47
+ <strong>A Python toolkit for data reduction, temporal analysis, and spectral extraction of X-ray and gamma-ray transients.</strong>
48
+ </p>
49
+
50
+ <p align="center">
51
+ <a href="https://pypi.org/project/heapyx/"><img alt="PyPI" src="https://img.shields.io/pypi/v/heapyx?color=4F46E5&labelColor=1f2937&logo=pypi&logoColor=white"></a>
52
+ <a href="https://doi.org/10.5281/zenodo.23283842"><img alt="DOI" src="https://zenodo.org/badge/DOI/10.5281/zenodo.23283842.svg"></a>
53
+ <a href="https://github.com/jyangch/heapy/tree/main/examples"><img alt="Examples" src="https://img.shields.io/badge/docs-examples-06B6D4?labelColor=1f2937"></a>
54
+ <a href="https://www.gnu.org/licenses/gpl-3.0"><img alt="License GPL-3.0" src="https://img.shields.io/badge/license-GPL--3.0-9CA3AF?labelColor=1f2937"></a>
55
+ </p>
56
+
57
+ ---
58
+
59
+ `Heapy` is a Python toolkit for data reduction, temporal analysis, and
60
+ spectral extraction of X-ray and gamma-ray transients. It pulls event and response data from mission
61
+ archives, reduces time-tagged-event (TTE) and image data into light curves
62
+ and OGIP spectra, separates burst signals from fitted backgrounds, and
63
+ measures durations, spectral lags, and source localizations — across
64
+ [`Fermi`](https://gammaray.nsstc.nasa.gov/gbm/)/GBM, GECAM, GRID,
65
+ [`Einstein Probe`](https://ep.bao.ac.cn/) (WXT/FXT), and
66
+ [`Swift`](https://swift.gsfc.nasa.gov/) (XRT/BAT). It bridges to
67
+ [`HEASoft`](https://heasarc.gsfc.nasa.gov/docs/software/heasoft/) and
68
+ [`gbm_drm_gen`](https://github.com/grburgess/gbm_drm_gen) for mission-specific
69
+ reduction and response generation.
70
+
71
+
72
+ ## Features
73
+
74
+ - **Data retrieval.** Pull event, position, and response files straight
75
+ from mission archives by burst ID, UTC window, or observation ID
76
+ (`gbmRetrieve`, `gecamRetrieve`, `gridRetrieve`, `epRetrieve`,
77
+ `swiftRetrieve`).
78
+ - **Multi-mission event reduction.** One `Event` interface across
79
+ Fermi/GBM TTE, GECAM, GRID, Einstein Probe (WXT/FXT), and Swift
80
+ (XRT/BAT).
81
+ - **Light curves.** Extract and rebin light curves with automatic
82
+ background fitting.
83
+ - **Signal detection.** Bayesian-block signal/background separation with
84
+ three noise regimes — Poisson + polynomial background (`pgSignal`),
85
+ Poisson + supplied background (`ppSignal`), and Gaussian (`ggSignal`).
86
+ - **OGIP spectra.** Generate source and background `PHA`/`PHA2` spectra,
87
+ and — for Fermi/GBM — response matrices via `gbm_drm_gen`.
88
+ - **Timing analysis.** Duration measurements (`T90`/`Txx`) and
89
+ spectral-lag estimation.
90
+ - **Localization & geometry.** Detector geometry, sky maps, and source
91
+ localization.
92
+
93
+
94
+ ## Installation
95
+
96
+ `Heapy` requires Python 3.10 or later and is available on PyPI:
97
+
98
+ ```bash
99
+ pip install heapyx
100
+ ```
101
+
102
+ ### Optional: `HEASoft`
103
+
104
+ For some missions (e.g., `Swift`), `heapy` invokes `HEASoft` tools such as
105
+ `xselect` and `ximage`. Ensure
106
+ [`HEASoft`](https://heasarc.gsfc.nasa.gov/docs/software/heasoft/#install) is
107
+ installed, along with the
108
+ [`Calibration Database`](https://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/install.html)
109
+ (CALDB) for the mission you are processing.
110
+
111
+ ### Optional: Fermi GBM response generator
112
+
113
+ To build response matrices for Fermi/GBM, `heapy` calls
114
+ [`gbm_drm_gen`](https://github.com/grburgess/gbm_drm_gen). The forked
115
+ packages below are fine-tuned for newer `numpy`/`astropy` and use TTE
116
+ instead of CSPEC data:
117
+
118
+ ```bash
119
+ git clone https://github.com/jyangch/responsum.git
120
+ pip3 install ./responsum
121
+
122
+ git clone https://github.com/jyangch/gbmgeometry.git
123
+ pip3 install ./gbmgeometry
124
+
125
+ git clone https://github.com/jyangch/gbm_drm_gen.git
126
+ pip3 install ./gbm_drm_gen
127
+ ```
128
+
129
+
130
+ ## Documentation
131
+
132
+ Browse the [examples](https://github.com/jyangch/heapy/tree/main/examples)
133
+ for typical workflows end to end.
134
+
135
+
136
+ ## Citation
137
+
138
+ If you use `HEAPY` in your research, please include a software citation in
139
+ your reference list and state the version used in your methods section.
140
+ Citation metadata are available in [CITATION.cff](CITATION.cff), with a
141
+ downloadable BibTeX entry in [CITATION.bib](CITATION.bib).
142
+
143
+ HEAPY version `0.2.3` is archived on Zenodo and can be cited as:
144
+
145
+ > Yang, J. (2026). HEAPY: A Python toolkit for data reduction, temporal analysis, and
146
+ > spectral extraction of X-ray and gamma-ray transients (v0.2.3) [Computer software].
147
+ > Zenodo. https://doi.org/10.5281/zenodo.23283842
148
+
149
+ ```bibtex
150
+ @software{heapy,
151
+ author = {Yang, Jun},
152
+ title = {{HEAPY}: A Python toolkit for data reduction, temporal analysis, and
153
+ spectral extraction of X-ray and gamma-ray transients},
154
+ year = {2026},
155
+ version = {v0.2.3},
156
+ publisher = {Zenodo},
157
+ doi = {10.5281/zenodo.23283842},
158
+ url = {https://doi.org/10.5281/zenodo.23283842}
159
+ }
160
+ ```
161
+
162
+ ## License
163
+
164
+ `Heapy` is distributed under the
165
+ [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0-standalone.html) license.
heapyx-0.2.4/README.md ADDED
@@ -0,0 +1,122 @@
1
+ <h1 align="center">HEAPY</h1>
2
+
3
+ <p align="center">
4
+ <strong>A Python toolkit for data reduction, temporal analysis, and spectral extraction of X-ray and gamma-ray transients.</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://pypi.org/project/heapyx/"><img alt="PyPI" src="https://img.shields.io/pypi/v/heapyx?color=4F46E5&labelColor=1f2937&logo=pypi&logoColor=white"></a>
9
+ <a href="https://doi.org/10.5281/zenodo.23283842"><img alt="DOI" src="https://zenodo.org/badge/DOI/10.5281/zenodo.23283842.svg"></a>
10
+ <a href="https://github.com/jyangch/heapy/tree/main/examples"><img alt="Examples" src="https://img.shields.io/badge/docs-examples-06B6D4?labelColor=1f2937"></a>
11
+ <a href="https://www.gnu.org/licenses/gpl-3.0"><img alt="License GPL-3.0" src="https://img.shields.io/badge/license-GPL--3.0-9CA3AF?labelColor=1f2937"></a>
12
+ </p>
13
+
14
+ ---
15
+
16
+ `Heapy` is a Python toolkit for data reduction, temporal analysis, and
17
+ spectral extraction of X-ray and gamma-ray transients. It pulls event and response data from mission
18
+ archives, reduces time-tagged-event (TTE) and image data into light curves
19
+ and OGIP spectra, separates burst signals from fitted backgrounds, and
20
+ measures durations, spectral lags, and source localizations — across
21
+ [`Fermi`](https://gammaray.nsstc.nasa.gov/gbm/)/GBM, GECAM, GRID,
22
+ [`Einstein Probe`](https://ep.bao.ac.cn/) (WXT/FXT), and
23
+ [`Swift`](https://swift.gsfc.nasa.gov/) (XRT/BAT). It bridges to
24
+ [`HEASoft`](https://heasarc.gsfc.nasa.gov/docs/software/heasoft/) and
25
+ [`gbm_drm_gen`](https://github.com/grburgess/gbm_drm_gen) for mission-specific
26
+ reduction and response generation.
27
+
28
+
29
+ ## Features
30
+
31
+ - **Data retrieval.** Pull event, position, and response files straight
32
+ from mission archives by burst ID, UTC window, or observation ID
33
+ (`gbmRetrieve`, `gecamRetrieve`, `gridRetrieve`, `epRetrieve`,
34
+ `swiftRetrieve`).
35
+ - **Multi-mission event reduction.** One `Event` interface across
36
+ Fermi/GBM TTE, GECAM, GRID, Einstein Probe (WXT/FXT), and Swift
37
+ (XRT/BAT).
38
+ - **Light curves.** Extract and rebin light curves with automatic
39
+ background fitting.
40
+ - **Signal detection.** Bayesian-block signal/background separation with
41
+ three noise regimes — Poisson + polynomial background (`pgSignal`),
42
+ Poisson + supplied background (`ppSignal`), and Gaussian (`ggSignal`).
43
+ - **OGIP spectra.** Generate source and background `PHA`/`PHA2` spectra,
44
+ and — for Fermi/GBM — response matrices via `gbm_drm_gen`.
45
+ - **Timing analysis.** Duration measurements (`T90`/`Txx`) and
46
+ spectral-lag estimation.
47
+ - **Localization & geometry.** Detector geometry, sky maps, and source
48
+ localization.
49
+
50
+
51
+ ## Installation
52
+
53
+ `Heapy` requires Python 3.10 or later and is available on PyPI:
54
+
55
+ ```bash
56
+ pip install heapyx
57
+ ```
58
+
59
+ ### Optional: `HEASoft`
60
+
61
+ For some missions (e.g., `Swift`), `heapy` invokes `HEASoft` tools such as
62
+ `xselect` and `ximage`. Ensure
63
+ [`HEASoft`](https://heasarc.gsfc.nasa.gov/docs/software/heasoft/#install) is
64
+ installed, along with the
65
+ [`Calibration Database`](https://heasarc.gsfc.nasa.gov/docs/heasarc/caldb/install.html)
66
+ (CALDB) for the mission you are processing.
67
+
68
+ ### Optional: Fermi GBM response generator
69
+
70
+ To build response matrices for Fermi/GBM, `heapy` calls
71
+ [`gbm_drm_gen`](https://github.com/grburgess/gbm_drm_gen). The forked
72
+ packages below are fine-tuned for newer `numpy`/`astropy` and use TTE
73
+ instead of CSPEC data:
74
+
75
+ ```bash
76
+ git clone https://github.com/jyangch/responsum.git
77
+ pip3 install ./responsum
78
+
79
+ git clone https://github.com/jyangch/gbmgeometry.git
80
+ pip3 install ./gbmgeometry
81
+
82
+ git clone https://github.com/jyangch/gbm_drm_gen.git
83
+ pip3 install ./gbm_drm_gen
84
+ ```
85
+
86
+
87
+ ## Documentation
88
+
89
+ Browse the [examples](https://github.com/jyangch/heapy/tree/main/examples)
90
+ for typical workflows end to end.
91
+
92
+
93
+ ## Citation
94
+
95
+ If you use `HEAPY` in your research, please include a software citation in
96
+ your reference list and state the version used in your methods section.
97
+ Citation metadata are available in [CITATION.cff](CITATION.cff), with a
98
+ downloadable BibTeX entry in [CITATION.bib](CITATION.bib).
99
+
100
+ HEAPY version `0.2.3` is archived on Zenodo and can be cited as:
101
+
102
+ > Yang, J. (2026). HEAPY: A Python toolkit for data reduction, temporal analysis, and
103
+ > spectral extraction of X-ray and gamma-ray transients (v0.2.3) [Computer software].
104
+ > Zenodo. https://doi.org/10.5281/zenodo.23283842
105
+
106
+ ```bibtex
107
+ @software{heapy,
108
+ author = {Yang, Jun},
109
+ title = {{HEAPY}: A Python toolkit for data reduction, temporal analysis, and
110
+ spectral extraction of X-ray and gamma-ray transients},
111
+ year = {2026},
112
+ version = {v0.2.3},
113
+ publisher = {Zenodo},
114
+ doi = {10.5281/zenodo.23283842},
115
+ url = {https://doi.org/10.5281/zenodo.23283842}
116
+ }
117
+ ```
118
+
119
+ ## License
120
+
121
+ `Heapy` is distributed under the
122
+ [GPL-3.0](https://www.gnu.org/licenses/gpl-3.0-standalone.html) license.
@@ -0,0 +1 @@
1
+ __version__ = '0.2.4'
@@ -6,8 +6,6 @@ The fitted baseline is stored on the instance and can be evaluated at
6
6
  arbitrary abscissae via cubic spline interpolation.
7
7
  """
8
8
 
9
- import warnings
10
-
11
9
  from astropy.stats import mad_std, sigma_clip
12
10
  import numpy as np
13
11
  import pybaselines
@@ -134,8 +132,9 @@ class Baseline:
134
132
  """Evaluate the fitted baseline at ``x`` via cubic spline interpolation.
135
133
 
136
134
  Args:
137
- x: Query abscissae; values outside the fitting range are
138
- extrapolated and trigger a ``UserWarning``.
135
+ x: Query abscissae; values more than one fitted-bin spacing
136
+ outside the fitting range are extrapolated and trigger a
137
+ ``UserWarning``.
139
138
 
140
139
  Returns:
141
140
  Interpolated baseline values at ``x``.
@@ -143,14 +142,6 @@ class Baseline:
143
142
 
144
143
  x = np.asarray(x)
145
144
 
146
- if min(x) < min(self.x - self.dx / 1.8):
147
- msg = f'Extrapolation may be imprecise: {min(x):f} < {min(self.x - self.dx / 1.8):f}'
148
- warnings.warn(msg, UserWarning, stacklevel=2)
149
-
150
- if max(x) > max(self.x + self.dx / 1.8):
151
- msg = f'Extrapolation may be imprecise: {max(x):f} > {max(self.x + self.dx / 1.8):f}'
152
- warnings.warn(msg, UserWarning, stacklevel=2)
153
-
154
145
  interp = CubicSpline(self.x, self.mo, extrapolate=True)
155
146
 
156
147
  return interp(x)
@@ -166,8 +157,9 @@ class Baseline:
166
157
  point is irrelevant.
167
158
 
168
159
  Args:
169
- x: Query abscissae; values outside the fitting range are
170
- extrapolated and trigger a ``UserWarning``.
160
+ x: Query abscissae; values more than one fitted-bin spacing
161
+ outside the fitting range are extrapolated and trigger a
162
+ ``UserWarning``.
171
163
 
172
164
  Returns:
173
165
  Antiderivative values at ``x``.
@@ -175,14 +167,6 @@ class Baseline:
175
167
 
176
168
  x = np.asarray(x)
177
169
 
178
- if min(x) < min(self.x - self.dx / 1.8):
179
- msg = f'Extrapolation may be imprecise: {min(x):f} < {min(self.x - self.dx / 1.8):f}'
180
- warnings.warn(msg, UserWarning, stacklevel=2)
181
-
182
- if max(x) > max(self.x + self.dx / 1.8):
183
- msg = f'Extrapolation may be imprecise: {max(x):f} > {max(self.x + self.dx / 1.8):f}'
184
- warnings.warn(msg, UserWarning, stacklevel=2)
185
-
186
170
  antider = CubicSpline(self.x, self.mo, extrapolate=True).antiderivative()
187
171
 
188
172
  return antider(x)
@@ -101,8 +101,9 @@ class Polynomial:
101
101
  def val(self, x):
102
102
  """Evaluate the fitted polynomial and its 1-sigma uncertainty at ``x``.
103
103
 
104
- Emits a ``UserWarning`` when ``x`` falls outside the fitting
105
- range. Requires a prior :meth:`fit` call.
104
+ Emits a ``UserWarning`` when ``x`` falls more than one
105
+ fitted-bin spacing outside the fitting range. Requires a prior
106
+ :meth:`fit` call.
106
107
 
107
108
  Args:
108
109
  x: Query abscissae.
@@ -117,14 +118,6 @@ class Polynomial:
117
118
 
118
119
  x = np.array(x)
119
120
 
120
- if min(x) < min(self.x - self.dx / 1.8):
121
- msg = f'Extrapolation may be imprecise: {min(x):f} < {min(self.x - self.dx / 1.8):f}'
122
- warnings.warn(msg, UserWarning, stacklevel=2)
123
-
124
- if max(x) > max(self.x + self.dx / 1.8):
125
- msg = f'Extrapolation may be imprecise: {max(x):f} > {max(self.x + self.dx / 1.8):f}'
126
- warnings.warn(msg, UserWarning, stacklevel=2)
127
-
128
121
  assert self.ls_res is not None, 'you should first perform fitting'
129
122
 
130
123
  mo, err = self.ls_polyval(x, coeff=self.ls_res['coeff'], covar=self.ls_res['covar'])
@@ -138,7 +131,9 @@ class Polynomial:
138
131
  via the linear map ``c_int[k] = c[k] / (deg + 1 - k)``. Intended
139
132
  as a ``bkg_integral`` callable for time-rescaling Bayesian blocks
140
133
  where only differences ``F(t1) - F(t0)`` enter, so the choice
141
- of integration constant is irrelevant.
134
+ of integration constant is irrelevant. Emits a ``UserWarning``
135
+ when ``x`` falls more than one fitted-bin spacing outside the
136
+ fitting range.
142
137
 
143
138
  Args:
144
139
  x: Query abscissae.
@@ -152,14 +147,6 @@ class Polynomial:
152
147
 
153
148
  x = np.array(x)
154
149
 
155
- if min(x) < min(self.x - self.dx / 1.8):
156
- msg = f'Extrapolation may be imprecise: {min(x):f} < {min(self.x - self.dx / 1.8):f}'
157
- warnings.warn(msg, UserWarning, stacklevel=2)
158
-
159
- if max(x) > max(self.x + self.dx / 1.8):
160
- msg = f'Extrapolation may be imprecise: {max(x):f} > {max(self.x + self.dx / 1.8):f}'
161
- warnings.warn(msg, UserWarning, stacklevel=2)
162
-
163
150
  assert self.ls_res is not None, 'you should first perform fitting'
164
151
 
165
152
  coeff = self.ls_res['coeff']
@@ -306,7 +293,8 @@ class Polynomial:
306
293
  lhs = np.vander(x, order)
307
294
 
308
295
  # evaluate the model values at given x
309
- mo = coeff @ lhs.T
296
+ # mo = coeff @ lhs.T
297
+ mo = np.polyval(coeff, x)
310
298
  # or
311
299
  # mo = np.zeros_like(x)
312
300
  # for ci in coeff: