Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: FITS save handler not installed #481

Open
zimmni opened this issue Jan 23, 2023 · 1 comment
Open

OSError: FITS save handler not installed #481

zimmni opened this issue Jan 23, 2023 · 1 comment

Comments

@zimmni
Copy link

zimmni commented Jan 23, 2023

Hello,

I want to use aplpy to create a rgb image from three different fits files of different projections. Thus I first import aplpy, define the directory paths to the files, and create a rgb cube via

blue = '/path/to/blue.fits'

green = '/path/to/green.fits'

red = 'path/to/red.fits'

aplpy.make_rgb_cube([blue,green,red],'path/to/cube_file.fits').

Then I want to create the rgb image using

aplpy.make_rgb_image('path/to/cube_file.fits','path/to/save_rgb_image.fits').

However, here I receive the error

OSError: FITS save handler not installed

I am quite puzzled with this, since I have been working with fits files quite a while now, I opened, modified, closed and saved them before and never experienced this error before. Also googling the error did not really help. I am on Ubuntu 22.04.1 via a vcn server using python 3.10.6 and aplpy 2.1.0. I installed aplpy via pip install and checked for numpy (version 1.21.5), matplotlib (v 3.6.3), and astropy (v 5.0.2). Also, pillow version (9.4.0).
It is the first time for me opening an issue on github, so please if I am violating/breaking any protocols, please tell me and I will do my best to correct myself.

Does anybody have an idea how to address this error?

Best,
zimmni

@zimmni
Copy link
Author

zimmni commented Jan 23, 2023

PS, here is the whole error message:

OSError Traceback (most recent call last)
Cell In[25], line 1
----> 1 aplpy.make_rgb_image('/mnt/Element/DATA/ColorImages/aplpy/eRASS1-ClJ051707-611912/cube.fits',
2 '/mnt/Element/DATA/ColorImages/aplpy/eRASS1-ClJ051707-611912/color_cube.fits')

File ~/.local/lib/python3.10/site-packages/aplpy/rgb.py:205, in make_rgb_image(data, output, indices, vmin_r, vmax_r, pmin_r, pmax_r, stretch_r, vmid_r, exponent_r, vmin_g, vmax_g, pmin_g, pmax_g, stretch_g, vmid_g, exponent_g, vmin_b, vmax_b, pmin_b, pmax_b, stretch_b, vmid_b, exponent_b, make_nans_transparent, embed_avm_tags)
201 img.putalpha(image_alpha)
203 img = img.transpose(Image.FLIP_TOP_BOTTOM)
--> 205 img.save(output)
207 if embed_avm_tags:
209 try:

File /usr/lib/python3/dist-packages/PIL/Image.py:2212, in Image.save(self, fp, format, **params)
2209 fp = builtins.open(filename, "w+b")
2211 try:
-> 2212 save_handler(self, fp, filename)
2213 finally:
2214 # do what we can to clean up
2215 if open_fp:

File /usr/lib/python3/dist-packages/PIL/FitsStubImagePlugin.py:90, in _save(im, fp, filename)
88 def _save(im, fp, filename):
89 if _handler is None or not hasattr("_handler", "save"):
---> 90 raise OSError("FITS save handler not installed")
91 _handler.save(im, fp, filename)

OSError: FITS save handler not installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant