base_case_reader.py

Base class for all CaseReaders.

class openmdao.recorders.base_case_reader.BaseCaseReader(filename, pre_load=False)[source]

Bases: object

Base class of all CaseReader implementations.

Attributes

problem_metadata

(dict) Metadata about the problem, including the system hierachy and connections.

solver_metadata

(dict) The solver options for each solver in the recorded model.

system_metadata

(dict) Metadata about each system in the recorded model, including options and scaling factors.

__init__(self, filename, pre_load=False)[source]

Initialize.

Parameters
filenamestr

The path to the file containing the recorded data.

pre_loadbool

If True, load all the data into memory during initialization.

get_case(self, case_id, recurse=True)[source]

Get case identified by case_id.

Parameters
case_idstr or int

The unique identifier of the case to return or an index into all cases.

recursebool, optional

If True, will return all successors to the case as well.

Returns
dict

The case identified by case_id

get_cases(self, source, recurse=True, flat=False)[source]

Iterate over the cases.

Parameters
source{‘problem’, ‘driver’, <system hierarchy location>, <solver hierarchy location>,

case name} Identifies which cases to return.

recursebool, optional

If True, will enable iterating over all successors in case hierarchy

flatbool, optional

If False and there are child cases, then a nested ordered dictionary is returned rather than an iterator.

Returns
list or dict

The cases identified by source

list_cases(self, source=None, recurse=True, flat=True)[source]

Iterate over Driver, Solver and System cases in order.

Parameters
source{‘problem’, ‘driver’, <system hierarchy location>, <solver hierarchy location>,

case name} If not None, only cases originating from the specified source or case are returned.

recursebool, optional

If True, will enable iterating over all successors in case hierarchy.

flatbool, optional

If False and there are child cases, then a nested ordered dictionary is returned rather than an iterator.

Returns
iterator or dict

An iterator or a nested dictionary of identified cases.

list_source_vars(self, source)[source]

List of all inputs and outputs recorded by the specified source.

Parameters
source{‘problem’, ‘driver’, <system hierarchy location>, <solver hierarchy location>}

Identifies the source for which to return information.

Returns
dict

{‘inputs’:[list of keys], ‘outputs’:[list of keys]}. Does not recurse.

list_sources(self)[source]

List of all the different recording sources for which there is recorded data.

Returns
list
One or more of: ‘problem’, ‘driver’, <system hierarchy location>,

<solver hierarchy location>