Changeset 3466
- Timestamp:
- Mar 18, 2005, 4:44:20 PM (21 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 67 edited
-
Makefile (modified) (1 diff)
-
src/addrefs/include/addstar.h (modified) (1 diff)
-
src/addspphot/include/addstar.h (modified) (1 diff)
-
src/addstar/include/addstar.h (modified) (3 diffs)
-
src/addstar/src/args.c (modified) (1 diff)
-
src/addstar/src/gstars.c (modified) (3 diffs)
-
src/addstar/src/rfits.c (modified) (2 diffs)
-
src/addstar/src/rtext.c (modified) (3 diffs)
-
src/addusno/include/addstar.h (modified) (1 diff)
-
src/addusno/include/addusno.h (modified) (1 diff)
-
src/delstar/include/addstar.h (modified) (1 diff)
-
src/delstar/include/delstar.h (modified) (1 diff)
-
src/fixcat/include/markstar.h (modified) (1 diff)
-
src/gastro/include/gastro.h (modified) (1 diff)
-
src/gastro2/include/gastro2.h (modified) (1 diff)
-
src/gastro2/src/gstars2.c (modified) (1 diff)
-
src/getstar/include/getstar.h (modified) (1 diff)
-
src/imclean/include/imclean.h (modified) (2 diffs)
-
src/imclean/src/wfits.c (modified) (1 diff)
-
src/imregister/include/detrend.h (modified) (1 diff)
-
src/imregister/include/imreg.h (modified) (1 diff)
-
src/imregister/include/imregister.h (modified) (1 diff)
-
src/imregister/include/photreg.h (modified) (1 diff)
-
src/imregister/photreg/db.c (modified) (7 diffs)
-
src/libohana/Makefile (modified) (2 diffs)
-
src/libohana/doc/dvo-structures.txt (modified) (1 diff)
-
src/libohana/doc/load_catalog.c (modified) (1 diff)
-
src/libohana/doc/save_catalog.c (modified) (1 diff)
-
src/libohana/include/loneos.h (modified) (10 diffs)
-
src/libohana/src/Fread.c (modified) (17 diffs)
-
src/libohana/src/LoadPhotcodes.c (modified) (1 diff)
-
src/libohana/src/coordops.c (modified) (1 diff)
-
src/libohana/src/imreg_datatypes.c (modified) (1 diff)
-
src/libohana/src/mosaic_astrom.c (modified) (1 diff)
-
src/libohana/src/phot_catalog.c (modified) (10 diffs)
-
src/libohana/src/photfits.c (modified) (1 diff)
-
src/markrock/include/markrock.h (modified) (1 diff)
-
src/markstar/include/markstar.h (modified) (1 diff)
-
src/misc/src/SAOobjects.c (modified) (1 diff)
-
src/misc/src/fixcpt.c (modified) (1 diff)
-
src/misc/src/fiximg.c (modified) (1 diff)
-
src/misc/src/fixsimple.c (modified) (1 diff)
-
src/misc/src/mosastro.c (modified) (1 diff)
-
src/mosastro/Makefile (modified) (1 diff)
-
src/mosastro/include/mosastro.h (modified) (6 diffs)
-
src/mosastro/src/ConfigInit.c (modified) (1 diff)
-
src/mosastro/src/ConvertStars.c (modified) (2 diffs)
-
src/mosastro/src/GetScatter.c (modified) (2 diffs)
-
src/mosastro/src/LoadStars.c (modified) (1 diff)
-
src/mosastro/src/args.c (modified) (1 diff)
-
src/mosastro/src/clip.c (modified) (3 diffs)
-
src/mosastro/src/match.c (modified) (3 diffs)
-
src/mosastro/src/mkmosaic.c (modified) (3 diffs)
-
src/mosastro/src/mosastro.c (modified) (3 diffs)
-
src/mosastro/src/output.c (modified) (1 diff)
-
src/mosastro/src/rfits.c (modified) (1 diff)
-
src/mosastro/src/wfits.c (modified) (2 diffs)
-
src/nightd/include/nightd.h (modified) (2 diffs)
-
src/nightd/src/ConfigInit.c (modified) (4 diffs)
-
src/nightd/src/DoCommand.c (modified) (2 diffs)
-
src/nightd/src/SetSignals.c (modified) (1 diff)
-
src/nightd/src/StartUp.c (modified) (1 diff)
-
src/nightd/src/misc.c (modified) (4 diffs)
-
src/nightd/src/nightd.c (modified) (1 diff)
-
src/photdbc/include/photdbc.h (modified) (1 diff)
-
src/relphot/include/relphot.h (modified) (1 diff)
-
src/uniphot/include/uniphot.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/Makefile
r3400 r3466 80 80 mkdir -p $(LINC) 81 81 mkdir -p $(LLIB) 82 for i in $(LIBS-$(ARCH)); do make $$i.install ; done82 for i in $(LIBS-$(ARCH)); do make $$i.install || exit; done 83 83 84 84 bins: -
trunk/Ohana/src/addrefs/include/addstar.h
r2459 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 # include <signal.h> 4 4 -
trunk/Ohana/src/addspphot/include/addstar.h
r2461 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 # include <signal.h> 4 4 -
trunk/Ohana/src/addstar/include/addstar.h
r3416 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 # include <signal.h> 4 4 # include <sys/time.h> … … 71 71 double Latitude, SiderealTime; 72 72 int VERBOSE; 73 int FITS_INPUT; 73 74 int SKIP_MISSED; 74 75 int XOVERSCAN, YOVERSCAN; … … 215 216 GSCRegion *gregion_patch (GSCRegion *patch, int *nregions); 216 217 int ConvertStars (StarData *data, int size, int nitems); 218 int dump_rawstars (Stars *stars, int Nstars); 219 Stars *rfits (FILE *f, int *nstars); 220 Stars *rtext (FILE *f, int *nstars); 221 -
trunk/Ohana/src/addstar/src/args.c
r3402 r3466 90 90 remove_argument (N, &argc, argv); 91 91 fits_free_header (&header); 92 } 93 FITS_INPUT = FALSE; 94 if ((N = get_argument (argc, argv, "-fits"))) { 95 FITS_INPUT = TRUE; 96 remove_argument (N, &argc, argv); 92 97 } 93 98 -
trunk/Ohana/src/addstar/src/gstars.c
r3416 r3466 4 4 5 5 FILE *f; 6 int j, N, extend, Nbytes; 7 int itmp, hour, min; 8 char *c, photcode[64], line[80]; 9 double tmp, sec, dMs; 10 Stars *stars, *rdstars; 6 11 Header header; 7 int j, N, Ninstar, extend;8 int nbytes, Nbytes;9 Stars *stars, *rdstars;10 char *buffer, *c, *c2, photcode[64];11 double tmp;12 int done, doneread, Nskip, Nextra, itmp;13 int hour, min;14 double sec, dMs;15 char line[80];16 12 17 13 if (!fits_read_header (file, &header)) { … … 131 127 132 128 /* find expected number of stars */ 133 fits_scan (&header, "NSTARS", "%d", 1, &image[0].nstar); 134 if (image[0].nstar == 0) { 129 if (!fits_scan (&header, "NSTARS", "%d", 1, &image[0].nstar)) { 135 130 fprintf (stderr, "ERROR: can't get NSTARS from header\n"); 136 131 exit (1); … … 166 161 fseek (f, header.size, SEEK_SET); 167 162 168 extend = FALSE; 169 fits_scan (&header, "EXTEND", "%t", 1, &extend); 170 if (extend) { 163 if (FITS_INPUT) { 171 164 Nbytes = fits_matrix_size (&header); 172 165 fseek (f, Nbytes, SEEK_CUR); -
trunk/Ohana/src/addstar/src/rfits.c
r3416 r3466 3 3 Stars *rfits (FILE *f, int *nstars) { 4 4 5 int i, N , Nx, Ny, Nstars;5 int i, Nx, Ny, Nstars; 6 6 Header theader; 7 7 FTable table; 8 8 Stars *stars; 9 9 StarData *stardata; 10 11 /* if no stars, no table */ 12 if (*nstars == 0) { 13 *nstars = 0; 14 return (NULL); 15 } 10 16 11 17 /* init & load in table data */ … … 40 46 escape: 41 47 fprintf (stderr, "error reading file\n"); 42 exit (1); 48 *nstars = 0; 49 return (NULL); 43 50 } -
trunk/Ohana/src/addstar/src/rtext.c
r3416 r3466 20 20 ALLOCATE (stars, Stars, *nstars); 21 21 22 while ( 1) {22 while (N < *nstars) { 23 23 /* load next data block */ 24 24 Nbytes = BYTES_STAR * BLOCK - Nextra; … … 62 62 Ninstar = nbytes / BYTES_STAR; 63 63 Nextra = nbytes % BYTES_STAR; 64 for (j = 0; j < Ninstar; j++, N++) {64 for (j = 0; (j < Ninstar) && (N < *nstars); j++, N++) { 65 65 dparse (&stars[N].X, 1, &buffer[j*BYTES_STAR]); 66 66 dparse (&stars[N].Y, 2, &buffer[j*BYTES_STAR]); … … 81 81 } 82 82 } 83 *nstars = N; 84 return (stars); 83 85 } -
trunk/Ohana/src/addusno/include/addstar.h
r2490 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 /* global variables set in parameter file */ -
trunk/Ohana/src/addusno/include/addusno.h
r2490 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 /* global variables set in parameter file */ -
trunk/Ohana/src/delstar/include/addstar.h
r2463 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 /* global variables set in parameter file */ -
trunk/Ohana/src/delstar/include/delstar.h
r2463 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 # include <signal.h> 4 4 -
trunk/Ohana/src/fixcat/include/markstar.h
r2490 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 int VERBOSE; -
trunk/Ohana/src/gastro/include/gastro.h
r2435 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 double DEFAULT_RADIUS; -
trunk/Ohana/src/gastro2/include/gastro2.h
r3413 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 typedef struct { -
trunk/Ohana/src/gastro2/src/gstars2.c
r3413 r3466 5 5 void gstars (char *filename, CmpCatalog *Target) { 6 6 7 int i, N, Nstars, nstars, Ninstar; 8 int nbytes, Nbytes; 9 char line[80], *buffer; 10 double dmag, type, det; 7 int Nstars; 8 char line[80]; 9 double det; 11 10 int NX, NY, FoundAstrom, extend; 12 13 FILE *f;14 11 StarData *stars; 15 12 -
trunk/Ohana/src/getstar/include/getstar.h
r2490 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 # include <signal.h> 4 4 -
trunk/Ohana/src/imclean/include/imclean.h
r3412 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 enum {DOPHOT, CHAD, SEXTRACT}; … … 77 77 void help (); 78 78 void args (int argc, char **argv); 79 int ConvertStars (Stars *data, int size, int nitems); 80 void wfits (char *filename, Stars *stars, int Nstars, Header *header); -
trunk/Ohana/src/imclean/src/wfits.c
r3412 r3466 1 1 # include "imclean.h" 2 int ConvertStars (Stars *data, int size, int nitems);3 2 4 3 void wfits (char *filename, Stars *stars, int Nstars, Header *header) { 5 4 6 int i;7 5 Matrix matrix; 8 6 Header theader; -
trunk/Ohana/src/imregister/include/detrend.h
r2823 r3466 77 77 int SaveEntry (char *input, DetReg *newdata, char *ID); 78 78 79 void init_db (); 79 80 int load_db (); 80 81 int save_db (); -
trunk/Ohana/src/imregister/include/imreg.h
r2803 r3466 75 75 RegImage *get_images (int *N); 76 76 int set_images (RegImage *new, int Nnew); 77 void init_db (); 77 78 int load_db (); 78 79 int save_db (); -
trunk/Ohana/src/imregister/include/imregister.h
r2823 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 # include <errno.h> 4 4 # include <time.h> -
trunk/Ohana/src/imregister/include/photreg.h
r2803 r3466 30 30 int set_images (PhotPars *new, int Nnew); 31 31 int load_db (); 32 void init_db (); 32 33 int save_db (); 33 34 int update_db (int *match, int Nmatch); -
trunk/Ohana/src/imregister/photreg/db.c
r2823 r3466 1 1 # include "imregister.h" 2 2 # include "photreg.h" 3 4 /**** I am moving the auto-convert functions out of this program 5 until I can define an appropriate paradigm ****/ 3 6 4 7 /* variables which describe the db */ … … 40 43 return (TRUE); 41 44 } 45 if (!strcmp (db, "trans")) { 46 dBFile = TransDB; 47 BinaryName = "TRANS_POINTS_3.0"; 48 set_Binary_name (BinaryName); 49 set_ASCII_name ("SUMMARY_ZPTS"); 50 return (TRUE); 51 } 52 /* 42 53 if (!strcmp (db, "phot_old")) { 43 54 dBFile = PhotDB; … … 47 58 return (TRUE); 48 59 } 49 if (!strcmp (db, "trans")) {50 dBFile = TransDB;51 BinaryName = "TRANS_POINTS_3.0";52 set_Binary_name (BinaryName);53 set_ASCII_name ("SUMMARY_ZPTS");54 return (TRUE);55 }56 60 if (!strcmp (db, "trans_old")) { 57 61 dBFile = TransDB; … … 61 65 return (TRUE); 62 66 } 67 */ 63 68 return (FALSE); 64 69 } … … 99 104 100 105 if (output.convert) { 106 fprintf (stderr, "conversion not allowed for now\n"); 107 status = FALSE; 108 exit (1); 109 /* 101 110 status = load_old_db (); 102 111 return (status); 112 */ 103 113 } 104 114 set_db (output.db); … … 138 148 } 139 149 150 # if (0) 140 151 int load_old_db () { 141 152 … … 198 209 return (1); 199 210 } 211 # endif 200 212 201 213 /* save complete db file */ -
trunk/Ohana/src/libohana/Makefile
r3389 r3466 21 21 ohana: $(LIB)/libohana.$(ARCH).a 22 22 23 HOBJ = $(DESTINC)/ohana.h $(DESTINC)/loneos.h $(DESTINC)/Xohana.h 23 HOBJ = \ 24 $(DESTINC)/Xohana.h \ 25 $(DESTINC)/ohana.h \ 26 $(DESTINC)/loneos.h \ 27 $(DESTINC)/elixir.h \ 28 $(DESTINC)/panstarrs.h \ 29 $(DESTINC)/dvo.h 24 30 25 31 LOBJ = \ … … 42 48 $(RANLIB) $(LIB)/libohana.$(ARCH).a 43 49 44 $(LOBJ): $(DESTINC)/ohana.h $(DESTINC)/loneos.h 50 $(LOBJ): $(DESTINC)/ohana.h $(DESTINC)/loneos.h $(DESTINC)/elixir.h $(DESTINC)/panstarrs.h 45 51 46 52 $(DESTINC)/%: $(INC)/% -
trunk/Ohana/src/libohana/doc/dvo-structures.txt
r3419 r3466 28 28 programs. 29 29 30 Translations 31 32 /* average data as stored in the LONEOS database -- must be translated on load */ 33 34 Loneos:Measure -> Elixir:Measure 35 /* OLD LONEOS VERSION. NOT BYTE COMPATIBLE WITH NEW VERSION 36 (can be loaded with translation, losing the exptime, 37 and limited the number of Naverage to 0xffffff - in load_catalog) */ -
trunk/Ohana/src/libohana/doc/load_catalog.c
r2413 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 /* the function in this file uses the old definition of Catalog, -
trunk/Ohana/src/libohana/doc/save_catalog.c
r2413 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 /* the function in this file uses the old definition of Catalog, -
trunk/Ohana/src/libohana/include/loneos.h
r3402 r3466 18 18 enum {M_UNDEF = -1, M_NONE, M_MEF, M_SPLIT, M_SINGLE, M_CUBE, M_SLICE, M_MODES, N_MODE}; 19 19 20 # if (0) 21 # define MODE_NONE 0 /* not defined */ 22 # define MODE_MEF 1 /* chip of mef image */ 23 # define MODE_SPLIT 2 /* chip of split image */ 24 # define MODE_SINGLE 3 /* single chip, not mosaic */ 25 # define MODE_CUBE 4 /* cube entry */ 26 # define MODE_SLICE 5 /* slice of a cube */ 27 # define MODE_MODES 6 /* not used? */ 28 29 # define TYPE_NONE 0 30 # define TYPE_OBJECT 1 31 # define TYPE_DARK 2 32 # define TYPE_BIAS 3 33 # define TYPE_FLAT 4 34 /** these are no longer used by imregister-3.0 35 status:imrough uses the imregister-3.0 values 36 status:imsearch should migrate to the imregister.h version 37 or be removed! 38 **/ 39 # endif 40 41 20 /* convert these to enums? */ 21 /* RegImage.flag values */ 42 22 # define IMREG_DIST 0x01 /* image distributed, only imregister-3.0 */ 43 23 … … 101 81 than one star in the catalog, but not in the same catalog file. 102 82 */ 103 104 /* structure for data on a catalog region */105 typedef struct {106 char filename[256];107 double DEC[2], RA[2];108 } GSCRegion;109 83 110 84 /* structure for Image Registration Database */ … … 137 111 } RegImage; /* 360 bytes / image */ 138 112 139 /* structure for Image Registration Database */140 typedef struct {141 float sky;142 float bias;143 float fwhm;144 float exptime;145 float airmass;146 e_time obstime;147 short int ccdnum;148 char junk1, junk2;149 char filter[32];150 } RufImage; /* 60 bytes */151 152 /* Old Detrend Database structure */153 typedef struct {154 e_time tstart;155 e_time tstop;156 e_time treg;157 float sigma, clipsigma;158 int type;159 int filter;160 int ccd;161 char filename[254];162 char flag1, flag2;163 } DetRegOld; /* 288 bytes */164 165 113 /* Detrend Database structure */ 166 114 typedef struct { … … 193 141 short int c2; /* photcode for color term */ 194 142 short int photcode; /* appropriate photcode */ 195 char label[66];196 } OldPhotPars; /* 100 bytes */197 198 /* Instant Zeropoint structure */199 typedef struct {200 float ZP; /* measured zero point */201 float ZPo; /* expected zero point */202 float dZP; /* error on zero point */203 float K; /* airmass term used */204 float X; /* color term used */205 e_time tstart; /* start time of observation */206 e_time tstop; /* end time of observation */207 short int c1; /* photcode for color term */208 short int c2; /* photcode for color term */209 short int photcode; /* appropriate photcode */210 143 char label[64]; 211 144 short int refcode; /* reference photometry system */ … … 213 146 int Nmeas; /* number of data points */ 214 147 } PhotPars; /* 108 bytes */ 215 216 /* average data as stored in the LONEOS database */217 typedef struct {218 float R; /* RA in decimal degrees */219 float D; /* DEC in decimal degrees */220 short int M; /* thousandths of mag (-32.000 to 32.000 valid range) */221 unsigned short int Nm, Nn; /* number of measurements, missing */222 short int Xp; /* scatter in 1/100 arcsec (-327.67 to +327.67 valid range) */223 short int Xm; /* chisq for primary mag [1000*value] */224 unsigned short int code; /* an ID code (ie, star, ghost, satelite, etc) */225 signed int offset; /* offset to first measurement */226 signed int missing; /* offset to first missing obs */227 short int dM; /* formal error on pri mag [1000*log(value)] */228 short int Xg; /* 'best' chisq value */229 } Average; /* 32 bytes / Average */230 148 231 149 /* average data as stored in the LONEOS database -- must be translated on load */ … … 240 158 signed int offset; /* offset to first measurement */ 241 159 signed int missing; /* offset to first missing obs */ 242 } OldAverage; /* 28 bytes / Average */160 } Average; /* 28 bytes / Average */ 243 161 244 162 /* data for individual measurement for each star */ 245 /* OLD LONEOS VERSION. NOT BYTE COMPATIBLE WITH NEW VERSION246 (can be loaded with translation, losing the exptime,247 and limited the number of Naverage to 0xffffff - in load_catalog) */248 163 typedef struct { 249 164 short int dR, dD; /* 1/100 of arcsec (-327.67 to +327.67 valid range) */ … … 255 170 unsigned int t; /* time in seconds (0 - 143 years valid range) */ 256 171 unsigned int average; /* reference to corresponding average entry, upper byte of Measure.average stores flags */ 257 } OldMeasure; /* 20 bytes / Measure */ 258 259 /* data for individual measurement for each star */ 260 typedef struct { 261 short int dR, dD; /* 1/100 of arcsec (-327.67 to +327.67 valid range) */ 262 short int M; /* thousandths of mag (-32.767 to 32.767 valid range) */ 263 short int Mcal; /* image cal mag, thousandths of mag (-32.767 to 32.767 valid range) */ 264 short int Mgal; /* 'galaxy' mag, thousandths of mag (-32.767 to 32.767 valid range) */ 265 short int airmass; /* (airmass - 1), thousandths of mag (-32.767 to 32.767 valid range) */ 266 short int FWx; /* object fwhm major axis - 1/100 of arcsec */ 267 unsigned char dM; /* thousandths of mag (0.000 to 0.255 valid range) */ 268 unsigned char fwy, theta; /* object fwhm minor/major axes ratio, angle wrt ccd X dir (0xff/360 deg precision) */ 269 char dophot; /* dophot type (1-9) */ 270 unsigned short int source; /* code to identify photometry source */ 271 unsigned int t; /* time in seconds (0 - 143 years valid range) */ 272 unsigned int averef; /* reference to corresponding average entry, upper byte of Measure.average stores flags */ 273 short int dt; /* exposure time in units of 2500*log(exptime) (millimags!) */ 274 unsigned short int flags; /* 16 bit-flags for various uses */ 275 } Measure; /* 32 bytes / Measure */ 276 277 # if (0) 278 /* data for individual measurement for each star */ 279 typedef struct { 280 short int dR, dD; /* 1/100 of arcsec (-327.67 to +327.67 valid range) */ 281 short int M; /* thousandths of mag (-32.767 to 32.767 valid range) */ 282 short int Mcal; /* image cal mag, thousandths of mag (-32.767 to 32.767 valid range) */ 283 unsigned char dM; /* thousandths of mag (0.000 to 0.255 valid range) */ 284 char dophot; /* dophot type (1-9) */ 285 unsigned short int source; /* code to identify photometry source */ 286 unsigned int t; /* time in seconds (0 - 143 years valid range) */ 287 unsigned int averef; /* reference to corresponding average entry, upper byte of Measure.average stores flags */ 288 short int dt; /* exposure time in units of 2500*log(exptime) (millimags!) */ 289 unsigned short int flags; /* 16 bit-flags for various uses */ 290 } Measure; /* 24 bytes / Measure */ 291 # endif 172 } Measure; /* 20 bytes / Measure */ 292 173 293 174 /* data on missing stars */ … … 302 183 short int dM; /* scatter on alt mag */ 303 184 } SecFilt; /* 6 byte / SecFilt */ 304 305 /* data on missing stars */306 typedef struct {307 short int M; /* other mags - thousandths of mag (-32.767 to 32.767 valid range) */308 short int Xm; /* chisq on alt mag */309 } OldSecFilt; /* 4 byte / SecFilt */310 311 /* a catalog contains this data */312 typedef struct {313 /* data in the file: */314 Average *average;315 Measure *measure;316 Missing *missing;317 SecFilt *secfilt;318 Header header;319 int Naverage, Nmeasure, Nmissing, Nsecfilt;320 /* description of the catalog file: */321 char *filename;322 int lockmode;323 FILE *f;324 /* pointers for data manipulation */325 int *found;326 int *image;327 int *mosaic;328 float *X;329 float *Y;330 } Catalog;331 185 332 186 /* the standard astrometric coordinates structure */ … … 341 195 char Npolyterms; 342 196 } Coords; /* 120 bytes / Coords */ 343 344 typedef struct {345 unsigned short int code; /* code number (stored in Measure.source) */346 char name[32]; /* name for filter combination */347 char type; /* primary, secondary, dependent, reference */348 short int C, dC, dX; /* primary phot calibration terms (millimags) */349 float K; /* secondary phot calibration terms (millimags) */350 int c1, c2; /* color is average.M[c1] - average.M[c2] */351 int equiv; /* this dependent filter is equivalent to equiv primary/secondary */352 int Nc; /* number of color terms */353 float X[4]; /* color terms X[0]*mc + X[1]*mc^2 + X[2]*mc^3, etc */354 } PhotCode;355 356 typedef struct {357 int Ncode;358 int Nsecfilt;359 int hashcode[0x10000];360 int hashNsec[0x10000];361 PhotCode *code;362 } PhotCodeData;363 197 364 198 /* image structure for binary data storage of image data */ … … 395 229 /* Image needs to be aligned with 8-byte boundaries on Suns */ 396 230 231 /* a catalog contains this data */ 232 typedef struct { 233 /* data in the file: */ 234 Average *average; 235 Measure *measure; 236 Missing *missing; 237 SecFilt *secfilt; 238 Header header; 239 int Naverage, Nmeasure, Nmissing, Nsecfilt; 240 /* description of the catalog file: */ 241 char *filename; 242 int lockmode; 243 FILE *f; 244 /* pointers for data manipulation */ 245 int *found; 246 int *image; 247 int *mosaic; 248 float *X; 249 float *Y; 250 } Catalog; 251 252 /* structure for data on a catalog region */ 253 typedef struct { 254 char filename[256]; 255 double DEC[2], RA[2]; 256 } GSCRegion; 257 258 typedef struct { 259 unsigned short int code; /* code number (stored in Measure.source) */ 260 char name[32]; /* name for filter combination */ 261 char type; /* primary, secondary, dependent, reference */ 262 short int C, dC, dX; /* primary phot calibration terms (millimags) */ 263 float K; /* secondary phot calibration terms (millimags) */ 264 int c1, c2; /* color is average.M[c1] - average.M[c2] */ 265 int equiv; /* this dependent filter is equivalent to equiv primary/secondary */ 266 int Nc; /* number of color terms */ 267 float X[4]; /* color terms X[0]*mc + X[1]*mc^2 + X[2]*mc^3, etc */ 268 } PhotCode; 269 270 typedef struct { 271 int Ncode; 272 int Nsecfilt; 273 int hashcode[0x10000]; 274 int hashNsec[0x10000]; 275 PhotCode *code; 276 } PhotCodeData; 277 397 278 /**** prototypes ****/ 398 279 -
trunk/Ohana/src/libohana/src/Fread.c
r2413 r3466 1 1 # include <stdio.h> 2 2 # include <string.h> 3 # include <ohana.h> 4 # include <dvo.h> 3 5 int ByteSwap (char *ptr, int size, int nitems, char *type); 4 6 int ConvertStruct (char *buffer, int size, int Nbytes, char *type); … … 15 17 tmp = byte[X+2]; byte[X+2] = byte[X+5]; byte[X+5] = tmp; \ 16 18 tmp = byte[X+3]; byte[X+3] = byte[X+4]; byte[X+4] = tmp; 17 # define IMAGE_SIZE 240 18 # define OLDAVERAGE_SIZE 28 19 # define AVERAGE_SIZE 32 20 # define OLDMEASURE_SIZE 20 21 # define MEASURE_SIZE 32 22 # define MISSING_SIZE 4 23 # define OLDSECFILT_SIZE 4 24 # define SECFILT_SIZE 6 19 25 20 # define REGIMAGE_SIZE 360 26 # define SPECTRUM_SIZE 21627 # define RUFIMAGE_SIZE 6028 # define OLDDETREG_SIZE 28829 21 # define DETREG_SIZE 416 30 22 # define PHOTPARS_SIZE 108 23 # define MISSING_SIZE 4 24 # define SECFILT_SIZE 6 25 # define SPECTRUM_SIZE 216 /* where is this?? */ 26 # define IMAGE_SIZE 240 27 28 # if (PANSTARRS) 29 # define AVERAGE_SIZE 40 30 # define MEASURE_SIZE 32 31 # endif 32 33 # if (ELIXIR) 34 # define AVERAGE_SIZE 32 35 # define MEASURE_SIZE 32 36 # endif 37 38 # if (LONEOS) 39 # define AVERAGE_SIZE 28 40 # define MEASURE_SIZE 20 41 # endif 42 31 43 # define OLDPHOTPARS_SIZE 100 32 # define TRUE 133 # define FALSE 044 # define OLDSECFILT_SIZE 4 45 # define OLDDETREG_SIZE 288 34 46 35 47 # ifdef linux … … 46 58 # endif 47 59 48 int Fread ( char*ptr, int size, int nitems, FILE *f, char *type) {60 int Fread (void *ptr, int size, int nitems, FILE *f, char *type) { 49 61 50 62 int valid, status; … … 58 70 } 59 71 60 int Fwrite ( char*ptr, int size, int nitems, FILE *f, char *type) {72 int Fwrite (void *ptr, int size, int nitems, FILE *f, char *type) { 61 73 62 74 int valid, status; … … 81 93 # ifdef BYTE_SWAP 82 94 83 int i, j , valid;95 int i, j; 84 96 unsigned char *byte, *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp; 85 97 86 valid = FALSE; 87 if (!strcmp (type, "char")) { 88 valid = TRUE; 89 } 98 if (!strcmp (type, "char")) return (TRUE); 90 99 91 100 if (!strcmp (type, "short")) { … … 97 106 *byte1 = tmp; 98 107 } 99 valid = TRUE;108 return (TRUE); 100 109 } 101 110 … … 113 122 *byte2 = tmp; 114 123 } 115 valid = TRUE;124 return (TRUE); 116 125 } 117 126 … … 139 148 *byte4 = tmp; 140 149 } 141 valid = TRUE; 142 } 143 144 if (!strcmp (type, "average")) { 145 if (size != AVERAGE_SIZE) { 146 fprintf (stderr, "mismatch in type sizes (Average) %d vs %d\n", size, AVERAGE_SIZE); 147 return (0); 148 } 149 byte = (char *)ptr; 150 for (i = 0; i < nitems; i++, byte += AVERAGE_SIZE) { 151 SWAP_WORD (0); /* R */ 152 SWAP_WORD (4); /* D */ 153 SWAP_BYTE (8); /* M */ 154 SWAP_BYTE (10); /* Nm */ 155 SWAP_BYTE (12); /* Nn */ 156 SWAP_BYTE (14); /* Xp */ 157 SWAP_BYTE (16); /* Xm */ 158 SWAP_BYTE (18); /* code */ 159 SWAP_WORD (20); /* offset */ 160 SWAP_WORD (24); /* missing */ 161 SWAP_BYTE (28); /* dM */ 162 SWAP_BYTE (30); /* Xg */ 163 } 164 valid = TRUE; 165 } 166 167 if (!strcmp (type, "oldaverage")) { 168 if (size != OLDAVERAGE_SIZE) { 169 fprintf (stderr, "mismatch in type sizes (OldAverage) %d vs %d\n", size, OLDAVERAGE_SIZE); 170 return (0); 171 } 172 byte = (char *)ptr; 173 for (i = 0; i < nitems; i++, byte += OLDAVERAGE_SIZE) { 174 SWAP_WORD (0); /* R */ 175 SWAP_WORD (4); /* D */ 176 SWAP_BYTE (8); /* M */ 177 SWAP_BYTE (10); /* Nm */ 178 SWAP_BYTE (12); /* Nn */ 179 SWAP_BYTE (14); /* Xp */ 180 SWAP_BYTE (16); /* Xm */ 181 SWAP_BYTE (18); /* code */ 182 SWAP_WORD (20); /* offset */ 183 SWAP_WORD (24); /* missing */ 184 } 185 valid = TRUE; 186 } 150 return (TRUE); 151 } 187 152 188 153 if (!strcmp (type, "regimage")) { 189 154 if (size != REGIMAGE_SIZE) { 190 155 fprintf (stderr, "mismatch in type sizes (RegImage) %d vs %d\n", size, REGIMAGE_SIZE); 191 return ( 0);156 return (FALSE); 192 157 } 193 158 byte = (char *)ptr; … … 213 178 SWAP_WORD (356); /* regtime */ 214 179 } 215 valid = TRUE; 216 } 217 218 if (!strcmp (type, "spectrum")) { 219 if (size != SPECTRUM_SIZE) { 220 fprintf (stderr, "mismatch in type sizes (Spectrum) %d vs %d\n", size, SPECTRUM_SIZE); 221 return (0); 222 } 223 byte = (char *)ptr; 224 for (i = 0; i < nitems; i++, byte += SPECTRUM_SIZE) { 225 SWAP_WORD (0); /* ra */ 226 SWAP_WORD (4); /* dec */ 227 SWAP_WORD (8); /* exptime */ 228 SWAP_WORD (12); /* airmass */ 229 SWAP_WORD (16); /* Ws */ 230 SWAP_WORD (20); /* We */ 231 SWAP_WORD (24); /* dW */ 232 SWAP_WORD (28); /* Nspec */ 233 SWAP_WORD (32); /* obstime */ 234 SWAP_WORD (36); /* regtime */ 235 } 236 valid = TRUE; 237 } 238 239 if (!strcmp (type, "rufimage")) { 240 if (size != RUFIMAGE_SIZE) { 241 fprintf (stderr, "mismatch in type sizes (RufImage) %d vs %d\n", size, RUFIMAGE_SIZE); 242 return (0); 243 } 244 byte = (char *)ptr; 245 for (i = 0; i < nitems; i++, byte += RUFIMAGE_SIZE) { 246 SWAP_WORD (0); /* sky */ 247 SWAP_WORD (4); /* bias */ 248 SWAP_WORD (8); /* fwhm */ 249 SWAP_WORD (12); /* exptime */ 250 SWAP_WORD (16); /* airmass */ 251 SWAP_WORD (20); /* obstime */ 252 SWAP_BYTE (24); /* ccdnum */ 253 } 254 valid = TRUE; 255 } 256 257 if (!strcmp (type, "olddetreg")) { 258 if (size != OLDDETREG_SIZE) { 259 fprintf (stderr, "mismatch in type sizes (DetReg) %d vs %d\n", size, OLDDETREG_SIZE); 260 return (0); 261 } 262 byte = (char *)ptr; 263 for (i = 0; i < nitems; i++, byte += OLDDETREG_SIZE) { 264 SWAP_WORD (0); /* tstart */ 265 SWAP_WORD (4); /* tstop */ 266 SWAP_WORD (8); /* treg */ 267 SWAP_WORD (12); /* sigma */ 268 SWAP_WORD (16); /* clipsigma */ 269 SWAP_WORD (20); /* type */ 270 SWAP_WORD (24); /* filter */ 271 SWAP_WORD (28); /* ccd */ 272 } 273 valid = TRUE; 180 return (TRUE); 274 181 } 275 182 … … 277 184 if (size != DETREG_SIZE) { 278 185 fprintf (stderr, "mismatch in type sizes (DetReg) %d vs %d\n", size, DETREG_SIZE); 279 return ( 0);186 return (FALSE); 280 187 } 281 188 byte = (char *)ptr; … … 291 198 SWAP_WORD (32); /* Norder */ 292 199 } 293 valid = TRUE; 294 } 295 296 if (!strcmp (type, "oldphotpars")) { 297 if (size != OLDPHOTPARS_SIZE) { 298 fprintf (stderr, "mismatch in type sizes (OldPhotPars) %d vs %d\n", size, OLDPHOTPARS_SIZE); 299 return (0); 300 } 301 byte = (char *)ptr; 302 for (i = 0; i < nitems; i++, byte += OLDPHOTPARS_SIZE) { 303 SWAP_WORD (0); /* ZP */ 304 SWAP_WORD (4); /* ZPo */ 305 SWAP_WORD (8); /* dZP */ 306 SWAP_WORD (12); /* K */ 307 SWAP_WORD (16); /* A */ 308 SWAP_WORD (20); /* tstart */ 309 SWAP_WORD (24); /* tstop */ 310 SWAP_BYTE (28); /* c1 */ 311 SWAP_BYTE (30); /* c2 */ 312 SWAP_BYTE (32); /* photcode */ 313 } 314 valid = TRUE; 200 return (TRUE); 315 201 } 316 202 … … 318 204 if (size != PHOTPARS_SIZE) { 319 205 fprintf (stderr, "mismatch in type sizes (PhotPars) %d vs %d\n", size, PHOTPARS_SIZE); 320 return ( 0);206 return (FALSE); 321 207 } 322 208 byte = (char *)ptr; … … 335 221 SWAP_WORD (104); /* Nmeas */ 336 222 } 337 valid = TRUE; 338 } 339 340 if (!strcmp (type, "oldmeasure")) { 341 if (size != OLDMEASURE_SIZE) { 342 fprintf (stderr, "mismatch in type sizes (OldMeasure) %d vs %d\n", size, OLDMEASURE_SIZE); 343 return (0); 344 } 345 byte = (char *)ptr; 346 for (i = 0; i < nitems; i++, byte += OLDMEASURE_SIZE) { 347 SWAP_BYTE (0); /* dR */ 348 SWAP_BYTE (2); /* dD */ 349 SWAP_BYTE (4); /* M */ 350 SWAP_BYTE (6); /* Mcal */ 351 SWAP_BYTE (10); /* source */ 352 SWAP_WORD (12); /* t */ 353 SWAP_WORD (16); /* average */ 354 } 355 valid = TRUE; 356 } 357 358 if (!strcmp (type, "measure")) { 359 if (size != MEASURE_SIZE) { 360 fprintf (stderr, "mismatch in type sizes (Measure) %d vs %d\n", size, MEASURE_SIZE); 361 return (0); 362 } 363 byte = (char *)ptr; 364 for (i = 0; i < nitems; i++, byte += MEASURE_SIZE) { 365 SWAP_BYTE (0); /* dR */ 366 SWAP_BYTE (2); /* dD */ 367 SWAP_BYTE (4); /* M */ 368 SWAP_BYTE (6); /* Mcal */ 369 SWAP_BYTE (8); /* Mgal */ 370 SWAP_BYTE (10); /* Map */ 371 SWAP_BYTE (12); /* FWx */ 372 /* 14, 15, 16, 17 - char */ 373 SWAP_BYTE (18); /* source */ 374 SWAP_WORD (20); /* t */ 375 SWAP_WORD (24); /* averef */ 376 SWAP_BYTE (28); /* dt */ 377 SWAP_BYTE (30); /* flags */ 378 } 379 valid = TRUE; 380 } 381 382 if (!strcmp (type, "secfilt")) { 383 if (size != SECFILT_SIZE) { 384 fprintf (stderr, "mismatch in type sizes (SecFilt) %d vs %d\n", size, SECFILT_SIZE); 385 return (0); 386 } 387 byte = (char *) ptr; 388 for (i = 0; i < nitems; i++, byte += SECFILT_SIZE) { 389 SWAP_BYTE (0); /* M */ 390 SWAP_BYTE (2); /* Xm */ 391 SWAP_BYTE (4); /* dM */ 392 } 393 valid = TRUE; 394 } 395 396 if (!strcmp (type, "oldsecfilt")) { 397 if (size != OLDSECFILT_SIZE) { 398 fprintf (stderr, "mismatch in type sizes (OldSecFilt) %d vs %d\n", size, OLDSECFILT_SIZE); 399 return (0); 400 } 401 byte = (char *) ptr; 402 for (i = 0; i < nitems; i++, byte += OLDSECFILT_SIZE) { 403 SWAP_BYTE (0); /* M */ 404 SWAP_BYTE (2); /* Xm */ 405 } 406 valid = TRUE; 223 return (TRUE); 407 224 } 408 225 … … 410 227 if (size != MISSING_SIZE) { 411 228 fprintf (stderr, "mismatch in type sizes (Missing) %d vs %d\n", size, MISSING_SIZE); 412 return ( 0);229 return (FALSE); 413 230 } 414 231 byte0 = (char *)ptr; … … 424 241 *byte2 = tmp; 425 242 } 426 valid = TRUE; 243 return (TRUE); 244 } 245 246 if (!strcmp (type, "secfilt")) { 247 if (size != SECFILT_SIZE) { 248 fprintf (stderr, "mismatch in type sizes (SecFilt) %d vs %d\n", size, SECFILT_SIZE); 249 return (FALSE); 250 } 251 byte = (char *) ptr; 252 for (i = 0; i < nitems; i++, byte += SECFILT_SIZE) { 253 SWAP_BYTE (0); /* M */ 254 SWAP_BYTE (2); /* Xm */ 255 SWAP_BYTE (4); /* dM */ 256 } 257 return (TRUE); 258 } 259 260 if (!strcmp (type, "spectrum")) { 261 if (size != SPECTRUM_SIZE) { 262 fprintf (stderr, "mismatch in type sizes (Spectrum) %d vs %d\n", size, SPECTRUM_SIZE); 263 return (FALSE); 264 } 265 byte = (char *)ptr; 266 for (i = 0; i < nitems; i++, byte += SPECTRUM_SIZE) { 267 SWAP_WORD (0); /* ra */ 268 SWAP_WORD (4); /* dec */ 269 SWAP_WORD (8); /* exptime */ 270 SWAP_WORD (12); /* airmass */ 271 SWAP_WORD (16); /* Ws */ 272 SWAP_WORD (20); /* We */ 273 SWAP_WORD (24); /* dW */ 274 SWAP_WORD (28); /* Nspec */ 275 SWAP_WORD (32); /* obstime */ 276 SWAP_WORD (36); /* regtime */ 277 } 278 return (TRUE); 427 279 } 428 280 … … 430 282 if (size != IMAGE_SIZE) { 431 283 fprintf (stderr, "mismatch in type sizes (Image) %d vs %d\n", size, IMAGE_SIZE); 432 return ( 0);284 return (FALSE); 433 285 } 434 286 byte = (char *)ptr; … … 450 302 } 451 303 } 452 valid = TRUE; 453 } 454 455 if (!valid) 456 fprintf (stderr, "unknown type %s\n", type); 457 458 return (valid); 304 return (TRUE); 305 } 306 307 # if (PANSTARRS) 308 if (!strcmp (type, "average")) { 309 if (size != AVERAGE_SIZE) { 310 fprintf (stderr, "mismatch in type sizes (Average) %d vs %d\n", size, AVERAGE_SIZE); 311 return (FALSE); 312 } 313 byte = (char *)ptr; 314 for (i = 0; i < nitems; i++, byte += AVERAGE_SIZE) { 315 SWAP_DBLE (0); /* R */ 316 SWAP_DBLE (8); /* D */ 317 SWAP_BYTE (16); /* M */ 318 SWAP_BYTE (18); /* Nm */ 319 SWAP_BYTE (20); /* Nn */ 320 SWAP_BYTE (22); /* Xp */ 321 SWAP_BYTE (24); /* Xm */ 322 SWAP_BYTE (26); /* code */ 323 SWAP_WORD (28); /* offset */ 324 SWAP_WORD (32); /* missing */ 325 SWAP_BYTE (36); /* dM */ 326 SWAP_BYTE (38); /* Xg */ 327 } 328 return (TRUE); 329 } 330 if (!strcmp (type, "measure")) { 331 if (size != MEASURE_SIZE) { 332 fprintf (stderr, "mismatch in type sizes (Measure) %d vs %d\n", size, MEASURE_SIZE); 333 return (FALSE); 334 } 335 byte = (char *)ptr; 336 for (i = 0; i < nitems; i++, byte += MEASURE_SIZE) { 337 SWAP_BYTE (0); /* dR */ 338 SWAP_BYTE (2); /* dD */ 339 SWAP_BYTE (4); /* M */ 340 SWAP_BYTE (6); /* Mcal */ 341 SWAP_BYTE (8); /* Mgal */ 342 SWAP_BYTE (10); /* Map */ 343 SWAP_BYTE (12); /* FWx */ 344 /* 14, 15, 16, 17 - char */ 345 SWAP_BYTE (18); /* source */ 346 SWAP_WORD (20); /* t */ 347 SWAP_WORD (24); /* averef */ 348 SWAP_BYTE (28); /* dt */ 349 SWAP_BYTE (30); /* flags */ 350 } 351 return (TRUE); 352 } 353 354 # endif /** ELIXIR **/ 355 356 357 # if (ELIXIR) 358 if (!strcmp (type, "average")) { 359 if (size != AVERAGE_SIZE) { 360 fprintf (stderr, "mismatch in type sizes (Average) %d vs %d\n", size, AVERAGE_SIZE); 361 return (FALSE); 362 } 363 byte = (char *)ptr; 364 for (i = 0; i < nitems; i++, byte += AVERAGE_SIZE) { 365 SWAP_WORD (0); /* R */ 366 SWAP_WORD (4); /* D */ 367 SWAP_BYTE (8); /* M */ 368 SWAP_BYTE (10); /* Nm */ 369 SWAP_BYTE (12); /* Nn */ 370 SWAP_BYTE (14); /* Xp */ 371 SWAP_BYTE (16); /* Xm */ 372 SWAP_BYTE (18); /* code */ 373 SWAP_WORD (20); /* offset */ 374 SWAP_WORD (24); /* missing */ 375 SWAP_BYTE (28); /* dM */ 376 SWAP_BYTE (30); /* Xg */ 377 } 378 return (TRUE); 379 } 380 if (!strcmp (type, "measure")) { 381 if (size != MEASURE_SIZE) { 382 fprintf (stderr, "mismatch in type sizes (Measure) %d vs %d\n", size, MEASURE_SIZE); 383 return (FALSE); 384 } 385 byte = (char *)ptr; 386 for (i = 0; i < nitems; i++, byte += MEASURE_SIZE) { 387 SWAP_BYTE (0); /* dR */ 388 SWAP_BYTE (2); /* dD */ 389 SWAP_BYTE (4); /* M */ 390 SWAP_BYTE (6); /* Mcal */ 391 SWAP_BYTE (8); /* Mgal */ 392 SWAP_BYTE (10); /* Map */ 393 SWAP_BYTE (12); /* FWx */ 394 /* 14, 15, 16, 17 - char */ 395 SWAP_BYTE (18); /* source */ 396 SWAP_WORD (20); /* t */ 397 SWAP_WORD (24); /* averef */ 398 SWAP_BYTE (28); /* dt */ 399 SWAP_BYTE (30); /* flags */ 400 } 401 return (TRUE); 402 } 403 404 # endif /** ELIXIR **/ 405 406 407 # if (LONEOS) 408 if (!strcmp (type, "average")) { 409 if (size != OLDAVERAGE_SIZE) { 410 fprintf (stderr, "mismatch in type sizes (OldAverage) %d vs %d\n", size, OLDAVERAGE_SIZE); 411 return (FALSE); 412 } 413 byte = (char *)ptr; 414 for (i = 0; i < nitems; i++, byte += OLDAVERAGE_SIZE) { 415 SWAP_WORD (0); /* R */ 416 SWAP_WORD (4); /* D */ 417 SWAP_BYTE (8); /* M */ 418 SWAP_BYTE (10); /* Nm */ 419 SWAP_BYTE (12); /* Nn */ 420 SWAP_BYTE (14); /* Xp */ 421 SWAP_BYTE (16); /* Xm */ 422 SWAP_BYTE (18); /* code */ 423 SWAP_WORD (20); /* offset */ 424 SWAP_WORD (24); /* missing */ 425 } 426 return (TRUE); 427 } 428 if (!strcmp (type, "measure")) { 429 if (size != OLDMEASURE_SIZE) { 430 fprintf (stderr, "mismatch in type sizes (OldMeasure) %d vs %d\n", size, OLDMEASURE_SIZE); 431 return (FALSE); 432 } 433 byte = (char *)ptr; 434 for (i = 0; i < nitems; i++, byte += OLDMEASURE_SIZE) { 435 SWAP_BYTE (0); /* dR */ 436 SWAP_BYTE (2); /* dD */ 437 SWAP_BYTE (4); /* M */ 438 SWAP_BYTE (6); /* Mcal */ 439 SWAP_BYTE (10); /* source */ 440 SWAP_WORD (12); /* t */ 441 SWAP_WORD (16); /* average */ 442 } 443 return (TRUE); 444 } 445 # endif /** LONEOS **/ 446 447 # if (0) /*** others ***/ 448 if (!strcmp (type, "oldsecfilt")) { 449 if (size != OLDSECFILT_SIZE) { 450 fprintf (stderr, "mismatch in type sizes (OldSecFilt) %d vs %d\n", size, OLDSECFILT_SIZE); 451 return (FALSE); 452 } 453 byte = (char *) ptr; 454 for (i = 0; i < nitems; i++, byte += OLDSECFILT_SIZE) { 455 SWAP_BYTE (0); /* M */ 456 SWAP_BYTE (2); /* Xm */ 457 } 458 return (TRUE); 459 } 460 if (!strcmp (type, "rufimage")) { 461 if (size != RUFIMAGE_SIZE) { 462 fprintf (stderr, "mismatch in type sizes (RufImage) %d vs %d\n", size, RUFIMAGE_SIZE); 463 return (FALSE); 464 } 465 byte = (char *)ptr; 466 for (i = 0; i < nitems; i++, byte += RUFIMAGE_SIZE) { 467 SWAP_WORD (0); /* sky */ 468 SWAP_WORD (4); /* bias */ 469 SWAP_WORD (8); /* fwhm */ 470 SWAP_WORD (12); /* exptime */ 471 SWAP_WORD (16); /* airmass */ 472 SWAP_WORD (20); /* obstime */ 473 SWAP_BYTE (24); /* ccdnum */ 474 } 475 return (TRUE); 476 } 477 if (!strcmp (type, "olddetreg")) { 478 if (size != OLDDETREG_SIZE) { 479 fprintf (stderr, "mismatch in type sizes (DetReg) %d vs %d\n", size, OLDDETREG_SIZE); 480 return (FALSE); 481 } 482 byte = (char *)ptr; 483 for (i = 0; i < nitems; i++, byte += OLDDETREG_SIZE) { 484 SWAP_WORD (0); /* tstart */ 485 SWAP_WORD (4); /* tstop */ 486 SWAP_WORD (8); /* treg */ 487 SWAP_WORD (12); /* sigma */ 488 SWAP_WORD (16); /* clipsigma */ 489 SWAP_WORD (20); /* type */ 490 SWAP_WORD (24); /* filter */ 491 SWAP_WORD (28); /* ccd */ 492 } 493 return (TRUE); 494 } 495 # endif /** others **/ 496 497 fprintf (stderr, "unknown type %s\n", type); 498 return (FALSE); 459 499 460 500 # else -
trunk/Ohana/src/libohana/src/LoadPhotcodes.c
r2413 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 # define NCTERMS 4 -
trunk/Ohana/src/libohana/src/coordops.c
r3389 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 static Coords *mosaic = NULL; -
trunk/Ohana/src/libohana/src/imreg_datatypes.c
r2805 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 char typename[N_TYPE][32] = {"none", "object", "dark", "bias", "flat", "mask", "fringe", "scatter", "modes", "frpts", "any"}; -
trunk/Ohana/src/libohana/src/mosaic_astrom.c
r3402 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 /* chip-match table: j = ChipMatch[i], images[j] is DIS for images[i] WRP */ -
trunk/Ohana/src/libohana/src/phot_catalog.c
r2413 r3466 1 1 # include <ohana.h> 2 # include <loneos.h> 3 4 SecFilt *FixOldSecFilt (OldSecFilt *in, int Nvalues); 5 Average *FixOldAverage (OldAverage *in, int Nvalues); 6 Measure *FixOldMeasure (OldMeasure *in, int Nvalues); 2 # include <dvo.h> 7 3 8 4 /* possible exit status for lock_catalog: … … 37 33 } 38 34 39 /* this is (a bit) dangerous: the load function will automatically40 convert from the old (Loneos) format to the new (CFHT) format.41 But, if you load an old-format catalog, then save the new-format42 version, the new file will be corrupted unless you load all four43 data components. Actually, 'save_catalog' assumes you've loaded44 all four anyway, so it is not such a problem... */45 46 35 int load_catalog (Catalog *catalog, char mode, int VERBOSE) { 47 36 … … 50 39 int NewMeasure, NewAverage, NewSecFilt; 51 40 FILE *f; 52 OldMeasure *tmpmeasure;53 OldAverage *tmpaverage;54 OldSecFilt *tmpsecfilt;55 41 struct stat filestatus; 56 42 … … 66 52 /* this is done by the load anyway... */ 67 53 fseek (f, catalog[0].header.size, SEEK_SET); 54 55 /* require the file to contain the NEW versions (ELIXIR) */ 56 if (!fits_scan (&catalog[0].header, "NEWMEAS", "%t", 1, &NewMeasure)) return (FALSE); 57 if (!fits_scan (&catalog[0].header, "NEWAVES", "%t", 1, &NewAverage)) return (FALSE); 58 if (!fits_scan (&catalog[0].header, "NEWSECF", "%t", 1, &NewSecFilt)) return (FALSE); 68 59 69 60 /* get the components from the header */ … … 73 64 if (!fits_scan (&catalog[0].header, "NMISS", "%d", 1, &catalog[0].Nmissing)) return (FALSE); 74 65 if (!fits_scan (&catalog[0].header, "NSECFILT", "%d", 1, &catalog[0].Nsecfilt)) catalog[0].Nsecfilt = 0; 75 if (!fits_scan (&catalog[0].header, "NEWMEAS", "%t", 1, &NewMeasure)) NewMeasure = FALSE;76 if (!fits_scan (&catalog[0].header, "NEWAVES", "%t", 1, &NewAverage)) NewAverage = FALSE;77 if (!fits_scan (&catalog[0].header, "NEWSECF", "%t", 1, &NewSecFilt)) NewSecFilt = FALSE;78 66 79 67 /* predicted file size - for double checking data validity */ 80 68 size = catalog[0].header.size; 81 ssize = NewAverage ? sizeof (Average) : sizeof (OldAverage);69 ssize = sizeof (Average); 82 70 size += ssize * catalog[0].Naverage; 83 ssize = NewMeasure ? sizeof (Measure) : sizeof (OldMeasure);71 ssize = sizeof (Measure); 84 72 size += ssize * catalog[0].Nmeasure; 85 73 ssize = sizeof (Missing); 86 74 size += ssize * catalog[0].Nmissing; 87 ssize = NewSecFilt ? sizeof (SecFilt) : sizeof (OldSecFilt);75 ssize = sizeof (SecFilt); 88 76 size += ssize * catalog[0].Nsecfilt * catalog[0].Naverage; 89 77 … … 96 84 if (VERBOSE) { 97 85 fprintf (stderr, "star catalog has inconsistent size\n"); 98 ssize = NewAverage ? sizeof (Average) : sizeof (OldAverage);86 ssize = sizeof (Average); 99 87 fprintf (stderr, "average: %d = %d bytes\n", catalog[0].Naverage, catalog[0].Naverage*ssize); 100 ssize = NewMeasure ? sizeof (Measure) : sizeof (OldMeasure);88 ssize = sizeof (Measure); 101 89 fprintf (stderr, "measure: %d = %d bytes\n", catalog[0].Nmeasure, catalog[0].Nmeasure*ssize); 102 90 ssize = sizeof (Missing); 103 91 fprintf (stderr, "missing: %d = %d bytes\n", catalog[0].Nmissing, catalog[0].Nmissing*ssize); 104 ssize = NewSecFilt ? sizeof (SecFilt) : sizeof (OldSecFilt);92 ssize = sizeof (SecFilt); 105 93 fprintf (stderr, "secfilt: %d = %d bytes\n", catalog[0].Nsecfilt, catalog[0].Nsecfilt*catalog[0].Naverage*ssize); 106 94 fprintf (stderr, "expect: %d, found: %d\n", size, (int)filestatus.st_size); … … 118 106 119 107 if (mode & LOAD_AVES) { 120 /* read average values */ 121 if (NewAverage) { 122 ALLOCATE (catalog[0].average, Average, MAX (catalog[0].Naverage, 1)); 123 Nitems = catalog[0].Naverage; 124 nitems = Fread (catalog[0].average, sizeof(Average), Nitems, f, "average"); 125 } else { 126 ALLOCATE (tmpaverage, OldAverage, MAX (catalog[0].Naverage, 1)); 127 Nitems = catalog[0].Naverage; 128 nitems = Fread (tmpaverage, sizeof(OldAverage), Nitems, f, "oldaverage"); 129 catalog[0].average = FixOldAverage (tmpaverage, Nitems); 130 } 108 ALLOCATE (catalog[0].average, Average, MAX (catalog[0].Naverage, 1)); 109 Nitems = catalog[0].Naverage; 110 nitems = Fread (catalog[0].average, sizeof(Average), Nitems, f, "average"); 131 111 if (nitems != Nitems) { 132 112 if (VERBOSE) fprintf (stderr, "failed to read averages from catalog file %s (%d vs %d)\n", catalog[0].filename, nitems, Nitems); … … 139 119 140 120 if (mode & LOAD_MEAS) { 141 /* read measurements */ 142 if (NewMeasure) { 143 ALLOCATE (catalog[0].measure, Measure, MAX (catalog[0].Nmeasure, 1)); 144 Nitems = catalog[0].Nmeasure; 145 nitems = Fread (catalog[0].measure, sizeof(Measure), Nitems, f, "measure"); 146 } else { 147 ALLOCATE (tmpmeasure, OldMeasure, MAX (catalog[0].Nmeasure, 1)); 148 Nitems = catalog[0].Nmeasure; 149 nitems = Fread (tmpmeasure, sizeof(OldMeasure), Nitems, f, "oldmeasure"); 150 catalog[0].measure = FixOldMeasure (tmpmeasure, Nitems); 151 } 121 ALLOCATE (catalog[0].measure, Measure, MAX (catalog[0].Nmeasure, 1)); 122 Nitems = catalog[0].Nmeasure; 123 nitems = Fread (catalog[0].measure, sizeof(Measure), Nitems, f, "measure"); 152 124 if (nitems != Nitems) { 153 125 if (VERBOSE) fprintf (stderr, "failed to read measures from catalog file %s (%d vs %d)\n", catalog[0].filename, nitems, Nitems); … … 174 146 175 147 if (mode & LOAD_SECF) { 176 /* read missing */ 177 if (NewSecFilt) { 178 Nitems = catalog[0].Naverage * catalog[0].Nsecfilt; 179 ALLOCATE (catalog[0].secfilt, SecFilt, MAX (Nitems, 1)); 180 nitems = Fread (catalog[0].secfilt, sizeof(SecFilt), Nitems, f, "secfilt"); 181 } else { 182 Nitems = catalog[0].Naverage * catalog[0].Nsecfilt; 183 ALLOCATE (tmpsecfilt, OldSecFilt, MAX (Nitems, 1)); 184 nitems = Fread (tmpsecfilt, sizeof(OldSecFilt), Nitems, f, "oldsecfilt"); 185 catalog[0].secfilt = FixOldSecFilt (tmpsecfilt, Nitems); 186 } 148 Nitems = catalog[0].Naverage * catalog[0].Nsecfilt; 149 ALLOCATE (catalog[0].secfilt, SecFilt, MAX (Nitems, 1)); 150 nitems = Fread (catalog[0].secfilt, sizeof(SecFilt), Nitems, f, "secfilt"); 187 151 if (nitems != Nitems) { 188 152 if (VERBOSE) fprintf (stderr, "failed to read secondary filters from catalog file %s (%d vs %d)\n", catalog[0].filename, nitems, Nitems); … … 281 245 } 282 246 283 /**** tools to convert between formats - this happens automatically in load_catalog */284 285 Measure *FixOldMeasure (OldMeasure *in, int Nvalues) {286 287 int i;288 Measure *out;289 290 ALLOCATE (out, Measure, Nvalues);291 292 for (i = 0; i < Nvalues; i++) {293 out[i].dR = in[i].dR;294 out[i].dD = in[i].dD;295 out[i].M = in[i].M;296 out[i].dM = in[i].dM;297 out[i].Mcal = in[i].Mcal;298 out[i].dophot = in[i].dophot;299 out[i].source = in[i].source;300 out[i].t = in[i].t;301 302 out[i].dt = 0xffff;303 out[i].averef = in[i].average & 0x00ffffff;304 out[i].flags = (in[i].average & 0xff000000) >> 24;305 }306 307 free (in);308 309 return (out);310 }311 312 Average *FixOldAverage (OldAverage *in, int Nvalues) {313 314 int i;315 Average *out;316 317 ALLOCATE (out, Average, Nvalues);318 319 for (i = 0; i < Nvalues; i++) {320 out[i].R = in[i].R;321 out[i].D = in[i].D;322 out[i].M = in[i].M;323 out[i].Xp = in[i].Xp;324 out[i].Xm = in[i].Xm;325 out[i].Nm = in[i].Nm;326 out[i].Nn = in[i].Nn;327 out[i].code = in[i].code;328 out[i].offset = in[i].offset;329 out[i].missing = in[i].missing;330 331 out[i].dM = 0xffff;332 }333 334 free (in);335 336 return (out);337 }338 339 SecFilt *FixOldSecFilt (OldSecFilt *in, int Nvalues) {340 341 int i;342 SecFilt *out;343 344 ALLOCATE (out, SecFilt, Nvalues);345 346 for (i = 0; i < Nvalues; i++) {347 out[i].M = in[i].M;348 out[i].Xm = in[i].Xm;349 350 out[i].dM = 0xffff;351 }352 353 free (in);354 355 return (out);356 }357 -
trunk/Ohana/src/libohana/src/photfits.c
r2413 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 # define MAX_ORDER 3 4 4 -
trunk/Ohana/src/markrock/include/markrock.h
r2490 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 typedef struct { -
trunk/Ohana/src/markstar/include/markstar.h
r2490 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 int VERBOSE; -
trunk/Ohana/src/misc/src/SAOobjects.c
r2417 r3466 1 1 # include "ohana.h" 2 # include " loneos.h"2 # include "dvo.h" 3 3 4 4 main (int argc, char **argv) { -
trunk/Ohana/src/misc/src/fixcpt.c
r2417 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 main (argc, argv) -
trunk/Ohana/src/misc/src/fiximg.c
r2417 r3466 1 1 # include <ohana.h> 2 # include <loneos.h>3 2 4 3 int main (int argc, char **argv) { -
trunk/Ohana/src/misc/src/fixsimple.c
r2417 r3466 1 1 # include <ohana.h> 2 # include <loneos.h>3 2 4 3 main (int argc, char **argv) { -
trunk/Ohana/src/misc/src/mosastro.c
r2417 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 # define NCCD 12 4 4 -
trunk/Ohana/src/mosastro/Makefile
r3416 r3466 61 61 $(SRC)/wfits.$(ARCH).o \ 62 62 $(SRC)/rtext.$(ARCH).o \ 63 $(SRC)/ConvertStars.$(ARCH).o 63 $(SRC)/ConvertStars.$(ARCH).o \ 64 $(SRC)/SaveResiduals.$(ARCH).o 64 65 65 66 mosastro: $(BIN)/mosastro.$(ARCH) -
trunk/Ohana/src/mosastro/include/mosastro.h
r3416 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 typedef struct { … … 73 73 } Stars; 74 74 75 typedef struct { 76 double Rraw, Draw; /* Sky Coords - degrees */ 77 float Praw, Qraw; /* Tangent Plane - pixels */ 78 float Lraw, Mraw; /* Focal Plane - pixels */ 79 float Xraw, Yraw; /* Chip Coords - pixels */ 80 81 double Rref, Dref; /* Sky Coords - degrees */ 82 float Pref, Qref; /* Tangent Plane - pixels */ 83 float Lref, Mref; /* Focal Plane - pixels */ 84 float Xref, Yref; /* Chip Coords - pixels */ 85 86 float Mcat, dMcat; 87 float Minst, dMinst; 88 char mask; 89 } MatchData; 90 75 91 int ChipOrder; 76 92 int Nchip; … … 81 97 double SIGMA; 82 98 double SIGMA_LIM; 99 double IMAG_MIN; 100 double IMAG_MAX; 101 double INST_BRIGHT; 102 double ZERO_POINT; 83 103 84 104 char StoneRegions[256]; … … 95 115 int VERBOSE; 96 116 int NO_CHIPS; 117 int SAVE_RESID; 97 118 98 119 char GSCFILE[256]; … … 116 137 StarData *gcatalog (char *filename, int *Nstars); 117 138 StarData *gptolemy (char *filename, int *NSTARS); 118 double GetScatter ( );139 double GetScatter (int *Nscatter, double *DL, double *DM, int bright); 119 140 int find_dec_bands (CatStats *area); 120 141 int load_ra_blocks (int Ndec, CatStats *area); … … 178 199 void wstars (char *filename, Stars *stars, int Nstars, Header *header); 179 200 int ConvertStars (Stars *data, int size, int nitems); 201 int rfits (Chip *mychip); 202 int rtext (Chip *mychip); 203 void wfits (char *filename, Stars *stars, int Nstars, Header *header); 204 int ConvertMatch (MatchData *data, int size, int nitems); -
trunk/Ohana/src/mosastro/src/ConfigInit.c
r3323 r3466 41 41 GetConfig (config, "RADIUS", "%lf", 0, &RADIUS); 42 42 GetConfig (config, "SIGMA_LIM", "%lf", 0, &SIGMA_LIM); 43 ScanConfig (config, "ZERO_PT", "%lf", 0, &ZERO_POINT); 43 44 45 ScanConfig (config, "INST_MAG_MIN", "%lf", 0, &IMAG_MIN); 46 ScanConfig (config, "INST_MAG_MAX", "%lf", 0, &IMAG_MAX); 47 ScanConfig (config, "INST_BRIGHT", "%lf", 0, &INST_BRIGHT); 48 44 49 free (config); 45 50 free (file); -
trunk/Ohana/src/mosastro/src/ConvertStars.c
r3416 r3466 25 25 26 26 # define STARS_SIZE 44 27 # define MATCH_SIZE 104 27 28 28 29 int ConvertStars (Stars *data, int size, int nitems) { … … 57 58 # endif 58 59 } 60 61 int ConvertMatch (MatchData *data, int size, int nitems) { 62 63 int i; 64 unsigned char *byte, tmp; 65 66 # ifdef BYTE_SWAP 67 68 if (size != MATCH_SIZE) { 69 fprintf (stderr, "mismatch in type sizes (MatchData) %d vs %d\n", size, MATCH_SIZE); 70 return (FALSE); 71 } 72 73 byte = (char *) data; 74 for (i = 0; i < nitems; i++, byte += size) { 75 SWAP_DBLE (0); /* R */ 76 SWAP_DBLE (8); /* D */ 77 SWAP_WORD (16); /* P */ 78 SWAP_WORD (20); /* Q */ 79 SWAP_WORD (24); /* L */ 80 SWAP_WORD (28); /* M */ 81 SWAP_WORD (32); /* X */ 82 SWAP_WORD (36); /* Y */ 83 84 SWAP_DBLE (40); /* R */ 85 SWAP_DBLE (40); /* D */ 86 SWAP_WORD (56); /* P */ 87 SWAP_WORD (60); /* Q */ 88 SWAP_WORD (64); /* L */ 89 SWAP_WORD (68); /* M */ 90 SWAP_WORD (72); /* X */ 91 SWAP_WORD (76); /* Y */ 92 93 SWAP_WORD (80); /* Mcat */ 94 SWAP_WORD (84); /* dMcat */ 95 SWAP_WORD (88); /* Minst */ 96 SWAP_WORD (92); /* dMinst */ 97 } 98 return (TRUE); 99 100 # else 101 return (TRUE); 102 # endif 103 } -
trunk/Ohana/src/mosastro/src/GetScatter.c
r3401 r3466 2 2 3 3 /* measure scatter on the focal plane */ 4 double GetScatter (int *Nscatter ) {4 double GetScatter (int *Nscatter, double *DL, double *DM, int bright) { 5 5 6 6 int i, j, Ntotal; 7 double dL, dM, d R2, dR;7 double dL, dM, dL2, dM2, dl, dm, dR; 8 8 StarData *raw, *ref; 9 9 10 Ntotal = dR2 =0.0;11 10 Ntotal = 0.0; 11 dL = dL2 = dM = dM2 = 0; 12 12 for (i = 0; i < Nchip; i++) { 13 13 raw = chip[i].raw; … … 15 15 for (j = 0; j < chip[i].Nmatch; j++) { 16 16 if (raw[j].mask) continue; 17 dL = raw[j].L - ref[j].L; 18 dM = raw[j].M - ref[j].M; 19 dR2 += dL*dL + dM*dM; 17 if (bright && (raw[j].Mag > INST_BRIGHT)) continue; 18 dl = raw[j].L - ref[j].L; 19 dm = raw[j].M - ref[j].M; 20 dL += dl; 21 dL2 += SQ(dl); 22 dM += dm; 23 dM2 += SQ(dm); 20 24 Ntotal ++; 21 25 } 22 26 } 23 dR = sqrt (dR2 / Ntotal) * 3600.0 * field.project.cdelt1; 27 dL = sqrt (fabs(dL2 / Ntotal - (dL*dL) / (Ntotal*Ntotal))); 28 dM = sqrt (fabs(dM2 / Ntotal - (dM*dM) / (Ntotal*Ntotal))); 29 dR = hypot(dL, dM) * 3600.0 * field.project.cdelt1; 24 30 *Nscatter = Ntotal; 31 *DL = dL; 32 *DM = dM; 25 33 return (dR); 26 34 } 35 36 /* sigma is returned in arcsec, dL, dM are in pixels */ 37 /* return dL and dM independently as well */ -
trunk/Ohana/src/mosastro/src/LoadStars.c
r3416 r3466 3 3 int LoadStars (int Nfile, char **file) { 4 4 5 int i, j, itmp, Nbytes, nbytes, status, extend; 6 FILE *f; 5 int i, itmp, status, extend; 7 6 time_t tsval; 8 7 struct tm *tmval; -
trunk/Ohana/src/mosastro/src/args.c
r3401 r3466 31 31 } 32 32 33 SAVE_RESID = FALSE; 34 if ((N = get_argument (*argc, argv, "-save-residuals"))) { 35 remove_argument (N, argc, argv); 36 SAVE_RESID = TRUE; 37 } 38 33 39 CHIPS = (char *) NULL; 34 40 if ((N = get_argument (*argc, argv, "-chips"))) { -
trunk/Ohana/src/mosastro/src/clip.c
r3416 r3466 4 4 5 5 int i, j, Nscatter, Nmask, Nkeep; 6 double dL, dM, dV;6 double DL, DM, dL, dM; 7 7 double sigma; 8 8 StarData *raw, *ref; 9 9 10 10 Nmask = Nkeep = 0; 11 sigma = GetScatter (&Nscatter ) / (3600.0 * field.project.cdelt1);11 sigma = GetScatter (&Nscatter, &DL, &DM, FALSE); 12 12 13 13 for (i = 0; i < Nchip; i++) { … … 17 17 dL = raw[j].L - ref[j].L; 18 18 dM = raw[j].M - ref[j].M; 19 dV = hypot(dL, dM); 20 if (dV > Nsigma*sigma) { 19 if ((fabs(dL) > Nsigma*DL) || (fabs(dM) > Nsigma*DM)) { 21 20 raw[j].mask = TRUE; 22 21 Nmask ++; … … 32 31 } 33 32 33 /* 34 sigma = sigma / (3600.0 * field.project.cdelt1); 35 */ -
trunk/Ohana/src/mosastro/src/match.c
r3401 r3466 6 6 int i, j, k, K, Ntotal; 7 7 int Nmatch, NMATCH; 8 double dp, dq, radius, Radius ;8 double dp, dq, radius, Radius, exptime; 9 9 double *p, *q, *P, *Q; 10 10 int *U, *u; … … 45 45 /* find star matches in the tangent plane coord system */ 46 46 for (j = k = 0; (j < chip[i].Nstars) && (k < Nrefcat); ) { 47 48 /** instrumental magnitude limits for raw data **/ 49 if (IMAG_MIN && (chip[i].stars[u[j]].Mag - ZERO_POINT < IMAG_MIN)) { 50 j++; 51 continue; 52 } 53 if (IMAG_MAX && (chip[i].stars[u[j]].Mag - ZERO_POINT > IMAG_MAX)) { 54 j++; 55 continue; 56 } 47 57 /* skip anything with dMag too large */ 48 58 if (SIGMA_LIM > 0.0) { … … 70 80 radius = hypot (dp, dq); 71 81 if (radius < Radius) { 82 chip[i].ref[Nmatch] = refcat[U[k]]; 72 83 chip[i].raw[Nmatch] = chip[i].stars[u[j]]; 73 chip[i].r ef[Nmatch] = refcat[U[k]];84 chip[i].raw[Nmatch].Mag -= ZERO_POINT; /* raw in instrumental mags */ 74 85 Nmatch ++; 75 86 if (Nmatch == NMATCH) { -
trunk/Ohana/src/mosastro/src/mkmosaic.c
r3401 r3466 4 4 5 5 int Nastro; 6 double Xmin, Xmax, Ymin, Ymax, tmp, Cerror, Cprecise; 6 double Xmin, Xmax, Ymin, Ymax, tmp; 7 double DL, DM, Cerror, Cprecise; 7 8 Header *header; 8 9 char line[80]; … … 16 17 header[0].bitpix = -32; 17 18 header[0].unsign = FALSE; 19 header[0].extend = FALSE; 18 20 header[0].bscale = 1.0; 19 21 header[0].bzero = 0.0; … … 25 27 26 28 /* calculate image-wide astrometry scatter */ 27 Cerror = GetScatter (&Nastro );29 Cerror = GetScatter (&Nastro, &DL, &DM, FALSE); 28 30 Cprecise = Cerror / sqrt (Nastro); 29 31 fits_modify (header, "CERROR", "%lf", 1, Cerror); 32 fits_modify (header, "CERR_L", "%lf", 1, DL*3600.0 * field.project.cdelt1); 33 fits_modify (header, "CERR_M", "%lf", 1, DM*3600.0 * field.project.cdelt1); 34 30 35 fits_modify (header, "CPRECISE", "%lf", 1, Cprecise); 31 fits_modify (header, "NSTARS", "%d", 1, 1); /*** modify addstar to allow NSTARS = 0 ***/ 32 fits_modify (header, "NASTRO", "%d", 1, Nastro); 36 fits_modify (header, "NSTARS", "%d", 1, 0); /*** modify addstar to allow NSTARS = 0 ***/ 37 fits_modify (header, "NASTRO", "%d", 1, Nastro); 38 39 GetScatter (&Nastro, &DL, &DM, TRUE); 40 fits_modify (header, "CERR_LB", "%lf", 1, DL*3600.0 * field.project.cdelt1); 41 fits_modify (header, "CERR_MB", "%lf", 1, DM*3600.0 * field.project.cdelt1); 42 fits_modify (header, "NBRIGHT", "%d", 1, Nastro); 43 44 fprintf (stderr, "bright: %f %f %d\n", DL*3600.0 * field.project.cdelt1, DM*3600.0 * field.project.cdelt1, Nastro); 33 45 34 46 /* make a better selection for the mosaic photcode? */ -
trunk/Ohana/src/mosastro/src/mosastro.c
r3416 r3466 5 5 6 6 int Nrefcat, Nastro; 7 double Cerror; 7 double Cerror, DL, DM; 8 double Scale; 8 9 glob_t pglob; 9 10 StarData *refcat; … … 29 30 init_field (); /** needs results from field stats **/ 30 31 init_chips (); /** needs results from init_field **/ 32 Scale = 3600.0 * field.project.cdelt1; 31 33 32 34 /* use field model to get TP & FP coords */ … … 41 43 deproject_raw (); 42 44 project_ref (); 43 Cerror = GetScatter (&Nastro );44 fprintf (stderr, "scatter (raw) : %f for %d stars\n", Cerror, Nastro);45 Cerror = GetScatter (&Nastro, &DL, &DM, TRUE); 46 fprintf (stderr, "scatter (raw) : %6.4f for %d stars (%6.4f, %6.4f)\n", Cerror, Nastro, DL*Scale, DM*Scale); 45 47 if ((DUMP != NULL) && !strcmp (DUMP, "rawmatch")) dump_match(); 46 48 47 49 grad = GetGradients (); 48 50 FitGradients (grad); 49 Cerror = GetScatter (&Nastro );50 fprintf (stderr, "scatter (grad) : % f for %d stars\n", Cerror, Nastro);51 Cerror = GetScatter (&Nastro, &DL, &DM, TRUE); 52 fprintf (stderr, "scatter (grad) : %6.4f for %d stars (%6.4f, %6.4f)\n", Cerror, Nastro, DL*Scale, DM*Scale); 51 53 if ((DUMP != NULL) && !strcmp (DUMP, "fitgrads")) dump_match(); 54 Scale = 3600.0 * field.project.cdelt1; 52 55 53 56 FitChips (ChipOrder); 54 Cerror = GetScatter (&Nastro );55 fprintf (stderr, "scatter (chip) : % f for %d stars\n", Cerror, Nastro);57 Cerror = GetScatter (&Nastro, &DL, &DM, TRUE); 58 fprintf (stderr, "scatter (chip) : %6.4f for %d stars (%6.4f, %6.4f)\n", Cerror, Nastro, DL*Scale, DM*Scale); 56 59 if ((DUMP != NULL) && !strcmp (DUMP, "fitchips_unclip")) dump_match(); 57 60 58 ClipOnFP (2. 0);59 Cerror = GetScatter (&Nastro );60 fprintf (stderr, "scatter (clip) : % f for %d stars\n", Cerror, Nastro);61 ClipOnFP (2.5); 62 Cerror = GetScatter (&Nastro, &DL, &DM, TRUE); 63 fprintf (stderr, "scatter (clip) : %6.4f for %d stars (%6.4f, %6.4f)\n", Cerror, Nastro, DL*Scale, DM*Scale); 61 64 62 65 FitChips (ChipOrder); 63 Cerror = GetScatter (&Nastro );64 fprintf (stderr, "scatter (chip) : % f for %d stars\n", Cerror, Nastro);66 Cerror = GetScatter (&Nastro, &DL, &DM, TRUE); 67 fprintf (stderr, "scatter (chip) : %6.4f for %d stars (%6.4f, %6.4f)\n", Cerror, Nastro, DL*Scale, DM*Scale); 65 68 66 ClipOnFP (2. 0);67 Cerror = GetScatter (&Nastro );68 fprintf (stderr, "scatter (clip) : % f for %d stars\n", Cerror, Nastro);69 ClipOnFP (2.5); 70 Cerror = GetScatter (&Nastro, &DL, &DM, TRUE); 71 fprintf (stderr, "scatter (clip) : %6.4f for %d stars (%6.4f, %6.4f)\n", Cerror, Nastro, DL*Scale, DM*Scale); 69 72 70 73 FitChips (ChipOrder); 71 Cerror = GetScatter (&Nastro );72 fprintf (stderr, "scatter (chip) : % f for %d stars\n", Cerror, Nastro);74 Cerror = GetScatter (&Nastro, &DL, &DM, TRUE); 75 fprintf (stderr, "scatter (chip) : %6.4f for %d stars (%6.4f, %6.4f)\n", Cerror, Nastro, DL*Scale, DM*Scale); 73 76 74 ClipOnFP (2. 0);75 Cerror = GetScatter (&Nastro );76 fprintf (stderr, "scatter (clip) : % f for %d stars\n", Cerror, Nastro);77 ClipOnFP (2.5); 78 Cerror = GetScatter (&Nastro, &DL, &DM, TRUE); 79 fprintf (stderr, "scatter (clip) : %6.4f for %d stars (%6.4f, %6.4f)\n", Cerror, Nastro, DL*Scale, DM*Scale); 77 80 78 81 FitChips (ChipOrder); 79 Cerror = GetScatter (&Nastro); 80 fprintf (stderr, "scatter (chip) : %f for %d stars\n", Cerror, Nastro); 82 Cerror = GetScatter (&Nastro, &DL, &DM, FALSE); 83 fprintf (stderr, "scatter (brit) : %6.4f for %d stars (%6.4f, %6.4f)\n", Cerror, Nastro, DL*Scale, DM*Scale); 84 Cerror = GetScatter (&Nastro, &DL, &DM, TRUE); 85 fprintf (stderr, "scatter (chip) : %6.4f for %d stars (%6.4f, %6.4f)\n", Cerror, Nastro, DL*Scale, DM*Scale); 81 86 if ((DUMP != NULL) && !strcmp (DUMP, "fitchips")) dump_match(); 82 87 -
trunk/Ohana/src/mosastro/src/output.c
r3416 r3466 36 36 37 37 header = mkmosaic (1, 1, 0, &field.project); 38 if (SAVE_RESID) { 39 SaveResiduals (f, header); 40 return; 41 } 42 38 43 fwrite (header[0].buffer, 1, header[0].size, f); 39 44 fclose (f); -
trunk/Ohana/src/mosastro/src/rfits.c
r3416 r3466 7 7 FTable table; 8 8 Stars *stars; 9 StarData *stardata;10 9 11 10 /* open file for stars */ -
trunk/Ohana/src/mosastro/src/wfits.c
r3416 r3466 3 3 void wfits (char *filename, Stars *stars, int Nstars, Header *header) { 4 4 5 int i;6 5 Matrix matrix; 7 6 Header theader; … … 48 47 return; 49 48 } 49 -
trunk/Ohana/src/nightd/include/nightd.h
r2494 r3466 1 1 # include <ohana.h> 2 # include <loneos.h>3 2 # include <signal.h> 4 3 # include <errno.h> … … 40 39 int vsystem (char *line); 41 40 char *ExpandWords (char *line); 41 int pcommand (char *line, int timeout); 42 int WaitForPeriod (); 43 int DoCommand (char *command, char *name); 44 int freeargs (char **arglist); 42 45 43 46 int PERIOD; -
trunk/Ohana/src/nightd/src/ConfigInit.c
r2494 r3466 17 17 sprintf (file, "%s/.%src", home, Program); 18 18 LoadConfig (SIGKILL); 19 19 return (TRUE); 20 20 } 21 21 22 22 void LoadConfig (int sig) { 23 23 24 int i, Ncmd , found;25 char *config ;24 int i, Ncmd; 25 char *config, *found; 26 26 char line[256]; 27 27 double tmp; … … 43 43 44 44 /* load list of InitCommands */ 45 found = TRUE;45 found = config; 46 46 Ncmd = 10; 47 47 ALLOCATE (InitCommand, char *, Ncmd); 48 for (i = 0; found ; i++) {48 for (i = 0; found != NULL; i++) { 49 49 ALLOCATE (InitCommand[i], char, 256); 50 50 bzero (InitCommand[i], 256); … … 57 57 58 58 /* load list of MainCommands */ 59 found = TRUE;59 found = config; 60 60 Ncmd = 10; 61 61 ALLOCATE (MainCommand, char *, Ncmd); 62 for (i = 0; found ; i++) {62 for (i = 0; found != NULL; i++) { 63 63 ALLOCATE (MainCommand[i], char, 256); 64 64 bzero (MainCommand[i], 256); … … 71 71 72 72 /* load list of DoneCommands */ 73 found = TRUE;73 found = config; 74 74 Ncmd = 10; 75 75 ALLOCATE (DoneCommand, char *, Ncmd); 76 for (i = 0; found ; i++) {76 for (i = 0; found != NULL; i++) { 77 77 ALLOCATE (DoneCommand[i], char, 256); 78 78 bzero (DoneCommand[i], 256); -
trunk/Ohana/src/nightd/src/DoCommand.c
r2494 r3466 9 9 int DoCommand (char *command, char *name) { 10 10 11 int status;12 11 char *line; 13 12 … … 19 18 } 20 19 free (line); 20 return (TRUE); 21 21 } -
trunk/Ohana/src/nightd/src/SetSignals.c
r2494 r3466 6 6 signal (SIGUSR1, LoadConfig); 7 7 signal (SIGUSR2, ToggleSuspend); 8 8 return (TRUE); 9 9 } 10 10 -
trunk/Ohana/src/nightd/src/StartUp.c
r2494 r3466 4 4 5 5 int i; 6 int night, NightTime , status;7 char user[256], machine[256] , filename[256];6 int night, NightTime; 7 char user[256], machine[256]; 8 8 float time; 9 9 pid_t pid; 10 struct stat filestat;11 10 12 11 if (!SetPID (&pid, user, machine)) { -
trunk/Ohana/src/nightd/src/misc.c
r2494 r3466 136 136 int WaitForPeriod () { 137 137 138 int Nsec , tsec;138 int Nsec; 139 139 struct timeval now; 140 struct tm *local;141 140 142 141 gettimeofday (&now, (struct timezone *) NULL); 143 142 Nsec = PERIOD - (now.tv_sec % PERIOD); 144 143 sleep (Nsec); 144 return (TRUE); 145 145 } 146 146 … … 151 151 pid_t pid; 152 152 char buffer[0x4000]; 153 char * file, **arglist;153 char **arglist; 154 154 155 155 /* create pipes for communications */ … … 235 235 char **getargs (char *input) { 236 236 237 int i;238 237 char **args, *line, *p, *e; 239 238 int Nargs, N, Nchar; … … 281 280 } 282 281 free (arglist); 283 282 return (TRUE); 284 283 } 285 284 -
trunk/Ohana/src/nightd/src/nightd.c
r2494 r3466 1 1 # include "nightd.h" 2 2 3 main (int argc, char **argv) {3 int main (int argc, char **argv) { 4 4 5 5 Program = filebasename (argv[0]); -
trunk/Ohana/src/photdbc/include/photdbc.h
r2494 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 # include <signal.h> 4 4 -
trunk/Ohana/src/relphot/include/relphot.h
r2486 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 /* # define GRID_V1 */ -
trunk/Ohana/src/uniphot/include/uniphot.h
r2492 r3466 1 1 # include <ohana.h> 2 # include < loneos.h>2 # include <dvo.h> 3 3 4 4 typedef struct {
Note:
See TracChangeset
for help on using the changeset viewer.
