code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import numpy as np import unittest from specklepy.io.filearchive import FileArchive from specklepy.core.alignment import FrameAlignment from specklepy.plotting.utils import imshow class TestAlignment(unittest.TestCase): def setUp(self): self.path = 'specklepy/tests/files/' self.files = FileArchi...
[ "specklepy.io.filearchive.FileArchive", "numpy.ones", "specklepy.core.alignment.FrameAlignment", "specklepy.plotting.utils.imshow", "unittest.main" ]
[((1171, 1186), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1184, 1186), False, 'import unittest\n'), ((570, 586), 'specklepy.core.alignment.FrameAlignment', 'FrameAlignment', ([], {}), '()\n', (584, 586), False, 'from specklepy.core.alignment import FrameAlignment\n'), ((688, 704), 'specklepy.core.alignment.F...
import numpy as np import featureflow as ff import zounds from torch import nn import torch from torch.autograd import Variable import argparse import glob import os from pytorch_wgan2 import \ BaseGenerator, BaseCritic, CriticLayer, GeneratorLayer, FinalGeneratorLayer from scipy.signal import resample, tukey from...
[ "numpy.hanning", "zounds.Milliseconds", "zounds.WassersteinGanTrainer", "numpy.fft.irfft", "zounds.FrequencyDimension", "torch.from_numpy", "torch.nn.BatchNorm1d", "zounds.AudioSamples", "zounds.AWeighting", "zounds.ArrayWithUnits", "zounds.PhatDrumLoops", "zounds.resampled", "featureflow.Pi...
[((440, 456), 'zounds.SR11025', 'zounds.SR11025', ([], {}), '()\n', (454, 456), False, 'import zounds\n'), ((469, 531), 'zounds.resampled', 'zounds.resampled', ([], {'resample_to': 'samplerate', 'store_resampled': '(True)'}), '(resample_to=samplerate, store_resampled=True)\n', (485, 531), False, 'import zounds\n'), ((1...
#!/usr/bin/env python from collections import defaultdict import numpy as np from nltk.corpus import reuters def analyze_data_distribution(cat2count): i = 1 most_frequent_words = sorted(cat2count.items(), key=lambda n: n[1]['train'], reverse=...
[ "reuters.load_data", "reuters.fileids", "reuters.words", "numpy.array", "collections.defaultdict" ]
[((690, 706), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (701, 706), False, 'from collections import defaultdict\n'), ((2361, 2378), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (2372, 2378), False, 'from collections import defaultdict\n'), ((2897, 2913), 'collections.d...
import numpy as np import sys import trisectEdge_171122 as tse import circumcenterSphTri_171123 as ccs import array_tool_171125 as art from scipy.spatial import Delaunay import freeBoundary_171112 as frb ''' v0.3 Nov. 29, 2017 - add Test_trisectTri() v0.2 Nov. 26, 2017 - use np.concatenate() instead of my own conc...
[ "circumcenterSphTri_171123.circumcenterSphTri", "numpy.array", "numpy.sum", "freeBoundary_171112.find_freeBoundary", "numpy.concatenate", "numpy.genfromtxt", "trisectEdge_171122.trisectEdge", "array_tool_171125.get_unique_rows", "scipy.spatial.Delaunay" ]
[((1056, 1092), 'numpy.concatenate', 'np.concatenate', (['(v1, v2, v3)'], {'axis': '(0)'}), '((v1, v2, v3), axis=0)\n', (1070, 1092), True, 'import numpy as np\n'), ((1169, 1201), 'circumcenterSphTri_171123.circumcenterSphTri', 'ccs.circumcenterSphTri', (['tris', 'xs'], {}), '(tris, xs)\n', (1191, 1201), True, 'import ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Create the data for the LSTM. """ import os import sys import argparse import numpy as np import h5py import itertools from collections import defaultdict class Indexer: def __init__(self, symbols = ["<blank>","<unk>","<s>","</s>"]): self.vocab = defaultdi...
[ "argparse.ArgumentParser", "h5py.File", "numpy.argsort", "numpy.array", "numpy.zeros", "collections.defaultdict", "numpy.random.permutation" ]
[((9598, 9703), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(description=__doc__, formatter_class=argparse.\n ArgumentDefaultsHelpFormatter)\n', (9621, 9703), False, 'import argparse\n'), ((311, 327), 'collectio...
"""functions related to sampling handful of functions here, related to sampling and checking whether you're sampling correctly, in order to avoid aliasing when doing something like strided convolution or using the pooling windows from plenoptic, you want to make sure you're sampling the image appropriately, in order ...
[ "numpy.ceil", "numpy.diff", "matplotlib.pyplot.close", "numpy.linspace", "numpy.matmul", "numpy.linalg.lstsq", "matplotlib.pyplot.subplots", "torch.linspace" ]
[((679, 705), 'torch.linspace', 'torch.linspace', (['(-5)', '(5)', '(101)'], {}), '(-5, 5, 101)\n', (693, 705), False, 'import torch\n'), ((4638, 4680), 'numpy.linalg.lstsq', 'np.linalg.lstsq', (['sampled', 'full'], {'rcond': 'None'}), '(sampled, full, rcond=None)\n', (4653, 4680), True, 'import numpy as np\n'), ((4700...
import numpy as np import matplotlib.pyplot as plt def displayData(X, example_width=None): """displays 2D data stored in X in a nice grid. It returns the figure handle h and the displayed array if requested.""" if X.ndim == 1: X = X.reshape(1, -1) # Set example_width automatically if ...
[ "matplotlib.pyplot.imshow", "numpy.ceil", "numpy.ones", "matplotlib.pyplot.axis", "matplotlib.pyplot.set_cmap", "matplotlib.pyplot.show" ]
[((429, 449), 'matplotlib.pyplot.set_cmap', 'plt.set_cmap', (['"""gray"""'], {}), "('gray')\n", (441, 449), True, 'import matplotlib.pyplot as plt\n'), ((1568, 1593), 'matplotlib.pyplot.imshow', 'plt.imshow', (['display_array'], {}), '(display_array)\n', (1578, 1593), True, 'import matplotlib.pyplot as plt\n'), ((1622,...
import os import json import time import torch import argparse import numpy as np from collections import OrderedDict, defaultdict import pickle from tensorboardX import SummaryWriter from convlab2.policy.mle.idea9.model_dialogue import dialogue_VAE, data_mask, loss_fn from convlab2.policy.mle.idea9.utils imp...
[ "collections.OrderedDict", "os.makedirs", "argparse.ArgumentParser", "torch.mean", "torch.stack", "os.path.join", "pickle.load", "numpy.exp", "torch.tensor", "torch.cuda.is_available", "collections.defaultdict", "convlab2.policy.mle.idea9.model_dialogue.dialogue_VAE", "convlab2.policy.mle.id...
[((395, 420), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (418, 420), False, 'import torch\n'), ((686, 699), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (697, 699), False, 'from collections import OrderedDict, defaultdict\n'), ((961, 978), 'convlab2.policy.mle.idea9.model_dia...
import itertools import numpy as np def jitter(data, depth): '''generates indices of the vertices for every possible mesh configuration for the given depth.''' return [a for a in itertools.product([0,1], repeat=len(data))] def mapVertices(vertices, all_indices, depths): '''given indices (l...
[ "numpy.array", "numpy.sqrt" ]
[((676, 733), 'numpy.sqrt', 'np.sqrt', (['(arr[:, 0] ** 2 + arr[:, 1] ** 2 + arr[:, 2] ** 2)'], {}), '(arr[:, 0] ** 2 + arr[:, 1] ** 2 + arr[:, 2] ** 2)\n', (683, 733), True, 'import numpy as np\n'), ((561, 598), 'numpy.array', 'np.array', (['[vtx[0], vtx[1], depths[i]]'], {}), '([vtx[0], vtx[1], depths[i]])\n', (569, ...
"""Tests for Octave magics extension.""" import codecs import unittest import sys from IPython.display import SVG from IPython.testing.globalipapp import get_ipython import numpy as np from oct2py.ipython import octavemagic from oct2py import Oct2PyError class OctaveMagicTest(unittest.TestCase): @classmethod ...
[ "IPython.testing.globalipapp.get_ipython", "codecs.getreader", "numpy.allclose" ]
[((660, 673), 'IPython.testing.globalipapp.get_ipython', 'get_ipython', ([], {}), '()\n', (671, 673), False, 'from IPython.testing.globalipapp import get_ipython\n'), ((1003, 1035), 'numpy.allclose', 'np.allclose', (['result', '[[2, 3, 4]]'], {}), '(result, [[2, 3, 4]])\n', (1014, 1035), True, 'import numpy as np\n'), ...
''' Author: <NAME> Description: Module to test the ODA algorithm and targeted landing. ''' from Camera import camera from Algorithms import create_samples as cs from Algorithms import discretize as disc from Algorithms import voronoi as voronoi from Algorithms import gap_detection as gd from process_frames import plot...
[ "matplotlib.pyplot.imshow", "matplotlib.pyplot.grid", "Camera.camera.Camera", "numpy.random.rand", "matplotlib.pyplot.colorbar", "time.sleep", "Algorithms.create_samples.createSamples", "matplotlib.pyplot.subplot", "Algorithms.discretize.depthCompletion", "matplotlib.pyplot.figure", "matplotlib....
[((2110, 2121), 'time.time', 'time.time', ([], {}), '()\n', (2119, 2121), False, 'import time\n'), ((2265, 2304), 'Algorithms.create_samples.createSamples', 'cs.createSamples', (['d_small', 'perc_samples'], {}), '(d_small, perc_samples)\n', (2281, 2304), True, 'from Algorithms import create_samples as cs\n'), ((2426, 2...
# -*- coding: utf-8 -*- """ Created on Sun Sep 23 20:32:25 2018 @author: robot """ import os,sys AbsolutePath = os.path.abspath(__file__) #将相对路径转换成绝对路径 SuperiorCatalogue = os.path.dirname(AbsolutePath) #相对路径的上级路径 BaseDir = os.path.dirname(SuperiorCatalogue) #在“SuperiorCatalogue”的基础上在脱掉一层路径,得到我们想...
[ "os.path.dirname", "constructMethod.instance.Instance", "numpy.zeros", "copy.deepcopy", "os.path.abspath", "sys.path.append" ]
[((114, 139), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (129, 139), False, 'import os, sys\n'), ((185, 214), 'os.path.dirname', 'os.path.dirname', (['AbsolutePath'], {}), '(AbsolutePath)\n', (200, 214), False, 'import os, sys\n'), ((239, 273), 'os.path.dirname', 'os.path.dirname', (['Sup...
import csv import logging from pathlib import Path from typing import Union import click import numpy as np from blender import Blender, Blend from blender.catalog import blend2cat, CATALOG_HEADER def save_img(blend: Blend, idx: int, prefix: str, outdir: Union[Path, str] = ".") -> None: np.save(f"{outdir}/{pref...
[ "logging.basicConfig", "logging.getLogger", "click.Choice", "blender.catalog.blend2cat", "click.option", "pathlib.Path.cwd", "blender.Blender", "csv.writer", "click.echo", "click.Path", "click.command", "numpy.save" ]
[((1596, 1620), 'click.command', 'click.command', (['"""produce"""'], {}), "('produce')\n", (1609, 1620), False, 'import click\n'), ((1622, 1736), 'click.option', 'click.option', (['"""-n"""', '"""--n_blends"""'], {'type': 'int', 'default': '(100)', 'show_default': '(True)', 'help': '"""Number of blends to produce"""'}...
from typing import List import itertools import numpy as np import torch from skimage.color import label2rgb def get_val_from_metric(metric_value): if isinstance(metric_value, (int, float)): pass elif torch.is_tensor(metric_value): metric_value = metric_value.item() else: metric_va...
[ "matplotlib.pyplot.ylabel", "torch.from_numpy", "numpy.ascontiguousarray", "numpy.array", "numpy.moveaxis", "matplotlib.pyplot.imshow", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.close", "matplotlib.pyplot.yticks", "matplotlib.pyplot.savefig", "matplotlib.pyplot.xticks", "matplotlib.use", ...
[((2235, 2261), 'numpy.zeros', 'np.zeros', (['(h, w)', 'np.uint8'], {}), '((h, w), np.uint8)\n', (2243, 2261), True, 'import numpy as np\n'), ((2363, 2387), 'skimage.color.label2rgb', 'label2rgb', (['labels', 'image'], {}), '(labels, image)\n', (2372, 2387), False, 'from skimage.color import label2rgb\n'), ((2572, 2597...
#!/usr/bin/python3 import numpy as np import matplotlib.pyplot as plt import sys import classifier as c from plotDecBoundaries import plotDecBoundaries def error_rate(classifications, true_classifications): if (np.shape(classifications) != np.shape(true_classifications)): raise RuntimeError("Size not equ...
[ "numpy.shape", "matplotlib.pyplot.savefig", "numpy.size", "classifier.NearestMeanClassifier", "matplotlib.pyplot.clf", "numpy.min", "numpy.argmax", "numpy.max", "numpy.append", "numpy.array", "numpy.count_nonzero", "plotDecBoundaries.plotDecBoundaries", "numpy.std", "numpy.argmin", "nump...
[((482, 498), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (490, 498), True, 'import numpy as np\n'), ((635, 658), 'numpy.append', 'np.append', (['features', '(-1)'], {}), '(features, -1)\n', (644, 658), True, 'import numpy as np\n'), ((679, 736), 'numpy.loadtxt', 'np.loadtxt', (['training_csv'], {'delimi...
# %% import numpy as np import os,sys import argparse import numpy as np from collections import defaultdict from keras.models import Model, load_model, model_from_json from datetime import datetime import plotly.graph_objects as go import base64 from dominate.util import raw from dominate.tags import * from dominate i...
[ "numpy.mean", "numpy.unique", "dominate.document", "argparse.ArgumentParser", "os.makedirs", "plotly.graph_objects.Box", "keras.models.model_from_json", "plotly.graph_objects.Figure", "numpy.array", "os.path.isdir", "collections.defaultdict", "numpy.random.seed", "numpy.linspace", "dominat...
[((335, 356), 'numpy.random.seed', 'np.random.seed', (['(12345)'], {}), '(12345)\n', (349, 356), True, 'import numpy as np\n'), ((1960, 1984), 'collections.defaultdict', 'defaultdict', (['defaultdict'], {}), '(defaultdict)\n', (1971, 1984), False, 'from collections import defaultdict\n'), ((6973, 6984), 'plotly.graph_o...
# @Date: 2019-05-13 # @Email: <EMAIL> <NAME> # @Last modified time: 2020-10-07 import sys #sys.path.insert(0, '/work/qiu/data4Keran/code/modelPredict') sys.path.insert(0, '/home/xx02tmp/code3/modelPredict') from img2mapC05 import img2mapC import numpy as np import time sys.path.insert(0, '/home/xx02tmp/...
[ "os.path.exists", "numpy.int8", "sys.path.insert", "scipy.io.savemat", "numpy.unique", "os.makedirs", "numpy.where", "numpy.delete", "basic4dataPre.savePatch_fold_singlev", "img2mapC05.img2mapC", "basic4dataPre.savePatch_fold_single", "basic4dataPre.patch2labelInx_lt", "numpy.arange" ]
[((162, 216), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/xx02tmp/code3/modelPredict"""'], {}), "(0, '/home/xx02tmp/code3/modelPredict')\n", (177, 216), False, 'import sys\n'), ((286, 339), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/xx02tmp/code3/dataPrepare"""'], {}), "(0, '/home/xx02tmp/cod...
import numpy as np from numba import jit # Tridiag solver from Carnahan # Not used in main program def TDMAsolver_carnahan(A, B, C, D): """ Our solution for the TDMA solver based on carnahan (not used in main program) """ # send the vectors a, b, c, d with the coefficents vector_len = D.shape[0] ...
[ "numpy.zeros", "numpy.arange" ]
[((392, 412), 'numpy.zeros', 'np.zeros', (['vector_len'], {}), '(vector_len)\n', (400, 412), True, 'import numpy as np\n'), ((443, 463), 'numpy.zeros', 'np.zeros', (['vector_len'], {}), '(vector_len)\n', (451, 463), True, 'import numpy as np\n'), ((491, 511), 'numpy.zeros', 'np.zeros', (['vector_len'], {}), '(vector_le...
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # Copyright (c) 2021 # # See the LICENSE file for details # see the AUTHORS file for authors # ---------------------------------------------------------------------- #-------------------- # System wide imports # ----------...
[ "logging.getLogger", "streetool.utils.paging", "statistics.mean", "PIL.Image.open", "numpy.unique", "numpy.average", "numpy.where", "matplotlib.widgets.Button", "streetool.utils.get_image", "numpy.array", "matplotlib.pyplot.subplots", "sklearn.cluster.DBSCAN", "matplotlib.pyplot.show" ]
[((780, 811), 'logging.getLogger', 'logging.getLogger', (['"""streetoool"""'], {}), "('streetoool')\n", (797, 811), False, 'import logging\n'), ((8498, 8538), 'streetool.utils.paging', 'paging', ([], {'iterable': 'cursor', 'headers': 'headers'}), '(iterable=cursor, headers=headers)\n', (8504, 8538), False, 'from street...
#!/usr/bin/env python3 import argparse import copy from collections import defaultdict from pathlib import Path import os import sys import time import numpy as np import pandas as pd from sklearn.metrics import f1_score, precision_recall_fscore_support, log_loss, average_precision_score import torch import torch.opt...
[ "apex.amp.scale_loss", "src.factory.get_model", "src.utils.load_model", "numpy.array", "apex.amp.initialize", "copy.deepcopy", "src.factory.get_loader_train", "os.path.exists", "argparse.ArgumentParser", "pathlib.Path", "src.utils.save_pickle", "torch.mean", "src.utils.get_logger", "src.ut...
[((1436, 1459), 'json.load', 'json.load', (['setting_json'], {}), '(setting_json)\n', (1445, 1459), False, 'import json\n'), ((1568, 1622), 'src.utils.get_logger', 'get_logger', (["(output_dir / f'fold{args.fold}_output.log')"], {}), "(output_dir / f'fold{args.fold}_output.log')\n", (1578, 1622), False, 'from src.utils...
# coding=UTF-8 import numpy as np import videoseam as vs class weights_delegate(object): """Delegate class to manage the weightning for the graph construction""" def __init__(self, parent, fill_with=np.inf, ndim=3): super(weights_delegate, self).__init__() self.parent = parent self.fill_with = fill_wi...
[ "numpy.abs", "numpy.zeros" ]
[((2218, 2242), 'numpy.zeros', 'np.zeros', (['((1,) + I.shape)'], {}), '((1,) + I.shape)\n', (2226, 2242), True, 'import numpy as np\n'), ((3384, 3408), 'numpy.zeros', 'np.zeros', (['((1,) + I.shape)'], {}), '((1,) + I.shape)\n', (3392, 3408), True, 'import numpy as np\n'), ((4446, 4470), 'numpy.zeros', 'np.zeros', (['...
import os import random from typing import List import numpy as np import pandas as pd from tqdm import tqdm def fix_random_seed(seed: int = 42) -> None: """ 乱数のシードを固定する。 Parameters ---------- seed : int 乱数のシード。 """ os.environ['PYTHONHASHSEED'] = str(seed) random.see...
[ "pandas.DataFrame", "numpy.random.seed", "random.seed", "pandas.read_csv" ]
[((310, 327), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (321, 327), False, 'import random\n'), ((332, 352), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (346, 352), True, 'import numpy as np\n'), ((733, 867), 'pandas.read_csv', 'pd.read_csv', (['input_filepath'], {'sep': '"""\\\\s+...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division from psychopy import locale_setup, visual, core import numpy as np from psychopy.hardware import keyboard from psychopy import misc def createPalette(size): """ Creates the color palette array in HSV and returns as...
[ "psychopy.visual.Rect", "psychopy.core.quit", "numpy.ones", "psychopy.misc.hsv2rgb", "psychopy.visual.Slider", "psychopy.visual.TextStim", "numpy.linspace", "numpy.zeros", "psychopy.hardware.keyboard.Keyboard", "psychopy.visual.Window", "psychopy.visual.ImageStim" ]
[((1159, 1222), 'psychopy.visual.Window', 'visual.Window', ([], {'size': '[1920, 1080]', 'fullscr': '(False)', 'units': '"""height"""'}), "(size=[1920, 1080], fullscr=False, units='height')\n", (1172, 1222), False, 'from psychopy import locale_setup, visual, core\n'), ((1239, 1347), 'psychopy.visual.ImageStim', 'visual...
from scipy.stats import multivariate_normal # 生成多维概率分布的方法 import numpy as np class GaussianMixture: def __init__(self, n_components: int = 1, covariance_type: str = 'full', tol: float = 0.001, reg_covar: float = 1e-06, max_iter: int = 100): self.n_components = n_components self.m...
[ "numpy.identity", "numpy.ones", "scipy.stats.multivariate_normal", "matplotlib.pyplot.clf", "numpy.argmax", "numpy.fill_diagonal", "numpy.sum", "numpy.zeros", "sklearn.datasets.samples_generator.make_blobs", "model_selection.train_test_split.train_test_split", "matplotlib.pyplot.scatter", "num...
[((3113, 3184), 'sklearn.datasets.samples_generator.make_blobs', 'make_blobs', ([], {'cluster_std': '(1.5)', 'random_state': '(42)', 'n_samples': '(1000)', 'centers': '(3)'}), '(cluster_std=1.5, random_state=42, n_samples=1000, centers=3)\n', (3123, 3184), False, 'from sklearn.datasets.samples_generator import make_blo...
import numpy as np import matplotlib.pyplot as plt from matplotlib.pyplot import gca import matplotlib as mb path = r'D:\data\20200213\100602_awg_sweep' data_name = path+path[16:]+r'.dat' data = np.loadtxt(data_name, unpack=True) n = 701 # print(len(data[0])) # print(len(data[0])/601.0) curr = np.arra...
[ "numpy.array_split", "numpy.rot90", "matplotlib.pyplot.title", "numpy.loadtxt", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((207, 241), 'numpy.loadtxt', 'np.loadtxt', (['data_name'], {'unpack': '(True)'}), '(data_name, unpack=True)\n', (217, 241), True, 'import numpy as np\n'), ((313, 339), 'numpy.array_split', 'np.array_split', (['data[0]', 'n'], {}), '(data[0], n)\n', (327, 339), True, 'import numpy as np\n'), ((385, 411), 'numpy.array_...
import click from numpy import argmax from achilles.model import AchillesModel from achilles.utils import get_dataset_labels from colorama import Fore from pathlib import Path Y = Fore.YELLOW G = Fore.GREEN RE = Fore.RESET @click.command() @click.option( "--model", "-m", default=None, help="Model fil...
[ "achilles.model.AchillesModel", "pathlib.Path", "click.option", "numpy.argmax", "achilles.utils.get_dataset_labels", "click.command" ]
[((227, 242), 'click.command', 'click.command', ([], {}), '()\n', (240, 242), False, 'import click\n'), ((244, 346), 'click.option', 'click.option', (['"""--model"""', '"""-m"""'], {'default': 'None', 'help': '"""Model file HD5."""', 'show_default': '(True)', 'metavar': '""""""'}), "('--model', '-m', default=None, help...
import numpy as np import numpy.random as random import matplotlib.pyplot as plt amplitude = eval( input( "Enter amplitude of impulse noise: " ) ) probability = eval( input( "Enter probability of impulse noise(%): " ) ) t = np.linspace( 0, 1, 200, endpoint = False ) # 定義時間陣列 x = 10 * np.cos( 2 * np.pi * 5 * t ) #...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.linspace", "matplotlib.pyplot.figure", "numpy.zeros", "matplotlib.pyplot.stem", "numpy.cos", "numpy.random.uniform", "matplotlib.pyplot.axis", "matplotlib.pyplot.show" ]
[((226, 264), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(200)'], {'endpoint': '(False)'}), '(0, 1, 200, endpoint=False)\n', (237, 264), True, 'import numpy as np\n'), ((335, 351), 'numpy.zeros', 'np.zeros', (['x.size'], {}), '(x.size)\n', (343, 351), True, 'import numpy as np\n'), ((573, 586), 'matplotlib.pyplo...
from collections import namedtuple import numpy as np from scipy.interpolate import Akima1DInterpolator as Akima import openmdao.api as om """United States standard atmosphere 1976 tables, data obtained from http://www.digitaldutch.com/atmoscalc/index.htm""" USatm1976Data = namedtuple("USatm1976Data", ["al...
[ "numpy.array", "collections.namedtuple", "scipy.interpolate.Akima1DInterpolator" ]
[((288, 376), 'collections.namedtuple', 'namedtuple', (['"""USatm1976Data"""', "['alt', 'T', 'P', 'rho', 'speed_of_sound', 'viscosity']"], {}), "('USatm1976Data', ['alt', 'T', 'P', 'rho', 'speed_of_sound',\n 'viscosity'])\n", (298, 376), False, 'from collections import namedtuple\n'), ((398, 1244), 'numpy.array', 'n...
import os import string from ast import literal_eval import numpy as np import operator from random import shuffle import gc import EmbeddingsManager as em from nltk import sent_tokenize import re import random from collections import OrderedDict SOS_TOKEN = 0 # Start of sentence token EOS_TOKEN = 1 # End of sent...
[ "random.shuffle", "numpy.ones", "os.path.join", "EmbeddingsManager.EmbeddingsManager", "numpy.max", "ast.literal_eval", "numpy.array", "nltk.sent_tokenize", "gc.collect", "re.sub", "operator.itemgetter" ]
[((15227, 15347), 'EmbeddingsManager.EmbeddingsManager', 'em.EmbeddingsManager', (['"""./embeddings/glove.6B.50d.txt"""', '(50)', '(10000)', 'processor.vocabulary', 'processor.sorted_vocabulary'], {}), "('./embeddings/glove.6B.50d.txt', 50, 10000, processor.\n vocabulary, processor.sorted_vocabulary)\n", (15247, 153...
import os import numpy as np import cv2 import sys import argparse import pathlib import glob import time sys.path.append('../../') from util import env, inverse, project_so, make_dirs from mesh import Mesh import scipy.io as sio """ Draw a 3 by n point cloud using open3d library """ def draw(vertex): import o...
[ "open3d.PointCloud", "util.project_so", "open3d.draw_geometries", "numpy.array", "numpy.loadtxt", "numpy.linalg.norm", "sys.path.append", "argparse.ArgumentParser", "numpy.random.seed", "numpy.concatenate", "numpy.random.permutation", "open3d.voxel_down_sample", "numpy.eye", "open3d.Vector...
[((106, 131), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (121, 131), False, 'import sys\n'), ((452, 457), 'util.env', 'env', ([], {}), '()\n', (455, 457), False, 'from util import env, inverse, project_so, make_dirs\n'), ((684, 746), 'argparse.ArgumentParser', 'argparse.ArgumentParser...
import time import os import gym import gym_panda import reflexxes import pybullet as p import math import numpy as np import cv2 import pandas as pd class MovementData: def __init__(self, id): self.mov_id=id self.currentPosition = [0.0, 0.0, 0.0]*2 self.currentVelocity = [0.0, 0.0, 0.0]*2 ...
[ "cv2.imwrite", "pybullet.getMatrixFromQuaternion", "os.path.exists", "numpy.sqrt", "pandas.DataFrame", "os.makedirs", "pybullet.getBasePositionAndOrientation", "time.sleep", "cv2.cvtColor", "pybullet.stepSimulation", "gym.make", "pybullet.getLinkState" ]
[((4247, 4283), 'cv2.cvtColor', 'cv2.cvtColor', (['rgb', 'cv2.COLOR_RGB2BGR'], {}), '(rgb, cv2.COLOR_RGB2BGR)\n', (4259, 4283), False, 'import cv2\n'), ((4298, 4334), 'cv2.cvtColor', 'cv2.cvtColor', (['cad', 'cv2.COLOR_RGB2BGR'], {}), '(cad, cv2.COLOR_RGB2BGR)\n', (4310, 4334), False, 'import cv2\n'), ((4343, 4373), 'c...
from pathlib import Path import numpy as np import pandas as pd import nibabel as nib import matplotlib.pyplot as plt import matplotlib.ticker as mtick color_tables_dir = Path(__file__).parent class Parcellation: def __init__(self, parcellation_path): self.parcellation_path = Path(parcellation_path) ...
[ "numpy.unique", "pandas.read_csv", "nibabel.load", "pathlib.Path", "matplotlib.ticker.PercentFormatter", "numpy.hstack", "numpy.argsort", "numpy.count_nonzero", "numpy.array", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((174, 188), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (178, 188), False, 'from pathlib import Path\n'), ((294, 317), 'pathlib.Path', 'Path', (['parcellation_path'], {}), '(parcellation_path)\n', (298, 317), False, 'from pathlib import Path\n'), ((1696, 1724), 'nibabel.load', 'nib.load', (['resection...
#-*-coding:utf-8-*- ''' Created on Nov14 31,2018 @author: pengzhiliang ''' import time import numpy as np import os import os.path as osp import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tqdm import tqdm from torch.utils.data import Dataset,DataLoader from torch.o...
[ "utils.crf.dense_crf", "torch.load", "os.path.join", "numpy.asarray", "utils.metrics.Score", "model.unet.UNet", "os.path.isfile", "torch.cuda.is_available", "dataloader.coder.merge_classes", "torch.no_grad", "torch.nn.functional.softmax" ]
[((855, 900), 'os.path.join', 'osp.join', (['"""/home/cv_xfwang/data/"""', '"""MRBrainS"""'], {}), "('/home/cv_xfwang/data/', 'MRBrainS')\n", (863, 900), True, 'import os.path as osp\n'), ((1430, 1448), 'utils.metrics.Score', 'Score', ([], {'n_classes': '(4)'}), '(n_classes=4)\n', (1435, 1448), False, 'from utils.metri...
import numpy import numpy as np from skimage.metrics import structural_similarity as ssim, peak_signal_noise_ratio from sklearn.metrics import mean_absolute_error, mean_squared_error, accuracy_score import torch from torch.nn import MSELoss,L1Loss # PSNR and SSIM calculation for inputting a 3d array (amount, height, wi...
[ "numpy.reshape", "skimage.metrics.structural_similarity", "torch.Tensor.cpu", "torch.nn.L1Loss", "torch.nn.MSELoss", "torch.no_grad", "skimage.metrics.peak_signal_noise_ratio", "torch.FloatTensor" ]
[((2048, 2057), 'torch.nn.MSELoss', 'MSELoss', ([], {}), '()\n', (2055, 2057), False, 'from torch.nn import MSELoss, L1Loss\n'), ((2071, 2079), 'torch.nn.L1Loss', 'L1Loss', ([], {}), '()\n', (2077, 2079), False, 'from torch.nn import MSELoss, L1Loss\n'), ((3383, 3489), 'numpy.reshape', 'numpy.reshape', (['x_set[:, :, 2...
import numpy as np import logging class PID(object): def __init__(self, kp, ki, kd): self.kp = kp self.ki = ki self.kd = kd self.reset() def update(self, t, e): # TODO add anti-windup logic # Most environments have a short execution time # the co...
[ "numpy.round" ]
[((4723, 4738), 'numpy.round', 'np.round', (['motor'], {}), '(motor)\n', (4731, 4738), True, 'import numpy as np\n')]
import os import numpy as np import cv2 as cv from tests_common import NewOpenCVTests def generate_test_trajectory(): result = [] angle_i = np.arange(0, 271, 3) angle_j = np.arange(0, 1200, 10) for i, j in zip(angle_i, angle_j): x = 2 * np.cos(i * 3 * np.pi/180.0) * (1.0 + 0.5 * np.cos(1.2 + ...
[ "cv2.viz.makeTransformToGlobal", "cv2.viz_WCoordinateSystem", "cv2.viz_Mesh", "cv2.viz_Color", "tests_common.NewOpenCVTests.bootstrap", "numpy.array", "numpy.sin", "cv2.viz_WCameraPosition", "numpy.arange", "cv2.viz_WCloudCollection", "cv2.viz_WTrajectory", "cv2.viz_WTrajectorySpheres", "cv2...
[((151, 171), 'numpy.arange', 'np.arange', (['(0)', '(271)', '(3)'], {}), '(0, 271, 3)\n', (160, 171), True, 'import numpy as np\n'), ((186, 208), 'numpy.arange', 'np.arange', (['(0)', '(1200)', '(10)'], {}), '(0, 1200, 10)\n', (195, 208), True, 'import numpy as np\n'), ((837, 869), 'cv2.viz_Viz3d', 'cv.viz_Viz3d', (['...
#!/usr/bin/env python3 """ Project 8: Maze Solver with Reinforcement Learning Author: <NAME> <***<EMAIL>> Learn policies to walk through a maze by reinforcement learning. This program implements value iteration with synchronous updates. Data Assumptions: 1. Maze data are rectangular (i.e. all rows have the same numbe...
[ "numpy.nanargmax", "numpy.absolute", "warnings.catch_warnings", "numpy.asarray", "numpy.zeros", "numpy.empty", "numpy.isnan", "numpy.nanmax", "warnings.simplefilter", "numpy.set_printoptions" ]
[((890, 942), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf', 'linewidth': '(100)'}), '(threshold=np.inf, linewidth=100)\n', (909, 942), True, 'import numpy as np\n'), ((2165, 2186), 'numpy.asarray', 'np.asarray', (['maze_data'], {}), '(maze_data)\n', (2175, 2186), True, 'import numpy as n...
import sympy as sp #math library to represent functions, we will write our own problem solving expressions from sympy import cos, cosh, sin, sinh import numpy as np import matplotlib.pyplot as mplot x = sp.Symbol('x') s = sp.Symbol('s') r1 = 1.87527632324985 r2 = 4.69409122046058 r3 = 7.855 #Superimpose plots q...
[ "sympy.sin", "sympy.Symbol", "matplotlib.pyplot.grid", "sympy.cos", "matplotlib.pyplot.ylabel", "sympy.cosh", "matplotlib.pyplot.legend", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.array", "matplotlib.pyplot.title", "sympy.sinh", "numpy.arange", "matplotlib.pyplot.show" ]
[((209, 223), 'sympy.Symbol', 'sp.Symbol', (['"""x"""'], {}), "('x')\n", (218, 223), True, 'import sympy as sp\n'), ((228, 242), 'sympy.Symbol', 'sp.Symbol', (['"""s"""'], {}), "('s')\n", (237, 242), True, 'import sympy as sp\n'), ((2044, 2068), 'numpy.arange', 'np.arange', (['(0)', '(1.01)', '(0.01)'], {}), '(0, 1.01,...
import numpy as np import torch import numpy.linalg as linalg import scipy.stats as stats import pickle from sys import exit m = 20 n = 40 K = 5 np.random.seed(0) U = stats.ortho_group.rvs(m)[:, 0:K] V = stats.ortho_group.rvs(n)[:, 0:K] mu_mn = np.sqrt(m + n + 2*np.sqrt(m*n)) D = np.random.uniform(low = 1/2*mu_mn, h...
[ "numpy.random.normal", "numpy.copy", "pickle.dump", "numpy.sqrt", "numpy.random.poisson", "scipy.stats.ortho_group.rvs", "numpy.random.binomial", "numpy.exp", "numpy.array", "numpy.matmul", "numpy.random.seed", "numpy.random.uniform", "numpy.arange", "numpy.random.shuffle" ]
[((147, 164), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (161, 164), True, 'import numpy as np\n'), ((284, 348), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(1 / 2 * mu_mn)', 'high': '(3 / 2 * mu_mn)', 'size': 'K'}), '(low=1 / 2 * mu_mn, high=3 / 2 * mu_mn, size=K)\n', (301, 348), Tru...
import numpy as np from tensorflow import keras from tensorflow.keras import backend as K class WarmUpLearningRateScheduler(keras.callbacks.Callback): """Warmup learning rate scheduler """ def __init__(self, warmup_batches, init_lr, verbose=0): """Constructor for warmup learning rate scheduler ...
[ "tensorflow.keras.utils.to_categorical", "numpy.random.random", "tensorflow.keras.backend.get_value", "numpy.random.randint", "tensorflow.keras.layers.Dense", "tensorflow.keras.backend.set_value", "tensorflow.keras.models.Sequential" ]
[((1553, 1565), 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1563, 1565), False, 'from tensorflow.keras.models import Sequential\n'), ((2087, 2124), 'numpy.random.random', 'np.random.random', (['(sample_count, 100)'], {}), '((sample_count, 100))\n', (2103, 2124), True, 'import numpy as np\n'),...
from astropy.cosmology import WMAP7 as cosmo from astropy.constants import c as C from astropy import units as u from astropy.table import Table from astropy.io import ascii import numpy as np from linetools import utils as ltu from linetools.isgm.abscomponent import AbsComponent from linetools.spectra.io import readsp...
[ "numpy.alltrue", "numpy.sqrt", "linetools.spectra.xspectrum1d.XSpectrum1D.from_tuple", "pyntejos.io.table_from_marzfile", "scipy.stats.sigmaclip", "numpy.argsort", "numpy.array", "linetools.utils.dz_from_dv", "linetools.utils.is_local_minima", "numpy.mean", "linetools.isgm.abscomponent.AbsCompon...
[((1342, 1354), 'numpy.array', 'np.array', (['z1'], {}), '(z1)\n', (1350, 1354), True, 'import numpy as np\n'), ((1364, 1376), 'numpy.array', 'np.array', (['z2'], {}), '(z2)\n', (1372, 1376), True, 'import numpy as np\n'), ((1386, 1398), 'numpy.array', 'np.array', (['dv'], {}), '(dv)\n', (1394, 1398), True, 'import num...
# -*- coding: utf-8 -*- """ Created on Sat Mar 23 18:44:48 2019 把轨迹数据填充到轨迹网格中,然后利用cnn深度学习的方法预测 @author: dell """ import numpy as np import pandas as pd from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten from keras.layers.convolutional import Convolution2D, MaxPooling2D fro...
[ "keras.layers.Flatten", "pandas.read_csv", "keras.layers.convolutional.Convolution2D", "sklearn.model_selection.train_test_split", "numpy.asarray", "keras.models.Sequential", "numpy.zeros", "keras.layers.convolutional.MaxPooling2D", "keras.layers.Dense", "keras.layers.Dropout" ]
[((385, 487), 'pandas.read_csv', 'pd.read_csv', (['"""F:\\\\python and machine learning\\\\track data and travel prediction\\\\sample_cnn"""'], {}), "(\n 'F:\\\\python and machine learning\\\\track data and travel prediction\\\\sample_cnn'\n )\n", (396, 487), True, 'import pandas as pd\n'), ((1299, 1338), 'numpy....
import csv import numpy as np from lightfm import LightFM import scipy.sparse from sklearn.metrics import label_ranking_average_precision_score import math import random import pickle def loadUserFeatures(i_file, n_users): print('Loading user graph...') A = scipy.sparse.lil_matrix((n_users, n_users), dtype=in...
[ "random.sample", "sklearn.metrics.label_ranking_average_precision_score", "pickle.dump", "lightfm.LightFM", "numpy.array", "numpy.random.seed", "csv.reader", "numpy.random.permutation" ]
[((3429, 3449), 'numpy.array', 'np.array', (['[sub_pred]'], {}), '([sub_pred])\n', (3437, 3449), True, 'import numpy as np\n'), ((3463, 3481), 'numpy.array', 'np.array', (['[labels]'], {}), '([labels])\n', (3471, 3481), True, 'import numpy as np\n'), ((3542, 3596), 'sklearn.metrics.label_ranking_average_precision_score...
#!/usr/bin/env python2 import cv2 import sys, random, socket, struct import numpy as np from math import sqrt, sin, cos, pi, atan2, fmod ################# # Choose camera # ################# camera = ' '.join(sys.argv[1:]) try: v = int(camera) camera = v except ValueError: pass if camera == '': camera = 0 #####...
[ "numpy.uint8", "cv2.__version__.split", "cv2.SimpleBlobDetector_create", "socket.socket", "math.sqrt", "cv2.SimpleBlobDetector", "cv2.imshow", "math.cos", "struct.pack", "cv2.SimpleBlobDetector_Params", "struct.unpack", "cv2.VideoCapture", "math.atan2", "random.random", "math.sin", "cv...
[((420, 444), 'cv2.VideoCapture', 'cv2.VideoCapture', (['camera'], {}), '(camera)\n', (436, 444), False, 'import cv2\n'), ((2897, 2928), 'cv2.SimpleBlobDetector_Params', 'cv2.SimpleBlobDetector_Params', ([], {}), '()\n', (2926, 2928), False, 'import cv2\n'), ((3352, 3378), 'cv2.__version__.split', 'cv2.__version__.spli...
# vim: expandtab:ts=4:sw=4 import numpy as np import scipy.linalg import pdb """ Table for the 0.95 quantile of the chi-square distribution with N degrees of freedom (contains values for N=1, ..., 9). Taken from MATLAB/Octave's chi2inv function and used as Mahalanobis gating threshold. """ chi2inv95 = { 1: 3.8415,...
[ "numpy.linalg.multi_dot", "numpy.dot", "numpy.zeros", "numpy.outer", "numpy.linalg.inv" ]
[((5839, 5858), 'numpy.zeros', 'np.zeros', (['self.ndim'], {}), '(self.ndim)\n', (5847, 5858), True, 'import numpy as np\n'), ((5885, 5917), 'numpy.zeros', 'np.zeros', (['(self.ndim, self.ndim)'], {}), '((self.ndim, self.ndim))\n', (5893, 5917), True, 'import numpy as np\n'), ((6846, 6879), 'numpy.dot', 'np.dot', (['in...
from pathlib import Path import torch import pandas as pd import numpy as np def load_train_data(root: Path): train_data_path = root / "train.csv" train_data = pd.read_csv(train_data_path) labels = train_data["label"].values data = train_data.drop("label", axis=1).values.reshape(-1, 1, 28, 28) ...
[ "torch.FloatTensor", "pandas.read_csv", "numpy.arange" ]
[((171, 199), 'pandas.read_csv', 'pd.read_csv', (['train_data_path'], {}), '(train_data_path)\n', (182, 199), True, 'import pandas as pd\n'), ((330, 353), 'torch.FloatTensor', 'torch.FloatTensor', (['data'], {}), '(data)\n', (347, 353), False, 'import torch\n'), ((611, 639), 'torch.FloatTensor', 'torch.FloatTensor', ([...
import os import re import warnings import numpy as np from typing import Tuple, Dict, Generator, Optional, Union # Custom types Map_File_Type = Tuple[ np.ndarray, Union[Dict[str, np.ndarray], dict], np.ndarray, Optional[np.ndarray] ] def load_3d_map_from_file(file_name: str) -> Map_File_Type: """map loader...
[ "re.split", "os.path.splitext", "os.path.isfile", "numpy.zeros", "warnings.warn" ]
[((878, 903), 'os.path.isfile', 'os.path.isfile', (['file_name'], {}), '(file_name)\n', (892, 903), False, 'import os\n'), ((994, 1021), 'os.path.splitext', 'os.path.splitext', (['file_name'], {}), '(file_name)\n', (1010, 1021), False, 'import os\n'), ((3599, 3650), 'warnings.warn', 'warnings.warn', (['"""start not giv...
#!/usr/bin/env python from time import time import numpy as np from metrics import Metrics from model import Model from utils import flatten class TwoWayMetrics(Metrics): # pylint: disable=too-many-instance-attributes def __init__(self, epoch, n_low_level_fids): self.first_gen_loss = [] self.first_gen...
[ "numpy.mean", "time.time", "numpy.std" ]
[((7106, 7121), 'numpy.mean', 'np.mean', (['values'], {}), '(values)\n', (7113, 7121), True, 'import numpy as np\n'), ((7145, 7159), 'numpy.std', 'np.std', (['values'], {}), '(values)\n', (7151, 7159), True, 'import numpy as np\n'), ((7948, 7954), 'time.time', 'time', ([], {}), '()\n', (7952, 7954), False, 'from time i...
import pandas as pd import numpy as np import argparse from plotnine import ggplot, scale_x_continuous, theme_bw, element_rect, element_line, geom_line, scale_color_brewer, \ annotate, \ element_blank, element_text, scale_x_discrete,geom_errorbar,position_dodge, scale_y_continuous, aes, theme, facet_grid, labs,...
[ "plotnine.element_blank", "plotnine.element_line", "sys.path.insert", "argparse.ArgumentParser", "pandas.read_csv", "numpy.size", "plotnine.theme_bw", "plotnine.geom_line", "plotnine.aes", "plotnine.element_text", "plotnine.facet_wrap", "numpy.array", "plotnine.scale_x_continuous", "plotni...
[((387, 411), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./"""'], {}), "(0, './')\n", (402, 411), False, 'import sys\n'), ((435, 503), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Effect_of_sigma_smooth_figure"""'}), "(description='Effect_of_sigma_smooth_figure')\n", (458, 503)...
import numpy as np import logging max_seed = 2147483647 #logging.basicConfig(level="DEBUG") logger = logging.getLogger("TUMOR2D") #logger.setLevel("ERROR") class Tumor2dExperiment: def __init__(self, mean_gc, mean_ecm, mean_prolif, std_gc, std_ecm, std_prolif, full_data_gc=None, full_data_ecm=N...
[ "logging.getLogger", "numpy.mean", "numpy.floor", "numpy.random.randint", "numpy.empty", "numpy.random.seed", "numpy.isnan", "numpy.std", "tumor2d.src.nixTumor2d.tumor2d_interface" ]
[((103, 131), 'logging.getLogger', 'logging.getLogger', (['"""TUMOR2D"""'], {}), "('TUMOR2D')\n", (120, 131), False, 'import logging\n'), ((1802, 2050), 'tumor2d.src.nixTumor2d.tumor2d_interface', 'nixTumor2d.tumor2d_interface', (['initial_radius', 'initial_quiescent_fraction', 'max_celldivision_rate', 'division_depth'...
import io import os import numpy as np import requests as rq import onnxruntime as ort from PIL import Image from app.utils import load_labels, softmax class Predictor: def __init__(self, mode_path) -> None: self.model = ort.InferenceSession(f'{os.getcwd()}/{mode_path}', None) def pre_process(self, input_data...
[ "PIL.Image.open", "io.BytesIO", "numpy.argmax", "requests.get", "os.getcwd", "numpy.array", "numpy.zeros" ]
[((568, 599), 'numpy.array', 'np.array', (['[0.485, 0.456, 0.406]'], {}), '([0.485, 0.456, 0.406])\n', (576, 599), True, 'import numpy as np\n'), ((617, 648), 'numpy.array', 'np.array', (['[0.229, 0.224, 0.225]'], {}), '([0.229, 0.224, 0.225])\n', (625, 648), True, 'import numpy as np\n'), ((1025, 1042), 'requests.get'...
# Copyright 2016 Hewlett Packard Enterprise Development LP # # 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 ...
[ "numpy.convolve", "opveclib.arange", "opveclib.output", "opveclib.position_in", "numpy.array", "itertools.repeat", "numpy.random.random", "tensorflow.Session", "opveclib.if_", "numpy.empty", "opveclib.profile", "tensorflow.ConfigProto", "opveclib.operator", "tensorflow.nn.conv2d", "tenso...
[((692, 706), 'opveclib.operator', 'ovl.operator', ([], {}), '()\n', (704, 706), True, 'import opveclib as ovl\n'), ((3758, 3791), 'opveclib.output', 'ovl.output', (['output_shape', 'x.dtype'], {}), '(output_shape, x.dtype)\n', (3768, 3791), True, 'import opveclib as ovl\n'), ((4443, 4475), 'opveclib.position_in', 'ovl...
import numpy as np from yt.testing import fake_random_ds, assert_equal from yt.frontends.stream.data_structures import load_uniform_grid def test_exclude_above(): the_ds = fake_random_ds(ndims=3) all_data = the_ds.all_data() new_ds = all_data.exclude_above('density', 1) assert_equal(new_ds['density']...
[ "yt.testing.assert_equal", "numpy.ones", "yt.testing.fake_random_ds", "yt.frontends.stream.data_structures.load_uniform_grid", "numpy.all" ]
[((179, 202), 'yt.testing.fake_random_ds', 'fake_random_ds', ([], {'ndims': '(3)'}), '(ndims=3)\n', (193, 202), False, 'from yt.testing import fake_random_ds, assert_equal\n'), ((290, 342), 'yt.testing.assert_equal', 'assert_equal', (["new_ds['density']", "all_data['density']"], {}), "(new_ds['density'], all_data['dens...
# builtin packages import os import numpy as np from tqdm import tqdm # torch import torch from torch import optim from torch.utils.data import DataLoader # from my module from depth_completion.data import DepthDataset from depth_completion.data import customed_collate_fn import depth_completion.utils.loss_func as lo...
[ "numpy.mean", "torch.ones_like", "torch.nn.parallel.data_parallel", "depth_completion.data.customed_collate_fn", "os.path.isdir", "os.mkdir", "torch.no_grad", "torch.cat", "depth_completion.data.DepthDataset" ]
[((6279, 6304), 'numpy.mean', 'np.mean', (['total_valid_loss'], {}), '(total_valid_loss)\n', (6286, 6304), True, 'import numpy as np\n'), ((7833, 7858), 'numpy.mean', 'np.mean', (['total_train_loss'], {}), '(total_train_loss)\n', (7840, 7858), True, 'import numpy as np\n'), ((8583, 8639), 'torch.cat', 'torch.cat', (['[...
import sys sys.path.append('/Users/bryanwhiting/Dropbox/interviews/downstream/DataScienceInterview-Bryan/src') import numpy as np import plotnine as g import pandas as pd from bryan.mcmc import MCMC # TODO: Placeholder for unit tests # Testing the code (would do unit tests w/more time) k = 26 n_fake_datapoints = 10...
[ "numpy.random.normal", "numpy.mean", "numpy.random.exponential", "bryan.mcmc.MCMC", "sys.path.append" ]
[((11, 120), 'sys.path.append', 'sys.path.append', (['"""/Users/bryanwhiting/Dropbox/interviews/downstream/DataScienceInterview-Bryan/src"""'], {}), "(\n '/Users/bryanwhiting/Dropbox/interviews/downstream/DataScienceInterview-Bryan/src'\n )\n", (26, 120), False, 'import sys\n'), ((597, 623), 'bryan.mcmc.MCMC', 'M...
import sys sys.path.append("./MPC/ThermalModels") sys.path.append("..") import numpy as np import utils # TODO distinguish between actions and add different noise correspondingly. class SimulationTstat: def __init__(self, mpc_thermal_model, curr_temperature): self.mpc_thermal_model = mpc_thermal_model ...
[ "numpy.random.normal", "sys.path.append" ]
[((12, 50), 'sys.path.append', 'sys.path.append', (['"""./MPC/ThermalModels"""'], {}), "('./MPC/ThermalModels')\n", (27, 50), False, 'import sys\n'), ((51, 72), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (66, 72), False, 'import sys\n'), ((3689, 3734), 'numpy.random.normal', 'np.random.normal...
#./usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: <NAME> (1459333) """ from __future__ import absolute_import, division, print_function, unicode_literals from os import path import timeit import numpy as np from Pyfhel import PyCtxt, Pyfhel from .util import createDir class Encryption: def __in...
[ "os.path.exists", "timeit.default_timer", "numpy.argmax", "Pyfhel.Pyfhel", "numpy.array", "numpy.empty", "numpy.load", "Pyfhel.PyCtxt", "numpy.save" ]
[((1640, 1648), 'Pyfhel.Pyfhel', 'Pyfhel', ([], {}), '()\n', (1646, 1648), False, 'from Pyfhel import PyCtxt, Pyfhel\n'), ((2128, 2148), 'os.path.exists', 'path.exists', (['context'], {}), '(context)\n', (2139, 2148), False, 'from os import path\n'), ((2700, 2726), 'os.path.exists', 'path.exists', (['self.keys_dir'], {...
from Optimithon import Base from Optimithon import QuasiNewton from numpy import array, sin, pi from scipy.optimize import minimize fun = lambda x: sin(x[0] + x[1]) + (x[0] - x[1]) ** 2 - 1.5 * x[0] + 2.5 * x[1] + 1. x0 = array((0., 0.)) print(fun(x0)) sol1 = minimize(fun, x0, method='COBYLA') sol2 = minimize(fun, x0,...
[ "numpy.sin", "numpy.array", "scipy.optimize.minimize", "Optimithon.Base" ]
[((223, 240), 'numpy.array', 'array', (['(0.0, 0.0)'], {}), '((0.0, 0.0))\n', (228, 240), False, 'from numpy import array, sin, pi\n'), ((261, 295), 'scipy.optimize.minimize', 'minimize', (['fun', 'x0'], {'method': '"""COBYLA"""'}), "(fun, x0, method='COBYLA')\n", (269, 295), False, 'from scipy.optimize import minimize...
from __future__ import division from tkinter import Button, Label, Tk import threading import pyaudio import numpy as np from core.stream import Stream from core.tone2frequency import tone2frequency from data.key_midi_mapping import midi_key_mapping class ThreadPlayer: def __init__(self, **kwargs): sel...
[ "tkinter.Tk", "tkinter.Label", "pyaudio.PyAudio", "core.tone2frequency.tone2frequency", "numpy.arange" ]
[((417, 434), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (432, 434), False, 'import pyaudio\n'), ((953, 970), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (968, 970), False, 'import pyaudio\n'), ((2159, 2184), 'core.tone2frequency.tone2frequency', 'tone2frequency', (['self.tone'], {}), '(self.to...
import os import subprocess import sys import tarfile import tempfile from dataclasses import asdict import numpy as np import onnxruntime as ort import tensorflow as tf import yaml from tvm.contrib.download import download from arachne.data import ModelSpec, TensorSpec from arachne.tools.openvino2tf import OpenVINO2...
[ "tensorflow.saved_model.load", "tempfile.TemporaryDirectory", "tarfile.open", "numpy.random.rand", "dataclasses.asdict", "numpy.testing.assert_allclose", "subprocess.run", "onnxruntime.InferenceSession", "arachne.data.TensorSpec", "arachne.tools.openvino2tf.OpenVINO2TFConfig", "os.chdir", "ara...
[((620, 654), 'tensorflow.saved_model.load', 'tf.saved_model.load', (['tf_model_path'], {}), '(tf_model_path)\n', (639, 654), True, 'import tensorflow as tf\n'), ((839, 912), 'onnxruntime.InferenceSession', 'ort.InferenceSession', (['onnx_model_path'], {'providers': "['CPUExecutionProvider']"}), "(onnx_model_path, prov...
import numpy as np import matplotlib.pyplot as plt import time, psutil, sys, gc useColab = False if useColab: #!pip3 install hdf5storage from google.colab import drive drive.mount('/content/gdrive') import hdf5storage as hdf def loadData(filename): #Get data return hdf.loadmat(filename) def...
[ "hdf5storage.loadmat", "numpy.unique", "google.colab.drive.mount", "matplotlib.pyplot.plot", "psutil.virtual_memory", "numpy.array", "matplotlib.pyplot.show" ]
[((5277, 5314), 'matplotlib.pyplot.plot', 'plt.plot', (['inData[featuresName][23, :]'], {}), '(inData[featuresName][23, :])\n', (5285, 5314), True, 'import matplotlib.pyplot as plt\n'), ((5339, 5349), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (5347, 5349), True, 'import matplotlib.pyplot as plt\n'), ((182...
# MAIN import simplex import search import tree import marking import numpy as np from prettytable import PrettyTable # Данные варианта 18 c = np.array( [7, 7, 6], float) b = np.array( [8, 2, 6], float) A = np.array( [ [2, 1, 1], [1, 2, 0], [0, 0.5, 4] ], float) print ("ДАННЫЕ ВАРИ...
[ "prettytable.PrettyTable", "tree.Branch", "marking.fillMarks", "numpy.size", "search.bruteForce", "numpy.append", "numpy.array", "simplex.Simplex" ]
[((146, 172), 'numpy.array', 'np.array', (['[7, 7, 6]', 'float'], {}), '([7, 7, 6], float)\n', (154, 172), True, 'import numpy as np\n'), ((178, 204), 'numpy.array', 'np.array', (['[8, 2, 6]', 'float'], {}), '([8, 2, 6], float)\n', (186, 204), True, 'import numpy as np\n'), ((211, 263), 'numpy.array', 'np.array', (['[[...
import numpy as np import random import time from sudoku.node import Node class Sudoku(): def __init__(self, size=9, custom=None, verbose=False, debug=False): # assume size is perfect square (TODO: assert square) # size is defined as the length of one side """ Custom s...
[ "random.choice", "numpy.sqrt", "random.shuffle", "sudoku.node.Node", "time.time" ]
[((596, 607), 'time.time', 'time.time', ([], {}), '()\n', (605, 607), False, 'import time\n'), ((8201, 8212), 'time.time', 'time.time', ([], {}), '()\n', (8210, 8212), False, 'import time\n'), ((560, 573), 'numpy.sqrt', 'np.sqrt', (['size'], {}), '(size)\n', (567, 573), True, 'import numpy as np\n'), ((736, 747), 'time...
# neural network functions and classes import numpy as np import random import json import cma from es import SimpleGA, CMAES, PEPG, OpenES from env import make_env def sigmoid(x): return 1 / (1 + np.exp(-x)) def relu(x): return np.maximum(x, 0) def passthru(x): return x # useful for discrete actions def sof...
[ "numpy.product", "numpy.multiply", "numpy.tanh", "numpy.random.multinomial", "numpy.exp", "numpy.array", "numpy.split", "numpy.zeros", "numpy.max", "numpy.matmul", "numpy.concatenate", "json.load", "env.make_env", "numpy.maximum", "numpy.random.randn" ]
[((236, 252), 'numpy.maximum', 'np.maximum', (['x', '(0)'], {}), '(x, 0)\n', (246, 252), True, 'import numpy as np\n'), ((455, 482), 'numpy.random.multinomial', 'np.random.multinomial', (['(1)', 'p'], {}), '(1, p)\n', (476, 482), True, 'import numpy as np\n'), ((694, 724), 'numpy.concatenate', 'np.concatenate', (['(x, ...
import copy import numpy as np class Objective(): pass class MeanSquaredError(): def calc_acc(self,y_hat,y): return 0 def calc_loss(self,y_hat,y): loss = np.mean(np.sum(np.power(y_hat-y,2),axis=1)) return 0.5*loss def backward(self,y_hat,y): ...
[ "numpy.ones_like", "numpy.prod", "numpy.mean", "numpy.power", "numpy.where", "numpy.arange", "numpy.absolute", "numpy.log", "numpy.asarray", "numpy.argmax", "numpy.sum", "copy.deepcopy", "numpy.divide" ]
[((687, 710), 'numpy.where', 'np.where', (['(y_hat - y < 0)'], {}), '(y_hat - y < 0)\n', (695, 710), True, 'import numpy as np\n'), ((723, 742), 'numpy.ones_like', 'np.ones_like', (['y_hat'], {}), '(y_hat)\n', (735, 742), True, 'import numpy as np\n'), ((2168, 2193), 'numpy.prod', 'np.prod', (['y_hat.shape[:-1]'], {}),...
from __future__ import print_function, absolute_import, division import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt from IPython.core.pylabtools import figsize figsize(12, 4) import os import sys os.environ['THEANO_FLAGS'] = "device=cpu,optimizer=fast_run" DATA_DIR = os.path.join('/res', 'dat...
[ "IPython.core.pylabtools.figsize", "matplotlib.use", "numpy.where", "matplotlib.pyplot.plot", "os.path.join", "numpy.tanh", "numpy.exp", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.pyplot.show" ]
[((83, 104), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (97, 104), False, 'import matplotlib\n'), ((186, 200), 'IPython.core.pylabtools.figsize', 'figsize', (['(12)', '(4)'], {}), '(12, 4)\n', (193, 200), False, 'from IPython.core.pylabtools import figsize\n'), ((295, 323), 'os.path.join', 'o...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ ##### Tools ##### *Created on Thu Jul 2 10:07:56 2015 by <NAME>* A set of tools to use with the `RDKit <http://rdkit.org>`_ in the IPython notebook. """ import time import sys import base64 import os import os.path as op import random import csv import gzip import ...
[ "csv.DictWriter", "rdkit.Chem.AllChem.CalcMolFormula", "csv.DictReader", "rdkit.Chem.AllChem.GetMolFrags", "numpy.log10", "IPython.core.display.display", "gzip.open", "PIL.Image.new", "rdkit.Chem.AllChem.MolFromSmiles", "rdkit.Chem.AllChem.Compute2DCoords", "rdkit.Chem.Descriptors.MolLogP", "r...
[((2527, 2564), 'os.path.isfile', 'op.isfile', (['"""lib/jsme/jsme.nocache.js"""'], {}), "('lib/jsme/jsme.nocache.js')\n", (2536, 2564), True, 'import os.path as op\n'), ((2236, 2260), 'misc_tools.apl_tools.get_commit', 'apt.get_commit', (['__file__'], {}), '(__file__)\n', (2250, 2260), True, 'from misc_tools import ap...
from torchtext import data from torch.utils.data import DataLoader from graph import MTBatcher, get_mt_dataset, MTDataset, DocumentMTDataset from modules import make_translation_model from optim import get_wrapper from loss import LabelSmoothing import numpy as np import torch as th import torch.optim as optim import ...
[ "graph.get_mt_dataset", "loss.LabelSmoothing", "yaml.load", "optim.get_wrapper", "torch.distributed.barrier", "os.path.exists", "argparse.ArgumentParser", "modules.make_translation_model", "graph.DocumentMTDataset", "numpy.random.seed", "os.mkdir", "torchtext.data.Field", "torch.distributed....
[((412, 442), 'torch.manual_seed', 'th.manual_seed', (["config['seed']"], {}), "(config['seed'])\n", (426, 442), True, 'import torch as th\n'), ((447, 477), 'numpy.random.seed', 'np.random.seed', (["config['seed']"], {}), "(config['seed'])\n", (461, 477), True, 'import numpy as np\n'), ((482, 521), 'torch.cuda.manual_s...
import yaml import inspect from pcl2depth import velo_points_2_pano import scipy.io import numpy as np import os from os.path import join import sys from tqdm import tqdm import matplotlib.pyplot as plt import cv2 currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.pat...
[ "os.path.exists", "cv2.imwrite", "sys.path.insert", "os.listdir", "os.makedirs", "inspect.currentframe", "os.path.join", "numpy.bitwise_and", "os.path.dirname", "yaml.safe_load", "numpy.array", "numpy.zeros", "numpy.concatenate", "cv2.resize", "sys.path.append", "pcl2depth.velo_points_...
[((314, 341), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (329, 341), False, 'import os\n'), ((342, 368), 'sys.path.append', 'sys.path.append', (['parentdir'], {}), '(parentdir)\n', (357, 368), False, 'import sys\n'), ((369, 398), 'sys.path.insert', 'sys.path.insert', (['(1)', 'parentd...
""" License ------- The MIT License (MIT) Copyright (c) 2018 Snappy2 Project 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 ...
[ "utils.Utility.Utility.reverse_nn_normalization", "os.path.join", "numpy.array", "os.path.dirname", "cv2.resize" ]
[((1054, 1079), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1069, 1079), False, 'import os\n'), ((1143, 1236), 'os.path.join', 'os.path.join', (['base_folder', '"""../resource/haarcascades/haarcascade_frontalface_default.xml"""'], {}), "(base_folder,\n '../resource/haarcascades/haarcas...
import pandas as pd import numpy as np def preprocess_data(df): df = df.drop(columns = ['FEINumberRecall','RecallingFirmName','RecallEventID','RecallEventClassification','RefusalFEINumber', 'RefusedDate','AnalysisDone','OutbreakLevel','Id','ImportingCountry']) a = df[df['OriginCountry'].isin(['-'])]['Orig...
[ "numpy.where", "pandas.factorize", "pandas.read_csv" ]
[((10855, 10903), 'pandas.read_csv', 'pd.read_csv', (['"""data/raw_data/seafood_imports.csv"""'], {}), "('data/raw_data/seafood_imports.csv')\n", (10866, 10903), True, 'import pandas as pd\n'), ((10075, 10102), 'numpy.where', 'np.where', (['(corr_matrix > 0.8)'], {}), '(corr_matrix > 0.8)\n', (10083, 10102), True, 'imp...
import pandas as pd import numpy import matplotlib import sklearn_crfsuite from sklearn import preprocessing from sklearn.preprocessing import LabelEncoder from sklearn_crfsuite import metrics from sklearn.model_selection import train_test_split from sklearn.metrics import make_scorer from sklearn.cross_validation i...
[ "sklearn.grid_search.RandomizedSearchCV", "numpy.unique", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn_crfsuite.CRF", "glob.glob" ]
[((972, 1039), 'glob.glob', 'glob', (['"""/Users/karanjani/Desktop/csvWithVecs/TrainCSV_Updated/*.csv"""'], {}), "('/Users/karanjani/Desktop/csvWithVecs/TrainCSV_Updated/*.csv')\n", (976, 1039), False, 'from glob import glob\n'), ((1750, 1809), 'sklearn.model_selection.train_test_split', 'train_test_split', (['featureM...
import os import glob import numpy as np import tabulate def pprint_dict(x): """ :param x: a dict :return: a string of pretty representation of the dict """ def helper(d): ret = {} for k, v in d.items(): if isinstance(v, dict): ret[k] = helper(v) ...
[ "tabulate.tabulate", "parse.parse", "torch.load", "os.path.join", "os.path.isfile", "numpy.stack", "os.path.dirname", "torch.save", "numpy.dtype" ]
[((1171, 1220), 'tabulate.tabulate', 'tabulate.tabulate', (['data', 'headers'], {'tablefmt': '"""psql"""'}), "(data, headers, tablefmt='psql')\n", (1188, 1220), False, 'import tabulate\n'), ((1295, 1340), 'os.path.join', 'os.path.join', (['dir', "('%s.%d' % (filename, step))"], {}), "(dir, '%s.%d' % (filename, step))\n...
# -*- coding: utf-8 -*- """OpenBabel toolkit for DeCAF""" from decaf import PHARS, Pharmacophore import pybel import openbabel as ob import numpy as np from collections import deque import math PATTERNS = {phar: pybel.Smarts(smarts) for (phar, smarts) in PHARS.items()} def __count_bonds(a1, a2, exclude): """Co...
[ "pybel.Smarts", "collections.deque", "math.ceil", "decaf.PHARS.items", "numpy.zeros", "openbabel.OBAtomAtomIter", "decaf.Pharmacophore", "openbabel.OBMol" ]
[((215, 235), 'pybel.Smarts', 'pybel.Smarts', (['smarts'], {}), '(smarts)\n', (227, 235), False, 'import pybel\n'), ((726, 742), 'collections.deque', 'deque', (['[(a1, 0)]'], {}), '([(a1, 0)])\n', (731, 742), False, 'from collections import deque\n'), ((2082, 2102), 'numpy.zeros', 'np.zeros', (['(idx, idx)'], {}), '((i...
#!/usr/bin/env python3 ################################################################################ # parse arguments first import argparse parser = argparse.ArgumentParser() parser.add_argument('--min_2d_power', type=int, default=3) parser.add_argument('--max_2d_power', type=int, default=15) parser.add_argument...
[ "common.get_marcher_plot_name", "sys.path.insert", "numpy.sqrt", "common3d.get_marcher_plot_name", "argparse.ArgumentParser", "numpy.arange", "pyolim.FacCenter3d", "numpy.where", "matplotlib.pyplot.style.use", "numpy.linspace", "common.get_marcher_name", "pyolim.FacCenter", "common3d.get_mar...
[((156, 181), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (179, 181), False, 'import argparse\n'), ((623, 674), 'sys.path.insert', 'sys.path.insert', (['(0)', "('../build/%s' % args.build_type)"], {}), "(0, '../build/%s' % args.build_type)\n", (638, 674), False, 'import sys\n'), ((675, 707),...
# Copyright 2020 <NAME>, <NAME>, <NAME> # # 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 a...
[ "numpy.mean", "numpy.abs", "numpy.sqrt", "numpy.zeros", "numpy.random.RandomState", "random.SystemRandom", "numpy.round" ]
[((1946, 1981), 'numpy.zeros', 'np.zeros', (['(2 ** N)'], {'dtype': 'np.complex_'}), '(2 ** N, dtype=np.complex_)\n', (1954, 1981), True, 'import numpy as np\n'), ((2634, 2658), 'numpy.random.RandomState', 'np.random.RandomState', (['a'], {}), '(a)\n', (2655, 2658), True, 'import numpy as np\n'), ((2834, 2876), 'numpy....
"""Machine Learning 2 Section 10 @ GWU Quiz 4 - Solution for Q4 Author: Xiaochi (George) Li""" import torch import numpy as np from torch.autograd import Variable import matplotlib.pyplot as plt torch.manual_seed(42) size = 100 p = np.linspace(-3, 3, size) t = np.exp(-np.abs(p)) * np.sin(np.pi * p) p = Variable(tor...
[ "torch.manual_seed", "torch.nn.ReLU", "numpy.abs", "matplotlib.pyplot.plot", "torch.from_numpy", "torch.nn.MSELoss", "numpy.linspace", "matplotlib.pyplot.scatter", "torch.nn.Linear", "numpy.sin", "matplotlib.pyplot.title", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((198, 219), 'torch.manual_seed', 'torch.manual_seed', (['(42)'], {}), '(42)\n', (215, 219), False, 'import torch\n'), ((235, 259), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', 'size'], {}), '(-3, 3, size)\n', (246, 259), True, 'import numpy as np\n'), ((691, 709), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {})...
'''This is the Channel module It can simulate a river channel basing on the inputs it is provided. It consists of a centerline, an inner channel, and arbitrary number of outer banks. All functions apply to it should be continuous. The offsets from banks to centerline are in sn coordinate system, and transform into xy...
[ "math.floor", "matplotlib.pyplot.ylabel", "math.log", "numpy.array", "numpy.arange", "numpy.cross", "numpy.where", "matplotlib.pyplot.xlabel", "numpy.linspace", "numpy.argmin", "numpy.meshgrid", "numpy.maximum", "numpy.round", "numpy.random.normal", "random.sample", "numpy.amax", "nu...
[((2131, 2151), 'numpy.array', 'np.array', (['x_v_valley'], {}), '(x_v_valley)\n', (2139, 2151), True, 'import numpy as np\n'), ((2236, 2255), 'numpy.amax', 'np.amax', (['x_v_valley'], {}), '(x_v_valley)\n', (2243, 2255), True, 'import numpy as np\n'), ((2697, 2712), 'numpy.array', 'np.array', (['out_x'], {}), '(out_x)...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def import_data(file_name, time_column_index=None, mode='csv', header=True, room_name=None, tz=0): """ Load raw data from the disk. :type file_name: str :param file_name: the name of the raw data file :type time_column_index: int :param time_col...
[ "dateutil.parser.parse", "numpy.asarray", "csv.reader" ]
[((1227, 1260), 'csv.reader', 'reader', (['input_file'], {'delimiter': '""","""'}), "(input_file, delimiter=',')\n", (1233, 1260), False, 'from csv import reader\n'), ((1984, 2010), 'numpy.asarray', 'asarray', (['data'], {'dtype': 'float'}), '(data, dtype=float)\n', (1991, 2010), False, 'from numpy import nan, asarray\...
import numpy as np N = 17 #607 #17 matrix = [] for i in range(N): matrix.append([0]*N) matrix = np.matrix(matrix) findn = 211 #368078 #211 find = [0,0] fn = 1 x = N//2 y = N//2 expo = 1 while(fn < N*N): per = expo**2 - (expo-2)**2 if per == 0: matrix[x,y] = 1 if findn == fn : find = [x,y] else: ...
[ "numpy.matrix" ]
[((100, 117), 'numpy.matrix', 'np.matrix', (['matrix'], {}), '(matrix)\n', (109, 117), True, 'import numpy as np\n')]
from pathlib import Path import os import cv2 import numpy as np import glob from sklearn.preprocessing import LabelEncoder from PIL import Image from tqdm import tqdm import albumentations as A import tensorflow as tf from .utils import load_bbox, get_resized_bbox from .preprocessing import preprocess DATA_DIR = Pa...
[ "sklearn.preprocessing.LabelEncoder", "os.listdir", "PIL.Image.open", "pathlib.Path", "tensorflow.data.Dataset.from_tensor_slices", "os.path.join", "numpy.array", "albumentations.Normalize", "albumentations.Resize", "cv2.cvtColor", "os.system", "cv2.imread", "glob.glob" ]
[((318, 336), 'pathlib.Path', 'Path', (['"""../../data"""'], {}), "('../../data')\n", (322, 336), False, 'from pathlib import Path\n'), ((490, 587), 'os.system', 'os.system', (['"""wget http://vision.stanford.edu/aditya86/ImageNetDogs/images.tar -P ./data"""'], {}), "(\n 'wget http://vision.stanford.edu/aditya86/Ima...
import random import matplotlib.pyplot as plt import numpy as np import pandas as pd def make_bin_edges(sos, x): middle, minim, maxim = np.mean(x), min(x), max(x) d_x = sos middle_low_edge, middle_high_edge = middle - d_x / 2, middle + d_x / 2 edges = [middle_low_edge, middle_high_edge] temp = mi...
[ "numpy.mean", "numpy.histogram", "matplotlib.pyplot.savefig", "numpy.sqrt", "pandas.read_csv", "numpy.std", "matplotlib.pyplot.subplots" ]
[((810, 856), 'numpy.histogram', 'np.histogram', (['x_list'], {'bins': 'bins', 'density': '(False)'}), '(x_list, bins=bins, density=False)\n', (822, 856), True, 'import numpy as np\n'), ((1538, 1567), 'pandas.read_csv', 'pd.read_csv', (['"""cantar2019.csv"""'], {}), "('cantar2019.csv')\n", (1549, 1567), True, 'import p...
#! -*- coding:utf-8 -*- ''' @Author: ZM @Date and Time: 2020/12/13 16:28 @File: train.py ''' import math import numpy as np import pandas as pd from gensim import corpora from keras.layers import Input from keras import Model from keras.callbacks import Callback from keras.optimizers import Adam from ...
[ "get_dataset.get_dataset", "keras.optimizers.Adam", "generator.generator", "math.ceil", "utils.str2id", "keras.Model", "keras.backend.mean", "numpy.argmax", "numpy.array", "utils.sequence_padding", "keras.layers.Input", "ToOneHot.ToOneHot", "CNN_model.CNN_Model", "keras.backend.softmax", ...
[((968, 981), 'get_dataset.get_dataset', 'get_dataset', ([], {}), '()\n', (979, 981), False, 'from get_dataset import get_dataset\n'), ((1187, 1235), 'utils.sequence_padding', 'sequence_padding', (['X_train'], {'max_length': 'max_length'}), '(X_train, max_length=max_length)\n', (1203, 1235), False, 'from utils import s...
import os import numpy as np from sklearn.model_selection import train_test_split from tensorflow.keras import backend as K # 这里目的是使用后端tensorflow from tensorflow.keras.applications.vgg16 import VGG16 from tensorflow.keras.layers import Input, Dense, Lambda from tensorflow.keras.models import Model, Sequential from te...
[ "tensorflow.keras.backend.epsilon", "numpy.array", "tensorflow.keras.layers.Dense", "numpy.mean", "tensorflow.keras.layers.Input", "os.path.exists", "tensorflow.keras.backend.mean", "tensorflow.keras.backend.maximum", "tensorflow.keras.backend.cast", "tensorflow.keras.models.Model", "tensorflow....
[((898, 914), 'tensorflow.keras.backend.square', 'K.square', (['y_pred'], {}), '(y_pred)\n', (906, 914), True, 'from tensorflow.keras import backend as K\n'), ((986, 1045), 'tensorflow.keras.backend.mean', 'K.mean', (['(y_true * square_pred + (1 - y_true) * margin_square)'], {}), '(y_true * square_pred + (1 - y_true) *...
import torch import torch.nn as nn import numpy as np import pytorch_lightning as pl import sys import os from lifelines.utils import concordance_index from sklearn.metrics import r2_score from torch.utils.data import DataLoader, TensorDataset from torchcontrib.optim import SWA from pytorch_lightning import Trainer, s...
[ "pytorch_lightning.callbacks.ModelCheckpoint", "numpy.mean", "pytorch_lightning.callbacks.EarlyStopping", "pytorch_lightning.Trainer.add_argparse_args", "argparse.ArgumentParser", "models.sfomm.SFOMM", "numpy.where", "pytorch_lightning.seed_everything", "models.sfomm.SFOMM.add_model_specific_args", ...
[((442, 464), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (457, 464), False, 'import sys\n'), ((465, 502), 'sys.path.append', 'sys.path.append', (['"""../../data/ml_mmrf"""'], {}), "('../../data/ml_mmrf')\n", (480, 502), False, 'import sys\n'), ((503, 533), 'sys.path.append', 'sys.path.appen...
# Copyright (c) 2018-2022, <NAME> # 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 of conditions and the following disclaimer. # * ...
[ "pycuda.driver.to_device", "numpy.int32", "numpy.array", "numpy.arctan2", "numpy.sin", "numpy.asarray", "cv2.blur", "pycuda.driver.mem_alloc", "numpy.intp", "numpy.cos", "pycuda.driver.from_device", "cv2.resize", "cv2.Canny", "pycuda.compiler.SourceModule", "pycuda.tools.DeviceData", "...
[((2532, 2555), 'pycuda.compiler.SourceModule', 'SourceModule', (['cuda_code'], {}), '(cuda_code)\n', (2544, 2555), False, 'from pycuda.compiler import SourceModule\n'), ((2407, 2433), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (2423, 2433), False, 'import os\n'), ((3198, 3297), 'cv2.re...
import numpy as np from typing import List, Set from .model_controllers import AdaptiveController from .controller_utils import ModelResults class AdaptiveSelector: def __init__(self, controllers: List[AdaptiveController], model_valid_results: List[ModelResult]): self._controllers = controllers ...
[ "numpy.argmin", "numpy.abs" ]
[((1500, 1530), 'numpy.abs', 'np.abs', (['(self._budgets - budget)'], {}), '(self._budgets - budget)\n', (1506, 1530), True, 'import numpy as np\n'), ((1551, 1573), 'numpy.argmin', 'np.argmin', (['budget_diff'], {}), '(budget_diff)\n', (1560, 1573), True, 'import numpy as np\n')]
from Beam import Beam from OpticalElement import Optical_element from Shape import BoundaryRectangle import numpy as np import matplotlib.pyplot as plt from numpy.testing import assert_almost_equal from Vector import Vector fx=0.5 fz=0.5 beam=Beam(5000) #beam.set_divergences_collimated() #beam.set_rectangular_spot(1...
[ "Beam.Beam", "numpy.sqrt", "matplotlib.pyplot.show", "OpticalElement.Optical_element" ]
[((246, 256), 'Beam.Beam', 'Beam', (['(5000)'], {}), '(5000)\n', (250, 256), False, 'from Beam import Beam\n'), ((410, 427), 'OpticalElement.Optical_element', 'Optical_element', ([], {}), '()\n', (425, 427), False, 'from OpticalElement import Optical_element\n'), ((647, 657), 'matplotlib.pyplot.show', 'plt.show', ([], ...
def calculate_line_diff(): # SAME LINE line1_start = (41.88695, -87.63248) line1_end = (41.88692, -87.63539) line2_start = (41.88695, -87.62951) line2_end = (41.88695, -87.63248) # NOT THE SAME LINE # line1_start = (41.87523, -87.64807) # line1_end = (41.8777, -87.64545) # line2_start = (41.87437, -87.642...
[ "numpy.random.normal", "scipy.stats.gaussian_kde", "numpy.amin", "multiprocessing.Process", "math.degrees", "sklearn.neighbors.KernelDensity", "time.sleep", "math.cos", "numpy.vstack", "numpy.rot90", "math.sin", "numpy.amax", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((2039, 2063), 'numpy.random.normal', 'np.random.normal', ([], {'size': 'n'}), '(size=n)\n', (2055, 2063), True, 'import numpy as np\n'), ((2070, 2105), 'numpy.random.normal', 'np.random.normal', ([], {'scale': '(0.5)', 'size': 'n'}), '(scale=0.5, size=n)\n', (2086, 2105), True, 'import numpy as np\n'), ((2372, 2391),...
import numpy as np import sys lines = [] for line in sys.stdin: lines.append(line.rstrip('\n')) n = int(lines[0]) count = 1 for i in range(n): size = int(lines[count]) count += 1 m = [[int(x) for x in lin.split()] for lin in lines[count:count+size]] m = np.array(m) k = np.trace(m) r = su...
[ "numpy.array", "numpy.trace" ]
[((278, 289), 'numpy.array', 'np.array', (['m'], {}), '(m)\n', (286, 289), True, 'import numpy as np\n'), ((298, 309), 'numpy.trace', 'np.trace', (['m'], {}), '(m)\n', (306, 309), True, 'import numpy as np\n')]
"""Implementation of parallel computation of the velocity integrals as a function of the integral variable y from the Gordeyev integral. """ import ctypes import multiprocessing as mp from functools import partial import numpy as np import scipy.integrate as si from isr_spectrum.inputs import config as cf def inte...
[ "multiprocessing.Array", "scipy.integrate.simps", "functools.partial", "multiprocessing.Pool", "numpy.cos", "numpy.sin" ]
[((901, 932), 'functools.partial', 'partial', (['parallel', 'params', 'v', 'f'], {}), '(parallel, params, v, f)\n', (908, 932), False, 'from functools import partial\n'), ((944, 953), 'multiprocessing.Pool', 'mp.Pool', ([], {}), '()\n', (951, 953), True, 'import multiprocessing as mp\n'), ((1261, 1277), 'scipy.integrat...
import glob import importlib import os import unittest import SimpleITK as sitk import numpy as np import sys import seg_metrics.seg_metrics as sg from parameterized import parameterized from medutils.medutils import save_itk import tempfile SUFFIX_LS = {".mhd", ".mha", ".nrrd", ".nii", ".nii.gz"} TEST_CASE1 = [{ "IM...
[ "tempfile.TemporaryDirectory", "parameterized.parameterized.expand", "numpy.testing.assert_allclose", "os.path.join", "numpy.array", "numpy.random.randint", "seg_metrics.seg_metrics.load_itk", "medutils.medutils.save_itk", "unittest.main" ]
[((780, 826), 'parameterized.parameterized.expand', 'parameterized.expand', (['[TEST_CASE1, TEST_CASE2]'], {}), '([TEST_CASE1, TEST_CASE2])\n', (800, 826), False, 'from parameterized import parameterized\n'), ((1786, 1801), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1799, 1801), False, 'import unittest\n'), (...
""" In vivo prediction robustness and first PC's """ import os import string import pandas as pd import seaborn as sns import numpy as np from .FigureCommon import getSetup, Legend, subplotLabel from ..StoneModMouseFit import InVivoPredict def makeFigure(): # Get list of axis objects ax, f = getSetup((6, 3), ...
[ "seaborn.factorplot", "seaborn.color_palette", "pandas.read_csv", "os.path.abspath", "numpy.meshgrid", "numpy.logspace" ]
[((1292, 1385), 'seaborn.factorplot', 'sns.factorplot', ([], {'x': '"""Cells"""', 'y': '"""value"""', 'hue': '"""Receptor"""', 'data': 'data', 'kind': '"""bar"""', 'ax': 'ax', 'ci': '(63)'}), "(x='Cells', y='value', hue='Receptor', data=data, kind='bar',\n ax=ax, ci=63)\n", (1306, 1385), True, 'import seaborn as sns...
import warnings import numpy as np import torch from torch import nn from torch.nn import functional as F from torch.utils.data import DataLoader from tqdm import tqdm, tqdm_notebook from itertools import chain import qucumber.cplx as cplx __all__ = [ "RBM_Module", "BinomialRBM" ] class RBM_Module(nn.Modul...
[ "itertools.chain", "numpy.sqrt", "torch.randperm", "qucumber.cplx.make_complex_vector", "torch.cuda.is_available", "torch.nn.functional.linear", "qucumber.cplx.MS_mult", "torch.distributions.bernoulli.Bernoulli", "warnings.warn", "torch.zeros_like", "qucumber.cplx.VS_mult", "torch.randn", "q...
[((3029, 3059), 'torch.mv', 'torch.mv', (['v', 'self.visible_bias'], {}), '(v, self.visible_bias)\n', (3037, 3059), False, 'import torch\n'), ((6371, 6421), 'torch.distributions.bernoulli.Bernoulli', 'torch.distributions.bernoulli.Bernoulli', ([], {'probs': '(0.5)'}), '(probs=0.5)\n', (6410, 6421), False, 'import torch...
#!/usr/bin/python # coding: utf-8 import numpy as np import netCDF4 import math import sys import time import calendar import datetime import os from math import pi from numpy import cos, sin, arccos, power, sqrt, exp,arctan2 ## Entrada path_wrf = (sys.argv[1]) filename = (sys.argv[2]) lat1 = (sys.argv[3]) lon1 = (sy...
[ "os.makedirs", "datetime.datetime.strptime", "netCDF4.Dataset", "numpy.argmax", "os.path.isfile", "numpy.exp", "os.path.isdir", "numpy.cos", "numpy.unravel_index", "numpy.savetxt", "numpy.sin", "numpy.full", "datetime.timedelta", "numpy.argmin" ]
[((453, 498), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['date2', '"""%Y%m%d%H"""'], {}), "(date2, '%Y%m%d%H')\n", (479, 498), False, 'import datetime\n'), ((507, 552), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['date3', '"""%Y%m%d%H"""'], {}), "(date3, '%Y%m%d%H')\n", (533, 552), ...
# # Data generator for training the SELDnet # import os import numpy as np import cls_feature_class from IPython import embed from collections import deque import random import parameter class DataGenerator(object): def __init__( self, datagen_mode='train', dataset='resim', ov=1, ov_num=1, split=1, d...
[ "os.listdir", "collections.deque", "random.shuffle", "numpy.where", "os.path.join", "numpy.zeros", "numpy.cos", "numpy.concatenate", "numpy.sin", "parameter.get_params", "cls_feature_class.FeatureClass" ]
[((784, 873), 'cls_feature_class.FeatureClass', 'cls_feature_class.FeatureClass', ([], {'dataset': 'dataset', 'ov': 'ov', 'split': 'split', 'db': 'db', 'nfft': 'nfft'}), '(dataset=dataset, ov=ov, split=split, db=db,\n nfft=nfft)\n', (814, 873), False, 'import cls_feature_class\n'), ((3477, 3502), 'parameter.get_para...
import math import numpy as np from gym import spaces import furuta_env_torque as fet import common as cm class FurutaEnvTorquePpo2(fet.FurutaEnvTorque): def __init__(self, state, render=False): super(FurutaEnvTorquePpo2, self).__init__(state=state, action_space=spaces.Box(np.array([-1]), np.array([1]))...
[ "numpy.array", "common.rad2Norm" ]
[((290, 304), 'numpy.array', 'np.array', (['[-1]'], {}), '([-1])\n', (298, 304), True, 'import numpy as np\n'), ((306, 319), 'numpy.array', 'np.array', (['[1]'], {}), '([1])\n', (314, 319), True, 'import numpy as np\n'), ((482, 515), 'common.rad2Norm', 'cm.rad2Norm', (['self.pole_angle_real'], {}), '(self.pole_angle_re...
from flow.envs.base_env import SumoEnvironment from flow.core import rewards from flow.controllers.car_following_models import * from gym.spaces.box import Box from gym.spaces.discrete import Discrete from gym.spaces.tuple_space import Tuple import numpy as np class SimpleLaneChangingAccelerationEnvironment(SumoEnvi...
[ "flow.core.rewards.desired_velocity", "gym.spaces.box.Box", "numpy.array", "gym.spaces.tuple_space.Tuple", "numpy.round" ]
[((1501, 1567), 'gym.spaces.box.Box', 'Box', ([], {'low': '(-np.inf)', 'high': 'np.inf', 'shape': '(self.vehicles.num_vehicles,)'}), '(low=-np.inf, high=np.inf, shape=(self.vehicles.num_vehicles,))\n', (1504, 1567), False, 'from gym.spaces.box import Box\n'), ((1583, 1660), 'gym.spaces.box.Box', 'Box', ([], {'low': '(0...
from PIL import Image import numpy as np import flask import io import base64 from os import path import cv2 from prediccion import prediccion import numpy as np import json import pruebita_svm # initialize our Flask application and the Keras model app = flask.Flask(__name__) model = None categorias = ["0", "1", "2"...
[ "prediccion.prediccion", "flask.request.args.get", "PIL.Image.open", "json.loads", "flask.Flask", "io.BytesIO", "base64.b64decode", "pruebita_svm.clf.predict", "flask.request.form.get", "numpy.array", "os.path.dirname", "cv2.cvtColor", "cv2.imread", "flask.jsonify" ]
[((258, 279), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (269, 279), False, 'import flask\n'), ((416, 428), 'prediccion.prediccion', 'prediccion', ([], {}), '()\n', (426, 428), False, 'from prediccion import prediccion\n'), ((589, 601), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (599, 601), Fa...
""" Version 1.1.2 """ from .Tokenizer import DDTokenizer from sklearn import preprocessing from .DDModelExceptions import * from tensorflow.keras import backend from .Models import Models from .Parser import Parser import tensorflow as tf import pandas as pd import numpy as np import keras import time import os import...
[ "pandas.Series", "keras.backend.one_hot", "numpy.reshape", "keras.callbacks.History", "tensorflow.keras.backend.count_params", "tensorflow.keras.optimizers.Adam", "sklearn.preprocessing.minmax_scale", "time.time", "warnings.filterwarnings" ]
[((330, 363), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (353, 363), False, 'import warnings\n'), ((3905, 3939), 'numpy.reshape', 'np.reshape', (['train_x', 'shape_train_x'], {}), '(train_x, shape_train_x)\n', (3915, 3939), True, 'import numpy as np\n'), ((3968, 4013),...