text string |
|---|
from pathlib import Path
from datetime import datetime
from shutil import move
import warnings
import logging
import numpy as np
import pandas as pd
from scipy.ndimage.measurements import label
import SimpleITK as sitk
from src.data.bounding_box import bbox_auto
log_fmt = '%(asctime)s - %(name)s - %(levelname)s - %(... |
import numpy as np
import matplotlib
import matplotlib.pylab as plt
import matplotlib.font_manager as fm
import scipy
import scipy.interpolate as spi
import datetime
import time
import csv
import os
import graph
def main(date):
plt.figure(figsize=(16, 9), dpi=80)
plt.subplots_adjust(left=0.10, bottom=0.08, r... |
<reponame>athomasmr23/Supermileage_Driver
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 18 10:57:13 2017
@author: Aaron
"""
import scipy
from scipy import interpolate
import math
def torque(RPM):
#return -3E-7*math.pow(RPM,2)+0.0018*RPM-1.6718 #N*m, torque as a function of RPM at full throttle
re... |
#!/usr/bin/env python
import os
import astropy.io.fits as pyfits
ns_dmp=globals()
def parse_column_file(input,output=None,offsets=None):
f = open(input,'r').readlines()
dict = {}
for l in f:
import re
res = re .split('\s+',l)
print res
if len(res) > 3:
t = {}
... |
import roslib; roslib.load_manifest('hima_experiment')
import rospy
import os
import os.path
import re
import numpy as np
import scipy.interpolate
def AddCommandLineOptions(parser):
'''Add command line options that are needed for routines in here.'''
parser.add_option('--annotation_regex',
defa... |
<gh_stars>0
import numpy as np
import scipy as sp
import scipy.io.wavfile as wav
import matplotlib.pyplot as plt
import itertools
def pearson_corr_coeff(syllable_1_template, syllable_2_template):
'''
:param syllable_1_template: spectrographic template syllable 1
:param syllable_2_template: spectrographic ... |
<reponame>GaloisInc/FAW
import base64
import ujson as json
import numpy as np
import scipy.sparse
from sklearn.cluster import AgglomerativeClustering
import sys
import typer
def main(workbench_api_url: str, json_arguments: str, output_html: str):
# Load parameters
dec_args = json.loads(json_arguments)
# ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 5 14:31:05 2018
@author: carolinalissack
"""
from sklearn.decomposition import NMF
import pandas as pd
from scipy.sparse import csr_matrix
df = pd.read_csv('wiki_source.csv', index_col=0)
articles = csr_matrix(df.transpose())
titles = list(df.col... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
import time
from itertools import product
import numpy as np
from loguru import logger
from scipy.optimize import minimize
from tqdm import tqdm
import wandb
from model_wrapper import LinearRegressionWrapper
from quantum_circuit import QuantumBox
from util import generate_measurement_matrices
def generate_random_co... |
<reponame>SPOClab-ca/word-class-flexibility
"""
From ElmoPlusBert.ipynb
Usage:
python scripts/multilingual_bert_contextual.py \
--pkl_dir data/wiki/processed/ \
--pkl_file en.pkl \
--results_dir results/
python scripts/multilingual_bert_contextual.py --pkl_dir data/wiki/processed/ --pkl_file en.pk... |
import numpy as np
import scipy.linalg
from itertools import permutations, combinations_with_replacement
from termcolor import colored
import warnings
from desc.backend import jnp, put
from desc.utils import issorted, isalmostequal, islinspaced
from desc.io import IOAble
class Transform(IOAble):
"""Transforms fr... |
# Brain Tumor Classification
# Enhance tumor region in each image.
# Author: <NAME>
# Copyleft: MIT Licience
# ,,, ,,,
# ;" '; ;' ",
# ; @.ss$$$$$$s.@ ;
# `s$$$$$$$$$$$$$$$'
# $$$$$$$$$$$$$$$$$$
# $$$$P""Y$$$Y""W$$$$$
# $$$$ p"$$$"q $$$$$
# $$$$ .$$$$$. $$$$'
# $$$DaU$$O$$DaU$$$'... |
import csv
import sys
import sqlparse as sql
import itertools
import statistics
import os
class SQL_Engine():
def __init__(self):
self.path = '../files'
self.AGGREGATE = {
'SUM': sum,
'AVG': statistics.mean,
'MAX': max,
'MIN': min
}
s... |
<reponame>manishaverma1012/Hackerank_Solution
import statistics
n=int(input())
p=list(map(int,input().split()))
u=statistics.mean(p)
m=[]
for i in range(len(p)):
q=p[i]-u
x=q**2
m.append(x)
y=sum(m)/n
sqrt = y ** 0.5
print('%.1f'%sqrt)
|
<gh_stars>10-100
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 1 16:30:29 2018
@author: shpark
"""
import numpy as np
import scipy.io as sio
from scipy.interpolate import CubicSpline #import interp1d
from energym.envs.battery_cells.paramfile_nca18650 import *
def spm_plant_obs_mats(p):
# E... |
import sys
sys.path.append("/nesi/projects/nesi00213/Pre-processing/geoNet")
import scrapeGeoNet as sg
from geoNet_file import GeoNet_File
from process import Process
import os
EVENT_SUMMARY_FILE = "20100904_103801.CSV"
#LOC = "/hpc/home/man56/ObservedGroundMotions/Mw4pt6_20100904_103801"
LOC = "/nesi/projects/nesi0... |
<reponame>paulmillar/PIC-to-ROR
# pip install geopy
# https://pypi.org/project/geopy/
from geopy.distance import geodesic
import statistics
class MissingDataError(Exception):
"""Exception raised because required data is missing.
Attributes:
expression -- input expression in which the error occurred
... |
# The date of the first sighting of robins has been occurring earlier each spring over the past 25 years at a certain laboratory.
# Scientists from this laboratory have developed two linear equations, shown below, that estimate the date of the first sighting of robins,
# where x is the year and y is the estimated ... |
<filename>python/prob21-40.py
#problem 21 Amicable Numbers
def memoize(f):
m = {}
def helper(x):
if x not in m:
m[x] = f(x)
return m[x]
return helper
@memoize
def d(n):
return sum(i for i in xrange(1, n/2+1) if n % i == 0)
def amicNum(n):
return sum(... |
<filename>gym_space_engineers/envs/walking_robot_ik.py
import json
import math
import os
import random
import time
from copy import deepcopy
from enum import Enum
from typing import Any, Dict, Tuple
import gym
import numpy as np
import zmq
from gym import spaces
from scipy.spatial.transform import Rotation as R
from ... |
<reponame>ipashchenko/jetsim
import math
import numpy as np
mas_to_rad = 4.8481368 * 1E-09
rad_to_mas = 1. / mas_to_rad
# Parsec [cm]
pc = 3.0857 * 10 ** 18
# Mass of electron [g]
m_e = 9.109382 * 10 ** (-28)
# Mass of proton [g]
m_p = 1.672621 * 10 ** (-24)
# Charge of electron [C]
q_e = 1.602176 * 10 ** (-19)
# Ch... |
"""
NCL_pdf_1.py
===============
This script illustrates the following concepts:
- Generating univariate probability distributions
- Generating PDFs of each sample distribution
- Paneling two plots horizontally on a page
- Modifying tick placement with matplotlib.ticker
See following URLs to see the repro... |
<filename>studies/effect_of_turbulent_wing_flow/effect_of_trips.py
import aerosandbox as asb
import numpy as np
af = asb.Airfoil(name="HALE_03 (root)", coordinates="HALE_03.dat")
no_trips = af.xfoil_aseq(
a_start=0,
a_end=15,
a_step=0.1,
Re=300e3,
max_iter=100,
verbose=True,
)
trips = af.xfoi... |
from surropt.caballero.problem import CaballeroReport
from surropt.core.options.nlp import DockerNLPOptions, IpOptOptions
from pathlib import Path
import numpy as np
from scipy.io import loadmat
from surropt.utils.models import evaporator
from surropt.caballero import Caballero
RESOURCES_PATH = Path(__file__).parents[... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals # at top of module
import os
import logging
import re
import string
from collections import Counter
import statistics
import numpy as np
import pandas as pd
import math
from scipy.stats import entropy
from math import log, e
import nlt... |
<gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, pickle, sys
import networkx as nx
import scipy.io as scio
import numpy as np
import pickle
### Assuming the input files are all pickle encoded networkx graph object ###
def data_load(path):
if os.path.exists(path):
# 加载已分好的缓存数据
p... |
# license: Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
# Licensed under the CC BY-NC-SA 4.0 license
# (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
# this code simulate the approximate motion required
# all time unit are picoseconds (1 picosec = 1e-12 sec)
import... |
<filename>LIHSPcommon/mysciutils_merged.py<gh_stars>0
#Author: <NAME>
#Last updated 8/30/2011
###Tukey Window code credited to Dat Chu of University of Houston. Updated by
###Scott to from a 2d Tukey
###http://leohart.wordpress.com/ << Dat Chu's blog
#####################################################################... |
""" GP model in CasADi.
"""
__author__ = '<NAME>'
__email__ = '<EMAIL>'
import time
import numpy as np
import casadi as cs
from scipy.linalg import solve_triangular
def CasadiRBF(X, Y, model):
""" RBF kernel in CasADi
"""
sX = X.shape[0]
sY = Y.shape[0]
length_scale = model.kernel_.get_para... |
<filename>common.py
import pickle
import os
import matplotlib.pyplot as plt
import numpy as np
import scipy.signal
import matplotlib.colors
import cv2
from emma.processing.dsp import *
from emma.io.io import get_trace_set
from matplotlib import collections as mc
op_to_int = {
"aes": 0,
"sha1prf": 1,
"hmac... |
<reponame>SoumyaShreeram/Locating_AGN_in_DM_halos<filename>python_scripts/010_Concatenate_cap_catAGN.py
"""
010. Concatenates the cluster files with affected Lx due to AGN
Script written by: <NAME>
Project supervised by: <NAME>
Date: 1st July 2021
"""
# astropy modules
import astropy.units as u
import astropy.io.... |
<filename>v4_pos+baseline/find_remove_sample.py
# coding: utf-8
import scipy
import json
import re
import allennlp
from allennlp.predictors.predictor import Predictor
from allennlp.commands.elmo import ElmoEmbedder
from torch.nn.utils.rnn import pad_sequence
from spacy.lang.en import English
import numpy as np
# imp... |
#!/usr/bin/python
"""Processing of the simulation data"""
import json
import csv
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
# Parameters
burnin = 500
input_folder = "output/"
file_pgibbs = input_folder + "yap_dengue_pgibbs_2048.json"
file_csmc = input_folder + "yap_dengue_csmc_2048.json"
o... |
import numpy as np
import math
import bisect
import scipy.stats as stats
from typing import TypeVar, Callable
from gym_fabrikatioRL.envs.env_utils import UndefinedInputType
from copy import deepcopy
# indicates generic types
T = TypeVar('T')
class SchedulingDimensions:
"""
Initializes and stores scheduling p... |
<reponame>mforbes/mmfutils-fork
"""BLAS and LAPACK access.
These functions provide access to BLAS routines from scipy which can improve
performance. This modules is woefully incomplete - it only contains functions
that I routinely used. It should give you an idea about how to add your own.
"""
import numpy.linalg
im... |
#!/usr/bin/env pythonw
# -*- coding: utf-8 -*-
from __future__ import print_function
from builtins import str
from builtins import range
import wx
import sys
import os
import scipy
from scipy import *
#------------------------------------------------------------------------
# def main():
#--------------------------... |
# Created on June 3, 2021
# @author: <NAME>
"""Class related to extracting HDF row numbers, timing information, and other DIO events from .ns5 files.
"""
from os import path as ospath
import numpy as np
import scipy as sp
from scipy import io
from riglib.ripple.pyns.pyns.nsexceptions import NeuroshareError, NSReturnTyp... |
"""
autor: <NAME>
Main game module
"""
import matplotlib.image as mpimg
import argparse
import matplotlib.pyplot as plt
from scipy.sparse import csc_matrix
import scipy.sparse.linalg
import copy
import os
from colors import color_int_to_float
from images import get_img_max_luminance, reinhard_image_mapping, clamp_... |
"""
* This file is part of RNIN-VIO
*
* Copyright (c) ZJU-SenseTime Joint Lab of 3D Vision. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/... |
<reponame>kuanpern/jupyterlab-snippets-multimenus<filename>example_snippets/multimenus_snippets/Snippets/SciPy/Setup.py
from __future__ import print_function, division
import numpy as np
import scipy as sp |
<reponame>adamoppenheimer/OG-USA
#%%
import numpy as np
import pandas as pd
import scipy.optimize as opt
import matplotlib.pyplot as plt
S = 80
ages = np.linspace(20, 100, S)
ages = np.linspace(20, 60, 40)
#### BASICALLY, MANUALLY CHANGE THESE VALUES TO MAKE DISUTILITY OF LABOR FOR HIGHER AGES HIGHER!!!!
chi_n_vals =... |
# This code generates a Voronoi-Poisson tessellation, meaning it generates
# a Poisson point process and then uses it to generate a corresponding
# Voronoi tesselation. A Voronoi tesselation is also known as a Dirichlet
# tesselation or Voronoi diagram.
#
# A (homogeneous) Poisson point process (PPP) is created on a r... |
from torch.utils.data import Dataset
import numpy as np
#from h5py import File
import os
import scipy
import scipy.io as sio
from utils import data_utils, plots
from matplotlib import pyplot as plt
import torch
class Datasets(Dataset):
def __init__(self, opt, split=0):
"""
:param path_to_data:
... |
import torch
import numpy as np
from scipy import linalg
from torch.nn.functional import adaptive_avg_pool2d
from metrics.fid.inception import InceptionV3
class fid(object):
def __init__(self, dataloader, device, dims=2048):
"""
dataloader: torch.utils.data.Dataloader
calc m1 ... |
<filename>smooth_rf/adam_sgd.py
import numpy as np
import pandas as pd
import scipy.sparse
import sparse
import progressbar
import copy
import sklearn.ensemble
import sklearn
import pdb
def adam_step(grad_fun, lamb_init = None,
alpha =.001,
beta_1 = .9, beta_2 = .999,
internal... |
<filename>src/io.py
import numpy as np
from numpy import genfromtxt
import matplotlib.pyplot as plt
import mdtraj as md
import scipy
import scipy.spatial
def load_dataset(pdb_filename,ids_filename='',keep_mode='intersect',superpose=False,pdb_clean=False,neighbour_cutoff=5.0,Nsigma=1):
""" load_dataset
Descri... |
<gh_stars>1-10
import warnings
import numpy as np
import pandas as pd
import scipy.stats
import bokeh.io
import bokeh.plotting
from .utils import *
from . import heat
from . import palettes
try:
import panel as pn # see if panel is installed
pn.extension()
_panel = True
except:
_panel = False
d... |
import copy
import pathlib
from typing import Union, List
import numpy as np
import pickle5 as pickle
from numpy import ndarray
from scipy.interpolate import interp1d
from .slip_gait_cycle import SlipGaitCycle
from .slip_model import SlipModel, THETA, X, THETA_DOT, X_DOT
class SlipTrajectory:
FILE_EXTENSION = '... |
<reponame>Intelligent-Systems-Phystech/ProjectTemplate
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
The :mod:`mylib.train` contains classes:
- :class:`mylib.train.Trainer`
The :mod:`mylib.train` contains functions:
- :func:`mylib.train.cv_parameters`
'''
from __future__ import print_function
__docformat__ = '... |
#!/usr/bin/env python3
from __future__ import with_statement
__author__ = u'veselt12'
import argparse
from synonyms.in_out.utils import check_input_file_exists, load_mat
from synonyms.dictionary import Dictionary
from synonyms.evaluation.test import Test
from synonyms.synonyms import SVDModel
from io import open
from s... |
<filename>probability/distributions/continuous/laplace.py
from typing import Optional
from scipy.stats import laplace, rv_continuous
from compound_types.built_ins import FloatIterable
from probability.distributions.mixins.attributes import MuFloatDMixin
from probability.distributions.mixins.calculable_mixin import Ca... |
<gh_stars>0
import sys
import statistics
import os
import fnmatch
# suppress TensorFlow information messages
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import collections
from keras import backend as K
from keras.models import Sequential, Model
from keras.layers import (Input, LSTM, Dense, Dropout, GaussianNoise, Gaussia... |
<reponame>shamelmerchant/CanTherm
#!/usr/bin/env python
"""
Copyright (c) 2002-2009 <NAME> and the CanTherm Team
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 wi... |
<gh_stars>0
import cv2
import cv2.cv as cv
import numpy as np
import signal, os, subprocess, sys
import time
import threading
import requests
import io
from picamera.array import PiRGBArray
from picamera import PiCamera
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
from fractions import Fraction
#
GPIO.setup(18, GPI... |
<filename>functions_legacy/IterGenMetMomFP.py
from collections import namedtuple
import numpy as np
from numpy import ones, eye, abs, mean, sqrt, r_
from numpy.linalg import solve
from scipy.optimize import minimize
def IterGenMetMomFP(epsi,p,Model,Order=2):
# This function computes the generalized method of mo... |
"""
Proto
Contains the following library code useful for prototyping robotic algorithms:
- YAML
- TIME
- PROFILING
- MATHS
- LINEAR ALGEBRA
- GEOMETRY
- LIE
- TRANSFORM
- MATPLOTLIB
- CV
- DATASET
- FILTER
- STATE ESTIMATION
- CALIBRATION
- SIMULATION
- UNITTESTS
"""
import os
import sys
import glob
import math
impo... |
<reponame>vaithak/Speaker-Diarization-System<gh_stars>1-10
import glob
from scipy.io import wavfile
from pyannote.database.util import load_rttm
class DataLoader():
"""docstring for DataLoader"""
def __init__(self, audio_folder, labels_folder, names_only=False):
# Audio files are assumed to have .wav e... |
<reponame>h-ssiqueira/HackerRank-problems<filename>Python/python/Polar_coordinates.py
import cmath
r = cmath.polar(complex(input()))
for cmp in r:
print(cmp)
#z = cmath.phase(complexnum)
#print(z) |
import numpy as np
import sympy as sp
import cvxpy as cv
import itertools
from sympy.polys.orderings import monomial_key
from sympy.utilities.lambdify import lambdify
from sympy import S, expand
from scipy.special import comb
from scipy.sparse import dok_matrix
import jax
jax.config.update('jax_platform_name', 'cpu')
f... |
<gh_stars>0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import pprint
import time
import spacy
from scipy.sparse.csr import csr_matrix
from textacy import Corpus
from textacy.tm import TopicModel
from textacy.vsm import Vectorizer
from base import BaseObject
from base import MandatoryParamError
class TextacyTop... |
"""
Copyright (C) 2022 <NAME>
Released under MIT License. See the file LICENSE for details.
Implementations of the square root of matrices, used inside Kalman
filters. Because scipy's cholesky isn't quite stable enough, this module's
implementation applies some hacks that ensure that an answer is... |
import pytest
import numpy as np
from numpy.testing import assert_array_equal
from scipy.cluster import hierarchy
from idpflex import cnextend as cnx
from idpflex.properties import ScalarProperty
class TestClusterNodeX(object):
def test_property(self):
n = cnx.ClusterNodeX(0)
n.property_group['p... |
<filename>src/analyses/plot/plot_utils.py
import pandas as pd
import numpy as np
import seaborn as sns
import seaborn as sn
from training.config import Config
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
from scipy.optimize import curve_fit
def get_heatmaps(data, no_pred=Fals... |
# ------------------------------------------ Import libraries ------------------------------------------#
import numpy as np
import pandas as pd
import re
from time import time, gmtime, strftime
from scipy.stats import itemfreq
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
# --------... |
<reponame>sichu366/Optimization
"""
unit commitment problem of IEEE test systems
"""
from pypower.loadcase import loadcase
from numpy import flatnonzero as find
from scipy.sparse.linalg import inv
from scipy.sparse import vstack, hstack
|
#!/usr/bin/env python
######### WORKFLOW DOCUMENTATION of FUNCTIONS #############################################
# First *InputArrays* to output 2 arrays (ppt value and xy values)
# Second *Run_IDW* for interpolation of the ppt-values, note has daughter classes
# Third *classify* classification of precipitation
# Fo... |
<reponame>1069066484/datasci_prj4
# -*- coding: utf-8 -*-
"""
Created on Wed May 15 21:03:28 2019
@author: 12709
"""
import numpy as np
#import scipy.io
import scipy.linalg
import Ldata_helper as data_helper
import Lglobal_defs as global_defs
import sklearn.metrics
import sklearn.neighbors
from sklearn import svm
if _... |
import sys
sys.path.append("/nesi/projects/nesi00213/Pre-processing/geoNet")
import scrapeGeoNet as sg
from geoNet_file import GeoNet_File
from process import Process
import os
#EVENT_SUMMARY_FILE = "20161113_110256.CSV"
#EVENT_SUMMARY_FILE = "20161113_110256.txt"
#EVENT_SUMMARY_FILE = "20161113_110256_missed_stations... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 26 13:58:02 2017
Testing suite for get_weights() function
@author: <NAME>
@email: <EMAIL>
Last modified: May 23, 2018
"""
import unittest
import sys
import numpy as np
import scipy.io as sio
# Add to the path code folder and data folder
sys.path.ap... |
# initial package imports
import numpy as np
from scipy.signal import zpk2tf,freqz,sawtooth,square,impulse
from math import pi
from numpy import exp,zeros_like,cos,sin,log10,angle
from numpy import convolve as conv
# to make the plots more TEX-like
import matplotlib
matplotlib.use('PS')
import pylab as plt
plt.switch_... |
import numpy as np
import numpy.linalg as la
import scipy.special
import matplotlib.pyplot as plt
# import scipy.sparse.linalg as spla
cos = np.cos
sin = np.sin
pi = np.pi
def curve(t):
a = 1.0
n = 5
eps = 0.25
return np.array(
[
(a + eps * a * cos(n * t)) * cos(t),
(... |
<reponame>JohnGBaker/tess-short-binaries<filename>src/mcmc/HB_MCMC.py
from astropy.stats import LombScargle
import pandas as pd
import numpy as np
#import matplotlib as mpl
#import matplotlib.pyplot as plt
import astroquery
from astroquery.mast import Catalogs,Observations
#import re
import sys
dirp='../../../TessSLB... |
import numpy as np
from scipy.optimize import check_grad
## softmax
def getAvgGradient(w, X, y, L, K):
N,D = X.shape
W = w.reshape((K,D))
XW = np.dot(X,W.T) # N x K
XW -= np.tile(XW.max(axis=1).reshape((N,1)),(1,K))
expXW = np.exp(XW) # N x K
sumexpXW = expXW.sum(axis=1) # N x 1
XWy = ... |
#Ref: <NAME>
####################################
#
#For better control over plotting you may as well use Matplotlib or Seaborn
#For Seaborn look here
##########################################
#Seaborn builds on top of matplotlib to provide a richer out of the box environment.
# https://seaborn.pydata.org/
#https:/... |
from matplotlib import pyplot as plt
from matplotlib.font_manager import FontProperties
from subprocess import call
import random
import sys
import math
from scipy.spatial import ConvexHull
from shapely import geometry
font = FontProperties()
font.set_family('Times New Roman')
font.set_size(12)
def generate_points_o... |
<reponame>deeuu/pylisten
import pandas as pd
import numpy as np
from scipy import stats
import collections
from . import utils
from . import correlation
WithinCorrelations = collections.namedtuple(
'WithinCorrelations',
'correlation spearman spearman_ci pearson pearson_ci concordance concordance_ci')
def ge... |
import numpy as np
from scipy.spatial.distance import cdist
from scipy.spatial.distance import cdist, pdist, squareform
from colt import Colt
from pysurf.database import PySurfDB
from pysurf.spp import within_trust_radius
from pysurf.spp import internal
class CleanupDB(Colt):
_questions = """
db_in = db.dat... |
import numpy as np
from scipy.optimize import minimize
# objective: minimize the output of x1*x4*(x1+x2+x3)+x3
# so that it satisfies: x1*x2*x3*x4 >=25
# sum(x1**2+x2**2+x3**3+x4**2)=40
# the bound of x1,x2,x3,x4 [1,5]
# start from x = [1,5,5,1]
def objective(x):
x1,x2,x3,x4 = x[0],x[1],x[2],x[3]
... |
<gh_stars>0
'''
@author: <NAME>
Tests for spatially structured networks.
'''
import numpy as np
import numpy.random as rnd
import scipy.integrate
import scipy.stats
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
class SpatialTester(object):
'''Tests for spatially structured networks.'''... |
<filename>horistickmusic.py
#!/usr/bin/env python2 -tt
# -*- coding: utf-8 -*-
__copyright__ = "© 2014 <NAME>"
__license__ = "MIT"
__version__ = "1.0"
import functools
import logging
import numpy
import os.path
import pygame
import scipy.io.wavfile
import scipy.signal
import sys
freq_sampling = 44100
folder = 's... |
#!/usr/local/bin/python
# <NAME> | 05/29/2018
#|__This script requires Python 3.4 and modules - numpy & scipy
#|__extracts the quality string and determine the length and average quality score of each read
#|__Converts the raw values for each read set into descriptive statistics
#|__Provides descriptive stats for ... |
import statistics, sys
class Library(object):
"""docstring for Library."""
def __init__(self, ID, n_books, signup_time, books_p_day, books, mean):
super(Library, self).__init__()
self.ID = ID
self.n_books = n_books
self.signup_time = signup_time
self.books_p_day = books_... |
<gh_stars>1-10
from lar import *
from scipy import *
import json
import scipy
import numpy as np
import time as tm
import gc
import struct
import getopt, sys
import os
import traceback
import logging
logger = logging.getLogger(__name__)
# ------------------------------------------------------------
# Logging & Timer
#... |
<reponame>MarieRoald/matcouply
import math
from copy import copy
from unittest.mock import patch
import numpy as np
import pytest
import scipy.stats as stats
import tensorly as tl
from pytest import fixture
from tensorly.testing import assert_array_equal
from matcouply import penalties
from matcouply._utils import ge... |
# TREC Question classifier
# Dataset : https://cogcomp.seas.upenn.edu/Data/QA/QC/
# Report : https://nlp.stanford.edu/courses/cs224n/2010/reports/olalerew.pdf
# Method: Used SVM to classify the questions
# Code: https://github.com/amankedia/Question-Classification/blob/master/Question%20Classifier.ipynb
import pandas... |
import sys
import fasttext
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import scipy.cluster.hierarchy as shc
all_tokens_file = 'ptb_dense_10k_cbow.tokens.txt'
all_token_paths_file = 'ptb_dense_10k_cbow.token_paths'
corpus = '/home/dave/agi/penn-treebank/simple-examples/data/ptb.train.txt'
#... |
import cv2
import numpy as np
import sympy as sp
from io import BytesIO
from PIL import ImageFont, ImageDraw, Image
from .helper import draw_arc, draw_bubble
from .graph import Graph, Node
from .string2graph import String2Graph
__all__ = [
'Graph',
'Node',
'draw_arc',
'draw_bubble',
... |
<reponame>adRenaud/research<gh_stars>1-10
#!/usr/bin/python
import numpy as np
from scipy import optimize
from sympy import *
import matplotlib.pyplot as plt
import pdb
def residualRK2(point,S,Sp):
CFL = symbols('CFL')
Res=0.
if S.shape[0]==1:
S1=[S[0,0]]
S2=[S[0,1]]
Sum1=np.sum(S1... |
"""Baseline score definition"""
import json
import os
from collections import defaultdict
import numpy as np
import pandas as pd
from scipy.stats import ranksums
from statsmodels.stats.multitest import multipletests
from tqdm import tqdm
from rxn_aa_mapper.aa_mapper import RXNAAMapper
def get_average_significant_ac... |
<gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy import interpolate
import pickle # to serialise objects
from scipy import stats
import seaborn as sns
from sklearn import metrics
from sklearn.model_selection import train_test_split
sns.set(style='whitegrid', palette='mu... |
import numpy as np
from scipy.io import loadmat
def get_unimib_data(s="acc"):
print("Loading UniMiB set ", s)
X_flat = loadmat("data/UniMiB-SHAR/data/" + s + "_data.mat")[s + "_data"]
y = loadmat("data/UniMiB-SHAR/data/" + s + "_labels.mat")[s + "_labels"][:,0]
if(s=="acc"):
labels = loadmat("d... |
from pyqtgraph.Qt import QtGui, QtCore
from scipy.fftpack import fft
import numpy as np
import scipy.stats
from GraphicsObject import GraphicsObject
import pyqtgraph.functions as fn
from pyqtgraph import debug
from pyqtgraph.Point import Point
import struct
__all__ = ['PlotCurveItem']
class PlotCurveItem(GraphicsObjec... |
<filename>src/scipp/constants/__init__.py
# flake8: noqa: E501
r"""
Physical and mathematical constants with units.
This module a wrapper around `scipy.constants <https://docs.scipy.org/doc/scipy/reference/constants.html>`_
and requires the ``scipy`` package to be installed.
Mathematical constants:
================ ... |
<gh_stars>0
from similarities.similarity import Similarity
from keras.preprocessing.text import text_to_word_sequence
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
from scipy.spatial.distance import cosine
import numpy as np
class D2VKSimilarity(Similarity):
"""Doc2vec similarityusing this: https://ww... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... |
# -*- coding: utf-8 -*-
import os
import re
from datetime import datetime
import numpy as np
from decimal import Decimal
import scipy.io as sio
import pandas as pd
from tqdm import tqdm
import glob
from decimal import Decimal
import datajoint as dj
from pipeline import (reference, subject, acquisition, stimulation, ... |
<reponame>luozm/Deep-Learning-for-HSI-classification
# -*- coding: utf-8 -*-
"""Preprocessing data.
Load the HSI data sets and split into several patches for CNN.
@Author: lzm
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import sci... |
<reponame>c0710204/python-socketio-cluster
from __future__ import print_function
from __future__ import division
import sys
sys.path.append('.')
sys.path.append('..')
import time
import numpy as np
from scipy import misc, ndimage
from collections import namedtuple
from pkg.pspnet import utils
import uuid
... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
from torchvision.utils import save_image
from torch... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.