Skip to content

Commit

Permalink
Flipped interesting and uninteresting colors
Browse files Browse the repository at this point in the history
  • Loading branch information
WarmCyan committed Aug 22, 2023
1 parent 43d9e9d commit 31c1bd6
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 28 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Offline mode arg to ``icat.initialize()``.
* Sample size configuration through model constructor and text field in sample tab.

### Changed
* Interesting and uninteresting colors to orange and blue respectively (swapped to better indicate
'warm' as interesting and 'cold' as uninteresting.)

### Fixed
* Instance viewer missing search highlight.

Expand Down
4 changes: 2 additions & 2 deletions icat/anchorlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ def _template(self):
</template>
<template v-slot:item.pct_negative="{ item }">
<div class='orange--text darken-1'>{{ item.pct_negative }}</div>
<div class='blue--text darken-1'>{{ item.pct_negative }}</div>
</template>
<template v-slot:item.pct_positive="{ item }">
<div class='blue--text darken-1'>{{ item.pct_positive }}</div>
<div class='orange--text darken-1'>{{ item.pct_positive }}</div>
</template>
<template v-slot:item.delete="{ item }">
Expand Down
12 changes: 6 additions & 6 deletions icat/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ def __init__(
self.label_all_i_btn = v.Btn(
children=["All interesting"],
small=True,
class_="blue darken-1",
class_="orange darken-1",
style_="margin-left: 2px; margin-right: 2px;",
)
self.label_all_u_btn = v.Btn(
children=["All uninteresting"],
small=True,
class_="orange darken-1",
class_="blue darken-1",
style_="margin-left: 2px; margin-right: 2px;",
)
self.label_all_i_btn.on_event("click", self._handle_ipv_label_all_i_btn_click)
Expand Down Expand Up @@ -504,9 +504,9 @@ def _set_page_contents(self, options):
# set the color of the text based on the prediction
if self.prediction_col in row.keys():
if row[self.prediction_col] > 0.5:
color = "blue"
else:
color = "orange"
else:
color = "blue"
text = f"<span class='{color}--text darken-1'>{text}</span>"
else:
text = f"<span>{text}</span>"
Expand All @@ -517,9 +517,9 @@ def _set_page_contents(self, options):
labeled = ""
else:
if row[self.label_col] == 1:
labeled = "blue"
elif row[self.label_col] == 0:
labeled = "orange"
elif row[self.label_col] == 0:
labeled = "blue"
labeled = f"<span class='{labeled}--text darken-1'>Labeled</span>"

rows.append(
Expand Down
4 changes: 2 additions & 2 deletions icat/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def get_vega_graph(self):
),
color=alt.condition(
"datum.bin >= 0.5",
if_true={"value": "#2196F3"},
if_false={"value": "#FB8C00"},
if_false={"value": "#2196F3"},
if_true={"value": "#FB8C00"},
),
)
.configure(background="transparent")
Expand Down
14 changes: 8 additions & 6 deletions icat/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ def __init__(

self.contents = HtmlContents(content="<p>No instance selected.</p>")
self.interesting_button = v.Btn(
style_="padding: 5px; margin: 5px;", color="blue", children=["Interesting"]
style_="padding: 5px; margin: 5px;",
color="orange",
children=["Interesting"],
)
self.interesting_button.on_event(
"click", self._handle_ipv_interesting_btn_clicked
)
self.uninteresting_button = v.Btn(
style_="padding: 5px; margin: 5px;",
color="orange",
color="blue",
children=["Uninteresting"],
)
self.uninteresting_button.on_event(
Expand Down Expand Up @@ -174,18 +176,18 @@ def populate(self, index: int):
f"Prediction: {row[self.data.prediction_col]}"
]
if row[self.data.prediction_col] > 0.5:
color = "blue"
else:
color = "orange"
else:
color = "blue"
self.current_prediction.class_ = f"{color}--text darken-1"

# set the "labeled" label and color if applicable
if self.data.label_col in row and row[self.data.label_col] != -1:
self.current_label.children = ["Labeled"]
if row[self.data.label_col] >= 0.5:
color = "blue"
else:
color = "orange"
else:
color = "blue"
self.current_label.class_ = f"{color}--text darken-1"
else:
self.current_label.children = ["Not labeled"]
Expand Down
22 changes: 14 additions & 8 deletions icat/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,44 +140,50 @@ def _template(self):
<td style="vertical-align: top; padding-bottom: 5px; padding-left: 2px;">
<v-tooltip bottom open-delay=500>
<template v-slot:activator="{ on, attrs }">
<v-btn x-small class="orange darken-1" @click.stop="applyAbsoluteLabelUninteresting(item.id)" v-bind="attrs" v-on="on">
<v-btn x-small class="blue darken-1" @click.stop="applyAbsoluteLabelUninteresting(item.id)" v-bind="attrs" v-on="on">
U
</v-btn>
</template>
<span>Label this instance as <span class="orange--text lighten-4"><b>uninteresting</b></span> (cold).</span>
<span>Label this item as <span class="blue--text lighten-4"><b>uninteresting</b></span> (cold).</span>
</v-tooltip>
<v-tooltip bottom open-delay=500>
<template v-slot:activator="{ on, attrs }">
<v-btn x-small class="blue darken-1" @click.stop="applyAbsoluteLabelInteresting(item.id)" v-bind="attrs" v-on="on">
<v-btn x-small class="orange darken-1" @click.stop="applyAbsoluteLabelInteresting(item.id)" v-bind="attrs" v-on="on">
I
</v-btn>
</template>
<span>Label this instance as <span class="blue--text lighten-5"><b>interesting</b></span> (warm).</span>
<span>Label this item as <span class="orange--text lighten-5"><b>interesting</b></span> (warm).</span>
</v-tooltip>
<v-tooltip bottom open-delay=500>
<template v-slot:activator="{ on, attrs }">
<v-btn x-small class="purple darken-1" @click.stop="addToExampleAnchor(item.id)" v-bind="attrs" v-on="on">
example
</v-btn>
</template>
<span>Create a similarity anchor with this instance as the target.</span>
<span>Create a similarity anchor with this item as the target.</span>
</v-tooltip>
<v-tooltip bottom open-delay=500>
<template v-slot:activator="{ on, attrs }">
<v-btn x-small v-if="!item.in_sample" @click.stop="addToSample(item.id)" v-bind="attrs" v-on="on">
sample
</v-btn>
</template>
<span>Add this instance to the current sample set.</span>
<span>Add this item to the current sample set.</span>
</v-tooltip>
<v-tooltip bottom open-delay=500>
<template v-slot:activator="{ on, attrs }">
<div v-html="item.labeled" v-bind="attrs" v-on="on" />
</template>
<span v-if="item.labeled.indexOf('orange') > -1"><span class="orange--text lighten-5"><b>interesting</b></span> (warm).</span>
<span v-if="item.labeled.indexOf('blue') > -1"><span class="blue--text lighten-4"><b>uninteresting</b></span> (cold).</span>
</v-tooltip>
<div v-html="item.labeled" />
<v-tooltip bottom open-delay=500 v-if="item.labeled != ''">
<template v-slot:activator="{ on, attrs }">
<v-btn x-small class="red darken-4" @click.stop="applyAbsoluteLabelUnlabeled(item.id)" v-bind="attrs" v-on="on">
unlabel
</v-btn>
</template>
<span>Remove the label from this instance.</span>
<span>Remove the label from this item.</span>
</v-tooltip>
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions icat/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class InteractiveView(pn.viewable.Viewer):
# here since view is already loosely orchestrating all of the gui stuff. If anything,
# _more_ of the model event handlers should be handled in here instead of in the model?
def __init__(self, model, **params):
self.interesting_color = "#2196F3" # blue
self.uninteresting_color = "#FB8C00" # orange darken-1
self.uninteresting_color = "#2196F3" # blue
self.interesting_color = "#FB8C00" # orange darken-1

self.model = model

Expand Down
4 changes: 2 additions & 2 deletions tests/test_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def catch_label(index, new_label):
assert returns[0] == 5
assert returns[1] == 1
assert model.data.instance_viewer.current_label.children == ["Labeled"]
assert model.data.instance_viewer.current_label.class_ == "blue--text darken-1"
assert model.data.instance_viewer.current_label.class_ == "orange--text darken-1"


@pytest.mark.integration
Expand All @@ -69,4 +69,4 @@ def catch_label(index, new_label):
assert returns[0] == 5
assert returns[1] == 0
assert model.data.instance_viewer.current_label.children == ["Labeled"]
assert model.data.instance_viewer.current_label.class_ == "orange--text darken-1"
assert model.data.instance_viewer.current_label.class_ == "blue--text darken-1"

0 comments on commit 31c1bd6

Please sign in to comment.