Changeset 5443
- Timestamp:
- Oct 24, 2005, 10:36:17 AM (21 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 2 added
- 19 edited
-
Makefile (modified) (3 diffs)
-
include/2mass.h (modified) (1 diff)
-
include/addstar.h (modified) (8 diffs)
-
src/ConfigInit.c (modified) (1 diff)
-
src/SkyListForStars.c (added)
-
src/SkyRegionUtils.c (added)
-
src/addstar.c (modified) (5 diffs)
-
src/args.c (modified) (1 diff)
-
src/find_matches.c (modified) (1 diff)
-
src/find_matches_closest.c (modified) (1 diff)
-
src/find_matches_refstars.c (modified) (2 diffs)
-
src/find_subset.c (modified) (2 diffs)
-
src/get2mass.c (modified) (5 diffs)
-
src/get2mass_as.c (modified) (4 diffs)
-
src/get2mass_dr2.c (modified) (3 diffs)
-
src/getgsc.c (modified) (2 diffs)
-
src/getusno.c (modified) (3 diffs)
-
src/gimages.c (modified) (2 diffs)
-
src/greference.c (modified) (3 diffs)
-
src/load_pt_catalog.c (modified) (1 diff)
-
src/mkcatalog.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/Makefile
r5347 r5443 44 44 $(SRC)/greference.$(ARCH).o \ 45 45 $(SRC)/grefstars.$(ARCH).o \ 46 $(SRC)/gregion_image.$(ARCH).o \47 $(SRC)/gregion_match.$(ARCH).o \48 $(SRC)/gregion_patch.$(ARCH).o \49 $(SRC)/gregion_star.$(ARCH).o \50 46 $(SRC)/gstars.$(ARCH).o \ 51 47 $(SRC)/image-db.$(ARCH).o \ … … 56 52 $(SRC)/opening_angle.$(ARCH).o \ 57 53 $(SRC)/parse_time.$(ARCH).o \ 58 $(SRC)/RegionOps.$(ARCH).o \59 54 $(SRC)/replace_match.$(ARCH).o \ 60 55 $(SRC)/SetSignals.$(ARCH).o \ … … 63 58 $(SRC)/wcatalog.$(ARCH).o \ 64 59 $(SRC)/Shutdown.$(ARCH).o \ 60 $(SRC)/SkyRegionUtils.$(ARCH).o \ 61 $(SRC)/SkyListForStars.$(ARCH).o \ 65 62 $(SRC)/rfits.$(ARCH).o \ 66 63 $(SRC)/rtext.$(ARCH).o 64 65 GSC-OPS = \ 66 $(SRC)/RegionOps.$(ARCH).o \ 67 $(SRC)/gregion_image.$(ARCH).o \ 68 $(SRC)/gregion_match.$(ARCH).o \ 69 $(SRC)/gregion_patch.$(ARCH).o \ 70 $(SRC)/gregion_star.$(ARCH).o 67 71 68 72 MKACC-2MASS = \ -
trunk/Ohana/src/addstar/include/2mass.h
r5328 r5443 9 9 short TM_J, TM_H, TM_K; 10 10 11 GSCRegion *get2mass_acc (GSCRegion *patch, int *nfiles, char *path, char *accel);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);11 SkyTable *get2mass_acc (SkyRegion *patch, char *path, char *accel); 12 Stars *get2mass_2DR_data (SkyRegion *region, SkyRegion *patch, int photcode, int *nstars); 13 Stars *get2mass_AS_data (SkyRegion *region, SkyRegion *patch, int phocode, int *nstars); -
trunk/Ohana/src/addstar/include/addstar.h
r5347 r5443 11 11 /* used in find_matches, find_matches_refstars */ 12 12 # define IN_CATALOG(R,D) ( \ 13 ((D) >= region[0].D EC[0]) && ((D) < region[0].DEC[1]) && \14 ((R) >= region[0].R A[0]) && ((R) < region[0].RA[1]))13 ((D) >= region[0].Dmin) && ((D) < region[0].Dmax) && \ 14 ((R) >= region[0].Rmin) && ((R) < region[0].Rmax)) 15 15 16 16 /* grab named photcode */ … … 39 39 char HOSTNAME[80]; 40 40 int NVALID, *VALID_IP; 41 int SKY_DEPTH; /** XXX EAM : depth of catalog tables, fix usage */ 41 42 42 43 /* used to select entries from header (gstars or parse_time) (KEEP) */ … … 79 80 /* these depend on HOW we implement the client/server interaction for CAT/REF modes */ 80 81 time_t TIMEREF; // used by MODE REF 81 GSCRegion UserPatch; // used by MODE CAT82 SkyRegion UserPatch; // used by MODE CAT 82 83 char *SELECT_2MASS_QUALITY; // used only by get2mass_as 83 84 … … 86 87 AddstarClientOptions ConfigInit PROTO((int *argc, char **argv)); 87 88 void FindCalibration PROTO((Image *image)); 88 int FindDecBand PROTO((double dec, double *DEC0, double *DEC1));89 int FindRegionByPoint PROTO((GSCRegion *regions, double ra, double dec, GSCRegion *gsc, int Ngsc));90 int FindRegionDecBandStart PROTO((GSCRegion *region, int Nregion, double dec));91 int FindRegionDecBandStop PROTO((GSCRegion *region, int Nregion, double dec));92 89 FILE *GetDB PROTO((int *state)); 93 90 void InitCalibration PROTO(()); 94 GSCRegion *LoadRegions PROTO((int *nregions));95 91 void SaveCalibration PROTO((float M, float dM, float Mr, float dMr, float Mc, float A, int N)); 96 92 void SetProtect PROTO((int mode)); … … 100 96 float airmass PROTO((float secz_image, double ra, double dec, double st, double latitude)); 101 97 void SetAirmassQuality PROTO((int quality)); 102 void aregion PROTO((GSCRegion *region, FILE *f, double ra, double dec));103 98 AddstarClientOptions args PROTO((int argc, char **argv, AddstarClientOptions options)); 104 99 void check_permissions PROTO((char *basefile)); 105 100 int dump_rawstars PROTO((Stars *stars, int Nstars)); 106 101 int edge_check PROTO((double *x1, double *y1, double *x2, double *y2)); 107 void find_matches PROTO(( GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options));108 void find_matches_closest PROTO(( GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options));109 void find_matches_refstars PROTO(( GSCRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options));110 Stars **find_subset PROTO(( GSCRegion *region, Stars *stars, int Nstars, int *NSTARS));102 void find_matches PROTO((SkyRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options)); 103 void find_matches_closest PROTO((SkyRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options)); 104 void find_matches_refstars PROTO((SkyRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options)); 105 Stars **find_subset PROTO((SkyRegion *region, Stars *stars, int Nstars, int *NSTARS)); 111 106 int gcatalog PROTO((Catalog *catalog)); 112 Stars *get2mass PROTO(( GSCRegion *patch, int photcode, int mode, int *NSTARS));107 Stars *get2mass PROTO((SkyRegion *patch, int photcode, int mode, int *NSTARS)); 113 108 double get_subpix PROTO((double x, double y)); 114 Stars *getgsc PROTO(( GSCRegion *patch, int *NSTARS));115 Stars *getusno PROTO(( GSCRegion *catstats, int photcode, int *Nstars));109 Stars *getgsc PROTO((SkyRegion *patch, int *NSTARS)); 110 Stars *getusno PROTO((SkyRegion *catstats, int photcode, int *Nstars)); 116 111 Image *gimages PROTO((FITS_DB *db, Image *image, Coords *mosaic, int *Npimage)); 117 Stars *grefcat PROTO((char *Refcat, GSCRegion *catstats, int photcode, int *nstars));112 Stars *grefcat PROTO((char *Refcat, SkyRegion *catstats, int photcode, int *nstars)); 118 113 Stars *grefstars PROTO((char *file, int photcode, int *Nstars)); 119 GSCRegion *gregion_image PROTO((Image *image, Coords *mosaic, int *Nregions));120 GSCRegion *gregion_match PROTO((GSCRegion *regions, int *nregions));121 GSCRegion *gregion_patch PROTO((GSCRegion *patch, int *nregions));122 void gregion_star PROTO((Stars *star, GSCRegion *region));123 GSCRegion *gregion_stars PROTO((Stars *stars, int Nstars, int *Nregion));124 GSCRegion *gregions PROTO((Image *image, int *Nregions));125 114 Stars *gstars PROTO((char *file, int *NSTARS, int photcode, Image *image)); 126 115 void help PROTO(()); 127 116 int in_image PROTO((double r, double d, Image *image)); 128 int load_pt_catalog PROTO((Catalog *catalog, GSCRegion *region)); /*** choose new name ***/117 int load_pt_catalog PROTO((Catalog *catalog, SkyRegion *region)); /*** choose new name ***/ 129 118 void load_subpix PROTO(()); 130 119 void lock_image_db PROTO((FITS_DB *db, char *filename)); … … 132 121 void make_backup PROTO((char *filename)); 133 122 int match_refstars PROTO((Stars *stars, int Nstars)); 134 void mkcatalog PROTO(( GSCRegion *region, Catalog *catalog));123 void mkcatalog PROTO((SkyRegion *region, Catalog *catalog)); 135 124 double opening_angle PROTO((double x1, double y1, double x2, double y2, double x3, double y3)); 136 125 int parse_time PROTO((Header *header)); … … 165 154 Missing *sort_missing (Average *average, int Naverage, Missing *missing, int Nmissing, int *next_miss); 166 155 156 GSCRegion *LoadRegions PROTO((int *nregions)); 157 int FindDecBand PROTO((double dec, double *DEC0, double *DEC1)); 158 int FindRegionByPoint PROTO((GSCRegion *regions, double ra, double dec, GSCRegion *gsc, int Ngsc)); 159 int FindRegionDecBandStart PROTO((GSCRegion *region, int Nregion, double dec)); 160 int FindRegionDecBandStop PROTO((GSCRegion *region, int Nregion, double dec)); 161 void aregion PROTO((GSCRegion *region, FILE *f, double ra, double dec)); 162 GSCRegion *gregion_image PROTO((Image *image, Coords *mosaic, int *Nregions)); 163 GSCRegion *gregion_match PROTO((GSCRegion *regions, int *nregions)); 164 GSCRegion *gregion_patch PROTO((GSCRegion *patch, int *nregions)); 165 void gregion_star PROTO((Stars *star, GSCRegion *region)); 166 GSCRegion *gregion_stars PROTO((Stars *stars, int Nstars, int *Nregion)); 167 GSCRegion *gregions PROTO((Image *image, int *Nregions)); 168 167 169 /** 168 170 there is an inconsistency to be resolved: fixed structures (like Image) … … 192 194 int UpdateDatabase_Reflist (AddstarClientOptions *options, Stars *stars, int Nstars); 193 195 int UpdateDatabase_Refcat (AddstarClientOptions *options, GSCRegion *UserPatch, char *refcat); 196 197 SkyList *SkyListForStars (SkyTable *table, int depth, Stars *stars, int Nstars); 198 SkyList *SkyListExistingSubset (SkyList *input); 199 int SkyListSetPath (SkyList *list, char *path); -
trunk/Ohana/src/addstar/src/ConfigInit.c
r5347 r5443 56 56 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 57 57 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile); 58 if (!ScanConfig (config, "SKY_DEPTH", "%d", 0, &SKY_DEPTH)) { 59 SKY_DEPTH = 2; 60 } 58 61 59 62 /* used by client/server setup */ -
trunk/Ohana/src/addstar/src/addstar.c
r5328 r5443 7 7 Stars *stars, **subset; 8 8 Image image, *overlap; 9 GSCRegion *regions;10 9 Catalog catalog; 11 10 FITS_DB db; 12 11 AddstarClientOptions options; 12 13 SkyTable *sky; 14 SkyList *skylist; 15 SkyRegion *regions; 13 16 14 17 double dtime; … … 20 23 options = ConfigInit (&argc, argv); 21 24 options = args (argc, argv, options); 25 26 sky = SkyTableFromGSC (GSCFILE, SKY_DEPTH, VERBOSE); 22 27 23 28 stars = NULL; … … 41 46 stars = gstars (argv[1], &Nstars, options.photcode, &image); 42 47 if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars); 43 regions = gregion_image (&image, MOSAIC, &Nregions); 44 /* lock_image_db (&db, ImageCat); */ 48 skylist = SkyListByImage (sky, -1, &image, MOSAIC); 45 49 overlap = gimages (&db, &image, MOSAIC, &Noverlap); 46 /* unlock_image_db (&db); */47 50 break; 48 51 case M_REFLIST: 49 52 stars = grefstars (argv[1], options.photcode, &Nstars); 50 regions = gregion_stars (stars, Nstars, &Nregions);53 skylist = SkyListForStars (sky, -1, stars, Nstars); 51 54 break; 52 55 case M_REFCAT: 53 regions = gregion_patch (&UserPatch, &Nregions);56 skylist = SkyListByPatch (sky, -1, &UserPatch); 54 57 break; 55 58 } 59 SkyListSetPath (skylist, CATDIR); 56 60 if (options.only_match || options.existing_regions) { 57 regions = gregion_match (regions, &Nregions); 61 SkyList *tmp; 62 tmp = SkyListExistingSubset (skylist); 63 SkyListFree (skylist); 64 skylist = tmp; 58 65 } 59 if (VERBOSE) fprintf (stderr, "writing to %d regions\n", Nregions);66 if (VERBOSE) fprintf (stderr, "writing to %d regions\n", skylist[0].Nregions); 60 67 61 68 gettimeofday (&stop, NULL); … … 64 71 65 72 Naverage = Nmeasure = 0; 66 for (i = 0; i < Nregions; i++) {73 for (i = 0; i < skylist[0].Nregions; i++) { 67 74 68 75 gettimeofday (&t1, NULL); 69 76 70 load_pt_catalog (&catalog, ®ions[i]);77 load_pt_catalog (&catalog, skylist[0].regions[i]); 71 78 72 79 /* for only_match, skip empty catalogs XXX EAM : this leaves behind empty files */ … … 93 100 Nsubset = Nstars; 94 101 if (options.closest) { 95 find_matches_closest ( ®ions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options);102 find_matches_closest (skylist[0].regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options); 96 103 } else { 97 find_matches ( ®ions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options);104 find_matches (skylist[0].regions[i], stars, Nstars, &catalog, &image, overlap, Noverlap, MOSAIC, options); 98 105 } 99 106 break; 100 107 case M_REFCAT: 101 stars = grefcat (argv[1], ®ions[i], options.photcode, &Nstars);108 stars = grefcat (argv[1], skylist[0].regions[i], options.photcode, &Nstars); 102 109 case M_REFLIST: 103 subset = find_subset ( ®ions[i], stars, Nstars, &Nsubset);104 find_matches_refstars ( ®ions[i], subset, Nsubset, &catalog, options);110 subset = find_subset (skylist[0].regions[i], stars, Nstars, &Nsubset); 111 find_matches_refstars (skylist[0].regions[i], subset, Nsubset, &catalog, options); 105 112 if (Nsubset) free (subset); 106 113 break; -
trunk/Ohana/src/addstar/src/args.c
r5328 r5443 28 28 /*** provide additional data ***/ 29 29 /* restrict to a portion of the sky? (REFCAT only) */ 30 UserPatch.R A[0]= 0;31 UserPatch.R A[1]= 360;32 UserPatch.D EC[0]= -90;33 UserPatch.D EC[1]= +90;30 UserPatch.Rmin = 0; 31 UserPatch.Rmax = 360; 32 UserPatch.Dmin = -90; 33 UserPatch.Dmax = +90; 34 34 if ((N = get_argument (argc, argv, "-region"))) { 35 35 remove_argument (N, &argc, argv); 36 UserPatch.R A[0]= atof (argv[N]);37 remove_argument (N, &argc, argv); 38 UserPatch.R A[1]= atof (argv[N]);39 remove_argument (N, &argc, argv); 40 UserPatch.D EC[0]= atof (argv[N]);41 remove_argument (N, &argc, argv); 42 UserPatch.D EC[1]= atof (argv[N]);36 UserPatch.Rmin = atof (argv[N]); 37 remove_argument (N, &argc, argv); 38 UserPatch.Rmax = atof (argv[N]); 39 remove_argument (N, &argc, argv); 40 UserPatch.Dmin = atof (argv[N]); 41 remove_argument (N, &argc, argv); 42 UserPatch.Dmax = atof (argv[N]); 43 43 remove_argument (N, &argc, argv); 44 44 } -
trunk/Ohana/src/addstar/src/find_matches.c
r5347 r5443 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, Coords *mosaic, AddstarClientOptions options) {3 void find_matches (SkyRegion *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; -
trunk/Ohana/src/addstar/src/find_matches_closest.c
r5381 r5443 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, Coords *mosaic, AddstarClientOptions options) {3 void find_matches_closest (SkyRegion *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; -
trunk/Ohana/src/addstar/src/find_matches_refstars.c
r5322 r5443 1 1 # include "addstar.h" 2 2 3 void find_matches_refstars ( GSCRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options) {3 void find_matches_refstars (SkyRegion *region, Stars **stars, int Nstars, Catalog *catalog, AddstarClientOptions options) { 4 4 5 5 int i, j, k, n, m, N, J; … … 46 46 /* project onto rectilinear grid with 1 arcsec pixels, sort by X */ 47 47 /* reference for coords is catalog center */ 48 tcoords.crval1 = 0.5*(region[0].R A[0] + region[0].RA[1]);49 tcoords.crval2 = 0.5*(region[0].D EC[0] + region[0].DEC[1]);48 tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax); 49 tcoords.crval2 = 0.5*(region[0].Dmin + region[0].Dmax); 50 50 tcoords.crpix1 = tcoords.crpix2 = 0.0; 51 51 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; -
trunk/Ohana/src/addstar/src/find_subset.c
r3361 r5443 2 2 3 3 /* find stars within this region */ 4 Stars **find_subset ( GSCRegion *region, Stars *stars, int Nstars, int *Nsubset) {4 Stars **find_subset (SkyRegion *region, Stars *stars, int Nstars, int *Nsubset) { 5 5 6 6 int i, N, NSUBSET; … … 11 11 ALLOCATE (subset, Stars *, NSUBSET); 12 12 13 RA0 = region[0].R A[0];14 RA1 = region[0].R A[1];15 DEC0 = region[0].D EC[0];16 DEC1 = region[0].D EC[1];13 RA0 = region[0].Rmin; 14 RA1 = region[0].Rmax; 15 DEC0 = region[0].Dmin; 16 DEC1 = region[0].Dmax; 17 17 18 18 if (VERBOSE) fprintf (stderr, "subset for %f - %f, %f - %f\n", RA0, RA1, DEC0, DEC1); -
trunk/Ohana/src/addstar/src/get2mass.c
r5386 r5443 2 2 # include "2mass.h" 3 3 4 Stars *get2mass ( GSCRegion *patch, int photcode, int mode, int *NSTARS) {4 Stars *get2mass (SkyRegion *patch, int photcode, int mode, int *NSTARS) { 5 5 6 6 char *path; 7 int i, Nstars, Nrefcat , Nregions;8 Stars *stars;9 Stars *refcat;10 GSCRegion *regions;7 int i, Nstars, Nrefcat; 8 Stars *stars; 9 Stars *refcat; 10 SkyTable *sky; 11 11 12 12 NAMED_PHOTCODE (TM_J, "2MASS_J"); … … 22 22 if (mode == 1) path = TWO_MASS_DIR_DR2; 23 23 24 regions = get2mass_acc (patch, &Nregions, path, "accel.dat");24 sky = get2mass_acc (patch, path, "accel.dat"); 25 25 26 26 Nstars = 0; 27 27 ALLOCATE (stars, Stars, 1); 28 28 29 for (i = 0; i < Nregions; i++) {29 for (i = 0; i < sky[0].Nregions; i++) { 30 30 refcat = NULL; 31 31 switch (mode) { 32 32 case 0: 33 refcat = get2mass_AS_data (& regions[i], patch, photcode, &Nrefcat);33 refcat = get2mass_AS_data (&sky[0].regions[i], patch, photcode, &Nrefcat); 34 34 if (VERBOSE) fprintf (stderr, "loaded %d stars from 2MASS (allsky)\n", Nrefcat); 35 35 break; 36 36 case 1: 37 refcat = get2mass_2DR_data (& regions[i], patch, photcode, &Nrefcat);37 refcat = get2mass_2DR_data (&sky[0].regions[i], patch, photcode, &Nrefcat); 38 38 if (VERBOSE) fprintf (stderr, "loaded %d stars from 2MASS (dr2)\n", Nrefcat); 39 39 break; … … 53 53 54 54 /* watch for patch which cross 0,360 boundary */ 55 GSCRegion *get2mass_acc (GSCRegion *patch, int *nregions, char *path, char *accel) {55 SkyTable *get2mass_acc (SkyRegion *patch, char *path, char *accel) { 56 56 57 57 int Nregions, NREGIONS; 58 GSCRegion *regions;59 58 char accelfile[1024], line[256], filename[128]; 60 59 FILE *f; 61 60 double Rs, Re, Ds, De; 61 62 SkyTable *sky; 63 SkyRegion *regions; 62 64 63 65 sprintf (accelfile, "%s/%s", path, accel); … … 67 69 Nregions = 0; 68 70 NREGIONS = 200; 69 ALLOCATE (regions, GSCRegion, NREGIONS);71 ALLOCATE (regions, SkyRegion, NREGIONS); 70 72 71 73 /* read in stars line-by-line */ … … 77 79 Rs *= 15.0; 78 80 Re *= 15.0; 79 if (Rs > patch[0].R A[1]) continue;80 if (Re < patch[0].R A[0]) continue;81 if (Ds > patch[0].D EC[1]) continue;82 if (De < patch[0].D EC[0]) continue;83 sprintf (regions[Nregions]. filename, "%s/%s", path, filename);84 regions[Nregions].R A[0]= Rs;85 regions[Nregions].R A[1]= Re;86 regions[Nregions].D EC[0]= Ds;87 regions[Nregions].D EC[1]= De;81 if (Rs > patch[0].Rmax) continue; 82 if (Re < patch[0].Rmin) continue; 83 if (Ds > patch[0].Dmax) continue; 84 if (De < patch[0].Dmin) continue; 85 sprintf (regions[Nregions].name, "%s/%s", path, filename); 86 regions[Nregions].Rmin = Rs; 87 regions[Nregions].Rmax = Re; 88 regions[Nregions].Dmin = Ds; 89 regions[Nregions].Dmax = De; 88 90 Nregions ++; 89 CHECK_REALLOCATE (regions, GSCRegion, NREGIONS, Nregions, 20);91 CHECK_REALLOCATE (regions, SkyRegion, NREGIONS, Nregions, 20); 90 92 } 91 93 fclose (f); 92 94 93 *nregions = Nregions; 94 return (regions); 95 ALLOCATE (sky, SkyTable, 1); 96 sky[0].regions = regions; 97 sky[0].Nregions = Nregions; 98 return (sky); 95 99 } -
trunk/Ohana/src/addstar/src/get2mass_as.c
r5386 r5443 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 photcode, int *nstars) {15 Stars *get2mass_AS_data (SkyRegion *region, SkyRegion *patch, int photcode, int *nstars) { 16 16 17 17 int FilterSkip, TimeSkip; … … 28 28 ALLOCATE (buffer, char, NBYTE); 29 29 30 RA0 = MAX (patch[0].R A[0], UserPatch.RA[0]);31 RA1 = MIN (patch[0].R A[1], UserPatch.RA[1]);32 DEC0 = MAX (patch[0].D EC[0], UserPatch.DEC[0]);33 DEC1 = MIN (patch[0].D EC[1], UserPatch.DEC[1]);30 RA0 = MAX (patch[0].Rmin, UserPatch.Rmin); 31 RA1 = MIN (patch[0].Rmax, UserPatch.Rmax); 32 DEC0 = MAX (patch[0].Dmin, UserPatch.Dmin); 33 DEC1 = MIN (patch[0].Dmax, UserPatch.Dmax); 34 34 35 35 FilterSkip = TimeSkip = Qentry = 0; … … 51 51 if (!FilterSkip) Shutdown ("invalid photcode %s", GetPhotcodeNamebyCode(photcode)); 52 52 53 filename = region[0]. filename;53 filename = region[0].name; 54 54 gf = gzopen (filename, "rb"); 55 55 if (gf == NULL) Shutdown ("can't read 2mass data file: %s", filename); … … 136 136 /* this just scans along in the file. file is sorted by dec, so we 137 137 should be skipping large chunks - but we would need to have 138 the size from the accel file (won't fit in GSCRegion) and need138 the size from the accel file (won't fit in SkyRegion) and need 139 139 to use gzseek, if it exists. 140 140 */ -
trunk/Ohana/src/addstar/src/get2mass_dr2.c
r5328 r5443 5 5 # define NLINE 30000 6 6 7 Stars *get2mass_2DR_data ( GSCRegion *region, GSCRegion *patch, int photcode, int *nstars) {7 Stars *get2mass_2DR_data (SkyRegion *region, SkyRegion *patch, int photcode, int *nstars) { 8 8 9 9 int i, Nstars, NSTARS, Nbyte, Nline; … … 20 20 if (patch == NULL) exit (3); 21 21 22 RA0 = MAX (patch[0].R A[0], UserPatch.RA[0]);23 RA1 = MIN (patch[0].R A[1], UserPatch.RA[1]);24 DEC0 = MAX (patch[0].D EC[0], UserPatch.DEC[0]);25 DEC1 = MIN (patch[0].D EC[1], UserPatch.DEC[1]);22 RA0 = MAX (patch[0].Rmin, UserPatch.Rmin); 23 RA1 = MIN (patch[0].Rmax, UserPatch.Rmax); 24 DEC0 = MAX (patch[0].Dmin, UserPatch.Dmin); 25 DEC1 = MIN (patch[0].Dmax, UserPatch.Dmax); 26 26 27 27 fprintf (stderr, "overlap: %f - %f, %f - %f\n", RA0, RA1, DEC0, DEC1); 28 28 29 filename = region[0]. filename;29 filename = region[0].name; 30 30 gf = gzopen (filename, "rb"); 31 31 if (gf == NULL) Shutdown ("can't read 2mass data file: %s", filename); … … 105 105 and gzseek is as expensive as gzread */ 106 106 /* 107 Noffset = region[0].Nrec * (patch[0].D EC[0]+ 90) / 180.0;107 Noffset = region[0].Nrec * (patch[0].Dmin + 90) / 180.0; 108 108 gzseek (gf, Noffset * NBYTE, SEEK_SET); 109 109 Nbyte = gzread (gf, buffer, NLINE*NBYTE); -
trunk/Ohana/src/addstar/src/getgsc.c
r3400 r5443 6 6 static short GSC_M; 7 7 8 Stars *getgsc ( GSCRegion *patch, int *NSTARS) {8 Stars *getgsc (SkyRegion *patch, int *NSTARS) { 9 9 10 10 int i, Ngsc, Nregions, Nstars; 11 11 Stars *gsc; 12 12 Stars *stars; 13 GSCRegion *regions; 13 SkyList *skylist; 14 SkyTable *sky; 14 15 char *tmp; 15 16 16 17 NAMED_PHOTCODE (GSC_M, "GSC_M"); 17 18 18 /* sort of sleaze way to get the right GSC files */ 19 tmp = strcreate (CATDIR); 20 strcpy (CATDIR, GSCDIR); 21 regions = gregion_patch (patch, &Nregions); 22 strcpy (CATDIR, tmp); 23 free (tmp); 19 /* load regions from GSC table, restrict to patch */ 20 sky = SkyTableFromGSC (GSCFILE, 2, VERBOSE); 21 skylist = SkyListByPatch (sky, -1, patch); 22 SkyListSetPath (skylist, GSCDIR); 24 23 25 24 Nstars = 0; 26 25 ALLOCATE (stars, Stars, 1); 27 26 28 for (i = 0; i < Nregions; i++) {29 gsc = rd_gsc ( regions[i].filename, &Ngsc);27 for (i = 0; i < skylist[0].Nregions; i++) { 28 gsc = rd_gsc (skylist[0].regions[i][0].name, &Ngsc); 30 29 31 30 REALLOCATE (stars, Stars, MAX (1, Nstars + Ngsc)); … … 67 66 dparse (&stars[Nstars].R, 1, &buffer[Nbyte]); 68 67 dparse (&stars[Nstars].D, 2, &buffer[Nbyte]); 69 if (stars[Nstars].R < UserPatch.R A[0]) continue;70 if (stars[Nstars].R > UserPatch.R A[1]) continue;71 if (stars[Nstars].D < UserPatch.D EC[0]) continue;72 if (stars[Nstars].D > UserPatch.D EC[1]) continue;68 if (stars[Nstars].R < UserPatch.Rmin) continue; 69 if (stars[Nstars].R > UserPatch.Rmax) continue; 70 if (stars[Nstars].D < UserPatch.Dmin) continue; 71 if (stars[Nstars].D > UserPatch.Dmax) continue; 73 72 74 73 dparse (&stars[Nstars].M, 3, &buffer[Nbyte]); -
trunk/Ohana/src/addstar/src/getusno.c
r5383 r5443 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 photcode, int *Nstars) {11 Stars *getusno (SkyRegion *catstats, int photcode, int *Nstars) { 12 12 13 13 long int offset; … … 34 34 /* identify ra & dec range of interest */ 35 35 /* note: the use of UserPatch to restrict here limits general utility of function */ 36 iRA0 = MAX (catstats[0].R A[0], UserPatch.RA[0]) * 360000.0;37 iRA1 = MIN (catstats[0].R A[1], UserPatch.RA[1]) * 360000.0;38 iDEC0 = (MAX (catstats[0].D EC[0], UserPatch.DEC[0]) + 90.0) * 360000.0;39 iDEC1 = (MIN (catstats[0].D EC[1], UserPatch.DEC[1]) + 90.0) * 360000.0;36 iRA0 = MAX (catstats[0].Rmin, UserPatch.Rmin) * 360000.0; 37 iRA1 = MIN (catstats[0].Rmax, UserPatch.Rmax) * 360000.0; 38 iDEC0 = (MAX (catstats[0].Dmin, UserPatch.Dmin) + 90.0) * 360000.0; 39 iDEC1 = (MIN (catstats[0].Dmax, UserPatch.Dmax) + 90.0) * 360000.0; 40 40 41 41 /* data is organized in south-pole distance zones */ 42 spd_start = (int)((catstats[0].D EC[0]+ 90) / 7.5) * 75.0;43 dec = (catstats[0].D EC[1]+ 90) / 7.5;42 spd_start = (int)((catstats[0].Dmin + 90) / 7.5) * 75.0; 43 dec = (catstats[0].Dmax + 90) / 7.5; 44 44 if (dec > (int)(dec)) { 45 spd_end = (int)(1 + (catstats[0].D EC[1]+ 90) / 7.5) * 75.0;45 spd_end = (int)(1 + (catstats[0].Dmax + 90) / 7.5) * 75.0; 46 46 } else { 47 spd_end = (int)(0 + (catstats[0].D EC[1]+ 90) / 7.5) * 75.0;47 spd_end = (int)(0 + (catstats[0].Dmax + 90) / 7.5) * 75.0; 48 48 } 49 49 … … 82 82 fclose (f); 83 83 84 first = catstats[0].R A[0]/ 3.75;85 if ((catstats[0].R A[1] / 3.75) == (int) (catstats[0].RA[1]/ 3.75))86 last = catstats[0].R A[1]/ 3.75;84 first = catstats[0].Rmin / 3.75; 85 if ((catstats[0].Rmax / 3.75) == (int) (catstats[0].Rmax / 3.75)) 86 last = catstats[0].Rmax / 3.75; 87 87 else 88 last = 1 + catstats[0].R A[1]/ 3.75;88 last = 1 + catstats[0].Rmax / 3.75; 89 89 90 90 if ((first > Nbins) || (last > Nbins)) { -
trunk/Ohana/src/addstar/src/gimages.c
r5385 r5443 153 153 */ 154 154 155 # if (0) 155 156 void SetImageCorners (double *X, double *Y, Image *image) { 156 157 … … 167 168 } 168 169 } 170 # endif -
trunk/Ohana/src/addstar/src/greference.c
r5328 r5443 3 3 # define LOAD_DR2 1 4 4 5 Stars *grefcat (char *Refcat, GSCRegion *catstats, int photcode, int *nstars) {5 Stars *grefcat (char *Refcat, SkyRegion *region, int photcode, int *nstars) { 6 6 7 7 int Nstars; … … 9 9 10 10 if (VERBOSE) fprintf (stderr, "loading reference catalog data from %s\n", Refcat); 11 if (VERBOSE) fprintf (stderr, "full region: %f - %f, %f - %f\n", catstats[0].RA[0], catstats[0].RA[1], catstats[0].DEC[0], catstats[0].DEC[1]);11 if (VERBOSE) fprintf (stderr, "full region: %f - %f, %f - %f\n", region[0].Rmin, region[0].Rmax, region[0].Dmin, region[0].Dmax); 12 12 13 13 Nstars = 0; … … 16 16 /* get stars from USNO for the given region */ 17 17 if (!strcasecmp (Refcat, "USNO")) { 18 stars = getusno ( catstats, photcode, &Nstars);18 stars = getusno (region, photcode, &Nstars); 19 19 } 20 20 21 21 /* get stars from HST GSC for the given region */ 22 22 if (!strcasecmp (Refcat, "GSC")) { 23 stars = getgsc ( catstats, &Nstars);23 stars = getgsc (region, &Nstars); 24 24 } 25 25 26 26 /* get stars from 2MASS for the given region */ 27 27 if (!strcasecmp (Refcat, "2MASS")) { 28 stars = get2mass ( catstats, photcode, LOAD_ALLSKY, &Nstars);28 stars = get2mass (region, photcode, LOAD_ALLSKY, &Nstars); 29 29 } 30 30 31 31 /* get stars from 2MASS for the given region */ 32 32 if (!strcasecmp (Refcat, "2MASS-ALLSKY")) { 33 stars = get2mass ( catstats, photcode, LOAD_ALLSKY, &Nstars);33 stars = get2mass (region, photcode, LOAD_ALLSKY, &Nstars); 34 34 } 35 35 36 36 /* get stars from 2MASS for the given region */ 37 37 if (!strcasecmp (Refcat, "2MASS-DR2")) { 38 stars = get2mass ( catstats, photcode, LOAD_DR2, &Nstars);38 stars = get2mass (region, photcode, LOAD_DR2, &Nstars); 39 39 } 40 40 41 if (VERBOSE && (Nstars == 0)) fprintf (stderr, "no ref objects in region %s\n", catstats[0].filename);41 if (VERBOSE && (Nstars == 0)) fprintf (stderr, "no ref objects in region %s\n", region[0].name); 42 42 43 43 *nstars = Nstars; -
trunk/Ohana/src/addstar/src/load_pt_catalog.c
r5322 r5443 1 1 # include "addstar.h" 2 2 3 int load_pt_catalog (Catalog *catalog, GSCRegion *region) {3 int load_pt_catalog (Catalog *catalog, SkyRegion *region) { 4 4 5 check_permissions (region[0]. filename);5 check_permissions (region[0].name); 6 6 7 7 /* don't free region before catalog! */ 8 catalog[0].filename = region[0]. filename;9 if (VERBOSE) fprintf (stderr, "adding to %s\n", region[0]. filename);8 catalog[0].filename = region[0].name; 9 if (VERBOSE) fprintf (stderr, "adding to %s\n", region[0].name); 10 10 11 11 switch (lock_catalog (catalog, LCK_XCLD)) { -
trunk/Ohana/src/addstar/src/mkcatalog.c
r5234 r5443 1 1 # include "addstar.h" 2 2 3 void mkcatalog ( GSCRegion *region, Catalog *catalog) {3 void mkcatalog (SkyRegion *region, Catalog *catalog) { 4 4 5 5 int length, status; … … 7 7 time_t now; 8 8 9 if (VERBOSE) fprintf (stderr, "new catalog file: %s\n", region[0]. filename);9 if (VERBOSE) fprintf (stderr, "new catalog file: %s\n", region[0].name); 10 10 11 11 /* set the recommended CATFORMAT */ … … 94 94 95 95 /* write RA,DEC range in header */ 96 fits_modify (&catalog[0].header, "RA0", "%lf", 1, region[0].R A[0]);97 fits_modify (&catalog[0].header, "DEC0", "%lf", 1, region[0].D EC[0]);98 fits_modify (&catalog[0].header, "RA1", "%lf", 1, region[0].R A[1]);99 fits_modify (&catalog[0].header, "DEC1", "%lf", 1, region[0].D EC[1]);96 fits_modify (&catalog[0].header, "RA0", "%lf", 1, region[0].Rmin); 97 fits_modify (&catalog[0].header, "DEC0", "%lf", 1, region[0].Dmin); 98 fits_modify (&catalog[0].header, "RA1", "%lf", 1, region[0].Rmax); 99 fits_modify (&catalog[0].header, "DEC1", "%lf", 1, region[0].Dmax); 100 100 101 101 /* write creation date in header */
Note:
See TracChangeset
for help on using the changeset viewer.
