code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 12 18:55:12 2019
@author: Bob
"""
import numpy as np
def Haversine(location_1, location_2, unit='miles'):
conversion = {'miles': 1609.344,
'kilometers': 1000.000,
'feet': 0.3047851,
'meters': 1}
lat1, lo... | [
"numpy.sin",
"numpy.sqrt",
"numpy.cos",
"numpy.deg2rad"
] | [((476, 492), 'numpy.deg2rad', 'np.deg2rad', (['lat1'], {}), '(lat1)\n', (486, 492), True, 'import numpy as np\n'), ((505, 522), 'numpy.deg2rad', 'np.deg2rad', (['long1'], {}), '(long1)\n', (515, 522), True, 'import numpy as np\n'), ((534, 550), 'numpy.deg2rad', 'np.deg2rad', (['lat2'], {}), '(lat2)\n', (544, 550), Tru... |
# -*- coding: utf-8 -*-
from numba import int32,complex128,int64,jit
import numba as nb
import numpy as np
import sys
import smuthi.memoizing as memo
import smuthi.spherical_functions as sf
# import sympy
# import sympy.physics.wigner
try:
from numba import cffi_support
from pywigxjpf_ffi import ffi, lib
... | [
"sys.stdout.write",
"numpy.arctan2",
"smuthi.spherical_functions.spherical_hankel",
"numpy.ones",
"numpy.sin",
"sys.stdout.flush",
"numpy.exp",
"pywigxjpf_ffi.lib.wig_temp_init",
"numpy.logical_not",
"smuthi.spherical_functions.dx_xj",
"pywigxjpf_ffi.lib.wig_table_init",
"numpy.arccos",
"smu... | [((345, 388), 'numba.cffi_support.register_module', 'cffi_support.register_module', (['pywigxjpf_ffi'], {}), '(pywigxjpf_ffi)\n', (373, 388), False, 'from numba import cffi_support\n'), ((435, 461), 'pywigxjpf_ffi.lib.wig_table_init', 'lib.wig_table_init', (['(100)', '(9)'], {}), '(100, 9)\n', (453, 461), False, 'from ... |
from pathlib import Path
import gym
import numpy as np
import pickle
import time
class RewardLearningWrapper(gym.Wrapper):
"""Wrapper class for a Gym environment for gathering human feedback."""
env: gym.Env
def __init__(self, env: gym.Env, db_path: Path | str):
super().__init__(env)
mode... | [
"numpy.stack",
"pathlib.Path",
"time.time_ns",
"pickle.dump"
] | [((508, 521), 'pathlib.Path', 'Path', (['db_path'], {}), '(db_path)\n', (512, 521), False, 'from pathlib import Path\n'), ((1182, 1202), 'pickle.dump', 'pickle.dump', (['clip', 'f'], {}), '(clip, f)\n', (1193, 1202), False, 'import pickle\n'), ((1072, 1100), 'numpy.stack', 'np.stack', (['self._state_buffer'], {}), '(se... |
## Support Vector Machine
import numpy as np
from svm_3 import *
train_f1 = x_train[:, 0]
train_f2 = x_train[:, 1]
train_f1 = train_f1.reshape(90, 1)
train_f2 = train_f2.reshape(90, 1)
w1 = np.zeros((90, 1))
w2 = np.zeros((90, 1))
epochs = 1
alpha = 0.0001
while (epochs < 10000):
y = w1 * train_f1 + w2 * trai... | [
"numpy.zeros"
] | [((194, 211), 'numpy.zeros', 'np.zeros', (['(90, 1)'], {}), '((90, 1))\n', (202, 211), True, 'import numpy as np\n'), ((217, 234), 'numpy.zeros', 'np.zeros', (['(90, 1)'], {}), '((90, 1))\n', (225, 234), True, 'import numpy as np\n')] |
import numpy as np
import cv2
import glob
import os
CORNER_SIZE = (9, 6)
class CameraCalibration:
def __init__(self, rel_cal_img_folder_path):
self.project_path = os.path.abspath(os.curdir)
self.cal_img_names = glob.glob(self.project_path + '/' + rel_cal_img_folder_path + '*.jpg')
self.ob... | [
"os.path.abspath",
"cv2.findChessboardCorners",
"cv2.cvtColor",
"numpy.zeros",
"cv2.imread",
"cv2.calibrateCamera",
"glob.glob",
"cv2.undistort"
] | [((178, 204), 'os.path.abspath', 'os.path.abspath', (['os.curdir'], {}), '(os.curdir)\n', (193, 204), False, 'import os\n'), ((234, 304), 'glob.glob', 'glob.glob', (["(self.project_path + '/' + rel_cal_img_folder_path + '*.jpg')"], {}), "(self.project_path + '/' + rel_cal_img_folder_path + '*.jpg')\n", (243, 304), Fals... |
#import packages
from random import randint
import numpy as np
import pandas as pd
#define the Dice class
class Dice:
"""
A class used to represent the five dice
...
Attributes
----------
current_throw : list
List of integers of the five dice
"""
def __in... | [
"numpy.sort",
"numpy.sum",
"random.randint",
"numpy.unique"
] | [((426, 439), 'random.randint', 'randint', (['(1)', '(6)'], {}), '(1, 6)\n', (433, 439), False, 'from random import randint\n'), ((657, 670), 'random.randint', 'randint', (['(1)', '(6)'], {}), '(1, 6)\n', (664, 670), False, 'from random import randint\n'), ((2021, 2065), 'numpy.unique', 'np.unique', (['current_throw'],... |
import argparse
import os
import traceback
import glob2
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from SRL4RL.utils.utils import give_name, loadConfig, str2bool
matplotlib.use("Agg")
def moving_avg_curve(x, kernel_size=2):
return np.convolve(x, np.ones(kernel_si... | [
"argparse.ArgumentParser",
"numpy.nanmedian",
"matplotlib.pyplot.margins",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"SRL4RL.utils.utils.loadConfig",
"matplotlib.pyplot.fill_between",
"os.path.join",
"traceback.print_exc",
"numpy.std",
"matplotlib.pyplot.close",... | [((213, 234), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (227, 234), False, 'import matplotlib\n'), ((1163, 1188), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1186, 1188), False, 'import argparse\n'), ((1132, 1151), 'numpy.array', 'np.array', (['padded_xs'], {}), ... |
import numpy as np
class Car:
"""
This Class models the movements and relevant information of the DeepRacer car.
You are not meant to interact directly with objects of this type, but rather it is
used by the DeepRacerEnv
"""
def __init__(s, x, y, view_angle, fps, direction=0):
s.x = x #... | [
"numpy.roll",
"numpy.sin",
"numpy.array",
"numpy.random.normal",
"numpy.sign",
"numpy.random.rand",
"numpy.cos"
] | [((3510, 3547), 'numpy.random.normal', 'np.random.normal', (['(val + bias)', 'std_dev'], {}), '(val + bias, std_dev)\n', (3526, 3547), True, 'import numpy as np\n'), ((578, 618), 'numpy.array', 'np.array', (['([[x, y]] * 6)'], {'dtype': 'np.float32'}), '([[x, y]] * 6, dtype=np.float32)\n', (586, 618), True, 'import num... |
#!/usr/bin/env python3
import gym
import json
import rospy
import rospkg
import numpy as np
from gym import utils, spaces
from gym.utils import seeding
from std_srvs.srv import Empty
from nav_msgs.msg import Odometry
from sensor_msgs.msg import LaserScan
from gazebo_msgs.msg import ModelStates, LinkStates
from obser... | [
"navigator.Navigator",
"rospy.ServiceProxy",
"numpy.isnan",
"gym.utils.seeding.np_random",
"envs.mainEnv.MainEnv.__init__",
"math.modf",
"rospy.wait_for_service",
"numpy.asarray",
"numpy.square",
"observer.Observer",
"numpy.isinf",
"json.load",
"numpy.flip",
"rospy.wait_for_message",
"ro... | [((506, 522), 'rospkg.RosPack', 'rospkg.RosPack', ([], {}), '()\n', (520, 522), False, 'import rospkg\n'), ((582, 638), 'envs.mainEnv.MainEnv.__init__', 'MainEnv.__init__', (['self', 'ros_path', '"""deepPusher-v0.launch"""'], {}), "(self, ros_path, 'deepPusher-v0.launch')\n", (598, 638), False, 'from envs.mainEnv impor... |
import numpy as np
def create_sfactor(wrange, s, omega, eps0, mu0, Nw, Nw_pml):
## Input Parameters
# wrange: [wmin wmax], range of domain in w-direction including PML
# s: 'b' or 'f', indicating whether s-factor is for Dwb or Dwf
# omega: angular frequency
# eps0: vacuum permittivity
# mu0: va... | [
"numpy.diff",
"numpy.ones",
"numpy.sqrt"
] | [((533, 552), 'numpy.sqrt', 'np.sqrt', (['(mu0 / eps0)'], {}), '(mu0 / eps0)\n', (540, 552), True, 'import numpy as np\n'), ((1009, 1040), 'numpy.ones', 'np.ones', (['(Nw, 1)'], {'dtype': 'complex'}), '((Nw, 1), dtype=complex)\n', (1016, 1040), True, 'import numpy as np\n'), ((724, 739), 'numpy.diff', 'np.diff', (['wra... |
import boto3
import numpy as np
import tensorflow as tf
import os.path
import re
from urllib.request import urlretrieve
import json
from io import BytesIO
from time import perf_counter
SESSION = None
strBucket = 'serverlessdeeplearning'
def handler(event, context):
global strBucket
if not os.path.exists('/tmp... | [
"tensorflow.gfile.FastGFile",
"io.BytesIO",
"boto3.client",
"numpy.std",
"tensorflow.GraphDef",
"time.perf_counter",
"tensorflow.get_default_graph",
"numpy.mean",
"tensorflow.InteractiveSession",
"tensorflow.import_graph_def"
] | [((1355, 1373), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (1367, 1373), False, 'import boto3\n'), ((1480, 1498), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (1492, 1498), False, 'import boto3\n'), ((1680, 1698), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (1... |
import unittest
import numpy
from chainer import functions
from chainer import testing
def _repeat(arr, repeats, axis=None):
# Workaround NumPy 1.9 issue.
if isinstance(repeats, tuple) and len(repeats) == 1:
repeats = repeats[0]
return numpy.repeat(arr, repeats, axis)
@testing.parameterize(*te... | [
"numpy.random.uniform",
"chainer.testing.product",
"chainer.functions.repeat",
"chainer.testing.run_module",
"numpy.repeat"
] | [((3616, 3654), 'chainer.testing.run_module', 'testing.run_module', (['__name__', '__file__'], {}), '(__name__, __file__)\n', (3634, 3654), False, 'from chainer import testing\n'), ((260, 292), 'numpy.repeat', 'numpy.repeat', (['arr', 'repeats', 'axis'], {}), '(arr, repeats, axis)\n', (272, 292), False, 'import numpy\n... |
# -*- coding: utf-8 -*-
import json
import matplotlib.pyplot as plt
import sys
import numpy as np
from matplotlib import ticker, cm
class Problem:
def __init__(self, filepath):
with open(filepath, 'r') as fin:
js = json.load(fin)
self.hole_vertices = js['hole']
self.fi... | [
"matplotlib.pyplot.clabel",
"json.load",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.contour",
"matplotlib.pyplot.cla",
"numpy.linspace",
"matplotlib.pyplot.savefig"
] | [((2012, 2048), 'numpy.linspace', 'np.linspace', (['xrange[0]', 'xrange[1]', 'n'], {}), '(xrange[0], xrange[1], n)\n', (2023, 2048), True, 'import numpy as np\n'), ((2062, 2098), 'numpy.linspace', 'np.linspace', (['yrange[0]', 'yrange[1]', 'n'], {}), '(yrange[0], yrange[1], n)\n', (2073, 2098), True, 'import numpy as n... |
import timeit
import numpy as np
import tensorflow as tf
from tensorflow.keras.utils import custom_object_scope
from tensorflow.python.framework import test_util
import dynastes as d
from dynastes.layers.t2t_attention_layers import Attention1D, Attention2D, PseudoBlockSparseAttention1D
from dynastes.probability.pseud... | [
"tensorflow.test.main",
"tensorflow.config.optimizer.set_jit",
"numpy.zeros_like",
"dynastes.probability.pseudoblocksparse_bijectors.BlockSparseStridedRoll1D",
"dynastes.layers.t2t_attention_layers.Attention1D",
"dynastes.layers.t2t_attention_layers.Attention2D",
"tensorflow.tile",
"timeit.timeit",
... | [((465, 502), 'tensorflow.test.compute_gradient', 'tf.test.compute_gradient', (['func', 'input'], {}), '(func, input)\n', (489, 502), True, 'import tensorflow as tf\n'), ((11999, 12032), 'tensorflow.config.optimizer.set_jit', 'tf.config.optimizer.set_jit', (['(True)'], {}), '(True)\n', (12026, 12032), True, 'import ten... |
import time
import os
import ray
import numpy as np
from contextlib import contextmanager
# Only run tests matching this filter pattern.
filter_pattern = os.environ.get("TESTS_TO_RUN", "")
def timeit(name, fn, multiplier=1):
if filter_pattern not in name:
return
# warmup
start = time.time()
... | [
"ray.init",
"numpy.std",
"time.time",
"os.environ.get",
"numpy.mean",
"ray.shutdown"
] | [((156, 190), 'os.environ.get', 'os.environ.get', (['"""TESTS_TO_RUN"""', '""""""'], {}), "('TESTS_TO_RUN', '')\n", (170, 190), False, 'import os\n'), ((304, 315), 'time.time', 'time.time', ([], {}), '()\n', (313, 315), False, 'import time\n'), ((785, 806), 'ray.init', 'ray.init', ([], {}), '(**init_args)\n', (793, 806... |
# -*- coding: utf-8 -*-
"""
INTRO
<NAME> (C)
Created on Sat May 4 14:12:47 2019
Aerodynamics, AE
TU Delft
"""
import numpy as np
from screws.freeze.main import FrozenOnly
from scipy.sparse import csr_matrix
class TraceMatrix(FrozenOnly):
"""
This is the trace matrix.
The trace matrix will select fr... | [
"scipy.sparse.csr_matrix",
"numpy.zeros",
"numpy.arange",
"numpy.vstack"
] | [((1457, 1560), 'numpy.zeros', 'np.zeros', (['(self._FS_.num_basis._3dCSCG_0Form[0], self._FS_.num_basis._3dCSCG_0Trace[0])'], {'dtype': 'int'}), '((self._FS_.num_basis._3dCSCG_0Form[0], self._FS_.num_basis.\n _3dCSCG_0Trace[0]), dtype=int)\n', (1465, 1560), True, 'import numpy as np\n'), ((2949, 2985), 'numpy.zeros... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 30 03:05:08 2021
@author: dv516
"""
import nlopt
import numpy as np
import functools
import warnings
# from test_functions import rosenbrock_constrained
# def Problem_rosenbrock_test(x, grad):
# f1 = rosenbrock_constrained.rosenbrock_f
# g1 = rosenbrock_constra... | [
"functools.partial",
"numpy.zeros",
"numpy.maximum"
] | [((1304, 1319), 'numpy.zeros', 'np.zeros', (['n_con'], {}), '(n_con)\n', (1312, 1319), True, 'import numpy as np\n'), ((1921, 1988), 'functools.partial', 'functools.partial', (['self.create_quadratic_penalized_objective', 'mu', '(2)'], {}), '(self.create_quadratic_penalized_objective, mu, 2)\n', (1938, 1988), False, 'i... |
#Importing Libraries
import numpy as np
import pandas as pd
import talib
#Setting the random seed to a fixed number
import random
random.seed(42)
#Importing the dataset
dataset = pd.read_csv('RELIANCE.NS.csv')
dataset = dataset.dropna()
dataset = dataset[['Open', 'High', 'Low', 'Close']]
#Preparing the dataset
dat... | [
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"talib.WILLR",
"pandas.read_csv",
"matplotlib.pyplot.legend",
"numpy.cumsum",
"matplotlib.pyplot.figure",
"numpy.where",
"random.seed",
"talib.RSI",
"keras.layers.Dense",
"keras.models.Sequential"
] | [((133, 148), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (144, 148), False, 'import random\n'), ((183, 213), 'pandas.read_csv', 'pd.read_csv', (['"""RELIANCE.NS.csv"""'], {}), "('RELIANCE.NS.csv')\n", (194, 213), True, 'import pandas as pd\n'), ((716, 764), 'talib.RSI', 'talib.RSI', (["dataset['Close'].val... |
"""Design Matrix Constructor Functions
This file contains the classes
This file can also be imported as a module and contains the following
classes:
* Equation
"""
# TODO: Consider making a param maps super class and have param map be a
# subclass that returns a Equation class when they're added together.
# Al... | [
"numpy.indices",
"copy.deepcopy",
"numpy.array",
"numpy.unique"
] | [((3479, 3506), 'numpy.array', 'np.array', (['[sign]'], {'dtype': 'int'}), '([sign], dtype=int)\n', (3487, 3506), True, 'import numpy as np\n'), ((9394, 9412), 'copy.deepcopy', 'deepcopy', (['PMAP_RAW'], {}), '(PMAP_RAW)\n', (9402, 9412), False, 'from copy import deepcopy\n'), ((1974, 1992), 'copy.deepcopy', 'deepcopy'... |
# -*- coding: utf-8 -*-
from typing import Iterator, Tuple, Optional, List
import math
import numpy as np
import scipy.special
def partitioning(collection: List[int],
cardinality: Optional[int] = None,
n_sample: Optional[int] = None,
lowerbound: int = 1,
... | [
"numpy.split",
"math.factorial",
"numpy.random.shuffle",
"numpy.random.choice"
] | [((3375, 3404), 'numpy.random.shuffle', 'np.random.shuffle', (['collection'], {}), '(collection)\n', (3392, 3404), True, 'import numpy as np\n'), ((6034, 6063), 'numpy.random.shuffle', 'np.random.shuffle', (['collection'], {}), '(collection)\n', (6051, 6063), True, 'import numpy as np\n'), ((3437, 3514), 'numpy.random.... |
import numpy as np
from scipy.stats import norm
def simulate_paths(drift, vola, price_0, nr_steps, nr_paths):
zs = norm.ppf(np.random.rand(nr_steps, nr_paths))
daily_returns = np.exp(drift + vola * zs)
price_paths = np.zeros_like(daily_returns)
price_paths[0] = price_0
for t in range(1, nr_steps)... | [
"numpy.zeros_like",
"pstats.Stats",
"numpy.exp",
"timeit.timeit",
"numpy.random.rand",
"cProfile.run"
] | [((187, 212), 'numpy.exp', 'np.exp', (['(drift + vola * zs)'], {}), '(drift + vola * zs)\n', (193, 212), True, 'import numpy as np\n'), ((231, 259), 'numpy.zeros_like', 'np.zeros_like', (['daily_returns'], {}), '(daily_returns)\n', (244, 259), True, 'import numpy as np\n'), ((783, 822), 'cProfile.run', 'cProfile.run', ... |
'''
Data loader for sinusoid regression
But with complex noise distribution
Note, this is very similar to data.py
Keeping in a separate file to avoid inducing any issues in other code
'''
import numpy as np
import pandas as pd
from math import pi as PI
import random
# !pip3 install higher
import torch
import random
... | [
"numpy.random.seed",
"random.uniform",
"torch.manual_seed",
"numpy.sin",
"random.seed",
"torch.Tensor",
"numpy.random.normal",
"numpy.random.choice"
] | [((370, 390), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (387, 390), False, 'import torch\n'), ((391, 405), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (402, 405), False, 'import random\n'), ((406, 423), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (420, 423), True, 'i... |
import numpy as np
class Shooting(object):
def __init__(self):
return None
def shoot(self, n_team_blue, n_team_red, distance, type):
if type == 'red':
loc = n_team_red / n_team_blue
else:
loc = n_team_blue / n_team_red
p = np.random.normal(loc / distanc... | [
"numpy.random.normal"
] | [((290, 339), 'numpy.random.normal', 'np.random.normal', (['(loc / distance ** 2)'], {'scale': '(0.75)'}), '(loc / distance ** 2, scale=0.75)\n', (306, 339), True, 'import numpy as np\n')] |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"argparse.ArgumentParser",
"mindspore.train.callback.ModelCheckpoint",
"os.path.isfile",
"mindspore.Parameter",
"mindspore.train.serialization.load_checkpoint",
"src.model_utils.moxing_adapter.moxing_wrapper",
"mindspore.train.callback.SummaryCollector",
"os.path.join",
"src.dataset.create_dataset",... | [((1462, 1521), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""video classification"""'}), "(description='video classification')\n", (1485, 1521), False, 'import argparse\n'), ((2156, 2167), 'mindspore.common.set_seed', 'set_seed', (['(1)'], {}), '(1)\n', (2164, 2167), False, 'from minds... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import os
import tempfile
import numpy as np
import PIL.Image
from dense_deep_event_stereo import dataset_constants
MOCKUP_MVSEC_STEREO_NUMBER_OF_EXAMPLES = 10
MOCKUP_MVSEC_STEREO_EXPERIMENT_NAME = 'indoor... | [
"numpy.full",
"numpy.random.uniform",
"numpy.stack",
"numpy.save",
"numpy.random.seed",
"numpy.copy",
"dense_deep_event_stereo.dataset_constants.create_folders",
"dense_deep_event_stereo.dataset_constants.experiment_paths",
"numpy.clip",
"numpy.savez_compressed",
"numpy.random.randint",
"tempf... | [((785, 860), 'numpy.random.uniform', 'np.random.uniform', (['start_timestamp', 'finish_timestamp'], {'size': 'number_of_events'}), '(start_timestamp, finish_timestamp, size=number_of_events)\n', (802, 860), True, 'import numpy as np\n'), ((1700, 1727), 'numpy.copy', 'np.copy', (['left_camera_events'], {}), '(left_came... |
import sys
import numpy as np
def bayes_theorem(P_B_A, P_A, P_B_nA):
"""An implementation of Bayes theorem.
Evaluate the probability of event $A$ given that $B$ is true.
Parameters
----------
P_B_A : array_like
the likelihood of event $B$ occurring given that $A$ is true.
P_A : array_... | [
"numpy.array"
] | [((2352, 2367), 'numpy.array', 'np.array', (['P_B_A'], {}), '(P_B_A)\n', (2360, 2367), True, 'import numpy as np\n'), ((2369, 2382), 'numpy.array', 'np.array', (['P_A'], {}), '(P_A)\n', (2377, 2382), True, 'import numpy as np\n'), ((2384, 2400), 'numpy.array', 'np.array', (['P_B_nA'], {}), '(P_B_nA)\n', (2392, 2400), T... |
from flask import Flask, request, render_template
import tensorflow as tf
import tensorflow_hub as hub
import numpy as np
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.image import load_img, img_to_array
app = Flask(__name__)
MODEL_PATH ='Mushroom_Model.h5'
model = tf.... | [
"tensorflow.keras.models.load_model",
"tensorflow.keras.preprocessing.image.img_to_array",
"flask.Flask",
"numpy.expand_dims",
"tensorflow.keras.preprocessing.image.load_img",
"flask.render_template"
] | [((257, 272), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (262, 272), False, 'from flask import Flask, request, render_template\n'), ((317, 407), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['MODEL_PATH'], {'custom_objects': "{'KerasLayer': hub.KerasLayer}"}), "(MODEL_PATH, cust... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Date : Sep-06-20 12:31
# @Author : <NAME> (<EMAIL>)
# @Link : http://example.org
import os
import datetime
import numpy as np
import tensorflow as tf
from tensorflow import keras # keras-tf
from tensorflow.keras.preprocessing.image import ImageDataGenerator
fro... | [
"numpy.load",
"resnet.resnet_v2",
"os.path.join",
"tensorflow.keras.applications.ResNet50V2",
"numpy.expand_dims",
"datetime.datetime.now",
"tensorflow.keras.utils.plot_model",
"numpy.max",
"tensorflow.keras.optimizers.Adam",
"numpy.eye",
"tensorflow.keras.callbacks.TensorBoard",
"tensorflow.k... | [((1162, 1185), 'resnet.model_depth', 'model_depth', (['n', 'version'], {}), '(n, version)\n', (1173, 1185), False, 'from resnet import model_depth, resnet_v2, lr_schedule\n'), ((1284, 1316), 'numpy.expand_dims', 'np.expand_dims', (['train_images', '(-1)'], {}), '(train_images, -1)\n', (1298, 1316), True, 'import numpy... |
import numpy as np
import cv2
class dataCreate:
'''
use this class to read data and to create test data.
selectedLabel needs to input labels which is selected as training target;
joints is setted as Kinect skeleton joints as default.
'''
def __init__(self,n_steps=30,joints=20):
self.n_s... | [
"numpy.load",
"numpy.zeros",
"numpy.append",
"numpy.array",
"numpy.reshape",
"preprocess.preprocessing",
"numpy.random.permutation",
"numpy.savez",
"numpy.delete",
"cv2.resize"
] | [((5808, 5947), 'numpy.savez', 'np.savez', (['"""LSTM_Train/data.npz"""'], {'skeleton': 'test.skeleton', 'label': 'test.label', 'test_skeleton': 'test.test_skeleton', 'test_label': 'test.test_label'}), "('LSTM_Train/data.npz', skeleton=test.skeleton, label=test.label,\n test_skeleton=test.test_skeleton, test_label=t... |
import numpy as np
from keras_applications.imagenet_utils import _obtain_input_shape
import tensorflow as tf
__TF_VERSION__ = int(tf.__version__.split(".")[0])
if __TF_VERSION__ < 2:
from tensorflow.python.keras import backend as K
else:
from tensorflow.keras import backend as K
VGG16_WEIGHTS_PATH = 'https:... | [
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.MaxPooling2D",
"numpy.copy",
"tensorflow.keras.layers.Dense",
"tensorflow.__version__.split",
"tensorflow.keras.Model",
"tensorflow.keras.utils.get_source_inputs",
"tensorflow.keras.backend.is_keras_tensor",
"tensorflow.keras.layers.Input",
... | [((754, 764), 'numpy.copy', 'np.copy', (['x'], {}), '(x)\n', (761, 764), True, 'import numpy as np\n'), ((2148, 2211), 'tensorflow.numpy_function', 'tf.numpy_function', (['preprocess_input', '[input_tensor]', 'tf.float32'], {}), '(preprocess_input, [input_tensor], tf.float32)\n', (2165, 2211), True, 'import tensorflow ... |
import pytesseract
from lxml import etree
import cv2
import numpy as np
imgTemp = cv2.imread('image1.bmp') # image file name
# for better accurancy, its better to have a light threshold first
gray_image = cv2.cvtColor(imgTemp , cv2.COLOR_BGR2GRAY)
blur_image = cv2.blur(gray_image , (5,5))
_,imgHOCR = cv2.threshold(b... | [
"lxml.etree.fromstring",
"cv2.cvtColor",
"cv2.imwrite",
"cv2.threshold",
"pytesseract.pytesseract.image_to_pdf_or_hocr",
"cv2.blur",
"cv2.imread",
"numpy.mean",
"cv2.rectangle"
] | [((84, 108), 'cv2.imread', 'cv2.imread', (['"""image1.bmp"""'], {}), "('image1.bmp')\n", (94, 108), False, 'import cv2\n'), ((208, 249), 'cv2.cvtColor', 'cv2.cvtColor', (['imgTemp', 'cv2.COLOR_BGR2GRAY'], {}), '(imgTemp, cv2.COLOR_BGR2GRAY)\n', (220, 249), False, 'import cv2\n'), ((264, 292), 'cv2.blur', 'cv2.blur', ([... |
# Copyright 2018 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | [
"io.BytesIO",
"copy.deepcopy",
"json.loads",
"copy.copy",
"mlrun.get_object",
"numpy.core.fromnumeric.mean",
"datetime.datetime.now",
"concurrent.futures.as_completed"
] | [((13248, 13262), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (13260, 13262), False, 'from datetime import datetime\n'), ((11183, 11200), 'numpy.core.fromnumeric.mean', 'mean', (['predictions'], {}), '(predictions)\n', (11187, 11200), False, 'from numpy.core.fromnumeric import mean\n'), ((12805, 12827), ... |
# lrg_omics.proteomics.analysis.maxquant
import pandas as pd
import numpy as np
from os.path import isfile
def get_maxquant_txt(path, txt="proteinGroups.txt", raw_file=None):
"""
Graps a MaxQuant txt based on the name of the
.RAW file and the name of the pipeline. raw_file
and pipename are added to ... | [
"pandas.DataFrame",
"numpy.log2",
"os.path.isfile",
"pandas.read_table",
"pandas.concat"
] | [((424, 441), 'os.path.isfile', 'isfile', (['full_path'], {}), '(full_path)\n', (430, 441), False, 'from os.path import isfile\n'), ((1119, 1133), 'numpy.log2', 'np.log2', (['(x + 1)'], {}), '(x + 1)\n', (1126, 1133), True, 'import numpy as np\n'), ((4263, 4308), 'pandas.concat', 'pd.concat', (['[data, reporter_intensi... |
import numpy as np
from starter_code.infrastructure.log import create_logdir
class TaskNode(object):
def __init__(self, task_name, parents=None):
self.task_name
self.parents = parents # a list of TaskNodes
class TaskDistribution(object):
"""
Contains a set of K environment managers
... | [
"numpy.random.choice"
] | [((1558, 1601), 'numpy.random.choice', 'np.random.choice', (['self.environment_managers'], {}), '(self.environment_managers)\n', (1574, 1601), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
import math
import numpy as np
import matplotlib.pyplot as plt
def quat2mat(q):
''' Calculate rotation matrix corresponding to quaternion
https://afni.nimh.nih.gov/pub/dist/src/pkundu/meica.libs/nibabel/quaternions.py
Parameters
----------
q :... | [
"matplotlib.pyplot.show",
"numpy.sum",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"numpy.zeros",
"numpy.array",
"numpy.linalg.inv",
"numpy.dot",
"numpy.eye",
"numpy.concatenate"
] | [((1313, 1439), 'numpy.array', 'np.array', (['[[1.0 - (yY + zZ), xY - wZ, xZ + wY], [xY + wZ, 1.0 - (xX + zZ), yZ + wX],\n [xZ - wY, yZ + wX, 1.0 - (xX + yY)]]'], {}), '([[1.0 - (yY + zZ), xY - wZ, xZ + wY], [xY + wZ, 1.0 - (xX + zZ), \n yZ + wX], [xZ - wY, yZ + wX, 1.0 - (xX + yY)]])\n', (1321, 1439), True, 'imp... |
"""
script used for testing features during development
don't actually use this for anything else
"""
import numpy
import math
import sys
import numpy as np
import utils.model as model
import matplotlib.pyplot as plt
test_fitting = False
if test_fitting:
test_model = model.line() + model.gaus([None,[5,7],None])
t... | [
"numpy.ones",
"utils.model.constant",
"utils.model.powc",
"utils.model.exponential",
"numpy.random.poisson",
"numpy.linspace",
"matplotlib.pyplot.errorbar",
"utils.model.line",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"utils.model.sqrt",
"utils.model.gaus",
"utils.model.powerlaw... | [((5760, 5771), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (5768, 5771), False, 'import sys\n'), ((357, 380), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(250)'], {}), '(0, 10, 250)\n', (368, 380), True, 'import numpy as np\n'), ((474, 498), 'numpy.random.poisson', 'np.random.poisson', (['ytrue'], {}), '(yt... |
#!/usr/bin/env python3
#
# PrepareDataMain.py
#
# Prepare the data from Github and produce the csv files for other apps
#
from datetime import datetime
from dateutil.relativedelta import relativedelta
from dateutil import parser
from geopy.geocoders import Nominatim
import os
import logging
import numpy as np
import p... | [
"pandas.DataFrame",
"logging.error",
"pandas.read_csv",
"numpy.datetime_as_string",
"logging.info",
"C19CollectDataMain.file_index_entry",
"os.path.join"
] | [((880, 921), 'logging.info', 'logging.info', (['"""Processing country rollup"""'], {}), "('Processing country rollup')\n", (892, 921), False, 'import logging\n'), ((1009, 1034), 'pandas.read_csv', 'pd.read_csv', (['cd.WORLD_POP'], {}), '(cd.WORLD_POP)\n', (1020, 1034), True, 'import pandas as pd\n'), ((2812, 2956), 'p... |
import unittest
import tempfile
import os
from ftl import FTLStreamWriter
from ftl.types import Channel, Camera, FTLException
import numpy as np
class TestStreamWriter(unittest.TestCase):
def test_create_and_delete_file(self):
""" Test constructor and destructor """
f = tempfile.NamedTemporaryF... | [
"unittest.main",
"tempfile.NamedTemporaryFile",
"ftl.FTLStreamWriter",
"ftl.types.Camera",
"numpy.random.rand"
] | [((2014, 2029), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2027, 2029), False, 'import unittest\n'), ((296, 338), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'suffix': '""".ftl"""'}), "(suffix='.ftl')\n", (323, 338), False, 'import tempfile\n'), ((356, 379), 'ftl.FTLStreamWriter', 'FTL... |
# -*- coding: utf-8 -*-
import numpy as np
from .base import Resampler
from ..types.numeric import Probability
from ..types.particle import Particle, RaoBlackwellisedParticle, MultiModelParticle
class SystematicResampler(Resampler):
def resample(self, particles):
"""Resample the particles
Param... | [
"numpy.random.uniform",
"numpy.cumsum",
"numpy.argmax"
] | [((686, 726), 'numpy.cumsum', 'np.cumsum', (['[p.weight for p in particles]'], {}), '([p.weight for p in particles])\n', (695, 726), True, 'import numpy as np\n'), ((822, 859), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1 / n_particles)'], {}), '(0, 1 / n_particles)\n', (839, 859), True, 'import numpy as n... |
# coding: utf-8
# # Object Detection Demo
# Welcome to the object detection inference walkthrough! This notebook will walk you step by step through the process of using a pre-trained model to detect objects in an image. Make sure to follow the [installation instructions](https://github.com/tensorflow/models/blob/mas... | [
"cv2.waitKey",
"object_detection.utils.label_map_util.create_category_index",
"object_detection.utils.label_map_util.convert_label_map_to_categories",
"numpy.zeros",
"PIL.Image.open",
"numpy.expand_dims",
"tensorflow.compat.v1.Session",
"cv2.imshow",
"time.sleep",
"PIL.Image.fromarray",
"tensorf... | [((1439, 1485), 'os.path.join', 'os.path.join', (['"""annotations"""', '"""label_map.pbtxt"""'], {}), "('annotations', 'label_map.pbtxt')\n", (1451, 1485), False, 'import os\n'), ((1598, 1608), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (1606, 1608), True, 'import tensorflow as tf\n'), ((2199, 2243), 'object_det... |
import argparse
import sys
from pathlib import Path
from typing import Any
from typing import Dict
from typing import List
import numpy as np
import torch
from utils.results import load_results
parser = argparse.ArgumentParser(
description="Fuse results from multiple modalities",
formatter_class=argparse.Argu... | [
"numpy.stack",
"utils.results.load_results",
"argparse.ArgumentParser",
"numpy.argsort",
"sys.exit"
] | [((205, 341), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Fuse results from multiple modalities"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Fuse results from multiple modalities',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import os, time, shutil, sys, re, subprocess
##############################################################################################################
##DO NOT change this part.
##../setup.py will update this variable
HTC_package_path = "C:/Users/tyang/Documents/... | [
"os.mkdir",
"numpy.abs",
"HTC_lib.VASP.Miscellaneous.Query_from_OUTCAR.find_incar_tag_from_OUTCAR",
"os.path.isfile",
"numpy.mean",
"os.path.join",
"sys.path.append",
"HTC_lib.VASP.INCAR.Write_VASP_INCAR.get_bader_charge_tags",
"shutil.copyfile",
"HTC_lib.VASP.INCAR.modify_vasp_incar.modify_vasp_i... | [((359, 390), 'os.path.isdir', 'os.path.isdir', (['HTC_package_path'], {}), '(HTC_package_path)\n', (372, 390), False, 'import os, time, shutil, sys, re, subprocess\n'), ((503, 536), 'sys.path.append', 'sys.path.append', (['HTC_package_path'], {}), '(HTC_package_path)\n', (518, 536), False, 'import os, time, shutil, sy... |
from __future__ import division
from openmdao.api import ExplicitComponent
import numpy as np
class LinearInterpolator(ExplicitComponent):
'''
Create a linearly interpolated set of points **including** two end points
Inputs
------
start_val : float
Starting value (scalar; units set from "... | [
"numpy.zeros",
"numpy.arange",
"numpy.linspace"
] | [((1170, 1186), 'numpy.arange', 'np.arange', (['(0)', 'nn'], {}), '(0, nn)\n', (1179, 1186), True, 'import numpy as np\n'), ((1285, 1297), 'numpy.zeros', 'np.zeros', (['nn'], {}), '(nn)\n', (1293, 1297), True, 'import numpy as np\n'), ((1303, 1324), 'numpy.linspace', 'np.linspace', (['(1)', '(0)', 'nn'], {}), '(1, 0, n... |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.style.use("ggplot")
import numpy as np
class SmoothPlot():
def __init__(self, smooth_rate=0, linewidth=1.0):
self.smooth_rate = smooth_rate
self.linewidth = linewidth
self.colors = ['r', 'b', 'c', 'g', 'm', 'y', '... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.style.use",
"matplotlib.use",
"matplotlib.pyplot.cla",
"numpy.mean",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((72, 95), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (85, 95), True, 'import matplotlib.pyplot as plt\n'), ((831, 852), 'matplotlib.pyplot.xlabel', 'pl... |
import numpy as np
import os
import sys
import math
import time
import random
import datetime
import pickle
from keras.utils.generic_utils import Progbar
from PIL import Image
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf
import keras
from keras import backend as K
from keras.data... | [
"pickle.dump",
"keras.datasets.cifar10.load_data",
"argparse.ArgumentParser",
"os.makedirs",
"numpy.ceil",
"random.shuffle",
"os.path.exists",
"math.floor",
"numpy.mean",
"numpy.array",
"os.path.join"
] | [((760, 785), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (783, 785), False, 'import argparse\n'), ((1323, 1356), 'os.path.join', 'os.path.join', (['output_dir', '"""train"""'], {}), "(output_dir, 'train')\n", (1335, 1356), False, 'import os\n'), ((1379, 1410), 'os.path.join', 'os.path.join'... |
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path
def find_neighborhood(e, edges):
neighborhood = []
for _e_a, _e_b in edges:
if _e_a == e:
neighborhood.append(_e_b)
if _e_b == e:
neighborhood.append(_e_a)... | [
"numpy.array",
"numpy.ones",
"scipy.sparse.csgraph.shortest_path"
] | [((712, 739), 'scipy.sparse.csgraph.shortest_path', 'shortest_path', (['A'], {'indices': 'e'}), '(A, indices=e)\n', (725, 739), False, 'from scipy.sparse.csgraph import shortest_path\n'), ((844, 859), 'numpy.array', 'np.array', (['edges'], {}), '(edges)\n', (852, 859), True, 'import numpy as np\n'), ((593, 616), 'numpy... |
"""
Tests for dit.math.ops.
"""
from __future__ import division
from nose.tools import assert_almost_equal, assert_raises, assert_true
import numpy as np
import numpy.testing as npt
from dit.exceptions import InvalidBase
from dit.math.ops import (
get_ops, LinearOperations, LogOperations, exp_func, log_func
)
... | [
"numpy.cumprod",
"dit.math.ops.get_ops",
"numpy.log2",
"numpy.ones",
"dit.math.ops.LinearOperations",
"numpy.array",
"numpy.arange",
"dit.math.ops.LogOperations",
"nose.tools.assert_raises",
"numpy.testing.assert_allclose"
] | [((5695, 5713), 'dit.math.ops.LogOperations', 'LogOperations', (['(0.5)'], {}), '(0.5)\n', (5708, 5713), False, 'from dit.math.ops import get_ops, LinearOperations, LogOperations, exp_func, log_func\n'), ((5948, 5964), 'dit.math.ops.LogOperations', 'LogOperations', (['(2)'], {}), '(2)\n', (5961, 5964), False, 'from dit... |
import matplotlib.pyplot as plt
from Liver_Kits import mhd_reader
from glob import glob
import os.path as osp
import cv2
import re
import numpy as np
import skimage.measure as measure
def show_a_pred(image, mask, pred, save_path=None, contour=True, mask_thresh=-500, alpha=0.3):
fig = plt.figure()
fig.set_size_... | [
"numpy.clip",
"matplotlib.pyplot.figure",
"numpy.mean",
"skimage.measure.find_contours",
"matplotlib.pyplot.imread",
"os.path.join",
"numpy.std",
"matplotlib.pyplot.close",
"Liver_Kits.mhd_reader",
"matplotlib.pyplot.imshow",
"os.path.dirname",
"numpy.linspace",
"matplotlib.pyplot.Axes",
"... | [((290, 302), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (300, 302), True, 'import matplotlib.pyplot as plt\n'), ((1814, 1825), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (1823, 1825), True, 'import matplotlib.pyplot as plt\n'), ((3794, 3834), 're.compile', 're.compile', (['"""batch Dice... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
###############################################################################
# TicTacToe.py
#
# Revision: 1.00
# Date: 11/07/2020
# Author: Alex
#
# Purpose: Contains all functions necessary to implement the Tic-Tac-Toe
# game e... | [
"copy.deepcopy",
"numpy.sum",
"numpy.zeros",
"numpy.fliplr",
"numpy.max",
"numpy.where",
"tabulate.tabulate"
] | [((996, 1028), 'numpy.zeros', 'np.zeros', (['(3, 3, 3)'], {'dtype': 'float'}), '((3, 3, 3), dtype=float)\n', (1004, 1028), True, 'import numpy as np\n'), ((2476, 2496), 'numpy.where', 'np.where', (['(board == 0)'], {}), '(board == 0)\n', (2484, 2496), True, 'import numpy as np\n'), ((3761, 3788), 'numpy.sum', 'np.sum',... |
""" Functions in this file calculate the Biot-Savart equation. """
import vector_field as VectorField
import numpy as np
from numpy import linalg
def _dB_calc(J_field, x, y, z):
""" Calcualtes the magnetic field at a point due to a current.
Args:
J_field (VectorField): Vector field describing the current
th... | [
"numpy.cross",
"vector_field.VectorField",
"numpy.linalg.norm",
"numpy.arange",
"numpy.add"
] | [((1685, 1730), 'numpy.arange', 'np.arange', (['bound.min_x', 'bound.max_x', 'res.step'], {}), '(bound.min_x, bound.max_x, res.step)\n', (1694, 1730), True, 'import numpy as np\n'), ((2092, 2133), 'vector_field.VectorField', 'VectorField.VectorField', (['x', 'y', 'z', 'u', 'v', 'w'], {}), '(x, y, z, u, v, w)\n', (2115,... |
import os
import shutil
import unittest
import filecmp
import numpy as np
from ont_fast5_api.helpers import compare_hdf_files
from ont_fast5_api.fast5_writer import Fast5Writer
test_data = os.path.join(os.path.dirname(__file__), 'data')
save_path = os.path.join(os.path.dirname(__file__), 'tmp')
class TestFast5Writer... | [
"ont_fast5_api.fast5_writer.Fast5Writer",
"os.makedirs",
"os.path.dirname",
"numpy.zeros",
"os.path.exists",
"shutil.rmtree",
"os.path.join"
] | [((203, 228), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (218, 228), False, 'import os\n'), ((263, 288), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (278, 288), False, 'import os\n'), ((536, 561), 'shutil.rmtree', 'shutil.rmtree', (['self._path'], {}), '(self... |
from scipy.linalg import eigh_tridiagonal
from six import iteritems
import numpy as _np
from ._lanczos_utils import _get_first_lv
__all__ = ["FTLM_static_iteration"]
def FTLM_static_iteration(O_dict,E,V,Q_T,beta=0):
"""Calculate iteration for Finite-Temperature Lanczos method.
Here we give a brief overview of th... | [
"numpy.einsum",
"numpy.zeros",
"numpy.vdot",
"numpy.squeeze",
"numpy.atleast_1d",
"six.iteritems"
] | [((5118, 5162), 'numpy.einsum', '_np.einsum', (['"""j,aj,...j->a..."""', 'V[0, :]', 'V', 'p'], {}), "('j,aj,...j->a...', V[0, :], V, p)\n", (5128, 5162), True, 'import numpy as _np\n'), ((5735, 5789), 'numpy.einsum', '_np.einsum', (['"""i,j,i...->ij..."""', 'V_l[0, :]', 'V_r[0, :]', 'p'], {}), "('i,j,i...->ij...', V_l[... |
import os
import sys
import numpy as np
DEBUG=1
class base:
def __init__(self, *args, **kwargs) -> None:
self.data=None
self.preprocess=lambda x:x if not kwargs.__contains__("preprocess") else kwargs["preprocess"]
pass
def load_data(self, path:str, *args, **kwargs):
... | [
"numpy.dot",
"numpy.zeros",
"numpy.ones"
] | [((734, 748), 'numpy.zeros', 'np.zeros', (['rank'], {}), '(rank)\n', (742, 748), True, 'import numpy as np\n'), ((787, 800), 'numpy.ones', 'np.ones', (['rank'], {}), '(rank)\n', (794, 800), True, 'import numpy as np\n'), ((934, 951), 'numpy.dot', 'np.dot', (['r', 'self.w'], {}), '(r, self.w)\n', (940, 951), True, 'impo... |
# -*- coding: utf-8 -*-
"""Survival analysis module.
Uses `scikit-survival <https://github.com/sebp/scikit-survival>`_, which can
be installed with ``pip install scikit-survival`` but is imported with
``import sksurv``.
"""
import logging
import os
import numpy as np
import pandas as pd
from sklearn.model_selection... | [
"sklearn.model_selection.GridSearchCV",
"pathway_forte.constants.CLINICAL_DATA.format",
"pandas.read_csv",
"numpy.asarray",
"numpy.dtype",
"sksurv.linear_model.CoxnetSurvivalAnalysis",
"sklearn.model_selection.KFold",
"pathway_forte.constants.NORMAL_EXPRESSION_SAMPLES.format",
"sksurv.metrics.concor... | [((670, 697), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (687, 697), False, 'import logging\n'), ((1279, 1320), 'pandas.read_csv', 'pd.read_csv', (['clinical_data_path'], {'sep': '"""\t"""'}), "(clinical_data_path, sep='\\t')\n", (1290, 1320), True, 'import pandas as pd\n'), ((1344, 1... |
"""data distribution with normal distribution over all the columns of data """
import scipy
import pandas as pd
import numpy as np
import seaborn as sns
import seaborn as sns
import matplotlib.pyplot as plt
data = pd.read_csv('iris.data', names=['Sepal.Length', 'Sepal.Width', 'Petal.Length', 'Petal.Width', 'Species']... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"scipy.stats.distributions.norm.pdf",
"numpy.array",
"scipy.stats.distributions.norm.fit",
"matplotlib.pyplot.subplots"
] | [((216, 325), 'pandas.read_csv', 'pd.read_csv', (['"""iris.data"""'], {'names': "['Sepal.Length', 'Sepal.Width', 'Petal.Length', 'Petal.Width', 'Species']"}), "('iris.data', names=['Sepal.Length', 'Sepal.Width',\n 'Petal.Length', 'Petal.Width', 'Species'])\n", (227, 325), True, 'import pandas as pd\n'), ((720, 734),... |
import pandas as pd
import numpy as np
from cloudservice import get_documenttask, download_doc
from cloudservice import get_doctag, create_doctag, delete_doctag
from cloudservice import create_doctagrel, delete_doctagrel
from cloudservice import change_step
from cloudservice import get_docs_byid, fill_docinfo
from clou... | [
"cloudservice.get_documenttask",
"os.path.join",
"utils.remove_blank",
"shutil.copy",
"pandas.DataFrame",
"core.analysis",
"numpy.loadtxt",
"cloudservice.fill_docinfo",
"datetime.datetime.now",
"cloudservice.get_file_projs",
"wordapi.transdoc.doc2docx",
"os.path.getsize",
"time.sleep",
"pp... | [((623, 658), 'cloudservice.get_documenttask', 'get_documenttask', ([], {'projid': 'project_id'}), '(projid=project_id)\n', (639, 658), False, 'from cloudservice import get_documenttask, download_doc\n'), ((673, 698), 'pandas.DataFrame', 'pd.DataFrame', (['docresponse'], {}), '(docresponse)\n', (685, 698), True, 'impor... |
#!/usr/bin/env python3
"""
"""
from typing import Dict
import numpy as np
import pandas as pd
def calculate_best_depth_statistics(
best_depths: pd.DataFrame,
trading_actions: pd.DataFrame,
metainfo: pd.Series,
start_microsecond: int,
end_microsecond: int,
) -> Dict[str, float]:
best_depths.dr... | [
"numpy.sum"
] | [((1682, 1749), 'numpy.sum', 'np.sum', (["(best_depths['depth_at_best'] * best_depths['time_validity'])"], {}), "(best_depths['depth_at_best'] * best_depths['time_validity'])\n", (1688, 1749), True, 'import numpy as np\n')] |
import tensorflow as tf
import numpy as np
from tensorflow.contrib.layers.python.layers import utils as tf_utils
from tensorflow.python.training import moving_averages
from tensorflow.python.framework import ops
from tensorflow.python.ops import control_flow_ops
class ConditionalBatchNorm(object):
"""
Batch ... | [
"tensorflow.get_collection",
"tensorflow.reshape",
"tensorflow.get_variable_scope",
"numpy.ones",
"tensorflow.global_variables",
"tensorflow.python.framework.ops.add_to_collections",
"numpy.random.normal",
"tensorflow.python.training.moving_averages.assign_moving_average",
"tensorflow.get_variable",... | [((4585, 4640), 'tensorflow.contrib.layers.python.layers.utils.smart_cond', 'tf_utils.smart_cond', (['is_training', '_training', '_inference'], {}), '(is_training, _training, _inference)\n', (4604, 4640), True, 'from tensorflow.contrib.layers.python.layers import utils as tf_utils\n'), ((4932, 4988), 'tensorflow.python... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 17 2018
@author: jgoldstein
example: http://dfm.io/george/current/user/quickstart
PTA data problem:
PTA data consists of a set of TOA residuals for each pulsar, observed at
unevenly sampled times over a time span of ~5-15 years. Usually t... | [
"numpy.full_like",
"numpy.random.seed",
"numpy.ones_like",
"jannasutils.isIterable",
"george.GP",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.linspace",
"numpy.random.rand",
"numpy.diag",
"george.kernels.ExpSquaredKernel"
] | [((3666, 3687), 'george.kernels.ExpSquaredKernel', 'ExpSquaredKernel', (['(1.0)'], {}), '(1.0)\n', (3682, 3687), False, 'from george.kernels import ExpSquaredKernel\n'), ((3697, 3714), 'george.GP', 'george.GP', (['kernel'], {}), '(kernel)\n', (3706, 3714), False, 'import george\n'), ((3869, 3892), 'numpy.linspace', 'np... |
from collections import namedtuple
import numpy
import pytest
from thyme.model.fvcom import node_to_centroid
from thyme.model.fvcom import vertical_interpolation
VerticalValues = namedtuple(
'VerticalValues',
['u',
'v',
'h',
'zeta',
'siglay_centroid',
'num_nele',
'num_siglay',
... | [
"numpy.allclose",
"thyme.model.fvcom.vertical_interpolation",
"numpy.array",
"collections.namedtuple",
"thyme.model.fvcom.node_to_centroid"
] | [((182, 587), 'collections.namedtuple', 'namedtuple', (['"""VerticalValues"""', "['u', 'v', 'h', 'zeta', 'siglay_centroid', 'num_nele', 'num_siglay',\n 'time_index', 'target_depth_default', 'target_depth_surface',\n 'target_depth_deep', 'expected_u_target_depth_default',\n 'expected_v_target_depth_default', 'e... |
import random
import numpy as np
import torch
class RNGHandler():
"""
Manage rng for random, numpy and pytorch as they all use
different seeds.
Plus additional functions for easy control about pytorch determinism.
"""
def __init__(self, cfg):
self.seed = cfg.RANDOM.SEED
self... | [
"numpy.random.seed",
"random.Random",
"torch.manual_seed",
"numpy.random.RandomState",
"random.seed",
"torch.initial_seed",
"torch.Generator"
] | [((402, 434), 'numpy.random.RandomState', 'np.random.RandomState', (['self.seed'], {}), '(self.seed)\n', (423, 434), True, 'import numpy as np\n'), ((457, 481), 'random.Random', 'random.Random', (['self.seed'], {}), '(self.seed)\n', (470, 481), False, 'import random\n'), ((507, 524), 'torch.Generator', 'torch.Generator... |
# MIT License
#
# Copyright (c) 2019 https://github.com/ElmiiiRaa/align_iranian_national_id_card
#
# 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 limit... | [
"cv2.cvtColor",
"cv2.waitKey",
"numpy.array",
"cv2.CascadeClassifier"
] | [((1236, 1303), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""data_harr/haarcascade_frontalface_alt2.xml"""'], {}), "('data_harr/haarcascade_frontalface_alt2.xml')\n", (1257, 1303), False, 'import cv2\n'), ((1321, 1375), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""data_harr/haarcascade_eye.xml"""'... |
# Copyright (c) <NAME>, <NAME>, and Unlock contributors.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# thi... | [
"numpy.zeros",
"numpy.arange",
"numpy.linspace"
] | [((6355, 6381), 'numpy.linspace', 'np.linspace', (['x1', 'x2', 'ticks'], {}), '(x1, x2, ticks)\n', (6366, 6381), True, 'import numpy as np\n'), ((2511, 2545), 'numpy.arange', 'np.arange', (['(0)', 'self.model.n_samples'], {}), '(0, self.model.n_samples)\n', (2520, 2545), True, 'import numpy as np\n'), ((2581, 2611), 'n... |
import subprocess
import os
import numpy as np
from astropy.table import Table
def generate_SEDs(parameter_names,parameters,path_to_cigale,path_to_ini_file,filename='tmp'):
fin = open(path_to_cigale+path_to_ini_file)
fout = open(path_to_cigale+"pcigale.ini", "wt")
for line in fin:
ind_line=[par... | [
"shutil.copyfile",
"subprocess.Popen",
"numpy.array"
] | [((693, 787), 'shutil.copyfile', 'copyfile', (["(path_to_cigale + path_to_ini_file + '.spec')", "(path_to_cigale + 'pcigale.ini.spec')"], {}), "(path_to_cigale + path_to_ini_file + '.spec', path_to_cigale +\n 'pcigale.ini.spec')\n", (701, 787), False, 'from shutil import copyfile, move, rmtree\n'), ((788, 844), 'sub... |
import SimpleITK as sitk
import numpy as np
import glob
import os,json
def get_resampled(input,resampled_spacing=[1,1,1],l=False):
resampler = sitk.ResampleImageFilter()
if l:
resampler.SetInterpolator(sitk.sitkLinear)
else:
resampler.SetInterpolator(sitk.sitkNearestNeighbor)
resampler... | [
"os.makedirs",
"SimpleITK.ReadImage",
"SimpleITK.ResampleImageFilter",
"SimpleITK.GetArrayFromImage",
"numpy.where",
"SimpleITK.GetImageFromArray",
"os.path.join",
"os.listdir"
] | [((791, 812), 'os.listdir', 'os.listdir', (['data_path'], {}), '(data_path)\n', (801, 812), False, 'import os, json\n'), ((1182, 1225), 'os.makedirs', 'os.makedirs', (['OUTPUT_RESAMPLE'], {'exist_ok': '(True)'}), '(OUTPUT_RESAMPLE, exist_ok=True)\n', (1193, 1225), False, 'import os, json\n'), ((1225, 1269), 'os.makedir... |
import numpy as np
def fib(n):
fib = [0, 1]
while len(fib) < n+1:
fib.append(fib[-2] + fib[-1])
return fib[1:]
def fib_numpy(n):
fib = np.zeros(n+1)
fib[1] = 1
for i in range(2, n+1):
fib[i] = fib[i-2] + fib[i-1]
return fib[1:]
def fib_recursive(n):
if n == 1 or n =... | [
"numpy.zeros"
] | [((163, 178), 'numpy.zeros', 'np.zeros', (['(n + 1)'], {}), '(n + 1)\n', (171, 178), True, 'import numpy as np\n')] |
from __future__ import division, print_function, absolute_import
import time
import os
import sys
import re
import csv
import codecs
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from pandas.io.parsers import read_csv
import tensorflow as tf
import glob
from datetime import d... | [
"tensorflow.nn.static_rnn",
"numpy.argmax",
"tensorflow.reshape",
"tensorflow.matmul",
"tensorflow.global_variables",
"tensorflow.train.latest_checkpoint",
"tensorflow.split",
"pandas.DataFrame",
"os.path.abspath",
"numpy.eye",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.pla... | [((953, 974), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (968, 974), False, 'import os\n'), ((1865, 1900), 'numpy.zeros', 'np.zeros', (['(t.shape[0], num_classes)'], {}), '((t.shape[0], num_classes))\n', (1873, 1900), True, 'import numpy as np\n'), ((2162, 2197), 'numpy.zeros', 'np.zeros', ([... |
from __future__ import division, print_function
import random
import sys
import pytest
from pysmu import Session, Mode, WriteTimeout
@pytest.fixture(scope='function')
def session(request):
"""Default session adding all attached devices."""
s = Session()
yield s
# force session destruction
s._c... | [
"sys.stdout.write",
"random.randint",
"scipy.signal.welch",
"numpy.argmax",
"scipy.signal.get_window",
"pytest.fixture",
"pytest.skip",
"pysmu.Session",
"pytest.raises"
] | [((139, 171), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (153, 171), False, 'import pytest\n'), ((330, 362), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (344, 362), False, 'import pytest\n'), ((464, 496), 'pytest.fixt... |
from copy import deepcopy
from itertools import cycle
from typing import Callable, Tuple
import matplotlib.pyplot as plt
import numpy as np
import streamlit as st
from tnmf.TransformInvariantNMF import TransformInvariantNMF
from tnmf.utils.data_loading import racoon_image
from tnmf.utils.demo import st_define_nmf_par... | [
"matplotlib.pyplot.title",
"numpy.moveaxis",
"matplotlib.pyplot.figure",
"itertools.cycle",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.close",
"matplotlib.pyplot.imshow",
"tnmf.utils.demo.st_define_nmf_params",
"matplotlib.pyplot.subplots",
"streamlit.sidebar.caption",
"numpy.ceil",
... | [((604, 703), 'streamlit.sidebar.number_input', 'st.sidebar.number_input', (['"""Image scale"""'], {'min_value': '(0.05)', 'value': '(0.25)', 'step': '(0.05)', 'help': 'help_scale'}), "('Image scale', min_value=0.05, value=0.25, step=\n 0.05, help=help_scale)\n", (627, 703), True, 'import streamlit as st\n'), ((2409... |
import subprocess
import numpy as np
import sys
from math import floor, log10
if __name__ == '__main__':
exp_i = sys.argv[1]
#rand_seed = int(sys.argv[2])
#np.random.seed(rand_seed)
exps = [4]
#num = np.arange(1, 9)
num = [2]
num_trials = 10
seeds = [123, 343]
for i in ... | [
"numpy.random.normal"
] | [((582, 613), 'numpy.random.normal', 'np.random.normal', (['(0.0002)', '(1e-05)'], {}), '(0.0002, 1e-05)\n', (598, 613), True, 'import numpy as np\n')] |
import time
import argparse
import numpy as np
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import sched_heuristic as oldh
import cy_heuristics as newh
import pickle
from scipy.stats import kendalltau as tau, spearmanr as rho
from coll... | [
"numpy.zeros_like",
"sched_heuristic.OPA",
"argparse.ArgumentParser",
"sched_heuristic.test_RTA_LC",
"cy_heuristics.OPA_DA_LC",
"time.time",
"collections.defaultdict",
"numpy.argsort",
"sched_heuristic.get_DM_DS_scores",
"pickle.load",
"cy_heuristics.test_RTA_LC"
] | [((357, 382), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (380, 382), False, 'import argparse\n'), ((1195, 1218), 'collections.defaultdict', 'defaultdict', (['(lambda : 0)'], {}), '(lambda : 0)\n', (1206, 1218), False, 'from collections import defaultdict\n'), ((698, 717), 'numpy.argsort', '... |
# This file is part of GridCal.
#
# GridCal is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GridCal is distributed in the hope that... | [
"GridCal.Engine.Simulations.PowerFlow.power_flow_options.PowerFlowOptions",
"GridCal.Engine.basic_structures.Logger",
"matplotlib.pyplot.show",
"numpy.abs",
"numpy.dot",
"numpy.zeros",
"time.time",
"GridCal.Engine.FileOpen",
"GridCal.Engine.Core.time_series_opf_data.compile_opf_time_circuit",
"mat... | [((5491, 5504), 'PySide2.QtCore.Signal', 'Signal', (['float'], {}), '(float)\n', (5497, 5504), False, 'from PySide2.QtCore import QThread, Signal\n'), ((5525, 5536), 'PySide2.QtCore.Signal', 'Signal', (['str'], {}), '(str)\n', (5531, 5536), False, 'from PySide2.QtCore import QThread, Signal\n'), ((5555, 5563), 'PySide2... |
import sys, os
import platform
import numpy
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QIntValidator, QDoubleValidator
from orangewidget import gui
from orangewidget.settings import Setting
from oasys.widgets import gui as oasysgui, congruence
from oasys.widgets.exchange import DataExchangeObject
... | [
"orangewidget.settings.Setting",
"orangewidget.gui.button",
"orangecontrib.xoppy.util.xoppy_util.locations.home_bin_run",
"numpy.arange",
"orangecontrib.xoppy.util.xoppy_util.locations.home_bin",
"orangewidget.gui.rubber",
"oasys.widgets.gui.widgetBox",
"PyQt5.QtWidgets.QApplication",
"orangecontrib... | [((865, 875), 'orangewidget.settings.Setting', 'Setting', (['(0)'], {}), '(0)\n', (872, 875), False, 'from orangewidget.settings import Setting\n'), ((887, 897), 'orangewidget.settings.Setting', 'Setting', (['(0)'], {}), '(0)\n', (894, 897), False, 'from orangewidget.settings import Setting\n'), ((913, 923), 'orangewid... |
'''
Copyright (c) 2018 <NAME>, Rutgers University
http://www.cs.rutgers.edu/~hxp1/
This code is free to use for academic/research purpose.
'''
import numpy as np
import cntk as C
import cv2
from scipy.signal import medfilt
import ShapeUtils2 as SU
from SysUtils import make_dir, get_items
def load_image(path):
... | [
"numpy.stack",
"numpy.load",
"numpy.vsplit",
"ShapeUtils2.draw_error_bar_plot",
"numpy.concatenate",
"cntk.load_model",
"cv2.imwrite",
"scipy.signal.medfilt",
"cv2.imread",
"ShapeUtils2.Visualizer",
"SysUtils.make_dir",
"numpy.loadtxt",
"numpy.reshape",
"SysUtils.get_items",
"cv2.resize"... | [((327, 346), 'cv2.imread', 'cv2.imread', (['path', '(1)'], {}), '(path, 1)\n', (337, 346), False, 'import cv2\n'), ((575, 589), 'numpy.stack', 'np.stack', (['imgs'], {}), '(imgs)\n', (583, 589), True, 'import numpy as np\n'), ((2239, 2298), 'numpy.loadtxt', 'np.loadtxt', (['audio_csv_file'], {'dtype': 'np.float32', 'd... |
import astropy.units as u
import numpy as np
import pytest
from astropy.coordinates import SkyCoord, SpectralCoord
from astropy.wcs.wcsapi import BaseHighLevelWCS, BaseLowLevelWCS
from astropy.wcs.wcsapi.wrappers import SlicedLowLevelWCS
from ndcube.tests import helpers
def generate_data(shape):
data = np.arange... | [
"numpy.allclose",
"astropy.coordinates.SpectralCoord",
"numpy.ones",
"numpy.product",
"pytest.raises",
"ndcube.tests.helpers.assert_cubes_equal",
"numpy.array",
"astropy.units.allclose",
"pytest.mark.parametrize"
] | [((537, 996), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ndc, item"""', "(('ndcube_3d_ln_lt_l', np.s_[:, :, 0]), ('ndcube_3d_ln_lt_l', np.s_[..., 0]\n ), ('ndcube_3d_ln_lt_l', np.s_[1:2, 1:2, 0]), ('ndcube_3d_ln_lt_l', np.\n s_[..., 0]), ('ndcube_3d_ln_lt_l', np.s_[:, :, 0]), (\n 'ndcube_3d_ln... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: 深圳星河软通科技有限公司 A.Star
# @contact: <EMAIL>
# @site: www.astar.ltd
# @file: graphics .py
# @time: 2020/9/6 23:48
# @Software: PyCharm
import unittest
import numpy as np
from astartool.project import std_logging
from snowland.graphics.core.computational_geometry_2d... | [
"numpy.sqrt",
"snowland.graphics.solid_geometry.on_polygon_edge",
"astartool.project.std_logging",
"snowland.graphics.solid_geometry.in_polygon"
] | [((479, 492), 'astartool.project.std_logging', 'std_logging', ([], {}), '()\n', (490, 492), False, 'from astartool.project import std_logging\n'), ((555, 568), 'astartool.project.std_logging', 'std_logging', ([], {}), '()\n', (566, 568), False, 'from astartool.project import std_logging\n'), ((638, 651), 'astartool.pro... |
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import List, Tuple, cast
import numpy as np
from tqdm import tqdm
from evolution.encoding.complex_edge import ComplexEdge
from evolution.evolve.mutation_strategy import MutationStrategy
from evolution.train.progress_observer import Prog... | [
"tqdm.tqdm",
"tqdm.tqdm.write",
"numpy.random.randint"
] | [((869, 900), 'tqdm.tqdm', 'tqdm', ([], {'total': '(100)', 'bar_format': 'fmt'}), '(total=100, bar_format=fmt)\n', (873, 900), False, 'from tqdm import tqdm\n'), ((1592, 1663), 'tqdm.tqdm.write', 'tqdm.write', (['"""Finished generating populations. Now start improving them"""'], {}), "('Finished generating populations.... |
## @ingroupMethods-Noise-Fidelity_One-Noise_Tools
# epnl_noise.py
#
# Created: Jul 2015, <NAME>
# Modified: Jan 2016, <NAME>
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
import numpy as np
# --... | [
"numpy.log10",
"numpy.max"
] | [((1060, 1072), 'numpy.max', 'np.max', (['PNLT'], {}), '(PNLT)\n', (1066, 1072), True, 'import numpy as np\n'), ((2091, 2109), 'numpy.log10', 'np.log10', (['sumation'], {}), '(sumation)\n', (2099, 2109), True, 'import numpy as np\n')] |
import numpy as np
import torch
import os
from common import constants as c
from common.utilities import Bunch
from common.config import setup_logger
from artisynth_envs.artisynth_base_env import ArtiSynthBase
logger = setup_logger()
class JawEnv(ArtiSynthBase):
def __init__(self, wait_action, reset_step, goal_... | [
"numpy.abs",
"os.makedirs",
"csv.DictReader",
"numpy.asarray",
"time.sleep",
"common.utilities.Bunch",
"numpy.mean",
"numpy.linalg.norm",
"numpy.log10",
"scipy.spatial.ConvexHull",
"os.path.join",
"common.config.setup_logger",
"csv.DictWriter"
] | [((221, 235), 'common.config.setup_logger', 'setup_logger', ([], {}), '()\n', (233, 235), False, 'from common.config import setup_logger\n'), ((5318, 5350), 'os.makedirs', 'os.makedirs', (['path'], {'exist_ok': '(True)'}), '(path, exist_ok=True)\n', (5329, 5350), False, 'import os\n'), ((8360, 8397), 'os.path.join', 'o... |
from __init__ import *
import numpy as np
import cv2
def main():
parser = create_parser()
args = parser.parse_args()
verify_json_in_args(args)
data = read(PROCESSED + args.filename)
for field in data:
create_mask(field["id"])
print("done")
def create_mask(id):
img = cv2.imread(RA... | [
"cv2.bitwise_and",
"cv2.imwrite",
"cv2.imread",
"numpy.array",
"cv2.inRange"
] | [((307, 333), 'cv2.imread', 'cv2.imread', (['(RAW + id + EXT)'], {}), '(RAW + id + EXT)\n', (317, 333), False, 'import cv2\n'), ((345, 378), 'cv2.imread', 'cv2.imread', (['(RAW + id + MASK + EXT)'], {}), '(RAW + id + MASK + EXT)\n', (355, 378), False, 'import cv2\n'), ((395, 418), 'numpy.array', 'np.array', (['[0, 135,... |
#!/usr/bin/env python
# coding=utf-8
'''
@描述: 画线
@版本: V1_0
@作者: LiWanglin
@创建时间: 2020.02.06
@最后编辑人: LiWanglin
@最后编辑时间: 2020.02.06
'''
import cv2 as cv
import numpy as np
img = np.zeros((512, 512, 3), dtype=np.uint8) # 创建黑色背景图
cv.imshow("img", img) # 显示原图
result = cv.line(img, (0 ,0), (511, 511), (0, 255, 0), 1) ... | [
"cv2.line",
"cv2.waitKey",
"cv2.imshow",
"numpy.zeros",
"cv2.destroyAllWindows"
] | [((178, 217), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)'], {'dtype': 'np.uint8'}), '((512, 512, 3), dtype=np.uint8)\n', (186, 217), True, 'import numpy as np\n'), ((229, 250), 'cv2.imshow', 'cv.imshow', (['"""img"""', 'img'], {}), "('img', img)\n", (238, 250), True, 'import cv2 as cv\n'), ((270, 318), 'cv2.line', 'cv... |
import json
from utils.dicom_utils import convert_image_to_numpy_array, save_prediction_slices_with_scan, preprocess_slice, \
postprocess_prediticion
from utils.network_utils import get_pretrained_models, get_best_checkpoints, get_preprocessor, backbone, architecture
import keras
import numpy as np
import tensorflo... | [
"logging.exception",
"json.load",
"utils.dicom_utils.convert_image_to_numpy_array",
"os.makedirs",
"csv.writer",
"numpy.copy",
"utils.misc.calculate_iou_score",
"numpy.empty",
"numpy.std",
"utils.dicom_utils.preprocess_slice",
"logging.info",
"numpy.mean",
"numpy.arange",
"utils.network_ut... | [((736, 754), 'utils.network_utils.get_preprocessor', 'get_preprocessor', ([], {}), '()\n', (752, 754), False, 'from utils.network_utils import get_pretrained_models, get_best_checkpoints, get_preprocessor, backbone, architecture\n'), ((1154, 1177), 'utils.network_utils.get_pretrained_models', 'get_pretrained_models', ... |
# import MNIST data, Tensorflow, and other helpers
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/")
import tensorflow as tf
import numpy as np
import sys
import os
import pickle
# training parameters
training_epochs = 500
batch_size = 64
# architecture paramet... | [
"numpy.random.shuffle",
"os.makedirs",
"os.path.exists",
"tensorflow.Session",
"tensorflow.pow",
"tensorflow.placeholder",
"tensorflow.matmul",
"tensorflow.zeros",
"numpy.arange",
"tensorflow.random_normal",
"tensorflow.initialize_all_variables",
"tensorflow.square",
"tensorflow.examples.tut... | [((118, 157), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""/tmp/data/"""'], {}), "('/tmp/data/')\n", (143, 157), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((715, 775), 'tensorflow.placeholder', 'tf.placeholder', ([], {'dtype': 'tf.floa... |
# 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, ... | [
"renn.analysis_utils.pseudogrid",
"numpy.product",
"numpy.array",
"numpy.linspace",
"numpy.array_equal"
] | [((1248, 1285), 'renn.analysis_utils.pseudogrid', 'au.pseudogrid', (['coordinates', 'dimension'], {}), '(coordinates, dimension)\n', (1261, 1285), True, 'from renn import analysis_utils as au\n'), ((1297, 1349), 'numpy.array', 'np.array', (['[[0, 1, 0, 0], [1, 1, 0, 0], [2, 1, 0, 0]]'], {}), '([[0, 1, 0, 0], [1, 1, 0, ... |
import numpy as np
import scipy.ndimage as ndi
from scipy import signal
import cv2
import logging
log = logging.getLogger(__name__)
def get_background(img, is_01_normalized=True):
return ~get_foreground(img, is_01_normalized)
def get_foreground(img, is_01_normalized=True):
return center_crop_and_get_foreg... | [
"cv2.circle",
"scipy.signal.cspline2d",
"numpy.zeros",
"numpy.ones",
"logging.getLogger"
] | [((104, 131), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (121, 131), False, 'import logging\n'), ((1429, 1459), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': '"""uint8"""'}), "(shape, dtype='uint8')\n", (1437, 1459), True, 'import numpy as np\n'), ((1464, 1508), 'cv2.circle', 'cv2.... |
import matplotlib.pyplot as plt
import numpy as np
I = plt.imread("./pred_tumour_seg_1.png")
print(I.shape)
print(I.dtype, type(I))
print(np.unique(I)) | [
"matplotlib.pyplot.imread",
"numpy.unique"
] | [((57, 94), 'matplotlib.pyplot.imread', 'plt.imread', (['"""./pred_tumour_seg_1.png"""'], {}), "('./pred_tumour_seg_1.png')\n", (67, 94), True, 'import matplotlib.pyplot as plt\n'), ((142, 154), 'numpy.unique', 'np.unique', (['I'], {}), '(I)\n', (151, 154), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
File name : test_atari_emulator_remote
Date : 08/07/2019
Description : {TODO}
Author : VickeeX
"""
import argparse, numpy as np, ray
def bool_arg(string):
value = string.lower()
if value == 'true':
return True
elif value ==... | [
"ray.init",
"argparse.ArgumentParser",
"numpy.asarray",
"numpy.zeros",
"atari_emulator.AtariEmulator.remote",
"ray.shutdown",
"ale_python_interface.ALEInterface"
] | [((492, 517), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (515, 517), False, 'import argparse, numpy as np, ray\n'), ((4553, 4567), 'ale_python_interface.ALEInterface', 'ALEInterface', ([], {}), '()\n', (4565, 4567), False, 'from ale_python_interface import ALEInterface\n'), ((4729, 4739), '... |
# main imports
import numpy as np
import sys
# image transform imports
from PIL import Image
from skimage import color, restoration
from sklearn.decomposition import FastICA
from sklearn.decomposition import IncrementalPCA
from sklearn.decomposition import TruncatedSVD
from numpy.linalg import svd as lin_svd
from scip... | [
"cv2.GaussianBlur",
"numpy.abs",
"numpy.sum",
"ipfml.processing.transform.get_mscn_coefficients",
"numpy.ones",
"numpy.mean",
"sys.getsizeof",
"cv2.filter2D",
"numpy.std",
"ipfml.processing.segmentation.divide_in_blocks",
"ipfml.processing.transform.get_LAB_L",
"numpy.append",
"gzip.compress... | [((515, 537), 'sys.path.insert', 'sys.path.insert', (['(0)', '""""""'], {}), "(0, '')\n", (530, 537), False, 'import sys\n'), ((3946, 4022), 'skimage.restoration.estimate_sigma', 'restoration.estimate_sigma', (['imArray'], {'average_sigmas': '(True)', 'multichannel': '(False)'}), '(imArray, average_sigmas=True, multich... |
"""
.. module:: extractor
:synopsis: Embedding extractor module
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import logging
import os
from typing import Union, Optional, Tuple
import warnings
import closely
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import torch
import torch.nn as nn
imp... | [
"matplotlib.pyplot.title",
"torch.cat",
"torch.cuda.device_count",
"torchvision.transforms.Normalize",
"torch.nn.MSELoss",
"os.path.abspath",
"torch.utils.data.DataLoader",
"numpy.transpose",
"torch.Tensor",
"closely.solve",
"torchvision.transforms.CenterCrop",
"matplotlib.pyplot.subplots",
... | [((557, 634), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'message': '"""Palette images with Transparency"""'}), "('ignore', message='Palette images with Transparency')\n", (580, 634), False, 'import warnings\n'), ((641, 668), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '... |
from sklearn.preprocessing import normalize
from minder_utils.scripts.weekly_loader import Weekly_dataloader
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense, Conv2D, Flatten, Input
import os
import numpy as np
import shap
import tensorflow as tf
from minder_utils.configurations impor... | [
"matplotlib.pyplot.tight_layout",
"tensorflow.keras.layers.Conv2D",
"os.path.join",
"tensorflow.keras.layers.Dense",
"matplotlib.pyplot.clf",
"tensorflow.keras.models.Model",
"minder_utils.scripts.weekly_loader.Weekly_dataloader",
"shap.image_plot",
"tensorflow.keras.layers.Input",
"shap.DeepExpla... | [((362, 396), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.compat.v1.disable_v2_behavior', ([], {}), '()\n', (394, 396), True, 'import tensorflow as tf\n'), ((398, 413), 'os.chdir', 'os.chdir', (['"""../"""'], {}), "('../')\n", (406, 413), False, 'import os\n'), ((440, 478), 'minder_utils.scripts.weekly_loader.Weekl... |
import os
import shutil
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from lime import lime_image
from skimage.segmentation import mark_boundaries
import data_handler
from utils import stitchImages
def plot_explainability_rtex_t(
image_tags,
image_paths,
num,
... | [
"os.mkdir",
"skimage.segmentation.mark_boundaries",
"numpy.vectorize",
"os.path.exists",
"matplotlib.pyplot.colorbar",
"data_handler.encode_images",
"lime.lime_image.LimeImageExplainer",
"numpy.array",
"pandas.Series",
"shutil.rmtree",
"utils.stitchImages",
"matplotlib.pyplot.subplots"
] | [((1024, 1043), 'pandas.Series', 'pd.Series', (['all_tags'], {}), '(all_tags)\n', (1033, 1043), True, 'import pandas as pd\n'), ((1074, 1102), 'os.path.exists', 'os.path.exists', (['plots_folder'], {}), '(plots_folder)\n', (1088, 1102), False, 'import os\n'), ((1153, 1175), 'os.mkdir', 'os.mkdir', (['plots_folder'], {}... |
__author__ = 'Will@PCVG'
# An Implementation based on shekkizh's FCN.tensorflow
# Utils used with tensorflow implemetation
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import copy
import functools
from ops_dup import *
import tensorflow as tf
import nu... | [
"portrait_plus.BatchDatset",
"tensorflow.trainable_variables",
"tensorflow.train.RMSPropOptimizer",
"scipy.misc.imsave",
"numpy.round",
"tensorflow.nn.softmax",
"portrait_plus.TestDataset",
"TensorflowUtils_plus.weight_variable",
"TensorflowUtils_plus.add_gradient_summary",
"tensorflow.variable_sc... | [((562, 631), 'tensorflow.flags.DEFINE_integer', 'tf.flags.DEFINE_integer', (['"""batch_size"""', '"""1"""', '"""batch size for training"""'], {}), "('batch_size', '1', 'batch size for training')\n", (585, 631), True, 'import tensorflow as tf\n'), ((632, 701), 'tensorflow.flags.DEFINE_string', 'tf.flags.DEFINE_string',... |
#!/usr/bin/env python
import numpy as np
from random import randrange, seed
def percent_diff(a, b):
return ((a - b)/b) * 100.0
##
## Simple Example
##
print("+++++ Simple Example +++++")
# Let's say that there are only 2 minutes in each hour
# with that in mind we have the following data sets
# for the first an... | [
"numpy.median",
"numpy.append",
"numpy.max",
"numpy.min",
"numpy.array",
"numpy.mean",
"random.seed",
"random.randrange"
] | [((564, 586), 'numpy.mean', 'np.mean', (['data_minute_1'], {}), '(data_minute_1)\n', (571, 586), True, 'import numpy as np\n'), ((603, 625), 'numpy.mean', 'np.mean', (['data_minute_2'], {}), '(data_minute_2)\n', (610, 625), True, 'import numpy as np\n'), ((798, 837), 'numpy.mean', 'np.mean', (['[mean_minute_1, mean_min... |
import argparse
import dask
import glob
import re
import sys
import os
import deepblink as pink
import numpy as np
import scipy.optimize as opt
sys.path.append("../")
from util import delayed_results
EPS = 1e-4
def _parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--datasets")
pars... | [
"sys.path.append",
"numpy.meshgrid",
"argparse.ArgumentParser",
"deepblink.data.normalize_image",
"util.delayed_results",
"numpy.min",
"numpy.max",
"numpy.arange",
"numpy.array",
"numpy.exp",
"glob.glob",
"re.search",
"numpy.round"
] | [((146, 168), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (161, 168), False, 'import sys\n'), ((248, 273), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (271, 273), False, 'import argparse\n'), ((457, 489), 'deepblink.data.normalize_image', 'pink.data.normalize_imag... |
"""Random number generation."""
import time
import numpy as np
def set_seed(sd="clock"):
"""Essentially ``np.random.seed(sd)``, but also returning ``sd``.
The disadvantage of ``np.random.seed()`` is that it produces a
RandomState that cannot be represented by a simple seed
(the mapping seed-->state... | [
"numpy.random.seed",
"time.time"
] | [((1932, 1950), 'numpy.random.seed', 'np.random.seed', (['sd'], {}), '(sd)\n', (1946, 1950), True, 'import numpy as np\n'), ((1843, 1854), 'time.time', 'time.time', ([], {}), '()\n', (1852, 1854), False, 'import time\n')] |
# coding=utf-8
"""RANSAC.
Random Sample Consensus regression.
"""
import numpy as np
from sklearn import linear_model, datasets
from sklearn.metrics import r2_score
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
if __name__ == "__main__":
print("Generating data...")
n_s... | [
"sklearn.linear_model.RANSACRegressor",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.scatter",
"numpy.logical_not",
"sklearn.datasets.make_regression",
"matplotlib.pyplot.legend",
"sklearn.linear_model.LinearRegression",
"numpy.... | [((383, 502), 'sklearn.datasets.make_regression', 'datasets.make_regression', ([], {'n_samples': 'n_samples', 'n_features': 'n_features', 'n_informative': 'n_features', 'noise': '(10)', 'coef': '(True)'}), '(n_samples=n_samples, n_features=n_features,\n n_informative=n_features, noise=10, coef=True)\n', (407, 502), ... |
"""implementation of Conflict-based Search(CBS)
Author: <NAME>
Affiliation: TokyoTech & OSX
Ref:
- <NAME>., <NAME>., <NAME>., & <NAME>. (2015).
Conflict-based search for optimal multi-agent pathfinding.
Artificial Intelligence, 219, 40-66.
"""
from __future__ import annotations
import copy
import heapq
from data... | [
"copy.deepcopy",
"heapq.heappush",
"heapq.heappop",
"numpy.linalg.norm",
"numpy.random.rand",
"dataclasses.dataclass"
] | [((514, 536), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (523, 536), False, 'from dataclasses import dataclass\n'), ((631, 653), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (640, 653), False, 'from dataclasses import dataclass\n'), ((214... |
import matplotlib.pyplot as plt
import numpy as np
import time
from mpi4py import MPI
from scipy.stats import uniform
from smcpy import SMCSampler, VectorMCMCKernel, ParallelMCMC
def gen_noisy_data(eval_model, std_dev, plot=True):
y_true = eval_model(np.array([[2, 3.5]]))
noisy_data = y_true + np.random.nor... | [
"smcpy.VectorMCMCKernel",
"numpy.random.seed",
"matplotlib.pyplot.show",
"smcpy.ParallelMCMC",
"scipy.stats.uniform",
"time.time",
"smcpy.SMCSampler",
"numpy.array",
"numpy.linspace",
"numpy.random.normal",
"mpi4py.MPI.COMM_WORLD.Clone",
"matplotlib.pyplot.subplots"
] | [((535, 550), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)'], {}), '(1)\n', (547, 550), True, 'import matplotlib.pyplot as plt\n'), ((702, 712), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (710, 712), True, 'import matplotlib.pyplot as plt\n'), ((747, 766), 'numpy.random.seed', 'np.random.seed', (['... |
from torchvision import transforms
import numpy as np
import PIL
import random
import torch
import utils
class ADA:
def __init__(self, xflip=1, rot90=1, int_translation=1, iso_scale=1, abrot=1, aniso_scale=1, frac_translation = 1, bright = 1, contrast = 1, lumaflip = 1, huerot = 1, sat = 1, target_value = ... | [
"torchvision.transforms.functional.center_crop",
"numpy.random.uniform",
"numpy.sum",
"numpy.maximum",
"torchvision.transforms.functional.rotate",
"torchvision.transforms.RandomHorizontalFlip",
"numpy.log",
"torchvision.transforms.RandomRotation",
"random.choice",
"PIL.Image.open",
"random.rando... | [((3223, 3248), 'random.choice', 'random.choice', (['angle_list'], {}), '(angle_list)\n', (3236, 3248), False, 'import random\n'), ((3263, 3303), 'torchvision.transforms.functional.rotate', 'transforms.functional.rotate', (['img', 'angle'], {}), '(img, angle)\n', (3291, 3303), False, 'from torchvision import transforms... |
from dlhalos_code import CNN
from dlhalos_code import custom_regularizers as reg
import dlhalos_code.data_processing as tn
from pickle import load
import numpy as np
import tensorflow as tf
import random as python_random
import sys
import os
if __name__ == "__main__":
########### CREATE GENERATORS FOR TRAINING A... | [
"numpy.save",
"numpy.random.seed",
"dlhalos_code.custom_regularizers.l2_norm",
"tensorflow.compat.v1.set_random_seed",
"random.seed",
"numpy.arange",
"dlhalos_code.data_processing.DataGenerator",
"dlhalos_code.data_processing.SimulationPreparation",
"dlhalos_code.CNN.CNNCauchy",
"dlhalos_code.cust... | [((565, 585), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (579, 585), True, 'import numpy as np\n'), ((590, 614), 'random.seed', 'python_random.seed', (['seed'], {}), '(seed)\n', (608, 614), True, 'import random as python_random\n'), ((619, 653), 'tensorflow.compat.v1.set_random_seed', 'tf.compat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.