text
string
import numpy as np import pickle import multiprocessing as mp from multiprocessing import Pool import matplotlib # matplotlib.rcParams.update({'font.size': 18}) matplotlib.use('Agg') import matplotlib.pyplot as plt import itertools from collections import defaultdict from joblib import Parallel, delayed from scipy.sta...
""" Implementation of <NAME>'s BLUP-based shrink (Mefford, PhD thesis 2018). """ import sys import time import scipy as sp from scipy import stats import h5py from ldpred import LDpred_inf from ldpred import util from ldpred import ld from ldpred import reporting from ldpred import coord_genotypes def get_LDpr...
<filename>loader/dataset.py import os import pandas as pd import torch import torch.utils.data as data import mrcfile as mrc import numpy as np import scipy.ndimage as nd from tqdm.notebook import tqdm import pandas as pd class Dataset_subtomo(data.Dataset): def __init__(self, dir_csv,task='classification',test=F...
<reponame>rowland-208/colorsort """The colorsort python library provides algorithms for sorting colors. You can use colorsort to: * Convert an image into a color vector * Reduce the number of colors in a color vector while maintaining the overall pallete * Sort the colors in a color vector For an interactive demo che...
import time from functools import wraps import numpy as np import pybullet as p import pybullet_data as pd from scipy.spatial.transform import Rotation as R from utils.text import TextFlag, log from world.action.primitives import PushAction from world.environment.objects import RandomObjectsGenerator GRAVITY = -9.80...
from sparse_als_soft_impute import SparseSoftImputeALS import numpy as np import graphlab import pandas as pd from sklearn.base import TransformerMixin from scipy.sparse import csr_matrix, csc_matrix, coo_matrix, issparse from sklearn.pipeline import Pipeline from sklearn.grid_search import GridSearchCV from sklearn.me...
<gh_stars>0 """ TFR predictions on test set from log folder """ import os import glob import pickle import numpy as np import pandas as pd from scipy.stats import spearmanr from scipy.stats import pearsonr pd.set_option('display.max_rows', 500) pd.set_option('display.max_columns', 50) pd.set_option('display.width', 10...
<filename>match_filtering/verify_snr.py from __future__ import division import cPickle import numpy as np from scipy import integrate, interpolate from scipy.misc import imsave import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt import lal import lalsimulation from pylal import antenna, co...
from collections import defaultdict, Counter import json import string from pathlib import Path import os from nltk.tokenize import word_tokenize from nltk.corpus import stopwords import pandas as pd import numpy as np from nltk.sentiment.vader import SentimentIntensityAnalyzer import statistics import csv #Fetching ...
import numpy as np import pandas as pd import pickle import math from sklearn.decomposition import PCA from sklearn import preprocessing import matplotlib.pyplot as plt import matplotlib.patches as mpatches from sklearn.preprocessing import StandardScaler from scipy.spatial.distance import pdist, cdist, squareform from...
<gh_stars>1-10 """ Module for feature processing. Includes feature selection and feature engineering algorithms """ import typing as t import numpy as np import pandas as pd import warnings from pyoneer import guards, metrics from pyoneer.base import CorrBasedSelectorMixin from pyoneer import warn_messages as w from s...
<filename>example.py<gh_stars>10-100 import config import sys sys.path.insert(0,config.caffe_path) import os import argparse import pickle import scipy.ndimage as ndimage import numpy as np import calc_horizon parser = argparse.ArgumentParser(description='') parser.add_argument('--gpu', default=0, type=int, help='GPU ...
<filename>src/camera_helper.py from fractions import Fraction def get_settings(camera): """Returns a dictionary of settings of the camera Input: camera: PiCamera camera object Output: settings: Dictionary, the settings of the camera """ settings = {} settings['iso'] = camera.iso...
""" ----------------------------------------------------------------------- Harmoni: a Novel Method for Eliminating Spurious Neuronal Interactions due to the Harmonic Components in Neuronal Data <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME> https://doi.org/10.1101/2021.10.06.463319 ----------------------------...
<reponame>JordiManyer/bddc<filename>src/main1D.py ############################################################################### ##### MAIN PROGRAM ##### ############################################################################### import sys sys.path.append("....
""" This package is used to generate the values of the 1) derivative of function 2) Taylor series 3) Fourier series 4) Legendre approximation 5) Larange approximation 6) Series converenge viewing 7) Limit of a given sequence """ import numpy as np import seaborn as sn...
import numpy as np from scipy.sparse import csr_matrix, lil_matrix from scipy.sparse.linalg import spsolve from numpy.linalg import solve, norm from scipy.spatial import KDTree from math import * from numpy import newaxis import matplotlib.pyplot as plt # constants elem_c = 1.6e-19 eps0 = 8.85e-12 m_elec = 9.11e-31 m_...
<filename>Project_02/Given_Data_and_Code_Skeleton/nnScript.py import numpy as np from scipy.optimize import minimize from scipy.io import loadmat from math import sqrt def initializeWeights(n_in, n_out): """ # initializeWeights return the random weights for Neural Network given the # number of node in the...
import sys,csv,time,calendar from math import log,sqrt import numpy as np from scipy.optimize import minimize from scipy.special import gammaln def datetoday(x): t=time.strptime(x+'UTC','%Y-%m-%d%Z') return calendar.timegm(t)//86400 def daytodate(r): t=time.gmtime(r*86400) return time.strftime('%Y-%m-%d',t) ...
<filename>codigos/fft_audio.py import pyaudio import scipy.io.wavfile as wavfile import matplotlib.pylab as plt import numpy as np import wave from scipy.fft import fft, fftfreq from playsound import playsound ## Reproducir audio playsound('/home/angie/Git/python_dsp/alejandro.wav') ## trear, extraer y gráficar los ...
# coding=utf-8 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import json import sys import kws_streaming.train.test as test import numpy as np import tensorflow.compat.v1 as tf1 import tensorflow as tf import scipy as scipy import scipy.io.wavfile as wav import scipy.signal from kws_streaming.models import models...
<reponame>yotamyaniv/kaczmarz-algorithms """ Dummy conftest.py for clapsolver. If you don't know what this is for, just leave it empty. Read more about conftest.py under: https://pytest.org/latest/plugins.html https://stackoverflow.com/questions/34466027/in-pytest-what-is-the-use-of-conftest-py-files """ import nump...
<filename>scripts/genereate_celeba_syn.py from glob import glob import os import random import scipy.misc as misc import numpy as np import random import argparse parser = argparse.ArgumentParser() parser.add_argument("--syn_type", type=str, choices=["inward", "outward"]) parser.add_argument("--data_dir", type=str) ar...
#-*-coding: utf-8 -*- import numpy as np from scipy.misc import derivative import matplotlib.pyplot as pt #Definicje funkcji def f(x): '''Zwraca wartość dla funkcji eksponencjalnej''' return np.exp(x) def g(x): '''Zwraca wartość dla funkcji exp(-(x**2))''' return np.exp((x**2)*(-1)) def j(x): '...
""" apply SVD on a PPMI matrix to get low-dimensional word embeddings """ import heapq import logging import numpy as np from gensim.models.lsimodel import stochastic_svd from scipy.sparse import linalg logger = logging.getLogger(__name__) try: from sparsesvd import sparsesvd except ImportError: logger.inf...
import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import make_interp_spline, BSpline font = {'family' : 'normal', 'size' : 16} plt.rc('font', **font) # Load data sources data = np.load('results/keep/delay/a.npy') times1 = np.load('results/keep/delay/a_td3.npy') # times1 = np.load(...
<reponame>frhrdr/MMD-GAN import numpy as np import lhsmdu import tensorflow as tf import tensorflow_probability as tfp from sklearn.mixture import GaussianMixture from sklearn.exceptions import ConvergenceWarning import warnings from dp_funcs.net_picker import NetPicker from scipy.stats import multivariate_normal impor...
""" Class for calculation of likelihood of a pixel expectation, given the pixel amplitude, the level of noise in the pixel and the photoelectron resolution. This calculation is taken from: de Naurois & Rolland, Astroparticle Physics, Volume 32, Issue 5, p. 231-252 (2009) https://arxiv.org/abs/0907.2610 The likelihood ...
<reponame>dmilios/dirichletGPC #!/usr/bin/python3 # Copyright 2018 <NAME>, <NAME>, # <NAME>,<NAME>, <NAME> # 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.apa...
# TWO CONNECTED NEURONS from sklearn.svm import LinearSVC from scipy.special import erf import nest import pylab # Create two neurons # Create neurons neuron1 = nest.Create("iaf_psc_alpha") nest.SetStatus(neuron1 , {"I_e": 376.}) neuron2 = nest.Create("iaf_psc_alpha") # Create data gatherer multimeter = nest.Cr...
import numpy as np import pytest import scipy.special as sp import scipy.stats as st import scqtl.simple @pytest.fixture def simulate_pois(): np.random.seed(1) x = np.random.poisson(lam=100, size=1000) return x @pytest.fixture def simulate_nb(): np.random.seed(1) x = st.nbinom(n=3, p=1e-3).rvs(size=1000) ...
import os import time from collections import Counter from functools import partial import numpy as np import scipy.optimize as so from matplotlib.backends.backend_pdf import PdfPages from matplotlib.figure import Figure from matplotlib.animation import FuncAnimation from matplotlib.collections import LineCollection ...
# encoding: utf-8 """ compare.py -- Functions for comparing double-rotation session responses Exoported namespace: mismatch_response_tally, mismatch_rotation, cluster_mismatch_rotation, population_spatial_correlation, correlation_matrix, correlation_diagonals, common_units Created by <NAME> on 2010-02-11. ...
import torch import LoaderFish import os import sys import numpy as np import matplotlib.pylab as plt import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import torch.optim as optim import torch.backends.cudnn as cudnn import geotnf.point_tnf ##########################...
import cv2 import numpy as np import pywt from scipy.fft import dct, idct from .detection_nonsonoprompt import texture_areas, ALPHA, MARK_SIZE, BLOCK_SIZE def embed_into_subband(wav_subband, mark_elements, alpha): mark_end = len(mark_elements) mark_index = 0 modified_subband = np.zeros(np.shape(wav_subba...
<filename>code/pyseg/psd/cleft_batch.py """ Script for extracting an analyzing a GraphMCF with a cleft (v3) 24.03.16 - Modification for not to compute filaments Input: - Density map tomogram - Segmentation tomogram Output: - GraphMCF """ __author__ = '<NAME>' # ################ Packag...
# -*- coding: utf-8 -*- from __future__ import print_function from itertools import combinations, permutations import logging import time import math import numpy as np import networkx as nx from scipy.integrate import quad from indep_test import bincondKendall, discondKendall, wrapped_ci_test_bin, wrapped_ci_test_d...
<reponame>oasys-kit/wofryimpl<filename>wofryimpl/propagator/test/propagators2D_test.py import unittest import numpy # # Note that the tests for the Fraunhofer phase do not make any assert, because a good matching has not yet been found. # from syned.beamline.shape import Rectangle, Ellipse from syned.beamline.eleme...
#!/usr/bin/env python3 """Functions to generate completions of operators with explicit SU(2) structure.""" from neutrinomass.tensormethod.core import ( Index, Field, IndexedField, eps, delta, is_invariant_symbol, Operator, get_dynkin, D, ) from neutrinomass.tensormethod.contract im...
<filename>FASTQ_Preprocess.py """ @author: <NAME> University of North Carolina at Chapel Hill Chapel Hill, NC 27599 @copyright: 2019 """ import datetime import os import collections import subprocess import argparse import sys import time from distutils.util import strtobool from scipy.stats import ...
<reponame>irenetrampoline/clustering-interval-censored import logging import numpy as np import torch import torch.nn as nn import torch.nn.functional as F # torch.manual_seed(0) # torch.backends.cudnn.deterministic = True # torch.backends.cudnn.benchmark = False from pyro.distributions import MultivariateNormal, No...
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Tue Aug 18 07:47:32 2020 @author: Sujit Time Series Analysis """ import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline plt.style.use('fivethirtyeight') df = pd.read_csv('international-airli...
#!/usr/bin/env python # coding: utf-8 # In[1]: def TestData(data): print(type(data)) print(data) castdata=list(data) print(type(castdata)) print(castdata) return False # In[ ]: def AutoSBTest( inputs_train,outputs_train): # firstmodel from sklearn.neural_network import MLPReg...
<gh_stars>0 from django.shortcuts import render, redirect from django.http import HttpResponse from django.contrib.auth import authenticate, login, logout from django.contrib.auth.models import User from django.contrib import messages from crypto.models import crypto from ssim.models import ssim from sympy import * d...
import numpy as np import sys sys.path.append('../') from Pipeline import DPA import hdbscan import sklearn.cluster as cluster import matplotlib.pyplot as plt import scipy as sp from sklearn import manifold from scipy import cluster from matplotlib.collections import LineCollection from math import sqrt from sklearn.me...
<filename>model.py<gh_stars>0 """ Model implementation """ import numpy as np # Numerical computing from scipy.integrate import odeint # ODE system numerical integrator from scipy.optimize import curve_fit ABSERR = 1.0e-8 RELERR = 1.0e-6 DAYS = 7 NUMPOINTS = DAYS def call_solver(func, p, w0, t): """ Intern...
<filename>examples/paper_examples/nnls_reg.py """ Copyright 2019 <NAME>, <NAME> This file is part of A2DR. A2DR 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...
<reponame>wangleon/stella #!/usr/bin/env python3 import math import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from astropy.coordinates import SkyCoord from stella.catalog import HIP2 from stella.kinetics import potential from stella.kinetics ...
# -*- coding: utf-8 -*- # @Author: <NAME> # @Date: 2016-11-22 20:41:39 # @Last Modified by: <NAME> # @Last Modified time: 2016-12-14 22:09:28 from __future__ import division import numpy as np from numpy import linalg as LA from scipy.stats import gamma from itertools import permutations, combinations from sklearn....
# -*- coding: utf-8 -*- # Copyright 2018 the HERA Project # Licensed under the MIT License from hera_cal import io from hera_cal import smooth_cal from hera_cal.datacontainer import DataContainer import numpy as np import unittest from copy import deepcopy from pyuvdata.utils import check_histories from pyuvdata impor...
<gh_stars>10-100 """Utilities for strongly connected components""" from typing import Dict, List, Tuple import numpy from scipy.sparse import csr_matrix from scipy.sparse.csgraph import connected_components from .graph import Node, Nodes, Graph NodeIndexes = Dict[Node, int] def get_graph_csr_matrix(graph: Graph, nod...
# Copyright 2018 <NAME> & <NAME> # # 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 required by applicable law or agreed to i...
<reponame>wtysos11/k8sPredictor # Birch论文 A BIRCH-Based Clustering Method for Large Time Series Databases # 固定读取部分 import time foreignTime = time.time() import os fileName = 'result.txt' dataPath = "E:\\code\\myPaper\\k8sPredictor" #返回一个词典,词典的key为第二项,value为一个列表,所有列表都应该等长 def ReadDataFromFile(): LocalPath = os.path....
import numpy as np from scipy.io import wavfile from scipy.signal import butter, lfilter class Signal: def __init__(self, path): self._path = path self._rate, self._data = self._load() def _load(self): return wavfile.read(self._path) @property def data(self): return ...
<gh_stars>0 __description__ = \ """ ordered_ternary_association.py Model for a ternary association, where a pair of the components are assumed to be at identical total concentrations. """ __author__ = "<NAME>" __date__ = "20th Aug 2019" import numpy as np from scipy.optimize import root as solve_mass_bala...
import numpy as np import pydart2 as pydart import math import IKsolve_double_stance import copy from scipy import interpolate from fltk import * from PyCommon.modules.GUI import hpSimpleViewer as hsv from PyCommon.modules.Renderer import ysRenderer as yr render_vector = [] render_vector_origin = [] push_force = [] pu...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ :mod:`decision_stump` ================== .. module:: decision_stump :platform: Unix, Windows :synopsis: .. moduleauthor:: hbldh <<EMAIL>> Created on 2014-08-31, 01:52 """ from __future__ import division from __future__ import print_function from __future__ im...
# -*- coding: utf-8 -*- import random import sys import datetime import csv import itertools from scipy.stats import poisson import networkx as nx class AbstractSimulation: """ Functions for the simulation of interactions between proteins that are needed independently from the consideration of protein p...
<reponame>maria-kuruvilla/temp_collective_code<filename>annd_batch.py # -*- coding: utf-8 -*- """ Created on Sun May 10 2020 @author: <NAME> Goal - Code to analyse all the tracked videos and calculate annd and save it as pickled file. """ import sys, os import pathlib from pprint import pprint import numpy as np f...
<gh_stars>0 #!/usr/bin/env python import argparse import subprocess import re import sys from scipy import special import numpy parser = argparse.ArgumentParser(description='for building pages from combos, input trans:hgvs;trans:hgvs;trans:hgvs\tlabelID') parser.add_argument("--mut", help="Batch output",required=True)...
<gh_stars>0 import skimage.io as io import numpy as np import tensorflow as tf import scipy.misc import openslide from resnet import Resnet def readTif (name : str): X = openslide.OpenSlide (name) X = X.read_region ((0,0),0,(X.dimensions[0],X.dimensions[1])) X = np.array (X, dtype='uint8') return X def ratioW...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 7 08:46:25 2022 This script calculates the 90th percentile threshold of climatological daily maximum temperatures, centred on a 31 d window, for the base period 1981–2010. This threshold is used in the calculation of heatwave magnitude index. The ...
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from DataStat import Handeler from pathlib import Path from sklearn.preprocessing import LabelEncoder from scipy import stats from scipy.stats import norm, skew def make_dir(file_path): if not os.path.exists(fil...
import open3d as o3d from scipy.spatial import ConvexHull import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt import scipy.stats as stats from scipy.spatial.distance import euclidean def bins_stat(x, y, number_of_bins): xmin, xmax = x.min(), x.max() ymin, ymax = y.min(), y.max() binx ...
import numpy as np from scipy.interpolate import LinearNDInterpolator, griddata import time global precision precision = 0.1 def func(x, y): return x*(1-x)*np.cos(4*np.pi*x) * np.sin(4*np.pi*y**2)**2 def my_interp(points, vals): numpoints = len(vals) A = np.empty(shape = (numpoints,4)) for idx, point in enumer...
# -*- coding: utf-8 -*- """ Created on Sun Dec 1 01:06:06 2019 @author: YQ """ from model import MusicVAE from scipy.io import wavfile import pretty_midi import numpy as np import tensorflow as tf import argparse tf.reset_default_graph() ap = argparse.ArgumentParser() ap.add_argument("--ckpt_path", default="vae_m...
<reponame>alexsavio/aizkolari #!/usr/bin/python #------------------------------------------------------------------------------- #License GPL v3.0 #Author: <NAME> <<EMAIL>> #Grupo de Inteligencia Computational <www.ehu.es/ccwintco> #Universidad del Pais Vasco UPV/EHU #Use this at your own risk! #2012-01-31 #----------...
""" ================================= Travelling Salesman Problem (TSP) ================================= Implementation of approximate algorithms for solving and approximating the TSP problem. Categories of algorithms which are implemented: - Christofides (provides a 3/2-approximation of TSP) - Greedy - Simulated A...
<filename>simulation-data/kuramoto.py<gh_stars>1-10 # -*- coding: utf-8 -*- from NNetwork import NNetwork """ Fun Colors""" fun_colors = ['Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', '...
try: # import version included with old SymPy from sympy.mpmath import mp except ImportError: # import newer version from mpmath import mp print("how many digits of pi do you want? I can give you that many digits up to 1000") #with imported library we can set precision of pi with mp.dps mp.dps = input...
<gh_stars>1-10 import pandas as pd from scipy.stats import chi2_contingency, ttest_ind from .plots import plot_categorical, plot_numerical def split_classes(X, Y, label): """ Returns the splited value of the dataset using the requested label Args: X (pd.DataFrame): Main dataset with the variables ...
import sys import pickle import numpy as np import scipy from opengl_viewer.opengl_viewer import OpenGlViewer from ntu_rgb import NTU from sysu_dataset import SYSU def record_multiple_voxel_flow(): # dataset = NTU() dataset = SYSU() all_voxels = [] for vid in range(int(sys.argv[1]) - 12, int(sys.argv[...
from itertools import accumulate as _accumulate from operator import add as _add import numpy as _np from scipy import signal as _signal from scipy.stats import norm as _norm def reshape(u_seq): if (ndim:=u_seq.ndim) == 1: u_seq = u_seq.reshape(len(u_seq), 1) elif ndim >= 3: raise NotImplement...
r"""@package motsfinder.numutils Miscellaneous numerical utilities and helpers. @b Examples ``` >>> binomial(5, 3) 10 ``` """ from contextlib import contextmanager import warnings from scipy.linalg import LinAlgWarning from scipy.integrate import fixed_quad, IntegrationWarning from scipy.interpolate impor...
import sys import random import pickle from tqdm import tqdm try : import numpy as np except ModuleNotFoundError as error: numpy = None print("numpy module not found") try : import scipy.spatial.transform except ModuleNotFoundError as error: scipy = None print("scipy module not found") try : ...
<filename>BAMnet/src/core/build_data/utils.py ''' Created on Sep, 2017 @author: hugo ''' import os import datetime import shutil from collections import defaultdict import numpy as np from scipy.sparse import * RESERVED_TOKENS = {'PAD': 0, 'UNK': 1} def built(path, version_string=None): """Checks if '.built' f...
import os import torch import numpy as np import math import scipy from htvlearn.lattice import Lattice from htvlearn.delaunay import Delaunay from htvlearn.grid import Grid class Hex(): """Hexagonal lattice vectors""" v1 = Lattice.hexagonal_matrix[:, 0].numpy() v2 = Lattice.hexagonal_matrix[:, 1].numpy...
<reponame>xinranzhu/GPTune-1<filename>examples/GCN/gcn_MB.py #! /usr/bin/env python # GPTune Copyright (c) 2019, The Regents of the University of California, # through Lawrence Berkeley National Laboratory (subject to receipt of any # required approvals from the U.S.Dept. of Energy) and the University of # California,...
from django.http import HttpResponse, JsonResponse import boto3 import json import io import base64 from django.conf import settings from PIL import Image import math import numpy import os from scipy.optimize import linear_sum_assignment from scipy.spatial.distance import euclidean, cosine def infer(image0, boxes0, ...
# -*- coding: utf-8 -*- import numpy import scipy from .redfieldtensor import RedfieldRelaxationTensor from ...core.time import TimeDependent class TDRedfieldRelaxationTensor(RedfieldRelaxationTensor, TimeDependent): def _implementation(self, ham, sbi): """ Reference implementation, complet...
<filename>examples/bicycle/inertial_param_convert.py<gh_stars>1-10 from pydy import * from sympy import * from bicycle_lib_hand import mj_params as mj_p # Reference frames N = NewtonianReferenceFrame('N') (q,), (qd,) = N.declare_coords('q', 1) lmbda=q var('rr rrt rf rft xb zb xh zh mc md me mf mr mb mh w c') var('xr...
<filename>mGST/additional_fns.py<gh_stars>1-10 import random import warnings import numpy as np import numpy.linalg as la from scipy.linalg import expm from scipy.linalg import qr from scipy.optimize import root_scalar from low_level_jit import local_basis,contract,MVE_lower,Mp_norm_lower def transp(dim1,dim2): ...
<gh_stars>0 ''' Initially written by <NAME> in MATLAB Rewritten in Python by <NAME> (<EMAIL>), 2021 ''' import numpy as np import scipy.linalg from scipy.sparse import csr_matrix from scipy.sparse.linalg import spsolve import argparse import matplotlib.pyplot as plt from solvers import * from utils...
# coding=utf-8 import numpy as np import scipy.sparse as sparse from hyperg.hyperg import HyperG def test_hyperg(): edge_idx = np.array([0, 0, 1, 1, 2, 2, 2]) node_idx = np.array([0, 1, 2, 3, 0, 1, 4]) val = np.array([0.1, 0.3, 0.2, 0.5, 0.6, 0.1, 0.3]) H = sparse.coo_matrix((val, (node_idx, edge_i...
import logging from msnlp.config import TaskName from msnlp.config import WORD_SIMILARITY_PATH from msnlp.config import WORD_SIMILARITY_PARAMS import torch from transformers import AutoModel, AutoConfig, AutoTokenizer, AlbertForMaskedLM, BertTokenizer, BertModel from scipy.spatial.distance import cosine import numpy a...
import pathlib import reprlib from typing import Optional, Union import numpy as np import scipy.io from .. import validators SPECT_FILE_LOADING_FUNCTIONS = { 'mat': scipy.io.loadmat, 'npz': np.load, } VALID_SPECT_FILE_FORMATS = tuple(SPECT_FILE_LOADING_FUNCTIONS.keys()) VALID_KEYS = ('s', 'f', 't', 'audi...
import numpy as np import cv2 import glob from scipy.misc import imread, imresize, imsave import matplotlib.pyplot as plt # %matplotlib qt # prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0) objp = np.zeros((6*9,3), np.float32) # print("objp") # print(objp) objp[:,:2] = np.mgrid[0:9,0:6].T.reshape(-1,...
<filename>bihgpy/posterior.py import numpy as np from scipy.special import comb from scipy.special import beta from scipy.special import gamma import tqdm from .check import initial_checks binom_coef_exact = True def K_posterior_value(N,n,K,k,a=1,b=1): return comb(a+K,a+k,exact=binom_coef_exact)*comb(b+N-K,b+n-k...
'''Predict OCR images using keras model. ''' import os import itertools import numpy as np from tensorflow.python import keras from tensorflow.python.keras.preprocessing import image from scipy import ndimage from PIL import Image, ImageDraw, ImageFont # digit classes # alphabet = u'0123456789 ' # English characters...
import os import h5py import argparse import pandas as pd import numpy as np import json import seaborn as sns import matplotlib.pyplot as plt from scipy.spatial import distance parser = argparse.ArgumentParser() parser.add_argument( "--partition_file", type=str, default="data/partition_fil...
<filename>utils.py import numpy as np import math from sklearn import preprocessing from sklearn.model_selection import train_test_split import pickle as pkl import geopandas as gpd from geopandas import GeoSeries from shapely.geometry import LineString,MultiLineString import scipy.sparse as sp import pandas as pd im...
<gh_stars>100-1000 import gpflowopt import numpy as np import pytest import gpflow import six import sys import os import warnings from contextlib import contextmanager from scipy.optimize import OptimizeResult from ..utility import vlmop2, create_parabola_model, create_vlmop2_model, GPflowOptTestCase def parabola2d(...
<gh_stars>0 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from sys import argv import h5py import pickle import numpy as np from scipy.misc import imread from scipy.misc import imresize # TODO Change parameters to different file, or take them a...
<gh_stars>0 from scipy.io import loadmat import numpy as np ''' test_mat_file = '../GazeFollowData/test2_annotations.mat' prediction_file = 'multi_scale_concat_prediction.npz' anns = loadmat(test_mat_file) gazes = anns['test_gaze'] eyes = anns['test_eyes'] N = anns['test_path'].shape[0] prediction = np.load(predicti...
<gh_stars>10-100 import os import sys import tempfile import yaml import zlib import numpy as np import simplejson as js import subprocess as sb from time import time,sleep from os import path from scipy.stats.mstats import mquantiles try: from sklearn.lda import LDA from sklearn.svm import SVC from sklear...
import json import pickle import matlab import scipy import numpy as np import os import yaml from EDL.dialogue.MatEngine_object import eng1 from EDL.dialogue.func_helpers import CalculateFuncs, ScorecardDataFrameFuncs, get_variable_info, correlation_multiprocessing from EDL.models import EDLContextScorecards from d...
import unittest import numpy as np import sympy as sp from graphik.robots.robot_base import RobotSpherical from graphik.solvers.local_solver import LocalSolver from graphik.graphs.graph_base import RobotSphericalGraph from graphik.utils.utils import list_to_variable_dict, list_to_variable_dict_spherical from liegroup...
<reponame>philipperemy/keras-mode-normalization<gh_stars>1-10 # https://github.com/aditya9211/SVHN-CNN import numpy as np import scipy.io as sio def load_data(): """Loads the SVHN dataset. # Returns Tuple of Numpy arrays: `(x_train, y_train), (x_test, y_test)`. """ train = sio.loadmat('svhn/t...
import os from styx_msgs.msg import TrafficLight import tensorflow as tf import numpy as np from PIL import Image from PIL import ImageDraw from scipy.stats import norm import scipy import scipy.misc import time import cv2 SSD_GRAPH_FILE = '../../frozen_models/ssd_inception_v2_coco_2017_11_17/frozen_inference_graph.pb...
<gh_stars>1-10 import distcan as dc import numpy as np from numpy.testing import assert_allclose import scipy as sp import scipy.stats as st # Get some random places to check pdf np.random.seed(1234) x = np.random.rand(10) # Create chi distributions chi_dc = dc.univariate.Chi(5) chi_sp = st.chi(5) # Check chi cdfs/...