Skip to content

Commit

Permalink
Merge pull request #12 from maxiv-science/ignore-orientation-accept-dict
Browse files Browse the repository at this point in the history
Ignore orientation accept dict
  • Loading branch information
meghdadyazdi authored Oct 28, 2024
2 parents f7e20a5 + 5651167 commit 774eac3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions azint/azint.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def from_file(cls, filename):

det_name = config['detector']
det_config = json.loads(config['detector_config'])
if "orientation" in config['detector_config']:
det_config.pop("orientation", None)
det = Detector.factory(det_name, det_config)
return cls(det,
float(config['distance']),
Expand All @@ -46,6 +48,23 @@ def from_file(cls, filename):
float(config['rot3']),
float(config['wavelength']))

@classmethod
def from_dict(cls, config):
det_name = config['detector']
det_config = {}
if 'detector_config' in config:
det_config = json.loads(config['detector_config'])
if "orientation" in config['detector_config']:
det_config.pop("orientation", None)
det = Detector.factory(det_name, det_config)
return cls(det,
float(config['distance']),
float(config['poni1']),
float(config['poni2']),
float(config['rot1']),
float(config['rot2']),
float(config['rot3']),
float(config['wavelength']))

def rotation_matrix(poni: Poni):
cos_rot1 = np.cos(poni.rot1)
Expand Down Expand Up @@ -170,6 +189,9 @@ def __init__(self,
if isinstance(poni, str):
poni = Poni.from_file(poni)

if isinstance(poni, dict):
poni = Poni.from_dict(poni)

self.unit = unit
self.error_model = error_model

Expand Down

0 comments on commit 774eac3

Please sign in to comment.