pycauset.spacetime.RestrictedSpacetime
Inherits from: Spacetime
Wraps a spacetime and keeps a subregion defined by a predicate region(coords) -> bool. Sampling uses rejection; is_causal is inherited unchanged.
Parameters
- base (Spacetime): The spacetime to restrict.
- region (callable): A predicate
region(coords) -> boolselecting the kept points. - volume (float, optional): The restricted volume. If omitted, it is estimated by Monte Carlo so
volume ↔ samplestay consistent.
Methods
volume
The restricted volume (provided, or Monte-Carlo estimated).
sample
Draws n points uniformly from the subregion by rejection sampling the base.
is_causal
Inherited from base.
Example
from pycauset import spacetime
box = spacetime.MinkowskiBox(2, 10.0, 10.0)
left_half = spacetime.RestrictedSpacetime(box, region=lambda c: c[1] < 5.0)