text
string
""" Compute the features (r2,mse,granger) for a given set of trials INPUT: time_window_size: time points considered in the regression; time_lag: time lag from which the selection of time_windows_size time points starts, if None it takes points from (-1)*time_window_size to -1; N: time points considered...
import time from typing import Tuple from statistics import mean, stdev def timeit(num=1, eps=0.5, max_trial=5, warmup=0.01): """Create measurement function for excetution time Args: num (int): will execute the function as per the number is given here. (The default value is 1) """ if num <= 0...
<reponame>Mailaender/spectrochempy<gh_stars>0 # -*- coding: utf-8 -*- # ====================================================================================================================== # Copyright (©) 2015-2021 LCS - Laboratoire Catalyse et Spectrochimie, Caen, France. = # CeCI...
<reponame>skirpichev/Mathics # -*- coding: utf-8 -*- # cython: language_level=3 """ Mathematical Functions Basic arithmetic functions, including complex number arithmetic. """ from mathics.version import __version__ # noqa used in loading to check consistency. import sympy import sys import mpmath from functools i...
<reponame>SherbyRobotics/PyRobotics #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Sep 10 11:12:11 2021 @author: alexandregirard """ from scipy.optimize import minimize from cyipopt import minimize_ipopt def cost (x): j = x[0]+x[1] return -j def constraint_circle(x): res...
import os import pathlib import torch import numpy as np from imageio import imread from scipy import linalg from torch.nn.functional import adaptive_avg_pool2d from skimage.measure import compare_ssim from skimage.measure import compare_psnr import glob import argparse import matplotlib.pyplot as plt from tools.incept...
from torchsummary import summary import os import glob import torch import librosa import pickle import copy import random import numpy as np import pandas as pd import scipy.signal as signal import torch.optim as optim import torch.nn as nn import torch.nn.functional as F from model import Net_ResNet50 from torch....
from sympy import bernoulli, Symbol, Sum, harmonic, Rational, oo, zoo, pi, I, bell, \ fibonacci, lucas, euler, catalan, binomial, gamma, sqrt, hyper, log, polygamma, diff x = Symbol('x') def test_bernoulli(): assert bernoulli(0) == 1 assert bernoulli(1) == Rational(-1,2) assert bernoulli(2) == Rat...
import matplotlib.pyplot as plt from scipy.ndimage.filters import gaussian_filter1d from matplotlib.pyplot import figure def make_line_plot(save_to_folder: str, list_of_data_points, xlabel, ylabel, title, add_avg_line=False, sigma=0, all_xticks=False, custom_width=False, width=0): if custom_width: figure(...
from cmath import phase print((lambda x: '%.3f\n%.3f' % (abs(x), phase(x)))(complex(input())))
import numpy as np import statistics from Superposition_VariationalInference import * import torch import time import pandas as pd import timeit import torch name1 = '2cpd' #2nl7:139 #2do0=114 #2cpd=99 name2 ='2cpd' from random import randint def random_with_N_digits(n): range_start = 10**(n-1) range_end = (1...
<gh_stars>0 from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression import scipy.stats as ss model = Pipeline(steps=[ ('scl', StandardScaler()), ('lin', LogisticRegression( penalty = 'l2', solver = 'lbfgs', ...
# Run using: # casapy --nologger --nogui --log2term -c ms_to_mat <MS name> import os import sys import scipy.io import collections # Get MS name from command line. ms_path = os.path.abspath(sys.argv[-1]) if not os.path.isdir(ms_path): raise ValueError('Specified measurement set not found!.') print '=' * 80 prin...
<reponame>davidstutz/daml-shape-completion<filename>data/shapenet/fast_post_process_cars.py #!/usr/bin/env python """ Post-process computed volumes, i.e. compute the distance transforms. """ import numpy as np from scipy import ndimage import os import sys sys.path.insert(1, os.path.realpath(__file__ + '../lib/')) im...
import os import ntpath import time from . import util from . import html import scipy.misc # try: # from StringIO import StringIO # Python 2.7 # except ImportError: # from io import BytesIO # Python 3.x from io import BytesIO # from .SpectralUtils import savePNG, projectToRGB, toPNG from .SpectralUtil...
<reponame>davmre/sigvisa import numpy as np import scipy.optimize import itertools import pandas as pd from sigvisa import Sigvisa from sigvisa.signals.io import load_event_station_chan grid = dict() grid['exp'] = np.array([x for x in itertools.product( (26, 30, 32 ), (0.0, 2.0), (-1.0, 1.0), (-5, -3, -1))]) grid['p...
<reponame>king821221/tf-mmoe-mgda<filename>census_income_demo.py<gh_stars>1-10 """ Multi-gate Mixture-of-Experts demo with census income data. Copyright (c) 2018 Drawbridge, Inc Licensed under the MIT License (see LICENSE for details) Written by <NAME> """ import argparse import random import traceback import json im...
<filename>SimpleFilterDesign/Wavelets/MultiStepHaar/IterativeHaar.py from cmath import log, pi from math import sin import matplotlib.pyplot as mplt def iterativeHaar(data): nSamples = len(data) nSweeps = int(log(nSamples).real / log(2.0).real) print(nSweeps) i = 1; gap = 2 s = 0; d = 0 for...
<reponame>dan-git/outdoor_bot #!/usr/bin/python # Software License Agreement (BSD License) # # Copyright (c) 2009, <NAME>, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistribut...
<reponame>FrictionTribologyEnigma/SlipPY<filename>slippy/contact/adhesion_models.py import numpy as np from scipy.misc import derivative from functools import partial from typing import Callable, Optional from slippy.core import _AdhesionModelABC __all__ = ['MDAdhesionPotential', 'AdhesionModelFromFunction'] class M...
<filename>modeling/position_average.py #!/usr/bin/env python ''' Given a prediction of the effect of each single mutation and the sequence of the reference in amino acids and nucleotides, average the effect of the given measurement for each position ''' import argparse import copy from Bio import AlignIO import re im...
<reponame>CliveUnger/BigGAN-Videos<gh_stars>0 #Imports import cv2 import numpy as np import matplotlib.pyplot as plt from scipy.stats import truncnorm from numpy import linalg as LA import random from scipy.signal import savgol_filter from image_net_labels import labels_to_idx import tensorflow.compat.v1 as tf tf.dis...
"""Test CZT package. To run: pytest test_czt.py -v To run (with coverage): pytest --cov . --cov-report html test_czt.py """ import numpy as np import matplotlib.pyplot as plt import pytest import scipy import czt def test_compare_different_czt_methods(debug=False): print("Compare different CZT calc...
"""Tests for arviz.utils.""" # pylint: disable=redefined-outer-name, no-member from unittest.mock import Mock import numpy as np import pytest import scipy.stats as st from ...data import dict_to_dataset, from_dict, load_arviz_data from ...stats.density_utils import _circular_mean, _normalize_angle, _find_hdi_contour...
<gh_stars>0 # # Copyright (c) 2022 salesforce.com, inc. # All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause # """ ETS (Error, Trend, Seasonal) forecasting model. """ import logging from typing impo...
<gh_stars>1-10 import sys,os sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir)) from PyEFVLib import MSHReader, Grid, ProblemData, CsvSaver, CgnsSaver, VtuSaver from PyEFVLib import MSHReader, Grid, ProblemData, CsvSaver, CgnsSaver from PyEFVLib.simulation import LinearSystem as ls import numpy a...
<reponame>ngunnar/tracking_reg from scipy import ndimage import numpy as np def inverse_distance(segmentation_masks, num_of_points, l=1, alpha = 1): img_height = segmentation_masks.shape[0] dt = ndimage.distance_transform_edt(segmentation_masks == False) + alpha dt = (1 + dt/l)**(-alpha) probability =...
# -*- coding: iso-8859-15 -*- """ Traveling salesman problem solved using Simulated Annealing. <NAME> email: <EMAIL> The steps consis of:: • Pick initial configuration X and an initial temperature T0. T0 should be much higher than the changes in function f to be minimized when typical Monte Carlo step is take...
# -*- coding: utf-8 """Module for fluid property integration. TESPy uses the CoolProp python interface for all fluid property functions. The TESPyFluid class allows the creation of lookup table for custom fluid mixtures. This file is part of project TESPy (github.com/oemof/tespy). It's copyrighted by the contributo...
<filename>Python code/EX02_Lorenz.py #import os # clear screen import numpy as np # matrix calc from scipy.integrate import odeint # scientific computation (ode solver) from utils.methods import poolData, sparsifyDynamics, sparseGalerkin3D , lorenz import matplotlib.pyplot as py #os.system('clear') # Generate data ...
<reponame>rubende/mupeg<filename>experiments/test/PredictModel_two_persons_all.py import tensorflow as tf import os import numpy as np import glob from scipy import stats import math import importlib createDatasetRecord = importlib.import_module('common.createDatasetRecord') Model = importlib.import_module('common.Mode...
from contextlib import contextmanager from phi.math import batch, spatial def assert_minimal_config(): # raises AssertionError import sys assert sys.version_info.major == 3 and sys.version_info.minor >= 6, "phiflow requires Python 3.6 or newer to run" try: import numpy except ImportError: ...
import matplotlib.pyplot as plt import numpy as np from scipy.stats import rv_discrete import scipy import datetime import dataset # import pickle plt.rcdefaults() # Debug mode debug = True def printdebug(debugmode, string=None, vartuple=None): """ prints string, varname and var for debug purposes :par...
#!/usr/bin/env python3 import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import scipy.stats from math import sqrt import operator BASE_PATH = "data/" PLOTS_PATH = "plots/" DATA_INDEX = 2 DEFAULT_INDEX = 3 KNN_INDEX = 4 LINEAR_INDEX = 5 LOGISTIC_INDEX = 6 TREE_INDEX = 7 FOREST_INDEX = 8 XMEA...
from dataclasses import dataclass, field from typing import Any, Dict from scipy import stats import numpy as np from .estimator import QuantileEstimator from .utils import compute_pr_x_ge_y from .tables import MANN_WHITNEY_UP010 @dataclass(frozen=True) class TwoSampleHypothesisTest(object): options: Dict[str, ...
<gh_stars>0 import os import shutil import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import pickle import findiff import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import TruncatedSVD from scipy.integrate import ode from scipy import in...
#!/usr/bin/env python3 # Plots loss functions of form |x|**q import matplotlib.pyplot as pl import numpy as np from scipy.stats import t, laplace, norm x = np.linspace(-4, 4, 100) pl.title('|x|^0.2') pl.plot(x, np.absolute(x)**.2) pl.savefig('lossFunctionFig_01.png') pl.figure() pl.title('|x|') pl.plot(x, np.absolu...
<reponame>jam-world/hongyuan_code<gh_stars>0 # -*- coding: utf-8 -*- """ run file for neural walker @author: hongyuan """ import pickle import time import numpy import theano from theano import sandbox import theano.tensor as tensor import os import scipy.io from collections import defaultdict from theano.tensor.shar...
<filename>sknetwork/utils/knn.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on October 2019 @author: <NAME> <<EMAIL>> """ from abc import ABC import numpy as np from scipy import sparse from scipy.spatial import cKDTree from sknetwork.utils.knn1d import knn1d from sknetwork.utils.format import directe...
<filename>dataset/spotify_million_playlist_dataset/subset/preprocessing.py<gh_stars>1-10 import matplotlib.pyplot as plt from dataset.spotify_million_playlist_dataset.src import * from dataset.spotify_million_playlist_dataset.src import stats from scipy.interpolate import make_interp_spline, BSpline path = "D:/Pycharm...
import torch import torch.nn.functional as F import numpy as np from scipy import interpolate class InputPadder: """ Pads images such that dimensions are divisible by 8 """ def __init__(self, dims, mode='sintel'): self.ht, self.wd = dims[-2:] pad_ht = (((self.ht // 8) + 1) * 8 - self.ht) % 8 ...
<reponame>asjohnston-asf/isce2 # # Author: <NAME> # Copyright 2016 # import numpy as np import os import isceobj import logging import scipy.signal as SS from isceobj.Util.ImageUtil import ImageLib as IML import datetime import pprint from .runFineResamp import getRelativeShifts def multilook(intname, alks=5, rlks=...
<gh_stars>10-100 import numpy as np import pandas as pd import numba as nb #import numba_stats as nbs import plotly.express as px import plotly.graph_objects as go from sklearn.linear_model import LinearRegression from scipy import stats #import statsmodels.api as sm from collections import Counter import multiprocessi...
''' Deep Learning for Data Science: Assignment 3 Submitted by: <NAME> (<EMAIL>) Description - Generalize to k-layer Neural Network - Implement Batch Normalization - Implement moving average - Training using mini batch Gradient Descent ''' import numpy as np from nump...
# SimpleOfficeEnv_py import numpy as np import matplotlib.pyplot as plt from owcsimpy.geoobjects.models.humanwithactivity_py import HumanWithActivity_py as Human from owcsimpy.geoutils.draw import draw from owcsimpy.geoobjects.bases.vector_py import Vector_py as Vector from owcsimpy.geoobjects.bases.cube_py import Cu...
<gh_stars>0 import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.backends.backend_agg as plt_backend_agg import seaborn as sns from sklearn import metrics from scipy import interp def get_confusion_matrix_figure(y_true, y_pred, n_classes, labels=None): """Plot visualization. Param...
import numpy as np from scipy import ndimage from scipy import stats from skimage.color import rgb2grey from skimage.util import img_as_float from skimage.feature import peak_local_max def _compute_derivatives(image): """Compute derivatives in x and y direction using the Sobel operator. Parameters ------...
""" Tools for representing and manipulating rooted trees. The main component of this module is the RootedTree object, whose documentation contains further details. To facilitate the display of trees, and since it is not convenient to use graph representations in most contexts, the module also defines canonical names f...
"""A few numpy and scipy helper functions for the processing pipelines. Author: <NAME>, March 2021 """ import numpy as np from scipy.signal import butter, filtfilt def butter_lowpass(cutoff, fs, order=2): "Create a lowpass filter." nyq = 0.5 * fs normal_cutoff = cutoff / nyq b, a = butter(order, norm...
<gh_stars>10-100 from __future__ import absolute_import import scipy.stats import autograd.numpy as np from autograd.numpy.numpy_vjps import unbroadcast_f from autograd.extend import primitive, defvjp pdf = primitive(scipy.stats.multivariate_normal.pdf) logpdf = primitive(scipy.stats.multivariate_normal.logpdf)...
""" Successive Halving Iterations ============================= This example illustrates how a successive halving search (:class:`~sklearn.model_selection.HalvingGridSearchCV` and :class:`~sklearn.model_selection.HalvingRandomSearchCV`) iteratively chooses the best parameter combination out of multiple candidates. ""...
<filename>Codes/Compute_AC_PWS.py<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 6 11:02:13 2020 @author: <NAME> This code reads 1-h data files (20 Hz sampling frequency) from MeSO-net stations, computes the autocorrelation function (ACF), and stack the ACFs using the Phase Weigh...
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.3' # jupytext_version: 1.0.0 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %matplotlib inline # %a...
<reponame>DSIP-UPatras/sEMG-hilbert-curve import numpy as np import scipy.io import os.path import glob def load_dataset(input_directory, subject, classes, repetitions, rest_reps=None): '''Loads data and applies preprocess_function_1''' X, y, r = [], [], [] if rest_reps is None: rest_reps = len(re...
<filename>hyperparameter_search_dd2.py from __future__ import absolute_import from __future__ import print_function from __future__ import division import time import os import numpy as np import scipy import scipy.misc from skopt import gp_minimize from skopt.space import Categorical def expansion_number_to_string(e...
#!/usr/bin/env python2 # Author: <NAME> (<EMAIL>) # Time-stamp: <2013-12-14 14:15:26 (jonah)> # This is a companion program to my FLRW simulator. It takes a data # file and generates a plot of the scale factor, its derivative, the # density, and the pressure of the matter. # Call the program with # python2 plot_all_...
# From the course: Bayesin Machine Learning in Python: A/B Testing # https://deeplearningcourses.com/c/bayesian-machine-learning-in-python-ab-testing # https://www.udemy.com/bayesian-machine-learning-in-python-ab-testing from __future__ import print_function, division from builtins import range # Note: you may need to ...
<filename>tests/test_pickle.py import pytest import numpy as np from sympy import Symbol import pickle from conftest import skipif from devito import (Constant, Eq, Function, TimeFunction, SparseFunction, Grid, Dimension, SubDimension, ConditionalDimension, IncrDimension, TimeDi...
import numpy as np import matplotlib import matplotlib.pyplot as plt from scipy.interpolate import griddata npzfile = np.load("/home/henry/dev/roomba/logger/2018-08-05_123107_wifi.npz") points = npzfile["points"] * 11.8 # convert to mm values = npzfile["values"] minx=np.amin(points, axis=0)[0] maxx=np.amax(points,...
import sys import numpy as np import scipy import scipy.io import scipy.ndimage import mahotas import math import h5py import time import pymaxflow import timer import os import glob try: input_paths = ['D:\dev\datasets\conn\ecs\ecs20_crop1kds2\diced_xy=512_z=32_xyOv=128_zOv=12_dwnSmp=1\cubes\cubeId=000001_Z=1...
<filename>hypertrees/ensemble/_forest.py """ Forest of trees-based ensemble methods. Those methods include random forests and extremely randomized trees. The module structure is the following: - The ``BaseForest`` base class implements a common ``fit`` method for all the estimators in the module. The ``fit`` metho...
<filename>advanced/scipy_sparse/examples/direct_solve.py """ Construct a 1000x1000 lil_matrix and add some values to it, convert it to CSR format and solve A x = b for x:and solve a linear system with a direct solver. """ import numpy as np import scipy.sparse as sps from matplotlib import pyplot as plt from scipy.spar...
from __future__ import print_function, division, absolute_import import numpy as np from scipy.misc import imsave, imread, imresize from sklearn.feature_extraction.image import reconstruct_from_patches_2d, extract_patches_2d from scipy.ndimage.filters import gaussian_filter from keras import backend as K import os i...
import numpy as np import os import pickle import ra import fft import argparse from gaussian2d import gaussian2d from hashkey import hashkey from math import floor from matplotlib import pyplot as plt from scipy import interpolate # Define parameters R = 2 patchsize = 11 gradientsize = 9 Qangle = 24 Qstrength = 3 Qc...
<reponame>wcbeard/fission-dashboard<gh_stars>0 import datetime as dt import itertools as it import operator as op import os import re import sys import time from collections import Counter, OrderedDict, defaultdict from functools import lru_cache, partial, reduce, wraps from glob import glob from importlib import reloa...
<gh_stars>10-100 from __future__ import absolute_import import numpy as np from matplotlib import pyplot as plt from matplotlib import animation from JSAnimation import IPython_display from six.moves import zip def basic_animation(frames=100, interval=30): """Plot a basic sine wave with oscillating amplitude""" ...
<reponame>keener101/lkpy<gh_stars>100-1000 from lenskit import DataWarning from lenskit.algorithms import Recommender from lenskit.algorithms.basic import Fallback from lenskit.algorithms.bias import Bias from lenskit import batch import lenskit.algorithms.item_knn as knn from lenskit.sharing import persist from lenski...
<gh_stars>1-10 ############################################################################### ## Library code for designing CRISPRi screens ## <NAME> ## November 10, 2019 ## Based on Charlie's gRNA design ## Tested with: "use .python-3.5.1; source /seq/lincRNA/Ben/VENV_MIP/bin/activate" ## TODO: Factor out helper co...
import numpy as np import scipy.sparse as sp import torch import random def encode_onehot(labels): classes = set(labels) classes_dict = {c: np.identity(len(classes))[i, :] for i, c in enumerate(classes)} labels_onehot = np.array(list(map(classes_dict.get, labels)), dtype=np.int32) return labels_onehot...
import argparse import scipy.stats import numpy as np import pandas as pd import json def summarize_pmf(pmf_dict): keys = np.fromiter(pmf_dict.keys(), dtype=np.float64) probas = np.fromiter(pmf_dict.values(), dtype=np.float64) dist = scipy.stats.rv_discrete(name='custom', values=(keys, probas)) samps =...
<reponame>CTJChen/ctc_astropylib from scipy.optimize import nnls import multiprocessing as mp from ctc_filters import * from ggplot import * from astropy.coordinates import Distance from astropy import units as u import seaborn as sns ''' Perform non negative least square SED fitting using the Assef et al. 2010 templa...
<gh_stars>1-10 import numpy as np from scipy.spatial.distance import cdist from stumpy import core def z_norm(a, axis=0, threshold=1e-7): std = np.std(a, axis, keepdims=True) std[np.less(std, threshold, where=~np.isnan(std))] = 1.0 return (a - np.mean(a, axis, keepdims=True)) / std def distance(a, b, a...
<reponame>Evan1415/QMLA<filename>qmla/analysis/genetic_algorithm_analysis.py import sys import os import numpy as np import pandas as pd import pickle import itertools import random import copy import scipy import time import sklearn import matplotlib.pyplot as plt from matplotlib.lines import Line2D from matplotlib.g...
<gh_stars>0 import argparse import re import warnings from pathlib import Path import numpy as np import scipy.sparse as sp import spacy from sklearn.feature_extraction.text import CountVectorizer, ENGLISH_STOP_WORDS from utils import createDirs, createLogger INPUT_DIR = Path(r'../data/aclImdb/') OUTPUT_DIR = Path(r...
<reponame>vinbigdata-medical/abdomen-phases<filename>study_evaluation/draw_ci(study).py<gh_stars>0 from os import replace import pandas as pd import numpy as np from scipy.sparse import data from tqdm import tqdm from multiprocessing import Pool from sklearn.metrics import classification_report import matplotlib.pypl...
''' Prediction Experiments Usage: python3 03_excitation_03_prediction.py [effect_type] [model_type] [time_span] Usage example: python3 03_excitation_03_prediction.py early reduced 3 ''' import json import os import sys import numpy as np from scipy import stats import sklearn.metrics as metrics from tick.inference imp...
import numpy as np from scipy.interpolate import interp1d __all__ = ["extend_xmax_range", "extend_distance_range", "extend_template_coverage"] def extend_xmax_range(xmax_bins, templates): """ Copy templates in empty xmax bins, helps to prevent problems from reaching the edge of the interpolation space. ...
<filename>sox/transform.py #!/usr/bin/env python # -*- coding: utf-8 -*- ''' Python wrapper around the SoX library. This module requires that SoX is installed. ''' from __future__ import print_function from .log import logger import random import os from io import BytesIO import numpy as np from scipy.io import wavf...
<gh_stars>0 # -*- coding: utf-8 -*- import sklearn as sk import scipy as sc import numpy as np import pandas as pd import stemming.paicehusk as st from Tkinter import Tk from tkFileDialog import askopenfilename import nltk as nltk import asciitable as asci import re import math import random as rand ...
<gh_stars>0 import numpy as np import logging logger = logging.getLogger('legacypipe.blobmask') def info(*args): from legacypipe.utils import log_info log_info(logger, args) def debug(*args): from legacypipe.utils import log_debug log_debug(logger, args) def stage_blobmask(targetwcs=None, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `univariate.gaussian_kde` module.""" from unittest import TestCase from unittest.mock import MagicMock, patch import numpy as np from scipy.stats import gaussian_kde from copulas.univariate.gaussian_kde import GaussianKDE class TestGaussianKDE(TestCase): ...
#ipython --pylab import scipy from mpl_toolkits.basemap import Basemap, addcyclic, shiftgrid from netCDF4 import Dataset import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import pandas import pylab np.set_printoptions(threshold=np.nan) Folder = 'results' species1 = ['Thunnus_obesus', 'T...
"""from numpy import * from pylab import * import math x = np.arange(0, math.pi*2, 0.05) y = np.sin(x) fig = plt.figure() ax = fig.add_axes([0,0,1,0.8]) ax.plot(x,y) ax.set_title("sine wave") ax.set_xlabel('angle') ax.set_ylabel('sine') plt.show()""" #etiquetas y dibujos """import matplotlib.pyplot as plt y = [1, 4, 9...
import platform import sys import subprocess armv6 = bool(platform.machine() == 'armv6l') if sys.platform == 'darwin': osx105 = b'10.5.' in subprocess.check_output('sw_vers') else: osx105 = False print('sys.version:', sys.version) print('sys.platform:', sys.platform) print('sys.abiflags:', sys.abiflags) print...
# New ks_2samp version submitted to scipy (see # https://github.com/scipy/scipy/pull/8). import numpy as np from numpy import asarray from scipy.stats import ksprob def ks_2samp(data1, data2, signed=False): """ Computes the Kolmogorov-Smirnov statistic on two samples, as well as its two-sided p-value. ...
import numpy as np import pandas as pd import collections import matplotlib.pyplot as plt from sklearn.mixture import GaussianMixture from sklearn.model_selection import KFold from random import seed from random import randrange from scipy.stats import multivariate_normal #Import Dataset and store features in X datase...
# -*- coding: utf-8 -*- import pandas as pd import numpy as np import biosppy import scipy # ============================================================================== # ============================================================================== # ===============================================================...
import argparse import numpy as np import scipy.stats import matplotlib as mpl mpl.use('Agg') from matplotlib import pyplot as plt def makenormal(mu=1, sigma=1, n=1000, **kwargs): data = np.random.normal(loc=mu, scale=sigma, size=n) return data def makebimodal(mu=1, mu2=2, sigma=1, sigma2=1, n=1000, n2=0, **...
from sympy import symbols, Mul, sin, Integral, oo, Eq, Sum from sympy.core.expr import unchanged from sympy.stats import ( Normal, Poisson, variance, Covariance, Variance, Probability, Expectation, ) from sympy.stats.rv import probability, expectation def test_literal_probability(): X ...
<filename>tests/python/test_dmatrix.py # -*- coding: utf-8 -*- import os import tempfile import numpy as np import xgboost as xgb import scipy.sparse import pytest from scipy.sparse import rand, csr_matrix import testing as tm rng = np.random.RandomState(1) dpath = 'demo/data/' rng = np.random.RandomState(1994) cl...
<reponame>albertoOA/Medical-Entities-Similarity-Measurements # !/usr/bin/env python3 import scipy import sklearn def compute_similarity_between_pairs(drugids, sim_matrix, list_of_pairs): n = len(list_of_pairs) total_list = list() for i in range(0, n): aux_list = list() pair = ...
<filename>modelnet40_cls/evaluate_modelnet.py import argparse import time import numpy as np import tensorflow as tf import socket import importlib import os import sys import scipy.io as sio ROTATION = False os.environ["CUDA_VISIBLE_DEVICES"]='0' # baseDir = os.path.dirname(os.path.abspath(__file__)) # rootDir = os....
import os import re import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches import math import random import skimage.io import skimage.transform import skimage.filters import skimage.feature import skimage.morphology import scipy.ndimage.morphology import skimage.mea...
<reponame>dcslagel/welly<filename>welly/curve.py """ Defines log curves. :copyright: 2021 Agile Scientific :license: Apache 2.0 """ from __future__ import division import numpy as np from scipy.interpolate import interp1d import matplotlib.pyplot as plt import matplotlib as mpl from matplotlib.patches import PathPat...
"""This module handles experiments related to matrix connections.""" import os import gc import numpy as np from collections import OrderedDict from pprint import pprint import pickle from scipy import sparse from mpmath import mpf import pandas as pd from .connectivity_patterns import MatrixConnectivity from .simpl...
<reponame>haoruilee/statslibrary<gh_stars>10-100 import CorreCoef as co import numpy as np import scipy.stats as sc if __name__ == "__main__": # 1. pearson相关系数 # pearson相关系数计算公式参见https://docs.scipy.org/doc/numpy/reference/generated/numpy.corrcoef.html?highlight=corrcoef#numpy.corrcoef data=n...
<filename>VAT_iVAT/Vat_exp_random_data.py import time import matplotlib.pyplot as plt import numpy as np from matplotlib import cm from scipy.stats import mode from data_generate_non_cs import data_generate_non_cs from distance2 import distance2 from iVAT import iVAT from VAT import VAT from scipy.io import savemat ...
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2012-2018 GEM Foundation # # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the Licen...
#!/usr/bin/env python ''' Miscellaneous utilities that are extremely helpful but cannot be clubbed into other modules. ''' import torch # Scientific computing import numpy as np import scipy.linalg as lin from scipy import io # Plotting import cv2 import matplotlib.pyplot as plt def nextpow2(x): ''' ...
<gh_stars>10-100 import onnx from onnx import helper, shape_inference from onnx import TensorProto import onnx.optimizer import math import numpy as np import scipy.stats as stats def truncated_normal(dims): size = 1 for dim in dims: size *= dim mu, stddev = 0, 1/math.sqrt(size) lower, upp...