From 67f39d0c5703ec6a0ca5875e928041857ecbeb03 Mon Sep 17 00:00:00 2001 From: Ryan Roussel Date: Tue, 26 Nov 2024 09:55:38 -0600 Subject: [PATCH 1/3] bugfixes from run --- lcls_tools/common/devices/screen.py | 2 +- lcls_tools/common/measurements/emittance_measurement.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lcls_tools/common/devices/screen.py b/lcls_tools/common/devices/screen.py index 954c3aaf..49bce0a0 100644 --- a/lcls_tools/common/devices/screen.py +++ b/lcls_tools/common/devices/screen.py @@ -73,7 +73,7 @@ def image(self) -> np.ndarray: the camera associated with this screen """ return self.controls_information.PVs.image.get(as_numpy=True).reshape( - self.n_rows, self.n_columns + self.n_columns, self.n_rows ) @property diff --git a/lcls_tools/common/measurements/emittance_measurement.py b/lcls_tools/common/measurements/emittance_measurement.py index dc947243..3f4484a0 100644 --- a/lcls_tools/common/measurements/emittance_measurement.py +++ b/lcls_tools/common/measurements/emittance_measurement.py @@ -42,6 +42,7 @@ class QuadScanEmittance(Measurement): @field_validator("rmat") def validate_rmat(cls, v, info): assert v.shape == (4, 4) + return v def measure(self): """Returns the emittance, BMAG, x_rms and y_rms @@ -58,7 +59,7 @@ def measure(self): # get transport matrix and design twiss values from meme # TODO: get settings from arbitrary methods (ie. not meme) - if self.rmat is None and self.twiss is None: + if self.rmat is None and self.design_twiss is None: optics = get_optics( self.magnet_name, self.device_measurement.device.name, @@ -85,7 +86,7 @@ def measure(self): kmod = bdes_to_kmod(self.energy, magnet_length, np.array(self.scan_values)) # compute emittance and bmag - emittance, bmag, _, _ = compute_emit_bmag( + results = compute_emit_bmag( k=kmod, beamsize_squared=beamsize_squared, q_len=magnet_length, @@ -93,9 +94,7 @@ def measure(self): twiss_design=twiss_betas_alphas, ) - results = { - "emittance": emittance, - "BMAG": bmag, + results = results | { "x_rms": self.beam_sizes["x_rms"], "y_rms": self.beam_sizes["y_rms"] } From 692f52cbe8781d6171fab565aa9c47165121c1f3 Mon Sep 17 00:00:00 2001 From: Ryan Roussel Date: Tue, 26 Nov 2024 13:19:56 -0600 Subject: [PATCH 2/3] change dict update statement --- lcls_tools/common/measurements/emittance_measurement.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lcls_tools/common/measurements/emittance_measurement.py b/lcls_tools/common/measurements/emittance_measurement.py index 3f4484a0..34071b07 100644 --- a/lcls_tools/common/measurements/emittance_measurement.py +++ b/lcls_tools/common/measurements/emittance_measurement.py @@ -94,10 +94,10 @@ def measure(self): twiss_design=twiss_betas_alphas, ) - results = results | { + results = results.update({ "x_rms": self.beam_sizes["x_rms"], "y_rms": self.beam_sizes["y_rms"] - } + }) return results From b3a14d35f2f2ccad56904da79e78194227da6fcb Mon Sep 17 00:00:00 2001 From: Ryan Roussel Date: Wed, 27 Nov 2024 14:20:15 -0600 Subject: [PATCH 3/3] Update emittance_measurement.py --- lcls_tools/common/measurements/emittance_measurement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lcls_tools/common/measurements/emittance_measurement.py b/lcls_tools/common/measurements/emittance_measurement.py index 34071b07..4ae7a7b9 100644 --- a/lcls_tools/common/measurements/emittance_measurement.py +++ b/lcls_tools/common/measurements/emittance_measurement.py @@ -94,7 +94,7 @@ def measure(self): twiss_design=twiss_betas_alphas, ) - results = results.update({ + results.update({ "x_rms": self.beam_sizes["x_rms"], "y_rms": self.beam_sizes["y_rms"] })