Skip to content

Instantly share code, notes, and snippets.

@sungyongchoi
sungyongchoi / draw.py
Last active February 5, 2016 04:27
Draw X,Z coordinates value throu MatPlotLib
import matplotlib.pyplot as plt
import csv
x=[]
z=[]
f= open("data.csv")
#append values to list
for row in csv.reader(f):
x.append(row[0])
z.append(row[1])
@sungyongchoi
sungyongchoi / rotate.py
Last active February 11, 2016 08:38
rotate points
import math
def rotate_vector(v, angle, anchor):
"""Rotate a vector `v` by the given angle, relative to the anchor point."""
x, y = v
x = x - anchor[0]
y = y - anchor[1]
# Here is a compiler optimization; inplace operators are slower than
# non-inplace operators like above. This function gets used a lot, so
@sungyongchoi
sungyongchoi / rotate and draw plot.py
Last active February 12, 2016 04:36
rotate points and draw plot
import matplotlib.pyplot as plt
import csv
import math
def rotate_vector(v, angle, anchor):
"""Rotate a vector `v` by the given angle, relative to the anchor point."""
x, y = v
x = float(x) - anchor[0]
y = float(y) - anchor[1]
# Here is a compiler optimization; inplace operators are slower than
@sungyongchoi
sungyongchoi / plot_click_rotate.py
Last active June 17, 2016 05:48
Plot and after click, rotate plot.
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import matplotlib.cbook as cbook
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
import Tkinter as Tk
import tkFileDialog
import os
import csv
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
import Tkinter as Tk
import tkFileDialog
import os
import csv
freqs = np.arange(2, 20, 3)
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import matplotlib.cbook as cbook
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
import Tkinter as Tk
import tkFileDialog
import os
import csv
#python 3.x
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import matplotlib.cbook as cbook
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Button, Cursor
import tkinter as Tk
from tkinter import filedialog
import os
@sungyongchoi
sungyongchoi / hextodouble.py
Last active July 8, 2016 07:01
Read hexa data and covert to double in binary file
# python 3.x
from types import *
import struct
from struct import unpack
import numpy as np
import binascii
import functools
import sys
@sungyongchoi
sungyongchoi / Least Square Line .py
Created July 15, 2016 07:03
Least Square Line through Python
# python 3.0
import numpy as np
import matplotlib.pyplot as mpl
x = np.array([1, 2, 3, 4, 5])
y = np.array([2, 5, 3, 8, 7])
A = np.vstack([x, np.ones(len(x))]).T
m, c = np.linalg.lstsq(A, y)[0]
@sungyongchoi
sungyongchoi / mouse draw
Created December 14, 2016 07:06
비주얼 스튜디오 2015, MFC, 마우스 사용하여 선 그리기
// http://stoned.8m.com/Source/MFC/mousedraw.html
// ChildView.h : CChildView 클래스의 인터페이스
//
#pragma once
// CChildView 창