IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 18, 2010, 5:06:01 PM (16 years ago)
Author:
watersc1
Message:

Almost working version of the mask-stats/software revision code.

Almost.

Location:
branches/czw_branch/20100427
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20100427

  • branches/czw_branch/20100427/ippTools/src/warptool.c

    r27784 r28017  
    177177            registered,
    178178            0,       // magicked
    179             note
     179            NULL,     // software version
     180            0,       // mask stat npix
     181            NAN,        // static
     182            NAN,        // dynamic
     183            NAN,        // magic
     184            NAN,        // advisory
     185            note
    180186    );
    181187    if (!warpRun) {
     
    248254    PXOPT_COPY_F64(config->args,   where, "-posang_max",         "rawExp.posang",         "<");
    249255    PXOPT_COPY_STR(config->args,   where, "-object",             "rawExp.object",         "==");
     256    PXOPT_COPY_STR(config->args,   where, "-comment",            "rawExp.comment",        "LIKE");
     257    PXOPT_COPY_STR(config->args,   where, "-obs_mode",           "rawExp.obs_mode",       "LIKE");
    250258    PXOPT_COPY_F32(config->args,   where, "-sun_angle_min",      "rawExp.sun_angle",      ">=");
    251259    PXOPT_COPY_F32(config->args,   where, "-sun_angle_max",      "rawExp.sun_angle",      "<");
     
    273281    PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false);
    274282    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     283    PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false);
    275284
    276285    // check mode
     
    310319    if (!psArrayLength(output)) {
    311320        psTrace("warptool", PS_LOG_INFO, "no rows found");
     321        psFree(output);
     322        return true;
     323    }
     324
     325    if (pretend) {
     326        // negative simple so the default is true
     327        if (!ippdbPrintMetadatas(stdout, output, "rawExp", !simple)) {
     328            psError(PS_ERR_UNKNOWN, false, "failed to print array");
     329            psFree(output);
     330            return false;
     331        }
    312332        psFree(output);
    313333        return true;
     
    925945        // to avoid slow queries and to the query itself
    926946        // to satisfy the user's requested limit
    927         psStringAppend(&limitString, psDBGenerateLimitSQL(limit));
     947        psStringAppend(&limitString, "%s", psDBGenerateLimitSQL(limit));
    928948        psStringAppend(&query, " %s", limitString);
    929949    }
     
    10121032    PXOPT_LOOKUP_STR(ver_streaks, config->args, "-ver_streaks", false, false);
    10131033
     1034    PXOPT_LOOKUP_S32(maskfrac_npix, config->args, "-maskfrac_npix", false, false);
     1035    PXOPT_LOOKUP_F32(maskfrac_static, config->args, "-maskfrac_static", false, false);
     1036    PXOPT_LOOKUP_F32(maskfrac_dynamic, config->args, "-maskfrac_dynamic", false, false);
     1037    PXOPT_LOOKUP_F32(maskfrac_magic, config->args, "-maskfrac_magic", false, false);
     1038    PXOPT_LOOKUP_F32(maskfrac_advisory, config->args, "-maskfrac_advisory", false, false);
     1039
    10141040    psTrace("czw.test",1,"Received versions: pslib %s psmodules %s psphot %s ppstats %s pswarp %s streaks %s\n",
    10151041            ver_pslib,ver_psmodules,ver_psphot,ver_ppstats,ver_pswarp,ver_streaks);
    1016    
     1042    psString ver_code = NULL;
     1043    if ((ver_pslib)&&(ver_psmodules)) {
     1044      ver_code = pxMergeCodeVersions(ver_pslib,ver_psmodules);
     1045    }
     1046    if (ver_psphot) {
     1047      ver_code = pxMergeCodeVersions(ver_code,ver_psphot);
     1048    }
     1049    if (ver_ppstats) {
     1050      ver_code = pxMergeCodeVersions(ver_code,ver_ppstats);
     1051    }
     1052    if (ver_pswarp) {
     1053      ver_code = pxMergeCodeVersions(ver_code,ver_pswarp);
     1054    }
     1055    if (ver_streaks) {
     1056      ver_code = pxMergeCodeVersions(ver_code,ver_streaks);
     1057    }
    10171058   
    10181059    // default values
     
    10491090                           fault,
    10501091                           quality,
    1051                            magicked
    1052 /*                         magicked, */
    1053 /*                         ver_pslib, */
    1054 /*                         ver_psmodules, */
    1055 /*                         ver_psphot, */
    1056 /*                         ver_ppstats, */
    1057 /*                         ver_pswarp, */
    1058 /*                         ver_streaks */
     1092                           magicked,
     1093                           ver_code,
     1094                           maskfrac_npix,
     1095                           maskfrac_static,
     1096                           maskfrac_dynamic,
     1097                           maskfrac_magic,
     1098                           maskfrac_advisory
    10591099        )) {
    10601100        if (!psDBRollback(config->dbh)) {
     
    11211161        bool status;
    11221162        psS64 warp_id = psMetadataLookupS64(&status, row, "warp_id");
     1163
     1164        psString software_ver = NULL;
     1165        psS32 maskfrac_npix = 0;
     1166        psF32 maskfrac_static = 0;
     1167        psF32 maskfrac_dynamic = 0;
     1168        psF32 maskfrac_magic = 0;
     1169        psF32 maskfrac_advisory = 0;
     1170
     1171        // Calculate run level masking and software state
     1172        if (!pxCoalesceRunStatus(config,"warptool_coalesce_run.sql",warp_id,
     1173                                 &software_ver,&maskfrac_npix,
     1174                                 &maskfrac_static,&maskfrac_dynamic,
     1175                                 &maskfrac_magic,&maskfrac_advisory)) {
     1176          psError(PS_ERR_UNKNOWN, false, "failed to generate run level statistics");
     1177          psFree(output);
     1178          if (!psDBRollback(config->dbh)) {
     1179            psError(PS_ERR_UNKNOWN, false, "database error");
     1180          }
     1181          return(false);
     1182        }
     1183        // Set warpRun.software_ver to the appropriate value
     1184        if (!pxSetRunSoftware(config, "warpRun", "warp_id", warp_id, software_ver)) {
     1185          psError(PS_ERR_UNKNOWN, false, "failed to set warpRun.software_ver for warp_id: %" PRId64,
     1186                  warp_id);
     1187          psFree(output);
     1188          if (!psDBRollback(config->dbh)) {
     1189            psError(PS_ERR_UNKNOWN, false, "database error");
     1190          }
     1191          return(false);
     1192        }
     1193        // Set warpRun.maskfrac* to the appropriate values.
     1194        if (!pxSetRunMaskfrac(config, "warpRun", "warp_id", warp_id, maskfrac_npix, maskfrac_static,
     1195                              maskfrac_dynamic, maskfrac_magic, maskfrac_advisory)) {
     1196          psError(PS_ERR_UNKNOWN, false, "failed to set warpRun.software_ver for warp_id: %" PRId64,
     1197                  warp_id);
     1198          psFree(output);
     1199          if (!psDBRollback(config->dbh)) {
     1200            psError(PS_ERR_UNKNOWN, false, "database error");
     1201          }
     1202          return(false);
     1203        }       
     1204
     1205       
    11231206        if (!status) {
    11241207            psError(PS_ERR_UNKNOWN, false, "failed to look up value for warp_id");
Note: See TracChangeset for help on using the changeset viewer.