0

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

Zoe
  • 27,060
  • 21
  • 118
  • 148
lelorrain7
  • 315
  • 5
  • 13
  • I'm a little confused by your problem, but it seems (if you'll pardon the pun) you have an [X-Y problem](https://en.wikipedia.org/wiki/XY_problem). You wrote "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", but then changed subjects to something about trying to write a FITS file, which doesn't seem related to me. You don't need to write your data to a FITS file to access it from GlueViz. – Iguananaut Jul 26 '19 at 08:18
  • This is a 3 dimensions problem if you consider X-Y-Z seperatly. This example is used as an easy model, but imagine you want to plot something with 10 dimensions (9 input 1 output). How to do that ? – lelorrain7 Jul 29 '19 at 14:28
  • GlueViz has (rightfully) a data model that is independent of the data files and file types the data happens to be read from. If you want to plot multi-dimensional data there are all kinds of ways to do that depending on what the data is and how you want to visualize it. So it's not clear what you think writing your data to a FITS file will do for you. In the example in your question you created three arrays, `X`, `Y`, and `Z` and you wanted to visualize them somehow. But what did you do next? Exactly what steps did you take, what result did you expect, and what did you get instead? – Iguananaut Jul 30 '19 at 16:16

1 Answers1

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

and it works...

lelorrain7
  • 315
  • 5
  • 13
  • 2
    This would be a better answer if you explained how the code you provided answers the question. – pppery Jul 25 '19 at 15:58
  • My question was: " 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?" The code presented allows to create a fits file from tables of data. – lelorrain7 Jul 29 '19 at 14:28
  • That sort of information should go in the answer, not in a comment. – pppery Jul 29 '19 at 14:52