text string |
|---|
<filename>ensembled_predictions_npy.py<gh_stars>100-1000
"""
Given a set of predictions for the validation and testsets (as .npy.gz), this script computes
the optimal linear weights on the validation set, and then computes the weighted predictions on the testset.
"""
import sys
import os
import glob
import theano
im... |
# coding: utf-8
# ## Non-independent cost of infection
# Import packages.
# In[1]:
import sys
sys.path.append('../lib/')
from cycler import cycler
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import palettable
import plotting
import projgrad
import scipy.optimize
import evolimmune
import an... |
<reponame>zx1239856/handSolver
"""
A simple tool to calculate box range for dataset http://www.robots.ox.ac.uk/~vgg/data/hands/
and convert the information to CSV file
Licensed under MIT license
Copyright: <EMAIL> <NAME>
## usage: use -s or --src param to specify input dir
"""
import cv2
import argparse
impor... |
<gh_stars>1-10
# views.py
from flask import render_template, request
from app import app
from .forms import LoanForm
from .amortize import amortize, amortization_table, proxy_rates
from scipy.optimize import minimize
import pandas as pd
from collections import OrderedDict
import plotly
import json
@app.route('/', me... |
<filename>57813137-watershed-segmentation/watershed_segmentation.py<gh_stars>1-10
import cv2
import numpy as np
from skimage.feature import peak_local_max
from skimage.morphology import watershed
from scipy import ndimage
# Load in image, convert to gray scale, and Otsu's threshold
image = cv2.imread('1.jpg')
gray = c... |
"""General utility functions"""
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import gridspec
import os
import json
import logging
import csv
import scipy.io as io
import torch
import numpy as np
class Params():
"""Class that loads hyperparameters from a json file.
Ex... |
# %% md
# Data Loading
# %%
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0,1,2,3' # specify GPUs locally
import pandas as pd
from matplotlib import pyplot as plt
# import seaborn as sns
# %%
#os.listdir('../input/cassava-leaf-disease-classification')
# %%
train = pd.read_csv('/root/disk/csy/cassava/data/d... |
"""multipy: Python library for multicomponent mass transfer"""
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright (c) 2022, <NAME>, <NAME>"
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = ["<NAME>"]
__email__ = ["<EMAIL>"]
__status__ = "Production"
import numpy as np
import pandas as pd
import random... |
<reponame>grzeimann/Panacea
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 8 06:44:36 2019
@author: gregz
"""
import numpy as np
import warnings
from scipy.interpolate import LSQBivariateSpline
from scipy.signal import medfilt
from astropy.io import fits
from astropy.table import Table
def get_selection(array1, arra... |
<reponame>CamAirCo/ProjetEntrepriseS3
# coding=utf-8
import cv2
#opencv的库
import os, shutil
#
import tensorflow as tf
from tensorflow.python.keras.applications.resnet50 import ResNet50
from tensorflow.python.keras.applications.vgg19 import VGG19
from tensorflow.python.keras.models import load_model
import numpy as np
i... |
__author__ = '<NAME>'
__email__ = '<EMAIL>'
from scipy import stats
from sklearn.cross_decomposition import PLSRegression
import numpy as np
from sklearn.metrics import mean_squared_error
import pandas as pd
import sys
import pdb
from sklearn.decomposition import PCA
from .Window import Window
from .util import utili... |
import tempfile
import os
from subprocess import getoutput as gop
from scipy import constants
from .. import const
from .execute import Command
import shutil
import jinja2
from ..pmd import convert as pmd_convert
from ..logger import logger
class Cpptraj(object):
def __init__(self, debug=False):
self.exe =... |
<reponame>bkmi/e3nn<gh_stars>0
# pylint: disable=not-callable, no-member, invalid-name, line-too-long, missing-docstring, arguments-differ
import math
import scipy.signal
import torch
from e3nn import o3
class SphericalHarmonicsProject(torch.nn.Module):
def __init__(self, alpha, beta, lmax):
super().__i... |
<reponame>vincentbonnetcg/Numerical-Bric-a-Brac
"""
@author: <NAME>
@description : Backward Euler time integrator
"""
import numpy as np
import scipy
import scipy.sparse
import scipy.sparse.linalg
import core
import core.jit.block_utils as block_utils
import lib.system.jit.integrator_lib as integrator_lib
from lib.sys... |
<reponame>DEIB-GECO/NMTF-link
import warnings
warnings.filterwarnings('ignore')
import sys
from scripts import Network
import numpy as np
import matplotlib
from utils import EvaluationMetric, StopCriterion
matplotlib.use('agg')
import pylab as plt
import time
import statistics
import os
current = os.getcwd()
_, fil... |
<filename>mushroom_rl/environments/mujoco_envs/humanoid_gait/reward_goals/velocity_profile.py
import warnings
import numpy as np
from scipy.signal import square
class VelocityProfile:
"""
Interface that represents and handles the velocity profile of the center of
mass of the humanoid that must be matched... |
import decimal
from decimal import Decimal
import sympy
def reciprocal(p, raw=False):
decimal.getcontext().prec = p - 1
r = Decimal(1) / Decimal(p)
if raw:
return r
else:
# only show digit part include dot
# e.g. 0.142857 -> .142857
return str(r)[1:]
def do_interesti... |
import numpy as np
from numpy import ndarray
import scipy.linalg as la
import solution
from utils.gaussparams import MultiVarGaussian
from config import DEBUG
from typing import Sequence
def get_NIS(z_pred_gauss: MultiVarGaussian, z: ndarray):
"""Calculate the normalized innovation squared (NIS), this can be seen... |
#%% ----------------------------------------------------------------------------
# <NAME>, March 2021
# KWR BO 402045-247
# ZZS verwijdering bodempassage
# AquaPriori - Transport Model
# With <NAME>, <NAME>, <NAME>, <NAME>
#
# Based on Stuyfzand, <NAME>. (2020). Predicting organic micropollutant behavior
# ... |
<gh_stars>1-10
import time
import sys
import numpy as np
import scipy.stats
import librosa
from matplotlib import pyplot as plt
from tqdm.notebook import tqdm
import gc
from face_rhythm.util import helpers
def prepare_freqs(config_filepath):
config = helpers.load_config(config_filepath)
for session in confi... |
<filename>Cali_Models - Price Ensembles.py<gh_stars>0
import matplotlib.pyplot as plt
import numpy as np
np_load_old = np.load
np.load = lambda *a,**k: np_load_old(*a, allow_pickle=True, **k)
hists = np.load('lagged_price_35day.npy')
# restore np.load for future normal usage
np.load = np_load_old
print(hists.s... |
import numpy as np
from astropy.stats import sigma_clip
from scipy import linalg, interpolate
class SFFCorrector(object):
def __init__(self):
pass
def correct(self, time, flux, centroid_col, centroid_row, polyorder=5,
niters=3, bins=15, windows=1, sigma_1=3., sigma_2=5.):
fro... |
<filename>mrftools/MarkovNet.py
"""Markov network class for storing potential functions and structure."""
import numpy as np
from scipy.sparse import coo_matrix
class MarkovNet(object):
"""Object containing the definition of a pairwise Markov net."""
def __init__(self):
"""Initialize a Markov net."""... |
from __future__ import print_function
import os
import numpy as np
import SimpleITK as sitk
import scipy.misc
from skimage.transform import resize
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import scipy.ndimage
import cv2
import time
from decimal import Decimal
import skimage.io as io
from skimage... |
"""
The code in this file was copied from
https://github.com/fasiha/array_range
https://github.com/fasiha/nextprod-py
https://github.com/fasiha/overlap_save-py
Thanks to <NAME> for releasing this to the larger public with the
Unlicense.
# Fast-convolution via overlap-save: a partial drop-in replacement for scipy.sign... |
<filename>server/aplicaciones/raices.py
import sympy
def beta_fc(fc):
if fc <= 280:
return 0.85
if fc >= 560:
return 0.65
return (280 - fc) / 1400 + 0.85
def revisar_seccion(base, altura, dp, As, Asp, fc, fy=4200, E=2000000, ec_max=0.003):
d = altura - dp
beta = beta_fc(fc)
... |
# https://deeplearningcourses.com/c/deep-reinforcement-learning-in-python
# https://www.udemy.com/deep-reinforcement-learning-in-python
from __future__ import print_function, division
from builtins import range
# Note: you may need to update your version of future
# sudo pip install -U future
import copy
import gym
im... |
import sys, os
from datetime import datetime
import numpy as np
import tensorflow as tf
from scipy.misc import imresize
def add_scalar_summaries(tensor_list, tensor_names):
if tensor_list:
# Attach a scalar summary to all individual losses and metrics.
for name, tensor in zip(tensor_name... |
import numpy
import scipy.sparse
class echo_reservoir:
def __init__(self, adjacency_matrix, input_producer, output_consumer, matrix_width, matrix_height, chaos_factor):
self.adjacency_matrix = adjacency_matrix
self.input_producer = input_producer
self.output_consumer = output_consume... |
"""
Created on Wed Jun 17 14:01:23 2020
combine graph properties for different seeds
@author: Jyotika.bahuguna
"""
import os
import glob
import numpy as np
import pylab as pl
import scipy.io as sio
from copy import copy, deepcopy
import pickle
import matplotlib.cm as cm
import pdb
import h5py
import pandas as pd
i... |
<reponame>weidel-p/go-robot-nogo-robot
import matplotlib
matplotlib.use('Agg')
import numpy as np
from scipy.stats import alpha
from scipy.stats import pearsonr
import pylab as pl
import seaborn
import sys
import json
import yaml
sys.path.append("code/striatal_model")
import params
from colors import colors
from plot_t... |
# -*- coding: utf-8 -*-
from __future__ import annotations
import typing
from typing import Optional
from collections import namedtuple
from dataclasses import dataclass
import functools
import warnings
import numpy as np
import pandas as pd
import scipy.signal
from endaq.calc.stats import L2_norm
from endaq.calc i... |
# -*- coding: utf-8 -*-
"""Análisis de la variación en celulas mediante análisis de texturas"""
""" Paper implementado: https://pubmed.ncbi.nlm.nih.gov/25482647/"""
from skimage.filters.rank import entropy
from skimage.morphology import disk
from skimage import io
import matplotlib.pyplot as plt
import numpy as np
fr... |
import theano
import numpy as np
import scipy as sp
import pickle
import sys,os
import argparse
import matplotlib
from sklearn.preprocessing import MinMaxScaler
matplotlib.use('TKAgg')
import pylab as py
py.ion()
file_path = os.path.dirname(os.path.realpath(__file__))
lib_path = os.path.abspath(os.path.join(file_path, ... |
<reponame>floregol/gcn_mark
import random
import time
import tensorflow as tf
from utils import *
from models import GCN, MLP
import os
from scipy import sparse
from train import get_trained_gcn
from copy import copy, deepcopy
import pickle as pk
import multiprocessing as mp
import math
import sys
from sklearn.metrics ... |
"""PCA tests."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import numpy as np
from scipy import signal
from spikedetekt2.processing import compute_pcs, project_pcs
# -----------------------... |
<reponame>LiamJHealy/LiamJHealy.github.io<filename>algorithmic_hedging.py
import math
import datetime
from datetime import timedelta
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from scipy import stats
class EuropeanCall:
def d1(self, asset_price, strike_price,... |
# --------------------------------------------------------------------------
# Core functions to train on NGA data.
# --------------------------------------------------------------------------
import gc # clean garbage collection
import glob # get global files from directory
import random ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 13 18:41:38 2021
@author: divyoj
"""
## importing libraries:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.animation import FuncAnimation
import os
# # note that this must be executed before 'import numba'
# os... |
<reponame>gymcoding/learning-python
#-- Fraction 클래스
# ● 유리수와 관련된 연산을 효율적으로 처리할 수 있는 분수(fractions)모듈
# ● Fraction 클래스의 생성자
# ○ fraction Fraction(분자=0, 분모=1)
# ○ fraction Fraction(Fraction 객체)
# ○ fraction Fraction(문자열)
import fractions
fraction_obj1 = fractions.Fraction(4, 16)
print(fraction_obj1)
fraction_obj2 =... |
import numpy as np
import scipy
import scipy.stats
from threadpoolctl import threadpool_limits
import ctypes
import collections
import irec.offline_experiments.metrics.utils as metrics
from tqdm import tqdm
from irec.utils.utils import run_parallel
from irec.recommendation.matrix_factorization.MF import MF
from numba ... |
<reponame>lukas-weber/fftl-data
import numpy as np
import scipy.optimize as spo
from collections import defaultdict
import mcextract as mce
import matplotlib.pyplot as plt
mc_1 = mce.MCArchive('../data/scaling5.json')
mc_075 = mce.MCArchive('../data/scaling_J3=0.75.json')
mc_025 = mce.MCArchive('../data/nd_scaling1.js... |
<filename>scripts/GaussianMixtureRegression.py
import numpy as np
from scipy.signal import gaussian
from sklearn.mixture import GaussianMixture as GM
from matplotlib import pyplot as plt
from operator import itemgetter
import math
from math import exp, sqrt, pi
import csv
# Convert data to float
# Ref: joint... |
import numpy as np
import scipy as sp
from PIL import Image, ImageDraw
import netCDF4
vertical_spacing = 0.05 # in meters
max_depth_of_section = 5 # meters
fp = 'deltaRCM_Output/pyDeltaRCM_output.nc'
nc = netCDF4.Dataset(fp)
strata_sf = nc.variables['strata_sand_frac'][:]
strata_depth = nc.variables['strata_depth'][... |
#!/usr/bin/env python3.7
#
# Copyright (c) University of Luxembourg 2021.
# Created by <NAME>, <EMAIL>, SnT, 2021.
#
import math
from scipy import spatial
def print_new_test(result, dist_value):
result_file = open(result, 'a+')
result_file.write(str(dist_value))
result_file.close()
def is_int(s):
tr... |
<reponame>rtagirov/python_scr_pc_imperial
import numpy as np
import matplotlib.pyplot as plt
import scipy.constants as const
import more_itertools as mit
import math as m
from matplotlib.ticker import AutoMinorLocator
from matplotlib.ticker import MultipleLocator
from tqdm import tqdm
import sys
if not '../aux/' in... |
<reponame>MorrisWan/MorrisWan.github.io<filename>pngToWav.py
import scipy.io.wavfile
import math
from PIL import Image
import numpy
def revSigmoid(x): # turning values from [0,255] to all real numbers (i think)
if x == 0:
return -700
ans = -numpy.log(255/x - 1)
return ans
list1 = []
... |
<gh_stars>10-100
# <NAME>
import os
import numpy as np
from keras.utils import to_categorical
from scipy.misc import imread, imresize, imsave
from sklearn.model_selection import train_test_split
import pickle
def get_img(data_path):
# Getting image array from path:
img = imread(data_path)
img = imresize(im... |
<reponame>KyleLeePiupiupiu/CS677_Assignment<filename>Assignment_3/Part_1_analysis_pi/Code.py
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import mpmath
import numpy as np
# In[2]:
# Initialize the pi for each kind
mpmath.mp.dps = 60
piMathe = mpmath.pi
piEgypt = mpmath.mpf(22/7)
piChina = mpmath.mpf(355/113)
p... |
from time import time
from sympy.ntheory import factorint
t1 = time()
i = 1
while True:
if all(len(factorint(j)) == 4 for j in range(i, i + 4)):
print(i)
print(f"Process completed in {time()-t1}s")
break
i += 1
|
"""
Class to perform over-sampling using Geometric SMOTE. This is a modified
version of the original Geometric SMOTE implementation.
"""
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# License: BSD 3 clause
import math
import numpy as np
from collections import Counter
from numpy.linalg import norm
from sc... |
import torch
from torch import nn
from torch.autograd import Variable
import numpy as np
from scipy.optimize import linear_sum_assignment
from scipy.sparse import csr_matrix
from lap import lapjv
from lap import lapmod
def compute_frobenius_pairwise_distances_torch(X, Y, device, p=1, normalized=True):
"""Compute ... |
# matching features of two images
import cv2
import cv
import sys
import scipy as sp
import numpy as np
img1_path = '/home/rolf/Dropbox/Robotica/World Perception/Assignment 6/Liftknop Fotos/up_template_empty.png'
img2_path = '/home/rolf/Dropbox/Robotica/World Perception/Assignment 6/Liftknop Fotos/lift-front-6.jpg'
... |
# I'm guessing this is no problem either :-P
import cmath
def xmaslight():
# This is the code from my
#NOTE THE LEDS ARE GRB COLOUR (NOT RGB)
# Here are the libraries I am currently using:
import time
import board
import neopixel
import re
import math
# You are wel... |
"""Tests for control module"""
from multiprocessing import Process
import multiprocessing
import multiprocessing.dummy
import tempfile
import shutil
import os
import itertools
from unittest import mock
import asyncio
import json
import datetime
import numba
import numpy as np
from nose.tools import (
assert_equal... |
import numpy as np
from scipy.signal import convolve, butter, filtfilt
def postprocess(beat_locs2, margin, wl=100):
'''
后处理:滑动窗口积分 + NMS
:param beat_locs2: FCN网络的输出,数值范围为(0,1)
:param margin: (滑动窗口大小-1)/ 2
:param wl: 非极大值抑制的窗口大小,根据0.2s内不出现重复心拍的生理学依据,对于采样率500最好小于100
:return: 最后得到的心拍位置
'''
... |
#Prints the (normalized) diversity metric from a list of target strings
#USAGE: Diversity.py <path-to-target-list>
#OUTPUT:
#Diversity median-target-length mean-target-length min-target-length max-target-length
from __future__ import division
import os
import math
import sys
from collections import... |
import pandas as pd
import scipy.special
import numpy as np
def generate_learners_parameterization(n_users, n_items, seed):
np.random.seed(seed)
df_param = pd.read_csv("data/param_exp_data.csv", index_col=0)
mu = np.array([df_param.loc["unconstrained", f"mu{i}"]
for i in (1, 2)])
si... |
import cupy
import numpy
import pytest
from cupy import testing
# TODO (grlee77): use fft instead of fftpack once min. supported scipy >= 1.4
import cupyx.scipy.fft # NOQA
import cupyx.scipy.fftpack # NOQA
import cupyx.scipy.ndimage # NOQA
try:
# scipy.fft only available since SciPy 1.4.0
import scipy.fft ... |
<filename>Codes/Scripts/pickling.py
from __future__ import division, absolute_import
import astropy.stats
import cPickle as pickle
import glob
import math
import matplotlib.pyplot as plt
from matplotlib import ticker
from matplotlib.ticker import FormatStrFormatter
import numpy as np
import os
import pandas as pd
fr... |
from astropy.time import TimeDelta
import numpy as np
from scipy.integrate import ode
import warnings
class Propagator:
def __init__(self, s0, dt, **kwargs):
self.s0 = s0
self.dt = dt
self.forces = []
self.params = {'body': s0.body, 'frame': s0.frame}
self.solver = ode(self.... |
<reponame>CMU-Light-Curtains/SafetyEnvelopes
from dataclasses import dataclass
from typing import Optional, Generator, Union, List, Tuple, NoReturn
import numpy as np
from gym import spaces
import scipy.signal
import torch
from stable_baselines3.common.buffers import BaseBuffer
from stable_baselines3.common.vec_env im... |
# bg_models.py - Background parametric models
# ---------------------------------------------------------------------------
# This file is a part of DeerLab. License is MIT (see LICENSE.md).
# Copyright(c) 2019-2021: <NAME>, <NAME> and other contributors.
import numpy as np
import math as m
import scipy as scp
from ... |
<gh_stars>1-10
"""Functions used to define the target data for fitting the halo population model."""
import numpy as np
import warnings
def get_clean_sample_mask(log_mah_fit, logmp_sample, it_min, lim=0.01, z_cut=3):
"""Calculate mask to remove halos with outlier MAH behavior.
Parameters
----------
l... |
import sqlalchemy
import pandas as pd
from scipy import sparse
import numpy as np
class Database:
def __init__(self, user='root', password='<PASSWORD>',localhost='127.0.0.1',port='8889', database='movielens'):
self.engine = sqlalchemy.create_engine('mysql+mysqldb://'+user+':'+password+'@'+localhost+':'+port... |
import numpy as np
import pandas as pd
import pickle
from math import cos, pi, sin, sqrt
from scipy import interpolate
# Arrays
#arrayName = 'BH'
#lat0 = 48.0056818181818
#lon0 = -123.084354545455
#arrayName = 'BS'
#lat0 = 47.95728
#lon0 = -122.92866
#arrayName = 'CL'
#lat0 = 48.068735
#lon0 = -122.969935
#arrayN... |
<reponame>fsoubelet/PyHEADTAIL
import matplotlib.pyplot as plt
import numpy as np
import pickle
from scipy.constants import c as c_light
from scipy.signal import find_peaks_cwt
from LHC import LHC
macroparticlenumber_track = 5000
macroparticlenumber_optics = 200000
n_turns = 10000
epsn_x = 2.5e-6
epsn_y = 3.5e-6... |
from __future__ import print_function, division
from scipy import interpolate
from netCDF4 import Dataset
''' read vertical profiles of temperature and salinity in a given netcdf name,
interpolate in the vertical on a 3D space grid -- currently uses linear interpolation
<NAME> April 2017 for LUCKYTO '''
def int... |
<reponame>microsoft/distribution-shift-latent-representations<gh_stars>1-10
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import copy
import os
import random
from collections import Counter
from itertools import combinations
from multiprocessing import *
from time import time
from typing imp... |
<filename>ch07/eval_on_wordsimilarity353_66.py
import os
from numpy.lib.npyio import save, savez_compressed
import pandas as pd
import requests
from sklearn.metrics import accuracy_score
import zipfile, io
from scipy.stats import spearmanr
from load_word_vector_60 import WordEmbedding
def fetch_file(url: str, sa... |
<filename>gpu/ann.py
'''
Created in June 2015
@author: <NAME>
'''
import numpy as np
import pyopencl as cl
from collections import namedtuple
from scipy.special import expit
import pkg_resources
class Weights:
def __init__(self, wHL=None, bHL=None, wOL=None, bOL=None):
self.wHL = wHL
self.bHL = b... |
<gh_stars>0
from statistics import mean
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
import random
style.use('fivethirtyeight')
#xs = np.array([1,2,3,4,5,6], dtype = np.float64)
#ys = np.array([5,4,6,5,6,7], dtype = np.float64)
# hm - How many data points we want; variance - how va... |
"""
solve the diffusion equation:
phi_t = k phi_{xx}
with a first-order (in time) implicit discretization
<NAME> (2013-04-03)
"""
import numpy as np
from scipy import linalg
import matplotlib.pyplot as plt
from diffusion_explicit import Grid1d
class Simulation(object):
def __init__(self, grid, k=1.0):
... |
<filename>ch_pipeline/analysis/calibration.py
"""Tasks for calibrating the data."""
import json
import numpy as np
from scipy import interpolate
from scipy.constants import c as speed_of_light
from caput import config, pipeline, memh5
from caput import mpiarray, mpiutil
from ch_util import tools
from ch_util import... |
<reponame>nsmoore57/M5344-IterativeMethods
# Preconditioned GMRES solver for Math 5344, Fall 2020.
# <NAME>, Texas Tech.
# This code is in the public domain.
import time
from copy import deepcopy
import scipy.linalg as la
import numpy as np
import scipy.sparse.linalg as spla
import scipy.sparse as sp
from numpy.random... |
<reponame>yishayv/lyacorr
import numpy as np
from scipy import signal
class MeanTransmittance:
def __init__(self, ar_z):
self.ar_z = np.copy(ar_z)
self.ar_total_flux = np.zeros_like(self.ar_z)
self.ar_count = np.zeros_like(self.ar_z)
self.ar_weights = np.zeros_like(self.ar_z)
... |
import sys
from scipy import special, stats
from numpy import array as A
def compoundPartitioning(agents):
"""Compute and return sections with compound criteria
agents is a dict with keys "d", "id", "od", "s", "is", "os"
with sectorialized_agents__ with each of these criteria
"""
exc_h=set( agents... |
import h5py
import numpy as np
import matplotlib.pylab as plt
import pandas as pd
import os
from matplotlib import ticker, patches
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import matplotlib as mpl
import json
from scipy import interpolate
base_path = r'C:\Users\erick\OneDrive\Documents\ucsd\Postdo... |
#C:\Users\nfor\Desktop\python_programs\projects\calculator\calculator.py
import tkinter
import tkinter as tk
import tkinter.tix as tix
import tkinter.ttk as ttk
from tkinter import *
import tkinter.colorchooser as tkcc
import tkinter.messagebox
import PIL
from PIL import ImageTk, Image
import math
import cmath
imp... |
import matplotlib
matplotlib.use('Agg')
import keras
import numpy as np
import tensorflow as tf
import os
import pdb
import cv2
import pickle
from matplotlib import pyplot as plt
import matplotlib.gridspec as gridspec
import pandas as pd
from ..helpers.utils import *
from ..spatial.ablation import Ablate
from ..clus... |
import numpy as np
from scipy.stats import norm
def rnorm(n, mean=0, sd=1):
"""
Random generation for the normal distribution with mean
equal to mean and standard deviation equation to sd
same functions as rnorm in r: ``rnorm(n, mean=0, sd=1)``
:param n: the number of the observations
:par... |
#----------------------------------------------------------------------
# Functions for AGU tutorial notebooks
#
# In Python a module is just a collection of functions in a file with
# a .py extension.
#
# Functions are defined using:
#
# def function_name(argument1, arguments2,... keyword_arg1=some_variable)
# ''... |
<reponame>erlendd/optomatic<filename>examples/minimal_example/user.py<gh_stars>10-100
from scipy.stats.distributions import randint
from time import sleep
def get_param_space():
'''
define parameter space. used by driver.py
'''
return {'sleep': randint(1, 5)}
def objective_random_sleep(params):
... |
from time import time
import autograd.numpy as np
import autograd.numpy.random as npr
import scipy
import ssm
def test_sample(T=10, K=4, D=3, M=2):
"""
Test that we can construct and sample an HMM
with or withou, prefixes, noise, and noise.
"""
transition_names = [
"standard",
"s... |
"""
This is a template algorithm on Quantopian for you to adapt and fill in.
"""
import math
import numpy as np
import pandas as pd
import scipy.stats as stats
import statsmodels.api as sm
from odo import odo
from statsmodels import regression
from quantopian.pipeline import Pipeline
from quantopian.pipeline import Cus... |
import time
import wx
import settings
#import matplotlib
#matplotlib.use( 'WXAgg',warn=False )
#matplotlib.interactive( False )
#from simplehuckel import matplotlib,FigureCanvasWxAgg,Figure,pylab
#from matplotlib.figure import Figure
#import pylab
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from ma... |
#==============================================================
# OBJECTIVE: Recommend product(s) to customers using
# Collaborative filtering method
#==============================================================
import pandas as pd
import numpy as np
import math
import re
from scipy.sparse import csr_matr... |
"""Utilities for depth images."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import scipy.misc
import scipy.stats
from robovat.perception import image_utils
transform = image_utils.transform
crop = image_utils.crop
def inpaint(d... |
#!/usr/bin/python
import rospy
import numpy as np
from scipy.signal import butter,filtfilt,freqz,lfilter_zi,lfilter,firwin,kaiserord
from geometry_msgs.msg import WrenchStamped
pub = None
def low_pass_filter(data):
global z
filtered_data, z= lfilter(b, 1, [data], zi=z)
return filtered_data
def throw_dat... |
<gh_stars>0
import sys, os
import numpy as np
import matplotlib.pyplot as plt
import json, csv
import glob, time
import matplotlib
from scipy.interpolate import InterpolatedUnivariateSpline as InterFun
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*ar... |
'''
Created on Jun 6, 2018
@author: dpolyakov
'''
import statistics, math
class Analyzer2(object):
'''
Class for keeping track of various values from the data.
Intended to work by being fed one data point at a time and do calculations based on that
'''
def __init__(self, val):
... |
<filename>codigo/limpieza_datos.py<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# ## Limpieza de Datos
# In[7]:
from netCDF4 import Dataset, num2date
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
import cartopy.crs as crs
import pprint
import pandas as pd
import os
from datetime import... |
<gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
""" REFERENCE:
<NAME>., <NAME>., & <NAME>. (2008). Similarity measures for
categorical data: A comparative evaluation. Society for Industrial and
Applied Mathematics - 8th SIAM International Conference on Data Mining 2008,
Proceedings in Applied Mathematics 130, ... |
<gh_stars>10-100
# for i in {1..10}; do python3 test_arxiv_mixed_device.py --finetune_device='gpu:0' --train_loop training_loops/finetune_arxiv_final.json; done
import json
import time
import os
from absl import app, flags
import numpy as np
from ogb.nodeproppred import NodePropPredDataset
import scipy.sparse
import... |
import numpy as np
import scipy.linalg
from inference_methods.abstract_inference_method import AbstractInferenceMethod
from utils.torch_utils import np_to_tensor, torch_to_np
class KernelInferenceMethod(AbstractInferenceMethod):
def __init__(self, rho, rho_dim, theta_dim, alpha, k_z_class, k_z_args,
... |
<gh_stars>1-10
import numpy as np
from scipy.integrate import quad
from scipy import linalg
from scipy import optimize
from scipy.sparse import diags
from math import factorial
import matplotlib.pyplot as plt
class Model(object):
def __init__(self):
self.Nt = 10 # number of Fourier components... |
<reponame>woblob/Crystal_Symmetry
import matrices_new_extended as mne
import numpy as np
import sympy as sp
from equality_check import Point
x, y, z = sp.symbols("x y z")
Point.base_point = np.array([x, y, z, 1])
class Test_Axis_hex_2_2xx0:
def test_matrix_hex_2_2xx0(self):
expected = Point([ x, x-y, -z... |
<filename>steps/evaluate_base.py
import os
import numpy as np
from imageio import imwrite
from mir_eval.separation import bss_eval_sources
from scipy.io import wavfile
from helpers.utils import makedirs, AverageMeter, istft_reconstruction, magnitude2heatmap, recover_rgb, \
save_video, combine_video_audio, get_ctx... |
# Disable debbuging logs (to get rid of cuda warnings)
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import numpy as np
from scipy import signal
from scipy import misc
import matplotlib.pyplot as plt
from PIL import Image
image = Image.open('bird.jpg')
# convert("L") translates color images into b/w
image_gr = ... |
<filename>wfsim/sst.py
from ast import Del
import galsim
import os
import numpy as np
import astropy.io.fits as fits
import batoid
import functools
from scipy.interpolate import CloughTocher2DInterpolator
from scipy.spatial import Delaunay
@functools.lru_cache
def _fitsCache(fn):
from . import datadir
return ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.