The 'filter_on_obs_ids' method of BaseMission can't handle a numpy array of ObsIDs #397
Labels
bug
Something isn't working
refinement
If a feature has already been implemented, and works, but could do with another pass to improve it.
Seems like something we should support - also doesn't throw a particularly useful error:
AttributeError Traceback (most recent call last)
Cell In[9], line 6
3 rand_ois = xm.all_obs_info[xm.all_obs_info['proprietary_usable']].sample(30, random_state=907)["ObsID"].values
5 # xm.filter_on_obs_ids(list(rand_ois))
----> 6 xm.filter_on_obs_ids(rand_ois)
9 xm.filtered_obs_info
File ~/code/DAXA/daxa/mission/base.py:63, in _lock_check..wrapper(*args, **kwargs)
58 @wraps(change_func)
59 def wrapper(*args, **kwargs):
60 # The first argument will be 'self' for any class method, so we check its 'locked' property
61 if not args[0].locked:
62 # If not locked then we can execute that method without any worries
---> 63 any_ret = change_func(*args, **kwargs)
64 else:
65 # If the mission is locked then we have to throw an error
66 raise MissionLockedError("This mission instance has been locked, and is now immutable.")
File ~/code/DAXA/daxa/mission/base.py:98, in _capture_filter..wrapper(*args, **kwargs)
93 # In this case, _no_filtering_op_store is True, which is NOT the default value, and we know then that this
94 # decorator has been triggered by a filtering operation called within another filtering operation, and we
95 # just want to run the filter without saving the information
96 if _no_filtering_op_store:
97 # First off we run the filtering method, so we don't save a filtering method that failed
---> 98 any_ret = change_func(*args, **kwargs)
100 # However in this case, we know that this is the outermost filtering operation, so we're going to do more than
101 # just run the filtering method
102 else:
103 # First of all, we set the global flag to True, so if the filtering method we're about to call has calls
104 # to other filtering methods (and thus this decorator is triggered again), then the filter operation is
105 # not saved
106 _no_filtering_op_store = True
File ~/code/DAXA/daxa/mission/base.py:1193, in BaseMission.filter_on_obs_ids(self, allowed_obs_ids)
1189 allowed_obs_ids = [allowed_obs_ids]
1191 # Just upper-cases everything, as that is what DAXA expects in cases where there are non-numerical characters
1192 # in the ObsIDs
-> 1193 allowed_obs_ids = [oid.upper() for oid in allowed_obs_ids]
1195 # Runs the ObsID pattern checks for all the passed ObsIDs
1196 oid_check = [oid for oid in allowed_obs_ids if not self.check_obsid_pattern(oid)]
AttributeError: 'numpy.ndarray' object has no attribute 'upper'
The text was updated successfully, but these errors were encountered: