IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 16, 2024, 6:55:34 AM (3 years ago)
Author:
eugene
Message:

working on xcfftool

Location:
branches/eam_branches/ipp-20230313/ippTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/ippTools/share/xcfftool_definebyquery.sql

    r42587 r42594  
    1313    JOIN skycell                USING (tess_id, skycell_id)
    1414    -- join hook %s
     15    -- for no-rerun:
     16    -- LEFT JOIN xcForceRun ON xcForceRun.xccal_id = %s.xccalRun.xccal_id
    1517WHERE
    16     %s.xcstackCamera.camera = 'test_cam1' AND
     18    -- the first %s below should be filled with the xcamera database
     19    -- the second should be the name of the camera corresponding to the
     20    -- database in which the tool is run
     21    %s.xcstackCamera.camera = '%s' AND
    1722    %s.xccalRun.state = 'full' AND
    1823    %s.xccalResult.quality = 0
    19 
     24-- 'where' string is appended here
     25    -- for no-rerun, also append:
     26    -- AND xcff_id IS NULL
    2027
    2128-- this query is run in the database in which the original stacks were made (e.g., gpc1)
    22 -- it refers to the database used to generate the xcstacks (e.g., xcamera)
     29-- the external database (%s in front of the xcstackRun & xccalRun tables) refers to the database
     30-- used to generate the xcstacks (e.g., xcamera)
  • branches/eam_branches/ipp-20230313/ippTools/src/xcfftool.c

    r42591 r42594  
    105105}
    106106
    107 // NOTE: if I denormalize and populate (tess_id, skycell_id) in xcForceRun the  I do not need
     107// NOTE: if I denormalize and populate (tess_id, skycell_id) in xcForceRun then I do not need
    108108// to join back to xcstackRun to get that info
    109109static bool definebyqueryMode(pxConfig *config)
     
    131131    PXOPT_LOOKUP_STR(reduction,   config->args, "-set_reduction", false, false);
    132132
    133     // XXX is the needed or wanted?
     133    // XXX is needed or wanted?
    134134    // PXOPT_LOOKUP_STR(sources_path_base,   config->args, "-set_sources_path_base", false, false);
     135
     136    // first, we need to select the xccalRun(s) which need to have xcForceRuns.  we can limit the selection based on
     137    // qualities of the xccalRun or the xcstackRun.  There will be one xcForceRun for each
     138    // identified xccalRun.
    135139
    136140    psMetadata *xccalWhereMD = psMetadataAlloc();
     
    145149    }
    146150
    147     // XXX do these need to specify stackRun?  can the filters be different between stackRun and xcstackRun?
    148151    PXOPT_COPY_STR(config->args, xccalWhereMD, "-select_skycell_id",    "xcstackRun.skycell_id",      "LIKE");
    149152    PXOPT_COPY_STR(config->args, xccalWhereMD, "-select_tess_id",       "xcstackRun.tess_id",         "==");
     
    155158    }
    156159
     160    // once we have identified the xccalRun(s) for which we will generate the xcForceRuns, we
     161    // need to select the input warps.  Normally, these would be all warps used to generate all
     162    // stacks used to generate the xcstack skyfile associated with the xccalRun.  But we have
     163    // the options to limit which warps we actually include. 
     164
    157165    psMetadata *warpWhereMD = psMetadataAlloc();
    158166    pxAddLabelSearchArgs(config, warpWhereMD, "-select_warp_label",      "warpRun.label",           "LIKE");
    159167    pxAddLabelSearchArgs(config, warpWhereMD, "-select_warp_data_group", "warpRun.data_group",      "LIKE");
    160168    PXOPT_COPY_S64(config->args, warpWhereMD, "-select_warp_id",         "warpRun.warp_id",         "==");
     169    // XXX is is really necessary to limit the warps?
    161170    if (!psListLength(warpWhereMD->list)) {
    162171        psError(PXTOOLS_ERR_CONFIG, false, "warp search parameters are required");
     
    166175    }
    167176    PXOPT_COPY_F32(config->args, warpWhereMD, "-select_good_frac_min",   "warpSkyfile.good_frac",  ">=");
    168     // XXX do I need these or not?  the warp skyfiles need to match the stack skycells
    169     PXOPT_COPY_STR(config->args, warpWhereMD, "-select_tess_id",         "warpRun.tess_id",        "==");
    170     pxAddLabelSearchArgs(config, warpWhereMD, "-select_filter",          "rawExp.filter",          "LIKE");
    171177
    172178    PXOPT_LOOKUP_BOOL(rerun, config->args, "-rerun", false);
     
    186192    psStringAppend(&where, "\nAND %s", whereClause);
    187193    psStringAppend(&select, " %s", where);
     194
    188195    psFree(whereClause);
    189196    psFree(xccalWhereMD);
     
    192199    if (!rerun) {
    193200      psStringAppend(&joinHook, "\nLEFT JOIN xcForceRun ON xcForceRun.xccal_id = %s.xccalRun.xccal_id", xcamera);
     201    }
     202
     203    psStringAppend(&joinHook, "\n %s, where);
     204
     205    if (
    194206        psStringAppend(&joinHook, "\n %s\nAND xcForceRun.label = '%s'", where, label);
    195207        psStringAppend(&select, "\nAND ff_id IS NULL");
Note: See TracChangeset for help on using the changeset viewer.