How to correctly read in visibility data from a FITS file using IDL

  • Thread starter 1ytrewq
  • Start date
  • Tags
    Data File
This will allow you to read in the visibility data for the desired frequency channel.In summary, to read in data from a FITS file for a specific frequency channel, you will need to change the index of the frequency channel in the code. This can be done by replacing the 100 in the code with the index of the desired channel.
  • #1
1ytrewq
6
0
Hi,
I'm having some trouble reading in some data from a FITS file. The FITS file has visibility data for 256 different frequency channels but I only seem to be able to read in the data for the first frequency channel. My question is how do I change which frequency channel I want to look at, for example look at the 100th freq channel rather than the first?

The code I have written in IDL to open the file and extract information so far is:


infile = 'finaluv.fits'

data = mrdfits(infile,0,hdr)

params = data.params
array = data.array

u = params[0,*]
v = params[1,*]
baseline = params[5,*]

real = reform(array[0,0,100,*])
imag = reform(array[0,0,100,*])

visibility = sqrt(real^2+imag^2)
uvdistance = sqrt(u^2 +v^2)
 
Astronomy news on Phys.org
  • #2
To answer your question, you need to change the index of the frequency channel in the code. Replace the 100 with the index of the frequency channel you want to look at (e.g. 0 for the first channel, 1 for the second channel, etc). This can be done by changing the linereal = reform(array[0,0,100,*])imag = reform(array[0,0,100,*])toreal = reform(array[0,0,<index>,*])imag = reform(array[0,0,<index>,*])where <index> is the index of the frequency channel you want to access.
 

1. How do I open a FITS file in IDL?

To open a FITS file in IDL, you can use the READFITS function. This function takes in the file name as a string and returns a structure containing the FITS header and data.

2. How do I access the visibility data in a FITS file using IDL?

Once you have opened the FITS file using the READFITS function, you can access the visibility data by using the DATA keyword. This will return a 2-dimensional array containing the visibility data.

3. What is the best way to visualize the visibility data from a FITS file in IDL?

There are several ways to visualize the visibility data in IDL, depending on your specific needs. One option is to use the CONTOUR function to create a contour plot. Another option is to use the TV function to display the data as an image.

4. Can I manipulate the visibility data in IDL before visualizing it?

Yes, you can manipulate the visibility data in IDL before visualizing it. Some common operations that can be performed include averaging, filtering, and smoothing the data. You can also apply mathematical functions to the data using built-in IDL functions.

5. How can I save the visibility data from a FITS file in IDL to a different format?

You can use the WRITE_BINARY function in IDL to save the visibility data to a binary file. Alternatively, you can use the SAVE function to save the data in IDL's internal format, which can be easily loaded back into IDL for further analysis.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • Programming and Computer Science
Replies
2
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
4K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
4
Views
11K
  • Programming and Computer Science
Replies
10
Views
25K
Replies
1
Views
3K
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
1
Views
3K
Back
Top