IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 2, 2009, 11:57:10 AM (17 years ago)
Author:
giebink
Message:

Doxygen comments added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20081230/pswarp/src/pswarpLoop.c

    r21090 r21268  
     1/** @file pswarpLoop.c
     2 *
     3 *  @brief
     4 *
     5 *  @ingroup pswarp
     6 *
     7 *  @author IfA
     8 *  @version $Revision: 1.32.8.2 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2009-02-02 21:57:10 $
     10 *  Copyright 2009 Institute for Astronomy, University of Hawaii
     11 */
     12
    113#include "pswarp.h"
    214#include <ppStats.h>
    315
    4 #define WCS_NONLIN_TOL 0.001            // Non-linear tolerance for header WCS
    5 #define PSPHOT_FIND_PSF 0               // Use psphot's findPSF function?
    6 //#define TESTING 1                       // Testing output?
    7 
    8 // Lists of file rules for the detectors and skycells, and an independent list of everything else
    9 // Lists must end with a NULL
    10 static char *detectorFiles[] = { "PSWARP.INPUT", "PSWARP.MASK", "PSWARP.WEIGHT", NULL };
    11 static char *skycellFiles[] = { "PSWARP.OUTPUT", "PSWARP.OUTPUT.MASK", "PSWARP.OUTPUT.WEIGHT", NULL };
    12 static char *photFiles[] = { "PSPHOT.INPUT", "PSPHOT.OUTPUT",
    13 #if PSPHOT_FIND_PSF
    14                              "PSPHOT.INPUT.CMF",
    15 #endif
    16                              "PSPHOT.RESID",
    17                              "PSPHOT.BACKMDL", "PSPHOT.BACKMDL.STDEV", "PSPHOT.BACKGND", "PSPHOT.BACKSUB",
    18                              "PSPHOT.PSF.SAVE", "SOURCE.PLOT.MOMENTS", "SOURCE.PLOT.PSFMODEL",
    19                              "SOURCE.PLOT.APRESID", NULL };
    20 static char *independentFiles[] = { "PSWARP.ASTROM", // Read independently from the input pixels
    21                                     "PSWARP.SKYCELL", // Don't care about the skycell once we have its WCS
    22                                     "PSWARP.OUTPUT.SOURCES", // Save these independently so we can do the PSF
    23                                     NULL };
    24 
    25 // Activate a list of files
    26 static void fileActivation(pmConfig *config, // Configuration
    27                            char **files, // Files to turn on/off
    28                            bool state   // Activation state
     16#define WCS_NONLIN_TOL 0.001            ///< Non-linear tolerance for header WCS
     17#define PSPHOT_FIND_PSF 1               ///< Use psphot's findPSF function?
     18#define TESTING 0                       ///< Testing output?
     19
     20#include "pswarpFileNames.h" ///< Lists of file rules used at different stages
     21
     22/**
     23 * XXX these are generic functions which should be moved to psModules
     24 * Activate a list of files
     25 */
     26static void fileActivation(pmConfig *config, ///< Configuration
     27                           char **files, ///< Files to turn on/off
     28                           bool state   ///< Activation state
    2929    )
    3030{
     
    3535}
    3636
    37 // Run down the FPA hierarchy, checking files
    38 static bool ioChecksBefore(pmConfig *config // Configuration
     37/**
     38 * Run down the FPA hierarchy, checking files
     39 */
     40static bool ioChecksBefore(pmConfig *config ///< Configuration
    3941                           )
    4042{
    41     pmFPAview *view = pmFPAviewAlloc(0); // View for checking
    42     bool status = true;                 // Status of checks
     43    pmFPAview *view = pmFPAviewAlloc(0); ///< View for checking
     44    bool status = true;                 ///< Status of checks
    4345    status &= pmFPAfileIOChecks(config, view, PM_FPA_BEFORE);
    4446    view->chip = 0;
     
    5052}
    5153
    52 // Run up the FPA hierarchy, checking files
    53 static bool ioChecksAfter(pmConfig *config // Configuration
     54/**
     55 * Run up the FPA hierarchy, checking files
     56 */
     57static bool ioChecksAfter(pmConfig *config ///< Configuration
    5458                          )
    5559{
    56     pmFPAview *view = pmFPAviewAlloc(0); // View for checking
     60    pmFPAview *view = pmFPAviewAlloc(0); ///< View for checking
    5761    view->chip = view->cell = 0;
    58     bool status = true;                 // Status of checks
     62    bool status = true;                 ///< Status of checks
    5963    status &= pmFPAfileIOChecks(config, view, PM_FPA_AFTER);
    6064    view->cell = -1;
     
    6771
    6872
    69 // Loop over the inputs, warp them to the output skycell and then write out the output.
     73/**
     74 * Loop over the inputs, warp them to the output skycell and then write out the output.
     75 */
    7076bool pswarpLoop(pmConfig *config)
    7177{
     
    113119    psFree (view);
    114120
    115     bool mdok;                          // Status of MD lookup
    116     const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // Filename for statistics
    117     psMetadata *stats = NULL;           // Container for statistics
    118     FILE *statsFile = NULL;             // File stream for statistics
     121    bool mdok;                          ///< Status of MD lookup
     122    const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); ///< Filename for statistics
     123    psMetadata *stats = NULL;           ///< Container for statistics
     124    FILE *statsFile = NULL;             ///< File stream for statistics
    119125    if (mdok && statsName && strlen(statsName) > 0) {
    120126        psString resolved = pmConfigConvertFilename(statsName, config, true, true);
     
    141147
    142148    // Read the input astrometry
     149    // XXX rather than use the activations here, this should just explicitly loop over the desired filerule
    143150    {
    144151        pmFPAfileActivate(config->files, true, "PSWARP.ASTROM");
     
    257264    }
    258265
    259     pmCell *outCell = output->parent;   // Output cell
    260     pmChip *outChip = outCell->parent;  // Output chip
    261     pmFPA *outFPA = outChip->parent;    // Output FP
     266    pmCell *outCell = output->parent;   ///< Output cell
     267    pmChip *outChip = outCell->parent;  ///< Output chip
     268    pmFPA *outFPA = outChip->parent;    ///< Output FP
    262269
    263270    if (!pswarpPixelFraction(output, stats, config)) {
     
    277284        varFactor /= goodPix;
    278285
    279         psMetadataItem *vfItem = psMetadataLookup(outCell->concepts, "CELL.VARFACTOR"); // Item to update
     286        psMetadataItem *vfItem = psMetadataLookup(outCell->concepts, "CELL.VARFACTOR"); ///< Item to update
    280287        psAssert(vfItem && vfItem->type == PS_TYPE_F32, "Concept should be as specified.");
    281288        if (!isfinite(vfItem->data.F32)) {
     
    295302    psFree(cells);
    296303
    297     psRegion *trimsec = psMetadataLookupPtr(NULL, outCell->concepts, "CELL.TRIMSEC"); // Trim section
    298     trimsec->x0 = trimsec->x1 = trimsec->y0 = trimsec->y1 = 0; // All pixels
     304    psRegion *trimsec = psMetadataLookupPtr(NULL, outCell->concepts, "CELL.TRIMSEC"); ///< Trim section
     305    trimsec->x0 = trimsec->x1 = trimsec->y0 = trimsec->y1 = 0; ///< All pixels
    299306
    300307    if (!psMetadataCopy(outFPA->concepts, input->fpa->concepts)) {
     
    305312    }
    306313
    307     pmHDU *hdu = outFPA->hdu;           // HDU for the output warped image
     314    pmHDU *hdu = outFPA->hdu;           ///< HDU for the output warped image
    308315
    309316    // Copy header from target
    310317    {
    311         pmFPAview *skyView = pmFPAviewAlloc(0); // View into skycell
     318        pmFPAview *skyView = pmFPAviewAlloc(0); ///< View into skycell
    312319        skyView->chip = skyView->cell = 0;
    313320        pmCell *cell = pmFPAfileThisCell(config->files, skyView, "PSWARP.SKYCELL"); // Skycell cell
    314321        psFree(skyView);
    315         pmHDU *skyHDU = pmHDUFromCell(cell); // HDU
     322        pmHDU *skyHDU = pmHDUFromCell(cell); ///< HDU
    316323        if (!skyHDU) {
    317324            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find skycell HDU.");
     
    364371        pmFPACopy(photFile->fpa, outFPA);
    365372
    366         pmFPAview *view = pmFPAviewAlloc(0); // View into skycell
     373        pmFPAview *view = pmFPAviewAlloc(0); ///< View into skycell
    367374        view->chip = view->cell = view->readout = 0;
    368375
     
    372379        // We can adjust the weight directly since this is a deep copy
    373380        pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa);
    374         float vf = psMetadataLookupF32(NULL, photRO->parent->concepts, "CELL.VARFACTOR"); // Variance factor
     381        float vf = psMetadataLookupF32(NULL, photRO->parent->concepts, "CELL.VARFACTOR"); ///< Variance factor
    375382        psBinaryOp(photRO->weight, photRO->weight, "*", psScalarAlloc(vf, PS_TYPE_F32));
    376383
     
    386393#endif
    387394
    388 #ifdef TESTING
     395#if (TESTING)
    389396        {
    390             #define PSF_SIZE 20         // Half-size of PSF
    391             #define PSF_FLUX 10000      // Central flux for PSF
     397            #define PSF_SIZE 20         ///< Half-size of PSF
     398            #define PSF_FLUX 10000      ///< Central flux for PSF
    392399            pmChip *photChip = pmFPAviewThisChip(view, photFile->fpa);
    393400            pmPSF *psf = psMetadataLookupPtr(NULL, photChip->analysis, "PSPHOT.PSF");
     
    419426    const char *chipName = psMetadataLookupStr(NULL, output->parent->parent->concepts, "CHIP.NAME");
    420427    const char *cellName = psMetadataLookupStr(NULL, output->parent->concepts, "CELL.NAME");
    421     psString headerName = NULL; // Header name for MD5
     428    psString headerName = NULL; ///< Header name for MD5
    422429    psStringAppend(&headerName, "MD5_%s_%s_%d", chipName, cellName, view->readout);
    423     psVector *md5 = psImageMD5(output->image); // md5 hash
    424     psString md5string = psMD5toString(md5); // String
     430    psVector *md5 = psImageMD5(output->image); ///< md5 hash
     431    psString md5string = psMD5toString(md5); ///< String
    425432    psFree(md5);
    426433    psMetadataAddStr(hdu->header, PS_LIST_TAIL, headerName, PS_META_REPLACE,
Note: See TracChangeset for help on using the changeset viewer.