본문 바로가기

전체 글43

공공데이터 GIS Dataset 연구를 위해 GIS 데이터가 필요할 때가 있다. 리스트는 지속적으로 업데이트할 예정이다. 1. 국토부 데이터셋 오픈마켓: data.nsdi.go.kr/dataset 데이터셋 - 오픈마켓 국토지리정보원 지형의 고도값을 수치로 저장함으로써 지형의 형상을 나타내는 지도 IMG 조회수: 21551 data.nsdi.go.kr 2. 공공데이터 포털: www.data.go.kr/ 공공데이터 포털 국가에서 보유하고 있는 다양한 데이터를『공공데이터의 제공 및 이용 활성화에 관한 법률(제11956호)』에 따라 개방하여 국민들이 보다 쉽고 용이하게 공유•활용할 수 있도록 공공데이터(Datase www.data.go.kr 3. 지방행정인허가데이터: www.localdata.go.kr/ LOCALDATA - 지방행정인허가데이.. 2021. 1. 3.
matplotlib.pyplot 팁: legend box 밖에, 한글 입력 plt.legend(loc='center left', bbox_to_anchor=(1, 0.5)) 참조: https://stackoverflow.com/questions/4700614/how-to-put-the-legend-out-of-the-plot 한글입력: plt.rcParams["font.family"] = 'nanumgothic' plt.rcParams['axes.unicode_minus'] = False 이거 추가해주면됨. 나눔고딕없으면 다른 폰트로 ㄱ 2020. 6. 15.
PCA & TSNE dimension reduction and viz from sklearn.decomposition import PCA from sklearn.manifold import TSNE import matplotlib.pyplot as plt pca = PCA(n_components=2, svd_solver='arpack') X_pca = pca.fit_transform(X) plt.scatter(X_pca[:, 0], X_pca[:, 1]) tsne = TSNE(n_components=2) X_tsne = tsne.fit_transform(X) plt.scatter(X_tsne[:, 0], X_tsne[:, 1]) 이렇게 하면됨. 보통 tSNE는 좀더 오래걸림. 위 결과는 이상해 보이긴한데 보통 PCA를 주로 dimension reduction에 활용하고, .. 2020. 6. 11.
CountVectorizer + pyLDAvis (N-gram LDA) dictionary = gensim.corpora.Dictionary() dictionary.token2id = dict((word, uid) for word, uid in vect.vocabulary_.items()) pyLDAvis를 써서 위와 같이 시각화를 하고싶은데 bigram같은 feature를 뽑고싶은경우가 있을 것이다. sklearn의 CountVectorizer를 쓰면 가능하지만, 이것을 gensim의 라이브러리를 써서 pyLDAvis로 어떻게 변환하는지에 대한 글이 없길래 써본다. 우선 아래의 라이브러리를 import한다. from sklearn.feature_extraction.text import CountVectorizer from gensim.models import LdaMode.. 2020. 6. 10.
Python Pandas Duplication 제거 df.drop_duplicates(['key'], keep='first') 2020. 5. 11.
Python MapBox 지도 visualize import pydeck def viz(mdf): # 2014 locations of car accidents in the UK UK_ACCIDENTS_DATA = ('https://raw.githubusercontent.com/uber-common/' 'deck.gl-data/master/examples/3d-heatmap/heatmap-data.csv') layer = pydeck.Layer( 'ScatterplotLayer', mdf, get_position='[x, y]', auto_highlight=True, elevation_scale=50, pickable=True, elevation_range=[0, 1], extruded=True, get_radius=10, get_fill_color=[.. 2020. 5. 11.
주로 쓰는 좌표계 정리 http://www.localdata.kr/ 여기서 x,y가 쓰는 좌표: TM좌표계 +proj=tmerc +lat_0=38 +lon_0=127.0028902777778 +k=1 +x_0=200000 +y_0=500000 +ellps=bessel +units=m +no_defs +towgs84=-115.80,474.99,674.11,1.16,-2.31,-1.63,6.43 UTM-K (EPSG:5178) +proj=tmerc +lat_0=38 +lon_0=127.5 +k=0.9996 +x_0=1000000 +y_0=2000000 +ellps=bessel +units=m +no_defs +towgs84=-115.80,474.99,674.11,1.16,-2.31,-1.63,6.43 KATEC 카텍좌표계 +pro.. 2020. 4. 8.
Proj Transformer 좌표 변환 from pyproj import Proj, transform inProj = Proj('+proj=tmerc +lat_0=38 +lon_0=127.0028902777778 +k=1 +x_0=200000 +y_0=500000 +ellps=bessel +units=m +no_defs +towgs84=-115.80,474.99,674.11,1.16,-2.31,-1.63,6.43') outProj = Proj(init='epsg:4326') x1,y1 = yldf.iloc[0].x, yldf.iloc[0].y x2,y2 = transform(inProj,outProj,x1,y1) print (y2,',',x2) 간단하게는 이렇게 바꾸거나 from pyproj import Transformer transform.. 2020. 4. 8.
GeoPandas 에서 GeoWithin Query하기 우리가 원하는 범위의 Polygon이 아래와 같은 형태라고 하자. yunnam_large = {'type': 'Polygon', 'coordinates': [[[126.92572992898702, 37.55835818322421], [126.92616538295539, 37.55864227038824], [126.92658623986753, 37.55938810776263], [126.92677406036564, 37.56118120785994], [126.9282886257802, 37.56334452890169], [126.92638553613328, 37.56494713073428], [126.9243245551222, 37.565900883346934], [126.9196036221869, 37... 2020. 3. 17.
dictionary 값으로 정렬하기 for w in sorted(d, key=d.get, reverse=True): print(w, d[w]) 2020. 3. 17.
꿀팁) Pulse Secure Windows 10에서 사용 학교 VPN쓸 때 Pulse Secure 거쳐야 하는 경우가 있는데, 꿀팁인데 잘 모르는 경우가 많은 것 같아서 쓴다. 일단 Microsoft Store를 검색해서 들어가면 Pulse Secure가 있다. 그냥 설치하면 된다. 그럼 VPN 쓸 때 Pulse Secure를 거쳐서 쓸 수 있다. 우리학교는 kvpn.kaist.ac.kr 주소로 하면 된다. 2019. 5. 22.
Apache2 비밀번호 걸기 https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-apache-on-ubuntu-14-04 How To Set Up Password Authentication with Apache on Ubuntu 14.04 | DigitalOcean When setting up a web server, there are often sections of the site that you wish to restrict access to. Web applications often provide their own authentication and authorization methods, but the web ser.. 2019. 5. 22.
웹 브라우저로 Terminal 쓰기: Butterfly 출처: https://github.com/paradoxxxzero/butterfly 설치는 "pip install butterfly"로 끝. 원래 gotty라는 것을 썼는데 End키 같은게 잘 인식 안되는 등의 문제가 조금 있어서 좀더 상위 호완버전인 듯한 butterfly를 써봤다. 우분투 18버전 기준이다. SSL인증은 다음과 같이 한다. 참조: https://paradoxxxzero.github.io/2014/03/21/butterfly-with-ssl-auth.html butterfly now with ssl authentication First of all thanks for all your feedback on butterfly, I never expected this to have such .. 2019. 5. 22.
Understanding and Predicting Image Memorability at a Large Scale Authors: Aditya Khosla MIT khosla@mit.edu Akhil S. Raju MIT araju@mit.edu Antonio Torralba MIT torralba@mit.edu Aude Oliva MIT oliva@mit.edu 흥미로운 키워드는 "memorable and forgettable images have different intrinsic visual features" What are the common visual features of memorable, or forgettable, images? How far we can we go in predicting with high accuracy which images people will remember, or not? .. 2019. 5. 22.
Pulse Secure 사용 법 (Ubuntu 18.04) 여기 글에서 보이는 링크로 다운로드 받으면 된다. https://cis.technion.ac.il/en/central-services/communication/install-pulse-client-linux/ 다만 libwebkitgtk 가 없다고 오류가 날 수 있는데 $ sudo apt-get install libwebkitgtk-1.0 $ sudo dpkg -i ps-pulse-ubuntu-debian.deb 이렇게 설치하고 deb 파일 설치하면 된다. 2018. 9. 29.
MPI Function Dictionary MPI Function의 parameter와 MPI_Datatype, MPI_Reduce functions등을 나름대로 정리한 글입니다. MPI에 더 자세히 정리된 문서는 KISTI Lecture Note를 참고하세요: http://ap2.khu.ac.kr/download/mpi_lec.pdf 또는 각 Function들을 나열한 문서: MPI Routines 참조 Bone functions: - MPI_Init(&argc, &argv) - MPI_Comm_rank(MPI_Comm comm, int *rank) - MPI_Comm_size(MPI_Comm comm, int *size) - MPI_Finalize() MPI_Datatype: - MPI_CHAR: signed char - MPI_SHORT: .. 2016. 10. 4.
KSC 2015 3번 문제 및 풀이 sequential.c#include #include #include #include #include #include float ran2(long *); long iseed=-9; struct timeval tv; float gettime(){ static int startflag = 1; static double tsecs0, tsecs1; if(startflag) { (void ) gettimeofday(&tv, NULL); tsecs0 = tv.tv_sec + tv.tv_usec*1.0E-6; startflag = 0; } (void) gettimeofday(&tv, NULL); tsecs1 = tv.tv_sec + tv.tv_usec*1.0e-6; return (float) (tsecs1 - ts.. 2016. 10. 1.
KSC 2015 2번 문제 및 답안 sequential.c#include #include #include #include #ifndef M_PI #define M_PI 3.14159265358979323846 #endif /* int np = 30, ne = 512; */ int np = 5, ne = 10; // np: number of nodes in each element // ne: number of elements // caution: np 20, ne 256 will take approx 10 minutes on a serial job void interface_flux(double *qq, double *fstar, double *ib, double speed); void rhs(double *qq, double *rr, do.. 2016. 10. 1.
KSC 2015 1번 문제 및 답안 sequential.c#include #include #include double genvv(double x){ return (x*x+pow(x,4)+pow(x,6)+exp(-x*x)+cos(x)+sin(x)+tan(x)); } int main(int argc, char **argv){ int i,n1,n2,j,jsta,jend; int iter,niter; double xi,xf,dx; double tmr; double *ar, *br; /* Do not change */ n1 = 0; n2 = 100000000; niter = 3; /* Do not change */ ar = (double*) malloc(sizeof(double)*n2); br = (double*) malloc(sizeof(doub.. 2016. 10. 1.
KSC 2014 3번 문제 및 답안 sequential.c#include #include #include #include double time_diff(struct timeval t1, struct timeval t2) { double sec1, sec2; sec1 = t1.tv_sec + t1.tv_usec*1e-6; sec2 = t2.tv_sec + t2.tv_usec*1e-6; return sec2-sec1; } int build_house(int nx, int column, int site[]) { int num_sol = 0; bool is_sol; int i, j; // Try to build a house in each line of column for (i=0; i=0; j--) { if ((site[column] == si.. 2016. 10. 1.
KSC 2014 2번 문제 및 답안 sequential.c#include #include #include #include #include #include #include #define THRES 100000000 #define READY_STATE -111 #define WRITING_STATE -222 #define READY_TAG 111 #define NP_TAG 222 #define R_TAG 333 #define RSLT_TAG 444 #define BOX_TAG 555 typedef struct Pos{ float x,y,z; }Pos; double potential(Pos *r, int np, int jsta, int jend, int ista, int iend){ int i,j; double potent = 0; int fi.. 2016. 10. 1.
KSC 2014 1번 문제 및 답안 [문제] 아래에 주어진 편미분 방정식 풀이 방법으로 순차 프로그램이 주어져 있다. 주어진 풀이 방식은 유한차분 (finite-difference) 방법을 활용하는 것이다. 주어진 2차원 공간을 x, y 방향으로 각각 m, n개의 격자를 고려한다. 즉, x 방향으로 i=1,2,3,...,m (또는 0,1,2,...m-1)의 격자가 정의되고, y 방향으로도 j=1,2,3,...,n (또는 0,1,2,...,n-1)처럼 격자가 정의 된다. 2차원 공간은 [0,1] ╳ [0,1]로 주어진다. 여기서 x 방향 경계들, x=0, x=1은 각각 유한 격자 지수 i=1, i=m (또는 i=0, i=m-1)에 해당한다. 마찬가지로 y 방향으로도 동일한 조건을 활용한다. y=0, y=1은 각각 j=1, j=n (또는 j=.. 2016. 10. 1.
KSC 2013 3번 문제 및 답안 sequential.c#include #include #include void advance_field(int nx, int ny, double *f, double *g, double *c) { int i, j, idx; for (i=1; i 2016. 10. 1.
KSC 2013 2번 문제 및 답안 문제 다운로드 문제는 2차 FDM으로 2차 배열을 쪼개어 계산하는 것이다. Exchange Boundary function이 핵심적이라고 볼 수 있다.sequential.c#include #include #include void advance_field(int nx, int ny, double *f, double *g) { int i, j, idx; for (i=1; i 2016. 10. 1.
KSC 2013 1번 문제 및 답안 문제1Simpson 적분공식을 활용한 1차원 정적분 프로그램을 고려한다. 주어진 시작 프로그램(C 또는 FORTRAN)을 병렬화(MPI/OpenMP)시켜서 주어진 시스템에서 적분값과 총 함수 호출 횟수를 출력하시오. 또한, 최대 병렬 효율 성능을 구하시오. 여기서 사용된 Simpson 정적분 공식은 구간 [a,b]에 대한 정적분을 의미하고, n+1개의 함수값을 호출하게 되어 있다. 여기서 n은 짝수 이다. 실제 정적분값은 다음의 수식으로 근사된다. (h/3)[f(x0)+4f(x1)+2f(x2)+....+4f(xn-1)+f(xn)]. 여기서, h=(b-a)/n 이며, xi=a+ih이고, f(x)=4/(1+x2)이다. 주의할 점은 함수 호출을 n+1번만 수행한다. Simpson 적분공식은 검색해보면 이와 같.. 2016. 10. 1.
유한차분법(finite difference method)에서 boundary exchange하기 가로가 n, 세로가 m인 배열 uu (이중배열은 아니고 이중배열처럼 쓰이는 일차 배열)의 boundary에서 정보 교환시void exchange_boundary(int m, int n, double *uu, int nprocs, int myrank){ int i,j; MPI_Request req[4]; MPI_Status stat[4]; if(myrank 0){ MPI_Isend(&.. 2016. 9. 28.
Project Euler #58 (Spiral primes) 문제는 https://projecteuler.net/problem=58 Spiral prime을 계산하여 10% 이하가 될 때를 구한다.간단한 문제이므로 코드에 대한 설명은 생략한다.#include #include #include #define RATIO 10 bool is_prime(int p) { int i; for (i = 2; i 2016. 9. 27.
Project Euler #55 (Lychrel numbers) 문제는 https://projecteuler.net/problem=5550회 이상 palindrome-sum-iteration을 돌려도 palindrome이 나오지 않는 Lychrel numbers에 대한 문제이다.#include #include #define ASIZE 30 #define MITER 50 void deep_copy(int n[], int m[]) { int i; for (i = 0; i = 0; i--) { if (m[i] != 0) { lim = i + 1; break; } } for (i = 0; i <.. 2016. 9. 19.
블록 분할코드 블록 분할 코드 예: Cvoid para_range(int n1, int n2, int nprocs, int myrank, int *ista, int *iend){ int iwork1, iwork2; iwork1 = (n2-n1+1)/nprocs; iwork2 = (n2-n1+1)%nprocs; *ista = myrank*iwork1 + n1 + min(myrank, iwork2); *iend = *ista + iwork1 - 1; if(iwork2 > myrank) *iend = *iend + 1; } 2016. 9. 13.
티스토리 블로그 노출 구글에 노출시키기: http://neogurihouse.tistory.com/11네이버에 노출시키기: http://neogurihouse.tistory.com/18 참고하세요. 2016. 9. 13.