Skip to content

Instantly share code, notes, and snippets.

"""
#python 2.x
"""
import numpy as np
import math
import matplotlib.pyplot as plt
class Point:
@sungyongchoi
sungyongchoi / mouse move win32
Created December 15, 2016 04:53
비주얼 스튜디오 2015, 윈도우즈 32 API 프로그래밍, 마우스 클릭 상태에서 원 이동 시키기
// MouseMove.cpp : 응용 프로그램에 대한 진입점을 정의합니다.
// 출처 : 윈도우즈 32 API 프로그래밍
#include "stdafx.h"
#include "MouseMove.h"
#include <math.h>
#define MAX_LOADSTRING 100
#define SIZE 40
@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 창
@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 / 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
#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
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)
@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
@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