Selection of the pixels involved in the fitting is via two keywords: box= and clip=. Apart from visual inspection, a good strategy could be to clip at a fraction of (datamax-datamin)
See also ccdshape(1NEMO) from which this program was derived.
Pixel coordinates are 0-based.
sn=100 ccdgen - gauss 1,3 127,127
|\ ccdgen - noise 0,1/$sn in=- seed=123 |\
ccdblob -
Npoints: 49 Box: 7 DataMinMax: 0.345445 1.00188 Min at: 60
66 (0 based) Max at: 63 63 Mean: 0.6649 Median: 1.00188 DataSum:
32.5801 Flux: -16.5122 ImSize: 127 127 1 Center: 0.000935206
-0.00434081 0 [wcs] BLOB: 63 63 0.000935206 -0.00434081 7 1.00188 1.00188
-16.5122 e_x: 1.00000 0.70711 0.70711 0.00000 90.0
45.0
e_y: 1.00000 -0.70711 0.70711 0.00000 90.0 135.0
e_z: 1.00000 0.00000 0.00000 1.00000 0.0 0.0
qpole: 7941.36475 0.70711 0.70711 0.00000
: 3.35181 0.70711 -0.70711 0.00000
: 0.00000 0.00000 0.00000 1.00000
a,b: 89.1143 1.83079 inc: 88.8228 (meaningless without radecvel) pa:
135 (meaningless without radecvel)
The same example as before, but now feeding a table with 37 points to a 2d gaussfit. These fits are often very dependant on the initial guess, but it does a pretty good job here:
ns=100
ccdgen - gauss 1,3 127,127 |\ ccdgen - noise 0,1/$sn in=- seed=123 |\
ccdblob - clip=0.5 out=gauss.tab
tabnllsqfit gauss.tab 1,2 3 fit=gauss2d par=1,2,64,64,2
nrt=16 Fitting a+b*exp(-[(x-c)^2+(y-d)^2]/(2*e^2)): a= -0.076949 0.126768 b= 1.07709 0.123398 c= 63.0009 0.0110594 d= 62.9887 0.011061 e= 3.15046 0.244319 npt= 37 rms= 0.00801193 rms2/chi2= 0.00237507 rms/chi = 1
tabnllsqfit gauss.tab 1,2 3 fit=peak2d par=1,-1,-1,63,63 Fitting : y = a+b*(x-d)**2+*c*(y-e)**2: a= 0.977191 0.00428134 b= -0.0414872 0.000758877 c= -0.0408268 0.000758877 d= 63.0008 0.0148635 e= 62.9876 0.0151057 FWZP= 0.206048 0.204401 npt= 37 rms= 0.0119193 rms2/chi2= 0.00525659 rms/chi = 1
https://github.com/perwin/imfit
15-feb-2020 V0.1 Created PJT 14-feb-2025 V0.3 fix boxsize when no pos given PJT 30-may-2025 V0.5 allow pos=max PJT 7-jun-2025 V0.8 WCS fixes,and use 0-based pixels PJT