NumPy

Resolver One supports the option of using NumPy, a popular CPython package that provides convenient and fast N-dimensional array manipulation.

This alpha-level integration is available thanks to the Ironclad project. It offers extremely fast number-crunching in certain circumstances, and we believe the core functionality to be extremely stable. However, it is still experimental in nature, so is not enabled by default

Enabling NumPy Support

NumPy support is now always enabled. If you used this feature before it was enabled by default, you can tidy up your system as follows:

  1. In the Windows Control Panel, select System, Advanced, Environment Variables.
  2. Delete the RESOLVER_ONE_USE_NUMPY environment variable, which is no longer used.

Using NumPy

Basics

The following resources should help you become familiar with NumPy:

  • The offical tutorial: Every NumPy operation it covers should work as expected in Resolver One. However pylab, referenced in the Histograms sections, is not yet available.
  • The Numpy documentation.

Using NumPy in Resolver One

You can use NumPy objects in the grid, just as you would any other Python or .NET object. However...

Slicing

Resolver One supports the range of clever slicing tricks available through NumPy arrays, but the formula language uses slightly different syntax—see Differences Between Resolver Ones Formula Language and Python Expressions. If you're writing user code to manipulate NumPy arrays, just use normal Python syntax.

NumPy array values

When a NumPy array is displayed in the Resolver One grid, its underlying data is not normally shown.

It is possible to override this behaviour using the Cell class's Formatter trait. However, first try unpacking.

Unpacking NumPy arrays

You can unpack 2D NumPy arrays just like 2D System.Array objects. The row/column ordering may not always be what you want, but you can work around this using the transpose method.

Any other rank of NumPy array will be treated as a normal iterable when unpacked. For example, unpacking a 6D NumPy array yields a number of 5D NumPy arrays. To unpack individual values in such an array, use the array's flat property.

Known Issues

  • Unicode data is not supported in any way. Attempts to use it will probably lead to spectacular crashes.
  • Memory-mapped file support is very tentative; if you need this feature, please contact us and we'll work out the best way to proceed in your particular situation.
  • The numpy.distutils package is not supported.
  • On certain versions of Windows XP, the float96 and complex192 data types are displayed incorrectly.

Unknown Issues

Please inform us of any problems you encounter, either in the forums, or by email.

Comments