Changeset 33574
- Timestamp:
- Mar 21, 2012, 6:42:08 AM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src
- Files:
-
- 2 added
- 10 edited
-
libdvo/Makefile (modified) (1 diff)
-
libdvo/include/dvo.h (modified) (1 diff)
-
libdvo/src/dvo_photcode_ops.c (modified) (1 diff)
-
libdvo/src/dvo_photcode_utils.c (added)
-
photdbc/Makefile (modified) (1 diff)
-
photdbc/include/photdbc.h (modified) (2 diffs)
-
photdbc/src/args.c (modified) (1 diff)
-
photdbc/src/initialize.c (modified) (2 diffs)
-
photdbc/src/photdbc.c (modified) (2 diffs)
-
photdbc/src/photdbc_catalogs.c (added)
-
relastro/src/initialize.c (modified) (1 diff)
-
relphot/src/initialize.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/Makefile
r33446 r33574 44 44 $(SRC)/dvosorts.$(ARCH).o \ 45 45 $(SRC)/dvo_photcode_ops.$(ARCH).o \ 46 $(SRC)/dvo_photcode_utils.$(ARCH).o \ 46 47 $(SRC)/LoadPhotcodes.$(ARCH).o \ 47 48 $(SRC)/LoadPhotcodesText.$(ARCH).o \ -
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/include/dvo.h
r33564 r33574 470 470 int PhotColorTiny (AverageTiny *average, SecFilt *secfilt, MeasureTiny *measure, int c1, int c2, double *color); 471 471 472 473 472 PhotCodeData *GetPhotcodeTable (void); 474 473 void SetPhotcodeTable (PhotCodeData *); 475 474 476 475 int *GetSecFiltMap(PhotCodeData *ouput, PhotCodeData* input); 476 PhotCode **ParsePhotcodeList (char *rawlist, int *nphotcodes, int needAve); 477 477 478 478 int LoadPhotcodes (char *catdir_file, char *master_file, int readwrite); -
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/dvo_photcode_ops.c
r31450 r33574 857 857 /***********************************************/ 858 858 859 // Create a map between the secfilt values from one photcode table to another860 int *GetSecFiltMap(PhotCodeData *output, PhotCodeData *input) {861 int i, j;862 int NsecfiltIn = input[0].Nsecfilt;863 int NsecfiltOut = output[0].Nsecfilt;864 int *map;865 ALLOCATE(map, int, NsecfiltIn);866 867 // loop over entries in the input table868 for (i = 0; i < NsecfiltIn; i++) {869 int code = input[0].codeNsec[i];870 int entry = -1;871 // find the matching entry in the output table872 for (j = 0; j < NsecfiltOut; j++) {873 int outcode = output[0].codeNsec[j];874 if (code == outcode) {875 entry = j;876 break;877 }878 }879 // if (entry == -1) {880 // // entry is missing fail (no printfs in this file)881 // free(map);882 // return(FALSE);883 // }884 885 // if entry is still -1, we will skip this one (not map into the output db)886 map[i] = entry;887 }888 889 return map;890 }891 859 892 860 /* photcode table should have the following format: -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/Makefile
r33518 r33574 23 23 PHOTDBC = \ 24 24 $(SRC)/photdbc.$(ARCH).o \ 25 $(SRC)/photdbc_catalogs.$(ARCH).o \ 25 26 $(SRC)/initialize.$(ARCH).o \ 26 27 $(SRC)/ConfigInit.$(ARCH).o \ -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/include/photdbc.h
r31635 r33574 20 20 int Nmeas; 21 21 } StatType; 22 23 int PARALLEL; 24 int PARALLEL_MANUAL; 25 int PARALLEL_SERIAL; 26 27 int HOST_ID; 28 char *HOSTDIR; 22 29 23 30 // need to get RADIUS from Config … … 124 131 int copy_images (char *outdir); 125 132 void usage(); 133 134 int photdbc_catalogs (SkyList *skylist, int hostID); 135 int photdbc_parallel (SkyList *skylist); -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/args.c
r30616 r33574 83 83 } 84 84 85 // XXX for the moment, make this selection manual. it needs to be automatic 86 // based on the state of the SkyTable 87 PARALLEL = FALSE; 88 if ((N = get_argument (argc, argv, "-parallel"))) { 89 PARALLEL = TRUE; 90 remove_argument (N, &argc, argv); 91 } 92 // this is a test mode : rather than launching the remote jobs and waiting for completion, 93 // relphot will simply list the remote command and wait for the user to signal completion 94 PARALLEL_MANUAL = FALSE; 95 if ((N = get_argument (argc, argv, "-parallel-manual"))) { 96 PARALLEL = TRUE; // -parallel-manual implies -parallel 97 PARALLEL_MANUAL = TRUE; 98 remove_argument (N, &argc, argv); 99 } 100 // this is a test mode : rather than launching the relphot_client jobs remotely, they are 101 // run in serial via 'system' 102 PARALLEL_SERIAL = FALSE; 103 if ((N = get_argument (argc, argv, "-parallel-serial"))) { 104 if (PARALLEL_MANUAL) { 105 fprintf (stderr, "ERROR: cannot mix -parallel-manual and -parallel-serial\n"); 106 exit (1); 107 } 108 PARALLEL = TRUE; // -parallel-serial implies -parallel 109 PARALLEL_SERIAL = TRUE; 110 remove_argument (N, &argc, argv); 111 } 112 85 113 if (argc != 2) usage(); 86 114 -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/initialize.c
r33569 r33574 2 2 3 3 void initialize (int argc, char **argv) { 4 5 int NPHOTCODES;6 char *codename, *ptr, *list;7 4 8 5 /* are these set correctly? */ … … 15 12 args (argc, argv); 16 13 17 NphotcodesDrop = 0; 18 photcodesDrop = NULL; 19 ptr = NULL; 20 if (PHOTCODE_DROP_LIST != NULL) { 21 NPHOTCODES = 10; 22 ALLOCATE (photcodesDrop, PhotCode *, NPHOTCODES); 23 24 /* parse the comma-separated list of photcodesDrop */ 25 list = PHOTCODE_DROP_LIST; 26 while ((codename = strtok_r (list, ",", &ptr)) != NULL) { 27 list = NULL; // pass NULL on successive strtok_r calls 28 fprintf (stderr, "PHOTCODE_LIST: %s\n", PHOTCODE_DROP_LIST); 29 fprintf (stderr, "codename: %s\n", codename); 30 if ((photcodesDrop[NphotcodesDrop] = GetPhotcodebyName (codename)) == NULL) { 31 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename); 32 exit (1); 33 } 34 NphotcodesDrop ++; 35 CHECK_REALLOCATE (photcodesDrop, PhotCode *, NPHOTCODES, NphotcodesDrop, 10); 36 } 37 } 38 39 NphotcodesSkip = 0; 40 photcodesSkip = NULL; 41 if (PHOTCODE_SKIP_LIST != NULL) { 42 NPHOTCODES = 10; 43 ALLOCATE (photcodesSkip, PhotCode *, NPHOTCODES); 44 45 /* parse the comma-separated list of photcodesSkip */ 46 list = PHOTCODE_SKIP_LIST; 47 while ((codename = strtok_r (list, ",", &ptr)) != NULL) { 48 list = NULL; // pass NULL on successive strtok_r calls 49 fprintf (stderr, "PHOTCODE_LIST: %s\n", PHOTCODE_SKIP_LIST); 50 fprintf (stderr, "codename: %s\n", codename); 51 if ((photcodesSkip[NphotcodesSkip] = GetPhotcodebyName (codename)) == NULL) { 52 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename); 53 exit (1); 54 } 55 NphotcodesSkip ++; 56 CHECK_REALLOCATE (photcodesSkip, PhotCode *, NPHOTCODES, NphotcodesSkip, 10); 57 } 58 } 14 photcodesDrop = ParsePhotcodeList (PHOTCODE_DROP_LIST, &NphotcodeDrop, FALSE); 15 photcodesSkip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodeSkip, FALSE); 59 16 60 17 if (SHOW_PARAMS) { -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/photdbc.c
r33218 r33574 3 3 int main (int argc, char **argv) { 4 4 5 int i;6 char *skyfile;7 Catalog incatalog;8 Catalog outcatalog;9 5 SkyTable *sky; 10 6 SkyList *skylist; … … 20 16 SkyTableSetFilenames (sky, CATDIR, "cpt"); 21 17 skylist = SkyListByPatch (sky, -1, ®ION); 22 for (i = 0; i < skylist[0].Nregions; i++) {23 if (VERBOSE) fprintf (stderr, "%s\n", skylist[0].regions[i][0].name);24 18 25 // set the parameters which guide catalog open/load/create 26 incatalog.filename = skylist[0].filename[i]; 27 incatalog.Nsecfilt = GetPhotcodeNsecfilt (); 28 incatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; 29 30 // an error exit status here is a significant error 31 if (!dvo_catalog_open (&incatalog, skylist[0].regions[i], VERBOSE, "r")) { 32 fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", incatalog.filename); 33 exit (2); 34 } 35 // skip empty input catalogs 36 if (!incatalog.Naves_disk) { 37 dvo_catalog_unlock (&incatalog); 38 dvo_catalog_free (&incatalog); 39 continue; 40 } 41 42 // create output catalog filename 43 outcatalog.filename = strsubs (incatalog.filename, CATDIR, argv[1]); 44 if (outcatalog.filename == NULL) Shutdown ("error with input catalog name"); 45 46 // define outcatalog open parameters 47 outcatalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 48 outcatalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 49 outcatalog.Nsecfilt = incatalog.Nsecfilt; // inherit from the incatalog 50 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 51 52 // output catalogs always represent the same skyregions as the input catalogs 53 if (!dvo_catalog_open (&outcatalog, skylist[0].regions[i], VERBOSE, "w")) { 54 fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", outcatalog.filename); 55 exit (2); 56 } 57 58 // the output catalog needs to have the same values for 'objID' and 'sorted' as the input 59 outcatalog.objID = incatalog.objID; 60 outcatalog.sorted = incatalog.sorted; 61 if (!incatalog.sorted) { 62 fprintf (stderr, "ERROR: input db must be sorted: %s\n", incatalog.filename); 63 exit (2); 64 } 65 66 /* limit number of measures based on selections */ 67 make_subcatalog (&outcatalog, &incatalog, skylist[0].regions[i]); 68 69 // XXX add other filters here: 70 // join_stars (&outcatalog); 71 // unique_measures (catalog); 72 // flag_measures (&db, catalog); 73 // get_mags (catalog); 74 75 dvo_catalog_save (&outcatalog, VERBOSE); 76 dvo_catalog_unlock (&outcatalog); 77 dvo_catalog_free (&outcatalog); 78 79 dvo_catalog_unlock (&incatalog); 80 dvo_catalog_free (&incatalog); 81 } 82 83 skyfile = SkyTableFilename (argv[1]); 84 SkyTableSave (sky, skyfile); 19 // hostID is 0 for master program 20 photdbc_catalogs (skylist, 0); 85 21 exit (0); 86 22 } -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/initialize.c
r33532 r33574 63 63 } 64 64 65 PhotCode **ParsePhotcodeList (char *rawlist, int *nphotcodes, int needAve) {66 67 *nphotcodes = 0;68 if (!rawlist) return NULL;69 70 int Nphotcodes = 0;71 int NPHOTCODES = 10;72 PhotCode **photcodes = NULL;73 ALLOCATE (photcodes, PhotCode *, NPHOTCODES);74 75 /* parse the comma-separated list of photcodes */76 char *myList = strcreate(rawlist);77 char *list = myList;78 char *codename = NULL;79 char *ptr = NULL;80 while ((codename = strtok_r (list, ",", &ptr)) != NULL) {81 list = NULL; // pass NULL on successive strtok_r calls82 if ((photcodes[Nphotcodes] = GetPhotcodebyName (codename)) == NULL) {83 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);84 exit (1);85 }86 if (needAve && (photcodes[Nphotcodes][0].type != PHOT_SEC)) {87 fprintf (stderr, "photcode %s is not an filter type (SEC)\n", codename);88 exit (1);89 }90 Nphotcodes ++;91 CHECK_REALLOCATE (photcodes, PhotCode *, NPHOTCODES, Nphotcodes, 10);92 }93 free (myList);94 95 *nphotcodes = Nphotcodes;96 return photcodes;97 } -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/initialize.c
r33472 r33574 1 1 # include "relphot.h" 2 3 void ParsePhotcodeList (char *word);4 2 5 3 void initialize (int argc, char **argv) { … … 13 11 // only a single remaining argument in this mode (the list of photcodes, eg g,r,i) 14 12 PhotcodeList = strcreate (argv[1]); 15 ParsePhotcodeList (PhotcodeList);13 photcodes = ParsePhotcodeList (PhotcodeList, &Nphotcodes, TRUE); // require SEC photcodes 16 14 } 17 15 if (USE_GRID && (Nphotcodes > 1)) { … … 69 67 // load the list of photcodes into the globals (photcodes, Nphotcodes) 70 68 PhotcodeList = strcreate (argv[1]); 71 ParsePhotcodeList (PhotcodeList);69 photcodes = ParsePhotcodeList (PhotcodeList, &Nphotcodes, TRUE); // require SEC photcodes 72 70 } 73 71 74 void ParsePhotcodeList (char *word) {72 void ParsePhotcodeList_old (char *word) { 75 73 76 74 Nphotcodes = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
