FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 86e8d0ec authored by Mark Driver's avatar Mark Driver
Browse files

documentation updates.

parent f4a10de6
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ class RuntimeInformation(object):
self.output_dir = output_dir
def __eq__(self, other):
"""
"""Overload equality comparison operator.
Parameters
----------
......
......@@ -34,9 +34,36 @@ class Temperature(object):
TOLERANCE = 0.01
def __init__(self, temperature, temperature_unit):
"""
Parameters
----------
temperature : float
Temperature value.
temperature_unit : str
Unit for temperature.
Returns
-------
Temperature
"""
self.temperature = temperature
self.temperature_unit = temperature_unit
def __eq__(self, other):
"""Overload equality comparison operator.
Parameters
----------
other : object
object to compare.
Returns
-------
boolean
is equal.
"""
if other is None:
return False
if isinstance(other, type(self)):
......@@ -52,10 +79,26 @@ class Temperature(object):
return Temperature(temperature, temperature_unit)
def write_to_xml(self):
"""Write information to Etree representation of XML.
Returns
-------
temp_element : lxml.etree.Element
XML representation of Temperature.
"""
temp_element = etree.Element(PHASE_CALCULATOR + "Temperature", nsmap=PHASE_CALC_NAMESPACE_DICT)
temp_element.set(PHASE_CALCULATOR + "value", "{:.1f}".format(self.temperature))
temp_element.set(PHASE_CALCULATOR + "unit", self.temperature_unit)
return temp_element
def to_dict(self):
"""Convert to dictionary.
Returns
-------
dict
Dictionary representation.
"""
return {"temperature_value":self.temperature,
"temperature_unit":self.temperature_unit}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment