Changeset 39711
- Timestamp:
- Sep 22, 2016, 11:13:19 AM (10 years ago)
- Location:
- branches/czw_branch/20160809/Ohana/src/addstar
- Files:
-
- 5 edited
-
include/gaia.h (modified) (2 diffs)
-
src/args_loadgaia.c (modified) (2 diffs)
-
src/loadgaia.c (modified) (2 diffs)
-
src/loadgaia_readstars.c (modified) (8 diffs)
-
src/loadgaia_table.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20160809/Ohana/src/addstar/include/gaia.h
r39710 r39711 15 15 AddstarClientOptions args_loadgaia_client (int *argc, char **argv, AddstarClientOptions options); 16 16 17 int loadgaia_table ( SkyList *skylistInput, HostTable *hosts, char*filename, AddstarClientOptions *options);17 int loadgaia_table (int Nstart, int Nend, SkyList *skylistInput, HostTable *hosts, char **filename, AddstarClientOptions *options); 18 18 19 19 Gaia_Stars *loadgaia_make_subset (Gaia_Stars *stars, int Nstars, int start, SkyRegion *region, int *nsubset); … … 38 38 Gaia_Stars *loadgaia_load_stars (char *filename, int *nstars); 39 39 40 Gaia_Stars *loadgaia_readstars (char *filename, int *nstars);40 Gaia_Stars *loadgaia_readstars (char *filename, Gaia_Stars *stars, int *nstars, AddstarClientOptions *options); 41 41 42 42 int loadgaia_sortStars (Gaia_Stars *stars, int Nstars); -
branches/czw_branch/20160809/Ohana/src/addstar/src/args_loadgaia.c
r39710 r39711 82 82 remove_argument (N, argc, argv); 83 83 } 84 if (!options.photcode) { 85 fprintf (stderr, "ERROR: please supply a photcode name with [-p name]\n"); 86 exit (2); 87 } 88 89 /* provide a time for dataset */ 90 options.timeref = 0; 91 if ((N = get_argument (*argc, argv, "-time"))) { 92 time_t tmp; 93 remove_argument (N, argc, argv); 94 if (!ohana_str_to_time (argv[N], &tmp)) { 95 fprintf (stderr, "syntax error in time\n"); 96 exit (1); 97 } 98 options.timeref = tmp; 99 remove_argument (N, argc, argv); 100 } 84 101 85 102 /* extra error messages */ … … 91 108 92 109 /* other addstar options which cannot be used in loadgaia */ 93 options.timeref = 0;110 // options.timeref = 0; 94 111 options.mosaic = FALSE; 95 112 options.skip_missed = FALSE; -
branches/czw_branch/20160809/Ohana/src/addstar/src/loadgaia.c
r39710 r39711 11 11 int main (int argc, char **argv) { 12 12 13 int i;14 13 SkyTable *sky; 15 14 SkyList *skylist = NULL; … … 28 27 skylist = SkyListByPatch (sky, -1, &UserPatch); 29 28 30 for (i = 1; i < argc; i++) { 31 fprintf (stderr, "loading %s\n", argv[i]); 32 loadgaia_table (skylist, NULL, argv[i], &options); 29 int Nstart = 1; 30 int Nend = argc; 31 while (Nstart < Nend) { 32 Nstart = loadgaia_table (Nstart, Nend, skylist, NULL, argv, &options); 33 33 } 34 35 SkyTableFree (sky); 36 SkyListFree(skylist); 37 FreePhotcodeTable(); 38 free (CATDIR); 39 40 ohana_memcheck (VERBOSE); 41 ohana_memdump (VERBOSE); 34 42 exit (0); 35 43 } -
branches/czw_branch/20160809/Ohana/src/addstar/src/loadgaia_readstars.c
r39710 r39711 6 6 myAssert (!strcmp(type, #TYPE), "wrong column type"); 7 7 8 Gaia_Stars *loadgaia_readstars (char *filename, int *nstars) {8 Gaia_Stars *loadgaia_readstars (char *filename, Gaia_Stars *stars, int *nstars, AddstarClientOptions *options) { 9 9 10 10 // read in the full FITS files … … 24 24 if (VERBOSE) fprintf (stderr, "can't read image subset header\n"); 25 25 fclose (f); 26 return NULL;26 return stars; 27 27 } 28 28 if (!gfits_fread_matrix (f, &matrix, &header)) { … … 30 30 gfits_free_header (&header); 31 31 fclose (f); 32 return NULL;32 return stars; 33 33 } 34 34 … … 38 38 if (!gfits_load_header (f, &theader)) { 39 39 fclose (f); 40 return NULL;40 return stars; 41 41 } 42 42 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { 43 43 fclose (f); 44 return (NULL);44 return stars; 45 45 } 46 46 … … 53 53 GET_COLUMN (gMag, "PHOT_G_MEAN_MAG", float); 54 54 GET_COLUMN (dgFlux, "PHOT_G_MEAN_FLUX_ERROR", float); 55 GET_COLUMN (Nobs, "PHOT_G_N_OBS", float); 55 GET_COLUMN (Nobs, "PHOT_G_N_OBS", short); 56 57 int NstarsIn = Nrow; 56 58 57 59 // free the memory associated with the FITS files … … 63 65 fclose (f); 64 66 65 int NstarsIn = matrix.Naxis[2];66 67 67 double Rmin = +360.0; 68 68 double Rmax = -360.0; … … 70 70 double Dmax = -360.0; 71 71 72 int Nstars = 0; 73 int NSTARS = 0.1*NstarsIn; 72 // start off where we finished on a previous read 73 int Nstars = *nstars; 74 int NSTARS = Nstars + 0.1*NstarsIn; 74 75 75 Gaia_Stars *stars = NULL; 76 ALLOCATE (stars, Gaia_Stars, NSTARS); 76 if (!stars) { 77 ALLOCATE (stars, Gaia_Stars, NSTARS); 78 } else { 79 REALLOCATE (stars, Gaia_Stars, NSTARS); 80 } 77 81 78 82 for (i = 0; i < NstarsIn; i++) { … … 102 106 stars[Nstars].measure.FluxPSF = flux; 103 107 stars[Nstars].measure.dFluxPSF = dgFlux[i]; 108 109 stars[Nstars].measure.photcode = options->photcode; 110 stars[Nstars].measure.t = options->timeref; 104 111 105 112 Nstars ++; -
branches/czw_branch/20160809/Ohana/src/addstar/src/loadgaia_table.c
r39710 r39711 1 1 # include "addstar.h" 2 2 # include "gaia.h" 3 # define NSTARS_MAX 1000000 3 4 4 int loadgaia_table ( SkyList *skylistInput, HostTable *hosts, char*filename, AddstarClientOptions *options) {5 int loadgaia_table (int Nstart, int Nend, SkyList *skylistInput, HostTable *hosts, char **filename, AddstarClientOptions *options) { 5 6 OHANA_UNUSED_PARAM(hosts); 6 7 7 int i , Nstars;8 int i; 8 9 9 Gaia_Stars *stars = loadgaia_readstars (filename, &Nstars); 10 if (!stars) return FALSE; 10 int Nstars = 0; 11 Gaia_Stars *stars = NULL; 12 for (i = Nstart; (Nstars < NSTARS_MAX) && (i < Nend); i++) { 13 // read the next file and append to the current set of stars 14 fprintf (stderr, "loading %s\n", filename[i]); 15 stars = loadgaia_readstars (filename[i], stars, &Nstars, options); 16 } 17 Nstart = i; // we pass back the entry for the next file to be read 18 if (!stars) return Nstart; 19 20 fprintf (stderr, "writing %d stars to dvo\n", Nstars); 11 21 12 22 // sort the stars by RA … … 41 51 // loadgaia_save_remote (subset, Nsubset, hosts, region, skylist[0].filename[0], options); 42 52 loadgaia_catalog (subset, Nsubset, region, skylist[0].filename[0], options); 53 free (subset); 54 SkyListFree (skylist); 43 55 } 44 56 … … 47 59 // harvest_all (); 48 60 49 return TRUE; 61 free (stars); 62 return Nstart; 50 63 } 51 64
Note:
See TracChangeset
for help on using the changeset viewer.
