pqp.refutation package¶
Submodules¶
pqp.refutation.result module¶
- class pqp.refutation.result.Assumption(name)¶
Bases:
object
Class representing a modeling assumption
- name¶
the name of the assumption
- Type:
str
- class pqp.refutation.result.Derived(name, value)¶
Bases:
object
Class representing a derived value or expression
- name¶
the name of the derived value
- Type:
str
- value¶
the derived value
- Type:
Any
- class pqp.refutation.result.Operation(op, args, kwargs)¶
Bases:
object
Class used to track the computational graph of function calls which led to a result
- op¶
the function which was called
- Type:
Callable
- args¶
the arguments passed to the function
- Type:
list
- kwargs¶
the keyword arguments passed to the function
- Type:
dict
- class pqp.refutation.result.Result(operation, step)¶
Bases:
object
Class to store results of computation and store dependencies in a graph
- explain(nested=False)¶
Prints a human-readable explanation of the result to the console.
- Parameters:
nested (bool) – if True, will print the explanation of all prior steps as well
- explain_all()¶
Prints a human-readable explanation of the result to the console, including all prior steps. Equivalent to calling self.explain(nested=True)
- get_dependencies()¶
Returns a list of all results which this result directly depends on
- Returns:
the list of dependencies
- Return type:
List[Result]
- get_nested_dependencies()¶
Returns a list of all results which this result depends on, including indirect dependencies
- Returns:
the list of dependencies
- Return type:
List[Result]
- class pqp.refutation.result.Step(name)¶
Bases:
object
Human-interpretable notes on how a result was derived
Subroutes in the library should use this class to record the steps taken to derive a result. This class is not intended to be used by end-users.
- Parameters:
name (
str
) – the name of the step
- assume(assumption)¶
Add an assumption to the derivation
- Parameters:
assumption (
Assumption
orstr
) – the assumption to add- Returns:
None
- explain(pad=True)¶
Print an explanation of the derivation of the result
- result(key, value)¶
Record the value derived during the step
- Parameters:
key (
str
) – the name of the derived valuevalue (
Any
) – the derived value
- Returns:
None
- substep(name)¶
Add a substep to the derivation
- Parameters:
name (
str
) – the name of the substep- Returns:
the substep
- Return type:
Step
- write(msg)¶
Add a note about the derivation
- Parameters:
msg (
str
) – the message to add- Returns:
None
- pqp.refutation.result.entrypoint(step_name, result_class=<class 'pqp.refutation.result.Result'>)¶
Wrapper for logical steps in the assumption management system
- Parameters:
step_name (
str
) – the name of theStep
(human readable)result_class (
class
) – used to store results of theStep
, must be a subclass ofResult
- Returns:
wrapper for functions implementing logical steps in an analysis
- Return type:
decorator
This function returns a a decorator which can be used to wrap a method implementing a step, a
Step
instance is passed as a keyword argument (“step”) to the method and should be used to record substeps, assumptions, and results. The method should not return a value.The three core constructs of the assumption management system are
Assumption
s,Step
s, andResult
s. A step is a logical unit of work encapsulated in a single method, which may be composed of multiple substeps. During the process of calculation, the method can report logical substeps, assumptions it is making, results as they are computed, and notes for the user. This information is consolidated into the Step object, which stores references to previous steps in the analysis in a graph representing the entire computation. This way, metadata about the computation is available at all times and can be used by both the user and automated sensitivity analysis tools.