IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38540


Ignore:
Timestamp:
Jun 24, 2015, 6:02:53 PM (11 years ago)
Author:
eugene
Message:

add radial apertures

Location:
branches/eam_branches/ipp-20150616/Ohana/src/addstar
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150616/Ohana/src/addstar/include/addstar.h

    r38525 r38540  
    266266// Stars     *MergeStars             PROTO((Stars *stars, unsigned int *Nstars, Stars *instars, unsigned int Ninstars));
    267267
    268 // int        ReadXradFITS           PROTO((FILE *f, Header *theader, Stars *stars, unsigned int Nstars));
     268int        ReadXradFITS           PROTO((FILE *f, Header *theader, Catalog *catalog));
    269269
    270270double     scat_subpix            PROTO((double x, double y));
  • branches/eam_branches/ipp-20150616/Ohana/src/addstar/src/FilterStars.c

    r38525 r38540  
    2727  Catalog *outcat = addstar_catalog_init (newcat->Nmeasure);
    2828  ALLOCATE (outcat->average, Average, newcat->Nmeasure);
     29  if (newcat->lensing) {
     30    ALLOCATE (outcat->lensing, Lensing, newcat->Nlensing);
     31  }
    2932 
    3033  for (N = j = 0; j < newcat->Nmeasure; j++) {
     
    4245    dvo_average_init (&outcat->average[N]);
    4346    outcat->measure[N] = newcat->measure[j];
     47
     48    if (newcat->lensing) {
     49      outcat->lensing[N] = newcat->lensing[j];
     50      outcat->average[N].Nlensing = 1;
     51      outcat->average[N].lensingOffset = N;
     52    }
    4453
    4554    outcat->average[N].Nmeasure = 1;
  • branches/eam_branches/ipp-20150616/Ohana/src/addstar/src/LoadData.c

    r38536 r38540  
    8888    images[0][Nvalid].nstar = newcat->Nmeasure;
    8989
    90 # if (0)
    9190    // XRAD : if we want to read the xrad table, skip to that table here:
    9291    if (headerSets[i].extnum_xrad != -1) {
     
    9897      fseeko (f, Nskip, SEEK_SET);
    9998     
    100       if (!ReadXradFITS (f, headers[Nxrad], &catalog[ncatalog], images[0][Nvalid].nstar)) {
     99      if (!ReadXradFITS (f, headers[Nxrad], newcat)) {
    101100        fprintf (stderr, "problem reading the radial flux data for %s\n", headerSets[i].extdata);
    102101      }
    103102    }
    104 # endif
    105103
    106104    // replace full input catalog newcat with subset version
  • branches/eam_branches/ipp-20150616/Ohana/src/addstar/src/ReadStarsFITS.c

    r38530 r38540  
    12051205    catalog->lensing[i].E2_psf      = ps1data[i].E2_psf;
    12061206
    1207     // catalog->lensing[i].F_ApR5    = ps1data[i].F_ApR5;
    1208     // catalog->lensing[i].dF_ApR5   = ps1data[i].dF_ApR5;
    1209     // catalog->lensing[i].sF_ApR5   = ps1data[i].sF_ApR5;
    1210     // catalog->lensing[i].fF_ApR5   = ps1data[i].fF_ApR5;
    1211     //
    1212     // catalog->lensing[i].F_ApR6    = ps1data[i].F_ApR6;
    1213     // catalog->lensing[i].dF_ApR6   = ps1data[i].dF_ApR6;
    1214     // catalog->lensing[i].sF_ApR6   = ps1data[i].sF_ApR6;
    1215     // catalog->lensing[i].fF_ApR6   = ps1data[i].fF_ApR6;
    1216 
    1217     // this is may optionally be replaced by the internal sequence (see FilterStars.c)
    1218     catalog->lensing[i].detID      = ps1data[i].detID;
     1207    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     1208    catalog->lensing[i].detID       = ps1data[i].detID;
    12191209
    12201210    // the Average fields and the following Measure fields are set in FilterStars after
  • branches/eam_branches/ipp-20150616/Ohana/src/addstar/src/ReadXradFITS.c

    r38153 r38540  
    33// given a file with the pointer at the start of the table block and the
    44// corresponding image header, load the xrad data from the table
    5 int ReadXradFITS (FILE *f, Header *theader, Stars *stars, unsigned int Nstars) {
     5int ReadXradFITS (FILE *f, Header *theader, Catalog *catalog) {
    66
    77  FTable table;
     
    5151  myAssert (Nrow == NrowAlt, "column mismatch?");
    5252
    53   if (Nrow > Nstars) {
     53  if (Nrow > catalog->Nmeasure) {
    5454    myAbort("more radial measurements than stars?  seems like a bug\n");
    5555  }
    5656
     57  myAssert (catalog->lensing, "lensing is not allocated");
     58  // we could allocate here, or just insist this is an error?
     59  // if (!catalog->lensing) {
     60  //   ALLOCATE (catalog->lensing, Lensing, catalog->Nmeasure);
     61  // }
     62
    5763  int i;
    5864  int Nap = 0;
    59   for (i = 0; i < Nstars; i++) {
    60     if (stars[i].measure.detID < RadID[Nap]) {
    61       continue; // this star does not have an aperture
     65  for (i = 0; i < catalog->Nmeasure; i++) {
     66    if (catalog->measure[i].detID < RadID[Nap]) {
     67      myAbort("star without radial aperture, seems like a bug"); // this star does not have an aperture
    6268    }
    63     if (stars[i].measure.detID > RadID[Nap]) {
     69    if (catalog->measure[i].detID > RadID[Nap]) {
    6470      myAbort("radial apertures out of order?  seems like a bug\n");
    6571    }
    6672
    67     // we could allocate here, or just insist this is an error?
    68     if (!stars[i].lensing) {
    69       fprintf (stderr, "!");
    70       ALLOCATE (stars[i].lensing, Lensing, 1);
    71       dvo_lensing_init (stars[i].lensing);
    72     }
     73    // we assumed we have already set up lensing in ReadStarsFITS.c
    7374
    7475    // XXX this is all hard-wired and should make use of the headers.
     
    7778    // SDSS  3, 4, 5, 6, 7
    7879
    79     stars[i].lensing-> F_ApR5 = AperFlux   [Nap*Ncol + 2];
    80     stars[i].lensing->dF_ApR5 = AperFluxErr[Nap*Ncol + 2];
    81     stars[i].lensing->sF_ApR5 = AperFluxStd[Nap*Ncol + 2];
    82     stars[i].lensing->fF_ApR5 = AperFill   [Nap*Ncol + 2];
     80    catalog->lensing[i]. F_ApR5 = AperFlux   [Nap*Ncol + 2];
     81    catalog->lensing[i].dF_ApR5 = AperFluxErr[Nap*Ncol + 2];
     82    catalog->lensing[i].sF_ApR5 = AperFluxStd[Nap*Ncol + 2];
     83    catalog->lensing[i].fF_ApR5 = AperFill   [Nap*Ncol + 2];
    8384
    84     stars[i].lensing-> F_ApR6 = AperFlux   [Nap*Ncol + 3];
    85     stars[i].lensing->dF_ApR6 = AperFluxErr[Nap*Ncol + 3];
    86     stars[i].lensing->sF_ApR6 = AperFluxStd[Nap*Ncol + 3];
    87     stars[i].lensing->fF_ApR6 = AperFill   [Nap*Ncol + 3];
     85    catalog->lensing[i]. F_ApR6 = AperFlux   [Nap*Ncol + 3];
     86    catalog->lensing[i].dF_ApR6 = AperFluxErr[Nap*Ncol + 3];
     87    catalog->lensing[i].sF_ApR6 = AperFluxStd[Nap*Ncol + 3];
     88    catalog->lensing[i].fF_ApR6 = AperFill   [Nap*Ncol + 3];
    8889
    89     stars[i].lensing-> F_ApR7 = AperFlux   [Nap*Ncol + 4];
    90     stars[i].lensing->dF_ApR7 = AperFluxErr[Nap*Ncol + 4];
    91     stars[i].lensing->sF_ApR7 = AperFluxStd[Nap*Ncol + 4];
    92     stars[i].lensing->fF_ApR7 = AperFill   [Nap*Ncol + 4];
     90    catalog->lensing[i]. F_ApR7 = AperFlux   [Nap*Ncol + 4];
     91    catalog->lensing[i].dF_ApR7 = AperFluxErr[Nap*Ncol + 4];
     92    catalog->lensing[i].sF_ApR7 = AperFluxStd[Nap*Ncol + 4];
     93    catalog->lensing[i].fF_ApR7 = AperFill   [Nap*Ncol + 4];
    9394    Nap ++;
    9495  }
     96  catalog->Nlensing = Nap;
     97
     98  gfits_free_table (&table);
     99  free (AperFlux);
     100  free (AperFluxErr);
     101  free (AperFluxStd);
     102  free (AperFill);
     103  free (RadID);
    95104
    96105  return TRUE;
Note: See TracChangeset for help on using the changeset viewer.