Scripting: Making the mundane go away

If you ever have had to manage or process data or plot said data (I know this is everyone in the sciences, but I am making a point) then your life is more difficult than it needs to be if you are not automating those tasks! The idea of having to re-load my image to my word doc, or plot more than one or two plots in excel makes me cringe. Why? Let me ask you this: How many of you have to do something like this in your day to day?

  1. get some columns of numbers
  2. make more columns based on those numbers
  3. plot a figure from some of the (now much lager) group of columns
  4. determine some useful metric or fact from the plot
  5. do it all over again

If that’s you, then it could be so much easier to do it using code, and not even that hard! let me show you:

for file in directory:
    open(file,'r')
    result = calculation(file[0])
    plot(file[0],result)
    metric=max(result)

That wasn’t so bad was it? thats the active bit of code in a python script to do our list of repetitive scripts! For as many files as you want! Without you lifting a finger (digitally speaking). More to come at an upcoming MESA workshop. We will be teaching you the basics and then getting some scripting working on YOUR data!