IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25626


Ignore:
Timestamp:
Sep 27, 2009, 11:36:17 AM (17 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/20090715/psModules/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090715/psModules/src/camera/pmReadoutFake.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090715/psModules/src/concepts/pmConcepts.c

    r25407 r25626  
    329329        conceptRegisterF32("FPA.TELTEMP.EXTRA", "Telescope Temperatures: extra", p_pmConceptParse_TELTEMPS, NULL, NULL, false, PM_FPA_LEVEL_FPA);
    330330        conceptRegisterF32("FPA.PON.TIME", "Power On Time", NULL, NULL, NULL, false, PM_FPA_LEVEL_FPA);
     331        conceptRegisterS32("FPA.BURNTOOL.APPLIED", "Status of burntool processing", p_pmConceptParse_BTOOLAPP,NULL,NULL,false,PM_FPA_LEVEL_FPA);
    331332        conceptRegisterF32("FPA.EXPOSURE", "Exposure time (sec)", NULL, NULL, NULL, false, PM_FPA_LEVEL_FPA);
    332333    }
     
    344345        conceptRegisterF32("CHIP.TEMP", "Temperature of chip", NULL, NULL, NULL, false, PM_FPA_LEVEL_CHIP);
    345346        conceptRegisterStr("CHIP.ID", "Chip identifier", NULL, NULL, NULL, false, PM_FPA_LEVEL_CHIP);
     347
    346348    }
    347349
  • branches/eam_branches/20090715/psModules/src/concepts/pmConceptsRead.c

    r25022 r25626  
    7373        return false;
    7474    }
    75 
    7675    psTrace ("psModules.concepts", 3, "parsing concept: %s\n", spec->blank->name);
    7776    if (!strcmp (spec->blank->name, "CELL.XPARITY")) {
     
    275274        psMetadataItem *headerItem = NULL; // The value of the concept from the header
    276275
     276
    277277        psTrace ("psModules.concepts", 3, "reading concept: %s\n", name);
    278278        if (!strcmp (name, "CELL.XPARITY")) {
     
    307307            }
    308308        }
    309 
    310309        if (!headerItem) {
    311310            psMetadataItem *formatItem = psMetadataLookup(transSpec, name); // Item with keyword
     
    328327            }
    329328            psString keywords = formatItem->data.str; // The FITS keywords
    330 
    331329            // In case there are multiple headers
    332330            psList *keys = psStringSplit(keywords, " ,;", true); // List of keywords
  • branches/eam_branches/20090715/psModules/src/concepts/pmConceptsStandard.c

    r25407 r25626  
    160160    assert(concept);
    161161    assert(pattern);
    162 
    163162    double value = NAN;
    164163    switch (concept->type) {
     
    632631    return psMetadataItemAllocS32(pattern->name, pattern->comment, binning);
    633632}
     633
     634// BTOOLAPP
     635psMetadataItem *p_pmConceptParse_BTOOLAPP(const psMetadataItem *concept,
     636                                          const psMetadataItem *pattern,
     637                                          pmConceptSource source,
     638                                          const psMetadata *cameraFormat,
     639                                          const pmFPA *fpa,
     640                                          const pmChip *chip,
     641                                          const pmCell *cell)
     642{
     643  assert(concept);
     644  assert(pattern);
     645
     646  int bt_status = 0;
     647
     648  if (concept->type != PS_DATA_BOOL) {
     649    psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type for %s (%x) is not BOOL\n",
     650            concept->name, concept->type);
     651    return NULL;
     652  }
     653
     654  if (concept->data.B == true) {
     655    bt_status = -2;
     656  }
     657  else if (concept->data.B == false) {
     658    bt_status = 1 ;
     659  }
     660 
     661  return psMetadataItemAllocS32(concept->name, concept->comment, bt_status);
     662
    634663
    635664// Get the current value of a concept
  • branches/eam_branches/20090715/psModules/src/concepts/pmConceptsStandard.h

    r22699 r25626  
    115115    );
    116116
     117/// Format for the BTOOLAPP conceptn
     118psMetadataItem *p_pmConceptParse_BTOOLAPP(
     119    const psMetadataItem *concept, ///< Concept to format
     120    const psMetadataItem *pattern,
     121    pmConceptSource source, ///< Source for concept
     122    const psMetadata *cameraFormat, ///< Camera format definition
     123    const pmFPA *fpa, ///< FPA for concept, or NULL
     124    const pmChip *chip, ///< Chip for concept, or NULL
     125    const pmCell *cell ///< Cell for concept, or NULL
     126    );
     127
     128
    117129/// Parse the cell binning concepts: CELL.XBIN, CELL.YBIN
    118130psMetadataItem *p_pmConceptParse_CELL_Binning(
  • branches/eam_branches/20090715/psModules/src/imcombine/pmPSFEnvelope.c

    r25496 r25626  
    3434
    3535// #define TESTING                         // Enable test output
     36// #define PEAK_NORM                       // Normalise peaks?
    3637#define PEAK_FLUX 1.0e4                 // Peak flux for each source
    3738#define SKY_VALUE 0.0e0                 // Sky value for fake image
     
    122123            continue;
    123124        }
     125
     126        if (psTraceGetLevel("psModules.imcombine") >= 1) {
     127            psString string = NULL;     // String with values
     128            psStringAppend(&string, "PSF %d: ", i);
     129            float x = numCols / 2.0, y = numRows / 2.0; // Coordinates of interest
     130            for (int j = 4; j < psf->params->n; j++) {
     131                pmTrend2D *trend = psf->params->data[j]; // Trend of interest
     132                double val = pmTrend2DEval(trend, x, y);
     133                double err;
     134                switch (trend->mode) {
     135                  case PM_TREND_POLY_ORD:
     136                  case PM_TREND_POLY_CHEB:
     137                    err = NAN;
     138                    break;
     139                  case PM_TREND_MAP:
     140                    err = psImageUnbinPixel(x, y, trend->map->error, trend->map->binning);
     141                    break;
     142                  default:
     143                    psAbort("Unsupported mode: %x", trend->mode);
     144                }
     145                psStringAppend(&string, "%lf %lf   ", val, err);
     146            }
     147            psTrace("psModules.imcombine", 1, "%s\n", string);
     148            psFree(string);
     149        }
     150
    124151        pmResiduals *resid = psf->residuals;// PSF residuals
    125152        psf->residuals = NULL;
     
    144171            float y = source->peak->yf + yOffset->data.S32[j]; // y coordinate of source
    145172
    146             double flux = fakeRO->image->data.F32[(int)y][(int)x];
     173#ifdef PEAK_NORM
     174            // Perhaps I'm being paranoid, but specify a range to check
     175            int uMax = PS_MIN(x + radius, numCols - 1), uMin = PS_MAX(x - radius, 0);
     176            int vMax = PS_MIN(y + radius, numRows - 1), vMin = PS_MAX(y - radius, 0);
     177
     178            double flux = -INFINITY;    // Peak flux
     179            for (int v = vMin; v <= vMax; v++) {
     180                for (int u = uMin; u <= uMax; u++) {
     181                    if (fakeRO->image->data.F32[v][u] > flux) {
     182                        flux = fakeRO->image->data.F32[v][u];
     183                    }
     184                }
     185            }
    147186            if (!isfinite(flux) || flux < 0) {
    148187                continue;
    149188            }
    150189            float norm = PEAK_FLUX / flux; // Normalisation for source
     190#endif
    151191            psRegion region = psRegionSet(x - radius, x + radius, y - radius, y + radius); // PSF region
    152192            psImage *subImage = psImageSubset(fakeRO->image, region); // Subimage of fake PSF
    153193            psImage *subEnv = psImageSubset(envelope, region); // Subimage of envelope
     194#ifdef PEAK_NORM
    154195            psBinaryOp(subImage, subImage, "*", psScalarAlloc(norm, PS_TYPE_F32));
     196#endif
    155197            psBinaryOp(subEnv, subEnv, "MAX", subImage);
    156198            psFree(subImage);
     
    345387    psFree(try);
    346388
     389    if (psTraceGetLevel("psModules.imcombine") >= 1) {
     390        psString string = NULL;     // String with values
     391        psStringAppend(&string, "Envelope PSF: ");
     392        float x = numCols / 2.0, y = numRows / 2.0; // Coordinates of interest
     393        for (int j = 4; j < psf->params->n; j++) {
     394            pmTrend2D *trend = psf->params->data[j]; // Trend of interest
     395            double val = pmTrend2DEval(trend, x, y);
     396            double err;
     397            switch (trend->mode) {
     398              case PM_TREND_POLY_ORD:
     399              case PM_TREND_POLY_CHEB:
     400                err = NAN;
     401                break;
     402              case PM_TREND_MAP:
     403                err = psImageUnbinPixel(x, y, trend->map->error, trend->map->binning);
     404                break;
     405              default:
     406                psAbort("Unsupported mode: %x", trend->mode);
     407            }
     408            psStringAppend(&string, "%lf %lf   ", val, err);
     409        }
     410        psTrace("psModules.imcombine", 1, "%s\n", string);
     411        psFree(string);
     412    }
     413
    347414#ifdef TESTING
    348415    {
     
    358425
    359426        pmReadout *generated = pmReadoutAlloc(NULL); // Generated image
    360         pmReadoutFakeFromSources(generated, numCols, numRows, fakes, NULL, NULL, psf, NAN, radius,
     427        pmReadoutFakeFromSources(generated, numCols, numRows, fakes, 0, NULL, NULL, psf, NAN, radius,
    361428                                 false, true);
    362429        {
  • branches/eam_branches/20090715/psModules/src/imcombine/pmStackReject.c

    r21351 r25626  
    4343    if (box > 0) {
    4444        // Convolve a subimage, then stick it in the target
    45         // XXX if (threaded) {
    46         // XXX     psMutexLock(source);
    47         // XXX }
    4845        psImage *mask = psImageSubset(source, psRegionSet(xMin - box, xMax + box,
    4946                                                          yMin - box, yMax + box)); // Mask to convolve
    50         // XXX if (threaded) {
    51         // XXX     psMutexUnlock(source);
    52         // XXX }
    5347        psImage *convolved = psImageConvolveMask(NULL, mask, PM_STACK_MASK_BAD, PM_STACK_MASK_CONVOLVE,
    5448                                                 -box, box, -box, box); // Convolved mask
    55         // XXX if (threaded) {
    56         // XXX     psMutexLock(source);
    57         // XXX }
    5849        psFree(mask);
    59         // XXX if (threaded) {
    60         // XXX     psMutexUnlock(source);
    61         // XXX }
    6250
    6351        int numBytes = (xMax - xMin) * PSELEMTYPE_SIZEOF(PS_TYPE_IMAGE_MASK); // Number of bytes to copy
     
    162150    pmReadout *inRO = pmReadoutAlloc(NULL); // Readout with input image
    163151    inRO->image = image;
    164     // XXX if (threaded) {
    165     // XXX     psMutexInit(image);
    166     // XXX }
    167152    for (int i = 0; i < numRegions; i++) {
    168153        psRegion *region = subRegions->data[i]; // Region of interest
    169154        pmSubtractionKernels *kernels = subKernels->data[i]; // Kernel of interest
    170         if (!pmSubtractionConvolve(convRO, NULL, inRO, NULL, NULL, stride, 0, 0, 1.0, 0.0,
     155        if (!pmSubtractionConvolve(NULL, convRO, NULL, inRO, NULL, stride, 0, 0, 1.0, 0.0,
    171156                                   region, kernels, false, true)) {
    172157            psError(PS_ERR_UNKNOWN, false, "Unable to convolve mask image in region %d.", i);
     
    211196        }
    212197    }
    213     // XXX if (threaded) {
    214     // XXX     psMutexDestroy(image);
    215     // XXX }
    216198    psFree(inRO);
    217199    psImage *convolved = psMemIncrRefCounter(convRO->image);
     
    264246    psImage *target = psImageRecycle(convolved, numCols, numRows, PS_TYPE_IMAGE_MASK); // Grown image
    265247    psImageInit(target, 0);
    266     // XXX if (threaded) {
    267     // XXX     psMutexInit(source);
    268     // XXX }
    269248    for (int i = 0; i < subRegions->n; i++) {
    270249        psRegion *region = subRegions->data[i]; // Subtraction region
     
    287266                    psArray *args = job->args; // Job arguments
    288267                    psArrayAdd(args, 1, target);
    289                     // XXX psMutexLock(source);
    290268                    psArrayAdd(args, 1, source);
    291                     // XXX psMutexUnlock(source);
    292269                    psArrayAdd(args, 1, kernels);
    293270                    PS_ARRAY_ADD_SCALAR(args, numCols, PS_TYPE_S32);
     
    332309        }
    333310
    334         // XXX psMutexDestroy(source);
    335311    }
    336312
  • branches/eam_branches/20090715/psModules/src/imcombine/pmSubtractionMatch.c

    r25407 r25626  
    628628    variance = NULL;
    629629
    630     if (!pmSubtractionBorder(conv1->image, conv1->variance, conv1->mask, size, maskBad)) {
     630    if (conv1 && !pmSubtractionBorder(conv1->image, conv1->variance, conv1->mask, size, maskBad)) {
     631        psError(PS_ERR_UNKNOWN, false, "Unable to set border of convolved image.");
     632        goto MATCH_ERROR;
     633    }
     634    if (conv2 && !pmSubtractionBorder(conv2->image, conv2->variance, conv2->mask, size, maskBad)) {
    631635        psError(PS_ERR_UNKNOWN, false, "Unable to set border of convolved image.");
    632636        goto MATCH_ERROR;
  • branches/eam_branches/20090715/psModules/src/objects/pmDetEff.c

    r25407 r25626  
    164164    }
    165165
    166     return psMetadataAddPtr(readout->analysis, PS_LIST_TAIL, PM_DETEFF_ANALYSIS,
    167                             PS_META_REPLACE | PS_DATA_UNKNOWN, "Detection efficiency", de);
     166    bool status = psMetadataAddPtr(readout->analysis, PS_LIST_TAIL, PM_DETEFF_ANALYSIS, PS_META_REPLACE | PS_DATA_UNKNOWN, "Detection efficiency", de);
     167    psFree (de);
     168    return status;
    168169}
  • branches/eam_branches/20090715/psModules/src/objects/pmPetrosian.c

  • branches/eam_branches/20090715/psModules/src/objects/pmPetrosian.h

  • branches/eam_branches/20090715/psModules/src/objects/pmSourceIO.c

    r25589 r25626  
    986986
    987987            if (!pmReadoutReadDetEff(file->fits, readout, deteffname)) {
     988#if 0
    988989                psError(PS_ERR_IO, false, "Unable to read detection efficiency");
    989990                return false;
     991#else
     992                // No great loss
     993                psErrorClear();
     994#endif
    990995            }
    991996        }
Note: See TracChangeset for help on using the changeset viewer.