Changeset 37453
- Timestamp:
- Oct 2, 2014, 11:03:19 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140904/Ohana/src/fakeastro
- Files:
-
- 2 added
- 8 edited
-
.mana (modified) (1 diff)
-
include/fakeastro.h (modified) (2 diffs)
-
src/ConfigInit.c (modified) (3 diffs)
-
src/args.c (modified) (1 diff)
-
src/fakeastro_galaxy.c (modified) (3 diffs)
-
src/fakeastro_images.c (added)
-
src/initialize.c (modified) (1 diff)
-
src/insert_fakestar.c (modified) (2 diffs)
-
src/make_fake_images.c (added)
-
src/make_fakestars.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/.mana
r37449 r37453 112 112 echo {$MAX / $dX^2} 113 113 echo {3000 / 34} 114 echo {dsin(30+90)} {dcos(30)} 115 echo {dsin(30-90)} {-dcos(30)} 116 echo {dsin(30-90)} {-1*dcos(30)} 117 echo {dcos(30-90)} {dsin(30)} 118 echo {dcos(120-90)} {dsin(120)} 119 echo {dcos(-20-90)} {dsin(-20)} 120 echo {dcos(-20+90)} {dsin(-20)} 121 echo {dcos(30+90)} {dsin(30)} 122 echo {dcos(30+90)} {-1*dsin(30)} 123 echo {dcos(-20+90)} {-1*dsin(-20)} 124 !ps ux | grep fakes 125 !ps ux | grep fake 126 ll /proc/25713/fd/ 127 !ll /proc/25713/fd/ 128 !ll /proc/25713/fd/ 129 !ll /proc/25713/fd/ 130 !fhead /data/pikake.1/eugene/relastro.20140923/catdir.fake1/s3730.cpt 131 !ls -lrt /data/pikake.1/eugene/relastro.20140923/catdir.fake1/ 132 !ls -lrt /data/pikake.1/eugene/relastro.20140923/catdir.fake1/ 133 !ls -lrt /data/pikake.1/eugene/relastro.20140923/catdir.fake1/*.cpt 134 !ls -lrt /data/pikake.1/eugene/relastro.20140923/catdir.fake1/*.cpt 135 !ls -lrth /data/pikake.1/eugene/relastro.20140923/catdir.fake1/*.cpt 136 !ls -lrth /data/pikake.1/eugene/relastro.20140923/catdir.fake1/*.cp? 137 !ps ux | grep fake 138 kill 25713 139 !kill 25713 -
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/include/fakeastro.h
r37449 r37453 30 30 char CATDIR[DVO_MAX_PATH]; 31 31 char SKY_TABLE[DVO_MAX_PATH]; 32 char MasterPhotcodeFile[DVO_MAX_PATH]; 32 33 33 34 char CATMODE[16]; /* raw, mef, split, mysql */ … … 46 47 int VERBOSE; 47 48 int VERBOSE2; 49 50 int FORCE; 48 51 49 52 SkyRegion UserPatch; -
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/ConfigInit.c
r37449 r37453 5 5 char *config, *file; 6 6 char CatdirPhotcodeFile[256]; 7 struct stat filestat;8 int status;9 7 10 8 /*** load configuration info ***/ … … 30 28 ScanConfig(config, "CATMODE", "%s", 0, CATMODE); 31 29 ScanConfig(config, "CATFORMAT", "%s", 0, CATFORMAT); 30 GetConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 32 31 33 32 sprintf (ImageCat, "%s/Images.dat", CATDIR); … … 39 38 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 40 39 41 // check for existence of CATDIR42 status = stat (CATDIR, &filestat);43 if (status == -1) {44 fprintf (stderr, "directory %s does not exist, giving up\n", CATDIR);45 exit (1);46 }47 48 40 /* update master photcode table if not defined */ 49 41 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 50 if (!LoadPhotcodes (CatdirPhotcodeFile, NULL, FALSE)) {42 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 51 43 fprintf (stderr, "error loading photcode table %s\n", CatdirPhotcodeFile); 52 44 exit (1); -
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/args.c
r37449 r37453 85 85 // } 86 86 87 FORCE = FALSE; 88 if ((N = get_argument (argc, argv, "-force"))) { 89 FORCE = TRUE; 90 remove_argument (N, &argc, argv); 91 } 92 87 93 VERBOSE = VERBOSE2 = FALSE; 88 94 if ((N = get_argument (argc, argv, "-v"))) { -
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_galaxy.c
r37449 r37453 4 4 5 5 int n, i; 6 7 // INITTIME;8 6 9 7 // XXX check for an existing CATDIR and exit? … … 18 16 gauss_init (50000); 19 17 20 int Nloop = 1 0;21 int Nstars = 1000000;18 int Nloop = 1; 19 int Nstars = 2000000; 22 20 23 21 for (n = 0; n < Nloop; n++) { 24 22 23 INITTIME; 24 25 25 FakeAstro_Stars *stars = make_fakestars (Nstars); 26 27 MARKTIME ("generate %d fake stars in %f sec\n", Nstars, dtime); 26 28 27 29 // sort the stars by RA 28 30 sortStars (stars, Nstars); 31 32 MARKTIME ("sorted %d fake stars: %f sec\n", Nstars, dtime); 29 33 30 34 // scan through the stars, loading the containing catalogs … … 44 48 int Nsubset; 45 49 FakeAstro_Stars *subset = make_subset (stars, Nstars, i, region, &Nsubset); 50 // MARKTIME ("subset %d fake stars: %f sec\n", Nsubset, dtime); 46 51 47 52 // In parallel mode, write out the subset to a disk file. Block until a remote host 48 53 // is available. In serial mode, just match against the appropriate region and save 49 54 save_fakestars (subset, Nsubset, hosts, region, skylist[0].filename[0]); 55 // MARKTIME ("saved %d fake stars: %f sec\n", Nsubset, dtime); 56 57 free (subset); 58 SkyListFree (skylist); 50 59 } 60 free (stars); 61 62 MARKTIME ("saved %d fake stars: %f sec\n", Nstars, dtime); 51 63 52 64 // wait for last remote clients to finish -
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/initialize.c
r37449 r37453 1 1 # include "fakeastro.h" 2 3 void usage (void); 4 void usage_client (void); 2 5 3 6 void initialize (int argc, char **argv) { 4 7 8 if (argc == 1) usage(); 9 if (get_argument (argc, argv, "-h")) usage(); 10 if (get_argument (argc, argv, "--h")) usage(); 11 if (get_argument (argc, argv, "-help")) usage(); 12 if (get_argument (argc, argv, "--help")) usage(); 13 5 14 ConfigInit (&argc, argv); 6 15 args (argc, argv); 16 17 // check for existence of CATDIR 18 struct stat filestat; 19 int status = stat (CATDIR, &filestat); 20 if (!FORCE && (status == 0)) { 21 fprintf (stderr, "directory %s exist, refusing to contaminate\n", CATDIR); 22 exit (1); 23 } 24 7 25 } 8 26 -
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/insert_fakestar.c
r37449 r37453 16 16 17 17 int Nsecfilt = catalog[0].Nsecfilt; 18 18 NAVE = Nave = catalog[0].Naverage; 19 NSTARPAR = Nstarpar = catalog[0].Nstarpar; 20 19 21 /** incorporate unmatched image stars? **/ 20 22 for (i = 0; i < Nstars; i++) { … … 50 52 } 51 53 54 // I need a photcode for r-band 55 catalog[0].secfilt[Nave*Nsecfilt+1].M = stars[i].starpar.M_r + stars[i].starpar.DistMag; 56 52 57 catalog[0].starpar[Nstarpar] = stars[i].starpar; 53 58 catalog[0].starpar[Nstarpar].averef = Nave; -
branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fakestars.c
r37449 r37453 1 1 # include "fakeastro.h" 2 2 3 # define Z_GAL 50 .03 # define Z_GAL 500.0 4 4 # define R_GAL 2000.0 5 6 static double iFkap = 1.0 / 4.74047; // (km/sec/kpc) / (milli-arcsec/ year) 7 static double A_oort = +14.5; // km/sec/kpc 8 static double B_oort = -13.0; // km/sec/kpc 9 10 static double U_sol = 9.44; // km/sec 11 static double V_sol = 11.90; // km/sec 12 static double W_sol = 7.20; // km/sec 5 13 6 14 FakeAstro_Stars *make_fakestars (int Nstars) { … … 12 20 // but Greg Green / LSD use the older Reid et al 2004 (ApJ 616, 872) definition 13 21 CoordTransform *transform = InitTransform (COORD_GALACTIC, COORD_CELESTIAL); 22 CoordTransform *transback = InitTransform (COORD_CELESTIAL, COORD_GALACTIC); 14 23 15 24 int i; … … 28 37 double z = rnd_gauss (0.0, Z_GAL); 29 38 double r = sqrt(drand48()) * R_GAL; 30 double L = drand48() * 2 * M_PI; 31 32 double distance = sqrt (SQ(r) + SQ(z)); 33 double B = atan2(z,r); 39 double Lrad = drand48() * 2 * M_PI; 34 40 35 41 // double x = r*cos(L); 36 42 // double y = r*sin(L); 43 44 double distance = sqrt (SQ(r) + SQ(z)); 45 double Brad = atan2(z,r); 46 47 double uL_gal = (A_oort * cos(2.0*Lrad) + B_oort) * cos(Brad) * iFkap; 48 double uB_gal = -0.5*A_oort * sin(2.0*Lrad) * sin(2.0*Brad) * iFkap; 49 50 double uL_sol = (U_sol * sin(Lrad) - V_sol * cos(Lrad)) * iFkap / distance; 51 double uB_sol = ((U_sol * cos(Lrad) + V_sol * sin(Lrad))*sin(Brad) - W_sol*cos(Brad)) * iFkap / distance; 52 53 double uL = uL_gal + uL_sol; 54 double uB = uB_gal + uB_sol; 37 55 38 56 // crude Mr distribution from … … 41 59 double Mr = rnd_gauss (11.25, 1.0); 42 60 61 double L = Lrad*DEG_RAD; 62 double B = Brad*DEG_RAD; 63 43 64 double R, D; 44 65 ApplyTransform (&R, &D, L, B, transform); 45 66 46 stars[Nstars].R = R; 47 stars[Nstars].D = D; 48 stars[Nstars].flag = FALSE; 49 stars[Nstars].found = FALSE; 67 // C1, C2 are from http://arxiv.org/pdf/1306.2945v2.pdf 68 double Rrad = R*RAD_DEG; 69 double Drad = D*RAD_DEG; 50 70 51 stars[Nstars].starpar.galLon = L; 52 stars[Nstars].starpar.galLat = B; 71 double C1 = 72 cos(Drad)*transback->cos_phi + 73 sin(Drad)*cos(Rrad)*transback->sin_phi_sin_Xo - 74 sin(Drad)*sin(Rrad)*transback->sin_phi_cos_Xo; 53 75 54 stars[Nstars].starpar.Ebv = 0.0; 55 stars[Nstars].starpar.dEbv = 0.0; 56 stars[Nstars].starpar.DistMag = 5.0*log10(distance) - 5.0; 57 stars[Nstars].starpar.dDistMag = 0.0; 58 stars[Nstars].starpar.M_r = Mr; 59 stars[Nstars].starpar.dM_r = 0.0; 60 stars[Nstars].starpar.FeH = 0.0; 61 stars[Nstars].starpar.dFeH = 0.0; 76 double C2 = 77 - cos(Rrad)*transback->sin_phi_cos_Xo 78 - sin(Rrad)*transback->sin_phi_sin_Xo; 62 79 63 Nstars ++; 80 double cosBinv = 1.0 / sqrt(C1*C1 + C2*C2); 81 82 // XXX add errors : I need to be able to choose the stars based on the error distribution 83 double uR = cosBinv * (C1 * uL - C2 * uB); 84 double uD = cosBinv * (C1 * uB + C2 * uL); 85 86 stars[i].R = R; 87 stars[i].D = D; 88 stars[i].flag = FALSE; 89 stars[i].found = FALSE; 90 91 stars[i].starpar.galLon = L; 92 stars[i].starpar.galLat = B; 93 94 stars[i].starpar.Ebv = 0.0; 95 stars[i].starpar.dEbv = 0.0; 96 stars[i].starpar.DistMag = 5.0*log10(distance) - 5.0; 97 stars[i].starpar.dDistMag = 0.0; 98 stars[i].starpar.M_r = Mr; 99 stars[i].starpar.dM_r = 0.0; 100 stars[i].starpar.FeH = 0.0; 101 stars[i].starpar.dFeH = 0.0; 102 103 stars[i].starpar.uRA = uR; 104 stars[i].starpar.uDEC = uD; 64 105 } 65 106 return stars;
Note:
See TracChangeset
for help on using the changeset viewer.
