Skip to content

Commit 48d06be

Browse files
committed
Improve docstring for getLinearizationOptions()
1 parent 78d155b commit 48d06be

1 file changed

Lines changed: 25 additions & 8 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -836,14 +836,31 @@ def getSimulationOptions(self, names: Optional[str | list[str]] = None) -> dict[
836836

837837
raise ModelicaSystemError("Unhandled input for getSimulationOptions()")
838838

839-
def getLinearizationOptions(self, names=None): # 9
840-
"""
841-
This method returns dict. The key is linearize option names and value is corresponding linearize option value.
842-
If name is None then the function will return dict which contain all linearize option names as key and value as corresponding values. eg., getLinearizationOptions()
843-
usage:
844-
>>> getLinearizationOptions()
845-
>>> getLinearizationOptions("Name1")
846-
>>> getLinearizationOptions(["Name1","Name2"])
839+
def getLinearizationOptions(self, names: Optional[str | list[str]] = None) -> dict | list:
840+
"""Get simulation options used for linearization.
841+
842+
Args:
843+
names: Either None (default), a string with the linearization option
844+
name, or a list of option name strings.
845+
846+
Returns:
847+
If `names` is None, a dict in the format
848+
{option_name: option_value} is returned.
849+
If `names` is a string, a single element list [option_value] is
850+
returned.
851+
If `names` is a list, a list with one value for each option name
852+
in names is returned: [option1_value, option2_value, ...].
853+
Some option values are returned as float when first initialized,
854+
but always as strings after setLinearizationOptions is used to
855+
change them.
856+
857+
Examples:
858+
>>> mod.getLinearizationOptions()
859+
{'startTime': 0.0, 'stopTime': 1.0, 'stepSize': 0.002, 'tolerance': 1e-08}
860+
>>> mod.getLinearizationOptions("stopTime")
861+
[1.0]
862+
>>> mod.getLinearizationOptions(["tolerance", "stopTime"])
863+
[1e-08, 1.0]
847864
"""
848865
if names is None:
849866
return self._linearOptions

0 commit comments

Comments
 (0)