IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 12, 2009, 4:07:48 PM (17 years ago)
Author:
Paul Price
Message:

Reworking magic (and some diff) to be ready for performing magic on warp-warp diffs. Several database changes to diff and magic tables because we can no longer assume that a diff is associated with a single exposure. Ready for testing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_magic/ippTools/share/magictool_inputs.sql

    r23886 r24149  
    1 SELECT *
    2 FROM (
    3 -- Single skycells
     1-- Get input details for a magic node
    42SELECT
    53    magicRun.magic_id,
    6     magicRun.state,
    7     magicInputSkyfile.node,
    8     diffSkyfile.diff_id,
    9     diffSkyfile.uri,
    10     diffSkyfile.path_base,
    11     diffSkyfile.fault,
    12     diffSkyfile.quality
     4    magicRun.inverse, -- Using the inverse subtraction?
     5    magicRun.diff_id,
     6    magicInputs.node,
     7    -- Only one of diff_path_base and magic_path_base should be non-NULL
     8    -- If diff_path_base is non-NULL, then only one of warp_path_base and stack_path_base should be non-NULL
     9    magicInputs.diff_path_base, -- path_base for the diff (if any)
     10    magicInputs.warp_path_base, -- path_base for the template warp (if any)
     11    magicInputs.stack_path_base, -- path_base for the template stack (if any)
     12    magicInputs.magic_path_base -- path_base for child nodes (if any)
    1313FROM magicRun
    14 JOIN magicInputSkyfile
    15 USING(magic_id)
    16 JOIN diffSkyfile
    17     ON magicInputSkyfile.diff_id = diffSkyfile.diff_id
    18     AND magicInputSkyfile.node = diffSkyfile.skycell_id
    19 UNION
    20 -- Merged skycells
    21 SELECT
    22     magicRun.magic_id,
    23     magicRun.state,
    24     magicTree.node,
    25     0,   -- no diff_id
    26     magicNodeResult.uri,
    27     NULL, -- magicNodeResult doesn't have a path_base
    28     magicNodeResult.fault,
    29     0 as quality
    30 FROM magicTree
    31 JOIN magicRun
    32     USING(magic_id)
    33 JOIN magicNodeResult
    34     ON magicTree.magic_id = magicNodeResult.magic_id
    35     AND magicTree.dep = magicNodeResult.node
    36 ) as Foo
    37 WHERE
    38     fault = 0
    39     AND quality = 0
     14JOIN (
     15    -- Single skycells: have uri=NULL
     16    SELECT
     17        magic_id,
     18        magicRun.diff_id,
     19        skycell_id AS node,
     20        diffSkyfile.path_base AS diff_path_base,
     21        warpSkyfile.path_base AS warp_path_base,
     22        stackSumSkyfile.path_base AS stack_path_base,
     23        NULL AS magic_path_base
     24    FROM magicRun
     25    JOIN magicTree USING(magic_id)
     26    JOIN magicInputSkyfile USING(magic_id, node)
     27    JOIN diffRun USING(diff_id)
     28    JOIN diffSkyfile
     29        ON diffSkyfile.diff_id = magicRun.diff_id
     30        AND diffSkyfile.skycell_id = magicInputSkyfile.node
     31    JOIN magicNodeResult USING(magic_id, node)
     32    JOIN (
     33        -- Template for non-inverse
     34        SELECT
     35            magic_id,
     36            skycell_id,
     37            warp1 AS warp_id,
     38            stack1 AS stack_id
     39        FROM magicRun
     40        JOIN diffInputSkyfile USING(diff_id)
     41        WHERE magicRun.inverse = 0
     42            -- WHERE hook (magicRun.magic_id, diffInputSkyfile.skycell_id) %s
     43        UNION
     44        -- Template for inverse
     45        SELECT
     46            magic_id,
     47            skycell_id,
     48            warp2 AS warp_id,
     49            stack2 AS stack_id
     50        FROM magicRun
     51        JOIN diffInputSkyfile USING(diff_id)
     52        WHERE magicRun.inverse = 1
     53            -- WHERE hook (magicRun.magic_id, diffInputSkyfile.skycell_id) %s
     54        ) AS diffTemplates USING(magic_id, skycell_id)
     55    LEFT JOIN warpSkyfile USING(warp_id, skycell_id)
     56    LEFT JOIN stackSumSkyfile USING(stack_id)
     57    -- WHERE hook (magicRun.magic_id, magicTree.node) %s
     58    UNION
     59    -- Merged skycells: have diff_id=0, various_path_base=NULL
     60    SELECT
     61        magicTree.magic_id,
     62        0 AS diff_id,
     63        magicTree.dep,
     64        NULL AS diff_path_base,
     65        NULL AS warp_path_base,
     66        NULL AS stack_path_base,
     67        magicNodeResult.path_base
     68    FROM magicTree
     69    JOIN magicRun USING(magic_id)
     70    JOIN magicNodeResult
     71        ON magicTree.magic_id = magicNodeResult.magic_id
     72        AND magicTree.dep = magicNodeResult.node
     73    -- WHERE hook (magicRun.magic_id, magicTree.node) %s
     74    ) AS magicInputs USING(magic_id)
Note: See TracChangeset for help on using the changeset viewer.