[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

[vsnet-chat 5459] JD->HJD



We had some discussions about this conversion a while back. Just 
wanted to let you know that there is a really nice perl module 
to do this calculation now thanks to Robert Creager with help 
from Patrick Wallace. It is accurate, fast and easy to use (if 
you are comfortable with Perl). The module is called 
Astro::Time::HJD and it is linked here:

http://vsnet.logicalchaos.org/perl/

I don't recall whether Robert announced this on these lists or 
not, so I hope I'm not being redundant.

Below is a little perl script I wrote that will do the 
calculation for a file of observations. It demonstrates how easy 
this is to use.

Cheers,
Michael Koppelman
http://vsnetlolife.com/astronomy/


#!/usr/local/bin/perl

use strict;

use Astro::Time::HJD qw( correction );

my $ra = $ARGV[0];
my $dec = $ARGV[1];
my $file = $ARGV[2];

if( ! $ra || ! $dec || ! $file ) {
         print "usage: $0 ra dec filename\n";
         exit;
}

open( FILE, $file ) || die "Can't open $file: $!\n";
while( my $line = <FILE> ) {
     chop( $line );
         my( $jd, @data ) = split( /\s+/, $line );
         if( $jd !~/^\d/ ) { next; }
         $jd += correction( $jd, $ra, $dec );
         print "$jd";
         foreach my $d (@data ) {
                 print " $d";
         }
         print "\n";
}
exit(0);

VSNET Home Page

Return to Daisaku Nogami


vsnet-adm@kusastro.kyoto-u.ac.jp