Reading results Install with pip install simapy[all] to read HDF5 results and use pandas. Condition results need SIMA 5.4 or later. run_condition runs a condition and returns the results of the run: from pathlib import Path from simapy.sre import SIMA sima = SIMA() res = sima.run_condition( Path("output/beam"), # the workspace SIMA runs in task="SimpleBeam", condition="Initial", run_type="dynamic", variables={"Hs": 3.0, "Tp": 6.0}, ) peak = res.run.signal("Dynamic/BeamLine/segment_1/element_1/Axial force").y.max() Add stask=Path("input/beam.stask") to import the task first. Point open_results at the condition folder, <workspace>/<task>/<condition>. It finds the latest run in any timestamp folders inside it: from simapy.results import open_results res = open_results("output/simo/condition/BouncingBalls/conditionSet") signal = res.run.signal("conditionSet_1/Dynamic/BALL1/Global total position/ZG translation") signal.unit, signal.xunit, len(signal) # ('m', 's', 5000) signal.y[:3] # array([30. , 29.99555016, 29.98225212]) The tree is the one SIMA’s post processor shows. res.run is the condition, or for a condition set, the set with one condition per member: [c.name for c in res.run.containers if c.type == "condition"] # ['conditionSet_1', ...] 1. Workflow output Open the file a workflow’s file output node writes: res = open_results("output/workflow/ws/out.json") res.run.signal("some_data/mysine_frompy").unit # '-' Prefer HDF5 for large output: JSON is read whole when opened. 2. Finding signals signal() and container() take a path, and [] takes the same path and returns either: res.run.signal("Static/RiserLine/Static forces/EFF. TENSION") res.run.container("Static/RiserLine") select picks several signals with SIMA’s signal requirements: res.select("*.Dynamic.*.F-MAX") res.select(name=["XG translation", "YG translation"]) res.select("*.RiserLine.*", name="F-MAX") A positional argument is a path of names joined by ., from the task down: Simple_Flexible_Riser.Initial.Dynamic.RiserLine.Force envelope curve.F-MAX. * matches anything, across levels too. A container selects everything in it. Keyword arguments match attributes such as name, type or unit. A list matches any of its values, and all keywords must match. select returns a dict from each signal’s path, relative to where you called it, to the signal. 3. numpy arrays .x and .y are numpy arrays, read from the file when first used: import numpy as np tension = res.run.signal("Static/RiserLine/Static forces/EFF. TENSION") tension.y.max(), tension.y.mean(), tension.y.std() np.trapezoid(tension.y, tension.x) # area under the curve tension.x[tension.y > 1.8e5] # where along the line it exceeds 180 kN For a fixed time step, .x is computed from the start and the step: signal.is_equidistant # True signal.xstart, signal.xdelta # (0.0, 0.019999999552965164) 4. Units Values are in SI base units: a force written in kN reads as N, a mass in Mg as kg. .to() returns a converted copy: tension.unit, tension.y[:3] # 'N', [183114.1 184240.9 185366. ] tension.to("kN").y[:3] # [183.1141 184.2409 185.366 ] tension.to("tonne").y[0] # 18.672441659486168 tension.to(xunit="mm").x[:3] # [1000. 3000. 5000.] Degrees, radians, seconds, hours, Hz and rpm stay as written: lift = open_results("output/simo/condition/Heavy_Lifting_Operation/Initial") rotation = lift.run.signal("Dynamic/Platform/Global total position/XB rotation") rotation.unit, rotation.y[:3] # 'deg', [-2.48208284 -2.48203874 -2.48190641] rotation.to("rad").y[:3] # [-0.04332052 -0.04331975 -0.04331744] Values in a unit SIMA does not know are left as written, with a warning. 4.1. Condition variables A run’s variables come with their units: member = res.run.container("conditionSet_1") member.signal("Variables/kzz").unit # 'N*m' kzz = res.description.members[0].variables["kzz"] kzz # Variable(value=500.0, unit='N*m') print(kzz) # 500.0 [N*m] For a condition set, res.description.variables holds the variables the set keeps constant. 5. pandas A signal becomes a Series indexed by its x-axis: series = tension.to_series() series.name # 'EFF. TENSION' series.index.name # 'm' series.attrs # {'unit': 'N', 'xunit': 'm', 'line': 'RiserLine'} series.rolling(10).mean() series.loc[10.0:50.0] A container becomes a DataFrame, one column per signal: df = res.run.container("Static/RiserLine/Static forces").to_dataframe() # EFF. TENSION # m # 1.0 183114.1 # 3.0 184240.9 # 5.0 185366.0 recursive=True includes sub-containers, and fails when their x-axes differ: res.run.container("Static/RiserLine").to_dataframe(recursive=True) # ValueError: 'XZ' and 'YZ' do not share an x-axis (same 66 samples, different x values). # Frame each container separately. index=False puts the columns side by side by position instead. signals_to_frame frames signals from several runs that share an x-axis. 6. Examples Example What it shows Run conditions in parallel Three runs of one model, compared. Read SIMO results A condition set, its members compared. Results as pandas Series, DataFrame, and one column per member. Working with SIMA Examples