Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
14 changes: 7 additions & 7 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: true
matrix:
platform: [windows-latest, ubuntu-latest, macos-13, macos-14]
platform: [windows-2022, ubuntu-latest, macos-13, macos-14]
env:
CIBW_SKIP: 'pp*'
CIBW_ARCHS: 'auto64'
Expand All @@ -34,19 +34,19 @@ jobs:
- name: Install OMP (MacOS Intel)
if: matrix.platform == 'macos-13'
run: |
brew install llvm libomp
echo "export CC=/usr/local/opt/llvm/bin/clang" >> ~/.bashrc
echo "export CXX=/usr/local/opt/llvm/bin/clang++" >> ~/.bashrc
brew install llvm@20 libomp
echo "export CC=/usr/local/opt/llvm@20/bin/clang" >> ~/.bashrc
echo "export CXX=/usr/local/opt/llvm@20/bin/clang++" >> ~/.bashrc
echo "export CFLAGS=\"$CFLAGS -I/usr/local/opt/libomp/include\"" >> ~/.bashrc
echo "export CXXFLAGS=\"$CXXFLAGS -I/usr/local/opt/libomp/include\"" >> ~/.bashrc
echo "export LDFLAGS=\"$LDFLAGS -Wl,-rpath,/usr/local/opt/libomp/lib -L/usr/local/opt/libomp/lib -lomp\"" >> ~/.bashrc
source ~/.bashrc
- name: Install OMP (MacOS M1)
if: matrix.platform == 'macos-14'
run: |
brew install llvm libomp
echo "export CC=/opt/homebrew/opt/llvm/bin/clang" >> ~/.bashrc
echo "export CXX=/opt/homebrew/opt/llvm/bin/clang++" >> ~/.bashrc
brew install llvm@20 libomp
echo "export CC=/opt/homebrew/opt/llvm@20/bin/clang" >> ~/.bashrc
echo "export CXX=/opt/homebrew/opt/llvm@20/bin/clang++" >> ~/.bashrc
echo "export CFLAGS=\"$CFLAGS -I/opt/homebrew/opt/libomp/include\"" >> ~/.bashrc
echo "export CXXFLAGS=\"$CXXFLAGS -I/opt/homebrew/opt/libomp/include\"" >> ~/.bashrc
echo "export LDFLAGS=\"$LDFLAGS -Wl,-rpath,/opt/homebrew/opt/libomp/lib -L/opt/homebrew/opt/libomp/lib -lomp\"" >> ~/.bashrc
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/run_ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3
with:
version: "0.12.x"
- run: ruff format --check

14 changes: 7 additions & 7 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [windows-latest, ubuntu-latest, macos-13, macos-14]
platform: [windows-2022, ubuntu-latest, macos-13, macos-14]
version: ["3.10", "3.13"]
defaults:
run:
Expand All @@ -38,19 +38,19 @@ jobs:
- name: Install OMP (MacOS Intel)
if: matrix.platform == 'macos-13'
run: |
brew install llvm libomp
echo "export CC=/usr/local/opt/llvm/bin/clang" >> ~/.bashrc
echo "export CXX=/usr/local/opt/llvm/bin/clang++" >> ~/.bashrc
brew install llvm@20 libomp
echo "export CC=/usr/local/opt/llvm@20/bin/clang" >> ~/.bashrc
echo "export CXX=/usr/local/opt/llvm@20/bin/clang++" >> ~/.bashrc
echo "export CFLAGS=\"$CFLAGS -I/usr/local/opt/libomp/include\"" >> ~/.bashrc
echo "export CXXFLAGS=\"$CXXFLAGS -I/usr/local/opt/libomp/include\"" >> ~/.bashrc
echo "export LDFLAGS=\"$LDFLAGS -Wl,-rpath,/usr/local/opt/libomp/lib -L/usr/local/opt/libomp/lib -lomp\"" >> ~/.bashrc
source ~/.bashrc
- name: Install OMP (MacOS M1)
if: matrix.platform == 'macos-14'
run: |
brew install llvm libomp
echo "export CC=/opt/homebrew/opt/llvm/bin/clang" >> ~/.bashrc
echo "export CXX=/opt/homebrew/opt/llvm/bin/clang++" >> ~/.bashrc
brew install llvm@20 libomp
echo "export CC=/opt/homebrew/opt/llvm@20/bin/clang" >> ~/.bashrc
echo "export CXX=/opt/homebrew/opt/llvm@20/bin/clang++" >> ~/.bashrc
echo "export CFLAGS=\"$CFLAGS -I/opt/homebrew/opt/libomp/include\"" >> ~/.bashrc
echo "export CXXFLAGS=\"$CXXFLAGS -I/opt/homebrew/opt/libomp/include\"" >> ~/.bashrc
echo "export LDFLAGS=\"$LDFLAGS -Wl,-rpath,/opt/homebrew/opt/libomp/lib -L/opt/homebrew/opt/libomp/lib -lomp\"" >> ~/.bashrc
Expand Down
13 changes: 5 additions & 8 deletions ratapi/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,16 @@ def delete_IPC(self):
os.remove(self._IPCFilePath)
return None

def save(self, path: Union[str, Path], filename: str = "controls"):
def save(self, filepath: Union[str, Path] = "./controls.json"):
"""Save a controls object to a JSON file.

Parameters
----------
path : str or Path
The directory in which the controls object will be written.
filename : str
The name for the JSON file containing the controls object.

filepath : str or Path
The path to where the controls file will be written.
"""
file = Path(path, f"{filename.removesuffix('.json')}.json")
file.write_text(self.model_dump_json())
filepath = Path(filepath).with_suffix(".json")
filepath.write_text(self.model_dump_json())

@classmethod
def load(cls, path: Union[str, Path]) -> "Controls":
Expand Down
9 changes: 4 additions & 5 deletions ratapi/examples/normal_reflectivity/custom_XY_DSPC.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""A custom XY model for a supported DSPC bilayer."""

import math

import numpy as np
from scipy.special import erf


def custom_XY_DSPC(params, bulk_in, bulk_out, contrast):
Expand Down Expand Up @@ -114,7 +113,7 @@ def custom_XY_DSPC(params, bulk_in, bulk_out, contrast):
totSLD = sldSilicon + sldOxide + sldHeadL + sldTails + sldHeadR + sldWat

# Make the SLD array for output
SLD = [[a, b] for (a, b) in zip(z, totSLD)]
SLD = np.column_stack((z, totSLD))

return SLD, subRough

Expand All @@ -132,8 +131,8 @@ def layer(z, prevLaySurf, thickness, height, Sigma_L, Sigma_R):
a = (z - left) / ((2**0.5) * Sigma_L)
b = (z - right) / ((2**0.5) * Sigma_R)

erf_a = np.array([math.erf(value) for value in a])
erf_b = np.array([math.erf(value) for value in b])
erf_a = erf(a)
erf_b = erf(b)

VF = np.array((height / 2) * (erf_a - erf_b))

Expand Down
Loading