text string |
|---|
<gh_stars>0
import numpy as np
from scipy.special import softmax
def random_argmax(a):
'''
like np.argmax, but returns a random index in the case of ties
parameters:
a : (np.Array)
'''
return np.random.choice(np.flatnonzero(a == a.max()))
class EGreedyPolicy(object):
def __init__(... |
<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
import argparse
import numpy as np
from scipy import integrate
pi = np.pi
norm = np.linalg.norm
inv = np.linalg.inv
dot = np.dot
cross = np.cross
arccos = np.arccos
description=r"""
<NAME>, <EMAIL> -
This script for work integration f... |
<filename>MFCC.py
# <NAME>
############################
## This script plots the mfccs
## code in calc_mfccs() obtained from https://haythamfayek.com/2016/04/21/speech-processing-for-machine-learning.html
############################
import warnings
import numpy as np
import scipy.io.wavfile
from scipy.fftpack import ... |
<reponame>dangeng/infiniteGANorama
import os.path
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
import numpy as np
from PIL import Image
from scipy.misc import imresize, imsave
from torchvision.transforms import ToTensor, Compose
import torch
import cv2
from scipy.n... |
<filename>polya/utils.py
#!/usr/bin/env python3
"""utils.py: Collection of useful utility functions"""
__author__ = "<NAME>"
__all__ = ['smooth','savitzky_golay','FSAAnalyzer', 'binning']
# Built-in
from collections import Counter
from math import factorial
import numbers
# Third-party
from scipy.signal import find... |
"""
Copyright (C) 2011-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, distribu... |
<reponame>shao1chuan/pythonbook<gh_stars>10-100
# # 支持向量机(1)
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import seaborn as sns; sns.set()
# ### 支持向量基本原理
# 如何解决这个线性不可分问题呢?咱们给它映射到高维来试试
# $z=x^完整例子+y^完整例子$.
#随机来点数据
#其中 cluster_std是数据的离散程度
from sklearn.datasets.samples_generator import make_b... |
#####################################################################################################################
# more_nodes: This module implements several new nodes and helper functions. It is part of the Cuicuilco framework. #
# ... |
<reponame>exalearn/hydronet
import numpy as np
from scipy.stats import ks_2samp, wasserstein_distance
'''
Computing divergence for discrete variables
https://github.com/michaelnowotny/divergence
'''
def compute_probs(data, n=50):
h, e = np.histogram(data, n)
p = h/data.shape[0]
return e, p
def support_i... |
# functions centered around statistics
"""
"""
import time
import datetime
import numpy as np
from scipy import stats
from scipy.stats import ttest_ind, ttest_1samp
from scipy.stats.distributions import norm
import warnings
from eventstatistics.models import EventStatistic
from games.models import Game
from lineu... |
import numpy as np
import random as rd
import scipy.sparse as sp
from time import time
import os
import warnings
from tqdm import tqdm, trange
import multiprocessing
import argparse
import pickle
def load_obj(name):
with open(name + '.pkl', 'rb') as f:
return pickle.load(f)
warnings.filterwarnings("ignor... |
"""
Created on Wed Feb 5 13:04:17 2020
@author: matias
"""
import numpy as np
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 definir_path
path_git,... |
<reponame>sitnarf/echo-clustering<filename>evaluation_functions.py
import logging
from dataclasses import dataclass
from functools import partial, reduce
from multiprocessing.pool import Pool
from statistics import mean, stdev, StatisticsError
# noinspection Mypy
from typing import Iterable, Optional, Any, Dict, Union,... |
<gh_stars>0
# <NAME>
import argparse
from spectral.io import envi
import numpy as np
import pylab as plt
from sklearn.decomposition import PCA
from scipy.interpolate import interp1d
from scipy.signal import medfilt
from scipy.linalg import norm, eigh
import sys, os
def find_header(infile):
if os.path.exists(infile+'... |
<gh_stars>0
#!/usr/bin/env python3
from matplotlib import pyplot as plt
from matplotlib import cm
from matplotlib import colors as mcolors
import numpy as np
from collections import Counter
import pandas as pd
import calendar
from pathlib import Path, PurePath
import os
from scipy.stats import linregress
from tw_ana... |
<filename>figure_data/sm1/sm1.py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.lines import Line2D
import matplotlib.image as mpimg
from matplotlib.offsetbox import TextArea, DrawingArea, OffsetImage, AnnotationBbox
from mpl_toolkits.axes_grid1.inset_locator import inset_ax... |
'''
本模块储存着常用算符和积分方法
调用模块中的算符时应注意:
1、算符作用的多元函数的自变量需为列表(list、tuple、ndarray均可,下同)
2、算符作用的标量函数的输出值需为单个值
3、算符作用的矢量函数的输出值需为列表
This module stores the common operators and integration method
When calling operators in the module, pay attention to:
1. The argument of the multivariate function acted by the operators should be li... |
import os
from glob import glob
import numpy as np
from scipy.io import loadmat, savemat
import h5py
data_dir = "./datasets/SIDD/SIDD_Medium_Raw/Data"
path_all_noisy = glob(os.path.join(data_dir, '**/*NOISY*.MAT'), recursive=True)
path_all_noisy = sorted(path_all_noisy)
print('Number of big images: {:d}'.format(len(pa... |
<reponame>mtmoncur/RootFinding
# from the groebner library
from groebner.multi_cheb import MultiCheb
from groebner.multi_power import MultiPower
from groebner import maxheap
from groebner.groebner_class import Groebner
# other libraries
import numpy as np
import pandas as pd
import scipy.linalg as la
# Example 1: 3-... |
import pybamm
import numpy as np
from sympy import evaluate
import scipy.optimize
import numbers
def check_input(name, params, t_init, t_final, intervals):
"""
Check if inputs is of the correct type
"""
if isinstance(name, str) == False:
raise ValueError("name must be of type string")
if i... |
<filename>5_results/5-2_main_results/compute_results/svm2.py
# %%
from sklearn import svm
from sklearn import metrics
import pandas as pd # for reading file
import numpy as np
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import GridSearchCV... |
from scipy.signal import butter, lfilter
import csv
import matplotlib.pyplot as plt
def butter_bandpass(lowcut, highcut, fs, order=5):
nyq = 0.5 * fs
low = lowcut / nyq
high = highcut / nyq
b, a = butter(order, [low, high], btype='band')
return b, a
def butter_bandpass_filter(data, lowcut, highc... |
<filename>pycmbs/tests/test_EOF.py
# -*- coding: utf-8 -*-
"""
This file is part of pyCMBS.
(c) 2012- <NAME>
For COPYING and LICENSE details, please refer to the LICENSE file
"""
from unittest import TestCase
from pycmbs.data import Data
#~ from pycmbs.diagnostic import *
import scipy as sc
import matplotlib.pylab as... |
# import matplotlib.pyplot as graph
import unittest
from statistics import mean, stdev
from cellsolvertools.define_parameter_uncertainties import create_model_from_config
from cellsolvertools.evaluate_sbml_model_initial_values import evaluate_parameter_initial_values, load_model
parameter_normal = {
"dimensions.l... |
<filename>src/alternative_MidpointSmoothingAlg.py
import os
from os.path import exists
import itertools
from datetime import datetime
from datetime import timedelta
from copy import deepcopy
from collections import OrderedDict
import matplotlib
matplotlib.use('TkAgg')
# matplotlib.use('Agg')
import matplotlib.pyplot ... |
<gh_stars>1-10
def surface_laplacian(epochs, leg_order, m, smoothing, montage):
"""
This function attempts to compute the surface laplacian transform to an mne Epochs object. The
algorithm follows the formulations of Perrin et al. (1989) and it consists for the most part in a
nearly-literal translatio... |
import numpy as np
import scipy as sp
import logging
import doctest
from pysnptools.snpreader import Bed
from pysnptools.snpreader import SnpHdf5
from pysnptools.snpreader import Dat
from pysnptools.snpreader import Dense
from pysnptools.snpreader import Pheno
from pysnptools.snpreader import Ped
from pysnptools.stand... |
#coding: utf-8
from __future__ import print_function
import csv, json, copy, re, argparse, os, urllib2
import numpy, scipy, fastcluster, sklearn
import scipy.cluster.hierarchy as hcluster
from sklearn import preprocessing
from scipy import spatial
LINKAGES = ["single", "complete", "average", "centroid", "ward", "med... |
<filename>main.py
from statistics import mode
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, MaxPooling2D, AveragePooling2D
from tensorflow.keras.layers import Activation, Dropout, Flatten, Dense
from tensorf... |
import numpy as np
import pandas as pd
import xarray as xr
from scipy.stats import t
class oat:
"""
Ordinal adequacy tests (OATs).
Attributes
----------
schedule_pos : list
Schedules whose scores are counted as positive.
behav_score_pos : behav_score object
Behavioral score use... |
<reponame>penseesface/NeuralVoicePuppetry
import os
# os.environ['CUDA_VISIBLE_DEVICES'] = '6'
from facenet_pytorch import MTCNN
from core.options import ImageFittingOptions
import cv2
import face_alignment
import numpy as np
from core import get_recon_model
import os
import torch
import core.utils as utils
... |
<gh_stars>1-10
#!/usr/bin/env python
'''A python module to generate lightcurve templates.
Author: <NAME>
Version: 0.1 (extreme-alpha)
This module uses Barry Madore's GLoEs algorithm to interpolate over a surface
with heterogeneous data. In this case, we have a surface with x=time, y=dm15
and z=flux.
This module pr... |
<filename>bayesian_relative_rates.py
#implement a Bayesian relative rates comparison
#obtain 95% credible intervals for branch lengths to particular taxa on the tree, from some common ancestor
#args: outgroup_textfile target_taxa_textfile treelist
import sys
from ete3 import Tree
from collections import defaultdict
fro... |
<filename>pyCardiac/signal/processing/transform_to_phase.py
import numpy as np
from scipy.signal import hilbert as hilbert_transform
from ...routines import rescale
def transform_to_phase(signal):
"""Transform ``signal`` to phase via Hilbert transform along last axis`.
Parameters
----------
``sig... |
#!/usr/bin/env
# -*- coding: utf-8 -*-
# Copyright (C) <NAME> - All Rights Reserved
# Unauthorized copying of this file, via any medium is strictly prohibited
# Proprietary and confidential
# Written by <NAME> <<EMAIL>>, January 2017
import os
import scipy.io as sio
import utils.datasets as utils
# ----------------... |
<gh_stars>0
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
from socket import socket, AF_INET, SOCK_DGRAM
HOST = ''
PORT = 9000 # 受信ポート番号
N = 10000 # サンプル数
dt = 0.001 # サンプリング間隔
freq = np.linspace(0, 1.0/dt, N) # 周波数軸
if __name__ == "__main__":
... |
from functools import partial
import numpy as np
from scipy.interpolate import BSpline
import torch
from itertools import product
class AbstractBasis(object):
def __init__(self):
self.basis_functions = []
self.is_setup = False
def get_basis_functions(self):
if not self.is_setup:
... |
#This file is in charge of reading all records from the database
#and calculating the influence for all the locations whose influence
# is currently set to -1, i.e. not calculated.
#import pdb for debuggins purposes
import pdb
#for mathematical functions
import math
#optimization packages for obtaining argmax of inf... |
<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A tool generate AUTHORS. We started tracking authors before moving to git, so
we have to do some manual rearrangement of the git history authors in order to
get the order in AUTHORS.
"""
from __future__ import unicode_literals
from __future__ import print_f... |
<filename>reference/poisson.py
from scipy.stats import poisson
import numpy as np
class Poisson(object):
cache_pmf = {}
cache_sf = {}
cache = {}
MAX_CUTOFF = 25
@classmethod
def pmf_series(cls, mu, cutoff):
assert isinstance(mu, int), "mu should be an integer."
assert isinstan... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # S_Nu... |
<reponame>knutdrand/hmmacs
from scipy.special import logsumexp
import numpy as np
from .utils import log_mat_mul, log_matprod
def is_singular(M):
return M[0, 0]*M[1, 1] == M[0, 1]*M[1, 0]
def log_is_singular(M):
return M[0, 0]+M[1, 1] == M[0, 1]+M[1, 0]
def singular_power(M, k):
if k==0:
return n... |
import argparse
import functools
import numpy as np
import os.path
import scipy.linalg as sla
import sys
import datetime
import os
import psutil
from pyspark import SparkContext, SparkConf
from pyspark.mllib.linalg import SparseVector
###################################
# Utility functions
###########################... |
import numpy as np
import pickle as pkl
import matplotlib.pyplot as plt
import sys
import os
from os import path
import scipy.io
from cca_functions import *
from speech_helper import load_data
from music_helper import stim_resp
name_of_the_script = sys.argv[0].split('.')[0]
a = sys.argv[1:]
eyedee = str(a[0]) # ... |
from typing import List, Dict
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.stats.mstats import gmean
from torch import Tensor
from badger_utils.sacred import SacredUtils
from utils.sacred_local import get_sacred_storage
sacred_utils = SacredUtils(get_sacred_storage())
def plot_... |
#/!usr/bin/env python
# encoding: utf-8
import os
import sys
import time
import threading
import numpy
import datetime
from pathlib import Path
import hfo_game
import ddpg
from hfo import *
import random
import logging
from absl import app
from absl import flags
import ddpg
from robocup_agent import RoboCupAgen... |
<reponame>valeoai/BEEF<filename>datasets/bdd.py<gh_stars>1-10
import json
from pathlib import Path
import h5py
import numpy as np
import torchvision.transforms as transforms
import torch
import torch.utils.data as data
from tqdm import tqdm
from scipy import interpolate
from bootstrap.datasets.dataset ... |
from __future__ import division
import os
import time
from glob import glob
import tensorflow as tf
from six.moves import xrange
from scipy.misc import imresize
from subpixel import PS
from mathops import *
from utils import *
class Model(object):
def __init__(self, sess, image_size_x=32,image_size_y=32, is_cro... |
<gh_stars>0
"""
Copyright 2015 <NAME>
[ Modified by <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 a... |
<filename>examples/plugins/robustness/2_multi_evaluator.py
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
"""
MultiShotEvaluator: Curve fitting to estimate reward at targeted FLOPs
Copyright (c) 2019 <NAME>, <NAME>
"""
import abc
import copy
import collections
import math
import numpy as np
from scipy.optimi... |
<filename>independent_mediators/step1_generate_simulated_data.py<gh_stars>0
from collections import Counter
import numpy as np
import scipy.io as sio
from scipy.stats import bernoulli
from scipy.special import expit as sigmoid
if __name__=='__main__':
## general setup
N = 1000
D_L = 10
D_M = 2
... |
<gh_stars>1-10
#######################################################
### Code for probabilities for axion-photon ###
### conversion in the ICM ###
### by <NAME>, 2020 ###
### and <NAME>, 2020 ###
########################################... |
from sympy import expand, poly, sqrt
from cartesian import *
def circle(P1, P2, P3):
# return F(x, y) such that F(x, y) = 0 is the circle's equation
d, e, f, x, y = symbols('d, e, f, x, y')
circle_eq = Eq(x**2 + y**2 + d*x + e*y + f, 0)
circle_eqs = []
circle_eqs.append(circle_eq.subs(x, P1[0]).sub... |
<reponame>sambennett04/ent
from json import load, dumps
from time import sleep
from statistics import mean
from megaio import set_relay, get_adc
import os.path
RELAY_ON = 1
RELAY_OFF = 0
MEGAIO_CONFIGURATION_PATH = os.path.join("Configuration","MegaioConfiguration.json")
SENSOR_CONFIGURATION_PATH = os.path.join("Conf... |
<reponame>codinginbrazil/GA018
#!/usr/bin/env python
from sympy import *
from sympy.abc import x, y
from Error import *
from Log import *
MAX = 1
PATH = 'log/newton/'
TOLERANCE = 0.00000001 # 10**(-8)
def newton2D(fn, cx, cy, tol, nmax) :
previous = 0
f = (lambdify(['x','y'], fn))
for n in range... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
try:
import matplotlib.pyplot as plt
except ImportError:
raise RuntimeError(
"In order to perform this validation you need the 'matplotlib' package."
)
import scipy.signal as sp_signal
from numpy import (
log10,
abs as np_abs,
maximum as np_ma... |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... |
#!/usr/bin/python
"""Processing of the simulation data"""
import json
import csv
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
from scipy.stats import invgamma
def load_data(filename, burnin=50):
s2x = []
s2y = []
with open(filename, 'r') as f:
data = json.load(f)
a... |
from __future__ import print_function
import time
import numpy
import logging
from omuse.units import units
import sputils
import spio
from scipy.optimize import brentq
# ~ from brent import brentq
# Logger
log = logging.getLogger(__name__)
# Superparametrization coupling methods
def integral (a, b, z, q):
""... |
import os
USE_SYMENGINE = os.getenv('USE_SYMENGINE', '0')
USE_SYMENGINE = USE_SYMENGINE.lower() in ('1', 't', 'true') # type: ignore
if USE_SYMENGINE:
from symengine import (Symbol, Integer, sympify, S,
SympifyError, exp, log, gamma, sqrt, I, E, pi, Matrix,
sin, cos, tan, cot, csc, sec, asin, acos... |
<filename>pytorch/dataset.py
import glob
import torch
import pdb
import os
import numbers
import numpy as np
import math
import PIL
import cv2
import random
import collections
import torch.utils.data
import torchvision
import torchvision.transforms as transforms
try:
import accimage
except ImportError:
accimage... |
import numpy as np
import pandas as pd
from scipy.io import arff
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from tqdm import tqdm
import csv
class DimensionValueError(ValueError):
pass
class TypeError(ValueError):
pass
class IterError(ValueError):
pass
class Da... |
<filename>sympy/geometry/tests/test_ellipse.py<gh_stars>1-10
from sympy import Eq, Rational, S, Symbol, symbols, pi, sqrt, oo, Point2D, Segment2D, Abs, sec
from sympy.geometry import (Circle, Ellipse, GeometryError, Line, Point,
Polygon, Ray, RegularPolygon, Segment,
... |
<filename>examples/fastspeech/alignments/get_alignments.py
# 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 obtain a copy of the License at
#
# http://www.a... |
import os
import sys
import time
import numpy as np
from numpy import matlib as mb
from scipy import spatial
import multiprocessing as mp
from multiprocessing import Pool
import csv
save_dir = "./local_data"
FEATURE_DIM = 32
def writeBin(file, data, count):
parent_dir = file.split("/")[-2]
# filename = os.pa... |
<reponame>janfsenge/-tda_shotpeening
# %%
from scipy.integrate import trapezoid, simpson
from scipy.stats import kurtosis, skew
import numpy as np
import pandas as pd
# TODO Do a parallel version
# TODO flatten the grids here
# TODO update docstring
# TODO do a scikit version
def getRoughnessParams(z_values,
... |
from __future__ import absolute_import
import numpy as np
import pydicom
from scipy.ndimage.interpolation import zoom
from scipy.ndimage.filters import gaussian_filter
def resize_image(img, size, smooth=None, verbose=True):
"""
Resizes image to new_length x new_length and pads with black.
Only works with gr... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 1 20:06:47 2021
@author: m-lin
"""
'''
データの読み込みと確認
'''
# ライブラリのインポート
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# ランダムシードの設定
import random
np.random.seed(1234)
random.seed(1234)
# データの読み込み
train... |
#!/usr/bin/env python3
"""
test_core_queue.py tests queue performance.
===============================================================================
"""
import unittest
import types
import scipy.stats as stats
import despy.dp as dp
class SubClassModel(dp.model.Component):
def initialize(self):
pass
c... |
#!/usr/bin/env python
import dfl.dynamic_system
import dfl.dynamic_model as dm
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
plt.rcParams["font.family"] = "Times New Roman"
plt.rcParams["font.size"] = 18
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['ps.fonttype'] = 42
class Plant1(df... |
<reponame>robreznor/speakAnalize
# measure_wav_linux_arm64.py
# <NAME> 2017-09-17
#
# A sample script that uses the Vokaturi library to extract the emotions from
# a wav file on disk. The file has to contain a mono recording.
#
# Call syntax:
# python3 measure_wav_linux_arm64.py path_to_sound_file.wav
#
# For the sou... |
from typing import Tuple, List, Callable
import numpy as np
from torch.utils.data import DataLoader
from statistics import mean
import time
from ..assemble.assemble_model import AssembleModel
from ..models.base import BaseModel
from ..metrics.base_metric import BaseMetric
from ..assemble.learning_table import Learning... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 29 10:35:45 2021
@author: maple
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import scipy.interpolate
import scipy.signal
import scipy.spatial
import scipy.stats
font = {'size' : 6,
'family' : 'sans-serif',
... |
import os
import json
import codecs
import pickle
import numpy as np
from scipy import sparse
def makedirs(directory):
if not os.path.exists(directory):
os.makedirs(directory)
def write_to_json(data, output_filename, indent=2, sort_keys=True):
with codecs.open(output_filename, 'w', encoding='utf-8')... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Vector Autoregression (VAR) processes
References
----------
Lütkepohl (2005) New Introduction to Multiple Time Series Analysis
"""
from __future__ import division, print_function
from statsmodels.compat.python import (range, lrange, string_types,
... |
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as sp
import random as rm
import math
import NumerosGenerados as ng
from Tests import testExpo
n = 100000
inicio = 0
alfa = 2
numeros_uniformes = sp.expon.rvs(size=n, loc = inicio, scale=1/alfa)
print("Media: ", round(np.mean(numeros_uniformes),3))... |
"""
Generic utility functions that help make life easier when dealing with data
Should be mostly short wrapper functions
"""
from datetime import datetime, timedelta
from typing import cast, Optional, Sequence
import numpy
from scipy.signal import butter, filtfilt
from laika.gps_time import GPSTime
from laika.lib imp... |
import torch
import torch.nn.functional as F
import os
import sys
import cv2
import random
import datetime
import math
import argparse
import numpy as np
import scipy.io as sio
import zipfile
from .net_s3fd import s3fd
from .bbox import *
def detect(net, img, device):
img = img - np.array([10... |
import datetime
import logging
import os
import pickle
import sys
import time
import numpy as np
import pandas as pd
import progressbar
import qutip
import qutip.control.pulseoptim as cpo
import qutip.logging_utils as logging
import scipy
if '../../' not in sys.path:
sys.path.append('../../')
import src.rabi_mode... |
<filename>Chapter15/c15_13_GARCH.py
"""
Name : c15_13_GARCH.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
import scipy as sp
import matplotlib.pyplot as plt
#
sp.random.seed(12345)
n=1000 ... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module implements equivalents of the basic ComputedEntry objects, which
is the basic entity that can be used to perform many analyses. ComputedEntries
contain calculated information, typically from VAS... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import re
from collections import OrderedDict
from typing import Any, Callable, Dict, List, MutableMapping, Optional,... |
<filename>DGFit/DustGrains.py
#!/usr/bin/env python
# Started: Jan 2015 (KDG)
# Updated to include better diagnoistic plots when run (Mar 2016 KDG)
"""
DustGrains class
dust grain properties stored by dust size/composition
"""
from __future__ import print_function
import glob
import re
import math
import numpy as np... |
import os
from glob import glob
import numpy as np
import matplotlib.pyplot as plt
from toolkit import (generate_master_flat_and_dark, photometry,
PhotometryResults, PCA_light_curve, params_b,
transit_model_b)
# Image paths
image_paths = sorted(glob('/Users/bmmorris/data/Q2UW... |
import cv2
import numpy as np
import matplotlib.pyplot as plt
import os
import tqdm
from scipy import interpolate
from mouse_detection.tracker import EuclideanDistTracker
def savitzky_golay(y, window_size, order, deriv=0, rate=1):
r"""Smooth (and optionally differentiate) data with a Savitzky-Golay filter.
... |
"""Metrics to assess performance on regression task
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME>... |
import os.path
import warnings
from glob import glob
from io import BytesIO
from numbers import Number
from pathlib import Path
import numpy as np
from .. import Dataset, backends, conventions
from ..core import indexing
from ..core.combine import (
_CONCAT_DIM_DEFAULT, _auto_combine, _infer_concat_order_from_pos... |
<reponame>Guiming/DL4SDM<gh_stars>0
# Author: <NAME>
# Last update: August. 08 2019
# Ref: http://stackoverflow.com/questions/27623919/weighted-gaussian-kernel-density-estimation-in-python
# http://nbviewer.jupyter.org/gist/tillahoffmann/f844bce2ec264c1c8cb5
import numpy as np
from scipy.spatial.distance im... |
<reponame>RightMesh/payment-channel-performance<filename>web/data_process.py
import requests
import json
import sys
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.optimize import curve_fit
from matplotlib.ticker import PercentFormatter
import statistics as stat
def get_data(url):
... |
import os
import sys
import scipy.misc
import numpy as np
from model import DCGAN
from utils import pp, visualize, to_json, show_all_variables
import tensorflow as tf
flags = tf.app.flags
flags.DEFINE_integer("epoch", 25, "Epoch to train [25]")
#Adam default, TensorFlow: learning_rate=0.001, beta1=0.9, b... |
from tcga_encoder.utils.helpers import *
from tcga_encoder.data.data import *
from tcga_encoder.definitions.tcga import *
#from tcga_encoder.definitions.nn import *
from tcga_encoder.definitions.locations import *
from tcga_encoder.analyses.dna_functions import *
#from tcga_encoder.algorithms import *
import seaborn a... |
<filename>codes/preprocess/ct_create_kernel_dataset_yic_210522.py
import argparse
import os
import torch.utils.data
import yaml
import glob
import utils
from PIL import Image
import torchvision.transforms.functional as TF
from tqdm import tqdm
# from KernelGAN.imresize import imresize
from scipy.io import loadmat
impor... |
<gh_stars>0
import math
import torch
from gpytorch.constraints import Positive
from gpytorch.kernels import Kernel
from scipy.special import i0e, i1e
import warnings
torch.set_default_dtype(torch.float64)
class i0eTorchFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
devic... |
# 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 in writing, software
# distribu... |
# Copyright 2020 The Cirq Developers
#
# 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 ... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Mon May 18 22:44:06 2020
@author: afran
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as sio
import os
import sys
from ripser import ripser
from scipy import sparse
from persim import plot_diagrams
from persim import PersImage
from sklearn... |
import os.path as osp
import numpy as np
import math
import torch
import json
import copy
import transforms3d
import scipy.sparse
import cv2
from pycocotools.coco import COCO
from core.config import cfg
from graph_utils import build_coarse_graphs
from noise_utils import synthesize_pose
from smpl import SMPL
from coo... |
<filename>experiments/noise.py
from abc import ABC, abstractmethod
from scipy.stats import uniform
from typing import List
import numpy as np
class Noise(ABC):
"""An abstract base class to implement noise distribution used when sampling games."""
@abstractmethod
def get_samples(self, m: int) -> List[floa... |
<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 13:17:13 2019
@author: thibautgold
"""
import os, sys
import numpy as np
import cv2 as cv
from skimage.morphology import skeletonize
from random import randrange
from matplotlib import pyplot as plt
from scipy.signal import argrelext... |
<filename>map.py<gh_stars>1-10
#More info:
#https://www.easycoding.org/2016/12/17/postroenie-izolinij-na-karte-mira-pri-pomoshhi-python-basemap.html
# 'values' is of the format [(lat, lon, val), (lat, lon, val), ..., (lat, lon, val)]
def show_map(values, maxvalue):
#Import libraries
from mpl_toolkits.basemap ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.