text string |
|---|
''' Data loading functions during training
(modified from from https://github.com/yukimasano/self-label) '''
import torchvision
import torch
import torchvision.transforms as tfs
import models
import os, glob, natsort, pdb
import numpy as np
import util
import xarray as xr
from scipy.stats import mode
import pickle
fro... |
import os
import sys
import cv2
import time
import torch
import numpy as np
import torch.nn as nn
import torch.optim as optim
import matplotlib.pylab as plt
import torch.nn.functional as F
from models.GatedPixelCNN import GatedPixelCNN
from config import setSeed, getConfig
from customLoader import LatentBlockDataset
... |
<reponame>icyblade/xgboost<filename>python-package/xgboost/core.py
# coding: utf-8
# pylint: disable=too-many-arguments, too-many-branches, invalid-name
# pylint: disable=too-many-branches, too-many-lines, W0141
"""Core XGBoost Library."""
from __future__ import absolute_import
import sys
import os
import ctypes
impor... |
<reponame>thegreenwebfoundation/green-spider
"""
Provides the spider functionality (website checks).
"""
import argparse
import json
import logging
import re
import statistics
import time
from datetime import datetime
from pprint import pprint
from google.api_core.exceptions import InvalidArgument
from google.cloud i... |
from sympy import (Symbol, Rational, Order, exp, ln, log, nan, oo, O, pi, I,
S, Integral, sin, cos, sqrt, conjugate, expand, transpose, symbols,
Function, Add)
from sympy.core.expr import unchanged
from sympy.testing.pytest import raises
from sympy.abc import w, x, y, z
def test_caching_bug():
#needs to b... |
<reponame>gatling-nrl/scikit-fem
r"""Linear hydrodynamic stability.
The linear stability of one-dimensional solutions of the Navier–Stokes equations
is governed by the `Orr–Sommerfeld equation
<https://en.wikipedia.org/wiki/Orr%E2%80%93Sommerfeld_equation>`_ (Drazin &
Reid 2004, p. 156). This is expressed in terms of... |
# -*- coding: utf-8 -*-
import logging
import numpy as np
from scipy.spatial.distance import cdist, pdist, squareform
# TODO: make this robust to having b0s
def swap_sampling_eddy(points, shell_idx, verbose=1):
"""
Optimize the bvecs of fixed multi-shell scheme for eddy
currents correction (fsl EDDY).
... |
<reponame>code-rius/data-randomness-and-regularities<gh_stars>0
import matplotlib.pyplot as plot
import numpy as np
import timeit
from scipy import signal
from PIL import Image, ImageOps
class RecurrencePlot:
def __init__(self, D: int, d: int, data: list, compare_mode:int = 0, target: float = 17.5, deviation: fl... |
<reponame>HuaijiaLin/AGSS-VOS<gh_stars>10-100
import cv2
import numpy as np
import random
from scipy.ndimage import distance_transform_edt as Dte
import torch
def resize(image, new_size, label=False):
r"""
resize a image to make the longer size match the new size
:param image: both HW3 or HW1 ok
:param new_si... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy.spatial import cKDTree
def in_box(pts, box):
x_in = np.logical_and(box[0] <= pts[:, 0], pts[:, 0] <= box[1])
y_in = np.logical_and(box[2] <= pts[:, 1], pts[:, 1] <= box[3])
index = np.logical_and(x_in, y_in)
return pts[index, :].copy()
class Pse... |
<filename>angler/linalg.py
import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as spl
try:
from pyMKL import pardisoSolver
SOLVER = 'pardiso'
except:
SOLVER = 'scipy'
from time import time
from angler.constants import DEFAULT_MATRIX_FORMAT, DEFAULT_SOLVER
from angler.constants import ... |
"""
Statistical tools for time series analysis
"""
import numpy as np
from scipy import stats, signal
from statsmodels.regression.linear_model import OLS, yule_walker
from statsmodels.tools.tools import add_constant
from tsatools import lagmat, lagmat2ds, add_trend
#from statsmodels.sandbox.tsa import var
from adfvalu... |
# Enhanced sampling protocols
# This file contains utility functions to generate samples in the gas-phase.
import os
import jax
import multiprocessing
import numpy as np
from scipy.special import logsumexp
from jax.scipy.special import logsumexp as jlogsumexp
from fe import topology
from fe.utils import get_romol_c... |
<filename>MutualCorrelationWork/correlation_analysis_GaN_v5_LLZO.py
# standard imports
import numpy as np
import matplotlib.pyplot as plt
# Add parent directory to path
import sys
import os
parent_path = '..\\nistapttools'
if parent_path not in sys.path:
sys.path.append(os.path.abspath(parent_path))
# custo... |
import pytest
import numpy as np
import scipy.sparse as sp
from pypardiso.scipy_aliases import pypardiso_solver
ps = pypardiso_solver
def create_test_A_b_small(matrix=False, sort_indices=True):
"""
--- A ---
scipy.sparse.csr.csr_matrix, float64
matrix([[5, 1, 0, 0, 0],
[0, 6, 2, 0, 0],
... |
<reponame>deepmind/distribution_shift_framework
#!/usr/bin/python
#
# Copyright 2022 DeepMind Technologies Limited
#
# 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.o... |
<filename>biosppy/signals/ecg.py
# -*- coding: utf-8 -*-
"""
biosppy.signals.ecg
-------------------
This module provides methods to process Electrocardiographic (ECG) signals.
Implemented code assumes a single-channel Lead I like ECG signal.
:copyright: (c) 2015-2018 by Instituto de Telecomunicacoes
:license: BSD 3-... |
import numpy as np
from scipy.linalg import det, eig, inv, solve
import scipy
from itertools import combinations
from js.geometry.rotations import *
from js.geometry.sphere import Sphere
from .discretized4dSphere import S3Grid
from .vMFMM import *
#import mayavi.mlab as mlab
import matplotlib.pyplot as plt
import pygra... |
<gh_stars>1000+
import numpy as np
import networkx as nx
import unittest
import scipy.sparse as ssp
import dgl
import backend as F
from test_utils import parametrize_dtype
D = 5
def generate_graph(grad=False, add_data=True):
g = dgl.DGLGraph().to(F.ctx())
g.add_nodes(10)
# create a graph where 0 is the s... |
<filename>jumpcutter.py
from contextlib import closing
from PIL import Image
import subprocess
from audiotsm import phasevocoder
from audiotsm.io.wav import WavReader, WavWriter
from scipy.io import wavfile
import numpy as np
import re
import math
from shutil import copyfile, rmtree
import os
import argparse
from pytub... |
# -*- encoding: utf-8 -*-
"""
TODO:
* Address Issue 2251, printing of spin states
"""
from sympy.physics.quantum.anticommutator import AntiCommutator
from sympy.physics.quantum.cg import CG, Wigner3j, Wigner6j, Wigner9j
from sympy.physics.quantum.commutator import Commutator
from sympy.physics.quantum.constants import ... |
<gh_stars>0
"""
** voyagerimb.py - A browser for the NASA's Voyager Golden Disk images **
Copyright (c) <2017> <NAME> <<EMAIL>>
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... |
<gh_stars>0
"""
Generate some results for midterm report
"""
import os
import numpy as np
from matplotlib import pyplot as plt
import pickle
import time
import SparseLowRankInv as slri
from scipy import sparse
ACTION = 'flop'
# Parameters for running Sparse + Low-rank Inverse
SAVEDIR = 'result_paper'
PROJECTION = 'J... |
# To add a new cell, type '#%%'
# To add a new markdown cell, type '#%% [markdown]'
#%% Change working directory from the workspace root to the ipynb file location. Turn this addition off with the DataScience.changeDirOnImportExport setting
# ms-python.python added
import os
try:
os.chdir(os.path.join(os.getcwd(), 'no... |
<filename>keras4torch/metrics.py<gh_stars>10-100
from collections import OrderedDict
import torch
import torch.nn.functional as F
import numpy as np
class Metric():
def __init__(self) -> None:
pass
def get_abbr(self) -> str:
raise NotImplementedError()
class Accuracy(Metric):
def __call__... |
<reponame>BingqingCheng/linear-regression-benchmarks<filename>scripts/extract_kernel.py
import numpy as np
from scipy.stats import spearmanr
from scipy.stats import pearsonr
import benchml as bml
if __name__ == "__main__":
bml.log.Connect()
bml.log.AddArg("models", (list,str), default=["^bmol_*.*_krr$"])
... |
import numpy as np
import numpy.ma as ma
import numpy.testing as npt
import pandas as pd
import pymc3_ext as pm
import scipy.sparse as sps
import theano
import theano.tensor as tt
import theano.sparse as sparse
class TestHelperFunc:
def test_pandas_to_array(self):
"""
Ensure that pandas_to_array ... |
<gh_stars>10-100
# coding: utf-8
# In[1]:
# Load dependencies
import pandas as pd
import numpy as np
from scipy.stats import gmean
import sys
sys.path.insert(0,'../../statistics_helper/')
from fraction_helper import *
from CI_helper import *
from excel_utils import *
pd.options.display.float_format = '{:,.1e}'.forma... |
def gradient_descent(A, b, mu, args, x_0, draw=True, output_f=False, delta=10, alp=1e-3, epsilon=1e-2, k=0):
'''
Parameters
----------
A : numpy.array
m*n维数 参数矩阵
b : 系数矩阵
m*1维数 参数矩阵
mu : float
正则化参数
args : sympy.matrices.dense.MutableDenseMa... |
<filename>scripts/plmDCA.py
import numpy as np
from numpy.linalg import norm
import pickle as pkl
from scipy.spatial.distance import squareform, pdist
from scipy.optimize import minimize
import sys
# Global variable
q = 22
def main(fastafile,outputfile,reweighting_threshold):
# maxcor: Defined in processInputOpti... |
<reponame>milljm/raven<filename>framework/SupervisedLearning/ARMA.py
# Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... |
<gh_stars>0
import math
import numpy as np
from numpy import sin,pi,linspace
from scipy.interpolate import UnivariateSpline, interp1d
from scipy.integrate import quad, cumtrapz, quad_explain
from scipy.signal import argrelextrema
g_SmoothingForParameterization_t = None
g_SmoothingForParameterization_s = None
g_Smooth... |
import os
import numpy as np
import tensorflow as tf
from tqdm import trange
#from buffer import Buffer
import scipy
import graph
from model import Model
from utils import BatchLoader, convert_to_one_hot
from six.moves import reduce, xrange
"""
Trainer:
1. Initializes model
2. Train
3. Test
"""
class Trainer(obj... |
<reponame>piyushpandita92/pydes<filename>tests/ex3.py
"""
Test the multi-objective optimization algorithm.
"""
import matplotlib
matplotlib.use('PS')
import seaborn as sns
sns.set_style("white")
sns.set_context("paper")
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import pyde... |
<reponame>lunzueta/insightface<filename>recognition/arcface_torch/eval/spoofing_verification.py
"""Helper for evaluation on the Labeled Faces in the Wild dataset
"""
# MIT License
#
# Copyright (c) 2016 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and asso... |
<reponame>pjotrscholtze/trident
# /**
# * Copyright MaDgIK Group 2010 - 2015.
# */
import statistics
from score.HistogramScore import HistogramScore
from Bucket import Bucket
from typing import List
# /**
# * @author herald
# */
class BalanceVarianceAndBucketsHistogramScore(HistogramScore):
def __init__(self... |
from typing import Optional, Union, Tuple
import torch
import numpy as np
import scipy.sparse as sp
from torch_geometric.utils import to_undirected
def directed_features_in_out(edge_index: torch.LongTensor, size: int,
edge_weight: Optional[torch.FloatTensor]=None, device:str='cpu') -> Tuple[torch.LongTensor, tor... |
<gh_stars>0
# Copyright 2014 <NAME> <<EMAIL>>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distri... |
# -*- coding: utf-8 -*-
from warnings import warn
import numpy as np
import pandas as pd
import scipy.signal
from ..misc import as_vector, NeuroKitWarning
from ..signal import signal_filter, signal_smooth
def eda_clean(eda_signal, sampling_rate=1000, method="neurokit"):
"""**Preprocess Electrodermal Activity (E... |
<reponame>aswolf/xmeos<filename>xmeos/models/gamma.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
from future.utils import with_metaclass
import numpy as np
import scipy as sp
from abc import ABCMeta, abstractmethod
from scipy import integrate
import scipy.inte... |
<reponame>arinachison/abides<gh_stars>100-1000
from metrics.metric import Metric
from metrics.minutely_returns import MinutelyReturns
from scipy.stats import kurtosis
class Kurtosis(Metric):
def __init__(self, intervals=4):
self.intervals = intervals
self.mr = MinutelyReturns()
def compute(s... |
# coding=utf-8
# Copyright (C) 2020 NumS Development Team.
#
# 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... |
<reponame>ssloy/least-squares-course<filename>presentation/listings/cubify.py
import numpy as np
from mesh import Mesh
from scipy.sparse import lil_matrix
from scipy.sparse.linalg import lsmr
m = Mesh("input-face.obj") # load mesh
def nearest_axis(n):
return np.argmax([np.abs(np.dot(n, a)) for a in [[1,0,0... |
from torch.utils import data
from scipy import stats
import pandas as pd
import numpy as np
import matplotlib.pyplot as plot
from itertools import repeat, chain
import torchvision.transforms as T
import lstm_hvac.preprocessing as proc
class TimeSeriesDataset(data.Dataset):
def __init__(self, data, targ... |
<reponame>Fernal73/LearnPython3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize
def f(x):
return x**2 + 10*np.sin(x)
x = np.arange(-10, 10, 0.1)
plt.plot(x, f(x))
plt.savefig("minimize.png")
plt.savefig("minimize.pdf")
result = optimize... |
from pymatting.util.boxfilter import boxfilter
import numpy as np
import scipy.signal
import time
def run_boxfilter(m, n, r, mode, n_runs):
src = np.random.rand(m, n)
kernel = np.ones((2 * r + 1, 2 * r + 1))
dst_ground_truth = scipy.signal.correlate2d(src, kernel, mode=mode)
for _ in range(n_runs):
... |
<reponame>colour-science/trimesh
# flake8: noqa
"""
Module which contains most imports and data unit tests
might need, to reduce the amount of boilerplate.
"""
from distutils.spawn import find_executable
import os
import sys
import json
import copy
import time
import shutil
import timeit
import base64
import inspect
im... |
<reponame>aphearin/SatGen
############################# orbit class ###############################
# <NAME> 2016, HUJI --- original version
# <NAME> 2019, HUJI, UCSC --- revisions:
# - no longer convert speed unit from kpc/Gyr to km/s
# - improved dynamical-friction (DF) (see profiles.py for more details)
#... |
<reponame>romulus97/HYDROWIRES
# -*- coding: utf-8 -*-
#This is the first modified version of the DE
#The main difference is add surplus as a objective and add maximun discharge
"""
Created on Thu Nov 30 17:19:24 2017
@author: jdkern
"""
from __future__ import division
from scipy.optimize import differential_evolutio... |
import numpy as np
from os import listdir
from os.path import isfile, join, dirname
from scipy.io import loadmat
meta_clsloc_file = join(dirname(__file__), "data", "meta_clsloc.mat")
synsets = loadmat(meta_clsloc_file)["synsets"][0]
synsets_imagenet_sorted = sorted([(int(s[0]), str(s[1][0])) for s in synsets[:1... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Software License Agreement (BSD License)
#
# Copyright (c) 2014, Ocean Systems Laboratory, Heriot-Watt University, UK.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follow... |
# Script to generate the walker beam equations
# For a full explanation see the jupyter notebook named "Ray Tracing for Tilted
# Flat Mirrors" in the "ipynbs" directory
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sympy as sp
###################... |
# testing field for things
import cv2 as cv
import numpy as np
from PIL import Image
import random
import scipy.ndimage
import scipy.misc
from matplotlib import pyplot
from src.data_manager import load_img, simple_flow
from src.data_manager import tuples_from_custom
def vector_direction_deg(x, y):
"""
di... |
import sklearn
from sklearn.naive_bayes import MultinomialNB as NB
import pandas as pd
import numpy as np
import scipy
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
import joblib
from src.data... |
<gh_stars>1-10
import pandas as pd
from enum import Enum
from datetime import datetime
import numpy as np
from fotf import *
from scipy.optimize import minimize, least_squares #,leastsq, curve_fit, shgo, dual_annealing, basinhopping, differential_evolution, Bounds
from control.matlab import lsim as controlsim
from matp... |
import cv2
import numpy as np
import matplotlib.pyplot as plt
import os, sys
import matplotlib.ticker as plticker
import pandas as pd
from collections import OrderedDict
from random import randint
from PIL import Image, ImageChops
from scipy.ndimage.measurements import center_of_mass
def visualize_grid(img, width, he... |
<gh_stars>1-10
#%% Import the nescessary stuff
# basic OS stuff
import time, os, sys, shutil
# for math and plotting
import pandas as pd
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
# small utilities
import csv
from colour import Color
from itertools import compress # for list selection with ... |
import json
import os
import re
from datetime import datetime, timedelta
from statistics import mean
import requests
import mskai.globals as globals
from mskai.DxLogging import print_debug
from mskai.veconfig import loadveconfig
import subprocess
class virtualization():
def __init__(self, config, **kwargs):
... |
<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 1 17:26:21 2021
@author: peter
"""
import numpy as np
from pathlib import Path
import pandas as pd
import scipy.ndimage as ndimage
import scipy.signal as signal
import matplotlib.cm
import tifffile
import time
import f.plotting_funct... |
<reponame>johntiger1/vaal_querying
import numpy as np
import scipy as sp
import scipy.stats as stats
import matplotlib.pyplot as plt
'''
t is number of standard deviations
'''
def plot_ci_manual(t, s_err, n, x, x2, y2, ax=None):
"""Return an axes of confidence bands using a simple approach.
Notes
-----
... |
import numpy as np
from scipy import signal
def approximate_polygon(coords, tolerance):
"""Approximate a polygonal chain with the specified tolerance.
It is based on the Douglas-Peucker algorithm.
Note that the approximated polygon is always within the convex hull of the
original polygon.
Param... |
# Copyright 2016 The TensorFlow 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
"""Miscellaneous utility functions.
"""
from enum import Enum
import re
import inspect
import itertools
from scipy import ndimage as ndi
from numpydoc.docscrape import FunctionDoc
import numpy as np
import wrapt
def str_to_rgb(arg):
"""Convert an rgb string 'rgb(x,y,z)' to a list of ints [x,y,z].
"""
ret... |
#ref: <NAME>
###########
# Let us start by looking at basic image transformation tasks like
#resize and rescale.
#Then let's look at a few ways to do edge detection.
#And then sharpening using deconvolution method and finally
#Then let's take a real life scenario like scratch assay analysis.
#Resize, rescale
import... |
<filename>LGT-Haptics.py
from pylab import *
import theano as th
import lasagne
import sys
import scipy.io
from scipy.io import wavfile
class LGT_haptics:
def __init__(self,x_shape,N,J,Q,num_knots=2**8,t1=-1.,t2=1.,sigma=0.02,log_=1,init_='random',nonlin='sqrt',grad=False):
x = th... |
#/usr/bin/env python
#coding=utf-8
import jieba
import sys
import pickle
from scipy.spatial.distance import cosine
import scipy.sparse as ssp
from preprocess import change_sentence
from tf_kdl_weight import TFKLD
def my_tokenizer(x):
return x.split()
def process(inpath, outpath):
tfkdl_p... |
<reponame>ejin700/pkpd<filename>pkmodel_EmFaGeHoJe/solution.py
#
# Solution class
#
#from model import Model
from pkmodel_EmFaGeHoJe.model import Model
import matplotlib.pylab as plt
import numpy as np
import scipy.integrate
class Solution:
"""A class that solves a Pharmacokinetics model
Methods
-------... |
<reponame>aleksandrkrivolap/mmfashion<gh_stars>0
import numpy as np
from numpy.linalg import norm as norm_dist
import scipy.io as sip
from scipy.spatial.distance import cdist as cdist
class LandmarkDetectorEvaluator(object):
def __init__(self,
img_size,
landmark_num,
... |
<filename>Chapter03/scripts/Exercise3.01_Unit_Test.py
# coding: utf-8
from sklearn.datasets import fetch_20newsgroups
from scipy.cluster.hierarchy import ward, dendrogram
import matplotlib as mpl
from scipy.cluster.hierarchy import fcluster
from sklearn.metrics.pairwise import cosine_similarity
import pandas as pd
im... |
# --------------
# Import packages
import numpy as np
import pandas as pd
from scipy.stats import mode
# code starts here
bank=pd.read_csv(path)
#print(bank.head())
categorical_var=bank.select_dtypes(include='object')
print(categorical_var)
numerical_var=bank.select_dtypes(include='number')
print(numerical_var)
# c... |
<reponame>harsh-98/sympy
"""Line-like geometrical entities.
Contains
========
LinearEntity
Line
Ray
Segment
LinearEntity2D
Line2D
Ray2D
Segment2D
LinearEntity3D
Line3D
Ray3D
Segment3D
"""
from __future__ import division, print_function
from sympy.core import S, sympify
from sympy.core.relational import Eq
from sympy... |
"""
A class to propose splits according to the most and least interesting points
based on the gradient.
"""
import numpy as np
import pandas as pd
import scipy.stats as stats
class SplitProposals:
"""
Generate splits to try when fit_type = 'local'.
Parameters
----------
given_splits : list
... |
import numpy as np
from scipy.spatial.transform import Rotation as R
from scipy.spatial.transform import Slerp
from scipy import interpolate
from sklearn.decomposition import PCA
def gen_circle(radius, num_points, R, hwf):
ps = np.arange(num_points)
pts = (np.exp(2j*np.pi/num_points)**ps*radius)
transfromatio... |
<gh_stars>1-10
# Calculate stability of representational similarity among DCNNs.
import numpy as np
from os.path import join as pjoin
from ATT.algorithm import tools
from scipy import stats
network_name = ['alexnet', 'vgg11', 'vgg19', 'resnet18', 'resnet50', 'resnet101']
dnnresponse_path = 'data/DCNNsim'
wordnet_s... |
<filename>anndata/_core/merge.py
"""
Code for merging/ concatenating AnnData objects.
"""
from collections import OrderedDict
from collections.abc import Mapping, MutableSet
from functools import reduce, singledispatch
from itertools import repeat
from operator import and_, or_, sub
from typing import Any, Callable, Co... |
<filename>CSSPy/volume_sampler.py
import scipy.io
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from copy import deepcopy
import scipy.io
import numpy as np
import pandas as pd
import seaborn as sns
from scipy import random, linalg, dot, diag, all, allclose
import timeit
from scipy.sparse... |
from logging import warning
from time import time
from typing import Callable, List, Optional, Tuple, Union, Set, Dict, Any
import numpy as np
import pandas as pd
from numpy import ndarray
from scipy.sparse import coo_matrix, spmatrix, csc_matrix, csr_matrix
from .coreConfig import EXTRA_LIBRARY
def che... |
<filename>sympy/simplify/hyperexpand_doc.py<gh_stars>1-10
""" This module cooks up a docstring when imported. Its only purpose is to
be displayed in the sphinx documentation. """
from sympy.simplify.hyperexpand import FormulaCollection
from sympy import latex, Eq, hyper
c = FormulaCollection()
doc = ""
for f in... |
<gh_stars>0
import numpy
from numpy.linalg import norm
from scipy.fft import idstn
from aydin.features.groups.convolutional import ConvolutionalFeatures
class DCTFeatures(ConvolutionalFeatures):
"""
DCT Feature Group class
"""
def __init__(self, size: int, max_freq: float = 0.75, power: float = 0.5)... |
# -*- coding: utf-8 -*-
#
# Author: <NAME> <<EMAIL>>
#
# Tests for seasonal differencing terms
from __future__ import absolute_import, division
import six
from sklearn.linear_model import LinearRegression
from sklearn.utils.validation import column_or_1d, check_array
from scipy.linalg import svd
from statsmodels imp... |
import numpy as np
from fmm_source import ggq_dist
from basic_operations import Vlm, operation
from scipy.special import binom
class CAO_basis:
"""build variables for contracted atomic basis"""
def __init__(self, x, element, n, pow, basis_type="STO_3G"):
self.x = x
self.element = element
... |
# -*- coding: utf-8 -*-
from .cartan_type import CartanType
from sympy.core import Basic
class RootSystem(Basic):
"""
Every simple Lie algebra has a unique root system.
To find the root system, we first consider the Cartan subalgebra of g,
which is the maximal abelian subalgebra, and consider the adj... |
<gh_stars>0
#!/usr/bin/env python
#from picamera.array import PiYUVArray
from picamera import PiCamera
from picamera.array import PiRGBArray
from PIL import Image
import time
import numpy
import threading
import datetime
import os
import io
import math
from fractions import Fraction
import json
import pyexiv2
class ... |
# Support for the Numato Saturn (http://numato.com/product/saturn-spartan-6-fpga-development-board-with-ddr-sdram)
# Original code from : https://github.com/timvideos/litex-buildenv/blob/master/targets/waxwing/base.py
# By <NAME>
from fractions import Fraction
from migen import *
from migen.genlib.resetsync import As... |
<reponame>ameisner/legacypipe
from __future__ import print_function
import numpy as np
import logging
logger = logging.getLogger('legacypipe.detection')
def info(*args):
from legacypipe.utils import log_info
log_info(logger, args)
def debug(*args):
from legacypipe.utils import log_debug
log_debug(logge... |
<filename>main.py
#!/usr/bin/env python
# encoding: utf-8
# author: 04
import operator
import itertools
from decimal import Decimal as D # noqa
from functools import reduce
from queue import PriorityQueue as PQ # noqa
import yaml
import click
from scipy.special import comb
from tqdm import tqdm
from buildings import... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 27 12:34:01 2018
@author: thieunv
*) AdadeltaOptimizer (MinMaxScaler - 2)
- Activation: elu, elu/ relu, elu/ tanh, elu/ sigmoid, elu ==> MSE:
- Activation: elu, relu/ relu, relu/ tanh, relu/ sigmoid, relu ==> MSE:
- Activation: elu, tanh/ relu, t... |
<filename>make_animation.py
import numpy as np
from scipy import integrate
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import cnames
from matplotlib import animation
def make_3d_animation(L, pos, delay=10, initial_view=(30, 20),
rotate_on_p... |
<reponame>charlesblakemore/opt_lev_analysis<gh_stars>0
import cant_utils as cu
import numpy as np
import matplotlib.pyplot as plt
import glob
import bead_util as bu
import tkinter
import tkinter.filedialog
import os, sys
from scipy.optimize import curve_fit
import bead_util as bu
from scipy.optimize import minimize_sc... |
"""Definitions of monomial orderings. """
from __future__ import print_function, division
from typing import Optional
__all__ = ["lex", "grlex", "grevlex", "ilex", "igrlex", "igrevlex"]
from sympy.core import Symbol
from sympy.core.compatibility import iterable
class MonomialOrder(object):
"""Base class for m... |
#!/usr/bin/env python
# @Copyright 2007 <NAME>
import os
from scipy import *
import utils
from w2k_atpar import readpotential, readlinearizatione, atpar, rint13
import struct1
import optparse
import re
def SolveForContinuousFunction(A,Ae,Aee,Rx,Nr0,Nr):
"""
Routine extends solution beyond Rmt by making value ... |
<reponame>Huyuwei/FeatGraph
import scipy
import scipy.sparse
import numpy as np
import argparse
import tvm
from tvm import te
from tvm.topi.util import get_const_tuple
from featgraph.module import VanillaSDDMMx86, VanillaSDDMMcuda
def exp_range(start, end, mul):
while start <= end:
yield start
st... |
from statsmodels.compat.numpy import lstsq
from statsmodels.compat.pandas import assert_index_equal
from statsmodels.compat.platform import PLATFORM_WIN
from statsmodels.compat.python import lrange
import os
import warnings
import numpy as np
from numpy.testing import (
assert_,
assert_allclose,
assert_al... |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 27 14:32:35 2018
@author: tb267
"""
import os.path
import numpy as np
import scipy.io as io
from pyqtgraph.Qt import QtGui, QtWidgets
def load_data(filename=None):
'''
Loads dataset from filename, or displays a dialog if no argument provided.
'''
if fi... |
# -*- coding: utf-8 -*-
"""1.K-Means_Algorithm
#Basic K-Means Implementations ::::
#Implementation 1 -->>
Generating different blobs
"""
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from sklearn.datasets.samples_generator import make_blobs
from sklearn.cluster import KMeans
X, y = ma... |
<filename>f_preprocess.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
f_preprocess of data
1. data cleaning
1. missing value
1. delete the piece of data
2. interpolation of value
1. replace
2. nearest neighbor imputation
3. regression method
4. spline inte... |
<gh_stars>0
from .utils import *
from ..utils import find_max
import msmtools.analysis as mana
import warnings
import networkx as nx
from scipy.sparse import dok_matrix
import itertools
class GenotypePhenotypeClusters(object):
"""Handles clustered genotype-phenotype maps.
Parameters
----------
gpmsm ... |
# -*- coding: utf-8 -*-
"""
===============================================================================
Delaunay: Generate random networks based on Delaunay Tessellations
===============================================================================
"""
import sys
import scipy as sp
import numpy as np
import Open... |
# -*- coding: utf-8 -*-
from scipy import *
from scipy.integrate import quad
# public
def call_price(kappa, theta, sigma, rho, v0, r, T, s0, K):
p1 = __p1(kappa, theta, sigma, rho, v0, r, T, s0, K)
p2 = __p2(kappa, theta, sigma, rho, v0, r, T, s0, K)
return s0 * p1 - K * exp(-r * T) * p2
def put_price(k... |
<gh_stars>0
from __future__ import division, print_function, absolute_import
__all__ = ['geometric_slerp']
import warnings
import numpy as np
from scipy.spatial.distance import euclidean
def _geometric_slerp(start, end, t):
# create an orthogonal basis using QR decomposition
basis = np.vstack([start, end])... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.