Changeset 12332
- Timestamp:
- Mar 8, 2007, 12:21:18 PM (19 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 27 added
- 1 deleted
- 209 edited
-
configure.tcsh (modified) (2 diffs)
-
src/addstar/Makefile (modified) (1 diff)
-
src/addstar/src/ConfigInit.c (modified) (4 diffs)
-
src/addstar/src/FilterStars.c (modified) (1 diff)
-
src/addstar/src/ImageOptions.c (modified) (1 diff)
-
src/addstar/src/LoadStars.c (modified) (4 diffs)
-
src/addstar/src/ReadImageHeader.c (modified) (5 diffs)
-
src/addstar/src/ReadStarsFITS.c (modified) (4 diffs)
-
src/addstar/src/SEDfit.c (modified) (5 diffs)
-
src/addstar/src/SocketOps.c (modified) (1 diff)
-
src/addstar/src/UpdateDatabase_Image.c (modified) (1 diff)
-
src/addstar/src/calibrate.c (modified) (6 diffs)
-
src/addstar/src/fakeimage.c (modified) (4 diffs)
-
src/addstar/src/find_matches.c (modified) (6 diffs)
-
src/addstar/src/find_matches_closest.c (modified) (6 diffs)
-
src/addstar/src/find_matches_refstars.c (modified) (3 diffs)
-
src/addstar/src/find_proper.c (modified) (2 diffs)
-
src/addstar/src/gstars.c (modified) (5 diffs)
-
src/addstar/src/load2mass_catalog.c (modified) (3 diffs)
-
src/addstar/src/replace_match.c (modified) (1 diff)
-
src/addstar/src/update_coords.c (modified) (2 diffs)
-
src/delstar/src/ConfigInit.c (modified) (3 diffs)
-
src/delstar/src/delete_imagefile.c (modified) (3 diffs)
-
src/delstar/src/delete_imagename.c (modified) (1 diff)
-
src/delstar/src/find_image_db.c (modified) (3 diffs)
-
src/delstar/src/find_matches.c (modified) (1 diff)
-
src/delstar/src/gimages.c (modified) (2 diffs)
-
src/delstar/src/parse_time.c (modified) (1 diff)
-
src/elixir/src/DefineProcesses.c (modified) (1 diff)
-
src/elixir/src/rconnect.c (modified) (1 diff)
-
src/gastro/src/ConfigInit.c (modified) (1 diff)
-
src/gastro/src/getptolemy.c (modified) (1 diff)
-
src/gastro/src/gheader.c (modified) (1 diff)
-
src/gastro/src/plotstuff.c (modified) (1 diff)
-
src/gastro2/src/getptolemy.c (modified) (1 diff)
-
src/gastro2/src/gproject2.c (modified) (1 diff)
-
src/gastro2/src/plotstuff.c (modified) (1 diff)
-
src/getstar/src/ConfigInit.c (modified) (3 diffs)
-
src/getstar/src/select_by_image.c (modified) (2 diffs)
-
src/getstar/src/select_by_region.c (modified) (1 diff)
-
src/imclean/src/AdjustHeader.c (modified) (1 diff)
-
src/imclean/src/ConfigInit.c (modified) (1 diff)
-
src/imregister/Makefile (modified) (3 diffs)
-
src/imregister/base/ConfigInit.c (modified) (4 diffs)
-
src/imregister/base/misc.c (modified) (2 diffs)
-
src/imregister/detrend/args.detsearch.c (modified) (4 diffs)
-
src/imregister/detrend/output.c (modified) (1 diff)
-
src/imregister/imphot/ConfigInit.c (modified) (4 diffs)
-
src/imregister/imphot/args.c (modified) (1 diff)
-
src/imregister/imphot/dumpfits.c (modified) (2 diffs)
-
src/imregister/imphot/output.c (modified) (1 diff)
-
src/imregister/imphot/subset.c (modified) (1 diff)
-
src/imregister/imreg/cadc.c (modified) (1 diff)
-
src/imregister/imreg/output.c (modified) (1 diff)
-
src/imregister/imreg/rconnect.c (modified) (1 diff)
-
src/imregister/include/detrend.h (modified) (4 diffs)
-
src/imregister/include/imphot.h (modified) (1 diff)
-
src/imregister/include/imreg.h (modified) (1 diff)
-
src/imregister/include/imregister.h (modified) (1 diff)
-
src/imregister/include/photreg.h (modified) (1 diff)
-
src/imregister/include/spreg.h (modified) (1 diff)
-
src/imregister/photreg/args.photreg.c (modified) (2 diffs)
-
src/imregister/photreg/args.photsearch.c (modified) (1 diff)
-
src/imregister/photreg/getImageData.c (modified) (1 diff)
-
src/imregister/photreg/output.c (modified) (1 diff)
-
src/imregister/spreg/output.c (modified) (1 diff)
-
src/imregister/src/imphotmerge.c (modified) (4 diffs)
-
src/imregister/src/photcode-table.c (added)
-
src/kapa/graph/PSObjects.c (modified) (1 diff)
-
src/kii/button/PSit.c (modified) (1 diff)
-
src/libautocode/Makefile.Targets (modified) (6 diffs)
-
src/libautocode/def/average-panstarrs-dev-0.d (added)
-
src/libautocode/def/average.d (modified) (3 diffs)
-
src/libautocode/def/image-panstarrs-dev-0.d (added)
-
src/libautocode/def/image.d (modified) (3 diffs)
-
src/libautocode/def/measure-panstarrs-dev-0.d (added)
-
src/libautocode/def/measure.d (modified) (1 diff)
-
src/libautocode/def/photcode.d (modified) (2 diffs)
-
src/libautocode/def/secfilt-panstarrs-dev-0.d (added)
-
src/libautocode/def/secfilt.d (modified) (1 diff)
-
src/libdvo/Makefile (modified) (2 diffs)
-
src/libdvo/doc/dvo-structures.txt (modified) (2 diffs)
-
src/libdvo/doc/notes.txt (added)
-
src/libdvo/include/dvo.h (modified) (8 diffs)
-
src/libdvo/src/LoadPhotcodes.c (modified) (1 diff)
-
src/libdvo/src/LoadPhotcodesFITS.c (added)
-
src/libdvo/src/LoadPhotcodesText.c (added)
-
src/libdvo/src/SavePhotcodesFITS.c (added)
-
src/libdvo/src/SavePhotcodesText.c (added)
-
src/libdvo/src/coordops.c (modified) (11 diffs)
-
src/libdvo/src/coordops.update.c (modified) (6 diffs)
-
src/libdvo/src/dvo_catalog.c (modified) (3 diffs)
-
src/libdvo/src/dvo_catalog_chipcoords.c (added)
-
src/libdvo/src/dvo_catalog_mef.c (modified) (10 diffs)
-
src/libdvo/src/dvo_catalog_raw.c (modified) (21 diffs)
-
src/libdvo/src/dvo_catalog_split.c (modified) (29 diffs)
-
src/libdvo/src/dvo_convert.c (modified) (21 diffs)
-
src/libdvo/src/dvo_convert_elixir.c (modified) (13 diffs)
-
src/libdvo/src/dvo_convert_loneos.c (modified) (14 diffs)
-
src/libdvo/src/dvo_convert_panstarrs.c (modified) (9 diffs)
-
src/libdvo/src/dvo_convert_panstarrs_DEV_0.c (added)
-
src/libdvo/src/dvo_convert_pmtest.c (modified) (1 diff)
-
src/libdvo/src/dvo_image.c (modified) (1 diff)
-
src/libdvo/src/dvo_image_raw.c (modified) (3 diffs)
-
src/libdvo/src/dvo_photcode_ops.c (added)
-
src/libdvo/src/photfits.c (modified) (7 diffs)
-
src/libdvo/src/skyregion_gsc.c (modified) (1 diff)
-
src/libkapa/src/KiiConvert.c (modified) (1 diff)
-
src/libkapa/src/bDrawRotFont.c (modified) (1 diff)
-
src/libohana/include/ohana_allocate.h (modified) (2 diffs)
-
src/markrock/src/ConfigInit.c (modified) (4 diffs)
-
src/markstar/src/ConfigInit.c (modified) (3 diffs)
-
src/markstar/src/match_images.c (modified) (3 diffs)
-
src/misc/Makefile (modified) (1 diff)
-
src/mosastro/src/ConvertMatch.c (modified) (1 diff)
-
src/mosastro/src/getptolemy.c (modified) (1 diff)
-
src/nightd/src/misc.c (modified) (1 diff)
-
src/opihi/cmd.basic/date.c (modified) (1 diff)
-
src/opihi/cmd.basic/macro.c (modified) (1 diff)
-
src/opihi/cmd.basic/module.c (modified) (1 diff)
-
src/opihi/cmd.data/book_commands.c (modified) (3 diffs)
-
src/opihi/cmd.data/create.c (modified) (1 diff)
-
src/opihi/cmd.data/line.c (modified) (1 diff)
-
src/opihi/cmd.data/queueload.c (modified) (1 diff)
-
src/opihi/dvo/avextract.c (modified) (3 diffs)
-
src/opihi/dvo/calextract.c (modified) (6 diffs)
-
src/opihi/dvo/calmextract.c (modified) (5 diffs)
-
src/opihi/dvo/catalog.c (modified) (6 diffs)
-
src/opihi/dvo/ccd.c (modified) (3 diffs)
-
src/opihi/dvo/cmatch.c (modified) (1 diff)
-
src/opihi/dvo/cmd.c (modified) (3 diffs)
-
src/opihi/dvo/compare.c (modified) (1 diff)
-
src/opihi/dvo/ddmags.c (modified) (3 diffs)
-
src/opihi/dvo/dmagaves.c (modified) (3 diffs)
-
src/opihi/dvo/dmagmeas.c (modified) (3 diffs)
-
src/opihi/dvo/dmags.c (modified) (3 diffs)
-
src/opihi/dvo/dmt.c (modified) (4 diffs)
-
src/opihi/dvo/extract.c (modified) (4 diffs)
-
src/opihi/dvo/fitcolors.c (modified) (4 diffs)
-
src/opihi/dvo/fitsed.c (modified) (4 diffs)
-
src/opihi/dvo/gimages.c (modified) (2 diffs)
-
src/opihi/dvo/gstar.c (modified) (14 diffs)
-
src/opihi/dvo/imbox.c (modified) (1 diff)
-
src/opihi/dvo/imdata.c (modified) (8 diffs)
-
src/opihi/dvo/imextract.c (modified) (3 diffs)
-
src/opihi/dvo/imlist.c (modified) (2 diffs)
-
src/opihi/dvo/imphot.c (modified) (1 diff)
-
src/opihi/dvo/imsearch.c (modified) (2 diffs)
-
src/opihi/dvo/imstats.c (modified) (1 diff)
-
src/opihi/dvo/lcurve.c (modified) (2 diffs)
-
src/opihi/dvo/lightcurve.c (modified) (3 diffs)
-
src/opihi/dvo/match_image.c (modified) (2 diffs)
-
src/opihi/dvo/mextract.c (modified) (4 diffs)
-
src/opihi/dvo/paverage.c (modified) (5 diffs)
-
src/opihi/dvo/photometry.c (modified) (16 diffs)
-
src/opihi/dvo/pmeasure.c (modified) (1 diff)
-
src/opihi/dvo/subpix.c (modified) (1 diff)
-
src/opihi/include/display.h (modified) (1 diff)
-
src/opihi/include/pcontrol.h (modified) (2 diffs)
-
src/opihi/include/shell.h (modified) (1 diff)
-
src/opihi/lib.data/book.c (modified) (1 diff)
-
src/opihi/lib.data/page.c (modified) (2 diffs)
-
src/opihi/lib.shell/ListOps.c (modified) (2 diffs)
-
src/opihi/lib.shell/SocketOps.c (modified) (1 diff)
-
src/opihi/lib.shell/exec_loop.c (modified) (1 diff)
-
src/opihi/lib.shell/opihi.c (modified) (1 diff)
-
src/opihi/lib.shell/version.c (modified) (1 diff)
-
src/opihi/pantasks/CheckTasks.c (modified) (1 diff)
-
src/opihi/pantasks/TaskOps.c (modified) (2 diffs)
-
src/opihi/pantasks/ipptool2book.c (modified) (1 diff)
-
src/opihi/pantasks/task_stdout.c (modified) (2 diffs)
-
src/photdbc/src/ConfigInit.c (modified) (3 diffs)
-
src/photdbc/src/find_images.c (modified) (1 diff)
-
src/photdbc/src/flag_measures.c (modified) (9 diffs)
-
src/photdbc/src/get_mags.c (modified) (1 diff)
-
src/photdbc/src/join_stars.c (modified) (6 diffs)
-
src/photdbc/src/make_subcatalog.c (modified) (2 diffs)
-
src/photdbc/src/unique_measures.c (modified) (1 diff)
-
src/relastro/Makefile (modified) (2 diffs)
-
src/relastro/doc/parallax.pro (modified) (1 diff)
-
src/relastro/include/relastro.h (added)
-
src/relastro/include/relphot.h (deleted)
-
src/relastro/src/ConfigInit.c (modified) (5 diffs)
-
src/relastro/src/FitChip.c (added)
-
src/relastro/src/FitMosaic.c (added)
-
src/relastro/src/FitPM.c (added)
-
src/relastro/src/FitPMandPar.c (added)
-
src/relastro/src/FitSimple.c (added)
-
src/relastro/src/ImageOps.c (modified) (9 diffs)
-
src/relastro/src/MosaicOps.c (modified) (12 diffs)
-
src/relastro/src/ParFactor.c (added)
-
src/relastro/src/SetSignals.c (modified) (1 diff)
-
src/relastro/src/Shutdown.c (modified) (2 diffs)
-
src/relastro/src/StarOps.c (modified) (15 diffs)
-
src/relastro/src/UpdateChips.c (added)
-
src/relastro/src/UpdateImages.c (modified) (1 diff)
-
src/relastro/src/UpdateMosaic.c (added)
-
src/relastro/src/UpdateObjects.c (modified) (5 diffs)
-
src/relastro/src/UpdateSimple.c (added)
-
src/relastro/src/args.c (modified) (7 diffs)
-
src/relastro/src/bcatalog.c (modified) (8 diffs)
-
src/relastro/src/dvo_astrom_ops.c (added)
-
src/relastro/src/fitpoly.c (added)
-
src/relastro/src/global_stats.c (modified) (1 diff)
-
src/relastro/src/initialize.c (modified) (2 diffs)
-
src/relastro/src/liststats.c (modified) (1 diff)
-
src/relastro/src/load_catalogs.c (modified) (3 diffs)
-
src/relastro/src/load_images.c (modified) (3 diffs)
-
src/relastro/src/mkpolyterm.c (added)
-
src/relastro/src/plot_scatter.c (modified) (3 diffs)
-
src/relastro/src/plotstuff.c (modified) (2 diffs)
-
src/relastro/src/relastro.c (modified) (3 diffs)
-
src/relastro/src/reload_catalogs.c (modified) (3 diffs)
-
src/relastro/src/save_catalogs.c (added)
-
src/relastro/src/select_images.c (modified) (4 diffs)
-
src/relastro/src/setExclusions.c (modified) (3 diffs)
-
src/relastro/src/setMrelFinal.c (modified) (5 diffs)
-
src/relastro/src/sort.c (modified) (1 diff)
-
src/relastro/src/write_coords.c (modified) (1 diff)
-
src/relphot/include/relphot.h (modified) (1 diff)
-
src/relphot/src/ConfigInit.c (modified) (4 diffs)
-
src/relphot/src/GridOps.c (modified) (2 diffs)
-
src/relphot/src/ImageOps.c (modified) (15 diffs)
-
src/relphot/src/MosaicOps.c (modified) (8 diffs)
-
src/relphot/src/StarOps.c (modified) (14 diffs)
-
src/relphot/src/bcatalog.c (modified) (4 diffs)
-
src/relphot/src/initialize.c (modified) (1 diff)
-
src/relphot/src/plot_scatter.c (modified) (1 diff)
-
src/relphot/src/relphot.c (modified) (1 diff)
-
src/relphot/src/select_images.c (modified) (2 diffs)
-
src/relphot/src/setExclusions.c (modified) (5 diffs)
-
src/relphot/src/setMrelFinal.c (modified) (5 diffs)
-
src/uniphot/src/ConfigInit.c (modified) (3 diffs)
-
src/uniphot/src/fit_groups.c (modified) (2 diffs)
-
src/uniphot/src/subset_images.c (modified) (1 diff)
-
src/uniphot/src/update.c (modified) (1 diff)
-
src/uniphot/src/update_catalog.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/configure.tcsh
r12160 r12332 475 475 Configuration: 476 476 -h, --help display this help and exit 477 --enable-optimize enable compiler optimization 477 --enable-optimize enable compiler optimization (-O2) 478 478 --pedantic include -Wall -Werror on compilation 479 479 … … 490 490 --sysconfdir=DIR read-only single-machine data [PREFIX/etc] 491 491 492 Makefile flags: 493 CC=options 494 CFLAGS=options 495 CPPFLAGS=options 496 LDFLAGS=options 497 498 The following options are silently ignored for compatibility: 499 --enable-maintainer-mode 500 --no-create 501 --no-recursion 502 --sbindir 503 --libexecdir 504 --sharedstatedir 505 --localstatedir 506 --oldincludedir 507 --infodir 508 492 509 EOF 493 510 exit 2; -
trunk/Ohana/src/addstar/Makefile
r11880 r12332 240 240 241 241 install: 242 for i in $(INSTALL); do make $$i.install ; done242 for i in $(INSTALL); do make $$i.install || exit; done -
trunk/Ohana/src/addstar/src/ConfigInit.c
r8639 r12332 7 7 char *config, *file; 8 8 char RadiusWord[80]; 9 char PhotCodeFile[256]; 9 char CatdirPhotcodeFile[256]; 10 char MasterPhotcodeFile[256]; 10 11 AddstarClientOptions options; 11 12 … … 61 62 CAL_INSTMAG_MAX = -9.0; 62 63 CAL_INSTMAG_MIN = -13.0; 63 ScanConfig (config, "CAL_INSTMAG_MAX", "%lf", 0, &CAL_INSTMAG_MAX);64 ScanConfig (config, "CAL_INSTMAG_MIN", "%lf", 0, &CAL_INSTMAG_MIN);64 ScanConfig (config, "CAL_INSTMAG_MAX", "%lf", 0, &CAL_INSTMAG_MAX); 65 ScanConfig (config, "CAL_INSTMAG_MIN", "%lf", 0, &CAL_INSTMAG_MIN); 65 66 66 67 /* location of needed data sources */ … … 69 70 ScanConfig (config, "GSCDIR", "%s", 0, GSCDIR); 70 71 71 if (!ScanConfig (config, "USNO_A_DIR", "%s", 0, USNO_A_DIR)) {72 ScanConfig (config, "USNO_CDROM", "%s", 0, USNO_A_DIR);72 if (!ScanConfig (config, "USNO_A_DIR", "%s", 0, USNO_A_DIR)) { 73 ScanConfig (config, "USNO_CDROM", "%s", 0, USNO_A_DIR); 73 74 } 74 75 ScanConfig (config, "USNO_B_DIR", "%s", 0, USNO_B_DIR); 75 76 76 ScanConfig (config, "TYCHO_DIR", "%s", 0, TYCHO_DIR);77 ScanConfig (config, "TYCHO_DIR", "%s", 0, TYCHO_DIR); 77 78 78 GetConfig (config, "GSCFILE", "%s", 0, GSCFILE);79 GetConfig (config, "CATDIR", "%s", 0, CATDIR);80 GetConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);79 GetConfig (config, "GSCFILE", "%s", 0, GSCFILE); 80 GetConfig (config, "CATDIR", "%s", 0, CATDIR); 81 GetConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 81 82 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 82 83 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); … … 147 148 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 148 149 149 if (!LoadPhotcodes (PhotCodeFile)) { 150 fprintf (stderr, "error loading photcode file %s\n", PhotCodeFile); 150 /* XXX this does not yet write out the master photcode table */ 151 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 152 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 153 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 151 154 exit (1); 152 155 } -
trunk/Ohana/src/addstar/src/FilterStars.c
r10937 r12332 25 25 while (stars[N].R >= 360.0) stars[N].R -= 360.0; 26 26 stars[N].found = -1; 27 stars[N].code = image[0]. source;27 stars[N].code = image[0].photcode; 28 28 29 29 /** additional quantities to supply to Stars based on the image data **/ 30 30 31 31 /* calculate accurate per-star airmass */ 32 stars[N].airmass = airmass (image[0].secz _PS, stars[N].R, stars[N].D, image[0].sidtime, image[0].latitude);33 stars[N].Mcal = image[0].Mcal _PS;32 stars[N].airmass = airmass (image[0].secz, stars[N].R, stars[N].D, image[0].sidtime, image[0].latitude); 33 stars[N].Mcal = image[0].Mcal; 34 34 stars[N].t = image[0].tzero + 1e-4*stars[N].Y*image[0].trate; /* trate is in 0.1 msec / row */ 35 35 -
trunk/Ohana/src/addstar/src/ImageOptions.c
r10937 r12332 24 24 if (!strcmp (&images[0].coords.ctype[4], "-DIS")) continue; 25 25 26 photcode = GetPhotcodebyCode (images[i]. source);26 photcode = GetPhotcodebyCode (images[i].photcode); 27 27 28 28 if (equivPhotcode) { -
trunk/Ohana/src/addstar/src/LoadStars.c
r10897 r12332 52 52 exit (1); 53 53 } 54 image[0]. source = photcode;54 image[0].photcode = photcode; 55 55 56 56 image[0].NX -= XOVERSCAN; … … 62 62 tmp = 0; 63 63 /* gfits_scan (&header, "APMIFIT", "%lf", 1, &tmp); */ 64 image[0].apmifit _PS= tmp;64 image[0].apmifit = tmp; 65 65 66 66 tmp = 0; 67 67 /* gfits_scan (&header, "dAPMIFIT", "%lf", 1, &tmp); */ 68 image[0].dapmifit _PS= tmp;68 image[0].dapmifit = tmp; 69 69 70 70 tmp = 0; … … 108 108 tmp = 0; 109 109 gfits_scan (&header, AirmassKeyword, "%lf", 1, &tmp); 110 image[0].secz _PS= MIN (NO_MAG, tmp);110 image[0].secz = MIN (NO_MAG, tmp); 111 111 112 112 if (!gfits_scan (&header, CCDNumKeyword, "%d", 1, &itmp)) { … … 120 120 121 121 /* secz is in units milli-airmass */ 122 image[0].Mcal _PS= 0.0;122 image[0].Mcal = 0.0; 123 123 image[0].Xm = NO_MAG; 124 124 image[0].code = 0; -
trunk/Ohana/src/addstar/src/ReadImageHeader.c
r10937 r12332 5 5 int ReadImageHeader (Header *header, Image *image, int photcode) { 6 6 7 int Nastro, ccdnum, hour, min , simple;8 double tmp, sec , dMs;9 char * name, *c, photname[64], line[80];7 int Nastro, ccdnum, hour, min; 8 double tmp, sec; 9 char *c, photname[64], line[80]; 10 10 11 11 /* get astrometry information */ … … 66 66 exit (1); 67 67 } 68 image[0]. source = photcode;68 image[0].photcode = photcode; 69 69 70 70 image[0].NX -= XOVERSCAN; … … 76 76 tmp = 0; 77 77 /* gfits_scan (header, "APMIFIT", "%lf", 1, &tmp); */ 78 image[0].apmifit _PS= tmp;78 image[0].apmifit = tmp; 79 79 80 80 tmp = 0; 81 81 /* gfits_scan (header, "dAPMIFIT", "%lf", 1, &tmp); */ 82 image[0].dapmifit _PS= tmp;82 image[0].dapmifit = tmp; 83 83 84 84 tmp = 0; … … 118 118 tmp = 0; 119 119 gfits_scan (header, AirmassKeyword, "%lf", 1, &tmp); 120 image[0].secz _PS= MIN (NO_MAG, tmp);120 image[0].secz = MIN (NO_MAG, tmp); 121 121 122 122 if (!gfits_scan (header, CCDNumKeyword, "%d", 1, &ccdnum)) { … … 130 130 131 131 /* secz is in units milli-airmass */ 132 image[0].Mcal _PS= 0.0;132 image[0].Mcal = 0.0; 133 133 image[0].Xm = NO_MAG; 134 134 image[0].code = 0; -
trunk/Ohana/src/addstar/src/ReadStarsFITS.c
r10937 r12332 5 5 Stars *ReadStarsFITS (FILE *f, Header *header, Header *in_theader, unsigned int *nstars) { 6 6 7 int i,Nskip, Nstars;7 int Nskip, Nstars; 8 8 char type[80]; 9 9 Header theader; … … 13 13 if (in_theader == NULL) { 14 14 table.header = &theader; 15 if (!gfits_fread_header (f, table.header)) Shutdown ("ERROR: can't read table header"); 15 16 } else { 16 17 table.header = in_theader; 17 }18 19 /* load the table header (skip this?) */20 if (in_theader == NULL) {21 if (!gfits_fread_header (f, &theader)) {22 fprintf (stderr, "ERROR: can't read table header\n");23 exit (1);24 }25 } else {26 18 Nskip = in_theader[0].size; 27 19 fseek (f, Nskip, SEEK_CUR); … … 34 26 } 35 27 36 if (!gfits_scan ( &theader, "EXTTYPE", "%s", 1, type)) {28 if (!gfits_scan (table.header, "EXTTYPE", "%s", 1, type)) { 37 29 strcpy (type, "SMPDATA"); 38 30 } … … 93 85 PS1Data *ps1data; 94 86 95 ps1data = gfits_table_get _PS1Data (table, &Nstars, NULL);87 ps1data = gfits_table_get1Data (table, &Nstars, NULL); 96 88 97 89 ALLOCATE (stars, Stars, Nstars); -
trunk/Ohana/src/addstar/src/SEDfit.c
r8361 r12332 80 80 Nphot = 0; 81 81 for (j = 0; j < incat[0].average[i].Nm; j++) { 82 idx = table[0].hashcode[incat[0].measure[m+j]. source];82 idx = table[0].hashcode[incat[0].measure[m+j].photcode]; 83 83 if (idx == -1) continue; 84 84 // only fit the selected photcodes (mode == "fit") … … 86 86 if (table[0].mode[idx] == SED_SAMPLE) continue; 87 87 // XXX do something more clever if more than one value exists per photcode 88 sourceValue.mags[idx] = incat[0].measure[m+j].M _PS+ table[0].vegaToAB[idx];89 sourceError.mags[idx] = incat[0].measure[m+j].dM _PS;90 if (incat[0].measure[m+j]. source == USNOred) sourceError.mags[idx] = 0.3;91 if (incat[0].measure[m+j]. source == USNOblu) sourceError.mags[idx] = 0.3;88 sourceValue.mags[idx] = incat[0].measure[m+j].M + table[0].vegaToAB[idx]; 89 sourceError.mags[idx] = incat[0].measure[m+j].dM; 90 if (incat[0].measure[m+j].photcode == USNOred) sourceError.mags[idx] = 0.3; 91 if (incat[0].measure[m+j].photcode == USNOblu) sourceError.mags[idx] = 0.3; 92 92 found[idx] = TRUE; 93 93 Nphot ++; … … 159 159 160 160 // XXX for now, set the average mag data to NULL 161 outcat[0].average[Nave].M = NO_MAG;162 outcat[0].average[Nave].dM = NO_MAG;163 161 outcat[0].average[Nave].Nm = 0; 164 162 outcat[0].average[Nave].Nn = 0; 165 163 outcat[0].average[Nave].Xp = NO_MAG; 166 outcat[0].average[Nave].Xm = NO_MAG;167 outcat[0].average[Nave].Xg = NO_MAG;168 164 outcat[0].average[Nave].offset = Nmeas; 169 165 outcat[0].average[Nave].missing = -1; … … 171 167 172 168 for (j = 0; j < Nsec; j++) { 173 outcat[0].secfilt[Nave*Nsec+j].M _PS= NO_MAG;174 outcat[0].secfilt[Nave*Nsec+j].dM _PS= NO_MAG;169 outcat[0].secfilt[Nave*Nsec+j].M = NO_MAG; 170 outcat[0].secfilt[Nave*Nsec+j].dM = NO_MAG; 175 171 outcat[0].secfilt[Nave*Nsec+j].Xm = NO_MAG; 176 172 } … … 185 181 for (j = 0; valid && (j < Nmodel); j++) { 186 182 n = modelRow[j]; 187 outcat[0].measure[Nmeas].dR _PS= 0.0;188 outcat[0].measure[Nmeas].dD _PS= 0.0;189 outcat[0].measure[Nmeas].M _PS= MIN (table[0].row[minFit.row][0].mags[n] + minFit.Md, NO_MAG);190 outcat[0].measure[Nmeas].dM _PS= 0.0;191 outcat[0].measure[Nmeas].Mcal _PS= 0;183 outcat[0].measure[Nmeas].dR = 0.0; 184 outcat[0].measure[Nmeas].dD = 0.0; 185 outcat[0].measure[Nmeas].M = MIN (table[0].row[minFit.row][0].mags[n] + minFit.Md, NO_MAG); 186 outcat[0].measure[Nmeas].dM = 0.0; 187 outcat[0].measure[Nmeas].Mcal = 0; 192 188 outcat[0].measure[Nmeas].t = TIMEREF; 193 189 outcat[0].measure[Nmeas].averef = Nave; 194 outcat[0].measure[Nmeas]. source = table[0].code[n];190 outcat[0].measure[Nmeas].photcode = table[0].code[n]; 195 191 outcat[0].measure[Nmeas].dophot = 0; 196 192 outcat[0].measure[Nmeas].flags = 0; 197 outcat[0].measure[Nmeas].dt _PS= 0xffff;198 199 outcat[0].measure[Nmeas].Mgal _PS= NO_MAG;200 outcat[0].measure[Nmeas].airmass _PS= 0;193 outcat[0].measure[Nmeas].dt = 0xffff; 194 195 outcat[0].measure[Nmeas].Mgal = NO_MAG; 196 outcat[0].measure[Nmeas].airmass = 0; 201 197 outcat[0].measure[Nmeas].FWx = NO_MAG; 202 198 outcat[0].measure[Nmeas].FWy = NO_ERR; -
trunk/Ohana/src/addstar/src/SocketOps.c
r5347 r12332 60 60 int WaitServerSocket (int InitSocket, SockAddress *Address, int *validIP, int Nvalid) { 61 61 62 int i, BindSocket, length; 62 int i, BindSocket; 63 socklen_t length; 63 64 SockAddress Address_in; 64 65 u_int32_t addr; -
trunk/Ohana/src/addstar/src/UpdateDatabase_Image.c
r10939 r12332 3 3 int UpdateDatabase_Image (AddstarClientOptions *options, Image *images, int Nimages, Coords *mosaic, Stars *stars, int Nstars) { 4 4 5 int i, Noverlap, status; 6 Image *overlap; 5 int i, status; 7 6 Catalog catalog; 8 7 SkyList *skylist, *newlist; -
trunk/Ohana/src/addstar/src/calibrate.c
r5585 r12332 60 60 // - calibrate to external system (Mref) 61 61 62 mycode = GetPhotcodebyCode (new[0]. source);62 mycode = GetPhotcodebyCode (new[0].photcode); 63 63 incode = GetPhotcodebyCode (mycode[0].equiv); 64 64 excode = GetPhotcodebyCode (incode[0].equiv); … … 74 74 m = average[0].offset; 75 75 for (i = 0; i < average[0].Nm; i++) { 76 if (measure[m]. source == CalC0) {76 if (measure[m].photcode == CalC0) { 77 77 found0 = TRUE; 78 CalM0 = measure[m].M _PS;79 dCalM = measure[m].dM _PS;78 CalM0 = measure[m].M; 79 dCalM = measure[m].dM; 80 80 } 81 if (measure[m]. source == CalC1) {81 if (measure[m].photcode == CalC1) { 82 82 found1 = TRUE; 83 CalM1 = measure[m].M _PS;83 CalM1 = measure[m].M; 84 84 } 85 if (measure[m]. source == CalC2) {85 if (measure[m].photcode == CalC2) { 86 86 found2 = TRUE; 87 CalM2 = measure[m].M _PS;87 CalM2 = measure[m].M; 88 88 } 89 89 if (found0 && found1 && found2) { 90 Mcal = new[0].M _PS + 0.001*mycode[0].C + mycode[0].K*(new[0].airmass_PS- 1.0) - ZeroPt;90 Mcal = new[0].M + 0.001*mycode[0].C + mycode[0].K*(new[0].airmass - 1.0) - ZeroPt; 91 91 color = CalM1 - CalM2 - 0.001*mycode[0].dX; 92 92 factor = color; … … 99 99 } 100 100 // if we want to apply a Mcal -> Mref color correction, we need the additional color term 101 SaveCalibration (Mcal, new[0].dM _PS, CalM0, dCalM, new[0].M_PS - ZeroPt - new[0].dt_PS, Nstar);101 SaveCalibration (Mcal, new[0].dM, CalM0, dCalM, new[0].M - ZeroPt - new[0].dt, Nstar); 102 102 return; 103 103 } … … 121 121 if (MaxN == -1) { 122 122 fprintf (stderr, "no clean stars\n"); 123 image[0].Mcal _PS= 10.000;124 image[0].dMcal _PS= 10.000;123 image[0].Mcal = 10.000; 124 image[0].dMcal = 10.000; 125 125 return; 126 126 } … … 155 155 if (Nkeep < 5) { 156 156 fprintf (stderr, "too few stars\n"); 157 image[0].Mcal _PS= 10.000;158 image[0].dMcal _PS= 10.000;157 image[0].Mcal = 10.000; 158 image[0].dMcal = 10.000; 159 159 return; 160 160 } … … 187 187 Mw = W1 / W2; 188 188 fprintf (stderr, "N: %.0f, mean: %f, wt mean: %f, stdev: %f, precision: %f\n", N, M1, Mw, M2, M2 / sqrt (N)); 189 image[0].Mcal _PS= M1;190 image[0].dMcal _PS= M2 / sqrt (N);189 image[0].Mcal = M1; 190 image[0].dMcal = M2 / sqrt (N); 191 191 image[0].Mxxxx = N; 192 192 } else { 193 193 fprintf (stderr, "too few stars\n"); 194 image[0].Mcal _PS= 10.000;195 image[0].dMcal _PS= 10.000;194 image[0].Mcal = 10.000; 195 image[0].dMcal = 10.000; 196 196 image[0].Mxxxx = 0; 197 197 } -
trunk/Ohana/src/addstar/src/fakeimage.c
r11081 r12332 111 111 image[i+1].NY = Ny; 112 112 113 image[i+1]. source = photcode;113 image[i+1].photcode = photcode; 114 114 115 115 image[i+1].exptime = 0.0; 116 116 117 image[i+1].apmifit _PS= 0.0;118 image[i+1].dapmifit _PS= 0.0;117 image[i+1].apmifit = 0.0; 118 image[i+1].dapmifit = 0.0; 119 119 120 120 image[i+1].detection_limit = 0.0; … … 124 124 image[i+1].tzero = MosaicTime; 125 125 image[i+1].trate = 0; 126 image[i+1].secz _PS= 1.0;126 image[i+1].secz = 1.0; 127 127 image[i+1].ccdnum = 0xff; 128 128 129 image[i+1].Mcal _PS= 0.0;129 image[i+1].Mcal = 0.0; 130 130 image[i+1].Xm = NO_MAG; 131 131 image[i+1].code = 0; … … 173 173 image[0].NY = Dmax - Dmin; 174 174 175 image[0]. source = photcode;175 image[0].photcode = photcode; 176 176 177 177 image[0].exptime = 0.0; 178 image[0].apmifit _PS= 0.0;179 image[0].dapmifit _PS= 0.0;178 image[0].apmifit = 0.0; 179 image[0].dapmifit = 0.0; 180 180 image[0].detection_limit = 0.0; 181 181 image[0].saturation_limit = 0.0; … … 184 184 image[0].tzero = MosaicTime; 185 185 image[0].trate = 0; 186 image[0].secz _PS= 1.0;186 image[0].secz = 1.0; 187 187 image[0].ccdnum = 0xff; 188 image[0].Mcal _PS= 0.0;188 image[0].Mcal = 0.0; 189 189 image[0].Xm = NO_MAG; 190 190 image[0].code = 0; -
trunk/Ohana/src/addstar/src/find_matches.c
r10939 r12332 4 4 5 5 int i, j, n, N, J, status, Nstars; 6 double X, Y,RADIUS, RADIUS2;6 double RADIUS, RADIUS2; 7 7 float *X1, *Y1, *X2, *Y2; 8 8 float dX, dY, dR; … … 10 10 int Nave, NAVE, Nmeas, NMEAS, Nmatch; 11 11 int Nsecfilt, Nsec; 12 float Mcat, *Mval;13 PhotCode *code;14 12 Coords tcoords; 15 13 16 /* photcode data - must by of type DEP; options.photcode is equiv PRI/SEC photcode */ 17 /* this function requires incoming stars to have the same photcode.equiv value */ 14 /* photcode data - must by of type DEP; options.photcode is equiv photcode for all input 15 images this function requires incoming stars to have the same photcode.equiv value. if 16 this value is not a valid photcode (ie, 0), then no modification is made to the average 17 magnitudes (Nsec will be -1) */ 18 18 19 Nsecfilt = GetPhotcodeNsecfilt (); 19 20 Nsec = GetPhotcodeNsec (options.photcode); … … 142 143 /** add measurements for this star **/ 143 144 /** dR,dD now represent arcsec **/ 144 catalog[0].measure[Nmeas].dR _PS= 3600.0*(catalog[0].average[n].R - stars[N].R);145 if (catalog[0].measure[Nmeas].dR _PS> +180.0*3600.0) {145 catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R); 146 if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) { 146 147 // average on high end of boundary, move star up 147 148 stars[N].R += 360.0; 148 catalog[0].measure[Nmeas].dR _PS= 3600.0*(catalog[0].average[n].R - stars[N].R);149 } 150 if (catalog[0].measure[Nmeas].dR _PS< -180.0*3600.0) {149 catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R); 150 } 151 if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) { 151 152 // average on low end of boundary, move star down 152 153 stars[N].R -= 360.0; 153 catalog[0].measure[Nmeas].dR _PS= 3600.0*(catalog[0].average[n].R - stars[N].R);154 } 155 if (fabs(catalog[0].measure[Nmeas].dR _PS) > 10*RADIUS) {154 catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R); 155 } 156 if (fabs(catalog[0].measure[Nmeas].dR) > 10*RADIUS) { 156 157 fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n", 157 158 catalog[0].average[n].R, catalog[0].average[n].D, … … 160 161 Y1[i], Y2[J]); 161 162 } 162 catalog[0].measure[Nmeas].dD_PS = 3600.0*(catalog[0].average[n].D - stars[N].D); 163 catalog[0].measure[Nmeas].M_PS = stars[N].M; 164 catalog[0].measure[Nmeas].dM_PS = stars[N].dM; /* error in input files stored in thousandths of mag */ 165 catalog[0].measure[Nmeas].Mcal_PS = stars[N].Mcal; 166 catalog[0].measure[Nmeas].t = stars[N].t; 167 catalog[0].measure[Nmeas].averef = n; /* this must be an absolute sequence number, if partial average is loaded */ 168 catalog[0].measure[Nmeas].source = stars[N].code; /* photcode */ 169 catalog[0].measure[Nmeas].dophot = stars[N].dophot; 170 catalog[0].measure[Nmeas].flags = 0; 171 catalog[0].measure[Nmeas].dt_PS = stars[N].dt; 172 catalog[0].measure[Nmeas].airmass_PS = stars[N].airmass; 173 174 catalog[0].measure[Nmeas].Mgal_PS = stars[N].Mgal; 175 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG); 176 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG); 177 catalog[0].measure[Nmeas].theta = MIN ((255/360)*stars[N].df, NO_ERR); 163 catalog[0].measure[Nmeas].dD = 3600.0*(catalog[0].average[n].D - stars[N].D); 164 165 /* XXX need to add dX, dY : need to load into stars[N].dX,dY */ 166 /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */ 167 catalog[0].measure[Nmeas].Xccd = stars[N].X; 168 catalog[0].measure[Nmeas].Yccd = stars[N].Y; 169 170 catalog[0].measure[Nmeas].M = stars[N].M; 171 catalog[0].measure[Nmeas].dM = stars[N].dM; /* error in input files stored in thousandths of mag */ 172 catalog[0].measure[Nmeas].Mcal = stars[N].Mcal; 173 catalog[0].measure[Nmeas].t = stars[N].t; 174 catalog[0].measure[Nmeas].averef = n; /* this must be an absolute sequence number, if partial average is loaded */ 175 catalog[0].measure[Nmeas].photcode = stars[N].code; /* photcode */ 176 catalog[0].measure[Nmeas].dophot = stars[N].dophot; 177 catalog[0].measure[Nmeas].flags = 0; 178 catalog[0].measure[Nmeas].dt = stars[N].dt; 179 catalog[0].measure[Nmeas].airmass = stars[N].airmass; 180 181 catalog[0].measure[Nmeas].Mgal = stars[N].Mgal; 182 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG); 183 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG); 184 catalog[0].measure[Nmeas].theta = MIN ((0xffff/360.0)*stars[N].df, NO_MAG); 178 185 179 /* it is not valid to pass PRI/SEC/REF photcodes to this routine */ 180 /* check for entries in the secfilt lists */ 181 Mcat = PhotCat (&catalog[0].measure[Nmeas]); 182 Mval = (Nsec == -1) ? &catalog[0].average[n].M : &catalog[0].secfilt[n*Nsecfilt+Nsec].M_PS; 183 if (*Mval == NO_MAG) *Mval = Mcat; 186 /* set the average magnitude if not already set and if photcode.equiv is not 0 */ 184 187 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 188 if (Nsec > -1) { 189 if (catalog[0].secfilt[n*Nsecfilt+Nsec].M != NO_MAG) { 190 catalog[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]); 191 } 192 } 185 193 186 194 /* adds the measurement to the calibration if appropriate color terms are found */ … … 242 250 catalog[0].average[Nave].R = stars[N].R; 243 251 catalog[0].average[Nave].D = stars[N].D; 244 catalog[0].average[Nave].M = NO_MAG; 245 catalog[0].average[Nave].dM = NO_MAG; 252 catalog[0].average[Nave].Xp = 0; 246 253 catalog[0].average[Nave].Nm = 1; 247 254 catalog[0].average[Nave].Nn = 0; 248 catalog[0].average[Nave].Xp = NO_MAG;249 catalog[0].average[Nave].Xm = NO_MAG;250 catalog[0].average[Nave].Xg = NO_MAG;251 255 catalog[0].average[Nave].offset = Nmeas; 252 256 catalog[0].average[Nave].missing = -1; … … 263 267 264 268 for (j = 0; j < Nsecfilt; j++) { 265 catalog[0].secfilt[Nave*Nsecfilt+j].M_PS = NO_MAG; 266 catalog[0].secfilt[Nave*Nsecfilt+j].dM_PS = NO_MAG; 267 catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG; 268 } 269 270 catalog[0].measure[Nmeas].dR_PS = 0.0; 271 catalog[0].measure[Nmeas].dD_PS = 0.0; 272 catalog[0].measure[Nmeas].M_PS = stars[N].M; 273 catalog[0].measure[Nmeas].dM_PS = stars[N].dM; 274 catalog[0].measure[Nmeas].Mcal_PS = stars[N].Mcal; 275 catalog[0].measure[Nmeas].t = stars[N].t; 276 catalog[0].measure[Nmeas].averef = Nave; /* XXX EAM : must be absolute Nave if partial read */ 277 catalog[0].measure[Nmeas].source = stars[N].code; /* photcode */ 278 catalog[0].measure[Nmeas].dophot = stars[N].dophot; 279 catalog[0].measure[Nmeas].flags = 0; 280 catalog[0].measure[Nmeas].dt_PS = stars[N].dt; 281 catalog[0].measure[Nmeas].airmass_PS = stars[N].airmass; 282 283 catalog[0].measure[Nmeas].Mgal_PS = stars[N].Mgal; 284 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG); 285 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG); 286 catalog[0].measure[Nmeas].theta = MIN ((255/360)*stars[N].df, NO_ERR); 287 288 Mcat = PhotCat (&catalog[0].measure[Nmeas]); 289 Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M_PS; 290 if (*Mval == NO_MAG) *Mval = Mcat; 269 catalog[0].secfilt[Nave*Nsecfilt+j].M = NO_MAG; 270 catalog[0].secfilt[Nave*Nsecfilt+j].dM = NO_MAG; 271 catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG; 272 } 273 274 /* XXX need to add dX, dY : need to load into stars[N].dX,dY */ 275 /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */ 276 catalog[0].measure[Nmeas].Xccd = stars[N].X; 277 catalog[0].measure[Nmeas].Yccd = stars[N].Y; 278 279 catalog[0].measure[Nmeas].dR = 0.0; 280 catalog[0].measure[Nmeas].dD = 0.0; 281 catalog[0].measure[Nmeas].M = stars[N].M; 282 catalog[0].measure[Nmeas].dM = stars[N].dM; 283 catalog[0].measure[Nmeas].Mcal = stars[N].Mcal; 284 catalog[0].measure[Nmeas].t = stars[N].t; 285 catalog[0].measure[Nmeas].averef = Nave; /* XXX EAM : must be absolute Nave if partial read */ 286 catalog[0].measure[Nmeas].photcode = stars[N].code; /* photcode */ 287 catalog[0].measure[Nmeas].dophot = stars[N].dophot; 288 catalog[0].measure[Nmeas].flags = 0; 289 catalog[0].measure[Nmeas].dt = stars[N].dt; 290 catalog[0].measure[Nmeas].airmass = stars[N].airmass; 291 292 catalog[0].measure[Nmeas].Mgal = stars[N].Mgal; 293 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG); 294 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG); 295 catalog[0].measure[Nmeas].theta = MIN ((0xffff/360.0)*stars[N].df, NO_MAG); 296 /* XXX replace df here with theta, right? */ 297 298 /* set the average magnitude if not already set and the photcode.equiv is not 0 */ 299 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 300 if (Nsec > -1) { 301 catalog[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]); 302 } 291 303 292 304 /* next[Nmeas] should always be -1 in this context (it is always the only -
trunk/Ohana/src/addstar/src/find_matches_closest.c
r10939 r12332 4 4 5 5 int i, j, n, N, J, Jmin, status, Nstars; 6 double X, Y, RADIUS, RADIUS2, Rmin, secz;6 double RADIUS, RADIUS2, Rmin; 7 7 float *X1, *Y1, *X2, *Y2; 8 8 float dX, dY, dR; … … 11 11 Coords tcoords; 12 12 int Nsecfilt, Nsec; 13 float Mcat, *Mval, MTIME; 14 PhotCode *code; 15 16 /* photcode data - must by of type DEP; options.photcode is equiv PRI/SEC photcode */ 17 /* this function requires incoming stars to have the same photcode.equiv value */ 13 14 /* photcode data - must by of type DEP; options.photcode is equiv photcode for all input 15 images this function requires incoming stars to have the same photcode.equiv value. if 16 this value is not a valid photcode (ie, 0), then no modification is made to the average 17 magnitudes (Nsec will be -1) */ 18 18 19 Nsecfilt = GetPhotcodeNsecfilt (); 19 20 Nsec = GetPhotcodeNsec (options.photcode); … … 160 161 /** add measurements for this star **/ 161 162 /** dR,dD now represent arcsec **/ 162 catalog[0].measure[Nmeas].dR _PS= 3600.0*(catalog[0].average[n].R - stars[N].R);163 if (catalog[0].measure[Nmeas].dR _PS> +180.0*3600.0) {163 catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R); 164 if (catalog[0].measure[Nmeas].dR > +180.0*3600.0) { 164 165 // average on high end of boundary, move star up 165 166 stars[N].R += 360.0; 166 catalog[0].measure[Nmeas].dR _PS= 3600.0*(catalog[0].average[n].R - stars[N].R);167 } 168 if (catalog[0].measure[Nmeas].dR _PS< -180.0*3600.0) {167 catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R); 168 } 169 if (catalog[0].measure[Nmeas].dR < -180.0*3600.0) { 169 170 // average on low end of boundary, move star down 170 171 stars[N].R -= 360.0; 171 catalog[0].measure[Nmeas].dR _PS= 3600.0*(catalog[0].average[n].R - stars[N].R);172 } 173 if (fabs(catalog[0].measure[Nmeas].dR _PS) > 10*RADIUS) {172 catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N].R); 173 } 174 if (fabs(catalog[0].measure[Nmeas].dR) > 10*RADIUS) { 174 175 fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n", 175 176 catalog[0].average[n].R, catalog[0].average[n].D, … … 178 179 Y1[i], Y2[Jmin]); 179 180 } 180 catalog[0].measure[Nmeas].dD_PS = 3600.0*(catalog[0].average[n].D - stars[N].D); 181 catalog[0].measure[Nmeas].M_PS = stars[N].M; 182 catalog[0].measure[Nmeas].dM_PS = stars[N].dM; /* error in input files stored in thousandths of mag */ 183 catalog[0].measure[Nmeas].Mcal_PS = stars[N].Mcal; 184 catalog[0].measure[Nmeas].t = stars[N].t; 185 catalog[0].measure[Nmeas].averef = n; 186 catalog[0].measure[Nmeas].source = stars[N].code; /* photcode */ 187 catalog[0].measure[Nmeas].dophot = stars[N].dophot; 188 catalog[0].measure[Nmeas].flags = 0; 189 catalog[0].measure[Nmeas].dt_PS = stars[N].dt; 190 catalog[0].measure[Nmeas].airmass_PS = stars[N].airmass; 191 192 catalog[0].measure[Nmeas].Mgal_PS = stars[N].Mgal; 193 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG); 194 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG); 195 catalog[0].measure[Nmeas].theta = MIN ((255/360)*stars[N].df, NO_ERR); 181 catalog[0].measure[Nmeas].dD = 3600.0*(catalog[0].average[n].D - stars[N].D); 182 183 /* XXX need to add dX, dY : need to load into stars[N].dX,dY */ 184 /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */ 185 catalog[0].measure[Nmeas].Xccd = stars[N].X; 186 catalog[0].measure[Nmeas].Yccd = stars[N].Y; 187 188 catalog[0].measure[Nmeas].M = stars[N].M; 189 catalog[0].measure[Nmeas].dM = stars[N].dM; /* error in input files stored in thousandths of mag */ 190 catalog[0].measure[Nmeas].Mcal = stars[N].Mcal; 191 catalog[0].measure[Nmeas].t = stars[N].t; 192 catalog[0].measure[Nmeas].averef = n; 193 catalog[0].measure[Nmeas].photcode = stars[N].code; /* photcode */ 194 catalog[0].measure[Nmeas].dophot = stars[N].dophot; 195 catalog[0].measure[Nmeas].flags = 0; 196 catalog[0].measure[Nmeas].dt = stars[N].dt; 197 catalog[0].measure[Nmeas].airmass = stars[N].airmass; 198 199 catalog[0].measure[Nmeas].Mgal = stars[N].Mgal; 200 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG); 201 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG); 202 catalog[0].measure[Nmeas].theta = MIN ((0xffff/360.0)*stars[N].df, NO_MAG); 196 203 197 /* it is not valid to pass PRI/SEC/REF photcodes to this routine */ 198 /* check for entries in the secfilt lists */ 199 Mcat = PhotCat (&catalog[0].measure[Nmeas]); 200 Mval = (Nsec == -1) ? &catalog[0].average[n].M : &catalog[0].secfilt[n*Nsecfilt+Nsec].M_PS; 201 if (*Mval == NO_MAG) *Mval = Mcat; 204 /* set the average magnitude if not already set and the photcode.equiv is not 0 */ 202 205 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 206 if (Nsec > -1) { 207 if (catalog[0].secfilt[n*Nsecfilt+Nsec].M != NO_MAG) { 208 catalog[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]); 209 } 210 } 203 211 204 212 /* adds the measurement to the calibration if appropriate color terms are found */ … … 240 248 catalog[0].average[Nave].R = stars[N].R; 241 249 catalog[0].average[Nave].D = stars[N].D; 242 catalog[0].average[Nave].M = NO_MAG; 243 catalog[0].average[Nave].dM = NO_MAG; 250 catalog[0].average[Nave].Xp = 0; 244 251 catalog[0].average[Nave].Nm = 1; 245 252 catalog[0].average[Nave].Nn = 0; 246 catalog[0].average[Nave].Xp = NO_MAG;247 catalog[0].average[Nave].Xm = NO_MAG;248 catalog[0].average[Nave].Xg = NO_MAG;249 253 catalog[0].average[Nave].offset = Nmeas; 250 254 catalog[0].average[Nave].missing = -1; … … 261 265 262 266 for (j = 0; j < Nsecfilt; j++) { 263 catalog[0].secfilt[Nave*Nsecfilt+j].M _PS= NO_MAG;264 catalog[0].secfilt[Nave*Nsecfilt+j].dM _PS= NO_MAG;267 catalog[0].secfilt[Nave*Nsecfilt+j].M = NO_MAG; 268 catalog[0].secfilt[Nave*Nsecfilt+j].dM = NO_MAG; 265 269 catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG; 266 270 } 267 271 268 catalog[0].measure[Nmeas].dR_PS = 0.0; 269 catalog[0].measure[Nmeas].dD_PS = 0.0; 270 catalog[0].measure[Nmeas].M_PS = stars[N].M; 271 catalog[0].measure[Nmeas].dM_PS = stars[N].dM; 272 catalog[0].measure[Nmeas].Mcal_PS = stars[N].Mcal; 273 catalog[0].measure[Nmeas].t = stars[N].t; 274 catalog[0].measure[Nmeas].averef = Nave; 275 catalog[0].measure[Nmeas].source = stars[N].code; /* photcode */ 276 catalog[0].measure[Nmeas].dophot = stars[N].dophot; 277 catalog[0].measure[Nmeas].flags = 0; 278 catalog[0].measure[Nmeas].dt_PS = stars[N].dt; 279 catalog[0].measure[Nmeas].airmass_PS = stars[N].airmass; 280 281 catalog[0].measure[Nmeas].Mgal_PS = stars[N].Mgal; 282 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG); 283 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG); 284 catalog[0].measure[Nmeas].theta = MIN ((255/360)*stars[N].df, NO_ERR); 285 286 Mcat = PhotCat (&catalog[0].measure[Nmeas]); 287 Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M_PS; 288 if (*Mval == NO_MAG) *Mval = Mcat; 272 /* XXX need to add dX, dY : need to load into stars[N].dX,dY */ 273 /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */ 274 catalog[0].measure[Nmeas].Xccd = stars[N].X; 275 catalog[0].measure[Nmeas].Yccd = stars[N].Y; 276 277 catalog[0].measure[Nmeas].dR = 0.0; 278 catalog[0].measure[Nmeas].dD = 0.0; 279 catalog[0].measure[Nmeas].M = stars[N].M; 280 catalog[0].measure[Nmeas].dM = stars[N].dM; 281 catalog[0].measure[Nmeas].Mcal = stars[N].Mcal; 282 catalog[0].measure[Nmeas].t = stars[N].t; 283 catalog[0].measure[Nmeas].averef = Nave; 284 catalog[0].measure[Nmeas].photcode = stars[N].code; /* photcode */ 285 catalog[0].measure[Nmeas].dophot = stars[N].dophot; 286 catalog[0].measure[Nmeas].flags = 0; 287 catalog[0].measure[Nmeas].dt = stars[N].dt; 288 catalog[0].measure[Nmeas].airmass = stars[N].airmass; 289 290 catalog[0].measure[Nmeas].Mgal = stars[N].Mgal; 291 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG); 292 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG); 293 catalog[0].measure[Nmeas].theta = MIN ((0xffff/360.0)*stars[N].df, NO_ERR); 294 295 /* set the average magnitude if not already set and the photcode.equiv is not 0 */ 296 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 297 if (Nsec > -1) { 298 catalog[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]); 299 } 289 300 290 301 /* next[Nmeas] should always be -1 in this context (it is always the only -
trunk/Ohana/src/addstar/src/find_matches_refstars.c
r8644 r12332 131 131 /** add measurements for this star **/ 132 132 /** *** dR,dD now in arcsec *** **/ 133 catalog[0].measure[Nmeas].dR _PS= 3600.0*(catalog[0].average[n].R - stars[N][0].R);134 catalog[0].measure[Nmeas].dD _PS= 3600.0*(catalog[0].average[n].D - stars[N][0].D);135 catalog[0].measure[Nmeas].M _PS= MIN (stars[N][0].M, NO_MAG);136 catalog[0].measure[Nmeas].dM _PS= MIN (stars[N][0].dM, NO_ERR);137 catalog[0].measure[Nmeas].Mcal _PS= 0;138 catalog[0].measure[Nmeas].t = (TIMEREF == 0) ? stars[N][0].t : TIMEREF; /** careful : time_t vs e_time **/139 catalog[0].measure[Nmeas].averef = n;140 catalog[0].measure[Nmeas]. source= stars[N][0].code;141 catalog[0].measure[Nmeas].dophot = 0;142 catalog[0].measure[Nmeas].flags = 0;143 catalog[0].measure[Nmeas].dt _PS= 0xffff;144 145 catalog[0].measure[Nmeas].Mgal _PS= NO_MAG;146 catalog[0].measure[Nmeas].airmass _PS= 0;147 catalog[0].measure[Nmeas].FWx = NO_MAG;148 catalog[0].measure[Nmeas].FWy = NO_MAG;149 catalog[0].measure[Nmeas].theta = NO_ERR;133 catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].R); 134 catalog[0].measure[Nmeas].dD = 3600.0*(catalog[0].average[n].D - stars[N][0].D); 135 catalog[0].measure[Nmeas].M = MIN (stars[N][0].M, NO_MAG); 136 catalog[0].measure[Nmeas].dM = MIN (stars[N][0].dM, NO_ERR); 137 catalog[0].measure[Nmeas].Mcal = 0; 138 catalog[0].measure[Nmeas].t = (TIMEREF == 0) ? stars[N][0].t : TIMEREF; /** careful : time_t vs e_time **/ 139 catalog[0].measure[Nmeas].averef = n; 140 catalog[0].measure[Nmeas].photcode = stars[N][0].code; 141 catalog[0].measure[Nmeas].dophot = 0; 142 catalog[0].measure[Nmeas].flags = 0; 143 catalog[0].measure[Nmeas].dt = 0xffff; 144 145 catalog[0].measure[Nmeas].Mgal = NO_MAG; 146 catalog[0].measure[Nmeas].airmass = 0; 147 catalog[0].measure[Nmeas].FWx = NO_MAG; 148 catalog[0].measure[Nmeas].FWy = NO_MAG; 149 catalog[0].measure[Nmeas].theta = NO_MAG; 150 150 151 /* XXX need to add dX, dY : need to load into stars[N].dX,dY */ 152 /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */ 153 catalog[0].measure[Nmeas].Xccd = 0.0; 154 catalog[0].measure[Nmeas].Yccd = 0.0; 155 151 156 if (ACCEPT_MOTION) { 152 catalog[0].average[n].uR = stars[N][0].uR;153 catalog[0].average[n].uD = stars[N][0].uD;154 catalog[0].average[n].duR = stars[N][0].duR;155 catalog[0].average[n].duD = stars[N][0].duD;156 catalog[0].average[n].P = stars[N][0].P;157 catalog[0].average[n].dP = stars[N][0].dP;157 catalog[0].average[n].uR = stars[N][0].uR; 158 catalog[0].average[n].uD = stars[N][0].uD; 159 catalog[0].average[n].duR = stars[N][0].duR; 160 catalog[0].average[n].duD = stars[N][0].duD; 161 catalog[0].average[n].P = stars[N][0].P; 162 catalog[0].average[n].dP = stars[N][0].dP; 158 163 } 159 164 … … 207 212 catalog[0].average[Nave].R = stars[N][0].R; 208 213 catalog[0].average[Nave].D = stars[N][0].D; 214 catalog[0].average[Nave].Xp = 0; 215 catalog[0].average[Nave].Nm = 1; 216 catalog[0].average[Nave].Nn = 0; 217 catalog[0].average[Nave].offset = Nmeas; 218 catalog[0].average[Nave].missing = -1; 219 catalog[0].average[Nave].code = 0; 209 220 210 221 if (ACCEPT_MOTION) { … … 228 239 } 229 240 230 catalog[0].average[Nave].M = NO_MAG;231 catalog[0].average[Nave].dM = NO_MAG;232 catalog[0].average[Nave].Nm = 1;233 catalog[0].average[Nave].Nn = 0;234 catalog[0].average[Nave].Xp = NO_MAG;235 catalog[0].average[Nave].Xm = NO_MAG;236 catalog[0].average[Nave].Xg = NO_MAG;237 catalog[0].average[Nave].offset = Nmeas;238 catalog[0].average[Nave].missing = -1;239 catalog[0].average[Nave].code = 0;240 241 241 for (j = 0; j < Nsecfilt; j++) { 242 catalog[0].secfilt[Nave*Nsecfilt+j].M_PS = NO_MAG; 243 catalog[0].secfilt[Nave*Nsecfilt+j].dM_PS = NO_MAG; 244 catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG; 245 } 246 247 catalog[0].measure[Nmeas].dR_PS = 0.0; 248 catalog[0].measure[Nmeas].dD_PS = 0.0; 249 catalog[0].measure[Nmeas].M_PS = MIN (stars[N][0].M, NO_MAG); 250 catalog[0].measure[Nmeas].dM_PS = MIN (stars[N][0].dM, NO_ERR); 251 catalog[0].measure[Nmeas].Mcal_PS = 0; 252 catalog[0].measure[Nmeas].t = (stars[N][0].t == 0) ? TIMEREF : stars[N][0].t; /** careful : time_t vs e_time **/ 253 catalog[0].measure[Nmeas].averef = Nave; 254 catalog[0].measure[Nmeas].source = stars[N][0].code; 255 catalog[0].measure[Nmeas].dophot = 0; 256 catalog[0].measure[Nmeas].flags = 0; 257 catalog[0].measure[Nmeas].dt_PS = 0xffff; 258 259 catalog[0].measure[Nmeas].Mgal_PS = NO_MAG; 260 catalog[0].measure[Nmeas].airmass_PS = 0; 261 catalog[0].measure[Nmeas].FWx = NO_MAG; 262 catalog[0].measure[Nmeas].FWy = NO_ERR; 263 catalog[0].measure[Nmeas].theta = NO_ERR; 242 catalog[0].secfilt[Nave*Nsecfilt+j].M = NO_MAG; 243 catalog[0].secfilt[Nave*Nsecfilt+j].dM = NO_MAG; 244 catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG; 245 } 246 247 catalog[0].measure[Nmeas].dR = 0.0; 248 catalog[0].measure[Nmeas].dD = 0.0; 249 catalog[0].measure[Nmeas].M = MIN (stars[N][0].M, NO_MAG); 250 catalog[0].measure[Nmeas].dM = MIN (stars[N][0].dM, NO_ERR); 251 catalog[0].measure[Nmeas].Mcal = 0; 252 catalog[0].measure[Nmeas].t = (stars[N][0].t == 0) ? TIMEREF : stars[N][0].t; /** careful : time_t vs e_time **/ 253 catalog[0].measure[Nmeas].averef = Nave; 254 catalog[0].measure[Nmeas].photcode = stars[N][0].code; 255 catalog[0].measure[Nmeas].dophot = 0; 256 catalog[0].measure[Nmeas].flags = 0; 257 catalog[0].measure[Nmeas].dt = 0xffff; 258 259 catalog[0].measure[Nmeas].airmass = 0; 260 catalog[0].measure[Nmeas].Mgal = NO_MAG; 261 catalog[0].measure[Nmeas].FWx = NO_MAG; 262 catalog[0].measure[Nmeas].FWy = NO_MAG; 263 catalog[0].measure[Nmeas].theta = NO_MAG; 264 265 /* XXX need to add dX, dY : need to load into stars[N].dX,dY */ 266 /* XXX need to add stargal, Sky, dSky, qPSF, detID, imageID */ 267 catalog[0].measure[Nmeas].Xccd = 0.0; 268 catalog[0].measure[Nmeas].Yccd = 0.0; 264 269 265 270 stars[N][0].found = Nmeas; -
trunk/Ohana/src/addstar/src/find_proper.c
r3339 r12332 111 111 catalog[0].measure[Nmeas].t = 0; /* a flag: if 0, image is not in database */ 112 112 catalog[0].measure[Nmeas].averef = n; 113 catalog[0].measure[Nmeas]. source = USNO_RED;113 catalog[0].measure[Nmeas].photcode = USNO_RED; 114 114 catalog[0].measure[Nmeas+1].dR = catalog[0].measure[Nmeas].dR; 115 115 catalog[0].measure[Nmeas+1].dD = catalog[0].measure[Nmeas].dD; … … 119 119 catalog[0].measure[Nmeas+1].t = 0; /* a flag: if 0, image is not in database */ 120 120 catalog[0].measure[Nmeas+1].averef = n; 121 catalog[0].measure[Nmeas+1]. source = USNO_BLUE;121 catalog[0].measure[Nmeas+1].photcode = USNO_BLUE; 122 122 /* add flag in average to mark as matched with the USNO catalog */ 123 123 catalog[0].average[n].code |= (ID_PROPER | ID_USNO); -
trunk/Ohana/src/addstar/src/gstars.c
r11584 r12332 7 7 int i, j, Nfile, Nheader, NHEADER, Nimage, NIMAGE; 8 8 int Nskip, Nhead, Ndata, done, status, mode, NinStars; 9 char **file ;9 char **file, *name; 10 10 FILE *f; 11 11 glob_t globList; … … 63 63 64 64 ReadImageHeader (header, &image[i], photcode); 65 66 /* find image rootname */ 67 name = filebasename (file[i]); 68 snprintf (image[i].name, 32, name); 69 free (name); 65 70 66 71 switch (mode) { … … 176 181 } 177 182 } 183 // some old format files did not write EXTTYPE. they have a single table in the first 184 // extension matched to the header in the PHU 185 if (Nimage == 0) { 186 extsize[0] = headers[0][0].size + gfits_matrix_size (headers[0]); 187 extsize[1] = headers[1][0].size + gfits_matrix_size (headers[1]); 188 gfits_scan (headers[1], "EXTNAME", "%s", 1, tmpword); 189 if (!strcmp (tmpword, "SMPFILE")) { 190 extdata[Nimage] = strcreate (tmpword); 191 exttype[Nimage] = strcreate ("SMPDATA"); 192 exthead[Nimage] = strcreate ("PHU"); 193 extnum_head[Nimage] = 0; 194 extnum_data[Nimage] = 1; 195 Nimage = 1; 196 } 197 } 198 if (Nimage == 0) Shutdown ("no object data in file"); 199 178 200 if (VERBOSE) fprintf (stderr, "file %s has %d headers, including %d images\n", file[0], Nheader, Nimage); 201 202 /* find image rootname */ 203 name = filebasename (file[0]); 179 204 180 205 // now run through the images, interpret the headers and read the stars … … 185 210 ReadImageHeader (headers[Nhead], &image[i], 0); 186 211 187 if (!strcmp(exthead[i], "PHU")) continue; 212 // XXX use something to set the chip name? EXTNAME? 213 if (!strcmp(exthead[i], "PHU") && (Nimage == 1)) { 214 snprintf (image[i].name, 32, "%s", name); 215 } else { 216 snprintf (image[i].name, 32, "%s.%s", name, exthead[i]); 217 } 218 219 // this is an error we should not encounter 220 if (!strcmp(extdata[i], "PHU")) Shutdown ("error in data segment: PHU cannot be table"); 188 221 189 222 // advance the pointer to the start of the corresponding table block … … 199 232 stars = MergeStars (stars, Nstars, inStars, image[i].nstar); 200 233 } 234 free (name); 201 235 *Nimages = Nimage; 202 236 *images = image; -
trunk/Ohana/src/addstar/src/load2mass_catalog.c
r7780 r12332 32 32 33 33 // XXX for now, set the average mag data to NULL 34 catalog[0].average[Nave].M = NO_MAG;35 catalog[0].average[Nave].dM = NO_MAG;36 34 catalog[0].average[Nave].Nm = 0; 37 35 catalog[0].average[Nave].Nn = 0; 38 36 catalog[0].average[Nave].Xp = NO_MAG; 39 catalog[0].average[Nave].Xm = NO_MAG;40 catalog[0].average[Nave].Xg = NO_MAG;41 37 catalog[0].average[Nave].offset = Nmeas; 42 38 catalog[0].average[Nave].missing = -1; … … 44 40 45 41 for (j = 0; j < Nsec; j++) { 46 catalog[0].secfilt[Nave*Nsec+j].M _PS= NO_MAG;47 catalog[0].secfilt[Nave*Nsec+j].dM _PS= NO_MAG;42 catalog[0].secfilt[Nave*Nsec+j].M = NO_MAG; 43 catalog[0].secfilt[Nave*Nsec+j].dM = NO_MAG; 48 44 catalog[0].secfilt[Nave*Nsec+j].Xm = NO_MAG; 49 45 } … … 51 47 // we now have the min chisq row. use this to supply the other filter values.... 52 48 for (j = 0; j < 3; j++) { 53 catalog[0].measure[Nmeas].dR _PS= 0.0;54 catalog[0].measure[Nmeas].dD _PS= 0.0;55 catalog[0].measure[Nmeas].M _PS= MIN (stars[i+j].M, NO_MAG);56 catalog[0].measure[Nmeas].dM _PS= MIN (stars[i+j].dM, NO_ERR);57 catalog[0].measure[Nmeas].Mcal _PS= 0;49 catalog[0].measure[Nmeas].dR = 0.0; 50 catalog[0].measure[Nmeas].dD = 0.0; 51 catalog[0].measure[Nmeas].M = MIN (stars[i+j].M, NO_MAG); 52 catalog[0].measure[Nmeas].dM = MIN (stars[i+j].dM, NO_ERR); 53 catalog[0].measure[Nmeas].Mcal = 0; 58 54 catalog[0].measure[Nmeas].t = stars[i+j].t; 59 55 catalog[0].measure[Nmeas].averef = Nave; 60 catalog[0].measure[Nmeas]. source = stars[i+j].code;56 catalog[0].measure[Nmeas].photcode = stars[i+j].code; 61 57 catalog[0].measure[Nmeas].dophot = 0; 62 58 catalog[0].measure[Nmeas].flags = 0; 63 catalog[0].measure[Nmeas].dt _PS= 0xffff;59 catalog[0].measure[Nmeas].dt = 0xffff; 64 60 65 catalog[0].measure[Nmeas].Mgal _PS= NO_MAG;66 catalog[0].measure[Nmeas].airmass _PS= 0;61 catalog[0].measure[Nmeas].Mgal = NO_MAG; 62 catalog[0].measure[Nmeas].airmass = 0; 67 63 catalog[0].measure[Nmeas].FWx = NO_MAG; 68 64 catalog[0].measure[Nmeas].FWy = NO_ERR; -
trunk/Ohana/src/addstar/src/replace_match.c
r6683 r12332 7 7 /* search for entry and replace values M, dM, R, D */ 8 8 for (i = 0; i < average[0].Nm; i++) { 9 if (measure[i]. source != star[0].code) continue;10 measure[i].dR _PS= 3600.0*(average[0].R - star[0].R);11 measure[i].dD _PS= 3600.0*(average[0].D - star[0].D);12 measure[i].M _PS= MIN (star[0].M, NO_MAG);13 measure[i].dM _PS= MIN (star[0].dM, NO_ERR);9 if (measure[i].photcode != star[0].code) continue; 10 measure[i].dR = 3600.0*(average[0].R - star[0].R); 11 measure[i].dD = 3600.0*(average[0].D - star[0].D); 12 measure[i].M = MIN (star[0].M, NO_MAG); 13 measure[i].dM = MIN (star[0].dM, NO_ERR); 14 14 star[0].found = average[0].offset + i; 15 15 return (TRUE); -
trunk/Ohana/src/addstar/src/update_coords.c
r6683 r12332 19 19 continue; 20 20 } 21 R = measure[m].dR _PS;22 D = measure[m].dD _PS;21 R = measure[m].dR; 22 D = measure[m].dD; 23 23 r += R; 24 24 d += D; … … 37 37 m = average[0].offset; /* first measurement of this star */ 38 38 for (i = 0; i < average[0].Nm; i++) { 39 measure[m].dR _PS-= r;40 measure[m].dD _PS-= d;39 measure[m].dR -= r; 40 measure[m].dD -= d; 41 41 m = next[m]; 42 42 } -
trunk/Ohana/src/delstar/src/ConfigInit.c
r6684 r12332 4 4 5 5 char *config, *file; 6 char PhotCodeFile[256]; 6 char CatdirPhotcodeFile[256]; 7 char MasterPhotcodeFile[256]; 7 8 8 9 /*** load configuration info ***/ … … 22 23 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 23 24 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 24 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);25 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 25 26 26 27 sprintf (ImageCat, "%s/Images.dat", CATDIR); … … 42 43 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 43 44 44 if (!LoadPhotcodes (PhotCodeFile)) { 45 fprintf (stderr, "error loading photcodes\n"); 45 /* XXX this does not yet write out the master photcode table */ 46 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 47 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 48 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 46 49 exit (1); 47 50 } -
trunk/Ohana/src/delstar/src/delete_imagefile.c
r8555 r12332 9 9 Image *image; 10 10 Catalog catalog; 11 SkyList *skylist;12 11 SkyTable *sky; 13 12 … … 22 21 if (VERBOSE) fprintf (stderr, "deleting %s\n", image[0].name); 23 22 24 for (i = 0; i < sky list[0].Nregions; i++) {23 for (i = 0; i < sky[0].Nregions; i++) { 25 24 26 if (VERBOSE) fprintf (stderr, "deleting from %s\n", sky list[0].filename[i]);27 catalog.filename = sky list[0].filename[i]; /* don't free region before catalog! */25 if (VERBOSE) fprintf (stderr, "deleting from %s\n", sky[0].filename[i]); 26 catalog.filename = sky[0].filename[i]; /* don't free region before catalog! */ 28 27 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 29 28 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 30 29 31 30 // an error exit status here is a significant error 32 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "a")) {31 if (!dvo_catalog_open (&catalog, &sky[0].regions[i], VERBOSE, "a")) { 33 32 fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename); 34 33 exit (2); … … 45 44 start = image[0].tzero; 46 45 stop = image[0].tzero + trange; 47 find_matches (&catalog, image[0]. source, start, stop);46 find_matches (&catalog, image[0].photcode, start, stop); 48 47 49 48 dvo_catalog_save (&catalog, VERBOSE); -
trunk/Ohana/src/delstar/src/delete_imagename.c
r8555 r12332 54 54 start = image[j].tzero; 55 55 stop = image[j].tzero + trange; 56 find_matches (&catalog, image[j]. source, start, stop);56 find_matches (&catalog, image[j].photcode, start, stop); 57 57 58 58 dvo_catalog_save (&catalog, VERBOSE); -
trunk/Ohana/src/delstar/src/find_image_db.c
r7080 r12332 46 46 start = timage[0].tzero - MAX(0.05*timage[0].trate*timage[0].NY, 1); 47 47 stop = timage[0].tzero + MAX(1.05*timage[0].trate*timage[0].NY, 1); 48 code = timage[0]. source;48 code = timage[0].photcode; 49 49 50 50 Nlist = 0; … … 55 55 if (image[i].tzero < start) continue; 56 56 if (image[i].tzero > stop) continue; 57 if (image[i]. source != code) continue;57 if (image[i].photcode != code) continue; 58 58 list[Nlist] = i; 59 59 Nlist ++; … … 82 82 if (image[i].tzero > END) continue; 83 83 if (code != NULL) { 84 if (image[i]. source != code[0].code) continue;84 if (image[i].photcode != code[0].code) continue; 85 85 } 86 86 list[Nlist] = i; -
trunk/Ohana/src/delstar/src/find_matches.c
r4680 r12332 55 55 drop &= (catalog[0].measure[i].t >= start); 56 56 drop &= (catalog[0].measure[i].t <= end); 57 drop &= ((photcode == -1) || (photcode == catalog[0].measure[i]. source));57 drop &= ((photcode == -1) || (photcode == catalog[0].measure[i].photcode)); 58 58 if (!drop) { 59 59 prev = i; -
trunk/Ohana/src/delstar/src/gimages.c
r7080 r12332 56 56 Shutdown ("ERROR: photcode %s not found in photcode table", photcode); 57 57 } 58 image[0]. source = Nc;58 image[0].photcode = Nc; 59 59 60 60 tmp = 0; … … 76 76 tmp = 0; 77 77 gfits_scan (&header, "AIRMASS", "%lf", 1, &tmp); 78 image[0].secz _PS= tmp;78 image[0].secz = tmp; 79 79 80 80 /* secz is in units milli-airmass */ 81 image[0].Mcal _PS = ALPHA*(image[0].secz_PS- 1.000);81 image[0].Mcal = ALPHA*(image[0].secz - 1.000); 82 82 image[0].Xm = NO_MAG; 83 83 -
trunk/Ohana/src/delstar/src/parse_time.c
r7080 r12332 70 70 for (c = strchr (line, 0x2d); c != (char *) NULL; c = strchr (line, 0x2d)) { *c = ' '; } 71 71 72 Nf = 0; 72 73 switch (mode) { 73 74 case 1: -
trunk/Ohana/src/elixir/src/DefineProcesses.c
r10336 r12332 27 27 GetConfig (config, "global.pending", "%s", 0, global[0].argv[2]); 28 28 GetConfig (config, "global.logfile", "%s", 0, global[0].argv[3]); 29 GetConfig (config, "global. source", "%s", 0, global[0].argv[4]);29 GetConfig (config, "global.photcode", "%s", 0, global[0].argv[4]); 30 30 GetConfig (config, "global.msg", "%s", 0, global[0].argv[5]); 31 31 GetConfig (config, "global.end", "%s", 0, global[0].argv[6]); -
trunk/Ohana/src/elixir/src/rconnect.c
r10336 r12332 40 40 fprintf (stderr, "child is spawned\n"); 41 41 42 status = execl (command, file, hostname, "/bin/csh", 0);42 status = execl (command, file, hostname, "/bin/csh", NULL); 43 43 fprintf (stderr, "error starting remote shell process\n"); 44 44 Shutdown (1); -
trunk/Ohana/src/gastro/src/ConfigInit.c
r8514 r12332 44 44 ScanConfig (config, "CATDIR", "%s", 0, CATDIR); // location of ptolemy-format ref data 45 45 ScanConfig (config, "ROUGH_ASTROMETRY", "%s", 0, ROUGH_ASTROMETRY); // where to get initial guess (header, config) 46 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile); // location of photcode table to convert supplied photcode47 46 48 47 if (strcasecmp (ROUGH_ASTROMETRY, "header") && -
trunk/Ohana/src/gastro/src/getptolemy.c
r8514 r12332 50 50 stars[k].X = catalog.average[j].R; 51 51 stars[k].Y = catalog.average[j].D; 52 stars[k].mag = catalog.measure[catalog.average[j].offset].M _PS;52 stars[k].mag = catalog.measure[catalog.average[j].offset].M; 53 53 } 54 54 dvo_catalog_free (&catalog); -
trunk/Ohana/src/gastro/src/gheader.c
r7080 r12332 14 14 oldsize = header.size; 15 15 16 /* validating the photcode name should be the job of DVO/addstar */ 17 /* here we are only writing the selected photcode name to the header */ 16 18 if (NEWPHOTCODE) { 17 /* we are going to write the photcode into the header18 here we are just checking that the photcode provided19 is a valid code */20 if (!LoadPhotcodes (PhotCodeFile)) {21 fprintf (stderr, "error loading photcodes\n");22 exit (0);23 }24 if (!GetPhotcodeCodebyName (PHOTCODE)) {25 fprintf (stderr, "ERROR: photcode not found in photcode table\n");26 exit (0);27 }28 19 gfits_modify (&header, "PHOTCODE", "%s", 1, PHOTCODE); 29 20 } -
trunk/Ohana/src/gastro/src/plotstuff.c
r4772 r12332 21 21 # endif /* ANSI */ 22 22 23 int InitSocket, status, addreslen; 23 int InitSocket, status; 24 socklen_t addreslen; 24 25 struct sockaddr_un Address; 25 26 char temp[100]; -
trunk/Ohana/src/gastro2/src/getptolemy.c
r8513 r12332 61 61 Ref[0].stars[k].R = catalog.average[j].R; 62 62 Ref[0].stars[k].D = catalog.average[j].D; 63 Ref[0].stars[k].M = catalog.measure[catalog.average[j].offset].M _PS;63 Ref[0].stars[k].M = catalog.measure[catalog.average[j].offset].M; 64 64 } 65 65 dvo_catalog_free (&catalog); -
trunk/Ohana/src/gastro2/src/gproject2.c
r8513 r12332 60 60 61 61 /* need to allow some leeway? use a fixed +/- 0.5 mag for now */ 62 MMIN = MMAX = 0; 62 63 if (MAGLIMS && !MAGMANUAL) { 63 64 MMAX = Target[0].lum.Mmax + 1.0; -
trunk/Ohana/src/gastro2/src/plotstuff.c
r8496 r12332 21 21 # endif /* ANSI */ 22 22 23 int InitSocket, status, addreslen; 23 int InitSocket, status; 24 socklen_t addreslen; 24 25 struct sockaddr_un Address; 25 26 char temp[100]; -
trunk/Ohana/src/getstar/src/ConfigInit.c
r6968 r12332 4 4 5 5 char *config, *file; 6 char PhotCodeFile[256]; 6 char CatdirPhotcodeFile[256]; 7 char MasterPhotcodeFile[256]; 7 8 8 9 /*** load configuration info ***/ … … 20 21 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 21 22 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 22 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);23 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 23 24 if (!ScanConfig (config, "SKY_DEPTH", "%d", 0, &SKY_DEPTH)) { 24 25 SKY_DEPTH = 2; … … 31 32 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 32 33 33 if (!LoadPhotcodes (PhotCodeFile)) { 34 fprintf (stderr, "error loading photcodes\n"); 34 /* XXX this does not yet write out the master photcode table */ 35 sprintf (MasterPhotcodeFile, "%s/Photcodes.dat", CATDIR); 36 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 37 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 35 38 exit (1); 36 39 } -
trunk/Ohana/src/getstar/src/select_by_image.c
r6812 r12332 21 21 start = image[0].tzero; 22 22 end = image[0].tzero + 1e-4*image[0].NY*image[0].trate; /* trate is in 0.1 msec / row */ 23 photcode = image[0]. source;23 photcode = image[0].photcode; 24 24 } 25 25 if (VERBOSE) fprintf (stderr, "extracting for range %d to %d (photcode %s)\n", start, end, photcode); … … 27 27 for (i = 0; (i < catalog[0].Nmeasure); i++) { 28 28 if ((i % 10000) == 0) fprintf (stderr, ". "); 29 if ((catalog[0].measure[i].t >= start) && (catalog[0].measure[i].t <= end) && (photcode == catalog[0].measure[i]. source)) {29 if ((catalog[0].measure[i].t >= start) && (catalog[0].measure[i].t <= end) && (photcode == catalog[0].measure[i].photcode)) { 30 30 n = catalog[0].measure[i].averef; 31 31 stars[N].R = catalog[0].average[n].R - catalog[0].measure[i].dR / 360000.0; -
trunk/Ohana/src/getstar/src/select_by_region.c
r9630 r12332 38 38 if (D > region[0].Dmax) continue; 39 39 40 if (MagLimitUse && (catalog[0].average[i].M > MagLimitValue)) continue; 40 /* XXX add photcode as argument to MagLimitUse */ 41 if (MagLimitUse && (catalog[0].secfilt[Nsecfilt*i].M > MagLimitValue)) continue; 41 42 42 43 output[0].average[Nave] = catalog[0].average[i]; -
trunk/Ohana/src/imclean/src/AdjustHeader.c
r7080 r12332 18 18 } 19 19 20 /* validating the photcode name should be the job of DVO/addstar */ 21 /* here we are only writing the selected photcode name to the header */ 20 22 if (NEWPHOTCODE) { 21 /* we are going to write the photcode into the header22 here we are just checking that the photcode provided23 is a valid code */24 if (!LoadPhotcodes (PhotCodeFile)) {25 fprintf (stderr, "ERROR: can't load photcodes\n");26 exit (1);27 }28 if (!GetPhotcodebyName (PHOTCODE)) {29 fprintf (stderr, "ERROR: photcode not found in photcode table\n");30 exit (1);31 }32 23 gfits_modify (header, "PHOTCODE", "%s", 1, PHOTCODE); 33 24 } -
trunk/Ohana/src/imclean/src/ConfigInit.c
r2423 r12332 20 20 ScanConfig (config, "DOPHOT_CHAR_LINE", "%d", 0, &CHAR_LINE); 21 21 ScanConfig (config, "DOPHOT_TYPE_FIELD", "%d", 0, &TYPE_FIELD); 22 ScanConfig (config, "DOPHOT _PSF_FIELD", "%d", 0, &PSF_FIELD);22 ScanConfig (config, "DOPHOTF_FIELD", "%d", 0, &PSF_FIELD); 23 23 ScanConfig (config, "DOPHOT_AP_FIELD", "%d", 0, &AP_FIELD); 24 24 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile); -
trunk/Ohana/src/imregister/Makefile
r11880 r12332 33 33 imregtable imphotsearch \ 34 34 cameraconfig filtnames \ 35 photcode 35 photcode photcode-table 36 36 37 37 # program under development, not installed … … 145 145 $(BASEDIR)/sort.$(ARCH).o 146 146 147 $(SRC)/photcode-table.$(ARCH).o \ 147 148 $(SRC)/photcode.$(ARCH).o \ 148 149 $(SRC)/cameraconfig.$(ARCH).o \ … … 168 169 $(BIN)/filtnames.$(ARCH) : $(SRC)/filtnames.$(ARCH).o $(BASEOBJ) 169 170 $(BIN)/photcode.$(ARCH) : $(SRC)/photcode.$(ARCH).o $(BASEOBJ) 171 $(BIN)/photcode-table.$(ARCH) : $(SRC)/photcode-table.$(ARCH).o 170 172 171 173 $(BIN)/imsort.$(ARCH): $(BIN)/imregister.$(ARCH) -
trunk/Ohana/src/imregister/base/ConfigInit.c
r6684 r12332 7 7 int i, NDB; 8 8 char *config, *file, ElixirBase[80], catdir[256]; 9 char CatdirPhotcodeFile[256]; 10 char MasterPhotcodeFile[256]; 9 11 10 12 /*** load configuration info ***/ … … 25 27 26 28 WarnConfig (config, "CATDIR", "%s", 0, catdir); 29 WarnConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 27 30 sprintf (ImPhotDB, "%s/Images.dat", catdir); 28 31 29 32 /* small text databases: filters, camera defs */ 30 WarnConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);31 33 WarnConfig (config, "TEMPERATURE_LOG", "%s", 0, TempLogFile); 32 34 WarnConfig (config, "FILTER_LIST", "%s", 0, FilterList); … … 73 75 74 76 WarnConfig (config, "imstats", "%s", 0, ElixirBase); 75 sprintf (ImstatFifo, "%s. source", ElixirBase);77 sprintf (ImstatFifo, "%s.photcode", ElixirBase); 76 78 WarnConfig (config, "ptolemy", "%s", 0, ElixirBase); 77 sprintf (PtolemyFifo, "%s. source", ElixirBase);79 sprintf (PtolemyFifo, "%s.photcode", ElixirBase); 78 80 79 81 if (!ScanConfig (config, "CONNECT", "%s", 0, CONNECT)) { … … 101 103 } 102 104 105 /* XXX this does not yet write out the master photcode table */ 106 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", catdir); 107 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 108 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 109 exit (1); 110 } 111 103 112 free (config); 104 113 free (file); -
trunk/Ohana/src/imregister/base/misc.c
r10073 r12332 11 11 2 - arguments bad 12 12 */ 13 int get_trange_arguments (int *argc, char **argv, unsigned long **Tstart, unsigned long**Tstop, int *ntimes) {13 int get_trange_arguments (int *argc, char **argv, time_t **Tstart, time_t **Tstop, int *ntimes) { 14 14 15 15 int Na, N, Ntimes; 16 16 double trange; 17 unsigned longtmp, *tstart, *tstop;17 time_t tmp, *tstart, *tstop; 18 18 19 19 /* allocate space for returned lists */ 20 20 Ntimes = 10; 21 ALLOCATE (tstart, unsigned long, Ntimes);22 ALLOCATE (tstop, unsigned long, Ntimes);21 ALLOCATE (tstart, time_t, Ntimes); 22 ALLOCATE (tstop, time_t, Ntimes); 23 23 24 24 for (N = 0; ; N++) { … … 65 65 if (N == Ntimes - 1) { 66 66 Ntimes += 10; 67 REALLOCATE (tstart, unsigned long, Ntimes);68 REALLOCATE (tstop, unsigned long, Ntimes);67 REALLOCATE (tstart, time_t, Ntimes); 68 REALLOCATE (tstop, time_t, Ntimes); 69 69 } 70 70 } -
trunk/Ohana/src/imregister/detrend/args.detsearch.c
r2803 r12332 10 10 Criteria base, *crit; 11 11 int *filt; 12 unsigned long*tstart, *tstop;12 time_t *tstart, *tstop; 13 13 14 14 if ((N = get_argument (argc, argv, "-h"))) { usage (); } … … 96 96 97 97 /* define time / ranges */ 98 tstart = tstop = (unsigned long *)NULL;98 tstart = tstop = NULL; 99 99 base.TimeSelect = base.tstart = base.tstop = 0; 100 100 if ((N = get_argument (argc, argv, "-time"))) { … … 352 352 } 353 353 354 Criteria *ExpandBase (Criteria base, int *ncrit, unsigned long *tstart, unsigned long*tstop, int *filt) {354 Criteria *ExpandBase (Criteria base, int *ncrit, time_t *tstart, time_t *tstop, int *filt) { 355 355 356 356 Criteria *crit; … … 370 370 for (j = 0; j < Ntimes; j++) { 371 371 crit[Nc] = base; 372 if (tstart != (unsigned long *)NULL) {372 if (tstart != NULL) { 373 373 crit[Nc].tstart = tstart[j]; 374 374 crit[Nc].tstop = tstop[j]; -
trunk/Ohana/src/imregister/detrend/output.c
r7080 r12332 70 70 char *filtstr, *typestr, *modestr, *ccdstr, *datestr, *p; 71 71 int i; 72 unsigned longtsecond;72 time_t tsecond; 73 73 74 74 /* create primary header */ -
trunk/Ohana/src/imregister/imphot/ConfigInit.c
r6684 r12332 8 8 int i, NDB; 9 9 char *config, *file, ElixirBase[80], catdir[256]; 10 char CatdirPhotcodeFile[256]; 11 char MasterPhotcodeFile[256]; 10 12 11 13 /*** load configuration info ***/ … … 21 23 22 24 WarnConfig (config, "CATDIR", "%s", 0, catdir); 25 WarnConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 23 26 sprintf (ImPhotDB, "%s/Images.dat", catdir); 24 27 25 28 /* small text databases: filters, camera defs */ 26 WarnConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);27 29 WarnConfig (config, "TEMPERATURE_LOG", "%s", 0, TempLogFile); 28 30 WarnConfig (config, "FILTER_LIST", "%s", 0, FilterList); … … 69 71 70 72 WarnConfig (config, "imstats", "%s", 0, ElixirBase); 71 sprintf (ImstatFifo, "%s. source", ElixirBase);73 sprintf (ImstatFifo, "%s.photcode", ElixirBase); 72 74 WarnConfig (config, "ptolemy", "%s", 0, ElixirBase); 73 sprintf (PtolemyFifo, "%s. source", ElixirBase);75 sprintf (PtolemyFifo, "%s.photcode", ElixirBase); 74 76 75 77 if (!ScanConfig (config, "CONNECT", "%s", 0, CONNECT)) { … … 97 99 } 98 100 101 /* XXX this does not yet write out the master photcode table */ 102 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 103 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 104 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 105 exit (1); 106 } 107 99 108 free (config); 100 109 free (file); -
trunk/Ohana/src/imregister/imphot/args.c
r4772 r12332 8 8 9 9 ConfigInit (&argc, argv); /* load elixir config data */ 10 11 /* load photcode data */12 if (!LoadPhotcodes (PhotCodeFile)) {13 fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);14 exit (1);15 }16 10 17 11 /* interpret command-line arguments */ -
trunk/Ohana/src/imregister/imphot/dumpfits.c
r7080 r12332 55 55 int i; 56 56 double zp, dzp, ra, dec, airmass, sky; 57 unsigned longtsecond;57 time_t tsecond; 58 58 59 59 /* create primary header */ … … 113 113 subset = &image[match[i]]; 114 114 startstr = sec_to_date (subset[0].tzero); 115 filtstr = GetPhotcodeNamebyCode (subset[0]. source);116 zp = subset[0].Mcal _PS;117 dzp = subset[0].dMcal _PS;115 filtstr = GetPhotcodeNamebyCode (subset[0].photcode); 116 zp = subset[0].Mcal; 117 dzp = subset[0].dMcal; 118 118 XY_to_RD (&ra, &dec, 0.0, 0.0, &subset[0].coords); 119 airmass = subset[0].secz _PS;119 airmass = subset[0].secz; 120 120 sky = subset[0].Myyyy + 0x8000; 121 121 -
trunk/Ohana/src/imregister/imphot/output.c
r5014 r12332 35 35 36 36 /* convert photcode to filter name */ 37 photstr = GetPhotcodeNamebyCode (image[i]. source);37 photstr = GetPhotcodeNamebyCode (image[i].photcode); 38 38 if (photstr == (char *) NULL) photstr = PhotError; 39 39 40 40 fprintf (stdout, "%s %s %s %7.4f %7.4f %7.4f %5d %02x\n", image[i].name, photstr, timestr, 41 image[i].Mcal _PS, image[i].dMcal_PS, image[i].secz_PS, image[i].nstar, image[i].code);41 image[i].Mcal, image[i].dMcal, image[i].secz, image[i].nstar, image[i].code); 42 42 free (timestr); 43 43 } -
trunk/Ohana/src/imregister/imphot/subset.c
r5386 r12332 23 23 } 24 24 if (!status && criteria.Ntimes) continue; 25 if (criteria.PhotcodeSelect && (image[i]. source != criteria.photcode)) continue;25 if (criteria.PhotcodeSelect && (image[i].photcode != criteria.photcode)) continue; 26 26 if (criteria.CodeSelect && (image[i].code != criteria.Code)) continue; 27 27 if (criteria.NameSelect && strncasecmp (image[i].name, criteria.Name, NameSelectLength)) continue; -
trunk/Ohana/src/imregister/imreg/cadc.c
r7080 r12332 8 8 int i, Obsid, Nobsid, Nsubset, ref; 9 9 char *datestr, *line, hdrname[99]; 10 unsigned longtsecond;10 time_t tsecond; 11 11 Header header, theader; 12 12 Matrix matrix; -
trunk/Ohana/src/imregister/imreg/output.c
r7080 r12332 92 92 char *obsstr, *regstr, *line, dummy[64]; 93 93 char *modestr, *typestr, *ccdstr, *datestr; 94 unsigned longtsecond;94 time_t tsecond; 95 95 Header header, theader; 96 96 Matrix matrix; -
trunk/Ohana/src/imregister/imreg/rconnect.c
r2823 r12332 40 40 setvbuf (stderr, (char *) NULL, _IONBF, BUFSIZ); 41 41 42 status = execl (command, file, hostname, "/bin/csh", 0);42 status = execl (command, file, hostname, "/bin/csh", NULL); 43 43 fprintf (stderr, "error starting remote shell process\n"); 44 44 Shutdown (1); -
trunk/Ohana/src/imregister/include/detrend.h
r3606 r12332 7 7 8 8 typedef struct { 9 int TimeSelect; unsigned longtstart, tstop;9 int TimeSelect; time_t tstart, tstop; 10 10 char *label; 11 11 char *imageID; … … 28 28 int NameSelect; char *Name; 29 29 int ExptimeSelect; float Exptime; 30 int TimeSelect; unsigned longtstart, tstop;30 int TimeSelect; time_t tstart, tstop; 31 31 int MatchNumber; 32 32 } Criteria; … … 48 48 49 49 char *ModifyEntry, *ModifyValue; 50 unsigned longTimeValue;50 time_t TimeValue; 51 51 52 52 int verbose; … … 97 97 Criteria *MosaicCriteria (Criteria base, char *filename, int *ncrit); 98 98 Criteria *ImageCriteria (Criteria base, char *filename, char *ImageExtend, char *ImageMode, int *ncrit); 99 Criteria *ExpandBase (Criteria base, int *ncrit, unsigned long *tstart, unsigned long*tstop, int *filt);99 Criteria *ExpandBase (Criteria base, int *ncrit, time_t *tstart, time_t *tstop, int *filt); 100 100 Criteria *ExpandRecipe (Criteria *base, int *Ncrit); 101 101 -
trunk/Ohana/src/imregister/include/imphot.h
r4024 r12332 3 3 int PhotcodeSelect; int photcode; 4 4 int NameSelect; char *Name; 5 int Ntimes; unsigned long*tstart, *tstop;5 int Ntimes; time_t *tstart, *tstop; 6 6 int CodeSelect; int Code; 7 7 } criteria; -
trunk/Ohana/src/imregister/include/imreg.h
r3606 r12332 22 22 int ProcSelect; int Proc; 23 23 int DistSelect; int Dist; 24 int Ntimes; unsigned long*tstart, *tstop;24 int Ntimes; time_t *tstart, *tstop; 25 25 int MatchNumber; 26 26 int Close; -
trunk/Ohana/src/imregister/include/imregister.h
r7080 r12332 69 69 int *filternum; 70 70 71 int get_trange_arguments (int *argc, char **argv, unsigned long **Tstart, unsigned long**Tstop, int *ntimes);71 int get_trange_arguments (int *argc, char **argv, time_t **Tstart, time_t **Tstop, int *ntimes); 72 72 int get_filter_arguments (int *argc, char **argv, int **Filt, int *Nfilt); 73 73 -
trunk/Ohana/src/imregister/include/photreg.h
r3606 r12332 2 2 3 3 struct { 4 int Ntimes; unsigned long*tstart, *tstop;4 int Ntimes; time_t *tstart, *tstop; 5 5 int PhotCodeSelect; int photcode; 6 6 int LabelSelect; char *Label; -
trunk/Ohana/src/imregister/include/spreg.h
r3534 r12332 20 20 21 21 struct { 22 int Ntimes; unsigned long*tstart, *tstop;22 int Ntimes; time_t *tstart, *tstop; 23 23 int ModeSelect; int Mode; 24 24 int StateSelect; int State; -
trunk/Ohana/src/imregister/photreg/args.photreg.c
r3606 r12332 8 8 int *list, Nlist; 9 9 int N, Ntimes; 10 unsigned long*tstart, *tstop;10 time_t *tstart, *tstop; 11 11 PhotCode *photcode, *depcode; 12 12 … … 19 19 if (get_argument (argc, argv, "-h")) usage (); 20 20 if (get_argument (argc, argv, "--help")) usage (); 21 22 /* load photcode data */23 if (!LoadPhotcodes (PhotCodeFile)) {24 fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);25 exit (1);26 }27 21 28 22 /* set the required database */ -
trunk/Ohana/src/imregister/photreg/args.photsearch.c
r3606 r12332 9 9 ConfigCamera (); 10 10 ConfigFilter (); 11 12 /* load photcode data */13 if (!LoadPhotcodes (PhotCodeFile)) {14 fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);15 exit (1);16 }17 11 18 12 criteria.Ntimes = 0; -
trunk/Ohana/src/imregister/photreg/getImageData.c
r7080 r12332 17 17 18 18 /* get time from image header */ 19 ALLOCATE (criteria.tstart, unsigned long, 1);20 ALLOCATE (criteria.tstart, unsigned long, 1);19 ALLOCATE (criteria.tstart, time_t, 1); 20 ALLOCATE (criteria.tstart, time_t, 1); 21 21 criteria.tstart[0] = parse_time (&header); 22 22 criteria.tstop[0] = criteria.tstart[0] + 1; -
trunk/Ohana/src/imregister/photreg/output.c
r7080 r12332 81 81 char *c1, *c2, *code, *photsys, *extname; 82 82 int i; 83 unsigned longtsecond;83 time_t tsecond; 84 84 85 85 /* create primary header */ -
trunk/Ohana/src/imregister/spreg/output.c
r7080 r12332 76 76 int i; 77 77 char *obsstr, *regstr, *line, *datestr; 78 unsigned longtsecond;78 time_t tsecond; 79 79 FILE *f; 80 80 Header header, theader; -
trunk/Ohana/src/imregister/src/imphotmerge.c
r7080 r12332 4 4 5 5 Image *LoadImageTable (FILE *f, Header *header, int *nimage); 6 static char *version = "imphotcopy $Revision: 1. 5$";6 static char *version = "imphotcopy $Revision: 1.6 $"; 7 7 8 8 int main (int argc, char **argv) { … … 14 14 char *dBFile; 15 15 int Nimage, Ninput, *index, Ntimes; 16 unsigned long*tstart, *tstop;16 time_t *tstart, *tstop; 17 17 int VERBOSE, PHOTCODE, dbstate; 18 18 int PhotCodeSelect, Nin; … … 22 22 get_version (argc, argv, version); 23 23 ConfigInit (&argc, argv); 24 25 /* load photcode data */26 if (!LoadPhotcodes (PhotCodeFile)) {27 fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);28 exit (1);29 }30 24 31 25 /* interpret command-line arguments */ … … 105 99 } 106 100 if (!status && Ntimes) continue; 107 if (PhotCodeSelect && (input[i]. source != PHOTCODE)) continue;101 if (PhotCodeSelect && (input[i].photcode != PHOTCODE)) continue; 108 102 if ((NameSelect != (char *) NULL) && (strncasecmp (input[i].name, NameSelect, NameSelectLength))) continue; 109 103 -
trunk/Ohana/src/kapa/graph/PSObjects.c
r10834 r12332 13 13 FILE *f; 14 14 char filename[1024], pagename[1024], *version; 15 int Nbytes, status;16 15 17 16 /* expect a line telling the number of bytes and a filename */ -
trunk/Ohana/src/kii/button/PSit.c
r10838 r12332 12 12 double scale; 13 13 char filename[1024], pagename[1024], *version; 14 int Nbytes, status;15 14 16 15 /* expect a line telling the number of bytes and a filename */ -
trunk/Ohana/src/libautocode/Makefile.Targets
r10315 r12332 5 5 $(ASRC)/average-loneos.$(ARCH).o \ 6 6 $(ASRC)/average-elixir.$(ARCH).o \ 7 $(ASRC)/average-panstarrs-dev-0.$(ARCH).o \ 7 8 $(ASRC)/average-panstarrs.$(ARCH).o \ 8 9 $(ASRC)/average-pmtest.$(ARCH).o \ … … 10 11 $(ASRC)/secfilt-loneos.$(ARCH).o \ 11 12 $(ASRC)/secfilt-elixir.$(ARCH).o \ 13 $(ASRC)/secfilt-panstarrs-dev-0.$(ARCH).o \ 12 14 $(ASRC)/secfilt-panstarrs.$(ARCH).o \ 13 15 $(ASRC)/measure.$(ARCH).o \ 14 16 $(ASRC)/measure-loneos.$(ARCH).o \ 15 17 $(ASRC)/measure-elixir.$(ARCH).o \ 18 $(ASRC)/measure-panstarrs-dev-0.$(ARCH).o \ 16 19 $(ASRC)/measure-panstarrs.$(ARCH).o \ 17 20 $(ASRC)/missing.$(ARCH).o \ … … 20 23 $(ASRC)/image-loneos.$(ARCH).o \ 21 24 $(ASRC)/image-elixir.$(ARCH).o \ 25 $(ASRC)/image-panstarrs-dev-0.$(ARCH).o \ 22 26 $(ASRC)/image-panstarrs.$(ARCH).o \ 23 27 $(ASRC)/regimage.$(ARCH).o \ … … 38 42 $(AINC)/average-loneos.h \ 39 43 $(AINC)/average-elixir.h \ 44 $(AINC)/average-panstarrs-dev-0.h \ 40 45 $(AINC)/average-panstarrs.h \ 41 46 $(AINC)/average-pmtest.h \ … … 43 48 $(AINC)/secfilt-loneos.h \ 44 49 $(AINC)/secfilt-elixir.h \ 50 $(AINC)/secfilt-panstarrs-dev-0.h \ 45 51 $(AINC)/secfilt-panstarrs.h \ 46 52 $(AINC)/measure.h \ 47 53 $(AINC)/measure-loneos.h \ 48 54 $(AINC)/measure-elixir.h \ 55 $(AINC)/measure-panstarrs-dev-0.h \ 49 56 $(AINC)/measure-panstarrs.h \ 50 57 $(AINC)/missing.h \ … … 53 60 $(AINC)/image-loneos.h \ 54 61 $(AINC)/image-elixir.h \ 62 $(AINC)/image-panstarrs-dev-0.h \ 55 63 $(AINC)/image-panstarrs.h \ 56 64 $(AINC)/regimage.h \ -
trunk/Ohana/src/libautocode/def/average.d
r11742 r12332 2 2 EXTNAME DVO_AVERAGE 3 3 TYPE BINTABLE 4 SIZE 7 64 SIZE 72 5 5 DESCRIPTION DVO Average Object Table 6 6 … … 19 19 FIELD dP, PAR_ERR, float, parallax error, arcsec 20 20 21 FIELD M, MAG, float, primary mag, mag 22 FIELD dM, MAG_ERR, float, error on primary mag, mag 21 # XXX drop the old primary magnitude concept 22 # FIELD M, MAG, float, primary mag, mag 23 # FIELD dM, MAG_ERR, float, error on primary mag, mag 24 # FIELD Xm, CHISQ_MAG, short, chisq for primary mag, [100*log(value)] 25 # FIELD Xg, CHISQ_GAL, short, chisq for galaxy mags, [100*log(value)] 26 23 27 FIELD Xp, SIGMA_POS, short, position scatter, 1/100 arcsec 24 FIELD Xm, CHISQ_MAG, short, chisq for primary mag, [100*log(value)]25 FIELD Xg, CHISQ_GAL, short, chisq for galaxy mags, [100*log(value)]26 28 FIELD Nm, NMEAS, unsigned short, number of measures 27 29 FIELD Nn, NMISS, unsigned short, number of missings … … 30 32 FIELD missing, missing, int, offset to first missing obs 31 33 34 # Pan-STARRS uses a 64-bit detection ID. keep this in two 32 bit ints for backwards compatibility? 35 FIELD objID_hi, OBJ_ID_HI, unsigned int, ID upper bytes 36 FIELD objID_lo, OBJ_ID_LO, unsigned int, ID lower bytes 37 32 38 # this structure should only be used for internal representations 33 39 # the average-FORMAT structures should be used for external representations 34 40 # note that the average magnitudes are stored in the 'secfilt' table (change this name??) 35 41 # the index for the secfilt table is just Nsecfilt times the index for the average table. 42 43 # XXX after the rest of the DVO re-org work, remove the magnitude based values from this table 44 # and move them to the secfilt table. 45 46 # the DVO object IDs are generated internally and are not equivalent to the PSPS object IDs 47 # probably need to add position chisq 48 49 # XXX include the number of measurements used to determine the positional information? -
trunk/Ohana/src/libautocode/def/image.d
r6454 r12332 25 25 FIELD tzero, TZERO, e_time, readout time (row 0) 26 26 FIELD nstar, NSTAR, unsigned int, number of stars on image 27 FIELD secz _PS,SECZ, float, airmass, mag27 FIELD secz, SECZ, float, airmass, mag 28 28 FIELD NX, NX, short, image width 29 29 FIELD NY, NY, short, image height 30 FIELD apmifit _PS,APMIFIT, float, aperture correction, mag31 FIELD dapmifit _PS,DAPMIFIT, float, apmifit error, mag32 FIELD Mcal _PS,MCAL, float, calibration mag, mag33 FIELD dMcal _PS,DMCAL, float, error on Mcal, mag30 FIELD apmifit, APMIFIT, float, aperture correction, mag 31 FIELD dapmifit, DAPMIFIT, float, apmifit error, mag 32 FIELD Mcal, MCAL, float, calibration mag, mag 33 FIELD dMcal, DMCAL, float, error on Mcal, mag 34 34 FIELD Xm, XM, short, image chisq, 10*log(value) 35 FIELD source, SOURCE,short, identifier for CCD,35 FIELD photcode, PHOTCODE, short, identifier for CCD, 36 36 FIELD exptime, EXPTIME, float, exposure time, seconds 37 37 FIELD sidtime, ST, float, sidereal time of exposure … … 48 48 FIELD code, CODE, char, image quality flag 49 49 FIELD ccdnum, CCDNUM, unsigned char, CCD ID number 50 # 40 bytes 50 FIELD imageID_hi, IMAGE_ID_HI, unsigned int, ID upper bytes 51 FIELD imageID_lo, IMAGE_ID_LO, unsigned int, ID lower bytes 52 # 48 bytes 51 53 52 FIELD dummy, DUMMY, char[1 8], unused54 FIELD dummy, DUMMY, char[10], unused 53 55 FIELD order, ORDER, short, Mrel 2D polynomical order 54 56 FIELD Mx, MX, short, Mrel polyterm … … 66 68 FIELD Mxyyy, MXYYY, short, Mrel polyterm 67 69 FIELD Myyyy, MYYYY, short, Mrel polyterm 68 # 4 8bytes70 # 40 bytes -
trunk/Ohana/src/libautocode/def/measure.d
r6454 r12332 2 2 EXTNAME DVO_MEASURE 3 3 TYPE BINTABLE 4 SIZE 504 SIZE 96 5 5 DESCRIPTION DVO Detection Measurement Table 6 6 7 FIELD dR_PS, D_RA, float, RA offset, arcsec 8 FIELD dD_PS, D_DEC, float, DEC offset, arcsec 9 FIELD M_PS, MAG, float, catalog mag, mag 10 FIELD Mcal_PS, Mcal, float, image cal mag, mag 11 FIELD Mgal_PS, Mgal, float, galaxy mag, mag 12 FIELD dM_PS, dM, float, mag error, mag 13 FIELD airmass_PS, airmass, float, (airmass - 1), airmass 14 FIELD dt_PS, dt, float, exposure time, 2.5*log(exptime) 15 FIELD FWx, FWx, short, object fwhm major axis, 1/100 of arcsec 16 FIELD FWy, FWy, short, object fwhm minor axis, 1/100 of arcsec 17 FIELD theta, theta, unsigned char, angle wrt ccd X dir, (0xff/360) deg 18 FIELD dophot, dophot, char, dophot type 19 FIELD source, source, unsigned short, photcode 20 FIELD flags, flags, unsigned short, flags for various uses 21 FIELD t, t, unsigned int, time in seconds (UNIX) 22 FIELD averef, averef, unsigned int, reference to average entry 7 FIELD dR, D_RA, float, RA offset, arcsec 8 FIELD dD, D_DEC, float, DEC offset, arcsec 9 FIELD M, MAG, float, catalog mag, mag 10 FIELD Mcal, Mcal, float, image cal mag, mag 11 FIELD Mgal, Mgal, float, galaxy mag, mag 12 FIELD dM, dM, float, mag error, mag 13 FIELD airmass, airmass, float, (airmass - 1), airmass 14 FIELD dt, dt, float, exposure time, 2.5*log(exptime) 15 16 FIELD t, t, unsigned int, time in seconds (UNIX) 17 FIELD averef, averef, unsigned int, reference to average entry 18 19 FIELD FWx, FWx, short, object fwhm major axis, 1/100 of arcsec 20 FIELD FWy, FWy, short, object fwhm minor axis, 1/100 of arcsec 21 FIELD theta, theta, short, angle wrt ccd X dir, (0xffff/360) deg 22 FIELD photcode, photcode, unsigned short, photcode 23 24 FIELD flags, flags, unsigned short, flags for various uses 25 FIELD dophot, dophot, char, dophot type 26 FIELD stargal, stargal, char, star-galaxy separator 27 28 # new field elements needed for Pan-STARRS: 29 FIELD Xccd, X_CCD, float, X coord on chip, pixels 30 FIELD Yccd, Y_CCD, float, Y coord on chip, pixels 31 32 # could these be packed into fewer bits? 33 FIELD Sky, SKY_FLUX, float, local estimate of sky flux, counts/sec 34 FIELD dSky, SKY_FLUX_ERR, float, local estimate of sky flux, counts/sec 35 36 FIELD dXccd, X_CCD_ERR, short, X coord error on chip, pixels 37 FIELD dYccd, Y_CCD_ERR, short, Y coord error on chip, pixels 38 39 # do we need more resolution than a short? should this be a log? 40 FIELD qPSF, PSF_QF, short, psf coverage/quality factor 41 42 # Pan-STARRS uses a 64-bit detection ID. keep this in two 32 bit ints for backwards compatibility? 43 FIELD detID_hi, DET_ID_HI, unsigned int, ID upper bytes 44 FIELD detID_lo, DET_ID_LO, unsigned int, ID lower bytes 45 46 FIELD imageID_hi, IMAGE_ID_HI, unsigned int, reference to image 47 FIELD imageID_lo, IMAGE_ID_LO, unsigned int, reference to image 48 49 # note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation 50 FIELD az, AZ, float, telescope azimuth 51 52 # we need extra bytes for padding purposes... 53 FIELD dummy, dummy, char[2], padding -
trunk/Ohana/src/libautocode/def/photcode.d
r6454 r12332 2 2 EXTNAME DVO_PHOTCODE 3 3 TYPE BINTABLE 4 SIZE 774 SIZE 80 5 5 DESCRIPTION DVO Photcode Description Table 6 6 … … 9 9 FIELD name, NAME, char[32], name for filter combination 10 10 FIELD type, TYPE, char, PRI/SEC/DEP/REF 11 FIELD dummy, DUMMY, char[3], padding 11 12 FIELD C, C_LAM, short, primary phot calibration terms (millimags) 12 13 FIELD dC, C_LAM_ERR, short, primary phot calibration terms (millimags) -
trunk/Ohana/src/libautocode/def/secfilt.d
r6454 r12332 2 2 EXTNAME DVO_SECFILT 3 3 TYPE BINTABLE 4 SIZE 1 24 SIZE 16 5 5 DESCRIPTION DVO SecFilt : Secondary Filter Data 6 6 7 7 # elements of data structure / FITS table 8 FIELD M _PS,MAG, float, other mags, mags9 FIELD dM _PS,MAG_ERR, float, scatter on mag, mags8 FIELD M, MAG, float, other mags, mags 9 FIELD dM, MAG_ERR, float, scatter on mag, mags 10 10 FIELD Xm, MAG_CHI, short, chisq on mag, [100*log(value)] 11 FIELD Ncode, NCODE, short, number of detections in band 12 FIELD Nused, NUSED, short, number of detections used in average 11 13 FIELD dummy, JUNK, short, place holder -
trunk/Ohana/src/libdvo/Makefile
r11880 r12332 29 29 $(SRC)/version.$(ARCH).o \ 30 30 $(SRC)/coordops.$(ARCH).o \ 31 $(SRC)/dvo_photcode_ops.$(ARCH).o \ 31 32 $(SRC)/LoadPhotcodes.$(ARCH).o \ 33 $(SRC)/LoadPhotcodesText.$(ARCH).o \ 34 $(SRC)/LoadPhotcodesFITS.$(ARCH).o \ 35 $(SRC)/SavePhotcodesText.$(ARCH).o \ 36 $(SRC)/SavePhotcodesFITS.$(ARCH).o \ 32 37 $(SRC)/imreg_datatypes.$(ARCH).o \ 33 38 $(SRC)/mosaic_astrom.$(ARCH).o \ … … 41 46 $(SRC)/dvo_catalog_split.$(ARCH).o \ 42 47 $(SRC)/dvo_catalog_create.$(ARCH).o \ 48 $(SRC)/dvo_catalog_chipcoords.$(ARCH).o \ 43 49 $(SRC)/dvo_convert.$(ARCH).o \ 44 50 $(SRC)/dvo_convert_elixir.$(ARCH).o \ 45 51 $(SRC)/dvo_convert_loneos.$(ARCH).o \ 46 $(SRC)/dvo_convert_panstarrs.$(ARCH).o \ 47 $(SRC)/dvo_convert_pmtest.$(ARCH).o \ 52 $(SRC)/dvo_convert_panstarrs_DEV_0.$(ARCH).o \ 48 53 $(SRC)/skyregion_io.$(ARCH).o \ 49 54 $(SRC)/skyregion_gsc.$(ARCH).o \ 50 55 $(SRC)/skyregion_ops.$(ARCH).o 56 57 # $(SRC)/dvo_convert_panstarrs.$(ARCH).o \ 58 # $(SRC)/dvo_convert_pmtest.$(ARCH).o \ 51 59 52 60 include ../libautocode/Makefile.Targets -
trunk/Ohana/src/libdvo/doc/dvo-structures.txt
r11991 r12332 1 2 2007.02.22 3 4 I have several DVO improvements to implement. I need to plan them a 5 bit carefully. Here are my thoughts on these updates. 6 7 - add chip X,Y to measure table 8 9 this is a fairly simple addition. In addstar/find_matches, I just need 10 to assign the X,Y value from the incoming star data. For loading 11 old catalogs which don't include X,Y in the table, I need to 12 calculate the X,Y position based on the R,D after finding the 13 matching image. I have code to do this calculation currently in 14 dvo/photometry.c for looking up X,Y on the fly. once this is moved 15 into the load functions, it will not be needed in photometry.c 16 17 - remove PRI/SEC and only use secfilt table for mags 18 19 this is not a very difficult change, conceptually, but it may be a 20 fair amount of work. all of the functions which currently switch on 21 the case of PRI/SEC just need to look in the secfilt location. the 22 value of Nsec needs to increase by 1. the load from tables which 23 used PRI/SEC need to move the PRI values to the correct location in 24 secfilt 25 26 eventually, rename 'secfilt' to a better name choice 27 28 - add image, average, measure IDs 29 30 for PS1, the image and measure need to be generated by the external 31 software. they would just be part of the input stream. for the 32 case were the IDs are not supplied, DVO needs to generate them in a 33 unique way. I probably need to understand / define that mechanism 34 before tackling this problem. 35 36 one point: I need to keep the old averef index. how do this index 37 and the objID work together? 38 39 - link measure to image 40 41 temporariliy use an index like averef? 42 43 - move photcode table to catdir (also zero points) 44 45 should be fairly easy: just like the SkyTable, look in the catdir 46 first, then generate from the default text table if it is missing. 47 48 - color term as a function of mosaic position 49 50 - mextract field,field,field 51 52 this should not be a very difficult job. just add a loop to the 53 avextract / mextract functions. 54 55 - mextract field(s) where condition 56 57 this is a bit trickier, and could make use of the code in the dvo 58 math functions 59 60 - dvo select from mysql 61 62 not very difficult: need to define the commands to select the 63 database and set up a connection, then parse the select line into 64 the appropriate format. just need to as the db for the type of the 65 fields that are requested: must be numerical. 66 67 select field,field,field from table where condition 68 69 - change vectors to doubles 70 71 probably not a terrible job. this will depend on how the union is 72 defined. I don't want this to explode the size of an image! 73 74 --------- 1 75 2 76 I now have the ability to load and save DVO databases in old formats, … … 12 86 - CFHT Elixir databases: cmp files, ELIXIR format 13 87 - Brandon's Taurus db: incorrect 'PANSTARRS' format, should be called 14 'PSTEST1' 88 'PSTEST1'. drop support for this eventually? have brandon migrate to 89 the new panstarrs formats? 15 90 16 91 I am going to use the following naming convention for future db table 17 92 updates: 18 93 19 - PANSTARRS.DEV.0 94 - PANSTARRS.DEV.0, PANSTARRS.DEV.1, etc 20 95 - PANSTARRS.PS1.0, PANSTARRS.PS1.1, etc 21 96 - PANSTARRS.PS4.0, PANSTARRS.PS4.1, etc -
trunk/Ohana/src/libdvo/include/dvo.h
r10931 r12332 18 18 19 19 /* DVO table formats */ 20 enum {DVO_FORMAT_UNDEF, DVO_FORMAT_INTERNAL, DVO_FORMAT_ELIXIR, DVO_FORMAT_LONEOS, DVO_FORMAT_PANSTARRS, DVO_FORMAT_PMTEST} DVOTableFormat; 20 enum {DVO_FORMAT_UNDEF, 21 DVO_FORMAT_INTERNAL, 22 DVO_FORMAT_ELIXIR, 23 DVO_FORMAT_LONEOS, 24 DVO_FORMAT_PANSTARRS, 25 DVO_FORMAT_PMTEST, 26 DVO_FORMAT_PANSTARRS_DEV_0 27 } DVOTableFormat; 21 28 22 29 /* image data modes in RegImage */ 23 30 enum {T_UNDEF = -1, T_NONE, T_OBJECT, T_DARK, T_BIAS, T_FLAT, T_MASK, T_FRINGE, T_SCATTER, T_MODES, T_FRINGEPTS, T_ANY, N_TYPE}; 24 31 enum {M_UNDEF = -1, M_NONE, M_MEF, M_SPLIT, M_SINGLE, M_CUBE, M_SLICE, M_MODES, N_MODE}; 32 33 typedef enum { 34 PROJ_NONE, // undefined 35 PROJ_ZEA, // zenithal 36 PROJ_ZPL, // zenithal 37 PROJ_ARC, // zenithal 38 PROJ_STG, // zenithal 39 PROJ_SIN, // zenithal 40 PROJ_TAN, // zenithal 41 PROJ_DIS, // zenithal (TAN + polyterms) 42 PROJ_LIN, // cartesian 43 PROJ_PLY, // cartesian 44 PROJ_WRP, // cartesian 45 PROJ_AIT, // pseudocyl 46 PROJ_GLS, // pseudocyl 47 PROJ_PAR, // pseudocyl 48 } OhanaProjection; 49 50 typedef enum { 51 PROJ_MODE_NONE, 52 PROJ_MODE_CARTESIAN, 53 PROJ_MODE_ZENITHAL, 54 PROJ_MODE_PSEUDOCYL, 55 } OhanaProjectionMode; 25 56 26 57 /* RegImage.flag values */ … … 39 70 40 71 /* photometry code types */ 41 # define PHOT_PRI 0x0172 // # define PHOT_PRI 0x01 42 73 # define PHOT_SEC 0x02 43 74 # define PHOT_DEP 0x03 … … 133 164 134 165 typedef struct { 135 int Ncode; 136 int Nsecfilt; 137 int hashcode[0x10000]; 138 int hashNsec[0x10000]; 166 int Ncode; // number of photcodes 167 int Nsecfilt; // number of average magnitudes 168 int hashcode[0x10000]; // index from photcode value to sequence 169 int hashNsec[0x10000]; // index from photcode value to Nsec seq 170 int codeNsec[0x10000]; // index from Nsec seq to photcode value 139 171 PhotCode *code; 140 172 } PhotCodeData; … … 191 223 192 224 /* in coords.c, using libautocode/def/coords.d */ 225 int XY_to_LM (double *L, double *M, double x, double y, Coords *coords); 226 int LM_to_XY (double *x, double *y, double L, double M, Coords *coords); 227 int RD_to_LM (double *L, double *M, double ra, double dec, Coords *coords); 228 int LM_to_RD (double *ra, double *dec, double L, double M, Coords *coords); 193 229 int XY_to_RD (double *ra, double *dec, double x, double y, Coords *coords); 194 230 int RD_to_XY (double *x, double *y, double ra, double dec, Coords *coords); … … 199 235 void RegisterMosaic (Coords *coords); 200 236 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch); 237 OhanaProjection GetProjection (char *ctype); 238 int SetProjection (char *ctype, OhanaProjection proj); 239 OhanaProjectionMode GetProjectionMode (OhanaProjection proj); 201 240 202 241 char *libdvo_version (); … … 232 271 float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt); 233 272 234 # if (0) 235 short iPhotInst (Measure *measure); 236 short iPhotAbs (Measure *measure); 237 short iPhotCat (Measure *measure); 238 short iPhotSys (Measure *measure, Average *average, SecFilt *secfilt); 239 short iPhotRel (Measure *measure, Average *average, SecFilt *secfilt); 240 short iPhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code); 241 short iPhotAve (PhotCode *code, Average *average, SecFilt *secfilt); 242 short iPhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure); 243 short iPhotXm (PhotCode *code, Average *average, SecFilt *secfilt); 244 short iPhotdM (PhotCode *code, Average *average, SecFilt *secfilt); 245 # endif 246 247 float iPhotColor (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code); 273 float PhotColorForCode (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code); 248 274 int PhotColor (Average *average, SecFilt *secfilt, Measure *measure, int c1, int c2, double *color); 249 275 250 int LoadPhotcodes (char *filename); 276 PhotCodeData *GetPhotcodeTable (); 277 278 int LoadPhotcodes (char *catdir_file, char *master_file); 279 int LoadPhotcodesText (char *filename); 280 int LoadPhotcodesFITS (char *filename); 281 int SavePhotcodesText (char *filename); 282 int SavePhotcodesFITS (char *filename); 283 284 void PrintPhotcodeNamebyCode (FILE *f, char *format, int code); 285 251 286 int GetPhotcodeCodebyName (char *name); 252 287 int GetPhotcodeEquivCodebyName (char *name); … … 297 332 298 333 /*** conversion functions / I/O conversions ***/ 299 Average *ReadRawAverage (FILE *f, int Naverage, int format );334 Average *ReadRawAverage (FILE *f, int Naverage, int format, SecFilt **primary); 300 335 Measure *ReadRawMeasure (FILE *f, int Nmeasure, int format); 301 336 SecFilt *ReadRawSecFilt (FILE *f, int Nsecfilt, int format); 302 int WriteRawAverage (FILE *f, Average *average, int Naverage, int format );337 int WriteRawAverage (FILE *f, Average *average, int Naverage, int format, SecFilt *primary); 303 338 int WriteRawMeasure (FILE *f, Measure *measure, int Nmeasure, int format); 304 339 int WriteRawSecFilt (FILE *f, SecFilt *secfilt, int Nsecfilt, int format); 305 340 306 Average *FtableToAverage (FTable *ftable, int *Naverage, int *format); 307 Average *AverageLoneosToInternal (AverageLoneos *in, int Nvalues); 308 Average *AverageElixirToInternal (AverageElixir *in, int Nvalues); 309 Average *AveragePanstarrsToInternal (AveragePanstarrs *in, int Nvalues); 310 Average *AveragePMtestToInternal (AveragePMtest *in, int Nvalues); 311 AverageLoneos *AverageInternalToLoneos (Average *in, int Nvalues); 312 AverageElixir *AverageInternalToElixir (Average *in, int Nvalues); 313 AveragePanstarrs *AverageInternalToPanstarrs (Average *in, int Nvalues); 314 AveragePMtest *AverageInternalToPMtest (Average *in, int Nvalues); 315 341 Average *FtableToAverage (FTable *ftable, int *Naverage, int *format, SecFilt **primary); 316 342 Measure *FtableToMeasure (FTable *ftable, int *Nmeasure, int *format); 317 Measure *MeasureLoneosToInternal (MeasureLoneos *in, int Nvalues);318 Measure *MeasureElixirToInternal (MeasureElixir *in, int Nvalues);319 Measure *MeasurePanstarrsToInternal (MeasurePanstarrs *in, int Nvalues);320 MeasureLoneos *MeasureInternalToLoneos (Measure *in, int Nvalues);321 MeasureElixir *MeasureInternalToElixir (Measure *in, int Nvalues);322 MeasurePanstarrs *MeasureInternalToPanstarrs (Measure *in, int Nvalues);323 324 343 SecFilt *FtableToSecFilt (FTable *ftable, int *Nsecfilt, int *format); 325 SecFilt *SecFiltLoneosToInternal (SecFiltLoneos *in, int Nvalues); 326 SecFilt *SecFiltElixirToInternal (SecFiltElixir *in, int Nvalues); 327 SecFilt *SecFiltPanstarrsToInternal (SecFiltPanstarrs *in, int Nvalues); 328 SecFiltLoneos *SecFiltInternalToLoneos (SecFilt *in, int Nvalues); 329 SecFiltElixir *SecFiltInternalToElixir (SecFilt *in, int Nvalues); 330 SecFiltPanstarrs *SecFiltInternalToPanstarrs (SecFilt *in, int Nvalues); 331 332 int AverageToFtable (FTable *ftable, Average *average, int Naverage, int format); 344 int FtableToImage (FTable *ftable, Header *theader, int *format); 345 346 int AverageToFtable (FTable *ftable, Average *average, int Naverage, int format, SecFilt *primary); 333 347 int MeasureToFtable (FTable *ftable, Measure *measure, int Nmeasure, int format); 334 348 int SecFiltToFtable (FTable *ftable, SecFilt *secfilt, int Nsecfilt, int format); 349 int ImageToFtable (FTable *ftable, Header *theader, int format); 350 int ImageToVtable (VTable *vtable, Header *theader, int format); 351 352 Image *ImageElixirToInternal (ImageElixir *in, int Nvalues); 353 Image *ImageLoneosToInternal (ImageLoneos *in, int Nvalues); 354 Image *ImagePanstarrsToInternal (ImagePanstarrs *in, int Nvalues); 355 Image *ImagePanstarrs_DEV_0_ToInternal (ImagePanstarrs_DEV_0 *in, int Nvalues); 356 357 ImageElixir *ImageInternalToElixir (Image *in, int Nvalues); 358 ImageLoneos *ImageInternalToLoneos (Image *in, int Nvalues); 359 ImagePanstarrs *ImageInternalToPanstarrs (Image *in, int Nvalues); 360 ImagePanstarrs_DEV_0 *ImageInternalToPanstarrs_DEV_0 (Image *in, int Nvalues); 361 362 Average *AverageLoneosToInternal (AverageLoneos *in, int Nvalues, SecFilt **primary); 363 Average *AverageElixirToInternal (AverageElixir *in, int Nvalues, SecFilt **primary); 364 Average *AveragePanstarrsToInternal (AveragePanstarrs *in, int Nvalues); 365 Average *AveragePanstarrs_DEV_0_ToInternal (AveragePanstarrs_DEV_0 *in, int Nvalues); 366 367 AverageLoneos *AverageInternalToLoneos (Average *in, int Nvalues, SecFilt *primary); 368 AverageElixir *AverageInternalToElixir (Average *in, int Nvalues, SecFilt *primary); 369 AveragePanstarrs *AverageInternalToPanstarrs (Average *in, int Nvalues); 370 AveragePanstarrs_DEV_0 *AverageInternalToPanstarrs_DEV_0 (Average *in, int Nvalues); 371 372 Measure *MeasureLoneosToInternal (MeasureLoneos *in, int Nvalues); 373 Measure *MeasureElixirToInternal (MeasureElixir *in, int Nvalues); 374 Measure *MeasurePanstarrsToInternal (MeasurePanstarrs *in, int Nvalues); 375 Measure *MeasurePanstarrs_DEV_0_ToInternal (MeasurePanstarrs_DEV_0 *in, int Nvalues); 376 377 MeasureLoneos *MeasureInternalToLoneos (Measure *in, int Nvalues); 378 MeasureElixir *MeasureInternalToElixir (Measure *in, int Nvalues); 379 MeasurePanstarrs *MeasureInternalToPanstarrs (Measure *in, int Nvalues); 380 MeasurePanstarrs_DEV_0 *MeasureInternalToPanstarrs_DEV_0 (Measure *in, int Nvalues); 381 382 SecFilt *SecFiltLoneosToInternal (SecFiltLoneos *in, int Nvalues); 383 SecFilt *SecFiltElixirToInternal (SecFiltElixir *in, int Nvalues); 384 SecFilt *SecFiltPanstarrsToInternal (SecFiltPanstarrs *in, int Nvalues); 385 SecFilt *SecFiltPanstarrs_DEV_0_ToInternal (SecFiltPanstarrs_DEV_0 *in, int Nvalues); 386 387 SecFiltLoneos *SecFiltInternalToLoneos (SecFilt *in, int Nvalues); 388 SecFiltElixir *SecFiltInternalToElixir (SecFilt *in, int Nvalues); 389 SecFiltPanstarrs *SecFiltInternalToPanstarrs (SecFilt *in, int Nvalues); 390 SecFiltPanstarrs_DEV_0 *SecFiltInternalToPanstarrs_DEV_0 (SecFilt *in, int Nvalues); 335 391 336 392 /*** DVO image db I/O Functions ***/ … … 345 401 int dvo_image_addrows (FITS_DB *db, Image *new, int Nnew); 346 402 void dvo_image_create (FITS_DB *db, double ZeroPoint); 347 348 int FtableToImage (FTable *ftable, Header *theader, int *format);349 int ImageToFtable (FTable *ftable, Header *theader, int format);350 int ImageToVtable (VTable *vtable, Header *theader, int format);351 Image *ImageElixirToInternal (ImageElixir *in, int Nvalues);352 ImageElixir *ImageInternalToElixir (Image *in, int Nvalues);353 Image *ImageLoneosToInternal (ImageLoneos *in, int Nvalues);354 ImageLoneos *ImageInternalToLoneos (Image *in, int Nvalues);355 Image *ImagePanstarrsToInternal (ImagePanstarrs *in, int Nvalues);356 ImagePanstarrs *ImageInternalToPanstarrs (Image *in, int Nvalues);357 403 358 404 /* skyregion APIs */ -
trunk/Ohana/src/libdvo/src/LoadPhotcodes.c
r9631 r12332 1 1 # include <dvo.h> 2 2 3 # define NCTERMS 4 4 # define F_PS 0.001 5 # define NO_MAG_PS 100.0 3 int LoadPhotcodes (char *catdir_file, char *master_file) { 6 4 7 static PhotCodeData *photcodes = NULL; 8 static double ZERO_POINT; 9 static short int Nseclist[0x10000]; 10 11 /* static short int iZERO_POINT; */ 12 13 void SetZeroPoint (double ZP) { 14 ZERO_POINT = ZP; 15 /* iZERO_POINT = 1000 * ZP; */ 16 } 17 18 int LoadPhotcodes (char *filename) { 5 /* first try to load the photcodes from the specified CATDIR location */ 6 if (LoadPhotcodesFITS (catdir_file)) return TRUE; 19 7 20 FILE *f; 21 int i, Ns, Np, NPHOTCODE, Npri, Nfield; 22 PhotCode *photcode; 23 int code; 24 char *c; 25 char line[256]; 26 char name[32], type[32], Zero[32], Airmass[32], Offset[32], 27 C1[32], C2[32], Slope[32], Color[32], Primary[32]; 28 int c1, c2; 29 30 /* allocate space to photcode table, free existing data */ 31 if (photcodes == NULL) { 32 ALLOCATE (photcodes, PhotCodeData, 1); 33 photcodes[0].code = NULL; 34 } 35 if (photcodes[0].code != NULL) free (photcodes[0].code); 36 37 f = fopen (filename, "r"); 38 if (f == (FILE *) NULL) { 39 photcodes[0].Ncode = 0; 40 photcodes[0].Nsecfilt = 0; 41 photcodes[0].code = (PhotCode *) NULL; 42 return (FALSE); 8 /* next try to load the photcodes from the master text photcode file */ 9 /* automatically (or on demand?) save the text file to the FITS version */ 10 if (LoadPhotcodesText (master_file)) { 11 if (!check_file_access (catdir_file, TRUE, TRUE)) return TRUE; 12 SavePhotcodesFITS (catdir_file); 13 return TRUE; 43 14 } 44 15 45 Np = 0; 46 NPHOTCODE = 10; 47 ALLOCATE (photcode, PhotCode, NPHOTCODE); 48 photcodes[0].Nsecfilt = 0; 49 for (i = 0; i < 0x10000; i++) { 50 photcodes[0].hashcode[i] = -1; 51 photcodes[0].hashNsec[i] = -1; 52 } 53 54 while (scan_line (f, line) != EOF) { 55 for (c = line; isspace (*c); c++); 56 if (*c == '#') continue; 57 Nfield = sscanf (c, "%d %s %s %s %s %s %s %s %s %s %s", 58 &code, name, type, Zero, Airmass, Offset, C1, C2, Slope, Color, Primary); 59 if (Nfield != 11) { continue; } 60 61 c1 = atof (C1); 62 c2 = atof (C2); 63 if (!strcmp (C1, "-")) { c1 = 0; } 64 if (!strcmp (C2, "-")) { c2 = 0; } 65 66 photcode[Np].type = 0; 67 photcode[Np].code = code; 68 strcpy (photcode[Np].name, name); 69 if (!strncasecmp (type, "pri", 3)) { 70 photcode[Np].type = PHOT_PRI; 71 photcode[Np].C = 1000*atof (Zero); 72 photcode[Np].K = atof (Airmass); 73 photcode[Np].dC = 1000*atof (Offset); 74 photcode[Np].dX = 1000*atof (Color); 75 photcode[Np].c1 = c1; 76 photcode[Np].c2 = c2; 77 photcode[Np].equiv = atoi (Primary); 78 ParseColorTerms (Slope, photcode[Np].X, &photcode[Np].Nc); 79 Nseclist[0] = Np; 80 } 81 if (!strncasecmp (type, "sec", 3)) { 82 photcode[Np].type = PHOT_SEC; 83 photcode[Np].C = 1000*atof (Zero); 84 photcode[Np].K = atof (Airmass); 85 photcode[Np].dC = 1000*atof (Offset); 86 photcode[Np].dX = 1000*atof (Color); 87 photcode[Np].c1 = c1; 88 photcode[Np].c2 = c2; 89 photcode[Np].equiv = atoi (Primary); 90 photcodes[0].Nsecfilt ++; 91 ParseColorTerms (Slope, photcode[Np].X, &photcode[Np].Nc); 92 Nseclist[photcodes[0].Nsecfilt] = Np; 93 } 94 if (!strncasecmp (type, "dep", 3)) { 95 photcode[Np].type = PHOT_DEP; 96 photcode[Np].C = 1000*atof (Zero); /* zero point in millimags */ 97 photcode[Np].K = atof (Airmass); /* airmass coeff (millimag / millimag) */ 98 photcode[Np].dC = 1000*atof (Offset); /* color ref z.p. (millimag) */ 99 photcode[Np].dX = 1000*atof (Color); /* average color (millimag) */ 100 photcode[Np].c1 = c1; 101 photcode[Np].c2 = c2; 102 photcode[Np].equiv = atoi (Primary); 103 ParseColorTerms (Slope, photcode[Np].X, &photcode[Np].Nc); 104 } 105 if (!strncasecmp (type, "ref", 3)) { 106 photcode[Np].type = PHOT_REF; 107 photcode[Np].C = 0; 108 photcode[Np].K = 0; 109 photcode[Np].dC = 0; 110 photcode[Np].dX = 0; 111 photcode[Np].c1 = 0; 112 photcode[Np].c2 = 0; 113 photcode[Np].equiv = atoi (Primary); 114 photcode[Np].X[0] = 0; 115 photcode[Np].Nc = 0; 116 } 117 118 /* alt photcodes are a little different: they have the SAME photcode as an existing 119 pri/sec photcode, but define an alternate transformation for that code */ 120 if (!strncasecmp (type, "alt", 3)) { 121 photcode[Np].type = PHOT_ALT; 122 photcode[Np].C = 1000*atof (Zero); /* zero point in millimags */ 123 photcode[Np].K = atof (Airmass); /* airmass coeff (millimag / millimag) */ 124 photcode[Np].dC = 1000*atof (Offset); /* color ref z.p. (millimag) */ 125 photcode[Np].dX = 1000*atof (Color); /* average color (millimag) */ 126 photcode[Np].c1 = c1; 127 photcode[Np].c2 = c2; 128 photcode[Np].equiv = atoi (Primary); 129 ParseColorTerms (Slope, photcode[Np].X, &photcode[Np].Nc); 130 } 131 if (!photcode[Np].type) { 132 fprintf (stderr, "error in Photfile: unknown type %s\n", type); 133 } 134 135 Np++; 136 if (Np == NPHOTCODE) { 137 NPHOTCODE += 10; 138 REALLOCATE (photcode, PhotCode, NPHOTCODE); 139 } 140 } 141 fclose (f); 142 143 /* set up hashcode for photcode refs: 144 * the hashcode gives the structure sequence for a given photcode: 145 * photcode[i].hashcode[photcode[i].code] == i 146 */ 147 148 Ns = 0; 149 for (i = 0; i < Np; i++) { 150 if (photcode[i].type == PHOT_ALT) continue; /* no hashcode for ALT codes */ 151 if (photcodes[0].hashcode[photcode[i].code] != -1) { 152 fprintf (stderr, "duplicate photcodes in file\n"); 153 code = photcodes[0].hashcode[photcode[i].code]; 154 fprintf (stderr, "conflict between %s (%d) and %s (%d)\n", 155 photcode[i].name, photcode[i].code, photcode[code].name, photcode[code].code); 156 free (photcode); 157 return (FALSE); 158 } 159 photcodes[0].hashcode[photcode[i].code] = i; 160 if (photcode[i].type == PHOT_SEC) { 161 photcodes[0].hashNsec[photcode[i].code] = Ns; 162 Ns ++; 163 } 164 } 165 /* validity check for references */ 166 for (i = 0; i < Np; i++) { 167 if (photcode[i].type == PHOT_DEP) { 168 Npri = photcodes[0].hashcode[photcode[i].equiv]; 169 if ((Npri >= Np) || (Npri < 0)) { 170 fprintf (stderr, "reference for dependent photcode is not in photcodes\n"); 171 free (photcode); 172 return (FALSE); 173 } 174 if ((photcode[Npri].type != PHOT_PRI) && (photcode[Npri].type != PHOT_SEC)) { 175 fprintf (stderr, "reference for dependent photcode is not a primary or secondary code\n"); 176 free (photcode); 177 return (FALSE); 178 } 179 } 180 if (photcode[i].type == PHOT_ALT) { 181 Npri = photcodes[0].hashcode[photcode[i].code]; 182 if ((Npri >= Np) || (Npri < 0)) { 183 fprintf (stderr, "reference for alternate photcode is not in photcodes\n"); 184 free (photcode); 185 return (FALSE); 186 } 187 if ((photcode[Npri].type != PHOT_PRI) && (photcode[Npri].type != PHOT_SEC)) { 188 fprintf (stderr, "reference for alternate photcode is not a primary or secondary code\n"); 189 free (photcode); 190 return (FALSE); 191 } 192 } 193 } 194 photcodes[0].code = photcode; 195 photcodes[0].Ncode = Np; 196 197 return (TRUE); 198 16 return FALSE; 199 17 } 200 201 void ParseColorTerms (char *terms, float *X, int *N) {202 203 int i;204 char *p;205 206 p = terms;207 208 for (i = 0; (p != NULL) && (i < NCTERMS); i++) {209 X[i] = atof (p);210 p = strchr (p, ',');211 if (p == (char *) NULL) continue;212 p ++;213 }214 *N = i;215 }216 217 /********** photcode lookups **********/218 219 /* return photcode for given name */220 PhotCode *GetPhotcodebyName (char *name) {221 222 int i;223 224 if (name == (char *) NULL ) return (NULL);225 226 for (i = 0; i < photcodes[0].Ncode; i++) {227 if (!strcmp (photcodes[0].code[i].name, name)) {228 return (&photcodes[0].code[i]);229 }230 }231 return (NULL);232 }233 /* return photcode.code for given name */234 int GetPhotcodeCodebyName (char *name) {235 236 int i;237 238 if (name == (char *) NULL ) return (0);239 240 for (i = 0; i < photcodes[0].Ncode; i++) {241 if (!strcmp (photcodes[0].code[i].name, name)) {242 return (photcodes[0].code[i].code);243 }244 }245 return (0);246 }247 /* return equivalent photcode for given name */248 PhotCode *GetPhotcodeEquivbyName (char *name) {249 250 int i, equiv;251 252 if (name == (char *) NULL ) return (NULL);253 254 for (i = 0; i < photcodes[0].Ncode; i++) {255 if (!strcmp (photcodes[0].code[i].name, name)) {256 if (photcodes[0].code[i].equiv == 0) return (NULL);257 equiv = photcodes[0].hashcode[photcodes[0].code[i].equiv];258 if (equiv == -1) return (NULL);259 return (&photcodes[0].code[equiv]);260 }261 }262 return (NULL);263 }264 /* return equivalent photcode.code for given name */265 int GetPhotcodeEquivCodebyName (char *name) {266 267 int i, equiv;268 269 if (name == (char *) NULL ) return (0);270 271 for (i = 0; i < photcodes[0].Ncode; i++) {272 if (!strcmp (photcodes[0].code[i].name, name)) {273 if (photcodes[0].code[i].equiv == 0) return (0);274 equiv = photcodes[0].hashcode[photcodes[0].code[i].equiv];275 if (equiv == -1) return (0);276 return (photcodes[0].code[equiv].code);277 }278 }279 return (0);280 }281 282 /* return photcode for given code */283 PhotCode *GetPhotcodebyCode (int code) {284 285 int entry;286 287 if (code < 0) return (NULL);288 if (code > 0x10000) return (NULL);289 290 entry = photcodes[0].hashcode[code];291 if (entry == -1) return (NULL);292 293 return (&photcodes[0].code[entry]);294 }295 /* return photcode.code for given code */296 char *GetPhotcodeNamebyCode (int code) {297 298 int entry;299 300 if (code < 0) return (NULL);301 if (code > 0x10000) return (NULL);302 303 entry = photcodes[0].hashcode[code];304 if (entry == -1) return (NULL);305 306 return (photcodes[0].code[entry].name);307 }308 /* return equivalent photcode for given code */309 PhotCode *GetPhotcodeEquivbyCode (int code) {310 311 int entry, equiv;312 313 if (code < 0) return (NULL);314 if (code > 0x10000) return (NULL);315 316 entry = photcodes[0].hashcode[code];317 if (entry == -1) return (NULL);318 319 if (photcodes[0].code[entry].equiv == 0) return (NULL);320 equiv = photcodes[0].hashcode[photcodes[0].code[entry].equiv];321 322 if (equiv == -1) return (NULL);323 return (&photcodes[0].code[equiv]);324 }325 /* return equivalent photcode.code for given code */326 int GetPhotcodeEquivCodebyCode (int code) {327 328 int entry;329 330 if (code < 0) return (0);331 if (code > 0x10000) return (0);332 333 entry = photcodes[0].hashcode[code];334 if (entry == -1) return (0);335 return (photcodes[0].code[entry].equiv);336 }337 338 int GetPhotcodeNsec (int code) {339 340 int Nsec;341 342 if (code < 0) return (-1);343 if (code > 0x10000) return (-1);344 345 Nsec = photcodes[0].hashNsec[code];346 return (Nsec);347 }348 349 /* Nsec of 0 is PRI */350 PhotCode *GetPhotcodebyNsec (int Nsec) {351 352 if (Nsec > photcodes[0].Nsecfilt) return (NULL);353 if (Nsec < 0) return (NULL);354 355 return (&photcodes[0].code[Nseclist[Nsec]]);356 }357 358 int GetPhotcodeNsecfilt () {359 return (photcodes[0].Nsecfilt);360 }361 362 /* ALLOCATE and return list of all photcodes363 with photcode.equiv == code */364 int *GetPhotcodeEquivList (int code, int *nlist) {365 366 int i, Nlist;367 int *list;368 369 ALLOCATE (list, int, MAX (1, photcodes[0].Ncode));370 Nlist = 0;371 for (i = 0; i < photcodes[0].Ncode; i++) {372 if (photcodes[0].code[i].equiv != code) continue;373 list[Nlist] = photcodes[0].code[i].code;374 Nlist ++;375 }376 REALLOCATE (list, int, MAX (1, Nlist));377 378 *nlist = Nlist;379 return (list);380 }381 382 /**** conversion to INTERNAL vs TABLE types makes the iPhot versions irrelevant ****/383 # if (0)384 /******** photometry conversions *********/385 double PhotInst (Measure *measure) {386 387 short Mi;388 double M;389 390 Mi = iPhotInst (measure);391 M = 0.001*Mi;392 return (M);393 }394 395 /****/396 double PhotCat (Measure *measure) {397 398 short Mi;399 double M;400 401 Mi = iPhotCat (measure);402 M = 0.001*Mi;403 return (M);404 }405 406 /****/407 double PhotSys (Measure *measure, Average *average, SecFilt *secfilt) {408 409 short Mi;410 double M;411 412 Mi = iPhotSys (measure, average, secfilt);413 M = 0.001*Mi;414 return (M);415 }416 417 /****/418 double PhotRel (Measure *measure, Average *average, SecFilt *secfilt) {419 420 short Mi;421 double M;422 423 Mi = iPhotRel (measure, average, secfilt);424 M = 0.001*Mi;425 return (M);426 }427 428 /****/429 double PhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {430 431 short Mi;432 double M;433 434 Mi = iPhotCal (thisone, average, secfilt, measure, code);435 M = 0.001*Mi;436 return (M);437 }438 439 /****/440 double PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure) {441 442 short Mi;443 double M;444 445 Mi = iPhotRef (code, average, secfilt, measure);446 M = 0.001*Mi;447 return (M);448 }449 450 /****/451 double PhotAve (PhotCode *code, Average *average, SecFilt *secfilt) {452 453 short Mi;454 double M;455 456 Mi = iPhotAve (code, average, secfilt);457 M = 0.001*Mi;458 return (M);459 }460 461 /****/462 double PhotdM (PhotCode *code, Average *average, SecFilt *secfilt) {463 464 short Mi;465 double M;466 467 Mi = iPhotdM (code, average, secfilt);468 M = 0.001*Mi;469 return (M);470 }471 472 /****/473 double PhotXm (PhotCode *code, Average *average, SecFilt *secfilt) {474 475 int Mi;476 double Xm;477 478 Mi = iPhotXm (code, average, secfilt);479 Xm = (Mi == NO_MAG) ? -1.0 : pow (10.0, 0.01*Mi);480 return (Xm);481 }482 483 # endif484 485 /******** internal photometry conversions (keeps values in short int millimags) *********/486 float PhotInst (Measure *measure) {487 488 int Np;489 float M;490 491 Np = photcodes[0].hashcode[measure[0].source];492 if (Np == -1) return (NO_MAG_PS);493 494 if (photcodes[0].code[Np].type == PHOT_REF) {495 M = measure[0].M_PS;496 return (M);497 }498 499 M = measure[0].M_PS - measure[0].dt_PS - ZERO_POINT;500 501 return (M);502 503 }504 505 float PhotCat (Measure *measure) {506 507 int Np;508 float Mcat;509 PhotCode *code;510 511 Np = photcodes[0].hashcode[measure[0].source];512 if (Np == -1) return (NO_MAG_PS);513 514 if (photcodes[0].code[Np].type == PHOT_REF) {515 Mcat = measure[0].M_PS;516 return (Mcat);517 }518 code = &photcodes[0].code[Np];519 Mcat = measure[0].M_PS - ZERO_POINT + code[0].K*(measure[0].airmass_PS - 1.000) + F_PS*code[0].C;520 521 return (Mcat);522 }523 524 float PhotSys (Measure *measure, Average *average, SecFilt *secfilt) {525 526 int i, Np;527 float Mcat, Mcol, Msys, mc, Mc;528 PhotCode *code;529 530 Np = photcodes[0].hashcode[measure[0].source];531 if (Np == -1) return (NO_MAG_PS);532 533 if (photcodes[0].code[Np].type == PHOT_REF) {534 Msys = measure[0].M_PS;535 return (Msys);536 }537 code = &photcodes[0].code[Np];538 Mcat = measure[0].M_PS - ZERO_POINT + code[0].K*(measure[0].airmass_PS - 1.000) + F_PS*code[0].C;539 540 /* for DEP, color must be made of PRI/SEC */541 mc = iPhotColor (average, secfilt, NULL, code);542 if (mc == NO_MAG_PS) return (Mcat);543 mc = mc - F_PS*code[0].dX;544 545 Mc = mc;546 Mcol = 0;547 for (i = 0; i < code[0].Nc; i++) {548 Mcol += code[0].X[i]*Mc;549 Mc *= mc;550 }551 Msys = Mcat + Mcol;552 return (Msys);553 }554 555 float PhotRel (Measure *measure, Average *average, SecFilt *secfilt) {556 557 int i, Np;558 float Mcat, Mcol, Mrel, mc, Mc;559 PhotCode *code;560 561 Np = photcodes[0].hashcode[measure[0].source];562 if (Np == -1) return (NO_MAG_PS);563 564 if (photcodes[0].code[Np].type == PHOT_REF) {565 Mcat = measure[0].M_PS;566 return (Mcat);567 }568 code = &photcodes[0].code[Np];569 Mrel = measure[0].M_PS - ZERO_POINT + code[0].K*(measure[0].airmass_PS - 1.000) + F_PS*code[0].C - measure[0].Mcal_PS;570 571 /* for DEP, color must be made of PRI/SEC */572 mc = iPhotColor (average, secfilt, NULL, code);573 if (mc == NO_MAG_PS) return (Mrel);574 mc = mc - F_PS*code[0].dX;575 576 Mc = mc;577 Mcol = 0;578 for (i = 0; i < code[0].Nc; i++) {579 Mcol += code[0].X[i]*Mc;580 Mc *= mc; /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */581 }582 Mrel += Mcol;583 return (Mrel);584 }585 586 /* return calibrated magnitude from measure for given photcode */587 float PhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {588 589 int i, Np;590 float Mcal, Mrel, Mcol, mc, Mc;591 592 /* code must be the matching PRI/SEC code for this measurement or an equivalent ALT */593 Np = photcodes[0].hashcode[thisone[0].source];594 if (Np == -1) {595 return (NO_MAG_PS);596 }597 598 if (photcodes[0].code[Np].type == PHOT_REF) {599 Mrel = thisone[0].M_PS;600 return (Mrel);601 }602 if (code[0].code != photcodes[0].code[Np].equiv) {603 return (NO_MAG_PS);604 }605 606 Mcal = PhotRel (thisone, average, secfilt) + F_PS*code[0].C;607 608 mc = iPhotColor (average, secfilt, measure, code);609 if (mc == NO_MAG_PS) return (Mcal);610 mc = mc - F_PS*code[0].dX;611 612 Mc = mc;613 Mcol = 0;614 for (i = 0; i < code[0].Nc; i++) {615 Mcol += code[0].X[i]*Mc;616 Mc *= mc;617 }618 Mcal += Mcol;619 return (Mcal);620 }621 622 /* color term may not use DEP magnitude */623 float iPhotColor (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {624 625 int i, Ns1, Ns2, Ns;626 float m1, m2, mc;627 PhotCode *color;628 629 m1 = m2 = NO_MAG_PS;630 631 if (measure == NULL) {632 Ns1 = photcodes[0].hashNsec[code[0].c1];633 Ns2 = photcodes[0].hashNsec[code[0].c2];634 635 m1 = (Ns1 == -1) ? average[0].M : secfilt[Ns1].M_PS;636 m2 = (Ns2 == -1) ? average[0].M : secfilt[Ns2].M_PS;637 mc = ((m1 == NO_MAG_PS) || (m2 == NO_MAG_PS)) ? NO_MAG_PS : (m1 - m2);638 return (mc);639 }640 641 /* find magnitude matching first color term */642 color = GetPhotcodebyCode (code[0].c1);643 if (color == NULL) return (NO_MAG_PS);644 if (color[0].type == PHOT_REF) {645 for (i = 0; (i < average[0].Nm) && (m1 == NO_MAG_PS); i++) {646 if (measure[i].source == color[0].code) {647 m1 = measure[i].M_PS;648 }649 }650 } else {651 Ns = photcodes[0].hashNsec[color[0].code];652 m1 = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;653 }654 655 /* find magnitude matching second color term */656 color = GetPhotcodebyCode (code[0].c2);657 if (color == NULL) return (NO_MAG_PS);658 if (color[0].type == PHOT_REF) {659 for (i = 0; (i < average[0].Nm) && (m2 == NO_MAG_PS); i++) {660 if (measure[i].source == color[0].code) {661 m2 = measure[i].M_PS;662 }663 }664 } else {665 Ns = photcodes[0].hashNsec[color[0].code];666 m2 = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;667 }668 mc = ((m1 == NO_MAG_PS) || (m2 == NO_MAG_PS)) ? NO_MAG_PS : (m1 - m2);669 return (mc);670 }671 672 /* return calibrated magnitude from average/secfilt for given photcode */673 float PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure) {674 675 int i, Ns;676 float Mave, Mref, Mcol, mc;677 double Mc;678 679 Ns = photcodes[0].hashNsec[code[0].code];680 Mave = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;681 Mref = Mave + F_PS*code[0].C;682 683 mc = iPhotColor (average, secfilt, measure, code);684 if (mc == NO_MAG_PS) return (Mref);685 mc = mc - F_PS*code[0].dX;686 687 Mc = mc;688 Mcol = 0;689 for (i = 0; i < code[0].Nc; i++) {690 Mcol += code[0].X[i]*Mc;691 Mc *= mc; /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */692 }693 Mref += Mcol;694 return (Mref);695 }696 697 /***/698 float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt) {699 700 int Ns;701 float Mave;702 703 Ns = photcodes[0].hashNsec[code[0].code];704 Mave = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;705 return (Mave);706 }707 708 /*** note that this is NOT a wrapper around iPhotdM ***/709 float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt) {710 711 int Ns;712 float dM;713 714 Ns = photcodes[0].hashNsec[code[0].code];715 dM = (Ns == -1) ? average[0].dM : secfilt[Ns].dM_PS;716 return (dM);717 }718 719 /*** note that this is NOT a wrapper around iPhotXm ***/720 float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt) {721 722 int Ns;723 short Mi;724 float Xm;725 726 Ns = photcodes[0].hashNsec[code[0].code];727 Mi = (Ns == -1) ? average[0].Xm : secfilt[Ns].Xm;728 Xm = (Mi == NO_MAG_PS) ? -1.0 : pow (10.0, 0.01*Mi);729 return (Xm);730 }731 732 /* given a photcode pair c1 & c2, return the color of this star (NaN if not found) */733 int PhotColor (Average *average, SecFilt *secfilt, Measure *measure, int c1, int c2, double *color) {734 735 int i, Ns;736 double M1, M2, dM;737 PhotCode *code;738 739 code = GetPhotcodebyCode (c1);740 if (code == NULL) return (FALSE);741 if (code[0].type == PHOT_REF) {742 for (i = 0; i < average[0].Nm; i++) {743 if (measure[i].source == c1) {744 M1 = measure[i].M_PS;745 goto filter1;746 }747 }748 return (FALSE);749 } else {750 Ns = photcodes[0].hashNsec[code[0].code];751 M1 = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;752 }753 754 filter1:755 code = GetPhotcodebyCode (c2);756 if (code == NULL) return (FALSE);757 if (code[0].type == PHOT_REF) {758 for (i = 0; i < average[0].Nm; i++) {759 if (measure[i].source == c2) {760 M2 = measure[i].M_PS;761 goto filter2;762 }763 }764 return (FALSE);765 } else {766 Ns = photcodes[0].hashNsec[code[0].code];767 M2 = (Ns == -1) ? average[0].M : secfilt[Ns].M_PS;768 }769 770 filter2:771 772 dM = M1 - M2;773 *color = dM;774 775 return (TRUE);776 }777 778 /* photcode table should have the following format:779 780 # code name type zero airmass offset c1 c2 slope <color> primary781 1 B pri 24.0 0.15 - - - - - -782 2 B pri 24.0 0.15 - - - - - -783 3 B1 sec 22.5 0.18 0.15 1 2 0.10 0.50 1784 1000 USNO_B ref - - - - - - - -785 786 */787 788 789 /*790 Nc1 = photcodes[0].code[Np].c1;791 Ns1 = photcodes[0].hashNsec[Nc1];792 793 Nc2 = photcodes[0].code[Np].c2;794 Ns2 = photcodes[0].hashNsec[Nc2];795 796 Xlam = photcodes[0].code[Np].X[0];797 Klam = photcodes[0].code[Np].K;798 799 m1 = (Ns1 == -1) ? average[0].M : secfilt[Ns1].M;800 m2 = (Ns2 == -1) ? average[0].M : secfilt[Ns2].M;801 */ -
trunk/Ohana/src/libdvo/src/coordops.c
r10510 r12332 7 7 } 8 8 9 int XY_to_RD (double *ra, double *dec, double x, double y, Coords *coords) { 10 11 int Zenith1, Zenith2, Zenithal, Polynomial, Cartesian, PseudoCyl; 12 char *type; 13 double L, M, X, Y, T, Z, Z2; 14 double R, sphi, cphi, stht, ctht; 15 double alpha, delta, salp, calp, sdel, sdp, cdp; 16 17 *ra = 0; 18 *dec = 0; 19 stht = ctht = 1; 20 type = &coords[0].ctype[4]; 21 22 /* PLY is equiv to LIN with higher order terms 23 ZPL is equiv to ZEA with higher order terms 24 DIS is equiv to TAN with higher order terms 25 WRP is equiv to PLY, with implied mosaic */ 26 27 Polynomial = !strcmp(type, "-PLY") || !strcmp(type, "-DIS") || !strcmp(type, "-WRP") || !strcmp(type, "-ZPL"); 28 Cartesian = !strcmp(type, "-LIN") || !strcmp(type, "-PLY") || !strcmp(type, "-WRP") || !strcmp(&coords[0].ctype[0], "GENE"); 29 PseudoCyl = !strcmp(type, "-AIT") || !strcmp(type, "-GLS") || !strcmp(type, "-PAR"); 30 Zenith1 = !strcmp(type, "-DIS") || !strcmp(type, "-TAN") || !strcmp(type, "-STG"); 31 Zenith2 = !strcmp(type, "-SIN") || !strcmp(&coords[0].ctype[0], "MM"); 32 Zenithal = !strcmp(type, "-ZEA") || !strcmp(type, "-ZPL") || Zenith1 || Zenith2; 33 if (!Zenithal && !Cartesian && !PseudoCyl) return (FALSE); 9 int XY_to_LM (double *L, double *M, double x, double y, Coords *coords) { 10 11 double X, Y; 34 12 35 13 /** convert pixel coordinates to cartesian system **/ … … 37 15 Y = coords[0].cdelt2*(y - coords[0].crpix2); 38 16 39 L = (X*coords[0].pc1_1 + Y*coords[0].pc1_2);40 M = (X*coords[0].pc2_1 + Y*coords[0].pc2_2);17 *L = (X*coords[0].pc1_1 + Y*coords[0].pc1_2); 18 *M = (X*coords[0].pc2_1 + Y*coords[0].pc2_2); 41 19 42 20 /** extra polynomial terms **/ 43 21 if (coords[0].Npolyterms > 1) { 44 L += X*X*coords[0].polyterms[0][0] + X*Y*coords[0].polyterms[1][0] + Y*Y*coords[0].polyterms[2][0];45 M += X*X*coords[0].polyterms[0][1] + X*Y*coords[0].polyterms[1][1] + Y*Y*coords[0].polyterms[2][1];22 *L += X*X*coords[0].polyterms[0][0] + X*Y*coords[0].polyterms[1][0] + Y*Y*coords[0].polyterms[2][0]; 23 *M += X*X*coords[0].polyterms[0][1] + X*Y*coords[0].polyterms[1][1] + Y*Y*coords[0].polyterms[2][1]; 46 24 } 47 25 if (coords[0].Npolyterms > 2) { 48 L += X*X*X*coords[0].polyterms[3][0] + X*X*Y*coords[0].polyterms[4][0] + X*Y*Y*coords[0].polyterms[5][0] + Y*Y*Y*coords[0].polyterms[6][0]; 49 M += X*X*X*coords[0].polyterms[3][1] + X*X*Y*coords[0].polyterms[4][1] + X*Y*Y*coords[0].polyterms[5][1] + Y*Y*Y*coords[0].polyterms[6][1]; 50 } 51 52 /**** Locally Cartesian Projections ****/ 53 if (Cartesian) { 26 *L += X*X*X*coords[0].polyterms[3][0] + X*X*Y*coords[0].polyterms[4][0] + X*Y*Y*coords[0].polyterms[5][0] + Y*Y*Y*coords[0].polyterms[6][0]; 27 *M += X*X*X*coords[0].polyterms[3][1] + X*X*Y*coords[0].polyterms[4][1] + X*Y*Y*coords[0].polyterms[5][1] + Y*Y*Y*coords[0].polyterms[6][1]; 28 } 29 30 return (TRUE); 31 } 32 33 int LM_to_RD (double *ra, double *dec, double L, double M, Coords *coords) { 34 35 OhanaProjection proj; 36 OhanaProjectionMode mode; 37 double R, T, Z, Z2, sphi, cphi, stht, ctht; 38 double alpha, delta, salp, calp, sdel, sdp, cdp; 39 40 proj = GetProjection (coords[0].ctype); 41 mode = GetProjectionMode (proj); 42 if (proj == PROJ_NONE) return (FALSE); 43 if (proj == PROJ_MODE_NONE) return (FALSE); 44 45 stht = ctht = 1; 46 47 /** Locally Cartesian Projections **/ 48 if (mode == PROJ_MODE_CARTESIAN) { 54 49 *ra = L + coords[0].crval1; 55 50 *dec = M + coords[0].crval2; 56 51 57 52 /* mosaic astrometry : WRP is chip astrometry; apply mosaic (DIS) term */ 58 if ( !strcmp(type, "-WRP")) {53 if (proj == PROJ_WRP) { 59 54 if (mosaic == NULL) return (FALSE); 60 55 XY_to_RD (ra, dec, L + coords[0].crval1, M + coords[0].crval2, mosaic); … … 63 58 } 64 59 65 /** ** Zenithal Projections ****/66 if ( Zenithal) {60 /** Zenithal Projections **/ 61 if (mode == PROJ_MODE_ZENITHAL) { 67 62 R = hypot (L,M); 68 63 if ((L == 0) && (M == 0)) { … … 74 69 } 75 70 76 /* this is wrong : STG is not TAN - need to put in correct relationships. but is a close approx */ 77 if (Zenith1) { 78 if (R == 0) { 79 stht = 1.0; 80 ctht = 0.0; 81 } else { 82 T = DEG_RAD / R; 83 stht = T / sqrt ( 1.0 + T*T); 84 ctht = 1.0 / sqrt ( 1.0 + T*T); 85 } 86 } 87 if (Zenith2) { 88 ctht = RAD_DEG * R; 89 stht = sqrt (1 - ctht*ctht); 90 } 91 if (!strcmp(type, "-ZEA") || !strcmp(type, "-ZPL")) { 92 if (R > 2*DEG_RAD) { 93 *ra = L; 94 *dec = M; 71 switch (proj) { 72 case PROJ_TAN: 73 if (R == 0) { 74 stht = 1.0; 75 ctht = 0.0; 76 } else { 77 T = DEG_RAD / R; 78 stht = T / sqrt ( 1.0 + T*T); 79 ctht = 1.0 / sqrt ( 1.0 + T*T); 80 } 81 break; 82 case PROJ_STG: 83 stht = (4 - RAD_DEG*R) / (4 + RAD_DEG*R); 84 ctht = sqrt (1 - stht*stht); 85 break; 86 case PROJ_SIN: 87 ctht = RAD_DEG * R; 88 stht = sqrt (1 - ctht*ctht); 89 break; 90 case PROJ_ZEA: 91 case PROJ_ZPL: 92 if (R > 2*DEG_RAD) { 93 *ra = L; 94 *dec = M; 95 return (FALSE); 96 } 97 stht = 1 - 0.5*SQ(R*RAD_DEG); 98 ctht = sqrt (1 - stht*stht); 99 break; 100 default: 95 101 return (FALSE); 96 } 97 stht = 1 - 0.5*SQ(R*RAD_DEG); 98 ctht = sqrt (1 - stht*stht); 99 } 100 102 } 101 103 sdp = sin(RAD_DEG*coords[0].crval2); 102 104 cdp = cos(RAD_DEG*coords[0].crval2); … … 119 121 120 122 /**** Other Conventional Projections ****/ 121 if (PseudoCyl) { 122 if (!strcmp(type, "-AIT")) { 123 if (mode == PROJ_MODE_PSEUDOCYL) { 124 switch (proj) { 125 case PROJ_AIT: 123 126 Z2 = (1.0 - SQ(RAD_DEG*0.25*L) - SQ(RAD_DEG*0.5*M)); 124 127 if (Z2 < 0) return (FALSE); … … 126 129 alpha = 2.0 * DEG_RAD * atan2 (RAD_DEG*0.5*Z*L, 2.0*Z2 - 1.0); 127 130 delta = DEG_RAD * asin (RAD_DEG*M*Z); 128 *ra = alpha + coords[0].crval1;129 *dec = delta + coords[0].crval2;130 }131 if (!strcmp(type, "-GLS")) { 132 /* L,M in degrees, alpha,delta in degrees */ 133 alpha = L / cos (RAD_DEG * M);134 delta = M;135 *ra = alpha + coords[0].crval1;136 *dec = delta + coords[0].crval2; 137 } 138 if (!strcmp(type, "-PAR")) { 139 /* L,M in degrees, alpha,delta in degrees */ 140 alpha = L / (1.0 - SQ(2.0*M/180));141 delta = 3 * DEG_RAD * asin (M/180.0);142 *ra = alpha + coords[0].crval1;143 *dec = delta + coords[0].crval2;144 }131 break; 132 133 case PROJ_GLS: 134 /* L,M in degrees, alpha,delta in degrees */ 135 alpha = L / cos (RAD_DEG * M); 136 delta = M; 137 break; 138 case PROJ_PAR: 139 /* L,M in degrees, alpha,delta in degrees */ 140 alpha = L / (1.0 - SQ(2.0*M/180)); 141 delta = 3 * DEG_RAD * asin (M/180.0); 142 break; 143 default: 144 return (FALSE); 145 } 146 *ra = alpha + coords[0].crval1; 147 *dec = delta + coords[0].crval2; 145 148 146 149 /* rationalize ra range 0 - 360.0 */ … … 153 156 } 154 157 155 int RD_to_XY (double *x, double *y, double ra, double dec, Coords *coords) { 156 157 char *type; 158 int i, status, Polynomial, Zenith1, Zenith2, Zenithal, Cartesian, PseudoCyl; 158 int RD_to_LM (double *L, double *M, double ra, double dec, Coords *coords) { 159 159 160 double phi, theta; 160 double determ; 161 double X, Y, L, M, Lo, Mo, dL, dM; 161 double Lo, Mo; 162 162 double sphi, cphi, stht; 163 163 double salp, calp, sdel, cdel, sdp, cdp; 164 164 double P, A, Rc; 165 166 status = TRUE; 167 *x = 0; 168 *y = 0; 169 type = &coords[0].ctype[4]; 170 L = M = 0; 171 172 Polynomial = !strcmp(type, "-PLY") || !strcmp(type, "-DIS") || !strcmp(type, "-WRP") || !strcmp(type, "-ZPL"); 173 Cartesian = !strcmp(type, "-LIN") || !strcmp(type, "-PLY") || !strcmp(type, "-WRP") || !strcmp(&coords[0].ctype[0], "GENE"); 174 PseudoCyl = !strcmp(type, "-AIT") || !strcmp(type, "-GLS") || !strcmp(type, "-PAR"); 175 Zenith1 = !strcmp(type, "-DIS") || !strcmp(type, "-TAN") || !strcmp(type, "-STG"); 176 Zenith2 = !strcmp(type, "-SIN") || !strcmp(&coords[0].ctype[0], "MM"); 177 Zenithal = !strcmp(type, "-ZEA") || !strcmp(type, "-ZPL") || Zenith1 || Zenith2; 178 if (!Zenithal && !Cartesian && !PseudoCyl) return (FALSE); 165 OhanaProjection proj; 166 OhanaProjectionMode mode; 167 168 *L = *M = 0; 169 170 proj = GetProjection (coords[0].ctype); 171 mode = GetProjectionMode (proj); 172 if (proj == PROJ_NONE) return (FALSE); 173 if (proj == PROJ_MODE_NONE) return (FALSE); 179 174 180 175 /**** Locally Cartesian Projections ****/ 181 if ( Cartesian) {182 if ( !strcmp(type, "-WRP")) {176 if (mode == PROJ_MODE_CARTESIAN) { 177 if (proj == PROJ_WRP) { 183 178 if (mosaic == NULL) return (FALSE); 184 179 RD_to_XY (&Lo, &Mo, ra, dec, mosaic); 185 L = (Lo - coords[0].crval1); 186 M = (Mo - coords[0].crval2); 187 } else { 188 L = (ra - coords[0].crval1); 189 M = (dec - coords[0].crval2); 190 } 180 *L = (Lo - coords[0].crval1); 181 *M = (Mo - coords[0].crval2); 182 return (TRUE); 183 } 184 *L = (ra - coords[0].crval1); 185 *M = (dec - coords[0].crval2); 186 return (TRUE); 191 187 } 192 188 193 189 /**** Zenithal Projections ****/ 194 if ( Zenithal){190 if (mode == PROJ_MODE_ZENITHAL) { 195 191 sdp = sin(RAD_DEG*coords[0].crval2); 196 192 cdp = cos(RAD_DEG*coords[0].crval2); … … 203 199 sphi = cdel*salp; /* = cos(theta)*sin(phi) */ 204 200 cphi = cdel*sdp*calp - sdel*cdp; /* = cos(theta)*cos(phi) */ 205 if (stht < 0) status = FALSE; 206 207 if (Zenith1) { 208 L = DEG_RAD * sphi / stht; 209 M = -DEG_RAD * cphi / stht; 210 } 211 if (Zenith2) { 212 L = DEG_RAD * sphi; 213 M = -DEG_RAD * cphi; 214 } 215 if (!strcmp(type, "-ZEA") || !strcmp(type, "-ZPL")) { 216 Rc = DEG_RAD * M_SQRT2 / sqrt (1 + stht); 217 L = Rc * sphi; 218 M = -Rc * cphi; 219 status = TRUE; 220 } 201 if (stht < 0) return (FALSE); 202 203 switch (proj) { 204 case PROJ_TAN: 205 case PROJ_DIS: 206 *L = DEG_RAD * sphi / stht; 207 *M = -DEG_RAD * cphi / stht; 208 return (TRUE); 209 case PROJ_SIN: 210 *L = DEG_RAD * sphi; 211 *M = -DEG_RAD * cphi; 212 return (TRUE); 213 case PROJ_ZEA: 214 case PROJ_ZPL: 215 Rc = DEG_RAD * M_SQRT2 / sqrt (1 + stht); 216 *L = Rc * sphi; 217 *M = -Rc * cphi; 218 return (TRUE); 219 default: 220 return (FALSE); 221 } 222 return (FALSE); 221 223 } 222 224 223 225 /**** Other Standard Projections ****/ 224 if (PseudoCyl) { 225 if (!strcmp(type, "-AIT")) { 226 phi = RAD_DEG*(ra - coords[0].crval1); 227 theta = RAD_DEG*(dec - coords[0].crval2); 228 P = 1.0 + cos (theta) * cos (0.5*phi); 229 if (P != 0.0) { 226 if (mode == PROJ_MODE_PSEUDOCYL) { 227 switch (proj) { 228 case PROJ_AIT: 229 phi = RAD_DEG*(ra - coords[0].crval1); 230 theta = RAD_DEG*(dec - coords[0].crval2); 231 P = 1.0 + cos (theta) * cos (0.5*phi); 232 if (P == 0.0) { 233 *L = 0.0; 234 *M = 0.0; 235 return (TRUE); 236 } 230 237 A = DEG_RAD * sqrt (2.0 / P); 231 L = 2.0 * A * cos (theta) * sin (0.5*phi); 232 M = A * sin (theta); 233 } else { 234 L = 0.0; 235 M = 0.0; 236 } 237 } 238 if (!strcmp(type, "-GLS")) { 239 phi = ra - coords[0].crval1; 240 theta = dec - coords[0].crval2; 241 L = phi * cos(RAD_DEG * theta); 242 M = theta; 243 } 244 if (!strcmp(type, "-PAR")) { 245 phi = ra - coords[0].crval1; 246 theta = dec - coords[0].crval2; 247 L = phi * (2.0*cos(2*RAD_DEG*theta/3.0) - 1); 248 M = 180.0 * sin (RAD_DEG*theta/3.0); 249 } 250 } 238 *L = 2.0 * A * cos (theta) * sin (0.5*phi); 239 *M = A * sin (theta); 240 return (TRUE); 241 case PROJ_GLS: 242 phi = ra - coords[0].crval1; 243 theta = dec - coords[0].crval2; 244 *L = phi * cos(RAD_DEG * theta); 245 *M = theta; 246 return (TRUE); 247 case PROJ_PAR: 248 phi = ra - coords[0].crval1; 249 theta = dec - coords[0].crval2; 250 *L = phi * (2.0*cos(2*RAD_DEG*theta/3.0) - 1); 251 *M = 180.0 * sin (RAD_DEG*theta/3.0); 252 return (TRUE); 253 default: 254 return (FALSE); 255 } 256 return (FALSE); 257 } 258 return (FALSE); 259 } 260 261 int LM_to_XY (double *x, double *y, double L, double M, Coords *coords) { 262 263 int i; 264 double determ; 265 double X, Y, Lo, Mo, dL, dM; 266 267 *x = 0; 268 *y = 0; 251 269 252 270 /* convert L,M to X,Y */ … … 270 288 dL = (L - Lo); 271 289 dM = (M - Mo); 272 // fprintf (stderr, "%d: %f,%f : %f,%f : %f,%f : %f,%f\n", i, L, M, X, Y, Lo, Mo, dL, dM);273 290 274 291 X += determ * (coords[0].pc2_2*dL - coords[0].pc1_2*dM); … … 281 298 *y = Y / coords[0].cdelt2 + coords[0].crpix2; 282 299 300 return (TRUE); 301 } 302 303 int XY_to_RD (double *ra, double *dec, double x, double y, Coords *coords) { 304 305 double L, M; 306 int status; 307 308 status = XY_to_LM (&L, &M, x, y, coords); 309 if (!status) return FALSE; 310 311 status = LM_to_RD (ra, dec, L, M, coords); 283 312 return (status); 284 313 } 314 315 int RD_to_XY (double *x, double *y, double ra, double dec, Coords *coords) { 316 317 double L, M; 318 int status; 319 320 status = RD_to_LM (&L, &M, ra, dec, coords); 321 if (!status) return FALSE; 322 323 status = LM_to_XY (x, y, L, M, coords); 324 return (status); 285 325 } 286 326 … … 599 639 600 640 */ 641 642 /* PLY is equiv to LIN with higher order terms 643 ZPL is equiv to ZEA with higher order terms 644 DIS is equiv to TAN with higher order terms 645 WRP is equiv to PLY, with implied mosaic */ 646 647 OhanaProjection GetProjection (char *ctype) { 648 if (!strcmp(&ctype[4], "-ZEA")) return PROJ_ZEA; 649 if (!strcmp(&ctype[4], "-ZPL")) return PROJ_ZPL; 650 if (!strcmp(&ctype[4], "-ARC")) return PROJ_ARC; 651 if (!strcmp(&ctype[4], "-STG")) return PROJ_STG; 652 if (!strcmp(&ctype[4], "-SIN")) return PROJ_SIN; 653 if (!strcmp(&ctype[0], "MM")) return PROJ_SIN; // note ctype[0] 654 if (!strcmp(&ctype[4], "-TAN")) return PROJ_TAN; 655 if (!strcmp(&ctype[4], "-DIS")) return PROJ_DIS; 656 if (!strcmp(&ctype[4], "-LIN")) return PROJ_LIN; 657 if (!strcmp(&ctype[0], "GENE")) return PROJ_LIN; // note ctype[0] 658 if (!strcmp(&ctype[4], "-PLY")) return PROJ_PLY; 659 if (!strcmp(&ctype[4], "-WRP")) return PROJ_WRP; 660 if (!strcmp(&ctype[4], "-AIT")) return PROJ_AIT; 661 if (!strcmp(&ctype[4], "-GLS")) return PROJ_GLS; 662 if (!strcmp(&ctype[4], "-PAR")) return PROJ_PAR; 663 return PROJ_NONE; 664 } 665 666 int SetProjection (char *ctype, OhanaProjection proj) { 667 switch (proj) { 668 case PROJ_ZEA: strcpy(&ctype[4], "-ZEA"); return TRUE; 669 case PROJ_ZPL: strcpy(&ctype[4], "-ZPL"); return TRUE; 670 case PROJ_ARC: strcpy(&ctype[4], "-ARC"); return TRUE; 671 case PROJ_STG: strcpy(&ctype[4], "-STG"); return TRUE; 672 case PROJ_SIN: strcpy(&ctype[4], "-SIN"); return TRUE; 673 case PROJ_TAN: strcpy(&ctype[4], "-TAN"); return TRUE; 674 case PROJ_DIS: strcpy(&ctype[4], "-DIS"); return TRUE; 675 case PROJ_LIN: strcpy(&ctype[4], "-LIN"); return TRUE; 676 case PROJ_PLY: strcpy(&ctype[4], "-PLY"); return TRUE; 677 case PROJ_WRP: strcpy(&ctype[4], "-WRP"); return TRUE; 678 case PROJ_AIT: strcpy(&ctype[4], "-AIT"); return TRUE; 679 case PROJ_GLS: strcpy(&ctype[4], "-GLS"); return TRUE; 680 case PROJ_PAR: strcpy(&ctype[4], "-PAR"); return TRUE; 681 case PROJ_NONE: return FALSE; 682 } 683 return FALSE; 684 } 685 686 OhanaProjectionMode GetProjectionMode (OhanaProjection proj) { 687 switch (proj) { 688 case PROJ_ZEA: 689 case PROJ_ZPL: 690 case PROJ_ARC: 691 case PROJ_STG: 692 case PROJ_SIN: 693 case PROJ_TAN: 694 case PROJ_DIS: 695 return PROJ_MODE_ZENITHAL; 696 case PROJ_LIN: 697 case PROJ_PLY: 698 case PROJ_WRP: 699 return PROJ_MODE_CARTESIAN; 700 case PROJ_AIT: 701 case PROJ_GLS: 702 case PROJ_PAR: 703 return PROJ_MODE_PSEUDOCYL; 704 default: PROJ_MODE_NONE; 705 } 706 return PROJ_MODE_NONE; 707 } 708 -
trunk/Ohana/src/libdvo/src/coordops.update.c
r8638 r12332 86 86 case PROJ_ZEA: 87 87 case PROJ_ZPL: 88 if (R > 2*DEG_RAD) { 89 *ra = L; 90 *dec = M; 91 return (FALSE); 92 } 88 93 stht = 1 - 0.5*SQ(R*RAD_DEG); 89 94 ctht = sqrt (1 - stht*stht); … … 110 115 111 116 /**** Other Conventional Projections ****/ 112 if (mode == PROJ_MODE_ ZENITHAL) {117 if (mode == PROJ_MODE_PSEUDOCLY) { 113 118 switch (proj) { 114 119 case PROJ_AIT: … … 119 124 delta = DEG_RAD * asin (RAD_DEG*M*Z); 120 125 break; 121 126 122 127 case PROJ_GLS: 123 128 /* L,M in degrees, alpha,delta in degrees */ … … 213 218 214 219 /**** Other Standard Projections ****/ 215 if (PseudoCyl) { 216 if (!strcmp(type, "-AIT")) { 217 phi = RAD_DEG*(ra - coords[0].crval1); 218 theta = RAD_DEG*(dec - coords[0].crval2); 219 P = 1.0 + cos (theta) * cos (0.5*phi); 220 if (P != 0.0) { 221 A = DEG_RAD * sqrt (2.0 / P); 222 L = 2.0 * A * cos (theta) * sin (0.5*phi); 223 M = A * sin (theta); 224 } else { 225 L = 0.0; 226 M = 0.0; 227 } 228 } 229 if (!strcmp(type, "-GLS")) { 230 phi = ra - coords[0].crval1; 231 theta = dec - coords[0].crval2; 232 L = phi * cos(RAD_DEG * theta); 233 M = theta; 234 } 235 if (!strcmp(type, "-PAR")) { 236 phi = ra - coords[0].crval1; 237 theta = dec - coords[0].crval2; 238 L = phi * (2.0*cos(2*RAD_DEG*theta/3.0) - 1); 239 M = 180.0 * sin (RAD_DEG*theta/3.0); 220 if (mode == PROJ_MODE_PSEUDOCYL) { 221 switch (proj) { 222 case PROJ_AIT: 223 phi = RAD_DEG*(ra - coords[0].crval1); 224 theta = RAD_DEG*(dec - coords[0].crval2); 225 P = 1.0 + cos (theta) * cos (0.5*phi); 226 if (P != 0.0) { 227 A = DEG_RAD * sqrt (2.0 / P); 228 L = 2.0 * A * cos (theta) * sin (0.5*phi); 229 M = A * sin (theta); 230 } else { 231 L = 0.0; 232 M = 0.0; 233 } 234 break; 235 case PROJ_GLS: 236 phi = ra - coords[0].crval1; 237 theta = dec - coords[0].crval2; 238 L = phi * cos(RAD_DEG * theta); 239 M = theta; 240 break; 241 case PROJ_PAR: 242 phi = ra - coords[0].crval1; 243 theta = dec - coords[0].crval2; 244 L = phi * (2.0*cos(2*RAD_DEG*theta/3.0) - 1); 245 M = 180.0 * sin (RAD_DEG*theta/3.0); 246 break; 240 247 } 241 248 } … … 261 268 dL = (L - Lo); 262 269 dM = (M - Mo); 263 // fprintf (stderr, "%d: %f,%f : %f,%f : %f,%f : %f,%f\n", i, L, M, X, Y, Lo, Mo, dL, dM);264 270 265 271 X += determ * (coords[0].pc2_2*dL - coords[0].pc1_2*dM); … … 273 279 274 280 return (status); 275 276 281 } 277 282 -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r8520 r12332 50 50 if (!strcasecmp (catformat, "PANSTARRS")) return (DVO_FORMAT_PANSTARRS); 51 51 if (!strcasecmp (catformat, "PMTEST")) return (DVO_FORMAT_PMTEST); 52 if (!strcasecmp (catformat, "PANSTARRS_DEV_0")) return (DVO_FORMAT_PANSTARRS_DEV_0); 52 53 return (DVO_FORMAT_UNDEF); 53 54 } … … 340 341 for (in = out = i = 0; i < catalog[0].Naverage; i++) { 341 342 for (j = 0; j < catalog[0].Nsecfilt; j++, in++, out++) { 342 outsec[out].M _PS = insec[in].M_PS;343 outsec[out].dM _PS = insec[in].dM_PS;343 outsec[out].M = insec[in].M; 344 outsec[out].dM = insec[in].dM; 344 345 outsec[out].Xm = insec[in].Xm; 345 346 } 346 347 for (j = 0; j < Nextra; j++, out++) { 347 outsec[out].M _PS= NO_MAG;348 outsec[out].dM _PS= NO_MAG;348 outsec[out].M = NO_MAG; 349 outsec[out].dM = NO_MAG; 349 350 outsec[out].Xm = NO_MAG; 350 351 } … … 386 387 /* 387 388 mode : items to read (LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF) 388 format : what structure on disk (INTERNAL, ELIXIR, LONEOS, PANSTARRS)389 format : what table structure on disk (INTERNAL, LONEOS, etc, ) 389 390 style : raw, mef, split, mysql 390 391 */ -
trunk/Ohana/src/libdvo/src/dvo_catalog_mef.c
r8328 r12332 9 9 Matrix matrix; 10 10 FTable ftable; 11 SecFilt *primary; 11 12 12 13 f = catalog[0].f; … … 44 45 return (FALSE); 45 46 } 46 catalog[0].average = FtableToAverage (&ftable, &catalog[0].Naverage, &catalog[0].catformat); 47 /* old versions of DVO stored one of the average magnitudes in Average. we save this if needed */ 48 catalog[0].average = FtableToAverage (&ftable, &catalog[0].Naverage, &catalog[0].catformat, &primary); 47 49 if (Naverage != catalog[0].Naverage) { 48 50 fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%d vs %d)\n", Naverage, catalog[0].Naverage); … … 96 98 } 97 99 98 // catalog[0].secfilt = gfits_table_get_SecFilt (&ftable, &Nitems, NULL);99 // catalog[0].Nsecfilt = Nitems / catalog[0].Naverage;100 101 100 /* read secfilt table header */ 102 101 if (!gfits_fread_header (f, &header)) { … … 110 109 return (FALSE); 111 110 } 111 112 /* how many entries do we expect from the secfilt table? */ 112 113 Nexpect = catalog[0].Nsecfilt * catalog[0].Naverage; 113 114 catalog[0].secfilt = FtableToSecFilt (&ftable, &Nitems, &catalog[0].catformat); … … 115 116 fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%d vs %d)\n", Nexpect, Nitems); 116 117 } 118 119 /* if primary is defined, we were supplied with one additional average magnitude from Average 120 we need to interleave these magnitudes with the secfilt entries just loaded */ 121 if (primary != NULL) { 122 int Ntmpfilt, Ntotal, i, j; 123 SecFilt *tmpfilt; 124 tmpfilt = catalog[0].secfilt; 125 Ntmpfilt = catalog[0].Nsecfilt; 126 Nsecfilt = catalog[0].Nsecfilt + 1; 127 Ntotal = Nsecfilt * catalog[0].Naverage; 128 ALLOCATE (catalog[0].secfilt, SecFilt, Ntotal); 129 for (i = 0; i < catalog[0].Naverage; i++) { 130 catalog[0].secfilt[i*Nsecfilt + 0] = primary[i]; 131 for (j = 0; j < Ntmpfilt; j++) { 132 catalog[0].secfilt[i*Nsecfilt + j + 1] = tmpfilt[i*Ntmpfilt + j]; 133 } 134 } 135 catalog[0].Nsecfilt = Nsecfilt; 136 free (primary); 137 } 138 117 139 } else { 118 140 /* no real need to skip the data array here... */ 119 141 Nbytes = gfits_matrix_size (&header); 120 142 fseek (f, Nbytes, SEEK_CUR); 143 if (primary != NULL) free (primary); 121 144 } 122 145 … … 129 152 } 130 153 154 /* XXX need to decompose the primary and secfilt entries for Elixir and Loneos */ 131 155 /* save_catalog_mef writes a complete new file from scratch */ 132 133 156 int dvo_catalog_save_mef (Catalog *catalog, char VERBOSE) { 134 157 … … 138 161 Header header; 139 162 FTable ftable; 163 SecFilt *primary; 164 SecFilt *secfilt; 165 int i, j, Nsecfilt, Nallfilt, Ntotal; 140 166 141 167 if (catalog[0].Naverage == 0) { … … 171 197 gfits_free_matrix (&matrix); 172 198 199 /* for the appropriate types, pull out the first secfilt and pass to AverageToFtable as primary */ 200 if ((catalog[0].catformat == DVO_FORMAT_ELIXIR) || // special case for ELIXIR 201 (catalog[0].catformat == DVO_FORMAT_LONEOS)) { // special case for LONEOS 202 Nallfilt = catalog[0].Nsecfilt; 203 Nsecfilt = catalog[0].Nsecfilt - 1; 204 Ntotal = Nsecfilt * catalog[0].Naverage; 205 ALLOCATE (primary, SecFilt, catalog[0].Naverage); 206 ALLOCATE (secfilt, SecFilt, Ntotal); 207 208 for (i = 0; i < catalog[0].Naverage; i++) { 209 primary[i] = catalog[0].secfilt[i*Nallfilt + 0]; 210 for (j = 0; j < Nsecfilt; j++) { 211 secfilt[i*Nsecfilt + j] = catalog[0].secfilt[i*Nallfilt + j + 1]; 212 } 213 } 214 } else { 215 primary = NULL; 216 secfilt = catalog[0].secfilt; 217 Nsecfilt = catalog[0].Nsecfilt; 218 } 219 173 220 /* write out Average table (convert to FITS table format) */ 174 AverageToFtable (&ftable, catalog[0].average, catalog[0].Naverage, catalog[0].catformat );221 AverageToFtable (&ftable, catalog[0].average, catalog[0].Naverage, catalog[0].catformat, primary); 175 222 if (!gfits_fwrite_Theader (catalog[0].f, &header)) { 176 223 fprintf (stderr, "can't write table header"); … … 211 258 212 259 /* write out SecFilt table (convert to FITS table format) */ 213 Nitems = catalog[0].Naverage * catalog[0].Nsecfilt; 214 SecFiltToFtable (&ftable, catalog[0].secfilt, Nitems, catalog[0].catformat); 215 if (!gfits_fwrite_Theader (catalog[0].f, &header)) { 216 fprintf (stderr, "can't write table header"); 217 return (FALSE); 218 } 219 if (!gfits_fwrite_table (catalog[0].f, &ftable)) { 220 fprintf (stderr, "can't write table data"); 221 return (FALSE); 222 } 223 gfits_free_table (&ftable); 224 gfits_free_header (&header); 260 Nitems = catalog[0].Naverage * Nsecfilt; 261 SecFiltToFtable (&ftable, secfilt, Nitems, catalog[0].catformat); 262 if (!gfits_fwrite_Theader (catalog[0].f, &header)) { 263 fprintf (stderr, "can't write table header"); 264 return (FALSE); 265 } 266 if (!gfits_fwrite_table (catalog[0].f, &ftable)) { 267 fprintf (stderr, "can't write table data"); 268 return (FALSE); 269 } 270 gfits_free_table (&ftable); 271 gfits_free_header (&header); 272 273 /* free temp storage */ 274 if (primary != NULL) { 275 free (primary); 276 free (secfilt); 277 } 225 278 226 279 return (TRUE); … … 228 281 229 282 /* 230 catalog data is:231 header (bitpix == 8)232 matrix (empty)233 average header234 average table235 measure header236 measure table237 missing header238 missing table239 secfilt header240 secfilt table283 catalog data is: 284 header (bitpix == 8) 285 matrix (empty) 286 average header 287 average table 288 measure header 289 measure table 290 missing header 291 missing table 292 secfilt header 293 secfilt table 241 294 */ 242 295 -
trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c
r8456 r12332 12 12 struct stat filestatus; 13 13 char format[80], telescope[80]; 14 SecFilt *primary; 14 15 15 16 f = catalog[0].f; … … 28 29 catalog[0].catformat = DVO_FORMAT_UNDEF; 29 30 if (gfits_scan (&catalog[0].header, "FORMAT", "%s", 1, format)) { 30 if (!strcmp (format, "INTERNAL")) catalog[0].catformat = DVO_FORMAT_INTERNAL; 31 if (!strcmp (format, "LONEOS")) catalog[0].catformat = DVO_FORMAT_LONEOS; 32 if (!strcmp (format, "ELIXIR")) catalog[0].catformat = DVO_FORMAT_ELIXIR; 33 if (!strcmp (format, "PANSTARRS")) catalog[0].catformat = DVO_FORMAT_PANSTARRS; 34 if (!strcmp (format, "PMTEST")) catalog[0].catformat = DVO_FORMAT_PMTEST; 31 catalog[0].catformat = dvo_catalog_catformat (format); 35 32 if (catalog[0].catformat != DVO_FORMAT_UNDEF) goto got_format; 36 33 } 37 34 /* special cases: old versions of the DB tables which were poorly identified */ 38 35 if (gfits_scan (&catalog[0].header, "NEWMEAS", "%t", 1, &NewMeasure)) { 39 catalog[0].catformat = DVO_FORMAT_ELIXIR; 36 catalog[0].catformat = DVO_FORMAT_ELIXIR; // special case for ELIXIR 40 37 goto got_format; 41 38 } 42 39 if (gfits_scan (&catalog[0].header, "TELESCOP", "%s", 1, telescope)) { 43 40 if (!strncmp (telescope, "LONEOS", strlen("LONEOS"))) { 44 catalog[0].catformat = DVO_FORMAT_LONEOS; 41 catalog[0].catformat = DVO_FORMAT_LONEOS; // special case for LONEOS 45 42 goto got_format; 46 43 } 47 44 if (!strncmp (telescope, "1.3m McGraw-Hill", strlen("1.3m McGraw-Hill"))) { 48 catalog[0].catformat = DVO_FORMAT_ELIXIR; 45 catalog[0].catformat = DVO_FORMAT_ELIXIR; // special case for ELIXIR 49 46 goto got_format; 50 47 } … … 59 56 AverageSize = sizeof(Average); 60 57 MeasureSize = sizeof(Measure); 61 SecFiltSize = sizeof (SecFilt);58 SecFiltSize = sizeof(SecFilt); 62 59 break; 63 60 case DVO_FORMAT_LONEOS: 64 61 AverageSize = sizeof(AverageLoneos); 65 62 MeasureSize = sizeof(MeasureLoneos); 66 SecFiltSize = sizeof (SecFiltLoneos);63 SecFiltSize = sizeof(SecFiltLoneos); 67 64 break; 68 65 case DVO_FORMAT_ELIXIR: 69 66 AverageSize = sizeof(AverageElixir); 70 67 MeasureSize = sizeof(MeasureElixir); 71 SecFiltSize = sizeof (SecFiltElixir);68 SecFiltSize = sizeof(SecFiltElixir); 72 69 break; 70 case DVO_FORMAT_PANSTARRS_DEV_0: 71 AverageSize = sizeof(AveragePanstarrs_DEV_0); 72 MeasureSize = sizeof(MeasurePanstarrs_DEV_0); 73 SecFiltSize = sizeof(SecFiltPanstarrs_DEV_0); 74 break; 75 # if 0 73 76 case DVO_FORMAT_PANSTARRS: 74 77 AverageSize = sizeof(AveragePanstarrs); 75 78 MeasureSize = sizeof(MeasurePanstarrs); 76 SecFiltSize = sizeof (SecFiltPanstarrs);79 SecFiltSize = sizeof(SecFiltPanstarrs); 77 80 break; 78 81 case DVO_FORMAT_PMTEST: 79 82 AverageSize = sizeof(AveragePMtest); 80 83 MeasureSize = sizeof(MeasurePanstarrs); 81 SecFiltSize = sizeof (SecFiltPanstarrs);84 SecFiltSize = sizeof(SecFiltPanstarrs); 82 85 break; 86 # endif 83 87 default: 84 88 fprintf (stderr, "programming error in phot_catalog_raw\n"); … … 120 124 121 125 /* read and convert the averages (use a macro to clean this up?) */ 126 /* old versions of DVO stored one of the average magnitudes in Average. we save this if needed */ 122 127 if (catalog[0].catflags & LOAD_AVES) { 123 catalog[0].average = ReadRawAverage (catalog[0].f, catalog[0].Naverage, catalog[0].catformat );128 catalog[0].average = ReadRawAverage (catalog[0].f, catalog[0].Naverage, catalog[0].catformat, &primary); 124 129 } else { 125 130 /* skip over averages */ … … 157 162 Nitems = catalog[0].Naverage * catalog[0].Nsecfilt; 158 163 catalog[0].secfilt = ReadRawSecFilt (catalog[0].f, Nitems, catalog[0].catformat); 164 165 /* if primary is defined, we were supplied with one additional average magnitude from Average 166 we need to interleave these magnitudes with the secfilt entries just loaded */ 167 if (primary != NULL) { 168 int Ntmpfilt, Nsecfilt, Ntotal, i, j; 169 SecFilt *tmpfilt; 170 tmpfilt = catalog[0].secfilt; 171 Ntmpfilt = catalog[0].Nsecfilt; 172 Nsecfilt = catalog[0].Nsecfilt + 1; 173 Ntotal = Nsecfilt * catalog[0].Naverage; 174 ALLOCATE (catalog[0].secfilt, SecFilt, Ntotal); 175 for (i = 0; i < catalog[0].Naverage; i++) { 176 catalog[0].secfilt[i*Nsecfilt + 0] = primary[i]; 177 for (j = 0; j < Ntmpfilt; j++) { 178 catalog[0].secfilt[i*Nsecfilt + j + 1] = tmpfilt[i*Ntmpfilt + j]; 179 } 180 } 181 catalog[0].Nsecfilt = Nsecfilt; 182 free (primary); 183 } 184 159 185 } else { 160 186 /* skip over secfilts */ 161 187 Nskip = catalog[0].Nsecfilt * catalog[0].Naverage * SecFiltSize; 162 188 fseek (f, Nskip, SEEK_CUR); 189 if (primary != NULL) free (primary); 163 190 } 164 191 … … 194 221 int Nitems, nitems; 195 222 FILE *f; 223 SecFilt *primary; 224 SecFilt *secfilt; 225 int i, j, Nsecfilt, Nallfilt, Ntotal; 196 226 197 227 if (catalog[0].Naverage == 0) { … … 210 240 if (catalog[0].catformat == DVO_FORMAT_LONEOS) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "LONEOS"); 211 241 if (catalog[0].catformat == DVO_FORMAT_ELIXIR) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "ELIXIR"); 212 if (catalog[0].catformat == DVO_FORMAT_PANSTARRS) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS"); 213 if (catalog[0].catformat == DVO_FORMAT_PMTEST) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PMTEST"); 242 if (catalog[0].catformat == DVO_FORMAT_PANSTARRS_DEV_0) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_0"); 243 // if (catalog[0].catformat == DVO_FORMAT_PANSTARRS) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PANSTARRS"); 244 // if (catalog[0].catformat == DVO_FORMAT_PMTEST) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PMTEST"); 214 245 215 246 /* rewind file pointers and truncate file */ … … 225 256 } 226 257 258 /* for the appropriate types, pull out the first secfilt and pass to WriteRawAverage as primary */ 259 if ((catalog[0].catformat == DVO_FORMAT_ELIXIR) || // special case for ELIXIR 260 (catalog[0].catformat == DVO_FORMAT_LONEOS)) { // special case for LONEOS 261 Nallfilt = catalog[0].Nsecfilt; 262 Nsecfilt = catalog[0].Nsecfilt - 1; 263 Ntotal = Nsecfilt * catalog[0].Naverage; 264 ALLOCATE (primary, SecFilt, catalog[0].Naverage); 265 ALLOCATE (secfilt, SecFilt, Ntotal); 266 267 for (i = 0; i < catalog[0].Naverage; i++) { 268 primary[i] = catalog[0].secfilt[i*Nallfilt + 0]; 269 for (j = 0; j < Nsecfilt; j++) { 270 secfilt[i*Nsecfilt + j] = catalog[0].secfilt[i*Nallfilt + j + 1]; 271 } 272 } 273 } else { 274 primary = NULL; 275 secfilt = catalog[0].secfilt; 276 Nsecfilt = catalog[0].Nsecfilt; 277 } 278 227 279 /* write averages and measures */ 228 WriteRawAverage (f, catalog[0].average, catalog[0].Naverage, catalog[0].catformat );280 WriteRawAverage (f, catalog[0].average, catalog[0].Naverage, catalog[0].catformat, primary); 229 281 WriteRawMeasure (f, catalog[0].measure, catalog[0].Nmeasure, catalog[0].catformat); 230 282 … … 240 292 Nitems = catalog[0].Naverage * catalog[0].Nsecfilt; 241 293 WriteRawSecFilt (f, catalog[0].secfilt, Nitems, catalog[0].catformat); 294 295 /* free temp storage */ 296 if (primary != NULL) { 297 free (primary); 298 free (secfilt); 299 } 300 242 301 return (TRUE); 243 302 } … … 250 309 /** Average / Raw Table conversions **/ 251 310 252 Average *ReadRawAverage (FILE *f, int Naverage, int format ) {311 Average *ReadRawAverage (FILE *f, int Naverage, int format, SecFilt **primary) { 253 312 254 313 int nitems; 255 314 Average *average; 256 AverageElixir *tmpAverageElixir; 257 AverageLoneos *tmpAverageLoneos;258 AveragePanstarrs *tmpAveragePanstarrs;259 AveragePMtest *tmpAveragePMtest;315 316 /* in the Elixir and Loneos cases, we are supplied with an average magnitude in Average 317 in these cases, save these values in primary; otherwise set primary to NULL */ 318 *primary = NULL; 260 319 261 320 switch (format) { 262 case DVO_FORMAT_INTERNAL: 321 case DVO_FORMAT_INTERNAL: { 263 322 ALLOCATE (average, Average, MAX (Naverage, 1)); 264 323 nitems = fread (average, sizeof(Average), Naverage, f); … … 268 327 } 269 328 gfits_convert_Average (average, sizeof(Average), Naverage); 270 break; 271 case DVO_FORMAT_ELIXIR: 272 ALLOCATE (tmpAverageElixir, AverageElixir, MAX (Naverage, 1)); 273 nitems = fread (tmpAverageElixir, sizeof(AverageElixir), Naverage, f); 329 break; } 330 case DVO_FORMAT_ELIXIR: { 331 AverageElixir *tmpAverage; 332 ALLOCATE (tmpAverage, AverageElixir, MAX (Naverage, 1)); 333 nitems = fread (tmpAverage, sizeof(AverageElixir), Naverage, f); 274 334 if (nitems != Naverage) { 275 335 fprintf (stderr, "failed to read averages (%d vs %d)\n", nitems, Naverage); 276 336 return (NULL); 277 337 } 278 gfits_convert_AverageElixir (tmpAverageElixir, sizeof(AverageElixir), Naverage); 279 average = AverageElixirToInternal (tmpAverageElixir, Naverage); 280 free (tmpAverageElixir); 281 break; 282 case DVO_FORMAT_LONEOS: 283 ALLOCATE (tmpAverageLoneos, AverageLoneos, MAX (Naverage, 1)); 284 nitems = fread (tmpAverageLoneos, sizeof(AverageLoneos), Naverage, f); 338 gfits_convert_AverageElixir (tmpAverage, sizeof(AverageElixir), Naverage); 339 average = AverageElixirToInternal (tmpAverage, Naverage, primary); 340 free (tmpAverage); 341 break; } 342 case DVO_FORMAT_LONEOS: { 343 AverageLoneos *tmpAverage; 344 ALLOCATE (tmpAverage, AverageLoneos, MAX (Naverage, 1)); 345 nitems = fread (tmpAverage, sizeof(AverageLoneos), Naverage, f); 285 346 if (nitems != Naverage) { 286 347 fprintf (stderr, "failed to read averages (%d vs %d)\n", nitems, Naverage); 287 348 return (NULL); 288 349 } 289 gfits_convert_AverageLoneos (tmpAverageLoneos, sizeof(AverageLoneos), Naverage); 290 average = AverageLoneosToInternal (tmpAverageLoneos, Naverage); 291 free (tmpAverageLoneos); 292 break; 293 case DVO_FORMAT_PANSTARRS: 294 ALLOCATE (tmpAveragePanstarrs, AveragePanstarrs, MAX (Naverage, 1)); 295 nitems = fread (tmpAveragePanstarrs, sizeof(AveragePanstarrs), Naverage, f); 350 gfits_convert_AverageLoneos (tmpAverage, sizeof(AverageLoneos), Naverage); 351 average = AverageLoneosToInternal (tmpAverage, Naverage, primary); 352 free (tmpAverage); 353 break; } 354 case DVO_FORMAT_PANSTARRS_DEV_0: { 355 AveragePanstarrs_DEV_0 *tmpAverage; 356 ALLOCATE (tmpAverage, AveragePanstarrs_DEV_0, MAX (Naverage, 1)); 357 nitems = fread (tmpAverage, sizeof(AveragePanstarrs_DEV_0), Naverage, f); 296 358 if (nitems != Naverage) { 297 359 fprintf (stderr, "failed to read averages (%d vs %d)\n", nitems, Naverage); 298 360 return (NULL); 299 361 } 300 gfits_convert_AveragePanstarrs (tmpAveragePanstarrs, sizeof(AveragePanstarrs), Naverage); 301 average = AveragePanstarrsToInternal (tmpAveragePanstarrs, Naverage); 302 free (tmpAveragePanstarrs); 303 break; 304 case DVO_FORMAT_PMTEST: 305 ALLOCATE (tmpAveragePMtest, AveragePMtest, MAX (Naverage, 1)); 306 nitems = fread (tmpAveragePMtest, sizeof(AveragePMtest), Naverage, f); 362 gfits_convert_AveragePanstarrs_DEV_0 (tmpAverage, sizeof(AveragePanstarrs_DEV_0), Naverage); 363 average = AveragePanstarrs_DEV_0_ToInternal (tmpAverage, Naverage); 364 free (tmpAverage); 365 break; } 366 # if 0 367 case DVO_FORMAT_PANSTARRS: { 368 AveragePanstarrs *tmpAverage; 369 ALLOCATE (tmpAverage, AveragePanstarrs, MAX (Naverage, 1)); 370 nitems = fread (tmpAverage, sizeof(AveragePanstarrs), Naverage, f); 307 371 if (nitems != Naverage) { 308 372 fprintf (stderr, "failed to read averages (%d vs %d)\n", nitems, Naverage); 309 373 return (NULL); 310 374 } 311 gfits_convert_AveragePMtest (tmpAveragePMtest, sizeof(AveragePMtest), Naverage); 312 average = AveragePMtestToInternal (tmpAveragePMtest, Naverage); 313 free (tmpAveragePMtest); 314 break; 375 gfits_convert_AveragePanstarrs (tmpAverage, sizeof(AveragePanstarrs), Naverage); 376 average = AveragePanstarrsToInternal (tmpAverage, Naverage); 377 free (tmpAverage); 378 break; } 379 case DVO_FORMAT_PMTEST: { 380 AveragePMtest *tmpAverage; 381 ALLOCATE (tmpAverage, AveragePMtest, MAX (Naverage, 1)); 382 nitems = fread (tmpAverage, sizeof(AveragePMtest), Naverage, f); 383 if (nitems != Naverage) { 384 fprintf (stderr, "failed to read averages (%d vs %d)\n", nitems, Naverage); 385 return (NULL); 386 } 387 gfits_convert_AveragePMtest (tmpAverage, sizeof(AveragePMtest), Naverage); 388 average = AveragePMtestToInternal (tmpAverage, Naverage); 389 free (tmpAverage); 390 break; } 391 # endif 315 392 default: 316 393 fprintf (stderr, "error reading measures\n"); … … 322 399 /* accepts and converts internal average formats and outputs 323 400 raw data in the specified format */ 324 int WriteRawAverage (FILE *f, Average *average, int Naverage, int format ) {401 int WriteRawAverage (FILE *f, Average *average, int Naverage, int format, SecFilt *primary) { 325 402 326 403 int nitems; 327 AverageElixir *tmpAverageElixir;328 AverageLoneos *tmpAverageLoneos;329 AveragePanstarrs *tmpAveragePanstarrs;330 AveragePMtest *tmpAveragePMtest;331 404 332 405 switch (format) { 333 case DVO_FORMAT_INTERNAL: 406 case DVO_FORMAT_INTERNAL: { 334 407 gfits_convert_Average (average, sizeof(Average), Naverage); 335 408 nitems = fwrite (average, sizeof(Average), Naverage, f); … … 338 411 return (FALSE); 339 412 } 340 break; 341 case DVO_FORMAT_ELIXIR: 342 tmpAverageElixir = AverageInternalToElixir (average, Naverage); 343 gfits_convert_AverageElixir (tmpAverageElixir, sizeof(AverageElixir), Naverage); 344 nitems = fwrite (tmpAverageElixir, sizeof(AverageElixir), Naverage, f); 345 free (tmpAverageElixir); 413 break; } 414 case DVO_FORMAT_ELIXIR: { 415 AverageElixir *tmpAverage; 416 tmpAverage = AverageInternalToElixir (average, Naverage, primary); 417 gfits_convert_AverageElixir (tmpAverage, sizeof(AverageElixir), Naverage); 418 nitems = fwrite (tmpAverage, sizeof(AverageElixir), Naverage, f); 419 free (tmpAverage); 346 420 if (nitems != Naverage) { 347 421 fprintf (stderr, "failed to write averages (%d vs %d)\n", nitems, Naverage); 348 422 return (FALSE); 349 423 } 350 break; 351 case DVO_FORMAT_LONEOS: 352 tmpAverageLoneos = AverageInternalToLoneos (average, Naverage); 353 gfits_convert_AverageLoneos (tmpAverageLoneos, sizeof(AverageLoneos), Naverage); 354 nitems = fwrite (tmpAverageLoneos, sizeof(AverageLoneos), Naverage, f); 355 free (tmpAverageLoneos); 424 break; } 425 case DVO_FORMAT_LONEOS: { 426 AverageLoneos *tmpAverage; 427 tmpAverage = AverageInternalToLoneos (average, Naverage, primary); 428 gfits_convert_AverageLoneos (tmpAverage, sizeof(AverageLoneos), Naverage); 429 nitems = fwrite (tmpAverage, sizeof(AverageLoneos), Naverage, f); 430 free (tmpAverage); 356 431 if (nitems != Naverage) { 357 432 fprintf (stderr, "failed to write averages (%d vs %d)\n", nitems, Naverage); 358 433 return (FALSE); 359 434 } 360 break; 361 case DVO_FORMAT_PANSTARRS: 362 tmpAveragePanstarrs = AverageInternalToPanstarrs (average, Naverage); 363 gfits_convert_AveragePanstarrs (tmpAveragePanstarrs, sizeof(AveragePanstarrs), Naverage); 364 nitems = fwrite (tmpAveragePanstarrs, sizeof(AveragePanstarrs), Naverage, f); 365 free (tmpAveragePanstarrs); 435 break; } 436 case DVO_FORMAT_PANSTARRS_DEV_0: { 437 AveragePanstarrs_DEV_0 *tmpAverage; 438 tmpAverage = AverageInternalToPanstarrs_DEV_0 (average, Naverage); 439 gfits_convert_AveragePanstarrs_DEV_0 (tmpAverage, sizeof(AveragePanstarrs_DEV_0), Naverage); 440 nitems = fwrite (tmpAverage, sizeof(AveragePanstarrs_DEV_0), Naverage, f); 441 free (tmpAverage); 366 442 if (nitems != Naverage) { 367 443 fprintf (stderr, "failed to write averages (%d vs %d)\n", nitems, Naverage); 368 444 return (FALSE); 369 445 } 370 break; 371 case DVO_FORMAT_PMTEST: 372 tmpAveragePMtest = AverageInternalToPMtest (average, Naverage); 373 gfits_convert_AveragePMtest (tmpAveragePMtest, sizeof(AveragePMtest), Naverage); 374 nitems = fwrite (tmpAveragePMtest, sizeof(AveragePMtest), Naverage, f); 375 free (tmpAveragePMtest); 446 break; } 447 # if 0 448 case DVO_FORMAT_PANSTARRS: { 449 AveragePanstarrs *tmpAverage; 450 tmpAverage = AverageInternalToPanstarrs (average, Naverage); 451 gfits_convert_AveragePanstarrs (tmpAverage, sizeof(AveragePanstarrs), Naverage); 452 nitems = fwrite (tmpAverage, sizeof(AveragePanstarrs), Naverage, f); 453 free (tmpAverage); 376 454 if (nitems != Naverage) { 377 455 fprintf (stderr, "failed to write averages (%d vs %d)\n", nitems, Naverage); 378 456 return (FALSE); 379 457 } 380 break; 458 break; } 459 case DVO_FORMAT_PMTEST: { 460 AveragePMtest *tmpAverage; 461 tmpAverage = AverageInternalToPMtest (average, Naverage); 462 gfits_convert_AveragePMtest (tmpAverage, sizeof(AveragePMtest), Naverage); 463 nitems = fwrite (tmpAverage, sizeof(AveragePMtest), Naverage, f); 464 free (tmpAverage); 465 if (nitems != Naverage) { 466 fprintf (stderr, "failed to write averages (%d vs %d)\n", nitems, Naverage); 467 return (FALSE); 468 } 469 break; } 470 # endif 381 471 default: 382 472 fprintf (stderr, "error writing averages\n"); … … 392 482 int nitems; 393 483 Measure *measure; 394 MeasureElixir *tmpMeasureElixir;395 MeasureLoneos *tmpMeasureLoneos;396 MeasurePanstarrs *tmpMeasurePanstarrs;397 484 398 485 switch (format) { 399 case DVO_FORMAT_INTERNAL: 486 case DVO_FORMAT_INTERNAL: { 400 487 ALLOCATE (measure, Measure, MAX (Nmeasure, 1)); 401 488 nitems = fread (measure, sizeof(Measure), Nmeasure, f); … … 405 492 } 406 493 gfits_convert_Measure (measure, sizeof(Measure), Nmeasure); 407 break; 408 case DVO_FORMAT_ELIXIR: 409 ALLOCATE (tmpMeasureElixir, MeasureElixir, MAX (Nmeasure, 1)); 410 nitems = fread (tmpMeasureElixir, sizeof(MeasureElixir), Nmeasure, f); 494 break; } 495 case DVO_FORMAT_ELIXIR: { 496 MeasureElixir *tmpMeasure; 497 ALLOCATE (tmpMeasure, MeasureElixir, MAX (Nmeasure, 1)); 498 nitems = fread (tmpMeasure, sizeof(MeasureElixir), Nmeasure, f); 411 499 if (nitems != Nmeasure) { 412 500 fprintf (stderr, "failed to read measures (%d vs %d)\n", nitems, Nmeasure); 413 501 return (NULL); 414 502 } 415 gfits_convert_MeasureElixir (tmpMeasureElixir, sizeof(MeasureElixir), Nmeasure); 416 measure = MeasureElixirToInternal (tmpMeasureElixir, Nmeasure); 417 free (tmpMeasureElixir); 418 break; 419 case DVO_FORMAT_LONEOS: 420 ALLOCATE (tmpMeasureLoneos, MeasureLoneos, MAX (Nmeasure, 1)); 421 nitems = fread (tmpMeasureLoneos, sizeof(MeasureLoneos), Nmeasure, f); 503 gfits_convert_MeasureElixir (tmpMeasure, sizeof(MeasureElixir), Nmeasure); 504 measure = MeasureElixirToInternal (tmpMeasure, Nmeasure); 505 free (tmpMeasure); 506 break; } 507 case DVO_FORMAT_LONEOS: { 508 MeasureLoneos *tmpMeasure; 509 ALLOCATE (tmpMeasure, MeasureLoneos, MAX (Nmeasure, 1)); 510 nitems = fread (tmpMeasure, sizeof(MeasureLoneos), Nmeasure, f); 422 511 if (nitems != Nmeasure) { 423 512 fprintf (stderr, "failed to read measures (%d vs %d)\n", nitems, Nmeasure); 424 513 return (NULL); 425 514 } 426 gfits_convert_MeasureLoneos (tmpMeasure Loneos, sizeof(MeasureLoneos), Nmeasure);427 measure = MeasureLoneosToInternal (tmpMeasure Loneos, Nmeasure);428 free (tmpMeasure Loneos);429 break; 430 case DVO_FORMAT_PANSTARRS :431 case DVO_FORMAT_PMTEST:432 ALLOCATE (tmpMeasure Panstarrs, MeasurePanstarrs, MAX (Nmeasure, 1));433 nitems = fread (tmpMeasure Panstarrs, sizeof(MeasurePanstarrs), Nmeasure, f);515 gfits_convert_MeasureLoneos (tmpMeasure, sizeof(MeasureLoneos), Nmeasure); 516 measure = MeasureLoneosToInternal (tmpMeasure, Nmeasure); 517 free (tmpMeasure); 518 break; } 519 case DVO_FORMAT_PANSTARRS_DEV_0: { 520 MeasurePanstarrs_DEV_0 *tmpMeasure; 521 ALLOCATE (tmpMeasure, MeasurePanstarrs_DEV_0, MAX (Nmeasure, 1)); 522 nitems = fread (tmpMeasure, sizeof(MeasurePanstarrs_DEV_0), Nmeasure, f); 434 523 if (nitems != Nmeasure) { 435 524 fprintf (stderr, "failed to read measures (%d vs %d)\n", nitems, Nmeasure); 436 525 return (NULL); 437 526 } 438 gfits_convert_MeasurePanstarrs (tmpMeasurePanstarrs, sizeof(MeasurePanstarrs), Nmeasure); 439 measure = MeasurePanstarrsToInternal (tmpMeasurePanstarrs, Nmeasure); 440 free (tmpMeasurePanstarrs); 441 break; 527 gfits_convert_MeasurePanstarrs_DEV_0 (tmpMeasure, sizeof(MeasurePanstarrs_DEV_0), Nmeasure); 528 measure = MeasurePanstarrs_DEV_0_ToInternal (tmpMeasure, Nmeasure); 529 free (tmpMeasure); 530 break; } 531 # if 0 532 case DVO_FORMAT_PANSTARRS: { 533 MeasurePanstarrs *tmpMeasure; 534 ALLOCATE (tmpMeasure, MeasurePanstarrs, MAX (Nmeasure, 1)); 535 nitems = fread (tmpMeasure, sizeof(MeasurePanstarrs), Nmeasure, f); 536 if (nitems != Nmeasure) { 537 fprintf (stderr, "failed to read measures (%d vs %d)\n", nitems, Nmeasure); 538 return (NULL); 539 } 540 gfits_convert_MeasurePanstarrs (tmpMeasure, sizeof(MeasurePanstarrs), Nmeasure); 541 measure = MeasurePanstarrsToInternal (tmpMeasure, Nmeasure); 542 free (tmpMeasure); 543 break; } 544 # endif 442 545 default: 443 546 fprintf (stderr, "error reading measures\n"); … … 452 555 453 556 int nitems; 454 MeasureElixir *tmpMeasureElixir;455 MeasureLoneos *tmpMeasureLoneos;456 MeasurePanstarrs *tmpMeasurePanstarrs;457 557 458 558 switch (format) { 459 case DVO_FORMAT_INTERNAL: 559 case DVO_FORMAT_INTERNAL: { 460 560 gfits_convert_Measure (measure, sizeof(Measure), Nmeasure); 461 561 nitems = fwrite (measure, sizeof(Measure), Nmeasure, f); … … 464 564 return (FALSE); 465 565 } 466 break; 467 case DVO_FORMAT_ELIXIR: 468 tmpMeasureElixir = MeasureInternalToElixir (measure, Nmeasure); 469 gfits_convert_MeasureElixir (tmpMeasureElixir, sizeof(MeasureElixir), Nmeasure); 470 nitems = fwrite (tmpMeasureElixir, sizeof(MeasureElixir), Nmeasure, f); 471 free (tmpMeasureElixir); 566 break; } 567 case DVO_FORMAT_ELIXIR: { 568 MeasureElixir *tmpMeasure; 569 tmpMeasure = MeasureInternalToElixir (measure, Nmeasure); 570 gfits_convert_MeasureElixir (tmpMeasure, sizeof(MeasureElixir), Nmeasure); 571 nitems = fwrite (tmpMeasure, sizeof(MeasureElixir), Nmeasure, f); 572 free (tmpMeasure); 472 573 if (nitems != Nmeasure) { 473 574 fprintf (stderr, "failed to write measures (%d vs %d)\n", nitems, Nmeasure); 474 575 return (FALSE); 475 576 } 476 break; 477 case DVO_FORMAT_LONEOS: 478 tmpMeasureLoneos = MeasureInternalToLoneos (measure, Nmeasure); 479 gfits_convert_MeasureLoneos (tmpMeasureLoneos, sizeof(MeasureLoneos), Nmeasure); 480 nitems = fwrite (tmpMeasureLoneos, sizeof(MeasureLoneos), Nmeasure, f); 481 free (tmpMeasureLoneos); 577 break; } 578 case DVO_FORMAT_LONEOS: { 579 MeasureLoneos *tmpMeasure; 580 tmpMeasure = MeasureInternalToLoneos (measure, Nmeasure); 581 gfits_convert_MeasureLoneos (tmpMeasure, sizeof(MeasureLoneos), Nmeasure); 582 nitems = fwrite (tmpMeasure, sizeof(MeasureLoneos), Nmeasure, f); 583 free (tmpMeasure); 482 584 if (nitems != Nmeasure) { 483 585 fprintf (stderr, "failed to write measures (%d vs %d)\n", nitems, Nmeasure); 484 586 return (FALSE); 485 587 } 486 break; 487 case DVO_FORMAT_PANSTARRS :488 case DVO_FORMAT_PMTEST:489 tmpMeasure Panstarrs = MeasureInternalToPanstarrs(measure, Nmeasure);490 gfits_convert_MeasurePanstarrs (tmpMeasurePanstarrs, sizeof(MeasurePanstarrs), Nmeasure);491 nitems = fwrite (tmpMeasure Panstarrs, sizeof(MeasurePanstarrs), Nmeasure, f);492 free (tmpMeasure Panstarrs);588 break; } 589 case DVO_FORMAT_PANSTARRS_DEV_0: { 590 MeasurePanstarrs_DEV_0 *tmpMeasure; 591 tmpMeasure = MeasureInternalToPanstarrs_DEV_0 (measure, Nmeasure); 592 gfits_convert_MeasurePanstarrs_DEV_0 (tmpMeasure, sizeof(MeasurePanstarrs_DEV_0), Nmeasure); 593 nitems = fwrite (tmpMeasure, sizeof(MeasurePanstarrs_DEV_0), Nmeasure, f); 594 free (tmpMeasure); 493 595 if (nitems != Nmeasure) { 494 596 fprintf (stderr, "failed to write measures (%d vs %d)\n", nitems, Nmeasure); 495 597 return (FALSE); 496 598 } 497 break; 599 break; } 600 # if 0 601 case DVO_FORMAT_PANSTARRS: { 602 MeasurePanstarrs *tmpMeasure; 603 tmpMeasure = MeasureInternalToPanstarrs (measure, Nmeasure); 604 gfits_convert_MeasurePanstarrs (tmpMeasure, sizeof(MeasurePanstarrs), Nmeasure); 605 nitems = fwrite (tmpMeasure, sizeof(MeasurePanstarrs), Nmeasure, f); 606 free (tmpMeasure); 607 if (nitems != Nmeasure) { 608 fprintf (stderr, "failed to write measures (%d vs %d)\n", nitems, Nmeasure); 609 return (FALSE); 610 } 611 break; } 612 # endif 498 613 default: 499 614 fprintf (stderr, "error writing measures\n"); … … 509 624 int nitems; 510 625 SecFilt *secfilt; 511 SecFiltElixir *tmpSecFiltElixir;512 SecFiltLoneos *tmpSecFiltLoneos;513 SecFiltPanstarrs *tmpSecFiltPanstarrs;514 626 515 627 switch (format) { 516 case DVO_FORMAT_INTERNAL: 628 case DVO_FORMAT_INTERNAL: { 517 629 ALLOCATE (secfilt, SecFilt, MAX (Nsecfilt, 1)); 518 630 nitems = fread (secfilt, sizeof(SecFilt), Nsecfilt, f); … … 522 634 } 523 635 gfits_convert_SecFilt (secfilt, sizeof(SecFilt), Nsecfilt); 524 break; 525 case DVO_FORMAT_ELIXIR: 526 ALLOCATE (tmpSecFiltElixir, SecFiltElixir, MAX (Nsecfilt, 1)); 527 nitems = fread (tmpSecFiltElixir, sizeof(SecFiltElixir), Nsecfilt, f); 636 break; } 637 case DVO_FORMAT_ELIXIR: { 638 SecFiltElixir *tmpSecFilt; 639 ALLOCATE (tmpSecFilt, SecFiltElixir, MAX (Nsecfilt, 1)); 640 nitems = fread (tmpSecFilt, sizeof(SecFiltElixir), Nsecfilt, f); 528 641 if (nitems != Nsecfilt) { 529 642 fprintf (stderr, "failed to read secfilts (%d vs %d)\n", nitems, Nsecfilt); 530 643 return (NULL); 531 644 } 532 gfits_convert_SecFiltElixir (tmpSecFiltElixir, sizeof(SecFiltElixir), Nsecfilt); 533 secfilt = SecFiltElixirToInternal (tmpSecFiltElixir, Nsecfilt); 534 free (tmpSecFiltElixir); 535 break; 536 case DVO_FORMAT_LONEOS: 537 ALLOCATE (tmpSecFiltLoneos, SecFiltLoneos, MAX (Nsecfilt, 1)); 538 nitems = fread (tmpSecFiltLoneos, sizeof(SecFiltLoneos), Nsecfilt, f); 645 gfits_convert_SecFiltElixir (tmpSecFilt, sizeof(SecFiltElixir), Nsecfilt); 646 secfilt = SecFiltElixirToInternal (tmpSecFilt, Nsecfilt); 647 free (tmpSecFilt); 648 break; } 649 case DVO_FORMAT_LONEOS: { 650 SecFiltLoneos *tmpSecFilt; 651 ALLOCATE (tmpSecFilt, SecFiltLoneos, MAX (Nsecfilt, 1)); 652 nitems = fread (tmpSecFilt, sizeof(SecFiltLoneos), Nsecfilt, f); 539 653 if (nitems != Nsecfilt) { 540 654 fprintf (stderr, "failed to read secfilts (%d vs %d)\n", nitems, Nsecfilt); 541 655 return (NULL); 542 656 } 543 gfits_convert_SecFiltLoneos (tmpSecFilt Loneos, sizeof(SecFiltLoneos), Nsecfilt);544 secfilt = SecFiltLoneosToInternal (tmpSecFilt Loneos, Nsecfilt);545 free (tmpSecFilt Loneos);546 break; 547 case DVO_FORMAT_PANSTARRS :548 case DVO_FORMAT_PMTEST:549 ALLOCATE (tmpSecFilt Panstarrs, SecFiltPanstarrs, MAX (Nsecfilt, 1));550 nitems = fread (tmpSecFilt Panstarrs, sizeof(SecFiltPanstarrs), Nsecfilt, f);657 gfits_convert_SecFiltLoneos (tmpSecFilt, sizeof(SecFiltLoneos), Nsecfilt); 658 secfilt = SecFiltLoneosToInternal (tmpSecFilt, Nsecfilt); 659 free (tmpSecFilt); 660 break; } 661 case DVO_FORMAT_PANSTARRS_DEV_0: { 662 SecFiltPanstarrs_DEV_0 *tmpSecFilt; 663 ALLOCATE (tmpSecFilt, SecFiltPanstarrs_DEV_0, MAX (Nsecfilt, 1)); 664 nitems = fread (tmpSecFilt, sizeof(SecFiltPanstarrs_DEV_0), Nsecfilt, f); 551 665 if (nitems != Nsecfilt) { 552 666 fprintf (stderr, "failed to read secfilts (%d vs %d)\n", nitems, Nsecfilt); 553 667 return (NULL); 554 668 } 555 gfits_convert_SecFiltPanstarrs (tmpSecFiltPanstarrs, sizeof(SecFiltPanstarrs), Nsecfilt); 556 secfilt = SecFiltPanstarrsToInternal (tmpSecFiltPanstarrs, Nsecfilt); 557 free (tmpSecFiltPanstarrs); 558 break; 669 gfits_convert_SecFiltPanstarrs_DEV_0 (tmpSecFilt, sizeof(SecFiltPanstarrs_DEV_0), Nsecfilt); 670 secfilt = SecFiltPanstarrs_DEV_0_ToInternal (tmpSecFilt, Nsecfilt); 671 free (tmpSecFilt); 672 break; } 673 # if 0 674 case DVO_FORMAT_PANSTARRS: { 675 SecFiltPanstarrs *tmpSecFilt; 676 ALLOCATE (tmpSecFilt, SecFiltPanstarrs, MAX (Nsecfilt, 1)); 677 nitems = fread (tmpSecFilt, sizeof(SecFiltPanstarrs), Nsecfilt, f); 678 if (nitems != Nsecfilt) { 679 fprintf (stderr, "failed to read secfilts (%d vs %d)\n", nitems, Nsecfilt); 680 return (NULL); 681 } 682 gfits_convert_SecFiltPanstarrs (tmpSecFilt, sizeof(SecFiltPanstarrs), Nsecfilt); 683 secfilt = SecFiltPanstarrsToInternal (tmpSecFilt, Nsecfilt); 684 free (tmpSecFilt); 685 break; } 686 # endif 559 687 default: 560 688 fprintf (stderr, "error reading measures\n"); … … 569 697 570 698 int nitems; 571 SecFiltElixir *tmpSecFiltElixir;572 SecFiltLoneos *tmpSecFiltLoneos;573 SecFiltPanstarrs *tmpSecFiltPanstarrs;574 699 575 700 switch (format) { 576 case DVO_FORMAT_INTERNAL: 701 case DVO_FORMAT_INTERNAL: { 577 702 gfits_convert_SecFilt (secfilt, sizeof(SecFilt), Nsecfilt); 578 703 nitems = fwrite (secfilt, sizeof(SecFilt), Nsecfilt, f); … … 581 706 return (FALSE); 582 707 } 583 break; 584 case DVO_FORMAT_ELIXIR: 585 tmpSecFiltElixir = SecFiltInternalToElixir (secfilt, Nsecfilt); 586 gfits_convert_SecFiltElixir (tmpSecFiltElixir, sizeof(SecFiltElixir), Nsecfilt); 587 nitems = fwrite (tmpSecFiltElixir, sizeof(SecFiltElixir), Nsecfilt, f); 588 free (tmpSecFiltElixir); 708 break; } 709 case DVO_FORMAT_ELIXIR: { 710 SecFiltElixir *tmpSecFilt; 711 tmpSecFilt = SecFiltInternalToElixir (secfilt, Nsecfilt); 712 gfits_convert_SecFiltElixir (tmpSecFilt, sizeof(SecFiltElixir), Nsecfilt); 713 nitems = fwrite (tmpSecFilt, sizeof(SecFiltElixir), Nsecfilt, f); 714 free (tmpSecFilt); 589 715 if (nitems != Nsecfilt) { 590 716 fprintf (stderr, "failed to write secfilts (%d vs %d)\n", nitems, Nsecfilt); 591 717 return (FALSE); 592 718 } 593 break; 594 case DVO_FORMAT_LONEOS: 595 tmpSecFiltLoneos = SecFiltInternalToLoneos (secfilt, Nsecfilt); 596 gfits_convert_SecFiltLoneos (tmpSecFiltLoneos, sizeof(SecFiltLoneos), Nsecfilt); 597 nitems = fwrite (tmpSecFiltLoneos, sizeof(SecFiltLoneos), Nsecfilt, f); 598 free (tmpSecFiltLoneos); 719 break; } 720 case DVO_FORMAT_LONEOS: { 721 SecFiltLoneos *tmpSecFilt; 722 tmpSecFilt = SecFiltInternalToLoneos (secfilt, Nsecfilt); 723 gfits_convert_SecFiltLoneos (tmpSecFilt, sizeof(SecFiltLoneos), Nsecfilt); 724 nitems = fwrite (tmpSecFilt, sizeof(SecFiltLoneos), Nsecfilt, f); 725 free (tmpSecFilt); 599 726 if (nitems != Nsecfilt) { 600 727 fprintf (stderr, "failed to write secfilts (%d vs %d)\n", nitems, Nsecfilt); 601 728 return (FALSE); 602 729 } 603 break; 604 case DVO_FORMAT_PANSTARRS :605 case DVO_FORMAT_PMTEST:606 tmpSecFilt Panstarrs = SecFiltInternalToPanstarrs(secfilt, Nsecfilt);607 gfits_convert_SecFiltPanstarrs (tmpSecFiltPanstarrs, sizeof(SecFiltPanstarrs), Nsecfilt);608 nitems = fwrite (tmpSecFilt Panstarrs, sizeof(SecFiltPanstarrs), Nsecfilt, f);609 free (tmpSecFilt Panstarrs);730 break; } 731 case DVO_FORMAT_PANSTARRS_DEV_0: { 732 SecFiltPanstarrs_DEV_0 *tmpSecFilt; 733 tmpSecFilt = SecFiltInternalToPanstarrs_DEV_0 (secfilt, Nsecfilt); 734 gfits_convert_SecFiltPanstarrs_DEV_0 (tmpSecFilt, sizeof(SecFiltPanstarrs_DEV_0), Nsecfilt); 735 nitems = fwrite (tmpSecFilt, sizeof(SecFiltPanstarrs_DEV_0), Nsecfilt, f); 736 free (tmpSecFilt); 610 737 if (nitems != Nsecfilt) { 611 738 fprintf (stderr, "failed to write secfilts (%d vs %d)\n", nitems, Nsecfilt); 612 739 return (FALSE); 613 740 } 614 break; 741 break; } 742 # if 0 743 case DVO_FORMAT_PANSTARRS: { 744 SecFiltPanstarrs *tmpSecFilt; 745 tmpSecFilt = SecFiltInternalToPanstarrs (secfilt, Nsecfilt); 746 gfits_convert_SecFiltPanstarrs (tmpSecFilt, sizeof(SecFiltPanstarrs), Nsecfilt); 747 nitems = fwrite (tmpSecFilt, sizeof(SecFiltPanstarrs), Nsecfilt, f); 748 free (tmpSecFilt); 749 if (nitems != Nsecfilt) { 750 fprintf (stderr, "failed to write secfilts (%d vs %d)\n", nitems, Nsecfilt); 751 return (FALSE); 752 } 753 break; } 754 # endif 615 755 default: 616 756 fprintf (stderr, "error writing secfilts\n"); -
trunk/Ohana/src/libdvo/src/dvo_catalog_split.c
r8456 r12332 8 8 Matrix matrix; 9 9 FTable ftable; 10 SecFilt *primary; 10 11 Catalog *measure, *missing, *secfilt; 11 12 … … 54 55 return (FALSE); 55 56 } 56 catalog[0].average = FtableToAverage (&ftable, &catalog[0].Naverage, &catalog[0].catformat); 57 /* old versions of DVO stored one of the average magnitudes in Average. we save this if needed */ 58 catalog[0].average = FtableToAverage (&ftable, &catalog[0].Naverage, &catalog[0].catformat, &primary); 57 59 if (Naverage != catalog[0].Naverage) { 58 60 fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%d vs %d)\n", Naverage, catalog[0].Naverage); … … 240 242 fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%d vs %d)\n", Nexpect, Nitems); 241 243 } 244 245 /* if primary is defined, we were supplied with one additional average magnitude from Average 246 we need to interleave these magnitudes with the secfilt entries just loaded */ 247 if (primary != NULL) { 248 int Ntmpfilt, Ntotal, i, j; 249 SecFilt *tmpfilt; 250 tmpfilt = catalog[0].secfilt; 251 Ntmpfilt = catalog[0].Nsecfilt; 252 Nsecfilt = catalog[0].Nsecfilt + 1; 253 Ntotal = Nsecfilt * catalog[0].Naverage; 254 ALLOCATE (catalog[0].secfilt, SecFilt, Ntotal); 255 for (i = 0; i < catalog[0].Naverage; i++) { 256 catalog[0].secfilt[i*Nsecfilt + 0] = primary[i]; 257 for (j = 0; j < Ntmpfilt; j++) { 258 catalog[0].secfilt[i*Nsecfilt + j + 1] = tmpfilt[i*Ntmpfilt + j]; 259 } 260 } 261 catalog[0].Nsecfilt = Nsecfilt; 262 free (primary); 263 } 264 265 242 266 gfits_free_header (&header); 243 267 gfits_free_matrix (&matrix); 244 } 268 } else { 269 if (primary != NULL) free (primary); 270 } 271 245 272 catalog[0].secfilt_catalog = secfilt; 246 273 … … 254 281 255 282 /* save_catalog_split writes complete new files from scratch */ 256 257 283 int dvo_catalog_save_split (Catalog *catalog, char VERBOSE) { 258 284 … … 261 287 Header header; 262 288 FTable ftable; 263 Catalog *measure, *missing, *secfilt; 289 Catalog *catfile; 290 SecFilt *primary, *secfilt; 291 int i, j, Nsecfilt, Nallfilt, Ntotal; 264 292 265 293 ftable.header = &header; … … 289 317 /* in split mode, we can save only part of the data */ 290 318 319 /* for the appropriate types, pull out the first secfilt and pass to AverageToFtable as primary */ 320 if ((catalog[0].catformat == DVO_FORMAT_ELIXIR) || // special case for ELIXIR 321 (catalog[0].catformat == DVO_FORMAT_LONEOS)) { // special case for LONEOS 322 if (catalog[0].secfilt == NULL) { 323 fprintf (stderr, "missing secfilt, cannot build output averages (dvo_catalog_split.c:544)\n"); 324 exit (1); 325 } 326 secfilt = catalog[0].secfilt; 327 328 Nallfilt = catalog[0].Nsecfilt; 329 Nsecfilt = catalog[0].Nsecfilt - 1; 330 Ntotal = Nsecfilt * catalog[0].Naverage; 331 ALLOCATE (primary, SecFilt, catalog[0].Naverage); 332 ALLOCATE (secfilt, SecFilt, Ntotal); 333 334 for (i = 0; i < catalog[0].Naverage; i++) { 335 primary[i] = secfilt[i*Nallfilt + 0]; 336 for (j = 0; j < Nsecfilt; j++) { 337 secfilt[i*Nsecfilt + j] = catalog[0].secfilt[i*Nallfilt + j + 1]; 338 } 339 } 340 } else { 341 primary = NULL; 342 secfilt = catalog[0].secfilt; 343 Nsecfilt = catalog[0].Nsecfilt; 344 } 345 291 346 /*** Average Table ***/ 292 347 … … 303 358 304 359 /* write out Average table (convert to FITS table format) */ 305 AverageToFtable (&ftable, catalog[0].average, catalog[0].Naverage, catalog[0].catformat );360 AverageToFtable (&ftable, catalog[0].average, catalog[0].Naverage, catalog[0].catformat, primary); 306 361 if (!gfits_fwrite_Theader (catalog[0].f, &header)) { 307 362 fprintf (stderr, "can't write table header"); … … 317 372 318 373 /*** Measure Table ***/ 319 320 374 if (catalog[0].measure != NULL) { 321 375 322 measure = catalog[0].measure_catalog; 376 /* catalog file data is stored in separate structure */ 377 catfile = catalog[0].measure_catalog; 323 378 324 379 /* XXX EAM : warn about this condition; add code to handle? */ … … 329 384 330 385 /* rewind file pointers and truncate (file is still open) */ 331 fseek ( measure[0].f, 0, SEEK_SET);332 ftruncate (fileno ( measure[0].f), 0);386 fseek (catfile[0].f, 0, SEEK_SET); 387 ftruncate (fileno (catfile[0].f), 0); 333 388 334 389 /* write table PHU header */ 335 if (!gfits_fwrite_header ( measure[0].f, &measure[0].header)) {390 if (!gfits_fwrite_header (catfile[0].f, &catfile[0].header)) { 336 391 fprintf (stderr, "can't write primary header"); 337 392 return (FALSE); … … 339 394 340 395 /* this is probably a NOP, do I have to keep it in? */ 341 gfits_create_matrix (& measure[0].header, &matrix);342 if (!gfits_fwrite_matrix ( measure[0].f, &matrix)) {396 gfits_create_matrix (&catfile[0].header, &matrix); 397 if (!gfits_fwrite_matrix (catfile[0].f, &matrix)) { 343 398 fprintf (stderr, "can't write primary matrix"); 344 399 return (FALSE); … … 348 403 /* write out Measure table (convert to FITS table format) */ 349 404 MeasureToFtable (&ftable, catalog[0].measure, catalog[0].Nmeasure, catalog[0].catformat); 350 if (!gfits_fwrite_Theader ( measure[0].f, &header)) {405 if (!gfits_fwrite_Theader (catfile[0].f, &header)) { 351 406 fprintf (stderr, "can't write table header"); 352 407 return (FALSE); 353 408 } 354 if (!gfits_fwrite_table ( measure[0].f, &ftable)) {409 if (!gfits_fwrite_table (catfile[0].f, &ftable)) { 355 410 fprintf (stderr, "can't write table data"); 356 411 return (FALSE); … … 361 416 362 417 /*** Missing Table ***/ 363 364 418 if (catalog[0].missing != NULL) { 365 419 366 missing = catalog[0].missing_catalog; 420 /* catalog data is stored in separate catalog */ 421 catfile = catalog[0].missing_catalog; 367 422 368 423 /* rewind file pointers and truncate (file is still open) */ 369 fseek ( missing[0].f, 0, SEEK_SET);370 ftruncate (fileno ( missing[0].f), 0);424 fseek (catfile[0].f, 0, SEEK_SET); 425 ftruncate (fileno (catfile[0].f), 0); 371 426 372 427 /* write table PHU header */ 373 if (!gfits_fwrite_header ( missing[0].f, &missing[0].header)) {428 if (!gfits_fwrite_header (catfile[0].f, &catfile[0].header)) { 374 429 fprintf (stderr, "can't write primary header"); 375 430 return (FALSE); … … 377 432 378 433 /* this is probably a NOP, do I have to keep it in? */ 379 gfits_create_matrix (& missing[0].header, &matrix);380 if (!gfits_fwrite_matrix ( missing[0].f, &matrix)) {434 gfits_create_matrix (&catfile[0].header, &matrix); 435 if (!gfits_fwrite_matrix (catfile[0].f, &matrix)) { 381 436 fprintf (stderr, "can't write primary matrix"); 382 437 return (FALSE); … … 386 441 /* write out Missing table (convert to FITS table format) */ 387 442 gfits_table_set_Missing (&ftable, catalog[0].missing, catalog[0].Nmissing); 388 if (!gfits_fwrite_Theader ( missing[0].f, &header)) {443 if (!gfits_fwrite_Theader (catfile[0].f, &header)) { 389 444 fprintf (stderr, "can't write table header"); 390 445 return (FALSE); 391 446 } 392 if (!gfits_fwrite_table ( missing[0].f, &ftable)) {447 if (!gfits_fwrite_table (catfile[0].f, &ftable)) { 393 448 fprintf (stderr, "can't write table data"); 394 449 return (FALSE); … … 399 454 400 455 /*** Secfilt Table ***/ 401 402 456 if (catalog[0].secfilt != NULL) { 403 457 404 secfilt = catalog[0].secfilt_catalog; 458 /* catalog file data is stored in a separate catalog structure */ 459 catfile = catalog[0].secfilt_catalog; 405 460 406 461 /* rewind file pointers and truncate (file is still open) */ 407 fseek ( secfilt[0].f, 0, SEEK_SET);408 ftruncate (fileno ( secfilt[0].f), 0);462 fseek (catfile[0].f, 0, SEEK_SET); 463 ftruncate (fileno (catfile[0].f), 0); 409 464 410 465 /* write table PHU header */ 411 if (!gfits_fwrite_header ( secfilt[0].f, &secfilt[0].header)) {466 if (!gfits_fwrite_header (catfile[0].f, &catfile[0].header)) { 412 467 fprintf (stderr, "can't write primary header"); 413 468 return (FALSE); … … 415 470 416 471 /* this is probably a NOP, do I have to keep it in? */ 417 gfits_create_matrix (& secfilt[0].header, &matrix);418 if (!gfits_fwrite_matrix ( secfilt[0].f, &matrix)) {472 gfits_create_matrix (&catfile[0].header, &matrix); 473 if (!gfits_fwrite_matrix (catfile[0].f, &matrix)) { 419 474 fprintf (stderr, "can't write primary matrix"); 420 475 return (FALSE); … … 424 479 /* write out SecFilt table (convert to FITS table format) */ 425 480 Nitems = catalog[0].Naverage * catalog[0].Nsecfilt; 426 SecFiltToFtable (&ftable, catalog[0].secfilt, Nitems, catalog[0].catformat);427 if (!gfits_fwrite_Theader ( secfilt[0].f, &header)) {481 SecFiltToFtable (&ftable, secfilt, Nitems, catalog[0].catformat); 482 if (!gfits_fwrite_Theader (catfile[0].f, &header)) { 428 483 fprintf (stderr, "can't write table header"); 429 484 return (FALSE); 430 485 } 431 if (!gfits_fwrite_table ( secfilt[0].f, &ftable)) {486 if (!gfits_fwrite_table (catfile[0].f, &ftable)) { 432 487 fprintf (stderr, "can't write table data"); 433 488 return (FALSE); … … 435 490 gfits_free_table (&ftable); 436 491 gfits_free_header (&header); 492 } 493 494 /* free temp storage */ 495 if (primary != NULL) { 496 free (primary); 497 free (secfilt); 437 498 } 438 499 … … 453 514 FTable ftable; 454 515 VTable vtable; 455 Catalog *measure, *missing, *secfilt; 516 Catalog *catfile; 517 SecFilt *primary, *secfilt; 518 int j, Nsecfilt, Nallfilt, Ntotal; 456 519 457 520 ftable.header = &header; … … 480 543 } 481 544 545 /** for the appropriate types, pull out the first secfilt and pass to AverageToFtable as primary **/ 546 if ((catalog[0].catformat == DVO_FORMAT_ELIXIR) || // special case for ELIXIR 547 (catalog[0].catformat == DVO_FORMAT_LONEOS)) { // special case for LONEOS 548 if (catalog[0].secfilt == NULL) { 549 fprintf (stderr, "missing secfilt, cannot build output averages (dvo_catalog_split.c:544)\n"); 550 exit (1); 551 } 552 secfilt = catalog[0].secfilt; 553 554 Nallfilt = catalog[0].Nsecfilt; 555 Nsecfilt = catalog[0].Nsecfilt - 1; 556 Ntotal = Nsecfilt * catalog[0].Naverage; 557 ALLOCATE (primary, SecFilt, catalog[0].Naverage); 558 ALLOCATE (secfilt, SecFilt, Ntotal); 559 560 for (i = 0; i < catalog[0].Naverage; i++) { 561 primary[i] = secfilt[i*Nallfilt + 0]; 562 for (j = 0; j < Nsecfilt; j++) { 563 secfilt[i*Nsecfilt + j] = catalog[0].secfilt[i*Nallfilt + j + 1]; 564 } 565 } 566 } else { 567 primary = NULL; 568 secfilt = catalog[0].secfilt; 569 Nsecfilt = catalog[0].Nsecfilt; 570 } 571 482 572 /*** Average Table ***/ 483 484 573 if (catalog[0].average != NULL) { 485 574 … … 492 581 493 582 /* write out Average table (convert to FITS table format) */ 494 AverageToFtable (&ftable, catalog[0].average, catalog[0].Naverage, catalog[0].catformat );583 AverageToFtable (&ftable, catalog[0].average, catalog[0].Naverage, catalog[0].catformat, primary); 495 584 /* convert only output rows to vtable */ 496 585 gfits_table_to_vtable (&ftable, &vtable, catalog[0].Nave_disk, Nout); … … 510 599 511 600 /*** Measure Table ***/ 512 513 601 if (catalog[0].measure != NULL) { 514 602 515 measure = catalog[0].measure_catalog;603 catfile = catalog[0].measure_catalog; 516 604 517 605 /* skip past PHU header and matrix */ 518 Nskip = measure[0].header.size + gfits_matrix_size (&measure[0].header);519 fseek ( measure[0].f, Nskip, SEEK_SET);606 Nskip = catfile[0].header.size + gfits_matrix_size (&catfile[0].header); 607 fseek (catfile[0].f, Nskip, SEEK_SET); 520 608 521 609 Ndisk = catalog[0].Nmeas_disk; … … 547 635 vtable.pad = vtable.size - Nx*Ny; 548 636 549 if (!gfits_fwrite_Theader ( measure[0].f, &header)) {637 if (!gfits_fwrite_Theader (catfile[0].f, &header)) { 550 638 fprintf (stderr, "can't write table header"); 551 639 return (FALSE); 552 640 } 553 if (!gfits_fwrite_vtable ( measure[0].f, &vtable)) {641 if (!gfits_fwrite_vtable (catfile[0].f, &vtable)) { 554 642 fprintf (stderr, "can't write table data"); 555 643 return (FALSE); … … 566 654 if (catalog[0].missing != NULL) { 567 655 568 missing= catalog[0].missing_catalog;656 catfile = catalog[0].missing_catalog; 569 657 570 658 /* rewind file pointers and truncate (file is still open) */ 571 fseek ( missing[0].f, 0, SEEK_SET);572 ftruncate (fileno ( missing[0].f), 0);659 fseek (catfile[0].f, 0, SEEK_SET); 660 ftruncate (fileno (catfile[0].f), 0); 573 661 574 662 /* write table PHU header */ 575 if (!gfits_fwrite_header ( missing[0].f, &missing[0].header)) {663 if (!gfits_fwrite_header (catfile[0].f, &catfile[0].header)) { 576 664 fprintf (stderr, "can't write primary header"); 577 665 return (FALSE); … … 579 667 580 668 /* this is probably a NOP, do I have to keep it in? */ 581 gfits_create_matrix (& missing[0].header, &matrix);582 if (!gfits_fwrite_matrix ( missing[0].f, &matrix)) {669 gfits_create_matrix (&catfile[0].header, &matrix); 670 if (!gfits_fwrite_matrix (catfile[0].f, &matrix)) { 583 671 fprintf (stderr, "can't write primary matrix"); 584 672 return (FALSE); … … 588 676 /* write out Missing table (convert to FITS table format) */ 589 677 gfits_table_set_Missing (&ftable, catalog[0].missing, catalog[0].Nmissing); 590 if (!gfits_fwrite_Theader ( missing[0].f, &header)) {678 if (!gfits_fwrite_Theader (catfile[0].f, &header)) { 591 679 fprintf (stderr, "can't write table header"); 592 680 return (FALSE); 593 681 } 594 if (!gfits_fwrite_table ( missing[0].f, &ftable)) {682 if (!gfits_fwrite_table (catfile[0].f, &ftable)) { 595 683 fprintf (stderr, "can't write table data"); 596 684 return (FALSE); … … 601 689 602 690 /*** Secfilt Table ***/ 603 604 691 if (catalog[0].secfilt != NULL) { 605 692 606 secfilt= catalog[0].secfilt_catalog;693 catfile = catalog[0].secfilt_catalog; 607 694 608 695 /* skip past PHU header and matrix */ 609 Nskip = secfilt[0].header.size + gfits_matrix_size (&secfilt[0].header);610 fseek ( secfilt[0].f, Nskip, SEEK_SET);696 Nskip = catfile[0].header.size + gfits_matrix_size (&catfile[0].header); 697 fseek (catfile[0].f, Nskip, SEEK_SET); 611 698 612 699 /* how many lines to write out? */ … … 616 703 /* convert to output format FITS table */ 617 704 Nitems = catalog[0].Naverage * catalog[0].Nsecfilt; 618 SecFiltToFtable (&ftable, catalog[0].secfilt, Nitems, catalog[0].catformat);705 SecFiltToFtable (&ftable, secfilt, Nitems, catalog[0].catformat); 619 706 /* convert only output rows to vtable */ 620 707 gfits_table_to_vtable (&ftable, &vtable, Ndisk, Nout); 621 708 622 if (!gfits_fwrite_Theader ( secfilt[0].f, &header)) {709 if (!gfits_fwrite_Theader (catfile[0].f, &header)) { 623 710 fprintf (stderr, "can't write table header"); 624 711 return (FALSE); 625 712 } 626 if (!gfits_fwrite_vtable ( secfilt[0].f, &vtable)) {713 if (!gfits_fwrite_vtable (catfile[0].f, &vtable)) { 627 714 fprintf (stderr, "can't write table data"); 628 715 return (FALSE); … … 631 718 gfits_free_table (&ftable); 632 719 gfits_free_header (&header); 720 } 721 722 /* free temp storage */ 723 if (primary != NULL) { 724 free (primary); 725 free (secfilt); 633 726 } 634 727 -
trunk/Ohana/src/libdvo/src/dvo_convert.c
r8456 r12332 13 13 /*** Average / FTable conversion functions ***/ 14 14 15 Average *FtableToAverage (FTable *ftable, int *Naverage, int *format ) {15 Average *FtableToAverage (FTable *ftable, int *Naverage, int *format, SecFilt **primary) { 16 16 17 17 Average *average; 18 18 char extname[80]; 19 20 /* in the Elixir and Loneos cases, we are supplied with an average magnitude in Average 21 in these cases, save these values in primary; otherwise set primary to NULL */ 22 *primary = NULL; 19 23 20 24 /* convert to the internal format */ … … 31 35 AverageElixir *tmpAverage; 32 36 tmpAverage = gfits_table_get_AverageElixir (ftable, Naverage, NULL); 33 average = AverageElixirToInternal (tmpAverage, *Naverage );37 average = AverageElixirToInternal (tmpAverage, *Naverage, primary); 34 38 free (tmpAverage); 35 39 *format = DVO_FORMAT_ELIXIR; … … 39 43 AverageLoneos *tmpAverage; 40 44 tmpAverage = gfits_table_get_AverageLoneos (ftable, Naverage, NULL); 41 average = AverageLoneosToInternal (tmpAverage, *Naverage );45 average = AverageLoneosToInternal (tmpAverage, *Naverage, primary); 42 46 free (tmpAverage); 43 47 *format = DVO_FORMAT_LONEOS; 44 48 return (average); 45 49 } 50 if (!strcmp (extname, "DVO_AVERAGE_PANSTARRS_DEV_0")) { 51 AveragePanstarrs_DEV_0 *tmpAverage; 52 tmpAverage = gfits_table_get_AveragePanstarrs_DEV_0 (ftable, Naverage, NULL); 53 average = AveragePanstarrs_DEV_0_ToInternal (tmpAverage, *Naverage); 54 free (tmpAverage); 55 *format = DVO_FORMAT_PANSTARRS_DEV_0; 56 return (average); 57 } 58 /* disable the new and minimally-used versions for now. 59 put them back in after dev work is further along 60 OR replace with other output formats */ 61 # if 0 46 62 if (!strcmp (extname, "DVO_AVERAGE_PANSTARRS")) { 47 63 AveragePanstarrs *tmpAverage; … … 60 76 return (average); 61 77 } 78 # endif 62 79 63 80 fprintf (stderr, "table format unknown: %s\n", extname); … … 67 84 } 68 85 69 int AverageToFtable (FTable *ftable, Average *average, int Naverage, int format) { 70 71 AverageElixir *tmpAverageElixir; 72 AverageLoneos *tmpAverageLoneos ; 73 AveragePanstarrs *tmpAveragePanstarrs; 74 AveragePMtest *tmpAveragePMtest; 86 int AverageToFtable (FTable *ftable, Average *average, int Naverage, int format, SecFilt *primary) { 87 75 88 76 89 /* convert from the internal format */ 77 90 switch (format) { 78 case DVO_FORMAT_INTERNAL: 91 case DVO_FORMAT_INTERNAL: { 79 92 gfits_table_set_Average (ftable, average, Naverage); 80 break; 81 case DVO_FORMAT_ELIXIR: 82 tmpAverageElixir = AverageInternalToElixir (average, Naverage); 83 gfits_table_set_AverageElixir (ftable, tmpAverageElixir, Naverage); 84 free (tmpAverageElixir); 85 break; 86 case DVO_FORMAT_LONEOS: 87 tmpAverageLoneos = AverageInternalToLoneos (average, Naverage); 88 gfits_table_set_AverageLoneos (ftable, tmpAverageLoneos , Naverage); 89 free (tmpAverageLoneos ); 90 break; 91 case DVO_FORMAT_PANSTARRS: 92 tmpAveragePanstarrs = AverageInternalToPanstarrs (average, Naverage); 93 gfits_table_set_AveragePanstarrs (ftable, tmpAveragePanstarrs, Naverage); 94 free (tmpAveragePanstarrs); 95 break; 96 case DVO_FORMAT_PMTEST: 97 tmpAveragePMtest = AverageInternalToPMtest (average, Naverage); 98 gfits_table_set_AveragePMtest (ftable, tmpAveragePMtest, Naverage); 99 free (tmpAveragePMtest); 100 break; 93 break; } 94 case DVO_FORMAT_ELIXIR: { 95 AverageElixir *tmpAverage; 96 tmpAverage = AverageInternalToElixir (average, Naverage, primary); 97 gfits_table_set_AverageElixir (ftable, tmpAverage, Naverage); 98 free (tmpAverage); 99 break; } 100 case DVO_FORMAT_LONEOS: { 101 AverageLoneos *tmpAverage ; 102 tmpAverage = AverageInternalToLoneos (average, Naverage, primary); 103 gfits_table_set_AverageLoneos (ftable, tmpAverage, Naverage); 104 free (tmpAverage ); 105 break; } 106 case DVO_FORMAT_PANSTARRS_DEV_0: { 107 AveragePanstarrs_DEV_0 *tmpAverage; 108 tmpAverage = AverageInternalToPanstarrs_DEV_0 (average, Naverage); 109 gfits_table_set_AveragePanstarrs_DEV_0 (ftable, tmpAverage, Naverage); 110 free (tmpAverage); 111 break; } 112 # if 0 113 case DVO_FORMAT_PANSTARRS: { 114 AveragePanstarrs *tmpAverage; 115 tmpAverage = AverageInternalToPanstarrs (average, Naverage); 116 gfits_table_set_AveragePanstarrs (ftable, tmpAverage, Naverage); 117 free (tmpAverage); 118 break; } 119 case DVO_FORMAT_PMTEST: { 120 AveragePMtest *tmpAverage; 121 tmpAverage = AverageInternalToPMtest (average, Naverage); 122 gfits_table_set_AveragePMtest (ftable, tmpAverage, Naverage); 123 free (tmpAverage); 124 break; } 125 # endif 101 126 default: 102 127 fprintf (stderr, "table format unknown (average)\n"); … … 139 164 return (measure); 140 165 } 166 if (!strcmp (extname, "DVO_MEASURE_PANSTARRS_DEV_0")) { 167 MeasurePanstarrs_DEV_0 *tmpMeasure; 168 tmpMeasure = gfits_table_get_MeasurePanstarrs_DEV_0 (ftable, Nmeasure, NULL); 169 measure = MeasurePanstarrs_DEV_0_ToInternal (tmpMeasure, *Nmeasure); 170 free (tmpMeasure); 171 *format = DVO_FORMAT_PANSTARRS_DEV_0; 172 return (measure); 173 } 174 # if 0 141 175 if (!strcmp (extname, "DVO_MEASURE_PANSTARRS") || !strcmp (extname, "DVO_MEASURE_PMTEST")) { 142 176 MeasurePanstarrs *tmpMeasure; … … 147 181 return (measure); 148 182 } 183 # endif 149 184 150 185 fprintf (stderr, "table format unknown: %s\n", extname); … … 156 191 int MeasureToFtable (FTable *ftable, Measure *measure, int Nmeasure, int format) { 157 192 158 MeasureElixir *tmpMeasureElixir;159 MeasureLoneos *tmpMeasureLoneos;160 MeasurePanstarrs *tmpMeasurePanstarrs;161 193 162 194 /* convert from the internal format */ 163 195 switch (format) { 164 case DVO_FORMAT_INTERNAL: 196 case DVO_FORMAT_INTERNAL: { 165 197 gfits_table_set_Measure (ftable, measure, Nmeasure); 166 break; 167 case DVO_FORMAT_ELIXIR: 168 tmpMeasureElixir = MeasureInternalToElixir (measure, Nmeasure); 169 gfits_table_set_MeasureElixir (ftable, tmpMeasureElixir, Nmeasure); 170 free (tmpMeasureElixir); 171 break; 172 case DVO_FORMAT_LONEOS: 173 tmpMeasureLoneos = MeasureInternalToLoneos (measure, Nmeasure); 174 gfits_table_set_MeasureLoneos (ftable, tmpMeasureLoneos, Nmeasure); 175 free (tmpMeasureLoneos); 176 break; 177 case DVO_FORMAT_PANSTARRS: 178 case DVO_FORMAT_PMTEST: 179 tmpMeasurePanstarrs = MeasureInternalToPanstarrs (measure, Nmeasure); 180 gfits_table_set_MeasurePanstarrs (ftable, tmpMeasurePanstarrs, Nmeasure); 181 free (tmpMeasurePanstarrs); 182 break; 198 break; } 199 case DVO_FORMAT_ELIXIR: { 200 MeasureElixir *tmpMeasure; 201 tmpMeasure = MeasureInternalToElixir (measure, Nmeasure); 202 gfits_table_set_MeasureElixir (ftable, tmpMeasure, Nmeasure); 203 free (tmpMeasure); 204 break; } 205 case DVO_FORMAT_LONEOS: { 206 MeasureLoneos *tmpMeasure; 207 tmpMeasure = MeasureInternalToLoneos (measure, Nmeasure); 208 gfits_table_set_MeasureLoneos (ftable, tmpMeasure, Nmeasure); 209 free (tmpMeasure); 210 break; } 211 case DVO_FORMAT_PANSTARRS_DEV_0: { 212 MeasurePanstarrs_DEV_0 *tmpMeasure; 213 tmpMeasure = MeasureInternalToPanstarrs_DEV_0 (measure, Nmeasure); 214 gfits_table_set_MeasurePanstarrs_DEV_0 (ftable, tmpMeasure, Nmeasure); 215 free (tmpMeasure); 216 break; } 217 # if 0 218 case DVO_FORMAT_PANSTARRS: { 219 MeasurePanstarrs *tmpMeasure; 220 tmpMeasure = MeasureInternalToPanstarrs (measure, Nmeasure); 221 gfits_table_set_MeasurePanstarrs (ftable, tmpMeasure, Nmeasure); 222 free (tmpMeasure); 223 break; } 224 # endif 183 225 default: 184 226 fprintf (stderr, "table format unknown (measure)\n"); … … 221 263 return (secfilt); 222 264 } 265 if (!strcmp (extname, "DVO_SECFILT_PANSTARRS_DEV_0")) { 266 SecFiltPanstarrs_DEV_0 *tmpSecFilt; 267 tmpSecFilt = gfits_table_get_SecFiltPanstarrs_DEV_0 (ftable, Nsecfilt, NULL); 268 secfilt = SecFiltPanstarrs_DEV_0_ToInternal (tmpSecFilt, *Nsecfilt); 269 free (tmpSecFilt); 270 *format = DVO_FORMAT_PANSTARRS_DEV_0; 271 return (secfilt); 272 } 273 # if 0 223 274 if (!strcmp (extname, "DVO_SECFILT_PANSTARRS") || !strcmp (extname, "DVO_SECFILT_PMTEST")) { 224 275 SecFiltPanstarrs *tmpSecFilt; … … 229 280 return (secfilt); 230 281 } 282 # endif 231 283 232 284 fprintf (stderr, "table format unknown: %s\n", extname); … … 238 290 int SecFiltToFtable (FTable *ftable, SecFilt *secfilt, int Nsecfilt, int format) { 239 291 240 SecFiltElixir *tmpSecFiltElixir;241 SecFiltLoneos *tmpSecFiltLoneos;242 SecFiltPanstarrs *tmpSecFiltPanstarrs;243 244 292 /* convert from the internal format */ 245 293 switch (format) { 246 case DVO_FORMAT_INTERNAL: 294 case DVO_FORMAT_INTERNAL: { 247 295 gfits_table_set_SecFilt (ftable, secfilt, Nsecfilt); 248 break; 249 case DVO_FORMAT_ELIXIR: 250 tmpSecFiltElixir = SecFiltInternalToElixir (secfilt, Nsecfilt); 251 gfits_table_set_SecFiltElixir (ftable, tmpSecFiltElixir, Nsecfilt); 252 free (tmpSecFiltElixir); 253 break; 254 case DVO_FORMAT_LONEOS: 255 tmpSecFiltLoneos = SecFiltInternalToLoneos (secfilt, Nsecfilt); 256 gfits_table_set_SecFiltLoneos (ftable, tmpSecFiltLoneos, Nsecfilt); 257 free (tmpSecFiltLoneos); 258 break; 259 case DVO_FORMAT_PANSTARRS: 260 case DVO_FORMAT_PMTEST: 261 tmpSecFiltPanstarrs = SecFiltInternalToPanstarrs (secfilt, Nsecfilt); 262 gfits_table_set_SecFiltPanstarrs (ftable, tmpSecFiltPanstarrs, Nsecfilt); 263 free (tmpSecFiltPanstarrs); 264 break; 296 break; } 297 case DVO_FORMAT_ELIXIR: { 298 SecFiltElixir *tmpSecFilt; 299 tmpSecFilt = SecFiltInternalToElixir (secfilt, Nsecfilt); 300 gfits_table_set_SecFiltElixir (ftable, tmpSecFilt, Nsecfilt); 301 free (tmpSecFilt); 302 break; } 303 case DVO_FORMAT_LONEOS: { 304 SecFiltLoneos *tmpSecFilt; 305 tmpSecFilt = SecFiltInternalToLoneos (secfilt, Nsecfilt); 306 gfits_table_set_SecFiltLoneos (ftable, tmpSecFilt, Nsecfilt); 307 free (tmpSecFilt); 308 break; } 309 case DVO_FORMAT_PANSTARRS_DEV_0: { 310 SecFiltPanstarrs_DEV_0 *tmpSecFilt; 311 tmpSecFilt = SecFiltInternalToPanstarrs_DEV_0 (secfilt, Nsecfilt); 312 gfits_table_set_SecFiltPanstarrs_DEV_0 (ftable, tmpSecFilt, Nsecfilt); 313 free (tmpSecFilt); 314 break; } 315 # if 0 316 case DVO_FORMAT_PANSTARRS: { 317 SecFiltPanstarrs *tmpSecFilt; 318 tmpSecFilt = SecFiltInternalToPanstarrs (secfilt, Nsecfilt); 319 gfits_table_set_SecFiltPanstarrs (ftable, tmpSecFilt, Nsecfilt); 320 free (tmpSecFilt); 321 break; } 322 # endif 265 323 default: 266 324 fprintf (stderr, "table format unknown (secfilt)\n"); … … 278 336 279 337 /* extname may be set from outside if the source is RAW not MEF */ 280 if (*format == DVO_FORMAT_ELIXIR) { 338 if (*format == DVO_FORMAT_ELIXIR) { // special case for ELIXIR 281 339 ImageElixir *tmpimage; 282 340 tmpimage = gfits_table_get_ImageElixir (ftable, &Nimage, NULL); … … 313 371 goto set_header; 314 372 } 373 if (!strcmp (extname, "DVO_IMAGE_PANSTARRS_DEV_0")) { 374 ImagePanstarrs_DEV_0 *tmpimage; 375 *format = DVO_FORMAT_PANSTARRS_DEV_0; 376 tmpimage = gfits_table_get_ImagePanstarrs_DEV_0 (ftable, &Nimage, NULL); 377 ftable[0].buffer = (char *) ImagePanstarrs_DEV_0_ToInternal (tmpimage, Nimage); 378 free (tmpimage); 379 goto set_header; 380 } 381 # if 0 315 382 if (!strcmp (extname, "DVO_IMAGE_PANSTARRS") || !strcmp (extname, "DVO_IMAGE_PMTEST")) { 316 383 ImagePanstarrs *tmpimage; … … 321 388 goto set_header; 322 389 } 390 # endif 323 391 fprintf (stderr, "table format unknown: %s\n", extname); 324 392 return (FALSE); … … 336 404 337 405 int Nimage; 338 ImageElixir *tmpImageElixir;339 ImageLoneos *tmpImageLoneos;340 ImagePanstarrs *tmpImagePanstarrs;341 406 342 407 Nimage = theader[0].Naxis[1]; … … 344 409 /* convert from the internal format */ 345 410 switch (format) { 346 case DVO_FORMAT_INTERNAL: 411 case DVO_FORMAT_INTERNAL: { 347 412 gfits_convert_Image ((Image *) ftable[0].buffer, sizeof(Image), Nimage); 348 break; 349 case DVO_FORMAT_ELIXIR: 350 tmpImageElixir = ImageInternalToElixir ((Image *) ftable[0].buffer, Nimage); 413 break; } 414 case DVO_FORMAT_ELIXIR: { 415 ImageElixir *tmpImage; 416 tmpImage = ImageInternalToElixir ((Image *) ftable[0].buffer, Nimage); 351 417 free (ftable[0].buffer); 352 gfits_table_set_ImageElixir (ftable, tmpImageElixir, Nimage); 353 free (tmpImageElixir); 354 break; 355 case DVO_FORMAT_LONEOS: 356 tmpImageLoneos = ImageInternalToLoneos ((Image *) ftable[0].buffer, Nimage); 418 gfits_table_set_ImageElixir (ftable, tmpImage, Nimage); 419 free (tmpImage); 420 break; } 421 case DVO_FORMAT_LONEOS: { 422 ImageLoneos *tmpImage; 423 tmpImage = ImageInternalToLoneos ((Image *) ftable[0].buffer, Nimage); 357 424 free (ftable[0].buffer); 358 gfits_table_set_ImageLoneos (ftable, tmpImage Loneos, Nimage);359 free (tmpImage Loneos);360 break; 361 case DVO_FORMAT_PANSTARRS :362 case DVO_FORMAT_PMTEST:363 tmpImage Panstarrs = ImageInternalToPanstarrs((Image *) ftable[0].buffer, Nimage);425 gfits_table_set_ImageLoneos (ftable, tmpImage, Nimage); 426 free (tmpImage); 427 break; } 428 case DVO_FORMAT_PANSTARRS_DEV_0: { 429 ImagePanstarrs_DEV_0 *tmpImage; 430 tmpImage = ImageInternalToPanstarrs_DEV_0 ((Image *) ftable[0].buffer, Nimage); 364 431 free (ftable[0].buffer); 365 gfits_table_set_ImagePanstarrs (ftable, tmpImagePanstarrs, Nimage); 366 free (tmpImagePanstarrs); 367 break; 432 gfits_table_set_ImagePanstarrs_DEV_0 (ftable, tmpImage, Nimage); 433 free (tmpImage); 434 break; } 435 # if 0 436 case DVO_FORMAT_PANSTARRS: { 437 ImagePanstarrs *tmpImage; 438 tmpImage = ImageInternalToPanstarrs ((Image *) ftable[0].buffer, Nimage); 439 free (ftable[0].buffer); 440 gfits_table_set_ImagePanstarrs (ftable, tmpImage, Nimage); 441 free (tmpImage); 442 break; } 443 # endif 368 444 default: 369 445 fprintf (stderr, "table format unknown (image ftable)\n"); … … 375 451 int ImageToVtable (VTable *vtable, Header *theader, int format) { 376 452 377 ImageElixir *tmpImageElixir;378 ImageLoneos *tmpImageLoneos;379 ImagePanstarrs *tmpImagePanstarrs;380 453 int i, Nrow, Nimage; 381 454 … … 384 457 /* convert from the internal format */ 385 458 switch (format) { 386 case DVO_FORMAT_INTERNAL: 459 case DVO_FORMAT_INTERNAL: { 387 460 for (i = 0; i < Nrow; i++) { 388 461 gfits_convert_Image ((Image *) vtable[0].buffer[i], sizeof(Image), 1); 389 462 } 390 return (TRUE); 391 case DVO_FORMAT_ELIXIR: 463 return (TRUE); } 464 case DVO_FORMAT_ELIXIR: { 465 ImageElixir *tmpImage; 392 466 /* convert table rows from internal to external format */ 393 467 for (i = 0; i < Nrow; i++) { 394 tmpImage Elixir= ImageInternalToElixir ((Image *) vtable[0].buffer[i], 1);395 gfits_convert_ImageElixir (tmpImage Elixir, sizeof(ImageElixir), 1);468 tmpImage = ImageInternalToElixir ((Image *) vtable[0].buffer[i], 1); 469 gfits_convert_ImageElixir (tmpImage, sizeof(ImageElixir), 1); 396 470 free (vtable[0].buffer[i]); 397 vtable[0].buffer[i] = (char *) tmpImage Elixir;471 vtable[0].buffer[i] = (char *) tmpImage; 398 472 } 399 473 … … 407 481 theader[0].Naxis[1] = Nimage; 408 482 vtable[0].size = gfits_matrix_size (theader); 409 return (TRUE); 410 case DVO_FORMAT_LONEOS: 483 return (TRUE); } 484 case DVO_FORMAT_LONEOS: { 485 ImageLoneos *tmpImage; 411 486 /* convert table rows from internal to external format */ 412 487 for (i = 0; i < Nrow; i++) { 413 tmpImage Loneos= ImageInternalToLoneos ((Image *) vtable[0].buffer[i], 1);414 gfits_convert_ImageLoneos (tmpImage Loneos, sizeof(ImageLoneos), 1);488 tmpImage = ImageInternalToLoneos ((Image *) vtable[0].buffer[i], 1); 489 gfits_convert_ImageLoneos (tmpImage, sizeof(ImageLoneos), 1); 415 490 free (vtable[0].buffer[i]); 416 vtable[0].buffer[i] = (char *) tmpImage Loneos;491 vtable[0].buffer[i] = (char *) tmpImage; 417 492 } 418 493 … … 426 501 theader[0].Naxis[1] = Nimage; 427 502 vtable[0].size = gfits_matrix_size (theader); 428 return (TRUE); 429 case DVO_FORMAT_PANSTARRS :430 case DVO_FORMAT_PMTEST:503 return (TRUE); } 504 case DVO_FORMAT_PANSTARRS_DEV_0: { 505 ImagePanstarrs_DEV_0 *tmpImage; 431 506 /* convert table rows from internal to external format */ 432 507 for (i = 0; i < Nrow; i++) { 433 tmpImage Panstarrs = ImageInternalToPanstarrs((Image *) vtable[0].buffer[i], 1);434 gfits_convert_ImagePanstarrs (tmpImagePanstarrs, sizeof(ImagePanstarrs), 1);508 tmpImage = ImageInternalToPanstarrs_DEV_0 ((Image *) vtable[0].buffer[i], 1); 509 gfits_convert_ImagePanstarrs_DEV_0 (tmpImage, sizeof(ImagePanstarrs_DEV_0), 1); 435 510 free (vtable[0].buffer[i]); 436 vtable[0].buffer[i] = (char *) tmpImage Panstarrs;511 vtable[0].buffer[i] = (char *) tmpImage; 437 512 } 438 513 /* convert header from old format to new format */ 514 gfits_scan (theader, "NAXIS2", "%d", 1, &Nimage); 515 gfits_free_header (theader); 516 gfits_table_mkheader_ImagePanstarrs_DEV_0 (theader); 517 gfits_modify (theader, "NAXIS2", "%d", 1, Nimage); 518 theader[0].Naxis[1] = Nimage; 519 vtable[0].size = gfits_matrix_size (theader); 520 return (TRUE); } 521 # if 0 522 case DVO_FORMAT_PANSTARRS: { 523 ImagePanstarrs *tmpImage; 524 /* convert table rows from internal to external format */ 525 for (i = 0; i < Nrow; i++) { 526 tmpImage = ImageInternalToPanstarrs ((Image *) vtable[0].buffer[i], 1); 527 gfits_convert_ImagePanstarrs (tmpImage, sizeof(ImagePanstarrs), 1); 528 free (vtable[0].buffer[i]); 529 vtable[0].buffer[i] = (char *) tmpImage; 530 } 439 531 /* convert header from old format to new format */ 440 532 gfits_scan (theader, "NAXIS2", "%d", 1, &Nimage); … … 444 536 theader[0].Naxis[1] = Nimage; 445 537 vtable[0].size = gfits_matrix_size (theader); 446 return (TRUE); 538 return (TRUE); } 539 # endif 447 540 default: 448 541 break; -
trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c
r6683 r12332 10 10 11 11 for (i = 0; i < Nvalues; i++) { 12 out[i].dR_PS = in[i].dR * 0.01; 13 out[i].dD_PS = in[i].dD * 0.01; 14 out[i].M_PS = in[i].M * 0.001; 15 out[i].dM_PS = in[i].dM * 0.001; 16 out[i].dt_PS = in[i].dt * 0.001; 17 out[i].Mcal_PS = in[i].Mcal * 0.001; 18 out[i].Mgal_PS = in[i].Mgal * 0.001; 19 out[i].airmass_PS = in[i].airmass * 0.001; 12 out[i].dR = in[i].dR * 0.01; 13 out[i].dD = in[i].dD * 0.01; 14 out[i].M = in[i].M * 0.001; 15 out[i].dM = in[i].dM * 0.001; 16 out[i].dt = in[i].dt * 0.001; 17 out[i].Mcal = in[i].Mcal * 0.001; 18 out[i].Mgal = in[i].Mgal * 0.001; 19 out[i].airmass = in[i].airmass * 0.001; 20 out[i].FWx = in[i].FWx; 21 out[i].FWy = in[i].fwy * in[i].FWx * 0.01; 22 out[i].theta = in[i].theta*(0x10000 / 0x100); 23 out[i].dophot = in[i].dophot; 24 out[i].photcode = in[i].source; 25 out[i].t = in[i].t; 26 out[i].averef = in[i].averef; 27 out[i].flags = in[i].flags; 28 29 /* these can be determined if needed / desired */ 30 out[i].Xccd = 0; 31 out[i].Yccd = 0; 32 out[i].dXccd = 0; 33 out[i].dYccd = 0; 34 35 /* these do not have a corresponding value */ 36 out[i].stargal = 0; 37 out[i].Sky = 0; 38 out[i].dSky = 0; 39 out[i].qPSF = 0; 40 41 /* XXX add these later */ 42 out[i].detID_hi = 0; 43 out[i].detID_lo = 0; 44 out[i].imageID_hi = 0; 45 out[i].imageID_lo = 0; 46 } 47 return (out); 48 } 49 50 /* convert internal measures to elixir-format measures */ 51 MeasureElixir *MeasureInternalToElixir (Measure *in, int Nvalues) { 52 53 int i; 54 MeasureElixir *out; 55 56 ALLOCATE (out, MeasureElixir, Nvalues); 57 58 for (i = 0; i < Nvalues; i++) { 59 out[i].dR = in[i].dR * 100.0; 60 out[i].dD = in[i].dD * 100.0; 61 out[i].M = in[i].M * 1000.0; 62 out[i].dM = in[i].dM * 1000.0; 63 out[i].dt = in[i].dt * 1000.0; 64 out[i].Mcal = in[i].Mcal * 1000.0; 65 out[i].Mgal = in[i].Mgal * 1000.0; 66 out[i].airmass = in[i].airmass * 1000.0; 20 67 out[i].FWx = in[i].FWx; 21 out[i]. FWy = in[i].fwy * in[i].FWx * 0.01;22 out[i].theta = in[i].theta ;68 out[i].fwy = in[i].FWy * 100.0 / in[i].FWx; 69 out[i].theta = in[i].theta*(0x100/ 0x10000); 23 70 out[i].dophot = in[i].dophot; 24 out[i].source = in[i]. source;71 out[i].source = in[i].photcode; 25 72 out[i].t = in[i].t; 26 73 out[i].averef = in[i].averef; … … 30 77 } 31 78 32 /* convert internal measures to elixir-format measures */33 MeasureElixir *MeasureInternalToElixir (Measure *in, int Nvalues) {34 35 int i;36 MeasureElixir *out;37 38 ALLOCATE (out, MeasureElixir, Nvalues);39 40 for (i = 0; i < Nvalues; i++) {41 out[i].dR = in[i].dR_PS * 100.0;42 out[i].dD = in[i].dD_PS * 100.0;43 out[i].M = in[i].M_PS * 1000.0;44 out[i].dM = in[i].dM_PS * 1000.0;45 out[i].dt = in[i].dt_PS * 1000.0;46 out[i].Mcal = in[i].Mcal_PS * 1000.0;47 out[i].Mgal = in[i].Mgal_PS * 1000.0;48 out[i].airmass = in[i].airmass_PS * 1000.0;49 out[i].FWx = in[i].FWx;50 out[i].fwy = 100.0 * in[i].FWy / in[i].FWx;51 out[i].theta = in[i].theta;52 out[i].dophot = in[i].dophot;53 out[i].source = in[i].source;54 out[i].t = in[i].t;55 out[i].averef = in[i].averef;56 out[i].flags = in[i].flags;57 }58 return (out);59 }60 61 79 /* convert elixir-format averages to internal averages */ 62 Average *AverageElixirToInternal (AverageElixir *in, int Nvalues ) {80 Average *AverageElixirToInternal (AverageElixir *in, int Nvalues, SecFilt **primary) { 63 81 64 82 int i; … … 66 84 67 85 ALLOCATE (out, Average, Nvalues); 86 ALLOCATE (*primary, SecFilt, Nvalues); 68 87 69 88 for (i = 0; i < Nvalues; i++) { 70 89 out[i].R = in[i].R; 71 90 out[i].D = in[i].D; 72 out[i].M = in[i].M * 0.001;73 out[i].dM = in[i].dM * 0.001;74 91 out[i].Xp = in[i].Xp; 75 out[i].Xm = in[i].Xm;76 92 out[i].Nm = in[i].Nm; 77 93 out[i].Nn = in[i].Nn; … … 79 95 out[i].offset = in[i].offset; 80 96 out[i].missing = in[i].missing; 81 out[i].Xg = in[i].Xg;82 97 83 98 /* these don't exist in Elixir */ … … 90 105 out[i].P = 0; 91 106 out[i].dP = 0; 107 108 /* XXX add these later */ 109 out[i].objID_hi = 0; 110 out[i].objID_lo = 0; 111 112 primary[0][i].M = in[i].M * 0.001; 113 primary[0][i].dM = in[i].dM * 0.001; 114 primary[0][i].Xm = in[i].Xm; 115 primary[0][i].Ncode = 0; 116 primary[0][i].Nused = 0; 117 118 // XXX drop this or keep this? 119 // primary[0][i].Xg = in[i].Xg; 92 120 } 93 121 return (out); … … 95 123 96 124 /* convert internal averages to elixir-format averages */ 97 AverageElixir *AverageInternalToElixir (Average *in, int Nvalues ) {125 AverageElixir *AverageInternalToElixir (Average *in, int Nvalues, SecFilt *primary) { 98 126 99 127 int i; … … 105 133 out[i].R = in[i].R; 106 134 out[i].D = in[i].D; 107 out[i].M = in[i].M * 1000.0;108 out[i].dM = in[i].dM * 1000.0;109 135 out[i].Xp = in[i].Xp; 110 out[i].Xm = in[i].Xm;111 136 out[i].Nm = in[i].Nm; 112 137 out[i].Nn = in[i].Nn; … … 114 139 out[i].offset = in[i].offset; 115 140 out[i].missing = in[i].missing; 116 out[i].Xg = in[i].Xg; 141 142 out[i].M = primary[i].M * 1000.0; 143 out[i].dM = primary[i].dM * 1000.0; 144 out[i].Xm = primary[i].Xm; 145 // out[i].Xg = in[i].Xg; 117 146 } 118 147 return (out); … … 128 157 129 158 for (i = 0; i < Nvalues; i++) { 130 out[i].M_PS = in[i].M * 0.001; 131 out[i].dM_PS = in[i].dM * 0.001; 132 out[i].Xm = in[i].Xm; 159 out[i].M = in[i].M * 0.001; 160 out[i].dM = in[i].dM * 0.001; 161 out[i].Xm = in[i].Xm; 162 out[i].Ncode = 0; 163 out[i].Nused = 0; 133 164 } 134 165 return (out); … … 144 175 145 176 for (i = 0; i < Nvalues; i++) { 146 out[i].M = in[i].M _PS* 1000.0;147 out[i].dM = in[i].dM _PS* 1000.0;177 out[i].M = in[i].M * 1000.0; 178 out[i].dM = in[i].dM * 1000.0; 148 179 out[i].Xm = in[i].Xm; 149 180 } … … 166 197 out[i].tzero = in[i].tzero; 167 198 out[i].nstar = in[i].nstar; 168 out[i].secz _PS= in[i].secz * 0.001;199 out[i].secz = in[i].secz * 0.001; 169 200 out[i].NX = in[i].NX; 170 201 out[i].NY = in[i].NY; 171 out[i].apmifit _PS= in[i].apmifit * 0.001;172 out[i].dapmifit _PS= in[i].dapmifit * 0.001;173 out[i].Mcal _PS= in[i].Mcal * 0.001;174 out[i].dMcal _PS= in[i].dMcal * 0.001;202 out[i].apmifit = in[i].apmifit * 0.001; 203 out[i].dapmifit = in[i].dapmifit * 0.001; 204 out[i].Mcal = in[i].Mcal * 0.001; 205 out[i].dMcal = in[i].dMcal * 0.001; 175 206 out[i].Xm = in[i].Xm; 176 out[i]. source = in[i].source;207 out[i].photcode = in[i].source; 177 208 out[i].exptime = in[i].exptime; 178 209 out[i].detection_limit = in[i].detection_limit; … … 199 230 out[i].Mxyyy = in[i].Mxyyy; 200 231 out[i].Myyyy = in[i].Myyyy; 232 233 /* XXX add these later */ 234 out[i].imageID_hi = 0; 235 out[i].imageID_lo = 0; 201 236 } 202 237 return (out); … … 218 253 out[i].tzero = in[i].tzero; 219 254 out[i].nstar = in[i].nstar; 220 out[i].secz = in[i].secz _PS* 1000.0;255 out[i].secz = in[i].secz * 1000.0; 221 256 out[i].NX = in[i].NX; 222 257 out[i].NY = in[i].NY; 223 out[i].apmifit = in[i].apmifit _PS* 1000.0;224 out[i].dapmifit = in[i].dapmifit _PS* 1000.0;225 out[i].Mcal = in[i].Mcal _PS* 1000.0;226 out[i].dMcal = in[i].dMcal _PS* 1000.0;258 out[i].apmifit = in[i].apmifit * 1000.0; 259 out[i].dapmifit = in[i].dapmifit * 1000.0; 260 out[i].Mcal = in[i].Mcal * 1000.0; 261 out[i].dMcal = in[i].dMcal * 1000.0; 227 262 out[i].Xm = in[i].Xm; 228 out[i].source = in[i]. source;263 out[i].source = in[i].photcode; 229 264 out[i].exptime = in[i].exptime; 230 265 out[i].detection_limit = in[i].detection_limit; -
trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c
r6683 r12332 10 10 11 11 for (i = 0; i < Nvalues; i++) { 12 out[i].dR _PS= in[i].dR * 0.01;13 out[i].dD _PS= in[i].dD * 0.01;14 out[i].M _PS= in[i].M * 0.001;15 out[i].dM _PS= in[i].dM * 0.001;16 out[i].Mcal _PS= in[i].Mcal * 0.001;12 out[i].dR = in[i].dR * 0.01; 13 out[i].dD = in[i].dD * 0.01; 14 out[i].M = in[i].M * 0.001; 15 out[i].dM = in[i].dM * 0.001; 16 out[i].Mcal = in[i].Mcal * 0.001; 17 17 out[i].dophot = in[i].dophot; 18 out[i]. source = in[i].source;18 out[i].photcode = in[i].source; 19 19 out[i].t = in[i].t; 20 20 … … 24 24 25 25 /* these values don't exist in the Loneos format */ 26 out[i].Mgal _PS= in[i].M;27 out[i].dt _PS= 0;28 out[i].airmass _PS= 0;26 out[i].Mgal = in[i].M; 27 out[i].dt = 0; 28 out[i].airmass = 0; 29 29 out[i].FWx = 0; 30 30 out[i].FWy = 0; 31 31 out[i].theta = 0; 32 out[i].stargal = 0; 33 out[i].Sky = 0; 34 out[i].dSky = 0; 35 out[i].qPSF = 0; 36 37 /* these can be determined if needed / desired */ 38 out[i].Xccd = 0; 39 out[i].Yccd = 0; 40 out[i].dXccd = 0; 41 out[i].dYccd = 0; 42 43 /* XXX add these later */ 44 out[i].detID_hi = 0; 45 out[i].detID_lo = 0; 46 out[i].imageID_hi = 0; 47 out[i].imageID_lo = 0; 32 48 } 33 49 return (out); … … 43 59 44 60 for (i = 0; i < Nvalues; i++) { 45 out[i].dR = in[i].dR _PS* 100.0;46 out[i].dD = in[i].dD _PS* 100.0;47 out[i].M = in[i].M _PS* 1000.0;48 out[i].dM = in[i].dM _PS* 1000.0;49 out[i].Mcal = in[i].Mcal _PS* 1000.0;61 out[i].dR = in[i].dR * 100.0; 62 out[i].dD = in[i].dD * 100.0; 63 out[i].M = in[i].M * 1000.0; 64 out[i].dM = in[i].dM * 1000.0; 65 out[i].Mcal = in[i].Mcal * 1000.0; 50 66 out[i].dophot = in[i].dophot; 51 out[i].source = in[i]. source;67 out[i].source = in[i].photcode; 52 68 out[i].t = in[i].t; 53 69 … … 59 75 60 76 /* convert loneos-format averages to internal averages */ 61 Average *AverageLoneosToInternal (AverageLoneos *in, int Nvalues ) {77 Average *AverageLoneosToInternal (AverageLoneos *in, int Nvalues, SecFilt **primary) { 62 78 63 79 int i; … … 65 81 66 82 ALLOCATE (out, Average, Nvalues); 83 ALLOCATE (*primary, SecFilt, Nvalues); 67 84 68 85 for (i = 0; i < Nvalues; i++) { 69 86 out[i].R = in[i].R; 70 87 out[i].D = in[i].D; 71 out[i].M = in[i].M * 0.001;72 88 out[i].Xp = in[i].Xp; 73 out[i].Xm = in[i].Xm;74 89 out[i].Nm = in[i].Nm; 75 90 out[i].Nn = in[i].Nn; … … 87 102 out[i].P = 0; 88 103 out[i].dP = 0; 89 out[i].dM = 0xffff; 90 out[i].Xg = 0xffff; 104 105 /* XXX add these later */ 106 out[i].objID_hi = 0; 107 out[i].objID_lo = 0; 108 109 primary[0][i].M = in[i].M * 0.001; 110 primary[0][i].Xm = in[i].Xm; 111 primary[0][i].dM = 0xffff; 112 primary[0][i].Ncode = 0; 113 primary[0][i].Nused = 0; 114 115 // XXX drop this or keep this? 116 // primary[0][i].Xg = in[i].Xg; 91 117 } 92 118 return (out); … … 94 120 95 121 /* convert internal averages to loneos-format averages */ 96 AverageLoneos *AverageInternalToLoneos (Average *in, int Nvalues ) {122 AverageLoneos *AverageInternalToLoneos (Average *in, int Nvalues, SecFilt *primary) { 97 123 98 124 int i; … … 104 130 out[i].R = in[i].R; 105 131 out[i].D = in[i].D; 106 out[i].M = in[i].M * 1000.0;107 132 out[i].Xp = in[i].Xp; 108 out[i].Xm = in[i].Xm;109 133 out[i].Nm = in[i].Nm; 110 134 out[i].Nn = in[i].Nn; … … 112 136 out[i].offset = in[i].offset; 113 137 out[i].missing = in[i].missing; 138 139 out[i].M = primary[i].M * 1000.0; 140 out[i].Xm = primary[i].Xm; 114 141 } 115 142 return (out); … … 125 152 126 153 for (i = 0; i < Nvalues; i++) { 127 out[i].M_PS = in[i].M*0.001; 128 out[i].dM_PS = 0xffff; 154 out[i].M = in[i].M*0.001; 129 155 out[i].Xm = in[i].Xm; 156 out[i].dM = 0xffff; 157 out[i].Ncode = 0; 158 out[i].Nused = 0; 130 159 } 131 160 return (out); … … 141 170 142 171 for (i = 0; i < Nvalues; i++) { 143 out[i].M = in[i].M _PS*1000.0;172 out[i].M = in[i].M*1000.0; 144 173 out[i].Xm = in[i].Xm; 145 174 } … … 162 191 out[i].tzero = in[i].tzero; 163 192 out[i].nstar = in[i].nstar; 164 out[i].secz _PS= in[i].secz * 0.001;193 out[i].secz = in[i].secz * 0.001; 165 194 out[i].NX = in[i].NX; 166 195 out[i].NY = in[i].NY; 167 out[i].apmifit _PS= in[i].apmifit * 0.001;168 out[i].dapmifit _PS= in[i].dapmifit * 0.001;169 out[i].Mcal _PS= in[i].Mcal * 0.001;170 out[i].dMcal _PS= in[i].dMcal * 0.001;196 out[i].apmifit = in[i].apmifit * 0.001; 197 out[i].dapmifit = in[i].dapmifit * 0.001; 198 out[i].Mcal = in[i].Mcal * 0.001; 199 out[i].dMcal = in[i].dMcal * 0.001; 171 200 out[i].Xm = in[i].Xm; 172 out[i]. source = in[i].source;201 out[i].photcode = in[i].source; 173 202 out[i].exptime = in[i].exptime; 174 203 out[i].detection_limit = in[i].detection_limit; … … 195 224 out[i].Mxyyy = in[i].Mxyyy; 196 225 out[i].Myyyy = in[i].Myyyy; 226 227 /* XXX add these later */ 228 out[i].imageID_hi = 0; 229 out[i].imageID_lo = 0; 197 230 } 198 231 return (out); … … 214 247 out[i].tzero = in[i].tzero; 215 248 out[i].nstar = in[i].nstar; 216 out[i].secz = in[i].secz _PS* 1000.0;249 out[i].secz = in[i].secz * 1000.0; 217 250 out[i].NX = in[i].NX; 218 251 out[i].NY = in[i].NY; 219 out[i].apmifit = in[i].apmifit _PS* 1000.0;220 out[i].dapmifit = in[i].dapmifit _PS* 1000.0;221 out[i].Mcal = in[i].Mcal _PS* 1000.0;222 out[i].dMcal = in[i].dMcal _PS* 1000.0;252 out[i].apmifit = in[i].apmifit * 1000.0; 253 out[i].dapmifit = in[i].dapmifit * 1000.0; 254 out[i].Mcal = in[i].Mcal * 1000.0; 255 out[i].dMcal = in[i].dMcal * 1000.0; 223 256 out[i].Xm = in[i].Xm; 224 out[i].source = in[i]. source;257 out[i].source = in[i].photcode; 225 258 out[i].exptime = in[i].exptime; 226 259 out[i].detection_limit = in[i].detection_limit; -
trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs.c
r6683 r12332 1 1 # include <dvo.h> 2 2 3 /*** note that these structures are identical***/3 /*** XXX is this format actually used by anyone?? ***/ 4 4 5 5 /* convert panstarrs-format measures to internal measures */ … … 12 12 13 13 for (i = 0; i < Nvalues; i++) { 14 out[i].dR _PS= in[i].dR;15 out[i].dD _PS= in[i].dD;16 out[i].M _PS= in[i].M;17 out[i].dM _PS= in[i].dM;18 out[i].Mcal _PS= in[i].Mcal;19 out[i].Mgal _PS= in[i].Mgal;20 out[i].airmass _PS= in[i].airmass;21 out[i].dt _PS= in[i].dt;14 out[i].dR = in[i].dR; 15 out[i].dD = in[i].dD; 16 out[i].M = in[i].M; 17 out[i].dM = in[i].dM; 18 out[i].Mcal = in[i].Mcal; 19 out[i].Mgal = in[i].Mgal; 20 out[i].airmass = in[i].airmass; 21 out[i].dt = in[i].dt; 22 22 out[i].FWx = in[i].FWx; 23 23 out[i].FWy = in[i].FWy; 24 24 out[i].theta = in[i].theta; 25 25 out[i].dophot = in[i].dophot; 26 out[i]. source= in[i].source;26 out[i].photcode = in[i].source; 27 27 out[i].t = in[i].t; 28 28 out[i].averef = in[i].averef; 29 29 out[i].flags = in[i].flags; 30 31 /* these can be determined if needed / desired */ 32 out[i].Xccd = 0; 33 out[i].Yccd = 0; 34 out[i].dXccd = 0; 35 out[i].dYccd = 0; 36 37 /* these do not have a corresponding value */ 38 out[i].stargal = 0; 39 out[i].Sky = 0; 40 out[i].dSky = 0; 41 out[i].qPSF = 0; 42 43 /* XXX add these later */ 44 out[i].detID_hi = 0; 45 out[i].detID_lo = 0; 46 out[i].imageID_hi = 0; 47 out[i].imageID_lo = 0; 30 48 } 31 49 return (out); … … 41 59 42 60 for (i = 0; i < Nvalues; i++) { 43 out[i].dR = in[i].dR _PS;44 out[i].dD = in[i].dD _PS;45 out[i].M = in[i].M _PS;46 out[i].dM = in[i].dM _PS;47 out[i].Mcal = in[i].Mcal _PS;48 out[i].Mgal = in[i].Mgal _PS;49 out[i].airmass = in[i].airmass _PS;50 out[i].dt = in[i].dt _PS;61 out[i].dR = in[i].dR; 62 out[i].dD = in[i].dD; 63 out[i].M = in[i].M; 64 out[i].dM = in[i].dM; 65 out[i].Mcal = in[i].Mcal; 66 out[i].Mgal = in[i].Mgal; 67 out[i].airmass = in[i].airmass; 68 out[i].dt = in[i].dt; 51 69 out[i].FWx = in[i].FWx; 52 70 out[i].FWy = in[i].FWy; 53 71 out[i].theta = in[i].theta; 54 72 out[i].dophot = in[i].dophot; 55 out[i].source = in[i]. source;73 out[i].source = in[i].photcode; 56 74 out[i].t = in[i].t; 57 75 out[i].averef = in[i].averef; … … 92 110 out[i].P = 0; 93 111 out[i].dP = 0; 112 113 /* XXX add these later */ 114 out[i].objID_hi = 0; 115 out[i].objID_lo = 0; 94 116 } 95 117 return (out); … … 130 152 131 153 for (i = 0; i < Nvalues; i++) { 132 out[i].M_PS = in[i].M; 133 out[i].dM_PS = in[i].dM; 134 out[i].Xm = in[i].Xm; 135 } 154 out[i].M = in[i].M; 155 out[i].dM = in[i].dM; 156 out[i].Xm = in[i].Xm; 157 out[i].Ncode = 0; 158 out[i].Nused = 0; 159 } 136 160 return (out); 137 161 } … … 146 170 147 171 for (i = 0; i < Nvalues; i++) { 148 out[i].M = in[i].M _PS;149 out[i].dM = in[i].dM _PS;172 out[i].M = in[i].M; 173 out[i].dM = in[i].dM; 150 174 out[i].Xm = in[i].Xm; 151 175 } … … 168 192 out[i].tzero = in[i].tzero; 169 193 out[i].nstar = in[i].nstar; 170 out[i].secz _PS= in[i].secz;194 out[i].secz = in[i].secz; 171 195 out[i].NX = in[i].NX; 172 196 out[i].NY = in[i].NY; 173 out[i].apmifit _PS= in[i].apmifit;174 out[i].dapmifit _PS= in[i].dapmifit;175 out[i].Mcal _PS= in[i].Mcal;176 out[i].dMcal _PS= in[i].dMcal;197 out[i].apmifit = in[i].apmifit; 198 out[i].dapmifit = in[i].dapmifit; 199 out[i].Mcal = in[i].Mcal; 200 out[i].dMcal = in[i].dMcal; 177 201 out[i].Xm = in[i].Xm; 178 out[i]. source = in[i].source;202 out[i].photcode = in[i].source; 179 203 out[i].exptime = in[i].exptime; 180 204 out[i].detection_limit = in[i].detection_limit; … … 201 225 out[i].Mxyyy = in[i].Mxyyy; 202 226 out[i].Myyyy = in[i].Myyyy; 227 228 /* XXX add these later */ 229 out[i].imageID_hi = 0; 230 out[i].imageID_lo = 0; 203 231 } 204 232 return (out); … … 220 248 out[i].tzero = in[i].tzero; 221 249 out[i].nstar = in[i].nstar; 222 out[i].secz = in[i].secz _PS;250 out[i].secz = in[i].secz; 223 251 out[i].NX = in[i].NX; 224 252 out[i].NY = in[i].NY; 225 out[i].apmifit = in[i].apmifit _PS;226 out[i].dapmifit = in[i].dapmifit _PS;227 out[i].Mcal = in[i].Mcal _PS;228 out[i].dMcal = in[i].dMcal _PS;253 out[i].apmifit = in[i].apmifit; 254 out[i].dapmifit = in[i].dapmifit; 255 out[i].Mcal = in[i].Mcal; 256 out[i].dMcal = in[i].dMcal; 229 257 out[i].Xm = in[i].Xm; 230 out[i].source = in[i]. source;258 out[i].source = in[i].photcode; 231 259 out[i].exptime = in[i].exptime; 232 260 out[i].detection_limit = in[i].detection_limit; -
trunk/Ohana/src/libdvo/src/dvo_convert_pmtest.c
r6683 r12332 1 1 # include <dvo.h> 2 3 /* convert elixir-format measures to internal measures */ 4 Measure *MeasureElixirToInternal (MeasureElixir *in, int Nvalues) { 5 6 int i; 7 Measure *out; 8 9 ALLOCATE (out, Measure, Nvalues); 10 11 for (i = 0; i < Nvalues; i++) { 12 out[i].dR = in[i].dR; 13 out[i].dD = in[i].dD; 14 out[i].M = in[i].M; 15 out[i].dM = in[i].dM; 16 out[i].dt = in[i].dt; 17 out[i].Mcal = in[i].Mcal; 18 out[i].Mgal = in[i].Mgal; 19 out[i].airmass = in[i].airmass; 20 out[i].FWx = in[i].FWx; 21 out[i].FWy = in[i].FWy; 22 out[i].theta = in[i].theta; 23 out[i].dophot = in[i].dophot; 24 out[i].photcode = in[i].source; 25 out[i].t = in[i].t; 26 out[i].averef = in[i].averef; 27 out[i].flags = in[i].flags; 28 29 out[i].Xccd = in[i].Xccd; 30 out[i].Yccd = in[i].Yccd; 31 out[i].dXccd = in[i].dXccd; 32 out[i].dYccd = in[i].dYccd; 33 34 out[i].stargal = in[i].stargal; 35 out[i].Sky = in[i].Sky; 36 out[i].dSky = in[i].dSky; 37 out[i].qPSF = in[i].qPSF; 38 39 out[i].detID_hi = in[i].detID_hi; 40 out[i].detID_lo = in[i].detID_lo; 41 out[i].imageID_hi = in[i].imageID_hi; 42 out[i].imageID_lo = in[i].imageID_lo; 43 } 44 return (out); 45 } 46 47 /* convert internal measures to elixir-format measures */ 48 MeasureElixir *MeasureInternalToElixir (Measure *in, int Nvalues) { 49 50 int i; 51 MeasureElixir *out; 52 53 ALLOCATE (out, MeasureElixir, Nvalues); 54 55 for (i = 0; i < Nvalues; i++) { 56 out[i].dR = in[i].dR; 57 out[i].dD = in[i].dD; 58 out[i].M = in[i].M; 59 out[i].dM = in[i].dM; 60 out[i].dt = in[i].dt; 61 out[i].Mcal = in[i].Mcal; 62 out[i].Mgal = in[i].Mgal; 63 out[i].airmass = in[i].airmass; 64 out[i].FWx = in[i].FWx; 65 out[i].FWy = in[i].FWy; 66 out[i].theta = in[i].theta; 67 out[i].dophot = in[i].dophot; 68 out[i].photcode = in[i].source; 69 out[i].t = in[i].t; 70 out[i].averef = in[i].averef; 71 out[i].flags = in[i].flags; 72 73 out[i].Xccd = in[i].Xccd; 74 out[i].Yccd = in[i].Yccd; 75 out[i].dXccd = in[i].dXccd; 76 out[i].dYccd = in[i].dYccd; 77 78 out[i].stargal = in[i].stargal; 79 out[i].Sky = in[i].Sky; 80 out[i].dSky = in[i].dSky; 81 out[i].qPSF = in[i].qPSF; 82 83 out[i].detID_hi = in[i].detID_hi; 84 out[i].detID_lo = in[i].detID_lo; 85 out[i].imageID_hi = in[i].imageID_hi; 86 out[i].imageID_lo = in[i].imageID_lo; 87 } 88 return (out); 89 } 2 90 3 91 /* convert panstarrs-format averages to internal averages */ -
trunk/Ohana/src/libdvo/src/dvo_image.c
r9632 r12332 187 187 gfits_modify (&db[0].header, "ZERO_PT", "%lf", 1, ZeroPoint); 188 188 189 if (db[0].format == DVO_FORMAT_INTERNAL) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "INTERNAL"); 190 if (db[0].format == DVO_FORMAT_LONEOS) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "LONEOS"); 191 if (db[0].format == DVO_FORMAT_ELIXIR) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "ELIXIR"); 192 if (db[0].format == DVO_FORMAT_PANSTARRS) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PANSTARRS"); 193 if (db[0].format == DVO_FORMAT_PMTEST) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PMTEST"); 189 if (db[0].format == DVO_FORMAT_INTERNAL) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "INTERNAL"); 190 if (db[0].format == DVO_FORMAT_LONEOS) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "LONEOS"); 191 if (db[0].format == DVO_FORMAT_ELIXIR) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "ELIXIR"); 192 if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_0) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PANSTARRS_DEV_0"); 193 // if (db[0].format == DVO_FORMAT_PANSTARRS) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PANSTARRS"); 194 // if (db[0].format == DVO_FORMAT_PMTEST) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PMTEST"); 194 195 195 196 return; -
trunk/Ohana/src/libdvo/src/dvo_image_raw.c
r7080 r12332 20 20 db[0].format = DVO_FORMAT_UNDEF; 21 21 if (gfits_scan (&db[0].header, "FORMAT", "%s", 1, format)) { 22 if (!strcmp (format, "INTERNAL")) db[0].format = DVO_FORMAT_INTERNAL; 23 if (!strcmp (format, "LONEOS")) db[0].format = DVO_FORMAT_LONEOS; 24 if (!strcmp (format, "ELIXIR")) db[0].format = DVO_FORMAT_ELIXIR; 25 if (!strcmp (format, "PANSTARRS")) db[0].format = DVO_FORMAT_PANSTARRS; 26 if (!strcmp (format, "PMTEST")) db[0].format = DVO_FORMAT_PANSTARRS; 22 db[0].format = dvo_catalog_catformat (format); 27 23 if (db[0].format != DVO_FORMAT_UNDEF) goto got_format; 28 24 } 29 25 if (gfits_scan (&db[0].header, "TELESCOP", "%s", 1, telescope)) { 30 26 if (!strncmp (telescope, "LONEOS", strlen("LONEOS"))) { 31 db[0].format = DVO_FORMAT_LONEOS; 27 db[0].format = DVO_FORMAT_LONEOS; // special case for LONEOS 32 28 goto got_format; 33 29 } 34 30 if (!strncmp (telescope, "1.3m McGraw-Hill", strlen("1.3m McGraw-Hill"))) { 35 db[0].format = DVO_FORMAT_ELIXIR; 31 db[0].format = DVO_FORMAT_ELIXIR; // special case for ELIXIR 36 32 goto got_format; 37 33 } … … 51 47 /* get datatype size */ 52 48 ImageSize = 0; 53 if (db[0].format == DVO_FORMAT_INTERNAL) ImageSize = sizeof(Image); 54 if (db[0].format == DVO_FORMAT_LONEOS) ImageSize = sizeof(ImageLoneos); 55 if (db[0].format == DVO_FORMAT_ELIXIR) ImageSize = sizeof(ImageElixir); 56 if (db[0].format == DVO_FORMAT_PANSTARRS) ImageSize = sizeof(ImagePanstarrs); 49 if (db[0].format == DVO_FORMAT_INTERNAL) ImageSize = sizeof(Image); 50 if (db[0].format == DVO_FORMAT_LONEOS) ImageSize = sizeof(ImageLoneos); 51 if (db[0].format == DVO_FORMAT_ELIXIR) ImageSize = sizeof(ImageElixir); 52 if (db[0].format == DVO_FORMAT_PANSTARRS) ImageSize = sizeof(ImagePanstarrs); 53 if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_0) ImageSize = sizeof(ImagePanstarrs_DEV_0); 57 54 58 55 /* check that filesize makes sense */ … … 72 69 db[0].ftable.header = &db[0].theader; 73 70 74 if (db[0].format == DVO_FORMAT_INTERNAL) gfits_table_mkheader_Image (&db[0].theader); 75 if (db[0].format == DVO_FORMAT_LONEOS) gfits_table_mkheader_ImageLoneos (&db[0].theader); 76 if (db[0].format == DVO_FORMAT_ELIXIR) gfits_table_mkheader_ImageElixir (&db[0].theader); 77 if (db[0].format == DVO_FORMAT_PANSTARRS) gfits_table_mkheader_ImagePanstarrs (&db[0].theader); 71 if (db[0].format == DVO_FORMAT_INTERNAL) gfits_table_mkheader_Image (&db[0].theader); 72 if (db[0].format == DVO_FORMAT_LONEOS) gfits_table_mkheader_ImageLoneos (&db[0].theader); 73 if (db[0].format == DVO_FORMAT_ELIXIR) gfits_table_mkheader_ImageElixir (&db[0].theader); 74 if (db[0].format == DVO_FORMAT_PANSTARRS) gfits_table_mkheader_ImagePanstarrs (&db[0].theader); 75 if (db[0].format == DVO_FORMAT_PANSTARRS_DEV_0) gfits_table_mkheader_ImagePanstarrs_DEV_0 (&db[0].theader); 78 76 79 77 /* read data from file */ -
trunk/Ohana/src/libdvo/src/photfits.c
r5241 r12332 61 61 switch (image[0].order) { 62 62 case 0: 63 c[0] = image[0].Mcal _PS;64 return; 65 case 1: 66 c[0] = image[0].Mcal _PS;63 c[0] = image[0].Mcal; 64 return; 65 case 1: 66 c[0] = image[0].Mcal; 67 67 c[1] = getMi (image[0].Mx); 68 68 c[2] = getMi (image[0].My); 69 69 return; 70 70 case 2: 71 c[0] = image[0].Mcal _PS;71 c[0] = image[0].Mcal; 72 72 c[1] = getMi (image[0].Mx); 73 73 c[2] = getMi (image[0].Mxx); … … 77 77 return; 78 78 case 3: 79 c[0] = image[0].Mcal _PS;79 c[0] = image[0].Mcal; 80 80 c[1] = getMi (image[0].Mx); 81 81 c[2] = getMi (image[0].Mxx); … … 89 89 return; 90 90 case 4: 91 c[0] = image[0].Mcal _PS;91 c[0] = image[0].Mcal; 92 92 c[1] = getMi (image[0].Mx); 93 93 c[2] = getMi (image[0].Mxx); … … 117 117 switch (order) { 118 118 case 0: 119 image[0].Mcal _PS= c[0];120 return; 121 case 1: 122 image[0].Mcal _PS= c[0];119 image[0].Mcal = c[0]; 120 return; 121 case 1: 122 image[0].Mcal = c[0]; 123 123 image[0].Mx = putMi(c[1]); 124 124 image[0].My = putMi(c[2]); 125 125 return; 126 126 case 2: 127 image[0].Mcal _PS= c[0];127 image[0].Mcal = c[0]; 128 128 image[0].Mx = putMi(c[1]); 129 129 image[0].Mxx = putMi(c[2]); … … 133 133 return; 134 134 case 3: 135 image[0].Mcal _PS= c[0];135 image[0].Mcal = c[0]; 136 136 image[0].Mx = putMi(c[1]); 137 137 image[0].Mxx = putMi(c[2]); … … 145 145 return; 146 146 case 4: 147 image[0].Mcal _PS= c[0];147 image[0].Mcal = c[0]; 148 148 image[0].Mx = putMi(c[1]); 149 149 image[0].Mxx = putMi(c[2]); … … 162 162 return; 163 163 default: 164 image[0].Mcal _PS= 0.0;164 image[0].Mcal = 0.0; 165 165 image[0].order = 0; 166 166 return; -
trunk/Ohana/src/libdvo/src/skyregion_gsc.c
r8386 r12332 209 209 SkyRegion *regions; 210 210 SkyRegion tempregion; 211 char * *filename;212 char * tempfile;211 char *tempfile = NULL; 212 char **filename = NULL; 213 213 214 214 N = table[0].Nregions; -
trunk/Ohana/src/libkapa/src/KiiConvert.c
r10843 r12332 44 44 KiiSendCommand (fd, 4, "PSIT"); 45 45 46 name:47 46 KiiSendMessage (fd, "%s %s %d %d", filename, pagename, scaleMode, pageMode); 48 47 -
trunk/Ohana/src/libkapa/src/bDrawRotFont.c
r10073 r12332 12 12 13 13 unsigned char *bitmap; 14 char *currentname, basename[64] , *c;14 char *currentname, basename[64]; 15 15 int i, dy, dx, N, X, Y, code; 16 16 int dX, Xoff, dY, Yoff, YoffBase; -
trunk/Ohana/src/libohana/include/ohana_allocate.h
r11066 r12332 16 16 # define ohana_memdump(X) ohana_memdump_func (X); 17 17 18 # define ALLOCATE( X,T,S) \19 X = (T *) ohana_malloc (__FILE__, __LINE__, (S), sizeof(T))20 # define REALLOCATE( X,T,S) \21 X = (T *) ohana_realloc(__FILE__, __LINE__, X, (S), sizeof(T));22 # define CHECK_REALLOCATE( X,T,S,N,D) \23 if ((N ) >= (S)) { S += D; \24 X = (T *) ohana_realloc(__FILE__, __LINE__, X, (S), sizeof(T)); }25 # define FREE( X) if (X != NULL) { ohana_free (__FILE__, __LINE__, X); }26 # define free( X) ohana_free(__FILE__, __LINE__, X)18 # define ALLOCATE(PTR,TYPE,SIZE) \ 19 PTR = (TYPE *) ohana_malloc (__FILE__, __LINE__, (SIZE), sizeof(TYPE)) 20 # define REALLOCATE(PTR,TYPE,SIZE) \ 21 PTR = (TYPE *) ohana_realloc(__FILE__, __LINE__, PTR, (SIZE), sizeof(TYPE)); 22 # define CHECK_REALLOCATE(PTR,TYPE,SIZE,NCURR,DELTA) \ 23 if ((NCURR) >= (SIZE)) { SIZE += DELTA; \ 24 PTR = (TYPE *) ohana_realloc(__FILE__, __LINE__, PTR, (SIZE), sizeof(TYPE)); } 25 # define FREE(PTR) if (PTR != NULL) { ohana_free (__FILE__, __LINE__, PTR); } 26 # define free(PTR) ohana_free(__FILE__, __LINE__, PTR) 27 27 28 28 # else … … 33 33 34 34 # ifndef ALLOCATE 35 # define ALLOCATE( X,T,S) \36 X = (T *) malloc ((unsigned)(MAX(((S)*((int)sizeof(T))),1))); \37 if ( X== NULL) { \35 # define ALLOCATE(PTR,TYPE,SIZE) \ 36 PTR = (TYPE *) malloc ((unsigned)(MAX(((SIZE)*((int)sizeof(TYPE))),1))); \ 37 if (PTR == NULL) { \ 38 38 fprintf(stderr,"failed malloc at %d in %s\n", __LINE__, __FILE__);\ 39 39 exit (10); } 40 # define REALLOCATE( X,T,S) \41 X = (T *) realloc(X,(unsigned)(MAX(((S)*((int)sizeof(T))),1))); \42 if ( X== NULL) { \40 # define REALLOCATE(PTR,TYPE,SIZE) \ 41 PTR = (TYPE *) realloc(PTR,(unsigned)(MAX(((SIZE)*((int)sizeof(TYPE))),1))); \ 42 if (PTR == NULL) { \ 43 43 fprintf(stderr,"failed realloc at %d in %s\n", __LINE__, __FILE__);\ 44 44 exit (10); } 45 # define CHECK_REALLOCATE( X,T,S,N,D) \46 if ((N ) >= (S)) { \47 S += D; \48 X = (T *) realloc(X,(unsigned)(MAX(((S)*((int)sizeof(T))),1))); \49 if ( X== NULL) { \45 # define CHECK_REALLOCATE(PTR,TYPE,SIZE,NCURR,DELTA) \ 46 if ((NCURR) >= (SIZE)) { \ 47 SIZE += DELTA; \ 48 PTR = (TYPE *) realloc(PTR,(unsigned)(MAX(((SIZE)*((int)sizeof(TYPE))),1))); \ 49 if (PTR == NULL) { \ 50 50 fprintf(stderr,"failed realloc increment at %d in %s\n", __LINE__, __FILE__);\ 51 51 exit (10); } } 52 # define FREE( X) if (X != NULL) { free (X); }52 # define FREE(PTR) if (PTR != NULL) { free (PTR); } 53 53 # endif /* ALLOCATE */ 54 54 -
trunk/Ohana/src/markrock/src/ConfigInit.c
r4828 r12332 4 4 5 5 char *config, *file; 6 char PhotCodeFile[256]; 6 char CatdirPhotcodeFile[256]; 7 char MasterPhotcodeFile[256]; 7 8 8 9 /*** load configuration info ***/ … … 20 21 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 21 22 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 23 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 22 24 23 25 /* unique to markrock */ … … 30 32 ScanConfig (config, "ROCK_MAX_DELAY", "%lf", 0, &MAX_DELAY); 31 33 ScanConfig (config, "ROCK_CATALOG", "%s", 0, RockCat); 32 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);33 34 34 35 ScanConfig (config, "BRIGHT_HALO_MAG", "%lf", 0, &BRIGHT_HALO_MAG); … … 41 42 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 42 43 43 if (!LoadPhotcodes (PhotCodeFile, &photcodes)) { 44 fprintf (stderr, "error loading photcodes\n"); 45 exit (0); 44 /* XXX this does not yet write out the master photcode table */ 45 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 46 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 47 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 48 exit (1); 46 49 } 47 50 -
trunk/Ohana/src/markstar/src/ConfigInit.c
r6684 r12332 4 4 5 5 char *config, *file; 6 char PhotCodeFile[256]; 6 char CatdirPhotcodeFile[256]; 7 char MasterPhotcodeFile[256]; 7 8 8 9 /*** load configuration info ***/ … … 20 21 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 21 22 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 23 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 22 24 23 25 sprintf (ImageCat, "%s/Images.dat", CATDIR); … … 46 48 ScanConfig (config, "OPTICAL_AXIS1", "%lf", 0, &OPTICAL_AXIS1); 47 49 ScanConfig (config, "OPTICAL_AXIS2", "%lf", 0, &OPTICAL_AXIS2); 48 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);49 50 50 51 if (*CATMODE == 0) strcpy (CATMODE, "RAW"); 51 52 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 52 53 53 if (!LoadPhotcodes (PhotCodeFile, &photcodes)) { 54 fprintf (stderr, "error loading photcodes\n"); 55 exit (0); 54 /* XXX this does not yet write out the master photcode table */ 55 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 56 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 57 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 58 exit (1); 56 59 } 57 60 -
trunk/Ohana/src/markstar/src/match_images.c
r2490 r12332 24 24 start[j] = image[j].tzero - MAX(0.05*image[j].trate*image[j].NY, 1); 25 25 stop[j] = image[j].tzero + MAX(1.05*image[j].trate*image[j].NY, 1); 26 source[j] = image[j]. source;26 source[j] = image[j].photcode; 27 27 } 28 28 … … 36 36 if ((catalog[0].measure[j].t >= start[k]) && 37 37 (catalog[0].measure[j].t <= stop[k]) && 38 (catalog[0].measure[j]. source == source[k])) {38 (catalog[0].measure[j].photcode == source[k])) { 39 39 catalog[0].image[j] = k; 40 40 found = TRUE; … … 43 43 if (!found) { 44 44 fprintf (stderr, "ERROR: can't find source image for this measurement: %d %d)\n", 45 catalog[0].measure[j].t, catalog[0].measure[j]. source);45 catalog[0].measure[j].t, catalog[0].measure[j].photcode); 46 46 exit (0); 47 47 } -
trunk/Ohana/src/misc/Makefile
r11880 r12332 18 18 # we use a special set of rules in this directory which expect this simplification 19 19 20 PROGRAMS = gconfig mknames fhead ftable fields list_astro glockfile \ 21 radec mktemp precess csystem fits_insert mkgauss \ 22 medianfilter mefhead mkfringetable gtfringetable ckfits applyscat fiximg 20 PROGRAMS = mknames mkgauss mkfringetable gtfringetable applyscat fiximg 23 21 24 22 misc: $(PROGRAMS) -
trunk/Ohana/src/mosastro/src/ConvertMatch.c
r3520 r12332 38 38 } 39 39 40 byte = ( char *) data;40 byte = (unsigned char *) data; 41 41 for (i = 0; i < nitems; i++, byte += size) { 42 42 SWAP_DBLE (0); /* R */ -
trunk/Ohana/src/mosastro/src/getptolemy.c
r8515 r12332 50 50 stars[k].R = catalog.average[j].R; 51 51 stars[k].D = catalog.average[j].D; 52 stars[k].M = catalog.measure[catalog.average[j].offset].M _PS;52 stars[k].M = catalog.measure[catalog.average[j].offset].M; 53 53 } 54 54 dvo_catalog_free (&catalog); -
trunk/Ohana/src/nightd/src/misc.c
r5386 r12332 111 111 struct tm *local, *gmt; 112 112 struct timeval now; 113 unsigned longtsec, tref;113 time_t tsec, tref; 114 114 int dsec; 115 115 float hour; -
trunk/Ohana/src/opihi/cmd.basic/date.c
r10995 r12332 5 5 int N, SECONDS, REFTIME; 6 6 struct timeval now; 7 char *tstring, *varName; 7 char *tstring = NULL; 8 char *varName = NULL; 8 9 9 10 SECONDS = FALSE; -
trunk/Ohana/src/opihi/cmd.basic/macro.c
r11081 r12332 3 3 int macro (int argc, char **argv) { 4 4 5 int i, N,status;5 int status; 6 6 CommandF *cmd; 7 7 -
trunk/Ohana/src/opihi/cmd.basic/module.c
r11084 r12332 6 6 7 7 int i, NLINES, Nmodules, Nbytes, status; 8 FILE *infile;9 8 Macro inlist; 10 9 char modname[16], *modpath, *filename; 10 FILE *infile = NULL; 11 11 12 12 if (argc != 2) { -
trunk/Ohana/src/opihi/cmd.data/book_commands.c
r11327 r12332 8 8 9 9 ListBooks(); 10 return TRUE; 10 11 } 11 12 … … 63 64 int book_listbook (int argc, char **argv) { 64 65 65 int status;66 66 Book *book; 67 67 … … 83 83 int book_npages (int argc, char **argv) { 84 84 85 int N , status;85 int N; 86 86 Book *book; 87 87 char *varName; -
trunk/Ohana/src/opihi/cmd.data/create.c
r9275 r12332 3 3 int create (int argc, char **argv) { 4 4 5 int i , N;5 int i; 6 6 float start, end, delta; 7 7 Vector *vec; -
trunk/Ohana/src/opihi/cmd.data/line.c
r10307 r12332 3 3 int line (int argc, char **argv) { 4 4 5 int N, Npts;6 5 Graphdata graphmode; 7 6 float x[2], y[2]; -
trunk/Ohana/src/opihi/cmd.data/queueload.c
r10997 r12332 4 4 5 5 char *A, *B, *val; 6 int i, done,status;7 int N , Nread, Nbytes, NBYTES;6 int i, status; 7 int Nread, Nbytes, NBYTES; 8 8 FILE *f; 9 9 Queue *queue; -
trunk/Ohana/src/opihi/dvo/avextract.c
r10796 r12332 4 4 5 5 int i, j, m, N, NPTS, param; 6 int Nsec , mode;6 int Nsecfilt, mode; 7 7 char *RegionName, *RegionList, *p; 8 8 … … 22 22 /* load photcode information */ 23 23 if (!InitPhotcodes ()) goto escape; 24 Nsec = GetPhotcodeNsecfilt ();24 Nsecfilt = GetPhotcodeNsecfilt (); 25 25 26 26 /* interpret command-line options */ … … 68 68 for (j = 0; j < catalog.Naverage; j++) { 69 69 m = catalog.average[j].offset; 70 vec[0].elements[N] = ExtractAverages (code, mode, &catalog.average[j], &catalog.secfilt[j*Nsec ], &catalog.measure[m], param);70 vec[0].elements[N] = ExtractAverages (code, mode, &catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], param); 71 71 N++; 72 72 CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 2000); -
trunk/Ohana/src/opihi/dvo/calextract.c
r8455 r12332 6 6 7 7 int i, j, m, N, Nr, mode[2]; 8 int Nsec , NSTAR;8 int Nsecfilt, NSTAR; 9 9 char *RegionName, *RegionList; 10 10 double M1, M2, dM2, color; … … 12 12 PhotCode *code[2]; 13 13 Catalog catalog; 14 Vector **vec; 14 15 SkyList *skylist; 15 Vector **vec;16 16 17 17 /* these need to be freed in the end */ … … 21 21 RegionName = NULL; 22 22 RegionList = NULL; 23 skylist = NULL; 23 24 vec = NULL; 24 25 25 26 /* load photcode information */ 26 27 if (!InitPhotcodes ()) return (FALSE); 27 Nsec = GetPhotcodeNsecfilt ();28 Nsecfilt = GetPhotcodeNsecfilt (); 28 29 29 30 /* command line arguments */ … … 77 78 m = catalog.average[i].offset; 78 79 79 if (code[0][0].c1 && code[0][0].c2 && !PhotColor (&catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], code[0][0].c1, code[0][0].c2, &color)) continue;80 if (code[0][0].c1 && code[0][0].c2 && !PhotColor (&catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], code[0][0].c1, code[0][0].c2, &color)) continue; 80 81 81 82 /* find data for filter 2 (PHOT_REF) */ … … 83 84 dM2 = NO_MAG; 84 85 for (j = 0; j < catalog.average[i].Nm; j++) { 85 if (catalog.measure[m+j]. source != code[1][0].code) continue;86 if (catalog.measure[m+j].photcode != code[1][0].code) continue; 86 87 M2 = PhotCat (&catalog.measure[m+j]); 87 dM2 = catalog.measure[m+j].dM _PS;88 dM2 = catalog.measure[m+j].dM; 88 89 } 89 90 if (M2 == NO_MAG) continue; 90 91 91 92 /* find data for filter 1 */ 92 M1 = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], AVE_MAG);93 M1 = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], AVE_MAG); 93 94 if (M1 == NO_MAG) continue; 94 95 … … 98 99 vec[NR ][0].elements[N] = catalog.average[i].R; 99 100 vec[ND ][0].elements[N] = catalog.average[i].D; 100 vec[Nd1][0].elements[N] = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], AVE_dMAG);101 vec[Nd1][0].elements[N] = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], AVE_dMAG); 101 102 vec[Nd2][0].elements[N] = dM2; 102 vec[Nx ][0].elements[N] = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], AVE_Xm);103 vec[Nc ][0].elements[N] = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], AVE_NCODE);104 vec[Np ][0].elements[N] = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], AVE_NPHOT);105 vec[Nt ][0].elements[N] = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], AVE_NCRIT);103 vec[Nx ][0].elements[N] = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], AVE_Xm); 104 vec[Nc ][0].elements[N] = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], AVE_NCODE); 105 vec[Np ][0].elements[N] = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], AVE_NPHOT); 106 vec[Nt ][0].elements[N] = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], AVE_NCRIT); 106 107 N ++; 107 108 if (N == NSTAR) { -
trunk/Ohana/src/opihi/dvo/calmextract.c
r8455 r12332 7 7 8 8 int i, j, k, m, N, N1, Nr, mode[2]; 9 int NSTAR, Nstar, Nsec ;9 int NSTAR, Nstar, Nsecfilt; 10 10 char *RegionName, *RegionList; 11 11 double *M1, M2, dM2, color; … … 22 22 RegionName = NULL; 23 23 RegionList = NULL; 24 skylist = NULL; 24 25 vec = NULL; 25 26 26 27 /* load photcode information */ 27 28 if (!InitPhotcodes ()) goto escape; 28 Nsec = GetPhotcodeNsecfilt ();29 Nsecfilt = GetPhotcodeNsecfilt (); 29 30 30 31 /* command line arguments */ … … 90 91 91 92 /* PRI/SEC must have data for color term */ 92 if (code[0][0].c1 && code[0][0].c2 && !PhotColor (&catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], code[0][0].c1, code[0][0].c2, &color)) continue;93 if (code[0][0].c1 && code[0][0].c2 && !PhotColor (&catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], code[0][0].c1, code[0][0].c2, &color)) continue; 93 94 94 95 /* find data for filter 2 (REF) */ … … 96 97 dM2 = NO_MAG; 97 98 for (j = 0; j < catalog.average[i].Nm; j++) { 98 if (catalog.measure[m+j]. source != code[1][0].code) continue;99 if (catalog.measure[m+j].photcode != code[1][0].code) continue; 99 100 M2 = PhotCat (&catalog.measure[m+j]); 100 dM2 = catalog.measure[m+j].dM _PS;101 dM2 = catalog.measure[m+j].dM; 101 102 } 102 103 if (M2 == NO_MAG) continue; 103 104 104 105 /* find data for filter 1 */ 105 M1 = ExtractMeasures (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N1, MEAS_MAG);106 M1 = ExtractMeasures (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N1, MEAS_MAG); 106 107 if (N1 == 0) goto skip; 107 108 … … 114 115 } 115 116 116 ConcatMeasures (vec[Nt ], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], N1, MEAS_TIME);117 ConcatMeasures (vec[Nz ], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], N1, MEAS_AIRMASS);118 ConcatMeasures (vec[NT ], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], N1, MEAS_EXPTIME);119 ConcatMeasures (vec[NP ], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], N1, MEAS_PHOTCODE);120 ConcatMeasures (vec[Nd1], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], N1, MEAS_dMAG);121 ConcatMeasures (vec[Nxc], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], N1, MEAS_XCCD);122 ConcatMeasures (vec[Nyc], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], N1, MEAS_YCCD);123 ConcatMeasures (vec[Nxm], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], N1, MEAS_XMOSAIC);124 ConcatMeasures (vec[Nym], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], N1, MEAS_YMOSAIC);117 ConcatMeasures (vec[Nt ], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], N1, MEAS_TIME); 118 ConcatMeasures (vec[Nz ], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], N1, MEAS_AIRMASS); 119 ConcatMeasures (vec[NT ], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], N1, MEAS_EXPTIME); 120 ConcatMeasures (vec[NP ], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], N1, MEAS_PHOTCODE); 121 ConcatMeasures (vec[Nd1], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], N1, MEAS_dMAG); 122 ConcatMeasures (vec[Nxc], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], N1, MEAS_XCCD); 123 ConcatMeasures (vec[Nyc], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], N1, MEAS_YCCD); 124 ConcatMeasures (vec[Nxm], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], N1, MEAS_XMOSAIC); 125 ConcatMeasures (vec[Nym], code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], N1, MEAS_YMOSAIC); 125 126 126 127 for (j = 0; j < N1; j++, N++) { -
trunk/Ohana/src/opihi/dvo/catalog.c
r8427 r12332 197 197 dparse (&D, Ad, tbuffer); 198 198 dparse (&M, Am, tbuffer); 199 catalog.average[nstar].R _PS= R;200 catalog.average[nstar].D _PS= D;201 catalog.average[nstar].M _PS= M;199 catalog.average[nstar].R = R; 200 catalog.average[nstar].D = D; 201 catalog.average[nstar].M = M; 202 202 nstar++; 203 203 if (nstar == NSTARS - 1) { … … 239 239 dparse (&D, Ad, &tbuffer[i*Bytes_Star]); 240 240 dparse (&M, Am, &tbuffer[i*Bytes_Star]); 241 catalog.average[nstar].R _PS= R;242 catalog.average[nstar].D _PS= D;243 catalog.average[nstar].M _PS= M;241 catalog.average[nstar].R = R; 242 catalog.average[nstar].D = D; 243 catalog.average[nstar].M = M; 244 244 nstar++; 245 245 if (nstar == NSTARS - 1) { … … 289 289 dparse (&D, 2, &tbuffer[i*BYTES_STAR]); 290 290 dparse (&M, 3, &tbuffer[i*BYTES_STAR]); 291 catalog.average[nstar].R _PS= R;292 catalog.average[nstar].D _PS= D;293 catalog.average[nstar].M _PS= M;291 catalog.average[nstar].R = R; 292 catalog.average[nstar].D = D; 293 catalog.average[nstar].M = M; 294 294 nstar++; 295 295 if (nstar == NSTARS - 1) { … … 342 342 if (IDclip && (catalog.average[i].code != IDchoice)) 343 343 continue; 344 Zvec.elements[N] = MIN (1.0, MAX (0.01, (catalog.average[i].M _PS- Mz) / Mr));344 Zvec.elements[N] = MIN (1.0, MAX (0.01, (catalog.average[i].M - Mz) / Mr)); 345 345 if (LimExclude && (Zvec.elements[N] > 0.99)) continue; 346 346 if (Zvec.elements[N] < 0.011) continue; 347 while (catalog.average[i].R _PS < Rmin) catalog.average[i].R_PS+= 360.0;348 while (catalog.average[i].R _PS > Rmax) catalog.average[i].R_PS-= 360.0;349 if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R _PS, catalog.average[i].D_PS, &graphmode.coords)) N ++;347 while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0; 348 while (catalog.average[i].R > Rmax) catalog.average[i].R -= 360.0; 349 if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R, catalog.average[i].D, &graphmode.coords)) N ++; 350 350 } 351 351 break; 352 352 case (NUMSCALE): 353 353 for (N = i = 0; i < catalog.Naverage; i++) { 354 if (clip && ((catalog.average[i].M _PS > Mz) || (catalog.average[i].M_PS< Mr+Mz)))354 if (clip && ((catalog.average[i].M > Mz) || (catalog.average[i].M < Mr+Mz))) 355 355 continue; 356 356 if (IDclip && (catalog.average[i].code != IDchoice)) … … 360 360 if (Zvec.elements[N] == 0.01) 361 361 continue; 362 while (catalog.average[i].R _PS < Rmin) catalog.average[i].R_PS+= 360.0;363 while (catalog.average[i].R _PS > Rmax) catalog.average[i].R_PS-= 360.0;364 if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R _PS, catalog.average[i].D_PS, &graphmode.coords)) N++;362 while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0; 363 while (catalog.average[i].R > Rmax) catalog.average[i].R -= 360.0; 364 if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R, catalog.average[i].D, &graphmode.coords)) N++; 365 365 } 366 366 break; 367 367 case (MISSCALE): 368 368 for (N = i = 0; i < catalog.Naverage; i++) { 369 if (clip && ((catalog.average[i].M _PS > Mz) || (catalog.average[i].M_PS< Mr+Mz)))369 if (clip && ((catalog.average[i].M > Mz) || (catalog.average[i].M < Mr+Mz))) 370 370 continue; 371 371 if (IDclip && (catalog.average[i].code != IDchoice)) … … 375 375 if (Zvec.elements[N] == 0.01) 376 376 continue; 377 while (catalog.average[i].R _PS < Rmin) catalog.average[i].R_PS+= 360.0;378 while (catalog.average[i].R _PS > Rmax) catalog.average[i].R_PS-= 360.0;379 if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R _PS, catalog.average[i].D_PS, &graphmode.coords)) N++;377 while (catalog.average[i].R < Rmin) catalog.average[i].R += 360.0; 378 while (catalog.average[i].R > Rmax) catalog.average[i].R -= 360.0; 379 if (fRD_to_XY (&Xvec.elements[N], &Yvec.elements[N], catalog.average[i].R, catalog.average[i].D, &graphmode.coords)) N++; 380 380 } 381 381 break; -
trunk/Ohana/src/opihi/dvo/ccd.c
r8455 r12332 7 7 int i, m, k, Npts, NPTS, N; 8 8 int N1, N2, i1, i2, mode[4]; 9 int Nsec , KeepNulls;9 int Nsecfilt, KeepNulls; 10 10 11 11 Catalog catalog; … … 20 20 RegionName = NULL; 21 21 RegionList = NULL; 22 skylist = NULL; 22 23 23 24 /* load photcode information */ 24 25 if (!InitPhotcodes ()) goto escape; 25 Nsec = GetPhotcodeNsecfilt ();26 Nsecfilt = GetPhotcodeNsecfilt (); 26 27 27 28 /* interpret command-line options */ … … 75 76 76 77 SetSelectionParam (0); 77 M1 = ExtractDMag (&code[0], &mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N1);78 M1 = ExtractDMag (&code[0], &mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N1); 78 79 if (N1 == 0) goto skip; 79 80 80 81 SetSelectionParam (2); 81 M2 = ExtractDMag (&code[2], &mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N2);82 M2 = ExtractDMag (&code[2], &mode[2], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N2); 82 83 if (N2 == 0) { 83 84 if (KeepNulls) { -
trunk/Ohana/src/opihi/dvo/cmatch.c
r8427 r12332 51 51 dparse (&D, 2, &tbuffer[i*BYTES_STAR]); 52 52 dparse (&M, 3, &tbuffer[i*BYTES_STAR]); 53 catalog2.average[nstar].R _PS= R;54 catalog2.average[nstar].D _PS= D;53 catalog2.average[nstar].R = R; 54 catalog2.average[nstar].D = D; 55 55 catalog2.average[nstar].M = M * 1000.0; 56 56 nstar++; -
trunk/Ohana/src/opihi/dvo/cmd.c
r8455 r12332 7 7 int i, j, m, i1, i3, N1, N3, N; 8 8 int Npts, NPTS, mode[3]; 9 int Nsec , KeepNulls;9 int Nsecfilt, KeepNulls; 10 10 11 11 PhotCode *code[3]; … … 20 20 RegionName = NULL; 21 21 RegionList = NULL; 22 skylist = NULL; 22 23 23 24 /* load photcode information */ 24 25 if (!InitPhotcodes ()) goto escape; 25 Nsec = GetPhotcodeNsecfilt ();26 Nsecfilt = GetPhotcodeNsecfilt (); 26 27 27 28 /* interpret command-line options */ … … 73 74 74 75 SetSelectionParam (0); 75 M1 = ExtractDMag (code, mode, &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N1);76 M1 = ExtractDMag (code, mode, &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N1); 76 77 if (N1 == 0) goto skip; 77 78 78 79 SetSelectionParam (2); 79 M3 = ExtractMagnitudes (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N3);80 M3 = ExtractMagnitudes (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N3); 80 81 if (N3 == 0) { 81 82 if (KeepNulls) { -
trunk/Ohana/src/opihi/dvo/compare.c
r7917 r12332 38 38 rvec[0].elements[Nmatch] = catlog1[0].average[i].R; 39 39 dvec[0].elements[Nmatch] = catlog1[0].average[i].D; 40 mvec[0].elements[Nmatch] = catlog1[0].average[i].M;40 // mvec[0].elements[Nmatch] = catlog1[0].average[i].M; 41 41 drvec[0].elements[Nmatch] = dX; 42 42 ddvec[0].elements[Nmatch] = dY; 43 dmvec[0].elements[Nmatch] = catlog1[0].average[i].M - catlog2[0].average[j].M;43 // dmvec[0].elements[Nmatch] = catlog1[0].average[i].M - catlog2[0].average[j].M; 44 44 Nmatch ++; 45 45 if (Nmatch == NMATCH - 1) { -
trunk/Ohana/src/opihi/dvo/ddmags.c
r8455 r12332 7 7 int i, m, k, N, Npts, NPTS; 8 8 int N1, N2, i1, i2, mode[4]; 9 int Nsec , KeepNulls;9 int Nsecfilt, KeepNulls; 10 10 11 11 Catalog catalog; … … 24 24 /* load photcode information */ 25 25 if (!InitPhotcodes ()) goto escape; 26 Nsec = GetPhotcodeNsecfilt ();26 Nsecfilt = GetPhotcodeNsecfilt (); 27 27 28 28 /* interpret command-line options */ … … 79 79 80 80 SetSelectionParam (0); 81 M1 = ExtractDMag (&code[0], &mode[0], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N1);81 M1 = ExtractDMag (&code[0], &mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N1); 82 82 if (N1 == 0) goto skip; 83 83 84 84 SetSelectionParam (2); 85 M2 = ExtractDMag (&code[2], &mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N2);85 M2 = ExtractDMag (&code[2], &mode[2], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N2); 86 86 if (N2 == 0) { 87 87 if (KeepNulls) { -
trunk/Ohana/src/opihi/dvo/dmagaves.c
r8455 r12332 7 7 int i, j, k, m, N1; 8 8 int Npts, NPTS, param, mode[3]; 9 int Nsec ;9 int Nsecfilt; 10 10 11 11 PhotCode *code[3]; … … 20 20 RegionName = NULL; 21 21 RegionList = NULL; 22 skylist = NULL; 22 23 code[2] = NULL; 23 24 24 25 /* load photcode information */ 25 26 if (!InitPhotcodes ()) goto escape; 26 Nsec = GetPhotcodeNsecfilt ();27 Nsecfilt = GetPhotcodeNsecfilt (); 27 28 28 29 /* interpret command-line options */ … … 67 68 68 69 SetSelectionParam (0); 69 M1 = ExtractDMag (code, mode, &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N1);70 M1 = ExtractDMag (code, mode, &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N1); 70 71 if (N1 == 0) goto skip; 71 72 72 73 SetSelectionParam (2); 73 M2 = ExtractAverages (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], param);74 M2 = ExtractAverages (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], param); 74 75 75 76 for (k = 0; k < N1; k++) { -
trunk/Ohana/src/opihi/dvo/dmagmeas.c
r8455 r12332 7 7 int i, j, m, i1, i3, N1, N3, N; 8 8 int Npts, NPTS, param, mode[3]; 9 int Nsec , KeepNulls;9 int Nsecfilt, KeepNulls; 10 10 11 11 Catalog catalog; … … 20 20 RegionName = NULL; 21 21 RegionList = NULL; 22 skylist = NULL; 22 23 code[2] = NULL; 23 24 24 25 /* load photcode information */ 25 26 if (!InitPhotcodes ()) goto escape; 26 Nsec = GetPhotcodeNsecfilt ();27 Nsecfilt = GetPhotcodeNsecfilt (); 27 28 28 29 /* interpret command-line options */ … … 75 76 76 77 SetSelectionParam (0); 77 M1 = ExtractDMag (code, mode, &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N1);78 M1 = ExtractDMag (code, mode, &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N1); 78 79 if (N1 == 0) goto skip; 79 80 80 81 SetSelectionParam (2); 81 M3 = ExtractMeasures (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N3, param);82 M3 = ExtractMeasures (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N3, param); 82 83 if (N3 == 0) { 83 84 if (KeepNulls) { -
trunk/Ohana/src/opihi/dvo/dmags.c
r8455 r12332 7 7 int i, j, m, i1, i3, N1, N3, N; 8 8 int Npts, NPTS, mode[3]; 9 int Nsec , KeepNulls;9 int Nsecfilt, KeepNulls; 10 10 11 11 PhotCode *code[3]; … … 24 24 /* load photcode information */ 25 25 if (!InitPhotcodes ()) goto escape; 26 Nsec = GetPhotcodeNsecfilt ();26 Nsecfilt = GetPhotcodeNsecfilt (); 27 27 28 28 /* interpret command-line options */ … … 74 74 75 75 SetSelectionParam (0); 76 M1 = ExtractDMag (code, mode, &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N1);76 M1 = ExtractDMag (code, mode, &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N1); 77 77 if (N1 == 0) goto skip; 78 78 79 79 SetSelectionParam (2); 80 M3 = ExtractMagnitudes (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsec ], &catalog.measure[m], &N3);80 M3 = ExtractMagnitudes (code[2], mode[2], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], &N3); 81 81 if (N3 == 0) { 82 82 if (KeepNulls) { -
trunk/Ohana/src/opihi/dvo/dmt.c
r8455 r12332 5 5 6 6 int i, m, k, N, Ngraph, SaveVectors; 7 int Ns , Nsec, NPTS;7 int Nsec, Nsecfilt, NPTS; 8 8 double Radius; 9 9 float dt1, dt2, dmt1, dmt2; … … 16 16 Vector Xvec, Yvec, Zvec, Rvec, Dvec; 17 17 Vector *vec1, *vec2, *vec3, *vec4, *vec5; 18 19 Dvec.elements = Rvec.elements = Zvec.elements = NULL; 18 20 19 21 if (!InitPhotcodes ()) return (FALSE); … … 44 46 return (FALSE); 45 47 } 46 if ( (code[0].type != PHOT_SEC) && (code[0].type != PHOT_PRI)) {47 gprint (GP_ERR, "first filter must be a PRIMARY or SECONDARYphotometry type\n");48 if (code[0].type != PHOT_SEC) { 49 gprint (GP_ERR, "first filter must be a average photometry type\n"); 48 50 return (FALSE); 49 51 } 50 Nsec = GetPhotcodeNsecfilt();51 Ns = GetPhotcodeNsec (code[0].code);52 Nsecfilt = GetPhotcodeNsecfilt(); 53 Nsec = GetPhotcodeNsec (code[0].code); 52 54 53 55 Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax)); … … 82 84 if (catalog.average[i].Nm != 3) continue; 83 85 m = catalog.average[i].offset; 84 M0 = (Ns == -1) ? catalog.average[i].M : catalog.secfilt[i*Nsec+Ns].M_PS;86 M0 = catalog.secfilt[i*Nsecfilt+Nsec].M; 85 87 M1 = PhotCat (&catalog.measure[m+0]); 86 88 M2 = PhotCat (&catalog.measure[m+1]); -
trunk/Ohana/src/opihi/dvo/extract.c
r7917 r12332 119 119 if (PhotcodeSelect) { 120 120 Ns = GetPhotcodeNsec (code[0].code); 121 if ((mode != REF) && (code[0].type != PHOT_SEC) && (code[0].type != PHOT_PRI)) {122 gprint (GP_ERR, "filter must be a PRIMARY or SECONDARYphotometry type\n");121 if ((mode != REF) && (code[0].type != PHOT_SEC)) { 122 gprint (GP_ERR, "filter must be a average photometry type\n"); 123 123 return (FALSE); 124 124 } … … 341 341 Ncode = 0; 342 342 for (k = 0; k < catalog.average[i].Nm; k++, m++) { 343 if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m]. source)) continue;343 if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m].photcode)) continue; 344 344 Ncode ++; 345 345 } … … 357 357 Ncode = 0; 358 358 for (k = 0; k < catalog.average[i].Nm; k++, m++) { 359 if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m]. source)) continue;360 if (catalog.measure[m]. source & (ID_MEAS_POOR | ID_MEAS_SKIP)) continue;359 if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m].photcode)) continue; 360 if (catalog.measure[m].photcode & (ID_MEAS_POOR | ID_MEAS_SKIP)) continue; 361 361 Ncode ++; 362 362 } … … 407 407 vec[0].elements[N] = -32; 408 408 for (k = 0; k < catalog.average[i].Nm; k++) { 409 if (catalog.measure[m+k]. source == N1) {409 if (catalog.measure[m+k].photcode == N1) { 410 410 vec[0].elements[N] = PhotCat (&catalog.measure[m+k]); 411 411 k = catalog.average[i].Nm; -
trunk/Ohana/src/opihi/dvo/fitcolors.c
r11120 r12332 12 12 int i, k, m, N, NP1, NP2, NP, Np, Npts, NPTS; 13 13 int N1, N2, i1, i2, mode[4]; 14 int Nsec , status;14 int Nsecfilt, status; 15 15 void *oldsignal; 16 16 char *RegionName, *RegionList; … … 43 43 /* load photcode information */ 44 44 if (!InitPhotcodes ()) goto escape; 45 Nsec = GetPhotcodeNsecfilt ();45 Nsecfilt = GetPhotcodeNsecfilt (); 46 46 47 47 /* interpret command-line options */ … … 70 70 71 71 PLOT = FALSE; 72 NPX = NPY = 0; 72 73 if ((N = get_argument (argc, argv, "-plot"))) { 73 74 remove_argument (N, &argc, argv); … … 217 218 218 219 SetSelectionParam (0); 219 M1 = ExtractDMag (&code[0], &mode[0], &catalog[k].average[i], &catalog[k].secfilt[i*Nsec ], &catalog[k].measure[m], &N1);220 M1 = ExtractDMag (&code[0], &mode[0], &catalog[k].average[i], &catalog[k].secfilt[i*Nsecfilt], &catalog[k].measure[m], &N1); 220 221 if (N1 == 0) goto skip_star; 221 222 222 223 SetSelectionParam (2); 223 M2 = ExtractDMag (&code[2], &mode[2], &catalog[k].average[i], &catalog[k].secfilt[i*Nsec ], &catalog[k].measure[m], &N2);224 M2 = ExtractDMag (&code[2], &mode[2], &catalog[k].average[i], &catalog[k].secfilt[i*Nsecfilt], &catalog[k].measure[m], &N2); 224 225 if (N2 == 0) goto skip_star; 225 226 -
trunk/Ohana/src/opihi/dvo/fitsed.c
r8455 r12332 25 25 int *hashcode; 26 26 int i, j, k, m, N, done, Nfit; 27 int Nsec , status;27 int Nsecfilt, status; 28 28 void *oldsignal; 29 29 char *RegionName, *RegionList; … … 68 68 resSection.name = NULL; 69 69 70 Nrow = 0; 71 72 fiterrs = NULL; 73 fitmags = NULL; 74 70 75 oldsignal = signal (SIGINT, handle_interrupt); 71 76 interrupt = FALSE; … … 73 78 /* load photcode information */ 74 79 if (!InitPhotcodes ()) goto escape; 75 Nsec = GetPhotcodeNsecfilt ();80 Nsecfilt = GetPhotcodeNsecfilt (); 76 81 77 82 /* interpret command-line options */ … … 203 208 m = catalog.average[i].offset; 204 209 for (j = 0; j < catalog.average[i].Nm; j++) { 205 idx = hashcode[catalog.measure[m+j]. source];210 idx = hashcode[catalog.measure[m+j].photcode]; 206 211 if (idx == -1) continue; 207 212 // XXX do something more clever if more than one value exists per photcode 208 sourceValue.mags[idx] = catalog.measure[m+j].M _PS+ vegaToAB[idx];209 sourceError.mags[idx] = catalog.measure[m+j].dM _PS;210 if ((catalog.measure[m+j]. source == USNOred) || (catalog.measure[m+j].source == USNOblu)) {213 sourceValue.mags[idx] = catalog.measure[m+j].M + vegaToAB[idx]; 214 sourceError.mags[idx] = catalog.measure[m+j].dM; 215 if ((catalog.measure[m+j].photcode == USNOred) || (catalog.measure[m+j].photcode == USNOblu)) { 211 216 sourceError.mags[idx] = 0.3; 212 217 } -
trunk/Ohana/src/opihi/dvo/gimages.c
r7917 r12332 81 81 if (PhotCodeSelect) { 82 82 if ((code[0].type == PHOT_REF) || (code[0].type == PHOT_DEP)) { 83 if (code[0].code != image[i]. source) continue;83 if (code[0].code != image[i].photcode) continue; 84 84 } 85 if ( (code[0].type == PHOT_PRI) || (code[0].type == PHOT_SEC)) {86 if (code[0].code != GetPhotcodeEquivCodebyCode (image[i]. source)) continue;85 if (code[0].type == PHOT_SEC) { 86 if (code[0].code != GetPhotcodeEquivCodebyCode (image[i].photcode)) continue; 87 87 } 88 88 } … … 104 104 if (PixelCoords) { 105 105 gprint (GP_LOG, "%3d %s %6.1f %6.1f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n", 106 Nfound, image[i].name, X, Y, date, image[i].nstar, image[i]. source, image[i].secz_PS, image[i].Mcal_PS, image[i].dMcal_PS, image[i].exptime, image[i].code);106 Nfound, image[i].name, X, Y, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal, image[i].exptime, image[i].code); 107 107 } else { 108 108 XY_to_RD (&ra, &dec, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 109 109 gprint (GP_LOG, "%3d %s %8.4f %8.4f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n", 110 Nfound, image[i].name, ra, dec, date, image[i].nstar, image[i]. source, image[i].secz_PS, image[i].Mcal_PS, image[i].dMcal_PS, image[i].exptime, image[i].code);110 Nfound, image[i].name, ra, dec, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal, image[i].exptime, image[i].code); 111 111 } 112 112 sprintf (name, "IMAGEx:%d", Nfound); -
trunk/Ohana/src/opihi/dvo/gstar.c
r8455 r12332 1 1 # include "dvoshell.h" 2 2 3 void initPhotcodeSequence (int Nsec );3 void initPhotcodeSequence (int Nsecfilt); 4 4 void freePhotcodeSequence (); 5 5 void printPhotcodeSequence (Average *average, SecFilt *secfilt, int entry, int type); … … 11 11 double Mcat, Mrel; 12 12 float *RA, *DEC; 13 int i, j, k, m, N, *N1, Nsec , NPTS, QUIET;13 int i, j, k, m, N, *N1, Nsecfilt, NPTS, QUIET; 14 14 int Nstars, found, GetMeasures, Nlo, Nhi; 15 15 int SaveVectors; … … 22 22 23 23 if (!InitPhotcodes ()) return (FALSE); 24 Nsec = GetPhotcodeNsecfilt ();24 Nsecfilt = GetPhotcodeNsecfilt (); 25 25 26 26 QUIET = FALSE; … … 127 127 } 128 128 129 initPhotcodeSequence (Nsec );129 initPhotcodeSequence (Nsecfilt); 130 130 131 131 for (i = Nlo; (i < catalog.Naverage) && !found; i++) { … … 139 139 if (!QUIET) { 140 140 gprint (GP_LOG, "star: %d\n", k); 141 gprint (GP_LOG, "% 9.5f %9.5f %3d of %3d %4.1f %5d\n", catalog.average[k].R, catalog.average[k].D,141 gprint (GP_LOG, "%11.7f %11.7f %3d of %3d %4.1f %5d\n", catalog.average[k].R, catalog.average[k].D, 142 142 catalog.average[k].Nm, catalog.average[k].Nn + catalog.average[k].Nm, 143 143 0.01*catalog.average[k].Xp, catalog.average[k].code); 144 144 145 145 /* filter names */ 146 for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 3);146 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 3); 147 147 gprint (GP_LOG, "\n"); 148 148 149 149 /* average mags */ 150 for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 0);150 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 0); 151 151 gprint (GP_LOG, "\n"); 152 152 153 153 /* average mag errors */ 154 for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 1);154 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 1); 155 155 gprint (GP_LOG, "\n"); 156 156 157 157 /* average mag chisq */ 158 for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 2);158 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 2); 159 159 gprint (GP_LOG, "\n"); 160 160 } … … 165 165 166 166 Mcat = PhotCat (&catalog.measure[m]); 167 Mrel = PhotRel (&catalog.measure[m], &catalog.average[k], &catalog.secfilt[k*Nsec ]);167 Mrel = PhotRel (&catalog.measure[m], &catalog.average[k], &catalog.secfilt[k*Nsecfilt]); 168 168 169 169 if (GetMeasures && !QUIET) { 170 170 date = sec_to_date (catalog.measure[m].t); 171 171 gprint (GP_LOG, "%6.3f %6.3f %5.3f %20s %5.2f %5.2f %2d %3x %3d %-20s\n", 172 Mcat, Mrel, catalog.measure[m].dM _PS,173 date, catalog.measure[m].dR _PS, catalog.measure[m].dD_PS,172 Mcat, Mrel, catalog.measure[m].dM, 173 date, catalog.measure[m].dR, catalog.measure[m].dD, 174 174 catalog.measure[m].dophot, catalog.measure[m].flags, 175 catalog.measure[m]. source, GetPhotcodeNamebyCode (catalog.measure[m].source));175 catalog.measure[m].photcode, GetPhotcodeNamebyCode (catalog.measure[m].photcode)); 176 176 free (date); 177 177 } … … 180 180 vec1[0].elements[N] = Mcat; 181 181 vec2[0].elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat); 182 vec3[0].elements[N] = catalog.measure[m].airmass _PS;183 vec4[0].elements[N] = catalog.measure[m]. source;182 vec3[0].elements[N] = catalog.measure[m].airmass; 183 vec4[0].elements[N] = catalog.measure[m].photcode; 184 184 N ++; 185 185 if (N == NPTS - 1) { … … 223 223 static int *sequence = NULL; 224 224 225 void initPhotcodeSequence (int Nsec ) {225 void initPhotcodeSequence (int Nsecfilt) { 226 226 227 227 int j; … … 230 230 231 231 // sequence contains, in desired order, secfilt number (0 == pri) 232 ALLOCATE (sequence, int, Nsec + 1);233 ALLOCATE (codeNumber, int, Nsec + 1);232 ALLOCATE (sequence, int, Nsecfilt); 233 ALLOCATE (codeNumber, int, Nsecfilt); 234 234 235 235 /* filter names -- primary code is 0 in this function */ 236 for (j = 0; j < Nsec + 1; j++) {236 for (j = 0; j < Nsecfilt; j++) { 237 237 code = GetPhotcodebyNsec (j); 238 238 codeNumber[j] = code[0].code; … … 240 240 } 241 241 242 isort_pair (codeNumber, sequence, Nsec + 1);242 isort_pair (codeNumber, sequence, Nsecfilt); 243 243 free (codeNumber); 244 244 } … … 254 254 PhotCode *code; 255 255 256 seq = sequence[entry] - 1;256 seq = sequence[entry]; 257 257 258 258 switch (type) { 259 259 case 0: /* average mags */ 260 260 if (seq == -1) { 261 print_value ( average[0].M, average[0].M);261 print_value (NO_MAG, NO_MAG); 262 262 } else { 263 print_value (secfilt[seq].M _PS, secfilt[seq].M_PS);263 print_value (secfilt[seq].M, secfilt[seq].M); 264 264 } 265 265 break; … … 267 267 case 1: /* average mags errors */ 268 268 if (seq == -1) { 269 print_value ( average[0].dM, average[0].dM);269 print_value (NO_MAG, NO_MAG); 270 270 } else { 271 print_value (secfilt[seq].dM _PS, secfilt[seq].dM_PS);271 print_value (secfilt[seq].dM, secfilt[seq].dM); 272 272 } 273 273 break; … … 275 275 case 2: /* average mag chisq */ 276 276 if (seq == -1) { 277 print_value ( pow (10.0, 0.01*average[0].Xm), average[0].Xm);277 print_value (NO_MAG, NO_MAG); 278 278 } else { 279 279 print_value (pow (10.0, 0.01*secfilt[seq].Xm), secfilt[seq].Xm); … … 282 282 283 283 case 3: /* filter names */ 284 code = GetPhotcodebyNsec (seq + 1);285 gprint (GP_LOG, "% 6s ", code[0].name);286 break; 287 } 288 } 284 code = GetPhotcodebyNsec (seq); 285 gprint (GP_LOG, "%-6s ", code[0].name); 286 break; 287 } 288 } -
trunk/Ohana/src/opihi/dvo/imbox.c
r10930 r12332 3 3 int imbox (int argc, char **argv) { 4 4 5 int i, j, Nskip, status, InPic, flipped, Nextend;5 int j, Nskip, status, InPic, flipped; 6 6 Vector Xvec, Yvec; 7 7 double r, d, x[4], y[4], Rmin, Rmax, Rmid; -
trunk/Ohana/src/opihi/dvo/imdata.c
r8455 r12332 39 39 } 40 40 } 41 42 gprint (GP_ERR, "function is poorly defined; disabled and may be removed\n"); 43 return (FALSE); 41 44 42 45 if (argc != 4) { … … 137 140 if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue; 138 141 n = catalog.measure[i].averef; 139 vec[0].elements[N] = catalog.average[n].R - catalog.measure[i].dR _PS/ 3600.0;142 vec[0].elements[N] = catalog.average[n].R - catalog.measure[i].dR / 3600.0; 140 143 N++; 141 144 CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000); … … 146 149 if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue; 147 150 n = catalog.measure[i].averef; 148 vec[0].elements[N] = catalog.average[n].D - catalog.measure[i].dD _PS/ 3600.0;151 vec[0].elements[N] = catalog.average[n].D - catalog.measure[i].dD / 3600.0; 149 152 N++; 150 153 CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000); … … 154 157 for (i = 0; i < catalog.Nmeasure; i++) { 155 158 if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue; 156 vec[0].elements[N] = catalog.measure[i].M _PS;159 vec[0].elements[N] = catalog.measure[i].M; 157 160 N++; 158 161 CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000); … … 162 165 for (i = 0; i < catalog.Nmeasure; i++) { 163 166 if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue; 164 vec[0].elements[N] = catalog.measure[i].dM _PS;167 vec[0].elements[N] = catalog.measure[i].dM; 165 168 N++; 166 169 CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000); … … 170 173 for (i = 0; i < catalog.Nmeasure; i++) { 171 174 if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue; 172 vec[0].elements[N] = catalog.measure[i].Mcal _PS;175 vec[0].elements[N] = catalog.measure[i].Mcal; 173 176 N++; 174 177 CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000); … … 179 182 if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue; 180 183 n = catalog.measure[i].averef; 181 vec[0].elements[N] = catalog.average[n].M;184 // vec[0].elements[N] = catalog.average[n].M; 182 185 N++; 183 186 } … … 186 189 for (i = 0; i < catalog.Nmeasure; i++) { 187 190 if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue; 188 vec[0].elements[N] = catalog.measure[i]. source;191 vec[0].elements[N] = catalog.measure[i].photcode; 189 192 N++; 190 193 CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000); -
trunk/Ohana/src/opihi/dvo/imextract.c
r7917 r12332 63 63 return (FALSE); 64 64 } 65 if ((code[0].type != PHOT_ PRI) && (code[0].type != PHOT_SEC) && (code[0].type != PHOT_DEP)) {65 if ((code[0].type != PHOT_SEC) && (code[0].type != PHOT_DEP)) { 66 66 gprint (GP_ERR, "photcode must be primary, secondary, or dependent code\n"); 67 67 return (FALSE); … … 114 114 if (PhotcodeSelect) { 115 115 if (code[0].type == PHOT_DEP) { 116 if (code[0].code != image[j]. source) continue;116 if (code[0].code != image[j].photcode) continue; 117 117 } else { 118 if (code[0].code != GetPhotcodeEquivCodebyCode (image[j]. source)) continue;118 if (code[0].code != GetPhotcodeEquivCodebyCode (image[j].photcode)) continue; 119 119 } 120 120 } … … 139 139 break; 140 140 case (AIRMASS): 141 vec[0].elements[N] = image[j].secz _PS;141 vec[0].elements[N] = image[j].secz; 142 142 break; 143 143 case (MCAL): 144 vec[0].elements[N] = image[j].Mcal _PS;144 vec[0].elements[N] = image[j].Mcal; 145 145 break; 146 146 case (dMCAL): 147 vec[0].elements[N] = image[j].dMcal _PS;147 vec[0].elements[N] = image[j].dMcal; 148 148 break; 149 149 case (PHOTCODE): 150 vec[0].elements[N] = image[j]. source;150 vec[0].elements[N] = image[j].photcode; 151 151 break; 152 152 case (TIME): -
trunk/Ohana/src/opihi/dvo/imlist.c
r10929 r12332 77 77 if (PhotcodeSelect) { 78 78 if (PhotcodeValue[0].type == PHOT_DEP) { 79 if (PhotcodeValue[0].code != image[i]. source) continue;79 if (PhotcodeValue[0].code != image[i].photcode) continue; 80 80 } else { 81 if (PhotcodeValue[0].code != GetPhotcodeEquivCodebyCode (image[i]. source)) continue;81 if (PhotcodeValue[0].code != GetPhotcodeEquivCodebyCode (image[i].photcode)) continue; 82 82 } 83 83 } … … 90 90 } 91 91 gprint (GP_LOG, "%3d %s %8.4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n", 92 i, image[i].name, r, d, t, image[i].nstar, image[i]. source, image[i].secz_PS, image[i].Mcal_PS, image[i].dMcal_PS);92 i, image[i].name, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal); 93 93 } 94 94 -
trunk/Ohana/src/opihi/dvo/imphot.c
r9362 r12332 65 65 switch (image[i].order) { 66 66 case 0: 67 gprint (GP_ERR, "%s: %d - %f\n", image[i].name, image[i].order, image[i].Mcal _PS);67 gprint (GP_ERR, "%s: %d - %f\n", image[i].name, image[i].order, image[i].Mcal); 68 68 break; 69 69 case 1: 70 gprint (GP_ERR, "%s: %d - %f, %d %d\n", image[i].name, image[i].order, image[i].Mcal _PS, image[i].Mx, image[i].My);70 gprint (GP_ERR, "%s: %d - %f, %d %d\n", image[i].name, image[i].order, image[i].Mcal, image[i].Mx, image[i].My); 71 71 break; 72 72 case 2: 73 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d\n", image[i].name, image[i].order, image[i].Mcal _PS, image[i].Mx, image[i].My, image[i].Mxx, image[i].Mxy, image[i].Myy);73 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d\n", image[i].name, image[i].order, image[i].Mcal, image[i].Mx, image[i].My, image[i].Mxx, image[i].Mxy, image[i].Myy); 74 74 break; 75 75 case 3: 76 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal _PS, image[i].Mx, image[i].My,76 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal, image[i].Mx, image[i].My, 77 77 image[i].Mxx, image[i].Mxy, image[i].Myy, image[i].Mxxx, image[i].Mxxy, image[i].Mxyy, image[i].Myyy); 78 78 break; 79 79 case 4: 80 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d, %d %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal _PS, image[i].Mx, image[i].My,80 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d, %d %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal, image[i].Mx, image[i].My, 81 81 image[i].Mxx, image[i].Mxy, image[i].Myy, image[i].Mxxx, image[i].Mxxy, image[i].Mxyy, image[i].Myyy, 82 82 image[i].Mxxxx, image[i].Mxxxy, image[i].Mxxyy, image[i].Mxyyy, image[i].Myyyy); -
trunk/Ohana/src/opihi/dvo/imsearch.c
r7917 r12332 11 11 char *Filter, *obstime; 12 12 int Type, Mode, CCD; 13 time_t tzero ;13 time_t tzero, obstime_sec; 14 14 double trange; 15 15 … … 126 126 if (TypeSelect && (pimage[i].type != Type)) continue; 127 127 128 obstime = ctime ((time_t *)&pimage[i].obstime); 128 obstime_sec = (time_t) pimage[i].obstime; 129 obstime = ctime (&obstime_sec); 129 130 obstime[strlen(obstime)-1] = 0; 130 131 -
trunk/Ohana/src/opihi/dvo/imstats.c
r7917 r12332 45 45 gprint (GP_LOG, "seq ra (J2000) dec time (s) Nstars\n"); 46 46 for (i = 0; i < Nimage; i++) { 47 Xvec.elements[i] = image[i].secz _PS;47 Xvec.elements[i] = image[i].secz; 48 48 if (Mcal) 49 Yvec.elements[i] = image[i].Mcal _PS;49 Yvec.elements[i] = image[i].Mcal; 50 50 else 51 Yvec.elements[i] = image[i].dMcal _PS;51 Yvec.elements[i] = image[i].dMcal; 52 52 if (!FindMosaicForImage (image, Nimage, i)) continue; 53 53 XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 54 54 gprint (GP_ERR, "%d %8.4f %8.4f %10d %6d %5.3f %6.3f %6.3f\n", 55 55 i, r, d, image[i].tzero, image[i].nstar, Xvec.elements[i], 56 image[i].Mcal _PS, image[i].dMcal_PS);56 image[i].Mcal, image[i].dMcal); 57 57 } 58 58 if (AutoLimits) SetLimits (&Xvec, &Yvec, &graphmode); -
trunk/Ohana/src/opihi/dvo/lcurve.c
r8455 r12332 112 112 ALLOCATE (Xvec.elements, float, NPTS); 113 113 ALLOCATE (Yvec.elements, float, NPTS); 114 dYvec.elements = NULL; 114 115 if (ErrorBars) { ALLOCATE (dYvec.elements, float, NPTS); } 115 116 N = 0; … … 130 131 m = catalog.average[N1[i]].offset; 131 132 for (j = 0; j < catalog.average[N1[i]].Nm; j++, m++) { 132 if (ErrorBars) dYvec.elements[N] = catalog.measure[m].dM _PS;133 if (ErrorBars) dYvec.elements[N] = catalog.measure[m].dM; 133 134 Xvec.elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat); 134 135 Yvec.elements[N] = PhotCat (&catalog.measure[m]); -
trunk/Ohana/src/opihi/dvo/lightcurve.c
r8455 r12332 6 6 float *RA, *DEC; 7 7 int Nstars, found, PhotCodeSelect; 8 int i, j, k, m, N, NPTS, Nsec , RELPHOT, *N1, TimeFormat;8 int i, j, k, m, N, NPTS, Nsecfilt, RELPHOT, *N1, TimeFormat; 9 9 time_t TimeReference; 10 10 … … 16 16 17 17 if (!InitPhotcodes ()) return (FALSE); 18 Nsec = GetPhotcodeNsecfilt ();18 Nsecfilt = GetPhotcodeNsecfilt (); 19 19 20 20 if ((tvec = SelectVector ("tc", ANYVECTOR, TRUE)) == NULL) return (FALSE); … … 110 110 if (PhotCodeSelect) { 111 111 if ((code[0].type == PHOT_REF) || (code[0].type == PHOT_DEP)) { 112 if (code[0].code != catalog.measure[m]. source) continue;112 if (code[0].code != catalog.measure[m].photcode) continue; 113 113 } 114 if ( (code[0].type == PHOT_PRI) || (code[0].type == PHOT_SEC)) {115 if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m]. source)) continue;114 if (code[0].type == PHOT_SEC) { 115 if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m].photcode)) continue; 116 116 } 117 117 } 118 118 119 119 tvec[0].elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat); 120 dmvec[0].elements[N] = catalog.measure[m].dM _PS;120 dmvec[0].elements[N] = catalog.measure[m].dM; 121 121 if (RELPHOT) { 122 122 mvec[0].elements[N] = PhotCat (&catalog.measure[m]); 123 123 } else { 124 mvec[0].elements[N] = PhotRel (&catalog.measure[m], &catalog.average[k], &catalog.secfilt[k*Nsec ]);124 mvec[0].elements[N] = PhotRel (&catalog.measure[m], &catalog.average[k], &catalog.secfilt[k*Nsecfilt]); 125 125 } 126 126 N++; -
trunk/Ohana/src/opihi/dvo/match_image.c
r7680 r12332 30 30 31 31 for (N = N1; N < N2; N++) { 32 if ((image[N].tzero == T) && (image[N]. source == S)) {32 if ((image[N].tzero == T) && (image[N].photcode == S)) { 33 33 return (N); 34 34 } … … 66 66 67 67 for (N = N1; N < N2; N++) { 68 if ((image[subset[N]].tzero == T) && (image[subset[N]]. source == S)) {68 if ((image[subset[N]].tzero == T) && (image[subset[N]].photcode == S)) { 69 69 return (subset[N]); 70 70 } -
trunk/Ohana/src/opihi/dvo/mextract.c
r8455 r12332 4 4 5 5 int i, j, k, m, N, N1, NPTS; 6 int param, mode, Nsec ;6 int param, mode, Nsecfilt; 7 7 char *RegionName, *RegionList, *p; 8 8 double *M1; … … 23 23 /* load photcode information */ 24 24 if (!InitPhotcodes ()) goto escape; 25 Nsec = GetPhotcodeNsecfilt ();25 Nsecfilt = GetPhotcodeNsecfilt (); 26 26 27 27 /* interpret command-line options */ … … 57 57 catalog.filename = skylist[0].filename[i]; 58 58 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; 59 catalog.Nsecfilt = Nsec ;59 catalog.Nsecfilt = Nsecfilt; 60 60 61 61 // an error exit status here is a significant error … … 66 66 dvo_catalog_unlock (&catalog); 67 67 68 /* XXX need to call dvo_catalog_chipcoords here passing the loaded images */ 69 68 70 for (j = 0; j < catalog.Naverage; j++) { 69 71 M1 = NULL; 70 72 m = catalog.average[j].offset; 71 M1 = ExtractMeasures (code, mode, &catalog.average[j], &catalog.secfilt[j*Nsec ], &catalog.measure[m], &N1, param);73 M1 = ExtractMeasures (code, mode, &catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], &N1, param); 72 74 for (k = 0; k < N1; k++) { 73 75 vec[0].elements[N] = M1[k]; -
trunk/Ohana/src/opihi/dvo/paverage.c
r10793 r12332 5 5 6 6 FILE *f; 7 int i, j, k, m,Narg, Npts, NPTS, status, VERBOSE;7 int i, j, Narg, Npts, NPTS, status, VERBOSE; 8 8 int Nsecfilt, Nsec; 9 9 double Mz, Mr, mag; 10 10 double Radius, Rmin, Rmax, R, D; 11 11 unsigned IDclip, IDchoice, LimExclude; 12 unsigned FlagChoice, FlagClip, flags;13 12 float *Xvec, *Yvec, *Zvec; 14 13 … … 32 31 Rmax = graphmode.coords.crval1 + 182.0; 33 32 34 Nsec = -1; 33 // require a photcode? default to 0? 34 Nsec = 0; 35 35 if ((Narg = get_argument (argc, argv, "-p"))) { 36 36 remove_argument (Narg, &argc, argv); … … 42 42 remove_argument (Narg, &argc, argv); 43 43 Nsec = GetPhotcodeNsec (photcode[0].code); 44 if (Nsec == -1) { 45 fprintf (stderr, "photcode %s is not an AVERAGE photcode\n", argv[Narg]); 46 return (FALSE); 47 } 44 48 } 45 49 … … 109 113 110 114 average = catalog.average; 115 secfilt = catalog.secfilt; 111 116 112 117 /* project stars to screen display coords */ … … 116 121 while (average[i].R > Rmax) average[i].R -= 360.0; 117 122 118 mag = (Nsec == -1) ? average[i].M : secfilt[i*Nsecfilt+Nsec].M_PS;123 mag = secfilt[i*Nsecfilt+Nsec].M; 119 124 Zvec[Npts] = MIN (1.0, MAX (0.01, (mag - Mz) / Mr)); 120 125 if (LimExclude && (Zvec[Npts] > 0.99)) continue; -
trunk/Ohana/src/opihi/dvo/photometry.c
r8427 r12332 7 7 case PHOT_DEP: \ 8 8 case PHOT_REF: \ 9 if (C[0].code != M. source) continue; \9 if (C[0].code != M.photcode) continue; \ 10 10 break; \ 11 case PHOT_PRI: \12 11 case PHOT_SEC: \ 13 if (C[0].code != GetPhotcodeEquivCodebyCode (M. source)) continue; \12 if (C[0].code != GetPhotcodeEquivCodebyCode (M.photcode)) continue; \ 14 13 break; \ 15 14 default: \ … … 22 21 if (TimeSelect && (M.t < tzero)) continue; \ 23 22 if (TimeSelect && (M.t > tend)) continue; \ 24 if (ErrSelect && (M.dM _PS> ErrValue)) continue; \23 if (ErrSelect && (M.dM > ErrValue)) continue; \ 25 24 if (TypeSelect && (TypeValue != GetMeasureTypeCode (&M))) continue; \ 26 25 if (iMagSelect && (PhotInst (&M) < iMagMin)) continue; \ … … 34 33 if (MODE == MAG_SYS) MOUT = PhotSys (&MEAS, average, secfilt); \ 35 34 if (MODE == MAG_REL) MOUT = PhotRel (&MEAS, average, secfilt); \ 36 if (MODE == MAG_CAL) MOUT = PhotCal (&MEAS, average, secfilt, measure, GetPhotcodeEquivbyCode (MEAS. source)); \37 if (MODE == MAG_AVE) MOUT = PhotAve (GetPhotcodeEquivbyCode (MEAS. source), average, secfilt); \38 if (MODE == MAG_REF) MOUT = PhotRef (GetPhotcodeEquivbyCode (MEAS. source), average, secfilt, measure); \35 if (MODE == MAG_CAL) MOUT = PhotCal (&MEAS, average, secfilt, measure, GetPhotcodeEquivbyCode (MEAS.photcode)); \ 36 if (MODE == MAG_AVE) MOUT = PhotAve (GetPhotcodeEquivbyCode (MEAS.photcode), average, secfilt); \ 37 if (MODE == MAG_REF) MOUT = PhotRef (GetPhotcodeEquivbyCode (MEAS.photcode), average, secfilt, measure); \ 39 38 if (ApplySelections[SelectionParam]) { \ 40 39 if (MagSelect && (MOUT > MagMax)) continue; \ … … 134 133 if (mode == MAG_CAL) status = TRUE; 135 134 } 136 if ( (code[0].type == PHOT_PRI) || (code[0].type == PHOT_SEC)) {135 if (code[0].type == PHOT_SEC) { 137 136 if (mode == MAG_NONE) mode = MAG_AVE; 138 137 if (mode == MAG_INST) status = TRUE; … … 302 301 } 303 302 if (NeedPhotcode) { 304 if (code[0][0].type == PHOT_PRI) return (TRUE);305 303 if (code[0][0].type == PHOT_SEC) return (TRUE); 306 gprint (GP_ERR, "photcode selection problem: average value requires PRI/SECphotcode\n");304 gprint (GP_ERR, "photcode selection problem: average value requires average photcode\n"); 307 305 return (FALSE); 308 306 } … … 322 320 323 321 double ZERO_POINT; 324 char PhotCodeFile[256]; 322 char MasterPhotcodeFile[256]; 323 char CatdirPhotcodeFile[256]; 324 char *catdir; 325 325 326 326 if (VarConfig ("ZERO_PT", "%lf", &ZERO_POINT) == (char *) NULL) { … … 330 330 SetZeroPoint (ZERO_POINT); 331 331 332 if (VarConfig ("PHOTCODE_FILE", "%s", PhotCodeFile) == (char *) NULL) { 332 catdir = GetCATDIR(); 333 if (catdir == NULL) { 334 CatdirPhotcodeFile[0] = 0; 335 } else { 336 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", catdir); 337 } 338 339 if (VarConfig ("PHOTCODE_FILE", "%s", MasterPhotcodeFile) == (char *) NULL) { 333 340 gprint (GP_ERR, "PHOTCODE_FILE undefined in config\n"); 334 341 return (FALSE); 335 342 } 336 if (!LoadPhotcodes ( PhotCodeFile)) {337 gprint (GP_ERR, "error loading photcode s\n");343 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 344 gprint (GP_ERR, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 338 345 return (FALSE); 339 346 } … … 676 683 value = 0; 677 684 for (i = 0; i < average[0].Nm; i++) { 678 if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i]. source)) continue;685 if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].photcode)) continue; 679 686 value ++; 680 687 } … … 683 690 value = 0; 684 691 for (i = 0; i < average[0].Nm; i++) { 685 if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i]. source)) continue;692 if (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].photcode)) continue; 686 693 if (measure[i].flags & (ID_MEAS_POOR | ID_MEAS_SKIP)) continue; 687 694 value ++; … … 691 698 value = 0; 692 699 for (i = 0; i < average[0].Nm; i++) { 693 if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[i]. source))) continue;694 if (ErrSelect && (measure[i].dM _PS> ErrValue)) continue;700 if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].photcode))) continue; 701 if (ErrSelect && (measure[i].dM > ErrValue)) continue; 695 702 if (FlagSelect && (measure[i].flags != FlagValue)) continue; 696 703 if (TypeSelect && (TypeValue != GetMeasureTypeCode (&measure[i]))) continue; … … 711 718 Nt = Nc = 0; 712 719 for (k = 0; k < average[0].Nm; k++) { 713 if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[k]. source))) continue;720 if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[k].photcode))) continue; 714 721 Nc ++; 715 722 if (measure[k].dophot != TypefracType) continue; … … 727 734 Nt[0] = Nt[1] = Nt[2] = 0; 728 735 for (k = 0; k < average[0].Nm; k++) { 729 if (code != GetPhotcodeEquivCodebyCode (measure[k]. source)) continue;736 if (code != GetPhotcodeEquivCodebyCode (measure[k].photcode)) continue; 730 737 N = GetMeasureTypeCode (&measure[k]); 731 738 Nt[N] ++; … … 1128 1135 break; 1129 1136 case MEAS_RA: /* OK */ 1130 value = average[0].R - measure[0].dR _PS/ 3600.0;1137 value = average[0].R - measure[0].dR / 3600.0; 1131 1138 break; 1132 1139 case MEAS_DEC: /* OK */ 1133 value = average[0].D - measure[0].dD _PS/ 3600.0;1140 value = average[0].D - measure[0].dD / 3600.0; 1134 1141 break; 1135 1142 case MEAS_dMAG: /* OK */ 1136 value = measure[0].dM _PS;1143 value = measure[0].dM; 1137 1144 break; 1138 1145 case MEAS_AIRMASS: /* OK */ 1139 value = measure[0].airmass _PS;1146 value = measure[0].airmass; 1140 1147 break; 1141 1148 case MEAS_EXPTIME: /* OK */ 1142 value = pow (10.0, measure[0].dt _PS* 0.4);1149 value = pow (10.0, measure[0].dt * 0.4); 1143 1150 break; 1144 1151 case MEAS_PHOTCODE: /* OK */ 1145 value = measure[0]. source;1152 value = measure[0].photcode; 1146 1153 break; 1147 1154 case MEAS_TIME: /* OK */ … … 1149 1156 break; 1150 1157 case MEAS_dR: /* OK */ 1151 value = measure[0].dR _PS;1158 value = measure[0].dR; 1152 1159 break; 1153 1160 case MEAS_dD: /* OK */ 1154 value = measure[0].dD _PS;1161 value = measure[0].dD; 1155 1162 break; 1156 1163 case MEAS_FWHM: /* OK */ … … 1164 1171 break; 1165 1172 case MEAS_XCCD: /* OK */ 1166 ra = average[0].R - measure[0].dR_PS / 3600.0; 1167 dec = average[0].D - measure[0].dD_PS / 3600.0; 1168 image = MatchImage (measure[0].t, measure[0].source); 1173 /* I need to perform this conversion for ELIXIR and LONEOS formats on load */ 1174 # if 0 1175 value = measure[0].Xccd; 1176 # else 1177 ra = average[0].R - measure[0].dR / 3600.0; 1178 dec = average[0].D - measure[0].dD / 3600.0; 1179 image = MatchImage (measure[0].t, measure[0].photcode); 1169 1180 if (image == NULL) break; 1170 1181 RD_to_XY (&x, &y, ra, dec, &image[0].coords); 1171 1182 value = x; 1183 # endif 1172 1184 break; 1173 1185 case MEAS_YCCD: /* OK */ 1174 ra = average[0].R - measure[0].dR_PS / 3600.0; 1175 dec = average[0].D - measure[0].dD_PS / 3600.0; 1176 image = MatchImage (measure[0].t, measure[0].source); 1186 /* I need to perform this conversion for ELIXIR and LONEOS formats on load */ 1187 # if 0 1188 value = measure[0].Yccd; 1189 # else 1190 ra = average[0].R - measure[0].dR / 3600.0; 1191 dec = average[0].D - measure[0].dD / 3600.0; 1192 image = MatchImage (measure[0].t, measure[0].photcode); 1177 1193 if (image == NULL) break; 1178 1194 RD_to_XY (&x, &y, ra, dec, &image[0].coords); 1179 1195 value = y; 1196 # endif 1180 1197 break; 1181 1198 case MEAS_XMOSAIC: /* OK */ 1182 ra = average[0].R - measure[0].dR _PS/ 3600.0;1183 dec = average[0].D - measure[0].dD _PS/ 3600.0;1184 mosaic = MatchMosaic (measure[0].t, measure[0]. source);1199 ra = average[0].R - measure[0].dR / 3600.0; 1200 dec = average[0].D - measure[0].dD / 3600.0; 1201 mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 1185 1202 if (mosaic == NULL) break; 1186 1203 RD_to_XY (&x, &y, ra, dec, mosaic); … … 1188 1205 break; 1189 1206 case MEAS_YMOSAIC: /* OK */ 1190 ra = average[0].R - measure[0].dR _PS/ 3600.0;1191 dec = average[0].D - measure[0].dD _PS/ 3600.0;1192 mosaic = MatchMosaic (measure[0].t, measure[0]. source);1207 ra = average[0].R - measure[0].dR / 3600.0; 1208 dec = average[0].D - measure[0].dD / 3600.0; 1209 mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 1193 1210 if (mosaic == NULL) break; 1194 1211 RD_to_XY (&x, &y, ra, dec, mosaic); -
trunk/Ohana/src/opihi/dvo/pmeasure.c
r10794 r12332 116 116 if (!(flags & FlagChoice)) continue; 117 117 } 118 if ((PhotcodeClip != -1) && (catalog.measure[m+k]. source != PhotcodeClip)) continue;118 if ((PhotcodeClip != -1) && (catalog.measure[m+k].photcode != PhotcodeClip)) continue; 119 119 mag = PhotCat (&catalog.measure[m+k]); 120 120 Zvec[Npts] = MIN (1.0, MAX (0.01, (mag - Mz) / Mr)); 121 121 if (LimExclude && (Zvec[Npts] > 0.99)) continue; 122 122 if (Zvec[Npts] < 0.011) continue; 123 R = catalog.average[i].R - catalog.measure[m+k].dR _PS/3600.0;124 D = catalog.average[i].D - catalog.measure[m+k].dD _PS/3600.0;123 R = catalog.average[i].R - catalog.measure[m+k].dR/3600.0; 124 D = catalog.average[i].D - catalog.measure[m+k].dD/3600.0; 125 125 // XXX drop this check 126 126 if ((R < Rmin) || (R > Rmax) || (D < -90.0) || (D > 90.0)) { 127 127 char *date; 128 128 date = sec_to_date (catalog.measure[m+k].t); 129 gprint (GP_LOG, "out: %f, %f : %s : (%f, %f) + (%f, %f)\n", R, D, date, catalog.average[i].R, catalog.average[i].D, catalog.measure[m+k].dR _PS/3600.0, catalog.measure[m+k].dD_PS/3600.0);129 gprint (GP_LOG, "out: %f, %f : %s : (%f, %f) + (%f, %f)\n", R, D, date, catalog.average[i].R, catalog.average[i].D, catalog.measure[m+k].dR/3600.0, catalog.measure[m+k].dD/3600.0); 130 130 free (date); 131 131 } -
trunk/Ohana/src/opihi/dvo/subpix.c
r8455 r12332 143 143 RD_to_XY (&X, &Y, Ra, Dec, &image[I].coords); 144 144 t = TimeValue (measure[j].t, TimeReference, TimeFormat); 145 gprint (GP_LOG, "%f %6.3f %7.2f %7.2f %5.3f\n", t, Mabs, X, Y, image[I].secz _PS);145 gprint (GP_LOG, "%f %6.3f %7.2f %7.2f %5.3f\n", t, Mabs, X, Y, image[I].secz); 146 146 } 147 147 } -
trunk/Ohana/src/opihi/include/display.h
r6684 r12332 20 20 int PrepPlotting PROTO((int Npts, Graphdata *graphmode)); 21 21 int PlotVector PROTO((int, float *)); 22 int PlotVectorTriplet PROTO((int N, float *xValues, float *yValues, float *zValues, Graphdata *graphmode)); 22 23 int GetGraphData PROTO((Graphdata *data, int *sock, int *N)); 23 24 int GetGraph PROTO((Graphdata *data, int *socket, int *N)); -
trunk/Ohana/src/opihi/include/pcontrol.h
r11388 r12332 114 114 # define PCLIENT_PROMPT "pclient:" 115 115 116 # define FREE(X) if (X != NULL) { free (X); }116 // # define FREE(X) if (X != NULL) { free (X); } 117 117 # define CLOSE(FD) { if (FD) close (FD); FD = 0; } 118 118 # define DTIME(A,B) ((A.tv_sec - B.tv_sec) + 1e-6*(A.tv_usec - B.tv_usec)) … … 151 151 int CheckLiveHosts (float delay); 152 152 int SetRunSystem (int state); 153 RunLevels SetRunLevel (RunLevels level); 153 154 154 155 /*** own files ***/ -
trunk/Ohana/src/opihi/include/shell.h
r11055 r12332 72 72 void welcome PROTO(()); 73 73 74 int add_listentry PROTO((int ThisList, char *line)); 74 75 int is_for_loop PROTO((char *line)); 75 76 int is_if_block PROTO((char *line)); -
trunk/Ohana/src/opihi/lib.data/book.c
r10997 r12332 38 38 /* return the given book */ 39 39 Book *GetBook (int where) { 40 41 int i;42 40 43 41 if (where < 0) where += Nbooks; -
trunk/Ohana/src/opihi/lib.data/page.c
r11007 r12332 27 27 Page *GetPage (Book *book, int where) { 28 28 29 int i;30 31 29 if (where < 0) where += book[0].Npages; 32 30 if (where < 0) return NULL; … … 46 44 if (where >= book[0].Npages) return NULL; 47 45 46 Nout = -1; 48 47 if (where >= 0) { 49 48 N = -1; -
trunk/Ohana/src/opihi/lib.shell/ListOps.c
r11119 r12332 79 79 80 80 int Nlines; 81 char *output;82 81 83 82 Nlines = lists[ThisList].Nlines; … … 108 107 int is_macro_create (char *line) { 109 108 110 int i, N,status;109 int status; 111 110 char *comm; 112 111 char *this_macro; -
trunk/Ohana/src/opihi/lib.shell/SocketOps.c
r8553 r12332 92 92 int WaitServerSocket (int InitSocket, SockAddress *Address) { 93 93 94 int i, BindSocket , length;94 int i, BindSocket; 95 95 SockAddress Address_in; 96 socklen_t length; 96 97 u_int32_t addr; 97 98 -
trunk/Ohana/src/opihi/lib.shell/exec_loop.c
r10846 r12332 4 4 5 5 void *Signal; 6 int n, Nlines,j, status, ThisList;6 int j, status, ThisList; 7 7 char *line; 8 8 -
trunk/Ohana/src/opihi/lib.shell/opihi.c
r10798 r12332 7 7 char *line, *prompt, *history; 8 8 pid_t ppid; 9 FILE *log;10 9 11 10 general_init (&argc, argv); -
trunk/Ohana/src/opihi/lib.shell/version.c
r10842 r12332 1 1 # include "shell.h" 2 3 static char *unknown = "UNKNOWN";4 2 static char *name = "$Name: not supported by cvs2svn $"; 5 3 -
trunk/Ohana/src/opihi/pantasks/CheckTasks.c
r11898 r12332 6 6 Task *task; 7 7 int status; 8 struct timeval now;8 // struct timeval now; 9 9 10 10 /** test all tasks: ready to test? ready to run? **/ -
trunk/Ohana/src/opihi/pantasks/TaskOps.c
r11898 r12332 149 149 void ListTaskStats (char *regex) { 150 150 151 int i, j, valid, nameLength; 152 char *start, *stop; 151 int i, valid, nameLength; 153 152 char format[128]; 154 153 regex_t preg; … … 557 556 if (verbose) { 558 557 fprintf (stderr, "tt: %d %6d - %d %6d : %f\n", 559 now.tv_sec,now.tv_usec,560 start.tv_sec,start.tv_usec, dtime);558 (int) now.tv_sec, (int) now.tv_usec, 559 (int) start.tv_sec, (int) start.tv_usec, dtime); 561 560 } 562 561 -
trunk/Ohana/src/opihi/pantasks/ipptool2book.c
r11334 r12332 15 15 char **setWordValue; 16 16 int setWordN, setWordNalloc; 17 Page *page; 18 Book *book; 19 Queue *queue; 17 18 Page *page = NULL; 19 Book *book = NULL; 20 Queue *queue = NULL; 20 21 21 22 /* supply additional constant words */ -
trunk/Ohana/src/opihi/pantasks/task_stdout.c
r9037 r12332 3 3 int task_stdout (int argc, char **argv) { 4 4 5 int N, RequiredHost;6 5 Task *task; 7 6 … … 27 26 int task_stderr (int argc, char **argv) { 28 27 29 int N, RequiredHost;30 28 Task *task; 31 29 -
trunk/Ohana/src/photdbc/src/ConfigInit.c
r8630 r12332 13 13 14 14 char *config, *file; 15 char CatdirPhotcodeFile[256]; 16 char MasterPhotcodeFile[256]; 15 17 16 18 /*** load configuration info ***/ … … 46 48 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 47 49 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 50 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 51 48 52 sprintf (ImageCat, "%s/Images.dat", CATDIR); 49 53 50 WarnConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);51 54 WarnConfig (config, "ZERO_PT", "%lf", 0, &ZERO_POINT); 52 55 … … 61 64 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 62 65 63 if (!LoadPhotcodes (PhotCodeFile)) { 64 fprintf (stderr, "error loading photcodes\n"); 66 /* XXX this does not yet write out the master photcode table */ 67 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 68 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 69 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 65 70 exit (1); 66 71 } -
trunk/Ohana/src/photdbc/src/find_images.c
r7080 r12332 38 38 # if (0) 39 39 /* select images by photcode */ 40 ecode = GetPhotcodeEquivCodebyCode (timage[i]. source);40 ecode = GetPhotcodeEquivCodebyCode (timage[i].photcode); 41 41 if (ecode != photcode[0].code) continue; 42 42 -
trunk/Ohana/src/photdbc/src/flag_measures.c
r7080 r12332 28 28 n = catalog[0].measure[i].averef; 29 29 Time = catalog[0].measure[i].t; 30 Photcode = catalog[0].measure[i]. source;30 Photcode = catalog[0].measure[i].photcode; 31 31 found = FALSE; 32 32 for (k = 0; !found && (k < Nimage); k++) { 33 if ((Time == image[k].tzero) && (Photcode == image[k]. source)) {33 if ((Time == image[k].tzero) && (Photcode == image[k].photcode)) { 34 34 imagelink[i] = k; 35 35 found = TRUE; … … 44 44 for (i = 0; i < catalog[0].Nmeasure; i++) { 45 45 n = catalog[0].measure[i].averef; 46 ra = catalog[0].average[n].R _PS - catalog[0].measure[i].dR_PS/ 3600.0;47 dec = catalog[0].average[n].D _PS - catalog[0].measure[i].dD_PS/ 3600.0;46 ra = catalog[0].average[n].R - catalog[0].measure[i].dR / 3600.0; 47 dec = catalog[0].average[n].D - catalog[0].measure[i].dD / 3600.0; 48 48 k = imagelink[i]; 49 49 RD_to_XY (&x, &y, ra, dec, &image[k].coords); … … 98 98 m = catalog[0].average[i].offset; 99 99 for (j = 0; j < catalog[0].average[i].Nm; j++, m++) { 100 if ((Ncode = photcodes.hashcode[catalog[0].measure[m]. source]) < 0) continue;100 if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue; 101 101 if (photcodes.code[Ncode].equiv != Photcode) continue; 102 102 if (photcodes.code[Ncode].type != PHOT_DEP) continue; … … 115 115 m = catalog[0].average[i].offset; 116 116 for (j = 0; j < catalog[0].average[i].Nm; j++, m++) { 117 if ((Ncode = photcodes.hashcode[catalog[0].measure[m]. source]) < 0) continue;117 if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue; 118 118 if (photcodes.code[Ncode].equiv != Photcode) continue; 119 119 if (photcodes.code[Ncode].type != PHOT_DEP) continue; … … 130 130 m = catalog[0].average[i].offset; 131 131 for (j = 0; j < catalog[0].average[i].Nm; j++, m++) { 132 if ((Ncode = photcodes.hashcode[catalog[0].measure[m]. source]) < 0) continue;132 if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue; 133 133 if (photcodes.code[Ncode].equiv != Photcode) continue; 134 134 if (photcodes.code[Ncode].type != PHOT_DEP) continue; … … 145 145 m = catalog[0].average[i].offset; 146 146 for (j = 0; j < catalog[0].average[i].Nm; j++, m++) { 147 if ((Ncode = photcodes.hashcode[catalog[0].measure[m]. source]) < 0) continue;147 if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue; 148 148 if (photcodes.code[Ncode].equiv != Photcode) continue; 149 149 if (photcodes.code[Ncode].type != PHOT_DEP) continue; … … 159 159 m = catalog[0].average[i].offset; 160 160 for (j = 0; j < catalog[0].average[i].Nm; j++, m++) { 161 if ((Ncode = photcodes.hashcode[catalog[0].measure[m]. source]) < 0) continue;161 if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue; 162 162 if (photcodes.code[Ncode].equiv != Photcode) continue; 163 163 if (photcodes.code[Ncode].type != PHOT_DEP) continue; … … 172 172 m = catalog[0].average[i].offset; 173 173 for (j = 0; j < catalog[0].average[i].Nm; j++, m++) { 174 if ((Ncode = photcodes.hashcode[catalog[0].measure[m]. source]) < 0) continue;174 if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue; 175 175 if (photcodes.code[Ncode].equiv != Photcode) continue; 176 176 if (photcodes.code[Ncode].type != PHOT_DEP) continue; … … 182 182 m = catalog[0].average[i].offset; 183 183 for (j = 0; j < catalog[0].average[i].Nm; j++, m++) { 184 if ((Ncode = photcodes.hashcode[catalog[0].measure[m]. source]) < 0) continue;184 if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue; 185 185 if (photcodes.code[Ncode].equiv != Photcode) continue; 186 186 if (photcodes.code[Ncode].type != PHOT_DEP) continue; -
trunk/Ohana/src/photdbc/src/get_mags.c
r2494 r12332 44 44 m = catalog[0].average[i].offset; 45 45 for (j = 0; j < catalog[0].average[i].Nm; j++, m++) { 46 if ((Ncode = photcodes.hashcode[catalog[0].measure[m]. source]) < 0) continue;46 if ((Ncode = photcodes.hashcode[catalog[0].measure[m].photcode]) < 0) continue; 47 47 if (photcodes.code[Ncode].equiv != Photcode) continue; 48 48 if (photcodes.code[Ncode].type != PHOT_DEP) continue; -
trunk/Ohana/src/photdbc/src/join_stars.c
r4808 r12332 28 28 Rmid = Dmid = 0; 29 29 for (i = 0; i < Naverage; i++) { 30 Rmid += average[i].R _PS;31 Dmid += average[i].D _PS;30 Rmid += average[i].R; 31 Dmid += average[i].D; 32 32 } 33 33 Rmid /= Naverage; … … 50 50 for (i = 0; i < Naverage; i++) { 51 51 index[i] = i; 52 fRD_to_XY (&X[i], &Y[i], average[i].R _PS, average[i].D_PS, &tcoords);52 fRD_to_XY (&X[i], &Y[i], average[i].R, average[i].D, &tcoords); 53 53 } 54 54 sort_lists (X, Y, index, Naverage); … … 77 77 mpointer[Nmeas].measure = m; 78 78 mpointer[Nmeas].averef = Naves; 79 mpointer[Nmeas].R = average[Ni].R _PS - measure[m].dR_PS/ 3600.0;80 mpointer[Nmeas].D = average[Ni].D _PS - measure[m].dD_PS/ 3600.0;79 mpointer[Nmeas].R = average[Ni].R - measure[m].dR / 3600.0; 80 mpointer[Nmeas].D = average[Ni].D - measure[m].dD / 3600.0; 81 81 Nmeas ++; 82 82 } … … 113 113 mpointer[Nmeas].measure = m; 114 114 mpointer[Nmeas].averef = Ncurr; 115 mpointer[Nmeas].R = average[Nj].R _PS - measure[m].dR_PS/ 3600.0;116 mpointer[Nmeas].D = average[Nj].D _PS - measure[m].dD_PS/ 3600.0;115 mpointer[Nmeas].R = average[Nj].R - measure[m].dR / 3600.0; 116 mpointer[Nmeas].D = average[Nj].D - measure[m].dD / 3600.0; 117 117 Nmeas ++; 118 118 } … … 130 130 Sr = Sr / naverage[Ncurr].Nm; 131 131 Sd = Sd / naverage[Ncurr].Nm; 132 naverage[Ncurr].R _PS= Sr;133 naverage[Ncurr].D _PS= Sd;132 naverage[Ncurr].R = Sr; 133 naverage[Ncurr].D = Sd; 134 134 135 135 /* update original measurement offsets */ … … 137 137 m = naverage[Ncurr].offset + k; 138 138 M = mpointer[m].measure; 139 measure[M].dR _PS= 3600.0*(Sr - mpointer[m].R);140 measure[M].dD _PS= 3600.0*(Sd - mpointer[m].D);139 measure[M].dR = 3600.0*(Sr - mpointer[m].R); 140 measure[M].dD = 3600.0*(Sd - mpointer[m].D); 141 141 } 142 142 -
trunk/Ohana/src/photdbc/src/make_subcatalog.c
r8630 r12332 40 40 # if 0 41 41 if (DropPhotcode) { 42 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset]. source);42 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset].photcode); 43 43 if (ecode == photcode[0].code) continue; 44 44 } … … 47 47 48 48 /* exclude measurements by measurement error */ 49 if (SIGMA_MAX && (catalog[0].measure[offset].dM _PS> SIGMA_MAX)) continue;49 if (SIGMA_MAX && (catalog[0].measure[offset].dM > SIGMA_MAX)) continue; 50 50 51 51 /* select measurements by mag limit */ -
trunk/Ohana/src/photdbc/src/unique_measures.c
r8630 r12332 60 60 } 61 61 62 dR = (catalog[0].measure[ilist[j]].dR _PS - catalog[0].measure[ilist[k]].dR_PS);63 dD = (catalog[0].measure[ilist[j]].dD _PS - catalog[0].measure[ilist[k]].dD_PS);62 dR = (catalog[0].measure[ilist[j]].dR - catalog[0].measure[ilist[k]].dR); 63 dD = (catalog[0].measure[ilist[j]].dD - catalog[0].measure[ilist[k]].dD); 64 64 R = SQ(dR) + SQ(dD); 65 65 -
trunk/Ohana/src/relastro/Makefile
r11880 r12332 15 15 FULL_CFLAGS = $(BASE_CFLAGS) 16 16 FULL_CPPFLAGS = $(BASE_CPPFLAGS) 17 FULL_LDFLAGS = -l dvo -lFITS -lohana $(BASE_LDFLAGS)17 FULL_LDFLAGS = -lkapa -ldvo -lFITS -lohana $(BASE_LDFLAGS) 18 18 19 19 relastro: $(BIN)/relastro.$(ARCH) … … 21 21 22 22 RELASTRO = \ 23 $(SRC)/relastro.$(ARCH).o \24 $(SRC)/initialize.$(ARCH).o \25 23 $(SRC)/ConfigInit.$(ARCH).o \ 26 $(SRC)/args.$(ARCH).o \ 27 $(SRC)/liststats.$(ARCH).o \ 28 $(SRC)/load_images.$(ARCH).o \ 29 $(SRC)/name_region.$(ARCH).o \ 30 $(SRC)/find_images.$(ARCH).o \ 31 $(SRC)/find_regions.$(ARCH).o \ 32 $(SRC)/get_regions.$(ARCH).o \ 33 $(SRC)/load_catalogs.$(ARCH).o \ 34 $(SRC)/gcatalog.$(ARCH).o \ 35 $(SRC)/bcatalog.$(ARCH).o \ 36 $(SRC)/GridOps.v2.$(ARCH).o \ 37 $(SRC)/StarOps.$(ARCH).o \ 24 $(SRC)/FitChip.$(ARCH).o \ 25 $(SRC)/FitMosaic.$(ARCH).o \ 26 $(SRC)/FitPM.$(ARCH).o \ 27 $(SRC)/FitPMandPar.$(ARCH).o \ 28 $(SRC)/FitSimple.$(ARCH).o \ 38 29 $(SRC)/ImageOps.$(ARCH).o \ 39 30 $(SRC)/MosaicOps.$(ARCH).o \ 40 $(SRC)/global_stats.$(ARCH).o \ 31 $(SRC)/ParFactor.$(ARCH).o \ 32 $(SRC)/SetSignals.$(ARCH).o \ 33 $(SRC)/Shutdown.$(ARCH).o \ 34 $(SRC)/UpdateChips.$(ARCH).o \ 35 $(SRC)/UpdateMosaic.$(ARCH).o \ 36 $(SRC)/UpdateObjects.$(ARCH).o \ 37 $(SRC)/UpdateSimple.$(ARCH).o \ 38 $(SRC)/args.$(ARCH).o \ 39 $(SRC)/bcatalog.$(ARCH).o \ 40 $(SRC)/dvo_astrom_ops.$(ARCH).o \ 41 $(SRC)/fitpoly.$(ARCH).o \ 42 $(SRC)/initialize.$(ARCH).o \ 43 $(SRC)/liststats.$(ARCH).o \ 44 $(SRC)/load_catalogs.$(ARCH).o \ 45 $(SRC)/load_images.$(ARCH).o \ 46 $(SRC)/mkpolyterm.$(ARCH).o \ 41 47 $(SRC)/plot_scatter.$(ARCH).o \ 42 48 $(SRC)/plotstuff.$(ARCH).o \ 43 $(SRC)/misc.$(ARCH).o \ 49 $(SRC)/select_images.$(ARCH).o \ 50 $(SRC)/sort.$(ARCH).o \ 51 $(SRC)/relastro.$(ARCH).o \ 44 52 $(SRC)/reload_catalogs.$(ARCH).o \ 45 $(SRC)/image-db.$(ARCH).o \ 46 $(SRC)/free_catalogs.$(ARCH).o \ 47 $(SRC)/check_permissions.$(ARCH).o \ 53 $(SRC)/save_catalogs.$(ARCH).o \ 54 $(SRC)/setExclusions.$(ARCH).o \ 55 $(SRC)/write_coords.$(ARCH).o 56 57 DROP = \ 48 58 $(SRC)/setMrelFinal.$(ARCH).o \ 49 $(SRC)/write_coords.$(ARCH).o \ 50 $(SRC)/setExclusions.$(ARCH).o \ 51 $(SRC)/Shutdown.$(ARCH).o \ 52 $(SRC)/SetSignals.$(ARCH).o \ 53 $(SRC)/wcatalog.$(ARCH).o 59 $(SRC)/StarOps.$(ARCH).o 60 54 61 55 62 $(RELASTRO): $(INC)/relastro.h -
trunk/Ohana/src/relastro/doc/parallax.pro
r6809 r12332 332 332 end 333 333 334 335 macro parfactor 336 337 $RA = $1 338 $Dec = $2 339 $e = 23 + 27/60 340 341 create s 0 360 342 set pR = dcos($e)*d 343 344 set pR = +(dcos($e)*dsin(s)*dcos($RA) - dcos(s)*dsin($RA)) 345 set pD = -(dcos($e)*dsin(s)*dsin($RA) + dcos(s)*dcos($RA))*dsin($Dec) + dsin($e)*dsin(s)*dcos($Dec) 346 347 lim -1.1 1.1 -1.1 1.1; clear; box; plot pR pD 348 end -
trunk/Ohana/src/relastro/src/ConfigInit.c
r8390 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 void ConfigInit (int *argc, char **argv) { … … 5 5 double ZERO_POINT; 6 6 char *config, *file; 7 char PhotCodeFile[256]; 7 char CatdirPhotcodeFile[256]; 8 char MasterPhotcodeFile[256]; 8 9 9 10 /*** load configuration info ***/ … … 32 33 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 33 34 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 35 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 36 34 37 sprintf (ImageCat, "%s/Images.dat", CATDIR); 35 38 … … 41 44 } 42 45 43 GetConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);44 46 GetConfig (config, "ZERO_PT", "%lf", 0, &ZERO_POINT); 45 47 … … 52 54 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 53 55 54 if (!LoadPhotcodes (PhotCodeFile)) { 55 fprintf (stderr, "error loading photcodes\n"); 56 /* XXX this does not yet write out the master photcode table */ 57 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 58 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 59 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 56 60 exit (1); 57 61 } -
trunk/Ohana/src/relastro/src/ImageOps.c
r6808 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 static unsigned int *start; … … 13 13 static int Nimage; 14 14 15 Image *getimages (int *N) { 16 *N = Nimage; 17 return (image); 18 } 19 20 Image *getimage (int N) { 21 return (&image[N]); 22 } 23 15 24 void initImages (Image *input, int N) { 16 25 … … 68 77 } 69 78 70 /* select all image equivalent to the current photcode*/79 /* match measurements to images */ 71 80 void findImages (Catalog *catalog, int Ncatalog) { 72 81 73 int i, j , ecode;82 int i, j; 74 83 75 84 for (i = 0; i < Ncatalog; i++) { 76 85 for (j = 0; j < catalog[i].Nmeasure; j++) { 77 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].source);78 if (photcode[0].code != ecode) continue;79 86 matchImage (catalog, j, i); 80 87 } … … 82 89 } 83 90 91 /* modify this function to use the measure->imageID field */ 84 92 void matchImage (Catalog *catalog, int meas, int cat) { 85 93 86 int i, ave, ccdnum; 87 double ra, dec, X, Y; 88 char *pname, *filter, *p, base[256]; 94 int i; 89 95 Measure *measure; 90 96 91 97 measure = &catalog[cat].measure[meas]; 92 98 for (i = 0; i < Nimage; i++) { 93 if (image[0]. source == -1) continue;94 if (measure[0]. source != image[i].source) continue;99 if (image[0].photcode == -1) continue; 100 if (measure[0].photcode != image[i].photcode) continue; 95 101 if (measure[0].t < start[i]) continue; 96 102 if (measure[0].t > stop[i]) continue; 97 103 98 # ifdef GRID_V2 /* this section is added to support GridOps.v2.c */99 if (USE_GRID) {100 101 /* identify the ccd on the basis of the photcode name */102 pname = GetPhotcodeNamebyCode (image[i].source);103 filter = photcode[0].name;104 sprintf (base, "%s.%s.", MOSAICNAME, filter);105 if (strncmp (pname, base, strlen (base))) continue;106 p = pname + strlen(base);107 if (*p == 0) continue;108 ccdnum = atoi (p);109 /* some ambiguity here between seq number and id number */110 111 /* add this measurement to the grid cell for this chip */112 ave = measure[0].averef;113 ra = catalog[cat].average[ave].R - measure[0].dR_PS / 3600.0;114 dec = catalog[cat].average[ave].D - measure[0].dD_PS / 3600.0;115 116 /* X,Y always positive-definite in range 0,0 - dX, dY */117 RD_to_XY (&X, &Y, ra, dec, &image[i].coords);118 setGridMeasure (meas, cat, X, Y, ccdnum);119 }120 # endif121 122 104 bin[cat][meas] = i; 123 105 … … 133 115 return; 134 116 } 135 /* fprintf (stderr, "can't find source image for this measurement: %d (%d)\n", measure[0].t, measure[0].source); */136 }137 138 float getMcal (int meas, int cat) {139 140 int i;141 float value;142 143 i = bin[cat][meas];144 if (i == -1) return (NO_MAG);145 146 if (image[i].code & IMAGE_BAD) return (NO_MAG);147 value = image[i].Mcal_PS;148 return (value);149 117 } 150 118 … … 158 126 } 159 127 160 /* determine Mcal values for all images */161 void setMcal (Catalog *catalog, int PoorImages) {162 163 int i, j, m, c, n, N, Nmax, mark, bad;164 float Msys, Mrel, Mmos, Mgrid;165 double *list, *dlist;166 StatType stats;167 168 if (FREEZE_IMAGES) return;169 170 if (PoorImages) {171 IMAGE_BAD = STAR_BAD = MEAS_BAD = 0;172 }173 174 Nmax = 0;175 for (i = 0; i < Nimage; i++) {176 Nmax = MAX (Nmax, Nlist[i]);177 }178 ALLOCATE (list, double, Nmax);179 ALLOCATE (dlist, double, Nmax);180 181 for (i = 0; i < Nimage; i++) {182 183 /* on PoorImages run, skip good images */184 if (PoorImages) {185 bad = image[i].code & (ID_IMAGE_FEW | ID_IMAGE_POOR | ID_IMAGE_SKIP);186 if (!bad) continue;187 }188 189 N = 0;190 for (j = 0; j < Nlist[i]; j++) {191 192 m = mlist[i][j];193 c = clist[i][j];194 195 if (catalog[c].measure[m].flags & MEAS_BAD) continue;196 if ((Mmos = getMmos (m, c)) == NO_MAG) continue;197 if ((Mgrid = getMgrid (m, c)) == NO_MAG) continue;198 if ((Mrel = getMrel (catalog, m, c)) == NO_MAG) continue;199 200 n = catalog[c].measure[m].averef;201 Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);202 list[N] = Msys - Mrel - Mmos - Mgrid;203 dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);204 N++;205 }206 /* Nlist[i] is all measurements, N is good measurements */207 208 /* too few good measurements or too many bad measurements */209 if (!PoorImages) {210 mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*Nlist[i]);211 if (mark) {212 image[i].code |= ID_IMAGE_FEW;213 } else {214 image[i].code &= ~ID_IMAGE_FEW;215 }216 }217 218 liststats (list, dlist, N, &stats);219 image[i].Mcal_PS = stats.mean;220 image[i].dMcal_PS = stats.sigma;221 image[i].Xm = 100.0*log10(stats.chisq);222 }223 free (list);224 free (dlist);225 if (PoorImages) {226 IMAGE_BAD = ID_IMAGE_POOR | ID_IMAGE_FEW | ID_IMAGE_SKIP;227 STAR_BAD = ID_STAR_POOR | ID_STAR_FEW;228 MEAS_BAD = ID_MEAS_NOCAL | ID_MEAS_POOR | ID_MEAS_SKIP | ID_MEAS_AREA;229 }230 return;231 }232 233 /* mark image if: abs(Mcal) too large, dMcal too large */234 void clean_images () {235 236 int i, N, mark, Nmark;237 double *mlist, *slist, *dlist;238 double MaxOffset, MaxScatter, MedOffset;239 StatType stats;240 241 if (FREEZE_IMAGES) return;242 243 if (VERBOSE) fprintf (stderr, "marking poor images\n");244 245 ALLOCATE (mlist, double, Nimage);246 ALLOCATE (slist, double, Nimage);247 ALLOCATE (dlist, double, Nimage);248 249 for (i = N = 0; i < Nimage; i++) {250 if (image[i].code & IMAGE_BAD) continue;251 mlist[N] = fabs (image[i].Mcal_PS);252 slist[N] = image[i].dMcal_PS;253 dlist[N] = 1;254 N++;255 }256 initstats ("MEAN");257 liststats (mlist, dlist, N, &stats);258 MaxOffset = MAX (IMAGE_OFFSET, 3*stats.sigma);259 MedOffset = stats.median;260 liststats (slist, dlist, N, &stats);261 MaxScatter = MAX (IMAGE_SCATTER, 2*stats.median);262 fprintf (stderr, "Mrel: %f, dMrel: %f, Max Scatter: %f, Max Offset: %f\n", MedOffset, stats.median, MaxScatter, MaxOffset);263 264 Nmark = 0;265 for (i = 0; i < Nimage; i++) {266 mark = FALSE;267 image[i].code &= ~ID_IMAGE_POOR;268 mark = (image[i].dMcal_PS > MaxScatter) || (fabs(image[i].Mcal_PS - MedOffset) > MaxOffset);269 if (mark) {270 Nmark ++;271 image[i].code |= ID_IMAGE_POOR;272 } else {273 image[i].code &= ~ID_IMAGE_POOR;274 }275 }276 277 fprintf (stderr, "%d images marked poor\n", Nmark);278 initstats (STATMODE);279 free (mlist);280 free (slist);281 free (dlist);282 }283 284 128 void plot_images () { 285 129 … … 296 140 /**** dMcal vs airmass ****/ 297 141 for (i = 0; i < Nimage; i++) { 298 Mlist[i] = image[i].Mcal _PS;299 dlist[i] = image[i].dMcal _PS;300 xlist[i] = image[i].secz _PS;142 Mlist[i] = image[i].Mcal; 143 dlist[i] = image[i].dMcal; 144 xlist[i] = image[i].secz; 301 145 } 302 146 … … 316 160 bzero (Mlist, NBIN*sizeof(double)); 317 161 for (i = 0; i < Nimage; i++) { 318 bin = image[i].dMcal _PS/ 0.00025;162 bin = image[i].dMcal / 0.00025; 319 163 bin = MAX (0, MIN (NBIN - 1, bin)); 320 164 Mlist[bin] += 1.0; … … 330 174 } 331 175 332 StatType statsImageN (Catalog *catalog) { 333 334 int i, j, m, c, n, N; 335 double *list, *dlist; 336 StatType stats; 337 338 bzero (&stats, sizeof (StatType)); 339 if (FREEZE_IMAGES) return (stats); 340 341 ALLOCATE (list, double, Nimage); 342 ALLOCATE (dlist, double, Nimage); 343 344 n = 0; 345 for (i = 0; i < Nimage; i++) { 346 if (image[i].code & IMAGE_BAD) continue; 347 348 N = 0; 349 for (j = 0; j < Nlist[i]; j++) { 350 351 m = mlist[i][j]; 352 c = clist[i][j]; 353 354 if (getMcal (m, c) == NO_MAG) continue; 355 if (getMmos (m, c) == NO_MAG) continue; 356 if (getMgrid (m, c) == NO_MAG) continue; 357 N++; 176 /* XXX re-write to use image->nstars if that is possible */ 177 StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic) { 178 179 int i, m, c; 180 181 Image *mosaic; 182 Coords *moscoords; 183 StarData *raw; 184 185 ALLOCATE (raw, StarData, Nlist[im]); 186 187 mosaic = NULL; 188 moscoords = NULL; 189 if (isMosaic) { 190 mosaic = getMosaicForImage (im); 191 moscoords = &mosaic[0].coords; 192 } 193 194 for (i = 0; i < Nlist[im]; i++) { 195 m = mlist[im][i]; 196 c = clist[im][i]; 197 198 /* apply the current image transformation or use the current value of R+dR, D+dD? */ 199 raw[i].X = catalog[c].measure[m].Xccd; 200 raw[i].Y = catalog[c].measure[m].Yccd; 201 202 raw[i].Mag = catalog[c].measure[m].M; 203 raw[i].dMag = catalog[c].measure[m].dM; 204 205 /* note that for a Simple image, L,M = P,Q */ 206 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 207 if (isMosaic) { 208 XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords); 209 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords); 210 } else { 211 raw[i].P = raw[i].L; 212 raw[i].Q = raw[i].M; 213 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords); 358 214 } 359 list[n] = N; 360 dlist[n] = 1; 361 n++; 362 } 363 364 liststats (list, dlist, n, &stats); 365 free (list); 366 free (dlist); 367 return (stats); 368 } 369 370 StatType statsImageX (Catalog *catalog) { 371 372 int i, n; 373 double *list, *dlist; 374 StatType stats; 375 376 bzero (&stats, sizeof (StatType)); 377 if (FREEZE_IMAGES) return (stats); 378 379 ALLOCATE (list, double, Nimage); 380 ALLOCATE (dlist, double, Nimage); 381 382 n = 0; 383 for (i = 0; i < Nimage; i++) { 384 385 if (image[i].code & IMAGE_BAD) continue; 386 387 list[n] = pow (10.0, 0.01*image[i].Xm); 388 dlist[n] = 1; 389 n++; 390 } 391 392 liststats (list, dlist, n, &stats); 393 free (list); 394 free (dlist); 395 return (stats); 396 } 397 398 StatType statsImageM (Catalog *catalog) { 399 400 int i, n; 401 double *list, *dlist; 402 StatType stats; 403 404 bzero (&stats, sizeof (StatType)); 405 if (FREEZE_IMAGES) return (stats); 406 407 ALLOCATE (list, double, Nimage); 408 ALLOCATE (dlist, double, Nimage); 409 410 n = 0; 411 for (i = 0; i < Nimage; i++) { 412 413 if (image[i].code & IMAGE_BAD) continue; 414 415 list[n] = image[i].Mcal_PS; 416 dlist[n] = 1; 417 n++; 418 } 419 420 liststats (list, dlist, n, &stats); 421 free (list); 422 free (dlist); 423 return (stats); 424 } 425 426 StatType statsImagedM (Catalog *catalog) { 427 428 int i, n; 429 double *list, *dlist; 430 StatType stats; 431 432 bzero (&stats, sizeof (StatType)); 433 if (FREEZE_IMAGES) return (stats); 434 435 ALLOCATE (list, double, Nimage); 436 ALLOCATE (dlist, double, Nimage); 437 438 n = 0; 439 for (i = 0; i < Nimage; i++) { 440 441 if (image[i].code & IMAGE_BAD) continue; 442 443 list[n] = image[i].dMcal_PS; 444 dlist[n] = 1; 445 n++; 446 } 447 448 liststats (list, dlist, n, &stats); 449 free (list); 450 free (dlist); 451 return (stats); 452 } 453 454 Image *getimages (int *N) { 455 456 *N = Nimage; 457 return (image); 458 } 459 460 Image *getimage (int N) { 461 return (&image[N]); 462 } 463 215 } 216 217 *Nstars = Nlist[im]; 218 return (raw); 219 } 220 221 StarData *getImageRef (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic) { 222 223 int i, m, c, n; 224 225 Image *mosaic; 226 Coords *moscoords; 227 StarData *ref; 228 229 ALLOCATE (ref, StarData, Nlist[im]); 230 231 mosaic = NULL; 232 moscoords = NULL; 233 if (isMosaic) { 234 mosaic = getMosaicForImage (im); 235 moscoords = &mosaic[0].coords; 236 } 237 238 for (i = 0; i < Nlist[im]; i++) { 239 m = mlist[im][i]; 240 c = clist[im][i]; 241 n = catalog[c].measure[m].averef; 242 243 /* apply the current image transformation or use the current value of R+dR, D+dD? */ 244 ref[i].R = catalog[c].average[n].R; 245 ref[i].D = catalog[c].average[n].D; 246 247 /* note that for a Simple image, L,M = P,Q */ 248 RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, &image[im].coords); 249 if (isMosaic) { 250 LM_to_XY (&ref[i].M, &ref[i].L, ref[i].P, ref[i].Q, moscoords); 251 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, moscoords); 252 } else { 253 ref[i].L = ref[i].P; 254 ref[i].M = ref[i].Q; 255 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, &image[im].coords); 256 } 257 } 258 259 *Nstars = Nlist[im]; 260 return (ref); 261 } -
trunk/Ohana/src/relastro/src/MosaicOps.c
r6808 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 Image *getimages (int *N); … … 16 16 17 17 /* find mosaic frames (unique time periods & photcode name matches mosaic) */ 18 /* XXX what is a mosaic? do we need to use the 'DIS/WRP' info to track? */ 18 19 void initMosaics (Image *image, int Nimage) { 19 20 … … 36 37 37 38 /* select valid mosaic images by photcode */ 38 pname = GetPhotcodeNamebyCode (image[i]. source);39 pname = GetPhotcodeNamebyCode (image[i].photcode); 39 40 status = strncmp (pname, MOSAICNAME, strlen (MOSAICNAME)); 40 41 if (status) continue; … … 69 70 mosaic[Nmosaic].Xm = 0.0; 70 71 mosaic[Nmosaic].code = image[i].code; 71 mosaic[Nmosaic].secz = image[i].secz _PS;72 mosaic[Nmosaic].secz = image[i].secz; 72 73 73 74 /* add image to mosaic image list */ … … 86 87 } 87 88 } 88 89 initMosaicGrid (image, Nimage);90 89 return; 91 }92 93 void initMosaicGrid (Image *image, int Nimage) {94 95 /* find max dR, dD range for all mosaics */96 /* define mosaic.coords to cover dR, dD */97 /* send results to initGridBins */98 99 int i, j, m, NX, NY;100 int dXmax, dYmax;101 double dS, dX, dY;102 double R, D, Rmin, Rmax, Dmin, Dmax;103 double Mcal, dMcal, Xm;104 105 dXmax = dYmax = 0.0;106 for (i = 0; i < Nmosaic; i++) {107 Dmin = Rmin = 360.0;108 Dmax = Rmax = -360.0;109 dS = 0.0;110 Mcal = dMcal = Xm = 0;111 for (j = 0; j < Nimlist[i]; j++) {112 m = imlist[i][j];113 NX = image[m].NX;114 NY = image[m].NY;115 dS += hypot (image[m].coords.cdelt1*image[m].coords.pc1_1, image[m].coords.cdelt1*image[m].coords.pc2_1);116 XY_to_RD (&R, &D, 0.0, 0.0, &image[m].coords);117 Rmin = MIN (Rmin, R);118 Rmax = MAX (Rmax, R);119 Dmin = MIN (Dmin, D);120 Dmax = MAX (Dmax, D);121 XY_to_RD (&R, &D, (double) NX, 0.0, &image[m].coords);122 Rmin = MIN (Rmin, R);123 Rmax = MAX (Rmax, R);124 Dmin = MIN (Dmin, D);125 Dmax = MAX (Dmax, D);126 XY_to_RD (&R, &D, (double) NX, (double) NY, &image[m].coords);127 Rmin = MIN (Rmin, R);128 Rmax = MAX (Rmax, R);129 Dmin = MIN (Dmin, D);130 Dmax = MAX (Dmax, D);131 XY_to_RD (&R, &D, 0.0, (double) NY, &image[m].coords);132 Rmin = MIN (Rmin, R);133 Rmax = MAX (Rmax, R);134 Dmin = MIN (Dmin, D);135 Dmax = MAX (Dmax, D);136 Mcal += image[m].Mcal_PS;137 dMcal += image[m].dMcal_PS;138 Xm += image[m].Xm;139 /* we are using mosaic.Mcal, not image.Mcal. reset image.Mcal */140 image[m].Mcal_PS = 0.0;141 image[m].dMcal_PS = image[m].Xm = NO_MAG;142 }143 dS /= Nimlist[i];144 strcpy (mosaic[i].coords.ctype, "RA---TAN");145 mosaic[i].coords.crval1 = Rmin;146 mosaic[i].coords.crval2 = Dmin;147 mosaic[i].coords.crpix1 = 0.0;148 mosaic[i].coords.crpix2 = 0.0;149 mosaic[i].coords.cdelt1 = dS;150 mosaic[i].coords.cdelt2 = dS;151 mosaic[i].coords.pc1_1 = 1.0;152 mosaic[i].coords.pc2_2 = 1.0;153 mosaic[i].coords.pc1_2 = 0.0;154 mosaic[i].coords.pc2_1 = 0.0;155 RD_to_XY (&dX, &dY, Rmax, Dmax, &mosaic[i].coords);156 157 mosaic[i].Mcal = Mcal / Nimlist[i];158 mosaic[i].dMcal = dMcal / Nimlist[i];159 mosaic[i].Xm = Xm / Nimlist[i];160 }161 if (!USE_GRID) return;162 163 dXmax = MAX (dXmax, dX);164 dYmax = MAX (dYmax, dY);165 initGrid (dXmax, dYmax);166 return;167 }168 169 void setMcalFinal () {170 171 int i, j, im, Nimage;172 Image *image;173 174 if (!MOSAICNAME[0]) return;175 176 image = getimages (&Nimage);177 178 for (i = 0; i < Nmosaic; i++) {179 for (j = 0; j < Nimlist[i]; j++) {180 im = imlist[i][j];181 image[im].Mcal_PS = mosaic[i].Mcal;182 image[im].dMcal_PS = mosaic[i].dMcal;183 image[im].Xm = mosaic[i].Xm;184 image[im].code |= (mosaic[i].code & ID_IMAGE_FEW);185 image[im].code |= (mosaic[i].code & ID_IMAGE_POOR);186 }187 }188 90 } 189 91 … … 238 140 int findMosaics (Catalog *catalog, int Ncatalog) { 239 141 240 int i, j , ecode;142 int i, j; 241 143 242 144 if (!MOSAICNAME[0]) return (FALSE); … … 247 149 if (catalog[i].measure[j].t > TSTOP) continue; 248 150 } 249 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].source);250 if (photcode[0].code != ecode) continue;251 151 matchMosaics (catalog, j, i); 252 152 } … … 255 155 } 256 156 157 /* modify this function to use the measure->imageID field ? */ 257 158 void matchMosaics (Catalog *catalog, int meas, int cat) { 258 159 … … 263 164 if (catalog[cat].measure[meas].t > mosaic[i].stop) continue; 264 165 265 # ifdef GRID_V1266 if (USE_GRID) {267 ave = catalog[cat].measure[meas].averef;268 ra = catalog[cat].average[ave].R_PS - catalog[cat].measure[meas].dR_PS / 3600.0;269 dec = catalog[cat].average[ave].D_PS - catalog[cat].measure[meas].dD_PS / 3600.0;270 271 /* X,Y always positive-definite in range 0,0 - dX, dY */272 RD_to_XY (&X, &Y, ra, dec, &mosaic[i].coords);273 setGridMeasure (meas, cat, X, Y);274 }275 # endif276 277 166 bin[cat][meas] = i; 278 167 … … 288 177 return; 289 178 } 290 fprintf (stderr, "missed measurement\n");291 179 return; 292 }293 294 float getMmos (int meas, int cat) {295 296 int i;297 float value;298 299 if (!MOSAICNAME[0]) return (0);300 i = bin[cat][meas];301 if (i == -1) return (NO_MAG);302 303 if (mosaic[i].code & IMAGE_BAD) return (NO_MAG);304 value = mosaic[i].Mcal;305 return (value);306 }307 308 int setMmos (Catalog *catalog, int PoorImages) {309 310 int i, j, m, c, n, N, Nmax, mark, bad;311 float Msys, Mrel, Mcal, Mgrid;312 double *list, *dlist, *Mlist, *dMlist;313 StatType stats;314 Image *image;315 316 if (!MOSAICNAME[0]) return (FALSE);317 318 image = getimages (&N);319 320 if (PoorImages) {321 IMAGE_BAD = 0;322 }323 324 Nmax = 0;325 for (i = 0; i < Nmosaic; i++) {326 Nmax = MAX (Nmax, Nlist[i]);327 }328 ALLOCATE (list, double, Nmax);329 ALLOCATE (dlist, double, Nmax);330 ALLOCATE (Mlist, double, Nmax);331 ALLOCATE (dMlist, double, Nmax);332 333 for (i = 0; i < Nmosaic; i++) {334 335 /* on PoorImages run, skip good images */336 if (PoorImages) {337 bad = mosaic[i].code & (ID_IMAGE_FEW | ID_IMAGE_POOR | ID_IMAGE_SKIP);338 if (!bad) continue;339 }340 341 N = 0;342 for (j = 0; j < Nlist[i]; j++) {343 344 m = mlist[i][j];345 c = clist[i][j];346 347 if (catalog[c].measure[m].flags & MEAS_BAD) continue;348 if ((Mcal = getMcal (m, c)) == NO_MAG) continue;349 if ((Mgrid = getMgrid (m, c)) == NO_MAG) continue;350 if ((Mrel = getMrel (catalog, m, c)) == NO_MAG) continue;351 352 n = catalog[c].measure[m].averef;353 Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);354 list[N] = Msys - Mrel - Mcal - Mgrid;355 dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);356 Mlist[N] = Msys;357 dMlist[N] = list[N];358 N++;359 }360 /* Nlist[i] is all measurements, N is good measurements */361 362 /* too few good measurements or too many bad measurements (skip in PoorImages run) */363 364 if (!PoorImages) {365 mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*Nlist[i]);366 if (mark) {367 fprintf (stderr, "marked image %s (%d), (%d < %d) || (%d < %f*%d)\n", image[imlist[i][0]].name, i, N, IMAGE_TOOFEW, N, IMAGE_GOOD_FRACTION, Nlist[i]);368 mosaic[i].code |= ID_IMAGE_FEW;369 } else {370 mosaic[i].code &= ~ID_IMAGE_FEW;371 }372 }373 liststats (list, dlist, N, &stats);374 if (PoorImages) fprintf (stderr, "Mmos: %f %f %d %d\n", stats.mean, stats.sigma, stats.Nmeas, N);375 mosaic[i].Mcal = stats.mean;376 mosaic[i].dMcal = stats.sigma;377 mosaic[i].Xm = 100.0*log10(stats.chisq);378 }379 free (list);380 free (dlist);381 free (Mlist);382 free (dMlist);383 384 if (PoorImages) {385 IMAGE_BAD = ID_IMAGE_POOR | ID_IMAGE_FEW | ID_IMAGE_SKIP;386 STAR_BAD = ID_STAR_POOR | ID_STAR_FEW;387 MEAS_BAD = ID_MEAS_NOCAL | ID_MEAS_POOR | ID_MEAS_SKIP | ID_MEAS_AREA;388 }389 return (TRUE);390 }391 392 StatType statsMosaicM (Catalog *catalog) {393 394 int i, n;395 double *list, *dlist;396 StatType stats;397 398 bzero (&stats, sizeof (StatType));399 if (!MOSAICNAME[0]) return (stats);400 401 ALLOCATE (list, double, Nmosaic);402 ALLOCATE (dlist, double, Nmosaic);403 404 n = 0;405 for (i = 0; i < Nmosaic; i++) {406 if (mosaic[i].code & IMAGE_BAD) continue;407 list[n] = mosaic[i].Mcal;408 dlist[n] = 1;409 n++;410 }411 412 liststats (list, dlist, n, &stats);413 free (list);414 free (dlist);415 return (stats);416 }417 418 StatType statsMosaicdM (Catalog *catalog) {419 420 int i, n;421 double *list, *dlist;422 StatType stats;423 424 bzero (&stats, sizeof (StatType));425 if (!MOSAICNAME[0]) return (stats);426 427 ALLOCATE (list, double, Nmosaic);428 ALLOCATE (dlist, double, Nmosaic);429 430 n = 0;431 for (i = 0; i < Nmosaic; i++) {432 433 if (mosaic[i].code & IMAGE_BAD) continue;434 list[n] = mosaic[i].dMcal;435 dlist[n] = 1;436 n++;437 }438 439 liststats (list, dlist, n, &stats);440 free (list);441 free (dlist);442 return (stats);443 }444 445 StatType statsMosaicN (Catalog *catalog) {446 447 int i, j, m, c, n, N;448 double *list, *dlist;449 StatType stats;450 451 bzero (&stats, sizeof (StatType));452 if (!MOSAICNAME[0]) return (stats);453 454 ALLOCATE (list, double, Nmosaic);455 ALLOCATE (dlist, double, Nmosaic);456 457 n = 0;458 for (i = 0; i < Nmosaic; i++) {459 if (mosaic[i].code & IMAGE_BAD) continue;460 461 N = 0;462 for (j = 0; j < Nlist[i]; j++) {463 464 m = mlist[i][j];465 c = clist[i][j];466 467 if (getMcal (m, c) == NO_MAG) continue;468 if (getMgrid (m, c) == NO_MAG) continue;469 if (getMrel (catalog, m, c) == NO_MAG) continue;470 N++;471 }472 list[n] = N;473 dlist[n] = 1;474 n++;475 }476 fprintf (stderr, "Nmosaic: %d, n: %d\n", Nmosaic, n);477 478 liststats (list, dlist, n, &stats);479 free (list);480 free (dlist);481 return (stats);482 }483 484 StatType statsMosaicX (Catalog *catalog) {485 486 int i, n;487 double *list, *dlist;488 StatType stats;489 490 bzero (&stats, sizeof (StatType));491 if (!MOSAICNAME[0]) return (stats);492 493 ALLOCATE (list, double, Nmosaic);494 ALLOCATE (dlist, double, Nmosaic);495 496 n = 0;497 for (i = 0; i < Nmosaic; i++) {498 499 if (mosaic[i].code & IMAGE_BAD) continue;500 list[n] = pow(10.0, 0.01*mosaic[i].Xm);501 dlist[n] = 1;502 n++;503 }504 505 liststats (list, dlist, n, &stats);506 free (list);507 free (dlist);508 return (stats);509 }510 511 /* mark mosaic if: abs(Mcal - <Mcal>) too large, dMcal too large */512 void clean_mosaics () {513 514 int i, N, mark, Nmark;515 double *mlist, *slist, *dlist;516 double MaxOffset, MedOffset, MaxScatter;517 StatType stats;518 519 if (!MOSAICNAME[0]) return;520 521 if (VERBOSE) fprintf (stderr, "marking poor mosaics\n");522 523 ALLOCATE (mlist, double, Nmosaic);524 ALLOCATE (slist, double, Nmosaic);525 ALLOCATE (dlist, double, Nmosaic);526 527 for (i = N = 0; i < Nmosaic; i++) {528 if (mosaic[i].code & IMAGE_BAD) continue;529 mlist[N] = mosaic[i].Mcal;530 slist[N] = mosaic[i].dMcal;531 dlist[N] = 1;532 N++;533 }534 initstats ("MEAN");535 liststats (mlist, dlist, N, &stats);536 MaxOffset = MAX (IMAGE_OFFSET, 2*stats.sigma);537 MedOffset = stats.median;538 liststats (slist, dlist, N, &stats);539 MaxScatter = MAX (IMAGE_SCATTER, 2*stats.median);540 fprintf (stderr, "Mrel: %f, dMrel: %f, Max Scatter: %f, Max Offset: %f\n", MedOffset, stats.median, MaxScatter, MaxOffset);541 542 Nmark = 0;543 for (i = 0; i < Nmosaic; i++) {544 mark = FALSE;545 mark = (mosaic[i].dMcal > MaxScatter) || (fabs(mosaic[i].Mcal - MedOffset) > MaxOffset);546 if (mark) {547 Nmark ++;548 mosaic[i].code |= ID_IMAGE_POOR;549 } else {550 mosaic[i].code &= ~ID_IMAGE_POOR;551 }552 }553 554 fprintf (stderr, "%d mosaics marked poor\n", Nmark);555 initstats (STATMODE);556 free (mlist);557 free (slist);558 free (dlist);559 180 } 560 181 … … 591 212 592 213 ave = catalog[c].measure[m].averef; 593 xlist[N] = catalog[c].average[ave].R - catalog[c].measure[m].dR _PS/ 3600.0;594 ylist[N] = catalog[c].average[ave].D - catalog[c].measure[m].dD _PS/ 3600.0;214 xlist[N] = catalog[c].average[ave].R - catalog[c].measure[m].dR / 3600.0; 215 ylist[N] = catalog[c].average[ave].D - catalog[c].measure[m].dD / 3600.0; 595 216 N++; 596 217 } … … 655 276 } 656 277 278 Image *getMosaicForImage (int Nim) { 279 280 Image *mosaic; 281 282 mosaic = NULL; 283 return mosaic; 284 } 285 657 286 int *SelectRefMosaic (Mosaic **refmosaic, int *Nimage) { 658 287 -
trunk/Ohana/src/relastro/src/SetSignals.c
r6808 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 static int Protect = FALSE; -
trunk/Ohana/src/relastro/src/Shutdown.c
r7080 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 static FITS_DB *db; … … 27 27 } 28 28 29 30 /* XXX this is probably not needed anymore : just protect the write statements */ -
trunk/Ohana/src/relastro/src/StarOps.c
r6808 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 static int Nmax; … … 28 28 if (catalog[cat].average[ave].code & STAR_BAD) return (NO_MAG); 29 29 30 value = PhotPrimary ? catalog[cat].average[ave].M : catalog[cat].secfilt[PhotNsec*ave+PhotSec].M_PS;30 value = catalog[cat].secfilt[PhotNsec*ave+PhotSec].M; 31 31 return (value); 32 32 } … … 54 54 Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 55 55 list[N] = Msys - Mcal - Mmos - Mgrid; 56 dlist[N] = MAX (catalog[i].measure[m].dM _PS, MIN_ERROR);56 dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 57 57 N++; 58 58 } … … 65 65 liststats (list, dlist, N, &stats); 66 66 67 if (PhotPrimary) { 68 catalog[i].average[j].M = stats.mean; 69 catalog[i].average[j].dM = stats.sigma; 70 catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 71 } else { 72 catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS = stats.mean; 73 catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS = stats.sigma; 74 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 75 } 67 catalog[i].secfilt[PhotNsec*j+PhotSec].M = stats.mean; 68 catalog[i].secfilt[PhotNsec*j+PhotSec].dM = stats.sigma; 69 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 76 70 } 77 71 } … … 112 106 Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 113 107 list[N] = Msys - Mcal - Mmos - Mgrid; 114 dlist[N] = MAX (catalog[i].measure[m].dM _PS, MIN_ERROR);108 dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 115 109 N++; 116 110 } … … 121 115 122 116 /* use sigma or error in dM for output? */ 123 if (PhotPrimary) { 124 catalog[i].average[j].M = stats.mean; 125 catalog[i].average[j].dM = MAX (stats.sigma, stats.error); 126 catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 127 } else { 128 catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS = stats.mean; 129 catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS = MAX (stats.error, stats.sigma); 130 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 131 } 117 catalog[i].secfilt[PhotNsec*j+PhotSec].M = stats.mean; 118 catalog[i].secfilt[PhotNsec*j+PhotSec].dM = MAX (stats.error, stats.sigma); 119 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 132 120 } 133 121 } … … 156 144 if ((Mmos = getMmos (m, i)) == NO_MAG) continue; 157 145 if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue; 158 catalog[i].measure[m].Mcal _PS= Mcal + Mmos + Mgrid;146 catalog[i].measure[m].Mcal = Mcal + Mmos + Mgrid; 159 147 } 160 148 } … … 183 171 for (j = 0; j < catalog[i].Naverage; j++) { 184 172 if (catalog[i].average[j].code & STAR_BAD) continue; 185 Xm = PhotPrimary ? catalog[i].average[j].Xm :catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;173 Xm = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm; 186 174 if (Xm == -1) continue; 187 175 Chisq = pow (10.0, 0.01*Xm); 188 176 xlist[Ntot] = Chisq; 189 slist[Ntot] = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;177 slist[Ntot] = catalog[i].secfilt[PhotNsec*j+PhotSec].dM; 190 178 dlist[Ntot] = 1; 191 179 Ntot ++; … … 203 191 for (i = 0; i < Ncatalog; i++) { 204 192 for (j = 0; j < catalog[i].Naverage; j++) { 205 dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;206 Xm = PhotPrimary ? catalog[i].average[j].Xm :catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;193 dM = catalog[i].secfilt[PhotNsec*j+PhotSec].dM; 194 Xm = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm; 207 195 Chisq = pow (10.0, 0.01*Xm); 208 196 mark = (dM > MaxScatter) || (Xm == NO_MAG) || (Chisq > MaxChisq); … … 269 257 Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 270 258 list[N] = Msys - Mcal - Mmos - Mgrid; 271 dlist[N] = MAX (catalog[i].measure[m].dM _PS, MIN_ERROR);259 dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 272 260 N++; 273 261 } … … 301 289 Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 302 290 list[N] = Msys - Mcal - Mmos - Mgrid; 303 dlist[N] = MAX (catalog[i].measure[m].dM _PS, MIN_ERROR);291 dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 304 292 ilist[N] = m; 305 293 N++; … … 387 375 if (catalog[i].average[j].code & STAR_BAD) continue; 388 376 389 Xm = PhotPrimary ? catalog[i].average[j].Xm :catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;377 Xm = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm; 390 378 if (Xm == NO_MAG) continue; 391 379 list[n] = pow (10.0, 0.01*Xm); … … 423 411 if (catalog[i].average[j].code & STAR_BAD) continue; 424 412 425 dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;413 dM = catalog[i].secfilt[PhotNsec*j+PhotSec].dM; 426 414 list[n] = dM; 427 415 dlist[n] = 1; … … 452 440 for (j = 0; j < catalog[i].Naverage; j++) { 453 441 if (catalog[i].average[j].code & STAR_BAD) continue; 454 dMrel = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;442 dMrel = catalog[i].secfilt[PhotNsec*j+PhotSec].dM; 455 443 bin = dMrel / 0.00025; 456 444 bin = MAX (0, MIN (NBIN-1, bin)); … … 483 471 for (j = 0; j < catalog[i].Naverage; j++) { 484 472 if (catalog[i].average[j].code & STAR_BAD) continue; 485 xlist[N] = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;486 value = PhotPrimary ? catalog[i].average[j].Xm :catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;473 xlist[N] = catalog[i].secfilt[PhotNsec*j+PhotSec].M; 474 value = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm; 487 475 if (value == NO_MAG) continue; 488 476 ylist[N] = 0.01*value; -
trunk/Ohana/src/relastro/src/UpdateImages.c
r11742 r12332 42 42 /* the astrometric errors are not being carried yet (but should be!) */ 43 43 /* we use the photometric mag error as a weighting term */ 44 dlistR[N] = MAX (catalog[i].measure[m].dM _PS, MIN_ERROR);45 dlistD[N] = MAX (catalog[i].measure[m].dM _PS, MIN_ERROR);44 dlistR[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 45 dlistD[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 46 46 N++; 47 47 } -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r11742 r12332 2 2 3 3 static int Nmax; 4 static double *listR, *listD; 5 static double *dlistR, *dlistD; 4 static double *X, *dX; 5 static double *Y, *dY; 6 static double *R, *dR; 7 static double *D, *dD; 8 static double *pX; 9 static double *pY; 10 static time_t *T; 11 static double *dT; 6 12 7 13 void initObjectData (Catalog *catalog, int Ncatalog) { … … 16 22 } 17 23 18 ALLOCATE (list, double, MAX (1, Nmax)); 19 ALLOCATE (dlist, double, MAX (1, Nmax)); 24 ALLOCATE (R, double, MAX (1, Nmax)); 25 ALLOCATE (D, double, MAX (1, Nmax)); 26 ALLOCATE (T, time_t, MAX (1, Nmax)); 27 ALLOCATE (X, double, MAX (1, Nmax)); 28 ALLOCATE (Y, double, MAX (1, Nmax)); 29 30 ALLOCATE (dR, double, MAX (1, Nmax)); 31 ALLOCATE (dD, double, MAX (1, Nmax)); 32 ALLOCATE (dT, double, MAX (1, Nmax)); 33 ALLOCATE (dX, double, MAX (1, Nmax)); 34 ALLOCATE (dY, double, MAX (1, Nmax)); 35 36 ALLOCATE (pX, double, MAX (1, Nmax)); 37 ALLOCATE (pY, double, MAX (1, Nmax)); 20 38 } 21 39 … … 23 41 24 42 int i, j, k, m, N; 25 float chisq;26 43 StatType statsR, statsD; 44 Coords coords; 45 PMFit fit; 46 47 initObjectData (catalog, Ncatalog); 48 49 coords.crval1 = 0; 50 coords.crval2 = 0; 51 coords.crpix1 = 0; 52 coords.crpix2 = 0; 53 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 54 coords.pc1_1 = coords.pc2_2 = 1.0; 55 coords.pc1_2 = coords.pc2_1 = 0.0; 56 coords.Npolyterms = 1; 57 strcpy (coords.ctype, "RA---SIN"); 27 58 28 59 for (i = 0; i < Ncatalog; i++) { … … 31 62 /* calculate the average value of R,D for a single star */ 32 63 if (catalog[i].average[j].code & STAR_BAD) continue; 33 m = catalog[i].average[j].offset;34 64 35 65 N = 0; 66 m = catalog[i].average[j].offset; 36 67 for (k = 0; k < catalog[i].average[j].Nm; k++, m++) { 37 68 if (catalog[i].measure[m].flags & MEAS_BAD) continue; 38 69 39 listR[N] = getMeanR (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 40 listD[N] = getMeanD (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 70 R[N] = getMeanR (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 71 D[N] = getMeanD (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 72 T[N] = catalog[i].measure[m].t; 41 73 42 74 /* the astrometric errors are not being carried yet (but should be!) */ 43 75 /* we use the photometric mag error as a weighting term */ 44 dlistR[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR); 45 dlistD[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR); 76 dR[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 77 dD[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 78 dT[N] = catalog[i].measure[m].dt; 79 46 80 N++; 47 81 } 82 83 // XXX This criterion needs to be better considered: adjust to match Ndof 48 84 if (N < STAR_TOOFEW) { /* too few measurements */ 49 85 catalog[i].average[j].code |= ID_STAR_FEW; 86 continue; 50 87 } else { 51 88 catalog[i].average[j].code &= ~ID_STAR_FEW; 52 89 } 53 90 54 /* in here, we should be fitting the parallax and proper-motion components */ 91 /* we need to do the fit in a locally linear space; choose a ref coordinate */ 92 coords.crval1 = R[0]; 93 coords.crval2 = D[0]; 94 95 /* project all of the R,D coordinates to a plane centered on this coordinate */ 96 for (k = 0; k < N; k++) { 97 RD_to_XY (&X[k], &Y[k], R[k], D[k], &coords); 98 } 55 99 56 liststats (listR, dlistR, N, &statsR); 57 liststats (listR, dlistR, N, &statsD); 100 /* fit the model components as needed */ 101 switch (FIT_MODE) { 102 case FIT_AVERAGE: 103 liststats (R, dR, N, &statsR); 104 liststats (D, dD, N, &statsD); 58 105 59 catalog[i].average[j].R= statsR.mean;60 catalog[i].average[j].dR= statsR.sigma;106 fit.Ro = statsR.mean; 107 fit.dRo = statsR.sigma; 61 108 62 catalog[i].average[j].D= statsD.mean;63 catalog[i].average[j].dD= statsD.sigma;109 fit.Do = statsD.mean; 110 fit.dDo = statsD.sigma; 64 111 65 chisq = 0.5*(statsR.chisq + statsD.chisq); 66 catalog[i].average[j].Xp = (statsR.Nmeas > 1) ? 100.0*log10(chisq) : NO_MAG; 112 fit.chisq = 0.5*(statsR.chisq + statsD.chisq); 113 fit.Nfit = N; 114 break; 115 116 case FIT_PM_ONLY: 117 FitPM (&fit, X, dX, Y, dY, T, N); 118 break; 119 120 case FIT_PM_AND_PAR: 121 for (k = 0; k < N; k++) { 122 ParFactor (&pX[k], &pY[k], R[k], D[k], T[k]); 123 } 124 FitPMandPar (&fit, X, dX, Y, dY, T, pX, pY, N); 125 break; 126 default: 127 fprintf (stderr, "programming error at %s, %s", __FILE__, __LINE__); 128 exit (2); 129 } 130 131 if (0 && (j < 100)) { 132 fprintf (stderr, "%f %f -> %f %f (%f,%f)\n", 133 catalog[i].average[j].R, 134 catalog[i].average[j].D, 135 fit.Ro, fit.Do, 136 3600*(catalog[i].average[j].R - fit.Ro), 137 3600*(catalog[i].average[j].D - fit.Do)); 138 } 139 140 // the measure fields must be updated before the average fields 141 m = catalog[i].average[j].offset; 142 for (k = 0; k < catalog[i].average[j].Nm; k++, m++) { 143 if (catalog[i].measure[m].flags & MEAS_BAD) continue; 144 setMeanR (fit.Ro, &catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 145 setMeanD (fit.Do, &catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 146 } 147 148 catalog[i].average[j].R = fit.Ro; 149 catalog[i].average[j].D = fit.Do; 150 catalog[i].average[j].dR = fit.dRo; 151 catalog[i].average[j].dD = fit.dDo; 152 153 catalog[i].average[j].uR = fit.uR; 154 catalog[i].average[j].uD = fit.uD; 155 catalog[i].average[j].duR = fit.duR; 156 catalog[i].average[j].duD = fit.duD; 157 158 catalog[i].average[j].P = fit.p; 159 catalog[i].average[j].dP = fit.dp; 160 161 catalog[i].average[j].Xp = (fit.Nfit > 1) ? 100.0*log10(fit.chisq) : NO_MAG; 67 162 68 163 } … … 71 166 } 72 167 168 /* fitting proper-motion and parallax: 169 170 given a source at position r,d, at a time t, we need to calculate a vector (pr,pd) 171 172 let x,y be the coordinate in the linearized frame with y parallel to DEC lines 173 174 L,B are the ecliptic longitude and latitude of the object, 175 dL and dB are the offsets in the L and B directions 176 177 dL = sin(t - topp) 178 dB = cos(t - topp)*sin(B) 179 180 these need to be rotated to the R,D frame to yield pR,pD. Then, the equation of motion 181 for the source in the x,y frame is: 182 183 x = Ro + uR * (t - to) + p * pR 184 y = Do + uD * (t - to) + p * pD 185 186 the unknowns in these equations are Ro, uR, Do, uD, and p 187 188 XXX think through the concepts for the pole a bit better. all objects near the pole 189 move the same way with the same phase. choose a projection center and define dL,dB relative 190 to that center point coordinate system? 191 192 */ -
trunk/Ohana/src/relastro/src/args.c
r11742 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 void usage (void); 3 3 … … 6 6 int N; 7 7 double trange; 8 9 /* possible operations */ 10 FIT_TARGET = TARGET_NONE; 11 FIT_MODE = FIT_AVERAGE; 12 if ((N = get_argument (argc, argv, "-update-objects"))) { 13 remove_argument (N, &argc, argv); 14 FIT_TARGET = TARGET_OBJECTS; 15 16 // check for object fitting modes (not valid for images) 17 if ((N = get_argument (argc, argv, "-pm"))) { 18 remove_argument (N, &argc, argv); 19 FIT_MODE = FIT_PM_ONLY; 20 } 21 if ((N = get_argument (argc, argv, "-pmpar"))) { 22 remove_argument (N, &argc, argv); 23 FIT_MODE = FIT_PM_AND_PAR; 24 } 25 } 26 if ((N = get_argument (argc, argv, "-update-simple"))) { 27 remove_argument (N, &argc, argv); 28 FIT_TARGET = TARGET_SIMPLE; 29 } 30 if ((N = get_argument (argc, argv, "-update-chips"))) { 31 remove_argument (N, &argc, argv); 32 FIT_TARGET = TARGET_CHIPS; 33 } 34 if ((N = get_argument (argc, argv, "-update-mosaics"))) { 35 remove_argument (N, &argc, argv); 36 FIT_TARGET = TARGET_MOSAICS; 37 } 38 if (FIT_TARGET == TARGET_NONE) usage(); 39 40 /* specify portion of the sky : allow default of all sky? */ 41 UserPatch.Rmin = 0; 42 UserPatch.Rmax = 360; 43 UserPatch.Dmin = -90; 44 UserPatch.Dmax = +90; 45 if ((N = get_argument (argc, argv, "-region"))) { 46 remove_argument (N, &argc, argv); 47 UserPatch.Rmin = atof (argv[N]); 48 remove_argument (N, &argc, argv); 49 UserPatch.Rmax = atof (argv[N]); 50 remove_argument (N, &argc, argv); 51 UserPatch.Dmin = atof (argv[N]); 52 remove_argument (N, &argc, argv); 53 UserPatch.Dmax = atof (argv[N]); 54 remove_argument (N, &argc, argv); 55 } else { 56 usage (); 57 } 8 58 9 59 /* define time */ … … 34 84 } 35 85 36 /* specify portion of the sky */ 37 UserPatch.Rmin = 0; 38 UserPatch.Rmax = 360; 39 UserPatch.Dmin = -90; 40 UserPatch.Dmax = +90; 41 UserPatchSelect = FALSE; 42 if ((N = get_argument (argc, argv, "-region"))) { 43 remove_argument (N, &argc, argv); 44 UserPatch.Rmin = atof (argv[N]); 45 remove_argument (N, &argc, argv); 46 UserPatch.Rmax = atof (argv[N]); 47 remove_argument (N, &argc, argv); 48 UserPatch.Dmin = atof (argv[N]); 49 remove_argument (N, &argc, argv); 50 UserPatch.Dmax = atof (argv[N]); 51 remove_argument (N, &argc, argv); 52 UserPatchSelect = TRUE; 86 PHOTCODE_LIST = NULL; 87 if ((N = get_argument (argc, argv, "-photcode"))) { 88 remove_argument (N, &argc, argv); 89 PHOTCODE_LIST = strcreate(argv[N]); 90 remove_argument (N, &argc, argv); 53 91 } 54 92 … … 79 117 } 80 118 81 NLOOP = 8;82 if ((N = get_argument (argc, argv, "-n"))) {83 remove_argument (N, &argc, argv);84 NLOOP = atof (argv[N]);85 remove_argument (N, &argc, argv);86 }87 88 119 RESET = FALSE; 89 120 if ((N = get_argument (argc, argv, "-reset"))) { … … 104 135 } 105 136 137 /* XXX update these for relevant plots */ 106 138 PlotMmin = 10.0; PlotMmax = 20.0; PlotdMmin = -1.0; PlotdMmax = 1.0; 107 139 if ((N = get_argument (argc, argv, "-plrange"))) { … … 117 149 } 118 150 119 /* group images by mosaic, find Mmos */ 120 MOSAICNAME[0] = 0; 121 if ((N = get_argument (argc, argv, "-mosaic"))) { 122 remove_argument (N, &argc, argv); 123 strcpy (MOSAICNAME, argv[N]); 124 remove_argument (N, &argc, argv); 125 } 126 127 FREEZE_IMAGES = FALSE; 128 if ((N = get_argument (argc, argv, "-imfreeze"))) { 129 remove_argument (N, &argc, argv); 130 FREEZE_IMAGES = TRUE; 131 } 132 133 USE_GRID = FALSE; 134 if ((N = get_argument (argc, argv, "-grid"))) { 135 remove_argument (N, &argc, argv); 136 USE_GRID = TRUE; 137 if (!MOSAICNAME[0]) { 138 fprintf (stderr, "-grid is only valid with -mosaic\n"); 139 exit (2); 140 } 141 } 142 151 /* XXX update this */ 143 152 MIN_ERROR = 0.001; 144 153 if ((N = get_argument (argc, argv, "-minerror"))) { … … 172 181 ImagSelect = TRUE; 173 182 } 174 175 /* possible operations */ 176 UpdateObjects = FALSE; 177 if ((N = get_argument (argc, argv, "-update-objects"))) { 178 remove_argument (N, &argc, argv); 179 UpdateObjects = TRUE; 180 } 181 UpdateImages = FALSE; 182 if ((N = get_argument (argc, argv, "-update-images"))) { 183 remove_argument (N, &argc, argv); 184 UpdateImages = TRUE; 185 } 186 187 if ( UserPatchSelect && (argc != 2)) usage (); 188 if (!UserPatchSelect && (argc != 3)) usage (); 189 183 184 /* XXX drop this? */ 185 DophotSelect = FALSE; 186 if ((N = get_argument (argc, argv, "-dophot"))) { 187 remove_argument (N, &argc, argv); 188 DophotValue = atof (argv[N]); 189 remove_argument (N, &argc, argv); 190 DophotSelect = TRUE; 191 } 192 193 if (argc != 1) usage (); 190 194 return TRUE; 191 195 } 192 196 193 197 void usage () { 194 fprintf (stderr, "ERROR: USAGE: relphot (region) (photcode)\n"); 195 fprintf (stderr, " or: relphot (photcode) -region RA RA DEC DEC\n"); 196 fprintf (stderr, " options: \n"); 198 fprintf (stderr, "ERROR: USAGE: relastro -region RA RA DEC DEC\n"); 199 fprintf (stderr, " working options: \n"); 197 200 fprintf (stderr, " -time (start) (stop)\n"); 198 201 fprintf (stderr, " -v\n"); 199 202 fprintf (stderr, " -plot\n"); 200 203 fprintf (stderr, " -plotdelay (seconds)\n"); 201 fprintf (stderr, " -statmode (mode)\n");202 fprintf (stderr, " -n (nloop)\n");203 fprintf (stderr, " -reset\n");204 204 fprintf (stderr, " -update\n"); 205 205 fprintf (stderr, " -params\n"); 206 fprintf (stderr, " -mosaic (mosaic)\n"); 207 fprintf (stderr, " -imfreeze\n"); 208 fprintf (stderr, " -grid\n"); 206 fprintf (stderr, " -reset\n"); 209 207 fprintf (stderr, " -area Xmin Xmax Ymin Ymax\n"); 210 fprintf (stderr, " -instmag min max\n"); 208 fprintf (stderr, " -instmag min max\n\n"); 209 fprintf (stderr, " planned options: \n"); 210 fprintf (stderr, " -photcode code[,code,code,..]\n"); 211 211 fprintf (stderr, " \n"); 212 212 exit (2); -
trunk/Ohana/src/relastro/src/bcatalog.c
r8390 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 int bcatalog (Catalog *subcatalog, Catalog *catalog) { 4 4 5 int i, j, offset, ecode;5 int i, j, k, offset, found; 6 6 int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm; 7 7 float mag; … … 19 19 if (catalog[0].average[i].Nm < 2) continue; 20 20 21 /* XXX this limitation is absurd22 if (catalog[0].average[i].R < fullregion[0].RA[0]) continue;23 if (catalog[0].average[i].R > fullregion[0].RA[1]) continue;24 if (catalog[0].average[i].D < fullregion[0].DEC[0]) continue;25 if (catalog[0].average[i].D > fullregion[0].DEC[1]) continue;26 */27 28 21 /* start with all stars good */ 29 22 subcatalog[0].average[Naverage] = catalog[0].average[i]; … … 34 27 35 28 if (RESET) { 36 float *p; 37 p = (PhotPrimary) ? &subcatalog[0].average[Naverage].M : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M_PS; 38 *p = NO_MAG; 39 p = (PhotPrimary) ? &subcatalog[0].average[Naverage].dM : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM_PS; 40 *p = NO_MAG; 29 // XXX reset the ra,dec coords? 41 30 subcatalog[0].average[Naverage].code &= ~ID_STAR_FEW; 42 31 subcatalog[0].average[Naverage].code &= ~ID_STAR_POOR; … … 48 37 offset = catalog[0].average[i].offset + j; 49 38 50 /* select measurements by photcode */ 51 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset].source); 52 if (ecode != photcode[0].code) continue; 39 /* select measurements by photcode, if specified */ 40 if (Nphotcodes > 0) { 41 found = FALSE; 42 for (k = 0; (k < Nphotcodes) && !found; k++) { 43 if (photcodes[k][0].code == catalog[0].measure[offset].photcode) found = TRUE; 44 } 45 if (!found) continue; 46 } 53 47 54 48 /* select measurements by time */ … … 59 53 60 54 /* select measurements by quality */ 61 if ( catalog[0].measure[offset].dophot != 1) continue;55 if (DophotSelect && (catalog[0].measure[offset].dophot != DophotValue)) continue; 62 56 63 57 /* select measurements by mag limit */ … … 66 60 67 61 /* select measurements by measurement error */ 68 if ( catalog[0].measure[offset].dM_PS > SIGMA_LIM) continue;62 if ((SIGMA_LIM > 0) && (catalog[0].measure[offset].dM > SIGMA_LIM)) continue; 69 63 70 64 /* select measurements by mag limit */ … … 79 73 subcatalog[0].measure[Nmeasure].averef = Naverage; 80 74 if (RESET) { 81 subcatalog[0].measure[Nmeasure].Mcal _PS= 0;75 subcatalog[0].measure[Nmeasure].Mcal = 0; 82 76 subcatalog[0].measure[Nmeasure].flags &= 0xff00; 83 77 subcatalog[0].measure[Nmeasure].flags &= ~ID_MEAS_POOR; … … 111 105 subcatalog[0].Nsecfilt = catalog[0].Nsecfilt; 112 106 113 if (catalog[0].Naverage > 0) free (catalog[0].average);114 if (catalog[0].Nmeasure > 0) free (catalog[0].measure);115 if (catalog[0].Naverage > 0) free (catalog[0].secfilt);116 117 107 if (VERBOSE) { 118 108 fprintf (stderr, "%d: using %d stars (%d measures) for catalog\n", i, -
trunk/Ohana/src/relastro/src/global_stats.c
r6808 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 void global_stats (Catalog *catalog, int Ncatalog) { -
trunk/Ohana/src/relastro/src/initialize.c
r8390 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 void initialize (int argc, char **argv) { 4 4 5 int N; 5 int NPHOTCODES; 6 char *codename, *ptr; 6 7 7 8 ConfigInit (&argc, argv); 8 9 args (argc, argv); 9 10 10 N = UserPatchSelect ? 1 : 2; 11 if ((photcode = GetPhotcodebyName (argv[N])) == NULL) { 12 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", argv[N]); 13 exit (1); 11 /* XXX we need to build a list of accepted photcodes. these will be used by bcatalog to accept or 12 reject loaded data */ 13 14 Nphotcodes = 0; 15 photcodes = NULL; 16 if (PHOTCODE_LIST != NULL) { 17 NPHOTCODES = 10; 18 ALLOCATE (photcodes, PhotCode *, NPHOTCODES); 19 20 /* parse the comma-separated list of photcodes */ 21 strtok_r (PHOTCODE_LIST, ",", &ptr); 22 while ((codename = strtok_r (NULL, ",", &ptr)) != NULL) { 23 fprintf (stderr, "PHOTCODE_LIST: %s\n", PHOTCODE_LIST); 24 fprintf (stderr, "codename: %s\n", codename); 25 if ((photcodes[Nphotcodes] = GetPhotcodebyName (codename)) == NULL) { 26 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename); 27 exit (1); 28 } 29 Nphotcodes ++; 30 CHECK_REALLOCATE (photcodes, PhotCode *, NPHOTCODES, Nphotcodes, 10); 31 } 14 32 } 15 if ((photcode[0].type != PHOT_PRI) && (photcode[0].type != PHOT_SEC)) {16 fprintf (stderr, "photcode %s is not a primary or secondary filter\n", argv[N]);17 exit (1);18 }19 20 PhotPrimary = (photcode[0].type == PHOT_PRI);21 33 PhotNsec = GetPhotcodeNsecfilt (); 22 PhotSec = GetPhotcodeNsec (photcode[0].code);23 34 24 35 initstats (STATMODE); … … 28 39 MEAS_BAD = ID_MEAS_NOCAL | ID_MEAS_POOR | ID_MEAS_SKIP | ID_MEAS_AREA; 29 40 41 /* XXX drop irrelevant entries */ 30 42 if (SHOW_PARAMS) { 31 43 fprintf (stderr, "current parameter settings:\n"); -
trunk/Ohana/src/relastro/src/liststats.c
r6808 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 enum {M_MEAN, M_MEDIAN, M_WT_MEAN, M_INNER_MEAN, -
trunk/Ohana/src/relastro/src/load_catalogs.c
r8390 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog ) {3 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int subselect) { 4 4 5 5 int i, Nstar; 6 Catalog *catalog, tcatalog;6 Catalog *catalog, *pcatalog, tcatalog; 7 7 8 8 if (VERBOSE) fprintf (stderr, "loading catalog data\n"); … … 13 13 for (i = 0; i < skylist[0].Nregions; i++) { 14 14 15 pcatalog = subselect ? &tcatalog : &catalog[i]; 16 15 17 // set up the basic catalog info 16 tcatalog.filename= skylist[0].filename[i];17 tcatalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data18 tcatalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data19 tcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; // don't need to load all data at this point18 pcatalog[0].filename = skylist[0].filename[i]; 19 pcatalog[0].catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 20 pcatalog[0].catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 21 pcatalog[0].catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; // don't need to load all data at this point 20 22 21 if (!dvo_catalog_open ( &tcatalog, skylist[0].regions[i], VERBOSE, "r")) {22 fprintf (stderr, "ERROR: failure reading catalog %s\n", tcatalog.filename);23 if (!dvo_catalog_open (pcatalog, skylist[0].regions[i], VERBOSE, "w")) { 24 fprintf (stderr, "ERROR: failure reading catalog %s\n", pcatalog[0].filename); 23 25 exit (1); 24 26 } 25 if (VERBOSE && ! tcatalog.Nave_disk) fprintf (stderr, "no data in %s, skipping\n", tcatalog.filename);27 if (VERBOSE && !pcatalog[0].Nave_disk) fprintf (stderr, "no data in %s, skipping\n", pcatalog[0].filename); 26 28 27 29 // select only the brighter stars 28 bcatalog (&catalog[i], &tcatalog); 29 dvo_catalog_unlock (&tcatalog); 30 dvo_catalog_free (&tcatalog); 30 if (subselect) { 31 bcatalog (&catalog[i], &tcatalog); 32 dvo_catalog_unlock (&tcatalog); 33 dvo_catalog_free (&tcatalog); 34 } 31 35 } 32 36 … … 37 41 } 38 42 if (Nstar < 2) { 39 fprintf (stderr, "insufficient stars %d\n", Nstar); 40 exit (0); 43 fprintf (stderr, "warning: insufficient stars %d\n", Nstar); 41 44 } 42 45 -
trunk/Ohana/src/relastro/src/load_images.c
r8390 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 SkyList *load_images (FITS_DB *db, char *regionName, SkyRegion *region, int RegionSelect) {3 SkyList *load_images (FITS_DB *db, SkyRegion *region) { 4 4 5 5 Image *image, *subset; 6 int Nimage, Nsubset , Nchar;6 int Nimage, Nsubset; 7 7 int *LineNumber; 8 8 … … 15 15 16 16 // determine the populated SkyRegions overlapping the requested area 17 if (RegionSelect) { 18 skylist = SkyListByPatch (sky, -1, region); 19 } else { 20 Nchar = strlen(regionName); 21 if (!strcmp (®ionName[Nchar-4], ".cpt")) regionName[Nchar-4] = 0; 22 skylist = SkyListByName (sky, regionName); 23 } 17 skylist = SkyListByPatch (sky, -1, region); 24 18 25 19 // convert database table to internal structure … … 34 28 initMosaics (subset, Nsubset); 35 29 30 /* unlock, if we can (else, unlocked below) */ 31 if (!UPDATE) dvo_image_unlock (db); 32 36 33 return (skylist); 37 34 } -
trunk/Ohana/src/relastro/src/plot_scatter.c
r6808 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 void plot_scatter (Catalog *catalog, int Ncatalog) { 4 4 5 # if (0) 5 6 int i, j, k, m, N, Ntot; 6 7 float Mrel, Mcal, Mmos, Mgrid; … … 28 29 for (k = 0; k < catalog[i].average[j].Nm; k++, m++) { 29 30 if (catalog[i].measure[m].flags & MEAS_BAD) continue; 30 if ((Mcal = getMcal (m, i)) == NO_MAG) continue;31 if ((Mmos = getMmos (m, i)) == NO_MAG) continue;32 if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;33 31 34 Mrel = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;32 Mrel = catalog[i].secfilt[PhotNsec*j+PhotSec].M; 35 33 xlist[N] = Mrel; 36 34 ylist[N] = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]) - Mcal - Mmos - Mgrid - Mrel; … … 55 53 free (ylist); 56 54 free (ilist); 55 56 # endif 57 57 } 58 59 /* XXX this should become astrometrically relevant */ -
trunk/Ohana/src/relastro/src/plotstuff.c
r10843 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 # include <signal.h> 3 3 … … 49 49 if (Xgraph[N] == 0) return; 50 50 51 KiiPS (Xgraph[N], TRUE, KAPA_PS_NEWPLOT, filename );51 KiiPS (Xgraph[N], TRUE, KAPA_PS_NEWPLOT, filename, "default"); 52 52 return; 53 53 } -
trunk/Ohana/src/relastro/src/relastro.c
r11742 r12332 3 3 int main (int argc, char **argv) { 4 4 5 int i,status, Ncatalog;5 int status, Ncatalog; 6 6 Catalog *catalog; 7 7 FITS_DB db; … … 22 22 23 23 /* load regions and images based on specified sky patch */ 24 // XXX need to mimic old-style load by passing patch name 25 // XXX need to reduce number of global variables in use. 26 // XXX this is fairly lame: argv[1] is photcode if UserPatchSelect is true 27 skylist = load_images (&db, argv[1], &UserPatch, UserPatchSelect); 24 skylist = load_images (&db, &UserPatch); 28 25 29 /* unlock, if we can (else, unlocked below) */ 30 if (!UPDATE) dvo_image_unlock (&db); 31 32 /* load catalog data from region files */ 33 catalog = load_catalogs (skylist, &Ncatalog); 26 /* load catalog data from region files : subselect only if we are not doing the objects */ 27 catalog = load_catalogs (skylist, &Ncatalog, (FIT_TARGET != TARGET_OBJECTS)); 34 28 35 29 /* match measurements with images, mosaics */ 36 30 initImageBins (catalog, Ncatalog); 37 initMosaicBins (catalog, Ncatalog); 38 initGridBins (catalog, Ncatalog); 39 initMrel (catalog, Ncatalog); 31 // initMosaicBins (catalog, Ncatalog); 40 32 41 33 findImages (catalog, Ncatalog); 42 findMosaics (catalog, Ncatalog); /* also sets Grid values */ 43 SAVEPLOT = FALSE; 44 45 setExclusions (catalog, Ncatalog); 34 // findMosaics (catalog, Ncatalog); /* also sets Grid values */ 46 35 47 36 if (PLOTSTUFF) { 48 plot_star_coords (catalog, Ncatalog);37 // plot_star_coords (catalog, Ncatalog); 49 38 plot_mosaic_fields (catalog); 50 39 } 51 40 52 41 /* major modes */ 53 if (UpdateObjects) { 54 UpdateObjects (catalog, Ncatalog); 55 } 56 if (UpdateImages) { 57 UpdateImages (catalog, Ncatalog); 42 switch (FIT_TARGET) { 43 case TARGET_OBJECTS: 44 UpdateObjects (catalog, Ncatalog); 45 break; 46 case TARGET_SIMPLE: 47 UpdateSimple (catalog, Ncatalog); 48 break; 49 50 case TARGET_CHIPS: 51 UpdateChips (catalog, Ncatalog); 52 break; 53 54 case TARGET_MOSAICS: 55 UpdateMosaic (catalog, Ncatalog); 56 break; 57 default: 58 fprintf (stderr, "programming error at %s:%s", __FILE__, __LINE__); 59 exit (2); 58 60 } 59 61 … … 69 71 if (!UPDATE) exit (0); 70 72 71 /* need to figure out how to update images, etc */ 72 dvo_image_update (&db, VERBOSE); 73 dvo_image_unlock (&db); 73 if (FIT_TARGET == TARGET_OBJECTS) { 74 save_catalogs (catalog, Ncatalog); 75 } else { 76 dvo_image_update (&db, VERBOSE); 77 dvo_image_unlock (&db); 78 } 74 79 75 80 exit (0); -
trunk/Ohana/src/relastro/src/reload_catalogs.c
r8390 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 void reload_catalogs (SkyList *skylist) { … … 38 38 initImageBins (&catalog, 1); 39 39 initMosaicBins (&catalog, 1); 40 initGridBins (&catalog, 1);41 40 42 41 findImages (&catalog, 1); 43 42 findMosaics (&catalog, 1); 44 43 45 setMrelFinal (&catalog);46 44 dvo_catalog_save (&catalog, VERBOSE); 47 45 dvo_catalog_unlock (&catalog); … … 50 48 freeImageBins (1); 51 49 freeMosaicBins (1); 52 freeGridBins (1);53 50 } 54 51 } -
trunk/Ohana/src/relastro/src/select_images.c
r8390 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 /* this function returns a list of all images which overlap the given SkyList (set of … … 17 17 Image *image; 18 18 int i, j, k, m, found, nimage, NIMAGE; 19 int InRange , ecode;19 int InRange; 20 20 double Ri[5], Di[5], Xi[5], Yi[5], dx, dy; 21 21 int *line_number; … … 75 75 for (i = 0; i < Ntimage; i++) { 76 76 77 /* exclude images by photcode */ 78 ecode = GetPhotcodeEquivCodebyCode (timage[i].source); 79 if (ecode != photcode[0].code) continue; 77 /* exclude images by photcode, if selected */ 78 if (Nphotcodes > 0) { 79 found = FALSE; 80 for (j = 0; (j < Nphotcodes) && !found; j++) { 81 if (photcodes[j][0].code == timage[i].photcode) found = TRUE; 82 } 83 if (!found) continue; 84 } 80 85 81 86 /* exclude images by time */ … … 135 140 if (RESET) { 136 141 assignMcal (&image[nimage], (double *) NULL, -1); 137 image[nimage].dMcal _PS= NO_MAG;142 image[nimage].dMcal = NO_MAG; 138 143 image[nimage].code &= ~ID_IMAGE_POOR; 139 144 } -
trunk/Ohana/src/relastro/src/setExclusions.c
r6808 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 /* XXX I think all of these, except for X,Y selection, are done / can be done in bcatalog */ 3 4 int setExclusions (Catalog *catalog, int Ncatalog) { 4 5 5 int i, j, k, m, Narea, Nnocal , ecode;6 int i, j, k, m, Narea, Nnocal; 6 7 Coords *coords; 7 8 double r, d, x, y; … … 14 15 15 16 /* select measurements by photcode */ 16 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[m].source); 17 if (ecode != photcode[0].code) goto mark_nocal; 17 // XXXX is this done when loaded, or is it needed for reload? 18 // ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[m].photcode); 19 // if (ecode != photcode[0].code) goto mark_nocal; 18 20 19 21 /* select measurements by time */ … … 25 27 /* select measurements by mag limit */ 26 28 if (AreaSelect) { 27 r = catalog[i].average[j].R + catalog[i].measure[m].dR _PS/ 3600.0;28 d = catalog[i].average[j].D + catalog[i].measure[m].dD _PS/ 3600.0;29 r = catalog[i].average[j].R + catalog[i].measure[m].dR / 3600.0; 30 d = catalog[i].average[j].D + catalog[i].measure[m].dD / 3600.0; 29 31 if ((coords = getCoords (m, i)) == NULL) goto markbad; 30 32 RD_to_XY (&x, &y, r, d, coords); -
trunk/Ohana/src/relastro/src/setMrelFinal.c
r6808 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 void setMrelFinal (Catalog *catalog) { … … 11 11 12 12 for (i = 0; i < catalog[0].Naverage; i++) { 13 p = (PhotPrimary) ? &catalog[0].average[i].M : &catalog[0].secfilt[PhotNsec*i+PhotSec].M _PS;13 p = (PhotPrimary) ? &catalog[0].average[i].M : &catalog[0].secfilt[PhotNsec*i+PhotSec].M; 14 14 *p = NO_MAG; 15 p = (PhotPrimary) ? &catalog[0].average[i].dM : &catalog[0].secfilt[PhotNsec*i+PhotSec].dM _PS;15 p = (PhotPrimary) ? &catalog[0].average[i].dM : &catalog[0].secfilt[PhotNsec*i+PhotSec].dM; 16 16 *p = NO_MAG; 17 17 q = (PhotPrimary) ? &catalog[0].average[i].Xm : &catalog[0].secfilt[PhotNsec*i+PhotSec].Xm; … … 22 22 23 23 /* select measurements by photcode */ 24 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m]. source);24 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].photcode); 25 25 if (ecode != photcode[0].code) continue; 26 26 … … 31 31 } 32 32 33 catalog[0].measure[m].Mcal _PS= 0;33 catalog[0].measure[m].Mcal = 0; 34 34 catalog[0].measure[m].flags &= 0xff00; 35 35 catalog[0].measure[m].flags &= ~ID_MEAS_POOR; … … 97 97 /** never use these measurements (wrong photcode, bad time range) */ 98 98 /* skipped via NOCAL, don't mark as skipped */ 99 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m]. source);99 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].photcode); 100 100 if (ecode != photcode[0].code) continue; 101 101 -
trunk/Ohana/src/relastro/src/sort.c
r8390 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 void sortA (double *X, int N) { -
trunk/Ohana/src/relastro/src/write_coords.c
r7080 r12332 1 # include "rel phot.h"1 # include "relastro.h" 2 2 3 3 # define CD_COORDS 1 -
trunk/Ohana/src/relphot/include/relphot.h
r10506 r12332 84 84 85 85 PhotCode *photcode; 86 int PhotPrimary;87 86 int PhotNsec; 88 87 int PhotSec; -
trunk/Ohana/src/relphot/src/ConfigInit.c
r7080 r12332 5 5 double ZERO_POINT; 6 6 char *config, *file; 7 char PhotCodeFile[256]; 7 char CatdirPhotcodeFile[256]; 8 char MasterPhotcodeFile[256]; 8 9 9 10 /*** load configuration info ***/ … … 32 33 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 33 34 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 35 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 36 34 37 sprintf (ImageCat, "%s/Images.dat", CATDIR); 35 38 … … 41 44 } 42 45 43 GetConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);44 46 GetConfig (config, "ZERO_PT", "%lf", 0, &ZERO_POINT); 45 47 … … 52 54 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 53 55 54 if (!LoadPhotcodes (PhotCodeFile)) { 55 fprintf (stderr, "error loading photcodes\n"); 56 /* XXX this does not yet write out the master photcode table */ 57 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 58 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 59 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 56 60 exit (1); 57 61 } -
trunk/Ohana/src/relphot/src/GridOps.c
r9633 r12332 282 282 Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]); 283 283 list[N] = Msys - Mrel - Mcal - Mmos; 284 dlist[N] = MAX (catalog[c].measure[m].dM _PS, MIN_ERROR);284 dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR); 285 285 N++; 286 286 } … … 447 447 for (i = 0; i < Nimage; i++) { 448 448 image = getimage (imlist[i]); 449 pname = GetPhotcodeNamebyCode (image[0]. source);449 pname = GetPhotcodeNamebyCode (image[0].photcode); 450 450 451 451 /* this is kind of bogus... */ -
trunk/Ohana/src/relphot/src/ImageOps.c
r9633 r12332 75 75 for (i = 0; i < Ncatalog; i++) { 76 76 for (j = 0; j < catalog[i].Nmeasure; j++) { 77 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j]. source);77 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].photcode); 78 78 if (photcode[0].code != ecode) continue; 79 79 matchImage (catalog, j, i); … … 82 82 } 83 83 84 /* XXX convert this to use the values of measure->Xccd,Yccd */ 85 /* XXX need to apply the conversion for ELIXIR and LONEOS formats */ 84 86 void matchImage (Catalog *catalog, int meas, int cat) { 85 87 … … 91 93 measure = &catalog[cat].measure[meas]; 92 94 for (i = 0; i < Nimage; i++) { 93 if (image[0]. source == -1) continue;94 if (measure[0]. source != image[i].source) continue;95 if (image[0].photcode == -1) continue; 96 if (measure[0].photcode != image[i].photcode) continue; 95 97 if (measure[0].t < start[i]) continue; 96 98 if (measure[0].t > stop[i]) continue; … … 100 102 101 103 /* identify the ccd on the basis of the photcode name */ 102 pname = GetPhotcodeNamebyCode (image[i]. source);104 pname = GetPhotcodeNamebyCode (image[i].photcode); 103 105 filter = photcode[0].name; 104 106 sprintf (base, "%s.%s.", MOSAICNAME, filter); … … 111 113 /* add this measurement to the grid cell for this chip */ 112 114 ave = measure[0].averef; 113 ra = catalog[cat].average[ave].R - measure[0].dR _PS/ 3600.0;114 dec = catalog[cat].average[ave].D - measure[0].dD _PS/ 3600.0;115 ra = catalog[cat].average[ave].R - measure[0].dR / 3600.0; 116 dec = catalog[cat].average[ave].D - measure[0].dD / 3600.0; 115 117 116 118 /* X,Y always positive-definite in range 0,0 - dX, dY */ … … 133 135 return; 134 136 } 135 /* fprintf (stderr, "can't find source image for this measurement: %d (%d)\n", measure[0].t, measure[0]. source); */137 /* fprintf (stderr, "can't find source image for this measurement: %d (%d)\n", measure[0].t, measure[0].photcode); */ 136 138 } 137 139 … … 145 147 146 148 if (image[i].code & IMAGE_BAD) return (NO_MAG); 147 value = image[i].Mcal _PS;149 value = image[i].Mcal; 148 150 return (value); 149 151 } … … 203 205 Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]); 204 206 list[N] = Msys - Mrel - Mmos - Mgrid; 205 dlist[N] = MAX (catalog[c].measure[m].dM _PS, MIN_ERROR);207 dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR); 206 208 N++; 207 209 } … … 219 221 220 222 liststats (list, dlist, N, &stats); 221 image[i].Mcal _PS= stats.mean;222 image[i].dMcal _PS= stats.sigma;223 image[i].Mcal = stats.mean; 224 image[i].dMcal = stats.sigma; 223 225 image[i].Xm = 100.0*log10(stats.chisq); 224 226 } … … 251 253 for (i = N = 0; i < Nimage; i++) { 252 254 if (image[i].code & IMAGE_BAD) continue; 253 mlist[N] = fabs (image[i].Mcal _PS);254 slist[N] = image[i].dMcal _PS;255 mlist[N] = fabs (image[i].Mcal); 256 slist[N] = image[i].dMcal; 255 257 dlist[N] = 1; 256 258 N++; … … 268 270 mark = FALSE; 269 271 image[i].code &= ~ID_IMAGE_POOR; 270 mark = (image[i].dMcal _PS > MaxScatter) || (fabs(image[i].Mcal_PS- MedOffset) > MaxOffset);272 mark = (image[i].dMcal > MaxScatter) || (fabs(image[i].Mcal - MedOffset) > MaxOffset); 271 273 if (mark) { 272 274 Nmark ++; … … 298 300 /**** dMcal vs airmass ****/ 299 301 for (i = 0; i < Nimage; i++) { 300 Mlist[i] = image[i].Mcal _PS;301 dlist[i] = image[i].dMcal _PS;302 xlist[i] = image[i].secz _PS;302 Mlist[i] = image[i].Mcal; 303 dlist[i] = image[i].dMcal; 304 xlist[i] = image[i].secz; 303 305 } 304 306 … … 318 320 bzero (Mlist, NBIN*sizeof(double)); 319 321 for (i = 0; i < Nimage; i++) { 320 bin = image[i].dMcal _PS/ 0.00025;322 bin = image[i].dMcal / 0.00025; 321 323 bin = MAX (0, MIN (NBIN - 1, bin)); 322 324 Mlist[bin] += 1.0; … … 420 422 if (image[i].code & IMAGE_BAD) continue; 421 423 422 list[n] = image[i].Mcal _PS;424 list[n] = image[i].Mcal; 423 425 dlist[n] = 1; 424 426 n++; … … 448 450 if (image[i].code & IMAGE_BAD) continue; 449 451 450 list[n] = image[i].dMcal _PS;452 list[n] = image[i].dMcal; 451 453 dlist[n] = 1; 452 454 n++; -
trunk/Ohana/src/relphot/src/MosaicOps.c
r9633 r12332 36 36 37 37 /* select valid mosaic images by photcode */ 38 pname = GetPhotcodeNamebyCode (image[i]. source);38 pname = GetPhotcodeNamebyCode (image[i].photcode); 39 39 status = strncmp (pname, MOSAICNAME, strlen (MOSAICNAME)); 40 40 if (status) continue; … … 69 69 mosaic[Nmosaic].Xm = 0.0; 70 70 mosaic[Nmosaic].code = image[i].code; 71 mosaic[Nmosaic].secz = image[i].secz _PS;71 mosaic[Nmosaic].secz = image[i].secz; 72 72 73 73 /* add image to mosaic image list */ … … 134 134 Dmin = MIN (Dmin, D); 135 135 Dmax = MAX (Dmax, D); 136 Mcal += image[m].Mcal _PS;137 dMcal += image[m].dMcal _PS;136 Mcal += image[m].Mcal; 137 dMcal += image[m].dMcal; 138 138 Xm += image[m].Xm; 139 139 /* we are using mosaic.Mcal, not image.Mcal. reset image.Mcal */ 140 image[m].Mcal _PS= 0.0;141 image[m].dMcal _PS= image[m].Xm = NO_MAG;140 image[m].Mcal = 0.0; 141 image[m].dMcal = image[m].Xm = NO_MAG; 142 142 } 143 143 dS /= Nimlist[i]; … … 179 179 for (j = 0; j < Nimlist[i]; j++) { 180 180 im = imlist[i][j]; 181 image[im].Mcal _PS= mosaic[i].Mcal;182 image[im].dMcal _PS= mosaic[i].dMcal;181 image[im].Mcal = mosaic[i].Mcal; 182 image[im].dMcal = mosaic[i].dMcal; 183 183 image[im].Xm = mosaic[i].Xm; 184 184 image[im].code |= (mosaic[i].code & ID_IMAGE_FEW); … … 247 247 if (catalog[i].measure[j].t > TSTOP) continue; 248 248 } 249 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j]. source);249 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].photcode); 250 250 if (photcode[0].code != ecode) continue; 251 251 matchMosaics (catalog, j, i); … … 266 266 if (USE_GRID) { 267 267 ave = catalog[cat].measure[meas].averef; 268 ra = catalog[cat].average[ave].R _PS - catalog[cat].measure[meas].dR_PS/ 3600.0;269 dec = catalog[cat].average[ave].D _PS - catalog[cat].measure[meas].dD_PS/ 3600.0;268 ra = catalog[cat].average[ave].R - catalog[cat].measure[meas].dR / 3600.0; 269 dec = catalog[cat].average[ave].D - catalog[cat].measure[meas].dD / 3600.0; 270 270 271 271 /* X,Y always positive-definite in range 0,0 - dX, dY */ … … 355 355 Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]); 356 356 list[N] = Msys - Mrel - Mcal - Mgrid; 357 dlist[N] = MAX (catalog[c].measure[m].dM _PS, MIN_ERROR);357 dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR); 358 358 Mlist[N] = Msys; 359 359 dMlist[N] = list[N]; … … 596 596 597 597 ave = catalog[c].measure[m].averef; 598 xlist[N] = catalog[c].average[ave].R - catalog[c].measure[m].dR _PS/ 3600.0;599 ylist[N] = catalog[c].average[ave].D - catalog[c].measure[m].dD _PS/ 3600.0;598 xlist[N] = catalog[c].average[ave].R - catalog[c].measure[m].dR / 3600.0; 599 ylist[N] = catalog[c].average[ave].D - catalog[c].measure[m].dD / 3600.0; 600 600 N++; 601 601 } -
trunk/Ohana/src/relphot/src/StarOps.c
r10506 r12332 28 28 if (catalog[cat].average[ave].code & STAR_BAD) return (NO_MAG); 29 29 30 value = PhotPrimary ? catalog[cat].average[ave].M : catalog[cat].secfilt[PhotNsec*ave+PhotSec].M_PS;30 value = catalog[cat].secfilt[PhotNsec*ave+PhotSec].M; 31 31 return (value); 32 32 } … … 65 65 Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 66 66 list[N] = Msys - Mcal - Mmos - Mgrid; 67 dlist[N] = MAX (catalog[i].measure[m].dM _PS, MIN_ERROR);67 dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 68 68 N++; 69 69 } … … 76 76 liststats (list, dlist, N, &stats); 77 77 78 if (PhotPrimary) { 79 catalog[i].average[j].M = stats.mean; 80 catalog[i].average[j].dM = stats.sigma; 81 catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 82 } else { 83 catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS = stats.mean; 84 catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS = stats.sigma; 85 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 86 } 78 catalog[i].secfilt[PhotNsec*j+PhotSec].M = stats.mean; 79 catalog[i].secfilt[PhotNsec*j+PhotSec].dM = stats.sigma; 80 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 87 81 } 88 82 } … … 130 124 Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 131 125 list[N] = Msys - Mcal - Mmos - Mgrid; 132 dlist[N] = MAX (catalog[i].measure[m].dM _PS, MIN_ERROR);126 dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 133 127 N++; 134 128 } … … 139 133 140 134 /* use sigma or error in dM for output? */ 141 if (PhotPrimary) { 142 catalog[i].average[j].M = stats.mean; 143 catalog[i].average[j].dM = MAX (stats.sigma, stats.error); 144 catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 145 } else { 146 catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS = stats.mean; 147 catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS = MAX (stats.error, stats.sigma); 148 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 149 } 135 catalog[i].secfilt[PhotNsec*j+PhotSec].M = stats.mean; 136 catalog[i].secfilt[PhotNsec*j+PhotSec].dM = MAX (stats.error, stats.sigma); 137 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG; 150 138 } 151 139 } … … 178 166 if (Mmos == NO_IMAGE) continue; 179 167 if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue; 180 catalog[i].measure[m].Mcal _PS= Mcal + Mmos + Mgrid;168 catalog[i].measure[m].Mcal = Mcal + Mmos + Mgrid; 181 169 } 182 170 } … … 205 193 for (j = 0; j < catalog[i].Naverage; j++) { 206 194 if (catalog[i].average[j].code & STAR_BAD) continue; 207 Xm = PhotPrimary ? catalog[i].average[j].Xm :catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;195 Xm = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm; 208 196 if (Xm == -1) continue; 209 197 Chisq = pow (10.0, 0.01*Xm); 210 198 xlist[Ntot] = Chisq; 211 slist[Ntot] = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;199 slist[Ntot] = catalog[i].secfilt[PhotNsec*j+PhotSec].dM; 212 200 dlist[Ntot] = 1; 213 201 Ntot ++; … … 225 213 for (i = 0; i < Ncatalog; i++) { 226 214 for (j = 0; j < catalog[i].Naverage; j++) { 227 dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;228 Xm = PhotPrimary ? catalog[i].average[j].Xm :catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;215 dM = catalog[i].secfilt[PhotNsec*j+PhotSec].dM; 216 Xm = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm; 229 217 Chisq = pow (10.0, 0.01*Xm); 230 218 mark = (dM > MaxScatter) || (Xm == NO_MAG) || (Chisq > MaxChisq); … … 295 283 Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 296 284 list[N] = Msys - Mcal - Mmos - Mgrid; 297 dlist[N] = MAX (catalog[i].measure[m].dM _PS, MIN_ERROR);285 dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 298 286 N++; 299 287 } … … 331 319 Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 332 320 list[N] = Msys - Mcal - Mmos - Mgrid; 333 dlist[N] = MAX (catalog[i].measure[m].dM _PS, MIN_ERROR);321 dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 334 322 ilist[N] = m; 335 323 N++; … … 422 410 if (catalog[i].average[j].code & STAR_BAD) continue; 423 411 424 Xm = PhotPrimary ? catalog[i].average[j].Xm :catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;412 Xm = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm; 425 413 if (Xm == NO_MAG) continue; 426 414 list[n] = pow (10.0, 0.01*Xm); … … 458 446 if (catalog[i].average[j].code & STAR_BAD) continue; 459 447 460 dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;448 dM = catalog[i].secfilt[PhotNsec*j+PhotSec].dM; 461 449 list[n] = dM; 462 450 dlist[n] = 1; … … 487 475 for (j = 0; j < catalog[i].Naverage; j++) { 488 476 if (catalog[i].average[j].code & STAR_BAD) continue; 489 dMrel = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;477 dMrel = catalog[i].secfilt[PhotNsec*j+PhotSec].dM; 490 478 bin = dMrel / 0.00025; 491 479 bin = MAX (0, MIN (NBIN-1, bin)); … … 518 506 for (j = 0; j < catalog[i].Naverage; j++) { 519 507 if (catalog[i].average[j].code & STAR_BAD) continue; 520 xlist[N] = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;521 value = PhotPrimary ? catalog[i].average[j].Xm :catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;508 xlist[N] = catalog[i].secfilt[PhotNsec*j+PhotSec].M; 509 value = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm; 522 510 if (value == NO_MAG) continue; 523 511 ylist[N] = 0.01*value; -
trunk/Ohana/src/relphot/src/bcatalog.c
r11062 r12332 27 27 28 28 if (RESET) { 29 float *p; 30 p = (PhotPrimary) ? &subcatalog[0].average[Naverage].M : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M_PS; 31 *p = NO_MAG; 32 p = (PhotPrimary) ? &subcatalog[0].average[Naverage].dM : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM_PS; 33 *p = NO_MAG; 29 subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M = NO_MAG; 30 subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM = NO_MAG; 34 31 subcatalog[0].average[Naverage].code &= ~ID_STAR_FEW; 35 32 subcatalog[0].average[Naverage].code &= ~ID_STAR_POOR; … … 42 39 43 40 /* select measurements by photcode */ 44 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset]. source);41 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset].photcode); 45 42 if (ecode != photcode[0].code) continue; 46 43 … … 60 57 61 58 /* select measurements by measurement error */ 62 if ((SIGMA_LIM > 0) && (catalog[0].measure[offset].dM _PS> SIGMA_LIM)) continue;59 if ((SIGMA_LIM > 0) && (catalog[0].measure[offset].dM > SIGMA_LIM)) continue; 63 60 64 61 /* select measurements by mag limit */ … … 73 70 subcatalog[0].measure[Nmeasure].averef = Naverage; 74 71 if (RESET) { 75 subcatalog[0].measure[Nmeasure].Mcal _PS= 0;72 subcatalog[0].measure[Nmeasure].Mcal = 0; 76 73 subcatalog[0].measure[Nmeasure].flags &= 0xff00; 77 74 subcatalog[0].measure[Nmeasure].flags &= ~ID_MEAS_POOR; -
trunk/Ohana/src/relphot/src/initialize.c
r7080 r12332 13 13 exit (1); 14 14 } 15 if ( (photcode[0].type != PHOT_PRI) && (photcode[0].type != PHOT_SEC)) {15 if (photcode[0].type != PHOT_SEC) { 16 16 fprintf (stderr, "photcode %s is not a primary or secondary filter\n", argv[N]); 17 17 exit (1); 18 18 } 19 19 20 PhotPrimary = (photcode[0].type == PHOT_PRI);21 20 PhotNsec = GetPhotcodeNsecfilt (); 22 21 PhotSec = GetPhotcodeNsec (photcode[0].code); -
trunk/Ohana/src/relphot/src/plot_scatter.c
r9633 r12332 36 36 if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue; 37 37 38 Mrel = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;38 Mrel = catalog[i].secfilt[PhotNsec*j+PhotSec].M; 39 39 xlist[N] = Mrel; 40 40 ylist[N] = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]) - Mcal - Mmos - Mgrid - Mrel; -
trunk/Ohana/src/relphot/src/relphot.c
r10506 r12332 44 44 /* load catalog data from region files */ 45 45 catalog = load_catalogs (skylist, &Ncatalog); 46 47 /* add in a loop over the catalogs calling dvo_catalog_chipcoords */ 46 48 47 49 /* match measurements with images, mosaics */ -
trunk/Ohana/src/relphot/src/select_images.c
r7082 r12332 76 76 77 77 /* exclude images by photcode */ 78 ecode = GetPhotcodeEquivCodebyCode (timage[i]. source);78 ecode = GetPhotcodeEquivCodebyCode (timage[i].photcode); 79 79 if (ecode != photcode[0].code) continue; 80 80 … … 135 135 if (RESET) { 136 136 assignMcal (&image[nimage], (double *) NULL, -1); 137 image[nimage].dMcal _PS= NO_MAG;137 image[nimage].dMcal = NO_MAG; 138 138 image[nimage].code &= ~ID_IMAGE_POOR; 139 139 } -
trunk/Ohana/src/relphot/src/setExclusions.c
r6683 r12332 3 3 int setExclusions (Catalog *catalog, int Ncatalog) { 4 4 5 int i, j, k, m, Narea, Nnocal, ecode;5 int i, j, k, m, Narea, Nnocal, Ngood, ecode; 6 6 Coords *coords; 7 7 double r, d, x, y; 8 8 9 N nocal = Narea = 0;9 Ngood = Nnocal = Narea = 0; 10 10 for (i = 0; i < Ncatalog; i++) { 11 11 for (j = 0; j < catalog[i].Naverage; j++) { … … 14 14 15 15 /* select measurements by photcode */ 16 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[m]. source);16 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[m].photcode); 17 17 if (ecode != photcode[0].code) goto mark_nocal; 18 18 … … 25 25 /* select measurements by mag limit */ 26 26 if (AreaSelect) { 27 r = catalog[i].average[j].R + catalog[i].measure[m].dR _PS/ 3600.0;28 d = catalog[i].average[j].D + catalog[i].measure[m].dD _PS/ 3600.0;27 r = catalog[i].average[j].R + catalog[i].measure[m].dR / 3600.0; 28 d = catalog[i].average[j].D + catalog[i].measure[m].dD / 3600.0; 29 29 if ((coords = getCoords (m, i)) == NULL) goto markbad; 30 30 RD_to_XY (&x, &y, r, d, coords); … … 34 34 if (y > AreaYmax) goto markbad; 35 35 } 36 Ngood ++; 36 37 continue; 37 38 … … 50 51 if (VERBOSE) fprintf (stderr, "%d measurements marked by area\n", Narea); 51 52 if (VERBOSE) fprintf (stderr, "%d measurements marked nocal\n", Nnocal); 53 if (VERBOSE) fprintf (stderr, "%d measurements kept for analysis\n", Ngood); 52 54 return (TRUE); 53 55 } -
trunk/Ohana/src/relphot/src/setMrelFinal.c
r10506 r12332 4 4 5 5 int i, j, m, ecode; 6 float *p;7 short *q;8 6 9 7 /* if we reset the catalog, reset all the current measurements */ … … 11 9 12 10 for (i = 0; i < catalog[0].Naverage; i++) { 13 p = (PhotPrimary) ? &catalog[0].average[i].M : &catalog[0].secfilt[PhotNsec*i+PhotSec].M_PS; 14 *p = NO_MAG; 15 p = (PhotPrimary) ? &catalog[0].average[i].dM : &catalog[0].secfilt[PhotNsec*i+PhotSec].dM_PS; 16 *p = NO_MAG; 17 q = (PhotPrimary) ? &catalog[0].average[i].Xm : &catalog[0].secfilt[PhotNsec*i+PhotSec].Xm; 18 *q = NO_MAG; 11 catalog[0].secfilt[PhotNsec*i+PhotSec].M = NO_MAG; 12 catalog[0].secfilt[PhotNsec*i+PhotSec].dM = NO_MAG; 13 catalog[0].secfilt[PhotNsec*i+PhotSec].Xm = NO_MAG; 19 14 20 15 m = catalog[0].average[i].offset; … … 22 17 23 18 /* select measurements by photcode */ 24 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m]. source);19 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].photcode); 25 20 if (ecode != photcode[0].code) continue; 26 21 … … 31 26 } 32 27 33 catalog[0].measure[m].Mcal _PS= 0;28 catalog[0].measure[m].Mcal = 0; 34 29 catalog[0].measure[m].flags &= 0xff00; 35 30 catalog[0].measure[m].flags &= ~ID_MEAS_POOR; … … 97 92 /** never use these measurements (wrong photcode, bad time range) */ 98 93 /* skipped via NOCAL, don't mark as skipped */ 99 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m]. source);94 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].photcode); 100 95 if (ecode != photcode[0].code) continue; 101 96 -
trunk/Ohana/src/uniphot/src/ConfigInit.c
r6684 r12332 5 5 double ZERO_POINT; 6 6 char *config, *file; 7 char PhotCodeFile[256]; 7 char CatdirPhotcodeFile[256]; 8 char MasterPhotcodeFile[256]; 8 9 9 10 /*** load configuration info ***/ … … 20 21 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 21 22 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 23 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 24 22 25 sprintf (ImageCat, "%s/Images.dat", CATDIR); 23 26 24 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);25 27 ScanConfig (config, "ZERO_PT", "%lf", 0, &ZERO_POINT); 26 28 SetZeroPoint (ZERO_POINT); … … 32 34 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 33 35 34 if (!LoadPhotcodes (PhotCodeFile)) { 35 fprintf (stderr, "error loading photcodes\n"); 36 exit (0); 36 /* XXX this does not yet write out the master photcode table */ 37 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 38 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 39 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 40 exit (1); 37 41 } 38 42 -
trunk/Ohana/src/uniphot/src/fit_groups.c
r5014 r12332 18 18 if (tgroup[i].image[j][0].code & IMAGE_BAD) continue; 19 19 sgroup = (Group *) tgroup[i].imlink[j][0].sgroup; 20 Mcal = tgroup[i].image[j][0].Mcal _PS;20 Mcal = tgroup[i].image[j][0].Mcal; 21 21 Mgrp = sgroup[0].M; 22 22 mlist[Nlist] = (Mcal - Mgrp); 23 dlist[Nlist] = tgroup[i].image[j][0].dMcal _PS;23 dlist[Nlist] = tgroup[i].image[j][0].dMcal; 24 24 Nlist ++; 25 25 } … … 56 56 if (sgroup[i].image[j][0].code & IMAGE_BAD) continue; 57 57 tgroup = (Group *) sgroup[i].imlink[j][0].tgroup; 58 Mcal = sgroup[i].image[j][0].Mcal _PS;58 Mcal = sgroup[i].image[j][0].Mcal; 59 59 Mgrp = tgroup[0].M; 60 60 mlist[Nlist] = (Mcal - Mgrp); 61 dlist[Nlist] = sgroup[i].image[j][0].dMcal _PS;61 dlist[Nlist] = sgroup[i].image[j][0].dMcal; 62 62 Nlist ++; 63 63 } -
trunk/Ohana/src/uniphot/src/subset_images.c
r7080 r12332 19 19 20 20 /* select images by photcode */ 21 equiv = GetPhotcodeEquivCodebyCode (image[i]. source);21 equiv = GetPhotcodeEquivCodebyCode (image[i].photcode); 22 22 if (equiv != photcode[0].code) continue; 23 23 -
trunk/Ohana/src/uniphot/src/update.c
r8388 r12332 22 22 for (i = 0; i < Nsgroup; i++) { 23 23 for (j = 0; j < sgroup[i].Nimage; j++) { 24 sgroup[i].image[j][0].Mcal _PS-= sgroup[i].M;24 sgroup[i].image[j][0].Mcal -= sgroup[i].M; 25 25 } 26 26 } -
trunk/Ohana/src/uniphot/src/update_catalog.c
r6683 r12332 4 4 5 5 int i, j, m, found; 6 int Primary, Nsec, Nsecfilt; 7 float *Mp; 6 int Nsec, Nsecfilt; 8 7 PhotCode *code; 9 8 10 Primary = (photcode[0].type == PHOT_PRI);11 9 Nsec = GetPhotcodeNsec (photcode[0].code); 12 10 Nsecfilt = GetPhotcodeNsecfilt (); … … 15 13 for (i = 0; i < catalog[0].Naverage; i++) { 16 14 17 Mp = Primary ? &catalog[0].average[i].M : &catalog[0].secfilt[i*Nsecfilt+Nsec].M_PS; 18 if (*Mp != NO_MAG) *Mp += sgroup[0].M; 15 if (catalog[0].secfilt[i*Nsecfilt+Nsec].M != NO_MAG) { 16 catalog[0].secfilt[i*Nsecfilt+Nsec].M += sgroup[0].M; 17 } 19 18 20 19 m = catalog[0].average[i].offset; 21 20 for (j = 0; j < catalog[0].average[i].Nm; j++, m++) { 22 code = GetPhotcodebyCode (catalog[0].measure[m]. source);21 code = GetPhotcodebyCode (catalog[0].measure[m].photcode); 23 22 if (code == NULL) continue; 24 23 if (code[0].type != PHOT_DEP) continue; 25 24 if (code[0].equiv != photcode[0].code) continue; 26 catalog[0].measure[m].Mcal _PS-= sgroup[0].M;25 catalog[0].measure[m].Mcal -= sgroup[0].M; 27 26 found ++; 28 27 }
Note:
See TracChangeset
for help on using the changeset viewer.
