code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""
"""
import logging
import numpy as np
from scipy.optimize import brentq as find_root
NUMPY_TYPE = 'float64'
logger = logging.getLogger(__name__).addHandler(logger.NullHandler())
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class InputError(Error):
"""Exception raised... | [
"scipy.optimize.brentq",
"numpy.array",
"numpy.sum",
"logging.getLogger"
] | [((2286, 2323), 'numpy.array', 'np.array', (['cashflows'], {'dtype': 'NUMPY_TYPE'}), '(cashflows, dtype=NUMPY_TYPE)\n', (2294, 2323), True, 'import numpy as np\n'), ((2344, 2385), 'numpy.array', 'np.array', (['days_to_flows'], {'dtype': 'NUMPY_TYPE'}), '(days_to_flows, dtype=NUMPY_TYPE)\n', (2352, 2385), True, 'import ... |
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
import os
from .utils import lazy_property
class Encoder(object):
def __init__(self, input, latent_space_size, num_filters, kernel_size, strides,
batch_norm, resnet50, resnet101, aspp, pre_trained_model,
emb_inv... | [
"tensorflow.contrib.layers.xavier_initializer",
"auto_pose.ae.deeplab_v3_encoder.deeplab_v3_encoder",
"tensorflow.get_collection",
"tensorflow.contrib.layers.flatten",
"tensorflow.get_variable_scope",
"tensorflow.nn.l2_normalize",
"numpy.ones",
"tensorflow.Variable",
"tensorflow.split",
"tensorflo... | [((3021, 3049), 'tensorflow.contrib.layers.flatten', 'tf.contrib.layers.flatten', (['x'], {}), '(x)\n', (3046, 3049), True, 'import tensorflow as tf\n'), ((4444, 4497), 'tensorflow.contrib.distributions.Normal', 'tf.contrib.distributions.Normal', (['self.z', 'self.q_sigma'], {}), '(self.z, self.q_sigma)\n', (4475, 4497... |
import pickle, gzip
import scipy
from scipy.stats import norm
import geojson
import numpy as np
import datetime
import h5py
import sys
import os
import pandas as pd
import geopandas as gpd
import shapely
from scipy.spatial.distance import pdist, squareform
from haversine import haversine
import synpopStructures
impo... | [
"sys.stdout.write",
"h5py.File",
"gzip.open",
"numpy.ceil",
"importlib.import_module",
"synpopUtils.clusterPointsInLevelsBottomUp",
"numpy.dtype",
"numpy.zeros",
"datetime.datetime",
"sys.stdout.flush",
"numpy.array",
"numpy.arange",
"pandas.read_pickle",
"synpopGenerator_tools.filterL0cod... | [((564, 596), 'importlib.import_module', 'importlib.import_module', (['cfgname'], {}), '(cfgname)\n', (587, 596), False, 'import importlib\n'), ((2209, 2245), 'pandas.read_pickle', 'pd.read_pickle', (["cfg['checkpoint_AG']"], {}), "(cfg['checkpoint_AG'])\n", (2223, 2245), True, 'import pandas as pd\n'), ((2257, 2293), ... |
# coding=utf-8
import os
import sys
import csv
import math
import unicodedata
import numpy as np
from tqdm import tqdm
from pathlib import Path
from collections import Counter
import torch
from torch import nn
HIGH_FIVE_REPLACEMENT = 'hit'
def normalize_string(string):
"""
Normalizes the string from unicode... | [
"torch.ones_like",
"unicodedata.normalize",
"copy.deepcopy",
"numpy.random.seed",
"torch.zeros_like",
"unicodedata.category",
"numpy.random.choice",
"torch.nn.utils.rnn.pad_sequence",
"torch.tensor"
] | [((2301, 2324), 'copy.deepcopy', 'copy.deepcopy', (['data_raw'], {}), '(data_raw)\n', (2314, 2324), False, 'import copy\n'), ((2473, 2495), 'numpy.random.seed', 'np.random.seed', (['num_JJ'], {}), '(num_JJ)\n', (2487, 2495), True, 'import numpy as np\n'), ((2549, 2592), 'numpy.random.choice', 'np.random.choice', (['JJs... |
# -*- coding: utf-8 -*-
import torch
from torch import nn
from torch.nn import functional as F
import torch.nn.init as init
import random
import numpy as np
from models.layers import GatedDense, ResConv2d, ResConvTranspose2d
# -----------------------------------------------------------
# -----------------------------... | [
"torch.nn.Dropout",
"torch.nn.init.constant_",
"numpy.prod",
"torch.FloatTensor",
"torch.nn.functional.log_softmax",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.functional.relu",
"torch.nn.GRUCell",
"torch.nn.LSTM",
"torch.mean",
"torch.nn.GRU",
"torch.nn.Dropout2d",
"torch.nn.Tanh",
"to... | [((1378, 1393), 'torch.nn.Sequential', 'nn.Sequential', ([], {}), '()\n', (1391, 1393), False, 'from torch import nn\n'), ((2673, 2688), 'torch.tanh', 'torch.tanh', (['out'], {}), '(out)\n', (2683, 2688), False, 'import torch\n'), ((3181, 3196), 'torch.nn.Sequential', 'nn.Sequential', ([], {}), '()\n', (3194, 3196), Fa... |
import numpy as np
import cv2
def print_image(name_image, image):
cv2.imshow(name_image, image)
cv2.waitKey(0)
cv2.destroyAllWindows()
def convert_image_to_RGB(image):
height, width = image.shape
channels = 3
img_rgb = np.zeros((height, width, channels))
for ch in range(channels):
... | [
"cv2.waitKey",
"cv2.cvtColor",
"cv2.imshow",
"numpy.zeros",
"numpy.loadtxt",
"cv2.destroyAllWindows"
] | [((634, 663), 'numpy.loadtxt', 'np.loadtxt', (['"""ImageMatriz.txt"""'], {}), "('ImageMatriz.txt')\n", (644, 663), True, 'import numpy as np\n'), ((72, 101), 'cv2.imshow', 'cv2.imshow', (['name_image', 'image'], {}), '(name_image, image)\n', (82, 101), False, 'import cv2\n'), ((106, 120), 'cv2.waitKey', 'cv2.waitKey', ... |
import colorsys
import imghdr
import os
import random
import cv2, time
import numpy as np
from keras import backend as K
from keras.models import load_model
from PIL import Image, ImageDraw, ImageFont
from yad2k.models.keras_yolo import yolo_eval, yolo_head
model_path = 'model_data/yolo.h5'
anchors_path = 'model_dat... | [
"keras.models.load_model",
"cv2.VideoWriter_fourcc",
"random.shuffle",
"numpy.floor",
"yad2k.models.keras_yolo.yolo_eval",
"os.path.join",
"keras.backend.placeholder",
"random.seed",
"PIL.ImageDraw.Draw",
"cv2.destroyAllWindows",
"cv2.resize",
"keras.backend.learning_phase",
"cv2.waitKey",
... | [((4002, 4029), 'cv2.VideoCapture', 'cv2.VideoCapture', (['input_vid'], {}), '(input_vid)\n', (4018, 4029), False, 'import cv2, time\n'), ((4146, 4177), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'XVID'"], {}), "(*'XVID')\n", (4168, 4177), False, 'import cv2, time\n'), ((4272, 4287), 'keras.backend.get_ses... |
# AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/00_core.ipynb (unless otherwise specified).
__all__ = ['demo_code', 'hw_cairo', 'surface_to_npy', 'surface_to_PIL', 'display_surface', 'RepeatedTimer']
# Cell
def demo_code():
return 'demo'
# Cell
import cairocffi as cairo
from IPython.display import Image, d... | [
"threading.Timer",
"cairocffi.Context",
"numpy.frombuffer",
"cairocffi.ImageSurface",
"numpy.reshape",
"IPython.display.clear_output",
"IPython.display.Image"
] | [((482, 531), 'cairocffi.ImageSurface', 'cairo.ImageSurface', (['cairo.FORMAT_ARGB32', '(300)', '(200)'], {}), '(cairo.FORMAT_ARGB32, 300, 200)\n', (500, 531), True, 'import cairocffi as cairo\n'), ((546, 568), 'cairocffi.Context', 'cairo.Context', (['surface'], {}), '(surface)\n', (559, 568), True, 'import cairocffi a... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 15 01:57:14 2020
@author: <NAME>
"""
import soundfile as sf
import numpy as np
import scipy.fftpack
import scipy.io.wavfile
import scipy.signal
import argparse
import os
import torch
from src.model.Patch_CNN import KitModel
def read_file(filename: str) -> (np.array, int... | [
"numpy.shape",
"numpy.random.randint",
"numpy.arange",
"numpy.linalg.norm",
"os.path.join",
"numpy.pad",
"torch.utils.data.DataLoader",
"numpy.power",
"numpy.fft.fft",
"numpy.max",
"numpy.remainder",
"numpy.log2",
"numpy.mod",
"numpy.dot",
"numpy.concatenate",
"torch.from_numpy",
"nu... | [((2935, 2972), 'numpy.dot', 'np.dot', (['freq_band_transformation', 'tfr'], {}), '(freq_band_transformation, tfr)\n', (2941, 2972), True, 'import numpy as np\n'), ((4005, 4043), 'numpy.dot', 'np.dot', (['freq_band_transformation', 'ceps'], {}), '(freq_band_transformation, ceps)\n', (4011, 4043), True, 'import numpy as... |
import hepdata_lib
from hepdata_lib import Submission
#Creating the Submission
submission = Submission()
submission.read_abstract("/afs/cern.ch/user/t/tuos/work/private/hepdata/hin17005_abstract.txt")
submission.add_link("Webpage with all figures and tables", "https://cms-results.web.cern.ch/cms-results/public-results... | [
"hepdata_lib.Variable",
"hepdata_lib.Uncertainty",
"numpy.loadtxt",
"hepdata_lib.Table",
"hepdata_lib.Submission"
] | [((93, 105), 'hepdata_lib.Submission', 'Submission', ([], {}), '()\n', (103, 105), False, 'from hepdata_lib import Submission\n'), ((614, 668), 'hepdata_lib.Table', 'Table', (['"""Figure 1 v422 at 5.02 TeV in 0-20% centrality"""'], {}), "('Figure 1 v422 at 5.02 TeV in 0-20% centrality')\n", (619, 668), False, 'from hep... |
import tensorflow as tf
import numpy as np
import gym
from oned import OneDProblem
from atari import AtariProblem
def copy_trainable_vars(to_model, from_model):
to_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope=to_model.name)
from_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, sco... | [
"atari.AtariProblem",
"tensorflow.reduce_sum",
"numpy.sum",
"numpy.abs",
"tensorflow.get_collection",
"random.sample",
"numpy.mean",
"tensorflow.InteractiveSession",
"tensorflow.reduce_max",
"tensorflow.one_hot",
"tensorflow.placeholder",
"numpy.max",
"numpy.random.choice",
"tensorflow.glo... | [((176, 248), 'tensorflow.get_collection', 'tf.get_collection', (['tf.GraphKeys.TRAINABLE_VARIABLES'], {'scope': 'to_model.name'}), '(tf.GraphKeys.TRAINABLE_VARIABLES, scope=to_model.name)\n', (193, 248), True, 'import tensorflow as tf\n'), ((265, 339), 'tensorflow.get_collection', 'tf.get_collection', (['tf.GraphKeys.... |
#!/usr/bin/python
import sys
import numpy as np
import shapely.geometry as geo
from modules import bag
class Run:
'''
a class for storing the bag file contents of one (simulation) run with multiple UAVs
'''
def __init__(self, folder, bag_files, launch_file, area_poly):
'''
initiali... | [
"numpy.abs",
"modules.bag.Bag",
"numpy.mean",
"sys.stdout.flush"
] | [((2636, 2671), 'numpy.mean', 'np.mean', (['[b.fov for b in self.bags]'], {}), '([b.fov for b in self.bags])\n', (2643, 2671), True, 'import numpy as np\n'), ((762, 794), 'modules.bag.Bag', 'bag.Bag', (['folder', 'bf', 'launch_file'], {}), '(folder, bf, launch_file)\n', (769, 794), False, 'from modules import bag\n'), ... |
# -*- coding: utf-8 -*-
import os
import cv2 as cv
import time
import numpy as np
from concurrent.futures import ThreadPoolExecutor
from skimage.measure import compare_ssim
EXT = ['.jpg', '.jpeg']
path = r'C:\Users\sml2h\Desktop\sb'
codes = [item.split("_")[0].lower() for item in os.listdir(path)]
codes = list(set(co... | [
"os.remove",
"skimage.measure.compare_ssim",
"numpy.fromfile",
"time.sleep",
"concurrent.futures.ThreadPoolExecutor",
"os.path.join",
"os.listdir"
] | [((400, 416), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (410, 416), False, 'import os\n'), ((1430, 1464), 'concurrent.futures.ThreadPoolExecutor', 'ThreadPoolExecutor', ([], {'max_workers': '(30)'}), '(max_workers=30)\n', (1448, 1464), False, 'from concurrent.futures import ThreadPoolExecutor\n'), ((283, ... |
import time
import cv2
import numpy as np
video = 'AV9_14.MOV'
timers = {}
# init video capture with video
cap = cv2.VideoCapture(video)
# get default video FPS
fps = cap.get(cv2.CAP_PROP_FPS)
# get total number of video frames
num_frames = cap.get(cv2.CAP_PROP_FRAME_COUNT)
count = cv2.cuda.getCudaEnabledDeviceCou... | [
"cv2.cuda_FarnebackOpticalFlow.calc",
"cv2.cuda.cartToPolar",
"numpy.zeros_like",
"numpy.ones_like",
"cv2.cvtColor",
"cv2.cuda_GpuMat",
"cv2.cuda.resize",
"cv2.cuda.split",
"time.time",
"cv2.VideoCapture",
"cv2.cuda_FarnebackOpticalFlow.create",
"cv2.cuda.merge",
"cv2.cuda.cvtColor",
"cv2.... | [((115, 138), 'cv2.VideoCapture', 'cv2.VideoCapture', (['video'], {}), '(video)\n', (131, 138), False, 'import cv2\n'), ((288, 324), 'cv2.cuda.getCudaEnabledDeviceCount', 'cv2.cuda.getCudaEnabledDeviceCount', ([], {}), '()\n', (322, 324), False, 'import cv2\n'), ((1140, 1151), 'time.time', 'time.time', ([], {}), '()\n'... |
#!/usr/bin/env python -W ignore
import numpy as np
from scipy import integrate
import matplotlib
import matplotlib.pyplot as plt
from math import pi
from typing import Callable, List
def scalar_product_int(f1: Callable[[float], float], f2: Callable[[float], float],
a: float, b: float, rho: Callable[[float], floa... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.linalg.solve",
"matplotlib.rcParams.update",
"numpy.linspace",
"numpy.arccos",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend",
"numpy.linalg.inv",
"numpy.dot",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.grid... | [((10939, 10984), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 20}"], {}), "({'font.size': 20})\n", (10965, 10984), False, 'import matplotlib\n'), ((1654, 1675), 'numpy.linalg.solve', 'np.linalg.solve', (['a', 'b'], {}), '(a, b)\n', (1669, 1675), True, 'import numpy as np\n'), ((7237, 72... |
import numpy as np
class LabelMap:
def __init__(self):
self.map = {}
self.reverse_map = []
self.label_count = 0
def transform(self, label):
label = as_argmax(label)
if label in self.map:
return self.map[label]
else:
self.map[labe... | [
"numpy.append",
"numpy.array",
"numpy.vstack",
"numpy.argmax"
] | [((1507, 1519), 'numpy.argmax', 'np.argmax', (['y'], {}), '(y)\n', (1516, 1519), True, 'import numpy as np\n'), ((1571, 1582), 'numpy.array', 'np.array', (['z'], {}), '(z)\n', (1579, 1582), True, 'import numpy as np\n'), ((1752, 1765), 'numpy.array', 'np.array', (['[y]'], {}), '([y])\n', (1760, 1765), True, 'import num... |
import numpy as np
from ..np_utils import grid_anchor_generator, anchor_generator
class MultipleGridAnchorGenerator(anchor_generator.AnchorGenerator):
"""Generate a grid of anchors for multiple CNN layers."""
def __init__(self,
box_specs_list,
base_anchor_size=None,
... | [
"numpy.minimum",
"numpy.ones",
"numpy.sqrt"
] | [((4522, 4553), 'numpy.minimum', 'np.minimum', (['im_height', 'im_width'], {}), '(im_height, im_width)\n', (4532, 4553), True, 'import numpy as np\n'), ((5640, 5671), 'numpy.ones', 'np.ones', (['[num_anchors_in_layer]'], {}), '([num_anchors_in_layer])\n', (5647, 5671), True, 'import numpy as np\n'), ((7471, 7498), 'num... |
import numpy as np
import cv2
import math
import cv2.cv as cv
from itertools import tee, izip
WHITE = (255, 255, 255)
BLUE = (255, 0, 0)
GREEN = (0, 255, 0)
RED = (0, 0, 255)
def project(pt, imgsize):
center = imgsize / 2
(x, y, z) = pt
return (int(z * 1.414 / 2 + x + center), int (center -(z * 1.414 /2 +... | [
"cv2.waitKey",
"numpy.zeros",
"itertools.izip",
"itertools.tee",
"cv2.imshow"
] | [((1895, 1928), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uint8)\n', (1903, 1928), True, 'import numpy as np\n'), ((2304, 2328), 'cv2.imshow', 'cv2.imshow', (['"""Image"""', 'img'], {}), "('Image', img)\n", (2314, 2328), False, 'import cv2\n'), ((2329, 2346), 'cv2.waitKey', 'cv... |
"""
Created on Mon Oct 5 2020
@author: <NAME>
GitHub username: esgomezm
"""
import numpy as np
def index_from_pdf(pdf_im):
prob = np.copy(pdf_im)
# Normalize values to create a pdf with sum = 1
prob = prob.ravel() / np.sum(prob)
# Convert into a 1D pdf
choices = np.prod(pdf_im.shape... | [
"numpy.sum",
"numpy.abs",
"numpy.copy",
"numpy.random.seed",
"numpy.floor",
"numpy.unravel_index",
"numpy.ones",
"numpy.random.choice",
"numpy.round",
"numpy.prod"
] | [((147, 162), 'numpy.copy', 'np.copy', (['pdf_im'], {}), '(pdf_im)\n', (154, 162), True, 'import numpy as np\n'), ((300, 321), 'numpy.prod', 'np.prod', (['pdf_im.shape'], {}), '(pdf_im.shape)\n', (307, 321), True, 'import numpy as np\n'), ((335, 376), 'numpy.random.choice', 'np.random.choice', (['choices'], {'size': '(... |
import matplotlib.pyplot as plt
import numpy as np
def quadratic(var):
return 2*pow(var, 2)
x = np.arange(0, 6, 1)
plt.plot(x, quadratic(x))
plt.plot([1, 4], [quadratic(1), quadratic(4)], linewidth=2.0)
plt.plot([1, 4], [quadratic(1), quadratic(1)], linewidth=3.0, label="Change in x")
plt.plot([4, 4], [quadratic... | [
"matplotlib.pyplot.legend",
"numpy.arange",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((103, 121), 'numpy.arange', 'np.arange', (['(0)', '(6)', '(1)'], {}), '(0, 6, 1)\n', (112, 121), True, 'import numpy as np\n'), ((377, 389), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (387, 389), True, 'import matplotlib.pyplot as plt\n'), ((390, 413), 'matplotlib.pyplot.plot', 'plt.plot', (['x', '(1... |
from flask import Blueprint
from app.models.user import User
from app.models.tweet import Tweet
import numpy as np
from sklearn.linear_model import SGDClassifier
from skl2onnx import convert_sklearn
from skl2onnx.common.data_types import FloatTensorType
import onnxruntime as rt
from app.api.basilica import BASILICA
fro... | [
"flask.Blueprint",
"app.models.user.User.query.all",
"sklearn.linear_model.SGDClassifier",
"app.forms.PredictTweetForm.PredictTweetForm",
"numpy.hstack",
"onnxruntime.InferenceSession",
"skl2onnx.common.data_types.FloatTensorType",
"numpy.mean",
"skl2onnx.convert_sklearn",
"flask.render_template",... | [((517, 547), 'flask.Blueprint', 'Blueprint', (['"""predict"""', '__name__'], {}), "('predict', __name__)\n", (526, 547), False, 'from flask import Blueprint\n'), ((630, 648), 'app.forms.PredictTweetForm.PredictTweetForm', 'PredictTweetForm', ([], {}), '()\n', (646, 648), False, 'from app.forms.PredictTweetForm import ... |
'''
本模块储存了蒙特卡洛模拟、遗传算法、模拟退火算法和梯度下降算法,用于简易模拟
This module stores Monte Carlo, Genetic Algorithm, Simulated Annealing Algorithm and Gradient Descent Algorithm for simple simulation
'''
import random
import numpy as np
from multiprocessing import Pool, cpu_count
from maysics.calculus import grad
class MC():
'''
蒙... | [
"numpy.random.seed",
"maysics.calculus.grad",
"numpy.ones",
"numpy.mean",
"numpy.random.randint",
"multiprocessing.cpu_count",
"random.randint",
"numpy.max",
"numpy.var",
"numpy.ones_like",
"random.random",
"numpy.min",
"multiprocessing.Pool",
"numpy.argwhere",
"numpy.delete",
"numpy.c... | [((2039, 2067), 'numpy.random.seed', 'np.random.seed', (['random_state'], {}), '(random_state)\n', (2053, 2067), True, 'import numpy as np\n'), ((7765, 7792), 'numpy.mean', 'np.mean', (['final_propability_'], {}), '(final_propability_)\n', (7772, 7792), True, 'import numpy as np\n'), ((7811, 7837), 'numpy.var', 'np.var... |
import collections as col
import itertools as itt
import logging
import pathlib as pl
import re
import numpy as np
import pandas as pd
from scipy.io import loadmat
from nems import epoch as nep
from nems.signal import TiledSignal
log = logging.getLogger(__name__)
def define_quilt_orders(folder='/auto/users/mateo/b... | [
"pandas.DataFrame",
"scipy.io.loadmat",
"numpy.empty",
"re.match",
"collections.defaultdict",
"numpy.sort",
"pathlib.Path",
"numpy.mean",
"numpy.where",
"nems.signal.TiledSignal",
"nems.epoch.epoch_names_matching",
"pandas.concat",
"logging.getLogger",
"numpy.in1d"
] | [((239, 266), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (256, 266), False, 'import logging\n'), ((863, 878), 'pathlib.Path', 'pl.Path', (['folder'], {}), '(folder)\n', (870, 878), True, 'import pathlib as pl\n'), ((1408, 1429), 'collections.defaultdict', 'col.defaultdict', (['dict'],... |
"""Sinus Hyperbolic."""
import numpy
from ..baseclass import Dist
from .. import evaluation, approximation
class Sinh(Dist):
"""
Sinus Hyperbolic.
Args:
dist (Dist): Distribution to perform transformation on.
Example:
>>> distribution = chaospy.Sinh(chaospy.Uniform(0, 1))
>>>... | [
"numpy.arcsinh",
"numpy.sqrt"
] | [((1318, 1339), 'numpy.sqrt', 'numpy.sqrt', (['(1 + x * x)'], {}), '(1 + x * x)\n', (1328, 1339), False, 'import numpy\n'), ((1422, 1438), 'numpy.arcsinh', 'numpy.arcsinh', (['x'], {}), '(x)\n', (1435, 1438), False, 'import numpy\n'), ((1287, 1303), 'numpy.arcsinh', 'numpy.arcsinh', (['x'], {}), '(x)\n', (1300, 1303), ... |
import numpy as np
import casadi as cs
from urdf_parser_py.urdf import URDF, Pose
import urdf2casadi.urdfparser as u2c
root = "calib_kuka_arm_base_link"
tip = "kuka_arm_7_link"
kuka = u2c.URDFparser()
kuka.from_file("../../urdf/kuka.urdf")
jointlist, names, q_max, q_min = kuka.get_joint_info(root, tip)
n_joints = ku... | [
"numpy.random.rand",
"urdf2casadi.urdfparser.URDFparser",
"numpy.zeros",
"casadi.Function"
] | [((186, 202), 'urdf2casadi.urdfparser.URDFparser', 'u2c.URDFparser', ([], {}), '()\n', (200, 202), True, 'import urdf2casadi.urdfparser as u2c\n'), ((454, 472), 'numpy.zeros', 'np.zeros', (['n_joints'], {}), '(n_joints)\n', (462, 472), True, 'import numpy as np\n'), ((808, 824), 'numpy.random.rand', 'np.random.rand', (... |
from glob import glob
from typing import Dict, Tuple, Union, List
import argparse
import csv
import logging
import operator
import os
import re
import json
from pyteomics import mgf
import numpy as np
import pandas as pd
import spectrum_utils.spectrum as sus
class PeptideSpectrumMatch:
"""Peptide spectrum match ... | [
"argparse.ArgumentParser",
"re.finditer",
"matplotlib.pyplot.figure",
"glob.glob",
"os.path.join",
"pyteomics.mgf.MGF",
"numpy.insert",
"re.findall",
"re.sub",
"pandas.concat",
"os.path.basename",
"csv.DictReader",
"pandas.Series",
"seaborn.lmplot",
"json.load",
"logging.debug",
"num... | [((16016, 16041), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (16039, 16041), False, 'import argparse\n'), ((1470, 1512), 're.findall', 're.findall', (['mod_pattern', 'modified_sequence'], {}), '(mod_pattern, modified_sequence)\n', (1480, 1512), False, 'import re\n'), ((2361, 2403), 're.sub'... |
import numpy as np
from lsst.sims.utils import _equatorialFromGalactic
from lsst.sims.maf.plots import BaseSkyMap
from matplotlib.patches import Polygon
class ZTFBaseSkyMap(BaseSkyMap):
def __init__(self, aspect_ratio = 1.0):
super(ZTFBaseSkyMap, self).__init__()
# width / length
self.a... | [
"numpy.radians",
"numpy.broadcast",
"matplotlib.patches.Polygon",
"numpy.sin",
"numpy.arange",
"numpy.cos",
"numpy.arctan",
"lsst.sims.utils._equatorialFromGalactic"
] | [((1369, 1399), 'numpy.broadcast', 'np.broadcast', (['lon', 'lat', 'radius'], {}), '(lon, lat, radius)\n', (1381, 1399), True, 'import numpy as np\n'), ((1947, 1963), 'numpy.radians', 'np.radians', (['(10.0)'], {}), '(10.0)\n', (1957, 1963), True, 'import numpy as np\n'), ((1976, 1992), 'numpy.radians', 'np.radians', (... |
import os
import argparse
import numpy as np
from pylab import *
import matplotlib.pyplot as plt
import matplotlib.image as mgimg
matplotlib.rcParams.update({'font.size': 15})
fig = plt.figure(1, figsize=(20, 10))
axImage = fig.add_subplot(121)
axStruct = fig.add_subplot(122)
M = 128 # size of image
N = 128
... | [
"matplotlib.pyplot.figure",
"numpy.genfromtxt",
"argparse.ArgumentParser",
"numpy.reshape"
] | [((189, 220), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(20, 10)'}), '(1, figsize=(20, 10))\n', (199, 220), True, 'import matplotlib.pyplot as plt\n'), ((353, 418), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""arguments for the CH plots"""'}), "(description='argu... |
import artm
from itertools import combinations
from itertools import product
import numpy as np
import shutil
import tempfile
import pytest
import warnings
from ..cooking_machine.models.topic_model import TopicModel
from ..cooking_machine.experiment import Experiment
from ..cooking_machine.routine import (
W_TOO_... | [
"artm.ARTM",
"shutil.rmtree",
"warnings.filterwarnings",
"pytest.warns",
"itertools.combinations",
"pytest.raises",
"tempfile.mkdtemp",
"numpy.arange",
"warnings.catch_warnings",
"itertools.product",
"pytest.mark.parametrize"
] | [((407, 448), 'artm.ARTM', 'artm.ARTM', ([], {'num_topics': '(1)', 'num_processors': '(1)'}), '(num_topics=1, num_processors=1)\n', (416, 448), False, 'import artm\n'), ((1087, 1130), 'numpy.arange', 'np.arange', (['MIN_SCORE', 'MAX_SCORE', 'SCORE_STEP'], {}), '(MIN_SCORE, MAX_SCORE, SCORE_STEP)\n', (1096, 1130), True,... |
"""
@author: <NAME>
This file is the Fourier Neural Operator for 2D problem such as the Darcy Flow discussed in Section 5.2 in the [paper](https://arxiv.org/pdf/2010.08895.pdf).
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
import ma... | [
"numpy.random.seed",
"chrysalis.Chrysalis.metamorphosize",
"torch.optim.lr_scheduler.LambdaLR",
"torch.utils.data.TensorDataset",
"torch.no_grad",
"numpy.meshgrid",
"torch.nn.Conv1d",
"numpy.linspace",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.functional.relu",
"functools.partial",
"torch.... | [((527, 551), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (542, 551), False, 'import sys\n'), ((629, 649), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (646, 649), False, 'import torch\n'), ((650, 667), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n... |
# Author: <NAME> <<EMAIL>> <<EMAIL>>
# License: BSD 3 clause (C) 2017
# # Visualizing 8x8 digits dataset (from sklearn). Generating linear embedding function and comapring it to weighted
# embedding function. Using it to visualize smooth transition from one value to another.
import sys
import os
from sklearn.datasets... | [
"sklearn.datasets.load_digits",
"os.path.abspath",
"dynamic_tsne.DynamicTSNE",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"numpy.dtype",
"numpy.min",
"numpy.max",
"matplotlib.pyplot.gcf",
"numpy.ascontiguousarray",
"numpy.uniq... | [((579, 592), 'sklearn.datasets.load_digits', 'load_digits', ([], {}), '()\n', (590, 592), False, 'from sklearn.datasets import load_digits\n'), ((994, 1028), 'numpy.unique', 'np.unique', (['temp'], {'return_index': '(True)'}), '(temp, return_index=True)\n', (1003, 1028), True, 'import numpy as np\n'), ((1091, 1130), '... |
import os
from typing import Union, Tuple
import numpy as np
import open3d as o3d
import trimesh
from easy_o3d.utils import get_camera_parameters_from_blenderproc_bopwriter, convert_depth_image_to_point_cloud
from scipy.spatial.transform import Rotation
from src.common import coord2index, normalize_coord, look_at, ge... | [
"numpy.load",
"trimesh.load",
"numpy.arctan2",
"numpy.abs",
"numpy.sum",
"open3d.geometry.PointCloud",
"numpy.ones",
"scipy.spatial.transform.Rotation.random",
"numpy.random.randint",
"numpy.linalg.norm",
"os.path.join",
"src.common.look_at",
"numpy.random.randn",
"os.path.exists",
"src.... | [((2121, 2139), 'numpy.load', 'np.load', (['file_path'], {}), '(file_path)\n', (2128, 2139), True, 'import numpy as np\n'), ((4539, 4557), 'numpy.load', 'np.load', (['file_path'], {}), '(file_path)\n', (4546, 4557), True, 'import numpy as np\n'), ((6420, 6460), 'os.path.join', 'os.path.join', (['model_path', 'self.file... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 5 21:32:52 2017
@author: hsd
"""
import numpy as np
from scipy import stats
from scipy import signal
##################################################
### tools
##################################################
def LongThresCrossing(ts, thres):
cnt = 0
pair_fl... | [
"numpy.abs",
"numpy.argmax",
"numpy.median",
"numpy.std",
"numpy.argmin",
"numpy.percentile",
"scipy.stats.skew",
"numpy.max",
"numpy.mean",
"numpy.array",
"numpy.min",
"scipy.stats.kurtosis",
"numpy.var"
] | [((919, 934), 'numpy.argmin', 'np.argmin', (['ts_s'], {}), '(ts_s)\n', (928, 934), True, 'import numpy as np\n'), ((1331, 1341), 'numpy.var', 'np.var', (['ts'], {}), '(ts)\n', (1337, 1341), True, 'import numpy as np\n'), ((1353, 1367), 'scipy.stats.skew', 'stats.skew', (['ts'], {}), '(ts)\n', (1363, 1367), False, 'from... |
import numpy as np
import torch
from net import Net
from generator import Generator
import utils
from PIL import Image
SIZE = (40, 40)
MARGIN = 1
NOISE = 0.1
MAX_LENGTH = 5
# DEVICE = torch.device('cuda:0')
DEVICE = torch.device('cpu')
np.set_printoptions(threshold=np.inf, precision=4, suppress=True, linewidth=16... | [
"numpy.set_printoptions",
"torch.load",
"numpy.ones",
"net.Net",
"numpy.array",
"torch.device",
"PIL.Image.fromarray",
"generator.Generator",
"numpy.concatenate"
] | [((221, 240), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (233, 240), False, 'import torch\n'), ((242, 327), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf', 'precision': '(4)', 'suppress': '(True)', 'linewidth': '(160)'}), '(threshold=np.inf, precision=4, suppress=Tru... |
# Copyright 2021 Institute of Advanced Research in Artificial Intelligence (IARAI) GmbH.
# IARAI licenses this file to You 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/li... | [
"torch.nn.functional.mse_loss",
"numpy.count_nonzero",
"numpy.subtract",
"torch.from_numpy"
] | [((3454, 3476), 'numpy.count_nonzero', 'np.count_nonzero', (['mask'], {}), '(mask)\n', (3470, 3476), True, 'import numpy as np\n'), ((1736, 1763), 'torch.from_numpy', 'torch.from_numpy', (['actual[:]'], {}), '(actual[:])\n', (1752, 1763), False, 'import torch\n'), ((1789, 1818), 'torch.from_numpy', 'torch.from_numpy', ... |
from mpi4py import MPI
import numpy as np
class MpiFitnessCaller:
"""
Fitness caller used for MPI parallelism.
Arguments
---------
comm : mpi4py comm object
Comm object from mpi4py
"""
def __init__(self, comm):
self.comm = comm
self.tasks = []
self.num_w... | [
"mpi4py.MPI.Status",
"numpy.zeros"
] | [((1380, 1392), 'mpi4py.MPI.Status', 'MPI.Status', ([], {}), '()\n', (1390, 1392), False, 'from mpi4py import MPI\n'), ((1793, 1822), 'numpy.zeros', 'np.zeros', (['(1)'], {'dtype': 'np.float64'}), '(1, dtype=np.float64)\n', (1801, 1822), True, 'import numpy as np\n'), ((3159, 3171), 'mpi4py.MPI.Status', 'MPI.Status', (... |
"""Daycount calculations, Schedule creation, and so on.
Only a small number of required daycount conventions are included here.
For full list, see the following:
https://developers.opengamma.com/quantitative-research/Interest-Rate-Instruments-and-Market-Conventions.pdf
"""
from __future__ import absolute_import, divis... | [
"pandas.date_range",
"pandas.tseries.offsets.DateOffset",
"pandas.DatetimeIndex",
"numpy.timedelta64",
"pandas.to_datetime",
"pandas.Series",
"pandas.DateOffset"
] | [((2542, 2578), 'pandas.date_range', 'pd.date_range', (['start', 'end'], {'freq': 'freq'}), '(start, end, freq=freq)\n', (2555, 2578), True, 'import pandas as pd\n'), ((2892, 2931), 'pandas.tseries.offsets.DateOffset', 'pd.tseries.offsets.DateOffset', ([], {}), '(**kwargs)\n', (2921, 2931), True, 'import pandas as pd\n... |
#!/usr/bin/env python
# −*− coding: UTF−8 −*−
from __future__ import division
import unittest
import pytest
from odelab.system.graph import QuasiGraphSystem, GraphSystem
from odelab.solver import Solver
Solver.catch_runtime = False
from odelab.scheme.rungekutta import RKDAE
import odelab.scheme.rungekutta as RK
impo... | [
"odelab.system.graph.QuasiGraphSystem",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.title",
"numpy.abs",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"odelab.system.graph.GraphSystem",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.cos",
"odelab.orde... | [((423, 432), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (429, 432), True, 'import numpy as np\n'), ((456, 465), 'numpy.cos', 'np.cos', (['x'], {}), '(x)\n', (462, 465), True, 'import numpy as np\n'), ((896, 918), 'odelab.system.graph.QuasiGraphSystem', 'QuasiGraphSystem', (['fsin'], {}), '(fsin)\n', (912, 918), Fals... |
import textwrap
import astropy.units as u
import numpy as np
from astropy.coordinates import SkyCoord
from astropy.io import fits
from astropy.time import Time, TimeDelta
from astropy.wcs import WCS
from ndcube import Meta, NDCollection
from sunpy.coordinates import Helioprojective
from sunraster import RasterSequenc... | [
"textwrap.dedent",
"astropy.time.Time",
"ndcube.NDCollection",
"numpy.asarray",
"astropy.units.def_unit",
"astropy.time.TimeDelta",
"astropy.wcs.WCS",
"sunraster.RasterSequence",
"numpy.array",
"astropy.io.fits.open",
"sunraster.SpectrogramCube",
"astropy.coordinates.SkyCoord",
"numpy.in1d"
... | [((624, 711), 'astropy.units.def_unit', 'u.def_unit', (['"""DN_IRIS_NUV"""', "(DETECTOR_GAIN['NUV'] / DETECTOR_YIELD['NUV'] * u.photon)"], {}), "('DN_IRIS_NUV', DETECTOR_GAIN['NUV'] / DETECTOR_YIELD['NUV'] * u.\n photon)\n", (634, 711), True, 'import astropy.units as u\n'), ((719, 806), 'astropy.units.def_unit', 'u.... |
import glob
import numpy as np
import json
import time
import datetime
import os
#create test batches used during training
def create_test_data(test_json_path,test_data_path,batch_creator,num_spkrs_in_batch,num_utts_per_spkr,num_batches):
# if batches npy already exist, simply load them
test_data_list = glob.... | [
"numpy.load",
"json.load",
"os.remove",
"datetime.datetime.now",
"time.time",
"numpy.random.choice",
"glob.glob",
"os.path.join"
] | [((315, 356), 'glob.glob', 'glob.glob', (["(test_data_path + '/batch*.npy')"], {}), "(test_data_path + '/batch*.npy')\n", (324, 356), False, 'import glob\n'), ((1325, 1411), 'numpy.random.choice', 'np.random.choice', (['spkr_list'], {'size': '(num_spkrs_in_batch * num_batches)', 'replace': '(False)'}), '(spkr_list, siz... |
#! /usr/bin/env python
from __future__ import print_function
from timeit import default_timer as time
import sys
import numpy as np
from numba import dppl
import dpctl
@dppl.kernel
def data_parallel_sum(a, b, c):
i = dppl.get_global_id(0)
c[i] = a[i] + b[i]
def driver(a, b, c, global_size):
print("befo... | [
"numpy.ones_like",
"dpctl.device_context",
"numpy.random.random",
"numba.dppl.get_global_id",
"dpctl.has_gpu_queues",
"dpctl.has_cpu_queues"
] | [((224, 245), 'numba.dppl.get_global_id', 'dppl.get_global_id', (['(0)'], {}), '(0)\n', (242, 245), False, 'from numba import dppl\n'), ((671, 686), 'numpy.ones_like', 'np.ones_like', (['a'], {}), '(a)\n', (683, 686), True, 'import numpy as np\n'), ((695, 717), 'dpctl.has_gpu_queues', 'dpctl.has_gpu_queues', ([], {}), ... |
import math
import random
import time
import numpy as np
class QAP(object):
def __init__(self, file=None, pop_size=100, gen=100, p_x=0.7, p_m=0.1, tour=5, use_tour=False):
self.pop_size = pop_size
self.gen = gen
self.p_x = p_x
self.p_m = p_m
self.tour = tour
self.... | [
"numpy.sum",
"numpy.amin",
"numpy.put",
"numpy.empty",
"numpy.argmin",
"numpy.random.randint",
"numpy.arange",
"numpy.copy",
"numpy.append",
"numpy.random.shuffle",
"numpy.average",
"numpy.asarray",
"random.random",
"numpy.zeros",
"time.time",
"numpy.amax",
"numpy.random.random",
"... | [((1964, 1976), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1972, 1976), True, 'import numpy as np\n'), ((2006, 2018), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (2014, 2018), True, 'import numpy as np\n'), ((2046, 2058), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (2054, 2058), True, 'import num... |
import numpy as np
from scipy.spatial import distance
import cv2
import math
import image_preprocess as IMG
import time
from Lidar_tools import edge_detect, polar_to_cartesian, interpolation, find_lidar_theta_phi_from_coord_Ma
from Lidar_tools_AG import build_roatation_matrix_3D, coords_ro_move
class ... | [
"Lidar_tools.polar_to_cartesian",
"numpy.sum",
"Lidar_tools_AG.coords_ro_move",
"numpy.sin",
"cv2.normalize",
"Lidar_tools_AG.build_roatation_matrix_3D",
"numpy.round",
"numpy.zeros_like",
"cv2.cvtColor",
"Lidar_tools.edge_detect",
"numpy.max",
"math.cos",
"numpy.arccos",
"Lidar_tools.inte... | [((1243, 1255), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1251, 1255), True, 'import numpy as np\n'), ((1296, 1308), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1304, 1308), True, 'import numpy as np\n'), ((1346, 1358), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1354, 1358), True, 'import num... |
import tensorflow as tf
import const, inference, train, process
import matplotlib.pyplot as plt
import numpy as np
IMAGE_ORDER = 5
'''
read only one testing datum
'''
def get_datum(order):
fp = open(const.TEST_PATH)
for i in range(order):
fp.readline()
test_x = []
test_y = []
line = fp.r... | [
"matplotlib.pyplot.show",
"tensorflow.train.Saver",
"tensorflow.argmax",
"tensorflow.global_variables_initializer",
"tensorflow.reshape",
"tensorflow.Session",
"inference.inference",
"tensorflow.placeholder",
"tensorflow.Variable",
"numpy.reshape",
"tensorflow.app.run",
"tensorflow.train.get_c... | [((573, 689), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, const.IMAGE_HEIGHT, const.IMAGE_WIDTH, const.NUM_CHANNELS]', '"""predict_x-input"""'], {}), "(tf.float32, [None, const.IMAGE_HEIGHT, const.IMAGE_WIDTH,\n const.NUM_CHANNELS], 'predict_x-input')\n", (587, 689), True, 'import tensorflow ... |
import cv2
import numpy as np
import requests
from PIL import Image
# import pyocr
import pytesseract
import io
import re
import os
class image_process:
def __init__(self):
self.input_img = None
self.result_img = None
self.id_recog_result_img = None
self.result_img_... | [
"io.BytesIO",
"cv2.bitwise_and",
"cv2.countNonZero",
"cv2.cvtColor",
"cv2.threshold",
"cv2.imdecode",
"cv2.blur",
"re.sub",
"cv2.imread",
"cv2.rectangle",
"numpy.where",
"numpy.array",
"requests.get",
"cv2.imencode",
"PIL.Image.fromarray",
"cv2.inRange",
"cv2.resize",
"cv2.matchTem... | [((850, 885), 'cv2.imdecode', 'cv2.imdecode', (['img', 'cv2.IMREAD_COLOR'], {}), '(img, cv2.IMREAD_COLOR)\n', (862, 885), False, 'import cv2\n'), ((912, 941), 'cv2.resize', 'cv2.resize', (['img', '(1920, 1080)'], {}), '(img, (1920, 1080))\n', (922, 941), False, 'import cv2\n'), ((1127, 1153), 'cv2.imread', 'cv2.imread'... |
# -*- coding: utf-8 -*-
"""
自动化最优分箱工具
Create Date 2020.11.27
"""
import pandas as pd
import numpy as np
from sklearn.utils.multiclass import type_of_target
def _check_target_binary(y):
"""
check if the target variable is binary
------------------------------
Param
y:exog variable,pandas Series co... | [
"pandas.DataFrame",
"pandas.crosstab",
"numpy.log",
"numpy.empty",
"pandas.merge",
"numpy.isnan",
"pandas.read_excel",
"numpy.percentile",
"sklearn.utils.multiclass.type_of_target",
"numpy.where",
"numpy.array",
"pandas.Series",
"pandas.concat",
"numpy.in1d"
] | [((448, 465), 'sklearn.utils.multiclass.type_of_target', 'type_of_target', (['y'], {}), '(y)\n', (462, 465), False, 'from sklearn.utils.multiclass import type_of_target\n'), ((738, 749), 'numpy.isnan', 'np.isnan', (['x'], {}), '(x)\n', (746, 749), True, 'import numpy as np\n'), ((1620, 1654), 'pandas.Series', 'pd.Serie... |
import collections
import numpy as np
import pandas as pd
from . import columns_to_transform, transform_ta
def moving_min(df, columns, window = '365d', win_type = None, append = False, trans_methods = None):
columns = columns_to_transform(df, columns)
tmp0 = df[columns]
tmp = tmp0.rolling(window, win_t... | [
"numpy.dot",
"numpy.sum"
] | [((2843, 2858), 'numpy.sum', 'np.sum', (['weights'], {}), '(weights)\n', (2849, 2858), True, 'import numpy as np\n'), ((2931, 2949), 'numpy.dot', 'np.dot', (['x', 'weights'], {}), '(x, weights)\n', (2937, 2949), True, 'import numpy as np\n')] |
"""Unit and regression test for the uq_utils module."""
import numpy as np
import pandas as pd
import pytest
import candle
@pytest.mark.parametrize("N", [100, 1000])
def test1_frac_distribution(N):
trf = np.random.rand(1)
vf = 0.0
ttf = 1.0 - trf
config = {"uq_train_fr": trf, "uq_valid_fr": vf, "uq_... | [
"pandas.DataFrame",
"candle.generate_index_distribution",
"candle.split_data_for_empirical_calibration",
"numpy.random.randn",
"candle.compute_statistics_heteroscedastic",
"candle.compute_statistics_homoscedastic_summary",
"candle.compute_statistics_quantile",
"pytest.raises",
"candle.compute_statis... | [((128, 169), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""N"""', '[100, 1000]'], {}), "('N', [100, 1000])\n", (151, 169), False, 'import pytest\n'), ((694, 735), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""N"""', '[100, 1000]'], {}), "('N', [100, 1000])\n", (717, 735), False, 'import pyt... |
import sys
import numpy as np
from PyQt5 import QtWidgets as qtw
from PyQt5 import QtGui as qtg
from PyQt5 import QtCore as qtc
import pyqtgraph as pg
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
def rand(n):
data = np.random.random(n)
data[int(n*0.1):int(n*0.13)] += .5
da... | [
"pyqtgraph.setConfigOption",
"PyQt5.QtWidgets.QVBoxLayout",
"numpy.random.random",
"numpy.real",
"pyqtgraph.PlotWidget"
] | [((153, 190), 'pyqtgraph.setConfigOption', 'pg.setConfigOption', (['"""background"""', '"""w"""'], {}), "('background', 'w')\n", (171, 190), True, 'import pyqtgraph as pg\n'), ((191, 228), 'pyqtgraph.setConfigOption', 'pg.setConfigOption', (['"""foreground"""', '"""k"""'], {}), "('foreground', 'k')\n", (209, 228), True... |
import numpy as np
import pandas as pd
import warnings
import sidekit
import tqdm
import argparse
warnings.filterwarnings('ignore')
def get_args():
parser = argparse.ArgumentParser(description = 'some utils for preprocess and score')
parser.add_argument('--enroll',
type = str,
... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"warnings.filterwarnings",
"pandas.read_csv",
"numpy.empty",
"numpy.asarray",
"numpy.savetxt",
"sidekit.IdMap",
"numpy.array",
"numpy.linspace",
"sidekit.Scores"
] | [((98, 131), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (121, 131), False, 'import warnings\n'), ((162, 236), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""some utils for preprocess and score"""'}), "(description='some utils for preproc... |
from pacman.exceptions import PacmanInvalidParameterException
from pacman.exceptions import PacmanConfigurationException
from pacman.exceptions import PacmanValueError
from pacman.model.constraints.abstract_constraints.\
abstract_placer_constraint \
import AbstractPlacerConstraint
from pacman.model.constraints... | [
"numpy.asarray",
"numpy.zeros",
"numpy.packbits",
"pacman.exceptions.PacmanValueError",
"pacman.exceptions.PacmanInvalidParameterException",
"pacman.exceptions.PacmanConfigurationException"
] | [((9615, 9645), 'numpy.zeros', 'numpy.zeros', (['(32)'], {'dtype': '"""uint8"""'}), "(32, dtype='uint8')\n", (9626, 9645), False, 'import numpy\n'), ((5369, 5433), 'pacman.exceptions.PacmanValueError', 'PacmanValueError', (['"""Multiple constraints with conflicting values"""'], {}), "('Multiple constraints with conflic... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2020 MeteoSwiss, contributors listed in AUTHORS.
Distributed under the terms of the BSD 3-Clause License.
SPDX-License-Identifier: BSD-3-Clause
This file contains test functions for the mk_stats module.
"""
# Import from python packages
from datetime import datetime
import ... | [
"mannkendall.mk_stats.std_normal_var",
"mannkendall.mk_stats.s_test",
"numpy.array",
"mannkendall.mk_stats.sen_slope",
"numpy.round"
] | [((929, 967), 'mannkendall.mk_stats.std_normal_var', 'mks.std_normal_var', (['test_in1', 'test_in2'], {}), '(test_in1, test_in2)\n', (947, 967), True, 'from mannkendall import mk_stats as mks\n'), ((1710, 1744), 'mannkendall.mk_stats.s_test', 'mks.s_test', (['test_in1', 'test_in2_dts'], {}), '(test_in1, test_in2_dts)\n... |
#!/usr/bin/env python
"""The WaveBlocks Project
Plot the energies of the different wavepackets as well as the sum of all energies.
@author: <NAME>
@copyright: Copyright (C) 2010, 2011, 2012, 2014, 2016 <NAME>
@license: Modified BSD License
"""
import argparse
import os
from functools import reduce
from numpy import ... | [
"os.path.abspath",
"numpy.abs",
"argparse.ArgumentParser",
"matplotlib.pyplot.close",
"os.path.exists",
"numpy.nanmin",
"WaveBlocksND.IOManager",
"matplotlib.pyplot.figure",
"numpy.where",
"WaveBlocksND.Plot.legend",
"functools.reduce",
"os.path.join",
"numpy.nanmax"
] | [((1786, 1818), 'numpy.where', 'where', (['(timegridk < 0)', 'nan', 'timek'], {}), '(timegridk < 0, nan, timek)\n', (1791, 1818), False, 'from numpy import abs, add, where, nan, nanmax, nanmin\n'), ((1831, 1863), 'numpy.where', 'where', (['(timegridp < 0)', 'nan', 'timep'], {}), '(timegridp < 0, nan, timep)\n', (1836, ... |
import glob
import pathlib
import math
import traceback as tb
from typing import Tuple, List, Union
import pandas as pd
from tqdm.auto import tqdm
import cv2
import numpy as np
from scipy.spatial.transform import Rotation
from insightface.app import FaceAnalysis
from yadil.image.face_model import model... | [
"pandas.DataFrame",
"traceback.print_tb",
"pandas.read_csv",
"yadil.image.utils.shift_centroid_to_origin",
"numpy.float32",
"scipy.spatial.transform.Rotation.align_vectors",
"cv2.warpAffine",
"pathlib.Path",
"cv2.imread",
"numpy.linalg.norm",
"numpy.matmul",
"glob.glob",
"insightface.app.Fac... | [((629, 653), 'yadil.image.utils.shift_centroid_to_origin', 'shift_to_o', (['model_points'], {}), '(model_points)\n', (639, 653), True, 'from yadil.image.utils import shift_centroid_to_origin as shift_to_o\n'), ((663, 835), 'insightface.app.FaceAnalysis', 'FaceAnalysis', ([], {'allowed_modules': "['detection', 'gendera... |
import random
from flask import render_template, jsonify
from flask_login import login_required
import pandas as pd
from . import graph
import numpy as np
from scipy.integrate import simps
from numpy import trapz
import datetime
@graph.route('/graph')
def graph():
# tone_data = pd.read_csv('tone_data')
val... | [
"datetime.timedelta",
"flask.render_template",
"numpy.math.floor",
"datetime.datetime.now",
"pandas.concat",
"scipy.integrate.simps"
] | [((365, 431), 'flask.render_template', 'render_template', (['"""graph/output.html"""'], {'values': 'values', 'labels': 'labels'}), "('graph/output.html', values=values, labels=labels)\n", (380, 431), False, 'from flask import render_template, jsonify\n'), ((1623, 1666), 'pandas.concat', 'pd.concat', (['multiple_tone'],... |
""" The MIT License (MIT)
Copyright (c) 2015 <NAME>, University of Massachusetts
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 ... | [
"sdl2.ext.Color",
"sdl2.ext.quit",
"sdl2.SDL_RenderCopy",
"numpy.linalg.norm",
"os.path.join",
"sys.path.append",
"sdl2.sdlgfx.filledTrigonRGBA",
"sdl2.ext.Renderer",
"math.cos",
"sdl2.ext.Window",
"sdl2.SDL_DestroyTexture",
"os.path.realpath",
"sdl2.SDL_SetRenderTarget",
"sdl2.sdlgfx.boxR... | [((1406, 1435), 'sys.path.append', 'sys.path.append', (['thisFilePath'], {}), '(thisFilePath)\n', (1421, 1435), False, 'import sys\n'), ((1378, 1404), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (1394, 1404), False, 'import os\n'), ((1474, 1519), 'os.path.join', 'os.path.join', (['thisFi... |
import os
import numpy as np
import torch
import torchvision
import argparse
# distributed training
import torch.distributed as dist
import torch.multiprocessing as mp
from torch.nn.parallel import DataParallel
from torch.nn.parallel import DistributedDataParallel as DDP
# TensorBoard
from torch.utils.tensorboard imp... | [
"os.mkdir",
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.argmax",
"dataset2.dataset_DFD",
"torch.vstack",
"numpy.mean",
"sklearn.metrics.f1_score",
"torch.no_grad",
"os.path.join",
"pandas.DataFrame",
"torch.utils.data.DataLoader",
"torch.load",
"datetime.datetime.now",
"torch.... | [((1462, 1490), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (1479, 1490), False, 'import torch\n'), ((1495, 1520), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (1509, 1520), True, 'import numpy as np\n'), ((1540, 1573), 'dataset2.dataset_DFD', 'dataset... |
import pandas as pd
import numpy as np
from numpy.random import rand
from matplotlib import pyplot as plt
from extras import *
for tt in range(nt):
field = rand()*(-1)**np.random.randint(2)
E1 = M1 = E2 = M2 = 0
config = initialstate(N)
iT=1.0/T[tt]; iT2=iT*iT;
for i in range(eqSteps): ... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"numpy.random.randint",
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((1742, 1808), 'pandas.DataFrame', 'pd.DataFrame', (["{'field': H, 'T': T, 'E': E, 'C': C, 'X': X, 'M': M}"], {}), "({'field': H, 'T': T, 'E': E, 'C': C, 'X': X, 'M': M})\n", (1754, 1808), True, 'import pandas as pd\n'), ((841, 869), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(18, 10)'}), '(figsize=(1... |
import lie_learn.spaces.S2 as S2
import numpy as np
def test_spherical_quadrature():
"""
Testing spherical quadrature rule versus numerical integration.
"""
b = 8 # 10
# Create grids on the sphere
x_gl = S2.meshgrid(b=b, grid_type='Gauss-Legendre')
x_cc = S2.meshgrid(b=b, grid_type='Cl... | [
"lie_learn.spaces.S2.integrate",
"numpy.abs",
"lie_learn.spaces.S2.meshgrid",
"lie_learn.spaces.S2.change_coordinates",
"numpy.array",
"lie_learn.spaces.S2.quadrature_weights"
] | [((234, 278), 'lie_learn.spaces.S2.meshgrid', 'S2.meshgrid', ([], {'b': 'b', 'grid_type': '"""Gauss-Legendre"""'}), "(b=b, grid_type='Gauss-Legendre')\n", (245, 278), True, 'import lie_learn.spaces.S2 as S2\n'), ((290, 335), 'lie_learn.spaces.S2.meshgrid', 'S2.meshgrid', ([], {'b': 'b', 'grid_type': '"""Clenshaw-Curtis... |
from strax.testutils import fake_hits, several_fake_records
import numpy as np
from hypothesis import given, settings, example
import hypothesis.strategies as st
import strax
@given(fake_hits,
st.one_of(st.just(1), st.just(3)),
st.one_of(st.just(0), st.just(3)))
@settings(deadline=None)
def test_find_p... | [
"numpy.sum",
"strax.endtime",
"strax.peak_dtype",
"numpy.ones",
"numpy.iinfo",
"hypothesis.settings",
"strax.sum_waveform",
"strax.record_dtype",
"strax.find_hits",
"strax.compute_widths",
"numpy.linspace",
"hypothesis.strategies.integers",
"strax.split_peaks",
"strax.fully_contained_in",
... | [((281, 304), 'hypothesis.settings', 'settings', ([], {'deadline': 'None'}), '(deadline=None)\n', (289, 304), False, 'from hypothesis import given, settings, example\n'), ((1701, 1724), 'hypothesis.settings', 'settings', ([], {'deadline': 'None'}), '(deadline=None)\n', (1709, 1724), False, 'from hypothesis import given... |
import logging
from concurrent.futures import ThreadPoolExecutor
import grpc
import numpy as np
from outliers_pb2 import OutliersResponse
from outliers_pb2_grpc import OutliersServicer, add_OutliersServicer_to_server
def find_outliers(data: np.ndarray):
"""Return indices where values more than 2 standard deviat... | [
"logging.basicConfig",
"outliers_pb2.OutliersResponse",
"logging.info",
"numpy.fromiter",
"concurrent.futures.ThreadPoolExecutor"
] | [((979, 1075), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s - %(levelname)s - %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s - %(levelname)s - %(message)s')\n", (998, 1075), False, 'import logging\n'), ((1286, 1331), 'logging.info', 'logging.... |
import numexpr as ne
import numpy as np
from MetaStruct.Objects.Shapes.Shape import Shape
class Cuboid(Shape):
def __init__(self, design_space, x=0, y=0, z=0, xd=1, yd=1.5, zd=1):
super().__init__(design_space, x, y, z)
self.xd = xd
self.yd = yd
self.zd = zd
self.x_limi... | [
"numpy.array",
"numexpr.evaluate"
] | [((325, 371), 'numpy.array', 'np.array', (['[self.x - self.xd, self.x + self.xd]'], {}), '([self.x - self.xd, self.x + self.xd])\n', (333, 371), True, 'import numpy as np\n'), ((409, 455), 'numpy.array', 'np.array', (['[self.y - self.yd, self.y + self.yd]'], {}), '([self.y - self.yd, self.y + self.yd])\n', (417, 455), ... |
# py2 & py3 compatible
from past.builtins import map
import numpy as np
from numpy.linalg import norm
from .AtomImage import AtomImage
class Cell:
"""Represents the volume enclosing a set of atoms.
Could represent a crystal unit cell or the simulation cell from a
molecular dynamics calculation.
Attri... | [
"numpy.matrix",
"past.builtins.map",
"numpy.zeros",
"numpy.math.sqrt",
"numpy.math.cos",
"numpy.math.sin",
"numpy.linalg.inv",
"numpy.array",
"numpy.linalg.norm",
"numpy.dot",
"numpy.eye"
] | [((1775, 1797), 'numpy.eye', 'np.eye', (['(3)'], {'dtype': 'float'}), '(3, dtype=float)\n', (1781, 1797), True, 'import numpy as np\n'), ((1829, 1851), 'numpy.eye', 'np.eye', (['(3)'], {'dtype': 'float'}), '(3, dtype=float)\n', (1835, 1851), True, 'import numpy as np\n'), ((1920, 1940), 'numpy.array', 'np.array', (['([... |
import collections
import numpy as np
import torch
# The neural process (NP) takes as input a `NPRegressionDescription` namedtuple
# with fields:
# context_x: A tensor containing the context observations.
# context_y: A tensor containing the evaluations of the context observations.
# target_x: A tensor co... | [
"torch.ones",
"torch.randint",
"torch.eye",
"numpy.random.shuffle",
"torch.randn",
"torch.squeeze",
"torch.exp",
"torch.index_select",
"collections.namedtuple",
"torch.arange",
"torch.rand",
"torch.unsqueeze",
"torch.tensor",
"torch.sum",
"torch.square"
] | [((733, 880), 'collections.namedtuple', 'collections.namedtuple', (['"""NPRegressionDescription"""', "('context_x', 'context_y', 'target_x', 'target_y', 'num_total_points',\n 'num_context_points')"], {}), "('NPRegressionDescription', ('context_x', 'context_y',\n 'target_x', 'target_y', 'num_total_points', 'num_co... |
from tomostream import solver
from tomostream import util
import numpy as np
import dxchange
import time
import threading
class Simulate():
def __init__(self):
proj, flat, dark, theta = dxchange.read_aps_32id('/local/data/2020-07/Nikitin/scan_057.h5', sino=(0, 2048))
proj=proj[:,::2,::2]
da... | [
"threading.Thread",
"tomostream.util.toc",
"dxchange.write_tiff",
"numpy.zeros",
"numpy.mod",
"time.sleep",
"tomostream.solver.Solver",
"dxchange.read_aps_32id",
"numpy.arange",
"tomostream.util.tic"
] | [((199, 285), 'dxchange.read_aps_32id', 'dxchange.read_aps_32id', (['"""/local/data/2020-07/Nikitin/scan_057.h5"""'], {'sino': '(0, 2048)'}), "('/local/data/2020-07/Nikitin/scan_057.h5', sino=(0, \n 2048))\n", (221, 285), False, 'import dxchange\n'), ((598, 657), 'numpy.zeros', 'np.zeros', (['[self.buffer_size, heig... |
__authors__ = {"<NAME>", "<NAME>"}
__contact__ = "<EMAIL>"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "05/07/2021"
__status__ = "stable"
import numpy as np
import logging
from silx.opencl.processing import BufferDescription, EventDescription
from silx.ope... | [
"numpy.moveaxis",
"numpy.zeros",
"logging.getLogger",
"numpy.prod",
"pyopencl.tools.dtype_to_ctype",
"numpy.cumsum",
"silx.opencl.processing.EventDescription",
"numpy.where",
"numpy.arange",
"numpy.int32",
"silx.opencl.processing.BufferDescription",
"pyopencl.array.zeros"
] | [((579, 606), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (596, 606), False, 'import logging\n'), ((3668, 3717), 'pyopencl.array.zeros', 'parray.zeros', (['self.queue', 'tot_nnz'], {'dtype': 'np.int32'}), '(self.queue, tot_nnz, dtype=np.int32)\n', (3680, 3717), True, 'from pyopencl imp... |
import numpy
from OpenGL.GL import *
from OpenGL.GL.shaders import compileShader, compileProgram
VERTEX_SHADER = """#version 120
attribute vec4 vertices;
varying vec2 coords;
void main() {
gl_Position = vertices;
coords = vertices.xy;
}
"""
FRAGMENT_SHADER = """#version 120
uniform float t;
varying vec2 coo... | [
"OpenGL.GL.shaders.compileProgram",
"OpenGL.GL.shaders.compileShader",
"numpy.array"
] | [((628, 706), 'numpy.array', 'numpy.array', (['[-1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0]'], {'dtype': 'numpy.float32'}), '([-1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0], dtype=numpy.float32)\n', (639, 706), False, 'import numpy\n'), ((898, 944), 'OpenGL.GL.shaders.compileShader', 'compileShader', (['VERTEX_SHADER', '... |
import os
import random
from pathlib import Path
import cv2
import numpy as np
from tqdm import tqdm
import utils.colormaps as cm
from gol import GoL
from imageRenderer import RenderSettings, renderImage
from utils import boardIO
class GoLVideoRenderer:
def __init__(self, filename, videoWidth, videoHeight, fps=... | [
"numpy.zeros_like",
"numpy.sum",
"cv2.VideoWriter_fourcc",
"gol.GoL",
"numpy.subtract",
"cv2.waitKey",
"cv2.setWindowTitle",
"cv2.imshow",
"utils.colormaps.RandomColorProgressionIterator",
"utils.colormaps._htmlColor",
"random.random",
"pathlib.Path",
"cv2.VideoWriter",
"imageRenderer.Rend... | [((675, 724), 'imageRenderer.RenderSettings', 'RenderSettings', (['self.videoWidth', 'self.videoHeight'], {}), '(self.videoWidth, self.videoHeight)\n', (689, 724), False, 'from imageRenderer import RenderSettings, renderImage\n'), ((1076, 1107), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'XVID'"], {}), "(*... |
'''
Created on 30 Oct 2020
@author: julianporter
'''
import numpy
import SoapySDR
import collections
from SoapySDR import SOAPY_SDR_RX, SOAPY_SDR_CF32
from .flags import SoapyError, SoapyFlags
SoapyData = collections.namedtuple('SoapyData', ['data','flags','timestamp'])
def range2str(r):
return ' - '.join([f'{x... | [
"numpy.array",
"collections.namedtuple",
"SoapySDR.Device",
"collections.OrderedDict",
"SoapySDR.Device.enumerate"
] | [((208, 275), 'collections.namedtuple', 'collections.namedtuple', (['"""SoapyData"""', "['data', 'flags', 'timestamp']"], {}), "('SoapyData', ['data', 'flags', 'timestamp'])\n", (230, 275), False, 'import collections\n'), ((680, 705), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (703, 705), F... |
# generate inputs
from util import *
import numpy as np
from config import *
#from main import M6ANetShare
import os
import os
import tensorlayer as tl
from motif import *
from model import *
import sys
import tensorflow
import random
import tensorflow as tf
import pickle
np.random.seed(2)
random.seed(2)
tf.set_random... | [
"numpy.random.seed",
"tensorlayer.files.exists_or_mkdir",
"tensorlayer.layers.initialize_global_variables",
"random.sample",
"tensorflow.Session",
"tensorlayer.layers.get_variables_with_name",
"tensorflow.set_random_seed",
"tensorflow.transpose",
"tensorflow.ConfigProto",
"tensorflow.placeholder",... | [((274, 291), 'numpy.random.seed', 'np.random.seed', (['(2)'], {}), '(2)\n', (288, 291), True, 'import numpy as np\n'), ((292, 306), 'random.seed', 'random.seed', (['(2)'], {}), '(2)\n', (303, 306), False, 'import random\n'), ((307, 328), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(2)'], {}), '(2)\n', (325,... |
from torch_geometric.data import Dataset
from lightconvpoint.datasets.data import Data
import os
import numpy as np
import torch
import glob
import logging
class ShapeNet(Dataset):
def __init__(self, root, split="training", transform=None, filter_name=None, num_non_manifold_points=2048, dataset_size=None, **kwarg... | [
"torch.ones_like",
"os.path.dirname",
"os.path.exists",
"logging.info",
"numpy.unpackbits",
"os.path.join",
"torch.tensor"
] | [((394, 446), 'logging.info', 'logging.info', (['f"""Dataset - ShapeNet- {dataset_size}"""'], {}), "(f'Dataset - ShapeNet- {dataset_size}')\n", (406, 446), False, 'import logging\n'), ((4842, 4887), 'torch.tensor', 'torch.tensor', (['points_shape'], {'dtype': 'torch.float'}), '(points_shape, dtype=torch.float)\n', (4... |
"""
###############################
@author: zhenwei.shi, Maastro##
###############################
Usage:
import PyrexReader
img_path = '.\CTscan'
rtstruct_path = '.\RTstruct'
ROI = Region Of Interest
Img,Mask = PyrexReader.Img_Bimask(img_path,rtstruct_path,ROI)
"""
import pydicom,os
import numpy as np
from skimag... | [
"numpy.stack",
"pydicom.dcmread",
"numpy.abs",
"os.path.join",
"skimage.draw.polygon",
"numpy.zeros",
"numpy.array",
"numpy.linalg.inv",
"SimpleITK.GetImageFromArray",
"numpy.matmul",
"numpy.int64",
"numpy.float64",
"numpy.int16",
"re.search"
] | [((2288, 2345), 'skimage.draw.polygon', 'draw.polygon', (['vertex_row_coords', 'vertex_col_coords', 'shape'], {}), '(vertex_row_coords, vertex_col_coords, shape)\n', (2300, 2345), False, 'from skimage import draw\n'), ((2357, 2387), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'np.bool'}), '(shape, dtype=np.bool)\n... |
import support_functions as sf
import data_structures as ds
import pandas as pd
import numpy as np
class Socioeconomic:
def __init__(self, attributes: ds.ModelAttributes):
self.model_attributes = attributes
self.required_dimensions = self.get_required_dimensions()
self.required_subsectors... | [
"pandas.DataFrame",
"support_functions.subset_df",
"numpy.array",
"support_functions.format_print_list"
] | [((1453, 1486), 'support_functions.format_print_list', 'sf.format_print_list', (['set_missing'], {}), '(set_missing)\n', (1473, 1486), True, 'import support_functions as sf\n'), ((4216, 4283), 'numpy.array', 'np.array', (['df_se_trajectories[self.model_attributes.dim_time_period]'], {}), '(df_se_trajectories[self.model... |
import numpy as np
import pickle
import random
import os
import cv2
# this is where you store your datasets for this project
DataDir = "G:\AI\Dog-or-Cat-Datasets"
Categories = ["Dog","Cat"]
# read the images with labels as arrays for later
training_data = []
image_size = 70
def pre_process_Data():
for Category in... | [
"pickle.dump",
"random.shuffle",
"numpy.array",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((1089, 1118), 'random.shuffle', 'random.shuffle', (['training_data'], {}), '(training_data)\n', (1103, 1118), False, 'import random\n'), ((1207, 1218), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (1215, 1218), True, 'import numpy as np\n'), ((1364, 1396), 'pickle.dump', 'pickle.dump', (['x_train', 'pickle_out'],... |
# ===============================================================
# Author: <NAME>
# Email: <EMAIL>
# Twitter: @FerroRodolfo
#
# ABOUT COPYING OR USING PARTIAL INFORMATION:
# This script was originally created by <NAME>, for his
# talk in FLISoL 2017 at Instituto Tecnológico de León. Any
# explicit usage of this script... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.set_cmap",
"matplotlib.pyplot.imread"
] | [((1014, 1040), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(7, 7)'}), '(figsize=(7, 7))\n', (1024, 1040), True, 'import matplotlib.pyplot as plt\n'), ((1040, 1060), 'matplotlib.pyplot.set_cmap', 'plt.set_cmap', (['"""bone"""'], {}), "('bone')\n", (1052, 1060), True, 'import matplotlib.pyplot as plt\n')... |
from numpy import finfo
from ._make_annotations import _make_annotations
from ._process_target_or_data_for_plotting import _process_target_or_data_for_plotting
from .plot_and_save import plot_and_save
eps = finfo(float).eps
eps_ = 2 * eps
def make_summary_match_panel(
target,
data_dicts,
score_moe_p_va... | [
"numpy.finfo"
] | [((209, 221), 'numpy.finfo', 'finfo', (['float'], {}), '(float)\n', (214, 221), False, 'from numpy import finfo\n')] |
import warnings
import itertools
from tofnet.models.blocks import create_cba, get_all_blocks
from tofnet.models.model_wrapper import ModelWrapper
from tofnet.models.unet import SubIdentity, ConvBlock
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class ConfUnet(ModelWrapper):
... | [
"tofnet.models.unet.SubIdentity",
"numpy.sum",
"torch.stack",
"tofnet.models.unet.ConvBlock",
"torch.nn.ModuleList",
"torch.nn.functional.avg_pool2d",
"torch.nn.ModuleDict",
"tofnet.models.blocks.get_all_blocks",
"torch.nn.Identity"
] | [((3530, 3546), 'tofnet.models.blocks.get_all_blocks', 'get_all_blocks', ([], {}), '()\n', (3544, 3546), False, 'from tofnet.models.blocks import create_cba, get_all_blocks\n'), ((4178, 4211), 'torch.nn.ModuleDict', 'nn.ModuleDict', (['self.input_process'], {}), '(self.input_process)\n', (4191, 4211), True, 'import tor... |
# coding: utf-8
#
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | [
"tensorflow.nn.softmax",
"tensorflow.train.ExponentialMovingAverage",
"json.load",
"tensorflow.train.Saver",
"numpy.argmax",
"cv2.cvtColor",
"tensorflow.reset_default_graph",
"numpy.expand_dims",
"cv2.imread",
"tensorflow.placeholder",
"tensorflow.to_float",
"PIL.Image.fromarray",
"architect... | [((1794, 1817), 'cv2.imread', 'cv2.imread', (['"""panda.jpg"""'], {}), "('panda.jpg')\n", (1804, 1817), False, 'import cv2\n'), ((1826, 1864), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2RGB'], {}), '(image, cv2.COLOR_BGR2RGB)\n', (1838, 1864), False, 'import cv2\n'), ((1873, 1920), 'cv2.resize', 'cv2.res... |
# * Copyright (c) 2020-2021. Authors: see NOTICE file.
# *
# * 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 ... | [
"numpy.dstack",
"pydantic.color.parse_str",
"pydantic.color.float_to_255",
"pydantic.color.ints_to_rgba",
"pydantic.color.parse_tuple",
"pydantic.color.ColorError"
] | [((3840, 3864), 'pydantic.color.ints_to_rgba', 'ints_to_rgba', (['r', 'g', 'b', 'a'], {}), '(r, g, b, a)\n', (3852, 3864), False, 'from pydantic.color import Color as PydanticColor, ColorError, ColorType as PydanticColorType, RGBA, float_to_255, ints_to_rgba, parse_str, parse_tuple\n'), ((4665, 4681), 'numpy.dstack', '... |
from spreco.common import utils, pipe
from spreco.workbench.trainer import trainer
import argparse
import os
import numpy as np
def main(args):
if os.path.exists(args.config):
config = utils.load_config(args.config)
else:
raise Exception('The specified config.yaml is not existed, please check... | [
"spreco.common.utils.slice_image",
"argparse.ArgumentParser",
"spreco.common.utils.load_config",
"os.path.exists",
"spreco.common.pipe.create_pipe",
"spreco.common.utils.color_print",
"spreco.common.utils.npz_loader",
"spreco.common.utils.find_files",
"spreco.common.utils.normalize_with_max",
"spr... | [((154, 181), 'os.path.exists', 'os.path.exists', (['args.config'], {}), '(args.config)\n', (168, 181), False, 'import os\n'), ((2062, 2087), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2085, 2087), False, 'import argparse\n'), ((200, 230), 'spreco.common.utils.load_config', 'utils.load_con... |
import matplotlib.pyplot as plt
import numpy as np
from src.classification.classification_base import BaseClassification
from src.utils.activation import softmax, cross_entropy
np.set_printoptions(linewidth=10000)
import logging
logger = logging.getLogger()
# ==========================================================... | [
"numpy.set_printoptions",
"src.utils.activation.softmax",
"numpy.random.randn",
"numpy.zeros",
"src.utils.activation.cross_entropy",
"logging.getLogger",
"numpy.sqrt"
] | [((179, 215), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(10000)'}), '(linewidth=10000)\n', (198, 215), True, 'import numpy as np\n'), ((240, 259), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (257, 259), False, 'import logging\n'), ((968, 978), 'src.utils.activation.softmax', '... |
from scipy import stats
import re
from pathlib import Path
import numpy as np
import pandas as pd
from astropy.io import ascii
from tqdm import tqdm
RNG = np.random.RandomState(952020)
DATAPATH = Path("./data")
RESULTSPATH = Path("./results")
FIGURESPATH = Path("./paper/figures")
def get_data(dataset, **kwargs):
... | [
"astropy.io.ascii.read",
"numpy.random.RandomState",
"pathlib.Path",
"re.findall",
"pandas.read_table",
"scipy.stats.ks_2samp",
"pandas.concat"
] | [((157, 186), 'numpy.random.RandomState', 'np.random.RandomState', (['(952020)'], {}), '(952020)\n', (178, 186), True, 'import numpy as np\n'), ((198, 212), 'pathlib.Path', 'Path', (['"""./data"""'], {}), "('./data')\n", (202, 212), False, 'from pathlib import Path\n'), ((227, 244), 'pathlib.Path', 'Path', (['"""./resu... |
from Ensemble.sparcc import SparCC, MakeBootstraps, PseudoPvals, EmpiricalBrownsMethod
import sys
import numpy
# Version of the Ensemble Plugin, but only runs SparCC
class SparCCPlugin:
def input(self, filename):
# Compute SparCC, Pearson and Spearman correlations on the input file (now just SparCC)
#se... | [
"Ensemble.sparcc.PseudoPvals.driver",
"Ensemble.sparcc.MakeBootstraps.driver",
"numpy.zeros",
"Ensemble.sparcc.SparCC.driver"
] | [((808, 831), 'Ensemble.sparcc.MakeBootstraps.driver', 'MakeBootstraps.driver', ([], {}), '()\n', (829, 831), False, 'from Ensemble.sparcc import SparCC, MakeBootstraps, PseudoPvals, EmpiricalBrownsMethod\n'), ((544, 559), 'Ensemble.sparcc.SparCC.driver', 'SparCC.driver', ([], {}), '()\n', (557, 559), False, 'from Ense... |
import numpy as np
import paddle
import pytest
import tensorflow as tf
import torch
from scipy.sparse import csr_matrix, coo_matrix, bsr_matrix, csc_matrix, issparse
from docarray.math.ndarray import get_array_rows, check_arraylike_equality
from docarray.proto.docarray_pb2 import NdArrayProto
from docarray.proto.io im... | [
"paddle.to_tensor",
"docarray.math.ndarray.check_arraylike_equality",
"docarray.proto.io.flush_ndarray",
"scipy.sparse.issparse",
"docarray.math.ndarray.get_array_rows",
"scipy.sparse.bsr_matrix",
"tensorflow.constant",
"scipy.sparse.coo_matrix",
"docarray.proto.docarray_pb2.NdArrayProto",
"numpy.... | [((356, 530), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data, expected_result"""', '[([1, 2, 3], (1, 1)), ([[1, 2, 3]], (1, 2)), ([[1, 2], [3, 4]], (2, 2)), ([\n [1, 2], [3, 4], [5, 6], [7, 8]], (4, 2))]'], {}), "('data, expected_result', [([1, 2, 3], (1, 1)), ([[1,\n 2, 3]], (1, 2)), ([[1, 2], ... |
import inspect
import random
from collections import Counter
from copy import copy
from itertools import cycle, islice
import networkx as nx
import numpy as np
import treelib
from cryptography.fernet import Fernet
from intervaltree import Interval
def dict_to_treelib(d,
parent="",
... | [
"networkx.drawing.nx_pydot.to_pydot",
"treelib.tree.Tree",
"networkx.topological_sort",
"copy.copy",
"numpy.equal",
"inspect.getmro",
"itertools.islice",
"cryptography.fernet.Fernet.generate_key",
"networkx.is_tree",
"intervaltree.Interval"
] | [((2637, 2644), 'copy.copy', 'copy', (['a'], {}), '(a)\n', (2641, 2644), False, 'from copy import copy\n'), ((3797, 3829), 'networkx.drawing.nx_pydot.to_pydot', 'nx.drawing.nx_pydot.to_pydot', (['dg'], {}), '(dg)\n', (3825, 3829), True, 'import networkx as nx\n'), ((6754, 6775), 'cryptography.fernet.Fernet.generate_key... |
import numpy as np
def manhattan(node, goal):
return abs(goal.point[0] - node.point[0]) + abs(goal.point[1] - node.point[0])
def feat_l1(node, goal):
node_feats = np.array(node.features, dtype=np.float)
goal_feats = np.array(goal.features, dtype=np.float)
inds = np.where(np.isnan(goal_feats))
go... | [
"numpy.logical_not",
"numpy.isnan",
"numpy.linalg.norm",
"numpy.take",
"numpy.array"
] | [((175, 214), 'numpy.array', 'np.array', (['node.features'], {'dtype': 'np.float'}), '(node.features, dtype=np.float)\n', (183, 214), True, 'import numpy as np\n'), ((232, 271), 'numpy.array', 'np.array', (['goal.features'], {'dtype': 'np.float'}), '(goal.features, dtype=np.float)\n', (240, 271), True, 'import numpy as... |
import tornado.websocket
import re
import os
import sys
import glob
import xml.etree.ElementTree as et
import userstate
import sqlite3 as sql
from astropy.time import Time
import time
from yml import yamler
from imp import load_source
from fnmatch import fnmatch
from astropy.table import Table
import numpy as np
impor... | [
"os.remove",
"numpy.arctan2",
"time.strftime",
"userstate_interface.set",
"numpy.random.randint",
"sys.stdout.flush",
"numpy.sin",
"os.path.join",
"xml.etree.ElementTree.parse",
"hashlib.md5",
"re.split",
"userstate_interface.get",
"os.path.realpath",
"worktable.Worktable",
"userstate_in... | [((732, 758), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (748, 758), False, 'import os\n'), ((7012, 7035), 'numpy.random.randint', 'np.random.randint', (['(9999)'], {}), '(9999)\n', (7029, 7035), True, 'import numpy as np\n'), ((11710, 11731), 'userstate_interface.check', 'userstate.che... |
from __future__ import print_function
import sys
import os
import os.path
import csv
import re
import random
import datetime
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
def print_message(s):
print("[{}] {}".format(datetime.datetime.utcnow()... | [
"torch.nn.Dropout",
"csv.reader",
"torch.nn.Embedding",
"torch.nn.MaxPool1d",
"datetime.datetime.utcnow",
"torch.device",
"os.path.join",
"torch.nn.Conv1d",
"torch.nn.Linear",
"numpy.int64",
"torch.nn.Parameter",
"torch.manual_seed",
"torch.from_numpy",
"re.compile",
"torch.nn.ReLU",
"... | [((17082, 17104), 'torch.device', 'torch.device', (['"""cuda:0"""'], {}), "('cuda:0')\n", (17094, 17104), False, 'import torch\n'), ((17749, 17795), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""word-vocab-small.tsv"""'], {}), "(DATA_DIR, 'word-vocab-small.tsv')\n", (17761, 17795), False, 'import os\n'), ((17899, 1... |
from msppy.utils.logger import LoggerSDDP,LoggerEvaluation,LoggerComparison,Logger
from msppy.utils.statistics import check_random_state,rand_int,compute_CI,allocate_jobs
from msppy.evaluation import Evaluation, EvaluationTrue
import time
import numpy
import multiprocessing
import gurobipy
import numbers
from collectio... | [
"msppy.utils.logger.LoggerComparison",
"multiprocessing.Lock",
"numpy.empty",
"numpy.einsum",
"numpy.ones",
"numpy.argsort",
"msppy.utils.statistics.allocate_jobs",
"msppy.evaluation.EvaluationTrue",
"numpy.arange",
"numpy.mean",
"msppy.utils.statistics.rand_int",
"numpy.full",
"pandas.DataF... | [((2532, 2569), 'numpy.full', 'numpy.full', (['self.forward_T', 'numpy.nan'], {}), '(self.forward_T, numpy.nan)\n', (2542, 2569), False, 'import numpy\n'), ((8257, 8325), 'numpy.einsum', 'numpy.einsum', (['"""ij,k->ijk"""', 'MSP.transition_matrix[t]', 'probability_ind'], {}), "('ij,k->ijk', MSP.transition_matrix[t], pr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utilitary functions.
"""
import numpy as np
import matplotlib.pyplot as plt
import random
import glob
import logging
import torch
import torchvision
from torch.autograd import Variable
from torch.utils.data.sampler import SubsetRandomSampler
from configuration i... | [
"matplotlib.pyplot.title",
"torch.utils.data.sampler.SubsetRandomSampler",
"torch.ones",
"matplotlib.pyplot.show",
"random.shuffle",
"matplotlib.pyplot.imshow",
"torch.load",
"numpy.zeros",
"numpy.clip",
"torchvision.utils.make_grid",
"torch.save",
"random.seed",
"torch.cuda.is_available",
... | [((329, 346), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (340, 346), False, 'import random\n'), ((357, 384), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (374, 384), False, 'import logging\n'), ((635, 658), 'random.shuffle', 'random.shuffle', (['indices'], {}), '(indices)... |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
from mpl_toolkits.axes_grid1.inset_locator import mark_inset
def simulate():
d = 0.005
x = np.random.uniform(0, d)
y = d - x
x, y = np.random.uniform(0, d, 2)
dt = 0.05
t = 3... | [
"matplotlib.pyplot.subplot",
"numpy.random.uniform",
"numpy.random.seed",
"matplotlib.pyplot.show",
"mpl_toolkits.axes_grid1.inset_locator.zoomed_inset_axes",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.random.randint",
"matplotlib.pyplot.savefig"
] | [((1134, 1152), 'numpy.random.seed', 'np.random.seed', (['(11)'], {}), '(11)\n', (1148, 1152), True, 'import numpy as np\n'), ((1214, 1242), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 10)'}), '(figsize=(20, 10))\n', (1224, 1242), True, 'import matplotlib.pyplot as plt\n'), ((1248, 1274), 'matplotl... |
"""
:Author: <NAME> <<EMAIL>>
:Author: <NAME> <<EMAIL>>
:Date: 2018-09-17
:Copyright: 2018, Karr Lab
:License: MIT
"""
from collections import namedtuple
from enum import Enum
from inspect import currentframe, getframeinfo
from matplotlib.backends.backend_pdf import PdfPages
from pprint import pprint, pformat
from sci... | [
"pprint.pformat",
"wc_utils.util.environ.EnvironUtils.temp_config_env",
"pandas.read_csv",
"numpy.empty",
"numpy.allclose",
"wc_sim.run_results.RunResults",
"matplotlib.pyplot.suptitle",
"numpy.mean",
"shutil.rmtree",
"wc_lang.core.Submodel",
"os.path.join",
"matplotlib.pyplot.tight_layout",
... | [((55237, 55376), 'collections.namedtuple', 'namedtuple', (['"""VerificationRunResult"""', "['cases_dir', 'case_type', 'case_num', 'result_type', 'duration',\n 'quant_diff', 'params', 'error']"], {}), "('VerificationRunResult', ['cases_dir', 'case_type', 'case_num',\n 'result_type', 'duration', 'quant_diff', 'par... |
import pickle
import os
import numpy as np
from imblearn.combine import SMOTEENN
from collections import Counter
def loaddataset(path):
with open(path, 'rb') as handle:
dict = pickle.load(handle)
return dict['x'], dict['y']
def savedataset(x, y, lens, path):
dir = os.path.dirname(os.path.abspa... | [
"os.path.abspath",
"pickle.dump",
"os.makedirs",
"imblearn.combine.SMOTEENN",
"os.path.exists",
"pickle.load",
"numpy.array",
"collections.Counter"
] | [((542, 619), 'imblearn.combine.SMOTEENN', 'SMOTEENN', ([], {'random_state': 'randomstate', 'n_jobs': '(3)', 'n_neighbors': "kwargs['neighbors']"}), "(random_state=randomstate, n_jobs=3, n_neighbors=kwargs['neighbors'])\n", (550, 619), False, 'from imblearn.combine import SMOTEENN\n'), ((189, 208), 'pickle.load', 'pick... |
# Main window and functions of the ephys analysis program
import sys
from PyQt5.QtCore import Qt, pyqtSlot, QEvent
from PyQt5.QtWidgets import QMainWindow, QAction, QLabel, QGridLayout, \
QPushButton, QButtonGroup, QRadioButton, QVBoxLayout, QHBoxLayout, \
QTextEdit, QWidget, QFileDialog, QApplication, QCheckBox,\... | [
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QFileDialog.getOpenFileName",
"PyQt5.QtWidgets.QVBoxLayout",
"numpy.mean",
"PyQt5.QtWidgets.QAction",
"numpy.unique",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QRadioButton",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidge... | [((7994, 8011), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', (['Project'], {}), '(Project)\n', (8002, 8011), False, 'from PyQt5.QtCore import Qt, pyqtSlot, QEvent\n'), ((8820, 8833), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', (['str'], {}), '(str)\n', (8828, 8833), False, 'from PyQt5.QtCore import Qt, pyqtSlot, QEvent\n'), ((9198, 9... |
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import warnings
import os
warnings.filterwarnings("ignore")
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
dataPath = "temp/"
if not os.path.exists(dataPath):
os.makedirs(d... | [
"matplotlib.pyplot.show",
"os.makedirs",
"numpy.resize",
"warnings.filterwarnings",
"matplotlib.pyplot.imshow",
"os.path.exists",
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets"
] | [((168, 201), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (191, 201), False, 'import warnings\n'), ((340, 389), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['dataPath'], {'one_hot': '(True)'}), '(dataPath, one_hot=True)... |
DEBUG = 8
import argparse
import numpy as np
import os
from os.path import dirname
import torch
import torchvision
from torch.utils.tensorboard import SummaryWriter
import tqdm
if DEBUG>0:
from utils.models1 import Classifier
else:
from utils.models import Classifier
from utils.dataset import NCaltech101
from... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"os.path.isdir",
"torch.manual_seed",
"utils.models.Classifier",
"os.path.dirname",
"time.time",
"torch.save",
"utils.dataset.NCaltech101",
"torch.optim.lr_scheduler.ExponentialLR",
"utils.train_eval.eval_one_epoch",
"utils.train_eval.train_one_e... | [((523, 546), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (540, 546), False, 'import torch\n'), ((551, 571), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (565, 571), True, 'import numpy as np\n'), ((599, 677), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Tr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 26 19:17:11 2019
@author: plunder
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 25 09:44:55 2019
@author: plunder
"""
import matplotlib.pyplot as plt
import numpy as np
import sympy as sp
from discrete_pms import Di... | [
"save_state.save_plots",
"discrete_pms.DiscretePMS",
"scipy.stats.norm.pdf",
"init_plot_settings.init_plot_settings",
"numpy.linspace"
] | [((446, 469), 'init_plot_settings.init_plot_settings', 'init_plot_settings', (['plt'], {}), '(plt)\n', (464, 469), False, 'from init_plot_settings import init_plot_settings\n'), ((478, 491), 'discrete_pms.DiscretePMS', 'DiscretePMS', ([], {}), '()\n', (489, 491), False, 'from discrete_pms import DiscretePMS\n'), ((1217... |
import hetu as ht
import numpy as np
import argparse
import six.moves.cPickle as pickle
import gzip
import sys
import json
import os
import ctypes
import yaml
import multiprocessing
import signal
def start_process(settings):
for key, value in settings.items():
os.environ[key] = str(value)
if os.envir... | [
"hetu.get_worker_communicate",
"hetu.worker_finish",
"argparse.ArgumentParser",
"hetu.cpu",
"hetu.server_finish",
"numpy.zeros",
"hetu.server_init",
"hetu.scheduler_finish",
"numpy.array",
"hetu.scheduler_init",
"numpy.random.rand",
"signal.signal",
"hetu.worker_init",
"multiprocessing.Pro... | [((1027, 1036), 'hetu.cpu', 'ht.cpu', (['(0)'], {}), '(0)\n', (1033, 1036), True, 'import hetu as ht\n'), ((1226, 1264), 'numpy.array', 'np.array', (['[2 * rank + 1, 2 * rank + 2]'], {}), '([2 * rank + 1, 2 * rank + 2])\n', (1234, 1264), True, 'import numpy as np\n'), ((1389, 1423), 'numpy.array', 'np.array', (['[rank ... |
# deep_moon.py
# Defines a network that can find separate data of moon shapes
#
# Imports
from sklearn.datasets import make_moons
import numpy as np
import matplotlib.pyplot as plt
import seaborn as snb # make plot look pretty
# Helper functions
# plot the moons only on a figure
def plot_moons... | [
"numpy.meshgrid",
"sklearn.model_selection.train_test_split",
"keras.optimizers.Adam",
"sklearn.datasets.make_moons",
"matplotlib.pyplot.figure",
"keras.layers.Dense",
"matplotlib.pyplot.contourf",
"numpy.linspace",
"keras.models.Sequential"
] | [((4175, 4229), 'sklearn.datasets.make_moons', 'make_moons', ([], {'n_samples': '(1000)', 'noise': '(0.1)', 'random_state': '(42)'}), '(n_samples=1000, noise=0.1, random_state=42)\n', (4185, 4229), False, 'from sklearn.datasets import make_moons\n'), ((4403, 4457), 'sklearn.model_selection.train_test_split', 'train_tes... |
import numpy as np
from paz.backend.image import draw
from dataset import VISUALISATION_CONFIG
def transform_point(point, transform):
point = np.array([point[0], point[1], 1.]).T
point_transformed = np.dot(transform, point)
return point_transformed
def transform_joints(grouped_joints, transform):
tr... | [
"numpy.dot",
"numpy.random.randint",
"numpy.array"
] | [((209, 233), 'numpy.dot', 'np.dot', (['transform', 'point'], {}), '(transform, point)\n', (215, 233), True, 'import numpy as np\n'), ((148, 183), 'numpy.array', 'np.array', (['[point[0], point[1], 1.0]'], {}), '([point[0], point[1], 1.0])\n', (156, 183), True, 'import numpy as np\n'), ((1733, 1766), 'numpy.random.rand... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.