13.07.2015 Views

LIAM 2 User Guide

LIAM 2 User Guide

LIAM 2 User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>LIAM</strong> 2 <strong>User</strong> <strong>Guide</strong>, Release 0.7.0The Entity class stores all there is to know about each entity: fields, links, processes and data. It serves as a glueclass between everything data, processes, ...When entities are created, they are added to a global registry in registry.pyProcessfile: process.pyThe Process class stores users processes. The most common kind of process is the Assignment which computesthe value of an expression and stores the result in a variable.The Compute class is used as alternative for Assignment when a user does not store the result of an expression(with a side effect) which does have a return value (as opposed to Actions).Another very common process is the ProcessGroup (a.k.a procedures) which runs a list of processes in order.Actionfile: actions.pyActions are processes which do not have any result (that can be stored in variables), but have side-effects. Examplesinclude: csv(), show(), remove(), breakpoint()Expressionsfile: expr.py (and many others)Expressions are the meat of the code. The Expr class is the base class for all expressions in Liam2. It defines allthe basic operators on expressions (arithmetic, logical, comparison), but it should not be inherited from directly.file: exprbases.pyLiam2 provides many different bases classes to inherit from when implementing a new function:• NumexprFunction: base class for functions which are implemented as-is in numexpr. eg. abs, log, exp• CompoundExpression: base class for expressions which can be expressed in terms of other “liam2” expressions.eg. min, max, zeroclip• EvaluableExpression: base class for all other expressions (those that do not exist in numexpr and cannot beexpressed in terms of other liam2 expressions). These expressions need to be pre-evaluated and stored in a(hidden) temporary variable before being fed to numexpr, and this is what EvaluableExpression does. Oneshould only inherit from this class directly if none of the below subclasses applies.1. NumpyFunction: subclass for functions which are implemented as is in Numpy. Should not be useddirectly.– NumpyCreateArray: subclass for functions which create arrays out of nothing (usually randomfunctions).– NumpyChangeArray: subclass for functions which take an array as input and give another arrayas output (eg clip, round).– NumpyAggregate: subclass for aggregate functions. eg. count, min, max, std, median.2. FunctionExpression: subclass for functions (which take one expression as argument). eg. trunc, lag,duration, ...– FilteredExpression: subclass for functions which also take a filter argument. eg. align, sum, avg,gini.Liam2 current expressions are implemented in the following files:alignment.py handles align() and align_abs() functions10.2. Code architecture 51

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!