Welcome to xyzpy’s documentation!

https://travis-ci.org/jcmgray/xyzpy.svg?branch=master https://codecov.io/gh/jcmgray/xyzpy/branch/master/graph/badge.svg LGTM Grade Documentation Status

xyzpy is python library for efficiently generating, manipulating and plotting data with a lot of dimensions, of the type that often occurs in numerical simulations. It stands wholly atop the labelled N-dimensional array library xarray. The project is hosted on github, please do submit any issues or PRs there.

The aim is to take the pain and errors out of generating and exploring data with a high number of possible parameters. This means:

  • you don’t have to write super nested for loops

  • you don’t have to remember which arrays/dimensions belong to which variables/parameters

  • you don’t have to parallelize over or distribute runs yourself

  • you don’t have to worry about loading, saving and merging disjoint data

  • you don’t need to guess when a set of runs is going to finish

As well as the ability to automatically parallelize over runs, xyzpy provides the Crop object that allows runs and results to be written to disk, these can then be run by any process with access to the files - e.g. a batch system - or just serve as a convenient persistent progress mechanism.

In terms of post-processing, as well as all the power of xarray, xyzpy adds uneven step differentiation and error propagation, filtering and interpolation - along any axis just specified by name.

The aim of the plotting functionality is to keep the same interface between interactively plotting the data using bokeh, and static, publication ready figures using matplotlib, whilst being able to see the dependence on up to 4 dimensions at once.

Quick-start

In [1]: import xyzpy as xyz
   ...: import time as time

In [2]: @xyz.label(var_names=['sum', 'diff'])
   ...: def sumdiff(a, b):
   ...:     time.sleep(0.5)
   ...:     return a + b, a - b
   ...:

In [3]: combos = {'a': range(1, 10), 'b': range(23, 27)}

In [4]: sumdiff.run_combos(combos, parallel=True)
100%|###########################################| 36/36 [00:06<00:00,  5.33it/s]
Out[4]:
<xarray.Dataset>
Dimensions:  (a: 9, b: 4)
Coordinates:
  * a        (a) int64 1 2 3 4 5 6 7 8 9
  * b        (b) int64 23 24 25 26
Data variables:
    sum      (a, b) int64 24 25 26 27 25 26 27 28 26 ... 31 32 33 34 32 33 34 35
    diff     (a, b) int64 -22 -23 -24 -25 -21 -22 ... -17 -18 -14 -15 -16 -17

Examples

These following examples are generated from the notebooks in docs/examples. They demonstrate more complete usage or advanced features of xyzpy.

Installation

xzypy is itself a pure python package and can be found on pypi. The core dependencies are:

Processing functions like filtering and differentiating require:

and the plotting functionality is provided by:

The recommended way of installing these is using the conda package manager. A development version of xyzpy can be installed directly from github using the command:

pip install -U git+https://github.com/jcmgray/xyzpy.git

Indices and tables