Closed pllim closed 1 year ago
My data was randomly generated by numpy.random.random
so all the values fall between 0 and 1.
Do you have some code that generates a repeatable fault image?
Something like this:
import numpy as np
from astropy.io import fits
def image_cube_hdu_obj_microns():
flux_hdu = fits.ImageHDU(np.random.random((8, 9, 10)).astype(np.float32))
flux_hdu.name = 'FLUX'
uncert_hdu = fits.ImageHDU(np.random.random((8, 9, 10)).astype(np.float32))
uncert_hdu.name = 'ERR'
mask_hdu = fits.ImageHDU(np.random.randint((8, 9, 10)).astype(np.uint16))
mask_hdu.name = 'MASK'
wcs = {
'WCSAXES': 3, 'CRPIX1': 38.0, 'CRPIX2': 38.0, 'CRPIX3': 1.0,
'CRVAL1': 205.4384, 'CRVAL2': 27.004754, 'CRVAL3': 4.890499866509344,
'CTYPE1': 'RA---TAN', 'CTYPE2': 'DEC--TAN', 'CTYPE3': 'WAVE',
'CUNIT1': 'deg', 'CUNIT2': 'deg', 'CUNIT3': 'um',
'CDELT1': 3.61111097865634E-05, 'CDELT2': 3.61111097865634E-05, 'CDELT3': 0.001000000047497451, # noqa
'PC1_1 ': -1.0, 'PC1_2 ': 0.0, 'PC1_3 ': 0,
'PC2_1 ': 0.0, 'PC2_2 ': 1.0, 'PC2_3 ': 0,
'PC3_1 ': 0, 'PC3_2 ': 0, 'PC3_3 ': 1,
'DISPAXIS': 2, 'VELOSYS': -2538.02,
'SPECSYS': 'BARYCENT', 'RADESYS': 'ICRS', 'EQUINOX': 2000.0,
'LONPOLE': 180.0, 'LATPOLE': 27.004754,
'MJDREFI': 0.0, 'MJDREFF': 0.0, 'DATE-OBS': '2014-03-30'}
flux_hdu.header.update(wcs)
flux_hdu.header['BUNIT'] = '1E-17 erg*s^-1*cm^-2*Angstrom^-1'
uncert_hdu.header['BUNIT'] = '1E-17 erg*s^-1*cm^-2*Angstrom^-1'
return fits.HDUList([fits.PrimaryHDU(), flux_hdu, uncert_hdu, mask_hdu])
hdulist = image_cube_hdu_obj_microns()
hdulist.writeto('image_cube_hdu_obj_microns.fits', overwrite=True)
Hmm, I thought I was able to reproduce this error with dev branch last week, but now I cannot.
Hmm, I thought I was able to reproduce this error with dev branch last week, but now I cannot.
Figured that out--I had "Cut New" set to "off".
@pllim, I did some digging and found the problem to be that the sample size was too small with small images. I'm still thinking about merging #1042, after a rebase and some more testing to make sure I am getting similar results.
In the meantime, can you check that your problem images are fixed by this update in b75f2f995a6eb4e31394c1ea431f30bcd2548fed ?
See https://github.com/ejeschke/ginga/pull/1042#issuecomment-1440721720 .
I also think #1042 is still a good idea since that would bring Ginga to be more consistent with astropy.visualization
. Thanks! 😸
on the latest master branch, cut low is 0.03439 and cut high is 0.9939
Excellent, that sounds much better. I'm glad we took a deeper look. I'm going to close this issue, and we can continue the discussion in #1042
I see this traceback:
As a result, cuts is set to
(0, 0)
and I have to manually adjust the cut levels for image to show properly.My hunch is that the loop run into
break
at the very first iteration.https://github.com/ejeschke/ginga/blob/af1756aa0fb9bda485fee2e1706836382d60547b/ginga/util/zscale.py#L128-L129