pyuvdata icon indicating copy to clipboard operation
pyuvdata copied to clipboard

UVFlag clearing unused attributes is wonky

Open mkolopanis opened this issue 4 years ago • 1 comments

UVFlag currently implements a clear_unused_attributes function to try to get rid of old attributes that no long make sense when changing forms (e.g. going to waterfall, or antenna mode). Some issue with this function have been brought up in #948. I will summarize briefly here:

  • Slowly bloating case statement is really highlighting the limitations we have imposed on ourselves with this function. Needs to be rethought.
  • Possible solution A: During changes, just remove the attributes that don't make sense anymore. This would basically hard code it into each of the to_??? functions explicitly.
  • Possible solution B: Mirror the pyuvdata style of different file objects to handle the to_??? transitions. The subclass would then re-initialize a UVFlag object and retain all the optional keywords while removing the ones that don't make sense anymore.

Both of my ideas are very similar, B might be more work than it is worth, but we have to do something.

Considering how much it is used in INS, maybe @mwilensky768 has other ideas how we can clean this up.

mkolopanis avatar Dec 07 '20 18:12 mkolopanis

We decided today option A is probably the most straight forward and easiest

mkolopanis avatar Dec 09 '20 17:12 mkolopanis