text string |
|---|
#To import required modules:
import numpy as np
import time
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 log scale
import scipy.integrate #... |
<filename>HARK/ConsumptionSaving/ConsPortfolioModel.py
# FIXME RiskyShareLimitFunc currently doesn't work for time varying CRRA,
# Rfree and Risky-parameters. This should be possible by creating a list of
# functions instead.
import math # we're using math for log and exp, might want to just use numpy?
import scipy.op... |
# -*- coding: utf-8 -*-
"""
A Ring Network Topology
This class implements a ring topology. In this topology,
the particles are connected with their k nearest neighbors.
This social behavior is often found in LocalBest PSO
optimizers.
"""
# Import standard library
import logging
# Import modules
import numpy as np
f... |
"""Matplotlib based plotting of quantum circuits.
Todo:
* Optimize printing of large circuits.
* Get this to work with single gates.
* Do a better job checking the form of circuits to make sure it is a Mul of
Gates.
* Get multi-target gates plotting.
* Get initial and final states to plot.
* Get measurements to plo... |
# -*- coding: utf-8 -*-
"""
Acquisition functions
"""
from typing import Optional, List
import numpy as np
from scipy.stats import norm
from ml_utils.models import GP
class AcquisitionFunction(object):
"""
Base class for acquisition functions. Used to define the interface
"""
def __init__(self, su... |
<filename>tricks/nb101/cosine_restart.py
import copy
import json
import logging
import math
import os
import pickle
import random
import numpy as np
import nni
import torch
import torch.nn as nn
import torch.optim as optim
from scipy import stats
from nni.nas.pytorch.utils import AverageMeterGroup
from torch.utils.ten... |
#!/usr/bin/env python
import logging
import datetime
import sys
import json
import warnings
sys.path.append('../')
warnings.filterwarnings("ignore")
import pandas as pd
from scipy import stats
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.model_selection import RandomizedSearchCV
import l... |
<filename>mars/learn/cluster/tests/test_k_means.py
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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/LIC... |
from scipy import *
from matplotlib import *
from pylab import *
Delay=10
path=os.getenv('P_Dir')
path_data=os.getenv('P_Data')
Kv=os.getenv('K')
fout=open('%s/Emb_plot_K_%s.dat' %(path,Kv),'w')
Lines=open('%s/Data_0155.dat' %path_data,'r').readlines()
for i,Line in enumerate(Lines):
if i>Delay:
Words=Line.... |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
#!/usr/bin/env pyhton
# -*- coding: UTF-8 -*-
__author__ = '<NAME>'
__date__ = '06/02/2021'
__version__ = '1.0'
r'''
This script predicts output MSP using a trained regression model and performs:
1. Sensitivity analysis with one query input;
2. Response analysis with two query inputs;
3. Monte Carlo simulation with... |
<gh_stars>1000+
"""
Greyscale dilation
====================
This example illustrates greyscale mathematical morphology.
"""
import numpy as np
from scipy import ndimage
import matplotlib.pyplot as plt
im = np.zeros((64, 64))
np.random.seed(2)
x, y = (63*np.random.random((2, 8))).astype(np.int)
im[x, y] = np.arange(8... |
"""
Sequential selection
"""
import numbers
import warnings
from abc import abstractmethod
import numpy as np
import scipy
from scipy.linalg import eig
from scipy.sparse.linalg import eigs as speig
from sklearn.base import (
BaseEstimator,
MetaEstimatorMixin,
)
from sklearn.feature_selection._base import Sele... |
<filename>misc/jupyter_notebooks/18.09.19/ipython_notes.py
# coding: utf-8
from __future__ import unicode_literals
s = 'abcd1213-=*&^тавдыжжфщушм'
s
s[0]
s[-1]
s[5:10]
'abc' + 'def'
str(1)
str([1, 2, 3, 'hello', (5, 6, 7), {'d', 'e', 'd'}])
s[0] = 'r'
del s[]0
del s[0]
b'abc'
type(b'abc')
b = b'abc'
b + 'abc'
b + b'abc... |
<gh_stars>10-100
#!/usr/bin/env python
#
# Created by: <NAME>, March 2002
#
""" Test functions for scipy.linalg.matfuncs module
"""
from __future__ import division, print_function, absolute_import
import math
import warnings
import numpy as np
from numpy import array, eye, dot, sqrt, double, exp, random
from numpy.... |
import os
import time
import logging
import platform
import csv
from datetime import datetime
import statistics
import xlrd
import sys
sys.path.insert(0,"/Users/mlml/Documents/GitHub/PolyglotDB/polyglotdb/acoustics")
from formant import analyze_formants_vowel_segments_new, get_mean_SD, get_stdev, refine_formants, extra... |
from statistics import mean
from timeit import Timer
from database import database
from threading import Thread
__version__ = '0.2.0'
# thread count
TH_LOW: int = 2
TH_MED: int = 4
TH_HIG: int = 8
TH_EXT: int = 16
# table names
HISTORY: str = "moz_formhistory"
# count_query() result - static test variable
ROW_COUNT:... |
import abc
import cv2 as cv
import matplotlib.pyplot as plt
import scipy
from skimage.measure import regionprops
from tfcore.utilities.image import *
from PIL import Image
class Preprocessing():
def __init__(self):
self.functions = ([], [], [])
def add_function_x(self, user_function):
self.... |
<gh_stars>10-100
import hashlib, warnings
import numpy as np
import pandas as pd
from scipy.stats import norm as normal_dbn
from ..algorithms.lasso import ROSI, lasso
from .core import (infer_full_target,
infer_general_target,
repeat_selection,
gbm_fit_sk)
fro... |
<reponame>AdrianNunez/Fall-Detection-with-CNNs-and-Optical-Flow<gh_stars>100-1000
from __future__ import print_function
from numpy.random import seed
seed(1)
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import os
import h5py
import scipy.io as sio
import cv2
import glo... |
import pandas as pd
import numpy as np
from scipy.sparse import csr_matrix, vstack
import sys
import math
import re
def sigmoid(Z): #Sigmoid function
return np.exp(Z)/(1+np.exp(Z))
def predictions(weights, X): #Given W and X, return predictions
return sigmoid(csr_matrix.dot(X, weights))
def calc_gradient(X, e):
... |
import os
import signal
import pickle
import numpy as np
from scipy import sparse
from krotos.paths import PATHS, mkdir_path
from krotos.utils import Singleton
from krotos.msd.db.echonest import EchoNestTasteDB
from krotos.exceptions import ParametersError
from krotos.debug import report
from krotos.msd.latent import ... |
<filename>neurokit2_parallel.py
# This file attempts to replicate the
# neurokit2.ecg_process and ecg_interval_related methods,
# but vectorized to support multi-lead ECGs without loops.
import re
import functools
import warnings
import neurokit2 as nk
import numpy as np
import pandas as pd
import scipy
import scipy.s... |
<reponame>ndexbio/ndex-enrich
__author__ = 'dexter'
from scipy.stats import hypergeom
# createEnrichmentSet(setName)
# deleteEnrichmentSet(setName)
# updateEnrichmentSet(setName)
# addNetworkToEnrichmentSet(setName, NDExURI, networkId)
# removeNetworkFromEnrichmentSet(setName, networkId)
#
# getEnrichmentSet(setName)... |
<reponame>fusion-flap/flap_w7x_camera<filename>flap_w7x_camera.py
# -*- coding: utf-8 -*-
"""
Created on Tue May 14 14:14:14 2019
@author: Csega
This is the flap module for W7-X camera diagnostic
(including EDICAM and Photron HDF5)
"""
import os.path
import fnmatch
import numpy as np
import copy
import h5py
import p... |
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from datetime import datetime
from django.apps import apps
import statistics
import csv
from water_store.data_store.los_angeles_county import wrp_data
import helpers.query_helpers
wrp_model = ... |
<reponame>castorini/numbert
# coding=utf-8
# Copyright 2020 castorini team, The Google AI Language Team Authors and
# The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in comp... |
## UNCOMMENTING THESE TWO LINES WILL FORCE KERAS/TF TO RUN ON CPU
#import os
#os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import tensorflow as tf
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.callbacks import ModelCheckpoint
from tensorflow.python.keras.models import model_from_json
... |
<reponame>joordamn/CellESignal
# -*- encoding: utf-8 -*-
'''
-------------------------
@File : data_explore.ipynb
@Time : 2022/01/20 14:11
@Author : <NAME>
@Contact : <EMAIL>
@Desc : 此脚本用于
1) 读取原始txt数据
2) 寻找峰值点及其坐标
3) 将原始数据及导出的... |
<reponame>rickyspy/Pedestrian-Model-Evaluation<filename>Evaluation.py
r'''
# Notes
# With the code, we'd like to formulate a framework or benchmark for quantitatively evaluating a pedestrian model
# by comparing the trajectories in simulations and in experiments. Note that an essential condition for the application
# o... |
<reponame>psesh/Efficient-Quadratures
""" Please add a file description here"""
from equadratures.distributions.template import Distribution
from equadratures.distributions.recurrence_utils import jacobi_recurrence_coefficients
import numpy as np
from scipy.stats import uniform
RECURRENCE_PDF_SAMPLES = 8000
class Unif... |
# -*- coding: utf-8 -*-
import os
import timeit
from contextlib import contextmanager
import numpy as np
from scipy.io import wavfile
from scipy import linalg, fftpack, signal
import librosa
from librosa import feature as acoustic_feature
from path import FSDD_PATH
def read_audio_files():
"""
Return
------
... |
<reponame>NSLS-II/pyCHX
"""
Sep 10 Developed by Y.G.@CHX
<EMAIL>
This module is for the static SAXS analysis, such as fit form factor
"""
#import numpy as np
from lmfit import Model
from lmfit import minimize, Parameters, Parameter, report_fit, fit_report
#import matplotlib as mpl
#import matplotlib.pyplot as plt
#f... |
<gh_stars>1-10
import numpy as np
import math
import fatpack
# import rainflow
import matplotlib.pyplot as plt
import pandas as pd
import h5py
import seaborn as sns
from scipy.signal import savgol_filter
import scipy.stats as stats
def Goodman_method_correction(M_a,M_m,M_max):
M_u = 1.5*M_max
M_ar = M_a/(1-... |
"""
Estimators : Empirical, Catoni, Median of means, Trimmed mean
Random truncation for u=empirical second moment and for u=true second moment
Data distributions:
- Normal (with mean=0, sd = 1.5, 2.2, 2.4)
- Log-normal (with log-mean=0, log-sd = 1.25, 1.75, 1.95)
- Pareto (a=3,xm= 4.1,6,6.5)
The parameters are... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def pprint_gaus(matrix):
"""
Pretty print a n×n matrix with a result vector n×1.
"""
n = len(matrix)
for i in range(0, n):
line = ""
for j in range(0, n+1):
line += str(matrix[i][j]) + "\t"
if j == n-1:
... |
<filename>tests/build/scipy/scipy/sparse/tests/test_sputils.py
"""unit tests for sparse utility functions"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import TestCase, run_module_suite, assert_equal
from scipy.sparse import sputils
class TestSparseUtils(T... |
#!/usr/bin/python
#
# x2z2
# BT Nodes for Testing, ID, Solving
#
# Solve using the x^2 + y^2 method Craig uses
# for puma joint 2 (eqn 4.65 p 118)
#
# BH 2/2/17
#
# BH : Dec-21: SIMPLIFY! After squaring and summing,
# if a one-unk equation is identified, just add
# it to the list ... |
import numpy as np
from SkewedSlicingTree import SkewedSlicingTree
from NormPolishExpression import NormPolishExpression
from SlicingTreeSolutionCache import SlicingTreeSolutionCache
import math
import copy
import warnings
import enum
from Utilities import LOG
import statistics
from Parameters import Parameters
# Alg... |
'''
Copy number variation (CNV) correction module
Author: <NAME>, <NAME>
'''
import numpy as np
import scipy
def read_CNVdata(CN_file,cell_list):
'''
reads a file contaning a matrix of copy number data and filters out
copy number data for inputted set of desired cell lines
'''
ndarr = np.genfromt... |
# -*- coding: utf-8 -*-
import numpy as np
from dramkit.gentools import isnull
from dramkit.datsci.stats import fit_norm_pdf
from dramkit.datsci.stats import fit_norm_cdf
from dramkit.datsci.stats import fit_lognorm_pdf
from dramkit.datsci.stats import fit_lognorm_cdf
from dramkit.datsci.stats import fit_weibull_pdf
f... |
#! /usr/bin/Python
from gensim.models.keyedvectors import KeyedVectors
from scipy import spatial
from numpy import linalg
import argparse
import os
DEFAULT_OUTPUT_PATH = '/home/mst3/deeplearning/goethe/eval-results'
def output_category(count, sums):
str = ''
if count == 0: count = 1
for i in range(0,... |
from __future__ import division, print_function, absolute_import
from .core import SeqletCoordinates
from modisco import util
import numpy as np
from collections import defaultdict, Counter
import itertools
from sklearn.neighbors.kde import KernelDensity
import sys
import time
from .value_provider import (
Abstract... |
<gh_stars>1-10
from statistics import mean, stdev
from pydes.core.metrics.accumulator import WelfordAccumulator
from pydes.core.metrics.confidence_interval import get_interval_estimation
from pydes.core.metrics.measurement import Measure
class BatchedMeasure(Measure):
"""
A measure that has an instantaneous ... |
#!/usr/bin/env python
"""
Since one might not only be interested in the individual (hyper-)parameters of a bayesloop study, but also in arbitrary
arithmetic combinations of one or more (hyper-)parameters, a parser is needed to compute probability values or
distributions for those derived parameters.
"""
from __future_... |
<reponame>hz324/fast_interpolation<filename>single_distance_benchmark.py<gh_stars>0
import time
import generate_random_spd
import scipy.sparse.linalg
import scipy.linalg
import matplotlib.pyplot as plt
import numpy as np
times_thompson = []
times_euclidean = []
times_logeuclid = []
op_number = 130
sample_number = 1
f... |
# coding: utf-8
# In[91]:
#%matplotlib inline
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize']=(15,5)
#%matplotlib inline
# In[103]:
# 求取绘制cdf的数据
cdf_result=np.linspace(0,1,1000)
x=norm.ppf(cdf_result)
# 求取绘制pdf的数据
xx=np.linspace(-4,4,50)
yy=norm.pdf... |
<reponame>iorodeo/photogate_test
#!/usr/bin/env python
import sys
import scipy
import pylab
def get_period(file_name,print_info=False, plot_data=False):
"""
Compute the period of the pendulum from the data file
"""
data_vals = load_data(file_name)
pend_len, time_vals, sens_vals = data_vals
# C... |
<filename>tests/test_unsupervised.py<gh_stars>10-100
from pathlib import Path
import numpy
import pandas
from matplotlib import pyplot
from scipy.spatial.distance import euclidean
from ds_utils.unsupervised import plot_cluster_cardinality, plot_cluster_magnitude, plot_magnitude_vs_cardinality, \
plot_loss_vs_clus... |
<filename>src/Classes/MSDS400/PFinal/Q_14.py
# A rectangular tank with a square base, an open top, and a volume of 500 ft cubed is to be constructed of sheet steel.
# Find the dimensions of the tank that has the minimum surface area.
from sympy import symbols, solve, diff, pprint
volume = 4000
s, h = symbols( 's... |
<reponame>liangyy/mixqtl-gtex
import argparse
parser = argparse.ArgumentParser(prog='run_r_mixfine.py', description='''
Prepare the bundle of input matrices for r-mixfine run
''')
parser.add_argument('--hap-file', help='''
the genotype files in parquet format.
It assumes that two haplotypes are separate
... |
from cmath import exp, cos, sin, pi
def f(x,n,w): return (lambda y=f(x[::2],n/2,w[::2]),z=f(x[1::2],n/2,w[::2]):reduce(lambda x,y:x+y,zip(*[(y[k]+w[k]*z[k],y[k]-w[k]*z[k]) for k in range(n/2)])))() if n>1 else x
def dfft(x,n): return f(x,n,[exp(-2*pi*1j*k/n) for k in range(n/2)])
def ifft(x,n): return ... |
import logging
import numpy as np
import openml
import openmlcontrib
import openmldefaults
import os
import pickle
import sklearn.model_selection
import statistics
import typing
from openmldefaults.models.defaults_generator_interface import DefaultsGenerator
AGGREGATES = {
'median': statistics.median,
'min':... |
import numpy as np
import cv2
from mayavi import mlab
mlab.options.offscreen = True
import matplotlib.pyplot as plt
from scipy.linalg import null_space
from math import atan2, pi
import seaborn as sns
FIG_SIZE = (480, 360)
PLOT_ORDER = [0,2,1]
def compare_voxels(grid_dict, *args, **kwargs):
dsize = len(grid_dict)... |
"""
Classes for passing results from transport and depletion
"""
from collections.abc import Sequence, Mapping
import numbers
import numpy
import scipy.sparse
from .xs import MaterialDataArray
class TransportResult:
"""Result from any transport simulation
Each :class:`hydep.TransportSolver`
is expecte... |
<filename>api/api_util.py
from api.models import Photo, Face, Person, AlbumAuto, AlbumDate, AlbumUser
import numpy as np
import json
from collections import Counter
from scipy import linalg
from sklearn.decomposition import PCA
import numpy as np
from sklearn import cluster
from sklearn import mixture
from scipy.spa... |
#!/usr/bin/env python3.7
#
# Copyright (c) University of Luxembourg 2021.
# Created by <NAME>, <EMAIL>, SnT, 2021.
#
import os
import re
import sys
import argparse
import math
import numpy
import operator
import random
from scipy import spatial
parser = argparse.ArgumentParser()
parser.add_argument('--cov_array', n... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 15 09:57:21 2017
@author: dalonlobo
"""
from __future__ import absolute_import, division, print_function
import os
import os.path as ospath
import sys
import subprocess
import argparse
import pandas as pd
import scipy.io.wavfile as wav
from timeit... |
import numpy
import scipy.signal
from generate import *
def generate():
def process(num_taps, cutoff, nyquist, window, x):
b = scipy.signal.firwin(num_taps, cutoff, pass_zero=False, window=window, nyq=nyquist)
return [scipy.signal.lfilter(b, 1, x).astype(type(x[0]))]
vectors = []
x = ran... |
"""
Testing suite for the solver.py module.
@author : <NAME>
@date : 2014-11-12
"""
import unittest
import numpy as np
import sympy as sym
import inputs
import models
import shooting
class MultiplicativeSeparabilityCase(unittest.TestCase):
def setUp(self):
"""Set up code for test fixtures."""
... |
<filename>archive/min_nlogl_square.py<gh_stars>0
import numpy as np
from astropy.io import fits
import os
from scipy import optimize, stats
import argparse
import time
from logllh_ebins_funcs import get_cnt_ebins_normed, log_pois_prob
from ray_trace_funcs import ray_trace_square
from drm_funcs import get_ebin_ind_edge... |
# General class for dynamics
# Use, e.g., for optimal control, MPC, etc.
# <NAME>
import jax.numpy as np
from jax import jit, jacfwd, hessian, vmap
from jax.experimental.ode import odeint
from jax.random import normal, uniform, PRNGKey
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
from functool... |
# Import required libraries
import numpy as np
import pandas as pd
from numpy import std
from numpy import mean
from math import sqrt
import matplotlib.pyplot as plt
from sklearn import linear_model
from scipy.stats import spearmanr
from sklearn.metrics import r2_score
from sklearn.metrics import max_error
from sklear... |
# -*- coding: utf-8 -*-
"""
make colormap image
===================
"""
# import standard libraries
import os
# import third-party libraries
import numpy as np
from scipy import interpolate
from colour import RGB_luminance, RGB_COLOURSPACES, RGB_to_RGB
from colour.models import sRGB_COLOURSPACE
from colour.colorimet... |
<reponame>SallyDa/konrad
# -*- coding: utf-8 -*-
"""This module contains classes for an upwelling induced cooling term.
To include an upwelling, use :py:class:`StratosphericUpwelling`, otherwise use
:py:class:`NoUpwelling`.
**Example**
Create an instance of the upwelling class, set the upwelling velocity,
and use the... |
# Copyright 2016, FBPIC contributors
# Authors: <NAME>, <NAME>
# License: 3-Clause-BSD-LBNL
"""
This file is part of the Fourier-Bessel Particle-In-Cell code (FB-PIC)
It defines numba methods that are used in particle ionization.
Apart from synthactic, this file is very close to cuda_methods.py
"""
import numba
from s... |
<filename>web_app/functions.py<gh_stars>0
from imutils import paths
import pickle
import cv2
import os, os.path
from sklearn.cluster import DBSCAN
from imutils import build_montages
import face_recognition
import numpy as np
import pandas as pd
import random
from scipy.cluster.hierarchy import dendrogram, linkage, fclu... |
<reponame>rklymentiev/py-for-neuro<filename>exercises/solution_07_04.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import softmax
# specify random generator
rnd_generator = np.random.default_rng(seed=123)
# colors for the plot
colors_opt = ['#82B223', '#2EA8D5', '#F5AF3D']
n_arms = 3 #... |
<reponame>sbrodeur/hierarchical-sparse-coding
# 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 must retain the above copyright... |
<gh_stars>1-10
#! env python
# coding: utf-8
# 功能:对图像进行预处理,将文字部分单独提取出来
# 并存放到ocr目录下
# 文件名为原验证码文件的文件名
import hashlib
import os
import pathlib
import cv2
import numpy as np
import requests
import scipy.fftpack
PATH = 'imgs'
def download_image():
# 抓取验证码
# 存放到指定path下
# 文件名为图像的MD5
... |
print("######################################################################")
print("# Parallel n-split k-stratified-fold continuous SVM Scikitlearn MVPA #")
print("# (c) <NAME> 2012, jeanremi.king [at] gmail [dot] com #")
print("######################################################################")
# Impl... |
<reponame>Michal-Gagala/sympy
from sympy.core.add import Add
from sympy.core.exprtools import factor_terms
from sympy.core.function import expand_log, _mexpand
from sympy.core.power import Pow
from sympy.core.singleton import S
from sympy.core.sorting import ordered
from sympy.core.symbol import Dummy
from sympy... |
<reponame>khabibullinra/unifloc
import sys
sys.path.append('../')
import uniflocpy.uWell.deviation_survey as dev_sev
import uniflocpy.uTools.data_workflow as utool
import uniflocpy.uTools.uconst as uconst
import uniflocpy.uWell.uPipe as Pipe
import uniflocpy.uWell.Self_flow_well as self_flow_well
import plotly.graph_o... |
"""
ANE method: Accelerated Attributed Network Embedding (AANE)
modified by <NAME> 2018
note: We tried this method in a HPC via pbs,
however, we don't know why it is particularly slow, even we observed multiple cores were used...
We then tried this method in a small individual linux server. It works well... |
<filename>augtxt/typo.py<gh_stars>0
from typing import Optional, Union
import numpy as np
import scipy.stats
import augtxt.keyboard_layouts as kbl
def draw_index(n: int, loc: Union[int, float, str]) -> int:
"""Get index
Parameters:
-----------
n : int
upper value from interval [0,n] to draw f... |
"""
Python PRM
@Author: <NAME>, original MATLAB code and Python version
@Author: <NAME>, initial MATLAB port
"""
# from multiprocessing.sharedctypes import Value
# from numpy import disp
# from scipy import integrate
# from spatialmath.base.animate import Animate
from spatialmath.base.transforms2d import *
from spatial... |
from sympy import *
from rodrigues_R_utils import *
x_1, y_1, z_1 = symbols('x_1 y_1 z_1')
px_1, py_1, pz_1 = symbols('px_1 py_1 pz_1')
sx_1, sy_1, sz_1 = symbols('sx_1 sy_1 sz_1')
x_2, y_2, z_2 = symbols('x_2 y_2 z_2')
px_2, py_2, pz_2 = symbols('px_2 py_2 pz_2')
sx_2, sy_2, sz_2 = symbols('sx_2 sy_2 sz_2')
position... |
import pickle
from scipy.spatial import distance as dist
import time
import random
import os
import copy
import argparse
import cv2
import numpy as np
from apriltag_images import TAG36h11,TAG41h12, AprilTagImages
from apriltag_generator import AprilTagGenerator
from backgound_overlayer import backgroundOverlayer
impor... |
<filename>pychron/core/regression/least_squares_regressor.py
# ===============================================================================
# Copyright 2012 <NAME>
#
# 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... |
<gh_stars>0
import math
import compas
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import distance
from scipy.sparse.linalg import eigs
from scipy.sparse.linalg import eigsh
from sklearn.metrics.pairwise import euclidean_distances
from sklearn.neighbors import kneighbors_graph
from sklearn.cl... |
import time
import pytest
pytest.importorskip("scipy", minversion="0.7.0")
import numpy as np
from scipy.signal import convolve2d
from aesara import function
from aesara.sparse.sandbox import sp
from aesara.tensor.type import dmatrix, dvector
from tests import unittest_tools as utt
class TestSP:
@pytest.mark... |
<reponame>honchardev/Fun
import statistics
from collections import defaultdict
def get_rainfall() -> str:
rainfall_data_storage = defaultdict(list)
while True:
user_input_city = input('Enter the name of a city: ')
user_input_city_empty = user_input_city == ''
if user_input_city_empty... |
<reponame>magdyksaleh/cs231n_bmi260_project
##Convert images from dicom to png for labelling software
import numpy as np
import os
import pydicom
import png
import matplotlib.pyplot as plt
from tqdm import tqdm
from scipy.signal import medfilt
import skimage
from skimage import feature
from scipy.ndimage.morphology im... |
import numpy as np
import pandas as pd
from timeit import default_timer as timer
from scipy.optimize import minimize
from sklearn.metrics import mean_squared_error as mse
def get_time_series(df):
""" Get a list of all time series of the given data.
:param df: Dataframe containing the time series
:return... |
<gh_stars>0
#!/usr/bin/env python3
import os
import sys
import random
import numpy as np
from scipy import signal
src = open("input.txt", "r").read()
example = """
5483143223
2745854711
5264556173
6141336146
6357385478
4167524645
2176841721
6882881134
4846848554
5283751526
"""
example_step_1 = """
6594254334
385696... |
# --------------
# Import packages
import numpy as np
import pandas as pd
from scipy.stats import mode
bank = pd.read_csv(path)
#bank = pd.Dataframe(data)
print(bank.info())
#print(bank.head())
#print(bank.shape)
# code starts here
categorical_var = bank.select_dtypes(include = 'object')
print(categorical_var)
nume... |
#!/usr/bin/env python3
# coding: utf-8
import os
import numpy as np
import torch
import pickle
import scipy.io as sio
def mkdir(d):
if not os.path.isdir(d) and not os.path.exists(d):
os.system(f'mkdir -p {d}')
def _get_suffix(filename):
"""a.jpg -> jpg"""
pos = filename.rfind('.')
if pos ==... |
<reponame>andrewtarzia/PoreMapper<gh_stars>1-10
"""
Blob
====
#. :class:`.Blob`
Blob class for optimisation.
"""
from __future__ import annotations
from collections import abc
from dataclasses import dataclass, asdict
from typing import Optional
import numpy as np
from scipy.spatial.distance import euclidean
from... |
<filename>train_edge_noise.py
from __future__ import division
from __future__ import print_function
import time
import argparse
import numpy as np
import datetime
from core_Ber import Smooth_Ber
from torch.distributions.bernoulli import Bernoulli
import torch
import torch.nn.functional as F
import torch.optim as opti... |
<reponame>michalogit/V-pipe<filename>workflow/scripts/testBench.py
#!/usr/bin/env python3
import os
import argparse
from alignmentIntervals import read_fasta
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
import sh
import numpy as np
import pandas as pd
__author__ = "<NAME>"
__lic... |
<reponame>johncollinsai/post-high-frequency-data
"""
This module implements empirical likelihood regression that is forced through
the origin.
This is different than regression not forced through the origin because the
maximum empirical likelihood estimate is calculated with a vector of ones in
the exogenous matrix bu... |
"""
Implementation of the paper 'ATOMO: Communication-efficient Learning via Atomic Sparsification'
This is mainly based on the code available at https://github.com/hwang595/ATOMO
Since the basic (transform domain) was not available, I implemented Alg. 1.
"""
import numpy as np
import scipy.linalg as sla
... |
<reponame>LionelMassoulard/aikit<filename>aikit/transformers/base.py
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 22 10:47:48 2018
@author: <NAME>
"""
import numpy as np
import pandas as pd
import scipy.sparse as sps
import scipy.stats
from statsmodels.nonparametric.kernel_density import KDEMultivariate
from scipy... |
<gh_stars>1-10
# Copyright 2021 United States Government as represented by the Administrator of the National Aeronautics and Space
# Administration. No copyright is claimed in the United States under Title 17, U.S. Code. All Other Rights Reserved.
"""
This module defines dynamics models to be used in an EKF for prop... |
<gh_stars>0
import matplotlib
matplotlib.use('Agg')
import keras
import numpy as np
import tensorflow as tf
import os
import pdb
import cv2
import pickle
from matplotlib import pyplot as plt
import matplotlib.gridspec as gridspec
import pandas as pd
from ..helpers.utils import *
from ..spatial.ablation import Ablate... |
import abc
from collections import OrderedDict
from functools import reduce
from operator import mul
from cached_property import cached_property
from sympy import Expr
from devito.ir.support.vector import Vector, vmin, vmax
from devito.tools import (PartialOrderTuple, as_list, as_tuple, filter_ordered,
... |
<filename>sandbox/measureIMs.py
import scipy
import numpy
import pyfits
import VLTTools
import SPARTATools
import os
import glob
import time
datdir = "/diska/data/SPARTA/2015-05-19/PupilConjugation_3/"
ciao = VLTTools.VLTConnection(simulate=False, datapath=datdir)
"""
Which variables do we want to vary?
AMPLITUDE: ... |
# python standard library
import logging
import itertools as it
# numpy/scipy
import numpy as np
from scipy import ndimage as nd
from scipy.special import factorial
from numpy.linalg import det
try:
from scipy.spatial import Delaunay
except ImportError:
logging.warning('Unable to load scipy.spatial.Delaunay. '... |
<gh_stars>1-10
from torch.nn import CrossEntropyLoss, MSELoss
import torch
import torch.nn.functional as F
from scipy.stats import entropy
from transformers import (BertForMultipleChoice,
BertForSequenceClassification,
RobertaForMultipleChoice,
... |
<reponame>Bertinus/gene-graph-analysis
"""A SKLearn-style wrapper around our PyTorch models (like Graph Convolutional Network and SparseLogisticRegression) implemented in models.py"""
import logging
import time
import itertools
import sklearn
import sklearn.model_selection
import sklearn.metrics
import sklearn.linear_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.