- Timestamp:
- Nov 25, 2020, 5:26:50 PM (6 years ago)
- Location:
- trunk/pstamp/scripts
- Files:
-
- 2 edited
-
detect_query_read (modified) (6 diffs)
-
dqueryparse.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/detect_query_read
r40747 r41440 83 83 my ($EXTVER,$headerEXTNAME,$QUERY_ID, 84 84 $FPA_ID,$MJD_OBS,$FILTER, 85 $OBSCODE,$STAGE ) =85 $OBSCODE,$STAGE,$COMPONENT_ID,$PROJECT,$TESS_ID) = 86 86 ($inHeader->{EXTVER},$inHeader->{EXTNAME},$inHeader->{QUERY_ID}, 87 87 $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}); 89 90 90 91 unless(defined($EXTVER) && defined($headerEXTNAME) && … … 126 127 # v2 stage: stage name to perform query on, allowed values of 'chip', 'warp', 'stack', and 'diff' 127 128 { 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 }, 128 135 ]; 129 136 … … 203 210 my ($key,$type,$value) = @line; 204 211 # print "$entry => $key / $type / $value \n"; 212 # if gpc2 then needs .00002 205 213 if ($key =~ /filter/i) { 206 214 $value =~ s/.00000//; … … 215 223 # HACK! 216 224 my $mjd = $colData{FPA_ID}[$i]; 225 # need to remove g for gpc2 217 226 $mjd =~ s/o(....)g.*/$1/; 218 227 $mjd += 50000; … … 227 236 my $ra = $colData{'RA1_DEG'}[$i]; 228 237 my $dec = $colData{'DEC1_DEG'}[$i]; 238 # if gpc2 then .00002 229 239 my $filter = $colData{'FILTER'}[$i] . ".00000"; 230 240 my $cmd; … … 294 304 295 305 # Verify uniqueness of important columns: 306 # -- need to add PROJECT as well? 296 307 my @unique_fields = ('QUERY_ID','OBSCODE','STAGE'); 297 308 foreach my $colName (@unique_fields) { -
trunk/pstamp/scripts/dqueryparse.pl
r40747 r41440 76 76 77 77 # Project name is hardcoded to gpc1 for the moment. 78 # -- set gpc1 by default and read in PROJECT column to update for actual query 78 79 $project = resolve_project($ipprc,"gpc1",$dbname,$dbserver); 79 80 my $imagedb = $project->{dbname}; … … 189 190 my $filter; 190 191 my $mjd; 192 my $tess_id; 193 my $component_id; 191 194 # Confirm that we only have one stage/filter/mjd 192 195 if ($fpa_id ne 'Not_Set') { # We only need to check things that aren't the known odd case. … … 195 198 $temp_hash{FILTER}{$query{$fpa_id}{FILTER}[$i]} = 1; 196 199 $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; 197 203 } 198 204 if (scalar(keys(%{ $temp_hash{STAGE} })) == 1) { … … 214 220 exit_with_failure(21,"Too many MJD-OBS specified"); 215 221 } 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 } 216 249 } 217 250 … … 255 288 256 289 # Determine the query style for this fpa_id 290 # fix remove g for gpc2 257 291 if ($fpa_id =~ /o.*g.*o/) { 258 292 $query_style = 'byexp'; … … 287 321 $req_filter = $filter . '%'; 288 322 } 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 290 334 # Call the PStamp code to find the images that contain the target on the given MJD in the specified filter. 291 335 my $pstamp_images_ref = locate_images($ipprc,$imagedb, 292 336 \@rowList, 293 337 $query_style,$stage, 294 $fpa_id, undef,undef,338 $fpa_id,$tess_id,$component_id, 295 339 $option_mask,$need_magic, 296 340 $mjd_min,$mjd_max,$req_filter,undef,$verbose); 297 341 298 342 foreach my $this_image_ref (@{ $pstamp_images_ref }) { 299 300 343 # loop over the rows that this component matched 301 344 foreach my $valid_index (@{ $this_image_ref->{row_index} }) { … … 308 351 $query{$fpa_id}{NEED_MAGIC}[$valid_index] = $need_magic; 309 352 $query{$fpa_id}{BAD_COMPONENT}[$valid_index] = 0; 310 311 353 if (exists($this_image_ref->{astrom})) { 312 354 $query{$fpa_id}{CATALOG}[$valid_index] = $this_image_ref->{astrom};
Note:
See TracChangeset
for help on using the changeset viewer.
