Skip to content

Commit 3705663

Browse files
sbillingepavoljuhasstevenhua0320pre-commit-ci[bot]
authored
fix p3 (#12)
* DOC: remove trailing white space from README * DOC: fix download link for Anaconda Python * add .github directory, add requirements, and other setup files. * added back blank line in main.yml * inserting precommit and other testing yamls * [pre-commit.ci] auto fixes from pre-commit hooks --------- Co-authored-by: Pavol Juhas <[email protected]> Co-authored-by: stevenhua0320 <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 0200e49 commit 3705663

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+5477
-5041
lines changed

Diff for: .codecov.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# codecov can find this file anywhere in the repo, so we don't need to clutter
2+
# the root folder.
3+
#comment: false
4+
5+
codecov:
6+
notify:
7+
require_ci_to_pass: no
8+
9+
coverage:
10+
status:
11+
patch:
12+
default:
13+
target: '70'
14+
if_no_uploads: error
15+
if_not_found: success
16+
if_ci_failed: failure
17+
project:
18+
default: false
19+
library:
20+
target: auto
21+
if_no_uploads: error
22+
if_not_found: success
23+
if_ci_failed: error
24+
paths: '!*/tests/.*'
25+
26+
tests:
27+
target: 97.9%
28+
paths: '*/tests/.*'
29+
if_not_found: success
30+
31+
flags:
32+
tests:
33+
paths:
34+
- tests/

Diff for: .coveragerc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[run]
2+
source =
3+
diffpy.srmise
4+
[report]
5+
omit =
6+
*/python?.?/*
7+
*/site-packages/nose/*
8+
# ignore _version.py and versioneer.py
9+
.*version.*
10+
*_version.py
11+
12+
exclude_lines =
13+
if __name__ == '__main__':

Diff for: .flake8

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[flake8]
2+
exclude =
3+
.git,
4+
__pycache__,
5+
build,
6+
dist,
7+
doc/source/conf.py
8+
max-line-length = 115
9+
# Ignore some style 'errors' produced while formatting by 'black'
10+
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings
11+
extend-ignore = E203

Diff for: .github/workflows/docs.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
release:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
shell: bash -l {0}
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- uses: conda-incubator/setup-miniconda@v2
21+
with:
22+
activate-environment: build
23+
auto-update-conda: true
24+
25+
- name: install requirements
26+
run: >-
27+
conda install -n build -c conda-forge
28+
--file requirements/build.txt
29+
--file requirements/run.txt
30+
--file requirements/docs.txt
31+
--quiet --yes
32+
33+
- name: install the package
34+
run: python -m pip install . --no-deps
35+
36+
- name: build documents
37+
run: make -C doc html
38+
39+
- name: Deploy
40+
uses: peaceiris/actions-gh-pages@v3
41+
with:
42+
github_token: ${{ secrets.GITHUB_TOKEN }}
43+
publish_dir: ./doc/build/html

Diff for: .github/workflows/main.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- CI
8+
pull_request:
9+
workflow_dispatch:
10+
11+
jobs:
12+
miniconda:
13+
name: Miniconda ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: ["ubuntu-latest"]
18+
steps:
19+
- name: check out diffpy.srmise
20+
uses: actions/checkout@v3
21+
with:
22+
repository: diffpy/diffpy.srmise
23+
path: .
24+
fetch-depth: 0 # avoid shallow clone with no tags
25+
26+
- name: initialize miniconda
27+
# this uses a marketplace action that sets up miniconda in a way that makes
28+
# it easier to use. I tried setting it up without this and it was a pain
29+
uses: conda-incubator/setup-miniconda@v2
30+
with:
31+
activate-environment: test
32+
# environment.yml file is needed by this action. Because I don't want
33+
# maintain this but rather maintain the requirements files it just has
34+
# basic things in it like conda and pip
35+
environment-file: ./environment.yml
36+
python-version: 3
37+
auto-activate-base: false
38+
39+
- name: install diffpy.srmise requirements
40+
shell: bash -l {0}
41+
run: |
42+
conda config --set always_yes yes --set changeps1 no
43+
conda config --add channels conda-forge
44+
conda activate test
45+
conda install --file requirements/run.txt
46+
conda install --file requirements/test.txt
47+
pip install .
48+
49+
- name: Validate diffpy.srmise
50+
shell: bash -l {0}
51+
run: |
52+
conda activate test
53+
coverage run -m pytest -vv -s
54+
coverage report -m
55+
codecov

Diff for: .github/workflows/pre-commit.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
workflow_dispatch:
7+
8+
jobs:
9+
pre-commit:
10+
# pull requests are a duplicate of a branch push if within the same repo.
11+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
12+
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-python@v4
17+
- uses: pre-commit/[email protected]
18+
with:
19+
extra_args: --all-files

Diff for: .isort.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[settings]
2+
line_length = 115
3+
multi_line_output = 3
4+
include_trailing_comma = True

Diff for: .pre-commit-config.yaml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
default_language_version:
2+
python: python3
3+
ci:
4+
autofix_commit_msg: |
5+
[pre-commit.ci] auto fixes from pre-commit hooks
6+
autofix_prs: true
7+
autoupdate_branch: 'pre-commit-autoupdate'
8+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
9+
autoupdate_schedule: monthly
10+
skip: [no-commit-to-branch]
11+
submodules: false
12+
repos:
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v4.6.0
15+
hooks:
16+
- id: check-yaml
17+
- id: end-of-file-fixer
18+
- id: trailing-whitespace
19+
exclude: '\.(rst|txt)$'
20+
- repo: https://github.com/psf/black
21+
rev: 24.4.2
22+
hooks:
23+
- id: black
24+
- repo: https://github.com/pycqa/flake8
25+
rev: 7.0.0
26+
hooks:
27+
- id: flake8
28+
- repo: https://github.com/pycqa/isort
29+
rev: 5.13.2
30+
hooks:
31+
- id: isort
32+
args: ["--profile", "black"]
33+
- repo: https://github.com/kynan/nbstripout
34+
rev: 0.7.1
35+
hooks:
36+
- id: nbstripout
37+
- repo: https://github.com/pre-commit/pre-commit-hooks
38+
rev: v4.4.0
39+
hooks:
40+
- id: no-commit-to-branch
41+
name: Prevent Commit to Main Branch
42+
args: ["--branch", "main"]
43+
stages: [pre-commit]

Diff for: MANIFEST.in

-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ include doc/examples/README
99
recursive-include doc/manual/source *.rst *.txt
1010
include doc/manual/source/conf.py
1111
include doc/manual/Makefile
12-

Diff for: README.rst

+49-49
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,38 @@ SrMise
55
`DiffPy project <http://www.diffpy.org>`_ tool for unbiased peak extraction from
66
atomic pair distribution functions.
77

8-
SrMise is an implementation of the `ParSCAPE algorithm
9-
<https://dx.doi.org/10.1107/S2053273315005276>`_ for peak extraction from
10-
atomic pair distribution functions (PDFs). It is designed to function even
11-
when *a priori* knowledge of the physical sample is limited, utilizing the
12-
Akaike Information Criterion (AIC) to estimate whether peaks are
13-
statistically justified relative to alternate models. Three basic use cases
14-
are anticipated for SrMise. The first is peak fitting a user-supplied
15-
collections of peaks. The second is peak extraction from a PDF with no (or
16-
only partial) user-supplied peaks. The third is an AIC-driven multimodeling
17-
analysis where the output of multiple SrMise trials are ranked.
18-
19-
The framework for peak extraction defines peak-like clusters within the data,
20-
extracts a single peak within each cluster, and iteratively combines nearby
21-
clusters while performing a recursive search on the residual to identify
22-
occluded peaks. Eventually this results in a single global cluster
23-
containing many peaks fit over all the data. Over- and underfitting are
8+
SrMise is an implementation of the `ParSCAPE algorithm
9+
<https://dx.doi.org/10.1107/S2053273315005276>`_ for peak extraction from
10+
atomic pair distribution functions (PDFs). It is designed to function even
11+
when *a priori* knowledge of the physical sample is limited, utilizing the
12+
Akaike Information Criterion (AIC) to estimate whether peaks are
13+
statistically justified relative to alternate models. Three basic use cases
14+
are anticipated for SrMise. The first is peak fitting a user-supplied
15+
collections of peaks. The second is peak extraction from a PDF with no (or
16+
only partial) user-supplied peaks. The third is an AIC-driven multimodeling
17+
analysis where the output of multiple SrMise trials are ranked.
18+
19+
The framework for peak extraction defines peak-like clusters within the data,
20+
extracts a single peak within each cluster, and iteratively combines nearby
21+
clusters while performing a recursive search on the residual to identify
22+
occluded peaks. Eventually this results in a single global cluster
23+
containing many peaks fit over all the data. Over- and underfitting are
2424
discouraged by use of the AIC when adding or, during a pruning step, removing
25-
peaks. Termination effects, which can lead to physically spurious peaks in
26-
the PDF, are incorporated in the mathematical peak model and the pruning step
27-
attempts to remove peaks which are fit better as termination ripples due to
28-
another peak.
29-
30-
Where possible, SrMise provides physically reasonable default values
31-
for extraction parameters. However, the PDF baseline should be estimated by
32-
the user before extraction, or by performing provisional peak extraction with
33-
varying baseline parameters. The package defines a linear (crystalline)
34-
baseline, arbitrary polynomial baseline, a spherical nanoparticle baseline,
35-
and an arbitrary baseline interpolated from a list of user-supplied values.
36-
In addition, PDFs with accurate experimentally-determined uncertainties are
37-
necessary to provide the most reliable results, but historically such PDFs
38-
are rare. In the absence of accurate uncertainties an *ad hoc* uncertainty
39-
must be specified.
25+
peaks. Termination effects, which can lead to physically spurious peaks in
26+
the PDF, are incorporated in the mathematical peak model and the pruning step
27+
attempts to remove peaks which are fit better as termination ripples due to
28+
another peak.
29+
30+
Where possible, SrMise provides physically reasonable default values
31+
for extraction parameters. However, the PDF baseline should be estimated by
32+
the user before extraction, or by performing provisional peak extraction with
33+
varying baseline parameters. The package defines a linear (crystalline)
34+
baseline, arbitrary polynomial baseline, a spherical nanoparticle baseline,
35+
and an arbitrary baseline interpolated from a list of user-supplied values.
36+
In addition, PDFs with accurate experimentally-determined uncertainties are
37+
necessary to provide the most reliable results, but historically such PDFs
38+
are rare. In the absence of accurate uncertainties an *ad hoc* uncertainty
39+
must be specified.
4040

4141
For more information about SrMise, see the users manual at
4242
http://diffpy.github.io/diffpy.srmise.
@@ -65,7 +65,7 @@ individual and/or academic use, but some also have commercial version. Links to
6565
executables, installation instructions, and licensing information
6666
for some popular options are listed below.
6767

68-
* `Anaconda <http://www.continuum.io/downloads>`_
68+
* `Anaconda <https://www.anaconda.com/download>`_
6969
* `Enthought Canopy <https://www.enthought.com/products/canopy/>`_
7070
* `Python(x,y) <https://code.google.com/p/pythonxy/>`_
7171
* `WinPython <http://winpython.github.io>`_
@@ -120,7 +120,7 @@ in MacPorts::
120120

121121
The simplest way to obtain diffpy.srmise on Mac OS X systems
122122
is using ``pip`` to download and install the latest release from
123-
`PyPI <https://pypi.python.org>`_. ::
123+
`PyPI <https://pypi.python.org>`_. ::
124124

125125
sudo pip install diffpy.srmise
126126

@@ -131,9 +131,9 @@ Uncompress them to a directory, and from that directory run ::
131131

132132
sudo python setup.py install
133133

134-
This installs diffpy.srmise for all users in the default system location. If
135-
administrator (root) access is not available, see the usage info from
136-
``python setup.py install --help`` for options to install to user-writable
134+
This installs diffpy.srmise for all users in the default system location. If
135+
administrator (root) access is not available, see the usage info from
136+
``python setup.py install --help`` for options to install to user-writable
137137
directories.
138138

139139

@@ -154,7 +154,7 @@ For other Linux distributions consult the appropriate package manager.
154154

155155
The simplest way to obtain diffpy.srmise on Linux systems
156156
is using ``pip`` to download and install the latest release from the
157-
`PyPI <https://pypi.python.org>`_. ::
157+
`PyPI <https://pypi.python.org>`_. ::
158158

159159
sudo pip install diffpy.srmise
160160

@@ -165,24 +165,24 @@ Uncompress them to a directory, and from that directory run ::
165165

166166
sudo python setup.py install
167167

168-
This installs diffpy.srmise for all users in the default system location. If
169-
administrator (root) access is not available, see the usage info from
170-
``python setup.py install --help`` for options to install to user-writable
171-
directories.
168+
This installs diffpy.srmise for all users in the default system location. If
169+
administrator (root) access is not available, see the usage info from
170+
``python setup.py install --help`` for options to install to user-writable
171+
directories.
172172

173173

174174
DEVELOPMENT
175175
===========
176176

177-
diffpy.srmise is open-source software developed with support of the Center of
178-
Research Excellence in Complex Materials at Michigan State University, in
179-
cooperation with the DiffPy-CMI complex modeling initiative at the Brookhaven
180-
National Laboratory. The diffpy.srmise sources are hosted at
181-
https://github.com/diffpy/diffpy.srmise.
177+
diffpy.srmise is open-source software developed with support of the Center of
178+
Research Excellence in Complex Materials at Michigan State University, in
179+
cooperation with the DiffPy-CMI complex modeling initiative at the Brookhaven
180+
National Laboratory. The diffpy.srmise sources are hosted at
181+
https://github.com/diffpy/diffpy.srmise.
182182

183-
Feel free to fork the project and contribute. To install diffpy.srmise in a
184-
development mode, with its sources being directly used by Python rather than
185-
copied to a package directory, use ::
183+
Feel free to fork the project and contribute. To install diffpy.srmise in a
184+
development mode, with its sources being directly used by Python rather than
185+
copied to a package directory, use ::
186186

187187
python setup.py develop --user
188188

0 commit comments

Comments
 (0)