Open TheSkyentist opened 10 months ago
Thanks for reporting. I will look into this.
@TheSkyentist
It looks the norm_kwargs
are trying to map to the png image:
# Normalization kwargs
norm_kwargs = {
'F200W.fits':dict(stretch='log',min_percent=30, max_percent=99.9),
'Segmentation.png':dict(stretch='log',min_percent=10, max_percent=99.9) # this image shouldn't have any norm kwargs
}
Do you get the same error if you give a norm kwargs map for just the fits files?
The code doesn't currently validate the norm_kwargs
and because you don't provide any norm_kwargs
for one of your fits files the whole dict is being passed in.
I will add some norm_kwargs validation. In the mean time, you need to provide either:
norm_kwargs
dict for all the fits filesor
norm_kwargs
with an entry for each of the fits files.It does not give me an error when I only include the FITS files. However, it also does not give me an error when I include some of the PNGs and FITS files, only certain combinations cause errors. For example:
norm_kwargs={
'RGB.png':dict(stretch="log",min_percent=30,max_percent=99.9),
'F200W.fits':dict(stretch="log",min_percent=30,max_percent=99.9),
'F200W-307.0.fits':dict(stretch="log",min_percent=30,max_percent=99.9),
'Segmentation.png':dict(stretch="log",min_percent=30,max_percent=99.9)
}
causes no errors.
@TheSkyentist
Thanks for checking. It will only give the error when there is a FITS file that doesn't contain an entry in the dictionary. The offending code is here:
image_engine = IMG_ENGINE_MPL if file_location.endswith(".fits") else IMG_ENGINE_PIL
if image_engine == IMG_ENGINE_MPL:
image_norm = norm_kwargs.get(os.path.basename(file_location), norm_kwargs)
mpl_norm, mpl_cmap = build_mpl_objects(array.array, image_norm)
If you put a PNG in there it won't ever get checked because the code only uses the norm_kwargs
for FITS image files.
I need to add some code to validate the norm_kwargs
, but for now doing the above will avoid errors.
Thanks again for reporting!
Ah okay I understand now, thanks for checking!
There is some unpredictable behavior with a per-file norm_kwargs dictionary.
I have a directory with the following structure:
The following code snippet results in the following error:
The error occurs after converting the F200W.fits file and the index.html file is not created. Behaviour is a little unpredictable, depending on which files are called as input, their order, and how many are used in the
norm_kwargs
file.