Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deepcopy of fiber units #2324

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/pyFAI/integrator/fiber.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,20 @@ def sample_orientation(self):

def parse_units(self, unit_ip, unit_oop, incident_angle=None, tilt_angle=None, sample_orientation=None):
if unit_ip is None:
unit_ip = units.get_unit_fiber("qip_nm^-1")
unit_ip = units.get_unit_fiber(name="qip_nm^-1")
elif isinstance(unit_ip, str):
unit_ip = units.get_unit_fiber(name=unit_ip)
elif isinstance(unit_ip, units.UnitFiber):
...
else:
unit_ip = units.to_unit(unit_ip)

if unit_oop is None:
unit_oop = units.get_unit_fiber("qoop_nm^-1")
unit_oop = units.get_unit_fiber(name="qoop_nm^-1")
elif isinstance(unit_oop, str):
unit_oop = units.get_unit_fiber(name=unit_oop)
elif isinstance(unit_oop, units.UnitFiber):
...
else:
unit_oop = units.to_unit(unit_oop)

Expand Down
4 changes: 3 additions & 1 deletion src/pyFAI/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
__status__ = "production"
__docformat__ = 'restructuredtext'

import copy
import logging
logger = logging.getLogger(__name__)
import numpy
Expand Down Expand Up @@ -990,7 +991,8 @@ def get_unit_fiber(name, incident_angle:float =0.0, tilt_angle:float =0.0, sampl
:param float tilt angle: roll angle. Its rotation axis is orthogonal to the beam, the horizontal axis of the lab frame
:param sample_orientation: 1-4, four different orientation of the fiber axis regarding the detector main axis, from 1 to 4 is +90º
"""
unit = RADIAL_UNITS.get(name, None)
unit = copy.deepcopy(RADIAL_UNITS.get(name, None))

if unit is not None:
unit.set_incident_angle(incident_angle)
unit.set_tilt_angle(tilt_angle)
Expand Down