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
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.10.1-23-g55e8e0e
_commit: v0.10.1-25-ga5301e9
_src_path: gh:easyscience/templates
app_docs_url: https://easyscience.github.io/dynamics-app
app_doi: 10.5281/zenodo.18877180
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-14, windows-2022]
os: [ubuntu-24.04, macos-15, windows-2022]

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-14, windows-2022]
os: [ubuntu-24.04, macos-15, windows-2022]

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -202,11 +202,8 @@ jobs:
echo "Adding Python $py_ver"
pixi add "python=$py_ver"

echo "Adding Conda dependencies"
pixi add gsl

#echo "Adding PyPI dependencies"
#pixi add --pypi pytest pytest-xdist
echo "Setting macOS 14.0 as minimum required"
pixi project system-requirements add macos 14.0

echo "Looking for wheel in ../dist/py$py_ver/"
ls -l "../dist/py$py_ver/"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
</picture>
</p>

**EasyDynamics** is a software for plotting and fitting QENS and INS
powder data.
**EasyDynamics** is a software package for plotting and fitting neutron
spectroscopy data (QENS and INS), mainly dedicated to amorphous
materials and crystalline powders.

<!-- HOME REPOSITORY SECTION -->

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![](assets/images/logo_dark.svg#gh-dark-mode-only)![](assets/images/logo_light.svg#gh-light-mode-only)

# QENS data analysis
# Neutron spectroscopy data analysis

Here is a brief overview of the main documentation sections:

Expand Down
5 changes: 3 additions & 2 deletions docs/docs/introduction/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ icon: material/information-slab-circle

## Description

**EasyDynamics** is a software for plotting and fitting QENS and INS
powder data.
**EasyDynamics** is a software package for plotting and fitting neutron
spectroscopy data (QENS and INS), mainly dedicated to amorphous
materials and crystalline powders

**EasyDynamics** is developed both as a Python library and as a
cross-platform desktop application.
Expand Down
5 changes: 2 additions & 3 deletions docs/docs/tutorials/analysis1d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@
")\n",
"\n",
"fit_result = my_analysis.fit()\n",
"fig = my_analysis.plot_data_and_model()\n",
"fig"
"my_analysis.plot_data_and_model()"
]
}
],
Expand All @@ -102,7 +101,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.13"
"version": "3.12.12"
}
},
"nbformat": 4,
Expand Down
31 changes: 29 additions & 2 deletions docs/docs/tutorials/components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"from easydynamics.sample_model import DampedHarmonicOscillator\n",
"from easydynamics.sample_model import DeltaFunction\n",
"from easydynamics.sample_model import Exponential\n",
"from easydynamics.sample_model import ExpressionComponent\n",
"from easydynamics.sample_model import Gaussian\n",
"from easydynamics.sample_model import Lorentzian\n",
"from easydynamics.sample_model import Polynomial\n",
Expand Down Expand Up @@ -123,11 +124,37 @@
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9a113170",
"metadata": {},
"outputs": [],
"source": [
"expr = ExpressionComponent(\n",
" 'A * exp(-(x - x0)**2 / (2*sigma**2)) +B*sin(2*pi*x/period)',\n",
" parameters={'A': 10, 'x0': 0, 'sigma': 1},\n",
")\n",
"\n",
"expr.A = 5\n",
"expr.sigma = 0.5\n",
"\n",
"expr.period = 2.0\n",
"\n",
"x = np.linspace(-5, 5, 100)\n",
"y = expr.evaluate(x)\n",
"\n",
"plt.figure()\n",
"plt.plot(x, y, label='Expression Component')\n",
"plt.legend()\n",
"plt.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "easydynamics_newbase",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -141,7 +168,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.12"
"version": "3.12.13"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/tutorials/convolution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"from easydynamics.sample_model import Gaussian\n",
"from easydynamics.sample_model import Lorentzian\n",
"from easydynamics.sample_model.component_collection import ComponentCollection\n",
"from easydynamics.utils import _detailed_balance_factor as detailed_balance_factor\n",
"from easydynamics.utils import detailed_balance_factor\n",
"\n",
"%matplotlib widget"
]
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/tutorials/detailed_balance.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from easydynamics.utils import _detailed_balance_factor as detailed_balance_factor\n",
"from easydynamics.utils import detailed_balance_factor\n",
"\n",
"%matplotlib widget"
]
Expand Down
48 changes: 18 additions & 30 deletions docs/docs/tutorials/tutorial1_brownian.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
"metadata": {},
"outputs": [],
"source": [
"diffusion_experiment.plot_data(slicer=True)"
"diffusion_experiment.plot_data(slicer=True, ymax=4)"
]
},
{
Expand Down Expand Up @@ -366,7 +366,7 @@
"id": "927b8fb5",
"metadata": {},
"source": [
"We also create a new instrument_model and attach it to our analysis. We want to use the resolutin that we determined from the vanadium data. Ideally, we'd just attach it to the instrument model like before. However, this is currently not possible due to a small issue in EasyDynamics that will be fixed asap. For now, we need to hack it a bit."
"We also create a new instrument_model and attach it to our analysis, giving it the resolution model determined in the vanadium analysis. We further fix all parameters in the resolution model and normalize it."
]
},
{
Expand All @@ -378,20 +378,16 @@
"source": [
"instrument_model = InstrumentModel(\n",
" background_model=background_model,\n",
" resolution_model=vanadium_analysis.instrument_model.resolution_model,\n",
")\n",
"instrument_model.resolution_model.fix_all_parameters()\n",
"instrument_model.normalize_resolution()\n",
"\n",
"diffusion_analysis = Analysis(\n",
" display_name='Diffusion Analysis',\n",
" experiment=diffusion_experiment,\n",
" sample_model=sample_model,\n",
" instrument_model=instrument_model,\n",
")\n",
"\n",
"# We need to hack in the resolution model from the vanadium analysis,\n",
"# since the setters and getters overwrite the model. This will be fixed\n",
"# asap.\n",
"diffusion_analysis.instrument_model._resolution_model = (\n",
" vanadium_analysis.instrument_model.resolution_model\n",
")"
]
},
Expand All @@ -403,17 +399,6 @@
"We don't want to fit our resolution anymore, so we fix all the parameters in it."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18e2f0bf",
"metadata": {},
"outputs": [],
"source": [
"# We fix all parameters of the resolution model.\n",
"diffusion_analysis.instrument_model.resolution_model.fix_all_parameters()"
]
},
{
"cell_type": "markdown",
"id": "e366a05d",
Expand Down Expand Up @@ -506,10 +491,19 @@
" diffusion_models=diffusion_model,\n",
")\n",
"\n",
"background_model = BackgroundModel(components=Polynomial(coefficients=[0.001]))\n",
"\n",
"background_model = BackgroundModel(components=Polynomial(coefficients=[0.001]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "48370156",
"metadata": {},
"outputs": [],
"source": [
"instrument_model = InstrumentModel(\n",
" background_model=background_model,\n",
" resolution_model=vanadium_analysis.instrument_model.resolution_model,\n",
")"
]
},
Expand All @@ -518,7 +512,7 @@
"id": "8bb4abe9",
"metadata": {},
"source": [
"We attach all our models to a new `Analysis` object, again being mindful that we need to hack in the resolution. I promise this will be fixed soon!"
"We attach all our models to a new `Analysis` object."
]
},
{
Expand All @@ -535,12 +529,6 @@
" instrument_model=instrument_model,\n",
")\n",
"\n",
"# We again need to hack in the resolution model from the vanadium\n",
"# analysis, since the setters and getters overwrite the model. This will\n",
"# be fixed asap.\n",
"diffusion_model_analysis.instrument_model._resolution_model = (\n",
" vanadium_analysis.instrument_model.resolution_model\n",
")\n",
"diffusion_model_analysis.instrument_model.resolution_model.fix_all_parameters()"
]
},
Expand Down Expand Up @@ -578,7 +566,7 @@
"outputs": [],
"source": [
"diffusion_model_analysis.fit(fit_method='simultaneous')\n",
"diffusion_model_analysis.plot_data_and_model()"
"diffusion_model_analysis.plot_data_and_model(ymax=2)"
]
},
{
Expand Down
23 changes: 14 additions & 9 deletions docs/docs/tutorials/tutorial2_nanoparticles.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,17 @@
"background_model.components = polynomial\n",
"\n",
"\n",
"instrument_model = InstrumentModel(background_model=background_model)\n",
"instrument_model = InstrumentModel(\n",
" background_model=background_model,\n",
" resolution_model=res_analysis.instrument_model.resolution_model,\n",
")\n",
"instrument_model.resolution_model.fix_all_parameters()\n",
"instrument_model.normalize_resolution()\n",
"\n",
"\n",
"analysis = Analysis(\n",
" experiment=experiment, sample_model=sample_model, instrument_model=instrument_model\n",
")\n",
"analysis.instrument_model._resolution_model = res_analysis.instrument_model.resolution_model\n",
"analysis.instrument_model.resolution_model.fix_all_parameters()\n",
"\n",
"analysis.plot_data_and_model(logy=True)"
]
Expand Down Expand Up @@ -410,15 +413,17 @@
"polynomial = Polynomial(coefficients=[0.15])\n",
"background_model.components = polynomial\n",
"\n",
"instrument_model = InstrumentModel(background_model=background_model)\n",
"\n",
"instrument_model = InstrumentModel(\n",
" background_model=background_model,\n",
" resolution_model=res_analysis.instrument_model.resolution_model,\n",
")\n",
"instrument_model.resolution_model.fix_all_parameters()\n",
"instrument_model.normalize_resolution()\n",
"\n",
"# Create the analysis object\n",
"mag_analysis = Analysis(\n",
" experiment=experiment, sample_model=mag_sample_model, instrument_model=instrument_model\n",
")\n",
"mag_analysis.instrument_model._resolution_model = res_analysis.instrument_model.resolution_model\n",
"mag_analysis.instrument_model.resolution_model.fix_all_parameters()"
")"
]
},
{
Expand Down Expand Up @@ -614,7 +619,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.12"
"version": "3.12.13"
}
},
"nbformat": 4,
Expand Down
12 changes: 6 additions & 6 deletions docs/docs/user-guide/concept.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The goal of EasyDynamics is to make it easy to fit QENS and powder INS
data.
EasyDynamics is a a fitting tool for neutron spectroscopy, mainly
dedicated to amorphous materials and crystalline powders.

The fit is carried out by an `Analysis` object, which contains an
`Experiment` that contains the data, a `SampleModel` that describes the
Expand Down Expand Up @@ -44,10 +44,10 @@ like this:

```python
gaussian = Gaussian()
gaussian.area=2.0
gaussian.area.fixed=True
gaussian.width.fixed=False
gaussian.width.min=0.5
gaussian.area = 2.0
gaussian.area.fixed = True
gaussian.width.fixed = False
gaussian.width.min = 0.5
```

And so on.
Expand Down
Loading
Loading