October 8, 2021

Python and Turbo Sleuth

Fortran 90 is old school. A lot like slide rules, typewriters, and rotary dial telephones. It is great if you are into nostalgia, but there is little else to recommend it. The only people currently using it in a serious way are labs doing major number cruching work and parallel computing; particle physics people and people simulating exploding stars (and nuclear weapons).

I am not selecting Python because it is my favorite language. Python has a number of virtues, as follows:

Nobody these days knows anything about Fortran 90. Everyone is using Python. I come from the Astronomical Computing community and python is widely used for data analysis and visualization at Steward Observatory, Space Telescope Science Institute, and most institutes doing astronomical research.

I would rather code in ruby, if I had to pick a nice language, but Python is far ahead of Ruby as far as the scientific support libraries it offers. Things that are at your fingertips with Python would be a significant struggle with Ruby. Perl is idiosyncratic, fading into the past, and out of the question. C could be used. You can do anything using C (and I like C), but it would simply be a lot more work for little gain -- and portability would be much less straightforward.

So, Python seems an ideal choice.

Python and Windows

I have never done any serious software development on Windows, and I don't intend to do so for this project. I am doing the development and testing under linux where I am far more comfortable and then testing on Windows. I am barely getting started, but so far I am very pleased with how this is working out. Python is handling almost all the portability issues smoothly for me.

What you need to do is to install two packages (Python and Git) to get started.

When I began this project, Python 3.9.7 was the latest, but as I write this 3.10 is out and by the time you read this, some yet newer version will be the thing.

Installing these is like installing any other package for windows. Use your browser to download whatever it is you download, then run it and you get an installer and almost certainly just take all the defaults as it asks questions. And of course you will need to give your admin password.

Note that the Git install gives you a fair bit of bonus stuff. You get a bash shell as well as an scp (and perhaps an ssh) client. Who knows what else.

Put the source on Github

I set up a new empty repository on my Github called (if you can believe it) "Raman". If you want to get a copy on your machine, do this:
git clone https://github.com:trebisky/Raman.git
I type this command in the "git bash" console window on my Windows machine and it sets up the "Raman" directory with my project inside.

Python packages on Windows

I have the latest Python (3.9.7) installed, but I try a tiny graphics demo and find that numpy and matplotlib are not installed. Missing packages are installed using the "pip" utility which you get as part of the python you installed.

I type at the "git bash" window:

pip install numpy
pip install matplotlib

Getting my Raman software

This is very simple once you have git installed.
Launch git bash window
git clone https://github.com:trebisky/Raman.git
This will create a directory called "Raman" and deposit all the files I currently make available into it.

Keeping up to date

Once you have a cloned repository on your windows machine, you keep it up to date by typing "git pull" in your Raman directory. In other words as follows:
Launch git bash window
cd Raman
git pull

Feedback? Questions? Drop me a line!

Tom's Mineralogy Info / tom@mmto.org