mjuric/lsd — Issue #12: bounds fails at specific galactic location
Author: ericmorganson
Created: 2012-02-07 10:05:16+00:00
State: open

I am finding that the bounds box rectangle(302.4,-34,304.8,-32,coordsys=galaxy) fails to bound queries. The relevant code:

self.bounds=[l1,b1,l2,b2]
bounds_xy = bounds.rectangle(*(self.bounds),coordsys='gal')
bounds_t = bounds.intervalset((-np.inf, np.inf))
rows=db.query(fields+' FROM '+dbname+' WHERE '+where).fetch(bounds=[(bounds_xy, bounds_t)])

By "fail" I mean thequery is over 2392 elements instead of 2-4 that I would expect. It takes forever and makes a huge fits file. So I think it really is querying the whole sky.

The funny thing, this code is iterating chunk by chunk. It works perfectly in b > 10 region and -90 < b < -34 region (an probably everywhere else). So I think this must be a problem in the way LSD converts galactic coordinates at this one location. When I print out the xy bounds, I get:

Polygon:
<0:Hole : [0:0.99, 0.96] [1:0.99, 0.96] [2:0.99, 0.96] [3:0.99, 0.96] [4:0.99, 0.95] [5:0.99, 0.95] [6:0.99, 0.95] [7:0.99, 0.95] [8:0.99, 0.95] [9:0.99, 0.95] [10:0.99, 0.95] [11:0.99, 0.95] [12:0.99, 0.95] [13:0.99, 0.95] [14:0.99, 0.95] [15:0.99, 0.94] [16:0.99, 0.94] [17:0.99, 0.94] [18:0.99, 0.94] [19:0.99, 0.94] [20:0.99, 0.94] [21:0.99, 0.94] [22:0.99, 0.94] [23:0.99, 0.94] [24:0.99, 0.94] [25:0.99, 0.94] [26:0.99, 0.94] [27:0.99, 0.94] [28:0.99, 0.94] [29:0.99, 0.93] [30:0.99, 0.93] [31:0.99, 0.93] [32:0.99, 0.93] [33:0.99, 0.93] [34:0.99, 0.93] [35:0.99, 0.93] [36:1.0, 0.93] [37:1.0, 0.93] [38:1.0, 0.93] [39:1.0, 0.93] [40:1.0, 0.93] [41:1.0, 0.93] [42:1.0, 0.93] [43:1.0, 0.93] [44:1.0, 0.92] [45:1.0, 0.95] [46:1.0, 0.95] [47:1.0, 0.95] [48:1.0, 0.95] [49:1.0, 0.95] [50:1.0, 0.95] [51:1.0, 0.95] [52:1.0, 0.95] [53:1.0, 0.95] [54:0.99, 0.95] [55:0.99, 0.95] [56:0.99, 0.95] [57:0.99, 0.95] [58:0.99, 0.96] [59:0.99, 0.96] [60:0.99, 0.96] [61:0.99, 0.96] [62:0.99, 0.96]>
<1:Hole : [0:1.0, 0.92] [1:1.0, -0.93] [2:1.0, -0.93] [3:1.0, -0.93] [4:1.0, 0.92]>
<2:Hole : [0:1.0, -0.93] [1:1.0, -0.93] [2:1.0, -0.93] [3:1.0, -0.93] [4:1.0, -0.93] [5:1.0, -0.93] [6:1.0, -0.93] [7:1.0, -0.94] [8:1.0, -0.94] [9:1.0, -0.94] [10:1.0, -0.94] [11:1.0, -0.94] [12:1.0, -0.94] [13:1.0, -0.94] [14:1.0, -0.94] [15:1.0, -0.94] [16:1.0, -0.95] [17:1.0, -0.95] [18:1.0, -0.95] [19:1.0, -0.95] [20:1.0, -0.95] [21:1.0, -0.95] [22:1.0, -0.95] [23:1.0, -0.95]>
<3:Contour: [0:1.0, -1.0] [1:-1.0, -1.0] [2:-1.0, 1.0] [3:1.0, 1.0]>

But I don't know how to interpret that.