text string |
|---|
""" Load VGGNet weights needed for the implementation in TensorFlow
of the paper A Neural Algorithm of Artistic Style (Gatys et al., 2016)
Created by <NAME> (<EMAIL>)
CS20: "TensorFlow for Deep Learning Research"
cs20.stanford.edu
For more details, please read the assignment handout:
"""
import numpy as np
import s... |
<reponame>Joshuaalbert/IonoTomo
# coding: utf-8
# In[1]:
import matplotlib
matplotlib.use('Agg')
import numpy as np
from scipy.cluster.vq import kmeans2
import pylab as plt
plt.style.use('ggplot')
import astropy.units as au
import os
import gpflow as gp
from heterogp.latent import Latent
from gpflow import set... |
<reponame>Whatsoever/SurfComp
# -*- coding: utf-8 -*-
"""
Created on Sun May 26 08:50:16 2019
@author: DaniJ
"""
import four_layer_model_2try_withFixSpeciesOption_Scaling as flm
import numpy as np
import scipy as sp
from matplotlib import pyplot as plt
def funky (T, X_guess, A, Z, log_k, idx_Aq,pos_psi0, pos_psialp... |
"""Moran's I global spatial autocorrelation."""
from typing import Union, Optional
from functools import singledispatch
from anndata import AnnData
import numpy as np
from scipy import sparse
from numba import njit, prange
from scanpy.get import _get_obs_rep
from scanpy.metrics._gearys_c import _resolve_vals, _check_... |
#!/usr/bin/env python3
import os, time, json
import numpy as np
import pandas as pd
from pprint import pprint
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib.colors import LogNorm
from scipy.integrate import quad
import tinydb as db
import argparse
from pyga... |
<reponame>thbom001/improver
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown copyright. The Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the... |
import os
import random
import numpy as np
import networkx as nx
from scipy.sparse import csr_matrix
from collections import Counter
from sklearn.metrics.pairwise import cosine_similarity
def determine_positive_and_negative_samples(graph, args):
if isinstance(graph, csr_matrix):
print ("graph is sparse adj m... |
import re
from collections import deque, Counter
from copy import deepcopy
from dataclasses import dataclass
from operator import add
from statistics import mean
from typing import List
@dataclass
class Particle(object):
id: int
pos: List[int]
vec: List[int]
acc: List[int]
@property
def dist(... |
from __future__ import division, print_function, absolute_import
import os
import time
import shutil
import numpy as np
import cv2 as cv
import glob
import scipy.io as sio
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.contrib.layers.python.layers import initializers
from Ops import O... |
<gh_stars>0
import numpy as np
import pandas as pd
import os
from scipy.stats import rankdata
LABELS = ["toxic", "severe_toxic", "obscene", "threat", "insult", "identity_hate"]
predict_list = []
predict_list.append(pd.read_csv("../input/textcnn-2d-convolution-on-preprocessed-data/submission.csv")[LABELS].values)
pre... |
<filename>lumos/optimal_control/collocation.py<gh_stars>1-10
from enum import auto, Enum
from typing import List
import numpy as np
from numpy.polynomial.legendre import Legendre
from numpy.polynomial.polynomial import Polynomial
from scipy.interpolate import lagrange
class CollocationEnum(Enum):
"""CollocationE... |
from datetime import datetime, date
import numpy
import pandas
import copy
import uuid
from past.builtins import basestring # pip install future
from pandas.io.formats.style import Styler
from functools import partial, reduce
from .offline import iplot, plot
from IPython.core.display import HTML, display
import... |
# Test out PWL waveform generator
import os
import sys
import re
import sympy as sym
import numpy as np
import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
from dave.common.empyinterface import EmpyInterface
from dave.mlingua.pwlbasisfunction import PWLBasisFunctionExpr
from dave.mlingua.pwlvecto... |
<reponame>MicrobialDarkMatter/GraphMB
import sys
import ast
import numpy as np
import scipy
# code to run evaluation based on lineage.ms file (Bacteria) and marker_gene_stats.txt file
# Get precicion
def getPrecision(mat, k, s, total):
sum_k = 0
for i in range(k):
max_s = 0
for j in range(s):
... |
<reponame>ML-PSE/Machine_Learning_for_PSE
##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
## train PLS model
## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#%% import required packages
import numpy as np
import pandas as pd... |
# why using t-dependent test?
# for example, the same group student attend a test before
# and after some training
# the key is `the same`
import numpy as np
from scipy import stats
def t_value_dependent(X, X_):
"""
D = X - X_
sum(D)
t = ---------------------------------------
... |
import cmath
from unittest import TestCase
from configparser import ConfigParser
from cross_section.ScalarMesonProductionTotalCrossSection import ScalarMesonProductionTotalCrossSection
from ua_model.KaonUAModel import KaonUAModel
class TestScalarMesonProductionTotalCrossSection(TestCase):
def test___call__(self... |
import matplotlib.pylab as plt
import numpy as np
import scipy.stats as stats
def plot_manhattan(gdl,
y=None,
y_label=None,
title=None,
output_fname=None,
snp_color='#d0d0d0',
snp_marker='o',
... |
# Copyright 2017 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 applicab... |
#!/usr/bin/env python3
from __future__ import division, print_function
import string, time
import sounddevice as sd
import numpy as np
from scipy import io
import scipy.io.wavfile
import morse
class Audio:
sps = 8000
letters = string.ascii_uppercase
freq = 750
wpm = 25
fs = 10
audio_padding = 0.5 # Sec... |
import numpy as np
import random
import matplotlib.pyplot as plt
import os
import pickle
import json
import sys
import time
import seaborn as sns
from scipy import stats
sys.path.append("..")
from utils import core_gene_utils, diversity_utils, HGT_utils
import config
'''
Need to know the cutoffs for same clade snp... |
<reponame>FabianKP/cgn<gh_stars>1-10
"""
Test CGN for an equality-constrained nonlinear least-squares problem.
Based on tests (29) in More, Garbow and Hillstrom "Testing Unconstrained Optimization Software"
"""
import numpy as np
import scipy.optimize as sciopt
import cgn
from tests.acceptance.problem import TestProb... |
import random
import torch
import numpy as np
import scipy
import pygsp
import graph_utils
import graph_construction
import normalization
import matplotlib.pyplot as plt
def nearest_mean_classifier(train_set, train_labels, test_set, test_labels):
# Compute the means of the feature vectors of the same classes
n... |
# Credit: https://github.com/MightyChaos/LKVOLearner/blob/master/src/KITTIdataset.py
from torch.utils.data import Dataset, DataLoader
import numpy as np
import scipy.io as sio
from PIL import Image
import os
class KITTIdataset(Dataset):
"""KITTIdataset"""
def __init__(self, list_file='train.txt', data_root_pa... |
<reponame>sheim/vibly_LFS
import numpy as np
import scipy.integrate as integrate
import models.slip as slip
def feasible(x, p):
'''
check if state is at all feasible (body/foot underground)
returns a boolean
'''
if x[5] < x[-1] or x[1] < x[-1]:
return False
return True
def poincare_m... |
<filename>torchlab/evaluation/evaluators.py
"""
The MIT License (MIT)
Copyright (c) 2019 <NAME>
"""
from __future__ import absolute_import, division, print_function
import logging
import os
import sys
import time
from ast import literal_eval
from functools import partial
import matplotlib
import matplotlib.pyplot a... |
<filename>lighting.py
#!/usr/bin/env python
# encoding: utf-8
"""
Author(s): <NAME>
See LICENCE.txt for licensing and contact information.
"""
__all__ = ['LambertianPointLight', 'SphericalHarmonics']
import os, sys, logging
import numpy as np
import scipy.sparse as sp
import scipy
from chumpy.utils import row, col... |
import numpy as np
import scipy.stats as sct
import time
import itertools
import sys
#----- normal distribution
def normal_model_log_prob(_x, _theta):
#-- parameters
_mu = _theta[0]
_sigma_sq = _theta[1]
#-- log probability
_p = -(_x - _mu) ** 2 / (2 * _sigma_sq) - np.log(2 * np.pi * _sigma_sq) / ... |
<reponame>Argenis616/cryptography
import random
from sympy import Matrix
from numpy.linalg import inv,det
import numpy as np
import math
class CryptographyException(Exception):
def __init__(self):
self.message = "Invalid key"
def __str__(self):
return self.message
def creaLlave(alphabet,n,lo... |
<filename>cbir/vggnet.py
# pylint: disable=invalid-name,missing-docstring,exec-used,too-many-arguments,too-few-public-methods,no-self-use
from __future__ import print_function
import numpy as np
import scipy.misc
import torch
import torch.nn as nn
from torchvision.models.vgg import VGG
from cbir.DB import Database
... |
import numpy as np
import pandas as pd
import warnings
warnings.filterwarnings('ignore')
from scipy.stats import kurtosis
from sklearn.svm import LinearSVC
from sklearn.feature_selection import SelectFromModel, VarianceThreshold, SelectKBest
from sklearn.preprocessing import StandardScaler, RobustScaler, QuantileTra... |
<reponame>atom-sun/countpigs<filename>src/python/countpigs/recursion.py
from .util import memoize
from numpy import array
from scipy.special import comb
@memoize
def binomial(n, k):
# return comb(n, k, exact=True) # long integer fail when n >= 15
return comb(n, k)
@memoize
def f(m, q, k):
... |
""" CS4277/CS5477 Lab 2: Camera Calibration.
See accompanying Jupyter notebook (lab2.ipynb) for instructions.
Name: <NAME>
Email: <EMAIL>
Student ID: A0215003A
"""
import cv2
import numpy as np
from scipy.optimize import least_squares
"""Helper functions: You should not have to touch the following functions.
"""
... |
<reponame>Abas-Khan/thesis
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 <NAME> <<EMAIL>>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for similarity algorithms (the similarities package).
"""
import logging
import unittest
import os
import nu... |
<reponame>NathanJustus/ROB599_Project
#!/usr/bin/env python
# Node to turn joint data into pose data using the connection field
# Also provides service to load connection data from matlab file
# Import the good stuff
import rospy
import sys
import tf
import rospkg
import scipy.io as sio
import numpy as np
from math i... |
import numpy as np
from scipy.special import gammaln
def logfactorial(n):
return gammaln(n + 1)
def regularized_log(vector):
"""
A function which is log(vector) where vector > 0, and zero otherwise.
:param vector:
:return:
"""
out = np.zeros_like(vector)
idx = vector > 0
out[id... |
<filename>fused_lasso/gen_data.py<gh_stars>0
import numpy as np
from scipy.stats import skewnorm
def generate(n, p, beta_vec):
X = []
y = []
for i in range(n):
X.append([])
yi = 0
for j in range(p):
xij = np.random.normal(0, 1)
X[i].append(xij)... |
import numpy as np
import scipy.special as sc
import warnings
from sampy.distributions import Discrete
from sampy.interval import Interval
from sampy.utils import check_array, cache_property
from sampy.math import logn, _handle_zeros_in_scale
class Binomial(Discrete):
def __init__(self, n_trials=1, bias=0.5, see... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
from sympy.physics.unitsystems.prefixes import PREFIXES, prefix_unit
def test_prefix_operations():
m = PREFIXES['m']
k = PREFIXES['k']
M = PREFIXES['M']
assert m * k == 1
assert k * k == M
assert 1 / m == k
assert k / m == M
def test_prefix_unit()... |
<filename>density_functional_approximation_dm21/density_functional_approximation_dm21/compute_hfx_density_test.py<gh_stars>1-10
# Copyright 2021 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 20 10:34:06 2018
@author: chrelli
#TODO:
automatically check how many camera files were present
"""
#%% Import the nescessary stuff
# basic OS stuff
import time, os, sys, shutil
# for math and plotting
import pandas as pd
import numpy as np
imp... |
#!/usr/bin/env python3
"""
logistic regression
"""
import numpy as np
from loguru import logger
from scipy.optimize import minimize
from sklearn.utils.extmath import safe_sparse_dot
from scipy.special import logsumexp
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import LabelEncoder, LabelBinar... |
import cv2
import random
import numpy as np
from scipy.stats import pearsonr, spearmanr, kendalltau, zscore
from dnnbrain.dnn.core import Mask
def get_frame_time_info(vid_file, original_onset, interval=1, before_vid=0, after_vid=0):
"""
Extract frames of interest from a video with their onsets and durations,... |
<filename>quantdsl/priceprocess/blackscholes.py
from __future__ import division
import datetime
from collections import defaultdict
import numpy
import numpy as np
import scipy
import scipy.linalg
from dateutil.relativedelta import relativedelta
from scipy.linalg import LinAlgError
from quantdsl.exceptions import Ds... |
<reponame>SirJamie/sgm3d
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from . import box_utils
from ..ops.iou3d_nms.iou3d_nms_utils import boxes_iou3d_gpu_differentiable
class SigmoidFocalClassificationLoss(nn.Module):
"""
Sigmoid focal cross entropy loss.
... |
<filename>pc_toolbox/model_slda/slda_loss__cython.py
"""
slda_loss__cython.py
Provides functions for computing loss function for PC sLDA objective.
Uses fast Cython-ized implementation of the local (per-document) step.
Does NOT compute gradients (not autodiff-able), so cannot be used for training.
"""
import numpy a... |
<gh_stars>10-100
#!/usr/bin/env python3
"""
This module provides utility classes for io operations.
"""
# adapted from original version in pymatgen version from pymatgen
import re
import os
import time
import errno
import numpy as np
from csld.util.string_utils import str2arr
import subprocess
def load_scmatrix(scm... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import fft
import cv2
import imutils
import math
cap = cv2.VideoCapture('Tag1.mp4')
#cap = cv2.VideoCapture('Tag0.mp4')
#cap = cv2.VideoCapture('Tag2.mp4')
out = cv2.VideoWriter('Testudo.avi',cv2.VideoWriter_fourcc(*'XVID'), 30, (400,300))
# FFT to subra... |
"""
'power.py' module serves mainly for interacting with C++ library fastsim.py
- translate all power spectra, growth functions, correlations functions, etc.
into C++ functions for speed
- handles numpy arrays
- cosmo == C++ class Cosmo_Param, accessible through SimInfo.sim.cosmo
- FTYPE_t=[float, double, long... |
# -*- coding: utf-8 -*-
"""
This module contains classes for sub-selecting features or samples from given
datasets using the CUR decomposition method. Each class supports a Principal
Covariates Regression (PCov)-inspired variant, using a mixing parameter and
target values to bias the selections.
Authors: <NAME>
... |
"""Scarf instance input/output."""
import numpy as np
import json
import pickle
from scipy import io as sio
import scarf.instance
__all__ = ["save_json", "load_json", "save_mat", "load_excel",
"save_pickle", "load_pickle"]
def save_json(ins, filename):
"""Save ScarfInstance to json format.
Args:
... |
# This code is an alternative implementation of the paper by
# <NAME>, <NAME>, and <NAME>. "Age Progression/Regression by Conditional Adversarial Autoencoder."
# IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
#
# Date: Mar. 24th, 2017
#
# Please cite above paper if you use this code
#
fro... |
<reponame>malhotrajayant/topsis
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 25 23:56:52 2020
@author: <NAME>
count_row = df.shape[0] # gives number of row count
count_col = df.shape[1] # gives number of col count
"""
# topsis.py data.csv "0.25,0.25,0.25,0.25" "-,+,+,+"
import math
import pandas as... |
<gh_stars>10-100
import h5py
import os
import numpy as np
from tqdm import tqdm
import torchvision
import scipy.io
root = '/mnt/datasets/inshop'
####
with open(
os.path.join(
root, 'Eval/list_eval_partition.txt'
), 'r'
) as f:
lines = f.readlines()
# store for using later '__getitem__'
nb_sampl... |
<reponame>MaiRajborirug/scikit-learn
"""Test truncated SVD transformer."""
import numpy as np
import scipy.sparse as sp
import pytest
from sklearn.decomposition import TruncatedSVD, PCA
from sklearn.utils import check_random_state
from sklearn.utils._testing import assert_array_less, assert_allclose
SVD_SOLVERS = [... |
<gh_stars>0
import numpy as np
from forward import Prediction
from tqdm import tqdm
import matplotlib.pyplot as plt
import os
import scipy
from matplotlib import ticker,cm
from latent import latent_c
class inference(object):
def __init__(self,step,burn_in,dim,obs,sigma,true_permeability,true_pressure,obs_position... |
"""
Implementation of IODINE from
"Multi-Object Representation Learning with Iterative Variational Inference"
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
<NAME>, <NAME>, <NAME>, <NAME>
https://arxiv.org/abs/1903.00450
This (re)-implemetation is draws from re-implementations of
https://github.com/zhixuan-lin/IODINE
https... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2020 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... |
<gh_stars>0
from skimage import measure
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
__author__ = '<NAME>'
__all__ = ['mask2polygon', 'plot_img_polygons_overlay', 'dice_score', 'iou_score',
'plot_scores_histogram', 'plot_scores_qq', 'plot_scores_violin', 'plot_img_masks_overlay... |
<reponame>ito-takuya/sr_enn
# <NAME>
# 2/22/2019
# General function modules for SRActFlow
# For group-level/cross-subject analyses
import numpy as np
import os
import multiprocessing as mp
import scipy.stats as stats
import nibabel as nib
import os
os.environ['OMP_NUM_THREADS'] = str(1)
import statsmodels.api as sm
im... |
<filename>meson_benchmark.py<gh_stars>0
#!/usr/bin/env python3
# Copyright 2015 The Meson 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/license... |
<reponame>lwiklendt/lsw<gh_stars>0
import numpy as np
from numba import njit
from .signal import find_extrema
@njit
def mesaclip(x, y, k):
"""
Clips the peaks of y to plateaus of minimum distance k, where the distance between i and j is x[j] - x[i].
:param x: non-decreasing input array specifying the x p... |
<reponame>tsmonteiro/fmri_proc<filename>util/orthogonalize_regressors.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 18 12:05:42 2020
Creates and orthogonalizes regressors prior to 3dREMLfit
@author: u0101486
"""
import numpy as np
import os
from sklearn.linear_model import TheilSenRegr... |
<filename>03_simulacion/casos_codigo/clase06_fit_distribucion_lugones/utils/distribution_plot.py<gh_stars>1-10
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import math
import numpy as np
np.random.seed(3)
mu = 0.0
var = 1.0
sigma = math.sqrt(var)
x = np.linspace(mu - 3*sigma, mu + 3... |
<filename>src/speechpy/feature.py
"""feature module.
This module provides functions for calculating the main speech
features that the package is aimed to extract as well as the required
elements.
Functions:
filterbanks: Compute the Mel-filterbanks
The filterbanks must be created for extracting
... |
import matplotlib.pyplot as plt
import scipy.stats as ss
import pandas as pd
import numpy as np
from matplotlib.ticker import MaxNLocator
def plot_individual_specific_effects(with_parameters=None):
fig, ax = plt.subplots()
x = np.linspace(-5, 5, 5000)
pdf = ss.norm.pdf(x, 0, 1)
ax.plot(x, pdf)
... |
from tkinter import *
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
def three_sampling_dis():
"""
三大抽样分布与标准正态分布
:return:
"""
nor_dis = stats.norm()
chi2_dis = stats.chi2(df=app.df1)
t_dis = stats.t(df=app.df2)
f_dis = stats.f(dfn=app.df3, dfd=app.df4)
... |
import math
import warnings
from fractions import Fraction
from typing import List, Tuple
import torch
from .._internally_replaced_utils import _get_extension_path
try:
lib_path = _get_extension_path("video_reader")
torch.ops.load_library(lib_path)
_HAS_VIDEO_OPT = True
except (ImportError, OSError):
... |
<gh_stars>0
# coding: utf-8
from __future__ import division
from math import sqrt, atan2, pi as PI
import itertools
from warnings import warn
import numpy as np
from scipy import ndimage as ndi
from ._label import label
from . import _moments
from functools import wraps
__all__ = ['regionprops', 'perimeter']
XY_T... |
<gh_stars>0
"""Batched versions of commin math operations."""
import numpy as np
from scipy.linalg import solve_triangular
def batched_inv_spd(a_chol: np.ndarray) -> np.ndarray:
"""Computes inverse of a batch of s.p.d. matrices from their cholesky decomposition.
Exploits s.p.d.-ness for faster invers... |
from sympy import cos, expand, Matrix, sin, symbols, tan
from sympy.physics.mechanics import (dynamicsymbols, ReferenceFrame, Point,
RigidBody, Kane, inertia, Particle)
def test_one_dof():
# This is for a 1 dof spring-mass-damper case.
# It is described in more detail in th... |
<gh_stars>1000+
#!/usr/bin/python
#
# Copyright 2018 Google 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/licenses/LICENSE-2.0
#
# Unless required by appl... |
# Copyright 2018 The TensorFlow Probability 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 applicable law o... |
<reponame>JoseChulani/PyFDTD
import numpy as np
import math
import scipy.constants
import time
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# ==== Preamble ===============================================================
c0 = scipy.constants.speed_of_light
mu0 = scipy.constants.mu_0
eps0 ... |
<reponame>Mishrasubha/napari
import numpy as np
import numpy.testing as npt
import pytest
from scipy.stats import special_ortho_group
from napari.utils.transforms import Affine, CompositeAffine, ScaleTranslate
transform_types = [Affine, CompositeAffine, ScaleTranslate]
@pytest.mark.parametrize('Transform', transfor... |
<gh_stars>1-10
# STUMPY
# Copyright 2019 TD Ameritrade. Released under the terms of the 3-Clause BSD license. # noqa: E501
# STUMPY is a trademark of TD Ameritrade IP Company, Inc. All rights reserved.
import numpy as np
import scipy.signal
try:
from numba.cuda.cudadrv.driver import _raise_driver_not_found
excep... |
from typing import Iterable, Union
import numpy as np
from scipy.linalg import block_diag, eigh
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.utils.validation import check_is_fitted
from cca_zoo.models import rCCA
from cca_zoo.utils.check_values import _process_parameter, _check_views
class MCC... |
"""
Loss Functions
Author: <NAME>
Loss functions to use for training. Some are adapted from Lar's Blog,
https://lars76.github.io/neural-networks/object-detection/losses-for-segmentation/
"""
from tensorflow.keras.losses import binary_crossentropy
import tensorflow.keras.backend as K
import tensorflow as tf
import num... |
############################################
# Copyright (c) 2012 Microsoft Corporation
#
# Z3 Python interface
#
# Author: <NAME> (leonardo)
############################################
"""Z3 is a high performance theorem prover developed at Microsoft Research. Z3 is used in many applications such as: software/hardwa... |
<reponame>trex47/MD-copy
from __future__ import division
from __future__ import print_function
import numpy as np
from scipy.linalg import expm
class RealTime(object):
"""Class for real-time routines"""
def __init__(self,mol,numsteps=1000,stepsize=0.1,field=0.0001,pulse=None):
self.mol = mol
se... |
<reponame>TalSchuster/CrossLingualELMo
import argparse
import numpy as np
import copy
import torch
from scipy.spatial.distance import cosine
from scipy.spatial import KDTree
from allennlp.commands.elmo import ElmoEmbedder
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
pa... |
# Copyright 2015 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... |
import time
import numpy as np
import pandas as pd
import pymap3d as pm
from geographiclib.geodesic import Geodesic
from scipy import stats
import junkdataretention
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
def point_on_line(a, b, p):
""" Returns coordinate of the point p whi... |
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import matplotlib.cm as cm
import numpy as np
from scipy import interpolate
from scipy.stats import multivariate_normal, gaussian_kde
from scipy.special import logsumexp
from sklearn import mixture
import time
import sys
from pydrake.solvers.ipopt im... |
<gh_stars>1-10
# Copyright 2019 Google LLC
# Modified 2020 by authors of BOSS paper
#
# 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
#
# Unl... |
<reponame>neutrinoceros/AMICAL
import glob
import logging
import matplotlib.pyplot as plt
import numpy as np
import scipy
from scipy.io.idl import readsav
from termcolor import cprint
from . import oifits
from .cp_tools import project_cps
# import pymask.oifits
"""---------------------------------------------------... |
import numpy as np
from denoising.utils import *
from scipy.signal import wiener
from denoising import _batch_algorithm_implementation
from tqdm import tqdm
def wiener_filter(noisy_images: np.ndarray, noise_std_dev: float, show_progress:bool = False) -> np.ndarray:
"""
Params:
noisy_images: receive noisy_i... |
<gh_stars>0
from vpython import *
import numpy as np
# from scipy.spatial.transform import Rotation as R
import math
import sys
from sympy import symbols, solve, Eq, Function
import quaternion as quat
import time
class Cell:
def __init__(self,Module_num, Spr_distance, Spr_len, **kwargs):
sel... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Simulates coupled Wendling neural mass models with and without periodic stimuli to main EXC cells,
changing parameters (EXC/A, SDI/B or coupling gain/K) to bring population activity towards the ictal state.
Features are extracted throughout each simulation - trends in t... |
# -*- coding: utf-8 -*-
__all__ = ["TransitModel", "setup_fit"]
import numpy as np
from scipy.stats import beta
import matplotlib.pyplot as pl
from scipy.optimize import minimize
import george
from george import kernels
import transit
from .catalogs import KOICatalog
from .data import load_light_curves_for_kic
c... |
from itertools import groupby
from operator import itemgetter
import numpy as np
import scipy as sp
import scipy.sparse
def to_sparse(ratings, shape=None):
_1, _2, _3 = itemgetter(0), itemgetter(1), itemgetter(2)
data = map(_3, ratings)
i = map(_1, ratings)
j = map(_2, ratings)
return sp.sparse.co... |
<gh_stars>1-10
"""Functions to plot raw M/EEG data."""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: Simplified BSD
import copy
from functools import partial
import numpy as np
from ..annotations import _annotations_starts_stops
from ..filter import create_filter, _overlap_add_filter
from ..i... |
<reponame>lsst/TS_wep
import numpy as np
import scipy as sci
from padArray import padArray
def opd2psf(opd,imagedelta,sensorFactor,fno,wavelength):
"""OPD
wavefront OPD in wave
imagedelta in micron
wavelength in meter
"""
m, n = opd.shape
if (m != n):
print 'warning: opd is not a ... |
<gh_stars>100-1000
import abc
import logging
import re
import time
from collections import defaultdict
import numpy as np
import pandas as pd
from diamond.solvers.repeated_block_diag import RepeatedBlockDiagonal
from scipy import sparse
from future.utils import iteritems
LOGGER = logging.getLogger(__name__)
LOGGER.set... |
# -*- coding: utf-8 -*-
"""Scheme for numerical modelling of TAP diffusion."""
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__status__ = 'Operational'
import numpy as np
from scipy.integrate import odeint
def knudsen_diffusion_coeff(temp, ref_coeff, mass=40.0, **kwargs):
"""Knudsen diffusion coefficient"""
... |
<reponame>themantalope/MONAI
# Copyright 2020 - 2021 MONAI Consortium
# 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 appli... |
"""
*
* Copyright (c) 2021 <NAME>
* 2021 Autonomous Systems Lab ETH Zurich
* 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 ... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
#
# Copyright (C) 2019 <NAME>
# University of Siena - Artificial Intelligence Laboratory - SAILab
#
# Inspired by the work of <NAME> (C) 2017: https://github.com/dj-on-github/sp800_22_tests
#
# NistRng is licensed under a BSD 3-Clause.
#
# You should have received a copy of the license along with this
# work. If not, s... |
<filename>tools/test_icp.py<gh_stars>0
#!/usr/bin/env python
# --------------------------------------------------------
# FCN
# Copyright (c) 2016 RSE at UW
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
"""Test a FCN on an ima... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.