IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27096


Ignore:
Timestamp:
Feb 25, 2010, 4:26:50 PM (16 years ago)
Author:
Paul Price
Message:

Reworking error codes to get consistent exit codes.

Location:
trunk/pswarp/src
Files:
14 edited

Legend:

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

    r23195 r27096  
    2828
    2929    psLibInit(NULL);
    30 
    31     // model inits are needed in pmSourceIO
    32     // models defined in psphot/src/models are not available in psastro
    3330    pmModelClassInit();
    34 
    35     // init various psphot pieces (errors, models, threads)
    3631    psphotInit();
    3732
     
    6459    }
    6560
    66     psLogMsg("pswarp", 3, "complete pswarp run: %f sec\n", psTimerMark("pswarp"));
    67     pswarpCleanup(config);
    68     psLibFinalize();
    69     exit(PS_EXIT_SUCCESS);
     61    psLogMsg("pswarp", PS_LOG_INFO, "complete pswarp run: %f sec\n", psTimerMark("pswarp"));
     62
     63    psExit exitValue = pswarpCleanup(config);
     64    exit(exitValue);
    7065}
  • trunk/pswarp/src/pswarp.h

    r23688 r27096  
    8181bool pswarpDefine (pmConfig *config);
    8282bool pswarpLoop (pmConfig *config);
    83 void pswarpCleanup (pmConfig *config);
     83psExit pswarpCleanup (pmConfig *config);
    8484bool pswarpTransformReadout (pmReadout *output, pmReadout *input, pmConfig *config);
    8585bool pswarpTransformSources(pmReadout *output, pmReadout *input, pmConfig *config);
  • trunk/pswarp/src/pswarpArguments.c

    r25538 r27096  
    2626    // load config data from default locations
    2727    pmConfig *config = pmConfigRead(&argc, argv, PSWARP_RECIPE);
    28     if (config == NULL) {
    29         psError(PSWARP_ERR_CONFIG, false, "Can't read site configuration");
     28    if (!config) {
     29        psError(psErrorCodeLast(), false, "Can't read configuration");
    3030        return NULL;
    3131    }
     
    3333    // save the following additional recipe values based on command-line options
    3434    // these options override the PSWARP recipe values loaded from recipe files
    35     pmConfigRecipeOptions (config, PSWARP_RECIPE);
     35    if (!pmConfigRecipeOptions(config, PSWARP_RECIPE)) {
     36        psError(psErrorCodeLast(), false, "Can't do something with recipes");
     37        psFree(config);
     38        return NULL;
     39    }
    3640
    3741    pmConfigFileSetsMD(config->arguments, &argc, argv, "ASTROM",   "-astrom", "-astromlist");
     
    7276        psThreadPoolInit (nThreads);
    7377    }
    74     pswarpSetThreads ();
     78    pswarpSetThreads();
    7579
    7680    if ((N = psArgumentGet(argc, argv, "-dumpconfig"))) {
     
    160164    bool PSF = psMetadataLookupBool(&status, recipe, "PSF"); ///< Generate a PSF model?
    161165    if (!status) {
    162         PSF = true;
     166        PSF = true;
    163167        psWarning("PSF is not set in the %s recipe --- defaulting to TRUE.", PSWARP_RECIPE);
    164168    }
  • trunk/pswarp/src/pswarpCleanup.c

    r21323 r27096  
    1313# include "pswarp.h"
    1414
    15 void pswarpCleanup (pmConfig *config) {
     15psExit pswarpCleanup (pmConfig *config)
     16{
     17    psExit exitValue = PS_EXIT_SUCCESS;        // Exit value for program
     18    psErrorCode errorCode = psErrorCodeLast(); // Error code
     19    if (errorCode != PS_ERR_NONE) {
     20        psErrorStackPrint(stderr, "Unable to perform warp.");
     21        switch (errorCode) {
     22          case PSWARP_ERR_UNKNOWN:
     23          case PS_ERR_UNKNOWN:
     24            exitValue = PS_EXIT_UNKNOWN_ERROR;
     25            break;
     26          case PS_ERR_IO:
     27          case PS_ERR_DB_CLIENT:
     28          case PS_ERR_DB_SERVER:
     29          case PS_ERR_BAD_FITS:
     30          case PS_ERR_OS_CALL_FAILED:
     31          case PSWARP_ERR_IO:
     32            exitValue = PS_EXIT_SYS_ERROR;
     33            break;
     34          case PS_ERR_BAD_PARAMETER_VALUE:
     35          case PS_ERR_BAD_PARAMETER_TYPE:
     36          case PS_ERR_BAD_PARAMETER_NULL:
     37          case PS_ERR_BAD_PARAMETER_SIZE:
     38          case PSWARP_ERR_ARGUMENTS:
     39          case PSWARP_ERR_CONFIG:
     40            exitValue = PS_EXIT_CONFIG_ERROR;
     41            break;
     42          case PSWARP_ERR_DATA:
     43          case PSWARP_ERR_NO_OVERLAP:
     44            exitValue = PS_EXIT_DATA_ERROR;
     45            break;
     46          case PS_ERR_UNEXPECTED_NULL:
     47          case PS_ERR_PROGRAMMING:
     48          case PSWARP_ERR_NOT_IMPLEMENTED:
     49          default:
     50            // It's a programming error if we're not dealing with the error correctly
     51            exitValue = PS_EXIT_PROG_ERROR;
     52            break;
     53        }
     54    }
    1655
    17     psFree (config);
     56    psThreadPoolFinalize();
     57    psMemCheckCorruption(stderr, true);
    1858
    19     psTimerStop ();
    20     psMemCheckCorruption(stderr, true);
    21     pmModelClassCleanup ();
    22     psTimeFinalize ();
    23     psThreadPoolFinalize ();
    24     pmConceptsDone ();
    25     pmConfigDone ();
    26     // fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "pswarp");
    27     fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "pswarp");
     59    psFree(config);
    2860
    29     return;
     61    psTimerStop();
     62    pmVisualClose();
     63    pmModelClassCleanup();
     64    pmConceptsDone();
     65    pmConfigDone();
     66    psLibFinalize();
     67
     68    return exitValue;
    3069}
  • trunk/pswarp/src/pswarpDefine.c

    r26896 r27096  
    4949    {
    5050        if (!pmFPAReadHeaderSet(skycell->fpa, skycell->fits, config)) {
    51             psError(PS_ERR_UNKNOWN, false, "Unable to read headers for skycell.");
     51            psError(psErrorCodeLast(), false, "Unable to read headers for skycell.");
    5252            psFree(view);
    5353            return false;
     
    5959        pmHDU *hdu = pmHDUFromCell(source); ///< HDU for source
    6060        if (!hdu || !hdu->header) {
    61             psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find header for sky cell.");
     61            psError(PM_ERR_PROG, false, "Unable to find header for sky cell.");
    6262            psFree(view);
    6363            return false;
     
    6565        int numCols = psMetadataLookupS32(NULL, hdu->header, "NAXIS1"); ///< Number of columns
    6666        int numRows = psMetadataLookupS32(NULL, hdu->header, "NAXIS2"); ///< Number of rows
    67         if ((numCols == 0) || (numRows == 0)) {
    68             psError(PS_ERR_UNKNOWN, false, "skycell has invalid dimensions %d x %d", numCols, numRows);
     67        if ((numCols == 0) || (numRows == 0)) {
     68            psError(PSWARP_ERR_DATA, false, "skycell has invalid dimensions %d x %d", numCols, numRows);
    6969            psFree(view);
    7070            return false;
     
    7777        psFree(readout);                // Drop reference
    7878
    79         bool status = false;
     79        bool status = false;
    8080        psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XBIN");
    8181        psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YBIN");
     
    106106    if (bilevelAstrometry) {
    107107        if (!pmAstromReadBilevelMosaic(output->fpa, phu->header)) {
    108             psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for skycell.");
     108            psError(psErrorCodeLast(), false, "Unable to read bilevel mosaic astrometry for skycell.");
    109109            psFree(view);
    110110            return false;
    111111        }
    112112        if (!pmAstromReadBilevelChip(outputChip, hdu->header)) {
    113             psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel chip astrometry for skycell.");
     113            psError(psErrorCodeLast(), false, "Unable to read bilevel chip astrometry for skycell.");
    114114            psFree(view);
    115115            return false;
     
    118118        // we use a default FPA pixel scale of 1.0
    119119        if (!pmAstromReadWCS(output->fpa, outputChip, hdu->header, 1.0)) {
    120             psError(PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry for skycell.");
     120            psError(psErrorCodeLast(), false, "Unable to read WCS astrometry for skycell.");
    121121            psFree(view);
    122122            return false;
  • trunk/pswarp/src/pswarpDefineSkycell.c

    r21323 r27096  
    4747    }
    4848    if (infiles->n != 1) {
    49         psError(PS_ERR_IO, false, "Found n == %ld files in %s in arguments\n", infiles->n, argname);
     49        psError(PSWARP_ERR_CONFIG, false, "Found n == %ld files in %s in arguments\n", infiles->n, argname);
    5050        return false;
    5151    }
     
    5454    psString realName = pmConfigConvertFilename (infiles->data[0], config, false, false);
    5555    if (!realName) {
    56         psError(PS_ERR_IO, false, "Failed to convert file name %s\n", (char *) infiles->data[0]);
     56        psError(psErrorCodeLast(), false, "Failed to convert file name %s\n", (char *) infiles->data[0]);
    5757        return false;
    5858    }
     
    6161    fits = psFitsOpen (realName, "r");
    6262    if (!fits) {
    63         psError(PS_ERR_IO, false, "Failed to open file %s\n", realName);
     63        psError(psErrorCodeLast(), false, "Failed to open file %s\n", realName);
    6464        psFree (realName);
    6565        return false;
     
    6767    phu = psFitsReadHeader (NULL, fits);
    6868    if (!phu) {
    69         psError(PS_ERR_IO, false, "Failed to read file header %s\n", realName);
     69        psError(psErrorCodeLast(), false, "Failed to read file header %s\n", realName);
    7070        psFree (realName);
    7171        return false;
     
    8787    format = pmConfigCameraFormatFromHeader (NULL, NULL, NULL, skyConfig, phu, false);
    8888    if (!format) {
    89         psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", realName);
     89        psError(psErrorCodeLast(), false, "Failed to read CCD format from %s\n", realName);
    9090        psFree(phu);
    9191        psFree (realName);
     
    100100    fpa = pmFPAConstruct (skyConfig->camera, skyConfig->cameraName);
    101101    if (!fpa) {
    102         psError(PS_ERR_IO, false, "Failed to construct FPA from %s", realName);
     102        psError(psErrorCodeLast(), false, "Failed to construct FPA from %s", realName);
    103103        psFree (realName);
    104104        return false;
     
    110110    file = pmFPAfileDefineInput (skyConfig, fpa, NULL, filename);
    111111    if (!file) {
    112         psError(PS_ERR_IO, false, "file %s not defined\n", filename);
     112        psError(psErrorCodeLast(), false, "file %s not defined\n", filename);
    113113        psFree(phu);
    114114        psFree(fpa);
     
    126126    file->fileLevel = pmFPAPHULevel(format);
    127127    if (file->fileLevel == PM_FPA_LEVEL_NONE) {
    128         psError(PS_ERR_IO, true, "Unable to determine file level for %s\n", file->name);
     128        psError(PSWARP_ERR_CONFIG, true, "Unable to determine file level for %s\n", file->name);
    129129        psFree(phu);
    130130        psFree(fpa);
     
    137137    pmFPAview *view = pmFPAAddSourceFromHeader (fpa, phu, format);
    138138    if (!view) {
    139         psError(PS_ERR_IO, false, "Unable to determine source for %s", file->name);
     139        psError(psErrorCodeLast(), false, "Unable to determine source for %s", file->name);
    140140        psFree(phu);
    141141        psFree (fpa);
  • trunk/pswarp/src/pswarpHeadersLoad.c

    r21323 r27096  
    7474    if (bilevelAstrometry) {
    7575        if (!pmAstromReadBilevelMosaic(input->fpa, phu->header)) {
    76             psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for input.");
     76            psError(psErrorCodeLast(), false, "Unable to read bilevel mosaic astrometry for input.");
    7777            psFree(view);
    7878            return false;
     
    9292        if (bilevelAstrometry) {
    9393            if (!pmAstromReadBilevelChip (chip, hdu->header)) {
    94                 psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel chip astrometry for input.");
     94                psError(psErrorCodeLast(), false, "Unable to read bilevel chip astrometry for input.");
    9595                psFree(view);
    9696                return false;
     
    9999            // we use a default FPA pixel scale of 1.0
    100100            if (!pmAstromReadWCS(input->fpa, chip, hdu->header, 1.0)) {
    101                 psError(PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry for input.");
     101                psError(psErrorCodeLast(), false, "Unable to read WCS astrometry for input.");
    102102                psFree(view);
    103103                return false;
  • trunk/pswarp/src/pswarpLoop.c

    r27063 r27096  
    8484    psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSWARP_RECIPE);
    8585    if (!recipe) {
    86         psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);
     86        psError(PSWARP_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);
    8787        return false;
    8888    }
    8989
    9090    if (!pswarpSetMaskBits(config)) {
    91         psError(PS_ERR_IO, false, "failed to set mask bits");
     91        psError(psErrorCodeLast(), false, "failed to set mask bits");
    9292        return NULL;
    9393    }
     
    111111
    112112    if (astrom->camera != input->camera) {
    113         psError(PS_ERR_UNKNOWN, true, "Input camera and astrometry camera do not match.");
     113        psError(PSWARP_ERR_DATA, true, "Input camera and astrometry camera do not match.");
    114114        return false;
    115115    }
     
    211211    if (bilevelAstrometry) {
    212212        if (!pmAstromReadBilevelMosaic(input->fpa, phu->header)) {
    213             psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for input FPA.");
     213            psError(psErrorCodeLast(), false, "Unable to read bilevel mosaic astrometry for input FPA.");
    214214            psFree(view);
    215215            psFree(stats);
     
    237237        if (bilevelAstrometry) {
    238238            if (!pmAstromReadBilevelChip (chip, hdu->header)) {
    239                 psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel chip astrometry for input FPA.");
     239                psError(psErrorCodeLast(), false, "Unable to read bilevel chip astrometry for input FPA.");
    240240                psFree(view);
    241241                psFree(stats);
     
    245245            // we use a default FPA pixel scale of 1.0
    246246            if (!pmAstromReadWCS (input->fpa, chip, hdu->header, 1.0)) {
    247                 psError(PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry for input FPA.");
     247                psError(psErrorCodeLast(), false, "Unable to read WCS astrometry for input FPA.");
    248248                psFree(view);
    249249                psFree(stats);
     
    312312
    313313    if (!pswarpPixelsLit(output, stats, config)) {
    314         psError(PS_ERR_UNKNOWN, false, "Unable to calculate pixel regions.");
     314        psError(psErrorCodeLast(), false, "Unable to calculate pixel regions.");
    315315        psFree(cells);
    316316        psFree(view);
     
    349349
    350350    if (!pmConceptsAverageCells(outCell, cells, NULL, NULL, false)) {
    351         psError(PS_ERR_UNKNOWN, false, "Unable to average cell concepts.");
     351        psError(psErrorCodeLast(), false, "Unable to average cell concepts.");
    352352        psFree(stats);
    353353        psFree(cells);
     
    361361
    362362    if (!psMetadataCopy(outFPA->concepts, input->fpa->concepts)) {
    363         psError(PS_ERR_UNKNOWN, false, "Unable to copy FPA concepts from input to output.");
     363        psError(psErrorCodeLast(), false, "Unable to copy FPA concepts from input to output.");
    364364        psFree(stats);
    365365        psFree(view);
     
    388388        pmHDU *skyHDU = pmHDUFromCell(cell); ///< HDU
    389389        if (!skyHDU) {
    390             psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find skycell HDU.");
     390            psError(PSWARP_ERR_DATA, false, "Unable to find skycell HDU.");
    391391            psFree(view);
    392392            return false;
     
    398398
    399399    if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) {
    400         psError(PS_ERR_UNKNOWN, false, "Unable to generate WCS header.");
     400        psError(psErrorCodeLast(), false, "Unable to generate WCS header.");
    401401        psFree(stats);
    402402        return false;
     
    428428        psArray *sources = psphotLoadPSFSources (config, view);
    429429        if (!sources) {
    430             psError(PS_ERR_UNKNOWN, false, "No sources supplied to measure PSF");
     430            psError(psErrorCodeLast(), false, "No sources supplied to measure PSF");
    431431            return false;
    432432        }
  • trunk/pswarp/src/pswarpParseCamera.c

    r26896 r27096  
    3131    }
    3232    if (!status) {
    33         psError(PSWARP_ERR_CONFIG, false, "Failed to load file definition for %s", filerule);
     33        psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule);
    3434        return false;
    3535    }
     
    3838        file = pmFPAfileDefineFromRun(&status, bind, config, filerule); // File to return
    3939        if (!status) {
    40             psError(PSWARP_ERR_CONFIG, false, "Failed to load file definition for %s", filerule);
     40            psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule);
    4141            return NULL;
    4242        }
     
    6565    pmFPAfile *input = defineInputFile(config, NULL, "PSWARP.INPUT", "INPUT", PM_FPA_FILE_IMAGE);
    6666    if (!input) {
    67         psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.INPUT");
     67        psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.INPUT");
    6868        return false;
    6969    }
     
    8989    bool status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");
    9090    if (!status) {
    91         psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.SKYCELL");
     91        psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.SKYCELL");
    9292        return false;
    9393    }
     
    9797    pmFPAfile *output = pmFPAfileDefineSkycell(config, NULL, "PSWARP.OUTPUT");
    9898    if (!output) {
    99         psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT");
     99        psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT");
    100100        return false;
    101101    }
     
    104104    pmFPAfile *outMask = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.MASK");
    105105    if (!outMask) {
    106         psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT.MASK");
     106        psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.MASK");
    107107        return false;
    108108    }
     
    112112        pmFPAfile *outVariance = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.VARIANCE");
    113113        if (!outVariance) {
    114             psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT.VARIANCE");
     114            psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.VARIANCE");
    115115            return false;
    116116        }
     
    121121        pmFPAfile *outSources = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.SOURCES");
    122122        if (!outSources) {
    123             psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT.SOURCES");
     123            psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.SOURCES");
    124124            return false;
    125125        }
     
    129129    psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSWARP_RECIPE);
    130130    if (!recipe) {
    131         psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);
     131        psError(PSWARP_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);
    132132        return false;
    133133    }
     
    139139        pmFPAfile *psphotInput = pmFPAfileDefineSkycell(config, NULL, "PSPHOT.INPUT");
    140140        if (!psphotInput) {
    141             psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.INPUT"));
     141            psError(psErrorCodeLast(), false, _("Unable to generate output file from PSPHOT.INPUT"));
    142142            return false;
    143143        }
    144144        psphotInput->src = psMemIncrRefCounter(output->fpa);
    145         // specify the number of psphot input images
    146         psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);
     145        // specify the number of psphot input images
     146        psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);
    147147
    148148        pmFPAfile *psphotInSources = pmFPAfileDefineSkycell(config, output->fpa, "PSPHOT.INPUT.CMF");
    149149        if (!psphotInSources) {
    150             psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.INPUT.CMF"));
     150            psError(psErrorCodeLast(), false, _("Unable to generate output file from PSPHOT.INPUT.CMF"));
    151151            return false;
    152152        }
     
    155155        psMetadata *psphotRecipe = psMetadataLookupPtr(NULL, config->recipes, PSPHOT_RECIPE); // Recipe
    156156        if (!psphotRecipe) {
    157             psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find %s recipe.", PSPHOT_RECIPE);
     157            psError(PSWARP_ERR_CONFIG, false, "Unable to find %s recipe.", PSPHOT_RECIPE);
    158158            return false;
    159159        }
     
    162162        // Define associated psphot input/output files
    163163        if (!psphotDefineFiles(config, psphotInput)) {
    164             psError(PSPHOT_ERR_CONFIG, false,
     164            psError(PSWARP_ERR_CONFIG, false,
    165165                    "Unable to define the additional input/output files for psphot");
    166166            return false;
     
    183183                int chipNum = atoi(chips->data[i]);
    184184                if (! pmFPASelectChip(input->fpa, chipNum, false)) {
    185                     psError(PSWARP_ERR_CONFIG, true, "Chip number %d doesn't exist in camera.\n", chipNum);
     185                    psError(PSWARP_ERR_ARGUMENTS, true, "Chip number %d doesn't exist in camera.\n", chipNum);
    186186                    return false;
    187187                }
  • trunk/pswarp/src/pswarpSetMaskBits.c

    r26013 r27096  
    2828    // this function sets the required single-image mask bits
    2929    if (!pmConfigMaskSetBits (&maskIn, &markIn, config)) {
    30         psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
     30        psError (psErrorCodeLast(), false, "Unable to define the mask bit values");
    3131        return false;
    3232    }
     
    6464    }
    6565    if (!markOut) {
    66         psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!");
     66        psError(PSWARP_ERR_CONFIG, true, "Unable to define the MARK bit mask: all bits taken!");
    6767        return false;
    6868    }
     
    7171    psMetadata *warpRecipe = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE);
    7272    if (!warpRecipe) {
    73         psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);
     73        psError(PSWARP_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);
    7474        return false;
    7575    }
     
    8585    psMetadata *psphotRecipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
    8686    if (!psphotRecipe) {
    87         psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE);
     87        psError(PSWARP_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE);
    8888        return false;
    8989    }
  • trunk/pswarp/src/pswarpSetThreads.c

    r23487 r27096  
    1919{
    2020    pswarpTransformTileArgs *args = job->args->data[0];
    21     bool status = pswarpTransformTile (args);
    22     return status;
     21    return pswarpTransformTile(args);
    2322}
    2423
    25 bool pswarpSetThreads(void) {
    26 
    27     psThreadTask *task = NULL;
    28 
    29     task = psThreadTaskAlloc("PSWARP_TRANSFORM_TILE", 1);
     24bool pswarpSetThreads(void)
     25{
     26    psThreadTask *task = psThreadTaskAlloc("PSWARP_TRANSFORM_TILE", 1);
    3027    task->function = &pswarpThread_pswarpTransformTile;
    3128    psThreadTaskAdd(task);
  • trunk/pswarp/src/pswarpTransformReadout.c

    r26896 r27096  
    8989
    9090    if (!pmReadoutMaskNonfinite(input, pmConfigMaskGet("SAT", config))) {
    91         psError(PS_ERR_UNKNOWN, false, "Unable to mask non-finite pixels in input.");
     91        psError(psErrorCodeLast(), false, "Unable to mask non-finite pixels in input.");
    9292        return false;
    9393    }
     
    129129            psArrayAdd(job->args, 1, args);
    130130            if (!psThreadJobAddPending(job)) {
    131                 psError(PS_ERR_UNKNOWN, false, "Unable to warp image.");
     131                psError(psErrorCodeLast(), false, "Unable to warp image.");
    132132                return false;
    133133            }
     
    140140    // wait here for the threaded jobs to finish
    141141    if (!psThreadPoolWait (false)) {
    142         psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
     142        psError(psErrorCodeLast(), false, "Unable to interpolate image.");
    143143        return false;
    144144    }
     
    185185    if (goodPixels > 0) {
    186186        if (!pswarpTransformSources(output, input, config)) {
    187             psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
     187            psError(psErrorCodeLast(), false, "Unable to interpolate image.");
    188188            return false;
    189189        }
  • trunk/pswarp/src/pswarpTransformSources.c

    r26896 r27096  
    4545    psArray *outSources = outDetections->allSources;
    4646    if (!outSources) {
    47         outDetections->allSources = psArrayAllocEmpty(SOURCE_ARRAY_BUFFER);
    48         outSources = outDetections->allSources;
     47        outDetections->allSources = psArrayAllocEmpty(SOURCE_ARRAY_BUFFER);
     48        outSources = outDetections->allSources;
    4949    }
    5050
     
    6161        int xGrid, yGrid;           ///< Grid coordinates for local map
    6262        if (!pswarpMapGridSetGrid(sourceGrid, xIn + 0.5, yIn + 0.5, &xGrid, &yGrid)) {
    63             psError(PS_ERR_UNKNOWN, false, "Unable to get grid coordinates for source at %f,%f\n",
     63            psError(psErrorCodeLast(), false, "Unable to get grid coordinates for source at %f,%f\n",
    6464                    xIn, yIn);
    6565            psFree(outDetections);
     
    7676        double xOut, yOut;          ///< Output coordinates
    7777        if (!pswarpMapApply(&xOut, &yOut, map, xIn + 0.5, yIn + 0.5)) {
    78             psError(PS_ERR_UNKNOWN, false, "Unable to transform coordinates for source at %f,%f\n",
     78            psError(psErrorCodeLast(), false, "Unable to transform coordinates for source at %f,%f\n",
    7979                    xIn, yIn);
    8080            psFree(outDetections);
     
    111111
    112112        new->modelPSF = pmModelAlloc(source->modelPSF->type);
    113         new->modelPSF->params->data.F32[PM_PAR_I0]=
    114           (isfinite(new->psfMag) ? pow(10.0, -0.4*new->psfMag) : NAN);
    115         new->modelPSF->dparams->data.F32[PM_PAR_I0]=
    116           (isfinite(new->psfMag) ? new->errMag*pow(10.0, -0.4*new->psfMag) : NAN);
     113        new->modelPSF->params->data.F32[PM_PAR_I0]=
     114          (isfinite(new->psfMag) ? pow(10.0, -0.4*new->psfMag) : NAN);
     115        new->modelPSF->dparams->data.F32[PM_PAR_I0]=
     116          (isfinite(new->psfMag) ? new->errMag*pow(10.0, -0.4*new->psfMag) : NAN);
    117117
    118118#if 0
  • trunk/pswarp/src/pswarpTransformTile.c

    r23487 r27096  
    9898            psImageMaskType maskValue = inMaskData ? inMaskData[(int)yIn][(int)xIn] : 0; // Value of mask
    9999            if (!psImageInterpolate(&imageValue, &varValue, &maskValue, xIn, yIn, args->interp)) {
    100                 psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
     100                psError(psErrorCodeLast(), false, "Unable to interpolate image.");
    101101                return false;
    102102            }
Note: See TracChangeset for help on using the changeset viewer.