text
string
from __future__ import print_function import argparse import os import torch import torch.nn as nn import torch.optim as optim from torch.autograd import Variable from torch.utils.data import DataLoader from rbpn import Net as RBPN from data import get_test_set from functools import reduce import numpy as np # from s...
from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report import matplotlib.pyplot as plt from matplotlib.patches import Patch import matplotlib.gridspec as gridspec import scipy.io as scio import numpy as np from minisom import MiniSom import math import torch fro...
<reponame>jajool/pipepy import os import json import numpy as np from scipy import interpolate class CompFactorInterpolator: address = os.path.join( os.path.dirname(__file__), os.pardir, 'databases', "z.json") def __init__(self): with open(self.address) as fp: points = np.array(js...
import numpy as np import scipy.signal import matplotlib.pyplot as plt import gym from numpy.random import choice import random import time N_POS = 150 N_VEL = 120 VALUE_STEP_SIZE = 1e-2 # faster than policy POLICY_STEP_SIZE = 1e-3 NUM_EPISODES = 1000 GAMMA = 0.999 TEMPERATURE = 1000 EPSILON = 1 ACTIONS = [-1, 0,...
#!/usr/bin/env python # -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by <NAME> # -------------------------------------------------------- """Train a Fast R-CNN network on a region of interest d...
import cmath import math from tkinter import W polos = 8 freq = 60 t1 = 380 t2 = 220 r1 = 0.19 r2L = 0.11 x1 = 0.45 x2L = 0.21 rp = 130 xm = 22 perdastotais = 1735 rpm = 400 ns = 120*freq/polos print("ns = ", ns) s = (ns - rpm)/ns print("s = ", s) aux1=[x1+x2L] Zs = complex(r1+r2L/s,sum(list(aux1))) print("Zs = ",...
import numpy as np import tensorflow as tf import tensorflow.keras.backend as K from scipy.ndimage.interpolation import zoom from tensorflow.python.keras.layers.convolutional import Conv from tf_keras_vis import ModelVisualization from tf_keras_vis.utils import find_layer class Gradcam(ModelVisualization): def _...
<reponame>Jahidul007/Python-Bootcamp import nltk import random from nltk.corpus import movie_reviews from nltk.classify.scikitlearn import SklearnClassifier from sklearn.linear_model import LogisticRegression,SGDClassifier from sklearn.svm import SVC, LinearSVC, NuSVC import pickle from sklearn.naive_bayes import Multi...
from __future__ import print_function, division __all__ = ['Particle'] from sympy import sympify from sympy.physics.vector import Point class Particle(object): """A particle. Particles have a non-zero mass and lack spatial extension; they take up no space. Values need to be supplied on initializat...
<filename>ompclib/ompclib_numpy.py # This file is a part of OMPC (http://ompc.juricap.com/) # # for testing: # import ompclib_numpy; reload(ompclib_numpy); from ompclib_numpy import * # TODO # - remove all references to array, use "ompc_base._init_data" instead import sys, os; sys.path.append(os.path.absp...
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.11.3 # kernelspec: # display_name: Python 3 # name: python3 # --- # + [markdown] id="view-in-github" colab_type="text" # <a href="https://colab...
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
<reponame>jonathanishhorowicz/RATE_python_package import numpy as np import pandas as pd import tensorflow as tf from sklearn.preprocessing import OneHotEncoder from sklearn.metrics import roc_curve, auc import matplotlib.pyplot as plt import seaborn as sns from scipy.stats import rankdata import time import logging l...
<reponame>NunoEdgarGFlowHub/cvxpy """ Copyright 2013 <NAME> This file is part of CVXPY. CVXPY is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later versio...
## Source : https://github.com/naokishibuya/car-behavioral-cloning/blob/master/utils.py import os import cv2 import sklearn import math import csv import numpy as np from scipy.ndimage import rotate from scipy.stats import bernoulli IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_CHANNELS = 66, 200, 3 INPUT_SHAPE = (IMAGE_HEIGHT,...
<reponame>DanAmador/BeamNGpy import sys from time import sleep import numpy as np from scipy import interpolate from beamngpy import BeamNGpy, Scenario, Road, Vehicle, setup_logging SIZE = 1024 def main(): setup_logging() beamng = BeamNGpy('localhost', 64256) bng = beamng.open(launch=True) sce...
<filename>top_pop_rec.py<gh_stars>1-10 import numpy as np import pandas as pd from tqdm import tqdm from definitions import ROOT_DIR from scipy import sparse as sps class TopPopRecommender(object): """ An unpersonalized top popular recommender. It recommends the top 500 tracks for each playlist. """ ...
""" Numerical tools """ from functools import partial import numpy as np from scipy.interpolate import splrep, splev import astropy.units as u __all__ = ['vectorize_where', 'vectorize_where_sum', 'burgess_tully_descale'] def vectorize_where(x_1, x_2): """ Find indices of one array in another Parameters ...
<reponame>bridgejio/2019_nCov_predcition<gh_stars>1-10 #!/usr/bin/env python # coding: utf-8 # ## Class Encapsulation for SEIR Model # In[1]: import pandas as pd import numpy as np import warnings import matplotlib.pyplot as plt warnings.filterwarnings('ignore') # ### hyperopt for seir model parameters optimizat...
<filename>examples/000_sphere/000_sphere_xfields3D.py import time import numpy as np from numpy.random import rand from scipy.constants import epsilon_0 from numpy import pi from xobjects import ContextCpu, ContextCupy, ContextPyopencl from xfields import TriLinearInterpolatedFieldMap context = ContextCpu() context ...
<reponame>Pandinosaurus/lapjv<gh_stars>100-1000 import unittest from numpy import array, dstack, float32, float64, linspace, meshgrid, random, sqrt from scipy.spatial.distance import cdist from lapjv import lapjv class LapjvTests(unittest.TestCase): def _test_random_100(self, dtype): random.seed(777) ...
<reponame>fmi-basel/gzenke-nonlinear-transient-amplification<filename>src/Fig_7_Spiking_neuron_networks_EE_STP_random_patterns.py import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sympy.solvers import solve from sympy import Symbol from matplotlib import patches import matplotlib.patches as ...
<reponame>ivandebono/montepython_public_3.2dev_Python3 """ .. module:: mcmc :synopsis: Monte Carlo procedure .. moduleauthor:: <NAME> <<EMAIL>> This module defines one key function, :func:`chain`, that handles the Markov chain. So far, the code uses only one chain, as no parallelization is done. The following rout...
# Kernel PCA toy example for k(x,y)=exp(-||x-y||^2/rbf_var) # Author: <NAME> import superimport import numpy as np import matplotlib.pyplot as plt import scipy.linalg as la from scipy.spatial.distance import pdist, cdist, squareform rbf_var = 0.1 xnum = 4 ynum = 2 max_ev = xnum*ynum x_test_num = 15 y_test_num = 15 c...
import sys import numpy as np import pandas as pd import scipy.stats from sktime.transformers.series_as_features.base import \ BaseSeriesAsFeaturesTransformer from sktime.transformers.series_as_features.dictionary_based import PAA from sktime.utils.data_container import tabularize # TO DO: verify this returned ...
<filename>liesym/algebras/_classic.py<gh_stars>1-10 from sympy.core.sympify import _sympify from sympy import Matrix, flatten from ._base import LieAlgebra, NumericSymbol def _euclidean_root(i, n): root = [0]*n root[i] = 1 try: root[i+1] = -1 except IndexError: pass # catches B last ...
<reponame>changhoonhahn/feasiBGS ''' validating the sky model ''' import os import pickle import numpy as np from scipy.interpolate import interp1d from speclite import filters # -- astropy -- import astropy.time import astropy.coordinates from astropy.io import fits from astropy import units as u from astropy.tabl...
<filename>malsynth/base.py import dataclasses import numbers import numpy as np from scipy import signal class PitchToHz: def __init__(self): self.two_pi = 2 * np.pi self._data = {} def __call__(self, pitch): """Technically doesn't return hz but instead hz * 2 * pi. Args: ...
<filename>ClusteringRelatedPosts/solution.py import scipy as sp from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer import nltk.stem stemmer = nltk.stem.SnowballStemmer('english') class StemmedCountVectorizer(CountVectorizer): def build_analyzer(self): analyzer = super(CountVect...
<filename>cylinder.py<gh_stars>0 import numpy as np import matplotlib.pyplot as plt import scipy.optimize import pdb import utilities.imaging.man as man import utilities.imaging.fitting as fit import scipy.ndimage as nd from utilities.plotting import scatter3d import utilities.plotting from utilities.imaging.analysis i...
import csv import pylab import numpy as np import uuid from numpy import vstack,array from scipy.cluster.vq import * from flask import Flask,render_template,request app = Flask(__name__,template_folder="static") coloumn_names = ["pclass","survived","name","sex","age","sibsp","parch","ticket","fare","cabin","embarked",...
import numbers import dolfin as fem import munch import numpy as np import sympy as sym from scipy import interpolate as intp import domain2 import mtnlion.comsol as comsol import mtnlion.engine as engine import utilities def prepare_comsol_buildup(): # cmn = Common(time) cmn = Common() domain = cmn.dom...
''' Generate a time series incorporating the motion of the screen across the source. This script may take a long time to run. I suggest you read through it first and adjust the num_samples variable to check out its performance. ''' import numpy as np from scipy.ndimage import imread import time import matplotlib.pyplot...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """A miscellaneous collection of basic functions.""" import sys import copy import os import warnings from collections.abc import Iterable from pathlib import Path import tempfile from scipy.interpolate import interp1d from scipy.stats import ncx2 import...
<filename>utils/misc.py import cPickle as pickle import numpy as np import networkx as nx import operator import sys import itertools from scipy.stats import pearsonr def run_it_uconn(wdir, script_txt, n, m, k, missing=None): # write it. script_file = '%s/script.sh' % wdir with open(script_file, "wb") as ...
<reponame>BystrickyK/SINDy<gh_stars>1-10 import pandas as pd import matplotlib.pyplot as plt from src.utils.identification.PI_Identifier import PI_Identifier from src.utils.solution_processing import * from differentiation.spectral_derivative import compute_spectral_derivative from filtering.SpectralFilter import Spect...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ CPU time comparison of resampling implementations. See Python corner of Chapter 9 (importance resampling) for more explanations. Notes: 1. this works only if numba is installed, see install notes. 2. Takes approx 1h 10min 3. If run on Pyth...
<filename>pyigm/continuum/quasar.py<gh_stars>10-100 """ Module for quasar continuum code """ from __future__ import print_function, absolute_import, division, unicode_literals import numpy as np import os import pdb from pkg_resources import resource_filename from scipy.interpolate import interp1d from astropy impo...
<gh_stars>0 # %% [markdown] # ## 0 | Import packages and load data # %% # Import packages import os import tkinter from tkinter.filedialog import askopenfilename, askopenfilenames, askdirectory import h5py from collections import defaultdict from nptdms import TdmsFile import numpy as np import pandas as pd import sea...
import numpy as n import scipy as s import matplotlib as m import sklearn as sk import pandas as p import tensorflow as t result = t.__version__ >= '1.3.1' and m.__version__ >= '2.0.2' and sk.__version__ >= '0.18.2' and p.__version__[1:] >= '0.20.3' and s.__version__ >= '0.19.1' and n.version.version >= '1.13.1' resu...
<gh_stars>10-100 import numpy as np import scipy.io as sio import matplotlib.pyplot as plt import time import skimage.io as io from skimage.segmentation import slic,mark_boundaries class SegmentMap(object): def __init__(self,datasetname:np.array): if datasetname=='indian_': ...
<filename>pysptools/spectro/hull_removal.py # #------------------------------------------------------------------------------ # Copyright (c) 2013-2014, <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...
<reponame>simonsobs/ps_py<filename>project/old/analyse_sims/sim_spectra_model.py<gh_stars>10-100 """ This script is used for the modeling the theoretical spectra that goes into the covariance computation. At the moment, we simply used interpolation and extrapolation of the signal only spectra, we hope to change this to...
<reponame>AkashKumarSingh11032001/Google-KickStart from sympy.core.cache import cacheit from sympy import binomial print(binomial(500, 2)) def fac(b): if b==1: return 1 else: return b * fac(b-1) def combinations(n,k): result = (fac(n)) / (fac(k) * fac(n-k)) return result print(50...
<filename>networkExperiments.py #!/usr/bin/env python # coding: utf-8 import numpy as np import numpy.linalg as lin import networkx as nx import scipy import matplotlib.pyplot as plt from scipy.stats import chi2_contingency # # Spectral norm from degree sequences # In this notebook we demonstrate experimently that ...
from time import sleep import numpy as np from scipy.fft import fft from scipy.integrate import simps NUM_SAMPLES = 1024 SAMPLING_RATE = 44100. MAX_FREQ = SAMPLING_RATE / 2 FREQ_SAMPLES = NUM_SAMPLES / 8 TIMESLICE = 100 # ms NUM_BINS = 16 data = {'values': None} try: import pyaudio def update_audio_data()...
<reponame>yamsam/G2Net-GoGoGo<gh_stars>1-10 import torch from torch import nn from scipy import signal import torch.nn.functional as F class GeM(nn.Module): ''' Code modified from the 2d code in https://amaarora.github.io/2020/08/30/gempool.html ''' def __init__(self, kernel_size=8, p=3, eps=1e-6...
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from numpy import testing as npt from ...tests.helper import pytest, assert_quantity_allclose as assert...
import sympy.physics.mechanics as me import sympy as sm import math as m import numpy as np x1, x2 = me.dynamicsymbols('x1 x2') f1 = x1*x2+3*x1**2 f2 = x1*me.dynamicsymbols._t+x2*me.dynamicsymbols._t**2 x, y = me.dynamicsymbols('x y') xd, yd = me.dynamicsymbols('x y', 1) yd2 = me.dynamicsymbols('y', 2) q1, q2, q3, u1,...
import numpy as np import scipy.sparse as sp import numba from numba import njit from ..base_transforms import SparseTransform from ..transform import Transform from ..sparse import add_selfloops, eliminate_selfloops @Transform.register() class NeighborSampler(SparseTransform): def __init__(self, max_degree: in...
# Copyright (c) 2019-2020, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
<reponame>Bmete7/bark # Copyright (c) 2020 fortiss GmbH # # Authors: <NAME>, <NAME>, <NAME> and # <NAME> # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. import unittest import numpy as np from scipy.special import fresnel from bark.core.world.open...
<reponame>dice-group/NETL-Automatic-Topic-Labelling- """ Author: <NAME> Date: October 2016 File: supervised_labels.py Updated by: <NAME> Date: January 7, 2019 Fix: Updated to work with Python 3.6.5 This python code gives the top supervised labels for that topic. The paramt...
""" Tools for DESI spectroperfectionism extractions implemented for a CPU """ import sys import numpy as np from numpy.polynomial.legendre import legvander, legval from numpy.polynomial import hermite_e as He import scipy.special import numba #------------------------------------------------------------------------- ...
<filename>torch_geometric_signed_directed/utils/signed/unhappy_ratio.py import torch import scipy.sparse as sp from ..general.scipy_sparse_to_torch_sparse import scipy_sparse_to_torch_sparse class Unhappy_Ratio(torch.nn.Module): r"""A calculation of the ratio of unhappy edges among all edges from the `SSSNET:...
<reponame>Corentin-LF/pyGPs<filename>pyGPs/GraphExtensions/graphKernels.py from __future__ import division from builtins import str from builtins import range from past.utils import old_div #================================================================================ # <NAME> [marion dot neumann at uni-bonn dot ...
''' Run this script to train the NN. Loads the problem and configuration according to examples/choose_problem.py. ''' import numpy as np import tensorflow as tf import scipy.io import time from utilities.other import int_input, load_NN from examples.choose_problem import system, problem, config, time_dependent if ti...
<reponame>dliu5812/PDAM import numexpr as ne from sklearn.metrics import f1_score import os import numpy as np from scipy.optimize import linear_sum_assignment # fast version of Aggregated Jaccrd Index def agg_jc_index(gt_ins, pred): from tqdm import tqdm_notebook """Calculate aggregated jaccard index for p...
import itertools import numpy as np import scipy import scipy.signal as signal __all__ = ['gaussian_kernel', 'blur_image', 'resample_array'] def gaussian_kernel(size, sigma, mesh_deltas=None): """ Returns a normalized gauss kernel array for convolutions. Parameters ---------- size : iterable ...
import logging import math import hashlib from functools import partial from inspect import getmembers from itertools import repeat import numpy as np import datajoint as dj import scipy.stats as sc_stats from . import lab from . import experiment from . import ephys [lab, experiment, ephys] # NOQA from . import ...
from ddapp.consoleapp import ConsoleApp from ddapp import robotsystem from ddapp import robotstate from ddapp import planplayback from ddapp import lcmUtils from ddapp import drcargs from ddapp import roboturdf from ddapp import simpletimer from ddapp.timercallback import TimerCallback from ddapp.fieldcontainer import ...
""" This code tests features in development. """ import mfanalysis as mf import os import numpy as np from scipy.io import loadmat #------------------------------------------------------------------------------- # Function to load data #------------------------------------------------------------------------------- ...
<reponame>aragilar/astroML """ Example of a Fourier Transform ------------------------------ Figure E.1 An example of approximating the continuous Fourier transform of a function using the fast Fourier transform. """ # Author: <NAME> # License: BSD # The figure produced by this code is published in the textbook # ...
<reponame>lev1khachatryan/ASDS_DSP # sampling rate = 16000 , points per second # 1) compute power of this wav # 2) create function which plots previously defined segment of data # 3) study signal data (print various segments of signal) # 4) write new wav with 2 times greater volume import numpy as np import scipy.io.w...
<filename>projects/dataprep/bg_ols_multiprocessing.py """ author: <NAME> 2019 - 07 - 29 Determine background overlaps using means and covariances for both background and stars. Covariance matrices for the background are Identity*bandwidth. Parameters ---------- background_means: [nstars,6] float array_like Phase-...
import decimal import math import numpy as np import pywt from scipy.io import wavfile def units_to_sample(x, unit, sr): unit = unit.lower() if unit == "ms": return ms_to_sample(x, sr) if unit == "s": in_ms = float(x) * 1000 return ms_to_sample(in_ms, sr) if unit == "sample":...
############################################################################### # Copyright (c) 2007-2018, National Research Foundation (Square Kilometre Array) # # Licensed under the BSD 3-Clause License (the "License"); you may not use # this file except in compliance with the License. You may obtain a copy # of the ...
import speechbrain as sb import os import torch import logging import numpy as np import speechbrain as sb from tqdm.contrib import tqdm from torch.utils.data import DataLoader from denoiser.losses import task1_metric import speechbrain.nnet.schedulers as schedulers from scipy.io import wavfile from pesq import pesq ...
<filename>scipy/linalg/_matfuncs_inv_ssq.py """ Matrix functions that use Pade approximation with inverse scaling and squaring. """ from __future__ import division, print_function, absolute_import import warnings import numpy as np from scipy.linalg._matfuncs_sqrtm import SqrtmError, _sqrtm_triu from scipy.linalg.d...
<gh_stars>0 import importlib from hydroDL.master import basins from hydroDL.app import waterQuality, wqLinear, wqRela from hydroDL import kPath from hydroDL.model import trainTS from hydroDL.data import gageII, usgs, gridMET, transform from hydroDL.post import axplot, figplot import torch import time import numpy as n...
<reponame>crocaos/OpenCV-4-with-Python-Blueprints-Second-Edition import cv2 import numpy as np from scipy.interpolate import UnivariateSpline def display_img(img): # Display image cv2.imshow('image', img) cv2.waitKey(0) cv2.destroyAllWindows() def resized(img_rgb, scale): scale_percent = scale ...
<filename>pycompvis/compvis/feature/detectors.py """ Feature detection (Szeliski 4.1.1) """ import numpy as np import scipy.signal as sig import scipy.ndimage as ndi from compvis.utils import get_patch def sum_sq_diff(img_0, img_1, u, x, y, x_len, y_len): """ Returns the summed square difference between two im...
<filename>discovery/pair_discovery.py # coding: utf-8 import outils import sys sys.path.append("..") from model.model import Model import torch import os from torchvision import datasets, transforms,models import numpy as np from tqdm import tqdm import ujson import cv2 import argparse import warnings import PIL.I...
<reponame>samuelcolvin/notbook from notbook import show_plot from bokeh.plotting import figure import numpy as np import scipy.optimize as opt """md _This is an example of a better way to work on and display numerical python code._ [Here's](https://github.com/samuelcolvin/notbook/blob/master/demo-script.py) the input...
<reponame>kidrabit/Data-Visualization-Lab-RND import sys import os import csv import math import json import random from datetime import datetime import numpy as np import pandas as pd import cv2 from scipy.spatial.distance import euclidean from fastdtw import fastdtw from collections import OrderedDict...
<gh_stars>1-10 import pandas as pd import numpy as np from scipy import stats from transformers import AutoModelWithLMHead, AutoTokenizer, AutoModelForMaskedLM, AutoModelForCausalLM, AutoModelWithLMAndDebiasHead import time import seaborn as sns import matplotlib.pyplot as plt import logging import argparse import torc...
""" ## Reference from: Multi-Stage Progressive Image Restoration ## Syed <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and <NAME> ## https://arxiv.org/abs/2102.02808 """ import numpy as np import os import argparse from tqdm import tqdm import torch import utils from model_arch.SRMNet_SWFF import SRM...
# Assignment 1 for ME4233 # Author: <NAME> # Prof: <NAME> import numpy as np import matplotlib.pyplot as plt from mpl_toolkits import mplot3d from itertools import product from scipy.sparse import dia_matrix, csr_matrix, csc_matrix, lil_matrix, identity, tril, triu # Main functions used def assemble_algebr...
# A manufacturer purchases a part for use at both of its plantsdashone at​ Roseville, California, the other at​ Akron, Ohio. # The part is available in limited quantities from two suppliers. # Each supplier has 85 units available. # The Roseville plant needs 50 ​units, and the Akron plant requires 85 units. # Th...
<filename>build/lib/mageck/mleem.py ''' Defining the core EM MLE approach ''' import re import sys import scipy from scipy.stats import nbinom from scipy.stats import norm import random import math import numpy as np import numpy.linalg as linalg import copy from mageck.mleclassdef import * from mageck.mledesignmat...
<reponame>verypluming/SyGNS # -*- coding: utf-8 -*- import pandas as pd from statistics import stdev import argparse import glob parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument("--outdir", nargs='?', type=str, help="output dir") parser.add_argument("-...
<gh_stars>0 import math import os from adjustText import adjust_text import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import ImageGrid import numpy as np from scipy.stats import linregress from process import DicomProcess case = 2 site = None # None for all except 1 dir_loc = './data/to_process/' test_...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import scipy from scipy.spatial.distance import cdist from .anchor_head_template import AnchorHeadTemplate class Self_Attn(nn.Module): """ Self attention Layer""" def __init__(self,in_dim,activation): super(Self_Attn...
#!/usr/bin/ python # -*- coding: utf-8 -*- """ Created on Sun Oct 2 18:33:10 2016 Modified from https://stackoverflow.com/questions/38076682/how-to-add-colors-to-each-individual-face-of-a-cylinder-using-matplotlib to add "end caps" and to undo fancy coloring. @author: astrokeat """ import numpy as np from matplotli...
<gh_stars>0 #!/usr/bin/env python """ LPU output visualization. """ import collections from collections import OrderedDict import itertools import os import h5py from future.utils import itervalues, iteritems import matplotlib from matplotlib import cm from matplotlib.colors import Normalize import matplotlib.pyplot...
# Authors: <NAME> (<EMAIL>), <NAME> (<EMAIL>), <NAME> (<EMAIL>) import os import yaml import logging import time import psutil import argparse import pandas as pd import numpy as np import multiprocessing as mp from scipy.integrate import solve_ivp from scipy.optimize import minimize from datetime import datetime, time...
<gh_stars>0 import numpy as np import scipy import GPyOpt import GPy from multi_objective import MultiObjective from multi_outputGP import multi_outputGP from maEI import maEI from parameter_distribution import ParameterDistribution from utility import Utility import cbo # --- Function to optimize m = 5 # Number of ...
<reponame>swederik/structurefunction<gh_stars>1-10 import os import os.path as op import nipype.interfaces.io as nio # Data i/o import nipype.interfaces.utility as util # utility import nipype.pipeline.engine as pe # pypeline engine import nipype.interfaces.fsl as fsl import nipype.interfaces.fre...
<filename>cryomem/cmtools/lib/sfs.py # -*- coding: utf-8 -*- """ SFS JJ data fitting etc. @author: burm """ #import pylab as pl import numpy as np from scipy.optimize import curve_fit, root from scipy.special import sici from scipy.integrate import quad e = 1.60217657e-19 hbar = 1.05457173e-34 kb = 1.3806488e-23 ...
# -*- coding: utf-8 -*- """ ======================================================= Math helper functions (:mod:`sknano.core._extras`) ======================================================= .. currentmodule:: sknano.core._extras """ from __future__ import absolute_import, division, print_function from __future__ imp...
<filename>gptf/core/models.py # -*- encoding: utf-8 -*- """Provides base classes for models of all kinds.""" from builtins import super, range from future.utils import with_metaclass from abc import ABCMeta, abstractmethod import numpy as np import tensorflow as tf from tensorflow.contrib.opt import ScipyOptimizerInte...
import pandas as pd from scipy.io import loadmat import os from python_speech_features import logfbank import matplotlib.pyplot as plt import numpy as np import librosa import librosa.display import pickle import math import glob import regex as rgx from pathlib import Path n_time_frames = 41 n_frequency_bands = 40 ...
def Halo_Plot(Data): ##### HALO ORBITS PLOTTING TOOL ##### # # Importing required functions # import numpy as np from scipy import linalg from scipy.integrate import solve_ivp from .intFun import ThreeBodyProp, DiffCorrection import matplotlib.pyplot as plt from mpl_toolkits.mplo...
from __future__ import print_function import numpy as np np.random.seed(1337) # for reproducibility import os import sys import multiprocessing from scipy import misc from keras.utils import np_utils from keras import backend as K from keras.preprocessing.image import ImageDataGenerator from skimage.filter import thre...
<reponame>TangYucopper/GCC import argparse import copy import random import warnings from collections import defaultdict import networkx as nx import numpy as np import scipy.sparse as sp import torch import torch.nn.functional as F from scipy import sparse as sp from sklearn.linear_model import LogisticRegression fro...
""" There are N workers.  The i-th worker has a quality[i] and a minimum wage expectation wage[i]. Now we want to hire exactly K workers to form a paid group.  When hiring a group of K workers, we must pay them according to the following rules: Every worker in the paid group should be paid in the ratio of their quali...
# -*- coding: utf-8 -*- u"""Integrate an ion and a magnetized electron forward in time, using the original phase space coordinates. The fast Larmor oscillations of the electron must be resolved. :copyright: Copyright (c) 2017 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-...
<gh_stars>10-100 from itertools import combinations import numpy as np import torch import torch.nn.functional as F from sklearn.metrics import roc_curve from scipy.interpolate import interp1d from scipy.optimize import brentq def eer(y_true, y_pred): fpr, tpr, thres = roc_curve(y_true, y_pred, pos_label = 1) ...
<filename>tensorbay/opendataset/Flower/loader.py #!/usr/bin/env python3 # # Copyright 2021 Graviti. Licensed under MIT License. # # pylint: disable=invalid-name # pylint: disable=missing-module-docstring import os from tensorbay.dataset import Data, Dataset from tensorbay.exception import ModuleImportError from tenso...
# -*- coding: utf-8 -*- import numpy as np import multiprocessing as mp from functools import partial from statistics import mode, StatisticsError from math import radians, sin, cos, sqrt, tan, atan2, floor, pi, degrees __all__ = ["make_point_cloud", "rel2abs", "project_point_cloud", "rotation_matrix", "point_cloud2...