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(), settings and from_settings(). Name a kind in 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:

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

HAS_OVERLAY

Whether measure_overlay() is implemented, for the callers that decide whether to ask for one.

kind

The name the class is registered under, which a file records.

products

The quantities of a map of this sampler beyond the success fraction.

settings

The arguments that rebuild this sampler, as plain types that an ECSV header can hold.

space

The axes the experiment is over, with their default ranges.

table_meta

What a figure of the map needs to label its axes, and what a comparison checks before it differences two.

yield_weight

The name of the Scale product 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).