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?


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!


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.


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.

Observing the Dark

by Ken Patton

April 2012: I’m headed to the airport early one Wednesday afternoon.  Double check to make sure I have my bags, backpack, and really the one most important thing I need: my passport.  This is going to be my first trip to Chile where the telescope for the Dark Energy Survey (DES) is located.  I’m a graduate student at Ohio State and I’ve been working on software for DES over the previous half year; this trip is intended to be a ‘mock’ observing run to test the software and hardware on our telescope.  And luckily the project is also giving me the first ever opportunity to travel to a destination requiring my passport.  I’m flying into La Serena, a town located about an hour and a half drive from the Cerro Tololo Inter-American Observatory (CTIO) where the telescope is located.


Cerro Tololo Inter-American Observatory


Blanco (DES telescope) is on the left, with various other telescopes.

The Dark Energy Survey is meant to study the nature of dark energy, a form of energy with negative pressure that is causing the universe to expand at an increasingly faster rate over time.  The survey will take images in several different colors over one eighth of the sky, observing over 300 million faint distant galaxies.  From statistical properties of the galaxies we can infer the expansion history of the universe.  For the ‘mock’ observing run, however, our camera is not yet mounted on the actual telescope; this means we are primarily testing the system without the actual ability to image the sky.

As we are still performing a good deal of engineering work we expected many of the components to have minor issues here or there.  However, within the first few days we got derailed by one thing we were not expecting: the cooling system of the telescope dome.  It is somewhat equivalent to air conditioning units but it circulates a mixture of water and antifreeze to cool various components inside the dome.  It’s an established system that is in use many places, so we did not expect to run into issues with it.  This caused a slight panic at first since without the building cooling system we would not be able to cool down the camera for the telescope, which operates at -100 degrees Celsius.

As most experimentalists know, it’s often the little things that have the potential to derail your project.  We began to develop a fallback plan for our tests, but fortunately within a couple of days they were able to getting the cooling system back up and running satisfactorily.  This allowed us to fully test the software by pulling data off the camera, processing it into images, and sending the data back to Fermilab (the national lab near Chicago hosting our data).  Overall the ‘mock’ observing run ended as a success, and it gave us useful information on which systems, such as the building cooling, needed improvements over the next few months before we actually intended to observe the sky.

Data from a single CCD with our ‘star’ projector

Data from a single CCD with our ‘star’ projector


The Blanco telescope inside the dome

Returning to Ohio it was back to the daily grind. Unfortunately, most days in the life of a scientist are not always glamorous. Much of your time is spent building, troubleshooting, and debugging rather than analyzing or collecting data.  But we live for the interesting events.  Final results from an experiment.  Publishing a paper.  Travelling to conferences, meetings, or in some cases, to remote observing locations.

Most of my time prior to and after the ‘mock’ observing run was dedicated to working on software for the telescope.  Before the telescope was being used to observe the sky, a large fraction of the effort in the collaboration was focused on getting all the systems ready.  Nonetheless, we still made time for collaboration meetings to discuss the goals of our dark energy science, mostly through constraining the evolution history of the universe.  To do this we have four different probes of cosmology: supernova, baryon acoustic oscillations, galaxy clusters, and gravitational lensing (you can read more about these probes here:

Then in early September we had first light. Wooooooooo! It was exciting seeing the first few images of the sky come off the camera because of how much work we had put into the project at that point.  In the very first images all of the stars and galaxies looked like large donuts- a sign the system was out of focus.  This is pretty much what we expected since we had not gone through the process of calibration yet; in particular we needed to determine the optimal distance from the correcting lenses in the telescope to the focal plane.  So that night the telescope operators stepped through offsets based on the first images to focus it and voila, stars and galaxies started to appear.  We had real data with which we could begin to do science.

First light!

First light!

Since then we’ve progressed into a phase of ‘science verification’ before the official start of the survey.  In this phase we staff the telescope with regular observing shifts and collect data much like we would for the full survey, but over a much smaller area of the sky with the intention of analyzing the data on a quicker time scale.  A typical observing shift consists of four scientists for DES: two observers (in case one falls asleep!), a software expert (often done remotely), and a run manager.  The run manager is the one who plans the observations for the night.  The observers then actually run the telescope, telling it where to point and verifying the correct images are being taken.  And the software expert is just on call in case system issues arise.

Blanco control room

Blanco control room

Eight months after my ‘mock’ observing run I got to return to the telescope once more for a real observing shift.  It was a bit more intense this time around because the telescope had to be run at night (surprise!) unlike the first trip.  For this trip I mostly operated as an observer while also providing local software support based on my experience with the code.

Outside the Blanco dome in the morning

Outside the Blanco dome in the morning

Dome opened for the night prior to observations around 8 PM

Dome opened for the night prior to observations around 8 PM

During the course of the survey many scientists will travel down to CTIO in order to rotate through week-long observing shifts.  We have not officially started the full survey, but are currently finishing up the phase of science verification.  When this phase is complete we should be able to publish preliminary results confirming our ability to perform the dark energy science we set out over the next five years.  You can follow our progress and see more images here:


About Ken Patton

IMG_0749I am originally a Columbus native, but I did my undergraduate degree at Swarthmore College near Philadelphia and then worked in Washington D.C. for three years before returning to The Ohio State University to pursue my PhD in Physics.  In my free time I play a lot of soccer, both on recreational teams and in various pick-up games with friends.  I got into astrophysics and cosmology after a professor once told me that if I had an interest in general relativity, condensed matter may not be the right area for me.