The Program This Week Is … Programming

by Eric Suchyta

As we’ve seen throughout previous postings, a day in the life of a physicist can be quite different from one physicist to another, depending on what kind of physics you do.  However, there are a number of skills that are generally useful and applied everyday across various disciplines.  One such craft is computer programming.  If you’re not too familiar with computer programming, the idea is pretty simple.  You write out a specific set of instructions, and then you tell your computer to go do these actions.  Just like humans speak different languages, there are many different programming languages, each of which has its own strengths and weaknesses.   Programming in each language will look a little different, but at the end of the day they’re all aimed at basically the same thing, helping you tell your computer what to do.

Computer programming is useful to physicists for a variety of reasons.  For one, the problems that physicists attempt to solve are often very sophisticated, maybe so much so that a pen and paper solution alone isn’t even possible.  In such cases we turn to a computer to implement calculations we couldn’t feasibly carry out ourselves.  Also, scientific datasets can be enormous, and often times we need to repeat the same types of analyses over various sets of data.  Humans quickly tire of doing the same task over and over again, but computers love to do this and are much faster at it than we are.  Computer programs are even written to control the instruments themselves when scientists are taking their data.  Some instruments are sufficiently complex that attempting to control each moving part without the aid of computer programs would be utterly impossible.  Take a look below at the picture of the Compact Muon Solenoid (CMS), one of the detectors at the Large Hadron Collider (LHC).  The LHC accelerates protons to extraordinary energies, and this awe-inspiring detector analyzes what is produced following a collision of these high energy protons.  Notice how puny the person (not me) looks compared to the size of it.  Can you imagine attempting to operate something like this without computer assistance?

cms

One of the detectors at the Large Hadron Collider. Did you notice the person in the center of the picture? Imagine trying to use this detector without any computer aid! Source: CERN

If I tried to share all the ways OSU faculty and students use programming in their lives we would be here for days, so I’ll limit the scope.  Two examples that I find particularly fascinating include biophysicists modeling exactly how DNA functions, and condensed matter physicists moving tiny beads in a controlled way through a magnetic field, which you can watch for yourself in this YouTube video.  For the rest of this post I’ll be sharing my story, focusing on some of the kinds of computer programs I’ve been writing.

My area of specialization is astronomy; I work on a project called The Dark Energy Survey.  If you’ve read the post by Ken Patton, I do the same kind of science he does.  In short, we take lots of images of the sky with an enormous digital camera attached to a telescope, and then analyze the images in order to learn what the Universe is doing on scales roughly 100,000 times larger than the Milky Way.  For a more thorough explanation, I invite you to see our project website or follow this blog written by one of our scientists.  My work for the project has been twofold, writing software for controlling our instruments so that we can efficiently carry out our survey, and writing analysis software that uses our recently acquired data to make meaningful measurements.  In both cases, I’m doing loads of computer programming.  It’d take me a bit too long to adequately describe my analysis software, so I’ll focus on the instrumental side.

We have a very sophisticated camera, and I was responsible for writing applications to control a few of its components.  Today I’ll mention two, called the filter changing mechanism and the hexapod.

The filter changing mechanism does exactly what its name says; it changes filters.  Our camera has six filters to choose from.  Each filter allows the camera to see only one specific color of light, everything else is absorbed.  In astronomy, it is useful to look at the individual colors of the sky as separate images because no two images look the same, and the differences give us clues about what we’re seeing.  I’ve included a picture of the filter changer.  The cartoon version illustrates how it moves the different color filters into the opening, and the frame directly above that is a picture of the real filter changer itself.  To get a sense of how big these filters actually are, look at the next picture comparing the size of this opening to the size of a person.  (Again, I’m not in the picture.)  The scale of our camera is a bit larger than your everyday digital camera to say the least!

Picture1

Left: Our camera’s filter changer. The different filters let us look at different colors of light.
Right: We have a huge camera. The filters are the size of this opening.

The hexapod is a system of six “legs” for precisely adjusting the focus of our images.  Again, I included a picture of it (in which I don’t appear).  Despite its massive size, it controls movement of the surface atop those legs with extreme accuracy.  This is where we place our camera, so we can make small adjustments to get the most crisp looking images possible.  To see a much smaller hexapod in action, you can watch this YouTube video.  You can see what I’m talking about at 1:43 into the clip.

hexapod

Our camera’s hexapod. The six “legs” can be finely adjusted to control the focus of an image.

Writing programs for such precise and very expensive equipment seemed a bit of a daunting task at first.  Before starting the project I had only had limited programming experience, and had never written anything in Python, the particular language used throughout the work.  In fact, I had never programmed anything before learning some basics in my undergraduate physics courses.  Yet when all was said and done, writing the programs for the camera turned out to be completely manageable.  The instrument has been tested, and much to my delight, what I wrote works!  I’m not quite sure how to explain it, but when you talk to those with programming experience (myself included), there’s a consensus for noticing a genuine feeling of satisfaction when you successfully run a program that you wrote yourself, even if it’s a very simple program.  This feeling is one of the things I look forward to daily at work.  My experiences have also dispelled any misconceptions that I may have had about computer programming.  I assumed it would have been much harder to get the hang of it than it actually was.  With a little effort, anyone can learn to program and open the door to all the applications it affords.  I wish I had learned sooner!

Want to Learn More about Programming?

Although I was taught a small amount of programming in college, the vast majority of what I have learned is self taught.  Introductory programming help is widely accessible online, and this is how many aspiring scientists get started.  I highly encourage you to go this route if you feel inclined.  Googling “<insert programming language here> beginner tutorial” will bring back endless results.  A few programming languages commonly used today include C++, Java, and PythonHere is one website that I know of which offers interactive tutorials.  Another package which introduces you to programming concepts through 3D graphical movement is called ALICE, and is available for free download.

____________________________________________________________________

About Eric Suchyta

michigan_2012_croppedI am entering my fourth year as a PhD student in physics at THE Ohio State University, where I also did my undergraduate degree in physics.  I’m a diehard fan of my local sports teams (Buckeyes, Blue Jackets, Crew, USA soccer), and enjoy playing sports and keeping active in my free time.  I’m into metal music, and I’ve been known to grow a beard every now and then.  I also happen to be an identical twin.  I’m still trying to figure out what I want to be when I grow up.  You can find me on the Twitterverse with handle @eric_suchyta.

Advertisements

One thought on “The Program This Week Is … Programming

  1. Pingback: 5 Highlights of My Summer REU at the University of Wisconsin – Madison | A day in the life...

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s