text string |
|---|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import pickle
import sys
import tensorflow as tf
import csv
import matplotlib.pyplot as plt
from PIL import Image
version = sys.version_info
import numpy as np
import skimage.data
import scipy.io as ... |
from typing import Union, Optional, Tuple
import numpy as np
import scipy
import sparse
from sklearn.utils import check_X_y, check_array
from ._data_format import data_format, check_format
from ._data_format import QueryFormat, ResponseFormat, Format
from ._typing import Query
def _check_list_query_response(query, ... |
<reponame>tristandeleu/jax-dag-gflownet
import numpy as np
import math
from scipy.special import gammaln
from dag_gflownet.scores.base import BasePrior
class UniformPrior(BasePrior):
@property
def log_prior(self):
if self._log_prior is None:
self._log_prior = np.zeros((self.num_variables... |
<gh_stars>0
"""
Wave class
<NAME> 2016
nacoustik
Author: <NAME>
License: MIT
"""
from sys import stderr
from os import path
from sox import file_info
import numpy as np
from scipy.io import wavfile
class Wave:
"""Create wave object"""
def __init__(self, wave):
"""
Parameters
----------
wave: file ... |
from math import sqrt
import cozmo
from cozmo.util import Pose
from cozmo.objects import CustomObject, CustomObjectMarkers, CustomObjectTypes, ObservableElement, ObservableObject
from sympy import Eq, symbols, solve
from numpy import ones,vstack
from numpy.linalg import lstsq
x, y = symbols("x y")
def line_equation... |
<reponame>zapatacomputing/z-quantum-qcbm
import numpy as np
import sympy
import json
from zquantum.core.circuits import Circuit, create_layer_of_gates, RX, RZ, XX
from zquantum.core.interfaces.ansatz import Ansatz
from zquantum.core.interfaces.ansatz_utils import (
ansatz_property,
invalidates_parametrized_cir... |
'''
Training code for MRBrainS18 datasets segmentation
Written by Whalechen
'''
import importlib
import os
import pkgutil
from os import path
import numpy as np
import torch
from scipy import ndimage
from torch import nn, optim
from torch.optim import lr_scheduler
from torch.utils.data import DataLoader
from datetime... |
import numpy as np
import scipy.special
def sigmoid(x):
return 1 / (1 + np.exp(-x))
class Layer:
def __init__(self, number_of_features, activation_units, layer_type):
# init_epsilon = [[-sys.float_info.epsilon, sys.float_info.epsilon]]
self.weight = (np.random.rand(activation_units, number_of_... |
import numpy as np
import scipy.signal
from gym.spaces import Box, Discrete
from gym_minigrid.minigrid import Actions, TRANSITION_TO_VEC
import torch
import torch.nn as nn
from torch.distributions.normal import Normal
from torch.distributions.categorical import Categorical
def combined_shape(length, shape=None):
... |
import pandas as pd
import sys
import time
import numpy as np
import scipy as sp
import scipy.optimize as opt
import scipy.signal as signal
import os, json
import pygama.dataset as ds
import pygama.analysis.histograms as pgh
import pygama.dsp.transforms as pgt
import pygama.utils as pgu
import pygama.analysis.peak_fitt... |
<filename>ctdcal/rinko.py
from collections import namedtuple
import numpy as np
import oxy_fitting
import pandas as pd
import scipy
RinkoO2Cal = namedtuple("RinkoO2Cal", [*"ABCDEFGH"])
RinkoTMPCal = namedtuple("RinkoTMPCal", [*"ABCD"])
def rinko_o2_cal_parameters(**kwargs):
A = kwargs.get("A", -4.524084e1)
B ... |
<filename>output_dir/pca_model_recovery.py
import sys
import csv
import json
import numpy as np
import scipy.io
path = '/home/u/workspace/lsfm/output_dir/'
def getAlpha(json_file, ID):
#read alpha from alpha.json
with open(json_file) as f:
alpha = json.load(f)
alpha = np.array(list(map(float,alpha[ID])))
return... |
<gh_stars>1-10
#-------------------------------------------------------------------------------------------------------------------
# Packages & Settings
#-------------------------------------------------------------------------------------------------------------------
# General packages
import time
import sys
import... |
from scipy.optimize import fsolve
from autograd import grad
from .binding_system import BindingSystem
from .lagrange_binding_system_factory import LagrangeBindingSystemFactory
import numpy as np
# 1:1 binding - see https://stevenshave.github.io/pybindingcurve/simulate_1to1.html
def system01_lagrange(p, l, kdpl):
d... |
import numpy as np
from sympy import zeros, eye, simplify, sqrt
from sympy import Matrix as mat
from ..genericas import print_verbose, norma, matriz_inversa
from .funcs_gram_schmidt import gram_schmidt
def householder(x, y, signo="+", normalizar=False):
"""Aplica la transformación de Householder. x e y pueden se... |
<filename>cirq/contrib/quirk/quirk_gate.py<gh_stars>1-10
# Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2... |
<reponame>MorganHamm/gs541-phylogeography<filename>scripts/priorities.py
"""
Mask initial bases from alignment FASTA
"""
import argparse
from random import shuffle
from collections import defaultdict
import Bio
import numpy as np
from Bio.SeqIO.FastaIO import SimpleFastaParser
from Bio.Seq import Seq
from Bio import Al... |
# -*- coding: utf-8 -*-
"""
Created on Sun May 3 10:34:57 2020
@author: hcji
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 6 15:29:15 2019
@author: hcji
"""
import json
import numpy as np
import pandas as pd
from tqdm import tqdm
from scipy.sparse import load_npz
from DeepEI.utils import get_score, get_fp_sc... |
# As documented in the NRPy+ tutorial module
# Tutorial-BSSN_stress_energy_source_terms.ipynb,
# this module will construct expressions for
# BSSN stress-energy source terms, in terms of
# elements of T^{mu nu}.
# Author: <NAME>
# zachetie **at** gmail **dot* com
import sympy as sp ... |
from __future__ import print_function, division
from itertools import permutations
from sympy.core.add import Add
from sympy.core.basic import Basic
from sympy.core.mul import Mul
from sympy.core.symbol import Wild, Dummy
from sympy.core.basic import sympify
from sympy.core.numbers import Rational, pi
from sympy.core... |
#!/usr/bin/env python
"""
# Author: <NAME>
# Created Time : Thu 16 Jul 2020 07:24:49 PM CST
# File Name: plot.py
# Description:
"""
import numpy as np
import scanpy as sc
import matplotlib.pyplot as plt
import seaborn as sns
def embedding(
adata,
color='celltype',
... |
<gh_stars>0
"""
NetCDF reader/writer module.
This module is used to read and create NetCDF files. NetCDF files are
accessed through the `netcdf_file` object. Data written to and from NetCDF
files are contained in `netcdf_variable` objects. Attributes are given
as member variables of the `netcdf_file` and `netcdf... |
<gh_stars>0
#!/usr/bin/env python
import sys
#import math
from scipy import spatial # Cosine similarity calculation
#import average_vector
import filter_vocab_words
import string_util
def getDistanceBetweenSets( arr_words1, arr_words2, model):
"""
Get distance between two sets of words.
(1) ::,
... |
<reponame>Samanwaya1301/bilby-BHNS
from __future__ import division
import gc
import os
import json
import copy
import numpy as np
import scipy.integrate as integrate
from scipy.interpolate import interp1d
try:
from scipy.special import logsumexp
except ImportError:
from scipy.misc import logsumexp
from scipy... |
<filename>networkx/drawing/tests/test_layout.py
"""Unit tests for layout functions."""
from nose import SkipTest
from nose.tools import assert_almost_equal, assert_equal, \
assert_true, assert_false, assert_raises
import networkx as nx
class TestLayout(object):
numpy = 1 # nosetests attribute, use nosetests ... |
<filename>.history/ClassFiles/inheritance_sub_classes_20210616144540.py
from sympy import real_root
class Icecream:
max_scoops = 3
def __init__(self):
self.scoops = 0
def eat(self, scoops):
if self.scoops < scoops:
print("Not enough bites left!")
else:
... |
import numpy as np
import sklearn
import sklearn.feature_extraction
import scipy
# convert list to a string
def _list2str(in_list):
# TODO: vectorize this opperation to accelerate it
string_sample = ''.join(i + ' ' for i in in_list)
return string_sample
# calculate the similarity between two batches of captions
d... |
<reponame>baleshwari/Predict-Zomato-Restaurant-Ratings
import numpy as np
import scipy.sparse as sp
import warnings
from abc import ABCMeta, abstractmethod
# mypy error: error: Module 'sklearn.svm' has no attribute '_libsvm'
# (and same for other imports)
from . import _libsvm as libsvm # type: ignore
from . import _... |
<filename>sorted_2.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Sat May 4 13:50:00 2019
@author: chaeg
"""
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 1 20:28:14 2019
@author: chaeg
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import panda... |
# -*- coding: utf-8 -*-
"""
TODO: Please check readme.txt file first!
--
This Python2.7 program is to reproduce Table 2, 3, 4, and 5.
"""
import os
import sys
import pickle
import numpy as np
import multiprocessing
from itertools import product
from numpy.random import randint
try:
import sparse_module
try:
... |
<reponame>k-khr/python_for_bayes<gh_stars>10-100
# -*- coding: utf-8 -*-
#%% NumPyの読み込み
import numpy as np
# SciPyのstatsモジュールの読み込み
import scipy.stats as st
# SciPyのoptimizeモジュールの読み込み
import scipy.optimize as opt
# Pandasの読み込み
import pandas as pd
# MatplotlibのPyplotモジュールの読み込み
import matplotlib.pyplot as plt
# ... |
# -*- coding: utf-8 -*-
"""
Academy Spectral Similarity Index (SSI)
=======================================
Defines the *Academy Spectral Similarity Index* (SSI) computation objects:
- :func:`colour.spectral_similarity_index`
References
----------
- :cite:`TheAcademyofMotionPictureArtsandSciences2019` : The Acad... |
"""
Copyright 2019 <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 in writing, software distribu... |
"""
Integrate functions by rewriting them as Meijer G-functions.
There are three user-visible functions that can be used by other parts of the
sympy library to solve various integration problems:
- meijerint_indefinite
- meijerint_definite
- meijerint_inversion
They can be used to compute, respectively, indefinite i... |
import librosa.display
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from scipy.fft import fft
import matplotlib.pyplot as plt
import numpy as np
import soundfile as sf
from tqdm import tqdm
from nara_wpe.wpe import wpe
from nara_wpe.wpe import get_power
from nara_wpe.utils import stft, istft, g... |
<filename>utils/utils.py<gh_stars>0
"utility methods for generating movies from learners"
from fastai import *
from fastai.vision import *
from fastai.callbacks import *
import shutil
from skimage.filters import gaussian
from skimage.io import imsave
import PIL
import imageio
from scipy.ndimage.interpolation import zoo... |
<reponame>jackcohen5/digit-recognition
import numpy
from scipy import weave
def ZSThinningIteration(originalImageArray, iteration):
I, M = originalImageArray, numpy.zeros(originalImageArray.shape, numpy.uint8)
c_code = """
for (int i = 1; i < NI[0]-1; i++) {
for (int j = 1; j < NI[1]-1; j++) {
... |
<filename>gp_gan.py<gh_stars>0
import math
# import chainer
# import chainer.functions as F
import numpy as np
import torch
# from chainer import cuda, Variable
from scipy.fftpack import dct, idct
from scipy.ndimage import correlate
from scipy.optimize import minimize
from skimage.filters import gaussian, sobel_h, sob... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Этот файл написан с целью посчитать характеристические экспоненты некоторых процессов Леви.
Написан на python2, имеет импорт scipy.
"""
from numpy import *
from scipy import optimize
# параметры модели передаются в виде списка p (от "parameters")
def bs_characteristic_exp(u, p,... |
<filename>examples/python/distributed_estimation.py<gh_stars>1000+
#!/usr/bin/env python
# coding: utf-8
# DO NOT EDIT
# Autogenerated from the notebook distributed_estimation.ipynb.
# Edit the notebook and then sync the output with this file.
#
# flake8: noqa
# DO NOT EDIT
# # Distributed Estimation
#
# This noteboo... |
import numpy as np
from gekko import GEKKO
import matplotlib.pyplot as plt
import car_v04 as car # this is vehicle_model_v04.py in git
from scipy.integrate import odeint
from datetime import datetime
#%%
def vehicle(u,eng_w,v0,ws,delta_t,gb_op,grade): #ws and gb_op are lists of len 2
if u > 0:
eng_tq= car.eng_wo... |
# -*- coding: ISO-8859-1 -*-
#-----------------------------------------------------------------------------
# Copyright (c) 2014, HFTools Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---------------------... |
import os
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import sys
import tkinter as Tk
import tkinter.filedialog
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
from scipy.optimize import curve_fit
from scipy.signal import butter, lfilter
i... |
from sympy import log, exp, Symbol, Pow, sin, MatrixSymbol
from sympy.assumptions import assuming, Q
from sympy.printing.ccode import ccode
from sympy.codegen.matrix_nodes import MatrixSolve
from sympy.codegen.cfunctions import log2, exp2, expm1, log1p
from sympy.codegen.numpy_nodes import logaddexp
from sympy.codegen.... |
<reponame>Mee-Panyar-Clinic/banpei<gh_stars>0
import numpy as np
from scipy import stats
from banpei.base.model import BaseModel
class Hotelling(BaseModel):
def __init__(self):
pass
def detect(self, data, threshold, trained_mean=None,trained_var=None):
"""
Parameters
---------... |
<gh_stars>1-10
#---- to do list -----
# err_data_list 파일자동화
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
import openpyxl
import fnmatch
import time
import tensorflow as tf
import random
import datetime
from tensorflow.keras.models import load_model
from tensorflow.python... |
#!/usr/bin/python
#
# Copyright (C) <NAME>, 2010.
# Licensed under the GNU General Public License (GPL).
# http://www.gnu.org/licenses/gpl.txt
"""
PyMF CUR Decomposition [1]
CUR(SVD) : Class for CUR Decomposition
[1] <NAME>., <NAME>. and <NAME>. (2006), 'Fast Monte Carlo Algorithms III: Computing
a Compressed App... |
"""
pysteps.motion.constant
=======================
Implementation of a constant advection field estimation by maximizing the
correlation between two images.
.. autosummary::
:toctree: ../generated/
constant
"""
import numpy as np
import scipy.ndimage.interpolation as ip
import scipy.optimize as op
def co... |
<gh_stars>100-1000
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "Licen... |
<filename>Time-dependent_GEV_fit_with_NAO.py
"""Fit a time- and NAO-dependent GEV distribution to monthly maxima (MM).
NAO stands for the index of the North Atlantic Oscillation.
See tools_climate.py for information how to obtain this data.
Written by <NAME>, June 2020–July 2021.
"""
import numpy as np
from scipy im... |
import random
from sympy import symbols, simplify, pretty, N
from terminaltables import DoubleTable as FancyTable
flatten = lambda lst: [item for sublist in lst for item in sublist]
def transpose(array_2d):
transposed = []
rows = len(array_2d)
cols = len(array_2d[0])
for j in range(cols):
row... |
#
# Copyright 2021 Budapest Quantum Computing Group
#
# 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... |
<filename>examples/ex1.py<gh_stars>1-10
import numpy as np
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn.decomposition import PCA
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn.svm import LinearSVC
from mlclas.ensemble import BinaryRelevance, ClassifierChains, Calibra... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.5
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_un... |
<gh_stars>1000+
# -*- coding: utf-8 -*-
"""
Number theoretic functions
"""
import sympy
from itertools import combinations
from mathics.version import __version__ # noqa used in loading to check consistency.
from mathics.builtin.base import Builtin, Test, SympyFunction
from mathics.core.expression import (
Expr... |
<reponame>vsukhor/cytoskeleton-analyser
# Copyright (c) 2021 <NAME>. 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 retain the above copyright
# notice, ... |
import numpy as np
from numpy.linalg import lstsq, solve
import warnings
from matplotlib import pyplot as plt
from scipy.optimize import linear_sum_assignment
import tensorly as tl
from tensorly.tenalg.proximal import hals_nnls
import copy
from scipy.optimize import linear_sum_assignment
def osmf_mpals(Y, rank, D, n_... |
from __future__ import division, print_function, absolute_import
import os
from os.path import join
def configuration(parent_package='', top_path=None):
from distutils.sysconfig import get_python_inc
from scipy._build_utils.system_info import get_info, NotFoundError, numpy_info
from numpy.distutils.misc_... |
from mpl_toolkits.mplot3d import axes3d
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import multivariate_normal
# 3 Component GMM Parameters:
ComponentNs = ['G1', 'G2', 'G3']
# Mixtures:
Pis = {'G1': .5,
'G2': .3,
'G3': .2}
# Means - first element refers to... |
from scipy.sparse import hstack as sphs, vstack as spvs, csc_matrix, csr_matrix
from scipy.sparse.linalg import spsolve
import numpy as np
from numpy import conj, arange
def dSbus_dV(Ybus, V):
"""
:param Ybus:
:param V:
:return:
"""
"""Computes partial derivatives of power injection w... |
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# 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 applicab... |
<reponame>bartkowiaktomasz/scipy
import warnings
import numpy as np
from scipy._lib._util import check_random_state
from scipy.special import ndtr, ndtri
from scipy._lib._util import rng_integers
from dataclasses import make_dataclass
from ._common import ConfidenceInterval
from ._axis_nan_policy import _broadcast_conc... |
<gh_stars>0
"""Unit tests for cuda helpers"""
import unittest
import numpy as np
import scipy
import scipy.linalg
import torch
import prox_tv
from tv_opt_layers.helpers.cuda import dpttr
from tv_opt_layers.ops import batched_tvl1_op
class TestTVOps(unittest.TestCase):
def test_batched_tvl1(self):
sigma = 0.5
... |
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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... |
<reponame>piskvorky/Kalman-and-Bayesian-Filters-in-Python
# -*- coding: utf-8 -*-
"""Copyright 2015 <NAME>.
Code supporting the book
Kalman and Bayesian Filters in Python
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
This is licensed under an MIT license. See the LICENSE.txt file
for more inform... |
from builtins import str
from builtins import object
import logging
import numpy as np
from scipy.interpolate import interp1d
class Process(object):
# The factor of in-scatering.
IN_FACTOR = {'EXCITATION': 1,
'IONIZATION': 2,
'ATTACHMENT': 0,
'ELASTIC': 1,... |
<filename>pcmdpy/utils/utils.py
# utils.py
# <NAME> (<EMAIL>)
import numpy as np
import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt
from scipy.special import logsumexp
from scipy.ndimage import gaussian_filter as norm_kde
import cv2
from astropy.io import fits
import os, sys
# A module to creat... |
"""
Scipy related utility functions.
# Author: <NAME>, Max Planck Institute for Biochemistry
# $Id$
"""
from __future__ import unicode_literals
from __future__ import division
from builtins import zip
#from past.utils import old_div
__version__ = "$Revision$"
import numpy
import scipy
import scipy.stats as stats
... |
import numpy as np
import matplotlib.pyplot as plt
import os, sys
from scipy.interpolate import interp2d
from pylab import *
import pandas as pd
filelist=[]
error = []
biomrsd1= []
biomrsd2= []
for i in range(1,94):
df1 = pd.read_csv('/home/renato/groimp_efficient/input/RSD_2D_MIN3P%s.txt'%i,skiprows=2,
... |
<gh_stars>0
# import necessary modules for the class
from lmfit import Parameters #Please do not remove this line
import numpy as np
import sys
import os
from scipy import special
sys.path.append(os.path.abspath('./Functions'))
class Rod_Lipid: #Please put the class name same as the function name
def __init__(self... |
<filename>datasets/create_training_set.py
import numpy as np
import h5py
import scipy.io as sio
import cv2
import zipfile
def create_nyu2():
print ("Loading mat file ...")
f = h5py.File('nyuv2/nyu_depth_v2_labeled.mat')
rgb_images = np.array([x for x in f["images"]])
depth_images = np.array([x for x in f["de... |
# Copyright 2020-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list o... |
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from joblib import Parallel, delayed
from scipy.special import wofz
from protoclass.data_management import RDAModality
from protoclass.preprocessing import MRSIPhaseCorrection
from protoclass.preprocessing import MRSIFrequencyCorrecti... |
import numpy as np
import pytest
from jina.proto.ndarray.dense.numpy import DenseNdArray
def test_empty_ndarray():
a = DenseNdArray()
assert a.value is None
from jina.proto.ndarray.sparse.pytorch import SparseNdArray as sp1
a = sp1()
assert a.value is None
from jina.proto.ndarray.sparse.sci... |
<reponame>ethankward/sympy
from sympy import (
adjoint, And, Basic, conjugate, diff, expand, Eq, Function, I, ITE,
Integral, integrate, Interval, KroneckerDelta, lambdify, log, Max, Min,
oo, Or, pi, Piecewise, piecewise_fold, Rational, solve, symbols, transpose,
cos, sin, exp, Abs, Ne, Not, Symbol, S, s... |
from astropy.io import fits
from scipy.ndimage import filters
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import sys
import importlib
import paths; importlib.reload(paths)
import pltaux; importlib.reload(pltaux)
date = '2013_11_16'
#date = '2016_06_1... |
<reponame>laelasbuch/football-python-flask-app
import pandas as pd
import numpy as np
import pickle
from scipy.stats import poisson
import os.path
from ..utils import array_sum_to_one, exists, to_percent, OpenFile, unzip
from enum import Enum
class ResultType(Enum):
WIN_TEAM_1 = 1
DRAW = 2
WIN_TEAM_2 = ... |
<filename>networks.py<gh_stars>10-100
from ops import *
import scipy.io as sio
class generator:
def __init__(self, name):
self.name = name
def __call__(self, inputs, reuse=False):
#just use the network of CycleGAN's generator
with tf.variable_scope(self.name, reuse=reuse):
... |
from re import match
from sympy import sympify
def mathematica (s):
return sympify(parse(s))
def parse (s):
s = s.strip()
#Begin rules
rules = (
(r"\A(\w+)\[([^\]]+[^\[]*)\]\Z", #Function call
lambda m: translateFunction(m.group(1)) + "(" + parse(m.group(2)) + ")" ),
(r"\((.+)\)\((.+... |
<reponame>Ian-Morris/COMP6915-Machine-Learning<filename>Assignment_4/a4_pilot_version_bw.py
# -*- coding: utf-8 -*-
"""A4_Pilot_Version_BW.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1q-L-BDJSQO2C4b9GqHrcCnbOaMA_4BcO
### Import Libraries
"""
... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 04_ts_prep.ipynb (unless otherwise specified).
__all__ = ['build_timeseries']
# Cell
import pandas as pd
from scipy import stats
import numpy as np
from tqdm.notebook import trange
def build_timeseries(df, features, timeslice_length, window_step_size=1, ignore_label='not_... |
import numpy as np
from numpy.linalg import inv
from scipy.linalg import solve_discrete_are
import logging
from prlqr.matrix_normal_distribution import MN
from prlqr.synthesis.syntheziser import LQRSyntheziser, NoControllerFound
class NLQRSyntheziser(LQRSyntheziser):
def __init__(self, uncertainStateSpaceModel, ... |
<gh_stars>1-10
import scipy.special as sci
import scipy.integrate as inte
import numpy as np
from math import pi,sqrt
# Warnings:
# using convention E>0
# units G=M=scale_radius=1 (output converted to Henon units)
#anisotropoic plummer Dejonghe 1986
def genDf(q):
cost1 = 1.0/( sci.gamma(4.5-q))
cost2 = 1.0/( sci.... |
<gh_stars>0
import numpy as np
import pytest
from sklearn import datasets
from sklearn.svm import LinearSVC
from sparse_ho.criterion import HeldOutLogistic
from sparse_ho.forward import Forward
from sparse_ho.implicit import Implicit
from sparse_ho.implicit_forward import ImplicitForward
from sparse_ho.models import SV... |
from jaxrk.utilities.eucldist import eucldist
from jaxrk.utilities.distances import dist
from jaxrk.utilities.linalg import inv_blockmatr
from scipy.spatial.distance import cdist
from numpy.random import randn
from jax.numpy import allclose
import jax.numpy as np
from jaxrk.kern import LinearKernel, GenGaussKernel
from... |
<filename>audio_synthesizer/audio_synthesizer.py
# System-related & MQTT imports
import time
import sys, os, pickle, argparse, subprocess
from tqdm import tqdm
from profilehooks import timecall
import queue
import paho.mqtt.client as mqtt
# Synthesizer imports
import synthesizer
from synthesizer import inference as si... |
<reponame>hossein1387/U-Net-Fixed-Point-Quantization-for-Medical-Image-Segmentation
from collections import defaultdict
from scipy import spatial
import numpy as np
class MetricManager(object):
def __init__(self, metric_fns):
self.metric_fns = metric_fns
self.result_dict = defaultdict(float)
... |
<gh_stars>10-100
# infrapy.location.bisl.py
#
# The bisl methods utilized to analyze the posterior pdf
# obtained by combining detection likelihood pdfs. The
# methods here use global coordiantes and assume two
# spatial parameters, latitude and longitude, along with
# the source time, t.
#
# Author <NAME> ... |
<reponame>asztrajman/svr-remap
import pandas as pd
import numpy as np
from sklearn import linear_model
import matplotlib.pyplot as plt
import scipy.optimize
import pyexr
ddf = pd.read_csv('mitsuba-ward2mitsuba-as.csv', sep='\t')
srccol_a = 'alpha1'
srccol_s = 'specular1'
tgtcol_a = 'alpha2'
tgtcol_s = 'eta2'
def sl... |
"""A demo of how to develop new inference algorithms in Edward. Here
we implement importance-weighted variational inference. We test it on
logistic regression.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import edward as ed
import numpy as np
import ... |
nc# -*- coding: utf-8 -*-
"""
Created on Wed May 1 17:46:25 2019
@author:
"""
#Introduce the package
import numpy as np
import random
from scipy.optimize import minimize
from sympy import diff
class Economy(object):
def _init_(self,nc,npro,ngp,fc,T,A,fp,externality):
# nc: no of consum... |
<reponame>nicoguaro/AdvancedMath<filename>examples/wave_iterations.py
"""
Illustration of the wave
Solve the wave equation using finite differences and Forward Euler.
Based on: https://commons.wikimedia.org/wiki/File:Heat_eqn.gif
"""
from __future__ import division, print_function
import numpy as np
from scipy.ndima... |
import numpy as np
import scipy.stats as stats
import scipy.linalg as la
import sys
import random
import time
import os
import os.path
import scipy.linalg.blas as blas
from pysnptools.snpreader.bed import Bed
import pandas as pd
import statsmodels.api as sm
import statsmodels.tools.tools as sm_tools
import itertools
np... |
from tensorflow.python.framework.ops import reset_default_graph
import tensorflow as tf
from bse_clahe.utils import read_test_images, check_and_create_dir, tf_ms_ssim, input_pipeline
import os
import numpy as np
import cv2
from scipy.misc import imsave
from PIL import ImageFile
from PIL import Image
ImageFile.LOAD_TRU... |
<filename>storm_analysis/sa_utilities/xyz_drift_correction.py
#!/usr/bin/env python
"""
Image based XYZ drift correction for STORM movies.
Hazen 12/17
"""
import numpy
import os
import scipy.signal
import sys
import storm_analysis.sa_library.drift_utilities as driftUtils
import storm_analysis.sa_library.imagecorrela... |
<reponame>bce-toolkit/BCE
#!/usr/bin/env python
#
# Copyright 2014 - 2018 The BCE Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the license.txt file.
#
import bce.base.stack as _adt_stack
import bce.locale.option as _l10n_opt
import bce.locale.regi... |
import numpy as np
from scipy.special import digamma
def alpha_update(m, p):
K = m.size
s_old = - (K - 1) / 2 / np.sum(np.multiply(m, (np.log(p) - np.log(m))))
print s_old
count = 0
for i in range(100):
s_new = (K - 1) / ((K - 1)/s_old - digamma(s_old) +
np.sum(np.multiply(m, digamma(s_old * m))) - np.sum(n... |
# coding=utf-8
import numpy as np
import scipy.signal as sig
# import scipy.sparse as sprs
# import scipy.sparse.linalg as spla
# import functools as ft
from pypint.utilities import assert_is_callable, assert_is_instance, assert_condition
from pypint.plugins.multigrid.i_multigrid_level import IMultigridLevel
from pypin... |
<gh_stars>10-100
from scipy.signal.signaltools import resample_poly
import yaml
import fractions
import numpy as np
def getConfiguration(config_fname):
'''sets up parameters for passive radar processing'''
config_file = open(config_fname, 'r')
config = yaml.safe_load(config_file)
config_file.close()
... |
<reponame>caoy3/RNA-m5C
#!/usr/bin/env python
import os,sys
import argparse
from collections import defaultdict
import pandas as pd
import numpy as np
import scipy.stats
import time
from time import gmtime, strftime
import scipy.stats
def subdf_formation(subs,format_df):
if len(subs) == 1:
min_C = options.single_co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.