The Jacknife is also sometimes called the “Leave One Out” method, and is a method to somehow evaluate the stability of statistics done on data. By leaving one element out of the input array and studying the mean of the…
Tag: numpy
Pack an Enthought Traits app inside a .exe using py2exe (Canopy Edit)
10 months ago, I published the updated version of my tutorial to pack an Enthought TraitsUI based application inside an .exe Windows Executable file, using a standard Python 2.7 install and the Enthought Tool Suite 4.0 (ETS4.0). In April 2013,…
Meteor in Russia – Seismic Signal ?
Very early this morning, a meteor lit up the skies of Russia, somewhere close to Ekaterinburg. Same as for the Korean Boom Boom, we wanted to have a look at the seismic data of a close-by station to check if…
Plot waveforms of events on a dates axis
Following a question from my dear colleague Devy, here is how to plot a set of events, occurring at random moments in time. The idea is to plot the waveform of each event with the beginning at the top and…
North Korean nuclear tests with Obspy
This morning, North Korea tested some nuclear “bomb” somewhere in the middle of the country (confirmed by Pyongyang officials and CTBTO), and many seismic sensors worldwide recorded the triggered waveforms. The location of the test is the same as the…
New Tutorial Series: Pandas
In the coming months, I’ll prepare some tutorials over an excellent data analysis package called pandas ! To show you the power of pandas, just take a look at this old tutorial, where I exploited the power of itertools to…
Matplotlib & Datetimes – Tutorial 04: Grouping & Analysing Sparse Data
To extend the previous tutorial (see here), we define a data array that has some information about the event that occurred for each datetime. The plot of data vs time now looks like: The data array is constructed with numpy.random:…
Matplotlib & Datetimes – Tutorial 03: Grouping Sparse Data
New tutorial, more advanced this time ! Let’s say we have a number of observations, like occurrences of earthquakes, or visitors connecting to a webserver, etc. These observations don’t occur every second, they are sparse on the time axis. To…
Matplotlib Basemap tutorial 09: Drawing circles
In the previous tutorial, I defined a “shoot” method to compute the landing point of a shoot from one point, to a given azimuth and distance. Using this logic, it’s possible to find the points situated at a given distance…
Numpy Trick 01
I usually forget how much Numpy makes life easy : Say, you have a 101 element array, e.g.: import numpy as np a = np.linspace(0,100,101) and you want to take every 4th item in that array, that’s as easy as…
Numpy.ma not always necessary
I just discovered that there is an easier way to do this (e.g. from tutorial06): import numpy.ma as ma mask = ma.masked_where(countries[‘ISO’] != iso, countries[‘ISO’]) country = ma.array(countries[‘country’],mask=mask.mask).compressed()[0] by using the built-in numpy.where method: import numpy as np index =…