IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14874


Ignore:
Timestamp:
Sep 17, 2007, 4:19:23 PM (19 years ago)
Author:
Paul Price
Message:

We need a new PSF model for the warped frame. It would be good to generate this analytically, but that's going to be tricky. We have a list of sources, so we could use those to redetermine the PSF model. Until Gene makes the necessary adaptations to psphot, we will simply redetermine the PSF model from scratch.

Location:
trunk/pswarp
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/configure.ac

    r14186 r14874  
    2929PKG_CHECK_MODULES([PSMODULE], [psmodules >= 1.0.0])
    3030PKG_CHECK_MODULES([PPSTATS], [ppStats >= 1.0.0])
     31PKG_CHECK_MODULES([PSPHOT], [psphot >= 0.8.0])
    3132
    3233dnl Set CFLAGS for build
  • trunk/pswarp/src/Makefile.am

    r13661 r14874  
    11bin_PROGRAMS = pswarp
    2 pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSWARP_CFLAGS)
    3 pswarp_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSWARP_LIBS)
     2pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PSWARP_CFLAGS)
     3pswarp_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PSWARP_LIBS)
    44
    55pswarp_SOURCES = \
  • trunk/pswarp/src/pswarp.h

    r14389 r14874  
    99# include <pslib.h>
    1010# include <psmodules.h>
     11# include <psphot.h>
    1112
    1213# include "pswarpErrorCodes.h"
  • trunk/pswarp/src/pswarpArguments.c

    r14389 r14874  
    2323    pmConfigRecipeOptions (config, PSWARP_RECIPE);
    2424
    25     pmConfigFileSetsMD (config->arguments, &argc, argv, "ASTROM",   "-astrom", "-astromlist");
     25    pmConfigFileSetsMD(config->arguments, &argc, argv, "ASTROM",   "-astrom", "-astromlist");
    2626
    2727    // chip selection is used to limit chips to be processed
     
    3939                         "Filename for statistics of output image", argv[N]);
    4040        psArgumentRemove(N, &argc, argv);
     41    }
     42
     43    // PSF determination?
     44    if ((N = psArgumentGet(argc, argv, "-psf"))) {
     45        psArgumentRemove(N, &argc, argv);
     46        psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PSF", 0, "Do PSF determination?", true);
    4147    }
    4248
  • trunk/pswarp/src/pswarpLoop.c

    r14768 r14874  
    198198    }
    199199
     200    // We need a new PSF model for the warped frame
     201    // It would be good to generate this analytically, but that's going to be tricky.
     202    // We have a list of sources, so we could use those to redetermine the PSF model.
     203    // Until Gene makes the necessary adaptations to psphot, we will simply redetermine the PSF model from
     204    // scratch.
     205    if (psMetadataLookupBool(&mdok, config->arguments, "PSF")) {
     206        psMetadata *psphotRecipe = psMetadataLookupPtr(NULL, config->recipes,
     207                                                       PSPHOT_RECIPE); // Recipe for psphot
     208        if (!psphotRecipe) {
     209            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find %s recipe.", PSPHOT_RECIPE);
     210            return false;
     211        }
     212
     213        psMetadataAddStr(psphotRecipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE,
     214                         "Break point for psphot operations", "PSFMODEL");
     215
     216        pmFPAfile *photFile = psMetadataLookupPtr(NULL, config->files, "PSPHOT.INPUT");
     217        pmFPACopy(photFile->fpa, outFPA);
     218
     219        pmFPAview *view = pmFPAviewAlloc(0); // View into skycell
     220        if (!psphotReadout(config, view)) {
     221            psError(psErrorCodeLast(), false, "Unable to determine PSF for warped image.\n");
     222            psFree(view);
     223            return false;
     224        }
     225        psFree(view);
     226
     227        pmFPAfileActivate(config->files, false, "PSPHOT.INPUT");
     228    }
     229
    200230    output->data_exists = true;
    201231    outCell->data_exists = true;
    202232    outChip->data_exists = true;
    203233
    204 #if 0
    205     float gain = 0.0, readnoise = 0.0, saturation = INFINITY, exposure = 0.0, darktime = 0.0;
    206     double mjd = 0.0;
    207 #endif
    208 
    209 #if 0
    210     // XXX Hack so that INSTRUME header keyword and the like are not updated properly
    211     // If INSTRUME (etc) is updated, then the FITS file with the warped image will be often
    212     // recognised as coming from the old camera, not the new, warped camera.
    213     // The proper solution to this, I believe, would be to define a skycell derivative of the
    214     // old camera, so that the skycell can be recognised as coming from the old camera (and would
    215     // also therefore inherit all its recipes, which would be good), rather than having a completely
    216     // different camera.  That will take some work; the below solution should be good enough for now.
    217     {
    218         psMetadataItem *item;           // Concepts item to update
    219 
    220         item = psMetadataLookup(outFPA->concepts, "FPA.INSTRUMENT");
    221         psFree(item->data.V);
    222         item->data.V = NULL;
    223 
    224         item = psMetadataLookup(outFPA->concepts, "FPA.DETECTOR");
    225         psFree(item->data.V);
    226         item->data.V = NULL;
    227     }
    228 #endif
    229234
    230235    // Perform statistics on the output image
  • trunk/pswarp/src/pswarpParseCamera.c

    r14768 r14874  
    44
    55    bool status;
     6    bool mdok;                          // Status of MD lookup
    67    pmFPAfile *skycell = NULL;
    78    pmConfig *skyConfig = NULL;
     
    8990    }
    9091
     92    if (psMetadataLookupBool(&mdok, config->arguments, "PSF")) {
     93        // This file, PSPHOT.INPUT, is just used as a carrier; output files (eg, PSPHOT.RESID) are defined by
     94        // psphotDefineFiles
     95        pmFPAfile *psphotInput = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT");
     96        if (!psphotInput) {
     97            psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.INPUT"));
     98            return false;
     99        }
     100
     101        // Define associated psphot input/output files
     102        if (!psphotDefineFiles(config, psphotInput)) {
     103            psError(PSPHOT_ERR_CONFIG, false,
     104                    "Unable to define the additional input/output files for psphot");
     105            return false;
     106        }
     107    }
    91108
    92109    // Chip selection: turn on only the chips specified
    93     bool mdok;                          // Status of MD lookup
    94110    char *chipLine = psMetadataLookupStr(&mdok, config->arguments, "CHIP_SELECTIONS");
    95111    if (mdok) {
  • trunk/pswarp/src/pswarpTransformReadout_Opt.c

    r14800 r14874  
    1111    psTimerStart ("warp");
    1212
    13     // Get grid size
     13    // Get warp parameters
     14    bool mdok;
    1415    int nGridX = psMetadataLookupS32(NULL, config->arguments, "GRID.NX");
    1516    int nGridY = psMetadataLookupS32(NULL, config->arguments, "GRID.NY");
     
    145146
    146147    // Transform sources
    147     bool mdok;
    148148    psArray *inSources = psMetadataLookupPtr(&mdok, input->analysis, "PSPHOT.SOURCES"); // Sources in source
    149149    if (goodPixels && mdok && inSources) {
Note: See TracChangeset for help on using the changeset viewer.