text string |
|---|
import math
from matplotlib import rc
# rc('text', usetex=True) # this is if you want to use latex to print text. If you do you can create strings that go on labels or titles like this for example (with an r in front): r"$n=$ " + str(int(n))
from pylab import matplotlib, xticks, yticks
import numpy as np
import matplot... |
#!/usr/bin/env python
from tamasis import *
from csh import *
import numpy as np
import lo
import scipy.sparse.linalg as spl
# data
pacs = PacsObservation(filename=tamasis_dir+'tests/frames_blue.fits',
fine_sampling_factor=1,
keep_bad_detectors=False)
tod = pacs.get_tod()
... |
import numpy as np
import matplotlib
import matplotlib.gridspec
import matplotlib.pyplot as plt
import scipy.optimize
from helper import load, mean8, cropsave, grendel_dir
"""
MEMORY SCALING
Memory usage as function of problem size,
at z = 0.
This uses boxsize = 2*cbrt(N)*Mpc/h.
"""
textwidth = 240 # mnras: 240... |
import time
# import wave
import numpy as np
import scipy.io.wavfile
import alsaaudio as alsa
import matplotlib.pyplot as plt
def main():
# mic = alsa.PCM(alsa.PCM_CAPTURE, alsa.PCM_NONBLOCK, device='hw:2,0')
mic = alsa.PCM(alsa.PCM_CAPTURE, alsa.PCM_NORMAL, device='hw:2,0')
mic.setformat(alsa.PCM_FORMAT_... |
<filename>spet/lib/benchmarks/docker.py
# -*- coding: utf-8 -*-
"""Docker benchmarking.
This module handles the downloading, extracting, setting up, and running
Docker.
"""
import logging
import os
import shutil
import statistics
import subprocess
import time
from spet.lib.utilities import download
from spet.lib.util... |
<filename>crazyflie_demo/scripts/catenary_trajectoryC.py
import numpy as np
from scipy import optimize
def f(c,l,x_bar):
return (- l/2 + c * np.sinh(x_bar/(2*c))) # only one real root at x = 1
def Rotz(th):
Rot = np.array([[np.cos(th), -np.sin(th), 0],
[np.sin(th), np.cos(th), 0],
... |
from typing import Union, Callable, Dict
from itertools import product
from collections import OrderedDict
import numpy as np
from scipy.signal import find_peaks, find_peaks_cwt
import torch
from torch import Tensor
from gpytorch.models import ExactGP
from gpytorch.likelihoods import GaussianLikelihood
from utils.b... |
<filename>misc/homework/code/test04_ZeroPhaseFiltering.py
'''
Compare normal IIR filtering with zero-phase filtering
Use digital filter
XiaoCY 2021-02-18
'''
#%%
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as sig
fs = 500.
t = np.arange(0,5,1/fs)
x0 = np.cos(2*np.pi*t)+0.2*np.sin(2*np.pi*1... |
<reponame>Naman-ntc/3D-HourGlass-Network
import os
import torch
import numpy as np
import scipy.io as sio
import numpy as np
from helperFunctions import *
import pickle
class Bbox:
def __init__(self):
self.mean = None
self.delta = None
def makeBoundingBox(joints, slack = 0.2):
#slack is the percent of the extr... |
'''
Description: Implementation of GHOST model. Five functions provided which
can be used to create a halo-galaxy catalog. Sample code provided at the
end for getting started up with a halo catalog containing over 2,500 dark
matter halos at redshift zero. Requires SciPy, NumPy, and CosmoloPy.
'''
import numpy as np... |
<filename>preprocess/get_mask_3d.py<gh_stars>1-10
# -*- coding:UTF-8 -*-
# !/usr/bin/env python
#########################################################################
# File Name: get_mask_3d.py
# Author: Banggui
# mail: <EMAIL>
# Created Time: 2017年04月26日 星期三 15时34分25秒
#############################################... |
<gh_stars>1-10
import scipy.io
import numpy as np
import pandas as pd
from oct2py import octave
# Generated with SMOP 0.41
from libsmop import *
# sRRQR_rank.m
#octave.addpath('/StrongRRQR')
#def Strong_RRQR(X,k):
# Q, R, p = octave.sRRQR_rank(X,2,k)
# return p[0:k]
def Strong_RRQR(A,k):
... |
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import pandas as pd
import numpy as np
from scipy.special import expit, logit
import g... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, <NAME>
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# Modifications 2014-2016 <NAME>
""" Module stentpoints3d
Detect points on the stent from a 3D dataset containing the stent.
"""
# Normal imports
import os, sys
import numpy as np
import sci... |
import numpy as np
import pytest
import scipy.stats as ss
import elfi
import elfi.client
@pytest.mark.usefixtures('with_all_clients')
def test_batch_handler(simple_model):
m = simple_model
computation_context = elfi.ComputationContext(seed=123, batch_size=10)
batches = elfi.client.BatchHandler(m, computa... |
<gh_stars>1-10
import torch
import torchvision
import torchvision.transforms as transforms
import torchvision.models as models
import matplotlib.pyplot as plt
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import scipy.io as sio
import copy
import pandas as pd
impor... |
<filename>EvalPostproc/analyse.py<gh_stars>0
import datetime
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal
import csvTable
TIMESTAMP_FORMAT = '%d.%m.%Y %H:%M:%S'
def averageNonNan(data, axis):
masked_data = np.ma.masked_array(data, np.isnan(data))
return np.ma.average(... |
# Run Random Forest on retina images
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import ShuffleSplit
import numpy as np
import os
from scipy.misc import imsave,imread
from sklearn.grid_search import GridSearchCV
from datetime import datetime
import cPickle
# Define directory with... |
"""Main entry point."""
from typing import Tuple, Text
import json
import os
from absl import app
from absl import flags
from absl import logging
from datetime import datetime
import jax.numpy as np
from jax import random, value_and_grad, jit
import jax.experimental.optimizers as optim
from jax.ops import index_up... |
<filename>python/compiler_options.py
import numpy as np
try:
from numba import njit
compiler_decorator = njit
NUMBA_COMPILER = True
except ModuleNotFoundError:
def compiler_decorator(fun):
return fun
NUMBA_COMPILER = True
BLAS_DOT = False
if not NUMBA_COMPILER:
try:
from scip... |
import numpy as np
import pandas as pd
from scipy.optimize import leastsq
def runtime_regression(daily_runtime, daily_demand, method):
"""
Least squares regession of runtime against a measure of demand.
Parameters
----------
hourly_runtime : pd.Series with pd.DatetimeIndex
Runtimes for a p... |
<filename>files_lifetimes/combined_distributions_non_res.py
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 28 11:09:57 2018
@author: <NAME>
"""
import scipy.stats
import pandas as pd
from scipy.optimize import least_squares
import numpy as np
import math
import matplotlib.pyplot as plt
#%% Optimizatio... |
import autograd.numpy as np
from scipy.stats import uniform
from scipy.special import ndtri as z
from surpyval import xcn_handler
from surpyval import nonparametric as nonp
from surpyval import parametric as para
from surpyval.parametric.parametric_fitter import ParametricFitter
from scipy.special import factorial
fro... |
<gh_stars>1-10
"""Renders the Mosco A/B Test Dashboard web app. Made with Streamlit.
"""
import os
from datetime import datetime
import streamlit as st
import pandas as pd
import numpy as np
import scipy.stats
# import plotly.express as px
import plotly.graph_objects as go
# import plotly.figure_factory as ff
import ... |
# pylint: disable=import-error
import collections
import math
import random
import numpy as np
import pandas
import requests
import ta
import datetime
import yfinance as yf
from scipy.stats import linregress, norm
from stockstats import StockDataFrame
# pylint: disable=no-member
class StockEngine():
'''
The... |
<filename>Wrappers/Python/test/FindCenterOfRotation.py
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from scipy import ndimage
#import logging
#logger = logging.getLogger(__name__)
#
#
#__author__ = "<NAME>, <NAME>, <NAME>"
#__copyrig... |
from astropy.cosmology import Planck15 as Planck15
from astropy import units
from scipy import stats
import re
import glob
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
# =========================================================================== #
# ... |
import scipy
import numpy as np
def Jacobi(A, b, x, n):
D = np.diag(A)
R = A - np.diagflat(D)
for i in range(n):
x = (b - np.dot(R, x)) / D
print("Iteration {0}: {1}".format(i, x))
return x
Jacobi(np.array([[5.0, -1.0, 2.0], [3.0, 8.0, -2.0],
[1.0, 1.0, 4.0]])... |
<filename>data_reader/real_input.py
from typing import List
from scipy.sparse import csr_matrix
"""
Created Binary FeatureVector and Instance data structures.
Support converting the emaildataset object(the csr_matrix) into list of instances.
"""
class RealFeatureVector(object):
"""Feature vector data structure.
... |
<reponame>mathieukaltschmidt/CompQD
import matplotlib as mpl
mpl.rcParams['legend.handlelength'] = 0.5
pgf_with_rc_fonts = {
"font.family": "serif",
"font.serif": [], # use latex default serif font
"font.sans-serif": ["DejaVu Sans"], # use a specific sans-serif font
}
mpl.rcParams.update(p... |
<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 4 14:43:37 2020
@author: nooteboom
"""
import os
assert os.environ['CONDA_DEFAULT_ENV']=='Cartopy-py3', 'You should use the Cartopy-py3 conda environment here'
import numpy as np
import network_functions as nwf
from scipy.spatial.dist... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pandas as pd
import numpy as np
import csv
import gensim, os
import pickle
import pandas as pd
import numpy as np
import os
import difflib
import pprint
import pickle
import textdistance
from sklearn impo... |
<filename>02_HybridModelling/HyCho_FEM.py
import numpy as np
import bsplines as bsp
import scipy.sparse as spa
import scipy.special as sp
#================================================== mass matrix in V0 =========================================================
def mass_V0(T, p, bc):
el_b = bs... |
# -*- coding: utf-8 -*-
from __future__ import print_function
"""
Date: 10/1/16
©2016 <NAME>. All rights reserved.
"""
__author__ = 'ogata'
import os
import re
import csv
from time import time
import requests
from tqdm import tqdm
from concurrent import futures
import click
from scipy.misc import imresiz... |
"""utils.py - Helper functions
"""
import numpy as np
import torch
from torch.utils import model_zoo
from .configs import PRETRAINED_MODELS
def load_pretrained_weights(
model,
model_name=None,
weights_path=None,
load_first_conv=True,
load_fc=True,
load_repr_layer=False,
resize_posit... |
<filename>calculus-and-differential-equations/numerical-integration.py
"""
This module contains code that computes numerical integrals with Scipy
"""
import numpy as np
from scipy import integrate
def erf_integrand(t):
"""Represents the integrand of a Gaussian Error Function."""
return np.exp(-t**2)
val_quad... |
import os
import numpy as np
import pandas as pd
from scipy.stats import stats
from sklearn.metrics.pairwise import cosine_similarity
from common.utils import pos_tags_jsons_generator, DATA_DIR, OUTPUTS_DIR, \
load_model, read_relevant_set, read_reference_set
from dependency_parser.generate_relevant_sets import r... |
<reponame>jay1999ke/autoSense<filename>convtest.py<gh_stars>0
import torch
import numpy as np
import scipy.io as mat
from autosense.autodiff import autoTensor
from autosense.neural import Loss, Weight, Initializer, Linear, Optimizer, optimNode, Conv2D, Dropout
import autosense.autodiff.functional as F
import torch.nn.i... |
import pandas as pd
from scipy.stats import truncnorm
import time
from .sensor import Sensor
class HumiditySensor(Sensor):
def __init__(self, sensor_id: int, name="humiditySensor", units: str = 'Humidity [%]'):
super(HumiditySensor, self).__init__(sensor_id, name, units=units)
self.acquisition_t... |
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
class ResSim:
"""plot and animate res_sim.mat simulation data
Attributes:
filename (str): name of file to load in (MATv5 or HDF5)
arfidata (float ndarray): arfidata
axial (float ndarray): dept... |
'''
parse, subsample, and align a sequence data set
'''
from __future__ import division, print_function
import os, re, time, csv, sys
from io_util import myopen, make_dir, remove_dir, tree_to_json, write_json
from collections import defaultdict
from Bio import SeqIO
import numpy as np
from seq_util import pad_nucleotid... |
<filename>slides/2017-11-29-group-meeting/figs/watson.py
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.gridspec as gridspec
import scipy.special as special
inch_fig = 3
f, axs = plt.subplots(nrows=1, ncols=7, figsize=(7*inch_fig, inch_fig), subplot_kw={'p... |
#!/usr/bin/env python
# coding: utf-8
# # Kmeans and Hierarchical Clustering on SEED dataset
# In[1]:
'''Demonstrating seed dataset on various techniques'''
# Importing library
# Adding Preliminary Libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
get_ipython().run_line_magic('matplo... |
#! /usr/bin/env python
################################################################################
import os
import re
import subprocess
import glob as g
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate as interp
########################################################################... |
<reponame>ferjorosa/test-glfm<filename>vbsem_experiments/group_by_type.py
import numpy as np
import pandas as pd
from scipy.io import arff
directory = "../vbsem_data/mixed/"
data_name = "iris"
percentage = 0.2
percentage_string = "0" + str(int(percentage * 10))
i = 1
file_name = data_name + "_" + percentage_string + ... |
#!/usr/bin/env python3
# encoding: utf-8
"""
@Funciton: Sobel 算子进行边缘检测 —— 可分离卷积核
@Python Version: 3.8
@Author: <NAME>
@Date: 2021-10-14
"""
import sys
import math
from scipy import signal
import numpy as np
import cv2 as cv
def PascalSmooth(n):
"""函数 PascalSmooth 返回 n 阶的非归一化的高斯平滑算子,
即指数为 n-1 的二项式展开式的系数,
... |
<reponame>hfekrmandi/Autonomous-GNC-MAS
#!/usr/bin/env python2
from __future__ import print_function
import roslib
import sys
import rospy
import numpy as np
import datetime
import time
from geometry_msgs.msg import Twist
from dse_msgs.msg import PoseMarkers
from std_msgs.msg import Float64MultiArray
from std_msgs.msg ... |
import Chromatin
import os
import scipy
import glob
import sys
__version__="01.00.00"
__author__ ="<NAME>"
class DataBase:
def __init__(self, DATA_BASE_PATH):
PATH_TO_DATABASE=DATA_BASE_PATH
MOLECULE_FILES = []
MOLECULE_FILES = glob.glob(PATH_TO_DATABASE+'\\*\\*\\*\\molecule_info.txt') + MOLECULE_FILES
MO... |
<reponame>Kebniss/Capstone-project<filename>src/data/position_exploration.py<gh_stars>0
import os
import sys
import pickle
import numpy as np
import pandas as pd
from os import path
import seaborn as sns
from scipy import sparse, io
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from dotenv im... |
<reponame>yanggengshan/dyn_pose
import os
import cv2
import numpy as np
from cStringIO import StringIO
import scipy.ndimage
def pose2Img2(framePose):
pairRef = [1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13, 13, 14]
pairRef = np.reshape(pairRef,(-1,2)) - 1
im = np.zeros((300,300,3), np.uint8)
for... |
import numpy as np
from matplotlib import rcParams
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = ['Arial']
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import math
import pandas
from scipy.stats import gaussian_kde
from StringIO import StringIO
from collections import C... |
<filename>src/test_boundary.py
from model_boundary import model_fn_decorator
from model_boundary import SemanticPrediction as Network
from dataset import ABCDataset
import torch
import torch.optim as optim
import time, sys, os, random
from tensorboardX import SummaryWriter
import numpy as np
from util.confi... |
"""
Routines for working with rotation matrices
"""
"""
comment
author : <NAME>
date : April-2018
"""
import numpy as np
import sympy
from collections import namedtuple
# The following construct is required since I want to run the module as a script
# inside the skinematics-directory
import os
import sys
file_d... |
#! /usr/bin/env python3
from json import load
import rospy
import sys
import statistics
from nav_msgs.msg import Odometry
#should add class
class AngleCalculator:
def __init__ (self):
rospy.init_node ("angle_calculator", anonymous=True)
self.subscriber_odom = rospy.Subscriber ("/odom", Odom... |
<reponame>NULLCT/LOMC
#!python3.8
# -*- coding: utf-8 -*-
# abc209/d
import sys
import re
import math
from collections import *
from itertools import *
from decimal import *
from functools import *
from scipy.sparse import csgraph
def s2ss(s):
return s.split()
def s2nn(s):
return list(map(int, s2ss(s)))
... |
<filename>numtypes/tests/python_reference/logtypes.py
import math
import cmath
class logfloat:
"""
An instance of logfloat represents a nonnegative floating point value.
The log of the value is stored internally.
"""
def __init__(self, *args, logx=None):
if len(args) > 1:
ra... |
import torch
import autograd
import autograd.numpy as np
import scipy.integrate
import pdb
solve_ivp = scipy.integrate.solve_ivp
# pendulum parameters
states = 2 # number of states of system (theta, thetadot)
m = 0.5 # mass
g = 9.81 # gravity
L = 1 # length of the pendulum
# network params
input_dim = states
hi... |
<reponame>msrparadesi/tensortrade
# Copyright 2019 The TensorTrade Authors.
#
# 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 requi... |
<gh_stars>0
"""MODULE DOCSTRING - TO FILL IN"""
import os
import csv
import numpy as np
import pandas as pd
from scipy import stats
from om.maps.base import MapCompBase
from om.core.db import OMDB, check_db
#from om.core.par import Par, run_corr_par
from om.core.utils import clean_file_list, avg_csv_files
from om.co... |
from __future__ import absolute_import, division, print_function
import argparse
import importlib
import itertools
import time
from multiprocessing import Pool
import numpy as np
import os
import pdb
import pickle
import subprocess
import sys
import tensorflow as tf
import tensorflow.contrib.slim as slim
import thr... |
import aerosandbox as asb
import aerosandbox.numpy as np
from conventional import airplane
from scipy import integrate
t_span = (0, 120)
def dynamics(t, y):
dyn = asb.FreeBodyDynamics(
*y,
g=1,
)
aero = asb.AeroBuildup(
airplane=airplane,
op_point=dyn.op_point
).run()... |
import sys
import multiprocessing
import gensim.models.doc2vec
from gensim.models import Doc2Vec
from gensim.models.doc2vec import TaggedDocument
from gensim.utils import simple_preprocess
from scipy.stats import pearsonr
from os.path import isfile
assert gensim.models.doc2vec.FAST_VERSION > -1
class ParagraphVector... |
<gh_stars>1-10
import os
import re
import sys
from optparse import OptionParser
from collections import Counter
import numpy as np
from scipy import sparse
from spacy.en import English
import file_handling as fh
def main():
usage = "%prog train.json test.json output_dir"
parser = OptionParser(usage=usage)
... |
import os
import logging
import argparse
import numpy
from collections import defaultdict
import torch
from scipy import linalg, mat, dot, stats
from torch.nn import EmbeddingBag
DATA_ROOT = os.path.dirname(os.path.abspath(__file__)) + "/data/"
class Wordsim:
def __init__(self, lang):
logging.debug("col... |
<reponame>wu1369955/item<gh_stars>0
import copy
from torch import nn
import PIL
import numpy as np
import torch
from PIL.Image import Image
from scipy.signal import convolve2d
import os
import random
from sklearn import metrics
from sklearn import metrics
from sklearn.metrics import roc_auc_score
os.envir... |
# -*- coding: utf-8 -*-
import wave
import scipy as sp
from util import read_signal, get_frame, add_signal, write_signal, compute_avgpowerspectrum
from pyssp.voice_enhancement import JointMap
from six.move import xrange
from .MinimumStatistics import MinimumStatistics
if __name__ == "__main__":
WINSIZE = 512
s... |
<reponame>jwa7/h.e.o.m-quantum<gh_stars>1-10
"""
Produces meta-data from QuantumSystem.time_evolution trajectories
"""
import numpy as np
from scipy import integrate
from quantum_heom import utilities as util
from quantum_heom.lindbladian import LINDBLAD_MODELS
def integrate_trace_distance(systems, reference) -> li... |
# -*- coding: utf-8 -*-
#
# Reaction time analysis
#
# Psychometric curve estimated from wheel movement direction for early/late reaction trials
#
# Author: <NAME> (<EMAIL>)
#
from math import *
import sys
import alf.io
from oneibl.one import ONE
from ibllib.misc import pprint
import numpy as np
import scipy.stats as ... |
# 4.3.2 ポアソン混合分布における推論:ギブスサンプリング
#%%
# 4.3.2項で利用するライブラリ
import numpy as np
from scipy.stats import poisson, gamma # ポアソン分布, ガンマ分布
import matplotlib.pyplot as plt
#%%
## 観測モデル(ポアソン混合分布)の設定
# 真のパラメータを指定
lambda_truth_k = np.array([10, 25, 40])
# 真の混合比率を指定
pi_truth_k = np.array([0.35, 0.25, 0.4])
# クラスタ数を取得
K = len... |
<reponame>ThomasBrouwer/BNMTF
"""
Variational Bayesian inference for non-negative matrix tri-factorisation.
We optimise the updates s.t. we compute each column of F and G using matrix
operations, rather than each element individually.
We expect the following arguments:
- R, the matrix
- M, the mask matrix indicating o... |
<reponame>Hammer7/PythonStanfordMachineLearning
import os
import numpy as np
import re
import string
from nltk.stem import PorterStemmer
from scipy.io import loadmat
from svm import SVM
# Exercise 6 | Spam Classification with SVMs
scriptdir = os.path.dirname(os.path.realpath(__file__))
def linearKernel(x1, x2):
... |
__all__ = [
"construct_cost_matrix",
"frame_to_features",
"track_single_pos",
"track",
]
import numpy as np
import scipy
from scipy import ndimage as ndi
from scipy.optimize import linear_sum_assignment
from .track_utils import _reindex_labels, overlap, reindex
def norm(prev, curr):
for col in r... |
import re
import numpy as np
import scipy.misc
import os
from scipy.misc import imresize
from PIL import Image, ImageDraw, ImageFont
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
def dra... |
'''
this function provides a tool to crop images. the image type is tiff
this function can be used as gui mode or terminal mode
for terminal mode, here is how to use it:
image_crop path_to_image_folder path_to_output_folder crop_size_col crop_size_row col_shift row_shift
description:
... |
from __future__ import division
from __future__ import absolute_import
import numpy as np
import pandas as pd
import scipy as sp
from rankit.Table import Table
from scipy.sparse import coo_matrix
from scipy.sparse.linalg import lsqr
from .matrix_build import fast_colley_build
from numpy.linalg import norm
class Unsupe... |
<filename>utils/mlr.py
import numpy as np
import scipy.optimize as opt
import scipy.interpolate as interpolate
# MLR for initialization
def regression_model(coefficients, regressors, T):
# initialize
y = np.zeros(len(T))
# proxies (including seasonal cycles and trend)
for i in range(len(regr... |
<reponame>xf1590281/ASNets
#!/usr/bin/env python3
"""Plot cumulative time taken for ASNets to solve a complement of problems."""
from argparse import ArgumentParser
from itertools import cycle, groupby
from json import load
import re
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import numpy... |
import numpy as np
from scipy.stats import norm
import pandas as pd
import matplotlib.pyplot as plt
# Function to estimate point of intersection of normal curves of two classes, at the point of intersection diff
# is zero or a point where the difference changes it sign
def intersection(f, g, x):
d = f - g
fo... |
<reponame>charlesblakemore/opt_lev_analysis<gh_stars>0
import os, fnmatch, sys
import dill as pickle
import scipy.interpolate as interp
import scipy.optimize as opti
import scipy.constants as constants
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import bead_util as bu
import co... |
<filename>qutip/fortran/mcsolve_f90.py
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, <NAME> and <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condit... |
import numpy as np
from sympy import *
from sympy import codegen
def dh2tf(a, alpha, d, theta):
if not all(len(lst) == len(a) for lst in [alpha, d, theta]):
print("Incorrect length of a, alpha, d, theta. Returning 0")
return 0
Ti = []
for i in range(0,len(a)):
sinTheta = sin(theta... |
<gh_stars>0
import csv
import logging
import time
import pandas as pd
from docopt import docopt
from gensim.models import KeyedVectors
from scipy.spatial.distance import cosine as cosine_distance
import numpy as np
def main():
"""
Compute local neighborhood measure for target words' topN neighbors.
"""
... |
<reponame>LMesaric/Seminar-FER-2019
import random
import matplotlib.pyplot as plt
import numpy as np
import sympy
from deap import algorithms, base, creator, tools
from sympy.utilities.lambdify import lambdify
class MathFunGA:
# CXPB is the probability with which two individuals are crossed
CXPB = 0.5
#... |
import numpy as np
from scipy.stats import multivariate_normal as mvn_pdf
import matplotlib.pyplot as plt
from sklearn.cluster import MiniBatchKMeans
from mixture import GaussianMixture
import pymesh
def compute_gmm(x,k=2,w=None,iter_max=10000,i_tol=1e-9,e_tol=1e-3):
km = MiniBatchKMeans(k)
if w is None:
... |
<reponame>randhawasimar/thesis
import logging
import os
import sys
import matplotlib.pyplot as plt
frmt = logging.Formatter(
"%(asctime)s - %(levelname)s - %(processName)s (%(process)s) - %(threadName)s - %(module)s - %(filename)s - %(lineno)d - "
"%(message)s", "%Y-%m-%d %H:%M:%S %Z")
h1 = logging.StreamHandl... |
<reponame>gordon-n-stevenson/shape_icc<gh_stars>0
#! /usr/bin/python
"""
Python implementation of the ShapeICC method devised by <NAME> from
<NAME>, <NAME>. Agreement and reliability statistics for shapes. PLoS One. 2018;
13(8):e0202087. Published 2018 Aug 23. doi:10.1371/journal.pone.0202087
"""
#MIT License... |
<reponame>ChristopherMayes/PyCSR2D
from csr2d.deposit import histogram_cic_2d
from csr2d.central_difference import central_difference_z
from csr2d.core2 import psi_sx, psi_s, psi_x0, psi_x0_hat, Es_case_B0, Es_case_A, Fx_case_A, Es_case_C, Fx_case_C, Es_case_D
from csr2d.core2 import psi_s_SC, psi_x0_SC
from csr2d.con... |
'''
This script contains examples of functions that can be used from the Seaborn
module.
'''
import seaborn as sb
import numpy as np
import statistics
import matplotlib.pyplot as plt
# Distribution Plots ---------------------------------------------------------
from scipy.stats import spearmanr, pearso... |
"""
analyze EEG data
Created by <NAME> on 25-08-2017.
Copyright (c) 2015 DvM. All rights reserved.
"""
import mne
import pickle
import numpy as np
from IPython import embed as shell
from scipy.stats import ttest_rel
def eeg_reader(subject_id, sessions = 2):
'''
'''
# get eeg data
eeg = []
for session in rang... |
<reponame>gtca/mofax
from .core import mofa_model
from .utils import *
import sys
from warnings import warn
from typing import Union, Optional, List, Iterable, Sequence
from functools import partial
import numpy as np
from scipy.stats import pearsonr
import pandas as pd
from pandas.api.types import is_numeric_dtype
i... |
<reponame>basiralab/Kaggle-BrainNetPrediction-Toolbox
"""
Target Problem:
---------------
* Predict the evolution of brain connectivity over time.
Proposed Solution (Machine Learning Pipeline):
----------------------------------------------
* Eliminate Correlated Features -> Backward Elimination -> Decision Tree Regre... |
#!/usr/bin/env python
import numpy as np
from scipy import stats
from icecube.phys_services import I3MT19937
N=10000
seed_params = [(), (0,),([],),([0],),([0,0],),([0,0,0],)]
for i in range(len(seed_params)):
for j in range(i,len(seed_params)):
rng1 = I3MT19937(*seed_params[i])
rng2 = I3MT19937(... |
# Copyright (c) 2020 Memex @ Imperial College London
import numpy as np
import matplotlib as plt
from numpy.core.numeric import identity
from sympy import Matrix, init_printing
from sympy.physics.quantum import Operator, Dagger
from sympy.matrices import zeros
from fractions import Fraction
from pprint import pprint
i... |
<filename>tools/extract_tfidf.py<gh_stars>10-100
from sklearn.feature_extraction.text import TfidfTransformer
from scipy.sparse import dok_matrix
import numpy as np
VOCAB_SIZE = 7987
TRANSC_SIZE = 277
with open('data/feats/transc.txt', 'r') as file:
counts = dok_matrix((TRANSC_SIZE, VOCAB_SIZE), dtype=np.float32)... |
<reponame>CG3002Group3/CG3002
"""
Train walk or run based on raw values
"""
import numpy as np
import csv
from sklearn.ensemble import RandomForestClassifier
from sklearn.externals import joblib
import csv
import numpy as np
import pandas as pd
import numpy as np
from numpy import fft, sin, pi
from scipy import arang... |
<filename>kkpy/util.py
"""
kkpy.util
========================
Utility functions for my research
.. currentmodule:: util
Winds
-------
.. autosummary::
kkpy.util.wind2uv
kkpy.util.uv2wind
kkpy.util.ms2knot
kkpy.util.knot2ms
Radars
--------
.. autosummary::
kkpy.util.dbzmean
Microphysics
--------... |
<reponame>Stellarator-X/PreSumm
import os
import scipy
import pandas as pd
from sentence_transformers import SentenceTransformer
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
from sklearn.metrics import classification_report
from rouge import Rouge
from statistics import mean
impo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Image Filtering
Reference: http://machinelearninguru.com/computer_vision/basics/convolution/image_convolution_1.html
Note:
The outputs are slightly different from the original outputs in the post,
due to the `image.png` file is not available (using `image.jp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 17 13:53:36 2020
@author: chrisbartel
"""
from compmatscipy.CompAnalyzer import CompAnalyzer
import numpy as np
from scipy.optimize import nnls
from compmatscipy.TrianglePlots import get_label
class ReactionAnalysis(object):
def __init__... |
<filename>synthesis.py
from distributed import apply_gradient_allreduce
import time
import IPython.display as ipd
from numpy import finfo
import sys
sys.path.append('waveglow/')
import numpy as np
import torch
from hparams import create_hparams
from model import Tacotron2
from layers import TacotronSTFT, STFT
from ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.