|
1 | | -""" pyplots.ai |
| 1 | +"""pyplots.ai |
2 | 2 | stereonet-equal-area: Structural Geology Stereonet (Equal-Area Projection) |
3 | 3 | Library: bokeh 3.9.0 | Python 3.14.3 |
4 | | -Quality: 84/100 | Created: 2026-03-15 |
| 4 | +Created: 2026-03-15 |
5 | 5 | """ |
6 | 6 |
|
7 | 7 | import numpy as np |
|
99 | 99 | d_max = np.nanmax(density_masked[mask]) |
100 | 100 | d_norm = (density_masked - d_min) / (d_max - d_min) |
101 | 101 |
|
102 | | -# Build uint32 RGBA array for Bokeh image_rgba |
| 102 | +# Build uint32 RGBA array for Bokeh image_rgba (vectorized) |
103 | 103 | img = np.zeros((grid_n, grid_n), dtype=np.uint32) |
104 | 104 | 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 |
115 | 111 |
|
116 | 112 | # Plot - Square format for circular stereonet |
117 | 113 | p = figure( |
|
181 | 177 | x=lx, |
182 | 178 | y=ly, |
183 | 179 | text=f"{deg}°", |
184 | | - text_font_size="18pt", |
| 180 | + text_font_size="20pt", |
185 | 181 | text_align="center", |
186 | 182 | text_baseline="middle", |
187 | 183 | text_color="#555555", |
|
213 | 209 | idxs = [j for j, t in enumerate(gc_types) if t == ftype] |
214 | 210 | fxs = [gc_xs[j] for j in idxs] |
215 | 211 | 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) |
217 | 213 | renderers_gc[ftype] = r |
218 | 214 |
|
219 | 215 | # Poles by feature type with HoverTool |
|
0 commit comments