IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 20, 2006, 8:57:16 PM (20 years ago)
Author:
eugene
Message:

modifications to support psphot on pmReadout with full IPP config files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotOutput.c

    r6056 r6117  
    22
    33// output functions: we have several fixed modes (sx, obj, cmp)
    4 void psphotOutput (pmReadout *readout, psMetadata *header, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky) {
     4void psphotOutput (pmReadout *readout, psMetadata *config) {
    55
    66    bool status;
    77
    88    psTimerStart ("psphot");
     9
     10    psMetadata *header = pmReadoutGetHeader (readout);
     11
     12    psArray *sources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
     13    pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");
    914
    1015    char *outputMode = psMetadataLookupPtr (&status, config, "OUTPUT_MODE");
     
    2934        return;
    3035    }
     36    if (!strcasecmp (outputMode, "SX")) {
     37        pmSourcesWriteSX (sources, outputFile);
     38        return;
     39    }
    3140    if (!strcasecmp (outputMode, "OBJ")) {
    32         pmSourcesWriteOBJ (readout, config, outputFile, sources, psf, sky);
     41        pmSourcesWriteOBJ (sources, outputFile);
    3342        return;
    3443    }
    35     if (!strcasecmp (outputMode, "SX")) {
    36         pmSourcesWriteSX (readout, config, outputFile, sources, psf, sky);
     44    if (!strcasecmp (outputMode, "CMP")) {
     45        pmSourcesWriteCMP (sources, outputFile, header);
    3746        return;
    3847    }
    39     if (!strcasecmp (outputMode, "CMP")) {
    40         pmSourcesWriteCMP (readout, header, config, outputFile, sources, psf, sky);
     48    if (!strcasecmp (outputMode, "CMF")) {
     49        pmSourcesWriteCMF (sources, outputFile, header);
    4150        return;
    4251    }
    43     if (!strcasecmp (outputMode, "CMF")) {
    44         pmSourcesWriteCMF (readout, header, config, outputFile, sources, psf, sky);
     52    if (!strcasecmp (outputMode, "TEXT")) {
     53        pmSourcesWriteText (sources, outputFile);
    4554        return;
    4655    }
    47     if (!strcasecmp (outputMode, "TEXT")) {
    48         pmSourcesWriteText (readout, config, outputFile, sources, psf, sky);
    49         return;
    50     }
    5156
    5257    psAbort ("psphot", "unknown output mode %s", outputMode);
     
    5459
    5560// dophot-style output list with fixed line width
    56 bool pmSourcesWriteOBJ (pmReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
     61bool pmSourcesWriteOBJ (psArray *sources, char *filename) {
    5762
    5863    int type;
    59     pmModel *model;
    6064    psF32 *PAR, *dPAR;
    6165    float dmag, apResid;
    62     bool status;
    6366
    6467    psLine *line = psLineAlloc (104);  // 104 is dophot-defined line length
     
    6972        return false;
    7073    }
    71 
    72     float RADIUS = psMetadataLookupF32 (&status, config, "AP_RADIUS");
    7374
    7475    // write sources with models
    7576    for (int i = 0; i < sources->n; i++) {
    7677        pmSource *source = (pmSource *) sources->data[i];
    77 
    78         model = pmSourceMagnitudes (source, psf, RADIUS);
     78        pmModel *model = pmModelSelect (source);
    7979        if (model == NULL) continue;
    8080
     
    106106
    107107// elixir-mode / sextractor-style output list with fixed line width
    108 bool pmSourcesWriteSX (pmReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
    109 
    110     pmModel *model;
     108bool pmSourcesWriteSX (psArray *sources, char *filename) {
     109
    111110    psF32 *PAR, *dPAR;
    112111    float dmag;
    113     bool status;
    114112
    115113    psLine *line = psLineAlloc (110);  // 110 is sextractor line length
     
    120118        return false;
    121119    }
    122 
    123     float RADIUS = psMetadataLookupF32 (&status, config, "AP_RADIUS");
    124120
    125121    // write sources with models
    126122    for (int i = 0; i < sources->n; i++) {
    127123        pmSource *source = (pmSource *) sources->data[i];
    128 
    129         model = pmSourceMagnitudes (source, psf, RADIUS);
     124        pmModel *model = pmModelSelect (source);
    130125        if (model == NULL) continue;
    131126
     
    157152
    158153// elixir-style pseudo FITS table (header + ascii list)
    159 bool pmSourcesWriteCMP (pmReadout *readout, psMetadata *header, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
     154bool pmSourcesWriteCMP (psArray *sources, char *filename, psMetadata *header) {
    160155
    161156    int i, type;
    162     pmModel *model;
    163157    psMetadataItem *mdi;
    164158    psF32 *PAR, *dPAR;
     
    167161
    168162    // find config information for output header
    169     float RADIUS = psMetadataLookupF32 (&status, config, "AP_RADIUS");
    170     float ZERO_POINT = psMetadataLookupF32 (&status, config, "ZERO_POINT");
     163    float ZERO_POINT = psMetadataLookupF32 (&status, header, "ZERO_PT");
    171164    if (!status) ZERO_POINT = 25.0;
    172165
    173166    // write necessary information to output header
    174     psphotUpdateHeader (header, config);
    175167    psMetadataAdd (header, PS_LIST_TAIL, "NSTARS",   PS_DATA_S32 | PS_META_REPLACE, "NUMBER OF STARS", sources->n);
    176168
     
    200192    for (i = 0; i < sources->n; i++) {
    201193        pmSource *source = (pmSource *) sources->data[i];
    202 
    203         model = pmSourceMagnitudes (source, psf, RADIUS);
     194        pmModel *model = pmModelSelect (source);
    204195        if (model == NULL) continue;
    205196
     
    232223// this format consists of a header derived from the image header
    233224// followed by a zero-size matrix, followed by the table data
    234 bool pmSourcesWriteCMF (pmReadout *readout, psMetadata *header, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *skyStats) {
     225bool pmSourcesWriteCMF (psArray *sources, char *filename, psMetadata *header) {
    235226
    236227    psArray *table;
     
    239230    psMetadata *theader;
    240231    int i, type;
    241     pmModel *model;
    242232    psF32 *PAR, *dPAR;
    243233    float dmag, lsky;
     
    245235
    246236    // find config information for output header
    247     float RADIUS = psMetadataLookupF32 (&status, config, "AP_RADIUS");
    248     float ZERO_POINT = psMetadataLookupF32 (&status, config, "ZERO_POINT");
    249 
    250     // write necessary information to output header
    251     psphotUpdateHeader (header, config);
     237    float ZERO_POINT = psMetadataLookupF32 (&status, header, "ZERO_PT");
    252238
    253239    table = psArrayAlloc (sources->n);
     
    256242    for (i = 0; i < sources->n; i++) {
    257243        pmSource *source = (pmSource *) sources->data[i];
    258 
    259         model = pmSourceMagnitudes (source, psf, RADIUS);
     244        pmModel *model = pmModelSelect (source);
    260245        if (model == NULL) continue;
    261246
     
    309294/***** Text Output Methods *****/
    310295
    311 bool pmSourcesWriteText (pmReadout *readout, psMetadata *config, char *filename, psArray *sources, pmPSF *psf, psStats *sky) {
     296bool pmSourcesWriteText (psArray *sources, char *filename) {
    312297
    313298    char *name = (char *) psAlloc (strlen(filename) + 10);
    314299
    315300    sprintf (name, "%s.psf.dat", filename);
    316     pmModelWritePSFs (sources, config, name, psf);
     301    pmModelWritePSFs (sources, name);
    317302
    318303    sprintf (name, "%s.ext.dat", filename);
     
    330315
    331316// write the PSF sources to an output file
    332 bool pmModelWritePSFs (psArray *sources, psMetadata *config, char *filename, pmPSF *psf) {
     317bool pmModelWritePSFs (psArray *sources, char *filename) {
    333318
    334319    double dPos, dMag;
     
    337322    psF32 *PAR, *dPAR;
    338323    pmModel  *model;
    339     bool status;
    340 
    341     float RADIUS = psMetadataLookupF32 (&status, config, "AP_RADIUS");
    342324
    343325    f = fopen (filename, "w");
     
    350332    for (i = 0; i < sources->n; i++) {
    351333        pmSource *source = (pmSource *) sources->data[i];
    352 
    353334        if (source->type != PM_SOURCE_STAR) continue;
    354         model = pmSourceMagnitudes (source, psf, RADIUS);
     335        model = source->modelPSF;
    355336        if (model == NULL) continue;
    356337
Note: See TracChangeset for help on using the changeset viewer.