πŸš€Migration Tips

We periodically update the way things behave in Collimator, so here are some tips and tricks to smoothly transition your models.

Collimator 2.0 Updates

Block updates

Python Script Block

  • The NumPy, math, and other libraries that were previously imported by default will now have to be imported explicitly. This should help with performance in many cases.

  • time is no longer an implicit variable. Add a Clock block connected to an input instead.

  • dtype and shape in port params are no more. Initialize outputs through code in the Init script instead. When in "Discrete" time mode outputs must be initialized with the correct shape and dtype.

    • For a performance speed up, tick Accelerate with JAX option. To get the full benefits, here are some guidelines:

      • Use jax.numpy in place of NumPy

      • Try to use JAX control flow (e.g. jnp.where) in place of Python if/else

        • Original (pure Python):

        out_0 = x1 if in_0 > 0.5 else x2

        • JAX:

        jnp.where(in_0 > 0.5, x1, x2)

      • This JAX help page has tips on writing JAX-compliant python.

  • We have dedicated blocks for common cases that can be used instead of the Python Script Block with manual code implementations:

    • State Machine Block

    • Random Normal Block

    • White Noise Block

State Space Block

  • Input and Output are vectors, rather than individual ports. To combine signals into a vector use a Mux block. To split vectors into separate signals, use a Demux block.

Logical Operator Block

  • This block has now been split into 2 blocks: Logical Operator block & Logical Reduce block.

  • The behavior of these blocks follows the NumPy functions (e.g. np.logical_or and np.all/np.any), respectively.

Matrix Multiplication Block

  • The Matrix Multiplication block does not take parameters representing multiplication type of Matrix matrix, Matrix vector, and Vector matrix anymore. The behavior is implicit depending on the inputs and mimics jax.numpy.matmul.

Dot Product Block

  • This now mimics jax.numpy.dot, and as such is not restricted to vectors only.

Rigid Body Block

  • The order and meaning of the input and output ports has changed - see block documentation for details.

  • Now supports defining gravity in the "world" (inertial) reference frame as a constant 3D vector.

User Interface Changes

The User Interface has seen a bit of a face lift, but you'll also find some usability enhancements throughout, including multi-select on the Dashboard, updated status of running simulations, and more.

One of the most important changes is that properties are now split into tabs. This makes it easier to access simulation and output settings from anywhere in the model hierarchy. You can find more information about these settings here.

Last updated