IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 24, 2010, 11:22:25 AM (16 years ago)
Author:
eugene
Message:

large update merging in changes for Ohana to support large files

Location:
trunk/Ohana
Files:
1 deleted
47 edited
6 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/addstar/include/addstar.h

    r27392 r27435  
    4444
    4545typedef struct {
    46   int Nstars;
     46  unsigned int Nstars;
    4747  Stars *stars;
    48   int Nimages;
     48  off_t Nimages;
    4949  Image *images;
    5050  Coords *mosaic;
     
    7676char   PASSWORD[80];
    7777char   HOSTNAME[80];
    78 int    NVALID, *VALID_IP;
     78int    NVALID_IP, *VALID_IP;
    7979char   SKY_TABLE[256];
    8080int    SKY_DEPTH;  /** XXX EAM : depth of catalog tables, fix usage */
     
    152152AddstarClientOptions args         PROTO((int argc, char **argv, AddstarClientOptions options));
    153153
    154 void       AddToCalibration       PROTO((Average *average, SecFilt *secfilt, Measure *measure, Measure *new, int *next, int Nstar));
     154void       AddToCalibration       PROTO((Average *average, SecFilt *secfilt, Measure *measure, Measure *new, off_t *next, off_t Nstar));
    155155void       FindCalibration        PROTO((Image *image));
    156156FILE      *GetDB                  PROTO((int *state));
    157157void       InitCalibration        PROTO((int mode));
    158 void       SaveCalibration        PROTO((float Mo, float dMo, float Mr, float dMr, float Mi, int N));
     158void       SaveCalibration        PROTO((float Mo, float dMo, float Mr, float dMr, float Mi, off_t N));
    159159void       SetProtect             PROTO((int mode));
    160160int        SetSignals             PROTO((void));
    161 int        Shutdown               PROTO((char *message, ...));
     161int        Shutdown               PROTO((char *message, ...)) OHANA_FORMAT(printf, 1, 2);
    162162void       TrapSignal             PROTO((int sig));
    163163float      airmass                PROTO((float secz_image, double ra, double dec, double st, double latitude));
     
    166166SkyTable  *SkyTableFromTychoIndex PROTO((char *filename, int VERBOSE));
    167167void       check_permissions      PROTO((char *basefile));
    168 int        dump_rawstars          PROTO((Stars *stars, int Nstars));
     168int        dump_rawstars          PROTO((Stars *stars, unsigned int Nstars));
    169169int        edge_check             PROTO((double *x1, double *y1, double *x2, double *y2));
    170 Image     *fakeimage              PROTO((char *rootname, int *Nimage, int photcode));
    171 
    172 int        find_matches           PROTO((SkyRegion *region, Stars *stars, int Nstars, Catalog *catalog, AddstarClientOptions options));
    173 int        find_matches_closest   PROTO((SkyRegion *region, Stars *stars, int Nstars, Catalog *catalog, AddstarClientOptions options));
    174 int        find_matches_refstars  PROTO((SkyRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options));
    175 int        find_matches_closest_refstars  PROTO((SkyRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options));
    176 
    177 Stars    **find_subset            PROTO((SkyRegion *region, Stars *stars, int Nstars, int *NSTARS));
     170Image     *fakeimage              PROTO((char *rootname, off_t *Nimage, int photcode));
     171
     172int        find_matches                  PROTO((SkyRegion *region, Stars *stars,  unsigned int Nstars, Catalog *catalog, AddstarClientOptions options));
     173int        find_matches_closest          PROTO((SkyRegion *region, Stars *stars,  unsigned int Nstars, Catalog *catalog, AddstarClientOptions options));
     174int        find_matches_refstars         PROTO((SkyRegion *region, Stars **stars, unsigned int Nstars, Catalog *catalog, AddstarClientOptions options));
     175int        find_matches_closest_refstars PROTO((SkyRegion *region, Stars **stars, unsigned int Nstars, Catalog *catalog, AddstarClientOptions options));
     176
     177Stars    **find_subset            PROTO((SkyRegion *region, Stars *stars, unsigned int Nstars, unsigned int *NSTARS));
    178178int        gcatalog               PROTO((Catalog *catalog));
    179 Stars     *get2mass               PROTO((SkyRegion *patch, int photcode, int mode, int *NSTARS));
     179Stars     *get2mass               PROTO((SkyRegion *patch, int photcode, int mode, unsigned int *NSTARS));
    180180double     get_subpix             PROTO((double x, double y));
    181181
    182 Stars     *greference             PROTO((char *Refcat, SkyRegion *catstats, int photcode, int *nstars));
    183 Stars     *getgsc                 PROTO((SkyRegion *patch, int *NSTARS));
    184 Stars     *gettycho               PROTO((SkyRegion *catstats, int photcode, int *Nstars));
    185 Stars     *getusno                PROTO((SkyRegion *catstats, int photcode, int *Nstars));
    186 Stars     *getusnob               PROTO((SkyRegion *catstats, int photcode, int *Nstars));
     182Stars     *greference             PROTO((char *Refcat, SkyRegion *catstats, int photcode, unsigned int *nstars));
     183Stars     *getgsc                 PROTO((SkyRegion *patch, unsigned int *NSTARS));
     184Stars     *gettycho               PROTO((SkyRegion *catstats, int photcode, unsigned int *Nstars));
     185Stars     *getusno                PROTO((SkyRegion *catstats, int photcode, unsigned int *Nstars));
     186Stars     *getusnob               PROTO((SkyRegion *catstats, int photcode, unsigned int *Nstars));
    187187
    188188// load text-based stars (REF only in the sense of REF photcodes)
    189 Stars     *grefstars              PROTO((char *file, int photcode, int *Nstars));
    190 
    191 Stars     *LoadStars              PROTO((char *file, int *Nstars, Image **images, int *Nimages, AddstarClientOptions *options));
     189Stars     *grefstars              PROTO((char *file, int photcode, unsigned int *Nstars));
     190
     191Stars     *LoadStars              PROTO((char *file, unsigned int *Nstars, Image **images, off_t *Nimages, AddstarClientOptions *options));
    192192Header   **LoadHeaders            PROTO((FILE *f, int *mode, int *Nheader));
    193 HeaderSet *MatchHeaders           PROTO((int **extsize, int *nimage, int mode, Header **headers, int Nheaders));
    194 int        LoadData               PROTO((FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int NheaderSets, AddstarClientOptions *options));
    195 int        GetZeroPointExposure   PROTO((Header **headers, HeaderSet *headerSets, int Nimages));
     193HeaderSet *MatchHeaders           PROTO((off_t **extsize, off_t *nimage, int mode, Header **headers, int Nheaders));
     194int        LoadData               PROTO((FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, int NheaderSets, AddstarClientOptions *options));
     195int        GetZeroPointExposure   PROTO((Header **headers, HeaderSet *headerSets, off_t Nimages));
    196196
    197197int        in_image               PROTO((double r, double d, Image *image));
     
    200200void       lock_image_db          PROTO((FITS_DB *db, char *filename));
    201201int        main                   PROTO((int argc, char **argv));
    202 void       make_backup            PROTO((char *filename));
    203 int        match_refstars         PROTO((Stars *stars, int Nstars));
    204 void       mkcatalog              PROTO((SkyRegion *region, Catalog *catalog));
    205202double     opening_angle          PROTO((double x1, double y1, double x2, double y2, double x3, double y3));
    206203int        parse_time             PROTO((Header *header));
    207 Stars     *rd_gsc                 PROTO((char *filename, int *nstars));
     204Stars     *rd_gsc                 PROTO((char *filename, unsigned int *nstars));
    208205int        replace_match          PROTO((Average *average, Measure *measure, Stars *star));
    209206void       resort_catalog         PROTO((Catalog *catalog));
    210 Stars     *rfits                  PROTO((FILE *f, unsigned int *nstars));
    211 Stars     *rtext                  PROTO((FILE *f, unsigned int *nstars));
    212207Stars     *ReadStarsFITS          PROTO((FILE *f, Header *header, Header *in_theader, unsigned int *nstars));
    213208Stars     *ReadStarsTEXT          PROTO((FILE *f, unsigned int *nstars));
    214 Stars     *ReadStarsSDSS          PROTO((FILE *f, char *name, Header *header, Header *in_theader, Image *images, int *nimages, unsigned int *nstars));
     209Stars     *ReadStarsSDSS          PROTO((FILE *f, char *name, Header *header, Header *in_theader, Image *images, off_t *nimages, unsigned int *nstars));
    215210int        ReadImageHeader        PROTO((Header *header, Image *image, int photcode));
    216211Stars     *FilterStars            PROTO((Stars *instars, Image *image, unsigned int imageID));
    217 Stars     *MergeStars             PROTO((Stars *stars, int *Nstars, Stars *instars, int Ninstars));
    218 void       save_pt_catalog        PROTO((Catalog *catalog));  /*** choose new name ***/
     212Stars     *MergeStars             PROTO((Stars *stars, unsigned int *Nstars, Stars *instars, unsigned int Ninstars));
    219213double     scat_subpix            PROTO((double x, double y));
    220 time_t     short_date_to_sec      PROTO((char *date));
    221 void       sort_lists             PROTO((float *X, float *Y, int *S, int N));
    222 void       sort_stars             PROTO((Stars *stars, int N));
    223 int        str_to_radec           PROTO((double *ra, double *dec, char *str1, char *str2));
    224 void       unlock_image_db        PROTO((FITS_DB *db));
    225 void       update_coords          PROTO((Average *average, Measure *measure, int *next));
    226 void       wcatalog               PROTO((Catalog *catalog));
    227 void       free_catalog           PROTO((Catalog *catalog));
    228 void       wimage                 PROTO((FITS_DB *db, Image *image));
    229 void       create_image_db        PROTO((FITS_DB *db));
    230 void       set_db                 PROTO((FITS_DB *in));
    231 void       uppercase              PROTO((char *string));
    232 void       fsort                  PROTO((float *X, int N));
    233 void       fsort2                 PROTO((float *X, float *Y, int N));
    234 int       *init_measure_links     PROTO((Average *average, int Naverage, Measure *measure, int Nmeasure));
    235 int       *init_missing_links     PROTO((Average *average, int Naverage, Missing *missing, int Nmissing));
    236 int        add_meas_link          PROTO((Average *average, int *next, int Nmeasure, int NMEASURE));
    237 int        add_miss_link          PROTO((Average *average, int *next, int Nmissing));
    238 int       *build_measure_links    PROTO((Average *average, int Naverage, Measure *measure, int Nmeasure));
    239 Measure   *sort_measure           PROTO((Average *average, int Naverage, Measure *measure, int Nmeasure, int *next));
    240 Missing   *sort_missing           PROTO((Average *average, int Naverage, Missing *missing, int Nmissing, int *next_miss));
    241 int        ImageOptions           PROTO((AddstarClientOptions *options, Image *images, int Nimages));
     214void       update_coords          PROTO((Average *average, Measure *measure, off_t *next));
     215off_t     *init_measure_links     PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure));
     216off_t     *init_missing_links     PROTO((Average *average, off_t Naverage, Missing *missing, off_t Nmissing));
     217off_t      add_meas_link          PROTO((Average *average, off_t *next_meas, off_t Nmeasure, off_t NMEASURE));
     218off_t      add_miss_link          PROTO((Average *average, off_t *next_miss, off_t Nmissing));
     219off_t     *build_measure_links    PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure));
     220Measure   *sort_measure           PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next_meas));
     221Missing   *sort_missing           PROTO((Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_miss));
     222int        ImageOptions           PROTO((AddstarClientOptions *options, Image *images, off_t Nimages));
    242223int        GetFileMode            PROTO((Header *header));
    243224AddstarClientOptions args_client  PROTO((int argc, char **argv, AddstarClientOptions options));
     
    252233int        WaitServerSocket       PROTO((int InitSocket, SockAddress *Address, int *validIP, int Nvalid));
    253234int        GetClientSocket        PROTO((char *hostname));
    254 int        UpdateDatabase_Image   PROTO((AddstarClientOptions *options, Image *images, int Nimages, Coords *mosaic, Stars *stars, int Nstars));
    255 int        UpdateDatabase_Reflist PROTO((AddstarClientOptions *options, Stars *stars, int Nstars));
     235int        UpdateDatabase_Image   PROTO((AddstarClientOptions *options, Image *images, off_t Nimages, Coords *mosaic, Stars *stars, unsigned int Nstars));
     236int        UpdateDatabase_Reflist PROTO((AddstarClientOptions *options, Stars *stars, unsigned int Nstars));
    256237int        UpdateDatabase_Refcat  PROTO((AddstarClientOptions *options, SkyRegion *UserPatch, char *refcat));
    257 SkyList   *SkyListForStars        PROTO((SkyTable *table, int depth, Stars *stars, int Nstars));
     238SkyList   *SkyListForStars        PROTO((SkyTable *table, int depth, Stars *stars, unsigned int Nstars));
    258239SkyList   *SkyListExistingSubset  PROTO((SkyList *input, char *path));
    259240int        SkyListSetPath         PROTO((SkyList *list, char *path));
     
    266247int        NewReflist_Thread      PROTO((int BindSocket));
    267248
    268 Stars     *Convert_SMPDATA        PROTO((FTable *table, int *nstars));
    269 Stars     *Convert_PS1_DEV_0      PROTO((FTable *table, int *nstars));
    270 Stars     *Convert_PS1_DEV_1      PROTO((FTable *table, int *nstars));
    271 Stars     *Convert_PS1_V1         PROTO((FTable *table, int *nstars));
    272 Stars     *Convert_PS1_V1_Alt     PROTO((FTable *table, int *nstars));
    273 Stars     *Convert_PS1_V2         PROTO((FTable *table, int *nstars));
     249Stars     *Convert_SMPDATA        PROTO((FTable *table, unsigned int *nstars));
     250Stars     *Convert_PS1_DEV_0      PROTO((FTable *table, unsigned int *nstars));
     251Stars     *Convert_PS1_DEV_1      PROTO((FTable *table, unsigned int *nstars));
     252Stars     *Convert_PS1_V1         PROTO((FTable *table, unsigned int *nstars));
     253Stars     *Convert_PS1_V1_Alt     PROTO((FTable *table, unsigned int *nstars));
     254Stars     *Convert_PS1_V2         PROTO((FTable *table, unsigned int *nstars));
    274255
    275256int        InitStar               PROTO((Stars *star));
     
    279260int args_skycells (int argc, char **argv);
    280261int ConfigInit_skycells (int *argc, char **argv);
    281 int UpdateImageIDs (Stars *stars, int Nstars, Image *images, int Nimages);
    282 int LoadDataSDSS (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int Nimages);
    283 int altaz (double *alt, double *az, double ha, double dec, double latitude);
    284 
    285 int LoadDataPMM (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars);
     262int UpdateImageIDs (Stars *stars, unsigned int Nstars, Image *images, off_t Nimages);
     263
     264int LoadDataSDSS (FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, off_t Nimages);
     265int LoadDataPMM (FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars);
     266
    286267PhotCode *LoadMetadataPMM (char *datafile, Image *image);
    287268time_t pmm_date_to_sec (char *date, char *time);
     
    293274uint64_t CreatePSPSDetectionID(double tobs, int ccdid, int detID);
    294275uint64_t CreatePSPSObjectID(double ra, double dec);
     276
     277int altaz (double *alt, double *az, double ha, double dec, double latitude);
    295278
    296279// this is a gnu extension?? caution!
  • trunk/Ohana/src/addstar/include/skycells.h

    r23914 r27435  
    7878void         SetProtect                     PROTO((int mode));
    7979int          SetSignals                     PROTO((void));
    80 int          Shutdown                       PROTO((char *message, ...); )
     80int          Shutdown                       PROTO((char *message, ...)) OHANA_FORMAT(printf, 1, 2);
    8181void         TrapSignal                     PROTO((int sig));
    8282
  • trunk/Ohana/src/addstar/src/ConfigInit.c

    r25757 r27435  
    130130  /* load valid ip list */
    131131  {
    132     int i, Nvalid, ip1, ip2, ip3, ip4, test, status;
     132    int i, Nvalid_IP, ip1, ip2, ip3, ip4, test, status;
    133133    char string[80];
    134134
    135     Nvalid = 0;
    136     NVALID = 10;
    137     ALLOCATE (VALID_IP, int, NVALID);
     135    Nvalid_IP = 0;
     136    NVALID_IP = 10;
     137    ALLOCATE (VALID_IP, int, NVALID_IP);
    138138    for (i = 0; ScanConfig (config, "VALID_IP", "%s", i, string) != NULL; i++) {
    139139      status = sscanf (string, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4);
     
    148148        exit (2);
    149149      }
    150       VALID_IP[Nvalid] = ip1 | (ip2 << 8) | (ip3 << 16) | (ip4 << 24);
    151       Nvalid ++;
    152       CHECK_REALLOCATE (VALID_IP, int, NVALID, Nvalid, 10);
    153     }
    154     NVALID = Nvalid;
    155     REALLOCATE (VALID_IP, int, NVALID);
    156     if (NVALID == 0) {
     150      VALID_IP[Nvalid_IP] = ip1 | (ip2 << 8) | (ip3 << 16) | (ip4 << 24);
     151      Nvalid_IP ++;
     152      CHECK_REALLOCATE (VALID_IP, int, NVALID_IP, Nvalid_IP, 10);
     153    }
     154    NVALID_IP = Nvalid_IP;
     155    REALLOCATE (VALID_IP, int, NVALID_IP);
     156    if (NVALID_IP == 0) {
    157157      free (VALID_IP);
    158158      VALID_IP = NULL;
     
    172172  } else {
    173173    options.radius = atof (RadiusWord);
     174    if (options.radius < 1e-6) {
     175      fprintf (stderr, "non-sensical correlation radius %f\n", options.radius);
     176      exit (1);
     177    }
    174178  }
    175179
  • trunk/Ohana/src/addstar/src/FilterStars.c

    r26384 r27435  
    109109}
    110110
    111 Stars *MergeStars (Stars *stars, int *Nstars, Stars *instars, int Ninstars) {
     111Stars *MergeStars (Stars *stars, unsigned int *Nstars, Stars *instars, unsigned int Ninstars) {
    112112
    113113  int i, j;
  • trunk/Ohana/src/addstar/src/GetFileMode.c

    r21508 r27435  
    44int GetFileMode (Header *header) {
    55
    6   char ctype[80];
     6  char ctype[80], ctmp;
    77  int Naxis;
    88  int simple, extend, haveNaxis, haveCTYPE;
    9   int tmp, havePHOT_VER, haveTARG_VER;
     9  int havePHOT_VER, haveTARG_VER;
    1010
    11   gfits_scan (header, "SIMPLE", "%t", 1, &simple);
     11  gfits_scan_alt (header, "SIMPLE", "%t", 1, &simple);
    1212  haveNaxis = gfits_scan (header, "NAXIS",  "%d", 1, &Naxis);
    1313  haveCTYPE = gfits_scan (header, "CTYPE1", "%s", 1, ctype);
    1414
    15   gfits_scan (header, "EXTEND", "%t", 1, &extend);
     15  gfits_scan_alt (header, "EXTEND", "%t", 1, &extend);
    1616   
    1717  // SDSS tsObj files have a version number for the PHOTO and
    1818  // TS (target selection) pipelines present as header keywords
    19   havePHOT_VER = gfits_scan (header, "PHOT_VER", "%s", 1, &tmp);
    20   haveTARG_VER = gfits_scan (header, "TARG_VER", "%s", 1, &tmp);
     19  havePHOT_VER = gfits_scan (header, "PHOT_VER", "%s", 1, &ctmp);
     20  haveTARG_VER = gfits_scan (header, "TARG_VER", "%s", 1, &ctmp);
    2121  if (havePHOT_VER && haveTARG_VER) return SDSS_OBJ;
    2222
  • trunk/Ohana/src/addstar/src/GetZeroPointExposure.c

    r25908 r27435  
    2121// offset in ReadImageHeader based on the per-chip zero points in the photcode database
    2222
    23 int GetZeroPointExposure (Header **headers, HeaderSet *headerSets, int Nimages) {
     23int GetZeroPointExposure (Header **headers, HeaderSet *headerSets, off_t Nimages) {
    2424
    2525    // the zero point correction is not applied
     
    3737    // the zero point correction is measured here and applied in ReadImageHeader
    3838    if (!strcasecmp(ZERO_POINT_OPTION, "CHIP_AVERAGE")) {
     39
    3940        int i, Nzpt, Nmid, Nhead;
    4041        float *zpt, ZPT_OBS;
  • trunk/Ohana/src/addstar/src/ImageOptions.c

    r16810 r27435  
    22
    33/* set specific options based on the image collection */
    4 int ImageOptions (AddstarClientOptions *options, Image *images, int Nimages) {
     4int ImageOptions (AddstarClientOptions *options, Image *images, off_t Nimages) {
    55
    6   int i, equivPhotcode, consistent;
     6  off_t i;
     7  int equivPhotcode, consistent;
    78  float maxError;
    89  PhotCode *photcode;
  • trunk/Ohana/src/addstar/src/ListenClients_Thread.c

    r6674 r27435  
    1414
    1515    /* wait for clients to make connection */
    16     BindSocket = WaitServerSocket (InitSocket, &Address, VALID_IP, NVALID);
     16    BindSocket = WaitServerSocket (InitSocket, &Address, VALID_IP, NVALID_IP);
    1717    if (BindSocket == -1) continue;
    1818
  • trunk/Ohana/src/addstar/src/LoadData.c

    r26390 r27435  
    66
    77// examine the header sets and set the Image entries for the the valid images
    8 int LoadData (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int Nimages, AddstarClientOptions *options) {
     8int LoadData (FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, int Nimages, AddstarClientOptions *options) {
    99
    1010  char *name;
    11   int i, j, Nvalid, Nhead, Ndata, Nskip;
     11  off_t Nskip, Nvalid, NVALID;
     12  int i, j, Nhead, Ndata;
    1213  uint32_t parentID = UINT32_MAX;
    1314  Stars *inStars;
     
    7677      Nskip += extsize[j];
    7778    }
    78     fseek (f, Nskip, SEEK_SET);
     79    fseeko (f, Nskip, SEEK_SET);
    7980         
    8081    inStars = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &images[0][Nvalid].nstar);
  • trunk/Ohana/src/addstar/src/LoadDataPMM.c

    r21508 r27435  
    1616# define MAG_INDEX_ASC 22
    1717
    18 int LoadDataPMM (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars) {
    19 
     18int LoadDataPMM (FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars) {
     19
     20  off_t Nvalid, NVALID;
    2021  char *name, *buffer;
    21   int i, fd, Nbyte, Nline, Nvalid, code;
     22  int i, fd, Nbyte, Nline, code;
    2223  double ra, dec, mag, airmass, az, ZeroPoint, ZeroPt;
    2324  unsigned int Ninstars, NINSTARS;
  • trunk/Ohana/src/addstar/src/LoadDataSDSS.c

    r16967 r27435  
    44// there should only be a single data set (phu + table) in this file
    55// each SDSS data set corresponds to 5 images (ugriz)
    6 int LoadDataSDSS (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int Nimages) {
     6int LoadDataSDSS (FILE *f, char *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, off_t Nimages) {
    77
     8  off_t Nskip, Nvalid, NVALID;
    89  char *name;
    9   int j, Nvalid, Nhead, Ndata, Nskip;
     10  int j, Nhead, Ndata;
    1011  unsigned int Ninstars;
    1112  Stars *inStars;
     
    3637    Nskip += extsize[j];
    3738  }
    38   fseek (f, Nskip, SEEK_SET);
     39  fseeko (f, Nskip, SEEK_SET);
    3940         
    4041  // XXX I think this is an error?  should this be &images[0][Nvalid] ??
  • trunk/Ohana/src/addstar/src/LoadHeaders.c

    r16810 r27435  
    44Header **LoadHeaders (FILE *f, int *mode, int *Nheaders) {
    55
    6   int i, status, Nskip, NHEADERS;
     6  off_t Nskip;
     7  int i, status, NHEADERS;
    78  Header **headers;
    89
     
    3132    // advance to the next header
    3233    Nskip = gfits_data_size (headers[i]);
    33     fseek (f, Nskip, SEEK_CUR);
     34    fseeko (f, Nskip, SEEK_CUR);
    3435    if (i == NHEADERS - 1) {
    3536      NHEADERS += 10;
  • trunk/Ohana/src/addstar/src/LoadStars.c

    r26286 r27435  
    11# include "addstar.h"
    22
    3 Stars *LoadStars (char *filename, int *Nstars, Image **images, int *Nimages, AddstarClientOptions *options) {
     3Stars *LoadStars (char *filename, unsigned int *Nstars, Image **images, off_t *Nimages, AddstarClientOptions *options) {
    44
    5   int i, Nfile, NFILE, Nheaders, NheaderSets, mode, *extsize;
     5  off_t *extsize, NheaderSets;
     6  int i, Nfile, NFILE, Nheaders, mode;
    67  char **file, line[1024];
    78  FILE *f;
     
    8081      continue;
    8182    }
    82     if (VERBOSE) fprintf (stderr, "file %s has %d headers, including %d images\n", file[i], Nheaders, NheaderSets);
     83    if (VERBOSE) fprintf (stderr, "file %s has %d headers, including %lld images\n", file[i], Nheaders, (long long) NheaderSets);
    8384
    8485    /* supplied photcode is incompatible with multi-chip images */
  • trunk/Ohana/src/addstar/src/MatchHeaders.c

    r26258 r27435  
    33// XXX largely psphot specific
    44
    5 HeaderSet *MatchHeaders (int **extsize, int *nimage, int mode, Header **headers, int Nheaders) {
     5HeaderSet *MatchHeaders (off_t **extsize, off_t *nimage, int mode, Header **headers, int Nheaders) {
    66
    77  int i, j, Nimage, NIMAGE;
     
    99  HeaderSet *headerSets;
    1010
    11   ALLOCATE (extsize[0], int, Nheaders);
     11  ALLOCATE (extsize[0], off_t, Nheaders);
    1212
    1313  Nimage = 0;
     
    3434    headerSets[0].extnum_head = 0;
    3535    headerSets[0].extnum_data = 1;
    36     extsize[0][0] = headers[0][0].size;
     36    extsize[0][0] = headers[0][0].datasize;
    3737    *nimage = 1;
    3838    return headerSets;
     
    4242  for (i = 0; i < Nheaders; i++) {
    4343    if (mode == SIMPLE_CMP) {
    44       extsize[0][i] = headers[i][0].size;
     44      extsize[0][i] = headers[i][0].datasize;
    4545    } else {
    46       extsize[0][i] = headers[i][0].size + gfits_data_size (headers[i]);
     46      extsize[0][i] = headers[i][0].datasize + gfits_data_size (headers[i]);
    4747    }
    4848
     
    9292  // extension matched to the header in the PHU
    9393  if (Nimage == 0) {
    94     extsize[0][0] = headers[0][0].size + gfits_data_size (headers[0]);
    95     extsize[0][1] = headers[1][0].size + gfits_data_size (headers[1]);
     94    extsize[0][0] = headers[0][0].datasize + gfits_data_size (headers[0]);
     95    extsize[0][1] = headers[1][0].datasize + gfits_data_size (headers[1]);
    9696    gfits_scan (headers[1], ExtnameKeyword, "%s", 1, extname);
    9797    if (!strcmp (extname, "SMPFILE")) {
  • trunk/Ohana/src/addstar/src/ReadImageHeader.c

    r27369 r27435  
    181181    // RULE: ccdnum is the value of the first string of digits in CCDNumKeyword
    182182    // For example: ccdnum(XY42.hdr) = 42, ccdnum(XY01.hdr) = 1
     183    // if no digits occur, then we assume there is only one ccd
    183184    char *p = ccdnum;
    184185    // get rid of any leading non-digit characters
    185186    while (*p && !isdigit(*p)) p++;
    186187    if (*p) {
    187         image[0].ccdnum = atoi(p);
     188      image[0].ccdnum = atoi(p);
    188189    } else {
    189         image[0].ccdnum = 0;
     190      image[0].ccdnum = 0;
    190191    }
    191192  }
  • trunk/Ohana/src/addstar/src/ReadStarsFITS.c

    r24400 r27435  
    55Stars *ReadStarsFITS (FILE *f, Header *header, Header *in_theader, unsigned int *nstars) {
    66
    7   int Nskip, Nstars;
     7  off_t Nskip;
     8  unsigned int Nstars;
    89  char type[80];
    910  Header theader;
     
    1617  } else {
    1718    table.header = in_theader;
    18     Nskip = in_theader[0].size;
    19     fseek (f, Nskip, SEEK_CUR);
     19    Nskip = in_theader[0].datasize;
     20    fseeko (f, Nskip, SEEK_CUR);
    2021  }
    2122
     
    5758}
    5859
    59 Stars *Convert_SMPDATA (FTable *table, int *nstars) {
    60 
    61   int i, Nstars, swapped;
     60Stars *Convert_SMPDATA (FTable *table, unsigned int *nstars) {
     61
     62  off_t Nstars;
     63  unsigned int i;
     64  char swapped;
    6265  double ZeroPt;
    6366  Stars *stars = NULL;
     
    9699}
    97100
    98 Stars *Convert_PS1_DEV_0 (FTable *table, int *nstars) {
    99 
    100   int i, Nstars;
     101Stars *Convert_PS1_DEV_0 (FTable *table, unsigned int *nstars) {
     102
     103  off_t Nstars;
     104  unsigned int i;
    101105  double ZeroPt;
    102106  Stars *stars;
     
    140144// XXX I need to make the IPP I/O functions and these functions
    141145// consistent wrt ZERO_POINT....
    142 Stars *Convert_PS1_DEV_1 (FTable *table, int *nstars) {
    143 
    144   int i, Nstars;
     146Stars *Convert_PS1_DEV_1 (FTable *table, unsigned int *nstars) {
     147
     148  off_t Nstars;
     149  unsigned int i;
    145150  double ZeroPt;
    146151  Stars *stars;
     
    185190}
    186191
    187 Stars *Convert_PS1_V1 (FTable *table, int *nstars) {
    188 
    189   int i, Nstars;
     192Stars *Convert_PS1_V1 (FTable *table, unsigned int *nstars) {
     193
     194  off_t Nstars;
     195  unsigned int i;
    190196  double ZeroPt;
    191197  Stars *stars;
     
    261267}
    262268
    263 Stars *Convert_PS1_V1_Alt (FTable *table, int *nstars) {
    264 
    265   int i, Nstars;
     269Stars *Convert_PS1_V1_Alt (FTable *table, unsigned int *nstars) {
     270
     271  off_t Nstars;
     272  unsigned int i;
    266273  double ZeroPt;
    267274  Stars *stars;
     
    332339}
    333340
    334 Stars *Convert_PS1_V2 (FTable *table, int *nstars) {
    335 
    336   int i, Nstars;
     341Stars *Convert_PS1_V2 (FTable *table, unsigned int *nstars) {
     342
     343  off_t Nstars;
     344  unsigned int i;
    337345  double ZeroPt;
    338346  Stars *stars;
  • trunk/Ohana/src/addstar/src/ReadStarsSDSS.c

    r27392 r27435  
    3131// given a file with the pointer at the start of the table block and the
    3232// corresponding image header, load the stars from the table
    33 Stars *ReadStarsSDSS (FILE *f, char *name, Header *header, Header *in_theader, Image *images, int *nimages, unsigned int *nstars) {
    34 
    35   int i, j, N, Nskip, Nstars, camcol;
     33Stars *ReadStarsSDSS (FILE *f, char *name, Header *header, Header *in_theader, Image *images, off_t *nimages, unsigned int *nstars) {
     34
     35  off_t Nskip, Nrow;
     36  int i, j, N, Nstars, camcol;
    3637  char type[80];
    3738  Header theader;
     
    4344  char filtname[16][5];
    4445  int photcode[5];
    45   int Nrow, Ncol; // used in the GET_COLUMN_1,5 macros above
     46  int Ncol; // used in the GET_COLUMN_1,5 macros above
    4647 
    4748  if (in_theader == NULL) {
     
    5051  } else {
    5152    table.header = in_theader;
    52     Nskip = in_theader[0].size;
    53     fseek (f, Nskip, SEEK_CUR);
     53    Nskip = in_theader[0].datasize;
     54    fseeko (f, Nskip, SEEK_CUR);
    5455  }
    5556
  • trunk/Ohana/src/addstar/src/SkyListForStars.c

    r21508 r27435  
    1313}
    1414
    15 SkyList *SkyListForStars (SkyTable *table, int depth, Stars *stars, int Nstars) {
     15SkyList *SkyListForStars (SkyTable *table, int depth, Stars *stars, unsigned int Nstars) {
    1616 
    1717  int i, j, Nr, NR;
  • trunk/Ohana/src/addstar/src/SkyTableFromTychoIndex.c

    r15036 r27435  
    147147    skytable[0].filename[i] = NULL;
    148148  }
    149   if (VERBOSE) fprintf (stderr, "loaded %d tables from tycho index\n", skytable[0].Nregions);
     149  if (VERBOSE) fprintf (stderr, "loaded %lld tables from tycho index\n", (long long) skytable[0].Nregions);
    150150
    151151  return (skytable);
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Image.c

    r15743 r27435  
    11# include "addstar.h"
    22
    3 int UpdateDatabase_Image (AddstarClientOptions *options, Image *images, int Nimages, Coords *mosaic, Stars *stars, int Nstars) {
     3int UpdateDatabase_Image (AddstarClientOptions *options, Image *images, int Nimages, Coords *mosaic, Stars *stars, unsigned int Nstars) {
    44
    55  int i, status;
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Reflist.c

    r15743 r27435  
    11# include "addstar.h"
    22
    3 int UpdateDatabase_Reflist (AddstarClientOptions *options, Stars *stars, int Nstars) {
     3int UpdateDatabase_Reflist (AddstarClientOptions *options, Stars *stars, unsigned int Nstars) {
    44
    55  int i, Nsubset;
  • trunk/Ohana/src/addstar/src/UpdateImageIDs.c

    r26390 r27435  
    11# include "addstar.h"
    22
    3 int UpdateImageIDs (Stars *stars, int Nstars, Image *images, int Nimages) {
     3int UpdateImageIDs (Stars *stars, unsigned int Nstars, Image *images, off_t Nimages) {
    44
    55  int i, status, isEmpty;
  • trunk/Ohana/src/addstar/src/addstar.c

    r26280 r27435  
    11# include "addstar.h"
    22
     3// LARGEFILES: this program currently limits Nstars (input file) to < 2^31
    34int main (int argc, char **argv) {
    45
     6  unsigned int Nstars, Nsubset;
    57  int Nmatch, status, loadObjects;
    6   int i, Nstars, Nimages, Nsubset;
    7   unsigned long long Naverage, Nmeasure;
     8  off_t i, Nimages;
     9  off_t Naverage, Nmeasure;
    810  Stars *stars, **subset;
    911  Image *images;
     
    4648        newlist = SkyListByImage (sky, -1, &images[i]);
    4749        SkyListMerge (&skylist, newlist);
    48         if (VERBOSE) fprintf (stderr, "added %d regions to yield %d total\n", newlist[0].Nregions, skylist[0].Nregions);
     50        if (VERBOSE) fprintf (stderr, "added %lld regions to yield %lld total\n", (long long) newlist[0].Nregions, (long long) skylist[0].Nregions);
    4951        SkyListFree (newlist);
    5052      }
     
    7880    skylist = tmp;
    7981  }
    80   if (VERBOSE) fprintf (stderr, "writing to %d regions\n", skylist[0].Nregions);
     82  if (VERBOSE) fprintf (stderr, "writing to %lld regions\n", (long long) skylist[0].Nregions);
    8183
    8284  /* don't load the object tables for only_images, unless we are getting the calibration. */
     
    147149      case M_RESORT:
    148150        if (options.nosort == 3) catalog.sorted = FALSE;
     151
     152        // no need to resort empty catalogs
     153        if (catalog.Naves_disk == 0) {
     154          dvo_catalog_unlock (&catalog);
     155          dvo_catalog_free (&catalog);
     156          continue;
     157        }
     158
    149159        resort_catalog (&catalog);
    150160        Nsubset = 1;
     
    203213  gettimeofday (&stop, NULL);
    204214  dtime = DTIME (stop, start);
    205   fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for %5d stars (%5d matches), %6lld average, %7lld measure\n", dtime, Nstars, Nmatch, Naverage, Nmeasure);
     215  fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for %5d stars (%5d matches), %6lld average, %7lld measure\n", dtime, Nstars, Nmatch, (long long) Naverage, (long long) Nmeasure);
    206216
    207217  exit (0);
  • trunk/Ohana/src/addstar/src/addstard.c

    r25757 r27435  
    2323
    2424    /* wait for clients to make connection */
    25     BindSocket = WaitServerSocket (InitSocket, &Address, VALID_IP, NVALID);
     25    BindSocket = WaitServerSocket (InitSocket, &Address, VALID_IP, NVALID_ID);
    2626    if (BindSocket == -1) continue;
    2727
  • trunk/Ohana/src/addstar/src/build_links.c

    r26399 r27435  
    2626/* build the initial links assuming the table is sorted,
    2727   not partial, and has a correct set of average[].measureOffset,Nmeasure values */
    28 int *init_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure) {
    29 
    30   int i, j, N;
    31   int *next;
     28off_t *init_measure_links (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure) {
     29
     30  off_t i, j, N;
     31  off_t *next_meas;
    3232
    3333  N = 0;
    3434
    35   ALLOCATE (next, int, Nmeasure);
     35  ALLOCATE (next_meas, off_t, Nmeasure);
    3636  for (i = 0; i < Naverage; i++, N++) {
    3737    for (j = 0; j < average[i].Nmeasure - 1; j++, N++) {
    38       next[N] = N + 1;
     38      next_meas[N] = N + 1;
    3939      if (N >= Nmeasure) {
    4040        fprintf (stderr, "WARNING: N out of bounds (1)\n");
    4141      }
    4242    }
    43     next[N] = -1;
     43    next_meas[N] = -1;
    4444    if (N >= Nmeasure) {
    4545      fprintf (stderr, "WARNING: N out of bounds (2)\n");
     
    5151    }
    5252  }
    53   return (next);
     53  return (next_meas);
    5454}
    5555
     
    6161 */
    6262
    63 int *build_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure) {
    64 
    65   int i, m, k, Nm, averef;
    66   int *next;
    67 
    68   ALLOCATE (next, int, Nmeasure);
     63off_t *build_measure_links (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure) {
     64
     65  off_t i, m, k, Nm, averef;
     66  off_t *next_meas;
     67
     68  ALLOCATE (next_meas, off_t, Nmeasure);
    6969
    7070  /* reset the Nm, offset values for average */
     
    7777    averef = measure[Nm].averef;
    7878    m = average[averef].measureOffset; 
    79     next[Nm] = -1;
     79    next_meas[Nm] = -1;
    8080
    8181    if (m == -1) { /* no links yet for source */
     
    8585    }
    8686
    87     for (k = 0; next[m] != -1; k++) {
    88       m = next[m];
     87    for (k = 0; next_meas[m] != -1; k++) {
     88      m = next_meas[m];
    8989      if (m >= Nmeasure) {
    9090        fprintf (stderr, "WARNING: m out of bounds (1)\n");
     
    9393
    9494    average[averef].Nmeasure = k + 2;
    95     next[m] = Nm;
     95    next_meas[m] = Nm;
    9696    if (m >= Nmeasure) {
    9797      fprintf (stderr, "WARNING: m out of bounds (2)\n");
    9898    }
    9999  }
    100   return (next);
     100  return (next_meas);
    101101}
    102102
    103103/* average[].measureOffset, average[].Nmeasure are valid within an addstar run */
    104 int add_meas_link (Average *average, int *next, int Nmeasure, int NMEASURE) {
    105 
    106   int k, m;
    107 
    108   /* if we have trouble, check validity of next[m] : m < Nmeasure */
     104off_t add_meas_link (Average *average, off_t *next_meas, off_t Nmeasure, off_t NMEASURE) {
     105
     106  off_t k, m;
     107
     108  /* if we have trouble, check validity of next_meas[m] : m < Nmeasure */
    109109  m = average[0].measureOffset; 
    110110
    111111  for (k = 0; k < average[0].Nmeasure - 1; k++)  {
    112     m = next[m];
     112    m = next_meas[m];
    113113    if (m >= NMEASURE) {
    114114      fprintf (stderr, "WARNING: m out of bounds (3)\n");
     
    117117
    118118  /* set up references */
    119   next[Nmeasure] = -1;
     119  next_meas[Nmeasure] = -1;
    120120  if (Nmeasure >= NMEASURE) {
    121121    fprintf (stderr, "WARNING: Nmeasure out of bounds (1)\n");
     
    125125    average[0].measureOffset = Nmeasure;
    126126  } else {
    127     next[m] = Nmeasure;
     127    next_meas[m] = Nmeasure;
    128128    if (m >= NMEASURE) {
    129129      fprintf (stderr, "WARNING: m out of bounds (4)\n");
     
    137137   we must always save the missing table, if it exists */
    138138
    139 Measure *sort_measure (Average *average, int Naverage, Measure *measure, int Nmeasure, int *next) {
    140 
    141   int i, k, n, N;
     139Measure *sort_measure (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next_meas) {
     140
     141  off_t i, k, n, N;
    142142  Measure *tmpmeasure;
    143143
     
    153153      if (measure[n].averef != i) abort();
    154154      tmpmeasure[N].averef = i;
    155       n = next[n];
     155      n = next_meas[n];
    156156    }
    157157  }
     
    161161
    162162/* build the initial links assuming the table is sorted */
    163 int *init_missing_links (Average *average, int Naverage, Missing *missing, int Nmissing) {
    164 
    165   int i, j, N;
    166   int *next;
     163off_t *init_missing_links (Average *average, off_t Naverage, Missing *missing, off_t Nmissing) {
     164
     165  off_t i, j, N;
     166  off_t *next_miss;
    167167
    168168  N = 0;
    169169
    170   ALLOCATE (next, int, Nmissing);
     170  ALLOCATE (next_miss, off_t, Nmissing);
    171171  for (i = 0; i < Naverage; i++) {
    172172    for (j = 0; j < average[i].Nmissing - 1; j++, N++) {
    173       next[N] = N + 1;
     173      next_miss[N] = N + 1;
    174174    }
    175175    if (average[i].Nmissing > 0) {
    176       next[N] = -1;
     176      next_miss[N] = -1;
    177177      if (N >= Nmissing) {
    178178        fprintf (stderr, "overflow in init_missing_links");
     
    183183
    184184  }
    185   return (next);
    186 }
    187 
    188 int add_miss_link (Average *average, int *next, int Nmissing) {
    189 
    190   int k, m;
     185  return (next_miss);
     186}
     187
     188off_t add_miss_link (Average *average, off_t *next_miss, off_t Nmissing) {
     189
     190  off_t k, m;
    191191
    192192  /* there may be 0 Nmiss; this is not true for Nmeas */
    193193  if (average[0].Nmissing < 1) {
    194194    average[0].missingOffset = Nmissing;
    195     next[Nmissing] = -1;
     195    next_miss[Nmissing] = -1;
    196196    return (TRUE);
    197197  }
    198198
    199199  m = average[0].missingOffset; 
    200   for (k = 0; k < average[0].Nmissing - 1; k++) m = next[m];
     200  for (k = 0; k < average[0].Nmissing - 1; k++) m = next_miss[m];
    201201  /* set up references */
    202   next[Nmissing] = -1;
    203   next[m] = Nmissing;
     202  next_miss[Nmissing] = -1;
     203  next_miss[m] = Nmissing;
    204204  return (TRUE);
    205205}
    206206
    207 Missing *sort_missing (Average *average, int Naverage, Missing *missing, int Nmissing, int *next) {
    208 
    209   int i, k, n, N;
     207Missing *sort_missing (Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_miss) {
     208
     209  off_t i, k, n, N;
    210210  Missing *tmpmissing;
    211211
     
    218218    for (k = 0; k < average[i].Nmissing; k++, N++) {
    219219      tmpmissing[N] = missing[n];
    220       n = next[n];
     220      n = next_miss[n];
    221221    }
    222222  }
  • trunk/Ohana/src/addstar/src/calibrate.c

    r16810 r27435  
    22
    33static int InternalCal;
    4 static int Ncal, NCAL, *Nstar;
     4static int Ncal, NCAL;
     5static off_t *Nstar;
    56static float *Mobs, *dMobs, *Mref, *dMref, *Minst;
    67
     
    1314  NCAL = 1000;
    1415  ALLOCATE (Mobs,  float,  NCAL);
    15   ALLOCATE (dMobs, float, NCAL);
     16  ALLOCATE (dMobs, float,  NCAL);
    1617  ALLOCATE (Mref,  float,  NCAL);
    1718  ALLOCATE (dMref, float,  NCAL);
    1819  ALLOCATE (Minst, float,  NCAL);
    19   ALLOCATE (Nstar, int, NCAL);
     20  ALLOCATE (Nstar, off_t, NCAL);
    2021}
    2122 
    22 void SaveCalibration (float Mo, float dMo, float Mr, float dMr, float Mi, int N) {
     23void SaveCalibration (float Mo, float dMo, float Mr, float dMr, float Mi, off_t N) {
    2324
    2425  Mobs[Ncal]  = Mo;
     
    3738    REALLOCATE (dMref, float, NCAL);
    3839    REALLOCATE (Minst, float, NCAL);
    39     REALLOCATE (Nstar, int,  NCAL);
     40    REALLOCATE (Nstar, off_t, NCAL);
    4041  }
    4142}
    4243
    4344/* use the linked list to navigate the measures; safe for unsorted measures */
    44 void AddToCalibration (Average *average, SecFilt *secfilt, Measure *measure, Measure *new, int *next, int Nstar) {
     45void AddToCalibration (Average *average, SecFilt *secfilt, Measure *measure, Measure *new, off_t *next, off_t Nstar) {
    4546
    4647  int i, j, m, Nsec, found0, found1, found2;
  • trunk/Ohana/src/addstar/src/dump.c

    r21508 r27435  
    11# include "addstar.h"
    22
    3 int dump_rawstars (Stars *stars, int Nstars) {
     3int dump_rawstars (Stars *stars, unsigned int Nstars) {
    44
    5   int i;
     5  unsigned int i;
    66  FILE *f;
    77
  • trunk/Ohana/src/addstar/src/fakeimage.c

    r21508 r27435  
    11# include "addstar.h"
    22
    3 Image *fakeimage (char *rootname, int *Nimage, int photcode) {
     3Image *fakeimage (char *rootname, off_t *Nimage, int photcode) {
    44
    55  int i, j, Nx, Ny, Nchips;
  • trunk/Ohana/src/addstar/src/find_matches.c

    r27392 r27435  
    11# include "addstar.h"
    22
    3 int find_matches (SkyRegion *region, Stars *stars, int NstarsIn, Catalog *catalog, AddstarClientOptions options) {
    4 
    5   int i, j, n, N, J, status, Nstars;
     3int find_matches (SkyRegion *region, Stars *stars, unsigned int NstarsIn, Catalog *catalog, AddstarClientOptions options) {
     4
     5  off_t i, j, n, N, J, status, Nstars;
    66  double RADIUS, RADIUS2;
    77  double *X1, *Y1, *X2, *Y2;
    88  double dX, dY, dR;
    9   int *N1, *N2, *next_meas;
    10   int Nave, NAVE, Nmeas, NMEAS, Nmatch;
     9  off_t *N1, *N2, *next_meas;
     10  off_t Nave, NAVE, Nmeas, NMEAS, Nmatch;
    1111  int Nsecfilt, Nsec;
    1212  unsigned int objID, catID;
     
    2929  ALLOCATE (X1, double, NstarsIn);
    3030  ALLOCATE (Y1, double, NstarsIn);
    31   ALLOCATE (N1, int,    NstarsIn);
     31  ALLOCATE (N1, off_t,  NstarsIn);
    3232
    3333  /** allocate local arrays (catalog) **/
     
    3535  ALLOCATE (X2, double, NAVE);
    3636  ALLOCATE (Y2, double, NAVE);
    37   ALLOCATE (N2, int,   NAVE);
    38   ALLOCATE (catalog[0].found, int, NAVE);
     37  ALLOCATE (N2, off_t,  NAVE);
     38  ALLOCATE (catalog[0].found, off_t, NAVE);
    3939  /* for secfilt j and star i, secfilt[i*Nsecfilt+j] */
    4040
     
    146146      if (Nmeas >= NMEAS) {
    147147        NMEAS = Nmeas + 1000;
    148         REALLOCATE (next_meas, int, NMEAS);
     148        REALLOCATE (next_meas, off_t, NMEAS);
    149149
    150150        REALLOCATE (catalog[0].measure, Measure, NMEAS);
     
    238238    if (Nmeas >= NMEAS - NSTAR_GROUP) {
    239239      NMEAS = Nmeas + 1000;
    240       REALLOCATE (next_meas, int, NMEAS);
     240      REALLOCATE (next_meas, off_t, NMEAS);
    241241      REALLOCATE (catalog[0].measure, Measure, NMEAS);
    242242    }
     
    352352  catalog[0].Nmeasure = Nmeas;
    353353  catalog[0].Nsecf_mem = Nave*Nsecfilt;
    354   if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %d %d %d, (%d matches)\n", Nstars, Nave, Nmeas, Nmatch);
     354  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch);
    355355
    356356  free (catalog[0].found);
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r27392 r27435  
    11# include "addstar.h"
    22
    3 int find_matches_closest (SkyRegion *region, Stars *stars, int NstarsIn, Catalog *catalog, AddstarClientOptions options) {
    4 
    5   int i, j, n, N, J, Jmin, status, Nstars;
     3int find_matches_closest (SkyRegion *region, Stars *stars, unsigned int NstarsIn, Catalog *catalog, AddstarClientOptions options) {
     4 
     5  off_t i, j, n, N, J, Jmin, status, Nstars;
    66  double RADIUS, RADIUS2, Rmin;
    77  double *X1, *Y1, *X2, *Y2;
    88  double dX, dY, dR;
    9   int *N1, *N2, *next_meas;
    10   int Nave, NAVE, Nmeas, NMEAS, Nmatch;
     9  off_t *N1, *N2, *next_meas;
     10  off_t Nave, NAVE, Nmeas, NMEAS, Nmatch;
    1111  int Nsecfilt, Nsec;
    1212  unsigned int objID, catID;
     
    2929  ALLOCATE (X1, double, NstarsIn);
    3030  ALLOCATE (Y1, double, NstarsIn);
    31   ALLOCATE (N1, int,    NstarsIn);
     31  ALLOCATE (N1, off_t,  NstarsIn);
    3232
    3333  /** allocate local arrays (catalog) **/
     
    3535  ALLOCATE (X2, double, NAVE);
    3636  ALLOCATE (Y2, double, NAVE);
    37   ALLOCATE (N2, int,   NAVE);
    38   ALLOCATE (catalog[0].found, int, NAVE);
     37  ALLOCATE (N2, off_t,  NAVE);
     38  ALLOCATE (catalog[0].found, off_t, NAVE);
    3939  /* for secfilt j and star i, secfilt[i*Nsecfilt+j] */
    4040
     
    161161    if (Nmeas >= NMEAS) {
    162162      NMEAS = Nmeas + 1000;
    163       REALLOCATE (next_meas, int, NMEAS);
     163      REALLOCATE (next_meas, off_t, NMEAS);
    164164      REALLOCATE (catalog[0].measure, Measure, NMEAS);
    165165    }
     
    198198               X1[i], X2[Jmin],
    199199               Y1[i], Y2[Jmin]);
     200        // XXX abort on this? -- this is a bad failure...
    200201    }
    201202
     
    232233    if (Nmeas >= NMEAS - NSTAR_GROUP) {
    233234      NMEAS = Nmeas + 1000;
    234       REALLOCATE (next_meas, int, NMEAS);
     235      REALLOCATE (next_meas, off_t, NMEAS);
    235236      REALLOCATE (catalog[0].measure, Measure, NMEAS);
    236237    }
     
    273274    catalog[0].average[Nave].flags         = 0;
    274275    if (PSPS_ID) {
    275         catalog[0].average[Nave].extID = CreatePSPSObjectID(catalog[0].average[Nave].R,
    276                                                             catalog[0].average[Nave].D);
     276        catalog[0].average[Nave].extID = CreatePSPSObjectID(catalog[0].average[Nave].R, catalog[0].average[Nave].D);
    277277    } else {
    278         catalog[0].average[Nave].extID         = 0;
    279     }
    280 
     278        catalog[0].average[Nave].extID = 0;
     279    }
    281280
    282281    objID ++;
     
    347346  catalog[0].Nmeasure = Nmeas;
    348347  catalog[0].Nsecf_mem = Nave*Nsecfilt;
    349   if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %d %d %d, (%d matches)\n", Nstars, Nave, Nmeas, Nmatch);
     348  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch);
    350349
    351350  free (catalog[0].found);
  • trunk/Ohana/src/addstar/src/find_matches_closest_refstars.c

    r26384 r27435  
    11# include "addstar.h"
    22
    3 int find_matches_closest_refstars (SkyRegion *region, Stars **stars, int NstarsIn, Catalog *catalog, AddstarClientOptions options) {
    4 
    5   int i, j, n, N, J, Jmin, status;
     3int find_matches_closest_refstars (SkyRegion *region, Stars **stars, unsigned int NstarsIn, Catalog *catalog, AddstarClientOptions options) {
     4
     5  off_t i, j, n, N, J, Jmin, status;
    66  double RADIUS, RADIUS2, Rmin;
    77  double *X1, *Y1, *X2, *Y2;
    88  double dX, dY, dR;
    9   int *N1, *N2, *next_meas;
    10   int Nave, NAVE, Nmeas, NMEAS, Nstars, Nmatch;
     9  off_t *N1, *N2, *next_meas;
     10  off_t Nave, NAVE, Nmeas, NMEAS, Nstars, Nmatch;
    1111  unsigned int objID, catID;
    1212  Coords tcoords;
     
    2424  ALLOCATE (X1, double, NstarsIn);
    2525  ALLOCATE (Y1, double, NstarsIn);
    26   ALLOCATE (N1, int,    NstarsIn);
     26  ALLOCATE (N1, off_t,  NstarsIn);
    2727
    2828  /** allocate local arrays (catalog) **/
     
    3030  ALLOCATE (X2, double, NAVE);
    3131  ALLOCATE (Y2, double, NAVE);
    32   ALLOCATE (N2, int, NAVE);
    33   ALLOCATE (catalog[0].found, int, NAVE);
     32  ALLOCATE (N2, off_t, NAVE);
     33  ALLOCATE (catalog[0].found, off_t, NAVE);
    3434  /* for secfilt j and star i, secfilt[i*Nsecfilt+j] */
    3535
     
    164164    if (Nmeas >= NMEAS) {
    165165      NMEAS = Nmeas + 1000;
    166       REALLOCATE (next_meas, int, NMEAS);
     166      REALLOCATE (next_meas, off_t, NMEAS);
    167167      REALLOCATE (catalog[0].measure, Measure, NMEAS);
    168168    }
     
    239239    if (Nmeas >= NMEAS - NREFSTAR_GROUP) {
    240240      NMEAS = Nmeas + 1000;
    241       REALLOCATE (next_meas, int, NMEAS);
     241      REALLOCATE (next_meas, off_t, NMEAS);
    242242      REALLOCATE (catalog[0].measure, Measure, NMEAS);
    243243    }
     
    329329      Nmeas ++;
    330330    }
     331    for (j = 0; j < NREFSTAR_GROUP - 1; j++) {
     332        next_meas[Nmeas - NREFSTAR_GROUP + j] = Nmeas - NREFSTAR_GROUP + j + 1;
     333    }
    331334    Nave ++;
    332335  }
     
    351354  catalog[0].Nmeasure = Nmeas;
    352355  catalog[0].Nsecf_mem = Nave*Nsecfilt;
    353   if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %d %d %d, (%d matches)\n", Nstars, Nave, Nmeas, Nmatch);
     356  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch);
    354357
    355358  free (catalog[0].found);
  • trunk/Ohana/src/addstar/src/find_matches_refstars.c

    r26400 r27435  
    11# include "addstar.h"
    22
    3 int find_matches_refstars (SkyRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options) {
    4 
    5   int i, j, n, N, J;
     3int find_matches_refstars (SkyRegion *region, Stars **stars, unsigned int Nstars, Catalog *catalog, AddstarClientOptions options) {
     4
     5  off_t i, j, n, N, J;
    66  double RADIUS, RADIUS2;
    77  double *X1, *Y1, *X2, *Y2;
    88  double dX, dY, dR;
    9   int *N1, *N2,  *next_meas;
    10   int Nave, NAVE, Nmeas, NMEAS, Nmatch;
     9  off_t *N1, *N2,  *next_meas;
     10  off_t Nave, NAVE, Nmeas, NMEAS, Nmatch;
    1111  unsigned int objID, catID;
    1212  Coords tcoords;
     
    2424  ALLOCATE (X1, double, Nstars);
    2525  ALLOCATE (Y1, double, Nstars);
    26   ALLOCATE (N1, int,   Nstars);
     26  ALLOCATE (N1, off_t,  Nstars);
    2727
    2828  /** allocate local arrays (catalog) **/
     
    3131  ALLOCATE (X2, double, NAVE);
    3232  ALLOCATE (Y2, double, NAVE);
    33   ALLOCATE (N2, int, NAVE);
    34   ALLOCATE (catalog[0].found, int, NAVE);
     33  ALLOCATE (N2, off_t, NAVE);
     34  ALLOCATE (catalog[0].found, off_t, NAVE);
    3535  REALLOCATE (catalog[0].average, Average, NAVE);
    3636  REALLOCATE (catalog[0].secfilt, SecFilt, NAVE*catalog[0].Nsecfilt);
     
    124124      if (Nmeas == NMEAS) {
    125125        NMEAS = Nmeas + 1000;
    126         REALLOCATE (next_meas, int, NMEAS);
     126        REALLOCATE (next_meas, off_t, NMEAS);
    127127        REALLOCATE (catalog[0].measure, Measure, NMEAS);
    128128      }
     
    209209    if (Nmeas >= NMEAS - NREFSTAR_GROUP) {
    210210      NMEAS = Nmeas + 1000;
    211       REALLOCATE (next_meas, int, NMEAS);
     211      REALLOCATE (next_meas, off_t, NMEAS);
    212212      REALLOCATE (catalog[0].measure, Measure, NMEAS);
    213213    }
     
    325325  catalog[0].Nmeasure = Nmeas;
    326326  catalog[0].Nsecf_mem = Nave*Nsecfilt;
    327   if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %d %d %d, (%d matches)\n", Nstars, Nave, Nmeas, Nmatch);
     327  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %lld %lld %lld, (%lld matches)\n", (long long) Nstars, (long long) Nave, (long long) Nmeas, (long long) Nmatch);
    328328
    329329  free (catalog[0].found);
  • trunk/Ohana/src/addstar/src/find_subset.c

    r21508 r27435  
    22
    33/* find stars within this region */
    4 Stars **find_subset (SkyRegion *region, Stars *stars, int Nstars, int *Nsubset) {
     4Stars **find_subset (SkyRegion *region, Stars *stars, unsigned int Nstars, unsigned int *Nsubset) {
    55
    66  int i, N, NSUBSET;
  • trunk/Ohana/src/addstar/src/get2mass.c

    r17439 r27435  
    22# include "2mass.h"
    33
    4 Stars *get2mass (SkyRegion *patch, int photcode, int mode, int *NSTARS) {
     4Stars *get2mass (SkyRegion *patch, int photcode, int mode, unsigned int *NSTARS) {
    55 
    66  char *path;
  • trunk/Ohana/src/addstar/src/getgsc.c

    r21508 r27435  
    77static SkyTable *sky = NULL;
    88
    9 Stars *getgsc (SkyRegion *patch, int *NSTARS) {
     9Stars *getgsc (SkyRegion *patch, unsigned int *NSTARS) {
    1010 
    11   int i, Ngsc, Nstars;
     11  unsigned int i, Ngsc, Nstars;
    1212  Stars *gsc;
    1313  Stars *stars;
     
    4545
    4646
    47 Stars *rd_gsc (char *filename, int *nstars) {
     47Stars *rd_gsc (char *filename, unsigned int *nstars) {
    4848 
    4949  int i, NSTARS, Nstars, Nbytes, nbytes, Nline, Nbyte;
  • trunk/Ohana/src/addstar/src/gettycho.c

    r21508 r27435  
    66static SkyTable *tychoTable = NULL;
    77
    8 Stars *gettycho (SkyRegion *catstats, int photcode, int *nstars) {
     8Stars *gettycho (SkyRegion *catstats, int photcode, unsigned int *nstars) {
    99
    1010  int i, j, nitems;
     
    1313  FILE *f;
    1414  int NTYCHO, Ntycho;
    15   int firstRow, firstByte;
     15  off_t firstRow, firstByte;
    1616  short int TYCHO_B, TYCHO_V;
    1717  e_time TychoEpoch;
     
    6060                          region[0].Rmin, region[0].Rmax, region[0].Dmin, region[0].Dmax);
    6161
    62     firstRow  = atoi (region[0].name);
     62    firstRow  = strtol (region[0].name, NULL, 0);
    6363    firstByte = firstRow * NBYTE;
    64     fseek (f, firstByte, SEEK_SET);
     64    fseeko (f, firstByte, SEEK_SET);
    6565
    6666    while (1) {
  • trunk/Ohana/src/addstar/src/getusno.c

    r21508 r27435  
    44# define NELEM  3
    55
    6 Stars *getusno (SkyRegion *catstats, int photcode, int *nstars) {
     6Stars *getusno (SkyRegion *catstats, int photcode, unsigned int *nstars) {
    77
    8   long int offset;
     8  off_t offset;
    99  int i, bin, first, last, nitems, Nitems, Nbins, Nstars;
    1010  float hours[100];
     
    8484    /* advance file pointer to first slice */
    8585    offset = NELEM*NBYTE*(start[first] - 1);
    86     fseek (f, offset, SEEK_SET);
     86    fseeko (f, offset, SEEK_SET);
    8787
    8888    /* sum the number of stars in data segment of interest */
  • trunk/Ohana/src/addstar/src/getusnob.c

    r26280 r27435  
    33# define NELEM  20
    44
    5 Stars *getusnob (SkyRegion *catstats, int photcode, int *nstars) {
     5Stars *getusnob (SkyRegion *catstats, int photcode, unsigned int *nstars) {
    66
    7   long int offset;
     7  off_t offset;
    88  int i, bin, first, last, nitems, Nitems, Nbins, Nitemsum;
    99  float hours[100];
     
    9393    /* advance file pointer to first slice */
    9494    offset = NELEM*NBYTE*(start[first] - 1);
    95     fseek (f, offset, SEEK_SET);
     95    fseeko (f, offset, SEEK_SET);
    9696
    9797    /* sum the number of stars in data segment of interest */
  • trunk/Ohana/src/addstar/src/greference.c

    r21508 r27435  
    33# define LOAD_DR2    1
    44
    5 Stars *greference (char *Refcat, SkyRegion *region, int photcode, int *nstars) {
     5Stars *greference (char *Refcat, SkyRegion *region, int photcode, unsigned int *nstars) {
    66
    7   int Nstars;
     7  unsigned int Nstars;
    88  Stars *stars;
    99
  • trunk/Ohana/src/addstar/src/grefstars.c

    r21508 r27435  
    22
    33/* read ASCII file with ref star data */
    4 Stars *grefstars (char *file, int photcode, int *Nstars) {
     4Stars *grefstars (char *file, int photcode, unsigned int *Nstars) {
    55
    66  FILE *f;
  • trunk/Ohana/src/addstar/src/gztest.c

    r3376 r27435  
    55main (int argc, char **argv) {
    66
    7   int N, Nread, Nseek, Nback;
     7  off_t Nseek, Nback;
     8  int N, Nread;
    89  char *filename, *buffer;
    910  gzFile gf;
     
    6667
    6768    gettimeofday (&start, NULL);
    68     N = fseek (f, Nseek, SEEK_SET);
     69    N = fseeko (f, Nseek, SEEK_SET);
    6970    gettimeofday (&stop, NULL);
    7071    if (N) {
     
    8485
    8586    gettimeofday (&start, NULL);
    86     N = fseek (f, Nback, SEEK_CUR);
     87    N = fseeko (f, Nback, SEEK_CUR);
    8788    gettimeofday (&stop, NULL);
    8889    if (N) {
  • trunk/Ohana/src/addstar/src/mkcmf.c

    r20936 r27435  
    1919  // load a text table with X,Y,Mag (instrumental?)
    2020
    21   int i, N, Nstars, NSTARS;
     21  int i, N, Nstars, NSTARS, found;
    2222  double *X, *Y, *M;
    2323  double Xmax, Ymax;
     
    5656  }
    5757
     58  // add support for all cmf types
     59  static char *type = "PS1_DEV_1";
     60  if ((N = get_argument (argc, argv, "-type"))) {
     61    remove_argument (N, &argc, argv);
     62    type = strcreate (argv[N]);
     63    remove_argument (N, &argc, argv);
     64    fprintf (stderr, "support for other types is broken: see comment at line 97\n");
     65    exit (1);
     66  }
     67
    5868  if (argc != 3) {
    59     fprintf (stderr, "USAGE mkcmf (input) (output) [-date date] [-time time] [-radec ra dec]\n");
     69    fprintf (stderr, "USAGE mkcmf (input) (output) [-date date] [-time time] [-radec ra dec] [-cmftype type]\n");
    6070    exit (2);
    6171  }
     
    8696
    8797  // XXX add gaussian-distributed noise based on counts
     98  // this needs to make different output 'stars' entries depending on the desired type
    8899  ALLOCATE (stars, PS1_DEV_1, Nstars);
    89100  gauss_init (2048);
     
    162173
    163174  ftable.header = &theader;
    164   gfits_table_set_PS1_DEV_1 (&ftable, stars, Nstars);
     175
     176  // set up desired CMF type:
     177  found = FALSE;
     178# if 0
     179  if (!strcmp(type, "PS1_DEV_0")) {
     180    gfits_table_set_PS1_DEV_0 (&ftable, stars, Nstars);
     181    gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_DEV_0");
     182    found = TRUE;
     183  }
     184# endif
     185  if (!strcmp(type, "PS1_DEV_1")) {
     186    gfits_table_set_PS1_DEV_1 (&ftable, stars, Nstars);
     187    gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_DEV_1");
     188    found = TRUE;
     189  }
     190# if 0
     191  if (!strcmp(type, "PS1_V1")) {
     192    gfits_table_set_CMF_PS1_V1 (&ftable, stars, Nstars);
     193    gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_V1");
     194    found = TRUE;
     195  }
     196  if (!strcmp(type, "PS1_V2")) {
     197    gfits_table_set_CMF_PS1_V2 (&ftable, stars, Nstars);
     198    gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_V2");
     199    found = TRUE;
     200  }
     201# endif
     202  if (!found) {
     203    fprintf (stderr, "ERROR: unknown CMF type %s\n", type);
     204    exit (1);
     205  }
     206
     207  gfits_modify (&theader, "EXTHEAD",   "%s", 1, "Chip.hdr");
    165208  gfits_modify (&theader, "EXTNAME",   "%s", 1, "Chip.psf");
    166   gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_DEV_1");
    167   gfits_modify (&theader, "EXTHEAD",   "%s", 1, "Chip.hdr");
    168209
    169210  fits = fopen (argv[2], "w");
  • trunk/Ohana/src/addstar/src/psps_ids.c

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • trunk/Ohana/src/addstar/src/resort_catalog.c

    r7039 r27435  
    33void resort_catalog (Catalog *catalog) {
    44
    5   int *next_meas;
    6   int Naves, Nmeas;
     5  off_t *next_meas;
     6  off_t Naves, Nmeas;
    77  double dtime;
    88  struct timeval start, stop;
     
    2424  gettimeofday (&stop, NULL);
    2525  dtime = DTIME (stop, start);
    26   fprintf (stderr, "  match time %9.4f sec for %7d measures, %6d average\n", dtime, Nmeas, Naves);
     26  fprintf (stderr, "  match time %9.4f sec for %7lld measures, %6lld average\n", dtime, (long long) Nmeas, (long long) Naves);
    2727
    2828  return;
  • trunk/Ohana/src/addstar/src/sky_tessalation.c

    r23914 r27435  
    947947  }
    948948  REALLOCATE (db[0].vtable.buffer, char *, 1);
    949   REALLOCATE (db[0].vtable.row, int, 1);
     949  REALLOCATE (db[0].vtable.row, off_t, 1);
    950950  db[0].vtable.Nrow   = 0;
    951951
    952952  // reset db[0].theader(NAXIS1) to match Image
    953   gfits_modify (&db[0].theader, "NAXIS1", "%d", 1, sizeof(Image));
     953  gfits_modify (&db[0].theader, "NAXIS1", "%lld", 1, (long long) sizeof(Image));
    954954  db[0].theader.Naxis[0] = sizeof(Image);
    955955
  • trunk/Ohana/src/addstar/src/update_coords.c

    r16810 r27435  
    22
    33/* find the average and scatter for R and D - no outlier rejection */
    4 void update_coords (Average *average, Measure *measure, int *next) {
     4void update_coords (Average *average, Measure *measure, off_t *next) {
    55
    6   int i, m, Npt;
     6  off_t i, m, Npt;
    77  double R, D, r, d;
    88  double r2, d2, dR2, dD2;
Note: See TracChangeset for help on using the changeset viewer.