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

Using flag-ms.py without a BITFLAG column (spoiler: it isn't possible [yet!]) #82

Open
IanHeywood opened this issue Feb 25, 2021 · 8 comments

Comments

@IanHeywood
Copy link

I want to do a very simple flagging operation on a MS, namely flagging a single timeslot. Here's what I'm trying:

flag-ms.py --flag --fill-legacy --timeslots=893  ../1612141271_sdp_l0_1024ch_scan10.ms

This produces this message:

flag-ms.py: MS does not contain a BITFLAG column. Please run the addbitflagcol utility on this MS.
Perhaps you forgot the -c/--create option?

Is there a way to use flag-ms.py for simple stuff like this without having to add a BITFLAG column?

Thanks.

@IanHeywood
Copy link
Author

IanHeywood commented Feb 25, 2021

Note for people running this on computers they don't own: the addbitflagcol utility is available in the Stimela MeqTrees container.

I tried adding the BITFLAG column with flag-ms.py directly, which this issue suggests is possible:

flag-ms.py --create --init-bitflags 0 ../1612141271_sdp_l0_1024ch_scan10.ms
===> No actions were performed. Showing the result of your selection:
===>   MS size:                1869920 rows
===>   Data/time selection:    1869920 rows, 7659192320 visibilities (100% of MS rows)

but that didn't do anything.

@o-smirnov
Copy link
Contributor

Try 16 or 32 instead of 0?

@IanHeywood
Copy link
Author

That's worked (although I went for 0 because it's the default), but --flag is expecting a flagset:

flag-ms.py --flag FLAG --fill-legacy --timeslots=893  ../1612141271_sdp_l0_1024ch_scan10.ms
flag-ms.py: Flagset 'FLAG' not found

which worries me that I'm dangerously close to accidentally using bitflags again.

@o-smirnov
Copy link
Contributor

which worries me that I'm dangerously close to accidentally using bitflags again.

Too late, if you're initializing a BITFLAG column, then you are already using bitflags quite purposefully. Now just add -c and your journey is complete. :) The regular FLAG column (aka legacy flags) should be populated by default anyway.

@IanHeywood
Copy link
Author

You might have to hold my hand here.

flag-ms.py -c --flag FLAG --fill-legacy --timeslots=893  ../1612141271_sdp_l0_1024ch_MTP0013_scan10.ms
flag-ms.py: Flagset '--timeslots=893' not found

@o-smirnov
Copy link
Contributor

--fill-legacy expects a flagmask and treats the next argument as such. But if you omit --fill-legacy, it will do the right thing by default.

@IanHeywood
Copy link
Author

Bingo. Thanks.

flag-ms.py -c --flag FLAG --timeslots=893  ../1612141271_sdp_l0_1024ch_MTP0013_scan10.ms
  ===> select timeslots slice(893, 894, None) (reltime 1785.24~1785.24 s)
===> flagging with flagmask 0x0001
===> filling legacy flags with flagmask 0xFFFF
===> Flagging stats:
===>   MS size:                1869920 rows
===>   Data/time selection:       2080 rows,    8519680 visibilities (0.111% of MS rows)
===>     (over which legacy flags were filled using flagmask 0xFFFF)
===>     (which were flagged using flagmask 0x0001)

@IanHeywood IanHeywood changed the title Using flag-ms.py without a BITFLAG column Using flag-ms.py without a BITFLAG column (spoiler: it isn't possible) Feb 25, 2021
@o-smirnov
Copy link
Contributor

Let's keep this open. You have a workaround, but it would be nice to do this directly on legacy flags without having to insert bitflags.

@o-smirnov o-smirnov reopened this Feb 25, 2021
@IanHeywood IanHeywood changed the title Using flag-ms.py without a BITFLAG column (spoiler: it isn't possible) Using flag-ms.py without a BITFLAG column (spoiler: it isn't possible [yet!]) Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants