-
Notifications
You must be signed in to change notification settings - Fork 0
Description
In the Alert class, properties like dict, dataframe, and skymap are mutable but they are not kept in sync if they are altered. This is potentially confusing. We haven't yet run into use cases where this has caused problems but there's nothing stopping folks from altering 2 or 3 of those and then being confused. At a minimum, we should provide some type of warning about what will/won't happen in this case.
For reference:
Alert.dictis constructed fromAlert.msg.data(which is immutable) the first time it is accessed, then can be mutated.- Methods like
Alert.get()andTopic.publish()always get the data fromAlert.dict. Alert.dataframeandAlert.skymapare constructed fromAlert.dictthe first time they are accessed, then can be mutated. Mutations to these properties will not propagate toAlert.dict.
It would be nice to propagate changes but implementing that would require a little more thought and then non-trivial work. I made an attempt at this awhile back and tried to use numpy arrays as the fundamental data structure and then have the three relevant properties get their data from there. It turned out to be more work than I had time for at the moment and I abandoned it. I'm not sure that was the best strategy anyway.