text string |
|---|
<reponame>simberaj/votelib<filename>votelib/evaluate/approval.py<gh_stars>10-100
'''Advanced approval voting methods.
This module contains approval voting evaluators that cannot be reduced to
a plurality evaluation by aggregating the scores. Use
:class:`votelib.convert.ApprovalToSimpleVotes` in conjunction with
:class... |
<reponame>eshandinesh/gis_based_crime_mapping
# -*- coding: utf-8 -*-
from sklearn.neighbors.kde import KernelDensity
from django.shortcuts import render
from osgeo import ogr
import json,xlsxwriter
import xlrd,math,scipy
from collections import OrderedDict,Counter
from scipy import stats
from scipy.stats import norm
f... |
import numpy as np
import skfuzzy as fuzz
import scipy.ndimage as ndi
import skimage.io
from skimage.transform import rescale
import matplotlib.pyplot as plt
kwargs = {'lw': 20, 'solid_capstyle': 'round'}
if __name__ == '__main__':
# Generate membership functions corresponding to S, F, I, and U in logo
x_sf... |
# Copyright 2019 D-Wave Systems 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 required by applicable law or... |
<reponame>luctrudeau/CfL-Analysis
import os
from scipy.ndimage import imread
def load_kodim():
img_folder = "../../data/external/kodim"
kodims = []
kodim_files = []
for file in sorted(os.listdir(img_folder)):
if file.endswith(".png"):
kodim_files.append(file)
kodims.appe... |
import math
import warnings
import numpy as np
import pandas as pd
import scipy.signal
import matplotlib.pyplot as plt
from typing import Optional, Union, List
from tqdm import tqdm
from signalanalysis.signalanalysis import general
from signalanalysis import signalplot
from signalanalysis import tools
class Egm(gen... |
##################################################################################
# Imports
from lightkurve.correctors import CBVCorrector
from lightkurve.correctors import RegressionCorrector, DesignMatrix
from lightkurve.correctors.designmatrix import create_spline_matrix, DesignMatrix, DesignMatrixCollection
#impor... |
import math
import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
import scipy.sparse as sp
from deeprobust.graph.defense import GraphConvolution
import deeprobust.graph.utils as utils
import torch.optim as optim
from sklearn.metrics.pai... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
from imageio import imread, imwrite
import matplotlib.pyplot as plt
import numpy as np
import scipy.ndimage
Img = imread('C:/Users/fc48286/Downloads/lena.tif')
dim = Img.shape
tipo = Img.dtype
npix = Img.size
plt.figur... |
<reponame>AaronLPS/CarND-Capstone<gh_stars>0
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import TwistStamped, PoseStamped
from styx_msgs.msg import Lane, Waypoint
from std_msgs.msg import Int32
import numpy as np
from scipy.spatial import KDTree
import math
import copy
'''
This node will publish waypo... |
<gh_stars>0
#!/usr/local/bin/python3
# Copyright (c) 2020 Stanford University
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVID... |
#!usr/bin/env ipython
# Functions related to loading, saving, processing datasets
import tensorflow.keras.datasets as datasets
from tensorflow.keras import Model
import numpy as np
import pandas as pd
import os
from pathlib import Path
from scipy.stats import entropy
from scipy.spatial.distance import cosine
from skle... |
<reponame>jingzbu/InverseVITraffic
from util import *
from util_data_storage_and_load import *
import numpy as np
from numpy.linalg import inv
from scipy.sparse import csr_matrix, csc_matrix
import json
with open('../temp_files/new_route_dict_journal.json', 'r') as json_file:
new_route_dict = json.load(json_file)
... |
import numpy
import scipy.special
class SimpleNeuralNetwork:
def __init__(self, inputnodes=None, hiddennodes=None, outputnodes=None, learningrate=None):
self.inputnodes = inputnodes
self.hiddennodes = hiddennodes
self.outputnodes = outputnodes
self.learningrate = learningrate
... |
<filename>sunycell/features.py
import numpy as np
from shapely.geometry import Polygon
import pandas as pd
from scipy import stats
from skimage import morphology, segmentation
from matplotlib.path import Path as mplPath
import matplotlib.tri as T
def get_polygon_from_pts(pts):
polygons = []
for pt in pts:
... |
from osgeo import gdal, ogr, osr
import numpy as np
from scipy.interpolate import RectBivariateSpline
import os
import sys
import matplotlib.pyplot as plt
from region import region
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
from descartes import PolygonPatch
class terrain:
def __init__(self):
... |
<filename>feature_encoders/utils.py<gh_stars>0
# -*- coding: utf-8 -*-
# Copyright (c) Hebes Intelligence Private Company
# This source code is licensed under the Apache License, Version 2.0 found in the
# LICENSE file in the root directory of this source tree.
import glob
from typing import Any, Union
import numpy ... |
<reponame>rhgao/ObjectFolder<filename>AudioNet_utils.py
from scipy.io import wavfile
import librosa
import librosa.display
import numpy as np
import matplotlib.pyplot as plt
from AudioNet_model import *
import os
from collections import OrderedDict
def strip_prefix_if_present(state_dict, prefix):
keys = sorted(st... |
<filename>demo/hnswlib_test.py<gh_stars>0
#!/usr/bin/python3
from img2vec_pytorch import Img2Vec
from PIL import Image
import numpy as np
from scipy import spatial
import hnswlib
import math
import time
img2vec = Img2Vec(cuda=False, model='densenet')
p = hnswlib.Index(space = 'cosine', dim = 1024) # possible options a... |
<gh_stars>1-10
from scipy.stats import norm
import math
def bsm_find_call_price(underlying_asset_price, strike_price, annual_volatility, annual_cc_risk_free, time_in_years = 1, annual_cc_dividend_yield = 0):
d1 = (math.log(underlying_asset_price/strike_price) + (annual_cc_risk_free - annual_cc_divid... |
<gh_stars>10-100
import base64
import gzip
import os
import zipfile
import numpy as np
from scipy import sparse
from scipy.io import mmread
from odin.utils import one_hot
from odin.utils.crypto import md5_folder
from sisua.data.const import OMIC
from sisua.data.path import DATA_DIR, DOWNLOAD_DIR
from sisua.data.singl... |
''' PolynomialFiltering.components.AdaptiveOrderPolynomialFilter
(C) Copyright 2019 - Blue Lightning Development, LLC.
<NAME>. <EMAIL>
SPDX-License-Identifier: MIT
See separate LICENSE file for full text
'''
from typing import Tuple
from abc import abstractmethod
from overrides import overrides
import csv
from m... |
<filename>biguaa/qteleportation.py
from qutip import *
import numpy as np
import math
import matplotlib.pyplot as plt
import qutip.qip
import scipy.stats
from qutip.qip.operations import snot, cnot, rx, ry, rz
from qutip.qobjevo import proj
# ############ FUNCTIONS FOR ANY REPRESENTATIONS OF QUANTUM STATES ########... |
<reponame>bwosh/CarND-Capstone
#!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, Pose
from styx_msgs.msg import TrafficLightArray, TrafficLight
from styx_msgs.msg import Lane
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from detector impor... |
from __future__ import print_function
import glob
import os
import numpy as np
from PIL import Image
# Some of the flowers data is stored as .mat files
from scipy.io import loadmat
import tarfile
import time
import traceback
import cntk.io.transforms as xforms
from urllib.request import urlretrieve
import zipfile
... |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 18 07:45:38 2021
@author: <NAME>
"""
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
import os
import hashlib
import gc
import skimage.color
import skimage.filters
import skimage.io
import skimage.viewer
import skimage.measure
imp... |
<reponame>RileyWClarke/flarubin
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate
import numpy.lib.recfunctions as rf
class Lims:
"""class to handle light curve of SN
Parameters
-------------
Li_files : str
light curve reference file
mag_to_flux_files : str
... |
#!/usr/bin/env python
#######################################
# Point of Contact #
# #
# Dr. <NAME> #
# University of Seville #
# Dept. Atomic and Molecular Physics #
# <NAME>, 7 #
# Seville, Andalusia, Spain #
# <EMAIL> #
# #
################... |
import math
import cmath
import numpy as np
from scipy.linalg import expm
sx = 1/2 * np.mat([[0, 1],[ 1, 0]], dtype=complex)
sy = 1/2 * np.mat([[0, -1j],[1j, 0]], dtype=complex)
sz = 1/2 * np.mat([[1, 0],[0, -1]], dtype=complex)
def hamiltonian(j):
J = 4
H = (j) * J * sz + sx
return H
psi_target = np.mat... |
<reponame>uw-unsat/leanette-popl22-artifact
#!/usr/bin/env python3
# Generate verification performance table
import argparse
import pandas
import os
import jinja2
import sys
import scipy.stats
parser = argparse.ArgumentParser()
parser.add_argument("--debug", action="store_true")
parser.add_argument("--template", typ... |
<filename>scripts/psoap_generate_masks.py<gh_stars>10-100
#!/usr/bin/env python
# Using a smart estimate of chunk size, create a chunks.dat file.
import argparse
parser = argparse.ArgumentParser(description="Auto-generate comprehensive masks.dat file, which can be later edited by hand.")
parser.add_argument("--sigma... |
"""
MIT License
Copyright (c) 2020 vqdang
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, publish, distri... |
<gh_stars>1-10
import sys, os
import numpy as np
import scipy
import itertools
import time
from math import factorial
import copy as cp
import sys
from fermicluster import *
from pyscf_helper import *
import pyscf
ttt = time.time()
pyscf.lib.num_threads(1) #with degenerate states and multiple processors there can be i... |
<filename>pylightcurve/__databases__.py
import os
import glob
import time
import shutil
from scipy.interpolate import interp1d
from pylightcurve.processes.files import open_dict, open_yaml, save_dict, download, open_dict_online
from pylightcurve import __version__
try:
import zipfile
download_zip = True
exce... |
import pandas as pd
import numpy as np
from numpy.random import randn, choice
from scipy.special import expit
np.random.seed(65535)
def make_test_data(size=2000):
# 大きさ
x1 = choice([0, 1, 2], size=size, p=[0.3, 0.3, 0.4])
# 見やすさ
e_x2 = expit(randn(size)) # ノイズ
x2_prob = 0.5
x2 = x2_prob * ... |
import numpy as np
import numpy.linalg as la
import scipy
import skimage
import PIL
from PIL import Image as PILImage
import TimestampedPacketMotionData_pb2
import argparse
import os
import google.protobuf.json_format
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import TimestampedImage_pb2
im... |
<reponame>jnez71/adaptive_control<gh_stars>10-100
"""
Concurrent-learning controller derived for
a two-linkage robotic manipulator. Includes
repetitive learning if the path to track
is cyclical.
"""
################################################# DEPENDENCIES
from __future__ import division
import numpy as np
impo... |
import torch
import torch.nn as nn
import torch.utils.data as Data
import torchvision
import numpy as np
from copy import deepcopy
from trajectoryReweight.gmm import GaussianMixture
from scipy import spatial
class WeightedCrossEntropyLoss(nn.Module):
"""
Cross entropy with instance-wise weights. Leave `aggregate` t... |
import numpy as np
from .grad1D import grad1D
from scipy.sparse import spdiags
def grad1DNonUniform(k, ticks, dx=1.):
""" Computes a m+1 by m+2 one-dimensional non-uniform mimetic gradient
operator
Arguments:
k (int): Order of accuracy
ticks (:obj:`ndarray`): Edges' ticks e.g. [0 0.1 0.15... |
<reponame>Ellsom1945/Routing-problem--CVRP
import datetime
import math
import matplotlib.pyplot as plt
import numpy as np
import cmath
import operator
from H_Hy_Men import VRPLibReader
start_time = datetime.datetime.now()
# 供需地封装成site类
class Site:
def __init__(self, x, y, ifo, goods):
self.map = []
... |
<gh_stars>1-10
import numpy as np
import nibabel as nib
import pandas as pd
from nibabel.processing import smooth_image
from scipy.stats import gmean
def dc(input1, input2):
r"""
Dice coefficient
Computes the Dice coefficient (also known as Sorensen index) between the binary
objects in two images.
... |
<reponame>aefernandez/coffee-web-app
from hx711 import HX711
import sys
import RPi.GPIO as GPIO
import math
import statistics
import os
import datetime
import array
from time import sleep
import logging
repeatMeasurements = True
lowMea = []
goodMea = []
dateSaveFile = "/home/pi/Desktop/scalescript_save.txt"
try:
... |
#!/usr/bin/env python
#ADAPTED FROM
#https://github.com/bio-ontology-research-group/deepgoplus/blob/master/evaluate_deepgoplus.py
import numpy as np
import pandas as pd
import click as ck
from sklearn.metrics import classification_report
from sklearn.metrics.pairwise import cosine_similarity
import sys
from collection... |
"""Sky brightnes approzimation using Zernike polynomials
The form and notation used here follow:
<NAME>., <NAME>., <NAME>., <NAME>. & VSIA
Standards Taskforce Members. Vision science and its
applications. Standards for reporting the optical aberrations of
eyes. J Refract Surg 18, S652-660 (2002).
"""
# imports
from ... |
<reponame>arosch/duckdb<gh_stars>0
import csv
import numpy as np
import numpy.random as nr
import scipy.stats as ss
def distribution(min_val, max_val, mean, std):
scale = max_val - min_val
location = min_val
# Mean and standard deviation of the unscaled beta distribution
unscaled_mean = (mean - min_va... |
<reponame>AnushaPB/geonomics-1
#!/usr/bin/python
# movement.py
'''
Functions to implement movement and dispersal.
'''
# TODO:
# - vectorize dispersal (i.e. create all offspring and parent midpoints,
# then draw new locations for all offspring simultaneously)
# - create simpler (private?) methods for making ... |
<reponame>occamLab/invisible-map-generation
"""Some helpful functions for visualizing and analyzing graphs.
"""
from enum import Enum
from typing import Union, List, Dict, Tuple, Any
import g2o
from matplotlib import pyplot as plt
from matplotlib import cm
import numpy as np
from g2o import SE3Quat, EdgeProjectPSI2UV,... |
# coding: utf-8
import numpy as np
import pandas as pd
from scipy.signal import savgol_filter
from scipy.ndimage.filters import median_filter
from radcomp.vertical import NAN_REPLACEMENT
# CONFIG
MEDIAN_WINDOWS = {'ZH': (7, 1),
'KDP': (19, 1),
'ZDR': (11, 1),
'RHO... |
<reponame>cjshui/WADN
import os
import argparse
import gzip
from tqdm import tqdm
import numpy as np
import scipy.io as sio
from skimage.transform import resize
import glob
import imageio
def mnist_to_np(data_path, train_test):
if train_test == "train":
flag = "train"
elif train_test == "test":
... |
import pystan
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import seaborn as sns
import pandas as pd
import numpy as np
import scipy.stats as stats
import sys
sys.path.append('../')
from LightningF.Datasets.data import create_twofluo, d... |
<filename>app/csv_parser.py
import os
import csv
import statistics
def calculate_average_grade(my_csv_filepath):
return 80
if __name__ == "__main__":
#
# CAPTURE USER INPUTS
#
year = input("Please select a year (2018 or 2019):")
if year not in ["2018", "2019"]:
print("OH, INVALID SE... |
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import streamlit as st
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
import statistics as s
#st.set_page_config(layout="wide")
silos=9
n_clusters=2
#metric=c1.selectbox("metric",["Idade Materna","Bishop Score","Cesarian... |
<gh_stars>0
def index_outliers(data):
"""Return indexes of values that are not outliers. i.e. outside 1.5 * interquartile range (IQR). So I suppose this function should really be called 'index non-outliers'. We'll make do with this.
Parameters
----------
data : :py:class:`numpy.ndarray` or lis... |
"""1.Phase"""
from sympy import *
init_printing()
z, x0, x1, x2, x3, x4, x5, x6, x7 = symbols('z, x0, x1, x2, x3, x4, x5, x6, x7')
B = [x3, x4, x5, x6, x7]
N = [x0, x1, x2]
rows = [Eq(x3, -12 + 2 * x1 + 1 * x2 + x0),
Eq(x4, -12 + x1 + 2 * x2 + x0),
Eq(x5, -10 + x1 + x2 + x0),
Eq(... |
<gh_stars>0
"""
Module with functions to plot and extract CSD info from LFP data
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
try:
basestring
except NameError:
basestring = str
# THIRD PARTY IMPORTS
i... |
__all__ = ['TuningCurve1D', 'TuningCurve2D', 'DirectionalTuningCurve1D']
import copy
import numpy as np
import numbers
import scipy.ndimage.filters
import warnings
from .. import utils
# TODO: TuningCurve2D
# 1. spatial information
# 1. init from rate map
# 1. magic functions
# 1. ordering? doesn't necessarily make ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018 MIT Probabilistic Computing Project.
# Released under Apache 2.0; refer to LICENSE.txt.
from collections import OrderedDict
from math import log
from scipy.special import gammaln
from cgpm.utils.general import get_prng
from cgpm.utils.general import log_linspace
from cgp... |
<reponame>hcbh96/SC_Coursework_1
from scipy.optimize import fsolve
from scipy.optimize import newton
from scipy.integrate import solve_ivp
from scipy.integrate import odeint
import math
from shooting import shooting
import numpy as np
import pytest
def test_on_lotka_volterra():
"""This function is intended to tes... |
# -*- coding: utf-8 -*-
from __future__ import (division, print_function, absolute_import,
unicode_literals)
"""
Small collection of robust statistical estimators based on functions from
<NAME> (Hughes STX) statistics library (called ROBLIB) that have
been incorporated into the AstroIDL User's... |
# This simulates determinatally-thinned point processes that have been
# fitted to thinned-point process based on the method outlined in the paper
# by Blaszczyszyn and Keeler[1], which is essentially the method developed
# by Kulesza and Taskar[2].
#
# This is the third file (of three files) to run to reproduce re... |
<filename>python/rslc/performance.py
# This script is only inteded to use for benchmarking the RSLC algorithm. So the
# script is not inteded to be commonly used and, thus, the used libraries are
# not included in the requirements. However, the functions remain accessible,
# since the smileys might be a fun synthetic d... |
<reponame>JEB12345/SB2_python_scripts
def DetectCurrentFace( hebi, Group ):
import scipy.io as scio
import sys
import numpy as np
### This was used for testing purposes only
# import hebi # for the Hebi motors
# from time import sleep
#
# # Need to look into XML formatting for Hebi Gains... |
<gh_stars>10-100
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
import numpy as np
import scipy
from scipy.ndimage.filters import maximum_filter
from astropy.coordinates import SkyCoord
from fermipy import utils
from fermipy import wcs_ut... |
#!/usr/bin/env python2
from __future__ import print_function
import matplotlib
from matplotlib import pyplot as plt
from scipy.cluster.hierarchy import dendrogram, linkage, cophenet, to_tree
import numpy as np
import json
import sys
import os
matplotlib.rcParams.update({'font.size': 18})
SHOWPLOT = 0
if len(sys.ar... |
"""
Solve a potentially over-determined system with uncertainty in
the values.
Given: A x = y +/- dy
Use: s = wsolve(A,y,dy)
wsolve uses the singular value decomposition for increased accuracy.
Estimates the uncertainty for the solution from the scatter in the data.
The returned model object s provides:
s.x ... |
###############
# Repository: https://github.com/lgervasoni/urbansprawl
# MIT License
###############
import numpy as np
import pandas as pd
import networkx as nx
import math
from shapely.geometry import LineString
from scipy.spatial.distance import cdist
def WeightedKernelDensityEstimation(
X, Weights, bandwidt... |
import numpy as np
from matplotlib import pyplot as plt
import stat_tools as st
from datetime import datetime,timedelta
import pysolar.solar as ps
from skimage.morphology import remove_small_objects
from scipy.ndimage.filters import maximum_filter
import mncc, geo
from scipy import interpolate
coordinate = {'HD815_1':... |
<reponame>cchu70/plotly-demo
#!/usr/bin/env python
"""Helper functions for plotly plotting, including choosing samples based on metrics and plotting mutation
and copy number plots."""
from scipy.stats import beta
import pandas as pd
import numpy as np
from intervaltree import IntervalTree
import matplotlib.colors as ... |
<reponame>akshitj1/mavsim_template_files
"""
compute_trim
- Chapter 5 assignment for <NAME>, PUP, 2012
- Update history:
2/5/2019 - RWB
"""
import sys
sys.path.append('..')
import numpy as np
from scipy.optimize import minimize
from tools.tools import Euler2Quaternion
def compute_trim(mav, Va, gamma... |
<gh_stars>0
#!/usr/bin/env python3
import numpy as np
import scipy.special
from functools import reduce
def peirce_dev(N: int, n: int = 1, m: int = 1) -> float:
"""Peirce's criterion
Returns the squared threshold error deviation for outlier identification
using Peirce's criterion based on Gould's meth... |
"""
Tutorial - Hello World
The most basic (working) CherryPy application possible.
"""
import os.path
# Import CherryPy global namespace
import cherrypy
#import statsics
import statistics
# use of numpy.cov
import numpy as np
import json
import pandas as pd
import seaborn as sn
import matplotlib.pyplot as plt
... |
<reponame>gautierdag/cultural-evolution-engine
import random
import numpy as np
import scipy
class BaseCEE(object):
def __init__(self, params):
self.senders = []
self.receivers = []
self.agents = [] # case where single pool of agents
self.params = params
self.generation = ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/2/11 15:19
# @Author : Baimohan/PH
# @Site : https://github.com/BaiMoHan
# @File : complex_text.py
# @Software: PyCharm
ac1 = 3 + 0.2j
print(ac1)
print(type(ac1)) # 输出复数类型
ac2 = 4 - 0.5j
print(ac2)
print(ac1 + ac2)
import cmath
ac3 = cmath.sqrt(... |
<reponame>benmaier/epipack
"""
Provides an API to define epidemiological models.
"""
import numpy as np
import scipy.sparse as sprs
import warnings
from epipack.integrators import (
IntegrationMixin,
time_leap_newton,
time_leap_ivp,
)
from epipack.process_conversions import (
pr... |
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.optimize import basinhopping
from .mean_variance_optimization import mean_variance_optimize
# 未完成
# class MeanVarianceModelSelector:
#
# def __init__(self, execution_cost: float,
# assets: float, budget: float, max... |
# -*- coding: utf-8 -*-
# from __future__ import absolute_import, print_function, division
from future.utils import with_metaclass
from builtins import str
from builtins import range
import numpy as np
import scipy as sp
from abc import ABCMeta, abstractmethod
from scipy import integrate
import scipy.interpolate as in... |
import unittest
import sam
from math import log, sqrt
import numpy as np
from scipy.stats import multivariate_normal
from scipy.special import logit
def logProb1(x, gradient, getGradient):
if getGradient:
gradient[0] = sam.gammaDLDX(x[0], 20, 40)
gradient[1] = sam.normalDLDX(x[1], 5, 1)
return... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 8 22:49:54 2019
image
@author: chineseocr
"""
from PIL import Image
import numpy as np
import cv2
import time
def timer(func):
def new_func(*args, **args2):
t0 = time.time()
back = func(*args, **args2)
print ("%.3fs tak... |
import numpy as np
from scipy.stats import ttest_ind
from skimage.filters import threshold_triangle
from skimage.filters import sobel
from skimage.morphology import disk, remove_small_objects, binary_closing
from skimage.feature import greycomatrix, greycoprops
from scipy.ndimage import binary_fill_holes
__all__ = [... |
<filename>Codes/Math/twin_prime.py
import math
from sympy import Range
def is_prime(number: int) -> bool:
for i in Range(2, math.sqrt(number)):
if number % i == 0:
return False
return True
def generate_twins(start: int, end: int) -> None:
for i in Range(start, end):
j = i + 2... |
import numpy as np
from astropy.io import fits
import os
from scipy import stats, optimize, special
def plaw_spec(A, ind, E, E0=50.0):
return A*(E/E0)**(-ind)
def plaw_flux(A, ind, E0, E1, esteps=10, E_0=50.0):
Es = np.linspace(E0, E1, esteps)
dE = Es[1] - Es[0]
flux = np.sum(plaw_spec(A, ind, Es, E0... |
import glob
import numpy as np
import matplotlib.pyplot as plt
import cv2
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from datetime import datetime
import time
import yaml
from pathlib import Path
from nd2reader import ND2Reader
import pandas as pd
from scipy import ndimage as ndi
from skimag... |
import cv2
import dlib
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import least_squares
glob_neutral_tmp_LM = np.array(
[[143, 214], [146, 244], [151, 273], [158, 302], [168, 328], [184, 352], [205, 371], [229, 386], [259, 390],
[287, 385], [311, 371], [331, 352], [347, 329], [356, ... |
<gh_stars>1-10
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
from scipy.stats import nanmean
from matplotlib import dates
import os
import pickle
from datetime import datetime
from pprint import pprint
import sys
import math
import traceback
import time
distr_type = 1 #1 for m... |
import numpy as np
import scipy
import torch
from nystrom import Nystrom
from gaussian_exact import GaussianKernel
import sys
sys.path.append("../utils")
from misc_utils import set_random_seed
from quantizer import Quantizer
import math
EPS = 1e-15
class EnsembleNystrom(object):
def __init__(self, n_feat, n_learn... |
<reponame>andrewcurtis/SSVMetric
# imports
import numpy as np
import scipy
import scipy.sparse.linalg
from scipy.sparse.linalg import ArpackNoConvergence
from scipy.sparse.linalg import ArpackError
import time
from SamplingPattern import SamplingPattern
from defaults import BASE_N
from utils import ft, ift, ft2, ift... |
"""
.. module:: computers
:platform: Unix, Windows
:synopsis: a module for defining computers, which are subclasses of OpenMM Context_ class.
.. moduleauthor:: <NAME> <<EMAIL>>
.. _Context: http://docs.openmm.org/latest/api-python/generated/simtk.openmm.openmm.Context.html
"""
import itertools
import numpy a... |
import sys, os, subprocess
import argparse
import statistics
import optuna
import yaml
import random
import pathlib
from datetime import datetime
from nto_templating import template_from_tunable_dict
def get_all_tunables(tunables_file):
with open(tunables_file, "r") as stream:
try:
tunables_ya... |
# -*- coding: utf-8 -*-
"""CREEDS Analysis."""
import pickle
import logging
from collections import defaultdict
from typing import Optional, Type
import bioregistry
import bioversions
import numpy as np
import pandas as pd
import protmapper.uniprot_client
import pyobo
import pystow
import seaborn
from indra.sources ... |
<reponame>QianJianhua1/QPanda-2
import pyqpanda as pq
import numpy as np
import unittest
class InitQMachine:
def __init__(self, machineType=pq.QMachineType.CPU):
self.m_machine = pq.init_quantum_machine(machineType)
self.m_machine.set_configure(64, 64)
def __del__(self):
pq.destroy_qu... |
<gh_stars>0
import sys
print (sys.version)
import statistics
print('NormalDist' in dir(statistics))
sat = statistics.NormalDist(167.44, 12.7)
a = sat.cdf(190.5) - sat.cdf(165.1)
print(round(a*800,1))
fraction = 1-sat.cdf(182.88)
print(round(fraction*800,1))
print(fraction)
|
import ase.data as ad
from pyscf import gto, dft, scf, cc, mp, ci
#from pyscf.geomopt import berny_solver
import aqml.cheminfo.core as cic
import os, sys, scipy
from pyscf.tools.cubegen import *
from pyscf.data import elements
import numpy as np
from functools import reduce
import pyscf
_mult = {1:2, 3:2, 4:1, 5:2, 6... |
<filename>gfx/environment.py
__author__ = '<NAME>, <EMAIL>'
import random
import copy
import numpy as np
from scipy import zeros
from pprint import pformat, pprint
import pygame
from pygame.locals import *
#from pybrain.utilities import Named
#from pybrain.rl.environments.environment import Environment
# TODO: mazes... |
import numpy as np
from scipy.signal import filtfilt
from scipy.signal import fftconvolve
def SNR_to_var(snr):
return 1 / 10 ** (snr / 20)
def reverberate_tensor(tensor, rir_tensor):
res = []
for i in range(rir_tensor.shape[1]):
res.append(fftconvolve(tensor, rir_tensor[:, i]))
return np.vst... |
import numpy as np
from PIL import Image
import scipy.io as sio
class AverageNum():
def __init__(self, num=0, sum=0):
self.num = num
self.sum = sum
def update(self, num, sum):
self.num += num
self.sum += sum
def __add__(self, other):
self.num += other.num
... |
import numpy as np
from sklearn import tree
from sklearn.externals import joblib
from deap import benchmarks
from sklearn import preprocessing
import math
from sklearn import ensemble
import copy
from sklearn.preprocessing import Imputer
from sklearn.gaussian_process import GaussianProcess
from sklearn import cross_v... |
<reponame>t-aritake/ancestral_atom_learning
import numpy
import scipy.misc
import pickle
import datetime
import os
from sklearn import linear_model
from ancestral_atom_learning import AncestralAtomLearning
# from gen_extract_operators import ExtractOperatorsGenerator
from gen_mean_downsampling_operators import gen_extr... |
from dataclasses import dataclass, replace
from typing import Tuple, Any, Optional
import numpy as np
from numpy import ndarray
from scipy.sparse import coo_matrix, csr_matrix
@dataclass
class COOData:
indices: ndarray
data: ndarray
shape: Tuple[int, ...]
local_shape: Optional[Tuple[int, ...]]
... |
<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from time import sleep
from scipy.optimize import curve_fit
def compute_locking_signal(images_mean, main_pca_component, normalization_factor, current_image):
current_image_centered = np.reshape(current_image, [current_image.shape[0]*current_image.shape[... |
<filename>pyFU/utils.py
# pyFU/utils.py
import argparse
import bisect
import datetime
import logging
import numpy as np
import os
import parse
import sys
import yaml
from astropy.io import fits
from astropy.table import Table, Column
from matplotlib import pyplot as plt
from scipy import signal, optimize, i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.