text string |
|---|
import numpy as np
from scipy.signal import savgol_filter
import scipy.constants
mec2 = scipy.constants.value("electron mass energy equivalent in MeV") * 1e6
c_light = scipy.constants.c
e_charge = scipy.constants.e
r_e = scipy.constants.value("classical electron radius")
def csr1d_steady_state_kick_calc(z, weights,... |
import pickle
import itertools
import numpy as np
from map_processing.graph_utils import optimizer_to_map
import matplotlib.pyplot as plt
from scipy.spatial.transform import Rotation as R
with open('converted-data/academic_center.pkl', 'rb') as data:
graph = pickle.load(data)
graph.generate_unoptimized_graph()
un... |
#!/usr/bin/env python3
"""
Signal analysis module for phys2cvr.
Attributes
----------
LGR :
Logger
"""
import logging
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate as spint
import scipy.stats as sct
from scipy.signal import butter, filtfilt
from phys2cvr.i... |
<reponame>dk-teknologisk-rtfh/ProcessOptimizer<gh_stars>0
import numpy as np
from scipy import optimize
from scipy.spatial.distance import pdist, squareform
try:
from sklearn.preprocessing import OrdinalEncoder
UseOrdinalEncoder = True
except ImportError:
UseOrdinalEncoder = False
from numpy.testing import ... |
#-*- coding:utf-8 -*-
from scipy.io import loadmat
from scipy.io import savemat
import numpy as np
import random
def sigmoid(z):
g=1/(1+np.exp(-z))
return g
l=0.1# lambda
train_set=loadmat('train')
weight=loadmat('theta')
X=np.mat(train_set['X'])
y=np.mat(train_set['y'])
m=y.shape[0]
print(m)
s1=X.shape[1]
s... |
<reponame>glimix/limix-genetics<gh_stars>0
from __future__ import division
import bokeh
import bokeh.plotting
from bokeh.models.sources import ColumnDataSource
from numba import jit
from numpy import (append, arange, argsort, empty, flipud, inf, linspace,
log10, logspace, partition, searchsorted, so... |
# Copyright (c) 2018, <NAME>
# All rights reserved.
#
# This file is part of the yambopy project
#
import os
from itertools import product
from yambopy import *
from cmath import polar
from yambopy.units import *
from yambopy.plot.plotting import add_fig_kwargs
from yambopy.lattice import replicate_red_kmesh, calculat... |
<reponame>chto/redmapper<filename>redmapper/fitters.py
"""Classes for fitting red sequence and related parameters.
This file contains the classes used to fit the red sequence model, including
the median relations, mean relations, scatter, covariance, etc.
"""
from __future__ import division, absolute_import, print_f... |
<reponame>kcyu2014/eval-nas
import logging
import operator
import os
import shutil
from functools import partial
import numpy as np
import torch
import torch.nn as nn
import torch.utils
from scipy.stats import kendalltau
import utils as project_utils
import torchvision.datasets as dset
from collections import named... |
#!/usr/bin/env python
__doc__ = """
This script estimate a transfer function (a pole or two poles or two poles and a zero) from a step response.
After loading step response waveform, it does fft to get a transfer function (phase data is lost). Then, it will try to fit the transfer function to one of TXF templates.
A... |
'''ResNet in PyTorch.'''
import os
import argparse
import shutil
import time
import json
import math
import operator
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.backends.cudnn as cudnn
import torchvision.datasets as dset
import torchvision.transforms as t... |
import pandas as pd
import numpy as np
import utils
from tensorflow.keras.preprocessing.sequence import pad_sequences
import tensorflow as tf
from tensorflow import keras
import config
from scipy.io import wavfile
import python_speech_features
class CleanDataGenerator(keras.utils.Sequence):
'Generates data for Ke... |
from sympy import (Symbol, gamma, expand_func, beta, digamma, diff, conjugate)
from sympy.functions.special.gamma_functions import polygamma
from sympy.core.function import ArgumentIndexError
from sympy.utilities.pytest import raises
def test_beta():
x, y = Symbol('x'), Symbol('y')
assert isinstance(beta(x, ... |
<reponame>pudo/nomenklatura
import pickle
import logging
import statistics
from itertools import combinations
from collections import defaultdict
from typing import Any, Dict, Generator, Generic, List, Optional, Set, Tuple, cast
from followthemoney.schema import Schema
from followthemoney.types import registry
from no... |
"""
Module containing raster blocks that aggregate rasters.
"""
from math import ceil, floor, log, sqrt
from collections import defaultdict
from functools import partial
import warnings
from scipy import ndimage
import numpy as np
import geopandas as gpd
from dask import config
from dask_geomodeling import measuremen... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Mon May 23 11:00:35 2016
@author: <NAME>
"""
# TODO: move all this into ReliablePy?
from __future__ import division, print_function, absolute_import
import numpy as np
from . import (zorro_util, zorro)
import time
import os, os.path, glob
import scipy.ndimage
im... |
<filename>demonstrations/tutorial_rosalin.py
r"""
Frugal shot optimization with Rosalin
=====================================
.. meta::
:property="og:description": The Rosalin optimizer uses a measurement-frugal optimization strategy to minimize the
number of times a quantum computer is accessed.
... |
<reponame>pymango/pymango<filename>misc/python/mango/application/plot.py<gh_stars>1-10
__doc__ = \
"""
=======================================================================
Application Specific Plotting Utilities (:mod:`mango.application.plot`)
=======================================================================
... |
<filename>rl_coach/spaces.py
#
# Copyright (c) 2017 Intel Corporation
#
# 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 b... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#This module implements the Spectrum1D class. It is eventually supposed to migrate to astropy core
from astropy.nddata import NDData
#!!!! checking scipy availability
scipy_available = True
try:
import scipy
from scipy import interpolate
except I... |
import math
from tabulate import tabulate
import scipy.io
import os
import operator
results = {}
template = set()
test = set()
##################
# MATRIX DO CONCORRENTE
###################
def get_name(directory):
directory = directory.split('/')
size = len(directory)
name = directory[size-1]
name = name.spli... |
###############################################################################
#
# bvp_process_model.py (c) <NAME>
# University of Chicago
# <EMAIL>
#
# Process model outputs such as corner plot, GR plot, and associated
# ascii data files.
#
######################################################... |
# -*- coding: utf-8 -*-
import copy
from math import erfc
from typing import Tuple, Set, Union
import numpy as np
import scipy.constants as const
from .beam_pattern import BeamTransitionModel
from .beam_shape import BeamShape
from ...base import Property
from ...functions import cart2sphere, rotx, roty, rotz, mod_bea... |
<filename>Algorithms/Phase_Coding.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import wavfile as wav
from scipy.fftpack import fft, fftfreq, ifft, rfft, rfftfreq, irfft
import binascii
import cmath as cm
import math as m
def parse_audio(filename):
rate, data = wav.read(filename)
data = d... |
import numpy as np
import scipy
import unittest
import pygsti
import pygsti.models.modelconstruction as mc
import pygsti.modelmembers.operations as op
import pygsti.tools.basistools as bt
from pygsti.processors.processorspec import QubitProcessorSpec as _ProcessorSpec
from ..util import BaseCase
class ModelConstruct... |
<reponame>sourceperl/sandbox<filename>signal/filters/bandpass_filter.py
#!/usr/bin/env python3
import numpy as np
from scipy.signal import butter, lfilter, freqz, square, periodogram
import matplotlib.pyplot as plt
# some functions
def butter_bandpass(lowcut, highcut, fs, order=5):
nyq = 0.5 * fs
low = lowcu... |
import functools
import numpy as np
import scipy.interpolate as spi
#
# Function manipulation
#
def curryish(f):
def g(*args, **kwargs):
return functools.partial(f, *args, **kwargs)
return g
def compose2(f, g):
def h(*args, **kwargs):
return f(g(*args, **kwargs))
return h
de... |
"""model.py.
Last update: 2021-02-19.
"""
# Python imports
import gzip
import numpy as np
import os
import pandas as pd
import re
import shutil
import tempfile
import sklearn.preprocessing
import matplotlib.pyplot as plt
from bs4 import BeautifulSoup as bs
from IPython.display import display, HTML
from pathlib import... |
<reponame>PlaytikaResearch/abexp
# MIT License
#
# Copyright (c) 2021 Playtika Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the r... |
# -*- coding: utf-8 -*-
"""Provides base model classes."""
import os
import json
import uuid
import statistics
from ..exceptions import NotFittedError
from ..utilities import check_timeseries, check_resolution, check_data_keys, item_is_in_range
from ..time import now_s, dt_from_s
from ..units import TimeUnit
from pand... |
import os
import pickle
import torch
import numpy as np
from torch import nn
from scipy.stats import linregress
from sklearn.datasets import make_blobs
from collections.abc import Iterable
import matplotlib.pyplot as plt
from utils.config import *
def get_blobs(feature_dim, num_samples=1000,
split=0... |
<reponame>repriem/smt
"""
Author: Dr. <NAME> <<EMAIL>>
Dr. <NAME> <<EMAIL>>
This package is distributed under New BSD license.
"""
import numpy as np
from scipy import linalg
from smt.utils import compute_rms_error
from smt.problems import Sphere, NdimRobotArm
from smt.sampling_methods import LHS
from smt.su... |
import datetime
import time
import numpy as np
from dateutil.parser import parse
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
# 如果gpu可用
from scipy.interpolate import make_interp_spline
from MLP_DNN import NeuralNet
import matplotlib.pyplot as plt
de... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# simulate.py
"""
A simulation which calculates coherence values for different parameter sets.
.. note::
The population consists of all subjects, not only the subset.
"""
from __future__ import division
from __future__ import absolute_import
import os
import pic... |
# -*- coding: utf-8 -*-
# region imports
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import norm
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_log_error
from sklearn import preprocessing
from s... |
<gh_stars>10-100
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# Week 2 from "Fundamentals of Digital Image and Video Processing"
#
# Question 7
#
# In this problem you will implement spatial-domain low-pass filtering
# using MATLAB, and evaluate the difference between the filtered image
# and the original image using two... |
<reponame>FlamingSparrow/UIUC--25-bot
import datetime
import pathlib
import re
from math import floor
from statistics import mean
import discord
import requests
from PIL import Image
from discord.ext import menus
from src.aws import upload_to_aws
DEFAULT_ICON = 'https://www.redditstatic.com/avatars/avatar_default_02... |
<reponame>baymlab/wastewater_analysis<filename>analysis/plot_coverage.py
#!/usr/bin/env python3
import sys
import os
import argparse
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import math
import statistics
def main():
parser = argparse.ArgumentParser(description="Create sequencing dept... |
<reponame>Ardavans/sHDP
from __future__ import division
import numpy as np
from numpy.random import random
na = np.newaxis
import scipy.stats as stats
import scipy.special as special
import scipy.linalg
from numpy.core.umath_tests import inner1d
from warnings import warn
import general
# TODO write cholesky version... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
Este é um arquivo de script temporário.
"""
import control.matlab
import math
import matplotlib.pyplot as plt
import numpy
import scipy
from sympy.solvers import solve
from sympy import Symbol #essa biblioteca vai servir para definir os símbolos u, h1, h2
import sympy
# ---... |
import scipy.ndimage as ndimage
import skimage.measure
import numpy as np
from torch.utils.data import Dataset
import os
import sys
import SimpleITK as sitk
import pydicom as pyd
import logging
import fill_voids
import skimage.morphology
def preprocess(img, label=None, resolution=[192, 192]):
imgmtx = np.copy(img... |
<gh_stars>1-10
import numpy as np
from scipy import constants as con
from scipy.optimize import minimize, dual_annealing, differential_evolution, shgo
import matplotlib.pyplot as plt
import find_nearest as fn
from matplotlib.colors import BoundaryNorm
from matplotlib.ticker import MaxNLocator
from matplotlib import rcP... |
<reponame>qgao-hd/galaxy-image-analysis<gh_stars>1-10
import skimage.io
from skimage.transform import ProjectiveTransform
from scipy.ndimage import map_coordinates
import numpy as np
import pandas as pd
import argparse
import warnings
import shutil
def _stackcopy(a, b):
if a.ndim == 3:
a[:] = b[:, :, np... |
<filename>libs/apls/infer_speed.py
"""
Modified on Sun Jul 27 2020 by <NAME>, DS @ AWS MLSL
Cleaned up for the tutorial.
Original author: avanetten
"""
import os, time
import argparse
# from multiprocessing.pool import Pool
from p_tqdm import p_umap
from tqdm import tqdm
import numpy as np
import pandas as pd
impor... |
"""
辅助函数
"""
from pathlib import Path
import matplotlib.pyplot as plt
import scipy.io as sio
def save_matrix(matrix, file_name):
sio.savemat(file_name + '.mat', {'matrix': matrix})
def save_fig(matrix, file_name):
plt.imshow(matrix)
plt.savefig(file_name + '.jpg')
def make_dir(outdir):
Path(outdi... |
<filename>TP2_1ChiCuadrado.py
import matplotlib.pyplot as plt
from scipy import stats
import numpy as np
import TP2_1NumerosAleatorios as generadores
#k > 100!! cantidad de subintervalos
#n/k > 5 n = cantidad de numeros
mod = 512 #poner el valor maximo + 1
n = 4500
k = 101
salto = 1/k
generadosGCL = np.array(generad... |
<filename>models/cnn.py
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from torch.utils.data import DataLoader,sampler,Dataset
import torchvision.datasets as dset
import torchvision.transforms as T
from PIL import Image
import os
import numpy as np
import scipy.io
im... |
<reponame>saroudant/sobolev_alignment
import numpy as np
import scipy
import torch
import pytest
from joblib import Parallel, delayed
from sobolev_alignment import KRRApprox
n_samples = 2000
n_samples_valid = 50
n_genes = 100
n_latent = 7
penalization = .0001
pearson_threshold = 0.99
M = 500
@pytest.fixture(scope='m... |
<reponame>bayu-wilson/phys218_example
#!/usr/bin/env python
# vim: set fileencoding=UTF-8 :
"""
Various flux derivative stuff
"""
import numpy as np
import math
# import smooth # removed 11/20/19. "Smooth" doesn't exist
import scipy.interpolate
import sys
import matplotlib.pyplot as plt
import matplotlib.backends
# i... |
<reponame>HakureiReimyyy/HSLC-3DSG<filename>my_utils/boxlist_ops.py
import torch
import numpy as np
import scipy.linalg
from model.structure.box3d_list import Box3dList
from model.dataset.model_util_rscan import RScanDatasetConfig
from model.modeling.detector.utils.box_util import box3d_iou_depth, box3d_vol
from model... |
# Copyright 2020 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
<filename>functions_matching.py
from sklearn.preprocessing import scale
from scipy.interpolate import interp1d
from scipy import signal
import cv2
from functions_plotting import *
from functions_misc import add_edges, interp_trace, normalize_matrix
import h5py
import pandas as pd
import os
import time
def align_trace... |
<reponame>cosmo-jana/numerics-physics-stuff
from __future__ import division
import numpy as np
import scipy.linalg as la
from scipy.constants import epsilon_0
import matplotlib.pyplot as plt
# Poissons equation for electromagitism:
# \Delta \phi = - \rho(x) / \epsilon_0
# 2D:
# \Delta \phi = \phi_{xx} + \phi_{yy} = -... |
<filename>crystmorph/polyhedron.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
from . import transformation as trans
import numpy as np
from numpy.linalg import norm
import vg
import itertools as it
from scipy.spatial import ConvexHull
class ConvexPolyhedron(object):
""" Root class fo... |
#!/usr/bin/python
#-*- coding: utf-8 -*-
import numpy as np
from scipy.integrate import RK45
class Simulator:
def __init__(self):
self.last_global_state = None
self.last_local_state = None
self.current_action = None
self.steps = 0
self.time_span = 10 # 20 seconds ... |
"""
Running Hamiltonian Monte Carlo on an oscillator with coupled degrees
of freedom.
"""
import isdhic
import numpy as np
import pylab as plt
from isdhic import utils
from isdhic.core import take_time
from isdhic.params import Array
from scipy import optimize
from csb.numeric import log_sum_exp
from csb.statistics... |
<gh_stars>0
import operator as op
import numpy as np
import pandas as pd
from scipy import signal, stats
def find_peaks(waveform, distance=0.5e-3, prominence=50, wlen=None,
invert=False, detrend=True):
y = -waveform.y if invert else waveform.y
if detrend:
y = signal.detren... |
<filename>src/dvg_fftw_firfilter.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
__author__ = "<NAME>"
__authoremail__ = "<EMAIL>"
__url__ = "https://github.com/Dennis-van-Gils"
__date__ = "12-08-2019"
__version__ = "1.0.0"
import numpy as np
from scipy.signal import firwin, freqz
fro... |
# -*- coding: utf-8 -*-
"""GRU_sequence+attention.ipynb
# Classifying OUV using GRU sequence model + Attention
## Imports
"""
import sys
sys.executable
import os
from argparse import Namespace
from collections import Counter
import json
import os
import re
import string
import numpy as np
import pandas as pd
import... |
<gh_stars>0
from numpy.testing import run_module_suite
from scipy.interpolate import interp1d
from spectractor import parameters
from spectractor.extractor.images import Image
from spectractor.extractor.spectrum import Spectrum
from spectractor.extractor.extractor import Spectractor
from spectractor.logbook import Log... |
<reponame>ZhekehZ/catboost
from __future__ import division, print_function, absolute_import
import warnings
import threading
import numpy as np
from numpy import array, finfo, arange, eye, all, unique, ones, dot, matrix
import numpy.random as random
from numpy.testing import (TestCase, run_module_suite,
asser... |
<filename>pysofe/pde/base.py
"""
Provides the base class for all pde objects.
"""
# IMPORTS
import numpy as np
from scipy import sparse
import conditions
# DEBUGGING
from IPython import embed as IPS
class PDE(object):
"""
Base class for all partial differential equations.
Parameters
----------
... |
<gh_stars>100-1000
from __future__ import print_function
import collections
import numpy as np
import scipy.sparse as ssp
from copy import deepcopy
from .lazy import Lazy
from .utils import top_k, get_sparse_vector
class MarkovModel(Lazy):
"""
"""
def __init__(self, **kwargs):
super(MarkovModel, self).__init__(*... |
<gh_stars>1-10
import statistics
a, b, c = [int(x)
for x in input('Digite 3 valores separados por ; ').split(";")]
i = [a, b, c]
media = (a + b + c)/3
print(f'A média é {media}')
maximo = max(i)
minimo = min(i)
print(f'O valor máximo é {maximo}')
print(f'O valor minimo é {minimo}')
delta = b ** 2 - 4 *... |
<reponame>universebang/SSD_Segmentation<gh_stars>1-10
from math import ceil
import numpy as np
import os
import scipy
import cv2
import time
from keras import backend as K
from keras.callbacks import (CSVLogger, EarlyStopping, ModelCheckpoint,
ReduceLROnPlateau, TerminateOnNaN)
from keras.... |
<filename>pygcn/utils.py<gh_stars>0
import numpy as np
import scipy.sparse as sp
import torch
import os.path as osp
def encode_onehot(labels):
classes = set(labels)
classes_dict = {c: np.identity(len(classes))[i, :] for i, c in
enumerate(classes)}
labels_onehot = np.array(list(map(clas... |
<gh_stars>100-1000
import json
import logging
import os
import subprocess
import sys
from calendar import timegm
from datetime import datetime, timedelta, timezone
from functools import lru_cache
from io import StringIO
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
... |
import cmath
num = eval(input('Enter a number: '))
num_sqrt = cmath.sqrt(num)
print('The square root of {0} is {1:0.3f}+{2:0.3f}j'.format(num ,num_sqrt.real,num_sqrt.imag))
|
<filename>detector.py
import math
import pickle
import time
from functools import wraps
import cv2
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import scipy.ndimage
### define profilers (https://stackoverflow.com/questions/3620943/measuring-elapsed-time-with-the-time-module)
PRO... |
import os
import numpy as np
import scipy.io
import scipy.ndimage
from PIL import Image
import matplotlib.pyplot as plt
image_subfolder = 'DRAWING_GT'
semantic_subfolder = 'CLASS_GT'
instance_subfolder = 'INSTANCE_GT'
IMAGE_SIZE = 768
def load_image(image_dir, image_id):
image_name = os.path.join(image_dir, 'L0... |
<filename>prepare_train.py<gh_stars>10-100
import numpy as np
import cv2 as cv
import os
import scipy.misc
import h5py
# Settings.
scale = 3
size_input = 33
size_label = 21
stride = 14
counter = 0
# data = np.zeros([size_input, size_input, 1, 1])
# label = np.zeros([size_label, size_label, 1, 1])
data = []
label = []
... |
<reponame>tamarakatic/machine-learning-playground
import matplotlib.pyplot as plt
import pandas as pd
import scipy.cluster.hierarchy as sch
from sklearn.cluster import AgglomerativeClustering
data = pd.read_csv("customers.csv")
X = data.iloc[:, [3, 4]].values
dendrogram = sch.dendrogram(sch.linkage(X, method='ward')... |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 4 18:14:29 2016
@author: becker
"""
import numpy as np
import scipy.linalg as linalg
import scipy.sparse as sparse
try:
from simfempy.meshes.simplexmesh import SimplexMesh
except ModuleNotFoundError:
from simfempy.meshes.simplexmesh import SimplexMesh
import sim... |
import timeit
import torchaudio
import librosa
import torch
import numpy as np
from scipy.stats import sem
from utils import get_whitenoise, get_spectrogram, update_results
def main():
results = {}
repeat = 5
number = 10
sample_rate = 16000
n_fft = 400
win_length = n_fft
hop_length = n_... |
#!/usr/bin/env python
from __future__ import print_function
import numpy as np
import scipy as scipy
import argparse
def parse_args():
parser = argparse.ArgumentParser(description='make tensors')
parser.add_argument('-Lx',metavar='Lx',dest='Lx',type=int,default=2,help='set Lx')
parser.add_argument('-Ly',... |
<reponame>Michael-Beukman/NEATNoveltyPCG<filename>src/analysis/proper_experiments/v500/fitness_plots.py
from cmath import exp
from functools import partial
import os
from pprint import pprint
import threading
from matplotlib import pyplot as plt
import numpy as np
import wandb
from baselines.ga.genetic_algorithm_pcg im... |
<reponame>thomasly/chemreader
from rdkit.Chem.rdmolfiles import MolFromPDBFile, MolFromPDBBlock
import numpy as np
from scipy.spatial.distance import pdist
from scipy import sparse as sp
from scipy.linalg import toeplitz
from .basereader import _BaseReader, MolFragmentsLabel
from ..utils.tools import property_getter
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utilities for visualizing results of experiments
"""
import sys
#import arrow
import numpy as np
from scipy import stats
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from Utils import file2sequence
from ppgen import *
def get_intensity(seq,... |
import argparse
import os
import numpy as np
import scipy.io.wavfile as scwav
import pylab
import scipy.signal as scisig
import utils.preprocess as preproc
from utils.feat_utils import preprocess_contour, normalize_wav
from nn_models.model_energy_f0_momenta_wasserstein import VariationalCycleGAN as VCGAN
num_mfcc = ... |
<filename>optimal_control_python/plot_fatigue_param.py
# This is a debug script for testing and plotting fatigue
import time
import pickle
from scipy import integrate
import numpy as np
from matplotlib import pyplot as plt
from violin_ocp.violin import Violin, ViolinString
from bioptim import XiaFatigue, MichaudFati... |
<filename>ImbalanceDetection/analyze_models.py
from detectron2.engine import default_setup, launch, default_argument_parser
from detectron2.config import get_cfg
import detectron2.utils.comm as comm
from imbalancedetection.build import build_detector, build_gambler
from imbalancedetection.config import add_gambler_conf... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 17 11:00:53 2020
@author: m102324
"""
import pysam
import numpy
from scipy import stats
def bam_info (bamfile, layout, frac = 0.2, n=500000):
'''
Extract DNA fragment size, read length and chrom sizes information from
BAM file. For PE, fragment... |
import numpy as np
from scipy.sparse.linalg import eigs
def scaled_Laplacian(W):
'''
compute \tilde{L}
Parameters
----------
W: np.ndarray, shape is (N, N), N is the num of vertices
Returns
----------
scaled_Laplacian: np.ndarray, shape (N, N)
'''
assert W.shape[0] == W.shape[1... |
# -*- coding: utf-8 -*-
#
# comparison_schemes.py
#
"""
Features selection and classifications
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
from scipy.stats import randint as sp_randint
from scipy.stats import uniform as sp_uniform
from skfeature.function.similarity_based.fisher_score import fisher_score
from sk... |
<filename>day3/bestFitLine.py
from statistics import mean
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
import random
style.use('fivethirtyeight')
#xs = np.array([1,2,3,4,5,6], dtype= np.float64)
#ys = np.array([5,4,6,5,6,7], dtype= np.float64)
def createDataset(hm, variance, step=... |
"""This module contains auxiliary functions for the creation of tables in the main notebook."""
import json
import scipy
import numpy as np
from numpy import nan
import pandas as pd
import pandas.io.formats.style
import seaborn as sns
import statsmodels as sm
import statsmodels.formula.api as smf
import statsmodels.ap... |
# Copyright 2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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 ... |
<reponame>iamabhishek0/sympy
import sys
from sympy.external import import_module
from sympy.integrals.rubi.rubimain import LoadRubiReplacer
matchpy = import_module("matchpy")
if not matchpy:
#bin/test will not execute any tests now
disabled = True
if sys.version_info[:2] < (3, 6):
disabled = True
from s... |
import numpy as np
import scipy
import matcompat
# if available import pylab (from matlibplot)
try:
import matplotlib.pylab as plt
except ImportError:
pass
def prony(h, nb, na):
# Local Variables: a, c, b, h1, h, nb, H1, M, N, H2, H, na, H2_minus, K
# Function calls: max, length, prony, zeros, toepl... |
"""Validate a face recognizer on the "Labeled Faces in the Wild" dataset (http://vis-www.cs.umass.edu/lfw/).
Embeddings are calculated using the pairs from http://vis-www.cs.umass.edu/lfw/pairs.txt and the ROC curve
is calculated and plotted.
"""
import os
import sys
import math
import pathlib
import argparse
import im... |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import time
import sympy as sp
import numpy as np
import pandas as pd
from tqdm import tqdm
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.collections import EllipseCollection
from matplotlib import patches
from fractions i... |
import scipy as sp
data = sp.genfromtxt("data/web_traffic.tsv", delimiter="\t")
# 先頭10件を表示
print(data[:10])
# 1列目を1次元配列で取り出す(経過時間?)
x = data[:, 0]
# 2列目を1次元配列で取り出す(アクセス数)
y = data[:, 1]
# 不正なデータが入っている要素を除去(アクセス数が不正な値(NAN)の行を除去)
invalid_data = ~sp.isnan(y)
x = x[invalid_data]
y = y[invalid_data]
... |
# coding=utf-8
#
# This file is part of Hypothesis (https://github.com/DRMacIver/hypothesis)
#
# Most of this work is copyright (C) 2013-2015 <NAME>
# (<EMAIL>), but it contains contributions by others. See
# https://github.com/DRMacIver/hypothesis/blob/master/CONTRIBUTING.rst for a
# full list of people who may hold c... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
<gh_stars>0
import surpyval
import autograd.numpy as np
from scipy.linalg import inv
from scipy.optimize import minimize
from scipy.special import ndtri as z
from autograd import jacobian, hessian
from surpyval import parametric as para
class MixtureModel():
"""
Generalised from algorithm found here
http... |
<gh_stars>1-10
"""Unit cell averaging of images."""
import numpy as np
import scipy.ndimage as ndi
from numba import njit
def forward_transform(vecs, ks):
# A = 0.5*np.sqrt(3) * ks
A = ks
return vecs @ A.T
def backward_transform(vecs, ks):
# A = 2/np.sqrt(3)*np.linalg.inv(ks)
A = np.linalg.inv(k... |
<filename>galaxy_ml/tools/keras_train_and_eval.py<gh_stars>0
import argparse
import joblib
import json
import numpy as np
import os
import pandas as pd
import warnings
from itertools import chain
from scipy.io import mmread
from sklearn.pipeline import Pipeline
from sklearn.metrics._scorer import _check_multimetric_sco... |
from collections import defaultdict
from numpy import bincount, empty, log, log2, unique, zeros
from numpy.random import choice, uniform
from scipy.special import gammaln
from algorithm_3 import iteration as algorithm_3_iteration
from kale.math_utils import log_sample, log_sum_exp, vi
def iteration(V, D, N_DV, N_D, ... |
from __future__ import absolute_import, division, print_function
import sys, os
import argparse
import time
import warnings
import numpy as np
from scipy.constants import speed_of_light
from scipy.stats import cauchy
from astropy.table import Table,Column
import astropy.io.fits as pyfits
import multiprocessing
import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.