Skip to content

Map Creation Error when norm_kwargs dictionary is sparse.  #84

@TheSkyentist

Description

@TheSkyentist

There is some unpredictable behavior with a per-file norm_kwargs dictionary.

I have a directory with the following structure:

 fitsmap/
├─ F200W.fits
├─ F200W-307.0.fits
├─ RGB.png
├─ Segmentation.png
/

The following code snippet results in the following error:

# 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)
}

# Make Map
files = ['RGB.png','F200W.fits','F200W-307.0.fits','Segmentation.png']
convert.files_to_map(
    files,out_dir='test',
    norm_kwargs=norm_kwargs
    )
  File "████/fitsmap/fitsmap/convert.py", line 1196, in files_to_map
    any(map(f, tasks))
  File "████/fitsmap/fitsmap/convert.py", line 1194, in f
    func_args[0](**func_args[1])
  File "████/fitsmap/fitsmap/convert.py", line 461, in tile_img
    mpl_norm, mpl_cmap = build_mpl_objects(array.array, image_norm)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "████/fitsmap/fitsmap/convert.py", line 408, in build_mpl_objects
    mpl_norm = simple_norm(array, **norm_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: simple_norm() got an unexpected keyword argument 'F200W.fits'

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions