Skip to content

Commit

Permalink
Merge pull request #35 from 1313e/dev
Browse files Browse the repository at this point in the history
Mark release of v1.2.3.
  • Loading branch information
1313e committed Mar 25, 2020
2 parents 7ae4bad + 8d102c5 commit 2db5a91
Show file tree
Hide file tree
Showing 37 changed files with 1,599 additions and 814 deletions.
42 changes: 29 additions & 13 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,51 @@ schedules:
strategy:
matrix:
linux-python35:
imageName: 'ubuntu-16.04'
imageName: 'ubuntu-latest'
python.version: '3.5'
linux-python36:
imageName: 'ubuntu-16.04'
imageName: 'ubuntu-latest'
python.version: '3.6'
linux-python37:
imageName: 'ubuntu-16.04'
imageName: 'ubuntu-latest'
python.version: '3.7'
linux-python38:
imageName: 'ubuntu-latest'
python.version: '3.8'
upload_coverage: true
mac-python37:
imageName: 'macos-10.13'
python.version: '3.7'
mac-python38:
imageName: 'macOS-latest'
python.version: '3.8'
upload_coverage: true
windows-x86-python35:
imageName: 'windows-2019'
imageName: 'windows-latest'
python.version: '3.5'
python.arch: 'x86'
windows-x86-python36:
imageName: 'windows-2019'
imageName: 'windows-latest'
python.version: '3.6'
python.arch: 'x86'
windows-x86-python37:
imageName: 'windows-2019'
imageName: 'windows-latest'
python.version: '3.7'
python.arch: 'x86'
windows-x86-python38:
imageName: 'windows-latest'
python.version: '3.8'
python.arch: 'x86'
upload_coverage: true
windows-x64-python35:
imageName: 'windows-2019'
imageName: 'windows-latest'
python.version: '3.5'
windows-x64-python36:
imageName: 'windows-2019'
imageName: 'windows-latest'
python.version: '3.6'
windows-x64-python37:
imageName: 'windows-2019'
imageName: 'windows-latest'
python.version: '3.7'
windows-x64-python38:
imageName: 'windows-latest'
python.version: '3.8'
upload_coverage: true
deploy: true
maxParallel: 10
Expand All @@ -86,8 +96,14 @@ steps:
displayName: Install missing libraries required for Qt on Linux

# Install dependencies and PRISM
- script: |
- bash: |
python -m pip install --upgrade pip setuptools wheel
if [[ $BUILD_SOURCEBRANCH == refs/heads/* ]] && [[ $BUILD_SOURCEBRANCH != "refs/heads/master" ]]; then
git clone -b dev https://github.com/1313e/e13Tools ../e13Tools
cd ../e13Tools
pip install .
cd -
fi
pip install -r requirements_dev.txt
displayName: Install testing dependencies

Expand Down
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
codecov:
notify:
require_ci_to_pass: yes
token: 6a194e41-c88d-4b7e-af10-29d9f54f8d84

coverage:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2019, Ellert van der Velden
Copyright (c) 2019-2020, Ellert van der Velden
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ Huge thanks to James Josephides for making the *PRISM* logo.
.. |Azure| image:: https://img.shields.io/azure-devops/build/1313e/2f7c67c7-61eb-4e70-9ff3-7f54f8e39987/1?logo=azure-pipelines&logoColor=white&label=Azure
:target: https://dev.azure.com/1313e/PRISM/_build/latest?definitionId=1
:alt: Azure Pipelines - Build Status
.. |ReadTheDocs| image:: https://img.shields.io/readthedocs/e13tools/latest.svg?logo=read%20the%20docs&logoColor=white&label=Docs
:target: https://e13tools.readthedocs.io/en/latest
.. |ReadTheDocs| image:: https://img.shields.io/readthedocs/prism-tool/latest.svg?logo=read%20the%20docs&logoColor=white&label=Docs
:target: https://prism-tool.readthedocs.io/en/latest
:alt: ReadTheDocs - Build Status
.. |Coverage| image:: https://img.shields.io/codecov/c/github/1313e/PRISM/master.svg?logo=codecov&logoColor=white&label=Coverage
:target: https://codecov.io/gh/1313e/PRISM/branches/master
Expand Down
4 changes: 3 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Package imports
import matplotlib as mpl
from py.path import local
import _pytest
import pytest


Expand All @@ -29,7 +30,8 @@ def pytest_configure(config):
# This introduces a marker that auto-fails tests if a previous one failed
def pytest_runtest_makereport(item, call):
if "incremental" in item.keywords:
if call.excinfo is not None:
if(call.excinfo is not None and
call.excinfo.type is not _pytest.outcomes.Skipped):
parent = item.parent
parent._previousfailed = item

Expand Down
3 changes: 3 additions & 0 deletions docs/source/api/prism.modellink.PolyLink.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PolyLink
========
.. autoclass:: prism.modellink.PolyLink
1 change: 1 addition & 0 deletions docs/source/api/prism.modellink.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Classes
.. toctree::
prism.modellink.GaussianLink
prism.modellink.ModelLink
prism.modellink.PolyLink
prism.modellink.SineWaveLink

Utilities
Expand Down
53 changes: 29 additions & 24 deletions docs/source/community_guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,7 @@ Users are highly encouraged to make contributions to the package or request new
If you would like to contribute to the package, but do not know what, then there are quite a few ToDos in the code that may give you some inspiration.
As with contributions, if you find a problem or issue with *PRISM*, please do not hesitate to open a `GitHub issue`_ about it or post it on `Gitter`_.

And, finally, if you use *PRISM* as part of your workflow in a scientific publication, please consider including an acknowledgement like *"Parts of the results in this work were derived using the PRISM Python package."* and citing the *PRISM* pipeline paper:

.. code-block:: none
@ARTICLE{2019ApJS..242...22V,
author = {{van der Velden}, E. and {Duffy}, A.~R. and {Croton}, D. and
{Mutch}, S.~J. and {Sinha}, M.},
title = "{Model dispersion with PRISM; an alternative to MCMC for rapid analysis of models}",
journal = {\apjs},
keywords = {Astrophysics - Instrumentation and Methods for Astrophysics, Physics - Computational Physics},
year = "2019",
month = "Jun",
volume = {242},
number = {2},
eid = {22},
pages = {22},
doi = {10.3847/1538-4365/ab1f7d},
archivePrefix = {arXiv},
eprint = {1901.08725},
primaryClass = {astro-ph.IM},
adsurl = {http://adsabs.harvard.edu/abs/2019ApJS..242...22V},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
And, finally, if you use *PRISM* as part of your workflow in a scientific publication, please consider including an acknowledgement like *"Parts of the results in this work were derived using the PRISM Python package."* and citing the *PRISM* pipeline paper using the BibTeX-entry below.

.. _GitHub issue: https://github.com/1313e/PRISM/issues
.. _Gitter: https://gitter.im/1313e/PRISM
Expand All @@ -43,6 +20,34 @@ License
:language: none


Citation
--------
This BibTeX-entry is also available in *PRISM* using :func:`~prism._internal.get_bibtex` (available as :pycode:`prism.get_bibtex()`).

.. code-block:: none
@ARTICLE{2019ApJS..242...22V,
author = {{van der Velden}, Ellert and {Duffy}, Alan R. and {Croton}, Darren and
{Mutch}, Simon J. and {Sinha}, Manodeep},
title = "{Model Dispersion with PRISM: An Alternative to MCMC for Rapid Analysis of Models}",
journal = {\apjs},
keywords = {methods: data analysis, methods: numerical,
Astrophysics - Instrumentation and Methods for Astrophysics, Physics - Computational Physics},
year = 2019,
month = jun,
volume = {242},
number = {2},
eid = {22},
pages = {22},
doi = {10.3847/1538-4365/ab1f7d},
archivePrefix = {arXiv},
eprint = {1901.08725},
primaryClass = {astro-ph.IM},
adsurl = {https://ui.adsabs.harvard.edu/abs/2019ApJS..242...22V},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}


Additions
---------
.. include:: additions.inc
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# -- Project information -----------------------------------------------------

project = 'PRISM'
copyright = '2019, Ellert van der Velden'
copyright = '2019-2020, Ellert van der Velden'
author = 'Ellert van der Velden'

# The short X.Y version
Expand Down
10 changes: 7 additions & 3 deletions docs/source/user/hdf5.inc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ An iteration data group (``'i'``) contains:
- ``'emul_n'``: The data group that contains all data for a specific emulator system in this iteration.
The value of ``'n'`` indicates which emulator system it is, not the data point.
See below for its contents;
- ``'emul_space'``: The boundaries of the hypercube that encloses the parameter space in which this iteration is defined.
This is always equal to the plausible space of the previous iteration;
- ``'impl_sam'``: The set of emulator evaluation samples that survived the implausibility checks and will be used to construct the next iteration;
- ``'proj_hcube'``: The data group that contains all data for the (created) projections for this iteration, if at least one has been made. See below for its contents;
- ``'sam_set'``: The set of model realization samples that were used to construct this iteration.
Expand All @@ -56,11 +58,12 @@ An iteration data group (``'i'``) contains:
----

An emulator system data group (``'i/emul_n'``) contains:
- Attributes (5+): List the details about the model comparison data point used in this emulator system, including:
- Attributes (7+): List the details about the model comparison data point used in this emulator system, including:

- Active parameters for this emulator system;
- Data errors, identifiers, value space and value;
- Regression score and residual variance if regression was used.
- Regression score and residual variance if regression was used;
- The active and passive contributions to the residual variance (obtained from either the regression residual variance or the Gaussian sigma).

- ``'cov_mat'``: The pre-calculated covariance matrix of all model evaluation samples in this emulator system.
This data set is never used in *PRISM* and stored solely for user-convenience;
Expand All @@ -84,4 +87,5 @@ A projections data group (``'i/proj_hcube'``) contains individual projection dat
- Projection depth and resolution.

- ``'impl_los'``: The calculated line-of-sight depth for all grid points in this projection;
- ``'impl_min'``: The calculated minimum implausibility values for all grid points in this projection.
- ``'impl_min'``: The calculated minimum implausibility values for all grid points in this projection;
- ``'proj_space'``: The boundaries of the hypercube that encloses the defined parameter space of this projection.
5 changes: 5 additions & 0 deletions docs/source/user/projections.inc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ However, since the first value is still the highest implausibility value, that v
Smoothing figures usually allows for 3D projections (2D projections rarely show this) to become less crowded, but they do throw away information.
It should therefore only be used when necessary.

.. versionadded:: 1.2.3
The `use_par_space` argument is also a bool, which controls whether the axes limits should be given by the model parameter space limits (:pycode:`True`) or by the parameter space over which the emulator iteration is defined (:pycode:`False`, default).
If :pycode:`False`, only the parameter space in which the emulator is defined is shown, which more often than not allows for more details to be seen in the projection figure.
If :pycode:`True`, the full model parameter space is used for the axes limits, allowing projection figures from different iterations to be compared with each other more easily.

The `force` argument is a bool, which controls what to do if a projection is requested for which data already exists.
If :pycode:`False` (default), it will use the previously acquired projection data to create the projection figure if it does not exist, skip if it does or return the figure data if `figure` is :pycode:`False`.
If :pycode:`True`, the projection data and all associated projection figures will be deleted, and the projection will be recalculated.
Expand Down
3 changes: 1 addition & 2 deletions prism/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@

# %% IMPORTS
# Package imports
from e13tools import compare_versions as _compare_versions
from e13tools.utils import aux_char_set
from e13tools import aux_char_set, compare_versions as _compare_versions
from mpi4pyd import MPI as _MPI

# PRISM imports
Expand Down
2 changes: 1 addition & 1 deletion prism/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# %% VERSIONS
# Default/Latest/Current version
__version__ = '1.2.2'
__version__ = '1.2.3'

# Compatibility versions
compat_version = ['1.0.0rc12']
26 changes: 8 additions & 18 deletions prism/_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@
Array containing the model outputs of all specified externally
provided model evaluation samples."""
ext_real_set_doc =\
"""ext_real_set : list, dict or None{0}{1}
List of dicts containing an externally calculated set of model
evaluation samples and its data values, a dict with keys
``['sam_set', 'mod_set']`` containing these dicts or *None* if no
"""ext_real_set : str, list, dict or None{0}{1}
String indicating the suffix of the backup file that needs to be
used; list of dicts containing an externally calculated set of
model evaluation samples and its data values; a dict with keys
``['sam_set', 'mod_set']`` containing these dicts; or *None* if no
external set needs to be used."""
ext_real_set_doc_s = ext_real_set_doc.format("", "")
ext_real_set_doc_d = ext_real_set_doc.format(ds, "None")
Expand Down Expand Up @@ -255,24 +256,13 @@
# %% PROJECTION DOCSTRINGS
# Docstrings of draw_proj_fig methods
draw_proj_fig_doc =\
"""Draws the {0} projection figure for the provided `hcube`, given the
`impl_min` and `impl_los` values.
"""Draws the {0} projection figure for the provided `hcube`.
Parameters
----------
hcube : 1D array_like of int of length {1}
Array containing the internal integer identifiers of the main model
parameters that require a projection figure.
impl_min : 1D :obj:`~numpy.ndarray` object
List containing the lowest implausibility value that can be reached
in every single grid point on the given hypercube.
impl_los : 1D :obj:`~numpy.ndarray` object
List containing the fraction of the total amount of evaluated
samples in every single grid point on the given hypercube, that
still satisfied the implausibility cut-off criterion.
proj_res : int
Number of emulator evaluations used to generate the grid for the
given hypercube."""
parameters that require a projection figure."""

# Description of hcube
hcube_doc =\
Expand Down Expand Up @@ -436,6 +426,6 @@ class that was created for drawing *{0}*.
save_data_doc_e = save_data_doc.format(
std_emul_i_doc+"\n\t"+lemul_s_doc+"\n\t", "{'active_par'; "
"'active_par_data'; 'cov_mat'; 'exp_dot_term'; 'mod_real_set'; "
"'regression'}")
"'regression', 'rsdl_var'}")
save_data_doc_pr = save_data_doc.format(std_emul_i_doc+"\n\t",
"{'nD_proj_hcube'}")
8 changes: 4 additions & 4 deletions prism/_gui/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import signal

# Package imports
from e13tools.utils import docstring_append, raise_error
import e13tools as e13
import matplotlib as mpl
from matplotlib.pyplot import switch_backend
from qtpy import QtCore as QC, QtWidgets as QW
Expand All @@ -30,8 +30,8 @@

# %% FUNCTION DEFINITIONS
# This function starts up the Projection GUI 'Crystal'
@docstring_append(start_gui_doc_pars, '\n\t\n\t')
@docstring_append(start_gui_doc)
@e13.docstring_append(start_gui_doc_pars, '\n\t\n\t')
@e13.docstring_append(start_gui_doc)
def start_gui(pipeline_obj): # pragma: no cover
# Create a logger
logger = getCLogger('GUI')
Expand All @@ -44,7 +44,7 @@ def start_gui(pipeline_obj): # pragma: no cover
if not isinstance(pipeline_obj, Pipeline):
err_msg = ("Input argument 'pipeline_obj' must be an instance of the "
"Pipeline class!")
raise_error(err_msg, TypeError, logger)
e13.raise_error(err_msg, TypeError, logger)

# Activate worker mode
with pipeline_obj.worker_mode:
Expand Down
8 changes: 4 additions & 4 deletions prism/_gui/widgets/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from traceback import format_exception_only, format_tb

# Package imports
from e13tools.utils import docstring_substitute
import e13tools as e13
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
from qtpy import QtCore as QC, QtGui as QG, QtWidgets as QW

Expand Down Expand Up @@ -204,7 +204,7 @@ def create_traceback_box(self):

# This function shows or hides the traceback box
@QC.Slot()
@docstring_substitute(qt_slot=qt_slot_doc)
@e13.docstring_substitute(qt_slot=qt_slot_doc)
def toggle_traceback_box(self):
"""
Toggles the visibility of the traceback box and updates the dimensions
Expand Down Expand Up @@ -468,7 +468,7 @@ def open(self):
self.thread.start()

# While the thread is running, keep processing user input events
while self.thread.isAlive():
while self.thread.is_alive():
qapp.processEvents()
self.thread.join(0.1)

Expand Down Expand Up @@ -503,7 +503,7 @@ def raise_exception(self, exception):

# This function kills all worker threads and then the controller thread
@QC.Slot()
@docstring_substitute(qt_slot=qt_slot_doc)
@e13.docstring_substitute(qt_slot=qt_slot_doc)
def kill_threads(self):
"""
Terminates all currently running threads besides the main thread (on
Expand Down

0 comments on commit 2db5a91

Please sign in to comment.