Orbithunter v 1.1.1: Framework for Nonlinear Dynamics and Chaos¶
Orbithunter serves as a framework for solving chaotic nonlinear partial differential equations via variational formulation. In other words, equations are posed as boundary value problems (typically with periodic boundary conditions) which manifest as differential algebraic equations.
This is in stark contrast with typical dynamical systems formulation of chaotic systems, which use an initial value problem in time. The argument in favor of orbithunter’s BVP/DAE formulation is that by definition, the hyperbolic dynamical systems under investigation suffer from exponential instabilities. This relegates forecasting and prediction to a finite time window. Orbithunter believes that this is a clear indication that posing the problem as an initial value problem is incorrect; one must create a setting where dynamics no longer take place.
Want a crash course on chaos or a good reference text (not https secure)? Alternatively, if you would like a more traditional approach to computational chaos in fluid dynamics, check out openpipeflow or channelflow 2.0. If you’re looking ahead to the future, the next big thing might be based in Julia.
Features¶
An object oriented approach of differential algebraic equations.
Vectorized (tensorized really) computations using NumPy broadcasting and tensor operations.
A general-purpose framework for finding, visualizing and manipulating these solutions
High-level access to SciPy API for usage with differential algebraic equations.
New spatiotemporal techniques developed in PhD thesis
Orbithunter uses [NumPy] and [SciPy] for its numerical calculations. Its design emphasizes user-friendliness and modularity; giving quick and easy access to high-level numerical operations.
Checkout the resources included in the github repository for more help and tutorials!
Documentation¶
- Release
1.1.1
- Date
Oct 01, 2021
Install¶
To get the latest stable release of orbithunter running locally, the package can either be installed locally via the Python package installation manager pip or can be accessed via a Docker container.
Docker installation¶
To facilitate scientific developments outside of the core development, the latest release has been used to create a Docker image. To the uninitated, Docker is a platform for containerizing applications, which, broadly speaking, makes it so the Python dependencies and issues arising from differences in operating systems can be avoided. The Docker image itself runs a jupyter notebook kernel, allowing the jupyter notebook GUI to be used in the local machine’s browser. Crudely speaking, the containing is acting as a server/virtual machine, serving the jupyter notebook application, saving all local files and code to the Docker container.
Important notes: the port opened to allow the local machine to interact with the container is hard-coded to be 8887, meaning that trying to run two containers on the same machine won’t work currently. This is simply because I’m new to Docker and haven’t learned how to do anything else yet.
Acquiring the Docker image¶
In exchange for avoiding the local installation of Python, orbithunter and its requirements the user must install the Docker application . During the installation process, Docker is going to ask for permissions multiple times and might require the installation of WSL 2 files (linux compatibility) if not already present.
Once the application is installed, the Docker image can be pulled from the remote repository by opening command line and typing:
docker pull orbithunter/orbithunter:latest
At which point, the image will be downloaded. This image will be displayed in the Docker application under the Local portion of the Images tab.
Running the Docker image¶
The easiest way to instantiate the container is to run the following in command line, replacing <container name> with whatever is the desired name.:
docker run --name <container name> -p 8887:8887 orbithunter/orbithunter:latest
The -p switch opens the local port 8887 allowing for the jupyter notebook GUI to be opened in a browser. This prints output, the last bit of which will look like the following. The notebook accomplished by copying the last (for some reason it has to be the latter) URL to a browser (only ever been tested on chrome + windows).
Or copy and paste one of these URLs:
http://e3954f15092d:8887/?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
or http://127.0.0.1:8887/?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Once the jupyter GUI is open, it can be utilized as per usual. All computations and output data will be saved to the container; which will be randomly named if no name was provided. To restart the container after it has been turned off, run the command:
docker start <container_name>
Installation via pip¶
orbithunter requires Python 3.7, 3.8, or 3.9. If you do not already have a Python environment configured on your computer, please see the instructions for installing the full scientific Python stack.
It is assumed that the default Python environment already configured on
your computer and you intend to install orbithunter
inside of it. If you want
to create and work with Python virtual environments, please follow instructions
on venv and virtual
environments.
First, make sure you have the latest version of pip
(the Python package manager)
installed. If you do not, refer to the Pip documentation and install pip
first.
Install the current release of orbithunter
with pip
:
pip install orbithunter
To upgrade to a newer release use the --upgrade
flag:
pip install --upgrade orbithunter
If you do not have permission to install software systemwide, you can
install into your user directory using the --user
flag:
pip install --user orbithunter
Alternatively, you can manually download orbithunter
from
GitHub or
PyPI.
To install one of these versions, unpack it and run the following from the
top-level source directory using the Terminal:
pip install .
Extra packages¶
Note
Some optional packages are required for full functionality of all orbithunter modules.
The two modules which are not supported by the default install are orbithunter.persistent_homology
and orbithunter.machine_learning
. These act as an API that allows interaction with
gudhi
, scikit-learn
, and tensorflow
packages.
The following extra packages provide additional functionality. See the
files in the requirements/
directory for information about specific
version requirements.
Gudhi and Python optimal transport for topological data analysis
To install orbithunter
and extra packages, do:
pip install orbithunter[extra]
To explicitly install all optional packages, do:
pip install ipykernel jupyterlab ipython gudhi pot scikit-learn tensorflow
Or, install any optional package (e.g., gudhi
) individually:
pip install gudhi
Warning
To get POT to install correctly, you need to have cython and numpy BEFORE you run:
pip install pot
Testing¶
Orbithunter uses the Python pytest
testing package. You can learn more
about pytest on their homepage.
Test a source distribution¶
After navigating to the downloaded source directory, the tests can be evaluated by the following commands:
pytest .
or for more control, pytest arguments can be included
pytest –pyargs .
or for individual files e.g. test_basic.py
pytest –pyargs test_basic.py
For those that are unaware .
is synonymous with “evaluate in the current directory”. Pytest will automatically
search for the tests folder and any file that begins with the prefix “test”.
Developer Guide¶
Preface¶
The following guide demonstrates the class methods required for full functionality in the orbithunter framework. This documentatino is presented much like how one might document their own equation module for inclusion in the main orbithunter branch. The creator of orbithunter Matthew Gudorf developed the framework to be as agnostic of equation as possible. That is, the techniques and tools should generalize to any equation, so long as the proper class methods are written. Because of this, the following is presented as a template for each technique or submodule. Implementation of the methods in each section should enable the functionality of the corresponding orbithunter module.
Orbithunter was designed with field equations in mind; that is, where the Orbit state array is a continuous function with respect to its dimensions. While it has not been tested, the package should work all the same as long as the user treats the vector components as a “discrete dimension”, i.e. arrays of shape (#, #, #, #, 3) or something similar.
Warning
Be sure to check the base orbithunter.core.Orbit
class before writing your methods; there very well may
be methods which already exist but are not included here either for brevity and because they generalize to other
equations.
SymmetryOrbitEQN Class¶
As mentioned in the preface, orbithunter
has tried to do most of the heavy lifting. For the user, the task
of implementing a module for a new equation is as simple as implementing a certain subset of methods that are equation and or
dimension dependent. If the following list of methods is completed, then all orbithunter utilities should be
available. The lion’s share is implementing the spatiotemporal equations and its gradients. The main successes have
been made using spectral methods, which leverage expansions in terms of global, spatiotemporal basis functions. It
is believed that there is an intimate link between these expansions and keeping the spatiotemporal domain sizes variable
quantities, and so only usage of spectral methods is recommended. For periodic boundary conditions we recommended
using a Fourier basis and for aperiodic boundary conditions Chebyshev polynomial bases are recommended.
Note
This is also available as a .py
file in the tutorials under class_template
-
class
template.class_template.
SymmetryOrbitEQN
(state=None, basis=None, parameters=None, discretization=None, constraints=None, **kwargs)[source]¶ Template for implementing other equations. Name is demonstration of orbithunter naming conventions
- Parameters
- statendarray, default None
If an array, it should contain the state values congruent with the ‘basis’ argument.
- basisstr, default None
Which basis the array state is currently in.
- parameterstuple, default None
Parameters required to uniquely define the Orbit.
- discretizationtuple, default None
The shape of the state array in configuration space, i.e. the ‘physical’ basis.
- constraintsdict, default None
Dictionary whose labels are parameter labels, and values are bool. If True, then corresponding parameter will be treated as a constant during optimization routines.
- kwargs :
Possible extra arguments for _parse_parameters and _parse_state.
Notes
The name of the base class for new equations should be Orbit + equation acronym, symmetry subclasses adding a prefix which describes said symmetry.
Methods¶
Static Methods¶
Methods decorated with @staticmethod
Labels of the different bases that ‘state’ attribute can be in. |
|
Strings to use to label dimensions. |
|
Strings to use to label discretization variables. |
|
Strings to use to label dimensions/periods; typically a subset of parameter_labels. |
|
The smallest possible discretization that can be used without methods breaking down. |
|
The smallest valid increment to change the discretization by. |
|
Bools indicating whether an array’s axes represent continuous dimensions or not. |
Governing Equations¶
Implementation of the governing equations is the lion’s share of the work and the most important part; matvec and rmatvec return the product of Jacobian and Jacobian transpose with a matrix; preferably without construction of the matrix itself. For certain numerical methods to work, these methods must handle parameters in a special way. See each individual method for details.
Return an instance whose state is an evaluation of the governing equations. |
|
Matrix-vector product of self.jacobian and other.orbit_vector |
|
Matrix-vector product of adjoint of self.jacobian and other.state |
|
Jacobian matrix evaluated at the current state. |
Numerical Optimization¶
|
Cost function evaluated at current state. |
|
Gradient of cost function; optional unless cost was defined |
Second Order Numerical Optimization¶
Certain algorithms require the Hessian matrix of the matrix vector product thereof. The SciPy implementations of the numerical methods that use these are fully developed but the orbithunter API still requires testing. Likewise, there are issues that are on SciPy’s end with using finite difference methods. They’ve been reported to their github issues page, see github issues for details.
|
Tensor product u * H * v where H is the matrix of second derivatives of governing equations. |
|
Matrix of second derivatives of the governing equations. |
|
Hessian matrix of the cost function |
|
Matrix-vector product with the Hessian of the cost function |
Defaults¶
The default array shape when dimensions are not specified. |
|
Intervals (continuous) or iterables (discrete) used to populate parameters. |
|
Sometimes parameters are necessary but constant; this allows for exclusion from optimization without hassle. |
|
Indicates whether numpy indexing corresponds to increasing or decreasing values configuration space variable |
State Transformations¶
These methods are recommended but optional methods; the base orbit class has simple implementations for all of these
|
Strategy for combining tile dimensions in gluing; default is arithmetic averaging. |
|
Increase the size of the discretization along an axis. |
|
Decrease the size of the discretization along an axis |
Other¶
The methods in this section are ones which really cannot be generalized at all, methods which may be heavily reliant on equation and methods which do not really fit anywhere else on this list. .
|
Signature for plotting method. |
|
Utility to convert from numpy array (orbit_vector) to Orbit instance for scipy wrappers. |
Follow orbithunter conventions for discretization size. |
|
Bools indicating whether or not dimension is periodic for persistent homology calculations. |
Reference¶
- Release
1.1
- Date
Oct 01, 2021
Base Orbit Class¶
The base Orbit class
Overview¶
-
class
orbithunter.core.
Orbit
(state=None, basis=None, parameters=None, discretization=None, constraints=None, **kwargs)[source]¶ Base class for orbits.
- Parameters
- statendarray, default None
If an array, it should contain the state values congruent with the ‘basis’ argument.
- basisstr, default None
Which basis the array state is currently in. Must be str if type(state) is np.ndarray
- parameterstuple, default None
Parameters required to uniquely define the Orbit.
- discretizationtuple, default None
The shape of the state array in configuration space, i.e. the ‘physical’ basis.
- constraintsdict, default None
Dictionary whose keys are parameter labels, and values are bool. If True, then corresponding parameter will be treated as a constant during optimization routines.
- kwargs :
Extra arguments for _parse_parameters and _parse_state (future/subclass usage only).
Notes
NumPy broadcasting will occur as one would expect if relevant numerical quantities are compatible type and shape.
The common usage case of constructing instances has the user specifying the state, basis and parameter values. For advanced numerical operations, however, it is required to know which parameters are cosntrained, stored in the constraints attribute, and what the shape of the state array is, prior to any transformations, this is stored in the discretization attribute. Because of this,
Orbit.__init__()
parses the input and sets the constraints using defaults specified by private method Orbit._default_constraints(); and also parses the state array for its shape in the ‘physical’ basis. Take note that the discretization attribute is NOT the current shape of the state. There are many cases where the current state’s shape is not sufficient information; to avoid parsing of this type in all future calculations, it is done upon creation of the instance. This parsing takes time; it can and should be avoided. To avoid parsing, all primary attributes that would otherwise be parsed need to be passed upon creation. ForOrbit
this consists of: state, basis, parameters, discretization, and constraints. It is assumed that the information is coherent if it is all being passed by the user; i.e. the discretization does in fact correspond to the state array passed.Examples
Orbit instances can be created in a multitude of ways. Typically it is acceptable to think of Orbits as a bundle of a state array and parameters.
Create an empty Orbit instance.
>>> orb = Orbit()
Create an empty Orbit instance, and then use built-in or user prescribed methods to fill its values
>>> orb = Orbit() >>> orb.populate(seed=0) # By default all attributes are populated; seed for reproducibility >>> print(repr(orb)) Orbit({"shape": [2, 2, 2, 2], "basis": "physical", "parameters": [0.549, 0.715, 0.603, 0.545]})
The attributes can also be specified using values ‘all’ (default), ‘state’ and ‘parameters’ for keyword ‘attr’.
>>> u = Orbit() >>> u.populate(attr='parameters', seed=0) >>> print(repr(orb)) Orbit({"shape": [0, 0, 0, 0], "basis": null, "parameters": [0.549, 0.715, 0.603, 0.545]})
Create and Orbit by providing state and parameter information
>>> example_state = np.ones([2, 2, 2, 2]) >>> example_parameters = (16, 16, 16, 16) >>> u = Orbit(state=example_state, basis='physical', parameters=example_parameters)
“Fast” initialization occurs when the five main attributes: ‘state’, ‘basis’, ‘parameters’, ‘constraints’ and ‘discretization are provided. If ‘state’ and ‘basis’ are provided by ‘discretization’ is not, then ‘discretization’ is parsed from the state array. If ‘parameters’ is provided but ‘constraints’ are not, then the default constraints are used. These two parsing/argument checking routines occur independently.
>>> example_state = np.ones([2, 2, 2, 2]) >>> example_parameters = (16, 16, 16, 16) >>> example_constraints = {'t': True, 'x': False, 'y': False, 'z': False} >>> example_discretization = example_state.shape >>> u = Orbit(state=example_state, basis='physical', parameters=example_parameters, ... constraints=example_constraints, discretization=example_discretization)
Using Jupyter Lab’s cell magic %%timeit to demonstrate. No parsing is much faster on a relative basis.
>>> %%timeit >>> u = Orbit(state=example_state, basis='physical', parameters=example_parameters, ... constraints=example_constraints, discretization=example_discretization) 1.44 µs ± 97.5 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
>>> %%timeit >>> u = Orbit(state=example_state, basis='physical', parameters=example_parameters) 10.9 µs ± 36.5 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
The latter is the more common usage, but when writing functions it is recommended to pass all attributes using dictionary unpacking; dictionary merging of the form {**dict1, **dict2} can be used to overwrite values of dict1 with new values in dict2 (those corresponding to the same keys, that is, the operation is otherwise a union).
>>> def example_func_(orbit_instance): >>> new_state_same_shape = ... >>> return orbit_instance.__class__(**{**vars(orbit_instance), 'state': new_state_same_shape})
Methods¶
Initialization¶
Examples of these methods are included in in Overview
|
Initialize self. |
|
Initialize random parameters or state or both. |
|
Should only be accessed through |
|
Should only be accessed through |
|
Parse and assign ‘state’, ‘basis’ and ‘discretization’ attributes. |
|
Parse and set the parameters attribute. |
See Python Docs for the definition of ‘special’
Special Methods¶
|
Addition of Orbit state and other numerical quantity. |
|
Addition of Orbit state and other numerical quantity. |
|
Subtraction of other numerical quantity from Orbit state. |
|
Subtraction of Orbit state from other numeric quantity |
|
Multiplication of Orbit state and other numerical quantity |
|
Multiplication of Orbit state and other numerical quantity |
|
Division of Orbit state by other numerical quantity |
|
Floor division of Orbit state by other numerical quantity |
|
Exponentiation of Orbit state. |
|
Modulo of Orbit state. |
|
Inplace addition of Orbit state with other |
|
Inplace subtraction of other from Orbit state |
|
Inplace multiplication of Orbit state with other |
|
Inplace exponentiation of Orbit state by other |
|
Inplace division of Orbit state by other |
|
Inplace floor division of Orbit state by other |
|
In place modulo of Orbit state |
String name |
|
More descriptive representation than __str__ with beautified parameters. |
|
|
Allows parameters, discretization variables to be retrieved by label directly |
|
Slicing of Orbit state and corresponding dimensions |
Properties¶
Current state array’s shape |
|
Current state array’s dimensionality |
|
Current state array’s number of dimensions |
State Transformations¶
|
Reflect the velocity field about the spatial midpoint |
|
Apply numpy roll along specified axis. |
|
Rotate by period/n_cell in either axis. |
|
Placeholder/signature for possible symmetry subclasses. |
|
Placeholder/signature for possible symmetry subclasses. |
|
Rediscretize the current state typically via zero padding or interpolation. |
|
Increase the size of the discretization along an axis. |
|
Decrease the size of the discretization along an axis |
Math Functions¶
Vector representation of Orbit instance; constants all variables required to define the Orbit instance. |
|
|
Return an instance whose state is an evaluation of the governing equations. |
|
Matrix-vector product of Jacobian and orbit_vector from other instance. |
|
Matrix-vector product of adjoint Jacobian and state from other instance. |
|
Jacobian matrix evaluated at the current state. |
|
Matrix of second derivatives of the governing equations. |
|
Tensor product u * H * v where H is the matrix of second derivatives of governing equations. |
|
Cost function evaluated at current state. |
|
Matrix-vector product corresponding to gradient of scalar cost functional \(1/2 F^2\) |
|
Matrix-vector product with the Hessian of the cost function. |
|
Matrix-vector product with the Hessian of the cost function. |
Orbit instance with absolute value of state. |
|
|
Return the L_2 inner product of two orbits |
|
Norm of spatiotemporal state via numpy.linalg.norm |
|
Rescaling of the state in the ‘physical’ basis per strategy denoted by ‘method’ |
|
Utility to convert from numpy array (orbit_vector) to Orbit instance for scipy wrappers. |
|
Incrementally add Orbit instances together |
Discretization and Dimension¶
The possible shapes of the current state based on discretization and basis. |
|
Dimensions of the spatiotemporal tile (configuration space). |
|
|
Strategy for combining tile dimensions in gluing; default is arithmetic averaging. |
Bools indicating whether or not dimension is periodic for persistent homology calculations. |
|
Follow orbithunter conventions for discretization size. |
Reading and Writing¶
|
Method for convenience and consistent/conventional file naming. |
|
Export current state information to HDF5 file |
Static¶
Labels of the different bases that ‘state’ attribute can be in. |
|
Strings to use to label dimensions. |
|
Strings to use to label dimensions/periods; typically a subset of parameter_labels. |
|
Strings to use to label discretization variables. |
|
The smallest possible discretization that can be used without methods breaking down. |
|
The smallest valid increment to change the discretization by. |
Other¶
Return an instance with copies of copy-able attributes. |
|
|
Return an Orbit instance with a numpy masked array state |
|
Set self constraints based on labels provided. |
Check the “status” of a solution |
Defaults¶
Dict of default values for constraints, parameter ranges, sizes, etc. |
|
The default array shape when dimensions are not specified. |
|
Intervals (continuous) or iterables (discrete) used to populate parameters. |
|
Sometimes parameters are necessary but constant; this allows for exclusion from optimization without hassle. |
Utility Functions¶
-
orbithunter.core.
convert_class
(orbit_instance, orbit_type, **kwargs)[source]¶ Utility for converting between different symmetry classes.
- Parameters
- orbit_instanceOrbit or Orbit subclass instance
The orbit instance to be converted
- orbit_typeOrbit type
The target class that orbit will be converted to.
- Returns
- Orbit :
New Orbit instance whose type is the provided orbit_type
Notes
This is for all practical purposes deprecated but it still provides readability so it has been kept as a convenience. To avoid conflicts with projections onto symmetry invariant subspaces, the orbit is always transformed into the physical basis prior to conversion; the instance is returned in the basis of the input, however.
Include any and all attributes that might be relevant to the new orbit and those which transfer over from old orbit via usage of vars(orbit_instance) and kwargs. If for some reason an attribute should not be passed, then providing attr=None in the function call is how to handle it, as the values in kwargs overwrite the values in vars(orbit_instance) via dictionary unpacking.
Kuramoto-Sivashinsky Equation¶
Note
For the Kuramoto-Sivashinsky equation there are six different Orbit
subclasses
Which orbit class should I use?¶
Let \(G\) denote a group of discrete spatiotemporal symmetries \(G = \{e, \sigma, \tau, \sigma\tau\}\) which represent the identity, spatial reflection, half-period time translation and spatiotemporal shift reflection (glide) which is the composition of spatial reflection and half-period time translation.
Orbit Class |
Invariance |
Equivariance |
---|---|---|
OrbitKS |
None |
Discrete rotations |
RelativeOrbitKS |
None |
Discrete rotations |
RelativeEquilibriumOrbitKS |
None |
Discrete rotations |
ShiftReflectionOrbitKS |
Spatial reflection + half-period time translation |
\(G\) |
AntisymmetricOrbitKS |
Spatial reflection |
\(G\) |
EquilibriumOrbitKS |
Spatial Reflection and time translation |
\(G\) |
Orbit Types¶
OrbitKS¶
-
class
orbithunter.
OrbitKS
(state=None, basis=None, parameters=None, discretization=None, constraints=None, **kwargs)[source]¶ Base class for orbits of the Kuramoto-Sivashinsky equation.
The Kuramoto-Sivashinsky equation is a fourth order partial differential equation that serves as a simplified testing ground for the more complicated Navier-Stokes equation. It’s form in configuration space, where the state variable \(u(t,x)\) is typically imagined as a velocity field of a laminar flame front. It’s spatiotemporal version with doubly periodic boundary conditions takes the form
\(u_t + u_{xx} + u_{xxxx} + 1/2(u^2)_x = 0\)
with boundary conditions
\(u(t, x) = u(t + T, x) = u(t, x+L) = u(t+T, x+L)\).
This class and its subclasses is used to find solutions to the system of differential algebraic equations (DAEs) which result from applying a discrete Fourier transform in both space and time.
The ‘state’ in configuration space is ordered such that when in the physical basis, the last row corresponds to ‘t=0’. This results in an extra negative sign when computing time derivatives. This convention was chosen because it is conventional to display positive time as ‘up’. This convention prevents errors due to flipping fields up and down.
To define an orbit, the configuration space (spatiotemporal dimensions) or tile must be defined. The unconventional approach of this package is to keep these domain dimensions as free variables.
The only additional parameter beyond the dimensions is a spatial shift parameter for solutions with continuous spatial translation symmetry; it only applies to
orbithunter.ks.orbits.RelativeOrbitKS
andorbithunter.ks.orbits.RelativeEquilibriumOrbitKS
. Its inclusion in the classorbithunter.ks.orbits.OrbitKS
is due to the ability to convert between Orbit types. The various subclasses represent symmetry invariant subspaces. Due to the nature of subspaces, it is numerically possible to find, for example, solutions with spatial reflection symmetry using OrbitKS. The discrete symmetry invariant orbits are literaly subspaces of solutions; any subclass member can be found using its parent class.Historically, only adj and lstsq were used, in combination, for OrbitKS and its subclasses: All possible methods include:
‘adj’
‘newton_descent’
‘lstsq’
‘lsqr’
‘lsmr’
‘bicg’
‘bicgstab’
‘gmres’
‘lgmres’
‘cg’
‘cgs’
‘qmr’
‘minres’
‘gcrotmk’
‘cg_min’
‘bfgs’
‘newton-cg’
‘l-bfgs-b’
‘tns’
‘slsqp’
Warning
If dimensions change by dramatic/nonsensible amounts then preconditioning=True can be used with certain methods (most notably, ‘adj’) to account for very large parameter gradients.
Warning
The following are supported but NOT recommended for the KSE.
‘nelder-mead’ (very very slow)
‘powell’ (very slow)
‘cobyla’ (slow),
See also
|
Initialize self. |
|
Initialize random parameters or state or both. |
|
Initialize a set of random spatiotemporal Fourier modes |
|
Should only be accessed through |
“Special” methods also known as “magic” or “dunder” (double underscore) methods account for most basic Math operations and other operations pertaining to NumPy arrays.
Note
See Orbit
for more details.
Current state array’s shape |
|
Current state array’s dimensionality |
|
Current state array’s number of dimensions |
State array shapes in different bases; determined by symmetry selection rules. |
|
Tile dimensions. |
|
|
Strategy for combining tile dimensions in gluing; default is arithmetic averaging. |
Return discretization size according to orbithunter conventions for the KSe. |
|
Dimensions according to plot labels; used in clipping. |
Vector representation of Orbit instance; constants all variables required to define the Orbit instance. |
|
Orbit instance with absolute value of state. |
|
|
Return the L_2 inner product of two orbits |
|
Norm of spatiotemporal state via numpy.linalg.norm |
|
Spatial derivative of the current state. |
|
Spectral time derivatives of the current state. |
|
Instance whose state is the Kuramoto-Sivashinsky equation evaluated at the current state |
|
Matrix-vector product of a vector with the Jacobian of the current state. |
|
Matrix-vector product with the adjoint of the Jacobian |
|
Rescale a vector with the inverse (absolute value) of linear spatial terms |
|
Jacobian matrix evaluated at the current state. |
|
Plot the velocity field as a 2-d density plot using matplotlib’s imshow |
|
Plot the spatiotemporal Fourier spectrum as a 2-d density plot using matplotlib’s imshow |
|
Transform current state to a different basis. |
|
Rediscretize the current state typically via zero padding or interpolation. |
|
Reflect the velocity field about the spatial midpoint |
|
Apply numpy roll along specified axis. |
|
Rotate by fraction of the period in either axis; nearest discrete approximate is taken. |
|
Rotate the velocity field in either space or time. |
Return a OrbitKS with shift-reflected velocity field |
|
|
Placeholder/signature for possible symmetry subclasses. |
|
Placeholder/signature for possible symmetry subclasses. |
|
Increase the size of the discretization via zero-padding |
|
Decrease the size of the discretization via truncation |
Labels of the different bases produced by transforms. |
|
The smallest possible compatible discretization to have full functionality. |
|
The smallest valid increment to change the discretization by. |
|
Strings to use to label dimensions/periods |
|
Labels of all parameters |
|
Strings to use to label dimensions/periods. |
|
Bools indicating whether or not dimension is periodic. |
|
Indicates whether numpy indexing corresponds to increasing or decreasing values configuration space variable |
Return an instance with copies of copy-able attributes. |
|
|
Return an Orbit instance with a numpy masked array state |
|
Set self constraints based on labels provided. |
Check whether the orbit converged to an equilibrium or close-to-zero solution |
Dict of default values for constraints, parameter ranges, sizes, etc. |
|
The default array shape when dimensions are not specified. |
|
Default parameter ranges. |
|
Defaults for whether or not parameters are constrained. |
|
Method for convenience and consistent/conventional file naming. |
|
Export current state information to HDF5 file. |
RelativeOrbitKS¶
Note
See also Orbit
and OrbitKS
.
|
Same as OrbitKS except for setting the ‘frame’ attribute. |
|
Randomly initialize parameters which are currently zero. |
|
Initialize a set of random spatiotemporal Fourier modes |
|
Should only be accessed through |
“Special” methods also known as “magic” or “dunder” (double underscore) methods account for most basic Math operations and other operations pertaining to NumPy arrays.
Note
See Orbit
for all definitions.
Current state array’s shape |
|
Current state array’s dimensionality |
|
Current state array’s number of dimensions |
State array shapes in different bases; determined by symmetry selection rules. |
|
Tile dimensions. |
|
|
Strategy for combining tile dimensions in gluing; default is arithmetic averaging. |
Return discretization size according to orbithunter conventions for the KSe. |
|
Dimensions according to plot labels; used in clipping. |
Vector representation of Orbit instance; constants all variables required to define the Orbit instance. |
|
Orbit instance with absolute value of state. |
|
|
Return the L_2 inner product of two orbits |
|
Norm of spatiotemporal state via numpy.linalg.norm |
|
Spatial derivative of the current state. |
|
A time derivative of the current state. |
|
Instance whose state is the Kuramoto-Sivashinsky equation evaluated at the current state |
|
Extension of parent class method |
|
Matrix-vector product with the adjoint of the Jacobian |
|
Rescale a vector with the inverse (absolute value) of linear spatial terms |
|
Jacobian matrix evaluated at the current state. |
|
Calculate the phase difference between the spatial modes at t=0 and t=T |
|
Plot the velocity field as a 2-d density plot using matplotlib’s imshow |
|
Plot the spatiotemporal Fourier spectrum as a 2-d density plot using matplotlib’s imshow |
|
Transform current state to a different basis. |
|
Rediscretize the current state typically via zero padding or interpolation. |
|
Reflect the velocity field about the spatial midpoint |
|
Apply numpy roll along specified axis. |
|
Rotate by fraction of the period in either axis; nearest discrete approximate is taken. |
|
Rotate the velocity field in either space or time. |
Return a OrbitKS with shift-reflected velocity field |
|
Placeholder/signature for possible symmetry subclasses. |
|
Placeholder/signature for possible symmetry subclasses. |
|
Transform to (or from) the co-moving frame depending on the current reference frame |
|
|
Checks if in comoving frame then pads. |
|
Checks if in comoving frame then truncates. |
Labels of the different bases produced by transforms. |
|
The smallest possible compatible discretization to have full functionality. |
|
The smallest valid increment to change the discretization by. |
|
Strings to use to label dimensions/periods |
|
Labels of all parameters |
|
Strings to use to label dimensions/periods. |
|
Indicates whether numpy indexing corresponds to increasing or decreasing values configuration space variable |
RelativeOrbitKS.periodic_dimensions()
is not ‘static’, unlike its parent; this is due to unavoidable
symmetry specific considerations. For this reason, the staticmethod decorator was not used.
Return an instance with copies of copy-able attributes. |
|
|
Return an Orbit instance with a numpy masked array state |
|
Set self constraints based on labels provided. |
Check whether the orbit converged to an equilibrium or close-to-zero solution |
|
Bools indicating whether or not dimension is periodic for persistent homology calculations. |
Dict of default values for constraints, parameter ranges, sizes, etc. |
|
The default array shape when dimensions are not specified. |
|
Default parameter ranges. |
|
Defaults for whether or not parameters are constrained. |
|
Method for convenience and consistent/conventional file naming. |
|
Export current state information to HDF5 file. |
AntisymmetricOrbitKS¶
Note
See also Orbit
and OrbitKS
.
|
Initialize self. |
|
Initialize random parameters or state or both. |
|
Initialize a set of random spatiotemporal Fourier modes |
Should only be accessed through |
“Special” methods also known as “magic” or “dunder” (double underscore) methods account for most basic Math operations and other operations pertaining to NumPy arrays.
Note
See Orbit
for all definitions.
Current state array’s shape |
|
Current state array’s dimensionality |
|
Current state array’s number of dimensions |
State array shapes in different bases. |
|
Tile dimensions. |
|
Strategy for combining tile dimensions in gluing; default is arithmetic averaging. |
|
Return discretization size according to orbithunter conventions for the KSe. |
|
Dimensions according to plot labels; used in clipping. |
Vector representation of Orbit instance; constants all variables required to define the Orbit instance. |
|
Orbit instance with absolute value of state. |
|
|
Return the L_2 inner product of two orbits |
|
Norm of spatiotemporal state via numpy.linalg.norm |
|
Spatial derivative of the current state. |
|
Spectral time derivatives of the current state. |
|
Instance whose state is the Kuramoto-Sivashinsky equation evaluated at the current state |
|
Matrix-vector product of a vector with the Jacobian of the current state. |
|
Matrix-vector product with the adjoint of the Jacobian |
|
Rescale a vector with the inverse (absolute value) of linear spatial terms |
|
Jacobian matrix evaluated at the current state. |
|
Plot the velocity field as a 2-d density plot using matplotlib’s imshow |
|
Plot the spatiotemporal Fourier spectrum as a 2-d density plot using matplotlib’s imshow |
|
Transform current state to a different basis. |
Rediscretize the current state typically via zero padding or interpolation. |
|
|
Reflect the velocity field about the spatial midpoint |
|
Apply numpy roll along specified axis. |
|
Rotate by fraction of the period in either axis; nearest discrete approximate is taken. |
|
Rotate the velocity field in either space or time. |
Return a OrbitKS with shift-reflected velocity field |
|
Overwrite of parent method |
|
Overwrite of parent method |
|
|
Overwrite of parent method |
|
Overwrite of parent method |
Labels of the different bases produced by transforms. |
|
The smallest possible compatible discretization to have full functionality. |
|
The smallest valid increment to change the discretization by. |
|
Strings to use to label dimensions/periods |
|
Labels of all parameters |
|
Strings to use to label dimensions/periods. |
|
Bools indicating whether or not dimension is periodic. |
|
Indicates whether numpy indexing corresponds to increasing or decreasing values configuration space variable |
Return an instance with copies of copy-able attributes. |
|
|
Return an Orbit instance with a numpy masked array state |
|
Set self constraints based on labels provided. |
Check whether the orbit converged to an equilibrium or close-to-zero solution |
|
Dict of default values for constraints, parameter ranges, sizes, etc. |
|
The shape of a generic state, see core.py for details |
|
Default parameter ranges. |
|
Defaults for whether or not parameters are constrained. |
|
Method for convenience and consistent/conventional file naming. |
|
Export current state information to HDF5 file. |
EquilibriumOrbitKS¶
-
class
orbithunter.
EquilibriumOrbitKS
(state=None, basis=None, parameters=None, discretization=None, constraints=None, **kwargs)[source]¶ Class for temporal equilibria
Notes
For convenience, this subclass accepts any (even) value for the time discretization. Only a single time point is required however to fully represent the solution and therefore perform any computations. If the discretization size is greater than 1 then then different bases will have the following shapes: field (N, M). spatial modes = (N, m), spatiotemporal modes (1, m). In other words, discretizations of this type can still be used in the optimization codes but will be much more inefficient. The reason for this choice is because it is possible to start with a spatiotemporal orbit with no symmetry (i.e. OrbitKS) and still end up at an equilibrium solution. Therefore, I am accommodating transformations from other orbit types to EquilibriumOrbitKS. To make the computations more efficient all that is required is usage of the method self.optimize_for_calculations(), which converts N -> 1, making the shape of the state (1, M) in the physical field basis. Also can inherit more methods with this choice. More details are included in the thesis and in the documentation. While only the imaginary components of the spatial modes are non-zero, both real and imaginary components are kept to allow for odd order spatial derivatives, required for the nonlinear term. Other allowed operations such as rotation are preferably performed after converting to a different symmetry type such as AntisymmetricOrbitKS or OrbitKS.
Note
See also Orbit
, OrbitKS
,
and AntisymmetricOrbitKS
,
|
Initialize self. |
|
Initialize random parameters or state or both. |
|
Initialize a set of random spatiotemporal Fourier modes |
|
Should only be accessed through |
“Special” methods also known as “magic” or “dunder” (double underscore) methods account for most basic Math operations and other operations pertaining to NumPy arrays.
Note
See Orbit
for all definitions.
Current state array’s shape |
|
Current state array’s dimensionality |
|
Current state array’s number of dimensions |
State array shapes in different bases. |
|
Tile dimensions. |
|
Strategy for combining tile dimensions in gluing; default is arithmetic averaging. |
|
Orbithunter conventions for discretization size. |
|
Dimensions according to plot labels; used in clipping. |
Vector representation of Orbit instance; constants all variables required to define the Orbit instance. |
|
Orbit instance with absolute value of state. |
|
|
Return the L_2 inner product of two orbits |
|
Norm of spatiotemporal state via numpy.linalg.norm |
|
Spatial derivative of the current state. |
|
A time derivative of the current state. |
|
Instance whose state is the Kuramoto-Sivashinsky equation evaluated at the current state |
|
Matrix-vector product of a vector with the Jacobian of the current state. |
|
Matrix-vector product with the adjoint of the Jacobian |
|
Precondition a vector with the inverse (aboslute value) of linear spatial terms |
|
Jacobian matrix evaluated at the current state. |
|
Plot the velocity field as a 2-d density plot using matplotlib’s imshow |
|
Plot the spatiotemporal Fourier spectrum as a 2-d density plot using matplotlib’s imshow |
|
Transform current state to a different basis. |
Rediscretize the current state typically via zero padding or interpolation. |
|
|
Reflect the velocity field about the spatial midpoint |
|
Apply numpy roll along specified axis. |
|
Rotate by fraction of the period in either axis; nearest discrete approximate is taken. |
|
Rotate the velocity field in either space or time. |
Return a OrbitKS with shift-reflected velocity field |
|
Overwrite of parent method |
|
Overwrite of parent method |
|
|
Overwrite of parent method |
|
Overwrite of parent method |
Labels of the different bases produced by transforms. |
|
The smallest possible compatible discretization |
|
The smallest valid increment to change the discretization by. |
|
Strings to use to label dimensions/periods |
|
Labels of all parameters |
|
Strings to use to label dimensions/periods. |
|
Bools indicating whether or not dimension is periodic. |
|
Indicates whether numpy indexing corresponds to increasing or decreasing values configuration space variable |
Return an instance with copies of copy-able attributes. |
|
|
Return an Orbit instance with a numpy masked array state |
|
Set self constraints based on labels provided. |
Check whether the orbit converged to an equilibrium or close-to-zero solution |
Dict of default values for constraints, parameter ranges, sizes, etc. |
|
The shape of a generic state, see core.py for details |
|
Default parameter ranges. |
|
Defaults for whether or not parameters are constrained. |
|
Method for convenience and consistent/conventional file naming. |
|
Export current state information to HDF5 file. |
RelativeEquilibriumOrbitKS¶
Note
See also Orbit
, OrbitKS
and RelativeOrbitKS
.
|
Same as OrbitKS except for setting the ‘frame’ attribute. |
Randomly initialize parameters which are currently zero. |
|
Initialize a set of random spatiotemporal Fourier modes |
|
Should only be accessed through |
“Special” methods also known as “magic” or “dunder” (double underscore) methods account for most basic Math operations and other operations pertaining to NumPy arrays.
Note
See Orbit
for all definitions.
Current state array’s shape |
|
Current state array’s dimensionality |
|
Current state array’s number of dimensions |
State array shapes in different bases. |
|
Tile dimensions. |
|
Strategy for combining tile dimensions in gluing; default is arithmetic averaging. |
|
|
Subclassed method for equilibria. |
Dimensions according to plot labels; used in clipping. |
Vector representation of Orbit instance; constants all variables required to define the Orbit instance. |
|
Orbit instance with absolute value of state. |
|
Return the L_2 inner product of two orbits |
|
|
Norm of spatiotemporal state via numpy.linalg.norm |
|
Spatial derivative of the current state. |
|
A time derivative of the current state. |
|
Instance whose state is the Kuramoto-Sivashinsky equation evaluated at the current state |
|
Extension of parent class method |
|
Matrix-vector product with the adjoint of the Jacobian |
|
Rescale a vector with the inverse (absolute value) of linear spatial terms |
|
Jacobian matrix evaluated at the current state. |
Calculate the phase difference between the spatial modes at t=0 and t=T |
|
Plot the velocity field as a 2-d density plot using matplotlib’s imshow |
|
Plot the spatiotemporal Fourier spectrum as a 2-d density plot using matplotlib’s imshow |
|
Transform current state to a different basis. |
Rediscretize the current state typically via zero padding or interpolation. |
|
Reflect the velocity field about the spatial midpoint |
|
|
Apply numpy roll along specified axis. |
Rotate by fraction of the period in either axis; nearest discrete approximate is taken. |
|
|
Rotate the velocity field in either space or time. |
Return a OrbitKS with shift-reflected velocity field |
|
Placeholder/signature for possible symmetry subclasses. |
|
For compatibility purposes with plotting and other utilities |
|
Transform to (or from) the co-moving frame depending on the current reference frame |
|
|
Overwrite of parent method |
|
Subclassed method to handle RelativeEquilibriumOrbitKS mode’s shape. |
Labels of the different bases produced by transforms. |
|
The smallest possible compatible discretization |
|
The smallest valid increment to change the discretization by. |
|
Strings to use to label dimensions/periods |
|
Labels of all parameters |
|
Strings to use to label dimensions/periods. |
|
Indicates whether numpy indexing corresponds to increasing or decreasing values configuration space variable |
RelativeEquilibriumOrbitKS.periodic_dimensions()
is not ‘static’, unlike its parent; this is due to unavoidable
symmetry specific considerations. For this reason, the staticmethod decorator was not used.
Return an instance with copies of copy-able attributes. |
|
|
Return an Orbit instance with a numpy masked array state |
|
Set self constraints based on labels provided. |
Check whether the orbit converged to an equilibrium or close-to-zero solution |
|
Bools indicating whether or not dimension is periodic for persistent homology calculations. |
Dict of default values for constraints, parameter ranges, sizes, etc. |
|
The default array shape when dimensions are not specified. |
|
Default parameter ranges. |
|
Defaults for whether or not parameters are constrained. |
Method for convenience and consistent/conventional file naming. |
|
|
Export current state information to HDF5 file. |
ShiftReflectionOrbitKS¶
Note
See also Orbit
and OrbitKS
.
|
Initialize self. |
|
Initialize random parameters or state or both. |
|
Initialize a set of random spatiotemporal Fourier modes |
Should only be accessed through |
“Special” methods also known as “magic” or “dunder” (double underscore) methods account for most basic Math operations and other operations pertaining to NumPy arrays.
Note
See Orbit
for all definitions.
Current state array’s shape |
|
Current state array’s dimensionality |
|
Current state array’s number of dimensions |
State array shapes in different bases. |
|
Tile dimensions. |
|
Strategy for combining tile dimensions in gluing; default is arithmetic averaging. |
|
Return discretization size according to orbithunter conventions for the KSe. |
|
Dimensions according to plot labels; used in clipping. |
Vector representation of Orbit instance; constants all variables required to define the Orbit instance. |
|
Orbit instance with absolute value of state. |
|
|
Return the L_2 inner product of two orbits |
|
Norm of spatiotemporal state via numpy.linalg.norm |
|
Spatial derivative of the current state. |
|
Spectral time derivatives of the current state. |
|
Instance whose state is the Kuramoto-Sivashinsky equation evaluated at the current state |
|
Matrix-vector product of a vector with the Jacobian of the current state. |
|
Matrix-vector product with the adjoint of the Jacobian |
|
Rescale a vector with the inverse (absolute value) of linear spatial terms |
|
Jacobian matrix evaluated at the current state. |
|
Plot the velocity field as a 2-d density plot using matplotlib’s imshow |
|
Plot the spatiotemporal Fourier spectrum as a 2-d density plot using matplotlib’s imshow |
|
Transform current state to a different basis. |
Rediscretize the current state typically via zero padding or interpolation. |
|
|
Reflect the velocity field about the spatial midpoint |
|
Apply numpy roll along specified axis. |
|
Rotate by fraction of the period in either axis; nearest discrete approximate is taken. |
|
Rotate the velocity field in either space or time. |
Return a OrbitKS with shift-reflected velocity field |
|
Overwrite of parent method |
|
Reconstruct full field from discrete fundamental domain |
|
|
Overwrite of parent method |
|
Overwrite of parent method |
Labels of the different bases produced by transforms. |
|
The smallest possible compatible discretization to have full functionality. |
|
The smallest valid increment to change the discretization by. |
|
Strings to use to label dimensions/periods |
|
Labels of all parameters |
|
Strings to use to label dimensions/periods. |
|
Bools indicating whether or not dimension is periodic. |
|
Indicates whether numpy indexing corresponds to increasing or decreasing values configuration space variable |
Return an instance with copies of copy-able attributes. |
|
|
Return an Orbit instance with a numpy masked array state |
|
Set self constraints based on labels provided. |
Check whether the orbit converged to an equilibrium or close-to-zero solution |
|
Symmetry selection rules |
Dict of default values for constraints, parameter ranges, sizes, etc. |
|
The default array shape when dimensions are not specified. |
|
Default parameter ranges. |
|
Defaults for whether or not parameters are constrained. |
|
Method for convenience and consistent/conventional file naming. |
|
Export current state information to HDF5 file. |
Utilities¶
Kuramoto-Sivashinsky Utilities¶
This module contains helper functions to compute various physical quantities, as well as the [ETDRK4] time integration scheme.
-
orbithunter.ks.physics.
dissipation
(orbit_instance, average='spacetime')[source]¶ Average energy dissipation or corresponding field.
- Parameters
- float or ndarray :
Spatiotemporal dissipation returned as a field, or averaged along an axis (ndarray) or spacetime (float).
Notes
Dissipation \(= u_xx^2\).
-
orbithunter.ks.physics.
energy
(orbit_instance, average='spacetime')[source]¶ Average energy or corresponding field
- Parameters
- float or ndarray :
Spatiotemporal power returned as a field, or averaged along an axis (ndarray) or spacetime (float).
Notes
Energy = 1/2 u^2
-
orbithunter.ks.physics.
energy_variation
(orbit_instance, average='spacetime')[source]¶ The field u_t * u whose spatial average should equal power - dissipation.
- Parameters
- float or ndarray :
Spatiotemporal energy variation returned as a field, or averaged along an axis (ndarray) or spacetime (float).
- Returns
- Field equivalent to u_t * u.
-
orbithunter.ks.physics.
power
(orbit_instance, average='spacetime')[source]¶ Average power or corresponding field
- Parameters
- float or ndarray :
Spatiotemporal power returned as a field, or averaged along an axis (ndarray) or spacetime (float).
Notes
power = u_x^2
-
orbithunter.ks.physics.
integrate
(orbit_, **kwargs)[source]¶ Exponential time-differencing Runge-Kutta 4th order integration scheme.
- Parameters
- orbit_Orbit
The Orbit which contains the initial starting point for the integration
- kwargsdict
verbose : bool
- starting_point :
The row to select as the initial value.
- integration_timefloat
The total amount of time to integrate, if not provided then defaults to orbit’s period (for reproduction of orbit, typically).
- step_sizefloat
The integration step
- return_trajectorybool
Whether to store and return all integration steps or only the endpoint.
- Returns
- Orbit :
Orbit instance with either an integrated trajectory or its final value as a state.
Notes
Adapter https://epubs.siam.org/doi/abs/10.1137/S1064827502410633?journalCode=sjoce3
By default, when input is an instance of relative periodic orbit then shift is calculated off of the integrated trajectory. This will lead to plotting issues so unless desired, you should convert to the base orbit type first.
Numerical Optimization¶
-
orbithunter.optimize.
hunt
(orbit_instance, *methods, **kwargs)[source]¶ Main optimization function for orbithunter; wraps many different SciPy and custom routines
- Parameters
- orbit_instanceOrbit
The orbit instance serving as the initial condition for optimization.
- methodsstr or multiple str or tuple of str
Represents the numerical methods to hunt with, in order of indexing. Not all methods will work for all classes, performance testing is part of the development process. Options include: ‘newton_descent’, ‘lstsq’, ‘solve’, ‘adj’, ‘gd’, ‘lsqr’, ‘lsmr’, ‘bicg’, ‘bicgstab’, ‘gmres’, ‘lgmres’, ‘cg’, ‘cgs’, ‘qmr’, ‘minres’, ‘gcrotmk’,’nelder-mead’, ‘powell’, ‘cg_min’, ‘bfgs’, ‘newton-cg’, ‘l-bfgs-b’, ‘tnc’, ‘cobyla’, ‘slsqp’, ‘trust-constr’, ‘dogleg’, ‘trust-ncg’, ‘trust-exact’, ‘trust-krylov’, ‘hybr’, ‘lm’,’broyden1’, ‘broyden2’, ‘linearmixing’, ‘diagbroyden’, ‘excitingmixing’, ‘df-sane’, ‘krylov’, ‘anderson’
- kwargsdict, optional
May contain any and all extra keyword arguments required for numerical methods and Orbit specific methods.
- factory : callable
Callable with signature: factory(orbit_instance, method, kwargs) that yields relevant callables or options for root, minimize, or sparse.linalg methods. See Notes for details.
- maxiter : int, optional
The maximum number of steps; computation time can be highly dependent on this number i.e. maxiter=100 for adjoint descent and lstsq have very very different computational times.
- tol : float, optional
The threshold for the cost function for an orbit approximation to be declared successful.
- ftol : float, optional
The threshold for the decrease of the cost function for any given step.
- min_step : float, optional
Smallest backtracking step size before failure; not used in minimize.optimize algorithms.
- scipy_kwargs : dict, optional
Additional arguments for SciPy solvers. There are too many to describe and they depend on the particular algorithm utilized, see references for links for more info. This set of kwargs is copied and then passed to numerical methods. They can include options that need to be passed to methods such as
Orbit.eqn()
during runtime.
- Returns
- OrbitResult :
Object which includes optimization properties like exit code, costs, tol, maxiter, etc. and the final resulting orbit approximation.
Notes
Description, links, and other comments on numerical methods. Before beginning testing/exploration I highly recommend checking the options of each solver. Typically the linear algebra solvers try to solve \(Ax=b\) within a strict error tolerance; however, because of nonlinearity we want to iteratively update this and solve it sequentially. Therefore, I recommend reducing the tolerance (sometimes dramatically) and use the orbithunter “outer iterations” (i.e. number of steps in the sequence x_n used to define and solve A_n x_n = b_n), to control the absolute error. Additionally, I have tried to provide a crude heuristic via the “progressive” keyword argument. This will crank up the strictness per every outer iteration loop, as it is presumed that more outer iterations means higher accuracy. Personally I just recommend to increase maxiter and keep the tolerances low.
The other issue is that scipy has different keyword arguments for the “same thing” everywhere. For example, the keyword arguments to control the tolerance across the set of methods that this provides access to are gtol, ftol, fatol, xtol, tol, atol, btol, … They do typically represent different quantities, but that doesn’t make it any less confusing.
scipy.optimize.minimize
To access options of the scipy solvers, must be passed as nested dict: hunt(x, scipy_kwargs={“options”:{}})
Do not take jacobian information: “nelder-mead”, “powell”, “cobyla”
Take Jacobian (product/matrix) “cg_min”, “bfgs”, “newton-cg”, “l-bfgs-b”, “tnc”, “slsqp”
Methods that either require the Hessian matrix (dogleg) or some method of computing it or its product. “trust-constr”, “dogleg”, “trust-ncg”, “trust-exact”, “trust-krylov”
Support for Hessian based methods [‘trust-constr’, ‘dogleg’, ‘trust-ncg’, ‘trust-exact’, ‘trust-krylov’]. For the ‘dogleg’ method, an argument
hess
is required to be passed to hunt inscipy_kwargs
hess{callable, ‘2-point’, ‘3-point’, ‘cs’, HessianUpdateStrategy}
For the other mehods,
hessp
is sufficient, but usage ofhess
is viable.hessp{callable, optional}
Alternatively, SciPy accepts the finite difference methods str ‘2-point’, ‘3-point’, ‘cs’ or HessianUpdateStrategy objects. The Hessian based methods have never been tested as they were never used with the KSe.
Factory function returns a (callable, dict) pair. The callable is cost function C(orbit_instance, kwargs). The dict contains keywords “jac” and one of the following “hess”, “hessp” with the relevant callables/str see SciPy scipy.optimize.minimize for more details
Approximating the Hessian with finite difference strategy ‘cs’ requires the ability to handle complex input; while 100% not meant to handle complex input, the state variables of the OrbitKS class and subclasses can be overloaded to be complex to allow this to work; the parameters however must be cast as reals.
scipy.optimize.root
To access options of the scipy solvers, must be passed as nested dict: hunt(x, scipy_kwargs={“options”:{}}) To access the “jac_options” options, it is even more annoying: hunt(x, scipy_kwargs={“options”:{“jac_options”:{}}})
Methods that take jacobian as argument: ‘hybr’, ‘lm’
Methods which approximate the jacobian; take keyword argument “jac_options” [‘broyden1’, ‘broyden2’, ‘anderson’, ‘krylov’, ‘df-sane’]
Methods whose performance, SciPy warns, is highly dependent on the problem. [‘linearmixing’, ‘diagbroyden’, ‘excitingmixing’]
Factory function should return root function F(x) (Orbit.eqn()) and if ‘hybr’ or ‘lm’ then also jac as dict.
scipy.sparse.linalg
Methods that solve \(Ax=b\) in least squares fashion : ‘lsmr’, ‘lsqr’. Do not use preconditioning.
Solves \(Ax=b\) if A square (n, n) else solve normal equations \(A^T A x = A^T b\) in iterative/inexact fashion: ‘minres’, ‘bicg’, ‘bicgstab’, ‘gmres’, ‘lgmres’, ‘cg’, ‘cgs’, ‘qmr’, ‘gcrotmk’. Use preconditioning.
Factory function should return (A, b) where A is Linear operator or matrix and b is vector.
Other factoids worth mentioning, the design choice has been made for function/callable factories that they should build in constants into their definitions of the callables using nonlocals within the scope of the factory instead of passing constants as args. The reason for this is because the latter is not allowed for LinearOperator (sparse linalg) methods.
References
User should be aware of the existence of
scipy.optimize.show_options()
Options for each optimize method scipy.optimize scipy.optimize.minimize scipy.optimize.root scipy.sparse.linalg
Clipping¶
-
orbithunter.clipping.
clip
(orbit_instance, window_dimensions, **kwargs)[source]¶ Create Orbit instance whose state array is a subdomain of the provided Orbit.
- Parameters
- orbit_instanceOrbit
The orbit whose state the subdomain is extracted from.
- window_dimensionstuple of tuples.
Contains one tuple for each continuous dimension, each defining the interval of the dimension to slice out.
- kwargsdict
Keyword arguments for Orbit instantiate.
- Returns
- Orbit :
Orbit whose state and parameters reflect the subdomain defined by the provided dimensions.
Notes
The intervals provided refer to the
Orbit._plotting_dimensions()
method. The motivation here is to allow for clipping using visualization techniques as a direct guide. If a dimension has zero extent; i.e. equilibrium in that dimension, then the corresponding window_dimension tuple must be passed as (None, None).Examples
Extract subdomain from an Orbit
>>> orb = Orbit(state=np.ones([128, 128, 128, 128]), basis='physical', ... parameters=(100, 100, 100, 100)) >>> one_sixteeth_subdomain_orbit = clip(orb, ((0, 50), (0, 50), (0, 50), (0, 50)))
It is 1/16th the size because it takes half of the points in 4 different dimensions.
-
orbithunter.clipping.
clipping_mask
(orbit_instance, *windows, invert=True)[source]¶ Produce an array mask which shows the clipped regions corresponding to windows upon plotting.
- Parameters
- orbit_instanceOrbit
An instance whose state is to be masked.
- windowslist or tuple
An iterable of window tuples; see Notes below.
- invertbool
Whether to logically invert the boolean mask; equivalent to showing the “interior” or “exterior” of the clipping if True or False, respectively.
- Returns
- Orbit :
Orbit instance whose state is a numpy masked array.
Numerical continuation¶
-
orbithunter.continuation.
continuation
(orbit_instance, constraint_item, *extra_constraints, step_size=0.01, **kwargs)[source]¶ Numerical continuation parameterized by a single parameter but supporting any number of constraints.
- Parameters
- orbit_instanceOrbit
Instance whose state’s parameters are to be continued.
- constraint_itemdict, tuple, dict_items
A key value pair indicating the parameter being continued and its target value.
- extra_constraintsdict
When constraining for continuation, it may be important to constrain other parameters which are not directly changed or incremented.
- step_sizefloat
The value to use as a continuation increment. E.g. if step_size = 0.1, the continuation will try to converge Orbits at p + 0.1, p + 0.2, … (if target < p then these would be substractions). For most field equations the continuation represents continuous deformations and so this should be reflected in this step size; not all dimensions are equal; for example, the KSE is more lenient to changes in time ‘t’ rather than space ‘x’ because it is a first order equation in ‘t’ and fourth order in ‘x’.
- Returns
- OrbitResult :
Optimization result with orbit resulting from continuation; if continuation failed (solution did not converge) then the parameter value may be different from the target; this failure or success will be indicated in the ‘status’ attribute of the result.
-
orbithunter.continuation.
discretization_continuation
(orbit_instance, target_discretization, cycle=False, **kwargs)[source]¶ Incrementally change discretization while maintaining convergence
- Parameters
- orbit_instanceOrbit or Orbit child
The instance whose discretization is to be changed.
- target_discretization :
The shape that will be incremented towards; failure to converge will terminate this process.
- cyclebool
Whether or not to applying the cycling strategy. See Notes for details.
- kwargs :
any keyword arguments relevant for orbithunter.minimize
- Returns
- minimize_resultOrbitResult
Orbit result from hunt function resulting from continuation; if continuation failed (solution did not converge) then the contained orbit’s discretization may be different from the target.
Notes
The cycling strategy alternates between the axes of the smallest discretization size, as to allow for small changes in each dimension as opposed to incrementing all in one dimension at once.
-
orbithunter.continuation.
span_family
(orbit_instance, **kwargs)[source]¶ Explore and span an orbit’s family (continuation and group orbit)
- Parameters
- orbit_instanceOrbit
The orbit whose family is to be spanned.
- kwargs :
Keyword arguments accepted by to_h5 and continuation methods (and hunt function, by proxy), and Orbit.group_orbit
- Returns
- orbit_familylist of list
A list of lists where each list is a branch of orbit states generated by continuation.
Notes
The ability to continue all continuations and hence span the family geometrically has been removed. It simply is too much to allow in a single function call. To span the entire family, run this function on various members of the family, possibly those populated by a previous function call. In that instance, using same filename between runs is beneficial.
How naming conventions work: family name is the filename. Each branch is a group or subgroup, depending on root only. If root_only=False then this behaves recursively and can get incredibly large. Use at your own risk.
Gluing¶
-
orbithunter.gluing.
tile
(symbol_array, tiling_dictionary, orbit_type, **kwargs)[source]¶ Wraps the glue function so that configurations of symbols may be provided instead of configurations of Orbits.
- Parameters
- symbol_arraynumpy.ndarray
An array of dictionary keys which exist in tiling_dictionary
- tiling_dictionarydict
A dictionary whose values are Orbit instances.
- orbit_typetype
The type of Orbit that will be returned.
- kwargs :
Orbit kwargs relevant to instantiation and gluing. See
glue()
for details.
- Returns
- Orbitorbit_type
An instance containing the glued state
-
orbithunter.gluing.
glue
(orbit_array, orbit_type, strip_wise=False, **kwargs)[source]¶ Combines the state arrays of a configuration of Orbits
- Parameters
- orbit_arrayndarray of Orbit instances
A NumPy array wherein each element is an orbit. i.e. a tensor of Orbit instances. The shape should be representative to how the orbits are going to be glued. See notes for more details. The orbits must all have the same discretization size if gluing is occuring along more than one axis. The orbits should all be in the physical field basis.
- orbit_typeOrbit type
The class that the final result will be returned as.
- strip_wisebool
If True, then the “strip-wise aspect ratio correction” is applied. See
aspect_ratio_correction()
.
- Returns
- glued_orbitOrbit
Instance of type orbit_type, whose state and dimensions are the combination of the original array of orbits.
Notes
Because of how the concatenation of fields works, wherein the discretization must match along the boundaries. It is quite complicated to write a generalized code that glues all dimensions together at once for differently sized, orbit, so instead this is designed to iterate through the axes of the orbit_array.
To prevent confusion, there are many different notions of ‘shape’ and ‘discretization’ that are relevant. There are three main array shapes or dimensions that are involved in this function. The first is the array of orbits, which represents a spatiotemporal symbolic “dynamics” block. This array can have as many dimensions as the solutions to the equation have. An array of orbits of shape (2,1,1,1) means that the fields have four continuous dimensions. The specific shape means that two such fields are being concatenated in time (because the first axis should always be time) by orbithunter convention.
Example for the spatiotemporal Navier-stokes equation. The spacetime is (1+3) dimensional. Let’s assume we’re gluing two vector fields with the same discretization size, (N, X, Y, Z). We can think of this discretization as a collection of 3D vector field snapshots in time. Therefore, there are actually (N, X, Y, Z, 3) degrees of freedom. Therefore the actually tensor before the gluing will be of the shape (2, 1, 1, 1, N, X, Y, Z, 3). Because we are gluing the orbits along the time axis, The final shape will be (1, 1, 1, 1, 2*N, X, Y, Z, 3), given that the original X, Y, Z, are all the same size. Being forced to have everything the same size is what makes this difficult, because this dramatically complicates things for a multi-dimensional symbol array.
For a symbol array of shape (a, b, c, d) and orbit field with shape (N, X, Y, Z, 3) the final dimensions would be (a*N, b*X, c*Y, d*Z, 3). This is achieved by repeated concatenation along the axis corresponding to the last axis of the symbol array. i.e. for (a,b,c,d) this would be concatenation along axis=3, 4 times in a row. I believe that this generalizes for all equations but it has not been tested yet.
-
orbithunter.gluing.
expensive_pairwise_glue
(orbit_pair, objective='cost', axis=0, **kwargs)[source]¶ Gluing that searches pairs of group orbit members for the best combination.
- Parameters
- orbit_pairnp.ndarray
An array with the same number of dimensions as the orbits within them; i.e. (2, 1, 1, 1), (1, 2, 1, 1), … for Orbits with 4 dimensions.
- orbit_typetype
The Orbit type to return the result as.
- objectivestr
The manner that orbit combinations are graded; options are ‘cost’ or ‘boundary_cost’. The former calls the Orbit’s built in cost function, the latter computes the L2 difference of the boundaries that are joined together.
- Returns
- best_glued_orbit_so_farOrbit
The orbit combination in the pairwise group orbit that had the smallest objective function value.
Notes
Expensive gluing only supported for pairs of Orbits. For larger arrays of orbits, apply this function in an iterative manner if so desired.
This function can not only be expensive, it can be VERY expensive depending on the generator x.group_orbit(). It is highly advised to have some way of controlling how many members of each group orbit are being used. For example, for the K-S equation and its translational symmetries, the field arrays are typically being rolled; the option exists to roll by an integer “stride” value s.t. instead of shifting by one unit, a number of units equal to stride is shifted. Note that for group orbits of size 1000, this would construct and search over 1000000 combinations, unless a subset of the group orbit is specified.
-
orbithunter.gluing.
generate_symbol_arrays
(tiling_dictionary, glue_shape, unique=True)[source]¶ Produce all d-dimensional symbol arrays for a given dictionary and shape.
- Parameters
- tiling_dictionarydict
Dictionary whose keys are the orbit symbols and whose values are Orbits
- glue_shapetuple
The shape of the gluing configuration (i.e. symbol array)
- uniquebool
If True, then rotations of symbol arrays are treated as redundant.
- Returns
- list of ndarray :
A list of numpy arrays containing configurations of symbols (tiling_dictionary keys).
Notes
If unique = False then this produces a list of d^N elements, d being the dimension and N being the number of symbols in the dictionary. Clearly this can be a huge drain on resources in certain cases. If possible, it is better to take the group orbit of the glued orbits resulting from a symbol array than all possible symbol arrays.
-
orbithunter.gluing.
rediscretize_tileset
(tiling_dictionary, new_shape=None, **kwargs)[source]¶ Convenience tool for resizing all orbits in a tiling dictionary in a single function call
- Parameters
- tiling_dictionarydict
Keys are symbol alphabet, values are Orbits.
- new_shapetuple, optional, default None
If provided as a shape tuple then all orbits in the tiling dictionary will be resized to this shape.
- kwargsdict
Keyword arguments for
Orbit.dimension_based_discretization()
method
- Returns
- dict :
Tiling dictionary whose values (Orbits) have been resized.
-
orbithunter.gluing.
aspect_ratio_correction
(orbit_array, axis=0, conserve_parity=True)[source]¶ Resize a collection of Orbits’ discretizations according to their sizes in the dimension specified by axis.
- Parameters
- orbit_arrayndarray
An array of orbits to resize along ‘axis’
- axisint
ndarray axis along which to resize with respect to.
- conserve_paritybool
Whether or not to maintain parity of the discretization size for each orbit. This is relevant when certain bases require either odd or even numbered discretization sizes.
- Returns
- ndarray :
An array of resized orbits, same shape as orbit_array.
Notes
Note that this will allow equilibria tiles to become very distorted; this can be managed by gluing order but typically when including equilibria, strip-wise corrections cause too much distortion to be useful. This is not an issue, however, as this method should never really be used for dramatically different sized Orbits unless the distortions are permitted.
Persistent Homology¶
See the Gudhi documentation for more information on persistent homology and its applications [gudhi] .
-
orbithunter.persistent_homology.
orbit_complex
(orbit_instance, **kwargs)[source]¶ Wrapper for Gudhi persistent homology package’s PeriodicCubicalComplex
- Parameters
- orbit_instanceOrbit
The orbit for which to compute the complex.
- kwargs :
periodic_dimensions : tuple Contains bools which flag which axes of the orbit’s field are assumed to be periodic for the persistence calculations. Defaults to Orbit defaults.
- Returns
- cubical_complexPeriodicCubicalComplex
-
orbithunter.persistent_homology.
orbit_persistence
(orbit_instance, **kwargs)[source]¶ Evaluate the persistence of an orbit complex; returns betti numbers and persistence intervals.
- Parameters
- orbit_instanceOrbit
- Returns
- ndarray or list :
NumPy or Gudhi format. Numpy format returns an array of shape (N, 3). Gudhi format is a list whose elements are of the form (int, (float, float)).
- kwargs :
min_persistence : float Minimum persistence interval size for returned values. periodic_dimensions : tuple of bool Flags the dimensions of Orbit.state which are periodic.
Notes
Mainly a convenience function because of how Gudhi structures its output.
-
orbithunter.persistent_homology.
persistence_plot
(orbit_instance, gudhi_method='diagram', **kwargs)[source]¶ - Parameters
- orbit_instanceOrbit
Iterable of length N that contains elements of length 2 (i.e. N x 2 array) containing the persistence intervals (birth, death)
- gudhi_methodstr
Plotting gudhi_method. Takes one of the following values: ‘diagram’, ‘barcode’, ‘density’.
- kwargs :
kwargs related to gudhi plotting functions. See Gudhi docs for details.
-
orbithunter.persistent_homology.
persistence_distance
(orbit_or_array, second_orbit_or_array, gudhi_metric='bottleneck', **kwargs)[source]¶ Compute the distance between two Orbits’ persistence diagrams.
- Parameters
- orbit1Orbit
Orbit whose persistence creates the first diagram
- orbit2Orbit
Orbit whose persistence creates the second diagram
- gudhi_metricstr
The persistence diagram distance metric to use. Takes values ‘bottleneck’ and ‘wasserstein’.
- kwargs :
Keyword arguments for orbit persistence and orbit complex computations.
Machine Learning¶
-
orbithunter.machine_learning.
orbit_cnn
(orbits, target, **kwargs)[source]¶ Create and train a deep learning model with 2 convolutional and 2 dense layers with Orbit state input Should be used as a crude reference due to its hard-coding.
- Parameters
- orbitsnumpy.ndarray of orbits.
Array of orbit states with shape (n_samples, time_discretization, space_discretization) shaped such that first axis is batch size or number of samples, then the last two dimensions are the ‘image’ dimensions, i.e. the two dimensions to convolve over. I.e. shape for KSE fields is
- targetnumpy.ndarray
Must have same length along first axis as orbits. Can be any type of labels/values the dimension of each sample is the same as the dimension of the prediction/output layer.
- kwargsdict, optional
May contain any and all extra keyword arguments required for numerical methods and Orbit specific methods.
- hyper_parameters : tuple
Hyper parameters for deep learning layers.
- Returns
- tensorflow.keras.models.Sequential, tf.keras.callbacks.History, tuple
The model, its History (training and testing error as a function of epoch number) and tuple containing the train test splits of the regressors and target data. Train test split returned as (X_train, X_test, y_train, y_test).
Shadowing¶
-
orbithunter.shadowing.
cover
(orbit_cover, verbose=False, **kwargs)[source]¶ Function to perform multiple shadowing computations given a collection of orbits.
- Parameters
- orbit_coverOrbitCover
Object which contains the base orbit, window orbits, thresholds, and everything else.
- Returns
- tuple(orbit_cover, np.ndarray, [np.ndarray, np.ndarray])
NumPy arrays whose indices along the first axis correspond to the window orbits’ position in
`window_orbits`
and whose other dimensions consist of scores or masking values. If return_pivot_arrays==True then also return the score and masking arrays for the pivots in addition to the orbit scores and pivots.
Notes
If a pivot mask is not provided, then any elements of the score array which are beneath threshold are not recalculated.
Reading and Writing Orbit Data¶
-
orbithunter.io.
read_h5
(filename, *datanames, validate=False, **orbitkwargs)[source]¶ - Parameters
- filenamestr or Path
Absolute or relative path to .h5 file
- datanamesstr or tuple, optional
Names of either h5py.Datasets or h5py.Groups within .h5 file. Recursively returns all orbits (h5py.Datasets) associated with all names provided. If nothing provided, return all datasets in file.
- validatebool
Whether or not to access Orbit().preprocess a method which checks the ‘integrity’ of the imported data; in terms of its status as a solution to its equations, NOT the actual file integrity.
- orbitkwargsdict
Any additional keyword arguments relevant for construction of specified Orbit instances. .
- Returns
- Orbit or list of Orbits or list of list of Orbits
The imported data; If a single h5py.Dataset’s name is specified, an Orbit is returned. If multiple Datasets are specified, a list of Orbits are returned. If a h5py.Group name is specified, then a list of Orbits is returned. If a combination of h5py.Dataset and h5py.Group names are provided, then the result is a list interspersed with either Orbits or lists of Orbits, arranged in the order based on the provided names.
Notes
The ‘state’ data should be saved as a dataset. The other attributes which define an Orbit, which are required for expected output are ‘basis’, ‘class’, ‘parameters’; all attributes included by default are ‘discretization’ (state shape in physical basis, not necessarily the shape of the saved state).
This searches through provided h5py.Groups recursively to extract all datasets. If you need to distinguish between two groups which are in the same parent group, both names must be provided separately.
As it takes a deliberate effort, keyword arguments passed to read_h5 are favored over saved attributes This allows for control in case of incorrect attributes; the dictionary update avoids sending more than one value to the same keyword argument. This passes all saved attributes, tuple or None for parameters, and any additional keyword arguments to the class
-
orbithunter.io.
read_tileset
(filename, keys, orbit_names, validate=False, **orbitkwargs)[source]¶ Importation of data as tiling dictionary
- Parameters
- filenamestr
The relative/absolute location of the file.
- keystuple
Strings representing the labels to give to the orbits corresponding to orbit_names, respectively.
- orbit_namestuple
Strings representing the dataset names within the .h5 file.
- validatebool
Whether or not to call preprocess method on each imported orbit.
- orbitkwargsdict
Keyword arguments that user wants to provide for construction of orbit instances.
- Returns
- dict :
Keys are those provided, values are orbit instances loaded from h5 file.
Glossary¶
- Orbit¶
The parent class for all possible equations and symmetry subclasses. This package revolves around subclassing this class, overloading the numerical functions such that they evaluate the developer’s desired equations.
- OrbitKS¶
- The parent class for all Orbit types pertaining to the Kuramoto-Sivashinsky equation.
See Kuramoto-Sivashinsky Equation for a more details.
Future Changes¶
Everything has been caught up on as of version 1.0!
Issues¶
Slicing
The current implementation orbithunter.core.Orbit.__getitem__()
infers the sliced state array’s
dimensions from the shape of the sliced array. NumPy’s advanced indexing
allows for many different combinations and types of keys: int, Ellipsis, tuple, slice, bool, np.ndarray
and more
can be used for indexing. The inference and computation of the new Orbit.dimensions()
based on this shape but
becomes nonsensical when the number of axes changes; we could just set any removed axes dimension to be equal to zero,
however, there is a critical ambiguity which makes this more difficult than it may seem. For example assume the
state array has shape (2, 2, 2, 2). Slicing via state[:, 0, : , :] and state[:, :, 0, :] will both result in an
array of shape (2, 2, 2); but they are not physically equivalent, as one should be (2, 1, 2, 2) and the other
should be (2, 2, 1, 2). This can technically be alleviated by using a slice instead, i.e. state[:, :1, :, :] but
this leaves much to be desired.
Parameter parsing/passing
Creating an instance w/o parsing; by passing values for the five main attributes allows for
fewer parameters than labels; normally this would be filled with zeros. If not designed carefully, then an IndexError
may be raised when trying to access a labelled parameter attribute that doesn’t exist. This is being recorded here
because while it is actually intended, it can still be confusing in the traceback; chaining an AttributeError in
future release to indicate this is where this is coming from. The clause in Orbit.__init__()
details this
somewhat but I feel it needs to be more obvious.
** Constrained optimization **
Currently constraints are handled on the orbithunter end by simply disallowing changes to be made to the parameter independent of the return of the optimization function. The equations which explicitly construct a matrix do not include these constants in the optimization but (incorrectly) they are included in the scipy functions due to the orbit_vector definition not taking constraints, which I believe is just an error on my part.
Extra Resources¶
FAQ¶
This is where the FAQ will go.
Bibliography¶
- gudhi
The GUDHI Project, “GUDHI User and Reference Manual”, GUDHI Editorial Board, 3.4.1, 2021. https://gudhi.inria.fr/doc/3.4.1/
- ETDRK4
Kassam, A.-K. & Trefethen, L. N. Fourth-order time-stepping for stiff PDEs SIAM J. Sci. Comput., 2005, 26, 1214-1233
- Networkx
Aric A. Hagberg, Daniel A. Schult and Pieter J. Swart, “Exploring network structure, dynamics, and function using NetworkX”, in Proceedings of the 7th Python in Science Conference (SciPy2008), Gäel Varoquaux, Travis Vaught, and Jarrod Millman (Eds), (Pasadena, CA USA), pp. 11–15, Aug 2008
- SciPy
Virtanen, Pauli and Gommers, Ralf and Oliphant, Travis E. and Haberland, Matt and Reddy, Tyler and Cournapeau, David and Burovski, Evgeni and Peterson, Pearu and Weckesser, Warren and Bright, Jonathan and {van der Walt}, St{'e}fan J. and Brett, Matthew and Wilson, Joshua and Millman, K. Jarrod and Mayorov, Nikolay and Nelson, Andrew R. J. and Jones, Eric and Kern, Robert and Larson, Eric and Carey, C J and Polat, {.I}lhan and Feng, Yu and Moore, Eric W. and {VanderPlas}, Jake and Laxalde, Denis and Perktold, Josef and Cimrman, Robert and Henriksen, Ian and Quintero, E. A. and Harris, Charles R. and Archibald, Anne M. and Ribeiro, Ant{^o}nio H. and Pedregosa, Fabian and {van Mulbregt}, Paul and {SciPy 1.0 Contributors}}, SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python, Nature Methods, 2020. 17, 261–272, https://rdcu.be/b08Wh, 10.1038/s41592-019-0686-2
- NumPy
Charles R. Harris and K. Jarrod Millman and Stefan J. van der Walt and Ralf Gommers and Pauli Virtanen and David Cournapeau and Eric Wieser and Julian Taylor and Sebastian Berg and Nathaniel J. Smith and Robert Kern and Matti Picus and Stephan Hoyer and Marten H. van Kerkwijk and Matthew Brett and Allan Haldane and Jaime Fernandez del Rio and Mark Wiebe and Pearu Peterson and Pierre Gerard-Marchant and Kevin Sheppard and Tyler Reddy and Warren Weckesser and Hameer Abbasi and Christoph Gohlke and Travis E. Oliphant, Array programming with NumPy, 2020, sep, Nature, 585, 7825, 357–362, 10.1038/s41586-020-2649-2 Springer Science and Business Media LLC, https://doi.org/10.1038/s41586-020-2649-2
Release Log¶
Orbithunter version releases
orbithunter 1.0.5¶
Minor Changes¶
Added methods to help with possible memory issues when creating Hessian matrices.
Added approximate keyword argument for Hessian generation; useful when full Hessian is expensive.
Added support for different behaviors for coordinate maps and base/window transformations
Changed some arguments in core methods to better describe them.
Improvements to efficiency of cover and
OrbitCover.map()
.More documentation/transparency into what :class:`OrbitCover does.
Improvements to shadowing efficiency; map still needs more work in the very large memory usage case.
Changed how masks are handled in shadowing computations; map previously recomputed the mask based on thresholds but it should be thresholds + provided mask.
Bug and Error Fixes¶
orbithunter.continuation.span_family()
did not have a bug fix previously made inorbithunter.continuation.continuation()
applied correctly.OrbitCover.cover()
was not correctly accounting for early-termination of computationsOrbitCover.cover()
was not correctly handling empty pivot iterators.Converting classes between classes with different # of parameters and default constraints was being done incorrectly.
Sometimes trust region methods would provide complex valued parameters in the case of singular matrices.
OrbitKS subclasses without discrete symmetry are handling complex valued state and parameter values in the trust region methods with hess_strategy=’cs’ they are able to do this because the state arrays are cast as complex before inverse time transforms are applied; discrete symmetry subclasses have to do spatial derivative of nonlinear term in spatial mode basis, so when transforming back to modes basis, complex valued input is passed to rfft. This has been handled, while trying to maintain the ability to use the finite difference strategy, by casting parameters to reals in the newly overloaded
from_numpy_array()
. The consequences of this complex overloading have not been investigated.
orbithunter 1.0.1¶
Minor Changes¶
OrbitCover.map()
now returns the mapped scores for each window individually, not their aggregation
Bug and Error Fixes¶
OrbitCover.trim()
was improperly applying masking.
orbithunter 1.0¶
Major Changes¶
Shadowing module completely redone with new
shadowing.OrbitCover
class.Fixes of numerical methods, function factories, and just errors in formulation with respect to hunt; all functionality should be available for classes which have implemented Hessian, however, the default can get surprisingly far using only the cost function’s Hessian if the linear terms are dominant w.r.t. the equation’s Hessian.
Optimization of shadowing module in terms of excessive or redundant computation, especially in
shadowing.OrbitCover.map()
, now only returns mapped scores corresponding to those which satisfy the corresponding threshold.Tutorial notebooks and docker container are now reasonable.
Minor Changes¶
include_zeros changed to include_zero_dimensions in
gluing.glue()
Bug and Error Fixes¶
Many bugs related to pivots, trimming, and mapping in the
shadowing.cover()
CG and CGS were not working for the KSe when parameters were constrained (square Jacobian); they are, for now, forced to evaluate the normal equations in this case.
Other¶
All numerical methods tested on KSe such that they all reduce the residual to some capacity now.
orbithunter 0.7rc1¶
Major Changes¶
Orbit.__getattr__ now provides more detail regarding errors fetching attributes, specifically those corresponding to parameter labels.
Numerical algorithm wrappers now have separate factory functions which produce the callables required for the various SciPy routines. This allows for more tidiness and separability between requirements for various routines.
Many fixes in SciPy wrappers
Orbit not allow for assignment of cpu_cores attribute; determines cores to use for KSe fft transforms. Only useful if dimension approx >= 128.
Orbit.transform()
now takes keyword argument “inplace”; this leverages SciPy’s overwrite_x in their rfft and irfft functions, and also overwrites orbit data in place as well.Orbit.costgrad()
now optionally takes Orbit.eqn() to be more general; i.e. allow for costgrad which do not require eqn to be passed.Jacobian for OrbitKS subclasses now much more efficient, many matrix related helper functions have been deprecated Memory usage cut down by approx 50% and time cut down by factor of 10.
Optimization methods now take “factories” which produce the requisite callables for numerical methods to allow for more customization. In other words, cost functions, their gradients, preconditioning can be handled without defining new class methods.
Shadowing has been re-done.
cover()
now returns scores in untrimmed pivot format only. These scores can be processed using the newprocess_scores()
function. Additionally, the mapping to orbit format scores and those which involve coordinate maps are done through this function as well.Example/provided shadowing metrics are now bundled into
scoring_functions()
.Hessian based methods are now supported but have not been thoroughly tested; worked with SciPy contributor to get finite difference methods to work (he did all of the actual coding, I just brought it to light).
New method
concat()
for simpler pair wise “gluing”. Allows ease of gluing without having to comprise an array of orbits, its shape, etc. Developed with fundamental domains of discrete symmetries in mind.Pairwise gluing was getting fundamental domains wrong. I have made it so glue and tile do not use fundamental domains but pairwise does.
Trust region methods now “approximately supported” for the KSe; meaning that the code has been generalized to the point where the hessian product can be computed for the KSe, but one of the terms is missing because it has not yet been defined, namely the evaluation of F * d^2 F * v; because the system is stiff, however, the jacobian times itself seems to provide enough information to enable decrease of the cost functional. Getting the Hessian product is more tricky than confusing, as it involves manipulation of a rank 3 tensor.
Shadowing, cover, fill have been rewritten to provide better performance/more consistent results based on window sizes. Now only computes scores at pivots valid for ALL window orbits. Previously pivots at the boundaries were taking only subsets of the windows due to whether the windows “fit” or not.
New handling of constraints and constants for SciPy; orbit_vector has been split into cdof and constants in order to avoid inclusion in the definition of the methods which use LinearOperator objects. Previously, they were included but corrections were constrained to be zero. Additionally, the usage of constraints was not handled properly by the definition of
from_numpy_array()
, as it was not accessing the correct values if constrained parameters appeared unconstrained parameters, relative to the order of parameter labels returned byparameter_labels()
. Optimization performed surprisingly well when all parameters were constrained, actually; may be worth describing alongside preconditioning.
Minor Changes¶
KSE Jacobians are now produced much more efficiently; uglier and very confusing code to do this, however, as OrbitKS operations are being used very creatively to apply to a 3-d array even though they are only meant for 2-d arrays.
Inplace computation of differentiation and FFTs now implemented for KSe. Uglier code but makes certain calculations more efficient.
np.reshape calls replaced with usage of None/np.newaxis where possible; as it is typically faster.
Spatial rotations were not working because the frequencies were being unduely raveled.
Added more generalized gradient descent; adjoint descent is now simply gradient descent with optimizations relevant to cost function \(1/2 F^2\)
Now can pass separate scipy keyword arguments for multiple methods via the method_kwargs keyword argument. Single dicts can still be passed to scipy_kwargs keyword argument.
The function fill now uses the relative difference between threshold and score to determine which orbit performed the best.
Added the ability to return the coordinates of pivots that produced windows that were out of bounds; should only be non-empty for when coordinate mapping functions are provided.
Bug and Error Fixes¶
Continuation was using the old OptimizeResult.status in while loop, making the code within unreachable: major error.
Can now handle cases where mask becomes “full”; i.e. no pivots to iterate over in shadowing.
core.Orbit.__getitem__()
was not updating the discretization parameters correctly; now forces parsing of the new state after slicing, as does the new concat method.When three or more methods were included,
optimize.hunt()
was unable to aggregate runtime statistics due to type errors; was trying to extend lists with numbers instead of listsCertain keyword arguments that were meant for outer iteration loops (orbithunter routines) and not inner loops (scipy routines) were conflicting, causing unintended performance issues. Most notable was
maxiter
keyword meant for the number of outer loop iterations was determining the size of the Krylov subspace inscipy.optimize.newton_krylov
The outer-iteration function factories were actually in the completely wrong place; needed to be within while loop but they were not..
Fixed fundamental domain gluing for this for ShiftReflectionOrbitKS by including roll
Keyword argument conflicts with scipy handled.
Known Issues¶
Handling of constraints with SciPy needs to be redone; the orbit_vector method should return only non-constant parameters.
orbithunter 0.7.0b¶
Major Changes¶
Orbit.__getattr__ now provides more detail regarding errors fetching attributes, specifically those corresponding to parameter labels.
Numerical algorithm wrappers now have separate factory functions which produce the callables required for the various SciPy routines. This allows for more tidiness and separability between requirements for various routines.
Many fixes in SciPy wrappers
Orbit not allow for assignment of workers attribute; determines cores to use for KSe fft transforms. Only useful if dimension approx >= 128.
Orbit.costgrad()
now optionally takes Orbit.eqn() to be more general; i.e. allow for costgrad which do not require eqn to be passed.Jacobian for OrbitKS subclasses now much more efficient, many matrix related helper functions have been deprecated Memory usage cut down by approx 50% and time cut down by factor of 10.
Minor Changes¶
KSE Jacobians are now produced much more efficiently
Inplace computation of differentiation and FFTs now implemented for KSe. Uglier code but makes certain calculations more efficient.
np.reshape calls replaced with usage of None/np.newaxis where possible; as it is typically faster.
Bug Fixes¶
When three or more methods were included, orbithunter.optimize.hunt was unable to aggregate runtime statistics due to type errors; was trying to extend lists with numbers instead of lists
Certain keyword arguments that were meant for outer iteration loops (orbithunter routines) and not inner loops (scipy routines) were conflicting, causing unintended performance issues. Most notable was
maxiter
keyword meant for the number of outer loop iterations was determining the size of the Krylov subspace inscipy.optimize.newton_krylov
The outer-iteration function factories were actually in the completely wrong place; needed to be within while loop but they were not..
orbithunter 0.6.1¶
Major Changes¶
EquilibriumOrbitKS._truncate()
was missing a normalization factor.
Misc¶
More docs
orbithunter 0.6.0¶
Major bug fix from refactoring
This is
Major Changes¶
The mapping from pivot scores to spacetime regions of the base orbit field
is holding the performance of orbithunter.shadowing.shadow()
and orbithunter.shadowing.cover()
back. It’s still required for orbithunter.shadowing.fill()
, but currently
the distinction between cover and fill seems blurred. It is still useful to map the scores
to orbit spacetime for masking purposes, though. Therefore the changes moving forward are going
to map scores only if the threshold is met; it’s not very useful information otherwise.
Misc¶
More docs
orbithunter 0.5¶
Major Changes¶
Renamed cost function related quantities;
obj
is reserved for objects in most places and so it didn’t make sense. :meth:orbithunter.core.Orbit.residual
is now :meth:orbithunter.core.Orbit.residual
orbithunter.core.Orbit.residual
is now :meth:orbithunter.core.Orbit.cost
orbithunter.core.Orbit.cost_function_gradient
is now :meth:orbithunter.core.Orbit.costgrad
Support for Hessian based methods has been updated through the new methods; also required tinkering with the scipy wrapper
orbithunter.optimize._scipy_optimize_minimize_wrapper()
New methods for second order methods
orbithunter.core.Orbit.costhess
orbithunter.core.Orbit.costhessp
orbithunter.core.Orbit.hessian
orbithunter.core.Orbit.hessp
Misc¶
Lots of docs changes, clean-up. Still not 100% polished but it’s getting there.
orbithunter 0.5rc2¶
Minor Changes¶
staticmethod bases renamed to bases_labels to better match other staticmethods
orbithunter.ks.RelativeOrbitKS.change_reference_frame()
keyword argument changed from ‘to’ to ‘frame’ because of potential conflicts withorbithunter.ks.RelativeOrbitKS.transform()
.
Other¶
Large expansion of docs, I believe it merits a rough draft ready for readthedocs
orbithunter v0.5b3¶
Minor Changes¶
Renaming function arguments to abide by .rst standards
Reorganization of private methods in OrbitKS classes
Other¶
Large expansion of docs, I believe it merits a rough draft ready for readthedocs
orbithunter v0.5b2¶
Major Changes¶
Major updates to documentation; lots of sphinxing learning and deployment.
Reorganized class methods and privated a number of methods like OrbitKS.nonlinear and OrbitKS.rnonlinear; those which served as components of a larger computation.
Minor Changes¶
Made the individual classmethod defaults private, with new classmethod
defaults()
.Naming conventions in
persistent homology
module now obey numpydoc rst.
orbithunter v0.5b1¶
Major Changes¶
Major updates to documentation; lots of sphinxing learning and deployment.
Reorganized class methods and privated a number of methods like OrbitKS.nonlinear and OrbitKS.rnonlinear; those which served as components of a larger computation.
Minor Changes¶
Made the individual classmethod defaults private, with new classmethod
defaults()
.Naming conventions in
persistent homology
module now obey numpydoc rst.
orbithunter v0.4.0
Major Changes¶
1. Discrete symmetry subclasses now handle bases differently. They force odd ordered derivatives to occur in the spatial basis. This leads to more sensible results instead of the zero-valued field that would occur otherwise.
2. More tests for core and KSE, fixed and expanded the derivative norm tests; they hadn’t taken the projections from transform operators into account.
Bug fixes¶
1. New iteration of self.constrain() was incorrectly assigning False to parameters that were not in self.parameter_labels(), causing self.from_numpy_array() to fail.
Notes¶
Getting readthedocs and github pages setup along with setup.
License¶
Orbithunter is distributed with the GNU General Public License v3 (GPLv3) license.
Orbithunter, Framework for Nonlinear Dynamics and Chaos
Copyright (C) 2019-2021 Orbithunter Research Community
All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
To contact the developer team, please send an email to
orbithunter@googlegroups.com
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
Indices and tables¶
Special Thanks¶
I’d like to thank the open source projects [Networkx], [NumPy], [SciPy] and many other packages for being great guides of how to setup, document, and structure Python packages, in addition to the great tools they provide.
Thank you to Predrag Cvitanovic for his courses and guidance throughout my PhD thesis, Burak Budanur for being a great source of information and friend, John Gibson, Ashley Willis and many others.