Error drawing circles when coord="wcs"
See original GitHub issueWhile developing for eteq/astrowidgets#1 , I encountered error when drawing circles in in coord='wcs'
mode. Circle radius is set to 20 (I assume it is in pixels but I have no idea if its unit secretly changes when I switch from “data” to “wcs” mode).
Here are the four points I attempted to draw:
RA (deg) | DEC (deg) |
---|---|
3.609821370156458 | -30.378452205494682 |
3.589858963715532 | -30.368501816764578 |
3.5872920549742506 | -30.371258703333265 |
3.58680555297819 | -30.366805584777612 |
What I did was attempting to create a CompoundObject
from four individual Circle
, each one constructed like this:
Circle(x=ra, y=dec, radius=20, coord='wcs', color='cyan')
This is the error I got from Ginga:
...\ginga\canvas\CanvasObject.py:193: RuntimeWarning: invalid value encountered in sqrt
radius = np.sqrt(abs(y2 - y1)**2 + abs(x2 - x1)**2)
2018-07-21 12:13:54,733 | E | ImageView.py:1272 (redraw_now) | Error redrawing image: cannot convert float NaN to integer
2018-07-21 12:13:54,747 | E | ImageView.py:1277 (redraw_now) | Traceback:
File "...\ginga\ImageView.py", line 1258, in redraw_now
self.redraw_data(whence=whence)
File "...\ginga\ImageView.py", line 1303, in redraw_data
self.private_canvas.draw(self)
File "...\ginga\canvas\DrawingMixin.py", line 723, in draw
super(DrawingMixin, self).draw(viewer)
File "...\ginga\canvas\CompoundMixin.py", line 143, in draw
obj.draw(viewer)
File "...\ginga\canvas\CompoundMixin.py", line 143, in draw
obj.draw(viewer)
File "...\ginga\canvas\types\basic.py", line 1044, in draw
cr.draw_circle(cx, cy, cradius)
File "...\ginga\pilw\CanvasRenderPil.py", line 110, in draw_circle
self.cr.circle((cx, cy), cradius, self.pen, self.brush)
File "...\ginga\pilw\PilHelp.py", line 124, in circle
radius = int(radius)
I am using Ginga 2.7.1.dev1944 on Windows 7 64-bit with ipyevents
on Jupyter Lab. In case it matters, Astropy is 3.1.dev22186.
I attempted to code dive a bit but got lost at viewer.renderer
calls. What am I doing wrong here? Any help would be appreciated. Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Incorrect canvas coordinates when drawing a circle [duplicate]
The problem is: We have a big canvas (with scroll) inside a div, with a background image, and if we try to draw...
Read more >arcmap circle draw usage error? - Esri Community
In Arcmap...I create a circle at a particular point in dd. Then I move to a specified radius (or even type it in)....
Read more >Draw Circle with Fixed Radius Error - TIBCO Community
The data function 'Draw Circles with Fixed Radius on Geographic Coordinates' could not be executed.
Read more >Drawing Circle using Image[Graphics[]] - incorrect coordinates
I want to draw a circle with center {x,y} in an image. I use the following code: img = Image[Graphics[{ {Red, Thick, Circle[{100,...
Read more >Problem with circles coordinates - SFML
BTW, I'm not sure what you mean, but I think your problem is that you need to App.draw for every circle (which for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m guessing it is derived from the WCS.
This might be nice; I can imagine cases where I want to specify the location in world coordinates but I want the mark to have a fixed pixel size (e.g. for aperture photometry).
An alternative might be to allow radius to have a unit (even if x, y are still separate unitless arguments).
Currently, for
coord='wcs'
, I passSkyCoord.ra.deg
andSkyCoord.dec.deg
into Ginga.To convert radius from degree to pixels, I would need to know the detector pixel scale (which might or might not be available as metadata in the image). How does Ginga compute this conversion internally?