# Computing and Software

## Excel Guide

Microsoft Excel is an important skill to develop and is used extensively in the Level 1 Physics labs at Durham for data analysis and graph plotting. Below is an introductory guide to the software.

The Excel Guide Template introduces how to prepare a worksheet and goes step by step through various tasks of data analysis and graph plotting typical of what you will do in the Level 1 Physics labs in Term 1.

 Objective Function Find the sum of a set of values SUM() Find the mean of a set of values AVERAGE() Find the standard deviation of a set of values STDEV() Find the standard error of a set of values STDEV() / SQRT( COUNT() )

Graphs are a great way to show your data and clearly identify trends. As a physicist, you will find that it is often useful to draw lines of best fit and calculate the gradient of such lines. This can easily be achieved in Excel.

LINEST is a built-in Excel function that computes the gradient, y-intercept and corresponding errors of a straight-line graph. This function is commonly used in Level 1, with the use of Python becoming increasingly frequent as your skills develop. However, across all levels you should always check throughout your experiments that your data is giving reasonable results and Excel is a great tool to do this!

Using the Excel Guide, test out the LINEST function on the prepared table. The answers can be found in the Graphs and Gradients solution sheet.

Distributions:

Excel can also be used to work with distributions such as the Gaussian and Poisson distributions. More information about both can be found on the Gaussian Distribution page (Gaussian Distribution - Durham University) page and the Poisson Distribution page (Poisson Distribution - Durham University).

Using the Excel Guide, test your ability to use both distributions. The answers can be found in the Distributions pdf solution sheet.

## Python

#### Jupyter notebooks

To reflect the current developments in the use of computing in the scientific community, we have modernised the way in which we use Python! Instead of requiring students to run Python on a command line, all the new learning resources are based on interactive Jupyter notebooks.

#### Notebook Resources:

Current students can access the Python handbook using their CIS username and account via BLU.

#### Using python and Jupyter notebooks outside of the notebook server:

You can also run python and Jupiter notebooks on your own laptop or computer. To do so you need to install python and Jupyter. The easiest way is to use anaconda (https://www.anaconda.com/distribution/). It is widely used in scientific contexts and there is a lot of help and tutorials available on the web.

There are also lots of online Python tutorials for you to find!

## Linux

Linux is an operating system, just like Windows or IOS. CIS uses Debian as their Linux operating system, which can be accessed through any PC attached to the CIS Network either directly, if they are dual boot machines (as in the Physics computer lab), or via Windows.

How to log on to Linux

On PCs in the Physics computer lab, you can boot Debian directly from the start-up screen immediately after the computer has been switched on. This runs Linux locally on that PC

Alternatively, it is possible to log in to Mira, which is the CIS Linux server. Mira can be accessed form outside of the University. If you would like an account on Mira, you will need to register for one, and the form for this can be found via https://durhamuniversity.sharepoint.com/Sites/MyDigitalDurham/SitePages/ServicePage.aspx?Service=%22Linux%20Timeshare%20(MIRA)%22

Once your account is active, you can use the X2Go software on Windows to connect remotely to Mira http://mira.dur.ac.uk/ . You can find this under `All programs' -> `Durham Network' -> 'Connect to CIS Linux' in the `Start' menu. Alternatively, this can be accessed through Durham “AppsAnywhere” package through the internet.  Your login details are your standard CIS username and password.  Once you have logged in a new window will appear containing your Linux desktop.

Linux is first and foremost a command-line based operating system, which means you type in commands at a prompt on your terminal and hit the return key to get them to run. As you are interacting almost directly with the computer, it will take your commands literally, and will not accommodate spelling errors etc...

Basic Linux commands the can be run in a Terminal include:

 ls List files ls-lrth List files with detailed information rm Remove a file e.g. rm test.txt rmdir Remove a directory (the directory must be empty) mkdir Make a directory cd Change directories e.g. cd Downloads cd .. Go back up to directory level 1 pwd ‘print working directory’ - tells you where you are in file structure cp Copy a file python Runs a python file e.g. python myfile.py

All commands relate to the directory you are in, but you can reference other directories without moving there by listing them with ‘/’

Eg. ls /Documents/myfiles/

To run a python file in a more interactive mode, you should use the command ‘ipython’ first, then run your file.