text string |
|---|
<reponame>jkmathuriya/Video-Interpolation-Using-Different-OpticalFlow-Algorithms
import numpy as np
import scipy.ndimage
def grad_cal(img0, img2):
img0 = img0/ 255
img2 = img2 / 255
#kernels
kernel_x = np.array([[-1,1],[-1, 1]]) / 4
kernel_y = np.array([[-1, -1], [1, 1]]) / 4
kernel_t = np.a... |
<gh_stars>0
'''
Contains routines to match ER-2 radar data and outputs from the neural network
radar retrieval of Chase et al. (2021) to the P-3 location.
Copyright <NAME>, Univ. of Washington, 2022.
'''
import numpy as np
from pyproj import Proj
from scipy.spatial import cKDTree
def match(
er2obj, p3obj, ra... |
<reponame>edwinkost/wflow
#!/usr/bin/python
# Wflow is Free software, see below:
#
# Copyright (c) <NAME>/Deltares 2005-2011
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
<reponame>jinhojang6/ai-detection-practice<gh_stars>10-100
import numpy as np
import argparse
import cv2 as cv
import subprocess
import time
import os
from yolo_utils import infer_image, show_image
from keras.models import load_model
import sys
from utils.datasets import get_labels
from utils.inference import detect_f... |
<filename>tests/test_expval.py
# Copyright 2018 Xanadu Quantum Technologies Inc.
# 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 req... |
from statistics import variance
example_list=[10,20,30,40,50,60,70,80,90,100]
x=variance(example_list)
print(x)
print('New Method')
from statistics import variance as v
example_list=[10,20,30,40,50,60,70,80,90,100]
x=v(example_list)
print(x)
print('new method')
from statistics import variance,mean... |
<filename>inc/server_config/server_class.py
# -*- coding: utf-8 -*-
# pylib
import pandas as pd
from datetime import datetime as dt
import statistics
import re
from sklearn.metrics import mean_absolute_error,r2_score,mean_squared_error
import configparser
import numpy as np
import glob
import json
import os
# utils
f... |
<reponame>LeBarbouze/tunacell
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This module implements general data operations.
"""
from __future__ import print_function # start to adapt to Python 3
import numpy as np
from scipy.interpolate import interp1d
from numpy.lib.recfunctions import append_fields
import warn... |
# Running parameter scans for 10K turns
# Includes elliptical aperatures in nll insert section
import sys, os
import numpy as np
import scipy
from scipy import constants
from mpi4py import MPI
sys.path.append('/home/vagrant/jupyter/repos/rssynergia/') #added specifically for nifak.radiasoft.org
sys.path.append('/User... |
from statistics import mean
import numpy as np
import scanpy as sc
import os
os.environ["R_HOME"] = r"/home/szalata/anaconda3/envs/joint_sc_embedding/lib/R"
from scIB.metrics import silhouette_batch, graph_connectivity, nmi, silhouette, cell_cycle, trajectory_conservation
from scIB.clustering import opt_louvain
def ... |
<reponame>jlk9/wavelet_xcorr<gh_stars>1-10
# Written by <NAME>, <EMAIL>
# Last modified 3/4/2021
import numpy as np
import math
from scipy.signal import correlate
# First, we need a few C related libraries:
from ctypes import c_void_p, c_double, c_int, cdll
from numpy.ctypeslib import ndpointer
# This loads the com... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 23 2019 09:45:01
WA : WA with the partner from Thessaloniki University, testing
different approach to force the WARM model with EO data
DATE & VERSION : Finalized on Jan, 2020
INPUT : yearly stacks of EVI and Acquisition-DOY from MOD&M... |
<reponame>Pecnut/stokesian-dynamics
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# <NAME>, <EMAIL>, 07/06/2017
# Reference: <NAME>, 2017. The mechanics of suspensions. PhD thesis, UCL. Appendix A.
import numpy as np
from numpy import sqrt, pi
from functions_shared import posdata_data, add_sphere_rotations_to... |
from datetime import datetime
import json
import glob
import os
from pathlib import Path
from multiprocessing.pool import ThreadPool
from typing import Dict
import numpy as np
import pandas as pd
from scipy.stats.mstats import gmean
import torch
from torch import nn
from torch.utils.data import DataLoader
ON_KAGGLE:... |
#!/usr/bin/env python3
import csv
import getopt
import numpy as np
from scipy.stats import spearmanr
import sys
def find_id_of_minimum(y, interval=15):
min_id = 1
while min_id+1 < len(y) and y[min_id] < y[min_id + 1]: # Find the maximum of the systematic error peak (which might be already at 1)
min_id... |
<reponame>EiffL/NaMaster
from __future__ import print_function
from optparse import OptionParser
import numpy as np
import matplotlib.pyplot as plt
import pymaster as nmt
import os
import sys
import data.flatmaps as fm
from matplotlib import rc
import matplotlib
rc('font',**{'family':'sans-serif','sans-serif':['Helveti... |
import numpy as np
import cv2
from keras.models import model_from_json
from keras import optimizers
import keras
import numpy as np
import os
import scipy
from scipy import io
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
from skimage import measure, filters
import math
def mkdir_if_nexist(... |
<reponame>hrwakeford/ExoTiC-LD
import os
import numpy as np
import pandas as pd
from scipy.io import readsav
from astropy.modeling.fitting import LevMarLSQFitter
from scipy.interpolate import interp1d, splev, splrep
from exotic_ld.ld_laws import quadratic_limb_darkening, \
nonlinear_limb_darkening
class StellarL... |
<gh_stars>100-1000
import logging
import numpy as np
from scipy import signal
from pyseir.rt.constants import InferRtConstants
utils_log = logging.getLogger(__name__)
# PR598 Request by Greater New Orlean Public Health to have a consistent Rt across the following:
NEW_ORLEANS_FIPS = (
"22051", # Jefferson
... |
"""
specter.util.util
=================
Utility functions and classes for specter
<NAME>
Fall 2012
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import math
import numpy as np
import scipy.signal
from scipy.special import legendre
from scipy.sparse import spdiags
f... |
"""Tests for node piece."""
import random
from typing import Any, MutableMapping
import numpy
import numpy.testing
import scipy.sparse.csgraph
import unittest_templates
import pykeen.nn.node_piece
from pykeen.nn.node_piece.utils import page_rank
from tests import cases
class DegreeAnchorSelectionTestCase(cases.Anc... |
<filename>test.py
#!/usr/bin/env python
# encoding: utf-8
"""
从单个mhd文件中切割出对应的结节
转换为npy待训练使用
"""
import SimpleITK as sitk
import numpy as np
import matplotlib.pyplot as plt
from skimage import measure, morphology
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import scipy.ndimage
import scipy
import dicom
imp... |
<gh_stars>0
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'seminar-roulette.settings')
import django
django.setup()
from backend.models import *
from django.db.models.functions import ExtractDay, ... |
import re
import os
from os import listdir
import requests
import statistics
from collections import defaultdict
from dotenv import load_dotenv
keyWords = {
'lul',
'lulw',
'omegalul',
'ez',
'pog',
'pogger',
'poggers',
'pogu',
'pogchamp',
'pepehands',
'gachibass',
'gachig... |
<filename>pyfacade/strcals.py
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 20 10:07:44 2020
Function Toolbox for Quick Structural Calculation
@author: qi.wang
"""
import os
import json
import time
import numpy as np
from numpy import sin, cos, arctan, pi
import pandas as pd
from scipy.linalg import solve
from scip... |
# This script is taken from https://github.com/mateuszbuda/ml-stat-util.git
import numpy as np
from scipy.stats import percentileofscore
def score_ci(
y_true,
y_pred,
score_fun,
n_bootstraps=2000,
confidence_level=0.95,
seed=None,
reject_one_class_samples=True,
):
"""
Compute conf... |
from .adt import ADT
from .prelude import *
from . import builtins as B
from . import atl_types as T
from collections import ChainMap, namedtuple, OrderedDict
import itertools
import math
from fractions import Fraction
import re
# --------------------------------------------------------------------------- #
# -----... |
<reponame>BioGeek/roc_comparison
import sklearn.datasets
import sklearn.model_selection
import sklearn.linear_model
import numpy
import compare_auc_delong_xu
import scipy.stats
x_distr = scipy.stats.norm(0.5, 1)
y_distr = scipy.stats.norm(-0.5, 1)
sample_size_x = 7
sample_size_y = 14
n_trials = 1000
aucs = numpy.e... |
# -*- coding: utf-8 -*-
"""Anchor search for NodePiece."""
import logging
from abc import ABC, abstractmethod
from typing import Iterable
import numpy
import scipy.sparse
import torch
from class_resolver import ClassResolver
from .utils import edge_index_to_sparse_matrix
from ...utils import format_relative_compari... |
import unittest
import sympy
import numpy as np
from qupulse.utils.types import TimeType
from qupulse.pulses.function_pulse_template import FunctionPulseTemplate
from qupulse.serialization import Serializer, Serializable, PulseStorage
from qupulse.expressions import Expression
from qupulse.pulses.parameters import Par... |
#/usr/bin python
import numpy as np
def significance_of_mean(a,b,num_bin = 200, data_type=np.float64): #
# discretize
ab = np.sort(np.concatenate((a, b), axis=None))[::-1]
bins = np.linspace(min(ab), max(ab), num_bin)
digitized = np.digitize(ab, bins)
if len(a)>len(b):
score = sum(np.digit... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
"""cluster_train - """
# =============================================================================
# Imports
# =============================================================================
... |
<gh_stars>0
import argparse
import glob
import os
from multiprocessing import Pool, cpu_count
import librosa
import librosa.display
import noisereduce
import numpy as np
from scipy import signal
# 定义参数
SR_ORIGIN = 20000 # 原始数据的采样率,已测试过所有数据相同
BAND_LOW = 0.02 # 带通滤波的下限 200Hz
BAND_HIGH = 0.3 # 带通滤波的上限 3000Hz
WINDOW_L... |
<gh_stars>0
import numpy as np
from numpy.linalg import solve
from scipy.stats import moment,norm
def fleishman(b, c, d):
"""calculate the variance, skew and kurtois of a Fleishman distribution
F = -c + bZ + cZ^2 + dZ^3, where Z ~ N(0,1)
"""
b2 = b * b
c2 = c * c
d2 = d * d
bd = b * d
v... |
<gh_stars>10-100
from __future__ import absolute_import
from __future__ import print_function
from matplotlib import animation
from clawpack.visclaw.JSAnimation import IPython_display
from IPython.display import display
import ipywidgets
import sympy
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
... |
# coding: utf-8
"""
generate all pairwise correlations and print a list of contig1, contig2, correlation score
This is the same code as pairwise_correlations, but does NOT use multiprocessing. Timing the two to see which is quicker
"""
import os,sys
from scipy.stats.stats import pearsonr
import numpy as np
d... |
'''
This script is the source code for a project that
Field Cady and <NAME> are working on.
'''
import pandas as pd
import matplotlib
from matplotlib import pyplot as plt
from scipy import stats
import pys2 # library internal to Allen Institute
# The field we use to tell rank paper importance
CITATION_COUNT_FIELD = ... |
<reponame>ctralie/jsMuSync<filename>CrossSimilarityExtractor.py
import numpy as np
import sys
sys.path.append("GeometricCoverSongs")
sys.path.append("GeometricCoverSongs/SequenceAlignment")
import os
import scipy.io as sio
import scipy.misc
import time
import matplotlib.pyplot as plt
from CSMSSMTools import *
from Bloc... |
<filename>DSP-PBE/PythonUtils/fft.py
"""
Takes a sound file, splits it into time slices, and builds FFT for each slice
"""
import sys
import pylab
from scipy.io import wavfile
from fft_util import timeSliceFFT
from slidingWindow import window
myAudio = sys.argv[1]
windowSize = int (sys.argv[2])
windowOverlap = int (s... |
<reponame>IgorSokoloff/ef21_b-w_experiements_source_code<gh_stars>1-10
"""
updated: 16.09.2021
experiment for logistic regression function with non-convex regularizer
"""
import numpy as np
from sklearn.model_selection import train_test_split
import time
import sys
import os
import argparse
from numpy.random import no... |
from sympy import Abs,sqrt,Number,simplify
class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
O = Point(0,0)
def get_length_of_segment_from_two_points(p1: Point, p2: Point) :
return simplify(sqrt((p1.x-p2.x)**2+(p1.y-p2.y)**2))
def get_analytic_expression_of_directly_propor... |
from scipy.fftpack import fft, fftfreq, fftshift
import matplotlib.pyplot as plt
import numpy as np
# number of signal points
N = 1600
# sample spacing
T = 1.0 / 800.0
x = np.linspace(0.0, N*T, N)
print x.shape
y = np.exp(50.0 * 1.j * 2.0*np.pi*x) + 0.5*np.exp(-80.0 * 1.j * 2.0*np.pi*x)
print y.shape
#y = np.cos(x)
y... |
import argparse, os
import torch
from torch.autograd import Variable
from scipy.ndimage import imread
from scipy.misc import imsave
from PIL import Image
import numpy as np
import time, math
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description="PyTorch VDSR Demo")
parser.add_argument("--cuda", ... |
import numpy as np
import h5py as h5
import scipy.io as spio
import argparse
def import_matlab(inputName, outputName):
w = spio.loadmat(inputName)
a = w['Rdenoisen']
#a = w['ESTvol']
f = h5.File(outputName, "w")
f.attrs.create('version_major', 0, dtype = np.int32)
f.attrs.create('version_minor... |
from flask import Flask, render_template, send_file
from flask_socketio import SocketIO, emit, Namespace
import numpy as np
import json
import drms
import os
import scipy.ndimage as nd
from astropy.io import fits
from bokeh.plotting import figure
from bokeh.resources import CDN
from bokeh.embed import components
from b... |
import matplotlib.pyplot as plt
from numpy import log
from statsmodels.tsa.stattools import adfuller
from statsmodels.tsa.stattools import kpss
from statsmodels.graphics.tsaplots import plot_acf
from statsmodels.graphics.tsaplots import plot_pacf
from statsmodels.tsa.seasonal import seasonal_decompose
import pandas as ... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2020 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import numpy as np
import scipy.linalg as spla
from pymor.algorithms.gram_schmidt import gram_sch... |
<reponame>othercriteria/StochasticBlockmodel
#!/usr/bin/env python
# Utility functions.
# <NAME>, 5/21/2012
import numpy as np
from scipy.stats import norm
from scipy.special import logit as logit
from scipy.special import expit as inv_logit
from scipy.misc import logsumexp
import pickle
from hashlib import sha1
fro... |
import matplotlib.pyplot as plt # plotting
import pandas as pd # data manipulation and analysis
import numpy as np # numerical computation
import pickle
import scipy
from scipy.interpolate import spline
from scipy.ndimage.filters import gaussian_filter1d
from statsmodels.nonparametric.smoothers_lowess import lowess
i... |
import json
from tqdm import tqdm
from collections import Counter
import numpy as np
import operator
from matplotlib.ticker import FuncFormatter
import seaborn as sns
import pandas as pd
import networkx as nx
import base64
from collections import defaultdict
import sys,os
import math
import random
import operator
impor... |
<filename>libs/dpmmIO.py
#!/usr/bin/env python3
import os
import re
import numpy as np
import pandas as pd
from scipy.spatial.distance import squareform
from string import ascii_uppercase
from datetime import timedelta
try:
import libs.utils as ut
except ModuleNotFoundError:
import utils as ut
try:
impor... |
"""
Copyright 2021 The CVXPY 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
Unless required by applicable law or agreed to in writing, so... |
from matplotlib import pyplot as plt
import numpy as np
import random
from sklearn.datasets import load_iris
from scipy.spatial.distance import pdist
from scipy.spatial.distance import squareform
class KMediod():
"""
实现简单的k-medoid算法
data: 训练数据
k_num_center: 簇个数
使用方法:KMediod.run(),返回每个... |
<reponame>woctezuma/steam-hype
# References:
# - https://en.wikipedia.org/wiki/Rank_correlation
# - https://stackoverflow.com/questions/13574406/how-to-compare-ranked-lists
# - http://scipy.github.io/devdocs/stats.html#correlation-functions
# - https://github.com/dlukes/rbo
from scipy import stats
from parse_... |
# coding: utf-8
# ## Exercises
#
# This will be a notebook for you to work through the exercises during the workshop. Feel free to work on these at whatever pace you feel works for you, but I encourage you to work together! Edit the title of this notebook with your name because I will ask you to upload your final no... |
"""
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
import os
import argparse
import tqdm
from PIL import Image
import numpy as np
import scipy.io
pascal_voc_seg_palette = [255] * (256 * 3)
pascal... |
<reponame>cannibalcheeseburger/cpu-scheduling-simluation
import matplotlib.pyplot as plt
from statistics import mean
plt.style.use('fivethirtyeight')
def findWaitingTime(processes, n, burst_time, waiting_time, quantum):
rem_burst_time = [0] * n
for i in range(n):
rem_burst_time[i] = burst_time... |
"""
These is the standard setup for the notebooks.
"""
%matplotlib inline
%load_ext autoreload
%autoreload 2
from jupyterthemes import jtplot
jtplot.style(theme='onedork', context='notebook', ticks=True, grid=False)
import pandas as pd
pd.options.display.max_rows = 999
pd.options.display.max_columns = 999
pd.set_opt... |
<reponame>icdishb/softALIGNF<filename>svm_code/run_svm.py
import sys
import commands
import numpy as np
from numpy.linalg import inv
from scipy.io import loadmat
from sklearn.preprocessing import KernelCenterer
from sklearn import preprocessing
from sklearn.metrics.pairwise import rbf_kernel
from sklearn.metrics impo... |
<reponame>nicksawhney/HARK<gh_stars>0
"""
Classes to solve canonical consumption-saving models with idiosyncratic shocks
to income. All models here assume CRRA utility with geometric discounting, no
bequest motive, and income shocks that are fully transitory or fully permanent.
It currently solves three types of mode... |
import matplotlib
matplotlib.use("Agg")
from itertools import combinations
from collections import defaultdict
from enum import Enum
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial.ckdtree import cKDTree as KDTree
from scipy.optimize import shgo
from sklearn.covariance import MinCovDet
import g... |
'''
Summary
=======
Defines a penalized ML estimator for Gaussian Mixture Models, using LBFGS gradient descent.
Supports these API functions common to any sklearn-like GMM unsupervised learning model:
* fit
Resources
=========
See COMP 136 CP3 assignment on course website for the complete problem description and all... |
import numpy as np
from scipy.optimize import fmin_slsqp
from scipy.stats import truncnorm
from copulas import EPSILON, store_args
from copulas.marginals.model import BoundedType, ParametricType, ScipyModel
class TruncatedGaussian(ScipyModel):
PARAMETRIC = ParametricType.PARAMETRIC
BOUNDED = BoundedType.BOUN... |
####################################################### README #####################################################
# This is the main file which calls all the functions and trains the network by updating weights
########################################################################################################... |
import pickle as pkl
import sys
import networkx as nx
import numpy as np
import scipy.sparse as sp
import torch
class Data:
def __init__(self, dataset_str):
if dataset_str in ['cora', 'citeseer']:
data = load_planetoid_data(dataset_str)
elif dataset_str in ['amaphoto', 'amacomp']:
... |
<reponame>Anbyew/GPy__GPLRF-GPLMRD
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from __future__ import division
import unittest
import numpy as np
import GPy
class MiscTests(unittest.TestCase):
def setUp(self):
self.N = 20
self.N_... |
# tf_unet is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# tf_unet is distributed in the hope that it will be useful,
# but WITHOUT... |
<reponame>RobinRojowiec/intent-recognition-in-doctor-patient-interviews<gh_stars>0
"""
IDE: PyCharm
Project: simulating-doctor-patient-interviews-using-neural-networks
Author: Robin
Filename: analyse_data
Date: 26.04.2019
"""
import glob
import json
import os
import random
import re
import statistics
import sys
from... |
<reponame>suhaspillai/DSRG<filename>training/tools/test-coco-f.py
import numpy as np
import pylab
import scipy.ndimage as nd
import png
import cv2, os
import os.path as osp
from matplotlib import pyplot as plt
from matplotlib import colors as mpl_colors
import krahenbuhl2013
import findcaffe
import ... |
import sys
import time
import numpy as np
import random
import matplotlib.pyplot as plt
import queue
import matplotlib.animation as animation
import threading
from scipy.io.wavfile import read as wavread
from scipy.signal import blackmanharris
from pysoundcard import *
from math import log
from sys import float_info
fr... |
import uuid
import itertools
import json
import numpy
from datetime import timedelta
from datetime import datetime
from collections import OrderedDict
from scipy import stats
from django.db import models
from rest_framework import serializers
from perftracker.models.project import ProjectModel
from perftracker.mod... |
<filename>frigate/object_processing.py
import base64
import copy
import datetime
import hashlib
import itertools
import json
import logging
import os
import queue
import threading
import time
from collections import Counter, defaultdict
from statistics import mean, median
from typing import Callable, Dict
import cv2
i... |
# Allows user to choose perturbations, add custom perturbations, allows tweaking with predefined parameters
from __future__ import division
import sys
import numpy as np
import re
import matplotlib.pyplot as plt
import plotly
import time
import datetime
import math
from scipy.optimize import least_squares
from orbitde... |
#!/usr/bin/env python
import numpy as np
import cv2
import sys
from scipy.interpolate import interp1d
import rospy
import cv_bridge
from sonar_oculus.msg import OculusPing
from sensor_msgs.msg import Image
from dynamic_reconfigure.server import Server
REVERSE_Z = 1
global res, height, rows, width, cols, map_x, map_y,... |
<filename>lightcone_resample/precompute_mask.py
#!/usr/bin/env python2.7
from __future__ import print_function, division
import numpy as np
import scipy as sp
import pdb
import dtk
import h5py
import time
import sys
import datetime
import galmatcher
if __name__ == "__main__":
param = dtk.Param(sys.argv[1])
... |
import glob
import time
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from keras import Input
from keras.applications import VGG19
from keras.callbacks import TensorBoard
from keras.layers import BatchNormalization, Activation, LeakyReLU, Add, Dense
from keras.layers.convolutional import C... |
import numpy as np
from scipy.signal import csd
def xwelch(x, **kwargs):
f, __ = csd(x[:,0], x[:,0], **kwargs)
cpsd = np.zeros([x.shape[1], x.shape[1], len(f)]).astype('complex')
for i, xi in enumerate(x.T):
for j, xj in enumerate(x.T):
f, cpsd[i,j,:] = csd(xi, xj, **kwargs)
retur... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import numpy as np
import scipy.ndimage
import dask.array as da
import dask_image.ndfilters
@pytest.mark.parametrize(
"da_func",
[
dask_image.ndfilters.generic_filter,
],
)
@pytest.mark.parametrize(
"err_type, function, size, footpr... |
<gh_stars>1-10
import numpy as np
import scipy.io as io
import os
def load_data_mat(filename, max_samples):
'''
Loads numpy arrays from .mat file
Returns:
X, np array (num_samples, 32, 32, 3) - images
y, np array of int (num_samples) - labels
'''
raw = io.loadmat(filename)
X = raw['X'... |
import time
from typing import Any, Callable, ClassVar, Dict, Optional, List
from dataclasses import dataclass, field
import pystan
from stanpyro.dppl import PyroModel
from stannumpyro.dppl import NumPyroModel
from scipy.stats import entropy, ks_2samp
import numpy as np
from jax import numpy as jnp
import jax.random
... |
import numpy as np
import pandas as pd
from PIL import Image
from tqdm import tqdm
import os
import re
from glob import glob
import yaml
import gdal
from shapely.geometry import LineString, MultiLineString
from skimage.morphology import skeletonize
from scipy import ndimage
from scipy.spatial import cKDTree
from shape... |
#!/usr/bin/env python3
import sys, scipy
import numpy as np
from scipy.optimize import minimize_scalar
from mathieu_methods import mathieu_solution
from overlap_methods import pair_overlap_1D, tunneling_1D
from fermi_hubbard_methods import get_simulation_parameters, gauged_energy, spatial_basis
from sr87_olc_consta... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
import fastai
from fastai.vision import *
from fastai.callbacks import *
from multiprocessing import Pool
import matplotlib.pyplot as plt
import numpy as np
import PIL
import torch
import torchvision
from torchvision.models import vgg16_bn
from skimage.metrics import structural_similarity as ssim
import os
import sys
... |
<filename>recsys/models.py
from pathlib import Path
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
from scipy.sparse import rand as sprand
from argparse import Namespace
from typing import List
#from utils import *
#from config import *
from recsys... |
<gh_stars>0
import time
from dataanalysis import dataanalysis as da
from math import isinf
from enum import Enum
from knowledgerepr.fieldnetwork import Relation
from nearpy import Engine
from nearpy.hashes import RandomBinaryProjections, RandomBinaryProjectionTree
from nearpy.hashes import RandomDiscretizedProjection... |
<reponame>gyan-krishna/exploring-ml-and-dl
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import normalize
import scipy.cluster.hierarchy as shc
from sklearn.cluster import AgglomerativeClustering
data = pd.read_csv("Wholesale customers data.csv")
data.i... |
<filename>bbc1/lib/token_lib.py
# -*- coding: utf-8 -*-
"""
Copyright (c) 2018 beyond-blockchain.org.
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
... |
<filename>np2.py<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 12 10:28:15 2018
@author: yulkang
"""
# Copyright (c) 2020 <NAME>. hk2699 at caa dot columbia dot edu.
import numpy as np
import torch
from scipy import interpolate
from scipy import stats
import numpy_groupies as ... |
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 28 20:04:37 2018
@author: samla
"""
import numpy as np
import pandas as pd
import datetime as dt
import pyaudio, wave
#import board, busio
#import adafuit_bno055 as bno
#from time import sleep
#initialize orientation sensor
#i2c = busio.I2C(board.SCL, boar... |
<gh_stars>10-100
import json
import os
from scipy.stats import pearsonr
from scipy.stats import spearmanr
from flow_score import *
FLOW_SCORE = FlowScore(MODEL_PATH)
for f in os.listdir("data/"):
human_dialogues = []
data_human = json.load(open("data/" + f))
for i in range(len(data_human)):
if len... |
<filename>DIGDriver/region_model/feature_vectors/gaussian_process.py
#!/usr/bin/env python
import numpy as np
import pandas as pd
import torch
import gpytorch
from sklearn.metrics import r2_score
from sklearn.preprocessing import StandardScaler
# import matplotlib.pyplot as plt
# import seaborn as sns
import h5py
impo... |
<reponame>ykawazura/calliope
# -*- coding: utf-8 -*-
#####################################################
## main program for making plots from AstroGK data ##
#####################################################
import numpy as np
from scipy.integrate import simps, trapz
from scipy import interpolate
from numba im... |
<gh_stars>0
# death battles
# highest paid problem - (bad)
from math import gcd, factorial, floor, ceil
from fractions import Fraction
import operator as op
from functools import reduce
def nCr(n, r):
r = min(r, n-r)
numer = reduce(op.mul, range(n, n-r, -1), 1)
denom = reduce(op.mul, range(1, r+1), 1)
... |
__author__ = 'sorensonderby'
import numpy as np
from load_mnist import load_data
from PIL import Image
import scipy.io as sio
import matplotlib
import matplotlib.pyplot as plt
import os
ORG_SHP = [28, 28]
OUT_SHP = [100, 100]
NUM_DISTORTIONS = 8
dist_size = (9, 9) # should be odd?
NUM_DISTORTIONS_DB = 100000
mnist_da... |
<gh_stars>0
from xml.dom import minidom
import sys
import requests
from scipy import spatial
import random
def load_nodes(xml_path):
dom = minidom.parse(xml_path)\
.getElementsByTagName('node')
list_with_id = []
list_without_id = []
for u in dom:
list_without_id.append([
... |
<reponame>KMC-70/kaos
"""Interpolator for satellite position and velocity."""
import numpy as np
from scipy import interpolate
from kaos.models import OrbitSegment, OrbitRecord, Satellite
from ..errors import InterpolationError
class Interpolator:
"""Utility class to interpolate satellite position and velocity ... |
<gh_stars>10-100
import sys
import bayesnewton
import objax
from bayesnewton.cubature import Unscented
import numpy as np
import matplotlib.pyplot as plt
import time
from scipy.io import loadmat
import pickle
# ----- THE BAYESNEWTON API HAS CHANGED SO THIS SCRIPT WILL NO LONGER RUN -----
if len(sys.argv) > 1:
met... |
<filename>pyva/tests/TestNumericRules.py
import unittest
from pyva import Validator
import decimal
import fractions
class TestNumericRules(unittest.TestCase):
def test_integer(self):
validation = Validator({
'age': 10,
'height': 120
},
{
'age': 'integer... |
<reponame>acadTags/caml-mimic
"""
This script reads a sorted training dataset and builds a vocabulary of terms of given size
Output: txt file with vocab words
Drops any token not appearing in at least vocab_min notes
This script could probably be replaced by using sklearn's CountVectorizer to buil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.