Here you can find the capture script, and here a script that processes the array and creates a few plots. Any help with Y axis units are appreciated. Make sure you secure the ipad before testing :)
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Posts made by KlMa
-
RE: Why do i get diffrent graphs running this code with Python 2.7 or 3.5?
-
RE: Why do i get diffrent graphs running this code with Python 2.7 or 3.5?
Apparently there is a bug in matplotlib 1.4.0 related to sliced arrays. A work around is to flattening the input.
# coding: utf-8 import console import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as ml # console.clear() file_name = 'wc-cent-2.npy' data = np.load(file_name) fig_mag = plt.figure() plt.psd(data[:, 0].flatten(), NFFT=256, Fs=80, window=ml.window_hanning, detrend = ml.detrend_none, scale_by_freq = True, noverlap = 0, pad_to = None, sides = 'onesided') plt.xlabel('Frequency (Hz)') plt.ylabel('Power/Frequency (dB/Hz)') plt.title('PSD X') plt.show()
-
Why do i get diffrent graphs running this code with Python 2.7 or 3.5?
Hi,
I wanted to see if i could find out the centrifugation speed of my old washing machine using some vibration analysis in Numpy using fft etc. So i wrote a little script that captured accelerometer data at 80Hz for one minute and then placed my ipad on top of the machine during centrifugation. I stored the data in an array in an .npy file. My graphs looked ok, I think, with a dominant peak at about 12Hz(12*60=720rpm...this probably explains why my clothes are so wet coming out from the machine). I tried the same using the the psd function in matplotlib using Python 2.7 and got a similar result, but when i run the code in Python 3.5 I get a very diffrent result. Can somebody explain why? Is it the diffrent versions Python or matplotlib or Pythonista or something else, i dont get it? The .npy file can be found here# coding: utf-8 import console import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as ml # console.clear() file_name = 'wc-cent-2.npy' data = np.load(file_name) fig_mag = plt.figure() plt.psd(data[:, 0], NFFT=256, Fs=80, window=ml.window_hanning, detrend = ml.detrend_none, scale_by_freq = True, noverlap = 0, pad_to = None, sides = 'onesided') plt.xlabel('Frequency (Hz)') plt.ylabel('Power/Frequency (dB/Hz)') plt.title('PSD X') plt.show()
-
RE: Pythonista crashes for me
Ok thanks. Is there a way to use the beta or should i wait for the bug fix? Or should i buy Pythonista 3?
-
Pythonista crashes for me
Hi
I am using Pythonista 2.1 on a ipad air and having problems with Pythonista crashing. Maybe matplotlib is involved, but its difficult for me to say. If I for example try to add a row after theplt.plot(np.arange...
row below and start to write "plt.plo..." and wait a few seconds it crashes. I see the problem in other scripts using matplotlib as well. Any ideas?# coding: utf-8 import console import motion import time import numpy as np import matplotlib.pyplot as plt def show(ori_func, ft, sampling_period): n = len(ori_func) interval = sampling_period / n plt.subplot(2, 1, 1) plt.plot(np.arange(0, sampling_period, interval), ori_func, 'black') plt.xlabel('Time'), plt.ylabel('Amplitude') plt.subplot(2,1,2) frequency = np.arange(n / 2) / (n * interval) nfft = abs(ft[range(int(n / 2))] / n ) plt.plot(frequency, nfft, 'red') plt.xlabel('Freq (Hz)'), plt.ylabel('Amp. Spectrum') plt.show()
-
RE: Error when trying to start ssh from stash
Thanks @ywangd , it works now.
Regards
Klas -
RE: Error when trying to start ssh from stash
A related question. I am trying to login to my Lego Mindstorms brick (with ev3dev firmware) but get the following error:
[~/Documents]$ ssh.py --password maker robot@192.168.1.17
Connecting...
Looking for SSH keys...
No SSH key found. Trying password...
No handlers could be found for logger "paramiko.transport"
Auth Error
Connection FailedI am able to login from my windows pc using putty.
Regards
Klas -
RE: Error when trying to start ssh from stash
Thanks! It seem to work now.
Regards
Klas -
Error when trying to start ssh from stash
Hi
I am trying to use ssh from stash but receive the following:StaSh v0.5.0
[~/Documents]$ ssh
pyte module not found.
StaSh ssh installing pyte...
Opening: https://codeload.github.com/selectel/pyte/zip/master
Save as: /private/var/mobile/Containers/Shared/AppGroup/02FA6CEE-1A00-462F-B842-260483ACFCD9/Documents/site-packages/pyte.zip (52161 bytes)
8192 [15.71%]
16384 [31.41%]
24576 [47.12%]
32768 [62.82%]
40960 [78.53%]
49152 [94.23%]
52161 [100.00%]
done
stash: <type 'exceptions.ImportError'>: No module named wcwidthAny ideas?
Regards
Klas -
RE: Matplotlib and style sheets
Thanks! And then the next question, is there a "official" Pythonista way how to install new modules? When i search around there seem to be several ways to do it. Pipista, stash and others. Is there a step by step instruction a newbie like me can follow?
-
Matplotlib and style sheets
I am not able to get matplotlib style sheets to work in Pythonista. Any tips?
http://matplotlib.org/examples/style_sheets/plot_ggplot.html