Skip to content

Commit

Permalink
fixes from Jesse's review
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorris3 committed Apr 16, 2024
1 parent c2cd379 commit 2027888
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
21 changes: 13 additions & 8 deletions jdaviz/configs/default/plugins/data_quality/data_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def update_opacity(self, event={}):
dq_layer.state.alpha = self.dq_layer_opacity * science_layer.state.alpha

@observe('decoded_flags', 'flags_filter')
def update_cmap(self, event={}):
def _update_cmap(self, event={}):
dq_layer = self.get_dq_layer()
flag_bits = np.array([flag['flag'] for flag in self.decoded_flags])
rgb_colors = [hex2color(flag['color']) for flag in self.decoded_flags]
Expand All @@ -184,7 +184,10 @@ def update_cmap(self, event={}):
# hide the flag if `flags_filter` has entries but not this one:
(
len(self.flags_filter) and
not np.isin(list(flag['decomposed'].keys()), list(self.flags_filter)).any()
not np.isin(
list(map(int, flag['decomposed'].keys())),
list(self.flags_filter)
).any()
)
])

Expand Down Expand Up @@ -213,16 +216,18 @@ def update_cmap(self, event={}):

def update_visibility(self, index):
self.decoded_flags[index]['show'] = not self.decoded_flags[index]['show']
self.vue_update_cmap()

def vue_update_cmap(self):
self.send_state('decoded_flags')
self.update_cmap()
self._update_cmap()

def vue_update_visibility(self, index):
self.update_visibility(index)

def update_color(self, index, color):
self.decoded_flags[index]['color'] = color
self.send_state('decoded_flags')
self.update_cmap()
self.vue_update_cmap()

def vue_update_color(self, args):
index, color = args
Expand All @@ -247,18 +252,18 @@ def vue_hide_all_flags(self, event):
for flag in self.decoded_flags:
flag['show'] = False

self.send_state('decoded_flags')
self.update_cmap()
self.vue_update_cmap()

def vue_clear_flags_filter(self, event):
self.flags_filter = []
self.vue_update_cmap()

def vue_show_all_flags(self, event):
for flag in self.decoded_flags:
flag['show'] = True

self.send_state('decoded_flags')
self.flags_filter = []
self.vue_update_cmap()

@property
def user_api(self):
Expand Down
2 changes: 0 additions & 2 deletions jdaviz/configs/default/plugins/data_quality/data_quality.vue
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@
// if any of the decomposed bits are in `flags_filter`, return true:
return Object.keys(decomposed).filter(value => flags_filter.includes(parseInt(value))).length !== 0;
}
return true
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions jdaviz/configs/default/plugins/data_quality/dq_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def __call__(self, values, out=None, clip=False):
if len(self.hidden_flags):
# mask that is True for `values` in the hidden flags list:
value_is_hidden = np.isin(
np.nan_to_num(values_integer, nan=-10),
self.hidden_flags
np.nan_to_num(values_integer, nan=-10).astype(int),
self.hidden_flags.astype(int)
)
else:
value_is_hidden = False
Expand Down

0 comments on commit 2027888

Please sign in to comment.