Рow to find the ordinal variables in a .csv file in python?

Python or Java ...

  • Help me choose between Python and Java for a specific type of programming. Background: I am a researcher in engineering with a wide scope. Mostly, I perform simulations of (mechanical) systems, behavior of which are governed by differential equations. I also develop models for biology/genetics (but not bioinformatics type stuff). I use Fortran (I know) for programming, write results to output file(s) and read them using Excel or Tecplot to visualize. I also use Matlab and Mathematica for quick models. It gets pretty cumbersome after a while, especially when you want to quickly figure out behavior change (of a phenomenon) depending on the input variables. So I thought maybe it is time for me to learn some OOP and write codes that will allow me to change input variables interactively and see the results simultaneously on the screen. Following link best describes the type of interface I am looking for: http://cmol.nbi.dk/models/igroup/igroup.html You see what I mean? There are buttons, sliders, text boxes to change variables and the results change immediately in the "graphics" area. As far as I can tell, it is an applet written using Java. Let's drop the ability to write applets aside because I am not looking for that. First question: can one write a code that would provide similar interface (GUI if you will) using Python? If so, would it be pretty straight forward after some Python learning (I understand it is hard to answer this question but give it whirl please)? Java appears a little intimidating to me while my initial experience with Python has been pleasant. However, I could not find any applications/codes on Python sites that fits what I am looking for (suggestions are welcome). Thanks so much.

  • Answer:

    I'm guessing here, but might you be interested in http://www.xjtek.com/ ? It provides a GUI for developing Agent based models and System Dynamic models (and more, but these two seem most relevant). It is java based and not free, but you can do much of the work using a GUI. I couldn't load your applet cos I'm on a java free computer but the structure seemed similar to an agent based model. System Dynamics is a really great way of visualizing differential equations. (I'm not familiar with python)

eebs at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

The Matlab gui editor is pretty good and I don't think you'd have any trouble writing a gui that looked like the example you provided. Once you're familiar with it writing gui applications are pretty easy and quick. While I understand the concern about being locked into a proprietary language, it may be that it's so much faster to solve your problems now in Matlab that you can worry about learning another language when you're no longer at your current job and don't have Matlab access. (That said I write this as an academic who's always had access to Matlab; academic licenses are cheap).

pombe

http://www.processing.org/ looks very interesting (though it kept crashing my Firefox when I was checking out their tutorial/demos). Here is my strategy: I'll give the Matlab gui editor a go as I already am familiar with other aspects of Matlab. In parallel, I will build knowledge on Python + the suggested modules. Thank you, appreciate the help.

eebs

I thorougly recommend Python + wxPython + numpy/scipy. Python is a fantastic general-purpose language. Of the languages I know, it's my favorite. If you use wxPython, you should know that the more detailed http://docs.wxwidgets.org/stable/wx_classref.html is also applicable to wxPython. Also be sure to download the docs and demos package to get a sense of what is possible. Numpy/scipy, recommended above, can function as a complete replacement for MATLAB (except for plotting) for most users. For the plotting part, look into http://matplotlib.sourceforge.net/, which basically duplicates most of the 2D plotting capabilities of MATLAB, with a similar API. You can also embed it in wxPython and other GUI frameworks, which is one way to acheive these "interactive plot" type applications. The only thing it can't do is 3D plots, so if you need those you'll have to look elsewhere. But it is much more powerful than Excel for plotting. One of the salient features of Python is that, once you get used to it, productivity is very high. Most people find they can get much more done in much less time with many fewer bugs than in a lot of other languages (C++ and Java, I'm looking at you). I'm an electrical engineer, if it matters.

musicinmybrain

OOP may be a red herring here. There's nothing about your problem that requires OOP, and it may get in the way. Java will require you to structure your code in an OO fashion, but it's optional in Python.

silentbicycle

You may want to check out http://wiki.python.org/moin/PyQt.

sien

Python only added features like garbage collection and Unicode support Unicode, yes. Garbage collection? Python was refcounted from the start. CPython still is. To the asker: Sage is v. awesome.

Monday, stony Monday

Check out http://www.scipy.org/. NumPy wraps some well proven and optimized numeric analysis libraries up for use in Python programs. SciPy builds on NumPy with a bunch of higher-level science and engineering modules. I think there are also bits for visualization and interactive UIs. Keep in mind too, you can use python interactively. You might also check out http://www.sagemath.org/. Also built with and scriptable in python. Has a webUI for interactive visualization.

Good Brain

Um, what? Python was first released in 1991, Java was first released in 1995. I'm not sure what "mature" means in this context, but I think it is something we could argue about all day long. You're right, but as a language on par with Java, Python only added features like garbage collection and Unicode support around the end of 2000. It's definitely something to argue about, but feature-wise, I think it is reasonable to suggest that Java has a lot more going for it than Python. One thing I like about Java is strong typing. Python does not have this, and while this makes writing code faster, it makes debugging anything much more than a script increasingly difficult to manage. YMMV. If you have the http://psyco.sourceforge.net/ module installed you'll get significant overall speed improvements with Python scripts. Install this and add the following snippet to the top of Python scripts that do any computation with non-native libraries: try:     import psyco     psyco.full() except ImportError:     pass I'd still recommend Java for anything more than short scripts where cross-platform GUI development is concerned, but it's good to have knowledge of both languages.

Blazecock Pileon

nthing Python and wxPython. Yes the documentation for wxPython kinda sucks right now, but it has a great demo and a super-helpful http://lists.wxwidgets.org/mailman/listinfo/wxpython-users. Like someone mentioned, the wxWidgets docs are actually more helpful, but you have to mentally translate them from C++ to python (not too difficult after a bit). Also http://matplotlib.sourceforge.net/ and NumPy would be of interest. Once you get setup/installed (make sure you get the wxPython demo), check out http://wiki.wxpython.org/MatplotlibFourierDemo on the wxPyWiki which is a recreation of a MATLAB GUI. (also if you've never programmed Java or Python, definitely go with Python... it's much easier to understanding OOP without Java in the way)

i_am_a_Jedi

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.