IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2014, 11:03:38 AM (12 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20140206
Files:
48 edited
19 copied

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140206

  • branches/eam_branches/ipp-20140206/ippScripts/scripts/dist_advancerun.pl

    r35960 r36627  
    6969my $stacktool   = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1);
    7070my $bgtool = can_run('bgtool') or (warn "Can't find bgtool" and $missing_tools = 1);
     71my $fftool = can_run('fftool') or (warn "Can't find fftool" and $missing_tools = 1);
    7172my $staticskytool = can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1);
    7273if ($missing_tools) {
     
    7778
    7879my $tool_cmd;
     80my $tool_cmd2;
    7981my $list_mode;
    8082my $component_key;
     
    127129    $list_mode = "-diffskyfile";
    128130    $component_key = "skycell_id";
     131} elsif ($stage eq "ff") {
     132    $tool_cmd = "$fftool -ff_id";
     133    $list_mode = "-result";
     134    $component_key = "dist_component";
     135    $tool_cmd2 = "$fftool -summary -ff_id"
    129136} else {
    130137    &my_die("Unexpected stage: $stage", $dist_id, $PS_EXIT_CONFIG_ERROR);
     
    132139
    133140$tool_cmd .= " $stage_id";
     141$tool_cmd2 .= " $stage_id" if $tool_cmd2;
    134142
    135143my $exportarg = '-exportrun';
     
    215223    my $components = parse_md_list($metadata) or
    216224        &my_die("Unable to parse metadata list", $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     225
     226    if ($tool_cmd2) {
     227        my $command = "$tool_cmd2";
     228        $command .= " -dbname $dbname" if defined $dbname;
     229
     230        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     231            run(command => $command, verbose => $verbose);
     232            unless ($success) {
     233            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     234            &my_die("Unable to perform $command: $error_code", $dist_id, $error_code);
     235        }
     236        if (@$stdout_buf == 0) {
     237            &my_die("Unable to perform $command: $error_code", $dist_id, $error_code);
     238        }
     239        my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
     240            &my_die("Unable to parse metadata config doc", $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     241        my $more_components = parse_md_list($metadata) or
     242            &my_die("Unable to parse metadata list", $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     243        if (scalar @$more_components) {
     244            push @$components, @$more_components;
     245        }
     246    }
    217247
    218248    open MANIFEST, ">$resolved" or
  • branches/eam_branches/ipp-20140206/ippScripts/scripts/dist_bundle.pl

    r36457 r36627  
    496496    } elsif ($stage eq "stack") {
    497497        $type = $stack_cleaned{$rule};
    498     } elsif ($stage eq "sky" or $stage eq 'skycal' or $stage eq 'stack_summary') {
     498    } elsif ($stage eq "sky" or $stage eq 'skycal' or $stage eq 'stack_summary' or $stage eq 'ff') {
    499499        $type = $empty_cleaned{$rule};
    500500    } else {
     
    588588        # stack_summary stage does not use a config dump file.
    589589        return build_stack_summary_file_list($path_base, \@file_list);
     590    } elsif ($stage eq "ff") {
     591        if ($component eq 'summary') {
     592            # full force summary does not use a config dump file. Cobble together a file list
     593            return build_ff_summary_file_list($path_base, \@file_list);
     594        } else {
     595            $config_file_rule = "PSPHOT.SKY.CONFIG";
     596        }
    590597    } else {
    591598        &my_die("$stage is not a valid stage", $component, $PS_EXIT_CONFIG_ERROR);
     
    742749}
    743750
     751# psphotFullForceSummary does not produce a config dump file cobble together a file list
     752sub build_ff_summary_file_list {
     753    my ($path_base, $file_list) = @_;
     754
     755    my %cmf ;
     756    $cmf{file_rule} = "SOURCES";
     757    $cmf{name} = "$path_base.cmf";
     758    push @$file_list, \%cmf;
     759
     760    my %log;
     761    $log{file_rule} = "LOG";
     762    $log{name} = "$path_base.log";
     763    push @$file_list, \%log;
     764
     765    return $file_list;
     766}
     767
    744768sub my_die
    745769{
  • branches/eam_branches/ipp-20140206/ippScripts/scripts/ipp_apply_burntool_single.pl

  • branches/eam_branches/ipp-20140206/ippScripts/scripts/publish_file.pl

  • branches/eam_branches/ipp-20140206/ippTasks/staticsky.pro

    r34814 r36627  
    6464end
    6565
     66$RA_POLL_MAX = 0
     67
     68macro set.ra.max
     69    if ($0 != 2)
     70        echo "USAGE: set.ra.max (ra_max_deg)"
     71        break
     72    end
     73    $RA_POLL_MAX = $1
     74end
     75macro get.ra.max
     76    echo $RA_POLL_MAX
     77end
     78
    6679### Load tasks for staticsky
    6780### Tasks are loaded into staticskyResult.
     
    8093    if ($LABEL:n == 0) break
    8194    $run = staticskytool -todo
     95    if ($RA_POLL_MAX > 0)
     96        $run = $run -ra_max $RA_POLL_MAX
     97    end
    8298    if ($DB:n == 0)
    8399      option DEFAULT
  • branches/eam_branches/ipp-20140206/ippToPsps/jython/cleanup.py

    r35311 r36627  
    8787        self.logger.infoPair("To delete from DXLayer", "%d" % len(deleteFromDxLayerIDs))
    8888        self.logger.infoPair("To delete from local disk", "%d" % len(deleteFromLocalIDs))
    89    
     89    #    self.logger.infoPair("Did I get here", "yes?")
    9090        # delete stuff from local disk
    9191        if self.skychunk.deleteLocal:
     
    110110   
    111111            self.reportResults("datastore", deleteFromDatastoreIDs, count)
    112         
     112       # self.logger.infoPair("here","here")
    113113        # remove stuff from DXLayer
    114114        if self.skychunk.deleteDxLayer:
     115#            self.logger.infoPair ("skip remove from dxlayer", "HAF")
    115116            count = 0
    116117            for id in deleteFromDxLayerIDs:
    117        
     118                self.logger.infoPair("delete from dxlayer", id);
    118119                if self.dxlayer.deleteBatch(id):
     120                    self.logger.infoPair("delete dxlayer",id);
    119121                    self.ippToPspsDb.updateDeletedDxlayer(id, 1)
    120122                    count = count + 1
  • branches/eam_branches/ipp-20140206/ippToPsps/jython/dxlayer.py

    r36098 r36627  
    3737       
    3838        if p.returncode != 0:
    39            self.logger.debugPair("DXLayer webservice", "failed")
     39           self.logger.infoPair("DXLayer webservice", "failed")
    4040           return 0
    4141        else:
    42            self.logger.debugPair("DXLayer webservice", "successful")
     42           self.logger.infoPair("DXLayer webservice", "successful")
    4343
    4444        ret = self.decodeDXLayerResponse(tempFile.name)
     
    4848
    4949        if ret: self.logger.infoPair("Deleted batch from DXLayer 1", batch)
    50         else: self.logger.errorPair("Unable to delete batch from DXLayer 1" , batch)
     50        else: self.logger.infoPair("Unable to delete batch from DXLayer 1" , batch)
    5151
    5252
     
    6161       
    6262        if p.returncode != 0:
    63            self.logger.debugPair("DXLayer webservice", "failed")
     63           self.logger.infoPair("DXLayer webservice", "failed")
    6464           return 0
    6565        else:
     
    7272
    7373        if ret: self.logger.infoPair("Deleted batch from DXLayer 2", batch)
    74         else: self.logger.errorPair("Unable to delete batch from DXLayer 2" , batch)
     74        else: self.logger.infoPair("Unable to delete batch from DXLayer 2" , batch)
    7575
    7676
  • branches/eam_branches/ipp-20140206/ippToPsps/jython/odm.py

    r35217 r36627  
    7878                DETAILS = doc.find("{%s}OdmBatchState/{%s}Details" % (NAMESPACE, NAMESPACE)).text
    7979                results['DETAILS'] = DETAILS
    80             elif re.search("processing", STATE): 
     80            elif re.search("processing", STATE):
    8181                loadedToODM = 1
    8282            if re.search("MergeWorthy", MESSAGE):
     
    8787                mergeWorthy = 1
    8888                merged = 1
     89#            if re.search("released", STATE):
     90#                loadedToODM = 1
     91#                mergeWorthy = 1
     92#                merged = 1
     93#            if re.search("released", MESSAGE):
     94#                loadedToODM = 1
     95#                mergeWorthy = 1
     96#                merged = 1
    8997        except:
    9098            pass
  • branches/eam_branches/ipp-20140206/ippToPsps/perl/deleteFromDXLayer.pl

    r36190 r36627  
    1818        );
    1919
    20 my $dxWebServiceUrl = "http://lsb01.psps.ifa.hawaii.edu/cgi-bin/dxlayer/dxwebservice.cgi";
     20#my $dxWebServiceUrl = "http://lsb01.psps.ifa.hawaii.edu/cgi-bin/dxlayer/dxwebservice.cgi";
     21
     22#my $dxWebServiceUrl = "http://web02.psps.ifa.hawaii.edu/lsb01/cgi-bin/dxwebservice.cgi";
     23my $dxWebServiceUrl = "http://web02.psps.ifa.hawaii.edu/lsb01/cgi-bin/dxlayer/dxwebservice.cgi";
     24
     25
    2126#my $dxWebServiceUrl2 = "http://lsb02.psps.ifa.hawaii.edu/cgi-bin/dxlayer/dxwebservice.cgi";
    2227
  • branches/eam_branches/ipp-20140206/ippToPsps/perl/deleteFromDXLayer2.pl

    r36191 r36627  
    1818        );
    1919
    20 my $dxWebServiceUrl = "http://lsb02.psps.ifa.hawaii.edu/cgi-bin/dxlayer/dxwebservice.cgi";
     20#my $dxWebServiceUrl = "http://lsb02.psps.ifa.hawaii.edu/cgi-bin/dxlayer/dxwebservice.cgi";
     21
     22#my $dxWebServiceUrl = "http://web02.psps.ifa.hawaii.edu/lsb02/cgi-bin/dxwebservice.cgi";
     23my $dxWebServiceUrl = "http://web02.psps.ifa.hawaii.edu/lsb02/cgi-bin/dxlayer/dxwebservice.cgi";
    2124#my $dxWebServiceUrl2 = "http://lsb02.psps.ifa.hawaii.edu/cgi-bin/dxlayer/dxwebservice.cgi";
    2225
  • branches/eam_branches/ipp-20140206/ippTools/share/Makefile.am

    r36536 r36627  
    105105        detselect_search.sql \
    106106        detselect_select.sql \
     107        detselect_show.sql \
    107108        dettool_addprocessedexp.sql \
    108109        dettool_childlessrun.sql \
     
    189190        disttool_definebyquery_diff.sql \
    190191        disttool_definebyquery_fake.sql \
     192        disttool_definebyquery_ff.sql \
    191193        disttool_definebyquery_raw.sql \
    192194        disttool_definebyquery_raw_no_magic.sql \
     
    206208        disttool_pending_diff.sql \
    207209        disttool_pending_fake.sql \
     210        disttool_pending_ff.sql \
    208211        disttool_pending_raw.sql \
    209212        disttool_pending_sky.sql \
     
    497500        fftool_todo.sql \
    498501        fftool_toadvance.sql \
     502        fftool_export_run.sql \
     503        fftool_export_input.sql \
     504        fftool_export_result.sql \
     505        fftool_export_summary.sql \
    499506        remotetool_definebyquery_chip.sql \
    500507        remotetool_definebyquery_cam.sql \
     
    502509        remotetool_definebyquery_stack.sql \
    503510        remotetool_updatepoll.sql
    504 
    505 
    506 
  • branches/eam_branches/ipp-20140206/ippTools/share/disttool_toadvance.sql

    r35960 r36627  
    308308        COUNT(diffSkyfile.skycell_id) = COUNT(distComponent.component)
    309309        AND SUM(distComponent.fault) = 0
     310UNION
     311-- ff stage
     312SELECT
     313    distRun.dist_id,
     314    stage,
     315    stage_id,
     316    outroot,
     317    distRun.label,
     318    clean
     319    -- ,COUNT(warp_id)
     320    -- ,COUNT(ff_id)
     321    FROM distRun
     322    JOIN fullForceRun ON stage_id = ff_id
     323    JOIN fullForceResult USING(ff_id)
     324    JOIN skycalRun USING(skycal_id)
     325    JOIN stackRun USING(stack_id)
     326    LEFT JOIN distComponent
     327        ON distRun.dist_id = distComponent.dist_id
     328        AND distComponent.component = CONCAT_WS('.', warp_id, stackRun.skycell_id)
     329    WHERE
     330        distRun.state = 'new'
     331        AND distRun.fault = 0
     332        AND distRun.stage = 'ff'
     333    GROUP BY
     334        distRun.dist_id,
     335        ff_id
     336    HAVING
     337        -- number of dist components is the number of warps plus 1 (for the summary component)
     338        COUNT(fullForceResult.ff_id) = COUNT(distComponent.component)
     339        AND SUM(distComponent.fault) = 0
    310340) as Foo
  • branches/eam_branches/ipp-20140206/ippTools/share/fftool_result.sql

    r36441 r36627  
    11SELECT
    22    fullForceResult.*,
    3     fullForceRun.skycal_id,
     3    fullForceRun.state,
    44    fullForceRun.label,
    55    fullForceRun.data_group,
     6    fullForceRun.skycal_id,
     7    fullForceRun.workdir,
     8    CONCAT_WS('.', warp_id, skycell_id) AS dist_component,
    69    stackRun.tess_id,
    710    stackRun.skycell_id,
  • branches/eam_branches/ipp-20140206/ippTools/share/fftool_summary.sql

    r36441 r36627  
    55    fullForceRun.data_group,
    66    fullForceRun.skycal_id,
     7    fullForceRun.workdir,
     8    'summary' AS dist_component,
    79    stackRun.tess_id,
    810    stackRun.skycell_id,
  • branches/eam_branches/ipp-20140206/ippTools/src

    • Property svn:ignore
      •  

        old new  
        4848releasetool
        4949fftool
         50remotetool
         51
  • branches/eam_branches/ipp-20140206/ippTools/src/detselect.c

    r31058 r36627  
    2929static bool searchMode(pxConfig *config);
    3030static bool selectMode(pxConfig *config);
     31static bool showMode(pxConfig *config);
     32
    3133
    3234# define MODECASE(caseName, func) \
     
    5052        MODECASE(DETSELECT_MODE_SEARCH,        searchMode);
    5153        MODECASE(DETSELECT_MODE_SELECT,        selectMode);
     54        MODECASE(DETSELECT_MODE_SHOW,          showMode);
    5255        default:
    5356            psAbort("invalid option (this should not happen)");
     
    241244    return true;
    242245}
     246
     247static bool showMode(pxConfig *config)
     248{
     249    PS_ASSERT_PTR_NON_NULL(config, false);
     250
     251    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     252
     253    psMetadata *where = psMetadataAlloc();
     254
     255    PXOPT_COPY_STR(config->args, where, "-inst",      "camera", "==");
     256    PXOPT_COPY_STR(config->args, where, "-telescope", "telescope", "==");
     257    PXOPT_COPY_STR(config->args, where, "-det_type",  "det_type", "==");
     258    PXOPT_COPY_STR(config->args, where, "-type",      "det_type", "==");
     259
     260    psString query = pxDataGet("detselect_show.sql");
     261    if (!query) {
     262        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     263        return false;
     264    }
     265
     266    // use psDBGenerateWhereConditionalSQL with AND ... because the SQL ends in a WHERE
     267    if (where && psListLength(where->list)) {
     268        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
     269        psStringAppend(&query, " AND %s", whereClause);
     270        psFree(whereClause);
     271    }
     272    psFree(where);
     273
     274    // we choose the single detrend image which matches all criteria and has
     275    // the latest insertion date
     276
     277    psStringAppend(&query, " ORDER BY registered DESC, iteration DESC");
     278
     279    if (!p_psDBRunQuery(config->dbh, query)) {
     280        psError(PS_ERR_UNKNOWN, false, "database error");
     281        psFree(query);
     282        return false;
     283    }
     284    psFree(query);
     285
     286    psArray *output = p_psDBFetchResult(config->dbh);
     287    if (!output) {
     288        psError(PS_ERR_UNKNOWN, false, "database error");
     289        return false;
     290    }
     291    if (!psArrayLength(output)) {
     292        // XXX check psError here
     293        psError(PS_ERR_UNKNOWN, false, "no detRun rows found");
     294        psFree(output);
     295        return true;
     296    }
     297
     298    // negative simple so the default is true
     299    if (!ippdbPrintMetadatas(stdout, output, "detRun", !simple)) {
     300        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     301        psFree(output);
     302        return false;
     303    }
     304
     305    psFree(output);
     306    return(true);
     307}
  • branches/eam_branches/ipp-20140206/ippTools/src/detselect.h

    r18561 r36627  
    2727    DETSELECT_MODE_SEARCH,
    2828    DETSELECT_MODE_SELECT,
     29    DETSELECT_MODE_SHOW
    2930} detselectMode;
    3031
  • branches/eam_branches/ipp-20140206/ippTools/src/detselectConfig.c

    r18561 r36627  
    6565    psMetadataAddStr(selectArgs, PS_LIST_TAIL, "-class_id", 0,                     "search by class ID", NULL);
    6666    psMetadataAddBool(selectArgs, PS_LIST_TAIL, "-simple",  0,                      "use the simple output format", false);
     67
     68    // -show
     69    psMetadata *showArgs = psMetadataAlloc();
     70    psMetadataAddStr(showArgs, PS_LIST_TAIL, "-inst",       0,       "search by camera", NULL);
     71    psMetadataAddStr(showArgs, PS_LIST_TAIL, "-telescope",  0,       "search by telescope", NULL);
     72    psMetadataAddStr(showArgs, PS_LIST_TAIL, "-det_type",   0,       "search by detrend type", NULL);
     73    psMetadataAddStr(showArgs, PS_LIST_TAIL, "-type",       0,       "search by detrend type (alias for -det_type)", NULL);
     74    psMetadataAddBool(showArgs, PS_LIST_TAIL, "-simple",     0,       "use the simple output format", false);
    6775   
    6876    psMetadata *argSets = psMetadataAlloc();
     
    7179    PXOPT_ADD_MODE("-search",  "search for an appropriate detrend", DETSELECT_MODE_SEARCH, searchArgs);
    7280    PXOPT_ADD_MODE("-select",  "retreive detrend information", DETSELECT_MODE_SELECT, selectArgs);
     81    PXOPT_ADD_MODE("-show",    "show all active detrends of this type with constraints", DETSELECT_MODE_SHOW, showArgs);
    7382
    7483    if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
  • branches/eam_branches/ipp-20140206/ippTools/src/difftool.c

    r36019 r36627  
    13491349    if (!mdok) {
    13501350        psError(PXTOOLS_ERR_PROG, false, "exp_id not found");
     1351        if (!psDBRollback(config->dbh)) {
     1352          psError(PS_ERR_UNKNOWN, false, "database error");
     1353        }
     1354        return false;
     1355    }
     1356    psString warpDataGroup = psMetadataLookupStr(&mdok, row, "warpDataGroup");
     1357    if (!mdok) {
     1358        psError(PXTOOLS_ERR_PROG, false, "warpDataGroup not found");
    13511359        if (!psDBRollback(config->dbh)) {
    13521360          psError(PS_ERR_UNKNOWN, false, "database error");
     
    13911399                                        workdir,
    13921400                                        label,
    1393                                         data_group ? data_group : label,
     1401                                        data_group ? data_group : warpDataGroup,
    13941402                                        dist_group,
    13951403                                        reduction,
  • branches/eam_branches/ipp-20140206/ippTools/src/disttool.c

    r36248 r36627  
    413413
    414414      magic = false;
     415    } else if (!strcmp(stage, "ff")) {
     416      runJoinStr = "fullForceRun.ff_id";
     417      query = pxDataGet("disttool_definebyquery_ff.sql");
     418      if (!query) {
     419        psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     420        psFree(where);
     421        return(false);
     422      }
     423
     424      if (label) {
     425        psStringAppend(&query, " AND (fullForceRun.label = '%s') ", label);
     426      }
     427      if (dist_group) {
     428        psStringAppend(&query, " AND (fullForceRun.dist_group = '%s') ", dist_group);
     429      }
     430
     431      magic = false;
    415432    } else {
    416433        psError(PS_ERR_UNKNOWN, true, "unknown value for stage: %s", stage);
  • branches/eam_branches/ipp-20140206/ippTools/src/fftool.c

    r36441 r36627  
    4444static bool updatesummaryMode(pxConfig *config);
    4545static bool summaryMode(pxConfig *config);
     46static bool exportrunMode(pxConfig *config);
     47static bool importrunMode(pxConfig *config);
     48static bool summaryMode(pxConfig *config);
    4649
    4750static bool setfullForceRunState(pxConfig *config, psS64 sky_id, const char *state);
     
    7780        MODECASE(FFTOOL_MODE_UPDATESUMMARY,     updatesummaryMode);
    7881        MODECASE(FFTOOL_MODE_SUMMARY,           summaryMode);
     82        MODECASE(FFTOOL_MODE_EXPORTRUN,         exportrunMode);
     83        MODECASE(FFTOOL_MODE_IMPORTRUN,         importrunMode);
    7984        default:
    8085            psAbort("invalid option (this should not happen)");
     
    134139
    135140    psMetadata *warpWhereMD = psMetadataAlloc();
    136     pxAddLabelSearchArgs(config, warpWhereMD, "-select_warp_label",     "warpRun.label",           "LIKE");
    137     pxAddLabelSearchArgs(config, warpWhereMD, "-select_warp_data_group","warpRun.data_group",      "LIKE");
    138     PXOPT_COPY_S64(config->args, warpWhereMD, "-select_warp_id",        "warpRun.warp_id",         "==");
     141    pxAddLabelSearchArgs(config, warpWhereMD, "-select_warp_label",     "fullForceRun.label",           "LIKE");
     142    pxAddLabelSearchArgs(config, warpWhereMD, "-select_warp_data_group","fullForceRun.data_group",      "LIKE");
     143    PXOPT_COPY_S64(config->args, warpWhereMD, "-select_warp_id",        "fullForceRun.warp_id",         "==");
    139144    if (!psListLength(warpWhereMD->list)) {
    140145        psError(PXTOOLS_ERR_CONFIG, false, "warp search parameters are required");
     
    150155    }
    151156
    152     PXOPT_COPY_STR(config->args, warpWhereMD, "-select_tess_id",       "warpRun.tess_id",         "==");
    153     pxAddLabelSearchArgs(config, warpWhereMD, "-select_filter",        "warpRun.filter",          "LIKE");
     157    PXOPT_COPY_STR(config->args, warpWhereMD, "-select_tess_id",       "fullForceRun.tess_id",         "==");
     158    pxAddLabelSearchArgs(config, warpWhereMD, "-select_filter",        "fullForceRun.filter",          "LIKE");
    154159    if (!pxskycellAddWhere(config, warpWhereMD)) {
    155160        psError(PXTOOLS_ERR_CONFIG, false, "failed to add skycell search arguments");
     
    175180    psString whereClause = psDBGenerateWhereConditionSQL(skycalWhereMD, NULL);
    176181    psStringAppend(&where, "\nAND %s", whereClause);
    177     psStringAppend(&select, where);
     182    psStringAppend(&select, " %s", where);
    178183    psFree(whereClause);
    179184    psFree(skycalWhereMD);
     
    504509    PXOPT_COPY_STR(config->args, where, "-tess_id",    "stackRun.tess_id", "LIKE");
    505510    PXOPT_COPY_STR(config->args, where, "-skycell_id", "stackRun.skycell_id", "LIKE");
     511    PXOPT_COPY_STR(config->args, where, "-filter",      "stackRun.filter", "LIKE");
    506512    PXOPT_COPY_S16(config->args, where, "-fault",      "staticskyResult.fault", "==");
    507513    pxskycellAddWhere(config, where);
     
    864870    PXOPT_COPY_STR(config->args, where, "-tess_id",    "stackRun.tess_id", "LIKE");
    865871    PXOPT_COPY_STR(config->args, where, "-skycell_id", "stackRun.skycell_id", "LIKE");
     872    PXOPT_COPY_STR(config->args, where, "-filter",     "stackRun.filter", "LIKE");
    866873    PXOPT_COPY_S16(config->args, where, "-fault",      "staticskyResult.fault", "==");
    867874    pxskycellAddWhere(config, where);
     
    933940    return true;
    934941}
     942
     943bool exportrunMode(pxConfig *config)
     944{
     945  typedef struct ExportTable {
     946    char tableName[80];
     947    char sqlFilename[80];
     948  } ExportTable;
     949
     950    PS_ASSERT_PTR_NON_NULL(config, NULL);
     951
     952    // PXOPT_LOOKUP_S64(det_id,  config->args, "-warp_id", true,  false);
     953    PXOPT_LOOKUP_STR(outfile, config->args, "-outfile", true,  false);
     954    PXOPT_LOOKUP_U64(limit,   config->args, "-limit",   false, false);
     955//    PXOPT_LOOKUP_BOOL(clean,  config->args, "-clean", false);
     956
     957    FILE *f = fopen (outfile, "w");
     958    if (f == NULL) {
     959        psError(PS_ERR_UNKNOWN, false, "failed to open output file");
     960        return false;
     961    }
     962
     963    if (!pxExportVersion(config, f)) {
     964        psError(PS_ERR_UNKNOWN, false, "failed to write dbversion output file");
     965        return false;
     966    }
     967    psMetadata *where = psMetadataAlloc();
     968    PXOPT_COPY_S64(config->args, where, "-ff_id", "ff_id", "==");
     969
     970    ExportTable tables [] = {
     971      {"fullForceRun", "fftool_export_run.sql"},
     972      {"fullForceInput", "fftool_export_input.sql"},
     973      {"fullForceResult", "fftool_export_result.sql"},
     974      {"fullForceSummary", "fftool_export_summary.sql"},
     975    };
     976
     977    int numTables = sizeof(tables)/sizeof(tables[0]);
     978
     979    for (int i=0; i < numTables; i++) {
     980      psString query = pxDataGet(tables[i].sqlFilename);
     981      if (!query) {
     982          psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     983          return false;
     984      }
     985
     986      if (where && psListLength(where->list)) {
     987          psString whereClause = psDBGenerateWhereSQL(where, NULL);
     988          psStringAppend(&query, " %s", whereClause);
     989          psFree(whereClause);
     990      }
     991
     992      // treat limit == 0 as "no limit"
     993      if (limit) {
     994        psString limitString = psDBGenerateLimitSQL(limit);
     995        psStringAppend(&query, " %s", limitString);
     996        psFree(limitString);
     997      }
     998
     999      if (!p_psDBRunQuery(config->dbh, query)) {
     1000        psError(PS_ERR_UNKNOWN, false, "database error");
     1001        psFree(query);
     1002        return false;
     1003      }
     1004      psFree(query);
     1005
     1006      psArray *output = p_psDBFetchResult(config->dbh);
     1007      if (!output) {
     1008          psError(PS_ERR_UNKNOWN, false, "database error");
     1009          return false;
     1010      }
     1011      if (!psArrayLength(output)) {
     1012        psError(PS_ERR_UNKNOWN, true, "no rows found");
     1013        psFree(output);
     1014        return false;
     1015      }
     1016
     1017      // we must write the export table in non-simple (true) format
     1018      if (!ippdbPrintMetadatas(f, output, tables[i].tableName, true)) {
     1019        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     1020        psFree(output);
     1021        return false;
     1022      }
     1023      psFree(output);
     1024    }
     1025
     1026    fclose (f);
     1027
     1028    return true;
     1029}
     1030
     1031bool importrunMode(pxConfig *config)
     1032{
     1033  unsigned int nFail;
     1034
     1035  int numImportTables = 3;
     1036
     1037  char tables[3] [80] = {"fullForceInput", "fullForceResult", "fullForceSummary"};
     1038
     1039  PS_ASSERT_PTR_NON_NULL(config, NULL);
     1040
     1041  PXOPT_LOOKUP_STR(infile, config->args, "-infile", true,  false);
     1042
     1043  psMetadata *input = psMetadataConfigRead (NULL, &nFail, infile, false);
     1044
     1045#ifdef notdef
     1046  fprintf (stderr, "---- input ----\n");
     1047  psMetadataPrint (stderr, input, 1);
     1048#endif
     1049
     1050  if (!pxCheckImportVersion(config, input)) {
     1051      psError(PS_ERR_UNKNOWN, false, "pxCheckImportVersion failed");
     1052      return false;
     1053  }
     1054
     1055  psMetadataItem *item = psMetadataLookup (input, "fullForceRun");
     1056  psAssert (item, "entry not in input?");
     1057  psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?");
     1058
     1059  psMetadataItem *entry = psListGet (item->data.list, 0);
     1060  assert (entry);
     1061  assert (entry->type == PS_DATA_METADATA);
     1062  fullForceRunRow *fullForceRun = fullForceRunObjectFromMetadata (entry->data.md);
     1063  fullForceRunInsertObject (config->dbh, fullForceRun);
     1064
     1065  // fprintf (stdout, "---- warp run ----\n");
     1066  // psMetadataPrint (stderr, entry->data.md, 1);
     1067
     1068  for (int i = 0; i < numImportTables; i++) {
     1069    item = psMetadataLookup (input, tables[i]);
     1070    psAssert (item, "entry not in input?");
     1071    psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?");
     1072
     1073    switch (i) {
     1074      case 0:
     1075        for (int i = 0; i < item->data.list->n; i++) {
     1076          entry = psListGet (item->data.list, i);
     1077          assert (entry);
     1078          assert (entry->type == PS_DATA_METADATA);
     1079          fullForceInputRow *fullForceInput = fullForceInputObjectFromMetadata (entry->data.md);
     1080          fullForceInputInsertObject (config->dbh, fullForceInput);
     1081
     1082          // fprintf (stdout, "---- row %d ----\n", i);
     1083          // psMetadataPrint (stderr, entry->data.md, 1);
     1084        }
     1085        break;
     1086
     1087      case 1:
     1088        for (int i = 0; i < item->data.list->n; i++) {
     1089          entry = psListGet (item->data.list, i);
     1090          assert (entry);
     1091          assert (entry->type == PS_DATA_METADATA);
     1092          fullForceResultRow *fullForceResult = fullForceResultObjectFromMetadata (entry->data.md);
     1093          fullForceResultInsertObject (config->dbh, fullForceResult);
     1094
     1095          // fprintf (stdout, "---- row %d ----\n", i);
     1096          // psMetadataPrint (stderr, entry->data.md, 1);
     1097        }
     1098        break;
     1099
     1100      case 2:
     1101        for (int i = 0; i < item->data.list->n; i++) {
     1102          entry = psListGet (item->data.list, i);
     1103          assert (entry);
     1104          assert (entry->type == PS_DATA_METADATA);
     1105          fullForceSummaryRow *fullForceSummary = fullForceSummaryObjectFromMetadata (entry->data.md);
     1106          fullForceSummaryInsertObject (config->dbh, fullForceSummary);
     1107
     1108          // fprintf (stdout, "---- row %d ----\n", i);
     1109          // psMetadataPrint (stderr, entry->data.md, 1);
     1110        }
     1111        break;
     1112    }
     1113  }
     1114  return true;
     1115}
  • branches/eam_branches/ipp-20140206/ippTools/src/fftool.h

    r36441 r36627  
    3636    FFTOOL_MODE_REVERTSUMMARY,
    3737    FFTOOL_MODE_UPDATESUMMARY,
    38     FFTOOL_MODE_SUMMARY
     38    FFTOOL_MODE_SUMMARY,
     39    FFTOOL_MODE_EXPORTRUN,
     40    FFTOOL_MODE_IMPORTRUN,
    3941} fftoolMode;
    4042
  • branches/eam_branches/ipp-20140206/ippTools/src/fftoolConfig.c

    r36441 r36627  
    186186    pxskycellAddArguments(revertsummaryArgs);
    187187
     188    // -exportrun
     189    psMetadata *exportrunArgs = psMetadataAlloc();
     190    psMetadataAddS64(exportrunArgs, PS_LIST_TAIL, "-ff_id", 0,          "export this full force ID (required)", 0);
     191    psMetadataAddStr(exportrunArgs, PS_LIST_TAIL, "-outfile", 0,          "export to this file (required)", NULL);
     192    psMetadataAddU64(exportrunArgs, PS_LIST_TAIL, "-limit",   0,          "limit result set to N items", 0);
     193//    psMetadataAddBool(exportrunArgs, PS_LIST_TAIL, "-clean",  0,          "export run in cleaned state", false);
     194
     195    // -importrun
     196    psMetadata *importrunArgs = psMetadataAlloc();
     197    psMetadataAddStr(importrunArgs, PS_LIST_TAIL, "-infile",  0,          "import from this file (required)", NULL);
     198
     199
     200
    188201    psFree(now);
    189202
     
    203216    PXOPT_ADD_MODE("-revertsummary", "revert faulted summary", FFTOOL_MODE_REVERTSUMMARY,  revertsummaryArgs);
    204217    PXOPT_ADD_MODE("-summary",       "list summary results", FFTOOL_MODE_SUMMARY,  summaryArgs);
     218    PXOPT_ADD_MODE("-exportrun",     "list summary results", FFTOOL_MODE_EXPORTRUN,  exportrunArgs);
     219    PXOPT_ADD_MODE("-importrun",     "list summary results", FFTOOL_MODE_IMPORTRUN,  importrunArgs);
    205220
    206221    if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
  • branches/eam_branches/ipp-20140206/ippTools/src/laptool.c

    r35568 r36627  
    11701170  // we only want projection cells which do not already of an entry
    11711171  psStringAppend(&query, "\nWHERE lapGroup.projection_cell IS NULL\n");
    1172   psStringAppend(&query, "\nORDER by projection_cell\n");
     1172  // Projection cell's don't have a convienient order. Queue runs in the order of lap_id
     1173  // psStringAppend(&query, "\nORDER by projection_cell\n");
     1174  psStringAppend(&query, "\nORDER by lap_id_0\n");
    11731175
    11741176  if (limit) {
     
    12891291    psFree(whereClause);
    12901292  }
     1293  psStringAppend(&query, "\nGROUP by projection_cell ORDER by MIN(lap_id)");
    12911294  if (limit) {
    12921295    psString limitString = psDBGenerateLimitSQL(limit);
  • branches/eam_branches/ipp-20140206/ippTools/src/remotetool.c

    r36536 r36627  
    149149    psFree(limitString);
    150150  }
    151   if (!p_psDBRunQueryF(config->dbh, query)) {
     151  if (!p_psDBRunQuery(config->dbh, query)) {
    152152    psError(PS_ERR_UNKNOWN, false, "database error");
    153153    psFree(query);
     
    313313{
    314314  PS_ASSERT_PTR_NON_NULL(config, false);
    315   PXOPT_LOOKUP_S64(remote_id,  config->args, "-remote_id",    true, false);
     315  // PXOPT_LOOKUP_S64(remote_id,  config->args, "-remote_id",    true, false);
    316316 
    317317  psMetadata *where = psMetadataAlloc();
     
    341341{
    342342  PS_ASSERT_PTR_NON_NULL(config, false);
    343   PXOPT_LOOKUP_S64(remote_id,  config->args, "-remote_id",    true, false);
     343  // PXOPT_LOOKUP_S64(remote_id,  config->args, "-remote_id",    true, false);
    344344 
    345345  psMetadata *where = psMetadataAlloc();
  • branches/eam_branches/ipp-20140206/ippconfig/recipes/filerules-split.mdc

    r36441 r36627  
    303303SKYCELL.TEMPLATE             OUTPUT {OUTPUT}.skycell                  SKYCELL         NONE       FPA        TRUE      NONE
    304304                                                                                                             
    305 PPSUB.OUTPUT                 OUTPUT {OUTPUT}.fits                     IMAGE           COMP_SUB   FPA        TRUE      NONE
     305PPSUB.OUTPUT                 OUTPUT {OUTPUT}.fits                     IMAGE           NONE       FPA        TRUE      NONE
    306306PPSUB.OUTPUT.MASK            OUTPUT {OUTPUT}.mask.fits                MASK            COMP_MASK  FPA        TRUE      NONE
    307307PPSUB.OUTPUT.VARIANCE        OUTPUT {OUTPUT}.wt.fits                  VARIANCE        COMP_WT    FPA        TRUE      NONE
     
    311311PPSUB.OUTPUT.JPEG2           OUTPUT {OUTPUT}.b2.jpg                   JPEG            NONE       FPA        TRUE      NONE
    312312PPSUB.OUTPUT.RESID.JPEG      OUTPUT {OUTPUT}.res.jpg                  JPEG            NONE       FPA        TRUE      NONE
    313 PPSUB.INVERSE                OUTPUT {OUTPUT}.inv.fits                 IMAGE           COMP_SUB   FPA        TRUE      NONE
     313PPSUB.INVERSE                OUTPUT {OUTPUT}.inv.fits                 IMAGE           NONE       FPA        TRUE      NONE
    314314PPSUB.INVERSE.MASK           OUTPUT {OUTPUT}.inv.mask.fits            MASK            COMP_MASK  FPA        TRUE      NONE
    315315PPSUB.INVERSE.VARIANCE       OUTPUT {OUTPUT}.inv.wt.fits              VARIANCE        COMP_WT    FPA        TRUE      NONE
  • branches/eam_branches/ipp-20140206/ippconfig/recipes/ppSub.config

  • branches/eam_branches/ipp-20140206/ippconfig/recipes/reductionClasses.mdc

  • branches/eam_branches/ipp-20140206/ppBackground/src/Makefile.am

    r28281 r36627  
    1 bin_PROGRAMS = ppBackground
     1bin_PROGRAMS = ppBackground ppBackgroundStack
    22
    33if HAVE_SVNVERSION
     
    2828ppBackground_LDFLAGS  = $(PSLIB_LIBS)   $(PSMODULE_LIBS)   $(PPSTATS_LIBS)   $(PSPHOT_LIBS)   $(PPBACKGROUND_LIBS)
    2929
     30ppBackgroundStack_CPPFLAGS = $(ppBackground_CPPFLAGS)
     31ppBackgroundStack_LDFLAGS = $(ppBackground_LDFLAGS)
     32
    3033ppBackground_SOURCES =          \
    3134        ppBackground.c          \
     
    3841        ppBackgroundErrorCodes.c        \
    3942        ppBackgroundExit.c
     43
     44ppBackgroundStack_SOURCES = \
     45        ppBackgroundStack.c \
     46        ppBackgroundStackArguments.c \
     47        ppBackgroundStackCamera.c \
     48        ppBackgroundStackData.c \
     49        ppBackgroundStackLoop.c \
     50        ppBackgroundStackMath.c \
     51        ppBackgroundVersion.c \
     52        ppBackgroundErrorCodes.c \
     53        ppBackgroundExit.c
     54
    4055
    4156noinst_HEADERS = \
  • branches/eam_branches/ipp-20140206/ppBackground/src/ppBackground.c

    r28280 r36627  
    1818    ppBackgroundErrorRegister();
    1919
     20    printf("Initializing data\n");
    2021    ppBackgroundData *data = ppBackgroundDataInit(&argc, argv);
    2122    if (!data) {
    2223        goto DIE;
    2324    }
    24 
     25    printf("Reading Arguments\n");
    2526    if (!ppBackgroundArguments(data, argc, argv)) {
    2627        goto DIE;
    2728    }
    28 
     29    printf("Setting up Camera\n");
    2930    if (!ppBackgroundCamera(data)) {
    3031        goto DIE;
    3132    }
    3233
     34    printf("Looping over data!\n");
    3335    if (!ppBackgroundLoop(data)) {
    3436        goto DIE;
  • branches/eam_branches/ipp-20140206/ppStack/src/ppStackReadout.c

    r34800 r36627  
    184184    psFree(stack);
    185185
     186    psLogMsg("ppStack", PS_LOG_INFO, "initial stack image sectionNum %d", sectionNum);
     187
    186188    sectionNum++;
    187189
     
    293295    psFree(stack);
    294296
     297    psLogMsg("ppStack", PS_LOG_INFO, "final stack image sectionNum %d", sectionNum);
     298
    295299    sectionNum++;
    296300
  • branches/eam_branches/ipp-20140206/ppSub/src/ppSubMatchPSFs.c

    r36441 r36627  
    156156    psLogMsg("ppSub", PS_LOG_INFO, "Input FWHM: %f\nReference FWHM: %f\n", inFWHM, refFWHM);
    157157    if (!isfinite(inFWHM) || !isfinite(refFWHM)) {
     158#ifdef SET_QUALITY_INSTEAD_OF_ERROR
    158159        psErrorStackPrint(stderr, "Cannot determine FHWM for images, giving up.");
    159160        int error = psErrorCodeLast(); // Error code
    160161        ppSubDataQuality(data, error, PPSUB_FILES_ALL);
    161162        return true;
     163#else
     164        psError(PPSUB_ERR_DATA, false, "Cannot determine FHWM for images, giving up.");
     165        return false;
     166#endif
    162167    }
    163168
  • branches/eam_branches/ipp-20140206/psLib/src/fits/psFitsImage.c

    r33645 r36627  
    753753    }   
    754754
     755    // If there is no options set, remove all our non-standard keywords, because no one asked for them.
     756    if (!options) {
     757      if (psMetadataLookup(header,"BOFFSET")) {
     758        psMetadataRemoveKey(header,"BOFFSET");
     759      }
     760      if (psMetadataLookup(header,"BSOFTEN")) {
     761        psMetadataRemoveKey(header,"BSOFTEN");
     762      }
     763    }     
     764   
    755765    // write the header, if any.
    756766    if (header && !psFitsWriteHeaderImage(fits, header, createPHU)) {
  • branches/eam_branches/ipp-20140206/psphot/src

  • branches/eam_branches/ipp-20140206/psphot/src/Makefile.am

    r36441 r36627  
    208208        psphotMakeGrowthCurve.c        \
    209209        psphotMagnitudes.c             \
     210        psphotLensing.c        \
    210211        psphotSetMaskBits.c            \
    211212        psphotSkyReplace.c             \
  • branches/eam_branches/ipp-20140206/psphot/src/psphot.h

    r36441 r36627  
    144144bool            psphotMagnitudesReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, pmReadout *readout, psArray *sources, pmPSF *psf);
    145145bool            psphotMagnitudes_Threaded (psThreadJob *job);
     146
     147bool            psphotLensing (pmConfig *config, const pmFPAview *view, const char *filerule);
     148bool            psphotLensingReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
     149bool            psphotLensingPSFtrendsReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
    146150
    147151bool            psphotEfficiency (pmConfig *config, const pmFPAview *view, const char *filerule);
  • branches/eam_branches/ipp-20140206/psphot/src/psphotApResid.c

    r34404 r36627  
    214214
    215215        // XXX make this user-configurable?
    216         if (source->psfMagErr > 0.01) continue;
     216        if (source->psfMagErr > 0.03) continue;
    217217
    218218        // aperture residual for this source
     
    267267
    268268    // set the max order (0 = constant) which the number of psf stars can support:
    269     // rule of thumb: require 3 stars per 'cell' (order+1)^2
     269    // we require only 3 stars for n = 0, increase stars / cell for higher order
    270270    int MaxOrderForStars = 0;
    271     if (Npsf >= 12) MaxOrderForStars = 1; // 4 cells
    272     if (Npsf >= 27) MaxOrderForStars = 2; // 9 cells
    273     if (Npsf >= 48) MaxOrderForStars = 3; // 16 cells
    274     if (Npsf >  75) MaxOrderForStars = 4; // 25 cells
     271    if (Npsf >=  16) MaxOrderForStars = 1; // 4 cells
     272    if (Npsf >=  54) MaxOrderForStars = 2; // 9 cells
     273    if (Npsf >= 128) MaxOrderForStars = 3; // 16 cells
     274    if (Npsf >= 300) MaxOrderForStars = 4; // 25 cells
     275    if (Npsf >  576) MaxOrderForStars = 5; // 36 cells
    275276
    276277    pmTrend2DMode mode = PM_TREND_MAP;
  • branches/eam_branches/ipp-20140206/psphot/src/psphotChoosePSF.c

    r35769 r36627  
    399399    char *modelName = pmModelClassGetName (psf->type);
    400400    psLogMsg ("psphot.pspsf", PS_LOG_WARN, "select psf model: %f sec\n", psTimerMark ("psphot.choose.psf"));
    401     psLogMsg ("psphot.pspsf", PS_LOG_INFO, "psf model %s, ApResid: %f +/- %f\n", modelName, psf->ApResid, psf->dApResid);
     401    psLogMsg ("psphot.pspsf", PS_LOG_INFO, "psf model %s, ApResid: %f +/- %f (%d x %d model)\n", modelName, psf->ApResid, psf->dApResid, psf->trendNx, psf->trendNy);
    402402
    403403    psFree (options);
  • branches/eam_branches/ipp-20140206/psphot/src/psphotCleanup.c

    r34086 r36627  
    2222    pmVisualCleanup ();
    2323    psLibFinalize();
     24#if (PS_TRACE_ON)
     25    // don't display memory leaks unless trace is on.
    2426    // fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "psphot");
    2527    fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "psphot");
     28#endif
    2629    return;
    2730}
  • branches/eam_branches/ipp-20140206/psphot/src/psphotReadout.c

    r36375 r36627  
    340340    // calculate source magnitudes
    341341    if (!psphotMagnitudes(config, view, filerule)) { // pass 1 (detections->allSources)
    342       psErrorStackPrint(stderr, "Unable to do magnitudes.");
     342        psErrorStackPrint(stderr, "Unable to do magnitudes.");
    343343        psErrorClear();
    344344    }
     345
     346    // calculate lensing parameters
     347    if (!psphotLensing(config, view, filerule)) {
     348        psErrorStackPrint(stderr, "Unable to do lensing parameters.");
     349        psErrorClear();
     350    }
     351
    345352    if (!psphotEfficiency(config, view, filerule)) { // pass 1
    346353        psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources");
     
    353360    // replace background in residual image
    354361    if (!psphotSkyReplace (config, view, filerule)) { // pass 1
    355       psErrorStackPrint(stderr, "Unable to replace sky");
    356       psErrorClear();
     362        psErrorStackPrint(stderr, "Unable to replace sky");
     363        psErrorClear();
    357364    }
    358365
    359366    // drop the references to the image pixels held by each source
    360367    if (!psphotSourceFreePixels (config, view, filerule)) { // pass 1
    361       psErrorStackPrint(stderr, "Unable to free source pixels");
    362       psErrorClear();
     368        psErrorStackPrint(stderr, "Unable to free source pixels");
     369        psErrorClear();
    363370    }
    364371
  • branches/eam_branches/ipp-20140206/psphot/src/psphotStackImageLoop.c

  • branches/eam_branches/ipp-20140206/psphot/src/psphotStackMatchPSFsNext.c

    r36128 r36627  
    105105        psLogMsg ("psphot", PS_LOG_INFO, "target FWHM (%f) is smaller than current FWHM (%f), not smoothing\n", targetFWHM, currentFWHM);
    106106        fwhmValues->data.F32[lastSize + 1] = currentFWHM;
     107        pmReadoutMaskInvalid(readout, maskVal, maskSat);
    107108        return false;
    108109    }
  • branches/eam_branches/ipp-20140206/psphot/src/psphotStackReadout.c

    r36375 r36627  
    391391
    392392                // re-measure the PSF for the smoothed image (using entries in 'allSources')
    393                 psphotChoosePSF (config, view, STACK_OUT, false);
     393                if (!psphotChoosePSF (config, view, STACK_OUT, false)) {
     394                    psLogMsg ("psphot", 3, "failure to construct a psf model in radial aperture loop for entry :%d", entry);
     395                    return psphotReadoutCleanup (config, view, STACK_RAW);
     396                }
    394397
    395398                // this is necessary to update the models based on the new PSF
  • branches/eam_branches/ipp-20140206/pstamp/scripts/pstamp_insert_request.pl

    r35487 r36627  
    4545my $pstamptool = can_run('pstamptool')  or (warn "Can't find pstamptool"  and $missing_tools = 1);
    4646my $fields = can_run('fields')  or (warn "Can't find fields"  and $missing_tools = 1);
     47my $fhead = can_run('fhead')  or (warn "Can't find fhead"  and $missing_tools = 1);
    4748
    4849if ($missing_tools) {
     
    5657    # Note that if it's a pstamp request then REQ_NAME should be defined.
    5758    # if it's a detectability query it will not have a REQ_NAME but will have a QUERY_ID
    58     my $command = "echo $tmp_req_file | $fields -x 0 EXTNAME EXTVER REQ_NAME QUERY_ID";
     59    # my $command = "echo $tmp_req_file | $fields -x 0 EXTNAME EXTVER REQ_NAME QUERY_ID";
     60    my $command = "$fhead -x 0 $tmp_req_file";
    5961    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    6062        run(command => $command, verbose => $verbose);
    61 if (0) {
    62     # stoopid fields doesn't set exit status to zero when it works
    6363    unless ($success) {
    6464        print STDERR @$stderr_buf;
    6565        exit $error_code >> 8;
    6666    }
    67 }
    6867    my $output = join "", @$stdout_buf;
    69     (undef, $extname, $extver, $req_name) = split " ", $output;
     68
     69
     70    my $makehash = 0;
     71    my %hash;
     72    foreach my $line (split "\n", $output) {
     73        chomp $line;
     74        # split lines inte left and right using equals sign. left is the keyword
     75        my ($key, $right) = split "=", $line;
     76            # skip if there was no '='
     77        next if !$right;
     78
     79        $key =~ s/ //g;
     80
     81        # separate value from comment
     82        my ($value, $comment) = split "/", $right;
     83        # remove ' and space characters from key and value
     84        $value =~ s/'//g;
     85        $value =~ s/ //g;
     86
     87        #    print "$key $value\n";
     88
     89        # extract the values that we are looking for
     90        $extname  = $value if ($key eq "EXTNAME");
     91        $extver   = $value if ($key eq "EXTVER");
     92        $req_name = $value if ($key eq "REQ_NAME");
     93        $req_name = $value if ($key eq "QUERY_ID");
     94
     95        # optionally build hash. Duplicate keys get the last value seen
     96        if ($makehash) {
     97            $hash{$key} = $value;
     98        }
     99    }
     100
     101    # (undef, $extname, $extver, $req_name) = split " ", $output;
     102
    70103    if (!$extname or ! (($extname eq "PS1_PS_REQUEST") or ($extname eq "MOPS_DETECTABILITY_QUERY"))) {
    71104        print STDERR "invalid request file\n";
     105        print "invalid request file\n";
    72106        exit $PS_EXIT_DATA_ERROR;
    73107    }
     108
    74109    if (!defined $req_name) {
    75110        print STDERR "invalid request file no REQ_NAME or QUERY_ID\n";
     111        print "invalid request file no REQ_NAME or QUERY_ID\n";
     112        exit $PS_EXIT_DATA_ERROR;
     113    }
     114    if (!defined $extver) {
     115        print STDERR "invalid request file no EXTVER found\n";
     116        print "invalid request file no EXTVER found\n";
    76117        exit $PS_EXIT_DATA_ERROR;
    77118    }
     
    119160
    120161exit 0;
     162
    121163# Ask the database for the next web request number
    122164sub get_webreq_num
  • branches/eam_branches/ipp-20140206/pstamp/scripts/pstampparse.pl

    r36165 r36627  
    243243my $watch_for_big_requests = (!($label =~ /BIG/) and ($label =~ /PSI/ or $label =~ /WEB/));
    244244
    245 my $big_limit = 100;    # XXX: this should be in a configuration file somewhere not hard coded
     245# XXX: these should be in a configuration file somewhere not hard coded
     246my $big_limit = 100;
     247my $job_big_limit = 400;
    246248
    247249if ($watch_for_big_requests and $nRows > $big_limit) {
     
    267269
    268270    # see whether number of jobs limit for high priority request was exceeded
    269     if ($watch_for_big_requests and $num_jobs > $big_limit) {
     271    if ($watch_for_big_requests and $num_jobs > $job_big_limit) {
    270272        $label = change_to_lower_priority_label($label);
    271273        $watch_for_big_requests = 0;
     
    311313    my $rownum   = $row->{ROWNUM};
    312314    if (!validID($rownum)) {
     315        $rownum = 'NULL' if !defined $rownum;
    313316        print STDERR "$rownum is not a valid ROWNUM\n";
    314317        insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST);
     
    316319    }
    317320    my $job_type = $row->{JOB_TYPE};
    318     if (($job_type ne "stamp") and ($job_type ne "get_image")) {
     321    if (!defined $job_type || (($job_type ne "stamp") and ($job_type ne "get_image"))) {
     322        $job_type = 'NULL' if !defined $job_type;
    319323        print STDERR "$job_type is not a valid JOB_TYPE\n";
    320324        insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST);
     
    325329    if (($req_type ne "byid") and ($req_type ne "bycoord") and ($req_type ne "byexp") and
    326330        ($req_type ne "byskycell") and ($req_type ne "bydiff")) {
     331        $req_type = 'NULL' if !defined $req_type;
    327332        print STDERR "$req_type is not a valid REQ_TYPE\n";
    328333        insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST);
  • branches/eam_branches/ipp-20140206/tools/dlapstacks

    r34358 r36627  
    1414
    1515my $label;
    16 my $label1  = 'LAP.ThreePi.20120706';
    17 my $label2  = 'LAP.ThreePi.20110809';
     16my $label1  = 'LAP.ThreePi.20130717';
     17my $label2  = 'LAP.ThreePi.20120706';
    1818my $tess_id = 'RINGS.V3';
    1919
  • branches/eam_branches/ipp-20140206/tools/fixburntool

    r36045 r36627  
    107107{
    108108    my $command = "$burntool --exp_id $exp_id --class_id $class_id --this_uri $uri --previous_uri $prev_uri";
     109    $command .= " --verbose" if $verbose;
    109110    print "$command\n";
    110111    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
Note: See TracChangeset for help on using the changeset viewer.