Filling in Degrees in a Circle (Astronomy)

W. eWatson notvalid2 at sbcglobal.net
Sun Aug 24 05:47:14 CEST 2008


tom wrote:
> W. eWatson wrote:
>> tom wrote:
>>> W. eWatson wrote:
>>>> The other night I surveyed a site for astronomical use by measuring 
>>>> the altitude (0-90 degrees above the horizon) and az (azimuth, 0 
>>>> degrees north clockwise around the site to 360 degrees, almost north 
>>>> again) of obstacles, trees. My purpose was to feed this profile of 
>>>> obstacles (trees) to an astronomy program that would then account 
>>>> for not sighting objects below the trees.
>>>>
>>>> When I got around to entering them into the program by a file, I 
>>>> found it required the alt at 360 azimuth points in order from 0 to 
>>>> 360 (same as 0). Instead I have about 25 points, and expected the 
>>>> program to be able to do simple linear interpolation between those.
>>>>
>>>> Is there some simple operational device in Python that would allow 
>>>> me to create an array (vector) of 360 points from my data by 
>>>> interpolating between azimuth points when necessary? All my data I 
>>>> rounded to the nearest integer. Maybe there's an interpolation 
>>>> operator?
>>>>
>>>> As an example, supposed I had made 3 observations: (0,0) (180,45) 
>>>> and (360,0). I would want some thing like (note the slope of the 
>>>> line from 0 to 179 is 45/180 or 0.25):
>>>> alt: 0, 0.25, 0.50, 0.75, ... 44.75, 45.0
>>>> az : 0, 1,    2,    3,              180
>>>>
>>>> Of course, I don't need the az.
>>>>
>>>
>>>
>>> If I understand you right, I think using interpolation as provided by 
>>> scipy would do what you need.
>>>
>>> Here's an example:
>>>
>>> from scipy.interpolate.interpolate import interp1d
>>>
>>> angles = [0, 22, 47.5, 180, 247.01, 360]
>>> altitudes = [18, 18, 26, 3, 5, 18]
>>>
>>> desired_angles = range(0, 361)
>>>
>>> skyline = interp1d(angles, altitudes, kind="linear")
>>> vals = skyline(desired_angles)
>>>
>>> # that is, vals will be the interpolated altitudes at each of the
>>> # desired angles.
>>>
>>> if 1:  # plot this out with matplotlib
>>>     import pylab as mx
>>>     mx.figure()
>>>     mx.plot(angles, altitudes, 'x')
>>>     mx.plot(desired_angles, vals)
>>>     mx.show()
>> 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.
>>
>> The above looks like it's on the right track. Is scipy some collection 
>> of astro programs? mx is a graphics character plot?
>>
>> I just hauled it into IDLE and tried executing it.
>>     from scipy.interpolate.interpolate import interp1d
>> ImportError: No module named scipy.interpolate.interpolate
>>
>> Apparently, something is missing.
>>
>> I posted a recent msg a bit higher that will probably go unnoticed, so 
>> I'll repeat most of it. How do I get my py code into some executable 
>> form so that Win users who don't have python can execute it?
>>
>>
> 
> Both scipy and matplotlib are not part of the standard Python 
> distribution so they would need to be installed separately.  Scipy is 
> useful for scientific data analysis, and matplotlib is useful for making 
> plots.
> 
> Since you want to wrap everything into a  Windows executable, it's 
> probably easiest for you not to use scipy.  At the least, I suspect it 
> would make your executable file much larger, but I've never made a 
> Windows executable so I don't know the details.
> 
> As for making an executable, I'm not the one to ask, but googling leads 
> to this:
> http://effbot.org/pyfaq/how-can-i-create-a-stand-alone-binary-from-a-python-script.htm 
> 
> which looks like a good place to start.
> 
> Tom
> 
What modules do I need to use pylab? I've installed scipy and numpy.

-- 
            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