text string |
|---|
#!/usr/bin/env python
import os
import pdb
import glob
import sys
import shutil
import json
import re
import nibabel as nib
from argparse import ArgumentParser
import pandas as pd
import numpy as np
import nilearn.plotting as plotting
import itertools
import matplotlib.colors as colors
import seaborn as sns
impor... |
<reponame>szajek/FDM<filename>fdm/geometry.py
import math
import numpy
import numpy as np
import scipy.spatial
COORDS_HASH_ACCURACY = 7
COORDS_EQ_ACCURACY = 1e-8
INFINITY = 9e9
def calculate_length(components):
return sum([c ** 2 for c in components]) ** .5
def calculate_points_delta(point_1, point_2):
re... |
<gh_stars>1-10
import os
import numpy as np
import scipy.io as sio
from matplotlib import pylab as plt
# parameters
nlayers = 9
nruns = 1000
featureset = 'meangamma_bipolar_noscram_artif_responsive_brodmann'
suffix = '.permatrix.nothresh'
# list of subjects
subjects = sorted(os.listdir('../../Data/Intracranial/Proces... |
<filename>Chapter10/c10_39_implied_vol_binary_search.py
"""
Name : c10_44_implied_vol_binary_search.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
from scipy import log,exp,sqrt,stats
S=42;X... |
<reponame>sjfreed21/DataAnalysis<gh_stars>0
# read sounding
import urllib
import matplotlib.pyplot as plt
def read_sounding(url):
pressure=[]
altitude=[]
temp =[]
tdew =[]
lines =urllib.request.urlopen(url).readlines()
for line in lines[10:76]: # 100
entries = line.decode("utf-8... |
<reponame>michaelJwilson/specsim<filename>specsim/simulator.py<gh_stars>1-10
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Top-level manager for spectroscopic simulation.
For an overview of using a :class:`Simulator`, see the
`examples notebook
<https://github.com/desihub/specsim/blob/master/docs/... |
import warnings
import numpy as np
from scipy.spatial.transform import Rotation
from sparseba import SBA, can_run_ba
from tadataka.rigid_transform import transform
from tadataka.pose import Pose
from tadataka.transform_project import (pose_jacobian, point_jacobian,
transform_p... |
<reponame>PauloRVdC/TERRIFIER
import pandas as pd
import networkx as nx
import numpy as np
from scipy.spatial.distance import cosine
from trenchant_utils import make_hin
from trenchant_utils import inner_connections
df = pd.read_parquet('/media/pauloricardo/basement/commodities_usecase/soybean_corn_4w1h.parquet')
G_... |
# Author: <NAME> <<EMAIL>>
# Copyright (c) 2020 <NAME>
#
# This file is part of Monet.
"""Tests for the `ENHANCE` class."""
import pytest
from pandas.testing import assert_frame_equal
from scipy.stats import pearsonr
import numpy as np
from monet.core import ExpMatrix
from monet.denoise import ENHANCE
from monet.den... |
<filename>Statistics/PopulationSampler.py
from Statistics.RandomGenerator import RandomGenerator
from Statistics.Statistics import Statistics
import scipy.stats as st
class PopulationSampler(RandomGenerator):
def __init__(self):
self.stats = Statistics()
pass
# Simple random sampling
de... |
import math
import cv2
import numpy as np
import scipy
from scipy import ndimage
from scipy.ndimage import filters, gaussian_filter
from cv2 import warpAffine
from cv2 import INTER_LINEAR
from scipy.spatial import distance
def inbounds(shape, indices):
assert len(shape) == len(indices)
for i, ind... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Humanizing functions for numbers."""
import re
from fractions import Fraction
from .i18n import gettext as _, gettext_noop as N_, pgettext as P_
def ordinal(value):
"""Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd',
3 is '3rd', etc. Wo... |
<reponame>s-pike/advent2021<gh_stars>0
"""
--- Day 7: The Treachery of Whales ---
A giant whale has decided your submarine is its next meal, and it's much faster
than you are. There's nowhere to run!
Suddenly, a swarm of crabs (each in its own tiny submarine - it's too deep for
them otherwise) zooms in to rescue yo... |
<filename>DuoGAE/model.py
# PyTorch model
from DuoGAE.diff2vec import Diff2Vec
from DuoGAE.node2vec import Node2Vec
from DuoGAE.vgae import GAE, eval_gae_lp, GAE_NP
from DuoGAE.layers import SparseMM
from DuoGAE.utils import log_progress, sparse_mx_to_torch_sparse_tensor
from DuoGAE.preprocessing import make_incidence... |
# -----------------------------------------------------------------------------
# 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... |
<reponame>esfandyari/APDanalysis
import sys
import openpyxl as oxl
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
import peakutils
from scipy import interpolate
from bpeak_v2 import *
#################################### parameter of analysis ##############################
minimu... |
<reponame>gtsoukas/cfzoo<filename>src/main/python/benfred_implicit.py
import argparse
import logging
import numpy as np
import time
import implicit
from implicit.nearest_neighbours import bm25_weight
import scipy.stats as stats
from sklearn.datasets import load_svmlight_file
from sklearn.model_selection impor... |
import logging
from scipy.spatial.distance import cdist
import numpy as np
import argparse
import pickle
import os
import datetime,dateutil
import sys
import random
def create_log_dir(FLAGS):
now = datetime.datetime.now(dateutil.tz.tzlocal())
timestamp = now.strftime('%Y_%m_%d_%H_%M_%S')
log_dir = FLAGS.l... |
from abc import ABC, abstractclassmethod, abstractmethod
import numpy as np
from scipy.sparse import dok_matrix
from collections import defaultdict
from graphviz import Digraph
from bidict import bidict
import os.path
import tempfile
from ..prism import parse_label_file, prism_to_tra
from ..utils import InvertibleDict... |
# -*- coding: utf-8 -*-
"""
所有的tensor都要命名便于索引和使用,所有的程序都可以放在session中设计,
计算图可以保存和继续训练的关键在于变量tensor的命名始终保持一致,
因为最终也是为了获得更合适的变量。
版本3的改进地方:1、参数初始化改为正太分布(0,1);2、采用正则化方法增加泛化性能;
3、采用随步数而减小的学习率;4、适当引入tf的高层API;5、是否可以采用抽样降低
训练数据的不对称性造成的损失失衡?。【2、4、5】留着在下一版本中探索研究.
6、AdaGrad,一种先进的梯度下降法,用于重新调整每个参数的梯度,以便有效地为每个参数
指定独立的学习速率;7... |
<reponame>recski/wordsim
import logging
import sys
from keras.layers import Dense, Activation
from keras.models import Sequential
import numpy as np
from scipy.stats import spearmanr
from embedding import GloveEmbedding
from utils import cut
def create_model(input_dim, output_dim):
model = Sequential()
# m... |
<filename>ObsRealism.py<gh_stars>0
#!/bin/env python
'''
The statistical observational realism suite presented in Bottrell et al 2019b applied to the CFIS survey. If you use this suite in your research or for any other purpose, I would appreciate a citation. If you have questions or suggestions on how to improve or br... |
"""
=====================
07. Sliding estimator
=====================
A sliding estimator fits a logistic regression model for every time point.
The end result is an averaging effect across sensors.
"""
###############################################################################
# Let us first import the libraries... |
import tensorflow as tf
import numpy as np
from scipy.optimize import fmin_ncg
import matplotlib.pyplot as plt
from numpy.linalg import norm
class Influence(object):
'''
tf_session: the session that contains the trained network
trainable_weights: a list of all of the trainable weights in your network
l... |
#<NAME>
#<EMAIL>
#201507225
import time
import sys
import random
import copy
import statistics
import math
import interfaceUtils
import mapUtils
from worldLoader import WorldSlice
# x position, z position, x size, z size
area = (0, 0, 128, 128)
buildArea = interfaceUtils.requestBuildArea()
if buildArea != -1:
x1... |
# Command airsim
import airsim
import argparse
import datetime
import math
import matplotlib
import matplotlib.image
import numpy as np
import os
import pprint
import scipy
import scipy.misc
import sys
import tempfile
import time
from tqdm import tqdm
import tables
from tables import IsDescription, Float64Col
class ... |
from astropy.io import fits
from astropy.cosmology import WMAP9
from astropy import units as u
from matplotlib import pyplot as plt
import numpy as np
from scipy import stats
plt.ion()
def get_rgz_data():
with fits.open('/Users/willettk/Astronomy/Research/GalaxyZoo/rgz-analysis/rgz_wise_75_sdss.fits') as f:
... |
<filename>tests/statistics/test__kullbach_lieber_divergence.py
import pytest
import numpy as np
import scipy.stats
from scipy.stats import norm
from scipy.stats import multivariate_normal
from scipy.stats import gaussian_kde
from pypospack.statistics import kullbach_lieber_divergence
# testing for normal distributi... |
<reponame>MasazI/python-r-stan-bayesian-model-2<gh_stars>10-100
import numpy as np
import seaborn as sns
import pandas
import matplotlib.pyplot as plt
import mcmc_tools
from scipy.stats import norm
# 回帰分析の各種テクニックを学んでいく
# 7.3 非線形
# data-conc
# Time: 投与からの経過時間Time(hour)
# Y: 薬の血中濃度mg/mL
data_conc = pandas.read_csv('da... |
#!/usr/bin/python3
from boosting.gbm import GBRTmodel
from scipy.interpolate import griddata
import unittest
import os
import numpy as np
MPL = False
try:
from pylab import cm
import matplotlib.pyplot as plt
MPL = True
except: pass
SK_LEARN = False
try:
from sklearn.ensemble import GradientBoostingRegre... |
import numpy as np
from abc import ABC, abstractmethod
from scipy.linalg import inv, cholesky, cho_solve, solve_triangular
from numpy.linalg import slogdet
from scipy.optimize import minimize
import cvxpy as cp
class Covariance(object):
"""Base class for covariance objects"""
def __init__(self):
# co... |
<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Created on Tue May 08 17:13:52 2018
@author: adityac8
"""
# Suppress warnings
import warnings
warnings.simplefilter("ignore")
# Clone the keras_aud library and place the path in ka_path variable
import sys
ka_path="e:/akshita_workspace/git_x"
sys.path.insert(0, ka_path)
f... |
import random
import pandas as pd
import numpy as np
from multiprocessing import Pool
from scipy.spatial import distance
from scipy.spatial.distance import cdist
from src.configs import GENERAL, PREPROCESSING, MODELING
N_RANDOM_OBS = None
N_POTENTIAL_EL = 3
DISTANCE_TYPE = MODELING['distance_type']
class TripletGen... |
<gh_stars>0
from sympy import Point, Polygon
import shapely.geometry
# calculate intersection area between polygons
# example polygon: ((0, 0), (1, 0), (1, 1), (0, 1))
def poly_intersection_area(p1, p2):
poly1 = Polygon(*map(Point, list(p1)))
poly2 = Polygon(*map(Point, list(p2)))
polya = shapely.geomet... |
<filename>idw_rbf.py
# -*- coding: utf-8 -*-
import numpy as np
from scipy.interpolate import Rbf
def scipy_idw(x, y, z, xi, yi):
interp = Rbf(x, y, z, function='linear')
return interp(xi, yi)
|
import numpy as np
from scipy import misc
import os, sys
from os.path import dirname, realpath
sys.path.append(dirname(dirname(realpath(__file__))))
import pickle
import dnnlib.tflib as tflib
import operator
import argparse
import backbones.modifiedResNet_v2 as modifiedResNet_v2
import backbones.inception_resnet_v1 as ... |
#!/usr/bin/python3
import librosa
import librosa.display
import matplotlib.pyplot as plt
import numpy as np
import soundfile as sf
from music21 import *
from scipy.signal import savgol_filter
import cv2
import subprocess
import sys
import shutil
import os
import argparse
import configparser
import midi
def peaks(s... |
<gh_stars>0
# To import required modules:
import numpy as np
import time
import os
import sys
import matplotlib
import matplotlib.cm as cm #for color maps
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec #for specifying plot attributes
from matplotlib import ticker #for setting contour plots to ... |
'''
imput file: .tvf-TriVista-Datei
output file: ein Graph mit 3 Spektren: Frame1, Frame100 und den Frame mit der Minimalintensität
output file: zeitlicher Verlauf der Frames nach baseline correctur
'''
#written by <NAME>
from Ramanspektren.lib.allgemein import liste_in_floats_umwandeln
import os
import plotly
impo... |
<reponame>DanielKotik/mala<filename>ml-dft-sandia/networks/training_data/scripts/fp_clustering/cluster_fingerprints.py<gh_stars>10-100
#!/usr/bin/env python3
import os
import sys
import glob
import math
from collections import defaultdict
from itertools import cycle
import yaml
import numpy as np
import scipy.stats
fro... |
<reponame>PedroMDuarte/thesis-hubbard-lda_evap
import scubic
import lda
from scipy.optimize import minimize_scalar, brentq
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from matplotlib import rc
rc('font',**{'family':'serif'})
rc('text', usetex=True)
def optimal( **kwargs ) :
"""
... |
<filename>utils/overlapping_tiles_detection/IoU_based_decision/run_bbox_mapping.py
# -*- coding: utf-8 -*-
# @__ramraj__
import numpy as np
import pandas as pd
import json
import cv2
from PIL import Image, ImageDraw
from scipy.optimize import linear_sum_assignment
from scipy.spatial import distance
OFFSET = 448
TIL... |
# BSD 3-Clause License; see https://github.com/jpivarski/doremi/blob/main/LICENSE
from fractions import Fraction
from dataclasses import dataclass, field
from typing import List, Tuple, Dict, Optional, Union, Generator
import lark
import doremi.parsing
def is_rest(word: str) -> bool:
return all(x == "_" for x ... |
<reponame>lindsayad/python<filename>1D_DC_discharge.py
import numpy as np
from scipy.sparse import csr_matrix, lil_matrix
from scipy.sparse.linalg import spsolve
from numpy.linalg import solve, norm
from scipy.spatial import KDTree
from math import *
from numpy import newaxis
import matplotlib.pyplot as plt
# constant... |
# -*- coding: utf-8 -*-
"""
GISpy contains python functions to handle raster data align them together
based on a source raster, perform any algebric operation on cell's values
@author: Mostafa
"""
#%library
import os
import re
import sys
import datetime as dt
import numpy as np
import json
import gdal
import osr
impo... |
<reponame>iluvcapra/ptulsconv<filename>ptulsconv/footage.py
from fractions import Fraction
import re
import math
from collections import namedtuple
from typing import Optional
def footage_to_seconds(footage: str) -> Optional[Fraction]:
m = re.match(r'(\d+)\+(\d+)(\.\d+)?')
if m is None:
return None
... |
# Load nvdm or nvrnn, check how Gauss or vMF distributes
"Dataptb_Distnor_Modelnvrnn_Emb400_Hid400_lat200_lr0.001_drop0.2"
import os
import random
import time
import numpy
import scipy
import torch
from NVLL.data.lm import DataLM
from NVLL.framework.train_eval_nvrnn import Runner
from NVLL.model.nvrnn import RNNVAE
... |
''' Helper class to do cv2 stuff '''
import os
import unittest
import time
from datetime import datetime
import shutil
import copy
import cv2
import numpy as np
from scipy.spatial import distance
import pyscreenshot as ImageGrab
import config
import currency
from misc import CouldNotFindStashException
from invent... |
<reponame>kamperh/vqwordseg<filename>vqwordseg/algorithms.py
"""
VQ phone and word segmentation algorithms.
Author: <NAME>
Contact: <EMAIL>
Date: 2021
"""
from pathlib import Path
from scipy.spatial import distance
from scipy.special import factorial
from scipy.stats import gamma
from tqdm import tqdm
import numpy as... |
import os
import string
import re
import numpy as np
import SimpleITK as sitk
import scipy.ndimage as ndi
import nibabel as nib
from pprint import pprint
os.environ["SITK_SHOW_COMMAND"] = "/Applications/ITK-SNAP.app/Contents/MacOS/ITK-SNAP"
def run_N4biasCorr(fimg, fout):
numberFittingLevels = 4
numberOfIte... |
#!/usr/bin/env python
# coding: utf8
import sys, re, os
import numpy as np
import lmfit as lm
import matplotlib.pyplot as pyp
import matplotlib.text as matplotlibtext
from matplotlib import gridspec
from scipy.integrate import quad
from scipy.stats import norm
import pygap_work.magne.floglangint as fl
import fithe... |
<filename>EoS_HRG/test/plot_HRG.py
import numpy as np
import matplotlib.pyplot as pl
import os
import argparse
import scipy
# import from __init__.py
from . import *
from .. import *
# import the functions to test from HRG.py
from EoS_HRG.HRG import HRG,fit_freezeout,J
# for Hagedorn spectrum
from EoS_HRG.HRG import B... |
import numpy as np
import math
import time
import datetime
import urllib2
from scipy import stats
from django.utils import timezone
def get_slope(values):
v_max = np.max(values)
v_min = np.min(values)
n_value = len(values)
slope, intercept, r_value, p_value, std_err = stats.linregress(np.linspace(v_m... |
<reponame>ianran/rdml_graph
# Copyright 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,... |
<filename>postproc_mpi.py<gh_stars>0
import numpy as np
import os
import csv
import pickle
import sys
import matplotlib
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
import scipy.interpolate
from pyevtk.hl... |
#%% Import libraries
import time
import scipy.io as sio
from godec import godec
from utils import play_2d_video, play_2d_results
#%% Load data
mat = sio.loadmat('dataset/demo.mat')
M, height, width = mat['M'], int(mat['m']), int(mat['n'])
#%% Play input data
play_2d_video(M, width, height)
#%% Decompose
t = time.ti... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import networkx as nx
from scipy import sparse as sps
from scipy.io import mmread
def sample_mask(idx, l):
"""Create mask."""
mask = np.zeros(l)
mask[idx] = 1
return np.array(mask, dtype=np.bool)
def load_data(dataset_path, graph_paths... |
<reponame>dptam/neural_wfst<gh_stars>0
import numpy as np
import numpy.random as npr
from numpy import zeros, zeros_like, ones, empty, exp, log
from transducer import Transducer
from argparse import ArgumentParser
from scipy.optimize import fmin_l_bfgs_b as lbfgs
import codecs, sys
import cProfile, pstats
from features... |
<reponame>mkamalel/fsds-driverless-system<filename>analysis/tracking_analysis.py
import sys
import os
import math
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from fastslam import *
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pickle
import pand... |
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.base import clone
from sklearn.utils.fixes import loguniform
from scipy.stats import uniform, norm, randint
from sklearn.model_selection import RandomizedSearchCV
from sklearn.pi... |
import scipy.io
import scipy.misc
import numpy as np
# Load in annotations
datadir = 'data/MPII/'
annotpath = 'data/MPII/annot/mpii_human_pose_v1_u12_1.mat'
annot = scipy.io.loadmat(annotpath)['RELEASE']
nimages = annot['img_train'][0][0][0].shape[0]
def imgpath(idx):
# Path to image
filename = str(annot['ann... |
<gh_stars>0
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 0.8.6
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# +
import os, sys, subprocess
import warni... |
<filename>src/primaires/scripting/fonctions/talent.py<gh_stars>0
# -*-coding:Utf-8 -*
# Copyright (c) 2015 <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:
#
# * Redistributions of source c... |
<reponame>qobi/amazing-race
from __future__ import print_function
import pickle
import tf
import cv2
import os
import numpy as np
import math
import sys
import scipy
import argparse
from mpl_toolkits.mplot3d import Axes3D
import time
from scipy.optimize import linear_sum_assignment
import matplotlib
matplotlib.use('A... |
"""
.. drv.py
Discrete random variables; these are discrete (integer-valued) finite random
variables.
This module provides a simple (quite thin) wrapper around the extensive
scipy.stats module.
"""
## SciPy's random variable framework
import scipy.stats as ss
## Math
import numpy as np
inf = np.inf
## Randomizatio... |
<filename>src/pymgt/ppmt_utils.py
"""Projection Pursuit Multivariate Transform using moments as projection index
"""
import numpy as np
import scipy.stats
import scipy
from scipy.optimize import differential_evolution
from .utils import spherical2cartesian
def find_next_best_direction(x,
... |
# encoding: utf-8
"""
@author: l1aoxingyu
@contact: <EMAIL>
"""
import logging
import math
import torch
import torch.nn.functional as F
from scipy.stats import norm
from torch import nn
from fastreid.modeling.meta_arch import META_ARCH_REGISTRY, Distiller
logger = logging.getLogger("fastreid.meta_arch.overhaul_dis... |
<filename>web-application.py
#Import streamlit pandas and geopandas
import streamlit as st
import pandas as pd
import geopandas as gpd
#Import folium and related plugins
import folium
from folium import Marker
from folium.plugins import MarkerCluster
#Geopy's Nominatim
from geopy.geocoders import Nominatim
#Scipy'... |
<reponame>NunoEdgarGFlowHub/cvxpy
"""
Copyright 2013 <NAME>
This file is part of CVXPY.
CVXPY is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later versio... |
import sys
import time
import numpy
import scipy
import cv2
import argparse
import scipy.io.wavfile as wavfile
from pyAudioAnalysis import ShortTermFeatures as sF
from pyAudioAnalysis import MidTermFeatures as mF
from pyAudioAnalysis import audioTrainTest as aT
import scipy.signal
import itertools
import operator
impor... |
<gh_stars>1-10
__author__ = '<NAME>'
from scipy import stats
import numpy as np
import json
def main():
timestamps = []
bottom_norms = []
top_norms = []
# expects norms.dat in same directory. Can be changed to be a command-line arg
f = open('norms.dat', 'r')
for line in f:
words = lin... |
# Copyright 2019-2022 Cambridge Quantum Computing
#
# 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 a... |
import matplotlib.pyplot as plt
from scipy.misc import imread
from scipy.misc import imresize
from random import shuffle
import numpy as np
import cv2
from keras.models import load_model
import numpy as np
from statistics import mode
import glob
import os
import face_recognition
import string
from random import *
from... |
'''
author: cxn
version: 0.1.0
read camera calibration from mat
'''
import numpy as np
import cv2
from scipy.io import loadmat
import matplotlib.pyplot as plt
#双目相机参数
class stereoCameral(object):
def __init__(self):
stereoParameters = loadmat("./internal_reference/stereoParameters.mat")
self.cam... |
<filename>synthesize_data_multiclass.py<gh_stars>0
##========================================================================================
import numpy as np
from scipy import linalg
from sklearn.preprocessing import MinMaxScaler
""" ----------------------------------------------------------------------------------... |
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
import argparse, sys, time, math, json
from scipy.fftpack import fft, fftshift, ifft
class Waterfall():
"""Waterfall Tool Main Class"""
def __init__(self, fs, fc, f_chan, BW):
self.fs = fs
self.BW = BW
self.fc... |
<gh_stars>0
#!/usr/bin/python
# Turn on debug mode.
import sys
import cgi
import cgitb
cgitb.enable()
import csv
import numpy as np
import json
import os.path
import collections
import skbio.diversity as skdiv
import scipy.stats as stats
import math
import d3bf
form = cgi.FieldStorage()
id = "emap"
d3bf.chdir( form.... |
"""
Provides the data structures that represents a finite element space.
"""
# IMPORTS
import numpy as np
from scipy import sparse
from .manager import DOFManager
from .. import quadrature
# DEBUGGING
from IPython import embed as IPS
class FESpace(DOFManager):
"""
Base class for all finite element spaces.
... |
<reponame>binarybana/samcnet<gh_stars>10-100
from __future__ import division
import sys
import numpy as np
import tables as t
import matplotlib as mpl
import random
from math import log, exp, pi, lgamma
import scipy.stats as st
import scipy.stats.distributions as di
import scipy
from scipy.special import betaln
from... |
import test_tools
import carna.py as cpy
import math
import numpy as np
import scipy.ndimage as ndi
import faulthandler
faulthandler.enable()
# ============================
# Create toy volume data
# ============================
def gaussian_filter3d(img, sigma):
for i in range(3):
img = ndi.gaussian_fil... |
import scipy.io.wavfile as wav
import numpy as np
import os #for directories
import cPickle, gzip #for storing our data
import pickle
a = [0, 1, 2, 3]
b = [4, 5]
training_data = zip(np.zeros(shape=(80, 83968)), np.zeros(shape=(80, 2)))
test_data = zip(np.zeros(shape=(40, 83968)), np.zeros(shape=(40, 2)))
#print np.... |
<reponame>pcmagic/stokes_flow
# coding=utf-8
import pickle
from petsc4py import PETSc
import numpy as np
from scipy.io import savemat
# filename = 'sphere'
# with open(filename + '_pick.bin', 'rb') as input:
# unpick = pickle.Unpickler(input)
#
# viewer = PETSc.Viewer().createBinary(filename + '_M.bin', 'r')
# M =... |
import numpy as np
import cosmolopy
from scipy.interpolation import CubicSpline
import cosmolopy.distance as cd
import h5py
import scipy.optimize as op
import h5py
def dvdz(z):
'''
dv/dz to impose uniformity
in redshift
'''
cosmo = {'omega_M_0':0.3, 'omega_lambda_0':0.7, 'omega_k_0':0.0, 'h':0.72}
... |
<filename>wellcomeml/ml/frequency_vectorizer.py
#!/usr/bin/env python3
# coding: utf-8
"""
A generic "frequency" vectorizer that wraps all usual transformations.
"""
import logging
import re
from scipy import sparse
from sklearn.feature_extraction.text import TfidfVectorizer
from wellcomeml.utils import throw_extra_... |
import numpy as np
import scipy.io.wavfile
from scipy.fftpack import dct
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
class MFCC_Sanderson:
def __init__(self):
self.num_filters = 40
self.nfft = 2048
self.cep = 12
self.debug = False
def execute(self, signal,... |
<reponame>i-aki-y/librosa
#!/usr/bin/env python
# CREATED: 2013-10-06 22:31:29 by <NAME> <<EMAIL>>
# unit tests for librosa.decompose
# Disable cache
import os
try:
os.environ.pop("LIBROSA_CACHE_DIR")
except:
pass
import numpy as np
import scipy.sparse
import librosa
import sklearn.decomposition
import pyt... |
# y=mx+c is the general equation of line
# formulation of sse is sse= summation of [(y(i)-x(i)]^2
import matplotlib.pyplot as plt
import numpy as np
from numpy.core.function_base import linspace
from sympy import *
import point_predictor_calculus_excluding_complex_numbers as cp
#taking coordinates
n=int(input("... |
<gh_stars>100-1000
from pykml import parser
import re
import matplotlib.pyplot as plt
from shapely.geometry import Polygon
from descartes.patch import PolygonPatch
import numpy as np
import scipy.io
kml_file = 'community_areas.kml'
result_file = 'community_areas.mat'
def get_boundaries():
""" Parse the KML fil... |
<gh_stars>1-10
#!/usr/bin/env python
"""Linear algebra helper routines"""
import warnings
import numpy as np
import scipy.linalg
import scipy.sparse
def inner(v1, v2):
"""Calculate the inner product of the two vectors or matrices `v1`, `v2`.
* For vectors, the inner product is the standard Euclidian inner p... |
from functools import singledispatch
from typing import Callable, List, Optional, Tuple
import numpy as np
import torch
import torch.nn.functional as F
from scipy.optimize import linear_sum_assignment
@singledispatch
def permutate(y1, y2, cost_func: Optional[Callable] = None, returns_cost: bool = False):
"""Find... |
import numpy as np
#import control
from scipy.linalg import solve_continuous_are
from double_pendulum import DoublePendulum
import tensorflow as tf
import spinup
import matplotlib.pyplot as plt
from plotter import Plotter
#should be in form ./logs/ and then whatever foldername logger dumped
filename = 'ppo-dptest-usca... |
import numpy as np
import scipy.io as sio
import pickle
import datetime
import os
# padding_mode = {'reflect', 'mean'}
def get_data_in_window(window_size=3, features=None, padding_mode='reflect', three_classes=True):
if window_size % 2 == 0:
raise ValueError("Window size must be odd number but was {}!".fo... |
<gh_stars>10-100
# Copyright (c) 2016 <NAME>
# Copyright (c) 2016 <NAME>
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
import numpy as np
from scipy.sparse import dok_matrix
import util
class Soinn(object):
""" Self-Organizing Incremental Neural Network (SOIN... |
#!/usr/bin/env python
import os.path
import numpy as np
import scipy.stats
import config
import experiment_lib
import xgboost as xgb
class XGBoostExperimentRandomSearchCV(experiment_lib.ExperimentRandomSearchCV):
def __init__(self, **kwargs):
super(XGBoostExperimentRandomSearchCV, self).__init__(**kw... |
<filename>kaggle_fastai_custom_metrics/kfcm.py
import sklearn
from fastai.vision import *
from scipy.stats import spearmanr
import numpy as np
import pandas as pd
import torch
class column_mean_aucroc(Callback):
'''
Column wise mean AUCROC:
It's for one hot encoded targets only.
The AUCROC ... |
<reponame>mlech26l/GoTube
import numpy as np
import jax.numpy as jnp
import benchmarks as bm
import stochastic_reachtube as reach
import go_tube
import configparser
import time
from performance_log import log_args
from performance_log import close_log
from performance_log import create_plot_file
from performance_log i... |
<reponame>chaseaw/helpful-scripts
#!/usr/bin/python
'''
Created April 2022
@author: chasew
Takes in a single column csv with a list of primer barcodes, calculates average hamming distance, and generates desired number of new barcodes.
Usage python new-barcodes --csv --new
'''
import os,sys,argparse
from statistics i... |
<reponame>boringlee24/SIMBO<gh_stars>1-10
#! /usr/bin/env python
from __future__ import division, print_function
import argparse
import collections
import logging
import os
import random
import threading
import numpy as np
import pandas as pd
from itertools import cycle, islice
import keras
from keras import backe... |
<reponame>floydie7/FEMpy
"""
helpers.py
Author: <NAME>
Contains helper functions.
"""
import numpy as np
from matplotlib.path import Path
from scipy.integrate import quad, dblquad
def det_jacobian(u, v, vertices):
"""Determinant of Jacobian matrix."""
# Unpack our vertex coordinates
x1, y1 = vertices[0... |
<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#===========================================================================
# pyaudio_numpy_example.py
#
# Einfaches Code-Beispiel zum Einlesen / Schreiben von WAV-Dateien mit
# schneller numpy-Array Arithmetik
#
# Eine Audio-Datei wird frameweise eingelese... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.