IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33284


Ignore:
Timestamp:
Feb 16, 2012, 2:41:04 PM (14 years ago)
Author:
bills
Message:

Fix finding run for a stack stack diff. First take the coordinates and figure out which
medium deep field they are located in.
Use difftool -listssdiff to find a matching run passing -tess_id MDxx% based on the results
of the coordinate lookup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/detect_query_read

    r29157 r33284  
    222222    if (($colData{FPA_ID}[$i] eq "Not_Set")&&(($colData{'FILTER'}[$i] ne "Not_Set")&&
    223223                                              ($colData{'MJD-OBS'}[$i] ne "Not_Set"))) {
    224         my $dateobs_begin = mjd_to_dateobs($colData{'MJD-OBS'}[$i]);
    225         my $dateobs_end = mjd_to_dateobs($colData{'MJD-OBS'}[$i] + 1);
     224        my $mjd_obs = int $colData{'MJD-OBS'}[$i];
     225        my $dateobs_begin = mjd_to_dateobs($mjd_obs);
     226        my $dateobs_end = mjd_to_dateobs($mjd_obs + 1);
    226227        my $ra = $colData{'RA1_DEG'}[$i];
    227228        my $dec = $colData{'DEC1_DEG'}[$i];
     
    229230        my $cmd;
    230231        if ($colData{STAGE}[$i] eq 'SSdiff') {
    231             $cmd = "$difftool -listrun -dbname $dbname -filter $filter ";
    232             $cmd .= " -dateobs_begin $dateobs_begin -dateobs_end $dateobs_end ";
    233             $cmd .= " -ra $ra -decl $dec -radius 1.5 -limit 1 -diff_mode 4";
     232            # Assumption: All Stack Stack diffs are for a medium deep field
     233            # go find which one the coordinates are in
     234            # XXX: If we don't find one we'll just get the first SSdiff
     235            # in the filter on the day in question
     236            my $field = find_md_field($ra, $dec, 1.6);
     237            $cmd = "$difftool -listssrun -dbname $dbname -filter $filter ";
     238            $cmd .= " -mjd_obs_begin $mjd_obs -mjd_obs_end " . (1 + $mjd_obs);
     239            $cmd .= " -limit 1";
     240            $cmd .= " -tess_id $field%" if $field;
    234241        }
    235242        elsif ($colData{STAGE}[$i] eq 'WSdiff') {
     
    366373
    367374
     375# Given an RA and  DEC return the MD field that contains it if any.
     376# This is much faster than actuallly examining the tessellation
     377# using dvoImagesAtCoords
     378
     379sub find_md_field {
     380    my $ra_deg = shift;
     381    my $dec_deg = shift;
     382    my $radius_deg = shift;
     383
     384    my @MD     = qw(MD01  MD02    MD03     MD04      MD05    MD06      MD07    MD08    MD09     MD10);
     385    my @MD_RA  = (35.875, 53.10, 130.592, 150.000, 161.917, 185.000, 213.454, 242.787, 333.98, 352.312);
     386    my @MD_DEC = (-4.25,  -27.8,   44.317,   2.20,   58.083,  47.117,  53.243, 54.95,    0.283, -0.433);
     387    my $PS_DEG_RAD = 0.017453292519943;
     388
     389    my $ra     = $ra_deg * $PS_DEG_RAD;
     390    my $dec    = $dec_deg * $PS_DEG_RAD;
     391    my $radius = $radius_deg * $PS_DEG_RAD;
     392
     393    for (my $i = 0; $i < scalar @MD; $i++) {
     394       
     395        my $dist = acos((cos($PS_DEG_RAD * $MD_DEC[$i]) * cos($dec) * cos($PS_DEG_RAD * $MD_RA[$i] - $ra)) +(sin($PS_DEG_RAD * $MD_DEC[$i]) * sin($dec)));
     396
     397        if ($dist < $radius) {
     398            return $MD[$i];
     399        }
     400    }
     401    print STDERR "failed to find MD field containing $ra_deg $dec_deg\n";
     402
     403    return undef;
     404}
     405
     406
    368407__END__
Note: See TracChangeset for help on using the changeset viewer.