IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41440 for trunk


Ignore:
Timestamp:
Nov 25, 2020, 5:26:50 PM (6 years ago)
Author:
mhuber
Message:

add PROJECT, COMPONENT_ID, TESS_ID and modifications to allow for gpc2 in dquery and add restrictions to prevent oddities

Location:
trunk/pstamp/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/detect_query_read

    r40747 r41440  
    8383my ($EXTVER,$headerEXTNAME,$QUERY_ID,
    8484    $FPA_ID,$MJD_OBS,$FILTER,
    85     $OBSCODE,$STAGE) =
     85    $OBSCODE,$STAGE,$COMPONENT_ID,$PROJECT,$TESS_ID) =
    8686    ($inHeader->{EXTVER},$inHeader->{EXTNAME},$inHeader->{QUERY_ID},
    8787     $inHeader->{FPA_ID},$inHeader->{'MJD-OBS'},$inHeader->{FILTER},
    88      $inHeader->{OBSCODE},$inHeader->{STAGE});
     88     $inHeader->{OBSCODE},$inHeader->{STAGE},$inHeader->{COMPONENT_ID},
     89     $inHeader->{PROJECT},$inHeader->{TESS_ID});
    8990
    9091unless(defined($EXTVER) && defined($headerEXTNAME) &&
     
    126127    # v2 stage: stage name to perform query on, allowed values of 'chip', 'warp', 'stack', and 'diff'
    127128    { name => 'STAGE', type => '20A', writetype => TSTRING, version => 2, default => $STAGE },
     129    #
     130    { name => 'COMPONENT_ID', type => '20A', writetype => TSTRING, version => 2, default => $COMPONENT_ID },
     131    #
     132    { name => 'PROJECT', type => '16A', writetype => TSTRING, version => 2, default => $PROJECT },   
     133    #
     134    { name => 'TESS_ID', type => '64A', writetype => TSTRING, version => 2, default => $TESS_ID },
    128135];
    129136
     
    203210                my ($key,$type,$value) = @line;
    204211#               print "$entry => $key / $type / $value \n";
     212                # if gpc2 then needs .00002
    205213                if ($key =~ /filter/i) {
    206214                    $value =~ s/.00000//;
     
    215223        # HACK!
    216224        my $mjd = $colData{FPA_ID}[$i];
     225        # need to remove g for gpc2
    217226        $mjd =~ s/o(....)g.*/$1/;
    218227        $mjd += 50000;
     
    227236        my $ra = $colData{'RA1_DEG'}[$i];
    228237        my $dec = $colData{'DEC1_DEG'}[$i];
     238        # if gpc2 then .00002
    229239        my $filter = $colData{'FILTER'}[$i] . ".00000";
    230240        my $cmd;
     
    294304
    295305# Verify uniqueness of important columns:
     306# -- need to add PROJECT as well?
    296307my @unique_fields = ('QUERY_ID','OBSCODE','STAGE');
    297308foreach my $colName (@unique_fields) {
  • trunk/pstamp/scripts/dqueryparse.pl

    r40747 r41440  
    7676
    7777# Project name is hardcoded to gpc1 for the moment.
     78# -- set gpc1 by default and read in PROJECT column to update for actual query
    7879$project = resolve_project($ipprc,"gpc1",$dbname,$dbserver);
    7980my $imagedb = $project->{dbname};
     
    189190        my $filter;
    190191        my $mjd;
     192        my $tess_id;
     193        my $component_id;
    191194        # Confirm that we only have one stage/filter/mjd
    192195        if ($fpa_id ne 'Not_Set') {   # We only need to check things that aren't the known odd case.
     
    195198                $temp_hash{FILTER}{$query{$fpa_id}{FILTER}[$i]} = 1;
    196199                $temp_hash{'MJD-OBS'}{$query{$fpa_id}{'MJD-OBS'}[$i]} = 1;
     200                $temp_hash{PROJECT}{$query{$fpa_id}{PROJECT}[$i]} = 1;
     201                $temp_hash{COMPONENT_ID}{$query{$fpa_id}{COMPONENT_ID}[$i]} = 1;
     202                $temp_hash{TESS_ID}{$query{$fpa_id}{TESS_ID}[$i]} = 1;
    197203            }
    198204            if (scalar(keys(%{ $temp_hash{STAGE} })) == 1) {
     
    214220                exit_with_failure(21,"Too many MJD-OBS specified");
    215221            }
     222            # add non-error cases/options as well
     223            if (scalar(keys(%{ $temp_hash{PROJECT} })) == 1) {
     224                if ( (keys(%{ $temp_hash{PROJECT} }))[0] ne 'Not_Set') {
     225                    $imagedb = (keys(%{ $temp_hash{PROJECT} }))[0];
     226                    $project = resolve_project($ipprc,$imagedb,$dbname,$dbserver);
     227                    $imagedb = $project->{dbname};
     228                    if (!$imagedb) {
     229                        my_die("failed to find imagedb for project: $project", $PS_EXIT_CONFIG_ERROR);
     230                    }
     231                }
     232            }
     233            if (scalar(keys(%{ $temp_hash{TESS_ID} })) == 1) {
     234                if ( (keys(%{ $temp_hash{TESS_ID} }))[0] ne 'Not_Set') {               
     235                    $tess_id = (keys(%{ $temp_hash{TESS_ID} }))[0];
     236                }
     237                else {
     238                    $tess_id = undef;
     239                }
     240            }
     241            if (scalar(keys(%{ $temp_hash{COMPONENT_ID} })) == 1) {
     242                if ( (keys(%{ $temp_hash{COMPONENT_ID} }))[0] ne 'Not_Set') {
     243                    $component_id = (keys(%{ $temp_hash{COMPONENT_ID} }))[0];
     244                }
     245                else {
     246                    $component_id = undef;
     247                }
     248            }
    216249        }
    217250
     
    255288
    256289        # Determine the query style for this fpa_id
     290        # fix remove g  for gpc2
    257291        if ($fpa_id =~ /o.*g.*o/) {
    258292            $query_style = 'byexp';
     
    287321            $req_filter = $filter . '%';
    288322        }
    289        
     323        # set defqults if not_set
     324#        if ($imagedb eq 'Not_Set') {
     325#            $imagedb = 'gpc1';
     326#        }
     327#        if ($component_id eq 'Not_Set') {
     328#            $component_id = undef;
     329#        }
     330#        if ($tess_id eq 'Not_Set') {
     331#            $tess_id = undef;
     332#        }
     333
    290334        # Call the PStamp code to find the images that contain the target on the given MJD in the specified filter.
    291335        my $pstamp_images_ref = locate_images($ipprc,$imagedb,
    292336                                          \@rowList,
    293337                                          $query_style,$stage,
    294                                           $fpa_id,undef,undef,
     338                                          $fpa_id,$tess_id,$component_id,
    295339                                          $option_mask,$need_magic,
    296340                                          $mjd_min,$mjd_max,$req_filter,undef,$verbose); 
    297341       
    298342        foreach my $this_image_ref (@{ $pstamp_images_ref }) {
    299 
    300343            # loop over the rows that this component matched
    301344            foreach my $valid_index (@{ $this_image_ref->{row_index} }) {
     
    308351                $query{$fpa_id}{NEED_MAGIC}[$valid_index] = $need_magic;
    309352                $query{$fpa_id}{BAD_COMPONENT}[$valid_index] = 0;
    310                
    311353                if (exists($this_image_ref->{astrom})) {
    312354                    $query{$fpa_id}{CATALOG}[$valid_index] = $this_image_ref->{astrom};
Note: See TracChangeset for help on using the changeset viewer.