IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 12, 2010, 2:18:52 PM (16 years ago)
Author:
Paul Price
Message:

Add ability to get inputs from text file. Don't use PSF residuals ever, since they seem to cause bad results whenever they're used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppViz/src/ppVizPSF/ppVizPSFLoop.c

    r27666 r27667  
    7575                psVector *xOffset = NULL, *yOffset = NULL; // Offset from source to true position
    7676
    77                 if (sources || (data->fakeNum > 0 && isfinite(data->fakeMag))) {
     77                if (sources || data->input || (data->fakeNum > 0 && isfinite(data->fakeMag))) {
    7878                    numCols = psf->fieldNx;
    7979                    numRows = psf->fieldNy;
     
    8282                if (sources) {
    8383                    psMemIncrRefCounter(sources);
    84                     psLogMsg("ppVizPSF", PS_LOG_INFO, "Using %ld input sources", sources->n);
    85                 }
     84                    psLogMsg("ppVizPSF", PS_LOG_INFO, "Using %ld input sources from CMF file", sources->n);
     85                } else if (data->input) {
     86                    psVector *x = data->input->data[0]; // x coordinates
     87                    psLogMsg("ppVizPSF", PS_LOG_INFO, "Using %ld input sources from text file", x->n);
     88                }
     89
    8690                if (data->fakeNum > 0 && isfinite(data->fakeMag)) {
    8791                    long numOld = 0; // Old number of sources
     
    113117                    }
    114118                }
    115                 if (!sources) {
     119                if (!sources && !data->input) {
    116120                    // Generate fake image with only a single realisation of the PSF
    117121                    sources = psArrayAlloc(1);
     
    137141                    psRegion *trimsec = psMetadataLookupPtr(NULL, cell->concepts, "CELL.TRIMSEC");
    138142                    *trimsec = psRegionSet(0, numCols, 0, numRows);
    139 
    140                     // We have trouble with PSF residuals in this case, so don't use them
    141                     psFree(psf->residuals);
    142                     psf->residuals = NULL;
    143143                }
    144144
     
    148148                }
    149149
    150                 if (!pmReadoutFakeFromSources(readout, numCols, numRows, sources, 0, xOffset, yOffset, psf,
    151                                               data->minFlux, 0, false, true)) {
    152                     psError(PS_ERR_UNKNOWN, false, "Unable to generate fake readout.");
    153                     return false;
     150                // We have trouble with PSF residuals, so don't use them
     151                psFree(psf->residuals);
     152                psf->residuals = NULL;
     153
     154                if (sources) {
     155                    if (!pmReadoutFakeFromSources(readout, numCols, numRows, sources, 0, xOffset, yOffset,
     156                                                  psf, data->minFlux, 0, false, true)) {
     157                        psError(PS_ERR_UNKNOWN, false, "Unable to generate fake readout.");
     158                        return false;
     159                    }
     160                } else if (data->input) {
     161                    psVector *x = data->input->data[0]; // x coordinates
     162                    psVector *y = data->input->data[1]; // y coordinates
     163                    psVector *mag = data->input->data[2]; // Magnitudes
     164                    if (!pmReadoutFakeFromVectors(readout, numCols, numRows, x, y, mag, xOffset, yOffset,
     165                                                  psf, data->minFlux, 0, false, true)) {
     166                        psError(PS_ERR_UNKNOWN, false, "Unable to generate fake readout.");
     167                        return false;
     168                    }
    154169                }
    155170
Note: See TracChangeset for help on using the changeset viewer.