Changeset 38062
- Timestamp:
- Mar 29, 2015, 6:52:41 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 108 edited
- 10 copied
-
. (modified) (1 prop)
-
DataStoreServer/scripts/dsreg (modified) (1 prop)
-
Nebulous/bin/neb-rm (modified) (1 prop)
-
Ohana (modified) (1 prop)
-
Ohana/src/addstar/include/WISE.h (modified) (1 diff)
-
Ohana/src/addstar/src/args_loadwise.c (modified) (1 diff)
-
Ohana/src/addstar/src/loadwise_rawdata.c (modified) (2 diffs)
-
Ohana/src/addstar/src/loadwise_star_full.c (modified) (8 diffs)
-
Ohana/src/dvomerge/src/args.c (modified) (1 diff)
-
Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c (modified) (1 diff)
-
Ohana/src/getstar (modified) (1 prop)
-
Ohana/src/kapa2/src/DrawObjects.c (modified) (9 diffs)
-
Ohana/src/kapa2/src/InterpretKeys.c (modified) (1 diff)
-
Ohana/src/kapa2/src/PSObjects.c (modified) (13 diffs)
-
Ohana/src/kapa2/src/bDrawObjects.c (modified) (13 diffs)
-
Ohana/src/libautocode/def/measure-ps1-v5.d (modified) (2 diffs)
-
Ohana/src/libautocode/def/measure.d (modified) (2 diffs)
-
Ohana/src/libdvo/include/dvo.h (modified) (1 diff)
-
Ohana/src/libdvo/include/dvodb.h (modified) (5 diffs)
-
Ohana/src/libdvo/src/dbExtractAverages.c (modified) (6 diffs)
-
Ohana/src/libdvo/src/dbExtractMeasures.c (modified) (1 diff)
-
Ohana/src/libdvo/src/dbFields.c (modified) (1 diff)
-
Ohana/src/libdvo/src/dvo_catalog.c (modified) (1 diff)
-
Ohana/src/libdvo/src/dvo_convert.c (modified) (1 diff)
-
Ohana/src/libdvo/src/dvo_convert_PS1_V5.c (modified) (5 diffs)
-
Ohana/src/libdvo/src/dvo_tiny_values.c (modified) (2 diffs)
-
Ohana/src/libfits/include/gfitsio.h (modified) (1 diff)
-
Ohana/src/libfits/matrix/F_convert_format.c (modified) (2 diffs)
-
Ohana/src/libfits/matrix/F_create_M.c (modified) (1 diff)
-
Ohana/src/libohana/src/config.c (modified) (1 diff)
-
Ohana/src/libohana/src/findexec.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.astro/Makefile (modified) (1 diff)
-
Ohana/src/opihi/cmd.astro/cdensify.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.astro/cdhistogram.c (copied) (copied from branches/eam_branches/ipp-20150112/Ohana/src/opihi/cmd.astro/cdhistogram.c )
-
Ohana/src/opihi/cmd.astro/init.c (modified) (2 diffs)
-
Ohana/src/opihi/cmd.data/Makefile (modified) (3 diffs)
-
Ohana/src/opihi/cmd.data/init.c (modified) (6 diffs)
-
Ohana/src/opihi/cmd.data/interpolate.c (modified) (3 diffs)
-
Ohana/src/opihi/cmd.data/mcreate.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/mget3d.c (copied) (copied from branches/eam_branches/ipp-20150112/Ohana/src/opihi/cmd.data/mget3d.c )
-
Ohana/src/opihi/cmd.data/rd.c (modified) (10 diffs)
-
Ohana/src/opihi/cmd.data/read_vectors.c (modified) (6 diffs)
-
Ohana/src/opihi/cmd.data/squash3d.c (copied) (copied from branches/eam_branches/ipp-20150112/Ohana/src/opihi/cmd.data/squash3d.c )
-
Ohana/src/opihi/cmd.data/tdhistogram.c (copied) (copied from branches/eam_branches/ipp-20150112/Ohana/src/opihi/cmd.data/tdhistogram.c )
-
Ohana/src/opihi/cmd.data/tv.c (modified) (2 diffs)
-
Ohana/src/opihi/cmd.data/wd.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/zplot.c (modified) (4 diffs)
-
Ohana/src/opihi/doc/BufferMath.txt (copied) (copied from branches/eam_branches/ipp-20150112/Ohana/src/opihi/doc/BufferMath.txt )
-
Ohana/src/opihi/dvo/avextract.c (modified) (1 diff)
-
Ohana/src/opihi/include/dvomath.h (modified) (1 diff)
-
Ohana/src/opihi/lib.shell/BufferOps.c (modified) (1 diff)
-
Ohana/src/opihi/lib.shell/check_stack.c (modified) (2 diffs)
-
Ohana/src/opihi/lib.shell/convert_to_RPN.c (modified) (1 diff)
-
Ohana/src/opihi/lib.shell/evaluate_stack.c (modified) (1 diff)
-
Ohana/src/opihi/lib.shell/stack_math.c (modified) (16 diffs)
-
Ohana/src/opihi/test/ellipse.sh (copied) (copied from branches/eam_branches/ipp-20150112/Ohana/src/opihi/test/ellipse.sh )
-
Ohana/src/photdbc/src/photdbc.c (modified) (1 diff)
-
Ohana/src/photdbc/src/photdbc_client.c (modified) (1 diff)
-
Ohana/src/relastro/Makefile (modified) (1 diff)
-
Ohana/src/relastro/include/relastro.h (modified) (1 diff)
-
Ohana/src/relastro/src/BrightCatalog.c (modified) (6 diffs)
-
Ohana/src/relastro/src/FrameCorrection.c (modified) (1 diff)
-
Ohana/src/relastro/src/ImageOps.c (modified) (1 diff)
-
Ohana/src/relastro/src/MeasPosIO.c (modified) (6 diffs)
-
Ohana/src/relastro/src/UpdateChips.c (modified) (1 diff)
-
Ohana/src/relastro/src/client_logger.c (modified) (1 diff)
-
Ohana/src/relastro/src/load_catalogs.c (modified) (4 diffs)
-
Ohana/src/relastro/src/relastro_parallel_images.c (modified) (8 diffs)
-
Ohana/src/relastro/src/share_images_pos.c (modified) (8 diffs)
-
Ohana/src/relastro/src/share_mean_pos.c (modified) (6 diffs)
-
Ohana/src/relastro/src/share_meas_pos.c (modified) (7 diffs)
-
Ohana/src/relphot/Makefile (modified) (2 diffs)
-
Ohana/src/relphot/include/relphot.h (modified) (4 diffs)
-
Ohana/src/relphot/src/args.c (modified) (4 diffs)
-
Ohana/src/relphot/src/extra.c (modified) (2 diffs)
-
Ohana/src/relphot/src/help.c (modified) (1 diff)
-
Ohana/src/relphot/src/initialize.c (modified) (1 diff)
-
Ohana/src/relphot/src/relphot.c (modified) (1 diff)
-
Ohana/src/relphot/src/relphot_client.c (modified) (1 diff)
-
Ohana/src/relphot/src/relphot_synthphot.c (copied) (copied from branches/eam_branches/ipp-20150112/Ohana/src/relphot/src/relphot_synthphot.c )
-
Ohana/src/relphot/src/relphot_synthphot_catalog.c (copied) (copied from branches/eam_branches/ipp-20150112/Ohana/src/relphot/src/relphot_synthphot_catalog.c )
-
Ohana/src/relphot/src/synthetic_zpts.c (copied) (copied from branches/eam_branches/ipp-20150112/Ohana/src/relphot/src/synthetic_zpts.c )
-
Ohana/src/uniphot/Makefile (modified) (2 diffs)
-
Ohana/src/uniphot/include/setastrom.h (modified) (3 diffs)
-
Ohana/src/uniphot/src/cam_correction.c (copied) (copied from branches/eam_branches/ipp-20150112/Ohana/src/uniphot/src/cam_correction.c )
-
Ohana/src/uniphot/src/initialize_setastrom.c (modified) (6 diffs)
-
Ohana/src/uniphot/src/update_catalog_setastrom.c (modified) (3 diffs)
-
Ohana/src/uniphot/src/update_dvo_setastrom.c (modified) (2 diffs)
-
dvodist (modified) (1 prop)
-
extsrc/gpcsw/gpcsrc/fits/burntool (modified) (1 prop)
-
ippMonitor/czartool/czartool/Plotter.pm (modified) (1 prop)
-
ippScripts/Build.PL (modified) (1 prop)
-
ippScripts/MANIFEST (modified) (1 prop)
-
ippScripts/scripts (modified) (1 prop)
-
ippScripts/scripts/lap_science.pl (modified) (1 prop)
-
ippScripts/scripts/queuestaticsky.pl (modified) (1 prop)
-
ippScripts/scripts/sc_remote_exec.pl (modified) (1 prop)
-
ippTasks/stack.pro (modified) (1 prop)
-
ippTools/share/laptool_exposures.sql (modified) (1 prop)
-
ippTools/src/stacktool.c (modified) (1 prop)
-
ippTools/src/stacktoolConfig.c (modified) (1 prop)
-
ippconfig (modified) (1 prop)
-
ippconfig/gpc1/ppStack.config (modified) (1 prop)
-
ippconfig/gpc1/psastro.config (modified) (1 prop)
-
ippconfig/recipes/ppStack.config (modified) (1 prop)
-
ippconfig/recipes/ppSub.config (modified) (1 prop)
-
ippconfig/recipes/psastro.config (modified) (1 prop)
-
ippconfig/recipes/reductionClasses.mdc (modified) (1 prop)
-
ippconfig/simple/psphot.config (modified) (1 prop)
-
psLib/src/math/psMinimizePolyFit.c (modified) (1 prop)
-
psModules/src/objects (modified) (1 prop)
-
psModules/src/objects/pmSourceIO_CMF.c.in (modified) (1 prop)
-
psphot (modified) (1 prop)
-
pstamp/scripts/pstamp_checkdependent.pl (modified) (1 prop)
-
pstamp/scripts/pstamp_finish.pl (modified) (1 prop)
-
pstamp/scripts/pstamp_job_run.pl (modified) (1 prop)
-
pstamp/scripts/pstampparse.pl (modified) (1 prop)
-
pstamp/scripts/request_finish.pl (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
-
trunk/DataStoreServer/scripts/dsreg
- Property svn:mergeinfo deleted
-
trunk/Nebulous/bin/neb-rm
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/Ohana
- Property svn:mergeinfo deleted
-
trunk/Ohana/src/addstar/include/WISE.h
r37807 r38062 35 35 int getWISE_sortStars (WISE_Stars *tstars, int Ntstars); 36 36 37 int loadwise_star_prelim (Stars **star, char *line, int Nmax); 37 38 int loadwise_star_allsky (Stars **star, char *line, int Nmax); 38 int loadwise_star_ prelim(Stars **star, char *line, int Nmax);39 int loadwise_star_allwise (Stars **star, char *line, int Nmax); 39 40 40 41 -
trunk/Ohana/src/addstar/src/args_loadwise.c
r37807 r38062 53 53 } 54 54 55 enum {MODE_NONE, MODE_ALLWISE, MODE_ALLSKY, MODE_PRELIM};56 int MODE;57 58 55 /* load the prelim data dump */ 59 56 MODE = MODE_ALLWISE; -
trunk/Ohana/src/addstar/src/loadwise_rawdata.c
r37807 r38062 7 7 8 8 /* read in chunks of ~64MB */ 9 # define NBYTE 0x4000000 9 # define NBYTE 0x40000000 10 10 # define DEBUG 0 11 11 … … 167 167 break; 168 168 case MODE_ALLWISE: 169 loadwise_star_allwise (&stars[Nstars], &buffer[offset], Nbyte - offset); 170 break; 169 171 default: 170 // loadwise_star_allwise (&stars[Nstars], &buffer[offset], Nbyte - offset);171 172 break; 172 173 } -
trunk/Ohana/src/addstar/src/loadwise_star_full.c
r37818 r38062 14 14 // RA and DEC have already been set 15 15 int loadwise_star_allwise (Stars **star, char *line, int Nmax) { 16 17 int i; 18 char *ptr; 19 20 if (line == NULL) Shutdown ("format error in WISE"); 21 22 ptr = line; 23 24 // I can assign dRA and dDEC to dX and dY if I can consistently set posangle and pltscale 25 star[0][0].measure.posangle = 0.0; 26 star[0][0].measure.pltscale = 1.0; 27 28 ptr = skipNbounds (ptr, '|', 3, Nmax); // skip: desig, ra, dec, 29 star[0][0].measure.dXccd = ToShortPixels((strtod (ptr, NULL) + 0.005)); // sig_ra -- add 5/1000 to avoid truncation 30 ptr = nextWISEfield (ptr); 31 star[0][0].measure.dYccd = ToShortPixels((strtod (ptr, NULL) + 0.005)); // sig_dec 32 ptr = nextWISEfield (ptr); 33 34 // we only know a single set of values for all 4 bands 35 for (i = 1; i < 4; i++) { 36 star[i][0].measure.dXccd = star[0][0].measure.dXccd; 37 star[i][0].measure.dYccd = star[0][0].measure.dYccd; 38 star[i][0].measure.posangle = star[0][0].measure.posangle; 39 star[i][0].measure.pltscale = star[0][0].measure.pltscale; 40 } 41 ptr = skipNbounds (ptr, '|', 5, Nmax); // skip: sig_radec, glon, glat, elon, elat 42 43 star[0][0].measure.Xccd = strtod (ptr, NULL); // wx 44 ptr = nextWISEfield (ptr); // skip wx 45 star[0][0].measure.Yccd = strtod (ptr, NULL); // wy 46 ptr = nextWISEfield (ptr); // skip wy 47 48 for (i = 1; i < 4; i++) { 49 star[i][0].measure.Xccd = star[0][0].measure.Xccd; 50 star[i][0].measure.Yccd = star[0][0].measure.Yccd; 51 } 52 ptr = skipNbounds (ptr, '|', 4, Nmax); // skip: cntr, source_id, coadd_id, src 53 54 // W1 55 for (i = 0; i < 4; i++) { 56 char *endpoint; 57 star[i][0].measure.M = strtod (ptr, &endpoint); // w?mpro 58 if (endpoint == ptr) { 59 star[i][0].measure.M = NAN; 60 } 61 ptr = nextWISEfield (ptr); 62 star[i][0].measure.dM = strtod (ptr, &endpoint); // w?sigmpro 63 if (endpoint == ptr) { 64 star[i][0].measure.dM = NAN; 65 } 66 ptr = skipNbounds (ptr, '|', 2, Nmax); // skip: w?sigmpro, w?snr 67 star[i][0].measure.psfChisq = strtod (ptr, NULL); // w?rchi2 68 star[i][0].measure.psfQF = strtod (ptr, NULL); // w?rchi2 69 ptr = nextWISEfield (ptr); // skip : w1rchi2 70 71 // init the photFlags field 72 star[i][0].measure.photFlags = 0; 73 } 74 75 ptr = nextWISEfield (ptr); // skip: rchi2 76 77 // set blend flags for all 4 measures 78 setWISE_blend_flag (star, ptr); // nb & na both used here 79 ptr = skipNbounds (ptr, '|', 2, Nmax); // skip: nb, na 80 81 for (i = 0; i < 4; i++) { 82 setWISE_sat_flag (star[i], ptr); // w1sat 83 ptr = nextWISEfield (ptr); 84 } 85 ptr = nextWISEfield (ptr); // skip satnum 86 87 ptr = skipNbounds (ptr, '|', 15, Nmax); // skip pm info 88 89 for (i = 0; i < 4; i++) { 90 setWISE_cc_flag (star[i], ptr[i]); // cc_flags 91 } 92 ptr = nextWISEfield (ptr); // skip cc_flags 93 ptr = nextWISEfield (ptr); // skip rel 94 95 // set ext flags for all 4 measures 96 setWISE_ext_flag_allsky (star, ptr[0]); // ext_flg 97 ptr = nextWISEfield (ptr); // skip ext_flags 98 99 for (i = 0; i < 4; i++) { 100 setWISE_var_flag_allsky (star[i], ptr[i]); // var_flg 101 } 102 ptr = nextWISEfield (ptr); // skip var_flags 103 104 for (i = 0; i < 4; i++) { 105 setWISE_ph_qual (star[i], ptr[i]); // ph_qual 106 } 107 108 ptr = skipNbounds (ptr, '|', 157, Nmax); // skip: det_bit, moon_lev, w?nm, w?m, w?cov, etc, etc. 109 // w?frtr dropped, (-4), use_src, best_use_cntr, ngrp added (+3), w?dmag dropped, w?k added, 110 111 for (i = 0; i < 4; i++) { 112 ptr = skipNbounds (ptr, '|', 8, Nmax); // skip: w?magp, w?sigp1,2, w?dmag, w?ndf, w?m1q, w?mjdmin, w?mjdmax 113 // w?magp is at 217, ph_qual is at 60 114 // double mjdmin = strtod (ptr, NULL); // mjd min 115 // ptr = nextWISEfield (ptr); // skip 116 // double mjdmax = strtod (ptr, NULL); // mjd max 117 // ptr = nextWISEfield (ptr); // skip mjd max 118 double mjdmean = strtod (ptr, NULL); // mjd mean 119 ptr = nextWISEfield (ptr); // skip mjd mean 120 121 // fprintf (stderr, "w%d mjd: %f\n", i, mjdmean); 122 123 // the release is based on data taken in the period 14 January 2010 to 29 April 2010 124 if (mjdmean == 0.0) { 125 star[i][0].measure.t = 0; 126 } else { 127 star[i][0].measure.t = ohana_mjd_to_sec (mjdmean); 128 } 129 } 130 131 star[0][0].measure.photcode = WISE_W1; 132 star[0][0].measure.detID = 0; 133 star[0][0].measure.imageID = 0; 134 135 star[1][0].measure.photcode = WISE_W2; 136 star[1][0].measure.detID = 0; 137 star[1][0].measure.imageID = 0; 138 139 star[2][0].measure.photcode = WISE_W3; 140 star[2][0].measure.detID = 0; 141 star[2][0].measure.imageID = 0; 142 143 star[3][0].measure.photcode = WISE_W4; 144 star[3][0].measure.detID = 0; 145 star[3][0].measure.imageID = 0; 146 147 return TRUE; 148 } 149 150 // there are slight format differences between the prelim data dump and the allsky data dump: 151 // * after ph_qual & det_bit : new field moon_lev 152 // * for each filter, after w?sigp2 : new fields w?dmag, w?ndf, w?mlq, w?mjdmin, w?mjdmax, w?mjdmean 153 // * after w4mdjmean : new fields rho12, rho23, rho34, q12, q23, q34 154 // * after k_msig_2mass : new fields best_use_cntr, ngrp 155 156 // fill in the data for a WISE quad star. takes a pointer to the start of the line the 157 // RA and DEC have already been set 158 int loadwise_star_allsky (Stars **star, char *line, int Nmax) { 16 159 17 160 int i; … … 84 227 ptr = nextWISEfield (ptr); // skip satnum 85 228 86 ptr = skipNbounds (ptr, '|', 15, Nmax); // skip pm info 87 88 for (i = 0; i < 4; i++) { 89 setWISE_cc_flag (star[i], ptr[i]); // cc_flags 229 for (i = 0; i < 4; i++) { 230 setWISE_cc_flag (star[i], ptr[i]); // cc_flg 90 231 } 91 232 ptr = nextWISEfield (ptr); // skip cc_flags 92 ptr = nextWISEfield (ptr); // skip rel93 233 94 234 // set ext flags for all 4 measures … … 105 245 } 106 246 107 ptr = skipNbounds (ptr, '|', 158, Nmax); // skip: det_bit, moon_lev, w?nm, w?m, w?cov, etc, etc. 108 // w?frtr dropped, (-4), use_src, best_use_cntr, ngrp added (+3), w?dmag dropped, w?k added, 109 110 for (i = 0; i < 4; i++) { 111 ptr = skipNbounds (ptr, '|', 8, Nmax); // skip: w?magp, w?sigp1,2, w?dmag, w?ndf, w?m1q, w?mjdmin, w?mjdmax 247 ptr = skipNbounds (ptr, '|', 159, Nmax); // skip: det_bit, moon_lev, w?nm, w?m, w?cov, etc, etc. 248 249 for (i = 0; i < 4; i++) { 250 ptr = skipNbounds (ptr, '|', 8, Nmax); // skip: det_bit, moon_lev, w?nm, w?m, w?cov, etc, etc. 112 251 113 252 // double mjdmin = strtod (ptr, NULL); // mjd min … … 147 286 } 148 287 149 // there are slight format differences between the prelim data dump and the allsky data dump:150 // * after ph_qual & det_bit : new field moon_lev151 // * for each filter, after w?sigp2 : new fields w?dmag, w?ndf, w?mlq, w?mjdmin, w?mjdmax, w?mjdmean152 // * after w4mdjmean : new fields rho12, rho23, rho34, q12, q23, q34153 // * after k_msig_2mass : new fields best_use_cntr, ngrp154 155 288 // fill in the data for a WISE quad star. takes a pointer to the start of the line the 156 289 // RA and DEC have already been set 157 int loadwise_star_ allsky(Stars **star, char *line, int Nmax) {290 int loadwise_star_prelim (Stars **star, char *line, int Nmax) { 158 291 159 292 int i; … … 196 329 // W1 197 330 for (i = 0; i < 4; i++) { 198 char *endpoint;199 star[i][0].measure.M = strtod (ptr, &endpoint); // w?mpro200 if (endpoint == ptr) {201 star[i][0].measure.M = NAN;202 }203 ptr = nextWISEfield (ptr);204 star[i][0].measure.dM = strtod (ptr, &endpoint); // w?sigmpro205 if (endpoint == ptr) {206 star[i][0].measure.dM = NAN;207 }208 ptr = skipNbounds (ptr, '|', 2, Nmax); // skip: w?sigmpro, w?snr209 star[i][0].measure.psfChisq = strtod (ptr, NULL); // w?rchi2210 ptr = nextWISEfield (ptr); // skip : w1rchi2211 212 // init the photFlags field213 star[i][0].measure.photFlags = 0;214 }215 216 ptr = nextWISEfield (ptr); // skip: rchi2217 218 // set blend flags for all 4 measures219 setWISE_blend_flag (star, ptr); // nb & na both used here220 ptr = skipNbounds (ptr, '|', 2, Nmax); // skip: nb, na221 222 for (i = 0; i < 4; i++) {223 setWISE_sat_flag (star[i], ptr); // w1sat224 ptr = nextWISEfield (ptr);225 }226 ptr = nextWISEfield (ptr); // skip satnum227 228 for (i = 0; i < 4; i++) {229 setWISE_cc_flag (star[i], ptr[i]); // cc_flg230 }231 ptr = nextWISEfield (ptr); // skip cc_flags232 233 // set ext flags for all 4 measures234 setWISE_ext_flag_allsky (star, ptr[0]); // ext_flg235 ptr = nextWISEfield (ptr); // skip ext_flags236 237 for (i = 0; i < 4; i++) {238 setWISE_var_flag_allsky (star[i], ptr[i]); // var_flg239 }240 ptr = nextWISEfield (ptr); // skip var_flags241 242 for (i = 0; i < 4; i++) {243 setWISE_ph_qual (star[i], ptr[i]); // ph_qual244 }245 246 ptr = skipNbounds (ptr, '|', 159, Nmax); // skip: det_bit, moon_lev, w?nm, w?m, w?cov, etc, etc.247 248 for (i = 0; i < 4; i++) {249 ptr = skipNbounds (ptr, '|', 8, Nmax); // skip: det_bit, moon_lev, w?nm, w?m, w?cov, etc, etc.250 251 // double mjdmin = strtod (ptr, NULL); // mjd min252 // ptr = nextWISEfield (ptr); // skip253 // double mjdmax = strtod (ptr, NULL); // mjd max254 // ptr = nextWISEfield (ptr); // skip mjd max255 double mjdmean = strtod (ptr, NULL); // mjd mean256 ptr = nextWISEfield (ptr); // skip mjd mean257 258 // fprintf (stderr, "w%d mjd: %f\n", i, mjdmean);259 260 // the release is based on data taken in the period 14 January 2010 to 29 April 2010261 if (mjdmean == 0.0) {262 star[i][0].measure.t = 0;263 } else {264 star[i][0].measure.t = ohana_mjd_to_sec (mjdmean);265 }266 }267 268 star[0][0].measure.photcode = WISE_W1;269 star[0][0].measure.detID = 0;270 star[0][0].measure.imageID = 0;271 272 star[1][0].measure.photcode = WISE_W2;273 star[1][0].measure.detID = 0;274 star[1][0].measure.imageID = 0;275 276 star[2][0].measure.photcode = WISE_W3;277 star[2][0].measure.detID = 0;278 star[2][0].measure.imageID = 0;279 280 star[3][0].measure.photcode = WISE_W4;281 star[3][0].measure.detID = 0;282 star[3][0].measure.imageID = 0;283 284 return TRUE;285 }286 287 // fill in the data for a WISE quad star. takes a pointer to the start of the line the288 // RA and DEC have already been set289 int loadwise_star_prelim (Stars **star, char *line, int Nmax) {290 291 int i;292 char *ptr;293 294 if (line == NULL) Shutdown ("format error in WISE");295 296 ptr = line;297 298 // I can assign dRA and dDEC to dX and dY if I can consistently set posangle and pltscale299 star[0][0].measure.posangle = 0.0;300 star[0][0].measure.pltscale = 1.0;301 302 ptr = skipNbounds (ptr, '|', 3, Nmax); // skip: desig, ra, dec,303 star[0][0].measure.dXccd = ToShortPixels(strtod (ptr, NULL)); // sig_ra304 ptr = nextWISEfield (ptr);305 star[0][0].measure.dYccd = ToShortPixels(strtod (ptr, NULL)); // sig_dec306 ptr = nextWISEfield (ptr);307 308 // we only know a single set of values for all 4 bands309 for (i = 1; i < 4; i++) {310 star[i][0].measure.dXccd = star[0][0].measure.dXccd;311 star[i][0].measure.dYccd = star[0][0].measure.dYccd;312 star[i][0].measure.posangle = star[0][0].measure.posangle;313 star[i][0].measure.pltscale = star[0][0].measure.pltscale;314 }315 ptr = skipNbounds (ptr, '|', 5, Nmax); // skip: sig_radec, glon, glat, elon, elat316 317 star[0][0].measure.Xccd = strtod (ptr, NULL); // wx318 ptr = nextWISEfield (ptr); // skip wx319 star[0][0].measure.Yccd = strtod (ptr, NULL); // wy320 ptr = nextWISEfield (ptr); // skip wy321 322 for (i = 1; i < 4; i++) {323 star[i][0].measure.Xccd = star[0][0].measure.Xccd;324 star[i][0].measure.Yccd = star[0][0].measure.Yccd;325 }326 ptr = skipNbounds (ptr, '|', 4, Nmax); // skip: cntr, source_id, coadd_id, src327 328 // W1329 for (i = 0; i < 4; i++) {330 331 star[i][0].measure.M = strtod (ptr, NULL); // w?mpro 331 332 ptr = nextWISEfield (ptr); … … 413 414 # define FLAG_PH_U 0x00000008 // quality flag 'U' 414 415 # define FLAG_PH_X 0x00000010 // quality flag 'X' 416 # define FLAG_PH_Z 0x00000020 // quality flag 'Z' 415 417 416 418 # define FLAG_SATURATED_PIX 0x00000100 // sat > 0.0 … … 429 431 # define FLAG_EXT_BY_XSC 0x04000000 // ext == 1 430 432 431 # define FLAG_VARIABLE_LEVEL1 0x10000000 // var_flg == 1 to 4 432 # define FLAG_VARIABLE_LEVEL2 0x20000000 // var_flg == 5 to 7 433 // note prelim version had 1 -> 1-4, 2 -> 5-6 434 # define FLAG_VARIABLE_LEVEL1 0x10000000 // var_flg == 0 to 5 435 # define FLAG_VARIABLE_LEVEL2 0x20000000 // var_flg == 6 or 7 433 436 # define FLAG_VARIABLE_LEVEL3 0x40000000 // var_flg == 8 or 9 434 437 … … 606 609 case 'U': star[0].measure.photFlags |= FLAG_PH_U; break; 607 610 case 'X': star[0].measure.photFlags |= FLAG_PH_X; break; 611 case 'Z': star[0].measure.photFlags |= FLAG_PH_Z; break; 608 612 default: 609 613 fprintf (stderr, "error in ph_flag: %c\n", qual); -
trunk/Ohana/src/dvomerge/src/args.c
r37807 r38062 206 206 } 207 207 208 UPDATE_CATFORMAT = NULL; 209 if ((N = get_argument (*argc, argv, "-update-catformat"))) { 210 remove_argument (N, argc, argv); 211 UPDATE_CATFORMAT = strcreate (argv[N]); 212 remove_argument (N, argc, argv); 213 } 214 208 215 /* replace measurement, don't duplicate */ 209 216 REPLACE_BY_PHOTCODE = FALSE; -
trunk/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c
r37807 r38062 270 270 271 271 char tmpline[DVO_MAX_PATH]; 272 if (VERBOSE) { snprintf (tmpline, DVO_MAX_PATH, "%s -v", command); strcpy (command, tmpline); } 273 if (VERIFY) { snprintf (tmpline, DVO_MAX_PATH, "%s -verify", command); strcpy (command, tmpline); } 274 if (VERIFY_CATALOG_ONLY) { snprintf (tmpline, DVO_MAX_PATH, "%s -verify-catalogs", command); strcpy (command, tmpline); } 275 if (REPLACE_BY_PHOTCODE) { snprintf (tmpline, DVO_MAX_PATH, "%s -replace", command); strcpy (command, tmpline); } 276 if (PARALLEL_INPUT) { snprintf (tmpline, DVO_MAX_PATH, "%s -parallel-input", command); strcpy (command, tmpline); } 277 if (FORCE_MERGE) { snprintf (tmpline, DVO_MAX_PATH, "%s -force-merge", command); strcpy (command, tmpline); } 278 if (MATCHED_TABLES) { snprintf (tmpline, DVO_MAX_PATH, "%s -matched-tables", command); strcpy (command, tmpline); } 272 if (VERBOSE) { snprintf (tmpline, DVO_MAX_PATH, "%s -v", command); strcpy (command, tmpline); } 273 if (VERIFY) { snprintf (tmpline, DVO_MAX_PATH, "%s -verify", command); strcpy (command, tmpline); } 274 if (VERIFY_CATALOG_ONLY) { snprintf (tmpline, DVO_MAX_PATH, "%s -verify-catalogs", command); strcpy (command, tmpline); } 275 if (REPLACE_BY_PHOTCODE) { snprintf (tmpline, DVO_MAX_PATH, "%s -replace", command); strcpy (command, tmpline); } 276 if (PARALLEL_INPUT) { snprintf (tmpline, DVO_MAX_PATH, "%s -parallel-input", command); strcpy (command, tmpline); } 277 if (FORCE_MERGE) { snprintf (tmpline, DVO_MAX_PATH, "%s -force-merge", command); strcpy (command, tmpline); } 278 if (MATCHED_TABLES) { snprintf (tmpline, DVO_MAX_PATH, "%s -matched-tables", command); strcpy (command, tmpline); } 279 if (UPDATE_CATFORMAT) { snprintf (tmpline, DVO_MAX_PATH, "%s -update-catformat %s", command, UPDATE_CATFORMAT); strcpy (command, tmpline); } 279 280 280 281 // add some config variables: -
trunk/Ohana/src/getstar
- Property svn:mergeinfo deleted
-
trunk/Ohana/src/kapa2/src/DrawObjects.c
r37047 r38062 630 630 } 631 631 } 632 if (object[0].ptype == 14) { /* upside-down filled triangle */ 633 XPoint points[4]; 634 for (i = 0; i < object[0].Npts; i++) { 635 if (!(finite(x[i]) && finite(y[i]))) continue; 636 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 637 sy = x[i]*myi + y[i]*myj + by + YCENTER; 638 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 639 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 640 if (scaleColor) { 641 if (!finite(z[i])) continue; 642 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 643 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 644 } 645 D = scaleSize ? dz*z[i] : ds; 646 points[0].x = sx - D; points[0].y = sy - 0.58*D; 647 points[1].x = sx + D; points[1].y = sy - 0.58*D; 648 points[2].x = sx; points[2].y = sy + 1.15*D; 649 points[3].x = sx - D; points[3].y = sy - 0.58*D; 650 XFillPolygon (graphic->display, graphic->window, graphic->gc, points, 4, Convex, CoordModeOrigin); 651 } 652 } 653 } 654 if (object[0].ptype == 15) { /* upside-down open triangle */ 655 for (i = 0; i < object[0].Npts; i++) { 656 if (!(finite(x[i]) && finite(y[i]))) continue; 657 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 658 sy = x[i]*myi + y[i]*myj + by + YCENTER; 659 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 660 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 661 if (scaleColor) { 662 if (!finite(z[i])) continue; 663 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 664 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 665 } 666 D = scaleSize ? dz*z[i] : ds; 667 DrawLine (sx - D, sy - 0.58*D, sx + D, sy - 0.58*D); 668 DrawLine (sx + D, sy - 0.58*D, sx, sy + 1.15*D); 669 DrawLine (sx, sy + 1.15*D, sx - D, sy - 0.58*D); 670 } 671 } 672 } 673 if (object[0].ptype == 16) { /* upside-down Y */ 674 for (i = 0; i < object[0].Npts; i++) { 675 if (!(finite(x[i]) && finite(y[i]))) continue; 676 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 677 sy = x[i]*myi + y[i]*myj + by + YCENTER; 678 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 679 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 680 if (scaleColor) { 681 if (!finite(z[i])) continue; 682 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 683 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 684 } 685 D = scaleSize ? dz*z[i] : ds; 686 DrawLine (sx, sy, sx - D, sy + 0.58*D); 687 DrawLine (sx, sy, sx + D, sy + 0.58*D); 688 DrawLine (sx, sy, sx, sy - 1.15*D); 689 } 690 } 691 } 632 692 if (object[0].ptype == 100) { /* connect a pair of points */ 633 693 … … 652 712 void DrawXErrors (KapaGraphWidget *graph, Gobjects *object) { 653 713 654 int i, bar ;655 float *x, *y, * dxm, *dxp;714 int i, bar, dz, ds, D; 715 float *x, *y, *z, *dxm, *dxp; 656 716 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 657 717 double sx0, sy0, sx1, sy1, sz, sx10, sx11, X0, X1, Y0, Y1; 718 719 int scaleSize = (object[0].size < 0); 658 720 659 721 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); … … 670 732 by = byi + byj; 671 733 672 x = object[0].x; y = object[0].y; dxp = object[0].dxp; dxm = object[0].dxm; 734 ds = 0.5 * (graphic->dx + graphic->dy) * 0.003 * object[0].size; 735 dz = 0.5 * (graphic->dx + graphic->dy) * 0.010; 736 737 x = object[0].x; y = object[0].y; dxp = object[0].dxp; dxm = object[0].dxm; z = object[0].z; 673 738 bar = object[0].ebar; sz = object[0].size*graph[0].axis[1].dfy*0.03; 674 739 … … 678 743 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 679 744 745 /// XXX NOTE : D should be modified by (mxi,myi) for tilted axes dx = D*(mxi/mx), dy = D*(myi/mx) 746 680 747 for (i = 0; i < object[0].Npts; i++) { 681 if (!(finite(x[i]) && finite(y[i]) && finite(dxp[i]))) continue; 682 sx0 = x[i]*mxi + y[i]*mxj + bx + XCENTER; 748 // for open circles, only go to the outer radius 749 D = 0; 750 if (object[0].ptype == 7) { D = scaleSize ? dz*z[i] : ds; } 751 if (object[0].ptype == 1) { D = scaleSize ? dz*z[i] : ds; } 752 if (object[0].ptype == 5) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; } 753 if (object[0].ptype == 15) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; } 754 if (!(finite(x[i]) && finite(y[i]) && finite(dxp[i]))) goto skip_dxp; 755 if (D > fabs(dxp[i]*mxi)) goto skip_dxp; 756 sx0 = x[i]*mxi + y[i]*mxj + bx + XCENTER + D; 683 757 sy0 = x[i]*myi + y[i]*myj + by + YCENTER; 684 sx1 = (x[i] + dxp[i])*mxi + y[i]*mxj + bx + XCENTER;685 sy1 = (x[i] + dxp[i])*myi + y[i]*myj + by + YCENTER;758 sx1 = sx0 + dxp[i]*mxi - D; 759 sy1 = sy0 + dxp[i]*myi; 686 760 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 687 761 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || … … 696 770 } 697 771 } 772 skip_dxp: 698 773 if (!(finite(x[i]) && finite(y[i]) && finite(dxm[i]))) continue; 699 sx0 = x[i]*mxi + y[i]*mxj + bx + XCENTER; 774 if (D > fabs(dxm[i]*mxi)) continue; 775 sx0 = x[i]*mxi + y[i]*mxj + bx + XCENTER - D; 700 776 sy0 = x[i]*myi + y[i]*myj + by + YCENTER; 701 sx1 = (x[i] - dxm[i])*mxi + y[i]*mxj + bx + XCENTER;702 sy1 = (x[i] - dxm[i])*myi + y[i]*myj + by + YCENTER;777 sx1 = sx0 - dxm[i]*mxi + D; 778 sy1 = sy0 - dxm[i]*myi; 703 779 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 704 780 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || … … 719 795 void DrawYErrors (KapaGraphWidget *graph, Gobjects *object) { 720 796 721 int i, bar ;722 float *x, *y, * dym, *dyp;797 int i, bar, dz, ds, D; 798 float *x, *y, *z, *dym, *dyp; 723 799 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 724 800 double sx0, sy0, sx1, sy1, sz, sx10, sx11, X0, X1, Y0, Y1; 801 802 int scaleSize = (object[0].size < 0); 725 803 726 804 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); … … 737 815 by = byi + byj; 738 816 739 x = object[0].x; y = object[0].y; dyp = object[0].dyp; dym = object[0].dym; 817 ds = 0.5 * (graphic->dx + graphic->dy) * 0.003 * object[0].size; 818 dz = 0.5 * (graphic->dx + graphic->dy) * 0.010; 819 820 x = object[0].x; y = object[0].y; dyp = object[0].dyp; dym = object[0].dym; z = object[0].z; 740 821 bar = object[0].ebar; sz = object[0].size*graph[0].axis[0].dfx*0.03; 741 822 … … 745 826 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 746 827 828 /// XXX NOTE : D should be modified by (mxi,myi) for tilted axes dx = D*(mxi/mx), dy = D*(myi/mx) 829 747 830 for (i = 0; i < object[0].Npts; i++) { 748 if (!(finite(x[i]) && finite(y[i]) && finite(dyp[i]))) continue; 831 // for open circles, only go to the outer radius 832 D = 0; 833 if (object[0].ptype == 7) { D = scaleSize ? dz*z[i] : ds; } 834 if (object[0].ptype == 1) { D = scaleSize ? dz*z[i] : ds; } 835 if (object[0].ptype == 5) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; } 836 if (object[0].ptype == 15) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; } 837 if (!(finite(x[i]) && finite(y[i]) && finite(dyp[i]))) goto skip_dyp; 838 if (D > fabs(dyp[i]*myj)) goto skip_dyp; 749 839 sx0 = x[i]*mxi + y[i]*mxj + bx + XCENTER; 750 sy0 = x[i]*myi + y[i]*myj + by + YCENTER ;840 sy0 = x[i]*myi + y[i]*myj + by + YCENTER - D; 751 841 sx1 = sx0 + dyp[i]*mxj; 752 sy1 = sy0 + dyp[i]*myj ;842 sy1 = sy0 + dyp[i]*myj + D; 753 843 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 754 844 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || … … 763 853 } 764 854 } 855 skip_dyp: 765 856 if (!(finite(x[i]) && finite(y[i]) && finite(dym[i]))) continue; 857 if (object[0].ptype == 5) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; } 858 if (object[0].ptype == 15) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; } 859 if (D > fabs(dym[i]*myj)) continue; 766 860 sx0 = x[i]*mxi + y[i]*mxj + bx + XCENTER; 767 sy0 = x[i]*myi + y[i]*myj + by + YCENTER ;768 sx1 = x[i]*mxi + (y[i] - dym[i])*mxj + bx + XCENTER;769 sy1 = x[i]*myi + (y[i] - dym[i])*myj + by + YCENTER;861 sy0 = x[i]*myi + y[i]*myj + by + YCENTER + D; 862 sx1 = sx0 - dym[i]*mxj; 863 sy1 = sy0 - dym[i]*myj - D; 770 864 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 771 865 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || -
trunk/Ohana/src/kapa2/src/InterpretKeys.c
r37807 r38062 98 98 Screen_to_Image (&X, &Y, (double)(event[0].x + 0.5), (double)(event[0].y + 0.5), &image[0].picture); \ 99 99 UpdateStatusBox (graphic, image, X, Y, 0.0, 1); \ 100 Remap (graphic, image); \ 100 101 break; 101 102 // Remap (graphic, image);103 102 104 103 // the number of entries here must match the value of NCHANNELS in contants.h -
trunk/Ohana/src/kapa2/src/PSObjects.c
r35416 r38062 403 403 D = scaleSize ? dz*z[i] : ds; 404 404 FillTriangle (sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 405 /* 406 DrawLine (sx - D, sy + 0.58*D, sx + D, sy + 0.58*D); 407 DrawLine (sx + D, sy + 0.58*D, sx, sy - 1.15*D); 408 DrawLine (sx, sy - 1.15*D, sx - D, sy + 0.58*D); 409 */ 405 } 406 } 407 } 408 if (object[0].ptype == 14) { /* filled triangle */ 409 for (i = 0; i < object[0].Npts; i++) { 410 if (!(finite(x[i]) && finite(y[i]))) continue; 411 sx = x[i]*mxi + y[i]*mxj + bx; 412 sy = x[i]*myi + y[i]*myj + by; 413 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 414 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 415 { 416 if (scaleColor) { 417 if (!finite(z[i])) continue; 418 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 419 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 420 } 421 D = scaleSize ? dz*z[i] : ds; 422 FillTriangle (sx - D, sy + 0.58*D, sx + D, sy + 0.58*D, sx, sy - 1.15*D); 410 423 } 411 424 } … … 426 439 D = scaleSize ? dz*z[i] : ds; 427 440 DrawLine (sx - D, sy - 0.58*D, sx + D, sy - 0.58*D); 428 DrawLine (sx + D, sy - 0.58*D, sx, sy + 1.15*D); 429 DrawLine (sx, sy + 1.15*D, sx - D, sy - 0.58*D); 441 DrawLine (sx + D, sy - 0.58*D, sx, sy + 1.15*D); 442 DrawLine (sx, sy + 1.15*D, sx - D, sy - 0.58*D); 443 } 444 } 445 } 446 if (object[0].ptype == 15) { /* upside-down open triangle */ 447 for (i = 0; i < object[0].Npts; i++) { 448 if (!(finite(x[i]) && finite(y[i]))) continue; 449 sx = x[i]*mxi + y[i]*mxj + bx; 450 sy = x[i]*myi + y[i]*myj + by; 451 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 452 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 453 { 454 if (scaleColor) { 455 if (!finite(z[i])) continue; 456 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 457 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 458 } 459 D = scaleSize ? dz*z[i] : ds; 460 DrawLine (sx - D, sy + 0.58*D, sx + D, sy + 0.58*D); 461 DrawLine (sx + D, sy + 0.58*D, sx, sy - 1.15*D); 462 DrawLine (sx, sy - 1.15*D, sx - D, sy + 0.58*D); 430 463 } 431 464 } … … 448 481 DrawLine (sx, sy, sx + D, sy + 0.58*D); 449 482 DrawLine (sx, sy, sx, sy - 1.15*D); 483 } 484 } 485 } 486 if (object[0].ptype == 16) { /* Y */ 487 for (i = 0; i < object[0].Npts; i++) { 488 if (!(finite(x[i]) && finite(y[i]))) continue; 489 sx = x[i]*mxi + y[i]*mxj + bx; 490 sy = x[i]*myi + y[i]*myj + by; 491 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 492 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 493 { 494 if (scaleColor) { 495 if (!finite(z[i])) continue; 496 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 497 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 498 } 499 D = scaleSize ? dz*z[i] : ds; 500 DrawLine (sx, sy, sx - D, sy - 0.58*D); 501 DrawLine (sx, sy, sx + D, sy - 0.58*D); 502 DrawLine (sx, sy, sx, sy + 1.15*D); 450 503 } 451 504 } … … 557 610 void PSXErrors (KapaGraphWidget *graph, Gobjects *object, FILE *f) { 558 611 559 int i, bar ;560 float *x, *y, * dxm, *dxp;612 int i, bar, dz, ds, D; 613 float *x, *y, *z, *dxm, *dxp; 561 614 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 562 615 double sx0, sy0, sx1, sy1, sz, sx10, sx11; 616 617 int scaleSize = (object[0].size < 0); 563 618 564 619 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); … … 575 630 by = byi + byj; 576 631 577 x = object[0].x; y = object[0].y; dxp = object[0].dxp; dxm = object[0].dxm; 632 ds = 0.5 * (graphic->dx + graphic->dy) * 0.003 * object[0].size; 633 dz = 0.5 * (graphic->dx + graphic->dy) * 0.010; 634 635 x = object[0].x; y = object[0].y; dxp = object[0].dxp; dxm = object[0].dxm; z = object[0].z; 578 636 bar = object[0].ebar; sz = object[0].size*graph[0].axis[1].dfy*0.03; 579 637 … … 583 641 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 584 642 643 /// XXX NOTE : D should be modified by (mxi,myi) for tilted axes dx = D*(mxi/mx), dy = D*(myi/mx) 644 585 645 for (i = 0; i < object[0].Npts; i++) { 586 if (!(finite(x[i]) && finite(y[i]) && finite(dxp[i]))) continue; 587 sx0 = x[i]*mxi + y[i]*mxj + bx; 646 // for open circles, only go to the outer radius 647 D = 0; 648 if (object[0].ptype == 7) { D = scaleSize ? dz*z[i] : ds; } 649 if (object[0].ptype == 1) { D = scaleSize ? dz*z[i] : ds; } 650 if (object[0].ptype == 5) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; } 651 if (object[0].ptype == 15) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; } 652 if (!(finite(x[i]) && finite(y[i]) && finite(dxp[i]))) goto skip_dxp; 653 if (D > fabs(dxp[i]*mxi)) goto skip_dxp; 654 sx0 = x[i]*mxi + y[i]*mxj + bx + D; 588 655 sy0 = x[i]*myi + y[i]*myj + by; 589 sx1 = (x[i] + dxp[i])*mxi + y[i]*mxj + bx;590 sy1 = (x[i] + dxp[i])*myi + y[i]*myj + by;656 sx1 = sx0 + dxp[i]*mxi - D; 657 sy1 = sy0 + dxp[i]*myi; 591 658 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 592 659 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || … … 595 662 { 596 663 ClipLinePS (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1, f); 597 // DrawLine (sx0, sy0, sx1, sy1);598 664 if (bar) { 599 665 sx10 = sy1 - sz; 600 666 sx11 = sy1 + sz; 601 667 ClipLinePS (sx1, sx10, sx1, sx11, X0, Y0, X1, Y1, f); 602 // DrawLine (sx1, sx10, sx1, sx11);603 }604 }668 } 669 } 670 skip_dxp: 605 671 if (!(finite(x[i]) && finite(y[i]) && finite(dxm[i]))) continue; 606 sx0 = x[i]*mxi + y[i]*mxj + bx; 672 if (D > fabs(dxm[i]*mxi)) continue; 673 sx0 = x[i]*mxi + y[i]*mxj + bx - D; 607 674 sy0 = x[i]*myi + y[i]*myj + by; 608 sx1 = (x[i] - dxm[i])*mxi + y[i]*mxj + bx;609 sy1 = (x[i] - dxm[i])*myi + y[i]*myj + by;675 sx1 = sx0 - dxm[i]*mxi + D; 676 sy1 = sy0 - dxm[i]*myi; 610 677 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 611 678 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || … … 614 681 { 615 682 ClipLinePS (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1, f); 616 // DrawLine (sx0, sy0, sx1, sy1);617 683 if (bar) { 618 684 sx10 = sy1 - sz; 619 685 sx11 = sy1 + sz; 620 686 ClipLinePS (sx1, sx10, sx1, sx11, X0, Y0, X1, Y1, f); 621 // DrawLine (sx1, sx10, sx1, sx11);622 687 } 623 688 } … … 629 694 void PSYErrors (KapaGraphWidget *graph, Gobjects *object, FILE *f) { 630 695 631 int i, bar ;632 float *x, *y, * dym, *dyp;696 int i, bar, dz, ds, D; 697 float *x, *y, *z, *dym, *dyp; 633 698 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 634 699 double sx0, sy0, sx1, sy1, sz, sx10, sx11; 635 700 701 int scaleSize = (object[0].size < 0); 702 636 703 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); 637 704 mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0); … … 647 714 by = byi + byj; 648 715 649 x = object[0].x; y = object[0].y; dyp = object[0].dyp; dym = object[0].dym; 716 ds = 0.5 * (graphic->dx + graphic->dy) * 0.003 * object[0].size; 717 dz = 0.5 * (graphic->dx + graphic->dy) * 0.010; 718 719 x = object[0].x; y = object[0].y; dyp = object[0].dyp; dym = object[0].dym; z = object[0].z; 650 720 bar = object[0].ebar; sz = object[0].size*graph[0].axis[0].dfx*0.03; 651 721 … … 655 725 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 656 726 727 /// XXX NOTE : D should be modified by (mxi,myi) for tilted axes dx = D*(mxi/mx), dy = D*(myi/mx) 728 657 729 for (i = 0; i < object[0].Npts; i++) { 658 if (!(finite(x[i]) && finite(y[i]) && finite(dyp[i]))) continue; 730 // for open circles, only go to the outer radius 731 D = 0; 732 if (object[0].ptype == 7) { D = scaleSize ? dz*z[i] : ds; } 733 if (object[0].ptype == 1) { D = scaleSize ? dz*z[i] : ds; } 734 if (object[0].ptype == 5) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; } 735 if (object[0].ptype == 15) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; } 736 if (!(finite(x[i]) && finite(y[i]) && finite(dyp[i]))) goto skip_dyp; 737 if (D > fabs(dyp[i]*myj)) goto skip_dyp; 659 738 sx0 = x[i]*mxi + y[i]*mxj + bx; 660 sy0 = x[i]*myi + y[i]*myj + by ;661 sx1 = x[i]*mxi + (y[i] + dyp[i])*mxj + bx;662 sy1 = x[i]*myi + (y[i] + dyp[i])*myj + by;739 sy0 = x[i]*myi + y[i]*myj + by - D; 740 sx1 = sx0 + dyp[i]*mxj; 741 sy1 = sy0 + dyp[i]*myj + D; 663 742 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 664 743 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || … … 667 746 { 668 747 ClipLinePS (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1, f); 669 // DrawLine (sx0, sy0, sx1, sy1);670 748 if (bar) { 671 749 sx10 = sx1 - sz; 672 750 sx11 = sx1 + sz; 673 751 ClipLinePS (sx10, sy1, sx11, sy1, X0, Y0, X1, Y1, f); 674 // DrawLine (sx10, sy1, sx11, sy1);675 }676 }752 } 753 } 754 skip_dyp: 677 755 if (!(finite(x[i]) && finite(y[i]) && finite(dym[i]))) continue; 756 if (object[0].ptype == 5) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; } 757 if (object[0].ptype == 15) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; } 758 if (D > fabs(dym[i]*myj)) continue; 678 759 sx0 = x[i]*mxi + y[i]*mxj + bx; 679 sy0 = x[i]*myi + y[i]*myj + by ;680 sx1 = x[i]*mxi + (y[i] - dym[i])*mxj + bx;681 sy1 = x[i]*myi + (y[i] - dym[i])*myj + by;760 sy0 = x[i]*myi + y[i]*myj + by + D; 761 sx1 = sx0 - dym[i]*mxj; 762 sy1 = sy0 - dym[i]*myj - D; 682 763 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 683 764 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || … … 686 767 { 687 768 ClipLinePS (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1, f); 688 // DrawLine (sx0, sy0, sx1, sy1);689 769 if (bar) { 690 770 sx10 = sx1 - sz; 691 771 sx11 = sx1 + sz; 692 772 ClipLinePS (sx10, sy1, sx11, sy1, X0, Y0, X1, Y1, f); 693 // DrawLine (sx10, sy1, sx11, sy1);694 773 } 695 774 } -
trunk/Ohana/src/kapa2/src/bDrawObjects.c
r37047 r38062 406 406 } 407 407 } 408 if (object[0].ptype == 14) { /* filled triangle */ 409 for (i = 0; i < object[0].Npts; i++) { 410 if (!(finite(x[i]) && finite(y[i]))) continue; 411 sx = x[i]*mxi + y[i]*mxj + bx; 412 sy = x[i]*myi + y[i]*myj + by; 413 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 414 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 415 { 416 if (scaleColor) { 417 if (!finite(z[i])) continue; 418 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 419 buffer->bColor_R = pixel1[pixel]; 420 buffer->bColor_G = pixel2[pixel]; 421 buffer->bColor_B = pixel3[pixel]; 422 } 423 D = scaleSize ? dz*z[i] : ds; 424 // FillTriangle (buffer, sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 425 FillTriangle (buffer, sx, sy - 0.58*D, D, +1.73*D); 426 // out-of-range points skipped by bDrawPoint 427 } 428 } 429 } 408 430 if (object[0].ptype == 5) { /* open triangle */ 409 431 for (i = 0; i < object[0].Npts; i++) { … … 423 445 D = scaleSize ? dz*z[i] : ds; 424 446 OpenTriangle (buffer, sx - D, sy + 0.58*D, sx + D, sy + 0.58*D, sx, sy - 1.15*D); 447 // out-of-range points skipped by bDrawPoint 448 } 449 } 450 } 451 if (object[0].ptype == 15) { /* open triangle */ 452 for (i = 0; i < object[0].Npts; i++) { 453 if (!(finite(x[i]) && finite(y[i]))) continue; 454 sx = x[i]*mxi + y[i]*mxj + bx; 455 sy = x[i]*myi + y[i]*myj + by; 456 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 457 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 458 { 459 if (scaleColor) { 460 if (!finite(z[i])) continue; 461 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 462 buffer->bColor_R = pixel1[pixel]; 463 buffer->bColor_G = pixel2[pixel]; 464 buffer->bColor_B = pixel3[pixel]; 465 } 466 D = scaleSize ? dz*z[i] : ds; 467 OpenTriangle (buffer, sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 425 468 // out-of-range points skipped by bDrawPoint 426 469 } … … 446 489 DrawLine (buffer, sx, sy, sx + D, sy - 0.58*D); 447 490 DrawLine (buffer, sx, sy, sx, sy + 1.15*D); 491 // out-of-range points skipped by bDrawPoint 492 } 493 } 494 } 495 if (object[0].ptype == 16) { /* Y */ 496 for (i = 0; i < object[0].Npts; i++) { 497 if (!(finite(x[i]) && finite(y[i]))) continue; 498 sx = x[i]*mxi + y[i]*mxj + bx; 499 sy = x[i]*myi + y[i]*myj + by; 500 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 501 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 502 { 503 if (scaleColor) { 504 if (!finite(z[i])) continue; 505 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 506 buffer->bColor_R = pixel1[pixel]; 507 buffer->bColor_G = pixel2[pixel]; 508 buffer->bColor_B = pixel3[pixel]; 509 } 510 D = scaleSize ? dz*z[i] : ds; 511 DrawLine (buffer, sx, sy, sx - D, sy + 0.58*D); 512 DrawLine (buffer, sx, sy, sx + D, sy + 0.58*D); 513 DrawLine (buffer, sx, sy, sx, sy - 1.15*D); 448 514 // out-of-range points skipped by bDrawPoint 449 515 } … … 590 656 void bDrawXErrors (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object) { 591 657 592 int i, bar ;593 float *x, *y, * dxm, *dxp;658 int i, bar, dz, ds, D; 659 float *x, *y, *z, *dxm, *dxp; 594 660 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 595 661 double sx0, sy0, sx1, sy1, sz, sx10, sx11; 662 663 int scaleSize = (object[0].size < 0); 596 664 597 665 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); … … 608 676 by = byi + byj; 609 677 610 x = object[0].x; y = object[0].y; dxp = object[0].dxp; dxm = object[0].dxm; 678 ds = 0.5 * (graphic->dx + graphic->dy) * 0.003 * object[0].size; 679 dz = 0.5 * (graphic->dx + graphic->dy) * 0.010; 680 681 x = object[0].x; y = object[0].y; dxp = object[0].dxp; dxm = object[0].dxm; z = object[0].z; 611 682 bar = object[0].ebar; sz = object[0].size*graph[0].axis[1].dfy*0.03; 612 683 … … 616 687 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 617 688 689 /// XXX NOTE : D should be modified by (mxi,myi) for tilted axes dx = D*(mxi/mx), dy = D*(myi/mx) 690 618 691 for (i = 0; i < object[0].Npts; i++) { 619 if (!(finite(x[i]) && finite(y[i]) && finite(dxp[i]))) continue; 620 sx0 = x[i]*mxi + y[i]*mxj + bx; 692 // for open circles, only go to the outer radius 693 D = 0; 694 if (object[0].ptype == 7) { D = scaleSize ? dz*z[i] : ds; } 695 if (object[0].ptype == 1) { D = scaleSize ? dz*z[i] : ds; } 696 if (object[0].ptype == 5) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; } 697 if (object[0].ptype == 15) { D = scaleSize ? 0.66*dz*z[i] : 0.66*ds; } 698 if (!(finite(x[i]) && finite(y[i]) && finite(dxp[i]))) goto skip_dxp; 699 if (D > fabs(dxp[i]*mxi)) goto skip_dxp; 700 sx0 = x[i]*mxi + y[i]*mxj + bx + D; 621 701 sy0 = x[i]*myi + y[i]*myj + by; 622 sx1 = (x[i] + dxp[i])*mxi + y[i]*mxj + bx;623 sy1 = (x[i] + dxp[i])*myi + y[i]*myj + by;702 sx1 = sx0 + dxp[i]*mxi - D; 703 sy1 = sy0 + dxp[i]*myi; 624 704 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 625 705 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || … … 628 708 { 629 709 bDrawClipLine (buffer, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 630 // DrawLine (buffer, sx0, sy0, sx1, sy1);631 710 if (bar) { 632 711 sx10 = sy1 - sz; 633 712 sx11 = sy1 + sz; 634 713 bDrawClipLine (buffer, sx1, sx10, sx1, sx11, X0, Y0, X1, Y1); 635 // DrawLine (buffer, sx1, sx10, sx1, sx11); 636 }637 }714 } 715 } 716 skip_dxp: 638 717 if (!(finite(x[i]) && finite(y[i]) && finite(dxm[i]))) continue; 639 sx0 = x[i]*mxi + y[i]*mxj + bx; 718 if (D > fabs(dxm[i]*mxi)) continue; 719 sx0 = x[i]*mxi + y[i]*mxj + bx - D; 640 720 sy0 = x[i]*myi + y[i]*myj + by; 641 sx1 = (x[i] - dxm[i])*mxi + y[i]*mxj + bx;642 sy1 = (x[i] - dxm[i])*myi + y[i]*myj + by;721 sx1 = sx0 - dxm[i]*mxi + D; 722 sy1 = sy0 - dxm[i]*myi; 643 723 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 644 724 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || … … 647 727 { 648 728 bDrawClipLine (buffer, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 649 // DrawLine (buffer, sx0, sy0, sx1, sy1);650 729 if (bar) { 651 730 sx10 = sy1 - sz; 652 731 sx11 = sy1 + sz; 653 732 bDrawClipLine (buffer, sx1, sx10, sx1, sx11, X0, Y0, X1, Y1); 654 // DrawLine (buffer, sx1, sx10, sx1, sx11);655 733 } 656 734 } … … 661 739 void bDrawYErrors (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object) { 662 740 663 int i, bar ;664 float *x, *y, * dym, *dyp;741 int i, bar, dz, ds, D; 742 float *x, *y, *z, *dym, *dyp; 665 743 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 666 744 double sx0, sy0, sx1, sy1, sz, sx10, sx11; 667 745 746 int scaleSize = (object[0].size < 0); 747 668 748 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); 669 749 mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0); … … 679 759 by = byi + byj; 680 760 681 x = object[0].x; y = object[0].y; dyp = object[0].dyp; dym = object[0].dym; 761 ds = 0.5 * (graphic->dx + graphic->dy) * 0.003 * object[0].size; 762 dz = 0.5 * (graphic->dx + graphic->dy) * 0.010; 763 764 x = object[0].x; y = object[0].y; dyp = object[0].dyp; dym = object[0].dym; z = object[0].z; 682 765 bar = object[0].ebar; sz = object[0].size*graph[0].axis[0].dfx*0.03; 683 766 … … 687 770 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 688 771 772 /// XXX NOTE : D should be modified by (mxi,myi) for tilted axes dx = D*(mxi/mx), dy = D*(myi/mx) 773 689 774 for (i = 0; i < object[0].Npts; i++) { 690 if (!(finite(x[i]) && finite(y[i]) && finite(dyp[i]))) continue; 775 // for open circles, only go to the outer radius 776 D = 0; 777 if (object[0].ptype == 7) { D = scaleSize ? dz*z[i] : ds; } 778 if (object[0].ptype == 1) { D = scaleSize ? dz*z[i] : ds; } 779 if (object[0].ptype == 5) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; } 780 if (object[0].ptype == 15) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; } 781 if (!(finite(x[i]) && finite(y[i]) && finite(dyp[i]))) goto skip_dyp; 782 if (D > fabs(dyp[i]*myj)) goto skip_dyp; 691 783 sx0 = x[i]*mxi + y[i]*mxj + bx; 692 sy0 = x[i]*myi + y[i]*myj + by ;693 sx1 = x[i]*mxi + (y[i] + dyp[i])*mxj + bx;694 sy1 = x[i]*myi + (y[i] + dyp[i])*myj + by;784 sy0 = x[i]*myi + y[i]*myj + by - D; 785 sx1 = sx0 + dyp[i]*mxj; 786 sy1 = sy0 + dyp[i]*myj + D; 695 787 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 696 788 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || … … 699 791 { 700 792 bDrawClipLine (buffer, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 701 // DrawLine (buffer, sx0, sy0, sx1, sy1);702 793 if (bar) { 703 794 sx10 = sx1 - sz; 704 795 sx11 = sx1 + sz; 705 796 bDrawClipLine (buffer, sx10, sy1, sx11, sy1, X0, Y0, X1, Y1); 706 // DrawLine (buffer, sx10, sy1, sx11, sy1); 707 }708 }797 } 798 } 799 skip_dyp: 709 800 if (!(finite(x[i]) && finite(y[i]) && finite(dym[i]))) continue; 801 if (object[0].ptype == 5) { D = scaleSize ? 0.58*dz*z[i] : 0.58*ds; } 802 if (object[0].ptype == 15) { D = scaleSize ? 1.15*dz*z[i] : 1.15*ds; } 803 if (D > fabs(dym[i]*myj)) continue; 710 804 sx0 = x[i]*mxi + y[i]*mxj + bx; 711 sy0 = x[i]*myi + y[i]*myj + by ;712 sx1 = x[i]*mxi + (y[i] - dym[i])*mxj + bx;713 sy1 = x[i]*myi + (y[i] - dym[i])*myj + by;805 sy0 = x[i]*myi + y[i]*myj + by + D; 806 sx1 = sx0 - dym[i]*mxj; 807 sy1 = sy0 - dym[i]*myj - D; 714 808 if (((sx0 > graph[0].axis[0].fx) && (sx0 < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 715 809 (sy0 < graph[0].axis[1].fy) && (sy0 > graph[0].axis[1].fy + graph[0].axis[1].dfy)) || … … 718 812 { 719 813 bDrawClipLine (buffer, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 720 // DrawLine (buffer, sx0, sy0, sx1, sy1);721 814 if (bar) { 722 815 sx10 = sx1 - sz; 723 816 sx11 = sx1 + sz; 724 817 bDrawClipLine (buffer, sx10, sy1, sx11, sy1, X0, Y0, X1, Y1); 725 // DrawLine (buffer, sx10, sy1, sx11, sy1);726 818 } 727 819 } -
trunk/Ohana/src/libautocode/def/measure-ps1-v5.d
r37246 r38062 2 2 EXTNAME DVO_MEASURE_PS1_V5 3 3 TYPE BINTABLE 4 SIZE 2 324 SIZE 240 5 5 DESCRIPTION DVO Detection Measurement Table 6 6 … … 40 40 FIELD XoffDCR, X_OFF_DCR, float, X offset from correction, pixels 41 41 FIELD YoffDCR, Y_OFF_DCR, float, Y offset from correction, pixels 42 FIELD XoffCAM, X_OFF_CAM, float, X offset from correction, pixels 43 FIELD YoffCAM, Y_OFF_CAM, float, Y offset from correction, pixels 42 44 FIELD RoffGAL, R_OFF_GAL, float, RA offset from correction, arcsec 43 45 FIELD DoffGAL, D_OFF_GAL, float, DEC offset from correction, arcsec -
trunk/Ohana/src/libautocode/def/measure.d
r37246 r38062 2 2 EXTNAME DVO_MEASURE 3 3 TYPE BINTABLE 4 SIZE 2 284 SIZE 236 5 5 DESCRIPTION DVO Detection Measurement Table 6 6 … … 40 40 FIELD XoffDCR, X_OFF_DCR, float, X offset from correction, pixels 41 41 FIELD YoffDCR, Y_OFF_DCR, float, Y offset from correction, pixels 42 FIELD XoffCAM, X_OFF_CAM, float, X offset from correction, pixels 43 FIELD YoffCAM, Y_OFF_CAM, float, Y offset from correction, pixels 42 44 FIELD RoffGAL, R_OFF_GAL, float, RA offset from correction, arcsec 43 45 FIELD DoffGAL, D_OFF_GAL, float, DEC offset from correction, arcsec -
trunk/Ohana/src/libdvo/include/dvo.h
r37992 r38062 555 555 Measure *Measure_PS1_V4alt_ToInternal (Average *ave, Measure_PS1_V4alt *in, off_t Nvalues); 556 556 557 typedef struct { 558 double R; // RA at epoch (degrees) 559 double D; // DEC at epoch (degrees) 560 float M; // catalog mag (mag) 561 float dM; // mag error (mag) 562 float Map; // aperture mag (mag) 563 float dMap; // aperture mag (mag) 564 float Mkron; // kron magnitude (mag) 565 float dMkron; // kron magnitude error (mag) 566 float Mcal; // image cal mag (mag) 567 float dMcal; // systematic calibration error (mag) 568 float dt; // exposure time (2.5*log(exptime)) 569 float FluxPSF; // flux from psf fit (counts/sec) 570 float dFluxPSF; // error on psf flux (counts/sec) 571 float FluxKron; // flux from kron ap (counts/sec) 572 float dFluxKron; // error on kron flux (counts/sec) 573 float FluxAp; // flux from ap ap (counts/sec) 574 float dFluxAp; // error on ap flux (counts/sec) 575 float airmass; // (airmass - 1) (airmass) 576 float az; // telescope azimuth 577 float Xccd; // X coord on chip (raw value) (pixels) 578 float Yccd; // Y coord on chip (raw value) (pixels) 579 float Xfix; // X coord after correction (pixels) 580 float Yfix; // Y coord after correction (pixels) 581 float XoffKH; // X offset from correction (pixels) 582 float YoffKH; // Y offset from correction (pixels) 583 float XoffDCR; // X offset from correction (pixels) 584 float YoffDCR; // Y offset from correction (pixels) 585 float RoffGAL; // RA offset from correction (arcsec) 586 float DoffGAL; // DEC offset from correction (arcsec) 587 float Sky; // local estimate of sky flux (counts/sec) 588 float dSky; // local estimate of sky flux (counts/sec) 589 int t; // time in seconds (UNIX) 590 unsigned int averef; // reference to average entry 591 unsigned int detID; // detection ID 592 unsigned int objID; // unique ID for object in table 593 unsigned int catID; // unique ID for table in which object was first realized 594 uint64_t extID; // external ID (eg PSPS detID) 595 unsigned int imageID; // reference to DVO image ID 596 float psfQF; // psf coverage/quality factor 597 float psfQFperf; // psf coverage / quality factor (all mask bits) 598 float psfChisq; // psf fit chisq 599 int psfNdof; // psf degrees of freedom 600 int psfNpix; // psf number of pixels 601 int photFlags2; // flags supplied by photometry program 602 float extNsigma; // Nsigma deviation towards EXT 603 short FWx; // object fwhm major axis (1/100 of pixels) 604 short FWy; // object fwhm minor axis (1/100 of pixels ) 605 short theta; // angle wrt ccd X dir ((0xffff/360) deg) 606 short Mxx; // second moments in pixel coords (1/100 of pixels) 607 short Mxy; // second moments in pixel coords (1/100 of pixels) 608 short Myy; // second moments in pixel coords (1/100 of pixels) 609 unsigned short t_msec; // time fraction of second (milliseconds) 610 unsigned short photcode; // photcode 611 short dXccd; // X coord error on chip (1/100 of pixels) 612 short dYccd; // Y coord error on chip (1/100 of pixels) 613 short dRsys; // systematic error from astrom (1/100 of pixels) 614 short posangle; // position angle sky to chip ((0xffff/360) deg) 615 float pltscale; // plate scale (arcsec/pixel) 616 unsigned int dbFlags; // flags supplied by analysis in database 617 unsigned int photFlags; // flags supplied by photometry program 618 int padding; // padding to ensure 8byte blocks 619 } Measure_PS1_V5alt; 620 621 Measure *Measure_PS1_V5alt_ToInternal (Average *ave, Measure_PS1_V5alt *in, off_t Nvalues); 622 int gfits_convert_Measure_PS1_V5alt (Measure_PS1_V5alt *data, off_t size, off_t nitems); 623 Measure_PS1_V5alt *gfits_table_get_Measure_PS1_V5alt (FTable *ftable, off_t *Ndata, char *swapped); 624 557 625 // alternate version of PS1_V5 (old dev version) 558 626 typedef struct { -
trunk/Ohana/src/libdvo/include/dvodb.h
r37871 r38062 178 178 MEAS_XOFF_DCR, 179 179 MEAS_YOFF_DCR, 180 MEAS_XOFF_CAM, 181 MEAS_YOFF_CAM, 180 182 MEAS_ROFF_GAL, 181 183 MEAS_DOFF_GAL, … … 237 239 MEAS_RA_GALMODEL, // model pm prediction 238 240 MEAS_DEC_GALMODEL, // model pm prediction 239 } ;241 } dvoMeasureType; 240 242 241 243 /* average fields */ … … 289 291 AVE_RA_GALMODEL, // model pm prediction 290 292 AVE_DEC_GALMODEL, // model pm prediction 291 } ;293 } dvoAverageType; 292 294 293 295 // AVE_NPHOT, … … 365 367 IMAGE_REF_COLOR_BLUE, 366 368 IMAGE_REF_COLOR_RED 367 } ;369 } dvoImageType; 368 370 369 371 enum {DVO_TABLE_AVERAGE, DVO_TABLE_MEASURE, DVO_TABLE_IMAGE}; … … 383 385 int extract; 384 386 int table; 385 int ID; 387 int ID; // may be either dvoMeasureType or dvoAverageType 386 388 387 389 dvoMagSourceType magSource; // chip, (forced) warp, stack [only relevant for averages] -
trunk/Ohana/src/libdvo/src/dbExtractAverages.c
r37807 r38062 53 53 54 54 // off_t i; 55 int n; 55 56 dbValue value; 56 57 … … 186 187 case AVE_PHOT: 187 188 // if we request mag:ave, use equiv for photcode (ie a given measure, say GPC1.g.XY01, will return g for mag:ave) 188 if (field->photcode->type == PHOT_MAG) { 189 // this is an error 190 break; 191 } 192 193 // if we ask for 2MASS_K, etc (REF values), return NAN unless measure->code matches 194 if (field->photcode->type == PHOT_REF) { 195 // need to ensure measure exists. 196 break; 197 } 198 199 // if we ask for GPC1.g.XY03:rel, etc (DEP values), return NAN unless measure->code matches 200 if (field->photcode->type == PHOT_DEP) { 201 // again. 202 break; 203 } 204 205 /* in some cases below we need a measurement which matches the requested photcode. 206 here is some sample code to find this. 207 208 for (i = 0; i < average[0].Nmeasure; i++) { 209 if (field->photcode->code != measure[i].photcode) continue; 210 value.Flt = measure[i].M; 211 break; 212 } 213 */ 189 190 // this is an error (no exposed photcodes should be of type PHOT_MAG) 191 if (field->photcode->type == PHOT_MAG) break; 214 192 215 193 switch (field->magOption) { … … 220 198 break; 221 199 case MAG_LEVEL_REF: 222 // which measure is needed here?223 // PhotRef (field->photcode, average, secfilt, measure, field->magClass, field->magSource);224 200 break; 225 201 case MAG_LEVEL_INST: 202 // find an appropriate measure (if one exists) 203 for (n = 0; n < average->Nmeasure; n++) { 204 if (field->photcode->code != measure[n].photcode) continue; 205 value.Flt = PhotInst (&measure[n], field->magClass); 206 break; 207 } 208 break; 226 209 case MAG_LEVEL_CAT: 210 // find an appropriate measure (if one exists) 211 for (n = 0; n < average->Nmeasure; n++) { 212 if (field->photcode->code != measure[n].photcode) continue; 213 value.Flt = PhotCat (&measure[n], field->magClass); 214 break; 215 } 216 break; 227 217 case MAG_LEVEL_SYS: 218 // find an appropriate measure (if one exists) 219 for (n = 0; n < average->Nmeasure; n++) { 220 if (field->photcode->code != measure[n].photcode) continue; 221 value.Flt = PhotSys (&measure[n], average, secfilt, field->magClass); 222 break; 223 } 224 break; 228 225 case MAG_LEVEL_REL: 226 // find an appropriate measure (if one exists) 227 for (n = 0; n < average->Nmeasure; n++) { 228 if (field->photcode->code != measure[n].photcode) continue; 229 value.Flt = PhotRel (&measure[n], average, secfilt, field->magClass); 230 break; 231 } 232 break; 229 233 case MAG_LEVEL_CAL: 230 234 case MAG_LEVEL_NONE: … … 243 247 case MAG_LEVEL_SYS: 244 248 case MAG_LEVEL_REL: 249 // find an appropriate measure (if one exists) 250 for (n = 0; n < average->Nmeasure; n++) { 251 if (field->photcode->code != measure[n].photcode) continue; 252 value.Flt = PhotErr (&measure[n], field->magClass); 253 break; 254 } 255 break; 245 256 case MAG_LEVEL_CAL: 246 257 case MAG_LEVEL_NONE: … … 259 270 break; 260 271 case MAG_LEVEL_INST: 272 // find an appropriate measure (if one exists) 273 for (n = 0; n < average->Nmeasure; n++) { 274 if (field->photcode->code != measure[n].photcode) continue; 275 value.Flt = PhotFluxInst (&measure[n], field->magClass); 276 break; 277 } 278 break; 261 279 case MAG_LEVEL_CAT: 280 // find an appropriate measure (if one exists) 281 for (n = 0; n < average->Nmeasure; n++) { 282 if (field->photcode->code != measure[n].photcode) continue; 283 value.Flt = PhotFluxCat (&measure[n], field->magClass); 284 break; 285 } 286 break; 262 287 case MAG_LEVEL_SYS: 288 // find an appropriate measure (if one exists) 289 for (n = 0; n < average->Nmeasure; n++) { 290 if (field->photcode->code != measure[n].photcode) continue; 291 value.Flt = PhotFluxSys (&measure[n], average, secfilt, field->magClass); 292 break; 293 } 294 break; 263 295 case MAG_LEVEL_REL: 296 // find an appropriate measure (if one exists) 297 for (n = 0; n < average->Nmeasure; n++) { 298 if (field->photcode->code != measure[n].photcode) continue; 299 value.Flt = PhotFluxRel (&measure[n], average, secfilt, field->magClass); 300 break; 301 } 302 break; 264 303 case MAG_LEVEL_CAL: 265 304 case MAG_LEVEL_NONE: … … 278 317 case MAG_LEVEL_SYS: 279 318 case MAG_LEVEL_REL: 319 // find an appropriate measure (if one exists) 320 for (n = 0; n < average->Nmeasure; n++) { 321 if (field->photcode->code != measure[n].photcode) continue; 322 value.Flt = PhotFluxInstErr (&measure[n], field->magClass); 323 break; 324 } 325 break; 280 326 case MAG_LEVEL_CAL: 281 327 case MAG_LEVEL_NONE: -
trunk/Ohana/src/libdvo/src/dbExtractMeasures.c
r37871 r38062 573 573 case MEAS_XOFF_DCR: { value.Flt = measure[0].XoffDCR; break; } 574 574 case MEAS_YOFF_DCR: { value.Flt = measure[0].YoffDCR; break; } 575 case MEAS_XOFF_CAM: { value.Flt = measure[0].XoffCAM; break; } 576 case MEAS_YOFF_CAM: { value.Flt = measure[0].YoffCAM; break; } 575 577 case MEAS_ROFF_GAL: { value.Flt = measure[0].RoffGAL; break; } 576 578 case MEAS_DOFF_GAL: { value.Flt = measure[0].DoffGAL; break; } -
trunk/Ohana/src/libdvo/src/dbFields.c
r37871 r38062 480 480 if (!strcasecmp (fieldName, "XOFF_DCR")) ESCAPE (MEAS_XOFF_DCR, OPIHI_FLT); 481 481 if (!strcasecmp (fieldName, "YOFF_DCR")) ESCAPE (MEAS_YOFF_DCR, OPIHI_FLT); 482 if (!strcasecmp (fieldName, "XOFF_CAM")) ESCAPE (MEAS_XOFF_CAM, OPIHI_FLT); 483 if (!strcasecmp (fieldName, "YOFF_CAM")) ESCAPE (MEAS_YOFF_CAM, OPIHI_FLT); 482 484 if (!strcasecmp (fieldName, "ROFF_GAL")) ESCAPE (MEAS_ROFF_GAL, OPIHI_FLT); 483 485 if (!strcasecmp (fieldName, "DOFF_GAL")) ESCAPE (MEAS_DOFF_GAL, OPIHI_FLT); -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r37995 r38062 273 273 measure->XoffDCR = NAN; 274 274 measure->YoffDCR = NAN; 275 measure->XoffCAM = NAN; 276 measure->YoffCAM = NAN; 275 277 measure->RoffGAL = NAN; 276 278 measure->DoffGAL = NAN; -
trunk/Ohana/src/libdvo/src/dvo_convert.c
r37995 r38062 204 204 free (tmpMeasure); 205 205 *format = DVO_FORMAT_PS1_V4; 206 return (measure); 207 } 208 209 // block to convert PV1_V5_0 tables (PS1_V5 made before the XoffCAM,YoffCAM addition) 210 if (!strcmp (extname, "DVO_MEASURE_PS1_V5") && (ftable[0].header[0].Naxis[0] == 232)) { 211 fprintf (stderr, "reading alt PS1_V5 format\n"); 212 Measure_PS1_V5alt *tmpMeasure; 213 tmpMeasure = gfits_table_get_Measure_PS1_V5alt (ftable, Nmeasure, NULL); 214 if (!tmpMeasure) { 215 fprintf (stderr, "ERROR: failed to read measures\n"); 216 exit (2); 217 } 218 myAssert (average, "conversion to internal needs average table"); 219 measure = Measure_PS1_V5alt_ToInternal (average, tmpMeasure, *Nmeasure); 220 free (tmpMeasure); 221 *format = DVO_FORMAT_PS1_V5; 206 222 return (measure); 207 223 } -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
r37995 r38062 4 4 5 5 Measure *Measure_PS1_V5_ToInternal (Average *ave, Measure_PS1_V5 *in, off_t Nvalues) { 6 7 off_t i; 8 Measure *out; 9 10 ALLOCATE_ZERO (out, Measure, Nvalues); 11 12 for (i = 0; i < Nvalues; i++) { 13 dvo_measure_init (&out[i]); 14 15 out[i].R = in[i].R; 16 out[i].D = in[i].D; 17 out[i].M = in[i].M; 18 out[i].dM = in[i].dM; 19 out[i].Map = in[i].Map; 20 out[i].dMap = in[i].dMap; 21 out[i].Mkron = in[i].Mkron; 22 out[i].dMkron = in[i].dMkron; 23 out[i].Mcal = in[i].Mcal; 24 out[i].dMcal = in[i].dMcal; 25 out[i].dt = in[i].dt; 26 out[i].FluxPSF = in[i].FluxPSF; 27 out[i].dFluxPSF = in[i].dFluxPSF; 28 out[i].FluxKron = in[i].FluxKron; 29 out[i].dFluxKron = in[i].dFluxKron; 30 out[i].FluxAp = in[i].FluxAp; 31 out[i].dFluxAp = in[i].dFluxAp; 32 out[i].airmass = in[i].airmass; 33 out[i].az = in[i].az; 34 out[i].Xccd = in[i].Xccd; 35 out[i].Yccd = in[i].Yccd; 36 out[i].Xfix = in[i].Xfix; 37 out[i].Yfix = in[i].Yfix; 38 out[i].XoffKH = in[i].XoffKH; 39 out[i].YoffKH = in[i].YoffKH; 40 out[i].XoffDCR = in[i].XoffDCR; 41 out[i].YoffDCR = in[i].YoffDCR; 42 out[i].XoffCAM = in[i].XoffCAM; 43 out[i].YoffCAM = in[i].YoffCAM; 44 out[i].RoffGAL = in[i].RoffGAL; 45 out[i].DoffGAL = in[i].DoffGAL; 46 out[i].Sky = in[i].Sky; 47 out[i].dSky = in[i].dSky; 48 out[i].t = in[i].t; 49 out[i].averef = in[i].averef; 50 out[i].detID = in[i].detID; 51 out[i].objID = in[i].objID; 52 out[i].catID = in[i].catID; 53 out[i].extID = in[i].extID; 54 out[i].imageID = in[i].imageID; 55 out[i].psfQF = in[i].psfQF; 56 out[i].psfQFperf = in[i].psfQFperf; 57 out[i].psfChisq = in[i].psfChisq; 58 out[i].psfNdof = in[i].psfNdof; 59 out[i].psfNpix = in[i].psfNpix; 60 out[i].extNsigma = in[i].extNsigma; 61 out[i].FWx = in[i].FWx; 62 out[i].FWy = in[i].FWy; 63 out[i].theta = in[i].theta; 64 out[i].Mxx = in[i].Mxx; 65 out[i].Mxy = in[i].Mxy; 66 out[i].Myy = in[i].Myy; 67 out[i].t_msec = in[i].t_msec; 68 out[i].photcode = in[i].photcode; 69 out[i].dXccd = in[i].dXccd; 70 out[i].dYccd = in[i].dYccd; 71 out[i].dRsys = in[i].dRsys; 72 out[i].posangle = in[i].posangle; 73 out[i].pltscale = in[i].pltscale; 74 out[i].dbFlags = in[i].dbFlags; 75 out[i].photFlags = in[i].photFlags; 76 out[i].photFlags2 = in[i].photFlags2; 77 } 78 return (out); 79 } 80 81 Measure_PS1_V5 *MeasureInternalTo_PS1_V5 (Average *ave, Measure *in, off_t Nvalues) { 82 83 off_t i; 84 Measure_PS1_V5 *out; 85 86 ALLOCATE_ZERO (out, Measure_PS1_V5, Nvalues); 87 88 for (i = 0; i < Nvalues; i++) { 89 out[i].R = in[i].R; 90 out[i].D = in[i].D; 91 out[i].M = in[i].M; 92 out[i].dM = in[i].dM; 93 out[i].Map = in[i].Map; 94 out[i].dMap = in[i].dMap; 95 out[i].Mkron = in[i].Mkron; 96 out[i].dMkron = in[i].dMkron; 97 out[i].Mcal = in[i].Mcal; 98 out[i].dMcal = in[i].dMcal; 99 out[i].dt = in[i].dt; 100 out[i].FluxPSF = in[i].FluxPSF; 101 out[i].dFluxPSF = in[i].dFluxPSF; 102 out[i].FluxKron = in[i].FluxKron; 103 out[i].dFluxKron = in[i].dFluxKron; 104 out[i].FluxAp = in[i].FluxAp; 105 out[i].dFluxAp = in[i].dFluxAp; 106 out[i].airmass = in[i].airmass; 107 out[i].az = in[i].az; 108 out[i].Xccd = in[i].Xccd; 109 out[i].Yccd = in[i].Yccd; 110 out[i].Xfix = in[i].Xfix; 111 out[i].Yfix = in[i].Yfix; 112 out[i].XoffKH = in[i].XoffKH; 113 out[i].YoffKH = in[i].YoffKH; 114 out[i].XoffDCR = in[i].XoffDCR; 115 out[i].YoffDCR = in[i].YoffDCR; 116 out[i].XoffCAM = in[i].XoffCAM; 117 out[i].YoffCAM = in[i].YoffCAM; 118 out[i].RoffGAL = in[i].RoffGAL; 119 out[i].DoffGAL = in[i].DoffGAL; 120 out[i].Sky = in[i].Sky; 121 out[i].dSky = in[i].dSky; 122 out[i].t = in[i].t; 123 out[i].averef = in[i].averef; 124 out[i].detID = in[i].detID; 125 out[i].objID = in[i].objID; 126 out[i].catID = in[i].catID; 127 out[i].extID = in[i].extID; 128 out[i].imageID = in[i].imageID; 129 out[i].psfQF = in[i].psfQF; 130 out[i].psfQFperf = in[i].psfQFperf; 131 out[i].psfChisq = in[i].psfChisq; 132 out[i].psfNdof = in[i].psfNdof; 133 out[i].psfNpix = in[i].psfNpix; 134 out[i].extNsigma = in[i].extNsigma; 135 out[i].FWx = in[i].FWx; 136 out[i].FWy = in[i].FWy; 137 out[i].theta = in[i].theta; 138 out[i].Mxx = in[i].Mxx; 139 out[i].Mxy = in[i].Mxy; 140 out[i].Myy = in[i].Myy; 141 out[i].t_msec = in[i].t_msec; 142 out[i].photcode = in[i].photcode; 143 out[i].dXccd = in[i].dXccd; 144 out[i].dYccd = in[i].dYccd; 145 out[i].dRsys = in[i].dRsys; 146 out[i].posangle = in[i].posangle; 147 out[i].pltscale = in[i].pltscale; 148 out[i].dbFlags = in[i].dbFlags; 149 out[i].photFlags = in[i].photFlags; 150 out[i].photFlags2 = in[i].photFlags2; 151 } 152 return (out); 153 } 154 155 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 156 Average *Average_PS1_V5_ToInternal (Average_PS1_V5 *in, off_t Nvalues, SecFilt **primary) { 157 158 off_t i; 159 Average *out; 160 161 ALLOCATE_ZERO (out, Average, Nvalues); 162 163 for (i = 0; i < Nvalues; i++) { 164 dvo_average_init (&out[i]); 165 166 out[i].R = in[i].R; 167 out[i].D = in[i].D; 168 out[i].dR = in[i].dR; 169 out[i].dD = in[i].dD; 170 out[i].uR = in[i].uR; 171 out[i].uD = in[i].uD; 172 out[i].duR = in[i].duR; 173 out[i].duD = in[i].duD; 174 out[i].P = in[i].P; 175 out[i].dP = in[i].dP; 176 177 out[i].Rstk = in[i].Rstk; 178 out[i].Dstk = in[i].Dstk; 179 out[i].dRstk = in[i].dRstk; 180 out[i].dDstk = in[i].dDstk; 181 182 out[i].ChiSqAve = in[i].ChiSqAve; 183 out[i].ChiSqPM = in[i].ChiSqPM; 184 out[i].ChiSqPar = in[i].ChiSqPar; 185 out[i].Tmean = in[i].Tmean; 186 out[i].Trange = in[i].Trange; 187 188 out[i].psfQF = in[i].psfQF; 189 out[i].psfQFperf = in[i].psfQFperf; 190 out[i].stargal = in[i].stargal; 191 out[i].Npos = in[i].Npos; 192 193 out[i].Nmeasure = in[i].Nmeasure; 194 out[i].Nmissing = in[i].Nmissing; 195 out[i].Nlensing = in[i].Nlensing; 196 out[i].Nlensobj = in[i].Nlensobj; 197 out[i].Nstarpar = in[i].Nstarpar; 198 out[i].Nextend = in[i].Nextend; 199 200 out[i].measureOffset = in[i].measureOffset; 201 out[i].missingOffset = in[i].missingOffset; 202 out[i].lensingOffset = in[i].lensingOffset; 203 out[i].lensobjOffset = in[i].lensobjOffset; 204 out[i].starparOffset = in[i].starparOffset; 205 out[i].extendOffset = in[i].extendOffset; 206 207 out[i].refColorBlue = in[i].refColorBlue; 208 out[i].refColorRed = in[i].refColorRed; 209 210 out[i].tessID = in[i].tessID; 211 out[i].skycellID = in[i].skycellID; 212 out[i].projectionID = in[i].projectionID; 213 214 out[i].flags = in[i].flags; 215 out[i].photFlagsUpper = in[i].photFlagsUpper; 216 out[i].photFlagsLower = in[i].photFlagsLower; 217 out[i].objID = in[i].objID; 218 out[i].catID = in[i].catID; 219 out[i].extID = in[i].extID; 220 out[i].extIDgc = in[i].extIDgc; 221 } 222 return (out); 223 } 224 225 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 226 Average_PS1_V5 *AverageInternalTo_PS1_V5 (Average *in, off_t Nvalues, SecFilt *primary) { 227 228 off_t i; 229 Average_PS1_V5 *out; 230 231 ALLOCATE_ZERO (out, Average_PS1_V5, Nvalues); 232 233 for (i = 0; i < Nvalues; i++) { 234 out[i].R = in[i].R; 235 out[i].D = in[i].D; 236 out[i].dR = in[i].dR; 237 out[i].dD = in[i].dD; 238 out[i].uR = in[i].uR; 239 out[i].uD = in[i].uD; 240 out[i].duR = in[i].duR; 241 out[i].duD = in[i].duD; 242 out[i].P = in[i].P; 243 out[i].dP = in[i].dP; 244 245 out[i].Rstk = in[i].Rstk; 246 out[i].Dstk = in[i].Dstk; 247 out[i].dRstk = in[i].dRstk; 248 out[i].dDstk = in[i].dDstk; 249 250 out[i].ChiSqAve = in[i].ChiSqAve; 251 out[i].ChiSqPM = in[i].ChiSqPM; 252 out[i].ChiSqPar = in[i].ChiSqPar; 253 out[i].Tmean = in[i].Tmean; 254 out[i].Trange = in[i].Trange; 255 256 out[i].psfQF = in[i].psfQF; 257 out[i].psfQFperf = in[i].psfQFperf; 258 out[i].stargal = in[i].stargal; 259 out[i].Npos = in[i].Npos; 260 261 out[i].Nmeasure = in[i].Nmeasure; 262 out[i].Nmissing = in[i].Nmissing; 263 out[i].Nlensing = in[i].Nlensing; 264 out[i].Nlensobj = in[i].Nlensobj; 265 out[i].Nstarpar = in[i].Nstarpar; 266 out[i].Nextend = in[i].Nextend; 267 268 out[i].measureOffset = in[i].measureOffset; 269 out[i].missingOffset = in[i].missingOffset; 270 out[i].lensingOffset = in[i].lensingOffset; 271 out[i].lensobjOffset = in[i].lensobjOffset; 272 out[i].starparOffset = in[i].starparOffset; 273 out[i].extendOffset = in[i].extendOffset; 274 275 out[i].refColorBlue = in[i].refColorBlue; 276 out[i].refColorRed = in[i].refColorRed; 277 278 out[i].tessID = in[i].tessID; 279 out[i].skycellID = in[i].skycellID; 280 out[i].projectionID = in[i].projectionID; 281 282 out[i].flags = in[i].flags; 283 out[i].photFlagsUpper = in[i].photFlagsUpper; 284 out[i].photFlagsLower = in[i].photFlagsLower; 285 out[i].objID = in[i].objID; 286 out[i].catID = in[i].catID; 287 out[i].extID = in[i].extID; 288 out[i].extIDgc = in[i].extIDgc; 289 } 290 return (out); 291 } 292 293 SecFilt *SecFilt_PS1_V5_ToInternal (SecFilt_PS1_V5 *in, off_t Nvalues) { 294 295 off_t i; 296 SecFilt *out; 297 298 ALLOCATE_ZERO (out, SecFilt, Nvalues); 299 300 for (i = 0; i < Nvalues; i++) { 301 dvo_secfilt_init (&out[i]); 302 303 out[i].M = in[i].M; 304 out[i].dM = in[i].dM; 305 out[i].Map = in[i].Map; 306 out[i].dMap = in[i].dMap; 307 out[i].sMap = in[i].sMap; 308 out[i].Mkron = in[i].Mkron; 309 out[i].dMkron = in[i].dMkron; 310 out[i].sMkron = in[i].sMkron; 311 312 out[i].psfQfMax = in[i].psfQfMax; 313 out[i].psfQfPerfMax = in[i].psfQfPerfMax; 314 315 out[i].Mstdev = in[i].Mstdev; 316 out[i].Mmin = in[i].Mmin; 317 out[i].Mmax = in[i].Mmax; 318 out[i].Mchisq = in[i].Mchisq; 319 320 out[i].Ncode = in[i].Ncode; 321 out[i].Nused = in[i].Nused; 322 out[i].NusedKron = in[i].NusedKron; 323 out[i].NusedAp = in[i].NusedAp; 324 325 out[i].flags = in[i].flags; 326 327 out[i].MpsfStk = in[i].MpsfStk; 328 out[i].FpsfStk = in[i].FpsfStk; 329 out[i].dFpsfStk = in[i].dFpsfStk; 330 331 out[i].MkronStk = in[i].MkronStk; 332 out[i].FkronStk = in[i].FkronStk; 333 out[i].dFkronStk = in[i].dFkronStk; 334 335 out[i].MapStk = in[i].MapStk; 336 out[i].FapStk = in[i].FapStk; 337 out[i].dFapStk = in[i].dFapStk; 338 339 out[i].Nstack = in[i].Nstack; 340 out[i].NstackDet = in[i].NstackDet; 341 342 out[i].stackPrmryOff = in[i].stackPrmryOff; 343 out[i].stackBestOff = in[i].stackBestOff; 344 345 out[i].MpsfWrp = in[i].MpsfWrp; 346 out[i].FpsfWrp = in[i].FpsfWrp; 347 out[i].dFpsfWrp = in[i].dFpsfWrp; 348 out[i].sFpsfWrp = in[i].sFpsfWrp; 349 350 out[i].MkronWrp = in[i].MkronWrp; 351 out[i].FkronWrp = in[i].FkronWrp; 352 out[i].dFkronWrp = in[i].dFkronWrp; 353 out[i].sFkronWrp = in[i].sFkronWrp; 354 355 out[i].MapWrp = in[i].MapWrp; 356 out[i].FapWrp = in[i].FapWrp; 357 out[i].dFapWrp = in[i].dFapWrp; 358 out[i].sFapWrp = in[i].sFapWrp; 359 360 out[i].NusedWrp = in[i].NusedWrp; 361 out[i].NusedKronWrp = in[i].NusedKronWrp; 362 out[i].NusedApWrp = in[i].NusedApWrp; 363 364 out[i].Nwarp = in[i].Nwarp; 365 out[i].NwarpGood = in[i].NwarpGood; 366 367 out[i].ubercalDist = in[i].ubercalDist; 368 } 369 return (out); 370 } 371 372 SecFilt_PS1_V5 *SecFiltInternalTo_PS1_V5 (SecFilt *in, off_t Nvalues) { 373 374 off_t i; 375 SecFilt_PS1_V5 *out; 376 377 ALLOCATE_ZERO (out, SecFilt_PS1_V5, Nvalues); 378 379 for (i = 0; i < Nvalues; i++) { 380 381 out[i].M = in[i].M; 382 out[i].dM = in[i].dM; 383 out[i].Map = in[i].Map; 384 out[i].dMap = in[i].dMap; 385 out[i].sMap = in[i].sMap; 386 out[i].Mkron = in[i].Mkron; 387 out[i].dMkron = in[i].dMkron; 388 out[i].sMkron = in[i].sMkron; 389 390 out[i].psfQfMax = in[i].psfQfMax; 391 out[i].psfQfPerfMax = in[i].psfQfPerfMax; 392 393 out[i].Mstdev = in[i].Mstdev; 394 out[i].Mmin = in[i].Mmin; 395 out[i].Mmax = in[i].Mmax; 396 out[i].Mchisq = in[i].Mchisq; 397 398 out[i].Ncode = in[i].Ncode; 399 out[i].Nused = in[i].Nused; 400 out[i].NusedKron = in[i].NusedKron; 401 out[i].NusedAp = in[i].NusedAp; 402 403 out[i].flags = in[i].flags; 404 405 out[i].MpsfStk = in[i].MpsfStk; 406 out[i].FpsfStk = in[i].FpsfStk; 407 out[i].dFpsfStk = in[i].dFpsfStk; 408 409 out[i].MkronStk = in[i].MkronStk; 410 out[i].FkronStk = in[i].FkronStk; 411 out[i].dFkronStk = in[i].dFkronStk; 412 413 out[i].MapStk = in[i].MapStk; 414 out[i].FapStk = in[i].FapStk; 415 out[i].dFapStk = in[i].dFapStk; 416 417 out[i].Nstack = in[i].Nstack; 418 out[i].NstackDet = in[i].NstackDet; 419 420 out[i].stackPrmryOff = in[i].stackPrmryOff; 421 out[i].stackBestOff = in[i].stackBestOff; 422 423 out[i].MpsfWrp = in[i].MpsfWrp; 424 out[i].FpsfWrp = in[i].FpsfWrp; 425 out[i].dFpsfWrp = in[i].dFpsfWrp; 426 out[i].sFpsfWrp = in[i].sFpsfWrp; 427 428 out[i].MkronWrp = in[i].MkronWrp; 429 out[i].FkronWrp = in[i].FkronWrp; 430 out[i].dFkronWrp = in[i].dFkronWrp; 431 out[i].sFkronWrp = in[i].sFkronWrp; 432 433 out[i].MapWrp = in[i].MapWrp; 434 out[i].FapWrp = in[i].FapWrp; 435 out[i].dFapWrp = in[i].dFapWrp; 436 out[i].sFapWrp = in[i].sFapWrp; 437 438 out[i].NusedWrp = in[i].NusedWrp; 439 out[i].NusedKronWrp = in[i].NusedKronWrp; 440 out[i].NusedApWrp = in[i].NusedApWrp; 441 442 out[i].Nwarp = in[i].Nwarp; 443 out[i].NwarpGood = in[i].NwarpGood; 444 445 out[i].ubercalDist = in[i].ubercalDist; 446 } 447 return (out); 448 } 449 450 Lensing *Lensing_PS1_V5_R2_ToInternal (Lensing_PS1_V5_R2 *in, off_t Nvalues) { 451 452 off_t i; 453 Lensing *out; 454 455 ALLOCATE_ZERO (out, Lensing, Nvalues); 456 457 for (i = 0; i < Nvalues; i++) { 458 dvo_lensing_init (&out[i]); 459 460 out[i].X11_sm_obj = in[i].X11_sm_obj; 461 out[i].X12_sm_obj = in[i].X12_sm_obj; 462 out[i].X22_sm_obj = in[i].X22_sm_obj; 463 out[i].E1_sm_obj = in[i].E1_sm_obj; 464 out[i].E2_sm_obj = in[i].E2_sm_obj; 465 466 out[i].X11_sh_obj = in[i].X11_sh_obj; 467 out[i].X12_sh_obj = in[i].X12_sh_obj; 468 out[i].X22_sh_obj = in[i].X22_sh_obj; 469 out[i].E1_sh_obj = in[i].E1_sh_obj; 470 out[i].E2_sh_obj = in[i].E2_sh_obj; 471 472 out[i].X11_sm_psf = in[i].X11_sm_psf; 473 out[i].X12_sm_psf = in[i].X12_sm_psf; 474 out[i].X22_sm_psf = in[i].X22_sm_psf; 475 out[i].E1_sm_psf = in[i].E1_sm_psf; 476 out[i].E2_sm_psf = in[i].E2_sm_psf; 477 478 out[i].X11_sh_psf = in[i].X11_sh_psf; 479 out[i].X12_sh_psf = in[i].X12_sh_psf; 480 out[i].X22_sh_psf = in[i].X22_sh_psf; 481 out[i].E1_sh_psf = in[i].E1_sh_psf; 482 out[i].E2_sh_psf = in[i].E2_sh_psf; 483 484 out[i].E1_psf = in[i].E1_psf; 485 out[i].E2_psf = in[i].E2_psf; 486 487 out[i].F_ApR5 = in[i].F_ApR5; 488 out[i].dF_ApR5 = in[i].dF_ApR5; 489 out[i].sF_ApR5 = in[i].sF_ApR5; 490 out[i].fF_ApR5 = in[i].fF_ApR5; 491 492 out[i].F_ApR6 = in[i].F_ApR6; 493 out[i].dF_ApR6 = in[i].dF_ApR6; 494 out[i].sF_ApR6 = in[i].sF_ApR6; 495 out[i].fF_ApR6 = in[i].fF_ApR6; 496 497 out[i].detID = in[i].detID; 498 out[i].objID = in[i].objID; 499 out[i].catID = in[i].catID; 500 out[i].averef = in[i].averef; 501 502 out[i].imageID = in[i].imageID; 503 } 504 return (out); 505 } 506 507 Lensing_PS1_V5_R2 *LensingInternalTo_PS1_V5_R2 (Lensing *in, off_t Nvalues) { 508 509 off_t i; 510 Lensing_PS1_V5_R2 *out; 511 512 ALLOCATE_ZERO (out, Lensing_PS1_V5, Nvalues); 513 514 for (i = 0; i < Nvalues; i++) { 515 516 out[i].X11_sm_obj = in[i].X11_sm_obj; 517 out[i].X12_sm_obj = in[i].X12_sm_obj; 518 out[i].X22_sm_obj = in[i].X22_sm_obj; 519 out[i].E1_sm_obj = in[i].E1_sm_obj; 520 out[i].E2_sm_obj = in[i].E2_sm_obj; 521 522 out[i].X11_sh_obj = in[i].X11_sh_obj; 523 out[i].X12_sh_obj = in[i].X12_sh_obj; 524 out[i].X22_sh_obj = in[i].X22_sh_obj; 525 out[i].E1_sh_obj = in[i].E1_sh_obj; 526 out[i].E2_sh_obj = in[i].E2_sh_obj; 527 528 out[i].X11_sm_psf = in[i].X11_sm_psf; 529 out[i].X12_sm_psf = in[i].X12_sm_psf; 530 out[i].X22_sm_psf = in[i].X22_sm_psf; 531 out[i].E1_sm_psf = in[i].E1_sm_psf; 532 out[i].E2_sm_psf = in[i].E2_sm_psf; 533 534 out[i].X11_sh_psf = in[i].X11_sh_psf; 535 out[i].X12_sh_psf = in[i].X12_sh_psf; 536 out[i].X22_sh_psf = in[i].X22_sh_psf; 537 out[i].E1_sh_psf = in[i].E1_sh_psf; 538 out[i].E2_sh_psf = in[i].E2_sh_psf; 539 540 out[i].E1_psf = in[i].E1_psf; 541 out[i].E2_psf = in[i].E2_psf; 542 543 out[i].F_ApR5 = in[i].F_ApR5; 544 out[i].dF_ApR5 = in[i].dF_ApR5; 545 out[i].sF_ApR5 = in[i].sF_ApR5; 546 out[i].fF_ApR5 = in[i].fF_ApR5; 547 548 out[i].F_ApR6 = in[i].F_ApR6; 549 out[i].dF_ApR6 = in[i].dF_ApR6; 550 out[i].sF_ApR6 = in[i].sF_ApR6; 551 out[i].fF_ApR6 = in[i].fF_ApR6; 552 553 out[i].detID = in[i].detID; 554 out[i].objID = in[i].objID; 555 out[i].catID = in[i].catID; 556 out[i].averef = in[i].averef; 557 558 out[i].imageID = in[i].imageID; 559 } 560 return (out); 561 } 562 563 Lensobj *Lensobj_PS1_V5_ToInternal (Lensobj_PS1_V5 *in, off_t Nvalues) { 564 565 off_t i; 566 Lensobj *out; 567 568 ALLOCATE_ZERO (out, Lensobj, Nvalues); 569 570 for (i = 0; i < Nvalues; i++) { 571 dvo_lensobj_init (&out[i], FALSE); 572 573 out[i].X11_sm_obj = in[i].X11_sm_obj; 574 out[i].X12_sm_obj = in[i].X12_sm_obj; 575 out[i].X22_sm_obj = in[i].X22_sm_obj; 576 out[i].E1_sm_obj = in[i].E1_sm_obj; 577 out[i].E2_sm_obj = in[i].E2_sm_obj; 578 579 out[i].X11_sh_obj = in[i].X11_sh_obj; 580 out[i].X12_sh_obj = in[i].X12_sh_obj; 581 out[i].X22_sh_obj = in[i].X22_sh_obj; 582 out[i].E1_sh_obj = in[i].E1_sh_obj; 583 out[i].E2_sh_obj = in[i].E2_sh_obj; 584 585 out[i].X11_sm_psf = in[i].X11_sm_psf; 586 out[i].X12_sm_psf = in[i].X12_sm_psf; 587 out[i].X22_sm_psf = in[i].X22_sm_psf; 588 out[i].E1_sm_psf = in[i].E1_sm_psf; 589 out[i].E2_sm_psf = in[i].E2_sm_psf; 590 591 out[i].X11_sh_psf = in[i].X11_sh_psf; 592 out[i].X12_sh_psf = in[i].X12_sh_psf; 593 out[i].X22_sh_psf = in[i].X22_sh_psf; 594 out[i].E1_sh_psf = in[i].E1_sh_psf; 595 out[i].E2_sh_psf = in[i].E2_sh_psf; 596 597 out[i].F_ApR5 = in[i].F_ApR5; 598 out[i].dF_ApR5 = in[i].dF_ApR5; 599 out[i].sF_ApR5 = in[i].sF_ApR5; 600 out[i].fF_ApR5 = in[i].fF_ApR5; 601 602 out[i].F_ApR6 = in[i].F_ApR6; 603 out[i].dF_ApR6 = in[i].dF_ApR6; 604 out[i].sF_ApR6 = in[i].sF_ApR6; 605 out[i].fF_ApR6 = in[i].fF_ApR6; 606 607 out[i].gamma = in[i].gamma; 608 out[i].E1 = in[i].E1; 609 out[i].E2 = in[i].E2; 610 611 out[i].objID = in[i].objID; 612 out[i].catID = in[i].catID; 613 614 out[i].photcode = in[i].photcode; 615 out[i].Nmeas = in[i].Nmeas; 616 } 617 return (out); 618 } 619 620 Lensobj_PS1_V5 *LensobjInternalTo_PS1_V5 (Lensobj *in, off_t Nvalues) { 621 622 off_t i; 623 Lensobj_PS1_V5 *out; 624 625 ALLOCATE_ZERO (out, Lensobj_PS1_V5, Nvalues); 626 627 for (i = 0; i < Nvalues; i++) { 628 629 out[i].X11_sm_obj = in[i].X11_sm_obj; 630 out[i].X12_sm_obj = in[i].X12_sm_obj; 631 out[i].X22_sm_obj = in[i].X22_sm_obj; 632 out[i].E1_sm_obj = in[i].E1_sm_obj; 633 out[i].E2_sm_obj = in[i].E2_sm_obj; 634 635 out[i].X11_sh_obj = in[i].X11_sh_obj; 636 out[i].X12_sh_obj = in[i].X12_sh_obj; 637 out[i].X22_sh_obj = in[i].X22_sh_obj; 638 out[i].E1_sh_obj = in[i].E1_sh_obj; 639 out[i].E2_sh_obj = in[i].E2_sh_obj; 640 641 out[i].X11_sm_psf = in[i].X11_sm_psf; 642 out[i].X12_sm_psf = in[i].X12_sm_psf; 643 out[i].X22_sm_psf = in[i].X22_sm_psf; 644 out[i].E1_sm_psf = in[i].E1_sm_psf; 645 out[i].E2_sm_psf = in[i].E2_sm_psf; 646 647 out[i].X11_sh_psf = in[i].X11_sh_psf; 648 out[i].X12_sh_psf = in[i].X12_sh_psf; 649 out[i].X22_sh_psf = in[i].X22_sh_psf; 650 out[i].E1_sh_psf = in[i].E1_sh_psf; 651 out[i].E2_sh_psf = in[i].E2_sh_psf; 652 653 out[i].F_ApR5 = in[i].F_ApR5; 654 out[i].dF_ApR5 = in[i].dF_ApR5; 655 out[i].sF_ApR5 = in[i].sF_ApR5; 656 out[i].fF_ApR5 = in[i].fF_ApR5; 657 658 out[i].F_ApR6 = in[i].F_ApR6; 659 out[i].dF_ApR6 = in[i].dF_ApR6; 660 out[i].sF_ApR6 = in[i].sF_ApR6; 661 out[i].fF_ApR6 = in[i].fF_ApR6; 662 663 out[i].gamma = in[i].gamma; 664 out[i].E1 = in[i].E1; 665 out[i].E2 = in[i].E2; 666 667 out[i].objID = in[i].objID; 668 out[i].catID = in[i].catID; 669 670 out[i].photcode = in[i].photcode; 671 out[i].Nmeas = in[i].Nmeas; 672 } 673 return (out); 674 } 675 676 StarPar *StarPar_PS1_V5_ToInternal (StarPar_PS1_V5 *in, off_t Nvalues) { 677 678 off_t i; 679 StarPar *out; 680 681 ALLOCATE_ZERO (out, StarPar, Nvalues); 682 683 for (i = 0; i < Nvalues; i++) { 684 dvo_starpar_init (&out[i]); 685 686 out[i].R = in[i].R; 687 out[i].D = in[i].D; 688 out[i].galLat = in[i].galLat; 689 out[i].galLon = in[i].galLon; 690 691 out[i].Ebv = in[i].Ebv ; 692 out[i].dEbv = in[i].dEbv ; 693 out[i].DistMag = in[i].DistMag ; 694 out[i].dDistMag = in[i].dDistMag; 695 out[i].M_r = in[i].M_r ; 696 out[i].dM_r = in[i].dM_r ; 697 out[i].FeH = in[i].FeH ; 698 out[i].dFeH = in[i].dFeH ; 699 out[i].uRA = in[i].uRA ; 700 out[i].uDEC = in[i].uDEC ; 701 702 out[i].averef = in[i].averef; 703 out[i].objID = in[i].objID ; 704 out[i].catID = in[i].catID ; 705 } 706 return (out); 707 } 708 709 StarPar_PS1_V5 *StarParInternalTo_PS1_V5 (StarPar *in, off_t Nvalues) { 710 711 off_t i; 712 StarPar_PS1_V5 *out; 713 714 ALLOCATE_ZERO (out, StarPar_PS1_V5, Nvalues); 715 716 for (i = 0; i < Nvalues; i++) { 717 718 out[i].R = in[i].R; 719 out[i].D = in[i].D; 720 out[i].galLat = in[i].galLat; 721 out[i].galLon = in[i].galLon; 722 723 out[i].Ebv = in[i].Ebv ; 724 out[i].dEbv = in[i].dEbv ; 725 out[i].DistMag = in[i].DistMag ; 726 out[i].dDistMag = in[i].dDistMag; 727 out[i].M_r = in[i].M_r ; 728 out[i].dM_r = in[i].dM_r ; 729 out[i].FeH = in[i].FeH ; 730 out[i].dFeH = in[i].dFeH ; 731 out[i].uRA = in[i].uRA ; 732 out[i].uDEC = in[i].uDEC ; 733 734 out[i].averef = in[i].averef; 735 out[i].objID = in[i].objID ; 736 out[i].catID = in[i].catID ; 737 } 738 return (out); 739 } 740 741 # define RAW_IMAGE_NAME_LEN 117 742 743 Image *Image_PS1_V5_ToInternal (Image_PS1_V5 *in, off_t Nvalues, off_t Nalloc) { 744 745 off_t i; 746 Image *out; 747 748 char *buffer; 749 ALLOCATE_ZERO (buffer, char, Nalloc); 750 out = (Image *) buffer; 751 // ALLOCATE_ZERO (out, Image, Nvalues); 752 753 for (i = 0; i < Nvalues; i++) { 754 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 755 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 756 out[i].coords.mosaic = NULL; 757 out[i].coords.offsetMap = NULL; 758 759 // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN 760 strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1); 761 out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination 762 763 out[i].tzero = in[i].tzero; 764 out[i].nstar = in[i].nstar; 765 out[i].secz = in[i].secz; 766 out[i].NX = in[i].NX; 767 out[i].NY = in[i].NY; 768 out[i].apmifit = in[i].apmifit; 769 out[i].dapmifit = in[i].dapmifit; 770 out[i].Mcal = in[i].Mcal; 771 out[i].dMcal = in[i].dMcal; 772 out[i].Xm = in[i].Xm; 773 out[i].photcode = in[i].photcode; 774 out[i].exptime = in[i].exptime; 775 out[i].sidtime = in[i].sidtime; 776 out[i].latitude = in[i].latitude; 777 778 out[i].RAo = in[i].RAo; 779 out[i].DECo = in[i].DECo; 780 out[i].Radius = in[i].Radius; 781 out[i].refColorBlue = in[i].refColorBlue; 782 out[i].refColorRed = in[i].refColorRed; 783 784 out[i].detection_limit = in[i].detection_limit; 785 out[i].saturation_limit = in[i].saturation_limit; 786 out[i].cerror = in[i].cerror; 787 out[i].fwhm_x = in[i].fwhm_x; 788 out[i].fwhm_y = in[i].fwhm_y; 789 out[i].trate = in[i].trate; 790 out[i].ccdnum = in[i].ccdnum; 791 out[i].flags = in[i].flags; 792 out[i].imageID = in[i].imageID; 793 out[i].parentID = in[i].parentID; 794 out[i].externID = in[i].externID; 795 out[i].sourceID = in[i].sourceID; 796 797 // as of 2011.02.03, the old Mx,My,..., Mxxxx,Myyyy have been deprecated and replaced 798 // with the following. (no real databases used those values -- see 799 // libdvo/doc/dvo-images.txt) 800 out[i].nLinkAstrom = in[i].nLinkAstrom; 801 out[i].nLinkPhotom = in[i].nLinkPhotom; 802 out[i].ubercalDist = in[i].ubercalDist; 803 out[i].dXpixSys = in[i].dXpixSys; 804 out[i].dYpixSys = in[i].dYpixSys; 805 out[i].dMagSys = in[i].dMagSys; 806 out[i].nFitAstrom = in[i].nFitAstrom; 807 out[i].nFitPhotom = in[i].nFitPhotom; 808 out[i].photom_map_id = in[i].photom_map_id; 809 out[i].astrom_map_id = in[i].astrom_map_id; 810 } 811 return (out); 812 } 813 814 Image_PS1_V5 *ImageInternalTo_PS1_V5 (Image *in, off_t Nvalues) { 815 816 off_t i; 817 Image_PS1_V5 *out; 818 819 ALLOCATE_ZERO (out, Image_PS1_V5, Nvalues); 820 821 for (i = 0; i < Nvalues; i++) { 822 // this is only save because the initial 120 bytes in Coords match CoordsDisk 823 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 824 825 // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN 826 strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1); 827 out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination 828 829 out[i].tzero = in[i].tzero; 830 out[i].nstar = in[i].nstar; 831 out[i].secz = in[i].secz; 832 out[i].NX = in[i].NX; 833 out[i].NY = in[i].NY; 834 out[i].apmifit = in[i].apmifit; 835 out[i].dapmifit = in[i].dapmifit; 836 out[i].Mcal = in[i].Mcal; 837 out[i].dMcal = in[i].dMcal; 838 out[i].Xm = in[i].Xm; 839 out[i].photcode = in[i].photcode; 840 out[i].exptime = in[i].exptime; 841 out[i].sidtime = in[i].sidtime; 842 out[i].latitude = in[i].latitude; 843 844 out[i].RAo = in[i].RAo; 845 out[i].DECo = in[i].DECo; 846 out[i].Radius = in[i].Radius; 847 out[i].refColorBlue = in[i].refColorBlue; 848 out[i].refColorRed = in[i].refColorRed; 849 850 out[i].detection_limit = in[i].detection_limit; 851 out[i].saturation_limit = in[i].saturation_limit; 852 out[i].cerror = in[i].cerror; 853 out[i].fwhm_x = in[i].fwhm_x; 854 out[i].fwhm_y = in[i].fwhm_y; 855 out[i].trate = in[i].trate; 856 out[i].ccdnum = in[i].ccdnum; 857 out[i].flags = in[i].flags; 858 out[i].imageID = in[i].imageID; 859 out[i].parentID = in[i].parentID; 860 out[i].externID = in[i].externID; 861 out[i].sourceID = in[i].sourceID; 862 863 // as of 2011.02.03, the old Mx,My,..., Mxxxx,Myyyy have been deprecated and replaced 864 // with the following. (no real databases used those values -- see 865 // libdvo/doc/dvo-images.txt) 866 out[i].nLinkAstrom = in[i].nLinkAstrom; 867 out[i].nLinkPhotom = in[i].nLinkPhotom; 868 out[i].ubercalDist = in[i].ubercalDist; 869 out[i].dXpixSys = in[i].dXpixSys; 870 out[i].dYpixSys = in[i].dYpixSys; 871 out[i].dMagSys = in[i].dMagSys; 872 out[i].nFitAstrom = in[i].nFitAstrom; 873 out[i].nFitPhotom = in[i].nFitPhotom; 874 out[i].photom_map_id = in[i].photom_map_id; 875 out[i].astrom_map_id = in[i].astrom_map_id; 876 } 877 return (out); 878 } 879 880 PhotCode *PhotCode_PS1_V5_To_Internal (PhotCode_PS1_V5 *in, off_t Nvalues) { 881 882 off_t i; 883 PhotCode *out; 884 885 ALLOCATE_ZERO (out, PhotCode, Nvalues); 886 887 for (i = 0; i < Nvalues; i++) { 888 strncpy (out[i].name, in[i].name, 31); // out[32], in[32] 889 out[i].name[31] = 0; // force termination 890 891 out[i].code = in[i].code; 892 out[i].type = in[i].type; 893 out[i].C = in[i].C; 894 out[i].dC = in[i].dC; 895 out[i].dX = in[i].dX; 896 out[i].K = in[i].K; 897 out[i].c1 = in[i].c1; 898 out[i].c2 = in[i].c2; 899 out[i].equiv = in[i].equiv; 900 out[i].Nc = in[i].Nc; 901 memcpy (out[i].X, in[i].X, 4*sizeof(float)); 902 903 out[i].astromErrSys = in[i].astromErrSys; 904 out[i].astromErrScale = in[i].astromErrScale; 905 out[i].astromErrMagScale = in[i].astromErrMagScale; 906 out[i].photomErrSys = in[i].photomErrSys; 907 908 out[i].photomPoorMask = in[i].photomPoorMask; 909 out[i].photomBadMask = in[i].photomBadMask; 910 out[i].astromPoorMask = in[i].astromPoorMask; 911 out[i].astromBadMask = in[i].astromBadMask; 912 } 913 return (out); 914 } 915 916 PhotCode_PS1_V5 *PhotCode_Internal_To_PS1_V5 (PhotCode *in, off_t Nvalues) { 917 918 off_t i; 919 PhotCode_PS1_V5 *out; 920 921 ALLOCATE_ZERO (out, PhotCode_PS1_V5, Nvalues); 922 923 for (i = 0; i < Nvalues; i++) { 924 strncpy (out[i].name, in[i].name, 31); // out[32], in[32] 925 out[i].name[31] = 0; // force termination 926 927 out[i].code = in[i].code; 928 out[i].type = in[i].type; 929 out[i].C = in[i].C; 930 out[i].dC = in[i].dC; 931 out[i].dX = in[i].dX; 932 out[i].K = in[i].K; 933 out[i].c1 = in[i].c1; 934 out[i].c2 = in[i].c2; 935 out[i].equiv = in[i].equiv; 936 out[i].Nc = in[i].Nc; 937 memcpy (out[i].X, in[i].X, 4*sizeof(float)); 938 939 out[i].astromErrSys = in[i].astromErrSys; 940 out[i].astromErrScale = in[i].astromErrScale; 941 out[i].astromErrMagScale = in[i].astromErrMagScale; 942 out[i].photomErrSys = in[i].photomErrSys; 943 944 out[i].photomPoorMask = in[i].photomPoorMask; 945 out[i].photomBadMask = in[i].photomBadMask; 946 out[i].astromPoorMask = in[i].astromPoorMask; 947 out[i].astromBadMask = in[i].astromBadMask; 948 } 949 return (out); 950 } 951 952 /*********************** old / alternate version **********************/ 953 954 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 955 Average *Average_PS1_V5alt_ToInternal (Average_PS1_V5alt *in, off_t Nvalues) { 956 957 off_t i; 958 Average *out; 959 960 ALLOCATE_ZERO (out, Average, Nvalues); 961 962 for (i = 0; i < Nvalues; i++) { 963 dvo_average_init (&out[i]); 964 965 out[i].R = in[i].R; 966 out[i].D = in[i].D; 967 out[i].dR = in[i].dR; 968 out[i].dD = in[i].dD; 969 out[i].uR = in[i].uR; 970 out[i].uD = in[i].uD; 971 out[i].duR = in[i].duR; 972 out[i].duD = in[i].duD; 973 out[i].P = in[i].P; 974 out[i].dP = in[i].dP; 975 976 out[i].Rstk = in[i].Rstk; 977 out[i].Dstk = in[i].Dstk; 978 out[i].dRstk = in[i].dRstk; 979 out[i].dDstk = in[i].dDstk; 980 981 out[i].ChiSqAve = in[i].ChiSqAve; 982 out[i].ChiSqPM = in[i].ChiSqPM; 983 out[i].ChiSqPar = in[i].ChiSqPar; 984 out[i].Tmean = in[i].Tmean; 985 out[i].Trange = in[i].Trange; 986 987 out[i].psfQF = in[i].psfQF; 988 out[i].psfQFperf = in[i].psfQFperf; 989 out[i].stargal = in[i].stargal; 990 out[i].Npos = in[i].Npos; 991 992 out[i].Nmeasure = in[i].Nmeasure; 993 out[i].Nmissing = in[i].Nmissing; 994 out[i].Nlensing = in[i].Nlensing; 995 out[i].Nlensobj = in[i].Nlensobj; 996 out[i].Nextend = in[i].Nextend; 997 998 out[i].measureOffset = in[i].measureOffset; 999 out[i].missingOffset = in[i].missingOffset; 1000 out[i].lensingOffset = in[i].lensingOffset; 1001 out[i].lensobjOffset = in[i].lensobjOffset; 1002 out[i].starparOffset = in[i].starparOffset; 1003 out[i].extendOffset = in[i].extendOffset; 1004 1005 out[i].refColorBlue = in[i].refColorBlue; 1006 out[i].refColorRed = in[i].refColorRed; 1007 1008 out[i].flags = in[i].flags; 1009 out[i].photFlagsUpper = in[i].photFlagsUpper; 1010 out[i].photFlagsLower = in[i].photFlagsLower; 1011 out[i].objID = in[i].objID; 1012 out[i].catID = in[i].catID; 1013 out[i].extID = in[i].extID; 1014 out[i].extIDgc = in[i].extIDgc; 1015 } 1016 return (out); 1017 } 1018 1019 int gfits_convert_Average_PS1_V5alt (Average_PS1_V5alt *data, off_t size, off_t nitems) { 1020 1021 off_t i; 1022 unsigned char *byte, tmp; 1023 1024 if (size != 184) { 1025 fprintf (stderr, "WARNING: mismatch in data types Average_PS1_V5alt: "OFF_T_FMT" vs %d\n", size, 184); 1026 return (FALSE); 1027 } 1028 1029 /* provide initial values to avoid compiler warnings for non-BYTE_SWAP arch */ 1030 i = tmp = 0; 1031 byte = NULL; 1032 1033 # ifdef BYTE_SWAP 1034 byte = (unsigned char *) data; 1035 for (i = 0; i < nitems; i++, byte += 184) { 1036 /** BYTE SWAP **/ 1037 SWAP_DBLE (0); // RA 1038 SWAP_DBLE (8); // DEC 1039 SWAP_WORD (16); // RA_ERR 1040 SWAP_WORD (20); // DEC_ERR 1041 SWAP_WORD (24); // U_RA 1042 SWAP_WORD (28); // U_DEC 1043 SWAP_WORD (32); // V_RA_ERR 1044 SWAP_WORD (36); // V_DEC_ERR 1045 SWAP_WORD (40); // PAR 1046 SWAP_WORD (44); // PAR_ERR 1047 SWAP_DBLE (48); // RA_STK 1048 SWAP_DBLE (56); // DEC_STK 1049 SWAP_WORD (64); // RA_STK_ERR 1050 SWAP_WORD (68); // DEC_STK_ERR 1051 SWAP_WORD (72); // CHISQ_POS 1052 SWAP_WORD (76); // CHISQ_PM 1053 SWAP_WORD (80); // CHISQ_PAP 1054 SWAP_WORD (84); // MEAN_EPOCH 1055 SWAP_WORD (88); // TIME_RANGE 1056 SWAP_WORD (92); // PSF_QF 1057 SWAP_WORD (96); // PSF_QF_PERF 1058 SWAP_WORD (100); // STARGAL_SEP 1059 SWAP_BYTE (104); // NUMBER_POS 1060 SWAP_BYTE (106); // NMEASURE 1061 SWAP_BYTE (108); // NMISSING 1062 SWAP_BYTE (110); // NLENSING 1063 SWAP_BYTE (112); // NLENSOBJ 1064 SWAP_BYTE (114); // NEXTEND 1065 SWAP_WORD (116); // OFF_MEASURE 1066 SWAP_WORD (120); // OFF_MISSING 1067 SWAP_WORD (124); // OFF_LENSING 1068 SWAP_WORD (128); // OFF_LENSOBJ 1069 SWAP_WORD (132); // OFF_EXTEND 1070 SWAP_WORD (136); // OFF_PARAMS 1071 SWAP_WORD (140); // REF_COLOR_BLUE 1072 SWAP_WORD (144); // REF_COLOR_RED 1073 SWAP_WORD (148); // FLAGS 1074 SWAP_WORD (152); // PHOTFLAGS_U 1075 SWAP_WORD (156); // PHOTFLAGS_L 1076 SWAP_WORD (160); // OBJ_ID 1077 SWAP_WORD (164); // CAT_ID 1078 SWAP_DBLE (168); // EXT_ID 1079 SWAP_DBLE (176); // EXT_ID_GC 1080 } 1081 # endif 1082 1083 return (TRUE); 1084 } 1085 1086 /*** add test of EXTNAME and header-defined columns? ***/ 1087 /* return internal structure representation */ 1088 Average_PS1_V5alt *gfits_table_get_Average_PS1_V5alt (FTable *ftable, off_t *Ndata, char *swapped) { 1089 1090 int Ncols; 1091 Average_PS1_V5alt *data; 1092 1093 Ncols = ftable[0].header[0].Naxis[0]; 1094 if (Ncols != 184) { 1095 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 184); 1096 return NULL; 1097 } 1098 1099 *Ndata = ftable[0].header[0].Naxis[1]; 1100 data = (Average_PS1_V5alt *) ftable[0].buffer; 1101 if ((swapped == NULL) || (*swapped == FALSE)) { 1102 if (!gfits_convert_Average_PS1_V5alt (data, sizeof (Average_PS1_V5alt), *Ndata)) { 1103 return NULL; 1104 } 1105 gfits_table_scale_data (ftable); 1106 if (swapped != NULL) *swapped = TRUE; 1107 } 1108 return (data); 1109 } 1110 1111 /****** alt secfilt **********/ 1112 1113 SecFilt *SecFilt_PS1_V5alt_ToInternal (SecFilt_PS1_V5alt *in, off_t Nvalues) { 1114 1115 off_t i; 1116 SecFilt *out; 1117 1118 ALLOCATE_ZERO (out, SecFilt, Nvalues); 1119 1120 for (i = 0; i < Nvalues; i++) { 1121 dvo_secfilt_init (&out[i]); 1122 1123 out[i].M = in[i].M; 1124 out[i].dM = in[i].dM; 1125 out[i].Map = in[i].Map; 1126 out[i].dMap = in[i].dMap; 1127 out[i].sMap = in[i].sMap; 1128 out[i].Mkron = in[i].Mkron; 1129 out[i].dMkron = in[i].dMkron; 1130 1131 out[i].Mstdev = in[i].Mstdev; 1132 out[i].Mmin = in[i].Mmin; 1133 out[i].Mmax = in[i].Mmax; 1134 out[i].Mchisq = in[i].Mchisq; 1135 1136 out[i].Ncode = in[i].Ncode; 1137 out[i].Nused = in[i].Nused; 1138 out[i].NusedKron = in[i].NusedKron; 1139 out[i].NusedAp = in[i].NusedAp; 1140 1141 out[i].flags = in[i].flags; 1142 1143 out[i].MpsfStk = in[i].MpsfStk; 1144 out[i].FpsfStk = in[i].FpsfStk; 1145 out[i].dFpsfStk = in[i].dFpsfStk; 1146 1147 out[i].MkronStk = in[i].MkronStk; 1148 out[i].FkronStk = in[i].FkronStk; 1149 out[i].dFkronStk = in[i].dFkronStk; 1150 1151 out[i].MapStk = in[i].MapStk; 1152 out[i].FapStk = in[i].FapStk; 1153 out[i].dFapStk = in[i].dFapStk; 1154 1155 out[i].stackPrmryOff = in[i].stackPrmryOff; 1156 out[i].stackBestOff = in[i].stackBestOff; 1157 1158 out[i].MpsfWrp = in[i].MpsfWrp; 1159 out[i].FpsfWrp = in[i].FpsfWrp; 1160 out[i].dFpsfWrp = in[i].dFpsfWrp; 1161 out[i].sFpsfWrp = in[i].sFpsfWrp; 1162 1163 out[i].MkronWrp = in[i].MkronWrp; 1164 out[i].FkronWrp = in[i].FkronWrp; 1165 out[i].dFkronWrp = in[i].dFkronWrp; 1166 out[i].sFkronWrp = in[i].sFkronWrp; 1167 1168 out[i].MapWrp = in[i].MapWrp; 1169 out[i].FapWrp = in[i].FapWrp; 1170 out[i].dFapWrp = in[i].dFapWrp; 1171 out[i].sFapWrp = in[i].sFapWrp; 1172 1173 out[i].NusedWrp = in[i].NusedWrp; 1174 out[i].NusedKronWrp = in[i].NusedKronWrp; 1175 out[i].NusedApWrp = in[i].NusedApWrp; 1176 1177 out[i].ubercalDist = in[i].ubercalDist; 1178 } 1179 return (out); 1180 } 1181 1182 int gfits_convert_SecFilt_PS1_V5alt (SecFilt_PS1_V5alt *data, off_t size, off_t nitems) { 1183 1184 off_t i; 1185 unsigned char *byte, tmp; 1186 1187 if (size != 160) { 1188 fprintf (stderr, "WARNING: mismatch in data types SecFilt_PS1_V5alt: "OFF_T_FMT" vs %d\n", size, 160); 1189 return (FALSE); 1190 } 1191 1192 /* provide initial values to avoid compiler warnings for non-BYTE_SWAP arch */ 1193 i = tmp = 0; 1194 byte = NULL; 1195 1196 # ifdef BYTE_SWAP 1197 byte = (unsigned char *) data; 1198 for (i = 0; i < nitems; i++, byte += 160) { 1199 /** BYTE SWAP **/ 1200 SWAP_WORD (0); // MAG 1201 SWAP_WORD (4); // MAG_ERR 1202 SWAP_WORD (8); // MAG_AP 1203 SWAP_WORD (12); // MAG_AP_ERR 1204 SWAP_WORD (16); // MAG_AP_STDEV 1205 SWAP_WORD (20); // MAG_KRON 1206 SWAP_WORD (24); // MAG_KRON_ERR 1207 SWAP_WORD (28); // MAG_KRON_STDEV 1208 SWAP_WORD (32); // MAG_STDEV 1209 SWAP_WORD (36); // MAG_MIN 1210 SWAP_WORD (40); // MAG_MAX 1211 SWAP_WORD (44); // MAG_CHI 1212 SWAP_BYTE (48); // NCODE 1213 SWAP_BYTE (50); // NUSED 1214 SWAP_BYTE (52); // NUSED_KRON 1215 SWAP_BYTE (54); // NUSED_AP 1216 SWAP_WORD (56); // FLAGS 1217 SWAP_WORD (60); // MAG_PSF_STK 1218 SWAP_WORD (64); // FLUX_PSF_STK 1219 SWAP_WORD (68); // FLUX_PSF_STK_ERR 1220 SWAP_WORD (72); // MAG_KRON_STK 1221 SWAP_WORD (76); // FLUX_KRON_STK 1222 SWAP_WORD (80); // FLUX_KRON_STK_ERR 1223 SWAP_WORD (84); // MAG_AP_STK 1224 SWAP_WORD (88); // FLUX_AP_STK 1225 SWAP_WORD (92); // FLUX_AP_STK_ERR 1226 SWAP_WORD (96); // STACK_PRIMARY_OFF 1227 SWAP_WORD (100); // STACK_BEST_OFF 1228 SWAP_WORD (104); // MAG_PSF_WRP 1229 SWAP_WORD (108); // FLUX_PSF_WRP 1230 SWAP_WORD (112); // FLUX_PSF_WRP_ERR 1231 SWAP_WORD (116); // FLUX_PSF_WRP_STD 1232 SWAP_WORD (120); // MAG_KRON_WRP 1233 SWAP_WORD (124); // FLUX_KRON_WRP 1234 SWAP_WORD (128); // FLUX_KRON_WRP_ERR 1235 SWAP_WORD (132); // FLUX_KRON_WRP_STD 1236 SWAP_WORD (136); // MAG_AP_WRP 1237 SWAP_WORD (140); // FLUX_AP_WRP 1238 SWAP_WORD (144); // FLUX_AP_WRP_ERR 1239 SWAP_WORD (148); // FLUX_AP_WRP_STD 1240 SWAP_BYTE (152); // NUSED_WRP 1241 SWAP_BYTE (154); // NUSED_KRON_WRP 1242 SWAP_BYTE (156); // NUSED_AP_WRP 1243 SWAP_BYTE (158); // UBERCAL_DIST 1244 } 1245 # endif 1246 1247 return (TRUE); 1248 } 1249 1250 /*** add test of EXTNAME and header-defined columns? ***/ 1251 /* return internal structure representation */ 1252 SecFilt_PS1_V5alt *gfits_table_get_SecFilt_PS1_V5alt (FTable *ftable, off_t *Ndata, char *swapped) { 1253 1254 int Ncols; 1255 SecFilt_PS1_V5alt *data; 1256 1257 Ncols = ftable[0].header[0].Naxis[0]; 1258 if (Ncols != 160) { 1259 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 160); 1260 return NULL; 1261 } 1262 1263 *Ndata = ftable[0].header[0].Naxis[1]; 1264 data = (SecFilt_PS1_V5alt *) ftable[0].buffer; 1265 if ((swapped == NULL) || (*swapped == FALSE)) { 1266 if (!gfits_convert_SecFilt_PS1_V5alt (data, sizeof (SecFilt_PS1_V5alt), *Ndata)) { 1267 return NULL; 1268 } 1269 gfits_table_scale_data (ftable); 1270 if (swapped != NULL) *swapped = TRUE; 1271 } 1272 return (data); 1273 } 1274 1275 Lensing *Lensing_PS1_V5_R0_ToInternal (Lensing_PS1_V5_R0 *in, off_t Nvalues) { 1276 1277 off_t i; 1278 Lensing *out; 1279 1280 ALLOCATE_ZERO (out, Lensing, Nvalues); 1281 1282 for (i = 0; i < Nvalues; i++) { 1283 dvo_lensing_init (&out[i]); 1284 1285 out[i].X11_sm_obj = in[i].X11_sm_obj; 1286 out[i].X12_sm_obj = in[i].X12_sm_obj; 1287 out[i].X22_sm_obj = in[i].X22_sm_obj; 1288 out[i].E1_sm_obj = in[i].E1_sm_obj; 1289 out[i].E2_sm_obj = in[i].E2_sm_obj; 1290 1291 out[i].X11_sh_obj = in[i].X11_sh_obj; 1292 out[i].X12_sh_obj = in[i].X12_sh_obj; 1293 out[i].X22_sh_obj = in[i].X22_sh_obj; 1294 out[i].E1_sh_obj = in[i].E1_sh_obj; 1295 out[i].E2_sh_obj = in[i].E2_sh_obj; 1296 1297 out[i].X11_sm_psf = in[i].X11_sm_psf; 1298 out[i].X12_sm_psf = in[i].X12_sm_psf; 1299 out[i].X22_sm_psf = in[i].X22_sm_psf; 1300 out[i].E1_sm_psf = in[i].E1_sm_psf; 1301 out[i].E2_sm_psf = in[i].E2_sm_psf; 1302 1303 out[i].X11_sh_psf = in[i].X11_sh_psf; 1304 out[i].X12_sh_psf = in[i].X12_sh_psf; 1305 out[i].X22_sh_psf = in[i].X22_sh_psf; 1306 out[i].E1_sh_psf = in[i].E1_sh_psf; 1307 out[i].E2_sh_psf = in[i].E2_sh_psf; 1308 1309 out[i].F_ApR5 = in[i].F_ApR5; 1310 out[i].dF_ApR5 = in[i].dF_ApR5; 1311 out[i].sF_ApR5 = in[i].sF_ApR5; 1312 out[i].fF_ApR5 = in[i].fF_ApR5; 1313 1314 out[i].F_ApR6 = in[i].F_ApR6; 1315 out[i].dF_ApR6 = in[i].dF_ApR6; 1316 out[i].sF_ApR6 = in[i].sF_ApR6; 1317 out[i].fF_ApR6 = in[i].fF_ApR6; 1318 1319 out[i].detID = in[i].detID; 1320 out[i].objID = in[i].objID; 1321 out[i].catID = in[i].catID; 1322 out[i].averef = in[i].averef; 1323 } 1324 return (out); 1325 } 1326 1327 Lensing *Lensing_PS1_V5_R1_ToInternal (Lensing_PS1_V5_R1 *in, off_t Nvalues) { 1328 1329 off_t i; 1330 Lensing *out; 1331 1332 ALLOCATE_ZERO (out, Lensing, Nvalues); 1333 1334 for (i = 0; i < Nvalues; i++) { 1335 dvo_lensing_init (&out[i]); 1336 1337 out[i].X11_sm_obj = in[i].X11_sm_obj; 1338 out[i].X12_sm_obj = in[i].X12_sm_obj; 1339 out[i].X22_sm_obj = in[i].X22_sm_obj; 1340 out[i].E1_sm_obj = in[i].E1_sm_obj; 1341 out[i].E2_sm_obj = in[i].E2_sm_obj; 1342 1343 out[i].X11_sh_obj = in[i].X11_sh_obj; 1344 out[i].X12_sh_obj = in[i].X12_sh_obj; 1345 out[i].X22_sh_obj = in[i].X22_sh_obj; 1346 out[i].E1_sh_obj = in[i].E1_sh_obj; 1347 out[i].E2_sh_obj = in[i].E2_sh_obj; 1348 1349 out[i].X11_sm_psf = in[i].X11_sm_psf; 1350 out[i].X12_sm_psf = in[i].X12_sm_psf; 1351 out[i].X22_sm_psf = in[i].X22_sm_psf; 1352 out[i].E1_sm_psf = in[i].E1_sm_psf; 1353 out[i].E2_sm_psf = in[i].E2_sm_psf; 1354 1355 out[i].X11_sh_psf = in[i].X11_sh_psf; 1356 out[i].X12_sh_psf = in[i].X12_sh_psf; 1357 out[i].X22_sh_psf = in[i].X22_sh_psf; 1358 out[i].E1_sh_psf = in[i].E1_sh_psf; 1359 out[i].E2_sh_psf = in[i].E2_sh_psf; 1360 1361 out[i].F_ApR5 = in[i].F_ApR5; 1362 out[i].dF_ApR5 = in[i].dF_ApR5; 1363 out[i].sF_ApR5 = in[i].sF_ApR5; 1364 out[i].fF_ApR5 = in[i].fF_ApR5; 1365 1366 out[i].F_ApR6 = in[i].F_ApR6; 1367 out[i].dF_ApR6 = in[i].dF_ApR6; 1368 out[i].sF_ApR6 = in[i].sF_ApR6; 1369 out[i].fF_ApR6 = in[i].fF_ApR6; 1370 1371 out[i].detID = in[i].detID; 1372 out[i].objID = in[i].objID; 1373 out[i].catID = in[i].catID; 1374 out[i].averef = in[i].averef; 1375 1376 out[i].imageID = in[i].imageID; 1377 } 1378 return (out); 1379 } 1380 1381 /********** PS1_V5alt measure ************/ 1382 1383 Measure *Measure_PS1_V5alt_ToInternal (Average *ave, Measure_PS1_V5alt *in, off_t Nvalues) { 6 1384 7 1385 off_t i; … … 77 1455 } 78 1456 79 Measure_PS1_V5 *MeasureInternalTo_PS1_V5 (Average *ave, Measure *in, off_t Nvalues) { 80 81 off_t i; 82 Measure_PS1_V5 *out; 83 84 ALLOCATE_ZERO (out, Measure_PS1_V5, Nvalues); 85 86 for (i = 0; i < Nvalues; i++) { 87 out[i].R = in[i].R; 88 out[i].D = in[i].D; 89 out[i].M = in[i].M; 90 out[i].dM = in[i].dM; 91 out[i].Map = in[i].Map; 92 out[i].dMap = in[i].dMap; 93 out[i].Mkron = in[i].Mkron; 94 out[i].dMkron = in[i].dMkron; 95 out[i].Mcal = in[i].Mcal; 96 out[i].dMcal = in[i].dMcal; 97 out[i].dt = in[i].dt; 98 out[i].FluxPSF = in[i].FluxPSF; 99 out[i].dFluxPSF = in[i].dFluxPSF; 100 out[i].FluxKron = in[i].FluxKron; 101 out[i].dFluxKron = in[i].dFluxKron; 102 out[i].FluxAp = in[i].FluxAp; 103 out[i].dFluxAp = in[i].dFluxAp; 104 out[i].airmass = in[i].airmass; 105 out[i].az = in[i].az; 106 out[i].Xccd = in[i].Xccd; 107 out[i].Yccd = in[i].Yccd; 108 out[i].Xfix = in[i].Xfix; 109 out[i].Yfix = in[i].Yfix; 110 out[i].XoffKH = in[i].XoffKH; 111 out[i].YoffKH = in[i].YoffKH; 112 out[i].XoffDCR = in[i].XoffDCR; 113 out[i].YoffDCR = in[i].YoffDCR; 114 out[i].RoffGAL = in[i].RoffGAL; 115 out[i].DoffGAL = in[i].DoffGAL; 116 out[i].Sky = in[i].Sky; 117 out[i].dSky = in[i].dSky; 118 out[i].t = in[i].t; 119 out[i].averef = in[i].averef; 120 out[i].detID = in[i].detID; 121 out[i].objID = in[i].objID; 122 out[i].catID = in[i].catID; 123 out[i].extID = in[i].extID; 124 out[i].imageID = in[i].imageID; 125 out[i].psfQF = in[i].psfQF; 126 out[i].psfQFperf = in[i].psfQFperf; 127 out[i].psfChisq = in[i].psfChisq; 128 out[i].psfNdof = in[i].psfNdof; 129 out[i].psfNpix = in[i].psfNpix; 130 out[i].extNsigma = in[i].extNsigma; 131 out[i].FWx = in[i].FWx; 132 out[i].FWy = in[i].FWy; 133 out[i].theta = in[i].theta; 134 out[i].Mxx = in[i].Mxx; 135 out[i].Mxy = in[i].Mxy; 136 out[i].Myy = in[i].Myy; 137 out[i].t_msec = in[i].t_msec; 138 out[i].photcode = in[i].photcode; 139 out[i].dXccd = in[i].dXccd; 140 out[i].dYccd = in[i].dYccd; 141 out[i].dRsys = in[i].dRsys; 142 out[i].posangle = in[i].posangle; 143 out[i].pltscale = in[i].pltscale; 144 out[i].dbFlags = in[i].dbFlags; 145 out[i].photFlags = in[i].photFlags; 146 out[i].photFlags2 = in[i].photFlags2; 147 } 148 return (out); 149 } 150 151 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 152 Average *Average_PS1_V5_ToInternal (Average_PS1_V5 *in, off_t Nvalues, SecFilt **primary) { 153 154 off_t i; 155 Average *out; 156 157 ALLOCATE_ZERO (out, Average, Nvalues); 158 159 for (i = 0; i < Nvalues; i++) { 160 dvo_average_init (&out[i]); 161 162 out[i].R = in[i].R; 163 out[i].D = in[i].D; 164 out[i].dR = in[i].dR; 165 out[i].dD = in[i].dD; 166 out[i].uR = in[i].uR; 167 out[i].uD = in[i].uD; 168 out[i].duR = in[i].duR; 169 out[i].duD = in[i].duD; 170 out[i].P = in[i].P; 171 out[i].dP = in[i].dP; 172 173 out[i].Rstk = in[i].Rstk; 174 out[i].Dstk = in[i].Dstk; 175 out[i].dRstk = in[i].dRstk; 176 out[i].dDstk = in[i].dDstk; 177 178 out[i].ChiSqAve = in[i].ChiSqAve; 179 out[i].ChiSqPM = in[i].ChiSqPM; 180 out[i].ChiSqPar = in[i].ChiSqPar; 181 out[i].Tmean = in[i].Tmean; 182 out[i].Trange = in[i].Trange; 183 184 out[i].psfQF = in[i].psfQF; 185 out[i].psfQFperf = in[i].psfQFperf; 186 out[i].stargal = in[i].stargal; 187 out[i].Npos = in[i].Npos; 188 189 out[i].Nmeasure = in[i].Nmeasure; 190 out[i].Nmissing = in[i].Nmissing; 191 out[i].Nlensing = in[i].Nlensing; 192 out[i].Nlensobj = in[i].Nlensobj; 193 out[i].Nstarpar = in[i].Nstarpar; 194 out[i].Nextend = in[i].Nextend; 195 196 out[i].measureOffset = in[i].measureOffset; 197 out[i].missingOffset = in[i].missingOffset; 198 out[i].lensingOffset = in[i].lensingOffset; 199 out[i].lensobjOffset = in[i].lensobjOffset; 200 out[i].starparOffset = in[i].starparOffset; 201 out[i].extendOffset = in[i].extendOffset; 202 203 out[i].refColorBlue = in[i].refColorBlue; 204 out[i].refColorRed = in[i].refColorRed; 205 206 out[i].tessID = in[i].tessID; 207 out[i].skycellID = in[i].skycellID; 208 out[i].projectionID = in[i].projectionID; 209 210 out[i].flags = in[i].flags; 211 out[i].photFlagsUpper = in[i].photFlagsUpper; 212 out[i].photFlagsLower = in[i].photFlagsLower; 213 out[i].objID = in[i].objID; 214 out[i].catID = in[i].catID; 215 out[i].extID = in[i].extID; 216 out[i].extIDgc = in[i].extIDgc; 217 } 218 return (out); 219 } 220 221 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 222 Average_PS1_V5 *AverageInternalTo_PS1_V5 (Average *in, off_t Nvalues, SecFilt *primary) { 223 224 off_t i; 225 Average_PS1_V5 *out; 226 227 ALLOCATE_ZERO (out, Average_PS1_V5, Nvalues); 228 229 for (i = 0; i < Nvalues; i++) { 230 out[i].R = in[i].R; 231 out[i].D = in[i].D; 232 out[i].dR = in[i].dR; 233 out[i].dD = in[i].dD; 234 out[i].uR = in[i].uR; 235 out[i].uD = in[i].uD; 236 out[i].duR = in[i].duR; 237 out[i].duD = in[i].duD; 238 out[i].P = in[i].P; 239 out[i].dP = in[i].dP; 240 241 out[i].Rstk = in[i].Rstk; 242 out[i].Dstk = in[i].Dstk; 243 out[i].dRstk = in[i].dRstk; 244 out[i].dDstk = in[i].dDstk; 245 246 out[i].ChiSqAve = in[i].ChiSqAve; 247 out[i].ChiSqPM = in[i].ChiSqPM; 248 out[i].ChiSqPar = in[i].ChiSqPar; 249 out[i].Tmean = in[i].Tmean; 250 out[i].Trange = in[i].Trange; 251 252 out[i].psfQF = in[i].psfQF; 253 out[i].psfQFperf = in[i].psfQFperf; 254 out[i].stargal = in[i].stargal; 255 out[i].Npos = in[i].Npos; 256 257 out[i].Nmeasure = in[i].Nmeasure; 258 out[i].Nmissing = in[i].Nmissing; 259 out[i].Nlensing = in[i].Nlensing; 260 out[i].Nlensobj = in[i].Nlensobj; 261 out[i].Nstarpar = in[i].Nstarpar; 262 out[i].Nextend = in[i].Nextend; 263 264 out[i].measureOffset = in[i].measureOffset; 265 out[i].missingOffset = in[i].missingOffset; 266 out[i].lensingOffset = in[i].lensingOffset; 267 out[i].lensobjOffset = in[i].lensobjOffset; 268 out[i].starparOffset = in[i].starparOffset; 269 out[i].extendOffset = in[i].extendOffset; 270 271 out[i].refColorBlue = in[i].refColorBlue; 272 out[i].refColorRed = in[i].refColorRed; 273 274 out[i].tessID = in[i].tessID; 275 out[i].skycellID = in[i].skycellID; 276 out[i].projectionID = in[i].projectionID; 277 278 out[i].flags = in[i].flags; 279 out[i].photFlagsUpper = in[i].photFlagsUpper; 280 out[i].photFlagsLower = in[i].photFlagsLower; 281 out[i].objID = in[i].objID; 282 out[i].catID = in[i].catID; 283 out[i].extID = in[i].extID; 284 out[i].extIDgc = in[i].extIDgc; 285 } 286 return (out); 287 } 288 289 SecFilt *SecFilt_PS1_V5_ToInternal (SecFilt_PS1_V5 *in, off_t Nvalues) { 290 291 off_t i; 292 SecFilt *out; 293 294 ALLOCATE_ZERO (out, SecFilt, Nvalues); 295 296 for (i = 0; i < Nvalues; i++) { 297 dvo_secfilt_init (&out[i]); 298 299 out[i].M = in[i].M; 300 out[i].dM = in[i].dM; 301 out[i].Map = in[i].Map; 302 out[i].dMap = in[i].dMap; 303 out[i].sMap = in[i].sMap; 304 out[i].Mkron = in[i].Mkron; 305 out[i].dMkron = in[i].dMkron; 306 out[i].sMkron = in[i].sMkron; 307 308 out[i].psfQfMax = in[i].psfQfMax; 309 out[i].psfQfPerfMax = in[i].psfQfPerfMax; 310 311 out[i].Mstdev = in[i].Mstdev; 312 out[i].Mmin = in[i].Mmin; 313 out[i].Mmax = in[i].Mmax; 314 out[i].Mchisq = in[i].Mchisq; 315 316 out[i].Ncode = in[i].Ncode; 317 out[i].Nused = in[i].Nused; 318 out[i].NusedKron = in[i].NusedKron; 319 out[i].NusedAp = in[i].NusedAp; 320 321 out[i].flags = in[i].flags; 322 323 out[i].MpsfStk = in[i].MpsfStk; 324 out[i].FpsfStk = in[i].FpsfStk; 325 out[i].dFpsfStk = in[i].dFpsfStk; 326 327 out[i].MkronStk = in[i].MkronStk; 328 out[i].FkronStk = in[i].FkronStk; 329 out[i].dFkronStk = in[i].dFkronStk; 330 331 out[i].MapStk = in[i].MapStk; 332 out[i].FapStk = in[i].FapStk; 333 out[i].dFapStk = in[i].dFapStk; 334 335 out[i].Nstack = in[i].Nstack; 336 out[i].NstackDet = in[i].NstackDet; 337 338 out[i].stackPrmryOff = in[i].stackPrmryOff; 339 out[i].stackBestOff = in[i].stackBestOff; 340 341 out[i].MpsfWrp = in[i].MpsfWrp; 342 out[i].FpsfWrp = in[i].FpsfWrp; 343 out[i].dFpsfWrp = in[i].dFpsfWrp; 344 out[i].sFpsfWrp = in[i].sFpsfWrp; 345 346 out[i].MkronWrp = in[i].MkronWrp; 347 out[i].FkronWrp = in[i].FkronWrp; 348 out[i].dFkronWrp = in[i].dFkronWrp; 349 out[i].sFkronWrp = in[i].sFkronWrp; 350 351 out[i].MapWrp = in[i].MapWrp; 352 out[i].FapWrp = in[i].FapWrp; 353 out[i].dFapWrp = in[i].dFapWrp; 354 out[i].sFapWrp = in[i].sFapWrp; 355 356 out[i].NusedWrp = in[i].NusedWrp; 357 out[i].NusedKronWrp = in[i].NusedKronWrp; 358 out[i].NusedApWrp = in[i].NusedApWrp; 359 360 out[i].Nwarp = in[i].Nwarp; 361 out[i].NwarpGood = in[i].NwarpGood; 362 363 out[i].ubercalDist = in[i].ubercalDist; 364 } 365 return (out); 366 } 367 368 SecFilt_PS1_V5 *SecFiltInternalTo_PS1_V5 (SecFilt *in, off_t Nvalues) { 369 370 off_t i; 371 SecFilt_PS1_V5 *out; 372 373 ALLOCATE_ZERO (out, SecFilt_PS1_V5, Nvalues); 374 375 for (i = 0; i < Nvalues; i++) { 376 377 out[i].M = in[i].M; 378 out[i].dM = in[i].dM; 379 out[i].Map = in[i].Map; 380 out[i].dMap = in[i].dMap; 381 out[i].sMap = in[i].sMap; 382 out[i].Mkron = in[i].Mkron; 383 out[i].dMkron = in[i].dMkron; 384 out[i].sMkron = in[i].sMkron; 385 386 out[i].psfQfMax = in[i].psfQfMax; 387 out[i].psfQfPerfMax = in[i].psfQfPerfMax; 388 389 out[i].Mstdev = in[i].Mstdev; 390 out[i].Mmin = in[i].Mmin; 391 out[i].Mmax = in[i].Mmax; 392 out[i].Mchisq = in[i].Mchisq; 393 394 out[i].Ncode = in[i].Ncode; 395 out[i].Nused = in[i].Nused; 396 out[i].NusedKron = in[i].NusedKron; 397 out[i].NusedAp = in[i].NusedAp; 398 399 out[i].flags = in[i].flags; 400 401 out[i].MpsfStk = in[i].MpsfStk; 402 out[i].FpsfStk = in[i].FpsfStk; 403 out[i].dFpsfStk = in[i].dFpsfStk; 404 405 out[i].MkronStk = in[i].MkronStk; 406 out[i].FkronStk = in[i].FkronStk; 407 out[i].dFkronStk = in[i].dFkronStk; 408 409 out[i].MapStk = in[i].MapStk; 410 out[i].FapStk = in[i].FapStk; 411 out[i].dFapStk = in[i].dFapStk; 412 413 out[i].Nstack = in[i].Nstack; 414 out[i].NstackDet = in[i].NstackDet; 415 416 out[i].stackPrmryOff = in[i].stackPrmryOff; 417 out[i].stackBestOff = in[i].stackBestOff; 418 419 out[i].MpsfWrp = in[i].MpsfWrp; 420 out[i].FpsfWrp = in[i].FpsfWrp; 421 out[i].dFpsfWrp = in[i].dFpsfWrp; 422 out[i].sFpsfWrp = in[i].sFpsfWrp; 423 424 out[i].MkronWrp = in[i].MkronWrp; 425 out[i].FkronWrp = in[i].FkronWrp; 426 out[i].dFkronWrp = in[i].dFkronWrp; 427 out[i].sFkronWrp = in[i].sFkronWrp; 428 429 out[i].MapWrp = in[i].MapWrp; 430 out[i].FapWrp = in[i].FapWrp; 431 out[i].dFapWrp = in[i].dFapWrp; 432 out[i].sFapWrp = in[i].sFapWrp; 433 434 out[i].NusedWrp = in[i].NusedWrp; 435 out[i].NusedKronWrp = in[i].NusedKronWrp; 436 out[i].NusedApWrp = in[i].NusedApWrp; 437 438 out[i].Nwarp = in[i].Nwarp; 439 out[i].NwarpGood = in[i].NwarpGood; 440 441 out[i].ubercalDist = in[i].ubercalDist; 442 } 443 return (out); 444 } 445 446 Lensing *Lensing_PS1_V5_R2_ToInternal (Lensing_PS1_V5_R2 *in, off_t Nvalues) { 447 448 off_t i; 449 Lensing *out; 450 451 ALLOCATE_ZERO (out, Lensing, Nvalues); 452 453 for (i = 0; i < Nvalues; i++) { 454 dvo_lensing_init (&out[i]); 455 456 out[i].X11_sm_obj = in[i].X11_sm_obj; 457 out[i].X12_sm_obj = in[i].X12_sm_obj; 458 out[i].X22_sm_obj = in[i].X22_sm_obj; 459 out[i].E1_sm_obj = in[i].E1_sm_obj; 460 out[i].E2_sm_obj = in[i].E2_sm_obj; 461 462 out[i].X11_sh_obj = in[i].X11_sh_obj; 463 out[i].X12_sh_obj = in[i].X12_sh_obj; 464 out[i].X22_sh_obj = in[i].X22_sh_obj; 465 out[i].E1_sh_obj = in[i].E1_sh_obj; 466 out[i].E2_sh_obj = in[i].E2_sh_obj; 467 468 out[i].X11_sm_psf = in[i].X11_sm_psf; 469 out[i].X12_sm_psf = in[i].X12_sm_psf; 470 out[i].X22_sm_psf = in[i].X22_sm_psf; 471 out[i].E1_sm_psf = in[i].E1_sm_psf; 472 out[i].E2_sm_psf = in[i].E2_sm_psf; 473 474 out[i].X11_sh_psf = in[i].X11_sh_psf; 475 out[i].X12_sh_psf = in[i].X12_sh_psf; 476 out[i].X22_sh_psf = in[i].X22_sh_psf; 477 out[i].E1_sh_psf = in[i].E1_sh_psf; 478 out[i].E2_sh_psf = in[i].E2_sh_psf; 479 480 out[i].E1_psf = in[i].E1_psf; 481 out[i].E2_psf = in[i].E2_psf; 482 483 out[i].F_ApR5 = in[i].F_ApR5; 484 out[i].dF_ApR5 = in[i].dF_ApR5; 485 out[i].sF_ApR5 = in[i].sF_ApR5; 486 out[i].fF_ApR5 = in[i].fF_ApR5; 487 488 out[i].F_ApR6 = in[i].F_ApR6; 489 out[i].dF_ApR6 = in[i].dF_ApR6; 490 out[i].sF_ApR6 = in[i].sF_ApR6; 491 out[i].fF_ApR6 = in[i].fF_ApR6; 492 493 out[i].detID = in[i].detID; 494 out[i].objID = in[i].objID; 495 out[i].catID = in[i].catID; 496 out[i].averef = in[i].averef; 497 498 out[i].imageID = in[i].imageID; 499 } 500 return (out); 501 } 502 503 Lensing_PS1_V5_R2 *LensingInternalTo_PS1_V5_R2 (Lensing *in, off_t Nvalues) { 504 505 off_t i; 506 Lensing_PS1_V5_R2 *out; 507 508 ALLOCATE_ZERO (out, Lensing_PS1_V5, Nvalues); 509 510 for (i = 0; i < Nvalues; i++) { 511 512 out[i].X11_sm_obj = in[i].X11_sm_obj; 513 out[i].X12_sm_obj = in[i].X12_sm_obj; 514 out[i].X22_sm_obj = in[i].X22_sm_obj; 515 out[i].E1_sm_obj = in[i].E1_sm_obj; 516 out[i].E2_sm_obj = in[i].E2_sm_obj; 517 518 out[i].X11_sh_obj = in[i].X11_sh_obj; 519 out[i].X12_sh_obj = in[i].X12_sh_obj; 520 out[i].X22_sh_obj = in[i].X22_sh_obj; 521 out[i].E1_sh_obj = in[i].E1_sh_obj; 522 out[i].E2_sh_obj = in[i].E2_sh_obj; 523 524 out[i].X11_sm_psf = in[i].X11_sm_psf; 525 out[i].X12_sm_psf = in[i].X12_sm_psf; 526 out[i].X22_sm_psf = in[i].X22_sm_psf; 527 out[i].E1_sm_psf = in[i].E1_sm_psf; 528 out[i].E2_sm_psf = in[i].E2_sm_psf; 529 530 out[i].X11_sh_psf = in[i].X11_sh_psf; 531 out[i].X12_sh_psf = in[i].X12_sh_psf; 532 out[i].X22_sh_psf = in[i].X22_sh_psf; 533 out[i].E1_sh_psf = in[i].E1_sh_psf; 534 out[i].E2_sh_psf = in[i].E2_sh_psf; 535 536 out[i].E1_psf = in[i].E1_psf; 537 out[i].E2_psf = in[i].E2_psf; 538 539 out[i].F_ApR5 = in[i].F_ApR5; 540 out[i].dF_ApR5 = in[i].dF_ApR5; 541 out[i].sF_ApR5 = in[i].sF_ApR5; 542 out[i].fF_ApR5 = in[i].fF_ApR5; 543 544 out[i].F_ApR6 = in[i].F_ApR6; 545 out[i].dF_ApR6 = in[i].dF_ApR6; 546 out[i].sF_ApR6 = in[i].sF_ApR6; 547 out[i].fF_ApR6 = in[i].fF_ApR6; 548 549 out[i].detID = in[i].detID; 550 out[i].objID = in[i].objID; 551 out[i].catID = in[i].catID; 552 out[i].averef = in[i].averef; 553 554 out[i].imageID = in[i].imageID; 555 } 556 return (out); 557 } 558 559 Lensobj *Lensobj_PS1_V5_ToInternal (Lensobj_PS1_V5 *in, off_t Nvalues) { 560 561 off_t i; 562 Lensobj *out; 563 564 ALLOCATE_ZERO (out, Lensobj, Nvalues); 565 566 for (i = 0; i < Nvalues; i++) { 567 dvo_lensobj_init (&out[i], FALSE); 568 569 out[i].X11_sm_obj = in[i].X11_sm_obj; 570 out[i].X12_sm_obj = in[i].X12_sm_obj; 571 out[i].X22_sm_obj = in[i].X22_sm_obj; 572 out[i].E1_sm_obj = in[i].E1_sm_obj; 573 out[i].E2_sm_obj = in[i].E2_sm_obj; 574 575 out[i].X11_sh_obj = in[i].X11_sh_obj; 576 out[i].X12_sh_obj = in[i].X12_sh_obj; 577 out[i].X22_sh_obj = in[i].X22_sh_obj; 578 out[i].E1_sh_obj = in[i].E1_sh_obj; 579 out[i].E2_sh_obj = in[i].E2_sh_obj; 580 581 out[i].X11_sm_psf = in[i].X11_sm_psf; 582 out[i].X12_sm_psf = in[i].X12_sm_psf; 583 out[i].X22_sm_psf = in[i].X22_sm_psf; 584 out[i].E1_sm_psf = in[i].E1_sm_psf; 585 out[i].E2_sm_psf = in[i].E2_sm_psf; 586 587 out[i].X11_sh_psf = in[i].X11_sh_psf; 588 out[i].X12_sh_psf = in[i].X12_sh_psf; 589 out[i].X22_sh_psf = in[i].X22_sh_psf; 590 out[i].E1_sh_psf = in[i].E1_sh_psf; 591 out[i].E2_sh_psf = in[i].E2_sh_psf; 592 593 out[i].F_ApR5 = in[i].F_ApR5; 594 out[i].dF_ApR5 = in[i].dF_ApR5; 595 out[i].sF_ApR5 = in[i].sF_ApR5; 596 out[i].fF_ApR5 = in[i].fF_ApR5; 597 598 out[i].F_ApR6 = in[i].F_ApR6; 599 out[i].dF_ApR6 = in[i].dF_ApR6; 600 out[i].sF_ApR6 = in[i].sF_ApR6; 601 out[i].fF_ApR6 = in[i].fF_ApR6; 602 603 out[i].gamma = in[i].gamma; 604 out[i].E1 = in[i].E1; 605 out[i].E2 = in[i].E2; 606 607 out[i].objID = in[i].objID; 608 out[i].catID = in[i].catID; 609 610 out[i].photcode = in[i].photcode; 611 out[i].Nmeas = in[i].Nmeas; 612 } 613 return (out); 614 } 615 616 Lensobj_PS1_V5 *LensobjInternalTo_PS1_V5 (Lensobj *in, off_t Nvalues) { 617 618 off_t i; 619 Lensobj_PS1_V5 *out; 620 621 ALLOCATE_ZERO (out, Lensobj_PS1_V5, Nvalues); 622 623 for (i = 0; i < Nvalues; i++) { 624 625 out[i].X11_sm_obj = in[i].X11_sm_obj; 626 out[i].X12_sm_obj = in[i].X12_sm_obj; 627 out[i].X22_sm_obj = in[i].X22_sm_obj; 628 out[i].E1_sm_obj = in[i].E1_sm_obj; 629 out[i].E2_sm_obj = in[i].E2_sm_obj; 630 631 out[i].X11_sh_obj = in[i].X11_sh_obj; 632 out[i].X12_sh_obj = in[i].X12_sh_obj; 633 out[i].X22_sh_obj = in[i].X22_sh_obj; 634 out[i].E1_sh_obj = in[i].E1_sh_obj; 635 out[i].E2_sh_obj = in[i].E2_sh_obj; 636 637 out[i].X11_sm_psf = in[i].X11_sm_psf; 638 out[i].X12_sm_psf = in[i].X12_sm_psf; 639 out[i].X22_sm_psf = in[i].X22_sm_psf; 640 out[i].E1_sm_psf = in[i].E1_sm_psf; 641 out[i].E2_sm_psf = in[i].E2_sm_psf; 642 643 out[i].X11_sh_psf = in[i].X11_sh_psf; 644 out[i].X12_sh_psf = in[i].X12_sh_psf; 645 out[i].X22_sh_psf = in[i].X22_sh_psf; 646 out[i].E1_sh_psf = in[i].E1_sh_psf; 647 out[i].E2_sh_psf = in[i].E2_sh_psf; 648 649 out[i].F_ApR5 = in[i].F_ApR5; 650 out[i].dF_ApR5 = in[i].dF_ApR5; 651 out[i].sF_ApR5 = in[i].sF_ApR5; 652 out[i].fF_ApR5 = in[i].fF_ApR5; 653 654 out[i].F_ApR6 = in[i].F_ApR6; 655 out[i].dF_ApR6 = in[i].dF_ApR6; 656 out[i].sF_ApR6 = in[i].sF_ApR6; 657 out[i].fF_ApR6 = in[i].fF_ApR6; 658 659 out[i].gamma = in[i].gamma; 660 out[i].E1 = in[i].E1; 661 out[i].E2 = in[i].E2; 662 663 out[i].objID = in[i].objID; 664 out[i].catID = in[i].catID; 665 666 out[i].photcode = in[i].photcode; 667 out[i].Nmeas = in[i].Nmeas; 668 } 669 return (out); 670 } 671 672 StarPar *StarPar_PS1_V5_ToInternal (StarPar_PS1_V5 *in, off_t Nvalues) { 673 674 off_t i; 675 StarPar *out; 676 677 ALLOCATE_ZERO (out, StarPar, Nvalues); 678 679 for (i = 0; i < Nvalues; i++) { 680 dvo_starpar_init (&out[i]); 681 682 out[i].R = in[i].R; 683 out[i].D = in[i].D; 684 out[i].galLat = in[i].galLat; 685 out[i].galLon = in[i].galLon; 686 687 out[i].Ebv = in[i].Ebv ; 688 out[i].dEbv = in[i].dEbv ; 689 out[i].DistMag = in[i].DistMag ; 690 out[i].dDistMag = in[i].dDistMag; 691 out[i].M_r = in[i].M_r ; 692 out[i].dM_r = in[i].dM_r ; 693 out[i].FeH = in[i].FeH ; 694 out[i].dFeH = in[i].dFeH ; 695 out[i].uRA = in[i].uRA ; 696 out[i].uDEC = in[i].uDEC ; 697 698 out[i].averef = in[i].averef; 699 out[i].objID = in[i].objID ; 700 out[i].catID = in[i].catID ; 701 } 702 return (out); 703 } 704 705 StarPar_PS1_V5 *StarParInternalTo_PS1_V5 (StarPar *in, off_t Nvalues) { 706 707 off_t i; 708 StarPar_PS1_V5 *out; 709 710 ALLOCATE_ZERO (out, StarPar_PS1_V5, Nvalues); 711 712 for (i = 0; i < Nvalues; i++) { 713 714 out[i].R = in[i].R; 715 out[i].D = in[i].D; 716 out[i].galLat = in[i].galLat; 717 out[i].galLon = in[i].galLon; 718 719 out[i].Ebv = in[i].Ebv ; 720 out[i].dEbv = in[i].dEbv ; 721 out[i].DistMag = in[i].DistMag ; 722 out[i].dDistMag = in[i].dDistMag; 723 out[i].M_r = in[i].M_r ; 724 out[i].dM_r = in[i].dM_r ; 725 out[i].FeH = in[i].FeH ; 726 out[i].dFeH = in[i].dFeH ; 727 out[i].uRA = in[i].uRA ; 728 out[i].uDEC = in[i].uDEC ; 729 730 out[i].averef = in[i].averef; 731 out[i].objID = in[i].objID ; 732 out[i].catID = in[i].catID ; 733 } 734 return (out); 735 } 736 737 # define RAW_IMAGE_NAME_LEN 117 738 739 Image *Image_PS1_V5_ToInternal (Image_PS1_V5 *in, off_t Nvalues, off_t Nalloc) { 740 741 off_t i; 742 Image *out; 743 744 char *buffer; 745 ALLOCATE_ZERO (buffer, char, Nalloc); 746 out = (Image *) buffer; 747 // ALLOCATE_ZERO (out, Image, Nvalues); 748 749 for (i = 0; i < Nvalues; i++) { 750 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 751 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 752 out[i].coords.mosaic = NULL; 753 out[i].coords.offsetMap = NULL; 754 755 // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN 756 strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1); 757 out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination 758 759 out[i].tzero = in[i].tzero; 760 out[i].nstar = in[i].nstar; 761 out[i].secz = in[i].secz; 762 out[i].NX = in[i].NX; 763 out[i].NY = in[i].NY; 764 out[i].apmifit = in[i].apmifit; 765 out[i].dapmifit = in[i].dapmifit; 766 out[i].Mcal = in[i].Mcal; 767 out[i].dMcal = in[i].dMcal; 768 out[i].Xm = in[i].Xm; 769 out[i].photcode = in[i].photcode; 770 out[i].exptime = in[i].exptime; 771 out[i].sidtime = in[i].sidtime; 772 out[i].latitude = in[i].latitude; 773 774 out[i].RAo = in[i].RAo; 775 out[i].DECo = in[i].DECo; 776 out[i].Radius = in[i].Radius; 777 out[i].refColorBlue = in[i].refColorBlue; 778 out[i].refColorRed = in[i].refColorRed; 779 780 out[i].detection_limit = in[i].detection_limit; 781 out[i].saturation_limit = in[i].saturation_limit; 782 out[i].cerror = in[i].cerror; 783 out[i].fwhm_x = in[i].fwhm_x; 784 out[i].fwhm_y = in[i].fwhm_y; 785 out[i].trate = in[i].trate; 786 out[i].ccdnum = in[i].ccdnum; 787 out[i].flags = in[i].flags; 788 out[i].imageID = in[i].imageID; 789 out[i].parentID = in[i].parentID; 790 out[i].externID = in[i].externID; 791 out[i].sourceID = in[i].sourceID; 792 793 // as of 2011.02.03, the old Mx,My,..., Mxxxx,Myyyy have been deprecated and replaced 794 // with the following. (no real databases used those values -- see 795 // libdvo/doc/dvo-images.txt) 796 out[i].nLinkAstrom = in[i].nLinkAstrom; 797 out[i].nLinkPhotom = in[i].nLinkPhotom; 798 out[i].ubercalDist = in[i].ubercalDist; 799 out[i].dXpixSys = in[i].dXpixSys; 800 out[i].dYpixSys = in[i].dYpixSys; 801 out[i].dMagSys = in[i].dMagSys; 802 out[i].nFitAstrom = in[i].nFitAstrom; 803 out[i].nFitPhotom = in[i].nFitPhotom; 804 out[i].photom_map_id = in[i].photom_map_id; 805 out[i].astrom_map_id = in[i].astrom_map_id; 806 } 807 return (out); 808 } 809 810 Image_PS1_V5 *ImageInternalTo_PS1_V5 (Image *in, off_t Nvalues) { 811 812 off_t i; 813 Image_PS1_V5 *out; 814 815 ALLOCATE_ZERO (out, Image_PS1_V5, Nvalues); 816 817 for (i = 0; i < Nvalues; i++) { 818 // this is only save because the initial 120 bytes in Coords match CoordsDisk 819 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 820 821 // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN 822 strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1); 823 out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination 824 825 out[i].tzero = in[i].tzero; 826 out[i].nstar = in[i].nstar; 827 out[i].secz = in[i].secz; 828 out[i].NX = in[i].NX; 829 out[i].NY = in[i].NY; 830 out[i].apmifit = in[i].apmifit; 831 out[i].dapmifit = in[i].dapmifit; 832 out[i].Mcal = in[i].Mcal; 833 out[i].dMcal = in[i].dMcal; 834 out[i].Xm = in[i].Xm; 835 out[i].photcode = in[i].photcode; 836 out[i].exptime = in[i].exptime; 837 out[i].sidtime = in[i].sidtime; 838 out[i].latitude = in[i].latitude; 839 840 out[i].RAo = in[i].RAo; 841 out[i].DECo = in[i].DECo; 842 out[i].Radius = in[i].Radius; 843 out[i].refColorBlue = in[i].refColorBlue; 844 out[i].refColorRed = in[i].refColorRed; 845 846 out[i].detection_limit = in[i].detection_limit; 847 out[i].saturation_limit = in[i].saturation_limit; 848 out[i].cerror = in[i].cerror; 849 out[i].fwhm_x = in[i].fwhm_x; 850 out[i].fwhm_y = in[i].fwhm_y; 851 out[i].trate = in[i].trate; 852 out[i].ccdnum = in[i].ccdnum; 853 out[i].flags = in[i].flags; 854 out[i].imageID = in[i].imageID; 855 out[i].parentID = in[i].parentID; 856 out[i].externID = in[i].externID; 857 out[i].sourceID = in[i].sourceID; 858 859 // as of 2011.02.03, the old Mx,My,..., Mxxxx,Myyyy have been deprecated and replaced 860 // with the following. (no real databases used those values -- see 861 // libdvo/doc/dvo-images.txt) 862 out[i].nLinkAstrom = in[i].nLinkAstrom; 863 out[i].nLinkPhotom = in[i].nLinkPhotom; 864 out[i].ubercalDist = in[i].ubercalDist; 865 out[i].dXpixSys = in[i].dXpixSys; 866 out[i].dYpixSys = in[i].dYpixSys; 867 out[i].dMagSys = in[i].dMagSys; 868 out[i].nFitAstrom = in[i].nFitAstrom; 869 out[i].nFitPhotom = in[i].nFitPhotom; 870 out[i].photom_map_id = in[i].photom_map_id; 871 out[i].astrom_map_id = in[i].astrom_map_id; 872 } 873 return (out); 874 } 875 876 PhotCode *PhotCode_PS1_V5_To_Internal (PhotCode_PS1_V5 *in, off_t Nvalues) { 877 878 off_t i; 879 PhotCode *out; 880 881 ALLOCATE_ZERO (out, PhotCode, Nvalues); 882 883 for (i = 0; i < Nvalues; i++) { 884 strncpy (out[i].name, in[i].name, 31); // out[32], in[32] 885 out[i].name[31] = 0; // force termination 886 887 out[i].code = in[i].code; 888 out[i].type = in[i].type; 889 out[i].C = in[i].C; 890 out[i].dC = in[i].dC; 891 out[i].dX = in[i].dX; 892 out[i].K = in[i].K; 893 out[i].c1 = in[i].c1; 894 out[i].c2 = in[i].c2; 895 out[i].equiv = in[i].equiv; 896 out[i].Nc = in[i].Nc; 897 memcpy (out[i].X, in[i].X, 4*sizeof(float)); 898 899 out[i].astromErrSys = in[i].astromErrSys; 900 out[i].astromErrScale = in[i].astromErrScale; 901 out[i].astromErrMagScale = in[i].astromErrMagScale; 902 out[i].photomErrSys = in[i].photomErrSys; 903 904 out[i].photomPoorMask = in[i].photomPoorMask; 905 out[i].photomBadMask = in[i].photomBadMask; 906 out[i].astromPoorMask = in[i].astromPoorMask; 907 out[i].astromBadMask = in[i].astromBadMask; 908 } 909 return (out); 910 } 911 912 PhotCode_PS1_V5 *PhotCode_Internal_To_PS1_V5 (PhotCode *in, off_t Nvalues) { 913 914 off_t i; 915 PhotCode_PS1_V5 *out; 916 917 ALLOCATE_ZERO (out, PhotCode_PS1_V5, Nvalues); 918 919 for (i = 0; i < Nvalues; i++) { 920 strncpy (out[i].name, in[i].name, 31); // out[32], in[32] 921 out[i].name[31] = 0; // force termination 922 923 out[i].code = in[i].code; 924 out[i].type = in[i].type; 925 out[i].C = in[i].C; 926 out[i].dC = in[i].dC; 927 out[i].dX = in[i].dX; 928 out[i].K = in[i].K; 929 out[i].c1 = in[i].c1; 930 out[i].c2 = in[i].c2; 931 out[i].equiv = in[i].equiv; 932 out[i].Nc = in[i].Nc; 933 memcpy (out[i].X, in[i].X, 4*sizeof(float)); 934 935 out[i].astromErrSys = in[i].astromErrSys; 936 out[i].astromErrScale = in[i].astromErrScale; 937 out[i].astromErrMagScale = in[i].astromErrMagScale; 938 out[i].photomErrSys = in[i].photomErrSys; 939 940 out[i].photomPoorMask = in[i].photomPoorMask; 941 out[i].photomBadMask = in[i].photomBadMask; 942 out[i].astromPoorMask = in[i].astromPoorMask; 943 out[i].astromBadMask = in[i].astromBadMask; 944 } 945 return (out); 946 } 947 948 /*********************** old / alternate version **********************/ 949 950 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 951 Average *Average_PS1_V5alt_ToInternal (Average_PS1_V5alt *in, off_t Nvalues) { 952 953 off_t i; 954 Average *out; 955 956 ALLOCATE_ZERO (out, Average, Nvalues); 957 958 for (i = 0; i < Nvalues; i++) { 959 dvo_average_init (&out[i]); 960 961 out[i].R = in[i].R; 962 out[i].D = in[i].D; 963 out[i].dR = in[i].dR; 964 out[i].dD = in[i].dD; 965 out[i].uR = in[i].uR; 966 out[i].uD = in[i].uD; 967 out[i].duR = in[i].duR; 968 out[i].duD = in[i].duD; 969 out[i].P = in[i].P; 970 out[i].dP = in[i].dP; 971 972 out[i].Rstk = in[i].Rstk; 973 out[i].Dstk = in[i].Dstk; 974 out[i].dRstk = in[i].dRstk; 975 out[i].dDstk = in[i].dDstk; 976 977 out[i].ChiSqAve = in[i].ChiSqAve; 978 out[i].ChiSqPM = in[i].ChiSqPM; 979 out[i].ChiSqPar = in[i].ChiSqPar; 980 out[i].Tmean = in[i].Tmean; 981 out[i].Trange = in[i].Trange; 982 983 out[i].psfQF = in[i].psfQF; 984 out[i].psfQFperf = in[i].psfQFperf; 985 out[i].stargal = in[i].stargal; 986 out[i].Npos = in[i].Npos; 987 988 out[i].Nmeasure = in[i].Nmeasure; 989 out[i].Nmissing = in[i].Nmissing; 990 out[i].Nlensing = in[i].Nlensing; 991 out[i].Nlensobj = in[i].Nlensobj; 992 out[i].Nextend = in[i].Nextend; 993 994 out[i].measureOffset = in[i].measureOffset; 995 out[i].missingOffset = in[i].missingOffset; 996 out[i].lensingOffset = in[i].lensingOffset; 997 out[i].lensobjOffset = in[i].lensobjOffset; 998 out[i].starparOffset = in[i].starparOffset; 999 out[i].extendOffset = in[i].extendOffset; 1000 1001 out[i].refColorBlue = in[i].refColorBlue; 1002 out[i].refColorRed = in[i].refColorRed; 1003 1004 out[i].flags = in[i].flags; 1005 out[i].photFlagsUpper = in[i].photFlagsUpper; 1006 out[i].photFlagsLower = in[i].photFlagsLower; 1007 out[i].objID = in[i].objID; 1008 out[i].catID = in[i].catID; 1009 out[i].extID = in[i].extID; 1010 out[i].extIDgc = in[i].extIDgc; 1011 } 1012 return (out); 1013 } 1014 1015 int gfits_convert_Average_PS1_V5alt (Average_PS1_V5alt *data, off_t size, off_t nitems) { 1457 int gfits_convert_Measure_PS1_V5alt (Measure_PS1_V5alt *data, off_t size, off_t nitems) { 1016 1458 1017 1459 off_t i; 1018 1460 unsigned char *byte, tmp; 1019 1461 1020 if (size != 184) {1021 fprintf (stderr, "WARNING: mismatch in data types Average_PS1_V5alt: "OFF_T_FMT" vs %d\n", size, 184);1462 if (size != 232) { 1463 fprintf (stderr, "WARNING: mismatch in data types Measure_PS1_V5alt: "OFF_T_FMT" vs %d\n", size, 232); 1022 1464 return (FALSE); 1023 1465 } … … 1029 1471 # ifdef BYTE_SWAP 1030 1472 byte = (unsigned char *) data; 1031 for (i = 0; i < nitems; i++, byte += 184) {1473 for (i = 0; i < nitems; i++, byte += 232) { 1032 1474 /** BYTE SWAP **/ 1033 1475 SWAP_DBLE (0); // RA 1034 1476 SWAP_DBLE (8); // DEC 1035 SWAP_WORD (16); // RA_ERR 1036 SWAP_WORD (20); // DEC_ERR 1037 SWAP_WORD (24); // U_RA 1038 SWAP_WORD (28); // U_DEC 1039 SWAP_WORD (32); // V_RA_ERR 1040 SWAP_WORD (36); // V_DEC_ERR 1041 SWAP_WORD (40); // PAR 1042 SWAP_WORD (44); // PAR_ERR 1043 SWAP_DBLE (48); // RA_STK 1044 SWAP_DBLE (56); // DEC_STK 1045 SWAP_WORD (64); // RA_STK_ERR 1046 SWAP_WORD (68); // DEC_STK_ERR 1047 SWAP_WORD (72); // CHISQ_POS 1048 SWAP_WORD (76); // CHISQ_PM 1049 SWAP_WORD (80); // CHISQ_PAP 1050 SWAP_WORD (84); // MEAN_EPOCH 1051 SWAP_WORD (88); // TIME_RANGE 1052 SWAP_WORD (92); // PSF_QF 1053 SWAP_WORD (96); // PSF_QF_PERF 1054 SWAP_WORD (100); // STARGAL_SEP 1055 SWAP_BYTE (104); // NUMBER_POS 1056 SWAP_BYTE (106); // NMEASURE 1057 SWAP_BYTE (108); // NMISSING 1058 SWAP_BYTE (110); // NLENSING 1059 SWAP_BYTE (112); // NLENSOBJ 1060 SWAP_BYTE (114); // NEXTEND 1061 SWAP_WORD (116); // OFF_MEASURE 1062 SWAP_WORD (120); // OFF_MISSING 1063 SWAP_WORD (124); // OFF_LENSING 1064 SWAP_WORD (128); // OFF_LENSOBJ 1065 SWAP_WORD (132); // OFF_EXTEND 1066 SWAP_WORD (136); // OFF_PARAMS 1067 SWAP_WORD (140); // REF_COLOR_BLUE 1068 SWAP_WORD (144); // REF_COLOR_RED 1069 SWAP_WORD (148); // FLAGS 1070 SWAP_WORD (152); // PHOTFLAGS_U 1071 SWAP_WORD (156); // PHOTFLAGS_L 1072 SWAP_WORD (160); // OBJ_ID 1073 SWAP_WORD (164); // CAT_ID 1074 SWAP_DBLE (168); // EXT_ID 1075 SWAP_DBLE (176); // EXT_ID_GC 1477 SWAP_WORD (16); // MAG 1478 SWAP_WORD (20); // MAG_ERR 1479 SWAP_WORD (24); // M_APER 1480 SWAP_WORD (28); // M_APER_ERR 1481 SWAP_WORD (32); // M_KRON 1482 SWAP_WORD (36); // M_KRON_ERR 1483 SWAP_WORD (40); // M_CAL 1484 SWAP_WORD (44); // MAG_CAL_ERR 1485 SWAP_WORD (48); // M_TIME 1486 SWAP_WORD (52); // FLUX_PSF 1487 SWAP_WORD (56); // FLUX_PSF_ERR 1488 SWAP_WORD (60); // FLUX_KRON 1489 SWAP_WORD (64); // FLUX_KRON_ERR 1490 SWAP_WORD (68); // FLUX_AP 1491 SWAP_WORD (72); // FLUX_AP_ERR 1492 SWAP_WORD (76); // AIRMASS 1493 SWAP_WORD (80); // AZ 1494 SWAP_WORD (84); // X_CCD 1495 SWAP_WORD (88); // Y_CCD 1496 SWAP_WORD (92); // X_FIX 1497 SWAP_WORD (96); // Y_FIX 1498 SWAP_WORD (100); // X_OFF_KH 1499 SWAP_WORD (104); // Y_OFF_KH 1500 SWAP_WORD (108); // X_OFF_DCR 1501 SWAP_WORD (112); // Y_OFF_DCR 1502 SWAP_WORD (116); // R_OFF_GAL 1503 SWAP_WORD (120); // D_OFF_GAL 1504 SWAP_WORD (124); // SKY_FLUX 1505 SWAP_WORD (128); // SKY_FLUX_ERR 1506 SWAP_WORD (132); // TIME 1507 SWAP_WORD (136); // AVE_REF 1508 SWAP_WORD (140); // DET_ID 1509 SWAP_WORD (144); // OBJ_ID 1510 SWAP_WORD (148); // CAT_ID 1511 SWAP_DBLE (152); // EXT_ID 1512 SWAP_WORD (160); // IMAGE_ID 1513 SWAP_WORD (164); // PSF_QF 1514 SWAP_WORD (168); // PSF_QF_PEFECT 1515 SWAP_WORD (172); // PSF_CHISQ 1516 SWAP_WORD (176); // PSF_NDOF 1517 SWAP_WORD (180); // PSF_NPIX 1518 SWAP_WORD (184); // PHOT_FLAGS 1519 SWAP_WORD (188); // EXT_NSIGMA 1520 SWAP_BYTE (192); // FWHM_MAJOR 1521 SWAP_BYTE (194); // FWHM_MINOR 1522 SWAP_BYTE (196); // PSF_THETA 1523 SWAP_BYTE (198); // MXX 1524 SWAP_BYTE (200); // MXY 1525 SWAP_BYTE (202); // MYY 1526 SWAP_BYTE (204); // TIME_MSEC 1527 SWAP_BYTE (206); // PHOTCODE 1528 SWAP_BYTE (208); // X_CCD_ERR 1529 SWAP_BYTE (210); // Y_CCD_ERR 1530 SWAP_BYTE (212); // POS_SYS_ERR 1531 SWAP_BYTE (214); // POSANGLE 1532 SWAP_WORD (216); // PLTSCALE 1533 SWAP_WORD (220); // DB_FLAGS 1534 SWAP_WORD (224); // PHOT_FLAGS 1535 SWAP_WORD (228); // PADDING 1076 1536 } 1077 1537 # endif … … 1080 1540 } 1081 1541 1082 /*** add test of EXTNAME and header-defined columns? ***/1083 1542 /* return internal structure representation */ 1084 Average_PS1_V5alt *gfits_table_get_Average_PS1_V5alt (FTable *ftable, off_t *Ndata, char *swapped) {1543 Measure_PS1_V5alt *gfits_table_get_Measure_PS1_V5alt (FTable *ftable, off_t *Ndata, char *swapped) { 1085 1544 1086 1545 int Ncols; 1087 Average_PS1_V5alt *data;1546 Measure_PS1_V5alt *data; 1088 1547 1089 1548 Ncols = ftable[0].header[0].Naxis[0]; 1090 if (Ncols != 184) {1091 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 184);1549 if (Ncols != 232) { 1550 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 232); 1092 1551 return NULL; 1093 1552 } 1094 1553 1095 1554 *Ndata = ftable[0].header[0].Naxis[1]; 1096 data = ( Average_PS1_V5alt *) ftable[0].buffer;1555 data = (Measure_PS1_V5alt *) ftable[0].buffer; 1097 1556 if ((swapped == NULL) || (*swapped == FALSE)) { 1098 if (!gfits_convert_ Average_PS1_V5alt (data, sizeof (Average_PS1_V5alt), *Ndata)) {1557 if (!gfits_convert_Measure_PS1_V5alt (data, sizeof (Measure_PS1_V5alt), *Ndata)) { 1099 1558 return NULL; 1100 1559 } … … 1105 1564 } 1106 1565 1107 /****** alt secfilt **********/ 1108 1109 SecFilt *SecFilt_PS1_V5alt_ToInternal (SecFilt_PS1_V5alt *in, off_t Nvalues) { 1110 1111 off_t i; 1112 SecFilt *out; 1113 1114 ALLOCATE_ZERO (out, SecFilt, Nvalues); 1115 1116 for (i = 0; i < Nvalues; i++) { 1117 dvo_secfilt_init (&out[i]); 1118 1119 out[i].M = in[i].M; 1120 out[i].dM = in[i].dM; 1121 out[i].Map = in[i].Map; 1122 out[i].dMap = in[i].dMap; 1123 out[i].sMap = in[i].sMap; 1124 out[i].Mkron = in[i].Mkron; 1125 out[i].dMkron = in[i].dMkron; 1126 1127 out[i].Mstdev = in[i].Mstdev; 1128 out[i].Mmin = in[i].Mmin; 1129 out[i].Mmax = in[i].Mmax; 1130 out[i].Mchisq = in[i].Mchisq; 1131 1132 out[i].Ncode = in[i].Ncode; 1133 out[i].Nused = in[i].Nused; 1134 out[i].NusedKron = in[i].NusedKron; 1135 out[i].NusedAp = in[i].NusedAp; 1136 1137 out[i].flags = in[i].flags; 1138 1139 out[i].MpsfStk = in[i].MpsfStk; 1140 out[i].FpsfStk = in[i].FpsfStk; 1141 out[i].dFpsfStk = in[i].dFpsfStk; 1142 1143 out[i].MkronStk = in[i].MkronStk; 1144 out[i].FkronStk = in[i].FkronStk; 1145 out[i].dFkronStk = in[i].dFkronStk; 1146 1147 out[i].MapStk = in[i].MapStk; 1148 out[i].FapStk = in[i].FapStk; 1149 out[i].dFapStk = in[i].dFapStk; 1150 1151 out[i].stackPrmryOff = in[i].stackPrmryOff; 1152 out[i].stackBestOff = in[i].stackBestOff; 1153 1154 out[i].MpsfWrp = in[i].MpsfWrp; 1155 out[i].FpsfWrp = in[i].FpsfWrp; 1156 out[i].dFpsfWrp = in[i].dFpsfWrp; 1157 out[i].sFpsfWrp = in[i].sFpsfWrp; 1158 1159 out[i].MkronWrp = in[i].MkronWrp; 1160 out[i].FkronWrp = in[i].FkronWrp; 1161 out[i].dFkronWrp = in[i].dFkronWrp; 1162 out[i].sFkronWrp = in[i].sFkronWrp; 1163 1164 out[i].MapWrp = in[i].MapWrp; 1165 out[i].FapWrp = in[i].FapWrp; 1166 out[i].dFapWrp = in[i].dFapWrp; 1167 out[i].sFapWrp = in[i].sFapWrp; 1168 1169 out[i].NusedWrp = in[i].NusedWrp; 1170 out[i].NusedKronWrp = in[i].NusedKronWrp; 1171 out[i].NusedApWrp = in[i].NusedApWrp; 1172 1173 out[i].ubercalDist = in[i].ubercalDist; 1174 } 1175 return (out); 1176 } 1177 1178 int gfits_convert_SecFilt_PS1_V5alt (SecFilt_PS1_V5alt *data, off_t size, off_t nitems) { 1179 1180 off_t i; 1181 unsigned char *byte, tmp; 1182 1183 if (size != 160) { 1184 fprintf (stderr, "WARNING: mismatch in data types SecFilt_PS1_V5alt: "OFF_T_FMT" vs %d\n", size, 160); 1185 return (FALSE); 1186 } 1187 1188 /* provide initial values to avoid compiler warnings for non-BYTE_SWAP arch */ 1189 i = tmp = 0; 1190 byte = NULL; 1191 1192 # ifdef BYTE_SWAP 1193 byte = (unsigned char *) data; 1194 for (i = 0; i < nitems; i++, byte += 160) { 1195 /** BYTE SWAP **/ 1196 SWAP_WORD (0); // MAG 1197 SWAP_WORD (4); // MAG_ERR 1198 SWAP_WORD (8); // MAG_AP 1199 SWAP_WORD (12); // MAG_AP_ERR 1200 SWAP_WORD (16); // MAG_AP_STDEV 1201 SWAP_WORD (20); // MAG_KRON 1202 SWAP_WORD (24); // MAG_KRON_ERR 1203 SWAP_WORD (28); // MAG_KRON_STDEV 1204 SWAP_WORD (32); // MAG_STDEV 1205 SWAP_WORD (36); // MAG_MIN 1206 SWAP_WORD (40); // MAG_MAX 1207 SWAP_WORD (44); // MAG_CHI 1208 SWAP_BYTE (48); // NCODE 1209 SWAP_BYTE (50); // NUSED 1210 SWAP_BYTE (52); // NUSED_KRON 1211 SWAP_BYTE (54); // NUSED_AP 1212 SWAP_WORD (56); // FLAGS 1213 SWAP_WORD (60); // MAG_PSF_STK 1214 SWAP_WORD (64); // FLUX_PSF_STK 1215 SWAP_WORD (68); // FLUX_PSF_STK_ERR 1216 SWAP_WORD (72); // MAG_KRON_STK 1217 SWAP_WORD (76); // FLUX_KRON_STK 1218 SWAP_WORD (80); // FLUX_KRON_STK_ERR 1219 SWAP_WORD (84); // MAG_AP_STK 1220 SWAP_WORD (88); // FLUX_AP_STK 1221 SWAP_WORD (92); // FLUX_AP_STK_ERR 1222 SWAP_WORD (96); // STACK_PRIMARY_OFF 1223 SWAP_WORD (100); // STACK_BEST_OFF 1224 SWAP_WORD (104); // MAG_PSF_WRP 1225 SWAP_WORD (108); // FLUX_PSF_WRP 1226 SWAP_WORD (112); // FLUX_PSF_WRP_ERR 1227 SWAP_WORD (116); // FLUX_PSF_WRP_STD 1228 SWAP_WORD (120); // MAG_KRON_WRP 1229 SWAP_WORD (124); // FLUX_KRON_WRP 1230 SWAP_WORD (128); // FLUX_KRON_WRP_ERR 1231 SWAP_WORD (132); // FLUX_KRON_WRP_STD 1232 SWAP_WORD (136); // MAG_AP_WRP 1233 SWAP_WORD (140); // FLUX_AP_WRP 1234 SWAP_WORD (144); // FLUX_AP_WRP_ERR 1235 SWAP_WORD (148); // FLUX_AP_WRP_STD 1236 SWAP_BYTE (152); // NUSED_WRP 1237 SWAP_BYTE (154); // NUSED_KRON_WRP 1238 SWAP_BYTE (156); // NUSED_AP_WRP 1239 SWAP_BYTE (158); // UBERCAL_DIST 1240 } 1241 # endif 1242 1243 return (TRUE); 1244 } 1245 1246 /*** add test of EXTNAME and header-defined columns? ***/ 1247 /* return internal structure representation */ 1248 SecFilt_PS1_V5alt *gfits_table_get_SecFilt_PS1_V5alt (FTable *ftable, off_t *Ndata, char *swapped) { 1249 1250 int Ncols; 1251 SecFilt_PS1_V5alt *data; 1252 1253 Ncols = ftable[0].header[0].Naxis[0]; 1254 if (Ncols != 160) { 1255 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 160); 1256 return NULL; 1257 } 1258 1259 *Ndata = ftable[0].header[0].Naxis[1]; 1260 data = (SecFilt_PS1_V5alt *) ftable[0].buffer; 1261 if ((swapped == NULL) || (*swapped == FALSE)) { 1262 if (!gfits_convert_SecFilt_PS1_V5alt (data, sizeof (SecFilt_PS1_V5alt), *Ndata)) { 1263 return NULL; 1264 } 1265 gfits_table_scale_data (ftable); 1266 if (swapped != NULL) *swapped = TRUE; 1267 } 1268 return (data); 1269 } 1270 1271 Lensing *Lensing_PS1_V5_R0_ToInternal (Lensing_PS1_V5_R0 *in, off_t Nvalues) { 1272 1273 off_t i; 1274 Lensing *out; 1275 1276 ALLOCATE_ZERO (out, Lensing, Nvalues); 1277 1278 for (i = 0; i < Nvalues; i++) { 1279 dvo_lensing_init (&out[i]); 1280 1281 out[i].X11_sm_obj = in[i].X11_sm_obj; 1282 out[i].X12_sm_obj = in[i].X12_sm_obj; 1283 out[i].X22_sm_obj = in[i].X22_sm_obj; 1284 out[i].E1_sm_obj = in[i].E1_sm_obj; 1285 out[i].E2_sm_obj = in[i].E2_sm_obj; 1286 1287 out[i].X11_sh_obj = in[i].X11_sh_obj; 1288 out[i].X12_sh_obj = in[i].X12_sh_obj; 1289 out[i].X22_sh_obj = in[i].X22_sh_obj; 1290 out[i].E1_sh_obj = in[i].E1_sh_obj; 1291 out[i].E2_sh_obj = in[i].E2_sh_obj; 1292 1293 out[i].X11_sm_psf = in[i].X11_sm_psf; 1294 out[i].X12_sm_psf = in[i].X12_sm_psf; 1295 out[i].X22_sm_psf = in[i].X22_sm_psf; 1296 out[i].E1_sm_psf = in[i].E1_sm_psf; 1297 out[i].E2_sm_psf = in[i].E2_sm_psf; 1298 1299 out[i].X11_sh_psf = in[i].X11_sh_psf; 1300 out[i].X12_sh_psf = in[i].X12_sh_psf; 1301 out[i].X22_sh_psf = in[i].X22_sh_psf; 1302 out[i].E1_sh_psf = in[i].E1_sh_psf; 1303 out[i].E2_sh_psf = in[i].E2_sh_psf; 1304 1305 out[i].F_ApR5 = in[i].F_ApR5; 1306 out[i].dF_ApR5 = in[i].dF_ApR5; 1307 out[i].sF_ApR5 = in[i].sF_ApR5; 1308 out[i].fF_ApR5 = in[i].fF_ApR5; 1309 1310 out[i].F_ApR6 = in[i].F_ApR6; 1311 out[i].dF_ApR6 = in[i].dF_ApR6; 1312 out[i].sF_ApR6 = in[i].sF_ApR6; 1313 out[i].fF_ApR6 = in[i].fF_ApR6; 1314 1315 out[i].detID = in[i].detID; 1316 out[i].objID = in[i].objID; 1317 out[i].catID = in[i].catID; 1318 out[i].averef = in[i].averef; 1319 } 1320 return (out); 1321 } 1322 1323 Lensing *Lensing_PS1_V5_R1_ToInternal (Lensing_PS1_V5_R1 *in, off_t Nvalues) { 1324 1325 off_t i; 1326 Lensing *out; 1327 1328 ALLOCATE_ZERO (out, Lensing, Nvalues); 1329 1330 for (i = 0; i < Nvalues; i++) { 1331 dvo_lensing_init (&out[i]); 1332 1333 out[i].X11_sm_obj = in[i].X11_sm_obj; 1334 out[i].X12_sm_obj = in[i].X12_sm_obj; 1335 out[i].X22_sm_obj = in[i].X22_sm_obj; 1336 out[i].E1_sm_obj = in[i].E1_sm_obj; 1337 out[i].E2_sm_obj = in[i].E2_sm_obj; 1338 1339 out[i].X11_sh_obj = in[i].X11_sh_obj; 1340 out[i].X12_sh_obj = in[i].X12_sh_obj; 1341 out[i].X22_sh_obj = in[i].X22_sh_obj; 1342 out[i].E1_sh_obj = in[i].E1_sh_obj; 1343 out[i].E2_sh_obj = in[i].E2_sh_obj; 1344 1345 out[i].X11_sm_psf = in[i].X11_sm_psf; 1346 out[i].X12_sm_psf = in[i].X12_sm_psf; 1347 out[i].X22_sm_psf = in[i].X22_sm_psf; 1348 out[i].E1_sm_psf = in[i].E1_sm_psf; 1349 out[i].E2_sm_psf = in[i].E2_sm_psf; 1350 1351 out[i].X11_sh_psf = in[i].X11_sh_psf; 1352 out[i].X12_sh_psf = in[i].X12_sh_psf; 1353 out[i].X22_sh_psf = in[i].X22_sh_psf; 1354 out[i].E1_sh_psf = in[i].E1_sh_psf; 1355 out[i].E2_sh_psf = in[i].E2_sh_psf; 1356 1357 out[i].F_ApR5 = in[i].F_ApR5; 1358 out[i].dF_ApR5 = in[i].dF_ApR5; 1359 out[i].sF_ApR5 = in[i].sF_ApR5; 1360 out[i].fF_ApR5 = in[i].fF_ApR5; 1361 1362 out[i].F_ApR6 = in[i].F_ApR6; 1363 out[i].dF_ApR6 = in[i].dF_ApR6; 1364 out[i].sF_ApR6 = in[i].sF_ApR6; 1365 out[i].fF_ApR6 = in[i].fF_ApR6; 1366 1367 out[i].detID = in[i].detID; 1368 out[i].objID = in[i].objID; 1369 out[i].catID = in[i].catID; 1370 out[i].averef = in[i].averef; 1371 1372 out[i].imageID = in[i].imageID; 1373 } 1374 return (out); 1375 } 1376 1566 -
trunk/Ohana/src/libdvo/src/dvo_tiny_values.c
r37807 r38062 2 2 3 3 void CopyAverageToTiny (AverageTiny *averageT, Average *average) { 4 memset (averageT, 0, sizeof(AverageTiny)); 4 5 averageT[0].R = average[0].R; 5 6 averageT[0].D = average[0].D; … … 14 15 15 16 void CopyMeasureToTiny (MeasureTiny *measureT, Measure *measure) { 17 memset (measureT, 0, sizeof(MeasureTiny)); 16 18 measureT[0].R = measure[0].R; 17 19 measureT[0].D = measure[0].D; -
trunk/Ohana/src/libfits/include/gfitsio.h
r37807 r38062 147 147 148 148 int gfits_init_matrix PROTO((Matrix *matrix)); 149 off_t gfits_npix_matrix PROTO((Matrix *matrix)); 149 150 void gfits_add_matrix_value PROTO((Matrix *matrix, off_t x, off_t y, double value)); 150 151 int gfits_convert_format PROTO((Header *header, Matrix *matrix, int outBitpix, double outScale, double outZero, int inBlank, int outUnsign)); -
trunk/Ohana/src/libfits/matrix/F_convert_format.c
r27435 r38062 90 90 91 91 /*********************** fits convert format ***********************************/ 92 /* this function is safe in the number of axes (can even be 0) */ 92 93 int gfits_convert_format (Header *header, Matrix *matrix, int outBitpix, double outScale, double outZero, int inBlank, int outUnsign) { 93 94 94 unsigned long i, nbytes, Npixels;95 off_t i, nbytes; 95 96 int inBitpix, inUnsign; 96 97 double inScale, inZero; … … 116 117 gfits_modify_alt (header, "UNSIGN", "%t", 1, outUnsign); 117 118 118 Npixels = header[0].Naxis[0]*header[0].Naxis[1];119 nbytes = Npixels * (abs(outBitpix) / 8);119 off_t Npixels = gfits_npix_matrix (matrix); 120 nbytes = Npixels * (abs(outBitpix) / 8); 120 121 121 122 A = inScale / outScale; -
trunk/Ohana/src/libfits/matrix/F_create_M.c
r35756 r38062 43 43 } 44 44 45 // XXX free buffer if non-null: need to double check for existing frees 45 /*********************** return number of valid pixels *******************************/ 46 off_t gfits_npix_matrix (Matrix *matrix) { 47 48 if (!matrix->Naxes) return 0; 49 50 int i; 51 int Npix = 1; 52 for (i = 0; i < matrix->Naxes; i++) { 53 if (matrix->Naxis[i] == 0) break; 54 Npix *= matrix->Naxis[i]; 55 } 56 return Npix; 57 } -
trunk/Ohana/src/libohana/src/config.c
r34088 r38062 146 146 NBYTES = D_NBYTES; 147 147 ALLOCATE (ibuffer, char, NBYTES + 2); 148 memset (ibuffer, 0, NBYTES + 2); 148 149 149 150 /* load data from file */ -
trunk/Ohana/src/libohana/src/findexec.c
r33646 r38062 429 429 ALLOCATE (newpath, char, Nbytes); 430 430 snprintf (newpath, Nbytes, "%s/%s", cwd, oldpath); 431 432 real_free (cwd); 431 433 return newpath; 432 434 } -
trunk/Ohana/src/opihi/cmd.astro/Makefile
r37807 r38062 29 29 $(SRC)/czplot.$(ARCH).o \ 30 30 $(SRC)/cdensify.$(ARCH).o \ 31 $(SRC)/cdhistogram.$(ARCH).o \ 31 32 $(SRC)/drizzle.$(ARCH).o \ 32 33 $(SRC)/flux.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.astro/cdensify.c
r37807 r38062 111 111 switch (PSFTYPE) { 112 112 case IS_DOT: 113 RD_to_XY (&x, &y, rn, *d, &graphmode.coords);114 Xb = (x - Xmin) / dX;115 Yb = (y - Ymin) / dY;116 117 113 RD_to_XY (&x, &y, rn, *d, &newcoords); 118 114 Xb = (int) x; -
trunk/Ohana/src/opihi/cmd.astro/init.c
r37807 r38062 14 14 int czcplot PROTO((int, char **)); 15 15 int cdensify PROTO((int, char **)); 16 int cdhistogram PROTO((int, char **)); 16 17 int drizzle PROTO((int, char **)); 17 18 int flux PROTO((int, char **)); … … 77 78 {1, "czplot", czplot, "plot scaled vectors in sky coordinates"}, 78 79 {1, "czcplot", czcplot, "plot color-scaled vectors in sky coordinates"}, 79 {1, "cdensify", cdensify, "vectors to density history on projection"}, 80 {1, "cdensify", cdensify, "vectors to density history on projection"}, 81 {1, "cdhistogram", cdhistogram, "vectors to 3D histogram on projection"}, 80 82 {1, "drizzle", drizzle, "transform image to image"}, 81 83 {1, "flux", flux, "flux in a convex contour"}, -
trunk/Ohana/src/opihi/cmd.data/Makefile
r37807 r38062 61 61 $(SRC)/ungridify.$(ARCH).o \ 62 62 $(SRC)/histogram.$(ARCH).o \ 63 $(SRC)/tdhistogram.$(ARCH).o \ 63 64 $(SRC)/hermitian1d.$(ARCH).o \ 64 65 $(SRC)/hermitian2d.$(ARCH).o \ … … 89 90 $(SRC)/medacc.$(ARCH).o \ 90 91 $(SRC)/mget.$(ARCH).o \ 92 $(SRC)/mget3d.$(ARCH).o \ 91 93 $(SRC)/minterpolate.$(ARCH).o \ 92 94 $(SRC)/medimage.$(ARCH).o \ … … 130 132 $(SRC)/imspline_apply.$(ARCH).o \ 131 133 $(SRC)/imspline_construct.$(ARCH).o \ 134 $(SRC)/squash3d.$(ARCH).o \ 132 135 $(SRC)/imstats.$(ARCH).o \ 133 136 $(SRC)/style.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/init.c
r37807 r38062 51 51 int ungridify PROTO((int, char **)); 52 52 int histogram PROTO((int, char **)); 53 int tdhistogram PROTO((int, char **)); 53 54 int hermitian1d PROTO((int, char **)); 54 55 int hermitian2d PROTO((int, char **)); … … 80 81 int medacc PROTO((int, char **)); 81 82 int mget PROTO((int, char **)); 83 int mget3d PROTO((int, char **)); 82 84 int minterp PROTO((int, char **)); 83 85 int medimage_command PROTO((int, char **)); … … 117 119 int imspline_apply PROTO((int, char **)); 118 120 int imspline_construct PROTO((int, char **)); 121 int squash3d PROTO((int, char **)); 119 122 int stats PROTO((int, char **)); 120 123 int imstats PROTO((int, char **)); … … 217 220 {1, "header", header, "print image header"}, 218 221 {1, "histogram", histogram, "generate histogram from vector"}, 222 {1, "tdhistogram", tdhistogram, "generate 2D histogram image from vector set"}, 219 223 {1, "hermitian1d", hermitian1d, "generate 1-D Hermitian Polynomial"}, 220 224 {1, "hermitian2d", hermitian2d, "generate 2-D Hermitian Polynomial"}, … … 243 247 {1, "medacc", medacc, "accumulate vector values in another vector"}, 244 248 {1, "mget", mget, "extract a vector from an image"}, 249 {1, "mget3d", mget3d, "extract a vector from a 3D image"}, 245 250 {1, "imget", mget, "extract a vector from an image"}, 246 251 {1, "minterp", minterp, "interpolate image pixels"}, … … 289 294 {1, "imspline.apply", imspline_apply, "apply spline fit to generate an image"}, 290 295 {1, "imspline.const", imspline_construct, "create spline 2nd deriv. terms"}, 296 {1, "squash3d", squash3d, "squash 3d buffer to 2d"}, 291 297 {1, "stats", imstats, "statistics on a portion of an image"}, 292 298 {1, "style", style, "set the style for graph plots"}, -
trunk/Ohana/src/opihi/cmd.data/interpolate.c
r20936 r38062 1 1 # include "data.h" 2 2 3 // XXX use 'threshold' to interpolate to a value 3 4 int interpolate (int argc, char **argv) { 4 5 … … 11 12 gprint (GP_ERR, "USAGE: interpolate Xi Yi Xo Yo\n"); 12 13 gprint (GP_ERR, " Xi Yi - sorted reference vectors\n"); 13 gprint (GP_ERR, " Xo - output positions\n"); 14 gprint (GP_ERR, " Yo - output values\n"); 14 gprint (GP_ERR, " Xo - output positions (vector)\n"); 15 gprint (GP_ERR, " Yo - output values (vector)\n"); 16 gprint (GP_ERR, " (use 'threshold' to interpolate to a value)\n"); 15 17 return (FALSE); 16 18 } … … 18 20 if ((xin = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE); 19 21 if ((yin = SelectVector (argv[2], OLDVECTOR, TRUE)) == NULL) return (FALSE); 22 23 // target positions are a vector 20 24 if ((xout = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE); 21 25 if ((yout = SelectVector (argv[4], ANYVECTOR, TRUE)) == NULL) return (FALSE); -
trunk/Ohana/src/opihi/cmd.data/mcreate.c
r9275 r38062 3 3 int mcreate (int argc, char **argv) { 4 4 5 int N x, Ny;5 int N; 6 6 Buffer *buf; 7 7 8 int Nz = 0; 9 if ((N = get_argument (argc, argv, "-nz"))) { 10 remove_argument (N, &argc, argv); 11 Nz = atoi (argv[N]); 12 remove_argument (N, &argc, argv); 13 } 14 8 15 if (argc != 4) { 9 gprint (GP_ERR, "USAGE: mcreate <buffer> Nx Ny \n");16 gprint (GP_ERR, "USAGE: mcreate <buffer> Nx Ny [-nz Nz]\n"); 10 17 return (FALSE); 11 18 } 12 19 13 20 if ((buf = SelectBuffer (argv[1], ANYBUFFER, TRUE)) == NULL) return (FALSE); 14 Nx = atof (argv[2]);15 Ny = atof (argv[3]);21 int Nx = atof (argv[2]); 22 int Ny = atof (argv[3]); 16 23 17 24 /* I should encapsulate this in a create_default_buffer */ 18 25 gfits_free_matrix (&buf[0].matrix); 19 26 gfits_free_header (&buf[0].header); 20 CreateBuffer (buf, Nx, Ny, -32, 1.0, 0.0); 27 28 if (Nz) { 29 CreateBuffer3D (buf, Nx, Ny, Nz, -32, 1.0, 0.0); 30 } else { 31 CreateBuffer (buf, Nx, Ny, -32, 1.0, 0.0); 32 } 21 33 return (TRUE); 22 34 } -
trunk/Ohana/src/opihi/cmd.data/rd.c
r29938 r38062 4 4 int rd (int argc, char **argv) { 5 5 6 int i, N, status, plane, Nplane, extend, Nextend, Nskip, JustHead, blank; 7 int ccdsel, done, Nword, IsCompressed; 8 char region[512], *ccdid, *filename; 9 FILE *f; 6 int i, N, Nskip, blank; 7 int done, Nword; 8 char region[512]; 10 9 Buffer *buf; 11 10 12 JustHead = FALSE;11 int JustHead = FALSE; 13 12 if ((N = get_argument (argc, argv, "-head"))) { 14 13 remove_argument (N, &argc, argv); … … 16 15 } 17 16 18 plane =1;17 int plane = -1; 19 18 if ((N = get_argument (argc, argv, "-plane"))) { 20 19 remove_argument (N, &argc, argv); … … 23 22 } 24 23 25 extend = FALSE;26 Nextend = -1;24 int extend = FALSE; 25 int Nextend = -1; 27 26 if ((N = get_argument (argc, argv, "-x"))) { 28 27 remove_argument (N, &argc, argv); … … 32 31 } 33 32 34 ccdsel = FALSE;35 c cdid = (char *)NULL;33 int ccdsel = FALSE; 34 char *ccdid = NULL; 36 35 if ((N = get_argument (argc, argv, "-n"))) { 37 36 remove_argument (N, &argc, argv); … … 52 51 53 52 /* test if file exists */ 54 f = fopen (argv[2], "r");53 FILE *f = fopen (argv[2], "r"); 55 54 if (f == (FILE *) NULL) { 56 55 gprint (GP_ERR, "file %s not found\n", argv[2]); … … 67 66 68 67 /* save file name */ 69 filename = filebasename (argv[2]);68 char *filename = filebasename (argv[2]); 70 69 strcpy (buf[0].file, filename); 71 70 free (filename); 72 71 73 status = FALSE;74 IsCompressed = FALSE;72 int status = FALSE; 73 int IsCompressed = FALSE; 75 74 76 75 /*** advance to the correct FITS extension ***/ … … 168 167 169 168 /* check for valid plane */ 170 Nplane = buf[0].header.Naxis[2]; 171 if (Nplane == 0) Nplane = 1; 172 if (plane > Nplane) { 173 gprint (GP_ERR, "-plane is too large: %d total planes\n", Nplane); 174 DeleteBuffer (buf); 175 fclose (f); 176 return (FALSE); 169 int Nz = buf[0].header.Naxis[2]; 170 if (plane >= 0) { 171 // we are requesting a specific plane (-1 : all data) 172 int tooFar = Nz ? (plane >= Nz) : (plane > Nz); 173 if (tooFar) { 174 gprint (GP_ERR, "-plane is too large: %d total planes\n", Nz); 175 DeleteBuffer (buf); 176 fclose (f); 177 return (FALSE); 178 } 177 179 } 178 180 179 181 /* load matrix data */ 180 182 if (IsCompressed) { 183 if (plane > -1) { 184 gprint (GP_ERR, "-plane incompatible with compressed image\n"); 185 DeleteBuffer (buf); 186 fclose (f); 187 return (FALSE); 188 } 181 189 FTable ftable; 182 190 Header theader; … … 191 199 // XXX this currently does not work for a cube (we get a cube back, not a specific plane) 192 200 } else { 193 sprintf (region, "-1 -1 -1 -1 %d %d", (plane - 1), plane); 194 status = gfits_fread_matrix_segment (f, &buf[0].matrix, &buf[0].header, region); 201 if (plane > -1) { 202 // read a single plane into a 2D image 203 sprintf (region, "-1 -1 -1 -1 %d %d", (plane - 1), plane); 204 status = gfits_fread_matrix_segment (f, &buf[0].matrix, &buf[0].header, region); 205 buf[0].header.Naxis[2] = 0; 206 buf[0].header.Naxes = 2; 207 gfits_modify (&buf[0].header, "NAXIS", "%d", 1, 2); 208 gfits_modify (&buf[0].header, "NAXIS3", "%d", 1, 0); 209 } else { 210 status = gfits_fread_matrix (f, &buf[0].matrix, &buf[0].header); 211 } 195 212 } 196 213 fclose (f); … … 200 217 DeleteBuffer (buf); 201 218 return (FALSE); 202 }203 204 /* adjust buffer to represent 2D data */205 if (Nplane > 1) {206 buf[0].header.Naxis[2] = 0;207 buf[0].header.Naxes = 2;208 gfits_modify (&buf[0].header, "NAXIS", "%d", 1, 2);209 gfits_delete (&buf[0].header, "NAXIS3", 1);210 219 } 211 220 … … 215 224 buf[0].header.Naxis[1] = 1; 216 225 buf[0].matrix.Naxis[1] = 1; 226 gfits_modify (&buf[0].header, "NAXIS", "%d", 1, 2); 227 gfits_modify (&buf[0].header, "NAXIS2", "%d", 1, 1); 217 228 } 218 229 -
trunk/Ohana/src/opihi/cmd.data/read_vectors.c
r37807 r38062 372 372 } 373 373 374 int VERBOSE = FALSE; 375 if ((N = get_argument (argc, argv, "-v"))) { 376 remove_argument (N, &argc, argv); 377 VERBOSE = TRUE; 378 } 379 374 380 int start = 0; 375 381 int Nrows = -1; // -1 : read entire table … … 399 405 // } 400 406 401 if (argc < 2) ESCAPE ("USAGE: read -fits extension [-extnum] [-keyword key] name name ...\n"); 407 if ((argc < 2) && !getSizes) ESCAPE ("USAGE: read -fits extension [-extnum] [-keyword key] name name ...\n"); 408 if ((argc != 1) && getSizes) ESCAPE ("USAGE: read -sizes -fits extension [-extnum] (does not read data values)\n"); 402 409 403 410 if (f == NULL) ESCAPE ("file not found\n"); … … 436 443 if (start >= header.Naxis[1]) ESCAPE ("invalid range: start >= Ny (%d)\n", header.Naxis[1]); 437 444 if (Nrows < 0) ESCAPE ("invalid range: Nrows < 0\n"); 438 if (start + Nrows > header.Naxis[1]) ESCAPE ("invalid range: start + Nrows > Ny (%d)\n", header.Naxis[1]); 445 446 // just a warning: 447 if (start + Nrows > header.Naxis[1]) { 448 if (VERBOSE) gprint (GP_ERR, "NOTE: reading last block will return only %d rows\n", header.Naxis[1] - start); 449 } 439 450 440 451 // Ny = 100, start = 0, Nrows = -1 -> Nrows => 100 … … 472 483 } 473 484 485 if (getSizes) { 486 read_table_sizes (&header); 487 if (CCDKeyword != NULL) free (CCDKeyword); 488 gfits_free_header (&header); 489 return TRUE; 490 } 491 474 492 if (Nrows == -1) { 475 493 Nrows = header.Naxis[1] - start; … … 478 496 if (start >= header.Naxis[1]) ESCAPE ("invalid range: start >= Ny (%d)\n", header.Naxis[1]); 479 497 if (Nrows < 0) ESCAPE ("invalid range: Nrows < 0\n"); 480 if (start + Nrows > header.Naxis[1]) ESCAPE ("invalid range: start + Nrows > Ny (%d)\n", header.Naxis[1]); 498 499 // just a warning: 500 if (start + Nrows > header.Naxis[1]) { 501 if (VERBOSE) gprint (GP_ERR, "NOTE: reading last block will return only %d rows\n", header.Naxis[1] - start); 502 } 481 503 482 504 if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend); … … 603 625 604 626 set_int_variable ("table:Nx", header->Naxis[0]); 605 set_int_variable ("table:N x", header->Naxis[0]);627 set_int_variable ("table:Ny", header->Naxis[1]); 606 628 set_int_variable ("table:Nfields", Nfields); 607 629 -
trunk/Ohana/src/opihi/cmd.data/tv.c
r37807 r38062 28 28 } 29 29 30 int plane = 0; 31 if ((N = get_argument (argc, argv, "-plane"))) { 32 remove_argument (N, &argc, argv); 33 plane = atoi (argv[N]); 34 remove_argument (N, &argc, argv); 35 } 36 if (plane < 0) { 37 gprint (GP_ERR, " ERROR: -plane (plane) : cannot be negative\n"); 38 return (FALSE); 39 } 40 30 41 /* shell exits on pipe close, FIX */ 31 42 if ((N = get_argument (argc, argv, "-kill"))) { … … 55 66 GetCoords (&coords, &buf[0].header); 56 67 57 image.data1d = (float *) buf[0].matrix.buffer;58 68 image.Nx = buf[0].matrix.Naxis[0]; 59 69 image.Ny = buf[0].matrix.Naxis[1]; 70 71 int tooBig = buf[0].matrix.Naxis[2] ? (plane >= buf[0].matrix.Naxis[2]) : plane > 0; 72 if (tooBig) { 73 gprint (GP_ERR, " ERROR: -plane (plane) : out of bounds (%d vs %d)\n", plane, buf[0].matrix.Naxis[2]); 74 return (FALSE); 75 } 76 int Npix2D = image.Nx * image.Ny; 77 78 float *imdata = (float *) buf[0].matrix.buffer; 79 image.data1d = &imdata[plane*Npix2D]; 60 80 61 81 // send only the root of the file, not the full path -
trunk/Ohana/src/opihi/cmd.data/wd.c
r27435 r38062 81 81 memcpy (temp_header.buffer, buf[0].header.buffer, temp_header.datasize); 82 82 83 if (temp_header.Naxes) { 84 // the inBlank value probably does not matter: temp_matrix is float, so nan is used 85 gfits_convert_format (&temp_header, &temp_matrix, outBitpix, outScale, outZero, 0xffff, outUnsign); 86 } else { 87 gfits_modify (&temp_header, "BITPIX", "%d", 1, outBitpix); 88 gfits_modify (&temp_header, "BSCALE", "%lf", 1, outScale); 89 gfits_modify (&temp_header, "BZERO", "%lf", 1, outZero); 90 gfits_modify_alt (&temp_header, "UNSIGN", "%t", 1, outUnsign); 91 } 83 gfits_convert_format (&temp_header, &temp_matrix, outBitpix, outScale, outZero, 0xffff, outUnsign); 92 84 85 // Extend puts the output matrix in the first available non-PHU slot (ie, the last one) 86 // it updates NEXTEND and set EXTEND to TRUE, and modifies the PHU header (neither should happen) 87 // if those keywords do not exist... 93 88 if (Extend) { 94 89 Header Xhead; -
trunk/Ohana/src/opihi/cmd.data/zplot.c
r34613 r38062 4 4 5 5 char *outname = NULL; 6 int i, kapa, valid, size;6 int i, N, kapa, valid, size; 7 7 opihi_flt *out; 8 8 double min, range; 9 9 Graphdata graphmode; 10 Vector *xvec, *yvec, *zvec, Zvec;10 Vector *xvec, *yvec, *zvec, *dxmvec, *dxpvec, *dymvec, *dypvec, Zvec; 11 11 12 12 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 13 14 /* decide on error bars */ 15 dxmvec = dxpvec = dymvec = dypvec = NULL; 16 if ((N = get_argument (argc, argv, "-dx"))) { 17 remove_argument (N, &argc, argv); 18 if ((dxmvec = SelectVector (argv[N], OLDVECTOR, TRUE)) == NULL) return (FALSE); 19 remove_argument (N, &argc, argv); 20 } 21 if ((N = get_argument (argc, argv, "+dx"))) { 22 remove_argument (N, &argc, argv); 23 if ((dxpvec = SelectVector (argv[N], OLDVECTOR, TRUE)) == NULL) return (FALSE); 24 remove_argument (N, &argc, argv); 25 } 26 if ((N = get_argument (argc, argv, "-dy"))) { 27 remove_argument (N, &argc, argv); 28 if ((dymvec = SelectVector (argv[N], OLDVECTOR, TRUE)) == NULL) return (FALSE); 29 remove_argument (N, &argc, argv); 30 } 31 if ((N = get_argument (argc, argv, "+dy"))) { 32 remove_argument (N, &argc, argv); 33 if ((dypvec = SelectVector (argv[N], OLDVECTOR, TRUE)) == NULL) return (FALSE); 34 remove_argument (N, &argc, argv); 35 } 13 36 14 37 valid = (argc == 6); … … 40 63 } 41 64 65 /* set errorbar mode (these are NOT sticky) */ 66 graphmode.etype = 0; 67 if ((dymvec != NULL) && (dypvec == NULL)) dypvec = dymvec; 68 if ((dypvec != NULL) && (dymvec == NULL)) dymvec = dypvec; 69 if ((dypvec != NULL) || (dymvec != NULL)) graphmode.etype |= 0x01; 70 if ((dxmvec != NULL) && (dxpvec == NULL)) dxpvec = dxmvec; 71 if ((dxpvec != NULL) && (dxmvec == NULL)) dxmvec = dxpvec; 72 if ((dxpvec != NULL) || (dxmvec != NULL)) graphmode.etype |= 0x02; 73 42 74 /* find vectors */ 43 75 if ((xvec = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE); … … 56 88 return (FALSE); 57 89 } 90 if (dypvec && (dypvec->Nelements != xvec->Nelements)) goto mismatch; 91 if (dymvec && (dymvec->Nelements != xvec->Nelements)) goto mismatch; 92 if (dxpvec && (dxpvec->Nelements != xvec->Nelements)) goto mismatch; 93 if (dxmvec && (dxmvec->Nelements != xvec->Nelements)) goto mismatch; 94 58 95 SetVector (&Zvec, OPIHI_FLT, zvec[0].Nelements); 59 96 out = Zvec.elements.Flt; 60 97 98 // note actual size is 3.3x plot -sz sizes. (DrawObjects.c:399) 61 99 if (zvec[0].type == OPIHI_FLT) { 62 100 opihi_flt *in = zvec[0].elements.Flt; … … 81 119 graphmode.style = 2; /* plot points */ 82 120 graphmode.size = -1; /* point size determined by Zvec */ 83 graphmode.etype = 0; /* no errorbars */84 121 PlotVectorTriplet (kapa, xvec, yvec, &Zvec, mask, &graphmode); 122 if (graphmode.etype & 0x01) { 123 PlotVectorSingle (kapa, dymvec, mask, "dym"); 124 PlotVectorSingle (kapa, dypvec, mask, "dyp"); 125 } 126 if (graphmode.etype & 0x02) { 127 PlotVectorSingle (kapa, dxmvec, mask, "dxm"); 128 PlotVectorSingle (kapa, dxpvec, mask, "dxp"); 129 } 85 130 86 131 free (Zvec.elements.Ptr); 87 132 if (mask) free (mask); 88 DeleteNamedVector (outname); 133 134 if (outname) { 135 DeleteNamedVector (outname); 136 free (outname); 137 } 89 138 90 139 return (TRUE); 91 140 141 mismatch: 142 gprint (GP_ERR, "error and data vector lengths are mismatched\n"); 143 if (outname) { 144 DeleteNamedVector (outname); 145 free (outname); 146 } 147 return (FALSE); 92 148 } 93 149 -
trunk/Ohana/src/opihi/dvo/avextract.c
r37807 r38062 221 221 222 222 for (n = 0; n < Nfields; n++) { 223 // we are passing in the *first* measure, but average->Nmeasure gives the count 223 224 values[n] = dbExtractAverages (average, secfilt, measure, lensobj, starpar, &fields[n]); 224 225 } -
trunk/Ohana/src/opihi/include/dvomath.h
r37807 r38062 187 187 int ListBuffersToList PROTO((char *name)); 188 188 int CreateBuffer PROTO((Buffer *buf, int Nx, int Ny, int bitpix, float bzero, float bscale)); 189 int CreateBuffer3D PROTO((Buffer *buf, int Nx, int Ny, int Nz, int bitpix, float bzero, float bscale)); 189 190 int ResetBuffer PROTO((Buffer *buf, int Nx, int Ny, int bitpix, float bzero, float bscale)); 190 191 Buffer *SelectBuffer PROTO((char *name, int mode, int verbose)); -
trunk/Ohana/src/opihi/lib.shell/BufferOps.c
r37807 r38062 120 120 } 121 121 122 // buffer is 1D array referenced in the order: 123 // buffer[x + Nx*y + Nx*Ny*z + ...] 124 int CreateBuffer3D (Buffer *buf, int Nx, int Ny, int Nz, int bitpix, float bzero, float bscale) { 125 126 /* store the default output values */ 127 gfits_init_header (&buf[0].header); 128 129 /* assign the necessary internal values */ 130 buf[0].header.bitpix = -32; 131 buf[0].header.Naxes = 3; 132 buf[0].header.Naxis[0] = Nx; 133 buf[0].header.Naxis[1] = Ny; 134 buf[0].header.Naxis[2] = Nz; 135 136 buf[0].bitpix = bitpix; 137 buf[0].bzero = bzero; 138 buf[0].bscale = bscale; 139 140 /* make some test of the validity of the values */ 141 142 /* create the appropriate header and matrix */ 143 gfits_create_header (&buf[0].header); 144 gfits_create_matrix (&buf[0].header, &buf[0].matrix); 145 146 return (TRUE); 147 } 148 122 149 /* copy data from in to out - new memory space */ 123 150 int CopyNamedBuffer (char *out, char *in) { -
trunk/Ohana/src/opihi/lib.shell/check_stack.c
r36375 r38062 6 6 int check_stack (StackVar *stack, int Nstack, int validsize) { 7 7 8 int i, Nx, Ny, N v, size;8 int i, Nx, Ny, Nz, Nv, size; 9 9 char *c1, *c2; 10 10 11 Nv = Nx = Ny = -1;11 Nv = Nx = Ny = Nz = -1; 12 12 13 13 for (i = 0; i < Nstack; i++) { … … 46 46 Nx = stack[i].buffer[0].matrix.Naxis[0]; 47 47 Ny = stack[i].buffer[0].matrix.Naxis[1]; 48 Nz = stack[i].buffer[0].matrix.Naxis[2]; 48 49 } 49 if ((Nx != stack[i].buffer[0].matrix.Naxis[0]) && (Ny != stack[i].buffer[0].matrix.Naxis[1])) { 50 if ((Nx != stack[i].buffer[0].matrix.Naxis[0]) && 51 (Ny != stack[i].buffer[0].matrix.Naxis[1]) && 52 (Nz != stack[i].buffer[0].matrix.Naxis[2])) { 50 53 push_error ("dimensions don't match"); 51 54 return (-1); -
trunk/Ohana/src/opihi/lib.shell/convert_to_RPN.c
r36679 r38062 60 60 if (!strcmp (argv[i], "xramp")) { type = ST_UNARY; goto gotit; } 61 61 if (!strcmp (argv[i], "yramp")) { type = ST_UNARY; goto gotit; } 62 if (!strcmp (argv[i], "zramp")) { type = ST_UNARY; goto gotit; } 62 63 if (!strcmp (argv[i], "ramp")) { type = ST_UNARY; goto gotit; } 63 64 if (!strcmp (argv[i], "zero")) { type = ST_UNARY; goto gotit; } -
trunk/Ohana/src/opihi/lib.shell/evaluate_stack.c
r36375 r38062 121 121 got_three_op: 122 122 if (!status) { 123 snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s or %s\n", stack[i-1].name, stack[i-2].name, stack[i-3].name);123 snprintf (line, 512, "syntax error: invalid operand for trinary operation: %s or %s or %s\n", stack[i-1].name, stack[i-2].name, stack[i-3].name); 124 124 push_error (line); 125 125 clear_stack (&tmp_stack); -
trunk/Ohana/src/opihi/lib.shell/stack_math.c
r36528 r38062 80 80 break; \ 81 81 } \ 82 if ((V1->vector->type == OPIHI_FLT) && (V2->vector->type == OPIHI_FLT) && (V3->vector->type == OPIHI_INT)) { \ 83 CopyVector (OUT[0].vector, V1[0].vector); \ 84 opihi_flt *M1 = V1[0].vector[0].elements.Flt; \ 85 opihi_flt *M2 = V2[0].vector[0].elements.Flt; \ 86 opihi_int *M3 = V3[0].vector[0].elements.Int; \ 87 opihi_flt *out = OUT[0].vector[0].elements.Flt; \ 88 for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) { \ 89 *out = OP; \ 90 } \ 91 break; \ 92 } \ 93 if ((V1->vector->type == OPIHI_FLT) && (V2->vector->type == OPIHI_INT) && (V3->vector->type == OPIHI_FLT)) { \ 94 CopyVector (OUT[0].vector, V1[0].vector); \ 95 opihi_flt *M1 = V1[0].vector[0].elements.Flt; \ 96 opihi_int *M2 = V2[0].vector[0].elements.Int; \ 97 opihi_flt *M3 = V3[0].vector[0].elements.Flt; \ 98 opihi_flt *out = OUT[0].vector[0].elements.Flt; \ 99 for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) { \ 100 *out = OP; \ 101 } \ 102 break; \ 103 } \ 104 if ((V1->vector->type == OPIHI_FLT) && (V2->vector->type == OPIHI_INT) && (V3->vector->type == OPIHI_INT)) { \ 105 CopyVector (OUT[0].vector, V2[0].vector); \ 106 opihi_flt *M1 = V1[0].vector[0].elements.Flt; \ 107 opihi_int *M2 = V2[0].vector[0].elements.Int; \ 108 opihi_int *M3 = V3[0].vector[0].elements.Int; \ 109 opihi_int *out = OUT[0].vector[0].elements.Int; \ 110 for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) { \ 111 *out = OP; \ 112 } \ 113 break; \ 114 } \ 115 if ((V1->vector->type == OPIHI_INT) && (V2->vector->type == OPIHI_FLT) && (V3->vector->type == OPIHI_FLT)) { \ 116 CopyVector (OUT[0].vector, V2[0].vector); \ 117 opihi_int *M1 = V1[0].vector[0].elements.Int; \ 118 opihi_flt *M2 = V2[0].vector[0].elements.Flt; \ 119 opihi_flt *M3 = V3[0].vector[0].elements.Flt; \ 120 opihi_flt *out = OUT[0].vector[0].elements.Flt; \ 121 for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) { \ 122 *out = OP; \ 123 } \ 124 break; \ 125 } \ 126 if ((V1->vector->type == OPIHI_INT) && (V2->vector->type == OPIHI_FLT) && (V3->vector->type == OPIHI_INT)) { \ 127 CopyVector (OUT[0].vector, V2[0].vector); \ 128 opihi_int *M1 = V1[0].vector[0].elements.Int; \ 129 opihi_flt *M2 = V2[0].vector[0].elements.Flt; \ 130 opihi_int *M3 = V3[0].vector[0].elements.Int; \ 131 opihi_flt *out = OUT[0].vector[0].elements.Flt; \ 132 for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) { \ 133 *out = OP; \ 134 } \ 135 break; \ 136 } \ 137 if ((V1->vector->type == OPIHI_INT) && (V2->vector->type == OPIHI_INT) && (V3->vector->type == OPIHI_FLT)) { \ 138 CopyVector (OUT[0].vector, V3[0].vector); \ 139 opihi_int *M1 = V1[0].vector[0].elements.Int; \ 140 opihi_int *M2 = V2[0].vector[0].elements.Int; \ 141 opihi_flt *M3 = V3[0].vector[0].elements.Flt; \ 142 opihi_flt *out = OUT[0].vector[0].elements.Flt; \ 143 for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) { \ 144 *out = OP; \ 145 } \ 146 break; \ 147 } \ 82 148 if ((V1->vector->type == OPIHI_INT) && (V2->vector->type == OPIHI_INT) && (V3->vector->type == OPIHI_INT)) { \ 83 149 CopyVector (OUT[0].vector, V1[0].vector); \ … … 127 193 int MMM_trinary (StackVar *OUT, StackVar *V1, StackVar *V2, StackVar *V3, char *op) { 128 194 129 int i , Nx, Ny;195 int i; 130 196 float *out, *M1, *M2, *M3; 131 197 char line[512]; // this is only used to report an error 132 198 133 Nx = V1[0].buffer[0].matrix.Naxis[0]; 134 Ny = V1[0].buffer[0].matrix.Naxis[1]; 135 199 int Npix = gfits_npix_matrix (&V1[0].buffer[0].matrix); 200 136 201 if (V1[0].type == ST_MATRIX_TMP) { /** use V1 as temp buffer **/ 137 202 OUT[0].buffer = V1[0].buffer; … … 154 219 155 220 # define MMM_FUNC(OP) \ 156 for (i = 0; i < N x*Ny; i++, out++, M1++, M2++, M3++) { \221 for (i = 0; i < Npix; i++, out++, M1++, M2++, M3++) { \ 157 222 *out = OP; \ 158 223 } \ … … 531 596 } 532 597 533 // the vector is applied to each column 598 // the vector is applied to each column (currently only valid for 2D matrix) 534 599 int MV_binary (StackVar *OUT, StackVar *V1, StackVar *V2, char *op) { 535 600 … … 626 691 } 627 692 628 // the vector is applied to each row 693 // the vector is applied to each row (currently only valid for 2D matrix) 629 694 int VM_binary (StackVar *OUT, StackVar *V1, StackVar *V2, char *op) { 630 695 … … 722 787 int MM_binary (StackVar *OUT, StackVar *V1, StackVar *V2, char *op) { 723 788 724 int i , Nx, Ny;789 int i; 725 790 float *out, *M1, *M2; 726 791 char line[512]; // this is only used to report an error 727 792 728 Nx = V1[0].buffer[0].matrix.Naxis[0]; 729 Ny = V1[0].buffer[0].matrix.Naxis[1]; 730 793 int Npix = gfits_npix_matrix (&V1[0].buffer[0].matrix); 794 731 795 if (V1[0].type == ST_MATRIX_TMP) { /** use V1 as temp buffer **/ 732 796 OUT[0].buffer = V1[0].buffer; … … 748 812 749 813 # define MM_FUNC(OP) \ 750 for (i = 0; i < N x*Ny; i++, out++, M1++, M2++) { \814 for (i = 0; i < Npix; i++, out++, M1++, M2++) { \ 751 815 *out = OP; \ 752 816 } \ … … 803 867 int MS_binary (StackVar *OUT, StackVar *V1, StackVar *V2, char *op) { 804 868 805 int i , Nx, Ny;869 int i; 806 870 char line[512]; // this is only used to report an error 807 871 808 Nx = V1[0].buffer[0].matrix.Naxis[0]; 809 Ny = V1[0].buffer[0].matrix.Naxis[1]; 872 int Npix = gfits_npix_matrix (&V1[0].buffer[0].matrix); 810 873 811 874 /* if possible, use V1 as temp buffer, otherwise create new one */ … … 825 888 if (V2->type == ST_SCALAR_FLT) { \ 826 889 opihi_flt M2 = V2[0].FltValue; \ 827 for (i = 0; i < N x*Ny; i++, out++, M1++) { \890 for (i = 0; i < Npix; i++, out++, M1++) { \ 828 891 *out = OP; \ 829 892 } \ … … 832 895 if (V2->type == ST_SCALAR_INT) { \ 833 896 opihi_int M2 = V2[0].IntValue; \ 834 for (i = 0; i < N x*Ny; i++, out++, M1++) { \897 for (i = 0; i < Npix; i++, out++, M1++) { \ 835 898 *out = OP; \ 836 899 } \ … … 881 944 int SM_binary (StackVar *OUT, StackVar *V1, StackVar *V2, char *op) { 882 945 883 int i , Nx, Ny;946 int i; 884 947 char line[512]; // this is only used to report an error 885 948 886 Nx = V2[0].buffer[0].matrix.Naxis[0]; 887 Ny = V2[0].buffer[0].matrix.Naxis[1]; 888 949 int Npix = gfits_npix_matrix (&V2[0].buffer[0].matrix); 950 889 951 if (V2[0].type == ST_MATRIX_TMP) { /* V2[0] is NOT temporary, we can't use it for storage */ 890 952 OUT[0].buffer = V2[0].buffer; … … 902 964 if (V1->type == ST_SCALAR_FLT) { \ 903 965 opihi_flt M1 = V1[0].FltValue; \ 904 for (i = 0; i < N x*Ny; i++, out++, M2++) { \966 for (i = 0; i < Npix; i++, out++, M2++) { \ 905 967 *out = OP; \ 906 968 } \ … … 909 971 if (V1->type == ST_SCALAR_INT) { \ 910 972 opihi_int M1 = V1[0].IntValue; \ 911 for (i = 0; i < N x*Ny; i++, out++, M2++) { \973 for (i = 0; i < Npix; i++, out++, M2++) { \ 912 974 *out = OP; \ 913 975 } \ … … 1240 1302 if (!strcmp (op, "xramp")) V_FUNC(i, ST_SCALAR_INT); 1241 1303 if (!strcmp (op, "yramp")) V_FUNC(0, ST_SCALAR_INT); 1242 /* xramp and yramp above only make sense for matrices. for vectors, xramp = ramp, yramp = zero */ 1304 if (!strcmp (op, "zramp")) V_FUNC(0, ST_SCALAR_INT); 1305 /* xramp, yramp, zramp above only make sense for matrices. for vectors, xramp = ramp, yramp = zero */ 1243 1306 1244 1307 # undef V_FUNC … … 1259 1322 int M_unary (StackVar *OUT, StackVar *V1, char *op) { 1260 1323 1261 int i, j, Nx, Ny;1324 int i, j, k; 1262 1325 float *out, *M1; 1263 1326 1264 Nx = V1[0].buffer[0].matrix.Naxis[0]; 1265 Ny = V1[0].buffer[0].matrix.Naxis[1]; 1266 1327 int Npix = gfits_npix_matrix (&V1[0].buffer[0].matrix); 1328 1267 1329 if (V1[0].type == ST_MATRIX_TMP) { 1268 1330 OUT[0].buffer = V1[0].buffer; … … 1277 1339 1278 1340 if (!strcmp (op, "=")) { } 1279 if (!strcmp (op, "abs")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = fabs(*M1); }}1280 if (!strcmp (op, "int")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = (opihi_flt)(long long)(*M1); }}1281 1282 if (!strcmp (op, "floor")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = floor (*M1); }}1283 if (!strcmp (op, "ceil")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = ceil (*M1); }}1284 // if (!strcmp (op, "rint")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = nearbyint (*M1); }}1285 1286 if (!strcmp (op, "exp")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = exp(*M1); }}1287 if (!strcmp (op, "ten")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = pow(10.0,*M1); }}1288 if (!strcmp (op, "log")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = log10(*M1); }}1289 if (!strcmp (op, "ln")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = log(*M1); }}1290 if (!strcmp (op, "sqrt")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = sqrt(*M1); }}1291 if (!strcmp (op, "erf")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = erf(*M1); }}1292 1293 if (!strcmp (op, "sinh")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = sinh(*M1); }}1294 if (!strcmp (op, "cosh")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = cosh(*M1); }}1295 if (!strcmp (op, "asinh")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = asinh(*M1); }}1296 if (!strcmp (op, "acosh")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = acosh(*M1); }}1297 if (!strcmp (op, "lgamma")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = lgamma(*M1); }}1298 1299 if (!strcmp (op, "sin")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = sin(*M1); }}1300 if (!strcmp (op, "cos")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = cos(*M1); }}1301 if (!strcmp (op, "tan")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = tan(*M1); }}1302 if (!strcmp (op, "dsin")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = sin(*M1*RAD_DEG); }}1303 if (!strcmp (op, "dcos")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = cos(*M1*RAD_DEG); }}1304 if (!strcmp (op, "dtan")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = tan(*M1*RAD_DEG); }}1305 if (!strcmp (op, "asin")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = asin(*M1); }}1306 if (!strcmp (op, "acos")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = acos(*M1); }}1307 if (!strcmp (op, "atan")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = atan(*M1); }}1308 if (!strcmp (op, "dasin")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = asin(*M1)*DEG_RAD; }}1309 if (!strcmp (op, "dacos")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = acos(*M1)*DEG_RAD; }}1310 if (!strcmp (op, "datan")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = atan(*M1)*DEG_RAD; }}1311 if (!strcmp (op, "not")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = !(*M1); }}1312 if (!strcmp (op, "--")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = -(*M1); }}1313 if (!strcmp (op, "rnd")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = drand48(); }}1314 if (!strcmp (op, "ramp")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = i; }}1315 if (!strcmp (op, "zero")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = 0; }}1316 if (!strcmp (op, "isinf")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = !finite(*M1); }}1317 if (!strcmp (op, "isnan")) { for (i = 0; i < N x*Ny; i++, out++, M1++) { *out = isnan(*M1); }}1318 1319 /* xrm and yrm only make sense in formatrices. see special meaning for vectors */1341 if (!strcmp (op, "abs")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = fabs(*M1); }} 1342 if (!strcmp (op, "int")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = (opihi_flt)(long long)(*M1); }} 1343 1344 if (!strcmp (op, "floor")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = floor (*M1); }} 1345 if (!strcmp (op, "ceil")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = ceil (*M1); }} 1346 // if (!strcmp (op, "rint")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = nearbyint (*M1); }} 1347 1348 if (!strcmp (op, "exp")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = exp(*M1); }} 1349 if (!strcmp (op, "ten")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = pow(10.0,*M1); }} 1350 if (!strcmp (op, "log")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = log10(*M1); }} 1351 if (!strcmp (op, "ln")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = log(*M1); }} 1352 if (!strcmp (op, "sqrt")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = sqrt(*M1); }} 1353 if (!strcmp (op, "erf")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = erf(*M1); }} 1354 1355 if (!strcmp (op, "sinh")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = sinh(*M1); }} 1356 if (!strcmp (op, "cosh")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = cosh(*M1); }} 1357 if (!strcmp (op, "asinh")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = asinh(*M1); }} 1358 if (!strcmp (op, "acosh")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = acosh(*M1); }} 1359 if (!strcmp (op, "lgamma")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = lgamma(*M1); }} 1360 1361 if (!strcmp (op, "sin")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = sin(*M1); }} 1362 if (!strcmp (op, "cos")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = cos(*M1); }} 1363 if (!strcmp (op, "tan")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = tan(*M1); }} 1364 if (!strcmp (op, "dsin")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = sin(*M1*RAD_DEG); }} 1365 if (!strcmp (op, "dcos")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = cos(*M1*RAD_DEG); }} 1366 if (!strcmp (op, "dtan")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = tan(*M1*RAD_DEG); }} 1367 if (!strcmp (op, "asin")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = asin(*M1); }} 1368 if (!strcmp (op, "acos")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = acos(*M1); }} 1369 if (!strcmp (op, "atan")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = atan(*M1); }} 1370 if (!strcmp (op, "dasin")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = asin(*M1)*DEG_RAD; }} 1371 if (!strcmp (op, "dacos")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = acos(*M1)*DEG_RAD; }} 1372 if (!strcmp (op, "datan")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = atan(*M1)*DEG_RAD; }} 1373 if (!strcmp (op, "not")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = !(*M1); }} 1374 if (!strcmp (op, "--")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = -(*M1); }} 1375 if (!strcmp (op, "rnd")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = drand48(); }} 1376 if (!strcmp (op, "ramp")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = i; }} 1377 if (!strcmp (op, "zero")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = 0; }} 1378 if (!strcmp (op, "isinf")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = !finite(*M1); }} 1379 if (!strcmp (op, "isnan")) { for (i = 0; i < Npix; i++, out++, M1++) { *out = isnan(*M1); }} 1380 1381 /* xrm and yrm only make sense for 2D matrices. see special meaning for vectors */ 1320 1382 if (!strcmp (op, "xramp")) { 1321 for (j = 0; j < Ny; j++) { 1322 for (i = 0; i < Nx; i++, out++, M1++) { 1323 *out = i; 1383 int Nx = V1[0].buffer[0].matrix.Naxis[0]; 1384 int Ny = V1[0].buffer[0].matrix.Naxis[1]; 1385 int Nz = MAX (1, V1[0].buffer[0].matrix.Naxis[2]); 1386 for (k = 0; k < Nz; k++) { 1387 for (j = 0; j < Ny; j++) { 1388 for (i = 0; i < Nx; i++, out++, M1++) { 1389 *out = i; 1390 } 1324 1391 } 1325 1392 } 1326 1393 } 1327 1394 if (!strcmp (op, "yramp")) { 1328 for (j = 0; j < Ny; j++) { 1329 for (i = 0; i < Nx; i++, out++, M1++) { 1330 *out = j; 1395 int Nx = V1[0].buffer[0].matrix.Naxis[0]; 1396 int Ny = V1[0].buffer[0].matrix.Naxis[1]; 1397 int Nz = MAX (1, V1[0].buffer[0].matrix.Naxis[2]); 1398 for (k = 0; k < Nz; k++) { 1399 for (j = 0; j < Ny; j++) { 1400 for (i = 0; i < Nx; i++, out++, M1++) { 1401 *out = j; 1402 } 1403 } 1404 } 1405 } 1406 if (!strcmp (op, "zramp")) { 1407 int Nx = V1[0].buffer[0].matrix.Naxis[0]; 1408 int Ny = V1[0].buffer[0].matrix.Naxis[1]; 1409 int Nz = MAX (1, V1[0].buffer[0].matrix.Naxis[2]); 1410 for (k = 0; k < Nz; k++) { 1411 for (j = 0; j < Ny; j++) { 1412 for (i = 0; i < Nx; i++, out++, M1++) { 1413 *out = k; 1414 } 1331 1415 } 1332 1416 } -
trunk/Ohana/src/photdbc/src/photdbc.c
r37807 r38062 10 10 11 11 // the output catalog needs to inherit the SKY_DEPTH of the input catalog 12 sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, 0, VERBOSE); 12 sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, FALSE, 0, VERBOSE); 13 if (!sky) { 14 fprintf (stderr, "ERROR loading sky table from %s\n", CATDIR); 15 exit (2); 16 } 17 13 18 SkyTableSetFilenames (sky, CATDIR, "cpt"); 14 19 skylist = SkyListByPatch (sky, -1, ®ION); -
trunk/Ohana/src/photdbc/src/photdbc_client.c
r33655 r38062 6 6 7 7 // load the current sky table (layout of all SkyRegions) 8 SkyTable *sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, -1, VERBOSE);8 SkyTable *sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, FALSE, -1, VERBOSE); 9 9 if (!sky) { 10 fprintf (stderr, "ERROR runningloading sky table from %s\n", CATDIR);10 fprintf (stderr, "ERROR loading sky table from %s\n", CATDIR); 11 11 exit (2); 12 12 } -
trunk/Ohana/src/relastro/Makefile
r37807 r38062 138 138 $(SRC)/relastroVisual.$(ARCH).o \ 139 139 $(SRC)/syncfile.$(ARCH).o \ 140 $(SRC)/client_logger.$(ARCH).o \ 140 141 $(SRC)/BrightCatalog.$(ARCH).o 141 142 -
trunk/Ohana/src/relastro/include/relastro.h
r37807 r38062 9 9 // # define IDX_T off_t 10 10 # define IDX_T int 11 12 # define LOGRTIME(MSG,...) { \ 13 gettimeofday (&stopTimer, (void *) NULL); \ 14 float dtime = DTIME (stopTimer, startTimer); \ 15 client_logger_message (MSG, __VA_ARGS__); } 11 16 12 17 typedef enum { -
trunk/Ohana/src/relastro/src/BrightCatalog.c
r37807 r38062 91 91 ALLOCATE (measure, MeasureTiny, Nrow); 92 92 for (i = 0; i < Nrow; i++) { 93 memset (&measure[i], 0, sizeof(MeasureTiny)); 93 94 measure[i].R = R[i]; 94 95 measure[i].D = D[i]; … … 111 112 measure[i].catID = catID[i]; 112 113 measure[i].photcode = photcode[i]; 114 measure[i].dXccd = 0.0; 115 measure[i].dYccd = 0.0; 116 measure[i].dRsys = 0.0; 117 measure[i].myDet = 0; 113 118 } 114 119 // fprintf (stderr, "loaded data for %lld measures\n", (long long) Nrow); … … 344 349 /*** MeasureTiny ***/ 345 350 { 351 ohana_memcheck_func (1); 346 352 gfits_create_table_header (&theader, "BINTABLE", "MEASURE_TINY"); 347 353 354 ohana_memcheck_func (1); 348 355 gfits_define_bintable_column (&theader, "D", "RA", "ra", "degrees", 1.0, 0.0); 349 356 gfits_define_bintable_column (&theader, "D", "DEC", "dec", "degrees", 1.0, 0.0); … … 368 375 369 376 // generate the output array that carries the data 377 ohana_memcheck_func (1); 370 378 gfits_create_table (&theader, &ftable); 379 ohana_memcheck_func (1); 371 380 372 381 // create intermediate storage arrays … … 391 400 int *catID ; ALLOCATE (catID , int , catalog->Nmeasure); 392 401 short *photcode ; ALLOCATE (photcode , short, catalog->Nmeasure); 402 ohana_memcheck_func (1); 393 403 394 404 // assign the storage arrays … … 416 426 photcode[i] = measure[i].photcode ; 417 427 } 428 ohana_memcheck_func (1); 418 429 419 430 // add the columns to the output array 420 431 gfits_set_bintable_column (&theader, &ftable, "RA", R, catalog->Nmeasure); 432 ohana_memcheck_func (1); 421 433 gfits_set_bintable_column (&theader, &ftable, "DEC", D, catalog->Nmeasure); 434 ohana_memcheck_func (1); 422 435 gfits_set_bintable_column (&theader, &ftable, "ROFF_GAL", RoffGAL, catalog->Nmeasure); 423 436 gfits_set_bintable_column (&theader, &ftable, "DOFF_GAL", DoffGAL, catalog->Nmeasure); -
trunk/Ohana/src/relastro/src/FrameCorrection.c
r37807 r38062 56 56 free (filename); 57 57 58 // XXX NOTE : do not apply correction for now. let's just measure it and see how it evolves 58 59 // Now apply the correction to all of the average.R,D values 59 FrameCorrectionApply (catalog, Ncatalog, set->frame, set->coords);60 // FrameCorrectionApply (catalog, Ncatalog, set->frame, set->coords); 60 61 FrameCorrectionSetFree(set); 61 62 -
trunk/Ohana/src/relastro/src/ImageOps.c
r37807 r38062 763 763 ref[i].dMag = measure[0].dM; 764 764 ref[i].dPos = GetAstromErrorTiny (&measure[0], ERROR_MODE_POS); 765 ref[i].ColorBlue = NAN; 766 ref[i].ColorRed = NAN; 765 767 766 768 if ((DCR_BLUE_NSEC_POS >= 0) && (DCR_BLUE_NSEC_NEG >= -1)) { -
trunk/Ohana/src/relastro/src/MeasPosIO.c
r37807 r38062 19 19 MeasPos *measpos = NULL; 20 20 21 INITTIME; 22 21 23 FILE *f = fopen (filename, "r"); 22 24 if (!f) { … … 46 48 } 47 49 50 LOGRTIME("MeasPosLoad_init %s: %f sec\n", filename, dtime); 51 48 52 // read the fits table bytes 49 53 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { … … 52 56 } 53 57 fclose (f); 58 LOGRTIME("MeasPosLoad_read %s: %f sec\n", filename, dtime); 54 59 55 60 // a bit annoying : we read the entire block of data, then extract the columns, then set the image structure values. … … 63 68 GET_COLUMN (catID, "CAT_ID", int); 64 69 GET_COLUMN (imageID, "IMAGE_ID", int); 70 LOGRTIME("MeasPosLoad_getcol %s: %f sec\n", filename, dtime); 65 71 66 72 ALLOCATE (measpos, MeasPos, Nrow); 73 LOGRTIME("MeasPosLoad_alloc %s: %f sec\n", filename, dtime); 74 67 75 for (i = 0; i < Nrow; i++) { 68 76 measpos[i].R = R [i]; … … 72 80 measpos[i].imageID = imageID[i]; 73 81 } 82 LOGRTIME("MeasPosLoad_convert %s: %f sec\n", filename, dtime); 83 74 84 fprintf (stderr, "loaded data for %lld objects (* filters)\n", (long long) Nrow); 75 85 … … 85 95 gfits_free_header (&theader); 86 96 gfits_free_table (&ftable); 97 LOGRTIME("MeasPosLoad_cleanup %s: %f sec\n", filename, dtime); 87 98 88 99 *nmeaspos = Nrow; -
trunk/Ohana/src/relastro/src/UpdateChips.c
r37807 r38062 223 223 224 224 // all threads are done, free the threads array and grab the info 225 for (i = 0; i < NTHREADS; i++) { 226 pthread_detach (threads[i]); 227 } 225 228 free (threads); 226 229 -
trunk/Ohana/src/relastro/src/client_logger.c
r37807 r38062 27 27 int client_logger_message (char *format,...) { 28 28 29 if (!logfile) return FALSE; 30 29 31 va_list argp; 30 32 -
trunk/Ohana/src/relastro/src/load_catalogs.c
r37807 r38062 17 17 18 18 if (VERBOSE) fprintf (stderr, "loading catalog data\n"); 19 client_logger_message ("loading catalog data\n"); 19 20 20 21 ALLOCATE (catalog, Catalog, skylist[0].Nregions); … … 255 256 256 257 BrightCatalog *bcatalog = BrightCatalogLoad (table->hosts[i].results); 257 assert (bcatalog); 258 if (!bcatalog) { 259 client_logger_message ("problem loading table from %s\n", table->hosts[i].hostname); 260 exit (2); 261 } 258 262 259 263 BrightCatalogSplit (catalogs, bcatalog); … … 267 271 Catalog *catalog = catalogs->catalog; 268 272 *Ncatalog = catalogs->Ncatalog; 269 BrightCatalogSplitFree (catalogs);270 273 271 274 int Nmeasure = 0; … … 275 278 Naverage += catalogs->catalog[i].Naverage; 276 279 } 277 278 280 fprintf (stderr, "loaded %d catalogs, using a total of %d stars (%d measures)\n", catalogs->Ncatalog, Naverage, Nmeasure); 281 client_logger_message ("loaded %d catalogs, using a total of %d stars (%d measures)\n", catalogs->Ncatalog, Naverage, Nmeasure); 282 283 BrightCatalogSplitFree (catalogs); 279 284 280 285 return (catalog); -
trunk/Ohana/src/relastro/src/relastro_parallel_images.c
r37807 r38062 22 22 RegionHostTable *regionHosts = RegionHostTableLoad (CATDIR, REGION_FILE); 23 23 int myHost = regionHosts->index[REGION_HOST_ID]; 24 char *myHostName = regionHosts->hosts[myHost].hostname; 25 24 26 RegionHostFindNeighbors (regionHosts, myHost); 25 client_logger_message ("started parallel images on %s\n", regionHosts->hosts[myHost].hostname);27 client_logger_message ("started parallel images on %s\n", myHostName); 26 28 27 29 // load the subset images belonging to this host … … 47 49 } 48 50 put_astrom_table (table); 49 client_logger_message ("loaded images on %s\n", regionHosts->hosts[myHost].hostname);51 client_logger_message ("loaded images on %s\n", myHostName); 50 52 51 53 // once we have read this table, we should remove it for repeat runs … … 62 64 63 65 /* load catalog data from region files (hostID is 0 since we are not a client */ 64 char *syncfile = make_filename (CATDIR, regionHosts->hosts[myHost].hostname, REGION_HOST_ID, "loadcat.sync");66 char *syncfile = make_filename (CATDIR, myHostName, REGION_HOST_ID, "loadcat.sync"); 65 67 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL, syncfile); 66 68 MARKTIME("-- load catalog data, host %d: %f sec\n", REGION_HOST_ID, dtime); 67 69 free (syncfile); 68 70 69 client_logger_message ("loaded catalog data %s\n", regionHosts->hosts[myHost].hostname);71 client_logger_message ("loaded catalog data %s\n", myHostName); 70 72 71 73 // find ICRF QSOs for reference downstream (only if USE_ICRF_CORRECT) … … 90 92 createStarMap (catalog, Ncatalog); 91 93 92 client_logger_message ("set up image indexes on %s\n", regionHosts->hosts[myHost].hostname);94 client_logger_message ("set up image indexes on %s\n", myHostName); 93 95 94 96 markObjects (catalog, Ncatalog); … … 96 98 SAVEPLOT = FALSE; 97 99 98 client_logger_message ("starting the loops: %s\n", regionHosts->hosts[myHost].hostname);100 client_logger_message ("starting the loops: %s\n", myHostName); 99 101 100 102 /* major modes */ … … 114 116 if (RESET_IMAGES) { 115 117 UpdateMeasures (catalog, Ncatalog); 116 MARKTIME(" reset measures, host %d: %f sec\n", REGION_HOST_ID, dtime);117 client_logger_message ("reset measures: %s\n", regionHosts->hosts[myHost].hostname);118 MARKTIME("UpdateMeasures on %s, host %d: %f sec\n", myHostName, REGION_HOST_ID, dtime); 119 LOGRTIME("UpdateMeasures on %s, host %d: %f sec\n", myHostName, REGION_HOST_ID, dtime); 118 120 } 119 121 for (i = 0; i < NLOOP; i++) { 120 122 UpdateObjects (catalog, Ncatalog, (i > 0)); 121 MARKTIME("update objects loop %d, host %d: %f sec\n", i, REGION_HOST_ID, dtime); 122 client_logger_message ("update objects loop %d: %s\n", i, regionHosts->hosts[myHost].hostname); 123 LOGRTIME("UpdateObjects loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime); 123 124 if ((i > 1) || !USE_GALAXY_MODEL) { 124 125 // if GALAXY_MODEL is selected, we want to delay the frame correction until we have 125 126 // applied the galaxy model a couple of times. 126 127 FrameCorrectionParallelSlave (catalog, Ncatalog, regionHosts, i); 127 MARKTIME("frame correction loop %d, host %d: %f sec\n", i, REGION_HOST_ID, dtime); 128 client_logger_message ("frame correction loop %d: %s\n", i, regionHosts->hosts[myHost].hostname); 128 LOGRTIME("FrameCorrection loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime); 129 129 } 130 130 share_mean_pos (catalog, Ncatalog, regionHosts, i); 131 LOGRTIME("share_mean_pos loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime); 131 132 slurp_mean_pos (catalog, Ncatalog, regionHosts, i); 132 client_logger_message ("slurp mags loop %d: %s\n", i, regionHosts->hosts[myHost].hostname);133 LOGRTIME("slurp_mean_pos loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime); 133 134 134 135 UpdateChips (catalog, Ncatalog); 135 MARKTIME("update chips loop %d, host %d: %f sec\n", i, REGION_HOST_ID, dtime); 136 client_logger_message ("update chips loop %d: %s\n", i, regionHosts->hosts[myHost].hostname); 136 LOGRTIME("UpdateChips loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime); 137 137 138 138 share_image_pos (regionHosts, i); 139 LOGRTIME("share_image_pos loop on %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime); 139 140 slurp_image_pos (catalog, Ncatalog, regionHosts, i); 140 client_logger_message ("slurp image pos loop %d: %s\n", i, regionHosts->hosts[myHost].hostname);141 LOGRTIME("slurp_image_pos loop on %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime); 141 142 142 143 share_meas_pos (catalog, Ncatalog, regionHosts, i); 144 LOGRTIME("share_meas_pos loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime); 143 145 slurp_meas_pos (catalog, Ncatalog, regionHosts, i); 144 MARKTIME("done exchange loop %d, host %d: %f sec\n", i, REGION_HOST_ID, dtime); 145 client_logger_message ("slurp meas loop %d: %s\n", i, regionHosts->hosts[myHost].hostname); 146 LOGRTIME("slurp_meas_pos loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime); 146 147 } 147 148 // create summary plots of the process … … 166 167 167 168 // this is a checkpoint to make sure all hosts have finished the loop above 168 char *loopsyncfile = make_filename (CATDIR, regionHosts->hosts[myHost].hostname, REGION_HOST_ID, "loop.sync");169 char *loopsyncfile = make_filename (CATDIR, myHostName, REGION_HOST_ID, "loop.sync"); 169 170 update_sync_file (loopsyncfile, 0); 170 171 free (loopsyncfile); … … 178 179 179 180 share_image_pos (regionHosts, -1); 180 client_logger_message ("share image pos loop %d: %s\n", -1, regionHosts->hosts[myHost].hostname);181 LOGRTIME("share image pos loop %d on %s, host %d: %f sec\n", -1, myHostName, REGION_HOST_ID, dtime); 181 182 182 183 exit (0); -
trunk/Ohana/src/relastro/src/share_images_pos.c
r37807 r38062 51 51 } 52 52 53 static char *masterHost = "master"; 53 54 int slurp_image_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop) { 54 55 … … 60 61 ALLOCATE (image_pos, ImagePos, 1); 61 62 63 INITTIME; 64 int myHost = regionHosts->index[REGION_HOST_ID]; 65 char *myHostName = (myHost == -1) ? masterHost : regionHosts->hosts[myHost].hostname; 66 62 67 fprintf (stderr, "grabbing image mags from other hosts...\n"); 63 68 69 LOGRTIME("image_load_start loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 64 70 for (i = 0; i < regionHosts->Nhosts; i++) { 65 71 if (regionHosts->hosts[i].hostID == REGION_HOST_ID) continue; … … 69 75 check_sync_file (syncfile, nloop); 70 76 free (syncfile); 77 LOGRTIME("image_load_sync host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 71 78 72 79 off_t Nsubset; … … 74 81 ImagePos *image_pos_subset = ImagePosLoad (iposfile, &Nsubset); 75 82 free (iposfile); 83 LOGRTIME("image_load_read host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 76 84 77 85 image_pos = merge_image_pos (image_pos, &Nimage_pos, image_pos_subset, Nsubset); 86 LOGRTIME("image_load_merge host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 78 87 } 79 88 … … 96 105 images[seq].flags = image_pos[i].flags ; 97 106 } 107 LOGRTIME("image_load_convert loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 98 108 99 109 // load the astrometry offset maps, if they exist, and apply … … 106 116 107 117 AstromOffsetTable *table = AstromOffsetMapLoad (mapname, VERBOSE); 118 LOGRTIME("image_maps_load host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 108 119 109 120 // apply table entries here to existing images … … 127 138 } 128 139 } 140 LOGRTIME("image_maps_copy host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 141 129 142 AstromOffsetTableFree(table); 143 LOGRTIME("image_maps_free host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 130 144 } 131 145 … … 137 151 } 138 152 free (image_pos); 153 LOGRTIME("image_load_apply loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 139 154 140 155 fprintf (stderr, "DONE grabbing image mags from other hosts\n"); -
trunk/Ohana/src/relastro/src/share_mean_pos.c
r37038 r38062 15 15 16 16 int myHost = regionHosts->index[REGION_HOST_ID]; 17 char *myHostName = regionHosts->hosts[myHost].hostname; 18 17 19 double Rmin = regionHosts->hosts[myHost].Rmin; 18 20 double Rmax = regionHosts->hosts[myHost].Rmax; 19 21 double Dmin = regionHosts->hosts[myHost].Dmin; 20 22 double Dmax = regionHosts->hosts[myHost].Dmax; 23 24 INITTIME; 21 25 22 26 // XXX skip some catalogs based on UserPatch? … … 40 44 } 41 45 } 46 LOGRTIME("set_mean_pos loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 42 47 43 48 // write out the meanmag fits table AND write state in some file … … 48 53 free (meanpos); 49 54 free (posfile); 55 LOGRTIME("MeanPosSave loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 50 56 51 57 char *syncfile = make_filename (CATDIR, hostname, REGION_HOST_ID, "meanpos.sync"); 52 58 update_sync_file (syncfile, nloop); 53 59 free (syncfile); 60 LOGRTIME("update_sync_file loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 54 61 55 62 return TRUE; … … 64 71 ALLOCATE (meanpos, MeanPos, 1); 65 72 73 int myHost = regionHosts->index[REGION_HOST_ID]; 74 char *myHostName = regionHosts->hosts[myHost].hostname; 75 66 76 fprintf (stderr, "grabbing mean object pos from other hosts...\n"); 77 78 INITTIME; 67 79 68 80 for (i = 0; i < regionHosts->Nhosts; i++) { … … 82 94 meanpos = merge_mean_pos (meanpos, &Nmeanpos, meanposSubset, Nsubset); 83 95 } 96 LOGRTIME("MeanPosLoad/merge_mean_pos loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 84 97 85 98 for (i = 0; i < Nmeanpos; i++) { … … 99 112 } 100 113 free (meanpos); 114 LOGRTIME("match_catID_and_objID loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 101 115 102 116 fprintf (stderr, "DONE grabbing mean object pos from other hosts...\n"); -
trunk/Ohana/src/relastro/src/share_meas_pos.c
r37807 r38062 14 14 ALLOCATE (measpos, MeasPos, NMEASPOS); 15 15 16 INITTIME; 16 17 int myHost = regionHosts->index[REGION_HOST_ID]; 18 char *myHostName = regionHosts->hosts[myHost].hostname; 17 19 18 20 // XXX skip some catalogs based on UserPatch? … … 33 35 } 34 36 } 37 LOGRTIME("set_meas_pos loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 35 38 36 39 // write out the measmag fits table AND write state in some file … … 41 44 free (measpos); 42 45 free (posfile); 46 LOGRTIME("MeasPosSave loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 43 47 44 48 char *syncfile = make_filename (CATDIR, hostname, REGION_HOST_ID, "measpos.sync"); 45 49 update_sync_file (syncfile, nloop); 46 50 free (syncfile); 51 LOGRTIME("update_sync_file loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 47 52 48 53 return TRUE; … … 59 64 fprintf (stderr, "grabbing meas object pos from other hosts...\n"); 60 65 66 INITTIME; 67 int myHost = regionHosts->index[REGION_HOST_ID]; 68 char *myHostName = regionHosts->hosts[myHost].hostname; 69 70 LOGRTIME("meas_load_start loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 61 71 for (i = 0; i < regionHosts->Nhosts; i++) { 62 72 if (regionHosts->hosts[i].hostID == REGION_HOST_ID) continue; … … 66 76 check_sync_file (syncfile, nloop); 67 77 free (syncfile); 78 LOGRTIME("meas_load_sync host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 68 79 69 80 off_t Nsubset = 0; … … 71 82 MeasPos *measposSubset = MeasPosLoad (posfile, &Nsubset); 72 83 free (posfile); 84 LOGRTIME("MeasPosLoad host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 73 85 74 86 // merge_meas_pos reallocs measpos and frees the input measposSubset 75 87 measpos = merge_meas_pos (measpos, &Nmeaspos, measposSubset, Nsubset); 88 LOGRTIME("merge_meas_pos host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 76 89 } 90 LOGRTIME("meas_load_done loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 77 91 78 92 for (i = 0; i < Nmeaspos; i++) { … … 99 113 } 100 114 free (measpos); 115 LOGRTIME("match_catID_and_objID/meas loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 101 116 102 117 fprintf (stderr, "DONE grabbing meas object pos from other hosts...\n"); -
trunk/Ohana/src/relphot/Makefile
r37037 r38062 50 50 $(SRC)/relphot_parallel_regions.$(ARCH).o \ 51 51 $(SRC)/relphot_parallel_images.$(ARCH).o \ 52 $(SRC)/relphot_synthphot.$(ARCH).o \ 53 $(SRC)/relphot_synthphot_catalog.$(ARCH).o \ 54 $(SRC)/synthetic_zpts.$(ARCH).o \ 52 55 $(SRC)/select_images.$(ARCH).o \ 53 56 $(SRC)/assign_images.$(ARCH).o \ … … 93 96 $(SRC)/relphot_objects.$(ARCH).o \ 94 97 $(SRC)/relphot_client.$(ARCH).o \ 98 $(SRC)/relphot_synthphot.$(ARCH).o \ 99 $(SRC)/relphot_synthphot_catalog.$(ARCH).o \ 100 $(SRC)/synthetic_zpts.$(ARCH).o \ 95 101 $(SRC)/client_logger.$(ARCH).o \ 96 102 $(SRC)/setExclusions.$(ARCH).o \ -
trunk/Ohana/src/relphot/include/relphot.h
r37907 r38062 22 22 PARALLEL_IMAGES, 23 23 APPLY_OFFSETS, 24 SYNTH_PHOT, 24 25 } RelphotMode; 25 26 … … 29 30 MODE_UPDATE = 2, 30 31 MODE_UPDATE_OBJECTS = 3, 32 MODE_SYNTH_PHOT = 4, 31 33 } ModeType; 34 35 // NOTE: this is only used in special cases where we limit photcode ranges 36 typedef enum { 37 PS1_none, 38 PS1_g = 1, 39 PS1_r = 2, 40 PS1_i = 3, 41 PS1_z = 4, 42 PS1_y = 5, 43 PS1_w = 6, 44 } PS1filters; 45 46 typedef struct { 47 Header PHU; 48 Header header[5]; // grizy (matches Nsec in photcodes) 49 Matrix matrix[5]; 50 Coords coords; 51 int Nx; 52 int Ny; 53 } SynthZeroPoints; 32 54 33 55 typedef struct { … … 175 197 char SKY_TABLE[DVO_MAX_PATH]; 176 198 int SKY_DEPTH; /** XXX EAM : depth of catalog tables, fix usage */ 199 char *SYNTH_ZERO_POINTS; 177 200 178 201 // globals for parallel region operations … … 509 532 int isGPC1stack (int photcode); 510 533 int isGPC1warp (int photcode); 511 512 534 int isGPC1synth (int photcode); 535 int whichGPC1filter (int photcode); 536 537 538 SynthZeroPoints *SynthZeroPointsLoad (char *filename); 539 540 int relphot_synthphot (int hostID, char *hostpath); 541 int relphot_synthphot_parallel (SkyList *sky); 542 543 int relphot_synthphot_catalog (Catalog *catalog, SynthZeroPoints *zpts); 544 int relphot_synthphot_average (Average *average, SecFilt *secfilt, Measure *measure, SynthZeroPoints *zpts); -
trunk/Ohana/src/relphot/src/args.c
r37907 r38062 372 372 mode = UPDATE_AVERAGES; 373 373 } 374 SYNTH_ZERO_POINTS = NULL; 375 if ((N = get_argument (argc, argv, "-synthphot_means"))) { 376 mode = SYNTH_PHOT; 377 remove_argument (N, &argc, argv); 378 myAssert (N < argc, "missing argument to -synthphot_means"); 379 SYNTH_ZERO_POINTS = strcreate (argv[N]); 380 remove_argument (N, &argc, argv); 381 } 374 382 if ((N = get_argument (argc, argv, "-apply-offsets"))) { 375 383 remove_argument (N, &argc, argv); … … 398 406 399 407 switch (mode) { 408 case SYNTH_PHOT: 400 409 case UPDATE_AVERAGES: 401 410 if (argc != 1) relphot_usage(); … … 471 480 } 472 481 MODE = MODE_UPDATE_OBJECTS; 482 remove_argument (N, &argc, argv); 483 } 484 SYNTH_ZERO_POINTS = NULL; 485 if ((N = get_argument (argc, argv, "-synthphot_means"))) { 486 MODE = MODE_SYNTH_PHOT; 487 remove_argument (N, &argc, argv); 488 SYNTH_ZERO_POINTS = strcreate (argv[N]); 473 489 remove_argument (N, &argc, argv); 474 490 } … … 644 660 } 645 661 662 if ((MODE == MODE_SYNTH_PHOT) && (argc == 1)) return TRUE; 646 663 if ((MODE == MODE_UPDATE_OBJECTS) && (argc == 1)) return TRUE; 647 664 if (argc != 2) relphot_client_usage (); -
trunk/Ohana/src/relphot/src/extra.c
r37907 r38062 1 1 # include "relphot.h" 2 3 // for now (20140710) I need to identify gpc1 chips explicitly. generalize in the future 4 int whichGPC1filter (int photcode) { 5 6 if ((photcode > 10000) && (photcode < 10077)) return PS1_g; // g-band 7 if ((photcode > 10100) && (photcode < 10177)) return PS1_r; // r-band 8 if ((photcode > 10200) && (photcode < 10277)) return PS1_i; // i-band 9 if ((photcode > 10300) && (photcode < 10377)) return PS1_z; // z-band 10 if ((photcode > 10400) && (photcode < 10477)) return PS1_y; // y-band 11 if ((photcode > 10500) && (photcode < 10577)) return PS1_w; // w-band 12 13 return PS1_none; 14 } 2 15 3 16 // for now (20140710) I need to identify gpc1 chips explicitly. generalize in the future … … 50 63 return FALSE; 51 64 } 65 66 int isGPC1synth (int photcode) { 67 68 if ((photcode >= 3001) && (photcode <= 3006)) return TRUE; // g-band 69 70 return FALSE; 71 } -
trunk/Ohana/src/relphot/src/help.c
r36630 r38062 5 5 fprintf (stderr, " or: relphot -averages\n"); 6 6 fprintf (stderr, " or: relphot -apply-offsets\n"); 7 fprintf (stderr, " or: relphot -synthphot_means\n"); 7 8 fprintf (stderr, " or: relphot (photcodes) -parallel-regions -region-hosts (RegionFile)\n"); 8 9 fprintf (stderr, " or: relphot (photcodes) -parallel-images (ImageTable) -region-hosts (RegionFile)\n\n"); -
trunk/Ohana/src/relphot/src/initialize.c
r37037 r38062 97 97 args_client (argc, argv); 98 98 99 if (MODE == MODE_SYNTH_PHOT) return; 100 99 101 if (MODE == MODE_UPDATE_OBJECTS) { 100 102 char tmpline1[256]; -
trunk/Ohana/src/relphot/src/relphot.c
r37807 r38062 17 17 // DOES NOT LOAD THE IMAGE TABLE 18 18 relphot_objects (0, NULL); 19 exit (0); 20 21 case SYNTH_PHOT: 22 // set the mean magnitudes ONLY for SYNPHOT objects 23 relphot_synthphot (0, NULL); 19 24 exit (0); 20 25 -
trunk/Ohana/src/relphot/src/relphot_client.c
r37037 r38062 87 87 } 88 88 89 case MODE_SYNTH_PHOT: 90 // set the mean magnitudes ONLY for SYNPHOT objects 91 relphot_synthphot (HOST_ID, HOSTDIR); 92 client_logger_message ("set synth photometry\n"); 93 break; 94 89 95 default: 90 96 fprintf (stderr, "impossible!"); -
trunk/Ohana/src/uniphot/Makefile
r37807 r38062 112 112 $(SRC)/setastrom.$(ARCH).o \ 113 113 $(SRC)/initialize_setastrom.$(ARCH).o \ 114 $(SRC)/cam_correction.$(ARCH).o \ 114 115 $(SRC)/dcr_correction.$(ARCH).o \ 115 116 $(SRC)/kh_correction.$(ARCH).o \ … … 127 128 $(SRC)/update_dvo_setastrom.$(ARCH).o \ 128 129 $(SRC)/update_catalog_setastrom.$(ARCH).o \ 130 $(SRC)/cam_correction.$(ARCH).o \ 129 131 $(SRC)/dcr_correction.$(ARCH).o \ 130 132 $(SRC)/kh_correction.$(ARCH).o \ -
trunk/Ohana/src/uniphot/include/setastrom.h
r37807 r38062 10 10 double *y2; 11 11 } Spline; 12 13 // we have one correction (an image) for each filter and chip 14 typedef struct { 15 int Nx; // number of chips in x 16 int Ny; // number of chips in y 17 int Nfilter; // number of filters 18 int Ndir; // number of correction dimensions 19 20 int Nchips; // chip offset (Nx*Ny) 21 int Ngroup; // direction offset (Nx*Ny*Nfilters) 22 int Nvalues; // Nx*Ny*Nfilters*Ndir 23 24 int dX; // superpixel size 25 int dY; // superpixel size 26 27 int NxCCD; // number of pixels 28 int NyCCD; // number of pixels 29 30 Matrix **matrix; // allocate an array of pointers 31 // index = ix + iy*Nx + filter*Nchips + dir*Ngroup 32 } CamCorrection; 12 33 13 34 /* global variables set in parameter file */ … … 27 48 char *KH_FILE; 28 49 char *DCR_FILE; 50 char *CAM_FILE; 29 51 30 52 int KH_RESET; 31 53 int DCR_RESET; 54 int CAM_RESET; 32 55 33 56 SkyRegion UserPatch; … … 65 88 int load_dcr_correction (char *filename); 66 89 int get_dcr_correction (int filter, double *dX, double *dY, float Color); 90 91 int load_cam_correction (char *filename); 92 int get_cam_correction (int chipID, int filter, float Xccd, float Yccd, double *dX, double *dY); -
trunk/Ohana/src/uniphot/src/initialize_setastrom.c
r37807 r38062 4 4 fprintf (stderr, "USAGE: setastrom [options]\n"); 5 5 fprintf (stderr, " options:\n"); 6 fprintf (stderr, " -KH (file) : supply Koppenhoefer correction splines\n"); 6 7 fprintf (stderr, " -DCR (file) : supply DCR correction splines\n"); 7 fprintf (stderr, " - KH (file) : supply Koppenhoefer correction splines\n");8 fprintf (stderr, " -CAM (file) : supply camera-static correction file\n"); 8 9 fprintf (stderr, " -v : verbose mode\n"); 9 10 fprintf (stderr, " -region Rmin Rmax Dmin Dmax\n"); … … 77 78 } 78 79 80 CAM_FILE = NULL; 81 if ((N = get_argument (argc, argv, "-CAM"))) { 82 remove_argument (N, &argc, argv); 83 char *tmpfile = strcreate (argv[N]); 84 CAM_FILE = abspath (tmpfile, DVO_MAX_PATH); 85 remove_argument (N, &argc, argv); 86 } 87 CAM_RESET = FALSE; 88 if ((N = get_argument (argc, argv, "-CAM-reset"))) { 89 remove_argument (N, &argc, argv); 90 CAM_RESET = TRUE; 91 } 92 79 93 SINGLE_CPT = NULL; 80 94 if ((N = get_argument (argc, argv, "-cpt"))) { … … 146 160 } 147 161 148 if (!KH_FILE && !DCR_FILE) { 149 fprintf (stderr, "at least one of -KH and -DCR must be supplied\n"); 150 exit (1); 162 if (!KH_FILE && !DCR_FILE && !CAM_FILE) { 163 fprintf (stderr, "WARNING: none of -CAM, -KH, -DCR supplied\n"); 151 164 } 152 165 … … 159 172 fprintf (stderr, "USAGE: setastrom_client -hostID (hostID) -catdir (catdir) -hostdir (hostdir) [options]\n"); 160 173 fprintf (stderr, " options:\n"); 174 fprintf (stderr, " -KH (file) : supply Koppenhoefer correction splines\n"); 161 175 fprintf (stderr, " -DCR (file) : supply DCR correction splines\n"); 162 fprintf (stderr, " - KH (file) : supply Koppenhoefer correction splines\n");176 fprintf (stderr, " -CAM (file) : supply camera-static correction file\n"); 163 177 fprintf (stderr, " -region Rmin Rmax Dmin Dmax\n"); 164 178 fprintf (stderr, " -update-catformat (format) : change database schema on output\n"); … … 221 235 remove_argument (N, &argc, argv); 222 236 DCR_RESET = TRUE; 237 } 238 239 CAM_FILE = NULL; 240 if ((N = get_argument (argc, argv, "-CAM"))) { 241 remove_argument (N, &argc, argv); 242 CAM_FILE = strcreate (argv[N]); 243 remove_argument (N, &argc, argv); 244 } 245 CAM_RESET = FALSE; 246 if ((N = get_argument (argc, argv, "-CAM-reset"))) { 247 remove_argument (N, &argc, argv); 248 CAM_RESET = TRUE; 223 249 } 224 250 … … 282 308 if (!CATDIR) usage_setastrom_client(); 283 309 284 if (!KH_FILE && !DCR_FILE) { 285 fprintf (stderr, "at least one of -KH and -DCR must be supplied\n"); 286 exit (1); 310 if (!KH_FILE && !DCR_FILE && !CAM_FILE) { 311 fprintf (stderr, "WARNING: none of -CAM, -KH, -DCR supplied\n"); 287 312 } 288 313 -
trunk/Ohana/src/uniphot/src/update_catalog_setastrom.c
r37807 r38062 117 117 } 118 118 119 /**** CAM section ****/ 120 121 double dX_CAM = 0.0; 122 double dY_CAM = 0.0; 123 if (CAM_FILE) { 124 125 // camera systematic correction ("astroflat") depends on only the X,Y coordinate, 126 // the filter, and the chip 127 128 // 10134 : r, XY34 -> filtCode = 1 129 int filtCode = (int)((measure->photcode % 1000) / 100); 130 131 // correction is in arcseconds 132 get_cam_correction (chipID, filtCode, measure->Xccd, measure->Yccd, &dX_CAM, &dY_CAM); 133 } 134 119 135 /**** DCR section ****/ 120 136 … … 245 261 } 246 262 if (DCR_RESET) { 247 measure[0].XoffDCR = -dX_DCR / pltScale; 248 measure[0].YoffDCR = -dY_DCR / pltScale; 263 measure[0].XoffDCR = 0.0; 264 measure[0].YoffDCR = 0.0; 265 } 266 if (CAM_FILE) { 267 measure[0].XoffCAM = -dX_CAM / pltScale; 268 measure[0].YoffCAM = -dY_CAM / pltScale; 269 } 270 if (CAM_RESET) { 271 measure[0].XoffDCR = 0.0; 272 measure[0].YoffDCR = 0.0; 249 273 } 250 274 … … 259 283 measure[0].Yfix += measure[0].YoffDCR; 260 284 } 285 if (isfinite(measure[0].XoffCAM) && isfinite(measure[0].YoffCAM)) { 286 measure[0].Xfix += measure[0].XoffCAM; 287 measure[0].Yfix += measure[0].YoffCAM; 288 } 261 289 found ++; 262 290 } -
trunk/Ohana/src/uniphot/src/update_dvo_setastrom.c
r37807 r38062 17 17 } 18 18 19 if (KH_FILE) load_kh_correction (KH_FILE); 20 if (DCR_FILE) load_dcr_correction (DCR_FILE); 19 if (KH_FILE) if (!load_kh_correction (KH_FILE)) { fprintf (stderr, "failed to load KH correction %s\n", KH_FILE ); exit (1); } 20 if (DCR_FILE) if (!load_dcr_correction (DCR_FILE)) { fprintf (stderr, "failed to load DCR correction %s\n", DCR_FILE); exit (1); } 21 if (CAM_FILE) if (!load_cam_correction (CAM_FILE)) { fprintf (stderr, "failed to load CAM correction %s\n", CAM_FILE); exit (1); } 21 22 22 23 // determine the populated SkyRegions overlapping the requested area (default depth) … … 104 105 if (KH_FILE) { snprintf (tmpline, 1024, "%s -KH %s", command, KH_FILE); strcpy (command, tmpline); } 105 106 if (DCR_FILE) { snprintf (tmpline, 1024, "%s -DCR %s", command, DCR_FILE); strcpy (command, tmpline); } 107 if (CAM_FILE) { snprintf (tmpline, 1024, "%s -CAM %s", command, CAM_FILE); strcpy (command, tmpline); } 106 108 if (UPDATE_CATFORMAT) { snprintf (tmpline, 1024, "%s -update-catformat %s", command, UPDATE_CATFORMAT); strcpy (command, tmpline); } 107 109 108 110 if (KH_RESET) { snprintf (tmpline, 1024, "%s -KH-reset", command); strcpy (command, tmpline); } 109 111 if (DCR_RESET) { snprintf (tmpline, 1024, "%s -DCR-reset", command); strcpy (command, tmpline); } 112 if (CAM_RESET) { snprintf (tmpline, 1024, "%s -CAM-reset", command); strcpy (command, tmpline); } 110 113 111 114 fprintf (stderr, "command: %s\n", command); -
trunk/dvodist
- Property svn:mergeinfo deleted
-
trunk/extsrc/gpcsw/gpcsrc/fits/burntool
- Property svn:mergeinfo deleted
-
trunk/ippMonitor/czartool/czartool/Plotter.pm
- Property svn:mergeinfo deleted
-
trunk/ippScripts/Build.PL
- Property svn:mergeinfo deleted
-
trunk/ippScripts/MANIFEST
- Property svn:mergeinfo deleted
-
trunk/ippScripts/scripts
- Property svn:mergeinfo deleted
-
trunk/ippScripts/scripts/lap_science.pl
- Property svn:mergeinfo deleted
-
trunk/ippScripts/scripts/queuestaticsky.pl
- Property svn:mergeinfo deleted
-
trunk/ippScripts/scripts/sc_remote_exec.pl
- Property svn:mergeinfo deleted
-
trunk/ippTasks/stack.pro
- Property svn:mergeinfo deleted
-
trunk/ippTools/share/laptool_exposures.sql
- Property svn:mergeinfo deleted
-
trunk/ippTools/src/stacktool.c
- Property svn:mergeinfo deleted
-
trunk/ippTools/src/stacktoolConfig.c
- Property svn:mergeinfo deleted
-
trunk/ippconfig
- Property svn:mergeinfo deleted
-
trunk/ippconfig/gpc1/ppStack.config
- Property svn:mergeinfo deleted
-
trunk/ippconfig/gpc1/psastro.config
- Property svn:mergeinfo deleted
-
trunk/ippconfig/recipes/ppStack.config
- Property svn:mergeinfo deleted
-
trunk/ippconfig/recipes/ppSub.config
- Property svn:mergeinfo deleted
-
trunk/ippconfig/recipes/psastro.config
- Property svn:mergeinfo deleted
-
trunk/ippconfig/recipes/reductionClasses.mdc
- Property svn:mergeinfo deleted
-
trunk/ippconfig/simple/psphot.config
- Property svn:mergeinfo deleted
-
trunk/psLib/src/math/psMinimizePolyFit.c
- Property svn:mergeinfo deleted
-
trunk/psModules/src/objects
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20150112/psModules/src/objects (added) merged: 38058,38061
- Property svn:mergeinfo changed
-
trunk/psModules/src/objects/pmSourceIO_CMF.c.in
- Property svn:mergeinfo deleted
-
trunk/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20150112/psphot (added) merged: 38057,38061
- Property svn:mergeinfo changed
-
trunk/pstamp/scripts/pstamp_checkdependent.pl
- Property svn:mergeinfo deleted
-
trunk/pstamp/scripts/pstamp_finish.pl
- Property svn:mergeinfo deleted
-
trunk/pstamp/scripts/pstamp_job_run.pl
- Property svn:mergeinfo deleted
-
trunk/pstamp/scripts/pstampparse.pl
- Property svn:mergeinfo deleted
-
trunk/pstamp/scripts/request_finish.pl
- Property svn:mergeinfo deleted
Note:
See TracChangeset
for help on using the changeset viewer.
