ism3d.xyhelper.maskmoment.momfuncs.makenoise¶
-
ism3d.xyhelper.maskmoment.momfuncs.
makenoise
(cubearray, gainarray=None, rms=None, perpixel=False, edge=None, clip=0.2)[source]¶ Given a data cube and an optional gain cube, estimate the noise at each position, using the robust mad_std estimator in astropy.
- Parameters
cubearray (SpectralCube or ~numpy.ndarray) – The input data cube. No default.
gainarray (SpectralCube or ~numpy.ndarray, optional) – Gain of a point source at each position of the cube (typically 0 to 1). Can be 2-D or 3-D image, e.g. from pb.fits file from CASA. Default is to assume the rms is constant with position.
rms (float, optional) – Global estimate of the rms noise, to be used instead of trying to estimate it from the data. It should have the units of the input cube. Default is to calculate the rms from the data.
perpixel (boolean, optional) – Whether to calculate the rms per pixel instead of over whole image. Set to True if you know there is a sensitivity variation across the image but you don’t have a gain cube. Only used if rms is unset. Default: False
edge (int, optional) – Number of channels at left and right edges of each spectrum to use for rms estimation. Default is to use all channels.
clip (float, optional) – Pixels below this value in the input gainarray are marked invalid. Default: 0.2
- Returns
noisecube *or* noisearray – The noise estimate as a 3-D array with the same shape and units as the input cube. If the input cube was a SpectralCube, a SpectralCube is returned.
- Return type
SpectralCube or ~numpy.ndarray