HSUB

A subroutine version of HISTPEAK for developers

Description:

A subroutine version of HISTPEAK that has been designed to be easily transplanted into the users ADAM programs. It establishes the mode, median and other statistics for NDF image files. Calls a subroutine based upon a modified version of HISTPEAK to obtain values for the mode, skewness and kurtosis values for an NDF image.

The method employed to calculate the modal value from the count versus frequency histogram is user selected using parameter TYPE.

The histogram may also be smoothed using a Normal distribution filter of integer radius SFACT. In general, values less than 3 have very little effect. A value of 0 indicates no smoothing is to be employed.

Usage:

HSUB IN SFACT TYPE OUT OUTCAT

Parameters:

IN = _NDF (Read)
The name of the NDF data structure/file that is to be examined.
SFACT = _INTEGER (Read)
The Gaussian smoothing filter radius requested. This may be:
  • -1 to indicate that the application should automatically assign a filter radius to apply to the histogram.

  • 0 to indicate that the histogram should not be smoothed.

  • >0 to indicate the radius of the Gaussian filter to use. Values greater than HSB__SFLIM (see include file HSUB_PAR) are not allowed. The value returned is that actually employed. Units counts.

TYPE = _INTEGER (Read)
Allows the user to define which method is to be used to calculate the modal count value. 1 = raw histogram 2 = smoothed histogram 3 = extrapolate the length of chords through histogram peak to zero length 4 = interpolation of data points near the histogram peak 0 = computer selection i.e. the highest method number that didnt fail A negative value is returned if the application cannot supply a result using the method requested. The value returned for mode is the next best estimate.
OUT = _CHAR (Read)
The name of an output file which is to receive the results. If not present, then the results are printed on stdout.
OUTCAT = _CHAR (Read)
The name of a file which is to receive the results formatted as an STL file, as defined in SUN/190. Both OUT and OUTCAT may be specified, in which case output is sent to both. If neither is specified, then output is sent to stdout, in the format appropriate for the OUT parameter. OUTCAT may only be specified on the command line.

Examples:

hsub in=ic3374 sfact=0 type=0
A histogram of the values in image IC3374 is constructed. The image is not smoothed (SFACT=0) and the results returned correspond to the highest value (1-4) of TYPE that was obtainable.
hsub in=galaxy sfact=10 type=4
A histogram of the values in image GALAXY is used. The image is smoothed (SFACT=10) using a Gaussian filter of radius 10. The results required are those for the smoothed histogram only.
hsub in=forn4 sfact=6 type=3 outcat=hsub.txt
A histogram of the values in image FORN4 is used. The image is smoothed using a gaussian filter of radius 6 and the results returned those for the projected mode value.

Notes:

HSUB should be viewed as a coding example for users wishing to incorporate the functions of HISTPEAK into their own programs.

This application is intended to form the basis of a user program requiring image statistics. The user requiring other data from the application will need to modify subroutines HSUB and HISTPEA2 so that the desired parameters (say mean or median) are passed between them.

With the addition of the OUTCAT keyword, HSUB is now used by GAIA to generate backgrounds. You should not, therefore, change the keywords in the STL output.

Implementation Status:

The current version will not accept a pixel value range greater than the largest integer value possible.