Table of Contents


ccdstat - statistics (1st through 4th moment) and chi2


ccdstat in=image [parameter=value]


ccdstat calculates all moments (up to fourth order) of the values in an image/cube, and calculate some human understandable numbers (mean, dispersion, skewness, curtosis) from them. It can optionally use a weighting map, in case the map needs to be weighted per pixel.

Optionally, if the map contains an error normalized difference between an observation and model, it can also compute a chi2 goodness of fit if the number of of fitting parameters is given (npar, must be > 0 to trigger this option), as well as the number of independant points per beam (nppb):

    chi2 = sum_{i,j}(map(i,j)^2)/nppb/(N/nppb-npar)
where N is the number of non-bad values in the map. The input map is now assumed to contain a dimensionless (obs-mod)/sigma


The following parameters are recognized in any order if the keyword is also given:
input file, in Image(5) format [no default]
If given, all values below this value are ignored in the statistics. By default no lower limit is used.
If given, all values above this value are ignored in the statistics. By default no upper limit is used.
If given, all values identical to this value are ignored in the statistics. Note that, apart for bad=0, it is dangerous to use equating to a real value as a masking operating.
optional input file, in Image(5) format, of which the mapvalues are used as a relative weight factor. Should be all positive, with 0 meaning no weight. [no default]
Number of fitting parameters. If given > 0, this will trigger the computation of chi2 goodness of fit, instead of the normal statistics.
Number of (independant) points per beam. Only used in the computation for chi2, and
Optional display of the median value
Conmpute robust mean, median and dispersion. Default: f
Count occurances of min and max
Only use half (negative) values and symmetrize them
Maximum moments it should compute. The current maximum is 4, moments up through the kurtosis are computed. For maxmom<0 no work is done, except for reading the file, which can be used to benchmark your disk I/O for large NEMO images. [Default: 4].
This will ignore the cell width when summing emission for any axis that has only one cell (assumed infinity, or a result of ccdmom(1NEMO) ). Setting this to false, will not ignore that cell width. [Default : t]
Sorting routine (not activated yet)


  % ccdstat image.ccd min=-2
Min=-1.879409  Max=2.265516
Number of points     : 95
Mean and dispersion  : 0.097891 0.956030
Skewness and kurtosis: -0.059936 -0.654776
5/100 out-of-range points discarded
Here is an example how to created a weight file which is a circular annulus:
  % ccdmath out=map1 "fie=iflt(%r,50,1,0)" size=200,200 crpix=100,100
  % ccdmath out=map2 "fie=iflt(%r,20,1,0)" size=200,200 crpix=100,100
  % ccdmath map1,map2 map3 %1-%2
Here is an two masking example: firstignoring the exact value of 0, followed by an example of a small range around 0:
  % ccdstat map1 bad=0
  % ccdmath map1 - ’iflt(abs(%1),0.001,0,%1)’ | ccdstat - bad=0
Here is an example of calculating the chi2 goodness of fit for a gaussian distribution:
  % ccdmath "" - "rang(0,1)" | ccdstat - npar=1    
Generating a map from scratch
chi2= 1.03431
df= 98

See Also

snapccd(1NEMO) , image(5NEMO)


Peter Teuben


src/image/misc    ccdstat.c

Update History

 4-Oct-88    V1.0: Created        PJT
9-may-03    V1.3: added bad=    PJT
5-jun-03    V1.4: added win=    PJT
14-nov-04    V1.5: added the chi2 trigger with npar= and nppb=    PJT
24-may-06    V1.8: added mmcount    PJT
15-oct-11    V1.10: added maxmom= and bench options    PJT
14-feb-13    V2.0:  ignore=t to properly handle units    PJT

Table of Contents