text string |
|---|
<reponame>x75/scapps<filename>fm_2018_brunel/resfinder.py
"""resonance finder
"""
import argparse
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import chirp, spectrogram
# from scipy.signal import butter, lfilter_zi, lfilter
from scipy import signal
def main_single(args):
# print "args",... |
from __future__ import print_function
import scipy.sparse as sp
import numpy as np
from scipy.sparse.linalg.eigen.arpack import eigsh, ArpackNoConvergence
import scipy.io
from cvxpy import *
import sys
np.set_printoptions(threshold=sys.maxsize)
def dfnets_coefficients_optimizer(mu, response, Kb, Ka, radius=0.85, sho... |
<filename>PlottingPython/Plotting/PyS_plotH5data.py
#!/usr/bin/env python
import os
import matplotlib
matplotlib.use("TKagg")
import matplotlib.pyplot as plt
import pylab
import datetime
import dateutil.parser
import argparse
from ingrid.ingrid_helper_functions import *
from scipy.optimize import curve_fit
import num... |
<filename>vnmrjpy/func/base.py
import vnmrjpy as vj
import numpy as np
from vnmrjpy.core.utils import vprint
import copy
from scipy.ndimage.filters import median_filter
import matplotlib.pyplot as plt
"""
Basic functions on varrays.
Includes:
noise_mask
average
concatenate
"""
def mask(varr, threshold=No... |
<filename>allopath/order_protein_domains.py
import argparse
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial.distance import squareform
def order_protein_domains(data, domain_composition):
""" Change the domain composition of the protein
so that it goes together
with the symmetrizat... |
from sympy import MatAdd, MatMul, Mul, flatten
from sympy import expand as sympyExpand
import itertools
def isZero(expr):
if (expr == 0 or
(hasattr(expr, 'is_Zero') and expr.is_Zero) or
(hasattr(expr, 'is_ZeroMatrix') and expr.is_ZeroMatrix) ):
return True
return False
def flattenAdd(exp... |
#!/usr/bin/env python3
import sys
import os
import numpy
import scipy.stats
import matplotlib
matplotlib.use("Agg")
import pylab
import seaborn
seaborn.set(context="paper", style="white", palette="deep")
#nonrandom
data=[numpy.loadtxt("learningON/trial"+str(i+1)+"/time_explore.csv", delimiter=",")[:,1] for i in range... |
# import os.path
# import torchvision.transforms as transforms
# from data.base_dataset import BaseDataset, get_transform
from data.base_dataset import BaseDataset
# from data.image_folder import make_dataset
# from PIL import Image
# import PIL
import h5py
import random
import torch
import numpy
import math
# import s... |
<reponame>PBGraff/SwiftGRB_PEanalysis<filename>pp_pipeline.py
import numpy as np
import os
import triangle
import matplotlib.pyplot as plt
import scipy.stats
from matplotlib.ticker import MultipleLocator
def PlotTriangle(fileroot,usetruths=True):
data = np.loadtxt(fileroot+'post_equal_weights.dat', usecols=(0,1,2,3,4... |
"""
Test spectra_wave_shape_1 for update_time
"""
import sys, os
import math, cmath
import numpy as np
import pytest
import shape_1
import corsys
import tfun
from spectral_wave_data import SpectralWaveData, SwdError, SwdFileCantOpenError, \
SwdFileBinaryError, SwdFileDataError, SwdInputValueError, SwdAllocate... |
<reponame>epatters/flowgraphs<gh_stars>1-10
import numpy as np
from scipy.cluster.vq import kmeans2
iris = np.genfromtxt('../datasets/iris.csv', dtype='f8', delimiter=',', skip_header=1)
iris = np.delete(iris, 4, axis=1)
centroids, clusters = kmeans2(iris, 3)
|
<filename>image-processing/find-path2.py
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import time
def threshold(imageArray):
balanceAr = []
newAr = imageArray
from statistics import mean
for eachRow in imageArray:
for eachPix in eachRow:
avgNum = mea... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
""" @package src.pyutil
A collection of functions specifically for python coding usage, and not related
to FEM. Some of these are borrowed/available/similar to MATLAB functions.
@author: <NAME>
Created on Sat Feb 26 18:30:11 2011
"""
import numpy as np
from scipy import ndimage,... |
<gh_stars>0
import collections
from collections import defaultdict
import sys
import json
import random
from jsmin import jsmin
from io import StringIO
import numpy as np
import copy
import importlib
from functools import partial
import math
import os
import argparse
import random
script_n = os.path.basename(__file__)... |
<filename>test_scripts/verify_MPC.py
import numpy as np
import scipy.sparse as sparse
import time
import matplotlib.pyplot as plt
from pyMPC.mpc import MPCController
if __name__ == '__main__':
import time
import matplotlib.pyplot as plt
# Constants #
Ts = 0.2 # sampling time (s)
M = 2 # mass (K... |
"""
hash_table.py
Python implementation of the very simple, fixed-array hash table
used for the audfprint fingerprinter.
2014-05-25 <NAME> <EMAIL>
"""
from __future__ import print_function
import numpy as np
import random
import cPickle as pickle
import os, gzip
import scipy.io
import math
# Current format version
... |
<filename>numecon/course_macro3/Aiyagari.py
import time
import numba
import numpy as np
from scipy import optimize
from scipy import interpolate
from types import SimpleNamespace
import matplotlib.pyplot as plt
class AiyagariModel():
############
# 1. setup #
############
def __init__(self,name='',*... |
<reponame>kj87au/Panda-Grasping<gh_stars>0
from __future__ import print_function
import sys
import numpy as np
from scipy.spatial import cKDTree
import time
import tensorflow as tf
from tqdm import tqdm
N = 5000
k = 1
dim = 3
radius = 0.1
np_matmul_time = []
np_sort_time = []
kd_build_time = []
kd_query_time = []
tf_... |
<filename>Fuzzy_clustering/version3/DatasetManager/create_datasets_PCA.py
import numpy as np
import pandas as pd
import joblib, os, logging
from joblib import Parallel, delayed
from scipy.interpolate import interp2d
from sklearn.decomposition import KernelPCA
from sklearn.preprocessing import MinMaxScaler
from sklearn.... |
<gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.optim.lr_scheduler import StepLR
import numpy as np
import sar_data as sd
import test_sar_data as tsd
import all_sar_data as asd
import os
import math
import time
import argparse
import scipy as... |
'''
Author: <NAME>
Creation Date: 9/21/2020
Helper blocks for deep_neural_net.py
'''
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Layer, Activation, Input, concatenate, Conv2D, MaxPooling2D, UpSampling2D, Cropping2D, Conv2DTranspose,BatchNormalizatio... |
"""Worker function for pylola."""
from multiprocessing import Pool
from functools import partial
import bioframe as bf
import pandas as pd
import numpy as np
from scipy.stats import fisher_exact
PSEUDOCOUNT = 10 ** -300
def _get_contingency_table(target, query, universe):
"""calculates contingency table for quer... |
""" Generic setup.py to compile each .pyx module. Build using
python cython_setup.py build_ext --inplace
"""
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np
import scipy
import Cython.Compiler.Options
Cython.Compiler.Options.annotate = T... |
<reponame>schelleg/rfsoc_sam<gh_stars>10-100
__author__ = "<NAME>"
__organisation__ = "The Univeristy of Strathclyde"
__support__ = "https://github.com/strath-sdr/rfsoc_sam"
import ipywidgets as ipw
import numpy as np
import plotly.graph_objs as go
import warnings
import matplotlib.pyplot as plt
from PIL import Image
... |
import numpy as np
import os
import random
import shutil
import gzip
import struct
import time
from statistics import mean
from base_game_model import BaseGameModel
from convolutional_neural_network import ConvolutionalNeuralNetwork
from frame import Frame
from memory import Memory
GAMMA = 0.99
MEMORY_SIZE = 900000
B... |
<filename>inversion/sgan2D_gen_model_from_noise.py
# -*- coding: utf-8 -*-
"""
@author: <NAME> <<EMAIL>>
"""
import sys
import os
#import imp
import numpy as np
from scipy.signal import medfilt
#import h5py
current_dir=os.getcwd()
sys.path.append('/home/elaloy/SGANinv/SGAN/2D/training')
from sgan2D import SGAN
cas... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Statistic and fit indices."""
from .utils import duplication_matrix
from scipy.stats import norm, chi2
from collections import namedtuple
from .optimizer import Optimizer
from .model_generalized_effects import ModelGeneralizedEffects
from .model_effects import ModelEffe... |
<reponame>tomsnail/opencv_tf_py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
from os.path import join as pjoin
import matplotlib.pyplot as plt
import sklearn
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection impor... |
from __future__ import absolute_import
import logging
from copy import copy
import numpy as np
import scipy.ndimage as nd
from .reference import generate_reference
from .reference_q4 import generate_reference_Q4, find_elm_borders_mesh, normalized_zero_mean
from ..IO.image_stack import ImageStack
from ..elements.b_sp... |
from scirpy._util import (
_is_na,
_is_false,
_is_true,
_normalize_counts,
_is_symmetric,
_reduce_nonzero,
)
from scirpy._util._graph import layout_components
from itertools import combinations
import igraph as ig
import numpy as np
import pandas as pd
import numpy.testing as npt
import pytest
i... |
'''
PlotTrace.py
Executable for plotting trace stats of learning algorithm progress, including
* objective function (ELBO) vs laps thru data
* number of active components vs laps thru data
* hamming distance vs laps thru data
Usage (command-line)
-------
python -m bnpy.viz.PlotTrace dataName jobpattern [kwargs]
'''
f... |
import numpy
import json
import cv2
import numpy as np
import os
import scipy.misc as misc
# Find segments wich are the same segments (high overlap) and merge
###############################################################################################
def MergeOverLapping(InDir,SubDir):
for DirName in o... |
<reponame>deapplegate/wtgpipeline<gh_stars>1-10
import astropy, astropy.io.fits as pyfits, os
web = os.environ['sne'] + '/photoz/COSMOS/'
#C = pyfits.open('/nfs/slac/g/ki/ki05/anja/SUBARU/COSMOS_PHOTOZ/PHOTOMETRY_W-C-IC_APER/cosmos_lephare.cat')['OBJECTS'].data
#U = pyfits.open('/nfs/slac/g/ki/ki05/anja/SUBARU/COSMOS... |
##############################################################################################
# A local simulation of coin withdrawal with 2k quadruples in an untraceable e-cash scheme #
# based on blind signatures. #
###################################... |
# Copyright (c) 2018,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Test the `grid` module."""
import logging
import numpy as np
from numpy.testing import assert_array_almost_equal
import pytest
import scipy
from metpy.cbook import get_te... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors as mcolors
from matplotlib.lines import Line2D
import scipy
import random
import os
import glob
import sklearn
from sklearn.preprocessing import MinMaxScaler
from __future__ import division #so 1/2 = 0.5, not 1/2=0
import pandas as pd
de... |
<reponame>itortoise/mycaffe<gh_stars>0
import os
import scipy
def makeImageSample(imagepath):
pathDir = os.listdir(imagepath)
with open('train.txt','w') as f:
imageList = [file for file in pathDir if file.endswith('.jpg')]
for name in imageList:
label = int(name[2:5])
la... |
<filename>satdetect/featextract/WindowExtractor.py
import os
import glob
import numpy as np
from scipy.spatial.distance import cdist
import skimage
import hashlib
from satdetect.ioutil import loadImage, getFilepathParts, mkpath
def transform(DataInfo, **kwargs):
''' Apply window extraction to all images in provided... |
<filename>ChE765Project.py
import numpy as np
import scipy as sp
import pandas as pd
import seaborn as sns
import time
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
import umap
import sklearn.discrimin... |
<reponame>qgoestch/sinecity_testcases
# -*- coding: utf-8 -*-
##
# \file errors_calc2_modes.py
# \title Calculation of the errors and norms for the case2:
# modes in 2D square box.
# \author <NAME>
# \version 0.1
# \license BSD 3-Clause License
# \inst UMRAE (Ifsttar Nantes), LAUM (Le Mans Univ... |
import torch
from model import *
from metric import Metric
from torchvision.datasets import MNIST
from torch.utils.data import DataLoader
from configparser import ConfigParser
cfg = ConfigParser()
cfg.read('config.ini')
cfg_model = dict((k, eval(v)) for k, v in cfg['Model'].items())
cfg_loss = dict((k, eval(v)) for k,... |
import os, sys, random, time, copy
from skimage import io, transform
import numpy as np
import scipy.io as sio
from scipy import misc
import matplotlib.pyplot as plt
import PIL.Image
import skimage.transform
import blosc, struct
import torch
from torch.utils.data import Dataset, DataLoader
import torch.nn as nn
impo... |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
"""Defines helpful utilities for summarizing and uploading data."""
import logging
import numpy as np
import scipy as sp
from scipy import... |
<gh_stars>10-100
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from scipy.stats import gaussian_kde
from scipy.interpolate import UnivariateSpline
from scipy import interpolate
from sklearn.neighbors.kde import KernelDensity
from scipy.stats import norm
from sklearn.neighbors import KernelDensity... |
<gh_stars>0
#!/usr/bin/env python
u"""
racmo_interp_firn_height.py
Written by <NAME> (08/2020)
Interpolates and extrapolates firn heights to times and coordinates
INPUTS:
base_dir: working data directory
EPSG: projection of input spatial coordinates
MODEL: model outputs to interpolate
FGRN055: 5.5k... |
<filename>relancer-exp/original_notebooks/wenruliu_adult-income-dataset/income-prediction.py
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
print()
# In[ ]:
df= pd.read_csv("../../../input/wenruliu_adult-income-dataset/a... |
<reponame>ratnania/mlhiphy<gh_stars>1-10
# coding: utf-8
import numpy as np
from sympy.core.containers import Tuple
from sympy import symbols
from sympy import Symbol
from sympy import Lambda
from sympy.core import Basic
from sympy import Function
from sympy import preorder_traversal
from sympy import diff
from mlh... |
<reponame>educauchy/ITMO_FS<gh_stars>10-100
import unittest
from math import sqrt
import numpy as np
import pandas as pd
from scipy import stats
from sklearn.datasets import load_iris
from sklearn.datasets import make_classification, make_regression
from sklearn.feature_selection import chi2, f_classif, mutual_info_cl... |
<filename>src/backend/gdetect/core/database_checking.py
from typing import List
from scipy.spatial import distance
from gdetect.database import query_all_vector_embeddings, Task
from gdetect.utils import config
from gdetect.utils.logger import logger
from gdetect.core.base import BaseMethod
class DatabaseChecking(B... |
<reponame>pavankkota/SPoRe
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 9 12:54:56 2021
@author: pkk24
"""
import numpy as np
import sys
import matplotlib.pyplot as plt
import pickle
import os
from matplotlib import cm
from scipy.stats import poisson
from itertools import product
from copy import deepcopy
from s... |
<filename>ssd_training.py
"""SSD training utils."""
import tensorflow as tf
from keras.applications.imagenet_utils import preprocess_input
from random import shuffle
from scipy.misc import imresize
from scipy.misc import imread
import numpy as np
class MultiboxLoss(object):
"""Multibox loss with some helper funct... |
"""Define VCTK datasets."""
import glob
import os
import numpy as np
import pickle
from scipy.io import wavfile
from .dataset import SEDataset
from .datatype import Audio, NoisySpeech
class SEVCTKNoRev(SEDataset):
"""Two-channel VCTK speech without reverberation."""
def __init__(self, root, subset="CT", m... |
<gh_stars>10-100
'''physics-based ODS methods and utilities
-------
'''
from .omas_utils import *
from .omas_core import ODS
__all__ = []
__ods__ = []
def add_to__ODS__(f):
"""
anything wrapped here will be available as a ODS method with name 'physics_'+f.__name__
"""
__ods__.append(f.__name__)
... |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import postgkyl as pg
from scipy import fftpack
from glob import glob
from mpl_toolkits.axes_grid1 import make_axes_locatable
def getSpectraAndDisp(k0, nK, nW, root, comp=0):
files = glob(root)
numFiles = len(files)
d = pg.GData(fil... |
import os
import unittest
import numpy as np
from scipy import signal
from maml.utils import get_sp_method, fft_magnitude, cwt, spectrogram, wvd
CWD = os.path.join(os.path.dirname(__file__))
try:
import tftb
except ImportError:
tftb = None
class TestSP(unittest.TestCase):
x = np.load(os.path.join(CWD... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2016 The siganalysis developers. All rights reserved.
# Project site: https://github.com/questrail/siganalysis
# Use of this source code is governed by a MIT-style license that
# can be found in the LICENSE.txt file for the project.
"""Provide Python routines for signal anal... |
<reponame>cjayross/riccipy
"""
Name: Friedman-Robertson-Walker Perfect Fluid
References:
- Robertson, Astrophys. J., v82, p284, (1935)
- Robertson, Astrophys. J., v83, p137, (1936)
- Stephani (10.9) p118
Coordinates: Spherical
Notes: Closed
"""
from sympy import Function, diag, sin, symbols
coords = symbol... |
<filename>S18_2.py<gh_stars>0
#----------------------------------
# This code for those tweeters of rumor whose tweets only retweeted once! gives the following information:
# ratio of following/follower (mean, stdv)
# ratio of Mutal/followings (mean, stdv)
# time delay of spreading with source node (mean, stdv)
# ... |
<filename>examples/keras/grad-cam-keras.py
# -*- coding: utf-8 -*-
# Visualize which parts of an image 'cause' the class label
# Uses the GradCAM algorithm
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>,
# “Grad-CAM: Why did you say that? Visual Explanations from Deep Networks via Gradient-based Localization,”
#... |
<reponame>lblonk/chaospy
"""Frechet or Extreme value distribution type 2."""
import numpy
from scipy import special
from ..baseclass import Dist
from ..operators.addition import Add
class frechet(Dist):
"""Frechet or Extreme value distribution type 2."""
def __init__(self, c=1):
Dist.__init__(self, ... |
<reponame>DanPorter/i16sim
"""Collection of auxiliary mathematical methods."""
from math import acos, cos, isclose, sin
from typing import Any, Sequence, Tuple
import numpy as np
from numpy.linalg import norm
from scipy.spatial.transform.rotation import Rotation
I: np.ndarray = np.identity(3)
SMALL: float = 1e-7
d... |
<reponame>aymericvie/evology<gh_stars>0
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.ndimage.filters import gaussian_filter
import ternary
import numpy as np
import pandas as pd
from ternary.helpers import simplex_iterator
data = pd.read_csv("/Users/aymericvie/Documents/GitHub/evology/evology/resear... |
import unittest
from hypothesis import given
import numpy as np
import scipy
from meta_analysis import Maps
from globals_test import random_permitted_case_3D, random_permitted_case_1D, empty_maps, random_maps, gray_mask, template, atlas, affine, fmri_img
class ToArrayTestCase(unittest.TestCase):
def setUp(self):
... |
# -*- coding: utf-8 -*-
import logging
import os
import shutil
from pathlib import Path
from src.utils.mask_cleanup import MIN_OBJ_EDGE_ALL, MIN_OBJ_EDGE_ANY, MIN_OBJ_SIZE, MIN_TOTAL, mask_cleanup
from zipfile import ZipFile
import numpy as np
import click
from dotenv import find_dotenv, load_dotenv
from PIL import Im... |
<reponame>achow113/LeetCode<gh_stars>100-1000
"""
In a deck of cards, each card has an integer written on it.
Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, where:
Each group has exactly X cards.
All the cards in each group have the s... |
<reponame>benman1/ep-stan<gh_stars>10-100
""" A simple test for Scipy compatibility.
The program does not work correctly in some scipy builds because of an issue in
the in-place operation of dpotri Lapack-routine with C- or F-order matrices. In
some builds, the in-place operation works for F-order matrices but not f... |
#%%[markdown]
# # Drag measurement Comp.air
# ## Spectral dencity plots
# - This file is for plotting the drag sensor measurement from the
# compressed air setup.
#
#| measurements id | channel name | group name |
#|:---------------------:| ------------------ | ---------- |
#| same as all CA meas. | 'Win... |
# From pairing session Juan <> Marlene 2021-05-06
import napari
import skan
from matplotlib import cm
from skimage import io
from skimage.exposure import exposure
from skimage.filters import gaussian
from skimage.filters import threshold_mean
from skimage.filters import frangi
from skimage.morphology import remove_sma... |
import os
import numpy as np
import unittest
from scipy.io import loadmat
from Atlas import Results, Fblade
def relative_err(x, y):
return (np.abs(x-y)/np.linalg.norm(x)).max()
class Test_Results(unittest.TestCase):
"""
Tests the Results component
"""
def test_Results(self):
""" Test ... |
from Anton import searchfiles
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy.stats import linregress
from itertools import cycle
import seaborn as sns; sns.set()
def get_files():
a = (r'Z:\2_Projekt__Permeabilitätsbeeinflussung\AP 4 - 90%\02_Löslichkeitsuntersuchungen\HS Microscop... |
"""
Programa de Segmentacion
Contiene Binarizacion, promedios de polarizacion, corte mediante contornos
"""
import cv2 #Opencv 3.000 a 32bits
import numpy as np
from skimage.filters import threshold_otsu
from scipy.ndimage import gaussian_filter
from skimage import measure
from skimage import filters
def avgPol(matrix... |
<gh_stars>0
import os
import glob
import sys
import tensorflow as tf
from scipy import misc
import numpy as np
from tensorflow.contrib.keras.python import keras
from tensorflow.contrib.keras.python.keras import layers, models
from tensorflow import image
from utils import scoring_utils
from utils.separable_conv2d i... |
<reponame>Rbeaty88/ginga
#
# wcs.py -- module wrapper for WCS calculations.
#
# <NAME> (<EMAIL>)
# <NAME>
# <NAME>
#
# Copyright (c) <NAME>. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
"""
We are lucky to have several possible choic... |
<reponame>phloem7/cdemgl<gh_stars>1-10
import os
from pathlib import Path
import numpy as np
import rasterio
import typer
from scipy.spatial import Delaunay
from .utils import project_tif
outputs_dir = os.getenv("outputs_dir", "/tmp")
class DEM:
def __init__(self, file_path, poi, zfactor, out_size):
ty... |
"""
Provides an API to define epidemiological
models in terms of sympy symbolic expressions.
"""
import warnings
import numpy as np
import scipy.sparse as sprs
import sympy
from epipack.numeric_epi_models import EpiModel, custom_choice
from IPython.display import Math, display
from sympy.printing.theanocode import ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 8 10:07:02 2021
Instead of using the uncertainity for each region, we will use the total uncertainty
@author: ccamargo
"""
import os
import xarray as xr
import numpy as np
import warnings
import sys
sys.path.append("/Users/ccamargo/Documents/py_s... |
<gh_stars>1-10
# MIT License
#
# Copyright (c) 2018 <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 limitation the rights
# to use, copy, mod... |
import sys
sys.path.append('../')
sys.path.append('../apex')
import torch
import numpy as np
from nltk.tokenize import word_tokenize
from sklearn.metrics import precision_recall_fscore_support
from tqdm import tqdm
import argparse
from torch.utils.data import DataLoader
import math
from sentence_transformers import m... |
<filename>DaVE/mLingua/examples_ncsim/spf/sim/plot_abserr.py
#! /usr/bin/env python
"""
Generate eyediagram and save it to eye.png
"""
import numpy as np
from scipy.interpolate import interp1d
import matplotlib.pylab as plt
import matplotlib
from scipy.signal import lsim, zpk2tf
font = { 'size' : 19}
matplotlib.... |
<reponame>AbsoluteIntegrator/Absolute_Integrator<gh_stars>1-10
import numpy as np
from numpy import mgrid
from scipy.ndimage import rotate
def gaussian(height, center_x, center_y, width_x, width_y):
"""Returns a gaussian function with the given parameters"""
width_x = float(width_x)
width_y = float(width_y... |
#!/usr/bin/python
import glob
import argparse
import numpy as np
from dicom_tools.pyqtgraph.Qt import QtCore, QtGui
import dicom_tools.pyqtgraph as pg
import dicom
from dicom_tools.FileReader import FileReader
#from dicom_tools.read_files import read_files
from scipy import ndimage
import os
from dicom_tools.roiFileHan... |
from biogeme import *
from headers import *
from loglikelihood import *
from statistics import *
# rowid H1_HHID H1_Pcode Pax_ID day_pattern_code In_day_pattern_choice_set modified_code begin_in_tour_table End_in_tour_table simple_day_pattern universitystudent person_type_id age_id income_id incmid missingincome fixed... |
import numpy
import scipy.integrate
import scipy_data_fitting
import data
import models
class Fig4(scipy_data_fitting.Fit):
"""
Fit for Figure 4 in PhysRevLett.105.167202.
Must supply `subfig` in the form `(subfig_letter, contact_spacing_(L))`,
e.g. `('a', 2.1)`.
Should not be used directly, but... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 10 16:42:22 2018
@author: Ifrana
"""
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import confusion_matrix
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.... |
import matplotlib.pyplot as plt
import numpy as np
import os
from sandbox.ex2.utils import log_utils
MARKERS = ['o', 's', '8', 'D', '4']
def plot_2dtrajectory(states, score=None, marker='o', cmap='afmhot'):
N, d = states.shape
assert d==2
if score is not None:
if isinstance(score, np.ndarray):
... |
<reponame>sujideevi/CarND-Capstone
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import PoseStamped
from geometry_msgs.msg import TwistStamped
from styx_msgs.msg import Lane, Waypoint
from std_msgs.msg import Int32
from scipy.spatial import KDTree
import numpy as np
import math
'''
This node will publish ... |
# Copyright 2021 The Scenic 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 applicable law or agreed to in w... |
import math
import sympy
class OperationCounts:
def __init__(self, addsubs=0, mults=0, divs=0, cmps=0, reads=0, writes=0):
self.addsubs = addsubs
self.mults = mults
self.divs = divs
self.cmps = cmps
self.reads = reads
self.writes = writes
def __str__(self)... |
import numpy as np
import scipy.sparse as sp
import warnings
import properties
from .. import Props
from .. import Maps
from .. import ObjectiveFunction
from .. import Utils
from .regularization_mesh import RegularizationMesh
###############################################################################
# ... |
<reponame>edgargmartinez/OpenPNM
import openpnm as op
import scipy as sp
import pytest
class GenericTransportTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[9, 9, 9])
self.geo = op.geometry.StickAndBall(network=self.net,
pores=self.net.P... |
<filename>svsim/summit_gpu/svsim_qasm_cplus.py<gh_stars>0
# ---------------------------------------------------------------------------
# SV-Sim: Density-Matrix Quantum Circuit Simulation Environement
# ---------------------------------------------------------------------------
# <NAME>, Senior Computer Scientist
# Pac... |
<reponame>aco8ogren/Tentin-Quarantino
# %%
from IPython import get_ipython
import pandas as pd
import numpy as np
import scipy.integrate
import matplotlib.pyplot as plt
import bokeh.io
import bokeh.application
import bokeh.application.handlers
import bokeh.models
import bokeh.plotting as bkp
from scipy.optimize impor... |
<gh_stars>1-10
from openmdao.api import Component, Group, Problem, IndepVarComp
from akima import Akima, akima_interp
from plantenergy.utilities import hermite_spline
import plantenergy.config as config
import position_constraints
import numpy as np
from scipy import interp
from scipy.io import loadmat
from scipy.spat... |
import sympy as sp
import numpy as np
from kaa.bundle import Bundle
from kaa.model import Model
class Phosphorelay(Model):
def __init__(self):
dim_sys = 7
x1, x2, x3, x4, x5, x6, x7 = sp.Symbol("x1"), sp.Symbol("x2"), sp.Symbol("x3"), sp.Symbol("x4"), sp.Symbol("x5"), sp.Symbol("x6"), sp.Symbol... |
<reponame>olsonjonny/cusp_cirq_demo
import numpy as np
import time
from multiprocessing import Pool
from scipy.optimize import minimize
###STAGE 1###
import sys
from config import CODE_DIRECTORY
sys.path.append(CODE_DIRECTORY)
# User settings for CUSP
import settings
from set_settings import *
from cusp_demo_utils im... |
import argparse
from utils import kitti_util
import os
import os.path as osp
import numpy as np
import cv2
from tqdm.auto import tqdm
import pickle
from scipy.spatial import Delaunay
import scipy
def in_hull(p, hull):
"""
:param p: (N, K) test points
:param hull: (M, K) M corners of a box
:return (N) ... |
import os
import numpy as np
import pandas as pd
import seaborn as sns
import subprocess
import re
import pysam
from itertools import product
import matplotlib.pyplot as plt
from matplotlib import rcParams
from matplotlib.ticker import MultipleLocator
import math
import scipy.stats as stats
from scip... |
"""Fairly basic set of tools for real-time data augmentation on image data.
Can easily be extended to include new transformations,
new preprocessing methods, etc...
"""
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import re
from scipy import linalg
import scipy.ndimag... |
<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import fsolve
import IPython
def main():
a = 0.2
w = 0.5
l1 = 0.5
l2 = 0.5
# origin of base frame
pb = np.array([0, 0])
th = 0
# end points of front of base
pbl = pb + np.array([a, 0.5 * w])
pb... |
<filename>examples/chaos_pendulum/chaos_pendulum.py<gh_stars>1-10
#!/usr/bin/env python
# This script generates the equations of motion for a double pendulum where the
# bob rotates about the pendulum rod. It can be shown to be chaotic when
# simulated.
# import sympy and the mechanics module
import sympy as sym
impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.