Changeset 7688
- Timestamp:
- Jun 25, 2006, 12:58:30 PM (20 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 3 added
- 6 edited
-
addstar/Makefile (modified) (1 diff)
-
addstar/include/2mass.h (modified) (1 diff)
-
addstar/src/get2mass_as.c (modified) (4 diffs)
-
addstar/src/get2mass_as_raw.c (modified) (4 diffs)
-
addstar/src/get2mass_ops.c (added)
-
addstar/src/load2mass.c (added)
-
addstar/src/load2mass_as_raw.c (added)
-
addstar/src/scan2mass_as_data.c (modified) (1 diff)
-
opihi/dvo/fitsed.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/Makefile
r7683 r7688 88 88 $(SRC)/get2mass_as.$(ARCH).o \ 89 89 $(SRC)/ConfigInit.$(ARCH).o \ 90 $(SRC)/Shutdown.$(ARCH).o \ 91 $(SRC)/SetSignals.$(ARCH).o 92 93 LOAD-2MASS = \ 94 $(SRC)/load2mass.$(ARCH).o \ 95 $(SRC)/load2mass_as_data.$(ARCH).o \ 96 $(SRC)/get2mass_ops.$(ARCH).o \ 97 $(SRC)/ConfigInit.$(ARCH).o \ 98 $(SRC)/args.$(ARCH).o \ 90 99 $(SRC)/Shutdown.$(ARCH).o \ 91 100 $(SRC)/SetSignals.$(ARCH).o -
trunk/Ohana/src/addstar/include/2mass.h
r7683 r7688 13 13 } TMBands; 14 14 15 typedef struct { 16 double R, D; 17 int offset; 18 int flag; 19 } TMStars; 20 15 21 short TM_J, TM_H, TM_K; 16 22 -
trunk/Ohana/src/addstar/src/get2mass_as.c
r7683 r7688 29 29 DEC1 = MIN (patch[0].Dmax, UserPatch.Dmax); 30 30 31 FilterSkip = TimeSkip = Qentry = 0; 32 if (photcode == TM_J) { 33 FilterSkip = 6; 34 // TimeSkip = 23; 35 TimeSkip = 28; 36 Qentry = 0; 37 } 38 if (photcode == TM_H) { 39 FilterSkip = 10; 40 // TimeSkip = 19; 41 TimeSkip = 24; 42 Qentry = 1; 43 } 44 if (photcode == TM_K) { 45 FilterSkip = 14; 46 // looks like this should be 20, not 15... 47 // TimeSkip = 15; 48 TimeSkip = 20; 49 Qentry = 2; 50 } 51 if (!FilterSkip) Shutdown ("invalid photcode %s", GetPhotcodeNamebyCode(photcode)); 31 get2mass_setup (photcode); 52 32 53 33 gf = gzopen (filename, "rb"); … … 75 55 while (1) { 76 56 77 RA = strtod (p, NULL); 78 ptr = skipNbounds (p, '|', 1, Nbyte - (p - buffer)); 79 DEC = strtod (ptr, NULL); 80 if (DEC > 90) Shutdown ("weird DEC value: something is wrong"); 57 get2mass_coords (p, &RA, &DEC, Nbyte - (p - buffer)); 81 58 82 59 /* skip stars which are outside desired region */ … … 86 63 if (RA > RA1) goto skip_star; 87 64 88 ptr = skipNbounds (p, '|', FilterSkip, Nbyte - (p - buffer)); 89 if (ptr == NULL) Shutdown ("format error in 2mass"); 90 M = strtod (ptr, NULL); 91 ptr = skipNbounds (ptr, '|', 1, Nbyte - (ptr - buffer)); 92 dM = strtod (ptr, NULL); 93 time = get2mass_time (ptr, buffer, TimeSkip, Nbyte); 94 95 /* filter on the ph_qual flag for this filter (field 19) */ 96 if (SELECT_2MASS_QUALITY != NULL) { 97 ptr = skipNbounds (p, '|', 18, Nbyte - (p - buffer)); 98 qc = ptr[Qentry]; 99 if (strchr (SELECT_2MASS_QUALITY, qc) == NULL) goto skip_star; 100 } 101 102 stars[Nstars].R = RA; 103 stars[Nstars].D = DEC; 104 stars[Nstars].M = M; 105 stars[Nstars].dM = dM; 106 stars[Nstars].code = photcode; 107 stars[Nstars].t = time; 108 stars[Nstars].found = -1; 65 get2mass_star (&stars[Nstars], p, Nbyte - (p - buffer)); 109 66 110 67 Nstars ++; … … 149 106 */ 150 107 151 /* return a pointer to the first char after Nbound of value bound */152 char *skipNbounds (char *line, char bound, int Nbound, int Nbyte) {153 154 int i;155 char *p, *q;156 157 p = line;158 for (i = 0; i < Nbound; i++) {159 q = memchr (p, bound, Nbyte - (p - line));160 if (q == NULL) return (NULL);161 p = q + 1;162 if (p - line == Nbyte) return (NULL);163 }164 return (p);165 }166 167 // this function retrieves the time from the DATE field168 e_time get2mass_date (char *ptr, char *buffer, int Nbound, int Nbyte) {169 170 e_time time;171 char *p, *end;172 173 p = skipNbounds (ptr, '|', Nbound, Nbyte - (ptr - buffer));174 if (p == NULL) Shutdown ("format error in 2mass");175 end = memchr (p, '|', Nbyte - (p - buffer));176 if (end == NULL) Shutdown ("format error in 2mass");177 *end = 0;178 time = date_to_sec (ptr);179 *end = '|';180 181 return (time);182 }183 184 // this function retrieves the time from the JDATE field (%12.4f)185 e_time get2mass_time (char *ptr, char *buffer, int Nbound, int Nbyte) {186 187 e_time time;188 double jd;189 char *p, *end;190 191 p = skipNbounds (ptr, '|', Nbound, Nbyte - (ptr - buffer));192 if (p == NULL) Shutdown ("format error in 2mass");193 end = memchr (p, '|', Nbyte - (p - buffer));194 if (end == NULL) Shutdown ("format error in 2mass");195 *end = 0;196 jd = strtod (p, NULL);197 time = jd_to_sec (jd);198 *end = '|';199 200 return (time);201 }202 203 108 # if (0) 204 109 /** need to re-think this test **/ -
trunk/Ohana/src/addstar/src/get2mass_as_raw.c
r7683 r7688 31 31 DEC1 = MIN (patch[0].Dmax, UserPatch.Dmax); 32 32 33 FilterSkip = TimeSkip = Qentry = 0; 34 if (photcode == TM_J) { 35 FilterSkip = 6; 36 // TimeSkip = 23; 37 TimeSkip = 28; 38 Qentry = 0; 39 } 40 if (photcode == TM_H) { 41 FilterSkip = 10; 42 // TimeSkip = 19; 43 TimeSkip = 24; 44 Qentry = 1; 45 } 46 if (photcode == TM_K) { 47 FilterSkip = 14; 48 // looks like this should be 20, not 15... 49 // TimeSkip = 15; 50 TimeSkip = 20; 51 Qentry = 2; 52 } 53 if (!FilterSkip) Shutdown ("invalid photcode %s", GetPhotcodeNamebyCode(photcode)); 33 get2mass_setup (photcode); 54 34 55 35 f = fopen (filename, "r"); … … 60 40 NSTARS = 10000; 61 41 ALLOCATE (stars, Stars, NSTARS); 62 63 /* I want to add a seek-ahead test to find a good starting position in the file64 this is very expensive using gzseek / gzread. */65 66 # if 067 if (patch[0].Rmin > 5) {68 // each 2MASS record is a random length of ~ 330 bytes69 // guess at start, then used a binary search to narrow down70 // first guess at start:71 dNoffset = region[0].childE / 360.0;72 Noffset = dNoffset * patch[0].Rmin;73 fseek (f, Noffset * NBREC, SEEK_SET);74 Nbyte = fread (buffer, 1, 10*NBREC, f);75 q = memchr (p, '\n', Nbyte);76 if (q == NULL) Shutdown ("incomplete line at end of file\n");77 q++; // first (or second) complete line78 79 // get coords for this line80 RA = strtod (q, NULL);81 ptr = skipNbounds (q, '|', 1, Nbyte - (q - buffer));82 DEC = strtod (ptr, NULL);83 if (DEC > 90) Shutdown ("weird DEC value: something is wrong");84 85 // if we are beyond, spin back in ~5 deg chunks 'till we are below86 while (RA > patch[0].Rmin) {87 fseek (f, -5 * dNoffset * NBREC, SEEK_CUR);88 Nbyte = fread (buffer, 1, 10*NBREC, f);89 q = memchr (p, '\n', Nbyte);90 if (q == NULL) Shutdown ("incomplete line at end of file\n");91 q++; // first (or second) complete line92 93 // get coords for this line94 RA = strtod (q, NULL);95 ptr = skipNbounds (q, '|', 1, Nbyte - (q - buffer));96 DEC = strtod (ptr, NULL);97 if (DEC > 90) Shutdown ("weird DEC value: something is wrong");98 99 Nextra = Nbyte - (q - buffer);100 memmove (buffer, q, Nextra);101 }102 } else {103 Nextra = 0;104 }105 # endif106 42 107 43 Nextra = 0; … … 119 55 while (1) { 120 56 121 RA = strtod (p, NULL); 122 ptr = skipNbounds (p, '|', 1, Nbyte - (p - buffer)); 123 DEC = strtod (ptr, NULL); 124 if (DEC > 90) Shutdown ("weird DEC value: something is wrong"); 57 get2mass_coords (p, &RA, &DEC, Nbyte - (p - buffer)); 125 58 126 59 /* skip stars which are outside desired region */ … … 130 63 if (RA > RA1) goto skip_star; 131 64 132 ptr = skipNbounds (p, '|', FilterSkip, Nbyte - (p - buffer)); 133 if (ptr == NULL) Shutdown ("format error in 2mass"); 134 M = strtod (ptr, NULL); 135 ptr = skipNbounds (ptr, '|', 1, Nbyte - (ptr - buffer)); 136 dM = strtod (ptr, NULL); 137 time = get2mass_time (ptr, buffer, TimeSkip, Nbyte); 138 139 /* filter on the ph_qual flag for this filter (field 19) */ 140 if (SELECT_2MASS_QUALITY != NULL) { 141 ptr = skipNbounds (p, '|', 18, Nbyte - (p - buffer)); 142 qc = ptr[Qentry]; 143 if (strchr (SELECT_2MASS_QUALITY, qc) == NULL) goto skip_star; 144 } 145 146 stars[Nstars].R = RA; 147 stars[Nstars].D = DEC; 148 stars[Nstars].M = M; 149 stars[Nstars].dM = dM; 150 stars[Nstars].code = photcode; 151 stars[Nstars].t = time; 152 stars[Nstars].found = -1; 65 get2mass_star (&stars[Nstars], p, Nbyte - (p - buffer)); 153 66 154 67 Nstars ++; -
trunk/Ohana/src/addstar/src/scan2mass_as_data.c
r7683 r7688 58 58 while (1) { 59 59 60 Ro = strtod (p, NULL); 61 ptr = skipNbounds (p, '|', 1, Nbyte - (p - buffer)); 62 Do = strtod (ptr, NULL); 63 if (Do > 90) Shutdown ("weird DEC value: something is wrong"); 60 get2mass_coords (p, &Ro, &Do, Nbyte - (p - buffer)); 61 64 62 if (badStar) { 65 63 fprintf (stderr, "next R,D: %10.6f %10.6f\n", Ro, Do); -
trunk/Ohana/src/opihi/dvo/fitsed.c
r7681 r7688 44 44 KapaSection magSection, resSection; 45 45 46 Catalog catalog ;46 Catalog catalog, outcat; 47 47 SkyList *skylist; 48 48 SEDtableRow *SEDtableRaw, **SEDtable; … … 55 55 catalog.measure = NULL; 56 56 catalog.secfilt = NULL; 57 58 outcat.average = NULL; 59 outcat.measure = NULL; 60 outcat.secfilt = NULL; 61 57 62 SEDtable = NULL; 58 63 SEDtableRaw = NULL; … … 81 86 remove_argument (N, &argc, argv); 82 87 PLOT = TRUE; 88 } 89 90 SAVEDIR = NULL; 91 if ((N = get_argument (argc, argv, "-save"))) { 92 remove_argument (N, &argc, argv); 93 SAVEDIR = strcreate (argv[N]); 94 remove_argument (N, &argc, argv); 83 95 } 84 96
Note:
See TracChangeset
for help on using the changeset viewer.
