code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from .model import ModelOCR import torch import numpy as np class Vocab(): def __init__(self, chars): self.pad = 0 self.go = 1 self.eos = 2 self.mask_token = 3 self.chars = chars self.c2i = {c:i+4 for i, c in enumerate(chars)} self.i2c = {i+4:c for i, c in ...
[ "torch.topk", "torch.LongTensor", "numpy.asarray", "torch.device", "torch.no_grad" ]
[((3371, 3390), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (3383, 3390), False, 'import torch\n'), ((1148, 1163), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1161, 1163), False, 'import torch\n'), ((1833, 1854), 'torch.topk', 'torch.topk', (['output', '(2)'], {}), '(output, 2)\n', (1843,...
#Python code for chapter 23 DSILT: Statistics ''' ------------------------------------------------------------------------------- -----------------------Combinations and Permutations--------------------------- ------------------------------------------------------------------------------- ''' import math def permuta...
[ "matplotlib.pyplot.title", "pymc3.sample", "pymc3.glm.families.Normal", "numpy.sum", "pandas.read_csv", "numpy.random.randint", "numpy.mean", "numpy.random.normal", "pymc3.Laplace.dist", "matplotlib.pyplot.tight_layout", "pymc3.sample_ppc", "pymc3.NUTS", "pymc3.Metropolis", "scipy.stats.la...
[((865, 906), 'numpy.random.binomial', 'np.random.binomial', ([], {'n': '(1)', 'p': '(0.5)', 'size': '(1000)'}), '(n=1, p=0.5, size=1000)\n', (883, 906), True, 'import numpy as np\n'), ((1137, 1168), 'numpy.random.randint', 'np.random.randint', (['(2)'], {'size': '(1000)'}), '(2, size=1000)\n', (1154, 1168), True, 'imp...
import numpy as np import tensorflow as tf from tensorflow import keras import tensorflow_datasets as tfds from sklearn import datasets from sklearn.metrics import hinge_loss from sklearn.model_selection import train_test_split from sklearn.preprocessing import normalize import matplotlib.pyplot as plt np.random.seed(...
[ "sklearn.datasets.load_digits", "numpy.random.seed", "tensorflow_datasets.load", "tensorflow_datasets.as_numpy", "matplotlib.pyplot.scatter", "sklearn.model_selection.train_test_split", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.where", "sklearn.preprocessing.normalize", "numpy.eye", "m...
[((305, 322), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (319, 322), True, 'import numpy as np\n'), ((2079, 2092), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (2089, 2092), True, 'import matplotlib.pyplot as plt\n'), ((2115, 2137), 'numpy.where', 'np.where', (['(Y_train == 1)']...
import hashlib from collections import OrderedDict import numpy as np from .parametrization import PiecewiseParametrization class Vertex: def __init__(self, t, x, idx): self.t = t self.x = x self.idx = idx @property def tx(self): return (self.t, self.x) def __repr__...
[ "numpy.argsort", "collections.OrderedDict.fromkeys", "numpy.sum", "numpy.sqrt" ]
[((8038, 8065), 'collections.OrderedDict.fromkeys', 'OrderedDict.fromkeys', (['roots'], {}), '(roots)\n', (8058, 8065), False, 'from collections import OrderedDict\n'), ((12801, 12816), 'numpy.sum', 'np.sum', (['eta_sqr'], {}), '(eta_sqr)\n', (12807, 12816), True, 'import numpy as np\n'), ((14171, 14186), 'numpy.sum', ...
from django.shortcuts import render from django.shortcuts import render_to_response import django.http # to raise 404's from django.http import HttpResponse from django.http import HttpResponseRedirect from django.template import Context, Template, loader from django.views.decorators.cache import cache_control from dja...
[ "django.contrib.sessions.backends.db.SessionStore", "pyeq3.Models_3D.Spline.Spline", "django.views.decorators.cache.cache_control", "os.path.isfile", "sys.stdout.flush", "sys.exc_info", "os.nice", "django.http.HttpResponseRedirect", "os.path.join", "inspect.getmembers", "multiprocessing.cpu_coun...
[((1454, 1482), 'django.views.decorators.cache.cache_control', 'cache_control', ([], {'no_cache': '(True)'}), '(no_cache=True)\n', (1467, 1482), False, 'from django.views.decorators.cache import cache_control\n'), ((1484, 1506), 'brake.decorators.ratelimit', 'ratelimit', ([], {'rate': '"""12/m"""'}), "(rate='12/m')\n",...
from . import TradingStrategy, Transaction import pandas as pd import numpy as np class KeepTheCash(TradingStrategy): '''Strategy which does exactly nothing.''' name = 'KeepTheCash' symbols = [] weights = [] cash_buffer = 0.0 frequency = None data_span = pd.Timedelta('1W') def reques...
[ "numpy.abs", "numpy.sum", "pandas.tseries.offsets.Week", "pandas.tseries.offsets.QuarterBegin", "pandas.Timedelta" ]
[((286, 304), 'pandas.Timedelta', 'pd.Timedelta', (['"""1W"""'], {}), "('1W')\n", (298, 304), True, 'import pandas as pd\n'), ((613, 631), 'pandas.Timedelta', 'pd.Timedelta', (['"""1W"""'], {}), "('1W')\n", (625, 631), True, 'import pandas as pd\n'), ((1612, 1645), 'pandas.tseries.offsets.QuarterBegin', 'pd.tseries.off...
import os import numpy import torch from torch.utils.data import DataLoader from torch.utils.data.sampler import SubsetRandomSampler from torchvision import datasets from torchvision import transforms # global variables # can change from outside random_scale = (0.4, 1.0) mean = [0.5, 0.5, 0.5] std = [0.2, 0.2, 0.2]...
[ "torch.utils.data.sampler.SubsetRandomSampler", "torch.utils.data.DataLoader", "torchvision.transforms.RandomHorizontalFlip", "torch.sqrt", "torch.load", "torchvision.transforms.Normalize", "torch.mul", "torchvision.datasets.ImageFolder", "torch.Tensor", "torch.cuda.is_available", "torchvision.t...
[((1482, 1530), 'torchvision.datasets.ImageFolder', 'datasets.ImageFolder', (['train_dir', 'train_transform'], {}), '(train_dir, train_transform)\n', (1502, 1530), False, 'from torchvision import datasets\n'), ((1550, 1627), 'torch.utils.data.DataLoader', 'DataLoader', (['train_dataset'], {'batch_size': '(1)', 'num_wor...
# pylint: disable=missing-module-docstring # pylint: disable=missing-class-docstring # pylint: disable=missing-function-docstring import unittest from unittest import mock import numpy as np from dl.data.utils import DataSource, DataLoader from ..nn import Sequential, Dense from ..act import ReLU, Sigmoid from ..opt i...
[ "unittest.main", "unittest.mock.patch.object", "numpy.random.seed", "numpy.random.randn", "numpy.seterr", "dl.data.utils.DataSource" ]
[((393, 415), 'numpy.seterr', 'np.seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (402, 415), True, 'import numpy as np\n'), ((1173, 1214), 'unittest.mock.patch.object', 'mock.patch.object', (['Dense', '"""update_params"""'], {}), "(Dense, 'update_params')\n", (1190, 1214), False, 'from unittest import mock\n...
# -*- coding: utf-8 -*- """ file: raccoon_ids_script.py @author: Suhail.Alnahari @description: @created: 2021-04-06T10:48:08.072Z-05:00 @last-modified: 2021-04-06T16:50:40.059Z-05:00 """ # standard library # 3rd party packages # local source import pandas as pd import numpy as np from typing import List, Dict im...
[ "pandas.read_csv", "datetime.datetime.strptime", "numpy.unique" ]
[((4625, 4660), 'pandas.read_csv', 'pd.read_csv', (['labelPath'], {'header': 'None'}), '(labelPath, header=None)\n', (4636, 4660), True, 'import pandas as pd\n'), ((3587, 3605), 'numpy.unique', 'np.unique', (['species'], {}), '(species)\n', (3596, 3605), True, 'import numpy as np\n'), ((3834, 3878), 'datetime.datetime....
# Copyright 2019 IBM Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "numpy.reshape", "numpy.concatenate" ]
[((2171, 2206), 'numpy.concatenate', 'np.concatenate', (['np_datasets'], {'axis': '(1)'}), '(np_datasets, axis=1)\n', (2185, 2206), True, 'import numpy as np\n'), ((2049, 2097), 'numpy.reshape', 'np.reshape', (['np_dataset', '(np_dataset.shape[0], 1)'], {}), '(np_dataset, (np_dataset.shape[0], 1))\n', (2059, 2097), Tru...
import os import warnings import math import numpy as np import matplotlib as mpl import matplotlib.patches as patches from matplotlib.path import Path from matplotlib.collections import PatchCollection from pleiades import ArbitraryPoints, RectangularCoil, MagnetRing, Device class TREXCoil(ArbitraryPoints): """T...
[ "numpy.sum", "numpy.amin", "pleiades.MagnetRing", "numpy.empty", "matplotlib.patches.Wedge", "numpy.mod", "numpy.amax", "matplotlib.path.Path", "pleiades.RectangularCoil", "numpy.sin", "numpy.array", "numpy.arange", "numpy.linspace", "numpy.cos" ]
[((450, 486), 'numpy.linspace', 'np.linspace', (['(-0.105469)', '(0.105469)', '(16)'], {}), '(-0.105469, 0.105469, 16)\n', (461, 486), True, 'import numpy as np\n'), ((501, 528), 'numpy.linspace', 'np.linspace', (['(0)', '(0.067083)', '(6)'], {}), '(0, 0.067083, 6)\n', (512, 528), True, 'import numpy as np\n'), ((1457,...
""" This module contains conjugate gradient method and svrg method """ import numpy def conjugate_solver(A, b, lam, tol=1e-16, max_iter=1000): """ conjugate gradient method solve (A^T * A + lam * I) * w = b. """ d = A.shape[1] b = b.reshape(d, 1) tol = tol * numpy.linalg.norm(b) w = nu...
[ "numpy.multiply", "numpy.subtract", "numpy.copy", "numpy.ceil", "numpy.zeros", "numpy.linalg.norm", "numpy.random.choice", "numpy.dot", "numpy.add", "numpy.sqrt" ]
[((318, 337), 'numpy.zeros', 'numpy.zeros', (['(d, 1)'], {}), '((d, 1))\n', (329, 337), False, 'import numpy\n'), ((439, 452), 'numpy.copy', 'numpy.copy', (['r'], {}), '(r)\n', (449, 452), False, 'import numpy\n'), ((1331, 1350), 'numpy.zeros', 'numpy.zeros', (['(d, 1)'], {}), '((d, 1))\n', (1342, 1350), False, 'import...
def pretty_print_review_and_label(i): print(labels[i] + '\t:\t' + reviews[i][:80] + '...') g = open('/Users/yp/study/udacity/DLNF/udacity_DLNF/Part1.NeuralNetworks/L7.SentimentAnalysis/reviews.txt', 'r') reviews = list(map(lambda x: x[:-1], g.readlines())) g.close() g = open('/Users/yp/study/udacity/DLNF/udacity...
[ "numpy.random.seed", "numpy.zeros", "time.time", "numpy.exp", "numpy.random.normal", "numpy.dot" ]
[((1971, 1988), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1985, 1988), True, 'import numpy as np\n'), ((2945, 2985), 'numpy.zeros', 'np.zeros', ([], {'shape': '(1, self.input_node_cnt)'}), '(shape=(1, self.input_node_cnt))\n', (2953, 2985), True, 'import numpy as np\n'), ((3015, 3056), 'numpy.zero...
# http://people.duke.edu/~ccc14/sta-663-2016/16A_MCMC.html import numpy as np import matplotlib.pyplot as plt from scipy import stats thetas = np.linspace(0, 1, 200) n = 100 h = 61 a = 10 b = 10 def target(lik, prior, n, h, theta): if theta < 0 or theta > 1: return 0 else: return li...
[ "matplotlib.pyplot.xlim", "numpy.random.uniform", "scipy.stats.norm", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "numpy.arange", "numpy.linspace", "scipy.stats.beta" ]
[((148, 170), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(200)'], {}), '(0, 1, 200)\n', (159, 170), True, 'import numpy as np\n'), ((764, 780), 'scipy.stats.beta', 'stats.beta', (['a', 'b'], {}), '(a, b)\n', (774, 780), False, 'from scipy import stats\n'), ((960, 981), 'matplotlib.pyplot.xlim', 'plt.xlim', (['[0...
#!/usr/bin/env python3 ### Eval option 1: onnxruntime import numpy as np import onnxruntime as rt sess = rt.InferenceSession("test.onnx") input_name = sess.get_inputs()[0].name img = np.ones((3, 3)).astype(np.float32) pred_onx = sess.run(None, {input_name: img})[0] print(pred_onx) ### Expected output: """ [[667. 6...
[ "onnxruntime.InferenceSession", "numpy.ones" ]
[((109, 141), 'onnxruntime.InferenceSession', 'rt.InferenceSession', (['"""test.onnx"""'], {}), "('test.onnx')\n", (128, 141), True, 'import onnxruntime as rt\n'), ((187, 202), 'numpy.ones', 'np.ones', (['(3, 3)'], {}), '((3, 3))\n', (194, 202), True, 'import numpy as np\n')]
from __future__ import print_function, division import numpy as np from PyAstronomy.pyaC import pyaErrors as PE import six.moves as smo def expCorrRN(n, tau, mean=0.0, std=1.0, rnos=None, fullOut=False): """ Generate exponentially correlated random numbers. This procedure implements the prescription giv...
[ "six.moves.range", "numpy.zeros", "PyAstronomy.pyaC.pyaErrors.PyAValError", "numpy.exp", "numpy.random.normal", "numpy.sqrt" ]
[((2180, 2191), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (2188, 2191), True, 'import numpy as np\n'), ((2248, 2266), 'numpy.exp', 'np.exp', (['(-1.0 / tau)'], {}), '(-1.0 / tau)\n', (2254, 2266), True, 'import numpy as np\n'), ((2307, 2328), 'numpy.sqrt', 'np.sqrt', (['(1.0 - f ** 2)'], {}), '(1.0 - f ** 2)\n',...
import data.murray_data_loader as data_loader from data import util import model.penman_monteith.penman_monteith as penman_monteith import model.storage.objective_hysteresis_model as ohm from collections import namedtuple import numpy as np import pandas as pd import seaborn as seaborn import matplotlib.pyplot as plt f...
[ "pandas.DataFrame", "model.storage.objective_hysteresis_model.calculate_storage_heat_flux", "seaborn.heatmap", "matplotlib.pyplot.close", "model.penman_monteith.penman_monteith.calc_sensible_and_latent_heat", "data.murray_data_loader.get_surface_data", "collections.namedtuple", "numpy.linspace", "da...
[((4789, 4824), 'collections.namedtuple', 'namedtuple', (['"""vars"""', "['mean', 'std']"], {}), "('vars', ['mean', 'std'])\n", (4799, 4824), False, 'from collections import namedtuple\n'), ((1459, 1488), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(7, 10)'}), '(figsize=(7, 10))\n', (1471, 1488), Tr...
""" Copyright (c) 2022 ZOOMi Technologies Inc. all rights reserved. This source code is licensed under the license found in the LICENSE file in the root directory of this source tree. maintainers : <EMAIL>, <EMAIL>, <EMAIL> This python script handles the dataset creation process. """ import os import sys from bson...
[ "os.mkdir", "os.remove", "s3_manager.s3_bucket_manager", "numpy.arange", "shutil.rmtree", "os.path.join", "shutil.make_archive", "cv2.imwrite", "os.path.exists", "augmentation_processor.augment_one_image", "datetime.timedelta", "traceback.format_exc", "configparser.ConfigParser", "datetime...
[((864, 901), 'configparser.ConfigParser', 'configparser.ConfigParser', (['os.environ'], {}), '(os.environ)\n', (889, 901), False, 'import configparser\n'), ((2312, 2389), 'mongo_manager.MongoDBmanager', 'MongoDBmanager', (['self.MDB_USER', 'self.MDB_PASS', 'self.MDB_NAME', '"""AnnotationTask"""'], {}), "(self.MDB_USER...
__author__ = 'satra' import numpy as np from scipy.spatial.distance import pdist, squareform import scipy.sparse as sps def distcorr(X, Y): """ Compute the distance correlation function >>> a = [1,2,3,4,5] >>> b = np.array([1,2,9,4,4]) >>> distcorr(a, b) 0.762676242417 """ def allsame(x)...
[ "sklearn.metrics.pairwise_distances", "numpy.allclose", "numpy.ones", "numpy.argsort", "numpy.sort", "scipy.sparse.csr_matrix", "scipy.spatial.distance.pdist", "numpy.exp", "numpy.atleast_1d", "numpy.sqrt", "numpy.round", "numpy.prod", "numpy.atleast_2d" ]
[((490, 506), 'numpy.atleast_1d', 'np.atleast_1d', (['X'], {}), '(X)\n', (503, 506), True, 'import numpy as np\n'), ((515, 531), 'numpy.atleast_1d', 'np.atleast_1d', (['Y'], {}), '(Y)\n', (528, 531), True, 'import numpy as np\n'), ((656, 672), 'numpy.atleast_2d', 'np.atleast_2d', (['X'], {}), '(X)\n', (669, 672), True,...
import ray import tqdm import yaml import numpy as np import torch import wandb import matplotlib.pyplot as plt import torch.nn.functional as F from lav.models.rgb import RGBSegmentationModel from lav.utils.logger import Logger from lav.utils.datasets.point_paint_dataset import PointPaintDataset from lav.utils import _...
[ "ray.init", "tqdm.tqdm", "ray.remote", "argparse.ArgumentParser", "lav.utils.visualization.lidar_to_bev", "matplotlib.pyplot.close", "ray.get", "torch.load", "wandb.init", "lav.utils.datasets.point_paint_dataset.PointPaintDataset", "lav.utils.point_painting.point_painting", "torch.device", "...
[((1348, 1376), 'ray.remote', 'ray.remote', ([], {'num_gpus': '(1.0 / 4)'}), '(num_gpus=1.0 / 4)\n', (1358, 1376), False, 'import ray\n'), ((2655, 2720), 'ray.init', 'ray.init', ([], {'logging_level': '(30)', 'local_mode': '(False)', 'log_to_driver': '(False)'}), '(logging_level=30, local_mode=False, log_to_driver=Fals...
import argos.io as io import argos.plot as tplot import matplotlib.pyplot as plt import numpy as np import hdbscan from sklearn import metrics import argos.cluster as cluster traj_list = io.load("1_traj_seg.dt") traj_list = traj_list[:1000] ''' D = io.load_distance_matrix("distance1.npz") D = D[:1000,:1000] ''' #D =...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "argos.cluster.kMedoids", "numpy.sum", "numpy.fromfile", "matplotlib.pyplot.ylabel", "sklearn.metrics.silhouette_score", "argos.plot.plot_map", "argos.io.load", "argos.plot.plot_traj", "matplotlib.pyplot.xlabel" ]
[((188, 212), 'argos.io.load', 'io.load', (['"""1_traj_seg.dt"""'], {}), "('1_traj_seg.dt')\n", (195, 212), True, 'import argos.io as io\n'), ((399, 436), 'numpy.fromfile', 'np.fromfile', (['"""dense.dat"""'], {'dtype': 'float'}), "('dense.dat', dtype=float)\n", (410, 436), True, 'import numpy as np\n'), ((495, 517), '...
import pickle import numpy as np import soundfile as sf from scipy import signal from scipy.signal import get_window from librosa.filters import mel from numpy.random import RandomState from model_bl import D_VECTOR from model_vc import Generator from collections import OrderedDict import torch import librosa from s...
[ "numpy.fft.rfft", "numpy.abs", "argparse.ArgumentParser", "numpy.maximum", "numpy.clip", "librosa.filters.mel", "librosa.core.load", "pathlib.Path", "numpy.mean", "glob.glob", "torch.device", "torch.no_grad", "model_bl.D_VECTOR", "numpy.pad", "synthesis.build_model", "scipy.signal.get_...
[((495, 558), 'scipy.signal.butter', 'signal.butter', (['order', 'normal_cutoff'], {'btype': '"""high"""', 'analog': '(False)'}), "(order, normal_cutoff, btype='high', analog=False)\n", (508, 558), False, 'from scipy import signal\n'), ((885, 949), 'numpy.lib.stride_tricks.as_strided', 'np.lib.stride_tricks.as_strided'...
import numpy as np import matplotlib.pyplot as plt print((-2000**(2/3))) print((abs(-2000)**(2/3))) print((abs(-2000**(2/3)))) print(((-2000)**(2/3)).real) exit() t_nought = 10 A = 1 L = np.linspace(0.001,40000, 1000000) sigma_t = 1 front = 1/np.sqrt(2*np.pi*sigma_t**2) def P_L(L): return front * np.exp(-0.5...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "numpy.random.uniform", "matplotlib.pyplot.show", "matplotlib.pyplot.hist", "matplotlib.pyplot.plot", "numpy.argmax", "numpy.exp", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "numpy.sqrt" ]
[((191, 225), 'numpy.linspace', 'np.linspace', (['(0.001)', '(40000)', '(1000000)'], {}), '(0.001, 40000, 1000000)\n', (202, 225), True, 'import numpy as np\n'), ((430, 440), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (438, 440), True, 'import matplotlib.pyplot as plt\n'), ((1217, 1254), 'matplotlib.pyplot...
import os import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import torch from sklearn.linear_model import LogisticRegression from sklearn.metrics import f1_score from sklearn.svm import SVC from utils.args_parser import mkdir from utils.constants import Cte...
[ "pandas.DataFrame", "os.path.join", "sklearn.svm.SVC", "matplotlib.pyplot.close", "torch.norm", "numpy.std", "sklearn.linear_model.LogisticRegression", "sklearn.metrics.f1_score", "numpy.mean", "seaborn.distplot", "utils.metrics.mmd.MMDLoss", "seaborn.pairplot", "utils.args_parser.mkdir", ...
[((4228, 4243), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (4241, 4243), False, 'import torch\n'), ((7180, 7195), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7193, 7195), False, 'import torch\n'), ((579, 634), 'utils.metrics.mmd.MMDLoss', 'MMDLoss', ([], {'kernel_mul': '(2.0)', 'kernel_num': '(5)', 'n...
"""Rescale approximate roguing rate ucing OL control to find global optimal strategy.""" from IPython import embed import argparse import copy import csv import json import logging import os import numpy as np from scipy.optimize import minimize from scipy.interpolate import interp1d from mixed_stand_model import par...
[ "numpy.sum", "argparse.ArgumentParser", "mixed_stand_model.mixed_stand_simulator.MixedStandSimulator", "logging.Formatter", "numpy.product", "mixed_stand_model.utils.get_setup_params", "numpy.arange", "scipy.interpolate.interp1d", "os.path.join", "mixed_stand_model.mixed_stand_approx.MixedStandApp...
[((706, 835), 'mixed_stand_model.utils.get_setup_params', 'utils.get_setup_params', (['parameters.CORRECTED_PARAMS'], {'scale_inf': '(True)', 'host_props': 'parameters.COBB_PROP_FIG4A', 'extra_spread': '(True)'}), '(parameters.CORRECTED_PARAMS, scale_inf=True,\n host_props=parameters.COBB_PROP_FIG4A, extra_spread=Tr...
# Q-learning agent for HallucinIce. # The goal for the agent is to discover wich combination of Hallucination will be better to defeat Terran # Kudos to <NAME> and to MorvanZhou import random import math import numpy as np import pandas as pd from pysc2.agents import base_agent from pysc2.lib import actions from p...
[ "pandas.DataFrame", "numpy.random.uniform", "pysc2.lib.actions.FunctionCall", "pysc2.lib.actions.FUNCTIONS.select_army", "numpy.random.choice", "numpy.random.permutation" ]
[((2795, 2847), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'self.actions', 'dtype': 'np.float64'}), '(columns=self.actions, dtype=np.float64)\n', (2807, 2847), True, 'import pandas as pd\n'), ((8214, 8246), 'pysc2.lib.actions.FunctionCall', 'actions.FunctionCall', (['_NO_OP', '[]'], {}), '(_NO_OP, [])\n', (82...
import numpy as np import boto3, json, time, datetime, sys import matplotlib.pyplot as plt from pytz import timezone from CloudExtras import array_get # Timings for gradient computation w/ batch. # Make sure, no other batch jobs are currently running or in a batch queue!! lambda_client = boto3.client('lambda') s3_cli...
[ "json.load", "boto3.client", "numpy.zeros", "json.dumps", "time.sleep", "CloudExtras.array_get", "pytz.timezone", "datetime.datetime.now" ]
[((291, 313), 'boto3.client', 'boto3.client', (['"""lambda"""'], {}), "('lambda')\n", (303, 313), False, 'import boto3, json, time, datetime, sys\n'), ((326, 344), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (338, 344), False, 'import boto3, json, time, datetime, sys\n'), ((360, 381), 'boto3.client'...
import os import argparse import numpy as np import carla_rllib from carla_rllib.environments.carla_envs.base_env import make_env from carla_rllib.environments.carla_envs.config import BaseConfig from carla_rllib.utils.clean_up import clear_carla def run_test(config): """Base env test Mandatory configuration...
[ "carla_rllib.utils.clean_up.clear_carla", "os.path.abspath", "argparse.ArgumentParser", "carla_rllib.environments.carla_envs.base_env.make_env", "carla_rllib.environments.carla_envs.config.BaseConfig", "numpy.sin", "os.path.join" ]
[((1568, 1622), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""CARLA RLLIB ENV"""'}), "(description='CARLA RLLIB ENV')\n", (1591, 1622), False, 'import argparse\n'), ((2031, 2054), 'carla_rllib.environments.carla_envs.config.BaseConfig', 'BaseConfig', (['args.config'], {}), '(args.config...
import os import sys import copy import random import logging import jsonpickle from time import strftime import numpy import simpy import simpy.util from phantom.dag import Block, DAG, MaliciousDAG from .miner import Miner, MaliciousMiner from .network import Network from typing import Callable, Iterable class Si...
[ "copy.deepcopy", "os.makedirs", "logging.basicConfig", "os.getcwd", "logging.StreamHandler", "time.strftime", "random.random", "numpy.random.poisson", "simpy.Environment", "os.path.join", "jsonpickle.encode" ]
[((562, 605), 'os.path.join', 'os.path.join', (['_DEFAULT_RESULTS_PATH', '"""logs"""'], {}), "(_DEFAULT_RESULTS_PATH, 'logs')\n", (574, 605), False, 'import os\n'), ((740, 789), 'os.path.join', 'os.path.join', (['_DEFAULT_RESULTS_PATH', '"""simulation"""'], {}), "(_DEFAULT_RESULTS_PATH, 'simulation')\n", (752, 789), Fa...
import os import math import hither2 as hi from hither2.dockerimage import RemoteDockerImage import kachery_client as kc import numpy as np from sortingview.config import job_cache, job_handler from sortingview.serialize_wrapper import serialize_wrapper from sortingview.helpers import get_unit_waveforms_from_snippets_h...
[ "numpy.sum", "hither2.Config", "kachery_client.taskfunction", "sortingview.helpers.get_unit_waveforms_from_snippets_h5", "numpy.std", "sortingview.helpers.prepare_snippets_h5.run", "math.floor", "numpy.ones", "hither2.dockerimage.RemoteDockerImage", "numpy.mean", "sklearn.decomposition.PCA", "...
[((377, 450), 'kachery_client.taskfunction', 'kc.taskfunction', (['"""individual_cluster_features.1"""'], {'type': '"""pure-calculation"""'}), "('individual_cluster_features.1', type='pure-calculation')\n", (392, 450), True, 'import kachery_client as kc\n'), ((962, 1029), 'kachery_client.taskfunction', 'kc.taskfunction...
#!/usr/bin/env python3 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import time from tqdm import tqdm import numpy as np import cv2 from skimage import measure # RESNET: import these for slim version of resnet import tensorflow as tf from tensorflow.python.framework import meta_graph import scipy import collectio...
[ "tensorflow.nn.softmax", "tensorflow.python.framework.meta_graph.read_meta_graph_file", "cv2.polylines", "tensorflow.train.Saver", "numpy.copy", "cv2.cvtColor", "cv2.imwrite", "numpy.zeros", "os.path.exists", "tensorflow.Session", "numpy.expand_dims", "tensorflow.placeholder", "tensorflow.Co...
[((1614, 1652), 'skimage.measure.find_contours', 'measure.find_contours', (['prob', 'FLAGS.cth'], {}), '(prob, FLAGS.cth)\n', (1635, 1652), False, 'from skimage import measure\n'), ((1681, 1719), 'cv2.cvtColor', 'cv2.cvtColor', (['prob', 'cv2.COLOR_GRAY2BGR'], {}), '(prob, cv2.COLOR_GRAY2BGR)\n', (1693, 1719), False, '...
# Copyright 2021 Huawei Technologies Co., Ltd # # 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...
[ "os.makedirs", "argparse.ArgumentParser", "numpy.empty", "numpy.float32", "numpy.expand_dims", "cv2.imread", "numpy.min", "numpy.max", "numpy.array", "numpy.round", "os.path.join", "cv2.resize" ]
[((871, 922), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process file"""'}), "(description='Process file')\n", (894, 922), False, 'import argparse\n'), ((1204, 1258), 'os.path.join', 'os.path.join', (['args_opt.val_dataset_folder', '"""label.txt"""'], {}), "(args_opt.val_dataset_fold...
from ..BaseModel import BaseModel from ....api import utils as mu import numpy as np from sklearn import preprocessing import sklearn.svm as svm from sklearn.utils import shuffle from sklearn.model_selection import RandomizedSearchCV import scipy def init(verbose, feature_set, class_set): return PostureClassifier(...
[ "numpy.argmax", "sklearn.preprocessing.MinMaxScaler", "numpy.logical_not", "sklearn.model_selection.RandomizedSearchCV", "numpy.any", "numpy.max", "numpy.logical_or", "scipy.stats.expon", "sklearn.svm.SVC", "sklearn.utils.shuffle" ]
[((892, 956), 'numpy.any', 'np.any', (['(train_df.iloc[:, 0].values != class_df.iloc[:, 0].values)'], {}), '(train_df.iloc[:, 0].values != class_df.iloc[:, 0].values)\n', (898, 956), True, 'import numpy as np\n'), ((1353, 1388), 'sklearn.preprocessing.MinMaxScaler', 'preprocessing.MinMaxScaler', (['(-1, 1)'], {}), '((-...
import numpy as np import matplotlib.pyplot as plt # Here's how to plot your calibration lines helium = np.load('/h/mulan0/data/working/K225b_ut161027_28/multipleapertures/aperture_605_1333/extracted_He.npy')[()] neon = np.load('/h/mulan0/data/working/K225b_ut161027_28/multipleapertures/aperture_605_1333/extracted_Ne....
[ "numpy.load", "matplotlib.pyplot.plot" ]
[((448, 496), 'matplotlib.pyplot.plot', 'plt.plot', (["helium['w']", "helium[6.0]['raw_counts']"], {}), "(helium['w'], helium[6.0]['raw_counts'])\n", (456, 496), True, 'import matplotlib.pyplot as plt\n'), ((497, 541), 'matplotlib.pyplot.plot', 'plt.plot', (["neon['w']", "neon[6.0]['raw_counts']"], {}), "(neon['w'], ne...
""" ============================================================================= Manifold learning on handwritten digits: Locally Linear Embedding, Isomap... ============================================================================= We illustrate various embedding techniques on the digits dataset. """ print(__doc...
[ "sklearn.datasets.load_digits", "numpy.sum", "sklearn.preprocessing.MinMaxScaler", "sklearn.manifold.LocallyLinearEmbedding", "sklearn.random_projection.SparseRandomProjection", "sklearn.ensemble.RandomTreesEmbedding", "sklearn.manifold.MDS", "matplotlib.offsetbox.OffsetImage", "sklearn.decompositio...
[((683, 705), 'sklearn.datasets.load_digits', 'load_digits', ([], {'n_class': '(6)'}), '(n_class=6)\n', (694, 705), False, 'from sklearn.datasets import load_digits\n'), ((898, 946), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(10)', 'ncols': '(10)', 'figsize': '(6, 6)'}), '(nrows=10, ncols=10, figsiz...
import pycuda.driver as cuda import pycuda.autoinit import numpy as np import tensorrt as trt import argparse import time # logger to capture errors, warnings, and other information during the build and inference phases TRT_LOGGER = trt.Logger() # def build_engine(onnx_file_path): # # initialize TensorRT engine a...
[ "tensorrt.Logger", "pycuda.driver.Stream", "pycuda.driver.memcpy_dtoh_async", "argparse.ArgumentParser", "pycuda.driver.pagelocked_empty", "tensorrt.OnnxParser", "pycuda.driver.memcpy_htod_async", "pycuda.driver.mem_alloc", "tensorrt.Builder", "time.time", "tensorrt.Runtime", "pycuda.driver.De...
[((234, 246), 'tensorrt.Logger', 'trt.Logger', ([], {}), '()\n', (244, 246), True, 'import tensorrt as trt\n'), ((766, 796), 'tensorrt.Logger', 'trt.Logger', (['trt.Logger.WARNING'], {}), '(trt.Logger.WARNING)\n', (776, 796), True, 'import tensorrt as trt\n'), ((1041, 1064), 'tensorrt.Builder', 'trt.Builder', (['TRT_LO...
# -*- coding: utf-8 -*- # # Copyright © 2009-2010 CEA # <NAME> # Licensed under the terms of the CECILL License # (see guiqwt/__init__.py for details) # pylint: disable=C0103 """ guiqwt.baseplot --------------- The `baseplot` module provides the `guiqwt` plotting widget base class: :py:class:`guiqwt.baseplot.BasePl...
[ "pickle.dump", "guiqwt.io.load_items", "qtpy.QtWidgets.QApplication.clipboard", "qtpy.py3compat.is_text_string", "pickle.load", "guiqwt.events.StatefulEventFilter", "guidata.configtools.get_font", "guiqwt.styles.ItemParameters", "guiqwt.config._", "qtpy.QtGui.QColor", "guiqwt.io.save_items", "...
[((4115, 4157), 'qtpy.QtCore.Signal', 'Signal', (['object', 'float', 'float', 'float', 'float'], {}), '(object, float, float, float, float)\n', (4121, 4157), False, 'from qtpy.QtCore import QSize, Qt, Signal\n'), ((4252, 4266), 'qtpy.QtCore.Signal', 'Signal', (['object'], {}), '(object)\n', (4258, 4266), False, 'from q...
"""Utils""" """Slang utils""" from collections import deque, defaultdict from itertools import islice import numpy as np from numpy.random import choice from functools import partial from contextlib import suppress ModuleNotFoundIgnore = partial( suppress, ModuleNotFoundError, ImportError ) # just an alias f...
[ "functools.partial", "numpy.insert", "collections.defaultdict", "numpy.random.choice", "collections.deque" ]
[((244, 295), 'functools.partial', 'partial', (['suppress', 'ModuleNotFoundError', 'ImportError'], {}), '(suppress, ModuleNotFoundError, ImportError)\n', (251, 295), False, 'from functools import partial\n'), ((5698, 5715), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (5709, 5715), False, 'from...
import datetime import numpy as np import os import random import sys import time import torch import torch.nn as nn import torchvision.utils as vutils from torch.backends import cudnn import utils from sagan_models import Generator, Discriminator class Trainer(object): def __init__(self, config): # C...
[ "numpy.random.seed", "torch.autograd.grad", "torch.randn", "torch.full", "torch.cuda.device_count", "utils.write_config_to_file", "numpy.arange", "sagan_models.Generator", "os.path.join", "utils.make_plots", "torch.nn.BCELoss", "random.seed", "datetime.timedelta", "torch.mean", "utils.ma...
[((463, 503), 'utils.make_folder', 'utils.make_folder', (['self.config.save_path'], {}), '(self.config.save_path)\n', (480, 503), False, 'import utils\n'), ((512, 561), 'utils.make_folder', 'utils.make_folder', (['self.config.model_weights_path'], {}), '(self.config.model_weights_path)\n', (529, 561), False, 'import ut...
from collections import OrderedDict from multiprocessing import Pool import matplotlib.pyplot as plt import numpy as np from astropy.io import fits from astropy.table import Table from scipy.interpolate import CubicSpline from pyM2FS.calibrations import Calibrations from pyM2FS.observations import Observations from py...
[ "matplotlib.pyplot.title", "numpy.sum", "pyM2FS.pyM2FS_funcs.boolify", "numpy.nanmedian", "pyM2FS.stitch.stitch_all_images", "numpy.abs", "numpy.logspace", "scipy.interpolate.CubicSpline", "numpy.isnan", "numpy.argmin", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "matplotlib....
[((989, 1034), 'pyM2FS.pyM2FS_funcs.boolify', 'boolify', (["pipeline_options['convert_adu_to_e']"], {}), "(pipeline_options['convert_adu_to_e'])\n", (996, 1034), False, 'from pyM2FS.pyM2FS_funcs import generate_wave_grid, boolify\n'), ((1068, 1118), 'pyM2FS.pyM2FS_funcs.boolify', 'boolify', (["pipeline_options['try_ski...
import numpy as np import torch from unityagents import UnityEnvironment """Unity Environment Wrapper """ class UnityEnv(): def __init__(self, env_file='data/Tennis_Windows_x86_64/Tennis.exe', no_graphics=True): self.env = UnityEnvironment(file_name=env_file, no_graphics=no_graphics) self.brain_na...
[ "numpy.array", "unityagents.UnityEnvironment", "numpy.clip" ]
[((237, 298), 'unityagents.UnityEnvironment', 'UnityEnvironment', ([], {'file_name': 'env_file', 'no_graphics': 'no_graphics'}), '(file_name=env_file, no_graphics=no_graphics)\n', (253, 298), False, 'from unityagents import UnityEnvironment\n'), ((1005, 1028), 'numpy.clip', 'np.clip', (['actions', '(-1)', '(1)'], {}), ...
# This file is a part of PDDLRL project. # Copyright (c) 2020 <NAME> (<EMAIL>) # Copyright (c) 2021 <NAME> (<EMAIL>, <EMAIL>), IBM Corporation import glob import os import string from typing import Dict, Optional, Sequence, Set, Tuple, Type import gin import numpy as np import pddlenv from pddlenv import PDDLObject...
[ "os.environ.get", "pddlenv.PDDLDynamics", "os.path.join", "numpy.random.default_rng" ]
[((361, 397), 'os.environ.get', 'os.environ.get', (['"""PDDL_ROOT_DIR"""', '"""."""'], {}), "('PDDL_ROOT_DIR', '.')\n", (375, 397), False, 'import os\n'), ((1466, 1488), 'pddlenv.PDDLDynamics', 'pddlenv.PDDLDynamics', ([], {}), '()\n', (1486, 1488), False, 'import pddlenv\n'), ((640, 675), 'os.path.join', 'os.path.join...
### We have two implementations: ### - librosa and griff. lim algo ### - lws library and it's own stft from timeit import default_timer as timer import librosa fft_size=2048 window_size=1024 # window size hop_size=512 # window shift size - 1024 by 512 means 50% overlap sample_rate=44100 #sample_rate=22050 # who...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.specgram", "numpy.abs", "matplotlib.pyplot.show", "numpy.nan_to_num", "timeit.default_timer", "numpy.asarray", "numpy.isfinite", "numpy.random.random", "librosa.load", "librosa.magphase", "librosa.core.stft", "matplotlib.pyplot.ylabel", "libros...
[((8400, 8445), 'librosa.load', 'librosa.load', (['file'], {'sr': 'sample_rate', 'mono': '(True)'}), '(file, sr=sample_rate, mono=True)\n', (8412, 8445), False, 'import librosa\n'), ((8638, 8645), 'timeit.default_timer', 'timer', ([], {}), '()\n', (8643, 8645), True, 'from timeit import default_timer as timer\n'), ((87...
import sys import numpy as np import scipy as sp import scipy.optimize as spo from scipy.special import erf as sperf import numpy.linalg as npl import numpy.random as npr import pickle from sklearn.model_selection import KFold from sklearn.utils import shuffle k = int(sys.argv[1]) i = int(k/10) #column index j = np.m...
[ "numpy.load", "pickle.dump", "numpy.abs", "numpy.std", "numpy.ones", "sklearn.model_selection.KFold", "numpy.mod", "scipy.special.erf", "numpy.hstack", "numpy.random.rand", "numpy.linalg.solve", "numpy.sqrt" ]
[((316, 329), 'numpy.mod', 'np.mod', (['k', '(10)'], {}), '(k, 10)\n', (322, 329), True, 'import numpy as np\n'), ((375, 391), 'scipy.special.erf', 'sperf', (['root2over'], {}), '(root2over)\n', (380, 391), True, 'from scipy.special import erf as sperf\n'), ((1993, 2029), 'numpy.load', 'np.load', (['"""./numpy_files/qu...
import os import time import numpy as np import win32com.client as win32 class HYSYSopt(): def __init__(self,hysys,fname): print("Creating the Solver Class") self.hyapp = hysys self.sep1t = 0 self.sep1p = 0 self.sep2p = 0 s...
[ "win32com.client.GetObject", "numpy.asarray", "numpy.savetxt", "numpy.zeros", "time.sleep", "numpy.loadtxt", "win32com.client.Dispatch" ]
[((5393, 5434), 'win32com.client.Dispatch', 'win32.Dispatch', (['"""HYSYS.Application.v11.0"""'], {}), "('HYSYS.Application.v11.0')\n", (5407, 5434), True, 'import win32com.client as win32\n'), ((5621, 5679), 'numpy.loadtxt', 'np.loadtxt', (['"""..\\\\data\\\\scaled_testplan.csv"""'], {'delimiter': '""","""'}), "('..\\...
''' random forest regression ''' import numpy as np from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import r2_score from utils.misc import plot_predictions, create_interactive_plot, create_df, generate_data def forest(save_fig=False, compare=False): ''' main function for testi...
[ "utils.misc.create_df", "sklearn.metrics.r2_score", "sklearn.ensemble.RandomForestRegressor", "utils.misc.create_interactive_plot", "utils.misc.plot_predictions", "numpy.array", "numpy.arange", "utils.misc.generate_data" ]
[((669, 723), 'utils.misc.generate_data', 'generate_data', (['"""dbs/data_2010s.csv"""'], {'scale_input': '(False)'}), "('dbs/data_2010s.csv', scale_input=False)\n", (682, 723), False, 'from utils.misc import plot_predictions, create_interactive_plot, create_df, generate_data\n'), ((2748, 2768), 'numpy.arange', 'np.ara...
# ==============database.base_dataset.py====================== # This module implements a base class for datasets. # Version: 1.0.0 # Date: 2019.05.20 # ============================================================ import os import random import numpy as np from PIL import Image import torchvision.transforms as transf...
[ "PIL.Image.new", "numpy.ones", "numpy.clip", "os.path.isfile", "torchvision.transforms.Normalize", "util.open_csv_file", "util.open_json_file", "os.path.join", "PIL.Image.merge", "random.randint", "torchvision.transforms.RandomRotation", "torchvision.transforms.Compose", "torchvision.transfo...
[((2821, 2833), 'util.cal_equal', 'cal_equal', (['(6)'], {}), '(6)\n', (2830, 2833), False, 'from util import cal_equal, open_csv_file, open_json_file, progress_bar\n'), ((4027, 4079), 'os.path.isfile', 'os.path.isfile', (["self.image_info[index]['image_path']"], {}), "(self.image_info[index]['image_path'])\n", (4041, ...
import argparse import pathlib import numpy as np import scipy import scipy.stats import torch def mean_confidence_interval(data, confidence=0.95): a = 1.0 * np.array(data) n = len(a) m, se = np.mean(a), scipy.stats.sem(a) h = se * scipy.stats.t.ppf((1 + confidence) / 2., n - 1) return m, h def...
[ "argparse.ArgumentParser", "torch.load", "pathlib.Path", "numpy.mean", "numpy.array", "scipy.stats.sem", "scipy.stats.t.ppf" ]
[((342, 411), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Evaluate COCO result from file"""'}), "(description='Evaluate COCO result from file')\n", (365, 411), False, 'import argparse\n'), ((617, 642), 'pathlib.Path', 'pathlib.Path', (['args.folder'], {}), '(args.folder)\n', (629, 642...
import sys import random import numpy as np from environments.carla_enviroments.carla_config import base_config try: sys.path.append(base_config.egg_file) except IndexError: pass import carla from environments.carla_enviroments.utils import sensor_ops from environments.carla_enviroments.env_v1_ObstacleAvoidanc...
[ "sys.path.append", "carla.Transform", "random.randint", "random.uniform", "environments.carla_enviroments.utils.sensor_ops.bgr_camera", "environments.carla_enviroments.env_v1_ObstacleAvoidance.env_v1.ObstacleAvoidanceScenario.__init__", "environments.carla_enviroments.utils.world_ops.try_spawn_random_ve...
[((122, 159), 'sys.path.append', 'sys.path.append', (['base_config.egg_file'], {}), '(base_config.egg_file)\n', (137, 159), False, 'import sys\n'), ((729, 769), 'environments.carla_enviroments.env_v1_ObstacleAvoidance.env_v1.ObstacleAvoidanceScenario.__init__', 'ObstacleAvoidanceScenario.__init__', (['self'], {}), '(se...
#!/usr/bin/python # -*- coding:utf-8 -*- """ @author:fangpf @time: 2020/11/24 """ import argparse import time import cv2 import torch import torchvision from PIL import Image import utils from models.resnet import resnet50 from torchvision.transforms import transforms import numpy as np N_IDENTITY = 8631 device = to...
[ "numpy.save", "argparse.ArgumentParser", "models.resnet.resnet50", "cv2.cvtColor", "time.time", "torchvision.transforms.transforms.ToTensor", "cv2.imread", "torch.cuda.is_available", "torchvision.transforms.transforms.Resize", "utils.load_state_dict" ]
[((539, 588), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""face feature extractor"""'], {}), "('face feature extractor')\n", (562, 588), False, 'import argparse\n'), ((802, 853), 'models.resnet.resnet50', 'resnet50', ([], {'num_classes': 'N_IDENTITY', 'include_top': '(False)'}), '(num_classes=N_IDENTITY,...
# -*- coding: utf-8 -*- import numpy as np class DataSampler(object): def __init__(self, vals, probs, bucket_count=10): self.max_prob = max(probs) self.bucket_count = min(bucket_count, int(len(probs) / 3)) print("""RandomSampler: bucketing... Usage warn: draw first bucket the...
[ "numpy.random.randint", "numpy.array" ]
[((2250, 2289), 'numpy.random.randint', 'np.random.randint', (['(0)', 'self.bucket_count'], {}), '(0, self.bucket_count)\n', (2267, 2289), True, 'import numpy as np\n'), ((2411, 2441), 'numpy.array', 'np.array', (['([0] * size)', 'np.int32'], {}), '([0] * size, np.int32)\n', (2419, 2441), True, 'import numpy as np\n'),...
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*- import ctypes from .base import SMLM import numpy as np import numpy.ctypeslib as ctl class PostProcess: def __init__(self, smlmlib): self.lib = smlmlib # CDLL_EXPORT void NearestNeighborDriftEstimate(const Vector3f * xyI, const int *spotFrameNum,...
[ "numpy.zeros", "numpy.ascontiguousarray", "numpy.ctypeslib.ndpointer" ]
[((2764, 2807), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['xyI'], {'dtype': 'np.float32'}), '(xyI, dtype=np.float32)\n', (2784, 2807), True, 'import numpy as np\n'), ((2825, 2872), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['crlbXYI'], {'dtype': 'np.float32'}), '(crlbXYI, dtype=np.float32)\n', (284...
import taichi as ti from tests import test_utils @test_utils.test() def test_empty(): @ti.kernel def func(): pass func() @test_utils.test() def test_empty_args(): @ti.kernel def func(x: ti.i32, arr: ti.ext_arr()): pass import numpy as np func(42, np.arange(10, dtype=np....
[ "tests.test_utils.test", "taichi.ext_arr", "numpy.arange" ]
[((52, 69), 'tests.test_utils.test', 'test_utils.test', ([], {}), '()\n', (67, 69), False, 'from tests import test_utils\n'), ((147, 164), 'tests.test_utils.test', 'test_utils.test', ([], {}), '()\n', (162, 164), False, 'from tests import test_utils\n'), ((297, 328), 'numpy.arange', 'np.arange', (['(10)'], {'dtype': 'n...
import itertools import numpy as np from numpy.testing import assert_ import pytest from qutip import * from qutip.legacy.ptrace import _ptrace as _pt @pytest.fixture(params=[True, False], ids=['sparse', 'dense']) def sparse(request): return request.param @pytest.fixture(params=[True, False], ids=['dm', 'ket'...
[ "qutip.legacy.ptrace._ptrace", "pytest.fixture", "pytest.param", "pytest.raises", "numpy.testing.assert_", "numpy.prod" ]
[((156, 217), 'pytest.fixture', 'pytest.fixture', ([], {'params': '[True, False]', 'ids': "['sparse', 'dense']"}), "(params=[True, False], ids=['sparse', 'dense'])\n", (170, 217), False, 'import pytest\n'), ((267, 322), 'pytest.fixture', 'pytest.fixture', ([], {'params': '[True, False]', 'ids': "['dm', 'ket']"}), "(par...
import argparse import logging import logging.config import os from os.path import dirname, exists, join import numpy as np import pandas as pd import simq_features from qac.evaluation import evaluation from qac.experiments import preprocessing logger = logging.getLogger(__name__) # pylint: disable=locally-disabled...
[ "numpy.stack", "qac.experiments.preprocessing.load_community", "os.makedirs", "argparse.ArgumentParser", "pandas.DataFrame.from_dict", "os.path.dirname", "simq_features.FeatureHandler", "qac.experiments.preprocessing.LABEL_ENCODER.inverse_transform", "pandas.concat", "logging.getLogger" ]
[((257, 284), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (274, 284), False, 'import logging\n'), ((514, 577), 'simq_features.FeatureHandler', 'simq_features.FeatureHandler', (['args.community'], {'run': 'args.simq_run'}), '(args.community, run=args.simq_run)\n', (542, 577), False, 'im...
#!/usr/bin/env python # # Copyright 2016 <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 applicabl...
[ "neon.transforms.CrossEntropyBinary", "neon.layers.RecurrentMean", "neon.initializers.Gaussian", "os.path.join", "neon.transforms.Softmax", "neon.data.AudioParams", "neon.layers.Pooling", "neon.callbacks.callbacks.Callbacks", "os.path.exists", "neon.layers.Conv", "numpy.loadtxt", "neon.models....
[((1353, 1375), 'neon.util.argparser.NeonArgparser', 'NeonArgparser', (['__doc__'], {}), '(__doc__)\n', (1366, 1375), False, 'from neon.util.argparser import NeonArgparser\n'), ((1922, 1931), 'indexer.Indexer', 'Indexer', ([], {}), '()\n', (1929, 1931), False, 'from indexer import Indexer\n'), ((2133, 2187), 'neon.data...
"""Change based on yarr.runners._env_runner to choose between multiple GPUs for agent evaluation """ import copy from copy import deepcopy import logging import os import time import multiprocessing from multiprocessing import Process, Manager from typing import Any, List import numpy as np from yarr.agents.agent im...
[ "copy.deepcopy", "logging.error", "numpy.random.seed", "logging.debug", "logging.warning", "multiprocessing.Manager", "os.path.exists", "time.sleep", "logging.info", "torch.device", "multiprocessing.Process", "os.listdir" ]
[((1744, 1753), 'multiprocessing.Manager', 'Manager', ([], {}), '()\n', (1751, 1753), False, 'from multiprocessing import Process, Manager\n'), ((2818, 2883), 'multiprocessing.Process', 'Process', ([], {'target': 'self._run_env', 'args': 'self._p_args[name]', 'name': 'name'}), '(target=self._run_env, args=self._p_args[...
import torch.nn as nn import torch.nn.functional as F import torch from sklearn.cluster import KMeans from sklearn.metrics.pairwise import pairwise_distances import numpy as np class BoF_Pooling(nn.Module): def __init__(self, n_codewords, features, spatial_level=0, **kwargs): super(BoF_Pooling, self).__ini...
[ "torch.mean", "torch.ones", "sklearn.metrics.pairwise.pairwise_distances", "torch.nn.ReLU", "numpy.random.shuffle", "torch.stack", "sklearn.cluster.KMeans", "numpy.float32", "torch.empty", "torch.nn.functional.conv2d", "numpy.ones", "torch.nn.Softmax", "torch.cuda.is_available", "torch.res...
[((796, 805), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (803, 805), True, 'import torch.nn as nn\n'), ((858, 875), 'torch.nn.Softmax', 'nn.Softmax', ([], {'dim': '(1)'}), '(dim=1)\n', (868, 875), True, 'import torch.nn as nn\n'), ((1356, 1399), 'torch.sum', 'torch.sum', ([], {'input': 'input', 'dim': '(1)', 'keepdi...
import numpy as np import itertools class PhysicsComponent(): def __init__(self, mass, static=False): #self.parent = parent self.static = static self.mass = mass self.velocity = np.zeros((2)) self.acceleration = np.zeros((2)) self.previous_collisions = [None] ...
[ "numpy.linalg.norm", "numpy.zeros" ]
[((215, 226), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (223, 226), True, 'import numpy as np\n'), ((257, 268), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (265, 268), True, 'import numpy as np\n'), ((395, 406), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (403, 406), True, 'import numpy as np\n')...
import numpy as np import random from numpy import savetxt data = np.loadtxt('tight_2_64.cfg', skiprows=10) print(data) print(np.shape(data), type(data)) print(data[3][3], type(data[3][3])) l = np.shape(data)[0] #expanded_layout = np.zeros((2*l,2*l), dtype=int) count = 0 count_zero = 0 for i in range(l): for j in ra...
[ "numpy.shape", "numpy.loadtxt" ]
[((67, 108), 'numpy.loadtxt', 'np.loadtxt', (['"""tight_2_64.cfg"""'], {'skiprows': '(10)'}), "('tight_2_64.cfg', skiprows=10)\n", (77, 108), True, 'import numpy as np\n'), ((127, 141), 'numpy.shape', 'np.shape', (['data'], {}), '(data)\n', (135, 141), True, 'import numpy as np\n'), ((196, 210), 'numpy.shape', 'np.shap...
""" Basic new method to calculate derivatives across assembly. """ import unittest import numpy as np from openmdao.main.api import Component, Assembly, set_as_top from openmdao.main.datatypes.api import Float from openmdao.main.test.test_derivatives import ArrayComp2D from openmdao.util.testutil import assert_rel_e...
[ "openmdao.main.api.Assembly", "unittest.main", "openmdao.main.test.test_derivatives.ArrayComp2D", "openmdao.util.testutil.assert_rel_error", "numpy.zeros", "openmdao.main.datatypes.api.Float" ]
[((364, 387), 'openmdao.main.datatypes.api.Float', 'Float', (['(1.0)'], {'iotype': '"""in"""'}), "(1.0, iotype='in')\n", (369, 387), False, 'from openmdao.main.datatypes.api import Float\n'), ((396, 420), 'openmdao.main.datatypes.api.Float', 'Float', (['(1.0)'], {'iotype': '"""out"""'}), "(1.0, iotype='out')\n", (401, ...
# Global runner for all NeRF methods. # For convenience, we want all methods using NeRF to use this one file. import argparse import random import json import math import time import numpy as np import torch import torch.optim as optim import torch.nn.functional as F import torchvision.transforms.functional as TVF imp...
[ "torch.cat", "numpy.ones", "src.neural_blocks.SpatialEncoder", "torch.nn.functional.normalize", "src.renderers.JointLearnedConstOcc", "src.lights.light_kinds.keys", "src.utils.mse2psnr", "torch.load", "torch.optim.lr_scheduler.CosineAnnealingLR", "src.utils.load_image", "src.sdf.load", "numpy....
[((16645, 16670), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (16668, 16670), False, 'import torch\n'), ((958, 1037), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpForm...
# Python implementation of the Eshelby ellipsoidal inclusion code presented by Meng et al. (2012) # "Evaluation of the Eshelby solution for the ellipsoidal inclusion and heterogeneity", Computers & Geosciences 40, 40-48. import numpy as np from copy import copy from numpy.linalg import inv from matplotlib import pyplo...
[ "numpy.roots", "numpy.isreal", "numpy.sum", "numpy.logspace", "numpy.ones", "numpy.arccosh", "numpy.sin", "scipy.special.ellipkinc", "numpy.prod", "numpy.meshgrid", "numpy.linspace", "numpy.log10", "numpy.arccos", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "numpy.tensordot...
[((10808, 10819), 'numpy.array', 'np.array', (['v'], {}), '(v)\n', (10816, 10819), True, 'import numpy as np\n'), ((10831, 10876), 'numpy.array', 'np.array', (['[v[:3], v[[1, 3, 4]], v[[2, 4, 5]]]'], {}), '([v[:3], v[[1, 3, 4]], v[[2, 4, 5]]])\n', (10839, 10876), True, 'import numpy as np\n'), ((10954, 11022), 'numpy.a...
# Neuron base import numpy as np import largescale.src.support.cl_support as clspt from largescale.src.support.common import CommonConfig from program import chain2 T_EXCITATORY = 1 T_INHIBITORY = 2 T_EXC = T_EXCITATORY T_E = T_EXCITATORY T_INH = T_INHIBITORY T_I = T_INHIBITORY T_ON = 3 T_OFF = 4 T_O...
[ "largescale.src.support.common.CommonConfig", "numpy.zeros", "largescale.src.support.cl_support.Variable", "numpy.array", "numpy.prod" ]
[((621, 635), 'largescale.src.support.common.CommonConfig', 'CommonConfig', ([], {}), '()\n', (633, 635), False, 'from largescale.src.support.common import CommonConfig\n'), ((1604, 1641), 'largescale.src.support.cl_support.Variable', 'clspt.Variable', (['trefs'], {'read_only': '(True)'}), '(trefs, read_only=True)\n', ...
''' Tukeys's weight function w: absx is N x 1 data vector which can be complex or real and threshold contant cl ''' import numpy as np def wtuk(absx,cl): return np.square(1-np.square(absx/cl)) * (absx<=cl)
[ "numpy.square" ]
[((179, 199), 'numpy.square', 'np.square', (['(absx / cl)'], {}), '(absx / cl)\n', (188, 199), True, 'import numpy as np\n')]
import numpy as np """ All general pre-processing functions used. """ import pandas as pd import math from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import StandardScaler from sklearn.feature_selection import VarianceThreshold from sklearn.preprocessing import LabelEncoder from utilities...
[ "numpy.random.seed", "sklearn.preprocessing.StandardScaler", "sklearn.model_selection.train_test_split", "sklearn.preprocessing.MinMaxScaler", "math.floor", "numpy.ones", "sklearn.preprocessing.LabelEncoder", "pandas.to_datetime" ]
[((1172, 1215), 'pandas.to_datetime', 'pd.to_datetime', (["data['timestamp']"], {'utc': '(True)'}), "(data['timestamp'], utc=True)\n", (1186, 1215), True, 'import pandas as pd\n'), ((1248, 1299), 'pandas.to_datetime', 'pd.to_datetime', (["data['registration_date']"], {'utc': '(True)'}), "(data['registration_date'], utc...
import numpy as np class Analysis: """Vega analysis class. - Compute parameter scan - Create Monte Carlo realizations of the data - Run FastMC analysis """ def __init__(self, minimizer, main_config, mc_config=None): """ Parameters ---------- minimizer : Min...
[ "numpy.linspace" ]
[((1474, 1509), 'numpy.linspace', 'np.linspace', (['start', 'end', 'num_points'], {}), '(start, end, num_points)\n', (1485, 1509), True, 'import numpy as np\n')]
#!/usr/bin/env python3 import numpy as np import pandas as pd import math as m import time import sys from ServoMotor import * # Functions for servo position conversion def servo12(targ12): if targ12>=0: pos12 = (140 - (targ12/1.2)*65)*(25/6) else: pos12 = ((abs(targ12)/1)*25 + 140)*(25/6) return int(round(pos1...
[ "numpy.zeros", "math.sin", "time.sleep", "time.time", "numpy.array", "sys.exit" ]
[((1533, 1578), 'numpy.array', 'np.array', (["df['Best Values']"], {'dtype': 'np.float32'}), "(df['Best Values'], dtype=np.float32)\n", (1541, 1578), True, 'import numpy as np\n'), ((1667, 1697), 'numpy.zeros', 'np.zeros', (['(12)'], {'dtype': 'np.float32'}), '(12, dtype=np.float32)\n', (1675, 1697), True, 'import nump...
""" Simple experiment with Scipy optimisation. We want to see if constraints that use absolute values are solved correctly. """ from typing import Sequence import numpy as np from scipy.optimize import NonlinearConstraint, minimize def loss(x: np.ndarray) -> np.ndarray: """ Reasonably representative 1D problem w...
[ "numpy.abs", "scipy.optimize.minimize", "numpy.array", "scipy.optimize.NonlinearConstraint" ]
[((526, 571), 'scipy.optimize.NonlinearConstraint', 'NonlinearConstraint', (['constraint', '(-np.inf)', '(1.0)'], {}), '(constraint, -np.inf, 1.0)\n', (545, 571), False, 'from scipy.optimize import NonlinearConstraint, minimize\n'), ((580, 596), 'numpy.array', 'np.array', (['[-0.2]'], {}), '([-0.2])\n', (588, 596), Tru...
"""Serialization utilities for Alpa. Adapted from https://flax.readthedocs.io/en/latest/_modules/flax/serialization.html. Add support for DistributedArray and ReplicatedDistributedArray serialization in Alpa. """ import enum import logging import os import re from typing import Union, Any, Sequence import uuid import...
[ "alpa.device_mesh.ReplicatedDistributedArray", "flax.serialization.from_state_dict", "tensorstore.Context", "os.path.join", "msgpack.packb", "re.fullmatch", "jax._src.tree_util.tree_unflatten", "msgpack.ExtType", "flax.serialization._ndarray_from_bytes", "numpy.asarray", "flax.serialization.to_s...
[((782, 809), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (799, 809), False, 'import logging\n'), ((3043, 3070), 'msgpack.ExtType', 'msgpack.ExtType', (['code', 'data'], {}), '(code, data)\n', (3058, 3070), False, 'import msgpack\n'), ((5305, 5326), 'flax.serialization.to_state_dict', ...
#!/usr/bin/env python # coding=utf-8 from __future__ import division, print_function, unicode_literals import numpy as np import pytest from brainstorm.handlers import NumpyHandler from brainstorm.optional import has_pycuda # np.random.seed(1234) dtype = np.float32 NO_CON = set() def _conv2d_forward_batch(inputs,...
[ "numpy.zeros_like", "numpy.allclose", "numpy.zeros", "pytest.mark.skipif", "numpy.random.rand", "brainstorm.handlers.NumpyHandler", "brainstorm.handlers.PyCudaHandler" ]
[((4751, 4828), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(has_pycuda is False)'], {'reason': '"""requires PyCUDA+scikit-cuda"""'}), "(has_pycuda is False, reason='requires PyCUDA+scikit-cuda')\n", (4769, 4828), False, 'import pytest\n'), ((1919, 1944), 'brainstorm.handlers.NumpyHandler', 'NumpyHandler', ([], {'dt...
import numpy as np import scipy.optimize as op import sampler def objfunction(theta, masked_data, mask , sr_psf, flux, bkg, floor, gain, fl): """ Inputs: theta = [old_cx, old_cy], where: old_cx = current sub-pixel shift of the center of star in x at the naitive pixel resolu...
[ "scipy.optimize.fmin", "sampler.imatrix_new", "numpy.sum", "numpy.abs", "numpy.log", "numpy.dot" ]
[((1436, 1548), 'scipy.optimize.fmin', 'op.fmin', (['nll', '[theta[0], theta[1]]'], {'args': '(masked_data, mask, sr_psf, flux, bkg, floor, gain, fl)', 'disp': '(False)'}), '(nll, [theta[0], theta[1]], args=(masked_data, mask, sr_psf, flux,\n bkg, floor, gain, fl), disp=False)\n', (1443, 1548), True, 'import scipy.o...
import itertools import matplotlib.pyplot as plt import numpy as np import random import sys from formula_parser import * from valuation import * from search import get_phylogenetic_weights universals = [ (1, "S-O"), (2, "Adp-NP ⇔ N-Gen"), (3, "V-S-O ⇒ Adp-NP"), (4, "S-O-V ⇒ NP-Adp"), (5, "( S-O-V & N-Gen ) ⇒ N-...
[ "numpy.multiply", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "random.shuffle", "numpy.square", "numpy.isnan", "numpy.array", "numpy.linspace", "search.get_phylogenetic_weights" ]
[((6623, 6642), 'numpy.array', 'np.array', (['train_avg'], {}), '(train_avg)\n', (6631, 6642), True, 'import numpy as np\n'), ((6655, 6673), 'numpy.array', 'np.array', (['test_avg'], {}), '(test_avg)\n', (6663, 6673), True, 'import numpy as np\n'), ((6908, 6942), 'matplotlib.pyplot.plot', 'plt.plot', (['train_avg', 'te...
""" Utility method to instantiate weight layers """ import numpy as np import torch from src.env import device, dtype def random_weight(shape): """ Create random Tensors for weights; setting requires_grad=True means that we want to compute gradients for these Tensors during the backward pass. We use...
[ "torch.zeros", "torch.randn", "numpy.prod", "numpy.sqrt" ]
[((736, 802), 'torch.zeros', 'torch.zeros', (['shape'], {'device': 'device', 'dtype': 'dtype', 'requires_grad': '(True)'}), '(shape, device=device, dtype=dtype, requires_grad=True)\n', (747, 802), False, 'import torch\n'), ((459, 477), 'numpy.prod', 'np.prod', (['shape[1:]'], {}), '(shape[1:])\n', (466, 477), True, 'im...
import os import cv2 import numpy as np import math import random import AffineTransformation as AT # important parameters PATH = os.getcwd() plates_path = os.getcwd()+"\\licensePlateDatasetGenerator\\data" # scenes_path = os.getcwd()+"\\ResizedGrayUrbanScene_Data"============================ scenes_path = ...
[ "os.listdir", "os.mkdir", "AffineTransformation.make_affine_transform", "os.getcwd", "cv2.cvtColor", "os.path.exists", "numpy.ones", "random.choice", "numpy.zeros", "numpy.clip", "cv2.imread", "numpy.max", "numpy.min", "cv2.warpAffine", "cv2.randn", "os.chdir" ]
[((139, 150), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (148, 150), False, 'import os\n'), ((566, 587), 'os.chdir', 'os.chdir', (['plates_path'], {}), '(plates_path)\n', (574, 587), False, 'import os\n'), ((598, 610), 'os.listdir', 'os.listdir', ([], {}), '()\n', (608, 610), False, 'import os\n'), ((612, 633), 'os.ch...
# -*- coding: utf-8 -*- from tensorflow.keras.layers import Input, Dense, Conv2D, Flatten, BatchNormalization, LeakyReLU, add from tensorflow.keras.regularizers import l2 from tensorflow.keras.optimizers import Adam from tensorflow.keras.models import Model from collections import deque import tensorflow.keras.backend...
[ "tensorflow.keras.backend.set_value", "tensorflow.keras.regularizers.l2", "tensorflow.keras.layers.BatchNormalization", "numpy.log", "random.sample", "numpy.flipud", "tensorflow.keras.layers.add", "tensorflow.keras.models.Model", "tensorflow.keras.layers.LeakyReLU", "numpy.fliplr", "numpy.rot90"...
[((5564, 5595), 'collections.deque', 'deque', ([], {'maxlen': 'trainDataPoolSize'}), '(maxlen=trainDataPoolSize)\n', (5569, 5595), False, 'from collections import deque\n'), ((2780, 2806), 'tensorflow.keras.layers.add', 'add', (['[input_block, output]'], {}), '([input_block, output])\n', (2783, 2806), False, 'from tens...
import numpy from scipy.stats import entropy def cross_entropy_loss(predict_prob: numpy.ndarray, y_label: numpy.ndarray, take_average: bool = False) -> float: loss = 0.0 batch_size = predict_prob.shape[0] for i in range(y_label.size): try: loss += -numpy.log(predict_prob[i, y_label[i]])...
[ "numpy.sum", "numpy.log", "numpy.argmax", "numpy.arange", "numpy.random.shuffle" ]
[((537, 567), 'numpy.argmax', 'numpy.argmax', (['softprob'], {'axis': '(1)'}), '(softprob, axis=1)\n', (549, 567), False, 'import numpy\n'), ((660, 680), 'numpy.arange', 'numpy.arange', (['y.size'], {}), '(y.size)\n', (672, 680), False, 'import numpy\n'), ((685, 718), 'numpy.random.shuffle', 'numpy.random.shuffle', (['...
import numpy as np import torch from src import networks, optimizeNet, pnetProcess import matplotlib.pyplot as plt dataFile ='./../data/testing' id, seq, pssm2, entropy, dssp, RN, RCa, RCb, mask = pnetProcess.parse_pnet(dataFile) idx = np.arange(0,1) ncourse = 4 X = []; Yobs = []; M = []; Sh = [] for i in idx: ...
[ "src.networks.TVreg", "src.networks.misfitFun", "src.pnetProcess.parse_pnet", "src.pnetProcess.plotProteinData", "src.pnetProcess.getProteinData", "src.networks.vnet2D", "src.optimizeNet.trainNetwork", "numpy.arange", "src.networks.initVnetParams", "torch.tensor" ]
[((198, 230), 'src.pnetProcess.parse_pnet', 'pnetProcess.parse_pnet', (['dataFile'], {}), '(dataFile)\n', (220, 230), False, 'from src import networks, optimizeNet, pnetProcess\n'), ((242, 257), 'numpy.arange', 'np.arange', (['(0)', '(1)'], {}), '(0, 1)\n', (251, 257), True, 'import numpy as np\n'), ((589, 769), 'torch...
#! python import argparse import json from os import listdir from os.path import isfile, join, exists, isdir, abspath import numpy as np import tensorflow as tf from tensorflow import keras import tensorflow_hub as hub IMAGE_DIM = 224 # required/default image dimensionality def load_images(image_paths, image_siz...
[ "os.path.abspath", "tensorflow.keras.models.load_model", "os.path.isdir", "numpy.asarray", "tensorflow.keras.preprocessing.image.img_to_array", "os.path.exists", "json.dumps", "tensorflow.keras.preprocessing.image.load_img", "os.path.isfile", "os.path.join", "os.listdir" ]
[((860, 878), 'os.path.isdir', 'isdir', (['image_paths'], {}), '(image_paths)\n', (865, 878), False, 'from os.path import isfile, join, exists, isdir, abspath\n'), ((1819, 1909), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['model_path'], {'custom_objects': "{'KerasLayer': hub.KerasLayer}"}), "...
# fmt: off from abc import ABC, abstractmethod from dataclasses import replace as dataclass_replace from itertools import chain import logging from typing import Callable, Dict, Iterable, Sequence, List, Tuple, Optional, Mapping import numpy as np # For constant-propagation rules for log/exp from rlo.native_impls impo...
[ "rlo.utils.uniquify", "rlo.expression_util.deep_copy_with_types", "numpy.log", "rlo.expression.EF.Sumbuild", "rlo.expression.EF.Let", "rlo.utils.Assert", "rlo.utils.single_elem", "rlo.expression.Expression.new_var", "rlo.expression.Expression.Constant", "rlo.sparser.parse_rule", "rlo.expression....
[((40327, 40372), 'rlo.utils.uniquify', 'uniquify', (['[*_simplify_rules, *_binding_rules]'], {}), '([*_simplify_rules, *_binding_rules])\n', (40335, 40372), False, 'from rlo.utils import Assert, uniquify, single_elem\n'), ((9856, 9883), 'rlo.sparser.parse_rule', 'sparser.parse_rule', (['rule_ks'], {}), '(rule_ks)\n', ...
from typing import List, Optional import numpy as np from django.db.models.aggregates import Sum from scipy import special from django.core.exceptions import ObjectDoesNotExist from django.db import IntegrityError, models from django_pandas.managers import DataFrameManager from app.support.repetition import calculat...
[ "django.db.models.TextField", "django.db.models.OneToOneField", "django.db.models.ManyToManyField", "services.genius.remove_sections", "django_pandas.managers.DataFrameManager", "django.db.models.BigIntegerField", "django.db.models.CharField", "django.db.models.ForeignKey", "django.db.models.FloatFi...
[((724, 756), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(289)'}), '(max_length=289)\n', (740, 756), False, 'from django.db import IntegrityError, models\n'), ((775, 807), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(289)'}), '(max_length=289)\n', (791, 807), False...
''' Implement a Poisson 2D problem on a cracked domain with pure Dirichlet boundary conditions: - \Delta u(x,y) = f(x,y) for (x,y) \in \Omega:= (-1,1)x(-1,1) \ (0,1)x{0} u(x,y) = 0, for (x,y) \in \partial \Omega f(x,y) = 1 Problem from: <NAME> and <NAME> - The Deep Ritz method: A deep learning-base...
[ "matplotlib.pyplot.title", "numpy.random.seed", "numpy.resize", "numpy.ones", "tensorflow.matmul", "tensorflow.ConfigProto", "matplotlib.pyplot.contour", "matplotlib.pyplot.contourf", "tensorflow.truncated_normal", "numpy.meshgrid", "numpy.savetxt", "tensorflow.concat", "tensorflow.set_rando...
[((730, 750), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (744, 750), True, 'import numpy as np\n'), ((752, 776), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(1234)'], {}), '(1234)\n', (770, 776), True, 'import tensorflow as tf\n'), ((9747, 9769), 'numpy.array', 'np.array', (['[-1.0,...
import numpy as np import tensorflow as tf import tensorflow_probability as tfp import Nn from utils.sth import sth from .policy import Policy class MAXSQN(Policy): def __init__(self, s_dim, visual_sources, visual_resolution, a_dim_or_list, ...
[ "numpy.random.uniform", "numpy.log", "tensorflow.summary.scalar", "tensorflow.argmax", "tensorflow.stop_gradient", "tensorflow.device", "tensorflow.minimum", "tensorflow.summary.experimental.set_step", "tensorflow.multiply", "tensorflow.Variable", "utils.sth.sth.int2action_index", "tensorflow....
[((6152, 6195), 'tensorflow.function', 'tf.function', ([], {'experimental_relax_shapes': '(True)'}), '(experimental_relax_shapes=True)\n', (6163, 6195), True, 'import tensorflow as tf\n'), ((1875, 1962), 'Nn.critic_q_all', 'Nn.critic_q_all', (['self.s_dim', 'self.visual_dim', 'self.a_counts', '"""q1_net"""', 'hidden_un...
from simtk.openmm.app import * from simtk.openmm import * from simtk.unit import * from sys import stdout from simtk.openmm import app import os import numpy as np import sys import matplotlib.pyplot as plt import math from scipy.ndimage import gaussian_filter import parmed def Output_Cleanup(filename): lines_see...
[ "numpy.average", "simtk.openmm.app.AmberPrmtopFile", "parmed.amber.AmberParm", "math.ceil", "numpy.std", "scipy.ndimage.gaussian_filter", "numpy.sum", "numpy.genfromtxt", "os.system", "matplotlib.pyplot.figure", "parmed.load_file", "simtk.openmm.app.AmberInpcrdFile" ]
[((624, 666), 'os.system', 'os.system', (["('mv temp_clean.txt ' + filename)"], {}), "('mv temp_clean.txt ' + filename)\n", (633, 666), False, 'import os\n'), ((748, 779), 'simtk.openmm.app.AmberPrmtopFile', 'app.AmberPrmtopFile', (['prmtopfile'], {}), '(prmtopfile)\n', (767, 779), False, 'from simtk.openmm import app\...
# Copyright (c) 2009 <NAME> - <EMAIL> # 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, publish, di...
[ "tkinter.StringVar", "tkinter.Text", "chimera.Xform", "numpy.sum", "Surface.selected_surface_pieces", "numpy.abs", "random.shuffle", "numpy.floor", "chimera.Xform.xform", "VolumePath.Link", "_contour.affine_transform_vertices", "tkinter.Frame", "VolumeData.interpolate_volume_gradient", "ch...
[((63416, 63460), 'chimera.dialogs.find', 'dialogs.find', (['"""segger_segloop"""'], {'create': '(False)'}), "('segger_segloop', create=False)\n", (63428, 63460), False, 'from chimera import dialogs\n'), ((63625, 63692), 'chimera.dialogs.register', 'dialogs.register', (['Segloop_Dialog.name', 'Segloop_Dialog'], {'repla...
""" Tools for additional manipulations and data munging related to Hydro objects, but not central to typical D-WAQ hydro usage. """ import datetime import numpy as np import xarray as xr from ... import utils def extract_water_level(hydro,xy,start_time,end_time): """ Not sure about the code location here... ...
[ "numpy.linalg.lstsq", "numpy.allclose", "xarray.Dataset", "numpy.nonzero", "numpy.arange", "numpy.array" ]
[((745, 774), 'numpy.arange', 'np.arange', (['start_idx', 'end_idx'], {}), '(start_idx, end_idx)\n', (754, 774), True, 'import numpy as np\n'), ((1227, 1263), 'numpy.allclose', 'np.allclose', (['seg_areas[0]', 'seg_areas'], {}), '(seg_areas[0], seg_areas)\n', (1238, 1263), True, 'import numpy as np\n'), ((1274, 1286), ...
from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt from osgeo import gdal from numpy import linspace from numpy import meshgrid map = Basemap(projection='tmerc', lat_0=0, lon_0=3, llcrnrlon=1.819757266426611, llcrnrlat=41.583851612359275, ...
[ "numpy.meshgrid", "matplotlib.pyplot.show", "numpy.linspace", "osgeo.gdal.Open", "mpl_toolkits.basemap.Basemap" ]
[((158, 327), 'mpl_toolkits.basemap.Basemap', 'Basemap', ([], {'projection': '"""tmerc"""', 'lat_0': '(0)', 'lon_0': '(3)', 'llcrnrlon': '(1.819757266426611)', 'llcrnrlat': '(41.583851612359275)', 'urcrnrlon': '(1.841589961763497)', 'urcrnrlat': '(41.598674173123)'}), "(projection='tmerc', lat_0=0, lon_0=3, llcrnrlon=1...
import numpy as np import torch from lifelong_rl.policies.mpc.mpc import MPCPolicy class PolicyMPCController(MPCPolicy): """ Perform MPC planning over a policy that takes in an additional latent. """ def __init__( self, policy, # control policy to run that takes in a la...
[ "torch.cat", "numpy.concatenate" ]
[((662, 698), 'numpy.concatenate', 'np.concatenate', (['(obs, plan)'], {'axis': '(-1)'}), '((obs, plan), axis=-1)\n', (676, 698), True, 'import numpy as np\n'), ((884, 915), 'torch.cat', 'torch.cat', (['(obs, plans)'], {'dim': '(-1)'}), '((obs, plans), dim=-1)\n', (893, 915), False, 'import torch\n')]
from typing import Optional, Tuple, List import torch from torch import nn import numpy as np from math import isclose from mdlearn.nn.utils import ( conv_output_shape, same_padding, get_activation, _init_weights, ) class Conv2dEncoder(nn.Module): def __init__( self, input_shape: T...
[ "torch.nn.Dropout", "mdlearn.nn.utils.get_activation", "torch.load", "torch.nn.Conv2d", "mdlearn.nn.utils.conv_output_shape", "math.isclose", "torch.nn.Linear", "mdlearn.nn.utils.same_padding", "mdlearn.nn.utils._init_weights", "numpy.prod", "torch.nn.Flatten" ]
[((3032, 3056), 'numpy.prod', 'np.prod', (['self.shapes[-1]'], {}), '(self.shapes[-1])\n', (3039, 3056), True, 'import numpy as np\n'), ((3545, 3620), 'torch.nn.Linear', 'nn.Linear', ([], {'in_features': 'self.affine_widths[-1]', 'out_features': 'self.latent_dim'}), '(in_features=self.affine_widths[-1], out_features=se...
import numpy as np import nengo import nengo_spa as spa import matplotlib.pyplot as plt import seaborn as sns import itertools import semanticmapping plt.style.use('plot_style.txt') import seaborn as sns dt = 0.001 def construct_envs(n_envs, n_objs, loopT,ssp_space, seeds=None): if seeds is None: seeds ...
[ "semanticmapping.networks.AssociativeMemory", "numpy.abs", "nengo_spa.vocabulary.Vocabulary", "numpy.floor", "numpy.ones", "matplotlib.pyplot.style.use", "matplotlib.pyplot.figure", "numpy.arange", "nengo.Connection", "nengo.Simulator", "semanticmapping.networks.PathIntegration", "nengo.Node",...
[((152, 183), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""plot_style.txt"""'], {}), "('plot_style.txt')\n", (165, 183), True, 'import matplotlib.pyplot as plt\n'), ((9313, 9455), 'semanticmapping.HexagonalSSPSpace', 'semanticmapping.HexagonalSSPSpace', (['domain_dim'], {'n_scales': '(8)', 'n_rotates': '(7)', ...
#!/usr/bin/env python # Script to make diagnostic plots for NSC DR2 high proper motion candidates import os from dl import queryClient as qc import matplotlib.pyplot as plt import matplotlib import pandas as pd import numpy as np from scipy import stats from dlnpyutils import utils as dln, coords #from functions.dlnp...
[ "argparse.ArgumentParser", "numpy.polyfit", "matplotlib.pyplot.suptitle", "numpy.argsort", "numpy.mean", "dl.queryClient.query", "traceback.print_exc", "astropy.io.fits.getdata", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.subplots", "matplotlib.pyplot.errorbar", "dlnpyutils.utils.match",...
[((576, 597), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (590, 597), False, 'import matplotlib\n'), ((879, 932), 'dl.queryClient.query', 'qc.query', ([], {'sql': 'dataselect', 'fmt': '"""table"""', 'profile': '"""db01"""'}), "(sql=dataselect, fmt='table', profile='db01')\n", (887, 932), True,...
from numpy import sum from numpy import where from numpy import zeros from gwlfe.Input.LandUse.Ag.TileDrainRO import TileDrainRO from gwlfe.Input.LandUse.Ag.TileDrainRO import TileDrainRO_f from gwlfe.Input.WaterBudget.Water import Water from gwlfe.Memoization import memoize from gwlfe.MultiUse_Fxns.Discharge.AdjQTota...
[ "gwlfe.Input.WaterBudget.Water.Water", "gwlfe.Input.LandUse.Ag.TileDrainRO.TileDrainRO", "numpy.sum", "gwlfe.Input.LandUse.Ag.TileDrainRO.TileDrainRO_f", "numpy.zeros", "gwlfe.MultiUse_Fxns.Discharge.AdjQTotal.AdjQTotal", "numpy.where", "gwlfe.MultiUse_Fxns.Discharge.AdjQTotal.AdjQTotal_f", "gwlfe.M...
[((730, 747), 'numpy.zeros', 'zeros', (['(NYrs, 12)'], {}), '((NYrs, 12))\n', (735, 747), False, 'from numpy import zeros\n'), ((766, 931), 'gwlfe.MultiUse_Fxns.Discharge.AdjQTotal.AdjQTotal', 'AdjQTotal', (['NYrs', 'DaysMonth', 'Temp', 'InitSnow_0', 'Prec', 'NRur', 'NUrb', 'Area', 'CNI_0', 'AntMoist_0', 'Grow_0', 'CNP...
from typing import List, Tuple import numpy as np from keras import Input, Model from keras.models import Sequential from keras.layers import Dense, Activation, Convolution1D from keras.layers import Conv1D from keras.layers import MaxPooling1D from keras.layers import Dropout from keras.layers import Flatten from ker...
[ "keras.Input", "numpy.load", "keras.regularizers.l2", "keras.Model", "keras.layers.Activation", "numpy.empty", "keras.layers.Flatten", "keras.layers.Conv1D", "utils.utils.calculate_num_segments", "numpy.array", "keras.layers.Dense", "keras.layers.merge.add", "keras.backend.int_shape", "ker...
[((737, 775), 'utils.utils.calculate_num_segments', 'calculate_num_segments', (['self.input_dim'], {}), '(self.input_dim)\n', (759, 775), False, 'from utils.utils import calculate_num_segments\n'), ((865, 942), 'numpy.empty', 'np.empty', (['(new_batch_size, *self.dimension, self.n_channels)'], {'dtype': '"""float32"""'...
# 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, publish, distribute, ...
[ "os.mkdir", "routines.semi_circle_layout", "argparse.ArgumentParser", "numpy.ones", "pyroomacoustics.circular_2D_array", "numpy.isnan", "numpy.argsort", "routines.random_layout", "os.path.isfile", "matplotlib.pyplot.figure", "numpy.mean", "routines.gm_layout", "os.path.join", "matplotlib.p...
[((1288, 1311), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (1302, 1311), False, 'import matplotlib\n'), ((1767, 1799), 'numpy.array', 'np.array', (["parameters['room_dim']"], {}), "(parameters['room_dim'])\n", (1775, 1799), True, 'import numpy as np\n'), ((1963, 2040), 'routines.random_la...
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
[ "unittest.main", "paddle.reshape", "paddle.grad", "paddle.compat.get_exception_message", "numpy.product", "paddle.autograd.jacobian", "paddle.matmul", "paddle.autograd.functional._check_tensors", "paddle.rand" ]
[((1069, 1092), 'paddle.reshape', 'paddle.reshape', (['t', '[-1]'], {}), '(t, [-1])\n', (1083, 1092), False, 'import paddle\n'), ((1357, 1380), 'paddle.reshape', 'paddle.reshape', (['t', '[-1]'], {}), '(t, [-1])\n', (1371, 1380), False, 'import paddle\n'), ((1427, 1458), 'paddle.reshape', 'paddle.reshape', (['flat_t', ...
from __future__ import division, print_function import numpy as np from ctypes import POINTER, c_double, c_int64 from pyscf.nao.m_libnao import libnao libnao.rsphar.argtypes = (POINTER(c_double), POINTER(c_int64), POINTER(c_double)) libnao.rsphar_vec.argtypes = (POINTER(c_double), POINTER(c_int64), POINTER(c_int64), P...
[ "numpy.zeros", "ctypes.c_int64", "numpy.require", "ctypes.POINTER" ]
[((178, 195), 'ctypes.POINTER', 'POINTER', (['c_double'], {}), '(c_double)\n', (185, 195), False, 'from ctypes import POINTER, c_double, c_int64\n'), ((197, 213), 'ctypes.POINTER', 'POINTER', (['c_int64'], {}), '(c_int64)\n', (204, 213), False, 'from ctypes import POINTER, c_double, c_int64\n'), ((215, 232), 'ctypes.PO...
# -*- coding: utf-8 -*- """ Currently this module contains a few solvers for demonstration purposes and it is not in the scope of pyneqsys to provide "production" solvers, but instead be a package for using well established solvers for solving systems of equations defined in a uniform (optionally symbolic) way. Nevert...
[ "math.exp", "numpy.ones_like", "numpy.abs", "numpy.asarray", "numpy.mean", "numpy.array" ]
[((1635, 1654), 'numpy.array', 'np.array', (['intern_x0'], {}), '(intern_x0)\n', (1643, 1654), True, 'import numpy as np\n'), ((5168, 5213), 'math.exp', 'math.exp', (['(-iter_idx / mx_iter * self.exp_damp)'], {}), '(-iter_idx / mx_iter * self.exp_damp)\n', (5176, 5213), False, 'import math\n'), ((5684, 5697), 'numpy.me...
### Import the ONNX model to Tensorflow ### import onnx from onnx_tf.backend import prepare import torch # Load the ONNX file model = onnx.load('DA2_FMNIST/output/mnist.onnx') # Import the ONNX model to Tensorflow tf_rep = prepare(model, strict=False) # Input nodes to the model print('inputs:', tf_rep.inputs) # Ou...
[ "numpy.argmax", "numpy.asarray", "IPython.display.display", "PIL.Image.open", "onnx_tf.backend.prepare", "onnx.load" ]
[((136, 177), 'onnx.load', 'onnx.load', (['"""DA2_FMNIST/output/mnist.onnx"""'], {}), "('DA2_FMNIST/output/mnist.onnx')\n", (145, 177), False, 'import onnx\n'), ((226, 254), 'onnx_tf.backend.prepare', 'prepare', (['model'], {'strict': '(False)'}), '(model, strict=False)\n', (233, 254), False, 'from onnx_tf.backend impo...
import numpy as np import math def normalize(column): """ this function takes a array and normalizes it input : array output : normalized array """ sq_sum = 0 for ele in column: sq_sum = sq_sum + (ele*ele) norm_column = column/math.sqrt(sq_sum) return norm_column def g...
[ "numpy.dot", "numpy.array", "math.sqrt" ]
[((270, 287), 'math.sqrt', 'math.sqrt', (['sq_sum'], {}), '(sq_sum)\n', (279, 287), False, 'import math\n'), ((738, 755), 'numpy.array', 'np.array', (['A[:, i]'], {}), '(A[:, i])\n', (746, 755), True, 'import numpy as np\n'), ((991, 1015), 'numpy.dot', 'np.dot', (['cols[i]', 'element'], {}), '(cols[i], element)\n', (99...
# Imports from CausalityTest import Granger import numpy as np import matplotlib from matplotlib import pyplot as plt # matplotlib inline # use `%matplotlib notebook` for interactive figures # plt.style.use('ggplot') import sklearn import h5py import pandas as pd import tigramite from tigramite import data_processing ...
[ "tigramite.plotting.plot_timeseries", "matplotlib.pyplot.show", "pandas.read_csv", "tigramite.independence_tests.ParCorr", "tigramite.plotting.plot_time_series_graph", "tigramite.pcmci.PCMCI", "numpy.array" ]
[((671, 736), 'pandas.read_csv', 'pd.read_csv', (['"""Data/data_site.csv"""'], {'usecols': "['SWC_F_MDS_1', 'P_F']"}), "('Data/data_site.csv', usecols=['SWC_F_MDS_1', 'P_F'])\n", (682, 736), True, 'import pandas as pd\n'), ((1197, 1226), 'tigramite.plotting.plot_timeseries', 'tp.plot_timeseries', (['dataframe'], {}), '...