IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26048


Ignore:
Timestamp:
Nov 5, 2009, 2:09:48 PM (17 years ago)
Author:
bills
Message:

fix "error" in calculation of MJD_OBS and argument to fields for getting
RA_DEG and DEC_DEG out of the stamp header

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstamp_finish.pl

    r25739 r26048  
    208208
    209209                    # ra_deg and dec_deg are the coordinates of center of the stamp
     210                    # first assume that the image is compressed and check the first extension.
     211                    # If not found check the PHU. If that doesn't work just set them to zero.
    210212                    # XXX do this more cleanly
    211                     my (undef, $ra_deg, $dec_deg) = split " ", `echo $out_dir/$img_name | fields -x -1 RA_DEG DEC_DEG`;
     213                    my (undef, $ra_deg, $dec_deg) = split " ", `echo $out_dir/$img_name | fields -x 0 RA_DEG DEC_DEG`;
     214                    if (!defined $ra_deg) {
     215                        (undef, $ra_deg, $dec_deg) = split " ", `echo $out_dir/$img_name | fields RA_DEG DEC_DEG`;
     216                    }
    212217                    $ra_deg = 0.0 if (!$ra_deg);
    213218                    $dec_deg = 0.0 if (!$dec_deg);
     
    372377    my $ra_deg   = $exp->{ra} * RADIANS_TO_DEGREES;
    373378    my $decl_deg = $exp->{decl} * RADIANS_TO_DEGREES;
    374     my $mjd_obs = dateobs_to_mjd($exp->{dateobs}, $exp->{exp_time});
     379    my $mjd_obs = dateobs_to_mjd($exp->{dateobs});
    375380
    376381    my $info = "$mjd_obs|$ra_deg|$decl_deg|$exp->{filter}|$exp->{exp_time}|$exp->{exp_name}";
     
    381386sub dateobs_to_mjd {
    382387    my $dateobs = shift;
    383     my $exp_time = shift;
    384388
    385389    # dateobs is in format: 1970-01-01T00:00:00
     
    391395    my $ticks = timegm($sec, $min, $hr, $day, $mon-1, $year-1900);
    392396
    393     $ticks += $exp_time / 2.0;
    394 
    395397    return 40587.0 + ($ticks/86400.);
    396398}
Note: See TracChangeset for help on using the changeset viewer.