IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5509


Ignore:
Timestamp:
Nov 12, 2005, 9:58:04 AM (20 years ago)
Author:
eugene
Message:

development work

Location:
trunk/psastro/src
Files:
4 edited

Legend:

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

    r5505 r5509  
    1414
    1515    // simple layout interpretation, basic WCS conversion
    16     psFPA *fpa = psastroBuildFPA (header, config);
     16    psFPA *fpa = psastroBuildFPA (header, rawstars);
    1717
    1818    // limit fit to bright stars only
    19     psArray *subset = pspsastroSelectBrightStars (config, rawstars);
     19    psFPA *subset = psastroSelectBrightStars (fpa, config);
    2020
    2121    // use the header & config info to project rawstars on the focal plane
    22     psastroProjectRawstars (subset, header, config);
     22    psastroProjectRawstars (subset);
    2323
    2424    // load the corresponding reference data (DVO command)
     
    2626
    2727    // use the header & config info to project refstars on the focal plane
    28     psastroProjectRefstars (refstars, header, config);
     28    psastroProjectRefstars (refstars, subset);
    2929
    30     // find initial offset / rotation
    31     stat = pmAstromGridMatch (subset, refstars, config);
    32 
    33     pmAstromModifyFPA (fpa, stat);
    34 
    35     // use fit result to re-project rawstars
    36     psastroProjectRawstars (fpa, subset);
    37     psastroProjectRefstars (fpa, refstars);
    38    
    39     // use small radius to match stars
    40     match = pmAstromRadiusMatch (rawstars, refstars, options);
    41 
    42     // fit astrometric terms
    43     output = pmAstromMatchedListFit (fpa, subset, refstars, match, options);
     30    // fpa and subset point to the same astrometry terms
     31    psastroChipAstrom (refstars, subset);
    4432
    4533    // write out data (cmp file)
    46     psastroWriteCMP (fpa, header, rawstars, argv[2]);
     34    psastroWriteCMP (fpa, argv[2]);
    4735
    4836    exit (0);
  • trunk/psastro/src/psastro.h

    r5506 r5509  
    3838    int colBins;                        ///< Amount of binning in x-dimension
    3939    int rowBins;                        ///< Amount of binning in y-dimension
    40     psArray *objects;                   ///< sources detected / measured on readout
     40    psArray *stars;                     ///< sources detected / measured on readout
    4141}
    4242pmReadout;
  • trunk/psastro/src/psastroBuildFPA.c

    r5506 r5509  
    11# include "psastro.h"
    22
    3 pmFPA *psastroBuildFPA (psMetadata *header, psMetadata *config) {
     3pmFPA *psastroBuildFPA (psMetadata *header, psArray *stars) {
    44
    55    // this function constructs a basic template pmFPA structure based on the information in the header
     
    3030
    3131            pmCell *cell = pmCellAlloc ();
    32             cell->chip = chip; // assign parent chip (view only; don't free)
    33             cell->header = header;
     32            cell->chip = chip;      // assign parent chip (view only; don't free)
     33            cell->header = header;  // XXX EAM : extend this function to take more than header
    3434
    3535            pmCellInterpretWCS (cell, header);
     
    3939
    4040                pmReadout *readout = pmReadoutAlloc ();
     41                readout->stars  = stars;   // XXX EAM : need more than one stars...
     42
    4143                cells->readouts->data[j] = readout;
    4244            }
     
    143145    // XXX EAM : if fpa->toSky and fpa->toTPA are already defined, then the
    144146    //           toFPA must be modified to match the crval(i), scale(i) and crpix(i)
     147    //           scale = scale(i)/scale(0) (i == chip #)
     148    //           project crval1(0),crval2(0 using projection
    145149
    146150    // XXX EAM : psPlaneTransformAlloc uses nTerm not nOrder (bug 581)
  • trunk/psastro/src/psastroUtils.c

    r5505 r5509  
    6969}
    7070
    71 psArray *psastroSelectBrightStars (psMetadata *config, psArray *stars) {
    72 
    73     stars = psArraySort (stars, psastroSortByMag);
     71psArray *psastroSelectBrightStars (pmFPA *inFPA, psMetadata *config) {
     72
     73    pmFPA *sbFPA = pmFPACopy (fpa);
    7474
    7575    // add exclusions for objects on some basis?
    7676    int MAX_NSTARS = pmMetadataLookupS32 (&status, config, "MAX_NSTARS");
    7777
    78     nSubset = PS_MIN (MAX_NSTARS, stars->n);
    79 
    80     psArray *subset = psArrayAlloc (nSubset);
    81 
    82     for (int i = 0; i < nSubset; i++) {
    83         subset->data[i] = stars->data[i];
    84     }
    85 
     78    for (int i = 0; i < inFPA->chips->n; i++) {
     79        pmChip *inChip = inFPA->chips->data[i];
     80        pmChip *sbChip = sbFPA->chips->data[i];
     81        for (int j = 0; j < Ncells; j++) {
     82            pmCell *inCell = inChip->cells->data[j];
     83o           pmCell *sbCell = sbChip->cells->data[j];
     84            for (int k = 0; k < Nreadouts; k++) {
     85                pmReadout *inReadout = inCell->readouts->data[k];
     86                pmReadout *sbReadout = sbCell->readouts->data[k];
     87
     88                inReadout->stars = psArraySort (inReadout->stars, psastroSortByMag);
     89
     90                nSubset = PS_MIN (MAX_NSTARS, stars->n);
     91
     92                psArray *subset = psArrayAlloc (nSubset);
     93
     94                for (int i = 0; i < nSubset; i++) {
     95                    subset->data[i] = inReadout->stars->data[i];
     96                }
     97                sbReadout->stars = subset;
     98            }
     99        }
     100    }
    86101    return (subset);
    87102}
     
    133148}
    134149
     150pmFPA *pmFPACopy (pmFPA *inFPA) {
     151
     152    pmFPA *fpa = pmFPAAlloc ();
     153
     154    fpa->toSky   = psMemCopy (inFPA->toSky);
     155    fpa->toTPA   = psMemCopy (inFPA->toTPA);
     156    fpa->fromTPA = psMemCopy (inFPA->fromTPA);
     157
     158    fpa->chips = psArrayAlloc (inFPA->chips->n);
     159    for (int i = 0; i < inFPA->chips->n; i++) {
     160
     161        pmChip *inChip = inFPA->chips->data[i];
     162
     163        pmChip *chip = pmChipAlloc ();
     164        chip->fpa = fpa; // assign parent fpa (view only; don't free)
     165
     166        chip->toFPA = psMemCopy (inChip->toFPA);
     167        chip->fromFPA = psMemCopy (inChip->fromFPA);
     168
     169        chip->cells = psArrayAlloc (inChip->cells->n);
     170        for (int j = 0; j < Ncells; j++) {
     171
     172            pmCell *inCell = inChip->cells->data[j];
     173
     174            pmCell *cell = pmCellAlloc ();
     175            cell->chip = chip;      // assign parent chip (view only; don't free)
     176
     177            cell->header = psMemCopy (inCell->header);
     178            cell->toChip = psMemCopy (inCell->toChip);
     179
     180            cell->readouts = psArrayAlloc (inCell);
     181            for (int k = 0; k < Nreadouts; k++) {
     182
     183                pmReadout *inReadout = inCell->readouts->data[k];
     184
     185                pmReadout *readout = pmReadoutAlloc ();
     186
     187                *readout = *inReadout;
     188                readout->stars = NULL;
     189               
     190                cell->readouts->data[k] = readout;
     191            }
     192            chip->cells->data[j] = cell;
     193        }
     194        fpa->chips->data[i] = chip;
     195    }
     196    return (fpa);
     197}
     198
     199bool psastroProjectRawstars (pmFPA *fpa) {
     200
     201    for (int i = 0; i < fpa->chips->n; i++) {
     202        pmChip *chip = fpa->chips->data[i];
     203        for (int j = 0; j < chip->cells->n; j++) {
     204            pmCell *cell = chip->cells->data[j];
     205            for (int k = 0; k < cell->readouts->n; k++) {
     206                pmReadout *readout = cell->readouts->data[k];
     207                for (int m = 0; m < readout->stars->n; m++) {
     208                    pmAstromObj *star = readout->data[m];
     209                    // apply readout offsets
     210                    // apply cell PlaneTransform
     211                    // apply chip PlaneTransform
     212                    psPlaneTransformApply (star->
     213
     214            }
     215            chip->cells->data[j] = cell;
     216        }
     217        fpa->chips->data[i] = chip;
     218    }
     219    return (fpa);
     220}
     221 
     222bool psastroChipAstrom (psArray *refstars, pmFPA *subset) {
     223
     224    // do this loop over the readouts
     225
     226    // find initial offset / rotation
     227    stat = pmAstromGridMatch (subset, refstars, config);
     228
     229    pmAstromModifyFPA (fpa, stat);
     230
     231    // use fit result to re-project rawstars
     232    psastroProjectRawstars (fpa, subset);
     233    psastroProjectRefstars (fpa, refstars);
     234   
     235    // use small radius to match stars
     236    match = pmAstromRadiusMatch (rawstars, refstars, options);
     237
     238    // fit astrometric terms
     239    output = pmAstromMatchedListFit (fpa, subset, refstars, match, options);
     240}
     241
Note: See TracChangeset for help on using the changeset viewer.