text string |
|---|
#!/bin/python
# -*- coding: utf-8 -*-
import os
import time
import tqdm
import numpy as np
from grgrlib.multiprocessing import serializer
from .mpile import get_par
from .stats import summary, pmdm_report
class PMDM(object):
"""A wrapper to have a progress par for the posterior mode maximization.
"""
na... |
<gh_stars>0
import csv, math, numpy as np
from collections import defaultdict
from matplotlib import pyplot as plt
from sklearn.decomposition import PCA as sklearnPCA
from scipy.cluster.hierarchy import dendrogram, linkage
def kmeans():
yeast_t = 7
yeast_k = 6
yeastData = np.empty([614, 7], dtype = float... |
from pylab import *
import sys
#sys.path.append("D:\\Control\\PythonPackages\\")
sys.path.append("C:\\photonbec\\Control\\PythonPackages\\")
import numpy as np
import scipy.misc
import numpy.fft as fft
from scipy.optimize import leastsq
import cv2
import pbec_analysis as pbeca
from scipy.signal import argrelmax, argre... |
''' Tests for fortran sequential files '''
import tempfile
import shutil
from os import path
from glob import iglob
import re
from numpy.testing import assert_equal, assert_allclose
import numpy as np
import pytest
from scipy.io import (FortranFile,
_test_fortran,
FortranE... |
import numpy as np
import itertools
from timeit import default_timer as timer
import scipy as scp
import scipy.stats as ssm
import multiprocessing as mp
#from matplotlib import pyplot as plt
#import matplotlib.animation as animation
def NBtorus(X, r = 1):
#Might need to be reduced only to focus metabol... |
<reponame>yhZhai/robrank
'''
Copyright (C) 2019-2021, <NAME> <<EMAIL>>
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 ... |
# _core/test_base.py
"""Tests for rom_operator_inference._core._base.py."""
import os
import h5py
import pytest
import numpy as np
from scipy import linalg as la
import rom_operator_inference as opinf
from . import MODEL_FORMS, _get_data, _get_operators, _trainedmodel
class TestBaseROM:
"""Test _core._base._Ba... |
#
# calcldawbic.py
#
# Copyright (c) 2017 <NAME>
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
#
#
# Includes pandas
#-----------------------------------------------------------------------------
# Copyright (c) 2012, PyData Development Team
# All rights reserved.... |
import sympy
from sympy import symbols, simplify, Matrix
from sympy.utilities import lambdify
import numpy as np
import robot_sim.robots.cobotta.cobotta as cbt_s
import basis.robot_math as rm
import modeling.geometric_model as gm
import visualization.panda.world as world
import time
import pickle
def sym_axangle(ax, ... |
# %% --------------------------------------- Load Packages -------------------------------------------------------------
import numpy as np
from numpy import cov
from numpy import trace
from numpy import iscomplexobj
from numpy import asarray
from numpy.random import shuffle
from scipy.linalg import sqrtm
from tensorfl... |
"""The about menu credits 3rd party packages."""
import os
import sys
import locale
import platform
import importlib
import warnings
from typing import Tuple, Dict
with warnings.catch_warnings(): # avoid an imp module deprecation warning
warnings.simplefilter("ignore")
import setuptools
import numpy
import sc... |
<filename>py/desispec/averagefluxcalibration.py
import numpy as np
import scipy.constants
from desimodel.io import load_desiparams
class AverageFluxCalib(object):
def __init__(self, wave, average_calib, atmospheric_extinction, seeing_term, \
pivot_airmass, pivot_seeing,\
atmospher... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 17 17:46:20 2018
@author: RahulJY_Wang
"""
#%%
import os
os.chdir("/home/rahul/workspace/wifi_predictor/src") #remote machine
#os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import sys
sys.path.append("../")
import matplotlib.pyplot as plt
#plt.switch_backend('agg')
import nu... |
'''
Taken from: Mehdi-Antoine
Link to original: https://github.com/Mehdi-Antoine/NormalMapGenerator
'''
import imageio
import numpy as np
import scipy.ndimage
import scipy.misc
from scipy import ndimage
import argparse
import os
def smooth_gaussian(im, sigma):
if sigma == 0:
return im
im_smooth = i... |
import pytest
from scirpy.ir_dist import (
AlignmentDistanceCalculator,
DistanceCalculator,
IdentityDistanceCalculator,
LevenshteinDistanceCalculator,
HammingDistanceCalculator,
ParallelDistanceCalculator,
IrNeighbors,
)
import numpy as np
import numpy.testing as npt
import scirpy as st
impo... |
<filename>codes/tests/base/test_1D_error_computation.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import sympy as sym
import pytest
import src.fem_base.master.master_1D as M1D
import src.handlers.dof_handler_1D as DOFH
import src.msh.mesh_1D as MSH
import src.fem_maps.fem_map as MAP
import src.... |
<gh_stars>10-100
"""
Run integration tests from pixsim through redshifts
python -m desispec.test.integration_test
"""
from __future__ import absolute_import, print_function
import sys
import os
import random
import time
import subprocess as sp
import glob
import shutil
import numpy as np
from astropy.io import fits
... |
<filename>apps/csr/heat_transfer_csr.py
import sys,os
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))
<<<<<<< HEAD:apps/heat_transfer.py
from PyEFVLib import MSHReader, Grid, ProblemData, CgnsSaver, CsvSaver, VtuSaver, VtmSaver
=======
from PyEFVLib import MSHReader, Grid, ProblemData, CgnsSave... |
<gh_stars>0
import tweepy
from textblob import TextBlob
import preprocessor
import statistics
from typing import List
from secrets import consumer_key, consumer_x.symmetric_difference_update(y)
def get_tweets():
return
def clean_tweets():
return
def get_sentiment():
return
def generate_average_sentime... |
<reponame>Illumina/SMNCopyNumberCaller
#!/usr/bin/env python3
#
# SMNCopyNumberCaller
# Copyright 2019-2020 Illumina, Inc.
# All rights reserved.
#
# Author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ... |
<reponame>Bf05nua/dosenet-analysis
import numpy as np
from scipy import optimize
from scipy import asarray as ar,exp
from scipy.integrate import quad
import matplotlib.pyplot as plt
verbose = 0
#--------------------------------------------------------------------------#
# Fit Functions
#--------------------... |
<gh_stars>0
import sys
import matplotlib.pyplot as plt
from scipy import stats
from processing_functions import *
import numpy as np
import statistics
data = read_in_scaphandre_json_file(sys.argv[1])
output_dir = sys.argv[2]
interval = sys.argv[3]
cores = float(sys.argv[4])
energy_data = process_socket_energy_data(da... |
from functools import lru_cache
from typing import Union
import numpy as np
from qutip import Qobj, expect, jmat, lindblad_dissipator, sigmax, sigmay, sigmaz, spin_q_function, spin_state, steadystate
from scipy import integrate
from scipy.linalg import expm
from utils import profile
def spin_S_measure(theta, Q):
... |
import os
import numpy as np
from numpy import linalg
from scipy import stats
import pypospack.utils
from pypospack.pyposmat.data import PyposmatConfigurationFile, PyposmatDataFile
from pypospack.statistics import GaussianKde
if __name__ == "__main__":
data_directory = os.path.join(
pypospack.utils.get... |
import os.path
import pickle
import numpy as np
import scipy.optimize as sciopt
from scipy.stats import norm
import pytest
from numpy.testing import (
assert_,
assert_almost_equal,
assert_equal,
assert_allclose,
)
from refnx.analysis import (
CurveFitter,
Parameter,
Parameters,
Model,... |
import numpy as np
import scipy.sparse as sp
from copy import deepcopy
from angler.linalg import construct_A, solver_direct, grid_average
from angler.derivatives import unpack_derivs
from angler.nonlinear_solvers import born_solve, newton_solve, newton_krylov_solve
from angler.source.mode import mode
from angler.nonli... |
<filename>Dassl/dassl/data/transforms/transforms.py<gh_stars>0
import numpy as np
import random
import torch
from PIL import Image
from torchvision.transforms import (
Resize, Compose, ToTensor, Normalize, CenterCrop, RandomCrop, ColorJitter,
RandomApply, GaussianBlur, RandomGrayscale, RandomResizedCrop,
Ra... |
<reponame>fr42k/gap-wgan-gp
"""Generative Adversarial Network for MNIST."""
import os, sys
sys.path.append(os.getcwd())
try: # This only matters on Ishaan's computer
import experiment_tools
experiment_tools.wait_for_gpu(tf=True)
except ImportError:
pass
import inception_score
import tflib as lib
import ... |
<gh_stars>10-100
import numpy as np
from utils import *
import scipy.linalg as la
import warnings
warnings.filterwarnings('error')
np.seterr(all='warn')
def LUPv2(inpA):
global global_vars
v = global_vars['v']
A = np.copy(inpA)
[m0, n0] = np.shape(A)
# first column of A holds original indices of ... |
<reponame>renatomello/qibo
"""Test special features of core gates."""
import pytest
import numpy as np
from qibo import K, gates
from qibo.models import Circuit
from qibo.tests.utils import random_state
####################### Test `_construct_unitary` feature #######################
GATES = [
("H", (0,), np.arra... |
<reponame>ACea15/sharpy
"""
Test assembly
<NAME>, 29 May 2018
"""
import os
import copy
import warnings
import unittest
import itertools
import numpy as np
import scipy.linalg as scalg
import sharpy.utils.h5utils as h5utils
import sharpy.linear.src.assembly as assembly
import sharpy.linear.src.multisurfaces as multis... |
<reponame>dimart10/machine-learning
import os
import argparse
import sys
import time
sys.path.append('../')
sys.path.append('../../utils')
import numpy as np
import matplotlib.pyplot as plt
import cv2
import pandas
import scipy.optimize as opt
import data_preprocessing as Preprocessing
from PIL import Image
# Custom ... |
<reponame>MatthewWilletts/GM-DGM<filename>src/data/data.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys, os, pickle, gzip, pdb
if sys.version_info[0]<3:
import cPickle
import numpy as np
import pandas
from data.mnist import mnist
from data.... |
from copy import deepcopy
import numpy as np
import pandas as pd
import statistics
from chemcharts.core.container.chemdata import ChemData
class Binning:
"""
The Binning contains a ChemData with binned median scores.
Method
----------
binning <chemdata: ChemData, num_bins: int>
... |
<gh_stars>0
# 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 or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or d... |
<reponame>alex-w/vplanet<gh_stars>0
import os
import multiprocessing as mp
import sys
import subprocess as sub
import mmap
import argparse
import h5py
import numpy as np
from collections import OrderedDict
import csv
import pandas as pd
from scipy import stats
"""
Code for command line call of bigplanet
"""
def Get... |
<filename>psydac/api/ast/utilities.py
import re
import string
import random
from sympy import Symbol, IndexedBase, Indexed, Idx
from sympy import Mul, Pow, Function, Tuple
from sympy import sqrt as sympy_sqrt, Range
from sympy.utilities.iterables import cartes
from sympde.topology.space import ScalarFunction
fr... |
<reponame>pearu/sympycore
# use time() instead on unix
import sys
if sys.platform=='win32':
from time import clock
else:
from time import time as clock
from sympycore import profile_expr
def time1(n=1):
from sympycore import Symbol, sin
x,y,z,v,w = map(Symbol,'xyzvw')
pattern = (2+v)*(v*w)**sin(x... |
import pandas as pd
import numpy as np
import scipy.stats as st
import logging
import functools
import asyncio
import rx
import datetime as dt
import exchange_calendars as ec
import plotille as plt
import socket
import warnings
import io
import json
import locale
import os
from bs4 import BeautifulSoup
from dateutil.tz... |
from __future__ import print_function
from scipy.optimize import fmin_l_bfgs_b
from itertools import chain
from subprocess import check_output
import warnings
from tempfile import NamedTemporaryFile
import logging
import gzip
from base64 import b64encode
from six import PY3, text_type
import numpy as np
from sklear... |
from math import sqrt
import numpy as np
from pycompss.api.api import compss_wait_on
from pycompss.api.constraint import constraint
from pycompss.api.parameter import COLLECTION_IN, Depth, Type
from pycompss.api.task import task
from scipy import sparse
from sklearn.base import BaseEstimator
from sklearn.metrics impor... |
"""Symbolic Curvature Utilities
This module provides functions for computing components of various curvature-related
tensors, such as Christoffel symbols, Riemann Tensor, and Ricci Tensor. While the
sympy module does offer analogous functions in the sympy.diffgeom subpackage, there is
an obnoxious bug in that derivati... |
<reponame>carrino/FrisPy
from typing import Dict, Union
import numpy as np
import math
from frispy.environment import Environment
from frispy.model import Model
from scipy.spatial.transform import Rotation
class EOM:
"""
``EOM`` is short for "equations of motion" is used to run the ODE solver
from `scipy... |
<filename>nipy/modalities/fmri/utils.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" This module defines some convenience functions of time.
interp : an expresion for a interpolated function of time
linear_interp : an expression for a linearly i... |
<reponame>Gringham/explainable-machine-translation-metrics
import argparse
import os
import dill
import numpy as np
import statistics
from sklearn.metrics import roc_auc_score, average_precision_score
from scipy.stats import pearsonr
from metrics.collection.MetricWrapper import MetricWrapper
from project_root import... |
<reponame>sumitsidana/cofactor<filename>src/preprocess_ML1M_backup.py
# coding: utf-8
# # Preprocess MovieLens-20M
# In[1]:
import datetime
import json
import os
import time
import sys
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pandas as pd
import scipy.sp... |
#!/usr/bin/env python
"""Provides conversion for molecules."""
import openbabel as ob
import pybel
import networkx as nx
import scipy.spatial.distance
import numpy as np
import subprocess
import shlex
from eden.util import read
import logging
logger = logging.getLogger(__name__)
def load(fname):
"""load."""
... |
# coding: utf-8
# The code takes the corrected file from *sso_freeze* (hardwired by user) and peforms a corrdinate transformation on the X-ray emission to wrap the PSF around Jupiter
# In[1]:
#Authors: <NAME> (<EMAIL>), apadpted from <NAME>'s 'gochandra' IDL script
"""All the relevant packages are imported for code... |
# coding=utf-8
import numpy as np
from pypint.multi_level_providers.multi_level_provider import MultiLevelProvider
from pypint.utilities import assert_is_instance, assert_condition
from pypint.plugins.multigrid.stencil import Stencil
from pypint.plugins.multigrid.i_multigrid_level import IMultigridLevel
import scipy.s... |
<gh_stars>1-10
import numpy as np
import scipy.spatial.distance as dis
import matplotlib.pyplot as plt
__all__ = ['k_means']
# KMeans主函数
def k_means(data_set, cluster_count):
point_count = np.shape(data_set)[0] # 数据集中的待分类点个数
# 列1:数据集归类的聚类中心(0,1,2,3),列2:数据集行向量到聚类中心的距离
point_cluster_distances = np.zeros... |
<gh_stars>10-100
from javax.swing import *
from thermo.system import *
from thermodynamicOperations import *
from processSimulation import *
from processSimulation.processEquipment import *
from processSimulation.processEquipment.stream import *
from processSimulation.processEquipment.mixer import *
from processSimulat... |
<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from gatspy.periodic import LombScargle
import scipy.signal as sps
def window(b):
time, depth = np.genfromtxt("data/l45b{0}_cadence.txt".format(b)).T
ps = np.linspace(.1, 100, 1000)
fs = 1./ps
ys = np.ones_like(time)
normval = time.sha... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# chaotic_circuits.py
""" Simulates an electrical circuit with chaotic features, pulling the
information for a given circuit from circuitparams. The jerk equation is
expressed as a system of ODE's that is passed to scipy's odeint integrator.
"""
from . import circuitparams
import numpy as np
import scipy.... |
<reponame>livenson/Cirq<gh_stars>1-10
# Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
<filename>snpy/CSPtemp/generate_surf.py
#!/usr/bin/env python
from __future__ import print_function
from snpy import CSPtemp
import os,sys
from numpy import *
#from scipy.interpolate import bisplrep
#from scipy.interpolate import bisplev
#from pygplot import *
import pickle
import scipy.interpolate as inter
base = os.... |
<reponame>jokk33/IM906
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy a... |
<filename>image_morphing/quadratic_motion_path.py<gh_stars>1-10
from image_morphing.np import np, GPU
import cv2
from itertools import product
import os
from image_morphing.utils import *
from image_morphing.render import render_animation_256
from datetime import datetime
import time
from scipy.optimize import minimize... |
#!/usr/bin/env python
"""
compare polarization integrals from C++ implementation with reference implementation
"""
import numpy as np
import numpy.linalg as la
from scipy import special
# slow python implementation
from polarization_ints_reference import d_func as d_func_reference
from polarization_ints_reference impo... |
from tracking_util import *
from moviepy.editor import VideoFileClip
from vehicle_classifier import FeatureParams
import matplotlib.pyplot as plt
from scipy.ndimage.measurements import label
from pathlib import Path
model_dir = Path("../")
test_images_dir = Path("../test_images")
output_dir = Path("../")
class HotWin... |
#!/usr/bin/python
__doc__ = """Localization figure related miscellaneous stuff
@TCC--Some more usage documentation goes here
"""
import sys
import math
import ConfigParser
import numpy as NP
from scipy.signal import lfilter, butter, BadCoefficients # needed for filtering
# matplotlib, but only GUI/window-toolkit a... |
<reponame>dbstein/pybie2d<gh_stars>10-100
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.path
import numexpr as ne
import scipy as sp
import scipy.sparse
plt.ion()
import pybie2d
"""
Demonstrate how to use the pybie2d package to solve an interior/exterior
Laplace problem ... |
"""
Python implementation of
http://rosettacode.org/wiki/Chernick%27s_Carmichael_numbers
"""
# use sympy for prime test
from sympy import isprime
# based on C version
def primality_pretest(k):
if not (k % 3) or not (k % 5) or not (k % 7) or not (k % 11) or not(k % 13) or not (k % 17) or not (k % 19) or not (k... |
<reponame>lilies/Cirq
# Copyright 2019 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
# used from predict.py
import string
import numpy as np
from scipy.stats import skew, kurtosis
from collections import OrderedDict
# Input: a single column in the form of pandas series
def extract_bag_of_characters_features(data, n_val):
characters_to_check = [ '['+ c + ']' for c in string.printable if c n... |
<reponame>KarrLab/model_generator
""" Utility methods for generating submodels
:Author: <NAME> <<EMAIL>>
:Date: 2019-01-23
:Copyright: 2019, Karr Lab
:License: MIT
"""
from wc_onto import onto as wc_ontology
from wc_utils.util.units import unit_registry
import collections
import conv_opt
import math
import scipy.cons... |
""" Methods to compute globally and locally with the Riley slice.
In this file are found methods to compute with the moduli space known as the `Riley slice'.
"""
import farey
from mpmath import mp
mp.dps = 100
import math
import scipy.optimize
from numpy.polynomial import Polynomial as P
try:
import mpsolve
... |
# standard libraries
import collections
import copy
import functools
import math
import numbers
import operator
import typing
# third party libraries
import numpy
import numpy.fft
import scipy
import scipy.fftpack
import scipy.ndimage
import scipy.ndimage.filters
import scipy.ndimage.fourier
import scipy.signal
# loc... |
<filename>porespy/io/_funcs.py<gh_stars>100-1000
import os
import imageio
import subprocess
import numpy as np
from stl import mesh
import scipy.ndimage as nd
import skimage.measure as ms
from porespy.tools import sanitize_filename
from porespy.networks import generate_voxel_image
from porespy.filters import reduce_pea... |
<reponame>aowen-uwmad/PySpecTools
""" radiative.py
Routines for calculating quantities useful for
radiative transfer, such as Einstein coefficients
"""
import numpy as np
import pandas as pd
from scipy import constants
from pyspectools.units import kbcm, MHz2cm
def parse_str(filepath):
# Function that ... |
"""@file parent_class.py
CLMModeling abstract class
"""
import numpy as np
# functions for the 2h term
from scipy.integrate import simps
from scipy.special import jv
from scipy.interpolate import interp1d
from .generic import compute_reduced_shear_from_convergence
import warnings
from .generic import compute_reduced_... |
<filename>test/torchaudio_unittest/functional/functional_impl.py
"""Test defintion common to CPU and CUDA"""
import torch
import torchaudio.functional as F
from parameterized import parameterized
from scipy import signal
from torchaudio_unittest import common_utils
class Lfilter(common_utils.TestBaseMixin):
def ... |
<reponame>SharanRajani/SoundQX
from keras.models import Sequential, load_model
from keras.layers.core import Dense, Dropout, Activation,Flatten
from keras.layers.recurrent import LSTM, GRU, SimpleRNN
from keras.layers.convolutional import Convolution2D, Convolution1D, MaxPooling2D, MaxPooling1D, AveragePooling2D
from k... |
<reponame>congnb/mypython
import numpy
import matplotlib.pyplot as plt
import threading
import multiprocessing
from scipy import stats
class TestHist:
def hist(self, parameter_list):
x = numpy.random.uniform(0.0, 5.0, 100000)
plt.hist(x, 100)
plt.show()
y = numpy.random.normal(0.0... |
import numpy as np
import scipy.interpolate as interpolate
import matplotlib.pyplot as plt
import clusterbuster.mathut as math
"""
Start with e.g. InterpolateRadio2D(psiFile = '../Analysis_MUSIC2/Hoeft_radio/mach_psi_tablefine(10,3).txt', inter=(10,6))
"""
# from http://stackoverflow.... |
"""
The MIT License (MIT)
Copyright (c) 2015 <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, modify, merge, publi... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 3 11:31:57 2016
@author: cpkmanchee
beam_profile.py contains methods for dealing with beam profile images.
All definitions, usages, and calculations are consisten with ISO
standard 11146 (generally dealing with D4sigma beamwidths).
"""
import numpy as np
import scipy.op... |
""" Hybrid Recommender HRChunks.
"""
import math
import fractions
from barbante.recommendation.HybridRecommender import HybridRecommender
import barbante.utils.logging as barbante_logging
log = barbante_logging.get_logger(__name__)
class RecommenderHRChunks(HybridRecommender):
""" Hybrid Recommender HRChunks.... |
from torch.autograd import Variable
import torch
import torch.optim
import time
import copy
import pickle
import random
import numpy as np
from scipy.linalg import hadamard
from skimage.metrics import structural_similarity as ssim
from .helpers import *
from .mri_helpers import *
from .transforms import *
from .decode... |
<gh_stars>10-100
# -*- coding: utf-8 -*-
import numpy as np
import pyny3d.geoms as pyny
class ShadowsManager(object):
"""
Class in charge of the management for the shadows simulations.
It can be initialize as standalone object or associated to a
``pyny.Space`` through the ``.shadow`` met... |
<reponame>danielnyga/prac-dev<gh_stars>1-10
#
#
# (C) 2011-2016 by <NAME> (<EMAIL>)
#
# 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... |
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
def vshale_gr(gr_curve,gr_sand,gr_shale,type='linear'):
"""vshale_gr [summary]
Parameters
----------
gr_curve : [type]
[description]
gr_sand : [type]
[description]
gr_shale : [type]
[descrip... |
# 確率分布に利用する関数
# 利用するライブラリ
import numpy as np
from scipy.special import gamma, gammaln, digamma, beta # ガンマ関数, 対数ガンマ関数, ディガンマ関数, ベータ関数
import matplotlib.pyplot as plt
#%%
### ガンマ関数の計算
# 変数の値を指定
x = 4.0
# ガンマ関数の計算
y = gamma(x)
print(y)
# 対数ガンマ関数による計算
log_y = gammaln(x)
z = np.exp(log_y)
print(y)
# ガンマ関数を計算:(発散)
p... |
#!/usr/bin/env python
# <NAME> - Vanderbilt University
# <EMAIL>
# Last edited 8/15/2015
# Description: Calculates the stellar density based off of Juric et al 2008 and Jackson et al 2002. For use with Field Star Count metric
from __future__ import print_function
import numpy as np
import sys
from scipy.optimize impo... |
<reponame>ZettaAI/Synaptor
""" Overlap Matrix Consolidation """
import numpy as np
import scipy.sparse as sp
from .. import overlap
def apply_chunk_id_maps(overlap_arr, chunk_id_maps):
"""
Applies id maps to each overlap matrix, returns a combined overlap mat
"""
rs, cs, vs = list(), list(), list()... |
<gh_stars>10-100
import h5py
import scipy.misc
import tqdm
import json
import os
from PIL import Image
import matplotlib.pyplot as plt
from matplotlib import patches
def get_box_data(index, hdf5_data):
"""
get `left, top, width, height` of each picture
:param index:
:param hdf5_data:
:return:
... |
<gh_stars>0
# Copyright 2020 Google LLC
#
# 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 ... |
<reponame>fengziyue/Insta-DM
'''
<NAME>
PyTorch version 1.4.0, 1.7.0 confirmed
RUN SCRIPT:
./scripts/run_demo.sh
'''
import warnings
warnings.simplefilter("ignore", UserWarning)
import argparse
import time
import csv
from path import Path
import datetime
import os
import numpy as np
from imageio import imread
from ... |
<gh_stars>10-100
"""External mathematical dependencies."""
import numpy as np
import scipy
from .dependency import compatible_version
if compatible_version("scipy", ">= 1.0.0"):
from scipy.special import logsumexp
elif compatible_version("scipy", ">= 0.12"):
# You can use this function from current scipy imple... |
<filename>projection_approach/projection.py
#! /usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm
path = './pics_projection_approach'
np.random.seed(0)
n_points = 40
mm = np.array([1, 0, -1, 2])
x = np.linspace(0, 1, n_points)
features = [['a', 'b'], ['i', 'j'], ['m... |
# Real-Time Randomized Path Planning for Robot Navigation∗
"""
This is rrt extend code for 3D
@author: <NAME>
"""
import numpy as np
from numpy.matlib import repmat
from collections import defaultdict
import time
import matplotlib.pyplot as plt
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__fi... |
# coding: utf-8
# TODO add action of diff operators on sympy known functions
from itertools import groupby
from collections import OrderedDict
import numpy as np
from sympy import Basic
from sympy import Symbol
from sympy import Expr
from sympy import Tuple
from sympy import Matrix, ImmutableDenseMatrix
from symp... |
#!/usr/bin/env python3
# coding:utf-8
import fractions
def myAdd(a, b, c, d):
# a, b 为第一个分数的分子与分母
# c, d 为第二个分数的分子与分母
x = fractions.Fraction(a, b)
y = fractions.Fraction(c, d)
print(x+y)
def myMinus(a, b, c, d):
# a, b 为第一个分数的分子与分母
# c, d 为第二个分数的分子与分母
x = fractions.Fraction(a, b)
... |
<reponame>chrelli/3DDD_social_mouse_tracker
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 12 12:34:45 2018
@author: chrelli
USAGE python draw_depth_roi.py -ncams 4
AUTOMATIC function to generate the LED roi!
added a moe clever way to look for the blinking LED!
"""
#%% Import the nescessary... |
# Reading an excel file using Python
import xlrd
import numpy as np
from scipy import optimize
import matplotlib.pyplot as plt
from itertools import combinations
# Give the location of the file
loc = ('Book1.xls')
# To open Workbook
wb = xlrd.open_workbook(loc)
sheet = wb.sheet_by_index(0)
# combinations = list(c... |
import numpy as np
from scipy import (linalg, mat, dot)
from scipy.sparse import isspmatrix
def cosine_similarity(vec1, vec2):
"""
Calculate the cosine similarity between vec1 and vec2
vec1, vec2: list, np.array, scipy.mat or scipy.sparse.csr_matrix|csc_matrix...
Return:
float
""" ... |
from collections import deque
import copy
import datetime
import itertools
import numpy as np
import matplotlib
from matplotlib.mlab import *
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cmx
import os
from scipy import signal
from robot import Robot
fr... |
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
def gauss_evaluate_likelihood(X, x_true):
if len(X.shape) == 3:
a,b,c = X.shape
X = np.reshape(X, newshape=(a,b*c))
x_true = np.reshape(x_true, newshape=(b*c,))
X_mean = np.mean(X,0)
X_sd = np.std(X,0)
return np.mean(-(... |
<reponame>simpeg/simpegem<filename>simpegEM/Analytics/TDEM.py
import numpy as np
from scipy.constants import mu_0, pi
from scipy.special import erf
def hzAnalyticDipoleT(r, t, sigma):
theta = np.sqrt((sigma*mu_0)/(4*t))
tr = theta*r
etr = erf(tr)
t1 = (9/(2*tr**2) - 1)*etr
t2 = (1/np.sqrt(pi))*(9/t... |
# This Python file uses the following encoding: utf-8
"""
MIT License
Copyright (c) 2020 <NAME> & <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 li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.