Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPW selection (or relaxation of assumptions) required #77

Open
IanHeywood opened this issue Dec 18, 2020 · 15 comments
Open

SPW selection (or relaxation of assumptions) required #77

IanHeywood opened this issue Dec 18, 2020 · 15 comments

Comments

@IanHeywood
Copy link
Collaborator

Trying to use Tricolour to flag a VLA P-band observation. The original MS has 16 SPWs. I've split the SPWs out into their own MS to process (and probably image) them independently. This preserves the SPECTRAL_WINDOW subtable, so that has 16 rows but the main table only now references one of them. Tricolour crashes when processing anything other than SPW0:

tricolour - 2020-12-18 20:51:20,039 INFO - Flagging based on quadrature polarized power
tricolour - 2020-12-18 20:51:22,305 INFO - Only considering scans '2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24' as per user selection criterion
tricolour - 2020-12-18 20:51:22,306 INFO - Adding field 'SGRA' scan 2 to compute graph for processing
Unexpected error. Dropping you into pdb for a post-mortem.
Traceback (most recent call last):
  File "/usr/local/bin/tricolour", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/tricolour/apps/tricolour/app.py", line 258, in main
    _main(args)
  File "/usr/local/lib/python3.6/dist-packages/tricolour/apps/tricolour/app.py", line 370, in _main
    ddid = ddid_ds[ds.attrs['DATA_DESC_ID']]
IndexError: list index out of range
> /usr/local/lib/python3.6/dist-packages/tricolour/apps/tricolour/app.py(370)_main()
-> ddid = ddid_ds[ds.attrs['DATA_DESC_ID']]

This is with the version bundled with the stimela 1.5.0 container.

Cheers.

@bennahugo
Copy link
Collaborator

bennahugo commented Dec 19, 2020 via email

@sjperkins
Copy link
Member

-> ddid = ddid_ds[ds.attrs['DATA_DESC_ID']]

Just a note, this is failing a lookup in the DATA_DESCRIPTION subtable using DATA_DESC_ID values in the main table. It would be worth posting the unique DATA_DESC_ID values in the main table, as well as the contents of the DATA_DESCRIPTION table so that we can investigate in more detail post-holiday season.

@o-smirnov
Copy link

That does suggest a malformed MS, doesn't it?..

@bennahugo
Copy link
Collaborator

bennahugo commented Dec 19, 2020 via email

@o-smirnov
Copy link

Well let's confirm it first. @IanHeywood could you please check your DATA_DESCRIPTION and SPECTRAL_WINDOW subtables, how many rows have you got per each, and what are your values in your DATA_DESC_ID column?

@IanHeywood
Copy link
Collaborator Author

IanHeywood commented Dec 21, 2020

All looks reasonable to me...

In [1]: from pyrap.tables import table

In [2]: spwtab = table('15A-310.sb30701840.eb31080533.57264.008705092594_SPW16-31_hanning_spw12.ms/SPECTRAL_WINDOW/')
Successful readonly open of default-locked table 15A-310.sb30701840.eb31080533.57264.008705092594_SPW16-31_hanning_spw12.ms/SPECTRAL_WINDOW/: 17 columns, 16 rows

In [3]: nn = spwtab.getcol("NAME")

In [4]: ff = spwtab.getcol("REF_FREQUENCY")

In [5]: for i in range(0,len(nn)):
   ...:     print i,nn[i],ff[i]
   ...:
0 EVLA_P#A0C0#16 224000000.0
1 EVLA_P#A0C0#17 240000000.0
2 EVLA_P#A0C0#18 256000000.0
3 EVLA_P#A0C0#19 272000000.0
4 EVLA_P#A0C0#20 288000000.0
5 EVLA_P#A0C0#21 304000000.0
6 EVLA_P#A0C0#22 320000000.0
7 EVLA_P#A0C0#23 336000000.0
8 EVLA_P#A0C0#24 352000000.0
9 EVLA_P#A0C0#25 368000000.0
10 EVLA_P#A0C0#26 384000000.0
11 EVLA_P#A0C0#27 400000000.0
12 EVLA_P#A0C0#28 416000000.0
13 EVLA_P#A0C0#29 432000000.0
14 EVLA_P#A0C0#30 448000000.0
15 EVLA_P#A0C0#31 464000000.0

In [6]: ddtab = table('15A-310.sb30701840.eb31080533.57264.008705092594_SPW16-31_hanning_spw12.ms/DATA_DESCRIPTION/')
Successful readonly open of default-locked table 15A-310.sb30701840.eb31080533.57264.008705092594_SPW16-31_hanning_spw12.ms/DATA_DESCRIPTION/: 3 columns, 16 rows

In [7]: ddtab.colnames()
Out[7]: ['FLAG_ROW', 'POLARIZATION_ID', 'SPECTRAL_WINDOW_ID']

In [8]: ddtab.getcol('SPECTRAL_WINDOW_ID')
Out[8]:
array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15],
      dtype=int32)

In [9]: import numpy

In [10]: maintab = table('15A-310.sb30701840.eb31080533.57264.008705092594_SPW16-31_hanning_spw12.ms')
Successful readonly open of default-locked table 15A-310.sb30701840.eb31080533.57264.008705092594_SPW16-31_hanning_spw12.ms: 24 columns, 1777113 rows

In [11]: print(numpy.unique(maintab.getcol("DATA_DESC_ID")))
[12]

I've carried on with the processing using flagdata, so there's no rush. This and all other CASA tasks seem fine with it, I just wanted to try tricolour out. The RFI situation at P-band is pretty horrid.

Thanks.

EDIT: Fixed the pasted part.

@bennahugo
Copy link
Collaborator

bennahugo commented Dec 21, 2020 via email

@IanHeywood
Copy link
Collaborator Author

I thought that's what lines [10] and [11] were above, but please let me know if I'm missing something.

My original paste ended up a bit mangled, so if you read it off the original email it might have been missing...

@bennahugo
Copy link
Collaborator

bennahugo commented Dec 21, 2020 via email

@sjperkins
Copy link
Member

Thanks for the detailed info @IanHeywood. If possible, could you place the MS on a Rhodes server?

@sjperkins
Copy link
Member

sjperkins commented Jan 4, 2021

@IanHeywood were you able to place the MS on the Rhodes server?

@smasoka Could you please do some investigation here to find out why this is breaking? You can message me if you become blocked on this issue.

@IanHeywood
Copy link
Collaborator Author

Not yet. Was going to "officially" return to work today but then I decided that would be a bad move. I'll transfer something this week, sorry for the delay.

@sjperkins
Copy link
Member

Not yet. Was going to "officially" return to work today but then I decided that would be a bad move. I'll transfer something this week, sorry for the delay.

Holidays are good. Can confirm.

@smasoka
Copy link
Contributor

smasoka commented Jan 14, 2021

@IanHeywood can I get the location of the MS on the Rhodes server? Is the MS also at CHPC lustre?

Can I also get you to look at #76 for some feedback?

@IanHeywood
Copy link
Collaborator Author

Yes, sorry, these things are slowly floating to the top of the to-do list.

There is a MS here on nash:

/home/ianh/tricolour_SPW/15A-310.sb30704857.eb31073319.57261.07368590278_spw24.ms

that triggers this bug. Note that this MS is the result of using Owlcat's SPW-splitter, which preserves the original SPW table in the resulting Measurement Sets. Looping over SPWs and splitting them out with CASA's mstransform task produces a SPECTRAL_WINDOW table that just has a single row, corrects the main table accordingly, and avoids the problem.

Thanks.

@smasoka smasoka mentioned this issue Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants