text string |
|---|
"""ASR test."""
import os
import matplotlib.pyplot as plt
import numpy as np
import pytest
from meegkit.asr import ASR, asr_calibrate, asr_process, clean_windows
from meegkit.utils.asr import yulewalk, yulewalk_filter
from meegkit.utils.matrix import sliding_window
from scipy import signal
np.random.seed(9)
# Data f... |
<filename>lake_model/lakemodel_example.py
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 27 18:08:44 2015
Author: <NAME>
Example Usage of LakeModel in lake
"""
import numpy as np
import matplotlib.pyplot as plt
from lake import LakeModel, LakeModelAgent, LakeModel_Equilibrium
import pandas as pd
#Use Matplotlib to Ad... |
# Sub-functions for 1D heat transfer code
# __main__ will main_args a non-linear 1D heat transfer analysis
# <NAME>
# OFR Consultants
# 15/05/2019
# Conversion from DegC to DegK
import numpy as np
from matplotlib import pyplot as plt
def ISO834_ft(t):
# returns the ISO curve where t is [s]
tmin = t / 60
... |
<reponame>davidlu89/pytf
import numpy as np
from scipy.signal import firwin
try:
import pyfftw.interfaces.numpy_fft as fft
except ImportError:
import scipy.fftpack as fft
# Authors : <NAME> <<EMAIL>>
#
# License : BSD (3-clause)
def create_filter(order, cutoff, nyquist, N, ftype='fir', output='freq', shift=T... |
import sympy
import qalgebra.core.operator_algebra
import qalgebra.library.fock_operators
from qalgebra.convert.to_sympy_matrix import convert_to_sympy_matrix
from qalgebra.core.hilbert_space_algebra import LocalSpace
def test_convert_to_sympy_matrix():
N = 4
Hil = LocalSpace('full', basis=range(N))
Hil... |
import argparse
import os, sys
import os.path as osp
import torchvision
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import transforms
import network
import loss
from torch.utils.data import DataLoader
from data_list import ImageList, ImageList_idx
import random, pd... |
<gh_stars>1-10
import numpy as np
# Dictionary of object flags
objFlagDict = {'TOO_FEW_OBS':2**0,
'BAD_COLOR':2**1,
'VARIABLE':2**2,
'TEMPORARY_BAD_STAR':2**3,
'RESERVED':2**4,
'REFSTAR_OUTLIER': 2**5,
'BAD_QUANTITY': 2**6}
# D... |
'''
script to restructure the urban sounds data set into the required format to run
the train.py script on it.
Download the the dataset from:
https://www.kaggle.com/pavansanagapati/urban-sound-classification
Then unpack train.zip into root specified below, define where the restructured
data is saved to (save_to) and th... |
"""
Communications Discpline for CADRE
"""
import os
from six.moves import range
import numpy as np
import scipy.sparse
from MBI import MBI
from openmdao.core.explicitcomponent import ExplicitComponent
from CADRE.kinematics import fixangles, computepositionspherical, \
computepositionsphericaljacobian, computep... |
<reponame>chiefenne/PyAero<gh_stars>10-100
import os
import copy
import numpy as np
from scipy import spatial
from PySide6 import QtCore, QtGui
import GraphicsItemsCollection as gic
import GraphicsItem
class Connect:
"""docstring"""
def __init__(self, progdialog):
# get MainWindo... |
<reponame>petersontylerd/spark-courses<filename>SparkML/MachineLearningSparkDataTypes.py
import numpy as np
import scipy.sparse as sps
from pyspark.mllib.linalg import Vectors
# create SparkContext object
spark = SparkSession.builder.appName("Unit03_IntroML").getOrCreate()
sc = spark.sparkContext
# Spark MLlib supp... |
<filename>3_day/sskernel.py<gh_stars>0
import numpy as np
import scipy as sp
from scipy.interpolate import interp1d
from IPython import embed
def ilogexp(x):
if x < 1e2:
y = np.log(np.exp(x)-1)
else:
y = x
return y
def logexp(x):
if x < 1e2:
y = np.log(1 + np.exp(x))
else:... |
import scipy.integrate as integrate
import numpy as np
import numpy.random as rd
from fractions import *
import scipy as sp
import matplotlib.pyplot as plt
from functools import reduce
def poscheck(ev):
if any(x <= 0 for x in ev):
raise Exception('You have negative eigenvalues')
else:
return 0
def checkvolume(... |
<filename>graph2vec_generation/inputfile_generation.py
import os
import pandas as pd
import statistics
import json
import numpy as np
import time
import argparse
def getArgs():
parser = argparse.ArgumentParser()
parser.add_argument('-inpath',
required=False,
def... |
<reponame>veghp/Python_scripts
from scipy import sparse, io
import pandas as pd
import numpy as np
# See https://github.com/veghp/R_scripts/blob/master/export_cellphonedb.R
# counts.txt : writeMM(<EMAIL>[, cells], file = "counts.txt")
# colnames.txt : write(colnames(counts), file = "colnames.txt")
# rownames.txt : writ... |
<filename>py_wholebodymovement/utils/cleaning_utils.py
#!/usr/bin/env python
# coding: utf-8
import pandas as pd
import numpy as np
import scipy
import pywt
def clean_gaussian_outliers(sig, sigmas=3):
"""Fills forward the values more than `sigmas` standard deviations away from `sig`'s mean.
If the first value is a... |
<reponame>hornekyle/AD-PIV
#!/usr/bin/env python
import matplotlib as mpl
mpl.rcParams['font.family'] = 'serif'
mpl.rcParams['font.size'] = 11
mpl.rcParams['font.serif'] = 'palatino'
mpl.rcParams['font.sans-serif'] = 'avant guard'
mpl.rcParams['text.usetex'] = 'yes'
mpl.rcParams['image.cmap'] = 'viridis'
import pylab... |
#!/usr/bin/env python
# coding: utf-8
# # Informer
#
# ### Uses informer model as prediction of future.
# In[1]:
import os, sys
from tqdm import tqdm
from subseasonal_toolkit.utils.notebook_util import isnotebook
if isnotebook():
# Autoreload packages that are modified
get_ipython().run_line_magic('load_ex... |
import csv
import os
from model import *
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
import cv2
import numpy as np
import scipy.misc
DATASET_PATH = "/home/ameya/mydata/behavioral_cloning_data"
# DATASET_PATH = "/home/ameya/mydata/behav_clon_data"
CSV_PATH = os.path.join(DATAS... |
# TEST 2: Bigram significance tests in any position, as prefixes, and as suffixes, on the entire Proto-Quechuan dataset
from ccnc.algorithm import ccnc_statistic
from ccnc.data import LexicalDataset, ShuffledVariant
from ccnc.filters import AnySubsequenceFilter, PrefixSubsequenceFilter, SuffixSubsequenceFilter
from cl... |
import autograd.numpy as np
import numpy.testing as np_testing
from scipy.linalg import eigvalsh, expm, logm
from pymanopt.manifolds import SymmetricPositiveDefinite
from pymanopt.tools.multi import multiexpm, multilogm, multisym, multitransp
from ._manifold_tests import ManifoldTestCase
def geodesic(point_a, point... |
"""This file contains the export method for men-files.
Export a .men file
<NAME> - march 2018
"""
from os import path
from numpy import vstack, array, NaN, zeros
from pandas import Timestamp
from scipy.io import savemat, loadmat
from ..utils import datetime2matlab
def load(fname):
raise NotImplementedError(... |
<gh_stars>0
import numpy as np
from threeML.minimizer.minimization import LocalMinimizer, FitFailed
from threeML.utils.differentiation import get_jacobian
import scipy.optimize
_SUPPORTED_ALGORITHMS = ['L-BFGS-B', 'TNC', 'SLSQP']
class ScipyMinimizer(LocalMinimizer):
valid_setup_keys = ('tol', 'algorithm')
... |
import scipy
import scipy.ndimage
import numpy
import matplotlib.pyplot
def plot(x, y, z, ax=None, **kwargs):
r"""
Plot iso-probability mass function, converted to sigmas.
Parameters
----------
x, y, z : numpy arrays
Same as arguments to :func:`matplotlib.pyplot.contour`
ax: axes obj... |
<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Wrapper around the sepsis simulator to get trajectories & optimal policy out.
Behavior for our purposes will be eps-greedy of optimal.
Lots of code here is directly copied from the original gumbel-max-scm repo.s
@author: kingsleychang
"""
# Sepsis S... |
<reponame>aselle/wavextrema
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
"""Class for working with Protein Structure Graphs"""
# %%
# Graphein
# Author: <NAME> <<EMAIL>>
# License: MIT
# Project Website: https://github.com/a-r-j/graphein
# Code Repository: https://github.com/a-r-j/graphein
import os
import glob
import re
import pandas as pd
import numpy as np
import dgl
import subprocess
im... |
import numpy as np
from scipy.optimize import minimize
from scipy import optimize
# array operations
class OrthAE(object):
def __init__(self, views, latent_spaces, x = None, knob = 0):
# x: input, column-wise
# y: output, column-wise
# h: hidden layer
# views and late... |
<gh_stars>1-10
"""This is your method of passing Pre-Calculus"""
import math
from fractions import Fraction
################################################################################
# Global Constants
################################################################################
nan = float("nan")
NaN = nan
... |
<gh_stars>1-10
import time
import statistics
from collections import OrderedDict, deque
from contextlib import contextmanager
from collections.abc import Iterable
class RecordManager:
def __init__(self):
self.groups = OrderedDict()
self.stats = OrderedDict()
self.records = OrderedDict()
... |
<filename>trenchripper/.ipynb_checkpoints/interactive-checkpoint.py
# fmt: off
import matplotlib.pyplot as plt
import numpy as np
import skimage as sk
import pandas as pd
import h5py
import pickle
import copy
from scipy import ndimage as ndi
from skimage.segmentation import watershed
from ipywidgets import interact, i... |
<filename>pyGPGO/covfunc.py
import numpy as np
from scipy.special import gamma, kv
from scipy.spatial.distance import cdist
default_bounds = {
'l': [1e-4, 1],
'sigmaf': [1e-4, 2],
'sigman': [1e-6, 2],
'v': [1e-3, 10],
'gamma': [1e-3, 1.99],
'alpha': [1e-3, 1e4],
'period': [1e-3, 10]
}
def... |
<reponame>Rubenkl/evalutils
import gc
from collections import namedtuple
from typing import List, Optional, Tuple, Union
import numpy as np
from numpy import ndarray
from scipy.ndimage.filters import convolve
from scipy.ndimage.morphology import binary_erosion, generate_binary_structure
def distance_transform_edt_fl... |
<reponame>jorgemarpa/lightkurve
"""Defines the Seismology class."""
import logging
import warnings
import numpy as np
from matplotlib import pyplot as plt
from scipy.signal import find_peaks
from astropy import units as u
from astropy.units import cds
from .. import MPLSTYLE
from . import utils, stellar_estimators
f... |
from deepleaps.dataloader.TensorTypes import TensorType
import scipy.misc as misc
class IMAGE(TensorType):
def image_loader(self, path):
return misc.imread(path)/255.
def image_saver(self, path, data):
return misc.imsave(path, data)
def getSample(self, sample):
return self.image_l... |
<gh_stars>10-100
import numpy as np
import scipy.linalg as la
import cvxpy as cp
import torch
import torch.optim as optim
import argparse
import setproctitle
import os
from gym import spaces
import tqdm
import policy_models as pm
import disturb_models as dm
import robust_mpc as rmpc
from envs.random_nldi_env import R... |
import numpy as np
from scipy import optimize, interpolate
import pandas as pd
import matplotlib.pyplot as plt
def transform(p, x, y):
#TODO: Read the xlsx files of origin tests of all rates and the formed sheet test at lowest rate
if np.max(x[:,0]) >= np.max(y[:, 0]):
trs = interpolate.interp1d(p[0]+... |
<reponame>zudi-lin/tracking_toolbox<filename>trackbox/utils.py
"""Utils for data I/O and visualization
"""
import json
import numpy as np
import skvideo.io
from matplotlib import pyplot as plt
from scipy.ndimage import zoom
from skimage.color import rgb2gray
from skimage.measure import label
from skimage.morphology im... |
import pytest
from scipy.optimize import check_grad
import numpy as np
import jax.numpy as jnp
from itea.classification import ITExpr_classifier, ITEA_classifier
from jax import grad, vmap
from sklearn.datasets import make_blobs
from sklearn.exceptions import NotFittedError
from sk... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy.optimize import curve_fit
def welch_t(a, b, ua=None, ub=None):
# t = (mean(a) - mean(b)) / sqrt(std(a)**2 + std(b)**2)
if ua is None:
ua = a.std()
if ub is None:
ub = b.std()
xa = a.mean()
xb = b.mean()
t = np.abs(xa - xb) ... |
<reponame>kylemann16/plumbline
# Dask
from dask.distributed import Client, progress
import dask
# PDAL and Entwine
from pyproj import CRS, Transformer
from ept.ept import EPT
import pdal
# Scipy
from scipy import stats as sci_stats
# Standard imports
import io
import logging
import argparse
import sys
from pathlib i... |
<gh_stars>1-10
# Copyright (c) 2012-2014 The GPy authors (see AUTHORS.txt)
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
from scipy import stats
import scipy as sp
from GPy.util.univariate_Gaussian import std_norm_pdf,std_norm_cdf,inv_std_norm_cdf
_exp_lim_val = np.finfo(np.float64).m... |
<filename>dd_1/Part 1/Section 10 - Extras/11 -command line arguments/example10.py
# sometimes we want to make two (or more) arguments mutually exclusive,
# i.e. we cannot specify both at once
# for example, we may have something where we want the user to specify verbose output,
# quiet output, or neither, but not both
... |
import numpy as np
import torch
from scipy import stats
from tqdm import tqdm
import random
from nltk.tokenize import TweetTokenizer
import logging
logging.basicConfig(format='%(asctime)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S')
logging.getLogger().setLevel(logging.INFO)
class IMExplainer:
def __init__(self,... |
# pluto.py
# My brother Steven and father Jim collaborated buiding this program
# I modified the output - to print the vector and return the string "Done"
# === import random.py and statistics.py
import random
import statistics
# === initialize temperatures in a vector that represents n layers of pluto's surface
# =... |
from six.moves import cPickle as pickle
from scipy import ndimage
import matplotlib.pyplot as plt
import numpy as np
# extract data
with open('./train_data/data.pickle', 'rb') as f:
tr_dat = pickle.load(f)
with open('./train_data/label.pickle', 'rb') as f:
tr_lab = pickle.load(f)
with open('./test_data/data.pi... |
from couplib.constants import *
from configuration import *
from couplib.lookup import *
#from interfaces import OverlapInterface
from scipy.integrate import quad
from scipy.integrate import quad_explain
from interfaces import *
import numpy as np
import math
from exstatesreader import ExStatesReader
#Nummerical integ... |
import matplotlib.pyplot as plt
import nltk
import os
from collections import Counter
from itertools import product
from statistics import mean, mode, median
nltk.download('stopwords')
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from nltk.tokenize import TweetTokenizer, word_... |
import numpy as np
import scipy.misc
import matplotlib.pyplot as plt
plt.rc("font", size=16, family="serif", serif="Computer Sans")
plt.rc("text", usetex=True)
data = np.loadtxt('../Data/road.txt')
plt.plot(data[:,0], data[:,1], 'bo', markersize=5)
plt.xlabel('Age (years)')
plt.ylabel('Distance (metres)')
plt.axis([... |
import pandas as pd
import numpy as np
import pickle
from scipy.special import expit
# 0 8 airx_s67 0.703696
# 1 5 preresnet_s67 0.697541
# 2 5 GAPNet_13_512crop 0.685118
# 3 1 GAPNet_13_ext 0.669337
# 4 3 GAPNet_13_ext_rgby 0.650539
# 5 ... |
<filename>src/KMMC.py
from math import log
from numpy import zeros, array, where
from scipy.cluster.vq import whiten, kmeans, vq
def toArray(img):
arrayPix = zeros((img.shape[0] * img.shape[1], 1))
for x in range(0, img.shape[0]):
for y in range(0, img.shape[1]):
posLineal = img.sha... |
<filename>scripts/print_matrix_multiplication_trace.py
import numpy as np
import sympy as sp
import re
def print_matrix_line(N=3,symbol="H",print_complex=False):
msg = ""
for i in range(N):
for j in range(N):
if print_complex:
msg += ("%s%d, " % (symbol,2*N*i + 2*j + 1))
else:
for k in range(2):
... |
<gh_stars>0
import sarpy.io.complex as sarpy_complex
from sarpy.io.complex.base import BaseReader
import sarpy.visualization.remap as remap
import sarpy.geometry.point_projection as point_projection
from tkinter_gui_builder.canvas_image_objects.abstract_canvas_image import AbstractCanvasImage
import sarpy.geometry.geoc... |
import os
import sys
import scipy.io
import scipy.misc
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
from PIL import Image
from nst_utils import *
import numpy as np
import tensorflow as tf
model = load_vgg_model("pretrained-model/imagenet-vgg-verydeep-19.mat")
content_image = scipy.misc.imread("... |
import os
from typing import List, Union
from scipy.io import loadmat
from . import BrandDataset, Brand
# CompCars
class CompCarsDataset(BrandDataset):
dataset_name = "CompCars"
_dataset_brand_mapping = {
'Acura': Brand.ACURA,
'Audi': Brand.AUDI,
'BWM': Brand.BMW,
'BYD': Bra... |
<reponame>ronniyjoseph/pyREM
import numpy as np
from scipy.constants import c
from scipy import signal
from .radiotelescope import beam_width
from .radiotelescope import mwa_dipole_locations
from .skymodel import sky_moment_returner
from .powerspectrum import compute_power
class CovarianceMatrix:
#Currently onl... |
<reponame>n-longuetmarx/tbip<gh_stars>10-100
"""Helpful functions for analysis."""
import numpy as np
import os
import scipy.sparse as sparse
from scipy.stats import bernoulli, poisson
def load_text_data(data_dir):
"""Load text data used to train the TBIP.
Args:
data_dir: Path to directory where data is s... |
# coding: utf-8
# In[1]:
exp_name = 'dpl_034a'
# In[2]:
import os
# In[3]:
import torch
import torch.nn as nn
import torchvision
from torch.autograd import Variable
from torch.nn import functional as F
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.patches as patches
# In... |
import copy
import quantities as pq
import scipy as sp
import scipy.signal
import scipy.special
import tools
default_kernel_area_fraction = 0.99999
class Kernel(object):
""" Base class for kernels. """
def __init__(self, kernel_size, normalize):
"""
:param kernel_size: Parameter controlling... |
import copy
import matplotlib.pyplot as plt
import numpy as np
import scipy
import SimpleITK as sitk
from data_augmentation import gen_warp_field
from data_augmentation import apply_warp as apply_warp_fra, pad_image
def apply_warp(x, warp_field, fill_mode='reflect',
interpolator=sitk.sitkLinear,
... |
<reponame>michaelmaser/ChemSchematicResolver<filename>chemschematicresolver/utils.py<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Image processing utilities
==========================
A toolkit of image processing operations.
author: <NAME>
email: <EMAIL>
"""
from __future__ import absolute_import
from __future__ im... |
<filename>ebcpy/optimization.py<gh_stars>1-10
"""Base-module for the whole optimization pacakge.
Used to define Base-Classes such as Optimizer and
Calibrator."""
import os
from typing import List, Tuple, Union
from collections import namedtuple
from abc import abstractmethod
import numpy as np
from ebcpy.utils import ... |
import os
import sys
import pickle
from typing import List
import numpy as np
import pandas as pd
from scipy.optimize import minimize_scalar
os.environ["OPENBLAS_NUM_THREADS"] = "1"
sys.path.append("../../")
from environments.Settings.EnvironmentManager import EnvironmentManager
from environments.Settings.Scenario i... |
<filename>ddm/tridiag.py
# Copyright 2018 <NAME> <<EMAIL>>
# 2018 <NAME> <<EMAIL>>
#
# This file is part of PyDDM, and is available under the MIT license.
# Please see LICENSE.txt in the root directory for more information.
# This file implements a diagonal sparse matrix format. Converting
# between format... |
<reponame>isjoung/scipy
from __future__ import division, absolute_import, print_function
from itertools import product
import numpy as np
try:
from scipy.signal import convolve2d, correlate2d
except ImportError:
pass
from .common import Benchmark
class Convolve2D(Benchmark):
def setup(self):
n... |
<gh_stars>10-100
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 17 12:30:46 2013
@author: <NAME>
This file pretends to imitate the behaviour of the MATLAB function with the same name.
"""
from prony_matlab import prony_matlab
from convmtx import convmtx
from scipy.signal import lfilter
import numpy ... |
#!/usr/bin/env python3
import sys, statistics
import regex as re
text = open(sys.argv[1],'r').read()
lines = text.split('\n')
kb = []
reclen = []
write = []
rewrite = []
read = []
reread = []
random_read = []
random_write = []
for line in lines:
if re.match(r"^\s+([0-9]+\s+)+$", line) :
numbers = re.spl... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import random
from .AbstractDist import AbstractDist
from scipy.stats import norm
class NormalDist(AbstractDist):
"""
This class is implements a normal noise distribution.
"""
def __init__(self, loc=0., scale=1., is_negative=False,
... |
<reponame>Stanford-NavLab/consensus-ndt<gh_stars>1-10
"""
mapping.py
Functions to update the map and perform global optimization given for a keyframe of NDT Clouds
Author: <NAME>
Date created: 13th June 2019
Last modified: 13th June 2019
"""
import ndt
import numpy as np
from ndt import ndt_approx
import odometry
from... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from scipy.spatial.kdtree import KDTree
from tqdm import tqdm
from PointCloudClass.channel_point import ChannelPoint
class ChannelPointCloud(object):
def __init__(self):
self.point_list = []
self.kd_tree = None
self.xyz_changed = Tru... |
from ..app import app
import numpy as np
from scipy.integrate import odeint
SCALE_FACTOR_HELPER = 2.
# FIXME: instalirati ili sa apt-getom
# The gravitational acceleration (m.s-2).
g = 9.81
def deriv(y, t, L1, L2, m1, m2):
"""Return the first derivatives of y = theta1, z1, theta2, z2."""
theta1, z1, theta2... |
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_val_score
from sklearn.neighbors import KNeighborsClassifier
from scipy.sparse import lil_matrix
import numpy as np
import json
def format_training_data_for_dnrl(emb_file, i2l_file):
i2l = dict()
with open(i2l_file, ... |
from scipy.spatial import KDTree
from numba import jit, vectorize, float32
from math import exp, sqrt, pi
import numpy as np
import numpy.linalg as la
import sklearn.metrics as mt
@vectorize([float32(float32, float32, float32, float32)])
def gauss3d(x, y, z, sigma):
N = 1/sqrt(2**3 * sigma**6 * pi**2)
return ... |
<gh_stars>0
import math
from scipy.stats import poisson
import scipy.optimize
class Neighborhood():
def __init__(self, point_center_ind):
self.center_point_ind = point_center_ind
self.has_center = True
def init_neighborhood(self,
init_size=3,
... |
import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
from matplotlib import cm
import spectral as spy
from sklearn import metrics
import time
from sklearn import preprocessing
import torch
import MSSGU
from utils import Draw_Classification_Map,distcorr,applyPCA,get_Samples_GT,GT_To_One_Ho... |
<filename>homework-1/hw1.py
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
"""
@auther fsy,zx,syj,Zero Void(lsx)
@date 2020/03/05
使用sklearn框架完成作业内容。
"""
import numpy as np
import pandas as pd
from scipy.stats import ttest_rel
from scipy.stats import t
import seaborn as sns
import matplotlib.pyplot as plt
from kflod... |
<filename>bluerov2_executive/src/bluerov2_executive/interfaces/__init__.py
#!/usr/bin/env python
import rospy
from bluerov2_msgs.srv import ConvertGeoPoints, ConvertGeoPointsRequest, SetControllerState, SetControllerStateRequest
from bluerov2_msgs.msg import FollowWaypointsGoal, FollowWaypointsResult, FollowWaypoints... |
import requests
import numpy as np
import matplotlib.pyplot as plt
from scipy import integrate
# r = requests.get('https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&apikey=2XZ08DFO2AYVOZHD')
r = requests.get('https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&s... |
<reponame>c-benko/Molecular_Alignment
import numpy as np
from scipy.integrate import ode
class integrator():
'''
Needs Jmax, sigma, Delta_omega, B, D
'''
def __init__(self, Jmax, sigma, strength, B, D):
self.Jmax = Jmax
self.sigma = sigma
self.strength = strength
self.B ... |
<reponame>bfemery-sandia/pvOps
"""
Derive the effective diode parameters from a set of input curves.
"""
import numpy as np
import matplotlib.pyplot as plt
from physics_utils import calculate_IVparams, smooth_curve
import scipy
import sklearn
from simulator import Simulator
import time
from physics_utils import iv_cut... |
''' Non-simple compressible flow.
Calculate quasi-1D compressible flow properties with varying area, friction, and heat addition.
"One-dimensional compressible flows of calorically perfect gases in which only a single driving potential is
present are called simple flows" [1]. This module implements a numerical solutio... |
<filename>pyPanair/utilities.py
#!/usr/bin/env python
import numpy as np
from scipy.interpolate import splev
def bspline(cv, degree=3, periodic=False):
""" return a function that defines a bezier spline
cv : an array of control points
degree: degree of the polynomial curve
... |
# imports
# -----------------------------------------------------------------------------
# pip-installable imports
from __future__ import print_function, division
import luigi
import cPickle as pickle
from math import ceil, floor
import numpy as np
import scipy as sp
import os
import logging
import copy
import datetim... |
# Data extracted using: https://ij.imjoy.io/
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from scipy.signal import argrelextrema
from scipy.constants import pi as π
import uncertainties as unc
from uncertainties import ufloat
distanceSS,grayValueSS = np.loadtxt(r"2021.11.18 D... |
import scipy.stats
import torch
import torch.distributions as dist
from numpy.testing import assert_allclose
import globalflow as gflow
def test_build_flowgraph():
timeseries = [
[0.0, 1.0],
[-0.5, 0.1, 0.5, 1.1],
[0.2, 0.6, 1.2],
]
V = 9
class MyCosts(gflow.GraphCosts):
... |
<gh_stars>1-10
from sklearn.metrics import roc_auc_score, precision_recall_curve, auc, f1_score
import numpy as np
from scipy import stats
from scipy.stats import t
class Evaluator:
def __init__(self, train_adj, test_adj=None, pos_threshold=None):
node_num = train_adj.shape[0]
eval_x,... |
import cirq
import numpy as np
import pytest
import sympy
from zquantum.core.wip.circuits import (
RX,
RY,
RZ,
XX,
XY,
YY,
Circuit,
H,
I,
X,
Y,
Z,
export_to_cirq,
)
class TestCreatingUnitaryFromCircuit:
@pytest.mark.parametrize(
"circuit",
[
... |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from scipy.integrate import solve_ivp
def hamiltonian(phi, p):
return 0.5*p**2 + 1. - np.cos(phi)
def beam(phi):
x = np.sin(phi)
y = -np.cos(phi)
return x, y
def RK_pendulum(t, state):... |
<reponame>UKPLab/tacl2020-interactive-rankin
import json, numpy as np, pandas as pd, os
from scipy.stats import wilcoxon
topics = ['apple', 'cooking', 'travel']
metrics = ['ndcg_at_1%', 'accuracy']
for topic in topics:
# baseline directory
baseline = 'results_coala/lno3_lr_%s_rep0/' % topic
# imp directo... |
from dotenv import load_dotenv
from bridge import Bridge
import os, json, statistics
class Adapter:
bridges = []
bridge_hosts = []
action_list = [action for action in dir(Bridge) if action.startswith('__') is False]
action = ''
error = False
def __init__(self, input):
self.id = input.g... |
# simple python script to check input data
#
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import mds
import sys
# Read from standard in
nel=0
vals=list()
for line in sys.stdin:
print float(line)
vals.append(float(line))
plt.plot(vals)
plt.show()
|
<filename>hyppo/kgof/datasource.py
"""
Module containing datasources for representing distributions.
"""
from __future__ import print_function, division
from builtins import range, object
from past.utils import old_div
from abc import ABC, abstractmethod
import autograd.numpy as np
import scipy.stats as stats
from nu... |
<filename>sim_hexa.py<gh_stars>0
#!/usr/bin/env python
import math
import sys
import os
import time
import argparse
import pybullet as p
from onshape_to_robot.simulation import Simulation
import kinematics
from constants import *
# from squaternion import Quaternion
from scipy.spatial.transform import Rotation
clas... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import json
import seaborn as sns
from sklearn.preprocessing import LabelEncoder, StandardScaler, OneHotEncoder
import random, sys, os
import tensorflow as tf
import pickle
np.random.seed(13)
random.seed(22)
tf.set_random_seed(13)
cl... |
"""Robust Neural Network meta estimator."""
# Author: <NAME>
# License: BSD 3 clause
import numpy as np
import warnings
from scipy.stats import iqr
from sklearn.base import BaseEstimator, clone
from sklearn.utils import (
check_random_state,
check_array,
check_consistent_length,
shuffle,
)
from tenso... |
from model.model import neural_network
import torch
import numpy as np
from torch.autograd import Variable
from scipy import signal
from scipy import stats
import pymef
class noise_detector():
def __init__(self,model_path,cuda_id = 0):
# initialize new empty model
self.net = neural_network()
... |
#
# Copyright (c) 2020 Expert System Iberia
#
"""Loads the STS-B dev set and evaluates a model on it
"""
import pandas as pd
import torch.utils.data
import math
import time
from scipy import stats
import torch.nn.functional as F
import os
def read_sts_csv(path, columns=['source', 'type', 'year', 'id', 'score', 'sent... |
<reponame>altndrr/persona
"""Collection of functions to work on LFW"""
# NOTE: functions are taken from https://github.com/davidsandberg/facenet
import math
import os
import numpy as np
from scipy import interpolate
from sklearn.model_selection import KFold
def distance(embeddings1, embeddings2, distance_metric=0)... |
<filename>benchmarks/benchmarks/pydy_double_pendulum.py
import numpy as np
from pyodesys.symbolic import SymbolicSys
def _get_equations(m_val, g_val, l_val):
# This function body is copyied from:
# http://www.pydy.org/examples/double_pendulum.html
# Retrieved 2015-09-29
from sympy import symbols
... |
<reponame>NiftyPET/NIMPA
"""
NIMPA: functions for neuro image processing and analysis
Generates images.
"""
import logging
import math
import numpy as np
import scipy.ndimage as ndi
try:
from miutil.plot import imscroll
except ImportError as err: # NOQA: F841
def imscroll(*_, **__):
"""delay matplotl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.