text
string
<filename>code_testing/test_WDM_splice.py import numpy as np from numpy.testing import assert_allclose,assert_raises,assert_almost_equal import sys from scipy.constants import c, pi sys.path.append('src') from scipy.integrate import solve_ivp from functions import * def specific_variables(N): n2 = 2.5e-20 alpha...
<reponame>nam8/Barry import sys import os import pandas as pd from scipy.interpolate import interp1d from scipy.stats import norm import numpy as np sys.path.append("..") from barry.cosmology.camb_generator import getCambGenerator from barry.postprocessing import BAOExtractor, PureBAOExtractor from barry.config import...
import urllib.request from bs4 import BeautifulSoup from statistics import mode states_dict = { "Alabama" : "https://en.wikipedia.org/wiki/COVID-19_pandemic_in_Alabama", "Alaska" : "https://en.wikipedia.org/wiki/COVID-19_pandemic_in_Alaska", "Arizona" : "https://en.wikipedia.org/wiki/COVID-19_pandemic_in_A...
""" The evaluation module for VA-JCR/VA-JCM models. Only works in Python >= 3.5. Some code is forked from https://github.com/ECHO960/PKU-MMD/blob/master/evaluate.py related to the paper: <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>, "PKU-MMD: A large scale benchmark for continuous multi-modal human action unders...
<reponame>EsmeeHuijten/DESHIMAmodel import matplotlib.pyplot as plt plt.rcParams['animation.ffmpeg_path'] = 'C:/FFmpeg/bin/ffmpeg.exe' from mpl_toolkits.axes_grid1 import make_axes_locatable from scipy import interpolate, optimize import os import math import numpy as np import matplotlib.animation as animation from ma...
<reponame>samtx/pyapprox<filename>pyapprox/cvar_regression.py import numpy as np from scipy import sparse from functools import partial from scipy import integrate def value_at_risk(samples,alpha,weights=None,samples_sorted=False): """ Compute the value at risk of a variable Y using a set of samples. Para...
import torch import numpy as np import scipy.special as sc from scipy.optimize import brentq import ctypes def generate_so3_lebedev(n=26, n_gamma=8): """ @param: (n, n_gamma) grid @return: np.ndarray (n x n_gamma, 3) """ LIB = ctypes.CDLL("./liblebedevlaikov.so") LDNS = [6, 14, 26, ...
<gh_stars>1-10 import os import numpy as np import pandas as pd from PIL import Image import random import scipy.misc from sklearn.model_selection import train_test_split from tensorflow.contrib.learn.python.learn.datasets.base import Datasets from tensorflow.contrib.learn.python.learn.datasets.mnist import DataSet,...
import numpy as np; from sklearn.base import BaseEstimator, TransformerMixin from scipy.sparse import issparse class SumarizeTransformer(BaseEstimator): def __init__(self, agg = None): self.agg = agg def transform(self, X, y=None): if self.agg == 'min': return X.min(axis=1,keepd...
import math, numpy from scipy.optimize import curve_fit import matplotlib.pyplot as plt global dm, m0 dm = -(75.5368+175.5873)*9 #rate of fuel consumption kg/s m0 = 486.931*(10.0**3.0) #mass at 100m/s m01 = 548.759*(10.0**3.0) #mass at 0m/s mwet = 424.6*(10.0**3.0) #mass of first stage fuel tank with fuel mdr...
from sklearn.feature_extraction.text import TfidfVectorizer, TfidfTransformer from sklearn.pipeline import Pipeline from src.data.DBConnection import DBConnection from src.data.make_dataset import preprocess_pipeline import time from numpy import round from pathlib import Path import scipy import pickle import log...
"""The ``templates`` module allows for fast creation of a few select sample types and diffraction geometries without having to worry about any of the "under the hood" scripting. """ import numpy as np import pygalmesh from scipy.spatial.transform import Rotation from xrd_simulator.detector import Detector from xrd_sim...
""" Data visualization toolbox. """ from matplotlib import style as mpstyle from matplotlib.pyplot import figure from pandas import DataFrame from scipy.cluster.hierarchy import dendrogram AXES = (("frame_on", False),) FIGURE = ( ("clear", True), ("dpi", 100), ("edgecolor", None), ("facecolor", None), ...
<filename>advanced_python/assignments/proj3/data_project.py<gh_stars>0 import numpy as np import pandas as pd #import matplotlib import matplotlib.pyplot as plt import datetime import pandas_datareader.data as web import math import scipy.optimize as sco #download data from Yahoo Finance and stock growth vi...
<reponame>karanchawla/ai_for_robotics #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun Apr 2 10:00 2017 @author: <NAME> (<EMAIL>) """ import numpy as np import matplotlib.pyplot as plt from scipy.sparse import linalg as sla from enum import Enum import copy import pylab import matplotlib.pyplot as pl...
<filename>scripts/solve_matrix_equation.py from envtest import my_mat_solve from sympy.matrices import Matrix, MatrixSymbol # Call function to solve the linear equation A*x=b symbolically A = Matrix([[2, 1, 3], [4, 7, 1], [2, 6, 8]]) b = Matrix(MatrixSymbol('b', 3, 1)) x = my_mat_solve(A, b) print(x)
<gh_stars>1-10 import numpy as np import matplotlib.pyplot as plt import sys import scipy as sp from pathlib import Path from scipy.signal import convolve2d import cProfile import pstats from time import strftime from .find_peaks import find_peak_indices # from skimage.feature import peak_local_max np.set_printoptions...
<gh_stars>1-10 #!/usr/bin/env python2 # -*- coding: utf-8 -*- from scipy.interpolate import UnivariateSpline def balance(gamma, interm, r, sa, x): return r[x], UnivariateSpline(r, interm, k=3, s=0).integral(0., r[x]), gamma[x]*sa(r[x])
#! /usr/bin/env python3 import sympy class _symbolic_object: _tokens = [] def __init__(self, token): if len(token) == 0: raise ValueError("Empty string is not a valid token.") if token in self.__class__._tokens: raise ValueError("The token \"" + token + "\" is...
"""General functions for mathematical and numerical operations. Functions --------- - spline - Create a general spline interpolation function. - cumtrapz_loglog - Perform a cumulative integral in log-log space. - extend - Extend the given array by extraplation. - sa...
""" Methods for estimating beta from pairwise comparisons """ import numpy as np from sklearn.linear_model import LogisticRegression as logistic_reg from scipy.optimize import minimize def averaging(X, XC, yn): """ Estimate covariance from X, beta from XC and yn. """ N, d = X.shape # Estimated mea...
<filename>mpys/mps.py """MPS class.""" import numpy as np from scipy.linalg import qr, rq from mpys.mps_ops import contract class Mps(object): """Class for matrix product states (MPS). Attributes: L (int): length of the MPS. d (int): physical dimension. D (int): maximum bond dimensi...
""" MATLAB® file utilies (:mod:`scipy.io.matlab`) ============================================= .. currentmodule:: scipy.io.matlab This submodule is meant to provide lower-level file utilies related to reading and writing MATLAB files. .. autosummary:: :toctree: generated/ matfile_version - Get the MATLAB fil...
<filename>fnc_kfold_our_model.py import sys import numpy as np import nltk nltk.download('wordnet') from sklearn.ensemble import GradientBoostingClassifier from feature_engineering import refuting_features, polarity_features, hand_features, gen_or_load_feats from libraries import sequence_padding from feature_engineeri...
<reponame>LCS2-IIITD/collusive-retweeters-ASONAM-2018 """ Title: Retweet Us, We Will Retweet You: Spotting Collusive Retweeters Involved in Blackmarket Services. (ASONAM 2018) Authors: <NAME>, <NAME>, <NAME>, <NAME> """ import sys from sklearn import svm from sklearn.model_selection import train_test_split, Stra...
<gh_stars>0 from __future__ import print_function import time import itertools import collections import logging from six.moves import cPickle import numpy as np from scipy import optimize import theano import theano.tensor as tt import theano.compile.sharedvalue as ts import numerical.numpytheano as nt import numeric...
<reponame>zxhyJack/image-enhancement import cv2 import copy import time import numpy as np from scipy.ndimage.filters import generic_filter, uniform_filter def window_stdev(X, window_size): r, c, l = X.shape X += np.random.rand(r, c, l) * 1e-6 c1 = uniform_filter(X, window_size, mode="reflect") c2 = u...
# CR(-2) is particularly computationally convenient from math import fsum, inf class Estimator: # NB: This works better you use the true wmin and wmax # which is _not_ the empirical minimum and maximum # but rather the actual smallest and largest possible values def __init__(self, wmin=0, wmax...
# -*- coding: utf-8 -*- """ Created on Mon Mar 5 13:17:47 2018 @author: JHodges """ import numpy as np import matplotlib matplotlib.rcParams['ps.useafm'] = True matplotlib.rcParams['pdf.use14corefonts'] = True #matplotlib.rcParams['text.usetex'] = True import matplotlib.pyplot as plt from PIL import Image, ImageDraw...
<reponame>tbj128/mian import numpy as np import scipy from scipy.sparse import csr_matrix import os from skbio.diversity import alpha_diversity from mian.core.data_io import DataIO otu = scipy.sparse.load_npz("/Users/boyanjin/Documents/Personal/workspace/mian/mian/data/18/b54c2ded-31db-4ae6-9d05-9e1550370f03/table.s...
#!/usr/bin/python import glob,sys,time from argparse import (ArgumentParser, FileType) import logging, os, sys, re, collections, operator, math, shutil, datetime from collections import Counter import pandas as pd import copy, statistics from multiprocessing import Pool from projectX.constants import SAMPLE_FIELDS,SAMP...
<gh_stars>100-1000 """ Utility functions and classes """ from __future__ import print_function, division import numpy as np import scipy.sparse as sp from itertools import chain from random import uniform def rand_convex(n): rand = np.matrix([uniform(0.0, 1.0) for i in range(n)]) return rand / np.sum(rand) ...
<gh_stars>0 from scipy import spatial import numpy as np import json import caas def run(workingPath, imagePathFilename, result_image): rgb_values = result_image["rgb"] cd = caas.color_definitions color_scheme_result = {} distances = np.empty([0]) color_schemes = list(cd.keys()) for col...
<filename>src/spectrogram_converter.py import numpy, scipy, matplotlib.pyplot as plt import librosa, librosa.display x, sr = librosa.load('audio/drum_sound.wav') plt.figure(figsize=(5, 5)) librosa.display.waveplot(x, sr, alpha=0.8) # plt.suptitle('Drum (Time Domain)') # plt.ylabel('Amplitude') # plt.xlabel('Time (Se...
<reponame>ttuanho/MATH_2859<gh_stars>0 # By # ████████╗██╗ ██╗ █████╗ ███╗ ██╗ ██╗ ██╗ ██████╗ # ╚══██╔══╝██║ ██║██╔══██╗████╗ ██║ ██║ ██║██╔═══██╗ # ██║ ██║ ██║███████║██╔██╗ ██║ ███████║██║ ██║ # ██║ ██║ ██║██╔══██║██║╚██╗██║ ██╔══██║██║ ██║ # ██║ ╚██████╔╝██║ ██║██║ ╚███...
import csv import random as random import numpy as np import matplotlib.pyplot as plt from scipy.special import expit, logit # Variables a usar archivos_fonts = [ "data/font1.csv", "data/font2.csv", "data/font3.csv" ] archivo_respuestas = [ "data/respuestas1.csv", "data/respuestas2.csv", "data/...
<reponame>rodluger/exoaurora<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- ''' search.py --------- Searching the HARPS data for the OI emission signal. ''' from __future__ import division, print_function, absolute_import, unicode_literals from pool import Pool import matplotlib as mpl; mpl.use('Agg') m...
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> from __future__ import division from pandas import * import os, os.path import sys import numpy as np sys.path.append('/home/will/HIVReportGen/AnalysisCode/') sys.path.append('/home/will/PySeqUtils/') # <codecell> store = HDFStore('/home/will/HIVRepor...
<filename>Chapter11/c11_17_ModifiedVaR_one_day.py """ Name : c11_17_modifed_VaR_one_day.py Book : Python for Finance (2nd ed.) Publisher: Packt Publishing Ltd. Author : <NAME> Date : 6/6/2017 email : <EMAIL> <EMAIL> """ import numpy as np import pandas as pd from scipy.stats ...
from scipy import stats, linalg from geosoup.common import Handler, Opt, np import warnings __all__ = ['Distance', 'Mahalanobis', 'Euclidean'] class Distance(object): """ Parent class for all the distance type methods """ def __init__(self, sam...
#!/usr/bin/env python """ Taken from https://github.com/AndrewRook/astro/tree/master/voronoi """ import sys import numpy as np import ConfigParser import time import os import astropy.io.fits as pyfits from sklearn.neighbors import BallTree import scipy.ndimage #import bottleneck as bn def writefits(image,filename,hea...
from pixell import enmap, curvedsky, fft as enfft, sharp, wcsutils from enlib import array_ops, bench from soapack import interfaces as sints from optweight import alm_c_utils import numpy as np from scipy.interpolate import interp1d, RectBivariateSpline from scipy import ndimage import numba import healpy as hp from ...
#!/usr/bin/env python """ This script is used to develop SpecViewer only. It should not be used for production. It creates a JSON file from a dictionary to be used in the QAP SpecViewer development. """ import json import os import numpy as np from scipy.ndimage import gaussian_filter1d def main(): # Create fak...
import sys import os import platform # Use OpenBLAS with 1 thread only as it seems to be using too many # on the CIs apparently. os.environ["OPENBLAS_NUM_THREADS"] = "1" import scipy import scipy.cluster._hierarchy import scipy.cluster._vq import scipy.fft import scipy.integrate._dop import scipy.integrate._odepack i...
<reponame>AroosaIjaz/Mypennylane # Copyright 2018 Xanadu Quantum Technologies Inc. # 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 # Unless r...
<filename>imports.py # --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.4.2 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- impo...
import os import math import time import datetime from functools import reduce import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import scipy.misc as misc from scipy import signal import skimage.color as sc import torch import torch.optim as optim import torch.optim.lr_schedu...
<reponame>hugo19941994/movie-pepper-back<filename>recommender.py #!/usr/bin/env python """ Sisrec.py Movies recomendation engine """ from typing import List # noqa: F401 from scipy.spatial.distance import cosine from concurrent.futures import ProcessPoolExecutor import sys import math import json # Importance of ea...
<reponame>soravux/jambokoko # coding: utf-8 # In[1]: import os, sys, urllib, gzip, glob, time import pickle # cPickle as pickle sys.setrecursionlimit(10000) # In[2]: import matplotlib.pyplot as plt #get_ipython().magic(u'matplotlib inline') import numpy as np from scipy.misc import imread, imsave from IPython.dis...
<gh_stars>0 import cmath print('Welcome to the Quadratic Solver App.') print('A quadratic equation is of the form: ax ^ 2 + bx + c = 0') print('Your solution can be real or complex numbers.') print('A complex number has two parts: a + bj') print("Where 'a' is the real portion and 'bj' is the imaginary portion." ) # ...
import os import pickle from time import time from datetime import datetime, timedelta # Configure logger first before importing any sub-module that depend on the logger being already configured. import logging.config logging.config.fileConfig("logging.ini") logger = logging.getLogger(__name__) import num...
from tqdm import tqdm import inspect import pandas as pd from scipy.sparse import issparse, SparseEfficiencyWarning from .moments import moments, strat_mom from .velocity import fit_linreg, velocity, ss_estimation from .estimation_kinetic import * from .utils_kinetic import * from .utils import ( update_dict, ...
# -*- coding: utf-8 -*- """ Container for the primary EMUS routines. """ import numpy as np from scipy.special import logsumexp try: import usample.linalg as lm import usample.autocorrelation as autocorrelation from .usutils import unpackNbrs except ImportError: import linalg as lm import autocorrel...
import sympy as sym from metric import Metric from coordinate_system_implementation_generator import JavaCoordinateSystemCreator xi = sym.symbols('xi', real=True, positive=True) eta = sym.symbols('eta', real=True) phi = sym.symbols('phi', real=True, positive=True) R = sym.symbols('R', real=True, positive=True, con...
""" Code to test the nearest neighbor search algorithm. RESULT: the algorithm appears to work perfectly, finding the exact points requested (with nudge=0). With nudge != 0 the error is equal to the nudge I added to the search points. """ import os, sys sys.path.append(os.path.abspath('../../LiveOcean/alpha')) impor...
<reponame>sasasagagaga/Code-examples import numpy as np from sklearn.tree import DecisionTreeRegressor from scipy.optimize import minimize_scalar from sklearn.metrics import mean_squared_error rmse = lambda x, y: np.sqrt(mean_squared_error(x, y)) def bootstrap(X, y): idx = np.random.randint(0, X.shape[0], X.sha...
# -*- coding: utf-8 -*- import numpy as np from scipy import sparse from . import Graph # prevent circular import in Python < 3.5 class Path(Graph): r"""Path graph. A signal on the path graph is akin to a 1-dimensional signal in classical signal processing. On the path graph, the graph Fourier tr...
<filename>lib/ys_optimize.py # Python Module for import Date : 2016-04-08 # vim: set fileencoding=utf-8 ff=unix tw=78 ai syn=python : per Python PEP 0263 ''' _______________| ys_optimize.py : Convex optimization given noisy data. We smooth some of the rough edges among the "scipy.optimi...
<reponame>00sapo/ASMD<gh_stars>1-10 import csv import os import re from copy import deepcopy from functools import wraps import numpy as np import pretty_midi import scipy.io from . import utils def convert(exts, no_dot=True, remove_player=False): """ This function is designed to be used as decorators for f...
<reponame>Atzingen/DynamicMouseAuthentication import gc import random import copy import os import traceback import numpy import pandas as pd from tqdm.notebook import tqdm as tqdmn import math import statistics import xgboost as xgb import scipy import matplotlib.pyplot as plt MEDIUM_SIZE = 20 BIGGER_SIZE = 25 plt....
<reponame>always-newbie161/pyprobml # K-means clustering for semisupervised learning # Code is from chapter 9 of # https://github.com/ageron/handson-ml2 import numpy as np import matplotlib.pyplot as plt from matplotlib import cm import matplotlib as mpl import itertools from scipy import linalg #color_iter = it...
<filename>models/ASIS/test.py import argparse import math import h5py import numpy as np import tensorflow as tf import socket from scipy import stats from IPython import embed import os import sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(os.path.dirname(BASE_DIR)) ...
<reponame>msgoff/sympy from sympy.ntheory.generate import Sieve, sieve from sympy.ntheory.primetest import ( mr, is_lucas_prp, is_square, is_strong_lucas_prp, is_extra_strong_lucas_prp, isprime, is_euler_pseudoprime, ) from sympy.testing.pytest import slow def test_euler_pseudoprimes(): ...
<reponame>davidmccandlish/vcregression import argparse parser = argparse.ArgumentParser() parser.add_argument("a", help="alphabet size", type=int) parser.add_argument("l", help="sequence length", type=int) parser.add_argument("-name", help="name of output folder") parser.add_argument("-data", help="path to input data",...
import numpy import sympy from sympy.diffgeom import Manifold, Patch from pystein import geodesic, metric, coords from pystein.utilities import tensor_pow as tpow class TestGeodesic: def test_numerical(self): M = Manifold('M', dim=2) P = Patch('origin', M) rho, phi, a = sympy.symbols('rho phi a', nonnegativ...
<gh_stars>1-10 import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import scipy.optimize as opt import cmath import sys import warnings from statistics import jackknifeMean from statistics import jackknifeCreutz from statistics import autocorrTime warnings.simplefilter(action='ig...
<filename>datasets/nyu_hand.py # -*- coding: utf-8 -*- import os import numpy as np import sys import struct from torch.utils.data import Dataset import scipy.io as scio def pixel2world(x, y, z, img_width, img_height, fx, fy): w_x = (x - img_width / 2) * z / fx w_y = (img_height / 2 - y) * z / fy w_z = z ...
<gh_stars>1-10 import numpy as np import easyvvuq as uq import os import fabsim3_cmd_api as fab import matplotlib.pyplot as plt from scipy import stats def get_kde(X, Npoints = 100): kernel = stats.gaussian_kde(X) x = np.linspace(np.min(X), np.max(X), Npoints) pde = kernel.evaluate(x) return x, pde #...
# Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # License: BSD (3-clause) import os import copy import numpy as np from scipy import linalg from .fiff.constants import FIFF from .fiff.tag import find_tag from .fiff.tree import dir_tree_find from .fiff.proj import read_proj from .fiff.channels import _read_b...
<reponame>Vinicius-Tanigawa/Undergraduate-Research-Project<gh_stars>0 ## @ingroup Methods-Power-Fuel_Cell-Discharge # larminie.py # # Created : Apr 2015, <NAME> # Modified: Feb 2016, <NAME> # ---------------------------------------------------------------------- # Imports # ----------------------------------------...
<filename>coba/benchmarks.py<gh_stars>0 """The benchmarks module contains core benchmark functionality and protocols. This module contains the abstract interface expected for Benchmark implementations. This module also contains several Benchmark implementations and Result data transfer class. """ import math import ...
from collections import Sequence import numpy as np from scipy.sparse.base import spmatrix from ..externals.six import string_types def is_multilabel(y): if hasattr(y, '__array__'): y = np.asarray(y) if not (hasattr(y, "shape") and y.ndim == 2 and y.shape[1] > 1): return False def type_of_...
<reponame>Luke-Ludwig/DRAGONS<gh_stars>1-10 # Copyright(c) 2019-2020 Association of Universities for Research in Astronomy, Inc. """ tracing.py This module contains functions used to locate peaks in 1D data and trace them in the orthogonal direction in a 2D image. Functions in this module: estimate_peak_width: estim...
<reponame>anekimken/DABEST-python<gh_stars>0 # #! /usr/bin/env python # Load Libraries import pytest import matplotlib as mpl import matplotlib.pyplot as plt mpl.use('Agg') import numpy as np import scipy as sp import pandas as pd import seaborn as sns from .._api import load from .utils import create_dummy_dataset,...
import numpy as np from scipy.stats import rankdata from sklearn.cluster import KMeans from skactiveml.base import SingleAnnotatorPoolQueryStrategy from skactiveml.utils import ( is_labeled, check_type, simple_batch, MISSING_LABEL, ) from skactiveml.utils._selection import combine_ranking class Repre...
<filename>qutip/rhs_generate.py # This file is part of QuTiP: Quantum Toolbox in Python. # # Copyright (c) 2011 and later, <NAME> and <NAME>. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions ar...
<filename>sphericalharmonics/sphharmhard.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 6 13:16:55 2018 @author: dietz """ from cmath import exp from math import sin, cos import numba @numba.njit(numba.complex128(numba.int64, numba.int64, numba.float64, numba.float64), nogil=True) def sph_...
import os import copy import numpy as np from astropy.io import fits import astropy.units as u import astropy.constants as const from specutils import Spectrum1D from astropy.table import Table from scipy.interpolate import interp1d import matplotlib.pyplot as plt from spectres import spectres from paintbox.utils impo...
<filename>CLEVER/collect_gradients.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ collect_gradients.py Front end for collecting maximum gradient norm samples Copyright (C) 2017-2018, IBM Corp. Copyright (C) 2017, <NAME> <<EMAIL>> and <NAME> <<EMAIL>> This program is licenced under the Apache ...
#!/usr/bin/env python import numpy as np import scipy.optimize as opt import sys,cPickle # import scipy.weave __doc__ = """Definitions for the threshold nonlinearity Copyright (C) 2014 <NAME> This code reproduces the analyses in the paper <NAME> (2014): Quantifying the effect of inter-trial dependence on perc...
<filename>wise/wiseutils.py import logging import datetime import numpy as np import wds import matcher import features as wfeatures from libwise import plotutils, nputils, imgutils import matplotlib.cm as cm import matplotlib.pyplot as plt import matplotlib.dates as mdates from mpl_toolkits.axisartist.grid_finder ...
<reponame>lanl/scico #!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of the SCICO package. Details of the copyright # and user license can be found in the 'LICENSE.txt' file distributed # with the package. r""" ℓ1 Total Variation (ADMM) ========================= This example demonstrates impulse noi...
""" ======================================== Saving and loading coordinates with asdf ======================================== In this example we are going to look at saving and loading collections of coordinates with `asdf <https://asdf.readthedocs.io/en/latest/>`__. asdf is a modern file format designed to meet the...
import numpy as np import matplotlib.pyplot as plt from scipy import stats if __name__ == '__main__': # # 1.重点新闻筛选 # # 读取已手动去除离群点的数据源, # data = np.loadtxt(r"../data/data.csv", delimiter=",", usecols=5, dtype="i4") # # # 绘制原始数据的频率直方图 # hist, bins = np.histogram(data, 300, normed=True) # bins...
import h5py import os import glob import re import numpy as np from . import peano import warnings from scipy.integrate import quad base_path = os.environ['EAGLE_BASE_PATH'] release = os.environ['EAGLE_ACCESS_TYPE'] class Snapshot: """ Basic SnapShot superclass which finds the relevant files and gets relevant inf...
<reponame>Lynn-015/Test_01 import numpy as np from scipy.sparse import kron,identity from mpo import MPO,op2mpo class TestMPO(object): def __init__(self): self.op=np.array([[0.5,0.],[0.,-0.5]]) for i in range(5): self.op=kron(self.op,identity(2)) self.mpo=op2mpo(self.op,2,6) def shape(self): for i in ra...
<filename>compute_scores.py #computes scores. #from features import * import sys import math from datetime import datetime import calendar import numpy as np import pylab import matplotlib.pyplot as plt import matplotlib import pandas as pd import pandas.io.sql as pd_sql from scipy import sparse import sqlite3 as s...
<filename>VAD.py # -*- coding: utf-8 -*- import struct import os import pandas as pd import wave import numpy as np import json import zipfile import matplotlib.pyplot as plt import pickle import scipy.signal as signal # 将record.wav输入信号 采样 切割 转化成若干processedi.pcm文件 # 通过高门限的一定是需要截取的音,但是只用高门限,会漏掉开始的清音 # 如果先用低门限,噪音可能不会被滤...
from numpy import arctan, zeros, pi, real as re, imag as im, linspace,eye, prod, newaxis from numpy import array as arr, exp, log, arange, diag, kron, savetxt, cumsum, argmax from numpy.linalg import det, norm, solve from scipy.optimize import fsolve import matplotlib.pyplot as plt from copy import deepcopy from ...
<gh_stars>0 from __future__ import print_function, division, absolute_import import sys import math import time import numpy as np import theano from matplotlib import pyplot as plt try: import seaborn except: pass # =========================================================================== # Progress bar ...
import itertools import os import pathlib from scipy.optimize import fsolve import BOPTools.SplitFeatures import FreeCAD import Part as FCPart import Points import gmsh import meshio # import Draft import numpy as np from Draft import make_fillet from FreeCAD import Base import DraftVecUtils from OCC.C...
#!/usr/bin/env python # # Copyright (C) 2017 - Massachusetts Institute of Technology (MIT) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option...
# -*- coding: utf-8 -*- """ Created on Thu Mar 26 11:21:14 2015 @author: noore """ import numpy as np import scipy class LINALG(object): @staticmethod def svd(A): # numpy.linalg.svd returns U, s, V such that # A = U * s * V # however, matlab and octave return U, S, V such that ...
<filename>covid19model/py/etl.py<gh_stars>0 ### ETL script for generating input tables to model ### main point: ETL JHU covid-19 case and mortality data # todo: refactor import os import numpy as np import pandas as pd import warnings from scipy.stats import gamma warnings.simplefilter( action="ignore", category...
<filename>SeriesAnalysis/Stationarity/AugmentedDickeyFuller.py import pandas as pd import numpy as np import yfinance as yf from sklearn.linear_model import LinearRegression import statsmodels import statsmodels.api as sm import statsmodels.tsa.stattools as ts import datetime import scipy.stats import math import op...
import numpy as np from scipy.special import logsumexp, kl_div import torch import torch.nn as nn EPS = float(np.finfo(np.float32).eps) __all__ = ['BeliefPropagation', 'BeliefPropagationTorch'] class BeliefPropagation(object): def __init__(self, J, b, msg_node, msg_adj): """ Belief Propagation for Binary...
import itertools import math import numpy as np import pytest from hypothesis import given, strategies as st from scipy.sparse import coo_matrix from tmtoolkit import bow @given(dtm=st.lists(st.integers(0, 10), min_size=2, max_size=2).flatmap( lambda size: st.lists(st.lists(st.integers(0, 10), ...
<reponame>alexbarcelo/dislib<gh_stars>10-100 import unittest import numpy as np from scipy.sparse import csr_matrix from sklearn.cluster import KMeans as SKMeans from sklearn.datasets import make_blobs import dislib as ds from dislib.cluster import KMeans class KMeansTest(unittest.TestCase): def test_init_param...
<gh_stars>0 """ This is companion code to Project 4 for CSEP576au21 (https://courses.cs.washington.edu/courses/csep576/21au/) Instructor: <NAME> """ # ====================================================================== # Copyright 2021 <NAME> https://corvidim.net/ablavsky/ # # Permission is hereby granted, free of...
# default package from logging import getLogger from typing import Dict # third party import numpy as np import scipy.signal import scipy.stats # logger logger = getLogger(__name__) def calc_all(data: np.ndarray, fs: float) -> Dict: features = { "Mean": np.mean(data), "Std": np.std(data), ...