IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15036


Ignore:
Timestamp:
Sep 26, 2007, 1:30:05 PM (19 years ago)
Author:
eugene
Message:

added PS1_DEV_1 I/O mode; switch bzero to memset, drop deprecated files

Location:
trunk/Ohana/src/addstar
Files:
4 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/Makefile

    r13106 r15036  
    5858$(SRC)/greference.$(ARCH).o \
    5959$(SRC)/grefstars.$(ARCH).o \
    60 $(SRC)/gstars.$(ARCH).o \
     60$(SRC)/LoadStars.$(ARCH).o \
    6161$(SRC)/in_image.$(ARCH).o \
    6262$(SRC)/load_subpix.$(ARCH).o \
     
    7373$(SRC)/ReadImageHeader.$(ARCH).o \
    7474$(SRC)/update_coords.$(ARCH).o
    75 
    76 # $(SRC)/gimages.$(ARCH).o \
    7775
    7876ADDSTARD = \
     
    111109$(SRC)/getusnob.$(ARCH).o \
    112110$(SRC)/ImageOptions.$(ARCH).o \
    113 $(SRC)/gimages.$(ARCH).o \
    114111$(SRC)/greference.$(ARCH).o \
    115112$(SRC)/in_image.$(ARCH).o \
     
    148145$(SRC)/gettycho.$(ARCH).o \
    149146$(SRC)/greference.$(ARCH).o \
    150 $(SRC)/gimages.$(ARCH).o \
    151147$(SRC)/in_image.$(ARCH).o \
    152148$(SRC)/load_subpix.$(ARCH).o \
     
    171167$(SRC)/SocketOps.$(ARCH).o \
    172168$(SRC)/ConfigInit.$(ARCH).o \
    173 $(SRC)/gstars.$(ARCH).o \
     169$(SRC)/LoadStars.$(ARCH).o \
    174170$(SRC)/grefstars.$(ARCH).o \
    175171$(SRC)/load_subpix.$(ARCH).o \
  • trunk/Ohana/src/addstar/include/addstar.h

    r13142 r15036  
    102102
    103103/* these globals are used separately by both client and server (KEEP) */
    104 double ZeroPt;  // double check for consistency
    105104double CAL_INSTMAG_MAX;
    106105double CAL_INSTMAG_MIN;
     
    155154Stars     *grefcat                PROTO((char *Refcat, SkyRegion *catstats, int photcode, int *nstars));
    156155Stars     *grefstars              PROTO((char *file, int photcode, int *Nstars));
    157 Stars     *gstars                 PROTO((char *file, int *Nstars, Image **images, int *Nimages, int photcode));
     156Stars     *LoadStars              PROTO((char *file, int *Nstars, Image **images, int *Nimages, int photcode));
    158157int        in_image               PROTO((double r, double d, Image *image));
    159158int        load_pt_catalog        PROTO((Catalog *catalog, SkyRegion *region));  /*** choose new name ***/
     
    199198Measure   *sort_measure           PROTO((Average *average, int Naverage, Measure *measure, int Nmeasure, int *next));
    200199Missing   *sort_missing           PROTO((Average *average, int Naverage, Missing *missing, int Nmissing, int *next_miss));
    201 Stars     *ConvertSMPDATA         PROTO((FTable *table, int *nstars));
    202 Stars     *ConvertPS1_DEV_0       PROTO((FTable *table, int *nstars));
    203200int        ImageOptions           PROTO((AddstarClientOptions *options, Image *images, int Nimages));
    204201int        GetFileMode            PROTO((Header *header));
     
    229226int        NewReflist_Thread      PROTO((int BindSocket));
    230227
     228Stars     *Convert_SMPDATA        PROTO((FTable *table, int *nstars));
     229Stars     *Convert_PS1_DEV_0      PROTO((FTable *table, int *nstars));
     230Stars     *Convert_PS1_DEV_1      PROTO((FTable *table, int *nstars));
     231
    231232int args_skycells (int argc, char **argv);
    232233int ConfigInit_skycells (int *argc, char **argv);
  • trunk/Ohana/src/addstar/src/ConfigInit.c

    r13140 r15036  
    55AddstarClientOptions ConfigInit (int *argc, char **argv) {
    66
     7  double ZERO_POINT;
    78  char *config, *file;
    89  char RadiusWord[80];
     
    9596    SKY_TABLE[0] = 0;
    9697  }
     98  GetConfig (config, "ZERO_PT",                "%lf", 0, &ZERO_POINT);
     99  SetZeroPoint (ZERO_POINT);
    97100
    98101  if (!ScanConfig (config, "IMAGE_TABLE",       "%s",  0, ImageCat)) {
  • trunk/Ohana/src/addstar/src/LoadStars.c

    r14590 r15036  
    1 
    2 /* read an image header corresponding to a CMF / CMP data block */
    3 Image *ReadImageHeader (Header *header) {
    4 
     1# include "addstar.h"
     2
     3Stars *LoadStars (char *filename, int *Nstars, Image **images, int *Nimages, int photcode) {
     4
     5  int i, j, N, Nfile, Nheader, NHEADER, Nimage, NIMAGE;
     6  int Nskip, Nhead, Ndata, done, status, mode, NinStars;
     7  char **file, *name;
     8  FILE *f;
     9  glob_t globList;
     10  char **exthead, **extdata, **exttype, tmpword[80];
     11  int *extnum_head, *extnum_data, *extsize;
     12  Header *header, **headers;
    513  Image *image;
    6 
    7   ALLOCATE (image, Image, 1);
    8 
    9   /* get astrometry information */
    10   if (!GetCoords (&image[0].coords, &header)) {
    11     fprintf (stderr, "ERROR: no astrometric solution in header\n");
     14  Stars *inStars, *stars;
     15
     16  // parse the filename as a glob
     17  globList.gl_offs = 0;
     18  glob (filename, 0, NULL, &globList);
     19
     20  // if the glob does not match, save the literal word:
     21  // otherwise save all glob matches
     22  if (globList.gl_pathc == 0) {
     23    Nfile = 1;
     24    ALLOCATE (file, char *, Nfile);
     25    file[0] = strcreate (filename);
     26  } else {
     27    Nfile = globList.gl_pathc;
     28    ALLOCATE (file, char *, Nfile);
     29    for (i = 0; i < Nfile; i++) {
     30      file[i] = strcreate (globList.gl_pathv[i]);
     31    }
     32  }
     33
     34  // open the first file, read the PHU header
     35  f = fopen (file[0], "r");
     36  if (f == NULL) {
     37    fprintf (stderr, "ERROR: can't read header for %s\n", file[0]);
    1238    exit (1);
    1339  }
    14   itmp = 0;
    15   gfits_scan (&header, "NASTRO",   "%d", 1, &itmp);
    16   if ((itmp == 0) && !ACCEPT_ASTROM) {
    17     fprintf (stderr, "ERROR: bad astrometric solution in header\n");
     40  ALLOCATE (header, Header, 1);
     41  gfits_fread_header (f, header);
     42
     43  mode = GetFileMode (header);
     44
     45  stars = NULL;
     46  *Nstars = 0;
     47
     48  /*** load data from a single PHU or a collection of PHU files ***/
     49  if ((mode != SIMPLE_MEF) && (mode != MOSAIC_MEF)) {
     50    Nimage = Nfile;
     51    ALLOCATE (image, Image, Nimage);
     52    for (i = N = 0; i < Nfile; i++) {
     53      // XXX we should not drop all input images if one fails
     54      if (i > 0) {
     55        f = fopen (file[i], "r");
     56        if (f == NULL) {
     57          fprintf (stderr, "can't read header for %s, skipping\n", file[i]);
     58          continue;
     59        }
     60        gfits_fread_header (f, header);
     61      }
     62
     63      if (!ReadImageHeader (header, &image[N], photcode)) {
     64        fprintf (stderr, "skipping %s\n", file[i]);
     65        continue;
     66      }
     67     
     68      /* find image rootname */
     69      name = filebasename (file[i]);
     70      snprintf (image[N].name, 64, name);
     71      free (name);
     72   
     73      switch (mode) {
     74        case SIMPLE_CMP:
     75        case MOSAIC_CMP:
     76          inStars = ReadStarsTEXT (f, &image[N].nstar);
     77          inStars = FilterStars (inStars, &image[N]);
     78          stars = MergeStars (stars, Nstars, inStars, image[N].nstar);
     79          break;
     80
     81        case SIMPLE_CMF:
     82        case MOSAIC_CMF:
     83          inStars = ReadStarsFITS (f, header, NULL, &image[N].nstar);
     84          inStars = FilterStars (inStars, &image[N]);
     85          stars = MergeStars (stars, Nstars, inStars, image[N].nstar);
     86          break;
     87
     88        case MOSAIC_PHU:
     89          inStars = NULL;
     90          NinStars = 0;
     91          break;
     92      }
     93      fclose (f);
     94      gfits_free_header (header);
     95      N++;
     96    }
     97    *Nimages = N;
     98    *images = image;
     99   
     100    if (N == 0) {
     101      // XXX how do we track this error?
     102      fprintf (stderr, "no valid image data in %s, giving up\n", filename);
     103      exit (0);
     104    }
     105
     106    return stars;
     107  }
     108   
     109  /* we have a multi-chip image */
     110
     111  /* supplied photcode is incompatible with multi-chip images */
     112  if (photcode) {
     113    fprintf (stderr, "ERROR: photcode cannot be supplied to multi-chip images -- manually adjust the headers\n");
    18114    exit (1);
    19115  }
    20   if (!strcmp (&image[0].coords.ctype[4], "-WRP")) {
    21     if (MOSAIC == NULL) {
    22       fprintf (stderr, "ERROR: no mosaic for WRP image (use -mosaic)\n");
    23       exit (1);
    24     }
    25     RegisterMosaic (MOSAIC);
    26   } else {
    27     /* force image to lie in 0-360 range */
    28     while (image[0].coords.crval1 < 0) image[0].coords.crval1 += 360.0;
    29     while (image[0].coords.crval1 > 360.0) image[0].coords.crval1 -= 360.0;
    30   }
    31    
    32   /* CERROR in data file is in arcsec */
    33   if (!gfits_scan (&header, "CERROR",   "%lf", 1, &tmp)) tmp = 1.0;
    34   image[0].cerror = tmp * 50.0;
    35   gfits_scan (&header, "NAXIS1",   "%hd", 1, &image[0].NX);
    36   gfits_scan (&header, "NAXIS2",   "%hd", 1, &image[0].NY);
    37  
    38   /* get photcode from header */
    39   if (photcode == 0) {
    40     if (!gfits_scan (&header, "PHOTCODE", "%s", 1, photname)) {
    41       fprintf (stderr, "ERROR: photcode not supplied in header\n");
    42       exit (1);
    43     }
    44     photcode = GetPhotcodeCodebyName (photname);
    45     if (photcode == 0) {
    46       fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", photname);
    47       exit (1);
    48     }
    49   }
    50   if (photcode == 0) {
    51     fprintf (stderr, "ERROR: no valid photcode is supplied\n");
    52     exit (1);
    53   }
    54   image[0].photcode = photcode;
    55 
    56   image[0].NX -= XOVERSCAN;
    57   image[0].NY -= YOVERSCAN;
    58   gfits_scan (&header, ExptimeKeyword,  "%lf", 1, &tmp);
    59   image[0].exptime = tmp;
    60  
    61   /*** why are we no longer using APMIFIT?? ***/
    62   tmp = 0;
    63   /* gfits_scan (&header, "APMIFIT",  "%lf", 1, &tmp); */
    64   image[0].apmifit = tmp;
    65 
    66   tmp = 0;
    67   /* gfits_scan (&header, "dAPMIFIT", "%lf", 1, &tmp); */
    68   image[0].dapmifit = tmp;
    69 
    70   tmp = 0;
    71   gfits_scan (&header, "FLIMIT",   "%lf", 1, &tmp);
    72   image[0].detection_limit = tmp * 10.0;
    73 
    74   tmp = 0;
    75   gfits_scan (&header, "FSATUR",   "%lf", 1, &tmp);
    76   image[0].saturation_limit = tmp * 10.0;
    77 
    78   tmp = 0;
    79   gfits_scan (&header, "FWHM_X",   "%lf", 1, &tmp);
    80   image[0].fwhm_x = tmp * 25.0 * image[0].coords.cdelt1 * 3600.0;
    81 
    82   tmp = 0;
    83   gfits_scan (&header, "FWHM_Y",   "%lf", 1, &tmp);
    84   image[0].fwhm_y = tmp * 25.0 * image[0].coords.cdelt1 * 3600.0;
    85 
    86   if (!gfits_scan (&header, "TZERO",   "%d",  1, &image[0].tzero)) {
    87     image[0].tzero = parse_time (&header);
    88   }
    89 
    90   if (STKeyword[0]) {
    91     /* get ST (used for airmass calculation) */
    92     gfits_scan (&header, STKeyword, "%s", 1, line);
    93     /* remove ':' characters */
    94     for (c = strchr (line, ':'); c != (char *) NULL; c = strchr (line, ':')) { *c = ' '; }
    95     sscanf (line, "%d %d %lf", &hour, &min, &sec);
    96     image[0].sidtime = hour + min/60.0 + sec/3600.0;
    97   } else {
    98     double jd;
    99     jd = ohana_sec_to_jd (image[0].tzero);
    100     image[0].sidtime  = ohana_lst (jd, Longitude);
    101   }
    102   image[0].latitude = Latitude;
    103 
    104   tmp = 0;
    105   gfits_scan (&header, "TRATE",   "%lf", 1, &tmp);
    106   image[0].trate = 10000 * tmp;
    107 
    108   tmp = 0;
    109   gfits_scan (&header, AirmassKeyword, "%lf", 1, &tmp);
    110   image[0].secz = MIN (NO_MAG, tmp);
    111 
    112   if (!gfits_scan (&header, CCDNumKeyword, "%d", 1, &itmp)) {
    113     image[0].ccdnum = 0xff;
    114   } else {
    115     image[0].ccdnum = itmp;
    116   }
    117 
    118   gfits_scan (&header, "ZERO_PT", "%lf", 1, &ZeroPt);
    119   SetZeroPoint (ZeroPt);
    120 
    121   /* secz is in units milli-airmass */
    122   image[0].Mcal = 0.0;
    123   image[0].Xm   = NO_MAG;
    124   image[0].code = 0;
    125   bzero (image[0].dummy, sizeof(image[0].dummy));
    126 
    127   /* find expected number of stars */
    128   if (!gfits_scan (&header, "NSTARS", "%d", 1, &image[0].nstar)) {
    129     fprintf (stderr, "ERROR: can't get NSTARS from header\n");
    130     exit (1);
    131   }
    132 
     116
     117  /* we need to examine the extensions to determine the headers and the data */
     118  NHEADER = 10;
     119  ALLOCATE (headers, Header *, NHEADER);
     120
     121  // the first header is already loaded
     122  headers[0] = header;
     123  Nskip = gfits_matrix_size (header);
     124  fseek (f, Nskip, SEEK_CUR);
     125
     126  // load all headers into memory
     127  done = FALSE;
     128  for (i = 1; !done; i++) {
     129      ALLOCATE (headers[i], Header, 1);
     130      status = gfits_fread_header (f, headers[i]);
     131      if (!status) {
     132          done = TRUE;
     133      } else {
     134          Nskip = gfits_matrix_size (headers[i]);
     135          fseek (f, Nskip, SEEK_CUR);
     136      }
     137      if (i == NHEADER - 1) {
     138          NHEADER += 10;
     139          REALLOCATE (headers, Header *, NHEADER);
     140      }
     141  }
     142  Nheader = i - 1; /* we failed on the last loop */
     143   
     144  // space to store the images, indexes to the matching headers
     145  Nimage = 0;
     146  NIMAGE = Nheader;
     147  ALLOCATE (image, Image, NIMAGE);
     148  ALLOCATE (exthead, char *, NIMAGE);
     149  ALLOCATE (extdata, char *, NIMAGE);
     150  ALLOCATE (exttype, char *, NIMAGE);
     151  ALLOCATE (extnum_head, int, NIMAGE);
     152  ALLOCATE (extnum_data, int, NIMAGE);
     153  ALLOCATE (extsize, int, Nheader);
     154
     155  if (mode == MOSAIC_MEF) {
     156      exthead[Nimage] = strcreate ("PHU");
     157      extdata[Nimage] = strcreate ("NONE");
     158      extnum_data[Nimage] = -1;
     159      extnum_head[Nimage] = 0;
     160      Nimage ++;
     161  }
     162
     163  // now examine the headers, count the table entries, find corresponding headers
     164  for (i = 0; i < Nheader; i++) {
     165      extsize[i] = headers[i][0].size + gfits_matrix_size (headers[i]);
     166      gfits_scan (headers[i], "EXTTYPE", "%s", 1, tmpword);
     167
     168      if (!strcmp (tmpword, "SMPDATA")   || 
     169          !strcmp (tmpword, "PS1_DEV_0") || 
     170          !strcmp (tmpword, "PS1_DEV_1")) {
     171
     172          exttype[Nimage] = strcreate (tmpword);
     173          gfits_scan (headers[i], ExtnameKeyword, "%s", 1, tmpword);
     174          extdata[Nimage] = strcreate (tmpword);
     175          gfits_scan (headers[i], "EXTHEAD", "%s", 1, tmpword);
     176          exthead[Nimage] = strcreate (tmpword);
     177          extnum_data[Nimage] = i;
     178          extnum_head[Nimage] = -1;
     179          // find the matching exthead entry
     180          for (j = 0; j < Nheader; j++) {
     181            if (gfits_scan (headers[j], ExtnameKeyword, "%s", 1, tmpword)) {
     182              if (!strcmp (tmpword, exthead[Nimage])) {
     183                extnum_head[Nimage] = j;
     184              }
     185            }
     186          }
     187          // skip or crash on table with missing matching header?
     188          if (extnum_head[Nimage] == -1) {
     189              fprintf (stderr, "ERROR: can't read header for %s\n", file[0]);
     190              exit (1);
     191          }
     192          Nimage ++;
     193      }
     194  }
     195  // some old format files did not write EXTTYPE.  they have a single table in the first
     196  // extension matched to the header in the PHU
     197  if (Nimage == 0) {
     198      extsize[0] = headers[0][0].size + gfits_matrix_size (headers[0]);
     199      extsize[1] = headers[1][0].size + gfits_matrix_size (headers[1]);
     200      gfits_scan (headers[1], ExtnameKeyword, "%s", 1, tmpword);
     201      if (!strcmp (tmpword, "SMPFILE")) {
     202          extdata[Nimage] = strcreate (tmpword);
     203          exttype[Nimage] = strcreate ("SMPDATA");
     204          exthead[Nimage] = strcreate ("PHU");
     205          extnum_head[Nimage] = 0;
     206          extnum_data[Nimage] = 1;
     207          Nimage = 1;
     208      }
     209  }
     210  if (Nimage == 0) Shutdown ("no object data in file");
     211   
     212  if (VERBOSE) fprintf (stderr, "file %s has %d headers, including %d images\n", file[0], Nheader, Nimage);
     213
     214  /* find image rootname */
     215  name = filebasename (file[0]);
     216
     217  // now run through the images, interpret the headers and read the stars
     218  for (i = N = 0; i < Nimage; i++) {
     219      Nhead = extnum_head[i];
     220
     221      if (VERBOSE) fprintf (stderr, "reading header for %s (%s)\n", exthead[i], extdata[i]);
     222      if (!ReadImageHeader (headers[Nhead], &image[N], 0)) {
     223          fprintf (stderr, "skipping %s\n", exthead[i]);
     224          continue;
     225      }
     226
     227      // XXX use something to set the chip name? EXTNAME?
     228      if (!strcmp(exthead[i], "PHU") && (Nimage == 1)) {
     229        snprintf (image[N].name, 64, "%s", name);
     230      } else {
     231        snprintf (image[N].name, 64, "%s[%s]", name, exthead[i]);
     232      }
     233
     234      // skip the table if there is not data segment (eg, mosaic WRP image)
     235      if (!strcmp(extdata[i], "NONE")) {
     236          N++;
     237          continue;
     238      }
     239
     240      // advance the pointer to the start of the corresponding table block
     241      Ndata = extnum_data[i];
     242      Nskip = 0;
     243      for (j = 0; j < Ndata; j++) {
     244          Nskip += extsize[j];
     245      }
     246      fseek (f, Nskip, SEEK_SET);
     247         
     248      inStars = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &image[N].nstar);
     249      inStars = FilterStars (inStars, &image[N]);
     250      stars = MergeStars (stars, Nstars, inStars, image[N].nstar);
     251      N++;
     252  }
     253  free (name);
     254  *Nimages = N;
     255  *images = image;
     256
     257  if (N == 0) {
     258    fprintf (stderr, "no valid image data in %s, giving up\n", filename);
     259    exit (0);
     260  }
     261
     262  return stars;
     263}
  • trunk/Ohana/src/addstar/src/ReadImageHeader.c

    r14590 r15036  
    66
    77  int Nastro, ccdnum, hour, min, Nx, Ny;
    8   double tmp, sec, Cerror;
     8  double tmp, sec, Cerror, ZeroPt;
    99  char *c, photname[64], line[80];
    1010
     
    146146
    147147  gfits_scan (header, "ZERO_PT", "%lf", 1, &ZeroPt);
    148   SetZeroPoint (ZeroPt);
     148  if (ZeroPt != GetZeroPoint()) {
     149      fprintf (stderr, "inconsistent zero point values: image: %f, config: %f\n", ZeroPt, GetZeroPoint());
     150      return (FALSE);
     151  }
    149152
    150153  /* secz is in units milli-airmass */
     
    152155  image[0].Xm   = NO_MAG;
    153156  image[0].code = 0;
    154   bzero (image[0].dummy, sizeof(image[0].dummy));
     157  memset (image[0].dummy, 0, sizeof(image[0].dummy));
    155158
    156159  /* find expected number of stars */
  • trunk/Ohana/src/addstar/src/ReadStarsFITS.c

    r12732 r15036  
    3232  stars = NULL;
    3333  if (!strcmp (type, "SMPDATA")) {
    34     stars = ConvertSMPDATA (&table, &Nstars);
     34    stars = Convert_SMPDATA (&table, &Nstars);
    3535  }
    3636  if (!strcmp (type, "PS1_DEV_0")) {
    37     stars = ConvertPS1_DEV_0 (&table, &Nstars);
     37    stars = Convert_PS1_DEV_0 (&table, &Nstars);
     38  }
     39  if (!strcmp (type, "PS1_DEV_1")) {
     40    stars = Convert_PS1_DEV_1 (&table, &Nstars);
    3841  }
    3942  if (stars == NULL) {
     
    4851}
    4952
    50 Stars *ConvertSMPDATA (FTable *table, int *nstars) {
     53Stars *Convert_SMPDATA (FTable *table, int *nstars) {
    5154
    5255  int i, Nstars, swapped;
     
    7780}
    7881
    79 // XXX I need to make the IPP I/O functions and these functions
    80 // consistent wrt ZERO_POINT....
    81 Stars *ConvertPS1_DEV_0 (FTable *table, int *nstars) {
     82Stars *Convert_PS1_DEV_0 (FTable *table, int *nstars) {
    8283
    8384  int i, Nstars;
     85  double ZeroPt;
    8486  Stars *stars;
    8587  PS1_DEV_0 *ps1data;
    8688
    8789  ps1data = gfits_table_get_PS1_DEV_0 (table, &Nstars, NULL);
     90  ZeroPt = GetZeroPoint();
    8891
    8992  ALLOCATE (stars, Stars, Nstars);
     
    9396    stars[i].dX      = ps1data[i].dX;
    9497    stars[i].dY      = ps1data[i].dY;
    95     stars[i].M       = ps1data[i].M + 25.0;
     98    stars[i].M       = ps1data[i].M + ZeroPt;
    9699    stars[i].dM      = ps1data[i].dM;
    97100    stars[i].Mpeak   = ps1data[i].Mpeak;
     
    138141  return (stars);
    139142}
     143
     144// XXX I need to make the IPP I/O functions and these functions
     145// consistent wrt ZERO_POINT....
     146Stars *Convert_PS1_DEV_1 (FTable *table, int *nstars) {
     147
     148  int i, Nstars;
     149  double ZeroPt;
     150  Stars *stars;
     151  PS1_DEV_1 *ps1data;
     152
     153  ps1data = gfits_table_get_PS1_DEV_1 (table, &Nstars, NULL);
     154  ZeroPt = GetZeroPoint();
     155
     156  ALLOCATE (stars, Stars, Nstars);
     157  for (i = 0; i < Nstars; i++) {
     158    stars[i].X       = ps1data[i].X;
     159    stars[i].Y       = ps1data[i].Y;
     160    stars[i].dX      = ps1data[i].dX;
     161    stars[i].dY      = ps1data[i].dY;
     162    stars[i].M       = ps1data[i].M + ZeroPt;
     163    stars[i].dM      = ps1data[i].dM;
     164    stars[i].Mpeak   = ps1data[i].Mpeak;
     165
     166    stars[i].sky     = ps1data[i].sky;
     167    stars[i].dsky    = ps1data[i].dSky;
     168
     169    stars[i].fx      = ps1data[i].fx;
     170    stars[i].fy      = ps1data[i].fy;
     171    stars[i].df      = ps1data[i].df;
     172
     173    stars[i].psfProb   = ps1data[i].psfProb;
     174    stars[i].psfQual   = ps1data[i].psfQual;
     175    stars[i].crNsigma  = ps1data[i].crNsigma;
     176    stars[i].extNsigma = ps1data[i].extNsigma;
     177
     178    stars[i].detID   = ps1data[i].detID;
     179
     180    /* these are set elsewhere */
     181    stars[i].R       = 0.0;
     182    stars[i].D       = 0.0;
     183    stars[i].dR      = 0.0;
     184    stars[i].dD      = 0.0;
     185
     186    stars[i].uR      = 0.0;
     187    stars[i].uD      = 0.0;
     188    stars[i].duR     = 0.0;
     189    stars[i].duD     = 0.0;
     190
     191    stars[i].P       = 0.0;
     192    stars[i].dP      = 0.0;
     193
     194    stars[i].Mcal    = 0;
     195    stars[i].t       = 0;
     196    stars[i].dt      = 0;
     197    stars[i].airmass = 0;
     198    stars[i].code    = 0;
     199    stars[i].found   = 0;
     200
     201    /* these are not used */
     202    stars[i].Map     = NO_MAG;
     203    stars[i].Mgal    = NO_MAG;
     204    stars[i].dophot  = 0;
     205  }   
     206  *nstars = Nstars;
     207  return (stars);
     208}
  • trunk/Ohana/src/addstar/src/ReadStarsTEXT.c

    r10897 r15036  
    3939        Nskip = c2 - c;
    4040        nbytes -= Nskip;
    41         bzero (buffer + nbytes, Nskip);
     41        memset (buffer + nbytes, 0, Nskip);
    4242        if (VERBOSE) fprintf (stderr, "deleted %d extra return chars\n", Nskip);
    4343      }
     
    5252        Nskip = c2 - c;
    5353        nbytes -= Nskip;
    54         bzero (buffer + nbytes, Nskip);
     54        memset (buffer + nbytes, 0, Nskip);
    5555        if (VERBOSE) fprintf (stderr, "deleted line, %d extra chars\n", Nskip);
    5656      } else {
  • trunk/Ohana/src/addstar/src/SkyTableFromTychoIndex.c

    r7974 r15036  
    3434    tycho[i].Dmax = atof (&line[36]);
    3535
    36     bzero (tycho[i].name, 21);
     36    memset (tycho[i].name, 0, 21);
    3737    strncpy (tycho[i].name, line, 7);
    3838    tycho[i].name[7] = 0;
     
    5656  regions[Nr].child     =  TRUE;
    5757  regions[Nr].table     =  FALSE;
    58   bzero (regions[Nr].name, 21);
     58  memset (regions[Nr].name, 0, 21);
    5959  strcpy (regions[Nr].name, "fullsky");
    6060 
     
    7575    regions[Nr].child     =  TRUE;
    7676    regions[Nr].table     =  FALSE;
    77     bzero (regions[Nr].name, 21);
     77    memset (regions[Nr].name, 0, 21);
    7878    strcpy (regions[Nr].name, DecNames[i]);
    7979  }
     
    8989    regions[Nr].child     =  TRUE;
    9090    regions[Nr].table     =  FALSE;
    91     bzero (regions[Nr].name, 21);
     91    memset (regions[Nr].name, 0, 21);
    9292    strcpy (regions[Nr].name, DecNames[i+13]);
    9393  }
  • trunk/Ohana/src/addstar/src/SocketOps.c

    r12332 r15036  
    1313
    1414  host = gethostbyname (hostname);
    15   bzero (hostip, 80);
     15  memset (hostip, 0, 80);
    1616  for (i = 0; i < host[0].h_length; i++) {
    1717    sprintf (tmpline, "%u", (0xff & host[0].h_addr[i]));
     
    125125
    126126  host = gethostbyname (hostname);
    127   bzero (hostip, 80);
     127  memset (hostip, 0, 80);
    128128  for (i = 0; i < host[0].h_length; i++) {
    129129    sprintf (tmpline, "%u", (0xff & host[0].h_addr[i]));
     
    170170
    171171  host = gethostbyname (hostname);
    172   bzero (hostip, 80);
     172  memset (hostip, 0, 80);
    173173  for (i = 0; i < host[0].h_length; i++) {
    174174    sprintf (tmpline, "%u", (0xff & host[0].h_addr[i]));
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Image.c

    r14401 r15036  
    9696    if (db.dbstate == LCK_EMPTY) {
    9797      if (VERBOSE) fprintf (stderr, "can't find %s, creating a new one\n", ImageCat);
    98       dvo_image_create (&db, ZeroPt);
     98      dvo_image_create (&db, GetZeroPoint());
    9999    } else {
    100100      if (!dvo_image_load (&db, VERBOSE, FORCE_READ)) {
  • trunk/Ohana/src/addstar/src/addstar.c

    r14401 r15036  
    3737  switch (options.mode) {
    3838    case M_IMAGE:
    39       stars = gstars (argv[1], &Nstars, &images, &Nimages, options.photcode);
     39      stars = LoadStars (argv[1], &Nstars, &images, &Nimages, options.photcode);
    4040      if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars);
    4141      for (i = 0; i < Nimages; i++) {
     
    163163  /* load or create the image table */
    164164  if (db.dbstate == LCK_EMPTY) {
     165    double ZeroPt;
    165166    if (VERBOSE) fprintf (stderr, "can't find %s, creating a new one\n", ImageCat);
    166     dvo_image_create (&db, ZeroPt);
     167    dvo_image_create (&db, GetZeroPoint());
    167168  } else {
    168169    if (!dvo_image_load (&db, VERBOSE, FORCE_READ)) {
  • trunk/Ohana/src/addstar/src/addstarc.c

    r10939 r15036  
    2121    case M_IMAGE:
    2222      /* load data */
    23       stars = gstars (argv[1], &Nstars, &images, &Nimages, options.photcode);
     23      stars = LoadStars (argv[1], &Nstars, &images, &Nimages, options.photcode);
    2424
    2525      /* send data to server */
  • trunk/Ohana/src/addstar/src/calibrate.c

    r14590 r15036  
    113113    }
    114114    if (found0 && found1 && found2) {
    115       Mcal   = new[0].M + 0.001*mycode[0].C + mycode[0].K*(new[0].airmass - 1.0) - ZeroPt;
     115      Mcal   = new[0].M + 0.001*mycode[0].C + mycode[0].K*(new[0].airmass - 1.0) - GetZeroPoint();
    116116      color  = CalM1 - CalM2 - 0.001*mycode[0].dX;
    117117      factor = color;
     
    124124      }
    125125      // if we want to apply a Mcal -> Mref color correction, we need the additional color term
    126       Minst = new[0].M - ZeroPt - new[0].dt;
     126      Minst = new[0].M - GetZeroPoint() - new[0].dt;
    127127      SaveCalibration (Mcal, new[0].dM, CalM0, dCalM, Minst, Nstar);
    128128      if ((DUMP != NULL) && !strcmp (DUMP, "cal")) {
     
    156156  /* create a hash array from Nstar[] entries */
    157157  ALLOCATE (Nlist, int, MaxN + 1);
    158   bzero (Nlist, MAX (0, MaxN*sizeof(int)));
     158  memset (Nlist, 0, MAX (0, MaxN*sizeof(int)));
    159159  for (i = 0; i < Ncal; i++) {
    160160    Nlist[Nstar[i]] ++;
  • trunk/Ohana/src/addstar/src/fakeimage.c

    r12332 r15036  
    130130    image[i+1].Xm   = NO_MAG;
    131131    image[i+1].code = 0;
    132     bzero (image[i+1].dummy, sizeof(image[i+1].dummy));
     132    memset (image[i+1].dummy, 0, sizeof(image[i+1].dummy));
    133133
    134134    image[i+1].nstar = 0;
     
    189189  image[0].Xm   = NO_MAG;
    190190  image[0].code = 0;
    191   bzero (image[0].dummy, sizeof(image[0].dummy));
     191  memset (image[0].dummy, 0, sizeof(image[0].dummy));
    192192  image[0].nstar = 0;
    193193  image[0].Myyyy = 0;
  • trunk/Ohana/src/addstar/src/find_proper.c

    r12332 r15036  
    2727  /* no need to do this twice!! */
    2828  ALLOCATE (usnodist, float, Nave);
    29   bzero (usnodist, Nave*sizeof(float));
     29  memset (usnodist, 0, Nave*sizeof(float));
    3030
    3131  X2 = usnostats[0].X;
  • trunk/Ohana/src/addstar/src/getusno.c

    r6675 r15036  
    110110      if (buf[1] > iDEC1) continue;
    111111
    112       bzero (&stars[Nusno], sizeof(Stars));
     112      memset (&stars[Nusno], 0, sizeof(Stars));
    113113      stars[Nusno].R     = buf[0]/360000.0;
    114114      stars[Nusno].D     = buf[1]/360000.0 - 90.0;
  • trunk/Ohana/src/addstar/src/getusnob.c

    r14590 r15036  
    120120      /* USNO coords are reported for J2000 / epoch 2000.0 */
    121121      /* extract the basic stellar data */
    122       bzero (&stars[Nusno], sizeof(Stars));
     122      memset (&stars[Nusno], 0, sizeof(Stars));
    123123      stars[Nusno].R   = buf[0]/360000.0;
    124124      stars[Nusno].D   = buf[1]/360000.0 - 90.0;
Note: See TracChangeset for help on using the changeset viewer.