IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12806


Ignore:
Timestamp:
Apr 11, 2007, 1:59:28 PM (19 years ago)
Author:
eugene
Message:

moved analysis steps into psastroAnalysis.c
moved file definitions into psastroDefineFiles.c
created psastroInternal.h, and psastroStandAlone.h
moved library prototypes only in psastro.h

Location:
trunk/psastro/src
Files:
4 added
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/Makefile.am

    r11554 r12806  
    99
    1010psastro_SOURCES = \
    11         psastro.c               
     11        psastro.c                   \
     12        psastroArguments.c          \
     13        psastroParseCamera.c        \
     14        psastroDataLoad.c           \
     15        psastroCleanup.c
     16
     17## move DataSave to psastro_SOURCES?
    1218
    1319libpsastro_la_SOURCES = \
    14 psastroArguments.c          \
    15 psastroErrorCodes.c         \
    16 psastroVersion.c            \
    17 psastroCleanup.c            \
    18 psastroParseCamera.c        \
    19 psastroDataLoad.c           \
    20 psastroDataSave.c           \
    21 psastroAstromGuess.c        \
    22 psastroLoadRefstars.c       \
    23 psastroChooseRefstars.c     \
    24 psastroConvert.c            \
    25 psastroChipAstrom.c         \
    26 psastroOneChip.c            \
    27 psastroUtils.c              \
    28 psastroTestFuncs.c          \
    29 psastroLuminosityFunction.c \
    30 psastroRefstarSubset.c      \
    31 psastroMosaicAstrom.c       \
    32 psastroMosaicGradients.c    \
    33 psastroMosaicChipAstrom.c   \
    34 psastroMosaicOneChip.c      \
    35 psastroMosaicSetAstrom.c    \
    36 psastroMosaicSetMatch.c     \
    37 psastroDemoDump.c           \
    38 psastroDemoPlot.c
     20        psastroErrorCodes.c         \
     21        psastroVersion.c            \
     22        psastroDataSave.c           \
     23        psastroDefineFiles.c        \
     24        psastroAnalysis.c           \
     25        psastroAstromGuess.c        \
     26        psastroLoadRefstars.c       \
     27        psastroChooseRefstars.c     \
     28        psastroConvert.c            \
     29        psastroChipAstrom.c         \
     30        psastroOneChip.c            \
     31        psastroUtils.c              \
     32        psastroTestFuncs.c          \
     33        psastroLuminosityFunction.c \
     34        psastroRefstarSubset.c      \
     35        psastroMosaicAstrom.c       \
     36        psastroMosaicGradients.c    \
     37        psastroMosaicChipAstrom.c   \
     38        psastroMosaicOneChip.c      \
     39        psastroMosaicSetAstrom.c    \
     40        psastroMosaicSetMatch.c     \
     41        psastroDemoDump.c           \
     42        psastroDemoPlot.c
    3943
    4044include_HEADERS = \
    4145        psastro.h \
    4246        psastroErrorCodes.h
     47
     48noinst_HEADERS = \
     49        psastroInternal.h \
     50        psastroStandAlone.h
    4351
    4452clean-local:
  • trunk/psastro/src/psastro.c

    r12492 r12806  
    1 # include "psastro.h"
     1# include "psastroStandAlone.h"
    22
    33static void usage (void) {
     
    99
    1010    pmConfig *config = NULL;
    11     psArray *refs = NULL;
    1211
    1312    psTimerStart ("complete");
     
    3635    }
    3736
    38     // interpret the available initial astrometric information
    39     // apply the initial guess
    40     if (!psastroAstromGuess (config)) {
    41         psErrorStackPrint(stderr, "failed to determine initial astrometry guess\n");
     37    if (!psastroAnalysis (config)) {
     38        psErrorStackPrint(stderr, "failure in psastro analysis\n");
    4239        exit (1);
    4340    }
    44 
    45     // load the reference stars overlapping the data stars
    46     refs = psastroLoadRefstars (config);
    47     if (!refs) {
    48         psErrorStackPrint(stderr, "failed to load reference data\n");
    49         exit (1);
    50     }
    51 
    52     // choose reference stars corresponding to the selected chips
    53     if (!psastroChooseRefstars (config, refs)) {
    54         psErrorStackPrint(stderr, "failed to select reference data for chips\n");
    55         exit (1);
    56     }
    57 
    58     // XXX does this check the recipe??
    59     bool chipastro = psMetadataLookupBool (NULL, config->arguments, "PSASTRO.CHIP.MODE");
    60     bool mosastro  = psMetadataLookupBool (NULL, config->arguments, "PSASTRO.MOSAIC.MODE");
    61     if (!chipastro && !mosastro) {
    62         psLogMsg ("psastro", 3, "no astrometry mode selected, assuming chip mode\n");
    63         chipastro= true;
    64     }
    65 
    66     if (chipastro) {
    67         if (!psastroChipAstrom (config, refs)) {
    68             psErrorStackPrint(stderr, "failed to perform single chip astrometry\n");
    69             exit (1);
    70         }
    71     }
    72 
    73     if (mosastro) {
    74         if (!psastroMosaicAstrom (config, refs)) {
    75             psErrorStackPrint(stderr, "failed to perform mosaic camera astrometry\n");
    76             exit (1);
    77         }
    78     }
    79 
    80     // XXX how do we specify stack astrometry?
    81     // psastroStackAstrom (config, refs);
    82 
     41   
    8342    // write out the results
    8443    if (!psastroDataSave (config)) {
     
    8948    psLogMsg ("psastro", 3, "complete psastro run: %f sec\n", psTimerMark ("complete"));
    9049
    91     psastroCleanup (config, refs);
     50    psastroCleanup (config);
    9251    exit (EXIT_SUCCESS);
    9352}
  • trunk/psastro/src/psastro.h

    r12718 r12806  
    1 # ifdef HAVE_CONFIG_H
    2 # include <config.h>
    3 # endif
     1/* This file defines the library functions available to external programs.  It must be included
     2 * by programs which are compiled against psphot functions.
     3 */
    44
    5 # include <stdio.h>
    6 # include <string.h>
    7 # include <strings.h>  // for strcasecmp
    8 # include <unistd.h>   // for unlink
    9 # include <pslib.h>
    10 # include <psmodules.h>
     5# ifndef PSASTRO_H
     6# define PSASTRO_H
    117
    128# include "psastroErrorCodes.h"
    13 #define PSASTRO_RECIPE "PSASTRO" // Name of the recipe to use
     9# define PSASTRO_RECIPE "PSASTRO" // Name of the recipe to use
    1410
    1511# define psMemCopy(A)(psMemIncrRefCounter((A)))
     
    2723} pmLumFunc;
    2824
    29 pmConfig         *psastroArguments (int argc, char **argv);
    30 void              psastroCleanup (pmConfig *config, psArray *refs);
    31 bool              psastroParseCamera (pmConfig *config);
    32 bool              psastroDataLoad (pmConfig *config);
    3325bool              psastroDataSave (pmConfig *config);
     26bool              psastroDefineFiles (pmConfig *config, pmFPAfile *input);
     27bool              psastroAnalysis (pmConfig *config);
    3428
    3529bool              psastroConvertFPA (pmFPA *fpa, psMetadata *recipe);
     
    3832bool              psastroAstromGuess (pmConfig *config);
    3933
    40 // bool              pmAstromReadWCS (pmFPA *fpa, pmChip *chip, psMetadata *header, double plateScale, bool isMosaic);
    41 // bool              pmAstromWriteWCS (psPlaneTransform *toFPA, psPlaneDistort *toTPA, psProjection *toSky, psMetadata *header, double plateScale);
    4234psPlaneDistort   *psPlaneDistortIdentity ();
    43 bool psPlaneDistortIsIdentity (psPlaneDistort *distort);
     35bool              psPlaneDistortIsIdentity (psPlaneDistort *distort);
    4436
    4537psArray          *psastroLoadRefstars (pmConfig *config);
    46 bool              psastroChipAstrom (pmConfig *config, psArray *refs);
     38bool              psastroChipAstrom (pmConfig *config);
    4739bool              psastroOneChip (pmFPA *fpa, pmChip *chip, psArray *refset, psArray *rawset, psMetadata *recipe, psMetadata *updates);
    4840bool              psastroChooseRefstars (pmConfig *config, psArray *refs);
     
    5648
    5749// mosaic fitting functions
    58 bool psastroMosaicGradients (pmFPA *fpa, psMetadata *recipe);
    59 bool psastroMosaicCommonScale (pmFPA *fpa, psMetadata *recipe);
    60 bool psastroMosaicAstrom (pmConfig *config, psArray *refs);
    61 bool psastroMosaicChipAstrom (pmFPA *fpa, psMetadata *recipe, int iteration);
    62 bool psastroMosaicSetMatch (pmFPA *fpa, psMetadata *recipe, int iteration);
    63 bool psastroMosaicSetAstrom (pmFPA *fpa);
    64 bool psastroMosaicHeaders (pmConfig *config);
    65 bool psastroMosaicRescaleChips (pmFPA *fpa);
    66 bool psastroMosaicOneChip (pmChip *chip, pmReadout *readout, psMetadata *recipe, psMetadata *updates, int iteration);
     50bool              psastroMosaicGradients (pmFPA *fpa, psMetadata *recipe);
     51bool              psastroMosaicCommonScale (pmFPA *fpa, psMetadata *recipe);
     52bool              psastroMosaicAstrom (pmConfig *config);
     53bool              psastroMosaicChipAstrom (pmFPA *fpa, psMetadata *recipe, int iteration);
     54bool              psastroMosaicSetMatch (pmFPA *fpa, psMetadata *recipe, int iteration);
     55bool              psastroMosaicSetAstrom (pmFPA *fpa);
     56bool              psastroMosaicHeaders (pmConfig *config);
     57bool              psastroMosaicRescaleChips (pmFPA *fpa);
     58bool              psastroMosaicOneChip (pmChip *chip, pmReadout *readout, psMetadata *recipe, psMetadata *updates, int iteration);
    6759
    6860// Return version strings.
    69 psString psastroVersion(void);
    70 psString psastroVersionLong(void);
     61psString          psastroVersion(void);
     62psString          psastroVersionLong(void);
    7163
    7264// demo plots
    73 bool psastroPlotRawstars (psArray *rawstars, pmFPA *fpa, pmChip *chip);
    74 bool psastroPlotRefstars (psArray *refstars);
    75 bool psastroPlotOneChipFit (psArray *rawstars, psArray *refstars, psArray *match, pmAstromFitResults *results);
     65bool              psastroPlotRawstars (psArray *rawstars, pmFPA *fpa, pmChip *chip);
     66bool              psastroPlotRefstars (psArray *refstars);
     67bool              psastroPlotOneChipFit (psArray *rawstars, psArray *refstars, psArray *match, pmAstromFitResults *results);
    7668
    77 bool psastroDumpRawstars (psArray *rawstars, pmFPA *fpa, pmChip *chip);
    78 bool psastroDumpRefstars (psArray *refstars, char *filename);
    79 bool psastroDumpMatches (pmFPA *fpa, char *filename);
    80 bool psastroDumpStars (psArray *stars, char *filename);
     69bool              psastroDumpRawstars (psArray *rawstars, pmFPA *fpa, pmChip *chip);
     70bool              psastroDumpRefstars (psArray *refstars, char *filename);
     71bool              psastroDumpMatches (pmFPA *fpa, char *filename);
     72bool              psastroDumpStars (psArray *stars, char *filename);
    8173
    82 bool psastroMosaicSetAstrom_tmp (pmFPA *fpa);
    83 int psastroSortByMag (const void **a, const void **b);
     74bool              psastroMosaicSetAstrom_tmp (pmFPA *fpa);
     75int               psastroSortByMag (const void **a, const void **b);
     76
     77# endif /* PSASTRO_H */
  • trunk/psastro/src/psastroArguments.c

    r12793 r12806  
    1 # include "psastro.h"
     1# include "psastroStandAlone.h"
    22
    33pmConfig *psastroArguments (int argc, char **argv) {
  • trunk/psastro/src/psastroAstromGuess.c

    r12708 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33// this function loads the header WCS astrometry terms into the fpa terms and applies the
  • trunk/psastro/src/psastroChipAstrom.c

    r12718 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22# define NONLIN_TOL 0.001 /* tolerance in pixels */
    33
    4 bool psastroChipAstrom (pmConfig *config, psArray *refs) {
     4bool psastroChipAstrom (pmConfig *config) {
    55
    66    pmChip *chip = NULL;
  • trunk/psastro/src/psastroChooseRefstars.c

    r12718 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33bool psastroChooseRefstars (pmConfig *config, psArray *refs) {
  • trunk/psastro/src/psastroCleanup.c

    r12492 r12806  
    1 # include "psastro.h"
     1# include "psastroStandAlone.h"
    22
    3 void psastroCleanup (pmConfig *config, psArray *refs) {
     3void psastroCleanup (pmConfig *config) {
    44
    5     psFree (refs);
    65    psFree (config);
    76
  • trunk/psastro/src/psastroConvert.c

    r11551 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22// leak free 2006.04.27
    33
  • trunk/psastro/src/psastroDataLoad.c

    r10438 r12806  
    1 # include "psastro.h"
     1# include "psastroStandAlone.h"
    22// this loop loads the data from the input files and selects the
    33// brighter stars for astrometry
  • trunk/psastro/src/psastroDataSave.c

    r11269 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22// XXX leak free 2006.04.27
    33
  • trunk/psastro/src/psastroDemoDump.c

    r12492 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33// this function is used for test purposes (-trace psastro.dump.psastroAstromGuess 1)
  • trunk/psastro/src/psastroDemoPlot.c

    r11468 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33# if (HAVE_KAPA)
  • trunk/psastro/src/psastroLoadRefstars.c

    r12794 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22# define ELIXIR_MODE 1
    33
     
    2222    PS_ASSERT (CATDIR, NULL);
    2323
    24     char *getstarCommand = psMetadataLookupStr(NULL, recipe, "DVO.GETSTAR");
     24    char *getstarCommand = psMemIncrRefCounter(psMetadataLookupStr(NULL, recipe, "DVO.GETSTAR"));
    2525    PS_ASSERT (getstarCommand, NULL);
    2626
     
    4444    }
    4545
    46     // XXX check for a default name (use .ptolemyrc)?
    47     if (CATDIR) {
     46    // check for default name (use .ptolemyrc), or use specified CATDIR
     47    if (strcasecmp(CATDIR, "NONE")) {
    4848        psStringAppend (&getstarCommand, " -D CATDIR %s", CATDIR);
    49     }
     49    } 
    5050
    5151    // psStringAppend (&getstarCommand, " -D CATMODE mef -maglim %f -region %f %f %f %f -o %s", MAGmax, RAmin, DECmin, RAmax, DECmax, tempFile);
     
    8989    // convert the Average table to the pmAstromObj entries
    9090    psTimerStart ("psastro");
     91
    9192    psArray *refstars = psArrayAllocEmpty (table->n);
    9293    for (int i = 0; i < table->n; i++) {
  • trunk/psastro/src/psastroLuminosityFunction.c

    r12712 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22# define dMag 0.1
    33// XXX put this in config?
  • trunk/psastro/src/psastroMosaicAstrom.c

    r12718 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22# define NONLIN_TOL 0.001 /* tolerance in pixels */
    33
    44// XXX require this fpa to have multiple chip extensions and a PHU?
    5 bool psastroMosaicAstrom (pmConfig *config, psArray *refs) {
     5bool psastroMosaicAstrom (pmConfig *config) {
    66
    77    // select the current recipe
  • trunk/psastro/src/psastroMosaicChipAstrom.c

    r12718 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22# define NONLIN_TOL 0.001 /* tolerance in pixels */
    33
  • trunk/psastro/src/psastroMosaicGetGrads.c

    r12492 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33psArray *psastroMosaicGetGrads (pmFPA *fpa, psMetadata *recipe) {
  • trunk/psastro/src/psastroMosaicGradients.c

    r12712 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33bool psastroMosaicGradients (pmFPA *fpa, psMetadata *recipe) {
  • trunk/psastro/src/psastroMosaicHeaders.c

    r10613 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33bool psastroMosaicHeaders (pmConfig *config) {
  • trunk/psastro/src/psastroMosaicOneChip.c

    r12718 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33# define REQUIRED_RECIPE_VALUE(VALUE, NAME, TYPE, MESSAGE)\
  • trunk/psastro/src/psastroMosaicSetAstrom.c

    r10880 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33bool psastroMosaicSetAstrom (pmFPA *fpa) {
  • trunk/psastro/src/psastroMosaicSetMatch.c

    r10880 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33bool psastroMosaicSetMatch (pmFPA *fpa, psMetadata *recipe, int iteration) {
  • trunk/psastro/src/psastroOneChip.c

    r12718 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33# define REQUIRED_RECIPE_VALUE(VALUE, NAME, TYPE, MESSAGE)\
  • trunk/psastro/src/psastroParseCamera.c

    r10855 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33bool psastroParseCamera (pmConfig *config) {
     
    1212    }
    1313
    14     // select recipe options supplied on command line
    15     psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE);
    16 
    17     // set default recipe values here
    18     psMetadataAddStr (recipe, PS_LIST_TAIL, "PHOTCODE",    PS_META_NO_REPLACE, "", "NONE");
    19     psMetadataAddStr (recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_NO_REPLACE, "", "NONE");
    20 
    21     // these calls bind the I/O handle to the specified fpa
    22     pmFPAfileDefineOutput (config, input->fpa, "PSASTRO.OUTPUT");
     14    // define the additional input/output files associated with psphot
     15    if (!psastroDefineFiles (config, input)) {
     16        psError(PSASTRO_ERR_CONFIG, false, "Trouble defining the additional input/output files");
     17        return false;
     18    }
    2319
    2420    // Chip selection: turn on only the chips specified (option is not required)
  • trunk/psastro/src/psastroRefstarSubset.c

    r12712 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33bool psastroRefstarSubset (pmReadout *readout) {
  • trunk/psastro/src/psastroTestFuncs.c

    r9574 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22
    33// write out objects
  • trunk/psastro/src/psastroUtils.c

    r12712 r12806  
    1 # include "psastro.h"
     1# include "psastroInternal.h"
    22# define RENORM 0
    33
  • trunk/psastro/src/psastroVersion.c

    r10292 r12806  
    1 #ifdef HAVE_CONFIG_H
    2 #include <config.h>
    3 #endif
    4 
    5 #include <stdio.h>
    6 #include <pslib.h>
    7 #include <psmodules.h>
    8 #include "psastro.h"
     1#include "psastroInternal.h"
    92
    103static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name
Note: See TracChangeset for help on using the changeset viewer.