text string |
|---|
#!/usr/bin/evn python3
'''
CNN experiments
'''
import logging
import numpy as np
import torch
from scipy.stats import kendalltau
from sklearn.metrics import accuracy_score, recall_score
from torch.nn import MSELoss, NLLLoss
from torch.optim import SGD, Adam
from omsignal.experiments import OmExperiment
from omsignal.... |
<reponame>NunoEdgarGFlowHub/pyzx
# PyZX - Python library for quantum circuit rewriting
# and optimization using the ZX-calculus
# Copyright (C) 2018 - <NAME> and <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
import sys
import numpy as np
import scipy.interpolate as interp
import scipy.signal as signal
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import torsion_noise as tn
alldata = np.load('/spinsim_data/alldata_Vxy100Vrotchirp_1kHz.npy')
# alldata = np.load('./data/test_efield_out.npy')
# Ti... |
"""
rotsesim.pecvel
This code runs a simulation that adds
random peculiar velocities to a simulated galaxy sample,
then finds H0 using a linear fit, attempting to mitigate
the effects of peculiar motion.
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.odr import *
#- Define necessary functions for ... |
<gh_stars>10-100
#emacs, this is -*-Python-*- mode
"""
There are several ways we want to acquire data:
A) From live cameras (for indefinite periods).
B) From full-frame .fmf files (of known length).
C) From small-frame .ufmf files (of unknown length).
D) From a live image generator (for indefinite periods).
E) From ... |
#from __future__ import print_function
import os
import time
import warnings
from math import tan, atan
from PIL import Image
from PIL import ImageFilter
from PIL.ImageChops import difference
import numpy as np
import yaml
from scipy import stats
from . import utils
TOP = 'top'
BOTTOM = 'bottom'
def percent_error(e... |
<gh_stars>0
#
import os
import sys
from typing import Union, Optional, Tuple, List, Dict
import math
import re
from warnings import warn
import itertools as it
import pickle
import logging
import numpy as np
import scipy.stats as stats
from scipy.linalg import block_diag
import torch
from torch.utils.data import Datas... |
# -*- coding:Utf-8 -*-
#####################################################################
#This file is part of RGPA.
#Foobar is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, ... |
<reponame>mbernste/spatialcorr<gh_stars>0
"""
Functions for creating plots visualizing spatial correlation patterns.
Authors: <NAME> <<EMAIL>>
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np
import math
from collections import defaultdict
import se... |
<filename>software/nnet/isbi/Antipasti/Antipasti/netarchs.py<gh_stars>10-100
from Antipasti import netutils
__author__ = "nasimrahaman"
''' Network architectures built on Netkit '''
import numpy as np
import scipy.spatial.distance as ssd
import theano as th
import theano.tensor as T
import netkit as nk
import netrai... |
<gh_stars>1-10
#!/usr/local/epd/bin/python
#------------------------------------------------------------------------------------------------------
# Dirac propagator based on:
# Fillion-Gourdeau, <NAME>, <NAME>, <NAME>.
# Numerical Solution of the Time-Dependent Dirac Equation in Coordinate Space without Fermion-Dou... |
"""This script defines the parametric 3d face model for Deep3DFaceRecon_pytorch
"""
import numpy as np, torch, torch.nn.functional as F, os
from scipy.io import loadmat
from util.load_mats import transferBFM09
# add for visualization ()
from utils_mesh import MeshOperator
import open3d as op3d
def perspective_project... |
<filename>multianalysis.py<gh_stars>0
from collections import namedtuple
import numpy as np
from numpy.random import default_rng
import pandas as pd
import scipy.spatial.distance as dist
import scipy.cluster.hierarchy as hier
import scipy.stats as stats
from sklearn.decomposition import PCA
import sklearn.cluster as s... |
import tensorflow as tf
import scipy
import numpy as np
import scipy.io as spio
# DATA_DIR = '/data/SBDD_Release/dataset/'
DATA_DIR = None
if DATA_DIR is None:
raise Exception('DATA_DIR is not set')
weight_decay = 5e-4
def get_input(input_file, batch_size, im_size=224):
input = DATA_DIR + input_file
file... |
<reponame>hackl/PyKrige<filename>pykrige/core.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
__doc__ = """
PyKrige
=======
Code by <NAME> and the PyKrige Developers
<EMAIL>
Summary
-------
Methods used by multipl... |
"""
Plot first-order element coefficients as a function of lambda.
"""
import matplotlib.pyplot as plt
#plt.rcParams["text.usetex"] = True
#plt.rcParams["text.latex.preamble"] = [r"\usepackage{amsmath}"]
import matplotlib.colors as cm
import numpy as np
import os
from scipy import optimize as op
from matplotlib.tic... |
<reponame>khetan2/sagemaker-scikit-learn-extension
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.am... |
<filename>thermo_deriv/fe_fitting.py<gh_stars>0
# free energy fitting - how do we want to do this?
# compute the free energy of removing a single lennard jones particle out of a 2D box
# (and we do this at varying lambda windows)
# can we optimize an MD engine using the thermodynamic gradient?
import jax
from jax.... |
<filename>app/streamflow/regional/box_huc.py
import matplotlib.pyplot as plt
from hydroDL.post import axplot, figplot
import scipy
from hydroDL.data import dbBasin
from hydroDL.master import basinFull
import os
import pandas as pd
from hydroDL import kPath, utils
import importlib
import time
import numpy as np
from hyd... |
<gh_stars>1-10
"""
This module contains implementations of algorithms for time series
analysis. These algorithms include:
1. Spectral estimation: calculate the spectra of time-series and cross-spectra
between time-series.
:func:`get_spectra`, :func:`get_spectra_bi`, :func:`periodogram`,
:func:`periodogram_csd`, :func... |
import gc, os, sys, string, re, pdb, scipy.stats
import Mapping2, getNewer1000GSNPAnnotations, Bowtie, binom, GetCNVAnnotations
TABLE=string.maketrans('ACGTacgt', 'TGCAtgca')
USAGE="%s mindepth snpfile readfiletmplt maptmplt bindingsites cnvfile outfile logfile ksfile"
def reverseComplement(seq):
tmp=seq[::-1]
... |
# -*- coding: utf-8 -*-
"""
Part of the MACAW project.
Contains the library_maker, the library_evolver functions, the hit_finder,
and the hit_finder_grad functions.
@author: <NAME>, 2021
"""
import numpy as np
from operator import itemgetter
from queue import PriorityQueue
from rdkit import Chem
import re
from scipy.... |
<reponame>mattkjames7/MHDWaveHarmonics<filename>MHDWaveHarmonics/PlotPoloidalHarmonics.py
import numpy as np
import matplotlib.pyplot as plt
from .GetFieldLine import GetFieldLine
from .FindHarmonics import FindHarmonics
from .SolveWave import SolveWave
from scipy.interpolate import InterpolatedUnivariateSpline,interp1... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Set of functions that can be useful
<NAME>
MeteoSwiss/EPFL
<EMAIL>
December 2019
"""
# Global imports
import datetime
import io
import os
from collections import OrderedDict
import numpy as np
from scipy.stats import energy_distance
from dateutil import parser
import... |
<reponame>swagat5147/wallgen<filename>tools/points.py
import warnings
import numpy as np
from scipy.spatial import Delaunay
from skimage.filters import sobel
from skimage import color, img_as_ubyte
from PIL import Image, ImageDraw, ImageFilter
def distance(p1, p2):
(x1, y1) = p1
(x2, y2) = p2
d = int((y2-y1)**2 +... |
<reponame>adgaudio/ietk-ret<filename>ietk/methods/sharpen_img.py
import cv2.ximgproc
import numpy as np
from matplotlib import pyplot as plt
import scipy.ndimage as ndi
import logging
from ietk.data import IDRiD
from ietk import util
log = logging.getLogger(__name__)
def check_and_fix_nan(A, replacement_img):
n... |
import torch
from saliency.saliency import Saliency
import numpy as np
from scipy.ndimage import label
import torchvision
from torch.autograd import Variable
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import to... |
<filename>tests/tests.py
import dynamo as dyn
import numpy as np
import scipy.io
from scipy import optimize
# def VecFnc(
# input,
# n=4,
# a1=10.0,
# a2=10.0,
# Kdxx=4,
# Kdyx=4,
# Kdyy=4,
# Kdxy=4,
# b1=10.0,
# b2=10.0,
# k1=1.0,
# k2=1.0,
# c1=0,
# ):
# x, y ... |
from sklearn.cluster import AgglomerativeClustering
import pandas as pd
import numpy as np
from zoobot import label_metadata, schemas
from sklearn.metrics import confusion_matrix, precision_recall_fscore_support
from scipy.optimize import linear_sum_assignment as linear_assignment
import time
def findChoice(frac):
... |
import discord
from discord.ext import commands
from PIL import Image
import requests
import numpy
import scipy
import scipy.misc
import scipy.cluster
from .converter import GuildConverter, ExtensionConverter
from . import utils
import io
import traceback
from collections import deque
import asyncio
import speedtest
im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# StimulusFrontEnd.py
# Copyright (c) 2018, <NAME>, <NAME>, <NAME>, <NAME>
#
# This file is part of ASR-Setup.
#
# ASR-Setup is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free ... |
<gh_stars>0
'''
Created on Jun 4, 2014
@author: Max
'''
import numpy as np
import amo.core.physicalconstants
import amo.core.utilities
import scipy.linalg
from scipy.optimize import brentq
import matplotlib.pylab as plt
pc = amo.core.physicalconstants.PhysicalConstantsSI
class Trap1D(object):
def __init__(self, ... |
<filename>python/gui/mapdisplay.py
##########################################################################
#
# Copyright 2007-2019 by <NAME>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Softwa... |
#!/usr/bin/env python
import sys
import numpy as np
import matplotlib.ticker as ticker
import scipy.spatial.distance as spd
import scipy.cluster.hierarchy as sph
from scipy import stats
import matplotlib
#matplotlib.use('Agg')
import pylab
import pandas as pd
from matplotlib.patches import Rectangle
from mpl_toolkits... |
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
This library defines a DynamicLogit class, which is used as a statistical
workbench to evaluate single-agent choice models in which the utility is
dynamic (in the fashion of Rust 1987).
"""
import numpy as np
import scipy.optimize as opt
import pandas as pd
from matplotlib i... |
from __future__ import print_function
import os
import os.path as op
from nose.tools import assert_true, assert_raises
from nose.plugins.skip import SkipTest
import numpy as np
from numpy.testing import assert_array_equal, assert_allclose, assert_equal
import warnings
from mne.datasets import sample
from mne import (... |
<reponame>binfen/FBDD
"""
@author: <NAME>
"""
import numpy as np
import copy
from math import sqrt
from scipy import stats
from sklearn import preprocessing,metrics
def rmse(y,f):
"""
Task: To compute root mean squared error (RMSE)
Input: y Vector with original labels (pKd [M])
f... |
<gh_stars>0
from fractions import Fraction
from functools import lru_cache
from math import sqrt, prod, log2, ceil, floor, log
from typing import Tuple, Optional, List, Union
from rfb_mc.component.eamp.eamp_edge_scheduler_base import EampEdgeSchedulerBase
from rfb_mc.component.eamp.primes import get_lowest_prime_above_... |
<filename>python/classifier/atyp_train_classifier.py
import numpy as np
import datetime as dt
import pickle as pkl
from matplotlib import pyplot as plt
import seaborn as sbn
import pandas as pd
import sys
import keras
from keras.models import Sequential, load_model
from keras.layers import Dense, Dropout, Flatten, Res... |
<filename>analysis/comparison_models/log_growth.py
####
# Read in LSHTM results and perform inference on
####
import matplotlib
matplotlib.use('Agg')
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import norm
from scipy.special import expit
from sys import... |
<gh_stars>1000+
# Copyright (c) 2012 - 2014, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
from scipy import stats, special
from ..core.parameterization import Param
from ..core.parameterization.transformations import Logexp
from . import link_functions
f... |
<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 7 23:31:43 2017
@author: wd
"""
import numpy as np
import gym
from gym import utils
from gym import spaces
import h5py
import tensorflow as tf
import random
import scipy.misc
class NDEnv(gym.Env):
# ===============================... |
<filename>mri-2d-resnet18-cam-norm.py
"""
Class Activation Map for ResNet-18 with 2D Tensor of MRI slices.
Normalize the response over small subset of patches from all classes.
author: <NAME>
email: <EMAIL>
date: 10-03-2019
"""
import torch
from torch import nn
import matplotlib.pyplot as plt
from matplotlib.pyplot i... |
<reponame>KOLANICH/hyper-engine
#! /usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maxim'
import math
from scipy import stats
from .nodes import *
def wrap(node, transform):
if transform is not None:
return MergeNode(transform, node)
return node
def uniform(start=0.0, end=1.0, transform=None, nam... |
<reponame>mikulatomas/fcapsy
"""Basic level
Belohlavek, Radim, and <NAME>.
Basic level of concepts in formal concept analysis 1: formalization and utilization.
International Journal of General Systems 49.7 (2020): 689-706.
"""
import typing
import statistics
import concepts.lattices
__all__ = ["basic_level_avg", "b... |
#!/usr/local/bin/python3
#
from numpy import *
import matplotlib
import matplotlib.pyplot as plt
import os
#from scipy.interpolate import spline Python 2
from scipy import interpolate
#
# ----------------------------------------------------------------------------
# -------------------------------------------------... |
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import ShuffleSplit
from datetime import datetime
from sklearn.preprocessing import FunctionTransformer
import scipy.io as sio
datasets = ['bugzilla', 'columba', 'jdt', 'mozilla', 'platform', 'postgres']
key ... |
import numpy as np
from scipy.linalg import hilbert,lu
n = 10
H = hilbert(10)
#------------------------Q1-----------------------------
L = np.array([[0. for i in range(n)] for i in range(n)])
for i in range(0,n):
L[i][i] = 1.
U = np.array([[0. for i in range(0,n)] for i in range(n)])
for i in range(0,n):
for j i... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 20 10:51:04 2019
@author: <NAME>
"""
import numpy as np
import scipy.io as scio
from WassersteinChangePointDetectionLib import *
from DataSetParameters import *
from ChangePointMetrics import *
import sys, os
import warnings
if __name__ == '__main__':
... |
<reponame>fameshpatel/olfactorybulb<gh_stars>1-10
import os
import sys
import numpy
import numpy.random as rnd
from scipy.spatial.distance import euclidean
class CreateHyperAndMinicolumns(object):
def __init__(self, param_dict):
self.params = param_dict
self.folder_name = self.params['folder_name... |
<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 <NAME>
# 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... |
<filename>tests/mxnet/test_specialization.py
import os
os.environ['DGLBACKEND'] = 'mxnet'
import mxnet as mx
from mxnet import autograd
import scipy as sp
import numpy as np
import dgl
import dgl.function as fn
D = 5
mx.random.seed(1)
np.random.seed(1)
def generate_graph(n):
arr = (sp.sparse.random(n, n, density... |
import sympy
import catamount
from catamount.tensors.tensor_shape import Dimension
from catamount.api import utils
# A set of helper functions for easy Flop calculations in tests
# Build symbol table for verifying Catamount Flops calculations
symbol_table = {}
subs_table = {}
correct_alg_flops = 0
def add_symbols(n... |
"""
Harmony perception by periodicity detection
<NAME>
Journal Of Mathematics And Music Vol. 9 , Iss. 3,2015
"""
import math
import numpy as np
np.warnings.filterwarnings('ignore')
from scipy.stats import hmean
from fractions import Fraction
# tuning 2
numerator = np.asarray([1, 16, 9, 6, 5, 4, 7, 3, 8, 5, 9, 15, 2])... |
<gh_stars>100-1000
#/usr/bin/python
# -*- coding: utf-8 -*-
"""
.. currentmodule:: pylayers.antprop.radionode
.. autosummary::
:members:
"""
from __future__ import print_function
import doctest
import os
import glob
import os
import sys
import doctest
import numpy as np
if sys.version_info.major==2:
import C... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 11 17:38:04 2029
Go through confusion matrix creating pie charts of
True Positive, False Positive (with a near miss component) and False Negative forecasts.
I hope these get called Tobechukwu plots, following Stigler’s Law.
Tobechukwu is a gender-ne... |
from sklearn.utils import resample
from itertools import chain
import random
import numpy as np
import os
import math
from skfeature.function.statistical_based import CFS
from sklearn.feature_selection import SelectKBest, SelectPercentile
from sklearn.feature_selection import chi2, f_classif
from sklearn.ensemble imp... |
from collections import namedtuple
import scipy.io as sio
import numpy as np
import cv2
import math
import json
# Defining a 2D point class
Point = namedtuple("Point", ["x", "y"])
def check_overlap(l1, r1, l2, r2):
"""
Check the overlap between two points
"""
# If one rectangle is on left side of ot... |
<gh_stars>10-100
import sys
sys.path.append('rchol/')
import numpy as np
from scipy.sparse import identity
from numpy.linalg import norm
from rchol import *
from util import *
# Initial problem: 3D-Poisson
n = 20
A = laplace_3d(n) # see ./rchol/util.py
# random RHS
N = A.shape[0]
b = np.random.rand(N)
print("Initia... |
<reponame>Testing4AI/DeepJudge
import numpy as np
import scipy.stats
from tensorflow.keras.models import Model
import tensorflow.keras.backend as K
DIGISTS = 4
def Rob(model, advx, advy):
""" Robustness (empirical)
args:
model: suspect model
advx: black-box test cases (adversarial examples)... |
<gh_stars>1-10
import json
import statistics as stat
import numpy as np
import pandas as pd
import csv as csv
import matplotlib.pyplot as mpl
import os
from tqdm import tqdm
import networkx as nx
from collections import defaultdict, Counter
import pickle
pwd = "/home/srivbane/shared/caringbridge/data/projects/sna-soci... |
import torch
import numpy as np
import scipy.sparse as sp
from sklearn.datasets import make_blobs, make_moons
from scipy.stats import norm as normal
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from sklearn.metrics import roc_auc_score
from sklearn.neighbors import kneighbors_graph
f... |
"""Tests for dense recursive polynomials' arithmetics. """
from sympy.polys.densebasic import (
dup_normal,
dmp_normal,
)
from sympy.polys.densearith import (
dup_add_term,
dmp_add_term,
dup_sub_term,
dmp_sub_term,
dup_mul_term,
dmp_mul_term,
dup_add_ground,
dmp_add_ground,
... |
<filename>chainer/functions/math/sparse_matmul.py
import numpy
import chainer
from chainer import backend
from chainer.backends import cuda
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
try:
from scipy import sparse
_scipy_available = True
except ImportError:... |
<gh_stars>10-100
import numpy as np
from numpy.fft import fft, ifft
from scipy import signal as spsig
"""
Fourier filter
"""
def fft_filter(ydata, window_function=None, cutoff=[50, 690], sample_rate=None):
"""
Fourier filter implementation.
Takes signal data in the frequency domain, ... |
<reponame>xxks-kkk/Code-for-blog
# models.py
from nerdata import *
from utils import *
import numpy as np
from sys import maxint
import sys
import time
import os
from scipy.misc import logsumexp
# Scoring function for sequence models based on conditional probabilities.
# Scores are provided for three potentials in ... |
<gh_stars>10-100
import cmath
import math
from unittest import TestCase
from cate.util.safe import get_safe_globals, safe_eval
class SafeTest(TestCase):
def test_get_safe_globals(self):
globals = get_safe_globals()
self.assertIsNotNone(globals)
self.assertEqual(globals.get('min'), min)
... |
<gh_stars>1-10
import numpy as np
from scipy.integrate import odeint
def glucose_insulin_model(
t,
meal_t,
meal_q,
Vp=3,
Vi=11,
Vg=10,
E=0.2,
tp=6,
ti=100,
td=12,
k=1 / 120,
Rm=209,
a1=6.6,
C1=300,
C2=144,
C3=100,
C4=80,
C5=... |
<filename>p20.py
# back testing
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm, preprocessing
import pandas as pd
from matplotlib import style
import statistics
style.use("ggplot")
FEATURES = [
'DE Ratio',
'Trailing P/E',
'Price/Sales',
'Price/Book',
'Profit Margin',
'Operatin... |
import utils
from os import path
import numpy as np
from scipy import stats, sparse
from paris_cluster import ParisClusterer
from sklearn.linear_model import LogisticRegression
from tqdm import tqdm
##Set a random seed to make it reproducible!
np.random.seed(utils.getSeed())
#load up data:
x, y = utils.load_feature_a... |
# -*- coding: utf-8 -*-
"""
Created on Thu May 26 22:22:48 2022
@author: Noah
"""
import numpy as np
import matplotlib.pyplot as plt
import yfinance as yf
import statsmodels.api as sm
import scipy.stats as sps
#specifying the maximum power of 2
power = 10
#rolling sample lenght
n = 2**power
ticker = "^GSPC"
start =... |
<reponame>thoughtworks/antiviral-peptide-predictions-using-gan<filename>src/models/leakGAN_mol_loss/Discriminator.py
import torch
from scipy.stats import truncnorm
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
#A truncated distribution has its domain (the x-values) restricted to a certain ra... |
#!/usr/bin/env python3
# this will catch exceptions and send them to sentry
import os
import json
import sentry_sdk
import socket
from sentry_sdk import capture_message, capture_exception
SENTRY_URL = os.environ.get("SENTRY_URL")
if SENTRY_URL is not None:
print("Exceptions in Sentry")
sentry_sdk.init(SENTRY... |
"""
Various tool functions used throughout the package.
Author: <NAME>
Date: 2/7/2017
"""
__all__ = ['dirac1D', 'diracND', 'grad_inner_prod_Legendre', 'gradgrad_inner_prod_Legendre', 'inverse_transform_sampling']
import numpy as np
import scipy.stats as st
from scipy import interpolate
def dirac1D(a,b):
"""
... |
<gh_stars>10-100
# Copyright (c) 2014, Salesforce.com, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this l... |
<filename>comptools/data_functions.py
from __future__ import division
import numpy as np
from scipy import stats
def get_summation_error(errors):
sum_error = np.sqrt(np.sum([err**2 for err in errors]))
return sum_error
def get_difference_error(errors):
diff_error = np.sqrt(np.sum([err**2 for err in err... |
<reponame>globusgenomics/galaxy
""" Benchmark functions for fftpack.pseudo_diffs module
"""
from __future__ import division, print_function, absolute_import
import sys
from numpy import arange, sin, cos, pi, exp, tanh, sign
from numpy.testing import *
from scipy.fftpack import diff, fft, ifft, tilbert, hilbert, shi... |
<gh_stars>10-100
from __future__ import print_function
import numpy as np
from scipy.integrate import simps
import math
def cross_validation(y, configpara, results):
"""
select the tuning parameters with validation
"""
P1 = configpara.P1
P2 = configpara.P2
P3 = configpara.P3
P4 = configp... |
<reponame>apoyezzhayev/CIHP_PGN<gh_stars>0
from __future__ import print_function
import argparse
import click
import cv2
import os
from os import path as osp
import scipy.io as sio
import scipy.misc
import sys
import time
from datetime import datetime
from glob import glob
from utils.utils import resize_image
from ut... |
import matplotlib.pyplot as plt
import cPickle as pickle
from scipy import stats
user_data = pickle.load(file('ppw.userdata.pickle'))
right_border = 1414058500
left_border = 1345889500
left_posts_per_month = []
right_posts_per_month = []
left = 0
right = 0
plt.figure(0)
for user in user_data:
weeks = sorted(u... |
<filename>lab2/eEstimate.py
import numpy as np
import scipy
import math
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from scipy.signal import fftconvolve as conv2
def eEstimateAll(Ig, Jg, Jgdx, Jgdy, lp2D):
diff = Ig-Jg
ex = np.multiply(diff,Jgdx)
ey = np.multiply(diff,Jgdy)
ex = ... |
<gh_stars>0
import copy
import functools
import numpy as np
import pandas as pd
import warnings
from scipy.stats import uniform
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import make_scorer
from sklearn.model_selection import RandomizedSearchCV, GridSearchCV, train_test_split
from xgboost ... |
import numpy as np
import time, os, math, operator, statistics, sys
from random import Random
import torch
import torch.utils.data
import torchvision
import pdb
import torch.nn.functional as F
class UncertaintyDatasetSampler(torch.utils.data.sampler.Sampler):
"""Samples elements randomly from a given list ... |
#! /usr/bin/env python
"""
Module with frame px resampling/rescaling functions.
"""
__author__ = '<NAME>, <NAME>, <NAME>'
__all__ = ['frame_px_resampling',
'cube_px_resampling',
'cube_rescaling_wavelengths',
'frame_rescaling',
'check_scal_vector',
'find_scal_vecto... |
"""
Code to process a dataframe into X_test for ML deployment
"""
# import packages
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.model_selection import train_test_split, KFold
from nltk.stem.snowball i... |
import argparse
import scipy
import os
import numpy as np
import json
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import transforms
from scipy import ndimage
from tqdm import tqdm
from math import ceil
from glob import glob
from PIL import Image
import dataloaders
import models
f... |
<filename>windMongoTools/mgWsdUP.py
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 28 10:55:10 2014
@author: space_000
"""
from scipy.io import loadmat
from WindPy import w
import pymongo as mg
#%%
def upiter(Data=[[]],Codes=[],Times=[],Fields='',col=None):
if Fields=='open':
Fields='o'
elif Fields=='... |
<filename>openquake.hazardlib/openquake/hazardlib/gsim/kanno_2006.py
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2012-2016 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as publi... |
import statistics
class ZipCode:
def __init__(self, sale, data):
#Initialize list of sale object with one sale object. Then appends to list.
self.sales = [sale]
self.zipCode = sale.zipCode
self.data = data
self.long = self.data.lng
self.lat = self.data.lat
def append(self, sale):
... |
from pathlib import Path
import torch
import numpy as np
import argparse
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from mpl_toolkits.mplot3d import Axes3D # https://stackoverflow.com/a/56222305
from scipy.spatial.transform import Rotation as R
from post.plots import get_figa
from mvn.mini ... |
import argparse
import os
from ast import literal_eval
from statistics import mean
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sb
import numpy as np
def evaluate_mut_info(_dir, path, _figure_name):
full_path = os.path.join(path, _dir)
files = [os.path.join(root, file) for root, _, f... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 31 12:14:22 2017
@author: <NAME>
"""
#read data
"""
root_dir
---index_file
---train
---label
---info
read_all_data
we do not need info data when train the network
"""
import os
import scipy
import numpy as np
from random import... |
from random import sample
import statistics
import datetime
from src.storage.table import Table as Table
'''
variables:
data = the data of the tempResult
fieldNames = names of fields of the data
'''
class TempResult():
'''
args:
data = a list of json objects, json keys would be table field name
'''
def ... |
from . import GeneExpressionDataset
import numpy as np
import os
from scipy.interpolate import interp1d
import pandas as pd
import torch.distributions as distributions
batch_lfc = distributions.Normal(loc=0.0, scale=0.25)
class SignedGamma:
def __init__(self, dim, proba_pos=0.75, shape=2, rate=4):
self.... |
<filename>scripts/read_rloc.py
#!/usr/bin/env python
import sys, pdb
import sqlalchemy as sa
from sqlalchemy.orm import Session
from sqlalchemy.ext.declarative import declarative_base
#from pisces.io.trace import read_waveform
from obspy.core import UTCDateTime
from obspy.core import trace
from obspy.core import Stre... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 15 12:05:40 2016
@author: sjjoo
"""
#%%
import sys
import mne
import matplotlib.pyplot as plt
import imageio
from mne.utils import run_subprocess, logger
import os
from os import path as op
import copy
import shutil
import numpy as np
from numpy.random impo... |
import numpy as np
import sympy
import combinatorics
from multiindex import multiindex
import bases
class jet(object):
"""Truncated Taylor's series.
The jet is represented in both a closed and expanded form. The closed form is ``fun``:math:`=\\sum_{0\\leq deg \\leq k}` ``fun_deg[deg]`` where ``fun_deg[deg]=c... |
from __future__ import division
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import os
import sys
from scipy import stats
p, fr, _lw, w, fs, sz = 2, 0.75, 0.5, 1, 4, 3
mydir = os.path.expanduser('~/GitHub/residence-time')
tools = os.path.expanduser(mydir + "/tools")
df = pd.read_csv(mydir +... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import UnivariateSpline, interp1d
from scipy.integrate import quad
import collections
from imripy import halo
from imripy import merger_system as ms
from imripy import inspiral
from imripy import waveform
inspiral.Classic.ln_Lambda=3.
def Meff... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.