Changeset 39457 for trunk/Ohana/src/relastro
- Timestamp:
- Mar 11, 2016, 10:23:42 PM (10 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 44 edited
- 11 copied
-
. (modified) (1 prop)
-
src/relastro/Makefile (modified) (6 diffs)
-
src/relastro/include/relastro.h (modified) (9 diffs)
-
src/relastro/src (modified) (1 prop)
-
src/relastro/src/BootstrapOps.c (modified) (1 diff)
-
src/relastro/src/BrightCatalog.c (modified) (11 diffs)
-
src/relastro/src/FitAstromOps.c (modified) (1 diff)
-
src/relastro/src/FitChip.c (modified) (2 diffs)
-
src/relastro/src/GetAstromError.c (modified) (1 diff)
-
src/relastro/src/ImageOps.c (modified) (13 diffs)
-
src/relastro/src/ImageTable.c (modified) (2 diffs)
-
src/relastro/src/MeasFilterTest.c (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/src/MeasFilterTest.c )
-
src/relastro/src/MosaicOps.c (modified) (4 diffs)
-
src/relastro/src/SetSignals.c (modified) (1 diff)
-
src/relastro/src/StarMaps.c (modified) (2 diffs)
-
src/relastro/src/UpdateChips.c (modified) (4 diffs)
-
src/relastro/src/UpdateMeasures.c (modified) (1 diff)
-
src/relastro/src/UpdateObjectOffsets.c (modified) (6 diffs)
-
src/relastro/src/UpdateObjects.c (modified) (4 diffs)
-
src/relastro/src/UpdateStacks.c (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/src/UpdateStacks.c )
-
src/relastro/src/args.c (modified) (6 diffs)
-
src/relastro/src/assign_images.c (modified) (2 diffs)
-
src/relastro/src/bcatalog.c (modified) (1 diff)
-
src/relastro/src/dvo_astrom_ops.c (modified) (8 diffs)
-
src/relastro/src/fitobj.c (modified) (2 diffs)
-
src/relastro/src/fitobj2.c (modified) (2 diffs)
-
src/relastro/src/fitstk.c (modified) (1 diff)
-
src/relastro/src/high_speed_utils.c (modified) (2 diffs)
-
src/relastro/src/indexCatalogs.c (modified) (4 diffs)
-
src/relastro/src/initialize.c (modified) (1 diff)
-
src/relastro/src/launch_region_hosts.c (modified) (2 diffs)
-
src/relastro/src/load_catalogs.c (modified) (4 diffs)
-
src/relastro/src/load_images.c (modified) (4 diffs)
-
src/relastro/src/plot_scatter.c (modified) (1 diff)
-
src/relastro/src/plotstuff.c (modified) (3 diffs)
-
src/relastro/src/relastro.c (modified) (4 diffs)
-
src/relastro/src/relastro_client.c (modified) (4 diffs)
-
src/relastro/src/relastro_images.c (modified) (7 diffs)
-
src/relastro/src/relastro_merge_source.c (modified) (1 diff)
-
src/relastro/src/relastro_objects.c (modified) (3 diffs)
-
src/relastro/src/relastro_parallel_images.c (modified) (3 diffs)
-
src/relastro/src/relastro_parallel_regions.c (modified) (1 diff)
-
src/relastro/src/share_icrf_obj.c (modified) (1 diff)
-
src/relastro/src/share_images_pos.c (modified) (1 diff)
-
src/relastro/src/share_mean_pos.c (modified) (1 diff)
-
src/relastro/src/share_meas_pos.c (modified) (2 diffs)
-
src/relastro/test/HostTable.dat.in (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/HostTable.dat.in )
-
src/relastro/test/RegionHosts.dat.in (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/RegionHosts.dat.in )
-
src/relastro/test/gdb.sh (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/gdb.sh )
-
src/relastro/test/run.fakeastro.par (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/run.fakeastro.par )
-
src/relastro/test/run.fakeastro.ser (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/run.fakeastro.ser )
-
src/relastro/test/run.relastro.par (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/run.relastro.par )
-
src/relastro/test/run.relastro.par.reg (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/run.relastro.par.reg )
-
src/relastro/test/run.relastro.ser (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/run.relastro.ser )
-
src/relastro/test/template.dat (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/template.dat )
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
-
Property svn:mergeinfo
set to
/branches/eam_branches/ohana.20160226 merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Ohana/src/relastro/Makefile
r39375 r39457 41 41 $(SRC)/Shutdown.$(ARCH).o \ 42 42 $(SRC)/UpdateChips.$(ARCH).o \ 43 $(SRC)/UpdateStacks.$(ARCH).o \ 43 44 $(SRC)/UpdateMosaic.$(ARCH).o \ 44 45 $(SRC)/UpdateObjects.$(ARCH).o \ … … 47 48 $(SRC)/UpdateMeasures.$(ARCH).o \ 48 49 $(SRC)/GetAstromError.$(ARCH).o \ 50 $(SRC)/MeasFilterTest.$(ARCH).o \ 49 51 $(SRC)/args.$(ARCH).o \ 50 52 $(SRC)/bcatalog.$(ARCH).o \ … … 120 122 $(SRC)/UpdateMeasures.$(ARCH).o \ 121 123 $(SRC)/GetAstromError.$(ARCH).o \ 124 $(SRC)/MeasFilterTest.$(ARCH).o \ 122 125 $(SRC)/args.$(ARCH).o \ 123 126 $(SRC)/bcatalog.$(ARCH).o \ … … 195 198 $(SRC)/mkpolyterm.$(ARCH).o \ 196 199 $(SRC)/GetAstromError.$(ARCH).o \ 197 $(SRC)/ImageOps.$(ARCH).o \ 198 $(SRC)/MosaicOps.$(ARCH).o \ 200 $(SRC)/MeasFilterTest.$(ARCH).o \ 199 201 $(SRC)/extra.$(ARCH).o \ 200 202 $(SRC)/plotstuff.$(ARCH).o \ … … 218 220 $(SRC)/mkpolyterm.$(ARCH).o \ 219 221 $(SRC)/GetAstromError.$(ARCH).o \ 220 $(SRC)/ImageOps.$(ARCH).o \ 221 $(SRC)/MosaicOps.$(ARCH).o \ 222 $(SRC)/MeasFilterTest.$(ARCH).o \ 222 223 $(SRC)/extra.$(ARCH).o \ 223 224 $(SRC)/plotstuff.$(ARCH).o \ … … 241 242 $(SRC)/mkpolyterm.$(ARCH).o \ 242 243 $(SRC)/GetAstromError.$(ARCH).o \ 243 $(SRC)/ImageOps.$(ARCH).o \ 244 $(SRC)/MosaicOps.$(ARCH).o \ 244 $(SRC)/MeasFilterTest.$(ARCH).o \ 245 245 $(SRC)/extra.$(ARCH).o \ 246 246 $(SRC)/plotstuff.$(ARCH).o \ 247 247 $(SRC)/fitpoly.$(ARCH).o 248 249 # stupid dependencies: 250 # UpdateObjects.c:UpdateObjects_Chips needs 251 # ImageOps.c:MeasFilterTiny forces 252 # load_images.c:free_astrom_table needs 253 # select_images.c 254 # MosaicOps.c 248 255 249 256 $(FITSTK): $(INC)/relastro.h -
trunk/Ohana/src/relastro/include/relastro.h
r39396 r39457 88 88 off_t *NMEASURE; // allocated Measures per catalog 89 89 int *index; // lookup table catID -> catalog[i] 90 int*catIDs; // lookup table catID <- catalog[i]91 int maxID;// max catID value to date90 unsigned int *catIDs; // lookup table catID <- catalog[i] 91 unsigned int maxID; // max catID value to date 92 92 } CatalogSplitter; 93 93 … … 259 259 int REGION_HOST_ID; 260 260 int PARALLEL_REGIONS_MANUAL; 261 char *MANUAL_UNIQUER; 261 262 262 263 int HOST_ID; … … 416 417 int SetSignals (void); 417 418 418 void relastro_client_free (); 419 void relastro_free (SkyTable *sky, SkyList *skylist); 420 void relastro_client_free (SkyTable *sky, SkyList *skylist); 419 421 420 422 GSCRegion *find_regions PROTO((Image *image, off_t Nimage, int *Nregions, GSCRegion *fullregion)); … … 438 440 void initImageBins PROTO((Catalog *catalog, int Ncatalog, int FULLINIT)); 439 441 void initImages PROTO((Image *input, off_t *line_number, off_t N)); 442 void freeImages PROTO(()); 440 443 void initMosaicBins PROTO((Catalog *catalog, int Ncatalog)); 441 444 void initMosaicGrid PROTO((Image *image, off_t Nimage)); … … 528 531 int UpdateSimple (Catalog *catalog, int Ncatalog); 529 532 int UpdateChips (Catalog *catalog, int Ncatalog, int Nloop); 533 int UpdateStacks (Catalog *catalog, int Ncatalog); 530 534 int UpdateMosaic (Catalog *catalog, int Ncatalog); 531 535 int UpdateMeasures (Catalog *catalog, int Ncatalog); … … 552 556 Mosaic *getmosaics (off_t *N); 553 557 void initMosaics (Image *image, off_t Nimage); 558 void freeMosaics (); 554 559 StarData *getMosaicRaw (Catalog *catalog, int Ncatalog, off_t mos, off_t *Nstars); 555 560 StarData *getMosaicRef (Catalog *catalog, int Ncatalog, off_t mos, off_t *Nstars); … … 588 593 589 594 int initStarMaps (); 595 void freeStarMaps (); 590 596 int updateStarMaps(Catalog *catalog); 591 597 int createStarMapPoints(); … … 653 659 654 660 int indexCatalogs (Catalog *catalog, int Ncatalog); 655 int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq); 661 int catID_and_objID_to_seq (unsigned int catID, unsigned int objID, int *catSeq, off_t *objSeq); 662 void freeCatalogIndexes (int Ncatalog); 656 663 657 664 int markObjects (Catalog *catalog, int Ncatalog); … … 682 689 AstromOffsetTable *get_astrom_table (); 683 690 void put_astrom_table (AstromOffsetTable *myTable); 691 void free_astrom_table (); 684 692 685 693 int fit_map (AstromOffsetMap *map, StarData *raw, StarData *ref, int Npts); -
trunk/Ohana/src/relastro/src
- Property svn:mergeinfo set to
-
trunk/Ohana/src/relastro/src/BootstrapOps.c
r39364 r39457 98 98 myAbort ("invalid option"); 99 99 } 100 free (values); 100 101 101 102 return TRUE; -
trunk/Ohana/src/relastro/src/BrightCatalog.c
r39396 r39457 358 358 ohana_memcheck (1); 359 359 360 my_memdump("start of define_bintable");361 360 gfits_define_bintable_column (&theader, "D", "RA", "ra", "degrees", 1.0, 0.0); 362 my_memdump("after define_bintable RA");363 364 361 gfits_define_bintable_column (&theader, "D", "DEC", "dec", "degrees", 1.0, 0.0); 365 my_memdump("after define_bintable DEC");366 367 362 gfits_define_bintable_column (&theader, "E", "MAG_SYS", "magnitude (sys)", NULL, 1.0, 0.0); 368 363 gfits_define_bintable_column (&theader, "E", "MAG_CAL", "magnitude (cal)", NULL, 1.0, 0.0); … … 433 428 // add the columns to the output array 434 429 gfits_set_bintable_column (&theader, &ftable, "RA", R, catalog->Nmeasure); 430 431 fprintf (stderr, "--------------- after set_bintable RA --------------"); 432 ohana_memdump_file (stderr, TRUE); 433 435 434 gfits_set_bintable_column (&theader, &ftable, "DEC", D, catalog->Nmeasure); 436 435 gfits_set_bintable_column (&theader, &ftable, "MAG_SYS", M, catalog->Nmeasure); … … 798 797 catalogs->maxID = 0; 799 798 ALLOCATE (catalogs->index, int, catalogs->maxID + 1); 800 for (i = 0; i <= catalogs->maxID; i++) catalogs->index[i] = -1; 799 800 unsigned int ID; 801 for (ID = 0; ID <= catalogs->maxID; ID++) catalogs->index[ID] = -1; 801 802 802 803 catalogs->Nsecfilt = Nsecfilt; … … 807 808 ALLOCATE (catalogs->catalog, Catalog, catalogs->NCATALOG); 808 809 809 ALLOCATE (catalogs->catIDs, int,catalogs->NCATALOG);810 ALLOCATE (catalogs->NAVERAGE, off_t, catalogs->NCATALOG);811 ALLOCATE (catalogs->NMEASURE, off_t, catalogs->NCATALOG);810 ALLOCATE (catalogs->catIDs, unsigned int, catalogs->NCATALOG); 811 ALLOCATE (catalogs->NAVERAGE, off_t, catalogs->NCATALOG); 812 ALLOCATE (catalogs->NMEASURE, off_t, catalogs->NCATALOG); 812 813 813 814 for (i = 0; i < catalogs->NCATALOG; i++) { … … 828 829 int BrightCatalogSplitFree (CatalogSplitter *catalogs) { 829 830 830 free (catalogs->catIDs); 831 free (catalogs->NAVERAGE); 832 free (catalogs->NMEASURE); 833 free (catalogs->index); 834 free (catalogs); 831 # if (0) 832 int i; 833 834 for (i = 0; i < catalogs->NCATALOG; i++) { 835 FREE (catalogs->catalog[i].average); 836 FREE (catalogs->catalog[i].secfilt); 837 FREE (catalogs->catalog[i].measureT); 838 } 839 FREE (catalogs->catalog); 840 # endif 841 842 FREE (catalogs->catIDs); 843 FREE (catalogs->NAVERAGE); 844 FREE (catalogs->NMEASURE); 845 FREE (catalogs->index); 846 FREE (catalogs); 835 847 return TRUE; 836 848 } … … 844 856 845 857 // find the max value of catID in this BrightCatalog 846 int catIDmax = 0;858 unsigned int catIDmax = 0; 847 859 for (i = 0; i < bcatalog->Naverage; i++) { 848 860 catIDmax = MAX(catIDmax, bcatalog->average[i].catID); … … 850 862 // XXX validate the measure ID range here 851 863 852 int maxIDold = catalogs->maxID;864 unsigned int maxIDold = catalogs->maxID; 853 865 catalogs->maxID = MAX (maxIDold, catIDmax); 854 866 855 867 // extend the index array and init 856 868 REALLOCATE (catalogs->index, int, catalogs->maxID + 1); 857 for (i = maxIDold + 1; i <= catalogs->maxID; i++) catalogs->index[i] = -1; 869 870 unsigned int id; 871 for (id = maxIDold + 1; id <= catalogs->maxID; id++) catalogs->index[id] = -1; 858 872 859 873 // identify the new catID values 860 874 for (i = 0; i < bcatalog->Naverage; i++) { 861 int catID = bcatalog->average[i].catID;875 unsigned int catID = bcatalog->average[i].catID; 862 876 assert (catID > 0); 863 877 assert (catID < catalogs->maxID + 1); … … 881 895 882 896 if (catalogs->Ncatalog >= catalogs->NCATALOG) { 897 int oldNCATALOG = catalogs->NCATALOG; 883 898 catalogs->NCATALOG += 16; 884 899 // fprintf (stderr, "realloc catalogs->catalog: old: %llx ", (long long) catalogs->catalog); … … 894 909 // fprintf (stderr, "new: %llx - %llx\n", (long long) catalogs->NMEASURE, (long long) (catalogs->NMEASURE + sizeof(off_t)*catalogs->NCATALOG)); 895 910 896 REALLOCATE (catalogs->catIDs, int,catalogs->NCATALOG);911 REALLOCATE (catalogs->catIDs, unsigned int, catalogs->NCATALOG); 897 912 898 913 int j; 899 for (j = catalogs->NCATALOG - 16; j < catalogs->NCATALOG; j++) {914 for (j = oldNCATALOG; j < catalogs->NCATALOG; j++) { 900 915 dvo_catalog_init (&catalogs->catalog[j], TRUE); 901 916 catalogs->catIDs[j] = 0; … … 917 932 // assign the averages to the corresponding catalog 918 933 for (i = 0; i < bcatalog->Naverage; i++) { 919 int ID = bcatalog->average[i].catID;934 unsigned int ID = bcatalog->average[i].catID; 920 935 int Nc = catalogs->index[ID]; 921 936 assert (Nc > -1); … … 942 957 // XXX what about averef and related links? Do I need them? 943 958 for (i = 0; i < bcatalog->Nmeasure; i++) { 944 int ID = bcatalog->measure[i].catID;959 unsigned int ID = bcatalog->measure[i].catID; 945 960 int Nc = catalogs->index[ID]; 946 961 assert (Nc > -1); -
trunk/Ohana/src/relastro/src/FitAstromOps.c
r39375 r39457 297 297 median = x[(int)(0.5*Npoints)]; 298 298 } 299 free (x); 299 300 300 301 return median; -
trunk/Ohana/src/relastro/src/FitChip.c
r38986 r39457 221 221 222 222 int i, Ns; 223 float dL, dM, dLsum, dLsum2, dMsum, dMsum2, *dR; 224 225 ALLOCATE (dR, float, Nstars); 223 float dL, dM; 224 225 ALLOCATE_PTR (dRvec, double, Nstars); 226 ALLOCATE_PTR (dLvec, double, Nstars); 227 ALLOCATE_PTR (dMvec, double, Nstars); 226 228 227 229 Ns = 0; 228 dLsum = dLsum2 = dMsum = dMsum2 = 0.0;229 230 for (i = 0; i < Nstars; i++) { 230 231 if (raw[i].mask) continue; … … 235 236 dM = raw[i].M - ref[i].M; 236 237 237 dLsum += dL; 238 dLsum2 += dL*dL; 239 dMsum += dM; 240 dMsum2 += dM*dM; 241 242 dR[Ns] = hypot (dL, dM); 238 dLvec[Ns] = dL; 239 dMvec[Ns] = dM; 240 dRvec[Ns] = hypot (dL, dM); 243 241 Ns++; 244 242 } 245 243 246 *dLsig = sqrt((dLsum2 / Ns) - SQ(dLsum/Ns)); 247 *dMsig = sqrt((dMsum2 / Ns) - SQ(dMsum/Ns)); 244 dsort (dLvec, Ns); 245 dsort (dMvec, Ns); 246 247 double Slo, Shi; 248 Slo = VectorFractionInterpolate (dLvec, 0.158655, Ns); 249 Shi = VectorFractionInterpolate (dLvec, 0.841345, Ns); 250 *dLsig = (Shi - Slo) / 2.0; 251 free (dLvec); 252 253 Slo = VectorFractionInterpolate (dMvec, 0.158655, Ns); 254 Shi = VectorFractionInterpolate (dMvec, 0.841345, Ns); 255 *dMsig = (Shi - Slo) / 2.0; 256 free (dMvec); 257 248 258 *nKeep = Ns; 249 259 250 260 if (Ns < 5) { 251 261 *dRsig = NAN; 252 free (dR );262 free (dRvec); 253 263 return (FALSE); 254 264 } 255 265 256 266 // for a 2D Gaussian, 40% of the points are within R = 1 sigma 257 fsort (dR, Ns);258 *dRsig = dR [(int)(0.40*Ns)];267 dsort (dRvec, Ns); 268 *dRsig = dRvec[(int)(0.40*Ns)]; 259 269 260 free (dR );270 free (dRvec); 261 271 return (TRUE); 262 272 } -
trunk/Ohana/src/relastro/src/GetAstromError.c
r39225 r39457 76 76 // weight to ensure the image is tied down to the 2mass frame 77 77 78 if (has2MASS && LoopWeight2MASS ) {78 if (has2MASS && LoopWeight2MASS && (Nloop >= 0)) { 79 79 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 80 80 } 81 if (is2MASS && LoopWeight2MASS ) {81 if (is2MASS && LoopWeight2MASS && (Nloop >= 0)) { 82 82 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 83 83 } 84 if (isTycho && LoopWeightTycho ) {84 if (isTycho && LoopWeightTycho && (Nloop >= 0)) { 85 85 dPtotal = dPtotal / LoopWeightTycho[Nloop]; 86 86 } -
trunk/Ohana/src/relastro/src/ImageOps.c
r39381 r39457 1 1 # include "relastro.h" 2 int isGPC1chip (int photcode);3 2 4 3 # define USE_IMAGE_ID 1 … … 10 9 // if we read only a subset of the rows from the Image FITS, LineNumber tells us to which row 11 10 // each image belongs 12 static off_t *LineNumber ; // match of subset to full image table13 14 static off_t *N_onImage ; // number of measurements on image15 static off_t *N_ONIMAGE ; // allocated number of measurements on image16 17 static int *Ncatlist ; // catalogs associated with each image18 static int *NCATLIST ; // catalogs associated with each image19 static int **catlist ; // catalogs associated with each image20 21 static IDX_T **MeasureToImage ; // link from catalog,measure to image22 static IDX_T **ImageToCatalog ; // catalog which supplied measurement on image23 static IDX_T **ImageToMeasure ; // measure reference for measurement on image11 static off_t *LineNumber = NULL; // match of subset to full image table 12 13 static off_t *N_onImage = NULL; // number of measurements on image 14 static off_t *N_ONIMAGE = NULL; // allocated number of measurements on image 15 16 static int *Ncatlist = NULL; // catalogs associated with each image 17 static int *NCATLIST = NULL; // catalogs associated with each image 18 static int **catlist = NULL; // catalogs associated with each image 19 20 static IDX_T **MeasureToImage = NULL; // link from catalog,measure to image 21 static IDX_T **ImageToCatalog = NULL; // catalog which supplied measurement on image 22 static IDX_T **ImageToMeasure = NULL; // measure reference for measurement on image 24 23 25 24 // if we search by image ID, we sort (imageIDs, imageIdx) by imageIDs to get a sorted … … 27 26 28 27 # if USE_IMAGE_ID 29 static off_t *imageIDs ; // list of all image IDs30 static off_t *imageIdx ; // list of index for image IDs28 static off_t *imageIDs = NULL; // list of all image IDs 29 static off_t *imageIdx = NULL; // list of index for image IDs 31 30 32 31 // as an alternative, we generate imageSeq, which directly maps imageID -> seq 33 static off_t *imageSeq ; // list of index for image IDs32 static off_t *imageSeq = NULL; // list of index for image IDs 34 33 35 34 // MAX_ID requires 512M to store the image index … … 120 119 } 121 120 # endif 121 } 122 123 void freeImages () { 124 125 FREE (LineNumber); 126 127 # if USE_IMAGE_ID 128 FREE (imageIDs); 129 FREE (imageIdx); 130 FREE (imageSeq); 131 # else 132 FREE (start); 133 FREE (stop); 134 # endif 135 136 free_astrom_table(); 122 137 } 123 138 … … 197 212 198 213 for (i = 0; i < Ncatalog; i++) { 199 free(MeasureToImage[i]);200 } 201 free(MeasureToImage);214 FREE (MeasureToImage[i]); 215 } 216 FREE (MeasureToImage); 202 217 for (i = 0; i < Nimage; i++) { 203 if (ImageToCatalog[i]) { free (ImageToCatalog[i]); } 204 if (ImageToMeasure[i]) { free (ImageToMeasure[i]); } 205 } 206 free (ImageToCatalog); 207 free (ImageToMeasure); 208 free (N_onImage); 209 free (N_ONIMAGE); 218 FREE (ImageToCatalog[i]); 219 FREE (ImageToMeasure[i]); 220 if (catlist) { FREE (catlist[i]); } 221 } 222 FREE (Ncatlist); 223 FREE (NCATLIST); 224 FREE (catlist); 225 Ncatlist = NULL; 226 NCATLIST = NULL; 227 catlist = NULL; 228 229 FREE (ImageToCatalog); 230 FREE (ImageToMeasure); 231 FREE (N_onImage); 232 FREE (N_ONIMAGE); 210 233 } 211 234 … … 240 263 name = GetPhotcodeNamebyCode (image[i].photcode); 241 264 int showExample = (Nfew < 30); 242 if (showExample) fprintf (stderr, "image "OFF_T_FMT" (%d, %s) has "OFF_T_FMT" of %d measures (%s, %s) ", i, image[i].imageID, image[i].name, N_onImage[i], image[i].nstar, 243 ohana_sec_to_date(image[i].tzero), name); 265 if (showExample) { 266 char *myDate = ohana_sec_to_date(image[i].tzero); 267 fprintf (stderr, "image "OFF_T_FMT" (%d, %s) has "OFF_T_FMT" of %d measures (%s, %s) ", i, image[i].imageID, image[i].name, N_onImage[i], image[i].nstar, myDate, name); 268 free (myDate); 269 } 244 270 if (N_onImage[i] < 20) { 245 271 if (showExample) fprintf (stderr, "*"); … … 508 534 m = ImageToMeasure[im][i]; 509 535 c = ImageToCatalog[im][i]; 536 myAssert (c < Ncatalog, "oops"); 510 537 511 538 Measure *measure = &catalog[c].measure[m]; … … 653 680 m = ImageToMeasure[im][i]; 654 681 c = ImageToCatalog[im][i]; 682 myAssert (c < Ncatalog, "oops"); 655 683 656 684 MeasureTiny *measure = &catalog[c].measureT[m]; … … 753 781 m = ImageToMeasure[im][i]; 754 782 c = ImageToCatalog[im][i]; 783 myAssert (c < Ncatalog, "oops"); 755 784 756 785 MeasureTiny *measure = &catalog[c].measureT[m]; … … 829 858 m = ImageToMeasure[im][i]; 830 859 c = ImageToCatalog[im][i]; 860 myAssert (c < Ncatalog, "oops"); 831 861 832 862 // XXX should I use the raw coords or just measure.X,Y -> R,D? … … 871 901 m = ImageToMeasure[im][i]; 872 902 c = ImageToCatalog[im][i]; 903 myAssert (c < Ncatalog, "oops"); 873 904 874 905 MeasureTiny *measure = &catalog[c].measureT[m]; … … 900 931 } 901 932 933 # if (0) 902 934 /** lifted from relphot/StarOps.clean_measures */ 903 935 void FlagOutliers2D(Catalog *catalog); … … 1267 1299 return TRUE; 1268 1300 } 1301 # endif -
trunk/Ohana/src/relastro/src/ImageTable.c
r38441 r39457 33 33 } 34 34 35 // gfits_db_free (&db); 36 gfits_free_header (&db.header); 37 gfits_free_matrix (&db.matrix); 38 gfits_free_header (&db.theader); 39 free (db.filename); 40 35 41 *nimage = Nimage; 36 42 return image; … … 61 67 dvo_image_unlock (&db); 62 68 69 gfits_db_free (&db); 70 63 71 return TRUE; 64 72 } -
trunk/Ohana/src/relastro/src/MosaicOps.c
r37038 r39457 3 3 // array of mosaic definition structures 4 4 static off_t Nmosaic; 5 static Mosaic *mosaic ;5 static Mosaic *mosaic = NULL; 6 6 7 7 // list of all images associated with a mosaic … … 185 185 } 186 186 187 void freeMosaics () { 188 189 off_t i; 190 191 if (!mosaic) return; 192 193 for (i = 0; i < Nmosaic; i++) { 194 FREE (mosaic_own_images[i]); 195 } 196 197 FREE (mosaic); 198 FREE (Nmosaic_own_images); 199 FREE (Amosaic_own_images); 200 FREE (mosaic_own_images); 201 FREE (mosaic_for_images); 202 } 203 187 204 // return StarData values for detections in the specified image, converting coordinates from the 188 205 // chip positions: X,Y -> L,M -> P,Q -> R,D … … 274 291 // extend each host image table to include the mosaic 'images' needed by the host 275 292 int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage) { 293 OHANA_UNUSED_PARAM(Nimage); 276 294 277 295 int i; … … 324 342 } 325 343 344 free (addMosaic); 345 326 346 host->Nimage += Nadd; 327 347 } 348 free (mosaicUsed); 349 328 350 return TRUE; 329 351 } -
trunk/Ohana/src/relastro/src/SetSignals.c
r39402 r39457 54 54 55 55 void my_memdump (char *message) { 56 57 return; 56 58 57 59 fprintf (stderr, "%s\n", message); -
trunk/Ohana/src/relastro/src/StarMaps.c
r38986 r39457 25 25 } StarMap; 26 26 27 static StarMap *starmap;27 static StarMap *starmap = NULL; 28 28 // static int Nstarmap; -- is it always == Nimages? 29 29 … … 55 55 } 56 56 57 void freeStarMaps () { 58 59 off_t i, Nimages; 60 61 getimages(&Nimages, NULL); 62 63 for (i = 0; i < Nimages; i++) { 64 FREE (starmap[i].points); 65 FREE (starmap[i].stars); 66 } 67 68 FREE (starmap); 69 return; 70 } 71 57 72 int updateStarMaps(Catalog *catalog) { 58 73 -
trunk/Ohana/src/relastro/src/UpdateChips.c
r38986 r39457 152 152 } 153 153 } 154 155 AstromOffsetMapFree (oldCoords.offsetMap); 154 156 155 157 // Apply the modified coords back to the measure.R,D. Note that raw.R,D, ref.L,M, etc … … 356 358 } 357 359 360 AstromOffsetMapFree (oldCoords.offsetMap); 361 358 362 // apply the modified R,D back to the measures 359 363 setImageRaw (threadinfo->catalog, threadinfo->Ncatalog, i, raw, Nraw, MODE_MOSAIC); … … 569 573 AstromOffsetMapSetOrder (truMap, tmpMap->Nx, tmpMap->Ny, image); 570 574 AstromOffsetMapCopyData (truMap, tmpMap); 575 AstromOffsetMapFree (tmpMap); 571 576 return; 572 577 } … … 579 584 unlockUpdateChips (); 580 585 AstromOffsetMapCopyData (image->coords.offsetMap, tmpMap); 586 AstromOffsetMapFree (tmpMap); 581 587 return; 582 588 } -
trunk/Ohana/src/relastro/src/UpdateMeasures.c
r39385 r39457 71 71 72 72 double dR = 3600.0*fabs(csdec*(oldR - R)); 73 double dD = 3600.0*fabs(oldD - R);73 double dD = 3600.0*fabs(oldD - D); 74 74 75 75 // complain if the new location is far from the old location -
trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c
r39171 r39457 62 62 // uses MeasureTiny values, but will also update Measure values when populated 63 63 // if Galaxy Motion Model correction is active, do not apply at this last stage 64 UpdateObjects (&catalog, 1, FALSE);64 UpdateObjects (&catalog, 1, -1); 65 65 66 66 free_tiny_values(&catalog); … … 218 218 fprintf (stderr, "command: %s\n", command); 219 219 220 if (PARALLEL_MANUAL) continue; 220 if (PARALLEL_MANUAL) { 221 free (command); 222 continue; 223 } 221 224 222 225 if (PARALLEL_SERIAL) { … … 236 239 group->hosts[i][0].pid = pid; // save for future reference 237 240 } 241 free (command); 238 242 } 239 243 … … 338 342 fprintf (stderr, "command: %s\n", command); 339 343 340 if (PARALLEL_MANUAL) continue; 344 if (PARALLEL_MANUAL) { 345 free (command); 346 continue; 347 } 341 348 342 349 if (PARALLEL_SERIAL) { … … 356 363 table->hosts[i].pid = pid; // save for future reference 357 364 } 365 free (command); 358 366 } 359 367 … … 366 374 } 367 375 376 FreeHostTable (table); 377 368 378 return TRUE; 369 379 } -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r39390 r39457 121 121 // be called with just MeasureTiny set and Measure == NULL 122 122 int UpdateObjects_Chips (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats, int cat, off_t measOff) { 123 OHANA_UNUSED_PARAM(Nsecfilt); 123 124 124 125 int k; … … 257 258 } 258 259 260 // if we have fitted (and accepted) a parallax model, get the best pm fit and chisq 261 // given the set of points (mask is respected) 259 262 if (average[0].flags & ID_OBJ_USE_PAR) { 260 // get the best pm fit and chisq given the set of points (mask is respected)261 263 if (!FitPM_Basic (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) { 262 264 average[0].flags |= ID_OBJ_BAD_PM; … … 551 553 // be called with just MeasureTiny set and Measure == NULL 552 554 int UpdateObjects_Stack (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats) { 555 OHANA_UNUSED_PARAM(Nsecfilt); 553 556 554 557 int status; … … 650 653 651 654 int UpdateObjects_SelectMeasures (FitStats *fit, Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int isStack, int *stackEntry) { 655 OHANA_UNUSED_PARAM(secfilt); 652 656 653 657 // I've already allocated fit->points (and fit->sample) with space for fit->NpointsAlloc entries -
trunk/Ohana/src/relastro/src/args.c
r39396 r39457 51 51 remove_argument (N, &argc, argv); 52 52 RELASTRO_OP = OP_UPDATE_OFFSETS; 53 } 54 55 // elements needed for parallel regions / parallel images 56 MANUAL_UNIQUER = NULL; 57 if ((N = get_argument (argc, argv, "-manual-uniquer"))) { 58 remove_argument (N, &argc, argv); 59 MANUAL_UNIQUER = strcreate (argv[N]); 60 remove_argument (N, &argc, argv); 53 61 } 54 62 … … 372 380 snprintf (PHOTCODE_SKIP_LIST, Ntotal, "%s,%s", SuperCOSMOS_SKIP, RawSkip); 373 381 free (RawSkip); 374 free (SuperCOSMOS_SKIP);375 382 } else { 376 383 PHOTCODE_SKIP_LIST = RawSkip; … … 378 385 remove_argument (N, &argc, argv); 379 386 } 387 free (SuperCOSMOS_SKIP); 380 388 381 389 VERBOSE = VERBOSE2 = FALSE; … … 562 570 if (argc != 1) usage (); 563 571 return TRUE; 572 } 573 574 void relastro_free (SkyTable *sky, SkyList *skylist) { 575 FREE (REGION_FILE); 576 FREE (IMAGE_TABLE); 577 FREE (LoopWeight2MASSstr); 578 FREE (LoopWeightTychostr); 579 580 FREE (PHOTCODE_SKIP_LIST); 581 FREE (PHOTCODE_KEEP_LIST); 582 FREE (PHOTCODE_RESET_LIST); 583 FREE (DCR_RED_COLOR_POS); 584 FREE (DCR_RED_COLOR_NEG); 585 FREE (DCR_BLUE_COLOR_POS); 586 FREE (DCR_BLUE_COLOR_NEG); 587 588 FREE (PHOTCODE_A_LIST); 589 FREE (PHOTCODE_B_LIST); 590 FREE (HIGH_SPEED_DIR); 591 FREE (BCATALOG); 592 FREE (HOSTDIR); 593 594 // these are set in initialize 595 FREE(photcodesKeep); 596 FREE(photcodesSkip); 597 FREE(photcodesReset); 598 FREE(photcodesGroupA); 599 FREE(photcodesGroupB); 600 601 SkyTableFree (sky); 602 SkyListFree(skylist); 603 FreePhotcodeTable(); 604 605 ohana_memcheck (VERBOSE); 606 ohana_memdump (VERBOSE); 564 607 } 565 608 … … 922 965 } 923 966 924 void relastro_client_free ( ) {967 void relastro_client_free (SkyTable *sky, SkyList *skylist) { 925 968 FREE (PHOTCODE_SKIP_LIST); 926 969 FREE (PHOTCODE_KEEP_LIST); … … 936 979 FREE(BCATALOG); 937 980 FREE (HOSTDIR); 981 982 // these are set in initialize 983 FREE(photcodesKeep); 984 FREE(photcodesSkip); 985 FREE(photcodesReset); 986 FREE(photcodesGroupA); 987 FREE(photcodesGroupB); 988 989 SkyTableFree (sky); 990 SkyListFree(skylist); 991 FreePhotcodeTable(); 992 993 ohana_memcheck (VERBOSE); 994 ohana_memdump (VERBOSE); 938 995 } 939 996 -
trunk/Ohana/src/relastro/src/assign_images.c
r38986 r39457 156 156 157 157 // this is a bit memory expensive : I am making a complete copy of the image table here 158 // XXX is adding an image, can we just add a pointer? 158 159 off_t Nsubset = host->Nimage; 159 160 host->image[Nsubset] = image[j]; … … 168 169 169 170 // save the astrometry maps, where they exist 171 // here we are adding an AstromOffsetTable, but the data are only pointers 172 // we should NOT free this table with AstromOffsetTableFree() 170 173 if (image[j].coords.offsetMap) { 171 174 if (!host->astromTable) { -
trunk/Ohana/src/relastro/src/bcatalog.c
r39375 r39457 184 184 offset = catalog[0].average[i].measureOffset + j; 185 185 186 // we do not measure astrometry for the warps, so skip: 187 if (isGPC1warp(catalog[0].measure[offset].photcode)) continue; 188 186 189 // filter objects based on user supplied criteria, including SIGMA_LIM 187 190 if (!MeasFilterTest(&catalog[0].measure[offset], TRUE)) { -
trunk/Ohana/src/relastro/src/dvo_astrom_ops.c
r37038 r39457 2 2 /* the Measure carries the instantaneous mean position at the epoch t */ 3 3 4 // average & secfilt no longer used since R and D are now in measure 5 4 6 double getMeanR (MeasureTiny *measure, Average *average, SecFilt *secfilt) { 7 OHANA_UNUSED_PARAM(average); 8 OHANA_UNUSED_PARAM(secfilt); 5 9 6 10 double ra; … … 14 18 15 19 double getMeanD (MeasureTiny *measure, Average *average, SecFilt *secfilt) { 20 OHANA_UNUSED_PARAM(average); 21 OHANA_UNUSED_PARAM(secfilt); 16 22 17 23 double dec; … … 25 31 26 32 int setMeanR (double ra_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) { 33 OHANA_UNUSED_PARAM(average); 34 OHANA_UNUSED_PARAM(secfilt); 27 35 28 36 // old: measure[0].dR += (ra_fit - average[0].R) * 3600.0; … … 34 42 35 43 int setMeanD (double dec_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) { 44 OHANA_UNUSED_PARAM(average); 45 OHANA_UNUSED_PARAM(secfilt); 36 46 37 47 // old: measure[0].dD += (dec_fit - average[0].D) * 3600.0; … … 43 53 44 54 double getMeanR_Big (Measure *measure, Average *average, SecFilt *secfilt) { 55 OHANA_UNUSED_PARAM(average); 56 OHANA_UNUSED_PARAM(secfilt); 45 57 46 58 double ra; … … 54 66 55 67 double getMeanD_Big (Measure *measure, Average *average, SecFilt *secfilt) { 68 OHANA_UNUSED_PARAM(average); 69 OHANA_UNUSED_PARAM(secfilt); 56 70 57 71 double dec; … … 65 79 66 80 int setMeanR_Big (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt) { 81 OHANA_UNUSED_PARAM(average); 82 OHANA_UNUSED_PARAM(secfilt); 67 83 68 84 // old: measure[0].dR += (ra_fit - average[0].R) * 3600.0; … … 74 90 75 91 int setMeanD_Big (double dec_fit, Measure *measure, Average *average, SecFilt *secfilt) { 92 OHANA_UNUSED_PARAM(average); 93 OHANA_UNUSED_PARAM(secfilt); 76 94 77 95 // measure[0].dD += (dec_fit - average[0].D) * 3600.0; -
trunk/Ohana/src/relastro/src/fitobj.c
r39370 r39457 156 156 157 157 Catalog *mkstar (FitStats *fitStats, double Ro, double Do, double uR, double uD, double plx, int Npoints, int Nbad) { 158 OHANA_UNUSED_PARAM(fitStats); 158 159 159 160 int i; … … 239 240 return catalog; 240 241 } 242 243 // these dummy functions are used to avoid including ImageOps, etc 244 int areImagesMatched () { 245 return FALSE; 246 } 247 float getColorBlue (off_t meas, int cat) { 248 OHANA_UNUSED_PARAM(meas); 249 OHANA_UNUSED_PARAM(cat); 250 return (NAN); 251 } 252 float getColorRed (off_t meas, int cat) { 253 OHANA_UNUSED_PARAM(meas); 254 OHANA_UNUSED_PARAM(cat); 255 return (NAN); 256 } -
trunk/Ohana/src/relastro/src/fitobj2.c
r39375 r39457 173 173 174 174 Catalog *mkstar (FitStats *fitStats, double Ro, double Do, double uR, double uD, double plx, int Npoints, int Nbad) { 175 OHANA_UNUSED_PARAM(fitStats); 175 176 176 177 int i; … … 264 265 return catalog; 265 266 } 267 268 // these dummy functions are used to avoid including ImageOps, etc 269 int areImagesMatched () { 270 return FALSE; 271 } 272 float getColorBlue (off_t meas, int cat) { 273 OHANA_UNUSED_PARAM(meas); 274 OHANA_UNUSED_PARAM(cat); 275 return (NAN); 276 } 277 float getColorRed (off_t meas, int cat) { 278 OHANA_UNUSED_PARAM(meas); 279 OHANA_UNUSED_PARAM(cat); 280 return (NAN); 281 } -
trunk/Ohana/src/relastro/src/fitstk.c
r39387 r39457 279 279 return catalog; 280 280 } 281 282 // these dummy functions are used to avoid including ImageOps, etc 283 int areImagesMatched () { 284 return FALSE; 285 } 286 float getColorBlue (off_t meas, int cat) { 287 OHANA_UNUSED_PARAM(meas); 288 OHANA_UNUSED_PARAM(cat); 289 return (NAN); 290 } 291 float getColorRed (off_t meas, int cat) { 292 OHANA_UNUSED_PARAM(meas); 293 OHANA_UNUSED_PARAM(cat); 294 return (NAN); 295 } -
trunk/Ohana/src/relastro/src/high_speed_utils.c
r38601 r39457 8 8 #define DEFAULT_WHERE_B "((flags & 0x01000000) == 0) && ((flags & 0x04000000) && ((y:nphot > 1) || (z:nphot > 1)) &&((y:err < 0.2) || (z:err < 0.2)))" 9 9 10 11 extern char **isolate_elements(int, char **, int *);12 10 13 11 int print_error(); … … 76 74 // parse it into elements of the where condition 77 75 char **cstack = NULL; 78 int Ncstack;76 unsigned int Ncstack; 79 77 cstack = isolate_elements(nWords, words, &Ncstack); 80 78 free(words); -
trunk/Ohana/src/relastro/src/indexCatalogs.c
r36630 r39457 1 1 # include "relastro.h" 2 2 3 static int catIDmax = 0;4 static int *catIDseq = NULL;5 static int *objIDmax = NULL;6 static int **objIDseq = NULL;3 static unsigned int catIDmax = 0; 4 static int *catIDseq = NULL; 5 static unsigned int *objIDmax = NULL; 6 static int **objIDseq = NULL; 7 7 8 8 int indexCatalogs (Catalog *catalog, int Ncatalog) { … … 19 19 20 20 ALLOCATE (catIDseq, int, catIDmax + 1); 21 for (i = 0; i < catIDmax + 1; i++) { 22 catIDseq[i] = -1; 21 22 unsigned int ID; 23 for (ID = 0; ID < catIDmax + 1; ID++) { 24 catIDseq[ID] = -1; 23 25 } 24 26 25 27 for (i = 0; i < Ncatalog; i++) { 26 int catID = catalog[i].catID;28 unsigned int catID = catalog[i].catID; 27 29 catIDseq[catID] = i; 28 30 } 29 31 30 ALLOCATE (objIDmax, int, Ncatalog);31 ALLOCATE (objIDseq, int *, Ncatalog);32 ALLOCATE (objIDmax, unsigned int, Ncatalog); 33 ALLOCATE (objIDseq, int *, Ncatalog); 32 34 for (i = 0; i < Ncatalog; i++) { 33 35 objIDmax[i] = 0; … … 37 39 38 40 ALLOCATE (objIDseq[i], int, objIDmax[i] + 1); 39 for ( j = 0; j < objIDmax[i] + 1; j++) {40 objIDseq[i][ j] = -1;41 for (ID = 0; ID < objIDmax[i] + 1; ID++) { 42 objIDseq[i][ID] = -1; 41 43 } 42 44 43 45 for (j = 0; j < catalog[i].Naverage; j++) { 44 int objID = catalog[i].average[j].objID;46 unsigned int objID = catalog[i].average[j].objID; 45 47 objIDseq[i][objID] = j; 46 48 } … … 49 51 } 50 52 51 int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq) { 53 void freeCatalogIndexes (int Ncatalog) { 54 int i; 55 56 for (i = 0; i < Ncatalog; i++) { 57 free (objIDseq[i]); 58 } 59 free (objIDmax); 60 free (objIDseq); 61 free (catIDseq); 62 } 63 64 int catID_and_objID_to_seq (unsigned int catID, unsigned int objID, int *catSeq, off_t *objSeq) { 52 65 53 66 if (catID > catIDmax) return FALSE; -
trunk/Ohana/src/relastro/src/initialize.c
r37807 r39457 2 2 3 3 void initialize (int argc, char **argv) { 4 5 photcodesKeep = NULL; 6 photcodesSkip = NULL; 7 photcodesReset = NULL; 8 photcodesGroupA = NULL; 9 photcodesGroupB = NULL; 4 10 5 11 ConfigInit (&argc, argv); -
trunk/Ohana/src/relastro/src/launch_region_hosts.c
r39389 r39457 161 161 fprintf (stderr, "command: %s\n", command); 162 162 163 if (PARALLEL_REGIONS_MANUAL) continue; 163 if (PARALLEL_REGIONS_MANUAL) { 164 free (command); 165 continue; 166 } 164 167 165 168 // launch the job, then wait for it to be done loading catalogs. force the remote … … 180 183 check_sync_file (syncfile, 1); 181 184 free (syncfile); 185 186 free (command); 182 187 } 183 188 -
trunk/Ohana/src/relastro/src/load_catalogs.c
r39396 r39457 142 142 int TIME = time(NULL); 143 143 int PID = getpid(); 144 snprintf (uniquer, 12, "%05d.%05d", PID, TIME % 100000); 144 145 if (PARALLEL_MANUAL && MANUAL_UNIQUER) { 146 snprintf (uniquer, 12, "%11s", MANUAL_UNIQUER); 147 } else { 148 snprintf (uniquer, 12, "%05d.%05d", PID, TIME % 100000); 149 } 145 150 146 151 // load the list of hosts … … 224 229 fprintf (stderr, "command: %s\n", command); 225 230 226 if (PARALLEL_MANUAL) continue; 231 if (PARALLEL_MANUAL) { 232 free (command); 233 continue; 234 } 227 235 228 236 if (PARALLEL_SERIAL) { … … 242 250 table->hosts[i].pid = pid; // save for future reference 243 251 } 252 free (command); 244 253 } 245 254 … … 289 298 } 290 299 300 FreeHostTable (table); 301 291 302 Catalog *catalog = catalogs->catalog; 292 303 *Ncatalog = catalogs->Ncatalog; 304 305 // need to free the place-holder catalogs: 306 for (i = catalogs->Ncatalog; i < catalogs->NCATALOG; i++) { 307 free (catalogs->catalog[i].average); 308 free (catalogs->catalog[i].measureT); 309 free (catalogs->catalog[i].secfilt); 310 } 293 311 294 312 int Nmeasure = 0; -
trunk/Ohana/src/relastro/src/load_images.c
r38986 r39457 27 27 MARKTIME("build chip match: %f sec\n", dtime); 28 28 29 char mapfile[DVO_MAX_PATH];30 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);31 table = AstromOffsetMapLoad (mapfile, 100000, VERBOSE);32 33 // assign images.coords.offsetMap -> table->map[i]34 if (table) {35 AstromOffsetTableMatchChips (image, Nimage, table);36 } else {37 table = AstromOffsetTableInit ();38 }39 40 29 // select the images which overlap the selected sky regions 41 30 if (UseAllImages) { … … 54 43 } 55 44 45 /* unlock, if we can (else, unlocked below) and free, if we can */ 46 int unlockImages = !UPDATE || (RELASTRO_OP == OP_UPDATE_OFFSETS); 47 if (unlockImages) { 48 if (subset != image) { 49 // if we have generated an image subset and we are running UPDATE_OFFSETS, the we can free images here 50 free (image); 51 db[0].ftable.buffer = NULL; 52 BuildChipMatch (subset, Nsubset); 53 } 54 dvo_image_unlock (db); 55 } 56 57 char mapfile[DVO_MAX_PATH]; 58 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR); 59 table = AstromOffsetMapLoad (mapfile, 100000, VERBOSE); 60 61 // assign images.coords.offsetMap -> table->map[i] 62 if (table) { 63 AstromOffsetTableMatchChips (subset, Nsubset, table); 64 } else { 65 table = AstromOffsetTableInit (); 66 } 67 56 68 initImages (subset, LineNumber, Nsubset); 57 69 MARKTIME(" init images: %f sec\n", dtime); … … 60 72 MARKTIME(" init mosaics: %f sec\n", dtime); 61 73 62 /* unlock, if we can (else, unlocked below) */63 int unlockImages = !UPDATE || (RELASTRO_OP == OP_UPDATE_OFFSETS);64 if (unlockImages) dvo_image_unlock (db);65 66 74 return TRUE; 67 75 } … … 102 110 } 103 111 112 void free_astrom_table () { 113 if (!table) return; 114 AstromOffsetTableFree (table); 115 free (table); 116 } -
trunk/Ohana/src/relastro/src/plot_scatter.c
r17203 r39457 2 2 3 3 void plot_scatter (Catalog *catalog, int Ncatalog) { 4 OHANA_UNUSED_PARAM(catalog); 5 OHANA_UNUSED_PARAM(Ncatalog); 4 6 5 7 # if (0) -
trunk/Ohana/src/relastro/src/plotstuff.c
r39396 r39457 44 44 45 45 void JpegPlot (Graphdata *graphmode, int N, char *filename) { 46 OHANA_UNUSED_PARAM(graphmode); 46 47 47 48 if (Xgraph[N] == 0) return; … … 52 53 53 54 void PSPlot (Graphdata *graphmode, int N, char *filename) { 55 OHANA_UNUSED_PARAM(graphmode); 54 56 55 57 if (Xgraph[N] == 0) return; … … 79 81 80 82 void PlotVector (int Npts, double *vect, int mode, int N, char *type) { 83 OHANA_UNUSED_PARAM(mode); 81 84 82 85 float *values; -
trunk/Ohana/src/relastro/src/relastro.c
r39382 r39457 7 7 initialize (argc, argv); 8 8 9 SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 10 SkyTableSetFilenames (sky, CATDIR, "cpt"); 11 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch); 9 SkyTable *sky = NULL; 10 SkyList *skylist = NULL; 11 12 if ((RELASTRO_OP != OP_PARALLEL_IMAGES) && (RELASTRO_OP != OP_PARALLEL_REGIONS)) { 13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 14 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 skylist = SkyListByPatch (sky, -1, &UserPatch); 16 } 12 17 13 18 switch (RELASTRO_OP) { … … 15 20 /* the object analysis is a separate process iterating over catalogs */ 16 21 relastro_objects (skylist, 0, NULL); 17 exit (0); 18 19 case OP_HIGH_SPEED: 20 /* high-speed is a 2pt cross-correlation process for linking moving objects (high PM) */ 21 high_speed_catalogs (sky, skylist, 0, NULL); 22 exit (0); 23 24 case OP_HPM: 25 hpm_catalogs (sky, skylist, 0, NULL); 26 exit (0); 27 28 case OP_MERGE_SOURCE: 29 /* a special method to manually merge unlinked detections of sources togther (not parallel) */ 30 relastro_merge_source (sky); 22 relastro_free (sky, skylist); 31 23 exit (0); 32 24 33 25 case OP_IMAGES: 34 26 relastro_images (skylist); 27 relastro_free (sky, skylist); 35 28 exit (0); 36 29 37 case OP_UPDATE_OFFSETS: 30 case OP_UPDATE_OFFSETS: { 31 FITS_DB db; 38 32 if (!PARALLEL) { 39 FITS_DB db;40 33 41 34 set_db (&db); … … 55 48 // iterate over catalogs to make detection coordinates consistant 56 49 UpdateObjectOffsets (skylist, 0, NULL); 50 51 if (!PARALLEL) { 52 gfits_db_free (&db); 53 freeImages(); 54 freeMosaics (); 55 } 56 57 relastro_free (sky, skylist); 57 58 exit (0); 59 } 58 60 59 61 case OP_PARALLEL_REGIONS: … … 67 69 exit (0); 68 70 71 case OP_HIGH_SPEED: 72 /* high-speed is a 2pt cross-correlation process for linking moving objects (high PM) */ 73 high_speed_catalogs (sky, skylist, 0, NULL); 74 exit (0); 75 76 case OP_HPM: 77 hpm_catalogs (sky, skylist, 0, NULL); 78 exit (0); 79 80 case OP_MERGE_SOURCE: 81 /* a special method to manually merge unlinked detections of sources togther (not parallel) */ 82 relastro_merge_source (sky); 83 exit (0); 84 69 85 default: 70 86 fprintf (stderr, "impossible!\n"); -
trunk/Ohana/src/relastro/src/relastro_client.c
r39396 r39457 55 55 } 56 56 57 SkyTableFree (sky);58 SkyListFree(skylist);59 FreePhotcodeTable();60 61 57 int i; 62 58 for (i = 0; i < Ncatalog; i++) { … … 66 62 BrightCatalogFree(bcatalog); 67 63 68 relastro_client_free (); 69 FREE(photcodesKeep); 70 FREE(photcodesSkip); 71 FREE(photcodesReset); 72 FREE(photcodesGroupA); 73 FREE(photcodesGroupB); 74 75 ohana_memcheck (TRUE); 76 ohana_memdump (TRUE); 64 relastro_client_free (sky, skylist); 77 65 break; 78 66 } … … 81 69 // USAGE: relastro_client -update-objects 82 70 relastro_objects (skylist, HOST_ID, HOSTDIR); 83 break; 84 } 85 86 case OP_HIGH_SPEED: { 87 // USAGE: relastro_client -high-speed 88 high_speed_catalogs (sky, skylist, HOST_ID, HOSTDIR); 89 break; 90 } 91 92 case OP_HPM: { 93 // USAGE: relastro_client -high-speed 94 hpm_catalogs (sky, skylist, HOST_ID, HOSTDIR); 71 relastro_client_free (sky, skylist); 95 72 break; 96 73 } … … 112 89 /* load regions and images based on specified sky patch (default depth) */ 113 90 load_images (&db, skylist, FALSE, USE_ALL_IMAGES); 114 115 // I can free the database after I have loaded the images...116 117 // // load the image subset table from the specified location118 // off_t Nimage;119 // ImageSubset *image = ImageSubsetLoad (IMAGES, &Nimage);120 // if (!image) {121 // fprintf (stderr, "ERROR loading image subset %s\n", CATDIR);122 // exit (2);123 // }124 //125 // // save the available image information in the static array in ImageOps.c126 // initImagesSubset (image, NULL, Nimage);127 //128 // // load the flat-field correction table from CATDIR129 // char flatcorrFile[1024];130 // snprintf (flatcorrFile, 1024, "%s/flatcorr.fits", CATDIR);131 // FlatCorrectionTable *flatcorr = FlatCorrectionLoad (flatcorrFile, VERBOSE);132 91 133 92 UpdateObjectOffsets (skylist, HOST_ID, HOSTDIR); 134 93 94 gfits_db_free (&db); 95 freeImages(); 96 freeMosaics (); 97 98 relastro_client_free (sky, skylist); 99 break; 100 } 101 102 case OP_HIGH_SPEED: { 103 // USAGE: relastro_client -high-speed 104 high_speed_catalogs (sky, skylist, HOST_ID, HOSTDIR); 105 break; 106 } 107 108 case OP_HPM: { 109 // USAGE: relastro_client -high-speed 110 hpm_catalogs (sky, skylist, HOST_ID, HOSTDIR); 135 111 break; 136 112 } -
trunk/Ohana/src/relastro/src/relastro_images.c
r38986 r39457 12 12 set_db (&db); 13 13 gfits_db_init (&db); 14 15 // final pass fit mode (use FIT_AVERAGE only for the image loop) 16 int finalPassMode = FIT_MODE; // start with the globally-defined fit mode 17 FIT_MODE = FIT_AVERAGE; 14 18 15 19 /* lock and load the image db table */ … … 77 81 MARKTIME("update chips: %f sec\n", dtime); 78 82 } 83 84 // measure scatter for stacks 85 UpdateStacks (catalog, Ncatalog); 86 MARKTIME("UpdateStacks: %f sec\n", dtime); 87 79 88 // create summary plots of the process 80 89 // relastroVisualSummaryChips(); … … 93 102 } 94 103 95 if (!UPDATE) exit (0); 104 if (!UPDATE) { 105 freeStarMaps(); 106 gfits_db_free (&db); 107 ohana_memcheck (VERBOSE); 108 ohana_memdump (VERBOSE); 109 exit (0); 110 } 96 111 97 112 // free the image / measurement pointers 98 freeImageBins (1); 113 freeImageBins (Ncatalog); 114 for (i = 0; i < Ncatalog; i++) { 115 dvo_catalog_free (&catalog[i]); 116 } 117 free (catalog); 118 freeMosaics (); 99 119 100 120 // If we did NOT use all images, then we applied the measured corrections to a subset of … … 105 125 reload_images (&db); 106 126 } 127 freeStarMaps(); 107 128 108 129 if (PARALLEL) { … … 116 137 } 117 138 dvo_image_unlock (&db); 139 gfits_db_free (&db); 140 freeImages(); 118 141 } 119 142 … … 123 146 124 147 // if we do NOT have parallel partitions, we must NOT write them out yet: the act of 125 // writing out the files byte-swaps the data and makes the values invalid efor the148 // writing out the files byte-swaps the data and makes the values invalid for the 126 149 // following calls to UpdateObjectOffsets (which attempt to apply the image values from 127 150 // the structure in memory) 151 152 FIT_MODE = finalPassMode; // use the user-selected mode for the final pass 128 153 129 154 // iterate over catalogs to make detection coordinates consistant … … 141 166 } 142 167 dvo_image_unlock (&db); 168 gfits_db_free (&db); 169 freeImages(); 143 170 } 144 171 145 exit (0);172 return TRUE; 146 173 } -
trunk/Ohana/src/relastro/src/relastro_merge_source.c
r38986 r39457 22 22 // load data from each region file, only use bright stars 23 23 for (i = 0; i < sky[0].Nregions; i++) { 24 if (sky[0].regions[i].index == CAT_ID_SRC) { 24 myAssert (sky[0].regions[i].index >= 0, "oops"); 25 if ((unsigned int) sky[0].regions[i].index == CAT_ID_SRC) { 25 26 catalog_src.filename = sky[0].filename[i]; 26 27 region_src = &sky[0].regions[i]; 27 28 } 28 29 // currently, we only accept dst == src... 29 if ( sky[0].regions[i].index == CAT_ID_DST) {30 if ((unsigned int) sky[0].regions[i].index == CAT_ID_DST) { 30 31 catalog_dst.filename = sky[0].filename[i]; 31 32 // region_dst = &sky[0].regions[i]; -
trunk/Ohana/src/relastro/src/relastro_objects.c
r39375 r39457 84 84 populate_tiny_values(&catalog, DVO_TV_MEASURE); 85 85 86 UpdateObjects (&catalog, 1, 0); 86 // the 3rd argument (-1) is the loop number for re-weighting 2MASS and Tycho. -1 is a special value meaning "ignore" 87 // we do NOT want to apply special weights to 2MASS and/or Tycho when calculating object final motions. 88 UpdateObjects (&catalog, 1, -1); 87 89 88 90 free_tiny_values(&catalog); … … 215 217 table->hosts[i].pid = pid; // save for future reference 216 218 } 219 free (command); 217 220 } 218 221 … … 224 227 HostTableWaitJobsGetIO (table, __FILE__, __LINE__, VERBOSE); 225 228 } 229 FreeHostTable (table); 226 230 227 231 return TRUE; -
trunk/Ohana/src/relastro/src/relastro_parallel_images.c
r38986 r39457 16 16 17 17 INITTIME; 18 19 // over-ride user selection here: this program does not set the final object 20 // astrometry. since it only sets the image parameters it should not use pm or par 21 FIT_MODE = FIT_AVERAGE; 18 22 19 23 client_logger_init (CATDIR); … … 141 145 LOGRTIME("slurp_meas_pos loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime); 142 146 } 147 148 // measure scatter for stacks 149 UpdateStacks (catalog, Ncatalog); 150 LOGRTIME("UpdateStacks on %s, host %d: %f sec\n", myHostName, REGION_HOST_ID, dtime); 151 143 152 // create summary plots of the process 144 153 // relastroVisualSummaryChips(); … … 176 185 LOGRTIME("share image pos loop %d on %s, host %d: %f sec\n", -1, myHostName, REGION_HOST_ID, dtime); 177 186 187 // free the image / measurement pointers 188 freeImageBins (Ncatalog); 189 for (i = 0; i < Ncatalog; i++) { 190 dvo_catalog_free (&catalog[i]); 191 } 192 free (catalog); 193 freeCatalogIndexes(Ncatalog); 194 195 freeMosaics (); 196 197 freeStarMaps(); 198 199 freeImages(); 200 free (image); 201 202 FreeRegionHostTable (regionHosts); 203 relastro_free (sky, skylist); 204 178 205 exit (0); 179 206 } -
trunk/Ohana/src/relastro/src/relastro_parallel_regions.c
r38441 r39457 83 83 } 84 84 85 // testjump: 86 85 87 MARKTIME ("finished relastro -parallel-regions: %f sec total\n", dtime); 88 89 gfits_db_free (&db); 90 freeImages(); 91 freeMosaics (); 92 93 FreeRegionHostTable (regionHosts); 94 relastro_free (sky, skylist); 86 95 87 96 exit (0); -
trunk/Ohana/src/relastro/src/share_icrf_obj.c
r37807 r39457 99 99 int cat, ave, meas; 100 100 ICRFdata (i, &cat, &ave, &meas); 101 myAssert (cat < Ncatalog, "oops"); 101 102 102 103 Average *average = &catalog[cat].average[ave]; -
trunk/Ohana/src/relastro/src/share_images_pos.c
r38986 r39457 141 141 142 142 AstromOffsetTableFree(table); 143 free (table); 143 144 LOGRTIME("image_maps_free host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 144 145 } 145 146 146 147 // apply the modified image parameters to my detections 148 // This loop is skipped because the updated image parameters are applied to 149 // all measurements in UpdateChips (and those modified measurements are saved 150 // at the same time) 147 151 for (i = 0; FALSE && (Ncatalog > 0) && (i < Nimage_pos); i++) { 148 152 off_t seq = getImageByID (image_pos[i].imageID); -
trunk/Ohana/src/relastro/src/share_mean_pos.c
r38062 r39457 107 107 continue; 108 108 } 109 109 myAssert (catSeq < Ncatalog, "oops"); 110 110 111 catalog[catSeq].average[objSeq].R = meanpos[i].R; 111 112 catalog[catSeq].average[objSeq].D = meanpos[i].D; -
trunk/Ohana/src/relastro/src/share_meas_pos.c
r38062 r39457 58 58 off_t i, k; 59 59 60 int Nmeaspos = 0;61 MeasPos *measpos = NULL;62 ALLOCATE (measpos, MeasPos, 1);63 64 60 fprintf (stderr, "grabbing meas object pos from other hosts...\n"); 65 61 … … 78 74 LOGRTIME("meas_load_sync host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 79 75 80 off_t N subset= 0;76 off_t Nmeaspos = 0; 81 77 char *posfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "measpos.fits"); 82 MeasPos *measpos Subset = MeasPosLoad (posfile, &Nsubset);78 MeasPos *measpos = MeasPosLoad (posfile, &Nmeaspos); 83 79 free (posfile); 84 80 LOGRTIME("MeasPosLoad host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 85 81 86 // merge_meas_pos reallocs measpos and frees the input measposSubset 87 measpos = merge_meas_pos (measpos, &Nmeaspos, measposSubset, Nsubset); 88 LOGRTIME("merge_meas_pos host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 82 // apply the loaded measurement positions: 83 for (off_t j = 0; j < Nmeaspos; j++) { 84 int objID = measpos[j].objID; 85 int catID = measpos[j].catID; 86 87 // set the meas mag 88 int catSeq; 89 off_t objSeq; 90 if (!catID_and_objID_to_seq (catID, objID, &catSeq, &objSeq)) { 91 // XXX what should I do if this does not match? 92 continue; 93 } 94 myAssert (catSeq < Ncatalog, "oops"); 95 96 off_t m = catalog[catSeq].average[objSeq].measureOffset; 97 for (k = 0; k < catalog[catSeq].average[objSeq].Nmeasure; k++, m++) { 98 if (catalog[catSeq].measureT[m].imageID != measpos[j].imageID) continue; 99 catalog[catSeq].measureT[m].R = measpos[j].R; 100 catalog[catSeq].measureT[m].D = measpos[j].D; 101 if (catalog[catSeq].measure) { 102 catalog[catSeq].measure[m].R = measpos[j].R; 103 catalog[catSeq].measure[m].D = measpos[j].D; 104 } 105 } 106 } 107 free (measpos); 108 LOGRTIME("match_catID_and_objID/meas loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 89 109 } 90 110 LOGRTIME("meas_load_done loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 91 92 for (i = 0; i < Nmeaspos; i++) {93 int objID = measpos[i].objID;94 int catID = measpos[i].catID;95 96 // set the meas mag97 int catSeq;98 off_t objSeq;99 if (!catID_and_objID_to_seq (catID, objID, &catSeq, &objSeq)) {100 // XXX what should I do if this does not match?101 continue;102 }103 off_t m = catalog[catSeq].average[objSeq].measureOffset;104 for (k = 0; k < catalog[catSeq].average[objSeq].Nmeasure; k++, m++) {105 if (catalog[catSeq].measureT[m].imageID != measpos[i].imageID) continue;106 catalog[catSeq].measureT[m].R = measpos[i].R;107 catalog[catSeq].measureT[m].D = measpos[i].D;108 if (catalog[catSeq].measure) {109 catalog[catSeq].measure[m].R = measpos[i].R;110 catalog[catSeq].measure[m].D = measpos[i].D;111 }112 }113 }114 free (measpos);115 LOGRTIME("match_catID_and_objID/meas loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime);116 111 117 112 fprintf (stderr, "DONE grabbing meas object pos from other hosts...\n");
Note:
See TracChangeset
for help on using the changeset viewer.
