Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Patching — sampler gallery (RegularStride, Jittered, PoissonDisk, …)

Patching samplers — where to place anchors

Same geopatcher axis, different placement strategies. The Sampler decides where the anchors go; the Geometry then turns each anchor into backend-specific indices. Sometimes you want a dense regular lattice, sometimes uniform random training crops, sometimes well-spaced samples without redundancy. This notebook visualises every shipped sampler over a real Sentinel-2 crop so the placement is grounded in something a reader recognises.

1. A real-data crop

Pull the Lake Tahoe chip, take a 512×512 sub-crop from the NIR band (band 3 in our BGRN stack) so the sampler scatter plots overlay real texture instead of a featureless backdrop.

crop shape: (512, 512)
patch size: (64, 64)

2. Spatial samplers side-by-side

Each sampler is asked for its anchors against the same field + geometry. Anchors are the top-left corners of where each 64×64 patch would land. The scatter colour encodes the iteration order; the underlay is the NIR-reflectance backdrop so each anchor sits over real terrain.

<Figure size 1800x400 with 5 Axes>

What to notice

  • RegularStride and JitteredStride produce a fixed-cardinality lattice. Jittering shakes each anchor by a fraction of the step — useful as training-time augmentation (see ../06_ml_patches_augment).
  • Random is uniform random; samples can clump. Good for cheap data augmentation but boundary coverage isn’t guaranteed.
  • PoissonDisk guarantees a minimum pairwise distance via Bridson’s algorithm — well-spaced random samples with no redundancy.
  • Explicit is the universal escape hatch — you provide the list yourself (e.g. station locations, event detections).

3. Pairwise-distance comparison

Quantify the spacing properties: histogram of nearest-neighbour distances per sampler.

<Figure size 800x400 with 1 Axes>

4. Temporal samplers on a time series

The temporal samplers index integer positions along a time axis. We visualise where each places its anchors on a 100-step series — think of these as scene-acquisition dates rather than pixel rows.

<Figure size 900x700 with 5 Axes>

5. Choosing a sampler

Rough decision table:

NeedSampler
Dense reconstruction (no overlap)RegularStride(step=size)
Dense reconstruction (overlap)RegularStride(step<size) + Hann/Tukey window
Training augmentation (regular + jitter)JitteredStride
Training augmentation (uniform random)Random(n_samples=…)
Well-spaced random samplesPoissonDisk(min_dist=…)
Anchors from external data (stations, events)Explicit / EventTriggered
Past-only rolling windowCausalRolling

Whichever you pick, the rest of the Patcher (geometry, window, aggregation) stays unchanged — sampling decisions can be A/B-tested independently of the operator pipeline.