diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c39b366 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,67 @@ +# This action releases refnx on PyPI for every version tagged commit (e.g. v0.0.1) +name: PyPI/Github Release + +on: + push: + tags: + - "v*" + +jobs: + make_sdist: + name: Make sdist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Build sdist + run: pipx run build --sdist + + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: wheels-sdist + path: dist/*.tar.gz + + + pypi-publish: + name: Upload release to PyPI + runs-on: ubuntu-latest + needs: [ make_sdist ] + environment: + name: pypi + url: https://pypi.org/p/refellips + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + + steps: + - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 + with: + pattern: wheels-* + merge-multiple: true + path: dist + + - name: Upload to PyPI + uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 + with: + # repository-url: https://test.pypi.org/legacy/ + skip_existing: true + + + release-github: + runs-on: ubuntu-latest + needs: [ pypi-publish ] + + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 + with: + pattern: wheels-* + merge-multiple: true + path: dist + + - uses: ncipollo/release-action@bcfe5470707e8832e12347755757cec0eb3c22af # v1.18.0 + with: + artifacts: "dist/refellips*.tar.gz" + token: ${{ secrets.GITHUB_TOKEN }} + allowUpdates: true + generateReleaseNotes: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a411b09..ccf6413 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: max-parallel: 3 matrix: - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11"] + python-version: ["3.12"] steps: - uses: actions/checkout@v4 @@ -66,7 +66,7 @@ jobs: strategy: max-parallel: 1 matrix: - python-version: ["3.10"] + python-version: ["3.13"] steps: - uses: actions/checkout@v4 @@ -95,7 +95,7 @@ jobs: strategy: max-parallel: 1 matrix: - python-version: ["3.11"] + python-version: ["3.13"] steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 42106e5..caba7bc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -16,3 +16,4 @@ First release on PyPI 0.0.6 ----- +- added circular_difference to calculate shortest difference between two angles. diff --git a/pyproject.toml b/pyproject.toml index 5c74142..7f7d2bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,8 @@ [project] requires-python = ">=3.9" name = "refellips" -dynamic=["version", "description", "readme", "license", "classifiers", "urls", "authors"] \ No newline at end of file +dynamic=["version", "description", "readme", "license", "classifiers", "urls", "authors"] + +[tool.black] +line-length = 79 +extend-exclude="refnx/_lib/emcee/|refnx/_lib/ptemcee/|benchmarks" diff --git a/refellips/reflect_modelSE.py b/refellips/reflect_modelSE.py index 2d2396b..cb1593f 100644 --- a/refellips/reflect_modelSE.py +++ b/refellips/reflect_modelSE.py @@ -238,16 +238,26 @@ def Delta_Psi_TMM(AOI, layers, wavelength, delta_offset, reflect_delta=False): Wavelength of light. Units = nm layers: np.ndarray coefficients required for the calculation, has shape (2 + N, 4), - where N is the number of layers - layers[0, 1] - refractive index of fronting - layers[0, 2] - extinction coefficent of fronting - layers[N, 0] - thickness of layer N - layers[N, 1] - refractive index of layer N - layers[N, 2] - extinction coefficent of layer N - layers[N, 3] - roughness between layer N-1/N (IGNORED!) - layers[-1, 1] - refractive index of backing - layers[-1, 2] - extinction coefficent of backing - layers[-1, 3] - roughness between backing and last layer (IGNORED!) + where N is the number of layers. + + - layers[0, 1] + refractive index of fronting + - layers[0, 2] + extinction coefficent of fronting + - layers[N, 0] + thickness of layer N + - layers[N, 1] + refractive index of layer N + - layers[N, 2] + extinction coefficent of layer N + - layers[N, 3] + roughness between layer N-1/N (IGNORED!) + - layers[-1, 1] + refractive index of backing + - layers[-1, 2] + extinction coefficent of backing + - layers[-1, 3] + roughness between backing and last layer (IGNORED!) Returns ------- @@ -288,7 +298,7 @@ class ReflectModelSE: r""" Parameters ---------- - structure : refnx.reflect.Structure + structure : refellips.StructureSE The interfacial structure. name : str, optional Name of the Model diff --git a/refellips/structureSE.py b/refellips/structureSE.py index 25c69fc..407b914 100644 --- a/refellips/structureSE.py +++ b/refellips/structureSE.py @@ -268,7 +268,7 @@ def parameters(self): def slabs(self, structure=None): """ - Slab representation of this component. See :class:`Component.slabs` + Slab representation of this component. See :class:`ComponentSE.slabs` """ # speculative shortcut to prevent a number of attribute retrievals if self.ri.dispersive: