code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""Testing visualization.interpolation."""
import numpy as np
import plonk
from .stubdata.interpolation_arrays import (
scalar_cross_section,
scalar_projection,
vector_cross_section,
vector_projection,
)
N = 10
XX = np.ones(N)
YY = np.ones(N)
ZZ = np.ones(N)
HH = np.ones(N)
WW = np.ones(N)
MM = np.... | [
"numpy.testing.assert_allclose",
"plonk.visualize.interpolation.vector_interpolation",
"numpy.ones",
"plonk.visualize.interpolation.scalar_interpolation"
] | [((237, 247), 'numpy.ones', 'np.ones', (['N'], {}), '(N)\n', (244, 247), True, 'import numpy as np\n'), ((253, 263), 'numpy.ones', 'np.ones', (['N'], {}), '(N)\n', (260, 263), True, 'import numpy as np\n'), ((269, 279), 'numpy.ones', 'np.ones', (['N'], {}), '(N)\n', (276, 279), True, 'import numpy as np\n'), ((285, 295... |
import os.path
import numpy
import tflearn
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.normalization import local_response_normalization
from tflearn.layers.estimator import regression
import tensorflow as tf
import errno
... | [
"tflearn.layers.conv.conv_2d",
"numpy.load",
"tflearn.layers.core.fully_connected",
"numpy.transpose",
"tflearn.layers.conv.max_pool_2d",
"tflearn.layers.core.dropout",
"tflearn.layers.normalization.local_response_normalization",
"tflearn.DNN",
"numpy.array",
"tensorflow.Graph",
"numpy.random.sh... | [((3623, 3633), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (3631, 3633), True, 'import tensorflow as tf\n'), ((7489, 7499), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (7497, 7499), True, 'import tensorflow as tf\n'), ((11252, 11262), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (11260, 11262), True, ... |
import numpy as np
import logging as log
import networkx as nx
from sklearn.decomposition import PCA, IncrementalPCA
from sklearn.preprocessing import StandardScaler
from sklearn.random_projection import SparseRandomProjection
from sklearn.ensemble import ExtraTreesClassifier, \
RandomFor... | [
"sklearn.cluster.MiniBatchKMeans",
"numpy.diag_indices_from",
"sklearn.preprocessing.StandardScaler",
"numpy.sum",
"numpy.empty",
"numpy.ones",
"numpy.ma.log",
"sklearn.random_projection.SparseRandomProjection",
"numpy.arange",
"sklearn.svm.SVC",
"numpy.unique",
"numpy.full",
"logging.error"... | [((2959, 2995), 'logging.info', 'log.info', (['"""+ Quantizing descriptors"""'], {}), "('+ Quantizing descriptors')\n", (2967, 2995), True, 'import logging as log\n'), ((11985, 12021), 'logging.info', 'log.info', (['"""+ Saving results to disk"""'], {}), "('+ Saving results to disk')\n", (11993, 12021), True, 'import l... |
"""Check that functions can handle scalar input"""
from typing import Callable, Union
import hypothesis
import numpy as np
import pytest
from hypothesis.strategies import floats, integers, one_of
from numpy.testing import assert_array_almost_equal
import bottleneck as bn # noqa: F401
from .util import get_functions... | [
"numpy.iinfo",
"hypothesis.strategies.floats",
"hypothesis.given",
"numpy.testing.assert_array_almost_equal",
"hypothesis.strategies.integers"
] | [((336, 354), 'numpy.iinfo', 'np.iinfo', (['np.int64'], {}), '(np.int64)\n', (344, 354), True, 'import numpy as np\n'), ((459, 491), 'hypothesis.given', 'hypothesis.given', ([], {'scalar': 'scalars'}), '(scalar=scalars)\n', (475, 491), False, 'import hypothesis\n'), ((380, 442), 'hypothesis.strategies.integers', 'integ... |
import cv2
import numpy as np
from matplotlib import pyplot as plt
import random
from handleXml import handleXml
import os
def img_resize(image):
height, width = image.shape[0], image.shape[1]
# 设置新的图片分辨率框架
multi=round(random.random()*2) + 1
# print(multi)
width_new = width*multi
height_new = h... | [
"numpy.pad",
"handleXml.handleXml",
"random.randint",
"cv2.cvtColor",
"numpy.fromfile",
"cv2.threshold",
"cv2.imdecode",
"numpy.transpose",
"random.random",
"numpy.array",
"cv2.imencode",
"os.listdir"
] | [((2407, 2426), 'os.listdir', 'os.listdir', (['imgPath'], {}), '(imgPath)\n', (2417, 2426), False, 'import os\n'), ((2439, 2466), 'handleXml.handleXml', 'handleXml', (['imgPath', 'xmlPath'], {}), '(imgPath, xmlPath)\n', (2448, 2466), False, 'from handleXml import handleXml\n'), ((624, 663), 'cv2.cvtColor', 'cv2.cvtColo... |
import numpy as np
def alogsumexp(logarray, axis=0):
"""
Calculate the sum of an array of values which are in log space. If an axis is
specified, the sum across this axis is given.
Parameters
----------
logarray: array
An array of log values to be summed.
axis: int, optional
... | [
"numpy.isnan",
"numpy.log",
"numpy.errstate"
] | [((504, 550), 'numpy.errstate', 'np.errstate', ([], {'invalid': '"""ignore"""', 'divide': '"""ignore"""'}), "(invalid='ignore', divide='ignore')\n", (515, 550), True, 'import numpy as np\n'), ((891, 900), 'numpy.log', 'np.log', (['(0)'], {}), '(0)\n', (897, 900), True, 'import numpy as np\n'), ((869, 887), 'numpy.isnan... |
# Python 3.5.2 |Anaconda 4.2.0 (64-bit)|
# -*- coding: utf-8 -*-
"""
Last edited: 2017-09-13
Author: <NAME> (<EMAIL>)
Forked by: <NAME> (<EMAIL>)
Description: Implements the Detector, i.e. the key object in the Spatial BOCD
software. This object takes in the Data & its dimensions, the CP prior,
a set of probability mo... | [
"numpy.sum",
"numpy.abs",
"numpy.argmax",
"numpy.ones",
"numpy.exp",
"numpy.diag",
"numpy.copy",
"numpy.power",
"time.clock",
"numpy.insert",
"numpy.append",
"numpy.max",
"scipy.misc.logsumexp",
"numpy.union1d",
"numpy.size",
"numpy.flipud",
"numpy.min",
"numpy.zeros",
"numpy.any... | [((6248, 6282), 'numpy.zeros', 'np.zeros', ([], {'shape': '(self.S1, self.S2)'}), '(shape=(self.S1, self.S2))\n', (6256, 6282), True, 'import numpy as np\n'), ((6310, 6364), 'numpy.zeros', 'np.zeros', ([], {'shape': '(self.S1 * self.S2, self.S1 * self.S2)'}), '(shape=(self.S1 * self.S2, self.S1 * self.S2))\n', (6318, 6... |
import json
from PIL import Image, ImageDraw, ImageFont
from PIL import ImagePath
import os
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats.stats import pearsonr
import pandas as pd
import sys
from matplotlib.backends.backend_pdf import PdfPages
import explore as ex
def get_font(fontsize=40):
... | [
"os.mkdir",
"PIL.Image.new",
"numpy.sum",
"matplotlib.pyplot.figure",
"numpy.mean",
"explore.parseMultiTIFF",
"numpy.exp",
"os.path.join",
"PIL.Image.merge",
"pandas.DataFrame",
"os.path.exists",
"numpy.max",
"numpy.linspace",
"PIL.ImageDraw.Draw",
"numpy.average",
"numpy.ceil",
"num... | [((1175, 1202), 'os.listdir', 'os.listdir', (['"""PreviewImages"""'], {}), "('PreviewImages')\n", (1185, 1202), False, 'import os\n'), ((1272, 1319), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['"""LEMONMILK-Regular.otf"""', '(75)'], {}), "('LEMONMILK-Regular.otf', 75)\n", (1290, 1319), False, 'from PIL import Im... |
from typing import List, Dict, Set, Optional
import numpy as np
from pyitlib import discrete_random_variable as drv
class CSScorer:
"""
computes category-separation:
a measure of how close next-word probability distributions for one category are to those of another
"""
def __init__(self,
... | [
"pyitlib.discrete_random_variable.divergence_jensenshannon_pmf",
"numpy.ndim",
"numpy.sum",
"pyitlib.discrete_random_variable.entropy_cross_pmf"
] | [((1190, 1201), 'numpy.ndim', 'np.ndim', (['ps'], {}), '(ps)\n', (1197, 1201), True, 'import numpy as np\n'), ((1222, 1233), 'numpy.ndim', 'np.ndim', (['qs'], {}), '(qs)\n', (1229, 1233), True, 'import numpy as np\n'), ((1871, 1932), 'pyitlib.discrete_random_variable.entropy_cross_pmf', 'drv.entropy_cross_pmf', (['ps',... |
from __future__ import division
import os, scipy.io
import re
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import glob
import cv2
import argparse
from PIL import Image
from utils import *
parser = argparse.ArgumentParser(description='Testing')
parser.add_argument('--model', dest='... | [
"numpy.uint8",
"argparse.ArgumentParser",
"torch.load",
"numpy.uint16",
"numpy.concatenate"
] | [((236, 282), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Testing"""'}), "(description='Testing')\n", (259, 282), False, 'import argparse\n'), ((753, 782), 'torch.load', 'torch.load', (['"""isp/ISP_CNN.pth"""'], {}), "('isp/ISP_CNN.pth')\n", (763, 782), False, 'import torch\n'), ((803... |
#!/usr/bin/python
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
from keras.models import Sequential
from keras.layers import LSTM,Dense, GRU
from sklearn.preprocessing import MinMaxScaler
import matplotlib.pyplot as plt
from matplotlib.legend_handler import ... | [
"matplotlib.pyplot.show",
"numpy.abs",
"pandas.read_csv",
"keras.layers.LSTM",
"sklearn.preprocessing.MinMaxScaler",
"numpy.mean",
"keras.layers.Dense",
"numpy.array",
"keras.models.Sequential",
"matplotlib.legend_handler.HandlerLine2D",
"os.listdir"
] | [((578, 592), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {}), '()\n', (590, 592), False, 'from sklearn.preprocessing import MinMaxScaler\n'), ((1168, 1184), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (1178, 1184), False, 'import os\n'), ((1649, 1689), 'pandas.read_csv', 'pd.read_csv', (["('... |
import numpy as np
from megaverse.megaverse_env import MegaverseEnv
env = MegaverseEnv(
'ObstaclesHard',
num_envs=2, num_agents_per_env=2,
num_simulation_threads=4, use_vulkan=True,
params={},
)
env.reset()
while True:
actions = [env.action_space.sample() for _ in range(env.num_agents)]
obs, ... | [
"numpy.any",
"megaverse.megaverse_env.MegaverseEnv"
] | [((76, 197), 'megaverse.megaverse_env.MegaverseEnv', 'MegaverseEnv', (['"""ObstaclesHard"""'], {'num_envs': '(2)', 'num_agents_per_env': '(2)', 'num_simulation_threads': '(4)', 'use_vulkan': '(True)', 'params': '{}'}), "('ObstaclesHard', num_envs=2, num_agents_per_env=2,\n num_simulation_threads=4, use_vulkan=True, ... |
import numpy as np
from .helpers import *
from .instance import *
def evaluate_EA():
list_instances = get_list_instance_name()
instance = Instance(config, 'Pixelcopter') # task 8 bit
arr = np.asarray(instance.results_by_tasks)
best_result = arr # task 8bit max
# best_result = np.sort(best_result,... | [
"numpy.asarray",
"numpy.arange"
] | [((204, 241), 'numpy.asarray', 'np.asarray', (['instance.results_by_tasks'], {}), '(instance.results_by_tasks)\n', (214, 241), True, 'import numpy as np\n'), ((789, 808), 'numpy.asarray', 'np.asarray', (['results'], {}), '(results)\n', (799, 808), True, 'import numpy as np\n'), ((2631, 2645), 'numpy.asarray', 'np.asarr... |
# Load movies from Kafka, generate embeddings of movie titles with BERT, then save embeddings to
# redis and HDFS.
import os
import subprocess
from time import localtime, strftime
import numpy as np
import redis
import tensorflow_hub as hub
import tensorflow_text as text
from kafka import KafkaConsumer... | [
"redis.Redis",
"os.remove",
"subprocess.Popen",
"tensorflow_hub.KerasLayer",
"os.path.isfile",
"numpy.array",
"time.localtime",
"kafka.KafkaConsumer"
] | [((865, 904), 'tensorflow_hub.KerasLayer', 'hub.KerasLayer', (['tfhub_handle_preprocess'], {}), '(tfhub_handle_preprocess)\n', (879, 904), True, 'import tensorflow_hub as hub\n'), ((919, 955), 'tensorflow_hub.KerasLayer', 'hub.KerasLayer', (['tfhub_handle_encoder'], {}), '(tfhub_handle_encoder)\n', (933, 955), True, 'i... |
#!/usr/bin/env python
'''
NOTE: This uses the alannlp PyTorch implementation of Elmo!
Process a line corpus and convert text to elmo embeddings, save as json array of sentence vectors.
This expects the sents corpus which has fields title, article, domains. and treates
title as the first sentence, then splits the articl... | [
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.einsum",
"json.dumps",
"torch.cuda.device_count",
"torch.device",
"torch.cuda.current_device",
"os.path.join",
"numpy.full",
"pandas.merge",
"collections.Counter",
"re.sub",
"pandas.DataFrame.from_dict",
"scipy.stats.zscore",
"pandas.r... | [((616, 649), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (639, 649), False, 'import warnings\n'), ((2526, 2563), 'pandas.read_excel', 'pd.read_excel', (['NRC_path1'], {'index_col': '(0)'}), '(NRC_path1, index_col=0)\n', (2539, 2563), True, 'import pandas as pd\n'), ((2... |
import tellurium as te
import numpy
# Coherent Type I Genetic Network, noise filter
rr = te.loada ('''
$G2 -> P2; Vmax2*P1^4/(Km1 + P1^4);
P2 -> $w; k1*P2;
$G3 -> P3; Vmax3*P1^4*P2^4/(Km1 + P1^4*P2^4);
P3 -> $w; k1*P3;
Vmax2 = 1; Vmax3 = 1;
Km1 = 0.5; k1 = 0.1;
P1 = 0; P2 = 0; P3 =... | [
"tellurium.loada",
"numpy.vstack",
"tellurium.plotWithLegend"
] | [((90, 337), 'tellurium.loada', 'te.loada', (['"""\n $G2 -> P2; Vmax2*P1^4/(Km1 + P1^4);\n P2 -> $w; k1*P2;\n $G3 -> P3; Vmax3*P1^4*P2^4/(Km1 + P1^4*P2^4);\n P3 -> $w; k1*P3;\n\n Vmax2 = 1; Vmax3 = 1;\n Km1 = 0.5; k1 = 0.1;\n P1 = 0; P2 = 0; P3 = 0;\n"""'], {}), '(\n """\n $G2 -> P2; ... |
import numpy as np
import pandas as pd
import colorsys
from scipy import interpolate
import matplotlib.patches as mpatches
from matplotlib import pyplot as plt
def _avg_silhouette(x):
"""
Создает симметричный граф
"""
return -x.sum(axis=1) / 2
def _wiggle_silhouette(x):
"""
Минимизирует дис... | [
"scipy.interpolate.splrep",
"matplotlib.pyplot.show",
"colorsys.hsv_to_rgb",
"matplotlib.pyplot.yticks",
"numpy.zeros",
"numpy.transpose",
"numpy.ones",
"numpy.argsort",
"numpy.max",
"numpy.array",
"numpy.arange",
"numpy.linspace",
"scipy.interpolate.splev",
"matplotlib.patches.Patch",
"... | [((712, 729), 'numpy.zeros', 'np.zeros', (['x.shape'], {}), '(x.shape)\n', (720, 729), True, 'import numpy as np\n'), ((962, 982), 'numpy.zeros', 'np.zeros', (['x.shape[0]'], {}), '(x.shape[0])\n', (970, 982), True, 'import numpy as np\n'), ((1284, 1295), 'numpy.array', 'np.array', (['g'], {}), '(g)\n', (1292, 1295), T... |
import pygame
from pygame.color import THECOLORS
from pygame.locals import *
from pygame import sprite
from pygame.draw import *
import math
import random
import time
from pykinect import nui
from pykinect.nui import JointId, SkeletonTrackingState
import ctypes
import thread
from numpy import interp
KINECTEVENT = pyg... | [
"pygame.event.Event",
"pygame.mouse.set_visible",
"pygame.event.get",
"pygame.Rect",
"pygame.font.init",
"pygame.display.update",
"numpy.interp",
"pykinect.nui.Runtime",
"ctypes.byref",
"math.radians",
"pygame.display.set_mode",
"pygame.quit",
"pygame.Surface",
"thread.allocate",
"math.s... | [((367, 380), 'pykinect.nui.Runtime', 'nui.Runtime', ([], {}), '()\n', (378, 380), False, 'from pykinect import nui\n'), ((434, 451), 'thread.allocate', 'thread.allocate', ([], {}), '()\n', (449, 451), False, 'import thread\n'), ((4251, 4270), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (4268, 4270), Fa... |
import pandas as pd
import json
import numpy as np
import os
import time
import asyncio
# def sendCred(self, command):
##### write config settings for Wizard to 'tinytuya.json' ####
CONFIGFILE = 'tinytuya.json'
print('')
config = {}
config['apiKey'] = "<KEY>"
config['apiSecret'] = "<KEY>"
config['apiDeviceID'] = "eb... | [
"json.load",
"pandas.json_normalize",
"json.dumps",
"time.sleep",
"numpy.where"
] | [((398, 426), 'json.dumps', 'json.dumps', (['config'], {'indent': '(4)'}), '(config, indent=4)\n', (408, 426), False, 'import json\n'), ((708, 722), 'time.sleep', 'time.sleep', (['(20)'], {}), '(20)\n', (718, 722), False, 'import time\n'), ((866, 904), 'pandas.json_normalize', 'pd.json_normalize', (["jsonData['devices'... |
import random
from typing import Union, Optional
import numpy as np
from eagle_bot.reinforcement_learning.exploration import OrnsteinUhlenbeckAndEpsilonGreedy
from eagle_bot.reinforcement_learning.model.base_model import BaseModel
from eagle_bot.reinforcement_learning.model.base_critic_model import BaseCriticModel
fr... | [
"tensorflow.python.keras.optimizers.Adam",
"numpy.zeros",
"eagle_bot.reinforcement_learning.replay.replay_handler.ExperienceReplayHandler",
"random.random",
"numpy.array"
] | [((1034, 1102), 'eagle_bot.reinforcement_learning.replay.replay_handler.ExperienceReplayHandler', 'ExperienceReplayHandler', ([], {'size': '(1500000)', 'batch_size': '(512)', 'warmup': '(100000)'}), '(size=1500000, batch_size=512, warmup=100000)\n', (1057, 1102), False, 'from eagle_bot.reinforcement_learning.replay.rep... |
import torch
from torch import nn as nn
from torch.nn import functional as F
from torch.distributions import Normal, Independent, Categorical
from rlkit.torch.core import eval_np
from rlkit.torch.networks import Mlp
from rlkit.torch.sac.gcs.networks import BNMlp
from rlkit.torch.sac.gcs.networks import BNMlp, MixtureS... | [
"torch.distributions.Categorical",
"numpy.argmax",
"torch.nn.BatchNorm1d",
"torch.nn.functional.softmax",
"torch.exp",
"rlkit.torch.core.eval_np",
"torch.clamp",
"numpy.array",
"torch.nn.Linear",
"torch.distributions.Normal",
"torch.log",
"numpy.all"
] | [((3681, 3713), 'torch.nn.BatchNorm1d', 'torch.nn.BatchNorm1d', (['input_size'], {}), '(input_size)\n', (3701, 3713), False, 'import torch\n'), ((4166, 4186), 'rlkit.torch.core.eval_np', 'eval_np', (['self', 'input'], {}), '(self, input)\n', (4173, 4186), False, 'from rlkit.torch.core import eval_np\n'), ((4202, 4216),... |
import json
import logging
from typing import Callable, Dict, List, Optional, Union
import bokeh
import hail as hl
import numpy as np
import pandas as pd
from bokeh.layouts import gridplot
from bokeh.models import (
BooleanFilter,
CDSView,
Column,
ColumnDataSource,
DataRange1d,
Div,
Grid,
... | [
"bokeh.models.ColumnDataSource",
"numpy.histogram",
"pandas.DataFrame",
"hail.hadoop_ls",
"numpy.append",
"numpy.cumsum",
"bokeh.models.widgets.Panel",
"bokeh.models.Legend",
"bokeh.layouts.gridplot",
"bokeh.models.Div",
"bokeh.models.Title",
"bokeh.plotting.figure",
"hail.hadoop_open",
"l... | [((719, 831), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s (%(name)s %(lineno)s): %(message)s"""', 'datefmt': '"""%m/%d/%Y %I:%M:%S %p"""'}), "(format='%(asctime)s (%(name)s %(lineno)s): %(message)s',\n datefmt='%m/%d/%Y %I:%M:%S %p')\n", (738, 831), False, 'import logging\n'), ((848... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from keras.utils import to_categorical
from DL_models import get_multiscaleDNN_model
## using synthetic data
input1_len = int(90*(90-1)*0.5)
input2_... | [
"DL_models.get_multiscaleDNN_model",
"numpy.random.randn"
] | [((415, 446), 'numpy.random.randn', 'np.random.randn', (['(80)', 'input1_len'], {}), '(80, input1_len)\n', (430, 446), True, 'import numpy as np\n'), ((462, 493), 'numpy.random.randn', 'np.random.randn', (['(80)', 'input2_len'], {}), '(80, input2_len)\n', (477, 493), True, 'import numpy as np\n'), ((509, 540), 'numpy.r... |
from torch.optim.lr_scheduler import _LRScheduler
import numpy
class WarmUpLR(_LRScheduler):
"""warmup_training learning rate scheduler
Args:
optimizer: optimzier(e.g. SGD)
total_iters: totoal_iters of warmup phase
"""
def __init__(self, optimizer, total_iters, last_epoch=-1):
... | [
"numpy.std",
"numpy.mean"
] | [((1243, 1261), 'numpy.mean', 'numpy.mean', (['data_r'], {}), '(data_r)\n', (1253, 1261), False, 'import numpy\n'), ((1263, 1281), 'numpy.mean', 'numpy.mean', (['data_g'], {}), '(data_g)\n', (1273, 1281), False, 'import numpy\n'), ((1283, 1301), 'numpy.mean', 'numpy.mean', (['data_b'], {}), '(data_b)\n', (1293, 1301), ... |
# $Id$
#
# This file is part of the BCPy2000 framework, a Python framework for
# implementing modules that run on top of the BCI2000 <http://bci2000.org/>
# platform, for the purpose of realtime biosignal processing.
#
# Copyright (C) 2007-10 <NAME>, <NAME>,
# <NAME>, <NAME>
# ... | [
"numpy.asarray",
"numpy.asmatrix"
] | [((3008, 3029), 'numpy.asarray', 'numpy.asarray', (['self.x'], {}), '(self.x)\n', (3021, 3029), False, 'import numpy\n'), ((3152, 3173), 'numpy.asarray', 'numpy.asarray', (['self.x'], {}), '(self.x)\n', (3165, 3173), False, 'import numpy\n'), ((5527, 5548), 'numpy.asarray', 'numpy.asarray', (['self.x'], {}), '(self.x)\... |
import numpy as np
import keras
import matplotlib.pyplot as plt
import tensorflow as tf
import keras.models
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.models import Model, load_model
from keras.layers import Dense, Dropout, Flatten, merge, UpSampling2D, Resha... | [
"scipy.misc.pilutil.imread",
"numpy.asarray",
"numpy.save",
"os.listdir"
] | [((1658, 1679), 'os.listdir', 'os.listdir', (['filePath1'], {}), '(filePath1)\n', (1668, 1679), False, 'import os\n'), ((1692, 1713), 'os.listdir', 'os.listdir', (['filePath2'], {}), '(filePath2)\n', (1702, 1713), False, 'import os\n'), ((1726, 1747), 'os.listdir', 'os.listdir', (['filePath3'], {}), '(filePath3)\n', (1... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 16 12:46:00 2018
@author: <NAME>
"""
# =============================================================================
# Chapter 0: Import Modules
# =============================================================================
import logging
import matplotlib.pyplot as plt... | [
"numpy.random.uniform",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.axis",
"logging.info",
"matplotlib.pyplot.figure",
"seaborn.set",
"matplotlib.pyplot.savefig"
] | [((362, 371), 'seaborn.set', 'sns.set', ([], {}), '()\n', (369, 371), True, 'import seaborn as sns\n'), ((1064, 1151), 'logging.info', 'logging.info', (["('Plotting the Losses of the' + 'Discriminative and Generative Models')"], {}), "('Plotting the Losses of the' +\n 'Discriminative and Generative Models')\n", (107... |
import numpy as np
import pytest
from pandas._libs.tslibs import iNaT
from pandas._libs.tslibs.period import IncompatibleFrequency
from pandas.core.dtypes.base import registry
from pandas.core.dtypes.dtypes import PeriodDtype
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import (
Perio... | [
"pandas.core.arrays.period_array",
"pandas.core.arrays.PeriodArray",
"pandas.core.dtypes.base.registry.find",
"pandas._testing.assert_period_array_equal",
"pytest.raises",
"numpy.array",
"pandas.Period",
"numpy.arange",
"pandas.core.dtypes.dtypes.PeriodDtype",
"pandas._testing.assert_numpy_array_e... | [((516, 542), 'pandas.core.dtypes.base.registry.find', 'registry.find', (['"""Period[D]"""'], {}), "('Period[D]')\n", (529, 542), False, 'from pandas.core.dtypes.base import registry\n'), ((558, 574), 'pandas.core.dtypes.dtypes.PeriodDtype', 'PeriodDtype', (['"""D"""'], {}), "('D')\n", (569, 574), False, 'from pandas.c... |
import pandas as pd
import numpy as np
import scipy.stats
from prettytable import PrettyTable
from prettytable import MSWORD_FRIENDLY
class bibd():
def __init__(self, file_name, alpha=0.05):
dataset = pd.read_csv(file_name)
missing=dataset.isna().sum(axis = 1)[0]
data = dataset.iloc[:,1:].values
data = data.as... | [
"numpy.nansum",
"numpy.size",
"pandas.read_csv",
"numpy.square",
"numpy.isnan",
"prettytable.PrettyTable"
] | [((204, 226), 'pandas.read_csv', 'pd.read_csv', (['file_name'], {}), '(file_name)\n', (215, 226), True, 'import pandas as pd\n'), ((361, 377), 'numpy.size', 'np.size', (['data', '(1)'], {}), '(data, 1)\n', (368, 377), True, 'import numpy as np\n'), ((394, 410), 'numpy.size', 'np.size', (['data', '(0)'], {}), '(data, 0)... |
"""
Environment module
"""
from typing import Dict, Optional
import gym
import math
import numpy as np
from typing import Dict, List
from atcenv.definitions import *
from gym.envs.classic_control import rendering
from shapely.geometry import LineString, MultiPoint
from shapely.ops import nearest_points
WHITE = [255,... | [
"gym.envs.classic_control.rendering.make_circle",
"gym.envs.classic_control.rendering.Transform",
"shapely.geometry.MultiPoint",
"shapely.ops.nearest_points",
"gym.envs.classic_control.rendering.make_polygon",
"numpy.zeros",
"shapely.geometry.LineString",
"gym.envs.classic_control.rendering.Viewer"
] | [((4166, 4217), 'numpy.zeros', 'np.zeros', (['(self.max_agent_seen * 2)'], {'dtype': 'np.float32'}), '(self.max_agent_seen * 2, dtype=np.float32)\n', (4174, 4217), True, 'import numpy as np\n'), ((10598, 10643), 'gym.envs.classic_control.rendering.Viewer', 'rendering.Viewer', (['screen_width', 'screen_height'], {}), '(... |
"""Chi distribution."""
import numpy
from scipy import special
from ..baseclass import SimpleDistribution, ShiftScaleDistribution
class chi(SimpleDistribution):
"""Chi distribution."""
def __init__(self, df=1):
super(chi, self).__init__(dict(df=df))
def _pdf(self, x, df):
return x**(df-... | [
"scipy.special.gamma",
"numpy.exp",
"scipy.special.gammainc",
"scipy.special.gammaincinv"
] | [((419, 458), 'scipy.special.gammainc', 'special.gammainc', (['(df * 0.5)', '(0.5 * x * x)'], {}), '(df * 0.5, 0.5 * x * x)\n', (435, 458), False, 'from scipy import special\n'), ((355, 378), 'scipy.special.gamma', 'special.gamma', (['(df * 0.5)'], {}), '(df * 0.5)\n', (368, 378), False, 'from scipy import special\n'),... |
# This code is a part of XMM: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
# Last modified by <NAME> (<EMAIL>) 16/08/2021, 16:20. Copyright (c) <NAME>
import inspect
from datetime import date
from typing import List
from warnings import warn
import numpy as np
import scipy.odr as ... | [
"matplotlib.pyplot.title",
"cycler.cycler",
"numpy.argmax",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.mean",
"getdist.MCSamples",
"numpy.random.normal",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.tight_layout",
"inspect.signature",
"numpy.linspace",
"matplotlib.pyplot.subplots",
... | [((19367, 19377), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (19375, 19377), True, 'from matplotlib import pyplot as plt\n'), ((21280, 21328), 'getdist.plots.get_subplot_plotter', 'plots.get_subplot_plotter', ([], {'width_inch': 'figsize[0]'}), '(width_inch=figsize[0])\n', (21305, 21328), False, 'from getd... |
import numpy as np
from matplotlib import pyplot as plt
def plot_spectrum(x: np.ndarray, eps: float = 1e-7):
assert len(x.shape) == 1
x_fft = np.fft.fft(x)
x_fft_abs = np.abs(x_fft)
x_fft_angle = np.angle(x_fft)
f_dig = np.linspace(-np.pi, np.pi, x.shape[0])
plt.subplot(2, 1, 1)
plt.plot(f... | [
"matplotlib.pyplot.subplot",
"numpy.abs",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.fft.fft",
"numpy.angle",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"numpy.log10",
"matplotlib.pyplot.grid"
] | [((152, 165), 'numpy.fft.fft', 'np.fft.fft', (['x'], {}), '(x)\n', (162, 165), True, 'import numpy as np\n'), ((182, 195), 'numpy.abs', 'np.abs', (['x_fft'], {}), '(x_fft)\n', (188, 195), True, 'import numpy as np\n'), ((214, 229), 'numpy.angle', 'np.angle', (['x_fft'], {}), '(x_fft)\n', (222, 229), True, 'import numpy... |
import os
from collections import OrderedDict
import pymatgen as pmg
from pymatgen.core import Specie, Element, Structure
from pymatgen.core.periodic_table import _pt_data as periodic_table
import numpy as np
from .core import LammpsBox, LammpsPotentials
class LammpsInput:
def __init__(self, lammps_script, lamm... | [
"numpy.abs",
"os.makedirs",
"pymatgen.core.Element",
"pymatgen.core.Structure",
"os.path.exists",
"numpy.rec.array",
"numpy.array",
"os.path.join",
"pymatgen.core.Specie",
"pymatgen.SymmOp.from_rotation_and_translation"
] | [((12820, 12922), 'pymatgen.core.Structure', 'Structure', (['lattice', 'species', 'positions'], {'coords_are_cartesian': '(True)', 'site_properties': 'site_properties'}), '(lattice, species, positions, coords_are_cartesian=True,\n site_properties=site_properties)\n', (12829, 12922), False, 'from pymatgen.core import... |
import math
import numpy as np
import torch
import torch.nn.functional as F
import torch.nn as nn
from cvcore.modeling.backbone.fpn import get_act, get_norm
from .build import SEM_SEG_HEAD_REGISTRY
__all__ = ["FPNHead"]
@SEM_SEG_HEAD_REGISTRY.register()
class FPNHead(nn.Module):
"""
A semanti... | [
"torch.stack",
"torch.nn.Sequential",
"numpy.log2",
"torch.nn.Conv2d",
"cvcore.modeling.backbone.fpn.get_act",
"torch.cat",
"torch.nn.Upsample",
"torch.nn.functional.interpolate",
"cvcore.modeling.backbone.fpn.get_norm"
] | [((2924, 3015), 'torch.nn.functional.interpolate', 'F.interpolate', (['x'], {'scale_factor': 'self.common_stride', 'mode': '"""bilinear"""', 'align_corners': '(False)'}), "(x, scale_factor=self.common_stride, mode='bilinear',\n align_corners=False)\n", (2937, 3015), True, 'import torch.nn.functional as F\n'), ((2430... |
import os
import json
import math
import random
import numpy as np
from PIL import Image
import torch
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from .dataset_utils import listdir_nohidden, normalize_trajectory, random_rotation_augment
class ReplicaDataset(Dataset):
def __i... | [
"torch.ones",
"json.load",
"torch.eye",
"random.randint",
"torch.stack",
"numpy.deg2rad",
"math.floor",
"torchvision.transforms.ToTensor",
"PIL.Image.open",
"torch.Tensor",
"random.seed",
"numpy.array",
"os.path.join",
"torchvision.transforms.Resize"
] | [((755, 794), 'os.path.join', 'os.path.join', (['self.data_dir', 'self.split'], {}), '(self.data_dir, self.split)\n', (767, 794), False, 'import os\n'), ((2157, 2179), 'torch.stack', 'torch.stack', (['Rt'], {'dim': '(0)'}), '(Rt, dim=0)\n', (2168, 2179), False, 'import torch\n'), ((3320, 3333), 'random.seed', 'random.s... |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 16 16:40:55 2014
@author: michaelwalton
"""
import csv
import numpy as np
import matplotlib.pyplot as plt
import pylab as pl
# general simulator settings
expType = 1 #which input dataset to use
inhibFreq = 20.0 #frequency of LFP oscillation in the i... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"numpy.random.random_sample",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.imshow",
"numpy.transpose",
"numpy.sin",
"numpy.arange",
"pylab.figure",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xla... | [((1761, 1801), 'numpy.arange', 'np.arange', (['(0)', 'glomeruli.shape[0]', '(1 / fs)'], {}), '(0, glomeruli.shape[0], 1 / fs)\n', (1770, 1801), True, 'import numpy as np\n'), ((1813, 1846), 'numpy.sin', 'np.sin', (['(2 * np.pi * inhibFreq * t)'], {}), '(2 * np.pi * inhibFreq * t)\n', (1819, 1846), True, 'import numpy ... |
"""
This module implements some of the spatial analysis techniques and processes used to
understand the patterns and relationships of geographic features.
This is mainly inspired by turf.js.
link: http://turfjs.org/
"""
import copy
import itertools
import math
from math import floor, sqrt
from typing import List, Optio... | [
"shapely.ops.unary_union",
"shapely.geometry.MultiLineString",
"turfpy.measurement.bbox_polygon",
"turfpy.helper.get_geom",
"scipy.spatial.Voronoi",
"turfpy.meta.flatten_each",
"turfpy.helper.get_coords",
"turfpy.helper.get_type",
"shapely.geometry.shape",
"scipy.spatial.Delaunay",
"geojson.Line... | [((3007, 3025), 'turfpy.measurement.bbox_polygon', 'bbox_polygon', (['bbox'], {}), '(bbox)\n', (3019, 3025), False, 'from turfpy.measurement import bbox, bbox_polygon, center, centroid, destination, rhumb_bearing, rhumb_destination, rhumb_distance\n'), ((5043, 5064), 'shapely.geometry.mapping', 'mapping', (['intersecti... |
#########################################################################################################################
## Distribution code Version 1.0 -- 14/10/2021 by <NAME> Copyright 2021, University of Siegen
##
## The Code is created based on the method described in the following paper
## [1] "Deep Optim... | [
"numpy.array",
"h5py.File",
"numpy.ndarray",
"torch.from_numpy"
] | [((2323, 2390), 'numpy.ndarray', 'np.ndarray', ([], {'shape': '(self.NC, self.NY, self.NX, self.NZ)', 'dtype': 'float'}), '(shape=(self.NC, self.NY, self.NX, self.NZ), dtype=float)\n', (2333, 2390), True, 'import numpy as np\n'), ((1472, 1502), 'h5py.File', 'h5py.File', (['self.path_data', '"""r"""'], {}), "(self.path_... |
#!/usr/bin/env python3
import numpy as np
RNNCell = __import__('0-rnn_cell').RNNCell
np.random.seed(0)
rnn_cell = RNNCell(10, 15, 5)
print("Wh:", rnn_cell.Wh)
print("Wy:", rnn_cell.Wy)
print("bh:", rnn_cell.bh)
print("by:", rnn_cell.by)
rnn_cell.bh = np.random.randn(1, 15)
rnn_cell.by = np.random.randn(1, 5)
h_prev =... | [
"numpy.random.seed",
"numpy.random.randn"
] | [((87, 104), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (101, 104), True, 'import numpy as np\n'), ((253, 275), 'numpy.random.randn', 'np.random.randn', (['(1)', '(15)'], {}), '(1, 15)\n', (268, 275), True, 'import numpy as np\n'), ((290, 311), 'numpy.random.randn', 'np.random.randn', (['(1)', '(5)'... |
"""
Файнтюнинг ruT5 на датасете, подготовленном в prepare_training_dataset.py
"""
import io
import re
import os
import tqdm
import torch
from transformers import T5ForConditionalGeneration, T5Tokenizer, T5Config
from transformers import TrainingArguments
from transformers import Trainer
from transformers import AdamW... | [
"apex.amp.initialize",
"torch.no_grad",
"torch.utils.data.DataLoader",
"transformers.T5ForConditionalGeneration.from_pretrained",
"numpy.mean",
"torch.cuda.is_available",
"io.open",
"torch.device",
"transformers.T5Tokenizer.from_pretrained",
"torch.nn.DataParallel",
"torch.is_tensor",
"os.path... | [((3702, 3715), 'numpy.mean', 'np.mean', (['accs'], {}), '(accs)\n', (3709, 3715), True, 'import numpy as np\n'), ((3964, 3996), 'os.path.join', 'os.path.join', (['tmp_dir', '"""rut5.pt"""'], {}), "(tmp_dir, 'rut5.pt')\n", (3976, 3996), False, 'import os\n'), ((4014, 4053), 'transformers.T5Tokenizer.from_pretrained', '... |
from typing import Dict, Tuple, Any
import numpy as np
import cv2
import matplotlib.pyplot as plt
from . import image
class Warp(object):
def __init__(self, mapping:Dict[Tuple[Any, Any], Tuple[Any, Any]]):
'''
initializes the warp perspective transformation from a mapping of
four source ... | [
"matplotlib.pyplot.imshow",
"cv2.warpPerspective",
"numpy.array",
"matplotlib.pyplot.ginput"
] | [((2248, 2263), 'matplotlib.pyplot.imshow', 'plt.imshow', (['img'], {}), '(img)\n', (2258, 2263), True, 'import matplotlib.pyplot as plt\n'), ((931, 1037), 'cv2.warpPerspective', 'cv2.warpPerspective', (['img', 'self.transform_matrix', '(img.shape[1], img.shape[0])'], {'flags': 'cv2.INTER_LINEAR'}), '(img, self.transfo... |
import os
import sys
import random
import math
import re
import time
import numpy as np
import tensorflow as tf
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from pathlib import PureWindowsPath as Path
import utils
import visualize
from visualize import display_images
import mod... | [
"tqdm.tqdm",
"json.load",
"pickle.dump",
"os.makedirs",
"os.readlink",
"os.path.isdir",
"scipy.sparse.bsr_matrix",
"numpy.zeros",
"numpy.fliplr",
"numpy.array",
"model.MaskRCNN",
"os.path.join"
] | [((612, 624), 'json.load', 'json.load', (['f'], {}), '(f)\n', (621, 624), False, 'import json\n'), ((1551, 1600), 'numpy.array', 'np.array', (['[88.59672608, 95.91837699, 98.90089033]'], {}), '([88.59672608, 95.91837699, 98.90089033])\n', (1559, 1600), True, 'import numpy as np\n'), ((1990, 2049), 'numpy.zeros', 'np.ze... |
from letop_examples import (
compliance_optimization,
heat_exchanger_optimization,
)
from numpy.testing import assert_allclose
def test_heat_exchanger():
results = heat_exchanger_optimization(n_iters=10)
cost_func = results["J"][-1]
assert_allclose(
cost_func,
-1.316,
rtol=... | [
"numpy.testing.assert_allclose",
"letop_examples.heat_exchanger_optimization",
"letop_examples.compliance_optimization"
] | [((178, 217), 'letop_examples.heat_exchanger_optimization', 'heat_exchanger_optimization', ([], {'n_iters': '(10)'}), '(n_iters=10)\n', (205, 217), False, 'from letop_examples import compliance_optimization, heat_exchanger_optimization\n'), ((255, 300), 'numpy.testing.assert_allclose', 'assert_allclose', (['cost_func',... |
"""Functions used for registering stacks of images, e.g. spectroscopic data"""
import numpy as np
import dask.array as da
import dask
from dask.delayed import delayed
from scipy.optimize import least_squares
import scipy.ndimage as ndi
from scipy.interpolate import interp1d
import scipy.sparse as ssp
from skimage impor... | [
"numpy.ones",
"dask.array.diag",
"dask.array.max",
"numpy.arange",
"numpy.diag",
"scipy.interpolate.interp1d",
"numpy.atleast_2d",
"numpy.full_like",
"dask.array.asarray",
"scipy.optimize.least_squares",
"scipy.sparse.coo_matrix",
"dask.array.argmax",
"dask.array.as_gufunc",
"dask.array.tr... | [((2269, 2300), 'dask.array.fft.rfft2', 'da.fft.rfft2', (['data'], {'axes': '(1, 2)'}), '(data, axes=(1, 2))\n', (2281, 2300), True, 'import dask.array as da\n'), ((2457, 2491), 'dask.array.fft.fftshift', 'da.fft.fftshift', (['Corr'], {'axes': '(2, 3)'}), '(Corr, axes=(2, 3))\n', (2472, 2491), True, 'import dask.array ... |
import torch
from torch import nn
import numpy as np
import utils
import excitability_modules as em
class fc_layer(nn.Module):
'''Fully connected layer, with possibility of returning "pre-activations".
Input: [batch_size] x ... x [in_size] tensor
Output: [batch_size] x ... x [out_size] tensor'''
def... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.BatchNorm1d",
"utils.Identity",
"torch.nn.Sigmoid",
"excitability_modules.LinearExcitability",
"numpy.repeat",
"numpy.linspace",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.LeakyReLU",
"torch.nn.Hardtanh"
] | [((409, 418), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (416, 418), False, 'from torch import nn\n'), ((757, 891), 'excitability_modules.LinearExcitability', 'em.LinearExcitability', (['in_size', 'out_size'], {'bias': '(False if batch_norm else bias)', 'excitability': 'excitability', 'excit_buffer': 'excit_buffer'}... |
# coding=utf-8
# Copyright 2020 <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 i... | [
"matplotlib.pyplot.box",
"matplotlib.pyplot.rcParams.update",
"numpy.array",
"matplotlib.pyplot.subplots",
"html.escape"
] | [((2396, 2434), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 22}"], {}), "({'font.size': 22})\n", (2415, 2434), True, 'import matplotlib.pyplot as plt\n'), ((2453, 2482), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(16, 9)'}), '(figsize=(16, 9))\n', (2465, 2482), True... |
import math
import random
import numpy as np
from typing import Union, Optional, Dict, List
from python_ghost_cursor.shared._math import (
Vector,
magnitude,
direction,
bezierCurve,
)
def fitts(distance: float, width: float) -> float:
a = 0
b = 2
id_ = math.log2(distance / width + 1)
r... | [
"python_ghost_cursor.shared._math.Vector",
"python_ghost_cursor.shared._math.bezierCurve",
"python_ghost_cursor.shared._math.direction",
"random.random",
"numpy.linspace",
"math.log2"
] | [((283, 314), 'math.log2', 'math.log2', (['(distance / width + 1)'], {}), '(distance / width + 1)\n', (292, 314), False, 'import math\n'), ((645, 684), 'python_ghost_cursor.shared._math.bezierCurve', 'bezierCurve', (['start', 'end', 'spreadOverride'], {}), '(start, end, spreadOverride)\n', (656, 684), False, 'from pyth... |
# Data processing imports
import scipy.io as io
import numpy as np
from pyDOE import lhs
# Plotting imports
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from scipy.interpolate import griddata
import matplotlib.gridspec as gridspec
def load_dataset(file):
data = io.loadma... | [
"mpl_toolkits.axes_grid1.make_axes_locatable",
"matplotlib.pyplot.subplot",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"scipy.io.loadmat",
"matplotlib.pyplot.gca",
"pyDOE.lhs",
"numpy.random.randn",
"numpy.std",
"numpy.ones",
"numpy.hstack",
"matplotlib.pyplot.figure",
"numpy.random.choice"... | [((311, 327), 'scipy.io.loadmat', 'io.loadmat', (['file'], {}), '(file)\n', (321, 327), True, 'import scipy.io as io\n'), ((510, 527), 'numpy.meshgrid', 'np.meshgrid', (['x', 't'], {}), '(x, t)\n', (521, 527), True, 'import numpy as np\n'), ((700, 735), 'numpy.hstack', 'np.hstack', (['[X[:1, :].T, T[:1, :].T]'], {}), '... |
import copy
from datetime import datetime
from decimal import Decimal
from unittest import TestCase
import numpy as np
import pandas as pd
import pytz
from pandas import DataFrame
from src.constants import UTC, US_EASTERN, NAN
from src.dao.dao import DAO
from src.dao.intraday_dao import IntradayDAO
from src.entity.co... | [
"pandas.DataFrame",
"numpy.full",
"pandas.date_range",
"datetime.datetime.fromisoformat",
"decimal.Decimal",
"unittest.TestCase",
"src.entity.stock_entity.StockEntity.query.delete",
"copy.copy",
"src.entity.forward_entity.ForwardEntity.query.delete",
"src.entity.intraday_entity.IntradayEntity.quer... | [((670, 716), 'pandas.date_range', 'pd.date_range', (['"""1/1/2000"""'], {'periods': '(150)', 'tz': 'UTC'}), "('1/1/2000', periods=150, tz=UTC)\n", (683, 716), True, 'import pandas as pd\n'), ((791, 812), 'copy.copy', 'copy.copy', (['prices_aaa'], {}), '(prices_aaa)\n', (800, 812), False, 'import copy\n'), ((834, 855),... |
# Import packages
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
from keras.preprocessing.image import ImageDataGenerator
from keras.utils.np_utils import to_categorical
from keras.models import Sequential, load_model
from keras.layers import Dense
from keras.optimizers import Adam... | [
"keras.preprocessing.image.ImageDataGenerator",
"cv2.equalizeHist",
"cv2.cvtColor",
"sklearn.model_selection.train_test_split",
"keras.layers.Dropout",
"keras.layers.convolutional.MaxPooling2D",
"keras.layers.Flatten",
"keras.optimizers.Adam",
"keras.utils.np_utils.to_categorical",
"keras.layers.c... | [((676, 692), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (686, 692), False, 'import os\n'), ((1019, 1035), 'numpy.array', 'np.array', (['images'], {}), '(images)\n', (1027, 1035), True, 'import numpy as np\n'), ((1046, 1063), 'numpy.array', 'np.array', (['classNo'], {}), '(classNo)\n', (1054, 1063), True, ... |
import os
import pytest
import numpy as np
import pyansys
from pyansys import examples
test_path = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture(scope='module')
def result():
return pyansys.read_binary(examples.rstfile)
@pytest.fixture(scope='module')
def archive():
return pyansys.Archive(exa... | [
"os.path.abspath",
"os.path.join",
"pyansys.read_binary",
"numpy.allclose",
"pytest.fixture",
"numpy.isnan",
"numpy.array",
"numpy.loadtxt",
"pyansys.Archive"
] | [((147, 177), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (161, 177), False, 'import pytest\n'), ((244, 274), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (258, 274), False, 'import pytest\n'), ((117, 142), 'os.path.abspath', '... |
#from tensorlayer.prepro import *
import numpy as np
import skimage.measure
import scipy
from time import localtime, strftime
import logging
import tensorflow as tf
import os
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
def distort_img(x):
x = (x + 1.) /... | [
"tensorflow.spectral.fft2d",
"tensorflow.abs",
"numpy.abs",
"logging.FileHandler",
"numpy.ravel",
"scipy.fftpack.fftshift",
"tensorflow.zeros_like",
"logging.getLogger",
"numpy.random.RandomState",
"scipy.ndimage.interpolation.map_coordinates",
"scipy.fftpack.ifft2",
"time.localtime",
"scipy... | [((810, 840), 'scipy.fftpack.fft2', 'scipy.fftpack.fft2', (['x[:, :, 0]'], {}), '(x[:, :, 0])\n', (828, 840), False, 'import scipy\n'), ((851, 878), 'scipy.fftpack.fftshift', 'scipy.fftpack.fftshift', (['fft'], {}), '(fft)\n', (873, 878), False, 'import scipy\n'), ((910, 938), 'scipy.fftpack.ifftshift', 'scipy.fftpack.... |
# 你好, 欢迎使用 EF 饮食计算器
# 你只需要改两个数字就可以使用了:
heat_required = 2500 # 请把数字2500改成你所需要摄入的总能量
required_cp_ratio=2.5 # 如果你希望碳水提供的能量是蛋白质提供的能能量的三倍, 就把2改成3
# 按照这个格式添加你需要的食物数据
# '鸡胸肉': [7.72, 0, 29.55] 的意思是:
# 食物名称:鸡胸肉
# 每100g鸡胸肉含有7.72g脂肪
# 每100g鸡胸肉含有0g碳水化合物
# 每100g鸡胸肉含有29.55g脂肪
# 如果要添加数据, 需要在 '蒸南瓜': [0.07, 5.33, 0.8] 后面加入一条新数... | [
"pandas.DataFrame",
"numpy.zeros",
"time.time",
"numpy.random.random",
"numpy.array",
"pandas.Series",
"numpy.dot",
"pandas.to_numeric"
] | [((909, 920), 'time.time', 'time.time', ([], {}), '()\n', (918, 920), False, 'import time\n'), ((1808, 1850), 'numpy.array', 'np.array', (['nutrition_information.iloc[:, 1]'], {}), '(nutrition_information.iloc[:, 1])\n', (1816, 1850), True, 'import numpy as np\n'), ((1864, 1906), 'numpy.array', 'np.array', (['nutrition... |
import os
import numpy as np
from file_handling import recording
from file_handling.file_handling_exceptions import InconsistentNChanError
class RecordingGroup(object):
"""
class for managing recordings and applying operations to multiple recording instances together
typically, a single exp... | [
"numpy.sort",
"os.listdir",
"file_handling.recording.Recording"
] | [((1295, 1316), 'os.listdir', 'os.listdir', (['self.root'], {}), '(self.root)\n', (1305, 1316), False, 'import os\n'), ((3117, 3141), 'numpy.sort', 'np.sort', (['self.recordings'], {}), '(self.recordings)\n', (3124, 3141), True, 'import numpy as np\n'), ((1667, 1734), 'file_handling.recording.Recording', 'recording.Rec... |
# Copyright 2020 The TensorFlow 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 applica... | [
"tensorflow.python.platform.test.main",
"tensorflow.python.ops.nn.embedding_lookup",
"tensorflow.python.framework.constant_op.constant",
"tensorflow.python.keras.initializers.constant",
"numpy.take",
"numpy.array",
"numpy.arange"
] | [((2888, 2899), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (2897, 2899), False, 'from tensorflow.python.platform import test\n'), ((1529, 1562), 'tensorflow.python.framework.constant_op.constant', 'constant_op.constant', (['[[1, 2, 3]]'], {}), '([[1, 2, 3]])\n', (1549, 1562), False, 'from te... |
import os
from glob import glob
import pickle
import numpy as np
import cv2
import torch
import torch.nn.functional as F
from face_detection_dsfd.face_ssd_infer import SSD
from face_detection_dsfd.data import widerface_640, TestBaseTransform
def parse_images(input, postfix='.jpg', indices=None):
out_dir = None
... | [
"pickle.dump",
"torch.set_default_tensor_type",
"os.path.isfile",
"cv2.imshow",
"os.path.join",
"numpy.round",
"torch.nn.functional.pad",
"torch.load",
"os.path.exists",
"numpy.loadtxt",
"cv2.resize",
"face_detection_dsfd.face_ssd_infer.SSD",
"os.path.basename",
"cv2.waitKey",
"torch.cud... | [((1636, 1665), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '(False)\n', (1658, 1665), False, 'import torch\n'), ((1933, 1944), 'face_detection_dsfd.face_ssd_infer.SSD', 'SSD', (['"""test"""'], {}), "('test')\n", (1936, 1944), False, 'from face_detection_dsfd.face_ssd_infer import SSD\n'), ((... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 17 09:11:12 2020
@author: emc1977
"""
import numpy as np
from scipy import optimize
def f(x): # The rosenbrock function
return .5*(1 - x[0])**2 + (x[1] - x[0]**2)**2
def jacobian(x):
return np.array((-2*.5*(1 - x[0]) - 4*x[0]*(x[1] - x[0]**2), 2... | [
"scipy.optimize.minimize",
"numpy.array"
] | [((354, 417), 'scipy.optimize.minimize', 'optimize.minimize', (['f', '[2, -1]'], {'method': '"""Newton-CG"""', 'jac': 'jacobian'}), "(f, [2, -1], method='Newton-CG', jac=jacobian)\n", (371, 417), False, 'from scipy import optimize\n'), ((265, 358), 'numpy.array', 'np.array', (['(-2 * 0.5 * (1 - x[0]) - 4 * x[0] * (x[1]... |
import numpy as np
import kornia
import torch
import torch.nn as nn
import torch.nn.functional as F
import utils
class ReplayBuffer(object):
"""Buffer to store environment transitions."""
def __init__(self, view, obs_shape, action_shape, capacity, image_pad, device, num_frames_per_stack):
self.view =... | [
"torch.nn.ReplicationPad2d",
"numpy.empty",
"kornia.augmentation.RandomCrop",
"numpy.random.randint",
"torch.as_tensor",
"numpy.copyto"
] | [((1112, 1177), 'numpy.empty', 'np.empty', (['(capacity, 39 * num_frames_per_stack)'], {'dtype': 'np.float32'}), '((capacity, 39 * num_frames_per_stack), dtype=np.float32)\n', (1120, 1177), True, 'import numpy as np\n'), ((1210, 1275), 'numpy.empty', 'np.empty', (['(capacity, 39 * num_frames_per_stack)'], {'dtype': 'np... |
import numpy as np
class Config:
#########################################################################
# GENERAL PARAMETERS
COLLISION_AVOIDANCE = True
continuous, discrete = range(2) # Initialize game types as enum
ACTION_SPACE_TYPE = continuous
ANIMATE_EPISODES = True
SHOW_EPISOD... | [
"numpy.array",
"numpy.ones"
] | [((4833, 4866), 'numpy.array', 'np.array', (['[5.0]'], {'dtype': 'np.float32'}), '([5.0], dtype=np.float32)\n', (4841, 4866), True, 'import numpy as np\n'), ((4887, 4920), 'numpy.array', 'np.array', (['[0.0]'], {'dtype': 'np.float32'}), '([0.0], dtype=np.float32)\n', (4895, 4920), True, 'import numpy as np\n'), ((5113,... |
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.transforms
import os
def image_resize(image, width=None, height=None, inter=cv2.INTER_AREA):
# initialize the dimensions of the image to be resized and
# grab the image size
dim = None
(h, w) = image.shape[:2]
... | [
"cv2.line",
"numpy.sum",
"os.makedirs",
"os.path.join",
"os.path.exists",
"cv2.imread",
"matplotlib.pyplot.gca",
"cv2.imshow",
"cv2.pyrDown",
"cv2.resize"
] | [((927, 970), 'cv2.resize', 'cv2.resize', (['image', 'dim'], {'interpolation': 'inter'}), '(image, dim, interpolation=inter)\n', (937, 970), False, 'import cv2\n'), ((1172, 1230), 'cv2.imread', 'cv2.imread', (['(base_path + pre_processed_path + image_name)', '(0)'], {}), '(base_path + pre_processed_path + image_name, 0... |
import argparse
import os
import torch
from torchvision import utils
from tqdm import tqdm
from torch.utils import data
import numpy as np
import random
from PIL import Image
import torchvision.transforms as transforms
from dataset import DeepFashionDataset
from model import Generator
from util.dp2coor import getSymXYc... | [
"numpy.load",
"torch.from_numpy",
"argparse.ArgumentParser",
"os.makedirs",
"util.coordinate_completion_model.define_G",
"torch.load",
"os.path.exists",
"torch.cat",
"numpy.expand_dims",
"torchvision.transforms.ToTensor",
"model.Generator",
"util.dp2coor.getSymXYcoordinates",
"torchvision.tr... | [((557, 645), 'torch.nn.functional.pad', 'torch.nn.functional.pad', ([], {'input': 'im', 'pad': '(right, left, 0, 0)', 'mode': '"""constant"""', 'value': '(0)'}), "(input=im, pad=(right, left, 0, 0), mode='constant',\n value=0)\n", (580, 645), False, 'import torch\n'), ((653, 744), 'torch.nn.functional.pad', 'torch.... |
# Advent of Code 2021 Day 20
# Author: <NAME>
# URL: https://adventofcode.com/2021/day/20
import numpy as np
from scipy.ndimage import convolve
def part_a(data: list[str]):
n = 2
key, _, *img = data
key = np.array([int(v == "#") for v in key])
img = np.array([[int(v == "#") for v in line] for line in... | [
"numpy.array",
"scipy.ndimage.convolve"
] | [((386, 436), 'numpy.array', 'np.array', (['[[1, 2, 4], [8, 16, 32], [64, 128, 256]]'], {}), '([[1, 2, 4], [8, 16, 32], [64, 128, 256]])\n', (394, 436), True, 'import numpy as np\n'), ((766, 816), 'numpy.array', 'np.array', (['[[1, 2, 4], [8, 16, 32], [64, 128, 256]]'], {}), '([[1, 2, 4], [8, 16, 32], [64, 128, 256]])\... |
import numpy as np
def isrowvector(m):
"""Check if the array has only one dimension
f = isrowvector(m)
function f = isrowvector(m)
<m> is a matrix
return whether <m> is 1 x n where n >= 0.
specifically:
f = isvector(m) & size(m,1)==1;
example:
isrowvector([[1,2]])
isrowvec... | [
"numpy.asarray"
] | [((443, 456), 'numpy.asarray', 'np.asarray', (['m'], {}), '(m)\n', (453, 456), True, 'import numpy as np\n')] |
#!/usr/bin/env python3
import numpy as np
x12 = np.array([95.25, 94.00, 95.50, 94.50])
x34 = np.array([230.00, 230.00, 230.26, 228.75, 229.75])
def sab(arr, mw):
return np.sqrt((np.sum((arr - mw)**2))/(arr.size - 1))
x12mw = np.mean(x12)
x12ab = sab(x12, x12mw)
x34mw = np.mean(x34)
x34ab = sab(x34, x34mw)
print("... | [
"numpy.mean",
"numpy.array",
"numpy.sum"
] | [((50, 85), 'numpy.array', 'np.array', (['[95.25, 94.0, 95.5, 94.5]'], {}), '([95.25, 94.0, 95.5, 94.5])\n', (58, 85), True, 'import numpy as np\n'), ((95, 143), 'numpy.array', 'np.array', (['[230.0, 230.0, 230.26, 228.75, 229.75]'], {}), '([230.0, 230.0, 230.26, 228.75, 229.75])\n', (103, 143), True, 'import numpy as ... |
#!/usr/bin/env python
# coding: utf-8
# In[3]:
# Import libraries
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
# In[4]:
# Load input image in grayscale
img = cv.imread('hitchcock.png', 0)
kernel = np.ones((3,3), np.uint8)
# Functions
imgEroded = cv.erode(img, kernel)
imgDilate = cv.dila... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"cv2.dilate",
"cv2.morphologyEx",
"matplotlib.pyplot.imshow",
"numpy.ones",
"cv2.imread",
"matplotlib.pyplot.figure",
"cv2.erode"
] | [((188, 217), 'cv2.imread', 'cv.imread', (['"""hitchcock.png"""', '(0)'], {}), "('hitchcock.png', 0)\n", (197, 217), True, 'import cv2 as cv\n'), ((227, 252), 'numpy.ones', 'np.ones', (['(3, 3)', 'np.uint8'], {}), '((3, 3), np.uint8)\n', (234, 252), True, 'import numpy as np\n'), ((279, 300), 'cv2.erode', 'cv.erode', (... |
"""SequenceDataset class."""
from typing import Callable, Tuple
import warnings
import numpy as np
import tensorflow as tf
from ..util import relative_shuffle
class SequenceDataset(tf.keras.utils.Sequence):
"""Custom Sequence class used to feed data into model.fit.
Args:
x_list: List of inputs.
... | [
"warnings.warn",
"numpy.expand_dims"
] | [((1162, 1282), 'warnings.warn', 'warnings.warn', (['"""Batch size larger than dataset, setting batch size to match length of dataset"""', 'RuntimeWarning'], {}), "(\n 'Batch size larger than dataset, setting batch size to match length of dataset'\n , RuntimeWarning)\n", (1175, 1282), False, 'import warnings\n'),... |
import os
import torch
from torch import nn
import numpy as np
import torch.nn.functional as F
class InterpretTransformer(object):
def __init__(self, model):
self.model = model
self.model.eval()
def transition_attention_maps(self, input, index=None, start_layer=4, steps=20, with_integral=... | [
"torch.eye",
"numpy.arange",
"numpy.linspace",
"torch.zeros",
"torch.tensor",
"torch.from_numpy"
] | [((1384, 1408), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'steps'], {}), '(0, 1, steps)\n', (1395, 1408), True, 'import numpy as np\n'), ((606, 618), 'numpy.arange', 'np.arange', (['b'], {}), '(b)\n', (615, 618), True, 'import numpy as np\n'), ((682, 707), 'torch.from_numpy', 'torch.from_numpy', (['one_hot'], {}... |
from sklearn.datasets import load_digits
import numpy as np
from numpy import linalg as linalg
import math
import matplotlib.pyplot as plt
def hw1p3c(train_data, train_target, test_data, test_target, plot_gate):
# digits = load_digits()
# d_data = digits.data
# d_target = digits.target
#
# divider... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"numpy.sum",
"numpy.argmax",
"matplotlib.pyplot.legend",
"numpy.zeros",
"numpy.transpose",
"numpy.linalg.eig",
"numpy.mean",
"numpy.linalg.norm",
"numpy.linalg.det",
"numpy.linalg.inv",
"numpy.dot",
"math.log",
"numpy.linalg.pinv",
... | [((746, 764), 'numpy.sum', 'np.sum', (['classes', '(1)'], {}), '(classes, 1)\n', (752, 764), True, 'import numpy as np\n'), ((846, 864), 'numpy.zeros', 'np.zeros', (['(10, 64)'], {}), '((10, 64))\n', (854, 864), True, 'import numpy as np\n'), ((995, 1014), 'numpy.mean', 'np.mean', (['x_train', '(0)'], {}), '(x_train, 0... |
'''
Copyright (c) 2018 by <NAME>
This file is part of Statistical Parameter Optimization Tool for Python(SPOTPY).
:author: <NAME>
'''
from . import _algorithm
import numpy as np
class mle(_algorithm):
"""
This class holds the Maximum Likelihood (MLE) algorithm,
based on a simple uphill method as presente... | [
"numpy.random.normal"
] | [((3666, 3712), 'numpy.random.normal', 'np.random.normal', ([], {'loc': 'old_par', 'scale': 'stepsizes'}), '(loc=old_par, scale=stepsizes)\n', (3682, 3712), True, 'import numpy as np\n')] |
################################################################################
#
# test_wham.py - testing the pyfeat wham class
#
# author: <NAME> <ch<EMAIL>h.wehmeyer@fu-berlin.de>
# author: <NAME> <<EMAIL>>
#
################################################################################
from nose.tools imp... | [
"numpy.ones"
] | [((551, 590), 'numpy.ones', 'np.ones', ([], {'shape': '(2, 3, 3)', 'dtype': 'np.intc'}), '(shape=(2, 3, 3), dtype=np.intc)\n', (558, 590), True, 'import numpy as np\n'), ((674, 713), 'numpy.ones', 'np.ones', ([], {'shape': '(2, 3, 3)', 'dtype': 'np.intc'}), '(shape=(2, 3, 3), dtype=np.intc)\n', (681, 713), True, 'impor... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import edward as ed
import numpy as np
import tensorflow as tf
from edward.models import Bernoulli, Categorical, Mixture, Normal
class test_copy_class(tf.test.TestCase):
def test_scope(self):
with sel... | [
"tensorflow.train.Coordinator",
"tensorflow.variables_initializer",
"tensorflow.Variable",
"edward.set_seed",
"tensorflow.train.batch",
"edward.random_variables",
"tensorflow.test.main",
"edward.copy",
"tensorflow.abs",
"tensorflow.train.start_queue_runners",
"tensorflow.placeholder",
"tensorf... | [((6928, 6942), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (6940, 6942), True, 'import tensorflow as tf\n'), ((348, 364), 'tensorflow.constant', 'tf.constant', (['(2.0)'], {}), '(2.0)\n', (359, 364), True, 'import tensorflow as tf\n'), ((379, 408), 'edward.copy', 'ed.copy', (['x'], {'scope': '"""new_scop... |
from __future__ import print_function, division
# Standard
#from itertools import izip
#from ctypes.util import find_library
from os.path import realpath, dirname
import ctypes_interface
import ctypes as C
import collections
# Scientific
import numpy as np
# Hotspotter
from hscom import __common__
print, print_, print_... | [
"numpy.ctypeslib.ndpointer",
"ctypes_interface.load_clib",
"numpy.empty",
"os.path.dirname",
"os.path.realpath",
"ellipse.adaptive_scale",
"numpy.ascontiguousarray",
"hscom.__common__.init",
"numpy.sqrt"
] | [((365, 441), 'hscom.__common__.init', '__common__.init', (['__name__'], {'module_prefix': '"""[hes]"""', 'DEBUG': '(False)', 'initmpl': '(False)'}), "(__name__, module_prefix='[hes]', DEBUG=False, initmpl=False)\n", (380, 441), False, 'from hscom import __common__\n'), ((682, 746), 'numpy.ctypeslib.ndpointer', 'np.cty... |
import numpy as np
from .pointcloud_utils import *
def downsample_kitti(points, ring, verticle_switch=True, horizontal_switch=True):
if verticle_switch:
ring_remained = [33, 32, 29, 27, 25, 23, 21, 19, 16, 14, 12, 10, 8, 6, 4, 2]
points = points[np.in1d(ring,ring_remained)] # faster
if horizont... | [
"numpy.ones",
"numpy.any",
"numpy.append",
"numpy.fabs",
"numpy.arange",
"numpy.vstack",
"numpy.all",
"numpy.in1d"
] | [((913, 951), 'numpy.all', 'np.all', (['[ring > 16, ring < 26]'], {'axis': '(0)'}), '([ring > 16, ring < 26], axis=0)\n', (919, 951), True, 'import numpy as np\n'), ((408, 447), 'numpy.fabs', 'np.fabs', (['(distances[1:] - distances[:-1])'], {}), '(distances[1:] - distances[:-1])\n', (415, 447), True, 'import numpy as ... |
from __future__ import print_function
import numpy as np
from openmdao.api import ExplicitComponent
class ConvertVelocity(ExplicitComponent):
"""
Convert the freestream velocity magnitude into a velocity vector at each
evaluation point. In this case, each of the panels sees the same velocity.
This re... | [
"numpy.sin",
"numpy.array",
"numpy.cos"
] | [((1940, 1953), 'numpy.cos', 'np.cos', (['alpha'], {}), '(alpha)\n', (1946, 1953), True, 'import numpy as np\n'), ((1969, 1982), 'numpy.sin', 'np.sin', (['alpha'], {}), '(alpha)\n', (1975, 1982), True, 'import numpy as np\n'), ((2207, 2220), 'numpy.cos', 'np.cos', (['alpha'], {}), '(alpha)\n', (2213, 2220), True, 'impo... |
from sklearn.preprocessing import LabelBinarizer
import numpy as np
class CustomLabelBinarizer(LabelBinarizer):
def transform(self, y):
Y = super(CustomLabelBinarizer, self).transform(y)
if self.y_type_ == 'binary':
return np.hstack((1-Y,Y))
else:
return Y
def i... | [
"numpy.hstack"
] | [((256, 277), 'numpy.hstack', 'np.hstack', (['(1 - Y, Y)'], {}), '((1 - Y, Y))\n', (265, 277), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Functions used to generate manufacturable ply drop layouts with guide-based
blending
- format_ply_drops and format_ply_drops2
format the ply drop layouts
- ply_drops_rules
deletes the ply drop layouts that does not satisfy the ply drop guidelines
- randomly_pdl_guide
... | [
"sys.path.append",
"src.BELLA.pdl_tools.format_ply_drops2",
"numpy.copy",
"src.BELLA.pdl_tools.ply_drops_at_each_boundaries",
"numpy.allclose",
"numpy.zeros",
"numpy.argmin",
"time.time",
"src.BELLA.pdl_tools.format_ply_drops",
"src.guidelines.ply_drop_spacing.calc_penalty_spacing",
"numpy.produ... | [((956, 984), 'sys.path.append', 'sys.path.append', (['"""C:\\\\BELLA"""'], {}), "('C:\\\\BELLA')\n", (971, 984), False, 'import sys\n'), ((1826, 1853), 'numpy.array', 'np.array', (['()'], {'dtype': '"""int16"""'}), "((), dtype='int16')\n", (1834, 1853), True, 'import numpy as np\n'), ((3421, 3443), 'numpy.unique', 'np... |
import numpy as np
import CoolProp.CoolProp as CP
#import grafici_termodinamici as gt
#import grafici_termodinamici_mixture as gt
from scipy.optimize import fsolve
from mixture_impianto_senza_eiettore_sep_function_T7fix import Funz as Funz7
from mixture_impianto_senza_eiettore_sep_function import Funz
import matplotlib... | [
"matplotlib.pyplot.title",
"numpy.meshgrid",
"CoolProp.CoolProp.AbstractState",
"scipy.interpolate.griddata",
"mixture_impianto_senza_eiettore_sep_function.Funz",
"numpy.zeros",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.contour",
"matplotlib.pyplot.contourf",
"... | [((1583, 1605), 'numpy.linspace', 'np.linspace', (['(0.8)', '(1)', 'n'], {}), '(0.8, 1, n)\n', (1594, 1605), True, 'import numpy as np\n'), ((1609, 1632), 'numpy.linspace', 'np.linspace', (['(70)', '(110)', 'm'], {}), '(70, 110, m)\n', (1620, 1632), True, 'import numpy as np\n'), ((1663, 1679), 'numpy.zeros', 'np.zeros... |
import os
import errno
import logging
from sklearn.metrics import accuracy_score
import numpy as np
from eval.utils.metrics import macroavg_prec, macroavg_f1, macroavg_rec, microavg_prec, microavg_rec, microavg_f1
def unit(x):
return x
def noop(*args, **kwargs):
pass
def one(*args, **kwargs):
return... | [
"numpy.count_nonzero",
"numpy.empty",
"numpy.arange",
"numpy.log"
] | [((1699, 1719), 'numpy.empty', 'np.empty', (['X.shape[1]'], {}), '(X.shape[1])\n', (1707, 1719), True, 'import numpy as np\n'), ((1820, 1841), 'numpy.arange', 'np.arange', (['X.shape[1]'], {}), '(X.shape[1])\n', (1829, 1841), True, 'import numpy as np\n'), ((1962, 1995), 'numpy.count_nonzero', 'np.count_nonzero', (['al... |
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import pyrealsense2 as rs
import json
import cv2
import os
import sys
from queue import Queue
from collections import deque
from copy import deepcopy
import threading
import struct
from dependencies.display_util.string_display_util import *
from depe... | [
"copy.deepcopy",
"numpy.set_printoptions",
"pyrealsense2.config.enable_device_from_file",
"cv2.VideoWriter_fourcc",
"pyrealsense2.pipeline",
"matplotlib.pyplot.close",
"matplotlib.pyplot.subplots",
"pyrealsense2.config",
"pyrealsense2.context",
"labview_recorder.distribution.compute_depth_bytes",
... | [((463, 487), 'matplotlib.use', 'matplotlib.use', (['"""Qt5agg"""'], {}), "('Qt5agg')\n", (477, 487), False, 'import matplotlib\n'), ((488, 525), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (507, 525), True, 'import numpy as np\n'), ((674, 681), 'collections.d... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import graphgallery as gg
from graphgallery import functional as gf
from graphgallery.utils import tqdm
from graphgallery.attack.untargeted import PyTorch
from graphgallery.attack.untargeted.untargeted_attacker import UntargetedAttac... | [
"torch.eye",
"torch.autograd.grad",
"torch.arange",
"graphgallery.functional.astensor",
"graphgallery.functional.normalize_adj_tensor",
"torch.triu",
"torch.nn.functional.log_softmax",
"torch.zeros_like",
"torch.where",
"numpy.hstack",
"torch.clamp",
"torch.ones_like",
"torch.stack",
"torc... | [((327, 345), 'graphgallery.attack.untargeted.PyTorch.register', 'PyTorch.register', ([], {}), '()\n', (343, 345), False, 'from graphgallery.attack.untargeted import PyTorch\n'), ((1250, 1306), 'graphgallery.functional.astensor', 'gf.astensor', (['self.graph.adj_matrix.A'], {'device': 'self.device'}), '(self.graph.adj_... |
# flowProfile.py
"""
Notes
"""
# import modules
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.image import NonUniformImage
from math import ceil
def generate_flowProfile(testSetup, flowType='pdf', z_resolution=10, y_mod=1.1, z_mod=5,
Umax_pdf=0, slip_near=0, slip_far=0, E... | [
"matplotlib.pyplot.title",
"numpy.abs",
"numpy.shape",
"numpy.mean",
"numpy.exp",
"matplotlib.pyplot.tight_layout",
"numpy.zeros_like",
"numpy.meshgrid",
"numpy.transpose",
"numpy.max",
"matplotlib.pyplot.savefigure",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show",
"numpy.ones_like... | [((1424, 1440), 'numpy.zeros_like', 'np.zeros_like', (['z'], {}), '(z)\n', (1437, 1440), True, 'import numpy as np\n'), ((1457, 1473), 'numpy.zeros_like', 'np.zeros_like', (['z'], {}), '(z)\n', (1470, 1473), True, 'import numpy as np\n'), ((1489, 1505), 'numpy.zeros_like', 'np.zeros_like', (['y'], {}), '(y)\n', (1502, ... |
# !/usr/bin/env python3
# -*- coding:utf-8 -*-
__author__ = '<NAME>'
__date__ = '2018/11/5 15:25'
import copy
import math
import numpy as np
from scipy.stats import f
from scipy.stats import t
class MultipleLinearRegression(object):
def __init__(self):
self.__sample_num = 0
self.__... | [
"scipy.stats.t.isf",
"numpy.ones",
"numpy.loadtxt",
"numpy.diag",
"scipy.stats.f.isf",
"numpy.mat",
"numpy.delete",
"numpy.sqrt"
] | [((706, 727), 'numpy.loadtxt', 'np.loadtxt', (['file_name'], {}), '(file_name)\n', (716, 727), True, 'import numpy as np\n'), ((801, 824), 'numpy.mat', 'np.mat', (['tmp_data[:, 1:]'], {}), '(tmp_data[:, 1:])\n', (807, 824), True, 'import numpy as np\n'), ((2026, 2074), 'numpy.delete', 'np.delete', (['self.__design_mat'... |
import logging
import os
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from mspypeline.core import MSPInitializer
from mspypeline.core.MSPPlots import BasePlotter
from mspypeline.plotting_backend import matplotlib_plots
class MQReade... | [
"matplotlib.pyplot.subplot",
"os.path.join",
"matplotlib.cm.get_cmap",
"numpy.ndenumerate",
"matplotlib.pyplot.close",
"numpy.log2",
"numpy.nanmin",
"matplotlib.pyplot.figure",
"numpy.linspace",
"mspypeline.plotting_backend.matplotlib_plots.save_intensity_histogram_results",
"os.path.split",
"... | [((5178, 5196), 'matplotlib.cm.get_cmap', 'cm.get_cmap', (['"""jet"""'], {}), "('jet')\n", (5189, 5196), True, 'import matplotlib.cm as cm\n'), ((3654, 3681), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(14, 7)'}), '(figsize=(14, 7))\n', (3664, 3681), True, 'from matplotlib import pyplot as plt\n'), ((4... |
#!/usr/bin/env python
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Object crash with prior vehicle action scenario:
The scenario realizes the user controlled ego vehicle
moving along the road and encounters a cyclist ahead after taking a rig... | [
"os.remove",
"pickle.dump",
"srunner.scenariomanager.carla_data_provider.CarlaDataProvider.request_new_actor",
"srunner.scenariomanager.scenarioatomics.atomic_criteria.CollisionTest",
"os.path.exists",
"customized_utils.make_hierarchical_dir",
"leaderboard.utils.route_manipulation.interpolate_trajectory... | [((2554, 2581), 'srunner.scenariomanager.carla_data_provider.CarlaDataProvider.get_map', 'CarlaDataProvider.get_map', ([], {}), '()\n', (2579, 2581), False, 'from srunner.scenariomanager.carla_data_provider import CarlaDataProvider\n'), ((3077, 3118), 'srunner.scenariomanager.carla_data_provider.CarlaDataProvider.get_e... |
#!/usr/bin/env python
# In case of poor (Sh***y) commenting contact <EMAIL>
# Basic
from os import path
# Testing
import time
import numpy as np
import yaml
import h5py
# import pickle as pickle
from scipy import sparse
# from FP_initial_conditions import *
# from math import *
# Speed
# from numba import jit
# Other i... | [
"numpy.zeros",
"time.time",
"scipy.sparse.csc_matrix",
"yaml.safe_load",
"numpy.linspace"
] | [((3749, 3808), 'numpy.linspace', 'np.linspace', (['(0)', '(ds * (self.ns1 - 1))', 'self.ns1'], {'retstep': '(True)'}), '(0, ds * (self.ns1 - 1), self.ns1, retstep=True)\n', (3760, 3808), True, 'import numpy as np\n'), ((3874, 3933), 'numpy.linspace', 'np.linspace', (['(0)', '(ds * (self.ns2 - 1))', 'self.ns2'], {'rets... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 26 19:46:14 2019
@author: Nate
"""
import numpy as np
import matplotlib.pyplot as plt
import pdb
'''
Determine the value of π to ≈ 14 digits by solving for the root of the equation
f(x) = cos(x) = 0
using the second order Newton’s method. The exact solution is
... | [
"numpy.sin",
"numpy.cos"
] | [((571, 584), 'numpy.cos', 'np.cos', (['guess'], {}), '(guess)\n', (577, 584), True, 'import numpy as np\n'), ((614, 627), 'numpy.sin', 'np.sin', (['guess'], {}), '(guess)\n', (620, 627), True, 'import numpy as np\n')] |
import time
import numpy as np
from column_01 import Column
from pump_01 import Pump
from sample_01 import Sample
from interaction_01 import Interaction
from calculation_current import Simu
import os
print(os.listdir())
if 'functions_with_D' in os.listdir():
from functions_with_D import Functions
else:
from C... | [
"interaction_01.Interaction",
"pump_01.Pump",
"numpy.ones",
"time.time",
"numpy.product",
"numpy.array",
"numpy.linspace",
"column_01.Column",
"os.listdir"
] | [((208, 220), 'os.listdir', 'os.listdir', ([], {}), '()\n', (218, 220), False, 'import os\n'), ((247, 259), 'os.listdir', 'os.listdir', ([], {}), '()\n', (257, 259), False, 'import os\n'), ((1285, 1296), 'time.time', 'time.time', ([], {}), '()\n', (1294, 1296), False, 'import time\n'), ((1570, 1577), 'pump_01.Pump', 'P... |
try:
from ulab import numpy as np
except:
import numpy as np
dtypes = (np.uint8, np.int8, np.uint16, np.int16)
a = np.array(range(8)).reshape((2, 4))
np.savetxt('loadtxt.dat', a, header='test file data')
print(np.loadtxt('loadtxt.dat'))
print()
for dtype in dtypes:
print(np.loadtxt('loadtxt.dat', dtype=... | [
"numpy.savetxt",
"numpy.loadtxt"
] | [((160, 213), 'numpy.savetxt', 'np.savetxt', (['"""loadtxt.dat"""', 'a'], {'header': '"""test file data"""'}), "('loadtxt.dat', a, header='test file data')\n", (170, 213), True, 'import numpy as np\n'), ((341, 409), 'numpy.savetxt', 'np.savetxt', (['"""loadtxt.dat"""', 'a'], {'delimiter': '""","""', 'header': '"""test ... |
import json
import math
from collections import defaultdict, Counter
import linecache
import numpy as np
from sklearn.preprocessing import MinMaxScaler
import jieba
from cfg import *
from index import Index, Document
import logging
jieba.setLogLevel(logging.INFO)
class Bm25:
def __init__(self, k1=2, k2=1, b=0.5):... | [
"index.Index",
"json.load",
"linecache.getline",
"math.pow",
"jieba.setLogLevel",
"sklearn.preprocessing.MinMaxScaler",
"collections.defaultdict",
"numpy.array",
"jieba.lcut",
"collections.Counter",
"math.log"
] | [((233, 264), 'jieba.setLogLevel', 'jieba.setLogLevel', (['logging.INFO'], {}), '(logging.INFO)\n', (250, 264), False, 'import jieba\n'), ((441, 481), 'math.log', 'math.log', (['((N - df + 0.5) / (df + 0.5))', '(2)'], {}), '((N - df + 0.5) / (df + 0.5), 2)\n', (449, 481), False, 'import math\n'), ((711, 736), 'collecti... |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.lines import Line2D
from matplotlib.collections import LineCollection
from matplotlib.colors import ListedColormap, BoundaryNorm
from vis.colorline import colorline
import matplotlib.path as mpath
import os
from vis.plot_rl_figures import plot_from_file... | [
"vis.plot_rl_figures.plot_from_file",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.std",
"numpy.mean",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.fill_between",
"matplotlib.pyplot.xlabel",
"os.listdir",
"matplotlib.pyplot.savefig"
] | [((402, 458), 'vis.plot_rl_figures.plot_from_file', 'plot_from_file', (['filename'], {'reduce_plot_data': '(1)', 'stepsize': '(1)'}), '(filename, reduce_plot_data=1, stepsize=1)\n', (416, 458), False, 'from vis.plot_rl_figures import plot_from_file\n'), ((715, 736), 'os.listdir', 'os.listdir', (['directory'], {}), '(di... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 16 09:27:20 2021
@author: <NAME>
"""
import json
import multiprocessing
import pathlib
import numpy as np
import pandas as pd
import plottery
class Hero():
"""Baseclass for characters from the rpg `Das Shwarze Auge` (DSA).
This class is motivated by the need... | [
"pandas.DataFrame",
"json.dump",
"json.load",
"numpy.argmax",
"numpy.argmin",
"pathlib.Path",
"numpy.random.randint",
"numpy.array",
"pathlib.Path.cwd",
"numpy.round",
"multiprocessing.Process"
] | [((8704, 8722), 'pathlib.Path.cwd', 'pathlib.Path.cwd', ([], {}), '()\n', (8720, 8722), False, 'import pathlib\n'), ((12286, 12313), 'numpy.random.randint', 'np.random.randint', (['(1)', '(21)', '(3)'], {}), '(1, 21, 3)\n', (12303, 12313), True, 'import numpy as np\n'), ((16335, 16421), 'multiprocessing.Process', 'mult... |
""""
This script contains a set metrics used for evaluating the performance
of the models trained for the task of Singing Language Identification.
"""
import os
from itertools import product, cycle
import numpy as np
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from sklearn.metrics impor... | [
"sklearn.metrics.confusion_matrix",
"sklearn.metrics.average_precision_score",
"os.makedirs",
"os.path.join",
"os.path.isdir",
"sklearn.metrics.precision_recall_curve",
"numpy.min",
"matplotlib.use",
"numpy.array",
"numpy.max",
"numpy.linspace",
"itertools.cycle",
"matplotlib.pyplot.subplots... | [((238, 259), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (252, 259), False, 'import matplotlib\n'), ((544, 868), 'itertools.cycle', 'cycle', (["['aqua', 'xkcd:azure', 'beige', 'black', 'blue', 'chartreuse', 'chocolate',\n 'coral', 'xkcd:crimson', 'grey', 'darkblue', 'xkcd:fuchsia', 'gold',... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn import metrics
y_label = np.random.randint(0, 2, (100,))
y_pred = np.random.randint(0, 2, (100,))
precision_vs_recall = metrics.precision_recall_curve(y_label, y_pred)
metrics.accuracy_score()
print(precision_vs_recall) | [
"sklearn.metrics.precision_recall_curve",
"sklearn.metrics.accuracy_score",
"numpy.random.randint"
] | [((91, 122), 'numpy.random.randint', 'np.random.randint', (['(0)', '(2)', '(100,)'], {}), '(0, 2, (100,))\n', (108, 122), True, 'import numpy as np\n'), ((132, 163), 'numpy.random.randint', 'np.random.randint', (['(0)', '(2)', '(100,)'], {}), '(0, 2, (100,))\n', (149, 163), True, 'import numpy as np\n'), ((187, 234), '... |
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 5 15:52:15 2021
Objective: Memory optimisation and preprocessing handy features
Reference: https://www.kaggle.com/shravankoninti/python-data-pre-processing-handy-tips
@author: Ashish
"""
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplo... | [
"matplotlib.pyplot.show",
"pandas.read_csv",
"numpy.percentile",
"seaborn.boxplot",
"matplotlib.pyplot.subplots"
] | [((347, 396), 'pandas.read_csv', 'pd.read_csv', (['"""../../data/kaggle_pimadiabetes.csv"""'], {}), "('../../data/kaggle_pimadiabetes.csv')\n", (358, 396), True, 'import pandas as pd\n'), ((707, 721), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (719, 721), True, 'import matplotlib.pyplot as plt\n'),... |
import scipy.io as scio
import numpy as np
from utils import channel_position
CHANNELS = ['Fz', 'FC3', 'FC1', 'FCz', 'FC2', 'FC4', 'C5', 'C3', 'C1', 'Cz', 'C2', 'C4', 'C6', 'CP3', 'CP1', 'CPz',
'CP2', 'CP4', 'P1', 'Pz', 'P2', 'POz']
INTERSECTION = ['Fz', 'FC3', 'FC1', 'FC2', 'FC4', 'C5', 'C3', 'C1', 'Cz'... | [
"utils.channel_position",
"numpy.delete",
"numpy.vstack"
] | [((1422, 1462), 'utils.channel_position', 'channel_position', (['CHANNELS', 'INTERSECTION'], {}), '(CHANNELS, INTERSECTION)\n', (1438, 1462), False, 'from utils import channel_position\n'), ((1631, 1656), 'numpy.delete', 'np.delete', (['train[0]', '(0)', '(3)'], {}), '(train[0], 0, 3)\n', (1640, 1656), True, 'import nu... |
import sklearn
if sklearn.__version__.startswith('0.18'):
from sklearn.pipeline import _BasePipeline as bp
else:
from sklearn.utils.metaestimators import _BaseComposition as bp
import numpy as np
class XcessivStackedEnsemble(bp):
"""Contains the class for the Xcessiv stacked ensemble"""
def __init__(s... | [
"sklearn.__version__.startswith",
"numpy.concatenate"
] | [((18, 56), 'sklearn.__version__.startswith', 'sklearn.__version__.startswith', (['"""0.18"""'], {}), "('0.18')\n", (48, 56), False, 'import sklearn\n'), ((2506, 2555), 'numpy.concatenate', 'np.concatenate', (['all_learner_meta_features'], {'axis': '(1)'}), '(all_learner_meta_features, axis=1)\n', (2520, 2555), True, '... |
import os
import cv2
import mmcv
import numpy as np
import torch
from mmpose.apis import (inference, inference_top_down_pose_model, init_pose_model,
vis_pose_result)
import PIL
from PIL import Image
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
model = init_pose_m... | [
"numpy.asarray",
"numpy.transpose",
"numpy.expand_dims",
"PIL.Image.open",
"mmpose.apis.inference_top_down_pose_model",
"torch.cuda.is_available",
"mmpose.apis.init_pose_model",
"torch.from_numpy"
] | [((309, 402), 'mmpose.apis.init_pose_model', 'init_pose_model', ([], {'config': '"""train_head_resnet.py"""', 'checkpoint': '"""epoch_210.pth"""', 'device': 'device'}), "(config='train_head_resnet.py', checkpoint='epoch_210.pth',\n device=device)\n", (324, 402), False, 'from mmpose.apis import inference, inference_t... |
import numpy as np
from nengo import *
from nengo_spa import *
from utils import *
D = 16 # Number of dimensions for each ensemble.
N = 64 # Number of neurons per dimension.
CLOCK_PERIOD = 0.25 # How many seconds a full clock cycle takes.
SIM_TIME = 20 # How long to run the simulation.
... | [
"numpy.ones",
"numpy.random.RandomState"
] | [((455, 482), 'numpy.random.RandomState', 'np.random.RandomState', (['SEED'], {}), '(SEED)\n', (476, 482), True, 'import numpy as np\n'), ((4463, 4492), 'numpy.ones', 'np.ones', (['(error.n_neurons, 1)'], {}), '((error.n_neurons, 1))\n', (4470, 4492), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
# @Date : 2020/7/20
# @Author : mingming.xu
# @Email : <EMAIL>
# @File : preprocess.py
import numpy as np
import tensorflow as tf
from toolkit4nlp.backend import K
class TrainingDataset(object):
def __init__(self, tokenizer, seq_length):
"""
:param tokenizer: toke... | [
"tensorflow.train.Int64List",
"numpy.random.randint",
"toolkit4nlp.tokenizers.Tokenizer",
"tensorflow.train.FloatList",
"glob.glob",
"toolkit4nlp.backend.K.floatx",
"jieba_fast.initialize",
"tensorflow.train.Example",
"re.findall",
"toolkit4nlp.backend.K.zeros_like",
"tensorflow.train.BytesList"... | [((8910, 8928), 'jieba_fast.initialize', 'jieba.initialize', ([], {}), '()\n', (8926, 8928), True, 'import jieba_fast as jieba\n'), ((9024, 9060), 'toolkit4nlp.tokenizers.Tokenizer', 'Tokenizer', (['vocab'], {'do_lower_case': '(True)'}), '(vocab, do_lower_case=True)\n', (9033, 9060), False, 'from toolkit4nlp.tokenizers... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.