From 7139d647773fd548f1ee8573d95b3bf25a78d693 Mon Sep 17 00:00:00 2001 From: Nils Krah Date: Sun, 14 Jan 2024 16:48:54 +0100 Subject: [PATCH] Rename GateObject.clone_user_info() to copy_user_info() --- opengate/base.py | 2 +- opengate/contrib/phantoms/nemaiec.py | 2 +- opengate/geometry/volumes.py | 2 +- opengate/tests/src/test059_tpsource_gantry_rot.py | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/opengate/base.py b/opengate/base.py index ae4cee21a..d5ba702d8 100644 --- a/opengate/base.py +++ b/opengate/base.py @@ -349,7 +349,7 @@ class GateObjectSingleton(metaclass=MetaUserInfoSingleton): class GateObject(metaclass=MetaUserInfo): user_info_defaults = {"name": (None, {"required": True})} - def clone_user_info(self, other_obj): + def copy_user_info(self, other_obj): for k in self.user_info.keys(): if k not in ["name", "_name"]: try: diff --git a/opengate/contrib/phantoms/nemaiec.py b/opengate/contrib/phantoms/nemaiec.py index e7d3f6a2e..aa5d8b83c 100644 --- a/opengate/contrib/phantoms/nemaiec.py +++ b/opengate/contrib/phantoms/nemaiec.py @@ -245,7 +245,7 @@ def add_iec_one_sphere( # capillary outer shell caps = sim.add_volume("Tubs", f"{name}_capillary_shell_{d}") - caps.clone_user_info(cap) + caps.copy_user_info(cap) caps.material = iec_plastic caps.rmax = cap_thick caps.rmin = cap.rmax diff --git a/opengate/geometry/volumes.py b/opengate/geometry/volumes.py index 6f1b793fb..0cd90ce0c 100644 --- a/opengate/geometry/volumes.py +++ b/opengate/geometry/volumes.py @@ -198,7 +198,7 @@ def __init__(self, *args, **kwargs): # except for the name of course if "template" in kwargs: # FIXME: use from_dictionary() - self.clone_user_info(kwargs["template"]) + self.copy_user_info(kwargs["template"]) # put back user infos which were explicitly passed as keyword argument for k in self.user_info.keys(): if k != "name": diff --git a/opengate/tests/src/test059_tpsource_gantry_rot.py b/opengate/tests/src/test059_tpsource_gantry_rot.py index 1a3ad29e2..5afa87050 100755 --- a/opengate/tests/src/test059_tpsource_gantry_rot.py +++ b/opengate/tests/src/test059_tpsource_gantry_rot.py @@ -90,16 +90,16 @@ ## ---- HBL Nozzle --- # FIXME : will change after volumes are refactored box_rot = sim.add_volume("Box", "box_rot") - box_rot.clone_user_info(box) + box_rot.copy_user_info(box) box_rot.rotation = Rotation.from_euler("y", -90, degrees=True).as_matrix() box_rot.translation = [1148.0, 0.0, 1000.0] nozzle_rot = sim.add_volume("Box", "nozzle_rot") - nozzle_rot.clone_user_info(nozzle) + nozzle_rot.copy_user_info(nozzle) nozzle_rot.mother = box_rot.name rashi_rot = sim.add_volume("Box", "rashi_rot") - rashi_rot.clone_user_info(rashi) + rashi_rot.copy_user_info(rashi) rashi_rot.mother = box_rot.name # ----------------------------------- @@ -113,7 +113,7 @@ # target 2 HBL phantom_rot = sim.add_volume("Box", "phantom_rot") - phantom_rot.clone_user_info(phantom) + phantom_rot.copy_user_info(phantom) phantom_rot.rotation = Rotation.from_euler("z", 90, degrees=True).as_matrix() phantom_rot.translation = [0.0, 0.0, 1000.0]