Skip to content

Commit

Permalink
Merge pull request #17 from aragilar/fix-tests
Browse files Browse the repository at this point in the history
Get tests/CI minimally passing for now
  • Loading branch information
aragilar committed Aug 13, 2021
2 parents 7502930 + 9356934 commit 375b374
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 29 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Expand Up @@ -15,3 +15,5 @@ include tox.ini
include pypi-intro.rst
exclude appveyor.yml
exclude bors.toml
exclude azure-pipelines.yml
recursive-exclude ci *
42 changes: 21 additions & 21 deletions azure-pipelines.yml
Expand Up @@ -65,24 +65,24 @@ jobs:
parameters:
platform: linux

- job: 'macOS1015'
pool:
vmImage: macOS-10.15
strategy:
matrix:
py37:
python.version: '3.7'
TOXENV: py37
py38:
python.version: '3.8'
TOXENV: py38
py39:
python.version: '3.9'
TOXENV: py39
maxParallel: 4

steps:
- template: ci/azure-pipelines-steps.yml
parameters:
platform: macos

#- job: 'macOS1015'
# pool:
# vmImage: macOS-10.15
# strategy:
# matrix:
# py37:
# python.version: '3.7'
# TOXENV: py37
# py38:
# python.version: '3.8'
# TOXENV: py38
# py39:
# python.version: '3.9'
# TOXENV: py39
# maxParallel: 4
#
# steps:
# - template: ci/azure-pipelines-steps.yml
# parameters:
# platform: macos
#
33 changes: 25 additions & 8 deletions spaceplot/__init__.py
@@ -1,14 +1,23 @@

"""
Plot multidimensional values against each other.
"""

from numpy import array as _array
from matplotlib.colors import Normalize as _Normalize
from matplotlib.gridspec import GridSpec as _GridSpec
from matplotlib.pyplot import figure as _figure

from ._version import get_versions
__version__ = get_versions()['version']
del get_versions


def spaceplots(
inputs, outputs, input_names=None, output_names=None, limits=None, **kwargs
):
"""
Plot multidimensional values against each other.
"""
num_samples, num_inputs = inputs.shape
if input_names is not None:
if len(input_names) != num_inputs:
Expand All @@ -30,22 +39,26 @@ def spaceplots(
raise RuntimeError(
"There must be a upper and lower limit for each output"
)
elif limits.shape[0] != num_outputs:
if limits.shape[0] != num_outputs:
raise RuntimeError("Output data and limits don't match")
else:
limits = [[None, None]] * num_outputs

for out_index in range(num_outputs):
yield _subspace_plot(
inputs, outputs[:, out_index], input_names=input_names,
output_name=output_names[out_index], min_output=limits[out_index][0],
output_name=output_names[out_index],
min_output=limits[out_index][0],
max_output=limits[out_index][1], **kwargs
)


def _setup_axes(
*, input_names, histogram_labels=False, constrained_layout=True
):
"""
Setup axes
"""
num_inputs = len(input_names)
fig = _figure(constrained_layout=constrained_layout)
axes = _array(
Expand Down Expand Up @@ -96,6 +109,9 @@ def _subspace_plot(
inputs, output, *, input_names, output_name, scatter_args=None,
histogram_args=None, min_output=None, max_output=None
):
"""
Do actual plotting
"""
if scatter_args is None:
scatter_args = {}
if histogram_args is None:
Expand Down Expand Up @@ -144,13 +160,14 @@ def _subspace_plot(


def _plot_hist(values, *, axis, **kwargs):
"""
Plot histogram subplot
"""
return axis.hist(values, **kwargs)


def _plot_scatter(*, x, y, z, axis, norm, **kwargs):
"""
Plot scatter subplot
"""
return axis.scatter(x=x, y=y, c=z, norm=norm, **kwargs)


from ._version import get_versions
__version__ = get_versions()['version']
del get_versions

0 comments on commit 375b374

Please sign in to comment.