code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import getpass import os import sys import math from io import StringIO import shutil import datetime from os.path import splitext from difflib import unified_diff import pytest from astropy.io import fits from astropy.io.fits import FITSDiff from astropy.utils.data import conf import numpy as np import stwcs from st...
[ "math.sqrt", "astropy.utils.data.conf.reset", "difflib.unified_diff", "stwcs.wcsutil.HSTWCS", "astropy.io.fits.FITSDiff", "ci_watson.artifactory_helpers.get_bigdata", "astropy.io.fits.open", "getpass.getuser", "pytest.fixture", "sys.stdout.writelines", "ci_watson.hst_helpers.ref_from_image", "...
[((635, 646), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (644, 646), False, 'import os\n'), ((984, 1012), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (998, 1012), False, 'import pytest\n'), ((8054, 8076), 'os.environ.get', 'os.environ.get', (['refstr'], {}), '(refstr)\n', (8068...
import math import numpy as np ''' This is v1 code using the old input format! If you are new please look at v2 ''' ''' Hi! You can use this code as a template to create your own bot. Also if you don't mind writing a blurb about your bot's strategy you can put it as a comment here. I'd appreciate it, especially if I...
[ "math.cos", "numpy.zeros", "math.sin", "math.atan2" ]
[((1070, 1082), 'numpy.zeros', 'np.zeros', (['(38)'], {}), '(38)\n', (1078, 1082), True, 'import numpy as np\n'), ((1095, 1107), 'numpy.zeros', 'np.zeros', (['(12)'], {}), '(12)\n', (1103, 1107), True, 'import numpy as np\n'), ((5959, 5999), 'math.sin', 'math.sin', (['(bluePitch * URotationToRadians)'], {}), '(bluePitc...
import numpy as np import matplotlib.pyplot as plt from gym.spaces import Discrete, Box from tfg.games import GameEnv, WHITE, BLACK class ConnectN(GameEnv): def __init__(self, n=4, rows=6, cols=7): if rows < n and cols < n: raise ValueError("invalid board shape and number to connect") ...
[ "numpy.multiply", "matplotlib.pyplot.Circle", "matplotlib.pyplot.gca", "numpy.fliplr", "matplotlib.pyplot.gcf", "gym.spaces.Discrete", "gym.spaces.Box", "numpy.diag", "numpy.zeros", "matplotlib.pyplot.ylim", "matplotlib.pyplot.xlim", "numpy.arange" ]
[((5606, 5615), 'matplotlib.pyplot.gca', 'plt.gca', ([], {}), '()\n', (5613, 5615), True, 'import matplotlib.pyplot as plt\n'), ((5764, 5783), 'matplotlib.pyplot.xlim', 'plt.xlim', (['[0, cols]'], {}), '([0, cols])\n', (5772, 5783), True, 'import matplotlib.pyplot as plt\n'), ((5788, 5807), 'matplotlib.pyplot.ylim', 'p...
# further developed by <NAME>, <NAME>, <NAME> and <NAME> import random import sort_task_set import math import numpy import task USet=[] PSet=[] possiblePeriods = [1, 2, 5, 10, 50, 100, 200, 1000] def init(): global USet,PSet USet=[] PSet=[] def taskGeneration_rounded( numTasks, uTotal ): random.se...
[ "sort_task_set.sort", "task.Task", "numpy.random.random", "math.pow", "task.setPriority", "random.seed", "random.random", "sort_task_set.sortEvent" ]
[((311, 324), 'random.seed', 'random.seed', ([], {}), '()\n', (322, 324), False, 'import random\n'), ((491, 504), 'random.seed', 'random.seed', ([], {}), '()\n', (502, 504), False, 'import random\n'), ((2860, 2898), 'sort_task_set.sort', 'sort_task_set.sort', (['allTasks', '"""period"""'], {}), "(allTasks, 'period')\n"...
import numpy as np import matplotlib.pyplot as plt from scipy.stats import poisson from scipy.stats import uniform from scipy.stats import norm # Data data = np.array([0.3120639, 0.5550930, 0.2493114, 0.9785842]) # Grid. mus = np.linspace(0, 1, num=100) sigmas = np.linspace(0, 1, num=100) x = [] y = [] z = [] # Gri...
[ "numpy.array", "numpy.linspace", "scipy.stats.uniform.pdf", "scipy.stats.norm.pdf", "matplotlib.pyplot.scatter", "matplotlib.pyplot.show" ]
[((159, 212), 'numpy.array', 'np.array', (['[0.3120639, 0.555093, 0.2493114, 0.9785842]'], {}), '([0.3120639, 0.555093, 0.2493114, 0.9785842])\n', (167, 212), True, 'import numpy as np\n'), ((229, 255), 'numpy.linspace', 'np.linspace', (['(0)', '(1)'], {'num': '(100)'}), '(0, 1, num=100)\n', (240, 255), True, 'import n...
## testing RigidMassInfo # a difficulty is to test the orientatoin of the summed up rigid frame since it is not deterministic (axis swapping is expected) # it is indirectly tested with test where the resultant sum is symmetric (a cube) so that the inertia is equal on all axis import os import numpy from SofaTest.Macr...
[ "numpy.array", "SofaPython.Quaternion.rotate", "SofaPython.Quaternion.inv", "SofaPython.mass.RigidMassInfo" ]
[((479, 499), 'SofaPython.mass.RigidMassInfo', 'mass.RigidMassInfo', ([], {}), '()\n', (497, 499), False, 'from SofaPython import mass\n'), ((710, 730), 'SofaPython.mass.RigidMassInfo', 'mass.RigidMassInfo', ([], {}), '()\n', (728, 730), False, 'from SofaPython import mass\n'), ((958, 978), 'SofaPython.mass.RigidMassIn...
from typing import Tuple, Any, Dict, Optional, List import numpy import numpy as np from plotly import graph_objects from plotly.subplots import make_subplots from plotly.tools import DEFAULT_PLOTLY_COLORS from phi import math, field from phi.field import SampledField, PointCloud, Grid, StaggeredGrid from phi.geom im...
[ "numpy.clip", "numpy.array", "numpy.isfinite", "numpy.nanmin", "phi.field.unstack", "plotly.graph_objects.scatter.Line", "plotly.graph_objects.scatter.Marker", "phi.vis._plot_util.down_sample_curve", "numpy.max", "numpy.stack", "plotly.graph_objects.Scatter", "numpy.vstack", "numpy.concatena...
[((15019, 15052), 'numpy.clip', 'numpy.clip', (['cm_arr[:, 1:]', '(0)', '(255)'], {}), '(cm_arr[:, 1:], 0, 255)\n', (15029, 15052), False, 'import numpy\n'), ((18446, 18472), 'numpy.concatenate', 'np.concatenate', (['curves', '(-2)'], {}), '(curves, -2)\n', (18460, 18472), True, 'import numpy as np\n'), ((1204, 1275), ...
import random from abc import abstractmethod import math from sklearn.cluster import KMeans import numpy as np import matplotlib.pyplot as plt def euclidian_distance(a, b): """ Calculating Euclidian distance between 2 vectors :param a: 1st vector :param b: 2nd vector :return: """ assert l...
[ "sklearn.cluster.KMeans", "numpy.mean", "math.ceil", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.sort", "numpy.square", "numpy.exp", "numpy.sum", "numpy.array", "numpy.zeros", "numpy.dot", "numpy.random.seed", "numpy.random.uniform", "random...
[((8331, 8357), 'matplotlib.pyplot.plot', 'plt.plot', (['net.errors_train'], {}), '(net.errors_train)\n', (8339, 8357), True, 'import matplotlib.pyplot as plt\n'), ((8362, 8386), 'matplotlib.pyplot.plot', 'plt.plot', (['net.errors_val'], {}), '(net.errors_val)\n', (8370, 8386), True, 'import matplotlib.pyplot as plt\n'...
# Copyright (C) 2010 Ion Torrent Systems, Inc. All Rights Reserved import os from ion.reports.plotters import plotters from numpy import median class KeyPlot: def __init__(self, key, floworder, title=None): self.data = None self.key = key self.floworder = floworder self.title = ti...
[ "numpy.median", "ion.reports.plotters.plotters.Iontrace", "os.getcwd" ]
[((384, 395), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (393, 395), False, 'import os\n'), ((475, 616), 'ion.reports.plotters.plotters.Iontrace', 'plotters.Iontrace', (['self.key', 'expected', 'self.data'], {'title': "('Consensus Key 1-Mer - %s Ave. Peak = %s' % (self.title, self.average_peak))"}), "(self.key, expect...
import cv2 import os, logging, time, json import requests, base64 from flask import Flask, jsonify, request, Response import numpy as np # for HTTP/1.1 support from werkzeug.serving import WSGIRequestHandler app = Flask(__name__) logging.basicConfig(format='%(asctime)s %(levelname)-10s %(message)s', datefmt="%Y-%m-...
[ "logging.basicConfig", "json.loads", "requests.post", "cv2.imencode", "flask.Flask", "base64.b64encode", "ptvsd.enable_attach", "ptvsd.break_into_debugger", "cmdline.cmd_args.parse_camera_args", "time.sleep", "numpy.zeros", "cv2.VideoCapture", "ptvsd.wait_for_attach", "cv2.resize", "logg...
[((216, 231), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (221, 231), False, 'from flask import Flask, jsonify, request, Response\n'), ((233, 357), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(levelname)-10s %(message)s"""', 'datefmt': '"""%Y-%m-%d-%H-%M-%S"""', 'leve...
import json import pickle import numpy as np import argparse from pathlib import Path from scipy.special import softmax import csv import statistics import sys import os from functools import partial import math sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))) import decim...
[ "statistics.stdev", "numpy.array", "numpy.mean", "argparse.ArgumentParser", "pathlib.Path", "numpy.stack", "numpy.concatenate", "numpy.abs", "numpy.ones", "csv.writer", "pickle.load", "numpy.argmax", "statistics.mean", "math.isclose", "os.path.realpath", "numpy.sum", "numpy.zeros", ...
[((339, 364), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (362, 364), False, 'import argparse\n'), ((2400, 2433), 'numpy.zeros', 'np.zeros', (['[10000]'], {'dtype': 'np.int32'}), '([10000], dtype=np.int32)\n', (2408, 2433), True, 'import numpy as np\n'), ((2467, 2499), 'numpy.ones', 'np.ones...
import numpy as np import matplotlib.pyplot as plt from math import pi import math, os, datetime class data_manipulation_module: def __init__(self): self.a = 1 self.list_x = None self.list_y = None def init_graph_list(self): self.list_x = [] self.list_y = [] def a...
[ "numpy.abs", "os.listdir", "os.makedirs", "math.pow", "numpy.conj", "numpy.absolute", "numpy.fft.fft", "datetime.datetime.now", "numpy.zeros", "numpy.correlate", "matplotlib.pyplot.figure", "numpy.real", "numpy.interp", "numpy.fft.ifft", "numpy.imag", "numpy.arange", "matplotlib.pypl...
[((703, 726), 'numpy.zeros', 'np.zeros', (['target_length'], {}), '(target_length)\n', (711, 726), True, 'import numpy as np\n'), ((7689, 7704), 'numpy.fft.fft', 'np.fft.fft', (['x_t'], {}), '(x_t)\n', (7699, 7704), True, 'import numpy as np\n'), ((7719, 7734), 'numpy.fft.fft', 'np.fft.fft', (['y_t'], {}), '(y_t)\n', (...
# -*- coding: utf-8 -*- #@Author: <NAME> #@Date: 2019-11-18 20:53:24 #@Last Modified by: <NAME> #@Last Modified time: 2019-11-18 21:44:1 import numpy as np import torch import torch.nn.functional as F import os def compute_pairwise_distance(x): ''' computation of pairwise distance matrix ---- Inp...
[ "torch.abs", "numpy.sqrt", "torch.rand", "torch.pow", "numpy.array", "torch.sum", "torch.nn.functional.relu", "torch.zeros_like", "torch.clamp" ]
[((720, 748), 'torch.clamp', 'torch.clamp', (['dist'], {'min': '(1e-06)'}), '(dist, min=1e-06)\n', (731, 748), False, 'import torch\n'), ((862, 893), 'numpy.array', 'np.array', (['[i // size, i % size]'], {}), '([i // size, i % size])\n', (870, 893), True, 'import numpy as np\n'), ((894, 925), 'numpy.array', 'np.array'...
"""Plot argmax and max.""" # import numpy as np import pandas as pd # import matplotlib.pyplot as plt import seaborn as sns from logzero import logger def plot_argmax(yargmax, ymax=None): """Plot yargmx and ymax.""" try: len_ = yargmax.shape[0] except Exception: len_ = len(yargmax) ...
[ "pandas.DataFrame", "numpy.array", "logzero.logger.error", "seaborn.relplot" ]
[((431, 497), 'seaborn.relplot', 'sns.relplot', ([], {'x': '"""lang2"""', 'y': '"""argmax"""', 'size': '"""max"""', 'hue': '"""max"""', 'data': 'df'}), "(x='lang2', y='argmax', size='max', hue='max', data=df)\n", (442, 497), True, 'import seaborn as sns\n'), ((585, 628), 'seaborn.relplot', 'sns.relplot', ([], {'x': '""...
import numpy as np from skimage import io from skimage import feature import cv2 from scipy import ndimage import matplotlib.pyplot as plt from sklearn.cluster import KMeans def main(): D = io.imread("data/attention-mri.tif") print(D.shape) im_x = D[63,:,:] #sagittal(x) im_y = D[:,63,:] #coronal...
[ "matplotlib.pyplot.imshow", "sklearn.cluster.KMeans", "numpy.sqrt", "matplotlib.pyplot.xticks", "matplotlib.pyplot.gca", "numpy.choose", "cv2.filter2D", "numpy.array", "skimage.io.imread", "matplotlib.pyplot.figure", "matplotlib.pyplot.yticks", "skimage.feature.canny", "matplotlib.pyplot.tit...
[((195, 230), 'skimage.io.imread', 'io.imread', (['"""data/attention-mri.tif"""'], {}), "('data/attention-mri.tif')\n", (204, 230), False, 'from skimage import io\n'), ((734, 744), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (742, 744), True, 'import matplotlib.pyplot as plt\n'), ((781, 823), 'cv2.Sobel', '...
# RGB -> HSV -> Gray import cv2 import numpy as np from . import print_image from . import plot_image def rotate(img, rotation_deg, crop, device, debug=None): """Rotate image, sometimes it is necessary to rotate image, especially when clustering for multiple plants is needed. Inputs: img ...
[ "cv2.getRotationMatrix2D", "numpy.shape", "cv2.warpAffine", "numpy.abs" ]
[((1191, 1249), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['(ix / 2, iy / 2)', 'rotation_deg', '(1)'], {}), '((ix / 2, iy / 2), rotation_deg, 1)\n', (1214, 1249), False, 'import cv2\n'), ((1261, 1276), 'numpy.abs', 'np.abs', (['M[0, 0]'], {}), '(M[0, 0])\n', (1267, 1276), True, 'import numpy as np\n'), ((1...
import numpy as np import matplotlib.pyplot as plot time = np.arange(0, 10, 0.1); amplitude =np.sin(time) plot.plot(time, amplitude) plot.title('Sign Wave 1') plot.xlabel('Time') plot.ylabel('Amplitude = sin(time)') plot.grid(True, which='both') plot.axhline(y=0, color='k') plot.show()
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.axhline", "numpy.sin", "matplotlib.pyplot.title", "numpy.arange", "matplotlib.pyplot.show" ]
[((60, 81), 'numpy.arange', 'np.arange', (['(0)', '(10)', '(0.1)'], {}), '(0, 10, 0.1)\n', (69, 81), True, 'import numpy as np\n'), ((95, 107), 'numpy.sin', 'np.sin', (['time'], {}), '(time)\n', (101, 107), True, 'import numpy as np\n'), ((109, 135), 'matplotlib.pyplot.plot', 'plot.plot', (['time', 'amplitude'], {}), '...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: <NAME> # @Date: 2014-10-28 18:07:20 # @Last Modified by: marinheiro # @Last Modified time: 2014-12-08 21:32:21 import scipy.sparse import numpy import rotation_averaging.so3 as so3 def create_matrix_from_indices(num_nodes, indices): i = [] j = [] val = [...
[ "numpy.hstack", "rotation_averaging.so3.axis_angle_to_log", "numpy.array", "rotation_averaging.so3.axis_angle_to_matrix", "rotation_averaging.so3.log_to_axis_angle", "rotation_averaging.so3.matrix_to_axis_angle" ]
[((835, 869), 'rotation_averaging.so3.matrix_to_axis_angle', 'so3.matrix_to_axis_angle', (['deltaRot'], {}), '(deltaRot)\n', (859, 869), True, 'import rotation_averaging.so3 as so3\n'), ((1079, 1118), 'rotation_averaging.so3.log_to_axis_angle', 'so3.log_to_axis_angle', (['log_matrix[node]'], {}), '(log_matrix[node])\n'...
import numpy as np def test_get_gini_score(): """A quick example against a hand worked gini score.""" from my_ml.model.decision_tree import DecisionTree dtree = DecisionTree() low_y: np.ndarray = np.array([1, 0, 0]) high_y: np.ndarray = np.array([1, 0]) k: int = 2 gini_score: float = dtre...
[ "my_ml.model.decision_tree.DecisionTree", "numpy.array", "numpy.isclose" ]
[((176, 190), 'my_ml.model.decision_tree.DecisionTree', 'DecisionTree', ([], {}), '()\n', (188, 190), False, 'from my_ml.model.decision_tree import DecisionTree\n'), ((215, 234), 'numpy.array', 'np.array', (['[1, 0, 0]'], {}), '([1, 0, 0])\n', (223, 234), True, 'import numpy as np\n'), ((260, 276), 'numpy.array', 'np.a...
# Modelling Enslin and GopalKrishna 2001 # Major updates from getpar import getparspace from astropy.io import ascii from operations import chicalc import numpy as np import matplotlib.pyplot as plt #################################### def readfile(myspec): dat = ascii.read(myspec) return dat myfile ='A1914_sp...
[ "numpy.nanargmin", "astropy.io.ascii.read", "getpar.getparspace", "numpy.array", "operations.chicalc", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((411, 434), 'numpy.array', 'np.array', (["spec['nughz']"], {}), "(spec['nughz'])\n", (419, 434), True, 'import numpy as np\n'), ((441, 465), 'numpy.array', 'np.array', (["spec['fmyerr']"], {}), "(spec['fmyerr'])\n", (449, 465), True, 'import numpy as np\n'), ((476, 497), 'numpy.array', 'np.array', (["spec['fmy']"], {...
# # Linear algebra subroutines # # Originally written in C++ by <NAME>, CSCS # Ported to Python by <NAME>, CSCS import collections import numba import numpy as np import sys import operators # epsilon value use for matrix-vector approximation EPS = 1.0e-8 EPS_INV = 1.0 / EPS CGStatus = collections.namedtuple('CGSta...
[ "numpy.copy", "collections.namedtuple", "numpy.sqrt", "numba.njit", "numpy.zeros_like", "operators.diffusion" ]
[((291, 361), 'collections.namedtuple', 'collections.namedtuple', (['"""CGStatus"""', "['converged', 'iters', 'residual']"], {}), "('CGStatus', ['converged', 'iters', 'residual'])\n", (313, 361), False, 'import collections\n'), ((399, 421), 'numba.njit', 'numba.njit', ([], {'cache': '(True)'}), '(cache=True)\n', (409, ...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
[ "numpy.abs", "numpy.minimum", "op_test.skip_check_grad_ci", "numpy.random.uniform", "unittest.main", "numpy.maximum" ]
[((2331, 2449), 'op_test.skip_check_grad_ci', 'skip_check_grad_ci', ([], {'reason': '"""[skip shape check] Input(Alpha) must be 1-D and only has one data in \'all\' mode"""'}), '(reason=\n "[skip shape check] Input(Alpha) must be 1-D and only has one data in \'all\' mode"\n )\n', (2349, 2449), False, 'from op_tes...
# Copyright (c) 2003-2015 by <NAME> # # TreeCorr is free software: redistribution and use in source and binary forms, # with or without modification, are permitted provided that the following # conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions...
[ "numpy.random.normal", "numpy.random.random_sample", "test_helper.get_from_wiki", "numpy.testing.assert_equal", "numpy.bitwise_or", "numpy.logical_and", "os.path.join", "treecorr.read_config", "numpy.logical_or", "treecorr.NGCorrelation", "numpy.testing.assert_almost_equal", "treecorr.Catalog"...
[((779, 805), 'numpy.random.seed', 'numpy.random.seed', (['(8675309)'], {}), '(8675309)\n', (796, 805), False, 'import numpy\n'), ((814, 846), 'numpy.random.random_sample', 'numpy.random.random_sample', (['nobj'], {}), '(nobj)\n', (840, 846), False, 'import numpy\n'), ((855, 887), 'numpy.random.random_sample', 'numpy.r...
import numpy as np # global stopping criteria EPS = 0.001 def value_iteration(model, maxiter=100): """ Solves the supplied environment with value iteration. Parameters ---------- model : python object Holds information about the environment to solve such as the reward structure an...
[ "numpy.sum", "numpy.zeros", "numpy.abs", "numpy.ones" ]
[((728, 758), 'numpy.ones', 'np.ones', (['(model.num_states, 1)'], {}), '((model.num_states, 1))\n', (735, 758), True, 'import numpy as np\n'), ((770, 801), 'numpy.zeros', 'np.zeros', (['(model.num_states, 1)'], {}), '((model.num_states, 1))\n', (778, 801), True, 'import numpy as np\n'), ((2293, 2323), 'numpy.ones', 'n...
import sys import numpy as np import matplotlib.pyplot as plt import sys import os sys.path.append(os.path.join('../')) from lib.BeamDynamicsTools.Boundary import Boundary from lib.BeamDynamicsTools.Bfield import Bfield, BfieldTF, BfieldVF from lib.BeamDynamicsTools.Trajectory import Trajectory from lib.BeamDynamicsToo...
[ "matplotlib.pyplot.ylabel", "numpy.array", "lib.BeamDynamicsTools.Boundary.Boundary", "lib.BeamDynamicsTools.Bfield.BfieldTF", "numpy.sin", "lib.BeamDynamicsTools.Bfield.BfieldVF", "matplotlib.pyplot.xlabel", "lib.BeamDynamicsTools.Trajectory.Trajectory", "numpy.linspace", "matplotlib.pyplot.ylim"...
[((1029, 1064), 'numpy.linspace', 'np.linspace', (['(594000.0)', '(900000.0)', '(10)'], {}), '(594000.0, 900000.0, 10)\n', (1040, 1064), True, 'import numpy as np\n'), ((1184, 1240), 'numpy.loadtxt', 'np.loadtxt', (['"""../data/CmodCoordinatesRZ.dat"""'], {'usecols': '[0]'}), "('../data/CmodCoordinatesRZ.dat', usecols=...
from __future__ import print_function import os import sys import numpy as np if len(sys.argv) > 1 and sys.argv[1] == '-p': import mfem.par as mfem use_parallel = True from mfem.common.mpi_debug import nicePrint as print from mpi4py import MPI myid = MPI.COMM_WORLD.rank else: import mf...
[ "mfem.ser.DenseMatrix", "numpy.zeros", "numpy.vstack", "numpy.arange" ]
[((403, 425), 'mfem.ser.DenseMatrix', 'mfem.DenseMatrix', (['(3)', '(3)'], {}), '(3, 3)\n', (419, 425), True, 'import mfem.ser as mfem\n'), ((598, 620), 'mfem.ser.DenseMatrix', 'mfem.DenseMatrix', (['(3)', '(5)'], {}), '(3, 5)\n', (614, 620), True, 'import mfem.ser as mfem\n'), ((531, 542), 'numpy.zeros', 'np.zeros', (...
import nixio import numpy as np import matplotlib.pyplot as plt from .efish_ephys_repro import EfishEphys class Chirps(EfishEphys): _repro_name = "Chirps" def __init__(self, repro_run: nixio.Tag, traces, relacs_nix_version=1.1): super().__init__(repro_run, traces, relacs_nix_version=relacs_nix_versi...
[ "numpy.ones_like", "numpy.max", "matplotlib.pyplot.close", "numpy.min", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((4220, 4264), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'ncols': '(1)', 'nrows': '(3)', 'sharex': '"""all"""'}), "(ncols=1, nrows=3, sharex='all')\n", (4232, 4264), True, 'import matplotlib.pyplot as plt\n'), ((4690, 4701), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (4699, 4701), True, 'impor...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # Copyright 2016 <NAME> <<EMAIL>> # # 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 r...
[ "numpy.empty", "tqdm.tqdm", "corpus.Corpus.connect_to", "numpy.save" ]
[((913, 940), 'corpus.Corpus.connect_to', 'Corpus.connect_to', (['filename'], {}), '(filename)\n', (930, 940), False, 'from corpus import Corpus\n'), ((978, 1010), 'numpy.empty', 'np.empty', (['total'], {'dtype': 'np.uint32'}), '(total, dtype=np.uint32)\n', (986, 1010), True, 'import numpy as np\n'), ((1206, 1237), 'nu...
""" defines methods to access MPC/rigid element data: - get_mpc_node_ids( mpc_id, stop_on_failure=True) - get_mpc_node_ids_c1( mpc_id, stop_on_failure=True) - get_rigid_elements_with_node_ids(self, node_ids) - get_dependent_nid_to_components(self, mpc_id=None, stop_on_failure=True) - get_lines_rigid(model: BD...
[ "collections.defaultdict", "numpy.unique" ]
[((3592, 3609), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (3603, 3609), False, 'from collections import defaultdict\n'), ((3638, 3655), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (3649, 3655), False, 'from collections import defaultdict\n'), ((13745, 13775), 'numpy...
#!/usr/bin/env python3 """ Tutorial example of training a statistical model to tension test data from from a known distribution. """ import sys import os.path sys.path.append("../../../..") sys.path.append("..") import numpy.random as ra import xarray as xr import torch from maker import make_model, downs...
[ "matplotlib.pyplot.ylabel", "torch.cuda.is_available", "sys.path.append", "pyoptmat.optimize.HierarchicalStatisticalModel", "matplotlib.pyplot.loglog", "numpy.random.random", "pyro.param", "matplotlib.pyplot.xlabel", "torch.set_default_tensor_type", "pyro.infer.SVI", "pyro.optim.ClippedAdam", ...
[((170, 200), 'sys.path.append', 'sys.path.append', (['"""../../../.."""'], {}), "('../../../..')\n", (185, 200), False, 'import sys\n'), ((201, 222), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (216, 222), False, 'import sys\n'), ((510, 543), 'warnings.filterwarnings', 'warnings.filterwarning...
import numpy as np import matplotlib.pyplot as pl import h5py import time from readout_fn import * def xyplot(ix,iy): pl.close(2) fig, ax = pl.subplots(figsize=(10,6), nrows=2, ncols=2,num = 'OBSERVED & SYNTHETIC PROFILES') ax = ax.flatten() ix = int(np.ceil(ix)) iy = int(np.ceil(iy)) for i in range(0,4): ax[i...
[ "numpy.ceil", "numpy.reshape", "h5py.File", "matplotlib.pyplot.close", "matplotlib.pyplot.tight_layout", "numpy.loadtxt", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((120, 131), 'matplotlib.pyplot.close', 'pl.close', (['(2)'], {}), '(2)\n', (128, 131), True, 'import matplotlib.pyplot as pl\n'), ((143, 231), 'matplotlib.pyplot.subplots', 'pl.subplots', ([], {'figsize': '(10, 6)', 'nrows': '(2)', 'ncols': '(2)', 'num': '"""OBSERVED & SYNTHETIC PROFILES"""'}), "(figsize=(10, 6), nro...
import numpy as np import pytest from shapecheck import (ShapeError, check_shapes, is_checking_enabled, is_compatible, set_checking_enabled, str_to_shape) from .utils import CaptureStdOut def test_basic(): @check_shapes('3', '4', out_='2') def f(x, y): return x[:2]**2 + y[:2]...
[ "numpy.mean", "numpy.ones", "shapecheck.is_compatible", "shapecheck.check_shapes", "pytest.mark.parametrize", "shapecheck.is_checking_enabled", "numpy.array", "shapecheck.str_to_shape", "pytest.raises", "shapecheck.set_checking_enabled" ]
[((3149, 3389), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""string, shape"""', "[('N,1,3,M', ('N', 1, 3, 'M')), ('N, 1, 3, M', ('N', 1, 3, 'M')), (\n '...,a,1', ('...', 'a', 1)), ('1, ... ,2', (1, '...', 2)), ('a,b,c,...',\n ('a', 'b', 'c', '...')), ('...', ('...',))]"], {}), "('string, shape', [(...
""" Copyright © 2017-2020 ABBYY Production 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 writ...
[ "neoml.PythonWrapper.tensor", "numpy.asarray" ]
[((2482, 2501), 'numpy.asarray', 'numpy.asarray', (['data'], {}), '(data)\n', (2495, 2501), False, 'import numpy\n'), ((4811, 4830), 'numpy.asarray', 'numpy.asarray', (['data'], {}), '(data)\n', (4824, 4830), False, 'import numpy\n'), ((2766, 2818), 'neoml.PythonWrapper.tensor', 'PythonWrapper.tensor', (['math_engine._...
import json import random import os import logging import pickle import string import re from pathlib import Path from collections import Counter, OrderedDict, defaultdict as ddict import torch import numpy as np from tqdm.notebook import tqdm from torch.utils.data import Dataset def set_seed(seed): random.seed(se...
[ "logging.getLogger", "re.compile", "numpy.argsort", "os.path.exists", "pathlib.Path", "numpy.max", "logging.FileHandler", "numpy.random.seed", "collections.OrderedDict", "pickle.load", "re.sub", "torch.cuda.manual_seed_all", "torch.manual_seed", "pickle.dump", "os.makedirs", "logging.F...
[((306, 323), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (317, 323), False, 'import random\n'), ((328, 348), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (342, 348), True, 'import numpy as np\n'), ((353, 376), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (37...
import torch from torch.autograd import Variable from typing import Dict from torch.nn import Module, Linear, Dropout, Sequential, Embedding, LogSigmoid, ReLU from torch.nn.functional import sigmoid, logsigmoid, softmax, normalize, log_softmax from embeddings.representation import SpanRepresentation from torch.nn.init ...
[ "torch.index_select", "torch.nn.ReLU", "torch.nn.Dropout", "torch.autograd.Variable", "embeddings.representation.SpanRepresentation", "torch.multinomial", "torch.nn.functional.cosine_similarity", "torch.from_numpy", "torch.nn.functional.sigmoid", "torch.nn.functional.normalize", "torch.cat", "...
[((531, 548), 'numpy.load', 'np.load', (['filename'], {}), '(filename)\n', (538, 548), True, 'import numpy as np\n'), ((782, 804), 'torch.from_numpy', 'torch.from_numpy', (['data'], {}), '(data)\n', (798, 804), False, 'import torch\n'), ((2987, 3027), 'torch.nn.Embedding', 'Embedding', (['config.n_args', 'config.d_embe...
#!/usr/bin/env python # coding: utf-8 # `Firefly/ntbks/multiple_datasets_tutorial.ipynb` # In[1]: get_ipython().run_line_magic('load_ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') from IPython.display import YouTubeVideo # A recording of this jupyter notebook in action is available at: # In[...
[ "sys.path.insert", "numpy.random.random", "Firefly.data_reader.ArrayReader", "numpy.array", "numpy.linspace", "IPython.display.YouTubeVideo", "numpy.meshgrid" ]
[((326, 353), 'IPython.display.YouTubeVideo', 'YouTubeVideo', (['"""TMq3IvnxGY8"""'], {}), "('TMq3IvnxGY8')\n", (338, 353), False, 'from IPython.display import YouTubeVideo\n'), ((408, 472), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/Users/agurvich/research/repos/Firefly/src"""'], {}), "(0, '/Users/agurvich/re...
################################################################################ # # # ONE-ZONE OPTICALLY THIN BREMSSTRAHLUNG COOLING # # ...
[ "sys.path.insert", "numpy.sqrt", "matplotlib.pyplot.ylabel", "sys.exit", "matplotlib.pyplot.xlabel", "numpy.linspace", "subprocess.call", "matplotlib.pyplot.ylim", "matplotlib.pyplot.savefig", "hdf5_to_dict.load_hdr", "scipy.integrate.odeint", "matplotlib.use", "util.safe_remove", "matplot...
[((507, 539), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../script/"""'], {}), "(0, '../script/')\n", (522, 539), False, 'import sys\n'), ((540, 580), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../script/analysis"""'], {}), "(0, '../script/analysis')\n", (555, 580), False, 'import sys\n'), ((685, 700), ...
# @Time : 2020/11/14 # @Author : <NAME>, <NAME> # @Email : <EMAIL> # UPDATE # @Time : 2021/4/12 # @Author : <NAME> # @Email : <EMAIL> """ textbox.evaluator.abstract_evaluator ##################################### """ import numpy as np class AbstractEvaluator(object): """:class:`AbstractEvaluator` is an ...
[ "numpy.mean" ]
[((1180, 1196), 'numpy.mean', 'np.mean', (['tp_list'], {}), '(tp_list)\n', (1187, 1196), True, 'import numpy as np\n')]
# Copyright 2017 Google Inc. 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 applicable law or a...
[ "tensorflow.shape", "tensorflow.scatter_update", "tensorflow.reduce_sum", "numpy.log", "tensorflow.truncated_normal_initializer", "tensorflow.group", "tensorflow.control_dependencies", "tensorflow.nn.softmax", "tensorflow.reduce_mean", "tensorflow.variables_initializer", "tensorflow.slice", "t...
[((1826, 1843), 'tensorflow.constant', 'tf.constant', (['(True)'], {}), '(True)\n', (1837, 1843), True, 'import tensorflow as tf\n'), ((3294, 3386), 'tensorflow.variables_initializer', 'tf.variables_initializer', (['[self.mem_keys, self.mem_vals, self.mem_age, self.recent_idx]'], {}), '([self.mem_keys, self.mem_vals, s...
import serial import struct import time import numpy as np from ahrs.filters import Madgwick from cube import CubeRenderer sync = b'\xEF\xBE\xAD\xDE' def reset(ser): ser.write(sync) ser.write(b'\x01\x00') ser.write(b'\x00') def begin(ser): ser.write(sync) ser.write(b'\x03\x00') ser.write(b'\x10') ser.w...
[ "time.sleep", "numpy.array", "struct.unpack", "serial.Serial", "cube.CubeRenderer", "ahrs.filters.Madgwick" ]
[((1049, 1062), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (1059, 1062), False, 'import time\n'), ((1142, 1172), 'numpy.array', 'np.array', (['[1.0, 0.0, 0.0, 0.0]'], {}), '([1.0, 0.0, 0.0, 0.0])\n', (1150, 1172), True, 'import numpy as np\n'), ((1182, 1210), 'ahrs.filters.Madgwick', 'Madgwick', ([], {'Dt': '(...
import numpy as np import time import gym def execute(env, policy, gamma=1.0, render=False): totalReward = 0 start = env.reset() stepIndex = 0 while True: if render: env.render() start, reward, done, _ = env.step(int(policy[start])) totalReward += (gamma ** stepIndex...
[ "numpy.mean", "numpy.copy", "numpy.fabs", "numpy.random.choice", "numpy.argmax", "numpy.max", "numpy.zeros", "numpy.all", "time.time", "gym.make" ]
[((570, 585), 'numpy.mean', 'np.mean', (['scores'], {}), '(scores)\n', (577, 585), True, 'import numpy as np\n'), ((638, 658), 'numpy.zeros', 'np.zeros', (['env.env.nS'], {}), '(env.env.nS)\n', (646, 658), True, 'import numpy as np\n'), ((963, 983), 'numpy.zeros', 'np.zeros', (['env.env.nS'], {}), '(env.env.nS)\n', (97...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 11 17:10:49 2020 @author: <NAME> In this code a Hamiltonian Neural Network is designed and employed to solve a system of four differential equations obtained by Hamilton's equations for the Hamiltonian of Henon-Heiles chaotic dynamical. """ import ...
[ "utils_HHsystem.HHsolution", "matplotlib.pyplot.ylabel", "torch.sin", "torch.exp", "copy.deepcopy", "sys.exit", "utils_HHsystem.HH_exact", "os.path.exists", "utils_HHsystem.symEuler", "matplotlib.pyplot.loglog", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.close",...
[((611, 627), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (620, 627), True, 'import matplotlib.pyplot as plt\n'), ((8927, 8964), 'torch.linspace', 'torch.linspace', (['t0', 't_max_test', 'nTest'], {}), '(t0, t_max_test, nTest)\n', (8941, 8964), False, 'import torch\n'), ((9177, 9202), 'uti...
from dataclasses import dataclass from typing import Tuple, List import ase.data import numpy as np from networkx import Graph from rdkit import Chem import graphdg.parse.tools as tools from graphdg.parse.extended_graph import mol_to_extended_graph from graphdg.tools import GLOBALS, NODES, EDGES, SENDERS, RECEIVERS, ...
[ "graphdg.parse.tools.get_atom_distance", "numpy.array", "graphdg.parse.extended_graph.mol_to_extended_graph" ]
[((4616, 4649), 'numpy.array', 'np.array', (['targets'], {'dtype': 'np.float'}), '(targets, dtype=np.float)\n', (4624, 4649), True, 'import numpy as np\n'), ((4826, 4868), 'graphdg.parse.extended_graph.mol_to_extended_graph', 'mol_to_extended_graph', (['molecule'], {'seed': 'seed'}), '(molecule, seed=seed)\n', (4847, 4...
from numpy import genfromtxt import numpy as np import matplotlib.pyplot as plt import sys filepath = 'dummy.csv' if len(sys.argv) >= 2: filepath = sys.argv[1] print(filepath) log_data = genfromtxt(filepath, delimiter=',', skip_header=1, ...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.legend", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.array", "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.step", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.show" ]
[((2442, 2486), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'wspace': 'None', 'hspace': '(0.5)'}), '(wspace=None, hspace=0.5)\n', (2461, 2486), True, 'import matplotlib.pyplot as plt\n'), ((2488, 2508), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(2)', '(2)', '(1)'], {}), '(2, 2, 1)\n', (2499, ...
# Actual movies.py from codecademy import pandas as pd from random import shuffle, seed import numpy as np seed(100) df = pd.read_csv("movies.csv") df = df.dropna() good_movies = df.loc[df['imdb_score'] >= 7] bad_movies = df.loc[df['imdb_score'] < 7] def min_max_normalize(lst): minimum = min(lst) maximum = max(ls...
[ "numpy.array", "random.shuffle", "random.seed", "pandas.read_csv" ]
[((108, 117), 'random.seed', 'seed', (['(100)'], {}), '(100)\n', (112, 117), False, 'from random import shuffle, seed\n'), ((124, 149), 'pandas.read_csv', 'pd.read_csv', (['"""movies.csv"""'], {}), "('movies.csv')\n", (135, 149), True, 'import pandas as pd\n'), ((1145, 1161), 'random.shuffle', 'shuffle', (['dataset'], ...
# # Aggregation of changing ROS topic values over time. Supports the following use cases: # # 1) Latching infrequent values (with expiration) # 2) Aggregating values over a moving window, with tolerance # import rospy class LatchedValue: def __init__(self, topic, max_age, value): self.topic = topic ...
[ "numpy.sqrt", "rospy.get_rostime", "rospy.Time.now", "numpy.sum", "numpy.array", "numpy.nonzero", "numpy.zeros_like", "rospy.loginfo", "sklearn.cluster.DBSCAN" ]
[((1419, 1436), 'numpy.sum', 'np.sum', (['arr[:, 0]'], {}), '(arr[:, 0])\n', (1425, 1436), True, 'import numpy as np\n'), ((1449, 1466), 'numpy.sum', 'np.sum', (['arr[:, 1]'], {}), '(arr[:, 1])\n', (1455, 1466), True, 'import numpy as np\n'), ((404, 423), 'rospy.get_rostime', 'rospy.get_rostime', ([], {}), '()\n', (421...
# ----------------------------------------------------------------------------- # Copyright (c) <NAME> 2015, all rights reserved. # # Created: 2015-10-4 # Version: 0.1 # Purpose: Main Python3 code for running a wireless sensor network gateway node # on a Raspberry Pi 2 with 4 cores # # TODO: Implementa...
[ "logging.basicConfig", "logging.debug", "argparse.ArgumentParser", "pathlib.Path", "datetime.datetime.utcnow", "json.dump", "logging.info", "time.sleep", "logging.INFO", "mpi4py.MPI.Status", "serial.Serial", "guard.guard", "numpy.frombuffer", "xbee.ZigBee", "worker.bee", "numpy.set_pri...
[((911, 945), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (930, 945), True, 'import numpy as np\n'), ((1728, 1740), 'mpi4py.MPI.Status', 'MPI.Status', ([], {}), '()\n', (1738, 1740), False, 'from mpi4py import MPI\n'), ((1862, 1887), 'argparse.ArgumentParser', 'ar...
from sigmoid import sigmoid import numpy as np def sigmoidGradient(z): #SIGMOIDGRADIENT returns the gradient of the sigmoid function #evaluated at z # g = SIGMOIDGRADIENT(z) computes the gradient of the sigmoid function # evaluated at z. This should work regardless if z is a matrix or a # vector. In particular,...
[ "sigmoid.sigmoid", "numpy.ones" ]
[((752, 762), 'sigmoid.sigmoid', 'sigmoid', (['z'], {}), '(z)\n', (759, 762), False, 'from sigmoid import sigmoid\n'), ((984, 994), 'sigmoid.sigmoid', 'sigmoid', (['z'], {}), '(z)\n', (991, 994), False, 'from sigmoid import sigmoid\n'), ((885, 895), 'sigmoid.sigmoid', 'sigmoid', (['z'], {}), '(z)\n', (892, 895), False,...
import numpy as np import mapping # Ohmic spectral density parameters: alpha = 1 s = 1 omega_c = 1 nof_coefficients = 5 # Discretization and chain mapping type: disc_type = 'gk_quad' mapping_type = 'lan_bath' # Discretization accuracy parameter: ncap = 1000000 # Domain of the spectral density. Must choose manual ...
[ "numpy.abs", "numpy.exp", "mapping.chain.get", "mapping.convert_star_to_chain_lan", "mapping.convert_chain_to_star" ]
[((472, 603), 'mapping.chain.get', 'mapping.chain.get', (['J', 'domain', 'nof_coefficients'], {'ncap': 'ncap', 'disc_type': 'disc_type', 'mapping_type': 'mapping_type', 'interval_type': '"""lin"""'}), "(J, domain, nof_coefficients, ncap=ncap, disc_type=\n disc_type, mapping_type=mapping_type, interval_type='lin')\n"...
import cv2 as cv import numpy as np import numpy as np import math import imutils import os beta = 0.75 class BodyPart(): def __init__(self, name='part'): self.name = name self.x = 0 self.y = 0 self.theta = 0 self.l = 0 self.w = 0 self.children = [] self.parent = None ...
[ "cv2.rectangle", "numpy.sqrt", "numpy.count_nonzero", "numpy.array", "cv2.CascadeClassifier", "os.path.exists", "os.listdir", "numpy.where", "cv2.line", "numpy.exp", "cv2.distanceTransform", "numpy.arctan", "numpy.random.normal", "cv2.fillPoly", "numpy.amax", "cv2.polylines", "numpy....
[((2234, 2263), 'cv2.absdiff', 'cv.absdiff', (['frame', 'background'], {}), '(frame, background)\n', (2244, 2263), True, 'import cv2 as cv\n'), ((2797, 2843), 'cv2.distanceTransform', 'cv.distanceTransform', (['foreImage', 'cv.DIST_L2', '(5)'], {}), '(foreImage, cv.DIST_L2, 5)\n', (2817, 2843), True, 'import cv2 as cv\...
#! /usr/bin/env python import os import pdb import time import yaml import json import random import shutil import argparse import numpy as np from collections import defaultdict # torch import torch import torch.nn as nn import torch.nn.functional as F from utils import AverageMeter from solvers import Solver __all...
[ "numpy.mean", "numpy.reshape", "torch.nn.functional.cosine_similarity", "os.path.join", "torch.from_numpy", "numpy.diag", "numpy.isin", "numpy.array", "numpy.sum", "torch.sum", "numpy.concatenate", "torch.nn.functional.relu", "utils.AverageMeter", "numpy.cumsum", "time.time", "numpy.ro...
[((611, 623), 'torch.nn.functional.relu', 'F.relu', (['dist'], {}), '(dist)\n', (617, 623), True, 'import torch.nn.functional as F\n'), ((750, 802), 'torch.nn.functional.cosine_similarity', 'F.cosine_similarity', (['x[:, None, :]', 'y[None, :, :]', '(2)'], {}), '(x[:, None, :], y[None, :, :], 2)\n', (769, 802), True, '...
import torch import os import datetime import pickle import dill import random import numpy as np import torch.nn as nn import torch.nn.functional as F import pandas as pd from torch.optim.lr_scheduler import ReduceLROnPlateau from torch import optim from random import choices from scipy.stats import e...
[ "torch.LongTensor", "numpy.array", "Networks.DecoderSumCover", "pandas.read_pickle", "Parameters.Params", "os.path.exists", "numpy.where", "Networks.DecoderGRUCover", "Evaluation.EvaluationUtil", "torch.optim.lr_scheduler.ReduceLROnPlateau", "Networks.Encoder", "numpy.isnan", "os.makedirs", ...
[((616, 624), 'Parameters.Params', 'Params', ([], {}), '()\n', (622, 624), False, 'from Parameters import Params\n'), ((1360, 1376), 'Evaluation.EvaluationUtil', 'EvaluationUtil', ([], {}), '()\n', (1374, 1376), False, 'from Evaluation import EvaluationUtil\n'), ((1578, 1614), 'numpy.zeros', 'np.zeros', (['(1, self.med...
""" A script which times the training time of our graph2vec reimplementations using both disk memory dataset loaders and ram memory dataset loaders. """ import os import time import numpy as np from geometric2dr.decomposition.weisfeiler_lehman_patterns import wl_corpus from geometric2dr.embedding_methods.pvdbow_train...
[ "numpy.mean", "geometric2dr.decomposition.shortest_path_patterns.sp_corpus", "geometric2dr.decomposition.weisfeiler_lehman_patterns.wl_corpus", "geometric2dr.embedding_methods.utils.get_files", "geometric2dr.embedding_methods.skipgram_trainer.Trainer", "geometric2dr.embedding_methods.pvdm_trainer.PVDM_Tra...
[((686, 740), 'geometric2dr.embedding_methods.utils.get_files', 'utils.get_files', (['corpus_data_dir', '""".gexf"""'], {'max_files': '(0)'}), "(corpus_data_dir, '.gexf', max_files=0)\n", (701, 740), True, 'import geometric2dr.embedding_methods.utils as utils\n'), ((741, 773), 'geometric2dr.decomposition.weisfeiler_leh...
"""Functions for using Gaussian Processes.""" import logging from typing import Callable, Tuple import numpy as np def zero_mean_initialise(x: np.ndarray, kernel_fun: Callable, noise=0.0) -> Tuple[np.ndarray, np.ndarray]: """Initialise a zero mean GP using the provided kernel function. Parameters -----...
[ "numpy.identity", "numpy.linalg.pinv", "numpy.random.multivariate_normal", "numpy.array", "numpy.zeros" ]
[((642, 662), 'numpy.zeros', 'np.zeros', (['x.shape[0]'], {}), '(x.shape[0])\n', (650, 662), True, 'import numpy as np\n'), ((1527, 1588), 'numpy.random.multivariate_normal', 'np.random.multivariate_normal', (['mean_vector', 'covariance_matrix'], {}), '(mean_vector, covariance_matrix)\n', (1556, 1588), True, 'import nu...
"""Module with embedding visualization tools.""" from multiprocessing import cpu_count from typing import Dict, List, Tuple, Union import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd from ddd_subplots import subplots as subplots_3d from ensmallen_graph import EnsmallenGraph # pyli...
[ "matplotlib.legend_handler.HandlerTuple", "matplotlib.patches.Rectangle", "numpy.unique", "sklearn.decomposition.PCA", "tsnecuda.TSNE", "numpy.isin", "ddd_subplots.subplots", "multiprocessing.cpu_count", "numpy.array", "numpy.zeros", "numpy.random.RandomState", "matplotlib.pyplot.cm.get_cmap",...
[((9087, 9114), 'numpy.arange', 'np.arange', (['args[0].shape[0]'], {}), '(args[0].shape[0])\n', (9096, 9114), True, 'import numpy as np\n'), ((9138, 9184), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': 'self._random_state'}), '(seed=self._random_state)\n', (9159, 9184), True, 'import numpy as np\n...
import math from typing import Tuple import numpy as np from PIL import Image # region Shift Hue def rgb_to_hsv(rgb): rgb = rgb.astype('float') hsv = np.zeros_like(rgb) hsv[..., 3:] = rgb[..., 3:] if rgb.shape[2] == 4: hsv[..., 3] = rgb[..., 3] r, g, b = rgb[..., 0], rgb[..., 1], rgb[..., ...
[ "numpy.clip", "PIL.Image.fromarray", "numpy.select", "math.pow", "numpy.floor", "numpy.max", "numpy.array", "numpy.empty_like", "numpy.min", "numpy.zeros_like" ]
[((160, 178), 'numpy.zeros_like', 'np.zeros_like', (['rgb'], {}), '(rgb)\n', (173, 178), True, 'import numpy as np\n'), ((334, 363), 'numpy.max', 'np.max', (['rgb[..., :3]'], {'axis': '(-1)'}), '(rgb[..., :3], axis=-1)\n', (340, 363), True, 'import numpy as np\n'), ((375, 404), 'numpy.min', 'np.min', (['rgb[..., :3]'],...
import cv2 import copy import xxhash import numpy as np import imgui import OpenGL.GL as gl from .static_vars import * from timeit import default_timer as timer from . import imgui_ext import math from typing import * from dataclasses import dataclass _start = timer() USE_FAST_HASH = True LOG_GPU_USAGE = False """ ...
[ "numpy.uint8", "imgui.is_item_hovered_rect", "copy.deepcopy", "OpenGL.GL.glTexImage2D", "numpy.random.RandomState", "imgui.get_io", "imgui.get_item_rect_min", "OpenGL.GL.glGenTextures", "imgui.end_group", "math.fabs", "OpenGL.GL.glBindTexture", "OpenGL.GL.glDeleteTextures", "cv2.cvtColor", ...
[((262, 269), 'timeit.default_timer', 'timer', ([], {}), '()\n', (267, 269), True, 'from timeit import default_timer as timer\n'), ((3490, 3509), 'OpenGL.GL.glGenTextures', 'gl.glGenTextures', (['(1)'], {}), '(1)\n', (3506, 3509), True, 'import OpenGL.GL as gl\n'), ((5598, 5641), 'OpenGL.GL.glPixelStorei', 'gl.glPixelS...
from behave import * from hamcrest import * import numpy @given('a matrix') def step_impl(context): context.matrix = numpy.arange(2, 11).reshape(3, 3) @when('project the agent') def step_impl(context): context.result = context.dpop_1.util_manager.project(context.matrix) @then('result is a matrix has one ...
[ "numpy.ndenumerate", "numpy.arange" ]
[((528, 561), 'numpy.ndenumerate', 'numpy.ndenumerate', (['context.result'], {}), '(context.result)\n', (545, 561), False, 'import numpy\n'), ((124, 143), 'numpy.arange', 'numpy.arange', (['(2)', '(11)'], {}), '(2, 11)\n', (136, 143), False, 'import numpy\n')]
""" The :mod:`sklearnext.metrics.regressio` contains various metrics for regression tasks. """ # Author: <NAME> <<EMAIL>> # Licence: MIT import numpy as np from sklearn.metrics.regression import _check_reg_targets, check_consistent_length from sklearn.externals.six import string_types def weighted_mean_squared_erro...
[ "sklearn.metrics.regression._check_reg_targets", "sklearn.metrics.regression.check_consistent_length", "numpy.average" ]
[((1784, 1831), 'sklearn.metrics.regression._check_reg_targets', '_check_reg_targets', (['y_true', 'y_pred', 'multioutput'], {}), '(y_true, y_pred, multioutput)\n', (1802, 1831), False, 'from sklearn.metrics.regression import _check_reg_targets, check_consistent_length\n'), ((1836, 1890), 'sklearn.metrics.regression.ch...
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
[ "numpy.eye", "numpy.linalg.solve", "numpy.sqrt", "numpy.linalg.pinv", "numpy.random.choice", "timeit.default_timer", "numpy.squeeze", "numpy.zeros", "numpy.random.seed", "numpy.random.randn" ]
[((1197, 1226), 'numpy.zeros', 'np.zeros', (['(d, 1)'], {'dtype': 'float'}), '((d, 1), dtype=float)\n', (1205, 1226), True, 'import numpy as np\n'), ((1241, 1266), 'numpy.zeros', 'np.zeros', (['(d, iterations)'], {}), '((d, iterations))\n', (1249, 1266), True, 'import numpy as np\n'), ((1431, 1448), 'numpy.linalg.pinv'...
#!/usr/bin/env python # donut_plot_with_subgroups_from_dataframe.py __author__ = "<NAME>" #fomightez on GitHub __license__ = "MIT" __version__ = "0.1.0" # donut_plot_with_subgroups_from_dataframe.py by <NAME> # ver 0.1 # #******************************************************************************* # Verified compa...
[ "pandas.read_pickle", "matplotlib.pyplot.setp", "matplotlib.pyplot.savefig", "argparse.ArgumentParser", "pandas.read_csv", "numpy.random.random", "seaborn.light_palette", "matplotlib.pyplot.pie", "pathlib2.Path", "sys.stderr.write", "numpy.random.seed", "sys.exit", "matplotlib.pyplot.title",...
[((7384, 7402), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (7398, 7402), True, 'import numpy as np\n'), ((15572, 15610), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': 'plot_figure_size'}), '(figsize=plot_figure_size)\n', (15584, 15610), True, 'import matplotlib.pyplot as plt\n'), ...
'''Utils for gene expression ''' import os, sys import json import hashlib import math from collections import OrderedDict import h5py import requests import numpy as np import pandas as pd import scipy.sparse as sp from scipy import io from sklearn.preprocessing import scale from bson.codec_options import CodecOptions...
[ "json.loads", "numpy.log10", "requests.post", "math.ceil", "pandas.read_csv", "collections.OrderedDict", "numpy.where", "numpy.in1d", "scipy.io.mmread", "os.path.join", "h5py.File", "os.path.realpath", "bson.codec_options.CodecOptions", "pandas.DataFrame", "scipy.sparse.csr_matrix", "s...
[((376, 402), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (392, 402), False, 'import os, sys\n'), ((611, 629), 'h5py.File', 'h5py.File', (['fn', '"""r"""'], {}), "(fn, 'r')\n", (620, 629), False, 'import h5py\n'), ((723, 746), 'numpy.in1d', 'np.in1d', (['all_gsms', 'gsms'], {}), '(all_gs...
# # Copyright 2019 The FATE 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 appli...
[ "numpy.array" ]
[((1393, 1404), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (1401, 1404), True, 'import numpy as np\n'), ((1417, 1428), 'numpy.array', 'np.array', (['Y'], {}), '(Y)\n', (1425, 1428), True, 'import numpy as np\n')]
import numpy as np # sigmoid function def my_sigmoid(w,x): return 1/(1+np.exp(-w.T.dot(x.T))) # 损失函数 def obj_fun(w,x,y): tmp = y.reshape(1,-1)*np.log(my_sigmoid(w,x)) + \ (1-y.reshape(1,-1))*np.log(1-my_sigmoid(w,x)) return np.sum(-tmp) # 计算随机梯度的函数 def my_Stgrad(w,x,y): return (my_sigmoid(w,x) - y)...
[ "numpy.sum" ]
[((241, 253), 'numpy.sum', 'np.sum', (['(-tmp)'], {}), '(-tmp)\n', (247, 253), True, 'import numpy as np\n')]
""" Run transfer learning on FashionProductImages dataset. This will first fine-tune a chosen model from the ImageNet model zoo on classifying the 20 most common product and then in a second pass will fine-tune the network further on the remaining, less common, product classes. """ import os import random import time i...
[ "few_shot_learning.utils.allocate_inputs", "torch.nn.CrossEntropyLoss", "few_shot_learning.utils.AverageMeter", "torchvision.transforms.ColorJitter", "few_shot_learning.utils.accuracy", "few_shot_learning.utils.save_results", "os.path.isdir", "os.mkdir", "torchvision.transforms.ToTensor", "torchvi...
[((1526, 1553), 'os.path.expanduser', 'os.path.expanduser', (['log_dir'], {}), '(log_dir)\n', (1544, 1553), False, 'import os\n'), ((1570, 1599), 'os.path.expanduser', 'os.path.expanduser', (['model_dir'], {}), '(model_dir)\n', (1588, 1599), False, 'import os\n'), ((2072, 2134), 'functools.partial', 'partial', (['alloc...
import os import copy import numpy as np import jigsawpy def case_3_(src_path, dst_path): # DEMO-3: generate multi-resolution spacing, via local refi- # nement along coastlines and shallow ridges. Global grid # resolution is 150KM, background resolution is 67KM and the # min. adaptive resolution is 33KM. opts...
[ "jigsawpy.savemsh", "numpy.minimum", "os.path.join", "jigsawpy.cmd.marche", "copy.copy", "jigsawpy.jigsaw_jig_t", "jigsawpy.jigsaw_msh_t", "numpy.full", "numpy.maximum" ]
[((323, 346), 'jigsawpy.jigsaw_jig_t', 'jigsawpy.jigsaw_jig_t', ([], {}), '()\n', (344, 346), False, 'import jigsawpy\n'), ((359, 382), 'jigsawpy.jigsaw_msh_t', 'jigsawpy.jigsaw_msh_t', ([], {}), '()\n', (380, 382), False, 'import jigsawpy\n'), ((395, 418), 'jigsawpy.jigsaw_msh_t', 'jigsawpy.jigsaw_msh_t', ([], {}), '(...
from typing import Any, Dict, List, Optional, Tuple, Type, Union import gym import numpy as np import torch as th from torch.nn import functional as F from stable_baselines3.common.buffers import ReplayBuffer from stable_baselines3.common.noise import ActionNoise from stable_baselines3.common.off_policy_algorithm imp...
[ "numpy.mean", "torch.nn.functional.mse_loss", "torch.log", "stable_baselines3.common.preprocessing.get_action_dim", "torch.mean", "torch.max", "stable_baselines3.bear.policies.VariationalAutoEncoder", "torch.exp", "torch.min", "torch.no_grad", "torch.repeat_interleave", "stable_baselines3.comm...
[((6173, 6218), 'stable_baselines3.common.preprocessing.get_flattened_obs_dim', 'get_flattened_obs_dim', (['self.observation_space'], {}), '(self.observation_space)\n', (6194, 6218), False, 'from stable_baselines3.common.preprocessing import get_action_dim, get_flattened_obs_dim\n'), ((6240, 6273), 'stable_baselines3.c...
""" .. currentmodule:: clifford ======================================== clifford (:mod:`clifford`) ======================================== The Main Module. Provides two classes, Layout and MultiVector, and several helper functions to implement the algebras. Classes =============== .. autosummary:: :toctree:...
[ "numpy.abs", "numpy.linalg.solve", "numpy.power", "functools.reduce", "numpy.hstack", "numpy.result_type", "numba.njit", "numpy.argmax", "numpy.asarray", "numpy.linalg.det", "itertools.combinations", "numpy.array", "numpy.zeros", "sparse.COO", "numba.generated_jit" ]
[((2041, 2088), 'numba.njit', 'numba.njit', ([], {'parallel': 'NUMBA_PARALLEL', 'nogil': '(True)'}), '(parallel=NUMBA_PARALLEL, nogil=True)\n', (2051, 2088), False, 'import numba\n'), ((1568, 1595), 'numpy.zeros', 'np.zeros', (['(ndimout, ndimin)'], {}), '((ndimout, ndimin))\n', (1576, 1595), True, 'import numpy as np\...
# coding: utf-8 # 我觉得变量太多的alpha factor我暂时搁置,以及我觉得rank函数比较奇怪,因为range太大了,是否需要设置一个窗口呢? # # # ## Dropped Index: # - Alpha30(要用到fama三因子) # - Alpha75(要用到BENCHMARKINDEX) # - Alpha143(要用到SELF函数) # - Alpha149(要用到BENCHMARKINDEX) # - Alpha181(要用到BENCHMARKINDEX) # - Alpha182(要用到BENCHMARKINDEX) ### 对于:?较为复杂的表达式,我都先用一些中间变量存储中间...
[ "numpy.log" ]
[((36308, 36321), 'numpy.log', 'np.log', (['CLOSE'], {}), '(CLOSE)\n', (36314, 36321), True, 'import numpy as np, pandas as pd, matplotlib.pyplot as plt\n'), ((24007, 24020), 'numpy.log', 'np.log', (['CLOSE'], {}), '(CLOSE)\n', (24013, 24020), True, 'import numpy as np, pandas as pd, matplotlib.pyplot as plt\n'), ((241...
""" Disctrict Cooling Network Calculations. Calculate which technologies need to be activated to meet the cooling energy demand and determine the cost and emissions that result from the activation of these cooling technologies. """ import numpy as np import pandas as pd from cea.constants import HOURS_IN_YEAR from c...
[ "numpy.amax", "numpy.average", "cea.technologies.chiller_vapor_compression.VaporCompressionChiller", "cea.optimization.master.cost_model.calc_generation_costs_capacity_installed_cooling", "cea.optimization.master.cost_model.calc_network_costs_cooling", "numpy.array", "numpy.zeros", "cea.optimization.s...
[((6856, 6948), 'cea.technologies.cogeneration.calc_cop_CCGT', 'calc_cop_CCGT', (['master_to_slave_variables.NG_Trigen_ACH_size_W', 'ACH_T_IN_FROM_CHP_K', '"""NG"""'], {}), "(master_to_slave_variables.NG_Trigen_ACH_size_W,\n ACH_T_IN_FROM_CHP_K, 'NG')\n", (6869, 6948), False, 'from cea.technologies.cogeneration impo...
import panda3d as p3d import numpy as np from itertools import izip from plyfile import PlyData, PlyElement, make2d as PlyMake2D # pip install plyfile from renderer_util import compute_vertex_normals class PLYNode(p3d.core.GeomNode): # TODO (True): large point clouds will overrun the buffer; so, we'll have to ...
[ "panda3d.core.Geom", "panda3d.core.GeomTriangles", "numpy.column_stack", "numpy.array", "panda3d.core.GeomPoints", "renderer_util.compute_vertex_normals", "panda3d.core.GeomVertexData", "plyfile.make2d", "plyfile.PlyData.read", "numpy.all", "panda3d.core.GeomVertexFormat" ]
[((546, 568), 'plyfile.PlyData.read', 'PlyData.read', (['ply_file'], {}), '(ply_file)\n', (558, 568), False, 'from plyfile import PlyData, PlyElement, make2d as PlyMake2D\n'), ((1448, 1494), 'plyfile.make2d', 'PlyMake2D', (["mesh['face'].data['vertex_indices']"], {}), "(mesh['face'].data['vertex_indices'])\n", (1457, 1...
from keras.models import Sequential, load_model from keras.layers import Dense, Reshape, Flatten, Conv2D, Conv2DTranspose, BatchNormalization, Activation from keras.layers.advanced_activations import LeakyReLU from keras.optimizers import Adam, SGD from keras.backend import clear_session import numpy as np import os i...
[ "numpy.random.normal", "keras.optimizers.Adam", "keras.layers.Conv2D", "keras.models.load_model", "scipy.misc.imsave", "os.path.join", "logging.info", "keras.layers.advanced_activations.LeakyReLU", "app.utils.mkdir_p", "keras.models.Sequential", "numpy.array", "keras.layers.Conv2DTranspose", ...
[((1072, 1092), 'keras.models.load_model', 'load_model', (['filename'], {}), '(filename)\n', (1082, 1092), False, 'from keras.models import Sequential, load_model\n'), ((1277, 1297), 'keras.models.load_model', 'load_model', (['filename'], {}), '(filename)\n', (1287, 1297), False, 'from keras.models import Sequential, l...
import os import glob import picamera import cv2 import numpy as np import importlib.util from datetime import datetime import videorecorder as vr import time from collections import Counter # If using TPU, need to load a different library # from tensorflow.lite.python.interpreter import Interpreter def take_picture...
[ "cv2.rectangle", "time.sleep", "cv2.imshow", "glob.glob", "numpy.float32", "picamera.PiCamera", "cv2.putText", "cv2.cvtColor", "cv2.getTextSize", "cv2.resize", "cv2.imread", "os.path.join", "videorecorder.VideoRecorder", "os.getcwd", "collections.Counter", "datetime.datetime.now", "t...
[((397, 416), 'picamera.PiCamera', 'picamera.PiCamera', ([], {}), '()\n', (414, 416), False, 'import picamera\n'), ((744, 774), 'os.path.join', 'os.path.join', (['path', 'cone_color'], {}), '(path, cone_color)\n', (756, 774), False, 'import os\n'), ((802, 831), 'videorecorder.VideoRecorder', 'vr.VideoRecorder', (['path...
from torch.utils.data import Dataset, DataLoader import os import json import sys import csv import itertools import numpy as np BASE_DIR = os.path.dirname(os.path.abspath(__file__)) UTILS_DIR = os.path.abspath(os.path.join(BASE_DIR, '..', 'utils')) sys.path.append(UTILS_DIR) from data_helper import * from coord_helpe...
[ "torch.manual_seed", "os.path.exists", "numpy.ones", "rotation_lib.angle_axis_from_quaternion", "os.path.join", "numpy.append", "numpy.stack", "numpy.zeros", "numpy.array", "rotation_lib.quat2mat", "torch.utils.data.DataLoader", "os.path.abspath", "numpy.load", "sys.path.append", "torch....
[((250, 276), 'sys.path.append', 'sys.path.append', (['UTILS_DIR'], {}), '(UTILS_DIR)\n', (265, 276), False, 'import sys\n'), ((156, 181), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (171, 181), False, 'import os\n'), ((211, 248), 'os.path.join', 'os.path.join', (['BASE_DIR', '""".."""', '...
""" <NAME> descriptor.py Takes in a directory of sub-directories of images and produces a descriptor file for all the images found in the sub-directories. ,:'/ _..._ // ( `""-.._.' \| / 6\___ ...
[ "os.listdir", "pickle.dump", "numpy.histogramdd", "numpy.hstack", "numpy.empty", "sys.exit", "cv2.imread" ]
[((1863, 1884), 'os.listdir', 'os.listdir', (['train_dir'], {}), '(train_dir)\n', (1873, 1884), False, 'import os\n'), ((2230, 2245), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (2240, 2245), False, 'import os\n'), ((2738, 2771), 'numpy.histogramdd', 'np.histogramdd', (['pixels', '(t, t, t)'], {}), '(pixels, ...
#!/usr/bin/env python """ A simple coin flipping example. The model is written in PyMC3. Inspired by Stan's toy example. Probability model Prior: Beta Likelihood: Bernoulli Variational model Likelihood: Mean-field Beta """ import edward as ed import pymc3 as pm import numpy as np import theano from edward...
[ "edward.MFVI", "edward.models.Beta", "pymc3.Beta", "edward.models.PyMC3Model", "numpy.array", "numpy.zeros", "pymc3.Model", "edward.models.Variational", "pymc3.Bernoulli" ]
[((650, 680), 'edward.models.PyMC3Model', 'PyMC3Model', (['model', 'data_shared'], {}), '(model, data_shared)\n', (660, 680), False, 'from edward.models import PyMC3Model, Variational, Beta\n'), ((695, 708), 'edward.models.Variational', 'Variational', ([], {}), '()\n', (706, 708), False, 'from edward.models import PyMC...
from core.base_environment import * import numpy as np from overrides import overrides from pyhelper_fns import vis_utils def str2action(cmd): cmd = cmd.strip() if cmd == 'w': #up ctrl = [0, 0.1] elif cmd == 'a': #left ctrl = [-0.1, 0] elif cmd == 'd': #right ctrl = [0.1, 0] elif cmd ...
[ "numpy.clip", "pyhelper_fns.vis_utils.MyAnimation", "numpy.where", "numpy.array", "numpy.zeros", "numpy.linspace", "numpy.sum" ]
[((1424, 1438), 'numpy.zeros', 'np.zeros', (['(2,)'], {}), '((2,))\n', (1432, 1438), True, 'import numpy as np\n'), ((1470, 1484), 'numpy.zeros', 'np.zeros', (['(2,)'], {}), '((2,))\n', (1478, 1484), True, 'import numpy as np\n'), ((1516, 1530), 'numpy.zeros', 'np.zeros', (['(2,)'], {}), '((2,))\n', (1524, 1530), True,...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 20 09:17:52 2019 @author: <NAME>, https://github.com/zhaofenqiang Contact: <EMAIL> """ import numpy as np from interp_numpy import resampleSphereSurf, bilinearResampleSphereSurfImg # from utils import get_neighs_order def get_rot_mat_zyz(z1, y...
[ "numpy.mean", "interp_numpy.bilinearResampleSphereSurfImg", "interp_numpy.resampleSphereSurf", "numpy.squeeze", "numpy.array", "numpy.linspace", "numpy.cos", "numpy.sin", "numpy.transpose", "numpy.amax" ]
[((1698, 1723), 'numpy.amax', 'np.amax', (['moving_xyz[:, 0]'], {}), '(moving_xyz[:, 0])\n', (1705, 1723), True, 'import numpy as np\n'), ((2101, 2176), 'numpy.linspace', 'np.linspace', (['(Center1 - SearchWidth)', '(Center1 + SearchWidth)'], {'num': 'numIntervals'}), '(Center1 - SearchWidth, Center1 + SearchWidth, num...
''' MIT License Optimal Testing and Containment Strategies for Universities in Mexico amid COVID-19 Copyright © 2021 Test and Contain. <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,and <NAME>. https://www.testandcontain.com/ Permission is hereby granted, free of charge, to any person obtaining a copy of thi...
[ "json.loads", "pandas.read_csv", "numpy.trunc", "dash.dependencies.Output", "dash_core_components.Location", "dash.dependencies.Input", "dash.callback_context.response.set_cookie", "preprocess._", "pandas.DataFrame", "dash.dependencies.State", "time.time", "random.randint", "dash_html_compon...
[((1966, 2000), 'dash.dependencies.Output', 'Output', (['"""page-content"""', '"""children"""'], {}), "('page-content', 'children')\n", (1972, 2000), False, 'from dash.dependencies import Input, Output, State, MATCH, ALL\n'), ((5528, 5554), 'dash.dependencies.Input', 'Input', (['"""campus_id"""', '"""data"""'], {}), "(...
# encoding = UTF-8 import numpy as np import message_passing import nn import randomtest import matplotlib.pyplot as plt def draw_graph(result, k): x_values = range(1, k+2) y_values = result ''' scatter() x:横坐标 y:纵坐标 s:点的尺寸 ''' plt.scatter(x_values, y_values, s=10) # 设置图表标题并给坐标轴加上标签...
[ "numpy.random.random_sample", "matplotlib.pyplot.ylabel", "numpy.average", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.tick_params", "numpy.diag", "numpy.zeros", "numpy.random.randint", "numpy.dot", "matplotlib.pyplot.scatter", "numpy.linalg.svd", "matplotlib.pyplot.title", "matplotlib.py...
[((705, 721), 'numpy.zeros', 'np.zeros', (['(M, N)'], {}), '((M, N))\n', (713, 721), True, 'import numpy as np\n'), ((726, 737), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (734, 737), True, 'import numpy as np\n'), ((749, 769), 'numpy.zeros', 'np.zeros', (['[N, 10000]'], {}), '([N, 10000])\n', (757, 769), True, '...
import itertools import numpy as np import numpy.testing as npt import pytest from quara.objects.composite_system import CompositeSystem from quara.objects.composite_system_typical import generate_composite_system from quara.objects.elemental_system import ElementalSystem from quara.objects.matrix_basis import get_no...
[ "quara.minimization_algorithm.projected_gradient_descent_backtracking.ProjectedGradientDescentBacktracking", "quara.protocol.qtomography.standard.standard_qmpt.StandardQmpt", "numpy.array", "quara.objects.composite_system.CompositeSystem", "quara.objects.composite_system_typical.generate_composite_system", ...
[((12343, 12406), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""on_para_eq_constraint"""', '[True, False]'], {}), "('on_para_eq_constraint', [True, False])\n", (12366, 12406), False, 'import pytest\n'), ((13872, 13935), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""on_para_eq_constraint"""',...
import sys import numpy as np import dimod from dwave.system.samplers import DWaveSampler from dwave.system.composites import EmbeddingComposite def loadFile(filename): commands= {} with open(filename) as fh: for line in fh: if line[0] != "#": command, description = line.st...
[ "numpy.argmin", "dwave.system.samplers.DWaveSampler", "numpy.save", "dimod.BinaryQuadraticModel" ]
[((873, 945), 'dimod.BinaryQuadraticModel', 'dimod.BinaryQuadraticModel', (['linear', 'quadratic', 'const', 'dimod.Vartype.SPIN'], {}), '(linear, quadratic, const, dimod.Vartype.SPIN)\n', (899, 945), False, 'import dimod\n'), ((1538, 1559), 'numpy.argmin', 'np.argmin', (['energy_vec'], {}), '(energy_vec)\n', (1547, 155...
""" Inter Rising Edge Timer: This example outlines the use of the single channel inter rising edge time measurement function of the time controller. Tis example showcases its use by generating a histogram of signal at CH1. First, the start_iretimer() function must be called which will start the hardware module for it....
[ "logging.getLogger", "logging.basicConfig", "pyqtgraph.Qt.QtGui.QApplication.instance", "pyqtgraph.Qt.QtCore.QRectF", "pyqtgraph.plot", "time.perf_counter", "time.sleep", "numpy.zeros", "pyqtgraph.Qt.QtGui.QApplication", "numpy.linspace", "_thread.start_new_thread", "pyqtgraph.Qt.QtCore.QTimer...
[((915, 942), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (932, 942), False, 'import logging\n'), ((943, 1053), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s [%(levelname)7s] %(module)s -- %(message)s"""'}), "(level=logging.DEBU...
import numpy as np from VariableUnittest import VariableUnitTest from gwlfe.Input.WaterBudget import GroundWatLE class TestGroundWatLE(VariableUnitTest): def test_GroundWatLE_ground_truth(self): z = self.z np.testing.assert_array_almost_equal( np.load(self.basepath + "/GroundWatLE.np...
[ "numpy.load", "gwlfe.Input.WaterBudget.GroundWatLE.GroundWatLE_f", "gwlfe.Input.WaterBudget.GroundWatLE.GroundWatLE" ]
[((280, 323), 'numpy.load', 'np.load', (["(self.basepath + '/GroundWatLE.npy')"], {}), "(self.basepath + '/GroundWatLE.npy')\n", (287, 323), True, 'import numpy as np\n'), ((337, 620), 'gwlfe.Input.WaterBudget.GroundWatLE.GroundWatLE', 'GroundWatLE.GroundWatLE', (['z.NYrs', 'z.DaysMonth', 'z.Temp', 'z.InitSnow_0', 'z.P...
from sklearn.neighbors import KNeighborsClassifier from PIL import Image import numpy as np import json import time import sys import argparse import os from datetime import datetime import warnings warnings.simplefilter(action='ignore', category=FutureWarning) def get_output_file_name(path): head, tail = os.pat...
[ "os.path.exists", "PIL.Image.fromarray", "PIL.Image.open", "argparse.ArgumentParser", "os.makedirs", "PIL.Image.new", "sklearn.neighbors.KNeighborsClassifier", "numpy.asarray", "os.path.split", "json.load", "numpy.array", "datetime.datetime.now", "os.path.basename", "warnings.simplefilter"...
[((200, 262), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (221, 262), False, 'import warnings\n'), ((314, 333), 'os.path.split', 'os.path.split', (['path'], {}), '(path)\n', (327, 333), False, 'import os\...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import struct import numpy as np import subprocess import matplotlib.pyplot as plt from collections import namedtuple # N - number of oscillators # freq - oscillator frequency (N elements) # phase - oscillator phases (N elements) # k - coupling coeffici...
[ "os.path.exists", "numpy.fromfile", "collections.namedtuple", "matplotlib.pyplot.savefig", "os.makedirs", "os.path.join", "struct.pack", "os.path.split", "matplotlib.pyplot.close", "subprocess.call", "os.remove" ]
[((351, 404), 'collections.namedtuple', 'namedtuple', (['"""DataPreset"""', "['N', 'k', 'freq', 'phase']"], {}), "('DataPreset', ['N', 'k', 'freq', 'phase'])\n", (361, 404), False, 'from collections import namedtuple\n'), ((5386, 5419), 'os.path.join', 'os.path.join', (['directory', 'filename'], {}), '(directory, filen...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 10 17:19:24 2021 @author: tungdang """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 10 14:16:33 2021 @author: tungbioinfo """ import warnings from abc import ABCMeta, abstractmethod from time import time import math fro...
[ "scipy.special.digamma", "scipy.special.gammaln", "numpy.ones", "math.factorial", "numpy.log", "numpy.exp", "numpy.sum", "numpy.dot", "numpy.errstate", "numpy.empty", "numpy.finfo", "pandas.DataFrame", "numpy.cumsum", "scipy.special.logsumexp", "numpy.nan_to_num" ]
[((924, 959), 'numpy.ones', 'np.ones', (['(n_components, n_features)'], {}), '((n_components, n_features))\n', (931, 959), True, 'import numpy as np\n'), ((972, 1007), 'numpy.ones', 'np.ones', (['(n_components, n_features)'], {}), '((n_components, n_features))\n', (979, 1007), True, 'import numpy as np\n'), ((1128, 116...
# 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", "torch.nn.Unfold", "numpy.random.RandomState", "torch.nn.Fold", "torch.flatten" ]
[((754, 786), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': 'seed'}), '(seed=seed)\n', (775, 786), True, 'import numpy as np\n'), ((803, 821), 'numpy.prod', 'np.prod', (['image_chw'], {}), '(image_chw)\n', (810, 821), True, 'import numpy as np\n'), ((1441, 1473), 'numpy.random.RandomState', 'np.ran...
import numpy as np from itertools import product from itertools import permutations def choose_nums(big, small): """ This function takes 2 inputs (number of big number and number of small numbers) and returns a list of appropriate randomized inetegers """ #test inputs assert type(big) is int, "...
[ "itertools.permutations", "numpy.random.randint", "itertools.product" ]
[((3151, 3178), 'numpy.random.randint', 'np.random.randint', (['(100)', '(999)'], {}), '(100, 999)\n', (3168, 3178), True, 'import numpy as np\n'), ((784, 807), 'numpy.random.randint', 'np.random.randint', (['(0)', '(3)'], {}), '(0, 3)\n', (801, 807), True, 'import numpy as np\n'), ((897, 921), 'numpy.random.randint', ...
#!/usr/bin/env python # coding: utf8 # # Copyright (c) 2021 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA2D # # https://github.com/CNES/Pandora2D # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
[ "numpy.reshape", "json_checker.Checker", "scipy.optimize.minimize", "numpy.rollaxis", "multiprocessing.cpu_count", "numpy.array", "numpy.isnan", "numpy.nonzero", "json_checker.And", "numpy.all", "scipy.interpolate.interp2d" ]
[((1888, 1903), 'json_checker.Checker', 'Checker', (['schema'], {}), '(schema)\n', (1895, 1903), False, 'from json_checker import And, Checker\n'), ((3432, 3453), 'numpy.isnan', 'np.isnan', (['matrix_cost'], {}), '(matrix_cost)\n', (3440, 3453), True, 'import numpy as np\n'), ((3504, 3516), 'numpy.all', 'np.all', (['na...
import numpy as np import math import random import matplotlib.pyplot as plt # ref : http://outlace.com/rlpart3.html # TODO : add ploting method class QAgent: # TODO : inherit from some RL classes which implement alpha , gamma , etc and delete them from constructor # TODO : make growing strategy...
[ "random.uniform", "numpy.fromfile", "numpy.eye", "numpy.ones", "numpy.unique", "math.sqrt", "numpy.argmax", "numpy.max", "numpy.append", "numpy.zeros", "numpy.argwhere", "numpy.triu", "numpy.transpose", "random.randint", "numpy.arange" ]
[((816, 855), 'numpy.zeros', 'np.zeros', (['(nbStateBatch, self.nbAction)'], {}), '((nbStateBatch, self.nbAction))\n', (824, 855), True, 'import numpy as np\n'), ((1453, 1473), 'random.uniform', 'random.uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (1467, 1473), False, 'import random\n'), ((3326, 3367), 'numpy.fromfile',...
# MIT License # # Copyright (c) 2021 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publi...
[ "librosa.feature.melspectrogram", "librosa.magphase", "torch.Tensor", "librosa.feature.mfcc", "numpy.std", "librosa.stft", "librosa.amplitude_to_db", "numpy.log1p", "torch.FloatTensor" ]
[((883, 984), 'librosa.stft', 'librosa.stft', (['sound'], {'n_fft': 'self.n_fft', 'hop_length': 'self.hop_length', 'window': 'signal.windows.hamming'}), '(sound, n_fft=self.n_fft, hop_length=self.hop_length, window=\n signal.windows.hamming)\n', (895, 984), False, 'import librosa\n'), ((1005, 1027), 'librosa.magphas...
import numpy as np import nibabel as nib import os def squeezeNii(root, file): img = nib.load(root + '/' + file) newFile = file.replace('.nii','_temp.nii') nib.save(nib.Nifti1Image(np.squeeze(img.dataobj),img.affine), root+'/'+newFile) # This is to get the directory that the program # is curre...
[ "numpy.squeeze", "os.walk", "nibabel.load" ]
[((466, 483), 'os.walk', 'os.walk', (['dir_path'], {}), '(dir_path)\n', (473, 483), False, 'import os\n'), ((95, 122), 'nibabel.load', 'nib.load', (["(root + '/' + file)"], {}), "(root + '/' + file)\n", (103, 122), True, 'import nibabel as nib\n'), ((201, 224), 'numpy.squeeze', 'np.squeeze', (['img.dataobj'], {}), '(im...
import matplotlib.pyplot as plt from scipy.optimize import curve_fit import numpy as np def exponential(x, a, b): return a * b**x def get_curve_pars(d20, d21): year = np.linspace(1, 120, num=120) temp_20 = np.linspace(0, d20*100, num=100) temp_21 = np.linspace(d20*101, d20*100 + d21*20, num=20) ...
[ "scipy.optimize.curve_fit", "numpy.linspace", "numpy.concatenate", "numpy.diag" ]
[((179, 207), 'numpy.linspace', 'np.linspace', (['(1)', '(120)'], {'num': '(120)'}), '(1, 120, num=120)\n', (190, 207), True, 'import numpy as np\n'), ((222, 256), 'numpy.linspace', 'np.linspace', (['(0)', '(d20 * 100)'], {'num': '(100)'}), '(0, d20 * 100, num=100)\n', (233, 256), True, 'import numpy as np\n'), ((269, ...
# MIT License # # Copyright (c) 2017 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publi...
[ "numpy.mean", "numpy.ceil", "numpy.random.choice", "numpy.sum", "numpy.zeros_like" ]
[((4039, 4068), 'numpy.zeros_like', 'np.zeros_like', (['bottom[0].data'], {}), '(bottom[0].data)\n', (4052, 4068), True, 'import numpy as np\n'), ((4260, 4274), 'numpy.mean', 'np.mean', (['whdrs'], {}), '(whdrs)\n', (4267, 4274), True, 'import numpy as np\n'), ((6038, 6071), 'numpy.sum', 'np.sum', (['comparisons[comp_l...
""" Traffic.py """ __author__ = "<EMAIL>" import numpy as np from os import listdir from re import split from OU import OU from helper import softmax def natural_key(string_): """See http://www.codinghorror.com/blog/archives/001018.html""" return [int(s) if s.isdigit() else s for s in split(r'(\d+)', string...
[ "numpy.random.normal", "re.split", "numpy.multiply", "numpy.average", "numpy.random.choice", "numpy.random.exponential", "numpy.fill_diagonal", "numpy.split", "numpy.outer", "numpy.vstack", "numpy.random.uniform", "numpy.full", "numpy.loadtxt", "numpy.random.randn", "OU.OU" ]
[((1266, 1314), 'OU.OU', 'OU', (['(1)', '(self.capacity / 2)', '(0.1)', '(self.capacity / 2)'], {}), '(1, self.capacity / 2, 0.1, self.capacity / 2)\n', (1268, 1314), False, 'from OU import OU\n'), ((1335, 1369), 'OU.OU', 'OU', (['(self.nodes_num ** 2)', '(1)', '(0.1)', '(1)'], {}), '(self.nodes_num ** 2, 1, 0.1, 1)\n'...
# -*- coding: utf-8 -*- """ Defines unit tests for :mod:`colour.recovery.mallett2019` module. """ from __future__ import division, unicode_literals import unittest import numpy as np from colour.characterisation import SDS_COLOURCHECKERS from colour.colorimetry import (SpectralShape, MSDS_CMFS_STANDARD_OBSERVER, ...
[ "colour.recovery.spectral_primary_decomposition_Mallett2019", "numpy.ones_like", "numpy.testing.assert_array_less", "colour.difference.delta_E_CIE1976", "colour.models.XYZ_to_Lab", "colour.colorimetry.SpectralShape", "colour.colorimetry.sd_to_XYZ", "colour.models.XYZ_to_RGB", "unittest.main", "num...
[((4307, 4322), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4320, 4322), False, 'import unittest\n'), ((1618, 1633), 'numpy.full', 'np.full', (['(3)', '(1.0)'], {}), '(3, 1.0)\n', (1625, 1633), True, 'import numpy as np\n'), ((3510, 3537), 'colour.colorimetry.SpectralShape', 'SpectralShape', (['(380)', '(730)'...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import json import numpy as np from pprint import pprint sys.path.append('../') from main_human36 import main_human as main # ordering of table 1 in the camera ready paper # 1) 3d supervised - opt_row_sup from opts.table_1.row_sup import opt as opt_...
[ "numpy.mean", "os.makedirs", "os.path.join", "os.path.isdir", "main_human36.main_human", "sys.path.append", "json.dump" ]
[((126, 148), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (141, 148), False, 'import sys\n'), ((1214, 1253), 'os.path.join', 'os.path.join', (['exp_opt.ckpt', 'exp_opt.exp'], {}), '(exp_opt.ckpt, exp_opt.exp)\n', (1226, 1253), False, 'import os\n'), ((1864, 1887), 'main_human36.main_human', ...
# https://scikit-learn.org/stable/auto_examples/inspection/plot_permutation_importance_multicollinear.html#sphx-glr-auto-examples-inspection-plot-permutation-importance-multicollinear-py # https://orbi.uliege.be/bitstream/2268/155642/1/louppe13.pdf # https://proceedings.neurips.cc/paper/2019/file/702cafa3bb4c9c86e4a3b6...
[ "numpy.random.rand", "sklearn.ensemble.ExtraTreesClassifier", "scipy.cluster.hierarchy.fcluster", "numpy.arange", "numpy.mean", "numpy.full_like", "numpy.max", "sklearn.inspection.permutation_importance", "numpy.dot", "numpy.random.seed", "numpy.concatenate", "numpy.min", "pandas.DataFrame",...
[((1112, 1123), 'time.time', 'time.time', ([], {}), '()\n', (1121, 1123), False, 'import time\n'), ((1137, 1188), 'sklearn.model_selection.cross_val_score', 'cross_val_score', (['model', 'dataset_x', 'dataset_y'], {'cv': 'cv'}), '(model, dataset_x, dataset_y, cv=cv)\n', (1152, 1188), False, 'from sklearn.model_selectio...
import numpy as np def mark_label_on_pathways(name, pid, pw_map, gene_id_list, label=1): """Marks given genes to the pathways Parameters ---------- name: str pid: int patient id pw_map: map of networkx graphs of pathways patient label mapping gene_id_list: list of list of ...
[ "numpy.any" ]
[((781, 832), 'numpy.any', 'np.any', (["[(g in nd['uniprotids']) for g in gene_ids]"], {}), "([(g in nd['uniprotids']) for g in gene_ids])\n", (787, 832), True, 'import numpy as np\n')]