Monthly Archives: April 2014

Geophysical Challenge 1 - Need some help?

It has been a few weeks since we have posted our first geophysical challenge. We thought to create a tutorial post for the challenge to help you along! First things first, you will need to download the data for this challenge. Save this data to the same folder you will be saving your python challenge 1 script to. Now open Spyder. We have provided a step-by-step tutorial with information about each step, to help you along.

Continue reading

Behind the Curtain: Modules, Packages, and Libraries

Following a question asked after our Geolunch session, "What is numpy?" We thought it would be useful to provide a brief overview of python's modules, packages, and libraries: what they are and how they are useful.

Since ArchaeoPy focuses on scientific applications, we often want to reuse the same functions and variables. Luckily for us, python has a great selection of modules and packages that we can use to simplify our projects; instead of having to define our own functions and variables with each project.

A module is a file that contains definitions of functions, variables, and classes that can be imported and run in other modules. A package is a directory of modules. A library is a collection of packages and modules.

Python already has a great standard library with built-in functions, constants, and types that we will regularly use. However, we will often want and need to go beyond the standard library tools, and to that end, there is a range of other powerful numeric and scientific libraries and modules that we can utilise. Below lists just few of which we frequently utilise for our scientific applications (hopefully familiar from the code in our Geolunch presentation and in our ArchaeoPy repository):

NumPy: Numpy is one of our fundamental packages because it handles and processes arrays, which are what we use to structure our geophysical data.

matplotlib: matplotlib is a plotting library. In our examples, we have used matplotlib to produce greyscales.

PyQt: We have used PyQt to create our graphical user interfaces (GUI).

Geophysical Challenge 1

Following on from yesterday's Geolunch, here's the first Applied Geophysical ArchaeoPy challenge:

Load XYZ .CSV file and plot the data within python

You can do this in any way you want but some hints and tips are given below:

  1. Download the data from
  2. Numpy.loadtxt to load in a CSV file
  3. Matplotlib.mlab.griddata to grid the XYZ data
  4. Matplotlib.pyplot to plot the data
  5. If you get stuck, google is your friend!
Extra Credit
Its not very often that we use completely raw geophysical data. Usually we'll have to apply some processing steps to make the data more usable.
A simple initial processing step is a Zero Mean Traverse. We don't need any extra software packages to do this.
Numpy.mean can be used to calculate the mean of a group of values, or more usefully return the means of rows/columns in an array.
Numpy.subtract can be used to remove that value from rows/columns.
You might want to use loops and array indexing to do this but you shouldn't have to.
Upload your example to the ArchaeoPY Bitbucket (details here).
Prize for the most readable and well documented code.

Getting Started Guide

Hello! This guide will help you to get started with ArchaeoPY. This will cover installations you will need, how to utilise our repository, and how to get going running code. Stay tuned for Python Basics and Coding Basics guides! We are just in the process of putting them into a more GitHub/external-user-friendly form from our ipython notebook server.

1. Getting Started: Anaconda:

First things first, you will need Python installed on your computer. We recommend running Python 2.7 through Anaconda:

Continue reading