IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23688


Ignore:
Timestamp:
Apr 2, 2009, 2:51:37 PM (17 years ago)
Author:
Paul Price
Message:

Merging in branches/pap/ from r23685. Some conflicts, most notably in ippTools, but these resolved fairly simply. Only question mark is on regtool reversion, but I think I got it right. Everything builds fine.

Location:
trunk
Files:
3 deleted
147 edited
5 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Nebulous/nebclient/src/nebulous.h

    r23198 r23688  
    11/* src/nebulous.h
    22   Generated by wsdl2h 1.2.12 from nebulous.wsdl and typemap.dat
    3    2009-03-05 21:11:05 GMT
     3   2009-04-03 00:34:43 GMT
    44   Copyright (C) 2001-2008 Robert van Engelen, Genivia Inc. All Rights Reserved.
    55   This part of the software is released under one of the following licenses:
  • trunk/Nebulous/nebclient/src/soapC.c

    r23198 r23688  
    1212#endif
    1313
    14 SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.12 2009-03-05 21:11:05 GMT")
     14SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.12 2009-04-03 00:34:43 GMT")
    1515
    1616
  • trunk/Nebulous/nebclient/src/soapClient.c

    r23198 r23688  
    1010#endif
    1111
    12 SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.12 2009-03-05 21:11:05 GMT")
     12SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.12 2009-04-03 00:34:43 GMT")
    1313
    1414
  • trunk/Nebulous/nebclient/src/soapServer.c

    r23198 r23688  
    1010#endif
    1111
    12 SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.12 2009-03-05 21:11:05 GMT")
     12SOAP_SOURCE_STAMP("@(#) soapServer.c ver 2.7.12 2009-04-03 00:34:43 GMT")
    1313
    1414
  • trunk/Ohana

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/dbconfig/cam.md

    r20274 r23688  
    8787    path_base      STR      255
    8888    fault          S16      0       # Key NOT NULL
     89    quality        S16      0
    8990END
    9091
  • trunk/dbconfig/changes.txt

    r23663 r23688  
    899899update chipRun SET magicked = 1 where chip_id = 11955;
    900900
     901
     902-- Version 1.1.51
     903
     904-- Distribution updates
    901905CREATE TABLE distTarget (
    902906    target_id   BIGINT AUTO_INCREMENT,
     
    908912    PRIMARY KEY(target_id)
    909913)  ENGINE=innodb DEFAULT CHARSET=latin1;
    910 
    911914
    912915CREATE TABLE rcDSProduct (
     
    931934)  ENGINE=innodb DEFAULT CHARSET=latin1;
    932935
    933 
    934936CREATE TABLE rcInterest (
    935937    int_id      BIGINT AUTO_INCREMENT,
     
    967969)  ENGINE=innodb DEFAULT CHARSET=latin1;
    968970
    969 -- 1.1.51
    970 
    971971ALTER TABLE distRun ADD COLUMN no_magic TINYINT AFTER clean;
     972
     973
     974-- Adding data quality flags
     975DROP TABLE guidePendingExp;
     976ALTER TABLE diffSkyfile ADD COLUMN quality SMALLINT NOT NULL DEFAULT 0 AFTER fault;
     977ALTER TABLE stackSumSkyfile ADD COLUMN quality SMALLINT NOT NULL DEFAULT 0 AFTER fault;
     978ALTER TABLE warpSkyfile ADD COLUMN quality SMALLINT NOT NULL DEFAULT 0 AFTER fault;
     979ALTER TABLE camProcessedExp ADD COLUMN quality SMALLINT NOT NULL DEFAULT 0 AFTER fault;
     980ALTER TABLE chipProcessedImfile ADD COLUMN quality SMALLINT NOT NULL DEFAULT 0 AFTER fault;
     981ALTER TABLE rawImfile ADD COLUMN quality SMALLINT NOT NULL DEFAULT 0 AFTER fault;
     982
     983ALTER TABLE warpSkyfile DROP COLUMN ignored;
     984
     985ALTER TABLE diffSkyfile ADD KEY(quality);
     986ALTER TABLE stackSumSkyfile ADD KEY(quality);
     987ALTER TABLE warpSkyfile ADD KEY(quality);
     988ALTER TABLE camProcessedExp ADD KEY(quality);
     989ALTER TABLE chipProcessedImfile ADD KEY(quality);
     990ALTER TABLE rawImfile ADD KEY(quality);
     991
     992-- Version 1.1.52
  • trunk/dbconfig/chip.md

    r23382 r23688  
    8888    path_base       STR     255
    8989    fault           S16     0       # Key NOT NULL
     90    quality         S16     0
    9091    magicked        BOOL    f
    9192END
  • trunk/dbconfig/config.md

    r23391 r23688  
    22    pkg_name        STR     ippdb
    33    pkg_namespace   STR     ippdb
    4     pkg_version     STR     1.1.50
     4    pkg_version     STR     1.1.52
    55END
  • trunk/dbconfig/diff.md

    r23388 r23688  
    5454    good_frac    F32        0.0     # Key
    5555    fault        S16        0       # Key
     56    quality      S16        0
    5657    magicked     BOOL       f
    5758END
  • trunk/dbconfig/ipp.m4

    r23663 r23688  
    99dnl include(telescope.md)
    1010dnl include(skycell.md)
    11 include(tasks.md)
    12 include(guide.md)
     11include(summitcopy.md)
     12include(new.md)
     13include(raw.md)
    1314include(chip.md)
    1415include(cam.md)
  • trunk/dbconfig/stack.md

    r19930 r23688  
    4646    good_frac          F32    0.0     # Key
    4747    fault              S16    0       # Key
     48    quality            S16    0
    4849END
  • trunk/dbconfig/warp.md

    r23383 r23688  
    5555    ymin           S32      0
    5656    ymax           S32      0
    57     ignored        BOOL     f       # Key
    5857    fault          S16      0       # Key
     58    quality        S16      0
    5959    magicked       BOOL     f
    6060END
  • trunk/ippScripts/scripts/camera_exp.pl

    r23295 r23688  
    263263            &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code);
    264264        }
    265         # XXX do we want to give an error if astrometry fails here?
    266         &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects);
    267 
     265
     266        my $quality;            # Quality flag
    268267        if ($do_stats) {
    269268            my $fpaStatsReal = $ipprc->file_resolve($fpaStats);
     
    282281            }
    283282            chomp $cmdflags;
     283
     284            ($quality) = $cmdflags =~ /-quality (\d+)/;
     285        }
     286
     287        if (!$quality) {
     288            &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects);
    284289        }
    285290
     
    375380            $command .= " -addprocessedexp";
    376381            $command .= " -uri UNKNOWN";
    377             $command .= " -code $exit_code";
     382            $command .= " -fault $exit_code";
    378383            $command .= " -path_base $outroot";
    379384            $command .= " -path_base $outroot" if defined $outroot;
     
    381386        } else {
    382387            $command .= " -updateprocessedexp";
    383             $command .= " -code $exit_code";
     388            $command .= " -fault $exit_code";
    384389        }
    385390        $command .= " -hostname $host" if defined $host;
  • trunk/ippScripts/scripts/chip_imfile.pl

    r23588 r23688  
    181181    ## allow the output images to be optional, depending on the recipe / reduction class
    182182    my $outputImageExpect = metadataLookupBool($recipeData, 'CHIP.FITS');
    183     if ($outputImageExpect) {
    184         &my_die("Couldn't find expected output file: $outputImage\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
    185     }
    186 
    187183    my $outputMaskExpect = metadataLookupBool($recipeData, 'CHIP.MASK.FITS');
    188     if ($outputMaskExpect) {
    189         &my_die("Couldn't find expected output file: $outputMask\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
    190     }
    191 
    192184    my $outputWeightExpect = metadataLookupBool($recipeData, 'CHIP.VARIANCE.FITS');
    193     if ($outputWeightExpect) {
    194         &my_die("Couldn't find expected output file: $outputWeight\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
    195     }
    196 
    197     &my_die("Couldn't find expected output file: $outputBin1\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin1);
    198     &my_die("Couldn't find expected output file: $outputBin2\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin2);
    199 
     185
     186    my $quality;                # Quality flag
    200187    if ($do_stats) {
    201188        my $outputStatsReal = $ipprc->file_resolve($outputStats);
     
    214201        }
    215202        chomp $cmdflags;
    216     }
     203        ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
     204    }
     205
     206    if (!$quality) {
     207        &my_die("Couldn't find expected output file: $outputImage\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless !$outputImageExpect or $ipprc->file_exists($outputImage);
     208        &my_die("Couldn't find expected output file: $outputMask\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless !$outputMaskExpect or $ipprc->file_exists($outputMask);
     209        &my_die("Couldn't find expected output file: $outputWeight\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless !$outputWeightExpect or $ipprc->file_exists($outputWeight);
     210        &my_die("Couldn't find expected output file: $outputBin1\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin1);
     211        &my_die("Couldn't find expected output file: $outputBin2\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin2);
     212    }
     213
    217214}
    218215
     
    277274        $command .= " -chip_id $chip_id";
    278275        $command .= " -class_id $class_id";
    279         $command .= " -code $exit_code";
     276        $command .= " -fault $exit_code";
    280277        $command .= " -dbname $dbname" if defined $dbname;
    281278        system ($command);
  • trunk/ippScripts/scripts/detrend_correct_imfile.pl

    r23295 r23688  
    132132        $command .= " -class_id $class_id";
    133133        $command .= " -path_base $outroot";
    134         $command .= " -code $exit_code";
     134        $command .= " -fault $exit_code";
    135135        $command .= " -dbname $dbname" if defined $dbname;
    136136        system ($command);
  • trunk/ippScripts/scripts/detrend_norm_apply.pl

    r23464 r23688  
    206206        $command .= " -class_id $class_id";
    207207        $command .= " -path_base $outroot";
    208         $command .= " -code $exit_code";
     208        $command .= " -fault $exit_code";
    209209        $command .= " -dbname $dbname" if defined $dbname;
    210210        system ($command);
  • trunk/ippScripts/scripts/detrend_norm_calc.pl

    r23464 r23688  
    239239        $command .= " -iteration $iter";
    240240        # XXX EAM : we should add this to the db : $command .= " -path_base $outroot";
    241         $command .= " -code $exit_code";
     241        $command .= " -fault $exit_code";
    242242        $command .= " -dbname $dbname" if defined $dbname;
    243243        system ($command);
  • trunk/ippScripts/scripts/detrend_norm_exp.pl

    r23295 r23688  
    191191        $command .= " -iteration $iter";
    192192        $command .= " -path_base $outroot ";
    193         $command .= " -code $exit_code";
     193        $command .= " -fault $exit_code";
    194194        $command .= " -dbname $dbname" if defined $dbname;
    195195        system ($command);
  • trunk/ippScripts/scripts/detrend_process_exp.pl

    r23295 r23688  
    205205        $command .= " -det_id $det_id";
    206206        $command .= " -exp_id $exp_id";
    207         $command .= " -code $exit_code";
     207        $command .= " -fault $exit_code";
    208208        $command .= " -path_base $outroot";
    209209        $command .= " -dbname $dbname" if defined $dbname;
  • trunk/ippScripts/scripts/detrend_process_imfile.pl

    r23464 r23688  
    195195        $command .= " -class_id $class_id";
    196196        $command .= " -path_base $outroot";
    197         $command .= " -code $exit_code";
     197        $command .= " -fault $exit_code";
    198198        $command .= " -dbname $dbname" if defined $dbname;
    199199        system ($command);
  • trunk/ippScripts/scripts/detrend_reject_exp.pl

    r23295 r23688  
    344344        $command .= " -iteration $iter";
    345345        # XXX EAM : we should add this to the db : $command .= " -path_base $outroot";
    346         $command .= " -code $exit_code";
     346        $command .= " -fault $exit_code";
    347347        $command .= " -dbname $dbname" if defined $dbname;
    348348        system ($command);
  • trunk/ippScripts/scripts/detrend_resid_exp.pl

    r23427 r23688  
    651651        $command .= " -exp_id $exp_id";
    652652        $command .= " -path_base $outroot";
    653         $command .= " -code $exit_code";
     653        $command .= " -fault $exit_code";
    654654        $command .= " -dbname $dbname" if defined $dbname;
    655655        system ($command);
  • trunk/ippScripts/scripts/detrend_resid_imfile.pl

    r23464 r23688  
    265265        $command .= " -class_id $class_id";
    266266        $command .= " -path_base $outroot";
    267         $command .= " -code $exit_code";
     267        $command .= " -fault $exit_code";
    268268        $command .= " -dbname $dbname" if defined $dbname;
    269269        system ($command);
  • trunk/ippScripts/scripts/detrend_stack.pl

    r23464 r23688  
    262262        $command .= " -class_id $class_id";
    263263        # XXX EAM : we should add this to the db : $command .= " -path_base $outroot";
    264         $command .= " -code $exit_code";
     264        $command .= " -fault $exit_code";
    265265        $command .= " -dbname $dbname" if defined $dbname;
    266266        system ($command);
  • trunk/ippScripts/scripts/diff_skycell.pl

    r23438 r23688  
    248248        &my_die("Unable to perform ppSub: $error_code", $diff_id, $skycell_id, $error_code);
    249249    }
    250     &my_die("Couldn't find expected output file: $outputName", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
    251     &my_die("Couldn't find expected output file: $outputMask", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
    252     &my_die("Couldn't find expected output file: $outputVariance", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance);
    253 #    &my_die("Couldn't find expected output file: $outputSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
    254 #    &my_die("Couldn't find expected output file: $bin1Name",    $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin1Name);
    255 #    &my_die("Couldn't find expected output file: $bin2Name",    $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin2Name);
    256250
    257251    my $outputStatsReal = $ipprc->file_resolve($outputStats);
     
    270264    }
    271265    chomp $cmdflags;
     266
     267    my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
     268
     269    if (!$quality) {
     270        &my_die("Couldn't find expected output file: $outputName", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
     271        &my_die("Couldn't find expected output file: $outputMask", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
     272        &my_die("Couldn't find expected output file: $outputVariance", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance);
     273#        &my_die("Couldn't find expected output file: $outputSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
     274#        &my_die("Couldn't find expected output file: $bin1Name",    $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin1Name);
     275#        &my_die("Couldn't find expected output file: $bin2Name",    $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin2Name);
     276    }
    272277}
    273278
     
    304309    warn($msg);
    305310    if (defined $diff_id and defined $skycell_id and not $no_update) {
    306         my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -code $exit_code";
     311        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -fault $exit_code";
    307312        $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
    308313        $command .= " -hostname $host" if defined $host;
  • trunk/ippScripts/scripts/dist_advancerun.pl

    r23295 r23688  
    134134    my $command = "$disttool -updaterun";
    135135    $command   .= " -dist_id $dist_id";
    136     $command   .= " -code $exit_code";
     136    $command   .= " -fault $exit_code";
    137137    $command   .= " -dbname $dbname" if defined $dbname;
    138138
  • trunk/ippScripts/scripts/dist_component.pl

    r23441 r23688  
    304304    $command   .= " -dist_id $dist_id";
    305305    $command   .= " -component $component";
    306     $command   .= " -code $exit_code";
     306    $command   .= " -fault $exit_code";
    307307    $command   .= " -dbname $dbname" if defined $dbname;
    308308
  • trunk/ippScripts/scripts/fake_imfile.pl

    r23295 r23688  
    216216        $command .= " -path_base $outroot";
    217217        $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
    218         $command .= " -code $exit_code";
     218        $command .= " -fault $exit_code";
    219219        $command .= " -dbname $dbname" if defined $dbname;
    220220        system ($command);
  • trunk/ippScripts/scripts/flatcorr_proc.pl

    r20540 r23688  
    320320        my $command = "$flatcorr -addprocess";
    321321        $command .= " -corr_id $corr_id";
    322         $command .= " -code $exit_code";
     322        $command .= " -fault $exit_code";
    323323        $command .= " -hostname $host" if defined $host;
    324324        $command .= " -dbname $dbname" if defined $dbname;
  • trunk/ippScripts/scripts/magic_destreak.pl

    r23636 r23688  
    274274    $command   .= " -magic_ds_id $magic_ds_id";
    275275    $command   .= " -component $component";
    276     $command   .= " -code $exit_code";
     276    $command   .= " -fault $exit_code";
    277277    $command   .= " -dbname $dbname" if defined $dbname;
    278278
  • trunk/ippScripts/scripts/magic_mask.pl

    r23295 r23688  
    152152        my $command = "$magictool -addmask";
    153153        $command .= " -magic_id $magic_id";
    154         $command .= " -code $exit_code";
     154        $command .= " -fault $exit_code";
    155155        $command .= " -dbname $dbname" if defined $dbname;
    156156        system($command);
  • trunk/ippScripts/scripts/magic_process.pl

    r23637 r23688  
    343343        $command .= " -magic_id $magic_id";
    344344        $command .= " -node $node";
    345         $command .= " -code $exit_code";
     345        $command .= " -fault $exit_code";
    346346        $command .= " -dbname $dbname" if defined $dbname;
    347347        system($command);
  • trunk/ippScripts/scripts/magic_tree.pl

    r23295 r23688  
    296296        my $command = "$magictool -inputtree";
    297297        $command .= " -magic_id $magic_id";
    298         $command .= " -code $exit_code";
     298        $command .= " -fault $exit_code";
    299299        $command .= " -dbname $dbname" if defined $dbname;
    300300        system($command);
  • trunk/ippScripts/scripts/register_exp.pl

    r23295 r23688  
    191191    carp($msg);
    192192    if (defined $exp_id and not $no_update) {
    193         my $command = "$regtool -addprocessedexp -exp_id $exp_id -code $exit_code";
     193        my $command = "$regtool -addprocessedexp -exp_id $exp_id -fault $exit_code";
    194194        $command .= " -hostname $host" if defined $host;
    195195        $command .= " -dbname $dbname" if defined $dbname;
  • trunk/ippScripts/scripts/register_imfile.pl

    r23540 r23688  
    112112
    113113# we require at a minimum: -telescope, -inst, -filelevel, -class_id, -exp_type
    114 if (uc(&value_for_flag ($cmdflags, "NULL", "-telescope")) eq "NULL") { &my_die ("telescope not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
    115 if (uc(&value_for_flag ($cmdflags, "NULL", "-inst"))      eq "NULL") { &my_die ("inst      not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
    116 if (uc(&value_for_flag ($cmdflags, "NULL", "-filelevel")) eq "NULL") { &my_die ("filelevel not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
    117 if (uc(&value_for_flag ($cmdflags, "NULL", "-class_id"))  eq "NULL") { &my_die ("class_id  not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
    118 if (uc(&value_for_flag ($cmdflags, "NULL", "-exp_type"))  eq "NULL") { &my_die ("exp_type  not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
     114if (uc(&value_for_flag ($cmdflags, "-telescope")) eq "NULL") { &my_die ("telescope not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
     115if (uc(&value_for_flag ($cmdflags, "-inst"))      eq "NULL") { &my_die ("inst      not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
     116if (uc(&value_for_flag ($cmdflags, "-filelevel")) eq "NULL") { &my_die ("filelevel not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
     117if (uc(&value_for_flag ($cmdflags, "-class_id"))  eq "NULL") { &my_die ("class_id  not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
     118if (uc(&value_for_flag ($cmdflags, "-exp_type"))  eq "NULL") { &my_die ("exp_type  not found", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR); }
    119119
    120120my $command = "$regtool -addprocessedimfile";
     
    226226        $command .= " -inst UNKNOWN";
    227227        $command .= " -class_id $tmp_class_id";
    228         $command .= " -code $exit_code";
     228        $command .= " -fault $exit_code";
    229229        $command .= " -hostname $host" if defined $host;
    230230        $command .= " -dbname $dbname" if defined $dbname;
  • trunk/ippScripts/scripts/stack_skycell.pl

    r23380 r23688  
    232232        &my_die("Unable to perform ppStack: $error_code", $stack_id, $error_code);
    233233    }
    234     &my_die("Couldn't find expected output file: $outputName", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
    235     &my_die("Couldn't find expected output file: $outputMask", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
    236     &my_die("Couldn't find expected output file: $outputWeight", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
    237     &my_die("Couldn't find expected output file: $outputSources", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
    238 #   &my_die("Couldn't find expected output file: $bin1Name",    $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin1Name);
    239 #   &my_die("Couldn't find expected output file: $bin2Name",    $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin2Name);
    240 
     234
     235    my $quality;                # Quality flag
    241236    if ($do_stats) {
    242237        my $outputStatsReal = $ipprc->file_resolve($outputStats);
     
    255250        }
    256251        chomp $cmdflags;
    257     }
     252
     253        ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
     254    }
     255
     256    if (!$quality) {
     257        &my_die("Couldn't find expected output file: $outputName", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
     258        &my_die("Couldn't find expected output file: $outputMask", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
     259        &my_die("Couldn't find expected output file: $outputWeight", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
     260        &my_die("Couldn't find expected output file: $outputSources", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
     261#       &my_die("Couldn't find expected output file: $bin1Name",    $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin1Name);
     262#       &my_die("Couldn't find expected output file: $bin2Name",    $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin2Name);
     263    }
     264
    258265}
    259266
     
    306313
    307314    if (defined $stack_id and not $no_update) {
    308         my $command = "$stacktool -stack_id $stack_id -code $exit_code";
     315        my $command = "$stacktool -stack_id $stack_id -fault $exit_code";
    309316        if ($run_state eq 'new') {
    310317            $command .= " -addsumskyfile";
  • trunk/ippScripts/scripts/summit_copy.pl

    r23497 r23688  
    148148        $command .= " -class_id $class_id";
    149149        $command .= " -uri $uri";
    150         $command .= " -code $exit_code";
     150        $command .= " -fault $exit_code";
    151151        $command .= " -dbname $dbname" if defined $dbname;
    152152
  • trunk/ippScripts/scripts/warp_overlap.pl

    r23295 r23688  
    193193        my $command = "$warptool -addoverlap";
    194194        $command .= " -warp_id $warp_id";
    195         $command .= " -code $exit_code";
     195        $command .= " -fault $exit_code";
    196196        $command .= " -dbname $dbname" if defined $dbname;
    197197        system ($command);
  • trunk/ippScripts/scripts/warp_skycell.pl

    r23430 r23688  
    175175# Run pswarp
    176176my $cmdflags;
    177 my $accept = 1;                 # Accept the skycell?
    178177my $do_stats;
    179178unless ($no_op) {
     
    215214
    216215    if ($do_stats) {
    217         # Check first for the stats file, and if the ACCEPT flag is set.
     216        # Check first for the stats file
    218217        my $outputStatsReal = $ipprc->file_resolve($outputStats);
    219218        &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless -f $outputStatsReal;
     
    232231        chomp $cmdflags;
    233232
    234         if ($cmdflags =~ /-accept/) {
     233        my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
     234
     235        if (!$quality) {
    235236            &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
    236237            &my_die("Couldn't find expected output file: $outputMask", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
     
    249250            $command .= " -magicked" if $magicked;
    250251
    251             $command .= " -uri $outputImage" if $accept;
     252            $command .= " -uri $outputImage" if !$quality;
    252253            $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
    253             $command .= " $cmdflags" if $accept;
     254            $command .= " $cmdflags";
    254255            $command .= " -hostname $host"   if defined $host;
    255256            $command .= " -dbname $dbname"   if defined $dbname;
     
    307308        $command .= " -skycell_id $skycell_id";
    308309        $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
    309         $command .= " -code $exit_code";
     310        $command .= " -fault $exit_code";
    310311        $command .= " -dbname $dbname" if defined $dbname;
    311312        run(command => $command, verbose => $verbose);
  • trunk/ippTools/configure.ac

    r23391 r23688  
    1818PKG_CHECK_MODULES([PSLIB], [pslib >= 1.1.0])
    1919PKG_CHECK_MODULES([PSMODULES], [psmodules >= 1.1.0])
    20 PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.50])
     20PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.52])
    2121
    2222PXTOOLS_CFLAGS="${PSLIB_CFLAGS=} ${PSMODULES_CFLAGS=} ${IPPDB_CFLAGS=}"
  • trunk/ippTools/share/chiptool_completely_processed_exp.sql

    r23381 r23688  
    3535        COUNT(rawImfile.class_id) = COUNT(chipProcessedImfile.class_id)
    3636        AND SUM(chipProcessedImfile.fault) = 0
     37        AND SUM(chipProcessedImfile.quality > 0) != COUNT(*)
    3738    ) as Foo
  • trunk/ippTools/share/difftool_definebyquery.sql

    r20973 r23688  
    3838    WHERE
    3939        warpSkyfile.fault = 0
    40         AND warpSkyfile.ignored = 0
     40        AND warpSkyfile.quality = 0
    4141    -- warpsToDiff WHERE hook %s
    4242    ) AS warpsToDiff
     
    5151    WHERE stackRun.state = 'full'
    5252        AND stackSumSkyfile.fault = 0
     53        AND stackSumSkyfile.quality = 0
    5354    -- stacksForDiff WHERE hook %s
    5455    GROUP BY
  • trunk/ippTools/share/difftool_definebyquery_part1.sql

    r20973 r23688  
    1     SELECT
    2         exp_id,
    3         warp_id,
    4         rawExp.filter,
    5         warpRun.label,
    6         warpRun.tess_id,
    7         count(skycell_id) as skycell_count
    8     FROM warpRun
    9     JOIN warpSkyfile USING(warp_id)
    10     JOIN fakeRun USING(fake_id)
    11     JOIN camRun USING(cam_id)
    12     JOIN chipRun USING (chip_id)
    13     JOIN rawExp USING(exp_id)
    14     LEFT JOIN diffRun USING(exp_id)
    15 
    16     WHERE
    17         warpSkyfile.ignored = 0
    18         -- warp where hook %s
    19         -- exp where hook %s
    20         -- diff where hook %s
    21 
    22     GROUP BY exp_id, warp_id DESC
     1SELECT
     2    exp_id,
     3    warp_id,
     4    rawExp.filter,
     5    warpRun.label,
     6    warpRun.tess_id,
     7    COUNT(skycell_id) as skycell_count
     8FROM warpRun
     9JOIN warpSkyfile USING(warp_id)
     10JOIN fakeRun USING(fake_id)
     11JOIN camRun USING(cam_id)
     12JOIN chipRun USING(chip_id)
     13JOIN rawExp USING(exp_id)
     14LEFT JOIN diffRun USING(exp_id)
     15WHERE
     16    warpSkyfile.fault = 0
     17    AND warpSkyfile.quality = 0
     18    -- warp where hook %s
     19    -- exp where hook %s
     20    -- diff where hook %s
     21GROUP BY exp_id, warp_id DESC
  • trunk/ippTools/share/difftool_definebyquery_part2.sql

    r21308 r23688  
    11-- insert skycells to diff
    22INSERT INTO skycellsToDiff
     3SELECT
     4    0,                      -- diff_id
     5    warpSkyfile.skycell_id,
     6    warpSkyfile.warp_id,    -- warp1
     7    NULL,                   -- stack1
     8    NULL,                   -- warp2
     9    max_stack_id,           -- stack2
     10    warpSkyfile.tess_id,
     11    0
     12FROM warpSkyfile
     13JOIN warpRun USING(warp_id)
     14LEFT JOIN (
    315    SELECT
    4         0,                      -- diff_id
    5         warpSkyfile.skycell_id,
    6         warpSkyfile.warp_id,    -- warp1
    7         NULL,                   -- stack1
    8         NULL,                   -- warp2
    9         max_stack_id,           -- stack2
    10         warpSkyfile.tess_id,
    11         0
    12         FROM warpSkyfile
    13         JOIN warpRun USING(warp_id)
    14         LEFT JOIN (
    15             SELECT
    16                 MAX(stack_id) AS max_stack_id, -- most recent stack, by virtue of auto-increment
    17                 stackRun.skycell_id,
    18                 stackRun.tess_id,
    19                 filter
    20             FROM stackRun
    21             JOIN stackSumSkyfile USING(stack_id)
    22             WHERE stackSumSkyfile.fault = 0
    23                 AND stackRun.state = 'full'
    24             -- stacks where hook %s
    25             GROUP BY
    26                 skycell_id,
    27                 filter
    28             ) as bestStacks
    29         USING(skycell_id)
    30         WHERE
    31             warpSkyfile.warp_id = %lld
    32             AND ignored = 0
    33             AND filter = '%s'
    34             AND warpSkyfile.tess_id = bestStacks.tess_id
    35         -- (good fraction test goes here for example also above)
    36         -- warp where hook %s
     16        MAX(stack_id) AS max_stack_id, -- most recent stack, by virtue of auto-increment
     17        stackRun.skycell_id,
     18        stackRun.tess_id,
     19        filter
     20    FROM stackRun
     21    JOIN stackSumSkyfile USING(stack_id)
     22    WHERE stackSumSkyfile.fault = 0
     23        AND stackSumSkyfile.quality = 0
     24        AND stackRun.state = 'full'
     25    -- stacks where hook %s
     26    GROUP BY
     27        skycell_id,
     28        filter
     29    ) as bestStacks USING(skycell_id)
     30WHERE
     31    warpSkyfile.warp_id = %lld
     32    AND warpSkyfile.fault = 0
     33    AND warpSkyfile.quality = 0
     34    AND filter = '%s'
     35    AND warpSkyfile.tess_id = bestStacks.tess_id
     36-- warp where hook %s
  • trunk/ippTools/share/difftool_definewarpwarp_insert.sql

    r23504 r23688  
    1111FROM warpSkyfile AS inputWarpSkyfile
    1212JOIN warpSkyfile AS templateWarpSkyfile USING(skycell_id, tess_id)
    13 WHERE inputWarpSkyfile.ignored = 0
    14     AND templateWarpSkyfile.ignored = 0
     13WHERE inputWarpSkyfile.quality = 0
     14    AND templateWarpSkyfile.quality = 0
    1515    AND inputWarpSkyfile.warp_id = %s
    1616    AND templateWarpSkyfile.warp_id = %s
  • trunk/ippTools/share/difftool_todiffskyfile.sql

    r21308 r23688  
    6363    AND diffSkyfile.diff_id IS NULL)
    6464    OR (diffRun.state = 'update'
    65     AND diffSkyfile.fault = 0)
     65    AND diffSkyfile.fault = 0
     66    AND diffSkyfile.quality = 0)
    6667    )
    6768-- Ensure input warps are available
     
    6970    OR (warpRun.state = 'full'
    7071    AND warpSkyfile.fault = 0
    71     AND warpSkyfile.ignored = 0))
     72    AND warpSkyfile.quality = 0))
    7273-- Ensure input stacks are available
    7374    AND (diffInputSkyfile.stack1 IS NULL
    7475    OR (stackRun.state = 'full'
    75     AND stackSumSkyfile.fault = 0))
     76    AND stackSumSkyfile.fault = 0
     77    AND stackSumSkyfile.quality = 0))
    7678-- Ensure template warps are available
    7779    AND (diffInputSkyfile.warp2 IS NULL
    7880    OR (warpTemplateRun.state = 'full'
    7981    AND warpTemplateSkyfile.fault = 0
    80     AND warpTemplateSkyfile.ignored = 0))
     82    AND warpTemplateSkyfile.quality = 0))
    8183-- Ensure template stacks are available
    8284    AND (diffInputSkyfile.stack2 IS NULL
    8385    OR (stackTemplateRun.state = 'full'
    84     AND stackTemplateSkyfile.fault = 0))
     86    AND stackTemplateSkyfile.fault = 0
     87    AND stackTemplateSkyfile.quality = 0))
    8588
    8689
  • trunk/ippTools/share/disttool_toadvance.sql

    r23245 r23688  
    77    (
    88-- raw stage
    9 SELECT 
     9SELECT
    1010    distRun.dist_id,
    1111    stage,
     
    2929UNION
    3030-- chip stage
    31 SELECT 
     31SELECT
    3232    distRun.dist_id,
    3333    stage,
     
    5151UNION
    5252-- warp stage
    53 SELECT 
     53SELECT
    5454    distRun.dist_id,
    5555    stage,
     
    6666        AND distRun.stage = 'warp'
    6767--        AND warpSkyfile.fault = 0
    68 --        AND warpSkyfile.ignored = 0
     68--        AND warpSkyfile.quality = 0
    6969    GROUP BY
    7070        distRun.dist_id,
     
    9999UNION
    100100-- stack stage
    101 SELECT 
     101SELECT
    102102    distRun.dist_id,
    103103    stage,
  • trunk/ippTools/share/flatcorr_completely_processed_chiprun.sql

    r18366 r23688  
    1414        dvodb
    1515    FROM
    16         (SELECT 
     16        (SELECT
    1717            chipRun.*,
    1818            rawImfile.class_id as rawimfile_class_id,
     
    3333            COUNT(rawImfile.class_id) = COUNT(chipProcessedImfile.class_id)
    3434            AND SUM(chipProcessedImfile.fault) = 0
    35         ) as Foo
     35            AND SUM(chipProcessedImfile.quality > 0) != COUNT(*)
     36       ) as Foo
    3637    ) as Bar
  • trunk/ippTools/share/flatcorr_pending.sql

    r18366 r23688  
    1 SELECT 
     1SELECT
    22    *
    33FROM
     
    2121HAVING
    2222    COUNT(rawImfile.class_id) = COUNT(chipProcessedImfile.class_id)
    23     AND SUM(chipProcessedImfile.fault) = 0
     23    AND SUM(chipProcessedImfile.fault > 0) = 0
    2424
  • trunk/ippTools/share/magicdstool_completed_runs.sql

    r23389 r23688  
    44    (
    55-- raw stage
    6 SELECT 
     6SELECT
    77    magicDSRun.magic_ds_id
    88    FROM magicDSRun
     
    2222UNION
    2323-- chip stage
    24 SELECT 
     24SELECT
    2525    magicDSRun.magic_ds_id
    2626    FROM magicDSRun
     
    4040UNION
    4141-- warp stage
    42 SELECT 
     42SELECT
    4343    magicDSRun.magic_ds_id
    4444    FROM magicDSRun
     
    5151        AND magicDSRun.stage = 'warp'
    5252        AND warpSkyfile.fault = 0
    53         AND warpSkyfile.ignored = 0
     53        AND warpSkyfile.quality = 0
    5454    GROUP BY
    5555        magicDSRun.magic_ds_id,
     
    7575        AND magicDSRun.stage = 'diff'
    7676        AND diffSkyfile.fault = 0
     77        AND diffSkyfile.quality = 0
    7778    GROUP BY
    7879        magicDSRun.magic_ds_id,
  • trunk/ippTools/share/magicdstool_getskycells.sql

    r20973 r23688  
    2121    ON warpSkyfile.warp_id = warpSkyCellMap.warp_id
    2222    AND warpSkyfile.skycell_id = warpSkyCellMap.skycell_id
    23     AND warpSkyfile.ignored = 0
     23    AND warpSkyfile.quality = 0
    2424WHERE
    2525    diffSkyfile.fault = 0
     26    AND diffSkyfile.quality = 0
    2627    AND magic_ds_id = %lld
  • trunk/ippTools/share/magicdstool_todestreak.sql

    r23389 r23688  
    6161    AND chipRun.state = 'full'
    6262    AND chipProcessedImfile.fault = 0
     63    AND chipProcessedImfile.quality = 0
    6364    AND magicDSFile.component IS NULL
    6465UNION
     
    9596    AND warpRun.state = 'full'
    9697    AND warpSkyfile.fault = 0
    97     AND warpSkyfile.ignored = 0
     98    AND warpSkyfile.quality = 0
    9899    AND magicDSFile.component IS NULL
    99100UNION
     
    130131    AND magicDSRun.stage = 'diff'
    131132    AND diffSkyfile.fault = 0
     133    AND diffSkyfile.quality = 0
    132134    AND magicDSFile.component IS NULL
    133135) as Foo
  • trunk/ippTools/share/magictool_chipprocessedimfile.sql

    r23389 r23688  
    2626    chipRun.state = 'full'
    2727    AND chipProcessedImfile.fault = 0
     28    AND chipProcessedImfile.quality = 0
    2829--   AND magicRun.state = 'full'
    2930--   AND magicMask.fault = 0
  • trunk/ippTools/share/magictool_definebyquery.sql

    r20743 r23688  
    4545WHERE
    4646    diffSkyfile.fault = 0
     47    AND diffSkyfile.quality = 0
    4748-- WHERE hook %s
    48 AND exp_id = 36475
    49 AND diffRun.label = 'magic_2008-11-12'
     49    AND exp_id = 36475
     50    AND diffRun.label = 'magic_2008-11-12'
    5051GROUP BY
    5152    exp_id,
     
    7980    JOIN diffRun USING(diff_id)
    8081    WHERE
    81         warpSkyfile.ignored = 0
     82        warpSkyfile.quality = 0
    8283        -- magicSkycellNums WHERE hook %s
    8384AND exp_id = 36475
  • trunk/ippTools/share/magictool_definebyquery_insert.sql

    r20973 r23688  
    99    diff_id = @DIFF_ID@ -- Update this with the appropriate diff_id
    1010    AND fault = 0
     11    AND quality = 0
  • trunk/ippTools/share/magictool_definebyquery_select_test.sql

    r20475 r23688  
    2525    JOIN warpSkyfile USING(warp_id, skycell_id)
    2626    WHERE
    27         warpSkyfile.ignored = 0
     27        warpSkyfile.quality = 0
    2828        AND warpRun.state = 'full'
    2929    -- INSERT HERE any additional restrictions (e.g., exp_id, warpSkyfile.good_frac)
  • trunk/ippTools/share/magictool_definebyquery_temp_insert.sql

    r20973 r23688  
    2020WHERE
    2121    diffSkyfile.fault = 0
     22    AND diffSkyfile.quality = 0
    2223-- WHERE hook %s
    2324GROUP BY
  • trunk/ippTools/share/magictool_diffskyfile.sql

    r23389 r23688  
    2020    ON warpSkyfile.warp_id = warpSkyCellMap.warp_id
    2121    AND warpSkyfile.skycell_id = warpSkyCellMap.skycell_id
    22     AND warpSkyfile.ignored = 0
     22    AND warpSkyfile.quality = 0
    2323WHERE
    2424    diffRun.state = 'full'
    2525    AND diffSkyfile.fault = 0
     26    AND diffSkyfile.quality = 0
    2627--   AND magicRun.state = 'full'
    2728--   AND magicMask.fault = 0
  • trunk/ippTools/share/magictool_inputs.sql

    r20973 r23688  
    1010    diffSkyfile.path_base,
    1111    diffSkyfile.fault
     12    diffSkyfile.quality
    1213FROM magicRun
    1314JOIN magicInputSkyfile
     
    3536WHERE
    3637    fault = 0
     38    AND quality = 0
  • trunk/ippTools/share/magictool_warpskyfile.sql

    r23389 r23688  
    2121    warpRun.state = 'full'
    2222    AND warpSkyfile.fault = 0
     23    AND warpSkyfile.quality = 0
    2324--   AND magicRun.state = 'full'
    2425--   AND magicMask.fault = 0
  • trunk/ippTools/share/pxadmin_create_tables.sql

    r23659 r23688  
    1818    epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    1919    PRIMARY KEY(exp_name, camera, telescope),
    20     KEY(fault))
    21 ENGINE=innodb DEFAULT CHARSET=latin1;
     20    KEY(fault)
     21) ENGINE=innodb DEFAULT CHARSET=latin1;
    2222
    2323CREATE TABLE summitImfile (
     
    3434    PRIMARY KEY(exp_name, camera, telescope, class, class_id),
    3535    KEY(file_id),
    36     FOREIGN KEY (exp_name, camera, telescope)
    37         REFERENCES  summitExp(exp_name, camera, telescope))
    38 ENGINE=innodb DEFAULT CHARSET=latin1;
     36    FOREIGN KEY(exp_name, camera, telescope) REFERENCES summitExp(exp_name, camera, telescope)
     37) ENGINE=innodb DEFAULT CHARSET=latin1;
    3938
    4039CREATE TABLE pzDownloadExp (
     
    4645    PRIMARY KEY(exp_name, camera, telescope),
    4746    KEY(state),
    48     FOREIGN KEY (exp_name, camera, telescope)
    49         REFERENCES  summitExp(exp_name, camera, telescope))
    50 ENGINE=innodb DEFAULT CHARSET=latin1;
     47    FOREIGN KEY(exp_name, camera, telescope) REFERENCES summitExp(exp_name, camera, telescope)
     48) ENGINE=innodb DEFAULT CHARSET=latin1;
    5149
    5250CREATE TABLE pzDownloadImfile (
     
    6260    PRIMARY KEY(exp_name, camera, telescope, class, class_id),
    6361    KEY(fault),
    64     FOREIGN KEY (exp_name, camera, telescope)
    65         REFERENCES  pzDownloadExp(exp_name, camera, telescope),
    66     FOREIGN KEY (exp_name, camera, telescope, class, class_id)
    67         REFERENCES  summitImfile(exp_name, camera, telescope, class, class_id)) ENGINE=innodb DEFAULT CHARSET=latin1;
     62    FOREIGN KEY (exp_name, camera, telescope) REFERENCES pzDownloadExp(exp_name, camera, telescope),
     63    FOREIGN KEY(exp_name, camera, telescope, class, class_id) REFERENCES summitImfile(exp_name, camera, telescope, class, class_id)
     64) ENGINE=innodb DEFAULT CHARSET=latin1;
    6865
    6966CREATE TABLE newExp (
     
    9895    epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    9996    PRIMARY KEY(exp_id, tmp_class_id),
    100     FOREIGN KEY (exp_id)
    101         REFERENCES  newExp(exp_id))
    102 ENGINE=innodb DEFAULT CHARSET=latin1;
     97    FOREIGN KEY(exp_id) REFERENCES newExp(exp_id)
     98) ENGINE=innodb DEFAULT CHARSET=latin1;
    10399
    104100CREATE TABLE rawExp (
     
    172168    KEY(end_stage),
    173169    KEY(fault),
    174     FOREIGN KEY (exp_id)
    175         REFERENCES  newExp(exp_id))
    176 ENGINE=innodb DEFAULT CHARSET=latin1;
     170    FOREIGN KEY(exp_id) REFERENCES newExp(exp_id)
     171) ENGINE=innodb DEFAULT CHARSET=latin1;
    177172
    178173CREATE TABLE rawImfile (
     
    237232    ignored TINYINT DEFAULT 0,
    238233    hostname VARCHAR(64),
     234    quality SMALLINT NOT NULL DEFAULT 0,
    239235    fault SMALLINT NOT NULL,
    240236    epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
     
    245241    KEY(fault),
    246242    KEY(raw_image_id),
     243    KEY(quality),
    247244    UNIQUE KEY(exp_id, tmp_class_id),
    248     FOREIGN KEY (exp_id, tmp_class_id)
    249         REFERENCES newImfile(exp_id, tmp_class_id))
    250 ENGINE=innodb DEFAULT CHARSET=latin1;
    251 
    252 CREATE TABLE guidePendingExp (guide_id BIGINT AUTO_INCREMENT, exp_id BIGINT, recipe VARCHAR(64), PRIMARY KEY(guide_id), KEY(guide_id), KEY(exp_id)) ENGINE=innodb DEFAULT CHARSET=latin1;
     245    FOREIGN KEY(exp_id, tmp_class_id) REFERENCES newImfile(exp_id, tmp_class_id)
     246) ENGINE=innodb DEFAULT CHARSET=latin1;
    253247
    254248CREATE TABLE chipRun (
     
    273267    KEY(end_stage),
    274268    INDEX(chip_id, exp_id),
    275     FOREIGN KEY (exp_id)
    276         REFERENCES rawExp(exp_id))
    277 ENGINE=innodb DEFAULT CHARSET=latin1;
     269    FOREIGN KEY(exp_id) REFERENCES rawExp(exp_id)
     270) ENGINE=innodb DEFAULT CHARSET=latin1;
    278271
    279272CREATE TABLE chipImfile (
     
    283276    PRIMARY KEY(chip_id, class_id),
    284277    KEY(chip_imfile_id),
    285     FOREIGN KEY (chip_id) REFERENCES  chipRun(chip_id))
    286 ENGINE=innodb DEFAULT CHARSET=latin1;
     278    FOREIGN KEY(chip_id) REFERENCES chipRun(chip_id)
     279) ENGINE=innodb DEFAULT CHARSET=latin1;
    287280
    288281CREATE TABLE chipProcessedImfile (
     
    343336    n_cr INT,
    344337    path_base VARCHAR(255),
     338    quality SMALLINT NOT NULL DEFAULT 0,
    345339    fault SMALLINT NOT NULL,
    346340    magicked BIGINT,
     
    348342    KEY(data_state),
    349343    KEY(fault),
    350     FOREIGN KEY (chip_id, exp_id)
    351         REFERENCES  chipRun(chip_id, exp_id),
    352     FOREIGN KEY (exp_id, class_id)
    353         REFERENCES  rawImfile(exp_id, class_id))
    354 ENGINE=innodb DEFAULT CHARSET=latin1;
     344    KEY(quality),
     345    FOREIGN KEY(chip_id, exp_id) REFERENCES chipRun(chip_id, exp_id),
     346    FOREIGN KEY(exp_id, class_id) REFERENCES rawImfile(exp_id, class_id)
     347) ENGINE=innodb DEFAULT CHARSET=latin1;
    355348
    356349CREATE TABLE chipMask (
    357350    label VARCHAR(64),
    358     PRIMARY KEY(label))
    359 ENGINE=innodb DEFAULT CHARSET=latin1;
     351    PRIMARY KEY(label)
     352) ENGINE=innodb DEFAULT CHARSET=latin1;
    360353
    361354CREATE TABLE camRun (
     
    380373    KEY(end_stage),
    381374    INDEX(cam_id, chip_id),
    382     FOREIGN KEY (chip_id)
    383         REFERENCES chipRun(chip_id))
    384 ENGINE=innodb DEFAULT CHARSET=latin1;
     375    FOREIGN KEY(chip_id) REFERENCES chipRun(chip_id)
     376) ENGINE=innodb DEFAULT CHARSET=latin1;
    385377
    386378CREATE TABLE camProcessedExp (
     
    444436    n_astrom INT,
    445437    path_base VARCHAR(255),
     438    quality SMALLINT NOT NULL DEFAULT 0,
    446439    fault SMALLINT NOT NULL,
    447440    PRIMARY KEY(cam_id),
    448441    KEY(fault),
    449     FOREIGN KEY (cam_id)
    450         REFERENCES camRun(cam_id))
    451 ENGINE=innodb DEFAULT CHARSET=latin1;
     442    KEY(quality),
     443    FOREIGN KEY(cam_id) REFERENCES camRun(cam_id)
     444) ENGINE=innodb DEFAULT CHARSET=latin1;
    452445
    453446CREATE TABLE camMask (
    454447    label VARCHAR(64),
    455     PRIMARY KEY(label))
    456 ENGINE=innodb DEFAULT CHARSET=latin1;
     448    PRIMARY KEY(label)
     449) ENGINE=innodb DEFAULT CHARSET=latin1;
    457450
    458451CREATE TABLE fakeRun (
     
    475468    KEY(end_stage),
    476469    INDEX(fake_id, cam_id),
    477     FOREIGN KEY (cam_id)
    478         REFERENCES camRun(cam_id))
    479 ENGINE=innodb DEFAULT CHARSET=latin1;
     470    FOREIGN KEY(cam_id) REFERENCES camRun(cam_id)
     471) ENGINE=innodb DEFAULT CHARSET=latin1;
    480472
    481473CREATE TABLE fakeProcessedImfile (
     
    493485    PRIMARY KEY(fake_id, exp_id, class_id),
    494486    KEY(fault),
    495     FOREIGN KEY (fake_id)
    496         REFERENCES fakeRun(fake_id),
    497     FOREIGN KEY (exp_id, class_id)
    498         REFERENCES rawImfile(exp_id, class_id))
    499 ENGINE=innodb DEFAULT CHARSET=latin1;
     487    FOREIGN KEY(fake_id) REFERENCES fakeRun(fake_id),
     488    FOREIGN KEY(exp_id, class_id) REFERENCES rawImfile(exp_id, class_id)
     489) ENGINE=innodb DEFAULT CHARSET=latin1;
    500490
    501491CREATE TABLE fakeMask (
    502492    label VARCHAR(64),
    503     PRIMARY KEY(label))
    504 ENGINE=innodb DEFAULT CHARSET=latin1;
     493    PRIMARY KEY(label)
     494) ENGINE=innodb DEFAULT CHARSET=latin1;
    505495
    506496CREATE TABLE detRun (
     
    535525    ref_det_id BIGINT,
    536526    ref_iter INT,
    537     -- parent INT, :: dropping this
    538527    PRIMARY KEY(det_id),
    539528    KEY(det_id),
     
    543532    KEY(state),
    544533    KEY(label),
    545     -- KEY(parent), :: dropping this
    546     INDEX(det_id, iteration))
    547 ENGINE=innodb DEFAULT CHARSET=latin1;
     534    INDEX(det_id, iteration)
     535) ENGINE=innodb DEFAULT CHARSET=latin1;
    548536
    549537CREATE TABLE detInputExp (
    550 det_id BIGINT,
    551 iteration INT,
    552 exp_id BIGINT,
    553 include TINYINT,
    554 PRIMARY KEY(det_id, iteration, exp_id),
    555 INDEX(det_id, exp_id),
    556 INDEX(det_id, iteration),
    557 FOREIGN KEY (det_id)
    558 REFERENCES  detRun(det_id),
    559 FOREIGN KEY (exp_id)
    560 REFERENCES  rawExp(exp_id))
    561 ENGINE=innodb DEFAULT CHARSET=latin1;
     538    det_id BIGINT,
     539    iteration INT,
     540    exp_id BIGINT,
     541    include TINYINT,
     542    PRIMARY KEY(det_id, iteration, exp_id),
     543    INDEX(det_id, exp_id),
     544    INDEX(det_id, iteration),
     545    FOREIGN KEY(det_id) REFERENCES detRun(det_id),
     546    FOREIGN KEY(exp_id) REFERENCES rawExp(exp_id)
     547) ENGINE=innodb DEFAULT CHARSET=latin1;
    562548
    563549CREATE TABLE detProcessedImfile (
     
    585571    INDEX(det_id, class_id),
    586572    INDEX(det_id, exp_id),
    587     FOREIGN KEY (det_id, exp_id)
    588         REFERENCES  detInputExp(det_id, exp_id),
    589     FOREIGN KEY (exp_id, class_id)
    590         REFERENCES  rawImfile(exp_id, class_id)
     573    FOREIGN KEY(det_id, exp_id) REFERENCES detInputExp(det_id, exp_id),
     574    FOREIGN KEY(exp_id, class_id) REFERENCES rawImfile(exp_id, class_id)
    591575) ENGINE=innodb DEFAULT CHARSET=latin1;
    592576
     
    611595    PRIMARY KEY(det_id, exp_id),
    612596    KEY(fault),
    613     FOREIGN KEY (det_id, exp_id)
    614         REFERENCES  detInputExp(det_id, exp_id),
    615     FOREIGN KEY (det_id, exp_id)
    616         REFERENCES  detProcessedImfile(det_id, exp_id)
     597    FOREIGN KEY(det_id, exp_id) REFERENCES detInputExp(det_id, exp_id),
     598    FOREIGN KEY(det_id, exp_id) REFERENCES detProcessedImfile(det_id, exp_id)
    617599) ENGINE=innodb DEFAULT CHARSET=latin1;
    618600
     
    635617    PRIMARY KEY(det_id, iteration, class_id),
    636618    KEY(fault),
    637     FOREIGN KEY (det_id, iteration)
    638         REFERENCES  detInputExp(det_id, iteration),
    639     FOREIGN KEY (det_id, class_id)
    640         REFERENCES  detProcessedImfile(det_id, class_id)
     619    FOREIGN KEY(det_id, iteration) REFERENCES detInputExp(det_id, iteration),
     620    FOREIGN KEY(det_id, class_id) REFERENCES detProcessedImfile(det_id, class_id)
    641621) ENGINE=innodb DEFAULT CHARSET=latin1;
    642622
     
    650630    PRIMARY KEY(det_id, iteration, class_id),
    651631    KEY(fault),
    652     FOREIGN KEY (det_id, iteration)
    653     REFERENCES  detInputExp(det_id, iteration),
    654     FOREIGN KEY (det_id, iteration, class_id)
    655     REFERENCES  detStackedImfile(det_id, iteration, class_id)
     632    FOREIGN KEY(det_id, iteration) REFERENCES detInputExp(det_id, iteration),
     633    FOREIGN KEY(det_id, iteration, class_id) REFERENCES  detStackedImfile(det_id, iteration, class_id)
    656634) ENGINE=innodb DEFAULT CHARSET=latin1;
    657635
     
    675653    KEY(fault),
    676654    INDEX(det_id, iteration),
    677     FOREIGN KEY (det_id)
    678     REFERENCES  detInputExp(det_id),
    679     FOREIGN KEY (det_id, iteration, class_id)
    680     REFERENCES  detNormalizedStatImfile(det_id, iteration, class_id)
     655    FOREIGN KEY(det_id) REFERENCES detInputExp(det_id),
     656    FOREIGN KEY(det_id, iteration, class_id) REFERENCES detNormalizedStatImfile(det_id, iteration, class_id)
    681657) ENGINE=innodb DEFAULT CHARSET=latin1;
    682658
     
    698674    PRIMARY KEY(det_id, iteration),
    699675    KEY(fault),
    700     FOREIGN KEY (det_id, iteration)
    701     REFERENCES  detInputExp(det_id, iteration),
    702     FOREIGN KEY (det_id, iteration)
    703     REFERENCES  detNormalizedImfile(det_id, iteration)
     676    FOREIGN KEY(det_id, iteration) REFERENCES detInputExp(det_id, iteration),
     677    FOREIGN KEY(det_id, iteration) REFERENCES detNormalizedImfile(det_id, iteration)
    704678) ENGINE=innodb DEFAULT CHARSET=latin1;
    705679
     
    736710    KEY(fault),
    737711    INDEX(det_id, iteration, exp_id),
    738     FOREIGN KEY (det_id, iteration, exp_id)
    739     REFERENCES  detInputExp(det_id, iteration, exp_id),
    740     FOREIGN KEY (det_id, exp_id, class_id)
    741     REFERENCES  detProcessedImfile(det_id, exp_id, class_id)
     712    FOREIGN KEY (det_id, iteration, exp_id) REFERENCES detInputExp(det_id, iteration, exp_id),
     713    FOREIGN KEY (det_id, exp_id, class_id) REFERENCES detProcessedImfile(det_id, exp_id, class_id)
    742714) ENGINE=innodb DEFAULT CHARSET=latin1;
    743715
     
    771743       KEY(fault),
    772744       INDEX(det_id, iteration),
    773        FOREIGN KEY (det_id, iteration, exp_id)
    774        REFERENCES  detInputExp(det_id, iteration, exp_id),
    775        FOREIGN KEY (det_id, iteration, exp_id)
    776        REFERENCES  detResidImfile(det_id, iteration, exp_id)
     745       FOREIGN KEY(det_id, iteration, exp_id) REFERENCES detInputExp(det_id, iteration, exp_id),
     746       FOREIGN KEY(det_id, iteration, exp_id) REFERENCES detResidImfile(det_id, iteration, exp_id)
    777747) ENGINE=innodb DEFAULT CHARSET=latin1;
    778748
     
    788758       PRIMARY KEY(det_id, iteration),
    789759       KEY(fault),
    790        FOREIGN KEY (det_id, iteration)
    791          REFERENCES  detInputExp(det_id, iteration),
    792        FOREIGN KEY (det_id, iteration)
    793          REFERENCES  detResidExp(det_id, iteration)
     760       FOREIGN KEY(det_id, iteration) REFERENCES detInputExp(det_id, iteration),
     761       FOREIGN KEY(det_id, iteration) REFERENCES detResidExp(det_id, iteration)
    794762) ENGINE=innodb DEFAULT CHARSET=latin1;
    795763
     
    812780       PRIMARY KEY(det_id, iteration, class_id),
    813781       KEY(fault),
    814        FOREIGN KEY (det_id, iteration)
    815          REFERENCES  detRun(det_id, iteration)
     782       FOREIGN KEY(det_id, iteration) REFERENCES detRun(det_id, iteration)
    816783) ENGINE=innodb DEFAULT CHARSET=latin1;
    817784
     
    838805    KEY(end_stage),
    839806    INDEX(warp_id, fake_id),
    840     FOREIGN KEY (fake_id)
    841         REFERENCES fakeRun(fake_id)
     807    FOREIGN KEY(fake_id) REFERENCES fakeRun(fake_id)
    842808) ENGINE=innodb DEFAULT CHARSET=latin1;
    843809
     
    850816    PRIMARY KEY(warp_id, skycell_id, tess_id, class_id),
    851817    KEY(fault),
    852     FOREIGN KEY (warp_id)
    853         REFERENCES warpRun(warp_id)
     818    FOREIGN KEY(warp_id) REFERENCES warpRun(warp_id)
    854819) ENGINE=innodb DEFAULT CHARSET=latin1;
    855820
     
    860825    PRIMARY KEY(warp_id, skycell_id),
    861826    KEY(warp_skyfile_id),
    862     FOREIGN KEY (warp_id) REFERENCES  warpRun(warp_id))
    863 ENGINE=innodb DEFAULT CHARSET=latin1;
     827    FOREIGN KEY(warp_id) REFERENCES warpRun(warp_id)
     828) ENGINE=innodb DEFAULT CHARSET=latin1;
    864829
    865830
     
    881846    ymin INT,
    882847    ymax INT,
    883     ignored TINYINT,
     848    quality SMALLINT NOT NULL DEFAULT 0,
    884849    fault SMALLINT,
    885850    magicked TINYINT,
    886851    PRIMARY KEY(warp_id, skycell_id, tess_id),
    887852    KEY(good_frac),
    888     KEY(ignored), KEY(fault),
    889     FOREIGN KEY (warp_id, skycell_id, tess_id)
    890         REFERENCES warpSkyCellMap(warp_id, skycell_id, tess_id)
     853    KEY(fault),
     854    KEY(quality),
     855    FOREIGN KEY(warp_id, skycell_id, tess_id) REFERENCES warpSkyCellMap(warp_id, skycell_id, tess_id)
    891856) ENGINE=innodb DEFAULT CHARSET=latin1;
    892857
     
    918883        warp_id BIGINT,
    919884        PRIMARY KEY(stack_id, warp_id),
    920         FOREIGN KEY (stack_id)  REFERENCES stackRun(stack_id),
    921         FOREIGN KEY (warp_id)  REFERENCES warpSkyfile(warp_id)
     885        FOREIGN KEY(stack_id) REFERENCES stackRun(stack_id),
     886        FOREIGN KEY(warp_id) REFERENCES warpSkyfile(warp_id)
    922887) ENGINE=innodb DEFAULT CHARSET=latin1;
    923888
     
    948913        hostname VARCHAR(64),
    949914        good_frac FLOAT,
     915        quality SMALLINT NOT NULL DEFAULT 0,
    950916        fault SMALLINT,
    951917        PRIMARY KEY(stack_id),
     
    953919        KEY(good_frac),
    954920        KEY(fault),
    955         FOREIGN KEY (stack_id)  REFERENCES  stackRun(stack_id)
     921        KEY(quality),
     922        FOREIGN KEY(stack_id) REFERENCES stackRun(stack_id)
    956923) ENGINE=innodb DEFAULT CHARSET=latin1;
    957924
     
    971938        KEY(state),
    972939        KEY(tess_id),
    973         FOREIGN KEY (exp_id) REFERENCES rawExp(exp_id)
     940        FOREIGN KEY(exp_id) REFERENCES rawExp(exp_id)
    974941) ENGINE=innodb DEFAULT CHARSET=latin1;
    975942
     
    991958        KEY(skycell_id),
    992959        KEY(tess_id),
    993         FOREIGN KEY (diff_id)  REFERENCES diffRun(diff_id),
    994         FOREIGN KEY (warp1, skycell_id, tess_id)  REFERENCES warpSkyfile(warp_id, skycell_id, tess_id),
    995         FOREIGN KEY (warp2, skycell_id, tess_id)  REFERENCES warpSkyfile(warp_id, skycell_id, tess_id),
    996         FOREIGN KEY (stack1)  REFERENCES stackSumSkyfile(stack_id),
    997         FOREIGN KEY (stack2)  REFERENCES stackSumSkyfile(stack_id)
     960        FOREIGN KEY(diff_id) REFERENCES diffRun(diff_id),
     961        FOREIGN KEY(warp1, skycell_id, tess_id) REFERENCES warpSkyfile(warp_id, skycell_id, tess_id),
     962        FOREIGN KEY(warp2, skycell_id, tess_id) REFERENCES warpSkyfile(warp_id, skycell_id, tess_id),
     963        FOREIGN KEY(stack1) REFERENCES stackSumSkyfile(stack_id),
     964        FOREIGN KEY(stack2) REFERENCES stackSumSkyfile(stack_id)
    998965) ENGINE=innodb DEFAULT CHARSET=latin1;
    999966
     
    1022989        hostname VARCHAR(64),
    1023990        good_frac FLOAT,
     991        quality SMALLINT NOT NULL DEFAULT 0,
    1024992        fault SMALLINT,
    1025993        magicked TINYINT,
     
    1027995        KEY(good_frac),
    1028996        KEY(fault),
    1029         FOREIGN KEY (diff_id)  REFERENCES  diffRun(diff_id)
     997        KEY(quality),
     998        FOREIGN KEY(diff_id) REFERENCES diffRun(diff_id)
    1030999) ENGINE=innodb DEFAULT CHARSET=latin1;
    10311000
     
    10471016        KEY(label),
    10481017        KEY(fault),
    1049         FOREIGN KEY (exp_id)  REFERENCES rawExp(exp_id),
    1050         FOREIGN KEY (diff_id) REFERENCES diffRun(diff_id)
     1018        FOREIGN KEY(exp_id)  REFERENCES rawExp(exp_id),
     1019        FOREIGN KEY(diff_id) REFERENCES diffRun(diff_id)
    10511020) ENGINE=innodb DEFAULT CHARSET=latin1;
    10521021
     
    10561025        node VARCHAR(64),
    10571026        PRIMARY KEY(magic_id, diff_id, node),
    1058         FOREIGN KEY (magic_id)  REFERENCES magicRun(magic_id),
    1059         FOREIGN KEY (diff_id) REFERENCES diffRun(diff_id)
     1027        FOREIGN KEY(magic_id) REFERENCES magicRun(magic_id),
     1028        FOREIGN KEY(diff_id) REFERENCES diffRun(diff_id)
    10601029) ENGINE=innodb DEFAULT CHARSET=latin1;
    10611030
     
    10681037        KEY(dep),
    10691038        INDEX(magic_id, node),
    1070         FOREIGN KEY (magic_id)  REFERENCES magicRun(magic_id)
     1039        FOREIGN KEY(magic_id) REFERENCES magicRun(magic_id)
    10711040) ENGINE=innodb DEFAULT CHARSET=latin1;
    10721041
     
    10771046        fault SMALLINT,
    10781047        PRIMARY KEY(magic_id, node),
    1079         FOREIGN KEY (magic_id)  REFERENCES magicRun(magic_id),
    1080         FOREIGN KEY (magic_id, node)  REFERENCES magicTree(magic_id, node),
     1048        FOREIGN KEY(magic_id) REFERENCES magicRun(magic_id),
     1049        FOREIGN KEY(magic_id, node) REFERENCES magicTree(magic_id, node),
    10811050        KEY(fault)
    10821051) ENGINE=innodb DEFAULT CHARSET=latin1;
     
    10881057        fault SMALLINT,
    10891058        PRIMARY KEY(magic_id),
    1090         FOREIGN KEY (magic_id)  REFERENCES magicRun(magic_id),
     1059        FOREIGN KEY(magic_id) REFERENCES magicRun(magic_id),
    10911060        KEY(fault)
    10921061) ENGINE=innodb DEFAULT CHARSET=latin1;
     
    11091078        KEY(magic_id),
    11101079        KEY(label),
    1111         FOREIGN KEY (magic_id)  REFERENCES magicRun(magic_id)
     1080        FOREIGN KEY(magic_id) REFERENCES magicRun(magic_id)
    11121081) ENGINE=innodb DEFAULT CHARSET=latin1;
    11131082
     
    11201089    PRIMARY KEY(magic_ds_id, component),
    11211090    KEY(fault),
    1122     FOREIGN KEY (magic_ds_id) REFERENCES magicDSRun(magic_ds_id)
     1091    FOREIGN KEY(magic_ds_id) REFERENCES magicDSRun(magic_ds_id)
    11231092) ENGINE=innodb DEFAULT CHARSET=latin1;
    11241093
     
    11391108        KEY(cal_id),
    11401109        KEY(last_step),
    1141         FOREIGN KEY (cal_id)  REFERENCES calDB(cal_id)
     1110        FOREIGN KEY(cal_id) REFERENCES calDB(cal_id)
    11421111) ENGINE=innodb DEFAULT CHARSET=latin1;
    11431112
     
    11671136        include TINYINT,
    11681137        PRIMARY KEY(corr_id, chip_id),
    1169         FOREIGN KEY (corr_id)  REFERENCES flatcorrRun(corr_id),
    1170         FOREIGN KEY (chip_id)  REFERENCES chipRun(chip_id)
     1138        FOREIGN KEY(corr_id) REFERENCES flatcorrRun(corr_id),
     1139        FOREIGN KEY(chip_id) REFERENCES chipRun(chip_id)
    11711140) ENGINE=innodb DEFAULT CHARSET=latin1;
    11721141
     
    11771146        include TINYINT,
    11781147        PRIMARY KEY(corr_id, cam_id),
    1179         FOREIGN KEY (corr_id)  REFERENCES flatcorrRun(corr_id),
    1180         FOREIGN KEY (chip_id)  REFERENCES chipRun(chip_id),
    1181         FOREIGN KEY (cam_id)  REFERENCES camRun(cam_id)
     1148        FOREIGN KEY(corr_id) REFERENCES flatcorrRun(corr_id),
     1149        FOREIGN KEY(chip_id) REFERENCES chipRun(chip_id),
     1150        FOREIGN KEY(cam_id) REFERENCES camRun(cam_id)
    11821151) ENGINE=innodb DEFAULT CHARSET=latin1;
    11831152
     
    12311200        PRIMARY KEY(job_id, req_id),
    12321201        KEY(job_id),
    1233         FOREIGN KEY (req_id)  REFERENCES pstampRequest(req_id)
     1202        FOREIGN KEY(req_id) REFERENCES pstampRequest(req_id)
    12341203) ENGINE=innodb DEFAULT CHARSET=latin1;
    12351204
    12361205CREATE TABLE distTarget (
    1237     target_id   BIGINT AUTO_INCREMENT, 
     1206    target_id   BIGINT AUTO_INCREMENT,
    12381207    obs_mode    VARCHAR(64),
    12391208    stage       VARCHAR(64),
     
    12631232
    12641233CREATE TABLE distComponent (
    1265     dist_id     BIGINT, 
     1234    dist_id     BIGINT,
    12661235    component   VARCHAR(64),
    12671236    bytes       INT,
     
    13351304
    13361305
    1337 -- This comment line is here to avoid empty query error. 
     1306-- This comment line is here to avoid empty query error.
    13381307-- Another way to avoid that problem is to omit the semicolon above but I think that is untidy.
  • trunk/ippTools/share/pxadmin_drop_tables.sql

    r23390 r23688  
    11SET FOREIGN_KEY_CHECKS=0;
     2
    23DROP TABLE IF EXISTS pzDataStore;
    34DROP TABLE IF EXISTS summitExp;
     
    910DROP TABLE IF EXISTS rawExp;
    1011DROP TABLE IF EXISTS rawImfile;
    11 DROP TABLE IF EXISTS guidePendingExp;
    1212DROP TABLE IF EXISTS chipRun;
    1313DROP TABLE IF EXISTS chipProcessedImfile;
  • trunk/ippTools/share/stacktool_definebyquery_insert.sql

    r19258 r23688  
    2121    AND rawExp.filter = '%s'
    2222    AND warpSkyfile.fault = 0
    23     AND warpSkyfile.ignored = 0
     23    AND warpSkyfile.quality = 0
  • trunk/ippTools/share/stacktool_definebyquery_insert_random_part1.sql

    r19258 r23688  
    2828        AND rawExp.filter = '%s' -- the result of the query is grouped by filter and inserted for one at a time
    2929        AND warpSkyfile.fault = 0
    30         AND warpSkyfile.ignored = 0
     30        AND warpSkyfile.quality = 0
    3131-- Put additional constraints here
    3232-- stacktool_definebyquery_insert_random_part2.sql goes here
  • trunk/ippTools/share/stacktool_definebyquery_part1.sql

    r19258 r23688  
    1717        COUNT(warpSkyfile.skycell_id) AS num_warp -- number of warps that can be stacked
    1818    FROM warpRun
    19         JOIN warpSkyfile USING(warp_id)
    20         JOIN fakeRun USING(fake_id)
    21         JOIN camRun USING(cam_id)
    22         JOIN chipRun USING(chip_id)
    23         JOIN rawExp USING(exp_id)
     19    JOIN warpSkyfile USING(warp_id)
     20    JOIN fakeRun USING(fake_id)
     21    JOIN camRun USING(cam_id)
     22    JOIN chipRun USING(chip_id)
     23    JOIN rawExp USING(exp_id)
    2424    WHERE
    2525        warpRun.state = 'full'
    26     AND warpSkyfile.ignored = 0
    27     AND warpSkyfile.fault = 0
     26        AND warpSkyfile.fault = 0
     27        AND warpSkyfile.quality = 0
    2828    -- Here should follow the SQL in stacktool_definebyquery_part2.sql,
    2929    -- after any additional WHERE conditions have been added
  • trunk/ippTools/share/stacktool_definebyquery_test.sql

    r19258 r23688  
    3131    WHERE
    3232        warpRun.state = 'full'
    33     AND warpSkyfile.ignored = 0
     33    AND warpSkyfile.quality = 0
    3434    AND warpSkyfile.fault = 0
    3535    -- Any additional selection on warps/exposures goes here
  • trunk/ippTools/share/stacktool_find_complete_warps.sql

    r19258 r23688  
    66    COUNT(stackRun.stack_id) AS num_extant
    77FROM warpRun
    8 JOIN warpSkyfile 
     8JOIN warpSkyfile
    99    USING(warp_id)
    1010JOIN fakeRun
     
    2323WHERE
    2424    warpRun.state = 'full'
    25     AND warpSkyfile.ignored = 0
     25    AND warpSkyfile.fault = 0
     26    AND warpSkyfile.quality = 0
    2627GROUP BY
    2728    warpSkyfile.skycell_id, stackRun.stack_id
  • trunk/ippTools/share/stacktool_tosum.sql

    r19678 r23688  
    1212    USING(stack_id)
    1313WHERE
    14     ((stackRun.state = 'new'
    15         AND stackSumSkyfile.stack_id IS NULL)
    16     OR
    17     (stackRun.state = 'update'
    18         AND stackSumSkyfile.fault = 0))
     14    ((stackRun.state = 'new' AND stackSumSkyfile.stack_id IS NULL)
     15    OR (stackRun.state = 'update' AND stackSumSkyfile.fault = 0 AND stackSumSkyfile.quality = 0))
  • trunk/ippTools/share/warptool_finished_run_select.sql

    r23459 r23688  
    1919   HAVING
    2020       COUNT(warpSkyCellMap.warp_id) = COUNT(warpSkyfile.warp_id)
    21        AND SUM(warpSkyfile.fault) = 0
     21       AND SUM(warpSkyfile.fault > 0) = 0
    2222 ) as Foo
  • trunk/ippTools/share/warptool_imfile.sql

    r20608 r23688  
    2626    AND camRun.state = 'full'
    2727    AND chipRun.state = 'full'
     28    AND chipProcessedImfile.quality = 0
     29    and camProcessedExp.quality = 0
    2830
  • trunk/ippTools/share/warptool_revertwarped_delete.sql

    r20722 r23688  
    77    AND chipRun.exp_id = rawExp.exp_id
    88    AND warpSkyfile.fault != 0
     9
  • trunk/ippTools/src/camtool.c

    r23616 r23688  
    468468
    469469    PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", false, false);
    470     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     470    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     471    PXOPT_LOOKUP_S16(quality, config->args, "-quality", false, false);
    471472
    472473    // generate restrictions
     
    533534        zpt_lq,
    534535        zpt_uq,
    535         fwhm_major,
    536         fwhm_major_lq,
    537         fwhm_major_uq,
    538         fwhm_minor,
    539         fwhm_minor_lq,
    540         fwhm_minor_uq,
    541 
    542         iq_fwhm_major,
    543         iq_fwhm_major_err,
    544         iq_fwhm_minor,
    545         iq_fwhm_minor_err,
     536        fwhm_major,
     537        fwhm_major_lq,
     538        fwhm_major_uq,
     539        fwhm_minor,
     540        fwhm_minor_lq,
     541        fwhm_minor_uq,
     542
     543        iq_fwhm_major,
     544        iq_fwhm_major_err,
     545        iq_fwhm_minor,
     546        iq_fwhm_minor_err,
    546547
    547548        iq_m2,
     
    576577        n_astrom,
    577578        path_base,
    578         code
     579        fault,
     580        quality
    579581        );
    580582
     
    599601
    600602    // NULL for end_stage means go as far as possible
    601     // EAM : skip here if code != 0
     603    // EAM : skip here if fault != 0
    602604    // Also, we can run fake even if tess_id is not defined
    603     if (code || (pendingRow->end_stage && psStrcasestr(pendingRow->end_stage, "cam"))) {
     605    if (fault || (pendingRow->end_stage && psStrcasestr(pendingRow->end_stage, "cam"))) {
    604606        psFree(row);
    605607        psFree(pendingRow);
     
    745747    PXOPT_COPY_STR(config->args, where, "-label",     "camRun.label",          "==");
    746748    PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction",      "==");
    747     PXOPT_COPY_S16(config->args, where, "-code",      "camProcessedExp.fault", "==");
     749    PXOPT_COPY_S16(config->args, where, "-fault", "camProcessedExp.fault", "==");
    748750
    749751    if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) {
     
    833835    PS_ASSERT_PTR_NON_NULL(config, false);
    834836
    835     PXOPT_LOOKUP_S16(code, config->args, "-code", true, false);
     837    PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
    836838
    837839    psMetadata *where = psMetadataAlloc();
     
    841843    PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "==");
    842844
    843     if (!pxSetFaultCode(config->dbh, "camProcessedExp", where, code)) {
     845    if (!pxSetFaultCode(config->dbh, "camProcessedExp", where, fault)) {
    844846        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    845847        psFree (where);
     
    11141116    char sqlFilename[80];
    11151117  } ExportTable;
    1116  
     1118
    11171119  int numExportTables = 2;
    11181120
     
    11941196
    11951197  PS_ASSERT_PTR_NON_NULL(config, NULL);
    1196  
     1198
    11971199  PXOPT_LOOKUP_STR(infile, config->args, "-infile", true,  false);
    11981200
     
    12051207  psAssert (item, "entry not in input?");
    12061208  psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?");
    1207  
     1209
    12081210  psMetadataItem *entry = psListGet (item->data.list, 0);
    12091211  assert (entry);
     
    12141216  // fprintf (stdout, "---- cam run ----\n");
    12151217  // psMetadataPrint (stderr, entry->data.md, 1);
    1216  
     1218
    12171219  item = psMetadataLookup (input, "camProcessedImfile");
    12181220  psAssert (item, "entry not in input?");
  • trunk/ippTools/src/camtoolConfig.c

    r23616 r23688  
    164164
    165165    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-path_base", 0,            "define base output location", NULL);
    166     psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     166    psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
     167    psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-quality",  0,            "set quality", 0);
    167168    psMetadataAddBool(addprocessedexpArgs, PS_LIST_TAIL, "-faulted",  0,            "only return imfiles with a fault status set", false);
    168169
     
    191192
    192193    psMetadataAddBool(revertprocessedexpArgs, PS_LIST_TAIL, "-all",  0,            "allow everything to be queued without search terms", false);
     194    psMetadataAddS16(revertprocessedexpArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    193195
    194196    // -updateprocessedexp
     
    199201    psMetadataAddStr(updateprocessedexpArgs, PS_LIST_TAIL, "-class",  0,            "search by class", NULL);
    200202    psMetadataAddStr(updateprocessedexpArgs, PS_LIST_TAIL, "-class_id",  0,            "search by class ID", NULL);
    201     psMetadataAddS16(updateprocessedexpArgs, PS_LIST_TAIL, "-code",  0,            "set fault code (required)", INT16_MAX);
     203    psMetadataAddS16(updateprocessedexpArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code (required)", INT16_MAX);
    202204
    203205    // -block
  • trunk/ippTools/src/chiptool.c

    r23657 r23688  
    409409    PXOPT_LOOKUP_F32(dtime_script, config->args,   "-dtime_script", false, false);
    410410    PXOPT_LOOKUP_STR(hostname, config->args,       "-hostname", false, false);
    411     PXOPT_LOOKUP_F32(n_stars, config->args,        "-n_stars", false, false);
    412     PXOPT_LOOKUP_F32(n_psfstars, config->args,     "-n_psfstars", false, false);
    413     PXOPT_LOOKUP_F32(n_iqstars, config->args,      "-n_iqstars", false, false);
    414     PXOPT_LOOKUP_F32(n_extended, config->args,     "-n_extended", false, false);
    415     PXOPT_LOOKUP_F32(n_cr, config->args,           "-n_cr", false, false);
    416     PXOPT_LOOKUP_STR(path_base, config->args,      "-path_base", false, false);
    417     PXOPT_LOOKUP_BOOL(magicked, config->args,      "-magicked", false);
     411    PXOPT_LOOKUP_F32(n_stars, config->args,        "-n_stars", false, false);
     412    PXOPT_LOOKUP_F32(n_psfstars, config->args,     "-n_psfstars", false, false);
     413    PXOPT_LOOKUP_F32(n_iqstars, config->args,      "-n_iqstars", false, false);
     414    PXOPT_LOOKUP_F32(n_extended, config->args,     "-n_extended", false, false);
     415    PXOPT_LOOKUP_F32(n_cr, config->args,           "-n_cr", false, false);
     416    PXOPT_LOOKUP_STR(path_base, config->args,      "-path_base", false, false);
     417    PXOPT_LOOKUP_BOOL(magicked, config->args,      "-magicked", false);
    418418
    419419    // default values
    420     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     420    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     421    PXOPT_LOOKUP_S16(quality, config->args, "-quality", false, false);
    421422
    422423    if (!psDBTransaction(config->dbh)) {
     
    449450                                   fwhm_minor_uq,
    450451
    451                                    iq_fwhm_major,
    452                                    iq_fwhm_major_err,
    453                                    iq_fwhm_minor,
    454                                    iq_fwhm_minor_err,
    455 
    456                                    iq_m2,
    457                                    iq_m2_err,
    458                                    iq_m2_lq,
    459                                    iq_m2_uq,
    460 
    461                                    iq_m2c,
    462                                    iq_m2c_err,
    463                                    iq_m2c_lq,
    464                                    iq_m2c_uq,
    465 
    466                                    iq_m2s,
    467                                    iq_m2s_err,
    468                                    iq_m2s_lq,
    469                                    iq_m2s_uq,
    470 
    471                                    iq_m3,
    472                                    iq_m3_err,
    473                                    iq_m3_lq,
    474                                    iq_m3_uq,
    475 
    476                                    iq_m4,
    477                                    iq_m4_err,
    478                                    iq_m4_lq,
    479                                    iq_m4_uq,
     452                                   iq_fwhm_major,
     453                                   iq_fwhm_major_err,
     454                                   iq_fwhm_minor,
     455                                   iq_fwhm_minor_err,
     456
     457                                   iq_m2,
     458                                   iq_m2_err,
     459                                   iq_m2_lq,
     460                                   iq_m2_uq,
     461
     462                                   iq_m2c,
     463                                   iq_m2c_err,
     464                                   iq_m2c_lq,
     465                                   iq_m2c_uq,
     466
     467                                   iq_m2s,
     468                                   iq_m2s_err,
     469                                   iq_m2s_lq,
     470                                   iq_m2s_uq,
     471
     472                                   iq_m3,
     473                                   iq_m3_err,
     474                                   iq_m3_lq,
     475                                   iq_m3_uq,
     476
     477                                   iq_m4,
     478                                   iq_m4_err,
     479                                   iq_m4_lq,
     480                                   iq_m4_uq,
    480481
    481482                                   dtime_detrend,
     
    490491                                   n_cr,
    491492                                   path_base,
    492                                    code,
     493                                   fault,
     494                                   quality,
    493495                                   magicked
    494496            )) {
     
    618620    PXOPT_COPY_STR(config->args, where, "-label", "chipRun.label", "LIKE");
    619621    PXOPT_COPY_STR(config->args, where, "-reduction", "chipRun.reduction", "==");
    620     PXOPT_COPY_S16(config->args, where, "-code", "chipProcessedImfile.fault", "==");
     622    PXOPT_COPY_S16(config->args, where, "-fault", "chipProcessedImfile.fault", "==");
    621623
    622624    if (!psListLength(where->list)
     
    659661    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
    660662    PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "==");
    661     PXOPT_LOOKUP_S16(code, config->args, "-code", true, false);
    662 
    663     if (!pxSetFaultCode(config->dbh, "chipProcessedImfile", where, code)) {
     663    PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
     664
     665    if (!pxSetFaultCode(config->dbh, "chipProcessedImfile", where, fault)) {
    664666        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    665667        return false;
     
    12801282    char sqlFilename[80];
    12811283  } ExportTable;
    1282  
     1284
    12831285  int numExportTables = 3;
    12841286
     
    13601362{
    13611363  unsigned int nFail;
    1362  
     1364
    13631365  int numImportTables = 2;
    1364  
     1366
    13651367  char tables[2] [80] = {"chipImfile", "chipProcessedImfile"};
    13661368
    13671369  PS_ASSERT_PTR_NON_NULL(config, NULL);
    1368  
     1370
    13691371  PXOPT_LOOKUP_STR(infile, config->args, "-infile", true,  false);
    13701372
     
    13861388  // fprintf (stdout, "---- chip run ----\n");
    13871389  // psMetadataPrint (stderr, entry->data.md, 1);
    1388  
     1390
    13891391  for (int i = 0; i < numImportTables; i++) {
    13901392    psMetadataItem *item = psMetadataLookup (input, tables[i]);
    13911393    psAssert (item, "entry not in input?");
    13921394    psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?");
    1393  
     1395
    13941396    switch (i) {
    13951397      case 0:
     
    14051407        }
    14061408        break;
    1407        
     1409
    14081410      case 1:
    14091411        for (int i = 0; i < item->data.list->n; i++) {
  • trunk/ippTools/src/chiptoolConfig.c

    r23615 r23688  
    146146
    147147    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-path_base",  0,            "define base output location", NULL);
    148     psMetadataAddS16(addprocessedimfileArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     148    psMetadataAddS16(addprocessedimfileArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
     149    psMetadataAddS16(addprocessedimfileArgs, PS_LIST_TAIL, "-quality",  0,            "set quality", 0);
    149150    psMetadataAddBool(addprocessedimfileArgs, PS_LIST_TAIL, "-magicked",  0,        "define magicked status", false);
    150151
     
    171172    pxchipSetSearchArgs(revertprocessedimfileArgs);
    172173    psMetadataAddBool(revertprocessedimfileArgs, PS_LIST_TAIL, "-all",  0,            "allow everything to be queued without search terms", false);
    173     psMetadataAddS16(revertprocessedimfileArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     174    psMetadataAddS16(revertprocessedimfileArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    174175
    175176    // -updateprocessedimfile
     
    177178    psMetadataAddS64(updateprocessedimfileArgs, PS_LIST_TAIL, "-chip_id",  0,            "search by chip ID", 0);
    178179    psMetadataAddStr(updateprocessedimfileArgs,  PS_LIST_TAIL, "-class_id",           0, "search by class ID", NULL);
    179     psMetadataAddS16(updateprocessedimfileArgs, PS_LIST_TAIL, "-code",  0,            "set fault code (required)", 0);
     180    psMetadataAddS16(updateprocessedimfileArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code (required)", 0);
    180181
    181182    // -advanceexp
  • trunk/ippTools/src/dettoolConfig.c

    r23332 r23688  
    254254    psMetadataAddS64(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,            "define exp ID (required)", 0);
    255255    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,            "define class ID (required)", NULL);
    256     psMetadataAddS16(addprocessedimfileArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     256    psMetadataAddS16(addprocessedimfileArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    257257    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-uri",  0,            "define URI", NULL);
    258258    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-recip",  0,            "define recipe", NULL);
     
    287287    psMetadataAddS64(revertprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,            "search by exposure ID", 0);
    288288    psMetadataAddStr(revertprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,            "search by class ID", NULL);
    289     psMetadataAddS16(revertprocessedimfileArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     289    psMetadataAddS16(revertprocessedimfileArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    290290
    291291    // -updateprocessedimfile
     
    334334    psMetadataAddF64(addprocessedexpArgs, PS_LIST_TAIL, "-user_5",  0,            "define user statistic (5)", NAN);
    335335    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-path_base",  0,            "define base output location", NULL);
    336     psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     336    psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    337337
    338338    // -proccessedexp
     
    348348    psMetadataAddS64(revertprocessedexpArgs, PS_LIST_TAIL, "-det_id",  0,            "search by detrend ID (required)", 0);
    349349    psMetadataAddS64(revertprocessedexpArgs, PS_LIST_TAIL, "-exp_id",  0,            "search by exposure ID", 0);
    350     psMetadataAddS16(revertprocessedexpArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     350    psMetadataAddS16(revertprocessedexpArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    351351
    352352    // -updateprocessedexp
     
    380380    psMetadataAddS32(addstackedArgs, PS_LIST_TAIL, "-iteration",  0,            "define iteration number (required)", 0);
    381381    psMetadataAddStr(addstackedArgs, PS_LIST_TAIL, "-class_id",  0,            "define class ID (required)", NULL);
    382     psMetadataAddS16(addstackedArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     382    psMetadataAddS16(addstackedArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    383383    psMetadataAddStr(addstackedArgs, PS_LIST_TAIL, "-uri",  0,            "define URI", NULL);
    384384    psMetadataAddStr(addstackedArgs, PS_LIST_TAIL, "-recip",  0,            "define recipe", NULL);
     
    407407    psMetadataAddS32(revertstackedArgs, PS_LIST_TAIL, "-iteration",  0,            "search by iteration number", 0);
    408408    psMetadataAddStr(revertstackedArgs, PS_LIST_TAIL, "-class_id",  0,            "search by class ID", NULL);
    409     psMetadataAddS16(revertstackedArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     409    psMetadataAddS16(revertstackedArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    410410
    411411    // -updatestacked
     
    443443    psMetadataAddStr(addnormstatArgs, PS_LIST_TAIL, "-class_id",  0,            "define class ID (required)", NULL);
    444444    psMetadataAddF32(addnormstatArgs, PS_LIST_TAIL, "-norm",  0,            "define normal value (required)", NAN);
    445     psMetadataAddS16(addnormstatArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     445    psMetadataAddS16(addnormstatArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    446446
    447447    // -normalizedstat
     
    459459    psMetadataAddS32(revertnormalizedstatArgs, PS_LIST_TAIL, "-iteration",  0,            "search by iteration number", 0);
    460460    psMetadataAddStr(revertnormalizedstatArgs, PS_LIST_TAIL, "-class_id",  0,            "search by class ID", NULL);
    461     psMetadataAddS16(revertnormalizedstatArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     461    psMetadataAddS16(revertnormalizedstatArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    462462
    463463    // -updatenormalizedstat
     
    494494    psMetadataAddS32(addnormalizedimfileArgs, PS_LIST_TAIL, "-iteration", 0,            "define iteration number", 0);
    495495    psMetadataAddStr(addnormalizedimfileArgs, PS_LIST_TAIL, "-class_id", 0,            "define class ID (required)", NULL);
    496     psMetadataAddS16(addnormalizedimfileArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     496    psMetadataAddS16(addnormalizedimfileArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    497497    psMetadataAddStr(addnormalizedimfileArgs, PS_LIST_TAIL, "-uri", 0,            "define URI", NULL);
    498498    psMetadataAddF64(addnormalizedimfileArgs, PS_LIST_TAIL, "-bg", 0,            "define exposure background", NAN);
     
    521521    psMetadataAddS32(revertnormalizedimfileArgs, PS_LIST_TAIL, "-iteration", 0,            "search by iteration number", 0);
    522522    psMetadataAddStr(revertnormalizedimfileArgs, PS_LIST_TAIL, "-class_id", 0,            "search by class ID", NULL);
    523     psMetadataAddS16(revertnormalizedimfileArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     523    psMetadataAddS16(revertnormalizedimfileArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    524524
    525525    // -updatenormalizedimfile
     
    555555    psMetadataAddS64(addnormalizedexpArgs, PS_LIST_TAIL, "-det_id",  0,            "define detrend ID (required)", 0);
    556556    psMetadataAddS32(addnormalizedexpArgs, PS_LIST_TAIL, "-iteration",  0,            "define iteration number", 0);
    557     psMetadataAddS16(addnormalizedexpArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     557    psMetadataAddS16(addnormalizedexpArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    558558    psMetadataAddStr(addnormalizedexpArgs, PS_LIST_TAIL, "-recip",  0,            "search for recipe", NULL);
    559559    psMetadataAddF64(addnormalizedexpArgs, PS_LIST_TAIL, "-bg",  0,            "define exposure background", NAN);
     
    580580    psMetadataAddS64(revertnormalizedexpArgs, PS_LIST_TAIL, "-det_id", 0,            "search by detrend ID (required)", 0);
    581581    psMetadataAddS32(revertnormalizedexpArgs, PS_LIST_TAIL, "-iteration", 0,            "search by iteration number", 0);
    582     psMetadataAddS16(revertnormalizedexpArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     582    psMetadataAddS16(revertnormalizedexpArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    583583
    584584    // -updatenormalizedexp
     
    616616    psMetadataAddS64(addresidimfileArgs, PS_LIST_TAIL, "-exp_id",  0,            "define detrend ID (required)", 0);
    617617    psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-class_id",  0,          "define class ID (required)", NULL);
    618     psMetadataAddS16(addresidimfileArgs, PS_LIST_TAIL, "-code",  0,              "set fault code", 0);
     618    psMetadataAddS16(addresidimfileArgs, PS_LIST_TAIL, "-fault",  0,              "set fault code", 0);
    619619    psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-uri",  0,               "define resid file URI", NULL);
    620620    psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-recip",  0,             "define recipe", NULL);
     
    658658    psMetadataAddS64(revertresidimfileArgs, PS_LIST_TAIL, "-exp_id",  0,         "search by detrend ID", 0);
    659659    psMetadataAddStr(revertresidimfileArgs, PS_LIST_TAIL, "-class_id",  0,       "search for class ID", NULL);
    660     psMetadataAddS16(revertresidimfileArgs, PS_LIST_TAIL, "-code",  0,           "search by fault code", 0);
     660    psMetadataAddS16(revertresidimfileArgs, PS_LIST_TAIL, "-fault",  0,           "search by fault code", 0);
    661661
    662662    // -updateresidimfile
     
    696696    psMetadataAddS32(addresidexpArgs, PS_LIST_TAIL, "-iteration",  0,            "define iteration number", 0);
    697697    psMetadataAddS64(addresidexpArgs, PS_LIST_TAIL, "-exp_id",  0,            "define detrend ID (required)", 0);
    698     psMetadataAddS16(addresidexpArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     698    psMetadataAddS16(addresidexpArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    699699    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-recip",  0,            "define recipe", NULL);
    700700    psMetadataAddF64(addresidexpArgs, PS_LIST_TAIL, "-bg",  0,            "define exposure background", NAN);
     
    734734    psMetadataAddS32(revertresidexpArgs, PS_LIST_TAIL, "-iteration", 0,            "search by iteration number", 0);
    735735    psMetadataAddS64(revertresidexpArgs, PS_LIST_TAIL, "-exp_id",  0,            "search by detrend ID", 0);
    736     psMetadataAddS16(revertresidexpArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     736    psMetadataAddS16(revertresidexpArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    737737
    738738    // -updateresidexp
     
    777777    psMetadataAddF64(adddetrunsummaryArgs, PS_LIST_TAIL, "-bg_stdev",  0,            "define exposure background stdev", NAN);
    778778    psMetadataAddF64(adddetrunsummaryArgs, PS_LIST_TAIL, "-bg_mean_stdev",  0,            "define exposure background mean stdev", NAN);
    779     psMetadataAddS16(adddetrunsummaryArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     779    psMetadataAddS16(adddetrunsummaryArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    780780    psMetadataAddBool(adddetrunsummaryArgs, PS_LIST_TAIL, "-accept",  0,            "declare that this detrun iteration is accepted as a master", false);
    781781    psMetadataAddBool(adddetrunsummaryArgs, PS_LIST_TAIL, "-again",  0,            "start a new iteration of this detrend run", false);
     
    794794    psMetadataAddS64(revertdetrunsummaryArgs, PS_LIST_TAIL, "-det_id", 0,            "search by detrend ID (required)", 0);
    795795    psMetadataAddS32(revertdetrunsummaryArgs, PS_LIST_TAIL, "-iteration", 0,            "search by iteration number", 0);
    796     psMetadataAddS16(revertdetrunsummaryArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     796    psMetadataAddS16(revertdetrunsummaryArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    797797
    798798    // -updatedetrunsummary
     
    886886    PXOPT_ADD_MODE("-input",           "", DETTOOL_MODE_INPUT,         inputArgs);
    887887
    888     PXOPT_ADD_MODE("-toprocessedimfile", "",              DETTOOL_MODE_TOPROCESSEDIMFILE, toprocessedimfileArgs);
    889     PXOPT_ADD_MODE("-addprocessedimfile", "",             DETTOOL_MODE_ADDPROCESSEDIMFILE,  addprocessedimfileArgs);
    890     PXOPT_ADD_MODE("-processedimfile", "",                DETTOOL_MODE_PROCESSEDIMFILE, processedimfileArgs);
    891     PXOPT_ADD_MODE("-revertprocessedimfile", "",          DETTOOL_MODE_REVERTPROCESSEDIMFILE, revertprocessedimfileArgs);
    892     PXOPT_ADD_MODE("-updateprocessedimfile", "",          DETTOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileArgs);
     888    PXOPT_ADD_MODE("-toprocessedimfile", "",              DETTOOL_MODE_TOPROCESSEDIMFILE, toprocessedimfileArgs);
     889    PXOPT_ADD_MODE("-addprocessedimfile", "",             DETTOOL_MODE_ADDPROCESSEDIMFILE,  addprocessedimfileArgs);
     890    PXOPT_ADD_MODE("-processedimfile", "",                DETTOOL_MODE_PROCESSEDIMFILE, processedimfileArgs);
     891    PXOPT_ADD_MODE("-revertprocessedimfile", "",          DETTOOL_MODE_REVERTPROCESSEDIMFILE, revertprocessedimfileArgs);
     892    PXOPT_ADD_MODE("-updateprocessedimfile", "",          DETTOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileArgs);
    893893    PXOPT_ADD_MODE("-pendingcleanup_processedimfile", "", DETTOOL_MODE_PENDINGCLEANUP_PROCESSEDIMFILE, pendingcleanup_processedimfileArgs);
    894894    PXOPT_ADD_MODE("-donecleanup_processedimfile", "",    DETTOOL_MODE_DONECLEANUP_PROCESSEDIMFILE, donecleanup_processedimfileArgs);
  • trunk/ippTools/src/dettool_detrunsummary.c

    r21402 r23688  
    101101
    102102    // default values
    103     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     103    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    104104    PXOPT_LOOKUP_BOOL(accept, config->args, "-accept", false);
    105105
     
    107107            det_id,
    108108            iteration,
    109             "full",
     109            "full",
    110110            bg,
    111111            bg_stdev,
    112112            bg_mean_stdev,
    113113            accept,
    114             code
     114            fault
    115115        );
    116116}
     
    120120{
    121121    PS_ASSERT_PTR_NON_NULL(config, false);
    122    
     122
    123123    // build a query to search by det_id, iteration, exp_id
    124124    psMetadata *where = psMetadataAlloc();
     
    129129    PXOPT_LOOKUP_BOOL(again, config->args, "-again", false);
    130130
    131     // The values supplied as arguments on the command (eg, -bg) are parsed 
    132     // by mdToDetRunSummary below. 
     131    // The values supplied as arguments on the command (eg, -bg) are parsed
     132    // by mdToDetRunSummary below.
    133133    // XXX why is there ever more than one?
    134134
     
    141141    if (psListLength(where->list)) {
    142142        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    143         psStringAppend(&query, " WHERE %s", whereClause);
    144         psFree(whereClause);
     143        psStringAppend(&query, " WHERE %s", whereClause);
     144        psFree(whereClause);
    145145    }
    146146    psFree(where);
     
    199199    psFree(output);
    200200
    201     // XXX this logic does not deal with the case of -code being set
    202     // XXX it should be an error for -again and -code to both be set
     201    // XXX this logic does not deal with the case of -fault being set
     202    // XXX it should be an error for -again and -fault to both be set
    203203    if (again) {
    204204        if (!startNewIteration(config, det_id)) {
     
    306306    PXOPT_COPY_S64(config->args, where, "-det_id",    "det_id", "==");
    307307    PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "==");
    308     PXOPT_COPY_STR(config->args, where, "-code",      "fault", "==");
     308    PXOPT_COPY_STR(config->args, where, "-fault",      "fault", "==");
    309309
    310310    psString query = pxDataGet("dettool_revertdetrunsummary.sql");
     
    340340{
    341341    PS_ASSERT_PTR_NON_NULL(config, false);
    342    
     342
    343343    PXOPT_LOOKUP_S64(det_id, config->args, "-det_id", true, false); // required
    344344    PXOPT_LOOKUP_BOOL(accept, config->args, "-accept", false);
     
    355355    }
    356356
    357     char *query = "UPDATE detRunSummary SET accept = %d WHERE det_id = %"PRId64; 
     357    char *query = "UPDATE detRunSummary SET accept = %d WHERE det_id = %"PRId64;
    358358    if (!p_psDBRunQueryF(config->dbh, query, accept, det_id)) {
    359359        psError(PS_ERR_UNKNOWN, false, "database error");
  • trunk/ippTools/src/dettool_normalizedexp.c

    r19092 r23688  
    7272{
    7373    PS_ASSERT_PTR_NON_NULL(config, false);
    74    
     74
    7575    PXOPT_LOOKUP_S64(det_id, config->args, "-det_id", true, false); // required
    7676    PXOPT_LOOKUP_S32(iteration, config->args, "-iteration", false, false);
    77     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    78     PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (code == 0), false); // Required if code == 0
     77    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     78    PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (fault == 0), false); // Required if fault == 0
    7979    PXOPT_LOOKUP_F64(bg, config->args, "-bg", false, false);
    8080    PXOPT_LOOKUP_F64(bg_stdev, config->args, "-bg_stdev", false, false);
     
    117117    // insert the new row into the detProcessedImfile table
    118118    if (!detNormalizedExpInsert(
    119             config->dbh,
    120             det_id,
    121             iteration,
    122             recipe,
    123             bg,
    124             bg_stdev,
    125             bg_mean_stdev,
    126             user_1,
    127             user_2,
    128             user_3,
    129             user_4,
    130             user_5,
    131             path_base,
    132             "full",
    133             code
    134             )) {
     119            config->dbh,
     120            det_id,
     121            iteration,
     122            recipe,
     123            bg,
     124            bg_stdev,
     125            bg_mean_stdev,
     126            user_1,
     127            user_2,
     128            user_3,
     129            user_4,
     130            user_5,
     131            path_base,
     132            "full",
     133            fault
     134            )) {
    135135        psError(PS_ERR_UNKNOWN, false, "database error");
    136136        return false;
     
    221221    PXOPT_COPY_S64(config->args, where, "-det_id",    "det_id", "==");
    222222    PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "==");
    223     PXOPT_COPY_S16(config->args, where, "-code",      "fault", "==");
     223    PXOPT_COPY_S16(config->args, where, "-fault",      "fault", "==");
    224224
    225225    psString query = pxDataGet("dettool_revertnormalizedexp.sql");
     
    260260
    261261    if (!setNormExpDataState(config, det_id, iteration, data_state)) {
    262         return false;
     262        return false;
    263263    }
    264264    return true;
  • trunk/ippTools/src/dettool_normalizedimfile.c

    r19092 r23688  
    8080    PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);
    8181
    82     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    83 
    84     // Required if code == 0
    85     PXOPT_LOOKUP_STR(uri, config->args, "-uri", (code == 0), false);
     82    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     83
     84    // Required if fault == 0
     85    PXOPT_LOOKUP_STR(uri, config->args, "-uri", (fault == 0), false);
    8686
    8787    // optional
     
    9797
    9898    if (!detNormalizedImfileInsert(
    99             config->dbh,
    100             det_id,
    101             iteration,
    102             class_id,
    103             uri,
    104             bg,
    105             bg_stdev,
    106             bg_mean_stdev,
    107             user_1,
    108             user_2,
    109             user_3,
    110             user_4,
    111             user_5,
    112             path_base,
    113             "full",
    114             code
    115             )) {
     99            config->dbh,
     100            det_id,
     101            iteration,
     102            class_id,
     103            uri,
     104            bg,
     105            bg_stdev,
     106            bg_mean_stdev,
     107            user_1,
     108            user_2,
     109            user_3,
     110            user_4,
     111            user_5,
     112            path_base,
     113            "full",
     114            fault
     115            )) {
    116116        psError(PS_ERR_UNKNOWN, false, "database error");
    117117        return false;
     
    201201    PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "==");
    202202    PXOPT_COPY_STR(config->args, where, "-class_id",  "class_id", "==");
    203     PXOPT_COPY_S16(config->args, where, "-code",      "fault", "==");
     203    PXOPT_COPY_S16(config->args, where, "-fault",      "fault", "==");
    204204
    205205    psString query = pxDataGet("dettool_revertnormalizedimfile.sql");
     
    241241
    242242    if (!setNormImfileDataState(config, det_id, iteration, class_id, data_state)) {
    243         return false;
     243        return false;
    244244    }
    245245    return true;
  • trunk/ippTools/src/dettool_normalizedstat.c

    r19092 r23688  
    8383    // default
    8484    PXOPT_LOOKUP_S32(iteration, config->args, "-iteration", false, false);
    85     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     85    PXOPT_LOOKUP_S16(code, config->args, "-fault", false, false);
    8686
    8787    detNormalizedStatImfileRow *row = detNormalizedStatImfileRowAlloc
    88         (det_id,
    89         iteration,
    90         class_id,
    91         norm,
    92         "full",
    93         code);
    94                                                                          
     88        (det_id,
     89        iteration,
     90        class_id,
     91        norm,
     92        "full",
     93        code);
     94
    9595    if (!detNormalizedStatImfileInsertObject(config->dbh, row)) {
    96         psError(PS_ERR_UNKNOWN, false, "database error");
    97         return false;
     96        psError(PS_ERR_UNKNOWN, false, "database error");
     97        return false;
    9898    }
    9999
     
    181181    PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "==");
    182182    PXOPT_COPY_STR(config->args, where, "-class_id",  "class_id", "==");
    183     PXOPT_COPY_S16(config->args, where, "-code",      "fault", "==");
     183    PXOPT_COPY_S16(config->args, where, "-fault",      "fault", "==");
    184184
    185185    psString query = pxDataGet("dettool_revertnormalizedstat.sql");
     
    221221
    222222    if (!setNormStatImfileDataState(config, det_id, iteration, class_id, data_state)) {
    223         return false;
     223        return false;
    224224    }
    225225    return true;
  • trunk/ippTools/src/dettool_processedexp.c

    r21402 r23688  
    8080
    8181    // default values
    82     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    83 
    84     // Required if code == 0
    85     PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (code == 0), false);
     82    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     83
     84    // Required if fault == 0
     85    PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (fault == 0), false);
    8686
    8787    // optional
     
    141141        user_5,
    142142        path_base,
    143         "full",
    144         code
     143        "full",
     144        fault
    145145    );
    146146
     
    231231    PXOPT_COPY_S64(config->args, where, "-det_id", "det_id", "==");
    232232    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    233     PXOPT_COPY_S16(config->args, where, "-code",   "fault", "==");
     233    PXOPT_COPY_S16(config->args, where, "-fault",   "fault", "==");
    234234
    235235    psString query = pxDataGet("dettool_revertprocessedexp.sql");
     
    269269    PXOPT_LOOKUP_STR(data_state, config->args, "-data_state", true, false);
    270270    if (!setProcessedExpDataState(config, det_id, exp_id, data_state)) {
    271         return false;
     271        return false;
    272272    }
    273273    return true;
  • trunk/ippTools/src/dettool_processedimfile.c

    r23229 r23688  
    9292
    9393    // default values
    94     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    95 
    96     // Required if code == 0
    97     PXOPT_LOOKUP_STR(uri, config->args, "-uri", (code == 0), false);
    98     PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (code == 0), false);
     94    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     95
     96    // Required if fault == 0
     97    PXOPT_LOOKUP_STR(uri, config->args, "-uri", (fault == 0), false);
     98    PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (fault == 0), false);
    9999
    100100    // optional
     
    144144        user_5,
    145145        path_base,
    146         "full",
    147         code
     146        "full",
     147        fault
    148148    );
    149149    psFree(rawImfiles);
     
    190190        psStringAppend(&query, " %s", whereClause);
    191191        psFree(whereClause);
    192         hasWhere = true;
     192        hasWhere = true;
    193193    }
    194194    psFree (where);
     
    196196    // restrict search to included imfiles
    197197    if (included) {
    198         if (hasWhere) {
    199             psStringAppend(&query, " AND detInputExp.include = 1");
    200         } else {
    201             psStringAppend(&query, " WHERE detInputExp.include = 1");
    202         }
    203         hasWhere = true;
     198        if (hasWhere) {
     199            psStringAppend(&query, " AND detInputExp.include = 1");
     200        } else {
     201            psStringAppend(&query, " WHERE detInputExp.include = 1");
     202        }
     203        hasWhere = true;
    204204    }
    205205
    206206    if (hasWhere) {
    207         psStringAppend(&query, " AND");
     207        psStringAppend(&query, " AND");
    208208    } else {
    209         psStringAppend(&query, " WHERE");
     209        psStringAppend(&query, " WHERE");
    210210    }
    211211
    212212    if (faulted) {
    213213        // list only faulted rows
    214         psStringAppend(&query, " %s", " detProcessedImfile.fault != 0");
     214        psStringAppend(&query, " %s", " detProcessedImfile.fault != 0");
    215215    } else {
    216216        // don't list faulted rows
     
    263263    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    264264    PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "==");
    265     PXOPT_COPY_S16(config->args, where, "-code", "fault", "==");
     265    PXOPT_COPY_S16(config->args, where, "-fault", "fault", "==");
    266266
    267267    psString query = pxDataGet("dettool_revertprocessedimfile.sql");
     
    303303
    304304    if (!setProcessedImfileDataState(config, det_id, exp_id, class_id, data_state)) {
    305         return false;
     305        return false;
    306306    }
    307307    return true;
  • trunk/ippTools/src/dettool_residexp.c

    r19092 r23688  
    9595    PXOPT_LOOKUP_S32(iteration, config->args, "-iteration", false, false);
    9696    PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", true, false); // required
    97     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    98     PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (code == 0), false); // Required if code == 0
     97    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     98    PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (fault == 0), false); // Required if fault == 0
    9999    PXOPT_LOOKUP_F64(bg, config->args, "-bg", false, false);
    100100    PXOPT_LOOKUP_F64(bg_stdev, config->args, "-bg_stdev", false, false);
     
    124124
    125125    if (psListLength(where->list)) {
    126         psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    127         psStringAppend(&query, " WHERE %s", whereClause);
    128         psFree(whereClause);
     126        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
     127        psStringAppend(&query, " WHERE %s", whereClause);
     128        psFree(whereClause);
    129129    }
    130130    psFree(where);
     
    151151
    152152    if (!detResidExpInsert(
    153             config->dbh,
     153            config->dbh,
    154154            det_id,
    155155            iteration,
     
    174174            user_5,
    175175            path_base,
    176             "full",
     176            "full",
    177177            !reject,
    178             code
     178            fault
    179179        )) {
    180180        psError(PS_ERR_UNKNOWN, false, "database error");
     
    225225    if (reject) {
    226226        psStringAppend(&query, " %s", "AND detResidExp.accept != 0");
    227     } 
     227    }
    228228
    229229    // treat limit == 0 as "no limit"
     
    273273    PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "==");
    274274    PXOPT_COPY_S64(config->args, where, "-exp_id",    "exp_id", "==");
    275     PXOPT_COPY_S16(config->args, where, "-code",      "fault", "==");
     275    PXOPT_COPY_S16(config->args, where, "-fault",      "fault", "==");
    276276
    277277    psString query = pxDataGet("dettool_revertresidexp.sql");
     
    330330    PXOPT_LOOKUP_STR(data_state, config->args, "-data_state", false, false);
    331331    if (data_state) {
    332         if (!isValidDataState (data_state)) return false;
     332        if (!isValidDataState (data_state)) return false;
    333333    }
    334334
  • trunk/ippTools/src/dettool_residimfile.c

    r23229 r23688  
    7575    PS_ASSERT_PTR_NON_NULL(config, false);
    7676
    77    
     77
    7878    PXOPT_LOOKUP_S64(det_id, config->args, "-det_id", true, false); // required
    7979    PXOPT_LOOKUP_S32(iteration, config->args, "-iteration", false, false);
     
    8484    PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", true, false); // required
    8585    PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false); // required
    86     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    87     PXOPT_LOOKUP_STR(uri, config->args, "-uri", (code == 0), false); // Required if code == 0
    88     PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (code == 0), false); // Required if code == 0
     86    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     87    PXOPT_LOOKUP_STR(uri, config->args, "-uri", (fault == 0), false); // Required if fault == 0
     88    PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (fault == 0), false); // Required if fault == 0
    8989    PXOPT_LOOKUP_F64(bg, config->args, "-bg", false, false);
    9090    PXOPT_LOOKUP_F64(bg_stdev, config->args, "-bg_stdev", false, false);
     
    107107
    108108    if (!detResidImfileInsert(
    109             config->dbh,
     109            config->dbh,
    110110            det_id,
    111111            iteration,
     
    134134            user_5,
    135135            path_base,
    136             "full",
    137             code
     136            "full",
     137            fault
    138138    )) {
    139139        psError(PS_ERR_UNKNOWN, false, "database error");
     
    174174        psStringAppend(&query, " %s", whereClause);
    175175        psFree(whereClause);
    176         hasWhere = true;
     176        hasWhere = true;
    177177    }
    178178    psFree(where);
     
    180180    // restrict search to included imfiles
    181181    if (included) {
    182         if (hasWhere) {
    183             psStringAppend(&query, " AND detInputExp.include = 1");
    184         } else {
    185             psStringAppend(&query, " WHERE detInputExp.include = 1");
    186         }
    187         hasWhere = true;
     182        if (hasWhere) {
     183            psStringAppend(&query, " AND detInputExp.include = 1");
     184        } else {
     185            psStringAppend(&query, " WHERE detInputExp.include = 1");
     186        }
     187        hasWhere = true;
    188188    }
    189189
    190190    if (hasWhere) {
    191         psStringAppend(&query, " AND");
     191        psStringAppend(&query, " AND");
    192192    } else {
    193         psStringAppend(&query, " WHERE");
     193        psStringAppend(&query, " WHERE");
    194194    }
    195195
     
    249249    PXOPT_COPY_S64(config->args, where, "-exp_id",  "exp_id", "==");
    250250    PXOPT_COPY_STR(config->args, where, "-class_id",  "class_id", "==");
    251     PXOPT_COPY_S16(config->args, where, "-code",      "fault", "==");
     251    PXOPT_COPY_S16(config->args, where, "-fault",      "fault", "==");
    252252
    253253    psString query = pxDataGet("dettool_revertresidimfile.sql");
     
    289289    PXOPT_LOOKUP_STR(data_state, config->args, "-data_state", true, false);
    290290    if (!setResidImfileDataState(config, det_id, iteration, exp_id, class_id, data_state)) {
    291         return false;
     291        return false;
    292292    }
    293293    return true;
  • trunk/ippTools/src/dettool_stack.c

    r19092 r23688  
    127127    PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);
    128128
    129     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    130 
    131     // Required if code == 0
    132     PXOPT_LOOKUP_STR(uri, config->args, "-uri", (code == 0), false);
    133     PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (code == 0), false);
     129    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     130
     131    // Required if fault == 0
     132    PXOPT_LOOKUP_STR(uri, config->args, "-uri", (fault == 0), false);
     133    PXOPT_LOOKUP_STR(recipe, config->args, "-recip", (fault == 0), false);
    134134
    135135    // optional
     
    188188            user_4,
    189189            user_5,
    190             "full",
    191             code
     190            "full",
     191            fault
    192192        );
    193193
     
    286286    PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "==");
    287287    PXOPT_COPY_STR(config->args, where, "-class_id",  "class_id", "==");
    288     PXOPT_COPY_S16(config->args, where, "-code",      "fault", "==");
     288    PXOPT_COPY_S16(config->args, where, "-fault",      "fault", "==");
    289289
    290290    psString query = pxDataGet("dettool_revertstacked.sql");
     
    326326
    327327    if (!setStackedImfileDataState(config, det_id, iteration, class_id, data_state)) {
    328         return false;
     328        return false;
    329329    }
    330330    return true;
  • trunk/ippTools/src/difftool.c

    r23634 r23688  
    485485    PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", true, false); // required
    486486    PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false);
    487     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    488     PXOPT_LOOKUP_STR(uri, config->args, "-uri", (code == 0), false);
    489     PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", (code == 0), false);
     487    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     488    PXOPT_LOOKUP_S16(quality, config->args, "-quality", false, false);
     489    PXOPT_LOOKUP_STR(uri, config->args, "-uri", (fault == 0), false);
     490    PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", (fault == 0), false);
    490491
    491492    // optional
     
    540541                           hostname,
    541542                           good_frac,
    542                            code,
     543                           fault,
     544                           quality,
    543545                           magicked
    544546          )) {
     
    578580    PXOPT_COPY_S64(config->args, where,  "-diff_skyfile_id", "diffInputSkyfile.diff_skyfile_id", "==");
    579581    PXOPT_COPY_STR(config->args, where, "-tess_id", "diffSkyfile.tess_id", "==");
    580     PXOPT_COPY_S16(config->args, where, "-code", "diffSkyfile.fault", "==");
     582    PXOPT_COPY_S16(config->args, where, "-fault", "diffSkyfile.fault", "==");
    581583    PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "==");
    582584    PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_name", "==");
     
    655657    PXOPT_COPY_S64(config->args, where,  "-diff_id", "diffSkyfile.diff_id", "==");
    656658    PXOPT_COPY_STR(config->args, where,  "-label", "diffRun.label", "==");
    657     PXOPT_COPY_S16(config->args, where, "-code",     "fault", "==");
     659    PXOPT_COPY_S16(config->args, where, "-fault",     "fault", "==");
    658660
    659661    if (!psDBTransaction(config->dbh)) {
     
    12691271    PXOPT_COPY_S64(config->args, selectWhere, "-exp_id", "inputRawExp.exp_id", "==");
    12701272    PXOPT_COPY_STR(config->args, selectWhere, "-filter", "inputRawExp.filter", "==");
     1273    PXOPT_COPY_STR(config->args, selectWhere, "-obs_mode", "inputRawExp.obs_mode", "==");
     1274    PXOPT_COPY_STR(config->args, selectWhere, "-obs_mode", "templateRawExp.obs_mode", "==");
    12711275    PXOPT_COPY_STR(config->args, selectWhere, "-input_label", "inputWarpRun.label", "==");
    12721276    PXOPT_COPY_STR(config->args, selectWhere, "-template_label", "templateWarpRun.label", "==");
     
    16621666    PS_ASSERT_PTR_NON_NULL(config, false);
    16631667
    1664     PXOPT_LOOKUP_S16(code, config->args, "-code", true, false);
     1668    PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
    16651669
    16661670    psMetadata *where = psMetadataAlloc();
    16671671    PXOPT_COPY_S64(config->args, where, "-diff_id",   "diff_id",   "==");
    16681672
    1669     if (!pxSetFaultCode(config->dbh, "diffSkyfile", where, code)) {
     1673    if (!pxSetFaultCode(config->dbh, "diffSkyfile", where, fault)) {
    16701674        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    16711675        psFree (where);
  • trunk/ippTools/src/difftoolConfig.c

    r23634 r23688  
    8888    psMetadataAddS64(adddiffskyfileArgs, PS_LIST_TAIL, "-diff_id", 0,            "define warp ID (required)", 0);
    8989    psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0,       "define skycell of file (required)", 0);
    90     psMetadataAddS16(adddiffskyfileArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     90    psMetadataAddS16(adddiffskyfileArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
     91    psMetadataAddS16(adddiffskyfileArgs, PS_LIST_TAIL, "-quality",  0,            "set quality", 0);
    9192    psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "-uri", 0,            "define URI of file", 0);
    9293    psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "-path_base", 0,            "define base output location", 0);
     
    123124    psMetadataAddU64(diffskyfileArgs, PS_LIST_TAIL, "-limit",  0,            "limit result set to N items", 0);
    124125    psMetadataAddBool(diffskyfileArgs, PS_LIST_TAIL, "-simple",  0,            "use the simple output format", false);
    125     psMetadataAddS16(diffskyfileArgs, PS_LIST_TAIL, "-code",  0,            "deifine fault code", 0);
     126    psMetadataAddS16(diffskyfileArgs, PS_LIST_TAIL, "-fault",  0,            "define fault code", 0);
    126127
    127128    // -revertdiffskyfile
     
    129130    psMetadataAddS64(revertdiffskyfileArgs, PS_LIST_TAIL, "-diff_id", 0,            "search by diff ID", 0);
    130131    psMetadataAddStr(revertdiffskyfileArgs, PS_LIST_TAIL, "-label", 0, "search by label", NULL);
    131     psMetadataAddS16(revertdiffskyfileArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     132    psMetadataAddS16(revertdiffskyfileArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    132133
    133134    // -definepoprun
     
    171172    psMetadataAddStr(definewarpwarpArgs, PS_LIST_TAIL, "-filter", 0, "search by filter", NULL);
    172173    psMetadataAddF32(definewarpwarpArgs, PS_LIST_TAIL, "-distance", 0, "limit distance between input and template (deg)", NAN);
     174    psMetadataAddStr(definewarpwarpArgs, PS_LIST_TAIL, "-obs_mode", 0, "search by observation mode", NULL);
    173175    psMetadataAddF32(definewarpwarpArgs, PS_LIST_TAIL, "-timediff", 0, "limit time difference between input and template", NAN);
    174176    psMetadataAddF32(definewarpwarpArgs, PS_LIST_TAIL, "-rotdiff", 0, "limit rotator difference between input and template", NAN);
     
    205207    psMetadata *updatediffskyfileArgs = psMetadataAlloc();
    206208    psMetadataAddS64(updatediffskyfileArgs, PS_LIST_TAIL, "-diff_id", 0,      "define diff ID (required)", 0);
    207     psMetadataAddS16(updatediffskyfileArgs, PS_LIST_TAIL, "-code", 0,         "set fault code (required)", 0);
     209    psMetadataAddS16(updatediffskyfileArgs, PS_LIST_TAIL, "-fault", 0,         "set fault code (required)", 0);
    208210
    209211    // -exportrun
  • trunk/ippTools/src/disttool.c

    r23661 r23688  
    106106
    107107    // TODO: should we check that stage_id actually exists for stage
    108     // in magicdstool we queue off of a magic_id so the stage_id, exp_id, and cam_id get looked up 
     108    // in magicdstool we queue off of a magic_id so the stage_id, exp_id, and cam_id get looked up
    109109    // when the run is queued
    110110
     
    151151    PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);
    152152    PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false);
    153     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    154 
    155     if ((!state) && (!label) && (!code)) {
    156         psError(PXTOOLS_ERR_DATA, false, "parameters (-code or -set_state or -set_label) are required");
     153    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     154
     155    if ((!state) && (!label) && (!fault)) {
     156        psError(PXTOOLS_ERR_DATA, false, "parameters (-fault or -set_state or -set_label) are required");
    157157        psFree(where);
    158158        return false;
     
    169169    }
    170170
    171     if (code) {
    172         psStringAppend(&query, " , fault = %d", code);
     171    if (fault) {
     172        psStringAppend(&query, " , fault = %d", fault);
    173173    }
    174174
     
    195195    PXOPT_COPY_STR(config->args, where, "-state", "state", "==");
    196196    PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
    197     PXOPT_COPY_S16(config->args, where, "-code", "distComponent.fault", "==");
     197    PXOPT_COPY_S16(config->args, where, "-fault", "distComponent.fault", "==");
    198198
    199199    // It might be useful to be able to query by the parameters of the underlying runs
     
    402402    // unless fault code is set require filename, bytes, and md5sum
    403403    bool require_fileinfo = false;
    404     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    405     if (!code) {
     404    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     405    if (!fault) {
    406406        require_fileinfo = true;
    407407    }
     
    410410    PXOPT_LOOKUP_STR(name, config->args, "-name", require_fileinfo, false);
    411411
    412     if (!distComponentInsert(config->dbh, dist_id, component, bytes, md5sum, "full", name, code)) {
     412    if (!distComponentInsert(config->dbh, dist_id, component, bytes, md5sum, "full", name, fault)) {
    413413        psError(PS_ERR_UNKNOWN, false, "database error");
    414414        return false;
  • trunk/ippTools/src/disttoolConfig.c

    r23661 r23688  
    4646    psMetadata *definerunArgs = psMetadataAlloc();
    4747    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-stage",         0, "define stage for bundle (required)", NULL);
    48     psMetadataAddS64(definerunArgs, PS_LIST_TAIL, "-stage_id", 0, "define stage_id (required)", 0); 
     48    psMetadataAddS64(definerunArgs, PS_LIST_TAIL, "-stage_id", 0, "define stage_id (required)", 0);
    4949    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-outroot",  0, "define output destination (required)", NULL);
    5050    psMetadataAddS64(definerunArgs, PS_LIST_TAIL, "-target_id", 0, "define stage_id", 0);
     
    5252    psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-no_magic", 0, "magic is not needed", false);
    5353    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-set_label",    0, "define label for run", NULL);
    54    
     54
    5555    // -updaterun
    5656    psMetadata *updaterunArgs = psMetadataAlloc();
    57     psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-dist_id",  0, "define dist_id", 0); 
     57    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-dist_id",  0, "define dist_id", 0);
    5858    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_state", 0, "new value for state", NULL);
    5959    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_label", 0, "new value for label", NULL);
     
    6161    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state",     0, "value for state", NULL);
    6262    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label",     0, "limit updates to label", NULL);
    63     psMetadataAddS16(updaterunArgs, PS_LIST_TAIL, "-code",      0, "define fault code", 0);
    64    
     63    psMetadataAddS16(updaterunArgs, PS_LIST_TAIL, "-fault",      0, "define fault code", 0);
     64
    6565    // -revertrun
    6666    psMetadata *revertrunArgs = psMetadataAlloc();
    67     psMetadataAddS64(revertrunArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0); 
     67    psMetadataAddS64(revertrunArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0);
    6868    psMetadataAddStr(revertrunArgs, PS_LIST_TAIL, "-stage",    0, "define stage", NULL);
    69     psMetadataAddS64(revertrunArgs, PS_LIST_TAIL, "-stage_id", 0, "define stage_id", 0); 
     69    psMetadataAddS64(revertrunArgs, PS_LIST_TAIL, "-stage_id", 0, "define stage_id", 0);
    7070    psMetadataAddStr(revertrunArgs, PS_LIST_TAIL, "-state",    0, "define state", NULL);
    7171    psMetadataAddStr(revertrunArgs, PS_LIST_TAIL, "-label",    0, "define label", NULL);
    72     psMetadataAddS16(revertrunArgs, PS_LIST_TAIL, "-code", 0, "define fault code", 0);
     72    psMetadataAddS16(revertrunArgs, PS_LIST_TAIL, "-fault", 0, "define fault code", 0);
    7373    psMetadataAddBool(revertrunArgs, PS_LIST_TAIL, "-all",    0, "revert all faulted runs", NULL);
    74    
     74
    7575    // -pendingcomponent
    7676    psMetadata *pendingcomponentArgs = psMetadataAlloc();
    77     psMetadataAddS64(pendingcomponentArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0); 
     77    psMetadataAddS64(pendingcomponentArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0);
    7878    psMetadataAddStr(pendingcomponentArgs, PS_LIST_TAIL, "-stage",    0, "limit results to runs for stage", NULL);
    7979    psMetadataAddStr(pendingcomponentArgs, PS_LIST_TAIL, "-label",    0, "limit results to label", NULL);
     
    8484    // -addprocessedcomponent
    8585    psMetadata *addprocessedcomponentArgs = psMetadataAlloc();
    86     psMetadataAddS64(addprocessedcomponentArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0); 
     86    psMetadataAddS64(addprocessedcomponentArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0);
    8787    psMetadataAddStr(addprocessedcomponentArgs, PS_LIST_TAIL, "-component", 0, "define component (required)", NULL);
    8888    psMetadataAddStr(addprocessedcomponentArgs, PS_LIST_TAIL, "-name", 0, "define file name", NULL);
    89     psMetadataAddS32(addprocessedcomponentArgs, PS_LIST_TAIL, "-bytes", 0, "define file size", 0); 
     89    psMetadataAddS32(addprocessedcomponentArgs, PS_LIST_TAIL, "-bytes", 0, "define file size", 0);
    9090    psMetadataAddStr(addprocessedcomponentArgs, PS_LIST_TAIL, "-md5sum", 0, "define stage for bundle", NULL);
    91     psMetadataAddS32(addprocessedcomponentArgs, PS_LIST_TAIL, "-code", 0, "define fault code", 0);
     91    psMetadataAddS32(addprocessedcomponentArgs, PS_LIST_TAIL, "-fault", 0, "define fault code", 0);
    9292
    9393    // -processedcomponent
    9494    psMetadata *processedcomponentArgs = psMetadataAlloc();
    95     psMetadataAddS64(processedcomponentArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0); 
     95    psMetadataAddS64(processedcomponentArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0);
    9696    psMetadataAddU64(processedcomponentArgs, PS_LIST_TAIL, "-limit",  0,  "limit result set to N items", 0);
    9797    psMetadataAddBool(processedcomponentArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
     
    9999    // -toadvance
    100100    psMetadata *toadvanceArgs = psMetadataAlloc();
    101     psMetadataAddS64(toadvanceArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0); 
     101    psMetadataAddS64(toadvanceArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0);
    102102    psMetadataAddU64(toadvanceArgs, PS_LIST_TAIL, "-limit",  0,  "limit result set to N items", 0);
    103103    psMetadataAddBool(toadvanceArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
  • trunk/ippTools/src/faketool.c

    r23339 r23688  
    496496
    497497    // default values
    498     PXOPT_LOOKUP_S16(code, config->args,        "-code", false, false);
     498    PXOPT_LOOKUP_S16(fault, config->args,        "-fault", false, false);
    499499
    500500    if (!psDBTransaction(config->dbh)) {
     
    513513                                   path_base,
    514514                                   "full",
    515                                    code,
     515                                   fault,
    516516                                   NULL         // epoch
    517517            )) {
     
    687687    PS_ASSERT_PTR_NON_NULL(config, false);
    688688
    689     PXOPT_LOOKUP_S16(code, config->args, "-code", true, false);
     689    PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
    690690
    691691    psMetadata *where = psMetadataAlloc();
     
    693693    PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "==");
    694694
    695     if (!pxSetFaultCode(config->dbh, "fakeProcessedImfile", where, code)) {
     695    if (!pxSetFaultCode(config->dbh, "fakeProcessedImfile", where, fault)) {
    696696        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    697697        psFree(where);
     
    12381238
    12391239  int numExportTables = 2;
    1240  
     1240
    12411241  PS_ASSERT_PTR_NON_NULL(config, NULL);
    12421242
     
    13161316
    13171317  PS_ASSERT_PTR_NON_NULL(config, NULL);
    1318  
     1318
    13191319  PXOPT_LOOKUP_STR(infile, config->args, "-infile", true,  false);
    13201320
  • trunk/ippTools/src/faketoolConfig.c

    r23339 r23688  
    175175    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-hostname",  0,            "define hostname", NULL);
    176176    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-path_base",  0,            "define base output location", NULL);
    177     psMetadataAddS16(addprocessedimfileArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     177    psMetadataAddS16(addprocessedimfileArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    178178
    179179    // -processedimfile
     
    193193    psMetadataAddS64(updateprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,            "search by exposure ID", 0);
    194194    psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,            "search by class ID", NULL);
    195     psMetadataAddS16(updateprocessedimfileArgs, PS_LIST_TAIL, "-code",  0,            "set fault code (required)", 0);
     195    psMetadataAddS16(updateprocessedimfileArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code (required)", 0);
    196196
    197197    // -revertprocessedimfile
     
    239239
    240240    psMetadataAddBool(revertprocessedimfileArgs, PS_LIST_TAIL, "-all",  0,            "allow everything to be queued without search terms", false);
    241     psMetadataAddS16(revertprocessedimfileArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     241    psMetadataAddS16(revertprocessedimfileArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    242242
    243243
  • trunk/ippTools/src/flatcorr.c

    r23310 r23688  
    117117    }
    118118
    119     // require the camera to be defined: this analysis does not make sense 
     119    // require the camera to be defined: this analysis does not make sense
    120120    // across multiple cameras
    121121    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     
    169169
    170170    if (pretend) {
    171         for (long i = 0; i < psArrayLength(output); i++) {
    172             // negative simple so the default is true
    173             if (!ippdbPrintMetadataRaw(stdout, output->data[i], !simple)) {
    174                 psError(PS_ERR_UNKNOWN, false, "failed to print array");
    175                 psFree(output);
    176                 return false;
    177             }
    178         }
     171        for (long i = 0; i < psArrayLength(output); i++) {
     172            // negative simple so the default is true
     173            if (!ippdbPrintMetadataRaw(stdout, output->data[i], !simple)) {
     174                psError(PS_ERR_UNKNOWN, false, "failed to print array");
     175                psFree(output);
     176                return false;
     177            }
     178        }
    179179        psFree(output);
    180180        return true;
     
    191191    // create a new flatcorrRun
    192192    if (!flatcorrRunInsert(
    193             config->dbh,
     193            config->dbh,
    194194            0,      // corr_id
    195             det_type,
     195            det_type,
    196196            dvodb,
    197             camera,
    198             telescope,
    199             NULL,
     197            camera,
     198            telescope,
     199            NULL,
    200200            filter,
    201201            "reg",  // state
     
    203203            label,
    204204            reduction,
    205             region,
    206             NULL,
    207             0
     205            region,
     206            NULL,
     207            0
    208208        )) {
    209209        if (!psDBRollback(config->dbh)) {
     
    304304    // create a new flatcorrRun
    305305    flatcorrRunRow *row = flatcorrRunRowAlloc(
    306         0,      // corr_id
    307         det_type,
    308         dvodb,
    309         camera,
    310         telescope,
    311         NULL,
    312         filter,
    313         "reg",  // state
    314         workdir,
    315         label,
    316         reduction,
    317         region,
    318         NULL, // hostname
    319         0 // fault
     306        0,      // corr_id
     307        det_type,
     308        dvodb,
     309        camera,
     310        telescope,
     311        NULL,
     312        filter,
     313        "reg",  // state
     314        workdir,
     315        label,
     316        reduction,
     317        region,
     318        NULL, // hostname
     319        0 // fault
    320320        );
    321321
     
    328328        return false;
    329329    }
    330    
     330
    331331    // figure out the ID of the flatcorrRun we just created
    332332    psS64 corr_id = psDBLastInsertID(config->dbh);
     
    365365    psString query = pxDataGet("flatcorr_dropchip.sql");
    366366    if (!query) {
    367         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    368         return false;
     367        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     368        return false;
    369369    }
    370370
     
    390390    psString query = pxDataGet("flatcorr_chiprundone.sql");
    391391    if (!query) {
    392         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    393         return false;
     392        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     393        return false;
    394394    }
    395395
    396396    // treat limit == 0 as "no limit"
    397397    if (limit) {
    398         psString limitString = psDBGenerateLimitSQL(limit);
    399         psStringAppend(&query, " %s", limitString);
    400         psFree(limitString);
     398        psString limitString = psDBGenerateLimitSQL(limit);
     399        psStringAppend(&query, " %s", limitString);
     400        psFree(limitString);
    401401    }
    402402
     
    459459        // queue the exp
    460460        if (!pxcamQueueByChipID(
    461                 config,
    462                 row->chip_id,
    463                 row->workdir,
    464                 row->label,
    465                 row->reduction,
    466                 row->expgroup,
    467                 row->dvodb,
    468                 row->tess_id,
    469                 "camera")) {
     461                config,
     462                row->chip_id,
     463                row->workdir,
     464                row->label,
     465                row->reduction,
     466                row->expgroup,
     467                row->dvodb,
     468                row->tess_id,
     469                "camera")) {
    470470            if (!psDBRollback(config->dbh)) {
    471471                psError(PS_ERR_UNKNOWN, false, "database error");
     
    478478        }
    479479
    480         // figure out the ID of the flatcorrRun we just created
    481         psS64 cam_id = psDBLastInsertID(config->dbh);
    482 
    483         // add the camRun entry to the flatcorrCamLink table (include is TRUE)
     480        // figure out the ID of the flatcorrRun we just created
     481        psS64 cam_id = psDBLastInsertID(config->dbh);
     482
     483        // add the camRun entry to the flatcorrCamLink table (include is TRUE)
    484484        if (!flatcorrCamLinkInsert(config->dbh, corr_id, row->chip_id, cam_id, 1)) {
    485485            if (!psDBRollback(config->dbh)) {
     
    489489            return false;
    490490        }
    491        
     491
    492492        psFree(row);
    493493    }
     
    513513    psString query = pxDataGet("flatcorr_dropcamera.sql");
    514514    if (!query) {
    515         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    516         return false;
     515        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     516        return false;
    517517    }
    518518
     
    537537    psString query = pxDataGet("flatcorr_pendingprocess.sql");
    538538    if (!query) {
    539         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    540         return false;
     539        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     540        return false;
    541541    }
    542542
    543543    // treat limit == 0 as "no limit"
    544544    if (limit) {
    545         psString limitString = psDBGenerateLimitSQL(limit);
    546         psStringAppend(&query, " %s", limitString);
    547         psFree(limitString);
     545        psString limitString = psDBGenerateLimitSQL(limit);
     546        psStringAppend(&query, " %s", limitString);
     547        psFree(limitString);
    548548    }
    549549
     
    566566
    567567    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    568         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    569         psFree(output);
    570         return false;
     568        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     569        psFree(output);
     570        return false;
    571571    }
    572572
     
    588588    // treat limit == 0 as "no limit"
    589589    if (limit) {
    590         psString limitString = psDBGenerateLimitSQL(limit);
    591         psStringAppend(&query, " %s", limitString);
    592         psFree(limitString);
     590        psString limitString = psDBGenerateLimitSQL(limit);
     591        psStringAppend(&query, " %s", limitString);
     592        psFree(limitString);
    593593    }
    594594
     
    611611
    612612    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    613         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    614         psFree(output);
    615         return false;
     613        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     614        psFree(output);
     615        return false;
    616616    }
    617617
     
    628628    PXOPT_LOOKUP_BOOL(simple,  config->args, "-simple",  false);
    629629    PXOPT_LOOKUP_BOOL(limit,   config->args, "-limit",   false);
    630    
     630
    631631    psMetadata *where = psMetadataAlloc();
    632632    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipProcessedImfile.chip_id", "==");
     
    647647    // treat limit == 0 as "no limit"
    648648    if (limit) {
    649         psString limitString = psDBGenerateLimitSQL(limit);
    650         psStringAppend(&query, " %s", limitString);
    651         psFree(limitString);
     649        psString limitString = psDBGenerateLimitSQL(limit);
     650        psStringAppend(&query, " %s", limitString);
     651        psFree(limitString);
    652652    }
    653653
     
    670670
    671671    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    672         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    673         psFree(output);
    674         return false;
     672        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     673        psFree(output);
     674        return false;
    675675    }
    676676
     
    685685    PXOPT_LOOKUP_S64(corr_id, config->args, "-corr_id", true, false);
    686686    PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false);
    687     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     687    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    688688
    689689    char *query = "UPDATE flatcorrRun SET state = 'full', hostname = '%s', fault = '%hd' WHERE corr_id = %" PRId64;
    690690
    691     if (!p_psDBRunQueryF(config->dbh, query, hostname, code, corr_id)) {
     691    if (!p_psDBRunQueryF(config->dbh, query, hostname, fault, corr_id)) {
    692692        psError(PS_ERR_UNKNOWN, false, "failed to change state for corr_id %" PRId64, corr_id);
    693693        return false;
     
    721721
    722722    // check that state is a valid string value
    723     if (!strcmp(state, "reg") && 
    724         !strcmp(state, "new") &&
    725         !strcmp(state, "full"))
     723    if (!strcmp(state, "reg") &&
     724        !strcmp(state, "new") &&
     725        !strcmp(state, "full"))
    726726    {
    727727        psError(PS_ERR_UNKNOWN, false, "invalid state: %s", state);
     
    745745    char sqlFilename[80];
    746746  } ExportTable;
    747  
     747
    748748  int numExportTables = 3;
    749749
     
    825825  unsigned int nFail;
    826826  psMetadataItem *item, *entry;
    827  
     827
    828828  int numImportTables = 3;
    829  
     829
    830830  char tables[3] [80] = {"flatcorrRun", "flatcorrCamLink", "flatcorrChipLink"};
    831831
    832832  PS_ASSERT_PTR_NON_NULL(config, NULL);
    833  
     833
    834834  PXOPT_LOOKUP_STR(infile, config->args, "-infile", true,  false);
    835835
     
    843843    psAssert (item, "entry not in input?");
    844844    psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?");
    845    
     845
    846846    entry = psListGet (item->data.list, 0);
    847847    assert (entry);
    848848    assert (entry->type == PS_DATA_METADATA);
    849  
     849
    850850    switch (i) {
    851851      case 0:
     
    857857        // psMetadataPrint (stderr, entry->data.md, 1);
    858858        break;
    859       } 
     859      }
    860860      case 1:
    861861      {
  • trunk/ippTools/src/flatcorrConfig.c

    r23310 r23688  
    106106    psMetadataAddS64 (addprocessArgs, PS_LIST_TAIL, "-corr_id",  0, "add complete run for specified corr_id (required)", 0);
    107107    psMetadataAddStr (addprocessArgs, PS_LIST_TAIL, "-hostname", 0, "set hostname", NULL);
    108     psMetadataAddS16 (addprocessArgs, PS_LIST_TAIL, "-code",     0, "set fault code", 0);
     108    psMetadataAddS16 (addprocessArgs, PS_LIST_TAIL, "-fault",     0, "set fault code", 0);
    109109
    110110    // -updaterun
  • trunk/ippTools/src/magicdstool.c

    r23438 r23688  
    599599
    600600    // default values
    601     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     601    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    602602    PXOPT_LOOKUP_STR(backup_path_base, config->args, "-backup_path_base", false, false);
    603603    PXOPT_LOOKUP_STR(recovery_path_base, config->args, "-recovery_path_base", false, false);
    604604    PXOPT_LOOKUP_BOOL(setmagicked, config->args, "-setmagicked", false);
    605605
    606     if (setmagicked && (code != 0)) {
     606    if (setmagicked && (fault != 0)) {
    607607        psError(PS_ERR_UNKNOWN, true, " cannot setmagicked for faulted file");
    608608        return false;
     
    625625    }
    626626
    627     if (!magicDSFileInsert(config->dbh, magic_ds_id, component, backup_path_base, recovery_path_base, code)) {
     627    if (!magicDSFileInsert(config->dbh, magic_ds_id, component, backup_path_base, recovery_path_base, fault)) {
    628628            // rollback
    629629        if (!psDBRollback(config->dbh)) {
     
    781781    PXOPT_COPY_S64(config->args, where, "-magic_ds_id", "magic_ds_id", "==");
    782782    PXOPT_COPY_STR(config->args, where, "-component", "component", "==");
    783     PXOPT_COPY_S16(config->args, where, "-code", "fault", "==");
     783    PXOPT_COPY_S16(config->args, where, "-fault", "fault", "==");
    784784
    785785    psString query = psStringCopy("DELETE FROM magicDSFile WHERE fault != 0");
  • trunk/ippTools/src/magicdstoolConfig.c

    r23389 r23688  
    9999    psMetadataAddStr(adddestreakedfileArgs, PS_LIST_TAIL, "-recovery_path_base", 0, "define recovery pixels URI", NULL);
    100100    psMetadataAddBool(adddestreakedfileArgs, PS_LIST_TAIL, "-setmagicked", 0, "update the magicked state of the file", false);
    101     psMetadataAddS16(adddestreakedfileArgs, PS_LIST_TAIL, "-code", 0, "set fault code", 0);
     101    psMetadataAddS16(adddestreakedfileArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0);
    102102
    103103    // -revertdestreakedfile
     
    105105    psMetadataAddS64(revertdestreakedfileArgs, PS_LIST_TAIL, "-magic_ds_id", 0, "search by magictool de-streak ID", 0);
    106106    psMetadataAddStr(revertdestreakedfileArgs, PS_LIST_TAIL, "-component", 0, "search by component", NULL);
    107     psMetadataAddS16(revertdestreakedfileArgs, PS_LIST_TAIL, "-code", 0, "search by fault code", 0);
     107    psMetadataAddS16(revertdestreakedfileArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0);
    108108
    109109    // -getskycells
     
    125125    PXOPT_ADD_MODE("-updaterun",           "update state of magic de-streak run",
    126126                    MAGICDSTOOL_MODE_UPDATERUN,         updaterunArgs);
    127     PXOPT_ADD_MODE("-todestreak",          "show pending files",   
     127    PXOPT_ADD_MODE("-todestreak",          "show pending files",
    128128                    MAGICDSTOOL_MODE_TODESTREAK,       todestreakArgs);
    129129    PXOPT_ADD_MODE("-adddestreakedfile",   "add a de-streaked file",
  • trunk/ippTools/src/magictool.c

    r23660 r23688  
    535535
    536536    // default values
    537     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    538 
    539     if (code > 0) {
     537    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     538
     539    if (fault > 0) {
    540540        char *query = "UPDATE magicRun SET fault = %d, state = 'full' WHERE magic_id = %" PRId64;
    541         if (!p_psDBRunQueryF(config->dbh, query, code, magic_id)) {
     541        if (!p_psDBRunQueryF(config->dbh, query, fault, magic_id)) {
    542542            psError(PS_ERR_UNKNOWN, false,
    543543                    "failed to set fault for magic_id %" PRId64, magic_id);
     
    561561    psMetadata *where = psMetadataAlloc();
    562562    PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "==");
    563     PXOPT_COPY_S16(config->args, where, "-code", "fault", "==");
     563    PXOPT_COPY_S16(config->args, where, "-fault", "fault", "==");
    564564
    565565    psString query = psStringCopy("UPDATE magicRun SET fault = 0, state = 'run' WHERE fault != 0");
     
    908908
    909909    // default values
    910     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     910    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    911911
    912912    if (!magicNodeResultInsert(config->dbh,
     
    914914                               node,
    915915                               uri,
    916                                code
     916                               fault
    917917        )) {
    918918        psError(PS_ERR_UNKNOWN, false, "database error");
     
    931931    PXOPT_COPY_STR(config->args, where, "-node", "node", "==");
    932932    PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
    933     PXOPT_COPY_S16(config->args, where, "-code", "magicNodeResult.fault", "==");
     933    PXOPT_COPY_S16(config->args, where, "-fault", "fault", "==");
    934934
    935935    psString query = pxDataGet("magictool_revertnode.sql");
     
    10371037
    10381038    // default values
    1039     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     1039    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    10401040
    10411041    if (!psDBTransaction(config->dbh)) {
     
    10481048                         uri,
    10491049                         streaks,
    1050                          code
     1050                         fault
    10511051        )) {
    10521052        psError(PS_ERR_UNKNOWN, false, "database error");
     
    10941094    psMetadata *where = psMetadataAlloc();
    10951095    PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "==");
    1096     PXOPT_COPY_S16(config->args, where, "-code", "fault", "==");
     1096    PXOPT_COPY_S16(config->args, where, "-fault", "fault", "==");
    10971097
    10981098    if (!psDBTransaction(config->dbh)) {
  • trunk/ippTools/src/magictoolConfig.c

    r23660 r23688  
    100100    psMetadataAddS64(inputtreeArgs, PS_LIST_TAIL, "-magic_id", 0, "define magictool ID (required)", 0);
    101101    psMetadataAddStr(inputtreeArgs, PS_LIST_TAIL, "-dep_file", 0, "order of operations dep. file", NULL);
    102     psMetadataAddS16(inputtreeArgs, PS_LIST_TAIL, "-code", 0, "set fault code", 0);
     102    psMetadataAddS16(inputtreeArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0);
    103103
    104104    // -reverttree
    105105    psMetadata *reverttreeArgs = psMetadataAlloc();
    106106    psMetadataAddS64(reverttreeArgs, PS_LIST_TAIL, "-magic_id", 0, "search by magictool ID", 0);
    107     psMetadataAddS16(reverttreeArgs, PS_LIST_TAIL, "-code", 0, "search by fault code", 0);
     107    psMetadataAddS16(reverttreeArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0);
    108108
    109109    // -inputs
     
    126126    psMetadataAddStr(addresultArgs, PS_LIST_TAIL, "-node", 0, "define symbolic node name (required)", NULL);
    127127    psMetadataAddStr(addresultArgs, PS_LIST_TAIL, "-uri", 0, "define URI", NULL);
    128     psMetadataAddS16(addresultArgs, PS_LIST_TAIL, "-code", 0, "set fault code", 0);
     128    psMetadataAddS16(addresultArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0);
    129129
    130130    // -revertnode
     
    133133    psMetadataAddStr(revertnodeArgs, PS_LIST_TAIL, "-node", 0, "search by node name", NULL);
    134134    psMetadataAddStr(revertnodeArgs, PS_LIST_TAIL, "-label",0, "search by label", NULL);
    135     psMetadataAddS16(revertnodeArgs, PS_LIST_TAIL, "-code", 0, "search by fault code", 0);
     135    psMetadataAddS16(revertnodeArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0);
    136136
    137137    // -tomask
     
    145145    psMetadataAddStr(addmaskArgs, PS_LIST_TAIL, "-uri", 0, "define URI", NULL);
    146146    psMetadataAddS32(addmaskArgs, PS_LIST_TAIL, "-streaks", 0, "define number of streaks", 0);
    147     psMetadataAddS16(addmaskArgs, PS_LIST_TAIL, "-code", 0, "set fault code", 0);
     147    psMetadataAddS16(addmaskArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0);
    148148
    149149    // -revertmask
    150150    psMetadata *revertmaskArgs = psMetadataAlloc();
    151151    psMetadataAddS64(revertmaskArgs, PS_LIST_TAIL, "-magic_id", 0, "search by magictool ID", 0);
    152     psMetadataAddS16(revertmaskArgs, PS_LIST_TAIL, "-code", 0, "search by fault code", 0);
     152    psMetadataAddS16(revertmaskArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0);
    153153
    154154    // -mask
  • trunk/ippTools/src/pztool.c

    r23497 r23688  
    338338        // a lot simplier than a complicated scheme (tried that) to attempt to
    339339        // request on the right number of rows for each camera
    340        
     340
    341341        // treat limit == 0 as "no limit"
    342342        if (limit) {
     
    403403
    404404    // default values
    405     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     405    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    406406
    407407    // start a transaction early so it will contain any row level locks
     
    410410        return false;
    411411    }
    412    
     412
    413413    // query to get an excluse lock on this exposure in
    414414    // pzDownloadExp
     
    421421        PXOPT_COPY_STR(config->args, where,  "-inst", "camera", "==");
    422422        PXOPT_COPY_STR(config->args, where,  "-telescope", "telescope", "==");
    423        
     423
    424424        if (psListLength(where->list)) {
    425425            psString whereClause = psDBGenerateWhereSQL(where, NULL);
     
    455455            class_id,
    456456            uri,
    457             code,
     457            fault,
    458458            NULL,    // epoch
    459459            hostname
     
    605605            psError(PS_ERR_UNKNOWN, false, "database error");
    606606            return false;
    607         } 
     607        }
    608608
    609609        // sanity check: we should have inserted at least one row
     
    675675            // init
    676676            long counter = 0,   // the total number of elements zipped so far
    677             i = 0,              // which array in the set 
     677            i = 0,              // which array in the set
    678678            index = 0;          // the depth into each array
    679679            // test
     
    782782    PXOPT_COPY_STR(config->args, where,  "-class_id", "class_id", "==");
    783783
    784     PXOPT_LOOKUP_S16(code, config->args, "-code", true, false);
    785 
    786     if (!pxSetFaultCode(config->dbh, "pzDownloadImfile", where, code)) {
     784    PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
     785
     786    if (!pxSetFaultCode(config->dbh, "pzDownloadImfile", where, fault)) {
    787787        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    788         psFree (where);
    789         return false;
     788        psFree (where);
     789        return false;
    790790    }
    791791    psFree(where);
  • trunk/ippTools/src/pztoolConfig.c

    r23497 r23688  
    4545    // -adddatastore
    4646    psMetadata *adddatastoreArgs = psMetadataAlloc();
    47     psMetadataAddStr(adddatastoreArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID", NULL); 
    48     psMetadataAddStr(adddatastoreArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID", NULL); 
     47    psMetadataAddStr(adddatastoreArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID", NULL);
     48    psMetadataAddStr(adddatastoreArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID", NULL);
    4949    psMetadataAddStr(adddatastoreArgs, PS_LIST_TAIL, "-uri", 0,            "define storage uri", NULL);
    50    
     50
    5151    // -datastore
    5252    psMetadata *datastoreArgs = psMetadataAlloc();
     
    5555    // -seen
    5656    psMetadata *seenArgs = psMetadataAlloc();
    57     psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID", NULL); 
    58     psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID", NULL); 
    59     psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID", NULL); 
    60     psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_type", 0,            "define exposure type", NULL); 
     57    psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID", NULL);
     58    psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID", NULL);
     59    psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID", NULL);
     60    psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_type", 0,            "define exposure type", NULL);
    6161    psMetadataAddBool(seenArgs, PS_LIST_TAIL, "-simple", 0,            "use the simple output format", false);
    62    
     62
    6363    // -pendingexp
    6464    psMetadata *pendingexpArgs = psMetadataAlloc();
    65     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID", NULL); 
    66     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID", NULL); 
    67     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID", NULL); 
    68     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_type", 0,            "define exposure type", NULL); 
     65    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID", NULL);
     66    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID", NULL);
     67    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID", NULL);
     68    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_type", 0,            "define exposure type", NULL);
    6969    psMetadataAddBool(pendingexpArgs, PS_LIST_TAIL, "-desc", 0,            "sort ouput in descending format", false);
    7070    psMetadataAddU64(pendingexpArgs, PS_LIST_TAIL, "-limit",  0,            "limit result set to N items", 0);
     
    7373    // -pendingimfile
    7474    psMetadata *pendingimfileArgs = psMetadataAlloc();
    75     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID", NULL); 
    76     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID", NULL); 
    77     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID", NULL); 
    78     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_type", 0,            "define exposure type", NULL); 
     75    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID", NULL);
     76    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID", NULL);
     77    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID", NULL);
     78    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_type", 0,            "define exposure type", NULL);
    7979    psMetadataAddBool(pendingimfileArgs, PS_LIST_TAIL, "-desc", 0,            "sort ouput in descending format", false);
    8080    psMetadataAddU64(pendingimfileArgs, PS_LIST_TAIL, "-limit",  0,            "limit result set to N items", 0);
     
    8383    // -copydone
    8484    psMetadata *copydoneArgs = psMetadataAlloc();
    85     psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID (required)", NULL); 
    86     psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID (required)", NULL); 
    87     psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID (required)", NULL); 
     85    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID (required)", NULL);
     86    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID (required)", NULL);
     87    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID (required)", NULL);
    8888    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-class", 0,            "define class", NULL);
    8989    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-class_id", 0,            "define class_id", NULL);
     
    9595    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-label",  0,        "define the label for the chip stage", NULL);
    9696    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-hostname",  0,     "define the host that copied the image", NULL);
    97     psMetadataAddS16(copydoneArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     97    psMetadataAddS16(copydoneArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    9898    psMetadataAddBool(copydoneArgs, PS_LIST_TAIL, "-row_lock", 0,     "lock pzDownImfile rows while advancing an exposure", false);
    9999    // XXX: remove this once advance is fixed
     
    102102    // -copied
    103103    psMetadata *copiedArgs = psMetadataAlloc();
    104     psMetadataAddStr(copiedArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID", NULL); 
    105     psMetadataAddStr(copiedArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID", NULL); 
    106     psMetadataAddStr(copiedArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID", NULL); 
     104    psMetadataAddStr(copiedArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID", NULL);
     105    psMetadataAddStr(copiedArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID", NULL);
     106    psMetadataAddStr(copiedArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID", NULL);
    107107    psMetadataAddStr(copiedArgs, PS_LIST_TAIL, "-class", 0,            "define class", NULL);
    108108    psMetadataAddStr(copiedArgs, PS_LIST_TAIL, "-class_id", 0,            "define class_id", NULL);
     
    113113    // -updatecopied
    114114    psMetadata *updatecopiedArgs = psMetadataAlloc();
    115     psMetadataAddStr(updatecopiedArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID (required)", NULL); 
    116     psMetadataAddStr(updatecopiedArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID (required)", NULL); 
    117     psMetadataAddStr(updatecopiedArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID (required)", NULL); 
     115    psMetadataAddStr(updatecopiedArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID (required)", NULL);
     116    psMetadataAddStr(updatecopiedArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID (required)", NULL);
     117    psMetadataAddStr(updatecopiedArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID (required)", NULL);
    118118    psMetadataAddStr(updatecopiedArgs, PS_LIST_TAIL, "-class", 0,            "define class", NULL);
    119119    psMetadataAddStr(updatecopiedArgs, PS_LIST_TAIL, "-class_id", 0,            "define class_id", NULL);
    120     psMetadataAddS16(updatecopiedArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     120    psMetadataAddS16(updatecopiedArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    121121
    122122    // -revertcopied
    123123    psMetadata *revertcopiedArgs = psMetadataAlloc();
    124     psMetadataAddStr(revertcopiedArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID (required)", NULL); 
    125     psMetadataAddStr(revertcopiedArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID (required)", NULL); 
    126     psMetadataAddStr(revertcopiedArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID (required)", NULL); 
     124    psMetadataAddStr(revertcopiedArgs, PS_LIST_TAIL, "-exp_name", 0,            "define exposure ID (required)", NULL);
     125    psMetadataAddStr(revertcopiedArgs, PS_LIST_TAIL, "-inst", 0,            "define camera ID (required)", NULL);
     126    psMetadataAddStr(revertcopiedArgs, PS_LIST_TAIL, "-telescope", 0,            "define telescope ID (required)", NULL);
    127127    psMetadataAddStr(revertcopiedArgs, PS_LIST_TAIL, "-class", 0,            "define class", NULL);
    128128    psMetadataAddStr(revertcopiedArgs, PS_LIST_TAIL, "-class_id", 0,            "define class_id", NULL);
    129     psMetadataAddS16(revertcopiedArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     129    psMetadataAddS16(revertcopiedArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    130130
    131131    // -clearcommonfaults
     
    134134    // -toadvance
    135135    psMetadata *toadvanceArgs = psMetadataAlloc();
    136     psMetadataAddStr(toadvanceArgs, PS_LIST_TAIL, "-exp_name", 0,      "define exposure ID", NULL); 
    137     psMetadataAddStr(toadvanceArgs, PS_LIST_TAIL, "-inst", 0,          "define camera ID", NULL); 
    138     psMetadataAddStr(toadvanceArgs, PS_LIST_TAIL, "-telescope", 0,     "define telescope ID", NULL); 
     136    psMetadataAddStr(toadvanceArgs, PS_LIST_TAIL, "-exp_name", 0,      "define exposure ID", NULL);
     137    psMetadataAddStr(toadvanceArgs, PS_LIST_TAIL, "-inst", 0,          "define camera ID", NULL);
     138    psMetadataAddStr(toadvanceArgs, PS_LIST_TAIL, "-telescope", 0,     "define telescope ID", NULL);
    139139    psMetadataAddStr(toadvanceArgs, PS_LIST_TAIL, "-label",  0,        "define the label for the chip stage", NULL);
    140140    psMetadataAddBool(toadvanceArgs, PS_LIST_TAIL, "-simple",  0,      "use the simple output format", false);
     
    143143    // -advance
    144144    psMetadata *advanceArgs = psMetadataAlloc();
    145     psMetadataAddStr(advanceArgs, PS_LIST_TAIL, "-exp_name", 0,   "define exposure ID (required)", NULL); 
    146     psMetadataAddStr(advanceArgs, PS_LIST_TAIL, "-inst", 0,       "define camera ID (required)", NULL); 
    147     psMetadataAddStr(advanceArgs, PS_LIST_TAIL, "-telescope", 0,  "define telescope ID (required)", NULL); 
     145    psMetadataAddStr(advanceArgs, PS_LIST_TAIL, "-exp_name", 0,   "define exposure ID (required)", NULL);
     146    psMetadataAddStr(advanceArgs, PS_LIST_TAIL, "-inst", 0,       "define camera ID (required)", NULL);
     147    psMetadataAddStr(advanceArgs, PS_LIST_TAIL, "-telescope", 0,  "define telescope ID (required)", NULL);
    148148    psMetadataAddStr(advanceArgs, PS_LIST_TAIL, "-workdir",  0,   "define the \"default\" workdir for this exposure (required)", NULL);
    149149    psMetadataAddStr(advanceArgs, PS_LIST_TAIL, "-dvodb",  0,     "define the dvodb for the next processing step", NULL);
  • trunk/ippTools/src/regtool.c

    r23544 r23688  
    238238    PXOPT_LOOKUP_TIME(dateobs, config->args, "-dateobs", false, false);
    239239    PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false);
    240     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     240
     241    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     242    PXOPT_LOOKUP_S16(quality, config->args, "-quality", false, false);
    241243
    242244    if (!rawImfileInsert(
     
    302304        ignored,
    303305        hostname,
    304         code,
     306        fault,
     307        quality,
    305308        NULL,
    306309        0
     
    408411    PXOPT_COPY_STR(config->args, where,  "-tmp_class_id", "tmp_class_id", "==");
    409412    PXOPT_COPY_STR(config->args, where,  "-class_id",     "class_id", "==");
    410     PXOPT_COPY_S16(config->args, where,  "-code",         "fault", "==");
     413    PXOPT_COPY_S16(config->args, where,  "-fault",         "fault", "==");
    411414    PXOPT_COPY_S64(config->args, where,  "-exp_id_begin", "exp_id", ">=");
    412415    PXOPT_COPY_S64(config->args, where,  "-exp_id_end", "exp_id", "<=");
     
    452455    PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);
    453456
    454     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     457    PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
    455458    PXOPT_LOOKUP_F64(user_1, config->args, "-user_1", false, false);
    456459
    457     if ((code == INT16_MAX) && !isfinite(user_1)) {
    458         psError(PS_ERR_UNKNOWN, false, "one of -code or -user_1 must be selected");
    459         return false;
    460     }
    461     if ((code != INT16_MAX) && isfinite(user_1)) {
    462         psError(PS_ERR_UNKNOWN, false, "only one of -code or -user_1 must be selected");
     460    if ((fault == INT16_MAX) && !isfinite(user_1)) {
     461        psError(PS_ERR_UNKNOWN, false, "one of -fault or -user_1 must be selected");
     462        return false;
     463    }
     464    if ((fault != INT16_MAX) && isfinite(user_1)) {
     465        psError(PS_ERR_UNKNOWN, false, "only one of -fault or -user_1 must be selected");
    463466        return false;
    464467    }
     
    468471    PXOPT_COPY_STR(config->args, where,  "-class_id",     "class_id", "==");
    469472
    470     if (code != INT16_MAX) {
     473    if (fault != INT16_MAX) {
    471474        // this is fairly dangerous : can set all if the where is not set...
    472         if (!pxSetFaultCode(config->dbh, "rawImfile", where, code)) {
     475        if (!pxSetFaultCode(config->dbh, "rawImfile", where, fault)) {
    473476            psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    474477            psFree (where);
     
    644647
    645648    // default
    646     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     649    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    647650
    648651    psString query = pxDataGet("regtool_pendingexp.sql");
     
    801804        moon_phase,
    802805        hostname,
    803         code,
     806        fault,
    804807        NULL,
    805808        0
     
    995998    psMetadata *where = psMetadataAlloc();
    996999    PXOPT_COPY_S64(config->args, where,  "-exp_id",       "exp_id", "==");
    997     PXOPT_COPY_S16(config->args, where,  "-code",         "fault", "==");
     1000    PXOPT_COPY_S16(config->args, where,  "-fault",         "fault", "==");
    9981001    PXOPT_COPY_S64(config->args, where,  "-exp_id_begin", "exp_id", ">=");
    9991002    PXOPT_COPY_S64(config->args, where,  "-exp_id_end", "exp_id", "<=");
     
    10391042    PXOPT_COPY_S64(config->args, where,  "-exp_id",       "exp_id", "==");
    10401043
    1041     PXOPT_LOOKUP_S16(code, config->args, "-code", true, false);
    1042 
    1043     if (!pxSetFaultCode(config->dbh, "rawExp", where, code)) {
     1044    PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
     1045
     1046    if (!pxSetFaultCode(config->dbh, "rawExp", where, fault)) {
    10441047        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    10451048        psFree(where);
     
    11611164    char sqlFilename[80];
    11621165  } ExportTable;
    1163  
     1166
    11641167  int numExportTables = 2;
    11651168
     
    12411244
    12421245  PS_ASSERT_PTR_NON_NULL(config, NULL);
    1243  
     1246
    12441247  PXOPT_LOOKUP_STR(infile, config->args, "-infile", true,  false);
    12451248
     
    12521255  psAssert (item, "entry not in input?");
    12531256  psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?");
    1254  
     1257
    12551258  psMetadataItem *entry = psListGet (item->data.list, 0);
    12561259  assert (entry);
  • trunk/ippTools/src/regtoolConfig.c

    r23545 r23688  
    122122    ADD_OPT(Time, addprocessedimfileArgs, "-dateobs",        "define observation time",         NULL);
    123123    ADD_OPT(Str,  addprocessedimfileArgs, "-hostname",       "define host name",                NULL);
    124     ADD_OPT(S16,  addprocessedimfileArgs, "-code",           "set fault code",                  0);
     124    ADD_OPT(S16,  addprocessedimfileArgs, "-fault",           "set fault code",                  0);
     125    ADD_OPT(S16,  addprocessedimfileArgs, "-quality",        "set quality flag", 0);
    125126
    126127    // -processedimfile
     
    140141    ADD_OPT(Str, revertprocessedimfileArgs, "-tmp_class_id",  "searcy by temp. class ID", NULL);
    141142    ADD_OPT(Str, revertprocessedimfileArgs, "-class_id",      "search by class ID", NULL);
    142     ADD_OPT(S16, revertprocessedimfileArgs, "-code",          "search by fault code", 0);
     143    ADD_OPT(S16, revertprocessedimfileArgs, "-fault",          "search by fault code", 0);
    143144    ADD_OPT(S64, revertprocessedimfileArgs, "-exp_id_begin",  "search by exposure ID", 0);
    144145    ADD_OPT(S64, revertprocessedimfileArgs, "-exp_id_end",    "search by exposure ID", 0);
     
    149150    ADD_OPT(Str, updateprocessedimfileArgs, "-class_id",      "search by class ID", NULL);
    150151    ADD_OPT(F64, updateprocessedimfileArgs, "-user_1",        "set user stat (1)", NAN);
    151     ADD_OPT(S16, updateprocessedimfileArgs, "-code",          "set fault code", INT16_MAX);
     152    ADD_OPT(S16, updateprocessedimfileArgs, "-fault",          "set fault code (required)", INT16_MAX);
    152153
    153154    // -pendingexp
     
    226227    ADD_OPT(Str,  addprocessedexpArgs, "-label",            "define label for chip stage (non-detrend data only)", NULL);
    227228    ADD_OPT(Str,  addprocessedexpArgs, "-hostname",         "define host name", NULL);
    228     ADD_OPT(S16,  addprocessedexpArgs, "-code",             "set fault code", 0);
     229    ADD_OPT(S16,  addprocessedexpArgs, "-fault",             "set fault code", 0);
    229230
    230231    // -processedexp
     
    276277    psMetadata *revertprocessedexpArgs = psMetadataAlloc();
    277278    psMetadataAddS64(revertprocessedexpArgs, PS_LIST_TAIL, "-exp_id",   0,            "search by exposure ID", 0);
    278     psMetadataAddS16(revertprocessedexpArgs, PS_LIST_TAIL, "-code",     0,            "search by fault code", 0);
     279    psMetadataAddS16(revertprocessedexpArgs, PS_LIST_TAIL, "-fault",     0,            "search by fault code", 0);
    279280    psMetadataAddS64(revertprocessedexpArgs, PS_LIST_TAIL, "-exp_id_begin",   0,      "search by exposure ID", 0);
    280281    psMetadataAddS64(revertprocessedexpArgs, PS_LIST_TAIL, "-exp_id_end",   0,      "search by exposure ID", 0);
     
    283284    psMetadata *updatedprocessedexpArgs = psMetadataAlloc();
    284285    psMetadataAddS64(updatedprocessedexpArgs, PS_LIST_TAIL, "-exp_id",  0,            "search by exposure ID", 0);
    285     psMetadataAddS16(updatedprocessedexpArgs, PS_LIST_TAIL, "-code",    0,            "set fault code (required)", INT16_MAX);
     286    psMetadataAddS16(updatedprocessedexpArgs, PS_LIST_TAIL, "-fault",    0,            "set fault code (required)", INT16_MAX);
    286287
    287288    // -exportrun
  • trunk/ippTools/src/stacktool.c

    r23310 r23688  
    718718
    719719    // default values
    720     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     720    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     721    PXOPT_LOOKUP_S16(quality, config->args, "-quality", false, false);
    721722
    722723    if (!psDBTransaction(config->dbh)) {
     
    754755                               hostname,
    755756                               good_frac,
    756                                code
     757                               fault,
     758                               quality
    757759          )) {
    758760        if (!psDBRollback(config->dbh)) {
     
    862864    PXOPT_COPY_S64(config->args, where, "-stack_id", "stackSumSkyfile.stack_id", "==");
    863865    PXOPT_COPY_STR(config->args, where, "-label", "stackRun.label", "==");
    864     PXOPT_COPY_S16(config->args, where, "-code", "stackSumSkyfile.fault", "==");
     866    PXOPT_COPY_S16(config->args, where, "-fault", "stackSumSkyfile.fault", "==");
    865867
    866868    if (!psDBTransaction(config->dbh)) {
     
    11691171    PS_ASSERT_PTR_NON_NULL(config, false);
    11701172
    1171     PXOPT_LOOKUP_S16(code, config->args, "-code", true, false);
     1173    PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false);
    11721174
    11731175    psMetadata *where = psMetadataAlloc();
    11741176    PXOPT_COPY_S64(config->args, where, "-stack_id",   "stack_id",   "==");
    11751177
    1176     if (!pxSetFaultCode(config->dbh, "stackSumSkyfile", where, code)) {
     1178    if (!pxSetFaultCode(config->dbh, "stackSumSkyfile", where, fault)) {
    11771179        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    11781180        psFree (where);
     
    11921194
    11931195  int numExportTables = 3;
    1194  
     1196
    11951197  PS_ASSERT_PTR_NON_NULL(config, NULL);
    11961198
     
    12621264{
    12631265  unsigned int nFail;
    1264  
     1266
    12651267  int numImportTables = 2;
    1266  
     1268
    12671269  char tables[2] [80] = {"stackInputSkyfile", "stackSumSkyfile"};
    12681270
    12691271  PS_ASSERT_PTR_NON_NULL(config, NULL);
    1270  
     1272
    12711273  PXOPT_LOOKUP_STR(infile, config->args, "-infile", true,  false);
    12721274
     
    12931295    psAssert (item, "entry not in input?");
    12941296    psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?");
    1295  
     1297
    12961298    switch (i) {
    12971299      case 0:
     
    13071309        }
    13081310        break;
    1309        
     1311
    13101312      case 1:
    13111313        for (int i = 0; i < item->data.list->n; i++) {
     
    13221324    }
    13231325  }
    1324  
     1326
    13251327  return true;
    13261328}
  • trunk/ippTools/src/stacktoolConfig.c

    r23310 r23688  
    147147    psMetadataAddStr(addsumskyfileArgs, PS_LIST_TAIL, "-hostname", 0,            "define hostname", 0);
    148148    psMetadataAddF32(addsumskyfileArgs, PS_LIST_TAIL, "-good_frac",  0,            "define %% of good pixels", NAN);
    149     psMetadataAddS16(addsumskyfileArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     149    psMetadataAddS16(addsumskyfileArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
     150    psMetadataAddS16(addsumskyfileArgs, PS_LIST_TAIL, "-quality",  0,            "set quality", 0);
    150151
    151152    // -sumskyfile
     
    162163    psMetadataAddS64(revertsumskyfileArgs, PS_LIST_TAIL, "-stack_id", 0,            "search by stack ID", 0);
    163164    psMetadataAddStr(revertsumskyfileArgs, PS_LIST_TAIL, "-label", 0, "search by label", 0);
    164     psMetadataAddS16(revertsumskyfileArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     165    psMetadataAddS16(revertsumskyfileArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    165166
    166167    // -pendingcleanuprun
     
    185186    psMetadata *updatesumskyfileArgs = psMetadataAlloc();
    186187    psMetadataAddS64(updatesumskyfileArgs, PS_LIST_TAIL, "-stack_id", 0,            "define stack ID (required)", 0);
    187     psMetadataAddS16(updatesumskyfileArgs, PS_LIST_TAIL, "-code", 0,            "set fault code (required)", 0);
     188    psMetadataAddS16(updatesumskyfileArgs, PS_LIST_TAIL, "-fault", 0,            "set fault code (required)", 0);
    188189
    189190    // -exportrun
  • trunk/ippTools/src/warptool.c

    r23613 r23688  
    609609    PXOPT_LOOKUP_STR(mapfile, config->args, "-mapfile", false, false);
    610610    PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", false, false);
    611     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     611    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    612612
    613613    if (!psDBTransaction(config->dbh)) {
     
    616616    }
    617617
    618     if (code == 0) {
     618    if (fault == 0) {
    619619        if (!parseAndInsertSkyCellMap(config, mapfile)) {
    620620            psError(PS_ERR_UNKNOWN, false, "failed to inject mapfile: %s into the database", mapfile);
     
    631631            NULL,   // tess_id
    632632            NULL,   // class_id
    633             code    // fault
     633            fault    // fault
    634634        );
    635635    }
     
    896896    PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false);
    897897    PXOPT_LOOKUP_F32(good_frac, config->args, "-good_frac", false, false);
    898     PXOPT_LOOKUP_BOOL(accept, config->args, "-accept", false);
    899898    PXOPT_LOOKUP_BOOL(magicked, config->args, "-magicked", false);
    900899
    901900    // default values
    902     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     901    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     902    PXOPT_LOOKUP_S16(quality, config->args, "-quality", false, false);
    903903
    904904    // we don't want to insert the last skyfile in a run but then not mark the
     
    927927                           ymin,
    928928                           ymax,
    929                            !accept,
    930                            code,
     929                           fault,
     930                           quality,
    931931                           magicked
    932932        )) {
     
    11121112    PXOPT_COPY_STR(config->args, where, "-reduction",  "rawExp.reduction", "==");
    11131113    PXOPT_COPY_STR(config->args, where, "-label",      "warpRun.label", "==");
    1114     PXOPT_COPY_S16(config->args, where, "-code",       "warpSkyfile.fault", "==");
     1114    PXOPT_COPY_S16(config->args, where, "-fault",       "warpSkyfile.fault", "==");
    11151115
    11161116    if (!psListLength(where->list)
     
    15601560    PS_ASSERT_PTR_NON_NULL(config, false);
    15611561
    1562     // warp_id, skycell_id, code are required
     1562    // warp_id, skycell_id, fault are required
    15631563    PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", true, false);
    15641564    PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false);
    1565     PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     1565    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    15661566
    15671567    psString query = pxDataGet("warptool_updateskyfile.sql");
    15681568
    1569     if (!p_psDBRunQueryF(config->dbh, query, code, warp_id, skycell_id)) {
     1569    if (!p_psDBRunQueryF(config->dbh, query, fault, warp_id, skycell_id)) {
    15701570        psError(PS_ERR_UNKNOWN, false, "database error");
    15711571        return false;
  • trunk/ippTools/src/warptoolConfig.c

    r23613 r23688  
    155155    psMetadataAddStr(addoverlapArgs, PS_LIST_TAIL, "-mapfile", 0,            "path to skycell <-> imfile mapping file", NULL);
    156156    psMetadataAddS64(addoverlapArgs, PS_LIST_TAIL, "-warp_id",  0,            "set warp ID", 0);
    157     psMetadataAddS16(addoverlapArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     157    psMetadataAddS16(addoverlapArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    158158
    159159    // -scmap
     
    190190    psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-hostname", 0,            "define hostname", 0);
    191191    psMetadataAddF32(addwarpedArgs, PS_LIST_TAIL, "-good_frac",  0,            "define %% of good pixels", NAN);
    192     psMetadataAddBool(addwarpedArgs, PS_LIST_TAIL, "-accept",  0, "define if this skycell should be accepted", false);
    193192    psMetadataAddBool(addwarpedArgs, PS_LIST_TAIL, "-magicked",  0, "define if this skycell has been magicked", false);
    194     psMetadataAddS16(addwarpedArgs, PS_LIST_TAIL, "-code",  0,            "set fault code", 0);
     193    psMetadataAddS16(addwarpedArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
     194    psMetadataAddS16(addwarpedArgs, PS_LIST_TAIL, "-quality",  0,            "set quality", 0);
    195195
    196196    // -warped
     
    216216    psMetadataAddStr(revertwarpedArgs, PS_LIST_TAIL, "-reduction",  0,            "search by warpRun reduction class", NULL);
    217217    psMetadataAddStr(revertwarpedArgs, PS_LIST_TAIL, "-label",  0,            "search by warpRun label", NULL);
    218     psMetadataAddS16(revertwarpedArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
     218    psMetadataAddS16(revertwarpedArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
    219219    psMetadataAddBool(revertwarpedArgs, PS_LIST_TAIL, "-all",  0,            "allow everything to be queued without search terms", false);
    220220
     
    269269    psMetadataAddS64(updateskyfileArgs, PS_LIST_TAIL, "-warp_id", 0,    "warptool ID to update", 0);
    270270    psMetadataAddStr(updateskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "skycell ID to update", NULL);
    271     psMetadataAddS16(updateskyfileArgs, PS_LIST_TAIL, "-code",  0,      "new fault code", 0);
     271    psMetadataAddS16(updateskyfileArgs, PS_LIST_TAIL, "-fault",  0,      "new fault code", 0);
    272272
    273273    // -exportrun
  • trunk/ippconfig/recipes/ppStatsFromMetadata.config

    r20302 r23688  
    5050  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_STDEV      -bg_mean_stdev     
    5151  ENTRY  VAL  ROBUST_STDEV        F32  RMS               -bg_stdev           
     52  ENTRY  VAL  QUALITY             S32  CONSTANT          -quality             # Bad quality flag
    5253END
    5354
     
    168169  ENTRY  VAL  IQ_M2S_L            F32  SAMPLE_MEAN      -iq_m2s_lq           
    169170  ENTRY  VAL  IQ_M2S_U            F32  SAMPLE_MEAN      -iq_m2s_uq           
     171  ENTRY  VAL  QUALITY             S32  CONSTANT          -quality             # Bad quality flag
    170172END
    171173
     
    225227  ENTRY  VAL  iq_m2s              F32  UQ               -iq_m2s_uq           
    226228  ENTRY  VAL  iq_m2s              F32  LQ               -iq_m2s_lq           
     229
     230  ENTRY  VAL  QUALITY             S32  CONSTANT          -quality             # Bad quality flag
    227231END
    228232
     
    253257  ENTRY  VAL  RANGE.YMAX          S32  CONSTANT          -ymax         
    254258  ENTRY  VAL  ACCEPT              BOOL CONSTANT          -accept
     259  ENTRY  VAL  QUALITY             S32  CONSTANT          -quality             # Bad quality flag
    255260END
    256261
     
    279284  ENTRY  VAL  NUM_SOURCES         S32  SUM               -sources                       
    280285  ENTRY  VAL  GOOD_PIXEL_FRAC     F32  MEAN              -good_frac                     
     286  ENTRY  VAL  QUALITY             S32  CONSTANT          -quality             # Bad quality flag
    281287END
    282288
     
    301307  ENTRY  VAL  NUM_SOURCES           S32  SUM               -sources       
    302308  ENTRY  VAL  GOOD_PIXEL_FRAC       F32  MEAN              -good_frac     
     309  ENTRY  VAL  QUALITY               S32  CONSTANT          -quality             # Bad quality flag
    303310END
    304311
  • trunk/ppImage

  • trunk/ppImage/src/ppImage.h

    r23411 r23688  
    4040    bool doAstromMosaic;                // full-mosaic Astrometry
    4141    bool doStats;                       // call ppStats on the image
    42     bool checkCTE;                      // measure pixel-based variance
     42    bool checkCTE;                      // measure pixel-based variance
    4343
    4444    // output files requested
     
    8888    float remnanceThresh;               // Threshold for remnance detection
    8989
    90     char *normClass;                    // class to use for per-class normalization
     90    char *normClass;                    // class to use for per-class normalization
    9191} ppImageOptions;
    9292
     
    146146bool ppImageRebinChip (pmConfig *config, pmFPAview *view, ppImageOptions *options, char *outName);
    147147
    148 bool ppImagePhotom (pmConfig *config, pmFPAview *view);
    149 bool ppImageAstrom (pmConfig *config);
    150 bool ppImageAddstar (pmConfig *config);
     148bool ppImagePhotom(psMetadata *stats, pmConfig *config, pmFPAview *view);
     149bool ppImageAstrom(pmConfig *config, psMetadata *stats);
     150bool ppImageAddstar(pmConfig *config);
    151151
    152152// Subtract background from the chip-mosaicked image
  • trunk/ppImage/src/ppImageAstrom.c

    r16084 r23688  
    77// this function is mostly equivalent to the top-level of psastro, with some
    88// modifications since the data has already been loaded.
    9 bool ppImageAstrom (pmConfig *config) {
     9bool ppImageAstrom (pmConfig *config, psMetadata *stats) {
    1010
    1111    bool status;
     
    2727    }
    2828
    29     if (!psastroAnalysis (config)) {
     29    if (!psastroAnalysis(config, stats)) {
    3030        psError (PSASTRO_ERR_UNKNOWN, false, "failure in psastro analysis\n");
    3131        return false;
  • trunk/ppImage/src/ppImageLoop.c

    r23411 r23688  
    1313bool ppImageLoop(pmConfig *config, ppImageOptions *options)
    1414{
    15     psMetadata *stats = options->doStats ? psMetadataAlloc() : NULL; // Statistics to output
     15    psMetadata *stats = NULL;          // Statistics to output
    1616    float timeDetrend = 0;              // Amount of time spent in detrend
    1717    float timePhot = 0;                 // Amount of time spent in photometry
     18
     19    if (options->doStats) {
     20        stats = psMetadataAlloc();
     21        psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0);
     22    }
    1823
    1924    bool status;                        // Status of MD lookup
     
    139144        psTimerStart(TIMER_PHOT);
    140145        if (options->doPhotom) {
    141             if (!ppImagePhotom(config, view)) {
     146            if (!ppImagePhotom(stats, config, view)) {
    142147                ESCAPE("error running photometry.");
    143148            }
     
    200205    // this also performs the psastro file IO
    201206    if (options->doAstromChip || options->doAstromMosaic) {
    202         if (!ppImageAstrom(config)) {
     207        if (!ppImageAstrom(config, stats)) {
    203208            ESCAPE("error running astrometry.");
    204209        }
  • trunk/ppImage/src/ppImagePhotom.c

    r20410 r23688  
    66
    77// In this function, we perform the psphot analysis routine for the chip-mosaicked images
    8 bool ppImagePhotom (pmConfig *config, pmFPAview *view) {
     8bool ppImagePhotom(psMetadata *stats, pmConfig *config, pmFPAview *view) {
    99
    1010    bool status;
     
    1212    pmReadout *readout;
    1313
    14     psphotInit ();
     14    psphotInit();
    1515
    1616    // find or define a pmFPAfile PSPHOT.INPUT
     
    3737            // run the actual photometry analysis
    3838            if (!psphotReadout (config, view)) {
    39                 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);
    40                 return false;
     39                // This is likely a data quality issue
     40                // XXX Split into multiple cases using error codes?
     41                psErrorStackPrint(stderr, "Unable to perform photometry on image");
     42                psWarning("Unable to perform photometry on image --- suspect bad data quality.");
     43                if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) {
     44                    psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     45                                     "Unable to perform photometry on image", psErrorCodeLast());
     46                }
     47                psErrorClear();
     48                psphotFilesActivate(config, false);
    4149            }
    4250
    43             // we want to save the MASK as modified by psphot, but not the data or weight
    44             // free the old mask and replace with a memory copy of the new mask
    45             pmReadout *oldReadout = pmFPAviewThisReadout (view, input->src);
    46             pmReadout *newReadout = pmFPAviewThisReadout (view, input->fpa);
    47             psFree (oldReadout->mask);
    48             oldReadout->mask = psMemIncrRefCounter (newReadout->mask);
     51            // we want to save the MASK as modified by psphot, but not the data or weight
     52            // free the old mask and replace with a memory copy of the new mask
     53            pmReadout *oldReadout = pmFPAviewThisReadout(view, input->src);
     54            pmReadout *newReadout = pmFPAviewThisReadout(view, input->fpa);
     55            psFree (oldReadout->mask);
     56            oldReadout->mask = psMemIncrRefCounter(newReadout->mask);
    4957        }
    5058    }
  • trunk/ppStack

  • trunk/ppStack/src/ppStackPhotometry.c

    r23462 r23688  
    6969
    7070    if (!psphotReadoutKnownSources(config, photView, inSources)) {
    71         // Clear the error, so that the output files are written.
    72         psError(PS_ERR_UNKNOWN, false, "Unable to perform photometry on stacked image.");
    73         psFree(photView);
    74         return false;
     71        // This is likely a data quality issue
     72        // XXX Split into multiple cases using error codes?
     73        psErrorStackPrint(stderr, "Unable to perform photometry on image");
     74        psWarning("Unable to perform photometry on image --- suspect bad data quality.");
     75        if (options->stats && psMetadataLookupS32(NULL, options->stats, "QUALITY") == 0) {
     76            psMetadataAddS32(options->stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     77                             "Unable to perform photometry on image", psErrorCodeLast());
     78        }
     79        psErrorClear();
     80        psphotFilesActivate(config, false);
    7581    }
    7682
  • trunk/ppStack/src/ppStackSetup.c

    r23602 r23688  
    4343        psFree(resolved);
    4444        options->stats = psMetadataAlloc();
     45        psMetadataAddS32(options->stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0);
    4546    }
    4647
  • trunk/ppSub

  • trunk/ppSub/src/Makefile.am

    r23229 r23688  
    1919        ppSubBackground.c        \
    2020        ppSubCamera.c            \
     21        ppSubData.c              \
    2122        ppSubLoop.c              \
    2223        ppSubReadout.c           \
  • trunk/ppSub/src/ppSub.h

    r23195 r23688  
    2222#define PPSUB_RECIPE "PPSUB"            /// Name of the recipe to use
    2323
     24// Output files, for activation/deactivation
     25typedef enum {
     26    PPSUB_FILES_IMAGE = 0x01,           // Image files
     27    PPSUB_FILES_PHOT  = 0x02,           // Photometry files
     28    PPSUB_FILES_ALL   = 0xFF,           // All files
     29} ppSubFiles;
     30
     31/// Data for processing
     32typedef struct {
     33    psErrorCode quality;                /// Quality code; 0 for no problem
     34    psMetadata *stats;                  /// Statistics
     35} ppSubData;
     36
     37/// Constructor
     38ppSubData *ppSubDataAlloc(void);
     39
    2440/// Setup the arguments parsing
    2541bool ppSubArgumentsSetup(int argc, char *argv[], ///< Command-line arguments
     
    4157/// Perform PSF-matched image subtraction on the readout
    4258bool ppSubReadout(pmConfig *config,     ///< Configuration
    43                   psMetadata *stats,    ///< Statistics, for output
     59                  ppSubData *data,      ///< Processing data
    4460                  const pmFPAview *view ///< View of readout to subtract
    4561    );
     
    5369/// looking up the parameters in the recipe and supplying them to the function pmSubtractionMatch()
    5470bool ppSubMatchPSFs(pmConfig *config,    ///< Configuration
     71                    ppSubData *data,    ///< Processing data
    5572                    const pmFPAview *view ///< View of active readout
    5673    );
     
    6380/// Photometry stage 1: measure the PSF from the minuend image
    6481bool ppSubMakePSF(pmConfig *config,       ///< Configuration
     82                  ppSubData *data,    ///< Processing data
    6583                  const pmFPAview *view ///< View of active readout
    6684    );
     
    7492/// Photometry stage 2: find and measure sources on the subtracted image
    7593bool ppSubReadoutPhotometry(pmConfig *config,     ///< Configuration
    76                             psMetadata *stats,    ///< Statistics, for output
     94                            ppSubData *data,    ///< Processing data
    7795                            const pmFPAview *view ///< View of active readout
    7896    );
     
    8098/// Renormalize, update headers and generate JPEGs
    8199bool ppSubReadoutUpdate(pmConfig *config, ///< Configuration
    82                         psMetadata *stats, ///< Statistics for output, or NULL
     100                        ppSubData *data,    ///< Processing data
    83101                        const pmFPAview *view ///< View of active readout
    84102    );
     
    96114void ppSubVersionPrint(void);
    97115
     116/// Mark the data quality as bad and prepare to suspend processing
     117void ppSubDataQuality(pmConfig *config, ///< Configuration
     118                      ppSubData *data,  ///< Processing data
     119                      psErrorCode error,///< Error code
     120                      ppSubFiles files  ///< Files to deactivate
     121    );
    98122
    99123// Copy every instance of a single keyword from one metadata to another
  • trunk/ppSub/src/ppSubCamera.c

    r23449 r23688  
    285285    return true;
    286286}
     287
     288
  • trunk/ppSub/src/ppSubLoop.c

    r23315 r23688  
    2828    pmConfigRecipesCull(config, "PPSUB,PPSTATS,PSPHOT,MASKS,JPEG");
    2929
     30    ppSubData *data = ppSubDataAlloc(); // Processing data
     31
    3032    bool mdok;                          // Status of MD lookup
    3133    const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // Filename for statistics
    32     psMetadata *stats = NULL;           // Container for statistics
    3334    FILE *statsFile = NULL;             // File stream for statistics
    3435    if (statsName && strlen(statsName) > 0) {
     
    3839            psError(PS_ERR_IO, true, "Unable to open statistics file %s for writing.\n", resolved);
    3940            psFree(resolved);
    40             return false;
    41         } else {
    42             stats = psMetadataAlloc();
     41            goto ERROR;
    4342        }
    4443        psFree(resolved);
     
    4847    if (!input) {
    4948        psError(PS_ERR_UNEXPECTED_NULL, false, "Can't find input data!\n");
    50         return false;
     49        goto ERROR;
    5150    }
    5251
     
    5453    if (!reference) {
    5554        psError(PS_ERR_UNEXPECTED_NULL, false, "Can't find reference data!\n");
    56         return false;
     55        goto ERROR;
    5756    }
    5857
     
    6059    if (!output) {
    6160        psError(PS_ERR_UNEXPECTED_NULL, false, "Can't find output data!\n");
    62         return false;
     61        goto ERROR;
    6362    }
    6463
     
    6766    // Iterate over the FPA hierarchy
    6867    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    69         return false;
     68        goto ERROR;
    7069    }
    7170
     
    7776            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "FPA format discrepency between input and reference");
    7877            psFree(view);
    79             return false;
     78            goto ERROR;
    8079        }
    8180
     
    8584
    8685        if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    87             return false;
     86            goto ERROR;
    8887        }
    8988
     
    9695                        "FPA format discrepency between input and reference");
    9796                psFree(view);
    98                 return false;
     97                goto ERROR;
    9998            }
    10099            if (!inCell->file_exists) {
     
    102101            }
    103102            if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    104                 return false;
     103                goto ERROR;
    105104            }
    106105
     
    108107            while ((inRO = pmFPAviewNextReadout(view, input->fpa, 1))) {
    109108                if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    110                     return false;
     109                    goto ERROR;
    111110                }
    112111                pmReadout *refRO = pmFPAviewThisReadout(view, reference->fpa);// Reference readout of interest
     
    116115                            "FPA format discrepency between input and reference");
    117116                    psFree(view);
    118                     return false;
     117                    goto ERROR;
    119118                }
    120119                if (!inRO->data_exists) {
     
    123122
    124123                // Perform the analysis
    125                 if (!ppSubReadout(config, stats, view)) {
     124                if (!ppSubReadout(config, data, view)) {
    126125                    psError(PS_ERR_UNKNOWN, false, "Unable to subtract images.\n");
    127                     return false;
     126                    goto ERROR;
    128127                }
    129128
    130129                if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    131                     return false;
     130                    goto ERROR;
    132131                }
    133132            }
    134133
    135134            // Perform statistics on the cell
    136             if (stats) {
     135            if (statsFile) {
    137136                pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, "PPSUB.OUTPUT"); // Output file
    138137                if (!output) {
    139138                    psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find file PPSUB.OUTPUT.\n");
    140                     return false;
     139                    goto ERROR;
    141140                }
    142141                psImageMaskType maskValue = pmConfigMaskGet("MASK.VALUE", config);
    143                 ppStatsFPA(stats, output->fpa, view, maskValue, config);
     142                ppStatsFPA(data->stats, output->fpa, view, maskValue, config);
    144143            }
    145144
    146145            if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    147                 return false;
     146                goto ERROR;
    148147            }
    149148        }
    150149
    151150        if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    152             return false;
     151            goto ERROR;
    153152        }
    154153    }
    155154
    156155    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    157         return false;
     156        goto ERROR;
    158157    }
    159158
     
    161160
    162161    // Write out summary statistics
    163     if (stats) {
    164         psMetadataAddF32(stats, PS_LIST_TAIL, "TIME_SUB", 0, "Time for subtraction completion",
     162    if (statsFile) {
     163        psMetadataAddF32(data->stats, PS_LIST_TAIL, "TIME_SUB", 0, "Time for subtraction completion",
    165164                         psTimerMark("ppSub"));
    166165
    167         const char *statsMDC = psMetadataConfigFormat(stats);
     166        const char *statsMDC = psMetadataConfigFormat(data->stats);
    168167        if (!statsMDC || strlen(statsMDC) == 0) {
    169168            psWarning("Unable to generate statistics MDC file.\n");
     
    173172        psFree((void *)statsMDC);
    174173        fclose(statsFile);
    175 
    176         psFree(stats);
    177174    }
    178175
    179176    psString dump_file = psMetadataLookupStr(&mdok, config->arguments, "-dumpconfig");
    180177    if (dump_file) {
    181 
    182178        pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PPSUB.INPUT"); // Input file
    183179        pmConfigDump(config, input->fpa, dump_file);
    184180    }
    185181
     182    psFree(data);
    186183    return true;
     184
     185ERROR:
     186    psFree(data);
     187    return false;
    187188}
  • trunk/ppSub/src/ppSubMakePSF.c

    r23235 r23688  
    2222#include "ppSub.h"
    2323
    24 bool ppSubMakePSF(pmConfig *config, const pmFPAview *view)
     24bool ppSubMakePSF(pmConfig *config, ppSubData *data, const pmFPAview *view)
    2525{
    2626    psAssert(config, "Require configuration");
     
    8383    psArray *sources = psMetadataLookupPtr(&mdok, minuend->analysis, "PSPHOT.SOURCES");
    8484    if (!psphotReadoutFindPSF(config, view, sources)) {
    85         psError(PS_ERR_UNKNOWN, false, "Unable to perform photometry on subtracted image.");
    86         return false;
     85        // This is likely a data quality issue
     86        // XXX Split into multiple cases using error codes?
     87        psErrorStackPrint(stderr, "Unable to determine PSF");
     88        psWarning("Unable to determine PSF --- suspect bad data quality.");
     89        ppSubDataQuality(config, data, PSPHOT_ERR_PSF, PPSUB_FILES_PHOT);
     90        return true;
    8791    }
    8892
     
    98102    return true;
    99103}
    100 
    101 // XXX we used to need this, is it still needed?
    102 
    103 // pmCell *photCell = pmFPAfileThisCell(config->files, view, "PSPHOT.INPUT");
    104 // pmCellFreeReadouts(photCell);
    105 
    106 // if (!pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL") ||
    107 //     !pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV") ||
    108 //     !pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND")) {
    109 //     psError(PS_ERR_UNKNOWN, false, "Unable to drop PSPHOT internal files.");
    110 //     return false;
    111 // }
    112 
    113 // Blow away the sources psphot found --- they're irrelevant for the subtraction
    114 // XXX is this still needed?  These are now probably not being set
    115 // pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout with sources
    116 // psMetadataRemoveKey(photRO->analysis, "PSPHOT.SOURCES");
    117 // psMetadataRemoveKey(photRO->analysis, "PSPHOT.HEADER");
    118 
  • trunk/ppSub/src/ppSubMatchPSFs.c

    r23505 r23688  
    2222#include "ppSub.h"
    2323
    24 bool ppSubMatchPSFs(pmConfig *config, const pmFPAview *view)
     24bool ppSubMatchPSFs(pmConfig *config, ppSubData *data, const pmFPAview *view)
    2525{
    2626    psAssert(config, "Require configuration");
     
    136136
    137137    // Match the PSFs
     138    bool success = false;               // Operation was successful?
    138139    if (kernelRO) {
    139         if (!pmSubtractionMatchPrecalc(inConv, refConv, inRO, refRO, kernelRO->analysis,
    140                                        stride, sys, maskVal, maskBad, maskPoor, poorFrac, badFrac)) {
    141             psError(PS_ERR_UNKNOWN, false, "Unable to convolve images.");
    142             return false;
    143         }
     140        success = pmSubtractionMatchPrecalc(inConv, refConv, inRO, refRO, kernelRO->analysis,
     141                                            stride, sys, maskVal, maskBad, maskPoor, poorFrac, badFrac);
    144142    } else {
    145         if (!pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, stride, regionSize, spacing,
    146                                 threshold, sources, stampsName, type, size, order, widths, orders, inner,
    147                                 ringsOrder, binning, penalty, optimum, optWidths, optOrder, optThresh, iter,
    148                                 rej, sys, maskVal, maskBad, maskPoor, poorFrac, badFrac, subMode)) {
     143        success = pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, stride, regionSize,
     144                                     spacing, threshold, sources, stampsName, type, size, order,
     145                                     widths, orders, inner, ringsOrder, binning, penalty, optimum,
     146                                     optWidths, optOrder, optThresh, iter, rej, sys, maskVal,
     147                                     maskBad, maskPoor, poorFrac, badFrac, subMode);
     148    }
     149
     150    psFree(optWidths);
     151    pmSubtractionThreadsFinalize(inRO, refRO);
     152
     153    if (!success) {
     154        psErrorCode error = psErrorCodeLast(); // Error code
     155        if (error == PM_ERR_STAMPS) {
     156            psErrorStackPrint(stderr, "Unable to find stamps");
     157            psWarning("Unable to find stamps --- suspect bad data quality.");
     158            ppSubDataQuality(config, data, error, PPSUB_FILES_ALL);
     159            return true;
     160        } else {
    149161            psError(PS_ERR_UNKNOWN, false, "Unable to match images.");
    150162            return false;
     
    152164    }
    153165
    154     psFree(optWidths);
    155 
    156     pmSubtractionThreadsFinalize(inRO, refRO);
    157 
    158166    psImageCovarianceTransfer(inConv->variance, inConv->covariance);
    159167    psImageCovarianceTransfer(refConv->variance, refConv->covariance);
    160168
    161     // XXX drop the pixels associated with inRO and refRO (now that we have inConv and refConf)
    162 #ifdef TESTING
    163     psphotSaveImage (NULL, inRO->image, "inRO.fits");
    164     psphotSaveImage (NULL, refRO->image, "refRO.fits");
    165     psphotSaveImage (NULL, inConv->image, "inConv.fits");
    166     psphotSaveImage (NULL, refConv->image, "refConv.fits");
    167 #endif
    168 
    169169    return true;
    170170}
  • trunk/ppSub/src/ppSubReadout.c

    r21524 r23688  
    2121#include "ppSub.h"
    2222
    23 bool ppSubReadout(pmConfig *config, psMetadata *stats, const pmFPAview *view)
     23bool ppSubReadout(pmConfig *config, ppSubData *data, const pmFPAview *view)
    2424{
    2525    psTimerStart("PPSUB_MATCH");
     
    3030    }
    3131
    32     if (!ppSubMatchPSFs(config, view)) {
     32    if (!ppSubMatchPSFs(config, data, view)) {
    3333        psError(PS_ERR_UNKNOWN, false, "Unable to match PSFs.");
    3434        return false;
     35    } else if (data->quality) {
     36        // Can't do anything at all
     37        return true;
    3538    }
    3639
     
    4043    }
    4144
    42     if (!ppSubMakePSF(config, view)) {
     45    if (!data->quality && !ppSubMakePSF(config, data, view)) {
    4346        psError(PS_ERR_UNKNOWN, false, "Unable to generate PSF.");
    4447        return false;
     
    5659    }
    5760
    58     if (!ppSubReadoutPhotometry(config, stats, view)) {
     61    if (!data->quality && !ppSubReadoutPhotometry(config, data, view)) {
    5962        psError(PS_ERR_UNKNOWN, false, "Unable to perform photometry.");
    6063        return false;
    6164    }
    6265
    63     if (!ppSubReadoutUpdate(config, stats, view)) {
     66    if (!ppSubReadoutUpdate(config, data, view)) {
    6467        psError(PS_ERR_UNKNOWN, false, "Unable to update.");
    6568        return false;
  • trunk/ppSub/src/ppSubReadoutPhotometry.c

    r21524 r23688  
    2222#include "ppSub.h"
    2323
    24 bool ppSubReadoutPhotometry (pmConfig *config, psMetadata *stats, const pmFPAview *view)
     24bool ppSubReadoutPhotometry (pmConfig *config, ppSubData *data, const pmFPAview *view)
    2525{
    2626    psAssert(config, "Require configuration");
     
    4545    pmPSF *psf = psMetadataLookupPtr(NULL, psfInputChip->analysis, "PSPHOT.PSF"); // PSF for photometry
    4646    if (!psf) {
    47         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find PSF from psphot");
    48         return false;
     47        psErrorStackPrint(stderr, "No PSF available");
     48        psWarning("No PSF available --- suspect bad data quality.");
     49        ppSubDataQuality(config, data, psErrorCodeLast(), PPSUB_FILES_PHOT);
     50        return true;
    4951    }
    5052    psMetadataAddPtr(psfLoadChip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN | PS_META_REPLACE,
     
    8082    }
    8183
    82 #if 0
    83     psMetadataAddPtr(config->files, PS_LIST_TAIL, "PSPHOT.INPUT", PS_DATA_UNKNOWN | PS_META_REPLACE,
    84                      "psphot input: view on another pmFPAfile", photFile);
    85 #endif
     84    if (!psphotReadoutMinimal(config, view)) {
     85        // This is likely a data quality issue
     86        // XXX Split into multiple cases using error codes?
     87        psErrorStackPrint(stderr, "Unable to perform photometry on image");
     88        psWarning("Unable to perform photometry on image --- suspect bad data quality.");
     89        ppSubDataQuality(config, data, psErrorCodeLast(), PPSUB_FILES_PHOT);
     90    }
    8691
    87     if (!psphotReadoutMinimal(config, view)) {
    88         psWarning("Unable to perform photometry on subtracted image.");
    89         psErrorStackPrint(stderr, "Error stack from photometry:");
    90         psErrorClear();
    91     }
    92 #if 1
    9392    photRO->data_exists = true;
    9493    photRO->parent->data_exists = true;
    9594    photRO->parent->parent->data_exists = true;
    96 #endif
    9795
    98     if (stats) {
     96    if (data->stats) {
    9997        psArray *sources = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.SOURCES"); // Sources
    100         psMetadataAddS32(stats, PS_LIST_TAIL, "NUM_SOURCES", 0, "Number of sources detected",
     98        psMetadataAddS32(data->stats, PS_LIST_TAIL, "NUM_SOURCES", 0, "Number of sources detected",
    10199                         sources ? sources->n : 0);
    102         psMetadataAddF32(stats, PS_LIST_TAIL, "TIME_PHOT", 0, "Time to do photometry",
     100        psMetadataAddF32(data->stats, PS_LIST_TAIL, "TIME_PHOT", 0, "Time to do photometry",
    103101                         psTimerClear("PPSUB_PHOT"));
    104102    }
  • trunk/ppSub/src/ppSubReadoutUpdate.c

    r23173 r23688  
    2121#include "ppSub.h"
    2222
    23 bool ppSubReadoutUpdate(pmConfig *config, psMetadata *stats, const pmFPAview *view)
     23bool ppSubReadoutUpdate(pmConfig *config, ppSubData *data, const pmFPAview *view)
    2424{
    2525    psAssert(config, "Require configuration");
     
    4747
    4848    // Statistics on the matching
    49     if (stats) {
    50         psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MODE);
    51         psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_STAMPS);
    52         psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_MEAN);
    53         psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_RMS);
    54         psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_NORM);
    55         psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_BGDIFF);
    56         psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MX);
    57         psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MY);
    58         psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXX);
    59         psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXY);
    60         psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MYY);
     49    if (data->stats) {
     50        psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MODE);
     51        psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_STAMPS);
     52        psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_MEAN);
     53        psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_RMS);
     54        psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_NORM);
     55        psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_BGDIFF);
     56        psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MX);
     57        psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MY);
     58        psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXX);
     59        psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXY);
     60        psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MYY);
    6161
    62         psMetadataAddF32(stats, PS_LIST_TAIL, "TIME_MATCH", 0, "Time to match PSFs",
     62        psMetadataAddF32(data->stats, PS_LIST_TAIL, "TIME_MATCH", 0, "Time to match PSFs",
    6363                         psTimerClear("PPSUB_MATCH"));
    6464    }
  • trunk/psModules

  • trunk/psModules/src/config/pmConfigRecipes.c

    r23286 r23688  
    8181            psTrace ("psModules.config", 3, "read recipes from camera config");
    8282        } else {
    83             psLogMsg ("psModules.config", PS_LOG_DETAIL, "no recipe supplied by camera config");
     83            psTrace ("psModules.config", PS_LOG_DETAIL, "no recipe supplied by camera config");
    8484        }
    8585    }
     
    9797            psTrace ("psModules.config", 3, "read recipes from symbolic references");
    9898        } else {
    99             psLogMsg ("psModules.config", PS_LOG_DETAIL, "no recipe supplied by symbolic reference");
     99            psTrace ("psModules.config", PS_LOG_DETAIL, "no recipe supplied by symbolic reference");
    100100        }
    101101
     
    105105            return false;
    106106        }
    107         psLogMsg ("psModules.config", PS_LOG_DETAIL, "merged camera recipes with system recipes");
     107        psTrace ("psModules.config", PS_LOG_DETAIL, "merged camera recipes with system recipes");
    108108
    109109        // load recipe-files specified on the command line
     
    115115            psTrace ("psModules.config", 3, "read recipes from command-line arguments");
    116116        } else {
    117             psLogMsg ("psModules.config", PS_LOG_DETAIL, "no recipe supplied on command-line arguments");
     117            psTrace ("psModules.config", PS_LOG_DETAIL, "no recipe supplied on command-line arguments");
    118118        }
    119119
     
    126126            psTrace ("psModules.config", 3, "read recipes from symbolic references");
    127127        } else {
    128             psLogMsg ("psModules.config", PS_LOG_DETAIL, "no recipe supplied by symbolic reference");
     128            psTrace ("psModules.config", PS_LOG_DETAIL, "no recipe supplied by symbolic reference");
    129129        }
    130130
     
    137137            psTrace ("psModules.config", 3, "read recipes from command-line arguments");
    138138        } else {
    139             psLogMsg ("psModules.config", PS_LOG_DETAIL, "no recipe supplied on command-line arguments");
     139            psTrace ("psModules.config", PS_LOG_DETAIL, "no recipe supplied on command-line arguments");
    140140        }
    141141    }
     
    348348            psFree(recipesIter);
    349349            return false;
    350         }
     350        }
    351351    }
    352352    psFree(recipesIter);
  • trunk/psModules/src/config/pmErrorCodes.dat

    r13654 r23688  
    1111OBJECTS                 Problem in objects
    1212SKY                     Problem in sky
     13STAMPS                  Unable to select stamps for PSF-matching
    1314# these errors correspond to standard exit conditions
    1415ARGUMENTS               Incorrect arguments
  • trunk/psModules/src/imcombine/pmSubtractionMatch.c

    r23308 r23688  
    1818#include "pmSubtractionMask.h"
    1919#include "pmSubtractionThreads.h"
     20#include "pmSubtractionVisual.h"
     21#include "pmErrorCodes.h"
     22
    2023#include "pmSubtractionMatch.h"
    21 #include "pmSubtractionVisual.h"
    2224
    2325#define BG_STAT PS_STAT_ROBUST_MEDIAN   // Statistic to use for background
     
    7375                                      stampSpacing, mode);
    7476    if (!*stamps) {
    75         psError(PS_ERR_UNKNOWN, false, "Unable to find stamps.");
     77        psError(psErrorCodeLast(), false, "Unable to find stamps.");
    7678        return false;
    7779    }
  • trunk/psModules/src/imcombine/pmSubtractionStamps.c

    r21363 r23688  
    2020#include "pmModel.h"
    2121#include "pmSource.h"
    22 
     22#include "pmErrorCodes.h"
    2323
    2424#include "pmSubtraction.h"
     
    355355    if (numGood == 0 && numFound == 0) {
    356356        // No good stamps
     357        psError(PM_ERR_STAMPS, true, "Unable to find suitable stamps");
    357358        psFree(stamps);
    358359        return NULL;
  • trunk/psastro

  • trunk/psastro/src/psastro.c

    r23195 r23688  
    1313# include "psastroStandAlone.h"
    1414
    15 static void usage (void) {
    16     fprintf (stderr, "USAGE: psastro [-file image(s)] [-list imagelist] (output)\n");
    17     exit (2);
     15static void usage(void) {
     16    fprintf(stderr, "USAGE: psastro [-file image(s)] [-list imagelist] (output)\n");
     17    exit(PS_EXIT_CONFIG_ERROR);
    1818}
    1919
    20 int main (int argc, char **argv) {
    21 
    22     pmConfig *config = NULL;
    23 
     20int main (int argc, char **argv)
     21{
    2422    psTimerStart ("complete");
    2523
     
    2826    // model inits are needed in pmSourceIO
    2927    // models defined in psphot/src/models are not available in psastro
    30     pmModelClassInit ();
     28    pmModelClassInit();
    3129
    3230    // load configuration information
    33     config = psastroArguments (argc, argv);
    34     if (!config) usage ();
     31    pmConfig *config = config = psastroArguments(argc, argv);
     32    if (!config) {
     33        usage();
     34    }
    3535
    3636    psastroVersionPrint();
     
    3939    if (!psastroParseCamera (config)) {
    4040        psErrorStackPrint(stderr, "error setting up the camera\n");
    41         exit (1);
     41        psFree(config);
     42        exit(PS_EXIT_CONFIG_ERROR);
    4243    }
    4344
     
    4647    if (!psastroDataLoad (config)) {
    4748        psErrorStackPrint(stderr, "error loading input data\n");
    48         exit (1);
     49        psFree(config);
     50        exit(PS_EXIT_DATA_ERROR);
    4951    }
    5052
     53    psMetadata *stats = psMetadataAlloc(); // Statistics, for output
     54    psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0);
     55
    5156    // run the full astrometry analysis (chip and/or mosaic)
    52     if (!psastroAnalysis (config)) {
     57    if (!psastroAnalysis(config, stats)) {
    5358        psErrorStackPrint(stderr, "failure in psastro analysis\n");
    54         exit (1);
     59        psFree(config);
     60        psFree(stats);
     61        exit(PS_EXIT_SYS_ERROR);
    5562    }
    5663
    5764    // write out the results
    58     if (!psastroDataSave (config)) {
     65    if (!psastroDataSave(config, stats)) {
    5966        psErrorStackPrint(stderr, "failed to write out data\n");
    60         exit (1);
     67        psFree(config);
     68        psFree(stats);
     69        exit(PS_EXIT_DATA_ERROR);
    6170    }
    6271
    63     psLogMsg ("psastro", 3, "complete psastro run: %f sec\n", psTimerMark ("complete"));
     72    psLogMsg("psastro", 3, "complete psastro run: %f sec\n", psTimerMark ("complete"));
    6473
    65     psastroCleanup (config);
    66     exit (EXIT_SUCCESS);
     74    psastroCleanup(config);
     75    exit(PS_EXIT_SUCCESS);
    6776}
  • trunk/psastro/src/psastro.h

    r23668 r23688  
    4646#endif
    4747
    48 bool              psastroDataSave (pmConfig *config);
     48bool              psastroDataSave (pmConfig *config, psMetadata *stats);
    4949bool              psastroDefineFiles (pmConfig *config, pmFPAfile *input);
    5050bool              psastroDefineFile (pmConfig *config, pmFPA *input, char *filerule, char *argname, pmFPAfileType fileType, pmDetrendType detrendType);
    51 bool              psastroAnalysis (pmConfig *config);
     51bool              psastroAnalysis (pmConfig *config, psMetadata *stats);
    5252
    5353bool              psastroConvertFPA (pmFPA *fpa, psMetadata *recipe);
     
    125125bool              psastroAstromGuessSetChip (pmFPA *fpa, pmChip *chip, const pmFPAview *view, double pixelScale, bool bilevelAstrometry);
    126126bool              psastroAstromGuessSetFPA (pmFPA *fpa, bool *bilevelAstrometry);
    127 bool              psastroMetadataStats (pmConfig *config);
     127bool              psastroMetadataStats (pmConfig *config, psMetadata *stats);
    128128
    129129bool              psastroZeroPoint (pmConfig *config);
  • trunk/psastro/src/psastroAnalysis.c

    r23412 r23688  
    11/** @file psastroAnalysis.c
    22 *
    3  *  @brief 
     3 *  @brief
    44 *
    55 *  @ingroup libpsastro
     
    1313# include "psastroInternal.h"
    1414
    15 bool psastroAnalysis (pmConfig *config) {
     15/// Turn save on/off for a file
     16static void fileSave(pmConfig *config,  // Configuration
     17                     const char *name,  // Name of file
     18                     bool save          // Save file?
     19    )
     20{
     21    pmFPAfile *file = pmFPAfileSelectSingle(config->files, name, 0); // File of interest
     22    if (!file) {
     23        psErrorClear();
     24        return;
     25    }
     26    file->save = save;
     27    return;
     28}
     29
     30
     31bool psastroAnalysis (pmConfig *config, psMetadata *stats) {
    1632
    1733    bool status;
     
    4056    }
    4157    if (nStars == 0) {
    42         psLogMsg ("psastro", 2, "skipping astrometry analysis : no stars\n");
    43         return false;
     58        // This is likely a data quality issue
     59        psWarning("No stars for astrometry analysis --- suspect bad data quality");
     60        if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) {
     61            psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     62                             "No stars for astrometry", PSASTRO_ERR_DATA);
     63        }
     64        fileSave(config, "PSASTRO.OUTPUT", false);
     65        fileSave(config, "PSASTRO.OUTPUT.MASK", false);
     66        fileSave(config, "PSASTRO.OUT.REFSTARS", false);
     67        psErrorClear();
     68        return true;
    4469    }
    4570
  • trunk/psastro/src/psastroDataSave.c

    r23169 r23688  
    2222 * this loop saves the photometry/astrometry data files
    2323 */
    24 bool psastroDataSave (pmConfig *config) {
     24bool psastroDataSave (pmConfig *config, psMetadata *stats) {
    2525
    2626    pmChip *chip;
     
    8484
    8585    // Write out summary statistics
    86     if (!psastroMetadataStats (config)) ESCAPE;
     86    if (!psastroMetadataStats (config, stats)) ESCAPE;
    8787
    8888    // activate all files except PSASTRO.OUTPUT
  • trunk/psastro/src/psastroMetadataStats.c

    r21409 r23688  
    1313# include "psastroInternal.h"
    1414
    15 bool psastroMetadataStats (pmConfig *config) {
     15bool psastroMetadataStats (pmConfig *config, psMetadata *stats) {
    1616
    1717    bool status;
     
    2424
    2525    if (!output) {
    26         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find output file (PSASTRO.OUTPUT).");
    27         return false;
     26        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find output file (PSASTRO.OUTPUT).");
     27        return false;
    2828    }
    2929
    30     // create output stats metadata
    31     psMetadata *stats = psMetadataAlloc ();
    32 
    33     // extract stats for the complete fpa
     30    // extract stats for the complete fpa
    3431    pmFPAview *view = pmFPAviewAlloc(0);
    3532
    3633    if (!ppStatsMetadata(stats, output->fpa, view, 0, config)) {
    37         psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image.");
    38         psFree(view);
    39         psFree(stats);
    40         return false;
     34        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image.");
     35        psFree(view);
     36        psFree(stats);
     37        return false;
    4138    }
    4239
    4340    // if we did not request any specific stats, the structure is empty
    4441    if (stats && stats->list->n == 0) {
    45         psWarning ("stats output specified, but no requested stats entries in headers");
    46         psFree(view);
    47         psFree(stats);
    48         return true;
     42        psWarning ("stats output specified, but no requested stats entries in headers");
     43        psFree(view);
     44        psFree(stats);
     45        return true;
    4946    }
    5047
     
    5249    char *statsMDC = psMetadataConfigFormat(stats);
    5350    if (!statsMDC || strlen(statsMDC) == 0) {
    54         psError(PS_ERR_IO, false, "Unable to serialize stats metadata.\n");
    55         return false;
    56     } 
     51        psError(PS_ERR_IO, false, "Unable to serialize stats metadata.\n");
     52        return false;
     53    }
    5754
    5855    // convert to a real UNIX filename
     
    6057    FILE *statsFile = fopen (resolved, "w");
    6158    if (!statsFile) {
    62         psError(PS_ERR_IO, true, "Unable to open statistics file %s for writing.\n", resolved);
    63         psFree(stats);
    64         psFree(view);
    65         psFree(statsMDC);
    66         psFree(resolved);
    67         return false;
     59        psError(PS_ERR_IO, true, "Unable to open statistics file %s for writing.\n", resolved);
     60        psFree(stats);
     61        psFree(view);
     62        psFree(statsMDC);
     63        psFree(resolved);
     64        return false;
    6865    }
    6966
  • trunk/psconfig

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/psphot

  • trunk/psphot/src/psphot.h

    r23492 r23688  
    3131bool            psphotReadoutCleanup (pmConfig *config, pmReadout *readout, psMetadata *recipe, pmDetections *detections, pmPSF *psf, psArray *sources);
    3232bool            psphotDefineFiles (pmConfig *config, pmFPAfile *input);
     33void            psphotFilesActivate(pmConfig *config, bool state);
     34
    3335bool            psphotSetMaskBits (pmConfig *config);
    3436bool            psphotSetMaskRecipe (pmConfig *config, psImageMaskType maskValue, psImageMaskType markValue);
  • trunk/psphot/src/psphotDefineFiles.c

    r14892 r23688  
    11# include "psphotInternal.h"
     2
     3// List of output files
     4static const char *outputFiles[] = { "PSPHOT.OUTPUT", "PSPHOT.RESID", "PSPHOT.BACKMDL",
     5                                     "PSPHOT.BACKMDL.STDEV", "PSPHOT.BACKGND", "PSPHOT.BACKSUB",
     6                                     "PSPHOT.PSF.SAVE", "SOURCE.PLOT.MOMENTS", "SOURCE.PLOT.PSFMODEL",
     7                                     "SOURCE.PLOT.APRESID", NULL };
    28
    39// XXX we need to be able to distinguish several cases:
     
    133139    return true;
    134140}
     141
     142void psphotFilesActivate(pmConfig *config, bool state)
     143{
     144    for (int i = 0; outputFiles[i]; i++) {
     145        if (!pmFPAfileActivate(config->files, state, outputFiles[i])) {
     146            psErrorClear();
     147        }
     148    }
     149
     150    return;
     151}
  • trunk/psphot/src/psphotMaskReadout.c

    r23535 r23688  
    3939      psImage *mk = readout->mask;
    4040      for (int j = 0; j < im->numRows; j++) {
    41         for (int i = 0; i < im->numCols; i++) {
    42           if (isfinite(im->data.F32[j][i]) && isfinite(wt->data.F32[j][i])) continue;
    43           mk->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskBad;
    44         }
     41        for (int i = 0; i < im->numCols; i++) {
     42          if (isfinite(im->data.F32[j][i]) && isfinite(wt->data.F32[j][i])) continue;
     43          mk->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskBad;
     44        }
    4545      }
    4646    }
  • trunk/pswarp/src/Makefile.am

    r23170 r23688  
    2424        pswarpMatchRange.c              \
    2525        pswarpParseCamera.c             \
    26         pswarpPixelFraction.c           \
     26        pswarpPixelsLit.c               \
    2727        pswarpSetMaskBits.c             \
    2828        pswarpSetThreads.c              \
  • trunk/pswarp/src/pswarp.h

    r23487 r23688  
    102102                          const char *filename, const char *argname);
    103103
    104 /// Check to see if the readout has a minimum fraction of "lit" pixels
    105 bool pswarpPixelFraction(const pmReadout *readout, ///< Readout to inspect
    106                          psMetadata *stats, ///< Statistics to update with the result
    107                          const pmConfig *config ///< Configuration
     104/// Get the range of lit pixels
     105bool pswarpPixelsLit(const pmReadout *readout, ///< Readout to inspect
     106                     psMetadata *stats, ///< Statistics to update with the result
     107                     const pmConfig *config ///< Configuration
    108108    );
    109109
  • trunk/pswarp/src/pswarpArguments.c

    r23314 r23688  
    163163    }
    164164
    165     float acceptFrac = psMetadataLookupF32(&status, recipe, "ACCEPT.FRAC"); ///< Min fraction of good pixels
    166     if (!status) {
    167         acceptFrac = 0.0;
    168         psWarning("ACCEPT.FRAC is not set in the %s recipe --- defaulting to %f.", PSWARP_RECIPE, poorFrac);
    169     }
    170 
    171165    // Set recipe values in the recipe (since we've possibly altered some)
    172166    psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NX", PS_META_REPLACE,
     
    180174    psMetadataAddF32(recipe, PS_LIST_TAIL, "POOR.FRAC", PS_META_REPLACE,
    181175                     "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
    182     psMetadataAddF32(recipe, PS_LIST_TAIL, "ACCEPT.FRAC", PS_META_REPLACE,
    183                      "Minimum fraction of good pixels for result to be accepted", acceptFrac);
    184176
    185177    // Set recipe values in the arguments
     
    194186    psMetadataAddF32(config->arguments, PS_LIST_TAIL, "POOR.FRAC", 0,
    195187                     "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
    196     psMetadataAddF32(config->arguments, PS_LIST_TAIL, "ACCEPT.FRAC", 0,
    197                      "Minimum fraction of good pixels for result to be accepted", acceptFrac);
    198188
    199189    psTrace("pswarp", 1, "Done with pswarpArguments...\n");
  • trunk/pswarp/src/pswarpErrorCodes.dat

    r11268 r23688  
    99IO                      Problem in FITS I/O
    1010DATA                    Problem in data values
     11NO_OVERLAP              No overlap between input and skycell
  • trunk/pswarp/src/pswarpLoop.c

    r23629 r23688  
    142142        psFree(resolved);
    143143        stats = psMetadataAlloc();
     144        psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0);
    144145    }
    145146
     
    273274    }
    274275
     276    if (!output->data_exists) {
     277        psWarning("No overlap between input and skycell.");
     278        if (stats) {
     279            psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     280                             "No overlap between input and skycell", PSWARP_ERR_NO_OVERLAP);
     281        }
     282        psphotFilesActivate(config, false);
     283        psFree(cells);
     284        psFree(view);
     285        return true;
     286    }
     287
    275288    pmCell *outCell = output->parent;   ///< Output cell
    276289    pmChip *outChip = outCell->parent;  ///< Output chip
    277290    pmFPA *outFPA = outChip->parent;    ///< Output FP
    278291
    279     if (!pswarpPixelFraction(output, stats, config)) {
    280         // Don't write output images, and don't bother about anything else
    281         output->data_exists = outCell->data_exists = outChip->data_exists = false;
     292    if (!pswarpPixelsLit(output, stats, config)) {
     293        psError(PS_ERR_UNKNOWN, false, "Unable to calculate pixel regions.");
    282294        psFree(cells);
    283295        psFree(view);
    284         goto COMPLETED;
     296        return false;
    285297    }
    286298
     
    363375    fileActivation(config, independentFiles, false);
    364376
    365     // We need a new PSF model for the warped frame.  It would be good to generate this analytically, but that's going to be tricky.
    366     // We have a list of sources, so we use those to redetermine the PSF model.
     377    // We need a new PSF model for the warped frame.  It would be good to generate this analytically, but
     378    // that's going to be tricky.  We have a list of sources, so we use those to redetermine the PSF model.
    367379
    368380    if (psMetadataLookupBool(&mdok, config->arguments, "PSF")) {
     
    393405        // measure the PSF using these sources
    394406        if (!psphotReadoutFindPSF(config, view, sources)) {
    395             psError(PS_ERR_UNKNOWN, false, "Unable to determine PSF for warped image.");
    396             return false;
     407            // This is likely a data quality issue
     408            // XXX Split into multiple cases using error codes?
     409            psErrorStackPrint(stderr, "Unable to determine PSF");
     410            psWarning("Unable to determine PSF --- suspect bad data quality.");
     411            if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) {
     412                psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     413                                 "Unable to determine PSF", psErrorCodeLast());
     414            }
     415            psErrorClear();
     416            psphotFilesActivate(config, false);
    397417        }
    398418
     
    447467    // Now done with the skycell side of things
    448468
    449     COMPLETED:
    450469    // Write out summary statistics
    451470    if (stats) {
Note: See TracChangeset for help on using the changeset viewer.