Skip to content

Commit

Permalink
Merge pull request #40 from scipp/guideline-adherence
Browse files Browse the repository at this point in the history
Guideline adherence
  • Loading branch information
jokasimr authored Mar 13, 2024
2 parents ac77b12 + f62978d commit 88b9e08
Show file tree
Hide file tree
Showing 25 changed files with 291 additions and 331 deletions.
1 change: 1 addition & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ requirements:
- sciline>=23.9.1
- scipp>=23.8.0
- scippneutron>=23.9.0
- essreduce
- python>=3.10

test:
Expand Down
61 changes: 22 additions & 39 deletions docs/examples/amor.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"import scipp as sc\n",
"import sciline\n",
"from essreflectometry.amor import providers, default_parameters\n",
"from essreflectometry.types import *"
"from essreflectometry.types import *\n",
"from essreflectometry.amor.data import providers as amor_data"
]
},
{
Expand All @@ -29,27 +30,17 @@
"metadata": {},
"outputs": [],
"source": [
"params = {\n",
" **default_parameters,\n",
" QBins: sc.geomspace(dim='Q', start=0.008, stop=0.075, num=200, unit='1/angstrom'),\n",
" SampleRotation[Sample]: sc.scalar(0.7989, unit='deg'),\n",
" Filename[Sample]: \"sample.nxs\",\n",
" SampleRotation[Reference]: sc.scalar(0.8389, unit='deg'),\n",
" Filename[Reference]: \"reference.nxs\",\n",
" WavelengthEdges: sc.array(dims=['wavelength'], values=[2.4, 16.0], unit='angstrom'),\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"pipeline = sciline.Pipeline(\n",
" providers,\n",
" params=params\n",
")"
"pl = sciline.Pipeline(\n",
" (*providers, *amor_data),\n",
" params=default_parameters\n",
")\n",
"\n",
"pl[QBins] = sc.geomspace(dim='Q', start=0.008, stop=0.075, num=200, unit='1/angstrom')\n",
"pl[SampleRotation[Sample]] = sc.scalar(0.7989, unit='deg')\n",
"pl[PoochFilename[Sample]] = \"sample.nxs\"\n",
"pl[SampleRotation[Reference]] = sc.scalar(0.8389, unit='deg')\n",
"pl[PoochFilename[Reference]] = \"reference.nxs\"\n",
"pl[WavelengthEdges] = sc.array(dims=['wavelength'], values=[2.4, 16.0], unit='angstrom')"
]
},
{
Expand All @@ -58,7 +49,7 @@
"metadata": {},
"outputs": [],
"source": [
"pipeline.visualize((NormalizedIofQ, QResolution), graph_attr={'rankdir': 'LR'})"
"pl.visualize((NormalizedIofQ, QResolution), graph_attr={'rankdir': 'LR'})"
]
},
{
Expand All @@ -68,7 +59,7 @@
"outputs": [],
"source": [
"# Compute I over Q and the standard deviation of Q\n",
"ioq, qstd = pipeline.compute((NormalizedIofQ, QResolution)).values()"
"ioq, qstd = pl.compute((NormalizedIofQ, QResolution)).values()"
]
},
{
Expand Down Expand Up @@ -103,7 +94,7 @@
"outputs": [],
"source": [
"from essreflectometry.types import ThetaData\n",
"pipeline.compute(ThetaData[Sample])\\\n",
"pl.compute(ThetaData[Sample])\\\n",
" .bins.concat('detector_number')\\\n",
" .hist(\n",
" theta=sc.linspace(dim='theta', start=0.0, stop=1.2, num=165, unit='deg').to(unit='rad'),\n",
Expand Down Expand Up @@ -149,22 +140,14 @@
"metadata": {},
"outputs": [],
"source": [
"providers_with_metadata = (\n",
" *providers,\n",
" *orso.providers,\n",
" *amor_orso.providers,\n",
")\n",
"for p in (*orso.providers, *amor_orso.providers):\n",
" pl.insert(p)\n",
"\n",
"params[orso.OrsoCreator] = orso.OrsoCreator(fileio.base.Person(\n",
"pl[orso.OrsoCreator] = orso.OrsoCreator(fileio.base.Person(\n",
" name='Max Mustermann',\n",
" affiliation='European Spallation Source ERIC',\n",
" contact='max.mustermann@ess.eu',\n",
"))\n",
"\n",
"metadata_pipeline = sciline.Pipeline(\n",
" providers_with_metadata,\n",
" params=params\n",
")"
"))"
]
},
{
Expand All @@ -180,7 +163,7 @@
"metadata": {},
"outputs": [],
"source": [
"iofq_dataset = metadata_pipeline.compute(orso.OrsoIofQDataset)"
"iofq_dataset = pl.compute(orso.OrsoIofQDataset)"
]
},
{
Expand Down Expand Up @@ -243,7 +226,7 @@
"metadata": {},
"outputs": [],
"source": [
"iofq_dataset.info.reduction.corrections = orso.find_corrections(metadata_pipeline.get(orso.OrsoIofQDataset))"
"iofq_dataset.info.reduction.corrections = orso.find_corrections(pl.get(orso.OrsoIofQDataset))"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies = [
"sciline>=23.9.1",
"scipp>=23.8.0",
"scippneutron>=23.9.0",
"essreduce",
]

dynamic = ["version"]
Expand Down
1 change: 1 addition & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ orsopy
sciline>=23.9.1
scipp>=23.8.0
scippneutron>=23.9.0
essreduce
31 changes: 18 additions & 13 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SHA1:697621007a6df52e05884bd9bf630052e4aa6fbe
# SHA1:1b431955cc8f1e9144b3b02f13d86b0693935140
#
# This file is autogenerated by pip-compile-multi
# To update, run:
Expand All @@ -15,16 +15,18 @@ click==8.1.7
# via dask
cloudpickle==3.0.0
# via dask
comm==0.2.1
comm==0.2.2
# via ipywidgets
contourpy==1.2.0
# via matplotlib
cycler==0.12.1
# via matplotlib
dask==2024.2.0
dask==2024.3.0
# via -r base.in
decorator==5.1.1
# via ipython
essreduce==24.3.11
# via -r base.in
exceptiongroup==1.2.0
# via ipython
executing==2.0.1
Expand All @@ -41,11 +43,11 @@ h5py==3.10.0
# scippnexus
idna==3.6
# via requests
importlib-metadata==7.0.1
importlib-metadata==7.0.2
# via dask
ipydatawidgets==4.3.5
# via pythreejs
ipython==8.22.1
ipython==8.22.2
# via ipywidgets
ipywidgets==8.1.2
# via
Expand Down Expand Up @@ -73,9 +75,9 @@ numpy==1.26.4
# scipp
# scippneutron
# scipy
orsopy==1.1.0
orsopy==1.2.0
# via -r base.in
packaging==23.2
packaging==24.0
# via
# dask
# matplotlib
Expand All @@ -102,9 +104,9 @@ pure-eval==0.2.2
# via stack-data
pygments==2.17.2
# via ipython
pyparsing==3.1.1
pyparsing==3.1.2
# via matplotlib
python-dateutil==2.8.2
python-dateutil==2.9.0.post0
# via
# -r base.in
# matplotlib
Expand All @@ -122,12 +124,15 @@ sciline==24.2.1
scipp==24.2.0
# via
# -r base.in
# essreduce
# scippneutron
# scippnexus
scippneutron==24.1.0
# via -r base.in
scippnexus==23.12.1
# via scippneutron
scippnexus==24.3.1
# via
# essreduce
# scippneutron
scipy==1.12.0
# via
# scippneutron
Expand All @@ -142,7 +147,7 @@ toolz==0.12.1
# via
# dask
# partd
traitlets==5.14.1
traitlets==5.14.2
# via
# comm
# ipython
Expand All @@ -158,5 +163,5 @@ wcwidth==0.2.13
# via prompt-toolkit
widgetsnbextension==4.0.10
# via ipywidgets
zipp==3.17.0
zipp==3.18.0
# via importlib-metadata
4 changes: 2 additions & 2 deletions requirements/basetest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ exceptiongroup==1.2.0
# via pytest
iniconfig==2.0.0
# via pytest
packaging==23.2
packaging==24.0
# via pytest
pluggy==1.4.0
# via pytest
pytest==8.0.1
pytest==8.1.1
# via -r basetest.in
tomli==2.0.1
# via pytest
6 changes: 3 additions & 3 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# pip-compile-multi
#
cachetools==5.3.2
cachetools==5.3.3
# via tox
certifi==2024.2.2
# via requests
Expand All @@ -27,7 +27,7 @@ gitpython==3.1.42
# via -r ci.in
idna==3.6
# via requests
packaging==23.2
packaging==24.0
# via
# -r ci.in
# pyproject-api
Expand All @@ -48,7 +48,7 @@ tomli==2.0.1
# via
# pyproject-api
# tox
tox==4.13.0
tox==4.14.1
# via -r ci.in
urllib3==2.2.1
# via requests
Expand Down
28 changes: 14 additions & 14 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ isoduration==20.11.0
# via jsonschema
jinja2-ansible-filters==1.3.2
# via copier
json5==0.9.17
json5==0.9.22
# via jupyterlab-server
jsonpointer==2.4
# via jsonschema
Expand All @@ -55,21 +55,21 @@ jsonschema[format-nongpl]==4.21.1
# jupyter-events
# jupyterlab-server
# nbformat
jupyter-events==0.9.0
jupyter-events==0.9.1
# via jupyter-server
jupyter-lsp==2.2.2
jupyter-lsp==2.2.4
# via jupyterlab
jupyter-server==2.12.5
jupyter-server==2.13.0
# via
# jupyter-lsp
# jupyterlab
# jupyterlab-server
# notebook-shim
jupyter-server-terminals==0.5.2
jupyter-server-terminals==0.5.3
# via jupyter-server
jupyterlab==4.1.2
jupyterlab==4.1.4
# via -r dev.in
jupyterlab-server==2.25.3
jupyterlab-server==2.25.4
# via jupyterlab
notebook-shim==0.2.4
# via jupyterlab
Expand All @@ -79,17 +79,17 @@ pathspec==0.12.1
# via copier
pip-compile-multi==2.6.3
# via -r dev.in
pip-tools==7.4.0
pip-tools==7.4.1
# via pip-compile-multi
plumbum==1.8.2
# via copier
prometheus-client==0.20.0
# via jupyter-server
pycparser==2.21
# via cffi
pydantic==2.6.1
pydantic==2.6.4
# via copier
pydantic-core==2.16.2
pydantic-core==2.16.3
# via pydantic
python-json-logger==2.0.7
# via jupyter-events
Expand All @@ -107,25 +107,25 @@ rfc3986-validator==0.1.1
# jupyter-events
send2trash==1.8.2
# via jupyter-server
sniffio==1.3.0
sniffio==1.3.1
# via
# anyio
# httpx
terminado==0.18.0
terminado==0.18.1
# via
# jupyter-server
# jupyter-server-terminals
toposort==1.10
# via pip-compile-multi
types-python-dateutil==2.8.19.20240106
types-python-dateutil==2.8.19.20240311
# via arrow
uri-template==1.3.0
# via jsonschema
webcolors==1.13
# via jsonschema
websocket-client==1.7.0
# via jupyter-server
wheel==0.42.0
wheel==0.43.0
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
Expand Down
Loading

0 comments on commit 88b9e08

Please sign in to comment.