Ian Photo Dr Ian Robinson
Physics Projects 'n Stuff
Home Research Blog Consult Downloads About

Simple Sieve of Erastothenes in Python and Fortran

One of my sons coded a prime number generator using the ancient Sieve of Eratosthenes algorithm in python. This and conversations about programming languages led me to a speed-test of such a numerically intensive task in python vs. Fortran.

A program was developed first in Fortran, then translated to python attempting to maintain the same data-types and loop methodology. No significant attempt was made to optimise the algorithm. Note, these programmes do not output the results, this to eliminate language differences in write times.

For results in python and fortran see Blog page post on 30/1/22.

Last updated (30/1/22) - Download

Seismic Data to Audio Converter

sonify_mseed is a simple python program which converts seismic data in .mseed format to an audio file with the seismic values mapped onto a frequency range.

The code can read in either a single .mseed file or an entire directory which it then concatenates. Data are mapped onto a frequency range and the time may be compressed by some user defined factor. e.g a day compressed by a factor of 1000 results in about 80 sec of audio.

The code is not very elegant in its use of python though has been written to hopefully be easy to follow and adapt.

Last updated (9/1/22) - Download

Precision Digital Protractor

A project to build and interface a precision digital protractor to a Prismatic-H82 Faceter (similar to a Polyhedron Scintillator) giving a resolution of 1/40 degree. The system employs a US Digital E6 Optical Encoder, Arduino Nano and Waveshare 1.5" colour OLED display.

This may be of interest to those interested in adding such a system to a faceting machine or any device where the angle of rotation needs to be measured . The code may be adapted to read from other rotarty optical encoders. It also may provide a template for those wishing to drive the Waveshare OLED display for other projects.

n.b. the Arduino sketch is adapted from Tom Herbst's excellent code described in his highly recommended 'Amateur Gemstone Faceting vol 2' -link. Any errors introduced are my own.

  • Arduino Sketch
  • Article Draft
  • Notes

All the above in one zip archive (updated 31/12/20) - Download

Raspberry Seismic

Stable well-tested code suitable for long-term recording of such as seismic data. This be easily adapted to record a range of input signals periodically producing plots for uploading to the web. Data are saved timestamped .mseed format for ease of analysis by standard seismic software.

  • Seismic Monitoring Code Description
  • rpiseismic.py - runs on Raspberry Pi to records and plots data
  • InfraSoundAnalyser.py - outline analysis code for PC
  • Software License - opensource but minor geographical limitation

All the above in one zip archive (updated 17/10/20) - Download

Infrasound Monitor

An opensource educational project this involves the construction of a static or portable high resolution Infrasound monitoring station.

The software & hardware has been tested over the past couple of years and is solid..

All the below in one zip archive (updated 30/8/21) - Download

Contains ...

  • InfrasoundReport1.pdf - draft paper

  • Getting Started - guide to circuitry and setting up the PI
  • TestRed.py - little python script to check that the PI is reading from the sensor
  • InfraSoundMonitor.py - main python Code to run on PI which records and plots data
  • InfraSoundMonitorMobile.py - mobile version of above, simply stores data every minute or so without plotting
  • InfraSoundAnalyser.py - various data analysis/visualisation routines built on ObsPy
  • V3 BOM - components list

  • Software License - opensource but minor geographical limitation

Aurora Monitor

This is a well-established opensource project to build a nT resolution earth field magnetometer. The system effectively monitors changes in the solar wind and could be used to predicit aurora as well as being a testbed for further development.

All the below in one zip archive (updated 25/4/21) - Download

Contains ...

  • Updated IOP paper

  • Getting Started - guide to circuitry and and setting up the PI

  • FreqMonitor - Python hardware test code, simply monitors the signal sent by Arduino

  • EFMv3.py - Raspberry PI python code to record and plot data

  • fcounter6.ino - Arduino program to record frequency of FGM sensor

  • Software License - opensource but minor geographical limitation

Physics Research