diff --git a/doc/releases/1.17.2dev.rst b/doc/releases/1.17.2dev.rst index 194bea27a..2829355d7 100644 --- a/doc/releases/1.17.2dev.rst +++ b/doc/releases/1.17.2dev.rst @@ -43,4 +43,5 @@ Bug Fixes in both spatial dimensions equal to half the field of view. - Fix the code for the extraction of the 1D flat spectrum, so that the spectrum is extracted even when `pixelflat_model` does not exist. - +- The variance cube previously had a cubic term, and this has been changed + to a quadratic term. This has been cross-checked with simple subpixel calculations. diff --git a/pypeit/core/datacube.py b/pypeit/core/datacube.py index bcca07d36..917a6b871 100644 --- a/pypeit/core/datacube.py +++ b/pypeit/core/datacube.py @@ -1822,7 +1822,7 @@ def subpixellate(output_wcs, bins, sciImg, ivarImg, waveImg, slitid_img_gpm, wgh vox_coord = vox_coord.reshape(numpix * num_all_subpixels, 3) # Use the "fast histogram" algorithm, that assumes regular bin spacing flxcube += histogramdd(vox_coord, bins=outshape, range=binrng, weights=np.repeat(this_sci[this_sl] * this_wght_subpix[this_sl], num_all_subpixels) * subpix_wght) - varcube += histogramdd(vox_coord, bins=outshape, range=binrng, weights=np.repeat(this_var[this_sl] * this_wght_subpix[this_sl]**2, num_all_subpixels) * subpix_wght**3) + varcube += histogramdd(vox_coord, bins=outshape, range=binrng, weights=np.repeat(this_var[this_sl] * this_wght_subpix[this_sl]**2, num_all_subpixels) * subpix_wght**2) # NOTE :: This was changed from subpix_wght**3 to subpix_wght**2 by RJC on 2024-12-18 normcube += histogramdd(vox_coord, bins=outshape, range=binrng, weights=np.repeat(this_wght_subpix[this_sl], num_all_subpixels) * subpix_wght) # Normalise the datacube and variance cube