A PhD Student Condenses: Coding for New Researchers

Emma Spooner | Ossila - University of Sheffield PhD Student

My name is Emma Spooner and I am currently pursuing a PhD in Fullerene-Free Photovoltaic Devices at the University of Sheffield, in collaboration with Ossila Ltd. As part of this collaboration, I have run this series where I reviewed recent papers encountered in my research to provide a concise & helpful summary for Ossila’s customers. This is the final instalment of the series, but I will continue collaborating with Ossila to write helpful scientific content - so stay tuned for updates!

 

 

Coding for New Researchers

For many new researchers in science - especially those from a non-physics background - coding can be an intimidating topic. During my undergraduate degree in Chemistry, I had very little experience with this area, so starting a PhD in a Physics department (where many other students were very familiar with coding) was a little overwhelming.

What programming should I use? How could I learn? How could I process large amounts of data? This blog post aims to clear up some of those questions for anyone in a similar position, and to encourage readers to start exploring the area for themselves.  

 

Why Should I Learn How to Code?

Fundamentally, learning how to code will make your life easier! In terms of basic data analysis, it can allow you to process lots of results very quickly, but can also be extended to more complicated numerical processing and modelling. Understanding programming can help you to better comprehend the ways in which software and computers process your data. Coding is also an incredibly marketable skill.

 

How Can I Get Started?

Most of the time when scientists discuss coding, it will be in the context of Python, one of the most common and widely-used programming languages. For researchers with little or no prior programming experience, Python is often the most recommended starting point. This is because it is easily readable and vast online resources are available for those wishing to learn.

Emma’s Comments: Python is an interpreted language, rather than a compiled language like C or C++. This means the program is executed directly, based on subroutines that are already compiled into the computer. Essentially this means Python is a little slower than compiled languages, but is much easier to code in as all the basic functions and libraries are already provided.

There are many different ways to get started in learning Python, but it can be easiest to download a bundle with popular libraries, like NumPy and SciPy. These are modules that facilitate numerical manipulation in Python using low-level code to speed up the operations, and will be required for data analysis. A perfect place to start is the Ossila Xtralien Scientific Python distribution, which is specifically aimed at scientists and includes already imported modules, and everything needed to get started quickly. Beyond this, one of the most commonly recommended distributions in the wider Python community is Anaconda, which includes the development environment Spyder.

Emma’s Comments: There is some debate in the Python community about which version of the language is best, but most resources will recommend that new learners to begin with Python 3, as this is the present version, and the one that new features will be implemented into.

There are hundreds of different online web resources to learn Python. Ossila’s own Scientific Python tutorials - specifically tailored to scientists and users of the Xtralien distribution - are a great way to learn some simple code quickly. These cover basic variables and functions, and also move into numerical manipulation and graph plotting. These resources can be used stand-alone with other distributions, but will be especially useful for users of the Ossila Source Measure Unit as they give an overview of programming the source-measure unit.


Figure 1: The Scientific python tutorials provided by Ossila are a great place to start learning Python.

Emma’s comments: Many researchers coming from a Physics background will use Matlab for data processing instead of Python. Whilst this has its advantages (such as not needing to install additional packages like NumPy), many resources will still recommend learning Python in addition to Matlab. This is because it is free and open to all, so can easily be shared, adapted, and expanded. Moreover, its functionality reaches far beyond just scientific applications.

 

What Can I Do with Coding?

For many researchers, Python will come in most handy when automating repetitive tasks, such as batch processing data, or simply handling large amounts of results. Libraries such as Matplotlib can produce high quality figures easily and allow generation of anything from a basic bar chart to a three-dimensional surface plot.

Basic 3D surface plot, generated with matplotlib module in Python
Figure 2: An example of a basic 3D surface plot generated using the matplotlib module in Python.

 

From a scientific perspective, coding can also be used to facilitate experiment design using processors such as the Arduino and Raspberry Pi (the latter of which predominantly uses Python), allowing for measurements, automation, and prototyping. The Xtralien Python distribution can be used to communicate with the X100 if you have intermediate to advanced coding skills.

Beyond this DIY approach, there are systems available to help simplify commonly-used measurements. One such example are Ossila’s test and measurement systems, which include complimentary PC software for thin-film device characterisation. These systems are are built on the same Xtralien system (that the tutorials are based around). 

If you aren't confident in using Python to design your own experiments, or if you don't have the luxury of time to learn coding on top of your research, then Ossila’s test and measurement systems (such as the IV Curve & Four-Point Probe Measurement Systems) are perfect for you. They provide easy-to-use software for specific measurements - automatically calculating key metrics, enabling you to fast-track your research. 

 

Figure 3: The Ossila IV Curve Measurement System (powered by the Xtralien) that comes with pre-programmed PC software.

 

Beyond the world of science, learning to code can allow you to tackle all sorts of new tasks, from creating websites and generating widgets to app development. Depending on what your goals are, other programming languages (such as Java and JavaScript) could also be helpful to you. I strongly encourage all readers to think about what you could achieve by learning coding and to explore some of the many great resources available.