Skip to content

Commit 28193e3

Browse files
fix(bokeh): address review feedback for stereonet-equal-area
Attempt 2/3 - fixes based on AI review
1 parent c7fba2e commit 28193e3

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

  • plots/stereonet-equal-area/implementations

plots/stereonet-equal-area/implementations/bokeh.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
""" pyplots.ai
1+
"""pyplots.ai
22
stereonet-equal-area: Structural Geology Stereonet (Equal-Area Projection)
33
Library: bokeh 3.9.0 | Python 3.14.3
4-
Quality: 84/100 | Created: 2026-03-15
4+
Created: 2026-03-15
55
"""
66

77
import numpy as np
@@ -99,19 +99,15 @@
9999
d_max = np.nanmax(density_masked[mask])
100100
d_norm = (density_masked - d_min) / (d_max - d_min)
101101

102-
# Build uint32 RGBA array for Bokeh image_rgba
102+
# Build uint32 RGBA array for Bokeh image_rgba (vectorized)
103103
img = np.zeros((grid_n, grid_n), dtype=np.uint32)
104104
view = img.view(dtype=np.uint8).reshape((grid_n, grid_n, 4))
105-
for iy in range(grid_n):
106-
for ix in range(grid_n):
107-
if mask[iy, ix] and d_norm[iy, ix] > 0.12:
108-
v = d_norm[iy, ix]
109-
gray = int(170 - v * 110)
110-
alpha_val = int(v * 150)
111-
view[iy, ix, 0] = gray
112-
view[iy, ix, 1] = gray
113-
view[iy, ix, 2] = min(gray + 15, 255)
114-
view[iy, ix, 3] = alpha_val
105+
visible = mask & (d_norm > 0.08)
106+
v = np.where(visible, d_norm, 0.0)
107+
view[visible, 0] = (220 - v[visible] * 100).astype(np.uint8) # R: warm orange-red
108+
view[visible, 1] = (160 - v[visible] * 130).astype(np.uint8) # G: decreasing for warmth
109+
view[visible, 2] = (80 - v[visible] * 60).astype(np.uint8) # B: low for warm tones
110+
view[visible, 3] = (v[visible] * 220).astype(np.uint8) # A: stronger alpha
115111

116112
# Plot - Square format for circular stereonet
117113
p = figure(
@@ -181,7 +177,7 @@
181177
x=lx,
182178
y=ly,
183179
text=f"{deg}°",
184-
text_font_size="18pt",
180+
text_font_size="20pt",
185181
text_align="center",
186182
text_baseline="middle",
187183
text_color="#555555",
@@ -213,7 +209,7 @@
213209
idxs = [j for j, t in enumerate(gc_types) if t == ftype]
214210
fxs = [gc_xs[j] for j in idxs]
215211
fys = [gc_ys[j] for j in idxs]
216-
r = p.multi_line(fxs, fys, line_color=colors_map[ftype], line_width=2.5, line_alpha=0.4)
212+
r = p.multi_line(fxs, fys, line_color=colors_map[ftype], line_width=1.5, line_alpha=0.25)
217213
renderers_gc[ftype] = r
218214

219215
# Poles by feature type with HoverTool

0 commit comments

Comments
 (0)