text
string
''' root/codes/utilities/simgan_fid_metric.py Frechet Inception Distance metric to be used for simgan performance https://machinelearningmastery.com/how-to-implement-the-frechet-inception-distance-fid-from-scratch ''' ### packages import os import glob import numpy as np import scipy.linalg import torch from torchvis...
<reponame>SallyDa/typhon # -*- coding: utf-8 -*- """Functions directly related to atmospheric sciences. """ import numpy as np from scipy.interpolate import interp1d from . import constants from . import math from .physics import thermodynamics from typhon.utils import deprecated __all__ = [ 'iwv', 'moist_...
<reponame>HopefulRational/DeepCaps from keras.utils import to_categorical import numpy as np def load_cifar10(): from keras.datasets import cifar10 (x_train, y_train), (x_test, y_test) = cifar10.load_data() x_train = x_train.reshape(-1, 32, 32, 3).astype('float32') / 255. x_test = x_test.reshape(-1, 3...
<reponame>abael/eli5 # -*- coding: utf-8 -*- from __future__ import absolute_import from functools import partial import re from singledispatch import singledispatch from typing import Any, Dict, List, Tuple import numpy as np # type: ignore import scipy.sparse as sp # type: ignore from xgboost import ( # type: ign...
<filename>scripts/statistics/eucdist_correlation_clustering_metrics.py #!/usr/bin/env python3 # Written by <NAME> (<EMAIL>) on 22 Jul 2021 # This script processes the output from the script "metrics_generation.py" and # determines the Euclidean distance of pipelines to the reference mock community, # the correaltion ...
<reponame>mingyuan-zhang/mmhuman3d import os from typing import List import cv2 import numpy as np import scipy.io as sio from tqdm import tqdm from mmhuman3d.core.cameras.camera_parameters import CameraParameter from mmhuman3d.core.conventions.keypoints_mapping import convert_kps from mmhuman3d.data.data_structures....
from scipy.stats import entropy, ks_2samp, kstest, anderson import numpy as np EPSILON = 10e-10 # ############################################### # # ##### Distribution Metrics for Testing G: ##### # # ############################################### # def calc_Dkl(true_samples, generated_samples, bin_num=100): ...
<gh_stars>0 import os import h5py import json import numpy as np import pandas as pd import scipy.signal as spsig from tqdm import tqdm def get_trn_val_tst(target_root_dir, cv, setname): int2name = np.load(os.path.join(target_root_dir, str(cv), '{}_int2name.npy'.format(setname))) int2label = np.load(os.path.jo...
<reponame>Saibaba-Alapati/Cirq<filename>cirq-core/cirq/ops/swap_gates_test.py # Copyright 2019 The Cirq Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.o...
<filename>numeric_eig.py<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Mon Feb 4 10:44:37 2019 @author: <NAME> """ import numpy as np from scipy import linalg def numeric_eig(A, eigvecs=True, hyp_corr=True): ''' Computes real numerical eigenvalues `Lam` and eigenvectors `K` of matrix `A`:: ...
import networkx as nx import numpy as np import matplotlib.pyplot as plt from random import randint,random import networkx as nx import matplotlib.pyplot as plt import torch import pickle,os,math import scipy.sparse as sparse from collections import Counter from matplotlib.ticker import MaxNLocator from sklearn.cluster...
from __future__ import print_function, division import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np import scipy.integrate as solver plt.style.use("classic") delta = 10.0 roh = 28.0 beta = 8/3 def lorenz_rhs(y, t): x, y, z = y[0], y[1], y[2] return np.array([ de...
#!/usr/bin/python3 import numpy as np from scipy.linalg import null_space import tensorflow as tf import networkx as nx import matplotlib.pyplot as plt import os, sys # Delete all flags and reset graph ---------- # Also make tensorflow shut up # TODO: make fun of Santiago's IDE next week # TODO: get made fun of for w...
<reponame>pernici/sympy """rename this to test_assumptions.py when the old assumptions system is deleted""" from sympy.core import symbols from sympy.assumptions import Assume, global_assumptions, Predicate from sympy.assumptions.assume import eliminate_assume from sympy.printing import pretty from sympy.assumptions.as...
#!/usr/bin/env python """ Generic python script. """ __author__ = "<NAME>" import glob import os import numpy as np import healpy as hp import scipy.stats import scipy.interpolate import scipy.ndimage import simple_adl.query_dl import simple_adl.projector #-----------------------------------------------------------...
import math import heapq import numpy as np import scipy.sparse as sp from opendr.topology import get_vert_connectivity, get_vertices_per_edge from menpo.shape import PointCloud, TriMesh from menpo3d.vtkutils import trimesh_from_vtk, trimesh_to_vtk, VTKClosestPointLocator from vtk.util.numpy_support import vtk_to_nu...
import librosa import matplotlib.pyplot as plt import librosa.display import os import json from copy import deepcopy from matplotlib import cm from numpy.linalg import norm import threading import collections import time import numpy as np import pandas as pd import scipy from scipy import stats from matplotlib.widget...
# Main function for black box learning #<NAME>, 2015 from sklearn.externals import joblib from sklearn import linear_model, naive_bayes, neighbors, cross_validation, feature_selection from sklearn import metrics, ensemble, decomposition, preprocessing, svm, manifold, mixture, neural_network from sklearn import cross_de...
<filename>EL_plots.py """ #!/usr/bin/env python # coding: utf-8 <NAME>, University of Toronto, Department of Physics. June 2020 Ekman layer post-processing. """ import os import pathlib import numpy as np from scipy.special import erf, erfc, erfi, fresnel import h5py import matplotlib.pylab as plt from dedalus.extr...
import json import math as m import numpy as np import plotly import plotly.graph_objects as go import scipy.misc as sc def result(func): def wrapper(params): fig = go.Figure() coords = np.array( [ [float(x) for x in pair.split()] for pair in params["co...
<reponame>manuelbrack/SPFlow """ Created on March 20, 2018 @author: <NAME> """ import numpy as np from sklearn.cluster import KMeans from spn.algorithms.splitting.Base import split_data_by_clusters, clusters_by_adjacency_matrix import logging logger = logging.getLogger(__name__) _rpy_initialized = False def init_...
from typing import Optional, Tuple, Union import numpy as np import pandas as pd import scipy as sp from sklearn import model_selection class FoldGenerator: """ pd.DataFrameをn_split文だけ分割する、class """ def __init__( self, targets: Union[pd.DataFrame, pd.Series], ...
from sympy.combinatorics import Permutation, symmetric from sympy.interactive import init_printing S = [4,0,1,3,2] P = Permutation(S) print(f"Direction Notation:\n{P.list()}") print(f"\nOne Line Notation:\n{P}") print(f"\nNumber of Permutations:{P.cardinality}") print(f"\nIs Even: {P.is_even}") print(f"Is Odd: {P.is_o...
<reponame>hansheng0512/Scanned-document-classification-using-deep-learning import warnings warnings.filterwarnings("ignore") import shutil import os import tarfile import pandas as pd import matplotlib import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pickle from sklearn.manifol...
<filename>mapgenmain.py # -*- coding: utf-8 -*- """ Created on Fri Dec 8 22:47:38 2017 @author: Bri """ import numpy as np import random import math from tkinter import * from PIL import Image, ImageDraw, ImageTk def lerp(t,a,b): return a + t * (b - a) def smoothcurve(t): return t * t * (3...
<gh_stars>10-100 import torch import torch.nn as nn import numpy as np import scipy try: from torchdiffeq import odeint class OdeintWrapper(nn.Module): def __init__(self, model): super(OdeintWrapper, self).__init__() self.model = model self.nfe = 0 def for...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 31 16:26:50 2019 @author: riccardo """ import nibabel as nib import numpy as np from torch.utils.data import Dataset import torch, torchvision, os, MUNet, tqdm, warnings from scipy.ndimage.morphology import binary_fill_holes from skimage.measure imp...
# -*- coding: utf-8 -*- # %% #!/usr/bin/env python # # Copyright (c) 2021, <NAME> # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # # CHILI 1.0 # # plot_example.py (generates an example figures) # # If you are...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Apr 25 16:34:23 2020 @author: <NAME> Neighbourhood Analysis HeatMap """ from scipy.cluster.hierarchy import dendrogram, linkage import seaborn as sns def nn_interaction_heatmap (adata, neighbourhood_result): """ Parameters ---------...
<reponame>usgs/geomag-algorithms<gh_stars>10-100 """Algorithm that produces Solar Quiet (SQ), Secular Variation (SV) and Magnetic Disturbance (DIST). Algorithm for producing SQ, SV and DIST. This module implements Holt-Winters exponential smoothing. It predicts an offset-from-zero plus a "seasonal" cor...
<filename>Vol2B/scipyoptimize/rosenbrock.py # Code obtained from http://matplotlib.1069221.n5.nabble.com/How-to-shift-colormap-td18451.html #Modified and used to shift color map on Rosenbrock function import math, copy import numpy from matplotlib import pyplot, colors, cm import scipy as sp from mpl_toolkits.mplot3d ...
import json import logging import numpy as np import pandas as pd import umap from scipy import sparse as sp from tqdm import tqdm import config as cfg from utils import ProductEncoder, get_shard_path, make_coo_row logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(message)s", handlers=[log...
import sympy.physics.mechanics as _me import sympy as _sm import math as m import numpy as _np q1, q2, u1, u2 = _me.dynamicsymbols('q1 q2 u1 u2') q1_d, q2_d, u1_d, u2_d = _me.dynamicsymbols('q1_ q2_ u1_ u2_', 1) l, m, g = _sm.symbols('l m g', real=True) frame_n = _me.ReferenceFrame('n') frame_a = _me.ReferenceFrame('a...
import datetime, numpy, scipy, pandas import matplotlib.pyplot as plt df = pandas.read_table("/Users/elee/temperature_data.txt", sep=",", header=0, index_col=0, parse_dates=True) print df.columns print df["temp"] minutes = df.temp.resample("1T", how="mean") df.temp.plot(kind="line") plt.show()
# -*-coding:utf-8 -*- import numpy as np from scipy import interpolate import pylab as pl x=np.linspace(0,10,11) #x=[ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.] y=np.sin(x) xnew=np.linspace(0,10,101) pl.plot(x,y,"ro") for kind in ["nearest","zero","slinear","quadratic","cubic"]:#插值方式 #"nearest","zero"...
# modified mexican hat wavelet test.py # spectral analysis for RADAR and WRF patterns # NO plotting - just saving the results: LOG-response spectra for each sigma and max-LOG response numerical spectra # pre-convolved with a gaussian filter of sigma=10 import os, shutil import time, datetime import pickle imp...
<gh_stars>0 import os import numpy as np import scipy.io as sio DEFAULT_FOLDER = 'DataBase/HadamardMatrix/' def load_hadamard_matrix(n, folder_name=DEFAULT_FOLDER): """ Loads or creates Hadamard matrix with given input dimention n and normalizes it such that H'H=I """ fname = os.path...
<gh_stars>0 # -*- coding: utf-8 -*- """ .. _plot_source_alignment: Source alignment and coordinate frames ====================================== This tutorial shows how to visually assess the spatial alignment of MEG sensor locations, digitized scalp landmark and sensor locations, and MRI volumes. This alignment proc...
<gh_stars>0 """ Factorize_laplacian.py Factorizes Laplacian for Hartree calculations """ from scipy.sparse.linalg import splu def factorize_laplacian(self, DISP): if DISP is True: print(" Factorizing Laplacian ... \n") LU = splu(self.elap, permc_spec="NATURAL") self.L_lap = LU.L se...
# -*- coding: utf-8 -*- """ Created on Tue Mar 9 23:12:04 2021 @author: <NAME> """ # ENSEMBLE PREDICTION AND REPORT GENERATION ###################################################################### # MODULE/PACKAGE IMPORT import pandas as pd import numpy as np import math import matplotlib.pyplot as plt from sklea...
<reponame>woqls22/MakeUpProject<filename>Util.py import dlib import cv2 import numpy as np from PIL import Image import math import os from PIL import ImageFilter from scipy.spatial import distance os.environ["KERAS_BACKEND"] = "tensorflow" MAKE_TRANSPARENT = True def draw_line(img, L): for i in range(len(L)-1): ...
<reponame>mattblasa/ML_Master import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.metrics import confusion_matrix, precision_score, classification_report, roc...
<reponame>hortinstein/NOSETEST #!COMMENT Warmup Exercise #4 def sum(arg): total = 0 for val in arg: total += val return total # Understanding Test Output # That was a very simple example where everything passes, so now you’re going to try a failing test and interpret the output. # sum() should be ...
<filename>csem/meshing.py import pyvtk import numpy as np from scipy.spatial import Delaunay def generate_spherical_shell(): vertices = np.array([[0,0,0], [2,0,0], [2,2,0], [0,2,0], [0,0,12], [...
""" Gaussian copula mutual information estimation. | **Authors** : <NAME> | **Original code** : https://github.com/robince/gcmi | **Reference** : | RAA Ince, <NAME>, <NAME>, <NAME>, <NAME> and <NAME> "A statistical framework for neuroimaging data analysis based on mutual information estimated via a Gaussian copula" Hu...
<reponame>bilgelm/NiMARE<gh_stars>0 """ Image-based meta-analysis estimators """ from __future__ import division from os import mkdir import os.path as op from shutil import rmtree import numpy as np import nibabel as nib from scipy import stats from nipype.interfaces import fsl from nilearn.masking import unmask, ap...
import os import io import sys import shutil import osgeo.gdal as gdal import subprocess import tempfile import urllib import scipy.interpolate import pyproj import numpy as np from itertools import product import boto3 import botocore def mercator(lat, lon, zoom): """Convert latitude, longitude to z/x/y tile coo...
<gh_stars>0 # -*- coding: utf-8 -*- # @Time : 2021/5/30 # @Author : <NAME> import numpy as np from scipy.sparse import csc_matrix, dok_matrix from scipy.sparse.linalg import splu, cg from sksparse.cholmod import cholesky # from scipy.sparse import save_npz, load_npz # import line_profiler class Edge(...
<filename>examples/rs_code_example.py import serdespy as sdp import numpy as np import time import skrf as rf import scipy as sp import matplotlib.pyplot as plt #create data input data_in = sdp.prbs20(1); #encode data with RS-KP4 data_in_int = sdp.bin_seq2int_seq(data_in) kp4 = sdp.RS_KP4() data_in_enc_int = np.arr...
__author__ = 'sibirrer' #this file contains a class to make a gaussian import numpy as np import scipy.special import scipy.integrate as integrate from lenstronomy.LensModel.Profiles.gaussian_potential import Gaussian from lenstronomy.LensModel.Profiles.base_profile import LensProfileBase __all__ = ['GaussianKappa'] ...
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- # $File: ltsd.py # $Date: Sun Jul 19 17:53:59 2015 +0800 # $Author: <NAME> <zxytim[at]gmail[dot]com> import sys from scipy.io import wavfile # import matplotlib # matplotlib.use("Qt4Agg") # import matplotlib.pyplot as plt import numpy as np from pyssp.vad.ltsd...
import numpy as np from scipy.interpolate import interp1d import matplotlib import matplotlib.pyplot as plt from Make_Timelist import * import sys sys.path.insert(0, '/tera/phil/nchaparr/python') import nchap_fun as nc from matplotlib.lines import Line2D from matplotlib import rcParams rcParams.update({'font.size': 10...
<gh_stars>10-100 # -*- coding: utf-8 -*- """ Created on Tue Apr 14 20:41:09 2015 @author: oliver """ import numpy as np from sympy import symbols import mubosym as mbs ############################################################### # general system setup example myMBS = mbs.MBSworld('planetary_char', connect=True, ...
<filename>ba/eval.py import ba.utils from functools import lru_cache as cache import ba.plt import copy from matplotlib import pyplot as plt import numpy as np import skimage.transform as tf from scipy.ndimage import distance_transform_cdt from scipy.misc import imread from tqdm import tqdm def extract_mean_evals(ite...
import datetime import json import logging import os import time import traceback import uuid from fractions import Fraction from logging.handlers import TimedRotatingFileHandler from threading import Thread from time import sleep from typing import Any import cv2 import numpy as np import picamera CONFIG_FILE = 'cam...
from load import ROOT as R import gna.constructors as C import numpy as N from collections import OrderedDict from gna.bundle import * from scipy.interpolate import interp1d class reactor_anu_corr_v01(TransformationBundleLegacy): debug = False def __init__(self, *args, **kwargs): super(reactor_anu_cor...
<reponame>sylwekczmil/sevq<filename>research/generated.py from collections import defaultdict from matplotlib import pyplot as plt import numpy as np import pandas as pd from evq.algorithm import EVQ from matplotlib.image import imread from scipy.stats import pearsonr from sklearn import preprocessing from sklearn.dat...
<reponame>brucedispassion/qikify import pandas import numpy as np from scipy.stats.stats import kurtosis from scipy import c_, r_ from qikify.helpers.identify_outliers import identify_outliers from qikify.controllers.KNN import KNN from qikify.controllers.KDE import KDE from qikify.controllers.LSFS import LSFS from q...
<filename>test2.py import dlib import cv2 from keras.models import load_model from keras.preprocessing.image import img_to_array from scipy.spatial import distance as dist import imutils from imutils import face_utils import matplotlib.pyplot as plt import numpy as np import pymongo import datetime client = pymongo.Mo...
<reponame>ucgmsim/Pre-processing<filename>SrfGen/NHM/plot_nhm_outputs.py<gh_stars>1-10 #!/usr/bin/env python from argparse import ArgumentParser from glob import glob import json import math import os from shutil import copy, rmtree from subprocess import call from tempfile import mkdtemp import yaml from h5py import...
import numpy as np from scipy.sparse import lil_matrix as sp_matrix from .metrics import * def laplacian_matrix(mesh): n = mesh.num_vertices #e = np.c_[mesh.faces[:,:2], mesh.faces[:,1:], mesh.faces[:,2], mesh.faces[:,0]] e = mesh.edges A = sp_matrix((n, n)) A[e[:,0], e[:,1]] = 1 A[e[:,1], e[:...
<filename>src/find_boundary.py import numpy as np import os from PIL import Image import utils from scipy.ndimage import binary_erosion, binary_dilation from scipy.ndimage.measurements import label import matplotlib.pyplot as plt PROJECT_ROOT = utils.get_project_root() DATA_DIR = os.path.join(PROJECT_ROOT, "input") ...
<gh_stars>100-1000 # LICENSE: Simplified BSD https://github.com/mmp2/megaman/blob/master/LICENSE # -*- coding: utf-8 -*- """ Created on Tue Jun 21 11:11:40 2016 @author: wang1 """ from __future__ import division import numpy as np import warnings from scipy.sparse import isspmatrix def nystrom_extension(C, e_vec, e_v...
#!/bin/env python # Copyright (c) 2013, 2018 National Technology and Engineering Solutions of Sandia, LLC . Under the terms of Contract # DE-NA0003525 with National Technology and Engineering Solutions of Sandia, LLC, the U.S. Government # retains certain rights in this software. """ Compute a timeseries model data f...
<reponame>grahamgower/moments # -*- coding: UTF-8 -*- import numpy as np import time import scipy.stats as stats import moments import dadi #------------- # Parameters : #------------- n1 = 20 n2 = 25 pts = 100 s = 0.25 T = 1.0 Ts = 0.1 nuB = 1.1 nuF = 3.0 nuPre = 1.0 TPre = 10 m = 1.0 m2 = 2.0 #params = (nuB,nuF,T...
<filename>client/python/loss_nndemo1.py import numpy as np from scipy.optimize import check_grad ## Two-layer NN with ReLU # Two-layer NN, with 200 units per layer with ReLu ai = max(0,oi) # X - (W01) - Layer1 - (W12) - Layer2 - (W23) - Output # ((D+1)*nh) + ((nh+1)*nh) + ((nh+1)*K) nh = 200 def getAvgGradient(w, X,...
<filename>mediaeval_nosplitpred.py import time import string import pickle import itertools import numpy as np import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer, TfidfTransformer from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import train_test_s...
<filename>sparse_weights.py import numpy as np import scipy.sparse as sp import math """ create sparse coo matrix of specified size and density, filled with gaussian values of given mean and std diag=False sets the diagonal to zero """ def sparse_weights(n_rows, n_columns='same', ...
<filename>yamtbx/util/xtal.py """ (c) RIKEN 2015. All rights reserved. Author: <NAME> This software is released under the new BSD License; see LICENSE. """ """ NOTE on unit cell constraints determination: XDS doesn't handle "real" rhombohedral space group (right?). So, No need to support R3 or R32. They are hand...
''' Multiple composite SIR models. This is the simulation of two overlapping and time-unbounded SIR models, A and B. Model B starts with a random time delay and one of its parameters (gamma) random. ''' import os from dotmap import DotMap from scipy.stats import gamma, uniform from pram.entity import Group, GroupS...
import random import numpy as np from sklearn.decomposition import PCA from sklearn.cluster import KMeans from sklearn.metrics import adjusted_rand_score from scipy.linalg import fractional_matrix_power def load(verbose=False): with np.load('dimredux-challenge-01-data.npz') as fh: data_x = fh['data_x'] ...
<reponame>robert-anderson/pyscf from __future__ import print_function, division import numpy as np from numpy import array, argmax, einsum, require, zeros, dot from timeit import default_timer as timer from pyscf.nao import tddft_iter from pyscf.nao import gw from scipy.linalg import blas from pyscf.nao.m_pack2den impo...
"""Functions to convert between quantities and fit DCE-MRI data. Created 28 September 2020 @authors: <NAME> @email: <EMAIL> @institution: University of Edinburgh, UK Functions: sig_to_enh enh_to_conc conc_to_enh conc_to_pkp enh_to_pkp pkp_to_enh volume_fractions minimize_global """ i...
#!/usr/bin/env python """ Artificial Intelligence for Humans Volume 2: Nature-Inspired Algorithms Python Version http://www.aifh.org http://www.jeffheaton.com Code repository: https://github.com/jeffheaton/aifh Copyright 2014 by <NAME> Licensed under the Apache License, Version 2....
<filename>Backend/flask_main.py from flask import Flask from flask import jsonify import requests as r import json # import distance from sklearn.feature_extraction.text import CountVectorizer from scipy.spatial.distance import jaccard app = Flask(__name__) api_key = 'DEMO_KEY' cache_dict = {} @app.route("/compare/...
# some snippets of code to show how one might # get initial trace and wavecal files for APO instruments import copy import numpy as np import os import pickle import pdb import yaml import matplotlib.pyplot as plt from pyvista import imred from pyvista import image from pyvista import spectra from pyvista import tv fr...
import warnings import scipy import numpy as np def svd_fun(matrix, n_eigenvecs=None): """Computes a fast partial SVD on `matrix` If `n_eigenvecs` is specified, sparse eigendecomposition is used on either matrix.dot(matrix.T) or matrix.T.dot(matrix). Parameters ---------- matrix : tensor ...
"""PyTorch Module and Function for scalar wave Born propagator.""" import torch import numpy as np import scipy.signal import deepwave.base.propagator class BornPropagator(deepwave.base.propagator.Propagator): """PyTorch Module for scalar wave Born propagator. See deepwave.base.propagator.Propagator for desc...
<gh_stars>1-10 """ File containing the model classes for the project """ import random from enum import Enum from noise import pnoise2 from cmath import pi as PI from math import sqrt CLAMP = lambda n, minn, maxn: max(min(maxn, n), minn) class Point(complex): """ This class describes a 2D point based on the...
#!/usr/bin/env python3 # Import modules from scipy import optimize import numpy as np import sys, os import pandas as pd import collections import itertools import argparse import re # Define functions def sWrite(string): sys.stdout.write(string) sys.stdout.flush() def sError(string): sys.stderr.write(s...
<filename>examples/aeronet_wrf_comparison/aeronet_wrf_domain_comparison.py import climpy.utils.aeronet_utils as aeronet from shapely.geometry.polygon import Polygon import netCDF4 import numpy as np import climpy.utils.wrf_utils as wrf_utils import climpy.utils.grid_utils as grid import pandas as pd import matplotlib.p...
<filename>nuplan/database/nuplan_db/utils.py<gh_stars>0 from __future__ import annotations import logging import math from bisect import bisect_right from functools import reduce from typing import Dict, List, Optional, Tuple, Union import cv2 import geopandas as gpd import matplotlib.pyplot as plt import numpy as np...
<reponame>wilson1yan/planet # Copyright 2019 The PlaNet Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
<gh_stars>1-10 """ Trains an agent with Deep Q Learning or Double DQN on Breakout. Uses OpenAI Gym. """ import sys import os sys.path.insert(0,os.path.expanduser('~/Library/Python/2.7/lib/python/site-packages/')) import numpy as np import cPickle as pickle import gym from optparse import OptionParser import itertools...
'''Give the input expression as a string and it'll ask for required values itself''' from sympy import * def error(exp): ex = sympify(exp) var_count = int(input('No. of variables in the eq: ')) var = [] m = 0 while m < var_count: m += 1 a = input("variable in the expressio...
# -*- coding: utf-8 -*- """Module containing functionality for conjugate gradients. Conjugate gradients is motivated from a first order Taylor expansion of the objective: .. math:: f(\\theta_t + \\alpha_t d_t) \\approx f(\\theta_t) + \\alpha_td_t^Tf'(\\theta_t). To locally decrease the objective, it is optimal t...
<gh_stars>1-10 """ Predict rainfall for the CIKM 2017 Competition """ import numpy as np from scipy.stats import entropy from sklearn.model_selection import KFold from sklearn import metrics, ensemble, neighbors from sklearn.externals import joblib from sklearn.decomposition import PCA import xgboost as xgb # import pa...
""" ------------------------------------------------------------------------------- Created: 11.02.2021, 12:40 ------------------------------------------------------------------------------- Author: <NAME> Email: <EMAIL> Website: https://becuriouss.github.io/matthieu-scherpf/ Project page: tba -------------------------...
"""FetchPickAndPlace with Rotating Table FetchPickAndPlace and its assets are part of OpenAI Gym, licensed under MIT. """ import os import gym import numpy as np import scipy.integrate from gym import utils from gym.envs.robotics import fetch_env, rotations _ASSETS_PATH = os.path.join(os.path.dirname(os.path.realpat...
#!/usr/bin/env python3 import itertools import numpy import scipy.optimize def step(x): return (x>0) def overlap_cross(m,c): return c*m+numpy.roll(m,1)+numpy.roll(m,-1) def overlap_eq(m, xi, c, V, R, b): return V*m-numpy.sum(xi*step(xi@(V*overlap_cross(m,c)+b)).reshape((R,1)), axis=0)/R def mean_rate(...
<reponame>laqua-stack/lifelines # -*- coding: utf-8 -*- """ Below is a re-implementation of Royston, Clements and Crowther spline models, <NAME>, <NAME>, <NAME>. A flexible parametric accelerated failure time model. """ from autograd import numpy as np from lifelines.fitters import ParametricRegressionFitter from life...
<gh_stars>0 # AUTOGENERATED! DO NOT EDIT! File to edit: seamcarving.ipynb (unless otherwise specified). __all__ = ['seam_removal'] # Cell import numpy as np from PIL import Image import matplotlib.pyplot as plt import numba from pathlib import Path from scipy import ndimage import PIL from skimage.transform import r...
""" The :mod:`sklearn.compose._column_transformer` module implements utilities to work with heterogeneous data and to apply different transformers to different columns. """ # Author: <NAME> # <NAME> # License: BSD import numpy as np from scipy import sparse from ..base import clone, TransformerMixin from ..e...
''' Usage: python detect_canny_edges image_name sigma percentile_high percentile_low Example: python detect_canny_edges book_gray.png 0.2 80 40 ''' import numpy as np import cv2 as cv from scipy.ndimage import filters import sys import os #for the recursion in hysteresis thresholding step sys.setrecursionlimit(4...
# -*- coding: utf-8 -*- import numpy as np import scipy.constants as const import astropy.units as u from copy import deepcopy from scipy.linalg import lstsq from poppy.fresnel import FresnelWavefront, QuadraticLens class PhysicalFresnelWavefront(FresnelWavefront): """ This class extends the capabilities of...
from collections import Counter from sklearn.feature_extraction import DictVectorizer from sklearn.feature_extraction.text import TfidfTransformer from scipy.sparse import hstack import itertools import kindred def _doEntityTypes(candidates,entityCount): data = [] for cr in candidates: assert isinstance(cr,kindr...
<filename>sympy/physics/quantum/circuitplot.py """Matplotlib based plotting of quantum circuits. Todo: * Optimize printing of large circuits. * Get this to work with single gates. * Do a better job checking the form of circuits to make sure it is a Mul of Gates. * Get multi-target gates plotting. * Get initial and f...
from sympy.core.sympify import sympify def series(expr, x=None, x0=0, n=6, dir="+"): """Series expansion of expr around point `x = x0`. See the doctring of Expr.series() for complete details of this wrapper. """ expr = sympify(expr) return expr.series(x, x0, n, dir)
#!/usr/bin/env python import numpy as np import astropy.io.fits as pyfits import matplotlib.pyplot as plt import specter.psf import sys import argparse import string import os.path from scipy.signal import fftconvolve def readpsf(filename) : try : psftype=pyfits.open(filename)[0].header["PSFTYPE"] e...
<filename>helpers.py # IMPORTS import numpy as np import matplotlib.pyplot as plt import sklearn from sklearn.metrics.pairwise import euclidean_distances from scipy.stats import norm from sklearn.preprocessing import MinMaxScaler from sklearn.utils import check_array, check_random_state, shuffle from sklearn import d...