Changeset 41965 for branches/eam_branches/ipp-20211108
- Timestamp:
- Dec 25, 2021, 2:19:17 PM (5 years ago)
- Location:
- branches/eam_branches/ipp-20211108/Ohana/src/opihi
- Files:
-
- 2 added
- 5 edited
-
cmd.astro/Makefile (modified) (1 diff)
-
cmd.astro/imfit-q2gauss.c (added)
-
cmd.astro/imfit-qgauss.c (modified) (4 diffs)
-
cmd.astro/imfit-r2gauss.c (added)
-
cmd.astro/imfit-rgauss.c (modified) (2 diffs)
-
cmd.astro/imfit.c (modified) (1 diff)
-
include/imfit.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20211108/Ohana/src/opihi/cmd.astro/Makefile
r41666 r41965 94 94 $(SRC)/imfit-qfgauss.$(ARCH).o \ 95 95 $(SRC)/imfit-qrgauss.$(ARCH).o \ 96 $(SRC)/imfit-rgauss.$(ARCH).o \ 96 97 $(SRC)/imfit-trail.$(ARCH).o 97 98 -
branches/eam_branches/ipp-20211108/Ohana/src/opihi/cmd.astro/imfit-qgauss.c
r39457 r41965 25 25 par[4] = get_variable_default ("SXYg", 0); 26 26 par[5] = get_variable_default ("Zpk", 10000); 27 par[6] = get_variable_default ("Sg", 0.0); 27 par[6] = get_variable_default ("Sg", 0.0); // sky 28 28 par[7] = get_variable_default ("Sr", 1.0); 29 29 fpar[0] = get_variable_default ("Npow", 2.25); … … 40 40 set_variable ("Zpk", par[5]); 41 41 set_variable ("Sg", par[6]); 42 set_variable ("Sr", par[7]);42 set_variable ("Sr", par[7]); 43 43 } 44 44 45 /* one component, two slopes: (1 + z^M + z^N)^(-1) -- x, y, sx, sy, sxy, I, sky, sr */45 /* qgauss: (1 + Sr*z + z^Npow)^(-1) -- x, y, sx, sy, sxy, I, sky, sr */ 46 46 opihi_flt qgaussTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 47 47 OHANA_UNUSED_PARAM(Npar); … … 60 60 r = 1.0 / (1 + par[7]*z + pow(z,fpar[0])); 61 61 f = par[5]*r + par[6]; 62 q = par[5]*SQ(r)*(par[7] + fpar[0]*pow(z,(fpar[0]-1)));63 62 64 63 if (dpar != NULL) { 64 q = par[5]*SQ(r)*(par[7] + fpar[0]*pow(z,(fpar[0]-1))); 65 65 dpar[0] = q*(2*px*par[2] + par[4]*Y); 66 66 dpar[1] = q*(2*py*par[3] + par[4]*X); … … 75 75 } 76 76 77 /****************************************************************************** 78 * this file defines the QGAUSS source shape model. Note that these model functions are 79 * loaded by pmModelClass.c using 'include', and thus need no 'include' statements of 80 * their own. The models use a psVector to represent the set of parameters, with the 81 * sequence used to specify the meaning of the parameter. The meaning of the parameters 82 * may thus vary depending on the specifics of the model. All models which are used as a 83 * PSF representations share a few parameters, for which # define names are listed in 84 * pmModel.h: 85 86 power-law with fitted linear term 87 1 / (1 + kz + z^2.25) 88 89 * PM_PAR_SKY 0 - local sky : note that this is unused and may be dropped in the future 90 * PM_PAR_I0 1 - central intensity 91 * PM_PAR_XPOS 2 - X center of object 92 * PM_PAR_YPOS 3 - Y center of object 93 * PM_PAR_SXX 4 - X^2 term of elliptical contour (SigmaX / sqrt(2)) 94 * PM_PAR_SYY 5 - Y^2 term of elliptical contour (SigmaY / sqrt(2)) 95 * PM_PAR_SXY 6 - X*Y term of elliptical contour 96 * PM_PAR_7 7 - amplitude of the linear component (k) 97 *****************************************************************************/ -
branches/eam_branches/ipp-20211108/Ohana/src/opihi/cmd.astro/imfit-rgauss.c
r39457 r41965 9 9 10 10 fitfunc = rgaussTD; 11 cleanup = rgaussCL;12 Npar = 10;13 Nfpar = 1;11 imfit_cleanup = rgaussCL; 12 Npar = 8; 13 Nfpar = 0; 14 14 15 15 /* allocate free and fixed parameters */ … … 21 21 par[0] = get_variable_default ("Xg", 0); 22 22 par[1] = get_variable_default ("Yg", 0); 23 par[2] = 2.35 * sqrt(2.0)/ get_variable_default ("SXg", 2.0);24 par[3] = 2.35 * sqrt(2.0)/ get_variable_default ("SYg", 2.0);25 par[4] = 0.0;23 par[2] = 2.35 / get_variable_default ("SXg", 2.0); 24 par[3] = 2.35 / get_variable_default ("SYg", 2.0); 25 par[4] = get_variable_default ("SXYg", 0); 26 26 par[5] = get_variable_default ("Zpk", 10000); 27 par[6] = get_variable_default ("Sg", 0.0); 28 par[7] = 2.35 * sqrt(2.0) / get_variable_default ("SXf", 15.0); 29 par[8] = 2.35 * sqrt(2.0) / get_variable_default ("SYf", 15.0); 30 par[9] = get_variable_default ("SXYf", 0.0); 27 par[6] = get_variable_default ("Sg", 0.0); // sky 28 par[7] = get_variable_default ("Sr", 2.0); 31 29 32 fpar[0] = get_variable_default ("Npow", 2.25);30 // fpar[0] = get_variable_default ("Npow", 2.25); 33 31 34 32 sky = &par[6]; 35 33 } 36 34 37 /* two components: (1 + z_1 + 0.5*z_1^2 + z_2^N)^(-1) -- x, y, sx1, sy1, sxy1, I, sky, sx2, sy2, sxy2 */ 35 void rgaussCL () { 36 set_variable ("Xg", par[0]); 37 set_variable ("Yg", par[1]); 38 set_variable ("SXg", 2.35 / par[2]); 39 set_variable ("SYg", 2.35 / par[3]); 40 set_variable ("SXYg", par[4]); 41 set_variable ("Zpk", par[5]); 42 set_variable ("Sg", par[6]); 43 set_variable ("Sr", par[7]); 44 } 45 46 /* rgauss: (1 + z + z^alpha)^(-1) -- x, y, sx, sy, sxy, I, sky, sr */ 38 47 opihi_flt rgaussTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 39 48 OHANA_UNUSED_PARAM(Npar); 40 49 41 opihi_flt X, Y, px1, py1, px2, py2; 42 opihi_flt z1, z2, r, q1, q2, f; 50 opihi_flt X = x - par[0]; 51 opihi_flt Y = y - par[1]; 52 53 opihi_flt px = par[2]*X; 54 opihi_flt py = par[3]*Y; 43 55 44 X = x - par[0]; 45 Y = y - par[1]; 46 47 px1 = par[2]*X; 48 py1 = par[3]*Y; 49 px2 = par[7]*X; 50 py2 = par[8]*Y; 56 opihi_flt z = 0.5*SQ(px) + 0.5*SQ(py) + par[4]*X*Y; 51 57 52 z1 = 0.5*SQ(px1) + 0.5*SQ(py1) + par[4]*X*Y; 53 z2 = 0.5*SQ(px2) + 0.5*SQ(py2) + par[9]*X*Y; 54 55 r = 1.0 / (1 + z1 + 0.5*SQ(z1)+ pow(z2,fpar[0])); 56 f = par[5]*r + par[6]; 57 58 q1 = par[5]*SQ(r)*(1 + z1); 59 q2 = par[5]*SQ(r)*fpar[0]*pow(z2,(fpar[0]-1)); 58 opihi_flt p = pow(z,par[7] - 1.0); 59 opihi_flt r = 1.0 / (1 + z + z*p); 60 opihi_flt f = par[5]*r + par[6]; 60 61 61 62 if (dpar != NULL) { 62 dpar[0] = q1*(2*px1*par[2] + par[4]*Y) + q2*(2*px2*par[7] + par[9]*Y); 63 dpar[1] = q1*(2*py1*par[3] + par[4]*X) + q2*(2*py2*par[8] + par[9]*X); 64 dpar[2] = -2*q1*px1*X; 65 dpar[3] = -2*q1*py1*Y; 66 dpar[4] = -q1*X*Y; 63 opihi_flt t = par[5]*SQ(r); 64 opihi_flt q = t*(1 + par[7]*p); 65 66 dpar[0] = +q*(par[2]*px + par[4]*Y); 67 dpar[1] = +q*(par[3]*py + par[4]*X); 68 dpar[2] = -q*px*X; 69 dpar[3] = -q*py*Y; 70 dpar[4] = -q*X*Y; 67 71 dpar[5] = +r; 68 72 dpar[6] = +1; 69 dpar[7] = -2*q2*px2*X; 70 dpar[8] = -2*q2*py2*Y;71 dpar[ 9] = -q2*X*Y;73 74 // this model derivative is undefined at z = 0.0, but the limit is zero as z -> 0.0 75 dpar[7] = (z == 0.0) ? 0.0 : -t*log(z)*p*z; 72 76 } 73 77 return (f); 74 78 } 75 79 76 int rgaussCL () { 77 set_variable ("Xg", par[0]); 78 set_variable ("Yg", par[1]); 79 set_variable ("SXg", 2.35 * sqrt(2.0) / par[2]); 80 set_variable ("SYg", 2.35 * sqrt(2.0) / par[3]); 81 set_variable ("SXYg", par[4]); 82 set_variable ("Zpk", par[5]); 83 set_variable ("Sg", par[6]); 84 set_variable ("SXf", 2.35 * sqrt(2.0) / par[7]); 85 set_variable ("SYf", 2.35 * sqrt(2.0) / par[8]); 86 set_variable ("SXYf", par[9]); 87 } 80 /****************************************************************************** 81 * this file defines the RGAUSS source shape model (XXX need a better name!). Note that these 82 * model functions are loaded by pmModelClass.c using 'include', and thus need no 'include' 83 * statements of their own. The models use a psVector to represent the set of parameters, with 84 * the sequence used to specify the meaning of the parameter. The meaning of the parameters 85 * may thus vary depending on the specifics of the model. All models which are used as a PSF 86 * representations share a few parameters, for which # define names are listed in pmModel.h: 87 88 power-law with fitted slope 89 1 / (1 + z + z^alpha) 90 91 * PM_PAR_SKY 0 - local sky : note that this is unused and may be dropped in the future 92 * PM_PAR_I0 1 - central intensity 93 * PM_PAR_XPOS 2 - X center of object 94 * PM_PAR_YPOS 3 - Y center of object 95 * PM_PAR_SXX 4 - X^2 term of elliptical contour (sqrt(2) / SigmaX) 96 * PM_PAR_SYY 5 - Y^2 term of elliptical contour (sqrt(2) / SigmaY) 97 * PM_PAR_SXY 6 - X*Y term of elliptical contour 98 * PM_PAR_7 7 - power-law slope (alpha) 99 *****************************************************************************/ 100 -
branches/eam_branches/ipp-20211108/Ohana/src/opihi/cmd.astro/imfit.c
r41962 r41965 65 65 sgauss_setup (argv[N]); 66 66 qgauss_setup (argv[N]); // OK 67 rgauss_setup (argv[N]); 67 68 qfgauss_setup (argv[N]); // OK 68 69 qrgauss_setup (argv[N]); -
branches/eam_branches/ipp-20211108/Ohana/src/opihi/include/imfit.h
r41667 r41965 14 14 void sgauss_setup (char *name); 15 15 void qgauss_setup (char *name); 16 void rgauss_setup (char *name); 16 17 void qfgauss_setup (char *name); 17 18 void qrgauss_setup (char *name);
Note:
See TracChangeset
for help on using the changeset viewer.
