code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import os import numpy as np import pandas as pd import argparse import random from net_benefit_ascvd.prediction_utils.pytorch_utils.metrics import StandardEvaluator parser = argparse.ArgumentParser() parser.add_argument( "--data_path", type=str, default="", help="The root path where data is stored"...
[ "numpy.random.seed", "argparse.ArgumentParser", "os.makedirs", "pandas.read_csv", "net_benefit_ascvd.prediction_utils.pytorch_utils.metrics.StandardEvaluator", "random.seed", "pandas.read_parquet", "os.path.join" ]
[((178, 203), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (201, 203), False, 'import argparse\n'), ((1077, 1154), 'os.path.join', 'os.path.join', (['data_path', '"""experiments"""', '"""ascvd_10yr_optum_dod_regularized_eo"""'], {}), "(data_path, 'experiments', 'ascvd_10yr_optum_dod_regulariz...
import tensorflow as tf import numpy as np from BaseLayers import Layers class GlimpseNet(object): def __init__(self, input_img, config): self.layers = Layers() self.config = config # Dataset inputs self.input_img = input_img self.batch_size = config.batch_size def e...
[ "tensorflow.image.resize_images", "tensorflow.compat.v1.nn.relu", "tensorflow.compat.v1.variable_scope", "BaseLayers.Layers", "tensorflow.compat.v1.name_scope", "tensorflow.stop_gradient", "tensorflow.reshape", "numpy.empty", "tensorflow.concat", "tensorflow.image.extract_glimpse", "tensorflow.s...
[((167, 175), 'BaseLayers.Layers', 'Layers', ([], {}), '()\n', (173, 175), False, 'from BaseLayers import Layers\n'), ((385, 411), 'tensorflow.stop_gradient', 'tf.stop_gradient', (['location'], {}), '(location)\n', (401, 411), True, 'import tensorflow as tf\n'), ((4626, 4634), 'BaseLayers.Layers', 'Layers', ([], {}), '...
# roifile.py # Copyright (c) 2020-2021, <NAME> # All rights reserved. # # 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 cond...
[ "os.remove", "numpy.empty", "numpy.sin", "glob.glob", "numpy.ndarray", "os.chdir", "doctest.testmod", "matplotlib.patches.Rectangle", "tifffile.TiffFile", "os.path.exists", "struct.pack", "numpy.linspace", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "numpy.asarray", "struct...
[((4699, 4718), 'os.fspath', 'os.fspath', (['filename'], {}), '(filename)\n', (4708, 4718), False, 'import os\n'), ((29189, 29223), 'numpy.array', 'numpy.array', (['rect'], {'dtype': '"""float32"""'}), "(rect, dtype='float32')\n", (29200, 29223), False, 'import numpy\n'), ((29232, 29296), 'numpy.linspace', 'numpy.linsp...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import argparse import pickle from matplotlib import pyplot as plt import os import glob import seaborn as sns sns.set_style("white") #%% if __name__ == '__main__': parser = argparse.Argu...
[ "seaborn.set_style", "argparse.ArgumentParser", "matplotlib.pyplot.plot", "os.path.basename", "numpy.std", "matplotlib.pyplot.yticks", "matplotlib.pyplot.figure", "numpy.mean", "numpy.array", "matplotlib.pyplot.gca", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.fill_between", "matplotlib.p...
[((240, 262), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (253, 262), True, 'import seaborn as sns\n'), ((307, 332), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (330, 332), False, 'import argparse\n'), ((1639, 1660), 'numpy.mean', 'np.mean', (['coco'], {'axis'...
from __future__ import print_function import numpy as np import unittest import scipy.constants as c """ Testing Framework with unittest """ class codeTester(unittest.TestCase): def test_qn1(self): self.assertEqual(energy_n(1), -13.60569) self.assertEqual(energy_n(2), -3.40142) self.assertE...
[ "numpy.arctan2", "unittest.TextTestRunner", "numpy.sin", "unittest.TestLoader", "numpy.cos", "numpy.sqrt" ]
[((2644, 2655), 'numpy.cos', 'np.cos', (['phi'], {}), '(phi)\n', (2650, 2655), True, 'import numpy as np\n'), ((2691, 2702), 'numpy.sin', 'np.sin', (['phi'], {}), '(phi)\n', (2697, 2702), True, 'import numpy as np\n'), ((2722, 2735), 'numpy.cos', 'np.cos', (['theta'], {}), '(theta)\n', (2728, 2735), True, 'import numpy...
import numpy as np def cceps(x): """ 计算复倒谱 """ y = np.fft.fft(x) return np.fft.ifft(np.log(y)) def icceps(y): """ 计算复倒谱的逆变换 """ x = np.fft.fft(y) return np.fft.ifft(np.exp(x)) def rcceps(x): """ 计算实倒谱 """ y = np.fft.fft(x) return np.fft.ifft(np.log(np.ab...
[ "numpy.fft.fft", "numpy.exp", "numpy.abs", "numpy.log" ]
[((69, 82), 'numpy.fft.fft', 'np.fft.fft', (['x'], {}), '(x)\n', (79, 82), True, 'import numpy as np\n'), ((172, 185), 'numpy.fft.fft', 'np.fft.fft', (['y'], {}), '(y)\n', (182, 185), True, 'import numpy as np\n'), ((271, 284), 'numpy.fft.fft', 'np.fft.fft', (['x'], {}), '(x)\n', (281, 284), True, 'import numpy as np\n...
import gym from gym import spaces from gym.utils import seeding import numpy as np import matplotlib.pyplot as plt from matplotlib.pyplot import gca import matplotlib.patches as patches font = {'family': 'sans-serif', 'weight': 'bold', 'size': 14} class ShepherdingEnv(gym.Env): def __init__(self...
[ "numpy.sum", "numpy.arctan2", "numpy.abs", "numpy.ones", "matplotlib.pyplot.figure", "numpy.sin", "numpy.linalg.norm", "matplotlib.pyplot.gca", "gym.utils.seeding.np_random", "numpy.multiply", "numpy.fill_diagonal", "numpy.divide", "matplotlib.pyplot.ylim", "numpy.hstack", "matplotlib.pa...
[((1286, 1316), 'numpy.array', 'np.array', (['[-self.r_max * 3, 0]'], {}), '([-self.r_max * 3, 0])\n', (1294, 1316), True, 'import numpy as np\n'), ((1767, 1801), 'numpy.zeros', 'np.zeros', (['(self.n_agents, self.nx)'], {}), '((self.n_agents, self.nx))\n', (1775, 1801), True, 'import numpy as np\n'), ((1882, 1984), 'g...
import numpy as np from numpy import sqrt, abs from numpy.linalg import inv, norm from scipy.linalg import sqrtm import copy class SE_matrix_factorization(object): def __init__(self, K=1, N=1000, M=1000, model='UV', au_av=[1, 1], ax=1, verbose=False): # Parameters self.model = model # Model 'XX...
[ "numpy.sum", "numpy.random.randn", "numpy.zeros", "numpy.identity", "copy.copy", "numpy.ones", "numpy.linalg.inv", "numpy.linalg.norm" ]
[((1086, 1105), 'numpy.identity', 'np.identity', (['self.K'], {}), '(self.K)\n', (1097, 1105), True, 'import numpy as np\n'), ((1987, 2014), 'numpy.linalg.inv', 'inv', (['(self.Sigma_v + gamma_u)'], {}), '(self.Sigma_v + gamma_u)\n', (1990, 2014), False, 'from numpy.linalg import inv, norm\n'), ((2535, 2562), 'numpy.li...
"""Duplicates Phillips' "Mechanics of Flight" Example 2.3.1""" import pyprop import numpy as np from pyprop.helpers import to_rpm import matplotlib.pyplot as plt # Declare prop getter functions def airfoil_CL(**kwargs): alpha = kwargs.get("alpha", 0.0) a_b = np.asarray(alpha+np.radians(2.1)) return np.whe...
[ "numpy.radians", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "numpy.zeros", "pyprop.helpers.to_rpm", "matplotlib.pyplot.figure", "numpy.sin", "numpy.linspace", "matplotlib.pyplot.gca", "pyprop.BladeElementProp", "matplotlib.pyplot.ylabel", "numpy.cos", "matplotlib.pyplot.xlabel" ]
[((1239, 1268), 'numpy.linspace', 'np.linspace', (['(0.0)', '(1.4)', 'num_Js'], {}), '(0.0, 1.4, num_Js)\n', (1250, 1268), True, 'import numpy as np\n'), ((1276, 1310), 'numpy.linspace', 'np.linspace', (['(0.3)', '(1.2)', 'num_pitches'], {}), '(0.3, 1.2, num_pitches)\n', (1287, 1310), True, 'import numpy as np\n'), ((1...
import matplotlib.pyplot as plt import numpy as np import pyprobml_utils as pml xmin = 0.1 xmax = 12 ymin= -5 ymax = 4 domain = np.linspace(xmin, xmax, 1191) # num=1191 assumes a step size of 0.01 for this domain f = lambda x: np.log(x) - 2 x_k = 2 m = 1/x_k b = f(x_k) - m*x_k tl = lambda x: m*x + b plt.plot((0.1, ...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "numpy.log", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.scatter", "matplotlib.pyplot.legend", "pyprobml_utils.savefig", "numpy.linspace", "matplotlib.pyplot.gca", "matplotlib.pyplot.xticks" ]
[((130, 159), 'numpy.linspace', 'np.linspace', (['xmin', 'xmax', '(1191)'], {}), '(xmin, xmax, 1191)\n', (141, 159), True, 'import numpy as np\n'), ((305, 361), 'matplotlib.pyplot.plot', 'plt.plot', (['(0.1, 12)', '(0, 0)', '"""-k"""'], {'linewidth': '(2)', 'zorder': '(1)'}), "((0.1, 12), (0, 0), '-k', linewidth=2, zor...
#!/usr/bin/python import numpy as np import cfgrib import xarray as xr import matplotlib.pyplot as plt import cProfile import pstats import io import time from pstats import SortKey pr = cProfile.Profile() pr.enable() pc_g = 9.80665 def destagger(u, du): du[1:-1, :] += u[2:, :] + u[0:-2, :] def level_range(inde...
[ "io.StringIO", "pstats.Stats", "cfgrib.open_datasets", "time.time", "cProfile.Profile", "cfgrib.open_fileindex", "numpy.arange", "cfgrib.open_dataset" ]
[((187, 205), 'cProfile.Profile', 'cProfile.Profile', ([], {}), '()\n', (203, 205), False, 'import cProfile\n'), ((968, 981), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (979, 981), False, 'import io\n'), ((1157, 1168), 'time.time', 'time.time', ([], {}), '()\n', (1166, 1168), False, 'import time\n'), ((1181, 1327)...
import unittest, time, main, ipdb import numpy as np from mujoco_py import mjcore, mjviewer from mujoco_py.mjlib import mjlib from core.parsing import parse_domain_config, parse_problem_config from core.util_classes.plan_hdf5_serialization import PlanDeserializer from pma import hl_solver from opentamp.src.policy_ho...
[ "opentamp.src.policy_hooks.tamp_agent.LaundryWorldMujocoAgent", "ipdb.set_trace", "numpy.ones", "core.parsing.parse_problem_config.ParseProblemConfig.parse", "numpy.mean", "numpy.linalg.norm", "main.parse_file_to_dict", "core.util_classes.plan_hdf5_serialization.PlanDeserializer", "numpy.save", "n...
[((474, 511), 'main.parse_file_to_dict', 'main.parse_file_to_dict', (['domain_fname'], {}), '(domain_fname)\n', (497, 511), False, 'import unittest, time, main, ipdb\n'), ((525, 573), 'core.parsing.parse_domain_config.ParseDomainConfig.parse', 'parse_domain_config.ParseDomainConfig.parse', (['d_c'], {}), '(d_c)\n', (56...
import numpy as np FRIENDS = { "Joanna": np.array([ 0.005460137035697699, 0.016921013593673706, 0.024080386385321617, 0.026871146634221077, 0.05073751509189606, 0.030588023364543915, 0.00916608888655901, 0.0029691439121961594, -0.0970607325434...
[ "numpy.array" ]
[((46, 12165), 'numpy.array', 'np.array', (['[0.005460137035697699, 0.016921013593673706, 0.024080386385321617, \n 0.026871146634221077, 0.05073751509189606, 0.030588023364543915, \n 0.00916608888655901, 0.0029691439121961594, -0.09706073254346848, -\n 0.041623570024967194, -0.056431159377098083, -0.0281454008...
import networkx as nx import collections #import itertools as IT from scipy.ndimage import label from mayavi import mlab import numpy as np import sys import pdb def get_nhood(img): """ calculates the neighborhood of all voxel, needed to create graph out of skel image inspired by [Skel2Graph](https://gith...
[ "numpy.sum", "networkx.MultiGraph", "numpy.iinfo", "numpy.ones", "numpy.shape", "collections.defaultdict", "numpy.arange", "mayavi.mlab.gcf", "sys.stdout.flush", "numpy.pad", "numpy.zeros_like", "mayavi.mlab.points3d", "tvtk.api.tvtk.CellArray", "numpy.linspace", "numpy.lib.unravel_index...
[((958, 977), 'numpy.arange', 'np.arange', (['img.size'], {}), '(img.size)\n', (967, 977), True, 'import numpy as np\n'), ((1024, 1057), 'numpy.unravel_index', 'np.unravel_index', (['inds', 'img.shape'], {}), '(inds, img.shape)\n', (1040, 1057), True, 'import numpy as np\n'), ((1119, 1165), 'numpy.zeros', 'np.zeros', (...
#!/usr/bin/env python3.6 import os import warnings from itertools import product, chain import math import torch as tc import numpy as np import matplotlib.pyplot as plt from tabulate import tabulate __author__ = "<NAME>" __email__ = "<EMAIL>" # General Utilities def unique_filename(prefix: str="", suffix: str="", n_...
[ "math.ceil", "os.path.exists", "matplotlib.pyplot.subplots", "os.path.isfile", "matplotlib.pyplot.rcParams.update", "numpy.array", "tabulate.tabulate", "itertools.product", "numpy.random.permutation", "warnings.warn", "itertools.chain.from_iterable" ]
[((1387, 1424), 'itertools.chain.from_iterable', 'chain.from_iterable', (['([itr] * n_repeat)'], {}), '([itr] * n_repeat)\n', (1406, 1424), False, 'from itertools import product, chain\n'), ((1622, 1669), 'itertools.chain.from_iterable', 'chain.from_iterable', (['([self.itr] * self.n_repeat)'], {}), '([self.itr] * self...
""" Solution to the scenario optimization problem for enclosing sets. A scenario optimization inputs (1) a table of observations i.e. an (nxd) array, and (2) a shape. In general, a scenario program should output three data structures: (1) A list of integers pointing to the support vectors in the data set; (2) A da...
[ "scipy.special.betaincinv", "numpy.asarray", "numpy.argsort", "numpy.matlib.repmat", "numpy.all" ]
[((988, 1017), 'numpy.asarray', 'numpy.asarray', (['x'], {'dtype': 'float'}), '(x, dtype=float)\n', (1001, 1017), True, 'import numpy as numpy\n'), ((1576, 1608), 'numpy.asarray', 'numpy.asarray', (['abox'], {'dtype': 'float'}), '(abox, dtype=float)\n', (1589, 1608), True, 'import numpy as numpy\n'), ((1745, 1770), 'nu...
import sys import tensorflow as tf import numpy as np sys.path.append("../") from network_builder import NetworkBuilder from net_parser import Parser from network import Network from layer import InputLayer, OutputLayer from utils import read_image, save_image from numpy import ndarray def main(): sess = tf.Sessi...
[ "sys.path.append", "layer.InputLayer", "network_builder.NetworkBuilder", "tensorflow.global_variables_initializer", "tensorflow.Session", "utils.read_image", "numpy.reshape", "layer.OutputLayer", "net_parser.Parser" ]
[((54, 76), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (69, 76), False, 'import sys\n'), ((312, 324), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (322, 324), True, 'import tensorflow as tf\n'), ((338, 369), 'utils.read_image', 'read_image', (['"""../data/heart.jpg"""'], {}), "('.....
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: lenovo @file: CyclicCoordinate.py @time: 2021/5/22 10:26 """ import math import time import matplotlib.pyplot as plt import numpy as np from matplotlib import ticker def f(x, y): return (1 - x) ** 2 + 100 * (y - x * x) ** 2 def H(x, y): return np...
[ "matplotlib.pyplot.title", "numpy.matrix", "matplotlib.pyplot.clabel", "numpy.meshgrid", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "math.sqrt", "matplotlib.pyplot.legend", "numpy.asarray", "matplotlib.ticker.LogLocator", "time.time", "matplotlib.pyplot.figure", "numpy.linspace", ...
[((2559, 2582), 'numpy.linspace', 'np.linspace', (['(-1)', '(1.1)', 'n'], {}), '(-1, 1.1, n)\n', (2570, 2582), True, 'import numpy as np\n'), ((2587, 2610), 'numpy.linspace', 'np.linspace', (['(-1)', '(1.1)', 'n'], {}), '(-1, 1.1, n)\n', (2598, 2610), True, 'import numpy as np\n'), ((2628, 2645), 'numpy.meshgrid', 'np....
""" Dueling Double DQN <NAME>, Jan 3 2018 MIT License """ import tensorflow as tf import numpy as np class Dueling_DDQN(object): def __init__(self, n_action, n_feature, learning_rate, batch_size, gamma, e_greedy ...
[ "tensorflow.contrib.layers.xavier_initializer", "numpy.argmax", "tensorflow.get_collection", "tensorflow.gather_nd", "tensorflow.reshape", "tensorflow.train.RMSPropOptimizer", "tensorflow.assign", "numpy.random.randint", "tensorflow.variable_scope", "tensorflow.concat", "tensorflow.placeholder",...
[((830, 900), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[self.batch_size, n_feature]'], {'name': '"""state"""'}), "(tf.float32, [self.batch_size, n_feature], name='state')\n", (844, 900), True, 'import tensorflow as tf\n'), ((923, 994), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[se...
import cv2, numpy as np, sys, math from matplotlib import pyplot as plt import random kwargs = dict(arg.split('=') for arg in sys.argv[2:]) #o tamanho padrao e 1024x768 img = np.zeros((768, 1024)).astype(np.uint8) H, W = img.shape #se vai utilizar um tamanho fixo fixedSize = 'size' in kwargs #se vai utilizar um angu...
[ "random.randint", "math.sqrt", "cv2.waitKey", "cv2.imwrite", "numpy.zeros", "math.sin", "random.random", "math.cos", "numpy.int32" ]
[((1814, 1843), 'cv2.imwrite', 'cv2.imwrite', (['sys.argv[1]', 'img'], {}), '(sys.argv[1], img)\n', (1825, 1843), False, 'import cv2, numpy as np, sys, math\n'), ((1844, 1858), 'cv2.waitKey', 'cv2.waitKey', (['(0)'], {}), '(0)\n', (1855, 1858), False, 'import cv2, numpy as np, sys, math\n'), ((558, 580), 'random.randin...
import os import json import numpy as np from tqdm import tqdm from config_file import * def load_doc(doc_filename, return_docid2index=False): """ :param doc_filename: :return: doc_list - |- doc: key {'title': , 'doc_id':...
[ "json.loads", "numpy.max", "numpy.min", "numpy.array", "os.path.join" ]
[((704, 720), 'json.loads', 'json.loads', (['text'], {}), '(text)\n', (714, 720), False, 'import json\n'), ((5495, 5511), 'json.loads', 'json.loads', (['text'], {}), '(text)\n', (5505, 5511), False, 'import json\n'), ((3468, 3484), 'numpy.max', 'np.max', (['Polygons'], {}), '(Polygons)\n', (3474, 3484), True, 'import n...
''' ============== 3D quiver plot ============== Demonstrates plotting directional arrows at points on a 3d meshgrid. YOUR MISSIONS, if you choose to accept them: JALAPENO. Change the size / dimensions of the vector positions TABASCO. Make a tornado shape SRIRACHA. Make a tornado shape with higher velocity at higher...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.figure", "numpy.sin", "numpy.arange", "numpy.cos", "numpy.sqrt" ]
[((573, 585), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (583, 585), True, 'import matplotlib.pyplot as plt\n'), ((1533, 1543), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1541, 1543), True, 'import matplotlib.pyplot as plt\n'), ((716, 739), 'numpy.arange', 'np.arange', (['(-0.8)', '(1)', ...
import numpy as np import tensorflow as tf from tfoptests.persistor import TensorFlowPersistor def test_unstack(): arrs = tf.Variable(tf.constant(np.reshape(np.linspace(1, 25, 25), (5, 5)))) unstack_list = tf.unstack(arrs, axis=0) out_node = tf.reduce_sum(unstack_list, axis=0, name="output") # Run and...
[ "tensorflow.reduce_sum", "tensorflow.unstack", "numpy.linspace", "tfoptests.persistor.TensorFlowPersistor" ]
[((216, 240), 'tensorflow.unstack', 'tf.unstack', (['arrs'], {'axis': '(0)'}), '(arrs, axis=0)\n', (226, 240), True, 'import tensorflow as tf\n'), ((256, 306), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['unstack_list'], {'axis': '(0)', 'name': '"""output"""'}), "(unstack_list, axis=0, name='output')\n", (269, 306), Tr...
# IMPORT LIBRARIES import warnings warnings.filterwarnings("ignore") import datetime as dt import pandas as pd import numpy as np pd.options.mode.chained_assignment = None pd.set_option('chained_assignment', None) import plotly.express as px import plotly.graph_objects as go import dash_auth, dash from dash import d...
[ "pandas.read_csv", "dash.dcc.Graph", "pandas.set_option", "dash_bootstrap_components.Label", "dash.Dash", "plotly.express.line", "plotly.express.bar", "dash.html.Hr", "dash.html.H3", "datetime.date", "dash.dependencies.Input", "pandas.to_datetime", "dash_bootstrap_components.RadioItems", "...
[((35, 68), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (58, 68), False, 'import warnings\n'), ((173, 214), 'pandas.set_option', 'pd.set_option', (['"""chained_assignment"""', 'None'], {}), "('chained_assignment', None)\n", (186, 214), True, 'import pandas as pd\n'), ((...
"""Collection of callable functions that augment deepdow tensors.""" import numpy as np import torch def prepare_standard_scaler(X, overlap=False, indices=None): """Compute mean and standard deviation for each channel. Parameters ---------- X : np.ndarray Full features array of shape `(n_sam...
[ "torch.randn_like", "numpy.median", "torch.nn.functional.dropout", "numpy.any", "numpy.percentile", "torch.as_tensor" ]
[((2358, 2402), 'numpy.median', 'np.median', (['considered_values'], {'axis': '(0, 2, 3)'}), '(considered_values, axis=(0, 2, 3))\n', (2367, 2402), True, 'import numpy as np\n'), ((2421, 2487), 'numpy.percentile', 'np.percentile', (['considered_values', 'percentile_range'], {'axis': '(0, 2, 3)'}), '(considered_values, ...
import numpy as np import numpy.ma as ma import scipy.ndimage from cloudnetpy import utils class Lidar: """Base class for all types of Lidars.""" def __init__(self, file_name): self.file_name = file_name self.model = '' self.backscatter = np.array([]) self.data = {} se...
[ "numpy.ma.copy", "numpy.argmax", "cloudnetpy.utils.mdiff", "numpy.ma.std", "numpy.where", "numpy.array", "numpy.var" ]
[((2614, 2630), 'numpy.ma.copy', 'ma.copy', (['beta_in'], {}), '(beta_in)\n', (2621, 2630), True, 'import numpy.ma as ma\n'), ((3350, 3375), 'cloudnetpy.utils.mdiff', 'utils.mdiff', (['range_instru'], {}), '(range_instru)\n', (3361, 3375), False, 'from cloudnetpy import utils\n'), ((3615, 3643), 'numpy.where', 'np.wher...
import os import os.path as osp import numpy as np def create_dir(dir_path): if not osp.exists(dir_path): print('Path {} does not exist. Creating it...'.format(dir_path)) os.makedirs(dir_path) def clipDataTopX(dataToClip, top=2): # res = [ sorted(s, reverse=True)[0:top] for s in dataToClip ] res...
[ "numpy.array", "os.makedirs", "os.path.exists" ]
[((384, 397), 'numpy.array', 'np.array', (['res'], {}), '(res)\n', (392, 397), True, 'import numpy as np\n'), ((603, 617), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (611, 617), True, 'import numpy as np\n'), ((89, 109), 'os.path.exists', 'osp.exists', (['dir_path'], {}), '(dir_path)\n', (99, 109), True, 'i...
import numpy as np import sys bh_path = ('/Users/alacan/Cosmostat/Codes/BlendHunter') sys.path.extend([bh_path]) # Set plaidml backend for Keras before importing blendhunter import plaidml.keras plaidml.keras.install_backend() from blendhunter import BlendHunter from os.path import expanduser user_home = expanduser(...
[ "numpy.load", "numpy.save", "numpy.sum", "sys.path.extend", "blendhunter.BlendHunter", "os.path.expanduser" ]
[((87, 113), 'sys.path.extend', 'sys.path.extend', (['[bh_path]'], {}), '([bh_path])\n', (102, 113), False, 'import sys\n'), ((309, 324), 'os.path.expanduser', 'expanduser', (['"""~"""'], {}), "('~')\n", (319, 324), False, 'from os.path import expanduser\n'), ((425, 468), 'blendhunter.BlendHunter', 'BlendHunter', ([], ...
import argparse import os from . import utils import torch import numpy as np import random class Options(): def __init__(self): self.parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) self.initialize() def initialize(self): self.parser.add_argumen...
[ "numpy.random.seed", "argparse.ArgumentParser", "torch.manual_seed", "torch.cuda.manual_seed_all", "random.seed", "torch.device", "torch.cuda.set_device", "os.path.join" ]
[((156, 235), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (179, 235), False, 'import argparse\n'), ((6344, 6373), 'numpy.random.seed', 'np.random.seed', (['self.opt.seed'], {}), '...
import numpy as np import time, os from wrappers import NIAFNet import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import matplotlib.pyplot as plt from scipy.spatial.distance import pdist, squareform from torch.autograd import grad class BNN_meta(): def __init__(self, a...
[ "torch.ones", "numpy.log", "numpy.median", "scipy.spatial.distance.squareform", "torch.matmul", "scipy.spatial.distance.pdist", "torch.nn.functional.nll_loss", "torch.no_grad", "torch.sum", "torch.div", "torch.tensor" ]
[((825, 839), 'scipy.spatial.distance.pdist', 'pdist', (['x_numpy'], {}), '(x_numpy)\n', (830, 839), False, 'from scipy.spatial.distance import pdist, squareform\n'), ((865, 886), 'scipy.spatial.distance.squareform', 'squareform', (['init_dist'], {}), '(init_dist)\n', (875, 886), False, 'from scipy.spatial.distance imp...
from __future__ import print_function import time import gc import numpy as np from pepper_2d_iarlenv import parse_iaenv_args, IARLEnv, check_iaenv_args import gym from gym import spaces from pandas import DataFrame from navrep.envs.scenario_list import set_rl_scenario PUNISH_SPIN = True class IANEnv(gym.Env): "...
[ "pepper_2d_iarlenv.parse_iaenv_args", "pandas.DataFrame", "pepper_2d_iarlenv.check_iaenv_args", "navrep.tools.envplayer.EnvPlayer", "time.time", "gc.collect", "numpy.random.random", "numpy.array", "gym.spaces.Box", "pepper_2d_iarlenv.IARLEnv", "navrep.envs.scenario_list.set_rl_scenario" ]
[((6182, 6196), 'navrep.tools.envplayer.EnvPlayer', 'EnvPlayer', (['env'], {}), '(env)\n', (6191, 6196), False, 'from navrep.tools.envplayer import EnvPlayer\n'), ((1039, 1095), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(-1)', 'high': '(1)', 'shape': '(3,)', 'dtype': 'np.float32'}), '(low=-1, high=1, shape=(3,), dt...
import numpy as np import pytest import scipy.sparse import krylov from .helpers import assert_consistent from .linear_problems import ( complex_unsymmetric, hermitian_indefinite, hpd, real_unsymmetric, ) from .linear_problems import spd_dense from .linear_problems import spd_dense as spd from .linear...
[ "numpy.abs", "numpy.dot", "numpy.asarray", "numpy.zeros", "numpy.ones", "numpy.all", "numpy.arange", "numpy.linalg.solve", "numpy.linspace", "numpy.linalg.norm", "krylov.gmres", "pytest.mark.parametrize", "pytest.mark.skip", "krylov.minres", "numpy.diag" ]
[((688, 737), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ortho"""', "['mgs', 'mgs2']"], {}), "('ortho', ['mgs', 'mgs2'])\n", (711, 737), False, 'import pytest\n'), ((2133, 2183), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""b_shape"""', '[(5,), (5, 1)]'], {}), "('b_shape', [(5,), (5, 1)]...
import os import sys import warnings BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(BASE_DIR) warnings.filterwarnings('ignore') import cv2 import math import argparse import random import numpy as np import torch from simpleAICV import datasets from simpleAICV.detection impor...
[ "numpy.random.seed", "argparse.ArgumentParser", "cv2.rectangle", "torch.device", "simpleAICV.detection.models.__dict__.keys", "cv2.imshow", "os.path.join", "sys.path.append", "os.path.abspath", "cv2.cvtColor", "cv2.namedWindow", "random.seed", "cv2.destroyAllWindows", "cv2.resize", "math...
[((109, 134), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (124, 134), False, 'import sys\n'), ((135, 168), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (158, 168), False, 'import warnings\n'), ((603, 654), 'argparse.ArgumentParser', 'argpars...
""" Gaussian Naive Bayes """ import operator import functools import numpy as np from sklearn.naive_bayes import GaussianNB as _sklearn_gaussiannb from skhyper.process import Process class GaussianNB: """Gaussian Naive Bayes Implements the Gaussian Naive Bayes algorithm for classification. The likelihoo...
[ "functools.reduce", "sklearn.naive_bayes.GaussianNB", "numpy.reshape" ]
[((2439, 2478), 'sklearn.naive_bayes.GaussianNB', '_sklearn_gaussiannb', ([], {'priors': 'self.priors'}), '(priors=self.priors)\n', (2458, 2478), True, 'from sklearn.naive_bayes import GaussianNB as _sklearn_gaussiannb\n'), ((3357, 3395), 'numpy.reshape', 'np.reshape', (['y_pred', 'self._X.shape[:-1]'], {}), '(y_pred, ...
""" Double Deep Policy Gradient with continuous action space, Reinforcement Learning. Based on yapanlau.github.io and the Continuous control with deep reinforcement learning ICLR paper from 2016 """ from Env_Plant import Plant import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import math, ra...
[ "numpy.ones", "numpy.clip", "Env_Plant.Plant", "glob.glob", "TempConfig.load_pickle", "matplotlib.pyplot.close", "Models.CriticNetwork", "OU.OrnsteinUhlenbeckActionNoise", "TempConfig.save_DDQL", "math.log", "matplotlib.pyplot.subplots", "ReplayBuffer.ReplayBuffer", "numpy.asarray", "keras...
[((1885, 1897), 'matplotlib.pyplot.close', 'plt.close', (['f'], {}), '(f)\n', (1894, 1897), True, 'import matplotlib.pyplot as plt\n'), ((3047, 3059), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (3057, 3059), True, 'import tensorflow as tf\n'), ((3099, 3118), 'keras.backend.set_session', 'K.set_session', (['s...
#!/usr/bin/env python3 """ Makes a PR curve based on output from generate_detection_metrics.py """ import argparse import numpy as np import matplotlib.pyplot as plt if __name__=="__main__": parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('data_file') parser.add_argument('--outp...
[ "numpy.load", "matplotlib.pyplot.subplots", "argparse.ArgumentParser", "matplotlib.pyplot.savefig" ]
[((207, 251), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (230, 251), False, 'import argparse\n'), ((446, 469), 'numpy.load', 'np.load', (['args.data_file'], {}), '(args.data_file)\n', (453, 469), True, 'import numpy as np\n'), ((590, 605), 'matplot...
import matplotlib.pyplot as plt import numpy as np incre_phi = list() incre_phi_val = 0 iteracion = list() for i in range(500): iteracion.append(i) incre_phi_val += 0.01 incre_phi.append(2**incre_phi_val*np.sin(2*np.pi*i/25+np.pi/2)) plt.figure() plt.plot(iteracion, incre_phi) plt.show() ...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "numpy.sin", "matplotlib.pyplot.savefig" ]
[((259, 271), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (269, 271), True, 'import matplotlib.pyplot as plt\n'), ((273, 303), 'matplotlib.pyplot.plot', 'plt.plot', (['iteracion', 'incre_phi'], {}), '(iteracion, incre_phi)\n', (281, 303), True, 'import matplotlib.pyplot as plt\n'), ((307, 317), 'matplot...
import pathlib import streamlit as st import numpy as np import pickle import matplotlib.pyplot as plt from SessionState import _get_state import tensorflow_text import tensorflow_hub as hub def main(): # Define main parameters tol = 0.1 max_sentences = 10 #debug = True # Needed to clean text_...
[ "streamlit.set_page_config", "tensorflow_hub.load", "streamlit.markdown", "SessionState._get_state", "streamlit.sidebar.checkbox", "numpy.argsort", "streamlit.text_area", "streamlit.button", "streamlit.sidebar.markdown", "pickle.load", "streamlit.pyplot", "streamlit.beta_columns", "numpy.inn...
[((347, 359), 'SessionState._get_state', '_get_state', ([], {}), '()\n', (357, 359), False, 'from SessionState import _get_state\n'), ((390, 437), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""ITC ML ChatBot"""'}), "(page_title='ITC ML ChatBot')\n", (408, 437), True, 'import streamlit as st...
import astropy.io.fits as pf import numpy as np import os as os import scipy.integrate as si from uw.stacklike.angularmodels import PSF class IrfLoader(object): def __init__(self,name): self.cdir = os.environ['CALDB']+'/data/glast/lat/bcf/' self.fpsffile = self.cdir+'psf/psf_%s_front.fits'%nam...
[ "numpy.sin", "numpy.array", "numpy.arange", "astropy.io.fits.open", "numpy.sqrt" ]
[((6679, 6726), 'numpy.sqrt', 'np.sqrt', (['((c0 * (e / 100.0) ** b) ** 2 + c1 ** 2)'], {}), '((c0 * (e / 100.0) ** b) ** 2 + c1 ** 2)\n', (6686, 6726), True, 'import numpy as np\n'), ((798, 814), 'astropy.io.fits.open', 'pf.open', (['psfname'], {}), '(psfname)\n', (805, 814), True, 'import astropy.io.fits as pf\n'), (...
import copy import math import random import numpy as np import pytest import torch import thelper class CustomSampler(torch.utils.data.sampler.RandomSampler): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.epoch = None def set_epoch(self, epoch=0): sel...
[ "torch.eq", "copy.deepcopy", "torch.randint", "torch.utils.data.dataloader.default_collate", "random.randint", "thelper.data.DataLoader", "pytest.raises", "numpy.random.randint", "torch.randperm", "math.isclose", "torch.Tensor", "thelper.data.create_loaders", "pytest.mark.parametrize", "th...
[((1279, 1328), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""num_workers"""', '[0, 1, 2]'], {}), "('num_workers', [0, 1, 2])\n", (1302, 1328), False, 'import pytest\n'), ((1405, 1533), 'thelper.data.DataLoader', 'thelper.data.DataLoader', (['tensor_dataset'], {'num_workers': 'num_workers', 'batch_size': ...
import numpy as np def compute_NR3JT(X, g_SB, G_KVL, H, g, nnode, nline, H_reg, G_reg, tf_lines, vr_lines): JSUBV = g_SB JKVL = G_KVL JKCL = np.zeros((2*3*(nnode-1), 2*3*(nnode+nline) + 2*tf_lines + 2*2*vr_lines)) for i in range(2*3*(nnode-1)): r = (2 * (X.T @ H[i, :, :])) \ + (g[i, 0, ...
[ "numpy.zeros" ]
[((154, 248), 'numpy.zeros', 'np.zeros', (['(2 * 3 * (nnode - 1), 2 * 3 * (nnode + nline) + 2 * tf_lines + 2 * 2 * vr_lines\n )'], {}), '((2 * 3 * (nnode - 1), 2 * 3 * (nnode + nline) + 2 * tf_lines + 2 *\n 2 * vr_lines))\n', (162, 248), True, 'import numpy as np\n'), ((357, 444), 'numpy.zeros', 'np.zeros', (['(2...
import logging import cv2 import numpy as np FORMAT = "%(asctime)s - %(levelname)s: %(message)s" logging.basicConfig(format=FORMAT) logger = logging.getLogger(__name__) formatter = logging.Formatter(FORMAT) logger.setLevel(logging.INFO) PARTS = { 0: 'NOSE', 1: 'LEFT_EYE', 2: 'RIGHT_EYE', 3: 'LEFT_EA...
[ "cv2.line", "cv2.circle", "numpy.flip", "logging.basicConfig", "numpy.argmax", "logging.Formatter", "numpy.mean", "numpy.array", "numpy.exp", "logging.getLogger" ]
[((99, 133), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': 'FORMAT'}), '(format=FORMAT)\n', (118, 133), False, 'import logging\n'), ((143, 170), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (160, 170), False, 'import logging\n'), ((184, 209), 'logging.Formatter', 'loggin...
from datetime import datetime from keras.callbacks import TensorBoard, CSVLogger, ModelCheckpoint, ReduceLROnPlateau from keras.layers import Input, Conv2D, MaxPooling2D, Conv2DTranspose, Concatenate, BatchNormalization, TimeDistributed from keras.models import Model from keras.optimizers import Adam from os import pat...
[ "os.mkdir", "tensorflow.reduce_sum", "numpy.sum", "keras.models.Model", "keras.layers.Input", "os.path.join", "os.path.exists", "tensorflow.keras.backend.binary_crossentropy", "keras.callbacks.ReduceLROnPlateau", "datetime.datetime.now", "keras.layers.MaxPooling2D", "math.ceil", "keras.callb...
[((714, 829), 'keras.layers.Conv2D', 'Conv2D', (['filters', 'kernel'], {'activation': 'activation', 'padding': '"""same"""', 'kernel_initializer': 'kernel_initializer'}), "(filters, kernel, activation=activation, padding='same',\n kernel_initializer=kernel_initializer, **kwargs)\n", (720, 829), False, 'from keras.la...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.1.4 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # s_ra...
[ "matplotlib.pyplot.tight_layout", "numpy.meshgrid", "numpy.zeros_like", "numpy.ones_like", "numpy.datetime64", "pandas.read_csv", "matplotlib.pyplot.subplots", "matplotlib.pyplot.figure", "numpy.max", "numpy.array", "numpy.arange", "arpym.tools.aggregate_rating_migrations" ]
[((934, 961), 'numpy.datetime64', 'np.datetime64', (['"""1995-01-01"""'], {}), "('1995-01-01')\n", (947, 961), True, 'import numpy as np\n'), ((1027, 1054), 'numpy.datetime64', 'np.datetime64', (['"""2004-12-31"""'], {}), "('2004-12-31')\n", (1040, 1054), True, 'import numpy as np\n'), ((1268, 1327), 'pandas.read_csv',...
from matplotlib.colors import LinearSegmentedColormap from matplotlib import cm import matplotlib.pyplot as plt import numpy as np MATLAB_COLORS = [ [0, 0.4470, 0.7410, 1], [0.8500, 0.3250, 0.0980, 1], [0.9290, 0.6940, 0.1250, 1], [0.4940, 0.1840, 0.5560, 1], [0.4660, 0.6740, 0.1880, 1], [0.30...
[ "matplotlib.colors.LinearSegmentedColormap.from_list", "matplotlib.pyplot.register_cmap", "matplotlib.colors.LinearSegmentedColormap", "matplotlib.cm.get_cmap", "matplotlib.pyplot.imshow", "numpy.nanmax", "numpy.ones", "numpy.nanmin", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.figure", "nu...
[((1862, 2271), 'matplotlib.colors.LinearSegmentedColormap.from_list', 'LinearSegmentedColormap.from_list', (['"""seismic_wider"""', '[(0, 0, 0.3, 1), (0, 0, 0.7, 1), (0.1, 0.1, 0.9, 1), (0.3, 0.3, 0.95, 1), (\n 0.6, 0.6, 1, 1), (0.85, 0.85, 1, 1), (0.92, 0.92, 1, 0.99), (0.98, 0.98,\n 1, 0.98), (1, 1, 1, 0.95), ...
import numpy as np from math import exp, log from enum import Enum from matplotlib.pyplot import * from crisp import Distribution, LBPPIS, GibbsPIS import itertools import argparse import csv class InfectionState(Enum): SUSCEPTIBLE = 0 EXPOSED = 1 INFECTIOUS = 2 RECOVERED = 3 class CRISP(): ...
[ "numpy.full", "numpy.full_like", "numpy.random.seed", "argparse.ArgumentParser", "csv.writer", "numpy.ones_like", "crisp.Distribution", "numpy.savetxt", "numpy.cumsum", "numpy.diff", "numpy.array", "numpy.arange", "numpy.where", "numpy.random.choice", "numpy.random.rand" ]
[((23800, 23900), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Simulates testing and quarantining policies for COVID-19"""'}), "(description=\n 'Simulates testing and quarantining policies for COVID-19')\n", (23823, 23900), False, 'import argparse\n'), ((27004, 27029), 'numpy.random...
import numpy as np def cam(data, x=None): x1 = 0; x2 = 0 if data is None or not data: x1 = x[0]; x2 = x[1] else: x1 = data; x2 = x # (4-2.1.*x1.^2+x1.^4./3).*x1.^2+x1.*x2+(-4+4.*x2.^2).*x2.^2 r1 = np.multiply(2.1, np.power(x1, 2)) r1 = 4 - r1 + np.divide(np.power(x1, 4), 3) ...
[ "numpy.power", "numpy.multiply" ]
[((370, 389), 'numpy.multiply', 'np.multiply', (['x1', 'x2'], {}), '(x1, x2)\n', (381, 389), True, 'import numpy as np\n'), ((254, 269), 'numpy.power', 'np.power', (['x1', '(2)'], {}), '(x1, 2)\n', (262, 269), True, 'import numpy as np\n'), ((344, 359), 'numpy.power', 'np.power', (['x1', '(2)'], {}), '(x1, 2)\n', (352,...
import tensorflow as tf import numpy as np from utils.tools import image_box_transform from configuration import MAX_BOXES_PER_IMAGE, IMAGE_WIDTH, IMAGE_HEIGHT, FEATURE_MAPS from core.anchor import DefaultBoxes class ReadDataset(object): def __init__(self): pass @staticmethod def __get_image_inf...
[ "numpy.stack", "tensorflow.convert_to_tensor", "tensorflow.stack", "numpy.array", "utils.tools.image_box_transform" ]
[((1493, 1526), 'numpy.array', 'np.array', (['boxes'], {'dtype': 'np.float32'}), '(boxes, dtype=np.float32)\n', (1501, 1526), True, 'import numpy as np\n'), ((1979, 2007), 'numpy.stack', 'np.stack', (['boxes_list'], {'axis': '(0)'}), '(boxes_list, axis=0)\n', (1987, 2007), True, 'import numpy as np\n'), ((2073, 2118), ...
# 提升方法 AdaBoost算法 # 2020/09/16 import numpy as np from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split def load_data(): """加载数据""" X, _y = load_breast_cancer(return_X_y=True) y = [] for i in _y: if i == 0: y.append(-1) ...
[ "sklearn.ensemble.AdaBoostClassifier", "numpy.sum", "numpy.log", "numpy.multiply", "sklearn.model_selection.train_test_split", "sklearn.datasets.load_breast_cancer", "numpy.array", "numpy.sign" ]
[((206, 241), 'sklearn.datasets.load_breast_cancer', 'load_breast_cancer', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (224, 241), False, 'from sklearn.datasets import load_breast_cancer\n'), ((398, 420), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {}), '(X, y)\n', (414, 420)...
import cv2 import numpy as np import torch import torch.nn as nn import random from BPTSN import BPTSN from tsn import TSN import pdb from tqdm import tqdm from confusion_matrix_figure import draw_confusion_matrix from multi_label_loss import MLL from multi_label_loss import MLLSampler from collections.abc import Ite...
[ "numpy.random.seed", "argparse.ArgumentParser", "numpy.sum", "numpy.abs", "spatial_transform.MultiScaleRandomCrop", "numpy.ones", "numpy.clip", "torch.utils.data.DataLoader", "cv2.imwrite", "torch.load", "spatial_transform.RandomHorizontalFlip", "numpy.transpose", "temporal_transform.RepeatP...
[((1400, 1425), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1423, 1425), False, 'import argparse\n'), ((2736, 2758), 'torch.manual_seed', 'torch.manual_seed', (['(123)'], {}), '(123)\n', (2753, 2758), False, 'import torch\n'), ((2759, 2778), 'numpy.random.seed', 'np.random.seed', (['(123)']...
# -*- coding: utf-8 -*- # Copyright (c) 2016-2019 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. import warnings import numpy as np from scipy.sparse import vstack, hstack, diags from scipy.sparse import csr_matrix as sparse fr...
[ "numpy.conj", "pandapower.pypower.makeYbus.makeYbus", "numpy.abs", "warnings.simplefilter", "scipy.sparse.vstack", "pandapower.pypower.dSbr_dV.dSbr_dV", "numpy.seterr", "numpy.zeros", "pandapower.pypower.dSbus_dV.dSbus_dV", "pandapower.pypower.dIbr_dV.dIbr_dV", "numpy.imag", "warnings.catch_wa...
[((760, 804), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (769, 804), True, 'import numpy as np\n'), ((3730, 3831), 'scipy.sparse.vstack', 'vstack', (['(dSbus_dth.real, dSf_dth.real, dSt_dth.real, dSbus_dth.imag, dSf_dth.imag,\n d...
import math import unittest import geometry_msgs.msg as g_msgs import numpy as np from simulation.utils.geometry.point import InvalidPointOperationError, Point from simulation.utils.geometry.vector import Vector class ModuleTest(unittest.TestCase): def test_point_init(self): """Test if the point class c...
[ "unittest.main", "simulation.utils.geometry.vector.Vector", "math.sqrt", "geometry_msgs.msg.Point32", "numpy.array", "simulation.utils.geometry.point.Point" ]
[((1664, 1679), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1677, 1679), False, 'import unittest\n'), ((371, 382), 'simulation.utils.geometry.point.Point', 'Point', (['(1)', '(3)'], {}), '(1, 3)\n', (376, 382), False, 'from simulation.utils.geometry.point import InvalidPointOperationError, Point\n'), ((970, 98...
# License: BSD 3 clause import numpy as np from tick.hawkes.simulation.base import SimuPointProcess from tick.hawkes.simulation.build.hawkes_simulation import Poisson as _Poisson class SimuPoissonProcess(SimuPointProcess): """Homogeneous Poisson process simulation Parameters ---------- intensities ...
[ "tick.hawkes.simulation.build.hawkes_simulation.Poisson", "numpy.array", "tick.hawkes.simulation.base.SimuPointProcess.__init__" ]
[((1974, 2077), 'tick.hawkes.simulation.base.SimuPointProcess.__init__', 'SimuPointProcess.__init__', (['self'], {'end_time': 'end_time', 'max_jumps': 'max_jumps', 'seed': 'seed', 'verbose': 'verbose'}), '(self, end_time=end_time, max_jumps=max_jumps,\n seed=seed, verbose=verbose)\n', (1999, 2077), False, 'from tick...
import matplotlib.pyplot as plt import numpy as np # functions to show an image def imshow(img): img = img / 2 + 0.5 # unnormalize npimg = img.numpy() plt.imshow(np.transpose(npimg, (1, 2, 0)))
[ "numpy.transpose" ]
[((190, 220), 'numpy.transpose', 'np.transpose', (['npimg', '(1, 2, 0)'], {}), '(npimg, (1, 2, 0))\n', (202, 220), True, 'import numpy as np\n')]
from time import sleep import numpy as np from numpy import ma import matplotlib.pyplot as plt from robo_motion import Robot from filterpy.kalman import UnscentedKalmanFilter, MerweScaledSigmaPoints from filterpy.common import Q_discrete_white_noise rnd = np.random.RandomState(0) step = 0.01 r = Robot((0.0, 0.0), [(...
[ "matplotlib.pyplot.plot", "filterpy.common.Q_discrete_white_noise", "matplotlib.pyplot.legend", "filterpy.kalman.UnscentedKalmanFilter", "numpy.random.RandomState", "time.sleep", "matplotlib.pyplot.ion", "matplotlib.pyplot.figure", "filterpy.kalman.MerweScaledSigmaPoints", "numpy.array", "numpy....
[((258, 282), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (279, 282), True, 'import numpy as np\n'), ((300, 370), 'robo_motion.Robot', 'Robot', (['(0.0, 0.0)', '[(0.1, 1.0, 0.0), (1, 1.0, np.pi), (1.0, 1.0, 0.0)]'], {}), '((0.0, 0.0), [(0.1, 1.0, 0.0), (1, 1.0, np.pi), (1.0, 1.0, 0.0)])...
#!/usr/bin/python3 #=========================== image02_threshold =========================== # # @brief Code to test out the simple image detector for a fairly # contrived scenario: threshold a grayscale image. # # Extends ``image01_threshold`` to have a bigger array and visual output of # the array data ...
[ "cv2.waitKey", "detector.inImage.inImage", "numpy.zeros", "improcessor.basic.basic" ]
[((975, 995), 'numpy.zeros', 'np.zeros', (['(100, 100)'], {}), '((100, 100))\n', (983, 995), True, 'import numpy as np\n'), ((1144, 1180), 'improcessor.basic.basic', 'improcessor.basic', (['operator.ge', '(7,)'], {}), '(operator.ge, (7,))\n', (1161, 1180), True, 'import improcessor.basic as improcessor\n'), ((1189, 121...
import pandas as pd import gzip from io import StringIO import xml.etree.ElementTree as ET import awkward import numpy as np import tqdm import datetime enable_debug_logging = False def print_log(*args, **kwargs): time_string = datetime.datetime.now() print(f"[{time_string}]", *args, **kwargs) def do_noth...
[ "pandas.DataFrame", "io.StringIO", "tqdm.tqdm", "numpy.sum", "gzip.open", "xml.etree.ElementTree.fromstring", "numpy.array", "datetime.datetime.now" ]
[((236, 259), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (257, 259), False, 'import datetime\n'), ((3069, 3086), 'numpy.array', 'np.array', (['weights'], {}), '(weights)\n', (3077, 3086), True, 'import numpy as np\n'), ((6479, 6512), 'xml.etree.ElementTree.fromstring', 'ET.fromstring', (['joine...
__author__ = '<NAME>' import numpy as np import hashlib, json from pyqchem.errors import StructureError class Structure: """ Structure object containing all the geometric data of the molecule """ def __init__(self, coordinates=None, symbols=None, atom...
[ "numpy.abs", "pymatgen.symmetry.analyzer.PointGroupAnalyzer", "numpy.mod", "numpy.where", "numpy.array", "warnings.warn", "pyqchem.errors.StructureError" ]
[((858, 879), 'numpy.array', 'np.array', (['coordinates'], {}), '(coordinates)\n', (866, 879), True, 'import numpy as np\n'), ((2423, 2444), 'numpy.array', 'np.array', (['coordinates'], {}), '(coordinates)\n', (2431, 2444), True, 'import numpy as np\n'), ((4799, 4858), 'numpy.array', 'np.array', (["[i for i in self._sy...
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.2.4 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %matplotlib inline # %a...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "numpy.log", "dtrace.DTracePlot.DTracePlot.plot_corrplot_discrete", "seaborn.clustermap", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.close", "matplotlib.patches.Circle", "matplotlib.pyplot.figure", "dtrace.DTracePlot.DTracePlot", "matplo...
[((693, 747), 'dtrace.Associations.Association', 'Association', ([], {'load_associations': '(True)', 'combine_lmm': '(False)'}), '(load_associations=True, combine_lmm=False)\n', (704, 747), False, 'from dtrace.Associations import Association\n'), ((912, 942), 'dtrace.TargetHit.TargetHit', 'TargetHit', (['"""MCL1"""'], ...
import torch import numpy as np import cv2 import math import deepFEPE.dsac_tools.utils_misc as utils_misc def rot_to_angle(R): return rot12_to_angle_error(np.eye(3, R)) # def _R_to_q(R): # if R[2, 2] < 0: # if R[0, 0] > R[1, 1]: # t = 1. + R[0, 0] - R[1, 1] - R[2, 2] # q = tor...
[ "numpy.sum", "torch.stack", "torch.sqrt", "torch.norm", "numpy.clip", "numpy.hstack", "numpy.array", "numpy.linalg.norm", "numpy.eye", "numpy.arccos", "numpy.sqrt" ]
[((4871, 4900), 'numpy.array', 'np.array', (['q'], {'dtype': 'np.float32'}), '(q, dtype=np.float32)\n', (4879, 4900), True, 'import numpy as np\n'), ((5100, 5276), 'numpy.array', 'np.array', (['[[q[0, 0], -q[1, 0], -q[2, 0], -q[3, 0]], [q[1, 0], q[0, 0], -q[3, 0], q[2,\n 0]], [q[2, 0], q[3, 0], q[0, 0], -q[1, 0]], [...
import argparse import numpy as np import time import os import logging import pickle from concurrent import futures import grpc import service_pb2 import service_pb2_grpc from timemachine.lib import custom_ops, ops class Worker(service_pb2_grpc.WorkerServicer): def __init__(self): self.state = None...
[ "pickle.loads", "numpy.zeros_like", "timemachine.lib.custom_ops.ReversibleContext_f64", "argparse.ArgumentParser", "logging.basicConfig", "numpy.zeros", "time.time", "concurrent.futures.ThreadPoolExecutor", "service_pb2.EmptyMessage", "timemachine.lib.custom_ops.AlchemicalStepper_f64", "pickle.d...
[((4413, 4465), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Worker Server"""'}), "(description='Worker Server')\n", (4436, 4465), False, 'import argparse\n'), ((4784, 4805), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (4803, 4805), False, 'import logging\n'), ((408...
import csv import os import numpy as np #import numpy from tqdm import tqdm import matplotlib.pyplot as plt sessionname = "TW2_UK_Medium" def read_csv(sessionname,packet): Filename = generate_path(sessionname,packet) rows = [] with open('{}.csv'.format(Filename),'r') as csv_file: lines = len(...
[ "tqdm.tqdm", "matplotlib.pyplot.show", "csv.reader", "matplotlib.pyplot.plot", "numpy.argmax", "os.path.isdir", "matplotlib.pyplot.legend", "numpy.argsort", "numpy.shape", "numpy.where", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "os.path.join" ]
[((699, 713), 'numpy.array', 'np.array', (['rows'], {}), '(rows)\n', (707, 713), True, 'import numpy as np\n'), ((1311, 1356), 'matplotlib.pyplot.plot', 'plt.plot', (['header[:, 6]', 'main_part[:, 0][:, 0]'], {}), '(header[:, 6], main_part[:, 0][:, 0])\n', (1319, 1356), True, 'import matplotlib.pyplot as plt\n'), ((135...
import numpy as np import matplotlib.pyplot as plt import random import time plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签 plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号 # 定义目标函数 def obj_fun(x: np.ndarray): return abs(0.2 * x[0]) + 10 * np.sin(5 * x[0]) + 7 * np.cos(4 * x[0]) def obj_fun2(...
[ "numpy.meshgrid", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.axes", "numpy.zeros", "random.random", "matplotlib.pyplot.figure", "numpy.sin", "numpy.array", "numpy.exp", "numpy.cos", "numpy.arange", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matpl...
[((5930, 5950), 'numpy.array', 'np.array', (['[-20, -20]'], {}), '([-20, -20])\n', (5938, 5950), True, 'import numpy as np\n'), ((5961, 5979), 'numpy.array', 'np.array', (['[20, 20]'], {}), '([20, 20])\n', (5969, 5979), True, 'import numpy as np\n'), ((462, 516), 'numpy.exp', 'np.exp', (['(-1 * (x[0] - np.pi) ** 2 - (x...
# Copyright 2020 Google LLC # # 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, ...
[ "absl.testing.absltest.main", "tensorflow.compat.v2.config.experimental_run_functions_eagerly", "functools.partial", "tensorflow.compat.v2.constant", "tensorflow.compat.v2.convert_to_tensor", "numpy.allclose", "graphs.get_num_graphs", "graphs.split_graphs_tuple", "featurization.MolTensorizer", "ta...
[((3037, 3085), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (['*TASK_TEST_CASES'], {}), '(*TASK_TEST_CASES)\n', (3067, 3085), False, 'from absl.testing import parameterized\n'), ((3289, 3337), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (['*TASK_...
import socket import sys import datetime import cv2 import pickle import numpy as np import struct ## new import zlib HOST='' PORT=8485 s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) print('Socket created') s.bind((HOST,PORT)) data = b"" encode_param = [int(cv2.IMWRITE_JPEG_QUALITY), 90] payload_size = struct....
[ "numpy.random.seed", "numpy.sum", "socket.socket", "cv2.imdecode", "cv2.imencode", "mrcnn.model.MaskRCNN", "os.path.join", "sys.path.append", "mrcnn.utils.download_trained_weights", "os.path.abspath", "os.path.exists", "struct.pack", "pickle.dumps", "pickle.loads", "struct.unpack", "st...
[((140, 189), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (153, 189), False, 'import socket\n'), ((313, 334), 'struct.calcsize', 'struct.calcsize', (['""">L"""'], {}), "('>L')\n", (328, 334), False, 'import struct\n'), ((1337, 1354), 'numpy...
import pathlib import pickle from pprint import pprint import manga109api import numpy as np # Instantiate a parser with the root directory of Manga109. This can be a relative or absolute path. manga109_root_dir = "Manga109_released_2021_02_28" p = manga109api.Parser(root_dir=manga109_root_dir) formatted_data: dict ...
[ "numpy.zeros", "pathlib.Path", "manga109api.Parser", "pickle.dump" ]
[((251, 297), 'manga109api.Parser', 'manga109api.Parser', ([], {'root_dir': 'manga109_root_dir'}), '(root_dir=manga109_root_dir)\n', (269, 297), False, 'import manga109api\n'), ((393, 424), 'pathlib.Path', 'pathlib.Path', (['manga109_root_dir'], {}), '(manga109_root_dir)\n', (405, 424), False, 'import pathlib\n'), ((25...
from __future__ import print_function import numpy as np from pybilt.common.running_stats import BlockAverager def test_block_averager(): block_0_data = np.array([1.2, 1.7, 2.3, 1.4, 2.0]) block_1_data = np.array([3.3, 0.8, 1.6, 1.8, 2.1]) block_2_data = np.array([0.4, 2.1, 1.3, 1.1, 1.95]) block_0_me...
[ "pybilt.common.running_stats.BlockAverager", "numpy.array", "numpy.sqrt" ]
[((158, 193), 'numpy.array', 'np.array', (['[1.2, 1.7, 2.3, 1.4, 2.0]'], {}), '([1.2, 1.7, 2.3, 1.4, 2.0])\n', (166, 193), True, 'import numpy as np\n'), ((213, 248), 'numpy.array', 'np.array', (['[3.3, 0.8, 1.6, 1.8, 2.1]'], {}), '([3.3, 0.8, 1.6, 1.8, 2.1])\n', (221, 248), True, 'import numpy as np\n'), ((268, 304), ...
#!/usr/bin/env python __author__ = "<NAME>" __copyright__ = "Copyright 2013, The American Gut Project" __credits__ = ["<NAME>"] __license__ = "BSD" __version__ = "unversioned" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" from americangut.agplots_parse import (parse_mapping_file_to_dict, ...
[ "unittest.main", "americangut.agplots_parse.get_filtered_taxa_summary", "americangut.agplots_parse.parse_mapping_file_to_dict", "numpy.array", "numpy.testing.assert_equal" ]
[((3239, 3245), 'unittest.main', 'main', ([], {}), '()\n', (3243, 3245), False, 'from unittest import TestCase, main\n'), ((1747, 1868), 'numpy.array', 'array', (['[[0.11, 0.15], [0.12, 0.14], [0.13, 0.13], [0.14, 0.12], [0.15, 0.11], [\n 0.16, 0.1], [0.09, 0.09], [0.1, 0.16]]'], {}), '([[0.11, 0.15], [0.12, 0.14], ...
# -*- coding: utf-8 -*- # Part of the PsychoPy library # Copyright (C) 2012-2020 iSolver Software Solutions (C) 2021 Open Science Tools Ltd. # Distributed under the terms of the GNU General Public License (GPL). import numpy as np from psychopy.iohub.client import ioHubConnection class PositionGrid(object): def ...
[ "numpy.random.uniform", "numpy.meshgrid", "numpy.asarray", "numpy.insert", "numpy.linspace", "numpy.column_stack", "psychopy.iohub.client.ioHubConnection.getActiveConnection", "numpy.delete", "numpy.random.shuffle", "numpy.sqrt" ]
[((10572, 10627), 'numpy.column_stack', 'np.column_stack', (['(vertPosOffsetList, horzPosOffsetList)'], {}), '((vertPosOffsetList, horzPosOffsetList))\n', (10587, 10627), True, 'import numpy as np\n'), ((8899, 8947), 'numpy.delete', 'np.delete', (['self.positions', 'self.firstposindex', '(0)'], {}), '(self.positions, s...
# coding=utf-8 from __future__ import print_function import numpy as np import cv2 import fitz from log_config import log import pyzbar.pyzbar as pyzbar logging = log() def format_data(data): res = {} list_1 = data.split(',') res['发票代码'] = list_1[2] res['发票号码'] = list_1[3] # 20190712 -> 2019年07月1...
[ "cv2.GaussianBlur", "log_config.log", "cv2.Canny", "cv2.boundingRect", "cv2.dilate", "cv2.waitKey", "cv2.cvtColor", "pyzbar.pyzbar.decode", "numpy.zeros", "numpy.ones", "cv2.imread", "numpy.array", "cv2.rectangle", "cv2.erode", "cv2.imshow", "cv2.inRange", "cv2.findContours" ]
[((164, 169), 'log_config.log', 'log', ([], {}), '()\n', (167, 169), False, 'from log_config import log\n'), ((614, 639), 'cv2.imshow', 'cv2.imshow', (['win_name', 'img'], {}), '(win_name, img)\n', (624, 639), False, 'import cv2\n'), ((644, 658), 'cv2.waitKey', 'cv2.waitKey', (['(0)'], {}), '(0)\n', (655, 658), False, ...
""" Optimizers ========== #. :class:`.NullOptimizer` #. :class:`.MMFF` #. :class:`.UFF` #. :class:`.ETKDG` #. :class:`.XTB` #. :class:`.MacroModelForceField` #. :class:`.MacroModelMD` #. :class:`.MOPAC` #. :class:`.OptimizerSequence` #. :class:`.CageOptimizerSequence` #. :class:`.TryCatchOptimizer` #. :class:`.Raising...
[ "os.mkdir", "rdkit.Chem.AllChem.UFFOptimizeMolecule", "rdkit.Chem.AllChem.EmbedMolecule", "shutil.rmtree", "os.chdir", "rdkit.Chem.AllChem.MMFFOptimizeMolecule", "os.path.abspath", "warnings.simplefilter", "logging.warning", "rdkit.Chem.AllChem.SanitizeMol", "os.path.exists", "warnings.catch_w...
[((2935, 2962), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2952, 2962), False, 'import logging\n'), ((3549, 3564), 'functools.wraps', 'wraps', (['optimize'], {}), '(optimize)\n', (3554, 3564), False, 'from functools import wraps\n'), ((14758, 14786), 'rdkit.Chem.AllChem.SanitizeMol',...
# PBNT: Python Bayes Network Toolbox # # Copyright (c) 2005, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notic...
[ "numpy.random.random" ]
[((4737, 4748), 'numpy.random.random', 'ra.random', ([], {}), '()\n', (4746, 4748), True, 'import numpy.random as ra\n')]
# -*- coding: utf-8 -*- import numpy import matplotlib.pyplot as plt from quantarhei.models.spectdens import DatabaseEntry from quantarhei.models.spectdens import DataDefinedEntry class example_data_defined_array(DataDefinedEntry): direct_implementation = DatabaseEntry.SPECTRAL_DENSITY identificator = ...
[ "numpy.array", "matplotlib.pyplot.show", "matplotlib.pyplot.plot" ]
[((2090, 2138), 'matplotlib.pyplot.plot', 'plt.plot', (['ex1._rawdata[:, 0]', 'ex1._rawdata[:, 1]'], {}), '(ex1._rawdata[:, 0], ex1._rawdata[:, 1])\n', (2098, 2138), True, 'import matplotlib.pyplot as plt\n'), ((2141, 2151), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2149, 2151), True, 'import matplotlib....
import math import numpy as np class Ball2D: def __init__(self, x, y, radius, colour, rotation=0.0, drawer=None, colour_setter=None): self._position = np.array([float(x), float(y)]) self._radius = radius self._angle = rotation self._mass = (radius / 10.0) * 2 if...
[ "numpy.array" ]
[((482, 500), 'numpy.array', 'np.array', (['[10, 10]'], {}), '([10, 10])\n', (490, 500), True, 'import numpy as np\n')]
# -*- coding:utf-8 -*- import sys import numpy as np sys.path.append('.')#添加工作中路径 def test_normalize(): from lib import data_preparation train = np.random.uniform(size=(32, 12, 307, 3)) val = np.random.uniform(size=(32, 12, 307, 3)) test = np.random.uniform(size=(32, 12, 307, 3)) stats, train_no...
[ "sys.path.append", "numpy.random.uniform", "lib.data_preparation.normalization" ]
[((55, 75), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (70, 75), False, 'import sys\n'), ((157, 197), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(32, 12, 307, 3)'}), '(size=(32, 12, 307, 3))\n', (174, 197), True, 'import numpy as np\n'), ((208, 248), 'numpy.random.uniform', 'np...
from typing import Dict import numpy as np import pytest import sympy as sp from qiskit import QuantumCircuit from qiskit.quantum_info.operators import Operator from sympy import Matrix from sympy.physics.quantum.qubit import Qubit from ewl import i, pi, sqrt2, number_of_qubits, sympy_to_numpy_matrix, \ U_theta_a...
[ "sympy.symbols", "qiskit.QuantumCircuit", "ewl.number_of_qubits", "ewl.U_theta_alpha_beta", "ewl.U", "sympy.Matrix", "sympy.sqrt", "ewl.U_theta_phi", "pytest.raises", "numpy.array", "ewl.J", "ewl.U_theta_phi_lambda", "ewl.EWL", "sympy.physics.quantum.qubit.Qubit", "numpy.sqrt" ]
[((1971, 1998), 'ewl.U', 'U', ([], {'theta': '(0)', 'alpha': '(0)', 'beta': '(0)'}), '(theta=0, alpha=0, beta=0)\n', (1972, 1998), False, 'from ewl import i, pi, sqrt2, number_of_qubits, sympy_to_numpy_matrix, U_theta_alpha_beta, U_theta_phi_lambda, U_theta_phi, J, U, EWL\n'), ((2007, 2035), 'ewl.U', 'U', ([], {'theta'...
from sklearn import tree import matplotlib.pyplot as plt import numpy as np import sys # preparing teaching data features = np.array([ # AIPA # ABV, IBU [6.2, 65], [6.2, 80], [6.5, 65], [6.7, 55], [6.8, 75], [6.8, 72], [6.8, 70], [7.0, 90], [7.0, 62], [7.5, 90], # A...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.scatter", "sklearn.tree.DecisionTreeClassifier", "numpy.array", "sys.exit" ]
[((125, 367), 'numpy.array', 'np.array', (['[[6.2, 65], [6.2, 80], [6.5, 65], [6.7, 55], [6.8, 75], [6.8, 72], [6.8, 70\n ], [7.0, 90], [7.0, 62], [7.5, 90], [4.8, 50], [5.2, 65], [5.3, 60], [\n 5.3, 60], [5.4, 65], [5.8, 50], [6.0, 30], [6.0, 70], [6.2, 50], [6.6, 45]]'], {}), '([[6.2, 65], [6.2, 80], [6.5, 65],...
import joblib import numpy as np from sklearn.metrics import accuracy_score, precision_score X = np.array(joblib.load("inception_preprocessed.joblib")) one_hot, labels, _ = joblib.load("labels.joblib") #grayscale X = X.mean(axis=3) differences = [] for idx, image in enumerate(X[1:]): differences.append(image - X...
[ "sklearn.metrics.accuracy_score", "numpy.insert", "numpy.array", "sklearn.metrics.precision_score", "joblib.load" ]
[((174, 202), 'joblib.load', 'joblib.load', (['"""labels.joblib"""'], {}), "('labels.joblib')\n", (185, 202), False, 'import joblib\n'), ((466, 507), 'numpy.insert', 'np.insert', (['mean_squared_error', '(-1)', 'np.inf'], {}), '(mean_squared_error, -1, np.inf)\n', (475, 507), True, 'import numpy as np\n'), ((679, 712),...
# Copyright (C) 2021 <NAME> # # SPDX-License-Identifier: MIT import basix import dolfinx_cuas import dolfinx_cuas.cpp import numpy as np import pytest import ufl from dolfinx.fem import (FunctionSpace, IntegralType, assemble_vector, create_vector, form) from dolfinx.mesh import (MeshTags, cr...
[ "ufl.TestFunction", "dolfinx_cuas.cpp.generate_vector_kernel", "dolfinx.mesh.create_unit_cube", "numpy.allclose", "numpy.isclose", "numpy.arange", "pytest.mark.parametrize", "dolfinx_cuas.cpp.generate_surface_vector_kernel", "dolfinx.fem.FunctionSpace", "basix.quadrature.string_to_type", "dolfin...
[((517, 582), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""kernel_type"""', '[dolfinx_cuas.Kernel.Rhs]'], {}), "('kernel_type', [dolfinx_cuas.Kernel.Rhs])\n", (540, 582), False, 'import pytest\n'), ((584, 622), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dim"""', '[2, 3]'], {}), "('dim', ...
import cv2 import numpy as np if __name__ == '__main__' : # Read source image. im_src = cv2.imread('../images/nightsky1.jpg') # Four corners of the book in source image pts_src = np.array([[141.1, 131.1], [480.1, 159.1], [493.1, 630.1],[64.1, 601.1]]) # Read destination image. im_dst = c...
[ "cv2.warpPerspective", "cv2.waitKey", "cv2.imread", "numpy.array", "cv2.imshow", "cv2.findHomography" ]
[((100, 137), 'cv2.imread', 'cv2.imread', (['"""../images/nightsky1.jpg"""'], {}), "('../images/nightsky1.jpg')\n", (110, 137), False, 'import cv2\n'), ((199, 272), 'numpy.array', 'np.array', (['[[141.1, 131.1], [480.1, 159.1], [493.1, 630.1], [64.1, 601.1]]'], {}), '([[141.1, 131.1], [480.1, 159.1], [493.1, 630.1], [6...
import json import numpy as np import pvlib try: from Client import windmod except: import windmod try: from Client import pvmod except: import pvmod # choose good model params temp_params = pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass'] # get weather paramameters wit...
[ "json.load", "windmod.power_calc_wind", "json.loads", "pvmod.power_calc_solar", "json.dumps", "numpy.array", "pvlib.temperature.sapm_cell" ]
[((392, 414), 'numpy.array', 'np.array', (["wind['wind']"], {}), "(wind['wind'])\n", (400, 414), True, 'import numpy as np\n'), ((1117, 1142), 'numpy.array', 'np.array', (["solar40['temp']"], {}), "(solar40['temp'])\n", (1125, 1142), True, 'import numpy as np\n'), ((1255, 1284), 'numpy.array', 'np.array', (["load['load...
# # This file is part of the erlotinib repository # (https://github.com/DavAug/erlotinib/) which is released under the # BSD 3-clause license. See accompanying LICENSE.md for copyright notice and # full license details. # import copy import numpy as np import pints import erlotinib as erlo class HierarchicalLogLik...
[ "copy.deepcopy", "numpy.sum", "numpy.empty", "pints.vector", "numpy.asarray", "copy.copy", "numpy.zeros", "erlotinib.ReducedMechanisticModel", "numpy.ones", "numpy.any", "numpy.argsort", "erlotinib.ReducedErrorModel", "numpy.array_equal" ]
[((3548, 3570), 'numpy.asarray', 'np.asarray', (['parameters'], {}), '(parameters)\n', (3558, 3570), True, 'import numpy as np\n'), ((4438, 4489), 'numpy.empty', 'np.empty', ([], {'shape': '(self._n_ids, self._n_indiv_params)'}), '(shape=(self._n_ids, self._n_indiv_params))\n', (4446, 4489), True, 'import numpy as np\n...
import numpy as np import laminate_analysis import materials import cantilevers import matplotlib.pyplot as plt from scipy.interpolate import InterpolatedUnivariateSpline from gaussian import Gaussian from laminate_fem import LaminateFEM from connectivity import Connectivity import scipy.sparse as sparse """ """ ma...
[ "cantilevers.InitialCantileverFixedTip", "laminate_fem.LaminateFEM", "materials.PiezoMumpsMaterial", "connectivity.Connectivity", "matplotlib.pyplot.show", "scipy.interpolate.InterpolatedUnivariateSpline", "numpy.sum", "laminate_analysis.LaminateAnalysis", "numpy.empty_like", "scipy.sparse.coo_mat...
[((329, 359), 'materials.PiezoMumpsMaterial', 'materials.PiezoMumpsMaterial', ([], {}), '()\n', (357, 359), False, 'import materials\n'), ((373, 412), 'cantilevers.InitialCantileverFixedTip', 'cantilevers.InitialCantileverFixedTip', ([], {}), '()\n', (410, 412), False, 'import cantilevers\n'), ((418, 480), 'laminate_an...
"""Variation of https://github.com/openai/spinningup/blob/master/spinup/examples/pytorch/pg_math/1_simple_pg.py""" import torch import torch.nn as nn from torch.distributions.categorical import Categorical import torch.optim as optim import numpy as np import gym from gym.spaces import Discrete, Box from torch.utils.d...
[ "torch.nn.ReLU", "torch.utils.data.DataLoader", "numpy.percentile", "numpy.min", "numpy.mean", "torch.nn.Linear", "torch.as_tensor", "torch.distributions.categorical.Categorical", "torch.tensor" ]
[((1855, 1881), 'torch.distributions.categorical.Categorical', 'Categorical', ([], {'logits': 'logits'}), '(logits=logits)\n', (1866, 1881), False, 'from torch.distributions.categorical import Categorical\n'), ((4299, 4354), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'dataset', 'batch_size': '(1)', '...
import numpy as np import tensorflow as tf import random from tensorflow.keras import Model, layers from tensorflow.keras import regularizers from tensorflow.keras.layers import Dense, Flatten, Conv2D, MaxPool2D, Reshape, Conv2DTranspose, UpSampling2D, ReLU class ProbabilityDistribution(Model): def call(self, logi...
[ "tensorflow.keras.regularizers.l2", "tensorflow.keras.layers.Reshape", "tensorflow.random.categorical", "tensorflow.keras.layers.ReLU", "tensorflow.keras.layers.MaxPool2D", "tensorflow.keras.layers.UpSampling2D", "numpy.squeeze", "tensorflow.nn.sparse_softmax_cross_entropy_with_logits", "tensorflow....
[((478, 554), 'tensorflow.nn.sparse_softmax_cross_entropy_with_logits', 'tf.nn.sparse_softmax_cross_entropy_with_logits', ([], {'logits': 'logits', 'labels': 'action'}), '(logits=logits, labels=action)\n', (524, 554), True, 'import tensorflow as tf\n'), ((775, 788), 'tensorflow.keras.layers.ReLU', 'layers.ReLU', ([], {...
""" NCL_stream_9.py =============== This script illustrates the following concepts: - Defining your own color map - Applying a color map to a streamplot - Using opacity to emphasize or subdue overlain features See following URLs to see the reproduced NCL plot & script: - Original NCL script: https://www.n...
[ "matplotlib.pyplot.show", "geocat.viz.util.set_titles_and_labels", "matplotlib.cm.ScalarMappable", "matplotlib.colors.BoundaryNorm", "numpy.square", "geocat.datafiles.get", "matplotlib.pyplot.figure", "numpy.arange", "cartopy.crs.PlateCarree", "matplotlib.colors.ListedColormap", "cartopy.crs.Lam...
[((972, 1151), 'matplotlib.colors.ListedColormap', 'colors.ListedColormap', (["['darkblue', 'mediumblue', 'blue', 'cornflowerblue', 'skyblue',\n 'aquamarine', 'lime', 'greenyellow', 'gold', 'orange', 'orangered',\n 'red', 'maroon']"], {}), "(['darkblue', 'mediumblue', 'blue', 'cornflowerblue',\n 'skyblue', 'aq...
# Import libraries and modules import numpy as np import pandas as pd np.random.seed(123) # for reproducibility from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Convolution2D, MaxPooling2D from keras.utils import np_utils from keras import bac...
[ "numpy.random.seed", "keras.layers.Convolution2D", "pandas.read_csv", "keras.layers.Dropout", "keras.layers.Flatten", "keras.backend.set_image_dim_ordering", "keras.utils.np_utils.to_categorical", "keras.layers.Dense", "keras.models.Sequential", "keras.layers.MaxPooling2D" ]
[((71, 90), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (85, 90), True, 'import numpy as np\n'), ((836, 872), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categorical', (['y_train', '(10)'], {}), '(y_train, 10)\n', (859, 872), False, 'from keras.utils import np_utils\n'), ((882, 917), 'ker...
# type: ignore from qepsi4 import select_active_space, run_psi4 from openfermion import ( jordan_wigner, jw_get_ground_state_at_particle_number, qubit_operator_sparse, ) from numpy import NaN, einsum import math import psi4 import pytest from collections import namedtuple from typing import List, Optional ...
[ "openfermion.jw_get_ground_state_at_particle_number", "psi4.core.clean_variables", "psi4.set_options", "pytest.fixture", "numpy.einsum", "qepsi4.run_psi4", "openfermion.jordan_wigner", "pytest.raises", "psi4.core.get_global_option", "collections.namedtuple", "qepsi4.select_active_space", "psi4...
[((576, 644), 'collections.namedtuple', 'namedtuple', (['"""Psi4Config"""', 'config_list'], {'defaults': 'config_list_defaults'}), "('Psi4Config', config_list, defaults=config_list_defaults)\n", (586, 644), False, 'from collections import namedtuple\n'), ((8570, 8727), 'pytest.mark.parametrize', 'pytest.mark.parametriz...
### Custom definitions and classes if any ### import pandas as pd import numpy as np def predictRuns(testInput): prediction = 0 ### Your Code Here ### #Open both the csv file in read mode: file1 = pd.read_csv(r'inputFile.csv', squeeze = True) file2 = pd.read_csv(r'dataset.csv', squeeze = True) ...
[ "pandas.read_csv", "numpy.random.randint" ]
[((215, 257), 'pandas.read_csv', 'pd.read_csv', (['"""inputFile.csv"""'], {'squeeze': '(True)'}), "('inputFile.csv', squeeze=True)\n", (226, 257), True, 'import pandas as pd\n'), ((273, 313), 'pandas.read_csv', 'pd.read_csv', (['"""dataset.csv"""'], {'squeeze': '(True)'}), "('dataset.csv', squeeze=True)\n", (284, 313),...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
[ "tensorflow.test.main", "numpy.random.uniform", "numpy.random.seed", "numpy.eye", "test_util.all_close", "graph_reduction._closest_column_orthogonal_matrix", "numpy.linalg.svd", "numpy.random.normal", "graph_reduction.resize_matrix", "graph_reduction.normalize_matrix", "numpy.matmul" ]
[((3096, 3110), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (3108, 3110), True, 'import tensorflow as tf\n'), ((1062, 1079), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (1076, 1079), True, 'import numpy as np\n'), ((1142, 1186), 'numpy.random.uniform', 'np.random.uniform', ([], {'size':...
import numpy as np a = np.array([(1,3,5),(8,3,2),(4,2,6)]) # Inverse Matrix print(np.linalg.inv(a)) # Determinan Matrix print(np.linalg.det(a))
[ "numpy.linalg.det", "numpy.linalg.inv", "numpy.array" ]
[((24, 67), 'numpy.array', 'np.array', (['[(1, 3, 5), (8, 3, 2), (4, 2, 6)]'], {}), '([(1, 3, 5), (8, 3, 2), (4, 2, 6)])\n', (32, 67), True, 'import numpy as np\n'), ((84, 100), 'numpy.linalg.inv', 'np.linalg.inv', (['a'], {}), '(a)\n', (97, 100), True, 'import numpy as np\n'), ((129, 145), 'numpy.linalg.det', 'np.lina...
import numpy as np from math import sqrt from sklearn import cross_validation from sklearn.cross_validation import KFold from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import mean_squared_error def random_forest_regressor( dataset, num_trees = 10, num_folds = 2): n = dataset...
[ "sklearn.cross_validation.KFold", "numpy.abs", "sklearn.metrics.mean_squared_error", "sklearn.ensemble.RandomForestRegressor" ]
[((474, 493), 'sklearn.cross_validation.KFold', 'KFold', (['n', 'num_folds'], {}), '(n, num_folds)\n', (479, 493), False, 'from sklearn.cross_validation import KFold\n'), ((800, 856), 'sklearn.ensemble.RandomForestRegressor', 'RandomForestRegressor', ([], {'n_estimators': 'num_trees', 'n_jobs': '(-1)'}), '(n_estimators...
""" """ from __future__ import division import os.path import numpy as np import click import h5py from math import log10 import sys from argparse import ArgumentParser import time from scidata.carpet.interp import Interpolator from profile_grids import (CARTESIAN_GRID, CYLINDRICAL_GRID, POLAR_GRID) from profile_for...
[ "h5py.File", "numpy.sum", "numpy.nan_to_num", "numpy.zeros", "numpy.ones", "numpy.arange", "numpy.array" ]
[((4988, 5028), 'numpy.arange', 'np.arange', ([], {'start': '(0)', 'stop': 'nlevels', 'step': '(1)'}), '(start=0, stop=nlevels, step=1)\n', (4997, 5028), True, 'import numpy as np\n'), ((4600, 4621), 'h5py.File', 'h5py.File', (['fpath', '"""r"""'], {}), "(fpath, 'r')\n", (4609, 4621), False, 'import h5py\n'), ((12273, ...
from __future__ import print_function from builtins import str from builtins import range import os import sys import numpy as np from girs.feat.layers import LayersReader from girs.rast.raster import RasterReader, RasterWriter, get_driver from girs.rast.raster import get_parameters from girs.rastfeat import rasterize ...
[ "builtins.str", "girs.rast.raster.RasterReader", "os.path.join", "numpy.ma.masked_where", "os.makedirs", "os.path.isdir", "os.path.basename", "os.path.dirname", "girs.rastfeat.rasterize.rasterize_layers", "girs.rast.raster.get_parameters", "numpy.where", "numpy.int32", "girs.feat.layers.Laye...
[((5338, 5375), 'girs.rast.raster.RasterWriter', 'RasterWriter', (['raster_parameters', 'name'], {}), '(raster_parameters, name)\n', (5350, 5375), False, 'from girs.rast.raster import RasterReader, RasterWriter, get_driver\n'), ((5573, 5613), 'builtins.range', 'range', (['raster_parameters.number_of_bands'], {}), '(ras...
# -*- coding: utf-8 -*- """SALAMI Dataset Loader SALAMI Dataset. Details can be found at http://ddmal.music.mcgill.ca/research/salami/annotations Attributes: DIR (str): The directory name for SALAMI dataset. Set to `'Salami'`. INDEX (dict): {track_id: track_data}. track_data is a jason data loaded f...
[ "mirdata.utils.get_default_dataset_path", "mirdata.utils.load_json_index", "csv.reader", "mirdata.download_utils.downloader", "mirdata.utils.validator", "os.path.exists", "mirdata.download_utils.RemoteFileMetadata", "numpy.diff", "numpy.array", "librosa.load", "os.path.join" ]
[((709, 751), 'mirdata.utils.load_json_index', 'utils.load_json_index', (['"""salami_index.json"""'], {}), "('salami_index.json')\n", (730, 751), True, 'import mirdata.utils as utils\n'), ((812, 1032), 'mirdata.download_utils.RemoteFileMetadata', 'download_utils.RemoteFileMetadata', ([], {'filename': '"""salami-data-pu...
import numpy as np import plotly.graph_objs as go import pandas as pd # ============================================================ # 对于不同维度的数据集,以下参数要调整,才能画图 df = pd.read_csv('./data/simple1.csv', sep=",", header=None) matrix = df.values print(matrix) labels = ['col1', 'col2', 'col3', 'col4', 'col5'] ideo_colors = [...
[ "numpy.sum", "pandas.read_csv", "numpy.asarray", "numpy.zeros", "numpy.ones", "plotly.graph_objs.Data", "plotly.offline.plot", "numpy.argsort", "numpy.exp", "numpy.linspace", "plotly.graph_objs.Figure" ]
[((165, 220), 'pandas.read_csv', 'pd.read_csv', (['"""./data/simple1.csv"""'], {'sep': '""","""', 'header': 'None'}), "('./data/simple1.csv', sep=',', header=None)\n", (176, 220), True, 'import pandas as pd\n'), ((2371, 2402), 'numpy.argsort', 'np.argsort', (['mapped_data'], {'axis': '(1)'}), '(mapped_data, axis=1)\n',...
from utils import * import numpy import matplotlib.pyplot as plt import os, os.path from os.path import join, dirname, exists curdir = dirname(__file__) pixels = (512, 512) quantities = ("V", "c_p", "c_n", "zflux_cp", "zflux_cn") units = ("V", "mol/m$^{3}$", "mol/m$^{3}$", "mol/(m$^{2}$*s)", "mol/(m$^{2}$*s)") Vg_a...
[ "numpy.load", "os.path.dirname", "matplotlib.pyplot.style.use", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.cla" ]
[((136, 153), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (143, 153), False, 'from os.path import join, dirname, exists\n'), ((846, 870), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""science"""'], {}), "('science')\n", (859, 870), True, 'import matplotlib.pyplot as plt\n'), ((877, 903), '...
import numpy as np class AgentGroup2D: def __init__(self, n_agent, pos=None, vel=None, mass=1): self.n_agent = n_agent if pos is not None: assert isinstance(pos, np.ndarray) assert pos.shape == (n_agent, 2) self.pos = pos else: self.pos = np.r...
[ "numpy.random.rand", "numpy.zeros" ]
[((316, 342), 'numpy.random.rand', 'np.random.rand', (['n_agent', '(2)'], {}), '(n_agent, 2)\n', (330, 342), True, 'import numpy as np\n'), ((500, 540), 'numpy.zeros', 'np.zeros', (['[n_agent, 2]'], {'dtype': 'np.float32'}), '([n_agent, 2], dtype=np.float32)\n', (508, 540), True, 'import numpy as np\n')]
import numpy as np import gym import roboschool from policies import ToeplitzPolicy, LinearPolicy def get_policy(params): if params['policy'] == "Toeplitz": return(ToeplitzPolicy(params)) elif params['policy'] == "Linear": return(LinearPolicy(params)) class worker(object): def __in...
[ "gym.make", "numpy.clip", "policies.ToeplitzPolicy", "numpy.array", "policies.LinearPolicy" ]
[((180, 202), 'policies.ToeplitzPolicy', 'ToeplitzPolicy', (['params'], {}), '(params)\n', (194, 202), False, 'from policies import ToeplitzPolicy, LinearPolicy\n'), ((394, 422), 'gym.make', 'gym.make', (["params['env_name']"], {}), "(params['env_name'])\n", (402, 422), False, 'import gym\n'), ((972, 992), 'numpy.array...
#!/usr/bin/env python # -*- coding: utf-8 -*- # __coconut_hash__ = 0x66912f49 # Compiled with Coconut version 1.5.0-post_dev78 [Fish License] """ The hyperopt backend. Does black box optimization using hyperopt. """ # Coconut Header: ------------------------------------------------------------- from __future__ impo...
[ "sys.path.pop", "hyperopt.hp.randint", "bbopt.backends.util.negate_objective", "hyperopt.hp.choice", "hyperopt.base.Trials", "hyperopt.base.Domain", "hyperopt.FMinIter", "hyperopt.base.spec_from_misc", "os.path.abspath", "os.path.dirname", "numpy.random.RandomState", "hyperopt.hp.normal", "_...
[((777, 823), 'sys.path.insert', '_coconut_sys.path.insert', (['(0)', '_coconut_file_dir'], {}), '(0, _coconut_file_dir)\n', (801, 823), True, 'import sys as _coconut_sys, os as _coconut_os\n'), ((2628, 2652), 'sys.path.pop', '_coconut_sys.path.pop', (['(0)'], {}), '(0)\n', (2649, 2652), True, 'import sys as _coconut_s...