Numpy for python script

Hello all,
I’m a newbie to both python and dynamo, so bear with me. I’m trying to write a script for some basic matrix analysis in python, but I’ve been unable to use functions like zeros and transpose because I haven’t found a way to numpy to work in my python script. It seems like numpy is what I need to download (although I can’t get it to work), but I’d be happy to hear if there are suggestions for any other options for working with arrays. What I’m doing requires some matrix analysis and for loops.

1 Like

numpy is intended for use with Cpython. Dynamo uses the .Net based ironPython implementation and thus does not support numpy. You can try using Math.Net instead. I don’t believe there are any examples for it on the forum but this link should get you started:

Could you upload sth to work on? What do you want to achieve?

Hey Tomas,
Thanks for the reply. I am trying to do an optimization (using Optimo which has been successful for simpler problems) of the beams and columns for a multi-story and multi-bay moment frame, having cross-sections and bay width as my variables. Roof deflection and structure weight are my objectives. I have many codes in Matlab that will do the analysis, and that is where I was hoping to write a python script that will do the same thing as my Matlab scripts. This is only because I have not been able to link Dynamo and SAP2000 through DynamoSAP.

Thanks for the response. I have tried using the Math.Net method from the link, but I cannot seem to figure out how to install it to the Dynamo IronPython script. I saw a link on enthought that has a package that is supposed to add numpy and scipy to IronPython. It is, but it only opens if you’re signed in as a member. I also haven’t been able to add it to the IronPython script in Dynamo.

I am wandering if this could help.
It looks it might be possible I would be interested to hear if anyone succeed.

1 Like

@JParker did you figure out a solution? I am trying to do the same.

Not yet…

I am also expecting a solution,

Will not come!
Numphy will not be supported as long as it is not a part of IronPython… Numphy is not meant for IronPython, so it will be difficult… It look also as it will be the current version of IronPython that will continue in Dynamo 2.0, therefore will pip not be supported. Meaning, dont use anything that is not a preloaded module.

What might work… implement parts you need as OOP in your package. You could see my package (DanEDU Dynamo) for inspiration for how to support OOP environment in python coding inside the package!

1 Like