text string |
|---|
import numpy as np
import scipy as sc
import pandas as pd
import bct
import networkx as nx
"""
distance_wei_floyd
"""
def distance_wei_floyd(adjacency, transform=None):
if transform is not None:
if transform == 'log':
if np.logical_or(adjacency > 1, adjacency < 0).any():
r... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import loadmat
from openmdao.api import Problem
from pyoptsparse import Optimization, SNOPT
from wakeexchange.OptimizationGroups import OptAEP
from wakeexchange.gauss import gauss_wrapper, add_gauss_params_IndepVarComps
def tuning_obj_function(xdict=... |
<gh_stars>10-100
import scipy.io
import numpy
import sppy
from apgl.graph.AbstractMatrixGraph import AbstractMatrixGraph
from apgl.graph.AbstractVertexList import AbstractVertexList
from apgl.graph import GeneralVertexList
from apgl.util.Parameter import Parameter
from apgl.util.SparseUtils import SparseUtils
clas... |
import asyncio
import datetime
import statistics
import time
from dataclasses import dataclass
from dataclasses import field
from typing import Any
from typing import List
from typing import Optional
from typing import Sequence
from typing import Tuple
from typing import TypeVar
import requests
from telliot_core.apps.... |
<reponame>Chibee/rt-cloud
# Purpose: finalize experiment when you're done running for the day
# Add whatever you want to do, but typically first we should make sure to
# move and delete all sever data
import os
import glob
import numpy as np
from subprocess import call
import time
import nilearn
from scipy import sta... |
from sympy import *
import sympy
from math import pi,e
from math import pow
import numpy as np
# variables
x = Symbol('x')
y = Symbol('y')
z = Symbol('z')
# model
G = sympy.Matrix([3*x-cos(y*z)-3./2.,
4.*x**2-625.*y**2+2.*y-1.,
sympy.exp(-x*y)+20.*z+(10.*pi-3.)/3.])
# Objective fu... |
<gh_stars>1-10
__author__ = "<NAME>, <EMAIL>"
import RLConfig as config
import numpy as np
import scipy.io
import MemoryUsage
import RLConfig as config
import BoxSearchState as bss
import random
STATE_FEATURES = config.geti('stateFeatures')/config.geti('temporalWindow')
NUM_ACTIONS = config.geti('outputActions')
TE... |
<reponame>Verma314/Experiments-in-Symbolic-Computation<filename>00 Calculus Operations in SymPy.py
from sympy import *
#define sympy symbols for
x , t , z , nu = symbols ('x t z nu')
#for pretty printing:
init_printing ( use_unicode=True)
#take a derivative of [ sin (x) e ^ x ]
print (" Diffrentiating sin... |
# coding=utf-8
import tensorflow as tf
import scipy.sparse
from sklearn.neighbors import KDTree
import numpy as np
import math
import multiprocessing as multiproc
from functools import partial
def GridSampling(batch_size, meshgrid):
'''
output Grid points as a NxD matrix
params = {
'batc... |
from __future__ import print_function, division
import numpy as np
from scipy.linalg import inv
import matplotlib.pyplot as plt
n = 20
s = 2.0
m = 2 * (n + 1)
M = np.empty((m, n))
for i in range(m):
for j in range(n):
M[i, j] = np.exp(-2*(i / s - j)**2)
M = M.dot(inv((M.T).dot(M))).dot(M.T)
xM = np.arang... |
<reponame>samtx/pyapprox
import dolfin as dl
from pyapprox.fenics_models.advection_diffusion import *
from pyapprox.fenics_models.advection_diffusion_wrappers import *
from pyapprox.fenics_models.fenics_utilities import *
import unittest
import matplotlib.pyplot as plt
class ExactSolutionPy(dl.UserExpression):
def... |
<gh_stars>1-10
import scipy.io
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from astropy.time import Time
import sys
#tagname_list = ['7_S11951','8_S11938', '11_S11971', '12_S11974', '13_S11976', '16_S12060', '17_S12061', '18_S12059', '22_S12068', '24_S11845']
#tagid_list = [7,8,11,12,13,16,1... |
import os
from os.path import join
from astropy.io import fits
import numpy as np
from scipy.ndimage import rotate
from PIL import Image
from tqdm import tqdm
dir_fits = './datasets/Fits/VSM'
dir_images = './datasets/Images/VSM'
os.makedirs(dir_images) if not os.path.isdir(dir_images) else None
list_fits_name = sorte... |
"""Module containing sample classes for approach definitions."""
import itertools
import numpy as np
from scipy import optimize
from ..wrappers.mytypes import doublenp
from ..wrappers.mytypes import complexnp
from .kernel_handler import KernelHandler
from .kernel_handler import KernelHandlerMatrixFree
class Appro... |
# Copyright 2020, Battelle Energy Alliance, LLC
# ALL RIGHTS RESERVED
"""
Created on Feb. 7, 2020
@author: wangc, mandd
"""
#External Modules------------------------------------------------------------------------------------
import numpy as np
import numpy.ma as ma
from scipy.integrate import quad
#External Modules E... |
import os
import sys
import numpy as np
from scipy.ndimage import measurements
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.
abspath(__file__))))
if path not in sys.path:
sys.path.append(path)
from CM.CM_TUW0.rem_mk_dir import rm_file
from CM.... |
#!/usr/bin/env python3
import numpy as np
from scipy.io.wavfile import write
from sys import argv
from os.path import abspath
# Generate .wav file from the command line
#
# testing out the accuracy of fft in Swift
#
# @ github.com/Jesssullivan/tmpUI
default_msg = str("no args specified, using defaults \n " +
... |
<reponame>binary-hideout/redes-neuronales<gh_stars>0
# Este programa carga un conjunto de muestras de datos en formato csv, las estandariza,
# les aplica una prueba de Kolmogorov-Smirnov y despliega visualmente
# los histogramas correspondientes
import numpy as np
import matplotlib.pyplot as plt
from scipy import stat... |
from task3 import get_velocity_Euler
from sympy import symbols, diff
import numpy as np
x1, x2, x3 = symbols('x1 x2 x3')
def get_euler_dt(eq1, eq2, eq3):
v1, v2, v3 = get_velocity_Euler(eq1, eq2, eq3)
vkl = [
[diff(v1, x1), diff(v1, x2), diff(v1, x3)],
[diff(v2, x1), diff(v2, x2), diff(v2, x3)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 6 14:09:32 2020
@author: <NAME>
@email: <EMAIL>
File to do a scatter plot of the tautomerization energy.
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy import stats
import pandas as pd
file_QM9 = pd... |
<reponame>Deltares/xugrid
import types
from functools import wraps
from typing import Any, Callable, Union
import numpy as np
import scipy.sparse
import xarray as xr
from xarray.backends.api import DATAARRAY_NAME, DATAARRAY_VARIABLE
from xarray.core._typed_ops import DataArrayOpsMixin, DatasetOpsMixin
from xarray.core... |
import numpy as np
import copy, re, sys
from fractions import Fraction as Q
def prmatr(m):
"""Виводить матрицю у звичайному вигляді, без технічних символів та слів."""
for i in m:
for j in i:
print(j, end=" ")
print()
class InputParser:
"""Клас для оброблення вхідної інформації з файлу або об'єкту.
Пов... |
import numpy as np
import matplotlib
import sys
import matplotlib.pyplot as plt
from scipy.ndimage import gaussian_filter
from mpl_toolkits import mplot3d
def mk_blob(**kwargs):
'''Makes a blob by generating a circle/sphere with a variable radius based
on a set distribution function and applyin... |
<reponame>MahdadJafarzadeh/ssccoorriinngg<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 22 10:07:37 2020
CopyRight: <NAME>
Using this code, one can directly feed in EDF data and select channels of interest
to perform classification.
Please Note: we recommend to use "EDF_to_h5.py" to firstly conve... |
<reponame>bdy9527/NASA<gh_stars>0
import os
import dgl
import time
import random
import argparse
import numpy as np
import scipy.sparse as sp
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgl.sampling import select_topk
from dgl import function as fn
from dgl.nn.functional import edge_softmax
... |
# -*- coding: utf-8 -*-
# ======================================================================================================================
# Copyright (©) 2015-2021 LCS - Laboratoire Catalyse et Spectrochimie, Caen, France. =
# CeCILL-B FREE SOFTWARE LICENSE AGREEMENT - See ful... |
<reponame>PianeRamso/cobrame
from __future__ import print_function, division, absolute_import
import re
from six import iteritems
from warnings import warn
from cobra import Model, DictList
import numpy as np
from scipy.sparse import dok_matrix
from cobrame.core.reaction import (SummaryVariable, MetabolicReaction,
... |
<reponame>Shahra/ip
from pj import *
import cmath
class AC(enum.Enum):
PLUS, MINUS, PUTA, KROZ, OTV, ZATV, KONJ = '+-*/()~'
NA, STRELICA = '**', '->'
class BROJ(Token):
def vrijednost(self, _): return complex(self.sadržaj)
class I(Token):
def vrijednost(self, _): return 1j
class IM... |
<reponame>lucianogsilvestri/sarkas<filename>sarkas/potentials/tests/test_moliere.py<gh_stars>0
from numpy import array, isclose, zeros
from scipy.constants import elementary_charge, epsilon_0, pi
from ..moliere import moliere_force
def test_moliere_force():
"""Test the calculation of the moliere force and potent... |
'''
Design filter using built-in functions
Show frequency response
Low-pass analog filter for example
XiaoCY 2021-02-05
'''
# %%
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal as sig
Wp = 1. # passband corner frequency (rad/s)
Ws = 3. # stopband co... |
<gh_stars>0
"""Determine the ability for VLTI to have simultaneous near-infrared fringes in
several bandpasses
#For K-band, by using delta/n_air_group of air to compensate for
#delta vacuum delay, we have +/- pi radians of phase as a worst case.
#This reduces visibility by 2/np.pi, which is significant but maybe not ... |
<reponame>listerchen319/cnn_rfi
#!/usr/bin/env python
# coding: utf-8
# In[13]:
from utilities.py import *
from Model_prediction.py import *
#get_ipython().run_line_magic('run', 'Utilities.ipynb')
#get_ipython().run_line_magic('run', 'Model_prediction.ipynb')
# In[5]:
import numpy as np
import os
from pyuvdata im... |
import numpy as np
import time
from scipy.special import gammaln, psi
eps = 1e-100
class diln:
"""
The Discrete Infinite Logistic Normal Distribution (DILN), <NAME> <NAME> and <NAME>, 2011
"""
def __init__(self, K, N):
self.K = K
self.N = N # vocabulary size
self.V =... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_ag... |
<gh_stars>0
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
"""
Demo script s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import sympy as sym
import pytest
from graphdot.util.pretty_tuple import pretty_tuple
from graphdot.metric import KernelInducedDistance
class Kernel:
def __init__(self, v, L):
self.v = v
self.L = L
self.expr = sym.sympify('v ... |
"""
Compute the base object representing the qubit network.
"""
import itertools
import time
import logging
import numpy as np
import sympy
import qutip
from .analytical_conditions import (pauli_product, pauli_basis,
_self_interactions,
_at_most_n... |
import numpy as np
import sympy as sym
import matplotlib.pyplot as plt
from .goodwin_keen import find_eqm_keen, eig_keen_val
def sim_study():
L_IC = np.linspace(0.6, 1, 10)
W_IC = np.linspace(0.5, 1, 10)
D_IC = np.linspace(0, 10, 10)
results = []
for i in range(len(L_IC)):
... |
<reponame>ondrejklejch/learning_to_adapt
from collections import defaultdict
from keras import backend as K
from keras.activations import get as get_activation
from keras.engine.topology import Layer
from keras.layers import Input, Activation, Dense, Conv1D, BatchNormalization
from keras.models import Model
from layers... |
<filename>egs/voxceleb/v2.voxceleb1/write_mfcc_scp_ark.py
#!/usr/bin/env python3
import sys, os
from os.path import basename, dirname, join as p_join
from glob import glob
import numpy as np
from kaldiio import WriteHelper
import scipy.io.wavfile as wav_file
from python_speech_features import mfcc as psf_mfcc
if __n... |
import torch.nn as nn
import numpy as np
import torch.optim as optim
from torch.utils.data import DataLoader
from torch.autograd import Variable
import torch.nn.functional as F
from tqdm import tqdm
import time
from torch.utils.tensorboard import SummaryWriter
import matplotlib.pyplot as plt
import pdb
import imageio
... |
<gh_stars>1-10
import numpy as np
import scipy.linalg as sl
from scipy import special
import functools as fts
from utils.sir import calc_residual_error
# TODO: docstring
@fts.lru_cache(maxsize=None)
def multigamma_ln(a, d):
"""
"""
return special.multigammaln(a, d)
@fts.lru_cache(maxsize=None)
def log... |
<reponame>zx-sdu/NodeFinder
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# © 2017-2019, ETH Zurich, Institut für Theoretische Physik
# Author: <NAME> <<EMAIL>>
import random
import numpy as np
import scipy.linalg as la
import matplotlib.pyplot as plt
import nodefinder as nf
def gap_fct(pos, noise_level=0.1):
... |
# coding: utf-8
# In[1]:
#import os
#os.environ["CUDA_VISIBLE_DEVICES"]="1"
# In[2]:
import json
import numpy as np
np.random.seed(1)
import keras
print keras.__version__ #version 2.1.2
from keras import preprocessing
# In[3]:
fn = '50EleReviews.json' #origial review documents, there are 50 classes
with open... |
import numpy as np
from scipy.integrate import quad
from math import sin, cos, pi, exp
def Find_Heaviside_Wavelet_One(T0,amp,Resolut):
"""
This function computes the wavelet transform of a heaviside function
input:
T0: float, representing the time where the step happen
amp: float, represent... |
<filename>src/papanda/cochran_test.py<gh_stars>0
# September 2021
import numpy as np
import pandas as pd
import scipy.stats
import math
import pkgutil
"""
Cochran's test for detecting outliers in variances.
See details https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/cochvari.htm
Complaint ISO 1626... |
"""
gui/average3
~~~~~~~~~~~~~~~~~~~~
Graphical user interface for three-dimensional averaging of particles
:author: <NAME>, 2017-2018
:copyright: Copyright (c) 2017-2018 Jungmann Lab, MPI of Biochemistry
"""
import os.path
import sys
import traceback
import colorsys
import matplotlib.pyplot as ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 27 09:54:51 2017
@author: Calil
"""
from numpy import array, sqrt, log2, zeros_like
from scipy.stats import norm
import matplotlib.pyplot as plt
from quant_2_bit import optimize_info, mutual_info
def plot_1b(eb_n0_dB: array):
"""
Plots capacity vs Eb/N0 for 1 b... |
"""
Calculus functionality (differentiation and integration) for polynomials expressed in the monomial basis (see
:mod:`~polynomials_on_simplices.polynomial.polynomials_monomial_basis`).
For integration of a polynomial over a simplex see [Baldoni_2008]_.
.. rubric:: References
.. [Baldoni_2008] <NAME>, <NAME> <NAME>,... |
"""
Copyright (C) 2022 <NAME>
This work is released under the MIT License.
See the file LICENSE for details
This script visualizes user generated tracks alongside the ground truth
in both pixel and world coordinates (top-down) as videos. Can also be used
to only visualize the ground truth
""... |
<filename>lib/score.py
#-------------------------------------------------------------------------------------------------------------------
# Packages & Settings
#-------------------------------------------------------------------------------------------------------------------
# General
import os
import datetime
impo... |
import timeit
import numpy as np
from scipy.linalg import lu_factor, lu_solve
def check_jacobian(x0, func, jacobian, eps=1e-5):
if x0.ndim != 1:
raise ValueError('x0 must be a vector')
# Compute analytic gradients
J = jacobian(x0)
n_out, n_in = J.shape
if x0.shape[0] != n_in:
raise ValueError('x0 must matc... |
<reponame>mprakhar/DSM2DTM
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = 'Prakhar'
# Created 8/08/2017
# Last edit 8/07/2018 - changed majority voting to more than 5
# Edit : Fixed extent of filter window
# Purpose: Make a class which can provide object To obtain DTM and nDSM from DSM . Follows from al... |
<gh_stars>0
#!/usr/bin/env python3
# Import the required modules
import cv2
import os
import scipy.misc
import numpy as np
from PIL import Image
# For face detection we will use a cascade pattern provided by OpenCV.
# noinspection SpellCheckingInspection
cascade_path = "/usr/local/share/OpenCV/haarcascades/haarcascad... |
from __future__ import division
import numpy as np
from matplotlib.ticker import AutoMinorLocator
from matplotlib.ticker import MultipleLocator
from matplotlib.ticker import MaxNLocator
from scipy.interpolate import LinearNDInterpolator
import matplotlib.pyplot as plt
import time
import sys
import os
sys.path.append(... |
# -*- codeing: utf-8 -*-
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
def myrand_gmm(n, mu, sigma, fill=0.0):
x = np.zeros(n)
g = np.random.randn(n)
u = np.random.rand(n)
#mu = np.array([1.0, 2.0, 3.0])
#sigma = np.array([0.1, 0.3, 0.5])
flag = (0 <... |
from unittest import TestCase
import scipy.sparse as sp
from pydsm import IndexMatrix
import pydsm.weighting as weighting
__author__ = 'jimmy'
class TestWeighting(TestCase):
def create_mat(self, list_, row2word=None, col2word=None):
if row2word is None:
row2word = self.row2word
if ... |
<reponame>poldrack/myconnectome
"""
compute correlations and save to numpy file
"""
import numpy
import os,sys,glob
import sklearn.covariance
import scipy.linalg
def pcor_from_precision(P,zero_diagonal=1):
# given a precision matrix, compute the partial correlation matrix
# based on wikipedia page: http://en... |
import numpy as np
from scipy.io import wavfile
import matplotlib.pyplot as plt
from scipy.linalg import dft
from scipy.signal import find_peaks
from scipy.fft import fft
samplerate, data = wavfile.read('assets/C0.wav')
print(len(data))
print(samplerate)
winsize = 1024
wins = [data[x:x+winsize] for x in range(0, len... |
<gh_stars>10-100
"""Solving the SMEFT RGEs."""
from . import beta
from copy import deepcopy
from math import pi, log
from scipy.integrate import solve_ivp
from wilson.util.smeftutil import C_array2dict, C_dict2array, arrays2wcxf_nonred
import numpy as np
def smeft_evolve_leadinglog(C_in, scale_in, scale_out, newphy... |
import cv2
import numpy as np
from scipy.cluster.vq import kmeans
class blobs:
def __init__(self, min_area = 100):
params = cv2.SimpleBlobDetector_Params()
params.filterByCircularity = True;
params.minCircularity = 0.5;
params.filterByConvexity = True
params.minConvexity = ... |
<reponame>lematt1991/RecLab<gh_stars>1-10
"""An implementation of the top popularity baseline recommender."""
import numpy as np
import scipy.sparse
from . import recommender
# TODO: add flag to allow this to also be based on number of times rated.
class TopPop(recommender.PredictRecommender):
"""The top popula... |
<filename>viewmorphing.py
import os
import dlib
import argparse
import numpy as np
import matplotlib.pyplot as plt
import cv2
from scipy import linalg, optimize
from math import sin, cos, asin, atan, pi, sqrt, floor, ceil
import utils
from feature_detection import feature_points_detection
from prewarp import compute_p... |
import numpy as np
import cv2
from scipy import misc
import os
from .m_im_util import sdmkdir,to_rgb3b
from sklearn import metrics
#import rasterio
#from rasterio import mask, features, warp
def show_heatmap_on_image(img,mask):
mask = np.uint8(mask)
heatmap = cv2.applyColorMap(mask, 3) #Jet is 2, winter is 3... |
<gh_stars>1-10
from ..data_class.data_manage import dataManager
from .. import directories as direc
import numpy as np
import scipy.sparse as sp
class tpfaScheme:
def __init__(self, M: 'mesh object', data_name: 'nome do arquivo para ser gravado') -> None:
self.mesh = M
self.gravity = direc.data_... |
from datetime import timedelta
import numpy as np
from scipy import signal
from slider.beatmap import Circle, Slider, Spinner as SliderSpinner
from circleguard.mod import Mod
from circleguard.utils import KEY_MASK
from circleguard import utils
from circleguard.game_version import GameVersion
from circleguard.hitobjec... |
import numpy as np
from scipy.special import gammaln
from COMBO.graphGP.sampler.tool_partition import compute_group_size
# For numerical stability in exponential
LOG_LOWER_BND = -12.0
LOG_UPPER_BND = 20.0
# For sampling stability
STABLE_MEAN_RNG = 1.0
# Hyperparameter for graph factorization
GRAPH_SIZE_LIMIT = 1024 +... |
<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: zparteka
"""
import argparse
from modeling_scripts.modeling_operations.create_structure import load_points, save_pdb
from modeling_scripts.modeling_operations.create_structure import run_image_tsp
from scipy.spatial.distance import squareform, pdis... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from scipy.ndimage import gaussian_filter, maximum_filter
def non_max_supression(plain, windowSize=3, conf_threshold=1e-6):
# clear value less than conf_threshold
under_th_indices = plain < conf_threshold
plain[under_th_indices] = 0
ret... |
import os
import numpy as np
import math
from math import pi
import scipy.ndimage.morphology
from scipy import ndimage
import skimage.morphology
from typing import Sequence, Tuple, Union, Optional, List
def angle_2_da_vector(angles: np.ndarray) -> np.ndarray:
"""
Angles in radians to double-angle vector spac... |
from PIL import Image
import numpy as np
import os
import glob
import torch
import torchvision.transforms as transforms
import torchvision.transforms.functional as F
import torch.nn.functional as functional
import torch.utils.data as data
import random
import time
import scipy.io as scio
import h5py
import math
class ... |
<filename>scripts/hb_connections.py
import numpy as np
import scipy.spatial as spatial
import time
import math
from math import log10, floor
import os
import sys
from math import log10, floor
class connections:
def __init__(self,file):
self.d=self.data_extraction(file)
self.a... |
# coding: utf-8
# pylint:
# author: <NAME>
# mail: <EMAIL>
from utils import KG, RegisterCustomColormaps, gen_meshgrid, gen_region_index, smooth
from data import Time
from matplotlib import ticker
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from mpl_toolkits.basemap imp... |
<gh_stars>1-10
from PIL import Image, ImageOps
from io import BytesIO
import base64
import tempfile
import scipy.io.wavfile
from scipy.fftpack import dct
import numpy as np
from gradio import encryptor
#########################
# IMAGE PRE-PROCESSING
#########################
def decode_base64_to_image(encoding):
... |
<gh_stars>1-10
import os
from glob import glob
import imageio
import h5py
import numpy as np
import skimage.color as skc
from batchlib.util import read_image, read_table
from scipy.ndimage import convolve
from scipy.ndimage.morphology import binary_erosion
def normalize(im):
im = im.astype('float32')
im -= ... |
from scipy import sparse
from tqdm import tqdm
from utils.pre_processing import *
class TailBoost(object):
def __init__(self, datareader, eurm, similarity, norm=norm_l2_row):
self.datareader = datareader
self.eurm = norm(eurm)
self.similarity = norm(similarity)
self.test_intera... |
<reponame>vaisaghvt/gameAnalyzer<gh_stars>0
import os
import math
from scipy import stats
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib import rc
import numpy as np
import csv
with open('2DormCorr-Limited.csv', 'r') as csvfile:
fileReader = csv.reader(csvfile, delimiter=',')
name... |
<reponame>alex-wenzel/ccal
from numpy import dot, full, nan
from numpy.linalg import pinv
from scipy.optimize import nnls
def solve_ax_equal_b(a, b, method="pinv"):
if method == "pinv":
x = dot(pinv(a), b)
elif method == "nnls":
x = full((a.shape[1], b.shape[1]), nan)
for i in ran... |
import higra as hg
import numpy as np
import scipy
def get_coo_sims(x):
""" Get cooccurence matrix given data
Args:
x (ndarray): Input data
Returns:
[ndarray]: coocurrence matrix
"""
z = (x * x).sum(1, keepdims=True) ** 0.5
return scipy.sparse.coo_matrix(x @ x.T / z / z.T)
de... |
<gh_stars>1-10
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import scipy
from scipy.optimize import *
from functools import reduce
class Node(object):
""" A thermal node."""
def __init__(self, name, tmass, temp=0.0, power=(lambda x: 0.0), description=None, boundary=None):
#import types
#... |
import time
from ctypes import *
import numpy as np
import scipy.stats as sps
from matplotlib import pyplot as pypl
# =========================测试数据设置=========================
# 正态分布均值
MU = 0
# 正态分布标准差
SIGMA = 1
# 正态分布随机数生成数量
TOTAL_COUNT = 10000
# 分桶计数时每个桶计数区间的大小
BUCKET_SIZE = 2
# 分桶数量
BUCKET_COUNT = 50
# 耗时测试中生成随机数的... |
<reponame>tsingqguo/AttackTracker<gh_stars>10-100
# Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import torch
import random
import torch.nn.functiona... |
import math
from dataclasses import dataclass, field
import functools
import warnings
warnings.filterwarnings("ignore")
import numpy as np
from scipy.stats import norm
from pyfinance.options import BSM as BSMAux
#-------------------------------------------------------------------------
@dataclass(frozen=True)
class B... |
<filename>response_model/python/metric_learning/end_to_end/ln_model.py
# Copyright 2018 Google LLC
#
# 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/LICEN... |
<filename>bootstrap_stat/bootstrap_stat.py
import warnings
import multiprocessing as mp
import numpy as np
import scipy.stats as ss
import scipy.optimize as optimize
import pandas as pd
from pathos.multiprocessing import ProcessPool as Pool
"""Methods relating to the Bootstrap.
Estimates of standard errors, bias, co... |
<gh_stars>0
#! /bin/bash
# -*- coding: utf-8 -*-
import logging
import pandas as pd
from multiprocessing.pool import ThreadPool, Pool
import numpy as np
from sklearn import preprocessing
from sklearn.experimental import enable_iterative_imputer
from sklearn.impute import IterativeImputer
from tqdm import tqdm
import r... |
r"""
Example of central limit theorem
--------------------------------
Figure 3.20.
An illustration of the central limit theorem. The histogram in each panel shows
the distribution of the mean value of N random variables drawn from the (0, 1)
range (a uniform distribution with :math:`\mu = 0.5` and W = 1; see eq. 3.39... |
<gh_stars>0
import numpy as np
import cv2
from scipy.ndimage.measurements import label
""" Utility functions to filter the bounding boxes by using heatmap with threshold
"""
def add_heat(heatmap, bbox_list):
# Iterate through list of bboxes
for box in bbox_list:
# Add += 1 for all pixels inside each ... |
import datacube as dc
from datacube.helpers import ga_pq_fuser
from datacube.storage import masking
import numpy as np
import xarray as xr
import multiprocessing as mp
import ctypes
from contextlib import closing
import datetime
import warnings
from stats import nbr_eucdistance, cos_distance, severity, outline_to_mask,... |
<gh_stars>1-10
import unittest
from os.path import join, dirname, abspath
import numpy as np
import h5py
import pystella as ps
import logging
mpl_logger = logging.getLogger('matplotlib')
mpl_logger.setLevel(logging.WARNING)
try:
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import ma... |
<gh_stars>0
#!/usr/bin/env python3
# encoding: utf8
# dataset.py
import logging
from itertools import count
from miptclass import models
from miptclass.settings import ML_DATASET, ML_FRIEND_ENCODER
from numpy import zeros
from operator import itemgetter
from os.path import realpath
from scipy.io import savemat
fr... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 7 18:39:51 2020
@author: mirta
"""
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import numpy as np
import pickle
#from qpt_oop import *
def func(x, b, c):
return c* x**(0.001*(-b * x))
fig, ax = plt.subplots(nrows=1, ncols=3... |
<reponame>jmcvey3/dolfyn
import numpy as np
import scipy.io as sio
import xarray as xr
import pkg_resources
from .nortek import read_nortek
from .nortek2 import read_signature
from .rdi import read_rdi
from .base import _create_dataset
from ..rotate.base import _set_coords
from ..time import epoch2date, date2epoch, dat... |
import torch.utils.data as data
import os
import os.path
from scipy.ndimage import imread
import numpy as np
import random
def Vimeo_90K_loader(root, im_path, input_frame_size = (3, 256, 448), output_frame_size = (3, 256, 448), data_aug = True):
root = os.path.join(root,'sequences',im_path)
if data_aug and ... |
<filename>NeurIPS_2021/Figure_3/QD_OOD/main_QD_FUN_OOD.py<gh_stars>10-100
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from scipy import stats
import os
import importlib
import DeepNetPI_V2
import DataGen_V2
import utils
from sklearn.metrics import r2_score
import os
import random
import itertools
os.envir... |
import logging
import warnings
import numpy as np
from scipy.integrate import IntegrationWarning, quad
from scipy.interpolate import Akima1DInterpolator
from smrf.envphys import sunang
from smrf.envphys.constants import SOLAR_CONSTANT
def direct_solar_irradiance(d, w=[0.28, 2.8]):
"""
Solar calculates exoat... |
<reponame>zipengxuc/ecs-visdial-rl
import os
import json
import numpy as np
from nltk.translate.bleu_score import sentence_bleu
import nltk
from nltk.tokenize import TreebankWordTokenizer
from nltk.util import ngrams
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import D... |
import pandas as pd
import numpy as np
from paperClass import exCI
from scipy.stats import norm
## read in real exchange rate and take log
df = pd.read_csv('./data/real_exchange.csv', index_col=False) #TXN matrix
df = df.iloc[:,1:].T #NXT matrix
## set significance level 95%
significance = 0.05
cv = norm.ppf(1 - sign... |
# Copyright (c) Facebook, Inc. and its affiliates.
# 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.
import csv
import random
import argparse
import operator
import numpy as np
import os, sys, json
import os.path a... |
<filename>notes/2018-05-14-single-view-continuous-svd/calculations/circular-ft.py
import numpy as np
from mpmath import *
from sympy import *
from sympy.matrices.dense import *
import functools
# Analytical spherical fourier transform
def cft(f, max_n=2):
coeffs = []
for n in range(-max_n, max_n+1):
p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.