IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18884


Ignore:
Timestamp:
Aug 4, 2008, 11:12:16 AM (18 years ago)
Author:
Paul Price
Message:

Removing print to stderr outside of trace.

Location:
trunk/pswarp/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpTransformReadout.c

    r18839 r18884  
    2020
    2121    // output mask bits
    22     psMaskType maskIn   = psMetadataLookupU8(&mdok, recipe, "MASK.INPUT"); 
    23     psMaskType maskPoor = pmConfigMaskGet("POOR.WARP", config); 
    24     psMaskType maskBad  = pmConfigMaskGet("BAD.WARP", config); 
     22    psMaskType maskIn   = psMetadataLookupU8(&mdok, recipe, "MASK.INPUT");
     23    psMaskType maskPoor = pmConfigMaskGet("POOR.WARP", config);
     24    psMaskType maskBad  = pmConfigMaskGet("BAD.WARP", config);
    2525    psAssert (mdok, "MASK.INPUT was not defined");
    2626
     
    2929
    3030    // Flux fraction for "poor"
    31     float poorFrac = psMetadataLookupF32(NULL, config->arguments, "POOR.FRAC"); 
     31    float poorFrac = psMetadataLookupF32(NULL, config->arguments, "POOR.FRAC");
    3232
    3333    // pswarpMapGridFromImage builds a set of locally-linear maps which convert the
     
    4343
    4444    if (input->weight && !output->weight) {
    45         output->weight = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_F32);
    46         psImageInit(output->weight, NAN);
     45        output->weight = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_F32);
     46        psImageInit(output->weight, NAN);
    4747    }
    4848    if ((input->mask || maskPoor || maskBad) && !output->mask) {
    49         output->mask = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_MASK);
    50         psImageInit(output->mask, maskBad);
     49        output->mask = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_MASK);
     50        psImageInit(output->mask, maskBad);
    5151    }
    5252
     
    5656    // create jobs and supply them to the threads
    5757    for (int gridY = 0; gridY < grid->nYpts; gridY++) {
    58         for (int gridX = 0; gridX < grid->nXpts; gridX++) {
     58        for (int gridX = 0; gridX < grid->nXpts; gridX++) {
    5959
    60             pswarpTransformTileArgs *args = pswarpTransformTileArgsAlloc();
     60            pswarpTransformTileArgs *args = pswarpTransformTileArgsAlloc();
    6161
    62             // these items are just views to the data; they are not freed with args
    63             args->input = input;
    64             args->output = output;
    65             args->grid = grid;
    66             args->interp = interp;
    67             args->region = region;
     62            // these items are just views to the data; they are not freed with args
     63            args->input = input;
     64            args->output = output;
     65            args->grid = grid;
     66            args->interp = interp;
     67            args->region = region;
    6868
    69             args->gridX = gridX;
    70             args->gridY = gridY;
    71             args->goodPixels = 0;
     69            args->gridX = gridX;
     70            args->gridY = gridY;
     71            args->goodPixels = 0;
    7272
    73             // allocate a job
    74             psThreadJob *job = psThreadJobAlloc ("PSWARP_TRANSFORM_TILE");
     73            // allocate a job
     74            psThreadJob *job = psThreadJobAlloc ("PSWARP_TRANSFORM_TILE");
    7575
    76             // construct the arguments for this job
    77             // job is pswarpTransformTile (gridX, gridY);
    78             psArrayAdd (job->args, 1, args);
    79             // fprintf (stderr, "adding job %d,%d, Nargs: %ld\n", gridX, gridY, job->args->n);
     76            // construct the arguments for this job
     77            // job is pswarpTransformTile (gridX, gridY);
     78            psArrayAdd (job->args, 1, args);
     79            // fprintf (stderr, "adding job %d,%d, Nargs: %ld\n", gridX, gridY, job->args->n);
    8080
    81             // call: pswarpTransformTile (args);
    82             if (!psThreadJobAddPending (job)) {
    83                 psError(PS_ERR_UNKNOWN, false, "Unable to warp image.");
    84                 return false;
    85             }
    86             psFree (args);
    87         }
     81            // call: pswarpTransformTile (args);
     82            if (!psThreadJobAddPending (job)) {
     83                psError(PS_ERR_UNKNOWN, false, "Unable to warp image.");
     84                return false;
     85            }
     86            psFree (args);
     87        }
    8888    }
    8989
     
    9191    // wait here for the threaded jobs to finish
    9292    if (!psThreadPoolWait ()) {
    93         psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
    94         return false;
     93        psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
     94        return false;
    9595    }
    96     fprintf (stderr, "success for threaded jobs\n");
    9796
    9897    // each job records its own goodPixel values; sum them here
     
    10099    psThreadJob *job = NULL;
    101100    while ((job = psThreadJobGetDone()) != NULL) {
    102         if (job->args->n < 1) {
    103             fprintf (stderr, "error with job\n");
    104         } else {
    105             pswarpTransformTileArgs *args = job->args->data[0];
    106             // fprintf (stderr, "finished job %d,%d, Nargs: %ld\n", args->gridX, args->gridY, job->args->n);
    107             goodPixels += args->goodPixels;
    108         }
    109         psFree (job);
     101        if (job->args->n < 1) {
     102            fprintf (stderr, "error with job\n");
     103        } else {
     104            pswarpTransformTileArgs *args = job->args->data[0];
     105            // fprintf (stderr, "finished job %d,%d, Nargs: %ld\n", args->gridX, args->gridY, job->args->n);
     106            goodPixels += args->goodPixels;
     107        }
     108        psFree (job);
    110109    }
    111110    psFree(interp);
     
    115114    // Store the variance factor and number of good pixels
    116115    if (goodPixels > 0) {
    117         // Variance factor: large factor --> small scale
    118         float varFactor = psImageInterpolateVarianceFactor(input->image->numCols / 2.0 + input->image->col0, input->image->numRows / 2.0 + input->image->row0, interp); 
     116        // Variance factor: large factor --> small scale
     117        float varFactor = psImageInterpolateVarianceFactor(input->image->numCols / 2.0 + input->image->col0, input->image->numRows / 2.0 + input->image->row0, interp);
    119118        psMetadataItem *vfItem = psMetadataLookup(output->analysis, PSWARP_ANALYSIS_VARFACTOR);
    120119        if (vfItem) {
     
    135134
    136135    if (goodPixels > 0) {
    137         if (!pswarpTransformSources (output, input, config)) {
    138             psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
    139             return false;
    140         }
     136        if (!pswarpTransformSources (output, input, config)) {
     137            psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
     138            return false;
     139        }
    141140    }
    142141
  • trunk/pswarp/src/pswarpTransformReadout_Threaded.c

    r18839 r18884  
    2323
    2424    // output mask bits
    25     psMaskType maskIn   = psMetadataLookupU8(&mdok, recipe, "MASK.INPUT"); 
    26     psMaskType maskPoor = pmConfigMaskGet("POOR.WARP", config); 
    27     psMaskType maskBad  = pmConfigMaskGet("BAD.WARP", config); 
     25    psMaskType maskIn   = psMetadataLookupU8(&mdok, recipe, "MASK.INPUT");
     26    psMaskType maskPoor = pmConfigMaskGet("POOR.WARP", config);
     27    psMaskType maskBad  = pmConfigMaskGet("BAD.WARP", config);
    2828    psAssert (mdok, "MASK.INPUT was not defined");
    2929
    3030    // Flux fraction for "poor"
    31     float poorFrac = psMetadataLookupF32(NULL, config->arguments, "POOR.FRAC"); 
     31    float poorFrac = psMetadataLookupF32(NULL, config->arguments, "POOR.FRAC");
    3232
    3333    // find the output pixel range
     
    5858
    5959    // Interpolation options
    60     psImageInterpolateOptions *interp = psImageInterpolateOptionsAlloc(interpolationMode, inImage, 
     60    psImageInterpolateOptions *interp = psImageInterpolateOptionsAlloc(interpolationMode, inImage,
    6161                                                                       inVar, inMask, maskIn, NAN, NAN,
    6262                                                                       maskBad, maskPoor, poorFrac);
    6363
    6464    if (inVar && !output->weight) {
    65         output->weight = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_F32);
    66         psImageInit(output->weight, NAN);
     65        output->weight = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_F32);
     66        psImageInit(output->weight, NAN);
    6767    }
    6868    if ((inMask || maskPoor || maskBad) && !output->mask) {
    69         output->mask = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_MASK);
    70         psImageInit(output->mask, maskBad);
     69        output->mask = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_MASK);
     70        psImageInit(output->mask, maskBad);
    7171    }
    7272
     
    7676    // create jobs and supply them to the threads
    7777    for (gridY = 0; gridY < nGridX; gridY++) {
    78         for (gridX = 0; gridX < nGridY; gridX++) {
    79 
    80             pswarpTransformTileArgs *args = pswarpTransformTileArgsAlloc();
    81 
    82             // these items are just views to the data; they are not freed with args
    83             args->input = input;
    84             args->output = output;
    85             args->grid = grid;
    86             args->interp = interp;
    87             args->region = region;
    88 
    89             args->gridX = gridX;
    90             args->gridY = gridY;
    91             args->goodPixels = 0;
    92 
    93 # if (THREADED)     
    94             // allocate a job
    95             psThreadJob *job = psThreadJobAlloc ("PSWARP_TRANSFORM_TILE", 0);
    96 
    97             // construct the arguments for this job
    98             // job is pswarpTransformTile (gridX, gridY);
    99             psArrayAdd (job->args, 1, args);
    100             psThreadJobAddPending (job);
     78        for (gridX = 0; gridX < nGridY; gridX++) {
     79
     80            pswarpTransformTileArgs *args = pswarpTransformTileArgsAlloc();
     81
     82            // these items are just views to the data; they are not freed with args
     83            args->input = input;
     84            args->output = output;
     85            args->grid = grid;
     86            args->interp = interp;
     87            args->region = region;
     88
     89            args->gridX = gridX;
     90            args->gridY = gridY;
     91            args->goodPixels = 0;
     92
     93# if (THREADED)
     94            // allocate a job
     95            psThreadJob *job = psThreadJobAlloc ("PSWARP_TRANSFORM_TILE", 0);
     96
     97            // construct the arguments for this job
     98            // job is pswarpTransformTile (gridX, gridY);
     99            psArrayAdd (job->args, 1, args);
     100            psThreadJobAddPending (job);
    101101# else
    102             pswarpTransformTile (args);
    103             goodPixels += args->goodPixels;
     102            pswarpTransformTile (args);
     103            goodPixels += args->goodPixels;
    104104# endif
    105             psFree (args);
    106         }
    107     }
    108 
    109 # if (THREADED)     
     105            psFree (args);
     106        }
     107    }
     108
     109# if (THREADED)
    110110    // wait here for the threaded jobs to finish
    111111    if (!psThreadPoolWait ()) {
    112         psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
    113         return false;
    114     }
    115     fprintf (stderr, "success for threaded jobs\n");
     112        psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
     113        return false;
     114    }
    116115
    117116    // each job records its own goodPixel values; sum them here
     
    119118    psThreadJob *job = NULL;
    120119    while ((job = psThreadJobGetDone()) != NULL) {
    121         pswarpTransformTileArgs *args = job->args->data[0];
    122         goodPixels += args->goodPixels;
    123         psFree (job);
     120        pswarpTransformTileArgs *args = job->args->data[0];
     121        goodPixels += args->goodPixels;
     122        psFree (job);
    124123    }
    125124# endif
Note: See TracChangeset for help on using the changeset viewer.