Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promoting develop to master version 0.0.3 #67

Merged
merged 79 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
310bb95
Reduce the default background
arm61 Dec 6, 2022
7b7ab93
Remove setup.py
arm61 Dec 6, 2022
25de621
Use prerelease branch
arm61 Dec 6, 2022
3b1a864
Remove duplicated information in setup.cfg
arm61 Dec 6, 2022
8e1d616
Using MultiFitter and new Serialization
arm61 Dec 6, 2022
e52d3bc
Updates to testing for MultiFitter and new Serialization
arm61 Dec 6, 2022
ca249c2
Linting all the code
arm61 Dec 6, 2022
3ed27d6
Add 3.10 to tests
arm61 Dec 6, 2022
12f2f72
Make minimum 3.8.1
arm61 Dec 6, 2022
f8ed78b
Improve developer installation instructions
arm61 Dec 6, 2022
45ff70d
Make workflow 3.8.1
arm61 Dec 6, 2022
1679f6f
Make version numbers strings
arm61 Dec 6, 2022
951a91c
Set flake8 version to 5.0.4
arm61 Dec 6, 2022
3d6ad8e
Correct poetry syntax
arm61 Dec 6, 2022
942e2cd
Bumping version numbers in action
arm61 Dec 6, 2022
a1e5912
bump pytest versions
arm61 Dec 6, 2022
e664444
Removing poetry from build
arm61 Jan 11, 2023
69d7a09
Quotes around versions >3.9
arm61 Jan 11, 2023
ebbc37e
Remove 3.11
arm61 Jan 11, 2023
a22d6cf
Remove test with bornagain
arm61 Jan 11, 2023
031fa0c
Add a full stop [skip ci]
arm61 Jan 12, 2023
fe8ba26
Moving to pyproject toml for dev
arm61 Jan 23, 2023
1bbf622
Remove some line endings
arm61 Jan 23, 2023
b9a1785
Line breaking
arm61 Jan 23, 2023
197dd77
Half of Piotrs comments
arm61 Jan 24, 2023
03b98d0
Skip none
arm61 Jan 24, 2023
c1e86fb
Move skip noning
arm61 Jan 24, 2023
9e26a26
Simon comments
arm61 Jan 24, 2023
6043df0
Finish fixing piotrs comments
arm61 Jan 24, 2023
1702486
Pin numpy due to numba bug
arm61 Jan 24, 2023
15198c1
Merge pull request #57 from easyScience/easycore-0.3.0
arm61 Jan 24, 2023
d0553ab
Merge conflicts
arm61 Jan 24, 2023
a70247a
Fix pp.toml
arm61 Jan 24, 2023
f1ab0e6
Remove flake8 with poetry
arm61 Jan 24, 2023
d38fa79
Bug fix
arm61 Jan 24, 2023
897a66f
Remove docs build
arm61 Jan 24, 2023
40b6e44
Merge pull request #58 from easyScience/no_poetry
arm61 Jan 25, 2023
2289a72
changed dependency to fixed easyCore
rozyczko Dec 5, 2023
19c6a54
and now with fixed typos
rozyczko Dec 5, 2023
490e079
pin scipp version
rozyczko Dec 5, 2023
07e8ece
Merge pull request #59 from easyScience/fixed_unit_tests
rozyczko Dec 5, 2023
0267fb1
pin hatchling, gitignore
andped10 Dec 12, 2023
5e423ca
Merge pull request #61 from easyScience/pin_hatchling
rozyczko Dec 12, 2023
c959886
py311 tests pass, scipp 23.08
andped10 Dec 18, 2023
1915d42
added python 3.11 to pipelines
andped10 Dec 18, 2023
be2c283
Merge pull request #63 from easyScience/python311
rozyczko Dec 18, 2023
b707b01
explicit packages different from project name
andped10 Jan 3, 2024
d688f79
update scipp
andped10 Jan 3, 2024
fb3572b
revert scipp version
andped10 Jan 3, 2024
149e823
scipp==23.08.0
andped10 Jan 3, 2024
dd0013f
set hatchling version
andped10 Jan 4, 2024
b8c383c
Merge pull request #64 from easyScience/hatchling-latest-preserve-mod…
andped10 Jan 4, 2024
6226875
adjust plot to satisfy scipp.plopp
andped10 Jan 8, 2024
a228963
adjustments
andped10 Jan 8, 2024
29acc66
no need for ipympl
andped10 Jan 8, 2024
b0f9b5e
removed plural s in neutron
andped10 Jan 9, 2024
12cbb4a
scipp update, dataset to datagroup
andped10 Jan 9, 2024
8abec5b
plot adjustments
andped10 Jan 10, 2024
b1714e7
code cleaning
andped10 Jan 10, 2024
6174a9a
copy to ensure new object
andped10 Jan 10, 2024
0a19e09
pr response
andped10 Jan 10, 2024
aaba24d
clean output notebook
andped10 Jan 10, 2024
2f128e2
revert changes to ort files
andped10 Jan 10, 2024
eab0d31
Merge pull request #65 from easyScience/plopp-plotting-more-strict-scipp
andped10 Jan 10, 2024
8765d02
Merge remote-tracking branch 'origin/develop' into dataset-to-datagroup
andped10 Jan 10, 2024
c67a8c8
ort with plural s
andped10 Jan 10, 2024
9ed466f
removed python 3.8
andped10 Jan 10, 2024
1daebdf
clean notebook
andped10 Jan 11, 2024
d89117e
revert change in background.bonds
andped10 Jan 11, 2024
e759eff
Merge pull request #66 from easyScience/dataset-to-datagroup
andped10 Jan 11, 2024
89e7f3a
version changed to 0.0.3
andped10 Jan 11, 2024
89b25f9
build using python
andped10 Jan 11, 2024
4a4622b
update version for codecov action
andped10 Jan 11, 2024
6765013
update pipeline description
andped10 Jan 12, 2024
a829bc0
unifying action workflows
andped10 Jan 12, 2024
cded290
packaging testing
andped10 Jan 12, 2024
6bfc6f1
packaging testing
andped10 Jan 12, 2024
43c7fd2
typo in comment
andped10 Jan 12, 2024
5bd92cc
changed from master to main
andped10 Jan 12, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: "CodeQL"

on:
push:
branches: [master, pre-release, develop]
branches: [ main, pre-release, develop ]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
branches: [ main ]
schedule:
- cron: '0 16 * * 5'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# This is a basic workflow to help you get started with Actions
# This pipeline
# - build html documentation
# - deploy html documentation to gh-pages branch of the same repository

name: Build Documentation
name: Build and Deploy Documentation

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]

Expand All @@ -24,15 +26,14 @@ jobs:
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install EasyReflectometry and dependencies
- name: Install Pandoc, EasyReflectometry and dependencies
run: |
sudo apt install pandoc
pip install -r requirements-dev.txt
pip install .
pip install . '.[dev]'
- name: Build and Commit
uses: sphinx-notes/pages@master
with:
Expand Down
55 changes: 33 additions & 22 deletions .github/workflows/ci_pip.yml → .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# This workflow will for a variety of Python versions
# - install the code base
# - lint the code base
# - test the code base
# - upload the test coverage to codecov
#
# It will also
# - build the package
# - check the package
#
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: CI using pip

on: [push, pull_request]
Expand All @@ -8,62 +20,61 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.8, 3.9]
python-version: ['3.9', '3.10', '3.11']
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Setup Poetry
uses: Gr1N/setup-poetry@v7

- name: Install dependencies
run: |
poetry update
run: pip install -e '.[dev]'

- name: Lint with flake8
run: |
poetry add flake8
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 ./EasyReflectometry --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 ./EasyReflectometry --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 ./EasyReflectometry --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 ./EasyReflectometry --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Test with tox
run: |
poetry add -D tox tox-gh-actions coverage
poetry run tox
pip install tox tox-gh-actions coverage
tox

- name: Upload coverage
uses: codecov/codecov-action@v1.0.7
uses: codecov/codecov-action@v3
with:
name: Pytest coverage
env_vars: OS,PYTHON,GITHUB_ACTIONS,GITHUB_ACTION,GITHUB_REF,GITHUB_REPOSITORY,GITHUB_HEAD_REF,GITHUB_RUN_ID,GITHUB_SHA,COVERAGE_FILE
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}

test_Packaging:
Package_Testing:

runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Setup Poetry
uses: Gr1N/setup-poetry@v7
- name: Install dependencies and build
run: |
pip install -e '.[dev]'
python -m build

- name: Check Build
run: |
pip install twine
poetry build
python -m twine check dist/*
cd ./dist
pytest ../
23 changes: 13 additions & 10 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# This workflow will for a variety of Python versions
# - build a python package
# - run tests on the produced package
# - upload the package as an artifact
#
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package testing
name: Create Python Package

on:
push:
branches: [master, pre-release]
branches: [ main, pre-release ]
pull_request:
branches: [master, pre-release]
branches: [ main, pre-release ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ['3.9', '3.10', '3.11']
if: "!contains(github.event.head_commit.message, '[ci skip]')"

steps:
Expand All @@ -23,15 +27,14 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: Gr1N/setup-poetry@v7
- name: Install dependencies
- name: Install dependencies and build
run: |
poetry update
poetry build
pip install -e '.[dev]'
python -m build
- name: Test with pytest
run: |
cd ./dist
poetry run pytest ../
pytest ../
- uses: actions/upload-artifact@v2
with:
name: EasyReflectometrys - Python ${{ matrix.python-version }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# This workflows will upload a Python Package using Twine when a release is created
# This workflows will
# - deploy already produced artifacts to PyIP
#
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
name: Deploy Python Package

on:
workflow_dispatch:
push:
branches: [ master ]
branches: [ main ]
tags:
- 'v*'

Expand All @@ -20,16 +22,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.9'
- uses: Gr1N/setup-poetry@v7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
poetry update
pip install -e '.[dev]'
- name: Build
run: |
poetry build
pip install build
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_PASSWORD }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ build
# Docs
docs/_build

# VSCode
.vscode

# Misc
..*
*.log
*.zip
.ci/
.idea/

2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Before you submit a pull request, check that it meets these guidelines:
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 3.8, 3.9, and 3.10, and for PyPy. Check
3. The pull request should work for Python 3.9, 3.10, and 3.11, and for PyPy. Check
https://travis-ci.com/easyScience/EasyReflectometryLib/pull_requests
and make sure that the tests pass for all supported Python versions.

Expand Down
4 changes: 2 additions & 2 deletions EasyReflectometry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MAJOR = 0
MINOR = 0
MICRO = 2
__version__ = f'{MAJOR:d}.{MINOR:d}.{MICRO:d}'
MICRO = 3
__version__ = f'{MAJOR:d}.{MINOR:d}.{MICRO:d}'
5 changes: 3 additions & 2 deletions EasyReflectometry/calculators/bornagain.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self):

def create_material(self, name):
"""
Create a material using SLD.
Create a material using SLD.

:param name: The name of the material
:type name: str
Expand Down Expand Up @@ -60,7 +60,8 @@ def update_material(self, name, **kwargs):
if 'imag' in kwargs.keys():
if kwargs['imag'] < 0:
raise ValueError(
'The BornAgain interface does not support negative imaginary scattering length densities'
'The BornAgain interface does not support negative '
'imaginary scattering length densities'
)
imag = kwargs['imag'] * 1e-6
self.storage['material'][name] = ba.MaterialBySLD(str(name), real, imag)
Expand Down
8 changes: 5 additions & 3 deletions EasyReflectometry/calculators/refl1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Tuple

from easyCore import np
from refl1d import names, model, experiment
from refl1d import names, model


class Refl1d:
Expand Down Expand Up @@ -169,7 +169,8 @@ def add_item(self, item_name: str, model_name: str):
:param item_name: items to add to model
:param model_name: name for the model
"""
self.storage['model'][model_name]['items'].append(self.storage['item'][item_name])
self.storage['model'][model_name]['items'].append(
self.storage['item'][item_name])

def remove_layer_from_item(self, layer_name: str, item_name: str):
"""
Expand All @@ -189,7 +190,8 @@ def remove_item(self, item_name: str, model_name: str):
:param item_name: The item name
:param model_name: The model name
"""
item_idx = self.storage['model'][model_name]['items'].index(self.storage['item'][item_name])
item_idx = self.storage['model'][model_name]['items'].index(
self.storage['item'][item_name])
del self.storage['model'][model_name]['items'][item_idx]
del self.storage['item'][item_name]

Expand Down
22 changes: 13 additions & 9 deletions EasyReflectometry/calculators/refnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self):
'material': {},
'layer': {},
'item': {},
'model': {} #reflect.ReflectModel(reflect.Structure())
'model': {}
}

def reset_storage(self):
Expand All @@ -24,7 +24,7 @@ def reset_storage(self):
'material': {},
'layer': {},
'item': {},
'model': {} # reflect.ReflectModel(reflect.Structure())
'model': {}
}

def create_material(self, name: str):
Expand Down Expand Up @@ -211,11 +211,13 @@ def calculate(self, x_array: np.ndarray, model_name: str) -> np.ndarray:
:param model_name: Name for the model
:return: points calculated at `x`
"""
structure = _remove_unecessary_stacks(self.storage['model'][model_name].structure)
model = reflect.ReflectModel(structure,
scale=self.storage['model'][model_name].scale.value,
bkg=self.storage['model'][model_name].bkg.value,
dq=self.storage['model'][model_name].dq.value)
structure = _remove_unecessary_stacks(
self.storage['model'][model_name].structure)
model = reflect.ReflectModel(
structure,
scale=self.storage['model'][model_name].scale.value,
bkg=self.storage['model'][model_name].bkg.value,
dq=self.storage['model'][model_name].dq.value)
return model(x_array)

def sld_profile(self, model_name: str) -> Tuple[np.ndarray, np.ndarray]:
Expand All @@ -225,10 +227,12 @@ def sld_profile(self, model_name: str) -> Tuple[np.ndarray, np.ndarray]:
:param model_name: Name for the model
:return: z and sld(z)
"""
return _remove_unecessary_stacks(self.storage['model'][model_name].structure).sld_profile()
return _remove_unecessary_stacks(
self.storage['model'][model_name].structure).sld_profile()


def _remove_unecessary_stacks(current_structure: reflect.Structure) -> reflect.Structure:
def _remove_unecessary_stacks(
current_structure: reflect.Structure) -> reflect.Structure:
"""
Removed unnecessary reflect.Stack objects from the structure.

Expand Down
Loading
Loading