Skip to content

Commit

Permalink
bump version, merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Dec 1, 2021
2 parents 1af0de5 + 2d684be commit 27e87b3
Show file tree
Hide file tree
Showing 25 changed files with 47 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
name: amypad ${{ steps.meta.outputs.tag }} alpha
name: amypet ${{ steps.meta.outputs.tag }} alpha
body_path: _CHANGES.md
draft: true
files: |
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
*.py[co]
*.py[cod]
__pycache__/

# build
/amypad/_dist_ver.py
/amypet/_dist_ver.py
/build/
/dist/
/*.egg*/

/.coverage*
/coverage.xml
/.pytest_cache/
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,22 @@ repos:
- id: flake8
args: [-j8]
additional_dependencies:
- flake8-broken-line
- flake8-bugbear
- flake8-comprehensions
- flake8-debugger
- flake8-isort
- flake8-string-format
- repo: https://github.com/google/yapf
rev: v0.31.0
hooks:
- id: yapf
args: [-i]
- repo: https://github.com/PyCQA/isort
rev: 5.9.3
rev: 5.10.1
hooks:
- id: isort
- hooks:
- id: mbeautify
repo: https://github.com/AMYPAD/miutil
rev: v0.9.0
rev: v0.9.1
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
|Logo|

AMYPAD
AMYPET
======

Amyloid imaging to prevent Alzheimer's Disease.
Expand All @@ -13,17 +13,17 @@ Choose one of the following:

.. code:: sh
pip install amypad # command line interface (CLI) version
pip install amypad[gui] # CLI and graphical user interface (GUI) version
pip install amypet # command line interface (CLI) version
pip install amypet[gui] # CLI and graphical user interface (GUI) version
Usage
-----

.. code:: sh
amypad --help # CLI version
amypad.gui # GUI version
amypet --help # CLI version
amypet.gui # GUI version
.. |Logo| image:: https://amypad.eu/wp-content/themes/AMYPAD/images/AMYPAD_Logo.jpg
Expand Down
2 changes: 1 addition & 1 deletion amypad/__init__.py → amypet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
__version__ = "UNKNOWN"

try:
__licence__ = get_distribution("amypad").get_metadata("LICENCE.md")
__licence__ = get_distribution("amypet").get_metadata("LICENCE.md")
except (DistributionNotFound, FileNotFoundError):
try:
__licence__ = (Path(__file__).parent.parent / "LICENCE.md").read_text()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
24 changes: 12 additions & 12 deletions amypad/gui.py → amypet/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,15 @@ def print_not_none(value, **kwargs):
# progress_expr="float(percent or 0)",
# hide_progress_msg=True,
# richtext_controls=True,
@Gooey(default_size=(768, 768), program_name="amypad", sidebar_title="pipeline",
@Gooey(default_size=(768, 768), program_name="amypet", sidebar_title="pipeline",
image_dir=resource_filename(__name__, ""), show_restart_button=False,
header_bg_color="#ffffff", sidebar_bg_color="#a3b5cd", body_bg_color="#a3b5cd",
footer_bg_color="#2a569f", terminal_font_family="monospace", menu=[{
"name": "Help", "items": [{
"type": "Link", "menuTitle": "🌐 View source (online)",
"url": "https://github.com/AMYPAD/amypad"}, {
"type": "AboutDialog", "menuTitle": "🔍 About", "name": "AMYPAD Pipeline",
"description": "GUI to run AMYPAD tools", "version": __version__,
"url": "https://github.com/AMYPAD/amypet"}, {
"type": "AboutDialog", "menuTitle": "🔍 About", "name": "AMYPET Pipeline",
"description": "GUI to run AMYPET tools", "version": __version__,
"copyright": "2021", "website": "https://amypad.eu",
"developer": "https://github.com/AMYPAD", "license": __licence__}]}])
def main(args=None, gui_mode=True):
Expand All @@ -249,9 +249,9 @@ def main(args=None, gui_mode=True):
import niftypad.api
import niftypad.models

from amypad import centiloid, imscroll, imtrimup
from amypet import centiloid, imscroll, imtrimup

parser = fix_subparser(MyParser(prog=None if gui_mode else "amypad"), gui_mode=gui_mode)
parser = fix_subparser(MyParser(prog=None if gui_mode else "amypet"), gui_mode=gui_mode)
sub_kwargs = {}
if sys.version_info[:2] >= (3, 7):
sub_kwargs["required"] = True
Expand Down Expand Up @@ -290,11 +290,11 @@ def argparser(prog, description=None, epilog=None, formatter_class=None):
<src> : Input file/folder [default: FileChooser]
Options:
-d PATH, --dst PATH : Output file/folder (default: input folder)
[default: FileChooser]
-m MODEL, --model MODEL : model [default: srtmb_basis]
-p FILE, --params FILE : config file hint (relative to `--input`)
[default: FileChooser]
--dst PATH : Output file/folder (default: input folder)
[default: FileChooser]
--model MODEL : model [default: srtmb_basis]
--params FILE : config file hint (relative to `src` input).
Default: search for {config,params}.{yaml,json}.
--w W : (default: None)
--r1 R1 : [default: 0.905:float]
--k2p K2P : [default: 0.000250:float]
Expand Down Expand Up @@ -333,7 +333,7 @@ def argparser(prog, description=None, epilog=None, formatter_class=None):
args = [i for i in args if i not in ("--dry-run",)] # strip args

if gui_mode:
print(" ".join([Path(sys.executable).name, "-m amypad"] + args))
print(" ".join([Path(sys.executable).name, "-m amypet"] + args))
if opts.dry_run:
pass
elif hasattr(opts, "main__"): # Cmd
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]

[tool.setuptools_scm]
write_to = "amypad/_dist_ver.py"
write_to = "amypet/_dist_ver.py"
write_to_template = "__version__ = '{version}'\n"
18 changes: 9 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[metadata]
name=amypad
name=amypet
description=Amyloid imaging to prevent Alzheimer's Disease
long_description=file: README.rst
long_description_content_type=text/x-rst
license=MPL 2.0
license_file=LICENCE.md
url=https://amypad.eu
project_urls=
Repository=https://github.com/AMYPAD/amypad
Changelog=https://github.com/AMYPAD/amypad/releases
Documentation=https://github.com/AMYPAD/amypad/#amypad
Repository=https://github.com/AMYPAD/amypet
Changelog=https://github.com/AMYPAD/amypet/releases
Documentation=https://github.com/AMYPAD/amypet/#amypet
maintainer=Casper da Costa-Luis
[email protected]
keywords=pet, alzheimers
platforms=any
provides=amypad
provides=amypet
classifiers=
Development Status :: 3 - Alpha
Intended Audience :: Developers
Expand Down Expand Up @@ -61,8 +61,8 @@ gui=Gooey>=1.0.8
niftypet=niftypet>=0.0.1
[options.entry_points]
console_scripts=
amypad=amypad.cli:main
amypad.gui=amypad.gui:main
amypet=amypet.cli:main
amypet.gui=amypet.gui:main
[options.packages.find]
exclude=tests
[options.package_data]
Expand All @@ -87,12 +87,12 @@ split_before_closing_bracket=False
[isort]
profile=black
line_length=99
known_first_party=amypad,tests
known_first_party=amypet,tests
[tool:pytest]
timeout=10
log_level=INFO
python_files=tests/test_*.py
addopts=-v --tb=short -rxs -W=error -n=auto --durations=0 --durations-min=1 --cov=amypad --cov-report=term-missing --cov-report=xml
addopts=-v --tb=short -rxs -W=error -n=auto --durations=0 --durations-min=1 --cov=amypet --cov-report=term-missing --cov-report=xml
filterwarnings=
ignore:numpy.ufunc size changed.*:RuntimeWarning
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from amypad.cli import main
from amypet.cli import main


def test_run():
Expand Down
19 changes: 10 additions & 9 deletions tests/test_imtrimup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@

@pytest.fixture
def dyndir(datain, mMRpars):
# definition of dynamic frames for kinetic analysis
frmdef = ["def", [4, 15], [8, 30], [9, 60], [2, 180], [8, 300]]
# output path
opth = str(Path(datain["corepath"]).parent / "amypad" / "dyndir")

res = Path(opth) / "PET" / "multiple-frames"
if res.is_dir():
if res.is_dir() and len(list(res.glob('*.nii*'))) > 1:
return res

nipet = pytest.importorskip("niftypet.nipet")
hst = nipet.mmrhist(datain, mMRpars)
# offset for the time from which meaningful events are detected
toff = nipet.lm.get_time_offset(hst)
# dynamic frame timings
# frmdef = ["def", [4, 15], [8, 30], [9, 60], [2, 180], [8, 300]]
frmdef = ["def", [4, (hst['t1'] - hst['t0'] - toff) / 4]]
frm_timings = nipet.lm.dynamic_timings(frmdef, offset=toff)
nipet.lm.draw_frames(hst, frm_timings["timings"])
# nipet.lm.draw_frames(hst, frm_timings["timings"]) # plot frames
# hardware mu-map
muhdct = nipet.hdw_mumap(datain, [1, 2, 4], mMRpars, outpath=opth, use_stored=True)

Expand All @@ -30,6 +30,7 @@ def dyndir(datain, mMRpars):
mMRpars,
outpath=opth,
store=True,
use_stored=True,
hst=hst,
itr=2,
petopt="ac",
Expand All @@ -44,7 +45,7 @@ def dyndir(datain, mMRpars):
mMRpars,
frames=frm_timings["timings"],
mu_h=muhdct,
mu_o=mupdct, # muodct,
mu_o=mupdct,
itr=5,
fwhm=0.0,
outpath=opth,
Expand All @@ -55,7 +56,7 @@ def dyndir(datain, mMRpars):
return Path(opth) / "PET" / "multiple-frames"


@pytest.mark.timeout(2 * 60 * 60) # 2h
def test_rectrim(dyndir):
rectrim = pytest.importorskip("amypad.rectrim")
rectrim.run(dyndir)
@pytest.mark.timeout(30 * 60) # 30m
def test_imtrimup(dyndir):
imtrimup = pytest.importorskip("amypet.imtrimup")
imtrimup.run(dyndir, glob='*_frm?_t*.nii*')

0 comments on commit 27e87b3

Please sign in to comment.