text string |
|---|
# Copyright 2018 The TensorFlow Probability Authors.
#
# 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 o... |
import sys
sys.path.append('../')
sys.path.append('../../')
import datetime
from math import floor
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage.interpolation import rotate
import tensorflow as tf
from tensorflow.keras.layers import Dense, Flatten, Conv3D, \
... |
<reponame>Dosenpfand/networkx<gh_stars>0
from nose import SkipTest
import networkx as nx
from networkx.generators.degree_seq import havel_hakimi_graph
class TestModularity(object):
numpy = 1 # nosetests attribute, use nosetests -a 'not numpy' to skip test
@classmethod
def setupClass(cls):
globa... |
################################################################################
#
# Package : AlphaPy
# Module : data
# Created : July 11, 2013
#
# Copyright 2017 ScottFree Analytics LLC
# <NAME> & <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... |
# -*- coding: utf-8 -*-
"""
This script works for foam phantom.
"""
import numpy as np
import glob
import dxchange
import matplotlib.pyplot as plt
import scipy.interpolate
import tomopy
from scipy.interpolate import Rbf
from mpl_toolkits.mplot3d.axes3d import Axes3D
from matplotlib import cm
from project import *
fro... |
<reponame>peter0749/Music_Genre_Classification<filename>test.py
# -*- coding: utf-8 -*-
### 參考 keras/example 裡的 neural_style_transfer.py
### 詳細可到這裡觀看他們的原始碼:
### https://github.com/fchollet/keras/blob/master/examples/neural_style_transfer.py
from __future__ import print_function
import sys
import os
import os.path
impor... |
"""
Author: <NAME>
Description: Class to abstract an abundance table and methods to run on such a table.
"""
#####################################################################################
#Copyright (C) <2012>
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of
#this software and ... |
<filename>experiments/mj60/optimizer.py
#!/usr/bin/env python3
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('clint.mpl')
from pprint import pprint
import scipy.signal as signal
from pygama import DataSet
import pygama.utils as pu
import pygama.analysis.histograms as ph... |
<filename>graphgallery/datasets/reddit.py
import os.path as osp
import numpy as np
import scipy.sparse as sp
import pickle as pkl
from typing import Optional, List
from graphgallery import functional as gf
from .in_memory_dataset import InMemoryDataset
from ..data.graph import Graph
class Reddit(InMemor... |
import glob
import os
import asset_production_tools as apt
import numpy as np
import pandas as pd
import scipy.interpolate as interp
import scipy.ndimage as ndimage
import scipy.signal as signal
import sunpy.map as smap
import sunpy.image.coalignment as coalign
import astropy.units as u
from astropy.coordinates import ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 12 18:01:06 2021
@author: rachel
"""
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%% constrained 3-exp fit %%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
<gh_stars>1-10
#%%
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from giskard.plot import set_theme
from graspologic.simulations import sbm
from pkg.stats import stochastic_block_test
from scipy.stats import ks_1samp, uniform
set_theme()
B = np.array([[0.4, 0.1], [0.1, 0... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 17 12:06:45 2020
@author: biomet
"""
import numpy as np
import pandas as pd
import scipy as sp
from statsmodels.stats.multitest import fdrcorrection
import itertools
from scipy import interp
from itertools import cycle
from sklearn.utils import check_rand... |
<reponame>smartalecH/pyWMM
# ---------------------------------------------------------------------------- #
#
# ---------------------------------------------------------------------------- #
import numpy as np
from matplotlib import pyplot as plt
from pyWMM import WMM as wmm
from pyWMM import mode
from pyWMM import CM... |
"""
CoNLL-2011/2012 scores for coreference detection.
## References
- **Scoring Coreference Partitions of Predicted Mentions: A Reference Implementation.** <NAME>, <NAME>, <NAME>, <NAME>, <NAME> and <NAME>. *Proceedings
of the 52nd Annual Meeting of the Association for Computational Linguistics*, Baltimore, MD,
June... |
import numpy as np
import pandas as pd
import itertools
from scipy.sparse import csr_matrix
from pegasusio import VDJData, MultimodalData
def load_10x_vdj_file(input_csv: str, genome: str = None, modality: str = None) -> MultimodalData:
"""Load VDJ data from a 10x CSV file
Parameters
----------
inp... |
# -*- coding: utf-8 -*-
from sympy.physics.quantum import Operator, Dagger
from sympy.physics.quantum.qexpr import QExpr
from sympy import I, conjugate
from sympy import S
from sympy import Function, Wild, Mul, Pow
from sympy import sympify
class CumulantException(Exception):
pass
"""
Cumulant express... |
'''
@author : <NAME>
@project : Emotion Recog from EEG
'''
from numba import jit
from math import factorial, log
from sklearn.neighbors import KDTree
from scipy.signal import periodogram, welch
from .utils import _embed
import csv
from collections import defaultdict
import numpy as np
from scipy.signa... |
<gh_stars>0
#!/usr/bin/python
# also supports python3
#
# version 2.0 of this script
#
# is_regression.py - statistical test for performance throughput regression
# based on python scipy.stats.ttest_ind() function
#
# we input two sets of samples:
# the baseline sample set -- used as an indication of previously achie... |
"""Methods to calculate internal coordinates from the cartesian coordinates"""
import numpy as np
import scipy.linalg
from itertools import combinations, ifilter
import logging
from contact import atom_distances
from dihedral import compute_dihedrals
from angle import bond_angles
from scipy.spatial.distance import sq... |
from tflearn.data_augmentation import DataAugmentation
import random
import numpy as np
import scipy
class ImageAugmentation3d(DataAugmentation):
""" Image Augmentation in 3d.
Base class for applying real-time augmentation related to images.
This class is meant to be used as an argument of `input_data`. Wh... |
<gh_stars>0
import numpy as np
import scipy.io.wavfile
from scikits.talkbox.features import mfcc
import sys
if len(sys.argv) < 2:
exit()
file_name = sys.argv[1]
sample_rate, X = scipy.io.wavfile.read(file_name)
ceps, mspec, spec = mfcc(X)
print ceps.shape
x = []
num_ceps = len(ceps)
x.append(np.mean(ceps[int(nu... |
<filename>benchmarks/benchmarks/sparse_csgraph_maxflow.py
import numpy as np
import scipy.sparse
try:
from scipy.sparse.csgraph import maximum_flow
except ImportError:
pass
from .common import Benchmark
class MaximumFlow(Benchmark):
params = [[200, 500, 1500], [0.1, 0.3, 0.5]]
param_names = ['n', '... |
<filename>scipy_optimize/scipy_leastsq.py
import numpy as np
from scipy import optimize
def f(x):
return x**2 - 1
def main():
res = optimize.leastsq(f, 10.0)
print(res)
if __name__ == "__main__":
main()
|
<filename>melp/taft/corrections/misc_corrections.py
import numpy as np
from scipy.optimize import minimize
# ---------------------------------------
def loop_correction_phi(detector, dt_phi_rel: dict, station: int):
print("*Simple correction phi (sum loop)")
for z in range(len(detector.TileDetector.row_ids(0,... |
from sympy import Symbol
from sympy.codegen.ffunctions import isign, dsign, cmplx, kind, literal_dp
from sympy.printing.fcode import fcode
def test_isign():
x = Symbol('x', integer=True)
assert isign(1, x) == isign(1, x)
assert fcode(isign(1, x), standard=95, source_format='free') == 'isign(1, x)'
def t... |
<filename>nortek/arrays.py<gh_stars>1-10
from __future__ import print_function
import numpy
import numpy.random
import scipy.stats
import scipy.signal
import scipy
AF = None
# implement logging in this module
class GenericDataArray(dict):
# base class for single sample volume data (e.g. Vectrino, Vector, current met... |
#/usr/bin/python
from __future__ import print_function
import argparse
import torch
import pickle
import numpy as np
import os
import math
import random
import sys
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.io
import data
from sklearn.decomposition import PCA
from torch import nn, opt... |
<gh_stars>1-10
import pandas as pd
import os
from pitch import get_pitch
from mfcc import get_mfcc
import librosa
import scipy.io.wavfile as wav
def extract_features(path):
df = pd.DataFrame()
print('Extracting features')
freq_col=['pitch']
mfcc_col=['mfcc'+str(i+1) for i in list(range(110))]
... |
"""Tests that the IPython printing module is properly loaded. """
from sympy.interactive.session import init_ipython_session
from sympy.external import import_module
from sympy.utilities.pytest import raises
# run_cell was added in IPython 0.11
ipython = import_module("IPython", min_module_version="0.11")
# disable ... |
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
from copy import deepcopy
from dace.sdfg.state import SDFGState
import functools
import itertools
import warnings
from sympy.functions.elementary.complexes import arg
from dace import data, dtypes, registry, memlet as mmlt, subsets, symbolic,... |
from fractions import Fraction
from decimal import Decimal
from collections import Counter
import itertools as it
from math import factorial
from dice_roller.DiceParser import DiceParser
from dice_roller.DiceThrower import DiceThrower
import sympy
class DiceProbability(object):
parser = DiceParser()
def calc... |
"""Ground types for various mathematical domains in Diofant. """
__all__ = ()
import builtins
import fractions
import mpmath.libmp as mlib
from ..core.compatibility import HAS_GMPY
from ..core.numbers import Float as DiofantReal # noqa: F401
from ..core.numbers import Integer as DiofantInteger # noqa: F401
from .... |
<gh_stars>0
from PIL import Image
from skimage import img_as_int
import cv2
import numpy as np
from pylab import *
import scipy.ndimage.filters as filters
img = cv2.imread('images/profile.jpg', 0)
#img = cv2.imread('images/moon.jpg',0)
laplacian_operator_pos = np.array([
[0, -1, 0],
[-1, 4 ,-1],
[0... |
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from scipy import polyfit, polyval, stats
import pandas as pd
# from mytext import textTL, textTR
import statsmodels.api as sm
from patsy import dmatrices,ModelDesc,Term,LookupFactor
from copy import deepcopy
i... |
# This module contains the model class
import logging
import os
import itertools
import numpy as np
import pandas as pd
from astropy import constants, units as u
import scipy.special
from util import intensity_black_body
from tardis.montecarlo import montecarlo
from tardis.montecarlo.base import MontecarloRunner
fro... |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from scipy import optimize
import pint
import math
u = pint.UnitRegistry()
# Constants
n_crew = 4
n_passengers = 50
n_people = n_passengers + n_crew
weight_per_passenger = 100 * u.kg
Swet_Sref = 6
AR = 8
K_ld = 15.5
Rcr = 2000 * u.km
Eltr = 45 * ... |
<reponame>DanielKotik/Optical-beams-MEEP<gh_stars>1-10
import sys
try:
import cython
cython_imported = True
except ModuleNotFoundError:
cython_imported = False
if cython_imported:
if cython.compiled:
from scipy import LowLevelCallable
else:
print("\nPlease consider compiling `%s.p... |
<filename>mediagrains/hypothesis/strategies.py<gh_stars>1-10
# Copyright 2018 British Broadcasting Corporation
#
# 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/li... |
<filename>straindesign/glpk_interface.py
from scipy import sparse
from numpy import nan, isnan, inf, isinf, sum
from straindesign.names import *
from typing import Tuple, List
from swiglpk import *
# Collection of GLPK-related functions that facilitate the creation
# of GLPK-object and the solutions of LPs/MILPs with ... |
<gh_stars>1-10
from unittest import TestCase
import anndata
import numpy as np
from scvi.dataset import (
AnnDatasetFromAnnData,
DownloadableAnnDataset,
CellMeasurement,
GeneExpressionDataset,
)
from .utils import unsupervised_training_one_epoch
import scipy.sparse as sp_sparse
class TestAnnDataset(... |
"""
This module contains common special functions such
as trigonometric functions, orthogonal polynomials, the gamma function,
and so on.
"""
from sympy.functions.special.gamma_functions import gamma, lowergamma, uppergamma
from factorials import factorial, binomial2, rising_factorial, \
falling_factoria... |
<reponame>KOLANICH-ML/rbfopt<gh_stars>100-1000
"""Routines for a local search to refine the solution.
This module contains all functions that are necessary to implement a
local search to refine the solution quality. The local search exploits
a linear model of the objective function.
Licensed under Revised BSD license... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 14 12:29:15 2018
@author: Pooja
"""
#Bounding Boxes and Segmented Images
import os
import numpy as np
import cv2
import pandas as pd
from IPython.display import Image #images from file
from matplotlib import pyplot as plt #cv2 images
from scipy.io import lo... |
#!/usr/bin/env python
from random import randrange, choice, shuffle, randint, seed, random
from math import sqrt
from collections import deque, defaultdict
from fractions import Fraction
import operator
import string
from game import Game
from copy import deepcopy
try:
from sys import maxint
except ImportError:
... |
'''
Copyright 2018 <NAME> and <NAME>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redi... |
<filename>yolo/backend/utils/eval/_box_match.py
# -*- coding: utf-8 -*-
import numpy as np
# from sklearn.utils.linear_assignment_ import linear_assignment
from scipy.optimize import linear_sum_assignment
class BoxMatcher(object):
"""
# Args
boxes1 : ndarray, shape of (N, 4)
(x1, y... |
<filename>molz/molz.py<gh_stars>0
from typing import Tuple, List, Union
from tabulate import tabulate
import tqdm
import numpy as np
import scipy.stats as stats
import pandas as pd
from pandasql import sqldf
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
from rdki... |
<reponame>austinpursley/audio-evo-algo
#https://makersportal.com/blog/2018/9/13/audio-processing-in-python-part-i-sampling-and-the-fast-fourier-transform
from scipy.io import wavfile
import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
plt.style.use('ggplot')
seed_audio_name = 'bruh2.wav'
rate, da... |
import numpy as np
from scipy.spatial.distance import euclidean
from wepy.runners.openmm import GET_STATE_KWARG_DEFAULTS
from wepy.resampling.distances.distance import Distance
from wepy.boundary_conditions.receptor import UnbindingBC
from openmmtools.testsystems import LennardJonesPair
from wepy_tools.sim_makers.op... |
import torch
from torch.utils.data import DataLoader
from torchvision import transforms
import matplotlib.pyplot as plt
import unet
import numpy as np
import dataset
from PIL import Image
import nibabel as nib
from scipy import ndimage
import os
import csv
import json
from tqdm import tqdm
import collections
from evalu... |
# Python modules
import os
import struct
# 3rd party modules
import pydicom
import numpy as np
from scipy.spatial.transform import Rotation
# Our modules
import vespa.analysis.fileio.raw_reader as raw_reader
import vespa.common.util.config as util_config
import vespa.common.util.misc as util_misc
from vespa.analysis.... |
"""
img.py
======
Helper functions for working with images.
Created by <NAME> (email: <EMAIL>)
"""
from typing import Tuple, Optional, Dict, Union, List
from collections import OrderedDict
import numpy as np
import cv2
from scipy import fftpack, ndimage
from sklearn.feature_extraction.image import extract_patches_2d... |
<reponame>ggml1/Speaker-Recognition
import os
from tqdm import tqdm
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import wavfile
from math import ceil, floor
from python_speech_features import mfcc, logfbank
import librosa
def plot_signals(signals, quantidade_locutores):
fig,... |
<filename>model/model.py<gh_stars>10-100
import numpy as np
import tensorflow as tf
import tflearn
from tensorflow.contrib.layers.python.layers import batch_norm
import random
import pickle
import scipy.ndimage as nd
import scipy
import math
import svgwrite
from svgwrite.image import Image as svgimage
from PIL impor... |
<filename>process/steps/make.py<gh_stars>1-10
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import stft
from os import remove as remove_file
from glob import glob
from tqdm import tqdm
from more_itertools import grouper,windowed
from joblib import Parallel,delayed
import json
... |
import numpy as np
import sympy as sp
from ..base_config import BaseConfig
class Config(BaseConfig):
""" Robot config file for the onelink arm
Attributes
----------
REST_ANGLES : numpy.array
the joint angles the arm tries to push towards with the
null controller
_M_LINKS : sympy.... |
<reponame>Qi-Xian/HW3-GAN-Dissection<filename>netdissect/actviz.py
import os
import numpy
from scipy.interpolate import RectBivariateSpline
def activation_visualization(image, data, level, alpha=0.5, source_shape=None,
crop=False, zoom=None, border=2, negate=False, return_mask=False,
**kwargs):
... |
import torch
from ND_Crossentropy import CrossentropyND, TopKLoss
from torch import nn
from scipy.ndimage import distance_transform_edt
import numpy as np
def softmax_helper(x):
# copy from: https://github.com/MIC-DKFZ/nnUNet/blob/master/nnunet/utilities/nd_softmax.py
rpt = [1 for _ in range(len(x.size()))]
... |
<reponame>liaojh1998/cross-modal-concept2robot
#!/usr/bin/env python3
import time
import math
from datetime import datetime
from time import sleep
import numpy as np
import random
import cv2
import os
import argparse
import torch
from math import sin,cos,acos
import matplotlib.pyplot as plt
from scipy.spatial.transfor... |
#!/usr/bin/env python3
import os
import numpy as np
import operator
import argparse
import re
import json
from collections import defaultdict
from statistics import mean, stdev
from gensim.models import Word2Vec, KeyedVectors
from gensim import matutils
import pytrec_eval
parser = argparse.ArgumentParser()
parser.add... |
<reponame>LiuHaolan/models
import oneflow as flow
import oneflow.nn.functional as F
import yaml
import pickle
from model import AE
from utils import *
from functools import reduce
from argparse import ArgumentParser, Namespace
from scipy.io.wavfile import write
from preprocess.tacotron.utils import melspectrogram2wav
f... |
from ase import units
import numpy as np
from scipy.stats import linregress
from cemc.wanglandau.wltools import get_formula
from scipy.stats import linregress
class WangLandauSGCAnalyzer( object ):
def __init__( self, energy, dos, atomic_numbers, chem_pot=None ):
"""
Object for analyzing thermodyna... |
import errortools
import numpy as np
import scipy.stats
import pytest
from matplotlib.backends.backend_pdf import PdfPages
import os
np.random.seed(42)
p_true = np.array([1, 0, -0.25])
b_true = 1.
ndata = 1000
X = np.random.uniform(low=-1, high=1, size=len(p_true) * ndata).reshape((ndata, len(p_true)))
y = (scipy.st... |
<reponame>alex123012/Bioinf_HW
from scipy.stats import binom
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
def bin_nll(data):
probs = np.arange(0.01, 1, 0.01)
x = list(range(max(data), int((data.mean() + 1) * 2 + 10)))
y = [[np.log(binom.pmf(data, n, p)).sum(... |
<reponame>henryzord/AUTOCVE-star
from multiprocessing import set_start_method
try:
set_start_method("spawn")
except RuntimeError:
pass # is in child process, trying to set context to spawn but failing because is already set
import os
import json
import time
import argparse
import numpy as np
import pandas as... |
""" Contains the Parameter class.
Copyright (c) 2014 <NAME>
See LICENSE for details
"""
from sympy import Symbol
from pysolve import InvalidNameError
from pysolve.variable import Variable
class Parameter(Symbol):
""" This class contains a 'parameter'. This is an exogenous
variable. The solve... |
<gh_stars>0
# coding=utf-8
# Copyright 2022 The TensorFlow GAN Authors.
#
# 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 ... |
# from configs.hparams import create_hparams
from hparams import create_hparams
from concurrent.futures import ProcessPoolExecutor
from functools import partial
import numpy as np
import librosa
from utils import read_wav_np
import os
hparams = create_hparams()
from scipy.io.wavfile import write
import torch
import glo... |
<reponame>joshua-gould/anndata
from __future__ import annotations
from os import PathLike
from collections.abc import Mapping
from functools import partial
from typing import Union
from types import MappingProxyType
from warnings import warn
import h5py
import numpy as np
import pandas as pd
from scipy import sparse
... |
<reponame>dxm447/ptychogpu
import numpy as np
import scipy as sp
import warnings
from scipy import ndimage as scnd
import math
from scipy import optimize as sio
import numexpr as ne
import cupy as cp
import cupyx.scipy.ndimage as csnd
import numba
def get_flat_dpc(data4D_flat,
chunks=8,
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 28 21:10:21 2020
@author: pengning
does the Green's function Arnoldi iteration over a shell domain for spherical waves
nice analytical properties of polynomial representation lost when using shell domain leaving out origin
try going back to spatial... |
import numpy as np
import scipy.linalg as npl
import Operators as ops
import os
# Constants
planck = 4.13566751691e-15 # ev s
hbarfs = planck * 1e15 / (2 * np.pi) #ev fs
ev_nm = 1239.842
# Operation flags
compute_hamiltonian = True
compute_operators = True
# -------------- Retinal 2-state 2-mode Hamiltonian -------... |
<gh_stars>1-10
'''
Implementation of parallel memoized variational algorithm for bnpy models.
'''
import numpy as np
import multiprocessing
import os
import learnalg. ElapsedTimeLogger as ElapsedTimeLogger
import scipy.sparse
from collections import defaultdict
from birthmove.BCreateManyProposals \
import makeSum... |
import numpy as np
from scipy import integrate
from matplotlib.pylab import *
import matplotlib.pyplot as plt
'''
Stiff combustion equation
'''
def combustion(t,y):
n = len(y)
dydt = np.zeros((n,1))
#dydt[0] = -15*y
dydt[0] = y**2 - y**3
return dydt
# The ``driver`` that will integrate the ODE(s)... |
<filename>FEBDAQMULTx2/data_analysis/7_preamp_gain_analysis_and_charge_injection/injection_and_pedestal_peak_adc.py
#!/usr/bin/env python
'''
This script is the OOP version that finds the peak ADC position for a single channel.
The file names follow the convention such as:
"ch0.root" for charge injected to channel 0.
... |
# for random distributions, random number generators, statistics
import random
import numpy as np
import scipy.stats as stats
# for simulation
import simulus
def exp_generator(mean, seed):
rv = stats.expon(scale=mean)
rv.random_state = np.random.RandomState(seed)
while True:
# 100 random numbers a... |
import numpy as np
import scipy
import multiprocessing
from pydoc import locate
from copy import deepcopy, copy
from joblib import Parallel, delayed
from bokeh.layouts import gridplot
from statsmodels.stats.weightstats import ttest_ind
from bokeh.models import HoverTool, Slope, Span
from bokeh.plotting import ColumnDat... |
import numpy as np
from scipy.optimize import minimize
from scipy.spatial.distance import cdist
def geometric_median(points, method='auto', options={}):
"""
Calculates the geometric median of an array of points.
method specifies which algorithm to use:
* 'auto' -- uses a heuristic to pick an alg... |
from mpmath.libmp import (fzero, from_int, from_rational,
fone, fhalf, bitcount, to_int, to_str, mpf_mul, mpf_div, mpf_sub,
mpf_add, mpf_sqrt, mpf_pi, mpf_cosh_sinh, mpf_cos, mpf_sin)
from sympy.core.numbers import igcd
from .residue_ntheory import (_sqrt_mod_prime_power,
legendre_symbol, jacobi_symbol, is_... |
# Required for rest of hug scripts
from bitshares import BitShares
from bitshares.account import Account
from bitshares.amount import Amount
from bitshares.asset import Asset
from bitshares.blockchain import Blockchain
from bitshares.block import Block
from bitshares.dex import Dex
from bitshares.price import Price
fro... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import scipy
import scipy.stats
# BCES fitting
# ===============
def bces(y1,y1err,y2,y2err,cerr):
"""
Does the entire regression calculation for 4 slopes:
OLS(Y|X), OLS(X|Y), bisector, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
clever.py
Compute CLEVER score using collected Lipschitz constants
Copyright (C) 2017-2018, IBM Corp.
Copyright (C) 2017, <NAME> <<EMAIL>>
and <NAME> <<EMAIL>>
This program is licenced under the Apache 2.0 licence,
contained in the LICENCE file in t... |
#!/usr/bin/env python3
import math
from sympy import *
zbb32 = None
data32 = dict()
data64 = dict()
with open("synth.out", "r") as f:
for line in f:
line = line.split()
if "32" in line[0]:
data32[line[0].replace("_xlen32", "").replace("32", "").split(".")[-1]] = int(line[1]) // 4
... |
<gh_stars>1-10
'''
This is the significance test for meta study in Section 5.2 (about semi-supervised learning)
and Section 6 (about domain adaptation).
- Data source: We curated a list of SSL and DA studies in https://docs.google.com/spreadsheets/d/1dNQiFuFMKE05YcTwcnvEZ5xojm3Q2c6c0uR3k7H7D7c/
- Code: We conducted th... |
# Authors: <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
#
# License: BSD 3 clause
from __future__ import print_function
import chemplot.descriptors as desc
import chemplot.parameters as parameters
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import umap
import base64
import functo... |
<gh_stars>10-100
## WE USE THE HIGHER LEVEL TENSORFLOW LIBRARY CALLED TF.CONTRIB WHICH HAS AN LSTM CELL
## IMPLEMENTED. ALSO, A SOFTWARE TEMPLATE FOR 1 LAYER MNIST DATASET
## IMPLEMENTATION WAS USED AS AN INITIAL TEMPLATE Project: https://github.com/aymericdamien/TensorFlow-Examples/
import tensorflow as tf
from tenso... |
<gh_stars>0
import torch
from .base_model import BaseModel
from . import networks
import numpy as np
from collections import OrderedDict
from scipy.ndimage.morphology import binary_erosion
import torch.nn.functional as F
def build_mask(shape, att_shape, locations=[]):
mask = torch.zeros(shape)
for r, c in loc... |
<reponame>Skalwalker/SpamRecognition
import scipy.io as sio
import numpy as np
class ReadFiles(object):
def __init__(self):
spamData = sio.loadmat('../data/spam_data.mat', struct_as_record=False)
self.header = spamData['__header__']
self.version = spamData['__version__']
self.name... |
#! /usr/bin/python
# <NAME> - UC Berkeley - 2020
# Contains plotting functions
####### Important Functions include:
# plotLine()
# plotCDF()
# plotStackedBars()
# plotBars()
# plotBarsDouble()
# Documentation for each function is included in the function definition
import matplotlib
matplotlib.use('Agg')
import nu... |
# -*- coding: utf-8 -*-
"""
/*------------------------------------------------------*
| Spatial Uncertainty Research Framework |
| |
| Author: <NAME>, UC Berkeley, <EMAIL> |
| |
| Date: 07/11/... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
# Author: <NAME>
# License: MIT
"""
Base class for Finite Element models
====================================
Define, solve and postprocess a FEM model using Gmsh_ and GetDP_.
.. _Gmsh:
http://gmsh.info/
.. _GetDP:
http://getdp.info/
"""
import shutil
import os
imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import os.path as op
import shutil as su
from datetime import datetime
import numpy as np
import pandas as pd
import xarray as xr
from scipy.io import loadmat
from .geo import gc_distance
# AUX. FUNCTIONs
def geo_distance_azimuth(lat_matrix, lon_matrix, lat_p... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
'''
ZELDA sequences analysis module
This module is dedicated to the analysis of ZELDA sequences acquired
with VLT/SPHERE. It is not directly applicable to other sensors but
could easily be modified or dupplicated for this purpose.
<EMAIL>
<EMAIL>
'''
import numpy as np
import g... |
<filename>archivedtst/romcomma/model/base.py
# BSD 3-Clause License
#
# Copyright (c) 2019, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain ... |
<filename>Kuru/BoundaryCondition/BoundaryCondition.py
from __future__ import print_function
import sys
import numpy as np #, scipy as sp, os, gc
from copy import deepcopy
#from warnings import warn
from time import time
class BoundaryCondition(object):
"""Base class for applying all types of boundary conditions"""... |
import gc
import json
import time
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
import scipy.sparse
from pegasus.io import read_input
from .. import decorators as pg_deco
obsm_whitelist = ['X_pca', 'X_rpca', 'X_tsne', 'X_fitsne', 'X_umap', 'X_fle', 'X_net_tsne', 'X_net_uma... |
<reponame>badarsh2/Virtual-Makeup<gh_stars>10-100
import Image, numpy as np,math
import scipy as sp
from scipy.interpolate import interp1d
from pylab import *
from skimage import io, color
import cv2
#Source colour
R,G,B = (102.,0.,51.)
inten = 0.8
lower_left_end = 5
upper_left_end = 11
lower_right_end = 16
upper_ri... |
r"""Computes the partition map for a segmentation.
For every labeled voxel of the input volume, computes the fraction of identically
labeled voxels within a neighborhood of radius `lom_radius`, and then quantizes
that number according to `thresholds`.
Sample invocation:
python compute_partitions.py \
--input_... |
<gh_stars>1-10
from cmath import rect, phase
from math import ceil
import pygame
import numpy as np
from numpy import pi
from gym_grand_prix.envs.cars.utils import to_px
sectors = 48
radius = 5
width = 3
scale = radius / 5
def get_partition(n, a, b=None):
if b is None:
b = a
a = 0
sample = np... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.