Skip to content

Instantly share code, notes, and snippets.

View peace098beat's full-sized avatar

Tomoyuki Nohara peace098beat

View GitHub Profile
@peace098beat
peace098beat / fdtd_3d_pml_v1_Cporting.py
Created March 15, 2016 08:55
PMLのポーティング(20160315)
#! coding:utf-8
"""
fdtd_3d.py
日本音響学会 サイエンスシリーズ14
「FDTD法で視る音の世界」 付録DVD
fdtd_3d_c_sjis.cのpython翻訳
所管
x->i
y->j
z->k
@peace098beat
peace098beat / fdtd_2d_c_sjis.c
Last active February 8, 2020 13:24
[FDTD] FDTDによる音の可視化 C->pythonにポーティング
// 二次元音響FDTDサンプル for C (by Masahiro TOYODA)
// gnu gcc -> gcc fdtd_2d_c_sjis.c -lm -O3 -fopenmp -o fdtd_2d_c_sjis.exe
// intel c -> icc fdtd_2d_c_sjis.c /O3 /Qopenmp
//■■■ヘッダーの読み込み■■■
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@peace098beat
peace098beat / fdtd_3d_v1.py
Created March 14, 2016 08:32
fdtd_3d_v1.py
#!coding:utf-8
"""
fdtd_3d_v1.py
OpenAcousticsのサンプルコード
"""
import os
from time import sleep
from scipy import *
from mpl_toolkits.mplot3d import axes3d
@peace098beat
peace098beat / FDTD.html
Last active March 14, 2016 08:32
FDTD.html
<!-- ver 2.0 : 2016/03/14 -->
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ["\\(","\\)"]] } });
</script>
#!/usr/bin/python
class List(list):
def dup(self):
def _dup(lst,ancestors):
for orig,copy in ancestors:
if lst == orig:
return copy
copy = lst[:]
_ancestors = ancestors+[(lst,copy)]
for i,x in enumerate(copy):
@peace098beat
peace098beat / api_json_load.py
Created March 2, 2016 05:43
[Ajax + Python CGI] python cgi でjsonを扱う
#!C:\Anaconda2_32bit\python.exe
# -*- coding: utf-8 -*-
import cgitb
cgitb.enable()
import cgi
import os
import sys
import json
@peace098beat
peace098beat / csv_write.py
Created December 22, 2015 00:42
[Python] CSVのかきだし 
def save(self, filename=None):
"""
評価結果をcsvで保存する
"""
if filename is None:
filename = 'result.csv'
filename_ = os.path.normpath(filename)
# OSを判定し、文字コードを取得
@peace098beat
peace098beat / tasktray_app.py
Created December 21, 2015 05:30
[PySdie] 何もしないタスクトレイアプリケーション
#! coding:utf-8
"""
tasktray_app
何もしないタスクトレイアプリケーション
http://moco.sakura.ne.jp/python/pyside-でタスクトレイアプリケーション作成/
Created by 0160929 on 2015/12/21 14:16
"""
@peace098beat
peace098beat / PyAudio-Controll.py
Created December 10, 2015 22:01
PyAudioのVolumeをコントロール
from numpy import frombuffer, dtype, asarray, iinfo
def byteToPCM(data, sample_width):
d_type = 'float'
if sample_width == 2:
d_type = 'short'
return frombuffer(data, dtype=d_type)
@peace098beat
peace098beat / Pair-Evaluation_UI_.py
Created December 2, 2015 13:48
[一対比較評価] ver0.1たたき台を作成
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UI_.ui'
#
# Created: Wed Dec 02 20:53:11 2015
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui