Filling in Degrees in a Circle (Astronomy)
W. eWatson
notvalid2 at sbcglobal.net
Sat Aug 23 19:22:08 EDT 2008
Dennis Lee Bieber wrote:
> On Fri, 22 Aug 2008 23:18:17 -0700, "W. eWatson"
> <notvalid2 at sbcglobal.net> declaimed the following in comp.lang.python:
>
>
>> I'll take a look. I just posted above yours with a more insightful set of
>> data than the first three pointer. Yes, some way of bisecting, or chopping
>> is the trick here. One is just trying to fill in all the gaps with
>> interpolation and produce 360 points to feed to the telescope software. It's
>> sort of like giving someone, and forgetting interpolation here, the sequence
>> 20, 30, blank, 60, 70, 80 and asking for the two missing tens between 30 and
>> 60. 40 and 50, of course.
>
> Presuming the data is an ordered list (in azimuth) of az/el pairs,
> AND that the last measurement does not close the circle (eg: (0, 1),
> (90, 5), (180, 5), (270, 2) ) the first step would be to append a data
> point consisting of the first azimuth data point + 360, but with the
> same elevation value. With normalization at the output, this would work
> if the first data point was not at 0. Then one would perform repeated
> interpolations over pairs of data points, outputting the first pair as
> the first value, and stopping when the azimuth reached the second pair.
>
> Something like (watch out for line wrapping):
>
> -=-=-=-=-=-=-
> import pprint
>
> def gatherPoints():
> pointList = []
> while True:
> cAz = raw_input("Enter Azimuth in integer degrees (blank line to
> exit) : ")
> cAz = cAz.strip()
> if not cAz: break
> az = int(cAz)
> cEl = raw_input("Enter Elevation in real degrees for azimuth %s
> : " % az).strip()
> el = float(cEl)
> pointList.append( (az, el) )
> if pointList:
> pointList.append( (pointList[0][0] + 360, pointList[0][1]) )
> return pointList
>
> def interpolate(start, end, step):
> slope = float(end[1] - start[1]) / (end[0] - start[0])
> iPoints = [ (i, (slope * (i - start[0])) + start[1])
> for i in range(start[0], end[0], step) ]
> return iPoints
>
>
> if __name__ == "__main__":
> points = gatherPoints()
> output = []
> if points:
> for s in range(len(points) - 1):
> output.extend(interpolate(points[s], points[s+1], 1))
> pprint.pprint(output)
> -=-=-=-=-=-=-
Close. A nice looking piece of code. Something for me to learn from. I play
with python on a pretty irregular basis.
The game here is like someone gives you five distinct integer numbers from 1
to 10 in order, and one needs to write a program to fill in the gaps. In my
case, the numbers go from 0 to 359, and I have lots of gaps. I gave a pretty
illustrative example in a post above. 11:10 pm last night. Of course, not
only the gaps from 0 to 359 need to be filled in, but the interpolated
values of the related values need to be obtained. Elevation.
As I just posted to the fellow below you. I decided this morning and roll up
my sleeves and write the program. I plan to take a deeper plunge in the next
month than my so far erratic look over the last 18 or more months It's working.
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet
Web Page: <www.speckledwithstars.net/>
More information about the Python-list
mailing list