text string |
|---|
sigma=0.10895354
thres=0.103468491232405
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator
import scipy.integrate as integrate
import math
def R(x):
return (1+math.erf(x/(sigma*2)))/2
def F(x):
return -math.log(x)/R(x-thres)
plt.rcParams['figure.figsize'] = (8.... |
<reponame>cellimnet/scellseg-publish
import numpy as np
from . import utils, dynamics
from numba import jit
from scipy.optimize import linear_sum_assignment
from scipy.ndimage import convolve
import itertools, tabulate, logging, types, os, cv2
def mask_ious(masks_true, masks_pred):
""" return best-matched masks "... |
# 2 sample t-test using Midwest results
#reference : https://www.youtube.com/watch?v=8uUfHx3M0Jw
import numpy as np
from scipy import stats as st
a=min
MI = int(19.42)
OH = int(16.89)
#ttest=st.ttest_ind(MIDMeanresults,OHMeanresults)
t2, P2 =st.ttest_ind( MI ,OH ,equal_var=False)
print (t2, P2) |
import scipy
import time
from scipy import io
"""
This file is an example dataset loader file for YouTube. Create one file per
dataset in this directory, containing the load_data function.
The output format should be as given below.
"""
def load_data():
""" Loads YouTube data of users and group memberships
Ar... |
################################# LICENSE ##################################
# Copyright (c) 2009, South African Astronomical Observatory (SAAO) #
# All rights reserved. #
# #
# Redistribu... |
__author__ = "<NAME>"
__copyright__ = "Copyright (C) 2004 <NAME>"
from pdb import set_trace
import numpy as np
from scipy.linalg import polar, pinv2, solve_discrete_lyapunov, sqrtm
import math
from scipy import io
def projectPSD(Q, epsilon = 0, delta = math.inf):
Q = (Q+Q.T)/2
[e, V] = np.linalg.eig(Q)
... |
import matplotlib.pyplot as plt
import yaml
import numpy as np
from scipy.signal import savgol_filter
file_list = [
["results/ib_optim/noniid_mnistLT_svrg_LR0.01_HLR0.02_N3_IT3_LE5_OT1_global_batch_0.yaml",
"results/ib_optim/noniid_mnistLT_svrg_LR0.01_HLR0.02_N3_IT3_LE5_OT1_global_batch_1.yaml",
],
["r... |
<filename>ols.py
# coding=utf-8
"""
Ordinary least squares.
"""
import numpy as np
from scipy.stats import t
def ols():
"""
Perform OLS with steps.
"""
n = int(input("Ilość wierszy: "))
m = int(input("Ilość kolumn: "))
matrix = []
for _ in range(n):
row = [int(x) for x in input()... |
import os
import re
import csv
import numpy as np
import pandas as pd
import tensorflow as tf
import config
from scipy import spatial
import operator
def parse_row(row, line_count, other):
citations = np.array([0] * config.tags_number)
id, title, citeid, raw_title, abstract = row[0], row[1], row[2], row[3], r... |
# -----------------------------------------------------------------------------
# Copyright (c) 2017, <NAME>. 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. Redistributions of source code mu... |
<gh_stars>10-100
import numpy as np
import scipy.sparse as sp
from pygcn.utils import normalize
'''测试归一化函数'''
# 读取原始数据集
path="C:/Users/73416/PycharmProjects/PyGCN_Visualization/data/cora/"
dataset = "cora"
idx_features_labels = np.genfromtxt("{}{}.content".format(path, dataset),
... |
#!/usr/bin/env python
from forceatlas2 import forceatlas2_networkx_layout
from scipy.spatial import Voronoi
from scipy.spatial import Delaunay
from sklearn import mixture
import matplotlib.pyplot as plt
import numpy as np
import networkx as nx
from eden.display import draw_graph
def plot_pdf2D(mtx, n_components=10, ... |
import os
import argparse
import math
import numpy as np
import pandas as pd
import json
from tqdm import tqdm
import scipy.sparse as sp
from pathlib import Path
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.nn.functional as F
from sklearn.metrics i... |
import logging
import math
import os
import shutil
import time
import cv2
import imageio
import numpy as np
import scipy.sparse
import tensorflow as tf
import utils
from lib import graph, mesh_renderer
from lib.mesh_io import write_obj
logger = logging.getLogger('x')
class BaseModel():
"""
Mesh Convolutional... |
import time
import numpy as np
import cytnx as cy
from ncon import ncon
from numpy import linalg
from scipy.sparse.linalg import LinearOperator, eigsh, eigs, bicgstab
'''
1. Need Arnoldi
2. Need bicgstab or gmres (LW and RW are calculated in numpy)
3. Lanczos_ER much slower than scipy.eigsh, Lanczos_Gnd doesn't work.
... |
<reponame>jhwnkim/nanopores
# (c) 2017 <NAME>
"""Generic framework to define, fit, sample, and plot statistical models;
especially suited for compound models, models which include complicated
machinery, and generally models that are not analytically tractable.
Uses simulated annealing as generic parameter search (fitti... |
<filename>HandSegmentation.py<gh_stars>0
"""
hand segmentation codes
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import os
import sys
import argparse
import csv
# insert at 1, 0 is the script path (or '' in REPL)
sys.path.insert(1, '... |
<filename>Linear Utility.py
import matplotlib.pyplot as plt
import numpy as np
from sympy import *
#from colorama import *
print("hi")
class Linear_Utility(object):
print("Welcome to the Linear Utility Model") # changes color of display text
print("created by <NAME>")
print("-"*40)
def __init__(self, ... |
<filename>poly_regression.py
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import sympy as sp
from sympy.abc import x as spx
import argparse
import os
# Define and parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('--input', help='The path to the input data file (csv) r... |
<filename>assignments/a4/Q2.py<gh_stars>1-10
import numpy as np
from scipy.special import expit
from scipy.optimize import minimize
from scipy.stats import multivariate_normal
import csv
import pandas as pd
##########################################################################################################
#####... |
"""
This module implements cubic regularization of Newton's method, as described in Nesterov and Polyak (2006) and also
the adaptive cubic regularization algorithm described in Cartis et al. (2011). This code solves the cubic subproblem
according to slight modifications of Algorithm 7.3.6 of Conn et. al (2000). Cubi... |
<reponame>chihyunsong/oc-nn
import numpy as np
import pandas as pd
from sklearn import utils
import matplotlib
from scipy.optimize import minimize
dataPath = './data/'
colNames = ["sklearn-OCSVM-Linear-Train","sklearn-OCSVM-RBF-Train","sklearn-OCSVM-Linear-Test","sklearn-OCSVM-RBF-Test","sklearn-explicit-Linear-Tra... |
import torch
import librosa
import warnings
import torchaudio
import numpy as np
from pathlib import Path
from scipy.ndimage import affine_transform
from torchaudio.transforms import Spectrogram
from svd.utils.labels import create_aligned_targets
from torch.utils.data import IterableDataset, Dataset
torchaudio.set_aud... |
<reponame>niyue/skillmap
from skillmap.nodes.common import get_icon, get_node_content, get_required_node_edges
from fractions import Fraction
from enum import Enum
from skillmap.nodes.progress_bar import PROGRESS_BAR_STYLES
class SkillStatus(Enum):
NEW = "new"
BEING_LEANRED = "beingLearned"
LEARNED = "lea... |
<reponame>willietheboy/srlife<gh_stars>0
"""
Module with methods for calculating creep-fatigue damage given
completely-solved tube results and damage material properties
"""
import numpy as np
import scipy.optimize as opt
import multiprocess
class DamageCalculator:
"""
Parent class for all damage calculat... |
# Example of using distributed work queue distwq
# PYTHONPATH must include the directories in which distwq and this file are located.
import sys, pprint
import distwq
import numpy as np
import scipy
from scipy import signal
from mpi4py import MPI
nprocs_per_worker = 3
def do_work(freq):
rng = np.random.RandomS... |
from . import X, Y, Z, H, I, PHASE, T, RX, RY, RZ
from . import CustomGate
import numpy as np
import pytest
import sympy
@pytest.mark.parametrize(
"qubit",
[0, 1, 2, 3, 4, 5, 10, 11, 12, 99, 100, 101],
)
def test_X_gate_has_correct_matrix(qubit):
assert X(qubit) == CustomGate(sympy.Matrix([[0, 1], [1, 0]]... |
<reponame>ernoe99/WP-Jumbo
from CoolProp.HumidAirProp import HAPropsSI
from CoolProp.CoolProp import PropsSI, PhaseSI
import math
from scipy.optimize import fsolve
from TurboCor import AVB87DA203_50kW # Mitsubishi Kompressor R32
import HeatExchanger
import Fluids
import Fluide
# The classes
class iwt: # speci... |
'''
Created on Jul 3, 2019
@author: Hazem
'''
import numpy as np
import time
from numba import njit,guvectorize,float64
import scipy.optimize as opt
from matplotlib import pyplot as plt
import pdb
import csv
#Set
t = np.arange(1, 101)
NT = len(t)
#Parameters
fosslim = 6000 # Maximum cumulative extraction fossil fu... |
<filename>LeaveOneOut_acc.py
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 2 18:17:29 2019
@author: JIAN
"""
import torch
import scipy.io as sio
import numpy as np
from sklearn.metrics import accuracy_score
from sklearn.model_selection import GridSearchCV
from skorch import NeuralNetClassifier
import torch.optim as ... |
<reponame>swkang73/bcbn<filename>preprocessing.py
import numpy as np, pandas as pd
from scipy import stats
"""
Notes on Analysis:
- we have mean, se, & worst on radius, texture, perimeter, area, smoothness, compactness,
concavity, concave points, symmetry, fractal dimensions
1st preprocessing: normalize each columns... |
import os.path
from PIL import Image
from torch.utils import data
from scipy.io import loadmat
from .utils import register_dataset_obj, register_data_params
from .utils import DatasetParams
@register_data_params('synnum')
class SYNNUMParams(DatasetParams):
num_channels = 3
image_size = 32
#mean = ... |
import numpy as np
import random
import scipy.stats as ss
import matplotlib.pyplot as plt
# This script finds the proportion of customers who arrive in different time intervals
# minutes before departure for all customers (generating using minutes_before_dep.py)
f = file('min_before_departure_list.txt', 'r+')
arrival... |
<reponame>sherryyyu/mmsd-dl
import os
import sys
# print('Current working path is %s' % str(os.getcwd()))
from statistics import mean
sys.path.insert(0,os.getcwd())
import matplotlib.pyplot as plt
eda_shift120 = [0.549,
0.712,
0.570,
0.550,
0.728,
0.415,
0.268,
0.480,
0.507,
0.830... |
<filename>bioinformatics/hypothesis_test/binomial_test.py
from scipy import stats
import scipy
from scipy.stats import distributions
import numpy as np
def binom_test(x, n=None, p=0.5, alternative='two-sided'):
print x, n, p , alternative
"""
Perform a test that the probability of success is p.
This... |
<gh_stars>0
#! /usr/bin/env python
# torus: https://en.wikipedia.org/wiki/Torus
import numpy as np
from scipy.stats import norm
import logging
from .base import BaseSimulator
from .utils import NumpyDataset
from scipy.special import i0
logger = logging.getLogger(__name__)
class ThinSpiralSimulator(BaseSimulator):
... |
<reponame>ds17/reptiles
#D:\Python\Python35\python.exe
# -*- coding:utf-8 -*-
import requests,re,csv,os
import jieba.analyse
from wordcloud import WordCloud
from scipy.misc import imread
import matplotlib.pyplot as plt
def get_cookie():
cookies = {}
filePath=r'd:\cookies\getweibo cookie.txt'
file=open(fi... |
#!/usr/bin/env python3
"""Turn completion files into actual SxS videos of the completion, the ground
truth, etc. Probably shares a lot with the other completion video scripts."""
import argparse
import json
import os
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import loadmat
import addpaths # n... |
# -*- coding: utf-8 -*-
"""
:Author: <NAME>
:Date: 2018. 1. 24.
"""
import numpy as np
import pandas as pd
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
from sklearn.linear_model import Ridge, LogisticRegression, Lasso
from s... |
# Copyright (c) 2017 <NAME>
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMA... |
from scipy.stats import binom
from matplotlib import pyplot as plt
import numpy as np
def plot_with_uniform_band(values, ci_level, x_label, n_bins=30, figsize=(10,4), ylim=[0, 50]):
'''
Plots the PIT/HPD histogram and calculates the confidence interval for the bin values, were the PIT/HPD values follow an unif... |
<filename>build/lib/more/scikit_helper/cluster/plot_elbow_curve.py<gh_stars>1-10
"""
Code modified from: https://github.com/reiinakano/scikit-plot
Modifications made to support running for Hierarchical Clustering
as well as support for plotting Silhoutte Score
The :mod:`scikitplot.cluster` module includes plots built ... |
<reponame>nshawen/RTOUtil
import pandas as pd
import numpy as np
from scipy.stats import mode
from scipy.signal import correlate, correlation_lags
from .ProcessingFunctions import getInclinations, getMagnitude
from .Constants import *
from .BaseFeature import Feature
# Abstract classes (meant to be inherited only)
cl... |
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sympy.solvers import solve
from sympy import Symbol
from matplotlib import patches
import matplotlib.patches as mpatches
import scipy.io as sio
# plotting
figure_len, figure_width = 15, 12
font_size_1, font_size_2 = 36, 36
legend_size = 18
l... |
<reponame>Aaron506/caltech-ee148-spring2020-hw02
import os
import json
import numpy as np
# Aaron added
import pdb
from scipy.sparse.csgraph import maximum_flow, maximum_bipartite_matching
from scipy.sparse import csr_matrix
from PIL import Image, ImageDraw, ImageFont
import matplotlib.pyplot as plt
def visualizePR(p... |
<reponame>Babayaga-mp4/Greedy-Pursuit-Algorithms-for-Sparse-Coding
from pyarma import *
def omp(dictionary, image, variance):
r = image
samples = image.n_cols
column = dictionary.n_cols
row = dictionary.n_rows
A_reduced = mat(row, 0, fill.none)
X_hat = mat(column, samples, fill.zeros)
s = ... |
from __future__ import annotations
import torch
import numpy as np
from scipy.sparse import lil_matrix, csr_matrix
import logging
from sequence.utils.general import TqdmLoggingHandler
import tqdm
import dask.array as da
import dask
from torch.utils.data import Dataset as TorchDataSet
from typing import Any, TYPE_CHECKI... |
"""
Perturbations
Add random perturbations to the dataset to make the classifier more robust.
- idea taken from Google's "Explaining and Harnessing Adversarial Examples"
https://arxiv.org/pdf/1412.6572v3.pdf
"""
import numpy as np
from scipy.ndimage import interpolation
SKEW_MEAN = 0.26
SKEW_SIGMA = 0.01
def pert... |
<gh_stars>1-10
#!/usr/bin/python
# spatial.py
'''
Defines core spatial classes, with their associated methods and supporting
functions
'''
# geonomics imports
# other imports
import numpy as np
import numpy.random as r
from numpy import pi
from scipy.stats import vonmises as s_vonmises
from collections import Counte... |
import os
import sys
import cv2
import json
import numpy as np
from scipy.io import savemat
import matplotlib.pyplot as plt
import matplotlib.patches as patches
_GRAY = (218, 227, 218)
_GREEN = (18, 127, 15)
_WHITE = (255, 255, 255)
## -----------------------------------------------------------------------------
de... |
<reponame>prahalad12345/yadv-dicom-imageprocessing<filename>yadv_multidicom_analyzer.py
# YYYYYYY YYYYYYY DDDDDDDDDDDDD VVVVVVVV VVVVVVVV
# Y:::::Y Y:::::Y D::::::::::::DDD V::::::V V::::::V
# Y:::::Y Y:::::Y D::... |
#!/usr/bin/python
import networkx as nx
from networkx.generators.random_graphs import *
import matplotlib.pyplot as plt
from scipy import integrate
#import pylab as p
import numpy as np
import random
#import numpy.random
#import time
import sys
import ast
import odespy
import simplejson as json
import sqlite3
import ma... |
# -*- coding: utf-8 -*-
""" Functions for calculating macroscopic properties of atomic ensembles from
solutions of the optical Bloch equations.
<NAME> <<EMAIL>>
"""
from scipy import exp, log10, sqrt, pi
from scipy import constants as si
### Constants
a_0 = si.physical_constants['Bohr radius'][0] # [m] Bohr radius... |
<reponame>jessicaleete/numerical_computing
import scipy as sp
import numpy as np
from scipy.fftpack import fft, ifft
from scipy.io import wavfile
from matplotlib import pyplot as plt
from pyfftw.interfaces import scipy_fftpack as fftw
#=============================================================================
# PR... |
"""
Register a user interaction
"""
import json
import logging
import subprocess
import os
from scipy.io.wavfile import read
import numpy
import requests
from admin.notify_admin import NotifyAdmin
from admin.admin import Admin
from checks import CheckResident, CheckCondo
from db.schema import create_resident, residen... |
import chaosmagpy
import shtns
import pyshtools as pysh
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from paropy.plot_utils import rad_to_deg, get_Z_lim
import scipy.special as sp
import numpy as np
lmax = 20
nphi = 480
ntheta = 200
fig_aspect = 0.8
n_levels = 30
def get_grid(nphi=256, ntheta=128):
... |
import numpy as np
import scipy.signal as sp
from .common import *
class Procressor:
def __init__(self, kernel):
self.kernel = kernel
kernelSize = len(self.kernel)
self.delay = kernelSize // 2
self.delayed = 0
if(kernelSize < 3):
raise ValueError("length of ker... |
<reponame>Amdis23/Tapestry_Intial
# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=8
from scipy.stats import binom
def get_d_for_n_p(n, p):
b = binom(n, p)
mean = b.mean()
std = b.std()
max_d = mean + 2 * std
print("n = %d, d_expect = %.1f, d_std = %.1f, d_max = %.1f" % (n, mean, std, max_d))
for n in [... |
import sys
import csv
import numpy as np
import gpflow
import os
import pandas as pd
import h5py
from sklearn.model_selection import train_test_split
import tensorflow as tf
from scipy.cluster.vq import kmeans
tf.set_random_seed(1234)
import pickle
import argparse
#Model to train the individual Policy and Value Functi... |
'''
Created on Jun 2, 2017
@author: zwieback
'''
import numpy as np
from scipy.interpolate import BSpline
def fractional_year(date):
# from 0 (1 Jan) to 1 (31 Dec); leap year/edge effect handling not perfect
try:
return np.array([np.min([1.0,date1.timetuple().tm_yday/365.25]) for date1 in date])
... |
"""
Control panel for the fitting and forecasting procedures. The key parameters
are usually needed to be adjusted based on properties of the simulation (i.e.
what machine is used, number of samples etc). This contains the bulk of the
assumptions used in the fitting and should be referred to when checking the
assump... |
<filename>cellx/callbacks.py
import io
from typing import List, Optional
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import tensorflow.keras as K
from scipy.special import expit as sigmoid
from scipy.special import softmax
from sklearn.metrics import confusion_matrix
from .tools.confusi... |
<filename>prosper/em/camodels/mca_et.py
#
# Author: <NAME> <<EMAIL>)
# Lincense: Academic Free License (AFL) v3.0
#
import numpy as np
from math import pi
from scipy.special import comb
from mpi4py import MPI
import prosper.em as em
import prosper.utils.parallel as parallel
import prosper.utils.tracing as traci... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
MRPy: Multivariate Random Processes with Python
Author: <NAME>
Please check https://github.com/mmaiarocha/MRPy for latest version
MIT License
"""
import sys
import gzip as gz
import pickle as pk
import numpy as np
import pandas as pd
from warnings import war... |
<filename>iiw3/plot_fit.py
from messungen import *
import matplotlib.pyplot as plt
import scipy.optimize
import numpy as np
def create_plt(name):
plt.figure(figsize=(10, 7.5), dpi=80)
plt1 = plt.subplot(1, 1, 1)
plt.grid(True)
plt.suptitle(name, fontsize=14, fontweight='bold')
plt.xlabel(r'Magneti... |
<gh_stars>0
from terraingrid import TerrainGrid
from scipy.ndimage.filters import gaussian_filter
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
import numpy.ma as ma
import os
SRTM1 = "D:\\Documents\\School\\2019-20\\ISEF 2020\\SRTM\\n52_e004_1arc_v3.tif"
SRTM2 = "D:\\Documents\\School\\201... |
<filename>Experimental/ElmerFEA/1TestProblemSIMP/old/readvtuDataVersion2.py
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
import numpy as np
import vtk
from vtk.util.numpy_support import vtk_to_numpy
# load a vtk file as input
reader = vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName("cas... |
<reponame>jaywoo123/lux
from lux.luxDataFrame.LuxDataframe import LuxDataFrame
from lux.view.View import View
from lux.executor.PandasExecutor import PandasExecutor
from lux.utils import utils
import pandas as pd
import numpy as np
from pandas.api.types import is_datetime64_any_dtype as is_datetime
from scipy.spatial.... |
import numpy as np
import cv2
from scipy.spatial import distance
class SymmetryDetector():
def __init__(self,
threshold = [127, 255, 0],
resolution = 64,
maxRadius = -1,
centroid = (-1,-1),
scoreThreshold = 0.9,
):
super().__init__()
self.threshold = thre... |
<filename>spectral_analysis/data_preprocessing/data_preprocessing.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sys
import pickle
from itertools import islice
from tqdm.auto import tqdm
from skimage import io, filters, feature
from scipy import ndimage, interpolate
from spectral_ana... |
<filename>ap_TS.py
import pandas as pd
import numpy as np
from python_nw import newey
from scipy.stats import f
from scipy.stats import chi2
def ap_TS(mr,mf):
dT, dN = mr.shape
dT, dK = mf.shape
vbeta = np.empty((dN,dK))
valpha = np.empty((dN,1))
valpha_t = np.empty((dN,1))
mresid = np.empty(... |
<gh_stars>10-100
# -*- coding: utf-8 -*-
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD 3 clause
from sklearn.base import BaseEstimator, TransformerMixin
import scipy.sparse as sp
import numpy as np
from skle... |
import numpy as np
import scipy as sp
import scipy.signal
import matplotlib.pyplot as plt
import numba as nb
import control
if __name__ == '__main__':
in_channels = 3
out_channels = 4
n_a = 0
n_b = 10
ts = 1.0
a_coeff = np.random.randn(out_channels, in_channels, n_a)
b_coeff = np.random.r... |
import os
import numpy as np
import pandas as pd
from multiprocessing import Pool
from numpy.random import choice, seed
from datetime import datetime
from scipy.stats import binom
from statsmodels.stats.multitest import fdrcorrection
from functools import partial
def evaluate(rows, data):
x = data.loc[rows,:]
... |
import caffe
from caffe_files.caffe_traininglayers import *
from caffe_files.color_quantization import *
from caffe_files.util import *
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
from data import colorize_image as CI
from skimage import color
from data import lab_gamut as lab
# Colorization ... |
from scipy.misc import imresize
from skimage.color import rgb2gray
from multiprocessing import *
from collections import deque
import gym
import numpy as np
import argparse
# -----
parser = argparse.ArgumentParser(description='Training model')
parser.add_argument('--game', default='Breakout-v0', help='OpenAI gym envir... |
<filename>scipy_utils.py<gh_stars>1-10
'''
Useful function based on scipy
'''
#### Standard Library Imports
#### Library imports
import numpy as np
import scipy
from IPython.core import debugger
breakpoint = debugger.set_trace
#### Local imports
from .shared_constants import *
def npz2mat(npz_fpath):
'''
... |
# from saliency.vanilla import *
# from saliency.guided import *
# from saliency.deconv import *
# from saliency.excitation_bp import *
# from saliency.test import *
# from saliency.perturbation import *
from saliency.perturbation_2 import *
# from saliency.lime import *
from .types import *
import torch
import torchvi... |
<reponame>maxeler/LatticeBoltzmann
import numpy as np
import matplotlib.pyplot as plt
import scipy.sparse as sp
import scipy.sparse.linalg as spla
T = 1000
dim = 150
fig1 = plt.figure()
dim2 = dim*dim
L = -4.0*sp.eye(dim2,dim2,k=0) + sp.eye(dim2,dim2,k=1) + sp.eye(dim2,dim2,k=-1) + sp.eye(dim2,dim2,k=dim) + sp.eye(d... |
"""
------------------------------
MIT License
Copyright (c) 2018 Hachastron
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, c... |
<gh_stars>0
#-*- coding: utf-8 -*-
import sys
import os
import numpy as np
import shutil
import traceback
import hashlib
import time
import datetime
import tarfile
import hashlib
#import SimpleITK as sitk
import pandas
from PIL import Image
###
#import pydicom
from pydicom import dcmread
from scipy.ndimage.interpolati... |
import torch
import math
from torch import nn
from scipy.special import binom
import torch.nn.functional as F
def compare_parameters(model1, model2):
for p1, p2 in zip(model1.parameters(), model2.parameters()):
try:
if p1.allclose(p2):
print('equal')
else:
print('diff')
except:
print('di... |
#!/usr/bin/env python
# usage example for webcam:
# cd /var/www/
# sudo /home/pi/Desktop/local/Raspberry-Pi-newbie/repeating_camera.py ceiling.jpg &
"""Test Raspberry Pi camera!
Just rewrite the same filename again and again. Useful for pointing
the camera in the right direction, etc.
"""
import picamera
impo... |
"""
Effect-size meta-analysis functions
"""
from __future__ import division
import logging
import numpy as np
from scipy import stats
from ..stats import null_to_p, p_to_z
from ..due import due
from .. import references
LGR = logging.getLogger(__name__)
@due.dcite(references.FISHERS, description='Fishers citation... |
<reponame>joshandali52/textis
"""
@author: <NAME>, <NAME>, <NAME> (in alphabetic order)
@institution: University of Liechtenstein, Fuerst-Franz-Josef Strasse 21, 9490 Vaduz, Liechtenstein
@funding: European Commission, part of an Erasmus+ Project (Project Reference: 2017-1-LI01-KA203-000083)
@copyright: Copyright (c) 2... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Name: <NAME>
# Date: October 11, 2019
# Email: <EMAIL>
# Description: Implementation of the continuous rate RNN model
import os, sys
import numpy as np
import tensorflow as tf
import scipy.io
import pickle
np.random.seed(700)
# import horovod.tens... |
from scipy import spatial
import numpy as np
import math
class Distance:
@staticmethod
def cosine_distance(A, B):
return spatial.distance.cosine(A.flatten(), B.flatten())
@staticmethod
def chi2_distance(A, B):
chi = 0.5 * np.sum([((a - b) ** 2) / max(a + b, +1e-9) for (a, b) in zip(A, B)])
return chi
@s... |
# from numpy import array, pi, einsum
from pymtensor.symmetry import (deg2rad, rotx, rotz, roty, rotu,
SgSymOps)
from pymtensor.sym_tensor import SymbolicTensor, SparseSymbolicTensor
from pymtensor.rot_tensor import to_voigt
# We use the NumPy testing suite to make it easier to compare arrays
from numpy.testing impo... |
#!/usr/bin/env python3
# -*- coding: ascii -*-
"""
Reaction system definition and derivatives for the series expansion.
Examples
========
Symbolic test system:
>>> rs = ReactionSystemBase(3)
>>> rs.eval_symbol('A', ())[0]
A[0]
>>> rs.eval_symbol('B', (2, 2))[0]
B[2, 2]
>>> rs.eval_symbol('C', ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 26 18:07:47 2021
@author: <NAME>
Cestimii.
Compute curvature estimations on point clouds using integral invariants.
This file contains all methods that have something to do with the
initialization, construction, splitting or merging of occupancy grids or
occupancy grid... |
#!/usr/bin/env python
# by TR
from numpy.random import random, seed
from sito import util
import sito.util.fftw3_be
import numpy as np
import os
import unittest
from scipy import fftpack
from sito.stream import read
from scipy.fftpack import fft, ifft
from obspy.signal.util import nextpow2
from sito.util.seispy import... |
<filename>examples/samplerate_test.py
"""
Example of creating TX waveform, and creating transmission line
"""
import serdespy as sdp
import skrf as rf
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import time
#%% set up some parameters for the transmitter waveform
voltage_levels = np.array([-... |
<reponame>bHodges97/pdf-from-site
from collections import Counter
from hashlib import sha256
from operator import itemgetter
from nltk.util import bigrams as nltk_bigrams
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.stem.wordnet import WordNetLemmatizer
import os
import json
impor... |
<reponame>dfm/SurPyval<filename>surpyval/parametric/fitters/mse.py
import autograd.numpy as np
from surpyval import nonparametric as nonp
from scipy.optimize import minimize
from autograd import jacobian, hessian
def mse_fun(params, dist, x, F, inv_trans, const):
return np.sum(((dist.ff(x, *inv_trans(const(para... |
<filename>Human_intention/src/Train_model/potential_map.py
"Isoclines map for the predicted trajectory"
from __future__ import division
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import scipy.interpolate
import time
import scipy.stats a... |
import numpy as np
import scipy.signal
import scipy.stats
import scipy.ndimage
def reshape_data(data, flatten=None, out_shape=None):
"""
Helper function to reshape input data for processing and return data shape
Inputs:
data: [np.ndarray] data of shape:
n is num_examples, i is num_rows, j is num_cols, ... |
<gh_stars>0
import logging
import anndata as ad
import os
from scipy.sparse import csc_matrix
import sys
from sklearn.decomposition import TruncatedSVD
from sklearn.linear_model import LinearRegression
from torch.serialization import save
# addition package
from torch.utils.data import TensorDataset, DataLoader
impo... |
<gh_stars>1-10
#!/usr/bin/python3.8
# Copyright 2020 Aragubas
#
# 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 require... |
<reponame>janimango/IW276SS20P1<gh_stars>0
from scipy import io
import csv
def scipy():
# annolist
# image
# annorect
# vididx
# frame_sec
# img_train(imgidx)
# single_person(imgidx)
# act(imgidx)
# act_name
# cat_name
# act_id
# video_list(v... |
<filename>teacher_student/feature_learning_utils.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 10 20:51:15 2021
@author: orram
"""
import os
import sys
# sys.path.insert(1, '/home/labs/ahissarlab/orra/imagewalker')
# sys.path.insert(1, '/home/orram/Documents/GitHub/imagewalker')
sys.path.in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.