openfisca_core.tracers.
Tracer
[source]¶A tracer that records simulation steps to enable exploring calculation steps in details.
requested_calculations
¶set
containing calculations that have been directly requested by the client.
Value example:
>>> {'income_tax<2017-01>', 'basic_income<2017-01>'}
stack
¶list
of the calculations that have started, but have not finished. The first item is one of the requested_calculations
, and each other item is a dependency of the one preceding him. Note that after a calculation is finished, stack
is always []
.
Value example:
>>> ['income_tax<2017-01>', 'global_income<2017-01>', 'salary<2017-01>']
trace
¶dict
containing, for each calculation, its result and its immediate dependencies.
Value example:
{
'income_tax<2017-01>': {
'dependencies':['global_income<2017-01>', 'nb_children<2017-01>'],
'parameters' : {'taxes.income_tax_rate<2015-01>': 0.15, ...},
'value': 600
},
'global_income<2017-01>': {...}
}
usage_stats
¶dict
containing, for each variable computed, the number of times the variable was requested.
Value example:
{
'salary': {
'nb_requests': 17
},
'global_income': {
'nb_requests': 1
}
}
print_computation_log
(aggregate=False)[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.
print_trace
(variable_name, period, extra_params=None, max_depth=1, aggregate=False, ignore_zero=False)[source]¶Print value, the dependencies, and the dependencies values of the variable for the given period (and possibly the given set of extra parameters).
Parameters: |
|
---|
record_calculation_abortion
(variable_name, period, **parameters)[source]¶Record that OpenFisca aborted computing a variable. This removes all trace of this computation.
Parameters: |
|
---|
record_calculation_end
(variable_name, period, result, **parameters)[source]¶Record that OpenFisca finished computing a variable.
Parameters: |
|
---|
record_calculation_start
(variable_name, period, **parameters)[source]¶Record that OpenFisca started computing a variable.
Parameters: |
|
---|