pytc.vmc.test.test_adaptive_burn_in.TestAdaptiveBurnIn

class pytc.vmc.test.test_adaptive_burn_in.TestAdaptiveBurnIn(methodName='runTest')[source]

Bases: TestCase

Task #12 tier-2: burn_in() should terminate on ensemble-stability evidence rather than a fixed, easy-to-under-provision step count.

Methods

__call__

Call self as a function.

__delattr__

Implement delattr(self, name).

__dir__

Default dir() implementation.

__eq__

Return self==value.

__format__

Default object formatter.

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__getstate__

Helper for pickle.

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Create an instance of the class that will use the named test method when executed.

__init_subclass__

This method is called when a class is subclassed.

__le__

Return self<=value.

__lt__

Return self<value.

__ne__

Return self!=value.

__new__

__reduce__

Helper for pickle.

__reduce_ex__

Helper for pickle.

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__

Size of object in memory, in bytes.

__str__

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

_addDuration

_addExpectedFailure

_addUnexpectedSuccess

_baseAssertEqual

The default assertEqual implementation, not type specific.

_callCleanup

_callSetUp

_callTearDown

_callTestMethod

_formatMessage

Honour the longMessage attribute when generating failure messages.

_fresh_walkers

_getAssertEqualityFunc

Get a detailed comparison function for the types of the two args.

_truncateMessage

addClassCleanup

Same as addCleanup, except the cleanup items are called even if setUpClass fails (unlike tearDownClass).

addCleanup

Add a function, with arguments, to be called when the test is completed.

addTypeEqualityFunc

Add a type specific assertEqual style function to compare a type.

assertAlmostEqual

Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is more than the given delta.

assertCountEqual

Asserts that two iterables have the same elements, the same number of times, without regard to order.

assertDictEqual

assertEqual

Fail if the two objects are unequal as determined by the '==' operator.

assertFalse

Check that the expression is false.

assertGreater

Just like self.assertTrue(a > b), but with a nicer default message.

assertGreaterEqual

Just like self.assertTrue(a >= b), but with a nicer default message.

assertIn

Just like self.assertTrue(a in b), but with a nicer default message.

assertIs

Just like self.assertTrue(a is b), but with a nicer default message.

assertIsInstance

Same as self.assertTrue(isinstance(obj, cls)), with a nicer default message.

assertIsNone

Same as self.assertTrue(obj is None), with a nicer default message.

assertIsNot

Just like self.assertTrue(a is not b), but with a nicer default message.

assertIsNotNone

Included for symmetry with assertIsNone.

assertLess

Just like self.assertTrue(a < b), but with a nicer default message.

assertLessEqual

Just like self.assertTrue(a <= b), but with a nicer default message.

assertListEqual

A list-specific equality assertion.

assertLogs

Fail unless a log message of level level or higher is emitted on logger_name or its children.

assertMultiLineEqual

Assert that two multi-line strings are equal.

assertNoLogs

Fail unless no log messages of level level or higher are emitted on logger_name or its children.

assertNotAlmostEqual

Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the difference between the two objects is less than the given delta.

assertNotEqual

Fail if the two objects are equal as determined by the '!=' operator.

assertNotIn

Just like self.assertTrue(a not in b), but with a nicer default message.

assertNotIsInstance

Included for symmetry with assertIsInstance.

assertNotRegex

Fail the test if the text matches the regular expression.

assertRaises

Fail unless an exception of class expected_exception is raised by the callable when invoked with specified positional and keyword arguments.

assertRaisesRegex

Asserts that the message in a raised exception matches a regex.

assertRegex

Fail the test unless the text matches the regular expression.

assertSequenceEqual

An equality assertion for ordered sequences (like lists and tuples).

assertSetEqual

A set-specific equality assertion.

assertTrue

Check that the expression is true.

assertTupleEqual

A tuple-specific equality assertion.

assertWarns

Fail unless a warning of class warnClass is triggered by the callable when invoked with specified positional and keyword arguments.

assertWarnsRegex

Asserts that the message in a triggered warning matches a regexp.

countTestCases

debug

Run the test without collecting errors in a TestResult

defaultTestResult

doClassCleanups

Execute all class cleanup functions.

doCleanups

Execute all cleanup functions.

enterClassContext

Same as enterContext, but class-wide.

enterContext

Enters the supplied context manager.

fail

Fail immediately, with the given message.

id

run

setUp

Hook method for setting up the test fixture before exercising it.

setUpClass

Hook method for setting up class fixture before running tests in the class.

shortDescription

Returns a one-line description of the test, or None if no description has been provided.

skipTest

Skip this test.

subTest

Return a context manager that will return the enclosed block of code in a subtest identified by the optional message and keyword parameters.

tearDown

Hook method for deconstructing the test fixture after testing it.

tearDownClass

Hook method for deconstructing the class fixture after running all tests in the class.

test_acceptance_target_zero_rejected

acceptance_target=0 would divide by zero in the step-size controller; it must raise ValueError instead.

test_burn_in_honours_adapt_step_size_false

burn_in with adapt_step_size=False must return the initial step_size unchanged (controller owned by the caller).

test_first_complete_interval_uses_all_interval_samples

After exactly one full interval, the returned step_size must equal initial * clip(mean(all interval acceptances) / 0.5).

test_hits_hard_cap_without_hanging

An impossible stability tolerance must still terminate at max_steps rather than loop forever.

test_no_adaptation_before_first_complete_interval

With n_steps < report_interval, no adaptation may fire at all -- in particular not at step 0 off a single acceptance sample.

test_nonpositive_chunk_and_max_steps_rejected

chunk_size<=0 never advances total_steps (infinite loop) and max_steps<=0 is meaningless; both must raise ValueError.

test_oversized_step_never_zeros_step_size

Regression: with a wildly oversized initial step (acceptance ~0) the old unclipped single-step controller could drive step_size to exactly 0, killing the chain permanently.

test_pregate_skips_evaluation_when_acceptance_out_of_band

A near-zero acceptance tolerance on freshly-initialized (highly accepted) walkers should never pass the pre-gate, so every chunk's mean_energy/variance stay None.

test_step_size_adapts_between_chunks_on_chunk_mean

The between-chunk controller must pull step_size toward the acceptance target from both sides: starting far apart, two runs with the same seed must end closer together than they started.

test_terminates_early_when_stable

With loose tolerances, should stop well short of max_steps and report the E/Var that triggered termination.

Attributes

__annotations__

__dict__

__doc__

__module__

__weakref__

list of weak references to the object

_classSetupFailed

_class_cleanups

_diffThreshold

longMessage

maxDiff

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_terminates_early_when_stable()[source]

With loose tolerances, should stop well short of max_steps and report the E/Var that triggered termination.

test_hits_hard_cap_without_hanging()[source]

An impossible stability tolerance must still terminate at max_steps rather than loop forever.

test_pregate_skips_evaluation_when_acceptance_out_of_band()[source]

A near-zero acceptance tolerance on freshly-initialized (highly accepted) walkers should never pass the pre-gate, so every chunk’s mean_energy/variance stay None.

test_step_size_adapts_between_chunks_on_chunk_mean()[source]

The between-chunk controller must pull step_size toward the acceptance target from both sides: starting far apart, two runs with the same seed must end closer together than they started.

test_oversized_step_never_zeros_step_size()[source]

Regression: with a wildly oversized initial step (acceptance ~0) the old unclipped single-step controller could drive step_size to exactly 0, killing the chain permanently. The clipped chunk-mean controller must keep it positive and shrinking.

test_no_adaptation_before_first_complete_interval()[source]

With n_steps < report_interval, no adaptation may fire at all – in particular not at step 0 off a single acceptance sample.

test_first_complete_interval_uses_all_interval_samples()[source]

After exactly one full interval, the returned step_size must equal initial * clip(mean(all interval acceptances) / 0.5).

test_acceptance_target_zero_rejected()[source]

acceptance_target=0 would divide by zero in the step-size controller; it must raise ValueError instead.

test_nonpositive_chunk_and_max_steps_rejected()[source]

chunk_size<=0 never advances total_steps (infinite loop) and max_steps<=0 is meaningless; both must raise ValueError.

test_burn_in_honours_adapt_step_size_false()[source]

burn_in with adapt_step_size=False must return the initial step_size unchanged (controller owned by the caller).