code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
import pandas as pd
from collections import OrderedDict
import tabulate
del(tabulate.LATEX_ESCAPE_RULES[u'$'])
del(tabulate.LATEX_ESCAPE_RULES[u'\\'])
del(tabulate.LATEX_ESCAPE_RULES[u'{'])
del(tabulate.LATEX_ESCAPE_RULES[u'}'])
del(tabulate.LATEX_ESCAPE_RULES[u'^'])
data = {}
scens = ["SPEAR-SWV"... | [
"numpy.argmin",
"tabulate.tabulate"
] | [((4159, 4228), 'tabulate.tabulate', 'tabulate.tabulate', ([], {'tabular_data': 'table_data', 'tablefmt': '"""latex_booktabs"""'}), "(tabular_data=table_data, tablefmt='latex_booktabs')\n", (4176, 4228), False, 'import tabulate\n'), ((2679, 2696), 'numpy.argmin', 'np.argmin', (['rmse_I'], {}), '(rmse_I)\n', (2688, 2696... |
"""
(C) Copyright 2021 IBM Corp.
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, software
d... | [
"torch.mul",
"numpy.array",
"fuse.utils.utils_hierarchical_dict.FuseUtilsHierarchicalDict.get",
"torch.nn.functional.interpolate",
"torch.nn.functional.max_pool2d",
"torch.zeros"
] | [((1137, 1158), 'numpy.array', 'np.array', (['input.shape'], {}), '(input.shape)\n', (1145, 1158), True, 'import numpy as np\n'), ((1224, 1257), 'torch.zeros', 'torch.zeros', (['shape'], {'device': 'device'}), '(shape, device=device)\n', (1235, 1257), False, 'import torch\n'), ((4650, 4707), 'fuse.utils.utils_hierarchi... |
from typing import Optional
import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras import Model
from tensorflow.keras.layers import Layer
import numpy as np
import rinokeras as rk
from rinokeras.layers import WeightNormDense as Dense
from rinokeras.layers import LayerNorm, Stack
class Ra... | [
"tensorflow.keras.backend.shape",
"numpy.random.random",
"numpy.asarray",
"numpy.isin",
"numpy.max",
"rinokeras.utils.convert_sequence_length_to_sequence_mask",
"numpy.cumsum",
"tensorflow.keras.backend.random_uniform",
"tensorflow.py_func",
"tensorflow.cast",
"numpy.arange"
] | [((1368, 1383), 'tensorflow.keras.backend.shape', 'K.shape', (['inputs'], {}), '(inputs)\n', (1375, 1383), True, 'import tensorflow.keras.backend as K\n'), ((2467, 2517), 'tensorflow.cast', 'tf.cast', (['(token_bert_mask & bert_mask)', 'inputs.dtype'], {}), '(token_bert_mask & bert_mask, inputs.dtype)\n', (2474, 2517),... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import glob as glb
import os
import cv2
import pickle
#################################################################################################################
def create_new_folder (new_dir):
if not os.path.exists(new_dir... | [
"numpy.copy",
"os.path.exists",
"pickle.dump",
"os.makedirs",
"cv2.getPerspectiveTransform",
"matplotlib.image.imread",
"numpy.float32",
"glob.glob"
] | [((1438, 1457), 'glob.glob', 'glb.glob', (['"""./*.jpg"""'], {}), "('./*.jpg')\n", (1446, 1457), True, 'import glob as glb\n'), ((878, 890), 'numpy.copy', 'np.copy', (['src'], {}), '(src)\n', (885, 890), True, 'import numpy as np\n'), ((1066, 1103), 'cv2.getPerspectiveTransform', 'cv2.getPerspectiveTransform', (['src',... |
import logging
from collections import OrderedDict
from copy import deepcopy
from datetime import datetime, timedelta
from pathlib import Path
from time import sleep
import cv2
import numpy as np
import pandas as pd
from PyQt5.QtCore import Qt, QTimer, pyqtSlot
from PyQt5.QtGui import QColor, QImage, QPixmap
from PyQt... | [
"cv2.rectangle",
"PyQt5.QtCore.QTimer.singleShot",
"datetime.datetime.strptime",
"pathlib.Path",
"PyQt5.QtGui.QColor",
"PyQt5.QtCore.pyqtSlot",
"PyQt5.QtGui.QImage",
"PyQt5.QtWidgets.QMessageBox.information",
"numpy.array",
"PyQt5.QtWidgets.QMessageBox.question",
"PyQt5.QtWidgets.QMessageBox.abo... | [((10100, 10110), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (10108, 10110), False, 'from PyQt5.QtCore import Qt, QTimer, pyqtSlot\n'), ((10451, 10461), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (10459, 10461), False, 'from PyQt5.QtCore import Qt, QTimer, pyqtSlot\n'), ((10793, 10803), 'PyQt5.Q... |
import numpy as np
import pandas as pd
from .scm import SCM
class DataGenerator:
def generate(self, scm: SCM, n_samples: int, seed: int):
pass
class SimpleDataGenerator(DataGenerator):
def generate(self, scm: SCM, n_samples: int, seed: int):
"""
Generates date according to the given... | [
"numpy.random.normal",
"numpy.zeros",
"numpy.random.seed",
"pandas.DataFrame.from_dict"
] | [((653, 673), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (667, 673), True, 'import numpy as np\n'), ((2057, 2085), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['data'], {}), '(data)\n', (2079, 2085), True, 'import pandas as pd\n'), ((786, 805), 'numpy.zeros', 'np.zeros', (['n_sample... |
#!/usr/bin/env python3
import numpy
from rl.agents.policy.policy_agent import PolicyAgent
class Random(PolicyAgent):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def act(self, state: numpy.ndarray, available_actions: numpy.ndarray):
"""
Uses a uniform rando... | [
"numpy.random.choice"
] | [((644, 682), 'numpy.random.choice', 'numpy.random.choice', (['available_actions'], {}), '(available_actions)\n', (663, 682), False, 'import numpy\n')] |
# ---------------------------------------------------
# Intermediate Python - Loops
# 22 set 2020
# VNTBJR
# ---------------------------------------------------
#
# Load packages
library(reticulate)
# while loop -------------------------------------------
# Basic while loop
# Initialize offset
offset = 8
# Code... | [
"numpy.array",
"numpy.nditer",
"pandas.read_csv"
] | [((2262, 2302), 'pandas.read_csv', 'pd.read_csv', (['"""Datasets/MLB.csv"""'], {'sep': '""","""'}), "('Datasets/MLB.csv', sep=',')\n", (2273, 2302), True, 'import pandas as pd\n'), ((2349, 2374), 'numpy.array', 'np.array', (["mlb[['Height']]"], {}), "(mlb[['Height']])\n", (2357, 2374), True, 'import numpy as np\n'), ((... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import functools
import gzip
import hashlib
import json
import logging
import os
import random
import warnings
... | [
"logging.getLogger",
"numpy.prod",
"gzip.open",
"dataclasses.dataclass",
"torch.from_numpy",
"numpy.array",
"numpy.isfinite",
"random.Random",
"numpy.flatnonzero",
"os.path.normpath",
"pytorch3d.io.IO",
"warnings.warn",
"dataclasses.field",
"torch.ones_like",
"torch.clamp",
"PIL.Image.... | [((908, 935), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (925, 935), False, 'import logging\n'), ((1046, 1065), 'dataclasses.dataclass', 'dataclass', ([], {'eq': '(False)'}), '(eq=False)\n', (1055, 1065), False, 'from dataclasses import dataclass, field\n'), ((30535, 30567), 'functool... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 13 13:10:41 2018
@author: crius
"""
import Hamiltonians as H
import numpy as np
import tools as t
import spintensor as st
import spinops as so
import time
import Expand as ex
from matplotlib import pyplot as plt
exp = np.exp
N = 8
nlegs = 4
S = 0.5
c = np.sqrt(2)
Jcu... | [
"tools.Statelist",
"numpy.sqrt",
"Expand.append",
"spinops.SziOp",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.kron",
"numpy.linspace",
"Expand.Expand",
"tools.exval",
"Hamiltonians.nlegHeisenberg.blockH",
"numpy.linalg.eigh",
"numpy.cos",
"time.time",
"spinops.sz"
] | [((306, 316), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (313, 316), True, 'import numpy as np\n'), ((343, 429), 'Hamiltonians.nlegHeisenberg.blockH', 'H.nlegHeisenberg.blockH', (['N', 'S', 'nlegs', 'c'], {'Js': '[1, 1]', 'gamma': '[0.0, 4.0]', 'full': '"""True"""'}), "(N, S, nlegs, c, Js=[1, 1], gamma=[0.0, 4.0]... |
import mnist
import numpy as np
from PIL import Image
from conv import Conv3x3
from maxpool import MaxPool2
from softmax import Softmax
train_images = mnist.train_images()[:100]
train_labels = mnist.train_labels()[:100]
test_images = mnist.test_images()[:1000]
test_labels = mnist.test_labels()[:1000]
conv = Conv3x3(8... | [
"softmax.Softmax",
"mnist.test_labels",
"mnist.train_images",
"numpy.log",
"numpy.argmax",
"mnist.test_images",
"numpy.array",
"numpy.zeros",
"conv.Conv3x3",
"maxpool.MaxPool2",
"mnist.train_labels"
] | [((311, 321), 'conv.Conv3x3', 'Conv3x3', (['(8)'], {}), '(8)\n', (318, 321), False, 'from conv import Conv3x3\n'), ((329, 339), 'maxpool.MaxPool2', 'MaxPool2', ([], {}), '()\n', (337, 339), False, 'from maxpool import MaxPool2\n'), ((350, 374), 'softmax.Softmax', 'Softmax', (['(13 * 13 * 8)', '(10)'], {}), '(13 * 13 * ... |
# -*- coding: utf-8 -*-
"""
Functions for plotting reliability diagrams: smooths of simulated vs observed
outcomes on the y-axis against predicted probabilities on the x-axis.
"""
from __future__ import absolute_import
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sbn
from .plot_utils import _l... | [
"seaborn.set_style",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"past.builtins.range"
] | [((681, 706), 'seaborn.set_style', 'sbn.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (694, 706), True, 'import seaborn as sbn\n'), ((2708, 2754), 'numpy.linspace', 'np.linspace', (['min_ref_val', 'max_ref_val'], {'num': '(100)'}), '(min_ref_val, max_ref_val, num=100)\n', (2719, 2754), True, 'import numpy as ... |
"""A tool to convert annotation files created with CVAT into ground-truth style images
for machine learning. The initial code was copied from:
https://gist.github.com/cheind/9850e35bb08cfe12500942fb8b55531f
originally written for a similar purpose for the tool BeaverDam (which produces json),
and was then adapted f... | [
"cv2.rectangle",
"numpy.copy",
"xml.etree.ElementTree.parse",
"argparse.ArgumentParser",
"cv2.VideoWriter",
"cv2.imshow",
"numpy.zeros",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"cv2.waitKey"
] | [((873, 891), 'xml.etree.ElementTree.parse', 'ET.parse', (['args.ann'], {}), '(args.ann)\n', (881, 891), True, 'import xml.etree.ElementTree as ET\n'), ((1101, 1129), 'cv2.VideoCapture', 'cv2.VideoCapture', (['args.video'], {}), '(args.video)\n', (1117, 1129), False, 'import cv2\n'), ((1464, 1495), 'cv2.VideoWriter_fou... |
import os
import tempfile
import pytest
import numpy as np
try:
import h5py
except ImportError:
h5py = None
from msl.io import read, HDF5Writer, JSONWriter
from msl.io.readers import HDF5Reader
from helper import read_sample, roots_equal
@pytest.mark.skipif(h5py is None, reason='h5py not installed')
def te... | [
"helper.read_sample",
"numpy.random.random",
"msl.io.read",
"msl.io.HDF5Writer",
"numpy.array",
"numpy.array_equal",
"pytest.raises",
"tempfile.gettempdir",
"pytest.mark.skipif",
"os.path.basename",
"helper.roots_equal",
"os.remove"
] | [((252, 313), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(h5py is None)'], {'reason': '"""h5py not installed"""'}), "(h5py is None, reason='h5py not installed')\n", (270, 313), False, 'import pytest\n'), ((3668, 3729), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(h5py is None)'], {'reason': '"""h5py not installe... |
import numpy as np
from ringity.classes.diagram import PersistenceDiagram
def read_pdiagram(fname, **kwargs):
"""
Wrapper for numpy.genfromtxt.
"""
return PersistenceDiagram(np.genfromtxt(fname, **kwargs))
def write_pdiagram(dgm, fname, **kwargs):
"""
Wrapper for numpy.savetxt.
"""
... | [
"numpy.array",
"numpy.genfromtxt",
"numpy.savetxt"
] | [((329, 342), 'numpy.array', 'np.array', (['dgm'], {}), '(dgm)\n', (337, 342), True, 'import numpy as np\n'), ((347, 381), 'numpy.savetxt', 'np.savetxt', (['fname', 'array'], {}), '(fname, array, **kwargs)\n', (357, 381), True, 'import numpy as np\n'), ((191, 221), 'numpy.genfromtxt', 'np.genfromtxt', (['fname'], {}), ... |
import functools
import os
from argparse import ArgumentParser
import networkx
import numpy as np
from visualize import heatmap
class MatchingClustering(object):
def __init__(self, n_clusters):
self.n_clusters = n_clusters
def fit_predict(self, X):
total = len(X)
grouping = [{i} for... | [
"networkx.algorithms.max_weight_matching",
"argparse.ArgumentParser",
"numpy.where",
"os.path.join",
"networkx.Graph",
"numpy.max",
"numpy.sum",
"numpy.zeros"
] | [((1247, 1263), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (1261, 1263), False, 'from argparse import ArgumentParser\n'), ((1101, 1130), 'numpy.zeros', 'np.zeros', (['total'], {'dtype': 'np.int'}), '(total, dtype=np.int)\n', (1109, 1130), True, 'import numpy as np\n'), ((1428, 1470), 'os.path.join',... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 27 14:39:08 2020
@author: ravi
"""
import scipy.io as scio
import scipy.io.wavfile as scwav
import numpy as np
import joblib
import pyworld as pw
import os
import warnings
warnings.filterwarnings('ignore')
from tqdm import tqdm
from concurrent.fut... | [
"feat_utils.preprocess_contour",
"numpy.random.rand",
"pyworld.code_spectral_envelope",
"pyworld.cheaptrick",
"tqdm.tqdm",
"numpy.asarray",
"extract_fold_data_hparams.Hparams",
"os.path.join",
"numpy.sum",
"numpy.array",
"numpy.random.randint",
"scipy.io.wavfile.read",
"functools.partial",
... | [((244, 277), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (267, 277), False, 'import warnings\n'), ((3408, 3474), 'joblib.load', 'joblib.load', (['"""/home/ravi/Downloads/Emo-Conv/speaker_file_info.pkl"""'], {}), "('/home/ravi/Downloads/Emo-Conv/speaker_file_info.pkl')\... |
import numpy as np
import cv2
import errno
# set environment variable
import os
os.environ['OPENCV_IO_ENABLE_JASPER']= 'TRUE' # allows JPEG2000 format
# path of this file
det_path = os.path.split(os.path.abspath(__file__))[0] + '/'
class DimensionError(Exception):
"""
raised when the image does not me... | [
"numpy.mean",
"cv2.imwrite",
"os.strerror",
"cv2.dnn.readNetFromCaffe",
"os.path.isfile",
"numpy.array",
"os.path.abspath",
"cv2.resize",
"cv2.imread"
] | [((1585, 1604), 'cv2.imread', 'cv2.imread', (['in_path'], {}), '(in_path)\n', (1595, 1604), False, 'import cv2\n'), ((1783, 1910), 'cv2.dnn.readNetFromCaffe', 'cv2.dnn.readNetFromCaffe', (["(det_path + 'models/deploy.prototxt')", "(det_path + 'models/res10_300x300_ssd_iter_140000.caffemodel')"], {}), "(det_path + 'mode... |
"""
NCL_coneff_16.py
================
This script illustrates the following concepts:
- Showing features of the new color display model
- Using a NCL colormap with levels to assign a color palette to contours
- Drawing partially transparent filled contours
See following URLs to see the reproduced NCL plot & s... | [
"geocat.datafiles.get",
"geocat.viz.util.add_major_minor_ticks",
"matplotlib.pyplot.colorbar",
"cartopy.crs.PlateCarree",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.axes",
"geocat.viz.util.add_lat_lon_ticklabels",
"geocat.viz.util.set_titles_and_labels",
"matplotlib.pyplot.sh... | [((1221, 1248), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(14, 7)'}), '(figsize=(14, 7))\n', (1231, 1248), True, 'import matplotlib.pyplot as plt\n'), ((1294, 1312), 'cartopy.crs.PlateCarree', 'ccrs.PlateCarree', ([], {}), '()\n', (1310, 1312), True, 'import cartopy.crs as ccrs\n'), ((1318, 1349), 'ma... |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import FuncFormatter
filepath = '/Users/huangjiaming/Documents/developer/ETreeLearning/res/losses/delay_etree.txt'
x = []
num = 0
with open(filepath) as fp:
for line in fp:
c = list(map(int, line.split()))
x = c
print(np.... | [
"numpy.mean",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.subplots",
"numpy.std"
] | [((360, 397), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(2)', 'figsize': '(9, 6)'}), '(nrows=2, figsize=(9, 6))\n', (372, 397), True, 'import matplotlib.pyplot as plt\n'), ((853, 917), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""./reports/20200301/delay_etree_100_nodes"""'], {'dpi': '(600)'}),... |
import numpy as np
from typing import List, Tuple
class InterfaceSolver():
"""
Informal interface for solving class needed to interact with rubiks
environment.
"""
def __init__(self, depth:int, possible_moves: List[str]) -> None:
"""
Will be passed depth, i.e. number of backwa... | [
"numpy.sum",
"numpy.array"
] | [((8033, 8074), 'numpy.sum', 'np.sum', (['(cube_state[i, :, :] == center_val)'], {}), '(cube_state[i, :, :] == center_val)\n', (8039, 8074), True, 'import numpy as np\n'), ((8674, 8706), 'numpy.array', 'np.array', (['self.cube_state_values'], {}), '(self.cube_state_values)\n', (8682, 8706), True, 'import numpy as np\n'... |
import sys
from glob import glob
from serial import Serial, SerialException
import numpy as np
BAUD_RATE = 9600
PORT = 'COM5'
READ_TIMEOUT = 1
LOWER_BOUND = 0.01
UPPER_BOUND = 0.4
class SerialCommunication():
""" Manages the communication and sends the data to the Arduino """
def __init__(self):
s... | [
"numpy.clip",
"sys.platform.startswith",
"serial.Serial",
"numpy.isnan",
"glob.glob"
] | [((342, 350), 'serial.Serial', 'Serial', ([], {}), '()\n', (348, 350), False, 'from serial import Serial, SerialException\n'), ((2715, 2745), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (2738, 2745), False, 'import sys\n'), ((3799, 3841), 'numpy.clip', 'np.clip', (['signals',... |
import sys
import time
import threading
import grpc
import numpy
import soundfile as sf
import tensorflow as tf
import _init_paths
import audioset.vggish_input as vggish_input
from tensorflow_serving.apis import predict_pb2
from tensorflow_serving.apis import prediction_service_pb2_grpc
tf.app.flags.DEFINE_integer... | [
"sys.stdout.flush",
"tensorflow.app.flags.DEFINE_integer",
"tensorflow_serving.apis.predict_pb2.PredictRequest",
"tensorflow_serving.apis.prediction_service_pb2_grpc.PredictionServiceStub",
"grpc.insecure_channel",
"tensorflow.app.flags.DEFINE_string",
"sys.stdout.write",
"numpy.pad",
"audioset.vggi... | [((293, 381), 'tensorflow.app.flags.DEFINE_integer', 'tf.app.flags.DEFINE_integer', (['"""concurrency"""', '(1)', '"""concurrent inference requests limit"""'], {}), "('concurrency', 1,\n 'concurrent inference requests limit')\n", (320, 381), True, 'import tensorflow as tf\n'), ((378, 448), 'tensorflow.app.flags.DEFI... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 21:46:56 2020
@author: adwait
"""
import numpy as np
import cv2
import pims
from tkinter import messagebox, Tk
from PIL import ImageFont, ImageDraw, Image
from PyQt5.QtGui import QIcon
import logging
class MainRecordFunctions:
def recordVideo(... | [
"PyQt5.QtGui.QIcon",
"logging.debug",
"cv2.imshow",
"pims.Video",
"PIL.ImageDraw.Draw",
"numpy.array",
"cv2.resizeWindow",
"cv2.line",
"PIL.ImageFont.truetype",
"cv2.VideoWriter",
"numpy.empty",
"cv2.VideoWriter_fourcc",
"tkinter.messagebox.showinfo",
"cv2.putText",
"cv2.cvtColor",
"cv... | [((352, 380), 'logging.debug', 'logging.debug', (['"""recordvideo"""'], {}), "('recordvideo')\n", (365, 380), False, 'import logging\n'), ((9583, 9612), 'logging.debug', 'logging.debug', (['"""record_frame"""'], {}), "('record_frame')\n", (9596, 9612), False, 'import logging\n'), ((11078, 11122), 'numpy.zeros', 'np.zer... |
from abc import ABC, abstractmethod
import collections
import statistics
import numpy as np
import sklearn.metrics
import torch
class Evaluator(ABC):
"""Class to evaluate model outputs and report the result.
"""
def __init__(self):
self.reset()
@abstractmethod
def add_predictions(self, p... | [
"statistics.mean",
"torch.mul",
"torch.topk",
"numpy.argmax",
"numpy.array",
"numpy.sum",
"torch.add",
"collections.defaultdict",
"torch.zeros_like"
] | [((904, 930), 'torch.topk', 'torch.topk', (['predictions', '(1)'], {}), '(predictions, 1)\n', (914, 930), False, 'import torch\n'), ((1160, 1186), 'torch.topk', 'torch.topk', (['predictions', 'k'], {}), '(predictions, k)\n', (1170, 1186), False, 'import torch\n'), ((1366, 1414), 'torch.zeros_like', 'torch.zeros_like', ... |
"""
This module exrtacts features from the data, saves the feauters
from all measurements to global results file and creates
one file for every sensor with all measurements.
:copyright: (c) 2022 by <NAME>, Hochschule-Bonn-Rhein-Sieg
:license: see LICENSE for more details.
"""
from pyexpat import features
import pan... | [
"numpy.trapz",
"numpy.ones",
"pandas.read_csv",
"matplotlib.pyplot.xticks",
"pathlib.Path",
"numpy.max",
"matplotlib.pyplot.close",
"scipy.signal.peak_widths",
"scipy.signal.find_peaks",
"pandas.DataFrame",
"matplotlib.pyplot.subplots",
"numpy.arange"
] | [((9673, 9752), 'scipy.signal.find_peaks', 'find_peaks', (['df[sensor]'], {'prominence': '(0)', 'width': '(1)', 'distance': '(20000)', 'height': 'threshold'}), '(df[sensor], prominence=0, width=1, distance=20000, height=threshold)\n', (9683, 9752), False, 'from scipy.signal import chirp, find_peaks, peak_widths\n'), ((... |
import krippendorff
import pandas as pd
import numpy as np
from . import utils
def r_to_z(r):
return np.arctanh(r)
def z_to_r(z):
return np.tanh(z)
def confidence_interval(r, conf_level=95, stat=np.mean):
z = r_to_z(r)
ci = utils.bootstrap_ci(z, stat=stat, conf_level=conf_level)
ci = z_to_r(c... | [
"numpy.arctanh",
"pandas.Series",
"numpy.tanh",
"krippendorff.alpha"
] | [((107, 120), 'numpy.arctanh', 'np.arctanh', (['r'], {}), '(r)\n', (117, 120), True, 'import numpy as np\n'), ((149, 159), 'numpy.tanh', 'np.tanh', (['z'], {}), '(z)\n', (156, 159), True, 'import numpy as np\n'), ((334, 371), 'pandas.Series', 'pd.Series', (["{'lo': ci[0], 'hi': ci[1]}"], {}), "({'lo': ci[0], 'hi': ci[1... |
import numpy as np #we use numpy alot
def main():
i = 0 #declare i = 0
n = 10 #declare n = 10
x = 119.0 #float x, these have a .
#we can use numpy to quickly make arrays
y = np.zeros(n, dtype=float) #declares 10 zeros
#we can use for loops to iterate through a variable
for i in range(n): #i in r... | [
"numpy.zeros"
] | [((189, 213), 'numpy.zeros', 'np.zeros', (['n'], {'dtype': 'float'}), '(n, dtype=float)\n', (197, 213), True, 'import numpy as np\n')] |
import numpy as np
import matplotlib as plt
from collections import Counter
from math import log
import sys
import time
class ListQueue:
def __init__(self, capacity):
self.__capacity = capacity
self.__data = [None] * self.__capacity
self.__size = 0
self.__front = 0
... | [
"numpy.unique",
"collections.Counter",
"numpy.argsort",
"numpy.array",
"numpy.log2",
"numpy.genfromtxt"
] | [((7410, 7495), 'numpy.genfromtxt', 'np.genfromtxt', (['"""train.csv"""'], {'dtype': 'np.float64', 'encoding': '"""utf-8-sig"""', 'delimiter': '""","""'}), "('train.csv', dtype=np.float64, encoding='utf-8-sig',\n delimiter=',')\n", (7423, 7495), True, 'import numpy as np\n'), ((4406, 4438), 'numpy.unique', 'np.uniqu... |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.3
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# + [markdown] id="view-in-github" colab_type="text"
# <a href="https://colab... | [
"hps.Hyperparams",
"jax.local_devices",
"google.colab.auth.authenticate_user",
"numpy.array",
"data.set_up_data",
"train_helpers.setup_save_dirs",
"train.get_sample_for_visualization",
"jax.random.PRNGKey",
"dataclasses.asdict",
"argparse.ArgumentParser",
"numpy.asarray",
"flax.jax_utils.unrep... | [((849, 873), 'google.colab.auth.authenticate_user', 'auth.authenticate_user', ([], {}), '()\n', (871, 873), False, 'from google.colab import auth\n'), ((2613, 2632), 'jax.local_devices', 'jax.local_devices', ([], {}), '()\n', (2630, 2632), False, 'import jax\n'), ((2927, 2940), 'hps.Hyperparams', 'Hyperparams', ([], {... |
"""Performs face alignment and stores face thumbnails in the output directory."""
# MIT License
#
# Copyright (c) 2016 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restr... | [
"os.path.exists",
"numpy.minimum",
"numpy.power",
"scipy.misc.imsave",
"os.path.join",
"numpy.asarray",
"os.path.splitext",
"os.path.split",
"numpy.squeeze",
"numpy.argmax",
"scipy.misc.imread",
"numpy.zeros",
"numpy.vstack",
"scipy.misc.imresize",
"numpy.maximum",
"facenet.to_rgb"
] | [((1824, 1870), 'os.path.join', 'os.path.join', (['curr_dir', "(filename + '_face.jpg')"], {}), "(curr_dir, filename + '_face.jpg')\n", (1836, 1870), False, 'import os\n'), ((1902, 1933), 'os.path.exists', 'os.path.exists', (['output_filename'], {}), '(output_filename)\n', (1916, 1933), False, 'import os\n'), ((1966, 1... |
from tester.ni_usb_6211 import NiUsb6211
import numpy as np
OUTPUT_READ_CHANNEL = "ai0"
VCC_READ_CHANNEL = "ai1"
TOLERANCE = 0.001
def test_find_devices():
devices = NiUsb6211.find_devices()
assert type(devices) == list, "Not a list!"
if len(devices) > 0:
assert type(devices[0]) == str, "An eleme... | [
"tester.ni_usb_6211.NiUsb6211",
"numpy.all",
"tester.ni_usb_6211.NiUsb6211.find_devices"
] | [((172, 196), 'tester.ni_usb_6211.NiUsb6211.find_devices', 'NiUsb6211.find_devices', ([], {}), '()\n', (194, 196), False, 'from tester.ni_usb_6211 import NiUsb6211\n'), ((382, 472), 'tester.ni_usb_6211.NiUsb6211', 'NiUsb6211', ([], {'output_read_channel': 'OUTPUT_READ_CHANNEL', 'vcc_read_channel': 'VCC_READ_CHANNEL'}),... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Defines a class for the COMPAS dataset."""
import pandas as pd
import numpy as np
from .base_wrapper import BasePerformanceDatasetWrapper
from tempeh.constants import FeatureType, Tasks, DataTypes, ClassVars, CompasDatase... | [
"pandas.get_dummies",
"numpy.delete",
"numpy.unique",
"pandas.read_csv"
] | [((768, 888), 'pandas.read_csv', 'pd.read_csv', (['"""https://raw.githubusercontent.com/propublica/compas-analysis/master/compas-scores-two-years.csv"""'], {}), "(\n 'https://raw.githubusercontent.com/propublica/compas-analysis/master/compas-scores-two-years.csv'\n )\n", (779, 888), True, 'import pandas as pd\n')... |
import numpy as np
from scipy.interpolate import CubicSpline
class WaypointTraj(object):
"""
"""
def __init__(self, points):
"""
This is the constructor for the Trajectory object. A fresh trajectory
object will be constructed before each mission. For a waypoint
trajectory, ... | [
"numpy.reshape",
"scipy.interpolate.CubicSpline",
"numpy.zeros",
"numpy.linalg.norm",
"numpy.shape"
] | [((1920, 1934), 'numpy.zeros', 'np.zeros', (['(3,)'], {}), '((3,))\n', (1928, 1934), True, 'import numpy as np\n'), ((1954, 1968), 'numpy.zeros', 'np.zeros', (['(3,)'], {}), '((3,))\n', (1962, 1968), True, 'import numpy as np\n'), ((1988, 2002), 'numpy.zeros', 'np.zeros', (['(3,)'], {}), '((3,))\n', (1996, 2002), True,... |
# Question 07, Lab 07
# AB Satyaprakash, 180123062
# imports
import pandas as pd
import numpy as np
# functions
def f(t, y):
return y - t**2 + 1
def F(t):
return (t+1)**2 - 0.5*np.exp(t)
def RungeKutta4(t, y, h):
k1 = f(t, y)
k2 = f(t+h/2, y+h*k1/2)
k3 = f(t+h/2, y+h*k2/2)
k4 = f(t+h, y+... | [
"pandas.DataFrame",
"numpy.exp",
"pandas.Series"
] | [((1063, 1077), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1075, 1077), True, 'import pandas as pd\n'), ((1120, 1132), 'pandas.Series', 'pd.Series', (['y'], {}), '(y)\n', (1129, 1132), True, 'import pandas as pd\n'), ((1154, 1169), 'pandas.Series', 'pd.Series', (['yact'], {}), '(yact)\n', (1163, 1169), True... |
import numpy as np
import cwrapping
GurobiEnv = cwrapping.gurobicpy.GurobiEnv
def make_float64(lists):
newlists = []
for e in lists:
newlists.append(np.float64(e))
return newlists
def check_feasibility(A, b, solution):
RHS = np.dot(A, solution)
if np.sum(RHS - (1.0 - 1e-10) * b > 1e-5) >= 1:
return False
... | [
"numpy.sum",
"numpy.dot",
"numpy.float64"
] | [((235, 254), 'numpy.dot', 'np.dot', (['A', 'solution'], {}), '(A, solution)\n', (241, 254), True, 'import numpy as np\n'), ((259, 298), 'numpy.sum', 'np.sum', (['(RHS - (1.0 - 1e-10) * b > 1e-05)'], {}), '(RHS - (1.0 - 1e-10) * b > 1e-05)\n', (265, 298), True, 'import numpy as np\n'), ((155, 168), 'numpy.float64', 'np... |
import numpy as np
import torch
from torch.utils.data import Dataset
class DSpritesDataset(Dataset):
"""dSprites dataset."""
def __init__(self, npz_file:str, transform=None):
"""
Args:
npz_file: Path to the npz file.
root_dir: Directory with all the images.
... | [
"numpy.load"
] | [((449, 504), 'numpy.load', 'np.load', (['npz_file'], {'allow_pickle': '(True)', 'encoding': '"""latin1"""'}), "(npz_file, allow_pickle=True, encoding='latin1')\n", (456, 504), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
from tflearn.data_utils import *
from os.path import join
import numpy as np
from skimage import io, transform
from keras.models import load_model
from skimage.color import rgb2lab, lab2rgb
import time
from functools import wraps
import warnings
from tensorflow.python.ops.image_ops import rgb_to... | [
"numpy.uint8",
"tensorflow.shape",
"tensorflow.transpose",
"tensorflow.slice",
"numpy.mean",
"skimage.color.lab2rgb",
"keras.backend.square",
"functools.wraps",
"keras.backend.var",
"tensorflow.extract_image_patches",
"tensorflow.size",
"keras.backend.abs",
"tensorflow.stack",
"keras.backe... | [((380, 413), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (403, 413), False, 'import warnings\n'), ((451, 462), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (456, 462), False, 'from functools import wraps\n'), ((513, 524), 'time.time', 'time.time', ([], {}), ... |
## the noise masks of funcSize are not binarized, this script is to binarize them
import os, json
import nibabel as nib
import numpy as np
from scipy import ndimage
# initalize data
work_dir = '/mindhive/saxelab3/anzellotti/forrest/output_denoise/'
all_subjects = ['sub-01', 'sub-02', 'sub-03', 'sub-04', 'sub-05', 'sub... | [
"nibabel.Nifti1Image",
"numpy.zeros",
"nibabel.save",
"nibabel.load"
] | [((938, 956), 'nibabel.load', 'nib.load', (['mask_dir'], {}), '(mask_dir)\n', (946, 956), True, 'import nibabel as nib\n'), ((1089, 1115), 'numpy.zeros', 'np.zeros', (['mask_union.shape'], {}), '(mask_union.shape)\n', (1097, 1115), True, 'import numpy as np\n'), ((1427, 1496), 'nibabel.Nifti1Image', 'nib.Nifti1Image', ... |
# This is a comparison for the CSSP algorithms on real datasets.
# This is a test for subsampling functions:
## * Projection DPPs
## * Volume sampling
## * Pivoted QR
## * Double Phase
## * Largest leverage scores
##
import sys
sys.path.insert(0, '..')
from CSSPy.dataset_tools import *
from CSSPy.volume_sampler impor... | [
"matplotlib.pyplot.boxplot",
"matplotlib.pyplot.setp",
"sys.path.insert",
"matplotlib.pyplot.savefig",
"timeit.Timer",
"pandas.read_csv",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.yticks",
"numpy.savetxt",
... | [((230, 254), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (245, 254), False, 'import sys\n'), ((803, 875), 'timeit.Timer', 'timeit.Timer', (['"""char in text"""'], {'setup': '"""text = "sample string"; char = "g\\""""'}), '(\'char in text\', setup=\'text = "sample string"; char = "g"... |
# -*- coding: utf-8 -*-
"""
Remove transcription sites in the FISH image.
"""
import os
import argparse
import time
import datetime
import sys
import bigfish.stack as stack
import numpy as np
from utils import Logger
from loader import (get_metadata_directory, generate_filename_base,
images_gene... | [
"numpy.savez",
"bigfish.stack.remove_transcription_site",
"argparse.ArgumentParser",
"os.path.join",
"bigfish.stack.read_image",
"utils.Logger",
"datetime.datetime.now",
"os.path.isdir",
"loader.generate_filename_base",
"os.path.basename",
"loader.get_metadata_directory",
"numpy.load",
"time... | [((404, 429), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (427, 429), False, 'import argparse\n'), ((1453, 1495), 'os.path.join', 'os.path.join', (['output_directory', '"""nuc_mask"""'], {}), "(output_directory, 'nuc_mask')\n", (1465, 1495), False, 'import os\n'), ((1517, 1565), 'os.path.joi... |
"""
Methods to search an ImageCollection with brute force, exhaustive search.
"""
import cgi
import abc
import cPickle
import numpy as np
from sklearn.decomposition import PCA
from sklearn.metrics.pairwise import \
manhattan_distances, euclidean_distances, additive_chi2_kernel
import pyflann
from scipy.spatial imp... | [
"scipy.spatial.cKDTree",
"sklearn.metrics.pairwise.manhattan_distances",
"sklearn.decomposition.PCA",
"sklearn.metrics.pairwise.euclidean_distances",
"util.histogram_colors_smoothed",
"pyflann.set_distance_type",
"sklearn.metrics.pairwise.additive_chi2_kernel",
"numpy.argsort",
"pyflann.FLANN",
"r... | [((408, 416), 'rayleigh.util.TicToc', 'TicToc', ([], {}), '()\n', (414, 416), False, 'from rayleigh.util import TicToc\n'), ((2377, 2427), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': 'self.num_dimensions', 'whiten': '(True)'}), '(n_components=self.num_dimensions, whiten=True)\n', (2380, 2427), False, 'fro... |
#!/usr/bin/env python3
import os
import argparse
import numpy as np
from sklearn import preprocessing
from sklearn import datasets
from tqdm import tqdm
class Network(object):
def __init__(self):
self.linear1 = Linear(64, 128)
self.relu1 = ReLU()
self.linear2 = Linear(128, 64)
se... | [
"numpy.random.normal",
"numpy.clip",
"argparse.ArgumentParser",
"ipdb.set_trace",
"sklearn.datasets.load_digits",
"numpy.max",
"sklearn.preprocessing.StandardScaler",
"numpy.sum",
"numpy.zeros",
"numpy.split",
"numpy.arange",
"numpy.random.shuffle"
] | [((1714, 1751), 'sklearn.datasets.load_digits', 'datasets.load_digits', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (1734, 1751), False, 'from sklearn import datasets\n'), ((1766, 1790), 'numpy.arange', 'np.arange', (['data.shape[0]'], {}), '(data.shape[0])\n', (1775, 1790), True, 'import numpy as np\n'), ((... |
"""
University of Minnesota
Aerospace Engineering and Mechanics - UAV Lab
Copyright 2019 Regents of the University of Minnesota
See: LICENSE.md for complete license details
Author: <NAME>
Analysis for Huginn (mAEWing2) FLT03 and FLT04
"""
#%%
# Import Libraries
import numpy as np
import matplotlib.pyplot as plt
# H... | [
"Core.AirData.ApplyCalibration",
"matplotlib.pyplot.grid",
"Core.AirData.Airspeed2NED",
"Core.AirDataCalibration.EstCalib",
"numpy.array",
"Core.OpenData.Decimate",
"numpy.linalg.norm",
"numpy.repeat",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.linspace",
"Core.Loader.Log_RAPTRS",
"sy... | [((811, 868), 'sys.path.join', 'path.join', (['"""/home"""', '"""rega0051"""', '"""FlightArchive"""', '"""Huginn"""'], {}), "('/home', 'rega0051', 'FlightArchive', 'Huginn')\n", (820, 868), False, 'from sys import path, argv\n'), ((1059, 1118), 'sys.path.join', 'path.join', (['pathBase', "('Huginn' + flt)", "('Huginn' ... |
#! /usr/bin/env python
########################################################################
# #
# Resums the non-global logarithms, needs ngl_resum.py #
# #
# If... | [
"numpy.sqrt",
"argparse.ArgumentParser",
"ngl_resum.FourVector",
"ngl_resum.Shower",
"ngl_resum.Event",
"ngl_resum.OutsideRegion",
"numpy.random.seed",
"time.time"
] | [((838, 1158), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""This code shows how to use ngl_resum to shower a single dipole aligned with the z-axis, both legs with velocity b. The outside region is defined by the symmetric rapidity gap from -y to y. This code was used to produce some of... |
import time
import picamera
import numpy as np
import cv2
with picamera.PiCamera() as camera:
camera.resolution = (3280, 2464)
camera. start_preview()
time. sleep(2)
camera.capture('image.data', 'yuv')
##################################################
fd = open('image.data', 'rb')
f=np.fromfile(fd, dty... | [
"cv2.imwrite",
"numpy.fromfile",
"picamera.PiCamera",
"time.sleep"
] | [((301, 351), 'numpy.fromfile', 'np.fromfile', (['fd'], {'dtype': 'np.uint8', 'count': '(3280 * 2464)'}), '(fd, dtype=np.uint8, count=3280 * 2464)\n', (312, 351), True, 'import numpy as np\n'), ((390, 425), 'cv2.imwrite', 'cv2.imwrite', (['"""rawconverted.jpg"""', 'im'], {}), "('rawconverted.jpg', im)\n", (401, 425), F... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import numpy as np
import scipy.io.wavfile as wav
import random
import tables
import pickle
def feed_to_hdf5(feature_vector, subject_num, utterance_train_storage, utterance_test_storage, ... | [
"numpy.array",
"numpy.zeros"
] | [((1387, 1430), 'numpy.zeros', 'np.zeros', (['(1, 80, 40, 20)'], {'dtype': 'np.float32'}), '((1, 80, 40, 20), dtype=np.float32)\n', (1395, 1430), True, 'import numpy as np\n'), ((2216, 2259), 'numpy.zeros', 'np.zeros', (['(1, 80, 40, 20)'], {'dtype': 'np.float32'}), '((1, 80, 40, 20), dtype=np.float32)\n', (2224, 2259)... |
import numpy as np
from bokeh.models import ColumnDataSource, HoverTool
from bokeh.palettes import Cividis256 as Pallete
from bokeh.plotting import Figure, figure
from bokeh.transform import factor_cmap
def draw_interactive_scatter_plot(
texts: np.ndarray,
xs: np.ndarray,
ys: np.ndarray,
values: np.nd... | [
"bokeh.transform.factor_cmap",
"numpy.log10",
"bokeh.plotting.figure",
"bokeh.models.HoverTool"
] | [((1245, 1334), 'bokeh.models.HoverTool', 'HoverTool', ([], {'tooltips': "[(text_column, '@text{safe}'), (label_column, '@original_label')]"}), "(tooltips=[(text_column, '@text{safe}'), (label_column,\n '@original_label')])\n", (1254, 1334), False, 'from bokeh.models import ColumnDataSource, HoverTool\n'), ((1353, 1... |
def plot_power_spectra(kbins, deltab_2, deltac_2, deltac_2_nodeconv, tf, ax=None):
'''
Plot density and velocity power spectra and compare with CAMB
'''
import numpy as np
import matplotlib.pylab as plt
from seren3.cosmology.transfer_function import TF
if ax is None:
ax = plt.gca()
... | [
"matplotlib.pylab.gca",
"matplotlib.pylab.subplots",
"numpy.sqrt",
"numpy.ones",
"matplotlib.pylab.figure",
"matplotlib.gridspec.GridSpec",
"numpy.linspace",
"numpy.isnan",
"matplotlib.pylab.show"
] | [((3864, 3911), 'matplotlib.pylab.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(2)', 'figsize': '(12, 6)'}), '(nrows=1, ncols=2, figsize=(12, 6))\n', (3876, 3911), True, 'import matplotlib.pylab as plt\n'), ((4410, 4420), 'matplotlib.pylab.show', 'plt.show', ([], {}), '()\n', (4418, 4420), True, 'import m... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import List
from unittest.mock import patch
import numpy as np
from ...common import testing
from . import co... | [
"numpy.random.normal",
"numpy.testing.assert_equal",
"numpy.testing.assert_almost_equal",
"numpy.zeros",
"numpy.random.seed",
"numpy.all",
"unittest.mock.patch"
] | [((674, 692), 'numpy.random.seed', 'np.random.seed', (['(24)'], {}), '(24)\n', (688, 692), True, 'import numpy as np\n'), ((940, 970), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)'], {'size': '(8)'}), '(0, 1, size=8)\n', (956, 970), True, 'import numpy as np\n'), ((1036, 1095), 'numpy.testing.assert_almost_... |
#!env python
import collections
import queue
import logging
import enum
import functools
import json
import time
import os
import gzip
import shutil
import random # ONLY USED FOR RANDOM DELAY AT BEGINNING.
import numpy as np
import argparse
import sys
sys.path.append("../src-testbed")
import events
import common
imp... | [
"numpy.random.default_rng",
"events.WorkerQueueCompletionEvent",
"common.getLogger",
"logging.debug",
"events.ModelAdditionEvent",
"logging.info",
"sys.path.append",
"logging.error",
"os.path.exists",
"common.getParser",
"json.dumps",
"events.ModelRemovalEvent",
"events.RequestCompletionEven... | [((254, 287), 'sys.path.append', 'sys.path.append', (['"""../src-testbed"""'], {}), "('../src-testbed')\n", (269, 287), False, 'import sys\n'), ((14014, 14063), 'common.getLogger', 'common.getLogger', ([], {'hide_debug': '(not flags.show_debug)'}), '(hide_debug=not flags.show_debug)\n', (14030, 14063), False, 'import c... |
# the simplex projection algorithm implemented as a layer, while using the saliency maps to obtain object size estimates
import sys
sys.path.insert(0,'/home/briq/libs/caffe/python')
import caffe
import random
import numpy as np
import scipy.misc
import imageio
import cv2
import scipy.ndimage as nd
import os.path
import... | [
"sys.path.insert",
"numpy.where",
"scipy.io.loadmat",
"random.seed",
"numpy.sum"
] | [((132, 182), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/briq/libs/caffe/python"""'], {}), "(0, '/home/briq/libs/caffe/python')\n", (147, 182), False, 'import sys\n'), ((711, 723), 'numpy.sum', 'np.sum', (['V_im'], {}), '(V_im)\n', (717, 723), True, 'import numpy as np\n'), ((1802, 1815), 'random.seed', '... |
'''
This file implements JPP-Net for human parsing and pose detection.
'''
import tensorflow as tf
import os
from tensorflow.python.framework import graph_util
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
from tensorflow.python.platform import gfile
import time
class JPP(object):
... | [
"tensorflow.Session",
"tensorflow.GraphDef",
"tensorflow.global_variables_initializer",
"numpy.array",
"tensorflow.python.platform.gfile.FastGFile",
"tensorflow.import_graph_def",
"tensorflow.ConfigProto",
"tensorflow.GPUOptions"
] | [((423, 493), 'numpy.array', 'np.array', (['(104.00698793, 116.66876762, 122.67891434)'], {'dtype': 'np.float32'}), '((104.00698793, 116.66876762, 122.67891434), dtype=np.float32)\n', (431, 493), True, 'import numpy as np\n'), ((548, 580), 'tensorflow.GPUOptions', 'tf.GPUOptions', ([], {'allow_growth': '(True)'}), '(al... |
#
# GeomProc: geometry processing library in python + numpy
#
# Copyright (c) 2008-2021 <NAME> <<EMAIL>>
# under the MIT License.
#
# See file LICENSE.txt for details on the copyright license.
#
"""This module contains the implicit function class of the GeomProc
geometry processing library used for defining implicit fu... | [
"numpy.linalg.solve",
"math.sqrt",
"numpy.array",
"numpy.zeros",
"numpy.sum"
] | [((2726, 2746), 'numpy.zeros', 'np.zeros', (['(n * 2, 3)'], {}), '((n * 2, 3))\n', (2734, 2746), True, 'import numpy as np\n'), ((2773, 2793), 'numpy.zeros', 'np.zeros', (['(n * 2, 1)'], {}), '((n * 2, 1))\n', (2781, 2793), True, 'import numpy as np\n'), ((5602, 5644), 'numpy.linalg.solve', 'np.linalg.solve', (['self.K... |
import pickle
import numpy as np
import matplotlib.pyplot as plt
with open('./quadratic/eval_record.pickle','rb') as loss:
data = pickle.load(loss)
print('Mat_record',len(data['Mat_record']))
#print('bias',data['inter_gradient_record'])
#print('constant',data['intra_record'])
with open('./quadratic/evaluate_reco... | [
"numpy.array",
"pickle.load"
] | [((382, 409), 'numpy.array', 'np.array', (["data1['x_record']"], {}), "(data1['x_record'])\n", (390, 409), True, 'import numpy as np\n'), ((135, 152), 'pickle.load', 'pickle.load', (['loss'], {}), '(loss)\n', (146, 152), False, 'import pickle\n'), ((359, 377), 'pickle.load', 'pickle.load', (['loss1'], {}), '(loss1)\n',... |
#--SHAPES and TEXTS--#
import cv2
import numpy as np
#We are going to use the numpy library to create our matrix
#0 stands for black and 1 stands for white
img = np.zeros((512,512,3),np.uint8) # (height,width) and the channel, it gives us value range 0-255
#print(img)
#img[200:300,100:300] = 255,0,0 #whole... | [
"cv2.rectangle",
"cv2.line",
"cv2.putText",
"cv2.imshow",
"cv2.circle",
"numpy.zeros",
"cv2.waitKey"
] | [((173, 206), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uint8)\n', (181, 206), True, 'import numpy as np\n'), ((395, 462), 'cv2.line', 'cv2.line', (['img', '(0, 0)', '(img.shape[1], img.shape[0])', '(0, 255, 0)', '(3)'], {}), '(img, (0, 0), (img.shape[1], img.shape[0]), (0, 255... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 13 15:10:58 2021
@author: nguy0936
"""
from pyenvnoise.utils import ptiread
data = ptiread('R:\CMPH-Windfarm Field Study\Hornsdale\set2\Recording-1.1.pti')
import numpy as np
file_name = 'R:\CMPH-Windfarm Field Study\Hornsdale\set2\Recording-1.1.pti'
fid = open(file... | [
"numpy.fromfile",
"numpy.delete",
"pyenvnoise.utils.ptiread",
"numpy.array",
"numpy.transpose"
] | [((133, 209), 'pyenvnoise.utils.ptiread', 'ptiread', (['"""R:\\\\CMPH-Windfarm Field Study\\\\Hornsdale\\\\set2\\\\Recording-1.1.pti"""'], {}), "('R:\\\\CMPH-Windfarm Field Study\\\\Hornsdale\\\\set2\\\\Recording-1.1.pti')\n", (140, 209), False, 'from pyenvnoise.utils import ptiread\n'), ((2162, 2203), 'numpy.fromfile'... |
import numpy as np
from OpenGL.arrays import vbo
from .Mesh_utils import MeshFuncs, MeshSignals, BBox
import openmesh
import copy
from .Shader import *
orig_set_vertex_property_array = openmesh.PolyMesh.set_vertex_property_array
def svpa(self, prop_name, array=None, element_shape=None, element_value=None):
if ar... | [
"numpy.identity",
"numpy.product",
"openmesh.PolyMesh",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.empty",
"copy.deepcopy",
"numpy.shape",
"numpy.broadcast_to"
] | [((3084, 3116), 'numpy.identity', 'np.identity', (['(3)'], {'dtype': 'np.float64'}), '(3, dtype=np.float64)\n', (3095, 3116), True, 'import numpy as np\n'), ((3133, 3165), 'numpy.identity', 'np.identity', (['(4)'], {'dtype': 'np.float64'}), '(4, dtype=np.float64)\n', (3144, 3165), True, 'import numpy as np\n'), ((7821,... |
import numpy as np
import pyautogui
import imutils
from mss import mss
from PIL import Image
import cv2
import copy
import argparse
from hand_poses import HandPoses
from hand_detect import HandDetect
from delay import Delay
from spotify_controls import SpotifyControls
parser = argparse.ArgumentParser()
parser.add_a... | [
"numpy.flip",
"delay.Delay",
"argparse.ArgumentParser",
"mss.mss",
"hand_poses.HandPoses",
"hand_detect.HandDetect",
"cv2.flip",
"cv2.imshow",
"cv2.putText",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"copy.deepcopy",
"spotify_controls.SpotifyControls",
"cv2.waitKey"
] | [((282, 307), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (305, 307), False, 'import argparse\n'), ((1307, 1357), 'hand_detect.HandDetect', 'HandDetect', ([], {'detect_threshold': 'args.detect_threshold'}), '(detect_threshold=args.detect_threshold)\n', (1317, 1357), False, 'from hand_detect ... |
import numpy as np
from scipy.fft import fft
def CAR(X, labels):
N = X.shape
N_classes = len(np.unique(labels))
data10 = np.zeros((N[0], N[1], 1))
data11 = np.zeros((N[0], N[1], 1))
data12 = np.zeros((N[0], N[1], 1))
data13 = np.zeros((N[0], N[1], 1))
for trial in range(N[2]): ##... | [
"numpy.mean",
"numpy.unique",
"numpy.where",
"numpy.delete",
"numpy.array",
"numpy.zeros",
"numpy.vstack",
"scipy.fft.fft"
] | [((140, 165), 'numpy.zeros', 'np.zeros', (['(N[0], N[1], 1)'], {}), '((N[0], N[1], 1))\n', (148, 165), True, 'import numpy as np\n'), ((179, 204), 'numpy.zeros', 'np.zeros', (['(N[0], N[1], 1)'], {}), '((N[0], N[1], 1))\n', (187, 204), True, 'import numpy as np\n'), ((218, 243), 'numpy.zeros', 'np.zeros', (['(N[0], N[1... |
from typing import Optional, Callable, List
import torch as tc
import numpy as np
from drl.agents.architectures.stateless.abstract import StatelessArchitecture
class Identity(StatelessArchitecture):
"""
Identity architecture. Useful for unit testing.
"""
def __init__(
self,
i... | [
"numpy.prod"
] | [((938, 964), 'numpy.prod', 'np.prod', (['self._input_shape'], {}), '(self._input_shape)\n', (945, 964), True, 'import numpy as np\n')] |
'''
Hash and Acoustic Fingerprint Functions
<NAME>
'''
import numpy as np
def findAdjPts(index,A,delay_time,delta_time,delta_freq):
"Find the three closest adjacent points to the anchor point"
adjPts = []
low_x = A[index][0]+delay_time
high_x = low_x+delta_time
low_y = A[index][1]-delta_freq/2... | [
"numpy.all",
"numpy.sort"
] | [((1283, 1310), 'numpy.sort', 'np.sort', (['hashMatrix'], {'axis': '(0)'}), '(hashMatrix, axis=0)\n', (1290, 1310), True, 'import numpy as np\n'), ((2025, 2052), 'numpy.sort', 'np.sort', (['hashMatrix'], {'axis': '(0)'}), '(hashMatrix, axis=0)\n', (2032, 2052), True, 'import numpy as np\n'), ((1236, 1267), 'numpy.all',... |
from utils.stats_trajectories import trajectory_arclength
import statistics as stats
import numpy as np
import logging
# Returns a matrix of trajectories:
# the entry (i,j) has the paths that go from the goal i to the goal j
def separate_trajectories_between_goals(trajectories, goals_areas):
goals_n = len(goals_are... | [
"statistics.stdev",
"numpy.median",
"numpy.reshape",
"utils.stats_trajectories.trajectory_arclength",
"numpy.max",
"statistics.median",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.empty",
"numpy.square",
"numpy.concatenate",
"numpy.min",
"numpy.cov",
"logging.error",
"numpy.var"
... | [((370, 412), 'numpy.empty', 'np.empty', (['(goals_n, goals_n)'], {'dtype': 'object'}), '((goals_n, goals_n), dtype=object)\n', (378, 412), True, 'import numpy as np\n'), ((1884, 1904), 'statistics.median', 'stats.median', (['arclen'], {}), '(arclen)\n', (1896, 1904), True, 'import statistics as stats\n'), ((2437, 2486... |
import numpy as np
from utils.metrics import variation_ratio, entropy, bald
from utils.progress_bar import Progbar
def get_monte_carlo_metric(metric):
if metric == 'variation_ratio':
return VariationRationMC
elif metric == 'entropy':
return EntropyMC
elif metric == 'bald':
return ... | [
"numpy.mean",
"utils.metrics.bald",
"utils.metrics.variation_ratio",
"numpy.equal",
"numpy.array",
"numpy.zeros",
"numpy.bincount",
"numpy.random.uniform",
"utils.progress_bar.Progbar",
"numpy.amax",
"utils.metrics.entropy"
] | [((2651, 2711), 'numpy.zeros', 'np.zeros', ([], {'shape': '(self.data_batch.shape[0], self.num_samples)'}), '(shape=(self.data_batch.shape[0], self.num_samples))\n', (2659, 2711), True, 'import numpy as np\n'), ((3625, 3649), 'numpy.zeros', 'np.zeros', ([], {'shape': 'num_data'}), '(shape=num_data)\n', (3633, 3649), Tr... |
from __future__ import print_function
from numpy import pi, arange, sin, cos
import numpy as np
import os.path
import time
from bokeh.objects import (Plot, DataRange1d, LinearAxis, DatetimeAxis,
ColumnDataSource, Glyph, PanTool, WheelZoomTool)
from bokeh.glyphs import Circle
from bokeh import session
x = ara... | [
"bokeh.session.HTMLFileSession",
"bokeh.objects.Glyph",
"bokeh.objects.WheelZoomTool",
"bokeh.objects.LinearAxis",
"bokeh.objects.PanTool",
"bokeh.objects.DatetimeAxis",
"bokeh.glyphs.Circle",
"numpy.sin",
"bokeh.objects.Plot",
"time.time",
"numpy.arange"
] | [((317, 345), 'numpy.arange', 'arange', (['(-2 * pi)', '(2 * pi)', '(0.1)'], {}), '(-2 * pi, 2 * pi, 0.1)\n', (323, 345), False, 'from numpy import pi, arange, sin, cos\n'), ((350, 356), 'numpy.sin', 'sin', (['x'], {}), '(x)\n', (353, 356), False, 'from numpy import pi, arange, sin, cos\n'), ((690, 760), 'bokeh.glyphs.... |
import numpy as np
from skimage.measure import label
from lib.utils_lung_segmentation import get_max_rect_in_mask
def getLargestCC(segmentation):
'''find largest connected component
return: binary mask of the largest connected component'''
labels = label(segmentation)
assert(labels.max() != 0 ) # a... | [
"numpy.bincount",
"skimage.measure.label",
"lib.utils_lung_segmentation.get_max_rect_in_mask"
] | [((266, 285), 'skimage.measure.label', 'label', (['segmentation'], {}), '(segmentation)\n', (271, 285), False, 'from skimage.measure import label\n'), ((690, 725), 'lib.utils_lung_segmentation.get_max_rect_in_mask', 'get_max_rect_in_mask', (['blobs_largest'], {}), '(blobs_largest)\n', (710, 725), False, 'from lib.utils... |
# Copyright 2018 D-Wave Systems Inc.
#
# 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... | [
"dimod.unembed_response",
"numpy.hstack",
"dimod.Response",
"dimod.BinaryQuadraticModel.empty",
"dwave_networkx.chimera_graph",
"dimod.embed_bqm",
"dwave_networkx.draw_chimera"
] | [((17215, 17318), 'dwave_networkx.chimera_graph', 'dnx.chimera_graph', (['m', 'n', 't'], {'node_list': 'child.structure.nodelist', 'edge_list': 'child.structure.edgelist'}), '(m, n, t, node_list=child.structure.nodelist, edge_list=\n child.structure.edgelist)\n', (17232, 17318), True, 'import dwave_networkx as dnx\n... |
# Copyright (c) 2021, Parallel Systems Architecture Laboratory (PARSA), EPFL &
# Machine Learning and Optimization Laboratory (MLO), EPFL. 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. Red... | [
"numpy.random.random_integers",
"torch.LongTensor",
"torch.nn.functional.embedding",
"torch.autograd.Variable",
"torch.nn.Embedding"
] | [((2519, 2649), 'torch.nn.functional.embedding', 'F.embedding', (['words', 'masked_embed_weight', 'padding_idx', 'embed.max_norm', 'embed.norm_type', 'embed.scale_grad_by_freq', 'embed.sparse'], {}), '(words, masked_embed_weight, padding_idx, embed.max_norm, embed.\n norm_type, embed.scale_grad_by_freq, embed.sparse... |
'''
Investigating the offset of CIV emission in the Cloudy models
as a function of ionization, nebular metallicity, stellar metallicity,
stellar population type, age, etc.
'''
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from scipy.optimize import curve_... | [
"scipy.optimize.curve_fit",
"numpy.median",
"matplotlib.pyplot.ylabel",
"numpy.power",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"warnings.simplefilter",
"matplotlib.py... | [((427, 474), 'warnings.simplefilter', 'warnings.simplefilter', (['"""error"""', 'OptimizeWarning'], {}), "('error', OptimizeWarning)\n", (448, 474), False, 'import warnings\n'), ((983, 1009), 'numpy.arange', 'np.arange', (['(-3.5)', '(-1.4)', '(0.2)'], {}), '(-3.5, -1.4, 0.2)\n', (992, 1009), True, 'import numpy as np... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import psoap
from psoap.data import lkca14, redshift, Chunk
from psoap import matrix_functions
from psoap import covariance
from psoap import orbit
# from matplotlib.ticker import FormatStrFormatter as FSF
# from matplotlib.tick... | [
"numpy.sqrt",
"scipy.interpolate.interp1d",
"numpy.array",
"psoap.orbit.SB2",
"numpy.save",
"numpy.searchsorted",
"numpy.max",
"numpy.linspace",
"numpy.empty",
"numpy.min",
"numpy.random.normal",
"numpy.ones",
"psoap.data.Chunk",
"numpy.std",
"numpy.ones_like",
"psoap.data.redshift",
... | [((577, 643), 'numpy.array', 'np.array', (['[2.1, 4.9, 8.0, 9.9, 12.2, 16.0, 16.9, 19.1, 22.3, 26.1]'], {}), '([2.1, 4.9, 8.0, 9.9, 12.2, 16.0, 16.9, 19.1, 22.3, 26.1])\n', (585, 643), True, 'import numpy as np\n'), ((700, 750), 'psoap.orbit.SB2', 'orbit.SB2', (['q', 'K', 'e', 'omega', 'P', 'T0', 'gamma', 'obs_dates'],... |
import cv2
import sys
import json
from image_encoder.image_encoder import decode
import numpy
import requests
# Get user supplied values
def get_image(fpath):
with open(fpath) as f:
record = [json.loads(line) for line in f]
img = decode(record[0]["image"])
return img
def n_faces(fpath):
cascP... | [
"image_encoder.image_encoder.decode",
"json.loads",
"requests.post",
"numpy.array",
"cv2.cvtColor",
"cv2.CascadeClassifier",
"pika_listener.QueueListener"
] | [((247, 273), 'image_encoder.image_encoder.decode', 'decode', (["record[0]['image']"], {}), "(record[0]['image'])\n", (253, 273), False, 'from image_encoder.image_encoder import decode\n'), ((413, 444), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['cascPath'], {}), '(cascPath)\n', (434, 444), False, 'import cv2\... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import optparse
import os
import re
import sys
import vtk
from multiprocessing import Process
import parse_imx
RADIUS = 3 # For Open and Gauss
SCALE = 50.0 # For Rasterization
class RepairMeshParser(optparse.OptionParser):
def __init__(self):
... | [
"vtk.vtkPolyDataToImageStencil",
"multiprocessing.Process",
"vtk.vtkOBJExporter",
"vtk.vtkImageStencil",
"vtk.vtkDecimatePro",
"vtk.vtkVRMLExporter",
"os.remove",
"vtk.vtkVRMLImporter",
"vtk.vtkImageDilateErode3D",
"os.path.isdir",
"vtk.vtkRenderer",
"vtk.vtkMetaImageWriter",
"sys.stdout.flu... | [((1355, 1379), 'vtk.vtkMetaImageWriter', 'vtk.vtkMetaImageWriter', ([], {}), '()\n', (1377, 1379), False, 'import vtk\n'), ((2470, 2501), 'vtk.vtkPolyDataToImageStencil', 'vtk.vtkPolyDataToImageStencil', ([], {}), '()\n', (2499, 2501), False, 'import vtk\n'), ((2841, 2859), 'vtk.vtkImageData', 'vtk.vtkImageData', ([],... |
#!/usr/bin/env python
from holtztools import plots,html
from astropy.io import fits,ascii
import numpy as np
import math
import pdb
import argparse
import os
import matplotlib.pyplot as plt
def throughplot(instrument='apogee-s',outfile=None,inter=False) :
'''
Routine to make zeropoint/throughput plots from ap... | [
"numpy.log10",
"argparse.ArgumentParser",
"numpy.where",
"holtztools.html.htmltab",
"numpy.exp",
"holtztools.plots.multi",
"holtztools.plots.plotc",
"numpy.isfinite",
"os.path.basename",
"pdb.set_trace",
"astropy.io.fits.open",
"astropy.io.ascii.read",
"numpy.arange"
] | [((2788, 2822), 'holtztools.plots.multi', 'plots.multi', (['(2)', '(3)'], {'figsize': '(8, 12)'}), '(2, 3, figsize=(8, 12))\n', (2799, 2822), False, 'from holtztools import plots, html\n'), ((5967, 5984), 'holtztools.plots.multi', 'plots.multi', (['(1)', '(1)'], {}), '(1, 1)\n', (5978, 5984), False, 'from holtztools im... |
from datetime import date
from models import gtfs, config, util, nextbus, routeconfig
import argparse
import shapely
import partridge as ptg
import numpy as np
from pathlib import Path
import requests
import json
import boto3
import gzip
import hashlib
import math
import zipfile
# Downloads and parses the GTFS specifi... | [
"zipfile.ZipFile",
"models.nextbus.get_route_list",
"shapely.geometry.Point",
"numpy.argsort",
"numpy.array",
"partridge.load_geo_feed",
"argparse.ArgumentParser",
"pathlib.Path",
"json.dumps",
"boto3.resource",
"models.nextbus.get_route_config",
"models.config.get_agency",
"shapely.ops.tran... | [((2964, 2990), 'numpy.argsort', 'np.argsort', (['terminal_dists'], {}), '(terminal_dists)\n', (2974, 2990), True, 'import numpy as np\n'), ((4156, 4216), 'shapely.geometry.Point', 'shapely.geometry.Point', (['shape_lines_xy[best_index].coords[0]'], {}), '(shape_lines_xy[best_index].coords[0])\n', (4178, 4216), False, ... |
"""AVLetters lip dataset.
The original dataset is available from
http://www.ee.surrey.ac.uk/Projects/LILiR/datasets/avletters1/index.html
This dataset consists of three repetitions by each of 10 talkers,
five male (two with moustaches) and five female,
of the isolated letters A-Z, a total of 780 utterances
Refe... | [
"os.path.exists",
"os.listdir",
"scipy.io.loadmat",
"os.path.join",
"os.path.dirname",
"numpy.zeros",
"numpy.empty"
] | [((736, 753), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (743, 753), False, 'from os.path import dirname, exists, isfile, join\n'), ((1790, 1809), 'os.listdir', 'listdir', (['folderpath'], {}), '(folderpath)\n', (1797, 1809), False, 'from os import listdir\n'), ((2113, 2182), 'numpy.empty', 'np.e... |
import cv2
import numpy as np
img = cv2.imread('../Resources/Photos/park.jpg')
b,g,r = cv2.split(img)
# cv2.imshow('Blue',b)
# cv2.imshow('Green',g)
# cv2.imshow('Red',r)
blank = np.zeros(img.shape[:2],dtype='uint8')
blue = cv2.merge([b,blank,blank])
green = cv2.merge([blank,g,blank])
red = cv2.merge([blank,blank,r]... | [
"cv2.merge",
"cv2.imshow",
"numpy.zeros",
"cv2.waitKey",
"cv2.split",
"cv2.imread"
] | [((37, 79), 'cv2.imread', 'cv2.imread', (['"""../Resources/Photos/park.jpg"""'], {}), "('../Resources/Photos/park.jpg')\n", (47, 79), False, 'import cv2\n'), ((89, 103), 'cv2.split', 'cv2.split', (['img'], {}), '(img)\n', (98, 103), False, 'import cv2\n'), ((182, 220), 'numpy.zeros', 'np.zeros', (['img.shape[:2]'], {'d... |
# encoding: utf-8
"""
@author: ccj
@contact:
"""
import numpy as np
from typing import List, Dict, Tuple, Any
import torch
import torch.nn.functional as F
def crop_white(image: np.ndarray, value: int = 255) -> np.ndarray:
"""
Crop white border from image
:param image: Type: np.ndarray, image to be ... | [
"torch.utils.data.dataloader.default_collate",
"numpy.sqrt",
"torch.stack",
"numpy.zeros",
"torch.nn.functional.one_hot",
"numpy.random.uniform",
"numpy.pad",
"torch.cat"
] | [((1593, 1709), 'numpy.pad', 'np.pad', (['image', '[[pad_h // 2, pad_h - pad_h // 2], [pad_w // 2, pad_w - pad_w // 2], [0, 0]]'], {'constant_values': '(255)'}), '(image, [[pad_h // 2, pad_h - pad_h // 2], [pad_w // 2, pad_w - pad_w //\n 2], [0, 0]], constant_values=255)\n', (1599, 1709), True, 'import numpy as np\n... |
import pickle
import numpy as np
import scipy.linalg as sci
from scipy import signal
# Rotations
def wrap2Pi(x):
xm = np.mod(x+np.pi,(2.0*np.pi))
return xm-np.pi
def Rot(x):
return np.array([[np.cos(x),-np.sin(x)],[np.sin(x),np.cos(x)]])
def RotVec(x_vec, rot_vec):
rvec = np.array([np.dot(x_vec[i,:-1],Rot(rot_ve... | [
"numpy.hstack",
"scipy.signal.filtfilt",
"numpy.log",
"numpy.sin",
"numpy.cov",
"numpy.mod",
"numpy.arange",
"numpy.divide",
"numpy.mean",
"numpy.vstack",
"numpy.abs",
"numpy.ones",
"pickle.load",
"numpy.cos",
"numpy.shape",
"numpy.copy",
"pickle.dump",
"scipy.signal.butter",
"nu... | [((120, 150), 'numpy.mod', 'np.mod', (['(x + np.pi)', '(2.0 * np.pi)'], {}), '(x + np.pi, 2.0 * np.pi)\n', (126, 150), True, 'import numpy as np\n'), ((545, 571), 'numpy.divide', 'np.divide', (['(x - x[0])', 't_vec'], {}), '(x - x[0], t_vec)\n', (554, 571), True, 'import numpy as np\n'), ((730, 743), 'numpy.cov', 'np.c... |
"""
Make a learning curve for the full neural net trained on all 30 output
measures. The point of this graph is to investigate how much training data
is needed to achieve various MSE values.
"""
import matplotlib.pyplot as plt
import numpy as np
import cPickle as pickle
import lasagne
from lasagne import layers
from ... | [
"numpy.mean",
"cPickle.dump",
"lignet_utils.gen_train_test",
"lasagne.nonlinearities.ScaledTanH",
"numpy.std",
"nolearn.lasagne.TrainSplit"
] | [((593, 609), 'lignet_utils.gen_train_test', 'gen_train_test', ([], {}), '()\n', (607, 609), False, 'from lignet_utils import gen_train_test\n'), ((764, 810), 'lasagne.nonlinearities.ScaledTanH', 'ScaledTanH', ([], {'scale_in': '(2.0 / 3)', 'scale_out': '(1.7159)'}), '(scale_in=2.0 / 3, scale_out=1.7159)\n', (774, 810)... |
import numpy, copy
from numpy import nan
from PyQt5.QtGui import QPalette, QColor, QFont
from PyQt5.QtWidgets import QMessageBox
from orangewidget import gui
from orangewidget import widget
from orangewidget.settings import Setting
from oasys.widgets import gui as oasysgui
from oasys.widgets import congruence
from oa... | [
"oasys.widgets.gui.widgetBox",
"oasys.widgets.gui.createTabPage",
"PyQt5.QtGui.QColor",
"oasys.util.oasys_util.read_surface_file",
"oasys.widgets.gui.tabWidget",
"copy.deepcopy",
"orangewidget.settings.Setting",
"wofrysrw.propagator.wavefront2D.srw_wavefront.SRWWavefront.fromGenericWavefront",
"oasy... | [((2028, 2039), 'orangewidget.settings.Setting', 'Setting', (['[]'], {}), '([])\n', (2035, 2039), False, 'from orangewidget.settings import Setting\n'), ((2065, 2077), 'orangewidget.settings.Setting', 'Setting', (['(1.0)'], {}), '(1.0)\n', (2072, 2077), False, 'from orangewidget.settings import Setting\n'), ((2213, 225... |
import numpy as np
import torch
from matplotlib import pyplot as plt
from scipy.spatial.distance import directed_hausdorff
from numpy import linalg as LA
from sklearn import metrics
def get_roc_auc(target, prediction):
y_true = target.view(-1).numpy()
y_score = prediction.view(-1).cpu().detach().numpy()
... | [
"scipy.spatial.distance.directed_hausdorff",
"numpy.arange",
"numpy.where",
"sklearn.metrics.auc",
"sklearn.metrics.precision_recall_curve",
"sklearn.metrics.roc_auc_score",
"numpy.array",
"matplotlib.pyplot.figure",
"torch.sum",
"numpy.linalg.norm",
"numpy.save"
] | [((336, 374), 'sklearn.metrics.roc_auc_score', 'metrics.roc_auc_score', (['y_true', 'y_score'], {}), '(y_true, y_score)\n', (357, 374), False, 'from sklearn import metrics\n'), ((574, 621), 'sklearn.metrics.precision_recall_curve', 'metrics.precision_recall_curve', (['y_true', 'y_score'], {}), '(y_true, y_score)\n', (6... |
# -*- encoding: utf-8 -*-
"""
@Author : zYx.Tom
@Contact : <EMAIL>
@site : https://zhuyuanxiang.github.io
---------------------------
@Software : PyCharm
@Project : tensorflow_cookbook
@File : C0707_Doc2Vec.py
@Version : v0.1
@Time : 2019-12-06 17:12
@License : ... | [
"numpy.sqrt",
"tensorflow.python.framework.ops.reset_default_graph",
"matplotlib.pyplot.ylabel",
"text_tools.generate_batch_data",
"text_tools.text_to_numbers",
"numpy.array",
"tensorflow.reduce_mean",
"text_tools.build_dictionary",
"tensorflow.set_random_seed",
"tensorflow.cast",
"tensorflow.sl... | [((1086, 1171), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(8)', 'suppress': '(True)', 'threshold': 'np.inf', 'linewidth': '(200)'}), '(precision=8, suppress=True, threshold=np.inf, linewidth=200\n )\n', (1105, 1171), True, 'import numpy as np\n'), ((1219, 1239), 'numpy.random.seed', 'np.ra... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import torch
import numpy as np
from utils import Generator
import matplotlib.pyplot as plt
from IPython.display import HTML
import torchvision.utils as vutils
import matplotlib.animation as animation
from IPython import embed
if __name__ == "__main__":
... | [
"utils.Generator",
"matplotlib.pyplot.title",
"IPython.embed",
"torch.nn.DataParallel",
"os.path.join",
"matplotlib.animation.ArtistAnimation",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axis",
"numpy.transpose",
"matplotlib.pyplot.subplot",
"torch.randn",
"matplotlib.pyplot.show"
] | [((495, 546), 'torch.nn.DataParallel', 'torch.nn.DataParallel', (['generator'], {'device_ids': '[0, 1]'}), '(generator, device_ids=[0, 1])\n', (516, 546), False, 'import torch\n'), ((968, 994), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 8)'}), '(figsize=(8, 8))\n', (978, 994), True, 'import matplot... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.colors import ListedColormap
from . import common
def v_loc(x):
return 40*np.log10(x + 1)
def x_loc(x):
return 40*(np.log10(x) + 1)
def main(debug=False):
name = ['I', 'SCA', 'tfp']
suffi... | [
"matplotlib.pyplot.setp",
"numpy.log10",
"pandas.read_csv",
"seaborn.heatmap",
"matplotlib.colors.ListedColormap",
"seaborn.boxenplot",
"pandas.concat"
] | [((744, 765), 'pandas.concat', 'pd.concat', (['df'], {'axis': '(1)'}), '(df, axis=1)\n', (753, 765), True, 'import pandas as pd\n'), ((1477, 1520), 'matplotlib.colors.ListedColormap', 'ListedColormap', (["['silver', 'grey', 'black']"], {}), "(['silver', 'grey', 'black'])\n", (1491, 1520), False, 'from matplotlib.colors... |
import symjax
import symjax.tensor as T
import matplotlib.pyplot as plt
import numpy as np
J = 5
Q = 4
scales = T.power(2, T.linspace(0.1, J - 1, J * Q))
scales = scales[:, None]
print(scales.get())
wavelet = symjax.tensor.signal.complex_morlet(5 * scales, np.pi / scales)
waveletw = symjax.tensor.signal.fourier_comp... | [
"numpy.abs",
"matplotlib.pyplot.savefig",
"symjax.tensor.linspace",
"symjax.tensor.signal.littewood_paley_normalization",
"symjax.tensor.signal.complex_morlet",
"matplotlib.pyplot.plot",
"numpy.fft.ifft",
"numpy.fft.ifftshift",
"matplotlib.pyplot.subplot",
"symjax.tensor.signal.fourier_complex_mor... | [((212, 275), 'symjax.tensor.signal.complex_morlet', 'symjax.tensor.signal.complex_morlet', (['(5 * scales)', '(np.pi / scales)'], {}), '(5 * scales, np.pi / scales)\n', (247, 275), False, 'import symjax\n'), ((287, 381), 'symjax.tensor.signal.fourier_complex_morlet', 'symjax.tensor.signal.fourier_complex_morlet', (['(... |
import numpy as np
import pandas as pd
import plotly.graph_objs as go
# import plotly.plotly as py
dates = pd.date_range('01-Jan-2010', pd.datetime.now().date(), freq='D')
df = pd.DataFrame(100 + np.random.randn(dates.size).cumsum(), dates, columns=['AAPL'])
trace = go.Scatter(x=df.index, y=df.AAPL)
data = [trace]
l... | [
"plotly.graph_objs.Figure",
"numpy.random.randn",
"plotly.graph_objs.Scatter",
"pandas.datetime.now"
] | [((270, 303), 'plotly.graph_objs.Scatter', 'go.Scatter', ([], {'x': 'df.index', 'y': 'df.AAPL'}), '(x=df.index, y=df.AAPL)\n', (280, 303), True, 'import plotly.graph_objs as go\n'), ((1145, 1156), 'plotly.graph_objs.Figure', 'go.Figure', ([], {}), '()\n', (1154, 1156), True, 'import plotly.graph_objs as go\n'), ((138, ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 15 21:56:08 2020
@author: <NAME>
"""
# STEP1----------------- # Importing the libraries------------
#-------------------------------------------------------------
import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import glob
... | [
"sklearn.preprocessing.LabelEncoder",
"tensorflow.python.client.device_lib.list_local_devices",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.classification_report",
"sklearn.ensemble.AdaBoostClassifier",
"sklearn.model_selection.StratifiedKFold",
"keras.layers.Dense",
"numpy.mean"... | [((1638, 1678), 'os.chdir', 'os.chdir', (['"""\\\\ML4TakeOver\\\\Data\\\\RawData"""'], {}), "('\\\\ML4TakeOver\\\\Data\\\\RawData')\n", (1646, 1678), False, 'import os\n'), ((1692, 1703), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1701, 1703), False, 'import os\n'), ((1827, 1872), 'pandas.read_csv', 'pd.read_csv', ([... |
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# @author: <NAME>
import os
from typing import Dict, Optional, Tuple, cast
import gym
import hydra.utils
from mbrl.env.offline_data import load_dataset_and_env
import numpy as np
import omegacon... | [
"numpy.random.default_rng",
"mbrl.env.offline_data.load_dataset_and_env",
"numpy.logical_or",
"os.getcwd",
"torch.Generator"
] | [((1098, 1134), 'numpy.random.default_rng', 'np.random.default_rng', ([], {'seed': 'cfg.seed'}), '(seed=cfg.seed)\n', (1119, 1134), True, 'import numpy as np\n'), ((2285, 2342), 'mbrl.env.offline_data.load_dataset_and_env', 'load_dataset_and_env', (['cfg.model_pretraining.train_dataset'], {}), '(cfg.model_pretraining.t... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import os
from collections import defaultdict
import numpy as np
from scipy.spatial import distance
from tqdm import tqdm
np.set_printoptions(threshold=np.inf, suppress=True)
def main(args):
num_batches = args.num_batches
bert_data = defaultdic... | [
"numpy.mean",
"scipy.spatial.distance.cosine",
"argparse.ArgumentParser",
"collections.defaultdict",
"numpy.concatenate",
"numpy.load",
"numpy.set_printoptions"
] | [((188, 240), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf', 'suppress': '(True)'}), '(threshold=np.inf, suppress=True)\n', (207, 240), True, 'import numpy as np\n'), ((310, 327), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (321, 327), False, 'from collections im... |
# pylint: disable=g-bad-file-header
# Copyright 2020 DeepMind Technologies Limited. 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/... | [
"numpy.mean",
"numpy.abs"
] | [((1677, 1699), 'numpy.mean', 'np.mean', (['squared_error'], {}), '(squared_error)\n', (1684, 1699), True, 'import numpy as np\n'), ((1883, 1917), 'numpy.abs', 'np.abs', (['(predictions - ground_truth)'], {}), '(predictions - ground_truth)\n', (1889, 1917), True, 'import numpy as np\n')] |
import torch
import torch.nn as nn
import argparse
from torch.utils.data import Dataset
import sys
'''
Block of net
'''
def net_block(n_in, n_out):
block = nn.Sequential(nn.Linear(n_in, n_out),
nn.BatchNorm1d(n_out),
nn.ReLU())
return block
class M... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.optim.lr_scheduler.MultiStepLR",
"torch.nn.Softmax",
"torch.nn.CrossEntropyLoss",
"torch.nn.init.constant_",
"torch.load",
"torch.from_numpy",
"torch.nn.init.xavier_normal_",
"torch.nn.BatchNorm1d",
"torch.nn.Linear",
"torch.utils.data.DataLoader",
... | [((1855, 1946), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', ([], {'dataset': 'dset', 'batch_size': 'param_batch_size', 'shuffle': 'shuffle'}), '(dataset=dset, batch_size=param_batch_size,\n shuffle=shuffle)\n', (1882, 1946), False, 'import torch\n'), ((2418, 2456), 'torch.load', 'torch.load', (['""... |
import numpy as np
import cv2
import glob
import PIL.ExifTags
import PIL.Image
from tqdm import tqdm
import os
import matplotlib.pyplot as plt
from pyntcloud import PyntCloud
import open3d as o3d
def create_output(vertices, colors, filename):
colors = colors.reshape(-1,3)
vertices = np.hstack([vertices.reshape(-1,3)... | [
"matplotlib.pyplot.imsave",
"cv2.undistort",
"cv2.reprojectImageTo3D",
"os.path.join",
"cv2.getOptimalNewCameraMatrix",
"cv2.StereoSGBM_create",
"cv2.cvtColor",
"numpy.savetxt",
"cv2.imread",
"numpy.float32"
] | [((997, 1013), 'cv2.imread', 'cv2.imread', (['left'], {}), '(left)\n', (1007, 1013), False, 'import cv2\n'), ((1026, 1043), 'cv2.imread', 'cv2.imread', (['right'], {}), '(right)\n', (1036, 1043), False, 'import cv2\n'), ((1253, 1310), 'cv2.getOptimalNewCameraMatrix', 'cv2.getOptimalNewCameraMatrix', (['K', 'dist', '(w,... |
# Copyright (c) 2016 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, s... | [
"theano.tensor.exp",
"theano.tensor.gt",
"numpy.sqrt",
"numpy.log",
"numpy.array",
"theano.shared",
"theano.function",
"numpy.asarray",
"theano.tensor.fvector",
"numpy.exp",
"theano.tensor.fill_diagonal",
"numpy.random.normal",
"sklearn.utils.check_random_state",
"theano.tensor.maximum",
... | [((2250, 2281), 'theano.tensor.fill_diagonal', 'T.fill_diagonal', (['esqdistance', '(0)'], {}), '(esqdistance, 0)\n', (2265, 2281), True, 'import theano.tensor as T\n'), ((2753, 2793), 'theano.tensor.fill_diagonal', 'T.fill_diagonal', (['(1 / (sqdistance + 1))', '(0)'], {}), '(1 / (sqdistance + 1), 0)\n', (2768, 2793),... |
import io
from PIL import Image, ImageDraw, ImageFont
import tensorflow as tf
import numpy as np
from matplotlib import cm
from matplotlib.colors import ListedColormap
import pdb
default_color = 'blue'
highlight_color = 'red'
class SemanticSegmentationOverlay:
def __init__(self, args):
self.segmap_key = arg... | [
"numpy.uint8",
"PIL.Image.fromarray",
"tensorflow.io.decode_image",
"tensorflow.io.parse_single_example",
"PIL.Image.blend",
"io.BytesIO",
"PIL.ImageFont.truetype",
"matplotlib.colors.ListedColormap",
"PIL.ImageDraw.Draw",
"numpy.zeros",
"tensorflow.io.FixedLenFeature",
"tensorflow.io.decode_r... | [((459, 513), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['"""./fonts/OpenSans-Regular.ttf"""', '(12)'], {}), "('./fonts/OpenSans-Regular.ttf', 12)\n", (477, 513), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((1067, 1086), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['img'], {}), '(img)\n', (1081, 1086)... |
'''
Authors: <NAME> and <NAME>
Date: July 10, 2017
Pre-cnmf-e processing of videos in chunks:
- Downsampling
- Motion Correction
'''
from os import path, system
import pims
import av
import numpy as np
import math
from tqdm import tqdm
from skimage import img_as_uint
from motion import align_video
import skimage.io
i... | [
"os.path.exists",
"numpy.mean",
"numpy.reshape",
"skimage.img_as_uint",
"skimage.morphology.square",
"os.path.splitext",
"h5py.File",
"av.VideoFrame.from_ndarray",
"os.path.dirname",
"av.open",
"numpy.array",
"os.path.basename",
"pims.ImageIOReader",
"motion.align_video",
"os.system",
... | [((1431, 1459), 'pims.ImageIOReader', 'pims.ImageIOReader', (['filename'], {}), '(filename)\n', (1449, 1459), False, 'import pims\n'), ((4013, 4031), 'numpy.arange', 'np.arange', (['dims[0]'], {}), '(dims[0])\n', (4022, 4031), True, 'import numpy as np\n'), ((4040, 4058), 'numpy.arange', 'np.arange', (['dims[1]'], {}),... |
import numpy as np
import pytest
import pytoolkit as tk
def test_load_voc_od_split(data_dir):
ds = tk.datasets.load_voc_od_split(data_dir / "od", split="train")
assert len(ds) == 3
assert tuple(ds.metadata["class_names"]) == ("~", "〇")
ann = ds.labels[0]
assert ann.path == (data_dir / "od" / "JP... | [
"numpy.array",
"pytoolkit.datasets.load_voc_od_split"
] | [((106, 167), 'pytoolkit.datasets.load_voc_od_split', 'tk.datasets.load_voc_od_split', (["(data_dir / 'od')"], {'split': '"""train"""'}), "(data_dir / 'od', split='train')\n", (135, 167), True, 'import pytoolkit as tk\n'), ((493, 510), 'numpy.array', 'np.array', (['[False]'], {}), '([False])\n', (501, 510), True, 'impo... |
# Copyright 2019 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | [
"numpy.array",
"armi.utils.units.getTc",
"armi.materials.material.Material.__init__"
] | [((1378, 1401), 'armi.materials.material.Material.__init__', 'Material.__init__', (['self'], {}), '(self)\n', (1395, 1401), False, 'from armi.materials.material import Material\n'), ((3236, 3249), 'armi.utils.units.getTc', 'getTc', (['Tc', 'Tk'], {}), '(Tc, Tk)\n', (3241, 3249), False, 'from armi.utils.units import get... |
import os
import csv
from utils import check_dir, make_sentences
import numpy as np
import pandas as pd
def transform(source_path):
rows = []
sentence_count = 1
new_sentence=True
for root, __subFolders, files in os.walk(source_path):
for file in files:
if file.endswith('.tags'):
... | [
"utils.make_sentences",
"os.path.join",
"numpy.setdiff1d",
"pandas.DataFrame",
"utils.check_dir",
"os.walk"
] | [((230, 250), 'os.walk', 'os.walk', (['source_path'], {}), '(source_path)\n', (237, 250), False, 'import os\n'), ((1461, 1497), 'numpy.setdiff1d', 'np.setdiff1d', (['sentence_idx', 'test_idx'], {}), '(sentence_idx, test_idx)\n', (1473, 1497), True, 'import numpy as np\n'), ((1577, 1616), 'utils.check_dir', 'check_dir',... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
def find_template(signal, rr):
return signal[200:400]
def conv(signal, template):
scores = []
template_length = len(template)
signal_length = len(signal)
for ind in ... | [
"numpy.dot",
"numpy.sqrt"
] | [((374, 425), 'numpy.dot', 'np.dot', (['signal[ind:ind + template_length]', 'template'], {}), '(signal[ind:ind + template_length], template)\n', (380, 425), True, 'import numpy as np\n'), ((440, 472), 'numpy.sqrt', 'np.sqrt', (['(score / template_length)'], {}), '(score / template_length)\n', (447, 472), True, 'import ... |
from __future__ import print_function
import numpy as np
try:
import QENSmodels
except ImportError:
print('Module QENSmodels not found')
def hwhmChudleyElliotDiffusion(q, D=0.23, L=1.0):
""" Returns some characteristics of `ChudleyElliotDiffusion` as functions
of the momentum transfer `q`:
the ha... | [
"numpy.reshape",
"numpy.ones",
"QENSmodels.lorentzian",
"numpy.asarray",
"numpy.sinc",
"numpy.zeros",
"doctest.testmod"
] | [((1468, 1499), 'numpy.asarray', 'np.asarray', (['q'], {'dtype': 'np.float32'}), '(q, dtype=np.float32)\n', (1478, 1499), True, 'import numpy as np\n'), ((1512, 1528), 'numpy.zeros', 'np.zeros', (['q.size'], {}), '(q.size)\n', (1520, 1528), True, 'import numpy as np\n'), ((1540, 1555), 'numpy.ones', 'np.ones', (['q.siz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.