text string |
|---|
<reponame>shijiale0609/Statistical-Computing-Methods<gh_stars>0
'''
<NAME>
Statistical Computing for Scientists and Engineers
Homework 1 5b
Fall 2018
University of Notre Dame
'''
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
import errno
import os.path
def readCSV(fileDir='.'):
'''
Rea... |
import numpy as np
from scipy.ndimage import gaussian_filter, gaussian_laplace
import itertools as itt
import math
from math import sqrt, hypot, log
from numpy import arccos
from ..util import img_as_float
from .peak import peak_local_max
from ._hessian_det_appx import _hessian_matrix_det
from ..transform import integ... |
<reponame>jaeeolma/enveco
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_data.las.ipynb (unless otherwise specified).
__all__ = ['plot_point_cloud', 'plot_2d_views', 'las_to_df', 'mask_plot_from_lidar', 'normalized_shannon_entropy',
'height_metrics', 'z_stats', 'z_percentages', 'z_quantiles', 'z_cumul',... |
###############################################################################
# TwoPowerTriaxialPotential.py: General class for triaxial potentials
# derived from densities with two power-laws
#
# amp/[4pia^3]
# ... |
# -*- coding: utf-8 -*-
"""
.. codeauthor:: <NAME> <<EMAIL>>
.. codeauthor:: <NAME> <<EMAIL>>
"""
import os
import argparse as ap
import urllib.request
from zipfile import ZipFile
import h5py
import numpy as np
import scipy.io
from tqdm import tqdm
# see: http://rgbd.cs.princeton.edu/ in section Data and Annotation
D... |
"""
Interface to the UMFPACK library.
--
Author: <NAME>
"""
from __future__ import division, print_function, absolute_import
import re
import warnings
from scipy.lib.six import iteritems
import numpy as np
import scipy.sparse as sp
try: # Silence import error.
from . import _umfpack as _um
except:
_um = N... |
from sympy.core.logic import FuzzyBool
from sympy.core import S, sympify, cacheit, pi, I, Rational
from sympy.core.add import Add
from sympy.core.function import Function, ArgumentIndexError
from sympy.core.logic import fuzzy_or, fuzzy_and
from sympy.functions.combinatorial.factorials import (binomial, factorial,
... |
import sys
import os
import argparse
import json
import datetime
import numpy as np
import cv2
import math
import csv
import rosbag
import sensor_msgs.point_cloud2
import keras
import pandas as pd
print(sys.path)
sys.path.append('../')
from common.camera_model import CameraModel
from process.globals import X_MIN, Y_MIN... |
<reponame>sjk0709/Electrophysiology
"""Contains classes to store the result of a genetic algorithm run.
Additionally, the classes in this module allow for figure generation.
"""
from abc import ABC
import copy
import enum
import math
import random
from typing import Dict, List, Union
from os import listdir, mkdir
fr... |
"""
ZELDA: a 3D Image Segmentation and Parent-Child relation plugin for microscopy image analysis in napari
"""
from napari_plugin_engine import napari_hook_implementation
from qtpy.QtWidgets import QWidget, QHBoxLayout, QPushButton, QGridLayout, QGroupBox
from napari.layers import Image, Labels, Layer, Points
from mag... |
<reponame>shinyfe74/Image_harmony
import cv2, numpy as np
import matplotlib.pyplot as plt
import time
from collections import Counter
from scipy import stats
from scipy.signal import find_peaks
def image_harmony(image_path, threshold = 0.005, hue_distance = 15, harmony_graph=False):
#read image
start_... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import h5py
import os
import numpy as np
import random
import torch
import skimage
import skimage.io
import scipy.misc
from torchvision import transforms as trn
preprocess = trn.Compose([
#... |
<gh_stars>0
import numpy as np
import os
from glob import glob
import scipy.io as sio
from skimage.io import imread, imsave
from skimage.transform import rescale, resize
from time import time
import argparse
import ast
from api import PRN
from utils.estimate_pose import estimate_pose
from utils.rotate_vertices import... |
# -*- coding: utf-8 -*-
"""
The analysis module provides the function to analyse the data generated by
pyDentate. Data files generated by pyDentate have the .pydd extension.
This extension simply allows to identify files that contain the raw data
as opposed to files that contain for example plots. All data files are py... |
# write your silhouette score unit tests here
# Not sure why this test wouldn't pass! Visually, the silhouette scores looked okay, but
# I looked all over and never figured out where the bug was. Maybe a grader can comment :)
import pytest
import numpy as np
from cluster import (
KMeans,
Silhouette,
make_clu... |
import scipy.optimize as so
def chi2(params, img, X, Y):
f, s, xm, ym, w = params
theta = 0
model = Gaussian2D.evaluate(X, Y, f, xm, ym, w, w, theta) + s
return np.sum((img - model)**2 / img)
x0 = (168.521, 98.409, 16., 16., 3.)
result = so.minimize(chi2, x0, args=(img, X, Y,))
print(result)
|
from . import utils
from scipy import sparse
import numpy as np
import warnings
def sqrt(data):
"""Square root transform.
Parameters
----------
data : array-like, shape=[n_samples, n_features]
Input data
Returns
-------
data : array-like, shape=[n_samples, n_features]
Sq... |
# -*- coding: utf-8 -*-
# Symbolic Transfer Function Solver for Signal Flow Graphs
#
# Author: 秋纫
from itertools import combinations
from functools import reduce
import strictyaml as yml
import networkx as nx
from sympy import S, Expr
from sympy.abc import _clash
class SignalFlowGraph:
"""
The signal flow ... |
<reponame>jaime-varela/boaAnalysisTool
from analasisAPI.fileLoader import LoadFile
from analasisAPI.queries import filterDataFrameByRegex
from analasisAPI.queries import filterDataFrameByDate
from analasisAPI.queries import filterDataFrameByAmount
from analasisAPI.queries import queryBankDataFrame
from analasisAPI.plo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" transforms, which can be applied to RDMs
"""
from copy import deepcopy
import numpy as np
from scipy.stats import rankdata
from .rdms import RDMs
def rank_transform(rdms, method='average'):
""" applies a rank_transform and generates a new RDMs object
This as... |
<filename>geoapps/simpegPF/EM/Static/DC/FieldsDC.py<gh_stars>1-10
import SimPEG
from SimPEG.Utils import Identity, Zero
import numpy as np
from scipy.constants import epsilon_0
class FieldsDC(SimPEG.Problem.Fields):
knownFields = {}
dtype = float
def _phiDeriv(self, src, du_dm_v, v, adjoint=False):
... |
<filename>ap_TwoPass.py
import pandas as pd
import numpy as np
from python_nw import newey
from scipy.stats import f
from scipy.stats import chi2
def ap_TwoPass(mr,mf,ishanken_correction):
dT, dN = mr.shape
dT, dK = mf.shape
valpha = np.empty((dN,1))
mbeta = np.empty((dN,dK))
valpha_t = np.empty((... |
<reponame>JackLonergan97/SOLikeT
from builtins import zip
import numpy as np
from scipy.interpolate import InterpolatedUnivariateSpline as iuSpline
from scipy.integrate import simps
# Tinker stuff
tinker_data = np.transpose([[float(x) for x in line.split()]
for line in
... |
## python src/chapter_1/chapter1_1.py
## python3 src/chapter_1/chapter1_1.py
from __future__ import division, absolute_import, print_function
import sys
import math
import numpy as nm
from numpy import arange
import matplotlib as mat
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
from matplotli... |
import torch
import torch.nn.functional as F
import numpy as np
import scipy.sparse as sp
def is_symmetric(m):
'''
Judge whether the matrix is symmetric or not.
:param m: Adjacency matrix(Array)
'''
res = np.int64(np.triu(m).T == np.tril(m))
if np.where(res==0)[0] != []:
raise ValueErro... |
# Copyright (C) 2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
<gh_stars>0
import numpy as np
import pandas as pd
import sys,os
#from random import choices
import random
from datetime import datetime as dt
import json
from ast import literal_eval
import time
from scipy import stats
#from joblib import Parallel, delayed
#from libs.lib_job_thread import *
import logging
import war... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
import numpy as np
import pandas as pd
import os, sys
from collections import OrderedDict
import torch
from torch.utils.data import TensorDataset, DataLoader
import argparse
import math
from scipy import signal
ROBOTICS_CODESIGN_DIR = os.environ['ROBOTICS_CODESIGN_DIR']
sys.path.append(ROBOTICS_CODESIGN_DIR)
sys.pa... |
import numpy as np
from scipy.spatial.transform import Rotation as R
def write_matrix2file(f, a):
mat = np.matrix(a)
for line in mat:
np.savetxt(f, line, fmt='%.5f')
f.write("\n")
def main():
#AX = ZB data generator
n = 10
r = R.from_euler('zyx', [30,50,60], degrees=True)
#r = R.fr... |
import scipy.spatial
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
mahal_uepos = np.loadtxt('all_cuts_mahal.txt', usecols=(12,))
mahal_uepos_unc = np.loadtxt('all_cuts_mahal.txt', usecols=(13,))
mahal_cepos = np.loadtxt('all_cuts_mahal.txt', usecols=(16,))
mahal_cepos_unc = n... |
<filename>utils.py
import numpy as np
from scipy.special import binom
from math import tau
def perimeter_hm(a, b=1):
return tau * (1/a + 1/b) / 2
def perimeter_am(a, b=1):
return tau * (a + b) / 2
def perimeter_gm(a, b=1):
return tau * np.sqrt(a*b)
def perimeter_rms(a, b=1):
return tau * np.sqrt((... |
from dataclasses import dataclass
from functools import partial
from typing import List
from jax import grad, jit, nn
import jax.numpy as np
import numpy as onp
import scipy as oscipy
from . import conditions, distribution, scale
@dataclass
class HistogramDist(distribution.Distribution):
logps: np.DeviceArray
... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
<filename>BusquedasSem.py
from nltk.corpus import stopwords
from nltk.tokenize import RegexpTokenizer
from nltk.stem import *
from nltk.corpus import wordnet
from nltk.collocations import *
from nltk import pos_tag
import nltk
from translate import Translator
from BusquedasEPO import *
import csv
import pandas as pd
#f... |
<reponame>DeliciousHair/pymc3
# Copyright 2020 The PyMC Developers
#
# 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 re... |
<gh_stars>0
"""
Bug 1386274 - TAAR similarity-based add-on donor list
This job clusters users into different groups based on their
active add-ons. A representative users sample is selected from
each cluster ("donors") and is saved to a model file along
with a feature vector that will be used, by the TAAR library
modul... |
# -*- coding: utf-8 -*-
#
import math
import numpy
import sympy
def _newton_cotes(n, point_fun):
"""
Construction after
<NAME>,
Symmetric quadrature formulae for simplexes
Math. Comp., 24, 95-100 (1970),
<https://doi.org/10.1090/S0025-5718-1970-0258283-6>.
"""
degree = n
# points... |
<reponame>riccardo-seppi/HMF_seppi20
#!/usr/bin/env python
# coding: utf-8
# In[94]:
"""
Build relations for MD
"""
#MAKES THE 2D HISTOGRAM AND CONVERTS THE COUNTS TO g(sigma,xoff)
from astropy.table import Table, Column
#from astropy_healpix import healpy
import sys
import os, glob
import time
from astropy.cosmol... |
# Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicabl... |
import abc
import numpy as np
from scipy import stats
class RunLength:
def __init__(self, r, prob, params):
self.r = r
self.prob = prob
self.params = params
self.pred_prob = None # current evidence
self.factor = None # self.prob*self.pred_prob
self.test_pred = None ... |
import torch
import argparse
import numpy as np
import scipy.misc as misc
import torch.nn as nn
import torch.nn.functional as F
from ptsemseg.models import get_model
from ptsemseg.utils import convert_state_dict
N_CLASSES = 151
class Classifier(nn.Module):
def __init__(self):
super(Classifier, self).__in... |
<reponame>BrooksLabUCSC/eVIP2
#!/usr/bin/python
#!/broad/software/free/Linux/redhat_5_x86_64/pkgs/python_2.5.4/bin/python
# mutation_impact_viz.py
# Author: <NAME>
# Program Completion Date:
# Description:
# Modification Date(s):
# Copyright (c) 2011, <NAME>. <EMAIL>
# All rights reserved.
import sys
... |
<gh_stars>0
from tkinter import *
from PIL import Image, ImageTk
from time import *
import sys
import time
import math
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import numpy as np
from scipy.integrate import odeint
import PyPDF2
from tkinter import filedialog
import os
from itertools import... |
# This Python file uses the following encoding: utf-8
__author__ = 'eiscar'
import csv
import matplotlib.pyplot as plt
import scipy.stats
import scipy.optimize
from scipy.interpolate import UnivariateSpline
import numpy as np
import os
import lights as lg
import wateratenuationmodel as wt
import camera as cam
import m... |
<gh_stars>1-10
from statistics import median
with open('2021/day_7/crabinput.txt') as f:
positions = [int(f) for f in f.readline().split(',')]
# original solution
def crab_part1():
medians = median(positions)
fuels = []
for position in positions:
if position <= medians:
fuels.app... |
<gh_stars>0
import argparse
import logging
import os
import anndata
import numpy as np
import pandas as pd
import scipy.sparse
from cirrocumulus.anndata_util import get_scanpy_marker_keys, datasets_schema, DataType
from cirrocumulus.io_util import get_markers, filter_markers, add_spatial, SPATIAL_HELP, unique_id
from... |
<reponame>GuoSuiming/mindspore
"""
WiderFace evaluation code
author: wondervictor
mail: <EMAIL>
copyright@wondervictor
MIT License
Copyright (c) 2018 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in th... |
<reponame>marielacour81/CBIG
# /usr/bin/env python
'''
Written by <NAME> and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import os
import scipy.io as sio
import numpy as np
import time
import torch
import CBIG_pMFM_basic_functions as fc
def get_init(myelin_data, gradient_d... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""Apply Naive Bayes (Gaussian & Bernoulli) and Random Forest on MNIST digits Classification
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from scipy.stats import bernoulli
from sklearn.ensemble import RandomForestClassifier
from mnist import M... |
<gh_stars>1-10
import time
import numpy as np
from riglib.experiment import traits
import scipy.io as sio
from riglib.bmi import extractor
channels = list(range(33))
n_chan = len(channels)
extractor_cls = extractor.BinnedSpikeCountsExtractor
# extractor_cls = extractor.LFPMTMPowerExtractor
class BlackrockData(objec... |
<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import loadmat
from sklearn.preprocessing import PolynomialFeatures
def gradientDescent(theta, X_with_interceptor, y, learning_rate, training_step, lambda_param):
"""
Compute gradient descent w.r.t. the given inputs
:param the... |
<filename>src/docker_code/docker_face_detect_server_v1.py<gh_stars>0
# -*- coding: utf-8 -*-
# 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
# in the Software wi... |
from typing import Iterable, Optional
import pandas as pd
import numpy as np
from scipy.special import expit
def get_expanded_df(df, event_type_col='J', duration_col='X', pid_col='pid'):
"""
This function gets a dataframe describing each sample the time of the observed events,
and returns an expanded dat... |
"""Perform a background correction on a fluorescence channel.
The background correction is based on Schwarzfischer et al.:
“Efficient fluorescence image normalization for time lapse movies”
https://push-zb.helmholtz-muenchen.de/frontdoor.php?source_opus=6773
"""
# Based on "background_correction.py"
# of commit f46236... |
<filename>shap/plots/force.py
""" Visualize the SHAP values with additive force style layouts.
"""
from __future__ import division, unicode_literals
import os
import io
import string
import json
import random
from IPython.core.display import display, HTML
from IPython import get_ipython
import base64
import numpy as n... |
from .. import settings
from .. import logging as logg
from .utils import not_yet_normalized, normalize_per_cell
from .neighbors import neighbors, get_connectivities, neighbors_to_be_recomputed
from scipy.sparse import csr_matrix
import numpy as np
def moments(data, n_neighbors=30, n_pcs=30, mode='connectivities', m... |
<reponame>busyyang/python_sound_open<gh_stars>100-1000
"""
LDA算法将数据投影到新的轴上去
来源:https://blog.csdn.net/z962013489/article/details/79871789
和: https://blog.csdn.net/z962013489/article/details/79918758
"""
import numpy as np
from scipy.io import loadmat
import matplotlib.pyplot as plt
from sklearn import svm
from sklearn... |
<filename>data/kitti/kitti_raw_loader.py<gh_stars>0
from __future__ import division
import numpy as np
from glob import glob
import os
import scipy.misc
class kitti_raw_loader(object):
def __init__(self,
dataset_dir,
split,
img_height=256,
img_wi... |
from common import (
identity,
identity_script,
heavy,
heavy_script,
identity_cuda,
identity_script_cuda,
heavy_cuda,
heavy_script_cuda,
stamp_time,
compute_delay,
NUM_RPC,
)
from torch.distributed import rpc
from functools import partial
from statistics import stdev
import... |
<reponame>utsekaj42/chaospy
"""Log-gamma distribution."""
import numpy
from scipy import special
from ..baseclass import SimpleDistribution, ShiftScaleDistribution
class log_gamma(SimpleDistribution):
"""Log-gamma distribution."""
def __init__(self, c):
super(log_gamma, self).__init__(dict(c=c))
... |
#!/usr/bin/env python3
#-----------------------------------------------------------------------------
# Title : SmurfProcessor's Filter Validation Script
#-----------------------------------------------------------------------------
# File : validate_filter.py
# Created : 2017-06-20
#---------------------... |
### Use with environment unet2DE
### script will match a corrected timelapse image to the A594-channel HCR image.
import numpy as np
from bin.fatetrack_register_v3 import *
from urllib.parse import urlparse
import cellpose
from cellpose import utils, io,models
import matplotlib
import matplotlib.pyplot as plt
impor... |
from __future__ import print_function, division, absolute_import
import GPy
import numpy as np
import safeoptpp as safeopt
import scipy
import math
import time
import os
import datetime
import pickle
import multiprocessing as mp
import sys
import pathlib
store_path = str(pathlib.Path(__file__).parent.resolve())
def ... |
from utilities import *
from gnpy.core.info import *
import json
import matplotlib.pyplot as plt
from math import *
from gnpy.core.elements import *
import numpy
import scipy.constants as sp
from Lab7lib import Ex3
ex3 = Ex3()
__span__ = 10
power_interval = numpy.arange(-5.0,2.0,0.25)
ex3.GenerateLine... |
<gh_stars>1-10
'''
.. module:: skrf.tlineFunctions
===============================================
tlineFunctions (:mod:`skrf.tlineFunctions`)
===============================================
This module provides functions related to transmission line theory.
Impedance and Reflection Coefficient
---------------------... |
from __future__ import division, absolute_import
from scipy import weave
class YMD(object):
year = 0
month = 0
days = 0
month_offset = [
[ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 ],
[ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 ]
]
days_in_month = [
[ 31, 2... |
import SimpleITK as sitk # For loading the dataset
import numpy as np # For data manipulation
import glob # For populating the list of files
from scipy.ndimage import zoom # For resizing
import re # For parsing the filenames (to know their modality)
import cv2 # For processing images
import matplotlib.pyplot as pl... |
<filename>run_gibbs_sampler_one_walker.py
# here i take the data and run one gibbs sampling procedure
# inputs are: data_dir output_dir Number of events considered Number of saved samples Burnin Space between samples
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import poisso... |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
# Copyright (C) 2020 <NAME>
# Use of this source code is governed by the MIT License
###############################################################################
from . im... |
<reponame>adamltyson/spikey
import numpy as np
import scipy.ndimage.filters as filters
from imlib.radial.misc import radial_bins
from imlib.array.misc import midpoints_of_series
def radial_spike_histogram_multiple(
angle_timeseries_list,
spikes_timeseries_list,
bin_width=6,
bin_occupancy=None,
n... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import glob
import os
from scipy import stats
import tensorflow as tf
import math
import random
# matplotlib inline
# plt.style.use('ggplot')
normalization_coef = 9
batch_size = 10
kernel_size = 30
depth = 20
num_hidden = 100
num_channels = 3
l... |
<filename>prml/rv/students_t.py
import numpy as np
from scipy.special import digamma, gamma
from prml.rv.rv import RandomVariable
class StudentsT(RandomVariable):
"""
Student's t-distribution
p(x|mu, tau, dof)
= (1 + tau * (x - mu)^2 / dof)^-(D + dof)/2 / const.
"""
def __init__(self, mu=Non... |
# Copyright (c) 2003-2019 by <NAME>
#
# TreeCorr is free software: 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 notice, this
# list of conditions... |
import numpy
from numpy.random import rand
from scipy.ndimage import correlate
from skimage.exposure import rescale_intensity
from aydin.io.datasets import newyork, examples_single, small_newyork
from aydin.util.fast_correlation.numba_cpu import numba_cpu_correlate
from aydin.util.fast_correlation.parallel import para... |
__author__ = 'github.com/wardsimon'
__version__ = '0.1.0'
# SPDX-FileCopyrightText: 2021 easyCore contributors <<EMAIL>>
# SPDX-License-Identifier: BSD-3-Clause
# © 2021 Contributors to the easyCore project <https://github.com/easyScience/easyCore>
from abc import ABCMeta, abstractmethod
from typing import Union... |
import numpy as np
from scipy.io import wavfile as wav
from python_speech_features import mfcc
from scipy.fftpack import fft
def compute_mfcc(file,numcep):
fs, audio = wav.read(file)
mfcc_feat = mfcc(audio, samplerate=fs, numcep=numcep)
mfcc_feat = mfcc_feat[::3]
mfcc_feat = np.transpose(mfcc_feat)
... |
import os
import h5py
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage
from skimage import measure
def get_edge(im):
edge_horizont = ndimage.sobel(im, 0)
edge_vertical = ndimage.sobel(im, 1)
edge = 1-np.array(np.hypot(edge_horizont, edge_vertical)>0, dtype=np.float)
return m... |
<reponame>m87/pyEM<filename>utils.py
import numpy as np
import os
from scipy import linalg
from config import *
EPS = np.finfo(float).eps
def genModels(n,dim,lmean, umean, lcovar, ucovar):
models = []
for i in range(n):
mean = np.random.random((dim,)) * umean + lmean
mat = np.random.random((d... |
<reponame>majdabd/nilearn<filename>nilearn/plotting/edge_detect.py
"""
Edge detection routines: this file provides a Canny filter
"""
import numpy as np
from scipy import ndimage, signal
from .._utils.extmath import fast_abs_percentile
# Author: <NAME>
# License: BSD
################################################... |
from sympy import *
from sympy.printing.cxxcode import CXX11CodePrinter
from sympy.printing.julia import JuliaCodePrinter
from sympy.printing.pycode import PythonCodePrinter
#
# Three-body Jastrow code generated in Julia or Python
# Output is for fixed sizes of the polynomial expansion
#
def gen_three_body():
... |
<reponame>extrakteon/hftools-1
# -*- coding: utf-8 -*
from __future__ import print_function
#-----------------------------------------------------------------------------
# Copyright (c) 2014, HFTools Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPY... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 29 14:00:18 2020
updated on Thu Oct 15 18:07:45 2020
@author: <NAME>
"""
#reproducability
from numpy.random import seed
seed(1)
import tensorflow as tf
tf.random.set_seed(1)
import numpy as np
from bayes_opt import BayesianOptimization
from bayes_opt.logger import JSONL... |
"""
Copyright (c) 2021 Intel Corporation
\file distgnn/partition/main_Libra.py
\brief Libra - Vertex-cut based graph partitioner for distirbuted training
\author <NAME> <<EMAIL>>,
<NAME> <<EMAIL>>
<NAME> <<EMAIL>>,
<NAME> <<EMAIL>>,
<NAME> <<EMAIL>>
<NAME> <<EMAI... |
import numpy as np
import tqdm
import re
import os
import pandas as pd
import warnings
from scipy.spatial import distance
from mne.channels import make_standard_montage
from glob import glob
from parse import parse
from slurppy import Config
import typing
from .atlas import center_of_masses
#from .config import eegip_... |
import numpy as np
from scipy.stats import poisson
from scipy.optimize import fmin_cobyla, minimize
from collections.abc import Iterable
from scipy.cluster.vq import vq, kmeans, whiten
UB = 1e0
EPS = 1e-6
class RegisterBased:
def __init__(self, pd, frequencies, limits):
self.inner_pd = pd
self.in... |
from cmath import log
from dataclasses import replace
import os
import json
import time
import datetime
from traceback import print_tb
from tqdm import tqdm
import numpy as np
import pandas as pd
import logging
import sklearn
logging.basicConfig(level = logging.INFO,format = '%(asctime)s - %(name)s - %(levelname)s - ... |
<reponame>UP-RS-ESP/GEW-DAP05-2018<filename>Session_04/koch_box_count.py
import sys
import numpy as np
from matplotlib import pyplot as pl
def draw_line(p0, p1, xb, yb):
assert xb.ndim == 1, 'xb not flat'
assert yb.ndim == 1, 'yb not flat'
xmin, xmax = xb.min(), xb.max()
ymin, ymax = yb.min(), yb.max()... |
<reponame>RandLive/Avito-Demand-Prediction-Challenge<filename>yuki/avito/src/create_base_features.py
import time
notebookstart= time.time()
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import os
import gc
print("Data:\n",os.listdir("../input"))
# Models Pa... |
"""
In this example we use the pysid library to estimate a MISO armax model
"""
#Import Libraries
from numpy.random import rand, randn #To generate the experiment
from scipy.signal import lfilter #To generate the data
from pysid import armax #To estimate an arx model
#True System
#Number of input... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# 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_FP... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
'''
INCOMPLETE: These are the beginnings of a module that allows you to
iterate over all dissections of a recilinear polygon into the minimum
number of rectangles. In its current state, it performs fairly well
but there are still edge cases that it can't deal with. This was
intended to be a module imported by rectlang.... |
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn import preprocessing
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import classification_report,accuracy_score
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier,GradientBoostingClassifier
im... |
from tkinter import *
from tkinter import ttk
from sympy.matrices import Matrix
from sympy.printing.str import StrPrinter
import math
printer = StrPrinter()
entries = []
rows = 0
master = Tk()
matIn = "[1,1,1,1;2,2,2,2;3,3,3,3;4,4,4,4]" #for testing
def multi(mats):
return mats.pop(0) * multi(mats) if len(mats) ... |
<gh_stars>1-10
#!/usr/bin/env python2
from argparse import ArgumentParser
from exceptions import IOError
from netlist import Netlist
import sys
from utils import plot
import matplotlib.pyplot as plt
from scipy.io import wavfile
import numpy as np
import sounddevice as sd
TARGET_AMPLITUDE = 80
def main():
"""
Main ... |
"""
Utility functions for experiment design simulations.
"""
import random
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from . import model_fitting
# Number of samples from cycling, selected at regular
# intervals throughout cycling.
DEFAULT_NUM_SAMPLES = ... |
from picamera.array import PiRGBArray
from picamera import PiCamera
from time import sleep
import time
import _datetime
import numpy as np
import os
import matplotlib.pyplot as plt
import cv2
from imageio import imread
from scipy.spatial import distance
from keras.models import load_model
import pandas as pd
from tqdm ... |
<reponame>swfarnsworth/tmnt
# coding: utf-8
"""
Copyright (c) 2019-2021 The MITRE Corporation.
"""
import io
import os
import json
import gluonnlp as nlp
import glob
from gluonnlp.data import Counter
from multiprocessing import Pool, cpu_count
from mantichora import mantichora
from atpbar import atpbar
import collecti... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 18 09:57:38 2019
@author: Sean
"""
import collections
import serial
import threading
import time
import sys
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import scipy.integrate as itg
serial_port =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.