text string |
|---|
<gh_stars>10-100
'''
Short Time Fourier Transform (STFT)
WARNING: s1~=s2, why?
XiaoCY 2021-02-22
'''
#%%
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as signal
fs = 1000.0
t = np.arange(0,100,1/fs)
x = signal.chirp(t,0,t[-1],300,method='quadratic')
#%%
nfft = 512
win = signal.hanning(nfft)... |
<reponame>HenryKenlay/DeepRobust
'''
Topology Attack and Defense for Graph Neural Networks: An Optimization Perspective
https://arxiv.org/pdf/1906.04214.pdf
Tensorflow Implementation:
https://github.com/KaidiXu/GCN_ADV_Train
'''
import torch
import torch.multiprocessing as mp
from deeprobust.gr... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # for removing unnecessary warnings
from absl import logging
logging._warn_preinit_stderr = 0
logging.warning('...')
import tensorflow as tf
import numpy as np
import pandas as pd
from scipy import interpolate
from tensorflow import keras
import evidential_de... |
<gh_stars>0
from __future__ import print_function
import numpy as np
import random
from tqdm import tqdm
import os
import math
import cPickle as cp
import scipy.sparse as sp
#import _pickle as cp # python3 compatability
import networkx as nx
from sklearn.preprocessing import OneHotEncoder
from sklearn.model_selection... |
# coding:utf-8
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import scipy.io as sio
from sklearn.cluster import KMeans
import sys
sys.path.append('..')
from helper import kmeans as km
if __name__ == '__main__':
mat = sio.loadmat('data/ex7data2.mat')
data2 = p... |
import numpy as np
try:
from scipy.weave import inline
except ImportError as e:
try:
from weave import inline
except ImportError as e:
pass
functions = r"""
double PI = 3.1415926535;
double sgn(double x){
return (x > 0) - (x < 0);
}
/*
To use this function, you must provide:
* ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 21 15:49:29 2019
@author: gsolana
https://oceanpython.org/2013/02/11/plot-a-ctd-profile/
https://ocefpaf.github.io/python4oceanographers/blog/2013/07/29/python-ctd/
https://matplotlib.org/3.1.1/tutorials/introductory/lifecycle.html#sphx-glr-tutori... |
"""
get alpha channel of a picture and generate the trimap
(trimap 是一个三值图,确定前景为255,确定背景为0,不确定的边缘为128)
"""
import numpy as np
from PIL import Image
from scipy import ndimage
# ndimage.morphology.distance_transform_edt()
def generate_trimap(alpha):
fg = np.array(np.equal(alpha, 255).astype(np.float32))
unknown... |
#!/usr/bin/env python
# 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 conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list... |
import scipy
import scipy.special
import scipy.interpolate
import matplotlib.pyplot as plt
def wind_speeds_from_normal(mu, sigma, number, cutoff, plot=False, normalize=True):
"""
Generates a respresentative sample of wind speeds (and weights) from normal
distribution with mean mu and standard deviation si... |
<filename>main.py
from IPython import embed
import torch
import torch.nn as nn
import torch.nn.functional as F
import pickle
import numpy as np
import torch.utils.data as data
import scipy.sparse as sp
import os
import gc
import configparser
import time
import argparse
from torch.utils.tensorboard import SummaryWriter
... |
<reponame>joedefen/subshop<filename>LibSub/SubFixer.py
#!/usr/bin/env python3
"""
Cleanse/shift SRT files.
"""
# pylint: disable=import-outside-toplevel,too-many-instance-attributes,broad-except,no-else-return
# pylint: disable=too-many-lines,invalid-name,too-many-public-methods,too-many-format-args
# pylint: disable=t... |
<gh_stars>0
# coding: utf-8
import sys
import sqlite3
import math
import numpy as np
import argparse
from scipy.spatial.transform import Rotation as R
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
sys.path.append('../')
from python_scale_ezxr.scale_restoration import umeyama_alignment
fr... |
<reponame>Sparsh-Sharma/SteaPy
import os
import numpy
from numpy import *
import math
from scipy import integrate, linalg
from matplotlib import pyplot
from pylab import *
def compute_tangential_velocity(panels, freestream, gamma, A_source, B_vortex):
"""
Computes the tangential surface velocity.
... |
# import the packages
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import os
import numpy as np
import tensorflow as tf
import sklearn.preprocessing as prep
from tensorflow.examples.tutorials.mnist import input_data
from matplotlib import pyplot as plt
f... |
<reponame>xueyuelei/tracklib
# -*- coding: utf-8 -*-
'''
Extended object tracker
REFERENCE:
[1].
'''
from __future__ import division, absolute_import, print_function
__all__ = ['KochEOFilter', 'FeldmannEOFilter', 'LanEOFilter']
import numpy as np
import scipy.linalg as lg
from .base import EOFilterBase
class Koc... |
"""Methods to smooth tentative prolongation operators"""
__docformat__ = "restructuredtext en"
import numpy
import scipy
from scipy.sparse import csr_matrix, isspmatrix_csr, bsr_matrix, isspmatrix_bsr, spdiags
from pyamg.util.utils import scale_rows, get_diagonal, get_block_diag, UnAmal, \
... |
# -*- coding: utf-8 -*-
"""Common utilities between client and server"""
import os
import sys
import numpy
import multiprocessing
enc_options = {}
try:
import cPickle as pickle
import xmlrpclib
from exceptions import Exception, KeyboardInterrupt
except:
import pickle
import xmlrpc as xmlrpclib
u... |
<filename>util.py
import torch
import numpy as np
from scipy.optimize import linear_sum_assignment
from sklearn.metrics import normalized_mutual_info_score, confusion_matrix
def seed_everything(seed):
np.random.seed(seed)
torch.manual_seed(seed)
if torch.cuda.is_available():
torch.backends.cudnn.d... |
import os
import glob
import cc3d
import numpy as np
from skimage import io, transform
from torch.utils.data import Dataset
from copy import copy
from graphics import Voxelgrid
from graphics.transform import compute_tsdf
import h5py
# from graphics.utils import extract_mesh_marching_cubes
# from graphics.visualizatio... |
# -*- coding: utf-8 -*-
"""
Code for selecting top N models and build stacker on them.
Competition: HomeDepot Search Relevance
Author: <NAME>
Team: Turing test
"""
from config_IgorKostia import *
import os
import pandas as pd
import xgboost as xgb
import csv
import random
import numpy as np
import scipy as sp
import... |
import numpy as np
import scipy.signal, math
from gym.spaces import Box, Discrete
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions.normal import Normal
from torch.distributions.categorical import Categorical
from torch.nn.parameter import Parameter
import pdb, functools
de... |
import numpy as np
import configparser
from typing import Callable
from math import sqrt, pi, gamma
import os
import numbers
from scipy.spatial.transform.rotation import Rotation
import plotly.graph_objs as go
def create_dir(dirname: str):
"""Creates a dictionary if it does not already exist."""
if not os.pat... |
<reponame>Zwitscherle/BioPsyKit
"""Module for generating Activity Counts from raw acceleration signals."""
from typing import Union
import numpy as np
import pandas as pd
from scipy import signal
from biopsykit.utils._types import arr_t
from biopsykit.utils.array_handling import downsample, sanitize_input_nd
from bio... |
<filename>backend/API/pyfiles/calvar.py<gh_stars>0
from pymongo import MongoClient
import pandas as pd
import numpy as np
from arch import arch_model
from scipy.stats import norm
from scipy import random
from datetime import date
import yfinance as yf
import schedule
import time
def job():
client = MongoClient(
... |
# -*- coding: utf-8 -*-
# @Date : 2017/10/25
# @Author : hrwhisper
import numpy as np
from scipy.sparse import csr_matrix
from datetime import datetime
from common_helper import ModelBase, XXToVec
"""
LocationToVec(), WifiToVec3(), TimeToVec()
RandomForestClassifier(class_weight='balanced',n_estimators=400, n_j... |
<filename>src/collect_co_occur_matrix.py
import json
from pathlib import Path
import numpy as np
from scipy import sparse as sp
from tqdm import tqdm
import config as cfg
from utils import ProductEncoder, get_shard_path
def collect_cooccur_matrix(shard_indices, product_encoder):
num_products = product_encoder.n... |
<reponame>amit112amit/oriented-particles-python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 29 13:02:32 2017
Driver file for asphericity calculations
@author: amit
"""
#import sys
#sys.path.insert(0,\
# '/home/amit/GoogleDrive/Research/Code/oriented-particles-python')
import os
... |
<filename>face_functions.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
face recognition defines using dlib with guidance of wuhuikai/FaceSwap
@author: <NAME> and <NAME>
"""
import cv2
import dlib
import numpy as np
from scipy.spatial import Delaunay
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_pred... |
<reponame>Mukeshka/onetwo<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 11 12:53:33 2021
@author: jbarker
"""
import math as m
from numpy import pi
import numpy as np
#import scipy as sp
from scipy import linalg
from numpy.linalg import inv
import re
import Helmert3Dtransform as helmt
import ... |
# -----------------------------------------------------------------------------
# tropter: plot_sparsity.py
# -----------------------------------------------------------------------------
# Copyright (c) 2017 tropter authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file... |
<filename>skylib/sonification/main.py
"""
Implementation of the sonification algorithm
sonify_image(): generate a WAV file from image data.
to_polar(): transform image to radial or circular coordinates.
"""
from __future__ import absolute_import, division, print_function
import os
import wave
from numpy import (
... |
"""
Name: <NAME>
References: Heintzmann, Z. Phys., v228, p489-493, (1969)
Coordinates: Spherical
Symmetry:
- Spherical
- Static
"""
from sympy import diag, sin, symbols
coords = symbols("t r theta phi", real=True)
variables = symbols("A a K", constant=True)
functions = ()
t, r, th, ph = coords
A, a, K = variab... |
<reponame>DengYuelin/baselines-assembly
""" This file defines utility classes and functions for agents. """
import numpy as np
import scipy.ndimage as sp_ndimage
def generate_noise(T, dU, hyperparams):
"""
Generate a T x dU gaussian-distributed noise vector. This will
approximately have mean 0 and varianc... |
<filename>project1/regression_task.py<gh_stars>0
'''
Created on 27. sep. 2018
@author: ljb
The best way to present these confidence intervals is to nail down say the best model.
If you compute the MSE for the different approximations (polynomials), you may find a
behavior like that of fig 5 of Mehta et al, see htt... |
import heapq
import numpy as np
from scipy.spatial import Rectangle
from scipy.spatial.transform import Rotation
from flightsim.world import World
from flightsim import shapes
class OccupancyMap:
def __init__(self, world=World.empty((0, 2, 0, 2, 0, 2)), resolution=(.1, .1, .1), margin=.2):
"""
Th... |
import numpy as np
from scipy.special import rel_entr
from small_text.query_strategies import (
BreakingTies,
EmbeddingBasedQueryStrategy,
LeastConfidence,
RandomSampling,
PredictionEntropy,
SubsamplingQueryStrategy)
def query_strategy_from_str(query_strategy_name, kwargs):
if query_stra... |
import numpy as np
import os
import platform
import pandas as pd
from scipy.interpolate import interp1d
from sklearn.metrics import mean_squared_error, r2_score
import warnings
warnings.filterwarnings("ignore")
import tensorflow as tf
from tensorflow.keras import layers
class PatchEncoder(layers.Layer):
... |
<reponame>yanseim/Vision-Based-Control
import numpy as np
from scipy.spatial.transform import Rotation as Rot
# bcT = np.matrix([[-7.34639719e-01, -6.27919076e-04, 6.78457138e-01, -1.08283672e+00],
# [-6.78432812e-01, 9.19848654e-03, -7.34604865e-01, 1.16241772e+00],
# [-5.77950645e-03, -9.99957496e-01, -7.18357... |
import numpy as np
import scipy
import matplotlib
import pandas as pd
import sklearn
from sklearn.preprocessing import MinMaxScaler
import tensorflow as tf
import keras
import matplotlib.pyplot as plt
from datetime import datetime
from loss_mse import loss_mse_warmup
from custom_generator import batch_generator
#Keras
... |
<gh_stars>0
import Examples.study.paretto_front as front
import Examples.metadata_manager_results as results_manager
import Source.io_util as io
import statistics as stats
import os
if __name__ == "__main__":
dataset = "sota_models_caltech256-32-dev_validation"
# 0) Single DNNs
models = io.read_pickle(os... |
<filename>test/test_lazyarray.py
# encoding: utf-8
"""
Unit tests for ``larray`` class
Copyright <NAME>, <NAME> and <NAME> (CNRS), 2012-2020
"""
from lazyarray import larray, VectorizedIterable, sqrt, partial_shape
import numpy as np
from nose.tools import assert_raises, assert_equal, assert_not_equal
from nose impor... |
<filename>problem2.py<gh_stars>10-100
from backtester.features.feature import Feature
from backtester.trading_system import TradingSystem
from backtester.sample_scripts.feature_prediction_params import FeaturePredictionTradingParams
from backtester.version import updateCheck
import numpy as np
import scipy.stats as st
... |
<filename>moment_freq_prior.py<gh_stars>10-100
"""Frequency prior baseline for single video moment retrieval
Huge thanks to @ModarTensai for a helpful discussion that elucidated the
procedure for the KDE approach.
TODO:
Implement sample with replacement, possibly applying NMS, in between.
Motivation: sample w... |
<reponame>TUD-STKS/PyRCN<gh_stars>10-100
"""
Testing for Extreme Learning Machine module (pyrcn.extreme_learning_machine)
"""
import scipy
import numpy as np
import matplotlib.pyplot as plt
import pytest
from sklearn.utils.extmath import safe_sparse_dot
from pyrcn.base import InputToNode, NodeToNode, BatchIntrinsicP... |
<gh_stars>0
import numpy as np
from typing import List,Union,Tuple
from scipy.fftpack import fft,fftfreq
from scipy.signal import find_peaks
from scipy.stats import binned_statistic
from astropy.convolution import convolve, Box1DKernel
from astropy.stats import LombScargle
from ticle.analysis.pdm import stellingwerf_p... |
# -*- coding: utf-8 -*-
# 张春强
# 《机器学习:软件工程方法与实现》 第6章 特征工程
from sklearn.tree import DecisionTreeClassifier
# max_depth=3,表示进行3次划分构造3层的树结构
def dt_entropy_cut(x, y, max_depth=3, criterion='entropy'): # gini
dt = DecisionTreeClassifier(criterion=criterion, max_depth=max_depth)
dt.fit(x.values.reshape(-1, 1), y)
... |
<filename>Software/Funcionales/histograma.py
import numpy as np
import matplotlib.pyplot as plt
#Estilos disponibles para pyplot:
#['bmh', 'classic', 'dark_background', 'fast', 'fivethirtyeight', 'ggplot',
# 'grayscale', 'seaborn-bright', 'seaborn-colorblind', 'seaborn-dark-palette',
# 'seaborn-dark', 'seaborn-darkgri... |
from scipy.stats import pearsonr, spearmanr
from sklearn.metrics import precision_recall_curve, roc_curve, auc
import pandas as pd
import numpy as np
def pearsonr_cor(pred, label):
""" Return Pearson's correlation between prediction and label
"""
cor, _ = pearsonr(pred, label)
return cor
def spearmanr_... |
<filename>scripts/eval_cityscapes.py
import numpy as np
from PIL import Image
import os, sys
import argparse
from sklearn.metrics import mean_absolute_error as compare_mae
from skimage.measure import compare_psnr
from skimage.measure import compare_ssim
from labels import labels
import scipy, skimage
from scipy.spat... |
import datetime
import os
import argopy
import geopandas as gpd
import numpy as np
import pandas as pd
import xarray as xr
from argopy import DataFetcher as ArgoDataFetcher
from argopy import IndexFetcher as ArgoIndexFetcher
from dmelon.ocean.argo import build_dl, launch_shell
from dmelon.utils import check_folder, fi... |
<reponame>BoxiLi/repeater-cut-off-optimization<gh_stars>1-10
from copy import deepcopy
import logging
import warnings
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.gridspec as gridspec
from scipy.optimize import curve_fit
from optimize_cutoff import (
optimization_tau_wrapper,
CutoffOpt... |
<filename>filterdesigner/tests/test_cheby2.py
import unittest
import filterdesigner.IIRDesign as IIRDesign
import scipy.signal as signal
import numpy as np
class TestCheby2(unittest.TestCase):
def setUp(self):
self.n = 3
self.Rs = 1
self.Ws1 = 0.3
self.Ws2 = [0.25, 0.75]... |
<filename>seqsign/sequence_signature.py
"""
A module for generating sequence signatures for the given two sets of proteins.
"""
from django.conf import settings
#from django.core import exceptions
from alignment.functions import strip_html_tags, get_format_props, prepare_aa_group_preference
Alignment = getattr(__impor... |
<reponame>rproskuryakov/absa<filename>src/metrics.py<gh_stars>0
from abc import ABC
from abc import abstractmethod
import logging
import numpy as np
from scipy.stats import hmean
class BaseMetric(ABC):
name: str
@abstractmethod
def __call__(self, ground_labels, pred_labels, input_mask, *args, **kwargs):... |
<gh_stars>1-10
import pathlib
import string
import time
import progressbar as pb
import statistics as stat
import utils as u
from argparse import ArgumentParser
from collections import namedtuple
from readability import Readability
from readability.exceptions import ReadabilityException
from typeguard import typechecke... |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, Inc.
#
# 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
#
# Unles... |
<filename>utils.py
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.prepro import *
import scipy
import numpy as np
def normalize_img(x, is_random=True):
x = imresize(x, size=[128, 128], interp='bicubic', mode=None)
x = x / (255. / 2.)
x = x - 1.
return x
def normalize_img_noresize(... |
import torch
import torch.nn as nn
from torch.nn import init
import torch.nn.functional as F
import scipy.io as sio
import numpy as np
import os
# Optimization-Inspired Dilated Deep Network for Compressive Sensing of Color Images
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
device = torch.device("cuda:0" if torch.c... |
<gh_stars>100-1000
# Turns a mathematical expression (already RPN turned) to pytorch expression, trains the parameters, and returns the new error, complexity and the new symbolic expression
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functio... |
<filename>tests/io/netcdf/test_write_netcdf.py
#! /usr/bin/env python
"""Unit tests for landlab.io.netcdf module."""
import os
import netCDF4 as nc
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from landlab import RasterModelGrid
from landlab.io.netcdf import NotRasterGridError, write_... |
""" Variational Auto-Encoder Example.
Using a variational auto-encoder to generate digits images from noise.
MNIST handwritten digits are used as training examples.
References:
- Auto-Encoding Variational Bayes The International Conference on Learning
Representations (ICLR), Banff, 2014. <NAME>, <NAME>
- ... |
"""" Loading MIO-TCD database. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from datasets.imdb import imdb
import datasets.ds_utils as ds_utils
import xml.etree.ElementTree as ET
import numpy as np
import scipy.sparse
import scipy.io as sio
... |
<reponame>RobBosman-rwhb/sedea<filename>xes_spectral_decomposition.py
import numpy as np
import matplotlib.pyplot as plt
import scipy.linalg as liny
from numpy.lib.function_base import diff
def load_spectra(filename):
fobj = open(filename,'r')
data = fobj.readlines()
data = [float(i.strip("\n")) for i in... |
<reponame>nicolossus/pylfi
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import copy
from abc import abstractmethod
from multiprocessing import Lock, RLock
import numpy as np
import scipy.stats as stats
from pathos.pools import ProcessPool
from pylfi.utils import (advance_PRNG_state, check_and_set_jobs,
... |
<reponame>ajavadia/qiskit-sdk-py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.... |
<filename>evaluation/MultiEvaluator.py
###############################################################################
# PyDial: Multi-domain Statistical Spoken Dialogue System Software
###############################################################################
#
# Copyright 2015-16 Cambridge University Engineerin... |
"""
Generates plots / figures when run as a script.
Plot files are placed in the :file:`plots` directory.
By default, simply running ``python -m src.plots`` generates **ALL** plots,
which may not be desired. Instead, one can pass a list of plots to generate:
``python -m src.plots plot1 plot2 ...``. The full list of ... |
#!/usr/bin/env python
import os
import json
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from scipy.stats import norm
from itertools import product
import anndata
import numpy as np
import pandas as pd
import scanpy as sc
from scipy.sparse import issparse
from sklearn.metrics import calinski_har... |
# File: genetic.py
# from chapter 3 of _Genetic Algorithms with Python_
#
# Author: <NAME> <<EMAIL>>
# Copyright (c) 2016 <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://... |
import numpy as np
from scipy.stats import tvar, norm
from batchedmoments import BatchedMoments
def test_correctness():
data = norm.rvs(size=1000, random_state=3) # mean = 0.01728433
bm = BatchedMoments(axis=0)(data)
assert np.allclose(tvar(data, ddof=0), bm.variance, equal_nan=True)
|
<reponame>KaiyuYue/mgd
#!/usr/bin/env python
import math
import time
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from scipy.stats import norm
from ortools.linear_solver import pywraplp
from ortools.graph import pywrapgraph
__all__ = [
'MGDistiller',
'get_margin_from... |
<reponame>ravshansk/NKPackage
import numpy as np
from numba import jit,njit
from scipy.stats import norm
from itertools import combinations as comb
###############################################################################
def interaction_matrix(N,K,shape="roll"):
"""Creates an interaction matrix for a given... |
<gh_stars>0
"""-----------------------------------------------------------------------------
initialize.py (Last Updated: 01/16/2020)
The purpose of this script is to finalize the rt-cloud session. Specifically,
here we want to dowload any important files from the cloud back to the console
computer and maybe even del... |
<gh_stars>0
import numpy as np
import torch
import pandas as pd
import torch
from torch import nn
from matplotlib import pyplot as plt
from tqdm import tqdm, trange
import math
import neptune.new as neptune
from .deepcolloid import DeepColloid
import scipy
class Trainer:
def __init__(self,
model: torch.nn.Module... |
<filename>assignment3/kmeans.py<gh_stars>0
import os
from typing import Dict, IO, Union
import numpy as np
from playground import ColorizedLogger, profileit
class KMeansRunner:
logger: ColorizedLogger
funcs: Dict
outputs_file: IO
features_iris: Union[np.ndarray, None]
features_tcga: Union[np.ndar... |
#!/usr/local/sci/bin/python
#***************************************
#11 Jun 2015 KMW - v1
# Takes any gridded field of mnnthly mean sea level pressure
# Can have long/lat/time manually or read in
# Pulls out gridbox closest to Darwin and Tahiti
# Calculates SOI for series
# Saves SOI time series to file
#***********... |
# Copyright 2018 The TensorFlow Probability 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
#
# Unless required by applicable law o... |
<reponame>tkm646/orthogonal-denoising-autoencoder<filename>PyTorch/orthdAE.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np, scipy as sp
import torch
from torch.nn.parameter import Parameter
import scipy.io
import m... |
import math
import csv
import subprocess
import sys
import re
import numpy as np
import scipy.integrate as integrate
import scipy.special as special
import scipy.linalg as linalg
from shutil import copyfile
def load_probe_data(filepath):
data_dict = {}
with open(filepath, "r") as filedata:
lines = file... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_equal, assert_almost_equal
import scipy.signal
from sm2.tsa import wold
# -------------------------------------------------------------------
class TestRoots(object):
def test_invert... |
<reponame>TaliaferroLab/AnalysisScripts
#Fasta1 = 'test sequences' ; Fasta2 = 'background sequences'
#Usage: python kmerenrichment.py -h
#Returns: <kmer> <fastafile1count> <fastafile2count> <enrichment> <pvalue> <bh_adjusted_pvalue>
import operator
import sys
from Bio import SeqIO
from scipy.stats import fisher_exact
... |
from unittest.mock import MagicMock, patch
import os
import pytest
from jumpscale import j
from statistics import Statistics
from zerorobot.template.state import StateCheckError
from JumpscaleZrobot.test.utils import ZrobotBaseTest, mock_decorator
patch("zerorobot.template.decorator.timeout", MagicMock(return_value=... |
<filename>Data_Science_Specialization_IBM/Applied_Data_Science_Specialization_IBM/Data_Analysis_with_Python/week4_model_development/week4_modelDevelopment.py
import pandas as pd
import matplotlib as plt
from matplotlib import pyplot
import numpy as np
import seaborn as sns
from scipy import stats
from sklearn.linear_mo... |
import datetime
import itertools
import json
import logging
import os
import sqlite3
from sqlite3 import DatabaseError
from typing import Optional, List, Dict, Tuple
import networkx as nx
import numpy as np
import pandas as pd
from ipyleaflet import Map, ScaleControl, FullScreenControl, Polyline, Icon, Marker, Circle,... |
# Copyright 2022 The Cirq Developers
#
# 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 ... |
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
import mshr
from dolfin import *
import sympy as sy
import numpy as np
import ExactSol
import MatrixOperations as MO
import CheckPetsc4py as CP
from dolfin import __version__
import MaxwellPrecond as MP
import StokesPrecond as SP
import ti... |
"""
We have a few different kind of Matrices
Matrix, ImmutableMatrix, MatrixExpr
Here we test the extent to which they cooperate
"""
from sympy import symbols
from sympy.matrices import (Matrix, MatrixSymbol, eye, Identity,
ImmutableMatrix)
from sympy.matrices.expressions import MatrixExpr, MatAdd
from sympy.... |
#!/usr/bin/env python3
"""
Simple phase-locked-loop experiment.
https://en.wikipedia.org/wiki/Phase-locked_loop#Time_domain_model
"""
# Dependencies
import numpy as np
from scipy.signal import butter, zpk2ss
from matplotlib import pyplot
# Display configuration
np.set_printoptions(suppress=True)
pyplot.rcParams["axes... |
from __future__ import print_function, unicode_literals, absolute_import, division
import os
import sys
import re
import numpy as np
import numexpr as ne
from .base import BaseValidationTest, TestResult
from .plotting import plt
from astropy.table import Table
from scipy.spatial import distance_matrix
import ot
from nu... |
import numpy as np
import pandas as pd
from scipy.sparse import issparse
from matplotlib.lines import Line2D
from ..tools.moments import (
prepare_data_no_splicing,
prepare_data_has_splicing,
prepare_data_mix_has_splicing,
prepare_data_mix_no_splicing,
)
from ..tools.utils import get_mapper
from .utils ... |
<reponame>iamabhishek0/sympy
from __future__ import print_function, division
from collections import defaultdict
from sympy.core import (sympify, Basic, S, Expr, expand_mul, factor_terms,
Mul, Dummy, igcd, FunctionClass, Add, symbols, Wild, expand)
from sympy.core.cache import cacheit
from sympy.core.compatibilit... |
"""
calculate performance measures
Three perf measures used correspond to those in perf_list in perfMeaure
acc@3: perf_list["acc3"]
tau: perf_list["kendalltau"]
GMR: perf_list["g_mean_pair"]
"""
import numpy as np
import itertools
from scipy.stats.mstats import gmean
import math
from ReadData import rankOrder
NOISE =... |
import pandas as pd
import random
from sentence_transformers import SentenceTransformer
import scipy.spatial
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
questionsdf = pd.read_csv("question-dataset.csv")
topics = questionsdf.topic.unique()
topicsList = topics.tol... |
<filename>preprocessing/sift_elevenPtIP.py
#!/usr/bin/env python
import os,sys
import subprocess
import json
import numpy as np
from json_tricks.np import dump, dumps, load, loads, strip_comments
from scipy.interpolate import interp1d
if __name__ == '__main__':
## #-----------------# ##
Precision = 0
c = 15
total... |
<gh_stars>1-10
"""Evaluate agent against marevlo results"""
import os
import re
import csv
import time
from collections import defaultdict
import numpy as np
from scipy import stats
import dill
import gym_environment
import marvelo_adapter
from generator import Generator
import baseline_agent
def load_config_from_... |
"""
oktopus algorithm related utils
"""
import random, statistics
from multiprocessing import Pool
from collections import defaultdict, deque
from sys import maxint
import networkx as nx
from cytoolz import merge, partial
from nx_disjoint_paths import edge_disjoint_paths
from ...multicast.session import Session
de... |
<filename>stellargraph/mapper/full_batch_generators.py
# -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Data61, CSIRO
#
# 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.or... |
# Copyright 2018 The TensorFlow Authors. 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
<reponame>dmontielg/smoking-microbiome
#!/usr/bin/env python
import os
import subprocess
import warnings
from collections import Counter
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelBinarizer
from sklearn.preprocessing import OneHotEncoder
from sklearn.metrics import matthews_corrcoe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.