IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35747


Ignore:
Timestamp:
Jul 3, 2013, 1:43:50 PM (13 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20130509
Files:
59 edited
9 copied

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130509/Nebulous

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/Nebulous-Server

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/PS-IPP-Config/lib/PS/IPP/Config.pm

    r32652 r35747  
    730730}
    731731
     732sub file_rename {
     733    my $self = shift;
     734    my $old_name = shift;
     735    my $name = shift;
     736
     737    my $scheme = file_scheme($old_name);
     738    my $newscheme = file_scheme($name);
     739    if ($scheme and $scheme eq 'neb') {
     740        if (!$newscheme or $newscheme ne 'neb') {
     741            carp "cannot rename nebulous file to non nebulous path";
     742            return undef;
     743        }
     744        my $neb = $self->nebulous;
     745        if ($neb->storage_object_exists($old_name)) {
     746            eval {
     747                $neb->move($old_name, $name);
     748            };
     749            if ($@) {
     750                carp "nebulous move failed for $old_name";
     751                return undef;
     752            }
     753        } else {
     754            carp "$old_name not found";
     755            return undef;
     756        }
     757    } else {
     758        if ($newscheme and $newscheme eq 'neb') {
     759            carp "cannot rename non-nebulous file to nebulous path";
     760            return undef;
     761        }
     762        if ($self->file_exists($old_name)) {
     763            my $resolved = $self->file_resolve($old_name);
     764            my $resolved_new = $self->file_resolve($name);
     765            if (!rename($resolved, $resolved_new)) {
     766                carp "Failed to rename $resolved $resolved_new";
     767                return undef;
     768            }
     769        } else {
     770            carp "$old_name not found";
     771            return undef;
     772        }
     773    }
     774    return $name;
     775}
     776
    732777# redirect stderr and stdout streams to log file. If file already exists rename it and record
    733778# the name in the new log file.
  • branches/eam_branches/ipp-20130509/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm

    r35506 r35747  
    574574        $command .= " -dateobs_end $dateobs_end" if $dateobs_end;
    575575    } elsif ($req_type ne "byid") {
    576         $command .= " -mjd_min $mjd_min" if $mjd_min;
    577         $command .= " -mjd_max $mjd_max" if $mjd_max;
     576        $command .= " -mjd_obs_begin $mjd_min" if $mjd_min;
     577        $command .= " -mjd_obs_end $mjd_max" if $mjd_max;
    578578    }
    579579
     
    10251025    } else {
    10261026        $using_camtool = 1;
    1027         my $command = "$camtool -dbname $imagedb -processedexp -pstamp_order";
    1028            # NOTE: we are applying the data_group to the camera run.
    1029            # If we're looking for chip stage images there is no guarentee that
    1030            # chipRun.data_group eq camRun.data_group. In practice this is almost
    1031            # always the case. If this turns out to be a problem we can defer
    1032            # the data_group test to when we look up the chipProcessedImfiles
    1033            if ($data_group) {
    1034                $command .= " -data_group $data_group";
    1035            } else {
    1036                $command .= $default_data_groups;
    1037            }
    1038            $command .= " -destreaked" if $need_magic;
     1027        $command = "$camtool -dbname $imagedb -processedexp -pstamp_order";
     1028        # NOTE: we are applying the data_group to the camera run.
     1029        # If we're looking for chip stage images there is no guarentee that
     1030        # chipRun.data_group eq camRun.data_group. In practice this is almost
     1031        # always the case. If this turns out to be a problem we can defer
     1032        # the data_group test to when we look up the chipProcessedImfiles
     1033        if ($data_group) {
     1034            $command .= " -data_group $data_group";
     1035        } else {
     1036            $command .= $default_data_groups;
     1037        }
     1038        $command .= " -destreaked" if $need_magic;
    10391039    }
    10401040    $command .= " -ra $ra -decl $dec -radius $search_radius";
  • branches/eam_branches/ipp-20130509/dbconfig/cam.md

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/dbconfig/changes.txt

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippMonitor

  • branches/eam_branches/ipp-20130509/ippMonitor/czartool/czartool/Nebulous.pm

    r34930 r35747  
    113113        } elsif (($line =~ m/(ipp[0-9]+\.[0-9]{1})\s.+[0-9]+\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)%.*/i)||
    114114               ($line =~ m/(ippb[0-9]+\.[0-9]{1})\s.+[0-9]+\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)%.*/i) ||
    115                ($line =~ m/(stsci0[0-9]+\.[0-9]{1})\s.+[0-9]+\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)%.*/i)) {
     115               ($line =~ m/(stsci[0-1][0-9]+\.[0-9]{1})\s.+[0-9]+\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)%.*/i)) {
    116116
    117117            $self->{_totalHosts}++;
  • branches/eam_branches/ipp-20130509/ippMonitor/czartool/czartool/Plotter.pm

    r34931 r35747  
    707707    if ($self->{_outputFormat} ne "X11") {print GP "set output \"$outputFile\";";}
    708708    print GP
    709         "set term $self->{_outputFormat} size 1280,1024;" .
     709        "set term $self->{_outputFormat} size 2560,1024;" .
    710710        "set title \"Nebulous disk use across IPP cluster ($totalPercent of total allocated)\";" .
    711711        "set style fill solid 1.00 border -1;" .
  • branches/eam_branches/ipp-20130509/ippMonitor/czartool/czartool/czarconfig.xml

    r34803 r35747  
    4747    <serverinterval>20 MINUTE</serverinterval>
    4848    <!-- whitespace-separated server list for servers we want roboczar to check -->
    49     <interestedservers>stdscience distribution summitcopy registration pstamp stack publishing</interestedservers>
     49    <interestedservers>stdscience distribution summitcopy registration stack publishing pstamp </interestedservers>
    5050    <!-- <interestedservers>pstamp</interestedservers> -->
    5151  </roboczar>
  • branches/eam_branches/ipp-20130509/ippMonitor/def/diffProcessedSkyfile_Images.d

    r30454 r35747  
    33FILE  diffProcessedSkyfile_Images.php
    44MENU  ipp.stack.dat
     5
     6UNRESTRICTED AND 0>1
     7RESTRICT_COUNT AND 0>1
    58
    69WHERE diffRun.diff_id             = diffSkyfile.diff_id
     
    1316
    1417# if no query restrictions are supplied, we want to limit the query or it is extremely long running:
    15 UNRESTRICTED AND diffRun.diff_id = 0
     18# UNRESTRICTED AND diffRun.diff_id = 0
    1619
    1720# XXX need to get camera from lookup
  • branches/eam_branches/ipp-20130509/ippScripts/scripts/background_chip.pl

    r35154 r35747  
    159159}
    160160
    161 # XXX: M31 TEST turn off restoring pattern correction
    162 $apply_pattern = 0;
    163 
    164161# Set up files
    165162&my_die("Couldn't find input file: $in_image\n", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($in_image);
     
    170167
    171168$ipprc->outroot_prepare($outroot);
    172 #my $out_image = $ipprc->filename("PPBACKGROUND.OUTPUT", $outroot, $class_id);
    173 #my $out_mask = $ipprc->filename("PPBACKGROUND.OUTPUT.MASK", $outroot, $class_id);
    174 #my $out_stats = $ipprc->filename("PPBACKGROUND.STATS", $outroot, $class_id);
    175 #my $out_config = $ipprc->filename("PPBACKGROUND.CONFIG", $outroot, $class_id);
    176 #my $traceDest = $ipprc->filename("TRACE.IMFILE", $outroot, $class_id);
    177169
    178170my $out_image = prepare_output("PPBACKGROUND.OUTPUT", $outroot, $class_id, 1);
     
    183175my $traceDest = prepare_output("TRACE.IMFILE", $outroot, $class_id, 1);
    184176
    185 my $auxmask;
    186 
    187 my $apply_auxiliary_mask = 1;
    188 # XXX Temporary lookup of auxiliary mask file from static location.
    189 # At some point I'll convert this to register the masks in the database and use detselect
    190 if ($apply_auxiliary_mask) {
    191     my @auxmask_start_date = qw(
    192     0000
    193     5178
    194     5218
    195     5403
    196     5424
    197     5455
    198     5485
    199     5512
    200     5545
    201     5770
    202     5797
    203     5825
    204     5854
    205     5881
    206     6138
    207     6153
    208     6197
    209     6214
    210     );
    211     my @auxmask_end_date = qw(
    212     5177
    213     5217
    214     5402
    215     5423
    216     5454
    217     5484
    218     5511
    219     5544
    220     5769
    221     5796
    222     5824
    223     5853
    224     5880
    225     6137
    226     6152
    227     6196
    228     6213
    229     9999
    230     );
    231 
    232     my $outroot_base = basename($outroot);
    233 
    234     # Assume that outroot base begins with exp_name: fix by passing in exp_name
    235     my $mjd = substr($outroot_base, 1, 4);
    236     if ($mjd =~ /\D/) {
    237             my $error_code = 1;
    238             &my_die("unexpected outroot base: $outroot_base: $error_code", $chip_bg_id, $class_id, $error_code);
    239     }
    240 
    241     my $i = 0;
    242     while ($auxmask_end_date[$i] < $mjd) {
    243         $i++;
    244     }
    245 
    246     my $auxmask_base = "/data/ipp064.0/bills/m31-masks/www.usm.uni-muenchen.de/people/arri/PAndromeda/masks_fits/mask";
    247 
    248     $auxmask = sprintf "%s_%04d-%04d_%s.fits", $auxmask_base, $auxmask_start_date[$i], $auxmask_end_date[$i], $class_id;
    249     print "Auxililary mask file is $auxmask\n";
    250 }
    251 
    252 
    253 
    254 # Run ppImage
     177
     178# Run ppBackground
    255179unless ($no_op) {
    256180    my $command  = "$ppBackground $outroot";
     
    258182    $command .= " -mask $in_mask";
    259183    $command .= " -variance $in_wt";
    260     $command .= " -auxmask $auxmask" if $auxmask;
    261184    $command .= " -stats $out_stats" if $do_stats;
    262185    $command .= " -background $in_bg" if $apply_bg;
  • branches/eam_branches/ipp-20130509/ippScripts/scripts/background_warp.pl

    r35154 r35747  
    191191    $command .= " $outroot $skyFile";
    192192    $command .= " -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF";
     193    # XXX: change fits type based on recipe
     194    $command .= " -R PSWARP.OUTPUT FITS.TYPE NONE";
    193195    $command .= " -recipe PSWARP $recipe_pswarp";
    194196    $command .= " -recipe PPSTATS WARPSTATS";
  • branches/eam_branches/ipp-20130509/ippScripts/scripts/camera_exp.pl

    r35367 r35747  
    5353    'skip-binned'       => \$skip_binned, # override recipe - don't create binned images
    5454    'skip-refmask'      => \$skip_masks, # override recipe - don't create refmask
    55     'bkg-only'          => \$bkg_only,  # override recipe - only do background continuity
     55#    'bkg-only'          => \$bkg_only,  # override recipe - only do background continuity
    5656    'verbose'           => \$verbose,   # Print to stdout
    5757    'no-update'         => \$no_update, # Update the database?
     
    8080my $replicateOutputs = 1;
    8181
     82$ipprc->outroot_prepare($outroot);
     83
    8284my $logDest;
    8385my $traceDest;
     
    114116my $bkg_recipe     = 'PPIMAGE_BKGCONT'; # Add to reduction?
    115117my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     118
     119my $recipeData;
     120{
     121    # Get the PSASTRO recipe
     122    my $command = "$ppConfigDump -camera $camera -recipe PSASTRO $recipe_psastro -dump-recipe PSASTRO -";
     123    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     124        run(command => $command, verbose => $verbose);
     125    unless ($success) {
     126        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     127        &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $PS_EXIT_CONFIG_ERROR);
     128    }
     129    $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
     130        &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_CONFIG_ERROR);
     131}
    116132
    117133my $cmdflags;
     
    158174    chomp $cmdflags;
    159175
    160     { # Determine if FWHM is too large to bother continuing.
    161         my $maxFWHM = 0;
    162       # XXX: temporary hack if this is a CNP exposure set maxFWHM to a large
    163       # value.
    164       # Before the next tag we will put this into a recipe
    165       if ($outroot =~ /CNP/) {
    166             $maxFWHM = 25;
    167       } else {
    168         my $command = "$ppConfigDump -camera $camera -get-key MAX_ALLOWED_FWHM";
    169         my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    170             run(command => $command, verbose => $verbose);
    171         unless ($success) {
    172             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    173             &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $PS_EXIT_CONFIG_ERROR);
    174         }
    175         if (@$stdout_buf) {
    176             my $cameraConfig = $mdcParser->parse(join "", @$stdout_buf) or
    177                 &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_CONFIG_ERROR);
    178             $maxFWHM = metadataLookupStr($cameraConfig, 'MAX_ALLOWED_FWHM');
    179         }
    180       }
    181         if ($maxFWHM) {
    182             my $expFWHM;
    183             ($expFWHM) = $cmdflags =~ /-fwhm_major (\d+)/;     
    184            
    185             if ($expFWHM > $maxFWHM) {
    186                 print "Setting quality to 4007 due to large FWHM: exposure: $expFWHM  maximum: $maxFWHM\n";
    187                 $cmdflags .= " -quality 4007 "; # This corresponds to PSASTRO_ERR_DATA
    188                 $no_op = 1;
    189             }
    190         }
    191     }
    192 }
    193 
    194 
    195 my $produceMasks;               # Produce masks?
     176    # Determine if FWHM is too large to bother continuing.
     177    my $maxFWHM = metadataLookupF32($recipeData, 'PSASTRO.MAX.ALLOWED.FWHM');
     178    if ($maxFWHM) {
     179        my $expFWHM;
     180        ($expFWHM) = $cmdflags =~ /-fwhm_major (\d+)/; 
     181       
     182        if ($expFWHM > $maxFWHM) {
     183            print "Setting quality to 4007 due to large FWHM: exposure: $expFWHM  maximum: $maxFWHM\n";
     184            $cmdflags .= " -quality 4007 "; # This corresponds to PSASTRO_ERR_DATA
     185            $no_op = 1;
     186        }
     187    }
     188}
     189
     190
     191my $do_masks;               # Produce masks?
    196192if (!$skip_masks) {
    197     # Get the PSASTRO recipe
    198     my $command = "$ppConfigDump -camera $camera -recipe PSASTRO $recipe_psastro -dump-recipe PSASTRO -";
    199     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    200         run(command => $command, verbose => $verbose);
    201     unless ($success) {
    202         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    203         &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $PS_EXIT_CONFIG_ERROR);
    204     }
    205     my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
    206         &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_CONFIG_ERROR);
    207 
    208     $produceMasks = metadataLookupBool($recipeData, 'REFSTAR_MASK');
     193    $do_masks = metadataLookupBool($recipeData, 'REFSTAR_MASK');
    209194}
    210195
     
    220205my ($list5File, $list5Name) = tempfile( "/tmp/$exp_tag.cm.$cam_id.b5.list.XXXX", UNLINK => !$save_temps ); # For background models
    221206
    222 # XXX we perform astrometry iff photometry output exists
     207
     208my $do_stats;
     209my $do_bkg;
     210my $do_jpegs;
     211my $fpaStats;
     212my $psastroInputArg;
     213if ($run_state eq 'new') {
     214    $do_stats = 1;
     215    $do_bkg = 1;
     216    $do_jpegs = !$skip_binned;
     217    $fpaStats = prepare_output("PSASTRO.STATS",      $outroot, undef, 1);
     218    $psastroInputArg = " -list $list3Name";
     219} else {
     220    # for $run_state eq 'update' we only rebuild the masks using psastro
     221    $do_stats = 0;
     222    $do_jpegs = 0;
     223    $do_bkg = 1;        # we could skip this step if camProcessedExp.backgroun_model is non zero
     224
     225    if (!$do_masks) {
     226        &my_die("run_state is update but do_masks is F. I have nothing to do!!", $cam_id, $PS_EXIT_UNKNOWN_ERROR)
     227    }
     228
     229    # the input to psastro is the original PSASTRO.OUTPUT
     230   
     231    # Check for file with rule PSASTRO.OUTPUT.ORGINAL
     232    # This file will exist if we attempted to update this camRun before but faulted
     233    # XXX: make sure cleanup deals with these files
     234    my $inputObjects = $ipprc->filename("PSASTRO.OUTPUT.ORIGINAL", $outroot, undef);
     235    if (!$ipprc->file_exists($inputObjects)) {
     236        # not found so original file should still be in place.
     237        # Rename it.
     238        my $originalObjects = $ipprc->filename("PSASTRO.OUTPUT", $outroot, undef);
     239        if ($ipprc->file_exists($originalObjects)) {
     240
     241            unless ($ipprc->file_rename($originalObjects, $inputObjects)) {
     242                &my_die("failed to rename $originalObjects to $inputObjects", $cam_id, $PS_EXIT_UNKNOWN_ERROR);
     243            }
     244
     245            # ok ready to go
     246        } else {
     247            print STDERR "failed to find input objects to update\n";
     248            print STDERR "Original file name: $originalObjects\n";
     249            print STDERR "Saved file name:    $inputObjects\n";
     250
     251            &my_die("Cannot proceed.", $cam_id, $PS_EXIT_DATA_ERROR);
     252
     253            # XXX: actually we could use the chip stage cmfs as inputs and turn on astrometry
     254            # ... except that somebody (me) got the bright idea to save space and
     255            # changed chip stage cleanup to remove them. So we're kind of stuck.
     256        }
     257    }
     258    $psastroInputArg = " -file $inputObjects -skipastro";
     259}
     260   
     261
    223262my @outMasks;                   # Names of output masks
    224263my @bkg_models;                 # Names of output background models
    225264foreach my $file (@$files) {
     265    # we perform astrometry iff photometry output exists
    226266    next if $file->{quality} != 0;
     267
    227268    # use the path_base as OUTPUT root and convert the filenames with ipprc->filename:
    228269    my $class_id = $file->{class_id};
     
    239280    print $list5File ($ipprc->filename("PSPHOT.BACKMDL", $file->{path_base}, $class_id) . "\n");
    240281
    241     push @outMasks, prepare_output("PSASTRO.OUTPUT.MASK", $outroot, $class_id, 1) if $produceMasks;
    242     push @bkg_models, prepare_output("PPIMAGE.BACKMDL", $outroot, $class_id, 1);
     282    push @outMasks, prepare_output("PSASTRO.OUTPUT.MASK", $outroot, $class_id, 1) if $do_masks;
     283    push @bkg_models, prepare_output("PPIMAGE.BACKMDL", $outroot, $class_id, 1) if $do_bkg;
    243284}
    244285close $list1File;
     
    247288close $list4File;
    248289close $list5File;
    249 # Output products
    250 $ipprc->outroot_prepare($outroot);
     290
     291# Prepare the Output products
    251292
    252293# the camera configurations should define the psastro output to be a single file (MEF), regardless of the inputs
    253 my $jpeg1      = prepare_output("PPIMAGE.JPEG1",      $outroot, undef, 1);
    254 my $jpeg2      = prepare_output("PPIMAGE.JPEG2",      $outroot, undef, 1);
    255 my $fpaObjects = prepare_output("PSASTRO.OUTPUT",     $outroot, undef, 1);
    256 my $configuration = prepare_output("PSASTRO.CONFIG",  $outroot, undef, 1);
    257 
    258 my $do_stats;
    259 my $fpaStats;
     294my $jpeg1      = prepare_output("PPIMAGE.JPEG1",      $outroot, undef, 1) if $do_jpegs;
     295my $jpeg2      = prepare_output("PPIMAGE.JPEG2",      $outroot, undef, 1) if $do_jpegs;
     296my $fpaObjects = prepare_output("PSASTRO.OUTPUT",     $outroot, undef, 1) if !$bkg_only;
     297
     298my $configuration;
    260299if ($run_state eq 'new') {
    261     $do_stats = 1;
    262     $fpaStats = prepare_output("PSASTRO.STATS",      $outroot, undef, 1);
     300    $configuration = prepare_output("PSASTRO.CONFIG",  $outroot, undef, 1);
    263301} else {
    264     $do_stats = 0;
    265 }
     302    # Do not use the original recipes for updates because they might contain the
     303    # recipe values that caused the masks to get fouled up in the first place
     304    # $configuration = $ipprc->filename("PSASTRO.CONFIG",  $outroot, undef);
     305}
     306
    266307
    267308unless ($no_op) {
     
    269310    ## build the output JPEG images first so we get them even if the astrometry fails
    270311
    271     # Make the jpeg for binning 1
    272     if (!$skip_binned and ($run_state eq 'new')) {
     312    if ($do_jpegs) {
     313        # Make the jpeg for binning 1
    273314        my $command = "$ppImage -list $list1Name $outroot"; # Command to run
    274315        $command .= " -recipe PPIMAGE $recipe1";
     
    282323        }
    283324        check_output($jpeg1, $replicateOutputs);
    284     }
    285 
    286     # Make the jpeg for binning 2
    287     if (!$skip_binned and ($run_state eq 'new')) {
    288         my $command = "$ppImage -list $list2Name $outroot"; # Command to run
     325
     326        # Make the jpeg for binning 2
     327
     328        $command = "$ppImage -list $list2Name $outroot"; # Command to run
    289329        $command .= " -recipe PPIMAGE $recipe2";
    290330        $command .= " -dbname $dbname" if defined $dbname;
    291331
    292         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     332        ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    293333            run(command => $command, verbose => $verbose);
    294334        unless ($success) {
     
    302342        # run psastro on the chipObjects, producing fpaObjects
    303343        my $command;
    304         $command  = "$psastro";
    305         $command .= " -list $list3Name";
    306         $command .= " -masklist $list4Name" if $produceMasks;
     344        $command  = $psastro;
     345        $command .= " $psastroInputArg";
     346        $command .= " -masklist $list4Name" if $do_masks;
    307347        $command .= " $outroot";
    308348        $command .= " -recipe PSASTRO $recipe_psastro";
    309         $command .= " -Db PSASTRO:REFSTAR_MASK F" if $skip_masks;
     349        $command .= " -Db PSASTRO:REFSTAR_MASK F" if !$do_masks;
    310350        $command .= " -tracedest $traceDest -log $logDest";
    311351        $command .= " -dbname $dbname" if defined $dbname;
     
    314354            $command .= " -dumpconfig $configuration";
    315355        } elsif ($run_state eq 'update') {
    316             $command .= " -ipprc $configuration";
     356            $command .= " -ipprc $configuration" if $configuration;
    317357        } else {
    318358            &my_die("invalid value for run-state: $run_state", $cam_id, $PS_EXIT_CONFIG_ERROR);
     
    362402        }
    363403    }
     404
    364405    # Construct FPA continuity corrected background images
    365406    if ($camera =~ /ISP/) {
    366407        print "Skipping FPA continuity corrected background images for ISP\n";
    367     } else {
     408    } elsif ($do_bkg) {
    368409        my $command;
    369410        $command = "$ppImage";
     
    381422            check_output($bkgModel, $replicateOutputs);
    382423        }
    383         $cmdflags = $cmdflags . " -background_model 1 ";
     424        if ($run_state eq 'new') {
     425            $cmdflags .= " -background_model 1 ";
     426        } else {
     427            my $command = "camtool -updateprocessedexp -set_background_model 1 -fault 0 -cam_id $cam_id";
     428            $command .= " -dbname $dbname" if $dbname;
     429            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     430                run(command => $command, verbose => $verbose);
     431            unless ($success) {
     432                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     433                &my_die("Unable to updateprocessedexp to set background_model: $error_code", $cam_id, $error_code);
     434            }
     435        }
    384436    }
    385437}
  • branches/eam_branches/ipp-20130509/ippScripts/scripts/chip_imfile.pl

    r35594 r35747  
    200200
    201201    ## get the ppImage recipe for this camera and CHIP reduction
    202     $command = "$ppConfigDump -camera $camera -dump-recipe PPIMAGE -recipe PPIMAGE $recipe_ppImage -";
     202    $command = "$ppConfigDump -dump-recipe PPIMAGE -recipe PPIMAGE $recipe_ppImage -";
     203    if ($dump_config) {
     204        # use this camera's recipes
     205        $command .= " -camera $camera";
     206    } else {
     207        # get recipes as set in config dump file
     208        $command .= " -ipprc $configuration";
     209    }
    203210    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    204211        run(command => $command, verbose => 0);
     
    224231    }
    225232
    226 
    227     ## XXX make the feature more general?
     233    my $no_compress_image = metadataLookupBool($recipeData, 'NO.COMPRESS');
     234
    228235    my $useDeburnedImage = metadataLookupBool($recipeData, 'USE.DEBURNED.IMAGE');
     236    my $ppImageApplyBurntool = metadataLookupBool($recipeData, 'APPLY.BURNTOOL');
     237    my $burntoolArguments;
    229238
    230239    if ($useDeburnedImage) {
     
    327336        }
    328337
    329         ## We now know that we have an image that has been burntooled.
    330         my ($tempFile, $tempName) = tempfile( "/tmp/chip.$exp_id.$class_id.deburned.XXXX",
     338        # if recipe option PPIMAGE:APPLY.BURNTOOL is set and the burntool information is stored in
     339        # an external table (usual case), check the existence of that table file and set $burntoolArguments.
     340        # If burntool state does not match, say if the burntool data is stored in a fits extension in
     341        # the rawImfile, use the burntool program.
     342        if ($ppImageApplyBurntool && ($burntoolState == -1 * $burntoolStateGood)) {
     343            my $burntoolTable_uri = $uri;
     344            $burntoolTable_uri =~ s/fits$/burn.tbl/;
     345            my $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri );
     346            if ((!$burntoolTable_uriReal)||(!($ipprc->file_exists($burntoolTable_uri)))) {
     347                my $repair_cmd = "$nebrepair $burntoolTable_uri";
     348                my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf )
     349                    = run(command => $repair_cmd, verbose => $verbose);
     350                unless ($repair_success) {
     351                    &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id,
     352                        $PS_EXIT_SYS_ERROR);
     353                }
     354                $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri );
     355            }
     356            unless ($ipprc->file_exists($burntoolTable_uri)) {
     357                &my_die("Couldn't find burntool table: $burntoolTable_uri",$exp_id,$chip_id,$class_id,
     358                    $PS_EXIT_SYS_ERROR);
     359            }
     360            $burntoolArguments = " -burntool $burntoolTable_uri";
     361        } else {
     362            ## use external burntool program
     363
     364            ## We now know that we have an image that has been burntooled.
     365            my ($tempFile, $tempName) = tempfile( "/tmp/chip.$exp_id.$class_id.deburned.XXXX",
    331366                                              UNLINK => !$save_temps, SUFFIX => '.fits' );
    332367
    333         # get the UNIX version of the (possible) neb: or path: filename
    334         my $uriReal = $ipprc->file_resolve( $uri );
    335         # Catch errors here
    336         if (!$uriReal) {
    337             my $repair_cmd = "$nebrepair $uri";
    338             my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose);
    339             unless ($repair_success) {
    340                 &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    341             }
    342             $uriReal = $ipprc->file_resolve( $uri );
    343         }
    344            
    345         &my_die("Unable to resolve $uri on $host", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) if !$uriReal;
    346 
    347         # funpack into the temp file.
    348         my $funpack_cmd = "$funpack -S $uriReal > $tempName";
    349         ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose);
    350         unless ($success) {
    351             # Catch errors here
    352             my $repair_cmd = "$nebrepair $uri";
    353             my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose);
    354             unless ($repair_success) {
    355                 &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    356             }
    357             ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose);
    358         }
    359         unless ($success) {
    360             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    361             &my_die("Unable to perform funpack: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    362         }
    363 
    364         ## Construct commands to apply the pre-calculated burntool trailfits to the pixel data.
    365         my ($burntoolTable_uri, $burntoolTable_uriReal);
    366         my $burntool_cmd = "$burntool ";
    367 
    368         if ($burntoolState == -1 * $burntoolStateGood) {   # Burntool information stored in an external table.
    369             $burntoolTable_uri = $uri;
    370             $burntoolTable_uri =~ s/fits$/burn.tbl/;
    371             $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri );
    372             if ((!$burntoolTable_uriReal)||(!($ipprc->file_exists($burntoolTable_uri)))) {
    373                 my $repair_cmd = "$nebrepair $burntoolTable_uri";
    374                 my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose);
    375                 unless ($repair_success) {
    376                     &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    377                 }
    378                 $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri );
    379             }
    380             unless ($ipprc->file_exists($burntoolTable_uri)) {
    381                 # Catch errors here
    382                 &my_die("Couldn't find burntool table: $burntoolTable_uri",$exp_id,$chip_id,$class_id, $PS_EXIT_SYS_ERROR);
    383             }
    384 
    385             $burntool_cmd .= "$tempName in=${burntoolTable_uriReal} persist=t apply=t";
    386         }
    387         elsif ($burntoolState == $burntoolStateGood) { # Burntool information stored in a header table.
    388             $burntool_cmd .= "$tempName persist=t apply=t";
    389         }
    390         else {
    391             &my_die("Image data not properly burntooled, impossible state", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    392         }
    393 
    394         ## Run burntool to change the pixels of tempfile, and repoint $uri to that file.
    395         ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
    396             run(command => $burntool_cmd, verbose => $verbose);
    397         unless ($success) {
    398             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    399             &my_die("Unable to perform burntool: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    400         }
    401 
    402         $uri = $tempName;
    403         unless ($ipprc->file_exists($uri)) {
    404             &my_die("Couldn't find deburned input file: $uri\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    405         }
    406 
    407 #       print STDERR "$uri $uriReal $tempName $burntoolTable_uri $burntoolTable_uriReal $burntool_cmd $save_temps\n";
    408 #       exit(100);
    409     }
    410 
    411     # apply the 'tiltystreak' operation, if desired
     368            # get the UNIX version of the (possible) neb: or path: filename
     369            my $uriReal = $ipprc->file_resolve( $uri );
     370                # Catch errors here
     371            if (!$uriReal) {
     372                my $repair_cmd = "$nebrepair $uri";
     373                my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose);
     374                unless ($repair_success) {
     375                    &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     376                }
     377                $uriReal = $ipprc->file_resolve( $uri );
     378            }
     379               
     380            &my_die("Unable to resolve $uri on $host", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) if !$uriReal;
     381
     382            # funpack into the temp file.
     383            my $funpack_cmd = "$funpack -S $uriReal > $tempName";
     384            ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose);
     385            unless ($success) {
     386                # Catch errors here
     387                my $repair_cmd = "$nebrepair $uri";
     388                my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose);
     389                unless ($repair_success) {
     390                    &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     391                }
     392                ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose);
     393            }
     394            unless ($success) {
     395                    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     396                &my_die("Unable to perform funpack: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     397            }
     398
     399            ## Construct commands to apply the pre-calculated burntool trailfits to the pixel data.
     400            my ($burntoolTable_uri, $burntoolTable_uriReal);
     401            my $burntool_cmd = "$burntool ";
     402
     403            if ($burntoolState == -1 * $burntoolStateGood) {   # Burntool information stored in an external table.
     404                $burntoolTable_uri = $uri;
     405                $burntoolTable_uri =~ s/fits$/burn.tbl/;
     406                $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri );
     407                if ((!$burntoolTable_uriReal)||(!($ipprc->file_exists($burntoolTable_uri)))) {
     408                    my $repair_cmd = "$nebrepair $burntoolTable_uri";
     409                    my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose);
     410                    unless ($repair_success) {
     411                        &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     412                    }
     413                    $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri );
     414                }
     415                unless ($ipprc->file_exists($burntoolTable_uri)) {
     416                    # Catch errors here
     417                    &my_die("Couldn't find burntool table: $burntoolTable_uri",$exp_id,$chip_id,$class_id, $PS_EXIT_SYS_ERROR);
     418                }
     419
     420                $burntool_cmd .= "$tempName in=${burntoolTable_uriReal} persist=t apply=t";
     421            }
     422            elsif ($burntoolState == $burntoolStateGood) { # Burntool information stored in a header table.
     423                $burntool_cmd .= "$tempName persist=t apply=t";
     424            }
     425            else {
     426                &my_die("Image data not properly burntooled, impossible state", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     427            }
     428
     429            ## Run burntool to change the pixels of tempfile, and repoint $uri to that file.
     430            ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
     431                run(command => $burntool_cmd, verbose => $verbose);
     432            unless ($success) {
     433                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     434                &my_die("Unable to perform burntool: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     435            }
     436
     437            $uri = $tempName;
     438            unless ($ipprc->file_exists($uri)) {
     439                &my_die("Couldn't find deburned input file: $uri\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     440            }
     441
     442            if ($dump_config) {
     443                # tell ppImage to not apply burntool since we have done it here
     444                $burntoolArguments = ' -Db PPIMAGE:APPLY.BURNTOOL F';
     445            }
     446    #       print STDERR "$uri $uriReal $tempName $burntoolTable_uri $burntoolTable_uriReal $burntool_cmd $save_temps\n";
     447    #       exit(100);
     448
     449        }
     450    }
     451
    412452    my $tiltystreakApply = metadataLookupBool($recipeData, 'TILTYSTREAK.APPLY');
    413453    if ($tiltystreakApply) {
    414 
    415         my $tiltystreakByClass = metadataLookupMD($recipeData, 'TILTYSTREAK.BY.CLASS');
    416         my $tiltystreakClassApply = metadataLookupBool($tiltystreakByClass, "APPLY.$class_id");
    417         if ($tiltystreakClassApply) {
    418 
    419             my $tiltystreakClassOptions = metadataLookupStr($tiltystreakByClass, "OPTIONS.$class_id");
    420             if ($tiltystreakClassOptions eq "none") {
    421                 $tiltystreakClassOptions = "";
    422             }
    423 
    424             my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf);
    425 
    426             # XXX make these optional (must be built by psbuild as well...)
    427             my $funpack = can_run('funpack') or &my_die ("Can't find funpack", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    428             my $tiltystreak = can_run('tiltystreak') or &my_die ("Can't find tiltystreak", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    429 
    430             # create an temporary output file:
    431             my ($tempFile, $tempName) = tempfile( "/tmp/chip.$exp_id.$class_id.tmp.XXXX", UNLINK => !$save_temps );
    432 
    433             print "uri: $uri\n";
    434 
    435             # get the UNIX version of the (possible) neb: or path: filename
    436             my $uriReal = $ipprc->file_resolve( $uri );
    437 
    438             print "uriReal: $uriReal\n";
    439 
    440             # unpack the data (is a NOP if not compressed)
    441             $command = "$funpack -S $uriReal > $tempName";
    442             ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
    443             unless ($success) {
    444                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    445                 &my_die("Unable to perform funpack: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    446             }
    447 
    448             # run tiltystreak
    449             $command = "$tiltystreak $tempName $tiltystreakClassOptions";
    450             ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
    451             unless ($success) {
    452                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    453                 &my_die("Unable to perform tiltystreak: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    454             }
    455 
    456             # supply the output file as the new input file
    457             $uri = $tempName;
    458         }
     454        # NOTE: application of TILTYSTREAK.APPLY was here. Removed after r35685
     455        &my_die("Unable to perform tiltystreak: code has been removed", $exp_id, $chip_id, $class_id,
     456            $PS_EXIT_PROG_ERROR);
    459457    }
    460458
     
    479477        $command .= " -Db PPIMAGE:BIN1.FITS FALSE -Db PPIMAGE:BIN2.FITS FALSE";
    480478    }
     479    if ($no_compress_image) {
     480        $command .= " -R PPIMAGE.CHIP FITS.TYPE NONE";
     481    }
     482    $command .= $burntoolArguments if $burntoolArguments;
    481483    $command .= " -threads $threads" if defined $threads;
    482484    $command .= " -image_id $chip_imfile_id" if defined $chip_imfile_id;
  • branches/eam_branches/ipp-20130509/ippScripts/scripts/destreak_restore_camera.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippScripts/scripts/ipp_apply_burntool_single.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippScripts/scripts/magic_destreak.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippScripts/scripts/publish_file.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippScripts/scripts/warp_skycell.pl

    r35594 r35747  
    129129my $astromSource;               # The astrometry source
    130130my $doBackground;               # Do we want to make background models?
     131my $noCompression;
    131132{
    132133    my $command = "$ppConfigDump -camera $camera -recipe PSWARP $recipe_pswarp -dump-recipe PSWARP -";
     
    141142    $astromSource = metadataLookupStr($metadata, 'ASTROM.SOURCE');
    142143    $doBackground = metadataLookupBool($metadata, 'BACKGROUND.MODEL');   
     144    $noCompression = metadataLookupBool($metadata, 'NO.COMPRESS');
    143145}
    144146
     
    299301    $command .= " -F SOURCE.PLOT.PSFMODEL SOURCE.PLOT.SKY.PSFMODEL";
    300302    $command .= " -F SOURCE.PLOT.APRESID SOURCE.PLOT.SKY.APRESID";
     303    $command .= " -R PSWARP.OUTPUT FITS.TYPE NONE" if $noCompression;
    301304    $command .= " -recipe PSWARP $recipe_pswarp";
    302305    $command .= " -tracedest $traceDest -log $logDest";
  • branches/eam_branches/ipp-20130509/ippTools/share

  • branches/eam_branches/ipp-20130509/ippTools/share/bgtool_advancechip.sql

    r28486 r35747  
    33    chipBackgroundImfile.magicked
    44FROM chipBackgroundRun
    5 JOIN chipProcessedImfile USING(chip_id)
    6 LEFT JOIN chipBackgroundImfile USING(chip_bg_id, class_id)
     5JOIN camRun using(cam_id)
     6JOIN chipProcessedImfile ON chipBackgroundRun.chip_id = chipProcessedImfile.chip_id
     7JOIN chipRun AS bgsub_chipRun on camRun.chip_id = bgsub_chipRun.chip_id
     8JOIN chipProcessedImfile AS bgsub_chipProcessedImfile
     9    ON (bgsub_chipRun.chip_id = bgsub_chipProcessedImfile.chip_id
     10        AND bgsub_chipProcessedImfile.class_id = chipProcessedImfile.class_id)
     11LEFT JOIN chipBackgroundImfile
     12    ON (chipBackgroundRun.chip_bg_id = chipBackgroundImfile.chip_bg_id
     13        AND chipBackgroundImfile.class_id = chipProcessedImfile.class_id)
    714WHERE chipBackgroundRun.state = 'new'
    815    AND chipProcessedImfile.quality = 0
    916    AND chipProcessedImfile.fault = 0
     17    AND bgsub_chipProcessedImfile.quality = 0
    1018-- WHERE hook %s
    11 GROUP BY chip_bg_id
     19GROUP BY chipBackgroundRun.chip_bg_id
    1220HAVING
    1321    COUNT(chipBackgroundImfile.class_id) = COUNT(chipProcessedImfile.class_id)
  • branches/eam_branches/ipp-20130509/ippTools/share/bgtool_definewarp.sql

    r35154 r35747  
    1515JOIN chipBackgroundRun ON chipRun.chip_id = chipBackgroundRun.chip_id
    1616    AND (chipBackgroundRun.cam_id = camRun.cam_id OR chipBackgroundRun.cam_id = 0)
    17 LEFT JOIN warpBackgroundRun ON chipBackgroundRun.chip_bg_id = warpBackgroundRun.warp_bg_id -- label hook %s
     17LEFT JOIN warpBackgroundRun ON chipBackgroundRun.chip_bg_id = warpBackgroundRun.chip_bg_id -- label hook %s
    1818WHERE chipBackgroundRun.state = 'full'
    1919    AND warpRun.state IN ('full', 'cleaned', 'goto_cleaned') -- need warp to have completed so warpSkyCellMap is populated
  • branches/eam_branches/ipp-20130509/ippTools/share/bgtool_tochip.sql

    r35154 r35747  
    11SELECT
    22    chipBackgroundRun.*,
    3     class_id,
     3    chipProcessedImfile.class_id,
    44    rawExp.exp_tag,
    55    rawExp.camera
     
    88JOIN rawExp USING(exp_id)
    99JOIN chipProcessedImfile USING(chip_id)
    10 LEFT JOIN chipBackgroundImfile USING(chip_bg_id, class_id)
     10JOIN camRun using(cam_id)
     11JOIN chipRun AS bgsub_chipRun on camRun.chip_id = bgsub_chipRun.chip_id
     12JOIN chipProcessedImfile AS bgsub_chipProcessedImfile
     13    ON (bgsub_chipRun.chip_id = bgsub_chipProcessedImfile.chip_id
     14        AND bgsub_chipProcessedImfile.class_id = chipProcessedImfile.class_id)
     15LEFT JOIN chipBackgroundImfile 
     16    ON (chipBackgroundRun.chip_bg_id = chipBackgroundImfile.chip_bg_id
     17        AND chipBackgroundImfile.class_id = chipProcessedImfile.class_id)
    1118LEFT JOIN Label ON chipBackgroundRun.label = Label.label
    1219WHERE chipBackgroundImfile.chip_bg_id IS NULL
     
    1421    AND chipProcessedImfile.fault = 0
    1522    AND chipProcessedImfile.quality = 0
     23    AND bgsub_chipProcessedImfile.quality = 0
    1624    AND (Label.active OR Label.active IS NULL)
    1725-- WHERE hook %s
  • branches/eam_branches/ipp-20130509/ippTools/share/camtool_find_pendingimfile.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippTools/share/chiptool_setimfiletoupdate.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippTools/share/pxadmin_create_tables.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippTools/share/warptool_towarped.sql

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippTools/src

  • branches/eam_branches/ipp-20130509/ippTools/src/bgtool.c

    r35189 r35747  
    774774
    775775    psMetadata *where = psMetadataAlloc();
    776     PXOPT_COPY_S64(config->args, where, "-chip_bg_id", "chip_bg_id", "==");
    777     pxAddLabelSearchArgs(config, where, "-label", "label", "==");
     776    PXOPT_COPY_S64(config->args, where, "-chip_bg_id", "chipBackgroundRun.chip_bg_id", "==");
     777    pxAddLabelSearchArgs(config, where, "-label", "chipBackgroundRun.label", "==");
    778778    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
    779779
  • branches/eam_branches/ipp-20130509/ippTools/src/camtool.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippTools/src/camtoolConfig.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippTools/src/chiptool.c

    r35594 r35747  
    493493    psFree(where);
    494494
    495     psStringAppend(&query, "\nORDER BY priority DESC, chip_id");
     495    psStringAppend(&query, "\nORDER BY priority DESC, chip_id, class_id");
    496496
    497497    // treat limit == 0 as "no limit"
  • branches/eam_branches/ipp-20130509/ippTools/src/magictool.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/ippTools/src/pstamptool.c

    r35365 r35747  
    142142    PXOPT_LOOKUP_STR(label,       config->args, "-set_label",         false, false);
    143143    PXOPT_LOOKUP_S32(pollInterval, config->args, "-set_poll_interval",false, false);
    144     PXOPT_LOOKUP_BOOL(no_magic, config->args, "-set_no_magic", false);
    145 
    146     bool need_magic = ! no_magic;
    147144
    148145    if (!pstampDataStoreInsert(config->dbh,
     
    155152            uri,
    156153            pollInterval,
    157             need_magic
     154            false
    158155        )) {
    159156        psError(PS_ERR_UNKNOWN, false, "database error");
  • branches/eam_branches/ipp-20130509/ippTools/src/pstamptoolConfig.c

    r35365 r35747  
    5151    psMetadataAddStr(adddatastoreArgs, PS_LIST_TAIL, "-set_label",        0, "define datastore label", NULL);
    5252    psMetadataAddS32(adddatastoreArgs, PS_LIST_TAIL, "-set_poll_interval", 0, "define datastore poll interval (seconds)", 60);
    53     psMetadataAddBool(adddatastoreArgs,PS_LIST_TAIL, "-set_no_magic",   0, "set magic not required", true);
    5453
    5554    // -datastore
  • branches/eam_branches/ipp-20130509/ppImage/src

  • branches/eam_branches/ipp-20130509/ppImage/src/Makefile.am

    r35531 r35747  
    6666        ppImageAddNoise.c \
    6767        ppImageRandomGaussian.c \
    68         ppImageAuxiliaryMask.c
     68        ppImageAuxiliaryMask.c \
     69        ppImageBurntoolApply.c
    6970
    7071CLEANFILES = *~
  • branches/eam_branches/ipp-20130509/ppImage/src/ppImage.h

    r35533 r35747  
    2626    bool doMaskBuild;                   // Build internal mask
    2727    bool doVarianceBuild;               // Build internal variance map
     28    bool doApplyBurntool;               // apply burntool correction
    2829    bool doMaskBurntool;                // mask potential burntool trails
    2930    bool doMaskSat;                     // mask saturated pixels
     
    182183bool ppImageCheckNoise(pmConfig *config, ppImageOptions *options, pmFPAview *view);
    183184
    184 bool ppImageBurntoolMask(pmConfig *config, ppImageOptions *options, pmFPAview *view, pmReadout *mask);
     185bool ppImageBurntoolMask(pmConfig *config, ppImageOptions *options, pmFPAview *view, pmReadout *readout);
     186bool ppImageBurntoolMaskFromTable(pmConfig *config, ppImageOptions *options, pmFPAview *view, pmReadout *readout);
     187
     188bool ppImageBurntoolApply(pmConfig *config, ppImageOptions *options, pmFPAview *view, pmReadout *readout);
    185189
    186190bool ppImageDetrendPatternApply(pmConfig *config, pmChip *chip, const pmFPAview *inputView, const ppImageOptions *options);
  • branches/eam_branches/ipp-20130509/ppImage/src/ppImageArguments.c

    r31155 r35747  
    117117    pmConfigFileSetsMD (config->arguments, &argc, argv, "LINEARITY", "-linearity", "-linearlist");
    118118
     119    if ((argnum = psArgumentGet(argc, argv, "-burntool"))) {
     120        psArgumentRemove(argnum, &argc, argv);
     121        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "BURNTOOL.TABLE", PS_META_REPLACE, "", argv[argnum]);
     122        psArgumentRemove(argnum, &argc, argv);
     123    }
     124
    119125    // chip selection is used to limit chips to be processed
    120126    if ((argnum = psArgumentGet (argc, argv, "-chip"))) {
  • branches/eam_branches/ipp-20130509/ppImage/src/ppImageAuxiliaryMask.c

    r35533 r35747  
    6060
    6161    if (!options->doAuxMask) {
    62         psLogMsg ("ppImage", PS_LOG_INFO, "Auxiliary mask not enabled.");
     62        psLogMsg ("ppImage", PS_LOG_DETAIL, "Auxiliary mask not enabled.");
    6363        return true;
    6464    }
  • branches/eam_branches/ipp-20130509/ppImage/src/ppImageDetrendReadout.c

    r35531 r35747  
    5656    }
    5757    done_video_check:
    58    
     58
    5959    // Masking on the basis of pixel value needs to be done before anything else, so the values are pristine.
    6060    if (options->doMaskBuild) {
     
    7474      pmMaskBadPixels(input, mask, options->maskValue);
    7575    }
     76
     77    if (options->doApplyBurntool)
     78    {
     79        // extern bool ppImageBurntoolApply(pmConfig *, ppImageOptions *, pmFPAview *, pmReadout *);
     80        ppImageBurntoolApply(config, options, view, input);
     81    }
     82   
    7683    if (options->doMaskBurntool) {
    77       ppImageBurntoolMask(config,options,view,input);
     84        if (options->doApplyBurntool) {
     85            // build burntool mask from data input burntool table
     86            ppImageBurntoolMaskFromTable(config,options,view,input);
     87        } else {
     88            // build burntool mask from data in the input image's fits extension
     89            ppImageBurntoolMask(config,options,view,input);
     90        }
    7891    }
    7992
  • branches/eam_branches/ipp-20130509/ppImage/src/ppImageDetrendRecord.c

    r29882 r35747  
    7676
    7777    detrendRecord(options->doNonLin,   detrend, config, view, "PPIMAGE.LINEARITY","DETREND.NONLIN",   "Non-linearity table filename");
     78
     79    detrendRecord(options->doDark & options->useVideoDark, detrend, config, view, "PPIMAGE.VIDEODARK", "DETREND.VIDEODARK", "VideoDark filename");
     80    detrendRecord(options->doMask & options->useVideoMask, detrend, config, view, "PPIMAGE.VIDEOMASK", "DETREND.VIDEOMASK", "VideoMASK filename");
    7881    psFree (detrend);
    7982    return true;
  • branches/eam_branches/ipp-20130509/ppImage/src/ppImageOptions.c

    r35531 r35747  
    2323    options->doMaskLow       = false;   // mask low pixels
    2424    options->doMaskBurntool  = false;   // mask potential burntool trails
     25    options->doApplyBurntool = false;   // apply burntool correction
    2526    options->doVarianceBuild = false;   // Build internal variance
    2627    options->doMask          = false;   // Mask bad pixels
     
    231232    options->doMaskLow       = psMetadataLookupBool(NULL, recipe, "MASK.LOW");
    232233    options->doMaskBurntool  = psMetadataLookupBool(NULL, recipe, "MASK.BURNTOOL");
     234    options->doApplyBurntool = psMetadataLookupBool(NULL, recipe, "APPLY.BURNTOOL");
    233235    options->doVarianceBuild = psMetadataLookupBool(NULL, recipe, "VARIANCE.BUILD");
    234236    options->doAuxMask       = psMetadataLookupBool(NULL, recipe, "MASK.AUXMASK");
  • branches/eam_branches/ipp-20130509/ppImage/src/ppImageParseCamera.c

    r35557 r35747  
    184184        }
    185185        outCTE->save = true;
     186    }
     187    if (options->doApplyBurntool) {
     188        // If no burntool file was supplied do not fail. (camera_exp.pl does not supply it
     189        // for example.
     190        if (!psMetadataLookupStr(NULL, config->arguments, "BURNTOOL.TABLE")) {
     191            psWarning("BURNTOOL.TABLE not supplied setting doApplyBurntool to false");
     192            options->doApplyBurntool = false;
     193        }
    186194    }
    187195
  • branches/eam_branches/ipp-20130509/psastro/src/psastro.h

    r28043 r35747  
    8383bool              psastroOneChipGrid (pmFPA *fpa, pmChip *chip, psArray *refset, psArray *rawset, psMetadata *recipe, psMetadata *updates);
    8484bool              psastroOneChipFit (pmFPA *fpa, pmChip *chip, pmReadout *readout, psArray *refset, psArray *rawset, psMetadata *recipe, psMetadata *updates);
    85 bool              psastroChooseRefstars (pmConfig *config, psArray *refs, const char *source);
     85bool              psastroChooseRefstars (pmConfig *config, psArray *refs, const char *source, bool saveExistingMatchedRefs);
    8686bool              psastroRefstarSubset (pmReadout *readout);
    8787pmLumFunc        *psastroLuminosityFunction (psArray *stars, pmLumFunc *rawFunc);
  • branches/eam_branches/ipp-20130509/psastro/src/psastroAnalysis.c

    r28043 r35747  
    8686    }
    8787
    88     if (!psastroChooseRefstars (config, refs, "PSASTRO.INPUT")) {
     88    bool skipastro = psMetadataLookupBool (&status, config->arguments, "PSASTRO.SKIP.ASTRO");
     89
     90    if (!psastroChooseRefstars (config, refs, "PSASTRO.INPUT", skipastro)) {
    8991        psError (PSASTRO_ERR_UNKNOWN, false, "failed to select reference data for chips\n");
    9092        psFree(refs);
     
    108110        mosastro  = psMetadataLookupBool (&status, recipe, "PSASTRO.MOSAIC.MODE");
    109111    }
    110     if (!chipastro && !mosastro) {
     112
     113    if (skipastro) {
     114        chipastro = false;
     115        mosastro = false;
     116        psLogMsg ("psastro", 3, "skip astrometry mode, accepting input astrometry\n");
     117    } else if (!chipastro && !mosastro) {
    111118        psLogMsg ("psastro", 3, "no astrometry mode selected, assuming chip astrometry\n");
    112119        chipastro = true;
     
    144151    }
    145152
    146     if (!psastroZeroPoint (config)) {
    147         psError(psErrorCodeLast(), false, "Failed to calculate zero point.");
    148         return false;
    149     }
     153    if (!skipastro) {
     154        if (!psastroZeroPoint (config)) {
     155            psError(psErrorCodeLast(), false, "Failed to calculate zero point.");
     156            return false;
     157        }
    150158
    151     if (!psastroAstromGuessCheck (config)) {
    152         psError(psErrorCodeLast(), false, "Failed to check astrometry guess.");
    153         return false;
     159        if (!psastroAstromGuessCheck (config)) {
     160            psError(psErrorCodeLast(), false, "Failed to check astrometry guess.");
     161            return false;
     162        }
    154163    }
    155164
  • branches/eam_branches/ipp-20130509/psastro/src/psastroArguments.c

    r26259 r35747  
    7474
    7575    // apply mosastro mode?
     76    bool mosastro = false;
    7677    if ((N = psArgumentGet (argc, argv, "-mosastro"))) {
    7778        psArgumentRemove (N, &argc, argv);
     
    8182        psArgumentRemove (N, &argc, argv);
    8283        psMetadataAddBool (config->arguments, PS_LIST_TAIL, "PSASTRO.MOSAIC.MODE", PS_META_REPLACE, "", true);
     84        mosastro = true;
    8385    }
    8486
    8587    // apply chipastro mode?
     88    bool chipastro = false;
    8689    if ((N = psArgumentGet (argc, argv, "-chipastro"))) {
    8790        psArgumentRemove (N, &argc, argv);
     
    9194        psArgumentRemove (N, &argc, argv);
    9295        psMetadataAddBool (config->arguments, PS_LIST_TAIL, "PSASTRO.CHIP.MODE", PS_META_REPLACE, "", true);
     96        chipastro = true;
     97    }
     98    if ((N = psArgumentGet (argc, argv, "-skipastro"))) {
     99        psArgumentRemove (N, &argc, argv);
     100        if (mosastro) {
     101            psError(PSASTRO_ERR_ARGUMENTS, true, "cannot specify +mosastro with -skipastro");
     102            psErrorStackPrint(stderr, "exit");
     103            return false;
     104        }
     105        if (chipastro) {
     106            psError(PSASTRO_ERR_ARGUMENTS, true, "cannot specify +chipastro with -skipastro");
     107            return false;
     108        }
     109        psMetadataAddBool (config->arguments, PS_LIST_TAIL, "PSASTRO.SKIP.ASTRO", PS_META_REPLACE, "", true);
    93110    }
    94111
  • branches/eam_branches/ipp-20130509/psastro/src/psastroChooseRefstars.c

    r35419 r35747  
    2020}
    2121
    22 bool psastroChooseRefstars (pmConfig *config, psArray *refs, const char *source) {
     22bool psastroChooseRefstars (pmConfig *config, psArray *refs, const char *source, bool saveExistingMatchedRefs) {
    2323
    2424    bool status;
     
    5555        // analysis.  however, we are re-doing the astrometry here, so remove
    5656        // that prior set of matched references
    57         psMetadataRemoveKey (fpa->analysis, "MATCHED_REFS");
     57        if (!saveExistingMatchedRefs) {
     58            psMetadataRemoveKey (fpa->analysis, "MATCHED_REFS");
     59        }
    5860    }
    5961
  • branches/eam_branches/ipp-20130509/psastro/src/psastroExtractAnalysis.c

    r23592 r35747  
    4444    }
    4545
    46     if (!psastroChooseRefstars (config, refs, "PSASTRO.EXTRACT.ASTROM")) {
     46    if (!psastroChooseRefstars (config, refs, "PSASTRO.EXTRACT.ASTROM", false)) {
    4747        psError (PSASTRO_ERR_UNKNOWN, false, "failed to select reference data for chips\n");
    4848        psFree(refs);
  • branches/eam_branches/ipp-20130509/psconfig

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/pstamp/scripts

  • branches/eam_branches/ipp-20130509/pstamp/scripts/pstamp_job_run.pl

    r35497 r35747  
    6868        or my_die ("unable to redirect output to $logDest", $job_id, $PS_EXIT_UNKNOWN_ERROR);
    6969}
    70 
    7170
    7271if (!$dbserver) {
  • branches/eam_branches/ipp-20130509/pstamp/src/ppstampMakeStamp.c

    r35497 r35747  
    814814    psArray *inSources = inDetections->allSources;
    815815
     816    // copy analysis metadata in order to pick up any data stored there from the input file.
     817    // This includes detection efficiency analysis and extended source parameters.
     818    psMetadataCopy(outReadout->analysis, inReadout->analysis);
     819
     820    // now replace the sources with a new container
    816821    pmDetections *outDetections = pmDetectionsAlloc();
    817822    psMetadataAddPtr (outReadout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN,
     
    820825    psArray *outSources = outDetections->allSources = psArrayAllocEmpty( 100 );
    821826
    822     // include sources that are off the stamp by just a little bit
     827    // include sources that are off the stamp by just a little bit
     828    // XXX: should I be doing this?
    823829    #define EXPAND_SIZE 16
    824830    psRegion sourceRegion = extractRegion;
     
    828834    sourceRegion.y1 += EXPAND_SIZE;
    829835
     836    bool adjustCoords = extractRegion.x0 != 0 || extractRegion.y0 != 0;
     837
    830838    for (int i = 0; i < inSources->n; i++ ) {
    831839        pmSource *src = inSources->data[i];
     
    837845            continue;
    838846        }
     847        if (adjustCoords) {
     848            // adjust the source position for the stamp coordinate system
     849            src->peak->x  -= extractRegion.x0;
     850            src->peak->xf -= extractRegion.x0;
     851
     852            src->peak->y  -= extractRegion.y0;
     853            src->peak->yf -= extractRegion.y0;
     854            if (src->moments) {
     855                src->moments->Mx -= extractRegion.x0;
     856                src->moments->My -= extractRegion.y0;
     857            }
     858            if (src->modelPSF) {
     859                src->modelPSF->params->data.F32[PM_PAR_XPOS] -= extractRegion.x0;
     860                src->modelPSF->params->data.F32[PM_PAR_YPOS] -= extractRegion.y0;
     861            }
     862
     863            if (src->modelFits) {
     864                for (int j = 0; j < src->modelFits->n; j++) {
     865                    pmModel *model = src->modelFits->data[j];
     866                    assert (model != NULL);
     867                    model->params->data.F32[PM_PAR_XPOS] -= extractRegion.x0;
     868                    model->params->data.F32[PM_PAR_YPOS] -= extractRegion.y0;
     869                }
     870            }
     871        }
     872
    839873        psArrayAdd(outSources, 100, src);
    840874    }
  • branches/eam_branches/ipp-20130509/psvideophot

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130509/pswarp/src/pswarpDefineLayout.c

    r35563 r35747  
    4040    // chips are not processed unless we have determined they overlap the inputs
    4141    pmFPAExcludeChips (output->fpa);
     42    if (bkgModel) {
     43        pmFPAExcludeChips (bkgModel->fpa);
     44    }
    4245
    4346    int nInputs = psMetadataLookupS32(&status, config->arguments, "NUM_INPUTS");
  • branches/eam_branches/ipp-20130509/pswarp/src/pswarpLoadAstrometry.c

    r35563 r35747  
    3838        psTrace ("pswarp", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    3939        if (!chip->process || !chip->file_exists) { continue; }
     40        pmChip *targetChip = pmFPAviewThisChip(view, target->fpa); // < Chip in the output
     41        if (!targetChip || !targetChip->process || !targetChip->file_exists) {
     42            continue; // only load astrometry into output chips which exist!
     43        }
    4044        if (!pmFPAfileRead (astrom, view, config)) {
    4145            psError(psErrorCodeLast(), false, "failed READ at CHIP %s", astrom->name);
     
    109113        if (!chip->process || !chip->file_exists) { continue; }
    110114
     115        pmChip *targetChip = pmFPAviewThisChip(view, target->fpa); // < Chip in the output
     116        if (!targetChip || !targetChip->process || !targetChip->file_exists) {
     117            continue; // only load astrometry into output chips which exist!
     118        }
     119
    111120        // we've got the astrom header
    112121        pmHDU *hdu = pmHDUFromChip(chip); ///< HDU for source
     
    116125            return false;
    117126        }
    118 
    119         // We read from the astrometry source into the target.
    120         pmChip *targetChip = pmFPAviewThisChip(view, target->fpa); ///< Chip in the output
    121         if (!targetChip) continue; // only load astrometry into output chips which exist!
    122127
    123128        if (bilevelAstrometry) {
  • branches/eam_branches/ipp-20130509/pswarp/src/pswarpLoopBackground.c

    r35563 r35747  
    3636    }
    3737
    38     // select the input data sources
     38    // select the input data background model
    3939    pmFPAfile *output = psMetadataLookupPtr(&status, config->files, "PSWARP.OUTPUT.BKGMODEL");
    4040    if (!output) {
  • branches/eam_branches/ipp-20130509/tools/runchipimfile.pl

    r33965 r35747  
    7777
    7878if ($outdir) {
     79    $outdir = $ENV{PWD} if $outdir eq '.';
    7980    my $base = basename($path_base);
    8081    $path_base = "$outdir/$base";
Note: See TracChangeset for help on using the changeset viewer.