LArray 0.33 released

Skip to first unread message

Alix Damman

Aug 19, 2021, 4:07:16 AM8/19/21

Hello all,

We are pleased to announce that version 0.33 of LArray is now available.

Major changes since the last 0.32 version are:

  • [EXPERIMENTAL] added CheckedSession, CheckedParameters and CheckedArray objects (See the Working With Sessions section of the tutorial):
o    CheckedSession is intended to be inherited by user defined classes in which the variables of a model are declared. By declaring variables, users will be able to take benefit of the auto-completion feature on session members in PyCharm (auto-completion is the feature in which development tools like PyCharm try to predict the variable or function a user intends to enter after only a few characters have been typed). All user defined classes inheriting from CheckedSession will have access to the same methods as Session objects.
CheckedSessions provide an elegant way to structure your model in functions (in particular, by limiting the number of / eliminating the global variables).

class Demography(CheckedSession):

    # (convention is to declare parameters (read-only objects) in capital letters)

    # Declare 'VARIANT' parameter as of type string.

    # 'VARIANT' will be initialized when a 'Demography' session will be created

    VARIANT: str

    # declare variables with an initialization value.

    # Their type is deduced from their initialization value.

    COUNTRY = Axis('country=Belgium,France,Germany')

    GENDER = Axis('gender=Male,Female')

    TIME = Axis('time=2013..2017')

    population = zeros([COUNTRY, GENDER, TIME], dtype=int)

    births = zeros([COUNTRY, GENDER, TIME], dtype=int)

    # declare 'deaths' with constrained axes and dtype.

    # Its type (Array), axes and dtype are not modifiable.

    # It will be initialized with 0

    deaths: CheckedArray([COUNTRY, GENDER, TIME], int) = 0


d = Demography(VARIANT='baseline')


    • CheckedParameters is the same as CheckedSession but the declared variables cannot be modified after initialization.
    • The special CheckedArray type represents an Array object with fixed axes and/or dtype. It is intended to be only used along with CheckedSession (see example above).

  • greatly improved the Array.plot() method and “submethods” (, etc.):
    • support x, y and by arguments in plot functions where it make sense When only some of them are specified, the other arguments pick from remaining available axes. This means a lot of plots can now be expressed more intuitively and concisely (you do not need to transpose your array to get the result you want, you just specify the axes you want to use in ‘x’ or ‘y’.
    • subplots argument now accepts an axis (or tuple of them) in addition to a boolean to specify which axes to use as subplots.
    • support for labels (instead of axes) in x and y for line plot and scatter.
    • support passing a dict as legend to customize the legend.
    • many tweaks to make several plots look better out of the box.

  • scalar objects (i.e of type int, float, bool, string, date, time or datetime) belonging to a session are now also saved and loaded when using the HDF5 format.
  • implemented the Array.allclose() method.
  • implemented Axis.astype(), Axis.min() and Axis.max() methods.
  • LArray is now supported by Python 3.8 and 3.9.

The complete description of changes including examples can be found at:


As always, *any* feedback is very welcome, preferably on the larray-users
mailing list: (you need to register to be able to post).

Disclaimer: This e-mail may contain confidential information which is intended only for the use of the recipient(s) named above.
If you have received this communication in error, please notify the sender immediately and delete this e-mail from your system.
Please note that e-mail messages cannot be considered as official information from the Federal Planning Bureau.
Reply all
Reply to author
0 new messages