Monday, February 28, 2005

Ride into the sunset

So I finally got around to writing a program that calculates sunrise and sunset. What a pain in the ass that turned out to be.

There are dozens of websites that will do the calculations for you but I wanted a pseudo-code algorithm. Eventually, I found one from the US Naval Observatory but my trials were far from over.

I learned that there is no single algorithm that will produce acceptable results for all places and for all time. I guess that certain parameters need to be tweaked as you extend your calculations towards dates more than a couple of decades away from some reference point.

Also, I discovered that there is a lot of disagreement between the results of various calculators. This may have something to do with the different definitions of sunrise and sunset. To me, sunset is the moment at which the last visible sliver of the sun slips beneath the horizon but this is actually only one of three possible definitions. What's more, the observed time of sunset/sunrise is effected by atmospheric conditions which can only be tackled probabilistically.

So after a lot of trial and error I managed to get my program to produce results that matched up with the worked example that accompanied the pseudo code. However, the algorithm doesn't really have any explanatory material so I don't really understand the terms (what the hell is "sun's mean anomaly" for instance) and I don't know whether it's trying to account for any atmospheric conditions or for how many years this algorithm will product good results. Lame.

Theoretically, I should be able to bike the few miles to the ocean and check my results against reality but I never seem to have the time and really, I just wrote the thing to know how late I can leave work and still have sunlight enough to get me home so as long as it's correct to within 5 minutes I'm pretty happy.

Wednesday, September 01, 2004

CAT scan followup

The whole thing took about 10 minutes. Including paperwork. The moral of the story is: if at all possible, schedule your hospital visit for a Saturday morning because nobody else wants to be there. I didn't see a single other patient the whole time I was there (which, given the previous paragraph maybe isn't all that remarkable). I actually sort of enjoyed the experience. I didn't have to wait at all. The paperwork consisted of signing a single piece of paper. The CAT scan tech was cool; she punched up the scans on the computer and gave me a tour, pointing out features and problems. It was like a very short field trip. The bad part is that my sinuses are all manner of fucked up. And yet I find this vindicating. Allergies seem to be a kind of medical brick wall. "Oh, you have allergies" my doctors told me. "There's not much to be done about that." No one (except myself) even wanted to figure out what it was that I was allergic to. "Your knowing won't really make much of a difference." So this seems bad enough that they can't just totally ignore it. It's ridiculous that in order to get better I have to get bad enough to warrant real attention. Is this just a guise of the squeaky wheel getting the oil or does it illustrate some deeper problem with the state of medicine? Who knows. I just want to be able to breathe again.

Friday, August 27, 2004

CAT Scan

Tomorrow morning I'm having a CAT scan. From the wikipedia entry on CAT scans...
Sometimes contrast materials such as barium (administered orally or rectally) or intravenous iodinated contrast are used. This is useful to highlight structures such as vessels or intestines that otherwise would be difficult to delineate from their surroundings.
All I can say is thank god there's nothing wrong with my intestines. There are probably worse ways to start your weekend morning than with a barium enema but I'd still rather not. I'm such a nerd: yesterday I pulled one of my computer science books off the shelf and read about the algorithms that are used to convert the raw CAT scan data into the cross sectional view of the anotomy. I don't have any idea why I thought that was a good idea.

Thursday, August 26, 2004

Is this thing on?

I have DSL. I have a blog. I have this third paragraph here. Just sort of hangin' out at the end.