Changeset 37417
- Timestamp:
- Sep 19, 2014, 5:47:19 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140904/Ohana/src/addstar
- Files:
-
- 1 added
- 15 edited
- 1 moved
-
Makefile (modified) (5 diffs)
-
include/addstar.h (modified) (1 diff)
-
include/loadstarpar.h (modified) (1 diff)
-
src/args_loadstarpar.c (modified) (3 diffs)
-
src/build_links.c (modified) (1 diff)
-
src/coord_transforms.c (added)
-
src/find_matches_starpar.c (modified) (6 diffs)
-
src/loadstarpar.c (modified) (3 diffs)
-
src/loadstarpar_catalog.c (modified) (1 diff)
-
src/loadstarpar_client.c (modified) (2 diffs)
-
src/loadstarpar_io.c (modified) (4 diffs)
-
src/loadstarpar_make_subset.c (modified) (3 diffs)
-
src/loadstarpar_readstars.c (modified) (5 diffs)
-
src/loadstarpar_remote_hosts.c (modified) (5 diffs)
-
src/loadstarpar_save_remote.c (modified) (4 diffs)
-
src/loadstarpar_table.c (moved) (moved from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_rawdata.c ) (2 diffs)
-
src/resort_catalog.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140904/Ohana/src/addstar/Makefile
r37402 r37417 25 25 load2mass : $(BIN)/load2mass.$(ARCH) 26 26 loadstarpar : $(BIN)/loadstarpar.$(ARCH) 27 loadstarpar_client : $(BIN)/loadstarpar_client.$(ARCH) 27 28 loadwise : $(BIN)/loadwise.$(ARCH) 28 29 dumpskycells : $(BIN)/dumpskycells.$(ARCH) … … 32 33 mkcmf : $(BIN)/mkcmf.$(ARCH) 33 34 34 all: addstar addstar_client sedstar load2mass loadstarpar skycells mkcmf loadwise loadsupercos dumpskycells findskycell35 36 INSTALL = addstar addstar_client sedstar load2mass loadstarpar skycells mkcmf loadwise loadsupercos dumpskycells findskycell35 all: addstar addstar_client sedstar load2mass loadstarpar loadstarpar_client skycells mkcmf loadwise loadsupercos dumpskycells findskycell 36 37 INSTALL = addstar addstar_client sedstar load2mass loadstarpar loadstarpar_client skycells mkcmf loadwise loadsupercos dumpskycells findskycell 37 38 38 39 # I need to fix the client/server version of addstar now that I have dropped Stars … … 244 245 LOAD-STARPAR = \ 245 246 $(SRC)/loadstarpar.$(ARCH).o \ 246 $(SRC)/loadstarpar_rawdata.$(ARCH).o \ 247 $(SRC)/ConfigInit.$(ARCH).o \ 248 $(SRC)/SetSignals.$(ARCH).o \ 249 $(SRC)/Shutdown.$(ARCH).o \ 250 $(SRC)/SkyRegionUtils.$(ARCH).o \ 251 $(SRC)/args_loadstarpar.$(ARCH).o \ 252 $(SRC)/coord_transforms.$(ARCH).o \ 253 $(SRC)/find_matches_starpar.$(ARCH).o \ 247 254 $(SRC)/loadstarpar_catalog.$(ARCH).o \ 255 $(SRC)/loadstarpar_io.$(ARCH).o \ 256 $(SRC)/loadstarpar_make_subset.$(ARCH).o \ 248 257 $(SRC)/loadstarpar_readstars.$(ARCH).o \ 258 $(SRC)/loadstarpar_remote_hosts.$(ARCH).o \ 259 $(SRC)/loadstarpar_save_remote.$(ARCH).o \ 260 $(SRC)/loadstarpar_table.$(ARCH).o \ 261 $(SRC)/psps_ids.$(ARCH).o 262 263 LOAD-STARPAR-CLIENT = \ 264 $(SRC)/loadstarpar_client.$(ARCH).o \ 265 $(SRC)/ConfigInit.$(ARCH).o \ 266 $(SRC)/SetSignals.$(ARCH).o \ 267 $(SRC)/Shutdown.$(ARCH).o \ 268 $(SRC)/SkyRegionUtils.$(ARCH).o \ 269 $(SRC)/args_loadstarpar.$(ARCH).o \ 270 $(SRC)/coord_transforms.$(ARCH).o \ 271 $(SRC)/find_matches_starpar.$(ARCH).o \ 272 $(SRC)/loadstarpar_catalog.$(ARCH).o \ 273 $(SRC)/loadstarpar_io.$(ARCH).o \ 249 274 $(SRC)/loadstarpar_make_subset.$(ARCH).o \ 275 $(SRC)/loadstarpar_readstars.$(ARCH).o \ 276 $(SRC)/loadstarpar_remote_hosts.$(ARCH).o \ 250 277 $(SRC)/loadstarpar_save_remote.$(ARCH).o \ 251 $(SRC)/loadstarpar_io.$(ARCH).o \ 252 $(SRC)/loadstarpar_remote_hosts.$(ARCH).o \ 253 $(SRC)/find_matches_refstars.$(ARCH).o \ 254 $(SRC)/args_loadstarpar.$(ARCH).o \ 255 $(SRC)/replace_match.$(ARCH).o \ 256 $(SRC)/update_coords.$(ARCH).o \ 257 $(SRC)/SkyRegionUtils.$(ARCH).o \ 258 $(SRC)/StarOps.$(ARCH).o \ 259 $(SRC)/ConfigInit.$(ARCH).o \ 260 $(SRC)/Shutdown.$(ARCH).o \ 261 $(SRC)/SetSignals.$(ARCH).o \ 278 $(SRC)/loadstarpar_table.$(ARCH).o \ 262 279 $(SRC)/psps_ids.$(ARCH).o 263 280 … … 330 347 $(SRC)/Shutdown.$(ARCH).o 331 348 332 $(ADDSTARC) : $(INC)/addstar.h 333 $(ADDSTARD) : $(INC)/addstar.h 334 $(ADDSTART) : $(INC)/addstar.h 335 $(ADDSTAR) : $(INC)/addstar.h 336 $(ADDSTAR_CLIENT) : $(INC)/addstar.h 337 $(SKYCELLS) : $(INC)/addstar.h 338 $(DUMPSKYCELLS) : $(INC)/addstar.h 339 $(FINDSKYCELL) : $(INC)/addstar.h 340 $(LOAD-2MASS) : $(INC)/addstar.h $(INC)/2mass.h 341 $(LOAD-WISE) : $(INC)/addstar.h $(INC)/WISE.h 342 $(MKCMF) : $(INC)/mkcmf.h 349 $(ADDSTARC) : $(INC)/addstar.h 350 $(ADDSTARD) : $(INC)/addstar.h 351 $(ADDSTART) : $(INC)/addstar.h 352 $(ADDSTAR) : $(INC)/addstar.h 353 $(ADDSTAR_CLIENT) : $(INC)/addstar.h 354 $(SKYCELLS) : $(INC)/addstar.h 355 $(DUMPSKYCELLS) : $(INC)/addstar.h 356 $(FINDSKYCELL) : $(INC)/addstar.h 357 $(LOAD-2MASS) : $(INC)/addstar.h $(INC)/2mass.h 358 $(LOAD-STARPAR) : $(INC)/addstar.h $(INC)/loadstarpar.h 359 $(LOAD-STARPAR-CLIENT) : $(INC)/addstar.h $(INC)/loadstarpar.h 360 $(LOAD-WISE) : $(INC)/addstar.h $(INC)/WISE.h 361 $(MKCMF) : $(INC)/mkcmf.h 343 362 344 363 $(BIN)/addstar.$(ARCH) : $(ADDSTAR) … … 351 370 $(BIN)/load2mass.$(ARCH) : $(LOAD-2MASS) 352 371 $(BIN)/loadwise.$(ARCH) : $(LOAD-WISE) 372 $(BIN)/loadstarpar.$(ARCH) : $(LOAD-STARPAR) 373 $(BIN)/loadstarpar_client.$(ARCH) : $(LOAD-STARPAR-CLIENT) 353 374 $(BIN)/loadsupercos.$(ARCH) : $(LOAD-SUPERCOS) 354 375 $(BIN)/skycells.$(ARCH) : $(SKYCELLS) -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/include/addstar.h
r37395 r37417 31 31 # define dCOS(A) ((double) cos ((double)RAD_DEG*A)) 32 32 # define dSIN(A) ((double) sin ((double)RAD_DEG*A)) 33 34 # define myAbortF(FORMAT,...) { fprintf (stderr, FORMAT, __VA_ARGS__); abort(); } 33 35 34 36 typedef struct { -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/include/loadstarpar.h
r37395 r37417 7 7 } StarPar_Stars; 8 8 9 int HOST_ID 9 int HOST_ID; 10 10 char *HOSTDIR; 11 11 char *CPT_FILE; 12 12 char *INPUT; 13 14 AddstarClientOptions args_loadstarpar (int argc, char **argv, AddstarClientOptions options); 15 AddstarClientOptions args_loadstarpar_client (int argc, char **argv, AddstarClientOptions options); 16 17 int loadstarpar_table (SkyList *skylistInput, HostTable *hosts, char *filename, AddstarClientOptions *options); 18 19 StarPar_Stars *loadstarpar_make_subset (StarPar_Stars *stars, int Nstars, int start, SkyRegion *region, int *nsubset); 20 21 int loadstarpar_save_remote (StarPar_Stars *stars, int Nstars, HostTable *hosts, SkyRegion *region, char *fullname, AddstarClientOptions *options); 22 23 int save_remote_host (HostInfo *host); 24 25 int init_remote_hosts (); 26 int find_empty_slot (); 27 int harvest_all (); 28 int harvest_host (); 29 30 int loadstarpar_catalog (StarPar_Stars *stars, int Nstars, SkyRegion *region, char *filename, AddstarClientOptions *options); 31 32 int galactic_to_celestial (double *R, double *D, double l, double b); 33 34 int find_matches_starpar (SkyRegion *region, StarPar_Stars *stars, int Nstars, Catalog *catalog, AddstarClientOptions *options); 35 36 int loadstarpar_save_stars (char *filename, StarPar_Stars *stars, int Nstars); 37 StarPar_Stars *loadstarpar_load_stars (char *filename, int *nstars); 38 39 StarPar_Stars *loadstarpar_readstars (char *filename, int *nstars); 40 41 int loadstarpar_sortStars (StarPar_Stars *stars, int Nstars); -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/args_loadstarpar.c
r37395 r37417 1 1 # include "addstar.h" 2 # include " WISE.h"2 # include "loadstarpar.h" 3 3 4 4 static void help (void); 5 static void help_client (void); 5 6 6 7 AddstarClientOptions args_loadstarpar (int argc, char **argv, AddstarClientOptions options) { … … 13 14 help (); 14 15 } 15 16 // a global used by find_matches_refstars.c17 NREFSTAR_GROUP = X;18 19 /*** check for command line options ***/20 16 21 17 /* basic mode: image, list, refcat */ … … 51 47 if ((N = get_argument (argc, argv, "-v"))) { 52 48 VERBOSE = TRUE; 53 remove_argument (N, &argc, argv);54 }55 56 /* load the prelim data dump */57 ALLSKY = TRUE;58 if ((N = get_argument (argc, argv, "-prelim"))) {59 ALLSKY = FALSE;60 49 remove_argument (N, &argc, argv); 61 50 } -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/build_links.c
r37334 r37417 1 1 # include "addstar.h" 2 3 # define myAbortF(FORMAT,...) { fprintf (stderr, FORMAT, __VA_ARGS__); abort(); }4 2 5 3 /* -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_matches_starpar.c
r37395 r37417 3 3 4 4 // we find matching stars by (R,D). we add the starpar to the array of starpars with appropriate links. 5 int find_matches_starpar (SkyRegion *region, StarPar_Stars *stars, int Nstars, Catalog *catalog, AddstarClientOptions options) {5 int find_matches_starpar (SkyRegion *region, StarPar_Stars *stars, int Nstars, Catalog *catalog, AddstarClientOptions *options) { 6 6 7 off_t i, j, n, N, J, Jmin , status, Nstars;7 off_t i, j, n, N, J, Jmin; 8 8 double RADIUS, RADIUS2, Rmin; 9 9 double *X1, *Y1, *X2, *Y2; … … 48 48 /* build spatial index (RA sort) referencing input array sequence */ 49 49 for (i = 0; i < Nstars; i++) { 50 status =RD_to_XY (&X1[i], &Y1[i], stars[i].R, stars[i].D, &tcoords);50 RD_to_XY (&X1[i], &Y1[i], stars[i].R, stars[i].D, &tcoords); 51 51 N1[i] = i; 52 52 } … … 62 62 63 63 /* choose a radius for matches */ 64 RADIUS = options .radius; /* provided by config */64 RADIUS = options->radius; /* provided by config */ 65 65 RADIUS2 = RADIUS*RADIUS; 66 66 … … 153 153 # if (0) 154 154 /** incorporate unmatched image stars? **/ 155 for (i = 0; (i < Nstars) && !options .only_match; i++) {155 for (i = 0; (i < Nstars) && !options->only_match; i++) { 156 156 157 157 // skip already matched stars … … 206 206 207 207 /* note stars which have been found in this catalog */ 208 for (i = 0; i < Nstars In; i++) {208 for (i = 0; i < Nstars; i++) { 209 209 if (stars[i].found > -1) { 210 210 stars[i].found = -2; … … 217 217 catalog[0].Nstarpar = Nstarpar; 218 218 catalog[0].Nsecf_mem = Nave*Nsecfilt; 219 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nstarpar , Nlens: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n", Nstars, Nave, Nmatch);219 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nstarpar: %d "OFF_T_FMT" "OFF_T_FMT" ("OFF_T_FMT" matches)\n", Nstars, Nave, Nstarpar, Nmatch); 220 220 221 221 free (X1); -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar.c
r37395 r37417 1 1 # include "addstar.h" 2 # include " WISE.h"2 # include "loadstarpar.h" 3 3 4 4 /* This is the DVO program to upload Greg Green's stellar parametersq into a DVO database. … … 9 9 10 10 USAGE: loadstarpar -D CATDIR (catdir) (file.fits) [...more files] 11 */11 */ 12 12 13 13 int main (int argc, char **argv) { … … 35 35 36 36 for (i = 1; i < argc; i++) { 37 fprintf (stderr, "loading %s\n", argv[i]);38 loadstarpar_rawdata (skylist, hosts, argv[i],options);37 fprintf (stderr, "loading %s\n", argv[i]); 38 loadstarpar_table (skylist, hosts, argv[i], &options); 39 39 } 40 40 exit (0); 41 41 } 42 -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_catalog.c
r37395 r37417 2 2 # include "loadstarpar.h" 3 3 4 int loadstarpar_catalog (StarPar_Stars *stars, int Nstars, SkyRegion *region, char *filename ) {4 int loadstarpar_catalog (StarPar_Stars *stars, int Nstars, SkyRegion *region, char *filename, AddstarClientOptions *options) { 5 5 6 6 Catalog catalog; -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_client.c
r37402 r37417 4 4 int main (int argc, char **argv) { 5 5 6 int i;7 6 AddstarClientOptions options; 8 7 … … 13 12 // client is called with a pointer to the file to be loaded 14 13 14 SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, FALSE, SKY_DEPTH, VERBOSE); 15 SkyTableSetFilenames (sky, CATDIR, "cpt"); 16 17 SkyList *skylist = SkyRegionByCPT (sky, CPT_FILE); 18 19 int Nstars; 15 20 StarPar_Stars *stars = loadstarpar_load_stars (INPUT, &Nstars); 16 21 17 loadstarpar_catalog (stars, Nstars, region, CPT_FILE);22 loadstarpar_catalog (stars, Nstars, skylist->regions[0], CPT_FILE, &options); 18 23 19 24 free (stars); -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_io.c
r37395 r37417 30 30 gfits_define_bintable_column (&theader, "D", "GLON", "", "degree", 1.0, 0.0); 31 31 gfits_define_bintable_column (&theader, "D", "GLAT", "", "degree", 1.0, 0.0); 32 gfits_define_bintable_column (&theader, "E", "Ebv", "", 1.0, 0.0);33 gfits_define_bintable_column (&theader, "E", "dEbv", "", 1.0, 0.0);34 gfits_define_bintable_column (&theader, "E", "DistMag", "", 1.0, 0.0);35 gfits_define_bintable_column (&theader, "E", "dDistMag", "", 1.0, 0.0);36 gfits_define_bintable_column (&theader, "E", "M_r", "", 1.0, 0.0);37 gfits_define_bintable_column (&theader, "E", "dM_r", "", 1.0, 0.0);38 gfits_define_bintable_column (&theader, "E", "FeH", "", 1.0, 0.0);39 gfits_define_bintable_column (&theader, "E", "dFeH", "", 1.0, 0.0);40 gfits_define_bintable_column (&theader, "J", "averef", "", 1.0, FT_BZERO_INT32);41 gfits_define_bintable_column (&theader, "J", "objID", "", 1.0, FT_BZERO_INT32);42 gfits_define_bintable_column (&theader, "J", "catID", "", 1.0, FT_BZERO_INT32);32 gfits_define_bintable_column (&theader, "E", "Ebv", "", "", 1.0, 0.0); 33 gfits_define_bintable_column (&theader, "E", "dEbv", "", "", 1.0, 0.0); 34 gfits_define_bintable_column (&theader, "E", "DistMag", "", "", 1.0, 0.0); 35 gfits_define_bintable_column (&theader, "E", "dDistMag", "", "", 1.0, 0.0); 36 gfits_define_bintable_column (&theader, "E", "M_r", "", "", 1.0, 0.0); 37 gfits_define_bintable_column (&theader, "E", "dM_r", "", "", 1.0, 0.0); 38 gfits_define_bintable_column (&theader, "E", "FeH", "", "", 1.0, 0.0); 39 gfits_define_bintable_column (&theader, "E", "dFeH", "", "", 1.0, 0.0); 40 gfits_define_bintable_column (&theader, "J", "averef", "", "", 1.0, FT_BZERO_INT32); 41 gfits_define_bintable_column (&theader, "J", "objID", "", "", 1.0, FT_BZERO_INT32); 42 gfits_define_bintable_column (&theader, "J", "catID", "", "", 1.0, FT_BZERO_INT32); 43 43 44 int i; 44 45 double *ra = NULL; ALLOCATE (ra , double , Nstars); for (i = 0; i < Nstars; i++) ra [i] = stars[i].R ; 45 46 double *dec = NULL; ALLOCATE (dec , double , Nstars); for (i = 0; i < Nstars; i++) dec [i] = stars[i].D ; … … 82 83 gfits_free_header (&theader); 83 84 gfits_free_table (&ftable); 85 86 return TRUE; 84 87 } 85 88 … … 131 134 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) goto escape; 132 135 133 GET_COLUMN _NEW(ra , "RA" , double);134 GET_COLUMN _NEW(dec , "DEC" , double);135 GET_COLUMN _NEW(glon , "GLON" , double);136 GET_COLUMN _NEW(glat , "GLAT" , double);137 GET_COLUMN _NEW(Ebv , "Ebv" , float);138 GET_COLUMN _NEW(dEbv , "dEbv" , float);139 GET_COLUMN _NEW(DistMag , "DistMag" , float);140 GET_COLUMN _NEW(dDistMag, "dDistMag" , float);141 GET_COLUMN _NEW(M_r , "M_r" , float);142 GET_COLUMN _NEW(dM_r , "dM_r" , float);143 GET_COLUMN _NEW(FeH , "FeH" , float);144 GET_COLUMN _NEW(dFeH , "dFeH" , float);145 GET_COLUMN _NEW(averef , "averef" , unsigned int);146 GET_COLUMN _NEW(objID , "objID" , unsigned int);147 GET_COLUMN _NEW(catID , "catID" , unsigned int);136 GET_COLUMN(ra , "RA" , double); 137 GET_COLUMN(dec , "DEC" , double); 138 GET_COLUMN(glon , "GLON" , double); 139 GET_COLUMN(glat , "GLAT" , double); 140 GET_COLUMN(Ebv , "Ebv" , float); 141 GET_COLUMN(dEbv , "dEbv" , float); 142 GET_COLUMN(DistMag , "DistMag" , float); 143 GET_COLUMN(dDistMag, "dDistMag" , float); 144 GET_COLUMN(M_r , "M_r" , float); 145 GET_COLUMN(dM_r , "dM_r" , float); 146 GET_COLUMN(FeH , "FeH" , float); 147 GET_COLUMN(dFeH , "dFeH" , float); 148 GET_COLUMN(averef , "averef" , unsigned int); 149 GET_COLUMN(objID , "objID" , unsigned int); 150 GET_COLUMN(catID , "catID" , unsigned int); 148 151 149 152 gfits_free_header (&theader); … … 152 155 gfits_free_matrix (&matrix); 153 156 154 ALLOCATE ( StarPar_Stars, stars, Nrow);157 ALLOCATE (stars, StarPar_Stars, Nrow); 155 158 156 159 for (i = 0; i < Nrow; i++) { -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_make_subset.c
r37395 r37417 7 7 StarPar_Stars *loadstarpar_make_subset (StarPar_Stars *stars, int Nstars, int start, SkyRegion *region, int *nsubset) { 8 8 9 int i; 10 9 11 StarPar_Stars *subset = NULL; 10 12 … … 12 14 int Nsubset = 0; 13 15 int NSUBSET = 3000; 14 ALLOCATE (subset, StarPar_Stars *, NSUBSET);16 ALLOCATE (subset, StarPar_Stars, NSUBSET); 15 17 16 18 // find the rest of the stars in this output region … … 31 33 32 34 subset[Nsubset] = stars[i]; 33 Nsubset ++ 35 Nsubset ++; 34 36 35 37 CHECK_REALLOCATE (subset, StarPar_Stars, NSUBSET, Nsubset, 10000); -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_readstars.c
r37395 r37417 9 9 10 10 // read in the full FITS files ('cause I don't have a partial read option) 11 f = fopen (filename, "r");11 FILE *f = fopen (filename, "r"); 12 12 if (f == NULL) Shutdown ("can't read stellar parameter file: %s", filename); 13 14 int i, Ncol; 15 off_t Nrow; 13 16 14 17 Header header; … … 79 82 int NstarsIn = matrix.Naxis[2]; 80 83 81 Rmin =360.0;82 Rmax =360.0;83 Dmin =360.0;84 Dmax =360.0;84 double Rmin = +360.0; 85 double Rmax = -360.0; 86 double Dmin = +360.0; 87 double Dmax = -360.0; 85 88 86 89 int Nstars = 0; … … 96 99 if (lnZ[i] < -15.0) continue; 97 100 98 galactic_to_celestial (&R, &D, glat[i], glon[i]); 101 double R, D; 102 galactic_to_celestial (&R, &D, glon[i], glat[i]); 99 103 100 104 Rmin = MIN (Rmin, R); … … 106 110 float dDistMag = 0.5*(errImage[i*20 + 5*1 + 3] - errImage[i*20 + 5*1 + 1]); 107 111 float dFeH = 0.5*(errImage[i*20 + 5*2 + 3] - errImage[i*20 + 5*2 + 1]); 108 float dM r= 0.5*(errImage[i*20 + 5*3 + 3] - errImage[i*20 + 5*3 + 1]);112 float dM_r = 0.5*(errImage[i*20 + 5*3 + 3] - errImage[i*20 + 5*3 + 1]); 109 113 110 114 stars[Nstars].R = R; 111 115 stars[Nstars].D = D; 112 116 113 stars[Nstars].starpar.galLon = l;114 stars[Nstars].starpar.galLat = b;117 stars[Nstars].starpar.galLon = glon[i]; 118 stars[Nstars].starpar.galLat = glat[i]; 115 119 116 120 stars[Nstars].starpar.Ebv = Ebv[i] ; … … 133 137 return (stars); 134 138 } 139 140 int loadstarpar_sortStars (StarPar_Stars *stars, int Nstars) { 141 142 # define SWAPFUNC(A,B){ StarPar_Stars temp = stars[A]; stars[A] = stars[B]; stars[B] = temp; } 143 # define COMPARE(A,B)(stars[A].R < stars[B].R) 144 145 OHANA_SORT (Nstars, COMPARE, SWAPFUNC); 146 147 # undef SWAPFUNC 148 # undef COMPARE 149 150 return TRUE; 151 } 152 -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_remote_hosts.c
r37395 r37417 1 1 # include "addstar.h" 2 2 # include "loadstarpar.h" 3 # include <sys/types.h> 4 # include <sys/wait.h> 5 6 # define DEBUG 1 3 7 4 8 // we are running N parallel remote jobs on the remote hosts. In the usual remote … … 19 23 hosts[i] = NULL; 20 24 } 25 return TRUE; 21 26 } 22 27 23 28 int find_empty_slot () { 24 29 30 int i; 25 31 for (i = 0; i < Nhosts; i++) { 26 32 if (hosts[i] == NULL) return i; … … 31 37 int harvest_all () { 32 38 33 slot = -1;39 int slot = -1; 34 40 35 41 while (slot != -2) { … … 44 50 int save_remote_host (HostInfo *host) { 45 51 52 int i; 46 53 for (i = 0; i < Nhosts; i++) { 47 54 if (hosts[i] == NULL) { … … 124 131 free (host->hostname); 125 132 free (host->pathname); 126 FreeIOBuffer ( host->stdout);127 FreeIOBuffer ( host->stderr);133 FreeIOBuffer (&host->stdout); 134 FreeIOBuffer (&host->stderr); 128 135 free (host); 129 136 -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_save_remote.c
r37402 r37417 1 1 # include "addstar.h" 2 2 # include "loadstarpar.h" 3 # define DEBUG 1 3 4 4 int loadstarpar_save_remote (StarPar_Stars *stars, int Nstars, HostTable *hosts, SkyRegion *region, char *fullname) { 5 int strextend (char *input, char *format,...) { 6 7 char tmpextra[1024], tmpline[1024]; 8 va_list argp; 9 10 va_start (argp, format); 11 vsnprintf (tmpextra, 1024, format, argp); 12 snprintf (tmpline, 1024, "%s %s", input, tmpextra); 13 strcpy (input, tmpline); 14 15 return TRUE; 16 } 17 18 int loadstarpar_save_remote (StarPar_Stars *stars, int Nstars, HostTable *hosts, SkyRegion *region, char *fullname, AddstarClientOptions *options) { 5 19 6 20 char uniquer[12]; … … 11 25 // if this region is a parallel thing, save and launch remote 12 26 if (!region->hostID) { 13 loadstarpar_catalog (stars, Nstars, region, fullname );27 loadstarpar_catalog (stars, Nstars, region, fullname, options); 14 28 } else { 15 29 int N = hosts->index[region->hostID]; 16 HostInfo *hostMach = hosts->hosts[N];30 HostInfo *hostMach = &hosts->hosts[N]; 17 31 18 32 // save to a unique filename … … 35 49 // allocate a host for this job 36 50 HostInfo *host = NULL; 37 ALLOCATE ( HostInfo, host, 1);51 ALLOCATE (host, HostInfo, 1); 38 52 39 53 // we want to run this job on the host described by hostMach. copy … … 42 56 host->hostname = strcreate (hostMach->hostname); 43 57 host->pathname = strcreate (hostMach->pathname); 44 InitIOBuffer ( host->stdout, 1000);45 InitIOBuffer ( host->stderr, 1000);58 InitIOBuffer (&host->stdout, 1000); 59 InitIOBuffer (&host->stderr, 1000); 46 60 47 61 // got a valid slot, so launch a new host -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_table.c
r37402 r37417 6 6 myAssert (!strcmp(type, #TYPE), "wrong column type"); 7 7 8 int loadstarpar_ foobar (SkyList *skylistInput, HostTable *hosts, char *filename, AddstarClientOptionsoptions) {8 int loadstarpar_table (SkyList *skylistInput, HostTable *hosts, char *filename, AddstarClientOptions *options) { 9 9 10 SkyRegion *region;10 int i, Nstars; 11 11 12 12 StarPar_Stars *stars = loadstarpar_readstars (filename, &Nstars); … … 27 27 28 28 // identify the relevant catalog 29 skylist = SkyRegionByPoint_List (skylistInput, -1, stars[i].R, stars[i].D);29 SkyList *skylist = SkyRegionByPoint_List (skylistInput, -1, stars[i].R, stars[i].D); 30 30 if (skylist[0].Nregions == 0) { 31 31 SkyListFree (skylist); 32 32 continue; 33 33 } 34 region = skylist[0].regions[0];34 SkyRegion *region = skylist[0].regions[0]; 35 35 36 36 // select stars matching this region 37 int Nsubset; 37 38 StarPar_Stars *subset = loadstarpar_make_subset (stars, Nstars, i, region, &Nsubset); 38 39 39 40 // In parallel mode, write out the subset to a disk file. Block until a remote host 40 41 // is available. In serial mode, just match against the appropriate region and save 41 loadstarpar_save_remote (subset, Nsubset, hosts, region, skylist[0].filename[0] );42 loadstarpar_save_remote (subset, Nsubset, hosts, region, skylist[0].filename[0], options); 42 43 } 43 44 -
branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/resort_catalog.c
r37402 r37417 4 4 void resort_catalog_measure (Catalog *catalog); 5 5 void resort_catalog_lensing (Catalog *catalog); 6 void resort_catalog_starpar (Catalog *catalog); 6 7 7 8 void resort_catalog_old (Catalog *catalog) { … … 339 340 340 341 off_t Naverage, Nstarpar; 341 Star par *starpar;342 StarPar *starpar; 342 343 Average *average; 343 344 off_t i, j, N, currentAve; … … 345 346 off_t *starparSeq = NULL; 346 347 off_t *averageSeq = NULL; 347 Star par *starparTMP = NULL;348 StarPar *starparTMP = NULL; 348 349 349 350 // struct timeval start, stop; … … 410 411 411 412 // copy the starpar entries in the sorted order 412 ALLOCATE (starparTMP, Star par, Nstarpar);413 ALLOCATE (starparTMP, StarPar, Nstarpar); 413 414 for (i = 0; i < Nstarpar; i++) { 414 415 j = starparSeq[i];
Note:
See TracChangeset
for help on using the changeset viewer.
