Changeset 37458
- Timestamp:
- Oct 3, 2014, 6:14:26 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src
- Files:
-
- 5 edited
-
args.c (modified) (1 diff)
-
fakeastro.c (modified) (1 diff)
-
fakeastro_galaxy.c (modified) (1 diff)
-
fakeastro_images.c (modified) (2 diffs)
-
make_fake_stars.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/args.c
r37453 r37458 99 99 VERBOSE = VERBOSE2 = TRUE; 100 100 remove_argument (N, &argc, argv); 101 } 102 103 if (FAKEASTRO_OP == OP_IMAGES) { 104 // mandatory arguments to fakeastro -images -input catdir -output -catdir -images images.fits 105 if ((N = get_argument (argc, argv, "-input"))) { 106 remove_argument (N, &argc, argv); 107 CATDIR_INPUT = strcreate (argv[N]); 108 remove_argument (N, &argc, argv); 109 } else { 110 fprintf (stderr, "missing -input (catdir)\n"); 111 exit (2); 112 } 113 if ((N = get_argument (argc, argv, "-output"))) { 114 remove_argument (N, &argc, argv); 115 CATDIR_OUTPUT = strcreate (argv[N]); 116 remove_argument (N, &argc, argv); 117 } else { 118 fprintf (stderr, "missing -output (catdir)\n"); 119 exit (2); 120 } 121 if ((N = get_argument (argc, argv, "-images"))) { 122 remove_argument (N, &argc, argv); 123 IMAGES_INPUT = strcreate (argv[N]); 124 remove_argument (N, &argc, argv); 125 } else { 126 fprintf (stderr, "missing -images (images)\n"); 127 exit (2); 128 } 101 129 } 102 130 -
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro.c
r37449 r37458 5 5 /* get configuration info, args */ 6 6 initialize (argc, argv); 7 8 SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);9 SkyTableSetFilenames (sky, CATDIR, "cpt");10 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch);11 12 // load the list of hosts13 HostTable *hosts = NULL;14 if (PARALLEL) {15 hosts = HostTableLoad (CATDIR, sky->hosts);16 if (!hosts) {17 fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);18 exit (1);19 }20 21 // ensure that the paths are absolute path names22 int i;23 for (i = 0; i < hosts->Nhosts; i++) {24 char *tmppath = abspath (hosts->hosts[i].pathname, DVO_MAX_PATH);25 free (hosts->hosts[i].pathname);26 hosts->hosts[i].pathname = tmppath;27 }28 29 // set up the array of active hosts30 init_remote_hosts ();31 }32 7 33 8 switch (FAKEASTRO_OP) { -
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_galaxy.c
r37453 r37458 2 2 3 3 int fakeastro_galaxy (SkyList *skylistInput, HostTable *hosts) { 4 5 SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 6 SkyTableSetFilenames (sky, CATDIR, "cpt"); 7 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch); 8 9 // load the list of hosts 10 HostTable *hosts = NULL; 11 if (PARALLEL) { 12 hosts = HostTableLoad (CATDIR, sky->hosts); 13 if (!hosts) { 14 fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR); 15 exit (1); 16 } 17 18 // ensure that the paths are absolute path names 19 int i; 20 for (i = 0; i < hosts->Nhosts; i++) { 21 char *tmppath = abspath (hosts->hosts[i].pathname, DVO_MAX_PATH); 22 free (hosts->hosts[i].pathname); 23 hosts->hosts[i].pathname = tmppath; 24 } 25 26 // set up the array of active hosts 27 init_remote_hosts (); 28 } 4 29 5 30 int n, i; -
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_images.c
r37453 r37458 1 1 # include "fakeastro.h" 2 2 3 int fakeastro_images (SkyList *skylistInput, HostTable *hosts) { 3 int fakeastro_images (HostTable *hosts) { 4 5 SkyTable *skyTableInput = SkyTableLoadOptimal (CATDIR_INPUT, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 6 SkyTableSetFilenames (skyTableInput, CATDIR_INPUT, "cpt"); 7 // SkyList *skyListInput = SkyListByPatch (skyInpt, -1, &UserPatch); 8 9 SkyTable *skyTableOutput = SkyTableLoadOptimal (CATDIR_OUTPUT, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 10 SkyTableSetFilenames (skyTableOutput, CATDIR_OUTPUT, "cpt"); 11 // SkyList *skyListOutput = SkyListByPatch (skyInpt, -1, &UserPatch); 4 12 5 13 int Nimages; 6 14 Images *images = load_template_images (&Nimages); 7 15 8 Images *bores = make_boresites (images, Nimages, Nbores); 9 10 for (i = 0; i < Nbores; i++) { 16 for (i = 0; i < Nimages; i++) { 11 17 12 18 // we only want to make fake images for the exposures … … 16 22 17 23 for (j = 0; j < NfakeImages; j++) { 18 Stars *fakeStars = make_fake_stars ( &fakeImages[i], &NfakeStars);24 Stars *fakeStars = make_fake_stars (skyTableInput, skyTableOutput, &fakeImages[i], &NfakeStars); 19 25 20 26 // save fake stars... -
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_stars.c
r37457 r37458 1 1 # include "fakeastro.h" 2 2 3 Stars *make_fake_stars ( Image *image, int *nfakeStars) {3 Stars *make_fake_stars (SkyTable *skyTableInput, SkyTable *skyTableOutput, Image *image, int *nfakeStars) { 4 4 5 5 // find the R,D coords of the 4 corners and 4 edge midpoints … … 24 24 } 25 25 26 SkyRegion *regions = SkyListByBounds (skyTable, -1, Rmin, Rmax, Dmin, Dmax); 26 SkyList *skyInput = SkyListByBounds (skyTableInput, -1, Rmin, Rmax, Dmin, Dmax); 27 28 int Nstars = 0; 27 29 28 30 // load stars from database in these regions 29 for (i = 0; i < regions->Nregions; i++) {31 for (i = 0; i < skyInput->Nregions; i++) { 30 32 31 33 // set the parameters which guide catalog open/load/create 32 catalog.filename = skylist[0].filename[i]; 33 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 34 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 35 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF | LOAD_LENSING; 36 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 37 if (options.update) catalog.catflags = LOAD_AVES | LOAD_MISS | LOAD_SECF; 38 39 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "r")) { 40 continue; 41 } 42 } else { 43 // an error exit status here is a significant error (disk I/O or file access) 44 // XXX should this be "a" for options.update? 45 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) { 46 fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", catalog.filename); 47 exit (2); 48 } 49 50 // load refstars in region 51 load_something (); 34 catInput.filename = skyInput[0].filename[i]; 35 catInput.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 36 catInput.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 37 catInput.catflags = LOAD_AVES | LOAD_SECF; 38 catInput.Nsecfilt = GetPhotcodeNsecfilt (); 39 if (!dvo_catalog_open (&catInput, skylist[0].regions[i], VERBOSE, "r")) { 40 continue; 41 } 52 42 53 43 // generate fake measurements for this image 54 stars = make_fake_stars_region (inCatalog); 44 stars = make_fake_stars_catalog (catInput, stars, &Nstars); 45 46 } 55 47 56 save_fake_stars (stars); 48 // will these match, or should I mangle the input cpt names? 49 SkyList *skyOutput = SkyListByBounds (skyTableOutput, -1, Rmin, Rmax, Dmin, Dmax); 50 51 // load stars from database in these regions 52 for (i = 0; i < skyOutput->Nregions; i++) { 53 if (!dvo_catalog_open (&catOutput, skyOutput[0].regions[i], VERBOSE, "w")) { 54 fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", catalog.filename); 55 exit (2); 56 } 57 58 save_fake_stars (stars, Nstars, catOutput); 57 59 } 58 60 } 59
Note:
See TracChangeset
for help on using the changeset viewer.
