Python block in altair activate

Linn Liao
Linn Liao New Altair Community Member
edited April 2024 in Community Q&A

Hi,

I'm trying to calculate a matrix using this python block, and while the same code works on python, it does not work here. Is numpy arrays not supported?

image

image

image

The error message says:

image

Best Answer

  • RSGarciarivas
    RSGarciarivas
    Altair Employee
    edited April 2024 Answer ✓

    Hi Linn,

    vssGetInputData will import the data as an an ndarray. Therefore, adding [0,0] at the end of lines 8 to 14, like this:

    a1 = apis.vssGetInputData(block,5)[0,0]

    Should give you the floats you need.

    Also, make sure the output size is correct in the Ports tab of the block. In this case, I believe it should be a 4x4 matrix, right?

     

    Rafael

Answers

  • RSGarciarivas
    RSGarciarivas
    Altair Employee
    edited April 2024 Answer ✓

    Hi Linn,

    vssGetInputData will import the data as an an ndarray. Therefore, adding [0,0] at the end of lines 8 to 14, like this:

    a1 = apis.vssGetInputData(block,5)[0,0]

    Should give you the floats you need.

    Also, make sure the output size is correct in the Ports tab of the block. In this case, I believe it should be a 4x4 matrix, right?

     

    Rafael

  • Linn Liao
    Linn Liao New Altair Community Member
    edited April 2024

    Wow, thanks alot! And you even replicated it in the twin activate :O I guess in my next question I could leave a file instead of screenshots.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.