Parameters Functions#

parameters.py classes, methods, and functions

ogcore.parameters#

class ogcore.parameters.Specifications(output_base='OUTPUT_BASELINE', baseline_dir='OUTPUT_BASELINE', baseline=False, num_workers=1)[source]#

Inherits ParamTools Parameters abstract base class.

compute_default_params()[source]#

Does cheap calculations to return parameter values

Parameters:

None

Returns:

None

get_ubi_nom_objs()[source]#

Generate time series of nominal SxJ UBI household matrix and aggregate UBI expenditure over necessary time periods. Also generate steady-state versions

Parameters:

self – OG-Core Specifications class object

Returns:

T+S x S x J array time series of UBI

transfers in dollars for each type-j age-s household in every period t

Return type:

ubi_nom_array (array)

initialize()[source]#

ParametersBase reads JSON file and sets attributes to self Next call self.compute_default_params for further initialization

Parameters:

None

Returns:

None

update_specifications(revision, raise_errors=True)[source]#

Updates parameter specification with values in revision dictionary.

Parameters:
  • revision (dict) – dictionary or JSON string with one or more PARAM: VALUE pairs

  • raise_errors (boolean) –

    if True (the default), raises ValueError when

    parameter_errors exists;

    if False, does not raise ValueError when

    parameter_errors exists and leaves error handling to caller of the update_specifications method.

Returns:

None

Raises:

ValueError – if raise_errors is True AND _validate_parameter_names_types generates errors OR _validate_parameter_values generates errors.

Notes

Given a reform dictionary, typical usage of the Specifications class is as follows:

>>> specs = Specifications()
>>> specs.update_specifications(revision)
An example of a multi-parameter specification is as follows::
>>> revision = {
    frisch: [0.03]
}
ogcore.parameters.revision_warnings_errors(spec_revision)[source]#

Generate warnings and errors for OG-Core parameter specifications

Parameters:

spec_revision (dict) – dictionary suitable for use with the Specifications.update_specifications method.

Returns:

with endpoint specific warning and error messages

Return type:

rtn_dict (dict)