From 9a4d9bc3e543edfe704c127c40220ca2601b741f Mon Sep 17 00:00:00 2001 From: "Sara A. Miskovich" Date: Thu, 6 Mar 2025 16:23:19 -0800 Subject: [PATCH 1/6] replace quad length value with variable --- pyemittance/emittance_calc.py | 2 +- pyemittance/optics.py | 8 ++++---- pyemittance/simulation.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyemittance/emittance_calc.py b/pyemittance/emittance_calc.py index 98ba5a5..1e67890 100644 --- a/pyemittance/emittance_calc.py +++ b/pyemittance/emittance_calc.py @@ -146,7 +146,7 @@ def get_emit(self): q = np.array(self.quad_vals[dim]) # quad vals are passed in machine units - kL = kL_from_machine_value(q, self.energy) + kL = kL_from_machine_value(q, self.energy, self.quad_len) bs = self.beam_vals[dim] bs_err = self.beam_vals_err[dim] diff --git a/pyemittance/optics.py b/pyemittance/optics.py index dcc8456..6f87a81 100644 --- a/pyemittance/optics.py +++ b/pyemittance/optics.py @@ -12,7 +12,7 @@ logger = logging.getLogger(__name__) -def kL_from_machine_value(quad_val, energy): +def kL_from_machine_value(quad_val, energy, quad_len): """ Calculates quadrupole strength from machine value. @@ -33,9 +33,9 @@ def kL_from_machine_value(quad_val, energy): gamma = energy / mec2 beta = np.sqrt(1 - 1 / gamma**2) - return c_light*quad_val * 0.1 / (beta * energy) # 1/m^2 + return c_light*quad_val * quad_len / (beta * energy) # 1/m^2 -def machine_value_from_kL(kL, energy): +def machine_value_from_kL(kL, energy, quad_len): """ Calculates machine value from quadrupole strength. @@ -55,7 +55,7 @@ def machine_value_from_kL(kL, energy): """ gamma = energy / mec2 beta = np.sqrt(1 - 1 / gamma**2) - return kL * beta * energy / c_light * 10 # 1/m -> kG + return kL * beta * energy / c_light / quad_len # 1/m -> kG diff --git a/pyemittance/simulation.py b/pyemittance/simulation.py index 619fb11..87009a3 100644 --- a/pyemittance/simulation.py +++ b/pyemittance/simulation.py @@ -222,7 +222,7 @@ def initial_sigma_matrix2(self, dim=''): return sigma_from_twiss(emit, beta, alpha) def screen_sigma(self, dim='x'): - kL = kL_from_machine_value(self.quad_value, self.energy) + kL = kL_from_machine_value(self.quad_value, self.energy, self.Lquad) sigma0 = self.initial_sigma_matrix2(dim) if dim == 'x': sign = 1 From eaf035c4071547c5190cb71eab1686e700382cc7 Mon Sep 17 00:00:00 2001 From: "Sara A. Miskovich" Date: Thu, 6 Mar 2025 16:25:42 -0800 Subject: [PATCH 2/6] adjust mamba version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fb7174..5f9c80b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - uses: conda-incubator/setup-miniconda@v2 with: python-version: ${{ matrix.python-version }} - mamba-version: "*" + mamba-version: "2.0.5" channels: conda-forge activate-environment: pyemittance-dev environment-file: environment-dev.yml From a86013bffa624dd34ddf3c3d02170f431004d226 Mon Sep 17 00:00:00 2001 From: "Sara A. Miskovich" Date: Thu, 6 Mar 2025 16:28:10 -0800 Subject: [PATCH 3/6] adjust python version for tests --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f9c80b..0cdaff8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.9] + python-version: [3.10] steps: - uses: actions/checkout@v3 - uses: conda-incubator/setup-miniconda@v2 From 0506f8df94f660fc168e08431fea1c6967e0516f Mon Sep 17 00:00:00 2001 From: "Sara A. Miskovich" Date: Thu, 6 Mar 2025 16:30:58 -0800 Subject: [PATCH 4/6] adjust conda install for test --- .github/workflows/ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0cdaff8..4febc46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,12 +11,13 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.10] + python-version: [3.9] steps: - - uses: actions/checkout@v3 - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/checkout@v4 + - uses: conda-incubator/setup-miniconda@v3 with: python-version: ${{ matrix.python-version }} + miniforge-version: latest mamba-version: "2.0.5" channels: conda-forge activate-environment: pyemittance-dev From 39a000f32d79e43491bf7fa211826cfcacb776a3 Mon Sep 17 00:00:00 2001 From: "Sara A. Miskovich" Date: Thu, 6 Mar 2025 16:34:17 -0800 Subject: [PATCH 5/6] adjust conda install for test --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4febc46..e2e0527 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,7 @@ jobs: - uses: conda-incubator/setup-miniconda@v3 with: python-version: ${{ matrix.python-version }} - miniforge-version: latest - mamba-version: "2.0.5" + mamba-version: "*" channels: conda-forge activate-environment: pyemittance-dev environment-file: environment-dev.yml From c82f499aded44fd385a5312c633424d0658f1b34 Mon Sep 17 00:00:00 2001 From: "Sara A. Miskovich" Date: Thu, 6 Mar 2025 16:37:11 -0800 Subject: [PATCH 6/6] update python version for deployment --- .github/workflows/pypi_upload.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pypi_upload.yml b/.github/workflows/pypi_upload.yml index 46edc42..b358b08 100644 --- a/.github/workflows/pypi_upload.yml +++ b/.github/workflows/pypi_upload.yml @@ -11,13 +11,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Python 3.7 + - name: Set up Python 3.9 uses: actions/setup-python@v1 with: - python-version: 3.7 + python-version: 3.9 - name: Install pypa/build run: >- python -m