text string |
|---|
from __future__ import division
import os,time,scipy.io
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.contrib.layers.python.layers import initializers
import numpy as np
import rawpy
import glob
input_dir = './dataset/Fuji/short/'
gt_dir = './dataset/Fuji/long/'
checkpoint_dir = './res... |
import math
import numpy as np
from matplotlib import cm
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.stats import multivariate_normal
def gauss_kernel_values(xs: np.ndarray, cov: np.ndarray, mean: np.ndarray = None):
'''
Vectorized Gaussian Kernel
v(x) ~ exp(-x'C^{-1... |
<reponame>trigfa/mpUtilities
# -*- coding: utf-8 -*-
"""
A number of useful functions for dealing with graphs
Created on Sun Dec 8 17:46:29 2013
@author: Graham
"""
import numpy as np
import scipy
import scipy.interpolate
def derivative(x,y,order=1):
"""Given the x any y arrays will return the derivative of th... |
<filename>Code/rioja.py
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 1 14:18:14 2019
@author: if715029
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.cluster import hierarchy as hi
import scipy.spatial.distance as sc
#%%
#rioja = pd.read_excel('../Data/la_rioja21-02-2019.xls... |
<gh_stars>1-10
"""
SSVEP Wang dataset.
"""
import logging
from os.path import dirname
import numpy as np
from mne import create_info
from mne.channels import make_standard_montage
from mne.io import RawArray
from pyunpack import Archive
from scipy.io import loadmat
from . import download as dl
from .base import Base... |
<reponame>Rubikplayer/flame-fitting
#!/usr/bin/env python
from chumpy import Ch, depends_on
import chumpy as ch
import numpy as np
from .alignment.objectives import sample_from_mesh
from .matlab.matlab import row, col
from .alignment.mesh_distance import sample2meshdist
from .robustifiers import SignedSqrt
import scip... |
import glob
import copy
import numpy as np
import os
import astropy.table as tbl
from astropy import time, coordinates as coord, units as u
from astropy.stats import LombScargle
from astropy.io import fits
from scipy.optimize import leastsq
import matplotlib.pyplot as plt
from scipy.stats import sigmaclip
import scipy.... |
# useful functions
# reference: https://biboxcom.github.io/v3/spot/zh/#api-2
# based on bibox api v3
# original api is JAVA, here rewrite in python
import requests
import json
import time
import hmac
import hashlib
import datetime
import time
import sys
import hmac
import hashlib
import math
import statistics
api_k... |
import os
import json
from argparse import ArgumentParser
import matplotlib.pyplot as plt
import numpy as np
from numpy import array
from statistics import mean
def parse_options():
parser = ArgumentParser()
parser.add_argument("-o", "--output", required=False,
default="outputs", type... |
<reponame>snasiriany/parasol
import os
import cv2
import numpy as np
import scipy.misc
from deepx import T
from gym import utils
from gym.envs.mujoco import mujoco_env
from ..gym_wrapper import GymWrapper
__all__ = ['Cartpole']
class GymCartpole(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self, *arg... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
import matplotlib.mlab as ml
filename = 'highMT_l_50000_93a5d5e5843c4d849a430a5a3885eb24'
dat = np.loadtxt('data/'+filename+'.txt' , delimiter=',', skiprows=1, unpack=False)
qfail = dat[:,6]
numsamples = 50000
# Load data from ... |
import numpy as np
import json
from pandas.util.testing import all_timeseries_index_generator
from scipy.signal import savgol_filter
from scipy.optimize import curve_fit
import scipy
import matplotlib.pyplot as plt
from math import fabs, pi, asin, sin, log, degrees, acos
import trendline
from scipy.interpolate import ... |
<reponame>Standard-Cognition/recursive-bayesian-filtering
'''
Statistics tools for tracking.
MIT License
Copyright (c) 2018 Standard Cognition
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software wit... |
<gh_stars>0
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
import pynbody
import pylab
import numpy as np
import matplotlib.pylab as plt
import readcol
import itertools as it
from itertools import tee
import pandas as pd
import warnings
import decimal
import statistics
# Loading files
Hfiles = readcol.readcol('/media/jil... |
#Problem 21:
#Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
#If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable #numbers.
#For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, ... |
<filename>bardensr/barcodediscovery/__init__.py
import skimage
import skimage.draw
import skimage.feature
import numpy as np
import scipy as sp
import scipy.sparse.linalg
import numpy.random as npr
from .. import misc
from . import purepixel
import logging
logger=logging.getLogger(__name__)
############
### mergin... |
<filename>orangecontrib/xoppy/widgets/source/undulator_radiation.py
import sys
from PyQt5.QtWidgets import QApplication
from orangewidget import gui
from orangewidget.settings import Setting
from oasys.widgets import gui as oasysgui, congruence
from oasys.widgets.exchange import DataExchangeObject
from orangecontrib... |
<reponame>clawpack/geoclaw_1d<gh_stars>0
from __future__ import print_function
import numpy as np
import os
from scipy.interpolate import interp1d
def make_mapc2p(outdir):
"""
Create a mapc2p function that maps computational cell edges xc
with 0 <= xc <= 1 to the physical cell edges. The physical
cel... |
import numpy as np
import cv2
import sys
import crownSegmenterEvaluator as CSE
from osgeo import gdal
from scipy.spatial.distance import directed_hausdorff
from sklearn.neighbors import KDTree
def avMinDistCloserTop(list1):
if len(list1)==0: return -1
newList1=np.asarray([[x,y] for x,y in list1 ])
newLis... |
<gh_stars>1-10
# source: https://github.com/pytorch/vision/blob/master/references/detection/
import math
import time
import torch
import torchvision.models.detection.mask_rcnn
from sklearn.metrics import roc_auc_score, matthews_corrcoef
import numpy as np
from scipy.special import softmax
import sys
import nucls_mod... |
# import cPickle as pickle
import pickle
import numpy as np
import matplotlib.pyplot as plt
from os.path import join
import os
from helper import DataSet
from PIL import Image
class Cifar:
def __init__(self):
self.path_to_dir = 'Data/cifar-10-batches-py'
self.batch_to_use = 'data_batch_'
def ... |
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import tensorflow as tf
import sys
import os
import pickle as pickle
from six.moves import urllib
import tarfile
import scipy.stats.mstats
from load_cifar10 import load_data10
# training parameters
initial_learning_rate = 0.001
... |
import numpy as np
import pdb
from utils import tensor_mult
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix
class Inference():
"""
superclass of inference procedures for an Ising model.
the model is represented using an adjacency matrix adj:
n x n ... |
import numpy as NP
from scipy import signal
from scipy import interpolate
import mathops as OPS
import lookup_operations as LKP
#################################################################################
def unwrap_FFT2D(arg, **kwarg):
return NP.fft.fft2(*arg, **kwarg)
def unwrap_IFFT2D(arg, **kwarg):
... |
<gh_stars>0
"""
.. module:: CDense
:synopsis: Wrapper of `numpy.ndarray`
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import numpy as np
import numpy.matlib
from numpy.linalg import inv, pinv
import scipy.sparse as scs
from copy import deepcopy
from secml.array.c_array_interface import _CArrayInterface
from secml.cor... |
<filename>src/ft01.py<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 20 14:56:17 2020
@author: qsong
"""
# option pricing with fft
import numpy as np
#import matplotlib.pyplot as plt
from scipy.integrate import quad
class BSM:
def __init__(self, S0, r, sigma):
self.... |
<gh_stars>10-100
#!/usr/bin/env python2
import numpy as np
from scipy.stats import binom as bi
import math
## We are looking for a number of rounds n such that adv will have at least
## k null rounds within n with near certainty.
targetNulls = 22 # drawn from selfish mining sim results
nullProb = .27
s = 2**-30
de... |
#################################################################################
#
# Project Title: Unsupervised Experiments Class: CS272
# Author: <NAME>
# Date: 2021-04-04
#
###########################################################################... |
## test_attack.py -- sample code to test attack procedure
##
## Copyright (C) 2017, <NAME> <<EMAIL>>.
## Copyright (C) 2016, <NAME> <<EMAIL>>.
##
## This program is licenced under the BSD 2-Clause licence,
## contained in the LICENCE file in this directory.
import tensorflow as tf
import numpy as np
import time
import... |
<filename>SimulatorDS.py
#!/usr/bin/env python
# "$Name: $";
# "$Header: /cvsroot/tango-ds/Simulators/SimulatorDS/SimulatorDS.py,v 1.4
# 2008/11/21 11:51:44 sergi_rubio Exp $";
#=============================================================================
#
# file : SimulatorDS.py
#
# description ... |
<reponame>sethaxen/arviz
"""Plot quantile MC standard error."""
import numpy as np
import xarray as xr
from scipy.stats import rankdata
from ..data import convert_to_dataset
from ..stats import mcse
from ..stats.stats_utils import quantile as _quantile
from .plot_utils import (
xarray_var_iter,
_scale_fig_size... |
<gh_stars>1-10
# bounds.py
import numpy as np
from scipy import special
import config as cf
def mom(n, var, delta):
'''
See Devroye et al. (Ann Stats, 2016), Thm 4.1.
'''
return 2*np.sqrt(2*np.exp(1)) * np.sqrt(var*(1+np.log(1/delta))/n)
def mest(n, var, delta):
'''
See, for example, Holl... |
<reponame>ChrisBarker-NOAA/tamoc<filename>tamoc/stratified_plume_model.py
"""
Stratified Plume Model
======================
Simulate a buoyant plume in stratification dominate or quiescent conditions
This module defines the classes, methods, and functions necessary to simulate
the buoyant plume behavior in stratifica... |
#!/usr/bin/env python
# Example of using nessai with `reparameterisations` dictionary. This example
# uses the same model as the half_gaussian example.
import numpy as np
from scipy.stats import norm
from nessai.flowsampler import FlowSampler
from nessai.model import Model
from nessai.utils import setup_logger
outp... |
import numpy as np
from scipy.stats import norm
from code.parameters import WINDOW_SIZE, MINIMAL_WINDOW_KERNEL_VALUE
def step_forward(signals: np.ndarray, threshold=0.1) -> np.ndarray:
"""
Encodes a time series based on the step-forward algorithm provided in:
Petro et al. (2020)
Args:
sig... |
<filename>scripts/arl15del2_b6ntac_exp_0002_paper_figures.py
"""
This file is part of Cytometer
Copyright 2021 Medical Research Council
SPDX-License-Identifier: Apache-2.0
Author: <NAME> <<EMAIL>>
"""
# script name to identify this experiment
experiment_id = 'klf14_b6ntac_exp_0002_paper_figures'
# cross-platform home... |
<reponame>k-cybulski/sigman-project
from scipy.signal import butter, filtfilt
import numpy as np
from sigman.analyzer import InvalidArgumentError
procedure_type = 'modify'
description = """Procedure applying the Butterworth filter from SciPy.
Exact documentation here:
https://docs.scipy.org/doc/scipy-0.14.0/reference... |
<reponame>ryuzakyl/data-bloodhound
#!/usr/bin/env
# -*- coding: utf-8 -*-
# Copyright (C) <NAME> - All Rights Reserved
# Unauthorized copying of this file, via any medium is strictly prohibited
# Proprietary and confidential
# Written by <NAME> <<EMAIL>>, January 2017
import os
import scipy.io as sio
import utils.da... |
import torch
import torch.nn as nn
import torch.utils.data as Data
from torch.autograd import Variable
from statistics import mean
import matplotlib.pyplot as plt
import _pickle as cPickle
from tqdm import tqdm
from scipy.stats import spearmanr
import pandas as pd
def evaluate(model, inp, target):
loss_func = torc... |
<reponame>ANRGUSC/pyREM
import math
import scipy.integrate as integrate
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import root
RHO_A = 1.21 #density of air in kg/m^3
RHO_D = 1000 #density of droplet in kg/m^3
RHO = RHO_A
RHO_P = RHO_D
G = 9.81 #gravitational acceleration in m/s^2
VISCOSITY... |
from matplotlib.pyplot import (figure, hold, subplot, plot, xlabel, ylabel,
xticks, yticks,legend,show)
import numpy as np
# requires data from exercise 4.1.1
from Project_Clean_data import raw
from Project_Clean_data import header
from textwrap import wrap
import matplotlib.pyplot as plt... |
# -*- coding: utf-8 -*-
#
# This file is part of the pyFDA project hosted at https://github.com/chipmuenk/pyfda
#
# Copyright © pyFDA Project Contributors
# Licensed under the terms of the MIT License
# (see file LICENSE in root directory for details)
"""
Create a popup window with FFT window information
"""
import lo... |
<filename>code/glm_program/gwas_main_cgmlst.py<gh_stars>0
#/usr/bin/env python
import statsmodels.api as sm
from statsmodels.formula.api import glm
from scipy import stats
import numpy as np
import pandas as pd
from sklearn.metrics import confusion_matrix
import csv, sys, re, os, subprocess
# Usage
# python gene_gwas.... |
<gh_stars>0
import argparse
import functools
import itertools
import json
import logging
import matplotlib.pyplot as plt
import numpy as np
import os
from collections import defaultdict
from overrides import overrides
from scipy.stats import kendalltau, pearsonr, spearmanr
from typing import Dict, List, Tuple, Union
f... |
import argparse
import logging
import os
import warnings
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from scipy.ndimage import gaussian_gradient_magnitude
from skimage import feature, morphology
from wordcloud import WordCloud, ImageColorGenerator, STOPWORDS
warni... |
from sklearn.model_selection import KFold, cross_val_score
from sklearn.metrics import mean_squared_error
from scipy.stats.stats import pearsonr
import numpy as np
from sklearn.svm import SVR
import datasetUtils as dsu
import embeddings
import sys
import os
def pccMean(arr):
pcc_only = np.array(list(scor[0] for sc... |
#!/usr/bin/env python
rmsfDat = '034205.4-370322.00_RMSF.dat'
#rmsfDat = 'test.dat'
#=============================================================================#
import os, sys, shutil
import math as m
import numpy as np
import numpy.ma as ma
from mpfit import mpfit
import pylab as pl
import matplotlib as mpl
from... |
import numpy as np
from keras.utils import np_utils
import pandas as pd
import sys
from sklearn.preprocessing import LabelEncoder
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.decomposition import PCA
import os
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
i... |
"""
Gradient Pertubation Controller
"""
import jax.numpy as np
import numpy as onp
import tigercontrol
from tigercontrol.controllers import Controller
from jax import grad,jit
import jax.random as random
from tigercontrol.utils import generate_key
import jax
import scipy
from tigercontrol.controllers import LQR
qua... |
#!/usr/bin/env python3
import warnings
from typing import List, Optional, Tuple, Union
import numpy as np
import numpy.testing as nptest
import pandas as pd
import pandas.testing as pdtest
import scipy.sparse
from sklearn.utils.validation import check_array, check_scalar
def series_if_applicable(ds: Union[pd.Series... |
<reponame>luoruiming/human-exoskeleton-simulation
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal, interpolate
import math
def lowpass_grf(original_file, fe, output_file):
with open(original_file, 'r') as fin:
with open(output_file, 'w') as fout:
for _ in r... |
<reponame>PBLab/python-pysight<gh_stars>1-10
from typing import List
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
from scipy.signal import savgol_filter
def _exp_decay(x, a, b, c):
""" Exponential function for FLIM and censor correction """
return a * np.exp(-b * x) + c
def... |
<gh_stars>0
from sklearn.metrics.cluster import silhouette_score as sklearn_silhouette
from scipy.spatial.distance import cdist
import numpy
from tslearn.metrics import cdist_dtw, cdist_soft_dtw_normalized
from tslearn.preprocessing import TimeSeriesResampler
from tslearn.utils import to_time_series_dataset, to_time_s... |
# Author: <NAME>
# License: Simplified BSD
import numpy as np
from scipy.optimize import minimize
from sdtw import SoftDTW
from sdtw.distance import SquaredEuclidean
def sdtw_barycenter(X, barycenter_init, gamma=1.0, weights=None,
method="L-BFGS-B", tol=1e-3, max_iter=50):
"""
Compute b... |
<filename>prevalence_placeholders.py
import numpy as np
import subprocess
from scipy.integrate import odeint
from submodel import SubModel
from model_data.zip_codes import ZIP_CODES
# from model_data.prevalence_samples import DATES, SAMPLES
class PlaceholderZipCodePrevalenceModel(SubModel):
def __init__(self):
... |
"""
Tests for universal spatial interaction models.
Test data is the Austria migration dataset used in Dennet's (2012) practical
primer on spatial interaction modeling. The data was made avialable through the
following dropbox link: http://dl.dropbox.com/u/8649795/AT_Austria.csv.
The data has been pre-filtered s... |
# Copyright(c) Microsoft Corporation.
# Licensed under the MIT license.
#from __future__ import print_function, division
import scipy.stats
import numpy as np
import os
import os.path
import pickle
import random
import sys
import time
import torch
from PIL import Image
from torch.utils.data import Dataset
import torc... |
<reponame>xiuheng-wang/ADMM_3DDnCNN_HSI_deconvolution
import numpy as np
import cv2
import os
import math
from scipy.fftpack import fft2, ifft2
from scipy.io import loadmat
import scipy.ndimage
def get_blurred(img, kernel, noise_sigma):
# get blurred
img = img.astype(np.float32) / 255
dim = np.shape(img)
... |
<reponame>othercriteria/StochasticBlockmodel
#!/usr/bin/env python
# Network representation and basic operations
# <NAME>, 5/10/2012
from os import system, unlink
import numpy as np
import scipy.sparse as sparse
import networkx as nx
import matplotlib.pyplot as plt
from Array import Array
from Covariate import NodeC... |
<reponame>reichelu/copasul<gh_stars>1-10
# author: <NAME>, Budapest, 2016
import os
import shutil as sh
import sys
import numpy as np
import pandas as pd
import statistics as stat
import scipy.stats as st
import scipy.cluster.vq as sc
import sklearn.preprocessing as sp
import json
import pickle
import re
import datet... |
<filename>chaospy/distributions/collection/generalized_gamma.py
"""Generalized gamma distribution."""
import numpy
from scipy import special
from ..baseclass import SimpleDistribution, ShiftScaleDistribution
class generalized_gamma(SimpleDistribution):
"""Generalized gamma distribution."""
def __init__(self... |
<reponame>vivarium-collective/vivarium-cell
import os
import numpy as np
import matplotlib.pyplot as plt
import scipy.constants
from iteround import saferound
from vivarium.core.process import Process
from vivarium.core.composition import (
simulate_process_in_experiment,
PROCESS_OUT_DIR,
)
NAME = 'diffusion... |
<filename>contex_synthetic/helper_functions.py
# __author__ = "<NAME>"
# __email__ = "<EMAIL>"
from __future__ import division
import numpy as np
from scipy.spatial import distance
# import math
import dill # pickle will fail if we remove this line
import pickle
import gzip
import signal
from contextlib import contex... |
<filename>tests/ritests/test5_sup.py
# @auto-fold regex /^\s*if/ /^\s*else/ /^\s*def/
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import scipy as sp
import batman
def neo_init_batman(t):
'''
initializes batman
'''
n = {'t0': min(t), 'per': 1., 'rp': 0.1, 'a': 15.,
'inc': 87., 'ecc':0., 'w':9... |
import numpy as np
import pandas as pd
from scipy import signal, ndimage, interpolate, stats, spatial
from scipy.interpolate import CubicSpline
from sklearn.decomposition import PCA
from pathlib import Path
import os,sys, json
import h5py
import pickle as pkl
sys.path.append('../PreProcessing/')
sys.path.... |
import numpy as np
from prlqr.systems.dynamical_system import DiscreteTimeDynamicalSystem, StateFeedbackLaw, NormalRandomControlLaw
from prlqr.analysis.stability_analysis import check_stability
class LinearSystem(DiscreteTimeDynamicalSystem):
def __init__(self, A, B, controller, settings):
self.A = A
... |
import math
import statistics
import warnings
import numpy as np
from hmmlearn.hmm import GaussianHMM
from sklearn.model_selection import KFold
from asl_utils import combine_sequences
class ModelSelector(object):
'''
base class for model selection (strategy design pattern)
'''
def __init__(self, all... |
"""Data processing module.
This module aims at preparing and shaping the data in order to make it suitable for the subsequent training step.
"""
import sys
import logging
import json
import pickle as pkl
from pathlib import Path
from typing import Union
import numpy as np
from scipy.sparse import csr_matrix
from panda... |
'''Objects to assign scores to ranks in ranked voting systems such as Borda.
A rank scorer returns a list of numerical scores to be assigned to ranks given
by voters. This is the essence of Borda count system, and rank scorers capture
most of the variations there are in that system.
'''
import abc
from fractions impo... |
import math
import numpy
import warnings
warnings.simplefilter('ignore', DeprecationWarning)
import scipy
import scipy.special
import scipy.optimize
warnings.simplefilter('default', DeprecationWarning)
def sqr(z):
return z*z
def faddeeva(z, NT=None):
"""computes w(z) = exp(-z^2) erfc(iz) according to
<NAME>,... |
# uniform content loss + adaptive threshold + per_class_input + recursive G
# improvement upon cqf37
from __future__ import division
import os, scipy.io, scipy.misc, cv2
import torch
import numpy as np
import glob
import utils
from unet import UNet
from torch.utils.data import DataLoader
from dataset.ICDAR15 import IC... |
import os
import numpy as np
from scipy.interpolate import interp1d
v_sliding = 0.35
def padcat(lis):
"""
Concatenate lists into a single numpy array, filling the holes with nans
:param lis:
:return:
"""
max_len = max(list(map(len,lis)))
out = np.empty([len(lis),max_len])
out[:] = np.... |
import json
import operator
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from pandas.core.indexes import base
from scipy import stats
from sklearn.metrics import auc, roc_auc_score, roc_curve
from tqdm.auto import tqdm
from data_prep import gini_weight, normalise_matrix... |
<reponame>dmft-wien2k/dmft-wien2k-v2<filename>src/putils/RXS/RXS.py<gh_stars>1-10
#!/usr/bin/env python
from scipy import *
import matplotlib.pyplot as plt
import struct1
import utils
import sys, os
from scipy import interpolate
import subprocess
import re
from w2k_atpar import readpotential, readlinearizatione, atpar... |
<reponame>jeanphilippemercier/microquake
import numpy as np
from scipy.fftpack import fft, fftfreq, rfft, rfftfreq
import matplotlib.pyplot as plt
"""
mag_utils - a collection of routines to assist in the moment magnitude calculation
"""
def parsevals(data, dt, nfft):
"""
Proper scaling to satisfy Parse... |
<reponame>canxkoz/Computational-Imaging
import cv2
import random
import numpy as np
from pprint import pprint
import matplotlib.pyplot as plt
from scipy.spatial import distance as dist
def find_island_cmass(island):
# Get island and return cmass x,y
M = cv2.moments(island)
c_mass_x = int(M['m10']/M['m00... |
from __future__ import print_function
import os
import time
import math
from PIL import Image
import h5py
import numpy as np
import theano
import theano.tensor as tensor
from theano import config
from theano.tensor.nnet.conv import conv2d
from theano.tensor.nnet import conv3d
from theano.tensor.nnet.abstract_conv impor... |
<gh_stars>1-10
''' Masking Module
This module contains utility functions working with known set masks
Author: <NAME>
'''
import scipy.sparse as sp
import numpy as np
class Mask():
def __init__(self, use_set):
if len(use_set.shape) == 1:
p = 1
T = len(use_set)
else:
... |
import warnings
import numpy as np
from scipy import spatial
from shapely.geometry import mapping, shape, Point, LineString, Polygon,MultiPoint,MultiLineString
from shapely.ops import cascaded_union,split,nearest_points,linemerge,snap
from tqdm import tqdm
from .df import DF
def resample_LineString(linestring, maxLen... |
<reponame>tensorflow-pool/insightface
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# import mxnet as mx
# from mxnet import ndarray as nd
import argparse
import os
import pickle
import sys
import cv2
import numpy as np
import tensorflow as tf
from scipy ... |
from __future__ import print_function, division
import sys,os
quspin_path = os.path.join(os.getcwd(),"../")
sys.path.insert(0,quspin_path)
from scipy.sparse.linalg import eigsh
from quspin.operators import hamiltonian # Hamiltonians and operators
from quspin.operators import quantum_LinearOperator
from quspi... |
<filename>testdata/PyFEM-master/pyfem/elements/Plate.py
############################################################################
# This Python file is part of PyFEM, the code that accompanies the book: #
# #
# 'Non-Linear Finite Elemen... |
#!/usr/bin/env python
################################################################################
# MIT License
#
# Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Sof... |
<filename>tests/test_error_functions.py<gh_stars>0
"""
Test different error functions as isolated units.
"""
import numpy as np
from tinydb import where
from pycalphad import Database
from espei.paramselect import generate_parameters
from espei.error_functions import calculate_activity_error, calculate_thermochemica... |
## Created 2015, <NAME>
import matplotlib
matplotlib.use('Qt4Agg')
import matplotlib.pyplot as plt
import numpy as np
from collections import OrderedDict
from scipy.optimize import curve_fit, fmin
from QuantSpectra import Section, GaussianComponent, LinearComponent
import h5py
import QuickPlot
import ALCHEMIConfig
impo... |
<reponame>ishine/IMS-Toucan
"""
taken and adapted from https://github.com/as-ideas/DeepForcedAligner
"""
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.multiprocessing
import torch.nn as nn
from scipy.sparse import coo_matrix
from scipy.sparse.csgraph import dijkstra
from torch.nn import C... |
"""
Distance functions
==================
Distance functions measure closeness of observed and sampled data.
For custom distance functions, either pass a plain function to ABCSMC or
subclass the DistanceFunction class if finer grained configuration is required.
"""
import json
import scipy as sp
import numpy as np
fr... |
"""
Multilayer VAE + Pixel CNN
<NAME>
"""
import os, sys
sys.path.append(os.getcwd())
# try: # This only matters on Ishaan's computer
# import experiment_tools
# experiment_tools.wait_for_gpu(tf=True)
# except ImportError:
# pass
import tflib as lib
import tflib.train_loop
import tflib.ops.kl_unit_gaussi... |
<filename>Statistics/Variance.py
from statistics import pvariance
def variance(a, b, c, d, e, f, g, h):
try:
a = float(a)
b = float(b)
c = float(c)
d = float(d)
e = float(e)
f = float(f)
g = float(g)
h = float(h)
num_list = [a, b, c, d, e, f,... |
"""
Standard Lomb-Scargle Periodogram
"""
from __future__ import division, print_function
import numpy as np
from scipy import optimize
def construct_X(t, dy, omega, Nterms=1, compute_offset=False):
cols = []
if compute_offset:
cols.append(np.ones(len(t), dtype=float))
for i in range(Nterms):
... |
<gh_stars>0
# External libraries.
import numpy as np
import scipy.special
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
import sys
import os
from orangewidget import gui
from orangewidget.settings import Setting
from oasys.widgets import widget
import ... |
<reponame>finkler/tulipa
import numpy as np
from scipy.optimize import bisect, curve_fit
from tulipa.wa import vg
alpha = 1.38
Cc = 130.0 # um-kPa
# kPa to cm
def ph(psi):
g = 9.81
rho = 997.0
return (psi * 1e3 / (g * rho)) * 100.0
class CNEAP:
def __init__(self, psd, n=None, rho_p=2.65):
... |
<reponame>treyfortmuller/barc<filename>workspace/src/labs/src/lab3/Bag2Mat.py<gh_stars>100-1000
import rosbag
import numpy as np
import scipy.io
import os
bag = rosbag.Bag(os.path.expanduser("~/Desktop/2017-10-06-18-21-06.bag"))
topics = bag.get_type_and_topic_info()[1].keys()
types = []
for i in range(0,len(bag.get... |
<gh_stars>0
import numpy as np
from scipy.interpolate import interp1d
class Renderer:
"""Cinema CIS Renderer
The Renderer.renderer() renders a CIS image into the final composited and/or
shadowed image. Currently, it support image composition through depth-buffer
and applies "simulated" shadow using (... |
<filename>Projects/Probability and Monte Carlo Techniques/_6_pearsons_chi2_test.py
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt
from scipy import stats
def pdf(costh, P_mu):
# define our probability density function
return 0.5 * (1.0 - 1.0 / 3.0 * P_mu * costh)
def inv_cdf... |
<filename>word2vec.py
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 28 21:59:33 2018
@author: moseli
"""
from numpy.random import seed
seed(1)
modelLocation="C:/Users/moseli/Documents/Masters of Information technology/Masters project/text mining/TrainedModels/"
import gensim as gs
import pandas as pd
... |
import json
import openpyxl
import os
import scipy
import librosa
data_path = os.path.dirname(os.path.abspath(__file__))
folders = [os.path.join(data_path, name) for name in os.listdir(data_path)
if os.path.isdir(os.path.join(data_path, name))]
json_files = [os.path.join(data_path, folder, file) for folder ... |
from utils import *
from fdft import att
from fdft import block
from network import *
import os
import argparse
from keras.preprocessing.image import ImageDataGenerator
import tensorflow as tf
import numpy as np
from keras.models import Input
from keras.layers import Input, Dense, Flatten, GlobalAveragePooling2D, Acti... |
# Python Libraries
from __future__ import print_function
from __future__ import division
import os
import numpy
numpy.seterr(divide='ignore', invalid='ignore')
from scipy import stats
import multiprocessing
from collections import OrderedDict
from ..tdf.RNADNABindingSet import RNADNABindingSet
from ..motifanalysis.Stat... |
<gh_stars>10-100
import pandas as pd
import numpy as np
import multiprocessing
from multiprocessing import Manager
import click
import warnings
from tqdm import tqdm
import json
import os
from nesymres.dataset import generator
import time
import signal
from nesymres import dclasses
from pathlib import Path
import pick... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.