Category Archives: ArchaeoPY Documentation

GitHub Inventory and Housekeeping

Hello ArchaeoPY,

We are thrilled by the positive responses to our paper at the 2015 CAA UK hosted at Bradford this past weekend.

Chrys and Finn have finished taking inventory of what is currently in the ArchaeoPY repository. As a result, we have shuffled some things around, renamed some code to be more descriptive, and deleted a few extraneous files. A short inventory of what is currently available below:

ArchaeoPY Modeller - 2D resistivity and magnetic responses modeller over simple features. 3D modelling has been derived, but still needs to be implemented. Hasn't been forgotten--just taken a back seat to other tasks!

ArchaeoPY:

Filters: Contains filters (analytical signal and peak-finding, which for example, we recently used on EMI and mag data)

GUI Templates: Contains the base ArchaeoPY templates generated from Qt Designer... These may be re-thought at a later time. Originally ArchaeoPY was meant to have a template GUI, to which users could utilise to their own needs by importing in modules. Currently this template GUI is mpl, which contains a matplotlib canvas, with plotting and clearing buttons.

IO: Various in>out code. Includes binary data viewer and binary data savers (to dxf, txt, or png); image processing and saving GUI; EMI regridding GUI.

Plotting: Basic plotter GUI, now with statistical information and trendline plotting; multiple subplots plotting from the same file; and, in progress, multiple subplots from different files.

Positional: EMI (xyz data) regridding, grid sorting, geotiff with open layers.

Processing: scikit image processing, geophysical data processing.

We are still getting the hang of GitHub; so if you have any questions or comments, please leave them below or tweet/facebook/google groups us!

 

 

ArchaeoPY Update: What's new... What's to Come...

Hi All,

It has been awhile since our last update, but we are still alive and active!

Our GitHub repository  is slowly growing... so much so that we are in the process of doing an "inventory," to better structure the organisation of the repository. End goal: restructure snippets of codes (e.g. filters, data loaders) into folders separate from the GUI's, and have template GUI's, which the user can import and utilise the various snippets to suit their needs.

We will try to provide more regular updates on what we are working on through this page, but the GitHub repository will always be the most up-to-date. Currently we are working on:

Plotting: We have developed a straightforward 2D plotting interface (plotter) that loads tab separated data. This has developed out a need to plot lines of EMI data. The end goal is to add multi-axis plotting capabilities and run basic statistical analysis of the data. The GUI needs tidying up, but it still does the job.

plotter

An extension of Plotter is the multiple subplots GUI, which is still in progress:  multiple subplots

Other things we are working on also include a binary data viewer > exporter, and lidar hillshade data processing. Stay tuned for more.

 

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: http://continuum.io/downloads

Continue reading

Getting started with Python for Archaeology

The 10th International conference on Archaeological Prospection in Vienna involved a small but significant discussion about Open Software. This has continued on Twitter and I've committed myself to helping people start writing OpenSource software in Python.

I've chosen the Python Programming Language, partly because its one i have a working knowledge of but more importantly because it's inherently user readable. We have to remember that primarily we're Scientists, Archaeologists & Geophysicists, not Programmers and by using Python we can concentrate on what we want to happen to our data rather than how to tell the computer what you want to happen to the data.

Installing Python

To Get started with Python you'll need an implementation of Python on your computer. Python is Cross-Platform (It will work on windows, linux, mac ...) but the method of installing it on different platforms can be very different.

I've traditionally used PythonXY and Spyder on Windows and Mac Systems. For the purposes of this introduction i'm going to recommend Anoconda because its entirely Cross-Platform and therefore we should all encounter the same issues at the same time.

The installation method is slightly different between different operating systems but the Anaconda Support documents are detailed enough, i think.

If you dont want to use Anaconda PythonXY or installing Spyder and Python from scratch are suitable alternatives.

It's only during the Writing of this post that i've encountered Anaconda. This was very easy to install on my mac and includes 64Bit support unlike PythonXY. I'm going to try using both Anaconda and PythonXY to see if they both work seamlessly..

Keeping Track of Code Changes

I found one of the hardest and most frustrating things when i started writing code to process my Geophysical data was i changed it so much from day to day it was impossible to know how i'd created a particular dataset. I should have used a revision control system from the start but didn't so i'm going to recommend you do.

I've chosen to use EasyMercurial because its the one favoured by SoftwareCarpentry and completely cross platform, some instructions are available here.

Getting started with Spyder

To start writing some code open up Spyder:

OpenSpyderMac

Opening Spyder on Mac OSX

OpenSpyderWIN

Opening Spyder on Windows

 

 

 

 

 

 

I Like to think Spyder is relatively simple but to the Non-Programmer it probably makes about as much sense as digging does to me. Hence the image below...

Using Spyder

This looks the same on whatever Operating System your running and you'll probably find i flick between Mac, Windows and Ipython.

Writing Some Code

Well we've done the boring stuff and got everything we need installed. Now to write some code.

Create a New file in Spyder and you should see something similar to this:

# -*- coding: utf-8 -*-
"""
Created on Sun Jun  9 15:53:31 2013

@author: popefinn
"""

the """ and # denote that the text is a comment and should not be 'run' as code. On a new line underneath the MetaData Comment section type

print ("Hello World")

Run the Code by pressing F5, save the file as something sensible within your EasyMercurial repository, and accept the default runtime options. You should see the following:

HelloWorld

 

You've just written your first Python program. Its not particularly useful but is good step along the way.

I'm going to write another post soon with more useful python programming (reading, doing something, saving data) and start to move my tools and libraries into ArchaeoPY. For now i'd recommend looking at the information and tutorials on SoftwareCartpentry

Software Carpentry

Last year myself and a few others from the university of Bradford went to a software carpentry workshop at Newcastle University.

The course was very informative teaching how to code in a scientific environment rather than for codings sake.

They also now run online open office hours for those who've been on the courses which offer help with any coding problem you might have.

New courses have been announced for this year including one at Manchester university. They're free to attend and I think highly valuable.

If you want to register follow this link:

http://software-carpentry.org/blog/2013/02/a-bunch-of-bootcamps.html

Spyder on Mac OSX

Spyder is a great python development environment available through Python XY on Windows. Getting it to run on Mac OS X is a little more complicated however. You can't just download a binary image (.dmg), you need to compile the code from source.

The easiest way i found is to use MacPorts which comes with a package installer (think setup file).

Prior to installing MacPorts you need to install Apple Xcode and Xcode command line tools (Xcode Preferences - Downloads)

Once Macports is installed you need to open a TerminalMac TerminalMac Terminal 2

Run Port selfupdate

Sudo Port SelfUpdate

 

install py-spyder - This should include most required dependencies including python 2.7, numpy etc.. and because of this it takes a while

install py-spyder

 

then open spyder from the terminal

Open SpyderSpyder Running

 

As i said before most required python libraries should be installed using this method but not everything included with python xy. If you find you need a module that is not installed chances are you'll be able to find it on macports. If unsure ask and google.