MCPcopy Create free account
hub / github.com/Derive-Risk/pyfair / __init__

Method __init__

pyfair/report/tree_graph.py:50–73  ·  view source on GitHub ↗
(self, model, format_strings)

Source from the content-addressed store, hash-verified

48 )
49
50 def __init__(self, model, format_strings):
51 self._colormap = {'Not Required': 'grey', 'Supplied': 'green', 'Calculated': 'blue'}
52 self._results = model.export_results().T
53 self._format_strings = format_strings
54 # Calculate mean and standard deviation for results
55 self._result_summary = pd.DataFrame({
56 'μ': self._results.mean(axis=1),
57 'σ': self._results.std(axis=1),
58 '↑': self._results.max(axis=1),
59 })
60 # Make status input into a dataframe.
61 self._statuses = model.get_node_statuses()
62 self._process_statuses()
63 # Make params a frame (must occur after process_statuses())
64 self._params = pd.DataFrame(model.export_params()).T.reindex(self._statuses.index)
65 # Tack all data together
66 self._data = pd.concat([
67 self._statuses,
68 self._DIMENSIONS,
69 self._result_summary,
70 self._params
71 ], axis=1, sort=True)
72 # Add format strinsg (forgot to add previously)
73 self._data['formatter'] = pd.Series(self._format_strings)
74
75 def _process_statuses(self):
76 """Turn dict into df and add color column"""

Callers

nothing calls this directly

Calls 4

_process_statusesMethod · 0.95
export_resultsMethod · 0.45
get_node_statusesMethod · 0.45
export_paramsMethod · 0.45

Tested by

no test coverage detected