Shallow Thoughts : : astro
Akkana's Musings on Open Source Computing and Technology, Science, and Nature.
Sun, 27 Aug 2017
My first total eclipse! The suspense had been building for years.
Dave and I were in Wyoming. We'd made a hotel reservation nine months
ago, by which time we were already too late to book a room in the zone
of totality and settled for Laramie, a few hours' drive from the centerline.
For visual observing, I had my little portable 80mm refractor. But
photography was more complicated. I'd promised myself that for my
first (and possibly only) total eclipse, I wasn't going to miss the
experience because I was spending too much time fiddling with cameras.
But I couldn't talk myself into not trying any photography at all.
Initially, my plan was to use my
as a 500mm camera lens. It had worked okay for the
the 2012 Venus transit.
I spent several weeks before the eclipse in a flurry of creation,
making a couple of
mount, and then wrestling with motorizing the barn-door (which was
a failure because I couldn't find a place to buy decent gears for the motor.
I'm still working on that and will eventually write it up).
I wrote up a plan: what equipment I would use when, a series of
progressive exposures for totality, and so forth.
And then, a couple of days before we were due to leave, I figured I
should test my rig -- and discovered that it was basically impossible
to focus on the sun. For the Venus transit, the sun wasn't that high
in the sky, so I focused through the viewfinder. But for the total
eclipse, the sun would be almost overhead, and the viewfinder nearly
impossible to see. So I had planned to point the Mak at a distant
hillside, focus it, then slip the filter on and point it up to the sun.
It turned out the focal point was completely different through the filter.
With only a couple of days left to go, I revised my plan.
The Mak is difficult to focus under any circumstances. I decided
not to use it, and to stick to my Canon 55-250mm zoom telephoto,
with the camera on a normal tripod. I'd skip the partial eclipse
(I've photographed those before anyway) and concentrate on
getting a few shots of the diamond ring and the corona, running
through a range of exposures without needing to look at the camera
screen or do any refocusing. And since I wasn't going to be usinga
telescope, my nifty solar finders wouldn't work; I designed a new
one out of popsicle sticks to fit in the camera's hot shoe.
We stayed with relatives in Colorado Saturday night, then drove to
Laramie Sunday. I'd heard horror stories of hotels canceling people's
longstanding eclipse reservations, but fortunately our hotel honored
our reservation. WHEW! Monday morning, we left the hotel at 6am in
case we hit terrible traffic. There was already plenty of traffic on
the highway north to Casper, but we turned east hoping for fewer crowds.
A roadsign sign said "NO PARKING ON HIGHWAY." They'd better not try
to enforce that in the totality zone!
When we got to I-25 it was moving and, oddly enough, not particularly
crowded. Glendo Reservoir had looked on the map like a nice spot on
the centerline ... but it was also a state park, so there was a risk
that everyone else would want to go there. Sure enough: although
traffic was moving on I-25 at Wheatland, a few miles north the freeway
came to a screeching halt. We backtracked and headed east toward Guernsey,
where several highways went north toward the centerline.
East of Glendo, there were crowds at every highway pullout and rest
stop. As we turned onto 270 and started north, I kept an eye on
OsmAnd on my phone, where I'd loaded
a GPX file of the eclipse path. When we were within a mile of the
centerline, we stopped at a likely looking pullout. It was maybe 9 am.
A cool wind was blowing -- very pleasant since we were expecting a hot
day -- and we got acquainted with our fellow eclipse watchers as we
waited for first contact.
Our pullout was also the beginning of a driveway to a farmhouse we could
see in the distance. Periodically people pulled up, looking lost,
checked maps or GPS, then headed down the road to the farm. Apparently
the owners had advertised it as an eclipse spot -- pay $35, and you
can see the eclipse and have access to a restroom too! But apparently
the old farmhouse's plumbing failed early on, and some of the people
who'd paid came out to the road to watch with us since we had better
equipment set up.
There's not much to say about the partial eclipse. We all traded views
-- there were five or six scopes at our pullout, including a nice
little H-alpha scope. I snapped an occasional photo through the 80mm
with my pocket camera held to the eyepiece, or with the DSLR through
an eyepiece projection adapter. Oddly, the DSLR photos came out worse
than the pocket cam ones. I guess I should try and debug that at some point.
Shortly before totality, I set up the DSLR on the tripod, focused on a
distant hillside and taped the focus with duct tape, plugged in the
shutter remote, checked the settings in Manual mode, then set the
camera to Program mode and AEB (auto exposure bracketing). I put the
lens cap back on and pointed the camera toward the sun using the
popsicle-stick solar finder. I also set a countdown timer, so I could
press START when totality began and it would beep to warn me when it was
time to the sun to come back out. It was getting chilly by then, with
the sun down to a sliver, and we put on sweaters.
The pair of eclipse veterans at our pullout had told everybody to
watch for the moon's shadow racing toward us across the hills from the
west. But I didn't see the racing shadow, nor any shadow bands.
And then Venus and Mercury appeared and the sun went away.
One thing the photos don't prepare you for is the color of the sky. I
expected it would look like twilight, maybe a little darker; but it
was an eerie, beautiful medium slate blue. With that unworldly
solar corona in the middle of it, and Venus gleaming as bright as
you've ever seen it, and Mercury shining bright on the other side.
There weren't many stars.
We didn't see birds doing anything unusual; as far as I can tell,
there are no birds in this part of Wyoming. But the cows did all
get in a line and start walking somewhere. Or so Dave tells me.
I wasn't looking at the cows.
Amazingly, I remembered to start my timer and to pull off the DSLR's
lens cap as I pushed the shutter button for the diamond-ring shots
without taking my eyes off the spectacle high above. I turned the
camera off and back on (to cancel AEB), switched to M mode, and
snapped a photo while I scuttled over to the telescope, pulled the
filter off and took a look at the corona in the wide-field eyepiece.
So beautiful! Binoculars, telescope, naked eye -- I don't know which
view was best.
I went through my exposure sequence on the camera, turning the dial a
couple of clicks each time without looking at the settings, keeping my
eyes on the sky or the telescope eyepiece. But at some point I happened
to glance at the viewfinder -- and discovered that the sun was drifting
out of the frame. Adjusting the tripod to get it back in the frame
took longer than I wanted, but I got it there and got my eyes
back on the sun as I snapped another photo ...
and my timer beeped.
I must have set it wrong! It couldn't possibly have been two
and a half minutes. It had been 30, 45 seconds tops.
But I nudged the telescope away from the sun, and looked back up -- to
another diamond ring. Totality really was ending and it was time to
The trip back to Golden, where we were staying with a relative, was
hellish. We packed up immediately after totality -- we figured we'd
seen partials before, and maybe everybody else would stay. No such luck.
By the time we got all the equipment packed there was already a steady
stream of cars heading south on 270.
A few miles north of Guernsey the traffic came to a stop. This was to
be the theme of the afternoon. Every small town in Wyoming has a stop sign
or signal, and that caused backups for miles in both directions.
We headed east, away from Denver, to take rural roads down through
eastern Wyoming and Colorado rather than I-25, but even so,
we hit small-town stop sign backups every five or ten miles.
We'd brought the Rav4 partly for this reason. I kept my eyes glued on
OsmAnd and we took dirt roads when we could, skirting the paved
highways -- but mostly there weren't any dirt roads going where we
needed to go. It took about 7 hours to get back to Golden, about twice
as long as it should have taken. And we should probably count
ourselves lucky -- I've heard from other people who took 11 hours to
get to Denver via other routes.
Dave is fond of the quote,
"No battle plan survives contact with the enemy"
(which turns out to be from Prussian military strategist
von Moltke the Elder).
The enemy, in this case, isn't the eclipse; it's time.
Two and a half minutes sounds like a lot, but it goes by like nothing.
Even in my drastically scaled-down plan, I had intended exposures from
1/2000 to 2 seconds (at f/5.6 and ISO 400). In practice, I only made
it to 1/320 because of fiddling with the tripod.
And that's okay. I'm thrilled with the photos I got, and definitely
wouldn't have traded any eyeball time for more photos. I'm more annoyed
that the tripod fiddling time made me miss a little bit of extra looking.
My script actually worked out better than I expected, and I was very
glad I'd done the preparation I had. The script was reasonable, the
solar finders worked really well, and the lens was even in focus
for the totality shots.
Then there's the eclipse itself.
I've read so many articles about solar eclipses as a mystical,
religious experience. It wasn't, for me. It was just an eerily
beautiful, other-worldly spectacle: that ring of cold fire staring
down from the slate blue sky, bright planets but no stars, everything
strange, like nothing I'd ever seen. Photos don't get across what it's
like to be standing there under that weird thing in the sky.
I'm not going to drop everything to become a globe-trotting eclipse
chaser ... but I sure hope I get to see another one some day.
August 21 Total Solar Eclipse in Wyoming.
[ 20:41 Aug 27, 2017
More science/astro |
permalink to this entry |
Mon, 14 Aug 2017
While I was testing various attempts at motorizing my barn-door mount,
trying to get it to track the sun, I had to repeatedly find the sun
in my telescope.
In the past, I've generally used the shadow of the telescope combined
with the shadow of the finderscope. That works, more or less, but it's
not ideal: it doesn't work as well with just a telescope with no finder,
which includes both of the scopes I'm planning to take to the eclipse;
and it requires fairly level ground under the telescope: it doesn't
work if there are bushes or benches in the way of the shadow.
For the eclipse, I don't want to waste any time finding the sun:
I want everything as efficient as possible. I decided to make a little
solar finderscope. One complication, though: since I don't do solar
observing very often, I didn't want to use tape, glue or, worse, drill
holes to mount it.
So I wanted something that could be pressed against the telescope and
held there with straps or rubber bands, coming off again without
leaving a mark. A length of an angled metal from my scrap pile
seemed like a good size to be able to align itself against a small
Then I needed front and rear sights. For the front sight, I wanted a
little circle that could project a bulls-eye shadow onto a paper card
attached to the rear sight. I looked at the hardware store for small
eye-bolts, but no dice. Apparently they don't come that small.I
settled for the second-smallest size of screw eye.
The screw eye, alas, is meant to screw into wood, not metal. So I
cut a short strip of wood a reasonable size to nestle into the inside
of the angle-iron. (That ripsaw Dave bought last year sure does come
in handy sometimes.) I drilled some appropriately sized holes and
fastened screw eyes on both ends, adding a couple of rubber grommets
as spacers because the screw eyes were a little too long and I didn't
want the pointy ends of the screws getting near my telescope tube.
I added some masking tape on the sides of the angle iron so it wouldn't
rub off the paint on the telescope tube, then bolted a piece of
cardboard cut from an old business card to the rear screw eye.
Voila! A rubber-band-attached solar sight that took about an hour to make.
Notice how the shadow of the front sight exactly fits around the rear
sight: you line up the shadow with the rear sight to point the scope.
It seems to work pretty well, and it should be adaptable to any
telescope I use.
I used a wing nut to attach the rear cardboard: that makes it easy to
replace it or remove it. With the cardboard removed,
the sight might even work for night-time astronomy viewing. That is,
it does work, as long as there's enough ambient light to see the rings.
Hmm... maybe I should paint the rings with glow-in-the-dark paint.
[ 15:25 Aug 14, 2017
More science/astro |
permalink to this entry |
Thu, 10 Aug 2017
I've been meaning forever to try making a "barn door" tracking mount.
Used mainly for long-exposure wide-field astrophotography, the barn door
mount, invented in 1975, is basically two pieces of wood with a hinge.
The bottom board mounts on a tripod and is pointed toward the North Star;
"opening" the hinge causes the top board to follow the motion of the
sky, like an equatorial telescope mount. A threaded rod and a nut
control the angle of the "door", and you turn the nut manually every
so often. Of course, you can also drive it with a motor.
We're off to view the eclipse in a couple of weeks.
Since it's my first total eclipse, my plan is to de-emphasize
photography: especially during totality, I want to experience the
eclipse, not miss it because my eyes are glued to cameras and timers
and other equipment. But I still want to take photos every so often.
Constantly adjusting a tripod to keep the sun in frame is another
hassle that might keep my attention away from the eclipse. But real
equatorial mounts are heavy and a time consuming to set up;
since I don't know how crowded the area will be, I wasn't
planning to take one. Maybe a barn door would solve that problem.
Perhaps more useful, it would mean that my sun photos would all be
rotated approximately the right amount, in case I wanted to make an
animation. I've taken photos of lunar and partial solar eclipses, but
stringing them together into an animation turned out to be too much
hassle because of the need to rotate and position each image.
I've known about barn-door mounts since I was a kid, and I knew the
basic theory, but I'd never paid much attention to the details. When I
searched the web, it sounded complicated -- it turned out there are
many types that require completely different construction techniques.
The best place to start (I found out after wasting a lot of time on
other sites) is the
article on "Barn door tracker", which gives a wonderfully clear
overview, with photos, of the various types. I had originally been
planning a simple tangent or isosceles type; but when I read
construction articles, it seemed that those seemingly simple types
might not be so simple to build: the angle between the threaded rod
and the boards is always changing, so you need some kind of a pivot.
Designing the pivot looked tricky. Meanwhile, the pages I found on
curved-rod mounts all insisted that bending the rod was easy, no
trouble at all. I decided to try a curved-rod mount first.
The canonical reference is a 2015 article by Gary Seronik:
Tracking Platform for Astrophotography. But I found three other good
"Making a Curve Bolt Barn Door",
Cloudy Nights discussion thread "Motorized Barn Door Mount Kit",
Pond Photography's "Barn Door Tracker".
I'm not going to reprise all their construction details, so refer to
those sites if you try making your own mount.
The crucial parts are a "piano hinge", a long hinge that eliminates
the need to line up two or more hinges, and the threaded rod.
Buying a piano hinge in the right size proved impossible locally,
but the folks at Metzger's assured me that piano hinges can be cut,
so I bought one longer than I needed and cut it to size.
I used a 1/4-20 rod, which meant (per the discussions in the Cloudy
Nights discussion linked above) that a 11.43-inch radius from the
hinge to the holes the rod passes through would call for the nut to
turn at a nice round number of 1 RPM.
I was suspicious of the whole "it's easy to bend the threaded rod ina
11.43-inch circle" theory, but it turned out to be true. Draw the
circle you want on a sheet of newspaper, put on some heavy gloves
and start bending, frequently comparing your rod to the circle you drew.
You can fine-tune the curvature later.
I cut my boards, attached the hinge, measured about 11.4" and drilled
a hole for the threaded rod. The hole needed to be a bit bigger than
5/8" to let the curved rod pass through without rubbing. Attach the
curved rod to the top wood piece with a couple of nuts and some
washers, and then you can fine-tune the rod's curvature, opening and
closing the hinge and re-bending the rod a little in any place it rubs.
A 5/8" captive nut on the top piece lets you attach a tripod head
which will hold your camera or telescope. A 1/4" captive nut on the
bottom piece serves to attach the mount to a tripod -- you need a
1/4", not 3/8": the rig needs to mount on a tripod head, not just the
legs, so you can align the hinge to the North Star. (Of course, you
could build a wedge or your own set of legs, if you prefer.) The 3/4"
plywood I was using turned out to be thicker than the captive nuts, so
I had to sand the wood thinner in both places. Maybe using half-inch
plywood would have been better.
The final piece is the knob/nut you'll turn to make the mount track.
I couldn't find a good 1/4" knob for under $15.
A lot of people make a wood circle and mount the nut in
the center, or use a gear so a motor can drive the mount. I looked
around at things like jam-jar lids and the pile of metal gears and
sprinkler handles in my welding junkpile, but I didn't see anything
that looked quite right, so I decided to try a wing nut just for
testing, and worry about the knob later. Turns out a wing nut works
wonderfully; there's no particular need for anything else if you're
driving your barn-door manually.
Testing time! I can't see Polaris from my deck, and I was too lazy to
set up anywhere else, so I used a protractor to set the hinge angle to
roughly 36° (my latitude), then pointed it approximately north.
I screwed my Pro-Optic 90mm Maksutov (the scope I plan to use for
my eclipse photos) onto the ball head and pointed it at the moon
as soon as it rose. With a low power eyepiece (20x), turning the wing
nut kept the moon more or less centered in the field for the next
half-hour, until clouds covered the moon and rain began threatening.
I didn't keep track of how many turns I was making, since I knew the
weather wasn't going to allow a long session, and right now I'm not
targeting long-exposure photography, just an easy way of keeping an
object in view.
A good initial test! My web searches, and the discovery of all
those different types of barn-door mounts and pivots and flex
couplings and other scary terms, had seemed initially daunting.
But in the end, building a barn-door mount was just as easy as
people say it is, and I finished it in a day.
And what about a motor? I added one a few days later, with a stepper
and an Arduino. But that's a separate article.
[ 19:25 Aug 10, 2017
More science/astro |
permalink to this entry |
Sat, 18 Jun 2016
I haven't had a chance to do much astronomy since moving to New Mexico,
despite the stunning dark skies. For one thing, those stunning dark
skies are often covered with clouds -- New Mexico's dramatic skyscapes
can go from clear to windy to cloudy to hail or thunderstorms and back
to clear and hot over the course of a few hours. Gorgeous to watch,
but distracting for astronomy, and particularly bad if you want to
plan ahead and observe on a particular night. The Pajarito Astronomers'
monthly star parties are often clouded or rained out, as was the PEEC
Nature Center's moon-and-planets star party last week.
That sort of uncertainty means that the best bet is a so-called
"quick-look scope": one that sits by the door, ready to be hauled
out if the sky is clear and you have the urge.
Usually that means some kind of tiny refractor; but it can also
mean leaving a heavy mount permanently set up (with a cover to protect
it from those thunderstorms) so it's easy to carry out a telescope
tube and plunk it on the mount.
I have just that sort of scope sitting in our shed: an old, dusty Cave
Astrola 6" Newtonian on an equatorian mount.
My father got it for me on my 12th birthday.
Where he got the money for such a princely gift -- we didn't have
much in those days -- I never knew, but I cherished that telescope,
and for years spent most of my nights in the backyard peering through
the Los Angeles smog.
Eventually I hooked up with older astronomers (alas, my father had
passed away) and cadged rides to star parties out in the Mojave desert.
Fortunately for me, parenting standards back then allowed a lot
more freedom, and my mother was a good judge of character and let
me go. I wonder if there are any parents today who would let their
daughter go off to the desert with a bunch of strange men? Even back
then, she told me later, some of her friends ribbed her -- "Oh,
'astronomy'. Suuuuuure. They're probably all off doing drugs in the desert."
I'm so lucky that my mom trusted me (and her own sense of the guys
in the local astronomy club) more than her friends.
The Cave has followed me through quite a few moves, heavy, bulky and
old fashioned as it is; even when I had scopes
that were bigger, or more portable, I kept it for the sentimental value.
But I hadn't actually set it up in years. Last week, I assembled the
heavy mount and set it up on a clear spot in the yard. I dusted off
the scope, cleaned the primary mirror and collimated everything,
replaced the finder which had fallen out somewhere along the way,
set it up ... and waited for a break in the clouds.
I'm happy to say that the optics are still excellent.
As I write this (to be posted later),
I just came in from beautiful views of Hyginus Rille and the
Alpine Valley on the moon. On Jupiter the Great Red Spot was just
rotating out. Mars, a couple of weeks before opposition, is still
behind a cloud (yes, there are plenty of clouds). And now the clouds
have covered the moon and Jupiter as well. Meanwhile, while I wait for
a clear view of Mars, a bat makes frenetic passes overhead, and
something in the junipers next to my observing spot is making rhythmic
crunch, crunch, crunch sounds. A rabbit chewing something tough?
Or just something rustling in the bushes?
I just went out again,
and now the clouds have briefly uncovered Mars. It's the first good look
I've had at the Red Planet in years. (Tiny achromatic refractors really
don't do justice to tiny, bright objects.) Mars is the most difficult
planet to observe: Dave liks to talk about needing to get your "Mars
eyes" trained for each Mars opposition, since they only come every two
years. But even without my "Mars eyes", I had no trouble seeing the
North pole with dark Acidalia enveloping it, and, in the south, the
sinuous chain of Sini Sabaeus, Meridiani, Margaritifer, and Mare Erythraeum.
(I didn't identify any of these at the time; instead, I dusted off my
sketch pad and sketched what I saw, then compared it with XEphem's
Mars view afterward.)
I'm liking this new quick-look telescope -- not to mention the
childhood memories it brings back.
[ 08:53 Jun 18, 2016
More science/astro |
permalink to this entry |
Thu, 01 Oct 2015
The lunar eclipse on Sunday was gorgeous. The moon rose already in
eclipse, and was high in the sky by the time totality turned the
moon a nice satisfying deep red.
I took my usual slipshod approach to astrophotography. I had my 90mm
f/5.6 Maksutov lens set up on the patio with the camera attached,
and I made a shot whenever it seemed like things had changed
significantly, adjusting the exposure if the review image looked
like it might be under- or overexposed, occasionally attempting
to refocus. The rest of the time I spent socializing with friends,
trading views through other telescopes and binoculars, and enjoying an
apple tart a la mode.
So the images I ended up with aren't all they could be --
not as sharply focused as I'd like (I never have figured out a
good way of focusing the Rebel on astronomy images) and rather
Still, I took enough images to be able to put together a couple of
animations: one of the lovely moonrise over the mountains, and one
of the sequence of the eclipse through totality.
Since the 90mm Mak was on a fixed tripod, the moon drifted through the
field and I had to adjust it periodically as it drifted out.
So the main trick to making animations was aligning all the moon
images. I haven't found an automated way of doing that, alas,
but I did come up with some useful GIMP techniques, which I'm in
the process of writing up as a tutorial.
Once I got the images all aligned as layers in a GIMP image,
I saved them as an animated GIF -- and immediately discovered that
the color error you get when converting to an indexed GIF image
loses all the beauty of those red colors. Ick!
loads images one by one at fixed intervals. That worked a lot better
than the GIF animation, plus it lets me add a Start/Stop button.
animation function) here:
Lunar eclipse animations
[ 12:55 Oct 01, 2015
More science/astro |
permalink to this entry |
Fri, 24 Oct 2014
We had perfect weather for the partial solar eclipse yesterday.
I invited some friends over for an eclipse party -- we set up
a couple of scopes with solar filters, put out food and drink
and had an enjoyable afternoon.
And what views! The sunspot group right on the center of the sun's disk
was the most large and complex I'd ever seen, and there were some much
smaller, more subtle spots in the path of the eclipse. Meanwhile, the
moon's limb gave us a nice show of mountains and crater rims silhouetted
against the sun.
I didn't do much photography, but I did hold the point-and-shoot up to
the eyepiece for a few shots about twenty minutes before maximum eclipse,
and was quite pleased with the result.
An excellent afternoon. And I made too much blueberry bread and
far too many oatmeal cookies ... so I'll have sweet eclipse memories
for quite some time.
[ 09:15 Oct 24, 2014
More science/astro |
permalink to this entry |
Thu, 31 Jul 2014
Part II: Predicting Conjunctions
After I'd written a basic
to calculate when planets will be visible,
the next step was predicting conjunctions, times when two or more
planets are close together in the sky.
Finding separation between two objects is easy in PyEphem: it's just one
line once you've set up your objects, observer and date.
p1 = ephem.Mars()
p2 = ephem.Jupiter()
observer = ephem.Observer() # and then set it to your city, etc.
observer.date = ephem.date('2014/8/1')
So all I have to do is loop over all the visible planets and see when
the separation is less than some set minimum, like 4 degrees, right?
Well, not really. That tells me if there's a conjunction between
a particular pair of planets, like Mars and Jupiter. But the really
interesting events are when you have three or more objects close
together in the sky. And events like that often span several days.
If there's a conjunction of Mars, Venus, and the moon, I don't want to
print something awful like
Conjunction between Mars and Venus, separation 2.7 degrees.
Conjunction between the moon and Mars, separation 3.8 degrees.
Conjunction between Mars and Venus, separation 2.2 degrees.
Conjunction between Venus and the moon, separation 3.9 degrees.
Conjunction between the moon and Mars, separation 3.2 degrees.
Conjunction between Venus and the moon, separation 4.0 degrees.
Conjunction between the moon and Mars, separation 2.5 degrees.
... and so on, for each day. I'd prefer something like:
Conjunction between Mars, Venus and the moon lasts from Friday through Sunday.
Mars and Venus are closest on Saturday (2.2 degrees).
The moon and Mars are closest on Sunday (2.5 degrees).
At first I tried just keeping a list of planets involved in the conjunction.
So if I see Mars and Jupiter close together, I'd make a list [mars,
jupiter], and then if I see Venus and Mars on the same date, I search
through all the current conjunction lists and see if either Venus or
Mars is already in a list, and if so, add the other one. But that got
out of hand quickly. What if my conjunction list looks like
[ [mars, venus], [jupiter, saturn] ] and then I see there's also
a conjunction between Mars and Jupiter? Oops -- how do you merge
those two lists together?
The solution to taking all these pairs and turning them into a list
of groups that are all connected actually lies in graph theory: each
conjunction pair, like [mars, venus], is an edge, and the trick is to
find all the connected edges. But turning my list of conjunction pairs
into a graph so I could use a pre-made graph theory algorithm looked
like it was going to be more code -- and a lot harder to read and less
maintainable -- than making a bunch of custom Python classes.
I eventually ended up with three classes:
ConjunctionPair, for a single conjunction observed between two bodies
on a single date;
Conjunction, a collection of ConjunctionPairs covering as many bodies
and dates as needed;
and ConjunctionList, the list of all Conjunctions currently active.
That let me write methods to handle merging multiple conjunction
events together if they turned out to be connected, as well as a
method to summarize the event in a nice, readable way.
So predicting conjunctions ended up being a lot more code than I
expected -- but only because of the problem of presenting it neatly
to the user. As always, user interface represents the hardest part
The working script is on github at
[ 19:57 Jul 31, 2014
More science/astro |
permalink to this entry |
Wed, 23 Jul 2014
Part 1: Basic Planetary Visibility
All through the years I was writing the planet observing column for
the San Jose Astronomical Association, I was annoyed at the lack of places
to go to find out about upcoming events like conjunctions, when two or
more planets are close together in the sky. It's easy to find out
about conjunctions in the next month, but not so easy to find sites
that will tell you several months in advance, like you need if you're
writing for a print publication (even a club newsletter).
For some reason I never thought about trying to calculate it myself.
I just assumed it would be hard, and wanted a source that could
spoon-feed me the predictions.
The best source I know of is the
RASC Observer's Handbook,
which I faithfully bought every year and checked each month so I could
enter that month's events by hand. Except for January and February, when I
didn't have the next year's handbook yet by the time my column went
to press and I was on my own.
I have to confess, I was happy to get away from that aspect of the
column when I moved.
In my new town, I've been helping the local nature center with their
website. They had some great pages already, like a
Blooming Now? page that keeps track
of which flowers are blooming now and only shows the current ones.
I've been helping them extend it by adding features like showing only
flowers of a particular color, separating the data into CSV databases
so it's easier to add new flowers or butterflies, and so forth.
Eventually we hope to build similar databases of birds, reptiles and
And recently someone suggested that their astronomy page could use
some help. Indeed it could -- it hadn't been updated in about five years.
So we got to work looking for a source of upcoming astronomy events
we could use as a data source for the page, and we found sources for
a few things, like moon phases and eclipses, but not much.
Someone asked about planetary conjunctions, and remembering
how I'd always struggled to find that data, especially in months when
I didn't have the RASC handbook yet, I got to wondering about
calculating it myself.
Obviously it's possible to calculate when a planet will
be visible, or whether two planets are close to each other in the sky.
And I've done some programming with
PyEphem before, and found
it fairly easy to use. How hard could it be?
Note: this article covers only the basic problem of predicting when
a planet will be visible in the evening.
A followup article will discuss the harder problem of conjunctions.
Calculating planet visibility with PyEphem
The first step was figuring out when planets were up.
That was straightforward. Make a list of the easily visible planets
(remember, this is for a nature center, so people using the page
aren't expected to have telescopes):
planets = [
Then we need an observer with the right latitude, longitude and
elevation. Elevation is apparently in meters, though they never bother
to mention that in the PyEphem documentation:
observer = ephem.Observer()
observer.name = "Los Alamos"
observer.lon = '-106.2978'
observer.lat = '35.8911'
observer.elevation = 2286 # meters, though the docs don't actually say
Then we loop over the date range for which we want predictions.
For a given date d, we're going to need to know the time of sunset,
because we want to know which planets will still be up after nightfall.
observer.date = d
sunset = observer.previous_setting(sun)
Then we need to loop over planets and figure out which ones are visible.
It seems like a reasonable first approach to declare that any planet
that's visible after sunset and before midnight is worth mentioning.
Now, PyEphem can tell you directly the rising and setting times of a planet
on a given day. But I found it simplified the code if I just checked
the planet's altitude at sunset and again at midnight. If either one
of them is "high enough", then the planet is visible that night.
(Fortunately, here in the mid latitudes we don't have to
worry that a planet will rise after sunset and then set again before
midnight. If we were closer to the arctic or antarctic circles, that
would be a concern in some seasons.)
min_alt = 10. * math.pi / 180.
for planet in planets:
observer.date = sunset
if planet.alt > min_alt:
print planet.name, "is already up at sunset"
Easy enough for sunset. But how do we set the date to midnight on
that same night? That turns out to be a bit tricky with PyEphem's
date class. Here's what I came up with:
midnight = list(observer.date.tuple())
midnight[3:6] = [7, 0, 0]
observer.date = ephem.date(tuple(midnight))
if planet.alt > min_alt:
print planet.name, "will rise before midnight"
What's that 7 there? That's Greenwich Mean Time when it's midnight in
our time zone. It's hardwired because this is for a web site meant for
locals. Obviously, for a more general program, you should get the time
zone from the computer and add accordingly, and you should also be
smarter about daylight savings time and such. The PyEphem documentation,
fortunately, gives you tips on how to deal with time zones.
(In practice, though, the rise and set times of planets on a given
day doesn't change much with time zone.)
And now you have your predictions of which planets will be visible
on a given date. The rest is just a matter of writing it out into
your chosen database format.
In the next article, I'll cover planetary and lunar
conjunctions -- which were superficially very simple, but turned out
to have some tricks that made the programming harder than I expected.
[ 21:32 Jul 23, 2014
More science/astro |
permalink to this entry |