This week we welcome Juan Luis Cano (@astrojuanlu) as our PyDev of the Week! He is the chair of the Python Spain non-profit and the author of the poliastro project. If you can read Spanish, then you might want to check out his website. Otherwise you can definitely take a look at his Github profile to see what he's been working on or is interested in. Let's take some time to learn more about Juan!
Can you tell us a little about yourself (hobbies, education, etc):
I'm an Aerospace engineer with a passion for space, programming and open source. I really enjoy solving Physics or Math problems using computers, and the more my job requires me reading scientific papers and derive mathematical equations, the happier I am. I am an open culture advocate and also chair of the Python Spain non-profit, which organizes the PyCon in our country (I have been involved one way or another since the first edition, in 2013). When I am not in front of the computer, I love to listen to all kinds of music (electronic, '70s rock, opera, blues), go everywhere with my bicycle and travel.
Why did you start using Python?
One snowy winter morning in my first year of University, our Physics professor wanted us to derive whether it's better to climb a frozen ramp using the reverse gear of the car or not. However, he gave us the wrong solution and I struggled the whole weekend to understand it, without knowing it was wrong. I wanted to interactively displace the center of gravity of the car and the slope of the ramp without doing the calculations every time and visualizing it in some way, so I bought a 6 month student license of Mathematica. It was totally awesome, but I could not afford buying a complete license and it worked so so on Linux, so I typed "free alternative to Mathematica" and
Sagemath appeared. This was 2011, and the rest is history.
What other programming languages do you know and which is your favorite?
My first programming experience was with a game called
Tzar. It's kind of like Age of Empires, but allowed you to create your own campaigns, define events, write dialogs... I copied and pasted $myVar everywhere without knowing what I was doing, but the result was super exciting. After that, I learned ActionScript 3 and Flash to create my own games, HTML and CSS to create my own website, PHP to give it some logic... I have to admit that I somewhat miss the object oriented nature of AS3. Also, they taught us FORTRAN 90 (all caps) in University, but since I started with Python I never had to go back to FORTRAN again. As any engineer out there, I also had to do a thing or two in MATLAB, but I oppose its closed nature and pervasiveness. Overall, my favorite is Python, of course 🙂
What projects are you working on now?
I just finished a freelance project with Boeing and the European Comission to try to predict aircraft trajectories based on historical data using machine learning. In my spare time, I maintain an open source library called poliastro (more on that later) and I dedicate a lot of time to promotion, documentation, prepare talks about it for conferences... I'm also trying to gather data from the Spanish railway company, RENFE, which is a bit challenging because one has to do some ugly web scraping tricks on their website. I love challenges 🙂
Which Python libraries are your favorite (core or 3rd party)?
My favorite libraries are Astropy and SymPy, hands down. The latter constitutes what for me is one of the most successful Python libraries when we talk about new contributors, Google Summer of Code projects... And its LaTeX output mode in the Jupyter notebook is just marvelous. The former is a rare gem in which very talented astronomers have managed to put together a big, complicated library that acts as a foundation to many different projects. I use its unit handling capabilities and kinematic reference frame conversion functions a lot in poliastro.
How did the poliastro project come about?
In 2013, when I was an Erasmus (visiting) student in Politecnico di Milano, an Italian colleague and I had to optimize an orbital trajectory from the Earth to Venus and then analyze the orbital perturbations of a Venus-orbiting spacecraft. My colleague started his part in MATLAB, and one afternoon he sent me an email with some non-working scripts and gave up. So I rewrote some parts in Python, kept some others in MATLAB (using Octave, since I didn't have a license), and even included a FORTRAN part as well. This mess worked beautifully in my computer but was probably impossible to install on Windows, so two years later I rewrote all the algorithms in Python using numba, threw the MATLAB and FORTRAN away and became a happy man again. Now the project is more mature:
we had funding from the European Space Agency last year,
we presented it at the first Open Source Cubesat Workshop that took place at the European Space Operations Centre, and
this year we have been accepted as mentoring organization in Google Summer of Code as part of the Open Astronomy umbrella, so I hope I get tons of applications from students!
What lessons have you learned from running this open source project?
There are other projects similar to poliastro, and I'd say that some of them have better algorithms and more features. However, I'd say that none of them have spent so much time on API design, documentation, examples and promotion (relatively to the size of the project, of course). Also, Python is not the fastest language in the world but it gets the job done, it's easy to learn and it's trending. My biggest lessons with poliastro have been:
- Sometimes, language wins over performance.
- Sometimes, documentation wins over features.
- Sometimes, marketing wins over quality.
My favorite quote from any Python developer is from John Hunter (may he rest in peace), the creator of matplotlib: "the most important commodity an open source project needs to succeed is users". I've spent so much time making poliastro easy to install and use, that now it's the first contact with the language for many users and they're making insightful suggestions for new features, driving the course of the project and giving me energy to continue.
Is there anything else you'd like to say?
Python and the Open Source/Hardware/Knowledge mentality are now making its way into science, but there's still a long road ahead in Engineering. I would like to encourage other engineers out there who are tired of paying expensive MATLAB licenses against their will, or tired of endlessly looking for papers that everybody cites and nobody can find, to embrace the Open movement, engage in open source, and make its contribution. Per Python ad astra!
Thanks for doing the interview!