geometry - Slicing a circle in equal segments, Python -
i have set of close of 10,000 points on sky. plotted using ra (right ascension) , dec (declination) on sky. when plotted, take shape of circle.
what slice circle 8 equal parts , remove each part 1 @ time , calculations using remaining parts.
to came illustration in mind, i.e. slicing them using arcs.
i know equation of arc given by:
s = r * theta
where
r --> radius theta --> angle (in our case 45 degrees)
i somehow like:
slice1 = [] a,b in zip(ra,dec): if a>some value , a<some value , b>some value , b<some value: slice1.append(a,b)
if square, becomes easy, , above equation can applied.
so once have slice, can numpy.where()
find out rest of circle.
i can slice 4 slices mentioning min(ra),max(ra),min(dec) , max(dec)
. 1 such example when first quadrant give me this:
ra>0.0 , ra<max(ra) dec>0.0 , dec<max(dec)
i don't know how go doing in case (i.e. 8 quadrants!!), wherein i have x,y coordinates of data points!!
you can compute array of slice numbers directly with numpy
operators:
sliceno = numpy.int32((pi + numpy.arctan2(y, x)) * (n / (2*pi)))
meaning:
- compute angle
-pi
...pi
each pointarctan2
- shift
pi
make positive interval - rescale
0
..n-1
- convert integer
Comments
Post a Comment