Wednesday 26 June 2013

python timing

With ipython:

In [1]:  timeit test = extractPhase2(Vin = res['C120130515-00000'][0:l], \
            Vout = res['C220130515-00000'][0:l], \
            pointsPerCycle = 30.0, cycles = 1, debug=0)


1 loops, best of 3: 7.88 s per loop

Wednesday 19 June 2013

save matplotlib pylab plots

import matplotlib.pyplot as plt

plt.plot(range(4))
plt.savefig("test.png", format='png')

and / or


a = subplot(221)
a.plot(range(4))
savefig('test2.png', format='png')

Monday 17 June 2013

standard deviation and rms values


from 20130510-WindTunnelMeas.ipynb


The formula used for calculating rms values was, $rms = \sqrt{ \frac{1}{n} \sum{x^{2}} }$

The standard deviations are of the quantity described and
were calculated using the population standard deviation calculation:
$std = \sqrt{ \frac{ \sum{ (x_{i} - \overline{x}) }^2}{n}} = \sqrt{variance}$.

It is clear that the standard deviation forms an rms like parameter, but using the
difference between each value and the mean, rather than the values themselves.  std should
therefore be compared to rms values, not amplitude values.

Monday 10 June 2013

Moving data to S3

ssh into the S3

cd /mnt/externalSD    or so.

scp -r login@localipaddress:/home/me/files ./

works!  Reset the thing to update the list.  Hmmm.

Even better:


sudo sshfs -p 2222 root@192.168.16.20:/ /mnt/phone

Friday 7 June 2013

Padding to get counter with constant field length


In  [1]: print '%06.0f' % 4
Out [1]: 000004

In  [2]: print '%06.0f' % 401
Out [2]: 000401



Wednesday 5 June 2013

Adjusting matplotlib spacing vspace


# These prevent two line titles and axis labels overlapping.
matplotlib.rcParams['figure.subplot.hspace'] = 0.4 # 0.3 default.
matplotlib.rcParams['figure.subplot.wspace'] = 0.3 # 0.2 default.