Sampler#
- class uvex_transients.phase_space.sampling.base.Sampler[source]#
Answer “how many detections in n tries at a point?” for one kind of experiment.
A subclass supplies
space,draw(),settingsandfrom_settings(). Name akindin the class statement to register it; see the module documentation. Everything else is an optional hook, with a default that a sampler overrides only if it has something to say, so that nothing that consumes a sampler has to ask what kind it is:products,rate_products()andyield_weight: the quantities of its map beyond the success fraction, and the one that two maps are compared on;table_meta: what a figure or a comparison needs to know about the plane the axes are measured on;describe(): what the map is, in a few words, for the title of its figure;draw_map()andannotate_map(): the figure of its map, and what is drawn on it;HAS_OVERLAYandmeasure_overlay(): a population to shade on the figure, if there is one;from_run_config(): how a run-config builds it.
- Raises:
TypeError – If a subclass names a kind that is already registered, or one that is not a non-empty string.
Methods
annotate_map(ax, overlay)Draw the overlay of a sampler on the axes of a figure of its map.
describe(settings)Describe the map of a sampler in a few words, for the title of its figure.
draw(x, n, seed)Make n independent tries at a point and return how many succeed.
draw_map(grid, points, path, title, *[, ...])Draw the fitted map of a sampler of this class and save the figure.
from_run_config(run, **options)Build a sampler from the arguments of a map in a run-config.
from_settings(settings, **context)Rebuild a sampler from the settings of another one.
kinds()Return the registered kinds this class is, the most specific first.
measure_overlay([n_draws, seed])Measure a population in the plane of the map, to be shaded on its figure.
rate_products(rate)Return the quantities of a map that need a volumetric rate, such as the expected number of recoveries.
Attributes
Whether
measure_overlay()is implemented, for the callers that decide whether to ask for one.The name the class is registered under, which a file records.
The quantities of a map of this sampler beyond the success fraction.
The arguments that rebuild this sampler, as plain types that an ECSV header can hold.
The axes the experiment is over, with their default ranges.
What a figure of the map needs to label its axes, and what a comparison checks before it differences two.
The name of the
Scaleproduct that turns the success fraction into the quantity two maps are compared on (the volume-time, for a survey sampler: the recovered volume-time is its product with the fraction).