text string |
|---|
# coding: utf8
""" Unit tests:
- :class:`TestUniformityUniformSpanningTreeSampler` to check that the different procedures used for uniform spanning trees of a graph actually sample spanning trees uniformly at random.
"""
import unittest
import itertools as itt
from collections import Counter
import numpy as np
from ... |
#@title
import numpy as np
import re
import string
import jax
import cmath
from typing import List
import tensorflow as tf
import tensornetwork as tn
from colorama import Fore
from colorama import Style
from itertools import product
class QCircuit:
"""Implementation of a QCircuit."""
def __init__(self, num_qubit... |
<reponame>savvytruffle/cauldron
'''This program is a translation of <NAME>'s IDL code to compute Temp ratios
with surface brightnesses for Spectroscopic Eclipsing Binaries. To run this program,
execute it with the following input arguments:
python sbratio.py 0 6237 0.3920984216 0 '''
## More instructive: python sbra... |
<filename>Mahalanobis/Mahalanobis.py
import numpy as np
x=np.random.random(10)
y=np.random.random(10)
#马氏距离要求样本数要大于维数,否则无法求协方差矩阵
#此处进行转置,表示10个样本,每个样本2维
X=np.vstack([x,y])
print(X)
XT=X.T
#方法一:根据公式求解
S=np.cov(X) #两个维度之间协方差矩阵
SI = np.linalg.inv(S) #协方差矩阵的逆矩阵
#马氏距离计算两个样本之间的距离,此处共有10个样本,两两组合,共有45个距离。
n=XT.shape[0]
d1=[... |
<filename>audio_data.py<gh_stars>0
import os
import os.path
import math
import threading
import torch
import torch.utils.data
import numpy as np
import librosa as lr
import bisect
import h5py
import scipy
from torch.autograd import Variable
class WavenetDataset(torch.utils.data.Dataset):
def __init__(self,
... |
<gh_stars>10-100
import pickle
import numpy as np
import scipy.io as sio
import os
# def save_HICO(HICO, HICO_dir, classid, begin, finish):
# all_boxes = []
# for i in range(finish - begin + 1):
# total = []
# score = []
# for key, value in HICO.iteritems():
# for element ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#TODO : save only fig ?
#TODO : update hbond graph when changing cutoff values
#TODO : check if angle is OK.
#TODO : Hbonds, use the selection....
#TODO : analyse
# - RG
# - RDF
# - salt bridges
# - cation-pi
import io
import os
import pickle
import... |
from scipy.ndimage import gaussian_filter
from lsml.feature.base_feature import BaseShapeFeature
class PrevIterFeature(BaseShapeFeature):
""" A feature that produces the previous level set iteration
smoothed by a gaussian filter with parameter sigma
"""
locality = 'local'
@property
def ... |
<reponame>asmcleod/NearFieldOptics
import os
import re
import time
import numpy
import pickle
from common import misc
from common.log import Logger
from numpy.linalg import solve
from scipy.integrate import simps
from scipy.interpolate import InterpolatedUnivariateSpline,UnivariateSpline,RectBivariateSpline,interp1d
fr... |
<reponame>kilimanjaro2/MRIQC_monkey
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
===================
Data handler module
===================
Reads in and writes CSV files with the IQMs
"""
from pathlib import Path
import numpy as np
import pan... |
<gh_stars>10-100
from collections import abc
from typing import Optional
import numpy as np
import numpy.linalg as la
from scipy.special import beta, gamma
from scipy.stats import multivariate_normal as mvn
from copulae.core import is_psd
from copulae.types import Numeric, OptNumeric
class multivariate_t:
_T_LI... |
<gh_stars>1-10
# -*- coding: UTF-8 -*-
# Copyright (c) 2018, <NAME> & <NAME>
# All rights reserved.
#
# This file is part of the pymatreader Project, see:
# https://gitlab.com/obob/pymatreader
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the followin... |
<gh_stars>1-10
"""
functions/fast_rcnn/fast_rcnn_conv_feat_detect.m
"""
import math
import scipy
import numpy as np
from faster_rcnn.functions.fast_rcnn_bbox_transform_inv import fast_rcnn_bbox_transform_inv
from faster_rcnn.rpn.proposal_im_detect import clip_boxes
from faster_rcnn.utils.blob import get_blobs
def f... |
<filename>Seam.py
import numpy as np
from imageio import imread, imwrite
from scipy.ndimage.filters import convolve
from tqdm import trange
from matplotlib import pyplot as plt
import numba
class Seam:
def __init__(self, filter_du, filter_dv, img):
self.filter_du = filter_du
self.filter_d... |
<filename>examples/signal_processing_examples/dsp_filters.py
import scipy.signal
import numpy as np
import sys
"""
This module shows how to use map_element in IoTPy
to build a library of classes for filtering streams
by encapsulating software from scipy.signal and
other software libraries.
The module consists of a bas... |
<reponame>ASU-CompMethodsPhysics-PHY494/project-snowwhite-7dwarves<gh_stars>0
# ASU PHY 494 Project 2: Solution: analysis
# Copyright (c) <NAME> 2017
# All Rights Reserved.
import numpy as np
import scipy.spatial
import matplotlib
import matplotlib.pyplot as plt
import parameters
from parameters import (M_star_in_s... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 26 21:38:13 2020
@author: elijahsheridan
"""
import numpy as np
import opt_helper as opt
import bisect as bs
import scipy
import matplotlib.pyplot as plt
def cross_sec_heatmap():
ms = np.log10([1, 1e3, 1e5])
Ls = np.array([i/2 for i in ran... |
#!/usr/bin/env python
import argparse, sys, copy, gzip, time, math, re
import numpy as np
import pandas as pd
from scipy import stats
from collections import Counter, defaultdict, namedtuple
import statsmodels.formula.api as smf
from operator import itemgetter
import warnings
from svtools.vcf.file import Vcf
from svto... |
<gh_stars>10-100
from __future__ import print_function, division
from sympy.core import S, sympify, expand
from sympy.functions import Piecewise, piecewise_fold
from sympy.functions.elementary.piecewise import ExprCondPair
from sympy.core.sets import Interval
def _add_splines(c, b1, d, b2):
"""Construct c*b1 + d... |
"""
14. Faça um programa que lê as duas notas parciais obtidas por um aluno numa disciplina ao longo de um semestre,
e calcule a sua média. A atribuição de conceitos obedece à tabela abaixo:
Média de Aproveitamento Conceito
Entre 9.0 e 10.0 A
Entre 7.5 e 9.0 B
Entre 6.0 e 7.5 ... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from glob import glob
import numpy as np
import matplotlib.pyplot as plt
from statistics import median
from tensorflow.keras import layers
from tensorflow.keras import models
from tensorflow.keras import optimizers
RESCALE = 10000000
EPOCH = 40
BATCH = 10
KERNEL = 1
... |
<gh_stars>0
import numpy as np
from scipy.integrate import solve_ivp
from pk_model.definitions import Compartment, form_rhs_ib, form_rhs_sc, write_solution_file
import json
# Some old sample options -
# to be removed, updated and included in some kind of unit test instead.
def generate_times(tmax, check_interval):
... |
"""
Module checks interactions between two molecules and
creates interacion fingerprints.
"""
from __future__ import division
from itertools import chain
from collections import OrderedDict, namedtuple
import sys
from six.moves import zip_longest
import numpy as np
from scipy.sparse import csr_matrix, isspmat... |
<filename>PythonCode/runOptimization.py
from __future__ import division
import numpy as np
import scipy.optimize as optim
import time
import optimization
import measures
import utility
KL_DIVERGENCE="rKL" # represent kl-divergence group fairness measure
ND_DIFFERENCE="rND" # represent normalized difference gr... |
<gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright 2020 The PsiZ Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... |
#!/usr/bin/env python
#-*-coding:utf-8-*-
from netCDF4 import Dataset
import numpy as np
import os
import scipy.interpolate as scp
import matplotlib.pyplot as plt
import scipy
from time import time
import sys
sys.path.append('../src/')
## Import own functions
from fine_forecast import *
from coarse_forecast import *
fr... |
"""
Mask R-CNN
Common utility functions and classes.
Copyright (c) 2017 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by <NAME>
"""
import numpy as np
import scipy.misc
import scipy.ndimage
import os
import random
import colorsys
from skimage.measure import find_contours
import m... |
## parse TCGA data
import pandas as pd
from collections import defaultdict
import numpy as np
import scipy.stats as stat
import os, time
def TCGA_ssGSEA(cancer_type, parse_reactome=True, simplify_barcode=True):
'''
Input
cancer_type: 'BLCA', 'SKCM' (melanoma), 'STAD' (gastric cancer)
simplify_barcode: if True, dup... |
import numpy as np
import resnet_model
import tensorflow as tf
from tensorflow.python.ops import variables
# import squeeze
from scipy import ndimage
import median
eval_dir = '/tmp/resnet_model/test'
log_root = '/tmp/resnet_model'
hps = resnet_model.HParams(batch_size=100,
num_classes=10,
... |
#!/usr/bin/env python3
class Dummy(object):
pass
def getWidth(xmlfile):
from xml.etree.ElementTree import ElementTree
xmlfp = None
try:
xmlfp = open(xmlfile,'r')
print('reading file width from: {0}'.format(xmlfile))
xmlx = ElementTree(file=xmlfp).getroot()
#width = int... |
'''
Helpful Function involving Matrices
'''
# Libraries
import numpy as np
from numpy import sin, cos
from scipy.linalg import block_diag
def add_above_diag(G, val=1):
n = G.shape[0]
for j in range(1, n):
G[j-1,j] = val
def poly_mats(W_list, V):
deg = len(W_list)
W = np.diag(np.array(W_... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
plt.style.use('fivethirtyeight')
# Numerical Solution of Yoyo despinning

The image above shows a proposed yoyo despin mechanism that has two
masses attached to a sliding track that ke... |
import numpy as np
from scipy.stats import entropy
from helper_functions import convert_assignment_to_clusters
def f(x): # for entropy
return x*(-np.log2(x))
def g(x): # for entropy
return -np.log2(x)
def f_gini(x):
return x*(1-x)
def g_gini(x):
return 1-x
def partition_entropy_rg(assignment, data, ... |
<filename>calvin_models/calvin_agent/datasets/utils/episode_utils.py
import logging
from pathlib import Path
from typing import Dict, Tuple
import numpy as np
from omegaconf import DictConfig, ListConfig, OmegaConf
from scipy.spatial.transform import Rotation as R
import torch
logger = logging.getLogger(__name__)
d... |
<gh_stars>0
# -*- coding: utf-8 -*-
# Function to calculate Ne as described in (Waples, 2006) (the same as in Ne estimator v. 2 software)
import simuPOP as sim
import pandas as pd
from statistics import mean
def CalcLDNe(pop, param):
sim.stat(pop = pop, popSize = "subPopSize")
sim.stat(pop= pop, effectiveSize... |
<reponame>chazzy1/nycdsaML
# coding: utf-8
# # Content
# __1. Exploratory Visualization__
# __2. Data Cleaning__
# __3. Feature Engineering__
# __4. Modeling & Evaluation__
# __5. Ensemble Methods__
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import warnings
from math import sqrt
... |
###############################################################################
# Create tensorflow records file for (projected) images
# Multiple images are used as input --> all inputs are "similar to each other"
# 'Similar' images can be hardcoded or obtained as nearest neighbours based on
# the embedding distance o... |
<reponame>kassianefacanha/distanciamento_social<filename>yolov3/social_distance_detector.py
MODEL_PATH = "yolo-coco"
MIN_CONF = 0.3
NMS_THRESH = 0.4
USE_GPU = False
MIN_DISTANCE = 50
from detection import detect_people
from scipy.spatial import distance as dist
import numpy as np
import argparse
import imutils
impo... |
<reponame>keatonb/WD_Gaia_Quick_Radius_Estimate
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 8 13:39:24 2019
https://github.com/keatonb/WD_Gaia_Quick_Radius_Estimate
@author: keatonb
"""
from __future__ import print_function, division
import astropy.units as u
from astropy.coordinates impo... |
"""
Plot Haxby masks
=================
Small script to plot the masks of the Haxby dataset.
"""
import numpy as np
from scipy import linalg
import matplotlib.pyplot as plt
from nilearn import datasets
haxby_dataset = datasets.fetch_haxby()
# Build the mean image because we have no anatomic data
from nilearn import i... |
# -*- coding: utf-8 -*-
"""
Miscellaneous functions for plotting, logging, data output, fitting etc
"""
import numpy as np
import matplotlib
from matplotlib import rcParams
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.animation as animation
from matplotlib.ticker import MaxNLocator, For... |
<filename>data/extract_relevant_data.py
import numpy as np
import os
from scipy.stats import multivariate_normal as normal_pdf
directories = []
progresses = []
results = []
gt_samples = []
targetlnpdfs = []
my_groundtruth_lns = []
log_densities = []
confs = []
final_groundtruth_lns = []
final_learned_lns = []
fevals =... |
<filename>boid.py
import pygame as pg
from random import uniform
from vehicle import Vehicle
import numpy as np
from scipy import signal
import random
class Boid(Vehicle):
# CONFIG
k=5
debug = False
min_speed = .001
max_speed = .05
max_force = 1
max_turn = 360
perception = 4
can_wr... |
import numpy as np
from scipy import misc
import os
import glob
import math
import scipy.io
import pandas as pd
def compute_3D_bbs_from_gt_liver(config):
path_list = []
MIN_AREA_SIZE = 512.0*512.0
phase = config.phase ## if/else
# inputs
images_path = os.path.join(config.database_root, 'images... |
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.patches import Ellipse
import matplotlib.lines as lines
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from math import pi
from scipy import linalg, ndimage
from scipy.stats import multivariate_normal
from sklearn.exceptions import... |
import nibabel as nb
import numpy as np
import cv2
import os
from skimage.measure import marching_cubes_lewiner as marching_cubes
import stl
from stl import mesh
import os
import numpy as np
from nibabel.testing import data_path
import nibabel as nb
import time
start_time = time.time()
import pandas
import h5py
import... |
import sys
from scipy.stats.stats import pearsonr
import matplotlib
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import matplotlib.mlab as mlab
sample_map = {
'Ost1-1':'A1054_01',
'Ost1-1pr2':'A1054_07',
'Ost2-2':'A1054_05',
'Ost3L41':... |
<reponame>JasonQSY/Associative3D
"""Script for dwr prediction benchmarking.
"""
# Sample usage:
# (shape_ft) : python -m factored3d.benchmark.suncg.dwr --num_train_epoch=1 --name=dwr_shape_ft --classify_rot --pred_voxels=True --use_context --save_visuals --visuals_freq=50 --eval_set=val --suncg_dl_debug_mode --max_e... |
from astropy.io import fits
import scipy.io as sio
from scipy.ndimage.filters import convolve as convolveim
import matplotlib.pyplot as plt
import ikernal23 as iker
import cv2
import os
from sklearn import cluster
import numpy as np
import pandas as pd
"""
fits.getdata()
return file style:numpy.ndarray
... |
import numpy as np
import matplotlib.pyplot as plt
import scipy as sp
from scipy import signal
import matplotlib.dates as mdates
from datetime import datetime
formato_tiempo=mdates.DateFormatter("%H:%M")
data=np.genfromtxt("ES_7.TXT.txt", names=True, delimiter=",", dtype=None, encoding=None)
date_list=list()
for i in r... |
#
# Shared methods and classes for testing
#
import pybamm
from scipy.sparse import eye
class SpatialMethodForTesting(pybamm.SpatialMethod):
"""Identity operators, no boundary conditions."""
def __init__(self, mesh):
super().__init__(mesh)
def gradient(self, symbol, discretised_symbol, boundary_... |
<reponame>amjltc295/hand_track_classification
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 5 12:53:37 2018
Functions that are used in training the network.
1) Cyclic learning rate scheduler from:
https://github.com/thomasjpfan/pytorch/blob/master/torch/optim/lr_scheduler.py
@author: Γιώργος
"""
import sys
im... |
<reponame>ishine/tf-kaldi-speaker-master
#!/usr/bin/env python
"""
This script computes the official performance metrics for the NIST SREs.
The metrics include EER and DCFs (min/act).
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__version__ = "4.3"
import numpy as np
def compute_norm_counts(scores, edges, wght... |
<filename>CNNectome/validation/organelles/cremi_scores.py<gh_stars>1-10
import numpy as np
import scipy.ndimage
import lazy_property
BG = 0
class CremiEvaluator(object):
def __init__(self, truth, test, sampling=(1, 1, 1), clip_distance=200, tol_distance=40):
self.test = test
self.truth = truth
... |
<gh_stars>0
#!/usr/bin/python
#
# TEMPLATE
# BT Nodes for Testing, ID, Solving
#
# Replace TEMPLATE below with your solution method
#
# Copyright 2017 University of Washington
# Developed by <NAME> and <NAME>
# BioRobotics Lab, University of Washington
# Redistribution and use in source and binary forms, wit... |
import numpy as np
from scipy.spatial.distance import pdist, squareform, cdist
import scipy.stats
import scipy.integrate
import math
import yaml
import os
import torch
import mdtraj
import multiprocessing as mp
"""
Compute the KSD divergence using samples, adapted from the theano code
"""
# From https://github.com/Y... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 26/06/18
@author: <NAME>
"""
import numpy as np
import scipy.sparse as sps
import time, sys, copy
from enum import Enum
from Utils.seconds_to_biggest_unit import seconds_to_biggest_unit
from Base.Evaluation.metrics import roc_auc, precision, precision_re... |
<reponame>jiayiliu/gradio
"""
This module defines various classes that can serve as the `input` to an interface. Each class must inherit from
`InputComponent`, and each class must define a path to its template. All of the subclasses of `InputComponent` are
automatically added to a registry, which allows them to be easi... |
<filename>HierarchicalCluster/HierarchicalClustering.py
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 12 14:31:43 2017
@author: mjq
"""
import numpy as np
import pandas as pd
from sklearn import datasets
import matplotlib.pyplot as plt
from scipy.spatial import distance
from numpy import linalg as LA
... |
"""
Functions and Wrappers to define families of kernels for signal analysis.
Author: <NAME>
Adapted from: https://github.com/pennmem/ptsa_new/blob/master/ptsa/wavelet.py
Last Updated: 2018/08/31
"""
import numpy as np
from scipy.signal import morlet as scipy_morlet
def morlet(freqs, cycles, Fs, n_win=7, complete=T... |
<reponame>yeatmanlab/BrainTools
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 15 12:05:40 2016
@author: sjjoo
"""
import sys
import mne
import matplotlib.pyplot as plt
from mne.utils import run_subprocess, logger
import os
from os import path as op
import copy
import shutil
import numpy as np
from numpy.random impor... |
# Copyright 2019-2020 <NAME> All Right 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 applicable law or ag... |
import math
from scipy.optimize import fsolve
from sim21.data.chemsep_consts import GAS_CONSTANT
from sim21.data.eqn import eval_eqn, eval_eqn_int, eval_eqn_int_over_t
import numpy as np
def fixed_properties(tb, sg, mw):
"""
Obtain the key fixed properties using the Twu correlations
:param tb: boiling poi... |
from pouring_base import Pouring_base
from pouring_MDP import Pouring_MDP
from gym import spaces
from scipy.spatial.transform import Rotation as R
import math
import numpy as np
import os,sys
FILE_PATH = os.path.abspath(os.path.dirname(__file__))
class Pouring_G2G_MDP(Pouring_MDP):
"""Concrete glass to glass water... |
from __future__ import division
from __future__ import print_function
import os
import unittest
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import logging
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),os.path.join('Resources','Libraries')))
import numpy... |
<filename>Similis/similis.py
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 07 17:56:46 2016
@author: Arenhart
"""
import PIL.Image as pil
import PIL.ImageTk as imagetk
import numpy as np
import scipy.ndimage as sp
import matplotlib.pyplot as plt
import skimage as sk
import skimage.filters as filters
import skimage.... |
<reponame>apoorva-sharma/deep-frame-interpolation<filename>data_loader.py
import numpy as np
from scipy import misc
import glob
from tensorflow.contrib.learn.python.learn.datasets import base
class DataSet(object):
def __init__(self, images, labels):
self._images = images
self._labels = labels
self._num_examp... |
#!/usr/bin/env python3
from colorsys import hsv_to_rgb
from math import sqrt, ceil
import matplotlib.colors
from matplotlib.patches import Rectangle
import matplotlib.pyplot as plt
import numpy as np
from optparse import OptionParser
import os
from PIL import Image
from scipy.cluster.vq import kmeans, whiten
import sy... |
<gh_stars>1-10
from fractions import gcd
def lcm(a, b):
return (a*b)/gcd(a, b)
def listLcm(lst):
curr = lst[0][1]
for i in range(1, len(lst)):
curr = lcm(curr, lst[i][1])
return curr
def convertFracts(lst):
res = []
den = int(listLcm(lst))
for v in lst:
res.append([int(... |
# -*- coding: utf-8 -*-
"""GRU_sequence+attention.ipynb
# Classifying OUV using GRU sequence model + Attention
## Imports
"""
import sys
sys.executable
from argparse import Namespace
from collections import Counter
import json
import os
import re
import string
import numpy as np
import pandas as pd
import torch
imp... |
import scipy
from glob import glob
import numpy as np
class DataLoader():
def __init__(self, img_res=(256,256)):
self.img_res = img_res
def load_data(self):
path = glob('./datasets/saree/new_handloom_saree/img_339968683.jpg')
batch=path
imgs_A, imgs_B = [], []
f... |
import numpy as np
np.random.seed(42)
from scipy.optimize import minimize
import emcee
import time
import sys
import os
from os.path import join as osjoin
from pc_path import definir_path
path_git, path_datos_global = definir_path()
os.chdir(path_git)
sys.path.append('./Software/utils/')
from sampleo import MCMC_sampl... |
<reponame>bmwant/chemister
import operator
import statistics
from crawler.helpers import load_config, get_statuses
from crawler.models.bid import (
get_daily_bids,
BidType,
BidStatus,
ACTIVE_STATUSES,
GONE_STATUSES,
)
from crawler.models.fund import get_fund, Currency
def get_bare_value_for_bids(... |
<filename>dm/app/pred.py
import pandas as pd
import numpy as np
from scipy.sparse import csr_matrix, hstack
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.preprocessing import LabelBinarizer
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.met... |
<gh_stars>0
import numpy as np
#import minimizers
import torch
from sklearn.utils.extmath import randomized_svd
from numpy.linalg import norm
import scipy.sparse
import PIL.Image
import numpy as np
from sklearn.metrics import pairwise_distances
import pydensecrf.densecrf as dcrf
from scipy import sparse
from skimage.s... |
<reponame>cphyc/cosmo_z17to0
import matplotlib.pyplot as plt
import argparse
import pandas as pd
import numpy as np
import os
from tqdm import tqdm
from pint import UnitRegistry
ur = UnitRegistry()
parser = argparse.ArgumentParser(description='Compute the smoothing tree of a halo.')
parser.add_argument('--in', dest='i... |
import glob
import os
import numpy as np
from sklearn.utils import shuffle
from scipy import misc
from PIL import Image
import pandas as pd
import matplotlib
from matplotlib import pyplot as plt
import tensorflow as tf
#matplotlib.interactive(True)
random_seed = 90210
np.random.seed(random_seed)
img_w, img_h = 64,... |
<filename>scripts/Binning_data/binning_netcdf_data_using_general_value_for_all_dimension.py
import xarray as xr
import numpy as np
import scipy.stats
from pandas import CategoricalIndex
import pandas as pd
def binned_statistic_1d(da, dim, bins=10, statistic='count', value_range=None):
'''
Bin a data array by ... |
<reponame>samir-nasibli/scikit-learn-intelex<filename>sklearnex/tests/test_memory_usage.py
#===============================================================================
# Copyright 2021-2022 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... |
<filename>bigappleserialbus/chart_trajectories.py
import numpy as np
import matplotlib.pyplot as plt
import os
from trajectory import Trajectory, Base
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sklearn.decomposition import ... |
"""
Class for performing a HESS style 2D fit of muon images
To do:
- Deal with astropy untis better, currently stripped and no checks made
- unit tests
- create container class for output
"""
import numpy as np
from scipy.ndimage.filters import correlate1d
from iminuit import Minuit
from astropy import un... |
<gh_stars>0
"""
Reading and preparing epoch data to create each 4 grous and 2 pattern
"""
import mne
import numpy as np
from scipy.signal import savgol_filter
def read_prep_epochs(args):
if args.applyBaseline_bool:
filename_epoch = args.SAVE_EPOCH_ROOT + \
'epochs_sec_applyBaseline... |
<gh_stars>0
"""
mpm testing
"""
from importlib import reload
import meshModel
reload(meshModel)
from meshModel import *
import material
reload(material)
from material import *
from scipy.special import erfc
import tempModel
reload(tempModel)
from tempModel import *
import stokes2Dve
reload(stokes2Dve)
from stoke... |
<reponame>zhuchangzhan/SEAS
#!/usr/bin/env python
#
# Copyright (C) 2017 - Massachusetts Institute of Technology (MIT)
#
# This program 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 of the L... |
<gh_stars>0
import numpy as np
def differential_encoding(image):
image = image.astype("float64")
height, width = image.shape
encoded = np.zeros(image.shape, dtype="float64")
# rewrite first element
encoded[0, 0] = image[0, 0]
# calculate first row
for i in range(1, width):
encoded[... |
from qiskit import QuantumCircuit, transpile
from typing import List, Union
from collections import OrderedDict
import itertools
import multiprocessing as mp
from collections import Counter
from math import pi
from scipy.special import logsumexp
import numpy as np
from abc import ABC, abstractmethod
from qiskit import ... |
#
# Copyright 2019 <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provi... |
""" Module for plot values eg: type, cdf, labl etc"""
from __future__ import print_function
import logging
import numpy as np
import pandas as pd
from scipy import stats
from raven_preprocess.column_info import ColumnInfo
import raven_preprocess.col_info_constants as col_const
logger = logging.getLogger(__name__)
cl... |
<filename>malaya/_models/_sklearn_model.py
import xgboost as xgb
import numpy as np
from collections import Counter
from scipy.sparse import hstack
from ..texts._text_functions import (
simple_textcleaning,
classification_textcleaning,
entities_textcleaning,
language_detection_textcleaning,
)
from .._ut... |
from sympy.physics.mechanics import (Body, Lagrangian, KanesMethod, LagrangesMethod,
RigidBody, Particle)
from sympy.physics.mechanics.method import _Methods
__all__ = ['JointsMethod']
class JointsMethod(_Methods):
"""Method for formulating the equations of motion using a set ... |
<reponame>robflintham/mippy
import dicom
import numpy as np
from Tkinter import *
from ttk import *
from PIL import Image, ImageTk
import platform
import scipy.stats as sps
from datetime import datetime
import scipy.ndimage.interpolation as spim
import gc
import time
import sys
########################################... |
import os,sys
PROJECT_ROOT = os.environ['ULS_ROOT_DIR']
sys.path.append(PROJECT_ROOT)
from Parameters import *
import pickle
import matplotlib.pyplot as plt
import statistics as stat
import numpy as np
import seaborn as sns
import pandas as pd
from matplotlib.patches import Ellipse
import sys,os
import matplotlib
from... |
""" Analyze MCMC output - chain length, etc. """
# Built-in libraries
import os
import pickle
# External libraries
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.stats import median_abs_deviation
import xarray as xr
# Local libraries
import pygem.pygem_input as pygem_prms
#from oggm... |
# -*- coding: utf-8 -*-
"""
Author: <NAME> / <NAME>
This program was developed in the scope of WESE H2020 project
The FEMM model here developed is used to estimate the EMF's surrounding a
3-phase submarine power cable.
For more information on the femm functions used, please check the manual
available he... |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module contains the object used to describe the possible bonded atoms based on a Voronoi analysis.
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2012, The Materials Project"
__credits__ = "<NAME>"
__version__ ... |
<filename>SCGAN_mnist_train.py<gh_stars>1-10
#! /usr/bin/python
# -*- coding: utf8 -*-
import os, time, pickle, random, time
from datetime import datetime
import numpy as np
from time import localtime, strftime
import logging, scipy
import tensorflow as tf
import tensorlayer as tl
import math as ma
from model import ... |
<gh_stars>1-10
from collections import UserList
import numpy as np
import scipy.linalg
from pycce.utilities import expand
class Pulse:
"""
Class containing properties of each control pulse, applied to the system.
Args:
axis (str): Axis of rotation of the central spin. Can be 'x', 'y', or 'z'. De... |
<reponame>binarybana/samcnet
import sys, os, random
import numpy as np
import scipy as sp
import networkx as nx
import json as js
import tables as t
import zlib
import cPickle
import time as gtime
import pylab as p
from samcnet.samc import SAMCRun
from samcnet.treenet import TreeNet, generateTree, generateData
from sa... |
import struct
import wave
import numpy as np
import pyaudio
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
from scipy.signal import butter, lfilter, welch
# This script calculates and displays the difference of the power spectral density for the left and right microphone offline
# from that we might b... |
# -*- coding: iso-8859-1 -*-
"""
Functions to compute the mean cross-section in each bin.
"""
import numpy as np
import pdb
import matplotlib.pyplot as plt
import scipy.stats
from scipy import interpolate as interp
import cookbook
"""
***********************************************************************************... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.