AstroChem / vis_sample

Other
13 stars 7 forks source link

Compatibility with GILDAS/NOEMA format #35

Open SmirnGreg opened 3 years ago

SmirnGreg commented 3 years ago

Hello @ryanaloomis,

I am trying to use VISIBLE with NOEMA data. We are using GILDAS for data reduction. GILDAS can convert its own uv tables uvt format in multiple styles, including "CASA"-compatible uvfits (I am not sure it actually is...). When I am trying to supply them to VISIBLE.matched_filter, vis_sample crashes in the following places:

  1. https://github.com/AstroChem/vis_sample/blob/148fc1e5e2e92b167693ef96c4b3662533bced21/vis_sample/file_handling.py#L17-L35 Here, if npol == 1, line 22 squeezes the data_VV_raw array to an array of rank 3, not 4. Thus in lines 33-35, the second last index should be removed, right?
  2. Then, https://github.com/AstroChem/vis_sample/blob/148fc1e5e2e92b167693ef96c4b3662533bced21/vis_sample/file_handling.py#L39, refers to dat[1].data['ch width']. In the format I have, this is not available. Here are the columns I have in this array:
    00 = {tuple: 2} ('ANNAME', '|S8')
    01 = {tuple: 3} ('STABXYZ', '>f8', (3,))
    02 = {tuple: 3} ('ORBPARM', '>f8', (0,))
    03 = {tuple: 2} ('NOSTA', '>i4')
    04 = {tuple: 2} ('MNTSTA', '>i4')
    05 = {tuple: 2} ('STAXOF', '>f4')
    06 = {tuple: 2} ('POLTYA', '|S1')
    07 = {tuple: 2} ('POLAA', '>f4')
    08 = {tuple: 3} ('POLCALA', '>f4', (2,))
    09 = {tuple: 2} ('POLTYB', '|S1')
    10 = {tuple: 2} ('POLAB', '>f4')
    11 = {tuple: 3} ('POLCALB', '>f4', (2,))
    12 = {tuple: 2} ('DIAMETER', '>f4')

    Why would not you reuse delt_freq defined above? Overall, this looks strange to me -- freq_start = dhd['CRVAL4'] refers to a value of a mid_chan_freq = dhd['CRPIX4'] channel. Thus the frequencies in Hz should be something like

    freqs = (np.arange(dhd['NAXIS4']) + 1 - dhd['CRPIX4']) * dhd['CDELT4'] + dhd['CRVAL4']

But even when I change this, I get other shape mismatch errors later. Could you please help me debug this? I don't exactly see where can I find the expected shapes of the input arrays.

I understand that NOEMA may not be a priority for you, but it is now getting a huge upgrade, especially viable for astrochemistry purposes.

Hoping for a reply, Greg Smirnov-Pinchukov

========================== Max Planck Institute for Astronomy PhD student @ Planet and Star Formation

j6626 commented 2 years ago

Hi @SmirnGreg,

I happen to be working on using vis_sample with NOEMA data right now. I'm not particularly familiar with uvfits files, but the way I'm handling things is converting the uvfits files to measurement sets in CASA. Then I insert the REST_FREQ value into the SOURCE table in the measurement set, since GILDAS records the value as 0. If you want to talk more about this, feel free to shoot me an email at jnhuang AT umich DOT edu