code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import numpy as np import math from scipy.optimize import minimize class Optimize(): def __init__(self): self.c_rad2deg = 180.0 / np.pi self.c_deg2rad = np.pi / 180.0 def isRotationMatrix(self, R) : Rt = np.transpose(R) shouldBeIdentity = np.dot(Rt, R) I = np.id...
[ "numpy.identity", "numpy.clip", "numpy.cross", "math.acos", "scipy.optimize.minimize", "math.asin", "numpy.array", "numpy.dot", "math.atan2", "numpy.cos", "numpy.linalg.norm", "numpy.sin", "numpy.transpose" ]
[((246, 261), 'numpy.transpose', 'np.transpose', (['R'], {}), '(R)\n', (258, 261), True, 'import numpy as np\n'), ((289, 302), 'numpy.dot', 'np.dot', (['Rt', 'R'], {}), '(Rt, R)\n', (295, 302), True, 'import numpy as np\n'), ((315, 344), 'numpy.identity', 'np.identity', (['(3)'], {'dtype': 'R.dtype'}), '(3, dtype=R.dty...
import matplotlib.pyplot as plt import numpy as np from flatland.core.grid.grid4_utils import get_new_position from flatland.envs.agent_utils import TrainState from flatland.utils.rendertools import RenderTool, AgentRenderVariant from utils.fast_methods import fast_count_nonzero, fast_argmax class AgentCanChooseHelp...
[ "matplotlib.pyplot.imshow", "numpy.size", "utils.fast_methods.fast_count_nonzero", "numpy.zeros", "flatland.utils.rendertools.RenderTool", "utils.fast_methods.fast_argmax", "matplotlib.pyplot.pause", "numpy.full", "numpy.pad", "flatland.core.grid.grid4_utils.get_new_position", "matplotlib.pyplot...
[((1145, 1191), 'numpy.full', 'np.full', (['(self.env.height, self.env.width)', '(-1)'], {}), '((self.env.height, self.env.width), -1)\n', (1152, 1191), True, 'import numpy as np\n'), ((11908, 11982), 'numpy.pad', 'np.pad', (['binary_image', '((1, 0), (1, 0))', '"""constant"""'], {'constant_values': '(0, 0)'}), "(binar...
import logging import numpy as np from gunpowder.nodes.batch_filter import BatchFilter logger = logging.getLogger(__name__) class TanhSaturate(BatchFilter): '''Saturate the values of an array to be floats between -1 and 1 by applying the tanh function. Args: array (:class:`ArrayKey`): ...
[ "logging.getLogger", "numpy.tanh" ]
[((98, 125), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (115, 125), False, 'import logging\n'), ((852, 884), 'numpy.tanh', 'np.tanh', (['(array.data / self.scale)'], {}), '(array.data / self.scale)\n', (859, 884), True, 'import numpy as np\n')]
""" Core functionality for feature computation <NAME> Copyright (c) 2021. Pfizer Inc. All rights reserved. """ from abc import ABC, abstractmethod from collections.abc import Iterator, Sequence import json from warnings import warn from pandas import DataFrame from numpy import float_, asarray, zeros, sum, moveaxis ...
[ "numpy.asarray", "numpy.moveaxis", "numpy.sum", "json.load", "warnings.warn", "json.dump" ]
[((8060, 8077), 'json.dump', 'json.dump', (['out', 'f'], {}), '(out, f)\n', (8069, 8077), False, 'import json\n'), ((8482, 8494), 'json.load', 'json.load', (['f'], {}), '(f)\n', (8491, 8494), False, 'import json\n'), ((11254, 11275), 'numpy.moveaxis', 'moveaxis', (['x', 'axis', '(-1)'], {}), '(x, axis, -1)\n', (11262, ...
from __future__ import division import io import matplotlib as mpl import matplotlib.pyplot as plt import networkx as nx import numpy import os import tensorflow as tf def figure_to_buff(figure): """Converts the matplotlib plot specified by 'figure' to a PNG image and returns it. The supplied figure is closed a...
[ "networkx.draw_networkx_edges", "matplotlib.pyplot.savefig", "networkx.draw_networkx_edge_labels", "networkx.get_edge_attributes", "networkx.DiGraph", "io.BytesIO", "matplotlib.pyplot.clf", "matplotlib.pyplot.close", "networkx.draw_networkx_nodes", "matplotlib.pyplot.figure", "networkx.draw_netw...
[((406, 418), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (416, 418), False, 'import io\n'), ((423, 453), 'matplotlib.pyplot.savefig', 'plt.savefig', (['buf'], {'format': '"""png"""'}), "(buf, format='png')\n", (434, 453), True, 'import matplotlib.pyplot as plt\n'), ((552, 569), 'matplotlib.pyplot.close', 'plt.close'...
#!/usr/bin/env python ''' Calculating the emissions from deposits in Platypus stable accounts ''' import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, EngFormatter, PercentFormatter from strategy_const import * from const import * def boosted_pool_...
[ "numpy.sqrt", "matplotlib.ticker.PercentFormatter", "matplotlib.ticker.LinearLocator", "matplotlib.ticker.EngFormatter", "numpy.meshgrid", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((504, 545), 'numpy.sqrt', 'np.sqrt', (['(your_stable_deposit * vePTP_held)'], {}), '(your_stable_deposit * vePTP_held)\n', (511, 545), True, 'import numpy as np\n'), ((2317, 2379), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'subplot_kw': "{'projection': '3d'}", 'figsize': '(18, 9)'}), "(subplot_kw={'projecti...
from types import FunctionType import numpy as np import pandas as pd from functools import partial from multiprocessing import Pool, cpu_count def get_levenshtein_distance(str1: str, str2: str) -> float: """ Computes the Levenshtein distance between two strings :param str1: first string :param str...
[ "multiprocessing.cpu_count", "numpy.array_split", "numpy.zeros", "functools.partial", "multiprocessing.Pool" ]
[((462, 488), 'numpy.zeros', 'np.zeros', (['(size_x, size_y)'], {}), '((size_x, size_y))\n', (470, 488), True, 'import numpy as np\n'), ((2007, 2034), 'numpy.array_split', 'np.array_split', (['df', 'n_cores'], {}), '(df, n_cores)\n', (2021, 2034), True, 'import numpy as np\n'), ((2090, 2103), 'multiprocessing.Pool', 'P...
# -*- coding: utf-8 -*- import os import datetime import logging import requests import numpy import cv2 import zbar from Queue import Queue from threading import Thread from PIL import Image logger = logging.getLogger(__name__) TEMP_DIR = os.path.join(os.getcwd(), 'temp') def get_temp_dir(): """Create TEMP_DIR ...
[ "logging.getLogger", "requests.post", "numpy.array", "zbar.Image", "datetime.timedelta", "os.remove", "os.path.exists", "cv2.threshold", "cv2.line", "cv2.contourArea", "os.mkdir", "cv2.cvtColor", "PIL.Image.fromarray", "os.path.join", "os.getcwd", "zbar.ImageScanner", "datetime.datet...
[((202, 229), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (219, 229), False, 'import logging\n'), ((254, 265), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (263, 265), False, 'import os\n'), ((865, 893), 'os.path.join', 'os.path.join', (['path', 'filename'], {}), '(path, filename)\n', (...
import tensorflow as tf import numpy as np import os import time from utils import random_batch, normalize, similarity, loss_cal, optim from configuration import get_config from tensorflow.contrib import rnn config = get_config() def train(path): tf.reset_default_graph() # reset graph # dra...
[ "utils.random_batch", "numpy.array", "tensorflow.contrib.rnn.LSTMCell", "tensorflow.clip_by_global_norm", "tensorflow.placeholder", "tensorflow.Session", "tensorflow.nn.dynamic_rnn", "tensorflow.concat", "utils.similarity", "tensorflow.summary.scalar", "tensorflow.trainable_variables", "tensor...
[((226, 238), 'configuration.get_config', 'get_config', ([], {}), '()\n', (236, 238), False, 'from configuration import get_config\n'), ((266, 290), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (288, 290), True, 'import tensorflow as tf\n'), ((341, 412), 'tensorflow.placeholder', 'tf.pl...
''' <NAME> 2021 ''' import numpy as np import cv2 from numpy.fft import fftn, ifftn, fft2, ifft2, fftshift from numpy import conj, real from utils import gaussian2d_rolled_labels, cos_window from hog_cpp.fhog.get_hog import get_hog vgg_path = 'model/imagenet-vgg-verydeep-19.mat' def create_model(): from scipy ...
[ "numpy.sqrt", "scipy.io.loadmat", "cv2.imshow", "numpy.array", "numpy.divide", "numpy.mean", "numpy.multiply", "numpy.fft.fftn", "numpy.fft.fft2", "numpy.exp", "numpy.real", "numpy.max", "numpy.dot", "keras.models.Model", "keras.applications.vgg19.VGG19", "numpy.maximum", "cv2.waitKe...
[((423, 443), 'scipy.io.loadmat', 'io.loadmat', (['vgg_path'], {}), '(vgg_path)\n', (433, 443), False, 'from scipy import io\n'), ((456, 466), 'keras.applications.vgg19.VGG19', 'VGG19', (['mat'], {}), '(mat)\n', (461, 466), False, 'from keras.applications.vgg19 import VGG19\n'), ((560, 603), 'keras.models.Model', 'Mode...
"""Utility functions used in Activity 7.""" import random import numpy as np from matplotlib import pyplot as plt from keras.callbacks import TensorBoard def create_groups(data, group_size=7): """Create distinct groups from a continuous series. Parameters ---------- data: np.array Series of...
[ "numpy.abs", "matplotlib.pyplot.xlabel", "numpy.subtract", "keras.callbacks.TensorBoard", "numpy.array", "matplotlib.pyplot.figure", "random.getrandbits", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((779, 796), 'numpy.array', 'np.array', (['samples'], {}), '(samples)\n', (787, 796), True, 'import numpy as np\n'), ((2298, 2321), 'random.getrandbits', 'random.getrandbits', (['(128)'], {}), '(128)\n', (2316, 2321), False, 'import random\n'), ((2447, 2490), 'keras.callbacks.TensorBoard', 'TensorBoard', ([], {'log_di...
import pandas as pd import numpy as np import itertools __metaclass__ = type def prob_incr(species, proj_compressed_data, min_occurences = 10): p = proj_compressed_data['count_incr']/ proj_compressed_data['count'] p[proj_compressed_data['count'] < min_occurences] = -1 return p def score(species,IV, G, ex...
[ "numpy.array", "numpy.setdiff1d", "numpy.unique" ]
[((640, 653), 'numpy.unique', 'np.unique', (['GG'], {}), '(GG)\n', (649, 653), True, 'import numpy as np\n'), ((8443, 8464), 'numpy.unique', 'np.unique', (['binned[sp]'], {}), '(binned[sp])\n', (8452, 8464), True, 'import numpy as np\n'), ((1796, 1829), 'numpy.setdiff1d', 'np.setdiff1d', (['pcd.index', 'idx_base'], {})...
"""Tools for working with Cryptopunk NFTs; this includes utilities for data analysis and image preparation for training machine learning models using Cryptopunks as training data. Functions: get_punk(id) pixel_to_img(pixel_str, dim) flatten(img) unflatten(img) sort_dict_by_function_of_value(d, f) ...
[ "matplotlib.pyplot.imshow", "collections.OrderedDict", "matplotlib.pyplot.title", "matplotlib.image.imread", "requests.get", "time.sleep", "bs4.BeautifulSoup", "matplotlib.pyplot.axis", "matplotlib.pyplot.figure", "re.sub", "numpy.concatenate", "os.path.abspath", "numpy.full", "numpy.froms...
[((655, 680), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (670, 680), False, 'import os\n'), ((1216, 1269), 'matplotlib.image.imread', 'mpimg.imread', (['f"""{__PUNK_DIR__}/punk{\'%04d\' % id}.png"""'], {}), '(f"{__PUNK_DIR__}/punk{\'%04d\' % id}.png")\n', (1228, 1269), True, 'import matpl...
"""This module provides tools for assessing flood risk """ from datetime import timedelta from floodsystem.datafetcher import fetch_measure_levels import numpy as np from floodsystem.analysis import polyfit from matplotlib import dates as date def stations_level_over_threshold(stations, tol): """For a list of Mon...
[ "matplotlib.dates.date2num", "numpy.average", "numpy.polyder", "floodsystem.analysis.polyfit", "datetime.timedelta" ]
[((3640, 3657), 'datetime.timedelta', 'timedelta', ([], {'days': '(2)'}), '(days=2)\n', (3649, 3657), False, 'from datetime import timedelta\n'), ((3860, 3887), 'floodsystem.analysis.polyfit', 'polyfit', (['times', 'values'], {'p': '(4)'}), '(times, values, p=4)\n', (3867, 3887), False, 'from floodsystem.analysis impor...
import statsmodels.api as sm import statsmodels.formula.api as smf import numpy as np import pandas as pd from mlxtend.feature_selection import ExhaustiveFeatureSelector as EFS from sklearn.linear_model import LinearRegression import sys; import re def AIC(data,model,model_type,k=2): if model_type=='linear': return...
[ "mlxtend.feature_selection.ExhaustiveFeatureSelector", "numpy.log", "statsmodels.api.families.Binomial", "numpy.array", "statsmodels.api.add_constant", "pandas.DataFrame", "statsmodels.api.OLS", "sklearn.linear_model.LinearRegression", "re.search" ]
[((10412, 10448), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {'fit_intercept': '(True)'}), '(fit_intercept=True)\n', (10428, 10448), False, 'from sklearn.linear_model import LinearRegression\n'), ((10457, 10568), 'mlxtend.feature_selection.ExhaustiveFeatureSelector', 'EFS', (['lm'], {'min_feature...
import numpy as np import math import pickle def get_data(data, frame_nos, dataset, topic, usernum, fps, milisec, width, height, view_width, view_height): """ Read and return the viewport data """ VIEW_PATH = '../../Viewport/' view_info = pickle.load(open(VIEW_PATH + 'ds{}/viewport_ds{}_topic{}_user...
[ "math.ceil", "numpy.std" ]
[((5199, 5258), 'math.ceil', 'math.ceil', (['((player_width / 2 - tile_width / 2) / tile_width)'], {}), '((player_width / 2 - tile_width / 2) / tile_width)\n', (5208, 5258), False, 'import math\n'), ((5274, 5336), 'math.ceil', 'math.ceil', (['((player_height / 2 - tile_height / 2) / tile_height)'], {}), '((player_heigh...
# Copyright 2022 AI Singapore # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
[ "numpy.ones", "numpy.testing.assert_equal", "numpy.array", "pytest.raises", "peekingduck.pipeline.nodes.augment.contrast.Node" ]
[((763, 820), 'peekingduck.pipeline.nodes.augment.contrast.Node', 'Node', (["{'input': ['img'], 'output': ['img'], 'alpha': 1.0}"], {}), "({'input': ['img'], 'output': ['img'], 'alpha': 1.0})\n", (767, 820), False, 'from peekingduck.pipeline.nodes.augment.contrast import Node\n'), ((891, 948), 'peekingduck.pipeline.nod...
# coding=utf-8 # Copyright 2018 The DisentanglementLib 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 # # Un...
[ "wandb.log", "disentanglement_lib.methods.unsupervised.model.train", "disentanglement_lib.methods.unsupervised.model.cuda", "wandb.save", "wandb.Image", "disentanglement_lib.data.ground_truth.named_data.get_named_ground_truth_data", "disentanglement_lib.methods.unsupervised.model.cpu", "gin.query_para...
[((1989, 2027), 'gin.configurable', 'gin.configurable', (['"""train"""'], {'denylist': '[]'}), "('train', denylist=[])\n", (2005, 2027), False, 'import gin\n'), ((3411, 3446), 'gin.query_parameter', 'gin.query_parameter', (['"""dataset.name"""'], {}), "('dataset.name')\n", (3430, 3446), False, 'import gin\n'), ((3536, ...
"""Models and utilities for processing SMIRNOFF data.""" import abc import copy import functools from collections import defaultdict from typing import ( TYPE_CHECKING, Any, DefaultDict, Dict, List, Tuple, Type, TypeVar, Union, ) import numpy as np from openff.toolkit.topology impor...
[ "openff.units.openmm.from_openmm", "pydantic.Field", "openff.interchange.exceptions.SMIRNOFFParameterAttributeNotImplementedError", "numpy.asarray", "openff.interchange.models.TopologyKey", "openff.toolkit.typing.engines.smirnoff.parameters.LibraryChargeHandler.LibraryChargeType", "numpy.sum", "openff...
[((1814, 1860), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': '"""SMIRNOFFPotentialHandler"""'}), "('T', bound='SMIRNOFFPotentialHandler')\n", (1821, 1860), False, 'from typing import TYPE_CHECKING, Any, DefaultDict, Dict, List, Tuple, Type, TypeVar, Union\n'), ((1866, 1905), 'typing.TypeVar', 'TypeVar', (['"""T...
from __future__ import print_function import pylab as plt import numpy as np from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest, QueryDict from django.shortcuts import render_to_response, get_object_or_404, redirect, render from django.template import Context, RequestContext, loader fr...
[ "numpy.clip", "pylab.subplots_adjust", "pylab.imread", "django.http.HttpResponse", "pylab.savefig", "django.shortcuts.get_object_or_404", "numpy.zeros_like", "numpy.diff", "pylab.figure", "numpy.argsort", "numpy.zeros", "numpy.random.uniform", "numpy.cumsum", "numpy.bincount", "pylab.clf...
[((1246, 1258), 'numpy.cumsum', 'np.cumsum', (['h'], {}), '(h)\n', (1255, 1258), True, 'import numpy as np\n'), ((2058, 2091), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Job'], {'pk': 'job_id'}), '(Job, pk=job_id)\n', (2075, 2091), False, 'from django.shortcuts import render_to_response, get_object_o...
""" Created on Dec 16 2021 @author: <NAME> Poisson equation solver for the Hall effect. Includes classes for Hall bars, Hall bars in a nonlocal geometry, and Corbino disks. The Hall bar class has build in methods for longitudinal and Hall 4-probe resistance measurements. Plotting functions assume coordinates are in mic...
[ "matplotlib.pyplot.ylabel", "diff_matrices.Diff_mat_2D", "matplotlib.pyplot.pcolormesh", "numpy.arange", "matplotlib.pyplot.contourf", "scipy.sparse.eye", "numpy.where", "numpy.searchsorted", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.linspace", "numpy.meshgrid", "matplotli...
[((1161, 1193), 'numpy.linspace', 'np.linspace', (['(0)', 'self.Lx', 'self.Nx'], {}), '(0, self.Lx, self.Nx)\n', (1172, 1193), True, 'import numpy as np\n'), ((1203, 1235), 'numpy.linspace', 'np.linspace', (['(0)', 'self.Ly', 'self.Ny'], {}), '(0, self.Ly, self.Ny)\n', (1214, 1235), True, 'import numpy as np\n'), ((141...
import unittest from electropy.charge import Charge import numpy as np from electropy import volume class VolumeTest(unittest.TestCase): def setUp(self): self.position_1 = [0, 0, 0] self.position_2 = [-2, 4, 1] self.charge = 7e-9 def tearDown(self): pass # Potential fun...
[ "numpy.testing.assert_equal", "electropy.volume.field", "electropy.charge.Charge", "numpy.testing.assert_almost_equal", "electropy.volume.potential", "electropy.volume._arange", "numpy.arange" ]
[((425, 461), 'electropy.charge.Charge', 'Charge', (['self.position_1', 'self.charge'], {}), '(self.position_1, self.charge)\n', (431, 461), False, 'from electropy.charge import Charge\n'), ((490, 583), 'electropy.volume.potential', 'volume.potential', (['[charge]'], {'x_range': '[-10, 10]', 'y_range': '[-10, 10]', 'z_...
import numpy as np import matplotlib.pyplot as plt from sklearn.utils.validation import check_random_state from sklearn.datasets import fetch_olivetti_faces from sklearn.externals import joblib rng = check_random_state(21) dataset = fetch_olivetti_faces() X = dataset.images.reshape(dataset.images.shape[0], -1) trai...
[ "numpy.hstack", "sklearn.utils.validation.check_random_state", "sklearn.externals.joblib.load", "sklearn.datasets.fetch_olivetti_faces", "matplotlib.pyplot.figure", "matplotlib.pyplot.axis", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.show" ]
[((202, 224), 'sklearn.utils.validation.check_random_state', 'check_random_state', (['(21)'], {}), '(21)\n', (220, 224), False, 'from sklearn.utils.validation import check_random_state\n'), ((235, 257), 'sklearn.datasets.fetch_olivetti_faces', 'fetch_olivetti_faces', ([], {}), '()\n', (255, 257), False, 'from sklearn.d...
import tensorflow as tf from tensorflow.keras.applications.vgg16 import VGG16 from tensorflow.keras import models from tensorflow.keras.preprocessing import image from tensorflow.keras.applications.vgg16 import preprocess_input import numpy as np import cv2 # prebuild model with pre-trained weights on imagene...
[ "tensorflow.keras.preprocessing.image.load_img", "tensorflow.keras.applications.vgg16.preprocess_input", "numpy.expand_dims", "tensorflow.keras.applications.vgg16.VGG16", "tensorflow.keras.preprocessing.image.img_to_array" ]
[((336, 379), 'tensorflow.keras.applications.vgg16.VGG16', 'VGG16', ([], {'weights': '"""imagenet"""', 'include_top': '(True)'}), "(weights='imagenet', include_top=True)\n", (341, 379), False, 'from tensorflow.keras.applications.vgg16 import VGG16\n'), ((669, 717), 'tensorflow.keras.preprocessing.image.load_img', 'imag...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 7 08:38:28 2020 pyqt realtime plot tutorial source: https://www.learnpyqt.com/courses/graphics-plotting/plotting-pyqtgraph/ @author: nlourie """ from PyQt5 import QtWidgets, QtCore,uic from pyqtgraph import PlotWidget, plot,QtGui import pyqtgra...
[ "PyQt5.QtWidgets.QWidget", "numpy.mean", "adafruit_lps35hw.LPS35HW", "numpy.polyfit", "datetime.datetime.utcnow", "busio.I2C", "PyQt5.QtCore.QTimer", "time.sleep", "scipy.interpolate.interp1d", "numpy.array", "pyqtgraph.PlotWidget", "numpy.cumsum", "PyQt5.QtWidgets.QApplication", "scipy.si...
[((632, 663), 'busio.I2C', 'busio.I2C', (['board.SCL', 'board.SDA'], {}), '(board.SCL, board.SDA)\n', (641, 663), False, 'import busio\n'), ((904, 945), 'adafruit_lps35hw.LPS35HW', 'adafruit_lps35hw.LPS35HW', (['i2c'], {'address': '(92)'}), '(i2c, address=92)\n', (928, 945), False, 'import adafruit_lps35hw\n'), ((953, ...
import pandas as pd import numpy as np print(pd.__version__) # 1.0.0 print(pd.DataFrame.agg is pd.DataFrame.aggregate) # True df = pd.DataFrame({'A': [0, 1, 2], 'B': [3, 4, 5]}) print(df) # A B # 0 0 3 # 1 1 4 # 2 2 5 print(df.agg(['sum', 'mean', 'min', 'max'])) # A B # sum 3.0 12.0 # mean ...
[ "pandas.DataFrame", "numpy.sum", "numpy.amax", "numpy.abs" ]
[((134, 180), 'pandas.DataFrame', 'pd.DataFrame', (["{'A': [0, 1, 2], 'B': [3, 4, 5]}"], {}), "({'A': [0, 1, 2], 'B': [3, 4, 5]})\n", (146, 180), True, 'import pandas as pd\n'), ((2325, 2341), 'numpy.amax', 'np.amax', (["df['A']"], {}), "(df['A'])\n", (2332, 2341), True, 'import numpy as np\n'), ((2754, 2769), 'numpy.s...
import os import re import pickle import numpy as np import pandas as pd from tqdm import tqdm # Assign labels used in eep conversion eep_params = dict( age = 'Age (yrs)', hydrogen_lum = 'L_H', lum = 'Log L', logg = 'Log g', log_teff = 'Log T', core_hydrogen_frac = 'X_core', # must be added ...
[ "os.path.exists", "os.listdir", "pickle.dump", "numpy.sqrt", "os.makedirs", "tqdm.tqdm", "os.path.join", "numpy.zeros", "pandas.concat", "os.path.basename", "pandas.DataFrame", "numpy.genfromtxt" ]
[((2750, 2761), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (2758, 2761), True, 'import numpy as np\n'), ((3554, 3579), 'numpy.genfromtxt', 'np.genfromtxt', (['data_lines'], {}), '(data_lines)\n', (3567, 3579), True, 'import numpy as np\n'), ((3815, 3869), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'index': '...
from precise.covariance.movingaverage import ema_scov from precise.covariance.matrixfunctions import grand_mean, grand_shrink from sklearn.covariance._shrunk_covariance import ledoit_wolf_shrinkage import numpy as np # Experimental estimator inspired by Ledoit-Wolf # Keeps a buffer of last n_buffer observations # Tra...
[ "numpy.atleast_2d", "sklearn.covariance._shrunk_covariance.ledoit_wolf_shrinkage", "precise.covariance.movingaverage.ema_scov", "numpy.eye", "precise.covariance.matrixfunctions.grand_mean", "numpy.asarray", "numpy.dot", "precise.covariance.matrixfunctions.grand_shrink", "numpy.linalg.norm", "numpy...
[((711, 735), 'precise.covariance.movingaverage.ema_scov', 'ema_scov', (['{}', 'n_dim'], {'r': 'r'}), '({}, n_dim, r=r)\n', (719, 735), False, 'from precise.covariance.movingaverage import ema_scov\n'), ((1017, 1030), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (1027, 1030), True, 'import numpy as np\n'), ((10...
# Copyright (c) 2015-2019 by the parties listed in the AUTHORS file. # All rights reserved. Use of this source code is governed by # a BSD-style license that can be found in the LICENSE file. import numpy as np from astropy.io import fits from ..op import Operator from ..timing import function_timer from .tod_mat...
[ "astropy.io.fits.HDUList", "astropy.io.fits.PrimaryHDU", "astropy.io.fits.ImageHDU", "astropy.io.fits.Column", "numpy.isnan" ]
[((1589, 1614), 'astropy.io.fits.ImageHDU', 'fits.ImageHDU', (['gain_table'], {}), '(gain_table)\n', (1602, 1614), False, 'from astropy.io import fits\n'), ((811, 828), 'astropy.io.fits.PrimaryHDU', 'fits.PrimaryHDU', ([], {}), '()\n', (826, 828), False, 'from astropy.io import fits\n'), ((1240, 1307), 'astropy.io.fits...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 30 15:28:09 2018 @author: dataquanty """ import numpy as np from math import sqrt, pi, acos,cos from matplotlib import pyplot as plt from scipy.misc import imsave from bisect import bisect_left h , w = 1000, 1000 img = np.ones((h,w)) center = (...
[ "matplotlib.pyplot.imshow", "numpy.ones", "math.acos", "math.sqrt", "matplotlib.pyplot.figure", "matplotlib.pyplot.show" ]
[((293, 308), 'numpy.ones', 'np.ones', (['(h, w)'], {}), '((h, w))\n', (300, 308), True, 'import numpy as np\n'), ((1265, 1293), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 10)'}), '(figsize=(10, 10))\n', (1275, 1293), True, 'from matplotlib import pyplot as plt\n'), ((1300, 1328), 'matplotlib.pypl...
#!/usr/bin/env ipython import numpy as np #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ class gral(): def __init__(self): self.name = '' sh, mc = gral(), gral() cr = gral() cr.sh, cr.mc = gral(), gral() vlo, vhi = 550.0, 3000.0 #550., 3000. #100.0, 450.0 #...
[ "numpy.loadtxt" ]
[((687, 707), 'numpy.loadtxt', 'np.loadtxt', (['fname_sh'], {}), '(fname_sh)\n', (697, 707), True, 'import numpy as np\n'), ((720, 740), 'numpy.loadtxt', 'np.loadtxt', (['fname_mc'], {}), '(fname_mc)\n', (730, 740), True, 'import numpy as np\n'), ((1005, 1025), 'numpy.loadtxt', 'np.loadtxt', (['fname_sh'], {}), '(fname...
""" DUNE CVN generator module. """ __version__ = '1.0' __author__ = '<NAME>, <NAME>' __email__ = "<EMAIL>, <EMAIL>" import numpy as np import zlib class DataGenerator(object): ''' Generate data for tf.keras. ''' def __init__(self, cells=500, planes=500, views=3, batch_size=32, images_pat...
[ "numpy.empty", "numpy.random.shuffle" ]
[((2123, 2149), 'numpy.random.shuffle', 'np.random.shuffle', (['indexes'], {}), '(indexes)\n', (2140, 2149), True, 'import numpy as np\n'), ((2517, 2589), 'numpy.empty', 'np.empty', (['(self.batch_size, self.planes, self.cells, 1)'], {'dtype': '"""float32"""'}), "((self.batch_size, self.planes, self.cells, 1), dtype='f...
import numpy as np import matplotlib.pyplot as plt import tensorflow as tf def show_batch(ds: tf.data.Dataset, classes: list, rescale: bool = False, size: tuple = (10, 10), title: str = None): """ Function to show a batch of images including labels f...
[ "matplotlib.pyplot.imshow", "numpy.ceil", "numpy.argmax", "matplotlib.pyplot.figure", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.axis", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.show" ]
[((640, 664), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'size'}), '(figsize=size)\n', (650, 664), True, 'import matplotlib.pyplot as plt\n'), ((1464, 1505), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {'rect': '[0, 0.03, 1, 0.95]'}), '(rect=[0, 0.03, 1, 0.95])\n', (1480, 1505), True, 'im...
import matlab.engine import matlab import numpy as np import PIL import matplotlib.pyplot as plt import sys print(sys.version_info[0:2]) if sys.version_info[0:2] != (3, 8) and sys.version_info[0:2] != (3, 7) and sys.version_info[0:2] != (3, 6): raise Exception('Requires python 3.6, 3.7, or 3.8') eng = matlab.eng...
[ "PIL.Image.fromarray", "PIL.Image.open", "matlab.engine.start_matlab", "numpy.ones", "numpy.asarray", "PIL.ImageOps.grayscale", "matlab.double" ]
[((310, 338), 'matlab.engine.start_matlab', 'matlab.engine.start_matlab', ([], {}), '()\n', (336, 338), False, 'import matlab\n'), ((1282, 1317), 'numpy.ones', 'np.ones', (['(kernel_size, kernel_size)'], {}), '((kernel_size, kernel_size))\n', (1289, 1317), True, 'import numpy as np\n'), ((1354, 1371), 'numpy.asarray', ...
from skimage.util import img_as_float from skimage import io, filters # from skimage.viewer import ImageViewer import numpy as np def split_image_into_channels(image): """Look at each image separately""" red_channel = image[:, :, 0] green_channel = image[:, :, 1] blue_channel = image[:, :, 2] ret...
[ "numpy.clip", "skimage.util.img_as_float", "numpy.stack", "skimage.io.imread", "numpy.linspace", "skimage.io.imsave", "skimage.filters.gaussian" ]
[((460, 496), 'numpy.stack', 'np.stack', (['[red, green, blue]'], {'axis': '(2)'}), '([red, green, blue], axis=2)\n', (468, 496), True, 'import numpy as np\n'), ((607, 659), 'skimage.filters.gaussian', 'filters.gaussian', (['image'], {'sigma': '(10)', 'multichannel': '(True)'}), '(image, sigma=10, multichannel=True)\n'...
import argparse import logging from pathlib import Path import dask import h5py import joblib import numpy as np import pandas as pd from dask.diagnostics import ProgressBar from tqdm import tqdm from dsconcept.get_metrics import ( get_cat_inds, get_synth_preds, load_category_models, load_concept_mode...
[ "logging.basicConfig", "logging.getLogger", "dsconcept.get_metrics.get_synth_preds", "dask.delayed", "dask.compute", "pathlib.Path", "argparse.ArgumentParser", "dsconcept.get_metrics.get_cat_inds", "dsconcept.get_metrics.load_concept_models", "tqdm.tqdm", "h5py.File", "dsconcept.get_metrics.lo...
[((369, 408), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (388, 408), False, 'import logging\n'), ((415, 442), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (432, 442), False, 'import logging\n'), ((659, 715), 'numpy.load', 'np...
# Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and # Technical University of Darmstadt. # 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 mus...
[ "numpy.array", "pyrado.spaces.box.BoxSpace", "pyrado.environment_wrappers.action_delay.ActDelayWrapper" ]
[((2046, 2079), 'pyrado.environment_wrappers.action_delay.ActDelayWrapper', 'ActDelayWrapper', (['mockenv'], {'delay': '(0)'}), '(mockenv, delay=0)\n', (2061, 2079), False, 'from pyrado.environment_wrappers.action_delay import ActDelayWrapper\n'), ((2416, 2449), 'pyrado.environment_wrappers.action_delay.ActDelayWrapper...
#!/usr/bin/env libtbx.python # # iotbx.xds.xds_cbf.py # # <NAME>, Diamond Light Source, 2012/OCT/16 # # Class to read the CBF files used in XDS # from __future__ import absolute_import, division, print_function class reader: """A class to read the CBF files used in XDS""" def __init__(self): pass def re...
[ "pycbf.cbf_handle_struct", "numpy.fromstring" ]
[((412, 437), 'pycbf.cbf_handle_struct', 'pycbf.cbf_handle_struct', ([], {}), '()\n', (435, 437), False, 'import pycbf\n'), ((1127, 1170), 'numpy.fromstring', 'numpy.fromstring', (['image_string', 'numpy.int32'], {}), '(image_string, numpy.int32)\n', (1143, 1170), False, 'import numpy\n')]
import pickle import numpy as np def fetch_file(path): with open(path, 'rb') as fp: return pickle.load(fp) def fetch_adj_mat(column): if column == 0: return A1 elif column == 1: return A2 elif column == 2: return A3 # elif column == 3: # return A4 print(...
[ "pickle.dump", "numpy.linalg.eig", "pickle.load", "numpy.array", "numpy.linalg.norm" ]
[((1745, 1774), 'numpy.array', 'np.array', (['krp'], {'dtype': 'np.float'}), '(krp, dtype=np.float)\n', (1753, 1774), True, 'import numpy as np\n'), ((1871, 1896), 'numpy.linalg.eig', 'np.linalg.eig', (['kr_product'], {}), '(kr_product)\n', (1884, 1896), True, 'import numpy as np\n'), ((1992, 2018), 'numpy.linalg.norm'...
from typing import List, overload from flow.envs.multiagent.traffic_light_grid import MultiTrafficLightGridPOEnv from flow.envs.traffic_light_grid import TrafficLightGridPOEnv from gym.spaces import Box, Discrete import numpy as np ID_IDX = 1 class SeqTraffiLightEnv(TrafficLightGridPOEnv): def __init__(self, en...
[ "numpy.append", "numpy.array", "numpy.concatenate", "gym.spaces.Box" ]
[((1060, 1229), 'gym.spaces.Box', 'Box', ([], {'low': '(0.0)', 'high': '(1)', 'shape': '(self.num_traffic_lights, 3 * 4 * self.num_observed + 2 * self.\n num_local_edges + 2 * (1 + self.num_local_lights))', 'dtype': 'np.float32'}), '(low=0.0, high=1, shape=(self.num_traffic_lights, 3 * 4 * self.\n num_observed + ...
import os import scipy.io.wavfile import matplotlib.pyplot as plt import numpy as np import os import random ''' Create a random dataset with three different frequencies that are always in fase. Frequencies will be octave [440, 880, 1320]. ''' fs = 16000 x1 = scipy.io.wavfile.read('corpus/Analysis/a440.wav')[1] x2 ...
[ "numpy.argmax", "numpy.asarray", "os.path.join", "random.randint" ]
[((773, 794), 'random.randint', 'random.randint', (['(5)', '(10)'], {}), '(5, 10)\n', (787, 794), False, 'import random\n'), ((926, 946), 'random.randint', 'random.randint', (['(0)', '(6)'], {}), '(0, 6)\n', (940, 946), False, 'import random\n'), ((1389, 1455), 'os.path.join', 'os.path.join', (['"""corpus"""', '"""panF...
""" This module contains a pytorch dataset for learning peptide embeddings. In particular, each "instance" of the dataset comprises two peptide sequences, as well as the sNebula similarity between them. The sNebula distance reflects the BLOSSUM similarity transformed from 0 to 1. """ import logging logger = logging.ge...
[ "logging.getLogger", "numpy.clip", "pyllars.string_utils.encode_all_sequences", "torch.as_tensor", "numpy.random.default_rng", "lifesci.sequence_similarity_utils.get_snebula_score", "lifesci.peptide_dataset.PeptideDataset.load" ]
[((310, 337), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (327, 337), False, 'import logging\n'), ((3411, 3443), 'numpy.random.default_rng', 'np.random.default_rng', (['self.seed'], {}), '(self.seed)\n', (3432, 3443), True, 'import numpy as np\n'), ((3467, 3552), 'lifesci.peptide_datas...
from collections import defaultdict import itertools import numpy as np import pickle import time import warnings from Analysis import binomial_pgf, BranchModel, StaticModel from simulators.fires.UrbanForest import UrbanForest from Policies import NCTfires, UBTfires, DWTfires, RHTfires, USTfires from Utilities import ...
[ "Utilities.equivalent_percolation_control", "time.clock", "Utilities.urban_boundary", "simulators.fires.UrbanForest.UrbanForest", "Utilities.percolation_parameter", "itertools.product", "numpy.exp", "numpy.random.seed", "Utilities.fire_boundary", "numpy.amin", "Policies.NCTfires", "numpy.floor...
[((423, 445), 'numpy.seterr', 'np.seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (432, 445), True, 'import numpy as np\n'), ((575, 590), 'numpy.exp', 'np.exp', (['(-1 / 10)'], {}), '(-1 / 10)\n', (581, 590), True, 'import numpy as np\n'), ((597, 624), 'Utilities.percolation_parameter', 'percolation_parameter...
# -*- coding: utf-8 -*- """ BLEND This module defines classes and methods for blending images. :Author: <NAME> <<EMAIL>> """ import numpy as np from lmfit import Model from lmfit.models import GaussianModel, ConstantModel from modopt.base.np_adjust import pad2d from sf_tools.image.stamp import postage_stamp from s...
[ "numpy.prod", "numpy.copy", "numpy.arange", "modopt.base.np_adjust.pad2d", "sf_tools.image.distort.recentre", "numpy.sin", "numpy.max", "numpy.array", "numpy.random.randint", "lmfit.models.GaussianModel", "numpy.random.seed", "numpy.around", "numpy.cos", "numpy.random.ranf", "numpy.pad",...
[((610, 631), 'numpy.array', 'np.array', (['stamp_shape'], {}), '(stamp_shape)\n', (618, 631), True, 'import numpy as np\n'), ((1178, 1193), 'lmfit.models.GaussianModel', 'GaussianModel', ([], {}), '()\n', (1191, 1193), False, 'from lmfit.models import GaussianModel, ConstantModel\n'), ((1472, 1493), 'numpy.arange', 'n...
import os import sys import argparse import onnx import time import subprocess import numpy as np import tempfile from onnx import numpy_helper from collections import OrderedDict # Command arguments. parser = argparse.ArgumentParser() parser.add_argument('model_path', type=str, help="Path to the ONNX model.") parser...
[ "PyRuntime.ExecutionSession", "tempfile.TemporaryDirectory", "onnx.save", "collections.OrderedDict.fromkeys", "argparse.ArgumentParser", "onnx.helper.make_tensor_value_info", "os.path.join", "os.environ.get", "time.perf_counter", "onnxruntime.InferenceSession", "onnx.TensorProto", "numpy.ndenu...
[((212, 237), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (235, 237), False, 'import argparse\n'), ((2061, 2093), 'os.environ.get', 'os.environ.get', (['"""VERBOSE"""', '(False)'], {}), "('VERBOSE', False)\n", (2075, 2093), False, 'import os\n'), ((2208, 2276), 'os.path.join', 'os.path.join'...
# Copyright (c) 2020, TU Wien, Department of Geodesy and Geoinformation # 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 notice,...
[ "numpy.log10", "numpy.arccos", "numpy.sum", "numpy.zeros", "numpy.cos" ]
[((3934, 3957), 'numpy.zeros', 'np.zeros', (['distance.size'], {}), '(distance.size)\n', (3942, 3957), True, 'import numpy as np\n'), ((2192, 2205), 'numpy.log10', 'np.log10', (['val'], {}), '(val)\n', (2200, 2205), True, 'import numpy as np\n'), ((3659, 3674), 'numpy.sum', 'np.sum', (['weights'], {}), '(weights)\n', (...
"""fasterRCNN对象创建""" import numpy as np import colorsys import os from keras import backend as K from keras.applications.imagenet_utils import preprocess_input from PIL import Image, ImageFont, ImageDraw import copy import math from net import fasterrcnn as frcnn from net import netconfig as netconfig from net import ...
[ "net.tools.get_new_img_size", "colorsys.hsv_to_rgb", "numpy.array", "PIL.ImageDraw.Draw", "copy.deepcopy", "math.exp", "numpy.delete", "numpy.max", "numpy.round", "os.path.expanduser", "net.tools.BBoxUtility", "net.fasterrcnn.get_predict_model", "numpy.floor", "numpy.argmax", "numpy.shap...
[((938, 953), 'keras.backend.get_session', 'K.get_session', ([], {}), '()\n', (951, 953), True, 'from keras import backend as K\n'), ((976, 994), 'net.netconfig.Config', 'netconfig.Config', ([], {}), '()\n', (992, 994), True, 'from net import netconfig as netconfig\n'), ((1044, 1063), 'net.tools.BBoxUtility', 'tools.BB...
# Standard Library import pickle from typing import * from pathlib import Path # Third-party Party import numpy as np import PIL.Image as Image from colorama import Fore, init # Torch Library import torch import torch.utils.data as data import torchvision.transforms as T # My Library from helper import visualize_np...
[ "helper.ProjectPath.config.joinpath", "numpy.array", "helper.DatasetPath.Cifar10.test.open", "colorama.init", "numpy.load", "numpy.savez", "numpy.where", "helper.DatasetPath.Cifar100.test.open", "helper.ClassLabelLookuper", "numpy.asarray", "helper.DatasetPath.PascalVOC2012.train_idx.items", "...
[((434, 454), 'colorama.init', 'init', ([], {'autoreset': '(True)'}), '(autoreset=True)\n', (438, 454), False, 'from colorama import Fore, init\n'), ((6474, 6513), 'helper.ClassLabelLookuper', 'ClassLabelLookuper', ([], {'datasets': 'md.dataset'}), '(datasets=md.dataset)\n', (6492, 6513), False, 'from helper import Cla...
# Copyright 2022 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...
[ "mindspore.common.initializer.XavierUniform", "mindspore.common.initializer.HeUniform", "mindspore.ops.ZerosLike", "mindspore.ops.clip_by_value", "os.path.join", "math.sqrt", "mindspore.ops.OnesLike", "numpy.zeros", "mindspore.common.initializer.Normal", "mindspore.common.initializer.initializer",...
[((2894, 2908), 'mindspore.ops.OnesLike', 'ops.OnesLike', ([], {}), '()\n', (2906, 2908), True, 'import mindspore.ops as ops\n'), ((2934, 2949), 'mindspore.ops.ZerosLike', 'ops.ZerosLike', ([], {}), '()\n', (2947, 2949), True, 'import mindspore.ops as ops\n'), ((2972, 2984), 'mindspore.ops.Assign', 'ops.Assign', ([], {...
#! /usr/bin/python3 import sys sys.path.append('../../') import numpy as np import numpy.fft as npfft import matplotlib.pyplot as plt from matplotlib import animation import time from netCDF4 import MFDataset from nephelae_simulation.mesonh_interface import MesoNHVariable from nephelae_base.types import Position fr...
[ "numpy.sqrt", "netCDF4.MFDataset", "numpy.array", "numpy.sin", "sys.path.append", "sklearn.gaussian_process.GaussianProcessRegressor", "nephelae_base.types.Position", "numpy.exp", "numpy.linspace", "numpy.meshgrid", "sys.stdout.flush", "numpy.cos", "numpy.random.randn", "time.time", "mat...
[((32, 57), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (47, 57), False, 'import sys\n'), ((2711, 2737), 'numpy.linspace', 'np.linspace', (['(0)', '(300.0)', '(300)'], {}), '(0, 300.0, 300)\n', (2722, 2737), True, 'import numpy as np\n'), ((3050, 3087), 'nephelae_base.types.Position', ...
#!/usr/bin/env python3 import numpy as np import numpy.random as npr import pytest A1 = npr.rand( 1, 1) B1 = npr.rand( 1, 1) C1 = npr.rand( 1, 1) A3 = npr.rand( 3, 3) B3 = npr.rand( 3, 3) C3 = npr.rand( 3, 3) A10 = npr.rand( 10, 10) B10 = npr.rand( 10, 10) C10...
[ "numpy.random.rand", "pytest.main" ]
[((93, 107), 'numpy.random.rand', 'npr.rand', (['(1)', '(1)'], {}), '(1, 1)\n', (101, 107), True, 'import numpy.random as npr\n'), ((122, 136), 'numpy.random.rand', 'npr.rand', (['(1)', '(1)'], {}), '(1, 1)\n', (130, 136), True, 'import numpy.random as npr\n'), ((151, 165), 'numpy.random.rand', 'npr.rand', (['(1)', '(1...
import random import numpy as np import tensorflow as tf from recognition.utils import train_utils, googlenet_load try: from tensorflow.models.rnn import rnn_cell except ImportError: rnn_cell = tf.nn.rnn_cell from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops random.seed...
[ "tensorflow.python.framework.ops.RegisterGradient", "tensorflow.models.rnn.rnn_cell.MultiRNNCell", "tensorflow.get_variable", "tensorflow.transpose", "tensorflow.get_variable_scope", "tensorflow.nn.dropout", "tensorflow.nn.conv2d_transpose", "tensorflow.nn.softmax", "recognition.utils.train_utils.in...
[((309, 323), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (320, 323), False, 'import random\n'), ((324, 341), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (338, 341), True, 'import numpy as np\n'), ((345, 378), 'tensorflow.python.framework.ops.RegisterGradient', 'ops.RegisterGradient', (['""...
# AUTOGENERATED! DO NOT EDIT! File to edit: linear.ipynb (unless otherwise specified). __all__ = ['vv', 'denoising_MRF'] # Cell import numpy as np import gtsam from gtsam import noiseModel from .display import show from typing import Dict # Cell def vv(keys_vectors: Dict[int, np.ndarray]): """Create a VectorVal...
[ "numpy.eye", "gtsam.noiseModel.Isotropic.Sigmas", "numpy.random.default_rng", "gtsam.symbol", "numpy.array", "numpy.zeros", "gtsam.VectorValues", "gtsam.GaussianFactorGraph" ]
[((352, 372), 'gtsam.VectorValues', 'gtsam.VectorValues', ([], {}), '()\n', (370, 372), False, 'import gtsam\n'), ((800, 825), 'numpy.random.default_rng', 'np.random.default_rng', (['(42)'], {}), '(42)\n', (821, 825), True, 'import numpy as np\n'), ((901, 937), 'gtsam.noiseModel.Isotropic.Sigmas', 'noiseModel.Isotropic...
"""Evaluating Prophet model on M4 timeseries """ from darts.models import Prophet from darts.utils.statistics import check_seasonality from darts.utils import _build_tqdm_iterator import numpy as np import pandas as pd import pickle as pkl from M4_metrics import owa_m4, mase_m4, smape_m4 if __name__ == "__main__"...
[ "M4_metrics.mase_m4", "pandas.read_csv", "M4_metrics.smape_m4", "numpy.argmax", "numpy.stack", "darts.models.Prophet" ]
[((429, 478), 'pandas.read_csv', 'pd.read_csv', (['"""dataset/M4-info.csv"""'], {'delimiter': '""","""'}), "('dataset/M4-info.csv', delimiter=',')\n", (440, 478), True, 'import pandas as pd\n'), ((2152, 2175), 'darts.models.Prophet', 'Prophet', ([], {}), '(**prophet_args)\n', (2159, 2175), False, 'from darts.models imp...
# -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. import numpy as np from numpy.testing import assert_array_equal, assert_allclose from vispy.testing import run_tests_if_main from vispy.geometry import (create_box, create_cub...
[ "numpy.ones_like", "numpy.unique", "vispy.geometry.create_cylinder", "vispy.testing.run_tests_if_main", "vispy.geometry.create_plane", "vispy.geometry.create_sphere", "vispy.geometry.create_cube", "vispy.geometry.create_box" ]
[((1913, 1932), 'vispy.testing.run_tests_if_main', 'run_tests_if_main', ([], {}), '()\n', (1930, 1932), False, 'from vispy.testing import run_tests_if_main\n'), ((475, 487), 'vispy.geometry.create_box', 'create_box', ([], {}), '()\n', (485, 487), False, 'from vispy.geometry import create_box, create_cube, create_cylind...
import logging import numpy as np from bico.geometry.point import Point from bico.nearest_neighbor.base import NearestNeighbor from bico.utils.ClusteringFeature import ClusteringFeature from datetime import datetime from typing import Callable, TextIO, List logger = logging.getLogger(__name__) class BICONode: de...
[ "logging.getLogger", "datetime.datetime.now", "numpy.zeros" ]
[((268, 295), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (285, 295), False, 'import logging\n'), ((796, 809), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n', (804, 809), True, 'import numpy as np\n'), ((818, 831), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n', (826, 831), T...
import numpy as np from scipy.stats import linregress as li from math import exp def calc_factor(field,stepsize=0.01): """ Function for calculation of the summed binning. The returned result is an integral over the binning of the velocities. It is done for the negative and positive half separately. ...
[ "numpy.copy", "numpy.where", "numpy.log", "numpy.max", "numpy.count_nonzero", "numpy.array", "numpy.exp", "numpy.sum", "numpy.isnan", "numpy.min", "math.exp" ]
[((785, 799), 'numpy.copy', 'np.copy', (['field'], {}), '(field)\n', (792, 799), True, 'import numpy as np\n'), ((1213, 1227), 'numpy.copy', 'np.copy', (['field'], {}), '(field)\n', (1220, 1227), True, 'import numpy as np\n'), ((1496, 1516), 'numpy.array', 'np.array', (['result_pos'], {}), '(result_pos)\n', (1504, 1516...
import urllib3 import pandas as pd import numpy as np import zipfile import copy import pickle import os from esig import tosig from tqdm import tqdm from multiprocessing import Pool from functools import partial from os import listdir from os.path import isfile, join from sklearn.ensemble import RandomForestClassifier...
[ "os.listdir", "copy.deepcopy", "numpy.unique", "zipfile.ZipFile", "pandas.read_csv", "numpy.where", "os.path.join", "sklearn.ensemble.RandomForestClassifier", "numpy.max", "numpy.array", "urllib3.PoolManager", "functools.partial", "numpy.concatenate", "numpy.min", "multiprocessing.Pool",...
[((500, 521), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (519, 521), False, 'import urllib3\n'), ((784, 822), 'zipfile.ZipFile', 'zipfile.ZipFile', (['"""data/input.zip"""', '"""r"""'], {}), "('data/input.zip', 'r')\n", (799, 822), False, 'import zipfile\n'), ((1275, 1291), 'pandas.read_csv', 'pd.r...
#------------------------------------------------------------------------------- # Filename: create_pics.py # Description: creates square pictures out of a picture which is mostly empty # for training a neural network later. # The parameters to fool around with include: # factor: scaled down image for faster imag...
[ "os.path.exists", "os.listdir", "PIL.Image.open", "numpy.reshape", "os.makedirs", "os.path.splitext", "numpy.argsort", "numpy.sum", "numpy.zeros" ]
[((1785, 1803), 'os.listdir', 'listdir', (['from_path'], {}), '(from_path)\n', (1792, 1803), False, 'from os import listdir, path, makedirs\n'), ((1343, 1365), 'os.path.exists', 'path.exists', (['from_path'], {}), '(from_path)\n', (1354, 1365), False, 'from os import listdir, path, makedirs\n'), ((1883, 1911), 'os.path...
""" Helper functions for the tests """ import os import numpy as np from msl.io import read def read_sample(filename, **kwargs): """Read a file in the 'samples' directory. Parameters ---------- filename : str The name of the file in the samples/ directory Returns ------- A root...
[ "os.path.dirname", "numpy.array_equal" ]
[((955, 987), 'numpy.array_equal', 'np.array_equal', (['d1.data', 'd2.data'], {}), '(d1.data, d2.data)\n', (969, 987), True, 'import numpy as np\n'), ((365, 390), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (380, 390), False, 'import os\n'), ((661, 683), 'numpy.array_equal', 'np.array_equa...
# -*- coding: utf-8 -*- """ Created on Wed Oct 19 17:35:09 2016 @author: yxl """ from imagepy.core.engine import Tool import numpy as np from imagepy.core.manager import ColorManager from imagepy.core.draw.fill import floodfill class Plugin(Tool): title = 'Flood Fill' para = {'tor':10, 'con':'8-connect'} ...
[ "imagepy.core.manager.ColorManager.get_front", "numpy.mean", "imagepy.core.draw.fill.floodfill" ]
[((549, 624), 'imagepy.core.draw.fill.floodfill', 'floodfill', (['ips.img', 'x', 'y', "self.para['tor']", "(self.para['con'] == '8-connect')"], {}), "(ips.img, x, y, self.para['tor'], self.para['con'] == '8-connect')\n", (558, 624), False, 'from imagepy.core.draw.fill import floodfill\n'), ((684, 708), 'imagepy.core.ma...
from typing import Union from scipy.spatial.qhull import Delaunay from shapely.geometry import LineString from subsurface.structs.base_structures import StructuredData import numpy as np try: import segyio segyio_imported = True except ImportError: segyio_imported = False def read_in_segy(filepath: str, ...
[ "numpy.copy", "subsurface.structs.base_structures.StructuredData.from_numpy", "numpy.array", "numpy.zeros", "scipy.spatial.qhull.Delaunay", "segyio.open" ]
[((793, 836), 'segyio.open', 'segyio.open', (['filepath'], {'ignore_geometry': '(True)'}), '(filepath, ignore_geometry=True)\n', (804, 836), False, 'import segyio\n'), ((913, 944), 'subsurface.structs.base_structures.StructuredData.from_numpy', 'StructuredData.from_numpy', (['data'], {}), '(data)\n', (938, 944), False,...
#!/usr/bin/python #author: zhaofeng-shu33 import numpy as np from ace_cream import ace_cream def pearson_correlation(X,Y): return (np.mean(X*Y, axis=0) -np.mean(X, axis = 0)* np.mean(Y, axis = 0)) / ( np.std(X, axis = 0) * np.std(Y, axis = 0)) if __name__ == '__main__': N_SIZE = 1000 ERROR_PROBABILITY = ...
[ "numpy.mean", "numpy.unique", "numpy.random.choice", "ace_cream.ace_cream", "numpy.std", "numpy.random.uniform" ]
[((332, 369), 'numpy.random.choice', 'np.random.choice', (['[0, 1]'], {'size': 'N_SIZE'}), '([0, 1], size=N_SIZE)\n', (348, 369), True, 'import numpy as np\n'), ((376, 406), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': 'N_SIZE'}), '(size=N_SIZE)\n', (393, 406), True, 'import numpy as np\n'), ((770, 798), ...
# -*- coding: utf-8 -*- import pandas as pd import numpy as np import math import datetime import time import matplotlib.pyplot as plt import warnings warnings.filterwarnings("ignore") class Indicators(): def __init__(self, dataframe, params = []): self.dataframe = dataframe self.params = params ...
[ "datetime.datetime", "matplotlib.pyplot.subplots_adjust", "time.strptime", "math.pow", "matplotlib.pyplot.subplot", "matplotlib.pyplot.figure", "numpy.std", "pandas.DataFrame", "pandas.concat", "warnings.filterwarnings", "pandas.to_datetime", "matplotlib.pyplot.show" ]
[((151, 184), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (174, 184), False, 'import warnings\n'), ((1033, 1071), 'pandas.to_datetime', 'pd.to_datetime', (["dataframe['tradeDate']"], {}), "(dataframe['tradeDate'])\n", (1047, 1071), True, 'import pandas as pd\n'), ((1704...
#!/usr/bin/env python3 import sys import csv import datetime import math from tabulate import tabulate import scipy.stats as st from tqdm import tqdm import numpy as np np.seterr(all='ignore') def isfloat(val): try: val = float(val) if math.isnan(val): return False return ...
[ "datetime.datetime", "csv.DictReader", "datetime.datetime.fromtimestamp", "scipy.stats.kstest", "math.sqrt", "numpy.seterr", "math.isnan" ]
[((175, 198), 'numpy.seterr', 'np.seterr', ([], {'all': '"""ignore"""'}), "(all='ignore')\n", (184, 198), True, 'import numpy as np\n'), ((263, 278), 'math.isnan', 'math.isnan', (['val'], {}), '(val)\n', (273, 278), False, 'import math\n'), ((7153, 7187), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimest...
import numpy as np def flip_axis(x_in, axis): x_out = np.zeros(x_in.shape, dtype=x_in.dtype) for i, x in enumerate(x_in): x = np.asarray(x).swapaxes(axis, 0) x = x[::-1, ...] x_out[i] = x.swapaxes(0, axis) return x_out def flip_axis_fra(x, flipping_axis): pattern = [flipping_...
[ "numpy.random.random", "numpy.zeros", "numpy.array_equal", "numpy.asarray" ]
[((60, 98), 'numpy.zeros', 'np.zeros', (['x_in.shape'], {'dtype': 'x_in.dtype'}), '(x_in.shape, dtype=x_in.dtype)\n', (68, 98), True, 'import numpy as np\n'), ((614, 645), 'numpy.random.random', 'np.random.random', (['(10, 2, 3, 4)'], {}), '((10, 2, 3, 4))\n', (630, 645), True, 'import numpy as np\n'), ((845, 867), 'nu...
def elastic_rate( hv, hs, v, s, rho, mu, nx, dx, order, t, y, r0, r1, tau0_1, tau0_2, tauN_1, tauN_2, type_0, forcing, ): # we compute rates that will be used for Runge-Kutta time-stepping # import first_derivative_sbp_operators ...
[ "boundarycondition.bcm", "numpy.sqrt", "first_derivative_sbp_operators.dx", "boundarycondition.bcp", "numpy.exp", "numpy.zeros", "numpy.cos", "numpy.sin" ]
[((378, 395), 'numpy.zeros', 'np.zeros', (['(nx, 1)'], {}), '((nx, 1))\n', (386, 395), True, 'import numpy as np\n'), ((404, 421), 'numpy.zeros', 'np.zeros', (['(nx, 1)'], {}), '((nx, 1))\n', (412, 421), True, 'import numpy as np\n'), ((431, 448), 'numpy.zeros', 'np.zeros', (['(nx, 1)'], {}), '((nx, 1))\n', (439, 448),...
import numpy as np import pandas as pd import pytest from etna.datasets import TSDataset from etna.datasets import generate_ar_df from etna.datasets import generate_const_df from etna.datasets import generate_periodic_df from etna.metrics import R2 from etna.models import LinearPerSegmentModel from etna.transforms imp...
[ "etna.transforms.encoders.categorical.LabelEncoderTransform", "etna.datasets.TSDataset.to_dataset", "etna.datasets.generate_periodic_df", "numpy.random.default_rng", "etna.metrics.R2", "etna.datasets.TSDataset", "etna.models.LinearPerSegmentModel", "etna.transforms.FilterFeaturesTransform", "etna.da...
[((8503, 8595), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""in_column, prefix"""', "[('2', ''), ('regressor_1', 'regressor_')]"], {}), "('in_column, prefix', [('2', ''), ('regressor_1',\n 'regressor_')])\n", (8526, 8595), False, 'import pytest\n'), ((9071, 9163), 'pytest.mark.parametrize', 'pytest.ma...
from sklearn.model_selection import train_test_split import pandas as pd import numpy as np from keras.models import Sequential from keras.layers import Dense, Activation, Flatten from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import f1_score from sklearn.metrics import accuracy_score, confusi...
[ "sklearn.model_selection.train_test_split", "sklearn.ensemble.RandomForestClassifier", "numpy.array", "matplotlib.pyplot.figure", "numpy.random.seed", "sklearn.tree.plot_tree", "numpy.genfromtxt", "sklearn.metrics.accuracy_score", "numpy.random.shuffle" ]
[((613, 630), 'numpy.random.seed', 'np.random.seed', (['(7)'], {}), '(7)\n', (627, 630), True, 'import numpy as np\n'), ((657, 736), 'numpy.genfromtxt', 'np.genfromtxt', (['"""covid_filtered_1-5_allMin3.csv"""'], {'delimiter': '""","""', 'encoding': '"""utf8"""'}), "('covid_filtered_1-5_allMin3.csv', delimiter=',', enc...
import numpy as np from pytope import Polytope import matplotlib.pyplot as plt np.random.seed(1) # Create a polytope in R^2 with -1 <= x1 <= 4, -2 <= x2 <= 3 lower_bound1 = (-1, -2) # [-1, -2]' <= x upper_bound1 = (4, 3) # x <= [4, 3]' P1 = Polytope(lb=lower_bound1, ub=upper_bound1) # Print the halfspace represen...
[ "matplotlib.pyplot.setp", "matplotlib.pyplot.grid", "matplotlib.pyplot.title", "numpy.sin", "matplotlib.pyplot.plot", "numpy.array", "numpy.random.seed", "matplotlib.pyplot.scatter", "numpy.random.uniform", "numpy.cos", "matplotlib.pyplot.axis", "pytope.Polytope", "matplotlib.pyplot.subplots...
[((82, 99), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (96, 99), True, 'import numpy as np\n'), ((247, 289), 'pytope.Polytope', 'Polytope', ([], {'lb': 'lower_bound1', 'ub': 'upper_bound1'}), '(lb=lower_bound1, ub=upper_bound1)\n', (255, 289), False, 'from pytope import Polytope\n'), ((511, 555), 'n...
import retro # pip install gym-retro import numpy as np # pip install numpy import cv2 # pip install opencv-python import neat # pip install neat-python import pickle # pip install cloudpickle class Worker(object): def __init__(self, genome, config): self.genome = genome ...
[ "pickle.dump", "neat.StdOutReporter", "neat.Population", "numpy.reshape", "neat.Config", "neat.nn.FeedForwardNetwork.create", "neat.Checkpointer.restore_checkpoint", "neat.StatisticsReporter", "numpy.ndarray.flatten", "cv2.cvtColor", "numpy.interp", "neat.ParallelEvaluator", "cv2.resize", ...
[((1918, 2050), 'neat.Config', 'neat.Config', (['neat.DefaultGenome', 'neat.DefaultReproduction', 'neat.DefaultSpeciesSet', 'neat.DefaultStagnation', '"""config-feedforward"""'], {}), "(neat.DefaultGenome, neat.DefaultReproduction, neat.\n DefaultSpeciesSet, neat.DefaultStagnation, 'config-feedforward')\n", (1929, 2...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import time import torch import numpy as np import torchvision import torch.nn as nn import torch.optim as optim import matplotlib.pyplot as plt from torch.utils.data import DataLoader from utils import * from IPython import embed class DCGAN(o...
[ "matplotlib.pyplot.ylabel", "torch.cuda.is_available", "numpy.save", "os.path.exists", "numpy.mean", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "os.mkdir", "torch.randn", "matplotlib.pyplot.savefig", "matplotlib.pyplot.title", "time.time", "matplotlib.pyplot.legend", "torch.full...
[((1189, 1201), 'torch.nn.BCELoss', 'nn.BCELoss', ([], {}), '()\n', (1199, 1201), True, 'import torch.nn as nn\n'), ((3336, 3375), 'torch.randn', 'torch.randn', (['(64)', 'self.args.in_dim', '(1)', '(1)'], {}), '(64, self.args.in_dim, 1, 1)\n', (3347, 3375), False, 'import torch\n'), ((7981, 8008), 'matplotlib.pyplot.f...
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "numpy.prod", "objax.util.image.nhwc", "objax.util.image.normalize_to_uint8", "objax.util.image.nchw", "io.BytesIO", "jax.numpy.array", "numpy.zeros", "objax.util.image.to_png", "objax.util.image.normalize_to_unit_float", "unittest.main", "numpy.arange" ]
[((3549, 3564), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3562, 3564), False, 'import unittest\n'), ((2080, 2094), 'numpy.arange', 'np.arange', (['(256)'], {}), '(256)\n', (2089, 2094), True, 'import numpy as np\n'), ((2107, 2150), 'objax.util.image.normalize_to_unit_float', 'objax.util.image.normalize_to_un...
import os import sys import json import time import numpy as np import tensorflow as tf from blocks.helpers import Monitor from blocks.helpers import visualize_samples, get_nonlinearity, int_shape, get_trainable_variables, broadcast_masks_np from blocks.optimizers import adam_updates import data.load_data as load_data ...
[ "numpy.split", "numpy.load", "blocks.helpers.broadcast_masks_np", "numpy.concatenate" ]
[((4122, 4148), 'numpy.concatenate', 'np.concatenate', (['ds'], {'axis': '(0)'}), '(ds, axis=0)\n', (4136, 4148), True, 'import numpy as np\n'), ((4895, 4924), 'numpy.concatenate', 'np.concatenate', (['x_gen'], {'axis': '(0)'}), '(x_gen, axis=0)\n', (4909, 4924), True, 'import numpy as np\n'), ((974, 1001), 'numpy.spli...
from __future__ import print_function import os import numpy as np from tqdm import trange from models import * from utils import save_image class Trainer(object): def __init__(self, config, batch_manager): tf.compat.v1.set_random_seed(config.random_seed) self.config = config self.batch_m...
[ "numpy.logical_and", "numpy.average", "numpy.where", "os.path.join", "numpy.logical_or", "utils.save_image", "numpy.sum", "numpy.isnan", "tqdm.trange" ]
[((6028, 6066), 'tqdm.trange', 'trange', (['self.start_step', 'self.max_step'], {}), '(self.start_step, self.max_step)\n', (6034, 6066), False, 'from tqdm import trange\n'), ((8716, 8758), 'os.path.join', 'os.path.join', (['self.model_dir', '"""model.ckpt"""'], {}), "(self.model_dir, 'model.ckpt')\n", (8728, 8758), Fal...
from zerocopy import send_from from socket import * s = socket(AF_INET, SOCK_STREAM) s.bind(('', 25000)) s.listen(1) c,a = s.accept() import numpy a = numpy.arange(0.0, 50000000.0) send_from(a, c) c.close()
[ "zerocopy.send_from", "numpy.arange" ]
[((153, 182), 'numpy.arange', 'numpy.arange', (['(0.0)', '(50000000.0)'], {}), '(0.0, 50000000.0)\n', (165, 182), False, 'import numpy\n'), ((183, 198), 'zerocopy.send_from', 'send_from', (['a', 'c'], {}), '(a, c)\n', (192, 198), False, 'from zerocopy import send_from\n')]
import os from json import JSONDecodeError from json import dump from json import load import numpy as np from core.net_errors import JsonFileStructureIncorrect, JsonFileNotFound def upload(net_object, path): if not os.path.isfile(path): raise JsonFileNotFound() try: with open(path, 'r') as...
[ "core.net_errors.JsonFileStructureIncorrect", "core.net_errors.JsonFileNotFound", "os.path.isfile", "numpy.array", "numpy.zeros", "json.load", "json.dump" ]
[((224, 244), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (238, 244), False, 'import os\n'), ((260, 278), 'core.net_errors.JsonFileNotFound', 'JsonFileNotFound', ([], {}), '()\n', (276, 278), False, 'from core.net_errors import JsonFileStructureIncorrect, JsonFileNotFound\n'), ((359, 369), 'json.loa...
from env_wrapper import SubprocVecEnv, DummyVecEnv import numpy as np import multiagent.scenarios as scenarios from multiagent.environment import MultiAgentEnv def make_parallel_env(n_rollout_threads, seed=1): def get_env_fn(rank): def init_env(): env = make_env("simple_adversary") ...
[ "multiagent.scenarios.load", "multiagent.environment.MultiAgentEnv", "numpy.random.seed" ]
[((765, 851), 'multiagent.environment.MultiAgentEnv', 'MultiAgentEnv', (['world', 'scenario.reset_world', 'scenario.reward', 'scenario.observation'], {}), '(world, scenario.reset_world, scenario.reward, scenario.\n observation)\n', (778, 851), False, 'from multiagent.environment import MultiAgentEnv\n'), ((362, 396)...
from AlphaGo.models.policy import CNNPolicy from AlphaGo import go from AlphaGo.go import GameState from AlphaGo.ai import GreedyPolicyPlayer, ProbabilisticPolicyPlayer import numpy as np import unittest import os class TestCNNPolicy(unittest.TestCase): def test_default_policy(self): policy = CNNPolicy(["board", ...
[ "AlphaGo.models.policy.CNNPolicy.load_model", "AlphaGo.models.policy.CNNPolicy", "AlphaGo.ai.GreedyPolicyPlayer", "AlphaGo.go.GameState", "unittest.main", "AlphaGo.ai.ProbabilisticPolicyPlayer", "numpy.all", "os.remove" ]
[((3295, 3310), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3308, 3310), False, 'import unittest\n'), ((300, 365), 'AlphaGo.models.policy.CNNPolicy', 'CNNPolicy', (["['board', 'liberties', 'sensibleness', 'capture_size']"], {}), "(['board', 'liberties', 'sensibleness', 'capture_size'])\n", (309, 365), False, '...
import os import torch import numpy as np import torch.nn as nn import matplotlib.pyplot as plt def get_param_matrix(model_prefix, model_dir): """ Grabs the parameters of a saved model and returns them as a matrix """ # Load and combine the parameters param_matrix = [] for file in os.listdir(...
[ "os.listdir", "torch.load", "os.path.join", "torch.nn.utils.parameters_to_vector", "numpy.array", "matplotlib.pyplot.figure", "matplotlib.pyplot.axes", "matplotlib.pyplot.title" ]
[((309, 330), 'os.listdir', 'os.listdir', (['model_dir'], {}), '(model_dir)\n', (319, 330), False, 'import os\n'), ((785, 807), 'numpy.array', 'np.array', (['param_matrix'], {}), '(param_matrix)\n', (793, 807), True, 'import numpy as np\n'), ((1024, 1051), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10...
# Author: <NAME> <<EMAIL>> """Module implementing the FASTA algorithm""" import numpy as np from math import sqrt from scipy import linalg import time import logging def _next_stepsize(deltax, deltaF, t=0): """A variation of spectral descent step-size selection: 'adaptive' BB method. Reference: -------...
[ "logging.getLogger", "numpy.copy", "numpy.random.randn", "time.time" ]
[((6219, 6245), 'logging.getLogger', 'logging.getLogger', (['"""FASTA"""'], {}), "('FASTA')\n", (6236, 6245), False, 'import logging\n'), ((6270, 6289), 'numpy.copy', 'np.copy', (['coefs_init'], {}), '(coefs_init)\n', (6277, 6289), True, 'import numpy as np\n'), ((6908, 6919), 'time.time', 'time.time', ([], {}), '()\n'...
from tensorflow.keras.preprocessing import image from tensorflow.keras.models import model_from_json import numpy as np import tensorflow.keras.models as models def predict(temp_file): test_image = image.load_img(temp_file, target_size = (224, 224)) test_image = image.img_to_array(test_image) test_image = ...
[ "tensorflow.keras.preprocessing.image.load_img", "tensorflow.keras.models.model_from_json", "numpy.argmax", "numpy.expand_dims", "tensorflow.keras.preprocessing.image.img_to_array" ]
[((203, 252), 'tensorflow.keras.preprocessing.image.load_img', 'image.load_img', (['temp_file'], {'target_size': '(224, 224)'}), '(temp_file, target_size=(224, 224))\n', (217, 252), False, 'from tensorflow.keras.preprocessing import image\n'), ((272, 302), 'tensorflow.keras.preprocessing.image.img_to_array', 'image.img...
import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit from sklearn.metrics import r2_score import datetime def func(x, a, b): return a + b*x def exp_regression(x, y): p, _ = curve_fit(func, x, np.log(y)) p[0] = np.exp(p[0]) return p def r2(coe...
[ "pandas.read_csv", "numpy.log", "numpy.exp", "datetime.timedelta", "pandas.to_datetime" ]
[((543, 573), 'pandas.read_csv', 'pd.read_csv', (['"""error_rates.csv"""'], {}), "('error_rates.csv')\n", (554, 573), True, 'import pandas as pd\n'), ((279, 291), 'numpy.exp', 'np.exp', (['p[0]'], {}), '(p[0])\n', (285, 291), True, 'import numpy as np\n'), ((257, 266), 'numpy.log', 'np.log', (['y'], {}), '(y)\n', (263,...
import numpy as np import tensorflow as tf from tensorflow import keras from keras.applications.xception import Xception import h5py import json import cv2 import math import logging from tensorflow.keras.preprocessing import image from tensorflow.keras.applications.xception import preprocess_input, decode_pr...
[ "logging.basicConfig", "cv2.resize", "tensorflow.keras.applications.xception.preprocess_input", "tensorflow.keras.applications.xception.decode_predictions", "tensorflow.keras.applications.Xception", "cv2.VideoCapture", "numpy.expand_dims", "tensorflow.keras.preprocessing.image.img_to_array", "loggin...
[((333, 372), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (352, 372), False, 'import logging\n'), ((519, 549), 'cv2.VideoCapture', 'cv2.VideoCapture', (['_sample_path'], {}), '(_sample_path)\n', (535, 549), False, 'import cv2\n'), ((613, 677), 'logging.info',...
from collections import namedtuple import numpy as np import scipy as sp from scipy.sparse.csgraph import minimum_spanning_tree from .. import logging as logg from ..neighbors import Neighbors from .. import utils from .. import settings def paga( adata, groups='louvain', use_rna_velocity=Fals...
[ "collections.namedtuple", "scipy.sparse.lil_matrix", "numpy.median", "scipy.stats.entropy", "numpy.sqrt", "networkx.Graph", "numpy.max", "itertools.combinations", "numpy.exp", "numpy.array", "scipy.sparse.csgraph.minimum_spanning_tree", "igraph.VertexClustering", "scipy.stats.ttest_1samp", ...
[((11850, 11891), 'networkx.Graph', 'nx.Graph', (["adata.uns['paga']['confidence']"], {}), "(adata.uns['paga']['confidence'])\n", (11858, 11891), True, 'import networkx as nx\n'), ((13730, 13773), 'networkx.Graph', 'nx.Graph', (["adata1.uns['paga'][adjacency_key]"], {}), "(adata1.uns['paga'][adjacency_key])\n", (13738,...
# -*- coding: utf-8 -*- """ Created on Fri Nov 5 01:34:00 2021 @author: yrc2 """ import biosteam as bst import biorefineries.oilcane as oc from biosteam.utils import CABBI_colors, colors from thermosteam.utils import set_figure_size, set_font, roundsigfigs from thermosteam.units_of_measure import format_units from co...
[ "matplotlib.pyplot.boxplot", "biosteam.utils.colors.red.shade", "matplotlib.pyplot.grid", "biosteam.utils.CABBI_colors.orange.shade", "matplotlib.pyplot.ylabel", "biosteam.plots.plot_quadrants", "biosteam.plots.style_axis", "biosteam.MockVariable", "numpy.array", "biosteam.utils.CABBI_colors.green...
[((3524, 3546), 'colorpalette.Palette', 'Palette', ([], {}), '(**area_colors)\n', (3531, 3546), False, 'from colorpalette import Palette\n'), ((3762, 3800), 'biosteam.utils.CABBI_colors.orange.copy', 'CABBI_colors.orange.copy', ([], {'hatch': '"""////"""'}), "(hatch='////')\n", (3786, 3800), False, 'from biosteam.utils...
import numpy as np from ..layers.Layer import LayerTrainable class LayeredModel(object): def __init__(self, layers): """ layers : a list of layers. Treated as a feed-forward model """ assert len(layers) > 0, "Model layers must be non-empty" # check that the output of ...
[ "numpy.shape", "numpy.zeros", "numpy.hstack" ]
[((4802, 4817), 'numpy.zeros', 'np.zeros', (['count'], {}), '(count)\n', (4810, 4817), True, 'import numpy as np\n'), ((3096, 3107), 'numpy.shape', 'np.shape', (['X'], {}), '(X)\n', (3104, 3107), True, 'import numpy as np\n'), ((5482, 5499), 'numpy.hstack', 'np.hstack', (['(x, 1)'], {}), '((x, 1))\n', (5491, 5499), Tru...
#%% import numpy as np from sapai.data import data from sapai.rand import MockRandomState #%% class Food(): def __init__(self, name="food-none", shop=None, team=[], seed_state = None): """ Food class definition the types of ...
[ "sapai.rand.MockRandomState", "numpy.random.RandomState" ]
[((661, 684), 'numpy.random.RandomState', 'np.random.RandomState', ([], {}), '()\n', (682, 684), True, 'import numpy as np\n'), ((804, 821), 'sapai.rand.MockRandomState', 'MockRandomState', ([], {}), '()\n', (819, 821), False, 'from sapai.rand import MockRandomState\n'), ((3925, 3948), 'numpy.random.RandomState', 'np.r...
import traceback import copy import gc from ctypes import c_void_p import itertools import array import math import numpy as np from OpenGL.GL import * from PyEngine3D.Common import logger from PyEngine3D.Utilities import Singleton, GetClassName, Attributes, Profiler from PyEngine3D.OpenGLContext import OpenGLContex...
[ "PyEngine3D.Common.logger.error", "traceback.format_exc", "PyEngine3D.OpenGLContext.OpenGLContext.glGetTexImage", "PyEngine3D.Utilities.GetClassName", "PyEngine3D.Common.logger.warn", "math.log2", "PyEngine3D.Utilities.Attributes", "numpy.array", "copy.copy", "numpy.fromstring", "PyEngine3D.Comm...
[((964, 1042), 'PyEngine3D.Common.logger.error', 'logger.error', (['"""Cannot convert to numpy dtype. UNKOWN DATA TYPE(%s)"""', 'data_type'], {}), "('Cannot convert to numpy dtype. UNKOWN DATA TYPE(%s)', data_type)\n", (976, 1042), False, 'from PyEngine3D.Common import logger\n'), ((3639, 3651), 'PyEngine3D.Utilities.A...
"""Find stars that are both in our sample and in Shull+21""" import numpy as np import get_data from matplotlib import pyplot as plt data = get_data.get_merged_table() shull = get_data.get_shull2021() matches = [name for name in data["Name"] if name in shull["Name"]] print(len(matches), " matches found") print(matche...
[ "get_data.get_merged_table", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.colorbar", "numpy.isin", "matplotlib.pyplot.figure", "matplotlib.pyplot.scatter", "matplotlib.pyplot.title", "get_data.get_shull2021", "matplotlib.pyplot.show" ]
[((142, 169), 'get_data.get_merged_table', 'get_data.get_merged_table', ([], {}), '()\n', (167, 169), False, 'import get_data\n'), ((178, 202), 'get_data.get_shull2021', 'get_data.get_shull2021', ([], {}), '()\n', (200, 202), False, 'import get_data\n'), ((806, 816), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\...
import numpy as np import matplotlib.pyplot as plt from collections import Iterable mrkr1 = 12 mrkr1_inner = 8 fs = 18 # FUNCTION TO TURN NESTED LIST INTO 1D LIST def flatten(lis): for item in lis: if isinstance(item, Iterable) and not isinstance(item, str): for x in flatten(item): ...
[ "numpy.radians", "matplotlib.pyplot.text", "matplotlib.pyplot.Circle", "matplotlib.pyplot.xticks", "matplotlib.pyplot.plot", "matplotlib.pyplot.cm.flag", "numpy.binary_repr", "matplotlib.pyplot.cm.hsv", "matplotlib.pyplot.yticks", "matplotlib.pyplot.ylim", "matplotlib.pyplot.xlim", "matplotlib...
[((4339, 4353), 'matplotlib.pyplot.xticks', 'plt.xticks', (['[]'], {}), '([])\n', (4349, 4353), True, 'import matplotlib.pyplot as plt\n'), ((4358, 4372), 'matplotlib.pyplot.yticks', 'plt.yticks', (['[]'], {}), '([])\n', (4368, 4372), True, 'import matplotlib.pyplot as plt\n'), ((7847, 7857), 'matplotlib.pyplot.ylim', ...
# pdaggerq - A code for bringing strings of creation / annihilation operators to normal order. # Copyright (C) 2020 <NAME> # # This file is part of the pdaggerq package. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
[ "numpy.abs", "numpy.reciprocal", "numpy.einsum", "numpy.linalg.norm", "diis.DIIS" ]
[((13236, 13255), 'numpy.reciprocal', 'np.reciprocal', (['e_ai'], {}), '(e_ai)\n', (13249, 13255), True, 'import numpy as np\n'), ((13274, 13295), 'numpy.reciprocal', 'np.reciprocal', (['e_abij'], {}), '(e_abij)\n', (13287, 13295), True, 'import numpy as np\n'), ((959, 980), 'numpy.einsum', 'einsum', (['"""ii"""', 'f[o...
"""Module containing definitions of arithmetic functions used by perceptrons""" from abc import ABC, abstractmethod import numpy as np from NaiveNeurals.utils import ErrorAlgorithm class ActivationFunction(ABC): """Abstract function for defining functions""" label = '' @staticmethod @abstractmeth...
[ "numpy.power", "numpy.tanh", "numpy.exp", "numpy.sum", "numpy.array" ]
[((1650, 1662), 'numpy.tanh', 'np.tanh', (['arg'], {}), '(arg)\n', (1657, 1662), True, 'import numpy as np\n'), ((2432, 2445), 'numpy.array', 'np.array', (['arg'], {}), '(arg)\n', (2440, 2445), True, 'import numpy as np\n'), ((3232, 3244), 'numpy.sum', 'np.sum', (['exps'], {}), '(exps)\n', (3238, 3244), True, 'import n...
from OpenGL import GL from PIL import Image from pathlib import Path import numpy as np import gc import os import ctypes GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1 VBO = None VAO = None TEXTURE = None SHADER = None vertexData = [ -1.0, -1.0, 0.0, 0.0, 1.0, -1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0,...
[ "OpenGL.GL.glTexParameter", "OpenGL.GL.glDeleteProgram", "ctypes.c_void_p", "OpenGL.GL.glAttachShader", "OpenGL.GL.glCreateShader", "OpenGL.GL.glDrawArrays", "OpenGL.GL.glDeleteBuffers", "OpenGL.GL.glGenTextures", "pathlib.Path", "OpenGL.GL.glBindVertexArray", "OpenGL.GL.glGenBuffers", "OpenGL...
[((575, 614), 'numpy.fromstring', 'np.fromstring', (['tex.data'], {'dtype': 'np.uint8'}), '(tex.data, dtype=np.uint8)\n', (588, 614), True, 'import numpy as np\n'), ((1089, 1109), 'OpenGL.GL.glCreateProgram', 'GL.glCreateProgram', ([], {}), '()\n', (1107, 1109), False, 'from OpenGL import GL\n'), ((1122, 1160), 'OpenGL...
import io import torchvision.transforms as transforms from PIL import Image import onnxruntime as ort import numpy as np class_map = { 0: "10 Reais Frente", 1: "10 Reais Verso", 2: "20 Reais Frente", 3: "20 Reais Verso", 4: "2 Reais Frente", 5: "2 Reais Verso", 6: "50 Reais Frente", ...
[ "onnxruntime.InferenceSession", "numpy.argmax", "io.BytesIO", "torchvision.transforms.Normalize", "torchvision.transforms.Resize", "torchvision.transforms.ToTensor" ]
[((1044, 1097), 'onnxruntime.InferenceSession', 'ort.InferenceSession', (['"""app/models/banknote_best.onnx"""'], {}), "('app/models/banknote_best.onnx')\n", (1064, 1097), True, 'import onnxruntime as ort\n'), ((669, 692), 'io.BytesIO', 'io.BytesIO', (['image_bytes'], {}), '(image_bytes)\n', (679, 692), False, 'import ...
import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import vplot import scipy.signal as sig #plt.rcParams["text.usetex"]=True #plt.rcParams["text.latex.unicode"]=True plt.rcParams.update({'font.size':16,'legend.fontsize':15}) import sys # Check correct number of arguments if (len(sys.argv) != ...
[ "numpy.abs", "matplotlib.pyplot.semilogy", "vplot.make_pretty", "matplotlib.pyplot.savefig", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "matplotlib.pyplot.rcParams.update", "numpy.array", "matplotlib....
[((191, 252), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 16, 'legend.fontsize': 15}"], {}), "({'font.size': 16, 'legend.fontsize': 15})\n", (210, 252), True, 'import matplotlib.pyplot as plt\n'), ((595, 612), 'vplot.GetOutput', 'vplot.GetOutput', ([], {}), '()\n', (610, 612), False, 'i...
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, division import array import numpy as np from numcodecs.compat import buffer_tobytes def test_buffer_tobytes(): bufs = [ b'adsdasdas', bytes(20), np.arange(100), array.array('l', b'qwertyuiqwertyui'...
[ "numcodecs.compat.buffer_tobytes", "array.array", "numpy.arange" ]
[((260, 274), 'numpy.arange', 'np.arange', (['(100)'], {}), '(100)\n', (269, 274), True, 'import numpy as np\n'), ((284, 321), 'array.array', 'array.array', (['"""l"""', "b'qwertyuiqwertyui'"], {}), "('l', b'qwertyuiqwertyui')\n", (295, 321), False, 'import array\n'), ((361, 380), 'numcodecs.compat.buffer_tobytes', 'bu...
import tensorflow as tf import numpy as np import cv2 import os import rospy from timeit import default_timer as timer from styx_msgs.msg import TrafficLight CLASS_TRAFFIC_LIGHT = 10 MODEL_DIR = 'light_classification/models/' IMG_DIR = 'light_classification/img/' DEBUG_DIR = 'light_classification/result/' class TL...
[ "cv2.rectangle", "numpy.array", "os.path.exists", "tensorflow.Graph", "tensorflow.Session", "numpy.asarray", "tensorflow.GraphDef", "tensorflow.ConfigProto", "numpy.squeeze", "cv2.cvtColor", "tensorflow.import_graph_def", "cv2.imread", "rospy.loginfo", "cv2.imwrite", "numpy.copy", "ten...
[((1463, 1501), 'cv2.imread', 'cv2.imread', (["(IMG_DIR + 'image_test.jpg')"], {}), "(IMG_DIR + 'image_test.jpg')\n", (1473, 1501), False, 'import cv2\n'), ((1908, 1959), 'cv2.imwrite', 'cv2.imwrite', (["(IMG_DIR + 'pred_image.png')", 'pred_image'], {}), "(IMG_DIR + 'pred_image.png', pred_image)\n", (1919, 1959), False...
"""Created on Sat Oct 01 2015 16:24. @author: <NAME> """ import numpy as np def coe2mee(COE, mu=1.): """ Convert classical orbital elements to modified equinoctial elements. Parameters ---------- COE : ndarray mx6 array of elements ordered as [p e i W w nu]. mu : float Standa...
[ "numpy.tan", "numpy.cos", "numpy.concatenate", "numpy.sin", "numpy.mod" ]
[((852, 881), 'numpy.mod', 'np.mod', (['(W + w + nu)', '(2 * np.pi)'], {}), '(W + w + nu, 2 * np.pi)\n', (858, 881), True, 'import numpy as np\n'), ((888, 925), 'numpy.concatenate', 'np.concatenate', (['(p, f, g, h, k, L)', '(1)'], {}), '((p, f, g, h, k, L), 1)\n', (902, 925), True, 'import numpy as np\n'), ((669, 682)...
import pickle from sys import intern from numpy import uint32 import numpy as np import zarr from napari_plugin_engine import napari_hook_implementation from qtpy.QtWidgets import QWidget, QHBoxLayout, QPushButton from magicgui import magic_factory import pathlib import napari def viterbrain_reader(path: str) -> lis...
[ "numpy.mean", "pathlib.Path", "pickle.load", "zarr.open", "magicgui.magic_factory" ]
[((965, 1060), 'magicgui.magic_factory', 'magic_factory', ([], {'call_button': '"""Trace"""', 'start_comp': "{'max': 2 ** 20}", 'end_comp': "{'max': 2 ** 20}"}), "(call_button='Trace', start_comp={'max': 2 ** 20}, end_comp={\n 'max': 2 ** 20})\n", (978, 1060), False, 'from magicgui import magic_factory\n'), ((419, 4...