text string |
|---|
import os
import re
import sys
import math
import time
import string
import random
import warnings
from functools import partial
import numpy as np
from scipy import stats
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
from astropy import wcs
from astropy import units as u
from astropy.io impor... |
<gh_stars>0
# Copyright (c) 2022, Chair of Software Technology
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice, this lis... |
# Importar as seguintes bibliotecas
import sympy as sp
import numpy as np
# Definir a letra x como parametro
x = sp.Symbol('x')
##-------- Início dos métodos auxiliares --------##
# Método para construção do numerador
def padeExponencialNumerador( grauDoNumerador, grauDoDenominador ):
# definir parâmetros e obj... |
'''
CODE COPIED FROM: https://jakevdp.github.io/PythonDataScienceHandbook/05.12-gaussian-mixtures.html
Python Data Science Handbook
by <NAME>
Released November 2016
Publisher(s): O'Reilly Media, Inc.
ISBN: 9781491912058
'''
import os
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
impor... |
<reponame>SankaW/teamfx
from flask import Flask,redirect, url_for, request
import pandas as pd
import scipy.stats as ss
import numpy as np
import math
from pandas import to_datetime
from collections import Counter
from sklearn import mixture
import os,gc
import anomalies.config as config
def get_percentage(percent, n... |
<filename>src/graph_modeling/training/dataset.py
import math
from pathlib import Path
from time import time
from typing import *
import attr
import numpy as np
import pandas as pd
import torch
from loguru import logger
from scipy.sparse import load_npz
from torch import Tensor, LongTensor
from torch.utils.data import ... |
import numpy as np
from scipy.interpolate import interp1d
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.colors as mcolors
import sys
from os.path import dirname, realpath
pypath = dirname(dirname(dirname(realpath(__file__)))) + '/python/'
sy... |
<gh_stars>0
from __future__ import division
import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin
from skimage.morphology import remove_small_objects, binary_closing, disk, rectangle
from scipy.ndimage.morphology import binary_fill_holes
from sklearn.metrics import precision_recall_fscore_support
i... |
import numpy as np
import statistics as s
from scipy.stats import pearsonr
Xs = np.array([0.0339, 0.0423, 0.213, 0.257, 0.273, 0.273, 0.450, 0.503, 0.503, \
0.637, 0.805, 0.904, 0.904, 0.910, 0.910, 1.02, 1.11, 1.11, 1.41, \
1.72, 2.03, 2.02, 2.02, 2.02])
Ys = np.array([-19.3, 30.4, 38.7, 5.52, -33.1, -77.3, 398.0, 40... |
<reponame>leking6176/PHYS-3211<filename>Exam 2/attempt1.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 9 17:54:03 2019
Exam 2 Physical Pendulum
@author: <NAME>
"""
"""
import numpy as np
import scipy as sc
#t=np.arange(0,10.001,.01)
#y=np.arange(0,10.001,.01)
#y[0]=.001
g=9.8
... |
from __future__ import print_function
import io
import six
import numpy
import dynet as dy
from enum import Enum
from xml.sax.saxutils import escape, unescape
from lxml import etree
from scipy.stats import poisson
import xnmt.linear as linear
import xnmt.expression_sequence as expression_sequence
from xnmt.events i... |
from datetime import datetime
import pandas as pd
import numpy as np
from statistics import mean
from fate_manager.db.db_models import ApplySiteInfo
from fate_manager.entity.types import FateJobStatus, FateJobType, FateJobEndStatus
from fate_manager.operation.db_operator import SingleOperation
from fate_manager.oper... |
import pygame
import time
import numpy as np
try:
from pudb import set_trace as st
except ModuleNotFoundError:
st = lambda: None
import scipy.misc
import sys
from kaleidoscope import world, templates, visualization
from kaleidoscope.world import BLACK, WHITE
#with World(x, y, dx, dy, name, agent=random_agent... |
<gh_stars>0
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import requests
import tensorflow_datasets as tfds
import tqdm
import tensorflow_hub as hub
import os
import gc
import shutil
import re
import lpips
import cv2
import time
import logging
import urllib.request
from sci... |
<reponame>Goettcke/kNN_BPP
from numpy import genfromtxt
from scipy.sparse.construct import random
from random import sample
from sklearn.utils import shuffle
from knn_bpp import kNN_BPP
from cw_knn import CW_kNN
from direct_cs_knn import DIRECT_CS_kNN
# Load an imbalanced dataset
numpy_array = genfromtxt("dataset/der... |
<gh_stars>0
import numpy as np
import subprocess
import os
import tempfile
import meshio
import shutil
from scipy import optimize
#def simplify(points, ratio=0.5, agressive=7):
# prefile = tempfile.NamedTemporaryFile(suffix=".obj")
# postfile = tempfile.NamedTemporaryFile(suffix=".obj")
# print("Writing out {... |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.3
# kernelspec:
# display_name: tcv-x21
# language: python
# name: tcv-x21
# --... |
<gh_stars>1-10
""" Script to link FCEN nutritional data to OFF ingredients """
import json
from statistics import mean
import math
import pandas as pd
from ingredients_characterization.vars import FCEN_DATA_FILEPATH, FCEN_OFF_LINKING_TABLE_FILEPATH
from data import INGREDIENTS_DATA_FILEPATH
def main():
links =... |
# --------------
# Importing header files
import numpy as np
import pandas as pd
from scipy.stats import mode
import warnings
warnings.filterwarnings('ignore')
#Reading file
bank = pd.read_csv(path)
#Code starts here
categorical_var = bank.select_dtypes(include = 'object')
print(categorical_var.... |
<gh_stars>0
__doc__ = """ Spline for muscle torques acting on rod """
import numpy as np
def _bspline(t_coeff, l_centerline=1.0):
""" Generates a bspline object that plots the spline interpolant for
any vector x. Optionally takes in a centerline length, set to 1.0 by
default and keep_pts for keeping recor... |
import csv
import glob # for finding file within subdirs, python >= 3.5
import fnmatch # for finding file within subdirs, python < 3.5
import random
import os.path
import SimpleITK as sitk # for reading LUNA2016 mhd files
import numpy as np
import h5py
import scipy.ndimage
PATH_CANDIDATES_CSV = "/razberry/data... |
#List of functions :
# colorsGraphs(df, feature, genderConfidence = 1, nbToRemove = 1)
# text_normalizer(s)
# compute_bag_of_words(text)
# print_most_frequent(bow, vocab, gender, n=20)
# model_test(model,X_train,y_train,X_test,y_test, full_voc, displayResults = True, displayColors = False)
# predictors(df,... |
<reponame>Prettyfinger/Twostream_reID<filename>featuremap.py
import os
import torch
import torchvision as tv
import torchvision.transforms as transforms
import torch.nn as nn
import torch.optim as optim
import argparse
import skimage.data
import skimage.io
import skimage.transform
import numpy as np
import matplotlib.... |
<reponame>yzha0802/python-bicluster-svd-implementation
import numpy as np
import scipy.linalg as la
def thred(z,delta):
return np.sign(z)*(np.abs(z)>=delta)*(np.abs(z)-delta)
def ssvd(X,gamu = 2, gamv =2, merr = 10**(-4), niter = 100):
n,d = X.shape
#initial value of u and v
U,s,VT = la.svd(X,full_mat... |
<gh_stars>0
from sympy.solvers import solve
from sympy.abc import x
from sympy import *
from algebreb.expresiones.polinomios import Polinomio
from algebreb.ejercicios.tipos_ejercicios import DosOperandos
class SistemaEcuaciones(DosOperandos):
def __init__(self, lado_derecho, lado_izquierdo) -> None:
super(... |
<gh_stars>0
"""
Usage: fitXs.py -i INPUT_FILE -c CHANNEL -t JSON_TABLE
Options:
-h --help Help.
-i --input_file INPUT_FILE Input file.
-c --channel CHANNEL Interaction channel (nu_cc, nu_nc, anu_cc, anu_nc).
-t --json_table JSON_TABLE JSON formatted table with all the ana... |
<gh_stars>0
import numpy as np
import pickle
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy import stats
import os,glob
import csv
from sklearn.cluster import KMeans
from matplotlib.lines import Line2D
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import FormatStrFormatter,ScalarFo... |
import numpy as np
import pandas as pd
from scipy.linalg import block_diag, norm
from pyFBS.utility import coh_frf
class VPT(object):
"""
Virtual Point Transformation (VPT) - enables transformation of measured responses to a virtual DoFs. Current
implementation enables rigid interface deformation modes an... |
import os
from os.path import join as pjoin
import numpy as np
import pandas as pd
import scipy.stats
import dask
from cesium import featurize
from cesium.tests.fixtures import (sample_values, sample_ts_files,
sample_featureset)
import numpy.testing as npt
import pytest
DATA_PATH ... |
<gh_stars>0
import numpy as np
from sailenv.agent import Agent
import time
import matplotlib.pyplot as plt
from scipy.stats import sem, t
import seaborn as sns
from opticalflow_cv import OpticalFlowCV
import pandas as pd
sns.set_style("white")
FLOWNET_FLAG = True
class Dataframe_Wrap:
def __init__(self, columns... |
<filename>generate_data2train.py
import scipy.io as sio
from PIL import Image
import numpy as np
import os
IMG_PATH = "./img_file/" #Please create the folder 'img_file' and put all images, which are used to train, into this folder.
SAVE_PATH = "./TrainingSet/"
IMG_H = 64
IMG_W = 64
def generate():
i... |
<gh_stars>10-100
"""
Copyright (c) 2019, National Institute of Informatics
All rights reserved.
Author: <NAME>
-----------------------------------------------------
Script for testing classification of ClassNSeg (the proposed method)
"""
import os
import torch
import numpy as np
import torch.utils.data
import torchvis... |
import numpy as np
from scipy.signal import find_peaks as fp
def _get_cps_from_R(R: np.ndarray, insensivity_index: int) -> np.ndarray:
return (
fp(np.flipud(np.rot90(R))[insensivity_index, :], height=0.05, distance=None)[0][
1:
]
- insensivity_index
)
|
<reponame>damuopel/TopOpt_SIMP
import sys
import numpy as np
from numpy.linalg import inv, det
from math import floor
import matplotlib.pyplot as plt
from scipy.sparse import csc_matrix,linalg
import gif
# Constants
defaultInputs = 6
tol = 1e-6
h = 1.0 # Elements size
E = 1000 # Young's Module
nu = 0.3 # Poisson ratio... |
<filename>1-pca/common.py
import matplotlib.pyplot as plt
import numpy as np
import os
import scipy.misc as misc
import tensorflow as tf
from tensorflow.contrib.layers import *
################################################################################
# 1. Define constants and helper functions
folder_path = 'at... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage.interpolation import zoom
from scipy.interpolate import griddata
try:
import plotly.graph_objects as go
except ImportError:
pass
def matplotlib_plot_2d(stvariogram, kind='contour', ax=None, zoom_factor=100., levels=10, method='fast', **kwa... |
<reponame>federatedcloud/FRB_pipeline<filename>Pipeline/Modules/friends.py
''' The module contains tools to run a Friends-of-Friends search algorithm.
The main function is fof(), which is found at the bottom of this file.
Most other functions defined in this module are called by fof(),
and some may also b... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import time
import argparse
import numpy as np
from scipy.sparse import csr_matrix
import pandas as pd
import logging
from sklearn.decomposition import TruncatedSVD
from sklearn.linear_model import LinearRegres... |
<reponame>jeffreyjohnens/style_rank
import os
import csv
import json
import numpy as np
import warnings
from scipy.stats import rankdata
from subprocess import call
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics.pairwise import cosine_distances
from sklearn.preprocessing import OneHotEncoder
... |
import kwant
import sympy
a = sympy.symbols("a")
phi_0 = sympy.symbols("phi_0")
ri = sympy.symbols("x_i y_i z_i")
rj = sympy.symbols("x_j y_j z_j")
def get_phase(A):
"""Calculate Peierl's phase phi_ij
Parameters
----------
A : string
String representing vector potential. For example: "[-B_z ... |
import lsst.afw.table
import lsst.afw.image
import lsst.afw.math
import lsst.meas.algorithms
import lsst.meas.base
import lsst.meas.deblender
import os
# Hack to import PySynphot
from os.path import exists, isdir, basename
_pysynphot_ref_file_roots = (
'/Users/hcferguson/data/cdbs',
'/Users/jlong/cdbs',
'... |
#!/usr/bin/env python
"""
python Horn_Schunck.py data/box box.*
python Horn_Schunck.py data/office office.*
python Horn_Schunck.py data/rubic rubic.*
python Horn_Schunck.py data/sphere sphere.*
"""
import time
from scipy.ndimage.filters import gaussian_filter
import imageio
import matplotlib.pyplot as plt
from pathli... |
<reponame>Jie-Yuan/aizoo
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : aizoo.
# @File : feature_selector
# @Time : 2021/9/30 下午6:43
# @Author : yuanjie
# @WeChat : 313303303
# @Software : PyCharm
# @Description :
"""https://www.cnblogs.com/nolonely/p/6435083.html
1、为什... |
<reponame>buaales/tt_offline_scheduler
import typing
import networkx
import networkx.algorithms.approximation
import matplotlib.pyplot as plt
import pprint
import math
import pandas
from fractions import Fraction
from collections import defaultdict
class Frame:
_id = 0
def __init__(self, app: 'Application', ... |
<gh_stars>1-10
"""
Audio recorder and player classes built on pyaudio.
"""
import time
import wave
import cStringIO
import pyaudio
import scipy.io.wavfile
class AudioPlayer(object):
""" Asynchronous audio player. NOT WORKING WELL."""
def __init__(self, wav_filename):
self.wave_file = wave.open(wav... |
<reponame>daniilpastukhov/serendipity_experiments
# ref: <NAME>
import json
import pandas as pd
import numpy as np
from scipy.sparse import csr_matrix
from sklearn.neighbors import NearestNeighbors
from tqdm import tqdm
from utils.helpers import get_movies_by_ids
from utils.metrics import unexpectedness, relevance
... |
<gh_stars>0
import numpy as np
import vtk
from pathlib import Path
from scipy.spatial import Delaunay
import pyvista as pv
def form2DGrid(coords_array, connectivity_array=None) -> pv.UnstructuredGrid:
"""Create 2D VTK UnstructuredGrid from coordinates and connectivity
If connectivity_array has 4 IDs per eleme... |
<filename>make_figure.py
import numpy
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from astropy.stats import LombScargle
from astropy.io import fits
from astropy import units
from astropy.constants import c
def running_median(data, kernel):
"""Returns sliding median of width 'kernel' and... |
<filename>Dynamic_MeanVariance.py
"""============================================================================
Copyright 2017 <NAME> (<EMAIL>)
Description
-----------
This module is a prototype for dyanmic asset allocation
under various asset dynamics
[1] Dynamic Mean-Variance Asset Allocation
Refer... |
import os
import pickle
import numpy as np
import soundfile as sf
from scipy import signal
from scipy.signal import get_window
from librosa.filters import mel
from numpy.random import RandomState
import argparse
import librosa
import pyloudnorm as pyln
parser = argparse.ArgumentParser()
parser.add_argument('--root-dir... |
import matplotlib
matplotlib.use('Agg')
import flask
from flask import Flask, request, render_template, session
from sklearn.externals import joblib
import numpy as np
from scipy import misc
from flask import send_from_directory
from skimage.io import imread
from skimage.filters import threshold_otsu
from skimage impo... |
import egp.gaussianField as GF
import egp.powerSpectrum as PS
cosmology8 = {
'omegaM': 0.268,
'omegaB': 0.044,
'omegaL': 0.732,
'h': 0.704,
'trans': PS.trans8,
'primn': 0.947,
'rth': 8./0.7,
'sigma0': 0.776,
'TCMB': 2.7
}
logk = np.linspace(-3,3,601)
k = 10**logk
power = PS.powerspectrum(k, 1., cosmology8)
logpower ... |
<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
from typing import Tuple
import pandas as pd
from scipy.stats import ks_2samp
from evidently.analyzers.stattests.registry import StatTest, register_stattest
def _ks_stat_test(
reference_data: pd.Series,
current_data: pd.Series,
feature_type: ... |
<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 10 21:58:45 2021
@author: zengke
"""
import pandas as pd
from BDMLtools.selector import binSelector
from BDMLtools.encoder import woeTransformer
import shap
from scipy.stats import pearsonr,spearmanr
from lightgbm import LGBMClassifi... |
<reponame>jpanikulam/sonder
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import cv2
import scipy.linalg
from points import points as sonar_points
def rot3d(theta, axis):
wx = np.cross(np.identity(3), axis / np.linalg.norm(axis) * theta)
return scipy.linalg.... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.special import eval_legendre,legendre
from scipy.integrate import quad
import math
n = float(input("enter the positive integer n : "))
x = float(input("enter the value of x : "))
def gm(n):
if n == 1:
return 1
elif n == 0.5:
... |
# Python 2 compatibility
from __future__ import print_function
from __future__ import division
import os
import pkg_resources
import numpy as np
import pytest
import tables
from scipy.special import erf
# Related modules
try:
import cantera as ct
except ImportError:
print("Error: Cantera must be installed.")
... |
<filename>polarization/test_lorentz.py
from satlasaddon import RateModel, RateModelPolar
import satlas as sat
sat.set(['standard'])
import numpy as np
import matplotlib.pyplot as plt
import scipy.constants as csts
EV_TO_MHZ = csts.physical_constants['electron volt-hertz relationship'][0] * 1e-6
ABC = [[-520, 0, 0], [... |
<filename>crosstalk_cancellation.py<gh_stars>1-10
#!/usr/bin/env python
import argparse
import math
import logging
import numpy as np
import scipy.signal
import audio
logger = logging.getLogger(__name__)
def process_file(audio_path, output, spkr_to_spkr, lstnr_to_spkr, ear_to_ear):
"""
Read stereo binaural... |
<filename>src/stk/molecular/topology_graphs/cage/two_plus_five/twelve_plus_thirty.py
"""
Twelve Plus Thirty
==================
"""
from scipy.constants import golden
from ...topology_graph import Edge
from ..cage import Cage
from ..vertices import LinearVertex, NonLinearVertex
class TwelvePlusThirty(Cage):
"""... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 10.15 from Kane 1985."""
from __future__ import division
from sympy import expand, sin, cos, solve, symbols, trigsimp, together
from sympy.physics.mechanics import ReferenceFrame, Point, Particle
from sympy.physics.mechanics import dot, dynamicsymbols, msprint
... |
"""
This module defines the Bonsai class and its basic templates.
The Bonsai class implments splitting data and constructing decision rules.
User need to provide two additional functions to complete the Bonsai class:
- find_split()
- is_leaf()
"""
# Authors: <NAME> <<EMAIL>>
# License: Apache License 2.0
from bonsai.c... |
<filename>specutil.py
import math
from collections import Counter
import numpy as np
from scipy import signal
def stft(X, nfft=1024, noverlap=None, window='hann', fs=1.0, S=0, G=0, Gr=0):
"""Computes the short-time Discrete Fourier Transform of X.
This function doesn't pad or extend the input but truncates it... |
import numpy as np
import torch
from CVAE_testbed.metrics.inception import InceptionV3
from scipy import linalg
from torch.nn.functional import adaptive_avg_pool2d
from torch.autograd import Variable
def get_activations(images, model, batch_size=64, dims=2048,
cuda=True, verbose=False):
"""Calc... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from collections import Counter
from statistics import mean
from statistics import stdev
import pprint
import typing
from pymongo.operations import UpdateOne
from pymongo.errors import BulkWriteError
from base import BaseObject
from base import MandatoryParamError
from d... |
<filename>analysis/value_strategy_funcs.py
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from scipy import stats
from linearmodels import FamaMacBeth
from decimal import Decimal
from data_source import local_source
from tqdm import tqdm as pb
import datetime
def DataFrame_Updater(df_old, df_new, b... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
<gh_stars>1-10
import os
import sys; sys.path.append('./..')
import pickle
import numpy as np
import networkx as nx # requires 2.3.0
import pandas as pd; pd.options.display.float_format = '{:,.5f}'.format
import statsmodels.stats.api as sm
import warnings; warnings.filterwarnings("ignore", category=UserWarning)
from gl... |
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils.validation import check_is_fitted, check_random_state
import numpy as np
from math import inf
from scipy.optimize import nnls
def _optimize_alphas(B, A):
B = np.pad(B, ((0, 0), (0, 1)), 'constant', constant_values=200)
A = np.pad(A, (... |
import pandas as pd
import hoki.hrdiagrams
import hoki.cmd
import hoki.load as load
from hoki.constants import BPASS_TIME_BINS
import warnings
from hoki.utils.exceptions import HokiFatalError, HokiUserWarning, HokiFormatError, HokiFormatWarning
from hoki.utils.hoki_object import HokiObject
from hoki.utils.hoki_dialogue... |
<reponame>fgerzer/gnn_benchmark
import torch
from sklearn.model_selection import StratifiedKFold
from pandas import json_normalize
import pandas as pd
from typing import List
from gnn_benchmark.common.definitions import RunEntry
import itertools
import copy
import numpy as np
from functools import lru_cache
import sci... |
# General
import os, sys, pickle, json
import pandas as pd
import numpy as np
# Dash and plotly
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import plotly.graph_objs as go
# colors
import matplotlib
from matplotlib import cm
# Mat... |
<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Which alg can you use to solve a system of equations, and least squares.
Ax = b
With A matrix; x and b vectors
"""
import numpy as np
import scipy.linalg as sclin
import scipy
import sys
def pureDiagonal(matrix, debug=False):
"""Matrix is pure dia... |
"""
A simple tokenizer capable of extracting not only the words, but also both
numbers and ranges of them, automatically converting the last ones into
a universal format.
The main arguable disadvantage of this tokenizer is that it's unable to see
any tokens that don't match the regular expressions describing of what
a... |
from unsup_detection_spline import *
from pylab import *
from scipy.io.wavfile import read
import csv
import glob
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score
import random
import cPickle
def trainit(X_train,n_epochs,MODEL,l_r):
train_error = []
for... |
"""
Name : c15_14_GARCH_2_1.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
import scipy as sp
import numpy as np
import matplotlib.pyplot as plt
#
sp.random.seed(12345)
m=2
n=100 ... |
<filename>src/host/python/gsmlib/FCCH.py<gh_stars>1-10
from fractions import Fraction
from FB import FB
from CH import CH
from config import *
import numpy as np
from Burst import Burst
class FCCH(CH):
__burst__ = FB
__freq__ = Fraction(6500000,24)
def __init__(self):
CH.__init__(self)
self.name="FCCH"
def ca... |
from __future__ import print_function, division
import numpy as np
import os
import cv2
from PIL import Image
import random
from functools import partial
import tensorflow as tf
from keras.models import Model, Sequential, load_model
from keras.layers.merge import _Merge
from keras.layers import Input, Conv2D, MaxPooli... |
import numpy as np, sys
from scipy.linalg import logm
from getnr.getnr import get_nr
from cdmft.evaluation.common import Evaluation
from cdmft.h5interface import Storage
from cdmft.plot.cfg import plt
entropies = []
xs = []
for arch in sys.argv[1:]:
print 'loading '+arch+'...'
x = get_nr(arch, 'u')[0]
st... |
import os
import time
import datetime
import numpy as np
import matplotlib.pyplot as plt
import qutip.logging_utils as logging
import qutip.control.pulseoptim as cpo
import qutip.control.pulsegen as pulsegen
import scipy
from tools import *
class optcontrol_admm_energy():
def __init__(self):
self.J = N... |
import sys
from io import StringIO
from typing import Tuple
import numpy as np
from scipy.ndimage import label
def load_map(path: str) -> np.ndarray:
with open(path, 'r') as f:
text = '\n'.join([' '.join(list(s)) for s in f.readlines()])
heightmap = np.loadtxt(StringIO(text), dtype=int)
return he... |
<reponame>ergs/transmutagen<gh_stars>1-10
"""
exp(-t) on [0, oo) best CRAM coefficients from the appendix of the paper
"Extended Numerical Computations on the '1/9' Conjecture in Rational
Approximation Theory", <NAME>, <NAME>, and <NAME>
The coefficients have been OCRed from https://finereaderonline.com which uses
Abb... |
<gh_stars>1-10
import numpy as np
from scipy import stats
from scipy import integrate
from .narrowband import Narrowband
from ..tools import pdf_rayleigh_sum
class ModifiedFuCebon(Narrowband):
"""Class for fatigue life estimation using frequency domain
method by Benasciutti and Tovo[1].
References
... |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate, scipy.integrate
from scipy import special
plt.ion()
binprec = '>f4'
flag_plot = 0
flag_bt = 0 # 1: barotropic vortex, 0: baroclinic vortex
flag_eddy = 1 # 1: isolated eddy, 2: modon
flag_surf = 0 # 0: non perturbated... |
#!/usr/bin/env python
import argparse
import numpy as np
from scipy.stats import genextreme
import string
import sys
import subprocess
import random
import resource
import unittest
from time import sleep
from Bio import SeqIO
import re
import pyfaidx
parser = argparse.ArgumentParser(description='HGVS-based Synthetic R... |
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import scipy.stats
import numpy as np
import os.path as path
thisdir = path.dirname(path.realpath(__file__))
def _calc_alpha(p_list, n):
n_neighbors = len(p_list)
# the last alpha is responsible for all the people that shouldn't be mov... |
import seaborn as sb
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn import metrics
from sklearn.naive_bayes import GaussianNB
import warnings
warnings.filterwarnings("ig... |
<reponame>nikhilsu/Mixed-modal-learning
import os
import numpy as np
import tensorflow as tf
from scipy.misc import imread, imresize
from tqdm import trange
from hparams import hparams
from models import create_model
from util import audio
class Synthesizer:
def load(self, checkpoint_path, vgg19_path, model_nam... |
<reponame>nontas/menpo3d<gh_stars>1-10
import numpy as np
from collections import namedtuple
optimise = None # expensive, from scipy
RadialFitResult = namedtuple('RadialFitResult', ['centre', 'radius'])
def radial_fit(p):
"""
Find the least squares radial fitting a set of ND points.
Parameters
---... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import sparse
def get_bin_trials(m, n):
"""
Do a trial of throwing m balls into n bins
Parameters
----------
m: int
Number of balls
n: int
Number of bins
Returns
-------
trials: ndarray(m)
The... |
from PIL import Image,ImageFilter,ImageDraw,ImageEnhance
import random
import os
import numpy as np
from tqdm import tqdm
import sys
sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages')
import cv2
from libtiff import TIFF
import scipy.misc
from scipy import misc
#要裁剪图像的大小
img_w = 256
img_h =... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 04 13:23:27 2013
@author: Joey
"""
import copy
import time
import os
import math
import random
import hickle
import cPickle as pickle
import datetime
import warnings
import numpy as np
import scipy
import scipy.integrate
import scipy.fftpack
import multiprocessing
impor... |
<reponame>Navolo/amset<filename>amset/scattering/elastic.py
import logging
from abc import ABC, abstractmethod
import numpy as np
from typing import Dict, Tuple, Any
from scipy.constants import epsilon_0
from scipy.integrate import trapz
from amset.misc.constants import k_B, e, hbar
from amset.data import AmsetDa... |
<gh_stars>0
##########
## JACK493 DATA ANALYSIS SCRIPT
## 18-1 PSYC493
## JACK 'jryzkns' ZHOU 2018
##########
import pickle, sys, numpy as np, matplotlib.pyplot as plt
from caseclass import *
from math import sqrt
from scipy.stats import shapiro
def mat_mean(arrmat):
meanmat = np.zeros(len(arrmat[0])**2).res... |
<gh_stars>10-100
"""
Tests module experiments
# Author: <NAME>
# $Id$
"""
from __future__ import unicode_literals
__version__ = "$Revision$"
import sys
from copy import copy, deepcopy
import pickle
import os.path
import unittest
import numpy
import numpy.testing as np_test
import scipy
from pyto.analysis.experi... |
#%%
"""
Created on July 05 2021
The SZHW model and implied volatilities
This code is purely educational and comes from "Financial Engineering" course by <NAME>
The course is based on the book “Mathematical Modeling and Computation
in Finance: With Exercises and Python and MATLAB Computer Codes”,
by <NAME> and... |
from sympy import Matrix
from lab2.BranchnBound import BranchnBound
A_matrix = Matrix([[1, 4, 2, -6, 3, -7, 1], [-2, 5, 1, 0, 2, 6, 1], [3, -3, 1, 0, 4, -5, -1]])
b_matrix = Matrix([-2, 13, -1])
c_matrix = Matrix([-1, 2, 4, 8, 9, -3, 7])
d_lower = Matrix([-1, -2, 0, -3, -1, -2, -1])
d_upper = Matrix([4, 3, 2, 4, 6, 4,... |
from typing import Dict, List, Optional, Tuple
import numpy as np
import pandas as pd
from scipy.stats import rankdata
from sklearn.preprocessing import MinMaxScaler
from tabular_dataset.transformations.common import add_imputed_columns
from tabular_dataset.transformations.decorator import transformation
@transform... |
<filename>algos/default.py
"""Default scipy spherical Bessel function algorithms.
The wrappers defined in this module produce a uniform interface with the
other algorithms.
"""
import numpy as np
import scipy.special
@np.vectorize
def sph_jn(n, z):
return scipy.special.sph_jn(n, z)[0][-1]
@np.vectorize
def sph_... |
"""A collection of tools, tips, and tricks.
2009-07-20 22:36 IJC: Created
2010-10-28 11:53 IJMC: Updated documentation for Sphinx.
2011-06-15 09:34 IJMC: More functions have been added; cleaned documentation.
"""
import pdb
import numpy as np
def getfigs():
"""Return a list of all open matplotlib figures.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.