-
Notifications
You must be signed in to change notification settings - Fork 101
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
Manipulating flags is a pain in the neck #1073
Comments
One suggestion for easier access: augment the indexing operator on TOAs objects so that toas['fish', toas['mjd']>58000] = 'carp' or some_toas = toas[toas['fish']=='carp'] |
One suggestion for data validation: create a FlagsDict class that only accepts valid keys and values, and store that in the astropy table instead of the current plain dicts. |
I really like the idea of moving the flag setting/getting loops into the indexing operation. It is still looping (and I don't really see a good way around that given the way tables work), but at least it is nice syntactic sugar. |
Now in #1074; open for comments. But you can do We could make all flags into columns in the table. This would allow very uniform handling with some caveats:
|
Just to confuse the issue, if you ever did a |
I'm way behind on reading discussion for this and the other related issues and PRs, but I've seen questions/comments about not keeping columns up to date. I don't think there is any desire for that at all. One of the reasons why we liked using Astropy tables is that we could do temporary calculations and save them in the table in memory -- with no intention of ever writing them out. To me it seems like it should be to the user to keep the tables updated if they are changing things on purpose. |
My concern is when PINT has the same information stored in two places, and users start changing things, how do we keep those two copies of the information in sync? My answer to that is, if at all possible, don't duplicate information like that. If duplication is necessary, use python's magic properties and the like to prevent changes; failing that, to keep the versions in sync. If you're going to quietly cache something you need to solve the cache invalidation problem. Currently we have a situation where users occasionally need to run Can we please not add to this problem? Specific to this issue, if we're going to make flags into columns, we must replace the flag dictionaries, not duplicate their values. |
When users need to work with the flags on TOAs objects, they generally need to write for loops for even basic operations (set all or some to TOAs to have a particular value, for example). #1070 has some discussion that demonstrates this. Some specific headaches:
-fish
) but in the flags dictionary without them (d['fish']
) and users are not warned if they make errors in this; maskParameters actually do need the dashThe text was updated successfully, but these errors were encountered: