code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import numpy as np import random def random_chunk(d, sample_len): l = d.shape[1] if l > sample_len: rd_idx = random.sample(range(l-sample_len),1)[0] sample = d[:,rd_idx:(rd_idx+sample_len)] else: sample = d return sample[np.newaxis,:] def split_data(data, window, hop): se...
[ "numpy.load", "random.randint", "numpy.split", "numpy.hstack", "numpy.append", "numpy.array", "numpy.vstack" ]
[((635, 647), 'numpy.vstack', 'np.vstack', (['a'], {}), '(a)\n', (644, 647), True, 'import numpy as np\n'), ((1108, 1123), 'numpy.vstack', 'np.vstack', (['data'], {}), '(data)\n', (1117, 1123), True, 'import numpy as np\n'), ((1137, 1154), 'numpy.hstack', 'np.hstack', (['labels'], {}), '(labels)\n', (1146, 1154), True,...
#graphics.py -- plotting functions for CamIO #(c) <NAME>, Smith-Kettlewell Eye Research Institute import numpy as np import cv2 from utilities import dict2list import pygame points_for_plotting_xyz_axes = np.array(((0.,0.,0.), (1.,0.,0.), (0.,1.,0.), (0.,0.,1.))) #p0, px, py, pz for plotting xyz axes XYZ_AXES_LENGTH ...
[ "cv2.line", "pygame.transform.flip", "cv2.circle", "utilities.dict2list", "cv2.cvtColor", "cv2.projectPoints", "numpy.shape", "pygame.display.update", "numpy.rot90", "numpy.array", "pygame.surfarray.make_surface", "numpy.squeeze", "numpy.round" ]
[((207, 285), 'numpy.array', 'np.array', (['((0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0))'], {}), '(((0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0)))\n', (215, 285), True, 'import numpy as np\n'), ((602, 694), 'cv2.projectPoints', 'cv2.projectPoints', (['(points_for_plotting_x...
import numpy as np import utils from scipy.ndimage import gaussian_filter1d from detection import rnn_detection as rnndet def monotransit_detection(pts, conf=None, peak_thresh=0.5, agg_fn=np.multiply, score_fn=np.max, smooth=True): # assuming uniform time time = np.arange(len(pts)) * utils.min2day(2) conf...
[ "detection.rnn_detection.get_tc", "numpy.ones_like", "utils.min2day", "detection.rnn_detection.get_peaks" ]
[((614, 651), 'detection.rnn_detection.get_peaks', 'rnndet.get_peaks', (['(pts_ >= peak_thresh)'], {}), '(pts_ >= peak_thresh)\n', (630, 651), True, 'from detection import rnn_detection as rnndet\n'), ((791, 825), 'detection.rnn_detection.get_tc', 'rnndet.get_tc', (['time', 'tr_indc', 'pts_'], {}), '(time, tr_indc, pts...
# coding=utf-8 import numpy as np import scipy.stats import logging from pines.metrics import list_to_discrete_rv from pines.trees import BinaryDecisionTree, BinaryDecisionTreeSplit from multiprocessing import Pool from pines.utils import split_dataset, compute_split_info, compute_split_gain, SplitCriterion class...
[ "pines.utils.SplitCriterion.resolve_split_criterion", "numpy.copy", "numpy.percentile", "numpy.mean", "pines.metrics.list_to_discrete_rv", "pines.utils.compute_split_gain", "multiprocessing.Pool", "pines.trees.BinaryDecisionTree", "logging.getLogger", "pines.utils.split_dataset" ]
[((1844, 1880), 'logging.getLogger', 'logging.getLogger', (['"""TreeBuilderCART"""'], {}), "('TreeBuilderCART')\n", (1861, 1880), False, 'import logging\n'), ((9602, 9643), 'logging.getLogger', 'logging.getLogger', (['"""TreeBuilderOblivious"""'], {}), "('TreeBuilderOblivious')\n", (9619, 9643), False, 'import logging\...
import tkinter as tk import numpy as np import math __author__ = "<NAME>" __copyright__ = "Copyright 2020" class ScaleTransCanvas(tk.Canvas): """A canvas that can be scaled and translated. Parameters ---------- widget The parent widget. scale_factor : float, optional Scale facto...
[ "numpy.copy", "math.tan", "numpy.asarray", "math.sin", "numpy.sin", "numpy.array", "math.cos", "numpy.cos", "numpy.dot" ]
[((6524, 6551), 'numpy.array', 'np.array', (['((c, -s), (s, c))'], {}), '(((c, -s), (s, c)))\n', (6532, 6551), True, 'import numpy as np\n'), ((6583, 6601), 'numpy.asarray', 'np.asarray', (['[x, y]'], {}), '([x, y])\n', (6593, 6601), True, 'import numpy as np\n'), ((7391, 7425), 'numpy.asarray', 'np.asarray', (['[x, y]...
# Copyright (c) 2020 Graphcore Ltd. All rights reserved. import numpy as np import os import popart import pytest import tempfile from tempfile import TemporaryDirectory from contextlib import contextmanager from pathlib import Path # Context manager changes directory and changes back when context exits. @contextmana...
[ "popart.DeviceManager", "os.mkdir", "popart.Adam", "popart.Builder", "numpy.allclose", "numpy.ones", "popart.AnchorReturnType", "pathlib.Path", "pytest.mark.parametrize", "os.path.join", "os.chdir", "numpy.prod", "popart.reservedAccl1Prefix", "tempfile.TemporaryDirectory", "numpy.random....
[((7993, 8049), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""optimizerInfo"""', 'optimizerInfos'], {}), "('optimizerInfo', optimizerInfos)\n", (8016, 8049), False, 'import pytest\n'), ((668, 684), 'popart.Builder', 'popart.Builder', ([], {}), '()\n', (682, 684), False, 'import popart\n'), ((1911, 1927), ...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import os import sys import random import numpy as np import matplotlib import matplotlib.pyplot as plt matplotlib.use('Qt5Agg') # matplotlib.use('Agg') from matplotlib.offsetbox import OffsetImage, AnnotationBbox import matplotlib.animation as animation class UAVsTrack(obje...
[ "numpy.stack", "matplotlib.offsetbox.OffsetImage", "matplotlib.pyplot.show", "random.randint", "random.uniform", "matplotlib.animation.FuncAnimation", "matplotlib.use", "matplotlib.pyplot.pause", "matplotlib.offsetbox.AnnotationBbox", "matplotlib.pyplot.imread", "matplotlib.pyplot.subplots" ]
[((148, 172), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (162, 172), False, 'import matplotlib\n'), ((3689, 3699), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (3697, 3699), True, 'import matplotlib.pyplot as plt\n'), ((774, 788), 'matplotlib.pyplot.subplots', 'plt.subplots',...
import logging from dataclasses import dataclass from enum import Enum from typing import Any, Callable, List, Optional import numpy as np import pytorch_lightning as pl from hydra.utils import instantiate from omegaconf import DictConfig from sklearn.model_selection import train_test_split from torch.utils.data impor...
[ "torch.utils.data.Subset", "torch.utils.data.DataLoader", "hydra.utils.instantiate", "sklearn.model_selection.train_test_split", "numpy.unique", "torchvision.transforms.Compose", "moths.config.resolve_config_path", "logging.getLogger", "moths.label_hierarchy.label_hierarchy_from_file" ]
[((618, 644), 'logging.getLogger', 'logging.getLogger', (['"""MOTHS"""'], {}), "('MOTHS')\n", (635, 644), False, 'import logging\n'), ((1240, 1271), 'torchvision.transforms.Compose', 'Compose', (['train_tfs_instantiated'], {}), '(train_tfs_instantiated)\n', (1247, 1271), False, 'from torchvision.transforms import Compo...
import numpy as np import numpy.random as npr from tqdm import tqdm from trslds.models import TroSLDS from numpy import newaxis as na from trslds import utils import matplotlib.pyplot as plt from trslds import initialize as init from trslds import plotting import seaborn as sns color_names = ["windows blue", "leaf gree...
[ "numpy.random.seed", "matplotlib.pyplot.figure", "numpy.random.randint", "numpy.sin", "trslds.plotting.rot_contour_plt", "seaborn.xkcd_palette", "trslds.utils.create_balanced_binary_tree", "trslds.models.TroSLDS", "numpy.cos", "trslds.initialize.initialize", "trslds.plotting.gradient_cmap", "t...
[((354, 383), 'seaborn.xkcd_palette', 'sns.xkcd_palette', (['color_names'], {}), '(color_names)\n', (370, 383), True, 'import seaborn as sns\n'), ((384, 395), 'numpy.random.seed', 'npr.seed', (['(0)'], {}), '(0)\n', (392, 395), True, 'import numpy.random as npr\n'), ((4619, 4647), 'matplotlib.pyplot.figure', 'plt.figur...
#!/usr/bin/python3 import numpy as np def almost_meeting_lines(a1, b1, a2, b2): A=np.array([[-a1,1],[-a2,1]]) b=np.array([b1,b2]) try: sol = np.linalg.solve(A, b) except: m, c = np.linalg.lstsq(A, b, rcond=None)[0] return (m,c),False else: return sol, True def ma...
[ "numpy.linalg.solve", "numpy.array", "numpy.linalg.lstsq" ]
[((88, 118), 'numpy.array', 'np.array', (['[[-a1, 1], [-a2, 1]]'], {}), '([[-a1, 1], [-a2, 1]])\n', (96, 118), True, 'import numpy as np\n'), ((122, 140), 'numpy.array', 'np.array', (['[b1, b2]'], {}), '([b1, b2])\n', (130, 140), True, 'import numpy as np\n'), ((163, 184), 'numpy.linalg.solve', 'np.linalg.solve', (['A'...
from math import cos,sin,radians,pi import numpy as np from matplotlib import pyplot as plt class Segment(object): def __init__(self, length=1, mplength=0.1, mpwidth=0.04): self.length = length self.q = np.array([0, 0, 0]) ll,ww,n = 0.5*mplength, 0.5*mpwidth, 4 self._rm0 = [0.7*length,0] + n...
[ "numpy.random.randn", "numpy.ones", "math.sin", "numpy.array", "math.cos", "matplotlib.pyplot.gca" ]
[((219, 238), 'numpy.array', 'np.array', (['[0, 0, 0]'], {}), '([0, 0, 0])\n', (227, 238), True, 'import numpy as np\n'), ((760, 804), 'numpy.array', 'np.array', (['[[c, -s, x], [s, c, y], [0, 0, 1]]'], {}), '([[c, -s, x], [s, c, y], [0, 0, 1]])\n', (768, 804), True, 'import numpy as np\n'), ((319, 373), 'numpy.array',...
import time import json import os from src.utils import * from src.notify import send_message import numpy as np from PIL import Image import nxbt TURTWIG = 0 CHIMCHAR = 1 PIPLUP = 2 def detect_shiny_starter(img_fn, timeout=17, framerate=30, timing_threshold=11.55): hp_bar_time = time.time() timeout_start...
[ "json.dump", "json.load", "src.notify.send_message", "PIL.Image.open", "time.time", "time.sleep", "os.path.isfile", "numpy.mean", "numpy.min", "nxbt.Nxbt" ]
[((291, 302), 'time.time', 'time.time', ([], {}), '()\n', (300, 302), False, 'import time\n'), ((323, 334), 'time.time', 'time.time', ([], {}), '()\n', (332, 334), False, 'import time\n'), ((1688, 1716), 'os.path.isfile', 'os.path.isfile', (['"""stats.json"""'], {}), "('stats.json')\n", (1702, 1716), False, 'import os\...
# coding: utf8 # !/usr/env/python import os import numpy as np import pytest from landlab import HexModelGrid, RasterModelGrid from terrainbento.boundary_handlers import SingleNodeBaselevelHandler _TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data") def test_hex(): """Test using a hex grid.""" ...
[ "landlab.HexModelGrid", "landlab.RasterModelGrid", "os.path.dirname", "terrainbento.boundary_handlers.SingleNodeBaselevelHandler", "pytest.raises", "os.path.join", "numpy.all" ]
[((231, 256), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (246, 256), False, 'import os\n'), ((327, 347), 'landlab.HexModelGrid', 'HexModelGrid', (['(5, 5)'], {}), '((5, 5))\n', (339, 347), False, 'from landlab import HexModelGrid, RasterModelGrid\n'), ((413, 476), 'terrainbento.boundary_h...
import traceback import logging import time import typing import random from multiprocessing import Pool from pprint import pprint import pandas as pd import numpy as np from d3m.container.dataset import Dataset from d3m.metadata.base import Metadata from dsbox.combinatorial_search.ConfigurationSpaceBaseSearch import ...
[ "traceback.print_exc", "numpy.log", "typing.NewType", "dsbox.combinatorial_search.search_utils.random_choices_without_replacement", "traceback.format_exc", "dsbox.combinatorial_search.TemplateSpaceParallelBaseSearch.TemplateSpaceParallelBaseSearch.__init__", "typing.TypeVar", "logging.getLogger" ]
[((812, 831), 'typing.TypeVar', 'typing.TypeVar', (['"""T"""'], {}), "('T')\n", (826, 831), False, 'import typing\n'), ((936, 969), 'typing.NewType', 'typing.NewType', (['"""PythonPath"""', 'str'], {}), "('PythonPath', str)\n", (950, 969), False, 'import typing\n'), ((994, 1038), 'typing.NewType', 'typing.NewType', (['...
import theano.tensor as T import lasagne from layers.masks import mask class MaskedConv2D(lasagne.layers.Conv2DLayer): """ Note: the layer does not have a non-linearity on top of it """ def __init__(self, incoming, num_filters, filter_size, mask_type, n_colors, stride=(1, 1), untie_biases=False, ...
[ "lasagne.layers.InputLayer", "theano.tensor.tensor4", "theano.function", "lasagne.init.GlorotUniform", "lasagne.init.Constant", "numpy.ones", "lasagne.layers.get_output", "layers.masks.mask" ]
[((1555, 1574), 'theano.tensor.tensor4', 'T.tensor4', (['"""filter"""'], {}), "('filter')\n", (1564, 1574), True, 'import theano.tensor as T\n'), ((1594, 1659), 'lasagne.layers.InputLayer', 'lasagne.layers.InputLayer', ([], {'input_var': 'input', 'shape': '(None, 1, 3, 3)'}), '(input_var=input, shape=(None, 1, 3, 3))\n...
from __future__ import unicode_literals import re from ufal.udpipe import Model, Pipeline, ProcessingError import pandas as pd from conllu import parse model = Model.load('G:/Softwares/urdu-udtb-ud-2.3-181115.udpipe') pipeline = Pipeline(model, 'tokenize', Pipeline.DEFAULT, Pipeline.DEFAULT, 'conllu') error = Process...
[ "sklearn.feature_extraction.text.CountVectorizer", "ufal.udpipe.Pipeline", "ufal.udpipe.Model.load", "IPython.display.Markdown", "time.time", "numpy.mean", "gensim.models.KeyedVectors.load_word2vec_format", "pyodbc.connect", "ufal.udpipe.ProcessingError" ]
[((162, 219), 'ufal.udpipe.Model.load', 'Model.load', (['"""G:/Softwares/urdu-udtb-ud-2.3-181115.udpipe"""'], {}), "('G:/Softwares/urdu-udtb-ud-2.3-181115.udpipe')\n", (172, 219), False, 'from ufal.udpipe import Model, Pipeline, ProcessingError\n'), ((231, 304), 'ufal.udpipe.Pipeline', 'Pipeline', (['model', '"""tokeni...
import chess from collections import defaultdict import numpy as np import logging import random import argparse from os import path from collections import deque logger = logging.getLogger() logging.basicConfig(level=logging.DEBUG, format="%(asctime)s: %(message)s") def parse_args(): parser ...
[ "numpy.random.seed", "argparse.ArgumentParser", "logging.basicConfig", "numpy.median", "random.shuffle", "collections.deque", "collections.defaultdict", "chess.Board", "numpy.max", "numpy.mean", "random.seed", "numpy.min", "random.random", "numpy.random.choice", "os.path.join", "loggin...
[((173, 192), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (190, 192), False, 'import logging\n'), ((193, 268), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s: %(message)s"""'}), "(level=logging.DEBUG, format='%(asctime)s: %(message)s')\n", (212, 2...
import math import ransacWrapper as rw from findEmptySpot import * from envClient import EnvClient import png import numpy as np import sys import time import os import tensorflow as tf import readCSV import normSTMImg import scipy.ndimage.filters as spf from scipy import ndimage import glob import datetime def print...
[ "sys.stdout.write", "numpy.abs", "numpy.random.random_sample", "numpy.mean", "glob.glob", "os.path.join", "normSTMImg.normImg1", "numpy.copy", "envClient.EnvClient", "numpy.max", "numpy.random.choice", "datetime.datetime.now", "ransacWrapper.RansacWrapper", "numpy.save", "numpy.min", "...
[((330, 356), 'sys.stdout.write', 'sys.stdout.write', (["(s + '\\n')"], {}), "(s + '\\n')\n", (346, 356), False, 'import sys\n'), ((644, 690), 'readCSV.readActions', 'readCSV.readActions', (["self.params['actionFile']"], {}), "(self.params['actionFile'])\n", (663, 690), False, 'import readCSV\n'), ((835, 870), 'envClie...
from tensorflow_serving.apis import predict_pb2 from tensorflow.python.framework import tensor_util import tensorflow as tf import sys sys.path.append('/home/yitao/Documents/fun-project/tensorflow-related/tf-pose-estimation/') from tf_pose.estimator import PoseEstimator import cv2 import pickle import numpy as np cl...
[ "sys.path.append", "tensorflow_serving.apis.predict_pb2.PredictRequest", "tf_pose.estimator.PoseEstimator.estimate_paf", "numpy.expand_dims", "numpy.append", "tensorflow.python.framework.tensor_util.MakeNdarray", "tensorflow.contrib.util.make_tensor_proto", "cv2.resize", "pickle.dumps" ]
[((136, 232), 'sys.path.append', 'sys.path.append', (['"""/home/yitao/Documents/fun-project/tensorflow-related/tf-pose-estimation/"""'], {}), "(\n '/home/yitao/Documents/fun-project/tensorflow-related/tf-pose-estimation/')\n", (151, 232), False, 'import sys\n'), ((946, 975), 'cv2.resize', 'cv2.resize', (['image', '(...
import random from unittest import TestCase import albumentations as A import numpy as np from watch_recognition.datasets import DEFAULT_TRANSFORMS class TestAugmentations(TestCase): def test_transformations_no_op(self): random.seed(0) np.random.seed(0) transforms = A.Compose( ...
[ "numpy.random.seed", "numpy.zeros", "albumentations.RandomSizedCrop", "watch_recognition.datasets.DEFAULT_TRANSFORMS", "random.seed", "numpy.array", "albumentations.KeypointParams", "numpy.all" ]
[((237, 251), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (248, 251), False, 'import random\n'), ((260, 277), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (274, 277), True, 'import numpy as np\n'), ((437, 460), 'numpy.zeros', 'np.zeros', (['(224, 224, 3)'], {}), '((224, 224, 3))\n', (445, 46...
from typing import Any, Dict import attr from attr import attrib, attrs import numpy as np from nlisim.coordinates import Voxel from nlisim.diffusion import apply_diffusion from nlisim.grid import RectangularGrid from nlisim.module import ModuleModel, ModuleState from nlisim.state import State from nlisim.util import...
[ "numpy.minimum", "nlisim.util.iron_tf_reaction", "attr.attrs", "attr.Factory", "nlisim.diffusion.apply_diffusion", "numpy.zeros", "numpy.mean" ]
[((562, 593), 'attr.attrs', 'attrs', ([], {'kw_only': '(True)', 'repr': '(False)'}), '(kw_only=True, repr=False)\n', (567, 593), False, 'from attr import attrib, attrs\n'), ((418, 540), 'numpy.zeros', 'np.zeros', ([], {'shape': 'self.global_state.grid.shape', 'dtype': "[('Tf', np.float64), ('TfFe', np.float64), ('TfFe2...
import os import re import cv2 import numpy as np from tqdm import tqdm from PIL import Image from ISR.models import RDN def resize_pics(dir, shape, fp): for root, dirs, files in os.walk(dir): for f in files: file_path = os.path.join(root, f) img = cv2.imread(file_path) ...
[ "tqdm.tqdm", "numpy.resize", "os.path.basename", "cv2.imwrite", "os.walk", "cv2.imread", "ISR.models.RDN", "numpy.array", "re.search", "os.path.join", "os.listdir", "cv2.resize" ]
[((185, 197), 'os.walk', 'os.walk', (['dir'], {}), '(dir)\n', (192, 197), False, 'import os\n'), ((844, 881), 'cv2.resize', 'cv2.resize', (['img', '(shape[1], shape[0])'], {}), '(img, (shape[1], shape[0]))\n', (854, 881), False, 'import cv2\n'), ((933, 969), 'numpy.resize', 'np.resize', (['np_array', '(width, height)']...
# -*- coding: utf-8 -*- """ Created on Tue Mar 31 11:00:16 2020 @author: DWXMG """ # import importlib.util # import sys # from collections import namedtuple, OrderedDict from pathlib import Path import itertools # from itertools import combinations # import operator import datetime as dt import rando...
[ "numpy.abs", "numpy.logspace", "numpy.angle", "pathlib.Path", "numpy.mean", "numpy.diag", "pandas.DataFrame", "random.randint", "matplotlib.pyplot.close", "matplotlib.offsetbox.AnchoredOffsetbox", "scipy.stats.linregress", "pandas.isna", "datetime.datetime.now", "matplotlib.pyplot.subplots...
[((1327, 1354), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1344, 1354), False, 'import logging\n'), ((2057, 2071), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2069, 2071), True, 'import pandas as pd\n'), ((3688, 3700), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (36...
# coding=utf-8 # Copyright 2018 Google LLC & <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 o...
[ "tensorflow.ones", "tensorflow.gfile.Exists", "mock.patch.object", "tensorflow.identity", "compare_gan.architectures.arch_ops.linear", "tensorflow.reduce_mean", "tensorflow.layers.flatten", "datetime.datetime.now", "tensorflow.placeholder", "gin.clear_config", "tensorflow.Graph", "tensorflow.n...
[((1374, 1384), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (1382, 1384), True, 'import tensorflow as tf\n'), ((1439, 1504), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, 299, 299, 3]', 'name': '"""Mul"""'}), "(tf.float32, shape=[None, 299, 299, 3], name='Mul')\n", (1453, 1504), T...
from nltk.translate.bleu_score import sentence_bleu from zss import simple_distance, Node import numpy as np import edit_distance from munch import Munch import itertools def compute_lev_distance(doc1, doc2): sm = edit_distance.SequenceMatcher( a=[t.text for t in doc1], b=[t.text for t in doc2]) return...
[ "numpy.mean", "munch.Munch", "edit_distance.SequenceMatcher", "nltk.translate.bleu_score.sentence_bleu" ]
[((219, 304), 'edit_distance.SequenceMatcher', 'edit_distance.SequenceMatcher', ([], {'a': '[t.text for t in doc1]', 'b': '[t.text for t in doc2]'}), '(a=[t.text for t in doc1], b=[t.text for t in\n doc2])\n', (248, 304), False, 'import edit_distance\n'), ((1546, 1560), 'munch.Munch', 'Munch', ([], {'bleu4': '(1)'})...
import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import json import logging from time import gmtime, strftime, localtime import os import loadcifardata import time import numpy as np import matplotlib.pyplot as plt import h5py import sys import getopt from pyecharts.charts import * import pyecha...
[ "tensorflow.compat.v1.zeros", "numpy.sum", "numpy.argsort", "tensorflow.compat.v1.train.exponential_decay", "matplotlib.pyplot.figure", "tensorflow.compat.v1.truncated_normal", "tensorflow.compat.v1.global_variables_initializer", "tensorflow.compat.v1.train.get_checkpoint_state", "tensorflow.compat....
[((35, 59), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (57, 59), True, 'import tensorflow.compat.v1 as tf\n'), ((53644, 53675), 'numpy.mean', 'np.mean', (['weight'], {'axis': '(0, 1, 2)'}), '(weight, axis=(0, 1, 2))\n', (53651, 53675), True, 'import numpy as np\n'), ((53726,...
# -*- coding: utf-8 -*- import math import numpy as np import unittest from dscribe.descriptors import EwaldSumMatrix from ase import Atoms from ase.build import bulk import sparse import scipy.constants from pymatgen.analysis.ewald import EwaldSummation from pymatgen.core.structure import Structure from testbase...
[ "unittest.TextTestRunner", "unittest.TestSuite", "pymatgen.analysis.ewald.EwaldSummation", "numpy.log", "numpy.empty", "ase.build.bulk", "numpy.allclose", "numpy.zeros", "dscribe.descriptors.EwaldSumMatrix", "math.sin", "numpy.array", "unittest.TestLoader", "math.cos", "ase.Atoms" ]
[((668, 794), 'ase.Atoms', 'Atoms', ([], {'cell': '[[5.0, 0.0, 0.0], [0.0, 5.0, 0.0], [0.0, 0.0, 5.0]]', 'positions': '[[0, 0, 0], [0.71, 0, 0]]', 'symbols': "['H', 'He']"}), "(cell=[[5.0, 0.0, 0.0], [0.0, 5.0, 0.0], [0.0, 0.0, 5.0]], positions=[\n [0, 0, 0], [0.71, 0, 0]], symbols=['H', 'He'])\n", (673, 794), False...
from styx_msgs.msg import TrafficLight import rospy import numpy as np import tensorflow as tf class TLClassifier(object): def __init__(self, model_path=None): self.graph = self.load_graph(model_path) self.sess = tf.Session(graph=self.graph) def load_graph(self, path): graph...
[ "numpy.asarray", "tensorflow.Session", "numpy.expand_dims", "tensorflow.gfile.GFile", "tensorflow.Graph", "tensorflow.import_graph_def", "tensorflow.GraphDef" ]
[((245, 273), 'tensorflow.Session', 'tf.Session', ([], {'graph': 'self.graph'}), '(graph=self.graph)\n', (255, 273), True, 'import tensorflow as tf\n'), ((323, 333), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (331, 333), True, 'import tensorflow as tf\n'), ((952, 975), 'numpy.asarray', 'np.asarray', (['image[:, ...
#! /usr/bin/env python # coding=utf-8 # ================================================================ # # Author : miemie2013 # Created date: 2020-10-15 14:50:03 # Description : pytorch_ppyolo # # ================================================================ import torch import torch.nn as nn import to...
[ "torch.atan", "torch.log", "torch.minimum", "torch.cat", "torch.exp", "torch.sigmoid", "torch.clamp", "numpy.array", "torch.max", "torch.arange", "torch.nn.functional.relu", "torch.Tensor", "torch.maximum", "torch.min" ]
[((2533, 2546), 'torch.max', 'T.max', (['x1', 'x2'], {}), '(x1, x2)\n', (2538, 2546), True, 'import torch as T\n'), ((2560, 2573), 'torch.max', 'T.max', (['y1', 'y2'], {}), '(y1, y2)\n', (2565, 2573), True, 'import torch as T\n'), ((2591, 2605), 'torch.max', 'T.max', (['x1', 'x1g'], {}), '(x1, x1g)\n', (2596, 2605), Tr...
import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np import json import os.path import subprocess np.set_printoptions(linewidth=1000000000) torch.cuda.manual_seed(1) training_data = [] testing_data = [] I = open("psipred_d...
[ "torch.nn.Dropout", "torch.mean", "numpy.set_printoptions", "torch.LongTensor", "subprocess.check_output", "torch.cuda.manual_seed", "torch.FloatTensor", "torch.nn.NLLLoss", "torch.Tensor", "torch.max", "torch.nn.functional.log_softmax", "torch.nn.Linear", "torch.zeros", "torch.nn.function...
[((194, 235), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(1000000000)'}), '(linewidth=1000000000)\n', (213, 235), True, 'import numpy as np\n'), ((236, 261), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['(1)'], {}), '(1)\n', (258, 261), False, 'import torch\n'), ((3629, 3641), 'torch....
import numpy as np from vision.utils.box_utils import SSDSpec, SSDBoxSizes, generate_ssd_priors image_size = 160 image_mean = np.array([127, 127, 127]) # RGB layout image_std = 128.0 iou_threshold = 0.45 center_variance = 0.1 size_variance = 0.2 specs = [ SSDSpec(10, 16, SSDBoxSizes(32, 54), [2, 3]), SSDSp...
[ "vision.utils.box_utils.SSDBoxSizes", "vision.utils.box_utils.generate_ssd_priors", "numpy.array" ]
[((129, 154), 'numpy.array', 'np.array', (['[127, 127, 127]'], {}), '([127, 127, 127])\n', (137, 154), True, 'import numpy as np\n'), ((574, 612), 'vision.utils.box_utils.generate_ssd_priors', 'generate_ssd_priors', (['specs', 'image_size'], {}), '(specs, image_size)\n', (593, 612), False, 'from vision.utils.box_utils ...
# -*- coding: utf-8 -*- """ Data conversion between space/time vector and space/time grid formats Created on Sat Jun 27 11:40:16 2015 @author: hdragon689 """ from six.moves import range import numpy as np import pandas as pd def valstv2stg(ch, z, cMS=None, tME=None): ''' Converts the values of a space/time var...
[ "pandas.DataFrame", "pandas.pivot_table", "six.moves.range", "numpy.logical_and", "numpy.asarray", "pandas.ExcelFile", "numpy.isnan", "time.time", "numpy.where", "numpy.array", "numpy.tile" ]
[((1847, 1879), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': 'cols'}), '(data, columns=cols)\n', (1859, 1879), True, 'import pandas as pd\n'), ((2020, 2106), 'pandas.pivot_table', 'pd.pivot_table', (['datadf'], {'values': 'datadf.columns[3]', 'index': "['y', 'x']", 'columns': "['t']"}), "(datadf, values=d...
''' :Copyright: 2015, EUMETSAT, All Rights Reserved. This software was developed within the context of the EUMETSAT Satellite Application Facility on Numerical Weather Prediction (NWP SAF), under the Cooperation Agreement dated 25 November 1998, between EUMETSAT and the Met Office, UK, by one or more partners within t...
[ "os.path.isdir", "os.path.isfile", "numpy.dtype", "numpy.array" ]
[((3835, 3856), 'os.path.isfile', 'os.path.isfile', (['value'], {}), '(value)\n', (3849, 3856), False, 'import os\n'), ((4348, 4368), 'os.path.isdir', 'os.path.isdir', (['value'], {}), '(value)\n', (4361, 4368), False, 'import os\n'), ((5871, 5905), 'numpy.array', 'np.array', (['value'], {'dtype': 'self._dtype'}), '(va...
import config as cfg import base64 from io import BytesIO import matplotlib.pyplot as plt import numpy as np import os from PIL import Image from sys import getsizeof ''' Refer to micro_image_large.py for code documentation ''' ''' Image level data and methods ''' class MicroImage(): def __init__(self, path): ...
[ "io.BytesIO", "numpy.save", "matplotlib.pyplot.show", "numpy.multiply", "os.path.getsize", "matplotlib.pyplot.imshow", "numpy.asarray", "numpy.zeros", "numpy.iinfo", "base64.b64decode", "PIL.Image.open", "numpy.array", "sys.getsizeof", "os.path.join" ]
[((9063, 9114), 'os.path.join', 'os.path.join', (['cfg.COLLECTED_DIR', '"""small_sess_0.png"""'], {}), "(cfg.COLLECTED_DIR, 'small_sess_0.png')\n", (9075, 9114), False, 'import os\n'), ((344, 365), 'os.path.getsize', 'os.path.getsize', (['path'], {}), '(path)\n', (359, 365), False, 'import os\n'), ((625, 641), 'PIL.Ima...
# Author: <NAME> # Date: January, 2021 # Purpose: Implement a package full of statistical functions # Versions: ## 1.0 ## Diebold-Mariano Test: ### This Python function dm_test implements the Diebold-Mariano Test (1995) ### with modification suggested by Harvey et. al (1997) to statistically identify forecast accura...
[ "sklearn.metrics.r2_score", "sklearn.metrics.mean_absolute_error", "sklearn.metrics.mean_squared_log_error", "numpy.arange", "collections.namedtuple", "pandas.Series", "sklearn.metrics.mean_squared_error", "sklearn.metrics.explained_variance_score", "re.compile" ]
[((5424, 5473), 'collections.namedtuple', 'collections.namedtuple', (['"""dm_return"""', '"""DM p_value"""'], {}), "('dm_return', 'DM p_value')\n", (5446, 5473), False, 'import collections\n'), ((5786, 5810), 'sklearn.metrics.r2_score', 'r2_score', (['y_test', 'y_pred'], {}), '(y_test, y_pred)\n', (5794, 5810), False, ...
''' Author: <NAME> Created Date: 2021-05-18 Last Modified: 2021-05-19 content: 1) adapt from Song Hui's matlab code, only the pixel-level distance, thresholding, evaluation parts are available in this script till now. 2) otsu's method are not suitable for this unsupervised method ''' import os import os.path ...
[ "numpy.quantile", "numpy.log", "PolSAR_distance_metric.distance_by_c3", "cv2.cvtColor", "numpy.clip", "mylib.polSAR_utils.min_max_map", "cv2.imread", "numpy.histogram", "mylib.polSAR_utils.read_c3", "mylib.polSAR_utils.rgb_by_c3", "scipy.ndimage.uniform_filter", "os.path.join" ]
[((769, 848), 'scipy.ndimage.uniform_filter', 'ndimage.uniform_filter', (['file.real', '(0, kernel_size, kernel_size)'], {'mode': '"""mirror"""'}), "(file.real, (0, kernel_size, kernel_size), mode='mirror')\n", (791, 848), False, 'from scipy import ndimage\n'), ((857, 936), 'scipy.ndimage.uniform_filter', 'ndimage.unif...
import random import numpy as np import torch import utils.policy as policy class CreditAssignment:# temporary resampling=False, if proved good then no default, need to choose! def __init__(self, cind, gae, n_step, floating_step, gamma, gae_tau, resampling=False, kstep_ir=False, clip=None): self.cind = ci...
[ "random.randint", "torch.stack", "utils.policy.KSTEP", "numpy.hstack", "utils.policy.GAE", "torch.tensor" ]
[((3479, 3524), 'torch.tensor', 'torch.tensor', (['[discounts + self.n_step * [0]]'], {}), '([discounts + self.n_step * [0]])\n', (3491, 3524), False, 'import torch\n'), ((4243, 4283), 'numpy.hstack', 'np.hstack', (['[indices, self.n_step * [-1]]'], {}), '([indices, self.n_step * [-1]])\n', (4252, 4283), True, 'import ...
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "numpy.random.seed", "deap.base.Toolbox", "numpy.ndarray", "matplotlib.pyplot.plot", "matplotlib.pyplot.show", "numpy.std", "deap.tools.Statistics", "deap.creator.create", "matplotlib.pyplot.figure", "matplotlib.pyplot.semilogy", "deap....
[((923, 982), 'deap.creator.create', 'creator.create', (['"""FitnessMin"""', 'base.Fitness'], {'weights': '(-1.0,)'}), "('FitnessMin', base.Fitness, weights=(-1.0,))\n", (937, 982), False, 'from deap import creator\n'), ((983, 1045), 'deap.creator.create', 'creator.create', (['"""Individual"""', 'list'], {'fitness': 'c...
# Copyright 2021 <NAME> # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistr...
[ "networkx.algorithms.all_simple_paths", "numpy.random.uniform", "sempler.generators.dag_avg_deg", "numpy.zeros_like", "networkx.from_numpy_matrix", "numpy.zeros", "numpy.where", "numpy.array", "numpy.random.randint", "numpy.random.permutation" ]
[((2356, 2456), 'numpy.array', 'np.array', (['[[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1], [0, 0,\n 0, 0, 0]]'], {}), '([[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1\n ], [0, 0, 0, 0, 0]])\n', (2364, 2456), True, 'import numpy as np\n'), ((2654, 2754), 'numpy.array', '...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ annom.loss define loss functions for neural network training specific for anomaly detection Author: <NAME> (<EMAIL>) Created on: Mar 11, 2018 """ __all__ = ['Burn2MSELoss', 'Burn2MAELoss', 'HotGaussianLoss', 'HotLaplacianLoss', ...
[ "torch.argmax", "logging.getLogger", "torch.no_grad", "torch.ones", "torch.exp", "numpy.linspace", "torch.zeros", "torch.mean", "torch.norm", "torch.nn.functional.mse_loss", "torch.nn.functional.cross_entropy", "torch.nn.functional.l1_loss", "torch.abs", "torch.pow", "torch.sum", "torc...
[((734, 761), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (751, 761), False, 'import logging\n'), ((2177, 2229), 'numpy.linspace', 'np.linspace', (['start', 'stop', '(n_bins - 1)'], {'endpoint': '(False)'}), '(start, stop, n_bins - 1, endpoint=False)\n', (2188, 2229), True, 'import num...
import numpy as np from talib._ta_lib import * #import talib close = np.random.random(100) output = SMA(close) close2 = np.random.random(20) sma = SMA(close2, 5) print(sma)
[ "numpy.random.random" ]
[((70, 91), 'numpy.random.random', 'np.random.random', (['(100)'], {}), '(100)\n', (86, 91), True, 'import numpy as np\n'), ((122, 142), 'numpy.random.random', 'np.random.random', (['(20)'], {}), '(20)\n', (138, 142), True, 'import numpy as np\n')]
#*----------------------------------------------------------------------------* #* Copyright (C) 2020 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
[ "scipy.signal.sosfilt", "numpy.zeros", "scipy.signal.firwin", "scipy.signal.convolve", "scipy.signal.butter" ]
[((1989, 2056), 'scipy.signal.butter', 'butter', (['order', 'f_band_nom'], {'analog': '(False)', 'btype': '"""band"""', 'output': '"""sos"""'}), "(order, f_band_nom, analog=False, btype='band', output='sos')\n", (1995, 2056), False, 'from scipy.signal import butter, sosfilt, sosfreqz\n'), ((2069, 2092), 'scipy.signal.s...
import numpy as np import cv2 class ColorGradientPoint(object): def __init__(self, p_r, p_g, p_b, p_v): self._r, self._g, self._b = p_r, p_g, p_b self._v = p_v; #position of the color along the gradient (0 to 1) class ColorGradient(object): def __init__(self): self._colorGrad...
[ "numpy.zeros_like", "numpy.ones_like", "cv2.cvtColor", "cv2.imwrite", "cv2.imread", "cv2.normalize" ]
[((2974, 3015), 'cv2.imread', 'cv2.imread', (['imgPath', 'cv2.IMREAD_UNCHANGED'], {}), '(imgPath, cv2.IMREAD_UNCHANGED)\n', (2984, 3015), False, 'import cv2\n'), ((3029, 3066), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (3041, 3066), False, 'import cv2\n'), ((306...
import numpy as np import random from utils.DataGenerator import SplitMnistGenerator import torch from utils.multihead_models import Vanilla_CNN, Vanilla_NN, MFVI_NN, MFVI_CNN import utils.coreset as coreset import utils.test as test from utils.vcl import run_vcl_cnn, run_vcl N_SEEDS = 3 for i in range(1, N_SEEDS+1)...
[ "numpy.save", "numpy.random.seed", "torch.manual_seed", "utils.DataGenerator.SplitMnistGenerator", "utils.vcl.run_vcl_cnn", "torch.cuda.manual_seed", "torch.cuda.manual_seed_all", "random.seed" ]
[((348, 368), 'torch.manual_seed', 'torch.manual_seed', (['i'], {}), '(i)\n', (365, 368), False, 'import torch\n'), ((373, 398), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['i'], {}), '(i)\n', (395, 398), False, 'import torch\n'), ((403, 432), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['i']...
import sys import cuzcatlan as cusca import numpy as np from statistics import mode from scipy.cluster.hierarchy import dendrogram import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import itertools SIGNIFICANT_DIGITS = 7 # This dictionary is used for parsing inputs input_col_distance_dict = { ...
[ "seaborn.heatmap", "numpy.sum", "matplotlib.pyplot.clf", "pandas.read_csv", "numpy.mean", "numpy.arange", "numpy.exp", "matplotlib.pyplot.gca", "numpy.unique", "cuzcatlan.uncentered_pearson_dist", "cuzcatlan.custom_pearson_dist", "cuzcatlan.custom_cosine_dist", "cuzcatlan.information_coeffic...
[((23452, 23461), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (23459, 23461), True, 'import matplotlib.pyplot as plt\n'), ((24842, 24897), 'scipy.cluster.hierarchy.dendrogram', 'dendrogram', (['linkage_matrix'], {'color_threshold': '(0)'}), '(linkage_matrix, color_threshold=0, **kwargs)\n', (24852, 24897), Fa...
from astrometry.libkd.spherematch import * from astrometry.util.fits import * import numpy as np from astrometry.util.starutil_numpy import * from astrometry.util.plotutils import * from glob import glob from collections import Counter from legacyanalysis.gaiacat import * from legacypipe.survey import radec_at_mjd def...
[ "numpy.fmod", "numpy.sum", "numpy.linalg.lstsq", "numpy.deg2rad", "numpy.median", "legacypipe.survey.radec_at_mjd", "numpy.logical_not", "numpy.flatnonzero", "numpy.isfinite", "numpy.rad2deg", "numpy.sin", "numpy.logical_or", "numpy.cos", "astrometry.util.multiproc.multiproc", "numpy.uni...
[((11212, 11228), 'numpy.unique', 'np.unique', (['W.run'], {}), '(W.run)\n', (11221, 11228), True, 'import numpy as np\n'), ((11650, 11662), 'astrometry.util.multiproc.multiproc', 'multiproc', (['(8)'], {}), '(8)\n', (11659, 11662), False, 'from astrometry.util.multiproc import multiproc\n'), ((452, 466), 'numpy.deg2ra...
# 論文中には載せてないけど研究で色々試したモデル群 import pandas as pd import numpy as np import statsmodels.api as sm from marginal import marginal from copula import copula from typing import List from scoring import models from utils import util class NestedCopulaKLParametricModel(models.ScoreModel): param_a = 10 def __init__(s...
[ "utils.util.list_of_users_axis_has_weight", "numpy.matrix", "statsmodels.api.Logit", "marginal.marginal.QuantizedNorm", "scoring.models.CopulaScoreModel.__init__", "scoring.models.create_cluster", "utils.util.kl_divergence_between_population_and_users", "pandas.DataFrame.from_records", "copula.copul...
[((3214, 3262), 'pandas.DataFrame.from_records', 'pd.DataFrame.from_records', (['dict_list'], {'index': '"""id"""'}), "(dict_list, index='id')\n", (3239, 3262), True, 'import pandas as pd\n'), ((3277, 3335), 'pandas.DataFrame.from_records', 'pd.DataFrame.from_records', (['dict_list_main_prod'], {'index': '"""id"""'}), ...
from keras.models import load_model import cv2 import numpy as np import glob def writeResultOnImage(openCVImage, resultText): # ToDo: this function may take some further fine-tuning to show the text well given any possible image size SCALAR_BLUE = (255.0, 0.0, 0.0) imageHeight, imageWidth, sceneNu...
[ "keras.models.load_model", "cv2.putText", "numpy.argmax", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.getTextSize", "cv2.imread", "cv2.namedWindow", "numpy.reshape", "glob.glob", "cv2.resizeWindow", "cv2.imshow", "cv2.resize" ]
[((1367, 1420), 'keras.models.load_model', 'load_model', (['"""models/model3classesDogCatBirdAdam32.h5"""'], {}), "('models/model3classesDogCatBirdAdam32.h5')\n", (1377, 1420), False, 'from keras.models import load_model\n'), ((1509, 1537), 'glob.glob', 'glob.glob', (['"""data/test/*.jpg"""'], {}), "('data/test/*.jpg')...
import torch import torch.nn as nn from .rnn_cell import MIMN as mimn from .rnn_cell import MIMBlock as mimblock from .rnn_cell import MIM_SpatioTemporalLSTMCell as stlstm from tqdm import tqdm import numpy as np from .utils import reshape_patch, reshape_patch_back # Cite from https://github.com/coolsunxu/MIM_Pytorch,...
[ "sys.path.append", "torch.nn.MSELoss", "tqdm.tqdm", "numpy.average", "torch.stack", "numpy.random.random_sample", "torch.nn.ModuleList", "API.metrics.metric", "torch.zeros_like", "torch.nn.Conv2d", "numpy.zeros", "numpy.ones", "torch.cat", "torch.FloatTensor", "numpy.array", "numpy.res...
[((716, 731), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (729, 731), True, 'import torch.nn as nn\n'), ((766, 781), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (779, 781), True, 'import torch.nn as nn\n'), ((2393, 2483), 'torch.nn.Conv2d', 'nn.Conv2d', (['self.num_hidden[self.num_layers - 1...
import pytest import numpy as np import numpy.testing as npt from neuroglia.calcium.oasis import functions from neuroglia.datasets.synthetic_calcium import gen_data def calculate_corrcoef(truth, estimate): return np.corrcoef(truth, estimate)[0, 1] @pytest.fixture def synthetic_calcium(calcium_kwargs): retu...
[ "numpy.corrcoef", "numpy.testing.assert_allclose", "neuroglia.calcium.oasis.functions.onnls", "neuroglia.calcium.oasis.functions.estimate_time_constant", "neuroglia.calcium.oasis.functions.deconvolve", "numpy.array", "numpy.arange", "neuroglia.datasets.synthetic_calcium.gen_data", "pytest.mark.param...
[((406, 952), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""calcium_kwargs, deconvolve_kwargs, calcium_threshold, spike_threshold"""', "[({'N': 1, 'b': 2, 'seed': 0}, {'penalty': 1}, 0.9, 0.8), ({'g': (1.7, -\n 0.712), 'sn': 0.5, 'N': 1, 'b': 2, 'seed': 0}, {'g': (1.7, -0.712)}, \n 0.9, 0.7), ({'g':...
import math import numpy as np from numba.experimental import jitclass @jitclass([]) class NumbaHeatIndexCalculator(object): """ This class uses the jitclass operator to automatically jit all of the functions inside. Otherwise it's identical to the base implementation """ def __init__(self): ...
[ "numpy.zeros_like", "numba.experimental.jitclass", "math.fabs" ]
[((75, 87), 'numba.experimental.jitclass', 'jitclass', (['[]'], {}), '([])\n', (83, 87), False, 'from numba.experimental import jitclass\n'), ((428, 447), 'numpy.zeros_like', 'np.zeros_like', (['temp'], {}), '(temp)\n', (441, 447), True, 'import numpy as np\n'), ((2803, 2825), 'math.fabs', 'math.fabs', (['(temp - 95.0)...
# TEST: Numeric Integration using adaptive Trapezoidal and Simpson methods import matplotlib.pyplot as plt import numpy as np from quad import quad_trapezoid, quad_simpson from quad import quad_trapezoid_adapt, quad_simpson_adapt f = lambda x: -2*x**(-3) * np.cos(x**(-2)) a = 0.5; b = 100; Iexp = np.sin(10**(-4)) - ...
[ "matplotlib.pyplot.show", "quad.quad_trapezoid", "matplotlib.pyplot.scatter", "quad.quad_trapezoid_adapt", "quad.quad_simpson", "numpy.sin", "numpy.linspace", "numpy.cos", "matplotlib.pyplot.subplots", "quad.quad_simpson_adapt", "matplotlib.pyplot.grid" ]
[((496, 530), 'quad.quad_trapezoid_adapt', 'quad_trapezoid_adapt', (['a', 'b', 'f', 'tol'], {}), '(a, b, f, tol)\n', (516, 530), False, 'from quad import quad_trapezoid_adapt, quad_simpson_adapt\n'), ((710, 740), 'quad.quad_trapezoid', 'quad_trapezoid', (['a', 'b', 'f', '(n - 1)'], {}), '(a, b, f, n - 1)\n', (724, 740)...
""" Connectivity ============ A fundamental difference between structured and unstructured grids lies in the connectivity. This is true for cell to cell connectivity, but also for vertex (node) connectivity (which set of vertices make up an individual cell). In structured grids, connectivity is implicit and can be dir...
[ "numpy.full", "xugrid.UgridDataArray", "numpy.ones", "xugrid.data.xoxo", "xugrid.plot.line", "xarray.full_like", "xugrid.data.disk", "matplotlib.pyplot.subplots" ]
[((2742, 2760), 'xugrid.data.disk', 'xugrid.data.disk', ([], {}), '()\n', (2758, 2760), False, 'import xugrid\n'), ((2978, 3016), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'ncols': '(2)', 'figsize': '(12, 5)'}), '(ncols=2, figsize=(12, 5))\n', (2990, 3016), True, 'import matplotlib.pyplot as plt\n'), ((3691, ...
import torch from model.vgg import vgg11 import cv2 import numpy as np classes = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'del', 'nothing', 'space'] class2idx = {'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6,...
[ "cv2.cvtColor", "torch.argmax", "numpy.transpose", "model.vgg.vgg11", "cv2.imread", "torch.device", "cv2.normalize", "torch.tensor" ]
[((757, 764), 'model.vgg.vgg11', 'vgg11', ([], {}), '()\n', (762, 764), False, 'from model.vgg import vgg11\n'), ((927, 955), 'numpy.transpose', 'np.transpose', (['img', '(2, 0, 1)'], {}), '(img, (2, 0, 1))\n', (939, 955), True, 'import numpy as np\n'), ((972, 1018), 'torch.tensor', 'torch.tensor', (['[torch_img]'], {'...
import sys import numpy as np import random from collections import defaultdict, Counter from classification_indicies import NamedBinaryIndices METRICS = ('f1', 'acc', 'cc', 'ba', 'kappa', 'ce', 'sba', 'gm1') DONE = defaultdict(set) DONE2 = defaultdict(set) SKIPIT = set() EPS = 1e-5 SEED = 1 random.seed(SEED) np...
[ "numpy.random.seed", "classification_indicies.NamedBinaryIndices.items", "numpy.isnan", "collections.defaultdict", "random.seed" ]
[((221, 237), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (232, 237), False, 'from collections import defaultdict, Counter\n'), ((246, 262), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (257, 262), False, 'from collections import defaultdict, Counter\n'), ((300, 317), 'ran...
import numpy as np import hmath.mm_math as mm import motion.motion as motion # if parent_joint_axis is None: assume 3dof parent joint # if not: use parent_joint_axis as rotV # parent_joint_axis is a local direction def ik_analytic(posture: motion.JointPosture, joint_name_or_index, new_position, parent_joint_axis=Non...
[ "hmath.mm_math.normalize", "numpy.cross", "hmath.mm_math.length", "numpy.array", "hmath.mm_math.exp", "hmath.mm_math.acos" ]
[((877, 889), 'hmath.mm_math.length', 'mm.length', (['L'], {}), '(L)\n', (886, 889), True, 'import hmath.mm_math as mm\n'), ((898, 910), 'hmath.mm_math.length', 'mm.length', (['N'], {}), '(N)\n', (907, 910), True, 'import hmath.mm_math as mm\n'), ((919, 931), 'hmath.mm_math.length', 'mm.length', (['M'], {}), '(M)\n', (...
import numpy as np import cv2 import time Dx , Dy = 0, 0 cap = cv2.VideoCapture('Back.mp4') # params for ShiTomasi corner detection feature_params = dict( maxCorners = 10, # How many point you wnat to check qualityLevel = 0.3, # The point quality ...
[ "numpy.zeros_like", "cv2.cvtColor", "cv2.waitKey", "cv2.imwrite", "time.time", "cv2.VideoCapture", "numpy.random.randint", "cv2.goodFeaturesToTrack", "cv2.calcOpticalFlowPyrLK", "cv2.destroyAllWindows" ]
[((71, 99), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""Back.mp4"""'], {}), "('Back.mp4')\n", (87, 99), False, 'import cv2\n'), ((658, 693), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)', '(100, 3)'], {}), '(0, 255, (100, 3))\n', (675, 693), True, 'import numpy as np\n'), ((825, 868), 'cv2.cvtColor', ...
''' gemm.py: Implement's the GeMM ONNX node as a flexnode (for use with any accelerator) ''' import uuid import numpy as np from operators.flexnode import FlexNode from core.defines import Operator from core.messaging import Message class GeMM(FlexNode): def __init__(self, onnx_node, inputs, outputs): ...
[ "uuid.uuid4", "operators.flexnode.FlexNode.__init__", "numpy.transpose", "numpy.broadcast_to", "core.messaging.Message" ]
[((323, 374), 'operators.flexnode.FlexNode.__init__', 'FlexNode.__init__', (['self', 'onnx_node', 'inputs', 'outputs'], {}), '(self, onnx_node, inputs, outputs)\n', (340, 374), False, 'from operators.flexnode import FlexNode\n'), ((1412, 1441), 'numpy.transpose', 'np.transpose', (['self._inputs[0]'], {}), '(self._input...
import time import numpy as np from scipy.sparse import coo_matrix import torch from torch.nn import Sequential, Linear, ReLU from torch_geometric.nn import GINConv, global_add_pool import torch.utils.data as Data import torch.nn as nn import torch.nn.functional as F from sklearn.model_selection import train_t...
[ "numpy.load", "sklearn.preprocessing.StandardScaler", "sklearn.model_selection.train_test_split", "torch.nn.functional.dropout", "torch.utils.data.TensorDataset", "torch.device", "torch.ones", "torch.utils.data.DataLoader", "scipy.sparse.coo_matrix", "numpy.max", "torch.nn.functional.log_softmax...
[((538, 554), 'numpy.load', 'np.load', (['"""1.npy"""'], {}), "('1.npy')\n", (545, 554), True, 'import numpy as np\n'), ((644, 669), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (667, 669), False, 'import torch\n'), ((2803, 2867), 'sklearn.model_selection.train_test_split', 'train_test_split'...
""" Module for analysing the Action Units in csvs, produced by Open Face""" import pandas as pd import numpy as np import environment as paths import matplotlib.pyplot as plt import os from multiprocessing import Pool from time import sleep import glob from sklearn.decomposition import PCA from sklearn.preprocessing im...
[ "matplotlib.pyplot.title", "sklearn.model_selection.GridSearchCV", "numpy.random.seed", "sklearn.preprocessing.StandardScaler", "numpy.sum", "pandas.read_csv", "sklearn.model_selection.train_test_split", "os.walk", "numpy.ones", "sklearn.metrics.classification_report", "statsmodels.api.stats.ano...
[((2104, 2121), 'pandas.read_csv', 'pd.read_csv', (['name'], {}), '(name)\n', (2115, 2121), True, 'import pandas as pd\n'), ((3342, 3361), 'os.walk', 'os.walk', (['search_dir'], {}), '(search_dir)\n', (3349, 3361), False, 'import os\n'), ((5774, 5781), 'multiprocessing.Pool', 'Pool', (['(4)'], {}), '(4)\n', (5778, 5781...
import numpy as np import cv2 class SeamCarver: def __init__(self, filename, out_height, out_width, protect_mask='', object_mask=''): # initialize parameter self.filename = filename self.out_height = out_height self.out_width = out_width # read in image and store as np.flo...
[ "numpy.average", "numpy.copy", "cv2.Scharr", "cv2.filter2D", "numpy.zeros", "numpy.argmin", "cv2.imread", "cv2.split", "numpy.array", "numpy.rot90", "numpy.where", "numpy.delete" ]
[((527, 549), 'numpy.copy', 'np.copy', (['self.in_image'], {}), '(self.in_image)\n', (534, 549), True, 'import numpy as np\n'), ((883, 968), 'numpy.array', 'np.array', (['[[0.0, 0.0, 0.0], [-1.0, 0.0, 1.0], [0.0, 0.0, 0.0]]'], {'dtype': 'np.float64'}), '([[0.0, 0.0, 0.0], [-1.0, 0.0, 1.0], [0.0, 0.0, 0.0]], dtype=np.fl...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 14 11:54:02 2018 @author: jeremiasknoblauch Description: Plot illustration of Thm """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 12 16:32:59 2018 @author: jeremiasknoblauch Description: Picture for influence functions...
[ "csv.reader", "matplotlib.rcParams.update", "numpy.zeros", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((1053, 1083), 'numpy.zeros', 'np.zeros', (['(num_rows, num_cols)'], {}), '((num_rows, num_cols))\n', (1061, 1083), True, 'import numpy as np\n'), ((1436, 1480), 'matplotlib.rcParams.update', 'rcParams.update', (["{'figure.autolayout': True}"], {}), "({'figure.autolayout': True})\n", (1451, 1480), False, 'from matplot...
# -*- coding: utf-8 -*- """ Created on Sat Aug 11 20:31:13 2018 revised the rcca this code is used to evaluate the sCCA model @author: lenovo """ # search path append import sys sys.path.append(r'D:\Github_Related\Github_Code\sCCA_Python\pyrcca-master') from rcca import predict import numpy as np def lc_compute_ev(v...
[ "sys.path.append", "rcca.predict", "numpy.zeros", "numpy.isnan" ]
[((180, 258), 'sys.path.append', 'sys.path.append', (['"""D:\\\\Github_Related\\\\Github_Code\\\\sCCA_Python\\\\pyrcca-master"""'], {}), "('D:\\\\Github_Related\\\\Github_Code\\\\sCCA_Python\\\\pyrcca-master')\n", (195, 258), False, 'import sys\n'), ((620, 637), 'numpy.zeros', 'np.zeros', (['(nC, f)'], {}), '((nC, f))\...
import os import sys import math import numpy as np from numpy.lib.stride_tricks import as_strided import cv2 import argparse from openvino.inference_engine import IECore def _exp(v): if isinstance(v, tuple) or isinstance(v, list): return [_exp(item) for item in v] elif isinstance(v, np.ndarray): ...
[ "numpy.pad", "cv2.resize", "cv2.putText", "argparse.ArgumentParser", "openvino.inference_engine.IECore", "cv2.cvtColor", "cv2.waitKey", "cv2.imwrite", "numpy.argsort", "cv2.VideoCapture", "cv2.imread", "numpy.lib.stride_tricks.as_strided", "numpy.array", "numpy.exp", "os.path.splitext", ...
[((409, 418), 'numpy.exp', 'np.exp', (['(1)'], {}), '(1)\n', (415, 418), True, 'import numpy as np\n'), ((1473, 1508), 'numpy.pad', 'np.pad', (['x', 'padding'], {'mode': '"""constant"""'}), "(x, padding, mode='constant')\n", (1479, 1508), True, 'import numpy as np\n'), ((1684, 1804), 'numpy.lib.stride_tricks.as_strided...
from neuromodulation.optimise import Optimise_modulation from neuromodulation.optimise import NumpyEncoder from neuromodulation.optimisation_setup_seclamp import optimisation_setup_seclamp from neuromodulation.NrnSimulatorParallel import NrnSimulatorParallel import numpy as np import neuromodulation.selection_criteria ...
[ "json.dump", "neuromodulation.NrnSimulatorParallel.NrnSimulatorParallel", "neuromodulation.optimisation_setup_seclamp.optimisation_setup_seclamp", "numpy.savetxt", "numpy.array", "neuromodulation.optimise.Optimise_modulation", "numpy.all" ]
[((4417, 4454), 'neuromodulation.optimise.Optimise_modulation', 'Optimise_modulation', ([], {'setup': 'objectives'}), '(setup=objectives)\n', (4436, 4454), False, 'from neuromodulation.optimise import Optimise_modulation\n'), ((1888, 1928), 'neuromodulation.NrnSimulatorParallel.NrnSimulatorParallel', 'NrnSimulatorParal...
import numpy as np from sed_scores_eval.utils.curves import get_curve_idx_for_threshold def precision_recall_curve_from_intermediate_statistics( scores_intermediate_statistics ): """Compute precision-recall curve from intermediate_statistics Args: scores_intermediate_statistics ((dict of) tup...
[ "sed_scores_eval.utils.curves.get_curve_idx_for_threshold", "numpy.sum", "numpy.maximum", "numpy.ones_like", "numpy.argmax", "numpy.isscalar", "numpy.argsort", "numpy.mean" ]
[((6273, 6291), 'numpy.argsort', 'np.argsort', (['scores'], {}), '(scores)\n', (6283, 6291), True, 'import numpy as np\n'), ((13318, 13364), 'sed_scores_eval.utils.curves.get_curve_idx_for_threshold', 'get_curve_idx_for_threshold', (['scores', 'threshold'], {}), '(scores, threshold)\n', (13345, 13364), False, 'from sed...
from mmdet.datasets import build_dataset, build_dataloader import torch import argparse import matplotlib.pyplot as plt import numpy as np import os import matplotlib.patches as patches import cv2 import sys from mmcv import Config def vis_masks(img, ref_img, masks, ref_masks, instance_ids, refinst_ids): fig2 = p...
[ "argparse.ArgumentParser", "mmdet.datasets.build_dataset", "matplotlib.patches.Rectangle", "matplotlib.pyplot.clf", "matplotlib.pyplot.imshow", "numpy.zeros", "numpy.transpose", "matplotlib.pyplot.draw", "matplotlib.pyplot.ion", "matplotlib.pyplot.figure", "mmcv.Config.fromfile", "numpy.array"...
[((319, 332), 'matplotlib.pyplot.figure', 'plt.figure', (['(4)'], {}), '(4)\n', (329, 332), True, 'import matplotlib.pyplot as plt\n'), ((359, 372), 'matplotlib.pyplot.figure', 'plt.figure', (['(3)'], {}), '(3)\n', (369, 372), True, 'import matplotlib.pyplot as plt\n'), ((766, 820), 'numpy.zeros', 'np.zeros', (['(masks...
""" Indian Buffet Process --------------------- Generative story for IBP """ import numpy as np N = 10 # num of customer C = [[] for i in range(N)] # cust. dishes assignment K = 0 # num of current dishes selected dishes = [] # num. of cust. sampled each dish alpha = 1 # Poisson prior for n in range(N): # S...
[ "numpy.array", "numpy.zeros", "numpy.random.poisson", "numpy.random.binomial" ]
[((829, 845), 'numpy.zeros', 'np.zeros', (['[N, K]'], {}), '([N, K])\n', (837, 845), True, 'import numpy as np\n'), ((641, 669), 'numpy.random.poisson', 'np.random.poisson', ([], {'lam': 'alpha'}), '(lam=alpha)\n', (658, 669), True, 'import numpy as np\n'), ((891, 905), 'numpy.array', 'np.array', (['C[n]'], {}), '(C[n]...
# MIT License # # Copyright (c) 2018-2019 Tskit Developers # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modif...
[ "tskit.util.safe_np_int_cast", "numpy.array", "numpy.iinfo", "pickle.dumps" ]
[((1533, 1562), 'numpy.array', 'np.array', (['[0, 1]'], {'dtype': 'dtype'}), '([0, 1], dtype=dtype)\n', (1541, 1562), True, 'import numpy as np\n'), ((1908, 1947), 'numpy.array', 'np.array', (['[[0, 1], [2, 3]]'], {'dtype': 'dtype'}), '([[0, 1], [2, 3]], dtype=dtype)\n', (1916, 1947), True, 'import numpy as np\n'), ((3...
import numpy as np def write_mat(os, m): r = m.shape[0] c = m.shape[1] os.write(str(r) + '\n') os.write(str(c) + '\n') for i in range(r): for j in range(c): os.write(str(m[i][j]) + '\n') def write_tensor(os, m): os.write(str(len(m.shape)) + '\n') for d in m.shape: ...
[ "numpy.zeros" ]
[((632, 646), 'numpy.zeros', 'np.zeros', (['size'], {}), '(size)\n', (640, 646), True, 'import numpy as np\n'), ((1095, 1109), 'numpy.zeros', 'np.zeros', (['size'], {}), '(size)\n', (1103, 1109), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- import unittest from numpy import exp, sqrt, random, mean from mc import payoffs from mc import mc from fox_toolbox.utils import volatility import numpy.testing as npt __author__ = "mkapchenko" __copyright__ = "mkapchenko" __license__ = "mit" random.seed(22) S0 = 100. K = 100. T = 10. r = 0...
[ "numpy.random.seed", "numpy.testing.assert_almost_equal", "mc.payoffs.call", "mc.mc.BlackScholesProcess", "numpy.mean", "fox_toolbox.utils.volatility.BSPrice", "numpy.exp", "numpy.random.normal", "numpy.sqrt" ]
[((271, 286), 'numpy.random.seed', 'random.seed', (['(22)'], {}), '(22)\n', (282, 286), False, 'from numpy import exp, sqrt, random, mean\n'), ((354, 361), 'numpy.sqrt', 'sqrt', (['T'], {}), '(T)\n', (358, 361), False, 'from numpy import exp, sqrt, random, mean\n'), ((371, 381), 'numpy.exp', 'exp', (['(r * T)'], {}), '...
import collections import csv import pickle import numpy as np import pandas as pd import tensorflow as tf from sklearn.model_selection import KFold from sklearn.naive_bayes import MultinomialNB from keras.preprocessing import sequence from keras.preprocessing import text from sklearn.metrics import confusion_matrix, a...
[ "pandas.DataFrame", "csv.reader", "sklearn.naive_bayes.MultinomialNB", "nltk.stem.WordNetLemmatizer", "keras.preprocessing.sequence.pad_sequences", "sklearn.metrics.accuracy_score", "numpy.array2string", "sklearn.model_selection.KFold", "numpy.rint", "keras.preprocessing.text.Tokenizer", "numpy....
[((2359, 2405), 'keras.preprocessing.text.Tokenizer', 'text.Tokenizer', ([], {'num_words': 'TOP_WORDS', 'split': '""" """'}), "(num_words=TOP_WORDS, split=' ')\n", (2373, 2405), False, 'from keras.preprocessing import text\n'), ((2657, 2704), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': "{'x': x_train, 'y': y_trai...
###################################################################### ###################################################################### # Copyright <NAME>, Cambridge Dialogue Systems Group, 2017 # ###################################################################### #############################################...
[ "numpy.random.uniform", "theano.tensor.concatenate", "numpy.sum", "numpy.zeros_like", "theano.tensor.sum", "theano.tensor.dot", "numpy.zeros", "theano.scan", "theano.tensor.zeros_like", "theano.gradient.disconnected_grad", "theano.tensor.nnet.softmax", "numpy.array", "numpy.dot", "theano.t...
[((2630, 2667), 'theano.tensor.sum', 'T.sum', (['ngms_j[ssrcpos_jsv, :]'], {'axis': '(0)'}), '(ngms_j[ssrcpos_jsv, :], axis=0)\n', (2635, 2667), True, 'import theano.tensor as T\n'), ((2688, 2725), 'theano.tensor.sum', 'T.sum', (['ngms_j[vsrcpos_jsv, :]'], {'axis': '(0)'}), '(ngms_j[vsrcpos_jsv, :], axis=0)\n', (2693, ...
import numpy as np import matplotlib.pyplot as plt import cv2 from itertools import product def threshold_binarization(img, threshold=150): height, width = img.shape for i,j in product(range(height), range(width)): if img[i][j] > threshold: img[i][j] = 0 else: img[i][j] = 1 return img def connected_c...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "cv2.imread", "numpy.array", "matplotlib.pyplot.savefig" ]
[((395, 408), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (403, 408), True, 'import numpy as np\n'), ((417, 430), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (425, 430), True, 'import numpy as np\n'), ((2750, 2781), 'cv2.imread', 'cv2.imread', (['"""Lab4-image.png"""', '(0)'], {}), "('Lab4-image.png',...
import numpy as np import matplotlib.pyplot as plt from cvxpy import * Q = np.loadtxt('data/FOL-monthly-inflow-TAF.csv', delimiter=',', skiprows=1, usecols=[1]) T = len(Q) K = 975 # reservoir capacity x = Variable(T+1) # storage vector (decision variable) u = Variable(T) # release vector (decision variable) d = 150*...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.ones", "numpy.loadtxt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((77, 166), 'numpy.loadtxt', 'np.loadtxt', (['"""data/FOL-monthly-inflow-TAF.csv"""'], {'delimiter': '""","""', 'skiprows': '(1)', 'usecols': '[1]'}), "('data/FOL-monthly-inflow-TAF.csv', delimiter=',', skiprows=1,\n usecols=[1])\n", (87, 166), True, 'import numpy as np\n'), ((1247, 1267), 'matplotlib.pyplot.subplo...
# -*- coding: utf-8 -*- import abc import tensorflow as tf import numpy as np import utils from constants import FLOAT_DTYPE class Simulator(abc.ABC): @property def max_size(self) -> int: return int(2**25) @property def correlation(self) -> tf.Tensor: """Returns the correlation matrix...
[ "tensorflow.cumsum", "tensorflow.matmul", "tensorflow.sqrt", "tensorflow.split", "tensorflow.size", "tensorflow.math.sobol_sample", "tensorflow.concat", "tensorflow.stack", "tensorflow.exp", "tensorflow.random.poisson", "tensorflow.random.normal", "tensorflow.constant", "tensorflow.transpose...
[((1574, 1612), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['rvs', 'FLOAT_DTYPE'], {}), '(rvs, FLOAT_DTYPE)\n', (1594, 1612), True, 'import tensorflow as tf\n'), ((1995, 2022), 'tensorflow.split', 'tf.split', (['tensor', 'tf.arange'], {}), '(tensor, tf.arange)\n', (2003, 2022), True, 'import tensorflow as...
from MCPricer import MCPricer from financial_instruments import europeanOption, barrierOption import numpy as np np.random.seed(0) from yahoo_fin import options import yfinance as yf from datetime import datetime if __name__ == "__main__": # ============================================================================...
[ "numpy.random.seed", "datetime.datetime.today", "yahoo_fin.options.get_calls", "financial_instruments.barrierOption", "datetime.datetime.strptime", "financial_instruments.europeanOption", "yfinance.Ticker", "MCPricer.MCPricer", "yahoo_fin.options.get_puts" ]
[((113, 130), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (127, 130), True, 'import numpy as np\n'), ((1151, 1193), 'yahoo_fin.options.get_calls', 'options.get_calls', (['ticker', 'expiration_date'], {}), '(ticker, expiration_date)\n', (1168, 1193), False, 'from yahoo_fin import options\n'), ((1227, ...
import time, math import numpy as np import pandas as pd import pylab as pl import scipy def get_region(df, angle_step=5, **kwargs): df = df.copy() min_lat = df['lat'].min() max_lat = df['lat'].max() min_lon = df['lon'].min() max_lon = df['lon'].max() origin = ((max_lat - min_la...
[ "numpy.arctan2", "scipy.interpolate.spline", "numpy.round", "pandas.DataFrame", "numpy.apply_along_axis", "numpy.cumsum", "numpy.linspace", "pylab.text", "numpy.asarray", "numpy.cross", "pylab.fill", "numpy.cos", "numpy.arctan", "numpy.vstack", "numpy.zeros", "pylab.clf", "pylab.gca"...
[((394, 450), 'numpy.arctan2', 'np.arctan2', (["(df['lon'] - origin[1])", "(df['lat'] - origin[0])"], {}), "(df['lon'] - origin[1], df['lat'] - origin[0])\n", (404, 450), True, 'import numpy as np\n'), ((1020, 1050), 'numpy.arctan', 'np.arctan', (['(delta[1] / delta[0])'], {}), '(delta[1] / delta[0])\n', (1029, 1050), ...
from scipy.interpolate import interp1d import numpy as np class WBP: def __init__(self, Nx, Ny, Nz): self.Nslice = Nx self.Nray = Ny self.Nproj = Nz self.recon = np.empty([self.Nslice, self.Nray, self.Nray], dtype=np.float32, order='F') def set...
[ "numpy.fft.ifft", "numpy.abs", "numpy.double", "numpy.empty", "numpy.fft.fft", "numpy.interp", "numpy.zeros", "numpy.log2", "numpy.sin", "numpy.arange", "numpy.cos", "numpy.lib.pad", "scipy.interpolate.interp1d" ]
[((203, 277), 'numpy.empty', 'np.empty', (['[self.Nslice, self.Nray, self.Nray]'], {'dtype': 'np.float32', 'order': '"""F"""'}), "([self.Nslice, self.Nray, self.Nray], dtype=np.float32, order='F')\n", (211, 277), True, 'import numpy as np\n'), ((898, 993), 'numpy.lib.pad', 'np.lib.pad', (['sinogram', '((0, F.size - sel...
import os import numpy as np import pytest from pennylane import qchem from openfermion.hamiltonians import MolecularData ref_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test_ref_files") table_1 = np.array( [ [0.0, 0.0, -32.70260436], [1.0, 1.0, -32.70260436], [0.0,...
[ "pennylane.qchem.one_particle", "numpy.allclose", "os.path.realpath", "pytest.raises", "numpy.array", "pytest.mark.parametrize", "os.path.join" ]
[((223, 1343), 'numpy.array', 'np.array', (['[[0.0, 0.0, -32.70260436], [1.0, 1.0, -32.70260436], [0.0, 2.0, -0.5581082],\n [1.0, 3.0, -0.5581082], [0.0, 6.0, 0.23519027], [1.0, 7.0, 0.23519027],\n [0.0, 10.0, 0.30460521], [1.0, 11.0, 0.30460521], [2.0, 0.0, -0.5581082\n ], [3.0, 1.0, -0.5581082], [2.0, 2.0, -...
""" Contains original YOLO anchors and associated utils """ import numpy as np YOLOV4_ANCHORS = [ np.array([(12, 16), (19, 36), (40, 28)], np.float32), np.array([(36, 75), (76, 55), (72, 146)], np.float32), np.array([(142, 110), (192, 243), (459, 401)], np.float32), ] YOLOV3_ANCHORS = [ np.array([(10,...
[ "numpy.array" ]
[((103, 155), 'numpy.array', 'np.array', (['[(12, 16), (19, 36), (40, 28)]', 'np.float32'], {}), '([(12, 16), (19, 36), (40, 28)], np.float32)\n', (111, 155), True, 'import numpy as np\n'), ((161, 214), 'numpy.array', 'np.array', (['[(36, 75), (76, 55), (72, 146)]', 'np.float32'], {}), '([(36, 75), (76, 55), (72, 146)]...
import logging import numpy as np from lcbuilder.LcBuild import LcBuild from lcbuilder.constants import CUTOUT_SIZE, LIGHTKURVE_CACHE_DIR from lcbuilder.objectinfo.MissionObjectInfo import MissionObjectInfo from lcbuilder.photometry.aperture_extractor import ApertureExtractor from lcbuilder.star import starinfo from l...
[ "lcbuilder.photometry.aperture_extractor.ApertureExtractor.from_pixels_to_boolean_mask", "lcbuilder.photometry.aperture_extractor.ApertureExtractor.from_boolean_mask", "logging.warning", "matplotlib.pyplot.close", "lightkurve.DesignMatrix", "lightkurve.KeplerCBVCorrector", "numpy.isnan", "logging.info...
[((826, 873), 'logging.info', 'logging.info', (['"""Retrieving star catalog info..."""'], {}), "('Retrieving star catalog info...')\n", (838, 873), False, 'import logging\n'), ((1359, 1406), 'logging.info', 'logging.info', (['"""Downloading lightcurve files..."""'], {}), "('Downloading lightcurve files...')\n", (1371, ...
import numba import numpy as np from loggingtools import log_with from numba import f8, i8 from crowddynamics.core.steering.quickest_path import distance_map, \ direction_map from crowddynamics.core.vector2D import normalize @log_with(arguments=False, timed=True) @numba.jit((f8[:, :], numba.types.Tuple((f8[:, :]...
[ "numpy.copy", "crowddynamics.core.vector2D.normalize", "loggingtools.log_with", "crowddynamics.core.steering.quickest_path.distance_map", "crowddynamics.core.steering.quickest_path.direction_map", "numpy.hypot", "numba.types.Tuple" ]
[((233, 270), 'loggingtools.log_with', 'log_with', ([], {'arguments': '(False)', 'timed': '(True)'}), '(arguments=False, timed=True)\n', (241, 270), False, 'from loggingtools import log_with\n'), ((3318, 3355), 'loggingtools.log_with', 'log_with', ([], {'arguments': '(False)', 'timed': '(True)'}), '(arguments=False, ti...
import numpy as np import matplotlib.pyplot as plt def threshold_function(x, threshold=0): return np.array(x>threshold, dtype=np.int32) def sigmoid(x): return 1 / (1 + np.exp(-x)) def relu(x): return np.maximum(0, x) def tanh(x): return np.tanh(x) x = np.arange(-10, 10, 0.01) y = tanh(x) plt.plot(...
[ "matplotlib.pyplot.show", "numpy.maximum", "matplotlib.pyplot.plot", "numpy.tanh", "numpy.array", "numpy.arange", "numpy.exp", "matplotlib.pyplot.grid" ]
[((273, 297), 'numpy.arange', 'np.arange', (['(-10)', '(10)', '(0.01)'], {}), '(-10, 10, 0.01)\n', (282, 297), True, 'import numpy as np\n'), ((311, 325), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (319, 325), True, 'import matplotlib.pyplot as plt\n'), ((327, 341), 'matplotlib.pyplot.grid', 'p...
import os import re import numpy as np from configobj import ConfigObj from file_handling import recording_io from util import detrending class Recording: """ class for dealing with individual files acquired with a probe, specifically for managing all files that are associated with a part...
[ "os.stat", "configobj.ConfigObj", "re.findall", "numpy.memmap", "os.path.join", "file_handling.recording_io.RecordingIo", "numpy.unique" ]
[((1645, 1687), 'os.path.join', 'os.path.join', (['self.input_folder', 'file_name'], {}), '(self.input_folder, file_name)\n', (1657, 1687), False, 'import os\n'), ((2501, 2539), 'file_handling.recording_io.RecordingIo', 'recording_io.RecordingIo', (['path', 'n_chan'], {}), '(path, n_chan)\n', (2525, 2539), False, 'from...
# Licensed under an MIT style license -- see LICENSE.md import numpy as np from pesummary.utils.decorators import array_input __author__ = [ "<NAME> <<EMAIL>>", "<NAME> <<EMAIL>>", "<NAME> <<EMAIL>>", ] def _dpsi(theta_jn, phi_jl, beta): """Calculate the difference between the polarization with resp...
[ "numpy.cross", "numpy.sign", "numpy.sin", "numpy.linalg.norm", "numpy.array", "numpy.inner", "numpy.cos", "pesummary.utils.decorators.array_input", "numpy.arccos" ]
[((944, 957), 'pesummary.utils.decorators.array_input', 'array_input', ([], {}), '()\n', (955, 957), False, 'from pesummary.utils.decorators import array_input\n'), ((1845, 1858), 'pesummary.utils.decorators.array_input', 'array_input', ([], {}), '()\n', (1856, 1858), False, 'from pesummary.utils.decorators import arra...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf import matplotlib matplotlib.use('Agg') import matplotlib.pylab as plt from scipy.misc import imsave import cv2 from model import Model from...
[ "cv2.GaussianBlur", "numpy.random.seed", "numpy.abs", "matplotlib.cm.get_cmap", "numpy.ones", "scipy.misc.imsave", "numpy.max", "numpy.reshape", "cv2.resize", "tensorflow.train.get_checkpoint_state", "place_cells.PlaceCells", "numpy.uint8", "tensorflow.train.Saver", "tensorflow.global_vari...
[((196, 217), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (210, 217), False, 'import matplotlib\n'), ((2036, 2053), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (2050, 2053), True, 'import numpy as np\n'), ((2074, 2087), 'data_manager.DataManager', 'DataManager', ([], {}), '(...
#! /usr/bin/env python """ Module with frame/cube filtering functionalities """ from __future__ import division __author__ = '<NAME> @ ULg' __all__ = ['frame_filter_highpass', 'frame_filter_lowpass', 'cube_filter_highpass', 'cube_filter_iuwt', 'frame_filter_gaussian2d', ...
[ "astropy.convolution.Gaussian2DKernel", "numpy.fft.ifftshift", "numpy.zeros_like", "photutils.aperture_photometry", "pyprind.ProgBar", "scipy.ndimage.gaussian_filter", "numpy.zeros", "numpy.array", "numpy.fft.fft2", "numpy.linspace", "scipy.ndimage.median_filter", "astropy.convolution.convolve...
[((1537, 1556), 'numpy.zeros_like', 'np.zeros_like', (['cube'], {}), '(cube)\n', (1550, 1556), True, 'import numpy as np\n'), ((1574, 1636), 'numpy.zeros', 'np.zeros', (['(cube.shape[0], coeff, cube.shape[1], cube.shape[2])'], {}), '((cube.shape[0], coeff, cube.shape[1], cube.shape[2]))\n', (1582, 1636), True, 'import ...
#! /usr/bin/env python """ Module for parsing and dealing with ST data formats. """ from collections import defaultdict from collections import namedtuple import csv import json import numpy as np from matplotlib.path import Path import cjson def readfq(fp): # this is a generator function """ <NAME>'s fasta/fa...
[ "numpy.load", "numpy.zeros_like", "csv.reader", "json.dumps", "collections.defaultdict", "matplotlib.path.Path", "cjson.decode", "collections.namedtuple" ]
[((2785, 2815), 'csv.reader', 'csv.reader', (['fh'], {'delimiter': '"""\t"""'}), "(fh, delimiter='\\t')\n", (2795, 2815), False, 'import csv\n'), ((2863, 2894), 'collections.namedtuple', 'namedtuple', (['"""DesignRow"""', 'header'], {}), "('DesignRow', header)\n", (2873, 2894), False, 'from collections import namedtupl...
import numpy as np from seq2seqSummariser import * from tensorflow.contrib.seq2seq.python.ops import beam_search_ops import time import tensorflow as tf import sys sys.path.append('/home/dwt17/MSc_project/neural_sum_1/code/Commons/') sys.path.append('../Commons/') from read_data import * from treatedData impor...
[ "sys.path.append", "numpy.sum", "tensorflow.train.import_meta_graph", "time.time", "tensorflow.InteractiveSession", "tensorflow.get_default_graph" ]
[((170, 239), 'sys.path.append', 'sys.path.append', (['"""/home/dwt17/MSc_project/neural_sum_1/code/Commons/"""'], {}), "('/home/dwt17/MSc_project/neural_sum_1/code/Commons/')\n", (185, 239), False, 'import sys\n'), ((241, 271), 'sys.path.append', 'sys.path.append', (['"""../Commons/"""'], {}), "('../Commons/')\n", (25...
# %% [37. Sudoku Solver](https://leetcode.com/problems/sudoku-solver/) import numpy as np class Solution: def solveSudoku(self, board: List[List[str]]) -> None: """ Do not return anything, modify board in-place instead. """ bd = np.vectorize(ord)(board) - 48 solve(bd) ...
[ "numpy.vectorize" ]
[((267, 284), 'numpy.vectorize', 'np.vectorize', (['ord'], {}), '(ord)\n', (279, 284), True, 'import numpy as np\n'), ((334, 351), 'numpy.vectorize', 'np.vectorize', (['chr'], {}), '(chr)\n', (346, 351), True, 'import numpy as np\n')]
import re import os import csv import codecs import pickle import argparse import xgboost as xgb import numpy as np import pandas as pd from nltk.corpus import stopwords from nltk.stem import SnowballStemmer from gensim.models import KeyedVectors from keras.preprocessing.text import Tokenizer from keras.preprocessing...
[ "csv.reader", "argparse.ArgumentParser", "numpy.sum", "keras.preprocessing.sequence.pad_sequences", "keras.models.Model", "os.path.isfile", "gensim.models.KeyedVectors.load_word2vec_format", "keras.layers.Input", "keras.layers.concatenate", "codecs.open", "xgboost.train", "keras.preprocessing....
[((805, 830), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (828, 830), False, 'import argparse\n'), ((7723, 7755), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {'num_words': 'MAX_NB_WORD'}), '(num_words=MAX_NB_WORD)\n', (7732, 7755), False, 'from keras.preprocessing.text import Tok...
# MIT License # # Copyright (c) 2019 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, pub...
[ "pylab.close", "pylab.get_cmap", "numpy.fromfile", "numpy.amax", "pylab.savefig", "numpy.shape", "pylab.figure", "numpy.reshape", "numpy.DataSource", "numpy.sqrt" ]
[((1310, 1325), 'numpy.DataSource', 'np.DataSource', ([], {}), '()\n', (1323, 1325), True, 'import numpy as np\n'), ((1419, 1455), 'numpy.fromfile', 'np.fromfile', (['filename'], {'dtype': 'numtype'}), '(filename, dtype=numtype)\n', (1430, 1455), True, 'import numpy as np\n'), ((1588, 1630), 'numpy.reshape', 'np.reshap...
import typing import numpy as np from robogym.envs.dactyl.common import cube_utils from robogym.goal.goal_generator import GoalGenerator from robogym.utils import rotation class FullUnconstrainedGoal(GoalGenerator): """ Rotate any face, no orientation objectives for the Z axis. """ def __init__( ...
[ "robogym.utils.rotation.normalize_angles", "numpy.zeros", "robogym.envs.dactyl.common.cube_utils.rotated_face_with_angle", "numpy.linalg.norm" ]
[((2425, 2560), 'robogym.envs.dactyl.common.cube_utils.rotated_face_with_angle', 'cube_utils.rotated_face_with_angle', (['cube_face', 'face_to_shift', 'random_state', 'self.round_target_face'], {'directions': 'self.goal_directions'}), '(cube_face, face_to_shift, random_state,\n self.round_target_face, directions=sel...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from collections import defaultdict import numpy as np with open('21a_data.txt', 'r') as f: input_data = f.read().split('\n')[:-1] translation_dictionary = dict() for line in input_data: old_pattern, new_pattern = line.rstrip(' ').split(' => ') old_pattern =...
[ "numpy.sum", "numpy.zeros", "numpy.flipud", "numpy.rot90", "numpy.array" ]
[((1257, 1318), 'numpy.array', 'np.array', (["[['.', '#', '.'], ['.', '.', '#'], ['#', '#', '#']]"], {}), "([['.', '#', '.'], ['.', '.', '#'], ['#', '#', '#']])\n", (1265, 1318), True, 'import numpy as np\n'), ((2494, 2515), 'numpy.sum', 'np.sum', (['start_pattern'], {}), '(start_pattern)\n', (2500, 2515), True, 'impor...
import os import tables import numpy as np def make_dirs(path): path = os.path.dirname(path) try: if not os.path.exists(path): os.makedirs(path) except OSError as e: if e.errno != errno.EEXIST: raise def cut_string(s, n=20): if len(s) > n: return '...' + s[3 - n::] return ' ' * (n - len(s)) + s def ...
[ "numpy.full", "os.makedirs", "os.path.dirname", "os.path.exists", "tables.StringAtom", "tables.IntAtom", "numpy.fromiter", "tables.open_file", "numpy.random.shuffle" ]
[((73, 94), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (88, 94), False, 'import os\n'), ((393, 417), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (407, 417), False, 'import os\n'), ((474, 510), 'tables.open_file', 'tables.open_file', (['filename'], {'mode': '"""w"""'}),...
import os GPU_FLAG = os.getenv('SETIGEN_ENABLE_GPU', '0') if GPU_FLAG == '1': try: import cupy as xp except ImportError: import numpy as xp else: import numpy as xp import numpy as np import time def get_pfb_waterfall(pfb_voltages_x, pfb_voltages_y=None, fftlength=256, int_factor=1):...
[ "numpy.abs", "numpy.fft.fft", "numpy.frombuffer", "numpy.zeros", "numpy.fft.fftshift", "os.getenv", "numpy.concatenate" ]
[((22, 58), 'os.getenv', 'os.getenv', (['"""SETIGEN_ENABLE_GPU"""', '"""0"""'], {}), "('SETIGEN_ENABLE_GPU', '0')\n", (31, 58), False, 'import os\n'), ((985, 1073), 'numpy.zeros', 'xp.zeros', (['(pfb_voltages_x.shape[1], pfb_voltages_x.shape[0] // fftlength, fftlength)'], {}), '((pfb_voltages_x.shape[1], pfb_voltages_x...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import argparse import cv2 from maskrcnn_benchmark.config import cfg from predictor import COCODemo from refinenet.code.linemod_tools import LabelInfo import time import os import json import numpy as np import glob from evaluation.evaluation imp...
[ "numpy.stack", "json.load", "argparse.ArgumentParser", "os.path.join", "predictor.COCODemo", "numpy.power", "cv2.imread", "numpy.where", "maskrcnn_benchmark.config.cfg.merge_from_list", "maskrcnn_benchmark.config.cfg.merge_from_file", "numpy.array", "glob.glob", "plyfile.PlyData.read", "ma...
[((397, 472), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Object Detection Webcam Demo"""'}), "(description='PyTorch Object Detection Webcam Demo')\n", (420, 472), False, 'import argparse\n'), ((1666, 1703), 'maskrcnn_benchmark.config.cfg.merge_from_file', 'cfg.merge_from_file...
# coding: utf-8 # # The Linear Model II # # <hr> # # * linear classification | classification error | perceptron learning algorithm, pocket algorithm, ... # * linear regression | squared error | pseudo-inverse, ... # * third linear model (logistic regression) | cross-entropy error | gradient descent, ... # * nonlin...
[ "matplotlib.pyplot.title", "numpy.random.seed", "numpy.ones", "matplotlib.pyplot.figure", "numpy.mean", "matplotlib.pyplot.contour", "numpy.exp", "numpy.linalg.norm", "numpy.set_printoptions", "numpy.meshgrid", "matplotlib.pyplot.colorbar", "numpy.max", "numpy.linspace", "sympy.simplify", ...
[((3167, 3179), 'sympy.var', 'var', (['"""x y w"""'], {}), "('x y w')\n", (3170, 3179), False, 'from sympy import var, diff, exp, latex, factor, log, simplify\n'), ((7611, 7643), 'numpy.array', 'np.array', (['[1, 0, 0, 0, 0.0, 1.0]'], {}), '([1, 0, 0, 0, 0.0, 1.0])\n', (7619, 7643), True, 'import numpy as np\n'), ((765...
from DrawingInterface import DrawingInterface import pydiffvg import torch import skimage import skimage.io import random import ttools.modules import argparse import math import torchvision import torchvision.transforms as transforms import numpy as np import PIL.Image from util import str2bool def bound(value, lo...
[ "numpy.uint8", "pydiffvg.RenderFunction.serialize_scene", "numpy.transpose", "pydiffvg.get_device", "numpy.clip", "random.random", "torch.optim.Adam", "torch.cuda.is_available", "pydiffvg.save_svg", "torch.device", "torch.zeros", "torch.no_grad", "pydiffvg.set_device", "torch.tensor" ]
[((7476, 7491), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7489, 7491), False, 'import torch\n'), ((8241, 8256), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (8254, 8256), False, 'import torch\n'), ((1832, 1852), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (1844, 1852), False, '...