code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import matplotlib.pyplot as plt from numpy import sum, array from numpy.random import randint, choice class MonteCarlo(object): """ A simple Monte Carlo implementation """ def __init__(self, energy, density, temperature=1, itermax=1000): from numpy import any, array density = array(density) ...
[ "numpy.random.uniform", "numpy.sum", "numpy.any", "numpy.array", "numpy.exp", "numpy.random.choice" ]
[((3444, 3458), 'numpy.array', 'array', (['density'], {}), '(density)\n', (3449, 3458), False, 'from numpy import any, array\n'), ((3734, 3750), 'numpy.any', 'any', (['(density < 0)'], {}), '(density < 0)\n', (3737, 3750), False, 'from numpy import any, array\n'), ((305, 319), 'numpy.array', 'array', (['density'], {}),...
# coding: utf-8 import numpy as np from kerasy.ML.decomposition import PCA, UMAP, tSNE from kerasy.datasets import mnist from kerasy.utils import cluster_accuracy num_mnist = 300 n_components = 5 epochs = 10 seed = 123 def get_test_data(): (x_train, y_train), _ = mnist.load_data() x_train = x_train[:num_mnist...
[ "kerasy.datasets.mnist.load_data", "numpy.square", "kerasy.ML.decomposition.PCA", "kerasy.ML.decomposition.tSNE", "numpy.mean", "kerasy.ML.decomposition.UMAP", "numpy.unique" ]
[((270, 287), 'kerasy.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (285, 287), False, 'from kerasy.datasets import mnist\n'), ((746, 764), 'numpy.unique', 'np.unique', (['y_train'], {}), '(y_train)\n', (755, 764), True, 'import numpy as np\n'), ((1094, 1124), 'kerasy.ML.decomposition.PCA', 'PCA', ([]...
import leg_controllers.model as model import leg_controllers.hopper as hopper from leg_controllers.designs import Params import numpy as np class Observer(): """ An implementation of a Kalman filter for the template dynamics. The filter is provided the template state measurement, and uses the template ...
[ "numpy.array", "numpy.eye", "numpy.linalg.inv", "numpy.zeros" ]
[((526, 537), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (534, 537), True, 'import numpy as np\n'), ((560, 571), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (568, 571), True, 'import numpy as np\n'), ((593, 609), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {}), '((2, 2))\n', (601, 609), True, 'import numpy a...
# -*- coding: utf-8 -*- """ ============================= Elekta phantom data with LCMV ============================= """ # authors: Amit & Alex & Eric from __future__ import print_function import numpy as np import mne from phantom_helpers import (get_data, get_fwd, actual_pos, maxfilter_options, ...
[ "phantom_helpers.get_fwd", "mne.beamformer.lcmv", "phantom_helpers.plot_errors", "phantom_helpers.get_data", "mne.compute_covariance", "numpy.mean", "numpy.linalg.norm", "numpy.round" ]
[((486, 495), 'phantom_helpers.get_fwd', 'get_fwd', ([], {}), '()\n', (493, 495), False, 'from phantom_helpers import get_data, get_fwd, actual_pos, maxfilter_options, dipole_amplitudes, dipole_indices, plot_errors\n'), ((1470, 1497), 'phantom_helpers.plot_errors', 'plot_errors', (['errors', '"""lcmv"""'], {}), "(error...
# -*- coding: utf-8 -*- """ Created on Sun May 28 11:36:17 2017 Calculate steady state output of a linear recurrent network @author: <NAME> """ import numpy as np from numpy import linalg as LA W = np.matrix('0.6 0.1 0.1 0.1 0.1; 0.1 0.6 0.1 0.1 0.1; 0.1 0.1 0.6 0.1 0.1;\ 0.1 0.1 0.1 0.6 0.1; 0.1 0.1 ...
[ "numpy.matrix", "numpy.zeros", "numpy.linalg.eig", "numpy.empty" ]
[((202, 341), 'numpy.matrix', 'np.matrix', (['"""0.6 0.1 0.1 0.1 0.1; 0.1 0.6 0.1 0.1 0.1; 0.1 0.1 0.6 0.1 0.1; 0.1 0.1 0.1 0.6 0.1; 0.1 0.1 0.1 0.1 0.6"""'], {}), "(\n '0.6 0.1 0.1 0.1 0.1; 0.1 0.6 0.1 0.1 0.1; 0.1 0.1 0.6 0.1 0.1; 0.1 0.1 0.1 0.6 0.1; 0.1 0.1 0.1 0.1 0.6'\n )\n", (211,...
"""Sample patients from the CSV file of cBioPortal gene variants. USAGE: python sample_patients.py <MUTATION_CSV_FILE> <OUTPUT_CSV_FILE> <OPTIONAL_NUMBER_OF_PATIENTS> Corresponding Author: <NAME> Affiliation: Stanford Date: March 1, 2022 """ import csv import sys from typing import Opti...
[ "pandas.DataFrame", "csv.reader", "csv.writer", "numpy.array", "pandas.concat" ]
[((3065, 3086), 'csv.reader', 'csv.reader', (['read_file'], {}), '(read_file)\n', (3075, 3086), False, 'import csv\n'), ((1350, 1371), 'csv.reader', 'csv.reader', (['read_file'], {}), '(read_file)\n', (1360, 1371), False, 'import csv\n'), ((1393, 1430), 'csv.writer', 'csv.writer', (['write_file'], {'delimiter': '""",""...
from sklearn import metrics from sklearn.cross_validation import train_test_split from sklearn.utils import shuffle import numpy as np import time class Cross_Validation: """ This class contains utility methods to compute Cross Validation """ """ Takes the following parameters as an input: ve...
[ "numpy.average", "numpy.std", "sklearn.metrics.accuracy_score", "numpy.ones", "time.time", "numpy.concatenate" ]
[((1099, 1135), 'numpy.ones', 'np.ones', (['vector.shape[0]'], {'dtype': 'bool'}), '(vector.shape[0], dtype=bool)\n', (1106, 1135), True, 'import numpy as np\n'), ((1289, 1335), 'numpy.concatenate', 'np.concatenate', (['(vector[:start], vector[end:])'], {}), '((vector[:start], vector[end:]))\n', (1303, 1335), True, 'im...
import random import cv2 import numpy as np from PIL import Image from time import sleep # Tetris game class class Tetris: '''Tetris game class''' # BOARD MAP_EMPTY = 0 MAP_BLOCK = 1 MAP_PLAYER = 2 BOARD_WIDTH = 10 BOARD_HEIGHT = 20 TETROMINOS = { 0: { ...
[ "cv2.waitKey", "random.shuffle", "time.sleep", "numpy.array", "PIL.Image.fromarray", "numpy.add" ]
[((2387, 2411), 'random.shuffle', 'random.shuffle', (['self.bag'], {}), '(self.bag)\n', (2401, 2411), False, 'import random\n'), ((9906, 9933), 'PIL.Image.fromarray', 'Image.fromarray', (['img', '"""RGB"""'], {}), "(img, 'RGB')\n", (9921, 9933), False, 'from PIL import Image\n'), ((10043, 10056), 'numpy.array', 'np.arr...
"""Word/Symbol level next step prediction using Recurrent Highway Networks. To run: $ python rhn_train.py """ from __future__ import absolute_import, division, print_function from copy import deepcopy import time import os import numpy as np import tensorflow as tf from sacred import Experiment from rhn import Mode...
[ "os.mkdir", "numpy.random.seed", "numpy.random.random_sample", "data.reader.data_iterator", "data.reader.enwik8_raw_data", "numpy.ones", "numpy.argmin", "numpy.clip", "numpy.exp", "data.reader.text8_raw_data", "tensorflow.random_uniform_initializer", "data.reader.ptb_raw_data", "tensorflow.v...
[((366, 394), 'sacred.Experiment', 'Experiment', (['"""rhn_prediction"""'], {}), "('rhn_prediction')\n", (376, 394), False, 'from sacred import Experiment\n'), ((4410, 4421), 'time.time', 'time.time', ([], {}), '()\n', (4419, 4421), False, 'import time\n'), ((5313, 5334), 'numpy.exp', 'np.exp', (['(costs / iters)'], {}...
""" - Version 1.3: Due to the current Rush/Cheese Meta, I implemented a more defensive build order and in return deactivated the 2-Base Immortal BO. - Version 1.4: Switched from randomly chosen build orders to scouting based build order. Yet, still not completely with a neural network but with basic rules, provided by...
[ "keras.models.load_model", "sc2.position.Point2", "s2clientprotocol.raw_pb2.ActionRawUnitCommand", "time.time", "s2clientprotocol.sc2api_pb2.Action", "random.randrange", "numpy.array", "s2clientprotocol.raw_pb2.ActionRaw", "sharpy.plans.StepBuildGas" ]
[((39181, 39203), 'random.randrange', 'random.randrange', (['(0)', '(2)'], {}), '(0, 2)\n', (39197, 39203), False, 'import random\n'), ((4148, 4197), 'keras.models.load_model', 'keras.models.load_model', (['"""MadAI/MadAI_06_03_2020"""'], {}), "('MadAI/MadAI_06_03_2020')\n", (4171, 4197), False, 'import keras\n'), ((42...
import unittest from random import Random import numpy as np from infinitd_server.game_config import CellPos, Row, Col from infinitd_server.battleground_state import BattlegroundState, BgTowersState, BgTowerState from infinitd_server.paths import makePathMap, compressPath, PathMap, pathExists def emptyBattleground(r...
[ "random.Random", "numpy.asarray", "infinitd_server.paths.makePathMap", "infinitd_server.battleground_state.BgTowerState", "infinitd_server.game_config.Col", "infinitd_server.paths.compressPath", "infinitd_server.game_config.Row" ]
[((665, 702), 'infinitd_server.paths.makePathMap', 'makePathMap', (['battleground', 'start', 'end'], {}), '(battleground, start, end)\n', (676, 702), False, 'from infinitd_server.paths import makePathMap, compressPath, PathMap, pathExists\n'), ((1685, 1722), 'infinitd_server.paths.makePathMap', 'makePathMap', (['battle...
import numpy as np from gym import utils from gym.envs.mujoco import mujoco_env_pixel import mujoco_py from mujoco_py.mjlib import mjlib from skimage import color from skimage import transform class PusherEnvPixel(mujoco_env_pixel.MujocoEnvPixel, utils.EzPickle): def __init__(self): self.memory = np.empt...
[ "gym.envs.mujoco.mujoco_env_pixel.MujocoEnvPixel.__init__", "skimage.color.rgb2gray", "numpy.empty", "numpy.asarray", "numpy.square", "numpy.flipud", "skimage.transform.resize", "numpy.reshape", "numpy.linalg.norm", "numpy.fromstring", "gym.utils.EzPickle.__init__" ]
[((313, 350), 'numpy.empty', 'np.empty', (['[84, 84, 4]'], {'dtype': 'np.uint8'}), '([84, 84, 4], dtype=np.uint8)\n', (321, 350), True, 'import numpy as np\n'), ((356, 385), 'gym.utils.EzPickle.__init__', 'utils.EzPickle.__init__', (['self'], {}), '(self)\n', (379, 385), False, 'from gym import utils\n'), ((394, 457), ...
""" Dataset object for PubChem BioAssay dataset. The data is given in the DeepChem package (https://github.com/deepchem/deepchem), and the details can be found here: https://deepchem.readthedocs.io/en/latest/api_reference/moleculenet.html?highlight=PCBA#pcba-datasets. """ import os import random import json import gzi...
[ "numpy.sum", "pandas.read_csv", "random.shuffle", "os.path.isfile", "os.path.join", "deepchem.feat.CircularFingerprint", "os.path.dirname", "torch.utils.data.Dataset.__init__", "meta.datasets.utils.get_split", "sklearn.metrics.average_precision_score", "json.dump", "torch.logical_or", "sklea...
[((977, 1005), 'numpy.array', 'np.array', (['[30269634, 427685]'], {}), '([30269634, 427685])\n', (985, 1005), True, 'import numpy as np\n'), ((10530, 10555), 'torch.nn.functional.softmax', 'F.softmax', (['outputs'], {'dim': '(2)'}), '(outputs, dim=2)\n', (10539, 10555), True, 'import torch.nn.functional as F\n'), ((10...
import numpy as np from scipy import stats from sklearn.metrics import mean_absolute_error, mean_squared_error, mean_absolute_percentage_error from sklearn.metrics import roc_auc_score, average_precision_score, f1_score, brier_score_loss, confusion_matrix from .base_verification import * from scipy.special import ndtr ...
[ "numpy.meshgrid", "numpy.sum", "numpy.log", "numpy.argmax", "numpy.asarray", "numpy.zeros", "numpy.ones", "numpy.cumsum", "numpy.min", "numpy.arange", "numpy.nanmean", "numpy.squeeze", "numpy.delete", "numpy.sqrt" ]
[((897, 933), 'numpy.zeros', 'np.zeros', (['(predictions1.shape[0], 1)'], {}), '((predictions1.shape[0], 1))\n', (905, 933), True, 'import numpy as np\n'), ((1352, 1379), 'numpy.argmax', 'np.argmax', (['observed'], {'axis': '(1)'}), '(observed, axis=1)\n', (1361, 1379), True, 'import numpy as np\n'), ((1606, 1623), 'nu...
import numpy as np from stats import ( questions_complexity, player2idx, ) from scipy import sparse def team_answer_estimation( dataset: dict, player_to_idx: dict, prediction: list, ) -> list: count = 0 result = [] for tournament in dataset: for team in dataset[tournamen...
[ "stats.player2idx", "numpy.array", "numpy.prod" ]
[((757, 773), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (765, 773), True, 'import numpy as np\n'), ((2025, 2052), 'stats.player2idx', 'player2idx', (['dataset', 'n_team'], {}), '(dataset, n_team)\n', (2035, 2052), False, 'from stats import questions_complexity, player2idx\n'), ((3059, 3076), 'numpy.arr...
from hypothesis import given from hypothesis.strategies import composite, integers import mf2 import numpy as np import pandas as pd from pytest import approx from scipy.special import binom from sklearn.metrics import mean_squared_error import xarray as xr from pyprojroot import here import sys module_path = str(here...
[ "sys.path.append", "scipy.special.binom", "numpy.random.seed", "multiLevelCoSurrogates.CandidateArchive.from_multi_fidelity_function", "multiLevelCoSurrogates.bi_fidelity_doe", "experiments.scale_to_function", "numpy.isfinite", "multiLevelCoSurrogates.set_seed_by_instance", "multiLevelCoSurrogates.M...
[((316, 343), 'pyprojroot.here', 'here', (['"""scripts/experiments"""'], {}), "('scripts/experiments')\n", (320, 343), False, 'from pyprojroot import here\n'), ((381, 409), 'sys.path.append', 'sys.path.append', (['module_path'], {}), '(module_path)\n', (396, 409), False, 'import sys\n'), ((517, 541), 'numpy.random.seed...
import os from mrcnn.utils import Dataset from skimage.color import gray2rgb import pandas as pd import pydicom import numpy as np class PneumoniaDataset(Dataset): def __init__(self, data_dir, mode): assert mode in ['dev', 'val', 'train', 'test'] super().__init__(self) self.data_dir = dat...
[ "pydicom.read_file", "numpy.zeros", "skimage.color.gray2rgb", "os.path.join", "os.listdir" ]
[((2177, 2190), 'skimage.color.gray2rgb', 'gray2rgb', (['img'], {}), '(img)\n', (2185, 2190), False, 'from skimage.color import gray2rgb\n'), ((2411, 2441), 'numpy.zeros', 'np.zeros', (['(1024, 1024, n_mask)'], {}), '((1024, 1024, n_mask))\n', (2419, 2441), True, 'import numpy as np\n'), ((2463, 2479), 'numpy.zeros', '...
import collections import itertools import time import numpy as np from ..exceptions import ValidationError from ..models import AlignmentMill from ..physical_constants import constants from ..testing import compare_values from ..util import distance_matrix, linear_sum_assignment, random_rotation_matrix, uno, which_i...
[ "numpy.sum", "numpy.random.random_sample", "numpy.allclose", "numpy.reciprocal", "numpy.ones", "collections.defaultdict", "numpy.around", "numpy.arange", "numpy.linalg.norm", "numpy.copy", "itertools.permutations", "numpy.identity", "numpy.random.shuffle", "numpy.asarray", "numpy.argwher...
[((6800, 6811), 'time.time', 'time.time', ([], {}), '()\n', (6809, 6811), False, 'import time\n'), ((9304, 9315), 'time.time', 'time.time', ([], {}), '()\n', (9313, 9315), False, 'import time\n'), ((11996, 12025), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (12019, 12025), False, '...
from spektral.layers import GraphConv, ChebConv, EdgeConditionedConv, GraphAttention, GraphConvSkip, ARMAConv, APPNP, \ GraphSageConv from keras import backend as K, Model, Input import numpy as np import tensorflow as tf SINGLE, BATCH, MIXED = 1, 2, 3 # Single, batch, mixed LAYER_K_, MODES_K_, KWARGS_K_ = 'layer...
[ "numpy.stack", "keras.Input", "keras.Model", "keras.backend.get_session", "tensorflow.global_variables_initializer", "numpy.ones", "numpy.random.normal" ]
[((1378, 1393), 'keras.backend.get_session', 'K.get_session', ([], {}), '()\n', (1391, 1393), True, 'from keras import backend as K, Model, Input\n'), ((1434, 1449), 'numpy.ones', 'np.ones', (['(N, N)'], {}), '((N, N))\n', (1441, 1449), True, 'import numpy as np\n'), ((1454, 1483), 'numpy.random.normal', 'np.random.nor...
#!/usr/bin/env python # coding: utf-8 import os import csv import pdb import librosa import ml_metrics import numpy as np import scipy as sp import soundfile as sf import IPython.display as ipd import matplotlib.pyplot as plt from scipy.stats.stats import pearsonr from sklearn.linear_model import LogisticRegression ...
[ "numpy.load", "matplotlib.pyplot.show", "numpy.count_nonzero", "numpy.random.seed", "scipy.spatial.distance.euclidean", "numpy.std", "matplotlib.pyplot.legend", "numpy.zeros", "numpy.reciprocal", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.mean", "numpy.array", "numpy.arange", "n...
[((3343, 3355), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (3353, 3355), True, 'import matplotlib.pyplot as plt\n'), ((3828, 3840), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (3838, 3840), True, 'import matplotlib.pyplot as plt\n'), ((3841, 3851), 'matplotlib.pyplot.show', 'plt.show', ...
# general import logging import json import os import random import math from collections import defaultdict, Counter import glob import shutil, io, base64 from typing import OrderedDict # general package from natsort import natsorted import pandas as pd import numpy as np import regex as re import h5py # image impo...
[ "numpy.load", "numpy.sum", "numpy.nan_to_num", "typing.OrderedDict", "collections.defaultdict", "logging.Formatter", "matplotlib.pyplot.figure", "progressbar.Percentage", "numpy.linalg.norm", "numpy.mean", "matplotlib.pyplot.gca", "numpy.unique", "pandas.DataFrame", "numpy.multiply", "nu...
[((1433, 1445), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (1443, 1445), True, 'import networkx as nx\n'), ((1530, 1547), 'numpy.load', 'np.load', (['filepath'], {}), '(filepath)\n', (1537, 1547), True, 'import numpy as np\n'), ((1764, 1773), 'collections.Counter', 'Counter', ([], {}), '()\n', (1771, 1773), Fa...
from copy import deepcopy from functools import partial from random import choice, randint, random, sample from typing import Any, Callable, List, TYPE_CHECKING, Union import numpy as np from fedot.core.composer.constraint import constraint_function from fedot.core.log import Log from fedot.core.optimisers.gp_comp.gp...
[ "functools.partial", "copy.deepcopy", "random.randint", "fedot.core.composer.constraint.constraint_function", "random.sample", "fedot.core.optimisers.gp_comp.gp_operators.random_graph", "fedot.core.optimisers.gp_comp.individual.Individual", "random.choice", "random.random", "numpy.random.lognormal...
[((2347, 2360), 'random.choice', 'choice', (['types'], {}), '(types)\n', (2353, 2360), False, 'from random import choice, randint, random, sample\n'), ((6055, 6068), 'copy.deepcopy', 'deepcopy', (['ind'], {}), '(ind)\n', (6063, 6068), False, 'from copy import deepcopy\n'), ((7510, 7525), 'copy.deepcopy', 'deepcopy', ([...
# (c) 2018-2021, <NAME> @ ETH Zurich # Computer-assisted Applications in Medicine (CAiM) Group, Prof. <NAME> import numpy as np import os from data_read.imarisfiles import ImarisFiles from skimage.transform import resize from utils.im_processing import interp3 from data_read.spots import Spots import logging log...
[ "data_read.imarisfiles.ImarisFiles", "numpy.flip", "numpy.ceil", "data_read.spots.Spots", "numpy.empty", "data_read.spots.Spots.gt_match_um", "utils.im_processing.interp3", "numpy.array", "os.path.splitext", "numpy.arange", "skimage.transform.resize", "numpy.round", "logging.getLogger", "n...
[((326, 353), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (343, 353), False, 'import logging\n'), ((6300, 6359), 'data_read.spots.Spots.gt_match_um', 'Spots.gt_match_um', ([], {'Xgt': 'Xgt_um', 'Xpred': 'Xf_um', 'rmatch': 'spot_rad'}), '(Xgt=Xgt_um, Xpred=Xf_um, rmatch=spot_rad)\n', (6...
# -*- coding: utf-8 -*- # @author: songjie # @email: <EMAIL> # @date: 2021/03/24 # SJ编程规范 # 命名: # 1. 见名思意,变量的名字必须准确反映它的含义和内容 # 2. 遵循当前语言的变量命名规则 # 3. 不要对不同使用目的的变量使用同一个变量名 # 4. 同个项目不要使用不同名称表述同个东西 # 5. 函数/方法 使用动词+名词组合,其它使用名词组合 # 设计原则: # 1. KISS原则: Keep it simple and stupid ! # 2. SOLID原则: S: 单一职责...
[ "calendar.monthcalendar", "pandas.merge", "sklearn.preprocessing.LabelEncoder", "itertools.product", "calendar.monthrange", "numpy.vstack" ]
[((3137, 3192), 'pandas.merge', 'pd.merge', (['items_df', 'item_cats_df'], {'on': '"""item_category_id"""'}), "(items_df, item_cats_df, on='item_category_id')\n", (3145, 3192), True, 'import pandas as pd\n'), ((4910, 4971), 'pandas.merge', 'pd.merge', (['feature_matrix_df', 'group'], {'on': 'index_cols', 'how': '"""lef...
# Princeton University licenses this file to You 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 in writin...
[ "psyneulink.core.components.functions.transferfunctions.Identity", "psyneulink.core.components.component.parameter_keywords.update", "psyneulink.core.components.functions.statefulfunctions.integratorfunctions.AccumulatorIntegrator", "inspect.isclass", "psyneulink.core.components.functions.transferfunctions....
[((19377, 19424), 'psyneulink.core.components.component.parameter_keywords.update', 'parameter_keywords.update', (['{MAPPING_PROJECTION}'], {}), '({MAPPING_PROJECTION})\n', (19402, 19424), False, 'from psyneulink.core.components.component import parameter_keywords\n'), ((19425, 19473), 'psyneulink.core.components.proje...
# encoding = utf-8 import requests import json import jieba from pandas import DataFrame import pandas as pd import numpy as np def getnews(pages): global newsbag newsbag = [] for page in range(1, pages + 1): raw_url = 'http://api.roll.news.sina.com.cn/zt_list?channel=news&cat_1=gnxw&ca...
[ "pandas.DataFrame", "numpy.asarray", "jieba.cut", "requests.get" ]
[((1689, 1718), 'numpy.asarray', 'np.asarray', (['final_count_local'], {}), '(final_count_local)\n', (1699, 1718), True, 'import numpy as np\n'), ((1726, 1773), 'pandas.DataFrame', 'pd.DataFrame', (['dataNumPy'], {'columns': "['地名', '出现次数']"}), "(dataNumPy, columns=['地名', '出现次数'])\n", (1738, 1773), True, 'import pandas...
#!/usr/bin/env python ############################################################################### # - FILE: benchmark_linegraph # - DESC: Render benchmark scores as a line graph ############################################################################### import sys import os import numpy as np import cv2 as ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.savefig", "matplotlib.pyplot.plot", "os.getcwd", "matplotlib.pyplot.yticks", "matplotlib.pyplot.ylabel", "numpy.log10", "matplotlib.pyplot.xticks", "sys.exit", "matplotlib.pyplot.xlabel" ]
[((427, 438), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (436, 438), False, 'import os\n'), ((886, 908), 'sys.exit', 'sys.exit', (['EXIT_SUCCESS'], {}), '(EXIT_SUCCESS)\n', (894, 908), False, 'import sys\n'), ((2174, 2194), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(2)', '(1)', '(1)'], {}), '(2, 1, 1)\n', (2185, ...
"""Trajectory interpolation utility module. Provides two main interpolation methods: - linear - minimum jerk """ from enum import Enum from typing import Callable, Optional import numpy as np InterpolationFunc = Callable[[float], np.ndarray] def linear( starting_position: np.ndarray, goal_position: np.nd...
[ "numpy.zeros", "numpy.linalg.solve", "numpy.array" ]
[((1581, 1659), 'numpy.array', 'np.array', (['((d3, d4, d5), (3 * d2, 4 * d3, 5 * d4), (6 * d1, 12 * d2, 20 * d3))'], {}), '(((d3, d4, d5), (3 * d2, 4 * d3, 5 * d4), (6 * d1, 12 * d2, 20 * d3)))\n', (1589, 1659), True, 'import numpy as np\n'), ((1698, 1816), 'numpy.array', 'np.array', (['(goal_position - a0 - a1 * d1 -...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 10 21:16:47 2019 @author: self-driver """ import numpy as np import matplotlib.pyplot as plt from pylab import mpl import math ''' x = [3, 4.5, 7, 9] SizeOfX = len(x) paremeter = [] i = 1 while i < SizeOfX: data = np.zeros((n * (SizeOfX))...
[ "numpy.zeros", "math.factorial" ]
[((584, 603), 'numpy.zeros', 'np.zeros', (['(order + 1)'], {}), '(order + 1)\n', (592, 603), True, 'import numpy as np\n'), ((615, 634), 'numpy.zeros', 'np.zeros', (['(order + 1)'], {}), '(order + 1)\n', (623, 634), True, 'import numpy as np\n'), ((644, 663), 'numpy.zeros', 'np.zeros', (['(order + 1)'], {}), '(order + ...
# -*- coding: utf-8 -*- """ Created on Fri Nov 29 12:35:19 2019 @author: HCHO """ from DouglasPeucker import * import sys import os import math import pandas as pd import numpy as np #命令行输入车道路径,如python LaneTracking.py lane/1.txt #后面按代码规范修改下 if __name__=="__main__": #lane_path = sys.argv[1] #print(lane_...
[ "numpy.ceil", "math.ceil", "pandas.read_csv", "os.path.dirname", "numpy.floor", "os.listdir" ]
[((425, 451), 'os.path.dirname', 'os.path.dirname', (['lane_path'], {}), '(lane_path)\n', (440, 451), False, 'import os\n'), ((468, 491), 'os.listdir', 'os.listdir', (['father_path'], {}), '(father_path)\n', (478, 491), False, 'import os\n'), ((870, 955), 'pandas.read_csv', 'pd.read_csv', (['after_lane_path'], {'header...
#!/ur/bin/python # -*- coding: utf-8 -*- """ @author: <NAME> iBEAt study T2* model fit 2021 """ import numpy as np import pydicom from scipy.optimize import curve_fit def read_and_sort_echo_times(fname,lstFilesDCM): """ This function provides sorted list of DICOMs from a sorted list of T2* echo times (TE). A...
[ "pydicom.dcmread", "scipy.optimize.curve_fit", "numpy.argsort", "numpy.max", "numpy.exp" ]
[((842, 864), 'numpy.argsort', 'np.argsort', (['echo_times'], {}), '(echo_times)\n', (852, 864), True, 'import numpy as np\n'), ((2190, 2308), 'scipy.optimize.curve_fit', 'curve_fit', (['exp_func'], {'xdata': 'echo_times', 'ydata': 'images_to_be_fitted', 'p0': 'initial_guess', 'bounds': '(lb, ub)', 'method': '"""trf"""...
import os import numpy as np from sklearn.externals import joblib from . import features from .features import loudness, mfcc, onsetflux, onsetcsd, onsethfc feature_modules = [features.loudness, features.mfcc, features.onsetflux, features.onsetcsd, features.onsethfc] class DownbeatTracker: """ Detects the ...
[ "numpy.argmax", "os.path.dirname", "numpy.append", "numpy.max", "numpy.min", "numpy.array" ]
[((1802, 1844), 'numpy.max', 'np.max', (['FRAME_INDEXER_MIN', 'trim_start_beat'], {}), '(FRAME_INDEXER_MIN, trim_start_beat)\n', (1808, 1844), True, 'import numpy as np\n'), ((1867, 1907), 'numpy.min', 'np.min', (['FRAME_INDEXER_MAX', 'trim_end_beat'], {}), '(FRAME_INDEXER_MAX, trim_end_beat)\n', (1873, 1907), True, 'i...
"""rio-tiler colormap functions and classes.""" import os import pathlib import re from typing import Dict, List, Sequence, Tuple, Union import attr import numpy from .constants import NumType from .errors import ( ColorMapAlreadyRegistered, InvalidColorFormat, InvalidColorMapName, InvalidFormat, ) ...
[ "numpy.load", "attr.Factory", "attr.s", "numpy.transpose", "numpy.zeros", "re.match", "importlib_resources.files", "os.environ.get", "pathlib.Path" ]
[((763, 805), 'os.environ.get', 'os.environ.get', (['"""COLORMAP_DIRECTORY"""', 'None'], {}), "('COLORMAP_DIRECTORY', None)\n", (777, 805), False, 'import os\n'), ((7628, 7647), 'attr.s', 'attr.s', ([], {'frozen': '(True)'}), '(frozen=True)\n', (7634, 7647), False, 'import attr\n'), ((1985, 2031), 'numpy.zeros', 'numpy...
import warnings warnings.filterwarnings('ignore') import numpy as np import matplotlib.pyplot as plt import vtk as v from scipy.spatial import Delaunay from vtk.numpy_interface import dataset_adapter as dsa from vtk.numpy_interface import algorithms as alg def numpy2PolyData(data): vtkArr = dsa.numpyTovtkDataArray...
[ "vtk.vtkPolyDataReader", "numpy.arctan2", "vtk.vtkPoints", "numpy.around", "numpy.mean", "vtk.numpy_interface.dataset_adapter.WrapDataObject", "matplotlib.pyplot.tight_layout", "vtk.numpy_interface.algorithms.norm", "vtk.vtkIdList", "numpy.append", "vtk.numpy_interface.dataset_adapter.numpyTovtk...
[((16, 49), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (39, 49), False, 'import warnings\n'), ((2092, 2113), 'vtk.vtkPolyDataReader', 'v.vtkPolyDataReader', ([], {}), '()\n', (2111, 2113), True, 'import vtk as v\n'), ((2179, 2204), 'vtk.numpy_interface.dataset_adapter....
from __future__ import division, print_function from hscom import __common__ (print, print_, print_on, print_off, rrr, profile) = __common__.init(__name__, '[extern_feat]') # Standard import os import sys from os.path import dirname, realpath, join # Scientific import numpy as np OLD_HESAFF = False or '--oldhesaff' i...
[ "imp.reload", "os.path.realpath", "os.path.dirname", "os.path.exists", "hstpl.extern_feat.pyhesaff.detect_kpts", "numpy.savez", "os.path.join", "hscom.__common__.init" ]
[((131, 173), 'hscom.__common__.init', '__common__.init', (['__name__', '"""[extern_feat]"""'], {}), "(__name__, '[extern_feat]')\n", (146, 173), False, 'from hscom import __common__\n'), ((849, 883), 'os.path.join', 'join', (['EXE_PATH', "('hesaff' + EXE_EXT)"], {}), "(EXE_PATH, 'hesaff' + EXE_EXT)\n", (853, 883), Fal...
#!/usr/bin/env python # -*- coding: utf-8 -*- """SpeciesEvolver tests.""" from collections import Counter import numpy as np import pandas as pd import pytest from landlab import RasterModelGrid from landlab.components import SpeciesEvolver from landlab.components.species_evolution.base_taxon import Taxon class Tes...
[ "pandas.DataFrame", "pandas.testing.assert_frame_equal", "landlab.components.SpeciesEvolver", "landlab.RasterModelGrid", "numpy.testing.assert_raises", "numpy.testing.assert_array_equal", "pytest.fixture", "numpy.zeros", "numpy.array", "numpy.testing.assert_equal", "collections.Counter" ]
[((796, 812), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (810, 812), False, 'import pytest\n'), ((849, 875), 'landlab.RasterModelGrid', 'RasterModelGrid', (['(3, 3)', '(1)'], {}), '((3, 3), 1)\n', (864, 875), False, 'from landlab import RasterModelGrid\n'), ((952, 985), 'landlab.components.SpeciesEvolver', '...
import matplotlib.pyplot as plt import numpy as np import os, glob #nBins = int(input('Give number of bins: ')) nBins = 100 datasetSize = 50000 error = 0.03 datafiles = [a for a in os.listdir() if a.endswith('50000.txt') and not(a.startswith('time'))] n = len(datafiles) print(datafiles) data = {} for i, file in enu...
[ "matplotlib.pyplot.axvline", "numpy.full_like", "matplotlib.pyplot.yticks", "numpy.mean", "os.listdir", "matplotlib.pyplot.savefig" ]
[((747, 768), 'matplotlib.pyplot.axvline', 'plt.axvline', ([], {'x': '(-error)'}), '(x=-error)\n', (758, 768), True, 'import matplotlib.pyplot as plt\n'), ((769, 789), 'matplotlib.pyplot.axvline', 'plt.axvline', ([], {'x': 'error'}), '(x=error)\n', (780, 789), True, 'import matplotlib.pyplot as plt\n'), ((826, 942), 'm...
"""Class decorators and other helpers.""" import numpy as np import inspect from vectorbt.utils import checks from vectorbt.utils.config import merge_dicts def get_kwargs(func): """Get names and default values of keyword arguments from the signature of `func`.""" return { k: v.default for k,...
[ "numpy.multiply", "numpy.subtract", "numpy.true_divide", "numpy.power", "numpy.floor_divide", "numpy.bitwise_xor", "numpy.mod", "vectorbt.utils.checks.assert_type", "inspect.signature", "numpy.bitwise_and", "numpy.add", "vectorbt.utils.config.merge_dicts", "numpy.bitwise_or" ]
[((846, 877), 'vectorbt.utils.checks.assert_type', 'checks.assert_type', (['info', 'tuple'], {}), '(info, tuple)\n', (864, 877), False, 'from vectorbt.utils import checks\n'), ((2449, 2475), 'inspect.signature', 'inspect.signature', (['nb_func'], {}), '(nb_func)\n', (2466, 2475), False, 'import inspect\n'), ((4298, 431...
# -*- coding: utf-8 -*- # Copyright (c) 2019 - now, Eggroll Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
[ "eggroll.roll_pair.test.roll_pair_test_assets.get_cluster_context", "random.randint", "eggroll.core.session.ErSession", "eggroll.roll_pair.test.roll_pair_test_assets.get_standalone_context", "eggroll.roll_pair.test.roll_pair_test_assets.get_default_options", "numpy.array", "eggroll.core.utils.time_now",...
[((1081, 1105), 'eggroll.roll_pair.test.roll_pair_test_assets.get_debug_test_context', 'get_debug_test_context', ([], {}), '()\n', (1103, 1105), False, 'from eggroll.roll_pair.test.roll_pair_test_assets import get_debug_test_context, get_cluster_context, get_standalone_context, get_default_options\n'), ((6738, 6759), '...
from snsql import * import pandas as pd import numpy as np privacy = Privacy(epsilon=3.0, delta=0.1) class TestPreAggregatedSuccess: # Test input checks for pre_aggregated def test_list_success(self, test_databases): # pass in properly formatted list pre_aggregated = [ ('keycount'...
[ "pandas.DataFrame", "numpy.array" ]
[((1107, 1156), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'pre_aggregated[1:]', 'index': 'None'}), '(data=pre_aggregated[1:], index=None)\n', (1119, 1156), True, 'import pandas as pd\n'), ((1902, 1951), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'pre_aggregated[1:]', 'index': 'None'}), '(data=pre_aggrega...
import message_queue as mq # -*- coding: utf-8 -*- print("Loading HaasoscopeLib.py") from HaasoscopeOversampleLib import HaasoscopeOversample as hos from serial import Serial, SerialException from struct import unpack import numpy as np import time, json, os import matplotlib from const import * import threading mearm...
[ "numpy.sum", "numpy.arctan2", "numpy.argmax", "numpy.mean", "matplotlib.pyplot.get_backend", "numpy.arange", "numpy.sin", "serial.Serial", "numpy.multiply", "numpy.std", "matplotlib.pyplot.close", "numpy.fft.fft", "os.uname", "message_queue.Adapter", "threading.Lock", "numpy.max", "n...
[((725, 749), 'matplotlib.use', 'matplotlib.use', (['"""Qt4Agg"""'], {}), "('Qt4Agg')\n", (739, 749), False, 'import matplotlib\n'), ((47662, 47673), 'time.time', 'time.time', ([], {}), '()\n', (47671, 47673), False, 'import time, json, os\n'), ((47687, 47698), 'time.time', 'time.time', ([], {}), '()\n', (47696, 47698)...
""" 思路: 输入一个json, 把他的字段改成poly, 再集成成segementation字段, 然后输出一个json字段 """ import itertools import json import numpy as np def bezier_to_poly(bezier): # bezier to polygon u = np.linspace(0, 1, 20) bezier = np.array(bezier) bezier = bezier.reshape(2, 4, 2).transpose(0, 2, 1).reshape(4...
[ "json.dump", "numpy.outer", "json.load", "numpy.array", "numpy.linspace", "itertools.chain.from_iterable", "numpy.concatenate" ]
[((201, 222), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(20)'], {}), '(0, 1, 20)\n', (212, 222), True, 'import numpy as np\n'), ((237, 253), 'numpy.array', 'np.array', (['bezier'], {}), '(bezier)\n', (245, 253), True, 'import numpy as np\n'), ((569, 626), 'numpy.concatenate', 'np.concatenate', (['(points[:, :2]...
#! /usr/bin/env python import sys import xacro import numpy as np import xml.etree.ElementTree as ET import xml.dom.minidom def xacro_macro(doc, name, params): return ET.SubElement(doc, 'xacro:macro', {'name' : name, 'params' : params}) def xacro_include(doc, filename): return ET.SubElement(doc, 'xacro:incl...
[ "xml.etree.ElementTree.Element", "xml.etree.ElementTree.tostring", "numpy.deg2rad", "xml.etree.ElementTree.SubElement" ]
[((174, 241), 'xml.etree.ElementTree.SubElement', 'ET.SubElement', (['doc', '"""xacro:macro"""', "{'name': name, 'params': params}"], {}), "(doc, 'xacro:macro', {'name': name, 'params': params})\n", (187, 241), True, 'import xml.etree.ElementTree as ET\n'), ((290, 349), 'xml.etree.ElementTree.SubElement', 'ET.SubElemen...
from PIL import Image import os import json import random import torchvision.transforms.functional as FT import torch import math import numpy as np device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # Some constants rgb_weights = torch.FloatTensor([65.481, 128.553, 24.966]).to(device) imagenet_mea...
[ "json.dump", "torchvision.transforms.functional.to_tensor", "random.randint", "torch.FloatTensor", "torchvision.transforms.functional.pad", "PIL.Image.open", "torch.save", "torchvision.transforms.functional.to_pil_image", "numpy.max", "torch.cuda.is_available", "os.path.join", "os.listdir" ]
[((8802, 8829), 'torch.save', 'torch.save', (['state', 'filename'], {}), '(state, filename)\n', (8812, 8829), False, 'import torch\n'), ((9393, 9415), 'numpy.max', 'np.max', (['[h, crop_size]'], {}), '([h, crop_size])\n', (9399, 9415), True, 'import numpy as np\n'), ((9428, 9450), 'numpy.max', 'np.max', (['[w, crop_siz...
import argparse import os import ndreg from ndreg import preprocessor, util import numpy as np import SimpleITK as sitk from intern.remote.boss import BossRemote from intern.resource.boss.resource import * import time import requests dimension = 3 vectorComponentType = sitk.sitkFloat32 vectorType = sitk.sitkVectorFlo...
[ "argparse.ArgumentParser", "SimpleITK.AffineTransform", "numpy.asarray", "SimpleITK.GetArrayFromImage", "time.time", "intern.remote.boss.BossRemote", "requests.get", "SimpleITK.GetImageFromArray", "ndreg.util.imgCollapseDimension", "ndreg.preprocessor.correct_bias_field", "os.path.expanduser" ]
[((334, 365), 'SimpleITK.AffineTransform', 'sitk.AffineTransform', (['dimension'], {}), '(dimension)\n', (354, 365), True, 'import SimpleITK as sitk\n'), ((608, 639), 'SimpleITK.AffineTransform', 'sitk.AffineTransform', (['dimension'], {}), '(dimension)\n', (628, 639), True, 'import SimpleITK as sitk\n'), ((2964, 2997)...
''' Create the Sounding (Profile) Object ''' from __future__ import division import numpy as np import numpy.ma as ma import getpass from datetime import datetime from sharppy.sharptab import utils, winds, params, interp, thermo, watch_type, fire import sharppy.io.qc_tools as qc_tools from sharppy.databases.sars import...
[ "sharppy.sharptab.watch_type.possible_watch", "sharppy.sharptab.winds.wind_shear", "sharppy.sharptab.interp.vec", "sharppy.sharptab.thermo.mixratio", "sharppy.sharptab.params.k_index", "sharppy.sharptab.winds.sr_wind", "sharppy.sharptab.winds.helicity", "sharppy.sharptab.params.mburst", "sharppy.sha...
[((8481, 8498), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (8496, 8498), False, 'from datetime import datetime\n'), ((8545, 8562), 'getpass.getuser', 'getpass.getuser', ([], {}), '()\n', (8560, 8562), False, 'import getpass\n'), ((13734, 13775), 'sharppy.io.qc_tools.areProfileArrayLengthEqual', 'q...
__author__ = 'jlu96' import numpy as np from sklearn.linear_model import Lasso, Ridge, ElasticNet, LinearRegression from sklearn.metrics import r2_score, mean_squared_error from sklearn.model_selection import LeaveOneOut import collections from lag_conversion import get_XY_lagged import pandas as pd import time def...
[ "pandas.DataFrame", "numpy.sum", "numpy.average", "sklearn.linear_model.ElasticNet", "sklearn.metrics.r2_score", "numpy.zeros", "time.time", "sklearn.linear_model.LinearRegression", "sklearn.linear_model.Lasso", "numpy.nonzero", "numpy.diff", "sklearn.model_selection.LeaveOneOut", "numpy.res...
[((582, 600), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (598, 600), False, 'from sklearn.linear_model import Lasso, Ridge, ElasticNet, LinearRegression\n'), ((635, 667), 'numpy.reshape', 'np.reshape', (['linreg.coef_', '(p, 1)'], {}), '(linreg.coef_, (p, 1))\n', (645, 667), True, 'i...
# -*- coding: utf-8 -*- """ Global settings for example scripts """ from pyplis.inout import find_test_data from pyplis import __version__, LineOnImage from numpy import subtract from os.path import join from optparse import OptionParser # the pyplis version for which these scripts SCRIPTS_VERSION = "0.12" SAVEFIGS =...
[ "numpy.subtract", "optparse.OptionParser", "matplotlib.rcParams.update", "pyplis.LineOnImage", "pyplis.__version__.split", "pyplis.inout.find_test_data", "os.path.join" ]
[((674, 698), 'os.path.join', 'join', (['"""."""', '"""scripts_out"""'], {}), "('.', 'scripts_out')\n", (678, 698), False, 'from os.path import join\n'), ((845, 963), 'pyplis.LineOnImage', 'LineOnImage', (['(345)', '(350)', '(450)', '(195)'], {'pyrlevel_def': '(1)', 'line_id': '"""young_plume"""', 'color': '"""#e67300"...
# derivative.py - determine first and second derivative import numpy as np ## ---- First derivative of y w.r.t x ---- def firstderivxy(x, y): """ Function to determine first derivative of y w.r.t x (dy/dx). Parameters ---------- x : ndarray y : ndarray Output ------...
[ "numpy.zeros" ]
[((525, 536), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (533, 536), True, 'import numpy as np\n'), ((1199, 1210), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1207, 1210), True, 'import numpy as np\n'), ((1902, 1913), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1910, 1913), True, 'import numpy as np\n...
import numpy as np import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt from pybnn.bohamiann import Bohamiann def f(x): return np.sinc(x * 10 - 5) rng = np.random.RandomState(42) x = rng.rand(20) y = f(x) grid = np.linspace(0, 1, 200) fvals = f(grid) plt.plot(grid, fvals, "k--") plt.plot(x, y...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.random.RandomState", "numpy.sinc", "matplotlib.use", "pybnn.bohamiann.Bohamiann", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid", "numpy.sqrt" ]
[((37, 60), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (51, 60), False, 'import matplotlib\n'), ((177, 202), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (198, 202), True, 'import numpy as np\n'), ((238, 260), 'numpy.linspace', 'np.linspace', (['(0)', '(1...
# Python modules import os import math import xml.etree.cElementTree as ElementTree # 3rd party modules import wx import numpy as np # Our modules import vespa.simulation.constants as constants import vespa.simulation.util_simulation_config as util_simulation_config import vespa.simulation.dialog_mixed_metabolite_de...
[ "vespa.common.util.xml_.TextSubElement", "numpy.ones", "wx.CheckBox", "wx.CallAfter", "vespa.common.mrs_prior.Prior", "wx.lib.agw.floatspin.FloatSpin", "numpy.arange", "numpy.tile", "numpy.exp", "xml.etree.cElementTree.Element", "vespa.simulation.auto_gui.mixed_metabolite_output.MyDialog.__init_...
[((3325, 3352), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""float"""'}), "([], dtype='float')\n", (3333, 3352), True, 'import numpy as np\n'), ((3365, 3392), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""float"""'}), "([], dtype='float')\n", (3373, 3392), True, 'import numpy as np\n'), ((3405, 3432), 'numpy.a...
# from future.utils import iteritems import os from os.path import join as pjoin from setuptools import setup from distutils.extension import Extension from Cython.Distutils import build_ext import numpy def find_in_path(name, path): """Find a file in a search path""" # Adapted fom http://code.activestate.co...
[ "os.path.abspath", "setuptools.setup", "os.path.dirname", "numpy.get_numpy_include", "os.path.exists", "distutils.extension.Extension", "numpy.get_include", "Cython.Distutils.build_ext.build_extensions", "os.path.splitext", "os.path.join" ]
[((3754, 4117), 'distutils.extension.Extension', 'Extension', (['"""gpuadder"""'], {'sources': "['src/manager.cu', 'wrapper.pyx']", 'library_dirs': "[CUDA['lib64']]", 'libraries': "['cudart']", 'language': '"""c++"""', 'runtime_library_dirs': "[CUDA['lib64']]", 'extra_compile_args': '{\'gcc\': [], \'nvcc\': [\'-arch=sm...
""" The constants `_MAX_SPEED` and `_BALL_SHAPE` are absolutely immutable (i.e., the game engine was built assuming these values to be immutable). Some of the remaining constants may be changed with caution. Proceed at your own risk. """ import numpy as np ############################################################...
[ "numpy.zeros", "numpy.array" ]
[((572, 588), 'numpy.array', 'np.array', (['[1, 1]'], {}), '([1, 1])\n', (580, 588), True, 'import numpy as np\n'), ((1135, 1151), 'numpy.array', 'np.array', (['[8, 4]'], {}), '([8, 4])\n', (1143, 1151), True, 'import numpy as np\n'), ((1684, 1717), 'numpy.zeros', 'np.zeros', (['(2 * PADDLE_SPEED + 1,)'], {}), '((2 * P...
import torch import torch.nn as nn from torch.utils.data import BatchSampler, SubsetRandomSampler from advattack.data_handling.cifar.cifar_dataset import Cifar10Dataset from advattack.data_handling.dataset_repository import DatasetRepository from advattack.data_handling.dataset_loader import DatasetLoader from advattac...
[ "advattack.models.model_repository.ModelRepository.get_model", "torch.nn.NLLLoss", "torch.cuda.is_available", "numpy.array", "advattack.models.model_repository.ModelRepository.store_model", "torch.utils.data.SubsetRandomSampler", "torchvision.transforms.Normalize", "advattack.data_handling.dataset_rep...
[((1219, 1231), 'torch.nn.NLLLoss', 'nn.NLLLoss', ([], {}), '()\n', (1229, 1231), True, 'import torch.nn as nn\n'), ((1518, 1612), 'advattack.data_handling.dataset_repository.DatasetRepository.get_dataset', 'DatasetRepository.get_dataset', (['dataset_class'], {'feature_transform_fun': 'feature_transform_fun'}), '(datas...
""" Library Features: Name: lib_ef_io_generic Author(s): <NAME> (<EMAIL>) Date: '20210104' Version: '1.0.0' """ ####################################################################################### # Libraries import logging import tempfile import os import json import pickle import re i...
[ "pandas.DataFrame", "tempfile.NamedTemporaryFile", "logging.error", "os.remove", "pickle.dump", "json.load", "scipy.io.loadmat", "logging.warning", "numpy.zeros", "os.path.exists", "json.dumps", "pandas.read_table" ]
[((1617, 1704), 'json.dumps', 'json.dumps', (['file_workspace'], {'indent': 'file_indent', 'ensure_ascii': '(False)', 'sort_keys': '(False)'}), '(file_workspace, indent=file_indent, ensure_ascii=False,\n sort_keys=False)\n', (1627, 1704), False, 'import json\n'), ((2150, 2174), 'numpy.zeros', 'np.zeros', ([], {'shap...
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "unittest.main", "paddle.static.data", "paddle.is_compiled_with_ipu", "numpy.random.choice" ]
[((2679, 2694), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2692, 2694), False, 'import unittest\n'), ((1250, 1349), 'paddle.static.data', 'paddle.static.data', ([], {'name': 'self.feed_list[0]', 'shape': 'self.feed_shape[0]', 'dtype': 'self.feed_dtype[0]'}), '(name=self.feed_list[0], shape=self.feed_shape[0],...
""" .. module:: analysis :platform: Unix, Windows :synopsis: Unified Free Energy Dynamics with OpenMM .. moduleauthor:: <NAME> <<EMAIL>> """ import itertools import numpy as np from collections import namedtuple from scipy import stats from simtk import openmm from ufedmm.ufedmm import _standardized, _get_ene...
[ "numpy.resize", "numpy.empty", "numpy.sin", "numpy.exp", "ufedmm.ufedmm._get_parameters", "scipy.stats.binned_statistic_dd", "itertools.product", "ufedmm.ufedmm._standardized", "numpy.vectorize", "simtk.openmm.CustomCompoundBondForce", "numpy.hstack", "numpy.cos", "simtk.openmm.Vec3", "num...
[((1042, 1099), 'simtk.openmm.CustomCompoundBondForce', 'openmm.CustomCompoundBondForce', (['num_particles', 'expression'], {}), '(num_particles, expression)\n', (1072, 1099), False, 'from simtk import openmm\n'), ((1289, 1304), 'simtk.openmm.System', 'openmm.System', ([], {}), '()\n', (1302, 1304), False, 'from simtk ...
import numpy as np import pandas as pd import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from tensorflow.python.framework import ops from sklearn import metrics from sklearn.metrics import roc_curve from sklearn.metrics import roc_auc_score def RandomForest(X_train, Y_train, X_t...
[ "tensorflow.keras.layers.Dense", "tensorflow.keras.models.Sequential", "tensorflow.keras.optimizers.RMSprop", "tensorflow.keras.layers.Flatten", "tensorflow.keras.regularizers.l2", "xgboost.XGBClassifier", "sklearn.svm.LinearSVC", "sklearn.ensemble.RandomForestClassifier", "tensorflow.keras.metrics....
[((401, 452), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'max_depth': '(5)', 'random_state': '(0)'}), '(max_depth=5, random_state=0)\n', (423, 452), False, 'from sklearn.ensemble import RandomForestClassifier\n'), ((670, 701), 'sklearn.metrics.roc_curve', 'roc_curve', (['Y_test', 'Y_pred...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import (division, print_function, absolute_import, unicode_literals) __all__ = ["plot_bpt"] import numpy as np import pkg_resources from .kewley import (NII_OIII_agn_lim, NII_OIII_sf_lim, OI_OIII_agn_lim, SII_OII...
[ "numpy.load", "matplotlib.pyplot.get_cmap", "numpy.seterr", "matplotlib.cm.ScalarMappable", "pkg_resources.resource_filename", "matplotlib.pyplot.figure", "numpy.where", "numpy.linspace", "matplotlib.pyplot.gca", "numpy.log10", "matplotlib.pyplot.gcf" ]
[((468, 534), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['__name__', '"""data/sdss_data_ls.npz"""'], {}), "(__name__, 'data/sdss_data_ls.npz')\n", (499, 534), False, 'import pkg_resources\n'), ((546, 563), 'numpy.load', 'np.load', (['linefile'], {}), '(linefile)\n', (553, 563), True, 'impor...
import numpy as np import cv2 import matplotlib.pyplot as plt import math from RootSift import RootSIFT import img_tags def get_img_res(test_img): count=0 match_error = False sift = cv2.xfeatures2d.SIFT_create() kp2, des2 = sift.detectAndCompute(test_img,None) rs = RootSIFT() kp2, des2 =...
[ "numpy.argmax", "cv2.cvtColor", "cv2.FlannBasedMatcher", "cv2.imread", "numpy.array", "RootSift.RootSIFT", "cv2.xfeatures2d.SIFT_create" ]
[((198, 227), 'cv2.xfeatures2d.SIFT_create', 'cv2.xfeatures2d.SIFT_create', ([], {}), '()\n', (225, 227), False, 'import cv2\n'), ((294, 304), 'RootSift.RootSIFT', 'RootSIFT', ([], {}), '()\n', (302, 304), False, 'from RootSift import RootSIFT\n'), ((2259, 2279), 'numpy.array', 'np.array', (['score_list'], {}), '(score...
import sys import os sys.path.append(os.path.abspath('..')) from vessel_tracking import geometry import numpy as np v1 = np.array([1,0,0]) v2 = np.array([1,1,1]) print("orth: {}, {}".format(v1,geometry.orth(v1))) print("orth: {}, {}".format(v2,geometry.orth(v2))) print("perpendicular_plane: {}, {}".format(v1,geomet...
[ "vessel_tracking.geometry.orth", "os.path.abspath", "vessel_tracking.geometry.fit_cylinder_3", "vessel_tracking.geometry.perpendicular_plane", "numpy.zeros", "vessel_tracking.geometry.distance_in_plane", "numpy.array", "vessel_tracking.geometry.fit_circle_3", "vessel_tracking.geometry.project_points...
[((123, 142), 'numpy.array', 'np.array', (['[1, 0, 0]'], {}), '([1, 0, 0])\n', (131, 142), True, 'import numpy as np\n'), ((146, 165), 'numpy.array', 'np.array', (['[1, 1, 1]'], {}), '([1, 1, 1])\n', (154, 165), True, 'import numpy as np\n'), ((454, 475), 'numpy.array', 'np.array', (['[[1, 1, 1]]'], {}), '([[1, 1, 1]])...
""" Interpolator ============ cloud2cloud implementation and API. """ import numpy as np from scipy import spatial SMALL = 1e-16 class CloudInterpolator: """Wrapper around a source and target meshe to facilitate interpolation between the two.""" def __init__(self, source, target, limitsource=None, stencil=4, funct...
[ "numpy.stack", "numpy.sum", "numpy.maximum", "numpy.empty", "numpy.ones", "scipy.spatial.cKDTree", "numpy.prod" ]
[((2652, 2668), 'numpy.prod', 'np.prod', (['shp_sce'], {}), '(shp_sce)\n', (2659, 2668), True, 'import numpy as np\n'), ((2680, 2696), 'numpy.prod', 'np.prod', (['shp_tgt'], {}), '(shp_tgt)\n', (2687, 2696), True, 'import numpy as np\n'), ((1250, 1274), 'numpy.stack', 'np.stack', (['target'], {'axis': '(1)'}), '(target...
import os import numpy as np from strategies import RSI from send_order_signal import SendOrderSignal from binance.client import Client from datetime import datetime import time signal = SendOrderSignal() client = signal.get_client() historicalData = client.get_historical_klines( 'ETHGBP', Client.KLINE_INTERV...
[ "strategies.RSI", "time.gmtime", "numpy.array", "send_order_signal.SendOrderSignal" ]
[((188, 205), 'send_order_signal.SendOrderSignal', 'SendOrderSignal', ([], {}), '()\n', (203, 205), False, 'from send_order_signal import SendOrderSignal\n'), ((756, 772), 'numpy.array', 'np.array', (['closes'], {}), '(closes)\n', (764, 772), True, 'import numpy as np\n'), ((734, 739), 'strategies.RSI', 'RSI', ([], {})...
import cv2 import numpy as np image1 = cv2.imread("log_3.png") image2 = cv2.imread("log_4.png") def logical_OR(img1,img2): image_output = np.bitwise_or(image1,image2) cv2.imwrite('output_or.png',image_output) if __name__ == "__main__": logical_OR(image1,image2)
[ "cv2.imread", "numpy.bitwise_or", "cv2.imwrite" ]
[((41, 64), 'cv2.imread', 'cv2.imread', (['"""log_3.png"""'], {}), "('log_3.png')\n", (51, 64), False, 'import cv2\n'), ((74, 97), 'cv2.imread', 'cv2.imread', (['"""log_4.png"""'], {}), "('log_4.png')\n", (84, 97), False, 'import cv2\n'), ((145, 174), 'numpy.bitwise_or', 'np.bitwise_or', (['image1', 'image2'], {}), '(i...
import torch import torch.nn.functional as F import torch.optim as optim import end2you.utils as utils import copy import os import numpy as np import logging import shutil import sys sys.path.append("..") from torch import nn from torch.utils.tensorboard import SummaryWriter from pathlib import Path from tqdm import ...
[ "sys.path.append", "logging.info", "pathlib.Path", "numpy.mean", "end2you.base_process.BaseProcess.set_logger", "torch.no_grad", "torch.tensor" ]
[((184, 205), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (199, 205), False, 'import sys\n'), ((1671, 1692), 'pathlib.Path', 'Path', (['params.root_dir'], {}), '(params.root_dir)\n', (1675, 1692), False, 'from pathlib import Path\n'), ((2039, 2077), 'end2you.base_process.BaseProcess.set_logger...
""" Conway game of life that simulates cellular automata and consists of the following rules: * Any live cell with fewer than two live neighbors dies * Any live cell with two or three neighbors lives * Any live cell with more than three neighbors dies * Any dead cell with exactly three neighbors comes to live """ imp...
[ "numpy.random.choice", "pycuda.compiler.SourceModule", "matplotlib.pyplot.show", "pycuda.gpuarray.empty_like", "matplotlib.animation.FuncAnimation", "pycuda.gpuarray.to_gpu", "matplotlib.pyplot.subplots" ]
[((536, 2327), 'pycuda.compiler.SourceModule', 'SourceModule', (['"""\n#define _X ( threadIdx.x + blockIdx.x * blockDim.x ) \n#define _Y ( threadIdx.y + blockIdx.y * blockDim.y )\n\n#define _WIDTH ( blockDim.x * gridDim.x )\n#define _HEIGHT ( blockDim.y * gridDim.y )\n\n#define _XM(x) ( (x + _WIDTH) % _WIDTH )\n#defin...
""" This module contains models and fitters for resonators that are operated in transmission. Fitting resonators in this configuration is more complicated than in the other configurations because the off-resonance data goes to 0 instead of 1, while the on-resonance data goes to a value that depends on the losses. Beca...
[ "numpy.interp", "numpy.abs", "numpy.argmax" ]
[((3237, 3266), 'numpy.argmax', 'np.argmax', (['smoothed_magnitude'], {}), '(smoothed_magnitude)\n', (3246, 3266), True, 'import numpy as np\n'), ((3601, 3672), 'numpy.interp', 'np.interp', (['(0)', 'power_minus_half_max[:peak_index]', 'frequency[:peak_index]'], {}), '(0, power_minus_half_max[:peak_index], frequency[:p...
""" This module will test the basic functionalities of topopy.MergeTree """ from unittest import TestCase import nglpy as ngl import numpy as np import topopy from .test_functions import gerber, generate_test_grid_2d import sklearn import sys import os class TestMT(TestCase): """ Class for testing the...
[ "os.remove", "nglpy.EmptyRegionGraph", "sklearn.preprocessing.scale", "sys.stdout.close", "topopy.MergeTree", "sklearn.preprocessing.MinMaxScaler", "numpy.atleast_2d" ]
[((651, 689), 'nglpy.EmptyRegionGraph', 'ngl.EmptyRegionGraph', ([], {'max_neighbors': '(10)'}), '(max_neighbors=10)\n', (671, 689), True, 'import nglpy as ngl\n'), ((733, 769), 'sklearn.preprocessing.MinMaxScaler', 'sklearn.preprocessing.MinMaxScaler', ([], {}), '()\n', (767, 769), False, 'import sklearn\n'), ((879, 9...
# how many missing values exist or better still what is the % of missing values in the dataset? import numpy as np import pandas as pd import seaborn as sns def convert_labels(df): df.columns = [column.replace(' ', '_').lower() for column in df.columns] return df def percent_missing(df: pd.DataFrame): #...
[ "numpy.product" ]
[((384, 404), 'numpy.product', 'np.product', (['df.shape'], {}), '(df.shape)\n', (394, 404), True, 'import numpy as np\n')]
"""Module to test garage.torch.utils.""" import numpy as np import torch import garage.torch.utils as tu def test_utils_set_gpu_mode(): """Test setting gpu mode to False to force CPU.""" if torch.cuda.is_available(): tu.set_gpu_mode(mode=True) assert tu.global_device() == torch.device('cuda:...
[ "garage.torch.utils.global_device", "garage.torch.utils.dict_np_to_torch", "garage.torch.utils.set_gpu_mode", "numpy.zeros", "numpy.ones", "torch.zeros", "torch.cuda.is_available", "torch.device", "garage.torch.utils.torch_to_np" ]
[((202, 227), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (225, 227), False, 'import torch\n'), ((677, 696), 'garage.torch.utils.torch_to_np', 'tu.torch_to_np', (['tup'], {}), '(tup)\n', (691, 696), True, 'import garage.torch.utils as tu\n'), ((945, 969), 'garage.torch.utils.dict_np_to_torch...
""" User Defined Functions ====================== """ import os import numpy as np import pandas as pd import scipy.sparse as sparse import matplotlib.pyplot as plt import pyspark.sql.functions as F from random import seed, random from pyspark.ml.linalg import Vectors from pyspark.sql import Window from pyspark.sql.t...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.spy", "matplotlib.pyplot.bar", "matplotlib.pyplot.figure", "pyspark.sql.types.IntegerType", "os.path.join", "pandas.DataFrame", "matplotlib.pyplot.yticks", "pyspark.sql.functions.row_number", "matplotlib.pyplot.colorbar", "numpy.cumsum", "scipy.spa...
[((594, 616), 'numpy.array', 'np.array', (['pd_df[type_]'], {}), '(pd_df[type_])\n', (602, 616), True, 'import numpy as np\n'), ((724, 789), 'scipy.sparse.coo_matrix', 'sparse.coo_matrix', (['(data, (rows, cols))'], {'shape': '(114 + 1, 114 + 1)'}), '((data, (rows, cols)), shape=(114 + 1, 114 + 1))\n', (741, 789), True...
# pylint: disable=redefined-outer-name,missing-docstring,unused-import,no-self-use import pytest import os import json from numpy.testing import assert_array_equal from .fixtures import target_dir, load_mock_nsl_data, load_mock_nsl_labels, load_mock_cic_data, load_mock_cic_labels from .context import single_benchmark,...
[ "numpy.testing.assert_array_equal" ]
[((1185, 1242), 'numpy.testing.assert_array_equal', 'assert_array_equal', (['tr_data.columns.values', 'wanted_fields'], {}), '(tr_data.columns.values, wanted_fields)\n', (1203, 1242), False, 'from numpy.testing import assert_array_equal\n'), ((2343, 2400), 'numpy.testing.assert_array_equal', 'assert_array_equal', (['tr...
import numpy as np #integer data ! i = 10 print(type(i)) # will print the data type of i ! a_i = np.zeros(i, dtype=int) #declaring an array :D print(type(a_i)) print(type(a_i[0])) #gives int64 as the number 0 is stored with 64 bit precision! :D #floats! x = 119.0 print(type(x)) #scientific ! y = 1.19e2 print(t...
[ "numpy.zeros" ]
[((101, 123), 'numpy.zeros', 'np.zeros', (['i'], {'dtype': 'int'}), '(i, dtype=int)\n', (109, 123), True, 'import numpy as np\n'), ((334, 363), 'numpy.zeros', 'np.zeros', (['i'], {'dtype': 'np.float64'}), '(i, dtype=np.float64)\n', (342, 363), True, 'import numpy as np\n')]
#! /usr/bin/env python # -*- coding: utf-8 -*- #Based on http://cyrille.rossant.net/shaders-opengl/ from __future__ import print_function import numpy as np import OpenGL.GL as gl import OpenGL.arrays.vbo as glvbo # Vertex shader VS = """ #version 330 // Attribute variable that contains coordinates of the vertices. l...
[ "OpenGL.GL.glGetShaderiv", "OpenGL.GL.glGetShaderInfoLog", "OpenGL.GL.glCreateProgram", "OpenGL.arrays.vbo.VBO", "OpenGL.GL.glUseProgram", "OpenGL.GL.glLinkProgram", "OpenGL.GL.glCompileShader", "numpy.zeros", "OpenGL.GL.glVertexAttribPointer", "OpenGL.GL.glAttachShader", "OpenGL.GL.glGetProgram...
[((1182, 1220), 'numpy.zeros', 'np.zeros', (['(10000, 2)'], {'dtype': 'np.float32'}), '((10000, 2), dtype=np.float32)\n', (1190, 1220), True, 'import numpy as np\n'), ((1273, 1288), 'OpenGL.arrays.vbo.VBO', 'glvbo.VBO', (['data'], {}), '(data)\n', (1282, 1288), True, 'import OpenGL.arrays.vbo as glvbo\n'), ((1311, 1345...
"""A regressor based on a MLP model.""" from dowel import tabular import numpy as np import tensorflow as tf from garage.tf.misc import tensor_utils from garage.tf.models import NormalizedInputMLPModel from garage.tf.optimizers import LbfgsOptimizer from garage.tf.regressors.regressor import Regressor cla...
[ "garage.tf.misc.tensor_utils.compile_function", "garage.tf.optimizers.LbfgsOptimizer", "tensorflow.compat.v1.variable_scope", "tensorflow.compat.v1.placeholder", "numpy.std", "garage.tf.models.NormalizedInputMLPModel", "numpy.mean", "tensorflow.initializers.glorot_uniform", "tensorflow.square", "t...
[((2436, 2468), 'tensorflow.initializers.glorot_uniform', 'tf.initializers.glorot_uniform', ([], {}), '()\n', (2466, 2468), True, 'import tensorflow as tf\n'), ((2502, 2524), 'tensorflow.zeros_initializer', 'tf.zeros_initializer', ([], {}), '()\n', (2522, 2524), True, 'import tensorflow as tf\n'), ((2602, 2634), 'tenso...
import os import tarfile import tempfile import shutil from collections import namedtuple, OrderedDict import h5py import numpy from scipy.io import loadmat from six import iteritems from six.moves import range, zip from PIL import Image from fuel.converters.base import fill_hdf5_file, check_exists, progress_bar from...
[ "h5py.File", "collections.OrderedDict", "fuel.converters.base.check_exists", "six.moves.range", "fuel.converters.base.fill_hdf5_file", "os.path.isdir", "numpy.dtype", "PIL.Image.open", "six.moves.zip", "tempfile.mkdtemp", "fuel.converters.base.progress_bar", "collections.namedtuple", "tarfil...
[((672, 715), 'fuel.converters.base.check_exists', 'check_exists', ([], {'required_files': 'FORMAT_1_FILES'}), '(required_files=FORMAT_1_FILES)\n', (684, 715), False, 'from fuel.converters.base import fill_hdf5_file, check_exists, progress_bar\n'), ((12767, 12810), 'fuel.converters.base.check_exists', 'check_exists', (...
from itertools import chain import numpy as np import quaternion from scipy import linalg as la from spherical_functions import Wigner_D_matrices class Rotator: def __init__(self, basis, phase=np.array([1., 1., 1.])): self.basis = basis self.phase = phase self.lmax = self.basis[:, :, 3]....
[ "numpy.argsort", "numpy.sin", "numpy.arange", "numpy.diag", "quaternion.from_rotation_matrix", "itertools.chain", "scipy.linalg.block_diag", "numpy.cos", "quaternion.from_rotation_vector", "numpy.random.uniform", "numpy.outer", "numpy.ix_", "numpy.zeros", "numpy.split", "numpy.array", ...
[((7344, 7354), 'numpy.sqrt', 'np.sqrt', (['z'], {}), '(z)\n', (7351, 7354), True, 'import numpy as np\n'), ((7456, 7469), 'numpy.sin', 'np.sin', (['theta'], {}), '(theta)\n', (7462, 7469), True, 'import numpy as np\n'), ((7479, 7492), 'numpy.cos', 'np.cos', (['theta'], {}), '(theta)\n', (7485, 7492), True, 'import num...
# write function to average across frames to give ensembled averaged cosine theta values at each N - 1 value import MDAnalysis as mda import statsmodels as stats import math import numpy as np import pandas import sklearn import scipy as scipy import warnings # Use sklearn to do fitting from sklearn.linear_model impo...
[ "numpy.sum", "sklearn.metrics.r2_score", "numpy.mean", "numpy.linalg.norm", "numpy.arange", "numpy.sin", "numpy.exp", "numpy.diag", "numpy.unique", "numpy.std", "numpy.random.choice", "scipy.stats.t.ppf", "sklearn.metrics.mean_squared_error", "scipy.optimize.curve_fit", "sklearn.linear_m...
[((1520, 1568), 'numpy.zeros', 'np.zeros', ([], {'shape': '(3, n_monomers - 1)', 'dtype': 'float'}), '(shape=(3, n_monomers - 1), dtype=float)\n', (1528, 1568), True, 'import numpy as np\n'), ((1647, 1672), 'numpy.arange', 'np.arange', (['(n_monomers - 1)'], {}), '(n_monomers - 1)\n', (1656, 1672), True, 'import numpy ...
# -*- coding: utf-8 -*- import preprocess import tensorflow as tf import tensorflow.contrib as tf_contrib import time import numpy as np import pickle word_dict_size = len(preprocess.get_dict()) # def poetry_2_num(poetry): # vector = [] # for word in poetry: # vector.append(word_dict.get(word)) # ...
[ "numpy.sum", "tensorflow.trainable_variables", "tensorflow.reshape", "tensorflow.matmul", "tensorflow.global_variables", "pickle.load", "tensorflow.Variable", "tensorflow.get_variable", "tensorflow.nn.softmax", "tensorflow.placeholder", "numpy.cumsum", "tensorflow.gradients", "tensorflow.nn....
[((1094, 1145), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[Config.BATCH_SIZE, None]'], {}), '(tf.int32, [Config.BATCH_SIZE, None])\n', (1108, 1145), True, 'import tensorflow as tf\n'), ((1163, 1214), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[Config.BATCH_SIZE, None]'], {}), '(tf.int32...
from __future__ import print_function,division from builtins import range from six import iteritems from ..klampt import vectorops from . import differences from .objective import ObjectiveFunction import numpy as np class PathLengthObjectiveFunction(ObjectiveFunction): """Meant for a kinematic planning problem:...
[ "numpy.outer", "numpy.multiply", "numpy.asarray", "numpy.zeros", "numpy.array", "numpy.linalg.norm", "numpy.dot", "numpy.diag" ]
[((1268, 1285), 'numpy.linalg.norm', 'np.linalg.norm', (['d'], {}), '(d)\n', (1282, 1285), True, 'import numpy as np\n'), ((964, 975), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (972, 975), True, 'import numpy as np\n'), ((992, 1009), 'numpy.linalg.norm', 'np.linalg.norm', (['d'], {}), '(d)\n', (1006, 1009), True...
# -*- coding: utf-8 -*- from __future__ import print_function import cv2 import numpy as np import time import glfw import OpenGL.GL as gl import imgui from imgui.integrations.glfw import GlfwRenderer import ceiltrack import recordreader # starting position for localization # negative x because we also mirror the tr...
[ "recordreader.RecordIterator", "glfw.poll_events", "glfw.make_context_current", "OpenGL.GL.glBindTexture", "glfw.window_should_close", "ceiltrack.floorlut", "imgui.same_line", "imgui.slider_float", "numpy.sin", "imgui.begin_menu", "OpenGL.GL.glClearColor", "OpenGL.GL.glClear", "ceiltrack.ren...
[((457, 476), 'OpenGL.GL.glGenTextures', 'gl.glGenTextures', (['(1)'], {}), '(1)\n', (473, 476), True, 'import OpenGL.GL as gl\n'), ((481, 522), 'OpenGL.GL.glBindTexture', 'gl.glBindTexture', (['gl.GL_TEXTURE_2D', 'texid'], {}), '(gl.GL_TEXTURE_2D, texid)\n', (497, 522), True, 'import OpenGL.GL as gl\n'), ((527, 603), ...
import numpy as np import tvm import time # The sizes of inputs and filters batch = 256 in_channel = 256 out_channel = 512 in_size = 14 kernel = 3 pad = 1 stride = 1 out_size = (in_size - kernel + 2*pad) // stride + 1 def conv2d(): """ .. _opt-conv-gpu: How to optimize convolution on GPU ==========...
[ "numpy.random.uniform", "tvm.te.reduce_axis", "tvm.te.placeholder", "tvm.tir.const", "tvm.nd.array", "numpy.zeros", "time.time", "tvm.build", "tvm.te.thread_axis", "tvm.te.compute", "tvm.te.create_schedule", "tvm.lower", "tvm.gpu", "tvm.tir.all", "tvm.te.sum" ]
[((1348, 1411), 'tvm.te.placeholder', 'te.placeholder', (['(in_size, in_size, in_channel, batch)'], {'name': '"""A"""'}), "((in_size, in_size, in_channel, batch), name='A')\n", (1362, 1411), False, 'from tvm import te\n'), ((1420, 1487), 'tvm.te.placeholder', 'te.placeholder', (['(kernel, kernel, in_channel, out_channe...
import hashlib import json import logging import os import pickle import re from pathlib import Path from time import time import h5py import numpy as np import torch from scipy import spatial from torch.utils.data import Sampler import Resources.training as r def reshape_to_indeces(_input, ix=((1, 4), (1, 4)), goa...
[ "json.dump", "h5py.File", "hashlib.md5", "json.load", "torch.cat", "time.time", "numpy.max", "re.findall", "numpy.array", "numpy.min", "pickle.load", "pathlib.Path", "scipy.spatial.KDTree", "torch.tensor", "json.JSONEncoder.default", "logging.getLogger" ]
[((4903, 4961), 're.findall', 're.findall', (['"""\\\\d+\\\\.\\\\d+ \\\\d+\\\\.\\\\d+ \\\\d+\\\\.\\\\d+"""', 'content'], {}), "('\\\\d+\\\\.\\\\d+ \\\\d+\\\\.\\\\d+ \\\\d+\\\\.\\\\d+', content)\n", (4913, 4961), False, 'import re\n'), ((5039, 5062), 'numpy.array', 'np.array', (['sensor_coords'], {}), '(sensor_coords)\n...
import os import sys import time import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns # import wmi from keras.backend import clear_session from scipy import stats from LSTM_for_Stock.data_processor import DataHelper from LSTM_for_Stock.data_processor import Da...
[ "sys.path.append", "LSTM_for_Stock.data_processor.Wrapper_default", "LSTM_for_Stock.data_processor.DataHelper.xy_split_2", "LSTM_for_Stock.model.SequentialModel", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "os.getcwd", "matplotlib.pyplot.close", "matplotlib.pypl...
[((620, 643), 'sys.path.append', 'sys.path.append', (['nb_dir'], {}), '(nb_dir)\n', (635, 643), False, 'import sys\n'), ((1668, 1685), 'LSTM_for_Stock.data_processor.Wrapper_default', 'Wrapper_default', ([], {}), '()\n', (1683, 1685), False, 'from LSTM_for_Stock.data_processor import Wrapper_default\n'), ((1699, 1710),...
from unittest import TestCase import numpy as np from scipy.stats import norm, uniform, lognorm from corai_util.calculus import diff_eq from corai_util.tools import function_iterable class Test_diff_eq(TestCase): def test_fractional_adams(self): pass def test_system_ode_solver(self): # exam...
[ "scipy.stats.uniform.pdf", "corai_util.calculus.diff_eq.system_ODE_solver", "corai_util.tools.function_iterable.replace_nans_numpy", "numpy.array", "numpy.linspace", "numpy.sqrt" ]
[((1532, 1566), 'numpy.linspace', 'np.linspace', (['(-1 * 0.999)', '(0.5)', '(1000)'], {}), '(-1 * 0.999, 0.5, 1000)\n', (1543, 1566), True, 'import numpy as np\n'), ((1671, 1790), 'corai_util.calculus.diff_eq.system_ODE_solver', 'diff_eq.system_ODE_solver', (['tt', 'starting_points[0]', '[p_dash_open_formula, q_dash_o...
import copy from typing import Dict, List, Tuple import matplotlib matplotlib.use("TkAgg") import matplotlib.pyplot as plt plt.style.use("./Styles/Scientific.mplstyle") import matplotlib.patches as patches import msgpack import numpy as np import quaternion as quat import optimization from configuration import Conf...
[ "numpy.stack", "matplotlib.pyplot.show", "utilities.clamp_signal", "optimization.optimize", "utilities.closest_point", "matplotlib.pyplot.style.use", "matplotlib.use", "numpy.array", "utilities.vec4_array_to_quat_array", "numpy.min", "numpy.max", "quaternion.as_euler_angles", "matplotlib.pyp...
[((69, 92), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (83, 92), False, 'import matplotlib\n'), ((125, 170), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""./Styles/Scientific.mplstyle"""'], {}), "('./Styles/Scientific.mplstyle')\n", (138, 170), True, 'import matplotlib.pyplot as p...
import imageio import cv2 import numpy as np import os, sys import argparse output_order = ['m00','m10','m01','m20','m11','m02','m30','m21','m12','m03','mu20','mu11','mu02','mu30','mu21','mu12','mu03','nu20','nu11','nu02','nu30','nu21','nu12','nu03'] def writeCSVHeader(filename): writer = open(filename, 'w') writer...
[ "cv2.contourArea", "numpy.zeros_like", "numpy.uint8", "argparse.ArgumentParser", "cv2.arcLength", "cv2.moments", "os.path.splitext", "imageio.get_reader", "cv2.resize" ]
[((567, 602), 'imageio.get_reader', 'imageio.get_reader', (['args.input_file'], {}), '(args.input_file)\n', (585, 602), False, 'import imageio\n'), ((1872, 1919), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Exports """'}), "(description='Exports ')\n", (1895, 1919), False, 'import arg...
from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import * import OpenEXR, Imath import numpy as np import os, sys from collections import defaultdict #import set # exr.py: Tools/helpers for various exr I/O operations FLOAT = Imath.PixelType(Ima...
[ "Imath.Channel", "OpenEXR.isOpenExrFile", "OpenEXR.InputFile", "numpy.expand_dims", "numpy.clip", "OpenEXR.Header", "collections.defaultdict", "numpy.fromstring", "OpenEXR.OutputFile", "Imath.Compression", "sys.exit", "Imath.PixelType" ]
[((301, 339), 'Imath.PixelType', 'Imath.PixelType', (['Imath.PixelType.FLOAT'], {}), '(Imath.PixelType.FLOAT)\n', (316, 339), False, 'import OpenEXR, Imath\n'), ((348, 385), 'Imath.PixelType', 'Imath.PixelType', (['Imath.PixelType.HALF'], {}), '(Imath.PixelType.HALF)\n', (363, 385), False, 'import OpenEXR, Imath\n'), (...
import numpy as np from protosc.model.utils import compute_accuracy from protosc.model.base import BaseFoldModel from protosc.model.filter import compute_filter_fold class RandomModel(BaseFoldModel): def _execute_fold(self, fold): filter_data = compute_filter_fold(fold) return self.execute_with_c...
[ "protosc.model.utils.compute_accuracy", "numpy.random.shuffle", "protosc.model.filter.compute_filter_fold" ]
[((260, 285), 'protosc.model.filter.compute_filter_fold', 'compute_filter_fold', (['fold'], {}), '(fold)\n', (279, 285), False, 'from protosc.model.filter import compute_filter_fold\n'), ((457, 484), 'numpy.random.shuffle', 'np.random.shuffle', (['clusters'], {}), '(clusters)\n', (474, 484), True, 'import numpy as np\n...
from collections import defaultdict from .utils import fix_dataclass_init_docs from .sim import SimGrid from .typing import Optional, Callable, Union, List, Tuple, Dict import jax import jax.numpy as jnp from jax.config import config from jax.experimental.optimizers import adam import numpy as np import dataclasses i...
[ "jax.numpy.array", "holoviews.DynamicMap", "numpy.abs", "jax.jit", "jax.lax.stop_gradient", "numpy.asarray", "collections.defaultdict", "numpy.max", "numpy.min", "numpy.array", "jax.value_and_grad", "numpy.arange", "jax.experimental.optimizers.adam", "holoviews.streams.Pipe", "jax.config...
[((547, 577), 'jax.config.config.parse_flags_with_absl', 'config.parse_flags_with_absl', ([], {}), '()\n', (575, 577), False, 'from jax.config import config\n'), ((7264, 7289), 'jax.experimental.optimizers.adam', 'adam', ([], {'step_size': 'step_size'}), '(step_size=step_size)\n', (7268, 7289), False, 'from jax.experim...
import argparse import numpy as np import os import sys from keras.models import load_model from data_loaders.SpectrogramGenerator import SpectrogramGenerator class_labels = ["EN", "DE", "FR", "ES", "CN", "RU"] def predict(cli_args): config = {"pixel_per_second": 50, "input_shape": [129, 500, 1], "num_classes":...
[ "numpy.stack", "keras.models.load_model", "numpy.divide", "argparse.ArgumentParser", "numpy.argmax", "os.path.isfile", "numpy.mean", "data_loaders.SpectrogramGenerator.SpectrogramGenerator", "sys.exit" ]
[((522, 536), 'numpy.stack', 'np.stack', (['data'], {}), '(data)\n', (530, 536), True, 'import numpy as np\n'), ((573, 603), 'keras.models.load_model', 'load_model', (['cli_args.model_dir'], {}), '(cli_args.model_dir)\n', (583, 603), False, 'from keras.models import load_model\n'), ((660, 692), 'numpy.argmax', 'np.argm...
#!/usr/bin/python # The MIT License (MIT) # # Copyright (c) 2015 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to us...
[ "cv2.resize", "cv2.circle", "cv2.putText", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "numpy.hstack", "cv2.VideoCapture", "cv2.namedWindow", "os.path.isfile", "cv2.CascadeClassifier", "cv2.destroyAllWindows", "datetime.datetime.now", "sys.exit" ]
[((1378, 1397), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (1394, 1397), False, 'import cv2\n'), ((1693, 1738), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['config.CLASSIFIER_PATH'], {}), '(config.CLASSIFIER_PATH)\n', (1714, 1738), False, 'import cv2\n'), ((1780, 1840), 'cv2.namedWindow', '...
import cv2 import numpy as np from lantz.core import Action, Driver, Feat class USBCam(Driver): def __init__(self, device_id): self.device_id = device_id self._flipud = False self._fliplr = False self._rotation = 0 return def initialize(self): self.capture = c...
[ "lantz.core.Feat", "cv2.cvtColor", "numpy.flipud", "cv2.VideoCapture", "numpy.fliplr", "lantz.core.Action" ]
[((444, 474), 'lantz.core.Feat', 'Feat', ([], {'values': '{0, 90, 180, 270}'}), '(values={0, 90, 180, 270})\n', (448, 474), False, 'from lantz.core import Action, Driver, Feat\n'), ((634, 660), 'lantz.core.Feat', 'Feat', ([], {'values': '{True, False}'}), '(values={True, False})\n', (638, 660), False, 'from lantz.core ...
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: <NAME>(<EMAIL>) # Segmentation running score. from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np class RunningScore(object): def __init__(self, configer): self.configer =...
[ "numpy.diag", "numpy.zeros", "numpy.nanmean" ]
[((428, 470), 'numpy.zeros', 'np.zeros', (['(self.n_classes, self.n_classes)'], {}), '((self.n_classes, self.n_classes))\n', (436, 470), True, 'import numpy as np\n'), ((1317, 1336), 'numpy.nanmean', 'np.nanmean', (['acc_cls'], {}), '(acc_cls)\n', (1327, 1336), True, 'import numpy as np\n'), ((1438, 1452), 'numpy.nanme...
import os import io import shutil import math import random import numpy as np import requests import urllib.request from PIL import Image, ImageDraw from bs4 import BeautifulSoup import imghdr from sklearn.cluster import KMeans from sklearn.decomposition import PCA from keras.models import Model from ker...
[ "os.mkdir", "os.remove", "PIL.Image.new", "random.sample", "keras.models.Model", "keras.applications.vgg16.VGG16", "shutil.rmtree", "os.path.join", "os.chdir", "sklearn.cluster.KMeans", "keras.preprocessing.image.load_img", "requests.get", "PIL.ImageDraw.Draw", "keras.applications.vgg16.pr...
[((731, 752), 'os.path.isdir', 'os.path.isdir', (['folder'], {}), '(folder)\n', (744, 752), False, 'import os\n'), ((790, 806), 'os.mkdir', 'os.mkdir', (['folder'], {}), '(folder)\n', (798, 806), False, 'import os\n'), ((871, 908), 'os.path.join', 'os.path.join', (['search_dir', '"""temp.jpeg"""'], {}), "(search_dir, '...
""" IN YOLOV3, uses 3 layers, respectively downsample 32, downsample 16 and downsample 8 IN DEEOLABV3+, the nwetwork output layers if stride 16, so need to add more layer to generate downsample 32! """ import numpy as np detection_feature_layers = [ # downsample 8 'xception_65/entry_flow/block2/unit_1/xception...
[ "numpy.asarray" ]
[((588, 611), 'numpy.asarray', 'np.asarray', (['[8, 16, 32]'], {}), '([8, 16, 32])\n', (598, 611), True, 'import numpy as np\n'), ((647, 906), 'numpy.asarray', 'np.asarray', (['[[[0.02403846, 0.03125], [0.03846154, 0.07211538], [0.07932692, 0.05528846]\n ], [[0.07211538, 0.14663462], [0.14903846, 0.10817308], [0.141...
# Copyright (c) MONAI Consortium # 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 in writing, so...
[ "numpy.asarray", "numpy.zeros", "numpy.max", "numpy.mean", "numpy.where", "numpy.interp" ]
[((2813, 2836), 'numpy.max', 'np.max', (['evaluation_mask'], {}), '(evaluation_mask)\n', (2819, 2836), True, 'import numpy as np\n'), ((2852, 2892), 'numpy.zeros', 'np.zeros', (['(max_label,)'], {'dtype': 'np.float32'}), '((max_label,), dtype=np.float32)\n', (2860, 2892), True, 'import numpy as np\n'), ((5921, 5993), '...
### Overview of artifact detection ### import os import numpy as np import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file) raw....
[ "mne.preprocessing.create_ecg_epochs", "mne.io.read_raw_fif", "mne.pick_types", "mne.preprocessing.create_eog_epochs", "numpy.searchsorted", "numpy.linspace", "mne.datasets.sample.data_path", "os.path.join" ]
[((102, 133), 'mne.datasets.sample.data_path', 'mne.datasets.sample.data_path', ([], {}), '()\n', (131, 133), False, 'import mne\n'), ((157, 231), 'os.path.join', 'os.path.join', (['sample_data_folder', '"""MEG"""', '"""sample"""', '"""sample_audvis_raw.fif"""'], {}), "(sample_data_folder, 'MEG', 'sample', 'sample_audv...
import networkx as nx import numpy.random as npr def draw_graph(G, edge_weight=None, layout: str = "kamada_kawai"): pos = nx.kamada_kawai_layout(G) if edge_weight: edge_labels = { (u, v): d[edge_weight] for u, v, d in G.edges(data=True) } # noqa: E501 nx.draw_networkx_edg...
[ "networkx.draw_networkx_edges", "networkx.kamada_kawai_layout", "networkx.draw_kamada_kawai", "networkx.draw_networkx_nodes", "numpy.random.normal", "networkx.draw_networkx_edge_labels", "networkx.DiGraph" ]
[((128, 153), 'networkx.kamada_kawai_layout', 'nx.kamada_kawai_layout', (['G'], {}), '(G)\n', (150, 153), True, 'import networkx as nx\n'), ((371, 401), 'networkx.draw_networkx_edges', 'nx.draw_networkx_edges', (['G', 'pos'], {}), '(G, pos)\n', (393, 401), True, 'import networkx as nx\n'), ((406, 454), 'networkx.draw_n...
# -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import import numpy as np from libs.configs._base_.models.retinanet_r50_fpn import * from libs.configs._base_.datasets.dota_detection import * from libs.configs._base_.schedules.schedule_1x import * from dataloader.pretrained_weights.pr...
[ "dataloader.pretrained_weights.pretrain_zoo.PretrainModelZoo", "numpy.array" ]
[((673, 691), 'dataloader.pretrained_weights.pretrain_zoo.PretrainModelZoo', 'PretrainModelZoo', ([], {}), '()\n', (689, 691), False, 'from dataloader.pretrained_weights.pretrain_zoo import PretrainModelZoo\n'), ((481, 512), 'numpy.array', 'np.array', (['DECAY_EPOCH', 'np.int32'], {}), '(DECAY_EPOCH, np.int32)\n', (489...