Python (and Fortran and C) as used in large-scale number crunching and scientific programming
Channel: North Bay Python
Date: 05/12/2017

Catherine Moroney

https://2017.northbaypython.org/schedule/presentation/24/

Slides: https://drive.google.com/open?id=1dhRV9myYou61AniLGdIXdfFfTQw3WdHl

Python is an incredibly powerful and versatile language, but it is not practical for lots of deeply nested loops because it's not compiled, and a lot of the big scientific libraries only have C interfaces.  But, if you bring Fortran (via f2py) and C (Cython) into the mix then you can use the best features of all three languages and shrink your development/maintenance time and resulting code size by almost an order of magnitude.

My satellite has a lot of legacy code in a Perl/C/Fortran mixture that is incredibly difficult to read and maintain, but our new software is in a Python/C/Fortran mixture (with Python being the bulk of the code) that is a fraction of the size of the old code, much much easier to develop and maintain, yet it has the speed and stability to be used in our production system.  

I use Python for the upper and middle layers, Fortran for the few places where I need to do lots of looping that cannot be transformed into whole-array operations, and then C to interface with the various 3rd party libraries.   I can wrap Fortran and C using f2py and Cython respectively, call them directly from the Python, and pass numpy arrays back and forth seamlessly.

I also have layers of scripts:  a Python code to run a single orbit's worth of data through a single stage of the processing pipeline,  a second Python script to run multiple orbits through a single stage, and then a third script that runs the entire processing chain through many orbits, thereby using Python's numerous scripting capabilities.  

By using all three languages as described above, I truly get the best of all worlds:  dramatically reduced development time, a code base that is a fraction of the size of the old legacy system, yet all the speed and stability I need to process huge amounts of data.

About North Bay Python

A single-track conference north of the Golden Gate, focused on community, collaboration, and all things Python.

North Bay Python is a two-day, single-track Python conference held at the Mystic Theatre in Historic Downtown Petaluma, California, over the weekend of December 2 & 3, 2017.

We're a nonprofit conference for professionals, enthusiasts and students alike. We're focused on inclusion, accessibility, diversity, and affordability. Most importantly, we're planning a great lineup of talks from all over the Python ecosystem, with plenty of time to meet new people and develop new ideas.

Our venue, the Mystic Theatre in Downtown Petaluma, is a beautiful example of an early 1900s Vaudeville theatre. You can find over 50 different food and drink options a short walk away, and the nearest hotel is only a block away.

A Python conference north of the Golden Gate


North Bay Python is a single-track conference with a carefully curated set of talks representing the diverse Python community and their different areas of interest.

If a topic is less to your interest, or you've met some people you really want to sit down and chat with, we'll have plenty of areas away from the main theatre to catch up and chat.

Our goal is to keep prices as low as possible. That means we won't be catering lunch. Instead, you can look forward to extra-long lunch breaks you can use to explore all of the great food options around the venue.