ska-sa / katdal

Data access library for the MeerKAT radio telescope
BSD 3-Clause "New" or "Revised" License
12 stars 13 forks source link

SPR1-2912: Select multiple targets with the same name #369

Closed ludwigschwardt closed 1 year ago

ludwigschwardt commented 1 year ago

A katpoint.Catalogue can have multiple different targets with the same name, usually differing in tags only. The DataSet selection mechanism [d.select(targets="name")] still used a dict-style lookup for target names though, which is constrained to return a single target: the last target with the given name.

This would normally not be a big issue as there are other ways to select targets. It became a problem after #269 (released in katdal 0.18 in April 2021) which added field selection to mvftoms.py. This now always selects targets by name, even if the user wants all the targets and the selection is therefore unnecessary. This caused folks to lose e.g. a flux or bpcal calibrator in the MS conversion if they used the same target as a gain calibrator later on in the observation.

Fix this by ensuring all targets with a given name are picked up in the selection.

spassmoor commented 1 year ago

How is this going @ludwigschwardt ? Should we start testing this ?

ludwigschwardt commented 1 year ago

Yes, I'm waiting for someone to tell me that it works :-)

spassmoor commented 1 year ago

I have got a test block https://archive.sarao.ac.za/scheduleblock/20231025-0009/

ludwigschwardt commented 1 year ago

Wow, excellent!

ludwigschwardt commented 1 year ago

Great, that’s a good start. The bug mostly affects mvftoms, so it would be good to test that...

spassmoor commented 1 year ago

I have successfully run a mvftoms.py on a file and it works .

spassmoor commented 1 year ago

I think we can merge this @ludwigschwardt