text string |
|---|
import sys
sys.path.append('/usr/local/lib/python2.7/site-packages')
import os
import dlib
import scipy.io as sio
from skimage import io
import numpy as np
def run_dlib_selective_search(image_name):
img = io.imread(image_name)
rects = []
dlib.find_candidate_object_locations(img,rects,min_size=0)
propos... |
<filename>sympy/polys/domains/sympyintegerring.py
"""Implementaton of :class:`SymPyIntegerRing` class. """
from sympy.polys.domains.integerring import IntegerRing
from sympy.polys.domains.groundtypes import SymPyIntegerType
from sympy.polys.polyerrors import CoercionFailed
class SymPyIntegerRing(IntegerRing):
""... |
from sympy.printing.dot import (purestr, styleof, attrprint, dotnode,
dotedges, dotprint)
from sympy.core.basic import Basic
from sympy.core.expr import Expr
from sympy.core.numbers import (Float, Integer)
from sympy.core.singleton import S
from sympy.core.symbol import (Symbol, symbols)
from sympy.printing.rep... |
from tkinter import *
import numpy as np
from keras.models import load_model
from time import sleep, time
from scipy.io import savemat
class GenericFeedback:
on = True
attention_x = 0.0
attention_y = 0.0
# Named fields according to Warren doc !
FIELDS = {"COUNTER": 0, "DATA-TYPE": 1, "AF3": 4, ... |
import numpy as np
from pyPNS import PNS
import scipy.io
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
### Read toy example data which distributed along a small circle on S^2
small_circle_data = scipy.io.loadmat('../data/toy_example_small_circle.mat')
data = small_circle_data['data']
### Fit... |
<gh_stars>1-10
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import astropy
from astropy.io import ascii
import scipy
from scipy.interpolate import interp1d
from scipy.interpolate import UnivariateSpline
data=ascii.read('desielam.txt')
x=data['col1'].data
y=data['col2'].data
xarr=np.linspace(... |
<reponame>oasys-kit/dabax<gh_stars>0
#
# dabax functions with the same interface as xraylib
#
import numpy
import scipy.constants as codata
from silx.io.specfile import SpecFile
from dabax.common_tools import atomic_symbols, atomic_names, atomic_number
from dabax.common_tools import bragg_metrictensor
from dabax.common... |
import sys
import argparse
import scipy.special as ss
import time
import numpy as np
from numba import njit, jit
from numba import vectorize, float64
def get_data(size):
price = np.ones(size, dtype="float64") * 4.0
strike = np.ones(size, dtype="float64") * 4.0
t = np.ones(size, dtype="float64") * 4.0
... |
<filename>Probability/src/postprior.py<gh_stars>1-10
from bokeh.plotting import figure
from bokeh.io import export_png
import numpy as np
from scipy.stats import norm
x=np.linspace(0,50,100)
y=norm(30,15).pdf(x)
z=norm(40.1,0.2).pdf(x)
f=figure(title='Prior and posterior distribution on temperature',toolbar_location=N... |
from threading import Thread
from collections import Counter, OrderedDict
import subprocess
import time, datetime
import statistics
from IPython.display import display
import ipywidgets as widgets
import matplotlib
from launcher.study import Study
import sys
sys.path.append('/home/docker/melissa/melissa')
sys.path.ap... |
<filename>openvision/facenet/facenet.py<gh_stars>0
"""Functions for building the face recognition network.
"""
# MIT License
#
# Copyright (c) 2016 <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
# ... |
import pandas as pd
import numpy as np
import os
import segyio
import rasterio
from scipy.spatial import KDTree
import matplotlib.pyplot as plt
import math
from rdp import rdp
def line_length(line):
'''
Function to return length of line
@param line: iterable containing two two-ordinate iterables, e.g. 2 x... |
import pydsm
import pydsm.similarity
from scipy.stats import spearmanr
from pkg_resources import resource_stream
import pickle
import os
def synonym_test(matrix, synonym_test, sim_func=pydsm.similarity.cos):
"""
Evaluate DSM using a synonym test.
:param matrix: A DSM matrix.
:param synonym_test: A dic... |
<reponame>maryprimary/frg
"""带有stripe的正方格子"""
import numpy
from scipy import optimize
from basics import Square, Point, Segment
STRIPE = None
POTENT = None
PBANDTOP = None
def brillouin():
'''布里渊区'''
return Square(Point(0., 0., 1), numpy.pi * 2.)
def set_stripe(sval):
'''设置stripe,注意色散里用的stripe是负数的'''
... |
<reponame>kmch/FullwavePy
"""
(c) 2019-2020 <NAME>.
Copywright: Ask for permission writing to <EMAIL>.
"""
import numpy as np
from autologging import logged, traced
from fullwavepy.generic.decor import timer
from fullwavepy.generic.parse import kw, strip, path_extract, path_leave
from fullwavepy.generic.system import... |
# CREATED:2014-03-07 by <NAME> <<EMAIL>>
'''
Melody extraction algorithms aim to produce a sequence of frequency values
corresponding to the pitch of the dominant melody from a musical
recording. For evaluation, an estimated pitch series is evaluated against a
reference based on whether the voicing (melody present or ... |
<filename>simple_recipes/web_io.py
import re
from fractions import Fraction
from decimal import Decimal, getcontext
fraction_translation = {
# vulgar fractions
'\u00BC': '1/4',
'\u00BD': '1/2',
'\u00BE': '3/4',
'\u2150': '1/7',
'\u2151': '1/9',
'\u2152': '1/10',
'\u2153': '1/3',
'\u... |
<reponame>VardaHagh/Rigidpy
from __future__ import division, print_function, absolute_import
import numpy as np
from .framework import framework
import scipy.optimize as opt
from typing import Union
class configuration(object):
"""Optimized a configuration.
Args:
coordinates (Union[np.array, list]):... |
#!/usr/bin/env python
# coding: utf-8
# author: <NAME>
from collections import namedtuple
import numpy as np
from scipy import stats
import gurobipy as gp
from gurobipy import GRB
from sklearn import tree
class binOptimalDecisionTreeClassifier:
"""
Binary encoding optimal classification tree
... |
"""
Name : c8_24_second_way_to_calculate_return.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
import pandas as pd
import scipy as sp
p=[1,1.1,0.9,1.05]
a=pd.DataFrame({'Price':p})
a['Ret']=... |
# LSB Matching Algorithm
"""
WARNING: Images that start with white color from (0, 0) should never be used.
Because, lsb_embedding(255, 255, mi, mip1) ==> probable output having 256 as pixel
value, which saturates to 255 in python. This makes us loose one bit of message.
Hence white images are los... |
"""
@author: <EMAIL>
"""
import numpy as np
import tensorflow as tf
import tensorflow.keras.layers as kl
import tensorflow.keras.losses as kls
import matplotlib.pyplot as plt
import math
import os
from tqdm import tqdm
from scipy.interpolate import interp1d
import time
#disable gpu
physical_devices = tf.config.expe... |
import numpy as np
from io import BytesIO
from matplotlib import pyplot as plt
from scipy import interpolate
from matplotlib import image
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.transforms import Bbox
from matplotlib.patches import Ellipse
def devectorize_axes(ax=None, dpi=None, transpa... |
<gh_stars>1-10
#
# Copyright 2018 <NAME>
#
# ### MIT license
#
# 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, m... |
#!/usr/bin/env python3
# Using am_sensors/simulatedSensors
# [TODO]
# - Differentiate between std in static or moving behaviour
import math
from math import sin, cos, pi
import rospy
import tf
from std_msgs.msg import Header
from geometry_msgs.msg import Point, Pose, Quaternion, Twist, Vector3, PoseWithCovariance, ... |
"""
This script does the main statistics analysis between each variables
It requires the dataframe of all results to run the script.
"""
import sys
import os
from custom_dynamics.enums import MillerDynamics
import pandas as pd
import numpy as np
from scipy import stats
from pandas import DataFrame
sys.path.append(os.... |
"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ammann-Beenker tiling by squares and lozenges
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import math
import cmath
try:
import cairocffi as cairo
except ImportError:
import cairo
IMAGE_SIZE = (800, 800)
NUM_ITERATIONS = 4
PI4 = math.pi / 4
SQRT2 = math.... |
<reponame>ajsmilutin/CarND-Vehicle-Detection
import math
import os
import pickle
import cv2
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
from moviepy.editor import VideoFileClip
from scipy.ndimage.measurements import label
from skimage.feature import hog
from lane_finder import ... |
<reponame>tomerkeren42/DeePINK-BiggerNet
""" Tests knockpy.knockoffs and knockpy.smatrix modules"""
import warnings
import numpy as np
import scipy as sp
import unittest
from .context import knockpy
from knockpy import dgp, utilities, mac, mrc, smatrix, knockoffs
try:
import torch
TORCH_AVAILABLE = True
except... |
<filename>object_classification/heuristics.py
import argparse, pickle, random, shelve, math
from tqdm import trange
import numpy as np
from scipy.stats import entropy
from batchbald_redux import batchbald
import torch
from trainer import get_trainer
from utils import load_data, store_baseline
import help_text as ht
... |
<reponame>nikgetas/brain_parcellation_project
#####################################################################################
# EM algorithm for clustering Mixture Model and visualization
#
# Date: Nov. 25, 2018
# Author: <NAME>
#####################################################################################... |
<filename>examples_depr/fluctuation_scaling.py
import numpy as np
from scipy.stats import linregress
lnf = [1.3550,0.6775,0.3387,0.1693,0.0846,0.04930001,0.02110001,0.00529296875,0.002646484375,0.0013232421875,0.00066162109375,0.000330810546875,0.000165405273437,
8.27026367187e-05,4.13513183594e-05,2.06756591797e-05]
... |
<filename>tests/test_color_names.py<gh_stars>1-10
from fractions import Fraction
import pytest
from xenterval.ji import Monzo
from xenterval.interval.name.color import color_name
@pytest.mark.parametrize(['ratio_str', 'name'], [
('531441/524288', 'LLw-2'),
('27/14', 'r7'),
('31/16', '31o7'),
('49/25', ... |
#-------------------------------------------------
# batch_exe_depth_XPS.py
#
# Copyright (c) 2018, Data PlatForm Center, NIMS
#
# This software is released under the MIT License.
#-------------------------------------------------
# coding: utf-8
__package__ = "M-DaC_XPS/PHI_XPS_depth_tools"
__version__ = "1.0.0"
imp... |
<filename>vix_utilities.py
# from IPython.display import display_html, HTML
import pyfolio as pf
import numpy as np
import pandas as pd
from statsmodels.tsa.arima_model import ARMA
# import statsmodels.formula.api as smf
import statsmodels.tsa.api as smt
import statsmodels.api as sm
import scipy.stats as scs
# from arc... |
from __future__ import print_function
import sys
sys.path.insert(0, '.')
import torch
from torch.autograd import Variable
import torch.optim as optim
from torch.nn.parallel import DataParallel
import time
import os.path as osp
from tensorboardX import SummaryWriter
import numpy as np
import argparse
... |
"""
Meta Tuner Class: Used to optimize across a set of models:
- selecting intelligently the order of functions to optimize
Current implementation: Bare Metal functionality for testing.
ToDo: Improve code with better config management and remove hardcoded parameters
"""
from dataclasses import dataclass
from mango.doma... |
"""Frame-based cutting/trimming/splicing of audio with VapourSynth and FFmpeg."""
__all__ = ['eztrim']
__author__ = 'Dave <<EMAIL>>'
__date__ = '3 August 2020'
__credits__ = """AzraelNewtype, for the original audiocutter.py.
<NAME> (wiiaboo), for vfr.py from which this was inspired.
doop, for explaining the use of None... |
<filename>calibrations/linearity/linearity_fit.py
# -*- coding: utf-8 -*-
"""
Linearity figure and (linear) fit.
"""
# Module importation
import os
import string
import deepdish
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
# Other modules
from source.processing import ProcessImage, Figur... |
'''
Expression.py - wrap various differential expression tools
===========================================================
:Tags: Python
Purpose
-------
This module provides tools for differential expression analysis
for a variety of methods.
Methods implemented are:
DESeq
EdgeR
ttest
The aim of this mod... |
import numpy as np
import scipy.stats
def test_r_square():
from measurements import r_square
b = np.array([[1.0, 2.0, 3.0], [2.0, 2.0, 2.0]])
a = np.array([[1.0, 2.0, 4.0], [1.0, 2.0, 3.0]])
assert r_square(a,a) == 1.0
assert r_square(a, b) == - 0.5
def test_corr_coef():
from measurements ... |
<gh_stars>1-10
import argparse, time, logging, os, math, random
os.environ["MXNET_USE_OPERATOR_TUNING"] = "0"
import numpy as np
from scipy import stats
import mxnet as mx
from mxnet import gluon, nd
from mxnet import autograd as ag
from mxnet.gluon import nn
from mxnet.gluon.data.vision import transforms
from gluon... |
import scipy.stats as stats
import scipy.special as sc
import math
import numpy as np
from stats_util import *
def raw_gaussian_moments_univar(num_moments, mu, sigma):
"""
This function returns raw 1D-Gaussian moments as a function of
mean (mu) and standard deviation (sigma)
"""
moments = np.zeros... |
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import time
from keras.models import Sequential
from keras.layers import Dense, LSTM, Bidirectional
from keras.layers import Masking
from scipy.interpolate import UnivariateSpline,CubicSpline
output = 'C:/Users/yihao/... |
# ---------------------------------------------
# PeriodicityDetector.py (SPARTA USuRPer file)
# ---------------------------------------------
# This file defines the "PeriodicityDetector" class. An object of this class handles the "TimeSeries" class
# and enables... |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import copy
import shutil
try:
import fcntl
except ImportError:
print "NO FILE LOCKING AVAILABLE (no fcntl on windows...)"
import scipy as sp
import scipy.linalg as la
import sympy as sy
import evoMPS.tdvp_uniform as tdvp
import evoMPS.dynamics as d... |
<filename>test.py
import numpy as np
import scipy as sp
import binom_hmm as bh
import feature_map as fm
import matplotlib.pyplot as plt
'''
Test Script for computing the ground truth E[phi(x,t)|h]
TODO: extend this to full N distribution and make this modular
'''
if __name__ == '__main__':
n = 40;
N = 40;
... |
<filename>Chapter 8/task 2.py
from sympy import *
A=[1.2,1.4,1.6,1.8]
B=[0.8333,0.7143,0.6250,0.5556]
number=eval(input(" masukan nilai x ="))
for i in range (0,len(A)):
if A[i] >= number:
urut=i
break
h = A[urut] - A[urut - 1]
print(urut)
fow=(B[urut+1]-B[urut])/h
print("hasil fow =", fow) |
<filename>code/Lab1_MT1D_uniform.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 18 15:47:25 2019
@author: <NAME>
"""
import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as linalg
import matplotlib.pyplot as plt
''' frequency at which MT signals are to be computed '''
om... |
<filename>phyto_photo_utils/_fitting.py
#!/usr/bin/env python
from numpy import count_nonzero, isnan, inf, linalg, arange, repeat, nan
from scipy.optimize import least_squares
from sklearn import linear_model
import warnings
warnings.filterwarnings("ignore", category=RuntimeWarning)
from ._equations import __fit_kolbe... |
import path_magic
from function_space import FunctionSpace
import numpy as np
from mesh import CrazyMesh
from forms import Form
from hodge import hodge
from coboundaries import d
from assemble import assemble
import matplotlib.pyplot as plt
from quadrature import extended_gauss_quad
from scipy.integrate import quad
fro... |
<gh_stars>0
import numpy as np
from scipy.linalg import solve
def gaussseidel(A, B):
row, col = np.shape(A)
if row == col:
n = 10000
x = B/(np.diagonal(A))
inbuilt = solve(A,B)
for i in range(1, n):
x_new = np.zeros_like(x)
print(x)
for i in ra... |
<reponame>lutzkuen/statarb
#!/usr/bin/env python
import numpy as np
import pandas as pd
import gc
from scipy import stats
from pandas.stats.api import ols
from pandas.stats import moments
from lmfit import minimize, Parameters, Parameter, report_errors
from collections import defaultdict
from util import *
INDUSTR... |
<reponame>Jamiree/PyDMD
from __future__ import division
from past.utils import old_div
from unittest import TestCase
from pydmd import DMDc
import matplotlib.pyplot as plt
import numpy as np
import scipy
def create_system_with_B():
snapshots = np.array([[4, 2, 1, .5, .25], [7, .7, .07, .007, .0007]])
u = np.a... |
from collections import Counter
import numpy as np
from scipy.spatial import distance
class KNN:
def __init__(self, k: int):
"""Initialize the KNN
Args:
k (int): number of clusters
"""
self.k = k
def fit(self, X: np.ndarray, y: np.ndarray):
"""Fit the mode... |
# Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Solves a DC power flow.
"""
from numpy import copy, r_, matrix, transpose
from scipy.sparse.linalg import spsolve
def dcpf(B, Pbus, Va0, ref, pv, pq):
""... |
# necessary libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
from scipy.signal import find_peaks
from scipy.optimize import curve_fit
import warnings
warnings.filterwarnings("ignore")
###################################################################################... |
<reponame>cjh1/hexrdgui
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 29 14:20:48 2020
@author: berni
"""
import numpy as np
from scipy.optimize import leastsq
from hexrd.transforms import xfcapi
from hexrd.ui.calibration.calibrationutil import sxcal_obj_func
def enrich_pick_data(picks, instr, mat... |
<gh_stars>10-100
#!/usr/bin/env python3
# ----------------------------------------------------------------------
#
# <NAME>, U.S. Geological Survey
# <NAME>, GNS Science
# <NAME>, University at Buffalo
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
... |
<reponame>PawelRosikiewicz/SkinDiagnosticAI
# ********************************************************************************** #
# #
# Project: FastClassAI workbecnch # ... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import numpy as np
from numpy import asarray
from numpy import argmin
from numpy.linalg import det
from scipy.spatial.distance import cdist
from scipy.linalg import svd
from scipy.linalg import norm
from compa... |
from cvxpy import *
import numpy as np
import scipy as sp
import scipy.sparse as sparse
# Discrete time model of the system (mass point with input force and friction)
# Constants #
Ts = 0.2 # sampling time (s)
M = 2 # mass (Kg)
b = 0.3 # friction coefficient (N*s/m)
Ad = sparse.csc_matrix([
[1.0, Ts],
[0... |
##################### Flask backend
######## Libraries:
#render_template: allows to take a html file and call that
from flask import Flask, request, render_template
#From the image that the user draws modify using Scintific Python
from scipy.misc import imread, imsave, imresize
import numpy as np
import keras.models
i... |
# This code make a rough scan using big mesh, and later make a deep scan on big meshes where ions are located.
# While deep sacn, This code reomve the ions, once counted in a small grid
# This code should show Normalized/raw QE on a grid
'''
Created on January 21, 2019
@author: <NAME>
Email:<EMAIL>
'''
f... |
# -*- coding: utf-8 -*-
r"""EnzymeModule is a class for handling reconstructions of enzymes.
The :class:`EnzymeModule` is a reconstruction an enzyme's mechanism and
behavior in a context of a larger system. To aid in the reconstruction process,
the :class:`EnzymeModule` contains various methods to build and add associ... |
# start
# filter vcf of metagenomes for clonal populations
import glob
import os
from Bio import SeqIO
from Bio.Seq import Seq
import statistics
from statistics import stdev
import argparse
############################################ Arguments and declarations ##############################################
parser = ar... |
import scipy.ndimage as ndi
import numpy as np
import ietk
import torch
def pil_to_numpy(pil_img):
return np.array(pil_img)
def preprocess(img_mask_tensor, method_name,
resize_to=(512, 512), crop_to_size=(512, 512),
**affine_transform_kws):
"""
For retinal fundus images, wi... |
<filename>poptimizer/portfolio/tests/test_optimizer.py
import pandas as pd
import pytest
from scipy import stats
from poptimizer.portfolio import Portfolio, optimizer, portfolio
class FakeMetricsResample:
def __init__(self, _=None):
self.count = 30
@property
def all_gradients(self):
grad... |
<filename>masp/shoebox_room_sim/render_rirs.py
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Copyright (c) 2019, Eurecat / UPF
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following... |
from __future__ import absolute_import
from __future__ import print_function
from six.moves import range
__author__ = 'marafi'
#### Helper Created by <NAME>
#### This to include in future versions:
#### -Phaseless Filtering using FILFIL command in scipy
def FourierSpectrum(GMData, Dt):
import numpy as np
impo... |
import numpy as np
from scipy import special as scyesp
"""
Realiza una transformación de una matriz en el dominio de los continuos a una matriz binaria.
Usada para discretización de soluciones en metaheurísticas.
Donde cada fila es una solución (individuo de la población), y las columnas de la matriz corresponden a l... |
<reponame>Christophe-FR/BayesianLinearRegression
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 18 18:59:36 2021
@author: lutzc
"""
#streamlit run bayesian_linear_regression.py
import base64
import matplotlib
from sympy import *
import streamlit as st
import numpy as np
import pandas as pd
import plotly.graph_objects... |
<reponame>dpopadic/arpmRes
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_projection_brownian_mo... |
"""
Uses attrs
Adv: validators as method decorators, mypy works
Dis: pylance needs extra annotations, converters as separate functions
Note: mypy undestands that input types are for converter, and output types are as hinted
Look into: cattrs, attrs-serde
"""
import json
from scipy.optimize import curve_fit
import nump... |
<filename>pydmd/mosesdmd_grouped.py
"""
Derived module from dmdbase.py for higher order dmd.
Reference:
- <NAME>, <NAME>, Higher Order Dynamic Mode Decomposition.
Journal on Applied Dynamical Systems, 16(2), 882-925, 2017.
"""
import numpy as np
import scipy as sp
from scipy.linalg import pinv2
from mosessvd... |
# coding: utf-8
__author__ = 'ZFTurbo: https://kaggle.com/zfturbo'
import datetime
import pandas as pd
import numpy as np
import xgboost as xgb
from sklearn.cross_validation import KFold
from sklearn.metrics import roc_auc_score
from scipy.io import loadmat
from operator import itemgetter
import random
import os
impor... |
# encoding: utf-8
from brian2 import *
from PIL import Image
import numpy as np
from scipy import misc
from model.model import UnsupervisedSNM
from utils.utils import *
import matplotlib.pyplot as pyplot
import time
import math
import matlab.engine
import os
import scipy.io as sio
import argparse
def ma... |
"""
Triangle dipole density approximation error
==================================================
Compare the exact solution for the potential of dipolar density with magnitude of a
linear shape function on a triangle with two approximations.
"""
from bfieldtools.integrals import (
potential_vertex_dipoles,
... |
"""
Copyright (c) 2020 University of Southern California
See full notice in LICENSE.md
<NAME> and <NAME>
Shanechi Lab, University of Southern California
Helps with interfacing with matlab
"""
import scipy.io as sio
import numpy as np
import h5py
def loadmat(file_path, variable_names=None):
"Loads a mat file as ... |
<reponame>iotanalytics/IoTTutorial
# <NAME>, <NAME>, <NAME>, <NAME>
#
# MultiRocket: Effective summary statistics for convolutional outputs in time series classification
# https://arxiv.org/abs/2102.00457
import cmath
import os
import numpy as np
from numba import njit
# ============================================... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
from sklearn.preprocessing import MinMaxScaler
def butter_highpass(cutoff, fs, order=5):
nyq = 0.5 * fs
normal_cutoff = cutoff / nyq
b, a = signal.butter(order, normal_cutoff, btype='high', analog=False)
return b, a
def butter_... |
import matplotlib.pyplot as plt
import os
import json
import math
import torch
from torch import nn
from torch.nn import functional as F
from torch.utils.data import DataLoader
import commons
import utils
from data_utils import TextAudioLoader, TextAudioCollate, TextAudioSpeakerLoader, TextAudioSpeakerCollate
import... |
import numpy as np
import tensorflow as tf
def logistic_logpdf(*, x, mean, logscale):
"""
log density of logistic distribution
this operates elementwise
"""
z = (x - mean) * tf.exp(-logscale)
return z - logscale - 2 * tf.nn.softplus(z)
def logistic_logcdf(*, x, mean, logscale):
"""
l... |
<gh_stars>1-10
"""
Tests for iteratively weighted least squares
Upstream this is part of test_glm
"""
import warnings
import pytest
import numpy as np
from numpy.testing import assert_allclose
import sm2.api as sm
from sm2.genmod.families import links
from sm2.tools.numdiff import approx_fprime, approx_hess
@pytes... |
import random
from IPython import embed
import numpy as np
from scipy.stats import bernoulli
from python.rl_prefetcher import TableRLPrefetcher
from python.reward_functions import compute_reward
# TODO: how best to assign rewards? Should "too soon" of use be penalized? Should max reward be > 1?
# what if something is ... |
from math import pi
from collections import namedtuple
import scipy.signal
import torch
from e3nn import o3
from e3nn.o3 import FromS2Grid, ToS2Grid
def _find_peaks_2d(x):
iii = []
for i in range(x.shape[0]):
jj, _ = scipy.signal.find_peaks(x[i, :])
iii += [(i, j) for j in jj]
jjj = []
... |
<gh_stars>1-10
import warnings
import numpy as np
import cvxpy as cp
from scipy.linalg import solve_discrete_are
def policy_fitting(L, r, xs, us_observed):
"""
Policy fitting.
Args:
- L: function that takes in a cvxpy Variable
and returns a cvxpy expression representing the objectiv... |
import numpy as np
import matplotlib.pyplot as pyplot
import scipy.spatial.distance as sd
import sys
import os
import copy
sys.path.append(os.path.dirname(os.getcwd())+"/code_material_python")
from helper import *
from graph_construction.generate_data import *
def build_similarity_graph(X, var=1, eps=0, k=0):
""" ... |
<filename>project_1/main.py
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer, ENGLISH_STOP_WORDS, TfidfVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.model_selection import KFold
from nltk.cluster.kmeans import KMea... |
import matplotlib.pyplot as plt
import numpy as np
import scipy.io as scio
import displayData as dd
import lrCostFunction as lCF
import oneVsAll as ova
import predictOneVsAll as pova
plt.ion()
# Setup the parameters you will use for this part of the exercise
input_layer_size = 400 # 20x20 input images of Digits
num... |
<filename>tempo/est_cell_phase_from_current_cyclers.py
import sys
import numpy as np
import torch
import os
import pandas as pd
import scipy
from scipy import stats
import copy
import statsmodels
from statsmodels import nonparametric
from statsmodels.nonparametric import kernel_regression
# tempo imports
from . imp... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""iminuit fitting functions."""
import logging
import numpy as np
from scipy.stats import chi2, norm
from .likelihood import Likelihood
__all__ = [
"optimize_iminuit",
"covariance_iminuit",
"confidence_iminuit",
"contour_iminuit",
]
log ... |
<gh_stars>1-10
import math
import numpy as np
from scipy import optimize
from scipy import signal
from scipy import special
from ransac.estimators import ransac
class XRansac(ransac.Ransac):
"""A RANSAC variant that can find multiple models in the underlying data.
This is largely the classic RANSAC algorit... |
# -*- coding: utf-8 -*-
import statsmodels.api as sm
from statsmodels.base.model import GenericLikelihoodModel,\
GenericLikelihoodModelResults
from statsmodels.nonparametric.smoothers_lowess import lowess
from scipy.special import zeta
from scipy.stats import binom
import pickle
import numpy as np
lg = np.... |
<reponame>hongkai-dai/neural-network-lyapunov-1
import torch
import numpy as np
import cvxpy as cp
import gurobipy
from scipy.integrate import solve_ivp
import warnings
import neural_network_lyapunov.utils as utils
import neural_network_lyapunov.gurobi_torch_mip as gurobi_torch_mip
from neural_network_lyapunov.utils i... |
<gh_stars>0
'''
Functions dealing with (n,d) points
'''
import numpy as np
from .constants import log, tol
from .geometry import plane_transform
def transform_points(points, matrix, translate=True):
'''
Returns points, rotated by transformation matrix
If points is (n,2), matrix must be (3,3)
if ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""Authors: <NAME>, OverLordGoldDragon
Ridge extraction on signals with varying time-frequency characteristics.
"""
if __name__ != '__main__':
raise Exception("ran example file as non-main")
import numpy as np
import scipy.signal as sig
from ssqueezepy import ssq_cwt, ssq_st... |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME> and <NAME>
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import divisi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.