text string |
|---|
<gh_stars>1-10
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
os.environ['AUTOGRAPH_VERBOSITY'] = '10'
import tensorflow as tf
tf.compat.v1.logging.info('TensorFlow')
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
tf.compat.v1.logging.info('TensorFlow')
import numpy as np
import scipy.spatial.dist... |
import torch
import scipy.stats as stats
def create_initial_sequence(rep_item, pre_rep_pgen, pre_other_pgen, t_query_before):
inputs = torch.empty((t_query_before))
obs_tminus1 = 0
for t in range(t_query_before):
obs_tminus1_is_other = obs_tminus1 != rep_item
pgen = pre_other_pgen if obs_tm... |
import sympy as sp
from sympy import lambdify, nsolve
#Python functions to calculate the enthalpy & adiabatic flame temp of a species based on the a_n & b_n constants
#calculate enthalpy (absolute value) using sympy
def enthalpy(input:dict, T:int=298.15):
x = sp.Symbol("x")
#define the polynomial
def... |
<gh_stars>0
from __future__ import print_function, division
"""
An implementation of the vocal similarity model of chord consonance described
in "Vocal similarity predicts the relative attraction of musical chords" by
<NAME>, <NAME>, and <NAME> (December 2017).
Reference:
@article{bowling2017vocal,
title={Vo... |
<filename>stanford/sms-tools/lectures/03-Fourier-properties/plots-code/zero-padding.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming
from scipy.fftpack import fft, fftshift
plt.figure(1, figsize=(9.5, 6))
M = 8
N1 = 8
N2 = 16
N3 = 32
x = np.cos(2*np.pi*2/M*np.arange(M)) * np.hanni... |
<reponame>RileyWClarke/flarubin
import numpy as np
from .baseMetric import BaseMetric
import rubin_sim.maf.utils as mafUtils
import rubin_sim.utils as utils
from scipy.optimize import curve_fit
from builtins import str
__all__ = ['ParallaxMetric', 'ProperMotionMetric', 'RadiusObsMetric',
'ParallaxCoverageMe... |
###########
# IMPORTS #
###########
# 3rd-party
import numpy as np
from scipy import stats
###########
# CLASSES #
###########
class Distribution:
def __init__(self, obj, **kwargs):
self.distribution_object = obj(**kwargs)
self.params = kwargs
self.dimensionality = len(self.draw())
d... |
import dash
# contains widgets that can be dropped into app
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
from dash.dependencies import Input, Output, State
import pandas as pd
import pickle
# new imports
!pip install basilica
import basilica
import numpy as np
... |
import numpy as np
from scipy.stats import norm as gauss
from ..core.util import assure_2d
class FunctionBasis(object):
def __init__(self, dim):
self.dim = dim
def output_matrix(self, xs, params):
raise NotImplementedError
def random_params(self, node_count):
raise NotImplement... |
import numpy as np
from scipy.special import jn_zeros, jn, kn,jv,kv
from scipy.optimize import brentq
from numpy.lib import scimath
def get_NA(ncore,nclad):
return np.sqrt(ncore*ncore - nclad*nclad)
def get_V(k0,rcore,ncore,nclad):
return k0 * rcore * get_NA(ncore,nclad)
def get_MFD(k0,rcore,ncore... |
<filename>code/Load.py
# coding:utf-8
from __future__ import print_function
import numpy as np
import scipy as sp
import math
class Loading(object):
"""docstring for Loading"""
def __init__(self,F = [] , Nx = 0 , Ny = 0, Nxy = 0,Mx = 0,My = 0,Mxy = 0):
super(Loading, self).__init__()
self.Nx = Nx ; self.Ny = Ny... |
#!/usr/bin/env python3
"""A low pass filter based on scipy optimized on filtering the temperature values from sensors
mounted to an oil based rocket burner."""
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import butter, lfilter, lfilter_zi
from scipy.ndimage.interpolation import shift
class th... |
import argparse
import datetime
import itertools
import os
import statistics
from collections import Counter
import numpy
import pandas
import plotly.express as px
import plotly.graph_objs as go
import plotly.io as pio
import scipy
import statsmodels.api as sm
from jsonlines import jsonlines
from nltk import Annotatio... |
<reponame>SchynsO/pixilium
#!/usr/bin/python
import numpy as np
import pygame as gm
from scipy.ndimage.measurements import label
from scipy import signal
from const import *
from wire import Wire
from board import Board
from config import Config
from memory import Memory
from components.gate import Gate
from... |
<filename>src/functions.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib
from scipy import stats
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
import textdistance
from collections import Counter
import os
import pandas as pd
import numpy as n... |
import numpy as np
import glob
from astropy.io import fits
import matplotlib.pyplot as plt
from astropy.table import Table
from fits2wave import fits2wave
from scipy.interpolate import InterpolatedUnivariateSpline
from scipy.signal import medfilt
from tqdm import tqdm
import os
def sanitize(files, blaze_file, model_s... |
<gh_stars>0
# Diagnoses the gradient problem...
import os
import sys
import glob
import numpy as np
from astropy.io import ascii
from astropy.table import Table as Table
from astropy.table import Column as Column
from astropy.convolution import convolve, convolve_fft, Gaussian2DKernel
from astropy.stats import gaussia... |
import networkx as nx
from util import generate_bipartite_graph, get_column, normalize_matrix
from networkx.algorithms import bipartite
from collections import Counter
from math import log2
import numpy as np
from scipy.spatial.distance import cosine as cos_dist
import progressbar
class RS:
def __init__(self, da... |
from game_effect_modifier.base_game_effect_modifier import BaseGameEffectModifier
from game_effect_modifier.game_effect_type import GameEffectType
from sims4.tuning.tunable import HasTunableSingletonFactory, TunableVariant, TunableEnumEntry, Tunable
from statistics.skill import Skill
import tag
class EffectiveSkillMod... |
import re
import pickle
from pathlib import Path
import h5py
import numpy as np
from scipy.io import loadmat
from tqdm import tqdm
from torch.utils.data import Dataset
# class Hand():
# """
# Helper class used to visualize hand joints and generate gaussian heatmaps
# """
# colormap = {
# 'wrist': 'w',
# '... |
"""
Test code for Expert Network (Expert-Net)
Created on 10/13/2020
@author DreamTale
"""
import os
import tqdm
import torch
import argparse
import numpy as np
from torch import nn
from data import ImageFolder
import torch.nn.functional as F
from scipy.stats import entropy
import torchvision.utils as vutils
from torch.... |
<filename>moldesign/mathutils/spherical_harmonics.py
from __future__ import print_function, absolute_import, division
from future import standard_library
standard_library.install_aliases()
from future.builtins import *
# Copyright 2017 Autodesk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
#... |
<gh_stars>0
# -*- coding: utf-8 -*-
# Estimation of link=>sensor transforms needs ROS
from ivenv import *
import scene_objects
from hironx import *
from mplan_env import *
from csplan import *
import hironx_params
import hironxsys
import time
from scipy.optimize import leastsq
# This package requires ROS
use_ros = ... |
<reponame>GrumpyZhou/semseg
'''
Testing script for fcn32 without skip architecture.
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
sys.path.append("..")
import os
import numpy as np
import tensorflow as tf
from network.fcn_instance import I... |
import io
import os
import argparse
import datetime
import numpy as np
import cv2
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from sklearn.preprocessing import MinMaxScaler
import scipy.ndimage as ndimage
import matplotlib.pyplot as plt
import json
from tqdm import t... |
<reponame>t-young31/thesis
#!/usr/bin/env python3
import argparse
import numpy as np
from scipy.spatial import distance_matrix
from scipy import integrate
class Constants:
hbar_au = 1.0
h_au = hbar_au * 2.0 * np.pi
amu_to_au = 1822.888486 # m_e amu-1
kj_mol_to_au = 0.00038087980 ... |
<reponame>rflperry/mvlearn<filename>mvlearn/utils/linalg.py
# License: MIT
from scipy.linalg import eigh
from scipy.linalg import svd as full_svd
from sklearn.utils.extmath import svd_flip
from scipy.sparse import issparse
from scipy.sparse.linalg import svds
import numpy as np
from sklearn.utils import check_random_s... |
<filename>ROC_curve/Test-ROC.py
## Test
## when you have data, and splite them into training dataset and test dataset.
## when you get the trained model clf, and want to test it by test dataset,
## and get the test varibles X_test and y_test.
# 装备库
import pandas as pd
import numpy as np
import matplotlib.pyplo... |
import os, time, glob, argparse
import numpy as np
from scipy.io import loadmat, savemat
import tensorflow as tf
from tnn import main
from tnn.reciprocalgaternn import tnn_ReciprocalGateCell
import warnings
warnings.filterwarnings("ignore")
host = os.uname()[1]
if host.startswith('braintree'):
DATA_PATH = '/bra... |
<filename>src/python/ksc/gmm/gmm.py<gh_stars>10-100
# A reference implementation of GMM objective converted to Numpy from
# ADBench's PyTorch version. See
#
# https://github.com/awf/ADBench/blob/master/src/python/modules/PyTorch/gmm_objective.py
import math
from scipy import special as scipy_special
import numpy ... |
import jax.numpy as jnp
import numpy as np
import scipy.sparse as sp
from scipy.sparse.linalg import eigs
from .grid import YeeGrid
from .typing import Size, Spacing, Optional, Tuple, Union, Callable, Size2
from .utils import poynting_fn, Box
from .viz import plot_power_2d, plot_field_2d, plot_field_1d, hv_field_1d, h... |
import sympy
import constant
debug = False
x, y, h = sympy.symbols('x y h', commutative=False)
def basis():
return x, y, h
structure_constants = {}
structure_constants[(x, y)] = h
structure_constants[(x, h)] = -2 * x
structure_constants[(y, h)] = 2 * y
structure_constants[(y, x)] = - structure_constants[(x, y)]
st... |
<reponame>retoweber/inaudible_aae<gh_stars>1-10
## attack.py -- generate audio adversarial examples
##
## Copyright (C) 2019, <NAME> <<EMAIL>>.
##
## This program is licenced under the BSD 2-Clause licence,
## contained in the LICENCE file in this directory.
import numpy as np
import tensorflow as tf
import argparse
i... |
<filename>NNGS_funs.py
from qutip import *
import numpy as np
import matplotlib.pyplot as plt
import scipy as scipy
import time
def PD(state):
# return a array of probability distribution of given state
return np.transpose( np.power(np.absolute( np.array(state) ),2) )[0]
def initialstate(K... |
import numpy as np
import scipy.interpolate as si
# Using B-spline for simulate humane like mouse movments
def move_mouse_like_human(action, start_element):
points = [[6, 2], [3, 2], [0, 0], [0, 2]]
points = np.array(points)
x = points[:, 0]
y = points[:, 1]
t = range(len(points))
i... |
<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import with_statement
from acq4.devices.Camera import Camera, CameraTask
from PyQt4 import QtCore
import time, sys, traceback
import acq4.util.ptime as ptime
from acq4.util.Mutex import Mutex
from acq4.util.debug import *
import acq4.util.functions as fn
import numpy ... |
"""
Stub module to expose DomainMatrix which has now moved to
sympy.polys.matrices package. It should now be imported as:
>>> from sympy.polys.matrices import DomainMatrix
This module might be removed in future.
"""
from sympy.polys.matrices.domainmatrix import DomainMatrix
__all__ = ['DomainMatrix']... |
"""
Copyright (C) 2012 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublice... |
import numpy as np
import scipy
__all__=['fixpoint','is_1d','is_complex','to_1d','to_2d','to_callback',]
#-------------------------------------------------------------------
# def is_numbertype(x):
# return isinstance(x,(float,int,list,tuple,complex,np.ndarray,np.matrix))
#--------------------------------------... |
"""
Library of function to create halo catalogs matched to a density.
.. moduleauthor:: <NAME> <johan.comparat__at__gmail.com>
"""
import random
import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as p
import astropy.io.fits as fits
import numpy as n
from scipy.interpolate import interp1d
import scipy.s... |
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.stats import norm
from sklearn.preprocessing import StandardScaler
from scipy import stats
from mpl_toolkits.mplot3d import Axes3D
from sklearn.model_selection import train_test_split
import warnings
import math
from... |
"""
Currently I only have support for Cora dataset - feel free to add your own graph data.
You can find the details on how Cora was constructed here: http://eliassi.org/papers/ai-mag-tr08.pdf
TL;DR:
The feature vectors are 1433 features long. The authors found the most frequent words across every paper... |
<reponame>kundajelab/genomics-DL-archsandlosses
import tensorflow as tf
import tensorflow.keras.backend as kb
import numpy as np
from scipy.ndimage import gaussian_filter
def smooth_tensor_1d(input_tensor, smooth_sigma):
"""
Smooths an input tensor along a dimension using a Gaussian filter.
Args:
... |
<reponame>guanghuixu/multi-model-forgetting<gh_stars>10-100
from collections import defaultdict, deque
import os
import pickle
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
# from torch.tensor import ones
from models.cnn_layers import CNN_LAYER_CREATION_FUNCTIONS, initialize_l... |
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
import math_models_animate as anim
import math_models_util as util
class Dimension(util.SumCallablesFtn):
def __init__(self, name, factors):
super().__init__(factors)
self.name = name
class CarryingCapacity:
... |
# -*- coding: utf-8 -*-
"""
Copyright Netherlands eScience Center
Function : Statistical Operator for Climate Data
Author : <NAME> (<EMAIL>)
First Built : 2019.08.10
Last Update : 2019.08.10
Contributor :
Description : This module provides several methods to perform statistical
... |
"""Baselines for predicting guide sequence activity.
"""
import argparse
import fnn
import parse_data
import predictor
import random
import rnn
import numpy as np
import scipy
import sklearn
import sklearn.ensemble
import sklearn.linear_model
import sklearn.metrics
import sklearn.model_selection
import sklearn.utils... |
<gh_stars>0
# -*- coding: utf-8 -*-
# _infnorm.py
# This module provides the infnorm function.
# Copyright 2013 <NAME>
# This file is part of python-deltasigma.
#
# python-deltasigma is a 1:1 Python replacement of Richard Schreier's
# MATLAB delta sigma toolbox (aka "delsigma"), upon which it is heavily based.
# The de... |
# Usage: CUDA_VISIBLE_DEVICES=gpu-number python deepSimDEF_for_sequence_homology.py arguments
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'}
import sys
import logging
import random
import numpy as np
import pprint
import argparse
import tensorflow.keras
import tensorflow as tf
tf.compat.v... |
import torch
import numpy as np
from scipy.sparse import linalg as sparselinalg
class DominantEig(torch.autograd.Function):
"""
Function primitive of dominant eigensolver, where the matrix is real
and only assumed to be diagonalizable. In addition, since Pytorch doesn't
support complex numbers, the... |
<reponame>basanto/HistomicsTK
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 22 02:37:52 2019.
@author: mtageld
"""
import numpy as np
from imageio import imread
from skimage.transform import resize
from PIL import Image
from skimage.filters import gaussian
from scipy import ndimage
from histom... |
<gh_stars>0
#!/usr/bin/python
'''Creates a video where each frame is annotated with color coded
frames based on the scores in a jet color scheme.
'''
usage='CreateVUEstimationVideo.py'
import roslib; roslib.load_manifest('hima_experiment')
import rospy
from pylab import *
import numpy as np
import scipy as sp
from opt... |
<filename>sigtest.py
#!/usr/bin/env python
import numpy as np
import pandas as pd
from scipy.stats import wilcoxon
model1 = "orensm"
model2 = "uniform_dotted"
#column = "p@3av"
#column = "p@1av"
column = "gap"
data = "semeval_all"
for data in ['semeval_all', 'coinco', 'twsi2']:
out1 = pd.read_table("lemma_pre... |
__VERSION__="ete2-2.2rev1056"
# -*- coding: utf-8 -*-
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://ete.cgenomics.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the t... |
<filename>vol4/195.py<gh_stars>0
from math import sqrt
from fractions import gcd
def solve(r):
ret = 0
M = int(r * 2 * 3 / sqrt(3))
for m in xrange(2, M + 1):
for n in xrange(1, m):
if gcd(m, n) != 1:
continue
a = (m + 2 * n) * m
b = (n + 2 * m) *... |
<gh_stars>0
#!/usr/bin/env python
# <NAME> - Vanderbilt University
# <EMAIL>
# Last edited 8/15/2015
# Description: Calculates the number of stars in a given direction and between a given set of distances. For use with Field Star Count metric
from __future__ import print_function
from __future__ import absolute_impor... |
<reponame>enjoyneer87/SciDataTool
from SciDataTool.Classes.Data1D import Data1D
import numpy as np
from numpy import (
ndarray,
concatenate,
identity,
arange,
asarray,
sin,
pi,
outer,
linspace,
sqrt,
)
from sklearn.linear_model import orthogonal_mp
from scipy.fft... |
<gh_stars>0
import os
import numpy as np
import pandas as pd
import tensorflow as tf
import scipy.stats as st
from PIL import Image
from scipy.misc import imread
from scipy.misc import imresize
from tensorflow.contrib.slim.nets import resnet_v1, inception, vgg
slim = tf.contrib.slim
tf.flags.DEFINE_string(
'check... |
<reponame>xuhao1/pyAircraftIden
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import math
from scipy import signal
from scipy.signal import freqz
from aircraft_iden.FreqIden import *
import os
def draw_gxx(fn, omg_min=0.1, omg_max=10):
arr = np.load(fn)
... |
<reponame>aragilar/astroML
"""
Curse of Dimensionality: Volume Ratio
-------------------------------------
This figure shows the ratio of the volume of a unit hypercube to the volume
of an inscribed hypersphere. The curse of dimensionality is illustrated in
the fact that this ratio approaches zero as the number of di... |
import osmnx as ox
import networkx as nx
import geopandas as gpd
import pandas as pd
import pandana as pdna
import numpy as np
from scipy.stats import zscore
import gc
import os
import csv
def neigh_stats(G_proj, hexes, length, rows, node, index):
"""
This function is for multiprocessing.
It uses hexes to... |
<gh_stars>1-10
# Author: <NAME>, University College London
# <<EMAIL>> <<EMAIL>>
#
# Code released under BSD Two-Clause license
#
# Copyright (c) 2020 University College London.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that t... |
<filename>Python Files/Dataset_Formating/Tensor_audio_formating.py<gh_stars>1-10
import tensorflow as tf
import tensorflow_io as tfio
import numpy as np
import matplotlib.pyplot as plt
from scipy.fftpack import fft
from scipy.io import wavfile as wav
'''
Tensorflow conversion to spectrograms
Maybe use if we go with M... |
import numpy as np
import time
import matplotlib.pyplot as plt
from scipy.integrate import solve_bvp
#Import from stablab
from stablab import Evans_compute, winding_number, Evans_plot, emcset, Struct
from stablab.contour import semicirc, semicirc2
from stablab.evans import Aadj
from stablab.periodic_contour import per... |
<reponame>Baccega/smartphone-based-rti
from scipy.interpolate import Rbf
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
from constants import constants
def interpolate_data(data, mode):
print("\t— Interpolating data")
interpolated_data = np.zeros(
(
constants["SQ... |
<filename>VasoTracker_Software/VasoTracker1.1.0/VTutils.py
##################################################
## VasoTracker Pressure Myograph Software
##
## This software provides diameter measurements (inner and outer) of pressurised blood vessels
## Designed to work with Thorlabs DCC1545M
## For additional info see... |
<reponame>Kensuke-Mitsuzawa/DocumentFeatureSelection<gh_stars>10-100
#! -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from scipy.sparse.csr import csr_matrix
from typing import Union
from Documen... |
<reponame>erkundanec/BasicPython
'''============================ scikitImageTutorial file ============================= %
Description : scikit-image Tutorial
Input parameter : Gray Image
Output parameter :
Subroutine called : NA
Called b... |
import time
import numpy as np
import scipy.spatial as sps
from scipy.sparse import csc_matrix
from shapely.geometry import Point, MultiPoint, LineString, mapping
from shapely.ops import unary_union, nearest_points
from tqdm import trange
from easydict import EasyDict as edict
from matplotlib import patches as patches
... |
<reponame>JacobGrig/ML-volatility<filename>ml_volatility/ml_volatility/model/model.py
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import statsmodels.api as sm
from sklearn.preprocessing import MinMaxScaler
from sklearn.ensemble import RandomForestRegressor
from scipy.optimize import fmin... |
<reponame>ludo67100/CereballarMaps-GraphProperties
import os
import glob
import numpy as np
import pylab as pl
import scipy.io as sio
# for_Jyotika.m
from copy import copy, deepcopy
import pickle
import matplotlib.cm as cm
import pdb
import h5py
import pandas as pd
import scipy.stats as sp_st
import sys
# Raw data
da... |
<gh_stars>0
import arff, numpy as np
from scipy import sparse
def load_custom_dataset(dataset_name, label_count, length_train=None, length_test=None):
train_dataset = arff.load(open(dataset_name+'_train.arff', 'r'))
if length_train == None:
length_train = len(train_dataset['data'])
test_dataset =... |
<filename>Codes/generate_data_500ms_nor.py
import os
import glob
import pandas as pd
import numpy as np
import scipy as sp
from scipy.interpolate import interp1d
from datetime import timedelta
from sklearn import preprocessing
from sklearn.preprocessing import MinMaxScaler
# import matplotlib.pyplot as plt... |
import json
import os
import numpy as np
from numpy.linalg import det
from scipy.signal import savgol_filter
from zoo.evaluation.metrics.utils import (
map_agent_to_json_file,
save_evaluation_result_to_json,
)
class KinematicsEvaluation:
def __init__(self, scenarios_data_path, result_path, agent_name_li... |
import sys
import ast
import runpy
import importlib
from pathlib import Path
from fractions import Fraction
from importlib import reload
import pytest
import hy
from hy.lex import hy_parse
from hy.errors import HyLanguageError, hy_exc_handler
from hy.lex.exceptions import PrematureEndOfInput
from hy.compiler import ... |
<reponame>QihuangZhang/CeLEry
import pandas as pd
import numpy as np
import scipy
import os
import scanpy as sc
from tqdm import tqdm
# from skimage.metrics import structural_similarity as ssim
# import pickle
from math import floor
import json
from sklearn.metrics import confusion_matrix
from sklearn.metrics import cl... |
#!/usr/bin/python -Wall
from __future__ import division
from kerlutil import mfrange
from cmath import sqrt
ab_s = mfrange(-3.0, 0.02, 3.0)
for a in ab_s:
for b in ab_s:
# z^2 - a z - b
D = a**2 + 4*b
sqrt_D = sqrt(D)
root1 = (a + sqrt_D) * 0.5
root2 = (a - sqrt_D) * 0.5
if abs(root1) < 1.0 and abs(root... |
import os
import scipy.io
import numpy as np
import torch
from torchvision import datasets, transforms
import glob
from zipfile import ZipFile
import random
from .celeba_dataset import CelebaDataset, CelebaHairDataset
from .brats import BratsDataSet
from .cub import TextDataset
def load_datasets(dataset, cfg, image... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Mon May 23 09:34:29 2022
@author: <NAME>
"""
import numpy as np
import scipy.optimize as op
import sys
sys.path.append("..")
import analyzers.general.thermal_network as tb
class SPM_RotorThermalProblem:
""" Problem class for rotor thermal analyzer
At... |
import torch
import numpy as np
from scipy.ndimage import distance_transform_edt as distance
from skimage import segmentation as skimage_seg
import matplotlib.pyplot as plt
def dice_loss(score, target):
# implemented from paper https://arxiv.org/pdf/1606.04797.pdf
target = target.float()
smooth = 1e-5
... |
import collections
from math import ceil
import torch
import torch.nn as nn
import numpy as np
import pygsp
import scipy
from tqdm import tqdm
from .utils import get_device
class logistic_regression(nn.Module):
def __init__(self, n_feature, n_way):
super(logistic_regression, self).__init__()
self... |
<filename>deepchem/molnet/load_function/qm7_datasets.py
"""
qm7 dataset loader.
"""
from __future__ import division
from __future__ import unicode_literals
import os
import numpy as np
import deepchem
import scipy.io
import logging
logger = logging.getLogger(__name__)
DEFAULT_DIR = deepchem.utils.get_d... |
import sys
from scipy.stats import pearsonr
import scikits.bootstrap as boot
from moduleUsefulFunctions_20180215 import *
plt.close()
def deletionReversal(seq):
posReassignedDict={} #dictionary
for counter, eachEl in enumerate(seq):
posReassignedDict[counter+1]=counter+1
if counter<len(seq)-1:... |
import os
import time
import numpy as np
import pandas as pd
import scanpy as sc
import scipy.sparse as ssp
from .. import help_functions as hf
from .. import logging as logg
from .. import plotting as pl
from .. import settings
from .. import tool as tl
def generate_similarity_matrix(
adata,
file_name,
... |
# -*- coding: utf-8 -*-.
"""
The Huber_braun neuronal model function.
@author: porio
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
import time as TM
from models import netwHBIh2 as HB
from utils import Networks
Area = 15000 # um^2
print("Area = %g"%Area)
HB.Area=Area
#Seteo de var... |
<filename>consolidated_functions.py<gh_stars>0
from PIL import Image, ImageDraw
import numpy as np
import pandas as pd
import folium
from folium import plugins
import matplotlib.pyplot as plt
import matplotlib.colors
from matplotlib.colors import LinearSegmentedColormap, rgb_to_hsv, hsv_to_rgb
import scipy.ndimage.filt... |
import numpy as np
from sympy import Matrix
A = np.array([[2, 3, 1, 0], [4, -1, 9, 0], [3, 8, -2, 0], [1, -2, 4, 0]])
# 将numpy.array转为sympy.Matrix
MA = Matrix(A)
print("------------------行简化阶梯型-------------------")
print(MA.rref()) # 行简化阶梯型
print("------------------对角化矩阵-------------------")
M = Matrix([[3,-2,4,-2],... |
<filename>src/utils/compute_dataset_seed_anchors.py
import tqdm
import numpy as np
import torch.utils.data
from scipy.cluster.vq import kmeans2
from utils.config import Config
from utils.misc import load_dataset
class DatasetWrapper(torch.utils.data.Dataset):
def __init__(self, dataset):
super(DatasetWra... |
import argparse
import numpy as np
import csv
import pandas as pd
import json
import scipy.sparse as sp
from sparsebm import (
SBM,
LBM,
ModelSelection,
generate_LBM_dataset,
generate_SBM_dataset,
)
from sparsebm.utils import reorder_rows, ARI
import logging
logger = logging.getLogger(__name__)
tr... |
<gh_stars>10-100
import os
from base import kernel_base
from base.os_base import listdir
import scipy.io as scio
def load_mat_kernel(mat_path):
data_dict = scio.loadmat(mat_path)
key = [v for v in data_dict.keys() if v not in ['__header__', '__version__', '__globals__']][0]
return data_dict[key]
def cal... |
import argparse
import statistics
import time
from collections import defaultdict, namedtuple
from typing import List
from xml.etree import ElementTree
import aiohttp
from colorama import Fore
from unsync import unsync
Args = namedtuple('Args', 'sitemap_url, workers, ignore_patterns')
RequestResult = namedtuple('Requ... |
<reponame>ElsevierSoftwareX/SOFTX_2019_164<gh_stars>1-10
# -*- coding: utf-8 -*-
"""SPHARA basis functions
This module provides a class for determining SPHARA basis functions. Methodes
are provided to determine basis functions using different discretization
scheme of the Laplace-Beltrami operator, as FEM, inverse eucl... |
<gh_stars>100-1000
import glob
import os
import keras_vgg_buddy
import numpy as np
from keras import backend as K
from scipy.misc import imsave
from .base import generate_img_batches
def input_generator(args):
'''Generates batches of random samples paired with images.
'''
g_training_imgs = generate_img_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @python: 3.6
import copy
import torch
import torch.nn.functional as F
from scipy import linalg
import numpy as np
def aggregate_att(w_clients, w_server, stepsize, metric, dp):
"""
Attentive aggregation
:param w_clients: list of client model parameters
:... |
<filename>analyzing/ResultsAnalyzer.py
import sys
import numpy as np
import matplotlib.pyplot as plt
import scipy as scipy
import sklearn.metrics as metrics
class ResultsSingleConfigAnalyzer:
def __init__(self, results, num_runs):
self.results = results;
self.num_runs = num_runs;
self.p... |
# encoding: utf-8
# (c) 2019 Open Risk (https://www.openriskmanagement.com)
#
# correlationMatrix is licensed under the Apache 2.0 license a copy of which is included
# in the source distribution of correlationMatrix. This is notwithstanding any licenses of
# third-party software included in this distribution. You may... |
<filename>routine_qiime2_analyses/_routine_q2_rarefy.py
# ----------------------------------------------------------------------------
# Copyright (c) 2020, <NAME>.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ---------------... |
<filename>fourier_restore_class4/assignment4.py
#!/usr/bin/env python3
"""
Image Processing -- SCC5830 — Prof. <NAME>
Assignment 4 : Recovery and Fourier
@author: "<NAME> -- NUSP: 11023222"
2021, May -- 1º Semester
"""
import numpy as np
import imageio
from scipy.fft import rfft2, ... |
"""
===========================
FisherS separability graph example
===========================
"""
import skdim
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from scipy.stats.mstats import winsorize
ball1 = skdim.gendata.hyperBall(n_points=1000, n_dim=3, radius=0.5, center=[... |
<filename>spikefeatures/features.py
"""
Functions based on
https://github.com/AllenInstitute/ecephys_spike_sorting/blob/master/ecephys_spike_sorting/modules/mean_waveforms/waveform_metrics.py
22/04/2020
"""
import numpy as np
from scipy.stats import linregress
import pandas as pd
all_1D_features = ['peak_to_valley', ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.