code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import unittest import random import numpy as np from mep.genetics.population import Population from mep.genetics.chromosome import Chromosome class TestPopulation(unittest.TestCase): """ Test the Population class. """ def test_random_tournament_selection(self): """ Test the random_to...
[ "numpy.zeros", "random.seed", "mep.genetics.chromosome.Chromosome" ]
[((401, 415), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (412, 415), False, 'import random\n'), ((1321, 1335), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (1332, 1335), False, 'import random\n'), ((534, 572), 'numpy.zeros', 'np.zeros', (['(num_examples, num_features)'], {}), '((num_examples, num_fe...
from typing import Callable import numpy as np import torch import torch.nn as nn from util.data import transform_observation class PommerQEmbeddingRNN(nn.Module): def __init__(self, embedding_model): super(PommerQEmbeddingRNN, self).__init__() self.embedding_model = embedding_model self....
[ "torch.nn.ReLU", "util.data.transform_observation", "torch.nn.Softmax", "numpy.array", "torch.nn.Linear", "torch.device", "torch.nn.LSTM", "torch.nn.Flatten" ]
[((400, 415), 'torch.nn.LSTM', 'nn.LSTM', (['(64)', '(64)'], {}), '(64, 64)\n', (407, 415), True, 'import torch.nn as nn\n'), ((497, 509), 'torch.nn.Flatten', 'nn.Flatten', ([], {}), '()\n', (507, 509), True, 'import torch.nn as nn\n'), ((523, 532), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (530, 532), True, 'impor...
# -*- coding: utf-8 -*- # from math import pi import numpy from .. import helpers def show(scheme, backend="mpl"): """Displays scheme for 3D ball quadrature. """ helpers.backend_to_function[backend]( scheme.points, scheme.weights, volume=4.0 / 3.0 * pi, edges=[], b...
[ "numpy.multiply.outer", "numpy.array", "numpy.swapaxes" ]
[((438, 457), 'numpy.array', 'numpy.array', (['center'], {}), '(center)\n', (449, 457), False, 'import numpy\n'), ((467, 508), 'numpy.multiply.outer', 'numpy.multiply.outer', (['radius', 'rule.points'], {}), '(radius, rule.points)\n', (487, 508), False, 'import numpy\n'), ((518, 543), 'numpy.swapaxes', 'numpy.swapaxes'...
from __future__ import print_function import keras.backend as K import keras.losses as losses import keras.optimizers as optimizers import numpy as np from keras.callbacks import ModelCheckpoint from keras.layers.advanced_activations import LeakyReLU from keras.layers import Input, RepeatVector, Reshape from keras.la...
[ "keras.layers.Input", "numpy.expand_dims", "keras.models.Model" ]
[((1293, 1334), 'keras.layers.Input', 'Input', (['img_shape'], {'name': '"""predictor_img_in"""'}), "(img_shape, name='predictor_img_in')\n", (1298, 1334), False, 'from keras.layers import Input, RepeatVector, Reshape\n'), ((1352, 1394), 'keras.layers.Input', 'Input', (['img_shape'], {'name': '"""predictor_img0_in"""'}...
import torch import numpy as np import pickle def filterit(s,W2ID): s=s.lower() S='' for c in s: if c in ' abcdefghijklmnopqrstuvwxyz0123456789': S+=c S = " ".join([x if x and x in W2ID else "<unk>" for x in S.split()]) return S def Sentence2Embeddings(sentence,W2ID,EMB): if...
[ "torch.stack", "pickle.load", "torch.nn.utils.rnn.pad_sequence", "numpy.vstack", "torch.from_numpy" ]
[((1080, 1115), 'numpy.vstack', 'np.vstack', (['[GloVe[w] for w in W2ID]'], {}), '([GloVe[w] for w in W2ID])\n', (1089, 1115), True, 'import numpy as np\n'), ((1651, 1665), 'torch.stack', 'torch.stack', (['A'], {}), '(A)\n', (1662, 1665), False, 'import torch\n'), ((1908, 1922), 'torch.stack', 'torch.stack', (['A'], {}...
import numpy as np import torch import torch.nn as nn from two_thinning.average_based.RL.basic_neuralnet_RL.neural_network import AverageTwoThinningNet n = 10 m = n epsilon = 0.1 train_episodes = 3000 eval_runs = 300 patience = 20 print_progress = True print_behaviour = False def reward(x): return -np.max(x) ...
[ "torch.nn.MSELoss", "torch.argmax", "torch.DoubleTensor", "numpy.zeros", "two_thinning.average_based.RL.basic_neuralnet_RL.neural_network.AverageTwoThinningNet", "numpy.max", "numpy.random.randint", "torch.cuda.is_available", "torch.rand", "torch.no_grad" ]
[((494, 521), 'torch.argmax', 'torch.argmax', (['action_values'], {}), '(action_values)\n', (506, 521), False, 'import torch\n'), ((663, 676), 'torch.rand', 'torch.rand', (['(1)'], {}), '(1)\n', (673, 676), False, 'import torch\n'), ((1804, 1836), 'two_thinning.average_based.RL.basic_neuralnet_RL.neural_network.Average...
# -*- coding: utf-8 -*- """ .. invisible: _ _ _____ _ _____ _____ | | | | ___| | | ___/ ___| | | | | |__ | | | |__ \ `--. | | | | __|| | | __| `--. \ \ \_/ / |___| |___| |___/\__/ / \___/\____/\_____|____/\____/ Created on Apr 13, 2015 BLAS class to use with ocl backend. ██...
[ "opencl4py.blas.CLBLAS", "zope.interface.implementer", "os.walk", "numpy.zeros", "threading.Lock", "veles.dummy.DummyWorkflow", "veles.numpy_ext.roundup", "weakref.ref" ]
[((1621, 1645), 'zope.interface.implementer', 'implementer', (['IOpenCLUnit'], {}), '(IOpenCLUnit)\n', (1632, 1645), False, 'from zope.interface import implementer\n'), ((2720, 2736), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (2734, 2736), False, 'import threading\n'), ((2760, 2779), 'weakref.ref', 'weakref...
import numpy as np from lipkin.model import LipkinModel class HartreeFock(LipkinModel): name = 'Hartree-Fock' def __init__(self, epsilon, V, Omega): if Omega%2 == 1: raise ValueError('This HF implementation assumes N = Omega = even.') LipkinModel.__init__(self, e...
[ "numpy.empty", "numpy.square", "numpy.zeros", "numpy.linalg.eig", "lipkin.model.LipkinModel.__init__", "numpy.sin", "numpy.array", "numpy.exp", "numpy.random.normal", "numpy.cos", "numpy.dot", "numpy.conjugate", "numpy.sqrt" ]
[((292, 344), 'lipkin.model.LipkinModel.__init__', 'LipkinModel.__init__', (['self', 'epsilon', 'V', 'Omega', 'Omega'], {}), '(self, epsilon, V, Omega, Omega)\n', (312, 344), False, 'from lipkin.model import LipkinModel\n'), ((538, 562), 'numpy.array', 'np.array', (['[theta0, phi0]'], {}), '([theta0, phi0])\n', (546, 5...
# coding: utf-8 # In[1]: get_ipython().run_cell_magic('javascript', '', '<!-- Ignore this block -->\nIPython.OutputArea.prototype._should_scroll = function(lines) {\n return false;\n}') # ## Use housing data # I have loaded the required modules. Pandas and Numpy. I have also included sqrt function from Math li...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "math.sqrt", "pandas.read_csv", "numpy.square", "numpy.zeros", "numpy.insert", "numpy.hstack", "numpy.array", "numpy.dot", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.subplots" ]
[((722, 748), 'pandas.read_csv', 'pd.read_csv', (['inputFilepath'], {}), '(inputFilepath)\n', (733, 748), True, 'import pandas as pd\n'), ((5725, 5758), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(2)'], {'sharey': '"""none"""'}), "(3, 2, sharey='none')\n", (5737, 5758), True, 'import matplotlib.pyplot as p...
"""Convexified Belief Propagation Class""" import numpy as np from .MatrixBeliefPropagator import MatrixBeliefPropagator, logsumexp, sparse_dot class ConvexBeliefPropagator(MatrixBeliefPropagator): """ Class to perform convexified belief propagation based on counting numbers. The class allows for non-Bethe ...
[ "numpy.abs", "numpy.nan_to_num", "numpy.zeros", "numpy.ones", "numpy.hstack", "numpy.exp" ]
[((1362, 1392), 'numpy.ones', 'np.ones', (['(2 * self.mn.num_edges)'], {}), '(2 * self.mn.num_edges)\n', (1369, 1392), True, 'import numpy as np\n'), ((2257, 2288), 'numpy.zeros', 'np.zeros', (['(2 * self.mn.num_edges)'], {}), '(2 * self.mn.num_edges)\n', (2265, 2288), True, 'import numpy as np\n'), ((4039, 4137), 'num...
import unittest from tests.test_support import TestSupport from mock import Mock from maskgen.masks.donor_rules import VideoDonor, AudioDonor, AllStreamDonor, AllAudioStreamDonor, \ VideoDonorWithoutAudio, InterpolateDonor,AudioZipDonor from maskgen.video_tools import get_type_of_segment, get_start_time_from_segme...
[ "unittest.main", "numpy.sum", "maskgen.video_tools.get_type_of_segment", "maskgen.video_tools.get_start_time_from_segment", "numpy.zeros", "maskgen.video_tools.get_end_frame_from_segment", "numpy.ones", "mock.Mock", "maskgen.video_tools.get_start_frame_from_segment", "maskgen.video_tools.get_end_t...
[((9585, 9600), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9598, 9600), False, 'import unittest\n'), ((501, 507), 'mock.Mock', 'Mock', ([], {}), '()\n', (505, 507), False, 'from mock import Mock\n'), ((3326, 3332), 'mock.Mock', 'Mock', ([], {}), '()\n', (3330, 3332), False, 'from mock import Mock\n'), ((6064,...
#%% -*- coding: utf-8 -*- """ Created on Sun Apr 26 02:47:57 2020 plot sherical hermonics in 3D with radial colormap http://balbuceosastropy.blogspot.com/2015/06/spherical-harmonics-in-python.html """ from __future__ import division import scipy as sci import scipy.special as sp import numpy as np import matplotlib...
[ "scipy.special.sph_harm", "matplotlib.colors.Normalize", "matplotlib.cm.ScalarMappable", "matplotlib.cm.jet", "numpy.sin", "numpy.cos" ]
[((1230, 1260), 'matplotlib.cm.ScalarMappable', 'cm.ScalarMappable', ([], {'cmap': 'cm.jet'}), '(cmap=cm.jet)\n', (1247, 1260), False, 'from matplotlib import cm, colors\n'), ((1908, 1926), 'matplotlib.colors.Normalize', 'colors.Normalize', ([], {}), '()\n', (1924, 1926), False, 'from matplotlib import cm, colors\n'), ...
""" Common sub models for lubricants """ import numpy as np __all__ = ['constant_array_property', 'roelands', 'barus', 'nd_barus', 'nd_roelands', 'dowson_higginson', 'nd_dowson_higginson'] def constant_array_property(value: float): """ Produce a closure that returns an index able constant value ...
[ "numpy.exp", "numpy.ones_like", "numpy.log" ]
[((1879, 1892), 'numpy.log', 'np.log', (['eta_0'], {}), '(eta_0)\n', (1885, 1892), True, 'import numpy as np\n'), ((3063, 3076), 'numpy.log', 'np.log', (['eta_0'], {}), '(eta_0)\n', (3069, 3076), True, 'import numpy as np\n'), ((3193, 3249), 'numpy.exp', 'np.exp', (['(ln_eta_0 * (-1 + (1 + p_all * nd_pressure) ** z))']...
import numpy as np from gradient_boosting import * def test_train_predict(): X_train, y_train = load_dataset("data/tiny.rent.train") X_val, y_val = load_dataset("data/tiny.rent.test") y_mean, trees = gradient_boosting_mse(X_train, y_train, 5, max_depth=2, nu=0.1) assert(np.around(y_mean, decimals=4)== 3...
[ "numpy.around" ]
[((287, 316), 'numpy.around', 'np.around', (['y_mean'], {'decimals': '(4)'}), '(y_mean, decimals=4)\n', (296, 316), True, 'import numpy as np\n')]
# -*- coding: UTF-8 -*- # # Copyright (C) 2008-2011 <NAME> <<EMAIL>>. # # 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 2 of the License, or # (at your option) any later version. ...
[ "ctypes.c_double", "math.sqrt", "ctypes.byref", "numpy.empty", "solvcon.dependency.getcdll" ]
[((2530, 2592), 'math.sqrt', 'sqrt', (['(((ga - 1) * Ms ** 2 + 2) / (2 * ga * Ms ** 2 - (ga - 1)))'], {}), '(((ga - 1) * Ms ** 2 + 2) / (2 * ga * Ms ** 2 - (ga - 1)))\n', (2534, 2592), False, 'from math import sqrt\n'), ((2773, 2791), 'math.sqrt', 'sqrt', (['self.ratio_T'], {}), '(self.ratio_T)\n', (2777, 2791), False,...
#%% import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap import matplotlib.cm as cm from tqdm import trange, tqdm from sklearn.metrics import adjusted_rand_score from argparse import ArgumentParser from util.config_parser import ConfigParser_with_eval #%% parse arguments def...
[ "matplotlib.pyplot.title", "tqdm.tqdm", "util.config_parser.ConfigParser_with_eval", "numpy.sum", "argparse.ArgumentParser", "matplotlib.pyplot.clf", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.subplot2grid", "joblib.Parallel", "numpy.loadtxt", "matplotlib.pyplot.xticks", "matplotlib.pypl...
[((449, 465), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (463, 465), False, 'from argparse import ArgumentParser\n'), ((2757, 2803), 'numpy.loadtxt', 'np.loadtxt', (['"""summary_files/log_likelihood.txt"""'], {}), "('summary_files/log_likelihood.txt')\n", (2767, 2803), True, 'import numpy as np\n'),...
# -*- coding: utf-8 -*- import click import logging from pathlib import Path from dotenv import find_dotenv, load_dotenv import netCDF4 as nc import pickle as pk import pandas as pd import datetime import os import numpy as np import sys src_dir = os.path.join(os.getcwd(), 'src/data') sys.path.append(src_dir) from hel...
[ "sys.path.append", "numpy.stack", "logging.basicConfig", "dotenv.find_dotenv", "os.getcwd", "click.option", "numpy.ones", "click.command", "pathlib.Path", "click.Path", "numpy.tile", "seq2seq_class.Seq2Seq_Class", "helper.load_pkl", "logging.getLogger" ]
[((287, 311), 'sys.path.append', 'sys.path.append', (['src_dir'], {}), '(src_dir)\n', (302, 311), False, 'import sys\n'), ((414, 438), 'sys.path.append', 'sys.path.append', (['src_dir'], {}), '(src_dir)\n', (429, 438), False, 'import sys\n'), ((2158, 2173), 'click.command', 'click.command', ([], {}), '()\n', (2171, 217...
import pickle import numpy as np import pandas as pd import shap import matplotlib.pyplot as pl shap.initjs() json_path = "response.json" model_path = "xgboost_primary_model.pkl" AGE_GROUP_CUTOFFS = [0, 17, 30, 40, 50, 60, 70, 120] AGE_GROUPS_TRANSFORMER = {1: 10, 2: 25, 3: 35, 4: 45, 5: 55, 6: 65, 7: 75} AGE_COL =...
[ "pandas.read_csv", "shap.summary_plot", "pandas.read_json", "shap.initjs", "shap.TreeExplainer", "shap.force_plot", "numpy.round" ]
[((98, 111), 'shap.initjs', 'shap.initjs', ([], {}), '()\n', (109, 111), False, 'import shap\n'), ((802, 837), 'pandas.read_json', 'pd.read_json', (['json_path'], {'lines': '(True)'}), '(json_path, lines=True)\n', (814, 837), True, 'import pandas as pd\n'), ((1068, 1101), 'numpy.round', 'np.round', (['predictions[:, 1]...
from IMLearn.learners import UnivariateGaussian, MultivariateGaussian import numpy as np import plotly.graph_objects as go import plotly.io as pio from matplotlib import pyplot as plt pio.templates.default = "simple_white" SAMPLES = 1000 QUESTION_ONE_MEAN = 10 QUESTION_ONE_VAR = 1 QUESTION_ONE_SAMPLES_SKIP = 10 QUEST...
[ "IMLearn.learners.UnivariateGaussian", "matplotlib.pyplot.show", "numpy.random.seed", "numpy.vectorize", "IMLearn.learners.MultivariateGaussian", "numpy.amax", "numpy.mean", "numpy.random.multivariate_normal", "numpy.arange", "numpy.array", "numpy.random.normal", "numpy.linspace", "matplotli...
[((476, 543), 'numpy.random.normal', 'np.random.normal', (['QUESTION_ONE_MEAN', 'QUESTION_ONE_VAR'], {'size': 'SAMPLES'}), '(QUESTION_ONE_MEAN, QUESTION_ONE_VAR, size=SAMPLES)\n', (492, 543), True, 'import numpy as np\n'), ((570, 590), 'IMLearn.learners.UnivariateGaussian', 'UnivariateGaussian', ([], {}), '()\n', (588,...
import numpy as np from lmfit.model import Model class PDFdecayModel(Model): r"""A model to describe the product of a decaying exponential and a Gaussian with three parameters: ``amplitude``, ``xi``, and ``sigma`` .. math:: f(x; A, \xi, \sigma) = A e^{[-{|x|}/\xi]} e^{[{-{x^2}/{{2\sigma}^2}}]} ...
[ "numpy.exp" ]
[((601, 635), 'numpy.exp', 'np.exp', (['(-x ** 2 / (2 * sigma ** 2))'], {}), '(-x ** 2 / (2 * sigma ** 2))\n', (607, 635), True, 'import numpy as np\n')]
import pygame import numpy as np from collections import OrderedDict from Utility.shape import Rectangle from Utility import ui from Level.generic_level import GenericLevel class Level(GenericLevel): def __init__(self, player, **kwargs): super().__init__(**kwargs) self.player = player...
[ "numpy.full", "pygame.quit", "pygame.image.load", "pygame.draw.line", "pygame.draw.circle", "pygame.draw.rect", "pygame.event.get", "numpy.zeros", "Utility.ui.message", "pygame.display.flip", "pygame.time.wait", "pygame.display.update", "collections.OrderedDict", "Utility.shape.Rectangle",...
[((7700, 7870), 'Utility.ui.message', 'ui.message', ([], {'gameDisplay': 'self.gameDisplay', 'msg': '"""Yeah.!"""', 'x': '(self.gameDimension[0] // 2 - 50)', 'y': '(self.gameDimension[1] // 2 - 50)', 'color': '(100, 200, 100)', 'font_size': '(50)'}), "(gameDisplay=self.gameDisplay, msg='Yeah.!', x=self.gameDimension\n ...
"""Sample program that runs a sweep and records results.""" from pathlib import Path from typing import Sequence import numpy as np from absl import app from absl import flags from differential_value_iteration import utils from differential_value_iteration.algorithms import algorithms from differential_value_iteration...
[ "differential_value_iteration.environments.micro.create_mrp1", "differential_value_iteration.environments.micro.create_mrp2", "differential_value_iteration.algorithms.algorithms.MDVI_Evaluation", "pathlib.Path", "differential_value_iteration.utils.run_alg", "absl.flags.DEFINE_bool", "differential_value_...
[((428, 506), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', ([], {'name': '"""plot_dir"""', 'default': '"""plots"""', 'help': '"""path to plot dir"""'}), "(name='plot_dir', default='plots', help='path to plot dir')\n", (447, 506), False, 'from absl import flags\n'), ((507, 585), 'absl.flags.DEFINE_integer', 'flags...
import fastNLP as FN import argparse import os import random import numpy import torch def get_argparser(): parser = argparse.ArgumentParser() parser.add_argument('--lr', type=float, required=True) parser.add_argument('--w_decay', type=float, required=True) parser.add_argument('--lr_decay', type=float...
[ "numpy.random.seed", "argparse.ArgumentParser", "torch.random.manual_seed", "torch.cuda.manual_seed_all", "numpy.random.randint", "random.seed" ]
[((123, 148), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (146, 148), False, 'import argparse\n'), ((1092, 1109), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1103, 1109), False, 'import random\n'), ((1114, 1137), 'numpy.random.seed', 'numpy.random.seed', (['seed'], {}), '(seed...
#!/usr/env/python python3 # -*- coding: utf-8 -*- # @File : vad_util.py # @Time : 2018/8/29 13:37 # @Software : PyCharm import numpy as np from math import log import librosa def mse(data): return ((data ** 2).mean()) ** 0.5 def dBFS(data): mse_data = mse(data) if mse_data == 0.0: retur...
[ "numpy.abs", "librosa.output.write_wav", "numpy.max", "numpy.array", "librosa.load", "math.log" ]
[((973, 984), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (981, 984), True, 'import numpy as np\n'), ((1055, 1068), 'numpy.abs', 'np.abs', (['sound'], {}), '(sound)\n', (1061, 1068), True, 'import numpy as np\n'), ((1157, 1203), 'librosa.load', 'librosa.load', (['"""BAC009S0908W0161.wav"""'], {'sr': '(16000)'}), "...
# -*- coding: utf-8 -*- """Demonstrations of setting up models and visualising outputs.""" from __future__ import division __authors__ = '<NAME>' __license__ = 'MIT' import sys import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.animation import FuncAnimation import numpy as np from pompy imp...
[ "matplotlib.pyplot.plot", "pompy.processors.ConcentrationArrayGenerator", "matplotlib.pyplot.scatter", "pompy.processors.ConcentrationValueCalculator", "matplotlib.pyplot.quiver", "pompy.models.Rectangle", "matplotlib.pyplot.imshow", "numpy.random.RandomState", "matplotlib.animation.FuncAnimation", ...
[((672, 708), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': 'fig_size'}), '(1, 1, figsize=fig_size)\n', (684, 708), True, 'import matplotlib.pyplot as plt\n'), ((1970, 1997), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (1991, 1997), True, 'import numpy a...
import numpy as np import matplotlib.pyplot as plt from PIL import Image import os from .leafs import leafs print("Reloaded preprocessing!") def normalize(dataset): '''normalize data so that over all imeges the pixels on place (x/y) have mean = 0 and are standart distributed''' # calculate the mean mean=np...
[ "numpy.save", "matplotlib.pyplot.show", "numpy.average", "os.path.join", "numpy.maximum", "matplotlib.pyplot.imshow", "os.walk", "numpy.zeros", "numpy.ones", "PIL.Image.open", "os.path.isfile", "numpy.array", "os.path.splitext", "numpy.argwhere", "matplotlib.pyplot.tight_layout", "nump...
[((318, 350), 'numpy.zeros', 'np.zeros', (['dataset[0].image.shape'], {}), '(dataset[0].image.shape)\n', (326, 350), True, 'import numpy as np\n'), ((469, 501), 'numpy.zeros', 'np.zeros', (['dataset[0].image.shape'], {}), '(dataset[0].image.shape)\n', (477, 501), True, 'import numpy as np\n'), ((1774, 1806), 'os.walk',...
import random import numpy as np from utils import splitPoly import matplotlib.patches as patches import matplotlib.path as path from matplotlib.transforms import Bbox import cartopy.crs as ccrs from spot import Spot class Star: # Stellar Radius in RSun, inclincation in degrees # Limb darkening grid resolution...
[ "numpy.dstack", "utils.splitPoly", "matplotlib.patches.Path", "cartopy.crs.RotatedPole", "cartopy.crs.Geodetic", "numpy.meshgrid", "matplotlib.path.contains_points", "matplotlib.transforms.Bbox", "numpy.ma.masked_greater", "numpy.column_stack", "spot.Spot.gen_spot", "numpy.ones", "matplotlib...
[((1059, 1166), 'cartopy.crs.Globe', 'ccrs.Globe', ([], {'semimajor_axis': 'self.radius', 'semiminor_axis': 'self.radius', 'ellipse': '"""sphere"""', 'flattening': '(1e-09)'}), "(semimajor_axis=self.radius, semiminor_axis=self.radius, ellipse=\n 'sphere', flattening=1e-09)\n", (1069, 1166), True, 'import cartopy.crs...
""" This file contains source code from another GitHub project. The comments made there apply. The source code was licensed under the MIT License. The license text and a detailed reference can be found in the license subfolder at models/east_open_cv/license. Many thanks to the author of the code. For reasons of c...
[ "numpy.asarray", "cv2.dnn.blobFromImage", "time.time", "cv2.dnn.readNet", "numpy.sin", "numpy.array", "numpy.cos", "cv2.resize" ]
[((1172, 1218), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['config.EAST_OPENCV_MODEL_PATH'], {}), '(config.EAST_OPENCV_MODEL_PATH)\n', (1187, 1218), False, 'import cv2\n'), ((2235, 2266), 'cv2.resize', 'cv2.resize', (['image', '(newW, newH)'], {}), '(image, (newW, newH))\n', (2245, 2266), False, 'import cv2\n'), ((2844, 2...
# Copyright - Transporation, Bots, and Disability Lab - Carnegie Mellon University # Released under MIT License """ Common Operations/Codes that are re-written on Baxter """ import numpy as np from pyquaternion import Quaternion from alloy.math import * __all__ = [ 'convert_joint_angles_to_numpy','transform_pose...
[ "pyquaternion.Quaternion", "numpy.zeros" ]
[((595, 606), 'numpy.zeros', 'np.zeros', (['(7)'], {}), '(7)\n', (603, 606), True, 'import numpy as np\n'), ((1186, 1197), 'numpy.zeros', 'np.zeros', (['(6)'], {}), '(6)\n', (1194, 1197), True, 'import numpy as np\n'), ((1346, 1364), 'pyquaternion.Quaternion', 'Quaternion', (['p2[3:]'], {}), '(p2[3:])\n', (1356, 1364),...
import cv2 import matplotlib.pyplot as plt import numpy as np from pathlib import Path import scipy.io from scipy import optimize from feature_func import * from preprocess import * from utils import * def fit_data(gt_count, feature_data, function): return optimize.curve_fit(function, feature_data, gt_count) d...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.scatter", "matplotlib.pyplot.legend", "numpy.power", "scipy.optimize.curve_fit", "cv2.imread", "pathlib.Path" ]
[((264, 316), 'scipy.optimize.curve_fit', 'optimize.curve_fit', (['function', 'feature_data', 'gt_count'], {}), '(function, feature_data, gt_count)\n', (282, 316), False, 'from scipy import optimize\n'), ((378, 431), 'matplotlib.pyplot.scatter', 'plt.scatter', (['feature_data', 'gt_count'], {'label': '"""raw data"""'})...
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np from keras.models import Sequential, Model from keras.models import model_from_yaml import keras.backend as K from keras.callbacks import Callback from ..utility.utils import path def custom_uniform(shape, range=(-1, 1), name=None): """ Examp...
[ "numpy.dot", "numpy.random.uniform", "keras.models.model_from_yaml", "keras.models.Sequential" ]
[((415, 465), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': 'min_', 'high': 'max_', 'size': 'shape'}), '(low=min_, high=max_, size=shape)\n', (432, 465), True, 'import numpy as np\n'), ((1139, 1151), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1149, 1151), False, 'from keras.models import Se...
import numpy as np import sys sys.path.insert(0, '..') from src.utils import * class LinearRegression: def __init__(self): self.params = None def train(self, X, y, iterations=5000, learning_rate=0.01, display=False): ''' Input parameters: X: (mxn) array where m is the number ...
[ "numpy.append", "numpy.zeros", "sys.path.insert" ]
[((31, 55), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (46, 55), False, 'import sys\n'), ((511, 536), 'numpy.zeros', 'np.zeros', (['(X.shape[1], 1)'], {}), '((X.shape[1], 1))\n', (519, 536), True, 'import numpy as np\n'), ((558, 574), 'numpy.zeros', 'np.zeros', (['(1, 0)'], {}), '((...
from collections import deque import numpy as np class Logger: """Print recorded values.""" def __init__(self, name): """ :param name str: identifier for printed value """ self.name = name def __call__(self, value): print("{}: {}".format(self.name, value)) cla...
[ "numpy.mean", "collections.deque" ]
[((724, 749), 'collections.deque', 'deque', ([], {'maxlen': 'filter_size'}), '(maxlen=filter_size)\n', (729, 749), False, 'from collections import deque\n'), ((913, 933), 'numpy.mean', 'np.mean', (['self.values'], {}), '(self.values)\n', (920, 933), True, 'import numpy as np\n')]
import numpy as np import time import pandas as pd import matplotlib.pyplot as plt import random def karatsuba(x, y): """ Recursive implementation of Karatsuba's Fast Mulciplication Algoritihm :param x: The first integer :param y: The second integer :return: The product of x * y """ if x < 10...
[ "matplotlib.pyplot.show", "random.randint", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.zeros", "time.perf_counter", "numpy.array", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((1572, 1632), 'matplotlib.pyplot.plot', 'plt.plot', (['test_size', 'standard_results'], {'label': '"""python native"""'}), "(test_size, standard_results, label='python native')\n", (1580, 1632), True, 'import matplotlib.pyplot as plt\n'), ((1637, 1694), 'matplotlib.pyplot.plot', 'plt.plot', (['test_size', 'karatsuba_...
#!/usr/bin/env python # -*- coding: utf-8 -*- from pylab import * import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import subprocess #Creacion de la Poblacion datos = open("Datos/Poblacion.txt","w") datos.close() datos = open("Datos/Estados.txt","w") datos.close() #genera...
[ "numpy.random.uniform", "subprocess.Popen", "numpy.random.choice" ]
[((1379, 1429), 'numpy.random.choice', 'np.random.choice', (['(4)', 'contador'], {'p': '[sano, s, inf, r]'}), '(4, contador, p=[sano, s, inf, r])\n', (1395, 1429), True, 'import numpy as np\n'), ((1529, 1578), 'subprocess.Popen', 'subprocess.Popen', (["[sys.executable, 'src/mapa.py']"], {}), "([sys.executable, 'src/map...
# This file is compatible with both Python 2 and 3 import base64 import cv2 import json import numpy as np from flask import Response import time import functools from collections import deque class Stream(deque): """ A stream stores an output sequence stream of data. It inherits from deque. Stream conta...
[ "numpy.stack", "numpy.argmax", "numpy.isfinite", "numpy.argmin", "json.dumps", "numpy.isnan", "time.sleep", "functools.wraps" ]
[((2501, 2526), 'functools.wraps', 'functools.wraps', (['data2msg'], {}), '(data2msg)\n', (2516, 2526), False, 'import functools\n'), ((3907, 3928), 'json.dumps', 'json.dumps', (['send_dict'], {}), '(send_dict)\n', (3917, 3928), False, 'import json\n'), ((5582, 5603), 'numpy.argmin', 'np.argmin', (['ys'], {'axis': '(0)...
import numpy as np from mpi4py import MPI from SIMP import TO_SIMP, make_Conn_matrix def get_void(nely,nelx): v=np.zeros((nely,nelx)) R=min(nely,nelx)/15 loc=np.array([[1/3, 1/4], [2/3, 1/4],[ 1/3, 1/2], [2/3, 1/2], [1/3 , 3/4], [2/3, 3/4]]) loc=loc*np.array([[nely,nelx]]) for i in range(nely): ...
[ "numpy.save", "numpy.ceil", "SIMP.make_Conn_matrix", "numpy.zeros", "numpy.mean", "numpy.array", "numpy.random.rand" ]
[((1080, 1108), 'SIMP.make_Conn_matrix', 'make_Conn_matrix', (['nelx', 'nely'], {}), '(nelx, nely)\n', (1096, 1108), False, 'from SIMP import TO_SIMP, make_Conn_matrix\n'), ((1206, 1223), 'numpy.zeros', 'np.zeros', (['perrank'], {}), '(perrank)\n', (1214, 1223), True, 'import numpy as np\n'), ((1240, 1257), 'numpy.zero...
from typing import Tuple import numpy as np from sklearn.model_selection import train_test_split from tensorflow.keras.datasets import mnist from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.utils import to_categorical class MNIST: def __init__(self, with_normali...
[ "tensorflow.keras.preprocessing.image.ImageDataGenerator", "tensorflow.keras.utils.to_categorical", "sklearn.model_selection.train_test_split", "numpy.zeros", "numpy.expand_dims", "tensorflow.keras.datasets.mnist.load_data", "numpy.random.randint", "numpy.concatenate" ]
[((398, 415), 'tensorflow.keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (413, 415), False, 'from tensorflow.keras.datasets import mnist\n'), ((749, 781), 'numpy.expand_dims', 'np.expand_dims', (['x_train'], {'axis': '(-1)'}), '(x_train, axis=-1)\n', (763, 781), True, 'import numpy as np\n'), ((9...
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/datasets/datasets.retailrocket.ipynb (unless otherwise specified). __all__ = ['RetailRocketDataset', 'RetailRocketDatasetv2'] # Cell from typing import List, Optional, Callable, Union, Any, Tuple import os import os.path as osp from collections.abc import Sequence impo...
[ "os.unlink", "os.path.exists", "datetime.datetime.strptime", "pandas.to_datetime", "datetime.timedelta", "os.path.join", "numpy.in1d" ]
[((4482, 4497), 'os.unlink', 'os.unlink', (['path'], {}), '(path)\n', (4491, 4497), False, 'import os\n'), ((5013, 5048), 'pandas.to_datetime', 'pd.to_datetime', (['data.Time'], {'unit': '"""s"""'}), "(data.Time, unit='s')\n", (5027, 5048), True, 'import pandas as pd\n'), ((7368, 7435), 'datetime.datetime.strptime', 'd...
#!/usr/bin/env python # ------------------------------------------------------------------------------------------------------% # Created by "Thieu" at 17:40, 06/11/2021 % # ...
[ "numpy.abs", "mealpy.bio_based.SMA.BaseSMA" ]
[((1451, 1510), 'mealpy.bio_based.SMA.BaseSMA', 'SMA.BaseSMA', (['problem_dict1'], {'epoch': '(100)', 'pop_size': '(50)', 'pr': '(0.03)'}), '(problem_dict1, epoch=100, pop_size=50, pr=0.03)\n', (1462, 1510), False, 'from mealpy.bio_based import SMA\n'), ((987, 1001), 'numpy.abs', 'np.abs', (['(x + 10)'], {}), '(x + 10)...
from keras.utils import multi_gpu_model import numpy as np import tensorflow as tf import pickle from keras.models import Model, Input from keras.optimizers import Adam, RMSprop from keras.layers import Dense from keras.layers import Conv2D, Conv2DTranspose from keras.layers import Flatten, Add from keras.layers impor...
[ "tensorflow.image.ssim", "numpy.ones", "keras.models.Model", "numpy.clip", "pickle.load", "numpy.random.randint", "keras.layers.LeakyReLU", "keras.utils.multi_gpu_model", "keras.optimizers.Adam", "keras.layers.Conv2DTranspose", "keras.layers.Concatenate", "tensorflow.random_normal_initializer"...
[((12779, 12832), 'keras.utils.multi_gpu_model', 'multi_gpu_model', (['d_model'], {'gpus': '(4)', 'cpu_relocation': '(True)'}), '(d_model, gpus=4, cpu_relocation=True)\n', (12794, 12832), False, 'from keras.utils import multi_gpu_model\n'), ((12866, 12893), 'keras.optimizers.Adam', 'Adam', ([], {'lr': '(0.0002)', 'beta...
"""Identity matrix.""" from scipy import sparse import numpy as np def iden(dim: int, is_sparse: bool = False) -> np.ndarray: r""" Calculate the :code:`dim`-by-:code:`dim` identity matrix [WIKID]_. Returns the :code:`dim`-by-:code:`dim` identity matrix. If :code:`is_sparse = False` then the matrix w...
[ "numpy.identity", "scipy.sparse.eye" ]
[((2041, 2056), 'scipy.sparse.eye', 'sparse.eye', (['dim'], {}), '(dim)\n', (2051, 2056), False, 'from scipy import sparse\n'), ((2084, 2100), 'numpy.identity', 'np.identity', (['dim'], {}), '(dim)\n', (2095, 2100), True, 'import numpy as np\n')]
import faiss import numpy as np from sklearn.cluster import KMeans from sklearn.metrics.cluster import normalized_mutual_info_score from argparse import ArgumentParser def parse_args(): """ Helper function parsing the command line options @retval ArgumentParser """ parser = ArgumentParser(descrip...
[ "numpy.load", "faiss.GpuIndexFlatL2", "argparse.ArgumentParser", "sklearn.cluster.KMeans", "faiss.Clustering", "faiss.GpuIndexFlatConfig", "faiss.StandardGpuResources", "numpy.unique", "sklearn.metrics.cluster.normalized_mutual_info_score" ]
[((298, 362), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""PyTorch metric learning nmi script"""'}), "(description='PyTorch metric learning nmi script')\n", (312, 362), False, 'from argparse import ArgumentParser\n'), ((1057, 1074), 'numpy.unique', 'np.unique', (['labels'], {}), '(labels)\n', (...
import os import numpy as np import os.path as op import matplotlib.pyplot as plt from matplotlib.colors import BASE_COLORS, SymLogNorm from scipy.stats import ttest_ind from swann.preprocessing import get_info from swann.utils import get_config, derivative_fname from swann.analyses import decompose_tfr, find_bursts,...
[ "numpy.log", "swann.utils.get_config", "mne.viz.iter_topography", "mne.time_frequency.EpochsTFR", "matplotlib.pyplot.close", "numpy.median", "numpy.std", "numpy.concatenate", "mne.Epochs", "os.path.isfile", "numpy.min", "numpy.max", "mne.time_frequency.tfr_morlet", "swann.analyses.find_bur...
[((2836, 2848), 'swann.utils.get_config', 'get_config', ([], {}), '()\n', (2846, 2848), False, 'from swann.utils import get_config, derivative_fname\n'), ((4064, 4167), 'mne.Epochs', 'Epochs', (['raw', 'events'], {'tmin': "(config['tmin'] - 1)", 'baseline': 'None', 'tmax': "(config['tmax'] + 1)", 'preload': '(True)'}),...
# -------------------------------------------------------------------------------------------------------------------- # # Import packages # -------------------------------------------------------------------------------------------------------------------- # import numpy as np from .nurbs_surface import NurbsSurface ...
[ "numpy.shape", "numpy.zeros" ]
[((2206, 2229), 'numpy.zeros', 'np.zeros', (['(n_dim, n, m)'], {}), '((n_dim, n, m))\n', (2214, 2229), True, 'import numpy as np\n'), ((1681, 1694), 'numpy.shape', 'np.shape', (['P00'], {}), '(P00)\n', (1689, 1694), True, 'import numpy as np\n'), ((1699, 1712), 'numpy.shape', 'np.shape', (['P01'], {}), '(P01)\n', (1707...
from hypothesis import HealthCheck from hypothesis import given, settings from hypothesis.extra import numpy as hnp from pytiff import * import hypothesis.strategies as st import numpy as np import pytest import subprocess import tifffile from skimage.data import coffee def test_write_rgb(tmpdir_factory): img = co...
[ "numpy.testing.assert_array_equal", "hypothesis.extra.numpy.integer_dtypes", "tifffile.TiffFile", "numpy.dtype", "numpy.ones", "hypothesis.extra.numpy.unsigned_integer_dtypes", "hypothesis.strategies.floats", "hypothesis.extra.numpy.floating_dtypes", "hypothesis.settings", "pytest.raises", "nump...
[((803, 833), 'hypothesis.settings', 'settings', ([], {'buffer_size': '(11000000)'}), '(buffer_size=11000000)\n', (811, 833), False, 'from hypothesis import given, settings\n'), ((1373, 1403), 'hypothesis.settings', 'settings', ([], {'buffer_size': '(11000000)'}), '(buffer_size=11000000)\n', (1381, 1403), False, 'from ...
import numpy as np def rd(c1, c2): return np.sqrt((c1[0]-c2[0])**2+(c1[1]-c2[1])**2+(c1[2]-c2[2])**2) #rbf as global support spline type #Gaussian Spline def rbf(r): return np.exp(-r**2) #Spline polynomial def rbf1(r,deg): return r**deg # Global def rbf2(r): return np.exp(-r**2) # %% codecell
[ "numpy.exp", "numpy.sqrt" ]
[((46, 121), 'numpy.sqrt', 'np.sqrt', (['((c1[0] - c2[0]) ** 2 + (c1[1] - c2[1]) ** 2 + (c1[2] - c2[2]) ** 2)'], {}), '((c1[0] - c2[0]) ** 2 + (c1[1] - c2[1]) ** 2 + (c1[2] - c2[2]) ** 2)\n', (53, 121), True, 'import numpy as np\n'), ((181, 196), 'numpy.exp', 'np.exp', (['(-r ** 2)'], {}), '(-r ** 2)\n', (187, 196), Tr...
#!/usr/bin/env python '''This module contains routines to perform Gram-Schmidt orthonormalization on a sequence of vectors. ''' import numpy as np import numpy.linalg as la def gso(A, overwrite=False, out=None): '''Performs Gram-Schmidt orthonormalization on a sequence of vectors. Parameters ---------- ...
[ "numpy.dot", "numpy.random.random", "numpy.linalg.norm", "numpy.zeros_like" ]
[((1456, 1480), 'numpy.random.random', 'np.random.random', (['(6, 6)'], {}), '((6, 6))\n', (1472, 1480), True, 'import numpy as np\n'), ((1582, 1600), 'numpy.dot', 'np.dot', (['out.T', 'out'], {}), '(out.T, out)\n', (1588, 1600), True, 'import numpy as np\n'), ((1161, 1177), 'numpy.zeros_like', 'np.zeros_like', (['A'],...
import pandas as pd import numpy as np from statsmodels.formula.api import ols import plotly_express import plotly.graph_objs as go from plotly.subplots import make_subplots # Read in data batter_data = pd.read_csv("~/Desktop/MLB_FA/Data/fg_bat_data.csv") del batter_data['Age'] print(len(batter_data)) print(batter_dat...
[ "numpy.log", "pandas.read_csv", "plotly.graph_objs.Scatter", "pandas.merge", "numpy.isnan", "numpy.where", "statsmodels.formula.api.ols", "plotly_express.scatter", "plotly.subplots.make_subplots", "plotly_express.bar", "pandas.to_numeric", "plotly.graph_objs.Bar" ]
[((204, 256), 'pandas.read_csv', 'pd.read_csv', (['"""~/Desktop/MLB_FA/Data/fg_bat_data.csv"""'], {}), "('~/Desktop/MLB_FA/Data/fg_bat_data.csv')\n", (215, 256), True, 'import pandas as pd\n'), ((346, 400), 'pandas.read_csv', 'pd.read_csv', (['"""~/Desktop/MLB_FA/Data/fg_pitch_data.csv"""'], {}), "('~/Desktop/MLB_FA/Da...
import wx import numpy as np import time from wx import glcanvas from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.arrays import vbo from OpenGL.GL import shaders from readobj import Obj3D __author__ = '<NAME>' __version__ = '0.1.0' vertexShader = """ #version 120 void main() { gl_Posit...
[ "wx.Menu", "readobj.Obj3D", "OpenGL.GL.shaders.glUseProgram", "wx.glcanvas.GLContext", "wx.StaticText", "numpy.array", "OpenGL.GL.shaders.compileProgram", "OpenGL.GL.shaders.compileShader", "wx.MenuBar" ]
[((1079, 1103), 'wx.glcanvas.GLContext', 'glcanvas.GLContext', (['self'], {}), '(self)\n', (1097, 1103), False, 'from wx import glcanvas\n'), ((3450, 3503), 'OpenGL.GL.shaders.compileShader', 'shaders.compileShader', (['vertexShader', 'GL_VERTEX_SHADER'], {}), '(vertexShader, GL_VERTEX_SHADER)\n', (3471, 3503), False, ...
from glob import glob from os import path import pytest import audiofile as af import numpy as np import audresample def set_ones(signal, channels): signal[channels, :] = 1 return signal def mixdown(signal): return np.atleast_2d(np.mean(signal, axis=0)) @pytest.mark.parametrize( 'signal, channel...
[ "audresample.am_fm_synth", "audresample.remix", "numpy.zeros", "numpy.ones", "numpy.mean", "numpy.testing.assert_equal", "pytest.mark.xfail" ]
[((7552, 7639), 'audresample.remix', 'audresample.remix', (['signal', 'channels', 'mixdown'], {'upmix': 'upmix', 'always_copy': 'always_copy'}), '(signal, channels, mixdown, upmix=upmix, always_copy=\n always_copy)\n', (7569, 7639), False, 'import audresample\n'), ((7686, 7725), 'numpy.testing.assert_equal', 'np.tes...
import requests import json import base64 import numpy as np import matplotlib.pyplot as plt import pickle import imageio def get_jsonstr(url): url = "http://172.16.58.3:8089/api/problem?stuid=031804104" response = requests.get(url) jsonstr = json.loads(response.text) return jsonstr def ...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "json.loads", "matplotlib.pyplot.imshow", "imageio.imread", "base64.b64decode", "pickle.load", "numpy.array", "requests.get" ]
[((234, 251), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (246, 251), False, 'import requests\n'), ((267, 292), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (277, 292), False, 'import json\n'), ((1137, 1158), 'pickle.load', 'pickle.load', (['pkl_file'], {}), '(pkl_file)\n', (1...
import numpy as np import argparse import imutils import cv2 ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", required = True, help = "Path to the image") ap.add_argument("-i2", "--image2", required = True, help = "Path to the image 2") ap.add_argument("-i3", "--image3", required = True, help = "Path to...
[ "argparse.ArgumentParser", "cv2.bitwise_and", "numpy.ones", "cv2.warpAffine", "cv2.rectangle", "imutils.translate", "imutils.resize", "cv2.imshow", "cv2.getRotationMatrix2D", "cv2.subtract", "cv2.cvtColor", "cv2.split", "cv2.destroyAllWindows", "cv2.resize", "cv2.circle", "cv2.bitwise_...
[((67, 92), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (90, 92), False, 'import argparse\n'), ((373, 398), 'cv2.imread', 'cv2.imread', (["args['image']"], {}), "(args['image'])\n", (383, 398), False, 'import cv2\n'), ((419, 448), 'cv2.imshow', 'cv2.imshow', (['"""Original"""', 'image'], {})...
import pytest import mxnet as mx import numpy as np from mxfusion.components.variables.runtime_variable import add_sample_dimension, is_sampled_array, get_num_samples from mxfusion.components.distributions import Gamma, GammaMeanVariance from mxfusion.util.testutils import numpy_array_reshape from mxfusion.util.testuti...
[ "numpy.random.uniform", "mxfusion.components.distributions.GammaMeanVariance.define_variable", "mxfusion.components.distributions.Gamma.define_variable", "mxfusion.components.variables.runtime_variable.is_sampled_array", "mxnet.random.seed", "numpy.random.rand", "scipy.stats.gamma.logpdf", "mxfusion.c...
[((358, 393), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""set_seed"""'], {}), "('set_seed')\n", (381, 393), False, 'import pytest\n'), ((1760, 1808), 'mxfusion.util.testutils.numpy_array_reshape', 'numpy_array_reshape', (['mean', 'mean_isSamples', 'n_dim'], {}), '(mean, mean_isSamples, n_dim)\n', (1779,...
""" Segmenting real-world sounds correctly with synthetic sounds ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It's easy to figure out if a sound is being correcly segmented if the signal at hand is well defined, and repeatable, like in many technological/ engineering applications. However, in bioacoust...
[ "itsfm.view_horseshoebat_call.visualise_call", "numpy.abs", "itsfm.simulate_calls.make_cffm_call", "itsfm.simulate_calls.silence", "scipy.signal.tukey", "itsfm.signal_processing.rms", "itsfm.simulate_calls.make_fm_chirp", "numpy.around", "itsfm.simulate_calls.make_tone", "numpy.random.normal", "...
[((2172, 2202), 'itsfm.simulate_calls.make_cffm_call', 'make_cffm_call', (['call_props', 'fs'], {}), '(call_props, fs)\n', (2186, 2202), False, 'from itsfm.simulate_calls import make_cffm_call, make_tone, make_fm_chirp, silence\n'), ((2216, 2249), 'scipy.signal.tukey', 'signal.tukey', (['cffm_call.size', '(0.1)'], {}),...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Dec 17 15:24:18 2020 @author: dhulls """ from anastruct import SystemElements import numpy as np class TrussModel: def HF(self, young1=None, young2=None, area1=None, area2=None, P1=None, P2=None, P3=None, P4=None, P5=None, P6=None): ...
[ "numpy.array", "anastruct.SystemElements", "numpy.sum" ]
[((333, 349), 'anastruct.SystemElements', 'SystemElements', ([], {}), '()\n', (347, 349), False, 'from anastruct import SystemElements\n'), ((2828, 2839), 'numpy.array', 'np.array', (['K'], {}), '(K)\n', (2836, 2839), True, 'import numpy as np\n'), ((2989, 3005), 'anastruct.SystemElements', 'SystemElements', ([], {}), ...
import numpy as np import pandas as pd from sklearn import datasets from sklearn.model_selection import train_test_split test_size = 0.25 def sampling(**kwargs): if kwargs['dataset'] == 'moons': X, y = datasets.make_moons(n_samples=kwargs['sample_size'], noise=kwargs['n...
[ "sklearn.datasets.make_circles", "sklearn.datasets.make_classification", "numpy.random.RandomState", "sklearn.datasets.make_moons" ]
[((217, 312), 'sklearn.datasets.make_moons', 'datasets.make_moons', ([], {'n_samples': "kwargs['sample_size']", 'noise': "kwargs['noise']", 'random_state': '(5)'}), "(n_samples=kwargs['sample_size'], noise=kwargs['noise'],\n random_state=5)\n", (236, 312), False, 'from sklearn import datasets\n'), ((636, 746), 'skle...
import numpy as np def get_predecessor(T,P): # copy the inputs T = np.copy(T) P = np.copy(P) P_size = P.shape[0] T_size = T.shape[0] adj = np.zeros((P_size + T_size,P_size + T_size)) # predecessor for Text for i in range(1,T_size): adj[i, i-1] = 1 # predecessor for Pattern for i in range(...
[ "numpy.eye", "numpy.zeros", "numpy.copy" ]
[((72, 82), 'numpy.copy', 'np.copy', (['T'], {}), '(T)\n', (79, 82), True, 'import numpy as np\n'), ((89, 99), 'numpy.copy', 'np.copy', (['P'], {}), '(P)\n', (96, 99), True, 'import numpy as np\n'), ((154, 198), 'numpy.zeros', 'np.zeros', (['(P_size + T_size, P_size + T_size)'], {}), '((P_size + T_size, P_size + T_size...
from __future__ import absolute_import, print_function import os import numpy as np from subprocess import Popen, PIPE from Bio.PDB.Polypeptide import aa1 as AA_STANDARD from ....featuresComputer import FeatureComputerException from ...seqToolManager import SeqToolManager from .al2coWorkers.parsePsiBlast import parseP...
[ "subprocess.Popen", "os.path.basename", "numpy.std", "os.path.isfile", "numpy.mean", "utils.tryToRemove", "os.path.join", "utils.myMakeDir" ]
[((1043, 1088), 'utils.myMakeDir', 'myMakeDir', (['self.computedFeatsRootDir', '"""al2co"""'], {}), "(self.computedFeatsRootDir, 'al2co')\n", (1052, 1088), False, 'from utils import myMakeDir, tryToRemove\n'), ((1654, 1715), 'os.path.join', 'os.path.join', (['self.al2coOutPath', "(prefixExtended + '.al2co.gz')"], {}), ...
import os import numpy as np import cv2 from glob import glob import tensorflow as tf from sklearn.model_selection import train_test_split def load_data(path, split=0.1): images = sorted(glob(os.path.join(path, "images/*"))) masks = sorted(glob(os.path.join(path, "masks/*"))) total_size = len(images) ...
[ "sklearn.model_selection.train_test_split", "numpy.expand_dims", "tensorflow.data.Dataset.from_tensor_slices", "cv2.imread", "tensorflow.numpy_function", "os.path.join", "cv2.resize" ]
[((422, 485), 'sklearn.model_selection.train_test_split', 'train_test_split', (['images'], {'test_size': 'valid_size', 'random_state': '(42)'}), '(images, test_size=valid_size, random_state=42)\n', (438, 485), False, 'from sklearn.model_selection import train_test_split\n'), ((509, 571), 'sklearn.model_selection.train_...
# -*- coding: utf-8 -*- import numpy as np from scipy.integrate import quad from pmutt import _ModelBase from pmutt import constants as c from pmutt.io.json import remove_class class HarmonicVib(_ModelBase): """Vibrational modes using the harmonic approximation. Equations used sourced from: - <NAME...
[ "numpy.sinh", "numpy.sum", "pmutt.constants.wavenumber_to_temp", "scipy.integrate.quad", "numpy.log", "pmutt.constants.h", "pmutt.io.json.remove_class", "numpy.array", "numpy.exp", "pmutt.constants.R", "numpy.dot", "pmutt.constants.kb", "numpy.prod", "pmutt.constants.wavenumber_to_inertia"...
[((34120, 34145), 'numpy.array', 'np.array', (['wavenumbers_out'], {}), '(wavenumbers_out)\n', (34128, 34145), True, 'import numpy as np\n'), ((950, 975), 'numpy.array', 'np.array', (['vib_wavenumbers'], {}), '(vib_wavenumbers)\n', (958, 975), True, 'import numpy as np\n'), ((1332, 1381), 'pmutt.constants.wavenumber_to...
import os import torch import random import librosa import torchaudio import numpy as np from glob import glob import nlpaug.flow as naf import nlpaug.augmenter.audio as naa import nlpaug.augmenter.spectrogram as nas from torchvision.transforms import Normalize from torch.utils.data import Dataset from nlpaug.augmente...
[ "torch.randn_like", "numpy.zeros", "librosa.feature.melspectrogram", "src.datasets.librispeech.SpectrumAugmentation", "librosa.power_to_db", "random.getrandbits", "torchaudio.load", "torchvision.transforms.Normalize", "os.path.join", "src.datasets.librispeech.WavformAugmentation", "torch.from_nu...
[((2416, 2449), 'os.path.join', 'os.path.join', (['self.root', 'wav_name'], {}), '(self.root, wav_name)\n', (2428, 2449), False, 'import os\n'), ((2482, 2507), 'torchaudio.load', 'torchaudio.load', (['wav_path'], {}), '(wav_path)\n', (2497, 2507), False, 'import torchaudio\n'), ((3222, 3347), 'librosa.feature.melspectr...
import numpy as np from numpy import exp, sqrt from functools import partial from scipy import optimize from scipy.stats import norm import scipy.integrate as integrate from fox_toolbox.utils import rates """This module price swaption under Hull White model using Jamshidian method. Usage example: from hw import Jams...
[ "functools.partial", "numpy.negative", "scipy.stats.norm.pdf", "numpy.array", "numpy.exp", "numpy.sign", "scipy.optimize.bisect", "numpy.sqrt" ]
[((3058, 3069), 'numpy.array', 'np.array', (['c'], {}), '(c)\n', (3066, 3069), True, 'import numpy as np\n'), ((4178, 4189), 'numpy.array', 'np.array', (['b'], {}), '(b)\n', (4186, 4189), True, 'import numpy as np\n'), ((4468, 4504), 'functools.partial', 'partial', (['swap_value', 'coef', 'b_i', 'varx'], {}), '(swap_va...
from typing import Optional, List import torch import torchvision import numpy as np from ..basic_typing import Datasets from ..train import SequenceArray from ..train import SamplerRandom, SamplerSequential import functools import collections import os from ..transforms import Transform from typing_extensions import...
[ "functools.partial", "torch.cat", "torchvision.datasets.cityscapes.Cityscapes", "os.environ.get", "numpy.array", "collections.OrderedDict", "os.path.join" ]
[((2469, 2501), 'os.path.join', 'os.path.join', (['root', '"""cityscapes"""'], {}), "(root, 'cityscapes')\n", (2481, 2501), False, 'import os\n'), ((2522, 2638), 'torchvision.datasets.cityscapes.Cityscapes', 'torchvision.datasets.cityscapes.Cityscapes', (['cityscapes_path'], {'mode': '"""fine"""', 'split': '"""train"""...
""" This file contains code that will kick off training and testing processes """ import os, sys import argparse import json import numpy as np from experiments.UNetExperiment import UNetExperiment from data_prep.HippocampusDatasetLoader import LoadHippocampusData from torch.utils.data import random_split class Config...
[ "experiments.UNetExperiment.UNetExperiment", "data_prep.HippocampusDatasetLoader.LoadHippocampusData", "json.dump", "argparse.ArgumentParser", "numpy.floor", "torch.utils.data.random_split", "os.path.join", "sys.exit" ]
[((1293, 1318), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1316, 1318), False, 'import argparse\n'), ((2445, 2541), 'data_prep.HippocampusDatasetLoader.LoadHippocampusData', 'LoadHippocampusData', (["(c.root_dir + 'TrainingSet/')"], {'y_shape': 'c.patch_size', 'z_shape': 'c.patch_size'}), ...
import os import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import tensorflow.keras.backend as K from models import load_model, load_adfmodel import instances # GENERAL PARAMETERS MODE = 'joint_untargeted' IMG_SHAPE = [28, 28] # LOAD MODEL model = load_model() generator = instances.load_gen...
[ "instances.load_generator", "os.makedirs", "tensorflow.convert_to_tensor", "tensorflow.reshape", "tensorflow.Session", "tensorflow.constant", "tensorflow.keras.backend.function", "models.load_model", "tensorflow.keras.backend.gradients", "numpy.argpartition", "numpy.max", "numpy.reshape", "n...
[((276, 288), 'models.load_model', 'load_model', ([], {}), '()\n', (286, 288), False, 'from models import load_model, load_adfmodel\n'), ((302, 328), 'instances.load_generator', 'instances.load_generator', ([], {}), '()\n', (326, 328), False, 'import instances\n'), ((559, 597), 'os.path.join', 'os.path.join', (['"""res...
from abc import ABC, abstractmethod import gym import numpy as np from minerl.herobraine.hero import AgentHandler from minerl.herobraine.hero import KEYMAP from minerl.herobraine.hero import spaces from minerl.herobraine.hero.spaces import DiscreteRange class CommandAction(AgentHandler): """ An action handl...
[ "numpy.sum", "minerl.herobraine.hero.spaces.DiscreteRange", "numpy.array", "minerl.herobraine.hero.spaces.Box", "minerl.herobraine.hero.spaces.Enum", "minerl.herobraine.hero.spaces.Discrete" ]
[((2307, 2355), 'minerl.herobraine.hero.spaces.Enum', 'spaces.Enum', (['*self._items'], {'default': 'self._default'}), '(*self._items, default=self._default)\n', (2318, 2355), False, 'from minerl.herobraine.hero import spaces\n'), ((9995, 10054), 'minerl.herobraine.hero.spaces.Box', 'spaces.Box', ([], {'low': '(-180)',...
#!/usr/bin/env python import fmm3dpy as fmm import numpy as np # # This is a sample code to demonstrate how to use # the fmm libraries # # sample with one density, sources to sources, # charge interactions, and potential only # n = 200000 nd = 1 sources = np.random.uniform(0,1,(3,n)) eps = 10**(-5) charges = np....
[ "numpy.random.uniform", "fmm3dpy.lfmm3d" ]
[((262, 293), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', '(3, n)'], {}), '(0, 1, (3, n))\n', (279, 293), True, 'import numpy as np\n'), ((317, 343), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', 'n'], {}), '(0, 1, n)\n', (334, 343), True, 'import numpy as np\n'), ((349, 408), 'fmm3dpy.l...
#!/usr/bin/env python # Copyright (c) 2017, DIANA-HEP # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list ...
[ "numpy.array_str", "numpy.empty", "uproot.interp.numerical._dimsprod", "numba.njit", "numpy.dtype", "numpy.floor_divide", "numpy.cumsum", "numpy.append", "numpy.array", "numpy.array_equal", "numpy.get_printoptions" ]
[((2202, 2225), 'numba.njit', 'numba.njit', (['_compactify'], {}), '(_compactify)\n', (2212, 2225), False, 'import numba\n'), ((17065, 17083), 'numpy.dtype', 'numpy.dtype', (['""">i4"""'], {}), "('>i4')\n", (17076, 17083), False, 'import numpy\n'), ((18846, 18864), 'numpy.dtype', 'numpy.dtype', (['""">i4"""'], {}), "('...
import numpy as np import torch import torch.nn.functional as F import dataset_creator as DC from torch import nn from torch import optim # import keras def createNN(_inputSize): input_size = _inputSize hidden_sizes = [15,10] # 12 nodes in first hidden layer output_size = 29 # Number of possible outputs ...
[ "dataset_creator.returnToArabicDictionary", "torch.nn.ReLU", "numpy.argmax", "torch.LongTensor", "torch.load", "torch.nn.CrossEntropyLoss", "torch.FloatTensor", "torch.nn.functional.softmax", "torch.max", "torch.nn.Linear" ]
[((737, 757), 'torch.FloatTensor', 'torch.FloatTensor', (['x'], {}), '(x)\n', (754, 757), False, 'import torch\n'), ((801, 820), 'torch.LongTensor', 'torch.LongTensor', (['x'], {}), '(x)\n', (817, 820), False, 'import torch\n'), ((1078, 1099), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (1097,...
# coding: utf-8 # In[1]: import nengo import nengo_spa as spa import numpy as np # In[2]: from matplotlib import pyplot as plt # In[3]: #create semantic pointers words = [ 'CAT', 'BLUE', 'RED'] colors = ['RED', 'BLUE'] fingers = ['INDEX', 'MIDDLE'] D = 16 #we reduced it from 32 cause of capacity of our com...
[ "nengo_spa.Vocabulary", "nengo_spa.State", "nengo_spa.Transcode", "nengo.Probe", "nengo_spa.Network", "nengo.Simulator", "nengo_spa.semantic_pointer.Zero", "nengo_spa.similarity", "nengo_spa.ActionSelection", "numpy.random.choice", "nengo_spa.dot", "nengo.Connection", "matplotlib.pyplot.subp...
[((335, 352), 'nengo_spa.Vocabulary', 'spa.Vocabulary', (['D'], {}), '(D)\n', (349, 352), True, 'import nengo_spa as spa\n'), ((626, 639), 'nengo_spa.Network', 'spa.Network', ([], {}), '()\n', (637, 639), True, 'import nengo_spa as spa\n'), ((2326, 2374), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'ncols': '(1...
import tensorflow as tf from attention import AttentionLayer from tensorflow.keras.models import load_model import numpy as np from tensorflow.keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from text_cleaner import text_cleaner,rareword_coverage import pickle tf.compat...
[ "text_cleaner.text_cleaner", "tensorflow.keras.preprocessing.text.Tokenizer", "tensorflow.keras.models.load_model", "numpy.argmax", "keras.preprocessing.sequence.pad_sequences", "numpy.zeros", "pickle.load", "tensorflow.compat.v1.logging.set_verbosity", "numpy.array", "text_cleaner.rareword_covera...
[((311, 373), 'tensorflow.compat.v1.logging.set_verbosity', 'tf.compat.v1.logging.set_verbosity', (['tf.compat.v1.logging.ERROR'], {}), '(tf.compat.v1.logging.ERROR)\n', (345, 373), True, 'import tensorflow as tf\n'), ((561, 577), 'numpy.zeros', 'np.zeros', (['(1, 1)'], {}), '((1, 1))\n', (569, 577), True, 'import nump...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Oct 6 20:17:09 2018 @author: tyler """ import numpy as np import sys #%% def karger(G,vertex_label,vertex_degree,size_V): size_V = len(vertex_label) #N = int(size_V*(1-1/np.sqrt(2))) iteration_schedule = [size_V-2] for N in ...
[ "numpy.copy", "numpy.savetxt", "numpy.zeros", "numpy.searchsorted", "numpy.nonzero", "numpy.cumsum", "numpy.min", "numpy.max", "numpy.arange", "numpy.where", "numpy.random.randint", "numpy.putmask" ]
[((2209, 2222), 'numpy.min', 'np.min', (['E_raw'], {}), '(E_raw)\n', (2215, 2222), True, 'import numpy as np\n'), ((2267, 2308), 'numpy.zeros', 'np.zeros', (['(size_V, size_V)'], {'dtype': '"""int64"""'}), "((size_V, size_V), dtype='int64')\n", (2275, 2308), True, 'import numpy as np\n'), ((2323, 2354), 'numpy.zeros', ...
#! /usr/bin/env python import rospy import actionlib import dynamic_reconfigure.client from riptide_msgs.msg import AttitudeCommand, LinearCommand, Imu from std_msgs.msg import Float32, Float64, Int32 import riptide_controllers.msg import time import math import numpy as np def angleDiff(a, b): return ((a-b+180...
[ "numpy.matrix", "rospy.Subscriber", "rospy.wait_for_message", "rospy.Publisher", "math.sin", "rospy.sleep", "rospy.loginfo", "rospy.is_shutdown", "actionlib.SimpleActionServer", "rospy.init_node", "math.cos", "numpy.dot", "rospy.spin" ]
[((3524, 3556), 'rospy.init_node', 'rospy.init_node', (['"""gate_maneuver"""'], {}), "('gate_maneuver')\n", (3539, 3556), False, 'import rospy\n'), ((3589, 3601), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (3599, 3601), False, 'import rospy\n'), ((473, 536), 'rospy.Publisher', 'rospy.Publisher', (['"""/command/roll"...
import sys, os sys.path.append(os.pardir) import numpy as np from dataset.mnist import load_mnist from PIL import Image def img_show(img): pil_img = Image.fromarray(np.uint8(img)) pil_img.show() (x_train, t_train), (x_test, t_test) = load_mnist(flatten=True, normalize = False) img = x_train[0] l...
[ "sys.path.append", "dataset.mnist.load_mnist", "numpy.uint8" ]
[((16, 42), 'sys.path.append', 'sys.path.append', (['os.pardir'], {}), '(os.pardir)\n', (31, 42), False, 'import sys, os\n'), ((254, 295), 'dataset.mnist.load_mnist', 'load_mnist', ([], {'flatten': '(True)', 'normalize': '(False)'}), '(flatten=True, normalize=False)\n', (264, 295), False, 'from dataset.mnist import loa...
import cv2 import numpy as np import math # Func to cal eucledian dist b/w 2 pts: def euc_dst(x1, y1, x2, y2): pt_a = (x1 - x2)**2 pt_b = (y1 - y2)**2 return math.sqrt(pt_a + pt_b) cap = cv2.VideoCapture(0) while(True): ret, frame = cap.read() gray = cv2.cvtColor(frame, cv2.CO...
[ "cv2.line", "cv2.HoughCircles", "cv2.circle", "math.sqrt", "cv2.medianBlur", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "cv2.VideoCapture", "numpy.around", "cv2.destroyAllWindows" ]
[((217, 236), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (233, 236), False, 'import cv2\n'), ((1899, 1922), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1920, 1922), False, 'import cv2\n'), ((183, 205), 'math.sqrt', 'math.sqrt', (['(pt_a + pt_b)'], {}), '(pt_a + pt_b)\n', (1...
#!/usr/local/bin/python # -*- coding: utf-8 -*- """ Created on : Mon Jun 4 23:17:56 2018 @author : Sourabh """ # %% import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.svm import SVR import matplotlib.pyplot as plt # ============================================...
[ "matplotlib.pyplot.title", "sklearn.svm.SVR", "numpy.set_printoptions", "sklearn.preprocessing.StandardScaler", "matplotlib.pyplot.show", "pandas.read_csv", "matplotlib.pyplot.scatter", "matplotlib.pyplot.legend", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((356, 393), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.nan'}), '(threshold=np.nan)\n', (375, 393), True, 'import numpy as np\n'), ((643, 665), 'pandas.read_csv', 'pd.read_csv', (['Data_File'], {}), '(Data_File)\n', (654, 665), True, 'import pandas as pd\n'), ((864, 880), 'sklearn.preproce...
# Imports modules import argparse import torch from torchvision import transforms,datasets,models from PIL import Image import numpy as np def get_input_args_train(): parser = argparse.ArgumentParser() parser.add_argument('--data_dir', type = str, default = 'flowers', help='data...
[ "argparse.ArgumentParser", "torch.utils.data.DataLoader", "torchvision.transforms.RandomHorizontalFlip", "torchvision.transforms.RandomRotation", "torchvision.transforms.Normalize", "numpy.transpose", "PIL.Image.open", "torchvision.datasets.ImageFolder", "numpy.array", "torchvision.transforms.Cent...
[((188, 213), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (211, 213), False, 'import argparse\n'), ((1301, 1326), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1324, 1326), False, 'import argparse\n'), ((3097, 3156), 'torchvision.datasets.ImageFolder', 'datasets.Im...
""" Fits PSPL model with parallax using EMCEE sampler. """ import os import sys import numpy as np try: import emcee except ImportError as err: print(err) print("\nEMCEE could not be imported.") print("Get it from: http://dfm.io/emcee/current/user/install/") print("and re-run the script") sys.e...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "MulensModel.MulensData", "MulensModel.Model", "matplotlib.pyplot.show", "numpy.random.randn", "emcee.EnsembleSampler", "matplotlib.pyplot.legend", "numpy.isfinite", "numpy.isnan", "numpy.percentile", "matplotlib.pyplot.figure", "sys.exit"...
[((1306, 1396), 'os.path.join', 'os.path.join', (['mm.DATA_PATH', '"""photometry_files"""', '"""OB05086"""', '"""starBLG234.6.I.218982.dat"""'], {}), "(mm.DATA_PATH, 'photometry_files', 'OB05086',\n 'starBLG234.6.I.218982.dat')\n", (1318, 1396), False, 'import os\n'), ((1412, 1464), 'MulensModel.MulensData', 'mm.Mul...
import numpy as np import cv2 import heapq import statistics import math def get_norm(t1 , t2): (xa, ya, za) = t1 (xb, yb, zb) = t2 return math.sqrt((xa-xb)^2 + (ya-yb)^2 + (za-zb)^2) def popularity(image,k): (m,n,_) = image.shape d = {} for i in range(m): for j in range(n): ...
[ "math.sqrt", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.imwrite", "numpy.asarray", "heapq.nlargest", "cv2.imread", "cv2.imshow" ]
[((1057, 1080), 'cv2.imread', 'cv2.imread', (['"""test1.png"""'], {}), "('test1.png')\n", (1067, 1080), False, 'import cv2\n'), ((1121, 1160), 'cv2.imshow', 'cv2.imshow', (['"""Popularity Cut image"""', 'img'], {}), "('Popularity Cut image', img)\n", (1131, 1160), False, 'import cv2\n'), ((1160, 1173), 'cv2.waitKey', '...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import numpy as np import os import tensorflow as tf import zipfile as zp import subprocess import glob import json from PIL import Image from collections import OrderedDict import shutil import ...
[ "csv.reader", "argparse.ArgumentParser", "numpy.empty", "os.walk", "numpy.shape", "sys.stdout.flush", "glob.glob", "os.path.join", "os.path.abspath", "os.path.dirname", "numpy.transpose", "os.path.exists", "json.dump", "os.chmod", "os.stat", "os.path.basename", "subprocess.call", "...
[((532, 550), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (548, 550), False, 'import sys\n'), ((697, 744), 'os.path.join', 'os.path.join', (['snpe_root', '"""benchmarks"""', 'dlc_path'], {}), "(snpe_root, 'benchmarks', dlc_path)\n", (709, 744), False, 'import os\n'), ((1193, 1213), 'subprocess.call', 'sub...
#!/usr/bin/env python """ Southern California Earthquake Center Broadband Platform Copyright 2010-2016 Southern California Earthquake Center """ from __future__ import division, print_function # Import Python modules import os import sys import shutil import matplotlib as mpl mpl.use('AGG', warn=False) import pylab im...
[ "pylab.close", "numpy.sin", "pylab.gcf", "os.path.join", "os.chdir", "pylab.title", "numpy.power", "pylab.ylabel", "pylab.xlabel", "bband_utils.mkdirs", "numpy.log10", "pylab.legend", "os.path.basename", "pylab.grid", "pylab.xscale", "pylab.savefig", "matplotlib.use", "install_cfg....
[((278, 304), 'matplotlib.use', 'mpl.use', (['"""AGG"""'], {'warn': '(False)'}), "('AGG', warn=False)\n", (285, 304), True, 'import matplotlib as mpl\n'), ((13765, 13810), 'pylab.title', 'pylab.title', (["('Station: %s' % station)"], {'size': '(12)'}), "('Station: %s' % station, size=12)\n", (13776, 13810), False, 'imp...
import pytest import numpy as np import zmq import h5py import struct import itertools from .. import Writer from .. import chunk_api from ...messages import array as array_api from .conftest import assert_chunk_allclose, assert_h5py_allclose from zeeko.conftest import assert_canrecv from ...tests.test_helpers import ...
[ "zeeko.conftest.assert_canrecv", "h5py.File", "pytest.mark.usefixtures", "numpy.random.randn" ]
[((1220, 1254), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""rnotify"""'], {}), "('rnotify')\n", (1243, 1254), False, 'import pytest\n'), ((2517, 2539), 'zeeko.conftest.assert_canrecv', 'assert_canrecv', (['socket'], {}), '(socket)\n', (2531, 2539), False, 'from zeeko.conftest import assert_canrecv\n'), ...
from __future__ import print_function, division, absolute_import import pickle import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np import pickle def visualize_vertices(vertices:np.ndarray, bones:np.ndarray = None): fig = plt.figure() ax = Axes3D(fig) ax.scatter(vertic...
[ "matplotlib.pyplot.show", "mpl_toolkits.mplot3d.Axes3D", "numpy.expand_dims", "matplotlib.pyplot.figure", "pickle.load", "numpy.linalg.inv", "numpy.vstack" ]
[((265, 277), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (275, 277), True, 'import matplotlib.pyplot as plt\n'), ((287, 298), 'mpl_toolkits.mplot3d.Axes3D', 'Axes3D', (['fig'], {}), '(fig)\n', (293, 298), False, 'from mpl_toolkits.mplot3d import Axes3D\n'), ((824, 834), 'matplotlib.pyplot.show', 'plt.s...
""" ====================== Comparing CCA Variants ====================== A comparison of Kernel Canonical Correlation Analysis (KCCA) with three different types of kernel to Deep Canonical Correlation Analysis (DCCA). Each learns and computes kernels suitable for different situations. The point of this tutorial is to ...
[ "mvlearn.embed.KCCA", "mvlearn.embed.DCCA", "mvlearn.datasets.GaussianMixture", "numpy.eye", "matplotlib.pyplot.subplots", "seaborn.set_context" ]
[((1558, 1606), 'mvlearn.datasets.GaussianMixture', 'GaussianMixture', (['n_samples', 'centers', 'covariances'], {}), '(n_samples, centers, covariances)\n', (1573, 1606), False, 'from mvlearn.datasets import GaussianMixture\n'), ((1625, 1673), 'mvlearn.datasets.GaussianMixture', 'GaussianMixture', (['n_samples', 'cente...
"""Training GCMC model on the MovieLens data set. The script loads the full graph to the training device. """ import os, time import argparse import logging import random import string import dgl import scipy.sparse as sp import pandas as pd import numpy as np import torch as th import torch.nn as nn import torch.nn.f...
[ "numpy.random.seed", "argparse.ArgumentParser", "random.sample", "utils.get_activation", "numpy.argsort", "numpy.argpartition", "numpy.random.randint", "numpy.mean", "utils.to_etype_name", "numpy.arange", "torch.device", "model.MLPDecoder", "os.path.join", "numpy.zeros_like", "torch.Floa...
[((2008, 2037), 'numpy.ones_like', 'np.ones_like', (['rating_pairs[0]'], {}), '(rating_pairs[0])\n', (2020, 2037), True, 'import numpy as np\n'), ((2067, 2154), 'scipy.sparse.coo_matrix', 'sp.coo_matrix', (['(ones, rating_pairs)'], {'shape': '(num_user, num_movie)', 'dtype': 'np.float32'}), '((ones, rating_pairs), shap...
# Copyright 2020 Stanford University, Los Alamos National Laboratory # # 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 ...
[ "flexflow.keras.datasets.cifar10.load_data", "flexflow.keras.models.Model", "flexflow.keras.layers.Dense", "flexflow.keras.callbacks.VerifyMetrics", "flexflow.keras.layers.MaxPooling2D", "numpy.zeros", "flexflow.keras.layers.Input", "flexflow.keras.layers.Flatten", "gc.collect", "flexflow.keras.la...
[((1277, 1307), 'flexflow.keras.datasets.cifar10.load_data', 'cifar10.load_data', (['num_samples'], {}), '(num_samples)\n', (1294, 1307), False, 'from flexflow.keras.datasets import cifar10\n'), ((1327, 1381), 'numpy.zeros', 'np.zeros', (['(num_samples, 3, 229, 229)'], {'dtype': 'np.float32'}), '((num_samples, 3, 229, ...
import numpy as np import sys from collections import Counter class CFeval(object): """Classification evaluator class""" def __init__(self, metrics, reshapeDims, classes): """ # Arguments metrics: dictionary of metrics to be evaluated, currently supports only classification accuracy reshapeDims: list of th...
[ "numpy.divide", "numpy.nansum", "numpy.minimum", "numpy.maximum", "numpy.sum", "numpy.argmax", "numpy.zeros", "numpy.expand_dims", "numpy.equal", "numpy.cumsum", "numpy.mean", "numpy.array", "collections.Counter" ]
[((7449, 7465), 'numpy.array', 'np.array', (['boxes1'], {}), '(boxes1)\n', (7457, 7465), True, 'import numpy as np\n'), ((7476, 7492), 'numpy.array', 'np.array', (['boxes2'], {}), '(boxes2)\n', (7484, 7492), True, 'import numpy as np\n'), ((8460, 8520), 'numpy.maximum', 'np.maximum', (['boxes1[:, [xmin, ymin]]', 'boxes...
# coding: utf-8 # In[ ]: import cv2 from keras.models import load_model import numpy as np from collections import deque from keras.preprocessing import image import keras import os # In[ ]: model1 = load_model('mob_logo_model.h5') val = ['Adidas','Apple','BMW','Citroen','Fedex','HP','Mcdonalds','Nike','none'...
[ "keras.models.load_model", "cv2.GaussianBlur", "cv2.bitwise_and", "cv2.medianBlur", "numpy.ones", "keras.preprocessing.image.img_to_array", "cv2.rectangle", "cv2.erode", "cv2.imshow", "cv2.inRange", "collections.deque", "cv2.line", "cv2.contourArea", "cv2.dilate", "cv2.cvtColor", "cv2....
[((210, 241), 'keras.models.load_model', 'load_model', (['"""mob_logo_model.h5"""'], {}), "('mob_logo_model.h5')\n", (220, 241), False, 'from keras.models import load_model\n'), ((399, 418), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (415, 418), False, 'import cv2\n'), ((419, 447), 'cv2.namedWindow...
from itertools import permutations import numpy as np import pytest from pyomeca import Angles, Rototrans, Markers SEQ = ( ["".join(p) for i in range(1, 4) for p in permutations("xyz", i)] + ["zyzz"] + ["zxz"] ) SEQ = [s for s in SEQ if s not in ["yxz"]] EPSILON = 1e-12 ANGLES = Angles(np.random.rand(4, ...
[ "pyomeca.Markers.from_random_data", "numpy.eye", "pyomeca.Angles.from_rototrans", "numpy.testing.assert_array_equal", "itertools.permutations", "pyomeca.Rototrans.from_euler_angles", "numpy.zeros", "pyomeca.Rototrans.from_averaged_rototrans", "pytest.raises", "pyomeca.Angles.from_random_data", "...
[((332, 367), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""seq"""', 'SEQ'], {}), "('seq', SEQ)\n", (355, 367), False, 'import pytest\n'), ((302, 327), 'numpy.random.rand', 'np.random.rand', (['(4)', '(1)', '(100)'], {}), '(4, 1, 100)\n', (316, 327), True, 'import numpy as np\n'), ((566, 636), 'pyomeca.Ro...
# # This file is part of CasADi. # # CasADi -- A symbolic framework for dynamic optimization. # Copyright (C) 2010-2014 <NAME>, <NAME>, <NAME>, # <NAME>. All rights reserved. # Copyright (C) 2011-2014 <NAME> # # CasADi is free software; you can redistribute it and/or # ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "os.path.abspath", "numpy.meshgrid", "matplotlib.pyplot.show", "matplotlib.pyplot.clabel", "numpy.linspace", "matplotlib.pyplot.grid" ]
[((4203, 4245), 'numpy.linspace', 'numpy.linspace', (['(-pi / 4)', '(pi / 4)', 'ngrid_phi'], {}), '(-pi / 4, pi / 4, ngrid_phi)\n', (4217, 4245), False, 'import numpy\n'), ((4250, 4293), 'numpy.linspace', 'numpy.linspace', (['(-pi / 4)', '(pi / 4)', 'ngrid_beta'], {}), '(-pi / 4, pi / 4, ngrid_beta)\n', (4264, 4293), F...
import tensorflow as tf import numpy as np import os import time import argparse import imageio parser = argparse.ArgumentParser() parser.add_argument("--training", type=int, default=1, help="training or testing") parser.add_argument("--testdir", type=str, default=None, help="specify log file dir") parser.add_argument...
[ "os.mkdir", "argparse.ArgumentParser", "tensorflow.reshape", "tensorflow.get_variable_scope", "numpy.shape", "tensorflow.matmul", "tensorflow.nn.conv2d", "tensorflow.nn.softmax", "tensorflow.nn.softmax_cross_entropy_with_logits", "os.path.exists", "tensorflow.placeholder", "tensorflow.cast", ...
[((106, 131), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (129, 131), False, 'import argparse\n'), ((2063, 2129), 'os.system', 'os.system', (["('cp %s %s/%s' % (args.runfile, test_path, args.runfile))"], {}), "('cp %s %s/%s' % (args.runfile, test_path, args.runfile))\n", (2072, 2129), False,...
#======================================================================================================================= # an example file on how to build special test/training cubes using nh3_testcube.py #================================================================================================================...
[ "numpy.abs", "nh3_testcubes.generate_gradients", "nh3_testcubes.generate_parameters", "numpy.zeros", "numpy.ones", "numpy.array", "numpy.linspace", "numpy.column_stack", "nh3_testcubes.make_and_write" ]
[((1611, 1661), 'nh3_testcubes.generate_parameters', 'testcubes.generate_parameters', (['nCubes', 'random_seed'], {}), '(nCubes, random_seed)\n', (1640, 1661), True, 'import nh3_testcubes as testcubes\n'), ((1681, 1730), 'nh3_testcubes.generate_gradients', 'testcubes.generate_gradients', (['nCubes', 'random_seed'], {})...
# Copyright 2021 Sony Group Corporation. # # 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 ...
[ "nnabla.logger.log", "tqdm.tqdm", "csv.reader", "csv.writer", "argparse.ArgumentParser", "sklearn.manifold.TSNE", "nnabla.utils.data_iterator.data_iterator_csv_dataset", "numpy.array" ]
[((1028, 1065), 'nnabla.logger.log', 'logger.log', (['(99)', '"""Loading variable..."""'], {}), "(99, 'Loading variable...')\n", (1038, 1065), False, 'from nnabla import logger\n'), ((1583, 1620), 'nnabla.logger.log', 'logger.log', (['(99)', '"""Processing t-SNE..."""'], {}), "(99, 'Processing t-SNE...')\n", (1593, 162...
from torch.utils.data import DataLoader, Subset from pathlib import Path import torch import torch.nn as nn import itertools as its import pandas as pd import numpy as np import json from rdkit import Chem, DataStructs from rdkit.Chem import AllChem import matplotlib.pyplot as plt from NeuralGraph.dataset import MolDa...
[ "numpy.random.seed", "pandas.read_csv", "torch.nn.init.uniform_", "pathlib.Path", "numpy.mean", "numpy.std", "torch.load", "itertools.product", "numpy.random.choice", "json.dump", "rdkit.Chem.AllChem.GetMorganFingerprintAsBitVect", "matplotlib.pyplot.ylim", "numpy.corrcoef", "numpy.asarray...
[((576, 601), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['smile'], {}), '(smile)\n', (594, 601), False, 'from rdkit import Chem, DataStructs\n'), ((620, 683), 'rdkit.Chem.AllChem.GetMorganFingerprintAsBitVect', 'Chem.AllChem.GetMorganFingerprintAsBitVect', (['mol', 'radius', 'fp_len'], {}), '(mol, radius, fp_l...
# File :all.py # Author :WJ # Function : # Time :2021/02/18 # Version : # Amend : import numpy as np import ConvexPolygon as cp import HierarchicalClustering as hc import ConPolyProcess as cs import LaplacianMatrice as lm import time from scipy.optimize import linear_sum_assignment im...
[ "LaplacianMatrice.corrlation", "HierarchicalClustering.HierarchicalClustering", "HierarchicalClustering.mergeClosePoints", "Visualization.VisualizeMatch", "TransformationMatrix.transformation", "ConPolyProcess.maxPoints", "ConPolyProcess.delete_linepoints", "LaplacianMatrice.resort_clouds", "Laplaci...
[((1201, 1212), 'time.time', 'time.time', ([], {}), '()\n', (1210, 1212), False, 'import time\n'), ((1310, 1371), 'numpy.loadtxt', 'np.loadtxt', (['"""..\\\\data\\\\Polyline_PCB02_500.txt"""'], {'delimiter': '""","""'}), "('..\\\\data\\\\Polyline_PCB02_500.txt', delimiter=',')\n", (1320, 1371), True, 'import numpy as n...
from matplotlib import mlab import matplotlib.pyplot as plt import numpy as np import colorednoise as cn from automutualinformation import sequential_mutual_information as smi from automutualinformation import fit_model beta = 0.5 # the exponent samples = 10000 # number of samples to generate y = cn.powerlaw_psd_gau...
[ "colorednoise.powerlaw_psd_gaussian", "automutualinformation.sequential_mutual_information", "numpy.max", "numpy.min", "numpy.arange", "automutualinformation.fit_model", "numpy.digitize" ]
[((301, 340), 'colorednoise.powerlaw_psd_gaussian', 'cn.powerlaw_psd_gaussian', (['beta', 'samples'], {}), '(beta, samples)\n', (325, 340), True, 'import colorednoise as cn\n'), ((441, 473), 'numpy.digitize', 'np.digitize', (['y', 'bins'], {'right': '(True)'}), '(y, bins, right=True)\n', (452, 473), True, 'import numpy...
import logging import sys import numpy as np from tensorflow.keras import backend as K from tensorflow.keras import layers from tensorflow.keras.layers import ( AveragePooling2D, BatchNormalization, Conv2D, MaxPooling2D, SeparableConv2D, ) from tensorflow.keras.models import Model sys.setrecursion...
[ "numpy.random.seed", "tensorflow.keras.layers.MaxPooling2D", "tensorflow.keras.layers.Reshape", "tensorflow.keras.layers.Dense", "tensorflow.keras.layers.Multiply", "sys.setrecursionlimit", "tensorflow.keras.layers.Flatten", "tensorflow.keras.layers.BatchNormalization", "tensorflow.keras.backend.exp...
[((304, 334), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(2 ** 20)'], {}), '(2 ** 20)\n', (325, 334), False, 'import sys\n'), ((335, 358), 'numpy.random.seed', 'np.random.seed', (['(2 ** 10)'], {}), '(2 ** 10)\n', (349, 358), True, 'import numpy as np\n'), ((949, 983), 'logging.debug', 'logging.debug', (['"""...
""" This script gather functions related to the SZ spectrum """ import numpy as np import astropy.units as u from astropy import constants as const from astropy.cosmology import Planck15 as cosmo #=================================================== #========== CMB intensity #========================================...
[ "numpy.array", "numpy.exp", "numpy.transpose", "numpy.sum" ]
[((11551, 11587), 'numpy.transpose', 'np.transpose', (['theta_ei', '(1, 0, 2, 3)'], {}), '(theta_ei, (1, 0, 2, 3))\n', (11563, 11587), True, 'import numpy as np\n'), ((4546, 8066), 'numpy.array', 'np.array', (['[[[-18.1317 + x * 0], [99.7038 + x * 0], [-60.7438 + x * 0], [1051.43 + x *\n 0], [-2867.34 + x * 0], [773...
# PhysiBoSS Tab import os from ipywidgets import Layout, Label, Text, Checkbox, Button, HBox, VBox, Box, \ FloatText, BoundedIntText, BoundedFloatText, HTMLMath, Dropdown, interactive, Output from collections import deque, Counter import xml.etree.ElementTree as ET import matplotlib.pyplot as plt from matplotlib.co...
[ "ipywidgets.interactive", "copy.deepcopy", "xml.etree.ElementTree.parse", "numpy.sum", "csv.reader", "scipy.io.loadmat", "collections.Counter", "numpy.zeros", "numpy.transpose", "ipywidgets.Box", "os.path.isfile", "matplotlib.pyplot.figure", "numpy.array", "ipywidgets.Label", "ipywidgets...
[((1211, 1238), 'os.path.isfile', 'os.path.isfile', (['config_file'], {}), '(config_file)\n', (1225, 1238), False, 'import os\n'), ((2007, 2169), 'ipywidgets.interactive', 'interactive', (['self.create_area_chart'], {'frame': '(0, max_frames)', 'percentage': '(0.0, 10.0)', 'total': '(False)', 'cell_line': 'self.cell_li...