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
36 changes: 12 additions & 24 deletions docs/api-reference/index.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,32 @@
# API Reference

## Module Attributes
## ESSpowder

### Module Attributes
```{eval-rst}
.. currentmodule:: ess.diffraction
.. currentmodule:: ess.powder

.. autosummary::
:toctree: ../generated/attributes

providers
```

## Top-level functions

```{eval-rst}
.. autosummary::
:toctree: ../generated/functions
:recursive:

crop_tof
filter_events
finalize_histogram
group_by_two_theta
lowpass
merge_all_pixels
normalize_by_monitor
normalize_by_proton_charge
normalize_by_vanadium
remove_bad_pulses
```

## Submodules
### Submodules

```{eval-rst}
.. autosummary::
:toctree: ../generated/modules
:template: module-template.rst
:recursive:

external.powgen
powder
conversion
correction
filtering
grouping
smoothing
types
uncertainty

external.powgen
```
72 changes: 67 additions & 5 deletions docs/examples/POWGEN_data_reduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"import sciline\n",
"\n",
"import ess.diffraction\n",
"from ess.diffraction import powder\n",
"from ess.diffraction.external import powgen\n",
"from ess.diffraction.types import *"
"from ess import powder\n",
"from ess.powder.external import powgen\n",
"from ess.powder.types import *"
]
},
{
Expand Down Expand Up @@ -82,7 +82,6 @@
"outputs": [],
"source": [
"providers = [\n",
" *ess.diffraction.providers,\n",
" *powder.providers,\n",
" *powgen.providers,\n",
"]\n",
Expand Down Expand Up @@ -141,6 +140,69 @@
"Now we compute the result:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "17f4aacf-aedf-4d1d-a7f8-c970eb19d68e",
"metadata": {},
"outputs": [],
"source": [
"%matplotlib widget"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "087ebe52-f246-41bc-94f3-626017d0c9c7",
"metadata": {},
"outputs": [],
"source": [
"d = pipeline.compute(DspacingData[VanadiumRun])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "03a92ca3-02fe-4a0b-934c-047ba5ddecee",
"metadata": {},
"outputs": [],
"source": [
"edges = sc.geomspace('dspacing', sc.scalar(0.1, unit='Å'), sc.scalar(2.2, unit='Å'), 1000)\n",
"h = d.bins.concat().hist(dspacing=2000)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2617132f-1574-4ab8-be42-bc2d1601698b",
"metadata": {},
"outputs": [],
"source": [
"h.plot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0d3a371d-e69f-4e27-b9b0-39250866948a",
"metadata": {},
"outputs": [],
"source": [
"del h.coords['gd_prtn_chrg']\n",
"del h.coords['sample_position']\n",
"del h.coords['source_position']"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "df725cc1-4a26-4323-b85f-d43fc5eae067",
"metadata": {},
"outputs": [],
"source": [
"h.save_hdf5('peaked-vanadium-spectrum.h5')"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -308,7 +370,7 @@
"metadata": {},
"outputs": [],
"source": [
"from ess.diffraction.grouping import group_by_two_theta, merge_all_pixels\n",
"from ess.powder.grouping import group_by_two_theta, merge_all_pixels\n",
"\n",
"grouping_providers = list(providers)\n",
"grouping_providers.remove(merge_all_pixels)\n",
Expand Down
41 changes: 0 additions & 41 deletions src/ess/diffraction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,9 @@

import importlib.metadata

from . import uncertainty
from .correction import (
normalize_by_monitor,
normalize_by_proton_charge,
normalize_by_vanadium,
)
from .correction import providers as correction_providers
from .filtering import crop_tof, filter_events
from .filtering import providers as filtering_providers
from .filtering import remove_bad_pulses
from .grouping import finalize_histogram, group_by_two_theta, merge_all_pixels
from .grouping import providers as grouping_providers
from .smoothing import lowpass

try:
__version__ = importlib.metadata.version(__package__ or __name__)
except importlib.metadata.PackageNotFoundError:
__version__ = "0.0.0"

del importlib

providers = (
*correction_providers,
*filtering_providers,
*grouping_providers,
*uncertainty.providers,
)
"""Sciline providers for setting up a diffraction pipeline.

These implement basic diffraction data-reduction functionality and need to be
extended with instrument-specific and sub-technique-specific providers.
"""
del correction_providers, filtering_providers, grouping_providers

__all__ = [
'crop_tof',
'filter_events',
'finalize_histogram',
'group_by_two_theta',
'lowpass',
'merge_all_pixels',
'normalize_by_monitor',
'normalize_by_proton_charge',
'normalize_by_vanadium',
'remove_bad_pulses',
'uncertainty',
]
125 changes: 0 additions & 125 deletions src/ess/diffraction/correction.py

This file was deleted.

14 changes: 0 additions & 14 deletions src/ess/diffraction/powder/__init__.py

This file was deleted.

Empty file added src/ess/dream/py.typed
Empty file.
25 changes: 25 additions & 0 deletions src/ess/powder/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
# flake8: noqa: F401
"""
Components for powder diffraction experiments.
"""
import importlib.metadata

from . import conversion, correction, filtering, grouping, smoothing, uncertainty

try:
__version__ = importlib.metadata.version(__package__ or __name__)
except importlib.metadata.PackageNotFoundError:
__version__ = "0.0.0"

del importlib

providers = (
*conversion.providers,
*correction.providers,
*filtering.providers,
*grouping.providers,
*uncertainty.providers,
)
"""Sciline providers for powder diffraction."""
Loading