FUNCTION gaussian_1d_vec, hsize, fwhm, x0, hires
; Description: This function creates a one-dimensional output pixel vector representing a Gaussian
; profile with a FWHM of "fwhm" pixels, and its centre at the pixel coordinates
; "hsize + 0.5 + x0". The output pixel vector is returned as a vector of length
; "(2*hsize) + 1" pixels. The pixel values are calculated from a pixel grid that samples
; the Gaussian profile at "hires" times the resolution of the output pixel vector, which
; gives the user the option of accurately calculating the integrals over the discrete
; pixels. Finally, the output pixel vector is normalised to a peak value of 1.
;
; Input Parameters:
;
; hsize - INTEGER/LONG - The output pixel vector is returned as a vector of length "(2*hsize) + 1"
; pixels. If this parameter is negative, then it will be reset to "0".
; fwhm - FLOAT/DOUBLE - The Gaussian FWHM (pix). This parameter must be positive, or the function
; will fail and return a value of "0.0".
; x0 - FLOAT/DOUBLE - The offset of the Gaussian centre from the centre of the output pixel vector
; (pix).
; hires - INTEGER/LONG - The oversampling factor to be used to calculate the output pixel vector. This
; parameter has a minimum allowed value of "1", corresponding to no
; oversampling, and a maximum allowed value of "10", to protect against
; unnecessary oversampling using too much memory allocation.
;
; Return Value:
;
; The function returns a pixel vector of DOUBLE precision values and of length "(2*hsize) + 1" pixels
; representing the required Gaussian profile. If the function fails, then it returns a value of "0.0".
;
; Author: Dan Bramich (dan.bramich@hotmail.co.uk)
;
; History:
;
; 24/04/2009 - Further module optimisation performed resulting in a ~21.7% speed increase (dmb).
; 17/07/2008 - Module created (dmb)
;Force the half size of the output pixel vector to be at least zero
;Check the parameters "fwhm" and "x0"
;Force the oversampling factor to be at least 1, and limit its maximum value to 10
;Convert the Gaussian FWHM to a Gaussian sigma
;Generate the coordinate vector for the oversampled pixel vector
;Calculate the values of the Gaussian profile for the oversampled pixel vector
;Bin the oversampled pixel vector by the oversampling factor "hires"
;Normalise the output pixel vector to a peak value of 1
;Return the output pixel vector representing the Gaussian profile