Skip to content

Commit

Permalink
Merge pull request #186 from astrofrog/update-infrastructure
Browse files Browse the repository at this point in the history
Update package infrastructure
  • Loading branch information
astrofrog committed Jul 20, 2022
2 parents 3430260 + 857dc48 commit 75ec031
Show file tree
Hide file tree
Showing 50 changed files with 508 additions and 3,455 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
push:
pull_request:

jobs:
test:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
envs: |
- linux: codestyle
pytest: false
- linux: py37-test-oldestdeps
- macos: py38-test
- windows: py39-test
- linux: py310-test
- linux: py310-test-devdeps
coverage: 'codecov'
66 changes: 63 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,67 @@
# Compiled files
*.py[cod]
*.a
*.o
*.so
__pycache__

# Ignore .c files by default to avoid including generated code. If you want to
# add a non-generated .c extension, use `git add -f filename.c`.
*.c

# Other generated files
*/version.py
*/cython_version.py
htmlcov
.coverage
MANIFEST
.ipynb_checkpoints

# Sphinx
docs/api
docs/_build

# Eclipse editor project files
.project
.pydevproject
.settings

# Pycharm editor project files
.idea

# Floobits project files
.floo
.flooignore

# Visual Studio Code project files
.vscode

# Packages/installer info
*.egg
*.egg-info
dist
build
*.egg-info/
eggs
.eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
distribute-*.tar.gz

# Other
.cache
.tox
.*.sw[op]
*~
.project
.pydevproject
*.pyc
.settings/
.settings
pip-wheel-metadata/

# Mac OSX
.DS_Store

.tmp
15 changes: 15 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

build:
os: ubuntu-20.04
tools:
python: '3.7'

python:
install:
- method: pip
path: .
extra_requirements:
- docs

formats: []
13 changes: 0 additions & 13 deletions .rtd-environment.yml

This file was deleted.

70 changes: 0 additions & 70 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
0.3.0 (unreleased)
------------------

- No changes yet
- Updated package infrastructure. [#186]

0.2.0 (2016-09-29)
------------------
Expand Down
20 changes: 15 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
include LICENSE
include CHANGES
include runtests.py
recursive-include astrodendro/tests *.npz
recursive-include astrodendro/tests/benchmark_data *.fits
include README.rst
include CHANGES.rst
include setup.cfg
include LICENSE.rst
include pyproject.toml

recursive-include astrodendro *.pyx *.c *.pxd
recursive-include docs *
recursive-include licenses *
recursive-include scripts *

prune build
prune docs/_build
prune docs/api

global-exclude *.pyc *.o
12 changes: 6 additions & 6 deletions astrodendro/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Licensed under an MIT open source license - see LICENSE

from .dendrogram import Dendrogram, periodic_neighbours
from .structure import Structure
from .analysis import ppv_catalog, pp_catalog
from .plot import DendrogramPlotter
from .viewer import BasicDendrogramViewer
from .dendrogram import Dendrogram, periodic_neighbours # noqa
from .structure import Structure # noqa
from .analysis import ppv_catalog, pp_catalog # noqa
from .plot import DendrogramPlotter # noqa
from .viewer import BasicDendrogramViewer # noqa

__version__ = '0.3.0.dev'
from .version import version as __version__ # noqa
15 changes: 6 additions & 9 deletions astrodendro/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
from astropy import units as u
from astropy.wcs import WCS

from . import six
from .structure import Structure
from .flux import UnitMetadataWarning
from .progressbar import AnimatedProgressBar

__all__ = ['ppv_catalog', 'pp_catalog']
__all__ = ['ppv_catalog', 'pp_catalog', 'PPStatistic', 'PPVStatistic', 'PPPStatistic', 'SpatialBase']


def memoize(func):
Expand Down Expand Up @@ -77,7 +76,7 @@ def __init__(self, values, indices):
Location of each element of values. The i-th array in the tuple
describes the ith positional dimension
"""
self.values = values.astype(np.float)
self.values = values.astype(float)
self.indices = indices

@memoize
Expand Down Expand Up @@ -126,13 +125,13 @@ def mom2_along(self, direction):
The variance (or co-variance matrix) of the data along the
specified direction(s).
"""
w = np.atleast_2d(direction).astype(np.float)
w = np.atleast_2d(direction).astype(float)
for row in w:
row /= np.linalg.norm(row)

result = np.dot(np.dot(w, self.mom2()), w.T)
if result.size == 1:
result = np.asscalar(result)
result = result.item()
return result

@memoize
Expand Down Expand Up @@ -233,7 +232,7 @@ def __init__(self, key, description, default=None, strict=False):
If True, raise KeyError if metadata not provided.
This overrides default
"""
if not isinstance(key, six.string_types):
if not isinstance(key, str):
raise TypeError("Key is", key, type(key))
self.key = key
self.description = description or 'no description'
Expand Down Expand Up @@ -684,15 +683,13 @@ def _make_catalog(structures, fields, metadata, statistic, verbose=False):
progress_bar + 1
progress_bar.show_progress()


result.sort('_idx')

if verbose:
progress_bar.progress = 100 # Done
progress_bar.show_progress()
print("") # newline


return result


Expand Down Expand Up @@ -724,7 +721,7 @@ def ppv_catalog(structures, metadata, fields=None, verbose=True):

with warnings.catch_warnings():
warnings.simplefilter("once" if verbose else 'ignore', category=MissingMetadataWarning)
warnings.simplefilter("once" if verbose else 'ignore', category=UnitMetadataWarning)
warnings.simplefilter("once" if verbose else 'ignore', category=UnitMetadataWarning)
return _make_catalog(structures, fields, metadata, PPVStatistic, verbose)


Expand Down

0 comments on commit 75ec031

Please sign in to comment.