text string |
|---|
# Copyright 2021 MIT Probabilistic Computing Project
# Apache License, Version 2.0, refer to LICENSE.txt
import itertools
import math
import random
from scipy.special import betaln
from scipy.special import gammaln
from .util_math import log_choices
from .util_math import log_linspace
from .util_math import logsumex... |
import numpy as np
from scipy.special import expit
import IPython as ipy
import pickle
class TwoLayerNeuralNetwork:
def __init__(self, n_in, n_hid, n_out, eta, epochs, bin_size=None):
self.n_in = n_in
self.n_hid = n_hid
self.n_out = n_out
self.w_ih = .001*np.random.randn(self.n_in+1,self.n_hid)
self.w_ho = ... |
<reponame>bozhnyukAlex/formal-lang-course
from typing import Set, Tuple
import networkx as nx
from pyformlang.cfg import CFG
from scipy import sparse
from scipy.sparse import dok_matrix, identity
from project import cfg_to_wcnf, is_wcnf, BooleanMatrices, graph_to_nfa
__all__ = ["hellings", "matrix", "tensor"]
def he... |
<filename>cv19gm/utils/cv19functions.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
from scipy.special import expit
import json
import pandas as pd
import ast
"""
# ------------------------------------------------- #
# ... |
"""
Copyright (C) 2012 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublice... |
# -*- coding: utf-8 -*-
"""
pyHRV - Time Domain Module
--------------------------
This module provides functions to compute HRV time domain parameters using R-peak locations
and/or NN interval series extracted from an ECG lead I-like signal (e.g. ECG, SpO2 or BVP sensor data).
Notes
-----
.. This module is part of ... |
<gh_stars>1-10
from sympy import expand, symbols, integrate, tan, summation
from sympy.core.cache import clear_cache
import time
def bench_expand():
x, y, z = symbols('x y z')
expand((1+x+y+z)**20)
def bench_integrate():
x, y = symbols('x y')
f = (1 / tan(x)) ** 10
return integrate(f, x)
def ben... |
import numpy as np
from skimage import measure
from scipy import ndimage
from skimage.morphology import skeletonize_3d as sk3d
class MorphologyOps(object):
'''
Class that performs the morphological operations needed to get notably
connected component. To be used in the evaluation
'''
def __init_... |
<reponame>cle1109/scot<filename>scot/varbase.py
# encoding: utf-8
# Released under The MIT License (MIT)
# http://opensource.org/licenses/MIT
# Copyright (c) 2013-2016 SCoT Development Team
"""Vector autoregressive (VAR) model."""
from __future__ import division
import numpy as np
import scipy as sp
from . import c... |
import numpy as np
from datetime import datetime
from KNN.utils import get_data
from scipy.stats import multivariate_normal as mvn
class NaiveBayes(object):
def fit(self, X, Y, smoothing=1e-2):
self.gaussians = dict()
self.priors = dict()
labels = set(Y)
for label in labels:
... |
from scipy.linalg import eigh
import sys
Atemp = sys.argv[1]
Btemp = sys.argv[2]
# Atemp = '364.8,-182.4;-182.4,182.4'
# Btemp = '.407,0;0,.407'
A = [];
for a in Atemp.split(';'):
A.append([float(x) for x in a.split(',')])
B = [];
for b in Btemp.split(';'):
B.append([float(x) for x in b.split(',')])
eigva... |
<reponame>artdgn/ml-recsys-tools_fork
import copy
import logging
import numpy as np
import pandas as pd
from sklearn.cluster import MiniBatchKMeans
import scipy.sparse as sp
from sklearn.preprocessing import LabelBinarizer, normalize, LabelEncoder
from sklearn_pandas import DataFrameMapper
from ml_recsys_tools.utils... |
<filename>examples/test_50d.py
import unittest
import numpy as np
import cpnest.model
from scipy import stats
class GaussianModel(cpnest.model.Model):
"""
An n-dimensional gaussian
"""
def __init__(self,dim=50):
self.distr = stats.norm(loc=0,scale=1.0)
self.dim=dim
self.names=['... |
from abc import ABC, abstractmethod
import numpy as np
from scipy.special import logsumexp
from scipy.stats import norm, t
from .robust_likelihoods import BetaRobustGaussian, BetaRobustAsymmetricGaussian
student = t
class SMCSampler(ABC):
def __init__(self, data, num_samples=100, X_init=None, seed=None):
... |
'''
25 2D-Gaussian Simulation
Compare different Sampling methods and DRE methods
1. DRE method
1.1. By NN
DR models: MLP
Loss functions: uLISF, DSKL, BARR, SP (ours)
lambda for SP is selected by maximizing average denstity ratio on validation set
1.2. GAN property
2. Data Generation:
(1). Target Distribution p_r:... |
'''
Created on May 30, 2012
@author: vinnie
'''
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as plt_patches
from scipy.signal import fftconvolve
from scipy.ndimage import filters
_MIN_RADIUS = 15
_MAX_RADIUS = 75
_RADIUS_STEP = 5
_ANNULUS_WIDTH = 5
_EDGE_THRESHOLD = 0.005
_... |
<gh_stars>1-10
import numpy as np
import scipy
import scipy.stats
import pytest
from pymgt import *
from pymgt.nscores import univariate_nscore
from pymgt.nscores import forward_interpolation
from pymgt.nscores import backward_interpolation
from test_utils import *
def test_normalscore_default(alpha=0.05):
decim... |
import flask
import json
import numpy as np
import os
import scipy.io.wavfile as sio
import tempfile
class Service:
"""
A basic abstract class for hosting speech processing applications.
"""
def __init__(self, app=None, root="/"):
self._app = app
self._root = root
if app:
... |
#!/usr/bin/env python3
import argparse
import collections
import hashlib
import heapq
import logging
import itertools
import json
import math
import os
import statistics
import subprocess
import sys
import tempfile
from XXX import helper
class Error(Exception):
"""Base class for errors in this module."""
class... |
import re,sys,os, glob
from string import *
import math, numpy, scipy, math
from numpy import array
from scipy import stats
import pvalue_combine
##############
# This code is designed to detect LOH events of interested gene per one cancer patient using two different exome sequencing samples from normal and tumor.
... |
"""Mixture of Finite Mixtures Model (Miller & Harrison, 2018)
References
----------
<NAME>, <NAME> (2018),
"Mixture Models with a Prior on the Number of Components".
Journal of the American Statistical Association, Vol. 113, Issue 521.
"""
import numpy as np
import math
from scipy.stats import poisson
from b... |
<reponame>maria-zafar/HSE_FaceRec_tf
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import numpy as np
import cv2
import time
from sklearn import preprocessing
from sklearn.metrics.pairwise import pairwise_distances
from sklearn import... |
# basic imports
import pandas as pd
import numpy as np
import math
# ml stuff
import tensorflow as tf
from tensorflow import keras
from keras.layers import Dense
from keras.models import Model
from keras.models import Sequential
# metrics + sklearn
from scipy import spatial
from hdbscan import HDBSCAN
from sklearn impo... |
<reponame>multimodallearning/slic_reg<filename>src/kpts_util.py
import torch
import torch.nn.functional as F
import matplotlib.pyplot as plt
import nibabel as nib
import cc3d
import struct
import numpy as np
from scipy.ndimage import distance_transform_edt as edt
import torch.nn as nn
import torch.optim as optim
device... |
<gh_stars>1-10
import sys
import scipy.io as sio
from pprint import pprint
import matplotlib.pyplot as plt
import numpy as np
# y = a + b1x + b2^2 + e
def normalize(x):
return (x - x.min())/(x.max() - x.min())
x = np.array([5, 15, 25, 35, 45, 55])
X = normalize(x)
y = np.array([15, 11, 2, 8, 25, 32])
theta = np... |
import getopt
import logging
import math
import os.path
import statistics as stat
import sys
from Bio import Phylo
import numpy as np
from .base import Tree
from ...helpers.stats_summary import calculate_summary_statistics_from_arr, print_summary_statistics
class InternalBranchStats(Tree):
def __init__(self, a... |
<reponame>Mohamed-Ibrahim-124/Image-Segmentaion
from os import path, getcwd, listdir
from scipy.misc import imread, imresize
from scipy.io import loadmat
from misc import handle_mat_struct
# down resizing to accelerate computation
RES = (30, 30)
DATASET_PATH = path.join(
path.split(getcwd())[0],
"BSR",
"B... |
<reponame>zEttOn86/Graph-CNN-in-3D-Point-Cloud-Classification
#coding:utf-8
"""
https://groups.google.com/forum/#!topic/chainer-jp/QzprFJet2eo
"""
import os, sys, time
import argparse
import chainer
import chainer.links as L
import chainer.functions as F
import numpy as np
import scipy
sys.path.append(os.path.normpath... |
<reponame>Johere/AICity2020-VOC-ReID
# encoding: utf-8
"""
@author: liaoxingyu
@contact: <EMAIL>
"""
import os
import glob
import re
import os.path as osp
from scipy.io import loadmat
from lib.utils.iotools import mkdir_if_missing, write_json, read_json
from .bases import BaseImageDataset
class CUHK03(BaseImageData... |
<gh_stars>0
from sympy.series.kauers import finite_diff
from sympy.abc import x, y, z, w, n
from sympy import sin, cos
from sympy import pi
def test_finite_diff():
assert finite_diff(x**2 + 2*x + 1, x) == 2*x + 3
assert finite_diff(y**3 + 2*y**2 + 3*y +5, y) == 3*y**2 + 7*y + 6
assert finite_diff(z**2 - 2... |
import optparse
import time
import numpy as np
from numpy.lib import recfunctions # to append fields to rec arrays
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator
from matplotlib.offsetbox import AnchoredText
from matplotlib.backends.backend_pdf import PdfPages
import katpoint
from kat... |
<filename>Code/stellar_variation.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
############################# STELLAR VARIATIONS ##############################
############################################################################... |
<filename>msmexplorer/plots/projection.py
import numpy as np
from scipy.constants import Avogadro, Boltzmann, calorie_th
from matplotlib import pyplot as pp
from corner import corner
import seaborn as sns
from seaborn.distributions import (_scipy_univariate_kde, _scipy_bivariate_kde)
from ..utils import msme_colors
... |
# Author: <NAME>
# Implementation of Fuzzy-c-means
"""
# Importing libraries
from scipy.stats import multivariate_normal
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import random
import math
import operator
#Loading iris dataset
iris = pd.read_csv('https://raw.githubusercontent.com/Piyus... |
<filename>scaffoldgraph/analysis/cse.py<gh_stars>0
"""
scaffoldgraph.analysis.cse
"""
from concurrent.futures import ProcessPoolExecutor
from functools import partial
from itertools import repeat
import networkx as nx
import pandas as pd
import tqdm
from scipy.stats import ks_2samp, binom_test
from ..core.graph impo... |
<reponame>alexlib/engineering_experiments_measurements_course<gh_stars>1-10
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.4.2
# kernelspec:
# display_name: Python [conda env:mdd] *
# langu... |
# Author: <NAME> <<EMAIL>>
import numpy as np
from scipy.optimize import fmin_l_bfgs_b
def global_optimization(objective_function, boundaries, optimizer, maxf,
x0=None, approx_grad=True, random=np.random,
*args, **kwargs):
"""Maximize objective_function within give... |
<gh_stars>0
import matplotlib.pyplot as plt
import numpy as np
import scipy.fftpack
import json
import pandas as pd
import time
from datetime import datetime,timedelta
import requests # we need this so we can make http requests to the server (e.g. to send email)
from db.retrieve_db import retrieve_dt
from emai... |
import numpy as np
import scipy.special as sc
class TestRgamma:
def test_gh_11315(self):
assert sc.rgamma(-35) == 0
def test_rgamma_zeros(self):
x = np.array([0, -10, -100, -1000, -10000])
assert np.all(sc.rgamma(x) == 0)
|
import scipy.io as sio
import numpy as np
import pandas as pd
import tables
import pickle
from scipy.interpolate import interp1d
import os
from ismore import settings
from utils.constants import *
pkl_name = os.path.expandvars('$BMI3D/riglib/ismore/traj_reference_interp.pkl')
mat_name = os.path.expandvars('$HOME/Des... |
<gh_stars>0
# Copyright @ 2020 <NAME>
# Version Date Description
# .5 1/1/2020 Initial class card_games written
# .6 1/4/2020 Added to play and playSet for multiple sets,
# and gave option to not print assesment of game play
# .7 1/7/2020 Added ability to set deck si... |
from typing import Set, Dict, Union
from pyformlang.finite_automaton import NondeterministicFiniteAutomaton, Symbol, State
__all__ = ["BooleanAdjacencies"]
from scipy.sparse import dok_matrix, kron, csr_matrix
class BooleanAdjacencies:
"""
Construct a Nondeterministic Finite Automaton boolean adjacency mat... |
'''
Program to calculate the basic characteristics of Coplanar Waveguide Resonators, CPW.
Using Geometrical factors describing the CPW, the superconductor used and the
dielectric loss the program calculate the Quality factor and the resonance
frequency.
Author: <NAME> - 07/2014
'''
# Python folder
#!/opt/local/bin/... |
<reponame>wilrop/Cyclic-Equilibria-MONFG<gh_stars>0
import numpy as np
from utils import *
import games
from scipy.optimize import minimize
def objective(strategy, expected_returns, u):
"""
The objective function to minimise for is the negative SER, as we want to maximise for the SER.
:param strategy: The... |
<gh_stars>0
# -*- coding: utf-8 -*-
import numpy as np
import scipy
import scipy.ndimage as ndi
from matplotlib import pyplot as plt
def pshift(a, ctr):
"""
Shift an array so that ctr becomes the origin.
"""
sh = np.array(a.shape)
out = np.zeros_like(a)
ctri = np.floor(ctr).astype(int)
ctr... |
import os
import numpy as np
from scipy import ndimage
from scipy.signal import fftconvolve, convolve2d
from astropy.modeling import models, fitting
def positional_shift(R,T):
Rc = R[10:-10,10:-10]
Tc = T[10:-10,10:-10]
c = fftconvolve(Rc, Tc[::-1, ::-1])
cind = np.where(c == np.max(c))
print cind... |
<gh_stars>1-10
import math
from collections import Counter
import numpy as np
from scipy import sparse
import torch
from torch.nn import functional as F
from torch.nn import Conv1d
from modules import remap
from sparselinear import SparseLinear
def reformat(x):
"""Reformat the input from a 4D tensor to a 3D tens... |
<filename>Software/Sandbox/DNL/DNL.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 5 20:42:21 2019
@author: matias
"""
import numpy as np
from scipy.integrate import solve_ivp
import sympy as sp
from matplotlib import pyplot as plt
def dX_dz(z, variables, gamma=0):
x = vari... |
<reponame>gimlidc/igre
import numpy as np
import scipy.io
import tempfile
import os
from stable.dataset.preparation.matrix_3d import crop
def test_matrix3d_mat_crop():
matfile = tempfile.NamedTemporaryFile(suffix=".mat")
data = np.random.randn(100, 100, 10)
scipy.io.savemat(f"{matfile.name}", {"data": dat... |
<reponame>joelbader/regulon-enrichment
#!/usr/bin/python3
import pandas as pd
import numpy as np
import pdb
import time
import mhyp_enrich as mh
import statsmodels.stats.multitest as mt
import random
from scipy import stats as st
from scipy.stats import beta
def main():
num_MC_samp = 1000000 # Number of Monte-Car... |
<filename>calibration/validation/validation_plots.py<gh_stars>1-10
import numpy as np
import os
import argparse
import json
import math
import statistics
from scipy.stats import chisquare
import matplotlib.pyplot as plt
from validation import validate_stats
# python validation_plots.py -pre_calibration_stats "F:\Dokum... |
<reponame>areding/6420-pymc
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 5 22:18:07 2017
@author: bv20
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate
#COIN
plt.figure()
p = np.arange(0,1,0.001)
p10t = lambda p: 11 * (1-p)**10
plt.plot(p, p10t(p),label='density')
are... |
<filename>antpat/reps/vsharm/vsh.py
"""Vector Spherical Harmonics module. Based on my matlab functions."""
#TobiaC 2015-07-25
import sys
import math
import cmath
import scipy.special
import numpy
def Psi(l,m,theta,phi):
"""Computes the components of the zenithal Vector Spherical Harmonic function
with l and m qua... |
<filename>Portfolio_Strategies/market_portfolio.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.stats.norm.pdf as normpdf
import seaborn as sns
from tabulate import tabulate
from scipy.stats import norm
import math
import warnings
warnings.filterwarnings("ignore")
import yfinance ... |
from tensorboardX import SummaryWriter
import numpy as np
import matplotlib.pyplot as plt
import os
import torch
import torch.nn as nn
import time
from scipy.stats import genpareto
import torch.nn.functional as F
from torch.autograd import Variable
from torch import FloatTensor
def convTBNReLU(in_channels, out_channel... |
<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt # plt 用于显示图片
import urllib
from PIL import Image
from astropy import wcs
from astropy.io import fits
from astropy.table import Table
import polarTransform
import peakutils.peak
from scipy import signal
from scipy.signal import lfilter, filtfilt
from ... |
import sympy
from sympy.vector import matrix_to_vector
from sympy import *
from sympy.solvers import solve
from sympy import Symbol,symbols
from sympy.matrices.dense import matrix_multiply_elementwise
L,S = symbols("L S",positive=True,real=True)
X0,Z0 = symbols("X0 Z0",real = True)
Xk,Zk = symbols("Xk Zk",real = True)... |
from time import perf_counter
import itertools as it
import numpy as np
from cppimport import import_hook
from rpxdock.sampling import *
from rpxdock.bvh.bvh_nd import *
import rpxdock.homog as hm
from scipy.spatial.distance import cdist
from rpxdock.geom import xform_dist2_split
from rpxdock.geom.xform_dist import *
... |
<reponame>ebouilhol/neuron_simulator
import numpy as np
import scipy.stats as st
from scipy import signal
class Nucleus:
"""Definition d'un Noyau"""
def __init__(self, kernel_size, std, image_size, radius, centroid):
self.mask = None
self.nucleus = None
self.kernel = None
self... |
"""
functions for handling the MERtools .sel format
"""
from collections.abc import Mapping
from pathlib import Path
from typing import Union
import numpy as np
import scipy.io
from astropy.io import fits
from marslab.compat.mertools import MERSPECT_MSL_COLOR_MAPPINGS, \
MERSPECT_M20_COLOR_MAPPINGS, MERSPECT_COLO... |
import os
from math import pi, sin, cos, atan2, sqrt
from cmath import rect
import liqss
from matplotlib import pyplot as plt
import numpy as np
from scipy.interpolate import interp1d
import pickle
RAD_PER_SEC_2_RPM = 9.5492965964254
save_data = None
def simple():
sys = liqss.Module("simple")
node1 = liq... |
# -*- coding: utf-8 -*-
from numpy import *
import scipy.integrate
import mab.constants
import mab.astrounits
import numpy.linalg
import scipy.optimize
G = mab.constants.G.asNumber(mab.astrounits.KM**2/mab.astrounits.S**2 *mab.astrounits.KPC/mab.astrounits.MSOL)
class FitNFW(object):
def __init__(self, profile, q):... |
import pandas as pd
from scipy.optimize._differentialevolution import DifferentialEvolutionSolver
from scipy.sparse import csc_matrix, csr_matrix
from bayesian_decision_tree.classification import PerpendicularClassificationTree, HyperplaneClassificationTree
from bayesian_decision_tree.hyperplane_optimization import Sc... |
<reponame>alkaet/machine-unlearning<filename>datasets/purchase/prepare_data.py
import os
import numpy as np
from sklearn.cluster import KMeans
from sklearn.model_selection import train_test_split
from scipy.sparse import load_npz
data = np.concatenate([load_npz('data1.npz').toarray(), load_npz('data2.npz').toarray()]... |
# (c) <NAME> - 2020
from scipy.stats import linregress
import matplotlib.pyplot as plt
import scipy.signal
from vars import *
import numpy as np
import csv
import sys
CSV_FOLDER = "Data/"
PGF_OUTPUT = "PGFplots/"
PNG_OUTPUT = "PNGplots/"
print("+----------------------------------------------------------+")
print("| ... |
# load the data for time-series
import numpy as np
from scipy import signal
import os
from nnlib.load_time_series import load_data
np.random.seed(231)
def fft_cross_correlation(x, corr_filter, output_len, preserve_energy_rates=0.95):
xfft = np.fft.fft(x)
xfft = xfft[1:len(x) // 2]
# print("length of the... |
# -*- coding:utf-8 -*-
#####################################################################
#This file is part of RGPA.
#Foobar 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, ... |
<reponame>sfcurre/aedes_model
import tensorflow as tf
import tensorflow.keras.backend as K
import os, json
import pandas as pd, numpy as np
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import r2_score
from itertools import chain
import models.models
from glob import glob
from scipy.signa... |
import pickle as pkl
import numpy as np
import scipy.sparse as sp
import torch
import networkx as nx
from sklearn.metrics import roc_auc_score, average_precision_score, accuracy_score
import matplotlib.pyplot as plt
from torch_geometric.data import DataLoader
from torch_geometric.datasets import MNISTSuperpixels, Plan... |
# coding: utf-8
# In[1]:
import numpy as np
from scipy.stats import entropy
def n_components_95(a):
a = a/np.sum(a)
n = np.sum(np.cumsum(a) >= 0.95)
return n
def Entropy(p1):
p1 = p1/np.sum(p1)
return entropy(p1)/np.log(len(p1))
def JSD(p):
n = len(p)
q = np.ones(n)/n # Uniform re... |
<gh_stars>1-10
#
#! coding:utf-8
import numpy as np
from scipy import signal
def cf(alpha=0.05,k=32):
from scipy.stats import chi2
cfmax = k/chi2.ppf(alpha/2.0, k)
cfmin = k/chi2.ppf(1.0-alpha/2.0, k)
return cfmin, cfmax
def asd(data1,fs,ave=None,integ=False,gif=False,
psd='asd',scaling='... |
""" Generator for RNA degradation submodels based on KBs for random in silico organisms
:Author: <NAME> <<EMAIL>>
:Author: <NAME> <<EMAIL>>
:Author: <NAME> <<EMAIL>>
:Date: 2018-06-11
:Copyright: 2018, Karr Lab
:License: MIT
"""
from wc_onto import onto as wc_ontology
from wc_utils.util.units import unit_registry
imp... |
<reponame>DebolinaHalder/FairForest
#%%
import numpy as np
import pandas as pd
from scipy.special import logit
from fairforest import d_tree
from fairforest import utils
import warnings
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeClassifier
#%%
warnings.simplefilter("ignore")
#%%
np.random.see... |
<reponame>VasimPatel/WikipediaGame
import numpy
import sys
from scipy.spatial import distance
class SimilarWords:
""" Determines similarity between 2 words using GloVe """
embedding_dict = dict()
file_name = ""
# Default to using 100 dimension vectors from glove.6B.100d.txt
# Data from Wikipedia... |
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics.pairwise import euclidean_distances
from scipy.stats import kurtosis, skew, zscore
import time
def get_distance_metafeatures(dataset_name, df):
start = time.time()
record = {'dataset': dataset_name.split(... |
#!/usr/bin/env ipython
#
# untitled.py
#
# Copyright (c) 2020 <NAME>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
#
# See accompanying LICENSE.md or https://opensource.org/licenses/MIT.
#
import sys
import numpy
import matplotlib
from matplotlib imp... |
<reponame>apodemus/pysalt3
################################# LICENSE ##################################
# Copyright (c) 2009, South African Astronomical Observatory (SAAO) #
# All rights reserved. #
# ... |
from __future__ import absolute_import, division, print_function
# This notebook is for finding the segmentation threshold that most clearly finds worms in a recording.
# It is intended as an alternative method of validating the MultiWorm Tracker's results.
# third party
import numpy as np
import matplotlib.pyplot as ... |
from pathlib import Path
import imageio
import librosa
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import itertools
from scipy.fftpack import dct
from tensorboardX import SummaryWriter
from torch.autograd import Variable
from utils.audioUtils.audio import wav2seg, inv_preemp... |
<reponame>WilliXL/AdaptiveDecisionMaking_2018
### Background code for running decay DDM and generating dataframes
'''
accuracy = df.choice.mean()
corRT = df[df.choice==1].rt.mean()
stdDev = np.std(df[df.choice==1].rt)
print("RT (cor) = {:.0f} ms".format(corRT/dt))
print("Accuracy = {:.0f}%".format(accuracy*100))
pr... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 11 11:22:55 2016
convert_npy_data_to_mat
@author: young
"""
import numpy as np
import scipy.io as sio
import sys
def convert_data(fileFolder,fileName):
' convert from .npy to .mat'
data = np.load(fileFolder+'/'+fileName+'.npy')
sio.savemat(fileFolder+'/'+file... |
<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from scipy.fftpack import dct, idct
from cosamp_fn import cosamp
import cvxpy as cvx
n = 4096 # High resolutions samples
t = np.linspace(0,1,n)
x = np.cos(2 * 97 * np.pi * t) + np.cos(2 * 777 * np.pi * t)
## Randomly samples the signal
p = 128
perm = n... |
import numpy as np
import scipy.constants as cs
from numpy import pi, sqrt
import datproc.print as dpr
import general as gen
import nocoupling as nc
## Data
tl = np.array([[1.78, 17.92], [2.91, 19.08], [1.84, 17.92]])
tr = np.array([[1.79, 17.93], [1.34, 17.43], [1.85, 17.88]])
d_tl = np.array([[0.1, 0.1], [0.1, 0.1... |
<filename>visnav/algo/bundleadj.py
"""
Based on Scipy's cookbook:
http://scipy-cookbook.readthedocs.io/items/bundle_adjustment.html
"""
import sys
import logging
import numpy as np
from scipy.sparse import lil_matrix
from scipy.optimize import least_squares
def bundle_adj(poses: np.ndarray, pts3d: np.n... |
# -*- coding: utf-8 -*-
"""
DR_Event: Setup data recovery for a specific event or set of modes
"""
import copy
from types import SimpleNamespace
import warnings
from collections import OrderedDict
import numpy as np
import scipy.linalg as la
from pyyeti.ytools import reorder_dict
from pyyeti.nastran import n2p
from .dr... |
''' Classes that represent images. '''
from .base import Stim
from scipy.misc import imread
from PIL import Image
from six.moves.urllib.request import urlopen
from contextlib import contextmanager
from scipy.misc import imsave
import six
import io
import os
import tempfile
import numpy as np
class ImageStim(Stim):
... |
__author__ = 'Ryba'
import glob
import itertools
import os
import sys
from collections import namedtuple
import matplotlib.pyplot as plt
import numpy as np
import scipy.ndimage.filters as scindifil
import scipy.ndimage.interpolation as scindiint
import scipy.ndimage.measurements as scindimea
impor... |
"""
Copyright {2016} {<NAME>, <NAME>}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... |
from scipy.ndimage import gaussian_filter
from marslab.imgops.imgutils import std_clip
from marslab.imgops.render import colormapped_plot
def gen_spectop_defaults(special_constants=None):
return {
"params": {"special_constants": special_constants},
"limiter": {"function": std_clip},
"post... |
<gh_stars>1-10
# 要添加一个新单元,输入 '# %%'
# 要添加一个新的标记单元,输入 '# %% [markdown]'
# %%
import pandas as pd
import os
import shutil
import numpy as np
from matplotlib import font_manager
import matplotlib as mpl
import scipy
zhfont1 = font_manager.FontProperties(fname='SimHei.ttf',size=22)
# %%
size = 1e6
lables=['device','trip'... |
<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Anaflow subpackage providing functions concerning the laplace transformation.
.. currentmodule:: anaflow.tools.laplace
The following functions are provided
.. autosummary::
get_lap
get_lap_inv
lap_trans
stehfest
"""
from math import floor, factorial
import nu... |
import logging
import numbers
import os
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import qutip
import scipy
import sympy
import theano
import theano.tensor as T
import theano.tensor.slinalg
import seaborn as sns
from .QubitNetwork import QubitNetwork
from .theano_qutils impor... |
<gh_stars>1-10
from keras.activations import get as get_activation
from keras.initializers import get as get_initializer
from keras.constraints import get as get_constraint
from keras.regularizers import get as get_regularizer
from keras import optimizers, losses
from keras.engine import Layer
from keras.layers import ... |
<filename>VGG_NET.py
import numpy as np
import scipy.misc
import scipy.io as sio
import tensorflow as tf
import os
##卷积层
def _conv_layer(input, weight, bias):
conv = tf.nn.conv2d(input, tf.constant(weight), strides=(1, 1, 1, 1), padding='SAME')
return tf.nn.bias_add(conv, bias)
##池化层
def _pool_layer(input)... |
<reponame>ccc-frankfurt/dronelab<filename>UnfoldPlainFit/UnfoldPlainFit.py<gh_stars>1-10
import numpy as np
import torch
import torch.nn as nn
from matplotlib import pyplot as plt
from scipy.linalg import lstsq
import os
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE" #I have some lib duplicates, this is to ignore this
... |
<reponame>myccpb08/AI_2nd_Pos_Neg
import numpy as np
import json
import pickle
import sqlite3
import requests
from konlpy.tag import Okt
from scipy.sparse import lil_matrix
from sklearn.naive_bayes import MultinomialNB
from sklearn import linear_model
from flask import Flask, request, make_response, Response
from sla... |
from typing import Set, List
from sympy import Expr, Mul, Symbol, Integer, Add, Pow
from sympy.parsing.sympy_parser import parse_expr
from signalflow_algorithms.algorithms.graph import Graph, Branch, Node
from signalflow_algorithms.algorithms.johnson import simple_cycles
from signalflow_algorithms.algorithms.loop_group... |
import numpy as np
import scipy.io as sio
from pydynamo_brain.model import *
from pydynamo_brain.util import deltaSz
# Read a single branch from the matlab arrays containing per-point data
def parseMatlabBranch(fullState, pointsXYZ, annotations):
branch = Branch(id=fullState.nextBranchID())
for xyz, annotatio... |
<reponame>TimSchneider42/mbpo
import math
from abc import ABC, abstractmethod
from typing import Dict, TypeVar, Optional, Generic, Sequence, Tuple, Union
import numpy as np
from scipy.spatial.transform import Rotation
from .continuous_sensor import ContinuousSensor
TaskType = TypeVar("TaskType")
class VelocitySen... |
"""
Matched Filter Burst Search
---------------------------
"""
# Author: <NAME> <<EMAIL>>
# License: BSD
# The figure produced by this code is published in the textbook
# "Statistics, Data Mining, and Machine Learning in Astronomy" (2013)
# For more information, see http://astroML.github.com
import numpy as np
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.