Merge branch 'main' of https://github.com/jochenstahn/amor
This commit is contained in:
68
.github/workflows/release.yml
vendored
Normal file
68
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
name: Release
|
||||
|
||||
# Controls when the action will run.
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the master branch
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build-items:
|
||||
description: 'Items to be build'
|
||||
required: true
|
||||
default: 'all'
|
||||
type: choice
|
||||
options:
|
||||
- all
|
||||
- windows
|
||||
- linux
|
||||
- mac
|
||||
|
||||
jobs:
|
||||
build-ubuntu-latest:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all", "linux"]'), github.event.inputs.build-items)) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build
|
||||
pip install -r requirements.txt
|
||||
- name: Build PyPI package
|
||||
run: |
|
||||
python3 -m build
|
||||
- name: Upload to PyPI
|
||||
if: github.event_name != 'workflow_dispatch'
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.PYPI_TOKEN }}
|
||||
skip-existing: true
|
||||
- name: Archive distribution
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-dist
|
||||
path: |
|
||||
dist/*.tar.gz
|
||||
|
||||
release:
|
||||
if: github.event_name != 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-ubuntu-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: linux-dist
|
||||
- uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: "amor*.tar.gz"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
allowUpdates: true
|
||||
37
.github/workflows/unit_tests.yml
vendored
Normal file
37
.github/workflows/unit_tests.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Unit Testing
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pytest
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
cd tests
|
||||
python -m pytest --pyargs .
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,6 +5,6 @@
|
||||
__pycache__
|
||||
raw
|
||||
.idea
|
||||
test_data
|
||||
test_results
|
||||
build
|
||||
dist
|
||||
|
||||
12
README.md
12
README.md
@@ -1,12 +0,0 @@
|
||||
Software repository for the neutron reflectometer Amor at the Paul Scherrer Institut, Switzerland
|
||||
|
||||
reduction of the raw files (.hdf) to reflectivity files in one of the representations of the **ORSO reflectivity file format**:
|
||||
|
||||
> `eos.py`
|
||||
> `neos.py` : version for playing and testing
|
||||
|
||||
visualisation of the content of a raw file (.hdf):
|
||||
|
||||
> `events2histogram.py`
|
||||
|
||||
#TODO: real readme for final system needed.
|
||||
27
README.rst
Normal file
27
README.rst
Normal file
@@ -0,0 +1,27 @@
|
||||
EOS - The AMOR focusing reflectometry data reduction software
|
||||
-------------------------------------------------------------
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/amor-eos.svg
|
||||
:target: https://pypi.python.org/pypi/amor-eos/
|
||||
|
||||
|
||||
Software repository for the neutron reflectometer Amor at the Paul Scherrer Institut, Switzerland
|
||||
|
||||
Reduction of the raw files (.hdf) to reflectivity files in one of the representations of the **ORSO reflectivity file format**:
|
||||
|
||||
eos.py --help
|
||||
|
||||
visualisation of the content of a raw file (.hdf):
|
||||
|
||||
events2histogram.py
|
||||
|
||||
:TODO: real readme for final system needed.
|
||||
|
||||
Installation
|
||||
------------
|
||||
Create a virtual python environment (>3.8) and install the PyPI package:
|
||||
|
||||
pip install amor-eos
|
||||
|
||||
On Windows you can also use the binary eos.exe that you find in the
|
||||
[GitHub Releases]([https://github.com/jochenstahn/amor/releases/latest) section
|
||||
@@ -2,5 +2,5 @@
|
||||
Package to handle data redction at AMOR instrument to be used by eos.py script.
|
||||
"""
|
||||
|
||||
__version__ = '2.1.1'
|
||||
__date__ = '2024-10-22'
|
||||
__version__ = '2.1.2'
|
||||
__date__ = '2024-10-30'
|
||||
|
||||
6
pyproject.toml
Normal file
6
pyproject.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
[build-system]
|
||||
requires = [
|
||||
"setuptools>=42",
|
||||
"wheel"
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
||||
32
setup.cfg
Normal file
32
setup.cfg
Normal file
@@ -0,0 +1,32 @@
|
||||
[bdist_wheel]
|
||||
universal = 1
|
||||
|
||||
[metadata]
|
||||
name = amor_eos
|
||||
version = attr: libeos.__version__
|
||||
author = Jochen Stahn - Paul Scherrer Institut
|
||||
author_email = jochen.stahn@psi.ch
|
||||
description = EOS reflectometry reduction for AMOR instrument
|
||||
long_description = Reduces data obtained by focusing time of flight neutron reflectivity to full reflectivity curve.
|
||||
license = MIT
|
||||
classifiers =
|
||||
Programming Language :: Python :: 3
|
||||
License :: OSI Approved :: MIT License
|
||||
Operating System :: OS Independent
|
||||
Topic :: Scientific/Engineering
|
||||
Development Status :: 5 - Production/Stable
|
||||
|
||||
[options]
|
||||
python_requires = >=3.8
|
||||
packages =
|
||||
libeos
|
||||
scripts =
|
||||
eos.py
|
||||
install_requires =
|
||||
numpy
|
||||
h5py
|
||||
orsopy
|
||||
numba
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/jochenstahn/amor"
|
||||
BIN
test_data/amor2023n000608.hdf
Normal file
BIN
test_data/amor2023n000608.hdf
Normal file
Binary file not shown.
BIN
test_data/amor2023n000609.hdf
Normal file
BIN
test_data/amor2023n000609.hdf
Normal file
Binary file not shown.
BIN
test_data/amor2023n000610.hdf
Normal file
BIN
test_data/amor2023n000610.hdf
Normal file
Binary file not shown.
BIN
test_data/amor2023n000611.hdf
Normal file
BIN
test_data/amor2023n000611.hdf
Normal file
Binary file not shown.
BIN
test_data/amor2023n000612.hdf
Normal file
BIN
test_data/amor2023n000612.hdf
Normal file
Binary file not shown.
BIN
test_data/amor2023n000613.hdf
Normal file
BIN
test_data/amor2023n000613.hdf
Normal file
Binary file not shown.
@@ -21,15 +21,14 @@ class FullAmorTest(TestCase):
|
||||
self.pr.enable()
|
||||
self.reader_config = options.ReaderConfig(
|
||||
year=2023,
|
||||
dataPath=os.path.join('..', "test_data"),
|
||||
raw=(os.path.join('..', "test_data"),)
|
||||
rawPath=(os.path.join('..', "test_data"),),
|
||||
)
|
||||
|
||||
def tearDown(self):
|
||||
self.pr.disable()
|
||||
for fi in ['test.Rqz.ort', '614.norm']:
|
||||
try:
|
||||
os.unlink(os.path.join(self.reader_config.dataPath, fi))
|
||||
os.unlink(os.path.join(self.reader_config.rawPath[0], fi))
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
@@ -38,6 +37,8 @@ class FullAmorTest(TestCase):
|
||||
experiment_config = options.ExperimentConfig(
|
||||
chopperPhase=-13.5,
|
||||
chopperPhaseOffset=-5,
|
||||
monitorType=options.Defaults.monitorType,
|
||||
lowCurrentThreshold=options.Defaults.lowCurrentThreshold,
|
||||
yRange=(11., 41.),
|
||||
lambdaRange=(2., 15.),
|
||||
qzRange=(0.005, 0.30),
|
||||
@@ -60,7 +61,8 @@ class FullAmorTest(TestCase):
|
||||
)
|
||||
output_config = options.OutputConfig(
|
||||
outputFormats=["Rqz.ort"],
|
||||
outputName='test'
|
||||
outputName='test',
|
||||
outputPath=os.path.join('..', 'test_results'),
|
||||
)
|
||||
config=options.EOSConfig(self.reader_config, experiment_config, reduction_config, output_config)
|
||||
# run three times to get similar timing to noslicing runs
|
||||
@@ -75,6 +77,8 @@ class FullAmorTest(TestCase):
|
||||
experiment_config = options.ExperimentConfig(
|
||||
chopperPhase=-13.5,
|
||||
chopperPhaseOffset=-5,
|
||||
monitorType=options.Defaults.monitorType,
|
||||
lowCurrentThreshold=options.Defaults.lowCurrentThreshold,
|
||||
yRange=(11., 41.),
|
||||
lambdaRange=(2., 15.),
|
||||
qzRange=(0.005, 0.30),
|
||||
@@ -91,12 +95,13 @@ class FullAmorTest(TestCase):
|
||||
thetaRangeR=(-12., 12.),
|
||||
fileIdentifier=["610", "611", "608,612-613", "609"],
|
||||
scale=[1],
|
||||
normalisationFileIdentifier=["614"],
|
||||
normalisationFileIdentifier=["608"],
|
||||
autoscale=(True, True)
|
||||
)
|
||||
output_config = options.OutputConfig(
|
||||
outputFormats=["Rqz.ort"],
|
||||
outputName='test'
|
||||
outputName='test',
|
||||
outputPath=os.path.join('..', 'test_results'),
|
||||
)
|
||||
config=options.EOSConfig(self.reader_config, experiment_config, reduction_config, output_config)
|
||||
reducer = reduction.AmorReduction(config)
|
||||
|
||||
Reference in New Issue
Block a user