from SimulationFramework.Framework_objects import frameworkElement
[docs]
class global_error(frameworkElement):
"""
Class defining a global error element.
"""
def __init__(
self,
*args,
**kwargs,
):
super(global_error, self).__init__(
*args,
**kwargs,
)
[docs]
def add_Error(self, type, sigma):
if type in global_Error_Types:
self.add_property(type, sigma)
def _write_ASTRA(self):
return self._write_ASTRA_dictionary(
dict([[key, {"value": value}] for key, value in self._errordict])
)
def _write_GPT(self, Brho, ccs="wcs", *args, **kwargs):
relpos, relrot = ccs.relative_position(self.middle, [0, 0, 0])
coord = self.gpt_coordinates(relpos, relrot)
output = (
str(self.objecttype)
+ "( "
+ ccs.name
+ ", "
+ coord
+ ", "
+ str(self.length)
+ ", "
+ str(Brho * self.k1)
+ ");\n"
)
return output