<div dir="ltr"><br><div>Hi Adam,</div><div><br></div><div>That is exactly how things should work. But probably for the FITS-IDI files from DiFX it's not entirely true. I know that we (=JIVE/SFXC) write all the MAXIS, MAXISn and CTYPEn keywords and this allows astropy.fits to correctly decompose the matrix column elements into properly shaped n-dimensional arrays instead of one big blob per row as from a DiFX FITS file.</div><div><br></div><div>To me it is clear that some keywords are missing from the DiFX FITS-IDI that prevent the FITS library from doing that; that's what Franz is seeing.</div><div><br></div><div>Cheers,</div><div>h</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 26 October 2016 at 09:17, Adam Deller <span dir="ltr"><<a href="mailto:adeller@astro.swin.edu.au" target="_blank">adeller@astro.swin.edu.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi Franz,<br><br></div>I looked up the FITS-IDI standard, and I think it describes how to extract this information.  See Section 4.1 of <a href="http://www.aoc.nrao.edu/%7Eegreisen/AIPSMEM114.PDF" target="_blank">http://www.aoc.nrao.edu/~egrei<wbr>sen/AIPSMEM114.PDF</a>. 
 Basically, you need to look at the CTYPE# keywords, where # runs from 1
 through to 5 or 6.  CTYPE1 describes the fastest varying parameter, CTYPE2 
the next fastest, and so on.  Corresponding keywords MAXIS# give the 
number of entries along that axis.  CTYPE1 is constrained to be of type 
COMPLEX (i.e., the re/im[/weight] values) but the other ones can come in
 whatever order, you need to look at the keywords.  They are STOKES for 
polarisation, FREQ for frequency channel, and BAND for the subband.<br><br></div>These should all be accessible via astropy.<br><br></div>Cheers,<br></div><div>Adam<br></div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On 25 October 2016 at 17:57, harro verkouter <span dir="ltr"><<a href="mailto:hverkouter@gmail.com" target="_blank">hverkouter@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div>Hi Franz,</div><div><br></div><div>FITS dates from the era of FORTRAN and thus the first axis should go fastest, then the 2nd etc.</div><div>But it depends a bit on what the (implied) order of the axes is in the difx FITS-IDI array. You may want to take a closer look at the full header for the 'UV_DATA' table - there may be hints in there what the order of the axes is within the 'FLUX' column. The logical choice would indeed be IF * CHANNELS * POL * 2 values / complex number (or 3, in sfxc's case; we record a weight per spectral point too: (re, im, wgt)), thus IF goes first, then channel etc.</div><div><br></div><div>In sfxc those axes have been made explicit - as you can tell, so there's no ambiguity of how to interpret them.</div><div><br></div><div>Cheers,</div><div>h</div><div><br></div></div><div class="m_5354878180662607916HOEnZb"><div class="m_5354878180662607916h5"><div class="gmail_extra"><br><div class="gmail_quote">On 25 October 2016 at 06:28, Franz Kirsten <span dir="ltr"><<a href="mailto:franz.kirsten@curtin.edu.au" target="_blank">franz.kirsten@curtin.edu.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I am currently looking at the fits-idi files as they are spit out by DiFX -- and noticed a difference in the structure of the visibility array compared to that produced by SFXC**. I'd mostly like to know how those visibilities are structured/ordered in the 'FLUX' field of the UV_DATA table.<br>
<br>
Just so you know what I look at (in python):<br>
import astropy.io.fits as fits<br>
hdulist=fits.open('./difx-file<wbr>.idifits')<br>
vis=hdulist['UV_DATA'].data['F<wbr>LUX']<br>
vis.shape<br>
> (n_times * n_baselines, some_number)<br>
<br>
Now, in my case, some_number = 4096. I have 8 IFs, 128 channels/IF and 2 polarisations. Assuming I have a pair of numbers (amp + phase, or real+imaginary?) for each visibility, 8 * 128 * 2 * 2 = 4096. But how are the data ordered? Are the, say, first 256 entries amp+phase for IF1, chan1-chan128, pol 1? In this logic the next 256 entries would be that of IF1, chan1-128, pol2. And then I'd jump to IF2 and repeat. Is this correct?<br>
<br>
Many thanks for your help!<br>
<br>
Regards,<br>
Franz<br>
<br>
**In fits-idi files that come out of SFXC:<br>
vis.shape = (n_times * n_baselines, 1, 1, n_IF, n_chan, n_pol, 3), where the three entries in the last index are amp, phase, weight.<br>
<br>
______________________________<wbr>_________________<br>
Difx-users mailing list<br>
<a href="mailto:Difx-users@listmgr.nrao.edu" target="_blank">Difx-users@listmgr.nrao.edu</a><br>
<a href="https://listmgr.nrao.edu/mailman/listinfo/difx-users" rel="noreferrer" target="_blank">https://listmgr.nrao.edu/mailm<wbr>an/listinfo/difx-users</a><br>
</blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
Difx-users mailing list<br>
<a href="mailto:Difx-users@listmgr.nrao.edu" target="_blank">Difx-users@listmgr.nrao.edu</a><br>
<a href="https://listmgr.nrao.edu/mailman/listinfo/difx-users" rel="noreferrer" target="_blank">https://listmgr.nrao.edu/mailm<wbr>an/listinfo/difx-users</a><br>
<br></blockquote></div><br><br clear="all"><br></div></div><span class="HOEnZb"><font color="#888888">-- <br><div class="m_5354878180662607916gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr" style="font-size:12.8000001907349px"><div dir="ltr" style="font-size:12.8px"><div dir="ltr" style="font-size:12.8px"><div dir="ltr" style="font-size:12.8px"><div dir="ltr" style="font-size:12.8px">!=============================<wbr>==============================<wbr>==!<br>Dr. Adam Deller         </div><div dir="ltr" style="font-size:12.8px">ARC Future Fellow, Senior Lecturer</div><div style="font-size:12.8px">Centre for Astrophysics & Supercomputing </div><div dir="ltr" style="font-size:12.8px">Swinburne University of Technology    <br>John St, Hawthorn VIC 3122 Australia</div><div style="font-size:12.8px">phone: <a href="tel:%2B61%203%209214%205307" value="+61392145307" target="_blank">+61 3 9214 5307</a></div><div style="font-size:12.8px">fax: <a href="tel:%2B61%203%209214%208797" value="+61392148797" target="_blank">+61 3 9214 8797</a><br>!=============================<wbr>==============================<wbr>==!</div></div></div></div></div></div></div></div></div></div></div></div></div>
</font></span></div>
</blockquote></div><br></div>