text string |
|---|
<reponame>Richert/BrainNetworks
from pyrates.utility import plot_timeseries, grid_search, plot_psd, plot_connectivity
import numpy as np
import matplotlib.pyplot as plt
from seaborn import cubehelix_palette
from scipy.signal import find_peaks
__author__ = "<NAME>"
__status__ = "Development"
# parameters
dt = 1e-4
dt... |
<reponame>PiaDiepman/NILMTK-contrib<filename>nilmtk_contrib/disaggregate/dae.py
from warnings import warn
from nilmtk.disaggregate import Disaggregator
from tensorflow.keras.layers import Conv1D, Dense, Dropout, Reshape, Flatten
import pandas as pd
import numpy as np
from collections import OrderedDict
from tensorflow... |
<reponame>Tian99/Robust-eye-gaze-tracker<filename>calibration.py
import matplotlib.pyplot as plt
import scipy.stats as stats
import numpy as np
import csv
class auto_draw:
def __init__(self):
self.columns = []
self.as_dict = None
self.factor = 10
def read(self, file):
with open(file) as csvfile:
readC... |
import random
import numpy as np
import torch
import yaml
import math
from agents.base_agent import BaseAgent
from envs.env_factory import EnvFactory
class QL(BaseAgent):
def __init__(self, env, config, count_based=False):
self.agent_name = "ql"
super().__init__(agent_name=self.agent_name, env=e... |
<filename>lau_outlierlong.py<gh_stars>0
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
#npyfile = np.load('total_data_array.npy')
def outlierlong(npyfile):
#making a list of all the station names
allstationnames = np.unique(npyfile[1:, 0])
#allstationnames = np.array(['AL... |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2015-2019 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... |
from sklearn.linear_model import LinearRegression, RidgeCV, LassoCV
from numpy import expm1, log1p, clip
from scipy.stats import boxcox
from scipy.special import inv_boxcox
class RightUnskewedLinearRegression(LinearRegression):
def predict(self, X):
return expm1(super().predict(X))
def fit(self, X, y,... |
# Copyright (c) 2019 Lightricks. All rights reserved.
import re
import string
import numpy as np
from scipy import sparse
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.utils.validation... |
#!/usr/bin/env python3
import stepwise
import appcli
import autoprop
import textwrap
from inform import plural
from fractions import Fraction
from operator import not_
from appcli import Key, DocoptConfig
from stepwise import StepwiseConfig, PresetConfig, pl, ul, pre
from stepwise_mol_bio import Main
def by_solvent(o... |
<reponame>chirain1206/Improvement-on-OTT-QA
#!/usr/bin/env python3
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""A script to build the tf-idf document matrices for retrieval."""... |
<reponame>zuoym15/dino<filename>util/box.py<gh_stars>0
import numpy as np
from scipy.spatial import ConvexHull
# some funcs from https://github.com/charlesq34/frustum-pointnets/blob/master/train/box_util.py
from bbox import BBox3D
from bbox.metrics import jaccard_index_3d
import torch
import utils.basic
import utils.ge... |
<gh_stars>0
from __future__ import print_function
from collections import defaultdict
import itertools
import logging
import os
import Queue
import time
import numpy as np
import pandas as pd
import sklearn
import scipy.stats
from autosklearn.metalearning.metalearning.meta_base import MetaBase
import HPOlib.benchmark... |
"""
Qubit_process_tomography.py: Reconstruction of characteristic χ matrix for a superoperator applied on a single qubit
Author: <NAME> - Quantum Machines
Created: 13/11/2020
Created on QUA version: 0.5.138
"""
# Importing the necessary from qm
from qm.QuantumMachinesManager import QuantumMachinesManager
from qm.qua i... |
<reponame>arseniiv/xenterval
from __future__ import annotations
from fractions import Fraction
from typing import Iterator
from xenterval.typing import Rat, RatFloat
__all__ = ('convergents',)
def convergents(x: RatFloat) -> Iterator[Rat]:
if isinstance(x, int | float):
x = Fraction(x)
m_prev, m, n_p... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
import tensorflow as tf
import tensorflow_probability as tfp
import numpy as np
from tqdm import trange
from scipy.io import savemat, loadmat
from scipy.stats import norm
import matplotlib.pyplot as ... |
"""
Functions to apply the fitting in an MCMC manner.
"""
import numpy as np
from tqdm import tqdm
from .profiles import free_params
# -- MCMC Functions -- #
def lnprior(params, priors):
"""Log-prior function."""
lnp = 0.0
for param, prior in zip(params, priors):
lnp += parse_prior(param, prior)... |
import os
import pickle
import random
import statistics
import sys
from datetime import datetime
import click
import numpy as np
from tensorflow import logging
from tensorflow.python.keras.callbacks import EarlyStopping
from tensorflow.python.keras.models import load_model
from tensorflow.python.keras.optimizers impor... |
<filename>contentcuration/contentcuration/management/commands/get_channel_stats.py
import csv
import os
import progressbar
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db.models import Sum
from le_utils.constants import content_kinds
from statistics import mean
from ... |
<filename>src/GA_MLP/GA_MLP_1.py<gh_stars>0
import os
import math
import tensorflow as tf
import numpy as np
import pylab as plt
from scipy.io import loadmat
import datetime
import copy
import sys
import statistics as st
from scipy.stats import pearsonr
import json
from core.data_processor import DataLoader
from core.m... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright CNRS 2012
# <NAME> (LULI)
# This software is governed by the CeCILL-B license under French law and
# abiding by the rules of distribution of free software.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
f... |
<filename>APKnet.py
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
import scipy.io as sio
from scipy.spatial import distance
import numpy as np
from sklearn.metrics.pairwise import pairwise_distances
import utils4knets
# import numba
# from numba import prange
# *******************************
# Assignment K... |
'''
cachenone.py
'''
import heapq
import numpy as np
from scipy.stats import entropy
from sklearn.ensemble import RandomForestClassifier
import helper
class CacheNone:
def __init__(self):
# pairs assigned to this node
self.pairs = None # list of (ltable_id, rtable_id)
self.features... |
<reponame>cdw/celloutline
# encoding: utf-8
""" Geometric transforms and supporting concepts: consequences of 3D world
Author: CDW
"""
# Standard or installed
import numpy as np
import scipy.spatial
from numba import jit
# Local
from . import greedy
""" Coordinate conversion: xyz to rpt and back """
def cart_to_sphe... |
<gh_stars>0
"""A class used for isotherm interpolation."""
from scipy.interpolate import interp1d
class isotherm_interpolator():
"""
Class used to interpolate between isotherm points.
Call directly to use.
It is mainly a wrapper around scipy.interpolate.interp1d.
Parameters
----------
... |
<gh_stars>0
import numpy as np
import torch
import model
import scipy.signal
from torch.optim import Adam
import time
from rlschool import make_env
import copy
from spinup.utils.logx import EpochLogger
def combined_shape(length, shape=None):
if shape is None:
return (length,)
return (length, shape) if... |
<reponame>fgnt/sed_scores_eval<filename>sed_scores_eval/base_modules/io.py
from pathlib import Path
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
import lazy_dataset
from sed_scores_eval.utils.scores import (
create_score_dataframe,
validate_score_dataframe,
)
from sed_scores_eva... |
<gh_stars>1-10
import os
os.environ['OMP_NUM_THREADS'] = '1'
import dgl
import sys
import numpy as np
import time
from scipy import sparse as spsp
from numpy.testing import assert_array_equal
from multiprocessing import Process, Manager, Condition, Value
import multiprocessing as mp
from dgl.graph_index import create_g... |
"""
Max-p regions algorithm
Source: <NAME>, <NAME>, and <NAME> (2020) "Efficient
regionalization for spatially explicit neighborhood delineation." International
Journal of Geographical Information Science. Accepted 2020-04-12.
"""
from ..BaseClass import BaseSpOptHeuristicSolver
from .base import (w_to_g, mo... |
# MIXTURE-BASED BEST REGION SEARCH
import geopandas as gpd
import pandas as pd
import math
from rtree import index
import networkx as nx
import numpy as np
from statistics import mean, median
import random
from random import sample
import time
from scipy.stats import entropy
import heapq
import folium
import json
fr... |
import numpy as np
import sys
sys.path.append('../')
from scipy.io import savemat
import os
import matplotlib.pyplot as plt
import scipy
from skimage.measure import compare_ssim
def removeFEOversampling(src):
""" Remove Frequency Encoding (FE) oversampling.
This is implemented such that they match with th... |
import sys
from scipy.stats import hypergeom
if len(sys.argv) < 3:
exit("Usage: python feature_enrichment.py <feature association file> <genelist>")
gene_feature = {}
feature_dict = {}
association_file = sys.argv[1]
try:
fassoc = open(association_file, "r")
for line in fassoc:
line = line... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 10 14:27:10 2021
@author: <NAME> from the Bioimaging Facility of the John Innes Centre.
"""
# Imports the necessary libraries.
from ncempy.io import dm
import numpy as np
import matplotlib.pyplot as plt
from skimage import filters, morphology, segmentation, me... |
<reponame>fsponciano/ElecSus
# Copyright 2014 <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME> and <NAME>.
# Updated 2017 JK
# 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.o... |
"""
Start based environments. The classes inside this file should inherit the classes
from the state environment base classes.
"""
import random
from collections import OrderedDict
from rllab import spaces
import sys
import os.path as osp
import cloudpickle
import pickle
import numpy as np
import scipy.misc
import ... |
<reponame>Emigon/qutilities<gh_stars>0
""" circle.py
author: <NAME>
this file defines the Circle datatype and complex plane circle fitting methods
"""
import warnings
import numpy as np
import pandas as pd
from scipy.linalg import eig
import matplotlib.patches as patches
from fitkit import *
class Circle(object... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
from load import *
from fft import *
from plots import *
print('\nplotting fields\n')
outdir = './fig_fields/'
# Load 2D cut
ncfile = netcdf.netcdf_file(input_dir+runname+'.out.2D.nc'+restart_num, 'r')
tt_fld = np.copy(ncfile.variables['tt' ][:]); tt_fld = np.delete(tt_fld... |
import warnings
from typing import Optional, Tuple, Any, Literal
from pandas.core.dtypes.common import is_numeric_dtype
from statsmodels.api import stats
from statsmodels.formula.api import ols
import numpy as np
import pandas as pd
import scipy.stats as sp
import seaborn as sns
import matplotlib.pyplot as plt
__all_... |
import os
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import networkx as nx
from sklearn.model_selection import KFold
from sklearn.preprocessing import StandardScaler
import numpy as np
from scipy.integrate import solve_ivp
import digital_patient
from scipy import interpolate
from digit... |
<reponame>physwkim/silx<filename>silx/math/fit/leastsq.py
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2004-2020 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software... |
<reponame>avicennax/sirang
#!/usr/bin/env python
# Find local minima of Rosenbrock function and store
# initial guess with solution together.
import argparse
import numpy as np
import scipy.optimize as sciop
import sirang
# Declare experiment storage wrapper
experiment = sirang.Sirang()
# Decorate function whose... |
<reponame>pnnl/vaine-widget
# VAINE Widget
# Copyright (c) 2020, Pacific Northwest National Laboratories
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must re... |
<filename>textured_surface_anomaly_detection/provider.py<gh_stars>10-100
import os
import sys
from scipy import misc
import re
import numpy as np
def LOAD_DATA(data_path):
label_path = data_path + 'Label/'
cls_label = []
with open(label_path + 'Labels.txt') as f:
for line in f.readlines():
... |
""" Python script to perform the analysis """
#==============================================================================
__title__ = "Winter School 2018"
__author__ = "<NAME>"
__version__ = "v1.0(26.05.2018)"
__email__ = "<EMAIL>"
#==============================================================================
# ... |
<gh_stars>0
import inspect as insp
import dask
import numpy as np
from edt import edt
import operator as op
import scipy.ndimage as spim
from skimage.morphology import reconstruction
from skimage.segmentation import clear_border
from skimage.morphology import ball, disk, square, cube, diamond, octahedron
from porespy.t... |
import os
import dgl
import torch as th
import numpy as np
import scipy.io as sio
from dgl.data import DGLBuiltinDataset
from dgl.data.utils import save_graphs, load_graphs, _get_dgl_url
class GASDataset(DGLBuiltinDataset):
file_urls = {
'pol': 'dataset/GASPOL.zip',
'gos': 'dataset/GASGOS.zip'
... |
import heapq
import sys
import numpy as np
from numpy import unique
from numpy import where
from sklearn.datasets import make_classification
from sklearn.cluster import KMeans
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.datasets import make_blobs
from sklearn.datasets import m... |
<filename>apps/fem_vis_ssbo/parse_mat_to_mat_bin_translation_only.py
#!/usr/bin/python
import scipy.io as sio
import numpy as np
import sys
number_of_arguments = len(sys.argv)
if number_of_arguments < 2:
print("This program takes an *.mat-File with the FEM-Attributes as defined before and creates a binary stream ... |
<filename>tensorcv/train/config.py<gh_stars>1-10
import scipy.misc
import os
import numpy as np
from ..dataflow.base import DataFlow
from ..models.base import ModelDes, GANBaseModel
from ..utils.default import get_default_session_config
from ..utils.sesscreate import NewSessionCreator
from ..callbacks.monitors... |
<filename>hsr4hci/metrics.py
"""
Methods for computing performance metrics (e.g., SNR, logFPF, ...).
"""
# -----------------------------------------------------------------------------
# IMPORTS
# -----------------------------------------------------------------------------
from typing import Any, Dict, List, Optiona... |
"""A module for TurbidityCurrent2D to produce a grid object from a geotiff
file or from scratch.
codeauthor: : <NAME>
"""
from landlab import RasterModelGrid
import numpy as np
from osgeo import gdal, gdalconst
from scipy.ndimage import median_filter
from landlab import FieldError
def create_topography(
l... |
# small demo for sinogram TOF OS-MLEM
import os
import matplotlib.pyplot as plt
import pyparallelproj as ppp
from pyparallelproj.phantoms import ellipse2d_phantom, brain2d_phantom
from pyparallelproj.models import pet_fwd_model, pet_back_model
from scipy.ndimage import gaussian_filter
import numpy as np
import argpar... |
<filename>analyses/regression/pylib/pylib_GP_model.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 18 12:39:04 2020
@author: glavrent
"""
#load variables
import pathlib
import glob
#arithmetic libraries
import numpy as np
from scipy import linalg
#statistics libraries
import pandas ... |
<reponame>joaopfonseca/research<gh_stars>1-10
"""
Analyze the experimental results.
"""
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# License: MIT
from os import listdir
from os.path import join
from itertools import product
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seabo... |
<reponame>MagicMilly/terraref-datasets<filename>scripts/tall-to-wide.py
#!/usr/bin/env python3
import csv
from pathlib import Path
from statistics import mean
import logging
# Files
data_dir = Path('/media/kshefchek/data')
big_file = data_dir / 'mac_season_four_2020-04-22.csv'
flowering_time = data_dir / 'days_gdd_to... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 8 17:54:25 2016
@author: amandine
"""
#%reset -f
import pandas as pd
from matplotlib import pyplot as plt
import glob
from datetime import date
import numpy as np
import matplotlib.dates as mdates
YEARS = np.arange(1991,2019) # TO CHANGE!!!
MHWPeriod = [1991,2019]
... |
<filename>helperFunction.py
import numpy as np
import scipy.stats as stats
import os, sys
import nibabel as nib
from info import *
def loadImages(imgPath, label=0):
# images with face features label 1, images without face features label 0;
files = sorted(os.listdir(imgPath))
imgs = np.zeros([len(files), im... |
__author__ = 'dengzhihong'
from src.Regression.base import *
from scipy import optimize
class LASSO(RegressionBase):
@staticmethod
def run(sampx, sampy, K):
y = RegressionBase.strlistToFloatvector(sampy)
fai_matrix = RegressionBase.constructFaiMartix(sampx, K)
product_fai = np.dot(fai_... |
import numpy as np
from scipy import signal # Det här kanske behöver importeras på något annat sätt.
import matplotlib.pyplot as plt # TODO: ta bort sen
import time # TODO: Ta bort sen
from scipy.fftpack import fft
from scipy.signal import spectrogram # To plot spectrogram of FFT.
import threading
import queue
impo... |
import numpy as np
import sklearn.metrics as sm
from scipy import stats
import pandas as pd
from sklearn.linear_model import LinearRegression
from .ModelInterface import Model
class LinearRegressionModel(Model):
def __init__(self, x, y):
self.model = LinearRegression()
super().__init__(x, y)
... |
<filename>py_system/prototype/UAV/uav_tdoa_3d.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import sys
import math
import random
import numpy as np
import matplotlib.pyplot as plt
from numpy.linalg import inv
import scipy.constants as spy_constants
from uav_tdoa import Sim2DCord
from scipy.optimize import fs... |
<gh_stars>10-100
'''create scatterplot with confidence ellipsis
Author: <NAME>
License: BSD-3
TODO: update script to use sharex, sharey, and visible=False
see http://www.scipy.org/Cookbook/Matplotlib/Multiple_Subplots_with_One_Axis_Label
for sharex I need to have the ax of the last_row when editing the earlie... |
<reponame>somniumism/kaldi
# Copyright 2021 STC-Innovation LTD (Author: <NAME>)
import kaldi_io
import argparse
import numpy as np
import pickle
import os
from collections import defaultdict
import logging
import glob
from tqdm import tqdm
import sys
from scipy.special import softmax
logger = logging.getLogger(__name... |
<gh_stars>10-100
'''Unit tests for Aronnax'''
from contextlib import contextmanager
import os.path as p
import re
import numpy as np
from scipy.io import FortranFile
import aronnax as aro
from aronnax.utils import working_directory
import pytest
import glob
self_path = p.dirname(p.abspath(__file__))
def test_ope... |
<gh_stars>0
#! /usr/bin env python
#Converts UTC Julian dates to Terrestrial Time and Barycentric Dynamical Time Julian dates
#Author: <NAME>, <EMAIL>
#Last update: 2011-03-17
import numpy as np
import urllib
import os
import re
import time
import scipy.interpolate as si
def leapdates(rundir):
'''Generates an array o... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 18 03:29:24 2019.
@author: mtageld
"""
import numpy as np
from PIL import Image
from histomicstk.annotations_and_masks.annotation_and_mask_utils import (
get_image_from_htk_response)
from histomicstk.preprocessing.color_deconvolution.color_deco... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 3 15:10:24 2020
@author: Nicolai
----------------
"""
import numpy as np
import time
from scipy.stats import cauchy
import testFunctions as tf
def L_SHADE(population, p, H, function, minError, maxGeneration):
'''
implementation of L-SHADE based on: \n
Impr... |
<filename>utils/x1_mri2nii.py
import os
import glob
import numpy as np
from scipy.ndimage import zoom
from nibabel import load, save, Nifti1Image
minc_list = glob.glob("./*.mnc")
minc_list.sort()
for minc_path in minc_list:
print(minc_path)
minc_file = load(minc_path)
minc_name = os.path.basename(minc_p... |
"""A collection of physical, chemical, and environmental constants."""
from typing import List
import scipy.constants as _sc
# chemical constants
M_d: float = 28.964_5e-3 # dry air molar mass [kg mol^-1]
M_w: float = 18.015_28e-3 # water vapor molar mass [kg mol^-1]
R_d: float = _sc.R / M_d # specific gas constant... |
"""
Functions for calculating per-pixel temporal summary statistics on a
timeseries stored in a xarray.DataArray.
The key functions are:
.. autosummary::
:caption: Primary functions
:nosignatures:
:toctree: gen
xr_phenology
temporal_statistics
.. autosummary::
:nosignatures:
:toctree: gen
"""
... |
import pytest
import scipy.sparse as sp
from sklearn.base import clone
from sklearn.utils._testing import assert_array_equal
from sklearn.utils._testing import assert_array_almost_equal
from sklearn.utils._testing import assert_almost_equal
from sklearn.utils._testing import ignore_warnings
from sklearn.utils.stats i... |
import numpy as np
import multiprocessing as mp
from multiprocessing import get_context
from numba import njit, prange
from hmmconf.conform import *
from hmmconf.base_utils import *
from hmmconf.numba_utils import *
from hmmconf.utils import *
import scipy
logger = make_logger(__file__)
__all__ = [
'compute_l... |
import logging
import numpy as np
from scipy.signal import filtfilt
from scipy.sparse.linalg import lsqr
from pylops.utils import dottest as Dottest
from pylops import Diagonal, Identity, Block, BlockDiag
from pylops.signalprocessing import FFT2D, FFTND
from pylops.utils.backend import get_module, get_module_name, get... |
import pandas as pd
import numpy as np
from sklearn.decomposition import TruncatedSVD
from scipy.sparse import csc_matrix
raw_data_path = "sparse_ijk.tsv"
out_data_path = "output.tsv"
query_projector = "query_proj.tsv"
svd_params = {
"n_components" : 5,
"algorithm" : 'randomized',
"n_iter" : 20}
d_ijk = np.loadtxt(... |
from math import factorial as f
from fractions import gcd
MOD = (10**9)+7
def F(n, k):
return (f(n) / (f(k) * f(n-k))) * k
def solve(n, k):
l = [F(n, i) for i in xrange(1, k+1)]
return (reduce(lambda x, y: x * y / gcd(x,y), l)) % MOD
t = input()
n, k = [int(x) for x in raw_input().split()]
a, b, m = [int(x) for ... |
<gh_stars>0
from pipetorch.experiment import Experiment
import os
import torch
from torch import nn
from torch.nn import functional as F
from torch.distributions import Categorical
from torch.utils import data
import torchvision
import torch.optim as optim
from utils.helper_functions import bw2rgb_expand_channels, res... |
<filename>mixed_effects.py<gh_stars>1-10
import scipy.io
from tqdm import tqdm
import pickle
import numpy as np
import pandas as pd
import sys
import math
from sklearn.model_selection import KFold
import statsmodels.api as sm
import statsmodels.formula.api as smf
import argparse
import os
import helper
import scipy.sta... |
<reponame>mcpl-sympy/sympy<gh_stars>0
from sympy.multipledispatch import Dispatcher
from .equation import SymbolicRelation, Equation
class RelOp(SymbolicRelation):
"""
Base class for every unevaluated operation between symbolic relations.
"""
def __new__(cls, arg1, arg2, evaluate=False):
if a... |
import numpy as np
from scipy.spatial import distance
def add_points_to_distance_matrix(points, original_array, distance_matrix, metric='euclidean'):
"""
There is an NxM array of points, a square matrix NxN with distances between points.
This function adds new points to the distance matrix.
We need to ... |
## Automatically adapted for scipy Oct 21, 2005 by
# Author: <NAME>
from scipy.special.orthogonal import p_roots as p_roots_orig
from numpy import sum, isinf, isscalar, asarray, real, empty
_cache = {}
#@profile
def p_roots(n):
try:
return _cache[n]
except KeyError:
_cache[n] = p_roots_orig(n... |
from baseProblem import NonLinProblem
from numpy import asfarray, dot, abs, ndarray
import numpy as np
from setDefaultIterFuncs import FVAL_IS_ENOUGH, SMALL_DELTA_F
import NLP
try:
import scipy
solver = 'scipy_fsolve'
except ImportError:
solver = 'nssolve'
class NLSP(NonLinProblem):
_optionalData = ['... |
'''
Help generate histogram for Descriptive Stat worksheet
'''
import csv, seaborn as sns, pandas as pd
import matplotlib.pyplot as plt
import json
import numpy as np
import scipy
iris = pd.read_csv('../../Datasets/iris.csv')
#mean
def mean(ls):
return sum(ls)/len(ls)
#std dev
def standard_deviation(ls):
_mean =... |
#! /usr/bin/env python
"""Unit tests for landlab.io.netcdf module."""
import numpy as np
from nose.tools import assert_equal, assert_true, assert_raises
from nose import SkipTest
from numpy.testing import assert_array_equal
from landlab import RasterModelGrid
from landlab.io.netcdf import write_netcdf, NotRasterGridE... |
<filename>simulator.py<gh_stars>0
import networkx as nx
import matplotlib.pyplot as plt
import random
import statistics
import utils
def simulate_time_step(graph):
graph_copy = utils.copy_graph(graph)
F = graph.graph['F']
for node in graph_copy:
values = [(graph.nodes[node]['value'], True)]
... |
import functools
import io
import os
import typing
from PIL import Image
from pymatting.alpha.estimate_alpha_cf import estimate_alpha_cf
from pymatting.foreground.estimate_foreground_ml import estimate_foreground_ml
from pymatting.util.util import stack_images
from scipy.ndimage.morphology import binary_erosion
import ... |
import unittest
import numpy as np
from scipy.stats import unitary_group
from neuroptica.component_layers import MZI, MZILayer, OpticalMesh, PhaseShifter, PhaseShifterLayer
from neuroptica.layers import ClementsLayer
from neuroptica.losses import MeanSquaredError
from neuroptica.models import Sequential
from neuropti... |
<filename>src/pyGLMHMM/transLearningFun.py<gh_stars>1-10
import copy
import numpy as np
from numba import jit
from scipy.sparse import spdiags
from scipy.linalg import block_diag
@jit
def _trans_learning_fun(trans_w, stim, state_num, options):
# trans_w are the weights that we are learning: in format... |
#!/usr/bin/env python
from scipy import constants
import numpy as np
import math
V_PLANCK = [x * (10**9) for x in [30.0, 44.0, 70.0, 100.0, 143.0, 217.0, 353.0, 545.0, 857.0]]
V_0 = V_PLANCK[3]
PLANCK_H = constants.Planck
BOLTZMANN_K = constants.Boltzmann
K_S = -2.65
K_D = 1.5
K_FF = -2.14
T1 = 18.1
L = "left"
R = "ri... |
import numpy as np
np.seterr(divide='ignore', invalid='ignore')
import pandas as pd
import rioxarray as rxr
import rasterio
import xarray as xr
from rasterio.warp import reproject, Resampling
from scipy.stats import mode, truncnorm
import os, sys
import argparse
from argparse import RawTextHelpFormatter
import tracebac... |
<filename>src/plot.py
import numpy as np
from matplotlib import pyplot as plt
from scipy.stats import sem
import os,argparse,pickle
from matplotlib import rc
def plot_one_scores_setsizes_with_hist(Scores,dset,dsetnum,dtype):
"""
plots choice probability log losses vs choice setsize for a single dataset,
al... |
<filename>testODEsolving.py
import Dynamic_equations as dyneq
import scipy.integrate as spint
import numpy as np
import matplotlib
matplotlib.style.use('classic')
import matplotlib.pyplot as plt
from matplotlib.ticker import (MultipleLocator)
T_init=0.1
tau_init=0.2
R_init=0.15
Pi_init=10
variables0 = np.array([T_ini... |
<gh_stars>10-100
import argparse
import metric
from sklearn.cluster import KMeans
from sklearn.metrics.cluster import normalized_mutual_info_score, adjusted_rand_score
from sklearn.metrics.cluster import homogeneity_score, adjusted_mutual_info_score
import numpy as np
import random
import sys,os
from scipy.io import lo... |
<reponame>EpicKiwi/projet-datascience
import os
import sys
import random
import PIL
import cv2
from scipy import ndimage, misc
from PIL import Image, ImageFilter
from matplotlib import pyplot as plt
from scipy import ndimage, signal
import numpy as np
from app import Filter
# chemin dossier contenant les images cl... |
""" Defines the CloudNoiseModel class and supporting functions """
#***************************************************************************************************
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
# Under the terms of Contract DE-NA0003525 with NTESS, the U.... |
<filename>LSA_N.py
########################################
########################################
####### Author : <NAME> (alivcor)
####### Stony Brook University
# perfect essays : 37, 118, 147,
import csv
import sys
from nltk.corpus import stopwords
import numpy
import sklearn
from sklearn.feature_extraction.text... |
<filename>rnaloc/expressionHeatmap.py
# -*- coding: utf-8 -*-
# IMPORTS
#import matplotlib as mpl
#mpl.use('Agg')
import matplotlib.pyplot as plt
import os
import numpy as np
import json
from skimage import io
from scipy import ndimage
from skimage.io import imread, imsave
from rnaloc import toolbox
# Turn off warn... |
#import modules
import pandas as pd
import numpy as np
import os, sys
import math
from scipy.integrate import quad
from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication, QWidget, QInputDialog, QLineEdit, QFileDialog, QMessageBox, QLabel, QVBoxLayout
from PyQt5.QtGui import QIcon
#import functions
import co... |
<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
# Based on Copyright (C) 2016 <NAME> <<EMAIL>>
"""Lda Sequence model, inspired by `<NAME>, <NAME>: "Dynamic Topic Models"
<https://mimno.infosci.cornell.edu/info6150/readings/dynami... |
# Code to perform Continuous k-Nearest Neighbors(CkNN), proposed in the paper
# 'Consistent Manifold Representation for Topological Data Analysis'
# (https://arxiv.org/pdf/1606.02353.pdf)
#
# Based on the implementation by <NAME> (https://github.com/chlorochrule/cknn),
# with some API and performance improvements (majo... |
<filename>Feng/models/KNNmorefeature.py
import numpy as np
import json
import os
from scipy.io import loadmat
from pandas import DataFrame
from sklearn.preprocessing import StandardScaler
from sklearn.neighbors import KNeighborsClassifier
from config_name_creator import create_fft_data_name
##knn
def load_train_data_k... |
import numpy
import matplotlib.pyplot as plt
import matplotlib.tri as tri
from fenics import cells, Expression, Point, RectangleMesh
from mshr import Ellipse, generate_mesh
from scipy.integrate import quad
TOL = 1e-10
def plot_mesh(mesh, color="green", alpha=0.5):
""" Plot 2D mesh."""
coors = mesh.coordinates... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.