IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2009, 6:15:31 PM (17 years ago)
Author:
beaumont
Message:

merged with head

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/ppStack

  • branches/cnb_branches/cnb_branch_20090301/ppStack/src/ppStackSources.c

    r23352 r23594  
    99//#define TESTING                         // Enable debugging output
    1010
     11#ifdef TESTING
    1112// Size of fake image; set by hand because it's trouble to get it from other places
    1213#define FAKE_COLS 4861
    1314#define FAKE_ROWS 4913
     15#endif
    1416
    1517#ifdef TESTING
     
    5355
    5456
    55 float ppStackSourcesTransparency(const psArray *sourceLists, psVector *inputMask,
    56                                  const pmFPAview *view, const pmConfig *config)
     57bool ppStackSourcesTransparency(ppStackOptions *options, const pmFPAview *view, const pmConfig *config)
    5758{
    58     PS_ASSERT_ARRAY_NON_NULL(sourceLists, NAN);
    59     PS_ASSERT_VECTOR_NON_NULL(inputMask, NAN);
    60     PS_ASSERT_VECTOR_TYPE(inputMask, PS_TYPE_U8, NAN);
    61     PS_ASSERT_VECTOR_SIZE(inputMask, sourceLists->n, NAN);
    62     PS_ASSERT_PTR_NON_NULL(view, NAN);
    63     PS_ASSERT_PTR_NON_NULL(config, NAN);
     59    PS_ASSERT_PTR_NON_NULL(options, false);
     60    PS_ASSERT_PTR_NON_NULL(view, false);
     61    PS_ASSERT_PTR_NON_NULL(config, false);
     62
     63    psArray *sourceLists = options->sourceLists; // Source lists for each input
     64    psVector *inputMask = options->inputMask; // Mask for inputs
     65
     66    PS_ASSERT_ARRAY_NON_NULL(sourceLists, false);
     67    PS_ASSERT_VECTOR_NON_NULL(inputMask, false);
     68    PS_ASSERT_VECTOR_TYPE(inputMask, PS_TYPE_U8, false);
     69    PS_ASSERT_VECTOR_SIZE(inputMask, sourceLists->n, false);
    6470
    6571#if defined(TESTING) && 0
     
    100106    if (!airmassZP) {
    101107        psError(PS_ERR_UNKNOWN, false, "Unable to find ZP.AIRMASS in recipe.");
    102         return NAN;
     108        return false;
    103109    }
    104110
     
    139145                    exptime, airmass, expFilter);
    140146            psFree(zp);
    141             return NAN;
     147            return false;
    142148        }
    143149
     
    149155                        "Unable to find airmass term (ZP.AIRMASS) for filter %s", filter);
    150156                psFree(zp);
    151                 return NAN;
     157                return false;
    152158            }
    153159        } else if (strcmp(filter, expFilter) != 0) {
    154160            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Filters don't match: %s vs %s", filter, expFilter);
    155161            psFree(zp);
    156             return NAN;
     162            return false;
    157163        }
    158164
     
    160166        sumExpTime += exptime;
    161167    }
     168
     169    options->sumExposure = sumExpTime;
    162170
    163171    psArray *matches = pmSourceMatchSources(sourceLists, radius, true); // List of matches
     
    165173        psError(PS_ERR_UNKNOWN, false, "Unable to match sources");
    166174        psFree(zp);
    167         return NAN;
     175        return false;
    168176    }
    169177
     
    177185    if (!trans) {
    178186        psError(PS_ERR_UNKNOWN, false, "Unable to measure transparencies");
    179         return NAN;
     187        return false;
    180188    }
    181189
     
    186194    for (int i = 0; i < trans->n; i++) {
    187195        if (!isfinite(trans->data.F32[i])) {
    188             inputMask->data.U8[i] = PPSTACK_MASK_CAL;
     196            inputMask->data.U8[i] |= PPSTACK_MASK_CAL;
    189197        }
    190198    }
     
    223231    // m_0 = m_1 + zp_1 + trans_1 - c1 * airmass_0 - 2.5log(t_0)
    224232    // We don't need to know the magnitude zero point for the filter, since it cancels out
     233    options->norm = psVectorAlloc(num, PS_TYPE_F32);
    225234    for (int i = 0; i < num; i++) {
    226235        if (!isfinite(trans->data.F32[i])) {
     
    229238        psArray *sources = sourceLists->data[i]; // Sources of interest
    230239        float magCorr = airmassTerm - 2.5*log10(sumExpTime) - zp->data.F32[i] - trans->data.F32[i];
     240        options->norm->data.F32[i] = magCorr;
    231241        psLogMsg("ppStack", PS_LOG_INFO, "Applying magnitude correction to image %d: %f\n", i, magCorr);
    232242
     
    248258            psError(PS_ERR_UNKNOWN, false, "Unable to match sources");
    249259            psFree(zp);
    250             return NAN;
     260            return false;
    251261        }
    252262        psVector *trans = pmSourceMatchRelphot(matches, zp, iter, tol, starLimit, transIter, transRej,
     
    259269#endif
    260270
    261     return sumExpTime;
     271    return true;
    262272}
Note: See TracChangeset for help on using the changeset viewer.