[Numpy-discussion] [AstroPy] Rotating and Transforming Vectors--Flight Path of a Celestial Body
Thu Dec 17 23:39:36 CST 2009
It's starting to come back to me. I found a few old graphics books that
get into transformation matrices and such. Yes, earth centered. I ground
out some code with geometry and trig that at least gets the first point
on the path right. I think I can probably apply a rotation around the
x-axis several times with a 1/2 degree rotation for each step towards
the north to get the job done.
I'm still fairly fresh with Python, and found a little bit of info in a
Tentative numpy tutorial. I found this on getting started with matrices:
from numpy import matrix
Apparently matrix is a class in numpy, and there are many others, linalg
I think is one. How
does one find all the classes, and are there rules that keep them apart.
It was tempting to add
import numpy in addition to the above, but how is what is in numpy
different that the classes?
Is numpy solely class driven? That is, if one does a from as above to
get all the classes, does
it give all the capabilities that just using import numpy does?
Anne Archibald wrote:
> 2009/12/17 Wayne Watson <firstname.lastname@example.org>:
>> I'm just getting used to the math and numpy library, and have begun
>> working on a problem of the following sort.
>> Two observing stations are equidistant, 1/2 degree, on either side of a
>> line of longitude of 90 deg west, and both are at 45 deg latitude. Given
>> the earth's circumference as 25020 miles, a meteor is 60 miles above the
>> point between the two sites. That is, if you were standing at long
>> 90deg and lat 45 deg, the meteor would be that high above you. 70 miles
>> along the long line is 1 degree, so the stations are 70 miles apart. I
>> want to know the az and el of the meteor from each station. With some
>> geometry and trig, I've managed to get that first point; however, I can
>> see moving the meteor say, 1/2 deg, along its circular path towards the
>> north pole is going to require more pen and pencil work to get the az/el
>> for it.
>> Long ago in a faraway time, I used to do this stuff. It should be easy
>> to rotate the vector to the first point 1/2 deg northward, and find the
>> vector there, then compute the new az and el from each station. Maybe.
>> I'm just beginning to look at the matrix and vector facilities in numpy.
>> Maybe someone can comment on how this should be done, and steer me
>> towards what I need to know in numpy.
> You may find that the problem grows drastically easier if you work as
> much as possible in so-called earth-centered earth-fixed coordinates
> (sometimes called XYZ) coordinates. These are a rectilinear coordinate
> system that rotates with the earth, with the Z axis through the north
> pole and the X axis through the equator at the Greenwich meridian.
> It's kind of horrible for getting altitudes, since the Earth is sort
> of pear-shaped, but it makes the 3D geometry much simpler.
> If you don't go this route, I'd recommend picking one station and
> defining a rectilinear coordinate system based on its north and
> vertical vectors. The north and vertical vectors of the other station
> will be at somewhat funny angles (unless you can get away with
> treating the Earth as flat between the two), but whatever rectilinear
> coordinates you choose, a dot product lets you calculate vector
> lengths and angles between them, and a cross product lets you build
> vectors orthogonal to a given pair. So, for example, if your station
> has north vector N and up vector U, you can get its east vector as
> E=cross(N,U) (then normalize it); if you want to convert an absolute
> north to a local north (i.e. one that is horizontal) you can do
> N=cross(E,U) (and normalize it). Then you can get the azimuth of a
> vector V using dot(N,V)/sqrt(dot(V,V)) and dot(E,V)/sqrt(dot(V,V)).
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
"... humans'innate skills with numbers isn't much
better than that of rats and dolphins."
-- Stanislas Dehaene, neurosurgeon
Web Page: <www.speckledwithstars.net/>
More information about the NumPy-Discussion