-
-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
I created this in the aplpy site (aplpy/aplpy#381) but it seems it may be more relevant here.
using aplpy.FITSFigure.show_regions I can load a region file with the following content just fine:
fk5
circle(10.0,-5.0,10")
but when the units correspond to a letter (i.e., 'd' for degrees, 'r' for radians, 'p' for physical pixels or 'i' for image pixels), the command cannot be parsed. Take a file with the following content
fk5
circle(10.0,-5.0,0.02d)
This file loads without a problem in ds9, but when passed to aplpy.FITSFigure.show_regions it issues the following warning:
/Users/cristobal/anaconda3/lib/python3.6/site-packages/pyregion/ds9_region_parser.py:107: UserWarning: Failed to parse : circle(10.0,-5.0,0.02d)
If this happens with all the entries in my reg file, then the following exception is raised:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-9-e910de502d80> in <module>()
6 regfile = mask.regions()
7 #img.show_regions(regfile)
----> 8 img.show_regions('test.reg')
/Users/cristobal/anaconda3/envs/pyraf/lib/python2.7/site-packages/aplpy/regions.pyc in show_regions(self, region_file, layer, **kwargs)
/Users/cristobal/anaconda3/envs/pyraf/lib/python2.7/site-packages/aplpy/decorators.pyc in _auto_refresh(f, *args, **kwargs)
23 mydata.nesting = getattr(mydata, 'nesting', 0) + 1
24 try:
---> 25 return f(*args, **kwargs)
26 finally:
27 mydata.nesting -= 1
/Users/cristobal/anaconda3/envs/pyraf/lib/python2.7/site-packages/aplpy/regions.pyc in show_regions(self, region_file, layer, **kwargs)
63 """
64
---> 65 PC, TC = ds9(region_file, wcs.WCS(self._header).sub([wcs.WCSSUB_CELESTIAL]), **kwargs)
66
67 # ffpc = self._ax1.add_collection(PC)
/Users/cristobal/anaconda3/envs/pyraf/lib/python2.7/site-packages/aplpy/regions.pyc in ds9(region_file, header, zorder, **kwargs)
94 # read region file
95 if isinstance(region_file, six.string_types):
---> 96 rr = pyregion.open(region_file)
97 elif isinstance(region_file, pyregion.ShapeList):
98 rr = region_file
/Users/cristobal/anaconda3/envs/pyraf/lib/python2.7/site-packages/pyregion/core.pyc in open(fname)
264 """
265 region_string = _builtin_open(fname).read()
--> 266 return parse(region_string)
267
268
/Users/cristobal/anaconda3/envs/pyraf/lib/python2.7/site-packages/pyregion/core.pyc in parse(region_string)
246 sss2 = _check_wcs(sss1)
247
--> 248 shape_list, comment_list = rp.filter_shape2(sss2)
249 return ShapeList(shape_list, comment_list=comment_list)
250
ValueError: need more than 0 values to unpack
N.B. all this is with pyregion 1.2.0 re: aplpy/aplpy#369
Reactions are currently unavailable