text string |
|---|
<filename>properties.py
import arabic_reshaper
import itertools
import math
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import seaborn as sns
import sys
import warnings
from bidi.algorithm import get_display
from matplotlib import rc
from matplotlib.backends import backend_gtk3
fro... |
<gh_stars>1-10
import numpy as np
import pylab as pl
import json
import pandas
import scipy.stats as S
from datetime import datetime
import time
import sys
#sys.path.append("/home/ubuntu/finlib_bin/modules/pymodules/")
#import finlib.statistics.pwlaw as pwlaw
#sys.path.append("/home/ubuntu/github/AstroWeekStudy/pytho... |
<reponame>ulf1/bwsample
import itertools # to_scipy
import scipy.sparse # to_scipy
import numpy as np # to_scipy, calibrate
import sklearn.linear_model # adjustscore
import sklearn.preprocessing # adjustscore
import scipy.special # adjustscore
from typing import Dict, Tuple, List, Optional
ItemID = str # add_dok... |
'''
.. codeauthor:: <NAME> <<EMAIL>>
'''
import pytest
import numpy as np
from scipy import stats
from ..spectral import make_colored_noise, spectral_density
from ...grids import UnitGrid, CartesianGrid
def test_colored_noise():
""" test the implementation of the colored noise """
... |
import cmath
from concurrent.futures import ProcessPoolExecutor
from ctypes import c_void_p
from itertools import repeat
from math import pi
import numpy as np
from numba import carray, cfunc, njit
from scipy import LowLevelCallable
from scipy.integrate import quad
from scipy.optimize import leastsq
from fyne import ... |
import cv2
import torch
import natsort
import itertools
import numpy as np
import matplotlib.pyplot as plt
import os
import sys
import time
import math
from glob import glob
from scipy.misc import imsave
param_dir = './params/sampled/mnist/test1/'
model_dir = 'encoders/'
def save_model(args, net, optim, m_name):
... |
#
# gemini_python
#
# primitives_gnirs_image.py
# ------------------------------------------------------------------------------
import numpy as np
import scipy.ndimage
from skimage.morphology import bi... |
"""
Script to parse 5C data from Nora et al., Nature 2012
"""
import os
import numpy as np
def parse_5C_file(filename):
"""
Reads the raw 5C data file and returns reverse restriction fragments,
forward restriction fragments, and a matrix of shape
(# forward fragments + 2, # reverse fragments + 2).
... |
<filename>utils.py
import numpy as np
from scipy.misc import imread, imresize, toimage
import cv2
from keras.preprocessing.image import img_to_array, load_img
def read_images(img_paths):
"""
Use the scipy imread function to read each image into a nunmpy array
:param img_paths: Numpy array of image paths ... |
"""
"""
# Libraries
import itertools
import numpy as np
import pandas as pd
# Pint libraries
from pint.errors import UndefinedUnitError
# DataBlend libraries
from datablend.core.settings import textwrapper
from datablend.core.settings import ureg
from datablend.utils.compute import add_days
from datablend.utils.pan... |
<gh_stars>0
# code from: https://towardsdatascience.com/build-an-extreme-learning-machine-in-python-91d1e8958599
# data from: https://www.kaggle.com/oddrationale/mnist-in-csv
from time import time
t0=time()
hidden_size = 1000 # 2k:80,72 1k:28,21 500:16,8
import numpy as np
import pandas as pd
from sklearn.model_sel... |
import numpy as np
import pandas as pd
from numpy.random import randn
from scipy import stats
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
ds1 = randn(80)
#sns.boxplot(ds1, orient='v').get_figure().savefig('box1.png')
sns.boxplot(ds1,whis=np.inf).get_figure().savefig('box2.png')
|
<reponame>m-serra/ADR
import os
import math
import neptune
from scipy.stats import norm
import pickle
import numpy as np
import tensorflow as tf
from termcolor import colored
import moviepy.editor as mpy
from data_readers.bair_data_reader import BairDataReader
from data_readers.google_push_data_reader import GooglePush... |
<gh_stars>0
#Fixing incompatability issue
import matplotlib
matplotlib.use('TkAgg')
#TKinter Modules
import tkinter as TK
from tkinter import ttk
from tkinter.filedialog import askopenfilename
#KinMS Modules
from KinMS import KinMS
from makebeam import makebeam
#Importing Numpy, Pandas and Matplotlib
impor... |
<reponame>karlosos/image_vector_quantization<filename>experiments/differential_encoding_experiments.py
"""
In this experiment I was testing differential encoding for a single image.
"""
from PIL import Image
import matplotlib.pyplot as plt
from scipy.stats import entropy
import numpy as np
from vector_quantization.m... |
"""
Created on Fri Mar 20 11:03:30 2020
Author: <NAME>
Description:
This file introduces base solver classes and tools for these classes.
It also contains a crude attempt at multiresolution analysis.
"""
import numpy as np
from scipy.optimize import minimize
from scipy.interpolate import griddata
from s... |
# Copyright (c) 2017 Sony Corporation. 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 applicabl... |
<filename>drivers/calc_empirical_isochrone_age.py
import numpy as np, pandas as pd, matplotlib.pyplot as plt
import os, pickle
from numpy import array as nparr
from rudolf.paths import DATADIR, RESULTSDIR
from rudolf.helpers import (
get_deltalyr_kc19_gaia_data, get_simulated_RM_data,
get_keplerfieldfootprint... |
import numpy as np
from scipy.sparse import csc
from sklearn.datasets import make_blobs
"""
1. i need LogisticRegression class
2. I need __init__ function with learning rate and #iteration parameter
3. I need train function with X,y parameter
4. I need predict function
5. I need sigmoid function for gradiant decent and... |
<gh_stars>0
import itertools
import os
import math
import numpy as np
import scipy.spatial as ss
import basis.robot_math as rm
from panda3d.bullet import BulletRigidBodyNode
from panda3d.bullet import BulletTriangleMesh
from panda3d.bullet import BulletTriangleMeshShape
from panda3d.bullet import BulletWorld
from panda... |
<gh_stars>1-10
import logging
import numpy as np
import scipy.signal
import ray
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.policy.tf_policy_template import build_tf_policy
from ray.rllib.utils import try_import_tf
tf = try_import_tf()
from algorithms.agents.intrinsic import INTRINSIC_REWARD... |
<reponame>sanghiad/vae_vampprior
from torch.utils.data import Dataset, DataLoader
import numpy as np
import os
import matplotlib.image as mpimg
import scipy.misc as misc
def load_data(dataset_loc, partition_type):
file_names = sorted(os.listdir(dataset_loc))
meta_file_name = dataset_loc + "list_eval_partiti... |
<reponame>jacopok/notes
# %%
'''
# General Relativity
'''
# %%
import numpy as np
import matplotlib.pyplot as plt
from functools import partial
import ipywidgets
def gamma(b):
return 1/np.sqrt(1-b**2)
# %%
'''
### Hw1.3
How does an isotropically emitting gamma source look like from the point of view of a moving... |
<reponame>mfkiwl/hdl_localization
#!/usr/bin/python3
import rospy
import numpy
import scipy.spatial
from matplotlib import pyplot
from hdl_localization.msg import *
class Plotter(object):
def __init__(self):
pyplot.ion()
pyplot.show(block=False)
self.status_buffer = []
self.timer = rospy.Timer(rospy.Duratio... |
<gh_stars>0
import numpy as np
import pylab, time, scipy
import scipy.sparse
import regreg.regression as regreg
import regreg.lasso as lasso
import regreg.graphnet as graphnet
import regreg.signal_approximator as glasso
from tests import gen_adj
import nose.tools
control = {'max_its':5500,
'tol':1.0... |
<reponame>UoB-HPC/performance-portability<filename>metrics/scripts/averages.py
#!/usr/bin/env python3
# Copyright (c) 2020 Performance Portability authors
# SPDX-License-Identifier: MIT
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import argparse
from statistics import mean, harmonic_mean, m... |
import torch
import torch.nn as nn
import torch.optim as optim
import matplotlib.pyplot as plt
import time
import argparse
import scipy.io as scio
from scipy.io import savemat
from utils import solve
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from keras.models import Sequential
from keras.... |
"""
Simulating a black body curve
"""
from scipy.optimize import curve_fit
import pylab as plt
import numpy as np
def blackbody_lam(lam, T):
""" Blackbody as a function of wavelength (um) and temperature (K).
returns units of erg/s/cm^2/cm/Steradian
"""
from scipy.constants import h,k,c
lam = 1e... |
import numpy as np
import matplotlib.pyplot as plt
# analysis
from sklearn.decomposition import PCA, FactorAnalysis
from sklearn.linear_model import LinearRegression
from scipy import stats, interpolate
from scipy import linalg as LA
# miscellaneous
from tqdm import tqdm
from itertools import cycle
from copy import d... |
<reponame>Foysal87/SBNLTK
import numpy as np
import sbnltk_default
from Downloader import downloader
from scipy import spatial
import fasttext
import pickle
class fasttext_embedding:
__dl=downloader()
__w2v=None
def __init__(self):
self.__dl.download('fasttext_w2v',sbnltk_default.sbnltk_root_path+... |
import logging
from typing import Tuple, Union
import dask.array as da
import dask.dataframe as dd
import dask_distance as ddst
import numpy as np
import scipy.spatial.distance as dst
from sklearn.base import (
BaseEstimator,
ClusterMixin,
TransformerMixin,
)
from sklearn.utils.validation import check_is_f... |
import numpy as np
from scipy import signal
FREQ = 20
class RealtimeFilter():
def __init__(self, b, a):
assert(len(b) == len(a))
self.n = len(b) # n = order + 1
self.b = b
self.a = a
self.reset()
def reset(self):
self.input = np.zeros(self.n, dtype=np.float)
self.output = np.zeros(s... |
<reponame>laowantong/paroxython<filename>examples/idioms/programs/075.0675-compute-lcm.py<gh_stars>10-100
"""Compute LCM.
Compute the least common multiple _x of big integers _a and _b. Use an integer type able to handle huge numbers.
Source: deleplace
"""
# Implementation author: cym13
# Created on 2016-02-18T16:58... |
<filename>live_detection_with_audio.py
import cv2
import pycuda.autoinit
from multiprocessing import Process,Queue
from utils.yolo_with_plugins import TrtYOLO
from utils.yolo_classes import get_cls_dict
from utils.camera import add_camera_args, Camera
from utils.display import open_window, set_display, show_fps
from u... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import keras
keras.__version__
# # Neural style transfer
#
#
# This notebook contains the code samples found in Chapter 8, Section 3 of [Deep Learning with Python](https://www.manning.com/books/deep-learning-with-python?a_aid=keras&a_bid=76564dff). Note that the ori... |
<filename>angle_to_position.py<gh_stars>0
#!/usr/bin/env python
import matplotlib.pyplot as plt
import matplotlib.mlab as mb
import numpy as np
import csv
import re
import math
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import pandas as pd
from pandas import DataFrame
import sys
from scipy.inter... |
import numpy as np
from scipy.optimize import curve_fit
import scipy.fftpack as fft
import matplotlib.pyplot as plt
np.set_printoptions(linewidth=500)
def savitzky_golay(y, window_size, order, deriv=0, rate=1):
r"""
Smooth (and optionally differentiate) data with a
Savitzky-Golay filter.
The Savi... |
#!/usr/bin/python
# Copyright (C) 2006 Imperial College London and others.
#
# Please see the AUTHORS file in the main source directory for a full list
# of copyright holders.
#
# Prof. <NAME>
# Applied Modelling and Computation Group
# Department of Earth Science and Engineering
# Imperial College... |
<gh_stars>0
import numpy as np
import sympy as sp
import matplotlib.pyplot as plt
def make_euler_equation(dc1, dc2, u, c1, lmbda):
''' Construct the euler equation.
Args:
dc1: derivative of lagrangian w.r.t c1
dc2: derivative of lagrangian w.r.t c2
u: within period utility functio... |
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from scipy import stats
from ..utils import check_multigraphs
def _test(i, j, *multigraphs):
"""Calculate p-value for a specific edge."""
# Subset samples by population
samples = [subpop[:, i, j] for subpop in multigraphs]
... |
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.pyplot as plt
from numpy import log10 as lg
from numpy import pi as pi
from scipy.interpolate import interp1d as sp_interp1d
from scipy.integrate import odeint
from scipy.integrate import ode
import warnings
import timeit
import sci... |
<reponame>jaakjensen/PythonDSP
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
######################################################################
######################################################################
##############################################################... |
import sys, wx
sys.path.append("../../")
from sciwx.mesh import Canvas3D, MCanvas3D
from sciapp.util import surfutil, meshutil
from sciapp.object import Scene, Mesh, Surface2d, Surface3d, TextSet, Volume3d
from sciwx.mesh import Canvas3DFrame, Canvas3DNoteBook, Canvas3DNoteFrame
import sys, wx
import scipy.ndimage as... |
<gh_stars>0
# Copyright (c) <NAME>.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory.
#
# This code implements a variant of the multi objective flexible job shop problem
# and is derived from https://github.com/dietmarwo/fast-cma-es/blob/master/examples/jobshop.p... |
<filename>data_modules.py
#https://www.robots.ox.ac.uk/~vgg/data/fgvc-aircraft/
#https://github.com/lvyilin/pytorch-fgvc-dataset/blob/master/aircraft.py
import logging
import os
import pytorch_lightning as pl
from torch.utils.data import DataLoader
from torchvision.datasets.utils import download_url, extract_archive
... |
#! /usr/bin/env python
# S.Rodney
# 2012.05.03
# plotting magnitudes, colors, redshifts, etc. from a SNANA simulation table.
import pyfits
import os
import exceptions
import numpy as np
import pylab as p
import time
import glob
from constants import SNTYPEDICT
BANDORDER = 'STUCBGVRXIZWLYMJOPNQH'
BANDORDER_RED2BLU... |
<filename>digit_single.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 28 12:42:15 2020
@author: KFH
This script is for comparing bmd in multiple digits, using .npy data files
created from processing of microCt images
NOTE: this depends on variables and data created by mdbands.py
@author: KFH
""... |
import scipy.io.wavfile as wavf
import numpy as np
def to_wav(data):
isInt16 = True # Int16 ou Float32 ?
fs = 16000 # 44100 ou 16000 ?
out_f = 'out.wav'
if isInt16:
wavf.write(out_f, fs, np.float32(np.array(data)/32767))
else:
wavf.write(out_f, fs, np.array(data))
|
import argparse
import pickle
import numpy as np
import os
import pandas as pd
import scipy.sparse as sp
import torch
from torch import nn
import torch.nn.functional as F
from scipy.sparse import linalg
from torch.autograd import Variable
from torch.utils.data.dataset import Dataset
from pygsp import graphs, filters
i... |
from __future__ import division
import os,time
import numpy as np
import tensorflow as tf
import scipy.io
MEAN_VALUES = np.array([123.6800, 116.7790, 103.9390]).reshape((1,1,1,3))
def build_net(ntype,nin,nwb=None,name=None):
if ntype=='conv':
return tf.nn.relu(tf.nn.conv2d(nin,nwb[0],strides=[1,1,1,1],pad... |
<reponame>mark-koren/bracket_pool_outcome_generator
import pdb
import numpy as np
from scipy import spatial
from pathlib import Path
import csv
import pickle
from string import digits
import pandas as pd
from pdfminer.layout import LAParams, LTTextBox, LTTextLine
from pdfminer.pdfdocument import PDFDocument
from pdfmi... |
<reponame>ManchesterBioinference/burstInfer
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 17 18:00:10 2020
@author: Jon
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 17 01:33:52 2020
@author: jbowl
"""
import scipy
import numpy as np
import datetime
print(datetime.datetime.now().time())
print('start program')
f... |
# Python Code implementation for Class_Reg ALGORITHM
import pandas as pd
import numpy as np
import itertools
from sklearn.model_selection import train_test_split
from models import *
from sklearn.metrics import accuracy_score,mean_squared_error
from tqdm import tqdm
import random
from sklearn.metrics import median_abs... |
<filename>csld/structure.py
#!/usr/bin/env python3
"""
This module provides classes used to define a periodic structure.
"""
# adapted from original version in pymatgen version from pymatgen
import math
import collections
import itertools
from abc import ABCMeta, abstractmethod, abstractproperty
import warnings
imp... |
<reponame>tristanang/bilayer-clusters
from sklearn.cluster import DBSCAN
from scipy.cluster import hierarchy
import numpy as np
import random
from bilayer_clusters import euclideanDist
def dbscan_wrapper(arr,L,cutoff):
edm = euclideanDist.edm(L,arr)
db = DBSCAN(eps=cutoff, min_samples=2, metric='precomputed... |
import cv2
import numpy as np
import sys
# TODO:use peak-finding
import peakutils
from scipy import signal
def cutLine(img):
img_gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
# ret, img_thres = cv2.threshold(img_gray, 115, 255, cv2.THRESH_BINARY)
ksize=11
blur = cv2.GaussianBlur(img_gray,(ksize,ksize),0... |
<filename>samples/recommender.py
import json
import sys
import random
import numpy as np
import pandas as pd
import statistics as st
from time import time
from progress.bar import Bar
from stable_baselines.common.policies import MlpPolicy
from stable_baselines import A2C, PPO2
from samples.environment.recommender4Stude... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # S_Mi... |
<reponame>dtiarks/ThesisPlot
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 13 11:25:42 2017
@author: daniel
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
import json
import io
from scipy.optimize import newton
from scipy import integrate
from scipy.optimi... |
<reponame>PredictiveScienceLab/inverse-bgo<filename>pydes/_cholesky.py
"""Everything related to Cholesky decomposition.
Author:
<NAME>
Date:
2/1/2013
"""
__all__ = ['update_cholesky', 'update_cholesky_linear_system']
import numpy as np
import scipy.linalg
def update_cholesky(L, B, C):
"""Updates the... |
# Numpy
import numpy as np
# Scipy
from scipy.stats import linregress
# Matplotlib
import matplotlib.pyplot as plt
def plot_spectrum(spectrum, freqs=None, drop_zero_frequency=True, ax=None,
xlog=False, ylog=False, loglog=False,
variance_preserving=False, xlim=None,
... |
<reponame>OObasuyi/evidential-deep-learning
import h5py
import os
from scipy.io import loadmat
import cv2
from tqdm import tqdm
import numpy as np
nyu_root = "/data/nyu_depth_processed"
train_path = "./data/depth_train_big_new.h5"
test_path = "./data/depth_test_big_new.h5"
if not path.isdir(nyu_root):
raise Value... |
<gh_stars>1-10
#### Standard Library Imports
import os
#### Library imports
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage import gaussian_filter, median_filter
from IPython.core import debugger
breakpoint = debugger.set_trace
#### Local imports
from scan_data_utils import *
from research_utils... |
import os
import numpy as np
from cffi import FFI
import cv2
import matplotlib.pyplot as plt
from scipy.cluster.vq import kmeans,kmeans2,vq
# For trajectory storage
import h5py
import uuid
# For loading dataset MATLAB metadata
import scipy.io as sio
import random
# for Multi-threading
from multiprocessing.dummy im... |
<filename>keblat.py
# -*- coding: utf-8 -*-
from glob import glob
import numpy as np
#from scipy import interpolate
#from ext_func.occultquad import occultquad
#from ext_func.rsky import rsky
import matplotlib.pyplot as plt
import os.path
import time
from collections import OrderedDict
try:
from helper_funcs impo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 23 11:59:35 2020
@author: apple
"""
import numpy as np
from scipy.linalg import fractional_matrix_power
def VerifyVariance(Yp,Yt,Vp):
# Yp: Standarized predictions Tasks x TestSamples
# Vp: Standarized Covariance matrices Tasks x Tasks... |
import numpy as np
from fatiando.gridder import regular
from fatiando.utils import ang2vec, vec2ang
from fatiando.constants import CM, T2NT, G, SI2MGAL, SI2EOTVOS
from scipy.optimize import nnls
def sph2cart(mag,inc,dec):
'''
Calculate the Cartesian coordinates of a vector
input
mag: float - Magnetiz... |
"""Set up the environment for doctests.
This file is automatically evaluated by pytest. It ensures that we can write
doctests without distracting import statements in the doctest.
"""
import numpy
import pytest
import sympy
import qalgebra
@pytest.fixture(autouse=True)
def set_doctest_env(doctest_namespace):
""... |
<reponame>andriyor/tslearn<gh_stars>1000+
# -*- coding: utf-8 -*-
"""
1-NN with SAX + MINDIST
=======================
This example presents a comparison between k-Nearest Neighbor runs with k=1.
It compares the use of:
* MINDIST (see [1]) on SAX representations of the data.
* Euclidean distance on the raw values of th... |
"""classifier.py
Define the classifier class and the preprocessing method
"""
import os
import glob
import math
import json
import cv2
from scipy import ndimage
import numpy as np
from keras.models import load_model
from src.detector import char_detect_segment as det_seg
def get_best_shift(img):
"""
DESCRIPTI... |
<reponame>billbrod/spatial-frequency-model
#!/usr/bin/python
"""2d tuning model
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import torch
import warnings
import itertools
import re
from scipy import stats
MODEL_ORDER = ['constant_donut_period-iso_amps-iso', 'scaling_donut_period-iso_amps-... |
<reponame>Grupo-de-Pesquisa-em-Macro-Aplicada/Ibmec-Pesquisa-Macro-Aplicada
import numpy as np
from scipy.stats import norm
from numba import njit, guvectorize
import scipy.linalg
import re
import inspect
'''Part 1: Efficient linear interpolation exploiting monotonicity.
Interpolates increasing query points xq ag... |
'''
使用最小二乘法拟合正弦函数
'''
import numpy as np
from scipy import optimize
import matplotlib.pyplot as plt
#定义拟合函数图形
def func(x,p):
A,k,theta = p
return A*np.sin(2*np.pi*k*x+theta)
#定义误差函数
def error(p,x,y):
return y-func(x,p)
#生成训练数据
#随机给出参数的初始值
p0 = [10, 0.34, np.pi/6]
A,k,theta = p0
x = np.linspace(0, 2*np.... |
<filename>code/libs/misc.py
"""Miscellaneous functions."""
import os.path
import json
import time
import datetime
import numpy as np
import h5py
import math
from scipy import linalg
from scipy.stats import t
from scipy.sparse import csr_matrix
from copy import deepcopy
########################
# MISC
##############... |
# -*- coding: utf-8 -*-
import numpy as np
import netCDF4 as nc
from pyproj import Proj
from matplotlib import pyplot as plt
from scipy import ndimage
from scipy.ndimage.measurements import center_of_mass
import matplotlib
matplotlib.use('Agg')
from mpl_toolkits.basemap import Basemap, addcyclic, shiftgrid
import ast
... |
# Training code for D4D Boston Crash Model project
# Developed by: bpben
import re
import csv
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as ss
from glob import glob
from sklearn.metrics import classification_report
from sklearn.preprocessing import S... |
#!/usr/bin/env python
from sympy import *
class Solution:
def inverse_schwarzschild(self):
"""
Description
===========
Returns the classic black hole solution. Uncharged and rotationally stationary.
Examples
========
>>> print(Solution().schwarzschil... |
import numpy as np
import xarray as xr
from scipy import ndimage as ndi
def get_min_dist_for_objects(distance_array, labels):
if isinstance(labels, xr.DataArray):
bins = np.cumsum(np.bincount(labels.data.ravel()))
args = np.argsort(labels.data.ravel())
else:
bins = np.cumsum(np.bincount... |
# Copyright 2021 AIPlan4EU project
#
# 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 in wri... |
import numpy as np
import scipy.sparse as sp
from numpy import ctypeslib
from .pardiso_interface import pardisoinit, pardiso
"""
mtype options
1 -> real and structurally symmetric
2 -> real and symmetric positive definite
-2 -> real and symmetric indefinite
3 -> complex and structurally symmetric
4 -> comple... |
<filename>utils.py
from tqdm import tqdm
import requests
import os
from PIL import Image
import numpy as np
from skimage.segmentation import slic
from scipy.spatial import ConvexHull
#------------------------------------------------------------------
# I/O
#------------------------------------------------------------... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: <NAME>, <NAME>, <NAME>
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
#
# Contributors: <NAME> <<EMAIL>>
from __future__ import absolute_import, division, print_function
from scipy import io
import num... |
<filename>utils.py
import numpy as np
import scipy as sp
from quaternion import from_rotation_matrix, quaternion
from rlbench.environment import Environment
from rlbench.action_modes import ArmActionMode, ActionMode
from rlbench.observation_config import ObservationConfig
from rlbench.tasks import *
from pyrep.const ... |
<filename>pre_modified_server_side_scripts/Savior.pyw
#************************************************
# Copyright 2010 *
# The University of Rochester *
# All Rights Reserved *
# *
# <NAME> (<EMA... |
import numpy as np
from scipy import interpolate
from skimage.restoration import unwrap_phase
import warnings
def interpolate_field(field, newsize, info=None, verbose=False):
"""Interpolate two-dimensional complex field
Parameters
----------
field: 2d ndarray of shape (M,M)
The field image
... |
from util import *
from scipy.spatial.distance import pdist
def toDistance(R):
"""
This function takes a numpy array containing positions and returns it as distances.
Parameters:
-R:
numpy array containing positions for every atom in every sample
Dimensions: (n_samples,n_a... |
<reponame>Qiskit/monodromy
"""
test/test_haar.py
Tests for monodromy/haar.py .
"""
import ddt
import unittest
from fractions import Fraction
from monodromy.coordinates import positive_canonical_alcove_c2
from monodromy.coverage import build_coverage_set, CircuitPolytope
from monodromy.haar import *
from monodromy.s... |
#
# Check convergence of pybamm model to "true" comsol solution (i.e. extremely fine mesh)
#
import pybamm
import numpy as np
import os
import pickle
import scipy.interpolate as interp
import matplotlib.pyplot as plt
# change working directory to the root of pybamm
os.chdir(pybamm.root_dir())
# choose npts for compa... |
<filename>Eval/testing.py
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import pandas as pd
from scipy.io import wavfile
from scipy import signal
import matplotlib.pyplot as plt
import Data.dataset as ds
import Eval.reconstruct as rc
N_BINS = 64
FS = 16000
device ... |
import numpy as np
from .Templates import Estimator_mimo, Descriptor
from SCM3GPP.scm_helper_MIMO import scm_channel
from SCM3GPP.toeplitz_helpers import best_circulant_approximation, vec2mat, mat2vec, best_block_circulant_approximation
from training_CNN_mimo import pilot_matrix
from scipy.linalg import toeplitz, circ... |
<filename>sources/doAnova.py
import pandas as pd
# load data file
df = pd.read_csv("foranova.csv", sep=",")
# reshape the d dataframe suitable for statsmodels package
#df_melt = pd.melt(df.reset_index(), id_vars=['index'], value_vars=['A', 'B', 'C', 'D'])
# replace column names
#df_melt.columns = ['index', 'treatments... |
<reponame>mnpinto/fire_split
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified).
__all__ = ['read_data', 'save_data', 'split_fires', 'to_polygon', 'run_all']
# Cell
from IPython.core.debugger import set_trace
import rasterio
import rasterio.features
from rasterio.crs import CRS
fro... |
<reponame>anirudhgj/hmr
from scipy.signal import savgol_filter
import numpy as np
from commons import skeleton_data as sk_data
from commons import prior_sk_data as psk_data
def smoothen(preds, window=11, order=3, axis=0):
return savgol_filter(preds, window, order, axis=axis)
def get_parent_relative_joint_locat... |
# machine learning module
import numpy as np, pandas as pd
from sklearn.cluster import KMeans
from sklearn.cluster import AgglomerativeClustering
import statistics
import matplotlib.pyplot as plt
import statsmodels.api as sm
from sklearn.linear_model import LogisticRegression
from sklearn import svm, metrics
from skl... |
import numpy as np
from typing import *
from numpy.typing import ArrayLike
from scipy.spatial import Delaunay
from tallem.utility import ask_package_install, package_exists
def flywing():
''' Fly wings example (Klingenberg, 2015 | https://en.wikipedia.org/wiki/Procrustes_analysis) '''
arr1 = np.array([[588.0, 443.0]... |
<gh_stars>100-1000
import scipy.io as sio
import numpy as np
import mne
import pickle
subj=1
subj_blocks = list()
for subj in range(1,17):
print(subj)
dataname = 's%d_sess3' % (subj)
SP = sio.loadmat('C:\\Data_speech\\'+dataname
, struct_as_record=False, squeeze_me=True)
temp = SP[... |
from dotenv import load_dotenv
from sympy import sympify, integrate, Symbol
from sympy.solvers import solve
import config
from mbutil.autosolver import AutoSolver
from mbutil.mathml import MATHML
from mbutil.util import sanitize_input, round_res
class Solver:
@staticmethod
def __solver(f, g, a, b):
x... |
import matplotlib.pyplot as plt
from collections import OrderedDict
import datetime
import numpy as np
from scipy.io import loadmat
import torch
import os
from os import listdir
def get_cwru_filepaths(root_dir,health_states,motor_load):
"""
Utility function that fetches all data filepaths corresponding
to ... |
<gh_stars>1-10
#!/usr/bin/env python
#
# Copyright 2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or... |
"""Transform task from dictionaries to task objects for the event simulator."""
import utilities.task as t
from scipy import stats
class Transformer:
"""Transformer class."""
def __init__(self, t_id, t_task_sets, time_scale=10000000):
"""Creates a transformer object."""
self.id = str(t_id) #... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.