Skip to content

Instantly share code, notes, and snippets.

View lan496's full-sized avatar

Kohei Shinohara lan496

View GitHub Profile
@lan496
lan496 / dist_kdtree.py
Created February 13, 2019 05:42
attempt to calculate distance via KDtree
import math
import itertools
import numpy as np
from scipy.spatial import KDTree
from pymatgen.core.sites import PeriodicSite
def get_kdtree(structure, cutoff):
recp_len = np.array(structure.lattice.reciprocal_lattice.abc)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
from scipy.special import iv
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils.validation import check_is_fitted
class ExpSineSquaredSampler(BaseEstimator, TransformerMixin):
"""
Approximates feature map of an Exp-Sine-Squared kernel by its Fourier series expansion.
Exp-Sine-Squared kernel is given by:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from scipy import sparse
from PIL import Image
class Wave:
def __init__(self, N, a):
import numpy as np
import matplotlib.pyplot as plt
#################################################
F = 8.0
J = 40 # site
dt = 0.05 # 6 hours
dt_forcast = 0.05
delta_TLM = 1e-9
alpha = 3.0 ** 2 # P^a_0 = alpha * I
import numpy as np
import requests
import matplotlib.pyplot as plt
def get_material_id(name):
material_dict = {
'1,1,1,2,3,3,3-Heptafluoropropane (R227ea)': 'C431890',
'1,1,1,2,3,3-Hexafluoropropane (R236ea)': 'C431630',
'1,1,1,3,3,3-Hexafluoropropane (R236fa)': 'C690391',
# -*- coding: utf-8 -*-
import sys
import urllib2
from bs4 import BeautifulSoup
def sample_getter(path, problemId):
directory = path + "/" + str(problemId)
url = "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=" + str(problemId)
html = urllib2.urlopen(url)
soup = BeautifulSoup(html)
set nocompatible
set number
set ruler
set cursorline
set nocursorcolumn
set laststatus=2
set cmdheight=2
set showmatch
set helpheight=999