Research: where a weighted lattice cell gets its weight (literature, CultMath today, 2D probe)
Eyes pass (2026-10-14) serving cultmath-tapes❓lattice-site-weight-source.
Key measurement: a query-point weight is common to all candidates and never
changes the winner; site and cell-centre weights differ from each other on
11-15% of pixels; no variant pops in space or time while the window holds
the winner; the window must scale with the weight ratio.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9545c80c56
commit
21281a39d6
5 changed files with 941 additions and 0 deletions
82
docs/research/lattice-site-weight.md
Normal file
82
docs/research/lattice-site-weight.md
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# Facts for `cultmath-tapes:question:lattice-site-weight-source`
|
||||
|
||||
Agent eyes-lattice-site-weight, session self-2026-10-14-eureka, 2026-10-14. Facts only, no recommendation.
|
||||
Marks: [src] source code, [doc] repo doc, [web] web page, [abs] absence found, [probe] measured by the scripts beside this file.
|
||||
The eureka-state view of the question id failed (`view` wants a PipelineRef, not the id string); the question text was taken from the brief.
|
||||
|
||||
## 1. What the fauna probe did (Aetheria 4354ef2c, read via `git show`)
|
||||
|
||||
- [src] `docs/research/2026-10-14-trophic-dag-probe/trophic_probe.py` `lattice_web` (lines 95-119): per lattice cell `(cx,cz)` in a (2*WIN+1)^2 window (WIN=2): jittered site `(c+.5)*LAT` plus a drifting offset; weight `wt = (hash*.5+.5) * (1 + BOOST*prox)`, `prox = max over wells of exp(-(|site - well| / (2.2*.103*r))^2)`, BOOST 1.6; `d = hypot(...) * wt`; F1, F2 and a polynomial smooth-min `m` accumulated in loop order; output `max(soft^2, exp(-((f2-f1)/.10)^2))`. Wells orbit with zone time, so the site weight is a function of time.
|
||||
- [src] The weight is read at the site's lattice position `(cx+.5)*LAT`, not at the query point and not at the drifted site.
|
||||
- [doc] `docs/aetheria-fauna-map.md` B34: largest presence step for `lattice` .124 (8 steps over .1); "not discontinuities: a traced member's web value rises .03 per step for 5 steps, a thin weighted border sweeping a fixed candidate"; window 7x7 changes nothing; boost .6 removes the steps (.047); reading the lattice drift at the member's cycle start removes them at full boost (.011, `cyc.log`).
|
||||
- [doc] Map r4 gap (1): "a 2D weighted lattice cellular with the smooth-min blend (her node) on `pcg3d` cells and zone time"; "The search window follows the weight range ... The CultMath node states the weight range it supports" (map lines 438, 444-446).
|
||||
- [doc] Prior art doc `docs/research/2026-10-14-trophic-dag-filaments-prior-art.md` 1.1.7 [M]: power diagram evaluated pointwise by the same neighbour search "only if the search window is widened with the weight range"; marked "Neither derivation checked against a source".
|
||||
|
||||
## 2. Literature and implementations
|
||||
|
||||
- [web] Wikipedia, Weighted Voronoi diagram (https://en.wikipedia.org/wiki/Weighted_Voronoi_diagram): multiplicative = distance divided by positive site weight (circular Dirichlet tessellation, edges circular arcs and line segments); additive = weight subtracted from distance (hyperbolic Dirichlet tessellation, hyperbola arcs and segments); power diagram = weight subtracted from squared distance. A multiplicatively weighted cell may be non-convex, disconnected or hold holes. The page says nothing on continuity.
|
||||
- [web] Sangil Lee, "Understanding the Variations of Cellular Noise" (https://sangillee.com/_posts/2025-04-18-Cellular-noises/): weighted Voronoi as effective distance `(1/w)*|x - seed|` with `w = 0.2 + 0.8 * random3(cell).z`, i.e. the per-site weight is a component of the hash of the lattice cell id, computed inside the noise function; the weighted example loops 5x5 instead of 3x3 (no reason given).
|
||||
- [web] Inigo Quilez, Voronoise (https://iquilezles.org/articles/voronoise/): `hash3(cell id)` yields jitter in `.xy` and a per-cell value in `.z`; 5x5 window; notes `min()` is discontinuous and the smooth blend fixes that. No weighted variant.
|
||||
- [web] Worley noise, Wikipedia and The Book of Shaders (https://thebookofshaders.com/12/): the standard is current cell plus neighbours (3x3), with a wider pass for exact borders; Worley's original used a variable number of points per cell. Nothing found on per-point weight attributes beyond the Lee article; the continuity guidance in the search results was general-knowledge reasoning, not sourced.
|
||||
- [abs] No source found stating a continuity theorem for weighted Worley; no source found for a node that takes its per-site weight from an external field function. The only per-site weight mechanism found in shader writing is the hash of the cell id.
|
||||
- [probe] Continuity as observed (section 4): F1 stays continuous as long as the window contains the true winner; failure occurs when it does not.
|
||||
|
||||
## 3. CultMath today
|
||||
|
||||
- [src] `F:\Projects\CultLib\packages\cultmath\src\CultMath\math.cs:909` `public static CultCellular cellular(float3 p)`: one argument, 3D, unweighted; sites `neighbor + jitter` with jitter from `pcg3d(int3(neighbor))` through `cellular_unit`; fixed 5x5x5 window with a per-offset lower-bound prune (`max(0,|d|-1)`), whose exactness proof (comment above the function) relies on the jitter being in [0,1) and on equal weights; returns `CultCellular { nearest = (grad F1, F1), edge = (grad(F2-F1), F2-F1), id = pcg4d of the winning cell mapped to [0,1) }` (`CultCellular.cs`). Hash is of the integer cell, never the float bits.
|
||||
- [src] `math.cs:831-847` `smin_grad(float4 a, float4 b, float k)`: quadratic smooth-min with analytic gradient (value-and-gradient form).
|
||||
- [src] `Voronoi.cs` (`Voronoi.SampleTones`, native `cultmath_apollonian_voronoi_tones`) is a UI-tone colour sampler over a hash-jittered field with a hard-coded 5x5 loop; takes x, y, tone, span; not a weighted-cell function.
|
||||
- [abs] No function in CultMath takes a weight, a callback, or a site span; no weighted cellular, no per-site hash output exposed besides `id`. (Map B28 states the same.) HLSL twin at `shaders/CultMath.hlsl:440-503`.
|
||||
- [doc] `packages/cultmath/docs/design.md` ~265-340: `cellular` section, search-radius proof and pruned/unpruned test pin.
|
||||
- Fact for composition: `CultCellular.id` is already a per-cell hash scalar available to the caller after the call, but only for the winning cell, after F1/F2 are decided.
|
||||
|
||||
## 4. Probe: where does the weight come from, 2D, 4 orbiting wells
|
||||
|
||||
Scripts: `siteweight_probe.py`, `siteweight_probe2.py`; raw numbers `probe_results.json`, `probe_results2.json`. numpy, scratch; hash is a lowbias32-style integer hash (stand-in for pcg3d). Units: lattice cell = 1; domain [1,7]^2, 500x500 grid (600 for shape rows); wells with radii .6-1.2 cells orbiting a centre; weight `wt = base(.5..1) * (1 + B*prox)`, B = 1.6, WIN = 2, the fauna probe's smooth-min and border output.
|
||||
|
||||
Variants: `base` (no field); `site` (field at the jittered site position: the fauna probe's method); `qpt` (field at the query point, same factor on every candidate); `cellc` (node calls the field at the integer cell centre, `cell + .5`, no jitter); `site_t0` (as `site` but field read at t=0 while wells have moved); `warp` (extra: query scaled `q*(1+B*prox(q))`).
|
||||
|
||||
### 4a. Winner identity, fraction of grid pixels whose winning cell differs (t=0 / t=8)
|
||||
|
||||
| variant | vs `site` | vs `base` |
|
||||
|---|---|---|
|
||||
| base | .147 / .156 | 0 / 0 |
|
||||
| qpt | .147 / .156 | 0 / 0 (identical argmin to base) |
|
||||
| cellc | .127 / .114 | .185 / .147 |
|
||||
| site_t0 | 0 / .226 | .147 / .147 |
|
||||
| warp | .675 / .646 | .668 / .639 |
|
||||
| site | 0 / 0 | .147 / .156 |
|
||||
|
||||
Mean absolute difference of the border output vs `site`: base .169/.186, qpt .168/.180, cellc .164/.156, site_t0 0/.234, warp .310/.280. Number of distinct cells on the grid: 53 for base, site and qpt; 54 cellc; 143/128 warp.
|
||||
|
||||
[probe] `qpt` leaves every winner unchanged because the factor is common to all candidates; it changes F1, F2 and the smooth-min scale, which moves the border line (border pixel fraction near wells .164 vs .300 for base, far .250 vs .281).
|
||||
|
||||
### 4b. Cell size and border near wells (pixels per cell, mean; "near" = within 1 well radius), t=0
|
||||
|
||||
| | near | far | border fraction near / far |
|
||||
|---|---|---|---|
|
||||
| base | 10951 | 10515 | .300 / .281 |
|
||||
| site | 9672 | 11439 | .270 / .253 |
|
||||
| qpt | 10951 | 10515 | .164 / .250 |
|
||||
| cellc | 11562 | 12274 | .274 / .262 |
|
||||
| warp | 3447 | 8566 | .291 / .302 |
|
||||
|
||||
### 4c. Pop measure, dense spatial line (6001 points over 6 cells, step 1e-3 cell), max |step| of F1 and of output, window sweep vs window 6 reference
|
||||
|
||||
- With the true winner inside the window, every variant's max F1 step is small (site .0010-.0033, qpt .0019-.0079, cellc .0009-.0041, warp .0054-.022, base .0007-.0013 per 1e-3).
|
||||
- WIN=1 (3x3): `site` F1 error vs window 6 up to .174 (diagonal line, B=1.6; max output step .95); `cellc` .155-.194; `base` .0065; `qpt` .0092-.0113; `warp` none seen. At WIN=2 and B=1.6 all variants' F1 error is 0.
|
||||
- Weight range: `site` at B=6 (weight ratio about 12:1), t=8, horizontal line: WIN=2 error .0169 (output step .371); WIN=3 error 0.
|
||||
- Note: even `base` (weights .5-1, ratio 2) shows F1 error .0065 at WIN=1.
|
||||
|
||||
### 4d. Pop measure, time at fixed query points (wells move), step refinement (worst point from a dt=.01 scan, refined)
|
||||
|
||||
| variant | dt .01 max output step | dt 1e-3 | dt 1e-4 | dt 1e-5 | max F1 step at dt 1e-5 |
|
||||
|---|---|---|---|---|---|
|
||||
| site | .1083 | .01125 | .00113 | .000113 | 2.9e-6 |
|
||||
| qpt | .00461 | .000461 | 4.6e-5 | 4.6e-6 | 4.1e-6 |
|
||||
| cellc | .1060 | .0204 | .00206 | .000207 | 5.2e-6 |
|
||||
|
||||
[probe] All three steps scale linearly with dt: no discontinuity in time for any variant when the window holds the winner. Winner-id changes over t in [0,20] at 4 query points (dt .01): base 0, qpt 0, site 17, cellc 15, site_t0 0.
|
||||
|
||||
### 4e. Caveats of the probe
|
||||
Static smooth proximity field, 4 wells, 2D, one seed of the hash; 3 boost values in the pop table only B=1.6 and 6.0; no gradient-bearing outputs measured; `cellc` field is sampled at the cell centre, so it differs from `site` by the jitter distance; no visual images rendered, only the numeric measures above. The `warp` variant is an addition outside the three asked and is reported for completeness.
|
||||
559
docs/research/lattice-site-weight/probe_results.json
Normal file
559
docs/research/lattice-site-weight/probe_results.json
Normal file
|
|
@ -0,0 +1,559 @@
|
|||
{
|
||||
"grid": {
|
||||
"t=0.0": {
|
||||
"base": {
|
||||
"winner_differs_from_site": 0.14684,
|
||||
"winner_differs_from_base": 0.0,
|
||||
"out_absdiff_vs_site_mean": 0.1692938271424024,
|
||||
"out_absdiff_vs_site_max": 0.9999999999999667,
|
||||
"n_cells": 53
|
||||
},
|
||||
"site": {
|
||||
"winner_differs_from_site": 0.0,
|
||||
"winner_differs_from_base": 0.14684,
|
||||
"out_absdiff_vs_site_mean": 0.0,
|
||||
"out_absdiff_vs_site_max": 0.0,
|
||||
"n_cells": 53
|
||||
},
|
||||
"qpt": {
|
||||
"winner_differs_from_site": 0.14684,
|
||||
"winner_differs_from_base": 0.0,
|
||||
"out_absdiff_vs_site_mean": 0.1679024745847925,
|
||||
"out_absdiff_vs_site_max": 1.0,
|
||||
"n_cells": 53
|
||||
},
|
||||
"cellc": {
|
||||
"winner_differs_from_site": 0.126984,
|
||||
"winner_differs_from_base": 0.184648,
|
||||
"out_absdiff_vs_site_mean": 0.16449204766510442,
|
||||
"out_absdiff_vs_site_max": 0.99999757371696,
|
||||
"n_cells": 54
|
||||
},
|
||||
"warp": {
|
||||
"winner_differs_from_site": 0.6748,
|
||||
"winner_differs_from_base": 0.667952,
|
||||
"out_absdiff_vs_site_mean": 0.31037303493350155,
|
||||
"out_absdiff_vs_site_max": 1.0,
|
||||
"n_cells": 143
|
||||
},
|
||||
"site_t0": {
|
||||
"winner_differs_from_site": 0.0,
|
||||
"winner_differs_from_base": 0.14684,
|
||||
"out_absdiff_vs_site_mean": 0.0,
|
||||
"out_absdiff_vs_site_max": 0.0,
|
||||
"n_cells": 53
|
||||
},
|
||||
"site_window2_vs_window5_winner_differs": 0.0
|
||||
},
|
||||
"t=8.0": {
|
||||
"base": {
|
||||
"winner_differs_from_site": 0.155996,
|
||||
"winner_differs_from_base": 0.0,
|
||||
"out_absdiff_vs_site_mean": 0.18560227222422834,
|
||||
"out_absdiff_vs_site_max": 0.9999999025356109,
|
||||
"n_cells": 53
|
||||
},
|
||||
"site": {
|
||||
"winner_differs_from_site": 0.0,
|
||||
"winner_differs_from_base": 0.155996,
|
||||
"out_absdiff_vs_site_mean": 0.0,
|
||||
"out_absdiff_vs_site_max": 0.0,
|
||||
"n_cells": 53
|
||||
},
|
||||
"qpt": {
|
||||
"winner_differs_from_site": 0.155996,
|
||||
"winner_differs_from_base": 0.0,
|
||||
"out_absdiff_vs_site_mean": 0.17977625463968147,
|
||||
"out_absdiff_vs_site_max": 0.999999999999996,
|
||||
"n_cells": 53
|
||||
},
|
||||
"cellc": {
|
||||
"winner_differs_from_site": 0.114268,
|
||||
"winner_differs_from_base": 0.146552,
|
||||
"out_absdiff_vs_site_mean": 0.1556440909167879,
|
||||
"out_absdiff_vs_site_max": 0.9999919751523085,
|
||||
"n_cells": 54
|
||||
},
|
||||
"warp": {
|
||||
"winner_differs_from_site": 0.646396,
|
||||
"winner_differs_from_base": 0.639384,
|
||||
"out_absdiff_vs_site_mean": 0.2802002446118991,
|
||||
"out_absdiff_vs_site_max": 1.0,
|
||||
"n_cells": 128
|
||||
},
|
||||
"site_t0": {
|
||||
"winner_differs_from_site": 0.226044,
|
||||
"winner_differs_from_base": 0.14684,
|
||||
"out_absdiff_vs_site_mean": 0.23360220832359216,
|
||||
"out_absdiff_vs_site_max": 1.0,
|
||||
"n_cells": 53
|
||||
},
|
||||
"site_window2_vs_window5_winner_differs": 0.0
|
||||
}
|
||||
},
|
||||
"line_pop": {
|
||||
"horizontal z=2.6 (near well 0)": {
|
||||
"base t=0.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.000679179751586656,
|
||||
"maxjump_out_per_step": 0.011527150729375713,
|
||||
"maxjump_f1_with_window6": 0.000679179751586656,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"base t=0.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.000679179751586656,
|
||||
"maxjump_out_per_step": 0.011527150729375713,
|
||||
"maxjump_f1_with_window6": 0.000679179751586656,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"site t=0.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0010050426622043585,
|
||||
"maxjump_out_per_step": 0.016002826669016756,
|
||||
"maxjump_f1_with_window6": 0.0010050426622043585,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"site t=0.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.0010050426622043585,
|
||||
"maxjump_out_per_step": 0.016002826669016756,
|
||||
"maxjump_f1_with_window6": 0.0010050426622043585,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"site t=0.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.001918579519211816,
|
||||
"maxjump_out_per_step": 0.03595224397909913,
|
||||
"maxjump_f1_with_window6": 0.001918579519211816,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"site t=0.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.001918579519211816,
|
||||
"maxjump_out_per_step": 0.03595224397909913,
|
||||
"maxjump_f1_with_window6": 0.001918579519211816,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=0.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0019043178713147313,
|
||||
"maxjump_out_per_step": 0.016796471326461004,
|
||||
"maxjump_f1_with_window6": 0.0019043178713147313,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=0.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.0019043178713147313,
|
||||
"maxjump_out_per_step": 0.016796471326461004,
|
||||
"maxjump_f1_with_window6": 0.0019043178713147313,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=0.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0056772408954191,
|
||||
"maxjump_out_per_step": 0.04338667429132481,
|
||||
"maxjump_f1_with_window6": 0.0056772408954191,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=0.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.0056772408954191,
|
||||
"maxjump_out_per_step": 0.04338667429132481,
|
||||
"maxjump_f1_with_window6": 0.0056772408954191,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=0.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.000899555983544964,
|
||||
"maxjump_out_per_step": 0.028931107704223913,
|
||||
"maxjump_f1_with_window6": 0.000899555983544964,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=0.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.000899555983544964,
|
||||
"maxjump_out_per_step": 0.028998803253634242,
|
||||
"maxjump_f1_with_window6": 0.000899555983544964,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=0.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.001589550701590614,
|
||||
"maxjump_out_per_step": 0.02212547196092063,
|
||||
"maxjump_f1_with_window6": 0.001589550701590614,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=0.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.001589550701590614,
|
||||
"maxjump_out_per_step": 0.02212547196092063,
|
||||
"maxjump_f1_with_window6": 0.001589550701590614,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=0.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.005413713480415305,
|
||||
"maxjump_out_per_step": 0.11861272322439464,
|
||||
"maxjump_f1_with_window6": 0.005413713480415305,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=0.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.005413713480415305,
|
||||
"maxjump_out_per_step": 0.6979479036971218,
|
||||
"maxjump_f1_with_window6": 0.005413713480415305,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=0.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.019199908363967788,
|
||||
"maxjump_out_per_step": 0.28876383821796175,
|
||||
"maxjump_f1_with_window6": 0.019199908363967788,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=0.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.019199908363967788,
|
||||
"maxjump_out_per_step": 0.28876383821796175,
|
||||
"maxjump_f1_with_window6": 0.019199908363967788,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"base t=8.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.000679179751586656,
|
||||
"maxjump_out_per_step": 0.011527150729375713,
|
||||
"maxjump_f1_with_window6": 0.000679179751586656,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"base t=8.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.000679179751586656,
|
||||
"maxjump_out_per_step": 0.011527150729375713,
|
||||
"maxjump_f1_with_window6": 0.000679179751586656,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"site t=8.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0011605444949153165,
|
||||
"maxjump_out_per_step": 0.03721603977227228,
|
||||
"maxjump_f1_with_window6": 0.0011605444949153165,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"site t=8.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.0011605444949153165,
|
||||
"maxjump_out_per_step": 0.037218919278060314,
|
||||
"maxjump_f1_with_window6": 0.0011605444949153165,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"site t=8.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.01726416929635244,
|
||||
"maxjump_out_per_step": 0.37104796823449204,
|
||||
"maxjump_f1_with_window6": 0.0024839789447830274,
|
||||
"f1_err_vs_win6": 0.016881040623005106
|
||||
},
|
||||
"site t=8.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.0024839789447830274,
|
||||
"maxjump_out_per_step": 0.045046050707719165,
|
||||
"maxjump_f1_with_window6": 0.0024839789447830274,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=8.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0019988841823728176,
|
||||
"maxjump_out_per_step": 0.01873902874992317,
|
||||
"maxjump_f1_with_window6": 0.0019988841823728176,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=8.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.0019988841823728176,
|
||||
"maxjump_out_per_step": 0.01873902874992317,
|
||||
"maxjump_f1_with_window6": 0.0019988841823728176,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=8.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.005628071367035137,
|
||||
"maxjump_out_per_step": 0.04897917252830741,
|
||||
"maxjump_f1_with_window6": 0.005628071367035137,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=8.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.005628071367035137,
|
||||
"maxjump_out_per_step": 0.04897917252830741,
|
||||
"maxjump_f1_with_window6": 0.005628071367035137,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=8.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0013893624582810293,
|
||||
"maxjump_out_per_step": 0.0186819346008138,
|
||||
"maxjump_f1_with_window6": 0.0013893624582810293,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=8.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.0013893624582810293,
|
||||
"maxjump_out_per_step": 0.02079886198517822,
|
||||
"maxjump_f1_with_window6": 0.0013893624582810293,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=8.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0033405760083177194,
|
||||
"maxjump_out_per_step": 0.07493559630083158,
|
||||
"maxjump_f1_with_window6": 0.0033405760083177194,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=8.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.0033405760083177194,
|
||||
"maxjump_out_per_step": 0.07493559630083158,
|
||||
"maxjump_f1_with_window6": 0.0033405760083177194,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=8.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.005131686955684001,
|
||||
"maxjump_out_per_step": 0.10245451309831222,
|
||||
"maxjump_f1_with_window6": 0.005131686955684001,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=8.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.005131686955684001,
|
||||
"maxjump_out_per_step": 0.5048292489051344,
|
||||
"maxjump_f1_with_window6": 0.005131686955684001,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=8.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.01955931573768127,
|
||||
"maxjump_out_per_step": 0.2975581851502386,
|
||||
"maxjump_f1_with_window6": 0.01955931573768127,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=8.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.01955931573768127,
|
||||
"maxjump_out_per_step": 0.2975581851502386,
|
||||
"maxjump_f1_with_window6": 0.01955931573768127,
|
||||
"f1_err_vs_win6": 0.0
|
||||
}
|
||||
},
|
||||
"diagonal": {
|
||||
"base t=0.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.001275910800458191,
|
||||
"maxjump_out_per_step": 0.03528728288006466,
|
||||
"maxjump_f1_with_window6": 0.001275910800458191,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"base t=0.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.006834249882349042,
|
||||
"maxjump_out_per_step": 0.45027124784270633,
|
||||
"maxjump_f1_with_window6": 0.001275910800458191,
|
||||
"f1_err_vs_win6": 0.006469535309243879
|
||||
},
|
||||
"site t=0.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0018160559768694018,
|
||||
"maxjump_out_per_step": 0.036994428279204405,
|
||||
"maxjump_f1_with_window6": 0.0018160559768694018,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"site t=0.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.17389687729083692,
|
||||
"maxjump_out_per_step": 0.9512571305077048,
|
||||
"maxjump_f1_with_window6": 0.0018160559768694018,
|
||||
"f1_err_vs_win6": 0.17352236500589702
|
||||
},
|
||||
"site t=0.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0032951968389483,
|
||||
"maxjump_out_per_step": 0.08101849084444412,
|
||||
"maxjump_f1_with_window6": 0.0032951968389483,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"site t=0.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.0032951968389483,
|
||||
"maxjump_out_per_step": 0.08049836455119364,
|
||||
"maxjump_f1_with_window6": 0.0032951968389483,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=0.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0026472302788482782,
|
||||
"maxjump_out_per_step": 0.03868824720262809,
|
||||
"maxjump_f1_with_window6": 0.0026472302788482782,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=0.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.010707146916472454,
|
||||
"maxjump_out_per_step": 0.21289370234612265,
|
||||
"maxjump_f1_with_window6": 0.0026472302788482782,
|
||||
"f1_err_vs_win6": 0.009199392603544854
|
||||
},
|
||||
"qpt t=0.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.007883634786070015,
|
||||
"maxjump_out_per_step": 0.07213687421025916,
|
||||
"maxjump_f1_with_window6": 0.007883634786070015,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=0.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.007883634786070015,
|
||||
"maxjump_out_per_step": 0.07213687421025916,
|
||||
"maxjump_f1_with_window6": 0.007883634786070015,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=0.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0021042254469000876,
|
||||
"maxjump_out_per_step": 0.03605934023336077,
|
||||
"maxjump_f1_with_window6": 0.0021042254469000876,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=0.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.15454958335751312,
|
||||
"maxjump_out_per_step": 0.47361732317771077,
|
||||
"maxjump_f1_with_window6": 0.0021042254469000876,
|
||||
"f1_err_vs_win6": 0.15418392181872642
|
||||
},
|
||||
"cellc t=0.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.004089971897996092,
|
||||
"maxjump_out_per_step": 0.04544931913493744,
|
||||
"maxjump_f1_with_window6": 0.004089971897996092,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=0.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.004089971897996092,
|
||||
"maxjump_out_per_step": 0.04544931913493744,
|
||||
"maxjump_f1_with_window6": 0.004089971897996092,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=0.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.007786414559647126,
|
||||
"maxjump_out_per_step": 0.10615772398185219,
|
||||
"maxjump_f1_with_window6": 0.007786414559647126,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=0.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.007786414559647126,
|
||||
"maxjump_out_per_step": 0.10615772398185219,
|
||||
"maxjump_f1_with_window6": 0.007786414559647126,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=0.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0220788526153487,
|
||||
"maxjump_out_per_step": 0.2726388272791984,
|
||||
"maxjump_f1_with_window6": 0.0220788526153487,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=0.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.0220788526153487,
|
||||
"maxjump_out_per_step": 0.2726388272791984,
|
||||
"maxjump_f1_with_window6": 0.0220788526153487,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"base t=8.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.001275910800458191,
|
||||
"maxjump_out_per_step": 0.03528728288006466,
|
||||
"maxjump_f1_with_window6": 0.001275910800458191,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"base t=8.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.006834249882349042,
|
||||
"maxjump_out_per_step": 0.45027124784270633,
|
||||
"maxjump_f1_with_window6": 0.001275910800458191,
|
||||
"f1_err_vs_win6": 0.006469535309243879
|
||||
},
|
||||
"site t=8.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.00155291340314212,
|
||||
"maxjump_out_per_step": 0.04226739191047357,
|
||||
"maxjump_f1_with_window6": 0.00155291340314212,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"site t=8.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.11344119297302535,
|
||||
"maxjump_out_per_step": 0.3917028634066005,
|
||||
"maxjump_f1_with_window6": 0.00155291340314212,
|
||||
"f1_err_vs_win6": 0.11285505036112697
|
||||
},
|
||||
"site t=8.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.002453426564246408,
|
||||
"maxjump_out_per_step": 0.03688685308461992,
|
||||
"maxjump_f1_with_window6": 0.002453426564246408,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"site t=8.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.002453426564246408,
|
||||
"maxjump_out_per_step": 0.03688685308461992,
|
||||
"maxjump_f1_with_window6": 0.002453426564246408,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=8.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0018171966866530331,
|
||||
"maxjump_out_per_step": 0.03560130205583023,
|
||||
"maxjump_f1_with_window6": 0.0018171966866530331,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=8.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.011573594040749535,
|
||||
"maxjump_out_per_step": 0.44945714067888365,
|
||||
"maxjump_f1_with_window6": 0.0018171966866530331,
|
||||
"f1_err_vs_win6": 0.011263134181283219
|
||||
},
|
||||
"qpt t=8.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.004178672365624969,
|
||||
"maxjump_out_per_step": 0.06700822884555246,
|
||||
"maxjump_f1_with_window6": 0.004178672365624969,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"qpt t=8.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.004178672365624969,
|
||||
"maxjump_out_per_step": 0.06700822884555246,
|
||||
"maxjump_f1_with_window6": 0.004178672365624969,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=8.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0013657606892926166,
|
||||
"maxjump_out_per_step": 0.03848639655536479,
|
||||
"maxjump_f1_with_window6": 0.0013657606892926166,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=8.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.19448286979973972,
|
||||
"maxjump_out_per_step": 0.9778972151563999,
|
||||
"maxjump_f1_with_window6": 0.0013657606892926166,
|
||||
"f1_err_vs_win6": 0.1940193666886757
|
||||
},
|
||||
"cellc t=8.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.0016119831862634326,
|
||||
"maxjump_out_per_step": 0.05348368104496215,
|
||||
"maxjump_f1_with_window6": 0.0016119831862634326,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"cellc t=8.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.0016119831862634326,
|
||||
"maxjump_out_per_step": 0.05348368104496215,
|
||||
"maxjump_f1_with_window6": 0.0016119831862634326,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=8.0 B=1.6 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.00389655575000758,
|
||||
"maxjump_out_per_step": 0.06278112824237458,
|
||||
"maxjump_f1_with_window6": 0.00389655575000758,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=8.0 B=1.6 WIN=1": {
|
||||
"maxjump_f1_per_step": 0.00389655575000758,
|
||||
"maxjump_out_per_step": 0.4429137542853424,
|
||||
"maxjump_f1_with_window6": 0.00389655575000758,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=8.0 B=6.0 WIN=2": {
|
||||
"maxjump_f1_per_step": 0.012386023943556368,
|
||||
"maxjump_out_per_step": 0.1972931166165931,
|
||||
"maxjump_f1_with_window6": 0.012386023943556368,
|
||||
"f1_err_vs_win6": 0.0
|
||||
},
|
||||
"warp t=8.0 B=6.0 WIN=3": {
|
||||
"maxjump_f1_per_step": 0.012386023943556368,
|
||||
"maxjump_out_per_step": 0.1972931166165931,
|
||||
"maxjump_f1_with_window6": 0.012386023943556368,
|
||||
"f1_err_vs_win6": 0.0
|
||||
}
|
||||
}
|
||||
},
|
||||
"time_pop": {
|
||||
"base": {
|
||||
"maxjump_f1_per_dt": 0.0,
|
||||
"maxjump_out_per_dt": 0.0,
|
||||
"winner_changes_total": 0
|
||||
},
|
||||
"site": {
|
||||
"maxjump_f1_per_dt": 0.006243969970252006,
|
||||
"maxjump_out_per_dt": 0.10827554277384255,
|
||||
"winner_changes_total": 17
|
||||
},
|
||||
"qpt": {
|
||||
"maxjump_f1_per_dt": 0.004880867091880958,
|
||||
"maxjump_out_per_dt": 0.004611044852681684,
|
||||
"winner_changes_total": 0
|
||||
},
|
||||
"cellc": {
|
||||
"maxjump_f1_per_dt": 0.006179970448791816,
|
||||
"maxjump_out_per_dt": 0.10604425529368433,
|
||||
"winner_changes_total": 15
|
||||
},
|
||||
"site_t0": {
|
||||
"maxjump_f1_per_dt": 0.0,
|
||||
"maxjump_out_per_dt": 0.0,
|
||||
"winner_changes_total": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
140
docs/research/lattice-site-weight/probe_results2.json
Normal file
140
docs/research/lattice-site-weight/probe_results2.json
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
{
|
||||
"timejump site dt=0.01": {
|
||||
"q": [
|
||||
2.3,
|
||||
2.8
|
||||
],
|
||||
"t_worst": 9.91,
|
||||
"max_out_step": 0.10827554277384255,
|
||||
"max_f1_step": 0.0028572323710521763
|
||||
},
|
||||
"timejump site dt=0.001": {
|
||||
"q": [
|
||||
2.3,
|
||||
2.8
|
||||
],
|
||||
"t_worst": 9.91,
|
||||
"max_out_step": 0.011248851985623975,
|
||||
"max_f1_step": 0.00028847749905558384
|
||||
},
|
||||
"timejump site dt=0.0001": {
|
||||
"q": [
|
||||
2.3,
|
||||
2.8
|
||||
],
|
||||
"t_worst": 9.91,
|
||||
"max_out_step": 0.00113067110268672,
|
||||
"max_f1_step": 2.8874698390524145e-05
|
||||
},
|
||||
"timejump site dt=1e-05": {
|
||||
"q": [
|
||||
2.3,
|
||||
2.8
|
||||
],
|
||||
"t_worst": 9.91,
|
||||
"max_out_step": 0.00011316362556801352,
|
||||
"max_f1_step": 2.8877387294734547e-06
|
||||
},
|
||||
"timejump qpt dt=0.01": {
|
||||
"q": [
|
||||
5.9,
|
||||
1.9
|
||||
],
|
||||
"t_worst": 16.21,
|
||||
"max_out_step": 0.00461104485268235,
|
||||
"max_f1_step": 0.004042127425204045
|
||||
},
|
||||
"timejump qpt dt=0.001": {
|
||||
"q": [
|
||||
5.9,
|
||||
1.9
|
||||
],
|
||||
"t_worst": 16.21,
|
||||
"max_out_step": 0.0004611240505579539,
|
||||
"max_f1_step": 0.000406360115853599
|
||||
},
|
||||
"timejump qpt dt=0.0001": {
|
||||
"q": [
|
||||
5.9,
|
||||
1.9
|
||||
],
|
||||
"t_worst": 16.21,
|
||||
"max_out_step": 4.611242486959877e-05,
|
||||
"max_f1_step": 4.065726355373389e-05
|
||||
},
|
||||
"timejump qpt dt=1e-05": {
|
||||
"q": [
|
||||
5.9,
|
||||
1.9
|
||||
],
|
||||
"t_worst": 16.21,
|
||||
"max_out_step": 4.611242504171109e-06,
|
||||
"max_f1_step": 4.065938649877587e-06
|
||||
},
|
||||
"timejump cellc dt=0.01": {
|
||||
"q": [
|
||||
5.9,
|
||||
1.9
|
||||
],
|
||||
"t_worst": 0.39,
|
||||
"max_out_step": 0.10604425529368433,
|
||||
"max_f1_step": 0.005110972264514513
|
||||
},
|
||||
"timejump cellc dt=0.001": {
|
||||
"q": [
|
||||
5.9,
|
||||
1.9
|
||||
],
|
||||
"t_worst": 0.39,
|
||||
"max_out_step": 0.020376801353283347,
|
||||
"max_f1_step": 0.0005172341605852449
|
||||
},
|
||||
"timejump cellc dt=0.0001": {
|
||||
"q": [
|
||||
5.9,
|
||||
1.9
|
||||
],
|
||||
"t_worst": 0.39,
|
||||
"max_out_step": 0.002064834070920063,
|
||||
"max_f1_step": 5.178482072565327e-05
|
||||
},
|
||||
"timejump cellc dt=1e-05": {
|
||||
"q": [
|
||||
5.9,
|
||||
1.9
|
||||
],
|
||||
"t_worst": 0.39,
|
||||
"max_out_step": 0.00020688477103125713,
|
||||
"max_f1_step": 5.179096147611695e-06
|
||||
},
|
||||
"shape base": {
|
||||
"mean_cell_pixels_near_wells": 10951.06215310558,
|
||||
"mean_cell_pixels_far": 10515.08654105133,
|
||||
"border_frac_near": 0.3004222385907398,
|
||||
"border_frac_far": 0.28125746844758714
|
||||
},
|
||||
"shape site": {
|
||||
"mean_cell_pixels_near_wells": 9671.733834071645,
|
||||
"mean_cell_pixels_far": 11438.643308839986,
|
||||
"border_frac_near": 0.2704401863244494,
|
||||
"border_frac_far": 0.25280623954417336
|
||||
},
|
||||
"shape qpt": {
|
||||
"mean_cell_pixels_near_wells": 10951.06215310558,
|
||||
"mean_cell_pixels_far": 10515.08654105133,
|
||||
"border_frac_near": 0.1644136900747995,
|
||||
"border_frac_far": 0.2500635410778843
|
||||
},
|
||||
"shape cellc": {
|
||||
"mean_cell_pixels_near_wells": 11562.292900789493,
|
||||
"mean_cell_pixels_far": 12273.640744435888,
|
||||
"border_frac_near": 0.27424759572989177,
|
||||
"border_frac_far": 0.2618651108270203
|
||||
},
|
||||
"shape warp": {
|
||||
"mean_cell_pixels_near_wells": 3446.9220259152826,
|
||||
"mean_cell_pixels_far": 8566.10048594699,
|
||||
"border_frac_near": 0.29084665580811486,
|
||||
"border_frac_far": 0.3016702768114897
|
||||
}
|
||||
}
|
||||
123
docs/research/lattice-site-weight/siteweight_probe.py
Normal file
123
docs/research/lattice-site-weight/siteweight_probe.py
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
"""Scratch probe: where does a weighted lattice Voronoi cell get its weight?
|
||||
2D, lattice cell = 1 unit, wells with a proximity field, numpy only.
|
||||
Variants of the per-site weight wt_i (multiplies the distance to site i, as the fauna probe's lattice_web):
|
||||
base : wt = hashed .5..1, no field (reference, the unweighted-by-field node)
|
||||
site : wt = base*(1+B*prox(site position, t)) (fauna probe, 4354ef2c)
|
||||
qpt : wt = base*(1+B*prox(query position, t)) (common factor for every candidate site)
|
||||
cellc : wt = base*(1+B*prox(lattice cell centre, t)) (node calls the field at the integer cell id)
|
||||
site_t0: as site, but field read at t=0 (stale time) while wells have moved
|
||||
warp : base weights, query warped q' = q*(1+B*prox(q)) (domain scaling, a different construct)
|
||||
"""
|
||||
import numpy as np, sys, json
|
||||
rng_seed = 7
|
||||
def hash01(ix, iz, k):
|
||||
# integer hash (lowbias32-style), stand-in for pcg3d; deterministic, vectorised
|
||||
x = (ix.astype(np.uint64)*np.uint64(73856093) ^ iz.astype(np.uint64)*np.uint64(19349663) ^ np.uint64(k*83492791+rng_seed)) & np.uint64(0xFFFFFFFF)
|
||||
x ^= x >> np.uint64(16); x = (x*np.uint64(0x7feb352d)) & np.uint64(0xFFFFFFFF)
|
||||
x ^= x >> np.uint64(15); x = (x*np.uint64(0x846ca68b)) & np.uint64(0xFFFFFFFF)
|
||||
x ^= x >> np.uint64(16)
|
||||
return (x >> np.uint64(8)).astype(np.float64)/16777216.0
|
||||
|
||||
W0 = np.array([[2.0,2.5],[5.5,4.0],[3.5,6.0],[6.5,1.5]]); WS = np.array([0.8,1.2,0.6,1.0])
|
||||
OM = np.array([0.30,-0.22,0.17,-0.41]) # well orbit rate, rad per unit t (wells orbit a centre)
|
||||
CEN = np.array([4.0,4.0])
|
||||
def wells(t):
|
||||
r = W0-CEN; c, s = np.cos(OM*t), np.sin(OM*t)
|
||||
return CEN + np.stack([r[:,0]*c-r[:,1]*s, r[:,0]*s+r[:,1]*c], 1)
|
||||
def prox(x, z, t):
|
||||
w = wells(t); out = 0
|
||||
for k in range(len(w)):
|
||||
out = np.maximum(out, np.exp(-(np.hypot(x-w[k,0], z-w[k,1])/WS[k])**2))
|
||||
return out
|
||||
|
||||
KW=.35
|
||||
def node(qx, qz, variant, t=0.0, B=1.6, WIN=2, tfield=None):
|
||||
"""returns f1, f2, winning cell id (ix*10007+iz), soft border value"""
|
||||
qx0, qz0 = qx, qz
|
||||
if variant == 'warp':
|
||||
s = 1+B*prox(qx, qz, t); qx, qz = qx*s, qz*s
|
||||
nx, nz = np.floor(qx), np.floor(qz)
|
||||
m = np.full(qx.shape, 8.0); f1 = m.copy(); f2 = m.copy(); wid = np.zeros(qx.shape)
|
||||
pq = prox(qx0, qz0, t)
|
||||
tf = t if tfield is None else tfield
|
||||
for j in range(-WIN, WIN+1):
|
||||
for i in range(-WIN, WIN+1):
|
||||
cx, cz = nx+i, nz+j
|
||||
ox, oz = hash01(cx, cz, 11), hash01(cx, cz, 12)
|
||||
base = hash01(cx, cz, 13)*.5+.5
|
||||
sx, sz = cx+ox, cz+oz
|
||||
if variant in ('base','warp'): wt = base
|
||||
elif variant == 'site': wt = base*(1+B*prox(sx, sz, tf))
|
||||
elif variant == 'site_t0': wt = base*(1+B*prox(sx, sz, 0.0))
|
||||
elif variant == 'cellc': wt = base*(1+B*prox(cx+.5, cz+.5, tf))
|
||||
elif variant == 'qpt': wt = base*(1+B*pq)
|
||||
d = np.hypot(sx-qx, sz-qz)*wt
|
||||
upd1 = d < f1; upd2 = (~upd1) & (d < f2)
|
||||
wid = np.where(upd1, cx*10007+cz, wid)
|
||||
f2 = np.where(upd1, f1, np.where(upd2, d, f2)); f1 = np.where(upd1, d, f1)
|
||||
h = (lambda u: u*u*(3-2*u))(np.clip(.5+.5*(m-d)/KW, 0, 1))
|
||||
m = m+(d-m)*h-h*(1-h)*KW/(1+3*KW)
|
||||
gap0 = .25*KW/(1+3*KW)
|
||||
soft = np.clip((f1-m)/gap0, 0, 1)
|
||||
out = np.maximum(soft**2, np.exp(-((f2-f1)/.10)**2))
|
||||
return f1, f2, wid, out
|
||||
|
||||
def grid(n=500, lo=1.0, hi=7.0):
|
||||
xs = np.linspace(lo, hi, n); X, Z = np.meshgrid(xs, xs); return X, Z
|
||||
|
||||
def main():
|
||||
R = {}
|
||||
X, Z = grid()
|
||||
for t in (0.0, 8.0):
|
||||
ref = {v: node(X, Z, v, t) for v in ('base','site','qpt','cellc','warp')}
|
||||
ref['site_t0'] = node(X, Z, 'site_t0', t)
|
||||
# large-window truth for 'site' (exact argmin unless window too small)
|
||||
truth = node(X, Z, 'site', t, WIN=5)[2]
|
||||
key = f"t={t}"; R[key] = {}
|
||||
for v, (f1, f2, wid, out) in ref.items():
|
||||
R[key][v] = dict(
|
||||
winner_differs_from_site=float((wid != ref['site'][2]).mean()),
|
||||
winner_differs_from_base=float((wid != ref['base'][2]).mean()),
|
||||
out_absdiff_vs_site_mean=float(np.abs(out-ref['site'][3]).mean()),
|
||||
out_absdiff_vs_site_max=float(np.abs(out-ref['site'][3]).max()),
|
||||
n_cells=int(len(np.unique(wid))))
|
||||
R[key]['site_window2_vs_window5_winner_differs'] = float((ref['site'][2] != truth).mean())
|
||||
# cell count density near wells for site vs base
|
||||
# pop measure: dense line, step 1e-3 units; also jumps in time at fixed q
|
||||
ts = np.linspace(1.0, 7.0, 6001) # 1e-3
|
||||
lines = {'horizontal z=2.6 (near well 0)': (ts, np.full_like(ts, 2.6)),
|
||||
'diagonal': (ts, 1.0+ts*0.9-0.5)}
|
||||
P = {}
|
||||
for ln, (lx, lz) in lines.items():
|
||||
P[ln] = {}
|
||||
for t in (0.0, 8.0):
|
||||
for v in ('base','site','qpt','cellc','warp'):
|
||||
for B, WIN in ((1.6,2),(1.6,1),(6.0,2),(6.0,3)):
|
||||
if v in ('base',) and B != 1.6: continue
|
||||
f1, f2, wid, out = node(lx, lz, v, t, B, WIN)
|
||||
ref = node(lx, lz, v, t, B, 6)
|
||||
P[ln][f"{v} t={t} B={B} WIN={WIN}"] = dict(
|
||||
maxjump_f1_per_step=float(np.abs(np.diff(f1)).max()),
|
||||
maxjump_out_per_step=float(np.abs(np.diff(out)).max()),
|
||||
maxjump_f1_with_window6=float(np.abs(np.diff(ref[0])).max()),
|
||||
f1_err_vs_win6=float(np.abs(f1-ref[0]).max()))
|
||||
# time pop: fixed query points, t stepped at 1e-2; wells move
|
||||
tt = np.linspace(0, 20, 2001)
|
||||
qs = [(2.3,2.8),(4.7,3.9),(3.5,5.5),(5.9,1.9)]
|
||||
T = {}
|
||||
for v in ('base','site','qpt','cellc','site_t0'):
|
||||
mj = 0; mo = 0; changes = 0
|
||||
for (qx, qz) in qs:
|
||||
f1s=[];outs=[];wids=[]
|
||||
for t in tt:
|
||||
a,b,w,o = node(np.array([qx]), np.array([qz]), v, t)
|
||||
f1s.append(a[0]); outs.append(o[0]); wids.append(w[0])
|
||||
mj=max(mj,np.abs(np.diff(f1s)).max()); mo=max(mo,np.abs(np.diff(outs)).max())
|
||||
changes += int((np.diff(wids)!=0).sum())
|
||||
T[v] = dict(maxjump_f1_per_dt=float(mj), maxjump_out_per_dt=float(mo), winner_changes_total=changes)
|
||||
json.dump(dict(grid=R, line_pop=P, time_pop=T), open('probe_results.json','w'), indent=1)
|
||||
print(json.dumps(R, indent=1)); print(json.dumps(T, indent=1))
|
||||
for ln in P:
|
||||
print(ln)
|
||||
for k,v in P[ln].items(): print(' ', k, {a: round(b,5) for a,b in v.items()})
|
||||
main()
|
||||
37
docs/research/lattice-site-weight/siteweight_probe2.py
Normal file
37
docs/research/lattice-site-weight/siteweight_probe2.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
"""Follow-up: (1) continuity refinement: does the max time-jump of 'site' scale with dt? (2) cell size near vs far from wells,
|
||||
border-pixel fraction per variant."""
|
||||
import numpy as np, json, importlib.util, sys, io, contextlib
|
||||
spec = importlib.util.spec_from_file_location('p', 'siteweight_probe.py')
|
||||
src = open('siteweight_probe.py').read().replace('\nmain()\n', '\n') # import without running main
|
||||
ns = {}; exec(compile(src, 'p', 'exec'), ns)
|
||||
node, prox, grid, wells = ns['node'], ns['prox'], ns['grid'], ns['wells']
|
||||
res = {}
|
||||
# (1) worst time step at dt=.01 for each variant, then refine dt inside +-.02 of it (continuity: step should shrink ~ with dt)
|
||||
qs = [(2.3,2.8),(4.7,3.9),(3.5,5.5),(5.9,1.9)]
|
||||
def series(v, qx, qz, tt):
|
||||
f1 = np.empty(len(tt)); out = np.empty(len(tt))
|
||||
for k, t in enumerate(tt):
|
||||
a,b,w,o = node(np.array([qx]), np.array([qz]), v, t); f1[k]=a[0]; out[k]=o[0]
|
||||
return f1, out
|
||||
for v in ('site','qpt','cellc'):
|
||||
tt = np.arange(0, 20.0001, 0.01); best = (0, None, None)
|
||||
for qx, qz in qs:
|
||||
f1, out = series(v, qx, qz, tt); i = int(np.argmax(np.abs(np.diff(out))))
|
||||
if abs(out[i+1]-out[i]) > best[0]: best = (abs(out[i+1]-out[i]), (qx,qz), tt[i])
|
||||
_, q, t0 = best
|
||||
for dt in (0.01, 0.001, 0.0001, 0.00001):
|
||||
t2 = np.arange(t0-0.02, t0+0.03, dt); f1, out = series(v, q[0], q[1], t2)
|
||||
res[f"timejump {v} dt={dt}"] = dict(q=q, t_worst=float(t0), max_out_step=float(np.abs(np.diff(out)).max()), max_f1_step=float(np.abs(np.diff(f1)).max()))
|
||||
print(v, dt, res[f"timejump {v} dt={dt}"], flush=True)
|
||||
# (2) cell area near vs far wells, border fraction
|
||||
X, Z = grid(600)
|
||||
w = wells(0.0)
|
||||
near = np.min([np.hypot(X-w[k,0], Z-w[k,1])/ns['WS'][k] for k in range(4)], axis=0) < 1.0
|
||||
for v in ('base','site','qpt','cellc','warp'):
|
||||
f1,f2,wid,out = node(X, Z, v, 0.0)
|
||||
ids, cnt = np.unique(wid, return_counts=True); area = dict(zip(ids, cnt))
|
||||
pa = np.array([area[i] for i in wid.ravel()]).reshape(wid.shape)
|
||||
res[f"shape {v}"] = dict(mean_cell_pixels_near_wells=float(pa[near].mean()), mean_cell_pixels_far=float(pa[~near].mean()),
|
||||
border_frac_near=float((out[near]>.5).mean()), border_frac_far=float((out[~near]>.5).mean()))
|
||||
print(v, res[f"shape {v}"])
|
||||
json.dump(res, open('probe_results2.json','w'), indent=1)
|
||||
Loading…
Reference in a new issue