Skip to content
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

The 'filter_on_obs_ids' method of BaseMission can't handle a numpy array of ObsIDs #397

Open
DavidT3 opened this issue Feb 27, 2025 · 0 comments
Assignees
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.

Comments

@DavidT3
Copy link
Owner

DavidT3 commented Feb 27, 2025

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'

@DavidT3 DavidT3 added bug Something isn't working refinement If a feature has already been implemented, and works, but could do with another pass to improve it. labels Feb 27, 2025
@DavidT3 DavidT3 self-assigned this Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

1 participant