Changeset 5328
- Timestamp:
- Oct 14, 2005, 6:29:26 AM (21 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 22 edited
-
Makefile (modified) (5 diffs)
-
doc/notes.txt (modified) (1 diff)
-
include/2mass.h (modified) (1 diff)
-
include/addstar.h (modified) (4 diffs)
-
src/addstar.c (modified) (3 diffs)
-
src/addstarc.c (modified) (1 diff)
-
src/airmass.c (modified) (2 diffs)
-
src/args.c (modified) (4 diffs)
-
src/args_client.c (modified) (2 diffs)
-
src/calibrate.c (modified) (5 diffs)
-
src/find_matches.c (modified) (4 diffs)
-
src/find_matches_closest.c (modified) (4 diffs)
-
src/get2mass.c (modified) (3 diffs)
-
src/get2mass_as.c (modified) (2 diffs)
-
src/get2mass_dr2.c (modified) (4 diffs)
-
src/getusno.c (modified) (3 diffs)
-
src/gimages.c (modified) (3 diffs)
-
src/greference.c (modified) (3 diffs)
-
src/grefstars.c (modified) (4 diffs)
-
src/gregion_image.c (modified) (2 diffs)
-
src/gstars.c (modified) (4 diffs)
-
src/replace_match.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/Makefile
r5289 r5328 9 9 INC = $(HOME)/include 10 10 SRC = $(HOME)/src 11 DEF = $(HOME)/def12 DFS = $(HOME)/dfs13 11 MAN = $(HOME)/doc 14 12 DESTBIN = $(LBIN) … … 60 58 $(SRC)/RegionOps.$(ARCH).o \ 61 59 $(SRC)/replace_match.$(ARCH).o \ 62 $(SRC)/save_pt_catalog.$(ARCH).o \63 60 $(SRC)/SetSignals.$(ARCH).o \ 64 61 $(SRC)/sort_lists.$(ARCH).o \ … … 107 104 default: $(PROGRAM) 108 105 109 COMMOBJ = \110 $(DFS)/AddstarClientOptions.$(ARCH).o \111 $(DFS)/Stars.$(ARCH).o112 113 COMMINC = \114 $(DFS)/AddstarClientOptions.h \115 $(DFS)/Stars.h116 117 autocode: $(COMMOBJ)118 119 106 ADDSTARC = $(SRC)/addstarc.$(ARCH).o $(CLIENT) 120 107 ADDSTARD = $(SRC)/addstard.$(ARCH).o $(SERVER) … … 152 139 $(CC) $^ -o $@ $(LFLAGS) 153 140 154 $(INC)/commcode.h: $(COMMINC)155 cat $(DEF)/common.h > $(INC)/commcode.h156 cat $(COMMINC) >> $(INC)/commcode.h157 @echo "# endif" >> $(INC)/commcode.h158 @echo done with commcode.h159 160 $(DFS)/%.c: $(DEF)/%.d $(DEF)/commcode.c $(INC)/commcode.h161 @if [ ! -d $(DFS) ]; then mkdir -p $(DFS); fi162 generate $< $(DEF)/commcode.c $@163 164 $(DFS)/%.h: $(DEF)/%.d $(DEF)/commcode.h165 @if [ ! -d $(DFS) ]; then mkdir -p $(DFS); fi166 generate $< $(DEF)/commcode.h $@167 168 141 $(DESTBIN)/%: $(BIN)/%.$(ARCH) 169 142 @if [ ! -d $(DESTBIN) ]; then mkdir -p $(DESTBIN); fi … … 189 162 rm -f `find . -name "*~"` 190 163 rm -f `find . -name "#*"` 191 rm -f $(DFS)/*.h192 rm -f $(DFS)/*.c193 rm -f $(INC)/commcode.h -
trunk/Ohana/src/addstar/doc/notes.txt
r5293 r5328 1 2 todo goals: 3 4 o move addstar/gstars to AddstarClientOptions 5 o add thiscode to AddstarClientOptions 6 o address MOSAIC somehow 7 o replace skyprobe mode 8 - address the cat & ref modes in client/server 9 10 * add airmass quality to options 11 * deal with Myyyy as sky value 12 * better way to interpret flips header info for sky? 13 * fix unlink empty file problem 14 * programs like relphot and dvo need to be provided 15 with sorted measure tables; add this as a feature 16 of the load_catalog API? 17 18 2005.10.13 19 20 I am working to minimize usage of globals and cleanup addstar 21 functions to make them more appropriate for the client / server 22 model. 23 24 I have dropped save_pt_catalog, and modified load_pt_catalog, as 25 well as the load_catalog functions. Now, the choice of elements to 26 load is made by setting flags in the catalog structure itself 27 (catalog.catflags). Thus this information is carried around by the 28 catalog variable. the load_pt_catalog function now only returns 29 true. it is now necessary to check the state of the disk file by 30 examining Nave_disk to decide if the file is empty or not. This is 31 perhaps too limiting: it prevents us from using only one of the 32 catalog tables (say measure without average). The concern I have is 33 to manage the process of cleaning up the catalogs if no data is 34 added to them: I don't want addstar to leave behind empty files 35 (plus, I think this breaks the lock/load state logic). Thus, 36 whenever addstar unlocks / closes a file, if the Nave_disk + 37 Naverage is 0, the file should be unlinked. 1 38 2 39 2005.10.12 -
trunk/Ohana/src/addstar/include/2mass.h
r4299 r5328 10 10 11 11 GSCRegion *get2mass_acc (GSCRegion *patch, int *nfiles, char *path, char *accel); 12 Stars *get2mass_2DR_data (GSCRegion *region, GSCRegion *patch, int *nstars);13 Stars *get2mass_AS_data (GSCRegion *region, GSCRegion *patch, int *nstars);12 Stars *get2mass_2DR_data (GSCRegion *region, GSCRegion *patch, int photcode, int *nstars); 13 Stars *get2mass_AS_data (GSCRegion *region, GSCRegion *patch, int phocode, int *nstars); -
trunk/Ohana/src/addstar/include/addstar.h
r5322 r5328 52 52 53 53 /* these globals modify the behavior of gstars (KEEP) */ 54 double SNLIMIT; 55 int ACCEPT_ASTROM; // accept even bad astrometry solutions (NASTRO == 0) 56 int TEXTMODE; // force input file to be loaded as RAW 57 char *DUMP; // dump out intermediate results 58 int XOVERSCAN; // used to modify stored image dimensions 59 int YOVERSCAN; // used to modify stored image dimensions 60 int XMIN; // used to filter loaded star list 61 int XMAX; // used to filter loaded star list 62 int YMIN; // used to filter loaded star list 63 int YMAX; // used to filter loaded star list 64 double Latitude; // carried into image structure from config 54 double SNLIMIT; 55 int ACCEPT_ASTROM; // accept even bad astrometry solutions (NASTRO == 0) 56 int TEXTMODE; // force input file to be loaded as RAW 57 int SUBPIX; // apply a subpix correction 58 char *DUMP; // dump out intermediate results 59 int XOVERSCAN; // used to modify stored image dimensions 60 int YOVERSCAN; // used to modify stored image dimensions 61 int XMIN; // used to filter loaded star list 62 int XMAX; // used to filter loaded star list 63 int YMIN; // used to filter loaded star list 64 int YMAX; // used to filter loaded star list 65 double Latitude; // carried into image structure from config 66 Coords *MOSAIC; // carries the mosaic into gstars 65 67 66 68 /* these globals are used separately by both client and server (KEEP) */ … … 68 70 int VERBOSE; 69 71 70 /* add to options as an int / keep the global? */71 PhotCode *thiscode;72 73 /* how to carry this around? */74 Coords *MOSAIC;75 76 /* globals set by command-line options (AddstarClientOptions) */77 /* move into AddstarClientOptions completely */78 # if (0)79 int MODE;80 int EXISTING_REGIONS;81 int ONLY_MATCH;82 int SKIP_MISSED;83 int REPLACE;84 int CLOSEST;85 int NOSORT;86 int UPDATE;87 int ONLY_IMAGES;88 int CALIBRATE;89 double DEFAULT_RADIUS; // XXX add to AddstarClientOptions90 double NSIGMA; // XXX add to AddstarClientOptions91 # endif92 93 72 /* modify server behavoir (make this an addstar cleanup mode?) */ 94 73 int FORCE_READ; 95 74 96 int SKYPROBE;97 75 // XXX this should be replaced with 98 76 // 1) an airmass accuracy option … … 126 104 int dump_rawstars PROTO((Stars *stars, int Nstars)); 127 105 int edge_check PROTO((double *x1, double *y1, double *x2, double *y2)); 128 void find_matches PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options));129 void find_matches_closest PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options));106 void find_matches PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options)); 107 void find_matches_closest PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options)); 130 108 void find_matches_refstars PROTO((GSCRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options)); 131 109 Stars **find_subset PROTO((GSCRegion *region, Stars *stars, int Nstars, int *NSTARS)); 132 110 int gcatalog PROTO((Catalog *catalog)); 133 Stars *get2mass PROTO((GSCRegion *patch, int *NSTARS, int mode));111 Stars *get2mass PROTO((GSCRegion *patch, int photcode, int mode, int *NSTARS)); 134 112 double get_subpix PROTO((double x, double y)); 135 113 Stars *getgsc PROTO((GSCRegion *patch, int *NSTARS)); 136 Stars *getusno PROTO((GSCRegion *catstats, int *Nstars));137 Image *gimages PROTO((FITS_DB *db, Image *image, int *Npimage));138 Stars *grefcat PROTO((char *Refcat, GSCRegion *catstats, int *nstars));139 Stars *grefstars PROTO((char *file, int *Nstars));140 GSCRegion *gregion_image PROTO((Image *image, int *Nregions));114 Stars *getusno PROTO((GSCRegion *catstats, int photcode, int *Nstars)); 115 Image *gimages PROTO((FITS_DB *db, Image *image, Coords *mosaic, int *Npimage)); 116 Stars *grefcat PROTO((char *Refcat, GSCRegion *catstats, int photcode, int *nstars)); 117 Stars *grefstars PROTO((char *file, int photcode, int *Nstars)); 118 GSCRegion *gregion_image PROTO((Image *image, Coords *mosaic, int *Nregions)); 141 119 GSCRegion *gregion_match PROTO((GSCRegion *regions, int *nregions)); 142 120 GSCRegion *gregion_patch PROTO((GSCRegion *patch, int *nregions)); … … 144 122 GSCRegion *gregion_stars PROTO((Stars *stars, int Nstars, int *Nregion)); 145 123 GSCRegion *gregions PROTO((Image *image, int *Nregions)); 146 Stars *gstars PROTO((char *file, int *NSTARS, Image *image));124 Stars *gstars PROTO((char *file, int *NSTARS, int photcode, Image *image)); 147 125 void help PROTO(()); 148 126 int in_image PROTO((double r, double d, Image *image)); -
trunk/Ohana/src/addstar/src/addstar.c
r5322 r5328 31 31 } 32 32 33 if (SKYPROBE) load_subpix ();34 35 33 /* we use the image table to lock db access -- perhaps this is not necessary?*/ 36 34 lock_image_db (&db, ImageCat); … … 41 39 switch (options.mode) { 42 40 case M_IMAGE: 43 stars = gstars (argv[1], &Nstars, &image);41 stars = gstars (argv[1], &Nstars, options.photcode, &image); 44 42 if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars); 45 regions = gregion_image (&image, &Nregions);43 regions = gregion_image (&image, MOSAIC, &Nregions); 46 44 /* lock_image_db (&db, ImageCat); */ 47 overlap = gimages (&db, &image, &Noverlap);45 overlap = gimages (&db, &image, MOSAIC, &Noverlap); 48 46 /* unlock_image_db (&db); */ 49 47 break; 50 48 case M_REFLIST: 51 stars = grefstars (argv[1], &Nstars);49 stars = grefstars (argv[1], options.photcode, &Nstars); 52 50 regions = gregion_stars (stars, Nstars, &Nregions); 53 51 break; … … 95 93 Nsubset = Nstars; 96 94 if (options.closest) { 97 find_matches_closest (®ions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, options);95 find_matches_closest (®ions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options); 98 96 } else { 99 find_matches (®ions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, options);97 find_matches (®ions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options); 100 98 } 101 99 break; 102 100 case M_REFCAT: 103 stars = grefcat (argv[1], ®ions[i], &Nstars);101 stars = grefcat (argv[1], ®ions[i], options.photcode, &Nstars); 104 102 case M_REFLIST: 105 103 subset = find_subset (®ions[i], stars, Nstars, &Nsubset); -
trunk/Ohana/src/addstar/src/addstarc.c
r5322 r5328 14 14 15 15 /* load data */ 16 stars = gstars (argv[1], &Nstars, &image);16 stars = gstars (argv[1], &Nstars, MOSAIC, &image); 17 17 18 18 /* set up server connection */ -
trunk/Ohana/src/addstar/src/airmass.c
r5014 r5328 1 1 # include "addstar.h" 2 3 static AirmassQuality = FALSE; 4 5 void SetAirmassQuality (int quality) { 6 AirmassQuality = quality; 7 } 2 8 3 9 float airmass (float secz_image, double ra, double dec, double st, double latitude) { … … 5 11 double hour, cosz, secz; 6 12 7 if (! SKYPROBE) return (secz_image);13 if (!AirmassQuality) return (secz_image); 8 14 9 15 /*** make this optional? we may not have ST... ***/ -
trunk/Ohana/src/addstar/src/args.c
r5322 r5328 5 5 6 6 int N; 7 int QUALITY_AIRMASS; 7 8 8 9 /* check for help request */ … … 43 44 } 44 45 /* override any header PHOTCODE values */ 45 thiscode = NULL;46 46 options.photcode = 0; 47 47 if ((N = get_argument (argc, argv, "-p"))) { 48 48 remove_argument (N, &argc, argv); 49 49 options.photcode = GetPhotcodeCodebyName (argv[N]); 50 thiscode = GetPhotcodebyName (argv[N]);51 50 remove_argument (N, &argc, argv); 52 51 } … … 148 147 149 148 /*** optional situations ***/ 150 /* treat data specially for skyprobe (calibration, subpix) */ 151 SKYPROBE = FALSE; 149 /* choose high quality airmass vs low quality airmass (per-star vs per-image) */ 150 QUALITY_AIRMASS = FALSE; 151 if ((N = get_argument (argc, argv, "-quality-airmass"))) { 152 remove_argument (N, &argc, argv); 153 QUALITY_AIRMASS = TRUE; 154 } 155 /* choose high quality airmass vs low quality airmass (per-star vs per-image) */ 156 SUBPIX = FALSE; 157 if ((N = get_argument (argc, argv, "-subpix"))) { 158 remove_argument (N, &argc, argv); 159 SUBPIX = TRUE; 160 } 161 /* skyprobe means: subpix correction and quality airmass */ 152 162 if ((N = get_argument (argc, argv, "-skyprobe"))) { 153 SKYPROBE = TRUE;154 remove_argument (N, &argc, argv);155 /* XXX EAM : define airmass calculation method?156 set calibrate to true157 perhaps a 'skyprobe' data format (for image.sky issue) 158 */159 } 163 remove_argument (N, &argc, argv); 164 QUALITY_AIRMASS = TRUE; 165 SUBPIX = TRUE; 166 } 167 SetAirmassQuality (QUALITY_AIRMASS); 168 if (SUBPIX) load_subpix (); 169 160 170 /* define 2MASS quality flags to keep */ 161 171 SELECT_2MASS_QUALITY = NULL; … … 196 206 } 197 207 208 if ((options.mode == M_REFLIST) && (options.photcode == 0)) { 209 fprintf (stderr, "photcode must be specified for -ref\n"); 210 exit (2); 211 } 198 212 199 213 if (argc != 2) { -
trunk/Ohana/src/addstar/src/args_client.c
r5322 r5328 5 5 6 6 int N; 7 int QUALITY_AIRMASS; 7 8 8 9 /* check for help request */ … … 146 147 147 148 /*** optional situations ***/ 148 /* treat input data specially for skyprobe (calibration, subpix) */ 149 SKYPROBE = FALSE; 149 /* choose high quality airmass vs low quality airmass (per-star vs per-image) */ 150 QUALITY_AIRMASS = FALSE; 151 if ((N = get_argument (argc, argv, "-quality-airmass"))) { 152 remove_argument (N, &argc, argv); 153 QUALITY_AIRMASS = TRUE; 154 } 155 /* choose high quality airmass vs low quality airmass (per-star vs per-image) */ 156 SUBPIX = FALSE; 157 if ((N = get_argument (argc, argv, "-subpix"))) { 158 remove_argument (N, &argc, argv); 159 SUBPIX = TRUE; 160 } 161 /* skyprobe means: subpix correction and quality airmass */ 150 162 if ((N = get_argument (argc, argv, "-skyprobe"))) { 151 SKYPROBE = TRUE; 152 remove_argument (N, &argc, argv); 153 } 163 remove_argument (N, &argc, argv); 164 QUALITY_AIRMASS = TRUE; 165 SUBPIX = TRUE; 166 } 167 if (SUBPIX) load_subpix (); 168 154 169 /* define 2MASS quality flags to keep */ 155 170 SELECT_2MASS_QUALITY = NULL; -
trunk/Ohana/src/addstar/src/calibrate.c
r5267 r5328 6 6 void InitCalibration () { 7 7 8 fprintf (stderr, "calibrating the image... %d\n", thiscode[0].equiv);8 fprintf (stderr, "calibrating the image...\n"); 9 9 Ncal = 0; 10 10 NCAL = 1000; … … 47 47 float CalM0, CalM1, CalM2, dCalM; 48 48 short CalC0, CalC1, CalC2; 49 PhotCode *code; 49 50 50 51 found0 = found1 = found2 = FALSE; 51 52 CalM0 = CalM1 = CalM2 = dCalM = NO_MAG; 52 53 53 CalC0 = thiscode[0].equiv; 54 CalC1 = thiscode[0].c1; 55 CalC2 = thiscode[0].c2; 54 code = GetPhotcodebyCode (new[0].source); 55 CalC0 = code[0].equiv; 56 CalC1 = code[0].c1; 57 CalC2 = code[0].c2; 56 58 57 59 m = average[0].offset; … … 85 87 float N, M1, M2, Klam, Clam, Xlam, Mabs, *Dmag, *dDmag; 86 88 float dMo, dMr, Mw, Dmed, W1, W2, NSigma; 87 89 PhotCode *code; 90 91 code = GetPhotcodebyCode (image[0].source); 92 88 93 /* reject multiple matched-stars */ 89 94 /* find maximum value of Nstar[] */ … … 109 114 ALLOCATE (dDmag, float, Ncal); 110 115 Nkeep = 0; 111 Clam = thiscode[0].C*0.001;112 Klam = thiscode[0].K;113 Xlam = thiscode[0].X[0];116 Clam = code[0].C*0.001; /* photcode.C still in millimags */ 117 Klam = code[0].K; 118 Xlam = code[0].X[0]; 114 119 for (i = 0; i < Ncal; i++) { 115 120 /* if this entry has too many (or two few?) matches, skip it */ … … 121 126 /* skip stars brighter than 8.0 */ 122 127 /* XXX EAM : perhaps make this more flexible?? */ 123 if (SKYPROBE) { 124 if (Mabs > 9.0) continue; 125 if (Mabs < 5.0) continue; 126 } 128 if (Mabs > 9.0) continue; 129 if (Mabs < 5.0) continue; 127 130 128 131 /* XXX EAM: note the artificial 0.005 dmag here */ -
trunk/Ohana/src/addstar/src/find_matches.c
r5322 r5328 1 1 # include "addstar.h" 2 2 3 void find_matches (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options) {3 void find_matches (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options) { 4 4 5 5 int i, j, n, N, J; … … 9 9 int *N1, *N2, *next_meas, *next_miss; 10 10 int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch; 11 Coords tcoords;12 11 int Nsecfilt, Nsec; 13 12 float Mcat, *Mval, MTIME; 14 13 double dtime; 15 14 struct timeval start, stop; 15 PhotCode *code; 16 Coords tcoords; 16 17 17 18 gettimeofday (&start, NULL); 19 20 code = GetPhotcodebyCode (options.photcode); 18 21 19 22 /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */ 20 23 Nsecfilt = GetPhotcodeNsecfilt (); 21 Nsec = (thiscode[0].type == PHOT_DEP) ? 22 GetPhotcodeNsec (thiscode[0].equiv) : 23 GetPhotcodeNsec (thiscode[0].code); 24 Nsec = (code[0].type == PHOT_DEP) ? GetPhotcodeNsec (code[0].equiv) : GetPhotcodeNsec (code[0].code); 24 25 /* this function requires incoming stars to have the same photcode */ 25 26 … … 46 47 /* for mosaic astrometry, the grid should be w.r.t. the tangent-plane, not chip coords */ 47 48 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 48 tcoords = MOSAIC[0];49 tcoords = mosaic[0]; 49 50 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 50 51 tcoords.pc1_1 = tcoords.pc2_2 = 1.0; … … 199 200 200 201 /* add reference for undetected catalog stars */ 201 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic ( MOSAIC);202 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (mosaic); 202 203 for (j = 0; (j < Nave) && !options.skip_missed; j++) { 203 204 n = N2[j]; -
trunk/Ohana/src/addstar/src/find_matches_closest.c
r5322 r5328 1 1 # include "addstar.h" 2 2 3 void find_matches_closest (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, AddstarClientOptions options) {3 void find_matches_closest (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options) { 4 4 5 5 int i, j, n, N, J, Jmin; … … 14 14 double dtime; 15 15 struct timeval start, stop; 16 PhotCode *code; 16 17 17 18 gettimeofday (&start, NULL); 19 20 code = GetPhotcodebyCode (options.photcode); 18 21 19 22 /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */ 20 23 Nsecfilt = GetPhotcodeNsecfilt (); 21 Nsec = (thiscode[0].type == PHOT_DEP) ? 22 GetPhotcodeNsec (thiscode[0].equiv) : 23 GetPhotcodeNsec (thiscode[0].code); 24 Nsec = (code[0].type == PHOT_DEP) ? GetPhotcodeNsec (code[0].equiv) : GetPhotcodeNsec (code[0].code); 24 25 /* this function requires incoming stars to have the same photcode */ 25 26 … … 46 47 /* for mosaic astrometry, the grid should be w.r.t. the tangent-plane, not chip coords */ 47 48 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 48 tcoords = MOSAIC[0];49 tcoords = mosaic[0]; 49 50 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 50 51 tcoords.pc1_1 = tcoords.pc2_2 = 1.0; … … 197 198 198 199 /** add reference for undetected catalog stars **/ 199 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic ( MOSAIC);200 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (mosaic); 200 201 for (j = 0; (j < Nave) && !options.skip_missed; j++) { 201 202 n = N2[j]; -
trunk/Ohana/src/addstar/src/get2mass.c
r4772 r5328 2 2 # include "2mass.h" 3 3 4 Stars *get2mass (GSCRegion *patch, int *NSTARS, int mode) {4 Stars *get2mass (GSCRegion *patch, int photcode, int mode, int *NSTARS) { 5 5 6 6 char *path; … … 13 13 NAMED_PHOTCODE (TM_H, "2MASS_H"); 14 14 NAMED_PHOTCODE (TM_K, "2MASS_K"); 15 if (thiscode == NULL) Shutdown ("photcode not specified"); 16 if (thiscode[0].code == TM_J) goto good_code; 17 if (thiscode[0].code == TM_H) goto good_code; 18 if (thiscode[0].code == TM_K) goto good_code; 15 if (photcode == TM_J) goto good_code; 16 if (photcode == TM_H) goto good_code; 17 if (photcode == TM_K) goto good_code; 19 18 Shutdown ("2MASS photcode not specified"); 20 19 … … 31 30 switch (mode) { 32 31 case 0: 33 refcat = get2mass_AS_data (®ions[i], patch, &Nrefcat);32 refcat = get2mass_AS_data (®ions[i], patch, photcode, &Nrefcat); 34 33 if (VERBOSE) fprintf (stderr, "loaded %d stars from 2MASS (allsky)\n", Nrefcat); 35 34 break; 36 35 case 1: 37 refcat = get2mass_2DR_data (®ions[i], patch, &Nrefcat);36 refcat = get2mass_2DR_data (®ions[i], patch, photcode, &Nrefcat); 38 37 if (VERBOSE) fprintf (stderr, "loaded %d stars from 2MASS (dr2)\n", Nrefcat); 39 38 break; -
trunk/Ohana/src/addstar/src/get2mass_as.c
r4772 r5328 13 13 e_time get2mass_time (char *ptr, char *buffer, int Nbound, int Nbyte); 14 14 15 Stars *get2mass_AS_data (GSCRegion *region, GSCRegion *patch, int *nstars) {15 Stars *get2mass_AS_data (GSCRegion *region, GSCRegion *patch, int photcode, int *nstars) { 16 16 17 17 int FilterSkip, TimeSkip; … … 33 33 DEC1 = MIN (patch[0].DEC[1], UserPatch.DEC[1]); 34 34 35 code = thiscode[0].code;36 35 FilterSkip = TimeSkip = 0; 37 if ( thiscode[0].code == TM_J) {36 if (photcode == TM_J) { 38 37 FilterSkip = 6; 39 38 TimeSkip = 23; 40 39 Qentry = 0; 41 40 } 42 if ( thiscode[0].code == TM_H) {41 if (photcode == TM_H) { 43 42 FilterSkip = 10; 44 43 TimeSkip = 19; 45 44 Qentry = 1; 46 45 } 47 if ( thiscode[0].code == TM_K) {46 if (photcode == TM_K) { 48 47 FilterSkip = 14; 49 48 TimeSkip = 15; 50 49 Qentry = 2; 51 50 } 52 if (!FilterSkip) Shutdown ("invalid photcode % d", thiscode[0].code);51 if (!FilterSkip) Shutdown ("invalid photcode %s", GetPhotcodeNamebyCode(photcode)); 53 52 54 53 filename = region[0].filename; -
trunk/Ohana/src/addstar/src/get2mass_dr2.c
r4299 r5328 5 5 # define NLINE 30000 6 6 7 Stars *get2mass_2DR_data (GSCRegion *region, GSCRegion *patch, int *nstars) {7 Stars *get2mass_2DR_data (GSCRegion *region, GSCRegion *patch, int photcode, int *nstars) { 8 8 9 9 int i, Nstars, NSTARS, Nbyte, Nline; … … 64 64 stars[Nstars].found = -1; 65 65 66 if ( thiscode[0].code == TM_J) {66 if (photcode == TM_J) { 67 67 dparse (&J, 1, &buffer[NBYTE*i + 53]); 68 68 dparse (&dJ, 2, &buffer[NBYTE*i + 53]); … … 71 71 stars[Nstars].code = TM_J; 72 72 } 73 if ( thiscode[0].code == TM_H) {73 if (photcode == TM_H) { 74 74 dparse (&H, 1, &buffer[NBYTE*i + 72]); 75 75 dparse (&dH, 2, &buffer[NBYTE*i + 72]); … … 78 78 stars[Nstars].code = TM_H; 79 79 } 80 if ( thiscode[0].code == TM_K) {80 if (photcode == TM_K) { 81 81 dparse (&K, 1, &buffer[NBYTE*i + 91]); 82 82 dparse (&dK, 2, &buffer[NBYTE*i + 91]); -
trunk/Ohana/src/addstar/src/getusno.c
r3376 r5328 9 9 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10}; 10 10 11 Stars *getusno (GSCRegion *catstats, int *Nstars) {11 Stars *getusno (GSCRegion *catstats, int photcode, int *Nstars) { 12 12 13 13 long int offset; … … 27 27 NAMED_PHOTCODE (USNO_RED, "USNO_RED"); 28 28 NAMED_PHOTCODE (USNO_BLUE, "USNO_BLUE"); 29 if (thiscode == NULL) Shutdown ("photcode not specified"); 30 if (thiscode[0].code == USNO_RED) goto good_code; 31 if (thiscode[0].code == USNO_BLUE) goto good_code; 29 if (photcode == USNO_RED) goto good_code; 30 if (photcode == USNO_BLUE) goto good_code; 32 31 Shutdown ("USNO photcode not specified"); 33 32 good_code: … … 130 129 131 130 /* one pass of addstar does either r or b */ 132 if ( thiscode[0].code == USNO_RED) {131 if (photcode == USNO_RED) { 133 132 stars[Nusno].code = USNO_RED; 134 133 stars[Nusno].M = fabs (0.1*(buf[2] - 1000*((int)(buf[2]/1000)))); 135 134 } 136 if ( thiscode[0].code == USNO_BLUE) {135 if (photcode == USNO_BLUE) { 137 136 stars[Nusno].code = USNO_BLUE; 138 137 stars[Nusno].M = fabs (0.1*((int)(buf[2] - 1000000*((int)(buf[2]/1000000))) / 1000)); -
trunk/Ohana/src/addstar/src/gimages.c
r4864 r5328 2 2 3 3 /* given image, find catalog images which overlap it */ 4 Image *gimages (FITS_DB *db, Image *image, int *Npimage) {4 Image *gimages (FITS_DB *db, Image *image, Coords *mosaic, int *Npimage) { 5 5 6 6 int i, j, k, addtolist; … … 37 37 /* for mosaic astrometry, the grid should be w.r.t. the tangent-plane, not chip coords */ 38 38 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 39 tcoords = MOSAIC[0];39 tcoords = mosaic[0]; 40 40 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 41 41 tcoords.pc1_1 = tcoords.pc2_2 = 1.0; … … 43 43 tcoords.Npolyterms = 1; 44 44 strcpy (tcoords.ctype, "RA---TAN"); 45 RegisterMosaic ( MOSAIC);45 RegisterMosaic (mosaic); 46 46 /* register so image->sky conversions below have correct mosaic */ 47 47 } else { -
trunk/Ohana/src/addstar/src/greference.c
r4299 r5328 1 1 # include "addstar.h" 2 # define LOAD_ALLSKY 0 3 # define LOAD_DR2 1 2 4 3 Stars *grefcat (char *Refcat, GSCRegion *catstats, int *nstars) {5 Stars *grefcat (char *Refcat, GSCRegion *catstats, int photcode, int *nstars) { 4 6 5 7 int Nstars; … … 14 16 /* get stars from USNO for the given region */ 15 17 if (!strcasecmp (Refcat, "USNO")) { 16 stars = getusno (catstats, &Nstars);18 stars = getusno (catstats, photcode, &Nstars); 17 19 } 18 20 … … 24 26 /* get stars from 2MASS for the given region */ 25 27 if (!strcasecmp (Refcat, "2MASS")) { 26 stars = get2mass (catstats, &Nstars, 0);28 stars = get2mass (catstats, photcode, LOAD_ALLSKY, &Nstars); 27 29 } 28 30 29 31 /* get stars from 2MASS for the given region */ 30 32 if (!strcasecmp (Refcat, "2MASS-ALLSKY")) { 31 stars = get2mass (catstats, &Nstars, 0);33 stars = get2mass (catstats, photcode, LOAD_ALLSKY, &Nstars); 32 34 } 33 35 34 36 /* get stars from 2MASS for the given region */ 35 37 if (!strcasecmp (Refcat, "2MASS-DR2")) { 36 stars = get2mass (catstats, &Nstars, 1);38 stars = get2mass (catstats, photcode, LOAD_DR2, &Nstars); 37 39 } 38 40 -
trunk/Ohana/src/addstar/src/grefstars.c
r3376 r5328 2 2 3 3 /* read ASCII file with ref star data */ 4 Stars *grefstars (char *file, int *Nstars) {4 Stars *grefstars (char *file, int photcode, int *Nstars) { 5 5 6 6 FILE *f; … … 8 8 Stars *stars; 9 9 char line[256]; 10 11 /* require photcode */12 if (thiscode == NULL) Shutdown ("photcode not specified");13 10 14 11 /* open file */ … … 31 28 while (stars[N].R >= 360.0) stars[N].R -= 360.0; 32 29 stars[N].t = 0; 33 stars[N].code = thiscode[0].code;30 stars[N].code = photcode; 34 31 stars[N].found = FALSE; 35 32 CHECK_REALLOCATE (stars, Stars, NSTARS, N+1, 100); … … 38 35 return (stars); 39 36 } 40 41 /* add the photcode here */ -
trunk/Ohana/src/addstar/src/gregion_image.c
r3389 r5328 2 2 3 3 /* given image with coords, find regions which overlap image */ 4 GSCRegion *gregion_image (Image *image, int *Nregions) {4 GSCRegion *gregion_image (Image *image, Coords *mosaic, int *Nregions) { 5 5 6 6 GSCRegion *regions, impatch; … … 14 14 15 15 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 16 if ( MOSAIC== NULL) Shutdown ("no mosaic for WRP image (use -mosaic)");17 RegisterMosaic ( MOSAIC);16 if (mosaic == NULL) Shutdown ("no mosaic for WRP image (use -mosaic)"); 17 RegisterMosaic (mosaic); 18 18 } 19 19 -
trunk/Ohana/src/addstar/src/gstars.c
r5287 r5328 1 1 # include "addstar.h" 2 2 3 Stars *gstars (char *file, int *NSTARS, Image *image) {3 Stars *gstars (char *file, int *NSTARS, int photcode, Image *image) { 4 4 5 5 FILE *f; 6 6 int j, N, Nbytes, extend; 7 7 int itmp, hour, min; 8 char *name, *c, phot code[64], line[80];8 char *name, *c, photname[64], line[80]; 9 9 double tmp, sec, dMs; 10 10 Stars *stars, *rdstars; … … 59 59 60 60 /* get photcode from header */ 61 if (thiscode == NULL) { 62 fits_scan (&header, "PHOTCODE", "%s", 1, photcode); 63 thiscode = GetPhotcodebyName (photcode); 64 } 65 if (thiscode == NULL) { 66 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", photcode); 67 exit (1); 68 } 69 image[0].source = thiscode[0].code; 61 if (photcode == 0) { 62 if (!fits_scan (&header, "PHOTCODE", "%s", 1, photname)) { 63 fprintf (stderr, "ERROR: photcode not supplied in header\n"); 64 exit (1); 65 } 66 photcode = GetPhotcodeCodebyName (photname); 67 if (photcode == 0) { 68 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", photname); 69 exit (1); 70 } 71 } 72 if (photcode == 0) { 73 fprintf (stderr, "ERROR: no valid photcode is supplied\n"); 74 exit (1); 75 } 76 image[0].source = photcode; 70 77 71 78 image[0].NX -= XOVERSCAN; … … 141 148 ***/ 142 149 143 if (SKYPROBE) { 150 /** I'm essentially using subpix to be synonymous with SKYPROBE */ 151 if (SUBPIX) { 144 152 char *p; 145 153 int sky; … … 199 207 while (stars[N].R >= 360.0) stars[N].R -= 360.0; 200 208 stars[N].found = -1; 201 stars[N].code = thiscode[0].code;202 203 if (S KYPROBE) {209 stars[N].code = photcode; 210 211 if (SUBPIX) { 204 212 dMs = get_subpix (stars[N].X, stars[N].Y); 205 213 stars[N].M -= dMs; -
trunk/Ohana/src/addstar/src/replace_match.c
r5322 r5328 7 7 /* search for entry and replace values M, dM, R, D */ 8 8 for (i = 0; i < average[0].Nm; i++) { 9 if (measure[i].source != thiscode[0].code) continue;9 if (measure[i].source != star[0].code) continue; 10 10 measure[i].dR_PS = 3600.0*(average[0].R_PS - star[0].R); 11 11 measure[i].dD_PS = 3600.0*(average[0].D_PS - star[0].D);
Note:
See TracChangeset
for help on using the changeset viewer.
