text string |
|---|
<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 9 12:58:58 2018
@author: <NAME>
@email: <EMAIL>
This module implements Normal-to-Anything (NORTA) algorithm
to generate correlated random vectors. The original paper is by
Cario and Nelson (2007).
"""
import numpy as np
from scipy... |
<gh_stars>0
from random import randint
import os
from bs4 import BeautifulSoup
import json
from textblob import TextBlob
from gensim.models.doc2vec import Doc2Vec,TaggedDocument
import datetime
from datetime import datetime,timedelta
import requests
import json
from stop_words import get_stop_words
import boto3
from sc... |
import xarray as xr
import numpy as np
import pytest
from vcm.interpolate import (
interpolate_unstructured,
interpolate_1d,
_interpolate_2d,
interpolate_to_pressure_levels,
)
def test_interpolate_unstructured_same_as_sel_if_1d():
n = 10
ds = xr.Dataset({"a": (["x"], np.arange(n) ** 2)}, coor... |
<reponame>vanvalenlab/deepcell-spots
# Copyright 2019-2022 The <NAME> at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
#
# Licensed under a modified Apache License... |
<reponame>hhio618/AUT-ml-hw-2017<gh_stars>0
import pandas as pd
import scipy.io as sio
def load_data():
df = pd.read_csv('data/car.data', header=None,
names=['b', 'm', 'd', 'p', 'l', 's', 'e'])
return df
def load_news():
return sio.loadmat('data/Train_data.mat'), sio.loadmat('data/T... |
<filename>python GTWR/gtwr-1.0.1/gtwr/testing.py
import numpy as np
from .kernels import GTWRKernel, GWRKernel
from scipy import linalg
from .model import _compute_betas_gwr
from scipy.stats import f
class test(object):
def __init__(self, coords, t, y, X, bw_GTWR, tau_GTWR, kernel_GTWR = 'gaussian',
... |
<reponame>CommanderStorm/jumpcutter<filename>jumpcutter.py
import argparse
import glob
import logging
import math
import os
import re
import subprocess
from multiprocessing import Process
from shutil import copyfile, rmtree
import numpy as np
from audiotsm import phasevocoder
from audiotsm.io.wav import WavReader, Wav... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Created by techno at 21/03/19
#Feature: #Enter feature name here
# Enter feature description here
#Scenario: # Enter scenario name here
# Enter steps here
"""
Here we continue our discussion of using statistics to analyze data with several additional descriptive
stat... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Generator to yield resampled volume data for training and validation
"""
# %%
from keras.models import load_model, Model
from matplotlib import pyplot as plt
import numpy as np
import os
from os import path
import random
import SimpleITK as sitk
from stl import mesh... |
<filename>results/firstResults/readjson.py<gh_stars>0
import json
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats.stats import pearsonr
from scipy.stats.stats import spearmanr
from sklearn.model_selection import train_test_split
from sklearn import ensemble
from sklearn.dummy import DummyClassifier... |
<gh_stars>1-10
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import numpy as np
from scipy.spatial.distance import cdist
import matplotlib.pyplot as plt
from math import sqrt
import matplotlib.animation as animation
from brian import *
''' Spikes model in computational neuroscience with Brian library. '''... |
'''
Complex Arithmetic
Number 1+ sqrt(-1)
Rectangular ComplexRI(1,1)
Polar ComplexMA(sqrt(2),pi/4)
'''
# Use c omplex numers to preform computation whole data values x.add(y). x.mul(y)
# add complex number real and imaginary parts real, imag, ComplexRI
# multiply complex number ... |
import sympy as sp
def gen_init_XImats(self, include_base_inertia = False):
# add function description
if include_base_inertia:
self.gen_add_func_doc("Initializes the Xmats and Imats in GPU memory", \
["Memory order is X[0...N], Ibase, I[0...N]"], \
[],"A pointer to the XI memor... |
""" Mapping functions and primitive objects """
from larlib import *
""" Basic tests of mapper module """
from larlib import *
if __name__=="__main__":
V,EV = larDomain([5])
VIEW(EXPLODE(1.5,1.5,1.5)(MKPOLS((V,EV))))
V,EV = larIntervals([24])([2*PI])
VIEW(EXPLODE(1.5,1.5,1.5)(MKPOLS((V,EV))))
V,... |
# -*- mode: python; coding: utf-8 -*
# Copyright (c) 2019 Radio Astronomy Software Group
# Licensed under the 3-clause BSD License
"""Define SkyModel class and helper functions."""
import warnings
import os
import h5py
import numpy as np
from scipy.linalg import orthogonal_procrustes as ortho_procr
import scipy.io
fr... |
"""
__author__ = <NAME>
__name__ = __init__.py
__description__ = Part that constructs the graph given the input data dump
"""
import pickle
import os
import subprocess
import struct
import networkx as nx
import numpy as np
from networkx.drawing.nx_agraph import write_dot
from scipy.sparse import dok_m... |
import os, sys
import pandas as pd
import numpy as np
import simpledbf
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
import arcpy
from arcpy import env
from arcpy.sa import *
try:
sys.path.... |
<filename>ICLR_2022/Flight_delay/QD/QD_flight_delay.py<gh_stars>10-100
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from scipy import stats
import os
import importlib
import DeepNetPI_V2
import DataGen_V2
import utils
from sklearn.metrics import r2_score
import os
import random
import data_loader
import ite... |
import pandas as pd
from pathlib import Path
from hashlib import md5
from sklearn.feature_extraction.text import TfidfVectorizer
from scipy import sparse as sp
import argparse
def main(args):
if args.output.exists():
if not args.overwrite():
raise FileExistsError(f"Output directory {args.outpu... |
from utils import input, prod
import numpy as np
from scipy.ndimage.measurements import label
def conn_comp(cave_map, idx):
x = (idx[0] + np.array((0, 0, -1, 1))).clip(0, cave_map.shape[1]-1)
y = (idx[1] + np.array((-1, 1, 0, 0))).clip(0, cave_map.shape[0]-1)
return cave_map[y, x]
def solve1(... |
from unittest import TestCase
import unittest
import numpy as np
import filecmp
import os
import sys
import scipy
from ezyrb.interpolation import Interpolation
from ezyrb.points import Points
from ezyrb.snapshots import Snapshots
class TestInterpolation(TestCase):
def test_interpolation(self):
space = Int... |
<reponame>stephenliu1989/HK_DataMiner<gh_stars>1-10
__author__ = 'stephen'
import os,sys
import numpy as np
import scipy.io
HK_DataMiner_Path = os.path.relpath(os.pardir)
#HK_DataMiner_Path = os.path.abspath("/home/stephen/Dropbox/projects/work-2015.5/HK_DataMiner/")
sys.path.append(HK_DataMiner_Path)
#from utils impor... |
<filename>basisgen/smeft.py<gh_stars>1-10
from basisgen import (
irrep, algebra, scalar, L_spinor, R_spinor,
boson, fermion, Field, EFT
)
from fractions import Fraction
sm_gauge_algebra = algebra('SU3 x SU2')
def sm_irrep(highest_weight_str):
return irrep('SU3 x SU2', highest_weight_str)
phi = Field(
... |
<filename>PA2/Code/q1.py
"""
Program to demonstrate SVM using various kernels
"""
from numpy import genfromtxt, ascontiguousarray, sum, mean, linspace, logspace, zeros, object
from random import shuffle
from sklearn.preprocessing import StandardScaler
from sklearn.cross_validation import KFold
from sklearn.multiclass ... |
import numpy as np
from matplotlib import pyplot as plt
from scipy.interpolate import interp2d, griddata, RBFInterpolator
from lib.spelling_type import alphabet
import warnings
warnings.filterwarnings("ignore",category=UserWarning)
KEYBOARD_BACKGROUND = "data/keyboard.png"
# 采集到的 A - Z 的按键坐标
KEYBOARD_KEY_POSITIONS = ... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 13 19:00:57 2021
@author: peijiun
"""
import pickle
import numpy as np
import matplotlib.pyplot as plt
from nilearn import plotting
import scipy.sparse as sp
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.k... |
<filename>Modelling/Regression/Non-negative Least Squares.py<gh_stars>0
# Model via non-negative Least Squares
from scipy.optimize import nnls
class NNLS():
def __init__(self):
self.coef_ = None
def get_params(self, deep=False, *args):
return {}
def fit(self, X, Y):
self.coef_ = nnl... |
import numpy as np
import scipy.sparse as sps
from .base import check_matrix
from .._cython._similarity import cosine_common
class ISimilarity(object):
"""Abstract interface for the similarity metrics"""
def __init__(self, shrinkage=10):
self.shrinkage = shrinkage
def compute(self, X):
p... |
import logging
from hmac import new
logging.basicConfig(level=logging.INFO)
import argparse
import numpy as np
import cv2
from collections import defaultdict
from pytorch3d import transforms
import torch
import json
import time
from scipy import signal, spatial
def parseargs():
parser = argparse.ArgumentParser(... |
<filename>benchmark_util.py
"""
"""
import os
import numpy as np
import scipy.sparse as sp
import pandas as pd
import info_log
def dropout(X, args):
"""
X: original testing set
========
returns:
X_zero: copy of X with zeros
i, j, ix: indices of where dropout is applied
"""
if not ar... |
<gh_stars>0
import os
from sklearn.metrics import roc_auc_score
from scipy.spatial.distance import cosine, euclidean
from attacks import Attack
import pandas as pd
class Link(Attack):
def __init__(self, vf_fname, weekends, in_datapath = '../data/dzne/', out_datapath = '../data/dzne/'):
"""
cr... |
<reponame>brown-ccv/pulsedetector
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: GitHub
# @Date: 2014-04-20 18:31:00
# @Last Modified by: <NAME>
# @Last Modified time: 2014-11-06 16:06:30
from lib.device import Camera, Video
from lib.processor_multi_channel import GetPulseMC
import cv2
from cv2 import ... |
<filename>helmnet/dataloaders.py
import cv2
import numpy as np
import torch
from scipy.io import savemat
from torch.utils.data import Dataset
from tqdm import trange
def get_dataset(
dataset_path: str, source_location="cuda:7", destination="cpu"
) -> Dataset:
"""Loads a torch dataset and maps it to arbitr... |
<reponame>liutiming/DPE
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 21 11:47:27 2018
Module to analyse an unknown mixture population.
@author: ben
"""
__all__ = ["analyse_mixture"]
from pprint import pprint
import itertools
import copy
import warnings
import numpy as np
import scipy as s... |
import unittest
from functools import partial
from scipy.stats import beta as beta, uniform
from pyapprox.orthogonal_least_interpolation import *
from pyapprox.variable_transformations import \
define_iid_random_variable_transformation
from pyapprox.utilities import remove_common_rows, \
allclose_unsorted_mat... |
import numpy as np
from scipy.sparse import csc_matrix
from algebra import transform
import cv2
import os
class Mesh:
def __init__(self, vertex=None, faces=None):
self.vertex = vertex
self.faces = faces
self.vertexNormal = None
def writeOBJ(self, filename):
nverts = self.vertex... |
import decimal
import xml.etree.ElementTree as ET
from fractions import Fraction
def translate(thing, encoding="utf-8"):
"""
Given an object, make a corresponding xml document that represents that
python object. Str types are converted to their byte equivalents
to preserve their contents over transiti... |
# ==============================================================================
#
# Utility functions used for data transformation or other common functionality
# @author: tbj128
#
# ==============================================================================
#
# Imports
#
from biom import Table
import numpy as np... |
#!/usr/bin/env python3
""" 音声情報処理 n本ノック !! """
# MIT License
# Copyright (C) 2020 by <NAME>
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the Software"), to deal in the Software without restriction,
# including without limitat... |
"""Work with healpix data
In this case for the QA plots Aaron creates. e.g. PS1 minus tractor flux"""
import numpy as np
import os
import healpy as hp
import fitsio
import matplotlib.pyplot as plt
from scipy.stats import sigmaclip
from collections import defaultdict
from astropy.coordinates import Galactic,ICRS
from... |
"""
Interpolates a given set of points into a PFLOTRAN mesh
"""
import numpy as np
from scipy.interpolate import griddata
from .BaseInterpolator import BaseInterpolator
import logging
from PyFLOTRAN.utils.decorators import set_run
logger = logging.getLogger(__name__)
class SparseDataInterpolator(BaseInterpolator):... |
<reponame>dnolivieri/MResVgene<filename>mresvgene/mrvPredictVgeneDB02.py
#!/usr/bin/env python
"""
dnolivieri: updated ...17 feb 2016
- specially designed for looking at the VgeneDB sequences.
- convert to feature vectors; and give a prediction score.
"""
import collections
import numpy as np
import... |
<filename>plotter_pdfs.py
"""PDF plots for the report"""
import numpy as np
import pandas as pd
import pickle
import matplotlib.pyplot as plt
from scipy.stats import norm as scipy_normal
# Make TeX labels work on plots
#plt.rc('font', **{'family': 'serif', 'serif': ['DejaVu Sans']})
#plt.rc('text', usetex=True)
# Gr... |
<reponame>RaulAstudillo06/BOCF<gh_stars>1-10
import numpy as np
import scipy
import GPyOpt
import GPy
from multi_objective import MultiObjective
from multi_outputGP import multi_outputGP
from maPI import maPI
from maEI import maEI
from parameter_distribution import ParameterDistribution
from utility import Utility
impo... |
import os
from time import time
import numpy as np
from scipy import optimize
import sys
from matplotlib import pyplot as plt
import cv2
import math
import cmath
from sklearn.utils import check_random_state
_delta = 1e-9
def ImgInt2Float(img, dtype=np.float):
return img.astype(dtype) / 255.0
def ImgFloat2Int(img... |
<filename>keckcode/osiris/oscube.py
"""
oscube.py
"""
from os import path
import numpy as np
from scipy.ndimage import filters
from astropy import wcs
from astropy.io import fits as pf
from cdfutils import datafuncs as df
from specim import imfuncs as imf
from specim import specfuncs as ss
from specim.imfuncs.wcsh... |
<reponame>dllatas/facial-emotion-detection-dl
from scipy import stats
def main():
"""
1st phase
top1 = [70.0, 71.1, 72.5, 70.8, 68.1, 71.9, 71.1, 71.3, 68.4, 70.2]
top3 = [75.8, 78.4, 77.8, 77.7, 80.0, 77.8, 78.7, 76.4, 79.1, 77.3]
2nd phase
"""
x = [53.6, 54.5, 53.7, 52.7, 53.1, 55.5, 55.5, 52.8, 53.7, 52.7]
... |
<filename>calculus.py<gh_stars>0
import tkinter as tk
from functools import partial
import sympy as sm
x,y,z=sm.symbols('x y z')
def integrate(label_result, n1, n2, n3):
num1 = (n1.get())
num2 = (n2.get())
num3 = (n3.get())
result = sm.integrate(num1,(x,num2,num3))
label_result.config(text=... |
## dea_datahandling.py
'''
Description: This file contains a set of python functions for handling
Digital Earth Australia data.
License: The code in this notebook is licensed under the Apache License,
Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0). Digital Earth
Australia data is licensed under the Creati... |
<reponame>Astroua/M33_NOEMA<gh_stars>1-10
import numpy as np
from scipy import ndimage as nd
from radio_beam import Beam, EllipticalTophat2DKernel
from astropy import units as u
clean(vis='meas_sets/M33-ARMcont.ms',
imagename="imaging/M33-ARMcont_dirty",
field='M33*',
imsize=[1024, 700],
cell... |
from .hypotest import HypoTest
from scipy.interpolate import interp1d
import numpy as np
class ConfidenceInterval(HypoTest):
def __init__(self, poinull, calculator, qtilde=False):
super(ConfidenceInterval, self).__init__(poinull, calculator)
self._pvalues = None
self._qtilde = qtilde
... |
"""
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
"""
import fractions
# The smallest number n that is evenly divisible by every number in a set {k1, k2, ..., ... |
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
try:
from os import scandir, path # scandir introduced in py3.x
except:
pass
from os import system, chdir
from copy import deepcopy
from scipy.interpolate import splrep, splev
from scipy.signal import savgol_filter, medfi... |
# %% Global imports
#%matplotlib qt
import os
import sys
from turtle import color
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
# %% Local imports
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../")
from utils.nb import isnotebook
from utils.viz.viz import plot_fustrum, plo... |
<reponame>WenyinWei/MHDpy<filename>MHDpy/psi_norm_isoline_RZ.py<gh_stars>0
# File: psi_norm_isoline_RZ.py
# Author: <NAME> <EMAIL> Tsinghua Univ. & EAST
# Usage: Read the (nR_nZ.dat & R_Z_min_max.dat & psi_norm.dat) in equilibrium_preparation folder and exports the .
# Output: The numpy.array((pt_pol_num, 2)) object... |
import os
import pytest
from acousticsim.representations.mfcc import Mfcc
from scipy.io import loadmat
from numpy.testing import assert_array_almost_equal
@pytest.mark.xfail
def test(base_filenames):
for f in base_filenames:
print(f)
if f.startswith('silence'):
continue
wavpa... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
import itertools
import logging
import re
from collections import OrderedDict
from typing import List
import mxnet as mx
import scipy as sp
from mxnet import nd, gluon
from tqdm import tqdm
from data.AugmentedAST import AugmentedAST
from data.B... |
<filename>unit_tests/test_utilities.py
import pytest
import numpy as np
from scipy.optimize._numdiff import approx_derivative
from pylgr import utilities
TOL = 1e-10
def _generate_dynamics(n_x, n_u, poly_deg=5):
A = np.random.randn(n_x, n_x+n_u)
# Make random polynomials of X and U with no constant term or ... |
import time
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_conditions as EC # availab... |
<reponame>brainglobe/bg-space
import numpy as np
from scipy import ndimage as nd
import warnings
from functools import wraps
from bg_space.utils import ordered_list_from_set, deprecated
def to_target(method):
"""Decorator for bypassing AnatomicalSpace creation."""
@wraps(method)
def decorated(spaceconv_... |
import sys
import os
import csv
import shutil
import numpy as np
import scipy.spatial.distance as dist
from pypcd import pypcd
from datetime import datetime
import zipfile
def base_run_dir_fn(i): # the folders will be run00001, run00002, etc.
"""returns the `run_dir` for run `i`"""
return "scans_run{:05d}".... |
from __future__ import division, print_function
import numpy as np
class BCTParamError(RuntimeError):
pass
def teachers_round(x):
'''
Do rounding such that .5 always rounds to 1, and not bankers rounding.
This is for compatibility with matlab functions, and ease of testing.
'''
if ((x > 0) a... |
from cmath import sqrt
a = ''
b = ''
c = ''
success = False
while success == False:
try:
a = float(input("a: "))
success = True
except:
print("That is not a number")
success = False
while success == False:
try:
b = float(input("b: "))
success = True
except:
... |
import numpy
from scipy.optimize import curve_fit
from scipy.stats import linregress
import os
import os.path
from os.path import exists, join, abspath, dirname
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from scipy.constants import pi
# from model_eps import plot_eps_para, plot_eps_perp
im... |
<gh_stars>1-10
# creates a dataset of the signals to analyze with different transformations
# work in progress
import math
from os.path import exists
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats, scipy.signal
import scipy.stats, scipy.signal
# TODO: not seeing the function... |
<reponame>bullgom/pysnn2
from pydesim import Atomic, Port, Content, INF, NEG_INF, PASSIVE, Errors
from .. import Ports
import numpy as np
import scipy.special as sp
import warnings
import math
class Quadratic2(Atomic):
class States:
PROPAGATING = "PROPAGATING"
POST_SYNAPSE = "POST_SYNAPSE"
d... |
<reponame>pokornyv/linkTRIQS_2bH<gh_stars>0
# dmft calculation using triqs ct-hyb solver for a 2-band Hubbard model
# with off-diagonal hybridizations
# ct-hyb solver for matrix form of Coulomb interaction
# <NAME>; 2014-2015; <EMAIL>
import scipy as sp
from numpy.random import randint
from time import time,ctime
fro... |
# _*_ coding: utf-8 _*_
__author__ = 'LelandYan'
__date__ = '2019/5/19 10:58'
import cv2
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage as ndi
import skimage as sm
from skimage import morphology
from skimage.feature import peak_local_max
from skimage.filters.rank import median
image = cv... |
<filename>greyatom-hackathon-2/Haptik NLP/src/libraries.py<gh_stars>0
#import all the libraries required for the project here
from nltk.tokenize import RegexpTokenizer
from nltk import word_tokenize
import nltk
from nltk.stem.porter import PorterStemmer
from nltk.corpus import stopwords
from collections import Counter... |
<reponame>smestern/pyAPisolation
import numpy as np
from numpy import genfromtxt
import matplotlib.pyplot as plt
from .abfderivative import *
import pyabf
from pyabf.tools import *
from pyabf import filter
import os
import pandas as pd
import statistics
vlon = 2330
def npindofgrt(a, evalp):
""" Pass through an nu... |
import pandas as pd
import numpy as np
import scipy.stats
def realization(num, hist_Disc, hist_DH, value_dollar=True):
mean = []
Pg = []
size = []
label = []
num = num
count = 0
while count < num:
P90 = np.random.triangular(4,5,8)
P10 = np.random.triangular(20,30,60)
... |
<reponame>charlesblakemore/opt_lev_analysis<filename>scripts/spinning/plot_phase_vs_pressure_v2.py
import numpy as np
import matplotlib.pyplot as plt
from piecewise_line import *
import scipy.optimize as opti
import scipy.interpolate as interp
import matplotlib
plt.rcParams.update({'font.size': 14})
#base_path = "/ho... |
# -*- coding: utf-8 -*-
import time
from tqdm import tqdm
import numpy as np
import torch
import logging
from sklearn.metrics import pairwise_distances
import scipy.sparse as sp
def get_embedding_matrix(vec_model, tokenizer, mode="glove"):
# values of word_index range from 1 to len
embedding_matrix = np.rando... |
<filename>tests/test_tria3r_static_point_load.py
import sys
sys.path.append('..')
import numpy as np
from scipy.spatial import Delaunay
from scipy.linalg import solve
from composites.laminate import read_isotropic
from tudaesasII.tria3r import Tria3R, update_K, DOF
#def test_nat_freq_plate(plot=False, mode=0):
plot... |
<filename>spheroid_simulator/artifacts.py
from random import randint, randrange
import numpy as np
import scipy.stats as st
from scipy import signal
from skimage.exposure import rescale_intensity
class Artifacts:
"""Add artifacts to images"""
def __init__(self, img_size, artifacts_nb, intensity):
se... |
<filename>bin/clustering.py
"""
Cluster genes based on %id with cutoffs
"""
import os
import sys
import argparse
import scipy
import scipy.cluster.hierarchy as sch
def parse_text_file(tf):
"""
Parse a text file and return an n-choose-2 array of the elements. The array returned has the distance from the fi... |
#import some necessary librairies
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
%matplotlib inline
import matplotlib.pyplot as plt # Matlab-style plotting
import seaborn as sns
color = sns.color_palette()
sns.set_style('darkgrid')
import warnings
def ignore... |
""" statistical analysis methods
This script allows the user to perform statistical models likde PCA , PLS and PLS-DA to used spesifically on NMR data
and get plots that help to undrestande and validate those model results
This script requires that `pandas` , 'numpy' , 'scikit-learn' , 'scipy' and 'matplotlib' be... |
<reponame>mfranco/pymir<gh_stars>1-10
from pymir import settings
from pymir.utils.readers import (
load_musicnet_metadata, load_musicnet_ds)
import csv
import os
import numpy as np
from scipy import fft
fs = 44100 # samples/second
stride = 512 # samples between windows
wps = fs/float(512) ... |
<gh_stars>0
'Respuesta de los laboratorios de Ironhack_JLMC'
'Laboratorio 3'
############################ DUEL OF SORCERERS #################
gandalf = [10, 11, 13, 30, 22, 11, 10, 33, 22, 22]
saruman = [23, 66, 12, 43, 12, 10, 44, 23, 12, 17]
Gandalf_wins = 0
Saruman_wins = 0
Ties = 0
x = len(gandalf)
y = len(saru... |
#coding:utf-8
import struct
import sys
import wave
import numpy as np
import scipy.fftpack
from pylab import *
from correlation import correlate_calculator
def generate_m(n, gen_poly):
m = []
for i in range(n):
m.append(0)
m[0] = 1
for i in range(n, 2 ** n - 1):
bit = 0
for j... |
<filename>assignments/assignments/loading.py
import os
import os.path as P
import sys
import tarfile
import numpy as np
from scipy import ndimage
from six.moves import cPickle as pickle
from six.moves.urllib.request import urlretrieve
DATA_DIR = "data"
def letter_for(label):
"""Return the letter for a given la... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 01 19:34:50 2017
@author: Matt
"""
from scipy.sparse import lil_matrix
import numpy as np
from scipy.optimize import linprog
from os import listdir, getcwd, system
class problem:
def __init__(self, filename):
self.name = None
self.rows = {}
... |
import pickle
import time
import numpy
import theano
from theano import sandbox
import theano.tensor as tensor
import os
import scipy.io
from collections import defaultdict
from theano.tensor.shared_randomstreams import RandomStreams
dtype=theano.config.floatX
def sample_weights(nrow, ncol):
bound = (numpy.sqrt(6... |
<reponame>osadj/calibrtion<filename>logreg.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 4 19:04:02 2021
@author: <NAME> <<EMAIL>>
"""
import numpy as np
from scipy.special import expit, xlogy
from scipy.optimize import fmin_l_bfgs_b
def platt_calibration(f, y):
"""Classif... |
import os,sys,math
import numpy
import random
import time
import pglobals
import pio
import copy
import inspect
import timeit
try: from collections import defaultdict
except: pass
from scipy.optimize import *
from scipy.linalg import *
import pminimise
def printl(*args):
if(pio.verbose):
frm = inspect.st... |
<gh_stars>1-10
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import scipy
import scipy.io.wavfile as wav
import librosa
import random, os
from sklearn import preprocessing
import glob
from PIL import Image
from tqdm import ... |
<filename>tests/vec_test.py<gh_stars>10-100
"""Tests for vectors."""
import pytest
from sympy import sympify, SympifyError
from drudge import Vec
def test_vecs_has_basic_properties():
"""Tests the basic properties of vector instances."""
base = Vec('v')
v_ab = Vec('v', indices=['a', 'b'])
v_ab_1 =... |
"""
Модуль с полезными функциями
"""
from collections import defaultdict
import numpy as np
import pandas as pd
import scipy.stats as sts
from typing import List, Dict, Any, Union, Optional
from IPython.display import display
from matplotlib import pyplot as plt
from scipy.cluster import hierarchy
from sklearn.linea... |
<filename>core/controllers/filter_controller_var2.py
from numpy import dot, maximum
from numpy.linalg import solve
from numpy import sign
from scipy.linalg import sqrtm
import cvxpy as cp
import numpy as np
import scipy
from cvxpy.error import SolverError
from .controller import Controller
class FilterControllerVar2(C... |
import numpy as np
#np.random.seed(11)
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics import r2_score, mean_absolute_error, mean_squared_error
from sklearn.preprocessing import StandardScaler
import h5py
import os.path as osp
import os
from scipy import ndimage
from glob import glob
from tqdm ... |
from typing import List
import numpy as np
from scipy.optimize import minimize
from sklearn.metrics import mean_absolute_error
from sklearn.model_selection import KFold
from utils.utils import LoggerFactory
logger = LoggerFactory().getLogger(__name__)
def get_score(
weights: np.ndarray, train_idx: List[int], o... |
<reponame>vincealdrin/Tutu<filename>detector/categorizer.py<gh_stars>1-10
from db import get_articles_filtered
from sklearn.feature_extraction.stop_words import ENGLISH_STOP_WORDS
from sklearn.metrics import confusion_matrix, classification_report, auc, roc_curve, accuracy_score
from sklearn.model_selection import trai... |
<gh_stars>0
import basilica
import numpy as np
import pandas as pd
from scipy import spatial
from .models import DB, Strain
def predict_strains(user_input):
'''Returns top 5 strains based on desired characteristics'''
embedded_df = pd.read_pickle("static/medembedv2.pkl")
# Embed the user input
with ba... |
"""
load ground true
"""
import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
# avenue testing label mask
from scipy.io import loadmat
import os
# root F:\avenue\pixel ground truth\ground_truth_demo\testing_label_mask
def load_single_mat(mat_file_floder,n_clip=1,dataset="Avenue",vis=True):
... |
import os
from cores.config import conf
import scipy.io as sio
import numpy as np
import cores.utils.misc as misc
import shutil
from PIL import Image
import cPickle as pickle
#convert SBD data and VOC12 data to our format.
if __name__ == "__main__":
misc.my_mkdir(conf.DATASET_PATH)
misc.my_mkdir(os.path.join(... |
import math
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import xgboost
from scipy.stats import pearsonr
from sklearn.linear_model import Ridge, LinearRegression, Lasso
from sklearn.metrics import mean_squared_log_error
from sklearn.model_selection import KFold
from sklearn.pi... |
<reponame>Giljermo/hw1_log_analyze<filename>utils.py
import os
import re
import gzip
from array import array
from datetime import datetime as dt
from statistics import median
from string import Template
def get_log_attrs(config):
"""
поиск наменования актуального лога, а получения его даты создания
"""
... |
from __future__ import print_function
import os
import numpy as np
import pandas as pd
import scipy.stats as sps
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import seaborn as sns
from statsmodels.stats.multicomp import pairwise_tukeyhsd
from shelve import DbfilenameShelf
from contextlib impor... |
<gh_stars>1-10
# 2015-03-23 LLB remove 1s wait time between snapshots
import corr, adc5g, httplib
import matplotlib.pyplot as plt
import numpy as np
import scipy.optimize
import sys, time
r2 = corr.katcp_wrapper.FpgaClient('r2dbe-1')
r2.wait_connected()
if len(sys.argv) == 2:
rpt = int(sys.argv[1])
else:
rpt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.