You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I attempted to manual extraction on my coadd2d spectra from Pypeit 1.17.1, I got the following error message:
Traceback (most recent call last):
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/bin/pypeit_coadd_2dspec", line 8, in <module>
sys.exit(CoAdd2DSpec.entry_point())
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/scripts/scriptbase.py", line 114, in entry_point
cls.main(cls.parse_args())
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/scripts/coadd_2dspec.py", line 196, in main
= coadd.reduce(pseudo_dict, show=args.show, show_peaks=args.peaks, basename=basename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/coadd2d.py", line 834, in reduce
global_sky_pseudo, sobjs_obj = objFind.run(show_peaks=show or show_peaks, show_skysub_fit=show_skysub_fit)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/find_objects.py", line 351, in run
sobjs_obj, self.nobj = self.find_objects(self.sciImg.image, self.sciImg.ivar,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/find_objects.py", line 442, in find_objects
self.find_objects_pypeline(image, ivar,
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/find_objects.py", line 944, in find_objects_pypeline
sobjs_ech = findobj_skymask.ech_objfind(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/core/findobj_skymask.py", line 1305, in ech_objfind
obj_id = ech_fof_sobjs(sobjs_in_orders, slit_left, slit_righ, order_vec, plate_scale, fof_link=fof_link)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/core/findobj_skymask.py", line 402, in ech_fof_sobjs
= pydl.spheregroup(ra_fake, dec_fake, FOF_frac/1000.0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/core/pydl.py", line 1552, in spheregroup
chunk = chunks(ra, dec, chunksize)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/core/pydl.py", line 1078, in __init__
self.raMin, self.raMax = self.getraminmax(ra, self.raOffset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/zixuanpeng/opt/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/core/pydl.py", line 1158, in getraminmax
currRa = np.fmod(ra + raOffset, 360.0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'numpy.float64' object has no attribute 'fmod'
The main issue here seems to be the ra numpy array contained both Python float and numpy.float64 as objects, but ra is explicitly set to dtype=object, meaning it contains Python objects instead of standard NumPy float64 elements (example attached below).
In [1]: ra
Out[1]:
array([np.float64(0.00042043491510027374), 0.0004339080459770116,
np.float64(0.0004477365176930186),
np.float64(0.0004603022893073715),
np.float64(0.0004648329181943401),
np.float64(0.00046714450939566645),
np.float64(0.0004692453942313854),
np.float64(0.0004679435356018008),
np.float64(0.0004739301929891501),
np.float64(0.0005127088976754066)], dtype=object)
To avoid this bug, I need to change the line 1969 in findobj_skymask.py (
Hi @jasonpeng17 . Thanks for reporting this issue! Can you pass along a minimal dataset that I can use to reproduce the error? You could e-mail me ([email protected]) or send me a direct message on the PypeIt Users Slack.
I really appreciate you providing a fix! But I'm confused by the error and want to make sure there isn't a different underlying problem that would remain after your solution.
When I attempted to manual extraction on my coadd2d spectra from Pypeit 1.17.1, I got the following error message:
The main issue here seems to be the
ra
numpy array contained both Pythonfloat
andnumpy.float64
as objects, butra
is explicitly set todtype=object,
meaning it contains Python objects instead of standard NumPyfloat64
elements (example attached below).To avoid this bug, I need to change the line 1969 in
findobj_skymask.py
(PypeIt/pypeit/core/findobj_skymask.py
Line 1969 in 73abd3b
to
thisobj.SPAT_FRACPOS = np.float64(f_ximg(thisobj.hand_extract_spec, thisobj.hand_extract_spat, grid=False)) # interpolate from ximg
The text was updated successfully, but these errors were encountered: