Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
26 changes: 26 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Codecov configuration
# https://docs.codecov.com/docs/codecov-yaml

github_checks:
annotations: true

comment:
layout: 'reach, diff, flags, files'
behavior: default
require_changes: false
require_base: false
require_head: true

coverage:
status:
project:
default:
target: auto
threshold: 1%
# Make project coverage informational (won't block PR)
informational: true
patch:
default:
target: auto
# Require patch coverage but with threshold
threshold: 1%
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WARNING: Do not edit this file manually.
# Any changes will be overwritten by Copier.
_commit: v0.11.3
_commit: v0.12.0
_src_path: gh:easyscience/templates
app_docs_url: https://easyscience.github.io/dynamics-app
app_doi: 10.5281/zenodo.18877180
Expand Down
26 changes: 1 addition & 25 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,32 +63,8 @@ jobs:
files: ./coverage-unit.xml
token: ${{ secrets.CODECOV_TOKEN }}

# Job 2: Run integration tests with coverage and upload to Codecov
integration-tests-coverage:
runs-on: ubuntu-latest

steps:
- name: Check-out repository
uses: actions/checkout@v6

- name: Set up pixi
uses: ./.github/actions/setup-pixi

- name: Run integration tests with coverage
run:
pixi run integration-tests-coverage --cov-report=xml:coverage-integration.xml

- name: Upload integration tests coverage to Codecov
if: ${{ !cancelled() }}
uses: ./.github/actions/upload-codecov
with:
name: integration-tests-job
flags: integration
files: ./coverage-integration.xml
token: ${{ secrets.CODECOV_TOKEN }}

# Job 4: Build and publish dashboard (reusable workflow)
run-reusable-workflows:
needs: [docstring-coverage, unit-tests-coverage, integration-tests-coverage] # depend on the previous jobs
needs: [docstring-coverage, unit-tests-coverage] # depend on the previous jobs
uses: ./.github/workflows/dashboard.yml
secrets: inherit
6 changes: 5 additions & 1 deletion .github/workflows/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ jobs:
- name: Set up pixi
uses: ./.github/actions/setup-pixi

# Install badgery into the active Pixi environment without modifying
# pixi.toml/pixi.lock. Using `pixi add` here re-solves the whole project
# and rebuilds the local editable package, which can cause intermittent
# Linux CI failures (`Text file busy`, os error 26).
- name: Install badgery
shell: bash
run: pixi add --pypi --git https://github.com/enhantica/badgery badgery
run: pixi run python -m pip install git+https://github.com/enhantica/badgery

- name: Run docstring coverage and code complexity/maintainability checks
run: |
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ docs/docs/assets/
# Node
node_modules

# Tox
.tox

# Misc
.benchmarks
.cache
Expand Down
13 changes: 0 additions & 13 deletions codecov.yml

This file was deleted.

9 changes: 8 additions & 1 deletion docs/docs/assets/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,14 @@ label.md-nav__title[for="__drawer"] {

/* Change the overall width of the page */
.md-grid {
max-width: 1280px;
max-width: 116em;
}

/* Keep prose line length stable when sidebars are hidden at narrower widths */
.md-main .md-content > .md-content__inner {
width: min(100%, 40.5em);
margin-left: auto !important;
margin-right: auto !important;
}

/* Needed for mkdocs-jupyter to show download and other buttons on top of the notebook */
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/tutorials/analysis1d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@
")\n",
"\n",
"fit_result = my_analysis.fit()\n",
"my_analysis.plot_data_and_model()"
"my_analysis.plot_data_and_model(plot_residuals=True)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (Pixi)",
"display_name": "Python 3",
"language": "python",
"name": "pixi-kernel-python3"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -101,7 +101,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.12"
"version": "3.14.5"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/tutorials/components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.4"
"version": "3.14.5"
}
},
"nbformat": 4,
Expand Down
118 changes: 118 additions & 0 deletions docs/docs/tutorials/delta_lorentz.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "0",
"metadata": {},
"source": [
"# Delta Lorentz\n",
"Model of Delta function and Lorentzian with intensities given by the Debye-Waller factor:\n",
"\n",
"$ I\n",
"= K \\exp \\left( \\frac{-\\langle u^2 \\rangle Q^2}{3} \\right)[A_0 \\delta(E) + A_1 L(E, \\Gamma)]\n",
"$,\n",
"\n",
"where $K$ is the scale factor, $\\langle u^2 \\rangle$ is the mean square displacement, $Q$ is\n",
"the scattering vector, $A_0$ and $A_1$ are the relative amplitudes of the delta function and\n",
"Lorentzian, respectively, with the constraint that $A_0+A_1=1$, and $L(E, \\Gamma)$ is the\n",
"Lorentzian function with width $\\Gamma$. $A_0$, $A_1$ and the width of the Lorentzian can be\n",
"the same at all $Q$ or be allowed to vary with $Q$.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1",
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from easydynamics.sample_model.diffusion_model.delta_lorentz import DeltaLorentz\n",
"\n",
"%matplotlib widget"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6d6e1984",
"metadata": {},
"outputs": [],
"source": [
"Q = np.linspace(0.5, 2, 7)\n",
"energy = np.linspace(-2, 2, 501)\n",
"scale = 1.0\n",
"mean_u_squared = 0.5\n",
"A_0 = 0.2\n",
"lorentzian_width = 0.2\n",
"\n",
"diffusion_model = DeltaLorentz(\n",
" scale=scale,\n",
" mean_u_squared=mean_u_squared,\n",
" A_0=A_0,\n",
" lorentzian_width=lorentzian_width,\n",
" allow_Q_variation={'A_0': True, 'lorentzian_width': True},\n",
" Q=Q,\n",
" lorentzian_name='Lorentzian',\n",
" delta_name='Delta function',\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "389aa3cd",
"metadata": {},
"outputs": [],
"source": [
"component_collections = diffusion_model.get_component_collections()\n",
"cmap = plt.cm.jet\n",
"nQ = len(component_collections)\n",
"plt.figure()\n",
"for Q_index in range(len(component_collections)):\n",
" color = cmap(Q_index / (nQ - 1))\n",
" y = component_collections[Q_index].evaluate(energy)\n",
" plt.plot(energy, y, label=f'Q={Q[Q_index]} Å^-1', color=color)\n",
"\n",
"plt.legend()\n",
"plt.show()\n",
"plt.xlabel('Energy (meV)')\n",
"plt.ylabel('Intensity (arb. units)')\n",
"plt.title('Delta-Lorentz Model')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bf360b45",
"metadata": {},
"outputs": [],
"source": [
"diffusion_model.get_all_variables()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
12 changes: 5 additions & 7 deletions docs/docs/tutorials/diffusion_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"metadata": {},
"source": [
"# Diffusion Model\n",
"We support several standard models of diffusion. Here we show an example of Browniand Translational Diffusion, where the scattering is a Lorentzian with width ($\\Gamma$) given by $\\Gamma = D Q^2$, where $D$ is the diffusion coefficient (in m$^2$/s) and $Q$ is the momentum transfer."
"We support several standard models of diffusion. Here we show an example of Brownian Translational Diffusion, where the scattering is a Lorentzian with width ($\\Gamma$) given by $\\Gamma = D Q^2$, where $D$ is the diffusion coefficient (in m$^2$/s) and $Q$ is the momentum transfer."
]
},
{
Expand Down Expand Up @@ -41,12 +41,10 @@
"diffusion_coefficient = 2.4e-9 # m^2/s\n",
"\n",
"diffusion_model = BrownianTranslationalDiffusion(\n",
" display_name='DiffusionModel',\n",
" scale=scale,\n",
" diffusion_coefficient=diffusion_coefficient,\n",
" display_name='DiffusionModel', scale=scale, diffusion_coefficient=diffusion_coefficient, Q=Q\n",
")\n",
"\n",
"component_collections = diffusion_model.create_component_collections(Q)\n",
"component_collections = diffusion_model.get_component_collections()\n",
"\n",
"\n",
"cmap = plt.cm.jet\n",
Expand Down Expand Up @@ -87,7 +85,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "easydynamics_newbase",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -101,7 +99,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.12"
"version": "3.14.4"
}
},
"nbformat": 4,
Expand Down
3 changes: 3 additions & 0 deletions docs/docs/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ tutorials.
balancing.
- [Diffusion model](diffusion_model.ipynb) – Learn how to create and use
a model of diffusion.
- [DeltaLorentz](delta_lorentz.ipynb) – Learn how to create and use a
model with a Delta function and a Lorentzian that have a shared
Debye-Waller-like Q-dependence.
- [Sample model](sample_model.ipynb) – Learn how to create a model of
the scattering from your sample including model components and
diffusion models.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/tutorials/sample_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.4"
"version": "3.14.5"
}
},
"nbformat": 4,
Expand Down
Loading
Loading