text string |
|---|
<gh_stars>0
#Copyright (c) 2018-2020 <NAME>
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, d... |
### BEGIN PYTHON CODE ###
import cmath
import numpy
import math
# <NAME>'s HW2 Code
### Exercise A ###
def rect(r, phi):
return r * (math.cos(phi) + math.sin(phi)*1j)
### Exercise B ###
def directSum(A, B):
width = len(A[0]) + len(B[0])
height = len(A) + len(B)
C = numpy.zeros((height, width), dtype=... |
<filename>infrapy/performance/network.py
# infrapy.performance.network.py
#
# Methods to estimate network performance using
# the various propagation models included in the
# infrapy toolkit.
#
# Author <NAME> (<EMAIL>)
import sys
import datetime
import time
import itertools
import random
import copyreg
im... |
from sympy import (symbols, pi, Piecewise, sin, cos, sinc, Rational,
oo, fourier_series, Add)
from sympy.series.fourier import FourierSeries
from sympy.utilities.pytest import raises
x, y, z = symbols('x y z')
fo = fourier_series(x, (x, -pi, pi))
fe = fourier_series(x**2, (-pi, pi))
fp = fourier_se... |
#!/usr/bin/env python
"""
Copyright (c) 2015 <NAME> <<EMAIL>>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHO... |
'''
This file loads in data from /data/interim/interim_data.hdf and then
applies a sinusoidal regression model to the temperature data to remove
the yearly predictable variation.
NOTE: This file is intended to be executed by make from the top
level of the project directory hierarchy. We rely on os.getcwd()
and it wil... |
<gh_stars>0
from encdec.EncDec import build_AE,build_decoder,build_encoder,build_discriminator,build_GAN
from plotload.PlotLoad import plot_1_to_255, load_polyp_data
import sys,os
import numpy as np
import matplotlib.pyplot as plt
import cv2
from scipy import stats
from keras.optimizers import Adam
from tqdm import tqd... |
import math
import numpy as np
import torch
import wandb
from botorch.posteriors import Posterior
from scipy.stats import spearmanr
from torch import optim as optim, nn as nn
from torch.utils.data import DataLoader
import lambo.utils
from lambo import dataset as dataset_util
from lambo.models.base_surrogate import Ba... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# Face parsing network proposed by Lin et al. 19,
# https://arxiv.org/abs/1906.01342,
# transfered to tensorflow version.
import tensorflow as tf
from scipy.io import loadmat
import cv2
import os
import numpy as np
def transfer_68to5(points):
... |
<filename>pgmpy/factors/continuous/LinearGaussianCPD.py
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from scipy.stats import multivariate_normal
from pgmpy.factors.continuous import ContinuousFactor
from pgmpy.factors.distributions import CanonicalDistribution
class LinearGaussianCPD(ContinuousFact... |
<filename>dsp_fpga/06_FIL/plots/FIL-phase_sin.py
# -*- coding: utf-8 -*-
"""
=== FIL-phase_sin.py ====================================================
Plots zum Kapitel "FIL":
Darstellung der Phase eines Sinussignals in Abhängigkeit der Verzögerung
(c) 2016 <NAME> - Files zur Vorlesung "DSV auf FPGAs"
==... |
import sys
sys.path.append("..")
from builtins import range
import os
import numpy as np
import scipy
from scipy import signal
from config import config as cfg
RANDOM = cfg['RANDOM']
CACHE = {}
def openAudioFile(path, sample_rate=48000, offset=0.0, duration=None):
import librosa
# Open file with libr... |
<reponame>miroenev/cuml
# Copyright (c) 2020-2021, 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 b... |
<filename>mk_config/mk_bathy.py
import numpy as np
import MITgcmutils as mit
import matplotlib.pyplot as plt
import xarray as xr
from scipy.interpolate import griddata
print("-- Make the bathymetry --")
#-- directories --
dir_grd = '/glade/p/univ/ufsu0011/initial_data/grid/'
dir_grd50 = '/glade/p/univ/ufsu0011/runs... |
import numpy as np
from gym import spaces
from scipy import stats
from cognibench.distr import DiscreteRV
from cognibench.models import CNBAgent
from cognibench.models.policy_model import PolicyModel
from cognibench.capabilities import Interactive, PredictsLogpdf
from cognibench.capabilities import (
ProducesPolic... |
<gh_stars>0
import os
import math
import numpy as np
import pandas as pd
import seaborn as sns
import scipy.stats as ss
import pickle5 as pickle
import matplotlib.pyplot as plt
def locate_index(value,bin_min,step_size,num_bins):
loc0 = (value-bin_min)/step_size
if loc0 < 0:
loc = 0
elif loc0 >= num_bins:
... |
<reponame>luisfciencias/pyprobml
# Nonlinear regression using MLE with fixed variance or input-dependent variance.
# We share the backbone and have two output heads for mu and sigma.
# When sigma is fixed, it is larger than necessary in some places,
# to compensate for growing noise in the input data.
# Adapted from
# ... |
<gh_stars>0
import math
import scipy.stats
from .ConfianceIntervalBase import ConfianceIntervalBase
class ProportionOptimist(ConfianceIntervalBase):
def __init__(self, proportion):
"""creates a new instance of the ProportionOptimist confiance interval.
Arguments:
proportion {float} -- t... |
#!/usr/bin/env python
# This code requires:
# 1. raster_mask, available:
# https://github.com/jgomezdans/geogg122-1/blob/master/Chapter6_Practical/python/raster_mask.py
# 2. smoothn, available:
# http://www2.geog.ucl.ac.uk/~plewis/geogg122/Chapter5_Interpolation/python/smoothn.py
# and ensure they are in the same di... |
import numpy as np
from scipy.stats import poisson
#lr1,lr2 = [int(x) for x in input().strip().split()]
#lrr1,lrr2 = [int(x) for x in input().strip().split()]
#reward = [10,-2]
gamma = 0.9
V = np.zeros([20+1,20+1])
pie = np.zeros([20+1,20+1])
class samples:
def __init__(self,l1,l2,ep = 0.01):
... |
<reponame>anovak10/plots<filename>Distribution_Header.py
# Dist def
import os
import math
from array import array
import optparse
import ROOT
from ROOT import *
import scipy
import Plotting_Header
from Plotting_Header import *
class DIST:
def __init__(self, name, File, Tree, weight, color):
self.name = name
self... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
#!/usr/bin/env python3
# coding: utf-8
# author: <NAME> <<EMAIL>>
import types
import numpy as np
from scipy.stats import f
from sklearn.utils import check_X_y, safe_sqr
from sklearn.base import clone
def f_classif(X, y):
# TODO Ancora non ci siamo con la memoria (soprattutto le comprehension)
groups, mask, ... |
<filename>src/classifiers/logistic_regression_scratch.py
import pandas as pd
import numpy as np
from scipy import sparse
from scipy.sparse import hstack
from .define_features import define_features_vectorizer
from .define_features import define_features_tfidf
from sklearn.linear_model import LogisticRegression
class... |
from scipy.spatial import distance
def affinity(ag,ab,algo="euclidean"):
if (algo=="euclidean"):
return distance.euclidean(ag.get_properties_as_list()[1:],ab.get_properties_as_list()[1:])
elif (algo=="cosine"):
return distance.cosine(ag.get_properties_as_list()[1:],ab.get_properties_as_list()[1... |
<reponame>RTHMaK/git-squash-master<gh_stars>1-10
"""
===================================================
Segmenting the picture of a raccoon face in regions
===================================================
This example uses :ref:`spectral_clustering` on a graph created from
voxel-to-voxel difference on an image to ... |
import numpy as np
import pylab as plt
from scipy.special import erf
from scipy.integrate import simps
from scipy.linalg import cho_solve
#from ChoSolver import choSolve, choBackSubstitution
def styblinsky(x):
return (x[0]**4 - 16*x[0]**2 + 5*x[0] + x[1]**4 - 16*x[1]**2 + 5*x[1])/2.
def rosenbrock(x):
... |
<reponame>globusgenomics/galaxy
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from numpy.testing import TestCase, assert_array_almost_equal, \
assert_array_equal, assert_raises, assert_equal, assert_, \
run_module_suite
from scipy.signal import tf... |
"""
Pipeline to analyze allesfitter output for planet transit timings
argument 1: allesfitter path
argument 2: p-value threshold
argument 3: Boolean to select to plot wout/with TESS or wout/with/only TESS
<NAME>
MIT Kavli Institute, Cambridge, MA, 02109, US
<EMAIL>
www.tansudaylan.com
"""
import numpy as np
import s... |
''' Use this file to hand register multiple depth cameras with the 3D visualizer
Procedure:
1) Modify the scrip below for your files
2) After adding points, click the mayavi button in the window and add Transformation to the scene. Drag the second points to the transformation.
3) Manually match the two scenes
4) Click... |
<filename>schicexplorer/scHicCluster.py
import argparse
import os
from multiprocessing import Process, Queue
import time
import logging
log = logging.getLogger(__name__)
from scipy import linalg
import cooler
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.cm import get_cmap
fr... |
import numpy as np
import logging
import unittest
import os
import scipy.linalg as LA
import time
from sklearn.utils import safe_sqr, check_array
from scipy import stats
from pysnptools.snpreader import Bed,Pheno
from pysnptools.snpreader import SnpData,SnpReader
from pysnptools.kernelreader import KernelNp... |
import pyaudio
import wave
import sys
import sounddevice as sd
from scipy.io.wavfile import write
from playsound import playsound
def play_audio(filename):
print('Escuchando ......')
playsound(filename)
def record_v1(seconds, filename):
fs = 44100 # Sample rate
myrecording = sd.rec(int(s... |
from cvxpy import Variable, Parameter, Minimize, Problem, OSQP, quad_form
import numpy as np
import scipy as sp
import scipy.sparse as sparse
import time
if __name__ == "__main__":
# Discrete time model of a quadcopter
Ts = 0.2
M = 2.0
Ad = sparse.csc_matrix([
[1.0, Ts],
[0, 1.0]
... |
# Copyright 2020 Alibaba Group Holding Limited. 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 ... |
<gh_stars>0
#!/usr/bin/env python
"""
@author: pritesh-mehta
"""
import numpy as np
from scipy.optimize import curve_fit
from pathlib import Path
from argparse import ArgumentParser
from dwi_utilities.monoexponential_decay import log_func, func
import dwi_utilities.nifti_utilities as nutil
def comp_high_b_case(case... |
<filename>pyapprox/optimization.py
import numpy as np
from scipy.optimize import minimize, Bounds
from functools import partial
from scipy.stats import gaussian_kde as KDE
from pyapprox.configure_plots import *
import scipy.stats as ss
from pyapprox.utilities import get_all_sample_combinations
def approx_jacobian(func... |
<gh_stars>0
import numpy as np
from scipy.sparse import issparse
from sklearn.utils import sparsefuncs
from .. import logging as logg
from ..utils import doc_params
from ._docs import doc_norm_descr, doc_quant_descr, doc_params_bulk, doc_norm_quant, doc_norm_return, doc_ex_quant, doc_ex_total
def _normalize_data(X, co... |
<gh_stars>1-10
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import os
from typing import Union
import pandas as pd
import signatureanalyzer as sa
# Cluster Color map
COLORMAP={
0:'#0073C2FF',
1:'#EFC000FF',
2:'#868686FF',
3:'#CD534CFF',
4:'#7AA6DCFF',
5:'#003C67FF',
... |
import numpy as np
from PIL import Image
from scipy.spatial.distance import cdist
import tensorflow as tf
def shannon_entropy(x, how="max"):
"""
Shannon entropy of a 2D array
:how: str; aggregate across columns by "max" or "sum"
"""
xprime = np.maximum(np.minimum(x, 1-1e-8), 1e-8)
elemwis... |
#!/usr/bin/env python
# Created by <NAME>, September 2002
from __future__ import division, print_function, absolute_import
__usage__ = """
Build fftpack:
python setup_fftpack.py build
Run tests if scipy is installed:
python -c 'import scipy;scipy.fftpack.test(<level>)'
Run tests if fftpack is not instal... |
<gh_stars>10-100
import re
import os
import Unique_kmer_detect_direct
import seqpy
from collections import defaultdict
from Bio import SeqIO
#import msa_polish_with_kalign
import math
import pickle
import Recls_withR_new
import scipy.sparse as sp
import numpy as np
import psutil
import gc
def build_dir(input_dir):
if... |
<gh_stars>1-10
# Tests that the environment works correctly
import matplotlib
matplotlib.use('TkAgg')
import sklearn
import pandas
import scipy
import numpy
from skimage.io import imread
from sklearn.externals.six.moves import xrange
from sklearn import svm
import tkinter as Tk
from matplotlib.backends.backend_tka... |
<reponame>ProtoLife/covid-recovery
import csv
import numpy as np
import datetime
import warnings
import math
import pwlf
from scipy import stats
from tqdm import tqdm, tqdm_notebook # progress bars
from scipy.interpolate import interp1d
from scipy.signal import savgol_filter
from matplotlib import pyplot as plt
impor... |
<reponame>rgiordan/LinearResponseVariationalBayes.py
import LinearResponseVariationalBayes as vb
import autograd
import autograd.numpy as np
import autograd.scipy as sp
import scipy as osp
from scipy.sparse import coo_matrix
# The first index is assumed to index simplicial observations.
def constrain_simplex_matrix(... |
<reponame>irhete/recsys-challenge-2018<gh_stars>1-10
"""
-----------------------------------------------------------------
RecSys Challenge 2018 - Team Latte
_..,---,.._
.-;'-.,___,.-'; <NAME> [<EMAIL>]
(( | | 2018.07.01
` \ ... |
<gh_stars>1-10
from __future__ import division,print_function
from ..calcs import Calc
from numba import njit,guvectorize,vectorize,prange
import numba.cuda as cuda
from PIL import Image
from pyproj import Geod
from six import iteritems
import scipy.interpolate as interp
import scipy.signal as signal
import numpy as ... |
import os
import threading
import json
import numpy as np
import pytest
from skimage import io
from skimage._shared._tempfile import temporary_file
from scipy import ndimage as ndi
from gala import features, serve, evaluate as ev
D = os.path.dirname(os.path.abspath(__file__))
os.chdir(os.path.join(D, 'example-data... |
import os
import re
import csv
import math
import time
import codecs
import string
import random
import warnings
import collections
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from PIL import Image
from tqdm import tqdm
from scipy import spatial
import nltk
from nltk.translate... |
<filename>venv/Lib/site-packages/psychopy/tools/audiotools.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tools for working with audio data.
This module provides routines for saving/loading and manipulating audio samples.
"""
__all__ = [
'array2wav',
'wav2array',
'sinetone',
'squaretone',
's... |
<gh_stars>1-10
import numpy
from .fit_profile import fit_linearComb
from .data import Data
from scipy import ndimage
from scipy import interpolate
try:
import emcee
except ImportError:
emcee = None
try:
import pymc
except ImportError:
pymc = None
from copy import deepcopy
try:
import copy_reg
excep... |
# cython: profile=True
import numpy as np
from scipy import optimize
from compartmentmodels.GenericModelOriginal import GenericModel
if __name__ == '__main__':
# create a boxcar function for the aif and calculate some convolutions
# with an exponential, as test case for further implementations of thi... |
<reponame>peterthorpe5/DROS_kitchenMadness_DNAseq_20211207
""" Title: collate data
"""
#imports
import os
from sys import stdin,argv
import sys
from collections import defaultdict
from scipy.stats import pearsonr
from numpy import mean
from numpy import std
import numpy as np
from matplotlib import pyplo... |
<gh_stars>10-100
import warnings
import numpy as np
from itertools import cycle
from matplotlib import cm
from sympy.utilities.iterables import is_sequence
from spb.series import BaseSeries
from mergedeep import merge
from spb.backends.utils import convert_colormap
class Plot:
"""Base class for all backends. A ba... |
import numpy as np
import scipy as sp
from sklearn.linear_model import Ridge, RidgeClassifier, LogisticRegression
from sklearn.naive_bayes import BernoulliNB
from sklearn.ensemble import GradientBoostingClassifier, GradientBoostingRegressor, BaggingClassifier, BaggingRegressor, RandomForestClassifier
from sklearn.pipel... |
<reponame>matthieuo/reorder-video
import argparse
import numpy as np
import cv2
from scipy.spatial import distance
def write_video_full_resolution(video_file_in, video_file_out, frames, l_coresp):
"""Write a reordered video in its original resolution
Args:
video_file_in: original file
video_file_... |
<reponame>KailongPeng/rtSynth
# this script is meant to deal with the data of 8 recognition runs and generate models saved in corresponding folder
'''
input:
cfg.session=ses1
cfg.modelFolder=f"{cfg.subjects_dir}/{cfg.subjectName}/{cfg.session}_recognition/clf/"
cfg.dataFolder=f"{cfg.subjects_dir}/{cfg.subj... |
#!/usr/bin/env python
"""
Demonstrates how to apply throughput corrections to individual BOSS spectrum.
There a few different ways to specify a spectrum. In order of precedence:
1) using the spec filename
2) a target id string (must also provide top-level directory containing spec files)
3) individual plat... |
<reponame>zmoon/bee-lpdm<filename>blpd/bees.py
"""
Bee flight model – the "b" in ``blpd``.
Based on the Lévy flight random walk model as implemented in
[Fuentes et al. (2016)](https://doi.org/10.1016/j.atmosenv.2016.07.002)
but with some enhancements.
"""
import math
import numpy as np
from scipy import stats
__all... |
"""
**generate_latex.py**
A commandline application to create a latex table summarising the results of
LSAnomaly static data experiments. This is a refactored version of
the script in `evaluate_lsanomaly.zip`
(see https://cit.mak.ac.ug/staff/jquinn/software/lsanomaly.html).
**usage**
generate_latex.py [-h] --input-j... |
<reponame>jutanke/mvpose
import numpy as np
from scipy.special import comb
import numpy.linalg as la
from numba import jit, float64
@jit([float64[:,:](float64[:,:,], float64[:,:,], float64[:,:,], float64[:,:,])], nopython=True)
def calculate_line_integral_elementwise(candA, candB, mapx, mapy):
"""
calcula... |
import numpy as np
import tensorflow as tf
from scipy.stats import multivariate_normal as normal
from scipy.integrate import solve_ivp
class Equation(object):
"""Base class for defining PDE related function."""
def __init__(self, eqn_config):
self.n_player = eqn_config.n_player
self.total_time... |
<gh_stars>0
#!/usr/bin/env python3
import functools, scipy, itertools
import scipy.special as special
import scipy.sparse as sparse
##########################################################################################
# general methods
###########################################################################... |
"""@package filters
Filter function for stress strain data.
"""
import numpy as np
import scipy.signal
import pandas as pd
def load_data_set(files):
""" Returns a list of stress-strain data.
:param list files: Stress-strain data files to be loaded.
:return list: (pd.DataFrame) Loaded data.
Notes:
... |
<reponame>Bai-Li/TRADES
import numpy as np
import scipy.misc
from scipy.misc import imsave
import os
def save_images(X, save_path):
# [-1, 1] -> [0,255]
if isinstance(X.flatten()[0], np.floating):
# X = ((X + 1.) * 127.5).astype('uint8')
X = (X * 255).astype('uint8')
n_samples = X.shape[0]
rows = int... |
<filename>codraft/core/computation/image.py
# -*- coding: utf-8 -*-
#
# Licensed under the terms of the BSD 3-Clause or the CeCILL-B License
# (see codraft/__init__.py for details)
"""
CodraFT Computation / Image module
"""
# pylint: disable=invalid-name # Allows short reference names like x, y, ...
import numpy as... |
<filename>binary-to-hdf5.py<gh_stars>1-10
import json
import glob
import re
import h5py
import os
import numpy as np
from scipy.ndimage import interpolation
data_path = "/media/vleite/a5c2cdb0-d068-41ea-a7a1-b28a29d082f3/ThomasDataset/Wafer1/precomputed"
data_name = "C1_EM"
json_file = data_path + "/" + data_name + "/... |
<reponame>Ryo-F/tableone
# ###################################### #
# #
# Updated by: <NAME> (2018.03.19) #
# Author: <NAME> #
# License: MIT License #
# Available from: #
# https://github.com/kjohnsson/modality #
# ... |
<filename>linear_regression/using_scipy.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import linregress
# load the data
df = pd.read_csv('data.csv', header=None)
X = df[0]
Y = df[1]
# plot the data to see what it looks like
plt.scatter(X, Y)
plt.show()
W, b, r_value, p_va... |
<filename>cirq/ops/random_gate_channel_test.py
# 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
#
# Unl... |
<reponame>mcnoat/pymc3<gh_stars>1-10
# Copyright 2020 The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
import unittest
import os
import random
import numpy as np
from scipy.linalg import expm
from scipy.stats import unitary_group
from openfermion.utils import qubit_operator_sparse
from .utils import (convert_array_to_dict, convert_dict_to_array,
dec2bin, bin2dec,
is_identity, is... |
<gh_stars>0
# pprint()用于在控制台上漂亮地打印输出。 LaTeX 可以达到最佳效果,例如 在 Jupyter 笔记本中。
from sympy import pprint, Symbol, exp, sqrt
from sympy import init_printing
init_printing(use_unicode=True)
x = Symbol('x')
a = sqrt(2)
pprint(a)
print(a)
print("------------------------")
c = (exp(x) ** 2) / 2
pprint(c)
print(c)
|
import numpy as np
from geompreds import orient2d
import matplotlib.pyplot as plt
from math import sqrt
from random import random
from sympy import Point, Polygon, Segment
def parse_point(line):
x, y = line.strip().split()
return (float(x), float(y))
def distance(a, b):
return sqrt((a[0] - b[0]) ** 2 + ... |
<reponame>hyiche/THSR_Captcha_Recognition<gh_stars>0
import cv2
import time
import tensorflow as tf
from PIL import Image
from io import BytesIO
from bs4 import BeautifulSoup
from scipy.special import softmax
from random import randint, sample
from requests import Session, adapters
from datetime import date, d... |
#!/usr/bin/env python
'''
Author: <NAME> @ RIKEN
Copyright (c) 2020 RIKEN
All Rights Reserved
See file LICENSE for details.
'''
import os,gzip,subprocess
import pybedtools
from pybedtools import BedTool
import pysam
import numpy as np
from scipy import stats
import matplotlib
matplotlib.use('pdf')
import matplotlib.... |
<gh_stars>100-1000
# Copyright 2018 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to i... |
<gh_stars>0
"""
Deep Residual Regression Networks
"""
import keras
from keras.datasets import mnist
from keras.layers import Dense, Conv2D, BatchNormalization, Activation
from keras.layers import Average,Flatten,AveragePooling1D, Input, GlobalAveragePooling1D
from keras.optimizers import Adam
from keras.regularizers im... |
<filename>optimism/phasefield/test/testPhaseFieldThresholdPatch.py<gh_stars>0
from scipy.sparse import diags
from matplotlib import pyplot as plt
from optimism.JaxConfig import *
from optimism.phasefield import PhaseFieldThreshold as material
from optimism.phasefield import PhaseField
from optimism.phasefield import M... |
import scipy.optimize as sop
from predictor import *
from xyz_to_zmat import *
def optimize(coordinates,species,bonds):
prediction_model = get_default_prediction_model()
zparams,zconnect = get_zmat_from_coordinates(coordinates)
optim_params = sop.minimize(optimizer_oracle,zparams,method='Nelder-Mead',... |
from keras.applications.vgg16 import preprocess_input, VGG16
from keras.layers import Conv2D, Dense, Input, Dropout, Flatten, Lambda
from keras.preprocessing import image
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential, Model
from keras.backend import tf
from scipy import n... |
import sys
import theano
import theano.tensor as T
import numpy as np
from scipy.misc import imread, imsave, imresize
from scipy.ndimage.filters import median_filter
from keras.applications import VGG16, VGG19, ResNet50
floatX = theano.config.floatX
models_table = {
"vgg16": VGG16,
"vgg19": VGG19,
"resnet... |
<filename>src/server/face_processor.py
import numpy as np
import pickle
import dlib
import cv2
import matplotlib.pyplot as plt
from scipy.spatial import distance as dist
from imutils import face_utils
class FaceProcessor:
ERROR_BAD_IMAGE = 1
ERROR_BAD_EYE = 2
__EYE_AR_THRESH = 0.25
__EYE_AR_CONSEC_FR... |
<filename>examples/demo/qt_example.py
"""
Example of how to directly embed Chaco into Qt widgets.
The actual plot being created is drawn from the basic/line_plot1.py code.
"""
from traits.etsconfig.etsconfig import ETSConfig
ETSConfig.toolkit = "qt4"
from numpy import linspace
from scipy.special import jn
from pyface... |
<filename>analysisCodes/abeliantensors/abeliantensor.py
import numpy as np
import heapq
import warnings
import itertools as itt
import functools as fct
import operator as opr
import scipy.sparse.linalg as spsla
from copy import deepcopy
from .tensorcommon import TensorCommon
from collections.abc import Iterable
# Some... |
"""
Table 4 in the paper.
"""
import os
import pickle
import json
from glob import glob
from tqdm import tqdm
import numpy as np
import scipy.stats
from tabulate import tabulate
from collections import defaultdict
from sklearn.metrics import average_precision_score
import torch
import torch.nn.functional as F
from nltk... |
#!/usr/bin/env python
# Copyright 2013-2019 <NAME>, <NAME> (<EMAIL>, <EMAIL>)
#
# 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 requir... |
<gh_stars>1-10
import numpy as np
from astropy import units as u
from astropy.time import Time
from astropy.timeseries import TimeSeries
from astroquery.jplhorizons import Horizons
from scipy.interpolate import interp1d
import starry
starry.config.lazy = False
def get_body_ephemeris(
times, body_id="501", step=... |
# Create Gaia reference catalog
from __future__ import division, print_function
import sys, os, glob, time, warnings, gc
# import matplotlib.pyplot as plt
import numpy as np
from astropy.table import Table, vstack, hstack
import fitsio
from astropy.io import fits
output_path = '/global/cfs/cdirs/desi/users/rongpu/de... |
<filename>biopen_smoothing_model_code.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 21 12:44:21 2020
@author: Vishnu
"""
import glob
from skimage import io
from scipy import ndimage
import numpy as np
#Imports all images (glucose, buffer, and rhodamine for NAD(P)H and Fluo-4) into arrays
NADH_g_... |
from bisect import bisect_left
from typing import List, Tuple
import numpy as np
import scipy.stats as ss
# function to calculate Cohen's d for independent samples
def cohend(a: List[float], b: List[float]) -> Tuple[float, str]:
a = np.asarray(a)
b = np.asarray(b)
# calculate the size of samples
m, n... |
#!/usr/bin/env python
# coding: utf-8
## DRUG RESPONSE PREDICTION FOR BASELINE C (ComBat + DL)
#
# For a list of drugs:
# - Look-up best set of hyper-parameter (trained on cell lines)
# - Train on cell lines.
# - Apply on tumors.
# This is a simple baseline to compare the approach.
######
#
# PARAMETERS
#
#####... |
# -*- coding: utf-8 -*-
""" Analysis tools
"""
import sciplot
import numpy as np
import matplotlib.pyplot as plt
from .functions import _hist_init
def plot_flatness(sig, tag, bins=None, ax=None, xrange=None, percent_step=5):
""" Plotting differences of sig distribution in percentiles of tag distribution
Arg... |
"""
Copyright (c) 2017, <NAME> (INRIA), <NAME> (ENS) and <NAME> (ENPC)
All rights reserved.
"""
import torch
import numpy as np
import scipy.fftpack as fft
def filters_bank(M, N, J, L=8):
filters = {}
filters['psi'] = []
offset_unpad = 0
for j in range(J):
for theta in range(L):
... |
<reponame>faameunier/word2vec
from __future__ import division
import os
# The code is optimized for a single threaded BLAS
# Multithreaded BLAS would mess with mp.Pool resulting in
# a major slowdown. Here we force the 2 most commonly
# used BLAS to be single threaded.
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.envir... |
<reponame>senthilkumarIRTT/Python-for-Digital-Signal-Processing
#Program to Discrete Fourier Transform
import numpy as np
from numpy.fft import fft,ifft
import scipy as sy
from matplotlib import pyplot as plt
#input sequences
x = eval(input('Enter the input sequence x[n]='))
N = len(x)
X = fft(x,N);
prin... |
<reponame>TiankunZhou/dials
from __future__ import absolute_import, division, print_function
import logging
# modified version of the ab_cluster function so we can access the scipy dendrogram object
from xfel.clustering.cluster import Cluster
logger = logging.getLogger(__name__)
class UnitCellCluster(Cluster):
... |
#coding:utf-8
"""
<NAME>, <NAME>
May 15, 2017
"""
import math
import geopy.distance
import numpy as np
from scipy.spatial import cKDTree
from scipy import inf
from matplotlib import pyplot as plt
from scipy.cluster.hierarchy import dendrogram, linkage
from scipy.cluster.hierarchy import cophenet
from scipy.spatial.di... |
#!/usr/bin/env python
"""
<NAME>
video and MARSIS radar inplemented: April 2012
Passive radar added: Dec 2014
This program detects aurora in multi-terabyte raw video data files
Also used for the Haystack passive FM radar ionospheric activity detection
"""
from typing import Dict, Any
import logging
from configparser ... |
# Copyright (c) 2019, 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 to i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.