text string |
|---|
<reponame>rvbcldud/sympy
"""
Finite Discrete Random Variables - Prebuilt variable types
Contains
========
FiniteRV
DiscreteUniform
Die
Bernoulli
Coin
Binomial
BetaBinomial
Hypergeometric
Rademacher
IdealSoliton
RobustSoliton
"""
from sympy.core.cache import cacheit
from sympy.core.function import Lambda
from sympy.c... |
<gh_stars>1-10
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from tqdm import tqdm
import datetime
import argparse
import matplotlib.pyplot as plt
import math
import scipy
import torch
from torch.autograd import Variable
import sys
import os
import torch
from utils.utils import *
import torch.optim as optim
import tor... |
<reponame>tesslerc/H-DRLN<filename>graying_the_box/smdp.py
import numpy as np
import scipy.linalg
def divide_tt(X, tt_ratio):
N = X.shape[0]
X_train = X[:int(tt_ratio*N)]
X_test = X[int(tt_ratio*N):]
return X_train, X_test
class SMDP(object):
def __init__(self, labels, termination, rewards, value... |
<filename>uncertify/evaluation/statistics.py
from collections import defaultdict
import logging
from scipy.stats.kde import gaussian_kde
import torch
from torch import nn
from torch.utils.data import DataLoader
import numpy as np
import pandas as pd
from uncertify.evaluation.entropy import get_entropy
from uncertify.... |
import ctypes
from numba.extending import get_cython_function_address
import numba
import binom
import numpy as np
from common import Models
from scipy import LowLevelCallable
import util
# TODO: Can I just replace this with `util.lbeta`? Would it be faster / less bullshit?
def _make_betainc():
addr = get_cython_fun... |
"""Header here."""
import numpy as np
import scipy.stats as sps
from base.utilities import postsampler
import copy
"""
##############################################################################
##############################################################################
###################### THIS BEGINS THE RE... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize, leastsq
def linear_fit(args, x, y, num):
m, b = args
fit = m*x+b#b * x**m
return np.nansum((y-fit)**2/num**2)
def linear(args, x):
m, b = args
fit = m*x+b#b * x**m
return fit
def power_law(args, x):
... |
<filename>chi_sq.py
#!/usr/bin/env python
# classification in presence of imbalance and overlap
# matching the variable names as in the corresponding R code
import os, sys, pickle
import numpy as np
from sklearn.decomposition import PCA
from scipy.stats import gamma
from scipy.special import beta
def main():
if ... |
# -*- coding: utf-8 -*-
"""
Tests for abagen.correct module
"""
import itertools
import numpy as np
import pandas as pd
import pytest
import scipy.stats as sstats
from abagen import allen, correct, io
from abagen.utils import flatten_dict
@pytest.fixture(scope='module')
def donor_expression(testfiles, atlas):
... |
# MIT License
#
# Copyright (c) 2017 <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 without restriction, including without limitation the rights
# to use, copy, modify, merge, publi... |
import math
from scipy.special import logsumexp
def logsumexp_list(lst):
while len(lst)>1:
a = lst.pop(0)
b = lst.pop(0)
c = b + math.log10(math.exp(a - b) + 1)
lst.insert(0,c)
return lst[0]
def forward(X):
K = 2
F0_1 = []
F0_2 = []
E = [[1/6,1/6,1/6,1/6,1/6,1/6... |
<reponame>Mirwaisse/pytorch_geometric
import torch
import scipy.sparse
import networkx as nx
import torch_geometric.data
from .num_nodes import maybe_num_nodes
def to_scipy_sparse_matrix(edge_index, edge_attr=None, num_nodes=None):
r"""Converts a graph given by edge indices and edge attributes to a scipy
spa... |
<filename>hedp/tests/test_plasma_physics.py
#!/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.
import numpy as np
from numpy.testing import assert_allclose
impo... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
# Folsom annual inflow data
# summary statistics, histogram, QQ plot
annQ = np.loadtxt('data/folsom-annual-flow.csv', delimiter=',', skiprows=1, usecols=[1])
N = len(annQ)
m = np.mean(annQ)
s = np.std(annQ)
g = stats.skew(annQ)
# print('Mean... |
<reponame>yuankailiu/isce2
#!/usr/bin/env python3
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2014 California Institute of Technology. ALL RIGHTS RESERVED.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import scipy.stats as st
import seaborn as sns
import matplotlib.pyplot as plt
from arpym.statistics.meancov_sp import meancov_sp
from arpym.tools.plot_ellipse import plot_ellipse
from arpym.tools.histogram_sp import histogram_sp
def invariance_test_... |
<filename>sympy/core/decorators.py
"""
SymPy core decorators.
The purpose of this module is to expose decorators without any other
dependencies, so that they can be easily imported anywhere in sympy/core.
"""
from __future__ import print_function, division
from functools import wraps
from .sympify import SympifyErro... |
<reponame>tarment10/CoolProp
import numpy as np
import matplotlib.pyplot as plt
import CoolProp, scipy.optimize
class CurveTracer(object):
def __init__(self, backend, fluid, p0, T0):
"""
p0 : Initial pressure [Pa]
T0 : Initial temperatrure [K]
"""
self.P = [p0]
sel... |
from ..algorithms.base import Algorithm
from ..algorithms.action_selection import MaxActionSelector, SoftmaxActionSelector
from .dynamic_programming import ValueIteration, solve_value_iteration
from .mcts import MCTS_next_node, get_actions_states
from ..mdp import MDP
import numpy as np
from numba import njit
from fast... |
<reponame>bpinsard/nipy
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Utilities for extracting masks from EPI images and applying them to time
series.
"""
from __future__ import absolute_import
import math
# Major scientific libraries imports
imp... |
#!/usr/local/bin/python3
###!/Users/zhiyang/anaconda3/bin/python3
"""
This Python script is written by <NAME> to perform
miscellaneous tasks in analyzing data.
Synopsis:
Perform miscellaneous tasks in data analysis.
To-Do List:
+ Add information for statistics regarding:
- accuracy
- precision
Revisi... |
#
# DCP product code
#
# (C) Copyright 2015-2016 Dataculture Analytics Company
# All right reserved.
#
# This file is confidential and NOT open source. Do not distribute.
#
"""
A collection of miscellaneous utility functions.
"""
import pandas as pd
def colnames(filename, **kwargs):
"""
Read the column na... |
import torch
from torch.utils import data
import json
import os
import numpy as np
import soundfile as sf
import scipy.io.wavfile
EPS = 1e-8
DATASET = 'WHAM'
# WHAM tasks
enh_single = {'mixture': 'mix_single',
'sources': ['s1'],
'infos': ['noise'],
'default_nsrc': 1}
enh_both ... |
#####################################################
#
# 20 October 2009
# <NAME>
# University of California, San Diego
# <EMAIL>
#
# This script performs symbolic Hermite-Simpson
# integration on a vector field given in the text file
# equations.txt, takes the Jacobian and Hessian of the
# vector field, and s... |
<filename>SNDATA_ADDONS/snsedextend.py
#! /usr/bin/env python
#S.rodney
# 2011.05.04
"""
Extrapolate the Hsiao SED down to 300 angstroms
to allow the W filter to reach out to z=2.5 smoothly
in the k-correction tables
"""
import os
from numpy import *
from pylab import *
sndataroot = os.environ['SNDATA_ROOT']
MINWAV... |
<gh_stars>1-10
from emlp.reps import V,T,Rep
from emlp.groups import Z,S,SO,Group
from scipy.spatial.transform import Rotation
import jax.numpy as jnp
import numpy as np
class PseudoScalar(Rep):
is_regular=False
def __init__(self,G=None):
self.G=G
self.concrete = (self.G is not None)
def __... |
import os
os.chdir('MERFISH_Moffit/')
import numpy as np
import pandas as pd
import pickle
import matplotlib
matplotlib.use('qt5agg')
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
import matplotlib.pyplot as plt
import scipy.stats as st
with open ('data/SpaGE_pkl/MERFIS... |
<gh_stars>10-100
# https://github.com/keithito/tacotron/blob/master/util/audio.py
# https://github.com/carpedm20/multi-speaker-tacotron-tensorflow/blob/master/audio/__init__.py
# I only changed the hparams to usual parameters from oroginal code.
import numpy as np
from scipy import signal
import librosa.filters
import... |
from rdkit import Chem
import pandas as pd
import matplotlib.pyplot as plt
from tqdm import tqdm
import os
import numpy as np
from scipy import stats
import pickle
import random
from multiprocessing import Pool
import time
""" Create a list of mol representations (from rdkit) from a list of smarts strings
Note: al... |
import numpy as np
from scipy.linalg import expm, eigvals
import matplotlib.pyplot as plt
from numpy.random import normal
from math import sin, pi, cos, sqrt
try:
from dynamic_graph.sot.torque_control.utils.plot_utils import *
except:
print "Failed to load plot-utils"
class Robot:
def __init__(self, omega,... |
<gh_stars>0
import sys
import time
import os
import gc
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from scipy.signal import argrelextrema
import majoranaJJ.modules.SNRG as SNRG
import majoranaJJ.modules.finders as finders
import majoranaJJ.modules.checkers as check
import majoranaJJ.m... |
<gh_stars>0
"""Define distributions from which to get random numbers."""
import numpy as np
import math
from scipy.stats import truncnorm
import frbpoppy.precalc as pc
from scipy.integrate import odeint
def schechter(low, high, power, shape=1):
"""
Return random variables distributed according to Schechter lu... |
import itertools
import copy
from enum import Enum
import numpy as np
import scipy.misc as spmisc
from matplotlib.colors import BoundaryNorm
import matplotlib.cm as cm
from matplotlib.patches import Rectangle
__all__ = ['Bunch', 'ChannelMap', 'get_electrode_map']
NonSignalChannels = Enum('NonSignalChannels', ['grou... |
<reponame>timgates42/imbalanced-learn<filename>imblearn/under_sampling/_prototype_selection/_edited_nearest_neighbours.py<gh_stars>1-10
"""Class to perform under-sampling based on the edited nearest neighbour
method."""
# Authors: <NAME> <<EMAIL>>
# <NAME>
# <NAME>
# License: MIT
from collections im... |
import numpy as np
from scipy import signal
from gpitch import windowed
def frame(y, window_size, overlap, fs):
x_b, y_b = windowed.balance_data_size(y, window_size, overlap, fs)
new_n = x_b.shape
xout = []
yout = []
n = x_b.size
l = (window_size - overlap)
nw = (n - overlap) / l
for i... |
<gh_stars>1-10
import re
import pandas as pd
from collections import defaultdict
from scipy.spatial.distance import cosine
def group_by_scale(labels):
""" Utility that groups attribute labels by time scale """
groups = defaultdict(list)
# Extract scales from labels (assumes that the scale is given by the l... |
<gh_stars>0
"""
The MIT License (MIT)
Copyright (c) 2016 <NAME> (Stanford University)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
... |
<filename>modules/delay_spectrum.py
from __future__ import division
import numpy as NP
import multiprocessing as MP
import itertools as IT
import statsmodels.robust.scale as stats
import progressbar as PGB
import writer_module as WM
import aipy as AP
import astropy
from astropy.io import fits
import astropy.cosmology ... |
# -*- coding: utf-8 -*-
"""
Created on 2021/12/14 21:10:08
@File -> mutual_info.py
@Author: luolei
@Email: <EMAIL>
@Describe: 互信息和条件互信息计算
"""
from scipy.special import psi
import pandas as pd
import numpy as np
from . import DTYPES
from . import preprocess_values, deter_k, build_tree, query_neighbors_dist
from .e... |
<filename>cube-builder-aws/cube_builder_aws/utils/builder.py
import numpy
import datetime
import rasterio
from datetime import timedelta
from dateutil.relativedelta import relativedelta
from numpngw import write_png
from scipy import ndimage as ndi
#############################
def get_date(str_date):
return date... |
<filename>src/voice_synthesis/inference/inference.py
## 기본 라이브러리 Import
import sys
import numpy as np
import torch
import os
import argparse
## WaveGlow 프로젝트 위치 설정
sys.path.append('waveglow/')
## Tacontron2 프로젝트 위치 설정
sys.path.append('tacotron2/')
## 프로젝트 라이브러리 Import
from hparams import defaults
from model import Ta... |
# metal_binding_classifier
import os
#os.environ['CUDA_VISIBLE_DEVICES'] = '0'
#import the tools
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim import lr_scheduler
from torch.utils.data.dataset import Dataset
from torch.utils.data import DataLoader, Wei... |
import random
import logging
import numpy as np
import scipy
import scipy.ndimage
import scipy.interpolate
import torch
# A sparse tensor consists of coordinates and associated features.
# You must apply augmentation to both.
# In 2D, flip, shear, scale, and rotation of images are coordinate transformation
# color j... |
from warnings import warn
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.scipy.special import logsumexp
from autograd.scipy.linalg import block_diag
from autograd import grad
from scipy.optimize import linear_sum_assignment, minimize
from scipy.special import gammaln, digamma, polygamma... |
<filename>code_experiments/select_valid_range.py
from scipy import misc
import os
import fnmatch
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage
from scipy import signal
from tqdm import tqdm
import pickle
# %matplotlib inline
##############################################################... |
<reponame>webclinic017/qf-lib<filename>qf_lib/common/utils/returns/beta_and_alpha.py
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
<filename>bayesian_privacy_accountant.py
#!/usr/bin/env python3
# Author: <NAME>
# Date: 12 August 2020
import itertools
import numpy as np
import scipy as sp
import torch
import warnings
from scipy.stats import t, binom
from scipy.special import logsumexp
from scaled_renyi import scaled_renyi_gaussian
class... |
<reponame>GirZ0n/Methods-of-Computation
from enum import Enum
from sympy.parsing.sympy_parser import (
convert_xor,
function_exponentiation,
implicit_application,
implicit_multiplication,
split_symbols,
standard_transformations,
)
TRANSFORMATIONS = standard_transformations + (
split_symbol... |
<reponame>jessestewart1/nrn-rrn
import calendar
import geopandas as gpd
import logging
import networkx as nx
import numpy as np
import pandas as pd
import pyproj
import shapely.ops
import string
import sys
from collections import Counter, defaultdict
from datetime import datetime
from itertools import chain, combinatio... |
<reponame>zisluiz/FCN.tensorflow<filename>evaluation.py
import tensorflow as tf
import numpy as np
import scipy.misc as misc
import os
def _transform(filename, __channels):
image_options = {'resize': True, 'resize_size': 224}
image = misc.imread(filename, flatten=False if __channels else True, mode='RGB' if __... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import pandas as pd
import numpy as np
from scipy import stats
import csv
import matplotlib.pyplot as plt
import matplotlib.path as path
import seaborn as sns
import tkinter as tk
from tkinter import ttk
from sklearn.model_sele... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Main module."""
import xarray as xr
import numpy as np
from scipy import signal
from functools import partial
# Wrap it into a simple function
def season_mean(ds, calendar='standard'):
# Make a DataArray of season/year groups
year_season = xr.DataArray(ds.time... |
<gh_stars>10-100
import osqp
import numpy as np
import scipy as sp
import scipy.sparse as sparse
import time
# Discrete time model of the system (mass point with input force and friction)
# Constants #
Ts = 0.2 # sampling time (s)
M = 2 # mass (Kg)
b = 0.3 # friction coefficient (N*s/m)
Ad = sparse.csc_matrix([
... |
from functools import wraps
from pathlib import Path
from typing import Union
import numpy as np
from spikeextractors.extraction_tools import cast_start_end_frame
from tqdm import tqdm
try:
import h5py
HAVE_H5 = True
except ImportError:
HAVE_H5 = False
try:
import scipy.io as spio
HAVE_Scipy = ... |
"""
thouless_anderson_palmer.py
---------------------
Reconstruction of graphs using a Thouless-Anderson-Palmer
mean field approximation
author: <NAME>
email: <EMAIL>
submitted as part of the 2019 NetSI Collabathon
"""
from .base import BaseReconstructor
import numpy as np
import networkx as nx
import scipy as sp
from... |
# Mostly based on the code written by <NAME>:
# https://github.com/mrharicot/monodepth/blob/master/utils/evaluation_utils.py
import numpy as np
import torch.utils.data as data
from path import Path
from scipy.misc import imresize, imread
from tqdm import tqdm
import random
class pose_framework_KITTI(data.Data... |
<filename>HW1/gibbs_sampling/gibbs_samplers.py
import numpy as np
import scipy.stats as st
import matplotlib.pyplot as plt
from gibbs_sampling.sampling_functions import *
from gibbs_sampling.initialization import *
def log_joint(data, theta_s, z_s, beta_mean_s, beta_sigma_s, theta_p, beta_mean_p, beta_sigma_p):
t... |
"""Based on:
https://github.com/mbinkowski/MMD-GAN/blob/678bb5e2d5f7b0bb8dd5c3591d7759e1bb3f8018/gan/compute_scores.py
BSD 3-Clause License
Copyright (c) 2016, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following condit... |
"""
===========================================================================
Modelize the static and dynamic behaviour ok an orienteering compass in the
Earth magnetic field
Every parameters are in international system units, angles in radians
=========================================================================... |
'''
A set of classes that implement analytical responses to
simple systems (mainly used in testing the discrete cases).
'''
from __future__ import division, unicode_literals, print_function, absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import object
import warnin... |
from __future__ import print_function
import nltk
import random
#from nltk.corpus import movie_reviews
from nltk.classify.scikitlearn import SklearnClassifier
import pickle
from sklearn.naive_bayes import MultinomialNB, BernoulliNB
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.svm impo... |
# -*- coding: utf-8 -*-
"""'Current Source Density analysis (CSD) is a class of methods of analysis of
extracellular electric potentials recorded at multiple sites leading to
estimates of current sources generating the measured potentials. It is usually
applied to low-frequency part of the potential (called the Local F... |
<gh_stars>0
import scipy.stats as ss
def compute_ranking_correlation(pseudotime1, pseudotime2):
kt = ss.kendalltau(pseudotime1, pseudotime2)
weighted_kt = ss.weightedtau(pseudotime1, pseudotime2)
sr = ss.spearmanr(pseudotime1, pseudotime2)
return {"kendall": kt, "weighted_kendall": weighted_kt, "spear... |
<reponame>CHuanSite/Dutl
import numpy as np
from scipy.spatial import distance_matrix
def probDistance(x, sigma_est = True):
'''
Embed data into probabilistic distance matrix
'''
x = np.array(x)
if sigma_est == True:
sigma = np.mean(np.std(x, 0))
else:
sigma = 1
dist = dis... |
<filename>app.py
# app.py
import json
import joblib
import os
import numpy as np
import pandas as pd
from flask import Flask, request, send_file
from pathlib import Path
from scipy.spatial import distance
from sklearn.tree import export_text
app = Flask(__name__)
with open(os.path.join('models', 'ansible', 'metadata... |
from __future__ import print_function, division, absolute_import
import numpy as np
from scipy import optimize as sciopt
from Bio import Phylo
from treetime import config as ttconf
from treetime import MissingDataError,UnknownMethodError,NotReadyError
from .utils import tree_layout
from .clock_tree import ClockTree
re... |
import pandas as pd
import numpy as np
from scipy.stats import chisquare
class QuestionDependence:
"""
Checks if there is any association between single/multiple choice
questions in a survey. Uses chi square test for independence.
Parameters
----------
path : str
Path to a csv file co... |
<filename>pymc3_hmm/utils.py<gh_stars>0
from typing import Any, Callable, Dict, List, Optional, Sequence, Text, Tuple, Union
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import theano.tensor as tt
from matplotlib import cm
from matplotlib.axes import Axes
from matplotlib.colors import Colorma... |
##Here we plot distributrions of how many individuals were correct for each states.
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import gaussian_kde
pal = sns.diverging_palette(10, 220, sep=80, n=5,l=40,center='light')
pal2 = sns.diverging_palette(10, 220, sep=80, n=5,l=40,... |
<reponame>Childhoo/Chen_Matcher
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy
from scipy.spatial.distance import cdist
from numpy.linalg import inv
from scipy.linalg import schur, sqrtm
import torch
from torch.autograd import Variable
##########numpy
def invSqrt(a,b,c):
eps = 1e... |
from termcolor import colored as color
import statistics
import math
from scipy import stats
import matplotlib.pyplot as plt
import pylab
def getStats (samble_means):
variance = statistics.variance(samble_means)
mean = statistics.mean(samble_means)
stdev = statistics.stdev(samble_means)
confidence = ... |
<gh_stars>10-100
import numpy as np
import scipy as scp
from numpy import pi
def calculate_exvolume_redfactor():
"""
Calculates DEER background reduction factor alpha(d)
See
Kattnig et al
J.Phys. Chem. B, 117, 16542 (2013)
https://doi.org/10.1021/jp408338q
The background reduct... |
########################################################################
# Required packages
########################################################################
import argparse
import sys
import os
import pandas as pd
import numpy as np
from tqdm.auto import tqdm
import tomotopy as tp
from pyteomics import mgf, au... |
<filename>eye_blink_detector_dlib4.py<gh_stars>0
import os,sys
import cv2
import dlib
from imutils import face_utils
from scipy.spatial import distance
cap = cv2.VideoCapture(0)
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_alt2.xml')
face_parts_detector = dlib.shape_predictor('shape_predictor_... |
<reponame>sn6uv/sympy
from basic import S
from expr import Expr
from evalf import EvalfMixin
from sympify import _sympify
from sympy.logic.boolalg import Boolean
__all__ = (
'Rel', 'Eq', 'Ne', 'Lt', 'Le', 'Gt', 'Ge',
'Relational', 'Equality', 'Unequality', 'StrictLessThan', 'LessThan',
'StrictGreaterThan', 'Greate... |
<gh_stars>0
import os
import pickle
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
import tqdm
from tqdm import tqdm
from scipy.spatial import distance
#self sim
def get_self_sim(word, data):
dat = [x[1] for x in data if x[0][1] == word]
count = 0
... |
<reponame>watsonjj/CHECLabPySB<filename>sstcam_sandbox/d191118_pedestal_temperature/extract_residuals_interp.py
from sstcam_sandbox import get_data, get_checs
from CHECLabPy.core.io import HDF5Writer
from TargetCalibSB.pedestal import PedestalTargetCalib
from TargetCalibSB.stats import OnlineStats, OnlineHist
from CHEC... |
#!/usr/bin/env python
from __future__ import division
import numpy as np
import scipy.special as scsp
import argparse
import asetk.format.cp2k as cp2k
import asetk.format.cube as cube
import asetk.atomistic.constants as constants
import asetk.util.progressbar as progressbar
import os.path
# Define command line parser
... |
<filename>quantecon/lss.py
"""
Filename: lss.py
Reference: https://lectures.quantecon.org/py/linear_models.html
Computes quantities associated with the Gaussian linear state space model.
"""
from textwrap import dedent
import numpy as np
from numpy.random import multivariate_normal
from scipy.linalg import solve
from... |
from cc3d.core.PySteppables import *
from cc3d import CompuCellSetup
from cc3d.core.SteeringParam import SteeringParam
import scipy.integrate
import numpy
class VolumeSteeringSteppable(SteppableBasePy):
def __init__(self, frequency=10):
SteppableBasePy.__init__(self, frequency)
def add_steering_panel... |
<reponame>hebatallah/LCILP
import argparse
import os
import numpy as np
from scipy.stats import rankdata
def get_ranks(scores):
'''
Given scores of head/tail substituted triplets, return ranks of each triplet.
Assumes a fixed number of negative samples (50)
'''
ranks = []
for i in range(len(s... |
################################################################################
# Copyright (C) 2014 <NAME>
#
# This file is licensed under the MIT License.
################################################################################
"""
Module for the multinomial distribution node.
"""
import numpy as np
from ... |
import argparse
import numpy as np
from scipy.optimize import minimize
from OCBO.cstrats.profile_cts import ContinuousMultiTaskTS, CMTSPM, ProfileEI
from OCBO.cstrats import copts
from dragonfly.utils.option_handler import load_options
from OCBO.util.misc_util import uniform_draw
def black_box_function_1(vec):
... |
<reponame>SK-tklab/RandomFourierFeatures<filename>RFM.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import cholesky, cho_solve
import seaborn as sns
sns.set_style('darkgrid')
class GP:
def __init__(self, x_train: np.ndarray, y_train: np.ndarray, noise_var: float = 1., lscale: float = 1.... |
<reponame>Sujit-O/gemben<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import scipy.io as sio
import scipy.sparse... |
import glob, h5py, os, subprocess
import numpy as np
from scipy.ndimage import imread
from hangul_analysis.utils import resize
from hangul_analysis.label_mapping import int2imf
from hangul_analysis.fontslist import fonts_with_imf
from hangul_analysis.cropping import load_crops500
def txt2png(base_path, font_file, f... |
from fractions import Fraction as frac
def subtract_matricies(m, n):
"""
1 2 1 0 0 2
3 4 - 1 2 = 2 2
5 6 4 2 1 4
"""
row_count = len(m)
return [[m[row][col] - n[row][col] for col in range(row_count)] for row in range(row_count)]
def multiply_matricies(m, n)... |
<gh_stars>0
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
def detect_timestep(data):
"""
Get the time steps present in the loaded data
"""
same_trace = data.shift(-1).trace_id == data.trace_id
dts = data.shift(-1).time - data.time
dts[~same_trace] = np.nan
... |
<reponame>IRPIhydrology/sm2rain
"""Module to compute and calibrate sm2rain."""
import numpy as np
from scipy.optimize import minimize
np.seterr(invalid='ignore')
# handle the case when numba is not available
try:
from numba import jit
_numba_available = True
except ImportError:
_numba_available = False
t... |
import numpy as np
import scipy.signal as sps
def filter_sigma_clip(x, y, nsigma=3, window_length=49, polyorder=3):
""" Sigma clip a light curve using a Savitzky-Golay filter.
Args:
x (array): The x-data array.
y (array): The y-data array.
nsigma (Optional[float]): The number of sigma... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 30 18:05:41 2020
@author: badat
"""
import torch
import torchvision
import torch.nn as nn
import torch.optim as optim
from torchvision import transforms
from torch.utils.data import Dataset, DataLoader
import torchvision.models.resnet as models
from PIL import Image
impo... |
__author__ = '<NAME>'
from unittest import TestCase
import os
from nose.tools import raises
import numpy as np
from scipy.integrate import odeint
import numba
from ..symbolic import make_jit_model
from test_utils import simple_model
from test_utils.jittable_model import model as unjitted_model
from test_utils.sens_j... |
import os
import numpy as np
from scipy.spatial.transform import Rotation as R
def read_kitti_calibration_file(file_path):
calib = dict()
with open(file_path, 'r') as f:
for line in f:
if len(line) < 5:
continue
key, val = line.rstrip().split(': ')
... |
<reponame>stewartadam/netl3d<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Takes system microphone input (no parameters) or an audio file (with parameter)
and performs frequency analysis on the samples read.
"""
import audiotools
import numpy
import pyaudio
import pygame
import scipy
import spectra
im... |
"""Test RESS."""
import matplotlib.pyplot as plt
import numpy as np
import pytest
import scipy.signal as ss
from scipy.linalg import pinv
from meegkit import ress
from meegkit.utils import fold, matmul3d, rms, snr_spectrum, unfold
def create_data(n_times, n_chans=10, n_trials=20, freq=12, sfreq=250,
n... |
<filename>sd/plotlib.py
#!/usr/bin/env python
"""plot_lib.py: module is dedicated to plot and create the movies."""
__author__ = "<NAME>."
__copyright__ = "Copyright 2020, SuperDARN@VT"
__credits__ = []
__license__ = "MIT"
__version__ = "1.0."
__maintainer__ = "<NAME>."
__email__ = "<EMAIL>"
__status__ = "Research"
... |
<filename>examples/matlab_data.py
# See also http://www.scipy.org/Cookbook/Reading_mat_files
import numpy as np
import scipy.io
# For old-style Matlab (up to 7.1) files you can use scipy.io
R = np.random.rand(100)
data = {
'R': R,
'test': 123,
}
scipy.io.savemat('test.mat', data)
data = scipy.io.loadmat('te... |
<filename>dm_control/locomotion/arenas/bowl.py
# Copyright 2020 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
2017-9-7
<Statistical Analysis with Missing Data>
Problems 1.6
Page 23
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
N = 100
np.random.seed(0)
z = np.random.randn(N,4)
#(1)
a = 0 # 0 , 2 , 0
b = 2 # 0 , 0 , 2
y = np.zeros((N,... |
<filename>postprocessing/partner_annotations/luigi_pipeline_spec_dir/find_partners_luigi_generators.py<gh_stars>0
from __future__ import print_function
import luigi
import z5py
import os
import numpy as np
import numpy.ma as ma
import scipy.ndimage
import itertools
import cremi
from cc_luigi import ConnectedComponents
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.