text string |
|---|
<gh_stars>1-10
from sympy.core.numbers import RealNumber
from ..syms import syms
import numpy as np
from sklearn.linear_model.base import LinearRegression
from ..sym_predict import register_sym_predict
def sym_predict_linear(estimator):
if hasattr(estimator, 'intercept_'):
expression = RealNumber(estimator... |
from qibo import gates
from qibo.models import Circuit
import numpy as np
from scipy.special import binom as binomial
import argparse
from qibo.models import Grover
def set_ancillas_to_num(ancillas, num):
"""Set a quantum register to a specific number.
"""
ind = 0
for i in reversed(bin(num)[2:]):
... |
<reponame>kunjiefan/MVGCNiSL
import numpy as np
import pandas as pd
from scipy import stats
import networkx as nx
import matplotlib.pyplot as plt
import os, random
import pickle, json,itertools
import torch
from torch_geometric.data import Data
from torch_geometric.utils import train_test_split_edges
from torch_geometr... |
#!/usr/bin/env python
import numpy as np
import pandas as pd
import os
import shutil
import pickle
import glob
import importlib
import argparse
import scipy.io as sio
from tqdm import tqdm
from padaczka.common import data_sequences
from sklearn.preprocessing import StandardScaler
description = """
Framework for fe... |
from __future__ import print_function
import os
import numpy as np
from scipy.misc import imresize
from scipy.ndimage import imread
from pepper.framework.sensor.face_detect import OpenFace
def add_friend_from_directory(directory, name, max_size=1024):
# type: (str, str, int) -> None
openface = OpenFace()
... |
<reponame>thorstenkranz/eegpy<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Module for plotting topography-maps and connectivity-diagrams
on a schematic head surface.
"""
__docformat__ = "restructuredtext"
#################
# Module-Import #
#################
#eegpy-modules
import eegpy
from eegpy... |
<reponame>RSchwan/evanqp
import warnings
import cvxpy as cp
import numpy as np
import scipy.sparse as sp
from gurobipy import GRB, LinExpr, Model
from tqdm import trange
from evanqp import Box
from evanqp.layers import BoundArithmetic, BaseLayer, ConstLayer, InputLayer
from evanqp.zonotope import Zonotope
class QPLa... |
<reponame>epiproject/FaST-LMM-HPC
import numpy as np
import scipy as sp
import logging
import unittest
import os.path
import time
import sys
import doctest
import pandas as pd
from fastlmmhpc.association import snp_set
import fastlmmhpc.pyplink.plink as plink
from fastlmmhpc.feature_selection.test import TestFeatureSe... |
<filename>excursion/active_learning/approximations.py
from scipy.linalg import cho_solve
from scipy.stats import norm
import gpytorch
import torch
import numpy as np
torch.cuda.set_device(0)
def h_normal_gpytorch(s):
""" Entropy of a normal distribution """
return torch.log(s * (2 * np.e * np.pi) ** 0.5)
d... |
<reponame>Emad-W/CarND-Behavioral-Cloning-P3
from scipy import ndimage
import csv
import cv2
import numpy as np
import os
import math
samples = []
path = '../data/Behavioral_Clonning/'
csv_file = path + 'driving_log.csv'
with open(csv_file, 'r') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
... |
# MIT License
#
# Copyright (c) 2018-2019 <NAME> / Retrieva, Inc.
#
# 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, co... |
<gh_stars>10-100
import os
import numpy
import osr
from osgeo import gdal
from scipy import misc
import rasterio
folder_path=r"C:\Users\sbarron\Desktop\Test\Output\Newfolder"
#Part 1: Convert NoData values to -9999 in order to solve patching issue later on.
#Need to run first part of script for each individual file.
... |
<gh_stars>0
import datetime
import time
import itertools
import warnings
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as tick
import requests
import librato
import statsmodels.api as sm
import statsmodels.formula.api as smf
import statsmodels.tsa.api as smt
import scipy.stats as scs
impo... |
import os
import sys
import itertools
import threading
from concurrent.futures import ThreadPoolExecutor
from src.python.preprocess2 import *
from blast import *
from tempfile import gettempdir
tmp_dir = gettempdir()
out_dir = "./Data"
from scipy.stats import *
import pickle
NUM_CPU = 8
eps = 10e-6
E = Threa... |
import numpy as np
from scipy.stats import loguniform
class example_prior:
"""
This example class defines an example prior class to handle both evaluations and
sampling of the prior. This samples a slope (a), an intercept (b) and the standard-deviation (sigma) of
the data.
"""
def sample(sel... |
#!/usr/bin/env python3
import argparse
import mcb185
from statistics import mean, median
# Write a program that computes statistics about a fasta file
# Number of sequences
# Total length
# Minimum and maximum lengths
# Average and median lengths
# N50 length
# Use argparse
# Make useful functions and add t... |
<filename>sympy/utilities/tmpfiles.py<gh_stars>0
from sympy.utilities.exceptions import SymPyDeprecationWarning
SymPyDeprecationWarning(
feature="Import sympy.utilities.tmpfiles",
useinstead="Import from sympy.testing.tmpfiles",
issue=18095,
deprecated_since_version="1.6",
).warn()
from sympy.testing.... |
<reponame>odeo47/collider-simulator
"""
Pi-0 data collection and analysis
"""
import pickle
from pathlib import Path
import collipy as cp
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
@cp.function_timer
def collect():
alpha = 1
particle = 'pi-0'
momentum =... |
<reponame>vreshniak/exemplar-feature-inpainting<filename>examples/example_2/script.py
from pathlib import Path
from skimage.exposure import rescale_intensity
from skimage.color import grey2rgb, rgb2grey
from skimage.io import imread, imsave
from skimage.util import montage, pad
from skimage.transform ... |
<reponame>jackmo375/Clustering
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
from scipy.cluster import hierarchy
from graphviz import Graph
import pygraphviz as pgv
import matplotlib.ticker as mtick
from matplotlib import rcParams
rcParams['axes.linewidth'] = 2.5 # set the value globally
rc... |
# discretization.py
#
# This file is part of scqubits: a Python package for superconducting qubits,
# arXiv:2107.08552 (2021). https://arxiv.org/abs/2107.08552
#
# Copyright (c) 2019 and later, <NAME> and <NAME>
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# ... |
<gh_stars>1-10
import numpy as np
import scipy as sc
from scipy import special
import numexpr as ne
from sklearn.linear_model import Ridge
from sklearn.preprocessing import PolynomialFeatures
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from matplotlib.colors import ListedColormap
from matplo... |
<gh_stars>0
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" Testing fmri utils
"""
from __future__ import absolute_import, division, print_function
import re
import numpy as np
import sympy
from sympy import Symbol, Dummy, Function, DiracDelta
fr... |
# -*- coding: utf-8 -*-
"""
"""
from __future__ import division, print_function, unicode_literals
import sympy
import phasor.math.dispatch_sympy
print("Sympy version: ", sympy.__version__)
#this makes the notebook sexy
sympy.init_printing(use_latex=True)
from IPython.display import (
display,
display_pretty,... |
import numpy as np
from scipy.sparse import lil_matrix
from scipy import stats, linalg
from joblib import Parallel, delayed
from joblib import load, dump
import tempfile
import shutil
import os
import warnings
from ..spm_dep import spm
from ..processing import knee
warnings.filterwarnings("ignore")
def wgr_rshrf_esti... |
"""
The MIT License (MIT)
Copyright (c) 2018 <NAME>
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import itertools as it
import numpy as np
import scipy as scp
import logging
import torch
from torch.utils.data.sampler import... |
# File that graph the particles for the 'particle_tracker' tool
import copy
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure, show
import matplotlib.ticker as ticker
import numpy
import os
from scipy import spatial
import sys
import pdb
sys.path.insert(0,'..')
import constants as c
#colors = {'Pr... |
<reponame>molgor/FIA-django<filename>sampling_scenarios.py<gh_stars>0
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Forest Inventory Analysis Program Sampling scenarios
====================================================
.. This module creates several DataFrames using the FIA database.
"""
from __future__ import... |
#%%
import os
cwd = os.getcwd()
dir_path = os.path.dirname(os.path.realpath(__file__))
os.chdir(dir_path)
import argparse
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
import torchvision.utils
import numpy as np
i... |
"""
Functions for Evaluation of Inter-Instrument Transformation Coefficients
"""
import numpy as np
import scipy.optimize as optim
import chmap.data.corrections.lbcc.lbcc_utils as lbcc_funcs
import chmap.utilities.datatypes.datatypes as psi_d_types
def optim_iit_linear(hist_ref, hist_fit, bin_edges, init_pars=np.asar... |
#!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(description="Measure statistics across multiple chains.")
parser.add_argument("--draws", type=int, default=0, help="In addition to plotting the mean GP, plot several draws of the GP to show the scatter in predicitions.")
args = parser.parse_args()... |
<gh_stars>1-10
from Scripts.utilities import start_correct_cluster, read_dataset, save_dataset, parse_args
from feature_extraction_utilities import dict_path, temp_output_path, dataset_path, preproc_dict_path
import dask
import dask.dataframe as dd
from dask.distributed import get_worker
import numpy as np
import pand... |
from app import app
from pymongo import MongoClient
from datetime import datetime
from flask import request
from flask import render_template
import scipy.spatial as sp
import numpy as np
import heapq
import json
import ast
from bson import json_util
import time
client = MongoClient()
db = client.test
def cosine_sim(s... |
from __future__ import division
import sys
import os
import numpy as np
import matplotlib.pyplot as plt
from math import ceil
from statistics import mode
from statsmodels.distributions.empirical_distribution import ECDF
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree i... |
<reponame>nishimoto/py_r_stats
#!/usr/bin/env python
import sys
import scipy
import scipy.stats as st
print(f"Scipy {scipy.__version__}")
# => 1.4.1
group1 = [0.7, -1.6, -0.2, -1.2, -0.1, 3.4, 3.7, 0.8, 0.0, 2.0]
group2 = [1.9, 0.8, 1.1, 0.1, -0.1, 4.4, 5.5, 1.6, 4.6, 3.4]
p_value_manh = st.mannwhitneyu(group1, group... |
import numpy as np
import statsmodels.api as sm
import scipy.stats as stats
import scipy.linalg as linalg
import matplotlib.pyplot as plt
from scipy.optimize import minimize
from scipy.stats import norm
def regular_test(yn,xn,nobs,compute_llr,hist=False):
llr, omega = compute_llr(yn,xn)
test_stat = llr/(omeg... |
<reponame>sandflow/imscHRM
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2021, Pearl TV LLC
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above co... |
#!/usr/bin/env python
# @Authors: <NAME>, <NAME>, <NAME>, <NAME>
# @Emails: <EMAIL>, <EMAIL>, <EMAIL>, <EMAIL>
#
# 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/licen... |
<gh_stars>100-1000
'''
A testing suite for ICA. This will run some Python code to build the data, then calls the ICA
testing script that contains BIDMach commands, then comes back to this Python code to plot the data.
This code should be in the BIDMach/scripts folder.
(c) February 2015 by <NAME>
'''
import matplotlib... |
<gh_stars>10-100
from imagepy.core.engine import Filter
from scipy.ndimage import gaussian_filter
class Invert(Filter):
title = 'Invert Demo'
note = ['all', 'auto_msk', 'auto_snap']
def run(self, ips, snap, img, para = None):
return 255-snap
class Gaussian(Filter):
title = 'Gaussian Demo'
... |
<reponame>usnistgov/sesame
import sesame
import numpy as np
L = 3e-4 # length of the system in the x-direction [cm]
# Mesh
x = np.concatenate((np.linspace(0,1.2e-4, 100, endpoint=False),
np.linspace(1.2e-4, L, 50)))
# Create a system
sys = sesame.Builder(x)
# Dictionary with the material paramet... |
import sys
sys.path.append(".")
import numpy as np
import torch
from torch.autograd import grad
from network import DNN
from scipy.io import loadmat
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
"""
Burgers Eqn.
f = u_t + lambda_1 * u * u_x - lambda_2 * u_xx = 0, x ~ [-1, 1], t... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Ce fichier sert à quantifier les erreurs entre une estimation et une solution de référence.
Une cellule de commandes se situe à la fin.
Contient les fonctions suivantes :
- liste_erreur(estimation, sol)
"""
import schemas_1d, traces, resolution_dim_multiple
import numpy as ... |
<filename>handwritten-character-classification-be/server.py
import os
from flask import Flask, request, render_template, jsonify
from scipy.misc import imsave, imread, imresize
import numpy as np
from keras.models import model_from_yaml
import re
import base64
app = Flask(__name__)
def load_model():
# load YAML ... |
<filename>openquake.hazardlib/openquake/hazardlib/gsim/douglas_stochastic_2013.py
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2016 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public Lic... |
<filename>sfg2d/models.py
"""Fitting Models to Fit data with."""
import numpy as np
from scipy.integrate import odeint
from scipy.special import erf, erfc
from scipy.stats import norm, skewnorm
from iminuit import Minuit, describe
import sys
import yaml
import logging
from .utils.static import sfgn
thismodule = sys.mo... |
# -*- coding: utf-8 -*-
"""Tests the star module."""
import pytest
import logging
from math import isclose
from statistics import mean
import csv
from tin import formats
log = logging.getLogger(__name__)
class TestStar:
def test_pointlocation(self, obj_base):
infile = obj_base / '37fz2_9.obj'
... |
# -*- coding: utf-8 -*-
"""
Author
------
<NAME>
Email
-----
<EMAIL>
Created on
----------
- Fri Jun 15 15:37:00 2016
Modifications
-------------
- Fri Jun 15 15:37:00 2016 re-format code
Aims
----
- to pre-process spectra in order to meet the needs of STARLIGHT
old comments
------------
How many places shoul... |
<filename>reactors.py
#!/usr/bin/env python
"""This script defines functions to chemical reactors. It uses source terms
provided by Cantera package.
@author = <NAME>
@contact = <EMAIL>
@data = September, 2012, rev.: June, 2013 (adapted to use cython Cantera)
"""
#=====================================================... |
"""
GrIML ice marginal lake (IML) data compiling module
@author: <NAME>
"""
import geopandas as gpd
import pandas as pd
from scipy.sparse.csgraph import connected_components
def assignNames(gdf, gdf_names, distance=500.0):
'''Assign placenames to geodataframe geometries based on names in another
geodatafra... |
import h5py
import sys
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
data = h5py.File(sys.argv[1], "r")
audio = data['audio'].value
for i in range(36):
plt.subplot(6,6,i+1)
f, t, Sxx = signal.spectrogram(audio[i,:], 44100, nperseg=256,noverlap=255)
plt.pcolormesh(t, f, Sxx... |
import numpy as np
import torch
import torch.nn.functional as F
from enum import Enum
import numpy as np
import math
from scipy.special import comb
from itertools import permutations, combinations, product
from collections import defaultdict
from operator import itemgetter
from src.utils.hilbert_math import make_bas... |
import numpy as np
from scipy.linalg import solve, eig
import mayavi.mlab as mlab
from project4d import *
from helpers import *
from itertools import combinations, permutations
path = "./bb_nodes_per_iteration_S3_bunnyFull.csv"
qs, tetras, props = LoadNodesPerIteration(path)
show = False
q = np.array([0.707107, 0.381... |
<filename>mosfit/modules/parameters/gaussian.py
"""Definitions for the `Gaussian` class."""
import numpy as np
from scipy.special import erfinv
from mosfit.modules.parameters.parameter import Parameter
# Important: Only define one ``Module`` class per file.
class Gaussian(Parameter):
"""Parameter with Gaussian... |
<reponame>woblob/Crystal_Symmetry<gh_stars>0
import matrices_new_extended as mne
import numpy as np
import sympy as sp
from equality_check import Point
x, y, z = sp.symbols("x y z")
Point.base_point = np.array([x, y, z, 1])
class Test_Axis_hex_m_x0z:
def test_matrix_hex_m_x0z(self):
expected = Point([ x... |
#!/usr/bin/env python
import numpy as np
from functools import partial
from scipy import optimize
from scipy.special import expit
def sigmoid_function(samples):
# return 1/(1 + np.exp(-samples))
return expit(samples)
def sigmoid_gradient(samples):
return sigmoid_function(samples)*(1.0-sigmoid_function(s... |
from sympy.physics.quantum.gate import H, X, Y, Z, CNOT, SWAP, CGateS
from sympy.physics.quantum.gate import IdentityGate as _I
from sympy.physics.quantum.gate import UGate as U
from sympy.physics.quantum.qubit import Qubit
from sympy.physics.quantum.qapply import qapply as sympy_qapply
from quantpy.sympy.qapply impor... |
<gh_stars>1-10
import os
from skimage import measure
import scipy.ndimage
import numpy as np
from PIL import Image
import nibabel as nib
import pdb, traceback, sys
import argparse
def create_body_mask(in_file_path, out_mask_path, out_image_path, env_intensity):
test_image_path = in_file_path
print('Creating b... |
import numpy as np
from scipy.misc import comb
import math
from fractions import Fraction
""" calculate the p value according to
https://en.wikipedia.org/wiki/McNemar%27s_test """
def cal_pvalue(c00, c11, c01, c10):
"""
c00: int, argeed number on positive
c01, c10: int, disagreed number
c11: int, ag... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 10 11:30:34 2022
@author: mahom
"""
import torch
import scipy as sp
def predictive_variance_white(Variances,W,Var_ErrorNMF,VarNMF):
# Variacnces: Ntest x K
# W: F x K
# StdNMF: F x 1
# Var_ErrorNMF: F
Ntest = Variances.size(0)
... |
# Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code mus... |
<reponame>MilkshakeForReal/manim
import numpy as np
from manimlib.imports import *
from scipy.spatial.distance import cdist
c_rng = (-3,3)
r_rng = (0.2,1)
n = 40
def generate_balls(n=n, c_rng = c_rng , r_rng=r_rng):
cs = np.random.uniform(c_rng[0],c_rng[1],(n,3))
cs[:,2:]=0
rs = np.random.uniform(r_rng[0]... |
import os
import sys
import numpy as np
import pandas as pd
from scipy import sparse
from tensorflow import keras
class ContentVaeDataGenerator(keras.utils.Sequence):
'''
Generate the training and validation data
for the content part of vae model.
'''
def __init__(self,
... |
import shutil
import unittest
import networkx as nx
import numpy as np
from scipy import sparse
import fastnode2vec
class TestCalc(unittest.TestCase):
def setUp(self):
self.G = nx.karate_club_graph()
self.A = nx.adjacency_matrix(self.G)
def test_node2vec(self):
model = fastnode2vec.... |
from math import sqrt
from numpy import array, zeros, fill_diagonal, cross, dot
from numpy.linalg import norm
from pymatgen import Element
from ase.data import atomic_numbers, covalent_radii
from itertools import combinations
from scipy.spatial import KDTree
from scipy.sparse.csgraph import connected_components ... |
<reponame>chenkaisun/MMLI1
"""This file is comprised of basic UDFs that may be useful in Project Outcome.
There are a couple possible input types for each function:
1. molecules (the raw sdf file, opened to be iterated upon)
2. atom list (the atoms that each molecule of the sdf is comprised of, which can be represente... |
<gh_stars>1-10
import urllib2
import cStringIO
import os
import scipy.io as sio
import glob
import tempfile
import shutil
import zipfile
from collections import namedtuple
# Container for bounding box
from menpo.shape import PointCloud
BoundingBox = namedtuple('BoundingBox', ['detector', 'groundtruth'])
# Where the b... |
import pandas as pd
import tia.bbg.datamgr as dm
import numpy as np
import sys
from datetime import date
import time
import math
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib.backends.backend_pdf import PdfPages
from sklearn.decomposition import PCA
import seaborn as sns
sns.se... |
<filename>straindesign/gurobi_interface.py
from scipy import sparse
from numpy import nan, inf, isinf, sum, array
import gurobipy as gp
from gurobipy import GRB as grb
from straindesign.names import *
from typing import Tuple, List
# Collection of Gurobi-related functions that facilitate the creation
# of Gurobi-objec... |
<gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import cholesky, cho_solve
import seaborn as sns
plt.rcParams['font.size'] = 11
sns.set_style('darkgrid')
class GP:
def __init__(self, x_train: np.ndarray, y_train: np.ndarray, noise_var: float = 1., lscale: float = 1.,
... |
<filename>pax/plugins/peak_processing/ClassifyPeaks.py
from pax import plugin, units
from scipy import interpolate
class AdHocClassification1T(plugin.TransformPlugin):
def startup(self):
self.s1_rise_time_bound = interpolate.interp1d([0, 5, 10, 100],
... |
<reponame>thoughteer/edera
import pytest
from sympy.logic import boolalg as sympyboolalg
import edera.condition
from edera import Condition
from edera import ConditionWrapper
class AlwaysTrue(Condition):
def check(self):
return True
@property
def name(self):
return "AlwaysTrue"
class... |
<gh_stars>10-100
"""
Pre-processing for mb_graph_batch.py of double oriented membranes from a lumen labeled segmentation
Input: - STAR file with 3 columns:
+ _rlnMicrographName: tomogram original (denisity map)
+ _psSegImage: labelled tomogram with the segmentations
... |
<filename>ProjectNetworkAwareness/NetFlowParser/Analyser.py<gh_stars>1-10
from pymongo import MongoClient
from netaddr import *
import sys,os, argparse
from progressbar import *
from statistics import variance, mean
sys.path.insert(0, os.path.abspath('..'))
from Utils.Constants import Constants
from Utils.Utils impor... |
<reponame>mdrolet01/scikit-fda
import scipy.linalg
import numpy as np
from ..._utils import _same_domain
from ._basis import Basis
class VectorValued(Basis):
r"""Vector-valued basis.
Basis for vector-valued functions constructed from scalar-valued bases.
For each dimension in the codomain, it uses a s... |
<gh_stars>1000+
import math
import unittest
import numpy
import pytest
import cupy
from cupy import testing
import cupyx.scipy.stats # NOQA
from cupyx.scipy import stats
from cupyx.scipy.stats import distributions
try:
import scipy.stats # NOQA
except ImportError:
pass
@testing.gpu
class TestEntropyBasic... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 05 14:05:24 2013
Aug 15 2020: add brunnermunzel, rank_compare_2indep
Author: <NAME>
"""
from statsmodels.compat.python import lzip
import numpy as np
from numpy.testing import (assert_allclose, assert_almost_equal,
assert_approx_equal, assert_)... |
"""
From Berryman 1980
"""
import numpy as np
from scipy.optimize import fsolve
def theta(alpha):
return alpha * (np.arccos(alpha) - alpha * np.sqrt(1.0 - alpha * alpha)) / (1.0 - alpha * alpha) ** (3.0 / 2.0)
def f(alpha, theta):
return alpha * alpha * (3.0 * theta - 2.0) / (1.0 - alpha * alpha)
def PQ(... |
'''
A collection of Distribution classes for the Continuous No Regret Problem.
@author: <NAME>, <NAME>
@date: Oct 24, 2014
'''
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import cm
from scipy.stats import multivariate_normal
from scipy.linalg import inv
class Distribution(object):
... |
<gh_stars>1-10
import numpy as np
import pandas as pd
import os
import utils_sickle_stats as utils
import nbinom_fit
import matplotlib.pyplot as plt
import seaborn as sns
import scipy
logger = utils.logger
sns.set()
def main(args):
logger.info('==================================')
logger.info('INTERARRIVAL ... |
"""
File: harmonic_context_track.py
Purpose: Defines a list container for harmonic context indexed by position.
Note: HarmonicContext positions are continually reset when the track is built. The position of the first HC
will be 0.
"""
from fractions import Fraction
from harmoniccontext.harmonic_context impo... |
<gh_stars>1-10
#!/usr/bin/python3
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import statistics
"""
Last edited by : Shawn
Last edited time : 25/11/2021
Version Status: dev
TO DO: Verify correctness
"""
class new_Node:
def __init__(self, json_object):
self.id = json_object['i... |
<filename>evaluation.py
import numpy as np
from scipy.stats import entropy
from collections import defaultdict
def replace_zeros(data):
"""
Replace all zeros with very small values.
"""
new_value = 0.0000000001
new_data = []
for value in data:
if value>0:
new_data.append(val... |
# Copyright 2019 ETH Zürich, <NAME>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer... |
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Author: <NAME>
# Copyright © 2020 <NAME>
# -------------------------------------------------------------------
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from scipy.fftpack import dct
def cm2inch... |
<reponame>eshanking/fears-figures
import numpy as np
from numpy.ma.core import get_data
import scipy
from seascapes_figures.utils import dir_manager, results_manager
import matplotlib.pyplot as plt
import os
class Fitness:
def __init__(self):
return
def gen_fitness_curves(self,pop=None,conc=None)... |
<reponame>liujiyuan13/MvDOCC-code
import numpy as np
import scipy.io as scio
import scipy.sparse as scsp
import h5py as hp
from torch.utils.data import Dataset, DataLoader
import torchvision.transforms as transforms
from tqdm import tqdm
import torch
from models.encoder_decoder import fc_autoencoder
from torch.nn impor... |
<gh_stars>1-10
import numpy as np
import itertools
import re
import zlib
from scipy.ndimage.measurements import label
from collections import defaultdict
import scipy.ndimage as ndimage
from scipy.spatial.distance import directed_hausdorff
def identity(x):
return x
def sigmoid(x):
return 2.0 / (1.0 + np.exp... |
# This module offers two Cursors:
# * DataCursor,
# where you have to click the data point, and
# * FollowDotCursor,
# where the bubble is always on the point
# nearest to your pointer.
#
# All the code was copied from
# http://stackoverflow.com/a/13306887
# DataCursor Example
# x=[1,2,3,4,5]
# y=[... |
<filename>2021/day7/day7.py
import math
import statistics
def part1(positions: list[int]):
median_pos = statistics.median(positions)
fuel = 0
for pos in positions:
fuel += abs(pos - median_pos)
print('Part 1:', int(fuel))
def part2(positions: list[int]):
mean_pos = math.floor(statistics.... |
<filename>code/estimator.py
from sklearn.linear_model import LogisticRegression, LinearRegression, Ridge, SGDRegressor
from sklearn.naive_bayes import BernoulliNB
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, GradientBoostingRegressor
from sklearn.svm import SVC, SVR, LinearSVC
from sklearn.... |
import numpy as np
from astropy.coordinates import SkyCoord
#from multiprocessing import Pool
from pathos.multiprocessing import ProcessingPool as Pool
from scipy.interpolate import interp1d
import scipy.integrate as integrate
import wisps
import pandas as pd
import wisps.simulations as wispsim
import pickle
from tqdm... |
<reponame>gauenk/faiss_fork
import torch
import torch.nn.functional as F
import torchvision
import numpy as np
from einops import rearrange,repeat
from nnf_share import getBlockLabelsRaw,loc_index_names,pix2locs,warp_burst_from_pix,warp_burst_from_locs
from align.xforms import align_from_pix
from pyutils import save_... |
from numpy import *
from pylab import *
import scipy.io as sio
mat_content = sio.loadmat('mat-files/example_annulus_speedtest.mat')
zkvals = mat_content['zkvals']
nchvals = mat_content['nchvals']
r1 = 1
r2 = 1.7
nchovals = ceil(nchvals/r1*r2)+1
n = transpose(nchvals + nchovals)*16
tt = mat_content['tt']
llll = ["{:.2... |
import itertools
from collections import Counter
from copy import deepcopy
import ipywidgets as ipw
import nglview
import numpy as np
import scipy.stats
from aiidalab_widgets_base.utils import list_to_string_range
# from ase.neighborlist import NeighborList
from ase import Atoms, neighborlist
from ase.data import cov... |
import pickle
import os
import hull_contour
from hull_contour import *
#from CrossRatio import *
from scipy import misc
#from CrossRadonTransform import *
#from HoughTransform import *
#from ShapeDescriptor import *
#from MatchRaysPairs import *
#from Plotter import *
#from ransac import *
#from LineEstimation import ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 27 10:13:15 2019
@author: orteg
"""
import logging
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.ensemble import IsolationForest, RandomForestClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import LocalOutlierFactor... |
import numpy as np
import numpy.random as npr
import scipy.stats as st
import pylab
def permutation_resampling(case, control, num_samples, statistic):
"""Returns p-value that statistic for case is different
from statistc for control."""
observed_diff = abs(statistic(case) - statistic(control))
num_cas... |
## Maintainer: <NAME> #####
## Contact: <EMAIL> #####
import torch
import os
import cv2
import numpy as np
from sort import *
from scipy.optimize import least_squares
import scipy.io
mot_tracker = Sort(max_age=5, iou_threshold=0.05)
model = torch.hub.load('ultralytics/yolov5', 'custom', path='/home/jingyu/Downl... |
<gh_stars>1-10
import os
import timeit
import numpy as np
import pandas as pd
import seaborn as sn
import matplotlib.pyplot as plt
import nrrd
import scipy.stats as ss
import SimpleITK as stik
import glob
from PIL import Image
from collections import Counter
import skimage.transform as st
from datetime import datetime... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.