text string |
|---|
#!/usr/bin/python
# -*- coding: utf-8 -*
import os
import glob
import sys
import numpy as np
import getpass
from ftplib import FTP
import shutil
import subprocess as sp
import multiprocessing as mp
sys.path.append(os.path.join(os.path.dirname(__file__),"../projects/tools"))
import msh
import executable_paths as exe
im... |
import numpy as np
from scipy.spatial.distance import cdist
from scipy.stats import kendalltau
from scipy.stats.mstats import spearmanr
def pearson(sfield, prob):
"""
Compute Pearson's correlation distance between the estimated density
and the scalar field on which to fit the density.
Correlation dis... |
<reponame>mscroggs/2D-Helmholtz-FEM-BEM-Coupling
from config import worldwide
from core import solve
from core import boundary
import cmath
from time import time
from math import log
from os.path import join
from numpy import array,linspace
from scipy import linalg
import matplotlib.pylab as plt
t00=time()
k=3
kc=k.c... |
<gh_stars>0
import matplotlib.pyplot as plt
import sys,os
sys.path.append('/home/asus/lyndon/program/Image2Depth/dataloader')
from dataloader.image_folder import make_dataset
import numpy as np
import scipy.misc
dataRoot = '/data/dataset/Image2Depth31_KITTI/testB'
dispairtyRoot = '/data/result/disparities_eigen_godard... |
<gh_stars>1-10
# Time: O(1)
# Space: O(1)
# There is a special square room with mirrors on each of the four walls.
# Except for the southwest corner, there are receptors on each of
# the remaining corners,
# numbered 0, 1, and 2.
#
# The square room has walls of length p,
# and a laser ray from the southwest corner f... |
<filename>CPA.py
import matplotlib.pyplot as plt
import numpy as np
from itertools import product, combinations
import matplotlib.tri as tri
import pendulum
import gurobipy as grp
from gurobipy import GRB
from scipy.spatial import Delaunay
'''
Reference: <NAME> et al. Continuous and Piecewise Affine Lyapunov Functions... |
import discord
import random
import math
import sympy
from sympy import *
from sympy.parsing.sympy_parser import parse_expr
from fractions import Fraction
from discord.ext import commands
class Math_Cog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 11 08:54:47 2020
@author: essys
"""
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import cv2
import tensorflow as tf
from tensorflow import keras
import numpy as np
import pathlib
import matplotlib.pyplot as plt
from box_utils import decode, co... |
# 'import contents in test1'
# from test import Student
# student=Student()
# print(Student.name)
# print(str(Student.age))
# student.print_file()
# '先定义student=Student()再调用'
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
#np.all(np.diff(xp) > 0)
# xp = [1, 2, 3]
# fp = [3, 2, 0]
# a=... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\objects\components\inventory_type_tuning.py
# Compiled at: 2020-02-04 00:24:58
# Size of source mod ... |
<gh_stars>1-10
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import math
from scipy.special import fresnel
from scipy import optimize
def dot(v1, v2):
return sum((a*b) for a, b in zip(v1, v2))
def length(v):
return math.sqrt(dot(v, v))
def angle(v1, v2):
return ... |
<filename>prob.py<gh_stars>0
import numpy as np
import collections
import scipy.stats as stats
import matplotlib.pyplot as plt
x = [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9]
#calculate frequency
c = collections.Counter(x) #print(c)
# calculate the number of insta... |
<reponame>esmondhkchu/vdm3
import pytest
from vdm3 import *
import pandas as pd
import numpy as np
from scipy.special import comb
##########################################################
################# Test X variable type ###################
##########################################################
var1 = pd... |
<filename>papers/ICML18-PoissonSampling/exp_rdp.py<gh_stars>100-1000
# This set of experiments compare subsampled gaussian of naive composition, CGF composition and asymp CGF composition
import math
from autodp import rdp_acct, rdp_bank, dp_acct, privacy_calibrator, utils
from scipy.optimize import minimize_scalar
i... |
import threading
import numpy as np
import os
import io
from flask import Flask, request, render_template, redirect, Response
from flask_classful import FlaskView, route
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.mlab import griddata
from matplotli... |
<reponame>chagaz/sfan
""" generate_data.py: Generate test data for multitask_sfan.
"""
import argparse
import logging
import numpy as np
import os
import tables as tb
import scipy.stats as st
import sys
NUM_CAUSAL_TOTAL = 30 # total number of causal features
NUM_CAUSAL_EACH = 20 # how many of these features are caus... |
<gh_stars>0
#!/usr/bin/env python3
"""
This script requires describegraph.json and will generate its own config file.
Running on node hardware is not recommended, copy describegraph.json to a
desktop.
This script attempts to find peers that will substantially improve a node's
betweenness centrality. This does not guar... |
import os
import sys
import re
import json
import math
from difflib import SequenceMatcher
import plotly.graph_objects as go
import requests
import networkx as nx
import pandas as pd
import numpy as np
import scipy
import matplotlib
import matplotlib.pyplot as plt
from ipywidgets import interactive, HBox, VBox
import... |
import scipy.io
import autograd.numpy as np
from ssm.util import split_by_trials
import ssm
import os.path
import smartload.smartload as smart
from tqdm import tqdm
def sigmoid(x, mu, sigma, lapse=0):
return lapse + (1-2*lapse) / (1 + np.exp(-(x - mu) * sigma))
def get_id_range(filepath):
'''
identify the... |
"""
Test adding 4D followed by 5D image layers to the viewer
Intially only 2 sliders should be present, then a third slider should be
created.
"""
import numpy as np
from skimage import data, measure
import napari
import scipy.ndimage as ndi
image = data.binary_blobs(128, n_dim=3)
verts, faces, normals, values = (
... |
<filename>old/scripts/strain2.py
import thermoplotting as tp
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as p3
import matplotlib.ticker as ticker
from scipy import ndimage
from scipy import interpolate
from matplotlib import cm
from matplotlib.colors import LogNorm
datadump=n... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 02 11:20:13 2017
@author: humberto
"""
import scipy.io as sio
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
number_of_neighbors = [2**i for i in range(0, 10)]
l_constraint = []
l_nn = []
l_st = []
l_solver = []
for solver in ['mosek', 'CDCS']:... |
<reponame>mdlama/pydstool<gh_stars>1-10
"""Event handling for python-based computations, and specification for
both python and externally compiled code. (Externally compiled code
may include its own event determination implementation.)
"High-level" events are built in native Python function format.
"Low-level" events ... |
<reponame>jurgjn/hotspots
'''
The main class of the :mod:`hotspots.grid_extension.Grid`.
This is an internal extension of :class:`ccdc.grid.Grid` that adds in potential new _features
for review and development. For example, gaussian smoothing function:
.. code-block:: python
#
# >>> from ccdc_development impo... |
import imageio
import torch
from tqdm import tqdm
from animate import normalize_kp
from demo import load_checkpoints
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from skimage import img_as_ubyte
from skimage.transform import resize
import cv2
import os
import argparse
impo... |
'''
Created on Apr 24, 2021
@author: <NAME>
'''
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
def StatorMaterial(main):
"""This function adds the stator material
Args:
main (Dic): Main dictionary used to upload the information
Returns:
Dic: Sa... |
# C2SMART Lab, NYU
# NCHRP 03-137
# @file DRAC_Calculation_Offline.py
# @author <NAME>
# @author <NAME>
# @date 2020-10-18
import pandas as pd
import numpy as np
from shapely.geometry import Polygon
import math
import time
import multiprocessing as mp
from itertools import repeat
from scipy import spatial
def... |
from scipy import stats
from permute.core import one_sample, two_sample
def get_exception(test_name):
return Exception(f"Can't run a {test_name}. Incorrect data. " +
"Only binary classification supported atm")
def check_paired_sample_format(data):
return len(data) == 2 and all(len(x) =... |
# MIT License
# Copyright (c) 2018 <NAME>, <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
"""
See end of https://github.com/JuliaDiffEq/SciPyDiffEq.jl/commit/8e623731387927fbe586291207bbb3fb7732f525
Actually no failure...
"""
from scipy.integrate import solve_ivp
from transonic.util import timeit_verbose as tiv
def rober(t, u):
k1 = 0.04
k2 = 3e7
k3 = 1e4
y1, y2, y3 = u
dy1 = -k1 *... |
from sympy import (
sqrt,
sin,
cos,
diff,
conjugate,
mathieus,
mathieuc,
mathieusprime,
mathieucprime,
)
from sympy.abc import a, q, z
def test_mathieus():
assert isinstance(mathieus(a, q, z), mathieus)
assert mathieus(a, 0, z) == sin(sqrt(a) * z)
assert conjugate(math... |
<filename>day11.py
from encodings import search_function
import re
from collections import Counter
import statistics
from typing import KeysView
from collections import deque
from math import prod
def parse_data(data:list):
parsed_data = []
for row in data:
parsed_data.append([int(state) for state in ... |
<reponame>kobewangSky/CenterNet<filename>filter_origin.py
import cv2
import time
import numpy as np
from scipy import ndimage
from scipy import signal
from multiprocessing import Pool, cpu_count
import matplotlib.pyplot as plt
import math
import glob
import os
# cnn parameter
# v1 parameter
window_v1 = [[[[0.0777, -0... |
<filename>scripts/drain_rois.py
#!/usr/bin/python
#-------------------------------------------------------------------------------
#License GPL v3.0
#Author: <NAME> <<EMAIL>>
#Grupo de Inteligencia Computational <www.ehu.es/ccwintco>
#Universidad del Pais Vasco UPV/EHU
#Use this at your own risk!
#--------------------... |
import os
from statistics import mean
from aalpy.SULs import DfaSUL
from aalpy.learning_algs import run_Lstar
from aalpy.oracles import StatePrefixEqOracle
from aalpy.utils import load_automaton_from_file
dfa_1000_states_20_inputs = '../DotModels/DFA_1000_states_20_inp'
dfa_2000_states_10_inputs = '../DotModels/DFA_2... |
"""Program for conducting Link Prediction over datasets downloaded from AsymProj
It constructs implicit matrix M^{WYS}, as described in our paper.
These datasets originally come from node2vec but we use the AsymProj train/test
partitions for consistency (node2vec, unfortunately, did not publish the splits
however the... |
<reponame>mpompolas/to_nwb<gh_stars>1-10
from scipy.io import loadmat
import numpy as np
from h5py import File
def load_wavs(raw_path, elecs=None):
try:
return load_wavs_mat(raw_path, elecs)
except:
return load_wavs_h5py(raw_path, elecs)
def load_wavs_mat(raw_path, elecs=None):
out = []... |
<gh_stars>0
from numpy.matlib import randn
from scipy.stats import binom
import numpy as np
import matplotlib.pyplot as plt
uniformskew = np.random.rand(100)*100-40
high_outlier = np.random.rand(10)* 50 + 100
low_outlier = np.random.rand(10)* -50 -100
data = np.concatenate((uniformskew, high_outlier, low_outlier))
plt... |
<reponame>adgilbert/med-seg<gh_stars>0
import logging
import os
from abc import abstractmethod
from typing import Callable, Tuple
import cv2
import numpy as np
import pandas as pd
import scipy.stats as st
import torch
from scipy.spatial.distance import cosine as cosine_dist
from scipy.spatial.distance import directed_... |
<gh_stars>1-10
import numpy as np
import cv2
from scipy.special import expit, logit
from scipy import stats
import logging
logger = logging.getLogger(__name__)
from ipso_phen.ipapi.base.ipt_abstract import IptBase
from ipso_phen.ipapi.base.ip_common import (
all_colors_dict,
ToolFamily,
)
CHA... |
<reponame>rfschubert/brumadinho_location<filename>backend/utils.py
import numpy as np
from scipy import interpolate
X = np.linspace(-20.139558, -20.115769, 1000)
Y = np.linspace(-44.141856, -44.099738, 1000)
Z = np.array([100.0, 50.0, 50.0, 25, 100.0])
DAM = [-20.119026, -44.119985]
X, Y = np.meshgrid(X, Y)
NPTS = ... |
<gh_stars>0
import pandas as pd
from scipy.signal import spectrogram
from scipy.io import wavfile
class CSVProcessor(object):
# csv file manipulation
def __init__(self, csv_path):
self.csv_path = csv_path
self.df = pd.read_csv(csv_path)
def add_label(self, label, value, position):
self.df.insert(position, l... |
import os
import numpy as np
from collections import Counter
from collections import defaultdict
import matplotlib.pyplot as plt
from scipy.spatial.distance import cosine
if __name__ == '__main__':
LANGUAGES_DICT = {'en': 0, 'fr': 1, 'es': 2, 'it': 3, 'de': 4, 'sk': 5, 'cs': 6}
def decode_langid(lan... |
import cobra
from fractions import Fraction
def ReadScrumPyModel(spy_file, compartment_dic={}, Print=False, AutoExt=True):
"""
Take a ScrumPy model file generated in ScrumPy with m.smexterns.ToScrumPy()
Cannot take a master model file with links to children files
Does not work if the model file is not ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
OptExp (c) University of Manchester 2018
OptExp is licensed under the MIT License.
To view a copy of this license, visit <http://opensource.org/licenses/MIT/>
Created on Tue Nov 27 16:01:46 2018
@author: pablo
"""
import numpy as np
import pandas as pd
import itert... |
"""Performing spectral clustering on neural networks and calculating its p-values."""
import numpy as np
import math
#from multiprocessing import Pool
from pathos.multiprocessing import ProcessPool
import scipy.sparse as sparse
from utils import splitter, load_weights, compute_pvalue
from sklearn.cluster import Spect... |
#!/usr/bin/python
# -*-coding: utf-8 -*-
# Author: <NAME>
# Email : <EMAIL>
import sys
import numpy as np
import scipy as sp
import pytest
import pandas as pd
from .._stats_tools import effsize
from .._classes import TwoGroupsEffectSize
# Data for tests.
# See Cumming, G. Understanding the New Statistics:
# Effect... |
from scipy import optimize
import matplotlib.pyplot as plt
import numpy as np
def tested_function(x):
"""
Testovana funkce
Da se sem napsat vselijaka cunarna
"""
freq = 1
damp_fac = 0.1
val = np.sin(freq * x)
damp = np.exp(-1 * damp_fac * abs(x))
return val * damp
# kolikrat hodl... |
<filename>porespy/filters/_ibip.py<gh_stars>100-1000
import numpy as np
from edt import edt
from porespy.tools import get_tqdm
import scipy.ndimage as spim
from porespy.tools import get_border, make_contiguous
from porespy.tools import Results
import numba
from porespy import settings
tqdm = get_tqdm()
def ibip(im, i... |
import cv2
import os
import scipy.stats as st
import numpy as np
from scipy.ndimage.filters import convolve
from multiprocessing import Pool
def gkern(kernlen=21, nsig=3):
"""Returns a 2D Gaussian kernel."""
x = np.linspace(-nsig, nsig, kernlen+1)
kern1d = np.diff(st.norm.cdf(x))
kern2d = np.outer(ker... |
import numpy as np
from .utils import print_vector, cvxopt_solve_lp
import time
from scipy.optimize import linprog
class ExchangesSolver:
def __init__(self, grid, x_opt_dist, x_opt_dep, x_opt_hub, supplier_distances, destination_distances):
self.grid = grid
self.x_opt = np.hstack([x_opt_dist, x_opt_... |
"""
Preprocessing Tutorial
======================
Before spike sorting, you may need to preproccess your signals in order to improve the spike sorting performance.
You can do that in SpikeInterface using the :py:mod:`spikeinterface.toolkit.preprocessing` submodule.
"""
import numpy as np
import matplotlib.pylab as p... |
#! /usr/bin/env python3
import cv2
from scipy.misc import imsave
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os.path as osp
import openslide
from pathlib import Path
from skimage.filters import threshold_otsu
import glob
#before importing HDFStore, make sure 'tables' is insta... |
<filename>causallib/preprocessing/filters.py<gh_stars>1-10
"""
(C) Copyright 2019 IBM Corp.
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 re... |
<gh_stars>10-100
import numpy as np
import tensorflow as tf
from scipy.special import expit
from sklearn.decomposition import PCA
flags = tf.app.flags
flags.DEFINE_string('output_data_file_name', 'processed_data.npz', 'Output data file name')
flags.DEFINE_integer('N', 10000, 'Number of vertices')
flags.DEFINE_integer(... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 27 10:41:17 2021
Pick the peak od CELIV from signal data extracted from background
Program work best when the square impulse in dark is at the beginning of the half of the signal
program will get error when the square impulse in dark is far end of the timescale
squarepulse... |
<filename>app1/plot_erlang_hist.py
from random import *
from math import *
from matplotlib.pyplot import *
from statistics import *
def Erlang():
k = 10
theta = 1.0
y = 0
for i in range(k):
u = random()
x = (-1 / theta) * log(u) # Exponential variate
y = y + x
return y
... |
<reponame>shrishabh/tetrahedron
import numpy as np
import scipy as sp
from scipy.integrate import ode
import matplotlib.pyplot as plt
from numpy import linalg as LA
import PhysConst as PC
import random
import cmath
import math
## A class for generating elements of SU(N)
# A class for generating elements o... |
import numpy as np
from scipy.signal import resample, blackmanharris, triang
from scipy.fftpack import fft, ifft, fftshift
import math, copy, sys, os
from scipy.io.wavfile import write, read
from sys import platform
import subprocess
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), './utilFunct... |
# Como executar:
# $ python hist.py img_1.tif
import sys
import matplotlib.pyplot as plt
from scipy import misc
def loadImg(arg):
return misc.imread(arg)
# Lê a imagem a partir de um arquivo
img_1 = loadImg(sys.argv[1])
saida = 'histograma.tif'
# Transforma os níveis de intensidade numa imagem de uma dimensão
... |
<gh_stars>0
import os
import scipy.io as sio
import pandas as pd
import urllib
#download Data from GEO
geo_url = "ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE110nnn/GSE110823/suppl/GSE110823_RAW.tar"
local_file = "GSE110823_raw.tar"
urllib.request.urlretrieve(geo_url, local_file)
os.system(command = "tar xf {}".format(lo... |
<filename>tools/make_contours.py
# copeied from the RGZ git hub:
#
# https://github.com/zooniverse/Radio-Galaxy-Zoo/blob/master/scripts/make_contours.py
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
import glob
import json
import numpy as np
from astropy.io import fi... |
import scipy.stats
import numpy as np
def welch_t_test(samples_x, samples_y, diff: float = 0.0, tail: str = "both"):
assert tail in {"both", "left", "right"}
mean_x = np.mean(samples_x)
mean_y = np.mean(samples_y)
n_x = len(samples_x)
n_y = len(samples_y)
var_x_norm = np.var(samples_x, ddof... |
<reponame>jagunnels/qiskit-sdk-py<filename>qiskit/qasm/node/binaryop.py<gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""Node for an OPENQASM binary operation e... |
<reponame>jfilter/hyperwords<gh_stars>1-10
from docopt import docopt
from scipy.sparse import dok_matrix, csr_matrix
import numpy as np
import sys
from representations.matrix_serializer import save_matrix, save_vocabulary, load_count_vocabulary
def main():
args = docopt("""
Usage:
counts2chi.py [opti... |
import numpy as np
from scipy.special import expit
from scipy.optimize import curve_fit
from warnings import warn, filterwarnings, catch_warnings, simplefilter
from functools import lru_cache
# plotting
import matplotlib.pyplot as plt
from matplotlib import cm as mplcm
from matplotlib import gridspec
import matplotli... |
'''
Functions used to plot the player's data
'''
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Rectangle, Arc
from matplotlib.offsetbox import OffsetImage
from scipy.stats import kde
import numpy as np
from PIL import Image
import process_data as process_data
'''
Fun... |
<gh_stars>0
from algo.EGAD import EGAD
from evaluate.MLPEvaluation import MLPEvaluation
from utils.dataset.GraphLoader import GraphLoader
import torch
import torch.optim as optim
from torch import nn
import scipy.sparse as sps
import numpy as np
import random
from utils.utils import sparse_mx_to_torch_sparse_tensor, s... |
<filename>movie_rating/movie_rating/settings.py
"""
Django settings for movie_rating project.
Generated by 'django-admin startproject' using Django 3.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https:/... |
<reponame>DLR-RM/moegplib<filename>src/moegplib/clustering/kernelkmeans.py
""" This files contain clustering method that works on the latent variable itself.
"""
import scipy
import numpy as np
from sklearn.cluster import KMeans
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.base import BaseEstimat... |
#!/usr/bin/env python
# encoding: utf-8
import scipy.io as sio
import numpy as np
import struct
print("Loading mat files.")
model_info = sio.loadmat('./3DDFA/model_info.mat',matlab_compatible=True)
bfm = sio.loadmat('./BaselFaceModel/01_MorphableModel.mat',matlab_compatible=True)
model_expr = sio.loadmat('./3DDFA/Mo... |
import numpy as np
from scipy.fftpack import fft
import matplotlib.pyplot as plt
from numpy import array
import sys
import os
file_name = sys.argv[1]
r_file = open(file_name, "r")
lines = r_file.readlines()
stripped = lines[3].strip()
data_in = stripped.split()
data_in = data_in[0:256]
for i in range(0,len(data_in)... |
desc = """Animations of black hole spin evolution for precessing binary black holes.
Example usage:
python precession_tracking.py --q 2 --chiA 0.2 0.7 -0.1 --chiB 0.2 0.6 0.1
"""
import numpy as np
import matplotlib.pyplot as P
import argparse
from scipy.interpolate import UnivariateSpline
from scipy.interpolate imp... |
<gh_stars>1-10
# pylint: disable=e1101
import networkx as nx
import numpy as np
import scipy.io as sio
import scipy.sparse as sp
import scipy.sparse.linalg as lg
from . import graph as g
import tensorflow as tf
from sklearn.preprocessing import normalize
__author__ = "<NAME>"
__email__ = "<EMAIL>"
class HOPE(object)... |
import cv2
import numpy as np
from sklearn.neighbors import NearestNeighbors
#from scipy.optimize import leastsq
from scipy.optimize import fmin_bfgs
from scipy.optimize import minimize
from scipy.optimize import approx_fprime
def res(p,src,dst):
T = np.matrix([[np.cos(p[2]),-np.sin(p[2]),p[0]],
... |
<filename>predict.py
import logging
import os
import numpy as np
from easydict import EasyDict as edict
from skimage.filters import threshold_otsu
from scipy import ndimage
from models.seq2seq_model import Seq2SeqAttModel
class ConfigSeq2Seq:
def __init__(self, data_type, gpu, encoder_type='conv'):
self._d... |
<filename>seekr2/tests/test_markov_chain_monte_carlo.py
"""
test_markov_chain_monte_carlo.py
Unit tests for the MCMC sampling algorithms to estimate error bars in
milestoning calculations.
"""
from collections import defaultdict
import pytest
import numpy as np
import scipy.linalg as la
import matplotlib.pyplot as ... |
import random
import pylab
import scipy.integrate
def gaussian(x, mu, sigma):
factor1 = 1.0 / sigma * ((2 * pylab.pi) ** 0.5)
factor2 = pylab.e ** -(((x - mu) ** 2) / (2 * sigma ** 2))
return factor1 * factor2
def check_empirical(num_trials):
for t in range(num_trials):
mu = random.randint(... |
import operator
from copy import copy
from scipy.special import softmax
class HMM_classifier():
def __init__(self, base_hmm_model):
self.models = {}
self.hmm_model = base_hmm_model
def fit(self, X, Y):
"""
X: input sequence [[[x1,x2,.., xn]...]]
Y: output classes [1, 2... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import scipy
import csv
import Statistics as stats
class ResultData():
def __init__(self, rps_scores, name):
self.rps_scores = rps_scores
self.name = name
def computeData(self):
self.uwm = [self.r... |
#Reader for the coco panoptic data set for pointer based image segmentation
import numpy as np
import os
import scipy.misc as misc
import random
import cv2
import json
import threading
############################################################################################################
def rgb2id(color): # Conv... |
<reponame>mafshar/xray-ensemble<gh_stars>1-10
import os
import sys
import glob
import time
import torch
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
from os.path import join
from os import listdir
from scipy.misc import imread, imresize, imsave
from torch.utils.data import ... |
#! python3
# coding: utf-8
# * =====================================================================================
# *
# * Filename: AMT_final.py
# *
# * Description: Python program for AMT2018 final thesis
# *
# * Version: 1.0
# * Created: 06/07/2018 07:09:10 PM
# * Revision: none
#... |
<reponame>whatbeg/Data-Analysis<gh_stars>1-10
from optparse import OptionParser
import os
import sys
import copy
import numpy as np
import pandas as pd
import scipy as sp
def get_data():
train_data = np.loadtxt('train_tensor.data', delimiter=',')
test_data = np.loadtxt('test_tensor.data', delimiter=',')
... |
import argparse
import numpy as np
import scipy.sparse
import timeit
import time
import sys
from bnpy.util.SparseRespUtil import sparsifyResp
from bnpy.util import dotATA
from bnpy.util.EntropyUtil import calcRlogR
from bnpy.util.ShapeUtil import as1D, toCArray
hasCPPLib = True
try:
from bnpy.util.lib.sparseResp.... |
<reponame>st34-satoshi/quixo-cpp<gh_stars>0
from scipy.special import comb
def read_file(file_name):
total_win = 0
total_loss = 0
total_draw = 0
# read each line
print("read each line")
with open(file_name) as f:
data_list = f.readlines()
p_win = 0
p_loss = 0
p_... |
<reponame>jjbrophy47/tree_influence
"""
Summarize correlations.
"""
import os
import sys
import time
import tqdm
import hashlib
import argparse
import resource
import seaborn as sns
from datetime import datetime
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.b... |
<reponame>liuzz1983/open_vision
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import sys
fileDir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(fileDir, ".."))
import argparse
from distutils.dir_util impo... |
<filename>Jupyter/handson_LH.py
#!/bin/python
# imports
from scipy import optimize, math
import numpy
import ROOT
from array import array
###############
# DEFINITIONS #
###############
# Poisson prob
def prob_poisson(n,mu):
if mu<=0 or n<0:
return 0
else:
p = 1
for i in range(0,len(... |
# -*- coding: utf-8 -*-
from sympy import Matrix, eye, symbols
from sympy.physics.units.dimensions import Dimension, DimensionSystem, length, time, velocity, mass, current, \
action, charge
from sympy.utilities.pytest import raises
def test_definition():
base = (length, time)
ms = DimensionSystem(base, ... |
<filename>simulator/per_machine_percentile_predictor.py
# Copyright 2020 Google LLC.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless r... |
<gh_stars>1-10
f#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 11 10:22:37 2018
@author: chrelli
"""
#%% Do all the imports
import time, os, sys, shutil
# for math and plotting
import pandas as pd
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import math
# small util... |
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, The QuTiP Project.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistribut... |
<gh_stars>100-1000
import os
os.environ['PATH'] = '../caffe/build/tools:'+os.environ['PATH']
import sys
sys.path = ['../caffe/python'] + sys.path
import cv2
import cv
import numpy as np
import shutil
import random
import leveldb
import caffe
from google import protobuf
from caffe.proto import caffe_pb2
from xml.dom im... |
<reponame>anandprabhakar0507/Assignments-Data-Driven-Astronomy-from-University-of-sydney-on-coursera-
from statistics import mean
fluxes = [23.3, 42.1, 2.0, -3.2, 55.6]
m = mean(fluxes)
print(m) |
import torch
print(torch.cuda.is_available())
from transformers import BertTokenizer, BertModel, GPT2Model, BertForMultipleChoice
import tqdm, sklearn
import numpy as np
import os, time, sys
import pickle
import multiprocessing
from multiprocessing import Process, Value, Manager
from itertools import chain
im... |
import os
import time
from argparse import ArgumentParser
from os import path
import cv2
import numpy as np
import scipy.io
import torch
from torch.utils.data import DataLoader
import model
from processing.jpeg_artifacts.loader import YcbCrLoader, ycbcr2bgr
from utils import tensor_to_np
parser = ArgumentParser()
pa... |
#! /usr/bin/env python
# coding=utf-8
#================================================================
# Copyright (C) 2019 * Ltd. All rights reserved.
#
# Editor : VIM
# File name : parser_voc.py
# Author : YunYang1994
# Created date: 2019-10-12 17:50:18
# Description :
#
#====================... |
<reponame>Franko1307/Contador-de-celulas-blancas-con-redes-neuronales-convolucionals<gh_stars>0
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Conv2D, MaxPooling2D, Lambda
from keras.layers import Dense
from keras.wrappers.sci... |
<filename>imaging_picking_function.py
#!/usr/bin/env python
import cv2
import os
import sys
import time
import scipy
import pickle
import random
import datetime
import numpy as np
import pandas as pd
from functools import partial
from sklearn import preprocessing, manifold, decomposition
from sklearn.mixture import Gau... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.