Tracers#

The policyengine_core.tracers module contains classes used to represent tracers, which are used to track the computation involved in calculating variables.

ComputationLog#

class policyengine_core.tracers.computation_log.ComputationLog(full_tracer: FullTracer)[source]#

Bases: object

print_log(aggregate=False, max_depth=100) → None[source]#

Print the computation log of a simulation.

If aggregate is False (default), print the value of each computed vector.

If aggregate is True, only print the minimum, maximum, and average value of each computed vector.

This mode is more suited for simulations on a large population.

If max_depth is None (default), print the entire computation.

If max_depth is set, for example to 3, only print computed vectors up to a depth of max_depth.

FlatTrace#

class policyengine_core.tracers.flat_trace.FlatTrace(full_tracer: FullTracer)[source]#

Bases: object

FullTracer#

class policyengine_core.tracers.full_tracer.FullTracer[source]#

Bases: object

PerformanceLog#

class policyengine_core.tracers.performance_log.PerformanceLog(full_tracer: FullTracer)#

Bases: object

SimpleTracer#

class policyengine_core.tracers.simple_tracer.SimpleTracer[source]#

Bases: object

TraceNode#

class policyengine_core.tracers.trace_node.TraceNode(name: 'str', period: 'str', branch_name: 'str' = 'default', parent: 'typing.Optional[TraceNode]' = None, children: 'typing.List[TraceNode]' = <factory>, parameters: 'typing.List[TraceNode]' = <factory>, value: 'typing.Optional[Array]' = None, start: 'float' = 0, end: 'float' = 0)[source]#

Bases: object

TracingParameterNode#

class policyengine_core.tracers.tracing_parameter_node_at_instant.TracingParameterNode(parameter_node: ParameterNode, tracer: FullTracer, branch_name: str)#

Bases: object

The parameter tree as the formulas of one traced simulation see it.

Calling it at an instant returns a TracingParameterNodeAtInstant that records every parameter a formula reads in tracer, under branch_name. Any other attribute is read from the wrapped node.

The wrapped node is never modified, so tracing one simulation does not trace the tax-benefit system it shares with other simulations, branches and clones. Like TracingParameterNodeAtInstant, it is not an instance of the class it wraps.

TracingParameterNodeAtInstant#

class policyengine_core.tracers.tracing_parameter_node_at_instant.TracingParameterNodeAtInstant(parameter_node_at_instant: ParameterNode, tracer: tracers.FullTracer, branch_name: str)#

Bases: object