utils.integral_validation module¶
Generic facilities to validate integrals
- class Sampler(*args, **kwargs)[source]¶
Bases:
better_abc.ABC
Sampling tool for integral validation that mimics the behavior of sample_survey/sample_refine from Integrators
- compare_integral_result(result1, result2, sigma_cutoff=2, keep_history=False)[source]¶
Compute an integral in two different ways and compare
- Parameters
result1 (utils.record.EvaluationRecord) –
result2 (utils.record.EvaluationRecord) –
sigma_cutoff (float) –
keep_history (bool) –
- Returns
- Return type
- compare_integrals(integrand1, sampler1, sampler2, integrand2=None, n_batch=10000, sigma_cutoff=2, keep_history=False)[source]¶
Compute an integral in two different ways and compare
- Parameters
- Returns
- Return type
- evaluate_integral(integrand, sampler, n_batch=10000, keep_history=False)[source]¶
Evaluate an integral
- Parameters
integrand (utils.integrands.KnownIntegrand) –
sampler (Sampler) –
n_batch (int) –
keep_history (bool) –
- Returns
- Return type
- evaluate_integral_stratified(integrand, sampler, n_batch=10000, keep_history=False)[source]¶
Evaluate an integral with a stratified sampling sampler
- Parameters
integrand (utils.integrands.KnownIntegrand) –
sampler (Sampler) –
n_batch (int) –
keep_history (bool) –
- Returns
- Return type
- validate_integral(integrand, sampler, n_batch=10000, sigma_cutoff=2, keep_history=False)[source]¶
Compute the integral and check whether it matches the known value
- Parameters
integrand (utils.integrands.KnownIntegrand) –
sampler (Sampler) –
n_batch (int) –
sigma_cutoff (float) –
keep_history (bool) –
- Returns
- Return type