Changeset 6791
- Timestamp:
- Apr 5, 2006, 12:46:25 AM (20 years ago)
- Location:
- trunk/psastro/src
- Files:
-
- 4 added
- 4 edited
-
psastro.c (modified) (2 diffs)
-
psastro.h (modified) (1 diff)
-
psastroArguments.c (modified) (1 diff)
-
psastroDataLoop.c (added)
-
psastroIO.c (modified) (1 diff)
-
psastroLoadData.c (added)
-
psastroParseCamera.c (added)
-
testPSastroLoop.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastro.c
r5560 r6791 3 3 int main (int argc, char **argv) { 4 4 5 psTimerStart ("complete"); 6 5 7 psMetadata *header = NULL; 6 8 7 9 // load configuration information 8 p sMetadata*config = psastroArguments (&argc, argv);10 pmConfig *config = psastroArguments (&argc, argv); 9 11 10 // load the input data (cmp file) 11 psArray *rawstars = psastroReadCMP (&header, argv[2]); 12 // load input data (config and images (signal, noise, mask) 13 psastroParseCamera (config); 14 15 // perform the astrometric solution 16 psastroDataLoop (input, config); 12 17 13 18 // simple layout interpretation, basic WCS conversion … … 23 28 psastroWriteCMP (fpa, argv[3]); 24 29 30 psLogMsg ("psphot", 3, "complete psphot run: %f sec\n", psTimerMark ("complete")); 31 25 32 psFree (config); 26 33 psFree (fpa); -
trunk/psastro/src/psastro.h
r5575 r6791 10 10 # define toTPA toTangentPlane 11 11 # define toSky projection 12 13 // How much of the FPA to load at a time 14 typedef enum { 15 PP_LOAD_NONE, // Don't load anything 16 PP_LOAD_FPA, // Load the entire FPA at once 17 PP_LOAD_CHIP, // Load by chip 18 PP_LOAD_CELL, // Load by cell 19 } ppImageLoadDepth; 20 21 // Configuration data 22 typedef struct { 23 psMetadata *site; // The site configuration 24 psMetadata *camera; // The camera configuration 25 psMetadata *recipe; // The recipe (i.e., specific setups) 26 psMetadata *arguments; // Command-line arguments 27 psMetadata *options; // Command-line recipe options 28 psDB *database; // Database handle 29 } ppConfig; 30 31 // A file to process 32 typedef struct { 33 char *filename; // File name 34 psFits *fits; // The FITS file handle 35 psMetadata *phu; // The FITS header 36 pmFPA *fpa; // The FPA, with pixels and extensions 37 } ppFile; 12 38 13 39 bool pmAstromReadWCS (psPlaneTransform **toFPA, psProjection **toSky, psMetadata *header); -
trunk/psastro/src/psastroArguments.c
r5565 r6791 1 1 # include "psastro.h" 2 3 static void usage (void); 4 static void usage_test (void); 5 6 psMetadata *psastroArguments (int *argc, char **argv) { 7 8 unsigned int Nfail; 9 10 // basic pslib options 11 fprintf (stderr, "starting... %s\n", psLibVersion()); 12 psLogSetFormat ("M"); 13 psLogArguments (argc, argv); 14 psTraceArguments (argc, argv); 15 16 if (*argc != 4) usage (); 17 18 // load config information 19 psMetadata *config = psMetadataAlloc (); 20 config = psMetadataConfigParse (config, &Nfail, argv[1], FALSE); 21 return (config); 22 } 2 # include <glob.h> 23 3 24 4 static void usage (void) { 25 fprintf (stderr, "USAGE: psastro (config) (input)(output)\n");5 fprintf (stderr, "USAGE: psastro [-file image(s)] [-list imagelist] (output)\n"); 26 6 exit (2); 27 7 } 28 8 29 p sMetadata *testArguments (int *argc, char **argv) {9 pmConfig *psastroArguments (int *argc, char **argv) { 30 10 31 unsigned int Nfail; 11 int N; 12 13 if (*argc == 1) usage (); 32 14 33 15 // basic pslib options 34 fprintf (stderr, "starting... %s\n", psLibVersion());35 16 psLogSetFormat ("M"); 36 psLogArguments (argc, argv);37 psTraceArguments (argc, argv);38 17 39 if (*argc != 6) usage_test (); 18 // these other options override the PSPHOT recipe options 19 psMetadata *options = psMetadataAlloc (); 40 20 41 // load config information 42 psMetadata *config = psMetadataAlloc (); 43 config = psMetadataConfigParse (config, &Nfail, argv[1], FALSE); 21 // photcode : used in output to supplement header data (argument or recipe?) 22 if ((N = psArgumentGet (*argc, argv, "-photcode"))) { 23 psArgumentRemove (N, argc, argv); 24 psMetadataAddStr (options, PS_LIST_TAIL, "PHOTCODE", PS_META_REPLACE, "", argv[N]); 25 psArgumentRemove (N, argc, argv); 26 } 27 28 // load config data from default locations 29 pmConfig *config = pmConfigRead(argc, argv); 30 31 // Storage for other command-line arguments 32 config->arguments = psMetadataAlloc (); 33 34 // save these recipe options until we have loaded the options 35 psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "PSASTRO.OPTIONS", PS_DATA_METADATA, "", options); 36 37 // we load all input files onto a psArray, to be parsed later 38 psArray *input = psArrayAlloc (16); 39 input->n = 0; 40 41 // load the list of filenames the supplied file (may be a glob: "file*.fits") 42 if ((N = psArgumentGet (*argc, argv, "-file"))) { 43 glob_t globList; 44 psArgumentRemove (N, argc, argv); 45 globList.gl_offs = 0; 46 glob (argv[N], 0, NULL, &globList); 47 for (int i = 0; i < globList.gl_pathc; i++) { 48 char *filename = psStringCopy (globList.gl_pathv[i]); 49 psArrayAdd (input, 16, filename); 50 } 51 psArgumentRemove (N, argc, argv); 52 } 53 54 // load the list from the supplied text file 55 if ((N = psArgumentGet (*argc, argv, "-list"))) { 56 int nItems; 57 char line[1024]; // XXX limits the list lines to 1024 chars 58 char word[1024]; 59 char *filename; 60 61 psArgumentRemove (N, argc, argv); 62 FILE *f = fopen (argv[N], "r"); 63 if (f == NULL) { 64 psAbort ("psphot", "unable to open specified list file"); 65 } 66 while (fgets (line, 1024, f) != NULL) { 67 nItems = sscanf (line, "%s", word); 68 switch (nItems) { 69 case 0: 70 break; 71 case 1: 72 filename = psStringCopy (word); 73 psArrayAdd (input, 16, filename); 74 break; 75 default: 76 // rigid format, no comments allowed? 77 psAbort ("psphot", "error parsing input list file"); 78 break; 79 } 80 } 81 psArgumentRemove (N, argc, argv); 82 } 83 if (input->n < 1) usage (); 84 85 // input list gets places as an array on the config->arguements list 86 psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "INPUT", PS_DATA_ARRAY, "", input); 87 88 if (*argc != 2) usage (); 89 90 // output positions is fixed 91 psMetadataAddStr (config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[2]); 92 93 psTrace(__func__, 1, "Done with psphotArguments...\n"); 44 94 return (config); 45 95 } 46 47 static void usage_test (void) {48 fprintf (stderr, "USAGE: psastro-mktest (config) (cmpfile) (catfile) (rawfile) (reffile)\n");49 exit (2);50 } -
trunk/psastro/src/psastroIO.c
r5565 r6791 36 36 stars->n = 0; 37 37 38 // we have fixed bytes / line : use that info 38 39 39 for (int i = 0; i < nStars; i++) { 40 40 fread (line, 1, 66, f);
Note:
See TracChangeset
for help on using the changeset viewer.
