INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Python/Excel for engineers

Python/Excel for engineers

(OP)
I have recently been experimenting with Python + numpy and scipy; combined with PyXll to talk to Excel. It seems to me to be a good way of getting round Excel's main limitation for engineering work (i.e. the lack of good heavy-duty numerical analysis routines), although the need to work in a new language slows things down at first.

Anyone else using Python for engineering work?

Any recommended engineering applications or good documentation/help resources would be much appreciated.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

RE: Python/Excel for engineers

I'm using it more and more. We've used it for scripting (running tests, controlling builds, etc.) for a while, but the big incentive lately was that we decided to abandon Matlab. A popular alternative (though not a clone in the spirit of Octave) is IPython. It's a confusing world of packages and GUIs and consoles though. Ended up installing Python(x,y) which bundles together all the important bits, though it's still not clear where to go for what.

While not directly related to Excel, I found the following two websites useful general resources:

http://wiki.scipy.org/NumPy_for_Matlab_Users

http://matplotlib.org/users/navigation_toolbar.htm...

RE: Python/Excel for engineers

Since the cost of Matlab is monotonically increasing, it would make sense that at some point in time, some people will abandon Matlab in favor of Python or Octave. I would expect, though, that Octave will be more prevalent than Python, mainly because Octave at least has some claim to compatibility with Matlab. The issue with Python would be the uncertainty of compatibility of any given routine with and given version of Python. The proliferation of Python versions would be an impediment to any company looking to have maximal compatibility with available code.

TTFN
FAQ731-376: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

RE: Python/Excel for engineers

I don't see code incompatibility as being a problem. At some point somebody will write a translator which will turn m files into py. That may not be efficient py code, but cpu time is cheap.

I write most of my matlab stuff in octave compatible code anyway, so of the two alternatives I am more likely to stick with octave. That being said it wouldn't kill me to get a working py environment up and running, as we already have large slabs of the GUI for my main programs written in py.



Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

RE: Python/Excel for engineers

(OP)
Thanks for the links LiteYear. I have also found the number of different packages confusing. I ended up installing Anaconda with Python 2.7 (although I also have WinPython 3.3 installed, which doesn't seem to cause any difficulties, so far).

My main reasons for going with Python rather than Octave were:
- It seems to be much easier to integrate with Excel (with the help of PyXll).
- The Strand7 API has interfaces for Matlab and Python, but not Octave. Trying to convert from Matlab to a partial clone, in a language I know nothing about, seemed like asking for trouble.
- Python is (it seems) more flexible, and probably has a bigger developer community.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

RE: Python/Excel for engineers

This Python stuff sounds really interesting, but climbing the learning curve on another language is an unenvious proposition.

So I ask, what advantages does Python have over my old favs Fortran and Excel VBA?

RE: Python/Excel for engineers

Nice site!

This IDE is useful: http://www.jetbrains.com/pycharm/


"Simplicity is the ultimate sophistication." L. da Vinci
G. Coppola

RE: Python/Excel for engineers

(OP)

Quote:

This Python stuff sounds really interesting, but climbing the learning curve on another language is an unenvious proposition.

So I ask, what advantages does Python have over my old favs Fortran and Excel VBA?

I have done some stuff linking Excel to Fortran via VBA, and it worked well, but it doesn't seem to work since I moved to 64 bit Windows. It would probably be fairly simple to fix, but I haven't found the time to look at it.

The main advantages of Python are:
  • There are extensive libraries linking to high performance compiled code, and these seem to be under more active development than Fortran.
  • Using PyXll it's very easy to call these libraries, either directly from a User Defined Function, or via VBA.
  • It is also very easy to develop routines in VBA, then link to compiled routines, via PyXll and Python, for the calculation intensive bits.
The main disadvantage compared with linking Excel directly to a compiled language is that pure Python seems to be even slower than VBA, although there are easy to use ways to speed it up, which from my limited testing seem to work very well.

I guess the main reason for adopting Python, other than that I enjoy dabbling with this stuff, is that I see it as a way of future-proofing for the days when VBA and/or Excel become just another programming tool that old people used to use once.

Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/

RE: Python/Excel for engineers

I don't primarily use Python for every day use.
But, I have used it many times before for statistical calculations.

Since reading this thread I tried to use if for scientific things I would normally use Matlab or Maple, Octave for.
But, the scientific libraries for Mac OSX are a serious pain to install. With a net search this seems to be a widespread issue.
If anyone here uses Python for engineering on OSX let me know. Thanks.


"Simplicity is the ultimate sophistication." L. da Vinci
G. Coppola

RE: Python/Excel for engineers

Screw it haha. I'll just use Linux for Python. Seems to work with no issues.


"Simplicity is the ultimate sophistication." L. da Vinci
G. Coppola

RE: Python/Excel for engineers

I just remembered I used another very useful Open source computational language before.
It is very useful and similar to Octave. It although has a better interface imo than Octve.
http://www.scilab.org/


"Simplicity is the ultimate sophistication." L. da Vinci
- Gian

RE: Python/Excel for engineers

Yup Scilab is much prettier, more modern and more actively developed than Octave. Sadly it is less compatible with Matlab. I can write Octave at home and be fairly confident that the same code will run on Matlab with very few tweeks. Converting Scilab to Matlab is nowhere near as easy.

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

RE: Python/Excel for engineers

I agree Greg. It's too bad that Octave is not more evolved than it is. If it were it would be the absolute choice without a doubt.


"Simplicity is the ultimate sophistication." L. da Vinci
- Gian

RE: Python/Excel for engineers

Ahh. The conversion is not without issues it seems. Had to correct the way it converts if statements.

It converted:

CODE -->

if s1(i)>d1h || s1(i)<d1l 
                s1(i)=6000;
            end 

to

CODE -->

//    %v02 = %t;  if ~s1(i)>d1h then %v02 = s1(i)<d1l;end;
  //    if %v02 then
  //      s1 = mtlb_i(s1,i,6000);
  //    end; 

Also, seems that Matlab runs the code same faster. Interesting.


"Simplicity is the ultimate sophistication." L. da Vinci
- Gian

RE: Python/Excel for engineers

scilab can come with scicos if dynamic block-based modelling is your thing. It even claims to support Modelica, although that bit was quite immature when I last looked into it.

- Steve

RE: Python/Excel for engineers

I tried the block diagram dynamic modeling in scilab. It is indeed very "immature" compared to simulink.

Although, the direct programming of scripts seems to be almost on par with matlab in terms of functionality.


"Simplicity is the ultimate sophistication." L. da Vinci
- Gian

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close