Changeset 2448
- Timestamp:
- Nov 24, 2004, 1:35:23 PM (22 years ago)
- Location:
- trunk/Ohana/src/misc/src
- Files:
-
- 4 edited
-
fhead.c (modified) (2 diffs)
-
fields.c (modified) (2 diffs)
-
gtfringetable.c (modified) (3 diffs)
-
mkfringetable.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/misc/src/fhead.c
r18 r2448 9 9 10 10 Extend = FALSE; 11 if ( N = get_argument (argc, argv, "-x")) {11 if ((N = get_argument (argc, argv, "-x"))) { 12 12 Extend = TRUE; 13 13 remove_argument (N, &argc, argv); … … 38 38 39 39 } 40 40 exit (0); 41 41 } 42 43 -
trunk/Ohana/src/misc/src/fields.c
r18 r2448 1 # include <stdio.h> 2 # include <fitsio.h> 3 # include <math.h> 4 # include <malloc.h> 5 # include <string.h> 6 # include <sys/time.h> 7 # include <stdarg.h> 8 # include <stdlib.h> 9 # include <readline/readline.h> 10 # include <readline/history.h> 1 # include <ohana.h> 11 2 12 # define TRUE (1) 13 # define FALSE (0) 14 # define SIGN(X) (((X) == 0) ? 0 : ((fabs((double)(X))) / (X))) 15 # define ROUND(X) ((int) ((X) + 0.5*SIGN(X))) 16 # define SQR(X) (double) (((double)(X))*((double)(X))) 17 # define SQ(X) (double) (((double)(X))*((double)(X))) 18 # define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) 19 # define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) 20 # define SWAP(X,Y) {double tmp=(X); (X) = (Y); (Y) = tmp;} 21 # define ISVAR(a) (isalnum (a) || (a == '.') || (a == '_')) 22 # define ISWORD(a,q) ((q) ? (a != '"') : (isalnum(a) || (a == '.') || (a == '_') || (a == '-'))) 23 # define ISNUM(c) (isdigit(c) || (c == '-') || (c == '.')) 3 int main (int argc, char **argv) { 24 4 25 main (int argc, char **argv) { 26 27 int i, j, nbytes; 5 int i; 28 6 Header header; 29 7 char filename[1000], buffer[1000]; 30 char *p;31 8 int N, Extend, Nextend, status, GotFile, GotField; 32 9 33 10 Extend = FALSE; 34 if ( N = get_argument (argc, argv, "-x")) {11 if ((N = get_argument (argc, argv, "-x"))) { 35 12 Extend = TRUE; 36 13 remove_argument (N, &argc, argv); … … 68 45 } 69 46 70 if (GotFile && GotField) exit (0); 71 if (GotFile) exit (2); 72 exit (1); 73 47 if (!GotFile) exit (1); 48 if (!GotField) exit (2); 49 exit (0); 74 50 } 75 76 -
trunk/Ohana/src/misc/src/gtfringetable.c
r24 r2448 1 1 # include <ohana.h> 2 static char *version = "gtfringetable $Revision: 1. 1$";2 static char *version = "gtfringetable $Revision: 1.2 $"; 3 3 4 intget_version (int argc, char **argv, char *version);4 void get_version (int argc, char **argv, char *version); 5 5 6 voidmain (int argc, char **argv) {6 int main (int argc, char **argv) { 7 7 8 8 int i; … … 34 34 fclose (f); 35 35 36 fits_get_table_column (&header, &table, "X_MIN", &xmin);37 fits_get_table_column (&header, &table, "X_MAX", &xmax);38 fits_get_table_column (&header, &table, "Y_MIN", &ymin);39 fits_get_table_column (&header, &table, "Y_MAX", &ymax);36 fits_get_table_column (&header, &table, "X_MIN", (void **) &xmin); 37 fits_get_table_column (&header, &table, "X_MAX", (void **) &xmax); 38 fits_get_table_column (&header, &table, "Y_MIN", (void **) &ymin); 39 fits_get_table_column (&header, &table, "Y_MAX", (void **) &ymax); 40 40 41 41 for (i = 0; i < header.Naxis[1]; i++) { … … 43 43 fprintf (stdout, "%f %f\n", xmax[i] / binning, ymax[i] / binning); 44 44 } 45 45 exit (0); 46 46 } 47 47 48 48 /**** support functions ******/ 49 intget_version (int argc, char **argv, char *version) {49 void get_version (int argc, char **argv, char *version) { 50 50 51 51 int N; -
trunk/Ohana/src/misc/src/mkfringetable.c
r20 r2448 1 1 # include <ohana.h> 2 static char *version = "mkfringetable $Revision: 1. 2$";3 4 intget_version (int argc, char **argv, char *version);2 static char *version = "mkfringetable $Revision: 1.3 $"; 3 4 void get_version (int argc, char **argv, char *version); 5 5 char *sec_to_date (unsigned long second); 6 6 7 voidmain (int argc, char **argv) {7 int main (int argc, char **argv) { 8 8 9 9 int i, j, Npts, NPTS, Nccd, status; 10 char *layout ;10 char *layout, *config, *file; 11 11 char filter[64], start[64], stop[64], camera[64], *datestr; 12 char ImagetypeKeyword[64], CCDnumKeyword[64], FilterKeyword[64], CameraKeyword[64]; 12 13 char *row, line[512], field[64], extname[64], filename[512]; 13 14 double x, y, *xmin, *xmax, *ymin, *ymax; 14 15 FILE *f, *g; 15 int s1, s2;16 16 17 17 Header header, theader; … … 20 20 21 21 get_version (argc, argv, version); 22 23 /*** load ptolemy/elixir configuration info ***/ 24 file = SelectConfigFile (&argc, argv, "ptolemy"); 25 config = LoadConfigFile (file); 26 if (config == (char *) NULL) { 27 fprintf (stderr, "ERROR: can't find configuration file %s\n", file); 28 if (file != (char *) NULL) free (file); 29 exit (0); 30 } 31 ScanConfig (config, "IMAGETYPE-KEYWORD", "%s", 0, ImagetypeKeyword); 32 ScanConfig (config, "CCDNUM-KEYWORD", "%s", 0, CCDnumKeyword); 33 ScanConfig (config, "FILTER-KEYWORD", "%s", 0, FilterKeyword); 34 ScanConfig (config, "CAMERA-KEYWORD", "%s", 0, CameraKeyword); 35 free (config); 36 free (file); 37 22 38 if (argc != 3) { 23 39 fprintf (stderr, "USAGE: (layout) (output)\n"); … … 65 81 fits_create_matrix (&header, &matrix); 66 82 67 fits_modify (&header, "NEXTEND", "%d", 1, Nccd);68 fits_modify (&header, "DATE", "%s", 1, datestr);69 fits_modify (&header, " FILTER", "%s", 1, filter);70 fits_modify (&header, " CAMERA", "%s", 1, camera);71 fits_modify (&header, " TVSTART", "%s", 1, start);72 fits_modify (&header, "TVSTOP", "%s", 1, stop);73 fits_modify (&header, "IMAGETYP", "%s", 1, "FRINGEPT");74 fits_modify (&header, "VERSION", "%s", 1, version);83 fits_modify (&header, "NEXTEND", "%d", 1, Nccd); 84 fits_modify (&header, "DATE", "%s", 1, datestr); 85 fits_modify (&header, "TVSTART", "%s", 1, start); 86 fits_modify (&header, "TVSTOP", "%s", 1, stop); 87 fits_modify (&header, "VERSION", "%s", 1, version); 88 fits_modify (&header, CameraKeyword, "%s", 1, camera); 89 fits_modify (&header, ImagetypeKeyword, "%s", 1, "FRPTS"); 90 fits_modify (&header, FilterKeyword, "%s", 1, filter); 75 91 76 92 fits_fwrite_header (g, &header); … … 130 146 131 147 /* add current date/time to header */ 132 fits_modify (&theader, "DATE", "%s", 1, datestr); 133 fits_modify (&theader, "FILTER", "%s", 1, filter); 134 fits_modify (&theader, "CAMERA", "%s", 1, camera); 135 fits_modify (&theader, "TVSTART", "%s", 1, start); 136 fits_modify (&theader, "TVSTOP", "%s", 1, stop); 137 fits_modify (&theader, "IMAGETYP", "%s", 1, "FRINGEPT"); 138 148 fits_modify (&theader, "DATE", "%s", 1, datestr); 149 fits_modify (&theader, "TVSTART", "%s", 1, start); 150 fits_modify (&theader, "TVSTOP", "%s", 1, stop); 151 fits_modify (&header, CameraKeyword, "%s", 1, camera); 152 fits_modify (&header, ImagetypeKeyword, "%s", 1, "FRPTS"); 153 fits_modify (&header, FilterKeyword, "%s", 1, filter); 154 fits_modify (&header, CCDnumKeyword, "%s", 1, extname); 155 156 139 157 /* define table layout */ 140 fits_define_table_column (&theader, "F6.1", "X_MIN", "min couple x", "pixels" , 1.0, 0.0);141 fits_define_table_column (&theader, "F6.1", "Y_MIN", "min couple y", "pixels" , 1.0, 0.0);142 fits_define_table_column (&theader, "F6.1", "X_MAX", "max couple x", "pixels" , 1.0, 0.0);143 fits_define_table_column (&theader, "F6.1", "Y_MAX", "max couple y", "pixels" , 1.0, 0.0);158 fits_define_table_column (&theader, "F6.1", "X_MIN", "min couple x", "pixels"); 159 fits_define_table_column (&theader, "F6.1", "Y_MIN", "min couple y", "pixels"); 160 fits_define_table_column (&theader, "F6.1", "X_MAX", "max couple x", "pixels"); 161 fits_define_table_column (&theader, "F6.1", "Y_MAX", "max couple y", "pixels"); 144 162 145 163 /* create table, add data values */ … … 154 172 fits_fwrite_table (g, &table); 155 173 } 174 exit (0); 156 175 } 157 176 … … 166 185 sprintf (line, "%4d/%02d/%02d,%02d:%02d:%02d", 1900+gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, gmt[0].tm_hour, gmt[0].tm_min, gmt[0].tm_sec); 167 186 return (line); 168 169 187 } 170 188 171 intget_version (int argc, char **argv, char *version) {189 void get_version (int argc, char **argv, char *version) { 172 190 173 191 int N;
Note:
See TracChangeset
for help on using the changeset viewer.
