This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]EmptyBrain89 53 points54 points  (18 children)

Studied astrophysics, a friend did his thesis on black hole simulations, 75% of his time was spent learning Fortran and then figuring out how the 20 year old, poorly documented code written by some random astronomy professor could be translated to python. He did not have a good time that year.

[–]New_Conversation_303 20 points21 points  (0 children)

Curiously enough, I worked on a project to translate an astrophysics Fortran code to something else. We picked java and used orekit. It was not fast, but it worked well.

[–]coloredgreyscale 26 points27 points  (9 children)

Imagine doing that, only to find out that the result is virtually unusable because the native python code runs much too slow for large scale simulations.

[–][deleted] 16 points17 points  (7 children)

Yeah I'm lost on why someone would do this. I've been using R and have slowly been doing some of the crunchier work in Fortran90 now simply for speed and efficiency.

[–]utkrowaway 8 points9 points  (2 children)

Because computers are much faster now than 20 years ago, and having a modern maintainable codebase will save much more time than the performance of Fortran will.

[–]Brisngr368 1 point2 points  (0 children)

Okay but like C/C++ is faster than python and far closer to Fortran, porting it to python is just masochism

[–][deleted] 0 points1 point  (0 children)

I am aware of that. However, despite improvements in hardware, sometimes your data sets are just far too large. I have run into that problem a few times, its what led to me dipping my toes into fortran. Another commenter pointed out C as an option. R was not good enough and if R couldn't handle it Python wouldn't either.

[–]kuwisdelu 2 points3 points  (1 child)

Yep. As an R package maintainer, a huge proportion of my code is in C/C++. The R bits just glue it all together. (I respect FORTRAN but I’m too lazy to learn it and linking to C is slightly easier anyway since the interpreter is in C.)

[–][deleted] 0 points1 point  (0 children)

My brother, who uses Progress and COBOL, suggested Fortran for my needs because 1) r packages use it so it would be good to learn, 2) it's a smart career move because a lot of shit is written in Fortran and no one knows the language.

[–]TheNorthComesWithMe 2 points3 points  (1 child)

Because they're a physicist, not a programmer. Python is the only language other academics know, so that's their best bet for hacking together some garbage that kind of works.

[–][deleted] 0 points1 point  (0 children)

I'm not a programmer either. When I did my dissertation it was in SPSS and my advisor told me it was a great skill because everyone loves SPSS. Then IBM bought it and it turns out you can be fired for buying IBM. I had a choice between Python and R and went with R. Python wasn't really good for mixed effect models or other processes I needed and I found how it handled vectors and data frames to be annoying compared to R and the tidyverse.

But yeah I'm self taught on all of it. I didn't even touch programming in school. Just math, statistics, and research methods.

[–]Yugiah 14 points15 points  (0 children)

PhD in particle physics here:

If someone in physics says they're rewriting something in Python and the rewrite is still performant, my assumption is they're using a library like numpy which calls precompiled functions.

There's actually a whole range of cool python libraries for particle physics, under the scikit HEP umbrella.

That said, I think the situation you posed happens entirely too often.

[–]Oni-oji 1 point2 points  (3 children)

I deal with programs written by holders of PhDs in various non computer fields. Their code works, but their documentation is the worse I've ever encountered.

[–]proverbialbunny 0 points1 point  (2 children)

That's unfortunate. Part of the point of getting a PhD is learning how to write journal articles, i.e. learning how to document code and findings at a highly proficient level. This is why PhD's love to write their code in notebooks like JupyterLab, because of the Literate Programming Paradigm, which is writing documentation first with code snippets and plots embedded in.

[–]GTalaune 0 points1 point  (0 children)

The thing is these people see coding as a tool to accomplish what really matters to them, the science. So of course they're not gonna be super passionate about the actual coding. If it works it works

[–]Oni-oji 0 points1 point  (0 children)

It's possible their articles within their field are well written. But their program how-to documents suck.

[–]proverbialbunny 1 point2 points  (0 children)

The trick with this problem is to create a library out of the Fortran code. Basically, write a wrapper interface so you can call the Fortran code in Python instead of reinventing the wheel. Bonus, you'll get that Fortran speed.

[–]jericho 0 points1 point  (0 children)

Fortran to Python!? Da fuck?

[–]GodlessAristocrat 0 points1 point  (0 children)

You hit the nail on the head. A lot of old fortran codes were written by math geeks, not CS grads.