-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hello, I am having trouble running the 2_x-ray-analysis notebook: link on the line
chandra.rebin_on_background(1)
where I get the following error:
~/anaconda3/envs/astro/bin/python3 /Users/ghosh/work/cds_tutorial/x-ray-analyse-threeml.py
~/anaconda3/envs/astro/lib/python3.9/site-packages/numba/core/decorators.py:262: NumbaDeprecationWarning: numba.generated_jit is deprecated. Please see the documentation at: https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-generated-jit for more information and advice on a suitable replacement.
warnings.warn(msg, NumbaDeprecationWarning)
~/anaconda3/envs/astro/lib/python3.9/site-packages/numba/core/decorators.py:262: NumbaDeprecationWarning: numba.generated_jit is deprecated. Please see the documentation at: https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-generated-jit for more information and advice on a suitable replacement.
warnings.warn(msg, NumbaDeprecationWarning)
19:42:53 INFO Starting 3ML! __init__.py:35
WARNING WARNINGs here are NOT errors __init__.py:36
WARNING but are inform you about optional packages __init__.py:37
that can be installed
WARNING to disable these messages, turn off __init__.py:40
start_warning in your config file
WARNING ROOT minimizer not available minimization.py:1345
WARNING Multinest minimizer not available minimization.py:1357
19:42:54 WARNING PyGMO is not available minimization.py:1369
19:42:54 WARNING The cthreeML package is not installed. You __init__.py:94
will not be able to use plugins which require
the C/C++ interface (currently HAWC)
WARNING Could not import plugin HAWCLike.py. Do you __init__.py:144
have the relative instrument software
installed and configured?
WARNING Could not import plugin FermiLATLike.py. Do __init__.py:144
you have the relative instrument software
installed and configured?
19:42:55 WARNING No fermitools installed lat_transient_builder.py:44
19:42:55 WARNING Env. variable OMP_NUM_THREADS is not set. __init__.py:387
Please set it to 1 for optimal performances in
3ML
WARNING Env. variable MKL_NUM_THREADS is not set. __init__.py:387
Please set it to 1 for optimal performances in
3ML
WARNING Env. variable NUMEXPR_NUM_THREADS is not set. __init__.py:387
Please set it to 1 for optimal performances in
3ML
INFO Auto-probed noise models: SpectrumLike.py:469
INFO - observation: poisson SpectrumLike.py:470
INFO - background: poisson SpectrumLike.py:471
Chandra significance: 83.866613
Chandra Significance by channel:
[-0.78657315 0.53715615 -0. ... -0. -0.
-0. ]
Chandra Exposure: 1.000000
19:42:56 INFO Range 0.2-10 translates to channels SpectrumLike.py:1210
13-684
WARNING UserWarning: Attempt to set non-positive ylim on a log-scaled axis will be ignored.
Traceback (most recent call last):
File "~/work/cds_tutorial/x-ray-analyse-threeml.py", line 45, in <module>
main()
File "~/work/cds_tutorial/x-ray-analyse-threeml.py", line 42, in main
chandra.rebin_on_background(1)
File "~/anaconda3/envs/astro/lib/python3.9/site-packages/threeML/plugins/SpectrumLike.py", line 1608, in rebin_on_background
self._apply_rebinner(rebinner)
File "~/anaconda3/envs/astro/lib/python3.9/site-packages/threeML/plugins/SpectrumLike.py", line 1650, in _apply_rebinner
(self._current_observed_counts,) = self._rebinner.rebin(self._observed_counts)
File "~/anaconda3/envs/astro/lib/python3.9/site-packages/threeML/utils/binner.py", line 186, in rebin
_rebin_vector_int(
File "~/anaconda3/envs/astro/lib/python3.9/site-packages/numba/core/dispatcher.py", line 468, in _compile_for_args
error_rewrite(e, 'typing')
File "~/anaconda3/envs/astro/lib/python3.9/site-packages/numba/core/dispatcher.py", line 409, in error_rewrite
raise e.with_traceback(None)
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
- Resolution failure for literal arguments:
Failed in nopython mode pipeline (step: native lowering)
Method '__array__' is not supported.
- Resolution failure for non-literal arguments:
None
During: resolving callee type: BoundFunction((<class 'numba.core.types.misc.ClassInstanceType'>, 'append') for instance.jitclass._Vector#12bc136d0<n:uint64,m:uint64,full_arr:array(int64, 1d, A)>)
During: typing of call at /Users/ghosh/anaconda3/envs/astro/lib/python3.9/site-packages/threeML/utils/binner.py (679)
File "../../anaconda3/envs/astro/lib/python3.9/site-packages/threeML/utils/binner.py", line 679:
def _rebin_vector_int(vector, start, stop, mask, N):
<source elided>
rebinned_vector.append(np.sum(vector[start[n] : stop[n]]))
^
Process finished with exit code 1
To reproduce:
import threeML as tml
import os
tml.update_logging_level("INFO")
tml.silence_warnings()
import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
def main():
chandra = tml.OGIPLike(name="chandra",
observation="c_data/obs.pha",
background="c_data/obs_bak.pha",
response="c_data/acis.rmf",
arf_file="c_data/acis.arf",
spectrum_number=1)
# Check chandra significance
print('Chandra significance: {0:f}'.format(chandra.significance))
# Get chandra significance by channel
print('Chandra Significance by channel:\n', chandra.significance_per_channel)
# Display rsp
chandra.display_rsp()
# Get chandra exposure
print('Chandra Exposure: {0:f}'.format(chandra.exposure))
# Display count spectrum
chandra.view_count_spectrum(scale_background=True)
# Set the active energy range
chandra.set_active_measurements('0.2-10')
# Plot the count spectrum after setting the energy range
chandra.view_count_spectrum()
# Rebin
chandra.rebin_on_background(1)
if __name__ == '__main__':
main()
plt.show()
SYSTEM INFORMATION
OS: macOS 13.4.1 (22F82)
conda version: conda 23.5.0
3ML version: threeml 2.4.0 pyhd8ed1ab_0 conda-forge
Metadata
Metadata
Assignees
Labels
No labels