I have a .fits file I want to represent but Paraview does not give the option to open this type of file. Which would be the best option to do this?
I tried opening it in python to get a numpy ndarray but I still cannot find a way to visualize this. My data is 3D and I would like to represent a volume or isocontours.
I’m afraid there is no native .fits reader in ParaView.
Can you save your data to another format ?
Well, I’ll be getting the files in .fits and it won’t be possible to store them all in another format. I was trying to open the files in the paraview python shell, and entering them from there. I managed to enter a data cube with PolyPointSource but I can’t give a value to each point and create a surfaces. Is there a way to do this?
Back to creating files in another format; maybe it’d be possible if I delete them just after reading with paraview, but I don’t know what format would be appropriate for this purpose. I need the process to be efficient.
In that case you may want to use a ProgrammableSource to read your file in python.
In there, you will be able to create the VTK datastructure.
For conversion, I do not know which format you can convert to.
Thank you, using ProgrammableSource worked.
I add the code I used as the script inside ProgrammableSource in case someone has the same issue:
import numpy as np
# The variable scidata is a 3D numpy array, and it represents my dataset.
# I previously converted the .fits file to numpy with astropy.io.fits
nx, ny, nz = scidata.shape
flux = vtk.vtkFloatArray()
for k in range(nz):
for j in range(ny):
for i in range(nx):
point += 1
After this, a filter has to be applied (I created Contours) to visualize the data.
Of course, I am new to Paraview and there might be some other way to do this, but, at least, I can get a decent representation of my data.