IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24274


Ignore:
Timestamp:
May 28, 2009, 2:17:52 PM (17 years ago)
Author:
Paul Price
Message:

When running under 'minimal' mode, want to find sources with the second (lower) threshold.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmFootprintArraysMerge.c

    r20937 r24274  
    2828 */
    2929psArray *pmFootprintArraysMerge(const psArray *footprints1, // one set of footprints
    30                                 const psArray *footprints2, // the other set
    31                                 const int includePeaks) { // which peaks to set? 0x1 => footprints1, 0x2 => 2
    32     assert (footprints1->n == 0 || pmFootprintTest(footprints1->data[0]));
    33     assert (footprints2->n == 0 || pmFootprintTest(footprints2->data[0]));
     30                                const psArray *footprints2, // the other set
     31                                const int includePeaks // which peaks to set? 0x1 => footprints1, 0x2 => 2
     32    )
     33{
     34    if (!footprints1 && !footprints2) {
     35        // No footprints in merged array
     36        return psArrayAllocEmpty(0);
     37    }
    3438
    35     if (footprints1->n == 0 || footprints2->n == 0) {           // nothing to do but put copies on merged
    36         const psArray *old = (footprints1->n == 0) ? footprints2 : footprints1;
     39    assert(!footprints1 || footprints1->n == 0 || pmFootprintTest(footprints1->data[0]));
     40    assert(!footprints2 || footprints2->n == 0 || pmFootprintTest(footprints2->data[0]));
    3741
    38         psArray *merged = psArrayAllocEmpty(old->n);
    39         for (int i = 0; i < old->n; i++) {
    40             psArrayAdd(merged, 1, old->data[i]);
    41         }
    42        
    43         return merged;
     42    if (!footprints1 || footprints1->n == 0 || !footprints2 || footprints2->n == 0) {
     43        // nothing to do but put copies on merged
     44        const psArray *old = (!footprints1 || footprints1->n == 0) ? footprints2 : footprints1;
     45
     46        psArray *merged = psArrayAllocEmpty(old->n);
     47        for (int i = 0; i < old->n; i++) {
     48            psArrayAdd(merged, 1, old->data[i]);
     49        }
     50
     51        return merged;
    4452    }
    4553    /*
     
    4856     */
    4957    {
    50         pmFootprint *fp1 = footprints1->data[0];
    51         pmFootprint *fp2 = footprints2->data[0];
    52         if (fp1->region.x0 != fp2->region.x0 ||
    53             fp1->region.x1 != fp2->region.x1 ||
    54             fp1->region.y0 != fp2->region.y0 ||
    55             fp1->region.y1 != fp2->region.y1) {
    56             psError(PS_ERR_BAD_PARAMETER_SIZE, true,
    57                     "The two pmFootprint arrays correspnond to different-sized regions");
    58             return NULL;
    59         }
     58        pmFootprint *fp1 = footprints1->data[0];
     59        pmFootprint *fp2 = footprints2->data[0];
     60        if (fp1->region.x0 != fp2->region.x0 ||
     61            fp1->region.x1 != fp2->region.x1 ||
     62            fp1->region.y0 != fp2->region.y0 ||
     63            fp1->region.y1 != fp2->region.y1) {
     64            psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     65                    "The two pmFootprint arrays correspnond to different-sized regions");
     66            return NULL;
     67        }
    6068    }
    6169    /*
     
    7280     * Now assign the peaks appropriately.  We could do this more efficiently
    7381     * using idImage (which we just freed), but this is easy and probably fast enough
    74      */ 
     82     */
    7583    if (includePeaks & 0x1) {
    76         psArray *peaks = pmFootprintArrayToPeaks(footprints1);
    77         pmFootprintsAssignPeaks(merged, peaks);
    78         psFree(peaks);
     84        psArray *peaks = pmFootprintArrayToPeaks(footprints1);
     85        pmFootprintsAssignPeaks(merged, peaks);
     86        psFree(peaks);
    7987    }
    8088
    8189    if (includePeaks & 0x2) {
    82         psArray *peaks = pmFootprintArrayToPeaks(footprints2);
    83         pmFootprintsAssignPeaks(merged, peaks);
    84         psFree(peaks);
     90        psArray *peaks = pmFootprintArrayToPeaks(footprints2);
     91        pmFootprintsAssignPeaks(merged, peaks);
     92        psFree(peaks);
    8593    }
    86    
     94
    8795    return merged;
    8896}
  • trunk/psphot/src/psphotFindFootprints.c

    r21366 r24274  
    5959
    6060        psArray *mergedFootprints = pmFootprintArraysMerge(detections->footprints, footprints, includePeaks);
    61         psLogMsg ("psphot", PS_LOG_MINUTIA, "merged %ld new footprints with %ld existing ones: %f sec\n", footprints->n, detections->footprints->n, psTimerMark ("psphot.footprints"));
     61        psLogMsg ("psphot", PS_LOG_MINUTIA, "merged %ld new footprints with %ld existing ones: %f sec\n", footprints->n, (detections->footprints ? detections->footprints->n : 0), psTimerMark ("psphot.footprints"));
    6262
    6363        psFree(footprints);
  • trunk/psphot/src/psphotReadoutMinimal.c

    r23442 r24274  
    4646
    4747    // find the detections (by peak and/or footprint) in the image.
    48     pmDetections *detections = psphotFindDetections (NULL, readout, recipe);
     48    pmDetections *detections = pmDetectionsAlloc(); // New detections; allocated to ensure pass=2
     49    detections = psphotFindDetections(detections, readout, recipe);
    4950    if (!detections) {
    5051        psLogMsg ("psphot", 3, "unable to find detections in this image");
Note: See TracChangeset for help on using the changeset viewer.