text string |
|---|
import pandas
from imblearn.over_sampling import RandomOverSampler
from nltk.tree import Tree
from scipy.sparse import hstack
from sklearn.base import TransformerMixin, BaseEstimator
from sklearn.feature_extraction import DictVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.pipeline i... |
"""
Graphing code for Stalk Market Predictions
Part of Stalk Market Bot.
"""
import logging
from io import BytesIO
from typing import TYPE_CHECKING, Optional, Dict, List, Union, Tuple, NamedTuple, Any
import matplotlib.pyplot as plt
from scipy.interpolate import Akima1DInterpolator, pchip_interpolate
import numpy as... |
<gh_stars>10-100
__author__ = 'rwechsler'
import datetime
import time
import cPickle as pickle
from annoy import AnnoyIndex
import gensim
import argparse
import numpy as np
import sys
import random
from scipy import spatial
import multiprocessing as mp
from collections import defaultdict
import codecs
def timestamp():... |
<gh_stars>0
# Steps for offline training:
# 1. load benign pcap file
# 2. extract features
# 3. train feature mapper model and save model
import numpy as np
from kitsune.FeatureExtractor import FE
from kitsune.KitNET import corClust as CC
from kitsune.KitNET import dA as AE
from scipy.stats import norm
from matplotlib ... |
<gh_stars>10-100
"""
Copyright 2018 Johns Hopkins University (Author: <NAME>)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
import numpy as np
from scipy import linalg as sla
from ...hyp_defs import float_cpu
from ...utils.math import (
invert_pdmat,
invert_trimat,
logdet_pdmat,
vec2... |
'''
------------------------------------------------------------------------
This program runs the steady state solver as well as the time path
solver for the OG model with S-period lived agents, exogenous labor,
M industries, and I goods.
This Python script calls the following other file(s) with the associated... |
<gh_stars>10-100
from matplotlib import rc
rc('text', usetex=True) # this is if you want to use latex to print text. If you do you can create strings that go on labels or titles like this for example (with an r in front): r"$n=$ " + str(int(n))
from numpy import *
from pylab import *
import random
from matplotlib.font_... |
<filename>rs_course/utils.py<gh_stars>0
# Copyright 2021-2022 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
import tensorflow as tf
from menpofit.visualize import plot_cumulative_error_distribution
from menpofit.error import compute_cumulative_error
from scipy.integrate import simps
from menpo_functions import load_menpo_image_list, load_bb_dictionary
from logging_functions import *
from data_loading_functions import *
from ... |
<filename>lang/python/matplotlib/dyn.py
import matplotlib.pyplot as p
from scipy import eye
import time
for x in xrange(3, 7):
p.imshow(eye(x))
p.show(block=False)
time.sleep(3)
print x
|
<gh_stars>1-10
from __future__ import absolute_import, division, print_function
import logging
import select
import subprocess
import fire
import logzero
import numpy as np
from logzero import logger
import itertools
import scipy
import scipy.optimize
import cPickle as pickle
logzero.loglevel(logging.DEBUG)
def gro... |
import json
import logging
import logging.handlers
import os
import re
import subprocess
import types
import uuid
import librosa
import numpy as np
import torch
from shutil import rmtree
from librosa.filters import mel as librosa_mel_fn
from scipy.io import wavfile
from daft_exprt.symbols import ascii, eos, punctua... |
<filename>Text_to_speech_GAN/waveFiles.py
import scipy.io.wavfile as siow
import scipy.signal as ssr
import matplotlib.pyplot as plt
import numpy as np
import math
def groupNumpy(to_group_array, interval, debug=True):
'''
Breaks numpy array into an array of arrays. Where each array is <interval> long.
Inputs:
... |
<filename>src/robotrunner.py
"""
Copyright (C) 2020-2022 <NAME>
"""
import plots
import mpc_cvx
# import time
# import sys
import numpy as np
import copy
from scipy.linalg import expm
import itertools
np.set_printoptions(suppress=True, linewidth=np.nan)
def projection(p0, v):
# find point p projected onto ground... |
<gh_stars>0
# -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>,
# <<EMAIL>>
#
# Distributed under the terms of the 3-clause BSD license.
# The full license is in the LICENSE... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 15 14:24:28 2020
@author: twguest
"""
import os
import numpy as np
from time import time
from wpg import srwlib
from felpy.model.tools import radial_profile
#from wpg.wpg_uti_wf import get_axis
from tqdm import tqdm
from felpy.utils.job_utils imp... |
<reponame>MaximeRedstone/UnstructuredCAE-DA
""" Data Loader for CAEs on Unstructured Meshes """
import sys, os, pickle, argparse
import numpy as np
from tabulate import tabulate
from datetime import datetime
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn.cluster import DBSCAN
fro... |
import os
import pandas as pd
import pickle as pkl
import numpy as np
import argparse
import yaml
import librosa
import scipy
from scipy.io import wavfile
import multiprocessing
import time
import datetime
import socket
def resample_wav_data(wav_data, orig_sr, target_sr):
""" Resample wav_data from sampling rate ... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 15 16:20:49 2016
@author: Philippe
"""
import numpy as np
from scipy.sparse.linalg import svds
from functools import partial
def em_svd(Y, k=None, tol=1e-3, maxiter=None):
"""
Approximate SVD on data with missing values via expectation-maximization
... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 13 09:14:27 2019
@author: hcji
"""
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1" # 这一行注释掉就是使用cpu,不注释就是使用gpu
import numpy as np
import keras.backend as K
from keras.models import Model
from keras.layers import Input, Dense, Add, concatenate, Conv1D, MaxPooling1D, ... |
import ynet
from util import *
from singa.layer import Conv2D, Activation, MaxPooling2D, AvgPooling2D, Flatten, Slice, LRN
from singa import initializer
from singa import layer
from singa import loss
from singa import tensor
import cPickle as pickle
import logging
import os
import numpy as np
from numpy.core.umath_te... |
import numpy as np
from scipy.optimize import fmin_cg
from utils.optimize import gradient_desc, computeNumericalGradient
from utils.utility import sigmoid, sigmoid_grad, ravel, unravel
import sys
np.set_printoptions(threshold=sys.maxsize)
np.seterr(divide = 'ignore')
class NeuralNetwork:
def __init__(self, hidde... |
<filename>tour5_damage_bond/damage2d_explorer.py
import numpy as np
import sympy as sp
import bmcs_utils.api as bu
from bmcs_cross_section.pullout import MATS1D5BondSlipD
s_x, s_y = sp.symbols('s_x, s_y')
kappa_ = sp.sqrt( s_x**2 + s_y**2 )
get_kappa = sp.lambdify( (s_x, s_y), kappa_, 'numpy' )
def get_tau_s(s_x_n1,... |
<filename>src/python/exsim3.py
"""
Laboratory Experiment 3 - Script
- Rootlocus project
@author <NAME>
"""
from sympy import *
def simplifyFraction(G,s):
"""
Expand numerator and denominator from given fraction
"""
num,den = fraction(G.expand().simplify())
num = Poly(num,s)
den = Poly(den,s)... |
from astropy.table import Table
from collections import OrderedDict
import numpy as np
from .spectrum import Spectrum1D
from copy import deepcopy
from scipy import signal
def read_expres(fname, full_output=False, as_arrays=False, as_order_dict=False, as_raw_table=False):
if full_output:
raise NotImplemente... |
<gh_stars>0
import logging
import os
import pickle
from typing import NamedTuple
import gym
from gym import Wrapper, GoalEnv
from gym.wrappers import FlattenObservation, TimeLimit, TransformReward, FilterObservation
from runstats import Statistics
import torch
from envs.gym_mujoco.custom_wrappers import DropGoalEnvsA... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 11.5 from Kane 1985."""
from __future__ import division
from sympy import expand, solve, symbols, trigsimp
from sympy import sin, tan, pi
from sympy.physics.mechanics import Point, ReferenceFrame, RigidBody
from sympy.physics.mechanics import dot, dynamicsymbol... |
import numpy as np
from scipy.linalg import eigh
import voice_activity_detector
import features_extraction
import statistics
import utils
def get_sigma(ubm, space_dimension):
sigma = np.zeros(shape=(len(ubm.covariances) * len(ubm.covariances[0])))
k = 0
for i in range(len(ubm.covariances[0])):
fo... |
<gh_stars>0
'''
This module contains a medley of sklearn transformers which can be integrated
into a pipeline.
'''
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.decomposition import PCA
from scipy.stats import kstat
from homcv import betti_numbers
class CumulantsExtractor(B... |
# -*- coding: utf-8 -*-
import time
import numpy
from krypy.linsys import LinearSystem, Cg
from krypy.deflation import DeflatedCg, DeflatedGmres, Ritz
from krypy.utils import Arnoldi, ritz, BoundCG
from krypy.recycling import RecyclingCg
from krypy.recycling.factories import RitzFactory,RitzFactorySimple
from k... |
<filename>vision/follow-line/actions.py
import math
import time
from scipy import interpolate
from threading import Lock
from abc import abstractmethod
from library.pid import PID
from stack import ActionStack
class BaseAction:
@abstractmethod
def undo(self):
pass
@staticmethod
def is_checkpo... |
import tensorflow as tf
tf.set_random_seed(42)
import numpy as np
from scipy import integrate
import neural_networks
import poisson_problem
import matplotlib.pyplot as plt
import sys, getopt
class sampling_from_dataset:
def __init__(self, filepath, total_samples):
self.filepath = filepath
self.total_samples = ... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy.stats import norm
from scipy.optimize import brentq
from arpym.tools.transpose_square_root import transpose_square_root
def saddle_point_quadn(y, alpha, beta, gamma, mu, sigma2):
"""For details, see here.
Parameters
----------
y : array, shape... |
<reponame>Honzaik/PocAlgDU
from cmath import exp, pi
from math import log2
def vratLiche(a):
oddA = list();
for i in range(len(a)):
if(i % 2 == 1):
oddA.append(a[i])
return oddA
def vratSude(a):
evenA = list()
for i in range(len(a)):
if(i % 2 == 0):
evenA.ap... |
# Download data, unzip, etc.
from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
import scipy.stats as st
# Set some parameters to apply to all plots. These can be overridden
# in each plot if desired
import matplotlib
# Plot size to 14" x 7"
matplotlib.rc('figure', figsize = (14, 7))
# Font... |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
Naturalunit system.
The natural system comes from "setting c = 1, hbar = 1". From the computer
point of view it means that we use velocity and action instead of length and
time. Moreover instead of mass we use energy.
"""
from __future__ import division
from sympy... |
from click.exceptions import FileError
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
from . import util
import numpy as np
import click
import sys
import csv
import os
def pt1(t, K, T):
""" time-domain solution/formula for
a first-order/pt1 system
Args:
t (float): time
K (float): ... |
"""Python C API alternative to `fractions` module."""
__version__ = '1.4.0'
try:
from _cfractions import Fraction
except ImportError:
import numbers as _numbers
from fractions import Fraction as _Fraction
from typing import (Any as _Any,
Dict as _Dict,
O... |
############################
# This example shows how to run pygosolnp with Truncated Normal distribution using Numpy and Scipy
############################
from typing import List, Optional
# Numpy random has the PCG64 generator which according to some research is better than Mersenne Twister
from numpy.random impor... |
<filename>GLM/GLM_Model/GLM_Model_GP.py
import numpy as np
import matplotlib.pyplot as plt
import torch
import scipy
from GLM.GLM_Model import GLM_Model, PyTorchObj
from scipy.optimize import minimize, Bounds
from tqdm import tqdm
class GLM_Model_GP(GLM_Model.GLM_Model):
def __init__(self, params):
super... |
<reponame>blackrhinoabm/sabcom
import random
import numpy as np
import pandas as pd
import math
from sklearn import preprocessing
import scipy.stats as stats
def edge_in_cliq(edge, nodes_in_cliq):
if edge[0] in nodes_in_cliq:
return True
else:
return False
def edges_to_remove_neighbourhood(a... |
<reponame>macthecadillac/Interacting-Fermions
import copy
import functools
import os
import numpy as np
from scipy import sparse
from spinsys import constructors, half, dmrg, exceptions
from cffi import FFI
class SiteVector(constructors.PeriodicBCSiteVector):
def __init__(self, ordered_pair, Nx, Ny):
sup... |
<reponame>jennan/crash_prediction
# # Exploration of the crash severity information in CAS data
#
# In this notebook, we will explore the severity of crashes, as it will be the
# target of our predictive models.
from pathlib import Path
import numpy as np
import pandas as pd
import scipy.stats as st
import matplotlib... |
# -*- coding: utf-8 -*-
import unittest
import cmath
import numpy as np
from scipy import integrate
from .. import polarization
from ...utils import instance
from ...patch import jsonpickle
class test_polarization(unittest.TestCase):
def _equal_params(self, params1, params2):
for k, v in params1.items()... |
<filename>ANOVA.py
import itertools
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from scipy.stats import f
from scipy.stats import norm
class ANOVA:
"""Analyse DOE experiments using ANOVA. NB: n > 1 for the code to work, where n is the number of repeats.
Model: y... |
<filename>transforms.py
import cv2
import numpy as np
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage.interpolation import map_coordinates
def upsample(image, image_size_target):
padding0 = (image_size_target - image.shape[0]) / 2
padding1 = (image_size_target - image.shape[1]) / 2
pa... |
<reponame>alex-cobb/python-spowtd<gh_stars>0
"""Transmissivity classes
"""
import numpy as np
import scipy.integrate as integrate_mod
import spowtd.spline as spline_mod
def create_transmissivity_function(parameters):
"""Create a transmissivity function
Returns a callable object that returns transmissivit... |
import os
import os.path as osp
__all__ = [
'pack_images',
'plot_and_pack',
'save_images'
]
def pack_images(output, imgs, vmax=1024.0, archive=None, name="image_%d.png", **data):
from scipy.misc import toimage
try:
os.makedirs(output)
except:
pass
for i in range(imgs.shape[0]):
args = dict... |
<gh_stars>0
# taken largely from https://github.com/ianvonseggern1/note-prediction
from pydub import AudioSegment
import pydub.scipy_effects
import numpy as np
import scipy
import matplotlib.pyplot as plt
from solo_generation_esac import *
from utils import frequency_spectrum, \
calculate_distance, \
classify... |
import base64
import datetime, pytz
from re import X
import io
from matplotlib import pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from scipy import spatial
from skyfield.api import load, Star
from skyfield.projections import build_stereographic_projection
from ..astro.angdi... |
<reponame>nicktfranklin/EventSegmentation
import numpy as np
from models import SEM, clear_sem
from sklearn import metrics
import pandas as pd
from scipy.special import logsumexp
def logsumexp_mean(x):
return logsumexp(x) - np.log(len(x))
def batch_experiment(sem_kwargs, n_train=1400, n_test=600, progress_bar=Tru... |
<gh_stars>0
"""
Mag Square
#always do Detective work nm what
UNDERSTAND
-nxn matrix of distinctive pos INT from 1 to n^2
-Sum of any row, column, or diagonal of length n is always equal to the same
number: "Mag" constant
-Given: 3x3 matrix s of integers in the inclusive range [1,9]
we can convert any digit a... |
import fractions
from pprint import pprint
lcm_limit = 32
octave_limit = 4
candidates = [(x, y) for x in range(1, lcm_limit + 1) for y in range(1, lcm_limit + 1)]
candidates = [c for c in candidates
if fractions.gcd(c[0], c[1]) == 1
and c[0] * c[1] <= lcm_limit
and 1 / octave_limit <= c[0] / c[1] <= octave_limit]
... |
<filename>validation/synthetic_promoters.py<gh_stars>1-10
#!/usr/bin/env python
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="0"
import common as cm
import tensorflow as tf
import numpy as np
import math
from scipy import stats
from Bio.Seq import Seq
half_size = 500
batch... |
""" General Utilities file. """
import sys
import os
############################ NON-TF UTILS ##########################
from skimage.util import img_as_float
import numpy as np
import cv2
import pickle
from PIL import Image
from io import BytesIO
import math
import tqdm
import scipy
import json
import matplo... |
import argparse
from pathlib import Path
import numpy as np
import scipy
import keras
from keras.models import load_model
from moviepy.editor import VideoFileClip, concatenate_videoclips
from tqdm import tqdm
def main():
# yapf: disable
parser = argparse.ArgumentParser(description='Video Highlight')
pa... |
<filename>audio_processing.py
import torch
import torch.nn.functional as F
import torchaudio
import numpy as np
from scipy.signal import get_window
from librosa.util import pad_center, tiny
from librosa.filters import window_sumsquare
from librosa.filters import mel as librosa_mel_fn
def get_mel_basis(sampling_rate=... |
<filename>Scripts/simulation/objects/components/object_inventory_component.py
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\objects\components\obj... |
<filename>2_Regression/Energy_balance_MIMO/Python_minimize/mimo_fit.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
from scipy.optimize import minimize
import pandas as pd
# generate data file from TCLab or get sample data file from:
# http://apmonitor.com/pdc/index.php... |
""" base estimator class for megaman """
# Author: <NAME> -- <<EMAIL>>
# LICENSE: Simplified BSD https://github.com/mmp2/megaman/blob/master/LICENSE
import numpy as np
from scipy.sparse import isspmatrix
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils.validation import check_array
from ... |
# coding=utf-8
# Copyright 2018 The DisentanglementLib 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
#
# Un... |
<filename>forexml.py
import numpy
from scipy import stats
from modules import controler
# To compile, us Auto Py to Exe:
# Step 1 - install Auto Py to Exe, if not already done
# To install the application run this line in cmd:
# pip install auto-py-to-exe
# To open the application run this line in cmd:
# auto-py-to-ex... |
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import PoseStamped
from styx_msgs.msg import Lane, Waypoint
from scipy.spatial import KDTree
import numpy as np
from std_msgs.msg import Int32
import math
'''
This node will publish waypoints from the car's current position to some `x` distance ahead.
As men... |
#!-*- conding: utf8 -*-
#coding: utf-8
"""
Aluno: <NAME>
Matricula: 401091
"""
import matplotlib.pyplot as pplt # gráficos
import math # Matemática
import re # expressões regulares
import numpy as np # matrizes
from statistics import pstdev # Desvi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sympy import *
x, y, z = symbols('x y z')
init_printing(use_unicode=True)
print(Eq(x, y))
print(solveset(Eq(x**2, 1), x))
print(solveset(Eq(x**2 - 1, 0), x))
print(solveset(x**2 - 1, x))
print(solveset(x**2 - x, x))
print(solveset(x - x, x, domain=S.Reals))
print(so... |
<filename>semesterIII/FADP/Exp2.py
# Solve the quadratic equation ax**2 + bx + c = 0
# import complex math module
import cmath
a=int(input("Enter a:"))
b=int(input("Enter b:"))
c=int(input("Enter c:"))
# calculate the discriminant
d = (b**2) - (4*a*c)
# find two solutions
sol1 = (-b-cmath.sqrt(d))/(2*a)
sol2 = (-b+cmat... |
r"""
.. _compartmental-modeling-tools:
Compartmental Modeling Tools
----------------------------
These functions build theoretical distributions with which to understand
how Dismod-AT works, and how disease processes work.
1. Specify a disease process by making simple Python functions that
return disease rates ... |
import sys
import warnings
import numpy as np
from scipy.stats import rankdata
TAB = ' '
maxfloat = np.float128 if hasattr(np, 'float128') else np.longdouble
class ReprMixin:
def __repr__(self):
return f'{self.__class__.__name__}\n' + '\n'.join([f'\t{k}: {v}' for k, v in self.__dict__.items()])
de... |
<reponame>hunterowens/frankenstein<gh_stars>1-10
import json
import pythonosc
import argparse
import math
import datetime
from pythonosc import dispatcher, osc_server, udp_client, osc_message_builder
import requests
from collections import OrderedDict
from statistics import mean
## added variables to change the ip and... |
from utils import *
from mpmath import ellipe, ellipk, ellippi
from scipy.integrate import quad
import numpy as np
C1 = 3.0 / 14.0
C2 = 1.0 / 3.0
C3 = 3.0 / 22.0
C4 = 3.0 / 26.0
def J(N, k2, kappa, gradient=False):
# We'll need to solve this with gaussian quadrature
func = (
lambda x: np.sin(x) ** (... |
<reponame>mlazzarin/qibo
"""Test Trotter Hamiltonian methods from `qibo/core/hamiltonians.py`."""
import pytest
import numpy as np
import qibo
from qibo import hamiltonians, K
from qibo.tests.utils import random_state, random_complex, random_hermitian
@pytest.mark.parametrize("nqubits", [3, 4])
@pytest.mark.parametri... |
<reponame>okumakito/dnb-bts<gh_stars>0
import numpy as np
import pandas as pd
from utils import calculate_q
from scipy import stats
def calculate_deg_fold_change(data1_df, data2_df, fc_cutoff=1,
alternative='two-sided'):
"""
This function calculates differentially expressed genes (DE... |
<filename>code/func/func.py
# Functions for project: NormativeNeuroDev_Longitudinal
# <NAME>, 2019
# <EMAIL>
from IPython.display import clear_output
import numpy as np
import scipy as sp
from scipy import stats
import pandas as pd
from statsmodels.stats import multitest
def get_cmap(which_type = 'qual1', num_classe... |
from sympy.functions import sqrt, sign, root
from sympy.core import S, Wild, sympify, Mul, Add, Expr
from sympy.core.function import expand_multinomial, expand_mul
from sympy.core.symbol import Dummy
from sympy.polys import Poly, PolynomialError
from sympy.core.function import count_ops
def _mexpand(expr):
return ... |
<reponame>binhhoangtieu/C3D-tensorflow
import cv2
import os
import glob
import numpy as np
from operator import itemgetter
# import matplotlib.pyplot as plt
import math
import scipy.stats as stats
def main():
video_dir = './UCF-101' #./testdata
result_dir = './UCF101-OF' #test-image
loaddata(video_dir = video_dir, ... |
from dataclasses import dataclass
from scipy.stats import nbinom # type: ignore[import]
from probs.discrete.rv import DiscreteRV
@dataclass(eq=False)
class NegativeBinomial(DiscreteRV):
"""
The negative binomial distribution is a discrete probability distribution
that models the number of failures k in... |
__author__ = 'luigolas'
import numpy as np
from scipy.stats import cumfreq
class Statistics():
"""
Position List: for each element in probe, find its same ids in gallery. Format: np.array([[2,14],[1,2],...])
Mean List: Calculate means of position list by axis 0. Format: np.array([1.52, 4.89])
Mode_li... |
<filename>Snow-Cooling/Libraries/HT_thermal_resistance.py
"""Object name: Resistance
Function name: serial_sum(R,nori,nend), performs serial sum of a resistance object list from nori to nend
Function name: parallel_sum(R,nori,nend), performs parallel sum of a resistance object list from nori to nend
"""
### de... |
# coding: utf-8
#
# This code is part of lattpy.
#
# Copyright (c) 2021, <NAME>
#
# This code is licensed under the MIT License. The copyright notice in the
# LICENSE file in the root directory and this permission notice shall
# be included in all copies or substantial portions of the Software.
"""Spatial algorithms a... |
<gh_stars>1-10
import numpy as np
import scipy.io
from sklearn.metrics import confusion_matrix
from random import randint, shuffle
from argparse import ArgumentParser
from helper import getValidDataset
import tensorflow as tf
parser = ArgumentParser()
parser.add_argument('--data', type=str, default='Indian_pines')
par... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import time
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import tensorflow as tf
from scipy.misc import imresize
from sklearn.cross_validation import train_test_split
import _pickle as cPickle
from train import train
class Alexnet:
de... |
import numpy as np
from scipy.linalg import solve_toeplitz, solve
from scipy.signal import fftconvolve
from scipy.interpolate import Rbf
from scorr import xcorr, xcorr_grouped_df, xcorrshift, fftcrop, corr_mat
# Helpers
# =====================================================================
def integrate(x... |
import tkinter as tk
from tkinter import ttk
from matplotlib.pyplot import close
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg,
NavigationToolbar2Tk)
from matplotlib.mathtext import math_to_image
from io import BytesIO
from PIL import ImageTk, Image
from sympy im... |
<reponame>anakinanakin/neural-network-on-finance-data<gh_stars>1-10
#source code: https://github.com/alvarobartt/trendet
import psycopg2, psycopg2.extras
import os
import glob
import csv
import time
import datetime
import string
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as ... |
"""
Distributions (Re)generation Script
This script generates likelihood and cost distributions based on threat
intelligence data stored in a connected Neo4j graph database. It attempts to
do so for every possible permutation of (size, industry) values.
These are then consumed by `montecarlo.py`, ... |
import numpy as np
from scipy.special import logsumexp
from scipy.optimize import minimize
from functools import partial
from dataclasses import dataclass, field
import matplotlib.pyplot as plt
@dataclass
class BindingDwelltimesBootstrap:
"""Bootstrap distributions for a binding dwelltime model.
This class i... |
<gh_stars>0
import numpy as np
import pandas as pd
from scipy.stats import expon, uniform
import sys
sys.path.append('../../well_mixed')
from well_mixed_death_clock import (WellMixedSimulator,
WellMixedSimulationData, exponential_ccm, uniform_ccm,
base_rate_death_signal)
# Exponential cell cycle model
tG1 = 5... |
import sys
import re
import json
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from sklearn.preprocessing import MultiLabelBinarizer
from scipy.spatial.distance import cdist
from colorama import Fore, Style
from kneed impo... |
import os
from . import utils
import numpy as np
from scipy.stats import scoreatpercentile
from scipy.optimize import curve_fit
from scipy import exp
import operator
from copy import copy, deepcopy
from collections import defaultdict, Counter
import re
from pyteomics import parser, mass, fasta, auxiliary as aux, achrom... |
import os
import sys
import copy
import ipdb
import json
import mat73
import numpy as np
import scipy.io as sio
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from lib.camera.camera import CameraInfoPacket, catesian2homogenous
rot = np.array([[1, 0, 0], [0, 0, -1], [0, 1, 0]]) # rotate along the x ax... |
from functools import partial
from typing import Tuple
import covasim as cv
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as st
def get_current_infected_ratio():
# Returns the current ratio of infected people in germany
number_infected = 651500 # https://www.deutschland.de/de/topic/p... |
<reponame>michaeljneely/sparse-attention-explanation<filename>ane_research/utils/kendall_top_k.py
'''Top-k kendall-tau distance.
This module generalise kendall-tau as defined in [1].
It returns a distance: 0 for identical (in the sense of top-k) lists and 1 if completely different.
Example:
Simply call kendall_to... |
import torch
import numpy as np
import logging, yaml, os, sys, argparse, time
from tqdm import tqdm
from collections import defaultdict
from Logger import Logger
import matplotlib
matplotlib.use('agg')
matplotlib.rcParams['agg.path.chunksize'] = 10000
import matplotlib.pyplot as plt
from scipy.io import wavfile
from ra... |
<filename>Chapter_BestPractices/Centering_Scaling.py<gh_stars>1-10
##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
## Centering & Scaling
## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#%% Standard scaling
import numpy as np
from... |
"""
Created on Sep 1, 2011
@author: guillaume
"""
from scipy import zeros
from chemex.bases.two_states.fast import R_IXY, DR_IXY, DW, KAB, KBA
def compute_liouvillians(pb=0.0, kex=0.0, dw=0.0,
r_ixy=5.0, dr_ixy=0.0):
"""
Compute the exchange matrix (Liouvillian)
The function a... |
#!/usr/bin/env python
import pandas as pd
from scipy import stats
import numpy as np
#import seaborn as sns
#import matplotlib.pyplot as plt
import math
from Bio import SeqIO
import io
import re
import pysam
from functools import reduce
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argum... |
# ___ ___ ___ ___ ___ ___
# /\ \ /\ \ /\ \ /\ \ /\ \ /\ \
# /::\ \ /::\ \ \:\ \ /::\ \ /::\ \ /::\ \
# /:/\:\ \ /:/\:\ \ \:\ \ /:/\:\ \ /:/\:\ \ /:/\:\ \
# /:/ \:\ \ /:/ \... |
<filename>theory/func/bardell/print_bardell_integrals_to_C.py
import os
import glob
from ast import literal_eval
import numpy as np
import sympy
from sympy import pi, sin, cos, var
from sympy.printing import ccode
from compmech.conecyl.sympytools import mprint_as_sparse, pow2mult
var('x1t, x1r, x2t, x2r')
var('y1t, ... |
<gh_stars>0
""" A module hosting all algorithms devised by Izzo """
import time
import numpy as np
from numpy import cross, pi
from numpy.linalg import norm
from scipy.special import hyp2f1
def izzo2015(
mu,
r1,
r2,
tof,
M=0,
prograde=True,
low_path=True,
maxite... |
import pprint
import statistics
from contextlib import suppress
from dataclasses import dataclass
from enum import Enum
from typing import Optional
@dataclass
class ValidCharacter:
definite_locations: set[int]
definite_not_locations: set[int]
class CharacterStatus(Enum):
GRAY = "gray"
GREEN = "green... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.