text string |
|---|
# coding: utf-8
# # Shells
# ## Init symbols for *sympy*
# In[22]:
from sympy import *
from sympy.vector import CoordSys3D
import matplotlib.pyplot as plt
from matplotlib import cm
from IPython.display import display
N = CoordSys3D('N')
x1, x2, x3 = symbols("x_1 x_2 x_3")
alpha1, alpha2, alpha3 = symbols("alpha_... |
import visualizer
import numpy as np
from PIL import Image as im
from scipy.stats import multivariate_normal
import math
import gaussianEquation
class PlaneMerger:
def __init__(self, planes, weights):
self.referencePlanes = np.array(planes)
print("Plane shape: ", self.referencePlanes.shape)
... |
import numpy as np
import pandas as pd
import scipy
import scipy.stats as stats
import statsmodels
import statsmodels.api as sm
from statsmodels.formula.api import ols
import os
import csv
rootdir = '/home/yukiho/results'
data = pd.read_csv(os.path.join(rootdir,'e3-2016.csv'))
home_lm = ols('homes ~ C(scenario)'... |
<gh_stars>0
from numbers import Integral, Real
import numpy as np
from scipy.sparse import csr_matrix
import pytest
from sklearn.base import BaseEstimator
from sklearn.utils import deprecated
from sklearn.utils._param_validation import Hidden
from sklearn.utils._param_validation import Interval
from sklearn.utils._pa... |
<reponame>gabrielclimb/intro-to-ml-with-kubeflow-examples<filename>data-extraction/python-notebook/MailingListDataPrep.py<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# Here we can install some packages our notebook needs. We can also install them in our container to speed things up & make it more reliable. But fo... |
<reponame>Fernal73/LearnPython3<filename>scipy/brainsize.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from statsmodels.formula.api import ols
import pandas
pandas.set_option('display.max_rows', 500)
pandas.set_option('display.max_columns', 500)
pandas.set_option('display.width', 1000)
from pandas imp... |
<filename>level-3/doomsday-fuel/solution_doomsday_fuel.py
"""
The first test case for this problem seems pretty straightforward. You can
follow along in your head or on paper and arrive at the answer fairly easily.
But then you hit the second test case. And you probably notice pretty quick
if you were to implement the... |
import sys, os
import numpy as np
from lflib.lightfield import LightField
from lflib.imageio import save_image
from scipy.ndimage import filters
os.environ['PYOPENCL_COMPILER_OUTPUT'] = '1'
try:
import pyopencl as cl
import pyopencl.array as cl_array
LFLIB_HAVE_OPENCL = True
except ImportError:
LFLIB_HA... |
#!/usr/bin/env python
"""
Run MCMC follow-up on target parameters.
The default parellel execution by emcee uses multiprocess and pickeling
the function that is being evaluated. Things become a bit complicated
because you can't pickle instance methods.
<NAME> has a solution registering a method with pickle:
http://byt... |
#!/usr/bin/env python
import sys
import os.path
import scipy.io.wavfile
DEBUG = False
#DEBUG = True
DISTORTIONS = [
("distorted", """
sox \"%(infile)s\" -r8000 /tmp/0_r8000.wav rate
sox /tmp/0_r8000.wav -r8000 /tmp/1_gsm.gsm
sox /tmp/1_gsm.gsm -r44100 -s /tmp/2_gsm-post.wav rate
sox /tmp/2_gsm-post.wav /tmp/3_f... |
import numpy as np
import torch
import cv2
import random
from scipy.signal import resample
from PIL import Image
import scipy
class Compose(object):
def __init__(self, transforms):
self.transforms = transforms
def __call__(self, seq):
for t in self.transforms:
seq =... |
<filename>signedfac/simplefac.py
r'''
Model:
Z_row,i ~ N(B_row C_{row,i}, Sigma_row)
Z_col,j ~ N(B_col C_{col,i}, Sigma_col)
C_ij = <Z_row,i,Z_col,j>
X_ij ~ p(C_ij;theta_j)
where p can be one of
- bernoulli
- normal
- negativebinomial
'''
import dataclasses
from . import lowlevel
import tensorflow a... |
#!/usr/bin/env python
'''Parameterized SBAS like inversion using a dictionary
of temporal functions. Reads the igram stack from a HDF5 file
and inverts it using the time representation string given by
the user. The results are again written to a HDF5 file.
.. note::
This script estimates time-series only... |
<reponame>brix4dayz/TRiCAM2.0<filename>frame_grabber.py
"""
frame_grabber.py
>>> python frame_grabber.py [from dir] [to dir] [frame capture rate]
"""
import hpidol as hp
import cv2, sys, shutil
import numpy as np
import scipy.misc, os
import pandas as pd
from collections import Counter
from PIL import Image
def pos... |
<filename>sketch.py<gh_stars>0
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
import matplotlib.colors as mc
from matplotlib.collections import PatchCollection
from scipy import misc
from scipy import ndimage
from sklearn.cluster import KMeans
from sklearn.metrics im... |
"""
Process a parquet of all training data to add labels and computed features.
Final data is stored individually (per-document) to enable random access of
small samples, with an index over all the documents.
"""
import argparse
from concurrent.futures import ThreadPoolExecutor, as_completed
from enum import Enum, au... |
<reponame>aimagelab/MCMR<filename>main.py
import os
import random
import sys
from argparse import ArgumentParser
from datetime import datetime
from pathlib import Path
from time import time
import cv2
import imageio
import lpips
import numpy as np
import torch
from pytorch3d.loss import mesh_laplacian_smoothing
from p... |
# coding: utf-8
# In[1]:
import os
import cv2
import numpy as np
import tensorflow as tf
from datetime import datetime
from alexnet import AlexNet
import matplotlib.pyplot as plt
from datagenerator import ImageDataGenerator
from glob import glob
from keras.preprocessing import image
from tqdm imp... |
<reponame>mwangistan/weather<filename>apps/api/utils.py<gh_stars>0
from statistics import mean, median
class Parser:
@staticmethod
def get_maximum(data):
days_max_temp = [i['day']['maxtemp_c'] for i in data]
return max(days_max_temp)
@staticmethod
def get_minimum(data):
days_mi... |
<reponame>junghun73/Learning
import numpy as np
from scipy import optimize
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def sixhump(x):
return (4 - 2.1*x[0]**2 + x[0]**4 / 3.) * x[0]**2 + x[0] * x[1] + (-4 + \
4*x[1]**2) * x[1] **2
x = np.linspace(-2, 2)
y = np.linspace(-1, 1)
... |
import numpy
from flexon_ken_memo_optimization import run_whole_beamline, get_surface_from_basis_and_coefficients
from srxraylib.plot.gol import plot
from scipy import optimize
import nevergrad as ng
import time
## Define function to minimize/maximize ##
##########################################
def get_corrector... |
import matplotlib
matplotlib.use('agg')
import sys
from netCDF4 import Dataset
import os
os.environ["PROJ_LIB"] = "/g/data4/x77/jm5970/env/trackeddy/share/proj"
import cmocean as cm
from trackeddy.tracking import *
from trackeddy.datastruct import *
from trackeddy.geometryfunc import *
from trackeddy.physics import *
f... |
"""Monitoring in Bayesian Dynamic Linear Models."""
import copy
import pybats
import numpy as np
import pandas as pd
from typing import List
from scipy import stats
from pybats_detection.smooth import Smoothing
from pybats_detection.utils import tidy_parameters
class Monitoring:
"""Bayesian Monitoring analysis.
... |
<reponame>eternalamit5/An-improved-wearable-multi-sensor-fusion-Pedestrian-Dead-Reckoning-system-for-indoor-localisation-of
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import find_peaks
x = np.sin(2*np.pi*(2**np.linspace(2,10,1000))*np.arange(1000)/48000) + np.random.normal(0, 1, 1000) * 0.15
... |
<filename>tests/linalg/test_matrix.py<gh_stars>10-100
import numpy as np
import pytest
import scipy as sp
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import norm as spnorm
import xgi
def test_incidence_matrix(edgelist1, edgelist3, edgelist4):
el1 = edgelist1
el3 = edgelist3
el4 = edgelis... |
<gh_stars>100-1000
from __future__ import print_function
import os
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
from multiprocessing import Pool, cpu_count
from scipy.ndimage.interpolation import zoom
def plot_middle(data, slice_no=None):
if not slice_no:
slice_no = data.shape... |
from prlqr.systems.dynamical_system import DiscreteTimeDynamicalSystem, StateFeedbackLaw
from prlqr.analysis.stability_analysis import check_stability
from prlqr.systems.pendulum import numerical_jacobian
import numpy as np
from scipy.integrate import solve_ivp
import math
class FurutaPendulum(DiscreteTimeDynamicalS... |
<filename>nept/tuning_curves.py
import numpy as np
import scipy
from .utils import find_nearest_idx, gaussian_filter
def binned_position(position, binsize):
"""Bins 1D position by the binsize.
Parameters
----------
position : nept.Position
Must be a 1D position
binsize : int
Returns... |
import numpy as np
from scipy import constants
def fluence(energy,area,inc_angle=np.pi/2,reflectivity=0):
"""Simple calculation of fluence at a surface of reflectivity
<reflectivity> with angle
<inc_angle> (radians) between surface plane and incoming wavevector.
energy in J, area (normal to wavewecto... |
import matplotlib.pyplot as plt
import numpy as np
from numpy import cross, eye
from scipy.linalg import expm, norm
import pandas as pd
from scipy.spatial.transform import Rotation as R
from pyts.decomposition import SingularSpectrumAnalysis
def modeshape_sync_lstsq(mode_shape_vec):
"""
Creates a straight lin... |
import numpy as np # to handle datas
import math # to handle mathematical stuff (example power of 2)
from scipy.signal import butter, lfilter, welch, square # for signal filtering
def getfeaturesTD(emg, windows, step):
pool = []
col = emg.shape
for i in range(col[-1]):
s = emg[:, i]
ass... |
<filename>segmentation_eval.py
import os
import sys
import cv2
import numpy as np
import torch
import torch.utils.data
from data.apple_dataset import AppleDataset
from sklearn.metrics import confusion_matrix
from statistics import mean
import utility.utils as utils
import utility transforms as T
def get_transform(tr... |
<reponame>IntelPython/scikit-ipp<gh_stars>1-10
# ******************************************************************************
# Copyright (c) 2020, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:... |
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
# Let's create a function to model and create data
def func(x, a0, b0, c0, a1, b1, c1):
return a0 * np.exp(-(x - b0) ** 2 / (2 * c0 ** 2))\
+ a1 * np.exp(-(x - b1) ** 2 / (2 * c1 ** 2))
# Generating clean data
x = np.linsp... |
'''
author: bg
goal:
type: Image Clustering DL learn <-- VGG Auto-encoder (AE) +
how: DCNN clustering - Local Aggregation by Zhuang et al (2019) + SegNet method of AE arch
ref: https://towardsdatascience.com/image-clustering-implementation-with-pytorch-587af1d14123
refactors:
'''
import numpy as np
import tor... |
import numpy as np
import scipy.weave as weave
from scipy.weave import converters
def my_xc(a, b):
# assume len(a) < len(b)
n = len(b) - len(a)+1
m = len(a)
r = np.zeros((n,))
a_normed = a / np.linalg.norm(a)
code="""
for(int i=0; i < n; ++i) {
double b_norm = 0;
double cc = 0;
for... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import re
import string
import nltk
from langdetect import detect # pip install langdetect
from sklearn.feature_extraction.text import TfidfVectorizer
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from collections import Counter
from ... |
<filename>src/automlwrapper/automlwrapper.py
import warnings
warnings.filterwarnings("ignore")
# Import libraries
import time as tm
import numpy as np
import pickle as pk
import pandas as pd
import random as rd
#---------------------------------------------------------------------------------------------------#
from i... |
import argparse
import numpy as np
import scipy
from scipy.linalg import pinv, svd
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Linear Dynamical Systems",
add_help="How to use",
prog="python LDS.py <arguments>")
... |
<reponame>cwardell97/learn-hippo-1<gh_stars>0
import os
import numpy as np
import pdb
from utils.constants import TZ_COND_DICT
from analysis import compute_stats, remove_none
from scipy.stats import pearsonr, sem
from collections import defaultdict
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style='wh... |
def is_number(s):
try:
float(s)
return True
except ValueError:
return False
import matplotlib.pyplot as plt
import numpy as np
f="/home/fast/onimaru/deepgmap/data/misc/deepsea_S3.txt"
datadict={}
with open(f, 'r') as fin:
for line in fin:
line=line.split("\t")
... |
from __future__ import division, with_statement
import pkg_resources
import data_format # strokelitude
import motmot.utils.config
import motmot.FastImage.FastImage as FastImage
import motmot.realtime_image_analysis.realtime_image_analysis as realtime_image_analysis
import motmot.fview.traited_plugin as traited_plugin... |
<gh_stars>1-10
'''
Reads input FITS data cube and resamples according to the
grating and spaxel scale. The output cube is in ph/s/m2/um/arcsec2 units
'''
import os
import logging
import astropy.io.fits as fits
import astropy.units as u
import numpy as np
import scipy.constants as sp
from scipy.interpolate import inter... |
<reponame>Codernob/problem-solving-codes
from fractions import Fraction
T = int(input())
for i in range(T):
n = int(input())
print("Case "+str(i+1)+": "+str(Fraction(n*n-n,4))) |
import os
from numpy import where, zeros
#from itertools import repeat
test = [(1, 1), (1, 6), (8, 3), (3, 4), (5, 5), (8, 9)]
#xt, yt = zip(*test)
res = {i:[] for i in test}
for x1, y1 in test:
idx = test.index((x1,y1))
for x2, y2 in (test[:idx]+test[(idx+1):]):
res[(x1, y1)].append((abs(x2-x1)+1 + a... |
<gh_stars>0
#!/usr/bin/env python
#===============================================================================
# Copyright (c) 2019 <NAME>
# Revised from Dr. <NAME>'s Chunk_compiler.R
# Lab of Dr. <NAME> and Dr. <NAME>
# University of Michigan
#Permission is hereby granted, free of charge, to any person obtaining... |
<gh_stars>0
import numpy as np
from scipy.stats import norm
from .basecalculator import BaseCalculator
from ..fitutils.utils import eval_pdf, array2dataset, pll
from ..parameters import POI
def generate_asimov_hist(model, params, nbins=100):
""" Generate the Asimov histogram using a model and dictionary of param... |
from __future__ import annotations
import os
import numpy as np
import pandas as pd
import scipy.optimize as so
import scipy.special as sp
from pymwm.utils.cutoff_utils import f_fp_fpp_cython
class Cutoff:
"""A callable class that calculates the values of u at cutoff frequencies for coaxial waveguides made of ... |
<gh_stars>10-100
# coding: utf-8
# # Word Mover's distance
#
# In this note notebook we will see an application of Optimal Transport to the problem of computing similarities between sentences and texts. The method under the lens is called 'Word Mover's Distance' in reference to 'Earth Mover's Distance', another name... |
import numpy as np
from scipy import interpolate
import matplotlib.pyplot as plt
def main():
x = np.linspace(-4, 4, 100)
noise = np.random.normal(0, 0000.1, 100)
y = np.sin(x) + noise
yinterp = interpolate.UnivariateSpline(x, y, s = 5e8)(x)
plt.plot(x, y, 'o', label = 'Original')
plt.plot(x,... |
import os
import torch
import torch.nn as nn
from pathlib import Path
import numpy as np
import math
import yaml
import time
from tqdm import tqdm
from scipy.cluster.vq import kmeans
import torchvision
class Ensemble(nn.ModuleList):
# Ensemble of models
def __init__(self):
super(Ensemble, self).__in... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 19 12:37:25 2020
@author: Vicky
Neural PDE - Tensorflow 2.X
Testing with Korteweg de Vries Equation
PDE: u_t + u*u_x + 0.0025*u_xxx
IC: u(0, x) = cos(pi.x),
BC: Periodic
Domain: t ∈ [0,1], x ∈ [-1,1]
"""
import os
import numpy as np
import sc... |
<reponame>JaeYoonKim72/DL-Biobank<filename>GA/utils/hck_data.py
import os
import hickle as hkl
import struct
# numpy
import numpy as np
# Pandas
import pandas as pd
# scipy
from scipy import stats
# sklearn
from sklearn import preprocessing
_data_dir = '/home/data/biobank/'
_mydata_dir = os.path.join(os.path.expandu... |
'''
Space-Time Kernel Density Estimation
<NAME>
'''
from ..bobs import *
from ..primitives import *
from ..engines import *
from .Pattern import *
import scipy.spatial as sp
#Takes the Vector BOB from the ShapefileRead Prim and makes it into a STCube BOB
class setUpSTPrim(Primitive):
def __call__(self, points,... |
import numpy as np
import h5py
import cv2
from scipy.spatial.transform import Rotation
def load_hdf5(path):
demo = {}
with h5py.File(path, "r") as hf:
demo["actions"] = hf["actions"][:]
demo["states"] = hf["states"][:]
# x, y, z, quaternion
# x: pointing inwards
# y: p... |
import scipy
import numpy as np
from numpy.testing import assert_equal, run_module_suite, assert_
import unittest
from qutip import num, rand_herm, expect, rand_unitary
def test_SparseHermValsVecs():
"""
Sparse eigs Hermitian
"""
# check using number operator
N = num(10)
spvals, spvecs = N.e... |
"""
Script to process the HDF5 files and convert them to netcdf
"""
#==============================================================================
__title__ = "Site Vegetation data"
__author__ = "<NAME>"
__version__ = "v1.0(04.04.2019)"
__email__ = "<EMAIL>"
#=====================================================... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
SCRIPT # 6
Created on Sun Aug 2 12:19:09 2020
@author: omid
"""
import pandas as pd
import numpy as np
from datetime import datetime
from khayyam import *
import statsmodels.api as sm
from scipy.stats import ttest_ind
# seed the random number generator
allFun... |
import os, sys
from logs import logDecorator as lD
import json
from scipy.interpolate import interp1d
from scipy.integrate import odeint
import numpy as np
import tensorflow as tf
import time
from tensorflow.python.client import timeline
config = json.load(open('../config/config.json'))
logBase = config['logging'... |
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils.validation import check_is_fitted, check_random_state
import numpy as np
from math import inf
from scipy.optimize import nnls
def _optimize_alphas(B, A):
B = np.pad(B, ((0, 0), (0, 1)), 'constant', constant_values=200)
A = np.pad(A, (... |
<reponame>evgeniy97/taskgenerator<filename>BaseNotebooks/LR2DB.py
# -*- coding: utf-8 -*-
"""
Numerical Methods, lab 2
"""
import sympy as sy
from sympy import Rational as syR
from sympy import exp, sin, cos, sqrt, log, ln
from sympy import pi, cot, sinh, cosh, atan, tan
# Это был Task_db
Tasks_db = {
'Task1':
[
... |
from typing import Callable, Dict
import numpy as np
import scipy.optimize as optim
from gradient_descent import grad_descent
from zoo import Zoo
def multistart(f: Callable,
jac: Callable,
domain: np.array,
max_iterations: int = 200,
tau: float = 1e-4,
... |
<reponame>Anna1015/WorkAtTokyo<filename>countWord.py
# coding: utf-8
import sys
import pandas, numpy, seaborn, pymc3, theano
import pandas, re, matplotlib, numpy
from scipy import sparse
import seaborn, scipy
import sklearn
import sklearn.utils.extmath
import sklearn.model_selection
import pymc3, theano
from ... |
"""
======================================================================
Brownian motion
======================================================================
Brownian motion, or pedesis, is the random motion of particles
suspended in a medium. In this animation, path followed by 20 particles
exhibiting brownian mot... |
<reponame>lanl/DnMFkCPP<filename>planc-master/utilities/shufflesparsemm.py
import numpy as np
import scipy.sparse as sp
import sys
import getopt
###############################################################################
# This file takes a sparse matrix as input file and shuffles it
# python shufflesparsemm.py -i... |
from math import log
import matplotlib.pyplot as plt
import numpy as np
from numba import jit, njit, prange
from scipy.stats import pearsonr
from .signal import envelope, fftwconvolve
def rms(y):
"""
Get RMS vlaue
Parameters
----------
y : float 1D array
Signal
Returns
-------
... |
import sqlite3
import numpy as np
import logging
import matplotlib.pyplot as plt
from scipy.integrate import simps
from scipy.interpolate import griddata
from .config import *
import os
import datetime
from .star import Star
logger = logging.getLogger(__name__)
class SolvePars:
def __init__(self, key_parameter_k... |
<gh_stars>10-100
#!/usr/bin/env python3
"""
compile comamnds functions
"""
import argparse
import os
import subprocess
import re
import collections
import sys
import json
import typing
import statistics
import itertools
COMPILE_COMMANDS_FILE_NAME = 'compile_commands.json'
class CompileCommand:
def __init__(s... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 29 15:07:49 2018
For GMLC 1.4.2, fleet Virtual Battery Model for HVACs
Based on a valided 4R4C building thermal model
Last update: 05/09/2019
Version: 1.0
@author: <NAME> (ORNL), <NAME> (ORNL)
"""
# code needed for GLOBAL fleet_interface
import sys
from os.path import d... |
"""
This module contains objects to characterize the pure-component adsorption
loading surface from experimental or simulated data. These will be fed into the
IAST functions in pyiast.py. A loading surface is a function of both temperature
and pressure where an isotherm is only a function of pressure.
"""
from __future... |
<reponame>yifan0330/NiMARE<gh_stars>1-10
"""CBMA methods from the ALE and MKDA families."""
import logging
from abc import abstractmethod
from hashlib import md5
import nibabel as nib
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from scipy import ndimage
from tqdm.auto import tqdm
from ... |
import numpy as np
from scipy.stats import multivariate_normal, entropy
from scipy.ndimage.filters import gaussian_filter
from math import floor, atan2, pi, cos, sin, sqrt
import time
from matplotlib import pyplot as plt
#Environment setup
# constant
WHITE = 0
YELLOW = 1
RED = 2
lanewidth = 0.4
linewidth_white = 0.0... |
import numpy as np
import scipy.sparse
from sklearn.neighbors import NearestNeighbors
from sklearn.utils.graph_shortest_path import graph_shortest_path
from parallel_transport_unfolding.ptu import PTU
from utils import relative_error, data_abs_path
def special_geodesic_distance(x, y):
return np.arctan2(np.linalg... |
# -*- coding: utf-8 -*-
import os
import warnings
from time import time
import numpy as np
import pandas as pd
import SimpleITK as sitk
import torch
from scipy.ndimage import label
from torch.autograd import Variable
from tqdm import tqdm
from dataset.dataset import Dataset
from net import Unet
from utilities.utils ... |
"""
Script for performing a fit to a histogramm of recorded
time differences for the use with QNet
"""
import scipy.optimize as optimize
import numpy
import pylab
import sys
#import optimalbins
def main(bincontent=None,binning = (0,10,21), fitrange = None):
def decay(p,x):
return p[0]*numpy.exp(-x/p[1]... |
# Copyright 2021-2022 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 ... |
<reponame>NREL/reVX<filename>reVX/offshore/assembly_areas.py
# -*- coding: utf-8 -*-
"""
Compute least-cost distance from ports to assembly areas
"""
import h5py
import logging
import numpy as np
from scipy.spatial import cKDTree
from reV.handlers.exclusions import ExclusionLayers
from reVX.utilities.utilities import ... |
<reponame>Limingxing00/RDE-VOS-CVPR2022
from matplotlib import pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from scipy.special import softmax
fig = plt.figure()
ax = Axes3D(fig)
X = np.arange(0.1, 1, 0.05)
Y = np.arange(0.1, 1, 0.05)
X, Y = np.meshgrid(X, Y)
# Z = X*Y # STM
# sof... |
'''
Created on Nov 2, 2016
@author: <NAME>
'''
from sklearn.neighbors.kde import KernelDensity
import data.data_utils as dut
import numpy as np
from scipy.optimize import basinhopping
class Clustering(object):
'''
classdocs
'''
annotations = None
num_docs = None
doc_leng... |
#! -*- coding: utf-8 -*-
'''用Keras实现的CVAE
目前只保证支持Tensorflow后端
#来自
https://github.com/keras-team/keras/blob/master/examples/variational_autoencoder.py
'''
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from tensorflow.keras.layers import In... |
<reponame>jasonrubenstein18/Stock-Market-Analysis<filename>StockAnalysis.py
"""
Created on Wed Dec 18 11:20:22 2019
@author: jasonrubenstein
ESN plot from: https://github.com/mrdragonbear/EchoStateNetworks/blob/master/Echo_State_Networks.ipynb
remember to update path in row 49; run from command line
"""
import date... |
from sympy import *
import pandas as pd
def seccion_dorada(xl, xu, tolerance, function):
x = Symbol('x')
f = parse_expr(function)
iteration = 0
data = pd.DataFrame(columns=['iteration','xl','xu','x1','x2','f(x1)','f(x2)','error'])
while abs(xu-xl) > tolerance:
fxl = f.subs(x, xl)
f... |
<filename>ex_starplus_local_tsvd.py<gh_stars>1-10
# import
import numpy as np
import tensor.tensor_product_wrapper as tp
from utils.plotting_utils import montage_array, slice_subplots, classification_plots
import matplotlib.pyplot as plt
import similarity_metrics as sm
import scipy.io
import utils.starplus_utils as sta... |
<filename>assignment-5-discreteevent-simulation-marctheshark3/partB/monte-carlo-simulation(approximate).py
import numpy as np
from scipy.interpolate import UnivariateSpline
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import scipy.stats as st
import TransitionMatrix as TM
from T... |
<filename>ctc_training.py
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 16 00:21:17 2019
@author: amade
"""
from tqdm import trange
import tensorflow as tf
from primus import CTC_PriMuS
import ctc_utils
import ctc_model
import argparse
from statistics import mean
import os
config = tf.ConfigProto()
... |
from django.core.management.base import BaseCommand
from django.core.files import File
import os
import exifread
from data.models import SkyPicture, MeasuringDevice
import datetime
from fractions import Fraction
from data.tasks import gator, computeProjection
class Command(BaseCommand):
help = 'Import sky images ... |
<reponame>maeda6uiui/AIO2
import argparse
import numpy as np
import torch
from pathlib import Path
from scipy import sparse
def convert_csr_to_tensor(csr:sparse.csr_matrix)->torch.FloatTensor:
coo=csr.tocoo()
values=coo.data
indices=np.vstack((coo.row,coo.col))
i=torch.LongTensor(indices)
v=torch... |
"""
This modules does the analysis required to find the probability distributions and its parameters for the simulation input
"""
import simdata
import datetime
import pandas as pd
import numpy as np
from scipy import stats
from scipy import arange
import gtconfig
import matplotlib
if not gtconfig.is_windows:
ma... |
import fractions
import re
import mpmath
import pytest
from diofant import (Add, Float, Function, I, Integer, Lambda, Matrix, Mul, Or,
Poly, Pow, Range, Rational, Symbol, SympifyError, Tuple,
Xor, evaluate, exp, false, pi, sin, sqrt, sympify, true)
from diofant.abc import _cl... |
# -*- coding: utf-8 -*-
# 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 ag... |
import logging
import os
import joblib
import numpy as np
import pandas as pd
from joblib import Parallel
from joblib import delayed
from scipy.interpolate import interp2d
from workalendar.europe import Portugal, Greece
def rescale(arr, nrows, ncol):
W, H = arr.shape
new_W, new_H = (nrows, ncol)
xrange =... |
<reponame>icdm2021submission/Continual-Neural-Network-Model-Retraining
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.datasets.samples_generator import make_blobs
from sklearn.preprocessing import StandardScaler
import glob
import pandas as pd
from scipy.stats.stats imp... |
import torch
import torch.nn as nn
from torch.autograd import grad
from torch.distributions.categorical import Categorical
import numpy as np
from scipy.spatial.distance import cdist
class RFFEmbedding(nn.Module):
r"""Random Fourier Features Embedding
Args
**num_features** (scalar): number of input f... |
#!/apps/well/python/2.7.8/bin/python
"""
Usage: hlmm_chr.py
This script fits heteroskedastic linear models or heteroskedastic linear mixed models to a sequence of genetic variants
contained in a .bed file. You need to specify the genotypes.bed file, which also has genotypes.bim and genotypes.fam in
the same directory,... |
<gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
'''
针对新疆低温,DTSM01调到负值来校准
物候,TMPFTB,和TMNFTB校准生长量
此外改下Tbase
v2-3: 修改了kdvs优化方式,不变动叶片
v2-1:增加分区内分级
V4版结果:三年标定的筛选了单产数据
单年标定的在上述基础上补充了部分空值,基本采用前后空值(前六年联合标定效果不好)
'''
# In[1]:
import os
import sys
import csv
import nlopt
import time
import datetime
import matplotlib.... |
import dolfin as fem
import matplotlib.pyplot as plt
import numpy as np
from scipy import integrate
from buildup import common, utilities
from mtnlion.newman import equations
def run(start_time, dt, stop_time, return_comsol=False):
cmn, domain, comsol = common.prepare_comsol_buildup()
comsol_j = utilities.i... |
from sympy import *
from rodrigues_R_utils import *
px, py, pz = symbols('px py pz')
sx, sy, sz = symbols('sx sy sz')
tie_px, tie_py, tie_pz = symbols('tie_px tie_py tie_pz');
cols, rows = symbols('cols rows');
pi = symbols('pi')
u_kp, v_kp = symbols('u_kp v_kp')
position_symbols = [px, py, pz]
rodrigues_symbols = [... |
import sys
import os
import pickle
import numpy as np
from metrics_ddie import ddie_compute_metrics
from scipy.special import softmax
from transformers import BertTokenizer
tokenizer = BertTokenizer.from_pretrained('/mnt/model/scibert_scivocab_uncased', do_lower_case=True)
with open('/mnt/corpus/test_tsv/dev.tsv', '... |
<reponame>zpincus/zplib<gh_stars>1-10
import numpy
from scipy.interpolate import _fitpack_impl as fitpack
from . import geometry
def linear_resample_polyline(points, num_points):
"""Resample a piecewise linear curve to contain a given number of
equally-spaced points, using linear interpolation.
Parameter... |
<reponame>shun60s/glottal-source-spectrum<gh_stars>1-10
#coding:utf-8
# A class of iir peaking filter
# Check version
# Python 3.6.4 on win32 (Windows 10)
# numpy 1.14.0
# scipy 1.0.0
# matplotlib 2.1.1
import sys
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
cla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.