text string |
|---|
<reponame>kata-ai/indosum<gh_stars>10-100
import os
import tensorflow as tf
import numpy as np
from sklearn.linear_model import LogisticRegression as lr
from scipy.spatial.distance import cosine
import json
flags = tf.flags
flags.DEFINE_string ('data_dir', 'data/demo', 'data directory, to compute vocab')
flags.... |
#import SatadishaModule as phase1
import SatadishaModule_final_trie as phase1
import phase2_Trie as phase2
import datetime
from threading import Thread
import random
import math
from queue import Queue
import pandas as pd
import warnings
import numpy as np
import time
import trie as trie
import pickle
import matplot... |
from __future__ import division # floating point division by default
import os
from fractions import Fraction
from datetime import datetime
from itertools import repeat
from warnings import warn
try:
from cPickle import dumps, loads
except ImportError:
from Pickle import dumps, loads
import numpy
from numpy i... |
<filename>lung_segmentation/crop.py
"""
Class to crop CT images to have only one subject per image.
It should work for pre-clinical and clinical images with different
resolutions.
"""
import os
import logging
import pickle
import numpy as np
import nibabel as nib
import nrrd
import cv2
from lung_segmentation.utils impo... |
"""
The MIT License
Copyright (c) 2014 <NAME>
For use in MUS491 Senior Project, in partial fulfillment of the Yale College Music Major (INT).
Code may be reused and distributed without permission.
"""
import sys, os, random, logging, copy, math
from operator import mul
from fractions import Fraction
import numpy as np... |
import statistics
import helpers
from contribution import Contribution
class Bitcoin:
def __init__(self, file_path):
self.data = helpers.read_yaml(file_path)
self.miners = Miners(self.data['miners'])
self.pools = Pools(self.data['pools'])
self.nodes = Nodes(self.data['nodes'])
... |
<reponame>berkott/SciFair<filename>src/evaluateData/breath.py
import heartpy as hp
import matplotlib.pyplot as plt
from scipy.signal import butter, lfilter
from scipy.signal import find_peaks, periodogram
import numpy as np
import glob
class breath:
def __init__(self):
basePath = "/home/berk/Code/SciFair/s... |
<gh_stars>1-10
import re
import shutil
import numpy as np
import pandas as pd
from pathlib import Path
from typing import List, Union, Iterable
import socket
import scipy.stats
from filelock import FileLock
from ramjet.data_interface.moa_data_interface import MoaDataInterface
from ramjet.photometric_database.light_c... |
import matplotlib
matplotlib.use('Agg')
import os
import torch
import numpy as np
import scipy.misc as m
import glob
import cv2
import time
import matplotlib.pyplot as plt
import copy
from random import shuffle
import random
from torch.utils import data
import yaml
from tqdm import tqdm
import pickle
class synthiaL... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import norm
### Functions ###
def best_fit(x, y):
"""
Function to manually create a line of best fit or linear regression line for a given dataset.
"""
xmean = sum(x)/len(x)
ymean ... |
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name,too-many-instance-attributes, too-many-arguments
"""
Copyright 2019 <NAME>
Copyright 2015 <NAME>.
FilterPy library.
http://github.com/rlabbe/filterpy
Documentation at:
https://filterpy.readthedocs.org
Supporting book at:
https://github.com/rlabbe/Kalman-and-Baye... |
<filename>qulab_toolbox/Fit/_Fit.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from scipy import interpolate
_CONFIG={
'scatter':{
'marker':'p',
'color':'g',
'edgecolors':'',
's':15,
},
'plot':{
}
}
def config(scatter={},plo... |
<filename>Display.py
import numpy as np
from pathlib import Path
import matplotlib.pyplot as plt
import pandas as pd
from pandas.plotting import scatter_matrix
import matplotlib.colors
from scipy.stats import gaussian_kde
from src.utils import DataIO
def factor_scatter_matrix(df, factor, palette=None):
'''Create... |
<reponame>Wentzell/libdlr
""" Solving the SYK model using the DLR expansion
The non-linear problem is solved using both forward iteration
and a hybrid-Newton method.
Author: <NAME> (2021) """
import numpy as np
from scipy.optimize import root
from pydlr import dlr
def sigma_x_syk(g_x, J, d, beta):
tau_l = d... |
<reponame>zehuilu/Learning-from-Sparse-Demonstrations
#!/usr/bin/env python3
import os
import sys
import time
sys.path.append(os.getcwd()+'/CPDP')
sys.path.append(os.getcwd()+'/JinEnv')
sys.path.append(os.getcwd()+'/lib')
import copy
import math
import json
import CPDP
import JinEnv
from casadi import *
import scipy.io... |
<filename>qiskit_dynamics/solvers/solver_classes.py<gh_stars>0
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree ... |
#pip install websocket-client
import websocket
from random import random, shuffle, randint
from ast import literal_eval as literal
from multiprocessing import Process
from threading import Thread
from datetime import datetime
from statistics import mode
import logging
import time
import json
# Solid State Drive (SS... |
<filename>splitwavepy/core/window.py<gh_stars>10-100
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
class Window:
"""
Instantiate a Window defined r... |
"""
Backports. Mostly from scikit-learn
"""
import numpy as np
from scipy import linalg
###############################################################################
# For scikit-learn < 0.14
def _pinvh(a, cond=None, rcond=None, lower=True):
"""Compute the (Moore-Penrose) pseudo-inverse of a hermetian matrix.
... |
import numpy as np
from sympy import Matrix
class HillCipher:
def __init__(self, message, matrix_list):
self.alphabet = {chr(i): i - 97 for i in range(97, 123)}
self.message = message
self.matrix = matrix_list
self.message_numbers = np.array([self.alphabet[x] for x in message]).res... |
# This file should contain a copy of each function defined in the tutorial file
# which can be imported and used in a students own work.
import numpy
from scipy import stats
import pandas
import itertools
from tabulate import tabulate
from statsmodels.stats.multicomp import pairwise_tukeyhsd
def ANOVA(dataset, indep... |
import argparse
import collections
import sys
import math
import cPickle as pickle
import scipy
import scipy.stats
import sexpdata
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.backends import backend_pdf
import os
import numpy as np
import inlining_tree
i... |
<reponame>w91379137/IDSPythonScript
#-*- coding: utf-8 -*-
#-*- coding: cp950 -*-
import numpy as np
import scipy as sp
|
<reponame>ilovecocolade/MultipleObjectTrackerMastersProject
import numpy as np
from PIL import Image
from mrcnn import visualize as vz
import cv2
import statistics as stats
# FILE CONTAINING FUNCTIONS USED TO TRACK VIA MASK ASSOCIATION
# AUTHOR - <NAME>
# generate initial object representations and save to dictionar... |
<reponame>TobiasRitter/PyNN<filename>errors.py
from layers import Layer
from scipy.special import softmax
import numpy as np
class CategoricalCrossEntropy(Layer):
def forward(self, logits, labels):
probs = softmax(logits, axis=1)
self.cache = (probs, labels)
loss = -np.sum(np.sum(labels*np... |
from __future__ import print_function
import json
import sys
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
from lib.dtw import dtw
matplotlib.rc('xtick', labelsize=15)
matplotlib.rc('ytick', labelsize=15)
matplotlib.rc('axes', titlesi... |
<gh_stars>1-10
from typing import Mapping, Any, Sequence
import numpy as np
import heapq
import math
from tqdm import tqdm
import scipy.optimize
import pandas as pd
def stack_x(x_counts: Sequence[np.ndarray]):
df = pd.DataFrame(x_counts)
return df.fillna(0).values
def adjust_xs(xs: np.ndarray, sizes: np.nd... |
# coding: utf-8
from logging import getLogger
from commonml import es
from commonml.utils import get_nested_value
from scipy.sparse.construct import hstack
from scipy.sparse import csr_matrix
from sklearn.base import BaseEstimator
from sklearn.feature_extraction.text import VectorizerMixin, TfidfVectorizer, \
Cou... |
<filename>python_backend/triton_client/tao_triton/python/postprocessing/bodyposenet_processor.py
import os
import math
import numpy as np
import cv2 as cv
from scipy.ndimage.filters import gaussian_filter
from tao_triton.python.postprocessing.postprocessor import Postprocessor
class BodyPoseNetPostprocessor(Postpr... |
<reponame>le-ander/epiScanpy<filename>episcanpy/preprocessing/_load_atac.py<gh_stars>10-100
import numpy as np
import anndata as ad
import pandas as pd
import warnings
from warnings import warn
from scipy.sparse import csc_matrix
def load_peak_matrix(matrix_file, path=''):
"""
Deprecated - Use load_atac... |
#!/usr/bin/env python
# Author: <NAME> <<EMAIL>>
# PTC5892 Processamento de Imagens Medicas
# POLI - University of Sao Paulo
# Implementation of the
# References:
# [1] <NAME>, Digital Image Processing. New York: Wiley, 1977
# [2] <NAME> and <NAME>, Speckle Reducing Anisotropic Diffusion.
# IEEE Transactions on Ima... |
# -*- coding: utf-8 -*-
"""
Numpy and Scipy script files that are common to both Keras+TF and PyTorch
"""
import numpy as np
import re
from scipy.spatial.distance import cdist
import torch
from torch.optim import Optimizer
__all__ = ['classes', 'eps', 'parse_name', 'rotation_matrix', 'get_gamma', 'get_accuracy']
# ... |
import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib as mpl
mpl.rcParams['animation.ffmpeg_path'] = r'C:\\ffmpeg\\bin\\ffmpeg.exe'
class BatchData:
def __init__(self, data_location):
"""
A class object which loads i... |
from scipy.io import loadmat
import os
import shutil
import numpy as np
def create_dataset():
car_meta = loadmat("./data/devkit/cars_meta.mat")
idx2car = {}
for idx, j in enumerate(range(len(car_meta["class_names"][0])), 1):
idx2car[idx] = car_meta["class_names"][0][j][0]
car2idx = {v: k for... |
from sympy import Eq, Function, var
from tilings import GriddedPerm, Tiling
from tilings.assumptions import TrackingAssumption
from tilings.strategies import SplittingStrategy
t = Tiling(
obstructions=[
GriddedPerm.single_cell((0, 1, 2), (0, 0)),
GriddedPerm.single_cell((0, 1), (1, 0)),
Gr... |
<filename>spectorm/spectrum/spectrum_meta.py
from spectorm.exceptions import InvalidSpectrumError, IntegrationError
import json
import numpy as np
from scipy.integrate import simps as sp
from scipy.integrate import trapz as tp
class MetaSpectrum(type):
def __call__(cls, *args, **kwargs):
temp = super().... |
import pickle
import gensim
from scipy import spatial
import operator
import numpy as np
path = "./Kseeds/"
def save_obj(obj, name ):
with open(path + name + '.pkl', 'wb') as f:
pickle.dump(obj, f, protocol=2)
def load_obj(name):
with open( path + name + '.pkl', 'rb') as f:
return pickle.loa... |
from statistics import mean
people = list()
option = 'Y'
while option == 'Y':
people.append({
'name': input(f'Enter the name of person: '),
'gender': input(f'Enter the gender (Male or Female) of person: '),
'age': int(input(f'Enter the age of person: '))
})
option = input('Keep in... |
<gh_stars>1-10
# ----------------------------------------------------------------------------
# Title: Scientific Visualisation - Python & Matplotlib
# Author: <NAME>
# License: BSD
# ----------------------------------------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
from ... |
"""
A simple example of using BERT encoding of documents to apply some clustering algorithm on top of it
"""
from collections import defaultdict
from typing import List, Tuple
from scipy import spatial
import torch
from sklearn.cluster import KMeans
from torch.utils.data import DataLoader
from tqdm import tqdm
from tr... |
from keras import *
from keras import backend as K
K.set_image_data_format('channels_first')
import cv2
import os
import sys
sys.path.insert(0, './drive/My Drive/DL/Face Recognition')
import numpy as np
from numpy import genfromtxt
import pandas as pd
import tensorflow as tf
from fr_utils import *
from matplotlib.pyplo... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 19 11:14:14 2017
@author: lbeddric
"""
###############################################################################
################## #######################################
################## RESEDA data analysis #########... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
A minimalistic Echo State Networks demo with Mackey-Glass (delay 17) data
in "plain" scientific Python.
from https://mantas.info/code/simple_esn/
(c) 2012-2020 <NAME>
Distributed under MIT license https://opensource.org/licenses/MIT
"""
import numpy as np
import matplot... |
import re
import numpy as np
from scipy.ndimage import gaussian_filter
from matplotlib.colors import ListedColormap
__all__ = ['natural_sort',
'bboxes_overlap',
'generate_image',
'white_noise',
'nonwhite_noise',
'is_notebook',
'get_Daans_sp... |
<reponame>Konstantin8105/py4go<gh_stars>1-10
############################################################################
# This Python file is part of PyFEM, the code that accompanies the book: #
# #
# 'Non-Linear Finite Element Analysis ... |
import glob
import os
import re
import datetime as dt
import cftime
from functools import partial
import scipy.ndimage
import numpy as np
import pandas as pd
try:
import cf_units
except ImportError:
# ReadTheDocs unable to pip install cf-units
pass
def timeout_cache(interval):
def decorator(f):
... |
<reponame>vishalbelsare/pylmnn
# coding: utf-8
"""
Large Margin Nearest Neighbor Classification
"""
# Author: <NAME> <<EMAIL>>
# License: BSD 3 clause
from __future__ import print_function
from warnings import warn
import sys
import time
import numpy as np
from scipy.optimize import minimize
from scipy.sparse import... |
import json
from scipy.io import wavfile
from scipy import signal
import torch
from UniversalVocoding.preprocess import get_mel
from UniversalVocoding.model import Vocoder
import soundfile
import torch
def wav_to_mel(filename, config_filename='UniversalVocoding/config.json'):
#sample_rate, samples = wavfile.rea... |
import torch
import random
import datetime
import torch.nn as nn
from sklearn.metrics import precision_recall_curve, auc, roc_auc_score, mean_absolute_error, r2_score
from scipy.stats import pearsonr
import torch.nn.functional as F
from rdkit import Chem
from prody import *
import pickle
import numpy as np
# def set_r... |
#!/usr/bin/env python
# coding: utf-8
# In[601]:
# [Author]: <NAME>
# [Date]: 2021-12-10
# [Description]
# this file has the following functionalities
# (1) train model 1 in the paper and evaluate it against test data with golden labels.
# (2) calculate random guess accuracy
# (3) evaluate the decoded texts from m... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Calculates cubic spline interpolations for sigma(r) and probability(r)
probability = 2*pi*r*sigma
Created on Mon Jan 27 13:00:52 2014
@author: ibackus
"""
# ICgen packages
import isaac
# External packages
import pynbody
SimArray = pynbody.array.SimArray
import numpy as np
... |
# Function for filtering either 1D or 2D data.
import numpy as np
from scipy.interpolate import interp1d
from scipy import signal
def estimateBackground(_tod, rms, close=None, sampleRate=50, cutoff=1.):
"""
Takes the TOD and set of indices describing the location of the source.
Fits polynomials beneath the... |
<filename>src/mdlmodel.py
#!/usr/bin/python
# -*- coding=utf-8 -*-
# # MDLModel
# Author: wenchieh
#
# Project: catchcore
# mdlmodel.py:
# The minimum description length (MDL) metric for the
# resultant hierarchical dense subtensor
# Version: 1.0
# Goal: Subroutine script... |
<reponame>Bhare8972/LOFAR-LIM<gh_stars>1-10
#!/usr/bin/env python3
#python
import time
from os import mkdir, listdir
from os.path import isdir, isfile
from itertools import chain
from pickle import load
from random import choice
#external
import numpy as np
from scipy.optimize import least_squares, minimize, approx_f... |
<gh_stars>0
import numpy as onp
from scipy.sparse import coo_matrix
from optimism.JaxConfig import *
def assemble_sparse_stiffness_matrix(kValues, conns, dofManager):
nElements, nNodesPerElement = conns.shape
nFields = kValues.shape[2]
nDofPerElement = nNodesPerElement*nFields
kValues = kVa... |
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import os
def find(name, path):
for root, dirs, files in os.walk(path):
if name in files:
return os.path.join(root, name);
return None;
def parse_results_file(filename, speed, trial, data):
filetype = "OptiResul... |
# Copyright (c) 2013, <NAME>.
# Licensed under the BSD 3-clause license (see LICENSE.txt)
#
# This implementation of converting GPs to state space models is based on the article:
#
# @article{Sarkka+Solin+Hartikainen:2013,
# author = {<NAME> and <NAME> and <NAME>},
# year = {2013},
# title = {Spatiotemp... |
<filename>resample/result.py
"""This module implements the results object that contains information
about the results of the bootstrap
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import norm
from .utility import group_res, output_res, bca_endpoints, \
... |
"""Utility functions supporting salient experiments
Attributes:
IN_DIR (str): input directory for salient related files.
INDIR (str): input directory for salient related files.
window_size (int): size of the sliding window over the data. If set to 10,
the NN's input feature vector consists of a... |
import numpy as np
import imageio
import matplotlib.pyplot as plt
import scipy.misc
def add_white_noise(arr, mu, sigma, factor, size):
""" sigma = std
var = sigma^2
"""
noisy_arr = arr + factor * np.random.normal(loc = mu, scale = sigma, size = size)
return noisy_arr
def imsave(i... |
<reponame>nd300/Real-Time-Face-Reconstruction-System
import scipy.io as spio
import numpy as np
import scipy as sp
from mayavi import mlab
import lsqlin
import time
import navpy as nv
class MMFitting:
def __init__(self, mat=None, shapeChoice = 1):
print("Initializing variables...")
if mat == None:
mat = spio.l... |
from arspy import ars
import numpy as np
from numpy import log, exp
from scipy.special import gamma as Gamma
from scipy.stats import gennorm
#So in our notations form_parameter=beta:=gamma. Also we fix scale_parameter = Gamma(beta).
#Generalized normal distribution is truncated into the interval [a,b].
#phi = lambd... |
<filename>MyML/EAC/eac_new.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on 10-04-2015
@author: <NAME>
Evidence accumulation clustering. This module aims to include all
features of the Matlab toolbox plus addressing NxK co-association
matrices.
TODO:
- clustering of non-square co-association matrix
- link eve... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 16:07:48 2019
@author: TempestGuerra
"""
import numpy as np
from numpy import multiply as mul
from scipy import linalg as las
import math as mt
from scipy.special import roots_hermite
from scipy.special import roots_chebyt
def hefunclb(NX):
... |
<filename>PressureNet/compute_mod1_spatialmaps.py
#!/usr/bin/env python
import sys
import os
import time
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pylab import *
#PyTorch libraries
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
f... |
<gh_stars>0
import logging
import warnings
from datetime import datetime
from traceback import format_exc
from typing import List, Tuple
import numpy as np
import pandas as pd
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.cluster import spectral_clustering
from scipy.ndimage import zoom, median_fi... |
# lower_bound = (40,70,70)
# upper_bound = (180,255,255)
import matplotlib.pyplot as plt
import numpy as np
import cv2
from matplotlib.colors import hsv_to_rgb, rgb_to_hsv
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib import colors
import argparse
from mpl_toolkits.mplot3d import Ax... |
#!/Users/mzoufras/anaconda/bin/python
# Developed by: <NAME>
import numpy as np
import scipy
import ast
import h5py
def Normal_weights(_X,_Y):
return np.dot( scipy.linalg.pinv(_X) , _Y)
def NRMSE(_Ybar,_Y):
return np.sqrt(np.divide(
np.mean(np.square(_Y-_Ybar)),
... |
# -*- coding: utf-8 -*-
"""
Optimization Methods
====================
"""
from __future__ import division
import itertools
from collections import defaultdict
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from scipy import optimize
from . import tools
from .test... |
# This file is part of the P3IV Simulator (https://github.com/fzi-forschungszentrum-informatik/P3IV),
# copyright by FZI Forschungszentrum Informatik, licensed under the BSD-3 license (see LICENSE file in main directory)
import numpy as np
from scipy.interpolate import interp1d
from p3iv_utils.coordinate_transformatio... |
<gh_stars>1-10
# armor/spectral/powerSpec1.py
# migrated from armor/test/
# 2014-06-17
# powerSpec1.py
# test script for computing power spectrum
# 2014-06-10
"""
== Spectral analysis ==
0. RADAR domain -> normalise to WRF domain
tests to do -
1. average each 4x4 grid in RADAR then compare ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 3 11:33:53 2021
@author: <NAME>
"""
"""
Pseudo-experimental data generation program for glucose (component A)-fructose (component B) system
References
Multi-column chromatographic process development using simulated
moving bed superstructure and simultaneou... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 19 15:03:35 2021
@author: willdavison
"""
"""
What follows has been taken from the DASH software GitHub, with relevant
modifications indicated. For a more complete understanding please visit
(https://github.com/daniel-muthukrishna/astrodash).
"""
... |
<reponame>brooky56/I2R
import numpy as np
# using sympy because it can correctly work with values of trigonometric functions
# from box, when numpy gives us only closer number, so here used the same function like in numpy
import sympy as sp
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
from mpl_toolk... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 24 20:20:03 2022
@author: d4kro
"""
#%%-----------0. loading package-----------------------------------------------
import pandas as pd
import numpy as np
import scipy.sparse
import matplotlib.pyplot as plt
from sklearn import preprocessing
from sklearn.... |
<filename>app.py
from math import radians, cos, sin, asin, sqrt
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
import helper_functions as hf
from helpe... |
import pandas as pd
import sqlite3 as sq
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import warnings, re
import nltk
from IPython.display import Image
import datetime
from collections import Counter
from sklearn.decomposition import NMF
from sklearn.metrics import explained_variance_score
f... |
<reponame>ryuikaneko/exact_diagonalization<filename>testing/191003_ed_ladder_J4_TBC.py<gh_stars>1-10
#!/usr/bin/env python
# coding:utf-8
from __future__ import print_function
import math
import numpy as np
#import scipy.linalg
import scipy.sparse
import scipy.sparse.linalg
import argparse
import time
def parse_args(... |
from scipy.fftpack import dct, idct
import numpy as np
from PIL import Image
from utils import zigzag, reorderWatermark, restoreWatermark, centerCrop
MAX_DIM = 1040
def encoder(input_file, output_file, watermark_file, reorder_flag):
img = Image.open(input_file)
img = img.convert("L")
img_w, img_h = img.si... |
#!/usr/bin/env python3
from __future__ import print_function
import os
import sys
import math
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from .util import custom_qt_items as cqt
from .util import file_io
from .util.mygraphicsview import MyGraphicsView
sys.path.append('..')
import qtutil
import pickle
impor... |
<reponame>bradkav/imripy<filename>tests/crosschecks9402014.py
import numpy as np
from scipy.interpolate import UnivariateSpline, interp1d
from scipy.integrate import quad
import matplotlib.pyplot as plt
import imripy.merger_system as ms
import imripy.halo as halo
import imripy.inspiral as inspiral
import imripy.wavefor... |
"""
KFE
* http://www.koneksys.com/
*
* Copyright 2016 Koneksys
* Released under the MIT license
*
* @author <NAME> (<EMAIL>)
*/
"""
from femaths.polytope import Polygontype, Polygoncoordinate, Polytopetype, Polyhedrontype, Polytope
from itertools import combinations
from scipy.special import comb, factorial
f... |
<filename>examples/utils.py
import numpy as np
import pandas as pd
import probscale
import scipy
import seaborn as sns
import xarray as xr
from matplotlib import pyplot as plt
def get_sample_data(kind):
if kind == 'training':
data = xr.open_zarr('../data/downscale_test_data.zarr.zip', group=kind)
... |
import argparse
import collections
import inspect
import re
import os
import signal
import sys
from datetime import datetime as dt
import pickle
import nltk
import traceback
from copy import deepcopy as deepcopy
import numpy as np
import unidecode as unidecode
from IPython import embed
import torch
from functools imp... |
<gh_stars>1-10
'''
Created on 13.04.2018, updated on 24.02.2020
@author: <NAME>, ETH Zurich
Comment: Helper Functions used in AGS_OPT_2D.py file
'''
"################################################ IMPORTS ###################################################"
import matplotlib.pyplot as plt
from matplotlib.collectio... |
import argparse
import numpy as np
from PIL import Image
import scipy.io
import matplotlib.pyplot as plt
import os
def visualize_semantic_segmentation(label_array, color_map, black_bg=False, save_path=None):
"""
tool for visualizing semantic segmentation for a given label array
:param label_array: [H, W]... |
<gh_stars>0
import math
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate as ip
from scipy.ndimage import gaussian_filter1d
from utils.helpers import crossings_nonzero_all, find_index, peakdet, replace_nan
from params import spring_params
def calc_spring_transition_timing_magnitude(flow_matri... |
"""ASCam is an ASC time-domain simulator to test novel feedback-filter designs.
Produced by <NAME>
Collaborators <NAME> and <NAME> from Caltech provided all the insight and data for the ASC modeling.
version 1.0 (04/26/2020)
ASCam implements pitch dynamics with noise inputs from ISI-L and TOP NL/NP from damping OSEM... |
import numpy as np
import argparse
import os
import random
import pandas as pd
from collections import OrderedDict
import tabulate
parser = argparse.ArgumentParser(description='Produce tables')
parser.add_argument('--data_loc', default='./datasets/cifar/', type=str, help='dataset folder')
parser.add_argument('--save_l... |
<gh_stars>1-10
import numpy as np
import pandas as pd
'''下载数据'''
import os
import tarfile
import urllib.request
DOWNLOAD_ROOT = "https://raw.githubusercontent.com/ageron/handson-ml2/master/"
HOUSING_PATH = os.path.join("datasets", "housing")
HOUSING_URL = DOWNLOAD_ROOT + "datasets/housing/housing.tgz"
def fetch_hous... |
import numpy as np
from scipy import sparse
import pandas as pd
import networkx as nx
from cidre import utils
def detect(
A, threshold, is_excessive, min_group_edge_num=0,
):
"""
CIDRE algorithm
Parameters
-----------
A : scipy sparse matrix
Adjacency matrix
threshold : float
... |
<reponame>HybridRobotics/car-racing
import numpy as np
import sympy as sp
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.animation as anim
from utils import base, racing_env
from system import vehicle_dynamics
from matplotlib import animation
from utils.constants import *
import ... |
<reponame>Sturtuk/EPES
import os, sys
import numpy
import math, matplotlib
matplotlib.use('Agg') # must be used prior to the next two statements
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import scipy, scipy.stats
import pyeq3
from scipy.stats.distributions import t
def DetermineOnOrOffF... |
<reponame>RikGhosh487/Open-Cluster-Research
#!/usr/bin/env python
'''
train_obtain.py: Uses Random Forest Regressor to obtain Photometric Estimates for Spectroscopic Data
SDSS filters (ugriz) are used to obtain missing spectroscopic data through photometric
approximations. The Machin... |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import ld as LD
import dd as DD
import mhfem_acc as mh
from scipy.interpolate import interp1d
''' find order of accurracy of LD and DD Eddington acceleration in the diffusion limit '''
def getError(N, solver):
eps = 1e-9
Sigmat = la... |
"""
Just needed because of my_print.
"""
def asymptotic_S_1(t_S, nu, N, flag = False, t_start = 1):
""" """
import statistics
import math
t = t_S[-1][0]
if flag == False:
c = math.exp(-nu*N/10)
t_start = int(0.6*c*t)
S = []
for i in range(t_start,t):
S.append(t_S[i... |
<gh_stars>10-100
import os
import time
import glob
import cv2
import h5py
import numpy as np
import scipy.io
import scipy.spatial
from scipy.ndimage.filters import gaussian_filter
import math
import scipy.io as io
from matplotlib import pyplot as plt
import sys
'''please set your dataset path'''
root = '/home/dkliang/... |
"""
pyrad.io.read_data_cosmo
========================
Functions for reading COSMO data
.. autosummary::
:toctree: generated/
cosmo2radar_data
cosmo2radar_coord
get_cosmo_fields
read_cosmo_data
read_cosmo_coord
_ncvar_to_dict
_prepare_for_interpolation
_put_radar_in_swiss_coord
"... |
from icenumerics.spins import *
from icenumerics.colloidalice import colloidal_ice
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import scipy.spatial as sptl
import pandas as pd
def unwrap_trj(trj,bounds):
""" Unwraps trj around periodic boundaries"""
trj2 = trj.cop... |
import sys
from Qcover.core import *
import os
import cotengra as ctg
from Qcover.backends import CircuitByTensor
from Qcover.applications.graph_color import GraphColoring
from time import time
import numpy as np
import h5py
from datetime import datetime
import quimb as qu
import quimb.tensor as qtn
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.