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

Get tests/CI minimally passing for now #17

Merged
merged 2 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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