** numpy [#pbad2eee]

[[→ndarray:rest-term>http://rest-term.com/archives/2999/]]

** 初めての信号処理 [#a94b925d]

人工信号に対して、FFT、STFT解析を行うサンプルコード

[[→初めての信号処理>https://gist.github.com/peace098beat/b233857e44b1abe3bebf]]

** オーディオのロード [#sac51b33]
+ scipyを使う場合

返り値のdataはnumpy.array()

    # オーディオのロード
    from scipy.io.wavfile import read
    fs, data = read(filename)
    data = data[0:fs/2-1]

** Numpy Array (np.ndarray) [#wdb3c394]
 ary = np.array([1,2,3,4,5]) = np.array( (1,2,3,4,5))
 # ゼロベクトル
 ary = np.zeros(3) # 1次元の場合はスカラーでよい
 ary = np.zeros((3, 2)) # N次元の場合はタプルを忘れずに
 # 空配列
 ary = np.empty((Nx,Ny))
 ary = np.empty_like(ary0)
 # 1ベクトル
 ary = np.ones((Nx,Ny))
 ary = np.ones_like(ary0)
 # 単位行列
 ary = identity(N) #NxNの単位行列が生成される

- ndarrayの属性・プロパティ

 ary = np.array([1,2,3])
 # データタイプ(np.bool, np.int, np.float, np.complex... np.int32, np.float64...)
  ary.dtype 
 # タイプの変更
 ary = ary.astype(np.float)
 # 配列サイズ
 ary = np.empty((3,5,2), dtype = np.float)
 ary.shape
 >> (3,5,2)
 # 配列次元
 ary = np.empty((3,5,2), dtype = np.float)
 ary.ndim
 >> 3
 # 要素数
 ary = np.empty((3,5,2), dtype = np.float)
 ary.size
 >> 30
 
** Numpy Array (ndarray) 便利機能 [#q7969d99]

[[→The N-dimensional array>http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html]]

#ref(s-ndarray.jpg)
[[→ndarray atribute and method>https://gist.github.com/peace098beat/9eb9270c97060ae0c48f]]

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS