lelorrain7
lelorrain7

Reputation: 337

Python - matrix to FITS File for glueviz

I try to use glue viz (Python tool installed with anaconda) to display 3 imshows plots type, and when I select squares located in an X Y location, then it appears on the other imshow.

I tried to contact the coder team few days ago, but I have no answer yet.

Here are my data:

x = np.linspace(0,5,100)
y = x
X,Y = np.meshgrid(x,y)
Z = (X**2+Y-11)**2

Based on that I have a 2D matrix for each parameter X,Y, and Z. It exists in Glueviz a 2D image reader but it seems it is using FITS file.

I tried to find an example in astropy on how to write my list of 2D tables in a FITS file... but I found no examples.

Anyone can help to do that? A better way to proceed?

Thanks for help

Edit1: Maybe a beginnign of answer here https://docs.astropy.org/en/stable/generated/examples/io/skip_create-large-fits.html

Upvotes: 0

Views: 190

Answers (1)

lelorrain7
lelorrain7

Reputation: 337

import os
from astropy.io import fits
data = Y
hdu = fits.PrimaryHDU(data=data)
hdu.writeto('Y.fits')

and it works...

Upvotes: 0

Related Questions