text string |
|---|
from strax.testutils import single_fake_pulse
import numpy as np
from hypothesis import given, settings
from scipy.ndimage import convolve1d
import strax
def _find_hits(r):
# Test pulses have dt=1 and time=0
# hm, maybe this doesn't test everything?
hits = strax.find_hits(r, min_amplitude=1)
# dt ... |
<reponame>1uc/morinth
# SPDX-License-Identifier: MIT
# Copyright (c) 2021 ETH Zurich, <NAME>
import numpy as np
import scipy.integrate
from morinth.quadrature import GaussLegendre
from morinth.grid import Grid
def sinusoidal(x):
x = (x - 10.0)/100.0
fx = np.sin(2.0*np.pi*x) * np.cos(2.0*np.pi*x)**2
retur... |
# -*- coding: utf-8 -*-
import os
import numpy as np
import sympy
import yaml
def create_directory(dir_name):
if not os.path.isdir(dir_name):
os.makedirs(dir_name)
def nonzero_indices(a):
return np.nonzero(a)[0]
def BezierIndex(dim, deg):
"""Iterator indexing control points of a Bezier simple... |
#2018-2019 <NAME>
#Finds a trajectory matching a provided itinerary.
#Shapely, after some experimentation, has been abandoned as unreliable;
#manifold intersections are once again being found manually.
#Call this command as
#sudo python toboldlygo.py energy mu itinerary
#for example (Jupiter) sudo python toboldly... |
from datetime import datetime
import os
import numpy as np
import pandas as pd
import random
import scipy.stats
from django.conf import settings
from .models import CurriculumDocument, StandardNode, HumanRelevanceJudgment
TEST_DATA_DUMP_PATH = os.path.join(settings.DATA_EXPORT_BASE_DIR, "../testdata")
def ranking(... |
import numpy as np
from scipy.signal.windows import hanning
def pulse(fc, fs):
"""approximate mooring navigation pulses"""
T = 0.009
num_samples = int(np.ceil(T * fs))
if num_samples % 2: num_samples += 1
t_signal = np.arange(num_samples) / fs
y_signal = np.sin(2 * np.pi * fc * t_signal) * hann... |
import numpy as np
import scipy.fftpack as spfft
from scipy.signal import resample
from scipy import interpolate
from sklearn.linear_model import Lasso,OrthogonalMatchingPursuit
#import spams
import cvxpy as cvx
import recon_utils as utils
""" Reconstruction algorithms
This module contains functions that can recons... |
#Imports
from argparse import ArgumentParser
import numpy as np
import sys
from scipy.interpolate import RegularGridInterpolator as Interp
class DataStore(object):
def __init__(self, filename):
""" Open a numpy array in the appropriate format and read it into this storage class
Args:
... |
#import os # clear screen
import numpy as np # matrix calc
from scipy.integrate import odeint # scientific computation (ode solver)
from utils.methods import poolData, sparsifyDynamics, sparseGalerkin , sparseGalerkin3D
import matplotlib.pyplot as py
#os.system('clear')
# Generate data
A=np.array([[-0.1, 2, 0],[ -... |
<reponame>sweichwald/causality-tutorial-exercises
from abc import abstractmethod
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
from numpy import (arange, cos, dot, exp, fill_diagonal, mean,
shape, sin, sqrt, zeros)
from numpy.random import permutation, randn
from scipy... |
"""
Additional skl-interface univariate filters.
"""
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils import check_X_y, safe_sqr, safe_mask
from sklearn.feature_selection._univariate_selection import f_oneway
from sklearn.utils.extmath import safe_sparse_dot, row_norms
fr... |
import numpy as np
from scipy.stats import norm
from find_streams_analysis_functions import match_values_within_std
# mc distribution
imaginary_data = np.array([1,2,2,3,3,4,4,4,4,5,5,5,5,5,6,6,6,7,8,8,9,10])
# test distributions
mean_d1 = 5
std_d1 = .1
mean_d2 = 10
std_d2 = 5
# results old - VERY WRONG
print np.sum(... |
<gh_stars>0
#!/usr/bin/env python3
import atddm
import pandas as pd
# import numpy as np
# from datetime import time
from math import sqrt
from constants import AIRPORTS, COLORS, TZONES, CODES, BEGDT, ENDDT
import seaborn as sns
import matplotlib.pyplot as plt
from statsmodels.tsa.stattools import adfuller
from scipy ... |
<gh_stars>1-10
import time
import numpy as np
import numpy.matlib as matlib
from scipy.optimize import dual_annealing
class maxpro_design:
def __init__(self):
self.s = 2.0
self.n = 8
self.p = 2
self.random_seed = np.random.RandomState(100)
self.no_local_search = True
... |
<filename>experiments/e12/main.py
import warnings
import multiprocessing
from logging import getLogger, Formatter, StreamHandler, INFO
# import json
from collections import Counter
from pathlib import Path
from scipy.spatial import cKDTree
from skimage.transform import AffineTransform
from skimage.measure import ransa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Creating a structured netcdf from unstructured SCHISM netcdf output.
This script use nearby point mapping for interpolation using scipy.spatial.
This script is an alternative version of unstrucutred2structured_ndinterpolator.py.
In future the script will be added as a... |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy import stats as scistats
from scipy import interpolate
from scipy.interpolate import interp1d, LinearNDInterpolator, \
NearestNDInterpolator, CloughTocher2DInterpolator
import scipy.optimize
import ... |
import math
import itertools
import random
import logging
from functools import partial
import numpy as np
from scipy import signal
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF, WhiteKernel
import matplotlib.pyplot as plt
from matplotlib import animati... |
# coding: utf-8
# In[1]:
import pandas as pd
import numpy as np
import seaborn as sns
from scipy import stats
from pprint import pprint
import matplotlib.pylab as plt
import re
# In[2]:
get_ipython().magic(u'matplotlib inline')
sns.set(style="ticks", color_codes=True, font_scale=1.1)
# ## Introduction
# I will... |
<reponame>Pantherkralle/pandapipes
from scipy import optimize
mdots, mdotl = 10, 10
m1 = 100
Ts, Tl = 50, 20
def Tdot1(T1):
return mdots/m1 * Ts + (mdots-mdotl)/m1 * T1 - mdotl/m1 * Tl
def dTdot1dT1():
return (mdots - mdotl) / m1
|
<filename>eugene/src/virtual_sys/lorenz.py
# lorenz.py
""" Simulates a Lorenz system (in terms of Lorenz's X, Y, and Z variables).
"""
import numpy as np
import scipy.integrate
class LorenzSystem( object ):
""" Implementation of Lorenz system.
"""
def __init__(self, beta, sigma, rho, init_x, init_y, in... |
<gh_stars>1-10
import os
import timeit
import statistics
import atexit
from tqdm import tqdm
import psutil
from inspect import getframeinfo, stack
from .shared_data import prev_runs, reference_start
from .snapshots import now
def nowdec(enabled=True):
def decorator(func):
def wrapper(*args, **kwargs)... |
import argparse
import logging
from pathlib import Path
from typing import Dict
from typing import Union, Type
import argcomplete
from termplot._version import __version__
from termplot.backend.base_plotter import Plotter
from termplot.data_source import FigureData, DataSource
from termplot.etc import EmptyEventFileE... |
# Copyright 2014 Open Connectome Project (http://openconnecto.me)
#
# 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 ap... |
import numpy as np
from scipy.interpolate import RectBivariateSpline
from scipy.ndimage import shift
#my imports
#import cv2
def LucasKanade(It, It1, rect, p0 = np.zeros(2)):
# Input:
# It: template image
# It1: Current image
# rect: Current position of the car
# (top left, bot right coordinates)
# p0: Initial ... |
<filename>model/concperf/general_model.py
import itertools
import numpy as np
import scipy.stats as stats
from tqdm.auto import tqdm
from .single_model import StateCoder as SingleStateCoder
from . import utility
from . import single_model
class StateCoder(SingleStateCoder):
def __init__(self, config, ):
... |
<reponame>tahentx/ecological-inference
"""
Plotting functions for visualizing ei outputs
"""
import warnings
import seaborn as sns
import pandas as pd
from matplotlib import pyplot as plt
from matplotlib import ticker as mticker
from matplotlib.collections import PatchCollection
from matplotlib.patches import Rectangl... |
import numpy as np
import matplotlib.pyplot as pl
import scipy.io as io
import h5py
if (__name__ == '__main__'):
f = h5py.File('imax_velocity_noPmodes_vz.h5')
net = f['velocity'][:] * 10.0
res = io.readsav('velI.idl')
spec = res['velI'][42:,100:800,100:800]
f.close()
f, ax = pl.subplots(nro... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import math
import numpy as np
from scipy.sparse import csr_matrix
from itertools import permutations
from collections import Counter
from copy import deepcopy
from tensorflow.contrib.l... |
<reponame>webdevhub42/Lambda<filename>0-notes/job-search/Cracking_the_Coding_Interview/C04TreesGraphs/python/4.2-answer.py
# 4.2 Minimal Tree
# Given a sorted (increasing order) array with unique integer elements, write an algorithm to
# create a binary search tree with minimal height.
import statistics
class Binar... |
import os, sys
import numpy as np
import matplotlib.pyplot as plt
import scipy as sci
import csv
def plot_coldict(d, dat, metkey):
max_labels = max(len(k.keys()) for k in d) -1
xticklabels = [d2['name']+":"+"|".join(k for k in sorted(d2.keys()) if k!='name') for d2 in d]
labels = [[k for k in sorted(d2.key... |
<reponame>JasonQSY/measurepy<filename>measurepy/regression.py
import numpy as np
from scipy.stats import linregress
def lineareg(x, y):
"""Apply linear regression for a numpy array.
Args:
x(numpy.array): x.
y(numpy.array): y.
Returns:
slope(float): the estimated value of slope.
... |
'''Functions for identifying moving object in almost static scene'''
import time
import os.path
import sys
#import matplotlib.pyplot as plt
import cPickle as pickle
import numpy as np
import cv2
import class_objects as co
import hand_segmentation_alg as hsa
import action_recognition_alg as ara
from scipy import ndimage... |
"""
Filename: regression.py
Modified: 2019-10-13
Author: <NAME>
E-mail: <EMAIL>
License:
The code is licensed under MIT License. Please read the LICENSE file in
this distribution for details regarding the licensing of this code.
Description:
A program to plot a linear regression.
"""
import argparse
imp... |
<gh_stars>100-1000
import time
import logging
from copy import deepcopy
import numpy as np
from scipy.spatial.transform import Rotation as R
import matplotlib.pyplot as plt
from polylidar.polylidarutil.plane_filtering import filter_planes_and_holes
from polylidar import MatrixDouble, Polylidar3D
from polylidar.polyli... |
from scipy.io import loadmat
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler, StandardScaler
from arff2pandas import a2p
from pathlib import Path
anomaly_column = 'is_anomaly'
def convert_arff_to_csv(path, split_cols_to_char=None, savedir=None):
with open(path) as f:
... |
# !/usr/bin/env python
import os
import sys
import numpy as np
import tensorflow as tf
from utils import *
import scipy.io as sio
import argparse
'''
Global Parameters
'''
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
sys.path.append(os.path.dirname(BASE_DIR))
parser = argparse.... |
# Copyright 2022 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 law or agreed to in w... |
<filename>utilities/Gnip-Python-Search-API-Utilities/build/scripts-2.7/gnip_time_series.py
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#######################################################
# This script wraps simple timeseries analysis tools
# and access to the Gnip Search API into a simple tool
# to help the analysis ... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.markers
import matplotlib.scale
from matplotlib import scale as mscale
from matplotlib import transforms as mtransforms
from matplotlib.ticker import Formatter, FixedLocator, LogLocator
import pandas as pd
from scipy import stats
from scipy import spe... |
<gh_stars>0
# Copyright 2019 Cambridge Quantum Computing
#
# 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 ... |
<reponame>DonHammerstrom/volttron-pnnl-applications<gh_stars>0
"""
Copyright (c) 2020, Battelle Memorial Institute
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must ... |
<filename>faceSwap/3DDFA/tools/to_3dmm.py<gh_stars>10-100
import sys
import os
path = os.path.abspath(__file__)
sys.path.append(os.path.dirname(path))
sys.path.append(os.path.dirname(os.path.dirname(path)))
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(path))))
import torch
import torchvision.transfor... |
<filename>qutipy/gates/Rx_i.py<gh_stars>10-100
'''
This code is part of QuTIpy.
(c) Copyright <NAME>, 2021
This code is licensed under the Apache License, Version 2.0. You may
obtain a copy of this license in the LICENSE.txt file in the root directory
of this source tree or at http://www.apache.org/licenses/LICENSE-2... |
<filename>bayesian_framework/inference/stochastic_models/stochastic_models.py
from __future__ import annotations
import collections
from abc import ABC, abstractmethod
from typing import NoReturn, Tuple, Union
import numpy as np
from scipy.stats import gamma, multivariate_normal
import bayesian_framework.shared.cova... |
<reponame>Jackwin/PaddleSlim<gh_stars>0
# ================================================================
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obt... |
<filename>examgen/lib/calc1.py
import os
import sympy
from sympy.parsing.sympy_parser import parse_expr
from sympy.polys.polytools import degree
import random
from .helper import alpha, digits_nozero, get_coefficients, render, shuffle
def poly1(x):
vals = sum([k*x**i for i,k in enumerate(reversed(get_coefficients(... |
# coding: utf-8
# # Estimating the total number of phages in soils
# We could not come by many data for the abundance of phages in soil. Our estimates are based on the data available to us, which is mainly from [Williamson](http://dx.doi.org/10.1007/978-3-642-14512-4_4) and [Parikka et al.](http://dx.doi.org/10.1111/... |
# make a multi scale representation of the data via filtering
import sys, getopt
import graphFun
import waveletFun
import numpy as np
import pygsp as gs
import igraph as ig
import os
import gzip
import scipy
from datetime import datetime, timedelta
def formatExprData(dirs,exprfile,allgenes):
reformat = []
... |
<filename>GNN/composite_graph_class.py
# coding=utf-8
import sys
import numpy as np
import tensorflow as tf
from scipy.sparse import coo_matrix
from GNN.graph_class import GraphObject, GraphTensor
#######################################################################################################################... |
<reponame>cthoyt/pybel-tools
# -*- coding: utf-8 -*-
"""This module describes a heat diffusion workflow for analyzing BEL networks with differential gene expression [0]_.
It has four parts:
1) Assembling a network, pre-processing, and overlaying data
2) Generating unbiased candidate mechanisms from the network
3) Ge... |
<filename>src/tankoh2/control_cl.py
"""control a tank optimization"""
import sys
import statistics
from tankoh2.existingdesigns import kautextDesign, NGTBITDesign
#from builtins import True, False
#from builtins import
sys.path.append('C:/MikroWind/MyCrOChain_Version_0_95_4_x64/MyCrOChain_Version_0_95_4_x64/abaqus_in... |
# -*- coding: utf-8 -*-
"""
.. module:: geek
:platform: Unix, Windows
:synopsis: GEneralised Elementary Kinetics
.. moduleauthor:: geek team
[---------]
Copyright 2018 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the Apac... |
<reponame>fkemeth/emergent_pdes
import os
import tqdm
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import pickle
import findiff
# from torchvision import transforms
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import TruncatedSVD
from scip... |
<filename>QUANTAXIS/Untitled-4.py<gh_stars>1-10
import numpy as np
import scipy
import pandas |
<filename>doc/cp/projections.py
#!/usr/bin/env python
from __future__ import division
import numpy as np
import copy
import itertools
from sympy import *
mandel = ((0,0),(1,1),(2,2),(1,2),(0,2),(0,1))
mandel_mults = (1,1,1,sqrt(2),sqrt(2),sqrt(2))
skew_inds = ((1,2),(0,2),(0,1))
skew_mults = (-1,1,-1)
def object_... |
<gh_stars>0
import numpy as np
import pandas as pd
from scipy.io import loadmat
TIMEWINDOW = 800 + 1
STEP = int(128)
FREQUENCY = 128
def _energy25(r, freq):
N = len(r)
R = np.abs(np.fft.fft(r.flatten()))**2
R[0] = 0
frequencies = [i * freq / N for i in range(N)]
CR = R.cumsum()
CR /= CR.max()... |
<filename>src/double_detection_removal.py
from astropy.io import fits
import numpy as np
from scipy import spatial
import matplotlib.pyplot as plt
def remove_object(rrg_catalogue, output_catalogue, FWHM_to_radius=1):
hdulist=fits.open(rrg_catalogue)
data_org=hdulist[1].data
print("num of objects in the rrg... |
<reponame>ermongroup/acl<filename>utils.py
import tensorflow as tf
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import collections
import functools
import random
import numpy as np
from scipy import misc
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
fro... |
import numpy as np
import time
import scipy
from scipy import stats
from scipy.special import multigammaln
from numpy.random import uniform, normal, beta, choice, gamma
from math import sqrt, floor, log
from scipy.special import erf, erfinv, gammaln
from scipy.stats import invwishart
from numpy.linalg import cholesky, ... |
<reponame>devinplatt/ms_thesis<gh_stars>1-10
#!/usr/bin/env python
"""
Script for running WMF.
"""
import argparse
import datetime
import numpy as np
import numpy
import os
import pandas
import scipy
from scipy.sparse import coo_matrix, csr_matrix
from scipy.sparse.linalg import svds
import wmf
parser = argparse.Argu... |
<gh_stars>1-10
import numpy as np
import scipy.io as sio
from min2net.utils import resampling
from min2net.preprocessing.config import CONSTANT
# load variable form config file
CONSTANT = CONSTANT['SMR_BCI']
orig_chs = CONSTANT['orig_chs']
orig_smp_freq = CONSTANT['orig_smp_freq']
trial_len = CONSTANT['trial_len']
n_c... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import root_scalar
if __name__ == "__main__":
# compute ODE solution to optically-thin wind
# a_rad = 7.5646e-15 # erg cm^-3 K^-4
# c = 2.99792458e10 # cm s^-1
# k_B = 1.380658e-16 # erg K^-1
# m_H = 1.6726231e-2... |
# RAiSERHD module
# <NAME>, 23 Feb 2022
# import packages
import h5py
import numpy as np
import pandas as pd
import time as ti
import os, warnings
from astropy import constants as const
from astropy import units as u
from astropy.convolution import convolve, Gaussian2DKernel
from astropy.cosmology import FlatLambdaCDM... |
import numpy as np
from datetime import datetime
from scipy.stats import poisson, scoreatpercentile
from scripts.model import Sub
# incubation: mean = 5.3, sd =3.2 (Linton et al., best gamma distr fit)
mean_incubation = 5.3
sd_incubation = 3.2
# onset to test: pooled CH data from BAG (12/05/20 update)
mean_onset_to_t... |
<gh_stars>1-10
#! /usr/bin/env python
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
torch.manual_seed(123)
import numpy as np
np.random.seed(123)
import time
from pytorch_U2GNN_Sup import *
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from scipy.sparse import coo... |
<gh_stars>0
import warnings
from scipy.stats import uniform
import numpy as np
def get_stochastic_disturbance_years(
mean_disturbance_time,
end_age,
step_size,
simulations,
random_state=None,
disturbance_delay=0
) -> list:
"""
Returns a list of disturba... |
<gh_stars>1-10
import numpy as np
import scipy as scp
def solve_least_squares(A, b, method):
if method == "numpy":
return solve_least_squares_numpy(A, b)
elif method == "cholesky":
return solve_least_squares_cholesky(A, b)
raise RuntimeError("Unknown method")
def solve_least_squares_nump... |
# -*- coding: utf-8 -*-
"""Functions to handle various numerical operations, including optimization."""
from __future__ import division
import random
import sys
from decimal import Decimal as D
from math import exp
from math import log
import numpy as np
from scipy.optimize import minimize, minimize_scalar, dual_an... |
<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import ascii
from scipy.stats import gaussian_kde
from scipy import stats
import pandas as pd
import math
# plt.rc('font', family='serif')
# plt.rc('text', usetex=True)
plt.rc('font', size=15) # controls default text sizes
p... |
# NO SOLUTION YET
import timeit
from sympy.ntheory.modular import crt
import re
from tools.input import Input, strToArr, strToInt, intToStr, arrToStr, newlineParse
i = Input(2020, 13).getData()
i = Input(2020, 13).getFromExample()
def PartOne(info):
info = strToArr(info)
fInfo = []
for i in info:
... |
<filename>gamc/evaluate.py
# -*- coding: utf-8 -*-
from __future__ import division
from math import sqrt, floor
from mingus.core import intervals
from mingus.containers import Note
import util
from common import get_names_octaves_durations
from statistics import markov_table_rank
__author__ = "kissg"
__date__ = "... |
import time
import aiohttp
import asyncio
import statistics
runs = []
async def fetch(session, url):
async with session.get(url) as response:
return await response.text()
async def main(loop):
for i in range(3):
latencies = []
expected_response = ','.join(['OK']*100)
async ... |
import os
from typing import Tuple
from scipy.signal import lfilter, savgol_filter
import numpy as np
import pandas as pd
from ..DataAugmenter import AbstractDataAugmenter
class DataAugmenterTimeSeries(AbstractDataAugmenter):
def __init__(self, n_jobs=1):
self.n_jobs = n_jobs
def augment_dataframe(... |
import argparse
import logging
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal, fftpack
from itertools import izip, count
import pandas as pd
def process_args(args, defaults, description):
""" Handle input commands
args - list of command line arguments
default - default command... |
"""
Created on Wed Feb 5 13:04:17 2020
@author: matias
"""
import numpy as np
np.random.seed(42)
from matplotlib import pyplot as plt
from scipy.optimize import minimize
import emcee
import corner
from scipy.interpolate import interp1d
import sys
import os
from os.path import join as osjoin
from pc_path import def... |
import shutil
import unittest
import graph_embeddings
import networkx as nx
import numpy as np
from scipy import sparse
class TestCalc(unittest.TestCase):
def setUp(self):
self.G = nx.karate_club_graph()
self.A = nx.adjacency_matrix(self.G)
def test_node2vec(self):
model = graph_embe... |
import re
import wx
import numpy
import os.path, glob
from scipy.sparse.csgraph import shortest_path, minimum_spanning_tree, reconstruct_path
import scipy.spatial.distance
import scipy.misc
# The recommended way to use wx with mpl is with the WXAgg backend.
# import matplotlib
# matplotlib.use('WXAgg')
import matplo... |
import numpy as np
from skimage import filters
from scipy.sparse import csc_matrix
from scipy.sparse.linalg import spsolve
def optical_flow_hs(t0, t1, alpha):
h, w = t0.shape[:2]
gradients = np.gradient(t0)
dx, dy = gradients[1], gradients[0]
dt = t1 - t0
inv_alpha = 1.0 / alpha
# construct A ... |
<reponame>11uc/whole_cell_patch
# Detect spontaneous mini postsynaptic responses and
# calculate their properties.
import os
import copy
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
from .project import Project
from .analysis import Analysis
from .process import SignalProc
from . import... |
# Copyright (c) 2021 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.
#
# 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
#
# Un... |
from __future__ import print_function
import matplotlib
matplotlib.use('tkAgg')
import matplotlib.pyplot as plt
from scipy.sparse import csr_matrix
from dolfin import *
import scipy
import numpy as np
import pyshtools
from deepsphere import utils
# Test for PETSc and SLEPc
if not has_linear_algebra_backend("PETSc... |
<reponame>LiangShe/AAM
# -*- coding: utf-8 -*-
import numpy as np
from matplotlib import path
from scipy.interpolate import interpn
from scipy import ndimage
#%%
def get_randn_param(n, data):
# p = get_randn_param( n, data)
# generate gaussian distributed random parameters
# n: number of parameter vectors ... |
<reponame>phunc20/dsp
# function to call the main analysis/synthesis functions in software/models/stft.py
import numpy as np
import matplotlib.pyplot as plt
import os, sys
from scipy.signal import get_window
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/'))
import utilFunctions a... |
import itertools
import numpy as np
from scipy.special import logit
from sklearn.metrics import roc_auc_score
def calculate_auc_single(Y_true, Y_pred, test_indices=None):
n_time_steps, n_nodes, _ = Y_true.shape
indices = np.tril_indices_from(Y_true[0], k=-1)
y_true = []
y_pred = []
for t in ran... |
from matplotlib import pyplot as plt
import pandas as pd
import seaborn as sns
def plot_numeric_features(df, numerical_features_list):
import seaborn as sns
sns.set() # Setting seaborn as default style even if use only matplotlib
sns.set_palette("Paired") # set color palette
fig, axes = plt.subplots(... |
<reponame>ishine/VITS_Singing
import os, sys
import librosa
import numpy as np
from scipy.io import wavfile
def load_wave(wav_fpath):
wavdata = []
wav, _ = librosa.load(wav_fpath, 16000)
wav = wav / np.abs(wav).max() * 0.6
wavdata.extend(wav)
wavdata = np.array(wavdata, dtype='float32')... |
<reponame>NoeLahaye/InTideScat_JGR
from __future__ import division
import numpy as np
from scipy.signal import butter
from scipy.signal import filtfilt as filt
def butterfilt(tt,data,axis=-1,cutoff=1,mode='low'):
''' Order 4 butterworth forward-backward filtering with gustafsson's method for endpoints
evenly spaced ... |
""" Sink-Node for the Signal-to-Signal-Plus-Noise Ratio. """
from copy import copy, deepcopy
import warnings
import numpy
from scipy.linalg import qr
from pySPACE.missions.nodes.base_node import BaseNode
from pySPACE.resources.dataset_defs.metric import BinaryClassificationDataset
class SSNR(object):
""" Helpe... |
<filename>agents/agent.py
#
# Copyright (c) 2017 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-2.0
#
# Unless required by a... |
<filename>cvxpy/problems/problem_data/compr_matrix.py<gh_stars>0
"""
Copyright 2013 <NAME>
This file is part of CVXPY.
CVXPY is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(a... |
<gh_stars>1-10
import numpy
import matplotlib.pyplot as plt
import scipy
from sklearn import manifold
from data_generation import print_process
def intrinsic_isometric_mapping(approx_intrinsic_geo_dists, approx_intrinsic_euc_dists, approx_intrinsic_euc_dists_trimmed, true_intrinsic_euc_dists, intrinsic_points, dim_in... |
<reponame>NoemieJaquier/GaBOflow
import numpy as np
import gpflow
from scipy.io import loadmat
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d, Axes3D
from BoManifolds.kernel_utils.kernels_spd_tf import SpdSteinGaussianKernel, SpdAffineInvariantGaussianKernel, SpdFrobeniusGaussianKernel, SpdLogE... |
<gh_stars>0
"""
Mixed-model with genetic effect heterogeneity.
The extended StructLMM model (two random effects) is ::
𝐲 = W𝛂 + 𝐠𝛽 + 𝐠⊙𝛃 + 𝐞 + u + 𝛆,
where ::
𝐠⊙𝛃 = ∑ᵢ𝐠ᵢ𝛽ᵢ
𝛃 ∼ 𝓝(𝟎, b²Σ)
𝐞 ∼ 𝓝(𝟎, e²Σ)
𝛆 ∼ 𝓝(𝟎, 𝜀²I)
Σ = EEᵀ
u ~ 𝓝(𝟎, g²K)
If one considers 𝛽 ∼ 𝓝(0,... |
"""
Name: Vaidya
References: Stephani (13.20) p158
Coordinates: Eddington-Finkelstein
Notes: Outgoing Coordinates
"""
from sympy import Function, diag, sin, symbols
coords = symbols("r v theta phi", real=True)
variables = ()
functions = symbols("M", cls=Function)
r, v, th, ph = coords
M = functions
metric = diag(0, -(... |
<reponame>vincentrobin/conda<filename>Cantera-data-examples/onedim.py<gh_stars>1-10
# This file is part of Cantera. See License.txt in the top-level directory or
# at http://www.cantera.org/license.txt for license and copyright information.
import numpy as np
from ._cantera import *
from .composite import Solution
imp... |
<gh_stars>0
import numpy as np
import scipy.stats as stats
import pandas as pd
from scipy.ndimage import gaussian_filter
from scipy.interpolate import interp1d
def __normolization_centroid(a: pd.Series, index: list) -> pd.Series:
if a.name in index:
minimum = a.min()
maximum = a.max()
... |
#!/usr/bin/env python
# coding: utf-8
# # LANL Earthquake Prediction Kaggle Competition 2019
# ### <NAME>, <NAME>, <NAME>
#
# ---
#
# In this notebook, we present our work for the LANL Earthquake Prediction Kaggle Competition 2019. The goal of this competition is to use seismic signals to predict the timing of labor... |
import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib import gridspec
import parmap
import numpy as np
import pandas as pd
import os
import shutil
import cv2
import scipy.io as sio
import scipy.signal
from Specgram.Specgram import Specgram
import glob2
f... |
import os
from datasets.imdb import imdb
import numpy as np
import copy
import scipy.sparse
import h5py, json
from fast_rcnn.config import cfg
class vg_hdf5(imdb):
def __init__(self, roidb_file, dict_file, imdb_file, rpndb_file, split, num_im):
imdb.__init__(self, roidb_file[:-3])
# read in datase... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.