- Timestamp:
- Mar 8, 2006, 5:14:23 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/objects/pmSourceIO_OBJ.c
r6545 r6556 1 # include "pmSource.h" 1 /** @file pmSourceIO.c 2 * 3 * @author EAM, IfA 4 * 5 * @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-09 03:14:23 $ 7 * 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 9 * 10 */ 11 12 #include <stdio.h> 13 #include <math.h> 14 #include <string.h> 15 #include "pslib.h" 16 #include "psLine.h" 17 #include "psEllipse.h" 18 #include "pmHDU.h" 19 #include "pmFPA.h" 20 #include "pmPeaks.h" 21 #include "pmMoments.h" 22 #include "pmGrowthCurve.h" 23 #include "pmModel.h" 24 #include "pmPSF.h" 25 #include "pmSource.h" 26 #include "pmModelGroup.h" 27 #include "pmSourceIO.h" 2 28 3 29 // dophot-style output list with fixed line width … … 8 34 psF32 *PAR, *dPAR; 9 35 float dmag, apResid; 36 EllipseShape shape; 37 EllipseAxes axes; 10 38 11 39 psTimerStart ("string"); … … 22 50 for (int i = 0; i < sources->n; i++) { 23 51 pmSource *source = (pmSource *) sources->data[i]; 24 pmModel *model = pm ModelSelect(source);52 pmModel *model = pmSourceSelectModel (source); 25 53 if (model == NULL) 26 54 continue; … … 31 59 dmag = dPAR[1] / PAR[1]; 32 60 type = pmSourceDophotType (source); 33 apResid = source->apMag - source->fitMag; 61 if ((source->apMag < 99.0) && (source->psfMag < 99.0)) { 62 apResid = source->apMag - source->psfMag; 63 } else { 64 apResid = 0.0; 65 } 66 67 shape.sx = PAR[4]; 68 shape.sy = PAR[5]; 69 shape.sxy = PAR[6]; 70 axes = EllipseShapeToAxes (shape); 34 71 35 72 psLineInit (line); … … 37 74 psLineAdd (line, "%8.2f", PAR[2]); 38 75 psLineAdd (line, "%8.2f", PAR[3]); 39 psLineAdd (line, "%8.3f", source-> fitMag);76 psLineAdd (line, "%8.3f", source->psfMag); 40 77 psLineAdd (line, "%6.3f", dmag); 41 78 psLineAdd (line, "%9.2f", PAR[0]); 42 psLineAdd (line, "%9.3f", PAR[4]);43 psLineAdd (line, "%9.3f", PAR[5]);44 psLineAdd (line, "%7.2f", PAR[6]);45 psLineAdd (line, "%8.3f", 99.999);79 psLineAdd (line, "%9.3f", axes.major); 80 psLineAdd (line, "%9.3f", axes.minor); 81 psLineAdd (line, "%7.2f", axes.theta); 82 psLineAdd (line, "%8.3f", source->extMag); 46 83 psLineAdd (line, "%8.3f", source->apMag); 47 84 psLineAdd (line, "%8.2f\n", apResid); … … 50 87 fclose (f); 51 88 psFree (line); 52 fprintf (stderr, "%f seconds for %d objects with psLine\n", psTimerMark ("string"), (int)sources->n); 53 54 psTimerStart ("string"); 55 56 f = fopen ("test.obj", "w"); 57 if (f == NULL) { 58 psLogMsg ("WriteSourceOBJ", 3, "can't open output file for output %s\n", "test.obj"); 59 return false; 60 } 61 62 char *string; 63 // write sources with models 64 for (int i = 0; i < sources->n; i++) { 65 pmSource *source = (pmSource *) sources->data[i]; 66 pmModel *model = pmModelSelect (source); 67 if (model == NULL) 68 continue; 69 70 PAR = model->params->data.F32; 71 dPAR = model->dparams->data.F32; 72 73 dmag = dPAR[1] / PAR[1]; 74 type = pmSourceDophotType (source); 75 apResid = source->apMag - source->fitMag; 76 77 string = NULL; 78 psStringAppend (&string, "%3d", type); 79 psStringAppend (&string, "%8.2f", PAR[2]); 80 psStringAppend (&string, "%8.2f", PAR[3]); 81 psStringAppend (&string, "%8.3f", source->fitMag); 82 psStringAppend (&string, "%6.3f", dmag); 83 psStringAppend (&string, "%9.2f", PAR[0]); 84 psStringAppend (&string, "%9.3f", PAR[4]); 85 psStringAppend (&string, "%9.3f", PAR[5]); 86 psStringAppend (&string, "%7.2f", PAR[6]); 87 psStringAppend (&string, "%8.3f", 99.999); 88 psStringAppend (&string, "%8.3f", source->apMag); 89 psStringAppend (&string, "%8.2f\n", apResid); 90 fwrite (string, 1, strlen(string), f); 91 psFree (string); 92 } 93 fclose (f); 94 fprintf (stderr, "%f seconds for %d objects with psString\n", psTimerMark ("string"), (int)sources->n); 95 89 fprintf (stderr, "%f seconds for %d objects\n", psTimerMark ("string"), (int)sources->n); 96 90 return true; 97 91 } 98 99 // XXX should we use psStringAppend or psLineAdd?
Note:
See TracChangeset
for help on using the changeset viewer.
