Changeset 37602
- Timestamp:
- Nov 14, 2014, 8:40:19 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140904/Ohana/src/uniphot
- Files:
-
- 6 edited
-
include/setgalmodel.h (modified) (2 diffs)
-
src/initialize_setgalmodel.c (modified) (7 diffs)
-
src/setgalmodel.c (modified) (1 diff)
-
src/setgalmodel_client.c (modified) (1 diff)
-
src/update_catalog_setgalmodel.c (modified) (5 diffs)
-
src/update_dvo_setgalmodel.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140904/Ohana/src/uniphot/include/setgalmodel.h
r37434 r37602 10 10 char *HOSTDIR; 11 11 int VERBOSE; 12 int TESTING; 12 13 int UPDATE; 13 14 int PARALLEL; … … 38 39 // int SetSignals PROTO((void)); 39 40 40 int update_dvo_setgalmodel PROTO(( char *corrfile));41 int update_dvo_setgalmodel_parallel PROTO((SkyTable *sky , char *corrfile));41 int update_dvo_setgalmodel PROTO((void)); 42 int update_dvo_setgalmodel_parallel PROTO((SkyTable *sky)); 42 43 43 44 int update_catalog_setgalmodel PROTO((Catalog *catalog)); -
branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/initialize_setgalmodel.c
r37434 r37602 2 2 3 3 void usage_setgalmodel () { 4 fprintf (stderr, "USAGE: setgalmodel (corrections)[options]\n");4 fprintf (stderr, "USAGE: setgalmodel [options]\n"); 5 5 fprintf (stderr, " options:\n"); 6 6 fprintf (stderr, " -v : verbose mode\n"); … … 43 43 exit (1); 44 44 } 45 46 // XXX add to config? 47 if (!InitGalaxyModel ("ROESER")) { 48 fprintf (stderr, "failed to init galaxy model\n"); 49 exit (2); 50 } 45 51 } 46 52 … … 83 89 if ((N = get_argument (argc, argv, "-v"))) { 84 90 VERBOSE = TRUE; 91 remove_argument (N, &argc, argv); 92 } 93 94 TESTING = FALSE; 95 if ((N = get_argument (argc, argv, "-testing"))) { 96 TESTING = TRUE; 85 97 remove_argument (N, &argc, argv); 86 98 } … … 118 130 } 119 131 120 if (argc != 2) usage_setgalmodel();132 if (argc != 1) usage_setgalmodel(); 121 133 122 134 return (TRUE); … … 124 136 125 137 void usage_setgalmodel_client () { 126 fprintf (stderr, "USAGE: setgalmodel_client (correction)-hostID (hostID) -catdir (catdir) -hostdir (hostdir) [options]\n");138 fprintf (stderr, "USAGE: setgalmodel_client -hostID (hostID) -catdir (catdir) -hostdir (hostdir) [options]\n"); 127 139 fprintf (stderr, " options:\n"); 128 140 fprintf (stderr, " -region Rmin Rmax Dmin Dmax\n"); … … 158 170 exit (1); 159 171 } 172 173 // XXX add to config? 174 if (!InitGalaxyModel ("ROESER")) { 175 fprintf (stderr, "failed to init galaxy model\n"); 176 exit (2); 177 } 160 178 } 161 179 … … 223 241 if (!CATDIR) usage_setgalmodel_client(); 224 242 225 if (argc != 2) usage_setgalmodel_client();243 if (argc != 1) usage_setgalmodel_client(); 226 244 return (TRUE); 227 245 } -
branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/setgalmodel.c
r37434 r37602 8 8 initialize_setgalmodel (argc, argv); 9 9 10 // argv[1] holds the correction file 11 status = update_dvo_setgalmodel (argv[1]); 10 status = update_dvo_setgalmodel (); 12 11 13 12 if (!status) exit (1); -
branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/setgalmodel_client.c
r37434 r37602 15 15 initialize_setgalmodel_client (argc, argv); 16 16 17 update_dvo_setgalmodel ( argv[1]);17 update_dvo_setgalmodel (); 18 18 19 19 exit (0); -
branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/update_catalog_setgalmodel.c
r37497 r37602 1 1 # include "setgalmodel.h" 2 3 static double iFkap = 0.001 / 4.74047; // (km/sec/kpc) / (arcsec/ year)4 static double A_oort = +14.5; // km/sec/kpc5 static double B_oort = -13.0; // km/sec/kpc6 7 static double U_sol = 9.44; // km/sec8 static double V_sol = 11.90; // km/sec9 static double W_sol = 7.20; // km/sec10 2 11 3 int update_catalog_setgalmodel (Catalog *catalog) { … … 14 6 15 7 // choose this number more judiciously... 16 time_t timeRef = ohana_date_to_sec("20 11/05/11,00:00:00");8 time_t timeRef = ohana_date_to_sec("2000/01/01,00:00:00"); 17 9 18 10 Average *average = catalog[0].average; 11 12 if ((catalog[0].Nstarpar_disk > 0) && (catalog[0].Nstarpar == 0)) { 13 fprintf (stderr, "ERROR: failed to load starpar data\n"); 14 exit (2); 15 } 19 16 20 17 CoordTransform *transform = InitTransform (COORD_CELESTIAL, COORD_GALACTIC); … … 27 24 m = average[i].starparOffset; 28 25 StarPar *starpar = &catalog[0].starpar[m]; 26 27 // fake or real QSOs are marked with FeH = +/- 100.0 28 if (fabs(starpar->FeH) > 99.0) continue; 29 29 30 double distance = pow(10.0, 0.2*(starpar->DistMag + 5.0)); 30 31 31 double glon= starpar->galLon * RAD_DEG;32 double glat= starpar->galLat * RAD_DEG;32 double Lrad = starpar->galLon * RAD_DEG; 33 double Brad = starpar->galLat * RAD_DEG; 33 34 34 double uL_gal = (A_oort * cos(2.0*glon) + B_oort) * cos(glat) * iFkap;35 double uB_gal = -0.5*A_oort * sin(2.0*glon) * sin(2.0*glat) * iFkap;35 double uL_gal, uB_gal; 36 GalaxyMotionModel_radians(&uL_gal, &uB_gal, Lrad, Brad); 36 37 37 double uL_sol = (U_sol * sin(glon) - V_sol * cos(glon)) * iFkap / distance;38 double uB_sol = ((U_sol * cos(glon) + V_sol * sin(glon))*sin(glat) - W_sol*cos(glat)) * iFkap / distance;38 double uL_sol, uB_sol; 39 SolarMotionModel_radians(&uL_sol, &uB_sol, Lrad, Brad, distance); 39 40 40 41 double uL = uL_gal + uL_sol; 41 42 double uB = uB_gal + uB_sol; 42 43 43 // C1, C2 are from http://arxiv.org/pdf/1306.2945v2.pdf 44 double Rrad = average[i].R*RAD_DEG; 45 double Drad = average[i].D*RAD_DEG; 46 47 double C1 = 48 cos(Drad)*transform->cos_phi + 49 sin(Drad)*cos(Rrad)*transform->sin_phi_sin_Xo - 50 sin(Drad)*sin(Rrad)*transform->sin_phi_cos_Xo; 51 52 double C2 = 53 - cos(Rrad)*transform->sin_phi_cos_Xo 54 - sin(Rrad)*transform->sin_phi_sin_Xo; 55 56 double cosBinv = 1.0 / sqrt(C1*C1 + C2*C2); 57 58 // XXX add errors : I need to be able to choose the stars based on the error distribution 59 double uR = cosBinv * (C1 * uL - C2 * uB); 60 double uD = cosBinv * (C1 * uB + C2 * uL); 44 // XXX: amplify motion to make tests easier: 45 if (TESTING) { 46 uL *= 100.0; 47 uB *= 100.0; 48 } 49 50 double uR, uD; 51 TransformProperMotion (&uR, &uD, uL, uB, average[i].R, average[i].D, transform); 61 52 62 53 starpar->uRA = uR; … … 69 60 for (j = 0; j < average[i].Nmeasure; j++) { 70 61 71 int Nm = m + j; 72 double dtime = (measure[Nm].t - timeRef) / 86400.0 / 365.25; 62 double dtime = (measure[j].t - timeRef) / 86400.0 / 365.25; 73 63 74 64 // do not modify the original Xccd,Yccd values 75 measure[ Nm].RoffGAL = uR * dtime; // XXX divide by dcos? project and calculate?76 measure[ Nm].DoffGAL = uD * dtime; // XXX divide by dcos? project and calculate?65 measure[j].RoffGAL = uR * dtime; // XXX divide by dcos? project and calculate? 66 measure[j].DoffGAL = uD * dtime; // XXX divide by dcos? project and calculate? 77 67 } 78 68 } … … 81 71 } 82 72 83 // I am using the galactic rotation and solar motion model to predict the reflex proper84 // motion of stars in the database.85 86 /*****87 88 From Siegfreid Roeser:89 90 Dear Gene,91 92 please find attached our approach for galactic rotation and93 solar motion that we assumed in our approach last fall.94 (Hope I understood correctly what you requested at the95 telecon). If not, please come back.96 97 fkap = 4.74047d-0 {km/s/kpc}/{mas/y}98 99 gl,gb is galactic longitude resp. latitude100 101 102 PARAMETER (distance= 1.d0,Aoort=14.5d0 ,Boort=-13.d0 )103 kpc km/s/kpc km/s/kpc104 PARAMETER (Usol = 9.44d0, Vsol =11.90d0, Wsol = 7.20d0)105 km/s106 C107 C Gal. Rotation108 C109 proper motions in longitude/latitude110 111 emulgal = (AOORT*dcos(2.d0*gl)+BOORT)*dcos(gb)/fkap112 emubgal = -0.5d0*AOORT*dsin(2.d0*gl)*dsin(2.d0*gb)/fkap113 c114 c Solar Motion115 cc116 emulsol = Usol*dsin(gl) - Vsol*dcos(gl)117 emulsol = emulsol/fkap/distance118 emubsol = Usol*dsin(gb)*dcos(gl)+Vsol*dsin(gb)*dsin(gl)119 emubsol = emubsol -Wsol*dcos(gb)120 emubsol = emubsol/fkap/distance121 122 123 ******/ -
branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/update_dvo_setgalmodel.c
r37434 r37602 1 1 # include "setgalmodel.h" 2 2 3 int update_dvo_setgalmodel ( char *corrfile) {3 int update_dvo_setgalmodel (void) { 4 4 5 5 SkyTable *sky = NULL; … … 13 13 14 14 if (PARALLEL && !HOST_ID) { 15 int status = update_dvo_setgalmodel_parallel (sky , corrfile);15 int status = update_dvo_setgalmodel_parallel (sky); 16 16 return status; 17 17 } … … 38 38 catalog.catformat = DVO_FORMAT_UNDEF; // not needed since we skip empty catalogs 39 39 catalog.catmode = DVO_MODE_UNDEF; // not needed since we skip empty catalogs 40 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF ;40 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF | LOAD_STARPAR; 41 41 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 42 42 … … 76 76 # define DEBUG 1 77 77 78 int update_dvo_setgalmodel_parallel (SkyTable *sky , char *corrfile) {78 int update_dvo_setgalmodel_parallel (SkyTable *sky) { 79 79 80 80 // now launch the setgalmodel_client jobs to the parallel hosts 81 82 char *abscorrfile = abspath (corrfile, DVO_MAX_PATH);83 81 84 82 // load the list of hosts … … 94 92 95 93 char command[1024]; 96 snprintf (command, 1024, "setgalmodel_client %s-hostID %d -catdir %s -hostdir %s -region %f %f %f %f",97 abscorrfile,table->hosts[i].hostID, CATDIR, table->hosts[i].pathname,94 snprintf (command, 1024, "setgalmodel_client -hostID %d -catdir %s -hostdir %s -region %f %f %f %f", 95 table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, 98 96 UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 99 97 … … 124 122 } 125 123 } 126 free (abscorrfile);127 124 128 125 // wait for the remote jobs to be completed
Note:
See TracChangeset
for help on using the changeset viewer.
