What a revolting development this is

One of the most important tasks in science is to browse through your results looking for oddities. You never know what might pop out at you. Last night, while rummaging through the data, I found some disturbing problems with the data from one of the cameras. The problem was restricted to camera AL50R. Apparently my spherical trig calculations had a problem dealing with azimuths close to 180º. This is not an uncommon problem; whenever you have a long sequence of complex trig calculations, angles close to the cardinal points can produce bad results. That’s because the values of some trig functions reach zero at those cardinal points. If your trig equation divides by one of these values, and it approaches a cardinal point, the overall value skyrockets. Typically this is suppose to be balance by the numerator, but things can go wrong. For example, consider this simple expression:

(sin (beta) - cos (gamma)) / sin (delta)

In many spherical trig calculations, a formula like this might be guaranteed to produce proper results – theoretically. But suppose that beta and gamma are at almost right angles. That means that the numerator of the expression will be small. If at the same time, the value of delta is, say, 179.9º, then sin(delta) = 0.00175. Dividing a tiny numerator by a tiny denominator can produce quirky results. That’s the problem that somehow hit me when I was doing the calculations for camera AL50R. I did not have any similar problems with the northern camera (AR50F), which was looking at azimuths close to zero. Theoretically, the problems I encountered at azimuth 180º should have been mirrored at azimuth 0º, but apparently I made corrections to the code sometime between running the two cameras.

Here’s how the problem manifested itself: the azimuths recorded for the flares of a single Leonid would scatter wildly around 180º. For example, the azimuths for the flares might read like this:

178.7º

179.1º

251.3º

33.5º

198.6º

180.7º

181.1º

In other words, in making the transition across the 180º boundary, the calculations went kooky. So I had to write special code to correct the problem in that data. It took me all day to get it right, but now I’ve fixed the problem and can move on. Just one more day of scientific effort.