RadioAstronomySoftwareGroup / RadioAstronomySoftwareGroup/pyuvdata

UVFlag clearing unused attributes is wonky

Open
#960 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

uvflag
Dominant language
Python
Stars
102
Forks
35
Avg merge
1d 20h
Merged PRs (30d)
14

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with UVFlag.clear_unused_attributes and the to_??? transition functions that change to waterfall or antenna mode. Compare the proposed explicit-removal and subclass approaches, then define the cleanup behavior so transitions remove attributes that no longer apply without an ever-growing case statement.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.