text string |
|---|
<gh_stars>0
from torch.utils.data import Dataset
import numpy as np
from h5py import File
import scipy.io as sio
from utils import data_utils
import torch
class Datasets(Dataset):
def __init__(self, opt, actions=None, out_of_distribution=False, split=0):
"""
:param path_to_data:
:param ac... |
#
# Bias and shot noise from <NAME>
#
# Evolution of HI bias and shot noise as a function of redshift. Then nP includes nonlinear damping
# From equation 4 and 5 of https://arxiv.org/abs/1609.05157. In equation 7, alpha=1 and M_{min} = 5*10^9 Msun/h to fit DLA bias b_{DLA}=2 at z=2.3
# The only ASSUMPTION is that... |
# coding: utf-8
from sympde.core import Constant
from sympde.calculus import grad, dot
from sympde.topology import ScalarFunctionSpace, VectorFunctionSpace
from sympde.topology import element_of
from sympde.topology import Domain, Boundary, NormalVector
from sympde.expr import EssentialBC
#===================... |
<reponame>RishikeshMagar/gnn-lspe<gh_stars>0
import time
import dgl
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset
from rdkit import Chem
from rdkit import RDPaths
import csv
from dgllife.utils import smiles_to_complete_graph
from ogb.graphproppred import DglGraphPropPredDataset, Ev... |
"""A pre-trained implimentation of VGG16 with weights trained on ImageNet."""
##########################################################################
# Special thanks to
# http://www.cs.toronto.edu/~frossard/post/vgg16/
# for converting the caffe VGG16 pre-trained weights to TensorFlow
# this file is essentially ju... |
<reponame>ocefpaf/pysal
"""
Diagnostics for SUR and 3SLS estimation
"""
__author__= "<NAME> <EMAIL>, \
<NAME> <EMAIL> \
<NAME> <EMAIL>"
import numpy as np
import scipy.stats as stats
import numpy.linalg as la
from .sur_utils import sur_dict2mat,sur_mat2dict,sur_corr,spdot
from .regimes ... |
<reponame>gecheline/stargrit<filename>stargrit/structure/potentials/roche.py
import numpy as np
import os, shutil
import logging
from scipy.optimize import newton
from scipy.special import legendre
logging.basicConfig(format='%(asctime)s: %(message)s', level=logging.INFO)
def critical_pots(q, sma=1., d=1., F=1.):
... |
import sys, os
import numpy as np
from scipy.integrate import trapz
#from scipy.optimize import fsolve
from scipy import optimize
import getLogDistributions as gLD
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from collections import OrderedDict, defaultdict
import h5py
import getAxyLabels as gal
i... |
<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# <EMAIL>
# StockNet evaluation experiments in GPU
from __future__ import print_function, division
import numpy as np
np.random.seed(42)
from models import StockNet, WaveNet
import pandas as pd
import tensorflow as tf
from tensorflow.python.keras.callbacks i... |
<gh_stars>0
import math
import copy
import numpy as np
import unittest
import sparse
from scipy.signal import find_peaks_cwt, find_peaks
from dscribe.descriptors import MBTR
from ase.build import bulk
from ase.build import molecule
from ase import Atoms
import ase.geometry
from testbaseclass import TestBaseClass
d... |
from pylab import *
from scipy import signal
from numpy import *
import netCDF4 as nc
import pyroms as p
from scipy.special import erf
from scipy.integrate import cumtrapz
#this code reads grid data from an existing grid and initial condition
#files, uses them to define a climatological temperature file and a
#nudging... |
<gh_stars>10-100
import os
import glob
import shutil
import subprocess
import argparse
from pydub import AudioSegment
from pydub.utils import make_chunks
from scipy.io import wavfile
from matplotlib import pyplot as plt
from PIL import Image
def mp3towav(path):
folders=glob.glob(path+'*')
#print "folders",fol... |
# Copyright (c) FULIUCANSHENG.
# Licensed under the MIT License.
import torch
import torch.nn as nn
from scipy.stats import pearsonr, spearmanr
from sklearn.metrics import (
accuracy_score,
f1_score,
matthews_corrcoef,
precision_score,
recall_score,
roc_auc_score,
)
# some functions
def _conve... |
# Exercise 3.17
# Author: <NAME>
from scipy.integrate import quad
from scipy import exp, pi, cos, log, sqrt
def diff2(f, x, h=1E-6):
r = (f(x - h) - 2 * f(x) + f(x + h)) / (h ** 2)
return r
def adaptive_trapezint(f, a, b, eps=1E-4):
ddf = []
for i in range(101):
ddf.append(abs(diff2(f, a + ... |
<filename>dsatools/_base/_arma/_arma_shanks_prony_v2.py
import random
import numpy as np
import struct
import os
import numpy as np
import matplotlib.pyplot as plt
import scipy
from ... import matrix
from ... import utilits as ut
f
__all__ = ['arma_shanks_v2','arma_prony_v2']
#-----------------------------------... |
<reponame>gdmcbain/quadpy
# -*- coding: utf-8 -*-
#
from __future__ import division
import math
import numpy
import scipy.special
import sympy
def untangle(data):
weights, points = zip(*data)
return (
numpy.concatenate(points),
numpy.repeat(weights, [len(grp) for grp in points]),
)
def ... |
# Copyright 2016, 2017, 2018 California Institute of Technology
# Users must agree to abide by the restrictions listed in the
# file "LegalStuff.txt" in the PROPER library directory.
#
# PROPER developed at Jet Propulsion Laboratory/California Inst. Technology
# Original IDL version by <NAME>
# Python trans... |
<reponame>mmicromegas/ransX
import numpy as np
import sys
from scipy import integrate
import matplotlib
import matplotlib.pyplot as plt
from UTILS.Calculus import Calculus
from UTILS.SetAxisLimit import SetAxisLimit
from UTILS.Tools import Tools
from UTILS.Errors import Errors
from mpl_toolkits.axes_grid1 import make_a... |
import h5py
import sys
sys.path.append('./')
sys.path.append('../CFG')
sys.path.append('../include')
#limix_path = '/Users/florian/Code/python_code/limix-master/build/release.darwin/interfaces/python'
#sys.path.append(limix_path)
sys.path.append('./..')
import limix.modules.panama as PANAMA
import limix.modules.varianc... |
'''
# Write a piece of code to create a Fibonacci sequence using recursion.
def fibr(n):
if n == 1:
return 1
elif n == 2:
return 1
elif n>2:
return fibr(n-1) + fibr(n-2)
print("\nFibonacci using recursion:\n")
for n in range(1,11):
print(n, ":", fibr(n))
# Write a piece of co... |
import os
import random
import pickle as pk
import pandas as pd
import numpy as np
from scipy.sparse import csr_matrix
from tqdm import tqdm
tqdm.pandas()
# import markov_clustering as mc
def get_pdb_id(name):
if name.startswith("d"):
return name[1:5].upper()
else:
return name[4:8].upper()
de... |
<filename>kadal/surrogate_models/supports/trendfunction.py
import numpy as np
import numpy.matlib
from itertools import combinations
from copy import deepcopy
from scipy.special import factorial
def polytruncation(nix, nvar, q):
"""
Generate polynomial indices for the trend function by using total-order
tr... |
# -*- coding: utf-8 -*-
"""
Utilities specific to the gw subpackage.
"""
from abc import ABC, abstractmethod
import logging
import numpy as np
from scipy import interpolate
logger = logging.getLogger(__name__)
try:
from astropy import cosmology as cosmo
import astropy.units as u
except ImportError:
logger... |
'''
Classes for extracting "decodable features" from various types of neural signal sources.
Examples include spike rate estimation, LFP power, and EMG amplitude.
'''
import numpy as np
import time
from scipy.signal import butter, lfilter
import math
import os
import nitime.algorithms as tsa
from riglib.ripple.pyns im... |
import warnings
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import norm
import statsmodels.api as sm
import statsmodels.formula.api as smf
from statsmodels.genmod.families import links
from tabulate import tabulate
from zepid.calc.utils import (risk_ci, incidence_rate_ci, ri... |
#################################################################################
### ###
### Date created - Monday, Nov 11, 2019 ###
### Author - <NAME> <<EMAIL>, <EMAIL> > ###
### ... |
<gh_stars>1000+
# -*- encoding: UTF-8 -*-
"""Plotting functions."""
import sys
import numpy as np
from itertools import count
from functools import partial
from scipy.optimize import OptimizeResult
from .acquisition import _gaussian_acquisition
from skopt import expected_minimum, expected_minimum_random_sampling
from ... |
<gh_stars>0
import numpy as np
import pandas as pd
from scipy.signal import argrelmax
from scipy.ndimage import gaussian_filter
from skimage import io
from skimage.color import rgb2gray
from skimage.filters import sobel
from . import image
def run(
image_path,
fft_pass,
delta_px,
delt... |
import itertools
import sympy as sp
from ..property import ProportionalLengthsProperty
from ..scene import Scene
from ..util import Comment
from .abstract import Rule, processed_cache
@processed_cache(set())
class LawOfSinesRule(Rule):
"""
The law of sines
"""
def sources(self):
return [p for... |
# standard libraries
import warnings
import argparse
import pathlib
import yaml
# dependent packages
import decode as dc
import numpy as np
from scipy import signal
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from astropy import table
from astropy.io import fits
import ... |
import unittest
import numpy as np
import scipy.linalg
import caribou.solvers as solvers
class TestQpSolvers(unittest.TestCase):
def setUp(self):
self.sizes = [10, 100, 1000]
def test_with_quadprog(self):
for size in self.sizes:
self.assertEqual(
self.solve_random_... |
# -*- coding: utf-8 -*-
# Copyright 2015 <NAME> <<EMAIL>>
#
# 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 la... |
<gh_stars>0
from math import floor
from fractions import Fraction
N = int(input())
def tuple_diff(t1, t2):
return tuple(e1 - e2 for e1, e2 in zip(t1, t2))
def to_continued_fractions(x):
a = []
while True:
q, r = divmod(x.numerator, x.denominator)
a.append(q)
if r == 0:
... |
<gh_stars>0
import pylab as P
import glob
from . import error
from . import plca
from .sound import *
from .audiodb import *
import pdb
import scipy.signal as sig
PVOC_VAR = 0.0
# Add filterbank implementation (gammatone, etc.)
# Correct frequency scaling: Mel, Log, etc.
# Support for HCQFT -> CHROMA
# Features Clas... |
import numpy as np
from matplotlib import pyplot as plt
from scipy.stats import gaussian_kde
from ..formula import element_ratios
from matplotlib.patches import Rectangle
def van_krevelen_plot(formula_list,
x_ratio = 'OC',
y_ratio = 'HC',
patch_classe... |
import sympy as sp
import random
from fractions import Fraction
# MathString parsing library
import cyllene.a_mathstring as ms
# random function generator
import cyllene.f_random
# Reserve some (real-valued) symbols in Sympy
a, b, c, d, p, q, r, s, t, w, x, y, z = sp.symbols(
'a b c d p q r s t w x y z', real=... |
"""
===========================================
Testing Utilities (:mod:`discretize.tests`)
===========================================
.. currentmodule:: discretize.tests
This module contains utilities for convergence testing
Classes
-------
.. autosummary::
:toctree: generated/
OrderTest
Functions
---------
.... |
import pandas as pd
import scipy.stats
import random
def generate_wb_lm(n):
wb_lm_list = []
for i in range(0,n):
lm_temp = random.uniform(1,2)
wb_lm_list.append(lm_temp)
#print(randomlist)
return(wb_lm_list) |
<filename>imot_tools/math/sphere/interpolate.py
# ##############################################################################
# interpolate.py
# ==============
# Author : <NAME> [<EMAIL>]
# ##############################################################################
"""
Interpolation algorithms.
"""
import numpy... |
<gh_stars>0
"""VAD is the Voice Activity Detection module"""
__author__ = '<NAME>'
import copy
import numpy as np
from scipy.special import logsumexp
import fbe_vad_sohn
import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath("__file__")),"./noise-tracking-hendriks/"))
import noise_trackin... |
#coding: utf-8
"""
Summary
-------
The functions in this file are used for extracting data from the weather data files
downloaded from Environment & Climate Change Canada and terrain lookup files (ex,
slope, drainage).
References
----------
get_b relies on information from Lawson & Armitage (2008)
<NAME>., & <NAM... |
<reponame>opnfv/samplevnf
#!/usr/bin/python
##
## Copyright (c) 2020 Intel 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/licenses/LICENSE... |
<filename>Code/MCP_TREAT.py
from tqdm import tqdm
import glob
import logging
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import scipy.ndimage as ndi
import skimage.feature
import skimage.io
import skimage.measure
LOG_FORMAT = "%(levelname)s %(asctime)s - %(filename)s %(funcName)s ... |
import scipy.stats as stats
import numpy as np
from .BaseConditionalDensitySimulation import BaseConditionalDensitySimulation
from cde.utils.distribution import batched_univ_t_cdf, batched_univ_t_pdf, batched_univ_t_rvs
class LinearStudentT(BaseConditionalDensitySimulation):
"""
A conditional student-t distributio... |
<filename>open_cp/kernels.py
"""
kernels
~~~~~~~
For us, a "kernel" is simply a non-normalised probability density function.
We use kernels extensively to represent (conditional) intensity functions in
point processes.
More formally, a kernel is any python object which is callable (e.g. a
function, or an instance of ... |
import os
from os.path import exists, join
import hydra
import joblib
import numpy as np
import pysptk
import pyworld
import torch
from hydra.utils import to_absolute_path
from nnmnkwii.io import hts
from nnmnkwii.postfilters import merlin_post_filter
from nnsvs.gen import (
gen_spsvs_static_features,
gen_worl... |
from sklearn import svm
from menpo.shape import PointCloud
from menpo.shape import TriMesh
from menpo.image import MaskedImage
from menpo.visualize.base import Viewable
from scipy.spatial.distance import euclidean as dist
import numpy as np
class SVS(Viewable):
def __init__(self, points, tplt_edge=None, nu=0.5, ... |
<filename>ogusa/parameter_plots.py<gh_stars>0
# import packages
import numpy as np
import os
import scipy.interpolate as si
import matplotlib.pyplot as plt
# import matplotlib
CUR_PATH = os.path.split(os.path.abspath(__file__))[0]
style_file = os.path.join(CUR_PATH, 'DynamicPopPlots.mplstyle')
plt.style.use(style_file)... |
# Jyväskylä 28th Summer School
# COM2 group work
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.stats import normaltest
if __name__ == '__main__':
# Load data from CSV
df_red = pd.read_csv('winequality-red.csv', sep=';')
df_white = pd.read_csv('winequality-white.csv... |
import numpy as np
from scipy import interpolate
from scipy.signal import argrelextrema
import warnings
from typing import Tuple, Optional, Iterable
VALID_CURVE = ["convex", "concave"]
VALID_DIRECTION = ["increasing", "decreasing"]
class KneeLocator(object):
"""
Once instantiated, this class attempts to find... |
<gh_stars>0
import sys
from os import listdir
from os.path import isdir, isfile, join
import math
import pandas as pd
import seaborn as sns
from mpl_toolkits.mplot3d import Axes3D
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy import stats
import argparse
# import homoglyphs as hg
import statsmodel... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
# Essentials
import os, sys, glob
import pandas as pd
import numpy as np
import nibabel as nib
import scipy.io as sio
from tqdm import tqdm
# Stats
import scipy as sp
from scipy import stats
import statsmodels.api as sm
import pingouin as pg
# Plotting
import seaborn ... |
<gh_stars>0
"""
@brief Script used for the reach environment using as state info the images
@author <NAME>
@date 03 Aug 2021
"""
import numpy as np
import time
# My import
from dVRL_simulator.PsmEnv import PSMEnv
from dVRL_simulator.vrep.simObjects import table, obj, target
import transforms3d.euler as euler
im... |
# coding: utf-8
# # Parametric Resonance
# I intend to understand the analytical and numerical solutions of a parametrically driven oscillator.
#
# $$ \ddot{x} + \frac{\omega_0}{Q} \dot{x} + \omega_0^2 (1 + 2 \alpha \cos(\omega t)) x = f(t) $$
#
# where $\omega_0$ is the natural frequency, $Q$ is the quality factor,... |
"""
physionet2017.py
----------------
This module provides classes and methods for creating the Physionet 2017 database.
By: <NAME>, Ph.D., 2018
"""
# Compatibility imports
from __future__ import absolute_import, division, print_function
# 3rd party imports
import os
import shutil
import urllib
import zipfile
import ... |
"""
Utils for Python Stress Detector
Created on 10 Jul 2018
@author: MaxMouse
"""
from scipy.io import wavfile
import emd
import os
import sys, getopt
import matplotlib.pyplot as plt
def plot_data(the_data):
plt.plot(the_data)
plt.show()
def get_audio_data_from_file_absolute_path(input_file):
return wa... |
from scipy.optimize import curve_fit
from hydroDL.master import basins
from hydroDL.app import waterQuality, relaCQ
from hydroDL import kPath
from hydroDL.model import trainTS
from hydroDL.data import gageII, usgs
from hydroDL.post import axplot, figplot
from hydroDL import utils
import torch
import os
import json
imp... |
<filename>ODEs/solver-demos/python/SciPy/sys_1st_ord_ivp_01.py
"""
Please see
https://computationalmindset.com/en/neural-networks/ordinary-differential-equation-solvers.html#sys1
for details
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
def ode_sys(t, XY):
x=XY[0]
y=X... |
<filename>Code/Analysis/ThermalDM/cmbforecast.py
"""
cmbforecast.py
Generates the CMB forecast comparisonss for Planck, Simons and CMB-S4.
- If data is not stored in DarkBBN/Data this needs to be modified in get_data
- Information on how to run and filename structure is in __main__ section
"""
import numpy as np
im... |
<filename>src/models/dwdii_bc_model_helper.py
#
# Author: <NAME>
#
# Created: Mar 14, 2017
#
# Description: Model Helper Functions
#
#
__author__ = '<NAME>'
import collections
import csv
import os
import random
import sys
import gc
import itertools
from decimal import *
from scipy import misc
from scipy import ndi... |
<gh_stars>10-100
"""Alignment algorithms."""
from warnings import warn
import numpy as np
from scipy.linalg import svd, det
from . import earth
from . import dcm
from . import util
def align_wahba(dt, theta, dv, lat, VE=None, VN=None):
"""Estimate attitude matrix by solving Wahba's problem.
This method is ba... |
# python3 test_resnet_2s2a_metadata.py --device=1 --test_kwargs='test_kwargs_resnet_2s2a_metadata_1000_fold_1337.p' --testset='testset_snp_1000_fold_1337.txt' --sampling='snp' --model='model_resnet_2s2a_metadata_1000_fold_1337.pt' --pred='pred_test_resnet_2s2a_metadata_1000_fold_1337.txt' --phenotype_dist='phenotype_di... |
<filename>junk/color_test.py
import cv2
import numpy as np
from time import time
from math import sqrt
from scipy import interpolate
def color_gradient_v4(img, edges_x):
# new_img = np.zeros_like(img, dtype=np.float32)
new_img = img.copy().astype(np.float32)
color = np.mean(img[np.argwhere(edges_x[:, 0] >... |
<reponame>rperrin22/FEHM_supplementary
import numpy as np
import pandas as pd
from pylagrit import PyLaGriT
from matplotlib import pyplot as plt
from scipy import interpolate
from scipy.interpolate import griddata
class create_FEHM_run:
def __init__(self,test_number,param_file):
# read in the pa... |
<reponame>nschor/G2LGAN<gh_stars>10-100
#!/usr/bin/env python
__author__ = "<NAME>"
__license__ = "MIT"
import tensorflow as tf
from tensorflow.python.ops import math_ops
import scipy.io as sio
import numpy as np
import math
import os
from scipy import ndimage
from scipy.io import loadmat
def load_mat(matFile, cu... |
<filename>py/rotcurve/densitymodels.py
# coding: utf-8
"""Spherically symmetric density models.
For examples of models, see <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>, "Empirical Models for Dark Matter Halos. I.
Nonparametric Construction of Density Profiles and Comparison with Parametric
Models," Astron J. 132:2685–2... |
<filename>lib/augmentation/random_shift.py
import numpy as np
import scipy.ndimage as ndimage
import sys,os
sys.path.append('/home/zongdaoming/cv/multi-organ/multi-organ-ijcai')
def transform_matrix_offset_center_3d(matrix, x, y, z):
offset_matrix = np.array([[1, 0, 0, x], [0, 1, 0, y], [0, 0, 1, z], [0, 0, 0, 1]... |
<reponame>tairaO/CarND-Path-Planning-Project
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 28 13:26:45 2018
@author: taira
"""
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.interpolate import splprep,splev
# reead data
filename = './data/highway_map.csv'
data = np.genfromtxt(f... |
<reponame>DavidWalz/polytopewalk
"""
This module provides functions to uniformly sample points subject to a system of linear
inequality constraints, :math:`Ax <= b` (convex polytope), and linear equality
constraints, :math:`Ax = b` (affine projection).
A comparison of MCMC algorithms to generate uniform samples over a... |
from __future__ import print_function, division
import numpy as np
import matplotlib.pyplot as plt
from numpy import linalg as LA
from matplotlib.animation import FuncAnimation
from matplotlib.ticker import FormatStrFormatter
from mpl_toolkits.mplot3d import Axes3D
from operator import itemgetter, attrgetter, truediv
i... |
<filename>environment.py
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
from matplotlib.pyplot import cm
class Environment:
def __init__(self, number_of_customers) -> None:
self.number_of_customers = number_of_customers
def create_experiment(self, plot=False):
dis... |
<filename>nricp.py
import numpy as np
from scipy import sparse
from sklearn.neighbors import NearestNeighbors
from sksparse.cholmod import cholesky_AAt
import open3d as o3d
import copy
def choleskySolve(M, b):
factor = cholesky_AAt(M.T)
return factor(M.T.dot(b)).toarray()
Debug=True
normalWeighting=False
... |
<reponame>yao-zl/python-deltasigma<filename>deltasigma/_rmsGain.py
# -*- coding: utf-8 -*-
# _rmsGain.py
# Module providing the rmsGain function
# Copyright 2013 <NAME>
# This file is part of python-deltasigma.
#
# python-deltasigma is a 1:1 Python replacement of Richard Schreier's
# MATLAB delta sigma toolbox (aka "d... |
<filename>gameoflife/game_of_life.py
import numpy as np
from scipy.signal import convolve2d
class GameOfLife(object):
def __init__(self, petri_dish, size):
self.kernel = [[1, 1, 1],
[1, 0, 1],
[1, 1, 1]]
self.size = size
self.state = petri_dish... |
'''
Basic models for decomposing large-scale stacked profiles
'''
import numpy as np
from astropy.modeling import models, fitting
from scipy.interpolate import InterpolatedUnivariateSpline
from scipy.special import erf
from scipy.optimize import curve_fit
from functools import partial
from astropy.convolution import ... |
<gh_stars>0
import random as rnd
from sympy import pretty, sqrt, symbols
import json
def elementosListaEhDistinta(lista):
for indiceLista in range(len(lista)):
for indiceListaComparacao in range(len(lista)):
if indiceLista == 4:
return True
elif lista[indiceLista] ==... |
<reponame>xixigaga/GolemQ<filename>utils/lost1.py<gh_stars>0
#
# The MIT License (MIT)
#
# Copyright (c) 2018-2020 azai/Rgveda/GolemQuant
#
# 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... |
from chainer.dataset import DatasetMixin
import six
import numpy as np
import os
from scipy.sparse import load_npz
from numba import jit
@jit
def sp_noise(data, occur_rate=0.9, sp_rate=0.5):
noise = np.random.uniform(0, 1, data.shape)
for i, p in enumerate(noise):
noise[i] = data[i] if p < occur_rate... |
<filename>FRI_detect/functions/double_consistency_search.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 9 17:38:11 2020
@author: peter
"""
import numpy as np
import scipy.stats
try:
import cosmic.cosmic
except ImportError:
cosmic = None
from FRI_detect.functions import extract_e... |
<reponame>MRod5/pyturb
"""
Intake:
-------
Generic intake (diffuser) control volume. Extends from ControlVolume.
Implements 30 different thermodynamic properties and variables of the
control volume.
MRodriguez 2020
"""
from pyturb.power_plant.control_volume import ControlVolume
from pyturb.gas_models.isentropic_... |
<filename>bpdl/data_utils.py
"""
The basic module for generating synthetic images and also loading / exporting
Copyright (C) 2015-2020 <NAME> <<EMAIL>>
"""
from __future__ import absolute_import
import glob
# import warnings
import itertools
import logging
import multiprocessing as mproc
import os
from functools impo... |
# Importing the needed python packages
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
import time
import sys
from pylab import *
from matplotlib.patches import Rectangle
# biological parameters definition
kon=0.1
koff=0.5
T=0.01
# simulation parameters definition
... |
import numpy as np
import os
from scipy.io import loadmat
from scipy.special import kv, iv
from numpy import pi, real, imag, exp, sqrt, sum, sin, cos
# see <NAME>., and <NAME>. "Stokes flow due to a Stokeslet in a pipe."
# Journal of Fluid Mechanics 86.04 (1978): 727-744.
# class containing functions for detailed e... |
import numpy
from scipy.special import expit, softmax
import math
'''
VMLP: Vectorised Multilayer Perceptron
a neuron is represented as a vector;
a the neural network is represented as an array of a matrix of vectors
this helps making the training process faster;
todo: use MinPy to leverage GPU suppor... |
<reponame>dmalagarriga/PLoS_2015_segregation
#!/usr/bin/python
import matplotlib
matplotlib.use('Agg')
from scipy import *
from pylab import *
from numpy import *
from matplotlib.collections import LineCollection
import glob
import os
from os.path import join as pjoin
def comparacio(a,b):
(Sepa,numa) = a.s... |
from BackEnd.VisibleTree import VisibleTree
from BackEnd.Node import Node
from ML.Sorter.sorter import sorter
import os
from nltk import word_tokenize
from nltk.stem.porter import *
import pickle
from BackEnd.Document import Document
import numpy as np
from scipy.sparse import coo_matrix, hstack, vstack
from nltk impor... |
from nltk.stem.lancaster import LancasterStemmer
from nltk.stem.wordnet import WordNetLemmatizer
import numpy as np
import scipy.spatial.distance
import itertools
import operator
import heapq
from typing import Tuple, List
from players.codemaster import *
class MiniMaxCodemaster(Codemaster):
def __init__(self, **... |
# %% [markdown]
# # THE MIND OF A MAGGOT
# %% [markdown]
# ## Imports
import os
import time
import warnings
from itertools import chain
import colorcet as cc
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import networkx as nx
import numpy as np
import pandas as pd... |
##############################################################################
#
# Unit tests for operations that prepare squeezed coherent states
#
##############################################################################
import unittest
import os, sys
sys.path.append(os.getcwd())
import numpy as np
from scipy.s... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020-2021 Alibaba Group Holding Limited.
#
# 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/LI... |
import numpy as np
import scipy
import scipy.cluster
import cv2 as cv
import mss
import time
from multiprocessing import Queue, Pool
import sys
## FLAGS
# Full speed if -1
FIXED_FPS = 5
NB_MONITOR = 1
MONITOR_1 = {'id':1, 'w':2560, 'h':1080, 'col':6, 'row':4,'active':True}
MONITOR_2 = {'id':2, 'w':3840, 'h':2160, 'col... |
"""
Created on Sun Sep 13 15:13:33 2020
@author: iseabrook1
"""
#This script contains the code required to produce analyse the predictability of
#binary edge changes given the value of l_e for each edge.
#<NAME>, <EMAIL>
#MIT License. Please reference below publication if used for research purposes.
#Reference: Sea... |
"""
Utility functions used throughout the code.
"""
import io
import json
import os
import pickle
import logging
import numpy as np
import pathlib
import torch
from torch.nn import Sequential, Module, Linear
from scipy.sparse import csc_matrix
from scipy import optimize, interpolate
from scipy.stats import norm as ... |
<reponame>Bengt/PYPOWER
# Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Converts external to internal indexing.
"""
import sys
from warnings import warn
from copy import deepcopy
from numpy import array, ... |
<filename>lib/kinematics/HTM.py
# Access to parent folder to get its files
import sys, os
from pandas import array
sys.path.append(sys.path[0].replace(r'/lib/kinematics', r''))
# Libraries
import numpy as np
from lib.movements.HTM import *
from lib.dynamics.Solver import *
from sympy import *
def forwardHTM(robot : ... |
<filename>Server/Deprecated/server_rme_old.py
import numpy
import time
import math
from scipy import optimize
import json
import sys
#CONSTANTS
CHIP_ID = 1 #unique to chip
PERIOD = 10 #seconds between each instance
URL = 'http://192.168.1.108:8080/update'
CENTER_DIST = 7.476063 #can change to be a fucntion of location... |
<filename>MyTools/Quaternion/rigid_transf2.py
import cmath as mth
import numpy as np
import scipy as sc
import matplotlib.pyplot as plt
t1 = np.linspace(0, 2 * np.pi, 11)
t2 = np.linspace(0, 2 * np.pi, 50)
print ("Len A: ", len(t1), " -- Len B: ", len(t2))
x1 = np.cos(t1)
y1 = np.sin(t1)
x2 = np.cos(t2)
y2 = np.sin(t... |
''' adapted from https://github.com/all-umass/ManifoldWarping '''
import numpy as np
import scipy as sp
import sys
import time
import scipy.spatial.distance as sd
from sklearn.metrics.pairwise import euclidean_distances, pairwise_distances
from sklearn.manifold import Isomap,LocallyLinearEmbedding
import pandas as pd
... |
<reponame>Nanguage/miniMDS
from matplotlib import pyplot as plt
import numpy as np
import sys
sys.path.append("..")
import data_tools as dt
import array_tools as at
from scipy import stats as st
import misc
chroms = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, "X")
n = len(chroms)
m... |
from os import mkdir
from os.path import join, exists, basename
from glob import glob
from scipy.stats import norm
from plot_fcn import plot_clean_vs_noisy
from calm.pandas_time_series import PandasTimeSeries
MAKE_PLOTS = True
INPUT_DIR = "clean_traces"
OUTPUT_DIR = "noisy_traces"
OUTPUT_PLOT_DIR = "plots"
NOISE_LOC =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.