text string |
|---|
<reponame>jeremy-rutman/prjxray<gh_stars>1-10
#!/usr/bin/env python3
import scipy.optimize as optimize
from timfuz import Benchmark, load_sub, A_ub_np2d, acorner2csv, corner_s2i
import numpy as np
import glob
import json
import math
import sys
import os
import time
import timfuz_solve
def run_corner(
Anp, b,... |
<reponame>DCHamerslag/FACT<gh_stars>0
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import time
import numpy as np
from scipy.linalg import orth
import scipy.sparse as sparse
import cvxpy as cvx
### Minimizer / CVX... |
<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Contains all abstract class definitions """
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from utils import Attribute
from directories import *
import os
__author__ = '<NAME>'
# TODO Add ideal cycle image
# TODO Add figure save... |
# Author: alexn11 (<EMAIL>)
# Created: 2018-10-21
# Copyright (C) 2018, 2020, <NAME>
# License: MIT License
import math
import cmath
import mathsvg
two_pi = 2 * math.pi
rescaling = 100
def draw_a_torus(image, torus_position, torus_size, thinness = 0.375):
# NOTE: there's limits to acceptable thinness beyond wh... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains simple functions for dealing with circular statistics, for
instance, mean, variance, standard deviation, correlation coefficient, and so
on. This module also cover tests of uniformity, e.g., the Rayleigh and V tests.
The Maximum L... |
import scipy.interpolate
from scipy.special import expit
import scipy.constants as constants
import numpy as np
def calculate_chemical_potential(temperatures,e_dos,fermi_energy,\
precision=0.000000001,initial_step=0.5,region_around_fermi_energy=5,number_of_points = 5000):
# This func... |
<gh_stars>1-10
import warnings
import numpy as np
import pytest
import scipy.sparse
import sympy as sp
from kernels import (
AdjointDoubleLayer,
DoubleLayer,
ElasticA,
ElasticH,
ElasticT,
ElasticU,
Hypersingular,
SingleLayer,
double_layer,
hypersingular,
kernel_types,
)
fro... |
<filename>utils/supervisedmetrics.py
import numpy as np
import scipy
import sklearn
from sklearn.ensemble import GradientBoostingClassifier
def mig(mus,ys):
score_dict = {}
discretized_mus = mus;
m = discrete_mutual_info(discretized_mus, ys)
assert m.shape[0] == mus.shape[0]
assert m.shape[1] == y... |
#!/usr/bin/python
from __future__ import print_function
import numpy as np
from scipy.optimize import minimize
from scipy.io import loadmat
from math import sqrt
from sys import argv
import json
from scipy.special import expit
from itertools import product
from time import process_time as ptime
from time imp... |
import torch
from net.model import get_model
from data import prepare_data
import fire
import numpy as np
from scipy import stats
from collections import OrderedDict
from util import batch_iou, read_image_tensor, draw_segmentation_mask, get_image_mask, show_cam_on_image
import pandas as pd
from pytorch_grad_cam import... |
'''Homework 4, Computational Photonics, SS 2020: Fourier modal method.
'''
import numpy as np
from numpy.linalg import eig, solve
from scipy.linalg import toeplitz
from scipy.fftpack import fft
from scipy.sparse import diags
def fmm1d_te_layer_modes(perm, period, k_0, k_x, N, dtype=np.complex128):
''... |
<reponame>nitred/tf-examples
"""Contains code basic implementation of GAN modeling a Gaussian.
- This is the basic version which is imperfect.
- The next versions in another file will aim to improve this model.
- Learning rate decay doesn't seem to work.
"""
from pprint import pprint
import numpy as np
import tensorf... |
<reponame>metocean/tcrm
"""
Tropical Cyclone Risk Model (TCRM) - Version 1.0 (beta release)
Copyright (C) 2011 Commonwealth of Australia (Geoscience Australia)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
t... |
# function call to the transformation functions of relevance for the hpsModel
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import get_window
import sys, os
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/'))
sys.path.append(os.path.join(os.pat... |
'''
This script creates 3-channel gray images from FER 2013 dataset.
It has been done so that the CNNs designed for RGB images can
be used without modifying the input shape.
This script requires two command line parameters:
1. The path to the CSV file
2. The output directory
It generates the images and saves them ... |
<reponame>ishine/wavegrad2-1<gh_stars>10-100
#This code is adopted from
#https://github.com/ming024/FastSpeech2
import os
import random
import json
import tgt
import librosa
import numpy as np
from scipy.io import wavfile
from tqdm import tqdm
class Preprocessor:
def __init__(self, hparams):
self.hparams... |
import os
import sys
import fnmatch
import numpy as np
import random
#Fix the import path, so that we can import our parent folder with all required modules
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path.dirname(... |
from dv import AedatFile
import numpy as np
import scipy.io as sio
from tqdm import tqdm
import cv2
from PIL import Image
import os
import matplotlib.pyplot as plt
import subprocess
# HIE-2020_03_09_15_48_39
# HIE-2020_03_09_15_49_59
# HIE-2020_03_09_15_47_06
# HIE-2020_03_09_15_47_53
# HIE-2020_03_09_15_40_36
# HIE-2... |
<filename>notebook-samples/unsupervised/diabetes_tensorflow_deep_learning.py
"""
Purpose: Binary classificaton for diabetes patients.
Date created: 2020-11-06
Ref: https://github.com/tirthajyoti/Deep-learning-with-Python/blob/master/Notebooks/Keras_Scikit_Learn_wrapper.ipynb
Contributor(s):
<NAME>.
"""
import w... |
<reponame>jaakjensen/PythonDSP<filename>graphing/31_fftExactFrequencyCalculation.py
# Use this animation to calculate the exact
# frequency of a signal in a bin.
# Press 'k' and 'l' keys to raise and lower
# the frequency of the cosine wave.
from scipy.fft import fft, fftfreq
import numpy as np
from scipy import signal... |
import numpy as np
from scipy.optimize import curve_fit
from scipy.optimize import fsolve, brentq
from scipy.interpolate import interp1d
import scipy.integrate
import sys
import os
import writeproperties.velociraptor_python_tools as vpt
from scipy.spatial import cKDTree
import h5py
import re
from constants import *
fro... |
import numpy as np
import scipy
import json
import os
import pickle
from nbodykit.cosmology import Planck15, LinearPower
from nbodykit.lab import *
from vmad.lib.fastpm import ParticleMesh
from pmesh.pm import RealField, ComplexField
def a2z(a):
"""
scale factor to redshift
"""
return 1./a-1
def z2a(... |
"""
Module containing functions for negative item sampling.
"""
import numpy as np
from scipy.sparse import csr_matrix
import torch_utils
import time
import interactions
class Sampler(object):
def __init__(self):
super(Sampler, self).__init__()
def get_train_instances(self, interactions: interaction... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Evaluator based on transition matrix
"""
from __future__ import print_function, division
from nltk import sent_tokenize
from sklearn import svm
from sklearn.model_selection import train_test_split
from scipy.stats import kendalltau as tau
import numpy as np
# cross_validation
fr... |
<reponame>geojames/py_sfm_depth
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
__author__ = '<NAME>'
__contact__ = '<EMAIL>'
__copyright__ = '(c) <NAME> 2016'
__license__ = 'MIT'
__date__ = '13 July 2016'
__version__ = '1.0'
__status__ = "in... |
<reponame>elemel/ratcode
from collections import deque
from fractions import Fraction
from ratcode.operations import OPCODE_TO_OPERATION
class Program:
def __init__(self):
self.registers = 256 * [Fraction()]
self.memory = bytearray(256 * 256)
self.files = [
deque(), # stdin
... |
"""
desispec.sky
============
Utility functions to compute a sky model and subtract it.
"""
import numpy as np
from desispec.resolution import Resolution
from desispec.linalg import cholesky_solve
from desispec.linalg import cholesky_invert
from desispec.linalg import spline_fit
from desiutil.log import get_logger
f... |
<reponame>aozbakir/gps_cluster<gh_stars>0
from scipy.stats import zscore
'''
TBD
'''
def remove_outliers(df, std=2):
"""
Remove, if the data is N standard deviations above or below the mean
"""
#df[df[['Velocity (E)', 'Velocity (N)']]
condition = (df[['Ve', 'Vn']].apply(zscore).abs() > std).any(... |
<reponame>jlmaurer/tectosaur<gh_stars>10-100
import sys
import logging
import pickle
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import okada_wrapper
import scipy.spatial
import tectosaur
import tectosaur.mesh.refine as mesh_refine
import tectosaur.mesh.modify as mesh_modify
import ... |
<reponame>niklasmichel/trapy
import os
import sys
import math
import warnings
import pandas as pd
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from .trial import Trial
def instantiate(folder):
"""Crawls folder for text files and makes them instanc... |
<filename>ML/prototypemethods.py
"""
Prototype methods are unstructured methods that represent the training
data with prototypes in the feature space.
"""
import random
import numpy as np
from scipy import stats
class KNearestNeighbor(object):
"""
K nearest neighbors classification and regression
"""
... |
# -*- coding: utf8 -*-
from pprint import pprint
import sympy as sp
def main():
# <NAME>, MRocklin, <NAME>, Automatically populating matrix elements in SymPy,
# http://stackoverflow.com/questions/6877061/automatically-populating-matrix-elements-in-sympy, 2011 Aug 02,
# (accessed 2015 Dec 01)
L = sp.M... |
from __future__ import print_function
from __future__ import absolute_import
import random
import warnings
import numpy as np
from PIL import Image
from math import ceil
try:
import cPickle as pickle
except:
import pickle
import scipy.special as scsp
from scipy import stats as scst
import matplotlib.pyplot as ... |
# Copyright 2021 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, ... |
"""Multivariate Student T distribution."""
from copy import deepcopy
from multiprocessing import Pool
import numpy as np
import scipy
import tensorflow as tf
import tensorflow_probability as tfp
from simanneal import Annealer
#from psych_metric.supervised_joint_distrib import is_prob_distrib
class MultivariateStude... |
<reponame>alexanderhucheerful/pysteps
# -*- coding: utf-8 -*-
"""
pysteps.nowcasts.sseps
======================
Implementation of the Short-space ensemble prediction system (SSEPS) method.
Essentially, SSEPS is a localized version of STEPS.
For localization we intend the use of a subset of the observations
... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import psoap
from psoap.data import lkca14, redshift, Chunk
from psoap import matrix_functions
from psoap import covariance
from psoap import orbit
# Specify orbital parameters and make a sanity plot
q_inner = 0.4
K_inner = 5.... |
<gh_stars>0
# Copyright 2021 The QHBM Library 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
import networkx as nx
import numpy as np
import scipy.sparse
class Transformer:
def get_laplacian(graph):
"""
Compute the laplacian matrix of a graph.
Parameters
----------
graph : NNGraph
Directed Graph.
Returns
-------
numpy.ndarray
... |
<gh_stars>1-10
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
plt.style.use('seaborn-white')
#%matplotlib inline
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import Pipeline, make_pipeline
from sklearn.model_selecti... |
<reponame>drvinceknight/Nashpy
"""A class for a normal form game"""
import numpy as np
import numpy.typing as npt
from typing import Generator, Any, Set
from scipy.optimize import linprog
from scipy.spatial import HalfspaceIntersection
def build_halfspaces(M: npt.NDArray) -> npt.NDArray:
"""
Build a matrix re... |
<reponame>anshu7919/NBApredict
"""
Author: <NAME>
Purpose: Four Factor Regression performs a regression on the Margin of Victory (mov) between NBA teams with each teams
four factors(offensive and defensive) as predictors. The regression object is returned from the module.
Args (default):
year (2019): The year of ... |
<reponame>vishalbelsare/fast-cma-es
# Copyright (c) <NAME>.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory.
# This example is taken from https://mintoc.de/index.php/F-8_aircraft
# The F-8 aircraft control problem is based on a very simple aircraft model.
# Th... |
<reponame>gum3ng/sympy
from sympy.external import import_module
matchpy = import_module("matchpy")
from sympy.utilities.decorator import doctest_depends_on
if matchpy:
from matchpy import Wildcard
else:
class Wildcard:
def __init__(self, min_length, fixed_size, variable_name, optional):
pas... |
from algebreb.ejercicios.operaciones_polinomio import TermPolinomio
from algebreb.expresiones.polinomios import polinomio_coeficientes_aleatorios
from sympy.abc import x, y, z
# Ejemplo 1
# Suma de polinomios
# Polinomios completos de grado 2 y 3,con coeficientes enteros aleatorios en un rango de -10 a 10
# con variab... |
import sys
import numpy as np
import healpy as hp
import scipy.optimize as opt
import numpy.polynomial.polynomial as poly
from mwa_pb.mwa_sweet_spots import all_grid_points
sys.path.append("../../decode_rf_data")
from colormap import spectral, jade, kelp
# Custom spectral colormap
jade, _ = jade()
def plot_healpix(... |
<reponame>Jinboasltw/FastSurfer<filename>recon_surf/smooth_aparc.py
#!/usr/bin/env python3
# Copyright 2019 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... |
<reponame>kamilstecyk/SMARTS
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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 ... |
<filename>pyqtgraph/widgets.py
# -*- coding: utf-8 -*-
"""
widgets.py - Interactive graphics items for GraphicsView (ROI widgets)
Copyright 2010 <NAME>
Distributed under MIT/X11 license. See license.txt for more infomation.
Implements a series of graphics items which display movable/scalable/rotatable shapes
... |
import numpy as np
import time, os, math, operator, statistics, sys
import tensorflow as tf
from random import Random
class Sample(object):
def __init__(self, id, image, true_label):
# image id
self.id = id
# image pixels
self.image = image
# image true label
... |
from scipy.io import loadmat
from .labeled_data import LabeledSequenceData, SparseLabeledSequenceData
def read_mat(path):
data = loadmat(path, squeeze_me=True)
return data['X'], data['y']
def get_datasets(args, xtrain=None, ytrain=None, xtest=None, ytest=None):
if (xtrain is None) or (ytrain is None) o... |
"""
Code borrowed from https://github.com/shubhtuls/toe/blob/master/data/base.py
Base data loading class.
Should output:
- img: B X 3 X H X W
- mask: B X H X W
- kp (optional): B X nKp X 2
- sfm_pose (optional): B X 7 (s, tr, q)
(kp, sfm_pose) correspond to image coordinates in [-1, 1]
"""
from __f... |
<gh_stars>0
import argparse
import pickle
from typing import List
from typing import Optional
import numpy as np
import pandas as pd
from scipy.spatial import distance
from sklearn.base import BaseEstimator
from bintools.cabc.utils import transform
def generate_cabc_conf(method: str, **kwargs) -> List[str]:
con... |
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import scipy.interpolate
import scipy.signal
import scipy.spatial
import scipy.stats
import sys
# %% Load data
case = int(sys.argv[1])
print("Case " + str(case))
suffix = '_uphavg'
basedata = np.load('/home/nc1472/git/qg-e... |
<reponame>sid21g/sympy<filename>sympy/physics/quantum/tests/test_represent.py
from sympy import Float, I, Integer, Matrix
from sympy.external import import_module
from sympy.testing.pytest import skip
from sympy.physics.quantum.dagger import Dagger
from sympy.physics.quantum.represent import (represent, rep_innerprodu... |
import numpy as np
from scipy import constants
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib as mpl
import meep
import meep_ext
import pinboard
job = pinboard.pinboard()
### transformation optics
nb = 1.33
scale = nb
nm = 1e-9*scale
um = 1e-6*scale
### geometry
radius = 7... |
<filename>Other_Documents/Code_Python/Kalman_Tracking/display_depth_cloud.py
## <NAME>, 16 April 2019
# Goal: Visualization of a 3D point cloud with Matplotlib
# Points are previously written in a textfile
# Each row is x,y,z separated by commas
import numpy as np
from matplotlib import pyplot as plt
import glob
... |
<reponame>amadavan/PhasorPy
import numpy as np
import scipy as sp
import scipy.sparse
import stukapy as st
def constructLP(network, formulation, alphap):
if formulation == 'ISF':
c, Aub, bub, Cub, Aeq, beq, Ceq, lb, ub = [], [], [], [], [], [], [], [], []
p0 = 1.
for lineOutage in network... |
# -*- coding: utf-8 -*-
"""nlp_analytics.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1x_zvmZxrJHddOzNrlVS3zdoTLeYSgyEO
# Purpose
This notebook accompanies the manuscript titled, "Parent Reflections on ABA: Analysis of 5,450 Open-Ended Respons... |
<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import print_function, division
# need linear algebra packages
import scipy.sparse.linalg as _sla
import scipy.linalg as _la
import scipy.sparse as _sp
import numpy as _np
from scipy.integrate import complex_ode
from joblib import delayed,Parallel
from numpy impo... |
<reponame>taylorlu/voicepuppet
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import tensorflow as tf
import numpy as np
import os
from optparse import OptionParser
import logging
import subprocess
from pixflow import PixFlowNet
from voicepuppet.bfmnet.bfmnet import BFMNet
from generator.loader import *
from generator... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 12 19:39:06 2020
@author: hongxing
"""
import sys
import argparse
import torch
import os
import torchvision as tv
import pandas as pd
import torchvision.transforms as transforms
import torch.nn as nn
import torch.optim as optim
import numpy as np
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#===========================================================================
# interpolate_compare.py
#
# Interactive Jitter modulation of audio files and generated waveforms
#
# See http://stackoverflow.com/questions/6783194/background-thread-with-qthread-in-pyqt
#
# Gener... |
#
# The MIT License (MIT)
#
# This file is part of RLScore
#
# Copyright (c) 2008 - 2016 <NAME>, <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 witho... |
<reponame>tihbe/PCRITICAL<filename>modules/topologies.py
from dataclasses import dataclass, asdict
from typing import Union, Tuple
import logging
import numpy as np
import networkx as nx
from modules import reporter
from scipy.spatial.distance import cdist
from scipy.sparse import bsr_matrix, vstack
from sklearn.metric... |
<gh_stars>0
from scipy import spatial
import pandas as pd
def tokenize(doc):
return doc.lower().split(" ")
def query_similarities(query_string, cosine_sim_threshold, top, bin):
loaded_tfidf_vectorizer = bin["loaded_tfidf_vectorizer"]
loaded_tfidf = bin["loaded_tfidf"]
df_data = bin["df_data"]
... |
from datetime import datetime, timezone
from pathlib import Path
from unittest.mock import patch
import pytest
import xarray as xr
from numpy.testing import assert_almost_equal, assert_array_equal
from scipy.io import loadmat
from xarray.testing import assert_allclose
from ewatercycle import CFG
from ewatercycle.forc... |
<filename>read_files.py
# Read Json File with Python
import json
with open('../atom_init.json') as f:
data = json.load(f)
# Read value from dict object and save into .csv
feat=[]
for k, v in data.items():
feat.append(v)
import csv
file = open("atom_features.csv", 'w', newline='')
with file:
wr = csv.writer(file... |
<gh_stars>0
#!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. 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/LICEN... |
<filename>sprcom.py
import numpy as np
import pymc3 as pm
import matplotlib.pyplot as plt
import theano.tensor as tt
from scipy.linalg import eigvalsh
from scipy.sparse import csr_matrix
from theano.sparse import as_sparse_variable
from theano.sparse import dot as t_sparse_dot
from theano... |
'''
a program for evaluating the quality of search algorithms using the vector model
it runs over all queries in query.text and get the top 10 results,
and then qrels.text is used to compute the NDCG metric
usage:
python batch_eval.py index_file query.text qrels.text n
output is the average NDCG over all the... |
from pathlib import Path
import shutil
from skimage.io import imread
import numpy as np
from numpy.testing import (assert_array_almost_equal,
assert_array_equal, assert_equal)
from scipy.spatial.transform import Rotation
from tadataka.interpolation import interpolation
from tadataka.dataset... |
<reponame>ggirelli/radiantkit
"""
@author: <NAME>
@contact: <EMAIL>
"""
from enum import Enum
import logging
import numpy as np # type: ignore
import os
import pandas as pd # type: ignore
import radiantkit as ra
from radiantkit import const, stat
from radiantkit.deconvolution import get_deconvolution_rescaling_facto... |
<gh_stars>0
import centrosome.cpmorphology
import matplotlib
import matplotlib.collections
import numpy
import scipy.ndimage
class OutlineArtist(matplotlib.collections.LineCollection):
"""An artist that is a plot of the outline around an object
This class is here so that we can add and remove artists for cer... |
<reponame>waterFlowin/CS10-medical-dashboard
# Necessary imports
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing
import statistics as stats
# Importing the files as pandas dataframes
df_1 = pd.read_csv('/Users/joannejordan/Desktop/RxClaims/Rx_BenefitPlan_201611... |
"""
Advent of code 2021
Day 19: Beacon Scanner
"""
from collections import Counter, deque
from typing import List, Any, Dict
import numpy as np
from numpy import ndarray
from scipy.spatial.transform import Rotation
from aoc.loader import LoaderLib
from aoc.utility import to_list_int
ROTATIONS = [
Rotation.from_e... |
<filename>chaospy/distributions/copulas/clayton.py
r"""
Clayton Copula.
The calculation of the derivative of the ``iphi`` function:
.. math::
\begin{eqnarray}
iphi(u) &= (1+\theta*u)^(-1/\theta) \\
iphi'(u) &= \theta*(-1/\theta)*(1+\theta*u)^(-1/\theta-1)
= \theta*\sigma(1+\theta*u, 1... |
#coding:utf-8
from __future__ import division
import torch
import torch.optim as optim
from adjacency import sparse_mx_to_torch_sparse_tensor
from net.gat import GCN_V
#from net.gcn_v import GCN_V
#from net.softmaxloss import GCN_V
import yaml
from easydict import EasyDict
from tensorboardX import SummaryWriter
import ... |
""" Unit tests for nmrglue/analysis/integration.py module """
import numpy as np
from scipy.stats import multivariate_normal
from numpy.testing import assert_array_almost_equal
import nmrglue as ng
from nmrglue.analysis.integration import integrate, ndintegrate
# test helper functions
def _build_1d_ppm_scale():
... |
<reponame>XuChanghhu/thgsp<filename>thgsp/filters/kernels.py<gh_stars>1-10
import math
from itertools import combinations
import numpy as np
import torch
from scipy.special import comb
# Utils
def get_kernel_name(kernel_array, identation=False):
get_name = np.vectorize(lambda f: '_'.join(f.__name__.split('_')[:-... |
"""
See class docs.
"""
import numpy as np
from scipy.signal import welch
class myDetector(object):
"""
Detects a LRLR signal.
Initialized as an attribute attached to myWorker,
and gets fed data as it comes in from the Arduino.
Keeps a single state as either idle/rising/ongoing/falling.
... |
"""
Quadratic eigenvalue problem solvers.
"""
from __future__ import absolute_import
import time
import numpy as nm
import scipy.sparse as sps
from sfepy.base.base import output, get_default
from sfepy.linalg.utils import max_diff_csr
from sfepy.solvers.solvers import QuadraticEVPSolver
def standard_call(call):
... |
<filename>correction_tools/alignment.py
import os,time
import numpy as np
from .. import _allowed_colors, _image_size, _num_buffer_frames, _num_empty_frames, _image_dtype
from .. import _correction_folder
def _find_boundary(_ct, _radius, _im_size):
_bds = []
for _c, _sz in zip(_ct, _im_size):
_bds.appe... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 14:52:15 2020
@author: cxue2
"""
from datetime import datetime
import numpy as np
from sklearn.metrics import confusion_matrix
from sklearn.metrics import roc_auc_score, roc_curve, auc
from sklearn.metrics import precision_recall_curve, average_p... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 25 11:30:35 2017
@author: Bartek
"""
# from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as dsp
import scipy.stats as stats
import os
import pandas as pd
from numpy.core.multiarray import ndarray
from sklearn.d... |
<reponame>SamuelmsWong/tensor2tensor
# coding=utf-8
# Copyright 2020 The Tensor2Tensor 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-... |
import numpy as np
from scipy.special import expit
from constants import *
class NeuralNetMLP(object):
def __init__(self, layers, random_state=None):
""" Initialise the layers as list(input_layer, ...hidden_layers..., output_layer) """
np.random.seed(random_state)
self.num_layers = len(layers)
self.layers = l... |
<reponame>epiproject/FaST-LMM-HPC
import subprocess
import os
import scipy
import scipy.io as IO
import sys
import logging
# methods to call FaSTLMM-C++ Code
def runLIN(bfile,pheno,outFilename,fastlmm_path=None,**kwargs):
'''
use linear model for filtering SNPs
-----------------------------------... |
"""
PL Modeling Program
Python file 1/3: InteractivePLFittingGUI.py (implements the GUI)
-> Python file 2/3: PLModeling.py (implements the PL emission models)
Python file 3/3: InterferenceFunction.py (implements the interference function models)
Author: <NAME>
Date: March 2021
"""
import scipy.special
import scipy.con... |
<filename>src/bot/handlers/story_part_handler.py
from datetime import datetime
from typing import List, Optional
from aiogram import types, Dispatcher, filters
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters.state import StatesGroup, State
from aiogram.types import ReplyKeyboardMarkup, ReplyK... |
<filename>src/analysis/ttest_analysis.py
from collections import namedtuple
from pathlib import Path
import numpy as np
import pandas as pd
from scipy import stats
from .csv_analysis import analyze_data, load_surveys
from ..data.survey_utils import ExperimentType
TTEST_DIR = Path(__file__).parent.joinpath("../../mo... |
<reponame>valeoai/NeeDrop
import numpy as np
import torch
import os
import glob
from scipy.spatial import KDTree
class Dataset:
def __init__(self, config, split="training", num_mesh=None, **kwargs):
self.cfg = config
self.dataset_root = config["dataset_root"]
self.num_manifold_... |
<filename>task-plugins/securingai_builtins/metrics/distance.py
# This Software (Dioptra) is being made available as a public service by the
# National Institute of Standards and Technology (NIST), an Agency of the United
# States Department of Commerce. This software was developed in part by employees of
# NIST and in ... |
<filename>cornac/models/knn/recom_knn.py
# Copyright 2018 The Cornac 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/LICEN... |
from qutip import *
import numpy as np
import scipy
from scipy import stats
import itertools
import random
import matplotlib.pyplot as plt
import pickle
from time import time
import simulate_povm
from pathlib import Path
import os
import qdiscord
from plot_settings import *
def state_00_11(p0, p1):
s0 = basis(2, 0) ... |
<filename>MainFile_OptPRFF_RFF_Nyst_ORF.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 14 15:40:47 2017
@author: damodara
"""
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 21 15:48:47 2016
@author: damodara
"""
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 14 14:50:12 2016
@author... |
<gh_stars>1-10
#!/usr/bin/env python
"""File: shapes.py
Module defining objects for geometric shapes, with attributes to retrieve
parameters characterizing the shapes, and plotting methods to include the
shapes matplotlib figure.
"""
# Copyright 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "Lic... |
<gh_stars>0
# -*- coding: utf-8 -*-
import numpy as np
import torch
import scipy
class PlaceCells(object):
def __init__(self, options, us=None):
self.Np = options.Np
self.sigma = options.place_cell_rf
self.surround_scale = options.surround_scale
self.box_width = options.box_width
... |
import birankpy
import pandas as pd
import sys
import numpy as np
from scipy import stats
import argparse
def read_data(filepath):
try:
data = pd.read_csv(filepath)
# print("loading data ")
except:
data = pd.read_csv(filepath,sep='\t')
# print("loading data ")
first_colum... |
<reponame>deapplegate/wtgpipeline
dtop = {'OBJNAME':'MACS1149+22','PPRUN':'2000-12-27_W-C-IC'}
''' retrieve all random fits '''
db_keys_f = describe_db(c,['fit_db'])
command="SELECT * from fit_db where OBJNAME='" + dtop['OBJNAME'] + "' and PPRUN='" + dtop['PPRUN'] + "' and sample_size like 'rand%'"
print co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.