Changeset 23487 for trunk/ppSim
- Timestamp:
- Mar 23, 2009, 9:42:42 AM (17 years ago)
- Location:
- trunk/ppSim/src
- Files:
-
- 3 edited
-
ppSim.h (modified) (3 diffs)
-
ppSimRandomGaussian.c (modified) (6 diffs)
-
ppSimStars.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSim.h
r23465 r23487 67 67 } ppSimGalaxy; 68 68 69 ppSimStar *ppSimStarAlloc ();70 ppSimGalaxy *ppSimGalaxyAlloc ();69 ppSimStar *ppSimStarAlloc(void); 70 ppSimGalaxy *ppSimGalaxyAlloc(void); 71 71 72 72 /// Parse command-line arguments … … 136 136 137 137 // add a bad CTE region 138 bool ppSimBadCTE(psImage *image, // Signal image, modified and returned139 const pmConfig *config // configuration138 bool ppSimBadCTE(psImage *image, // Signal image, modified and returned 139 const pmConfig *config // configuration 140 140 ); 141 141 … … 189 189 double ppSimRandomGaussian (const psRandom *rnd, double mean, double sigma); 190 190 double ppSimRandomGaussianNorm (const psRandom *rnd); 191 void ppSimRandomGaussianFree( );191 void ppSimRandomGaussianFree(void); 192 192 193 193 bool ppSimPhotomFiles (pmConfig *config, pmFPAfile *fakeFile, pmFPAfile *forceFile); -
trunk/ppSim/src/ppSimRandomGaussian.c
r18011 r23487 29 29 30 30 /* integrate a gaussian from -5 sigma to +5 sigma */ 31 void p_ppSimRandomGaussianInit ( ) {32 31 void p_ppSimRandomGaussianInit (void) { 32 33 33 int i; 34 34 long A, B; 35 35 double val, x, dx, dx1, dx2, dx3, df; 36 36 double mean, sigma; 37 37 38 38 /* no need to generate this if it already exists */ 39 39 if (gaussint) return; … … 42 42 for (B = 0; A == time(NULL); B++); 43 43 srand48(B); 44 44 45 45 Ngaussint = 0x1000; 46 46 ppSimRandomGaussianAlloc (Ngaussint + 1); … … 53 53 mean = 0.0; 54 54 sigma = 1.0; 55 55 56 56 for (i = 0, x = -7.0; (i < Ngaussint) && (x < 7.0); x += dx) { 57 df = (3.0*p_ppSimGaussian(x , mean, sigma) + 57 df = (3.0*p_ppSimGaussian(x , mean, sigma) + 58 58 9.0*p_ppSimGaussian(x+dx1, mean, sigma) + 59 9.0*p_ppSimGaussian(x+dx2, mean, sigma) + 59 9.0*p_ppSimGaussian(x+dx2, mean, sigma) + 60 60 3.0*p_ppSimGaussian(x+dx3, mean, sigma)) * (dx1/8.0); 61 61 val += df; … … 67 67 } 68 68 69 // XXX we are using drand48() rather than the random var supplied by rnd 69 // XXX we are using drand48() rather than the random var supplied by rnd 70 70 double ppSimRandomGaussian (const psRandom *rnd, double mean, double sigma) { 71 71 72 72 int i; 73 73 double y; 74 74 75 75 if (gaussint == NULL) { 76 76 p_ppSimRandomGaussianInit (); … … 80 80 i = Ngaussint*y; 81 81 y = gaussint[i]*sigma + mean; 82 82 83 83 return (y); 84 84 85 85 } 86 87 // XXX we are using drand48() rather than the random var supplied by rnd 86 87 // XXX we are using drand48() rather than the random var supplied by rnd 88 88 double ppSimRandomGaussianNorm (const psRandom *rnd) { 89 89 90 90 int i; 91 91 double y; 92 92 93 93 if (gaussint == NULL) { 94 94 p_ppSimRandomGaussianInit (); … … 98 98 i = Ngaussint*y; 99 99 y = gaussint[i]; 100 100 101 101 return (y); 102 102 } -
trunk/ppSim/src/ppSimStars.c
r17557 r23487 6 6 } 7 7 8 ppSimStar *ppSimStarAlloc () {8 ppSimStar *ppSimStarAlloc(void) { 9 9 10 10 ppSimStar *star = (ppSimStar *) psAlloc(sizeof(ppSimStar)); … … 19 19 } 20 20 21 ppSimGalaxy *ppSimGalaxyAlloc () {21 ppSimGalaxy *ppSimGalaxyAlloc(void) { 22 22 23 23 ppSimGalaxy *galaxy = (ppSimGalaxy *) psAlloc(sizeof(ppSimGalaxy));
Note:
See TracChangeset
for help on using the changeset viewer.
