IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2009, 4:04:51 PM (17 years ago)
Author:
eugene
Message:

extract ghosts in first pass, extract pixels along with stars

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroExtractStars.c

    r23591 r23592  
    8383        return false;
    8484    }
     85
    8586    char *filename = NULL;
    8687    psStringAppend (&filename, "%s.st.fits", fileroot);
    87 
    8888    psFits *outStars = psFitsOpen (filename, "w");
    8989    if (!outStars) {
     
    9191        return false;
    9292    }
     93    psFree (filename);
     94
     95    filename = NULL;
     96    psStringAppend (&filename, "%s.gh.fits", fileroot);
     97    psFits *outGhosts = psFitsOpen (filename, "w");
     98    if (!outGhosts) {
     99        psError(PS_ERR_IO, false, "error opening file %s\n", filename);
     100        return false;
     101    }
     102    psFree (filename);
    93103
    94104    pmFPAview *view = pmFPAviewAlloc (0);
     
    103113    psMetadataAddF32 (phu, PS_LIST_TAIL, "EXPTIME", 0, "exptime", exptime);
    104114    psMetadataAddF32 (phu, PS_LIST_TAIL, "ZEROPT",  0, "zeropt", zeropt);
     115
    105116    psFitsWriteBlank (outStars, phu, NULL);
     117    psFitsWriteBlank (outGhosts, phu, NULL);
    106118    psFree (phu);
    107119
     
    145157                    psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_Y",   0, "focal-plane coordinate", ref->FP->y);
    146158                    psMetadataAddF32 (header, PS_LIST_TAIL, "MAG",     0, "magnitude",              ref->Mag);
     159
     160                    snprintf (extname, 80, "extname.%05d", nExt);
     161                    psFitsWriteImage (outStars, header, subraster, 0, extname);
     162                    nExt ++;
     163                   
     164                    psFree (header);
     165                    psFree (subraster);
     166                }
     167
     168                // select the raw objects for this readout (loaded in psastroExtract.c)
     169                psArray *ghosts = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.GHOSTS");
     170                if (ghosts == NULL) { continue; }
     171
     172                // identify the bright stars of interest
     173                for (int i = 0; i < ghosts->n; i++) {
     174                    pmAstromObj *ghost = ghosts->data[i];
     175
     176                    pmReadout *inReadout = pmFPAviewThisReadout (view, input->fpa);
     177                    psImage *subraster = psastroExtractStar (inReadout->image, ghost->chip->x, ghost->chip->y, 200.0, 200.0);
     178                    if (!subraster) continue;
     179                   
     180                    // generate a (very) basic header:
     181                    psMetadata *header = psMetadataAlloc ();
     182                    psMetadataAddF32 (header, PS_LIST_TAIL, "CHIP_X",  0, "chip coordinate",        ghost->chip->x);
     183                    psMetadataAddF32 (header, PS_LIST_TAIL, "CHIP_Y",  0, "chip coordinate",        ghost->chip->y);
     184                    psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_X",   0, "focal-plane coordinate", ghost->FP->x);
     185                    psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_Y",   0, "focal-plane coordinate", ghost->FP->y);
     186                    psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_X0",  0, "star focal-plane coordinate", ghost->TP->x); // note : over-loaded value
     187                    psMetadataAddF32 (header, PS_LIST_TAIL, "FPA_Y0",  0, "star focal-plane coordinate", ghost->TP->y); // note : over-loaded value
     188                    psMetadataAddF32 (header, PS_LIST_TAIL, "MAG",     0, "magnitude",              ghost->Mag);
    147189
    148190                    snprintf (extname, 80, "extname.%05d", nExt);
Note: See TracChangeset for help on using the changeset viewer.