code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
'''
generate evaluation file for Cityscapes.
'''
import numpy as np
from PIL import Image
import utilities.get_default_palette as get_default_palette
BINS = [-0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5]
def get_mode(arr, num=1):
'''
get mode
'''
assert num <= 8
hist = np.histogram(arr, bins=BINS)... | [
"numpy.copy",
"numpy.argmax",
"utilities.get_default_palette.get_default_palette",
"numpy.histogram",
"numpy.max",
"numpy.array",
"numpy.arange",
"PIL.Image.fromarray",
"numpy.unique"
] | [((292, 320), 'numpy.histogram', 'np.histogram', (['arr'], {'bins': 'BINS'}), '(arr, bins=BINS)\n', (304, 320), True, 'import numpy as np\n'), ((350, 362), 'numpy.max', 'np.max', (['hist'], {}), '(hist)\n', (356, 362), True, 'import numpy as np\n'), ((1057, 1120), 'numpy.array', 'np.array', (["['0', '24', '25', '26', '... |
"""
Example script to do acquire a composite survey image using stage shift.
The script uses the center 50% of the image, shifts the stage by the appropriate amount
in x, y directions, and stitches the resulting images together into a larger super image.
To use:
Run Nion Swift and get a good image
Set the def... | [
"nionlib.api.get_instrument_by_id",
"math.radians",
"numpy.empty",
"nionlib.api.get_hardware_source_by_id",
"math.sin",
"time.time",
"math.cos"
] | [((5764, 5781), 'math.radians', 'math.radians', (['(-23)'], {}), '(-23)\n', (5776, 5781), False, 'import math\n'), ((1386, 1443), 'nionlib.api.get_hardware_source_by_id', 'nionlib.api.get_hardware_source_by_id', (['"""nionccd1010"""', '"""1"""'], {}), "('nionccd1010', '1')\n", (1423, 1443), False, 'import nionlib\n'), ... |
# Author: <NAME>
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
try:
import cPickle as pickle
except:
import pickle
import os
import active_learners.helper as helper
import h5py
import numpy as np
from active_learners.active_learner import run_ActiveL... | [
"os.mkdir",
"active_learners.active_learner.run_ActiveLearner",
"h5py.File",
"ipdb.set_trace",
"os.path.isdir",
"active_learners.helper.get_func_from_exp",
"active_learners.helper.get_xx_yy",
"numpy.array",
"active_learners.helper.gen_data",
"active_learners.helper.get_learner_from_method",
"act... | [((758, 787), 'active_learners.helper.get_func_from_exp', 'helper.get_func_from_exp', (['exp'], {}), '(exp)\n', (782, 787), True, 'import active_learners.helper as helper\n'), ((801, 830), 'active_learners.helper.gen_data', 'helper.gen_data', (['func', 'n_data'], {}), '(func, n_data)\n', (816, 830), True, 'import activ... |
from timeit import default_timer as timer
import numpy as np
start = timer()
class Link (object):
def __init__(self, data, next=None, previous=None):
self.data = data
self.next = next
self.previous = previous
class CircularList(object):
# Constructor
def __init__(self):
s... | [
"timeit.default_timer",
"numpy.unique"
] | [((69, 76), 'timeit.default_timer', 'timer', ([], {}), '()\n', (74, 76), True, 'from timeit import default_timer as timer\n'), ((1808, 1815), 'timeit.default_timer', 'timer', ([], {}), '()\n', (1813, 1815), True, 'from timeit import default_timer as timer\n'), ((1470, 1504), 'numpy.unique', 'np.unique', (['raw'], {'ret... |
import argparse
import os
import sys
import re
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(BASE_DIR)
from model import *
import indoor3d_util
import time
import numpy as np
import get_instances
import project_inst
"python inference_online_all.py --path_dat... | [
"os.mkdir",
"os.remove",
"argparse.ArgumentParser",
"numpy.amin",
"numpy.argmax",
"os.walk",
"indoor3d_util.get_info_classes",
"numpy.mean",
"os.path.join",
"sys.path.append",
"os.path.abspath",
"indoor3d_util.room2blocks_plus_normalized_parsed",
"os.path.dirname",
"os.path.exists",
"pro... | [((112, 137), 'os.path.dirname', 'os.path.dirname', (['BASE_DIR'], {}), '(BASE_DIR)\n', (127, 137), False, 'import os\n'), ((138, 163), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (153, 163), False, 'import sys\n'), ((455, 480), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}... |
"""Module that contains the tools to open and retrieve raster properties and statistics.
Classes:
ImgManagerError.
ImgManager.
"""
import logging
import gettext
import numpy as np
from osgeo import gdal
from controls.imagery_controls.results import WorldFileData
class RasterManagerError(Exception):
"""Exception... | [
"numpy.count_nonzero",
"osgeo.gdal.Open",
"controls.imagery_controls.results.WorldFileData",
"logging.getLogger"
] | [((1198, 1331), 'controls.imagery_controls.results.WorldFileData', 'WorldFileData', ([], {'pixel_size': '[self.geo_transform[1], self.geo_transform[5]]', 'rotation': '[self.geo_transform[4], self.geo_transform[2]]'}), '(pixel_size=[self.geo_transform[1], self.geo_transform[5]],\n rotation=[self.geo_transform[4], sel... |
import numpy as np
import pandas as pd
from copy import deepcopy as dc
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.cm as cm
from tqdm import tqdm_notebook as tqdm
import XPyS
from .helper_functions import index_of, guess_from_data
import XPyS.config as cfg
import os
fro... | [
"numpy.abs",
"numpy.empty",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.exp",
"scipy.interpolate.interp1d",
"matplotlib.patches.Patch",
"numpy.round",
"pandas.DataFrame",
"XPyS.config.element_color.keys",
"numpy.cumsum",
"numpy.max",
"nump... | [((2976, 2993), 'numpy.round', 'np.round', (['xnew', '(3)'], {}), '(xnew, 3)\n', (2984, 2993), True, 'import numpy as np\n'), ((5682, 5700), 'pandas.concat', 'pd.concat', (['df_list'], {}), '(df_list)\n', (5691, 5700), True, 'import pandas as pd\n'), ((5772, 5797), 'pandas.concat', 'pd.concat', (['df_params_list'], {})... |
"""
Command line interface to several manipulations of D-WAQ formatted
hydrodynamic data.
Typical invocation:
python -m stompy.model.delft.waq_hydro_editor -h
(to get help message).
python -m stompy.model.delft.waq_hydro_editor -i path/to/com-foo.hyd -a agg.shp -o output_agg/output
Read existing, serial DWAQ ... | [
"numpy.abs",
"argparse.ArgumentParser",
"os.path.dirname",
"logging.info",
"datetime.timedelta"
] | [((2953, 3039), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Manipulate transport data in D-WAQ format."""'}), "(description=\n 'Manipulate transport data in D-WAQ format.')\n", (2976, 3039), False, 'import argparse\n'), ((8664, 8692), 'os.path.dirname', 'os.path.dirname', (['args.o... |
import os
import time
import numpy as np
from functools import reduce
import torch
import torch.nn as nn
import torch.nn.functional as F
from carle.env import CARLE
from carle.mcl import RND2D, AE2D
from game_of_carle.agents.agent import Agent
class CARLA(Agent):
def __init__(self, **kwargs):
super(CA... | [
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.rand_like",
"torch.Tensor",
"numpy.array",
"torch.rand",
"functools.reduce",
"torch.nn.Sigmoid"
] | [((807, 897), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', '(9)', '(3)'], {'groups': '(1)', 'padding': '(1)', 'stride': '(1)', 'padding_mode': '"""circular"""', 'bias': '(False)'}), "(1, 9, 3, groups=1, padding=1, stride=1, padding_mode='circular',\n bias=False)\n", (816, 897), True, 'import torch.nn as nn\n'), ((2482, ... |
import argparse
import os
from os.path import join
from tempfile import TemporaryDirectory
from collections import OrderedDict
import numpy as np
import torch
from sklearn.metrics import confusion_matrix, accuracy_score
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.dataset... | [
"pytorch_lightning.Trainer",
"pytorch_lightning.seed_everything",
"argparse.ArgumentParser",
"numpy.argmax",
"torch.cat",
"torchvision.transforms.Normalize",
"torch.no_grad",
"os.path.join",
"tempfile.TemporaryDirectory",
"torch.utils.data.DataLoader",
"create_datasets.create_patches_dataset_fir... | [((10699, 10738), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (10722, 10738), False, 'import argparse\n'), ((15625, 15675), 'pytorch_lightning.loggers.WandbLogger', 'WandbLogger', ([], {'project': '"""TFG"""', 'tags': '[hparams.dataset]'}), "(project='TFG',... |
import torch.optim as optim # Import optim
import torchvision # Import torchvision
import h5py # import h5py
from torch.utils.data import dataset # import dataset
from torch.utils.data import DataLoader # Import Dataloader
import torchvision.transforms as transforms # Import Transform
import pandas as pd # Impor... | [
"numpy.random.seed",
"pytorchtools.EarlyStopping",
"torch.device",
"torch.no_grad",
"os.path.join",
"torch.utils.data.DataLoader",
"torch.load",
"random.seed",
"torch.utils.data.random_split",
"torch.nn.Linear",
"numpy.save",
"torch.manual_seed",
"torch.nn.Conv2d",
"torch.cuda.manual_seed"... | [((1361, 1378), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (1372, 1378), False, 'import random\n'), ((1379, 1399), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (1393, 1399), True, 'import numpy as np\n'), ((1400, 1423), 'torch.manual_seed', 'torch.manual_seed', (['SEED'], {}), '(SEE... |
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %%
import math
import numpy as np
import matplotlib.pyplot as plt
import struct
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data as D
import os
import multiprocessing as mp
os.environ["KMP_D... | [
"math.isnan",
"numpy.save",
"struct.unpack_from",
"multiprocessing.Array",
"numpy.empty",
"torch.load",
"numpy.zeros",
"torch.FloatTensor",
"struct.calcsize",
"torch.nn.Linear",
"torch.nn.functional.sigmoid",
"multiprocessing.Pool",
"multiprocessing.cpu_count"
] | [((4021, 4040), 'torch.load', 'torch.load', (['filestr'], {}), '(filestr)\n', (4031, 4040), False, 'import torch\n'), ((4560, 4585), 'numpy.zeros', 'np.zeros', (['(21 * 900 * 1800)'], {}), '(21 * 900 * 1800)\n', (4568, 4585), True, 'import numpy as np\n'), ((4590, 4608), 'multiprocessing.Array', 'mp.Array', (['"""f"""'... |
'''
The proposed methoed: DynWalks
---------------------------------
scheme=3, # the final version of DynWalks presented and tested in our paper
limit=0.1, local_global=0.5 # DynWalks key hyper-parameters
# NOTE: limit i.e. $\alpha$, local_global i.e. $... | [
"pickle.dump",
"random.uniform",
"warnings.filterwarnings",
"random.shuffle",
"gensim.models.Word2Vec",
"random.choice",
"time.time",
"networkx.neighbors",
"pickle.load",
"numpy.random.choice",
"collections.Counter"
] | [((759, 838), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""', 'category': 'UserWarning', 'module': '"""gensim"""'}), "(action='ignore', category=UserWarning, module='gensim')\n", (782, 838), False, 'import warnings\n'), ((8235, 8246), 'time.time', 'time.time', ([], {}), '()\n', (82... |
#%%
import pandas as pd
import pickle
import numpy as np
import matplotlib.pyplot as plt
import gensim
import sklearn.decomposition
import sklearn.manifold
from sklearn.neural_network import MLPClassifier
#%%
#--Read in data
D2V_WOstop = gensim.models.Doc2Vec.load(r'..\data\process\D2V_WOstop')
df = pd.read_csv(r'..... | [
"matplotlib.pyplot.show",
"gensim.models.Doc2Vec.load",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.close",
"matplotlib.pyplot.yticks",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.arange",
"sklearn.neural_network.MLPClassifier",
"matplotlib.pyplot.xticks",
"pandas.... | [((241, 300), 'gensim.models.Doc2Vec.load', 'gensim.models.Doc2Vec.load', (['"""..\\\\data\\\\process\\\\D2V_WOstop"""'], {}), "('..\\\\data\\\\process\\\\D2V_WOstop')\n", (267, 300), False, 'import gensim\n'), ((1202, 1221), 'numpy.array', 'np.array', (['core_vecs'], {}), '(core_vecs)\n', (1210, 1221), True, 'import n... |
from collections import deque
import numpy as np
import pickle
import os
import cv2
import inspect
import functools
from ddpg_curiosity_mc_her import logger
try:
from mujoco_py import MujocoException
except Exception:
logger.warn("Mujoco could not be imported.")
def convert_episode_to_batch_major(episode):... | [
"pickle.dump",
"numpy.abs",
"inspect.getfullargspec",
"cv2.VideoWriter_fourcc",
"cv2.waitKey",
"numpy.empty",
"numpy.zeros",
"numpy.isnan",
"numpy.mean",
"numpy.array",
"ddpg_curiosity_mc_her.logger.get_dir",
"functools.wraps",
"ddpg_curiosity_mc_her.logger.warn",
"cv2.destroyAllWindows",
... | [((755, 785), 'inspect.getfullargspec', 'inspect.getfullargspec', (['method'], {}), '(method)\n', (777, 785), False, 'import inspect\n'), ((1070, 1093), 'functools.wraps', 'functools.wraps', (['method'], {}), '(method)\n', (1085, 1093), False, 'import functools\n'), ((229, 273), 'ddpg_curiosity_mc_her.logger.warn', 'lo... |
import matplotlib.pyplot as plt
import numpy as np
import random as r
import time
from drawnow import *
recipe = ["225 g flour",
"90 g sugar",
"1 egg",
"60 g butter",
"100 ml milk",
"1/2 package of yeast",
"225 g flour",
"90 g sugar",
"1... | [
"matplotlib.pyplot.title",
"random.randint",
"numpy.deg2rad",
"time.sleep",
"numpy.sign"
] | [((1502, 1541), 'matplotlib.pyplot.title', 'plt.title', (['"""Matplotlib bakery: A donut"""'], {}), "('Matplotlib bakery: A donut')\n", (1511, 1541), True, 'import matplotlib.pyplot as plt\n'), ((2475, 2514), 'matplotlib.pyplot.title', 'plt.title', (['"""Matplotlib bakery: A donut"""'], {}), "('Matplotlib bakery: A don... |
# This example demonstrates how to regrid between a UGRID Mesh and a Grid.
# The data files can be retrieved from the ESMF data repository by uncommenting the
# following block of code:
#
# import os
# DD = os.path.join(os.getcwd(), "examples/data")
# if not os.path.isdir(DD):
# os.makedirs(DD)
# from ESMF.util.cac... | [
"numpy.radians",
"matplotlib.pyplot.show",
"numpy.abs",
"numpy.copy",
"matplotlib.pyplot.gca",
"ESMF.Field",
"ESMF.Regrid",
"matplotlib.pyplot.figure",
"numpy.where",
"ESMF.Grid",
"numpy.min",
"numpy.max",
"ESMF.Mesh",
"ESMF.local_pet"
] | [((3391, 3480), 'ESMF.Mesh', 'ESMF.Mesh', ([], {'filename': 'meshfile', 'filetype': 'ESMF.FileFormat.UGRID', 'meshname': '"""adcirc_mesh"""'}), "(filename=meshfile, filetype=ESMF.FileFormat.UGRID, meshname=\n 'adcirc_mesh')\n", (3400, 3480), False, 'import ESMF\n'), ((3584, 3689), 'ESMF.Grid', 'ESMF.Grid', ([], {'fi... |
from __future__ import print_function
import tensorflow as tf
from functools import partial
import os
from os import listdir
from os.path import isfile, join
import shutil
import sys
from glob import glob
import math
import json
import logging
import numpy as np
from PIL import Image
from datetime import datetime
from ... | [
"functools.partial",
"json.dump",
"os.makedirs",
"tensorflow.summary.scalar",
"os.path.realpath",
"numpy.zeros",
"tensorflow.reduce_mean",
"datetime.datetime.now",
"tensorflow.core.framework.summary_pb2.Summary.Value",
"os.path.exists",
"tensorflow.python.client.device_lib.list_local_devices",
... | [((616, 638), 'tensorflow.reduce_mean', 'tf.reduce_mean', (['tensor'], {}), '(tensor)\n', (630, 638), True, 'import tensorflow as tf\n'), ((698, 748), 'tensorflow.summary.scalar', 'tf.summary.scalar', (["(name + '_ave')", 'ave', 'collections'], {}), "(name + '_ave', ave, collections)\n", (715, 748), True, 'import tenso... |
""" This module contains functions that return a new, single point in a given
parameter space. In general, these functions are not used to return
multi-dimensional arrays. These functions are intended to be called only a
few times.
"""
import numpy
from mystic import math
def uniform(lower_bounds, upper_bounds):
... | [
"mystic.math.fillpts",
"numpy.random.uniform",
"numpy.zeros"
] | [((742, 759), 'numpy.zeros', 'numpy.zeros', (['ndim'], {}), '(ndim)\n', (753, 759), False, 'import numpy\n'), ((1658, 1727), 'mystic.math.fillpts', 'math.fillpts', (['lower_bounds', 'upper_bounds', 'n_new_pts', 'data', 'rtol', 'dist'], {}), '(lower_bounds, upper_bounds, n_new_pts, data, rtol, dist)\n', (1670, 1727), Fa... |
import plot_line
import numpy as np
import reader
import render_figure
class PlotAltitude(plot_line.LinePlot):
def __init__(self, fig_cluster, fig_name, fig):
self.fig = fig
self.fig_name = fig_name
self.fig_cluster = fig_cluster
self.config = self.get_config()
self.index_a... | [
"numpy.nanmax",
"numpy.isnan",
"numpy.nanmin",
"numpy.append",
"numpy.array",
"numpy.delete",
"render_figure.RenderFigure"
] | [((461, 473), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (469, 473), True, 'import numpy as np\n'), ((516, 528), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (524, 528), True, 'import numpy as np\n'), ((2201, 2228), 'numpy.append', 'np.append', (['self.alt_x', 'time'], {}), '(self.alt_x, time)\n', (2210, ... |
# Copyright 2019, The Jelly Bean World 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 ... | [
"numpy.array",
"gym.envs.registration.register"
] | [((10444, 10473), 'numpy.array', 'np.array', (['[0, -1, 1, 0, 0, 0]'], {}), '([0, -1, 1, 0, 0, 0])\n', (10452, 10473), True, 'import numpy as np\n'), ((10758, 10898), 'gym.envs.registration.register', 'register', ([], {'id': '"""JBW-v0"""', 'entry_point': '"""jbw.environment:JBWEnv"""', 'kwargs': "{'sim_config': sim_co... |
# Copyright 2020 Standard Cyborg
#
# 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 wr... | [
"scsdk.scsdk_native.Node",
"scsdk.scsdk_native.DepthImageNode",
"scsdk.scsdk_native.ColorImageNode",
"scsdk.scsdk_native.DepthImage",
"scsdk.scsdk_native.GeometryNode",
"scsdk.scsdk_native.WriteSceneGraphToGltf",
"numpy.zeros",
"scsdk.scsdk_native.ColorImage",
"PIL.Image.open",
"numpy.array",
"s... | [((764, 776), 'scsdk.scsdk_native.Node', 'scsdk.Node', ([], {}), '()\n', (774, 776), True, 'from scsdk import scsdk_native as scsdk\n'), ((876, 896), 'scsdk.scsdk_native.GeometryNode', 'scsdk.GeometryNode', ([], {}), '()\n', (894, 896), True, 'from scsdk import scsdk_native as scsdk\n'), ((951, 994), 'numpy.array', 'np... |
"""
Copyright (c) <2018> YoongiKim
See the file license.txt for copying permission.
"""
import tensorflow as tf
import random
import os
import numpy as np
# import matplotlib.pyplot as plt
import cv2
from tensorflow.examples.tutorials.mnist import input_data
tf.set_random_seed(777) # reproducibility
# This path ... | [
"tensorflow.contrib.layers.xavier_initializer",
"tensorflow.reshape",
"os.walk",
"numpy.shape",
"tensorflow.matmul",
"tensorflow.Variable",
"tensorflow.nn.conv2d",
"tensorflow.nn.relu",
"os.path.exists",
"tensorflow.set_random_seed",
"tensorflow.nn.softmax_cross_entropy_with_logits_v2",
"tenso... | [((264, 287), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(777)'], {}), '(777)\n', (282, 287), True, 'import tensorflow as tf\n'), ((1447, 1473), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {}), '(tf.float32)\n', (1461, 1473), True, 'import tensorflow as tf\n'), ((1501, 1540), 'tensorflow.pl... |
from all_net_def import *
import os
import numpy as np
import torch
from torch import nn
from torch.utils.data import Dataset, DataLoader
import t1_audio_process
np.set_printoptions(threshold=np.inf)
class AudioDataset_test(Dataset):
def __init__(self, csv_file, transform=None):
self.data = np.load(csv_f... | [
"t1_audio_process.test",
"numpy.set_printoptions",
"numpy.load",
"torch.utils.data.DataLoader",
"torch.load",
"torch.max",
"numpy.reshape",
"torch.cuda.is_available",
"torch.is_tensor",
"os.listdir",
"torch.tensor"
] | [((163, 200), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (182, 200), True, 'import numpy as np\n'), ((1029, 1053), 'torch.load', 'torch.load', (['"""t1_cnn.pth"""'], {}), "('t1_cnn.pth')\n", (1039, 1053), False, 'import torch\n'), ((1095, 1118), 't1_audio_pro... |
""" Usage:
load_pretrained_word_embeddings [--glove=GLOVE_FN]
"""
from docopt import docopt
import numpy as np
from word_index import Word_index
import logging
logging.basicConfig(level = logging.DEBUG)
import sys
sys.path.append("./common")
from symbols import UNK_INDEX, UNK_SYMBOL, UNK_VALUE
from keras.layers im... | [
"sys.path.append",
"logging.debug",
"keras_bert.load_trained_model_from_checkpoint",
"logging.basicConfig",
"docopt.docopt",
"codecs.open",
"tokenization.FullTokenizer",
"numpy.asarray",
"keras.layers.SpatialDropout1D",
"logging.info",
"keras.layers.Lambda",
"keras.backend.mean",
"symbols.UN... | [((165, 205), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (184, 205), False, 'import logging\n'), ((219, 246), 'sys.path.append', 'sys.path.append', (['"""./common"""'], {}), "('./common')\n", (234, 246), False, 'import sys\n'), ((7553, 7568), 'docopt.docop... |
from sensors.sensor import Sensor
from matplotlib import pyplot as plt
from PIL import Image
import numpy as np
import pygame
import io
class OverviewSensor(Sensor):
def __init__(self, **kwargs):
super(OverviewSensor, self).__init__(**kwargs)
self.name = 'overview'
def get_sensory_input(self... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"pygame.image.tostring",
"matplotlib.pyplot.draw",
"matplotlib.pyplot.figure",
"PIL.Image.frombytes"
] | [((398, 438), 'pygame.image.tostring', 'pygame.image.tostring', (['env.screen', '"""RGB"""'], {}), "(env.screen, 'RGB')\n", (419, 438), False, 'import pygame\n'), ((459, 504), 'PIL.Image.frombytes', 'Image.frombytes', (['"""RGB"""', '(width, height)', 'data'], {}), "('RGB', (width, height), data)\n", (474, 504), False,... |
import numpy as np
from matplotlib import pyplot as plt
from ..Xfit.MCMC_straight_line import mcmc_sl
from ..Xfit.fit_basic import fit_basic
from ..Xfit.FitPoissonGamma import fit_pg
from ..Xplot.niceplot import niceplot
from matplotlib.offsetbox import AnchoredText
from matplotlib import ticker
from ..misc.running_mea... | [
"numpy.std",
"numpy.ones",
"numpy.histogram",
"numpy.mean",
"numpy.array",
"numpy.arange",
"numpy.diff",
"matplotlib.colors.LogNorm",
"numpy.where"
] | [((1376, 1415), 'numpy.histogram', 'np.histogram', (['x'], {'bins': '(100)', 'density': '(True)'}), '(x, bins=100, density=True)\n', (1388, 1415), True, 'import numpy as np\n'), ((1567, 1586), 'numpy.array', 'np.array', (['[0, ymax]'], {}), '([0, ymax])\n', (1575, 1586), True, 'import numpy as np\n'), ((5477, 5501), 'n... |
from typing import Optional
import numpy as np
from xarray import Dataset
from .api import create_genotype_call_dataset
from .utils import split_array_chunks
def simulate_genotype_call_dataset(
n_variant: int,
n_sample: int,
n_ploidy: int = 2,
n_allele: int = 2,
n_contig: int = 1,
seed: Opti... | [
"numpy.unique",
"numpy.arange",
"numpy.random.RandomState"
] | [((1451, 1483), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': 'seed'}), '(seed=seed)\n', (1472, 1483), True, 'import numpy as np\n'), ((1729, 1746), 'numpy.unique', 'np.unique', (['contig'], {}), '(contig)\n', (1738, 1746), True, 'import numpy as np\n'), ((1676, 1695), 'numpy.arange', 'np.arange', ... |
import numpy as np
import input_data
from sklearn.utils import shuffle
np.random.seed(9999)
mnist = input_data.read_data_sets('../MNIST_data', one_hot=True)
X_train = mnist.train.images
t_train = mnist.train.labels
X_test = mnist.test.images
t_test = mnist.test.labels
X_train, t_train = shuffle(X_train, t_train)
... | [
"input_data.read_data_sets",
"numpy.save",
"numpy.zeros_like",
"numpy.random.seed",
"numpy.maximum",
"numpy.random.randn",
"numpy.max",
"sklearn.utils.shuffle",
"numpy.sqrt"
] | [((73, 93), 'numpy.random.seed', 'np.random.seed', (['(9999)'], {}), '(9999)\n', (87, 93), True, 'import numpy as np\n'), ((103, 159), 'input_data.read_data_sets', 'input_data.read_data_sets', (['"""../MNIST_data"""'], {'one_hot': '(True)'}), "('../MNIST_data', one_hot=True)\n", (128, 159), False, 'import input_data\n'... |
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.collections import LineCollection
from koala import graph_color, plotting
from koala import graph_color
def rotate(vector, angle):
rm = np.array([
[np.cos(angle), -np.sin(angle)],
[np.sin(angle), np.cos(angle)]
])
return... | [
"matplotlib.pyplot.show",
"numpy.sum",
"numpy.zeros",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.linspace",
"koala.graph_color.edge_color",
"numpy.cos",
"numpy.concatenate"
] | [((4982, 5018), 'koala.graph_color.edge_color', 'graph_color.edge_color', (['adjacency', '(3)'], {}), '(adjacency, 3)\n', (5004, 5018), False, 'from koala import graph_color\n'), ((5070, 5108), 'numpy.array', 'np.array', (['[color_dict[c] for c in out]'], {}), '([color_dict[c] for c in out])\n', (5078, 5108), True, 'im... |
from __future__ import print_function, absolute_import, division, unicode_literals
# Requirements:
import numpy as np, glob, os, sys
#from scipy import misc
import imageio
import tensorflow as tf
import pdb
from spit.utils import one_hot_encoded
sys.dont_write_bytecode = True
def load_linear_pngs(instr, data_typ... | [
"imageio.imread",
"tensorflow.data.Dataset.from_tensor_slices",
"numpy.array",
"pdb.set_trace",
"glob.glob",
"os.getenv"
] | [((398, 420), 'os.getenv', 'os.getenv', (['"""SPIT_DATA"""'], {}), "('SPIT_DATA')\n", (407, 420), False, 'import numpy as np, glob, os, sys\n'), ((5059, 5077), 'numpy.array', 'np.array', (['raw_data'], {}), '(raw_data)\n', (5067, 5077), True, 'import numpy as np, glob, os, sys\n'), ((5285, 5301), 'numpy.array', 'np.arr... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 19 19:33:17 2019
@author: Mysia
"""
import numpy as np
def nnloss(x,t,dzdy):
instanceWeights=np.ones(len(x))
res=x-t
if(dzdy==0):
y = (1/2) * instanceWeights * np.power(res,2)
else:
y = res
return y | [
"numpy.power"
] | [((251, 267), 'numpy.power', 'np.power', (['res', '(2)'], {}), '(res, 2)\n', (259, 267), True, 'import numpy as np\n')] |
import numpy as np
import torch
from torch.autograd import Variable
def data_generator(T, mem_length, b_size):
"""
Generate data for the copying memory task
:param T: The total blank time length
:param mem_length: The length of the memory to be recalled
:param b_size: The batch size
:return: I... | [
"torch.zeros",
"torch.ones",
"numpy.random.randint",
"torch.cat"
] | [((455, 479), 'torch.zeros', 'torch.zeros', (['(b_size, T)'], {}), '((b_size, T))\n', (466, 479), False, 'import torch\n'), ((553, 586), 'torch.zeros', 'torch.zeros', (['(b_size, mem_length)'], {}), '((b_size, mem_length))\n', (564, 586), False, 'import torch\n'), ((596, 638), 'torch.cat', 'torch.cat', (['(seq, zeros[:... |
import numpy as np
x = np.array([1., 2.])
x /= np.sqrt(np.sum(x**2 ,axis=-1))[..., np.newaxis]
print(x)
print(x[0]+x[1]) | [
"numpy.array",
"numpy.sum"
] | [((24, 44), 'numpy.array', 'np.array', (['[1.0, 2.0]'], {}), '([1.0, 2.0])\n', (32, 44), True, 'import numpy as np\n'), ((56, 79), 'numpy.sum', 'np.sum', (['(x ** 2)'], {'axis': '(-1)'}), '(x ** 2, axis=-1)\n', (62, 79), True, 'import numpy as np\n')] |
from classify_utils import setup_args, setup, get_basemodel, get_data, get_logger, setup_args_preprocessing, setup_args_getE
from util import Logger
import argparse
import torch
import numpy as np
from statsmodels.stats.proportion import proportion_confint
import scipy.stats as sps
from collections import Counter
impor... | [
"classify_utils.get_data",
"classify_utils.get_logger",
"torchvision.transforms.functional.center_crop",
"classify_utils.setup_args_getE",
"argparse.ArgumentParser",
"classify_utils.setup_args",
"torchvision.transforms.functional.resize",
"numpy.expand_dims",
"classify_utils.setup_args_preprocessing... | [((516, 541), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (539, 541), False, 'import argparse\n'), ((551, 569), 'classify_utils.setup_args', 'setup_args', (['parser'], {}), '(parser)\n', (561, 569), False, 'from classify_utils import setup_args, setup, get_basemodel, get_data, get_logger, se... |
'''
Created on 2018年3月28日
@author: <NAME>
'''
import numpy as np
import Lib.RFLib as RFLib
def kernalTransfrom(dataMatrix, vector, kTup):
if kTup[0] == "lin":
return vector * dataMatrix.transpose()
elif kTup[0] == "rbf":
delta = dataMatrix - vector
K = np.matrix(np.diag(delta * delta.t... | [
"numpy.matrix",
"numpy.abs",
"numpy.multiply",
"numpy.zeros",
"numpy.nonzero",
"numpy.random.randint",
"numpy.exp"
] | [((5294, 5329), 'numpy.matrix', 'np.matrix', (['trainSet'], {'dtype': 'np.float'}), '(trainSet, dtype=np.float)\n', (5303, 5329), True, 'import numpy as np\n'), ((573, 609), 'numpy.matrix', 'np.matrix', (['dataMatIn'], {'dtype': 'np.float'}), '(dataMatIn, dtype=np.float)\n', (582, 609), True, 'import numpy as np\n'), (... |
import os
import copy
import pandas as pd
import numpy as np
import random
from sklearn.preprocessing import StandardScaler
# from imblearn.over_sampling import SMOTE
from sklearn.decomposition import PCA
from sklearn.metrics import mean_squared_error as mse
import matplotlib.pyplot as plt
from evaluation import heatm... | [
"numpy.stack",
"copy.deepcopy",
"sklearn.preprocessing.StandardScaler",
"os.path.isdir",
"numpy.corrcoef",
"pandas.read_table",
"numpy.array",
"sklearn.decomposition.PCA",
"evaluation.heatmap",
"matplotlib.pyplot.subplots"
] | [((3364, 3390), 'numpy.stack', 'np.stack', (['feat_all'], {'axis': '(0)'}), '(feat_all, axis=0)\n', (3372, 3390), True, 'import numpy as np\n'), ((3719, 3742), 'numpy.corrcoef', 'np.corrcoef', (['feat_all.T'], {}), '(feat_all.T)\n', (3730, 3742), True, 'import numpy as np\n'), ((3757, 3771), 'matplotlib.pyplot.subplots... |
import numpy as np
import cv2
from skimage.feature import hog
class FeatureExtractor():
def __init__(self, config):
self.conf = config
def calc_hog_features(self, img):
hog_features = []
for channel in range(img.shape[2]):
winSize = (img.shape[0], img.shape[1])
... | [
"cv2.resize",
"numpy.ravel",
"skimage.feature.hog",
"numpy.histogram",
"cv2.HOGDescriptor",
"numpy.concatenate"
] | [((1537, 1559), 'numpy.ravel', 'np.ravel', (['hog_features'], {}), '(hog_features)\n', (1545, 1559), True, 'import numpy as np\n'), ((2102, 2158), 'numpy.histogram', 'np.histogram', (['img[:, :, 0]'], {'bins': 'nbins', 'range': 'bins_range'}), '(img[:, :, 0], bins=nbins, range=bins_range)\n', (2114, 2158), True, 'impor... |
import warnings
from typing import Dict, List, Union
import numpy as np
import pandas as pd
from loguru import logger
from sklearn.ensemble import RandomForestClassifier
from sklearn.exceptions import ConvergenceWarning
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import f1_score, matthews_... | [
"sklearn.ensemble.RandomForestClassifier",
"sklearn.preprocessing.StandardScaler",
"warnings.filterwarnings",
"pandas.read_csv",
"numpy.asarray",
"loguru.logger.warning",
"numpy.zeros",
"sklearn.model_selection.KFold",
"sklearn.metrics.roc_auc_score",
"sklearn.tree.DecisionTreeClassifier",
"logu... | [((1938, 1981), 'loguru.logger.info', 'logger.info', (['f"""Training Ensemble Model ..."""'], {}), "(f'Training Ensemble Model ...')\n", (1949, 1981), False, 'from loguru import logger\n'), ((2292, 2314), 'pandas.read_csv', 'pd.read_csv', (['data_path'], {}), '(data_path)\n', (2303, 2314), True, 'import pandas as pd\n'... |
import random
from pathlib import Path
from typing import Iterator
import numpy as np
import torch.utils.data
from torch import nn
from torch.utils.data.dataset import T_co
from torch.nn import functional as F
class RandomShiftsAug(nn.Module):
def __init__(self, pad):
super().__init__()
self.pad ... | [
"numpy.load",
"torch.nn.functional.grid_sample",
"random.sample",
"random.choices",
"random.choice",
"pathlib.Path",
"numpy.random.rand",
"torch.nn.functional.pad"
] | [((457, 487), 'torch.nn.functional.pad', 'F.pad', (['x', 'padding', '"""replicate"""'], {}), "(x, padding, 'replicate')\n", (462, 487), True, 'from torch.nn import functional as F\n'), ((1274, 1339), 'torch.nn.functional.grid_sample', 'F.grid_sample', (['x', 'grid'], {'padding_mode': '"""zeros"""', 'align_corners': '(F... |
# Copyright (c) 2021, NVIDIA CORPORATION. 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 applic... | [
"tensorflow.reshape",
"numpy.iinfo",
"os.close",
"os.path.join",
"tensorflow.random.uniform",
"tensorflow.concat",
"tensorflow.io.decode_raw",
"tensorflow.cast",
"tensorflow.data.FixedLengthRecordDataset",
"tensorflow.ones",
"os.open",
"tensorflow.data.Dataset.zip",
"os.fstat",
"tensorflow... | [((1613, 1703), 'collections.namedtuple', 'namedtuple', (['"""DatasetMetadata"""', "['num_numerical_features', 'categorical_cardinalities']"], {}), "('DatasetMetadata', ['num_numerical_features',\n 'categorical_cardinalities'])\n", (1623, 1703), False, 'from collections import namedtuple\n'), ((1172, 1202), 'os.open... |
import os
import sys
sys.path.append("./")
sys.path.append("../")
sys.path.append("create_plots/")
import datetime as dt
import pandas as pd
import numpy as np
import matplotlib as mpl
from matplotlib.dates import num2date
import matplotlib.pyplot as plt
from scipy.stats import beta
import pickle
import pydarn
from py... | [
"numpy.sum",
"pandas.read_csv",
"utils.fetch_file",
"matplotlib.pyplot.figure",
"pickle.load",
"numpy.histogram",
"matplotlib.colors.LogNorm",
"numpy.round",
"utils._run_riberio_threshold_on_rad",
"utils.get_session",
"numpy.unique",
"sys.path.append",
"pandas.DataFrame",
"matplotlib.rcPar... | [((21, 42), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (36, 42), False, 'import sys\n'), ((43, 65), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (58, 65), False, 'import sys\n'), ((66, 98), 'sys.path.append', 'sys.path.append', (['"""create_plots/"""'], {}), "('crea... |
"""Unit tests for code in shared.py.
Copyright by <NAME>
Released under the MIT license - see LICENSE file for details
"""
from unittest import TestCase
import numpy as np
import proset.shared as shared
from test.test_set_manager import REFERENCE, PROTOTYPES, FEATURE_WEIGHTS # pylint: disable=wrong-impo... | [
"proset.shared.check_scale_offset",
"numpy.sum",
"numpy.testing.assert_array_equal",
"numpy.zeros",
"numpy.ones",
"numpy.array",
"numpy.testing.assert_allclose",
"proset.shared.check_feature_names"
] | [((2439, 2503), 'numpy.zeros', 'np.zeros', (['(REFERENCE.shape[0], PROTOTYPES.shape[0])'], {'dtype': 'float'}), '((REFERENCE.shape[0], PROTOTYPES.shape[0]), dtype=float)\n', (2447, 2503), True, 'import numpy as np\n'), ((2775, 2835), 'numpy.testing.assert_allclose', 'np.testing.assert_allclose', (['similarity', 'refere... |
import os
import time
import h5py
import numpy as np
from annotypes import Anno, add_call_types
from scanpointgenerator import Point
from malcolm.core import APartName, Part, PartRegistrar
from malcolm.modules import builtin, scanning
from ..util import interesting_pattern, make_gaussian_blob
with Anno("Width of de... | [
"h5py.File",
"malcolm.modules.scanning.infos.RunProgressInfo",
"numpy.sum",
"annotypes.Anno",
"time.time",
"malcolm.modules.scanning.hooks.ConfigureHook.create_info",
"malcolm.modules.scanning.infos.DatasetProducedInfo",
"os.path.join"
] | [((303, 334), 'annotypes.Anno', 'Anno', (['"""Width of detector image"""'], {}), "('Width of detector image')\n", (307, 334), False, 'from annotypes import Anno, add_call_types\n'), ((358, 390), 'annotypes.Anno', 'Anno', (['"""Height of detector image"""'], {}), "('Height of detector image')\n", (362, 390), False, 'fro... |
from skfuzzy import control as ctrl
import skfuzzy as fuzz
import numpy as np
from fuzzy_utils import create_universes_membership_functions
class VehicleRules:
def __init__(self, show_sim_result=None):
prox, over, spat = create_universes_membership_functions()
self.__show_sim_result = show_sim_res... | [
"skfuzzy.control.ControlSystemSimulation",
"skfuzzy.trimf",
"fuzzy_utils.create_universes_membership_functions",
"skfuzzy.control.Rule",
"numpy.arange",
"skfuzzy.control.ControlSystem",
"skfuzzy.interp_membership"
] | [((235, 274), 'fuzzy_utils.create_universes_membership_functions', 'create_universes_membership_functions', ([], {}), '()\n', (272, 274), False, 'from fuzzy_utils import create_universes_membership_functions\n'), ((1241, 1303), 'skfuzzy.trimf', 'fuzz.trimf', (['self.__cycle_interaction.universe', '[0.4, 0.7, 1.0]'], {}... |
import pandas as pd
import numpy as np
import json
import subprocess
df = pd.read_csv('ingr.csv', encoding='latin-1')
df_new = df.groupby('recipe_id')['ingredients'].apply(list).reset_index(name='ingredients')
ingredients = df_new['ingredients'].to_numpy()
parsed_ingr = []
for ingr in ingredients:
with open('tmp... | [
"pandas.read_csv",
"numpy.savetxt",
"json.load"
] | [((75, 118), 'pandas.read_csv', 'pd.read_csv', (['"""ingr.csv"""'], {'encoding': '"""latin-1"""'}), "('ingr.csv', encoding='latin-1')\n", (86, 118), True, 'import pandas as pd\n'), ((887, 947), 'numpy.savetxt', 'np.savetxt', (['"""parsed_ingredients"""', 'parsed_ingr'], {'delimiter': '""","""'}), "('parsed_ingredients'... |
""" Epsilon Greedy. """
from typing import Union, Dict, Iterator, NamedTuple
from numpy import random
from .deterministic import DeterministicPolicy
from .exploration_schedules import get_schedule as get_epsilon_schedule
class EpsilonGreedyOutput(NamedTuple):
""" The output of the epsilon greedy policy. """
... | [
"numpy.random.uniform"
] | [((1141, 1157), 'numpy.random.uniform', 'random.uniform', ([], {}), '()\n', (1155, 1157), False, 'from numpy import random\n')] |
# coding: utf-8
# In[1]:
from pynq import Overlay, allocate
import numpy as np
# In[2]:
bitfile = "stream_axi_stream_fifo_ipxact.bit"
overlay = Overlay(bitfile)
overlay.ip_dict.keys()
# In[3]:
dma = overlay.axi_dma_0
blinkled = overlay.blinkled_0
# In[4]:
reduce_size = 8
read_size = 1024
write_size = re... | [
"pynq.Overlay",
"numpy.sum",
"numpy.multiply",
"numpy.zeros",
"numpy.ones",
"numpy.arange",
"pynq.allocate"
] | [((152, 168), 'pynq.Overlay', 'Overlay', (['bitfile'], {}), '(bitfile)\n', (159, 168), False, 'from pynq import Overlay, allocate\n'), ((350, 394), 'pynq.allocate', 'allocate', ([], {'shape': '(read_size,)', 'dtype': 'np.int32'}), '(shape=(read_size,), dtype=np.int32)\n', (358, 394), False, 'from pynq import Overlay, a... |
import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
from keras.utils.np_utils import to_categorical
from keras.layers import Conv2D, Dense, Flatten, MaxPooling2D, Dropout
from keras.models import Sequential
from tensorflow.python.keras.utils.vis_utils import plot_model
from sklearn.model_selection i... | [
"matplotlib.pyplot.title",
"os.mkdir",
"sklearn.model_selection.train_test_split",
"os.walk",
"tensorflow.python.keras.utils.vis_utils.plot_model",
"os.path.join",
"keras.layers.Flatten",
"numpy.append",
"keras.utils.np_utils.to_categorical",
"keras.layers.MaxPooling2D",
"matplotlib.pyplot.show"... | [((453, 480), 'os.listdir', 'os.listdir', (['image_directory'], {}), '(image_directory)\n', (463, 480), False, 'import os\n'), ((1572, 1588), 'numpy.array', 'np.array', (['x_data'], {}), '(x_data)\n', (1580, 1588), True, 'import numpy as np\n'), ((1736, 1768), 'os.walk', 'os.walk', (['dir_path'], {'topdown': '(False)'}... |
"""
Convenience functions for the construction of spatial weights based on
contiguity and distance criteria.
"""
__author__ = "<NAME> <<EMAIL>> "
import pysal
from Contiguity import buildContiguity, Queen, Rook
from Distance import knnW, Kernel, DistanceBand
from util import get_ids, get_points_array_from_shapefile, ... | [
"numpy.set_printoptions",
"pysal.cg.kdtree.Arc_KDTree",
"Contiguity.Queen.from_shapefile",
"pysal.open",
"util.get_ids",
"Distance.knnW",
"Distance.Kernel",
"pysal.weights.WSP",
"pysal.cg.KDTree",
"Distance.DistanceBand",
"Contiguity.Rook.from_shapefile",
"util.min_threshold_distance",
"util... | [((2032, 2086), 'Contiguity.Queen.from_shapefile', 'Queen.from_shapefile', (['shapefile'], {'idVariable': 'idVariable'}), '(shapefile, idVariable=idVariable)\n', (2052, 2086), False, 'from Contiguity import buildContiguity, Queen, Rook\n'), ((3247, 3300), 'Contiguity.Rook.from_shapefile', 'Rook.from_shapefile', (['shap... |
#!/usr/bin/env python
# coding: utf-8
import argparse
import os
import random
import matplotlib.pyplot as plt
import numpy as np
import torch
import tqdm
from l5kit.configs import load_config_data
from l5kit.dataset import AgentDataset
from l5kit.geometry import transform_points
from l5kit.visualization import (
... | [
"l5kit.geometry.transform_points",
"l5kit.visualization.draw_trajectory",
"tqdm.tqdm",
"l5kit.configs.load_config_data",
"numpy.random.seed",
"os.makedirs",
"argparse.ArgumentParser",
"lyft_utils.print_argparse_arguments",
"os.path.join",
"matplotlib.pyplot.show",
"run_lyft_mpred.LitModel.load_f... | [((796, 839), 'os.makedirs', 'os.makedirs', (['args.output_dir'], {'exist_ok': '(True)'}), '(args.output_dir, exist_ok=True)\n', (807, 839), False, 'import os\n'), ((4008, 4025), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (4019, 4025), False, 'import random\n'), ((4058, 4078), 'numpy.random.seed', 'np.ra... |
import cv2 as cv
import numpy as np
# 分水岭算法
def watershed_image():
print(src.shape)
blurred = cv.pyrMeanShiftFiltering(src, 10, 100) # 利用边缘滤波,去除噪点
# gray\binary image 灰度二值图像
gray = cv.cvtColor(blurred, cv.COLOR_BGR2GRAY)
ret, binary = cv.threshold(gray, 0, 255, cv.THRESH_BINARY | cv.T... | [
"numpy.uint8",
"cv2.subtract",
"cv2.dilate",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"cv2.threshold",
"cv2.getStructuringElement",
"cv2.morphologyEx",
"cv2.watershed",
"cv2.connectedComponents",
"cv2.imread",
"cv2.pyrMeanShiftFiltering",
"cv2.normalize",
"cv2.imshow",
"... | [((1338, 1359), 'cv2.imread', 'cv.imread', (['"""F:00.jpg"""'], {}), "('F:00.jpg')\n", (1347, 1359), True, 'import cv2 as cv\n'), ((1413, 1432), 'cv2.imshow', 'cv.imshow', (['"""0"""', 'src'], {}), "('0', src)\n", (1422, 1432), True, 'import cv2 as cv\n'), ((1453, 1466), 'cv2.waitKey', 'cv.waitKey', (['(0)'], {}), '(0)... |
####################################################################
# Copyright (c) 2019 <NAME> #
# #
# This source code is licensed under the MIT license found in the #
# LICENSE file in the root directory of this source tr... | [
"PyDelFEM2.Mesh",
"numpy.zeros",
"PyDelFEM2.VoxelGrid",
"math.sin",
"PyDelFEM2.gl.glfw.winDraw3d",
"math.cos",
"PyDelFEM2.gl.AxisXYZ"
] | [((501, 522), 'numpy.zeros', 'numpy.zeros', (['(16, 32)'], {}), '((16, 32))\n', (512, 522), False, 'import numpy, math\n'), ((655, 666), 'PyDelFEM2.Mesh', 'dfm2.Mesh', ([], {}), '()\n', (664, 666), True, 'import PyDelFEM2 as dfm2\n'), ((779, 798), 'PyDelFEM2.gl.AxisXYZ', 'dfm2.gl.AxisXYZ', (['(32)'], {}), '(32)\n', (79... |
import os
import h5py
import numpy as np
def copy_file_struct(f, hmap, fo):
"""
Iteratively copy a HDF5 file structure to a new file
Arguments:
-f : File from which to copy [OPEN HDF5 file handle]
-hmap : Current file object of interest to copy from
-fo : File to copy structure to ... | [
"h5py.File",
"numpy.zeros",
"os.listdir",
"os.remove"
] | [((2497, 2518), 'os.listdir', 'os.listdir', (['"""output/"""'], {}), "('output/')\n", (2507, 2518), False, 'import os\n'), ((2702, 2722), 'h5py.File', 'h5py.File', (['flib', '"""w"""'], {}), "(flib, 'w')\n", (2711, 2722), False, 'import h5py\n'), ((2933, 2950), 'h5py.File', 'h5py.File', (['y', '"""r"""'], {}), "(y, 'r'... |
import numpy as np
from ..orbit import calcNhat
def test_calcNhat_normalized():
state_vectors = np.array([
[1.0, 0.0, 0.0, 0.0, 0.002, 0.000],
[1.0, 0.0, 1.0, 0.0, 0.002, 0.000],
[1.0, 0.0, 1.0, 0.0, 0.000, 0.002]
])
n_hat = calcNhat(state_vectors)
n_hat_norm = np.linalg.norm(n... | [
"numpy.linalg.norm",
"numpy.array",
"numpy.sqrt"
] | [((102, 219), 'numpy.array', 'np.array', (['[[1.0, 0.0, 0.0, 0.0, 0.002, 0.0], [1.0, 0.0, 1.0, 0.0, 0.002, 0.0], [1.0, \n 0.0, 1.0, 0.0, 0.0, 0.002]]'], {}), '([[1.0, 0.0, 0.0, 0.0, 0.002, 0.0], [1.0, 0.0, 1.0, 0.0, 0.002, 0.0\n ], [1.0, 0.0, 1.0, 0.0, 0.0, 0.002]])\n', (110, 219), True, 'import numpy as np\n'), ... |
import numpy as np
import os
import copy
import torch
import random
import utils as du
from torch.utils.data import Dataset
class SliceDataset(Dataset):
def __init__(self, data_path, dataset='kits', task='tumor', series_index=None, train=True):
super(SliceDataset, self).__init__()
assert dataset i... | [
"numpy.stack",
"copy.deepcopy",
"utils.window_standardize",
"random.choice",
"numpy.rot90",
"os.path.join"
] | [((761, 787), 'numpy.rot90', 'np.rot90', (['img', 'k', '(-2, -1)'], {}), '(img, k, (-2, -1))\n', (769, 787), True, 'import numpy as np\n'), ((803, 830), 'numpy.rot90', 'np.rot90', (['mask', 'k', '(-2, -1)'], {}), '(mask, k, (-2, -1))\n', (811, 830), True, 'import numpy as np\n'), ((2046, 2065), 'copy.deepcopy', 'copy.d... |
from PyAstronomy.pyaC import pyaErrors as PE
from PyAstronomy.pyaC import invertIndexSelection
import numpy as np
def intep(x, y, xinter, boundsError=True, fillValue=None):
"""
The INTEP interpolation algorithm
The INTEP interpolation algorithm is described
by Hill 1982, PDAO 16, 67 ("Intep - an Eff... | [
"numpy.where",
"PyAstronomy.pyaC.pyaErrors.PyAValError",
"numpy.concatenate",
"numpy.all"
] | [((1638, 1667), 'numpy.all', 'np.all', (['(x[1:] - x[0:-1] > 0.0)'], {}), '(x[1:] - x[0:-1] > 0.0)\n', (1644, 1667), True, 'import numpy as np\n'), ((1681, 1960), 'PyAstronomy.pyaC.pyaErrors.PyAValError', 'PE.PyAValError', (["('The array of independent values (`x`) is not sorted in (strictly) ' +\n 'ascending order,... |
import numpy as np
import math
var = 2
n_eq = 3
n_un = 2
weights = np.array([[2, 3], [3, -5]])
outputs = np.array([4, 7])
def eqnfit(chromosome, weights, outputs):
'''
Equation 1:
'''
print(weights.shape)
print(outputs.shape)
output_model = np.dot(weights, np.array(chromosome))
print(... | [
"numpy.power",
"numpy.array"
] | [((70, 97), 'numpy.array', 'np.array', (['[[2, 3], [3, -5]]'], {}), '([[2, 3], [3, -5]])\n', (78, 97), True, 'import numpy as np\n'), ((108, 124), 'numpy.array', 'np.array', (['[4, 7]'], {}), '([4, 7])\n', (116, 124), True, 'import numpy as np\n'), ((288, 308), 'numpy.array', 'np.array', (['chromosome'], {}), '(chromos... |
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import popart
import pytest
import numpy as np
# `import test_util` requires adding to sys.path
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).resolve().parent.parent))
import test_util as tu
@tu.requires_ipu_model
def test_2_restores_f... | [
"popart.ConstSGD",
"numpy.random.seed",
"numpy.allclose",
"popart.Builder",
"popart.AnchorReturnType",
"pytest.raises",
"test_util.create_test_device",
"pathlib.Path",
"popart.PyStepIO",
"numpy.random.rand",
"popart.SessionOptions"
] | [((887, 904), 'numpy.random.seed', 'np.random.seed', (['(2)'], {}), '(2)\n', (901, 904), True, 'import numpy as np\n'), ((2993, 3036), 'numpy.allclose', 'np.allclose', (['ref_weights', 'pipelined_weights'], {}), '(ref_weights, pipelined_weights)\n', (3004, 3036), True, 'import numpy as np\n'), ((3048, 3098), 'numpy.all... |
"""
Module for guiding Arc/Sky line tracing
.. _numpy.ndarray: https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html
"""
import os
import copy
import inspect
import numpy as np
from astropy.io import fits
from pypeit import msgs
from pypeit import masterframe
from pypeit import ginga
from pypeit.... | [
"numpy.invert",
"astropy.io.fits.PrimaryHDU",
"pypeit.core.tracewave.fit2tilts",
"os.path.isfile",
"astropy.io.fits.Header",
"pypeit.msgs.warn",
"pypeit.core.pixels.tslits2mask",
"pypeit.core.arc.get_censpec",
"pypeit.msgs.info",
"astropy.io.fits.ImageHDU",
"pypeit.core.arc.resize_mask2arc",
"... | [((2420, 2556), 'pypeit.masterframe.MasterFrame.__init__', 'masterframe.MasterFrame.__init__', (['self', 'self.master_type'], {'master_dir': 'master_dir', 'master_key': 'master_key', 'reuse_masters': 'reuse_masters'}), '(self, self.master_type, master_dir=\n master_dir, master_key=master_key, reuse_masters=reuse_mas... |
## @package libgsidem2el 地理院標高タイルから標高値を取得するライブラリ
# @brief 地理院標高タイルから標高値を取得するライブラリ
# 地図の種類はDEM5A,DEM5B,DEM10B,DEMGMの4種類が選択可能 https://maps.gsi.go.jp/help/pdf/demapi.pdf参照
# zoom levelは,DEM5A,B:15, DEM10B:0-14, DEMGM:0-8
# getELメソッドで取得,DEM5AB,10Bは[m],DEMGMは[cm]の標高値を返す.
# それぞれの地図の対象範囲外は'outside'を返す
# 水面等により欠測の場合は,'e'を返す(地... | [
"pandas.read_csv",
"numpy.sin"
] | [((1769, 1798), 'pandas.read_csv', 'pd.read_csv', (['url'], {'header': 'None'}), '(url, header=None)\n', (1780, 1798), True, 'import pandas as pd\n'), ((1251, 1276), 'numpy.sin', 'np.sin', (['(np.pi / 180.0 * L)'], {}), '(np.pi / 180.0 * L)\n', (1257, 1276), True, 'import numpy as np\n'), ((1213, 1240), 'numpy.sin', 'n... |
import pandas as pd
import numpy as np
import os
import keras
from sklearn.model_selection import train_test_split
from keras.models import load_model, Sequential
model = Sequential()
model_path = os.path.join(os.getcwd(),'convmodel.h5')
model = load_model(model_path)
test_data = pd.read_csv('test.csv').astype('float32... | [
"keras.models.load_model",
"pandas.DataFrame",
"numpy.argmax",
"os.getcwd",
"pandas.read_csv",
"keras.models.Sequential"
] | [((171, 183), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (181, 183), False, 'from keras.models import load_model, Sequential\n'), ((246, 268), 'keras.models.load_model', 'load_model', (['model_path'], {}), '(model_path)\n', (256, 268), False, 'from keras.models import load_model, Sequential\n'), ((477, ... |
import sys
import cv2
import numpy as np
from .detect_reso_chart import detect_reso_chart
from .compute_mtf import compute_mtf
def reso_meas(images, verbose=False):
""" measure the resolution from multiple photos of resolution test chart
STEP1: Extract edge images from photos.
STEP2: Estimate MTF ... | [
"cv2.imread",
"numpy.mean",
"sys.exit"
] | [((1063, 1126), 'sys.exit', 'sys.exit', (['"""[ERROR]: no valid image for resolution measurement!"""'], {}), "('[ERROR]: no valid image for resolution measurement!')\n", (1071, 1126), False, 'import sys\n'), ((1218, 1263), 'numpy.mean', 'np.mean', (['[mtf[1] for mtf in mtf_list]'], {'axis': '(0)'}), '([mtf[1] for mtf i... |
# test_model.py
import numpy as np
import cv2
import time
import os
from grabscreen import grab_screen
from directkeys import PressKey, ReleaseKey, DirectionKey as dk
from alexnet import alexnet
from getkeys import key_check
cwd = os.getcwd()
for file_name in os.listdir(cwd):
if file_name.startswith('Osori-SelfD... | [
"alexnet.alexnet",
"numpy.argmax",
"os.getcwd",
"cv2.cvtColor",
"cv2.destroyAllWindows",
"cv2.waitKey",
"directkeys.ReleaseKey",
"time.sleep",
"directkeys.PressKey",
"time.time",
"grabscreen.grab_screen",
"getkeys.key_check",
"cv2.imshow",
"os.listdir",
"cv2.resize"
] | [((234, 245), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (243, 245), False, 'import os\n'), ((263, 278), 'os.listdir', 'os.listdir', (['cwd'], {}), '(cwd)\n', (273, 278), False, 'import os\n'), ((849, 886), 'alexnet.alexnet', 'alexnet', (['WIDTH', 'HEIGHT', 'LEARNING_RATE'], {}), '(WIDTH, HEIGHT, LEARNING_RATE)\n', (8... |
import cv2
import time
import imutils
import argparse
import numpy as np
import logging
from imutils.video import FPS
from imutils.video import VideoStream
logging.basicConfig(level=logging.INFO,
format='%(asctime)s :: %(levelname)s :: %(message)s')
#Constructing Argument Parse to inpu... | [
"imutils.video.VideoStream",
"imutils.video.FPS",
"cv2.putText",
"argparse.ArgumentParser",
"logging.basicConfig",
"cv2.waitKey",
"cv2.imshow",
"time.sleep",
"cv2.rectangle",
"numpy.arange",
"numpy.array",
"cv2.dnn.readNetFromCaffe",
"imutils.resize",
"cv2.destroyAllWindows",
"cv2.resize... | [((166, 264), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s :: %(levelname)s :: %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s :: %(levelname)s :: %(message)s')\n", (185, 264), False, 'import logging\n'), ((346, 371), 'argparse.ArgumentParser'... |
import cv2
import glob
import h5py
import imageio
import numpy as np
import os
import matplotlib.pylab as plt
from keras.datasets import mnist
from keras.preprocessing.image import ImageDataGenerator
from keras.utils import np_utils
def normalization(X):
return X / 127.5 - 1
def inverse_normalization(X):
... | [
"keras.preprocessing.image.ImageDataGenerator",
"os.walk",
"numpy.random.randint",
"numpy.arange",
"numpy.random.normal",
"matplotlib.pylab.close",
"matplotlib.pylab.title",
"os.path.join",
"numpy.round",
"matplotlib.pylab.figure",
"matplotlib.pylab.legend",
"keras.utils.np_utils.to_categorica... | [((455, 472), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (470, 472), False, 'from keras.datasets import mnist\n'), ((1006, 1050), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categorical', (['y_train', 'nb_classes'], {}), '(y_train, nb_classes)\n', (1029, 1050), False, 'from keras.uti... |
__author__ = '<NAME>'
import pymc
import numpy as np
from simtk.unit import kilojoules_per_mole
import torsionfit.database.qmdatabase as TorsionScan
import torsionfit.parameters as par
import warnings
from torsionfit.utils import logger
class TorsionFitModel(object):
"""pymc model
This model only allows a p... | [
"torsionfit.parameters.set_phase_0",
"numpy.log",
"pymc.Uniform",
"torsionfit.utils.logger",
"torsionfit.parameters.add_missing",
"torsionfit.parameters.update_param_from_sample",
"numpy.append",
"numpy.exp",
"pymc.Normal",
"warnings.warn",
"torsionfit.database.qmdatabase.to_optimize",
"pymc.D... | [((8975, 9052), 'torsionfit.parameters.add_missing', 'par.add_missing', (['self.parameters_to_optimize', 'param'], {'sample_n5': 'self.sample_n5'}), '(self.parameters_to_optimize, param, sample_n5=self.sample_n5)\n', (8990, 9052), True, 'import torsionfit.parameters as par\n'), ((9850, 9863), 'numpy.ndarray', 'np.ndarr... |
from numpy import random
from RandomGenerator.randomDecimal import random_decimal
def random_decimal_seeded(start, end, seed):
state = random.get_state()
random.seed(seed)
try:
rand_decimal_seeded = random_decimal(start, end)
return rand_decimal_seeded
finally:
random.set_state... | [
"numpy.random.get_state",
"RandomGenerator.randomDecimal.random_decimal",
"numpy.random.seed",
"numpy.random.set_state"
] | [((141, 159), 'numpy.random.get_state', 'random.get_state', ([], {}), '()\n', (157, 159), False, 'from numpy import random\n'), ((164, 181), 'numpy.random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (175, 181), False, 'from numpy import random\n'), ((221, 247), 'RandomGenerator.randomDecimal.random_decimal', 'ran... |
"""Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the license found in the
LICENSE file in the root directory of this source tree.
Portions of the source code are from the OLTR project which
notice below and in LICENSE in the root directory of
this source tree.... | [
"numpy.sum",
"numpy.power",
"torch.nn.functional.cross_entropy",
"numpy.array",
"torch.tensor"
] | [((1370, 1437), 'torch.nn.functional.cross_entropy', 'F.cross_entropy', (['output_logits', 'target'], {'weight': 'self.per_cls_weights'}), '(output_logits, target, weight=self.per_cls_weights)\n', (1385, 1437), True, 'import torch.nn.functional as F\n'), ((977, 1046), 'torch.tensor', 'torch.tensor', (['per_cls_weights'... |
# --------------
# Importing header files
import numpy as np
# Path of the file has been stored in variable called 'path'
data = np.genfromtxt(path, delimiter = ",", skip_header = 1)
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Code starts here
census = np.concatenate((data, new_record))
print... | [
"numpy.std",
"numpy.genfromtxt",
"numpy.max",
"numpy.mean",
"numpy.min",
"numpy.concatenate"
] | [((134, 183), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {'delimiter': '""","""', 'skip_header': '(1)'}), "(path, delimiter=',', skip_header=1)\n", (147, 183), True, 'import numpy as np\n'), ((279, 313), 'numpy.concatenate', 'np.concatenate', (['(data, new_record)'], {}), '((data, new_record))\n', (293, 313), True... |
import tensorflow as tf
import numpy as np
test_arr = [[np.zeros(shape=(2, 2), dtype="float32"), 0], [np.ones(shape=(2, 2), dtype="float32"), 1]]
def input_gen():
for i in range(len(test_arr)):
label = test_arr[i][1]
features = test_arr[i][0]
yield label, features
dataset = tf.data.Data... | [
"tensorflow.data.Dataset.from_generator",
"numpy.zeros",
"numpy.ones"
] | [((57, 96), 'numpy.zeros', 'np.zeros', ([], {'shape': '(2, 2)', 'dtype': '"""float32"""'}), "(shape=(2, 2), dtype='float32')\n", (65, 96), True, 'import numpy as np\n'), ((103, 141), 'numpy.ones', 'np.ones', ([], {'shape': '(2, 2)', 'dtype': '"""float32"""'}), "(shape=(2, 2), dtype='float32')\n", (110, 141), True, 'imp... |
"""
Tools for gapfilling missing data.
Gapfill functions that can be applied are called from the gapfunctions module.
"""
import pandas as pd
import numpy as np
from datetime import datetime
from sawyer import gapfunctions as gfuncs
import sawyer.plots as dpl
import sawyer.io as sio
import sawyer.dtools as tools
fro... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"numpy.logical_and",
"sawyer.dtools.regex_colnames",
"matplotlib.pyplot.subplots",
"sawyer.io.get_datadir",
"sawyer.io.read_yaml_conf",
"numpy.logical_or",
"sawyer.plots.gf_var_tsplot",
"sawyer.io.get_latest_df",
"datetime.datetime.now"
] | [((7957, 8012), 'pandas.DataFrame', 'pd.DataFrame', (['(False)'], {'index': 'df.index', 'columns': 'df.columns'}), '(False, index=df.index, columns=df.columns)\n', (7969, 8012), True, 'import pandas as pd\n'), ((10443, 10494), 'sawyer.io.get_latest_df', 'sio.get_latest_df', (['lname', 'dlevel'], {'optmatch': '"""masked... |
from car_utils import get_rotation, get_car_can_path, get_points_rotated
from street_view import ImageWgsHandler
import sys
import time
import threading
from argparse import ArgumentParser
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
import cv2
from car_utils import OFFSET_STEERING, ... | [
"numpy.load",
"argparse.ArgumentParser",
"pandas.read_csv",
"car_utils.get_points_rotated",
"os.path.isfile",
"sys.stdout.flush",
"cv2.imshow",
"os.path.join",
"matplotlib.pyplot.close",
"matplotlib.pyplot.draw",
"cv2.destroyAllWindows",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.subplots... | [((5159, 5200), 'threading.Thread', 'threading.Thread', ([], {'target': 'looping', 'args': '()'}), '(target=looping, args=())\n', (5175, 5200), False, 'import threading\n'), ((5323, 5339), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (5337, 5339), False, 'from argparse import ArgumentParser\n'), ((535... |
#! /bin/env python
"""
Examples
--------
Create a grid of length 2 in the x direction, and 3 in the y direction.
>>> (x, y) = np.meshgrid ([1., 2., 4., 8.], [1., 2., 3.])
>>> g = Structured(y.flatten(), x.flatten(), [3, 4])
>>> g.get_point_count()
12
>>> g.get_cell_count()
6
>>> g.get_x()
array([ 1., 2., 4., 8., ... | [
"warnings.warn",
"pymt.grids.connectivity.get_connectivity",
"numpy.array",
"doctest.testmod"
] | [((5855, 5912), 'doctest.testmod', 'doctest.testmod', ([], {'optionflags': 'doctest.NORMALIZE_WHITESPACE'}), '(optionflags=doctest.NORMALIZE_WHITESPACE)\n', (5870, 5912), False, 'import doctest\n'), ((3872, 3898), 'numpy.array', 'np.array', (['shape'], {'dtype': 'int'}), '(shape, dtype=int)\n', (3880, 3898), True, 'imp... |
# -*- coding: utf-8 -*-
""" Thresholds Functions
This file helps to calculate useful statistics to further choose thresholds
Created on Fri May 15 12:47:14 2020
Authors: <NAME> (<EMAIL>)
<NAME> (<EMAIL>)
"""
import numpy as np
import pandas as pd
from trackintel.geogr.distances imp... | [
"pandas.DataFrame",
"numpy.quantile",
"numpy.median",
"help_functions.getDataPaths",
"help_functions.selectRange",
"numpy.transpose",
"trackintel.geogr.distances.haversine_dist",
"numpy.mean",
"numpy.array",
"help_functions.parseLocs"
] | [((2554, 2573), 'numpy.array', 'np.array', (['ddiff_max'], {}), '(ddiff_max)\n', (2562, 2573), True, 'import numpy as np\n'), ((2590, 2613), 'numpy.transpose', 'np.transpose', (['ddiff_max'], {}), '(ddiff_max)\n', (2602, 2613), True, 'import numpy as np\n'), ((2630, 2649), 'numpy.array', 'np.array', (['ddiff_min'], {})... |
# Copyright 2013 <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 agreed to in writing, software... | [
"SimpleGP.GP",
"numpy.ones",
"numpy.fabs",
"numpy.array",
"numpy.linspace"
] | [((672, 697), 'numpy.linspace', 'np.linspace', (['(-10)', '(10)', '(100)'], {}), '(-10, 10, 100)\n', (683, 697), True, 'import numpy as np\n'), ((712, 738), 'numpy.array', 'np.array', (['[0.2, -0.3, 0.2]'], {}), '([0.2, -0.3, 0.2])\n', (720, 738), True, 'import numpy as np\n'), ((1171, 1223), 'numpy.array', 'np.array',... |
import motionTools
import numpy as np
import os
print("Loading Simulator Motion Files")
simMotion_1 = np.genfromtxt("data/MotionCondition_1.csv", delimiter = ",", skip_header = 1)
simMotion_2 = np.genfromtxt("data/MotionCondition_2.csv", delimiter = ",", skip_header = 1)
# Changing time to seconds instead of ... | [
"os.listdir",
"motionTools.headMotionSystem",
"numpy.genfromtxt"
] | [((108, 181), 'numpy.genfromtxt', 'np.genfromtxt', (['"""data/MotionCondition_1.csv"""'], {'delimiter': '""","""', 'skip_header': '(1)'}), "('data/MotionCondition_1.csv', delimiter=',', skip_header=1)\n", (121, 181), True, 'import numpy as np\n'), ((201, 274), 'numpy.genfromtxt', 'np.genfromtxt', (['"""data/MotionCondi... |
try:
from plotting import hd_hist
except ImportError:
from utilities.plotting import hd_hist
from sklearn.externals import joblib
import numpy as np
etbins = np.linspace(20.0, 400.0, num=100)
etabins = np.linspace(-4.0, 4.0, num=100)
mbins = np.linspace(0.0, 200.0, num=100)
ktbins = np.linspace(0.0, 100000.0, ... | [
"utilities.plotting.hd_hist",
"numpy.linspace",
"sklearn.externals.joblib.load"
] | [((167, 200), 'numpy.linspace', 'np.linspace', (['(20.0)', '(400.0)'], {'num': '(100)'}), '(20.0, 400.0, num=100)\n', (178, 200), True, 'import numpy as np\n'), ((211, 242), 'numpy.linspace', 'np.linspace', (['(-4.0)', '(4.0)'], {'num': '(100)'}), '(-4.0, 4.0, num=100)\n', (222, 242), True, 'import numpy as np\n'), ((2... |
from sklearn.model_selection import train_test_split
import numpy as np
import matplotlib.pyplot as plt
def sigmoid(x):
return 1.0/(1 + np.exp(-x))
def sigmoid_derivative(x):
return x * (1.0 - x)
class NeuralNetwork:
def __init__(self, x, y, epoch, typeofweightinitialise = "random"):
self.inpu... | [
"matplotlib.pyplot.show",
"numpy.random.shuffle",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"sklearn.model_selection.train_test_split",
"numpy.zeros",
"numpy.ones",
"numpy.array",
"numpy.random.multivariate_normal",
"numpy.exp",
"numpy.random.rand",
"numpy.dot",
"numpy.round",... | [((3232, 3248), 'numpy.array', 'np.array', (['[2, 3]'], {}), '([2, 3])\n', (3240, 3248), True, 'import numpy as np\n'), ((3259, 3275), 'numpy.array', 'np.array', (['[0, 0]'], {}), '([0, 0])\n', (3267, 3275), True, 'import numpy as np\n'), ((3287, 3321), 'numpy.array', 'np.array', (['[[10, 0.01], [0.01, 10]]'], {}), '([... |
# -*- coding: utf-8 -*-
"""ahp.utils
This module contains the common functions and methods used by other modules in the class.
"""
import numpy as np
def normalize_priorities(criteria_pr, global_pr):
"""Normalize the priorities received from the lower layer.
This function performs a Global Prioritization a... | [
"numpy.dot"
] | [((584, 614), 'numpy.dot', 'np.dot', (['global_pr', 'criteria_pr'], {}), '(global_pr, criteria_pr)\n', (590, 614), True, 'import numpy as np\n')] |
"""
Custom preprocessing transformation functions for video/sequential frame
MRI data from the UK Biobank
"""
import numpy as np
from skimage.exposure import rescale_intensity
from torchvision.transforms import Lambda
class NullTransform(Lambda):
"""
Create a null transformation.
This is to be used whe... | [
"numpy.argmax",
"numpy.std",
"skimage.exposure.rescale_intensity",
"numpy.mean",
"numpy.array",
"numpy.sign"
] | [((7264, 7283), 'numpy.array', 'np.array', (['stdSeries'], {}), '(stdSeries)\n', (7272, 7283), True, 'import numpy as np\n'), ((1393, 1405), 'numpy.std', 'np.std', (['z[i]'], {}), '(z[i])\n', (1399, 1405), True, 'import numpy as np\n'), ((2050, 2078), 'numpy.sign', 'np.sign', (['(std[i + 1] - std[i])'], {}), '(std[i + ... |
# Copyright <NAME> S.A. 2019
import numpy as np
import cv2
from shapely.geometry import Point, Polygon
from shapely.ops import cascaded_union
from sklearn.cluster import KMeans, DBSCAN
from .Config import OCRConfig
from .utils import DebugUtils, sort_box
class TextBinarizer:
def __init__(self, config=None):
... | [
"numpy.sum",
"numpy.polyfit",
"numpy.ones",
"cv2.adaptiveThreshold",
"cv2.fillPoly",
"numpy.argsort",
"numpy.mean",
"numpy.linalg.norm",
"cv2.rectangle",
"cv2.imshow",
"numpy.unique",
"cv2.line",
"cv2.contourArea",
"cv2.subtract",
"numpy.zeros_like",
"shapely.geometry.Point",
"shapel... | [((1257, 1285), 'numpy.sqrt', 'np.sqrt', (['(750 * 750 / (h * w))'], {}), '(750 * 750 / (h * w))\n', (1264, 1285), True, 'import numpy as np\n'), ((14615, 14640), 'numpy.mean', 'np.mean', (['text_box'], {'axis': '(0)'}), '(text_box, axis=0)\n', (14622, 14640), True, 'import numpy as np\n'), ((14882, 14909), 'numpy.arra... |
import os
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import stats
DISTRIBUTIONS = {
'exp' : "Exponential",
'N': "Normal"
}
def plot_cdf(groupings, name):
conf = name.split('-')
reservoir_size = conf[0]
distribution = DIST... | [
"scipy.stats.cumfreq",
"os.path.abspath",
"numpy.divide",
"pandas.read_csv",
"collections.defaultdict",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"os.listdir"
] | [((1004, 1021), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1015, 1021), False, 'from collections import defaultdict\n'), ((1034, 1054), 'os.listdir', 'os.listdir', (['"""../gen"""'], {}), "('../gen')\n", (1044, 1054), False, 'import os\n'), ((379, 393), 'matplotlib.pyplot.subplots', 'plt.sub... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import copy
from functools import reduce
from hypothesis import assume, given, settings
import hypothesis.strategies as st
from functools import partial
import unittest
from caffe2.python i... | [
"caffe2.python.core.Net",
"numpy.random.seed",
"numpy.abs",
"numpy.array_equal",
"numpy.argmax",
"numpy.empty",
"caffe2.python.core.BlobReference",
"numpy.iinfo",
"numpy.clip",
"numpy.ones",
"hypothesis.settings",
"numpy.random.randint",
"numpy.arange",
"hypothesis.given",
"numpy.exp",
... | [((456, 523), 'caffe2.python.dyndep.InitOpsLibrary', 'dyndep.InitOpsLibrary', (['"""@/caffe2/caffe2/fb/optimizers:sgd_simd_ops"""'], {}), "('@/caffe2/caffe2/fb/optimizers:sgd_simd_ops')\n", (477, 523), False, 'from caffe2.python import core, workspace, tt_core, dyndep\n'), ((2548, 2609), 'hypothesis.strategies.sampled_... |
from typing import Optional
import numpy as np
from sklearn.decomposition import KernelPCA, PCA
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import MinMaxScaler, OneHotEncoder, PolynomialFeatures, StandardScaler
from fedot.core.operations.evaluation.operation_implementations. \
implementati... | [
"sklearn.impute.SimpleImputer",
"sklearn.preprocessing.StandardScaler",
"sklearn.preprocessing.MinMaxScaler",
"sklearn.preprocessing.OneHotEncoder",
"numpy.hstack",
"sklearn.preprocessing.PolynomialFeatures",
"numpy.array",
"sklearn.decomposition.PCA",
"sklearn.decomposition.KernelPCA"
] | [((6063, 6106), 'numpy.array', 'np.array', (['features[:, self.categorical_ids]'], {}), '(features[:, self.categorical_ids])\n', (6071, 6106), True, 'import numpy as np\n'), ((2937, 2979), 'sklearn.decomposition.PCA', 'PCA', ([], {'svd_solver': '"""full"""', 'n_components': '"""mle"""'}), "(svd_solver='full', n_compone... |
from astropy.io import fits
import pandas as pd
import numpy as np
import glob
import os
class ExternalFile:
""" Read in external files and turn them into numpy arrays to work with pyRT_DISORT functions"""
def __init__(self, file_path, header_lines=0, text1d=True):
"""
Parameters
-----... | [
"pandas.DataFrame",
"numpy.load",
"numpy.save",
"pandas.read_csv",
"numpy.ndim",
"numpy.genfromtxt",
"numpy.array",
"astropy.io.fits.open",
"glob.glob",
"os.path.join"
] | [((2099, 2122), 'numpy.load', 'np.load', (['self.file_path'], {}), '(self.file_path)\n', (2106, 2122), True, 'import numpy as np\n'), ((2254, 2279), 'astropy.io.fits.open', 'fits.open', (['self.file_path'], {}), '(self.file_path)\n', (2263, 2279), False, 'from astropy.io import fits\n'), ((3229, 3286), 'numpy.array', '... |
#!/usr/bin/env python
import os
from argparse import ArgumentParser
from os import listdir
from time import time
import h5py
import numpy as np
import tensorflow as tf
import tensorflow.contrib.slim.python.slim.nets.vgg as vgg
from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
from tqdm import tqd... | [
"h5py.File",
"argparse.ArgumentParser",
"tensorflow.train.Saver",
"h5py.special_dtype",
"tensorflow.contrib.slim.python.slim.nets.vgg.vgg_16",
"numpy.expand_dims",
"time.time",
"PIL.Image.open",
"tensorflow.placeholder",
"tensorflow.ConfigProto",
"tensorflow.image.resize_image_with_crop_or_pad",... | [((332, 348), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (346, 348), False, 'from argparse import ArgumentParser\n'), ((2429, 2435), 'time.time', 'time', ([], {}), '()\n', (2433, 2435), False, 'from time import time\n'), ((2564, 2627), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[No... |
import networkx as nx
import numpy as np
from scipy.linalg import fractional_matrix_power, inv
import tensorlayerx as tlx
from sklearn.preprocessing import MinMaxScaler
import scipy.sparse as sp
def preprocess_features(features):
"""Row-normalize feature matrix and convert to tuple representation"""
rowsum = n... | [
"scipy.sparse.diags",
"numpy.sum",
"numpy.power",
"tensorlayerx.convert_to_numpy",
"scipy.linalg.fractional_matrix_power",
"sklearn.preprocessing.MinMaxScaler",
"numpy.isinf",
"tensorlayerx.convert_to_tensor",
"numpy.nonzero",
"networkx.convert_matrix.to_numpy_array",
"numpy.array",
"numpy.mat... | [((436, 451), 'scipy.sparse.diags', 'sp.diags', (['r_inv'], {}), '(r_inv)\n', (444, 451), True, 'import scipy.sparse as sp\n'), ((502, 533), 'tensorlayerx.convert_to_tensor', 'tlx.convert_to_tensor', (['features'], {}), '(features)\n', (523, 533), True, 'import tensorlayerx as tlx\n'), ((605, 662), 'networkx.convert_ma... |
from typing import List, Optional
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mpc
import matplotlib.cm as cm
from matplotlib import rc
from matplotlib import colors
from matplotlib.ticker import MaxNLocator
from matplotlib.colors import BoundaryNorm
import numpy as np
import... | [
"matplotlib.pyplot.yscale",
"numpy.argmin",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.mean",
"matplotlib.pyplot.fill_between",
"matplotlib.pyplot.tight_layout",
"numpy.multiply",
"matplotlib.ticker.MaxNLocator",
"helper_funcs.get_tab_colors",
"numpy.insert",
"numpy.linalg.eig",
"nump... | [((1411, 1427), 'helper_funcs.get_tab_colors', 'get_tab_colors', ([], {}), '()\n', (1425, 1427), False, 'from helper_funcs import convert2rgb, get_tab_colors\n'), ((1438, 1456), 'matplotlib.pyplot.figure', 'plt.figure', (['metric'], {}), '(metric)\n', (1448, 1456), True, 'import matplotlib.pyplot as plt\n'), ((2354, 23... |
import numpy as np
import pandas as pd
import biclust_comp.analysis.accuracy as acc
import biclust_comp.analysis.accuracy_utils as acc_utils
import biclust_comp.analysis.enrichment as enrich
def get_results_with_num_unique(error_df_file):
error_df = pd.read_csv(error_df_file)
unique_factors_df = get_unique_fa... | [
"pandas.DataFrame",
"numpy.fill_diagonal",
"pandas.read_csv",
"numpy.ix_",
"biclust_comp.analysis.enrichment.get_number_unique_pathways",
"biclust_comp.analysis.accuracy.calc_overlaps",
"biclust_comp.analysis.accuracy_utils.read_result_binary_best_threshold",
"numpy.arange",
"numpy.delete"
] | [((256, 282), 'pandas.read_csv', 'pd.read_csv', (['error_df_file'], {}), '(error_df_file)\n', (267, 282), True, 'import pandas as pd\n'), ((364, 412), 'biclust_comp.analysis.enrichment.get_number_unique_pathways', 'enrich.get_number_unique_pathways', (['error_df_file'], {}), '(error_df_file)\n', (397, 412), True, 'impo... |
import prata
import time
import timeit
import numpy as np
import sys
import random
import string
B = 1
KB = 1000
MB = 1000000
END = []
def getString(s):
#''.join(random.choice(string.ascii_letters) for x in range(int(real)))
real = 1 if (s-49) < 1 else s-49
return "1"*real
TIMES = 5
SLEEP = 2
NUMBER = ... | [
"numpy.average",
"random.randint",
"numpy.median",
"timeit.Timer",
"time.sleep",
"numpy.max",
"numpy.min",
"sys.getsizeof",
"prata.connect"
] | [((1454, 1487), 'prata.connect', 'prata.connect', (['"""127.0.0.1"""', '(25565)'], {}), "('127.0.0.1', 25565)\n", (1467, 1487), False, 'import prata\n'), ((1955, 1973), 'sys.getsizeof', 'sys.getsizeof', (['obj'], {}), '(obj)\n', (1968, 1973), False, 'import sys\n'), ((2396, 2414), 'sys.getsizeof', 'sys.getsizeof', (['o... |
import numpy as np
"""
these are altitudes hard-coded into the old version of NCAR GLOW.
"""
def glowalt() -> np.ndarray:
# z = range(80,110+1,1)
z = np.arange(30.0, 110 + 1.0, 1.0)
z = np.append(z, [111.5, 113.0, 114.5, 116.0])
z = np.append(z, np.arange(118, 150 + 2, 2.0))
z = np.append(z, np.a... | [
"numpy.append",
"numpy.arange"
] | [((161, 192), 'numpy.arange', 'np.arange', (['(30.0)', '(110 + 1.0)', '(1.0)'], {}), '(30.0, 110 + 1.0, 1.0)\n', (170, 192), True, 'import numpy as np\n'), ((201, 243), 'numpy.append', 'np.append', (['z', '[111.5, 113.0, 114.5, 116.0]'], {}), '(z, [111.5, 113.0, 114.5, 116.0])\n', (210, 243), True, 'import numpy as np\... |
from typing import Union, Tuple
import multiaug
import numpy as np
import scipy.ndimage
from multiaug.augmenters import meta
def _generate_bool_sequence(num: int, random_state: int) -> list:
return [random_state.choice([True, False], 1)[0] for _ in range(num)]
def _merge_bool_sequences(proposed: list, mask: lis... | [
"numpy.array"
] | [((2833, 2857), 'numpy.array', 'np.array', (['rotated_images'], {}), '(rotated_images)\n', (2841, 2857), True, 'import numpy as np\n')] |
"""Took all this from https://github.com/MadryLab/implementation-matters"""
import gym
import numpy as np
class RunningStat:
def __init__(self):
self.n = 0
self.m = 0
self.s = 0
def add(self, v):
self.n += 1
if self.n == 1:
self.m = v
else:
... | [
"numpy.sqrt"
] | [((655, 672), 'numpy.sqrt', 'np.sqrt', (['self.var'], {}), '(self.var)\n', (662, 672), True, 'import numpy as np\n')] |
import os
import random
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
import torchvision.transforms as T
import torchvision
from torchvision import datasets, transforms
# from stylegan_model import Generator, Encoder
# from view_generator import VGGLoss
from functools import pa... | [
"pickle.dump",
"argparse.ArgumentParser",
"torch.cat",
"pathlib.Path",
"pickle.load",
"torchvision.transforms.Normalize",
"torch.no_grad",
"torch.utils.data.DataLoader",
"utils_html.save_grid",
"torch.load",
"os.path.exists",
"resnet.resnet18",
"torchvision.transforms.CenterCrop",
"utils.f... | [((1837, 1927), 'einops.rearrange', 'rearrange', (['zq', '"""(b h w) c -> b c h w"""'], {'b': 'z_q.shape[0]', 'h': 'z_q.shape[2]', 'w': 'z_q.shape[3]'}), "(zq, '(b h w) c -> b c h w', b=z_q.shape[0], h=z_q.shape[2], w=z_q\n .shape[3])\n", (1846, 1927), False, 'from einops import rearrange\n'), ((2176, 2201), 'argpar... |
import os.path as osp
import logging
import time
import argparse
from collections import OrderedDict
import torch
import numpy as np
import options.options as option
import utils.util as util
from data.util import bgr2ycbcr
from data import create_dataset, create_dataloader
from models import create_model
import matplo... | [
"utils.util.crop_border",
"argparse.ArgumentParser",
"models.create_model",
"utils.util.mkdir",
"os.path.join",
"utils.util.calculate_psnr",
"numpy.std",
"utils.util.save_img",
"numpy.max",
"utils.util.setup_logger",
"data.create_dataloader",
"os.path.basename",
"cv2.addWeighted",
"numpy.m... | [((3130, 3155), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3153, 3155), False, 'import argparse\n'), ((3310, 3338), 'options.options.dict_to_nonedict', 'option.dict_to_nonedict', (['opt'], {}), '(opt)\n', (3333, 3338), True, 'import options.options as option\n'), ((3496, 3615), 'utils.util... |
"""
Copyright (c) 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | [
"numpy.array"
] | [((1451, 1473), 'numpy.array', 'np.array', (['output_shape'], {}), '(output_shape)\n', (1459, 1473), True, 'import numpy as np\n'), ((2334, 2356), 'numpy.array', 'np.array', (['output_shape'], {}), '(output_shape)\n', (2342, 2356), True, 'import numpy as np\n'), ((1037, 1063), 'numpy.array', 'np.array', (['block_size.s... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from wordcloud import WordCloud, STOPWORDS
# Lists, dicts, and sorting
l = [3, 5, 6, 1, -6]
d = {'a': 9, 'b': 2, 'c': 5, 'd': 3}
sl = sorted(l)
sorted(d)
sorted(d.values())
sorted(d.items())
print(l[:2])
# Capturing standard output
# Call this pr... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.clf",
"pandas.read_csv",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.imshow",
"wordcloud.WordCloud",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.... | [((760, 782), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Integers"""'], {}), "('Integers')\n", (770, 782), True, 'import matplotlib.pyplot as plt\n'), ((783, 801), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""f(x)"""'], {}), "('f(x)')\n", (793, 801), True, 'import matplotlib.pyplot as plt\n'), ((836, 853), 'mat... |
# Copyright 2021 Adobe
# All Rights Reserved.
# NOTICE: Adobe permits you to use, modify, and distribute this file in
# accordance with the terms of the Adobe license agreement accompanying
# it.
'''
>> python -m unittest unit_test.TestSingle_operator
'''
from skimage import io
import time
import beacon_aug as BA
# ... | [
"unittest.main",
"beacon_aug.Rotate",
"numpy.array_equal",
"skimage.io.imread"
] | [((1719, 1734), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1732, 1734), False, 'import unittest\n'), ((838, 870), 'skimage.io.imread', 'io.imread', (['"""../data/example.png"""'], {}), "('../data/example.png')\n", (847, 870), False, 'from skimage import io\n'), ((1014, 1025), 'beacon_aug.Rotate', 'BA.Rotate',... |
"""
Copyright 2017 Neural Networks and Deep Learning lab, MIPT
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.zeros",
"deeppavlov.core.common.registry.register"
] | [((723, 739), 'deeppavlov.core.common.registry.register', 'register', (['"""mask"""'], {}), "('mask')\n", (731, 739), False, 'from deeppavlov.core.common.registry import register\n'), ((1070, 1119), 'numpy.zeros', 'np.zeros', (['[batch_size, max_len]'], {'dtype': 'np.float32'}), '([batch_size, max_len], dtype=np.float3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.