code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import tkinter as tk from tkinter import * from tkinter import filedialog, Text import os from PIL import Image, ImageTk import matplotlib.pyplot as plt from matplotlib.figure import Figure import matplotlib.image as mpimg import cv2 import scipy import numpy as np from tkinter.font import Font import csv import matplo...
[ "os.remove", "csv.reader", "tkinter.font.Font", "matplotlib.pyplot.figure", "matplotlib.pyplot.imread", "os.chdir", "numpy.savetxt", "numpy.genfromtxt", "tkinter.filedialog.askopenfilename", "numpy.loadtxt", "matplotlib.pyplot.Axes", "skimage.io.imread", "matplotlib.image.imread", "csv.wri...
[((591, 602), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (600, 602), False, 'import os\n'), ((614, 632), 'os.chdir', 'os.chdir', (['dir_path'], {}), '(dir_path)\n', (622, 632), False, 'import os\n'), ((650, 698), 'tkinter.font.Font', 'Font', ([], {'family': '"""Helvetica"""', 'size': '(14)', 'weight': '"""bold"""'}), ...
from astropy.cosmology import Planck18_arXiv_v2 as cosmo import numpy as np import matplotlib.pyplot as plt import astropy.units as u zlist=np.arange(0.8,3.,.05) arcsec2kpc= cosmo.arcsec_per_kpc_proper(zlist) #plt.plot(zlist,10.*arcsec2kpc) #plt.show() z_L=0.493 z_s = 2.7434 z_c =1.62650 theta_obs=1./3600. Ds...
[ "matplotlib.pyplot.show", "astropy.cosmology.Planck18_arXiv_v2.comoving_distance", "numpy.deg2rad", "astropy.cosmology.Planck18_arXiv_v2.arcsec_per_kpc_proper", "numpy.where", "numpy.arange" ]
[((141, 166), 'numpy.arange', 'np.arange', (['(0.8)', '(3.0)', '(0.05)'], {}), '(0.8, 3.0, 0.05)\n', (150, 166), True, 'import numpy as np\n'), ((176, 210), 'astropy.cosmology.Planck18_arXiv_v2.arcsec_per_kpc_proper', 'cosmo.arcsec_per_kpc_proper', (['zlist'], {}), '(zlist)\n', (203, 210), True, 'from astropy.cosmology...
""" An implementation of a deep, recurrent Q-Network following https://gist.github.com/awjuliani/35d2ab3409fc818011b6519f0f1629df#file-deep-recurrent-q-network-ipynb. Adopted to play Pong, or at least to make an honest attempt at doing so, by taking cues from https://gist.github.com/karpathy/a4166c7fe253700972fcbc77e...
[ "tensorflow.contrib.layers.xavier_initializer", "random.sample", "tensorflow.constant_initializer", "tensorflow.reshape", "tensorflow.matmul", "tensorflow.multiply", "numpy.random.randint", "tensorflow.nn.conv2d", "tensorflow.split", "tensorflow.one_hot", "tensorflow.contrib.layers.xavier_initia...
[((722, 754), 'numpy.reshape', 'np.reshape', (['downsampled', '[1, -1]'], {}), '(downsampled, [1, -1])\n', (732, 754), True, 'import numpy as np\n'), ((1577, 1615), 'random.sample', 'random.sample', (['self.buffer', 'batch_size'], {}), '(self.buffer, batch_size)\n', (1590, 1615), False, 'import random\n'), ((1911, 1935...
""" For each space group fetches information about the Wyckoff positions that have free parameters, i.e. can be moved freely in some direction. Returns the free parametesr and the algebraic expressions for the locations of the atoms based on the free variables. """ import re import numpy as np import pickle from fracti...
[ "pickle.dump", "re.finditer", "numpy.array", "bs4.BeautifulSoup", "fractions.Fraction", "re.compile" ]
[((417, 443), 're.compile', 're.compile', (['"""(\\\\d)([xyz])"""'], {}), "('(\\\\d)([xyz])')\n", (427, 443), False, 'import re\n'), ((462, 563), 're.compile', 're.compile', (['"""\\\\(([xyz\\\\d\\\\/\\\\+\\\\- ]+).?,([xyz\\\\d\\\\/\\\\+\\\\- ]+).?,([xyz\\\\d\\\\/\\\\+\\\\- ]+).?\\\\)"""'], {}), "(\n '\\\\(([xyz\\\\...
import threading import numpy as np import matplotlib from thimblesgui import QtWidgets, QtCore, Qt class FloatSlider(QtWidgets.QWidget): valueChanged = Signal(float) def __init__( self, name, hard_min, hard_max, n_steps=127, or...
[ "numpy.around" ]
[((3644, 3675), 'numpy.around', 'np.around', (['(vfrac * self.n_steps)'], {}), '(vfrac * self.n_steps)\n', (3653, 3675), True, 'import numpy as np\n')]
import remodnav import inspect """ This is mostly copypasta """ __version__ = '1.0' import logging lgr = logging.getLogger('remodnav') import sys import numpy as np from remodnav import clf from remodnav.clf import EyegazeClassifier, events2bids_events_tsv def remodnav_api(x, y, px2deg=0.02, rate=20, **kwargs...
[ "remodnav.clf", "remodnav.clf.events2bids_events_tsv", "remodnav.clf.EyegazeClassifier", "numpy.recfromcsv", "inspect.getargspec", "logging.getLogger" ]
[((111, 140), 'logging.getLogger', 'logging.getLogger', (['"""remodnav"""'], {}), "('remodnav')\n", (128, 140), False, 'import logging\n'), ((687, 763), 'numpy.recfromcsv', 'np.recfromcsv', (['args.infile'], {'delimiter': '"""\t"""', 'names': "['x', 'y']", 'usecols': '[0, 1]'}), "(args.infile, delimiter='\\t', names=['...
import numpy as np from numpy.random import randn class RNN: # A many-to-one Vanilla Recurrent Neural Network. #初始化RNN的权重和偏置 def __init__(self, input_size, output_size, hidden_size=64): # Weights self.Whh = randn(hidden_size, hidden_size) / 1000 #标准正态分布初始化权重,除以1000以减少权重的初始方差 self.Wxh = randn(hidden_si...
[ "numpy.zeros", "numpy.tanh", "numpy.clip", "numpy.random.randn" ]
[((425, 451), 'numpy.zeros', 'np.zeros', (['(hidden_size, 1)'], {}), '((hidden_size, 1))\n', (433, 451), True, 'import numpy as np\n'), ((466, 492), 'numpy.zeros', 'np.zeros', (['(output_size, 1)'], {}), '((output_size, 1))\n', (474, 492), True, 'import numpy as np\n'), ((728, 760), 'numpy.zeros', 'np.zeros', (['(self....
import DaNN import numpy as np import torch import torch.nn as nn import torch.optim as optim from tqdm import tqdm import data_loader import mmd DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu') LEARNING_RATE = 0.02 MOMEMTUN = 0.05 L2_WEIGHT = 0.003 DROPOUT = 0.5 N_EPOCH = 900 BATCH_SIZE = [64, 6...
[ "tqdm.tqdm.write", "DaNN.DaNN", "torch.manual_seed", "numpy.asarray", "numpy.savetxt", "torch.nn.CrossEntropyLoss", "mmd.mix_rbf_mmd2", "data_loader.load_data", "torch.save", "torch.cuda.is_available", "torch.no_grad", "data_loader.load_test" ]
[((512, 551), 'mmd.mix_rbf_mmd2', 'mmd.mix_rbf_mmd2', (['x_src', 'x_tar', '[GAMMA]'], {}), '(x_src, x_tar, [GAMMA])\n', (528, 551), False, 'import mmd\n'), ((651, 672), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (670, 672), True, 'import torch.nn as nn\n'), ((1958, 1975), 'tqdm.tqdm.write', '...
""" S3LIO Class Labeled Array access, backed by multiple S3 objects. """ from __future__ import absolute_import, division import SharedArray as sa import hashlib import sys import zstd from itertools import repeat, product import numpy as np from pathos.multiprocessing import ProcessingPool from six import integer_...
[ "SharedArray.create", "numpy.ndarray", "zstd.ZstdCompressor", "numpy.ascontiguousarray", "numpy.zeros", "six.moves.zip", "numpy.around", "SharedArray.delete", "zstd.ZstdDecompressor", "SharedArray.attach", "itertools.product", "pathos.multiprocessing.ProcessingPool", "itertools.repeat" ]
[((1153, 1180), 'pathos.multiprocessing.ProcessingPool', 'ProcessingPool', (['num_workers'], {}), '(num_workers)\n', (1167, 1180), False, 'from pathos.multiprocessing import ProcessingPool\n'), ((3023, 3037), 'itertools.product', 'product', (['*var1'], {}), '(*var1)\n', (3030, 3037), False, 'from itertools import repea...
import os import sys import numpy as np from sklearn.utils.validation import check_is_fitted from sklearn.base import BaseEstimator, TransformerMixin class SklearnTransformerMixin(BaseEstimator, TransformerMixin): def fit(self, X, y=None): """ Will fit the language model such that it is ready for...
[ "numpy.array", "numpy.nan_to_num", "sys.stderr.close", "sklearn.utils.validation.check_is_fitted" ]
[((1167, 1199), 'sklearn.utils.validation.check_is_fitted', 'check_is_fitted', (['self', '"""fitted_"""'], {}), "(self, 'fitted_')\n", (1182, 1199), False, 'from sklearn.utils.validation import check_is_fitted\n'), ((1590, 1608), 'sys.stderr.close', 'sys.stderr.close', ([], {}), '()\n', (1606, 1608), False, 'import sys...
import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as mcolors from matplotlib.collections import PatchCollection from matplotlib.font_manager import FontProperties from pyproj import Proj, transform import pickle import geopandas as gpd from geopandas.plotting import _flatten_multi_geoms, _mapc...
[ "util.calBinsScale", "geopandas.GeoSeries", "matplotlib.font_manager.FontProperties", "matplotlib.pyplot.annotate", "matplotlib.colors.BoundaryNorm", "util.calBinsBoundary", "geopandas.plotting._flatten_multi_geoms", "pickle.load", "numpy.take", "pyproj.Proj", "matplotlib.collections.PatchCollec...
[((652, 678), 'util.calBinsBoundary', 'calBinsBoundary', (['binsScale'], {}), '(binsScale)\n', (667, 678), False, 'from util import getAbbrv, calBinsScale, calBinsBoundary\n'), ((761, 814), 'matplotlib.colors.BoundaryNorm', 'mcolors.BoundaryNorm', (['binsBoundary', 'ncolor'], {'clip': '(True)'}), '(binsBoundary, ncolor...
import torch import torchvision.transforms as transforms from torchvision import datasets import numpy as np from training.SelfMNIST import * def modify_target_ori(target,interest_num): for j in range(len(target)): for idx in range(len(interest_num)): if target[j] == interest_num[idx]: ...
[ "torch.utils.data.DataLoader", "torchvision.transforms.ToTensor", "numpy.linalg.svd", "numpy.where", "torch.cuda.is_available", "torch.zeros", "numpy.dot", "torchvision.datasets.MNIST", "numpy.concatenate", "torchvision.transforms.Resize" ]
[((4122, 4244), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['train_data'], {'batch_size': 'batch_size', 'num_workers': 'num_workers', 'shuffle': '(True)', 'drop_last': '(True)'}), '(train_data, batch_size=batch_size, num_workers=\n num_workers, shuffle=True, drop_last=True)\n', (4149, 4244), Fals...
# -*- coding: utf-8 -*- """ Created on Thu Nov 2 16:08:11 2017 @author: dykua """ import numpy as np from scipy.integrate import ode import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as p3 from math import sin, cos, pi #import matplotlib.animation as animation from mpl_toolkits.mplot3d.art3d import ...
[ "matplotlib.pyplot.show", "numpy.average", "matplotlib.pyplot.plot", "scipy.integrate.ode", "matplotlib.pyplot.axes", "matplotlib.widgets.Slider", "numpy.asarray", "numpy.identity", "math.sin", "mpl_toolkits.mplot3d.art3d.Poly3DCollection", "matplotlib.pyplot.figure", "numpy.arange", "numpy....
[((1717, 1738), 'numpy.arange', 'np.arange', (['(0)', '(100)', 'dt'], {}), '(0, 100, dt)\n', (1726, 1738), True, 'import numpy as np\n'), ((2081, 2093), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2091, 2093), True, 'import matplotlib.pyplot as plt\n'), ((2099, 2113), 'mpl_toolkits.mplot3d.axes3d.Axes3...
import os import sys import subprocess import datetime import numpy as np from astropy.io import ascii from astropy.table import Table, Column, vstack from astropy.wcs import WCS from astropy.wcs.utils import proj_plane_pixel_scales from astropy.coordinates import SkyCoord, ICRS from astropy.stats import gaussian_fwhm_...
[ "os.mkdir", "astropy.stats.sigma_clipped_stats", "matplotlib.pyplot.figure", "os.path.join", "numpy.unique", "sys.path.append", "numpy.zeros_like", "os.path.basename", "numpy.roll", "AstroImage.AstroImage", "matplotlib.pyplot.ylabel", "astropy.table.Table.read", "numpy.logical_and", "os.pa...
[((646, 713), 'sys.path.append', 'sys.path.append', (['"""C:\\\\Users\\\\Jordan\\\\Libraries\\\\python\\\\AstroImage"""'], {}), "('C:\\\\Users\\\\Jordan\\\\Libraries\\\\python\\\\AstroImage')\n", (661, 713), False, 'import sys\n'), ((1722, 1761), 'os.path.join', 'os.path.join', (['PPOL_dir', '"""S3_Astrometry"""'], {})...
import numpy as np import warnings def quadratic1(a,b,c): ''' Solve an quadratic equation ''' if b**2-4*a*c < 0: x = np.nan elif b**2-4*a*c == 0: x = -b/(2*a) else: x = np.array(((-b+np.sqrt(b**2-4*a*c))/(2*a), (-b-np.sqrt(b**2-4*a*c))/(2*a))) return x def demean(d): return d - d.mean(...
[ "numpy.sum", "warnings.simplefilter", "numpy.zeros", "numpy.triu_indices", "numpy.isnan", "numpy.max", "pickle.load", "warnings.catch_warnings", "numpy.sign", "numpy.sqrt", "numpy.nanmean" ]
[((1119, 1139), 'numpy.sign', 'np.sign', (['(data - mean)'], {}), '(data - mean)\n', (1126, 1139), True, 'import numpy as np\n'), ((2164, 2200), 'numpy.triu_indices', 'np.triu_indices', (['corrmat.shape[0]', '(1)'], {}), '(corrmat.shape[0], 1)\n', (2179, 2200), True, 'import numpy as np\n'), ((2530, 2551), 'numpy.triu_...
### Figure S5 - D and E - Obenhaus et al. # Shuffling of NN graphs import sys, os import os.path import datajoint as dj import cmasher as cmr from pathlib import Path # Make plots pretty import seaborn as sns sns.set(style='white') # Prevent bug in figure export as pdf: import matplotlib as mpl mpl.rcParams['pdf....
[ "Figure_4_E_and_Figure_S5_D._make_nn_graph", "pickle.dump", "Figure_4_E_and_Figure_S5_D.get_nn_weights", "Figure_4_E_and_Figure_S5_D._get_distance_metric", "os.path.dirname", "tqdm.auto.trange", "Figure_4_E_and_Figure_S5_D._spring_loaded_model", "numpy.random.permutation", "seaborn.set" ]
[((213, 235), 'seaborn.set', 'sns.set', ([], {'style': '"""white"""'}), "(style='white')\n", (220, 235), True, 'import seaborn as sns\n'), ((1369, 1412), 'Figure_4_E_and_Figure_S5_D._make_nn_graph', '_make_nn_graph', (['weights', 'params_A', 'params_B'], {}), '(weights, params_A, params_B)\n', (1383, 1412), False, 'fro...
from math import e from array import array import numpy as np def log_reg(x, theta): """ logistic regression hypothesis function """ return np.exp(np.dot(x,theta))/(1.+np.exp(np.dot(x,theta))) def log_reg_classify_acc(x, y, theta): return np.mean(np.asarray(np.asarray(log_reg(x, theta) >= 1/2, np...
[ "numpy.sum", "numpy.ones", "numpy.random.random", "numpy.arange", "array.array", "numpy.random.permutation", "numpy.dot" ]
[((661, 680), 'numpy.random.random', 'np.random.random', (['n'], {}), '(n)\n', (677, 680), True, 'import numpy as np\n'), ((2014, 2033), 'numpy.random.random', 'np.random.random', (['n'], {}), '(n)\n', (2030, 2033), True, 'import numpy as np\n'), ((2042, 2054), 'numpy.arange', 'np.arange', (['m'], {}), '(m)\n', (2051, ...
import numpy as np from PIL import Image def process_image(image_path): ''' Scales, crops, and normalizes a PIL image for a PyTorch model, returns an Numpy array ''' with Image.open(image_path) as img: #resize the shorestes size re_size = 256 new_width = 224 new_hei...
[ "numpy.array", "PIL.Image.open" ]
[((193, 215), 'PIL.Image.open', 'Image.open', (['image_path'], {}), '(image_path)\n', (203, 215), False, 'from PIL import Image\n'), ((1388, 1401), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (1396, 1401), True, 'import numpy as np\n')]
import logging from typing import Any, Optional, Union import numpy as np from snorkel.labeling.model import LabelModel from ..basemodel import BaseLabelModel from ..dataset import BaseDataset from ..dataset.utils import check_weak_labels logger = logging.getLogger(__name__) ABSTAIN = -1 class Snor...
[ "snorkel.labeling.model.LabelModel", "numpy.random.randint", "logging.getLogger" ]
[((261, 288), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (278, 288), False, 'import logging\n'), ((1791, 1839), 'snorkel.labeling.model.LabelModel', 'LabelModel', ([], {'cardinality': 'n_class', 'verbose': 'verbose'}), '(cardinality=n_class, verbose=verbose)\n', (1801, 1839), False, '...
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "numpy.sum", "qiskit.circuit.library.RealAmplitudes", "numpy.zeros", "qiskit.algorithms.optimizers.COBYLA", "itertools.product", "qiskit.circuit.library.ZZFeatureMap" ]
[((2370, 2400), 'itertools.product', 'product', (['*VqcBenchmarks.params'], {}), '(*VqcBenchmarks.params)\n', (2377, 2400), False, 'from itertools import product\n'), ((1419, 1445), 'numpy.zeros', 'np.zeros', (['(num_samples, 2)'], {}), '((num_samples, 2))\n', (1427, 1445), True, 'import numpy as np\n'), ((1603, 1627),...
# Import Libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd #import dataset from working directory dataset= pd.read_csv('50_Startups.csv') x= dataset.iloc[:,:-1].values y= dataset.iloc[:,4].values #Encode categorical data from sklearn.preprocessing import LabelEncoder, OneHotEncoder labe...
[ "matplotlib.pyplot.title", "sklearn.cross_validation.train_test_split", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "statsmodels.formula.api.OLS", "pandas.read_csv", "matplotlib.pyplot.scatter", "sklearn.preprocessing.OneHotEncoder", "numpy.ones", "sklearn.preprocessing.LabelEncoder", "s...
[((139, 169), 'pandas.read_csv', 'pd.read_csv', (['"""50_Startups.csv"""'], {}), "('50_Startups.csv')\n", (150, 169), True, 'import pandas as pd\n'), ((331, 345), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (343, 345), False, 'from sklearn.preprocessing import LabelEncoder, OneHotEncoder\n')...
import numpy as np import matplotlib.pyplot as pl flux, sigma, time = np.loadtxt("dat/2m1324_visit6_lc.dat", unpack=True) pl.plot(time, flux) pl.show()
[ "matplotlib.pyplot.show", "numpy.loadtxt", "matplotlib.pyplot.plot" ]
[((71, 122), 'numpy.loadtxt', 'np.loadtxt', (['"""dat/2m1324_visit6_lc.dat"""'], {'unpack': '(True)'}), "('dat/2m1324_visit6_lc.dat', unpack=True)\n", (81, 122), True, 'import numpy as np\n'), ((123, 142), 'matplotlib.pyplot.plot', 'pl.plot', (['time', 'flux'], {}), '(time, flux)\n', (130, 142), True, 'import matplotli...
import random import numpy as np class StochasticFocalPatchSampler: """ Stochasting Focal Patching technique achieves spatial correspondance of patches extracted from a pair of volumes by: (1) Randomly selecting a patch from volume_A (patch_A) (2) Calculating the relative start position of the...
[ "numpy.any", "numpy.array", "random.randint" ]
[((1045, 1065), 'numpy.array', 'np.array', (['patch_size'], {}), '(patch_size)\n', (1053, 1065), True, 'import numpy as np\n'), ((4739, 4758), 'numpy.array', 'np.array', (['[z, x, y]'], {}), '([z, x, y])\n', (4747, 4758), True, 'import numpy as np\n'), ((5132, 5162), 'numpy.any', 'np.any', (['(valid_start_region < 0)']...
from typing import Any, Dict, List, Optional import numpy as np from deployment_toolkit.core import BaseMetricsCalculator class MetricsCalculator(BaseMetricsCalculator): def __init__(self, output_used_for_metrics: str = "classes"): self._output_used_for_metrics = output_used_for_metrics def calc(se...
[ "numpy.squeeze" ]
[((552, 570), 'numpy.squeeze', 'np.squeeze', (['y_true'], {}), '(y_true)\n', (562, 570), True, 'import numpy as np\n'), ((588, 606), 'numpy.squeeze', 'np.squeeze', (['y_pred'], {}), '(y_pred)\n', (598, 606), True, 'import numpy as np\n')]
import cv2 import json import numpy as np import torch from PIL import Image from torchvision.transforms import transforms as transforms from model_utils.model_celebmask import BiSeNet class mask_generator: """ Class to generate masks using models""" def __init__(self, threshold=0.5, auto_init=True): ...
[ "torch.device", "cv2.imshow", "torch.no_grad", "numpy.unique", "model_utils.model_celebmask.BiSeNet", "cv2.cvtColor", "cv2.imwrite", "torch.load", "cv2.destroyAllWindows", "cv2.waitKey", "torchvision.transforms.transforms.ToTensor", "cv2.bitwise_or", "torch.cuda.is_available", "cv2.thresho...
[((11000, 11029), 'cv2.imread', 'cv2.imread', (['"""images/city.jpg"""'], {}), "('images/city.jpg')\n", (11010, 11029), False, 'import cv2\n'), ((11155, 11177), 'cv2.imshow', 'cv2.imshow', (['"""img"""', 'img'], {}), "('img', img)\n", (11165, 11177), False, 'import cv2\n'), ((11182, 11206), 'cv2.imshow', 'cv2.imshow', ...
# coding: utf-8 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License...
[ "scripts.parsing.common.k_means.KMeans", "numpy.std", "numpy.random.randn", "numpy.zeros", "numpy.array", "collections.Counter", "gluonnlp.embedding.create", "numpy.random.shuffle" ]
[((4063, 4072), 'collections.Counter', 'Counter', ([], {}), '()\n', (4070, 4072), False, 'from collections import Counter\n'), ((6308, 6380), 'gluonnlp.embedding.create', 'gluonnlp.embedding.create', (['pret_embeddings[0]'], {'source': 'pret_embeddings[1]'}), '(pret_embeddings[0], source=pret_embeddings[1])\n', (6333, ...
from picamera.array import PiRGBArray from picamera import PiCamera import time import cv2 import numpy as np font = cv2.FONT_HERSHEY_SIMPLEX x_cent = 320 y_cent = 240 def find_dir(x): if x > x_cent: direction = 'right' else: direction = 'left' return directi...
[ "cv2.line", "cv2.GaussianBlur", "cv2.contourArea", "cv2.circle", "cv2.waitKey", "cv2.imwrite", "cv2.moments", "cv2.imshow", "time.sleep", "numpy.array", "picamera.array.PiRGBArray", "cv2.destroyAllWindows", "cv2.inRange", "cv2.findContours", "picamera.PiCamera" ]
[((333, 343), 'picamera.PiCamera', 'PiCamera', ([], {}), '()\n', (341, 343), False, 'from picamera import PiCamera\n'), ((450, 485), 'picamera.array.PiRGBArray', 'PiRGBArray', (['camera'], {'size': '(640, 480)'}), '(camera, size=(640, 480))\n', (460, 485), False, 'from picamera.array import PiRGBArray\n'), ((487, 502),...
import numpy as np # fast vectors and matrices import matplotlib.pyplot as plt # plotting from scipy import fft # fast fourier transform import librosa from intervaltree import Interval,IntervalTree X, fs = ...
[ "numpy.stack", "numpy.max", "scipy.fft", "librosa.load" ]
[((320, 489), 'librosa.load', 'librosa.load', (['"""C:/Users/JiangQin/Documents/python/Music Composition Project/Music data/violin/cut data/S3 Alg 1 of 4/A1-0001_allegro assai 1 of 4_00086400.wav"""'], {}), "(\n 'C:/Users/JiangQin/Documents/python/Music Composition Project/Music data/violin/cut data/S3 Alg 1 of 4/A1...
import os import numpy as np import cv2 from PIL import Image from paddleseg import utils import xml.dom.minidom def mkdir(path): sub_dir = os.path.dirname(path) if not os.path.exists(sub_dir): os.makedirs(sub_dir) def get_image_list(image_path): """Get image list""" valid_suffix = [ ...
[ "numpy.zeros_like", "os.makedirs", "paddleseg.utils.visualize.get_pseudo_color_map", "os.path.isdir", "os.path.dirname", "os.walk", "os.path.exists", "PIL.Image.open", "cv2.imread", "os.path.isfile", "os.path.splitext" ]
[((146, 167), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (161, 167), False, 'import os\n'), ((440, 466), 'os.path.isfile', 'os.path.isfile', (['image_path'], {}), '(image_path)\n', (454, 466), False, 'import os\n'), ((179, 202), 'os.path.exists', 'os.path.exists', (['sub_dir'], {}), '(sub_dir)\n'...
import matplotlib.pyplot as plt import numpy as np import math Fs = 16000 #샘플링 주파수 T = 1/Fs # 초당 측정 시간 te = 0.5 # 시간 끝 t = np.arange(0, te, T) #시간 백터 noise = np.random.normal(0, 0.05, len(t)) x = 0.6 * np.cos(2*np.pi*60*np.pi/2) + np.cos(2*np.pi*120*t) y = x + noise plt.figure(num = 1, dpi=100, facecolor='white') pl...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "numpy.arange", "numpy.cos", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((124, 143), 'numpy.arange', 'np.arange', (['(0)', 'te', 'T'], {}), '(0, te, T)\n', (133, 143), True, 'import numpy as np\n'), ((270, 315), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'num': '(1)', 'dpi': '(100)', 'facecolor': '"""white"""'}), "(num=1, dpi=100, facecolor='white')\n", (280, 315), True, 'import matp...
# Copyright (C) 2019-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import operator from functools import reduce from typing import Tuple, Dict import numpy as np # pylint: disable=no-name-in-module,import-error from openvino.runtime import Node from model_analyzer.layer_provider import LayerTypesManag...
[ "numpy.finfo", "functools.reduce", "numpy.broadcast_to", "model_analyzer.layer_provider.LayerTypesManager.provider", "numpy.round" ]
[((4317, 4355), 'numpy.broadcast_to', 'np.broadcast_to', (['self.input_low', 'shape'], {}), '(self.input_low, shape)\n', (4332, 4355), True, 'import numpy as np\n'), ((4377, 4416), 'numpy.broadcast_to', 'np.broadcast_to', (['self.input_high', 'shape'], {}), '(self.input_high, shape)\n', (4392, 4416), True, 'import nump...
"""Test the Dataset class""" import tensorflow as tf import numpy as np from pprint import pprint import os class DatasetTests(tf.test.TestCase): def testSlice(self): a = tf.constant(np.arange((10*4*8)), shape=[10, 4, 8]) b = tf.slice(a, [0,0,0], [-1, 1, 8]) with tf.Session() as...
[ "tensorflow.test.main", "tensorflow.slice", "tensorflow.Session", "numpy.arange" ]
[((456, 470), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (468, 470), True, 'import tensorflow as tf\n'), ((259, 293), 'tensorflow.slice', 'tf.slice', (['a', '[0, 0, 0]', '[-1, 1, 8]'], {}), '(a, [0, 0, 0], [-1, 1, 8])\n', (267, 293), True, 'import tensorflow as tf\n'), ((208, 229), 'numpy.arange', 'np.ar...
import os import sys import numpy as np import cv2 import numpy.matlib import dlib from scipy.io import loadmat from scipy.ndimage import imread, affine_transform import nudged def get_facial_points(image, num_points): predictor = dlib.shape_predictor('shape_predictor_68_face_landmarks.dat') detector = dlib.g...
[ "numpy.pad", "scipy.io.loadmat", "nudged.estimate", "numpy.zeros", "numpy.iinfo", "cv2.warpAffine", "numpy.array", "dlib.get_frontal_face_detector", "numpy.linspace", "dlib.shape_predictor", "scipy.ndimage.imread" ]
[((1568, 1605), 'numpy.pad', 'np.pad', (['maskc', '[600, 600]', '"""constant"""'], {}), "(maskc, [600, 600], 'constant')\n", (1574, 1605), True, 'import numpy as np\n'), ((237, 298), 'dlib.shape_predictor', 'dlib.shape_predictor', (['"""shape_predictor_68_face_landmarks.dat"""'], {}), "('shape_predictor_68_face_landmar...
# coding=utf-8 # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
[ "optax.adam", "jax.random.PRNGKey", "numpy.mean", "learned_optimization.population.examples.simple_cnn.common.get_data_iterators", "numpy.exp", "os.path.join", "learned_optimization.population.examples.simple_cnn.common.loss", "learned_optimization.population.examples.simple_cnn.common.update", "lea...
[((1162, 1197), 'learned_optimization.filesystem.make_dirs', 'filesystem.make_dirs', (['train_log_dir'], {}), '(train_log_dir)\n', (1182, 1197), False, 'from learned_optimization import filesystem\n'), ((1217, 1257), 'flax.metrics.tensorboard.SummaryWriter', 'tensorboard.SummaryWriter', (['train_log_dir'], {}), '(train...
# <NAME> (<EMAIL>) # Harvard-MIT Department of Health Sciences & Technology # Athinoula A. Martinos Center for Biomedical Imaging import numpy as np import pandas as pd from medpy.metric.binary import hd, dc def get_geometric_metrics(M_gt, M_pred, voxelspacing, tissue_labels=[1, 2, 3], ti...
[ "pandas.DataFrame", "numpy.abs", "numpy.sum", "numpy.copy", "medpy.metric.binary.hd", "numpy.argmax", "numpy.clip", "pandas.Index", "medpy.metric.binary.dc", "numpy.mean", "numpy.prod" ]
[((1166, 1186), 'pandas.DataFrame', 'pd.DataFrame', (['output'], {}), '(output)\n', (1178, 1186), True, 'import pandas as pd\n'), ((5203, 5214), 'numpy.mean', 'np.mean', (['dk'], {}), '(dk)\n', (5210, 5214), True, 'import numpy as np\n'), ((5661, 5791), 'pandas.DataFrame', 'pd.DataFrame', (["{'RV_EDV_ml': [], 'RV_ESV_m...
import os import scipy.io as scio import math from scipy import stats import numpy as np import pandas as pd import matplotlib.pyplot as plt import math import csv ''' 1. Central Trend Statistics: --- mean --- median --- low quartile --- upper quartile 2. Dispersion Degree Statistics: --- minimum -...
[ "pandas.DataFrame", "os.path.abspath", "numpy.abs", "pandas.read_csv", "numpy.std", "numpy.min", "numpy.mean", "numpy.max", "os.path.join", "os.listdir" ]
[((606, 622), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (616, 622), False, 'import os\n'), ((727, 748), 'os.path.abspath', 'os.path.abspath', (['path'], {}), '(path)\n', (742, 748), False, 'import os\n'), ((759, 785), 'os.path.join', 'os.path.join', (['domain', 'info'], {}), '(domain, info)\n', (771, 785)...
#!/usr/bin/env python import numpy import kernel_tuner from scipy import misc #from matplotlib import pyplot #image = misc.imread("../test_small.jpg", "r") image = misc.imread("../test_small.jpg", mode='RGB') misc.imshow(image) print (image.shape) exit() kernel_names = [] """ pipeline overview -- fastnois...
[ "scipy.misc.imshow", "numpy.random.randn", "kernel_tuner.tune_kernel", "numpy.int32", "scipy.misc.imread" ]
[((166, 210), 'scipy.misc.imread', 'misc.imread', (['"""../test_small.jpg"""'], {'mode': '"""RGB"""'}), "('../test_small.jpg', mode='RGB')\n", (177, 210), False, 'from scipy import misc\n'), ((212, 230), 'scipy.misc.imshow', 'misc.imshow', (['image'], {}), '(image)\n', (223, 230), False, 'from scipy import misc\n'), ((...
# -*- coding: utf-8 -*- """this is for the part 5 of CourseWork 1.""" __author__ = '<NAME>' import sys import os import open3d as o3d import numpy as np import trimesh import matplotlib import matplotlib.pyplot as plt import tools.baseICP import tools.tools # check whether the data folder exis...
[ "os.path.abspath", "trimesh.load", "matplotlib.pyplot.show", "trimesh.Trimesh", "os.path.exists", "matplotlib.pyplot.figure", "numpy.array", "os.path.join", "os.listdir", "numpy.vstack" ]
[((391, 434), 'os.path.join', 'os.path.join', (['FILE_PATH', '"""../data/bunny_v2"""'], {}), "(FILE_PATH, '../data/bunny_v2')\n", (403, 434), False, 'import os\n'), ((352, 377), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (367, 377), False, 'import os\n'), ((443, 467), 'os.path.exists', 'o...
import torch import argparse import hashlib import pandas as pd import numpy as np import itertools as its from tabulate import tabulate from torch.utils.data import DataLoader from functools import partial from tqdm import tqdm from pathlib import Path, PurePath from warnings import warn from rdkit import Chem, DataSt...
[ "numpy.random.seed", "argparse.ArgumentParser", "pandas.read_csv", "sklearn.metrics.r2_score", "sklearn.metrics.mean_absolute_error", "pathlib.Path", "numpy.mean", "numpy.arange", "torch.utils.data.DataLoader", "numpy.std", "torch.load", "hashlib.sha256", "sklearn.metrics.mean_squared_error"...
[((929, 941), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (938, 941), True, 'import numpy as np\n'), ((946, 968), 'numpy.random.shuffle', 'np.random.shuffle', (['idx'], {}), '(idx)\n', (963, 968), True, 'import numpy as np\n'), ((1011, 1027), 'hashlib.sha256', 'hashlib.sha256', ([], {}), '()\n', (1025, 1027), Fa...
if __name__ == "__main__": import os import numpy as np import pandas as pd import sys import copy if len(sys.argv) != 5: raise Exception('Number of params incorrect') dataFile = sys.argv[1] weights = sys.argv[2] impacts = sys.argv[3] resultFile = sys.argv[4] #note...
[ "copy.deepcopy", "numpy.sum", "pandas.read_csv", "os.path.exists", "numpy.max", "numpy.min", "numpy.array" ]
[((828, 849), 'pandas.read_csv', 'pd.read_csv', (['dataFile'], {}), '(dataFile)\n', (839, 849), True, 'import pandas as pd\n'), ((1356, 1376), 'numpy.array', 'np.array', (['columns_np'], {}), '(columns_np)\n', (1364, 1376), True, 'import numpy as np\n'), ((3064, 3090), 'copy.deepcopy', 'copy.deepcopy', (['topsisScore']...
# %% # Ensemble Forecasting of RNN Models Trained for Lookbacks Ranging from 1 to 6 # <NAME>, Ph.D. Candidate # %% # Import required libraries import pandas as pd import numpy as np import csv from scipy.stats.mstats import trimmed_mean, winsorize from sklearn.ensemble import ( GradientBoostingRegressor, AdaBo...
[ "pandas.DataFrame", "sklearn.svm.SVR", "sklearn.utils.check_random_state", "sklearn.ensemble.AdaBoostRegressor", "csv.writer", "sklearn.tree.DecisionTreeRegressor", "sklearn.model_selection.train_test_split", "sklearn.ensemble.GradientBoostingRegressor", "sklearn.neural_network.MLPRegressor", "skl...
[((4799, 4820), 'sklearn.utils.check_random_state', 'check_random_state', (['(0)'], {}), '(0)\n', (4817, 4820), False, 'from sklearn.utils import check_random_state\n'), ((1024, 1080), 'pandas.read_excel', 'pd.read_excel', (['input_path'], {'sheet_name': '"""Sheet1"""', 'header': '(0)'}), "(input_path, sheet_name='Shee...
import numpy as np import torch def get_sinusoid_encoding_table(n_position, d_hid, padding_idx=None): ''' Sinusoid position encoding table ''' def cal_angle(position, hid_idx): return position / np.power(10000, 2 * (hid_idx // 2) / d_hid) def get_posi_angle_vec(position): return [cal_ang...
[ "numpy.power", "numpy.sin", "torch.FloatTensor", "numpy.cos" ]
[((489, 520), 'numpy.sin', 'np.sin', (['sinusoid_table[:, 0::2]'], {}), '(sinusoid_table[:, 0::2])\n', (495, 520), True, 'import numpy as np\n'), ((561, 592), 'numpy.cos', 'np.cos', (['sinusoid_table[:, 1::2]'], {}), '(sinusoid_table[:, 1::2])\n', (567, 592), True, 'import numpy as np\n'), ((735, 768), 'torch.FloatTens...
import numpy as np import os import tensorflow as tf from styx_msgs.msg import TrafficLight FROZEN_SIM_INFERENCE_GRAPH = os.getcwd() + "/sim_traffic_light_graph.pb" FROZEN_SITE_INFERENCE_GRAPH = os.getcwd() + "/site_traffic_light_graph.pb" SCORE_THRESHOLD = 0.5 MAX_BOXES = 3 class TLClassifier(object): def __ini...
[ "os.getcwd", "tensorflow.Session", "numpy.expand_dims", "tensorflow.gfile.GFile", "tensorflow.Graph", "numpy.squeeze", "tensorflow.import_graph_def", "tensorflow.GraphDef" ]
[((123, 134), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (132, 134), False, 'import os\n'), ((197, 208), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (206, 208), False, 'import os\n'), ((536, 546), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (544, 546), True, 'import tensorflow as tf\n'), ((622, 635), 'tensorflow...
"""This module provides a way to grab and store raw data for fission product yeilds from the NDS library at the IAEA. For more information, please visit their website: https://www-nds.iaea.org/sgnucdat/index.htm or https://www-nds.iaea.org/sgnucdat/c2.htm. Please contact the NDS at <EMAIL> with questions about the data...
[ "pyne.utils.QA_warn", "os.path.dirname", "numpy.dtype", "os.path.exists", "pyne.nucname.id", "tables.open_file", "os.path.join", "urllib2.urlopen", "shutil.copy" ]
[((1213, 1230), 'pyne.utils.QA_warn', 'QA_warn', (['__name__'], {}), '(__name__)\n', (1220, 1230), False, 'from pyne.utils import QA_warn\n'), ((1518, 1733), 'numpy.dtype', 'np.dtype', (["[('from_nuc', 'i4'), ('to_nuc', 'i4'), ('yield_thermal', float), (\n 'yield_thermal_err', float), ('yield_fast', float), ('yield_...
#!/usr/bin/env python3 import numpy as np import os.path import copy from Distributions import Porosity_Distribution,TA_POR_Distribution #### Load values of transport resistant from data file DEF_DATA = dict( res0 = 2, pstd_r0=0.15, por_con_min = 0.07, nmin = 20, dp = 0.02, # scale_std...
[ "numpy.sum", "numpy.diagflat", "numpy.floor", "numpy.isnan", "numpy.random.randint", "numpy.mean", "numpy.exp", "numpy.arange", "numpy.diag", "Distributions.TA_POR_Distribution", "numpy.linalg.solve", "Distributions.Porosity_Distribution", "numpy.power", "numpy.logical_not", "numpy.resha...
[((1644, 1663), 'copy.copy', 'copy.copy', (['DEF_DATA'], {}), '(DEF_DATA)\n', (1653, 1663), False, 'import copy\n'), ((2920, 2985), 'Distributions.Porosity_Distribution', 'Porosity_Distribution', ([], {'pmean': 'self.pmean', 'pstd': 'self.pstd'}), '(pmean=self.pmean, pstd=self.pstd, **kwargs)\n', (2941, 2985), False, '...
# import PIL import matplotlib.pyplot as plt import numpy as np import math import cv2 import torch from torch_geometric.data import Data def load_ply(path): """ Loads a 3D mesh model from a PLY file. :param path: Path to a PLY file. :return: The loaded model given by a dictionary with items: 'pt...
[ "numpy.abs", "numpy.concatenate", "numpy.argmax", "numpy.std", "torch.argmax", "numpy.zeros", "math.floor", "numpy.nonzero", "numpy.mean", "torch_geometric.data.Data", "numpy.array", "numpy.exp", "numpy.where", "numpy.dot", "matplotlib.pyplot.imread", "torch.tensor", "numpy.sqrt" ]
[((2187, 2217), 'numpy.zeros', 'np.zeros', (['(n_pts, 3)', 'np.float'], {}), '((n_pts, 3), np.float)\n', (2195, 2217), True, 'import numpy as np\n'), ((5977, 6037), 'numpy.concatenate', 'np.concatenate', (["[x, model['pts'], model['normals']]"], {'axis': '(-1)'}), "([x, model['pts'], model['normals']], axis=-1)\n", (59...
import cv2 import numpy as np from random import randint, uniform import string, random def addNoise(image): row,col = image.shape s_vs_p = 0.4 amount = 0.01 out = np.copy(image) # Salt mode num_salt = np.ceil(amount * image.size * s_vs_p) coords = [np.random.randint(0, i - 1, int(num_...
[ "numpy.full", "cv2.putText", "numpy.ceil", "numpy.copy", "random.randint", "cv2.waitKey", "random.choice", "cv2.blur", "cv2.imshow" ]
[((186, 200), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n', (193, 200), True, 'import numpy as np\n'), ((232, 269), 'numpy.ceil', 'np.ceil', (['(amount * image.size * s_vs_p)'], {}), '(amount * image.size * s_vs_p)\n', (239, 269), True, 'import numpy as np\n'), ((422, 467), 'numpy.ceil', 'np.ceil', (['(amount ...
import os import torch import torch.nn.functional as F import glob import numpy as np from torch.optim import Adam from utils.utils import soft_update, hard_update from utils.model import GaussianPolicy, QNetwork, DeterministicPolicy from keras.models import Sequential, Model from keras.layers import Dense, Dropout, In...
[ "numpy.absolute", "numpy.sum", "numpy.argmax", "numpy.mean", "numpy.arange", "utils.model.GaussianPolicy", "numpy.multiply", "torch.FloatTensor", "numpy.cumsum", "numpy.max", "torch.Tensor", "numpy.reshape", "torch.zeros", "numpy.stop_gradient", "numpy.matlib.repmat", "utils.model.Dete...
[((820, 842), 'numpy.multiply', 'np.multiply', (['w_norm', 'p'], {}), '(w_norm, p)\n', (831, 842), True, 'import numpy as np\n'), ((854, 880), 'keras.backend.mean', 'K.mean', (['p_weighted'], {'axis': '(0)'}), '(p_weighted, axis=0)\n', (860, 880), True, 'import keras.backend as K\n'), ((998, 1025), 'keras.backend.squar...
import numpy as np def compute_anomaly_corrs(out_true, out_pred): anomaly_corrs = np.zeros(out_pred.shape[1]) for i in range(anomaly_corrs.size): anomaly_corrs[i] = np.corrcoef(out_pred[:,i], out_true[:,i])[0,1] return anomaly_corrs def split_train_data(train_months, test_months, tra...
[ "numpy.corrcoef", "numpy.asarray", "numpy.zeros" ]
[((92, 119), 'numpy.zeros', 'np.zeros', (['out_pred.shape[1]'], {}), '(out_pred.shape[1])\n', (100, 119), True, 'import numpy as np\n'), ((187, 230), 'numpy.corrcoef', 'np.corrcoef', (['out_pred[:, i]', 'out_true[:, i]'], {}), '(out_pred[:, i], out_true[:, i])\n', (198, 230), True, 'import numpy as np\n'), ((423, 441),...
''' * This Software is under the MIT License * Refer to LICENSE or https://opensource.org/licenses/MIT for more information * Written by <NAME> * © 2019 ''' #Parallelized datareading network import tensorflow as tf import os import sys import numpy as np import matplotlib as mpl import csv mpl.use('A...
[ "matplotlib.pyplot.title", "numpy.absolute", "tensorflow.ConfigProto", "tensorflow.matmul", "numpy.mean", "matplotlib.pyplot.gca", "matplotlib.pyplot.xlabel", "multiprocessing.cpu_count", "numpy.set_printoptions", "tensorflow.nn.relu", "matplotlib.pyplot.close", "tensorflow.nn.softmax_cross_en...
[((310, 324), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (317, 324), True, 'import matplotlib as mpl\n'), ((478, 515), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.nan'}), '(threshold=np.nan)\n', (497, 515), True, 'import numpy as np\n'), ((3337, 3377), 'tensorflow.placeho...
import sys from limix.core.old.cobj import * from limix.utils.preprocess import regressOut import numpy as np import scipy.linalg as LA import copy def compute_X1KX2(Y, D, X1, X2, A1=None, A2=None): R,C = Y.shape if A1 is None: nW_A1 = Y.shape[1] #A1 = np.eye(Y.shape[1]) #for now this creates...
[ "numpy.outer", "numpy.eye", "numpy.zeros", "numpy.ones", "limix.utils.preprocess.regressOut", "numpy.array", "numpy.reshape", "numpy.kron", "numpy.arange", "numpy.dot", "numpy.concatenate" ]
[((702, 736), 'numpy.zeros', 'np.zeros', (['(rows_block, cols_block)'], {}), '((rows_block, cols_block))\n', (710, 736), True, 'import numpy as np\n'), ((2737, 2784), 'numpy.reshape', 'np.reshape', (['self.d', '(self.N, self.P)'], {'order': '"""F"""'}), "(self.d, (self.N, self.P), order='F')\n", (2747, 2784), True, 'im...
# Import dependencies import numpy as np from apogee.spec import continuum from apogee.tools import bitmask as bm from .util import get_DR_slice, bitsNotSet # Future: Define a class for spectra - spectra, error and weight def process_spectra(spectra_info=None, badcombpixmask=4351, minSNR=50.): cont_cannon = cont...
[ "numpy.median", "numpy.place", "numpy.where", "numpy.squeeze", "apogee.tools.bitmask.bits_set", "apogee.spec.continuum.fit" ]
[((316, 384), 'apogee.spec.continuum.fit', 'continuum.fit', (['spectra_info[:, 0]', 'spectra_info[:, 1]'], {'type': '"""cannon"""'}), "(spectra_info[:, 0], spectra_info[:, 1], type='cannon')\n", (329, 384), False, 'from apogee.spec import continuum\n'), ((691, 718), 'apogee.tools.bitmask.bits_set', 'bm.bits_set', (['ba...
from GenerativeModelling.Autoencoder import Autoencoder from GenerativeModelling.Encoder import Encoder from GenerativeModelling.Decoder import Decoder from GenerativeModelling.verification_net import VerificationNet from SemiSupervisedLearning import visualisations from GenerativeModelling.Trainer import Trainer from ...
[ "matplotlib.pyplot.title", "GenerativeModelling.utils.generate_images_from_Z", "numpy.argsort", "matplotlib.pyplot.figure", "pathlib.Path", "GenerativeModelling.verification_net.VerificationNet", "torch.ones", "GenerativeModelling.Encoder.Encoder", "torch.zeros", "torch.manual_seed", "SemiSuperv...
[((7824, 7844), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (7841, 7844), False, 'import torch\n'), ((7925, 8012), 'GenerativeModelling.stacked_mnist.StackedMNISTData', 'StackedMNISTData', ([], {'mode': 'DataMode.MONO_FLOAT_COMPLETE', 'default_batch_size': 'batch_size'}), '(mode=DataMode.MONO_FLOA...
import numpy as np import os import tensorflow as tf import time import json from PIL import Image from object_detection.utils import ops as utils_ops from object_detection.utils import label_map_util THRESHOLD = 0.6 LABEL_PATH = 'object_detection/test1/pascal_label_map.pbtxt' MODEL_PATH = 'object_detection/test1/out...
[ "tensorflow.GraphDef", "numpy.expand_dims", "json.dumps", "time.time", "object_detection.utils.label_map_util.create_category_index_from_labelmap", "PIL.Image.open", "tensorflow.Session", "tensorflow.get_default_graph", "tensorflow.gfile.GFile", "tensorflow.import_graph_def" ]
[((423, 445), 'PIL.Image.open', 'Image.open', (['IMAGE_PATH'], {}), '(IMAGE_PATH)\n', (433, 445), False, 'from PIL import Image\n'), ((589, 621), 'numpy.expand_dims', 'np.expand_dims', (['image_np'], {'axis': '(0)'}), '(image_np, axis=0)\n', (603, 621), True, 'import numpy as np\n'), ((738, 777), 'tensorflow.import_gra...
# -*- coding: utf-8 -*- import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data import numpy as np ### hyper parameters ### IMG_X = 28 IMG_Y = 28 INPUT_DIM = IMG_X * IMG_Y OUTPUT_DIM = 10 LR = 1e-4 MAX_LOOP = 10000 BATCH_SIZE = 50 KEEP_PROB = 0.5 ### hyper parameters ### ...
[ "img_proc.getImgAsMatFromFile", "numpy.argmax", "tensorflow.reshape", "tensorflow.ConfigProto", "tensorflow.matmul", "tensorflow.Variable", "tensorflow.nn.conv2d", "tensorflow.truncated_normal", "tensorflow.nn.softmax_cross_entropy_with_logits", "tensorflow.placeholder", "tensorflow.cast", "te...
[((342, 400), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""data/MNIST_data"""'], {'one_hot': '(True)'}), "('data/MNIST_data', one_hot=True)\n", (367, 400), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((1898, 1955), 'tensorflow.placeholde...
import numpy as np import xarray as xr airds = xr.tutorial.open_dataset("air_temperature").isel(time=slice(4), lon=slice(50)) airds.air.attrs["cell_measures"] = "area: cell_area" airds.air.attrs["standard_name"] = "air_temperature" airds.coords["cell_area"] = ( xr.DataArray(np.cos(airds.lat * np.pi / 180)) * x...
[ "numpy.stack", "xarray.tutorial.open_dataset", "numpy.random.randn", "numpy.zeros", "numpy.ones", "xarray.Dataset", "numpy.sin", "numpy.arange", "xarray.DataArray", "numpy.linspace", "numpy.cos", "xarray.ones_like", "numpy.prod", "numpy.sqrt" ]
[((492, 504), 'xarray.Dataset', 'xr.Dataset', ([], {}), '()\n', (502, 504), True, 'import xarray as xr\n'), ((1431, 1443), 'xarray.Dataset', 'xr.Dataset', ([], {}), '()\n', (1441, 1443), True, 'import xarray as xr\n'), ((1936, 1948), 'xarray.Dataset', 'xr.Dataset', ([], {}), '()\n', (1946, 1948), True, 'import xarray a...
import numpy as np from scipy import linalg import compound_poisson import dataset def main(): downscale = compound_poisson.Downscale(dataset.AnaDual10Training()) precision_array = np.linspace(250, 300, 50) for precision in precision_array: cov_chol = downscale.square_error.copy() cov_cho...
[ "scipy.linalg.cholesky", "dataset.AnaDual10Training", "numpy.exp", "numpy.linspace" ]
[((192, 217), 'numpy.linspace', 'np.linspace', (['(250)', '(300)', '(50)'], {}), '(250, 300, 50)\n', (203, 217), True, 'import numpy as np\n'), ((140, 167), 'dataset.AnaDual10Training', 'dataset.AnaDual10Training', ([], {}), '()\n', (165, 167), False, 'import dataset\n'), ((359, 375), 'numpy.exp', 'np.exp', (['cov_chol...
import json from collections import namedtuple from datetime import datetime from pathlib import Path from zipfile import ZipFile import h5py import numpy as np from scipy.signal import convolve2d from torch.utils.data import Dataset from .exceptions import InconsistentDataException, DoesNotExistException from .trans...
[ "json.dump", "h5py.File", "json.load", "numpy.sum", "zipfile.ZipFile", "numpy.random.randn", "numpy.ones", "pathlib.Path", "numpy.diff", "numpy.array", "collections.namedtuple", "numpy.where", "numpy.float64", "numpy.atleast_1d", "datetime.datetime.now" ]
[((11320, 11375), 'collections.namedtuple', 'namedtuple', (['"""DefaultDataPoint"""', "['images', 'responses']"], {}), "('DefaultDataPoint', ['images', 'responses'])\n", (11330, 11375), False, 'from collections import namedtuple\n'), ((4673, 4697), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r...
# ****************************************************************************** # Copyright 2017-2018 Intel Corporation # # 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.apa...
[ "os.unlink", "ngraph.op_graph.serde.serde.pb_to_axis", "ngraph.exp", "ngraph.op_graph.serde.serde.axis_to_protobuf", "numpy.arange", "ngraph.op_graph.serde.serde_pass.SerializationPass", "ngraph.op_graph.serde.serde.serialize_graph", "ngraph.placeholder", "ngraph.op_graph.serde.serde.protobuf_to_op"...
[((1128, 1148), 'ngraph.constant', 'ng.constant', (['(5.0)', 'ax'], {}), '(5.0, ax)\n', (1139, 1148), True, 'import ngraph as ng\n'), ((1776, 1799), 'copy.deepcopy', 'deepcopy', (['obj1.__dict__'], {}), '(obj1.__dict__)\n', (1784, 1799), False, 'from copy import deepcopy\n'), ((1828, 1851), 'copy.deepcopy', 'deepcopy',...
from itertools import product as product from math import ceil from typing import Tuple import numpy as np import torch from fnms import nms from ._model import FaceBoxes MIN_SIZES = [[32, 64, 128], [256], [512]] STEPS = [32, 64, 128] CLIP = False VARIANCE = [0.1, 0.2] KEEP_TOP_K = 5000 TRANSFORM_OFFSET = np.float32...
[ "math.ceil", "numpy.float32", "torch.load", "numpy.clip", "numpy.hstack", "torch.exp", "numpy.where", "numpy.array", "torch.cuda.is_available", "fnms.nms", "torch.device", "itertools.product", "torch.tensor", "torch.from_numpy" ]
[((310, 340), 'numpy.float32', 'np.float32', (['(-104, -117, -123)'], {}), '((-104, -117, -123))\n', (320, 340), True, 'import numpy as np\n'), ((3353, 3365), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (3361, 3365), True, 'import numpy as np\n'), ((3388, 3400), 'numpy.array', 'np.array', (['[]'], {}), '([])\n',...
""" Helper functions for loading data and managing arrays across ranks with MPI. """ import h5py import numpy as np try: from mpi4py import MPI _np2mpi = {np.dtype(np.float32): MPI.FLOAT, np.dtype(np.float64): MPI.DOUBLE, np.dtype(np.int): MPI.LONG, np.dtype(np.intc...
[ "h5py.File", "numpy.empty", "numpy.dtype", "numpy.zeros", "numpy.cumsum", "numpy.array", "numpy.ascontiguousarray", "numpy.prod" ]
[((607, 630), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['X'], {}), '(X)\n', (627, 630), True, 'import numpy as np\n'), ((3712, 3734), 'numpy.zeros', 'np.zeros', (['(1)'], {'dtype': 'int'}), '(1, dtype=int)\n', (3720, 3734), True, 'import numpy as np\n'), ((164, 184), 'numpy.dtype', 'np.dtype', (['np.float32'...
# -*- coding: utf-8 -*- """ Created on Sat Sep 2 13:35:38 2017 @author: Harsh """ import numpy as num print(num.zeros(10)) print(num.ones(10)) print(num.ones(10)*5) print(num.arange(10,51)) print(num.arange(10,51,2)) print(num.arange(0,9).reshape(3,3)) print(num.eye(3)) print(num.random.rand(1)) print(num.random.ran...
[ "numpy.sum", "numpy.random.randn", "numpy.std", "numpy.zeros", "numpy.ones", "numpy.arange", "numpy.linspace", "numpy.random.rand", "numpy.eye" ]
[((111, 124), 'numpy.zeros', 'num.zeros', (['(10)'], {}), '(10)\n', (120, 124), True, 'import numpy as num\n'), ((132, 144), 'numpy.ones', 'num.ones', (['(10)'], {}), '(10)\n', (140, 144), True, 'import numpy as num\n'), ((174, 192), 'numpy.arange', 'num.arange', (['(10)', '(51)'], {}), '(10, 51)\n', (184, 192), True, ...
#!/usr/bin/env python3 import argparse import glob import json import os import queue import threading import time from collections import defaultdict from copy import deepcopy import cv2 import numpy as np class Camera: """Contains logic dependent on camera and its position, i.e. undistortion and perspective...
[ "numpy.absolute", "numpy.arctan2", "argparse.ArgumentParser", "numpy.sum", "numpy.argmax", "cv2.getPerspectiveTransform", "numpy.polyfit", "numpy.isnan", "cv2.bilateralFilter", "collections.defaultdict", "numpy.mean", "numpy.arange", "cv2.rectangle", "glob.glob", "cv2.inRange", "os.pat...
[((2411, 2438), 'cv2.inRange', 'cv2.inRange', (['sobel', '*thresh'], {}), '(sobel, *thresh)\n', (2422, 2438), False, 'import cv2\n'), ((2541, 2573), 'cv2.Sobel', 'cv2.Sobel', (['img', 'cv2.CV_64F', '(1)', '(0)'], {}), '(img, cv2.CV_64F, 1, 0)\n', (2550, 2573), False, 'import cv2\n'), ((2587, 2619), 'cv2.Sobel', 'cv2.So...
import unittest import numpy as np from pystan import StanModel, stan from pystan._compat import PY2 from pystan.tests.helper import get_model # REF: rstan/tests/unitTests/runit.test.stanfit.R class TestStanfit(unittest.TestCase): def test_init_zero_exception_inf_grad(self): code = """ paramete...
[ "pystan.tests.helper.get_model", "numpy.sum", "numpy.log", "numpy.array", "numpy.exp", "numpy.testing.assert_equal", "pystan.StanModel" ]
[((440, 466), 'pystan.StanModel', 'StanModel', ([], {'model_code': 'code'}), '(model_code=code)\n', (449, 466), False, 'from pystan import StanModel, stan\n'), ((642, 785), 'numpy.array', 'np.array', (['[0.7, -0.16, 0.77, -1.37, -1.99, 1.35, 0.08, 0.02, -1.48, -0.08, 0.34, 0.03,\n -0.42, 0.87, -1.36, 1.43, 0.8, -0.4...
import numpy as np import tensorflow as tf import time class MGPC(object): ''' Variational Inference multiclass classification with gaussian processes ''' def __init__(self, kernels, inducing_points, n_classes, total_training_data, eps = 0.001): ''' Constructor @param ker...
[ "tensorflow.reduce_sum", "tensorflow.matrix_band_part", "numpy.polynomial.hermite.hermgauss", "tensorflow.clip_by_value", "numpy.argmax", "tensorflow.variables_initializer", "tensorflow.reshape", "tensorflow.ConfigProto", "tensorflow.Variable", "numpy.mean", "numpy.tile", "numpy.arange", "te...
[((822, 880), 'tensorflow.constant', 'tf.constant', (['[1.0 * total_training_data]'], {'dtype': 'tf.float32'}), '([1.0 * total_training_data], dtype=tf.float32)\n', (833, 880), True, 'import tensorflow as tf\n'), ((1484, 1561), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, self.input_di...
__author__ = 'junz' import numpy as np import os import scipy.ndimage as ni import scipy.sparse as sparse import math import matplotlib.pyplot as plt from itertools import combinations from operator import itemgetter import skimage.morphology as sm import skimage.transform as tsfm import matplotlib.color...
[ "matplotlib.pyplot.title", "numpy.arctan2", "numpy.sum", "numpy.amin", "math.atan2", "numpy.abs", "scipy.ndimage.measurements.label", "numpy.angle", "numpy.floor", "numpy.ones", "numpy.isnan", "numpy.shape", "matplotlib.pyplot.figure", "numpy.sin", "numpy.mean", "numpy.arange", "nump...
[((593, 615), 'core.FileTools.loadFile', 'ft.loadFile', (['trialPath'], {}), '(trialPath)\n', (604, 615), True, 'from core import FileTools as ft\n'), ((3760, 3782), 'numpy.gradient', 'np.gradient', (['phasemap1'], {}), '(phasemap1)\n', (3771, 3782), True, 'import numpy as np\n'), ((3799, 3821), 'numpy.gradient', 'np.g...
import tensorflow as tf import numpy as np from layers import Oper1D np.random.seed(10) tf.random.set_seed(10) ### SLR-OL def SLRol(n_bands, q): input = tf.keras.Input((n_bands, 1), name='input') x_0 = Oper1D(n_bands, 3, activation = 'tanh', q = q)(input) y = tf.matmul(x_0, input) model = tf.keras.models.Mo...
[ "tensorflow.random.set_seed", "numpy.random.seed", "layers.Oper1D", "tensorflow.keras.Input", "tensorflow.keras.models.Model", "tensorflow.matmul", "tensorflow.keras.optimizers.Adam" ]
[((71, 89), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (85, 89), True, 'import numpy as np\n'), ((90, 112), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(10)'], {}), '(10)\n', (108, 112), True, 'import tensorflow as tf\n'), ((158, 200), 'tensorflow.keras.Input', 'tf.keras.Input', (['(n_b...
import sys import numpy as np import pytest from opytimizer.core import function from opytimizer.optimizers import ba from opytimizer.spaces import search def test_ba_hyperparams(): hyperparams = { 'f_min': 0, 'f_max': 2, 'A': 0.5, 'r': 0.5 } new_ba = ba.BA(hyperparams=h...
[ "opytimizer.optimizers.ba.BA", "numpy.sum", "opytimizer.core.function.Function", "opytimizer.spaces.search.SearchSpace" ]
[((301, 331), 'opytimizer.optimizers.ba.BA', 'ba.BA', ([], {'hyperparams': 'hyperparams'}), '(hyperparams=hyperparams)\n', (306, 331), False, 'from opytimizer.optimizers import ba\n'), ((497, 504), 'opytimizer.optimizers.ba.BA', 'ba.BA', ([], {}), '()\n', (502, 504), False, 'from opytimizer.optimizers import ba\n'), ((...
""" Wrappers for Metaworld compatibility """ import numpy as np from metaworld import benchmarks from metaworld.benchmarks.base import Benchmark from metaworld.core.serializable import Serializable from metaworld.envs.mujoco.multitask_env import MultiClassMultiTaskEnv from metaworld.envs.mujoco.sawyer_xyz.sawyer_doo...
[ "numpy.random.randint", "numpy.random.choice" ]
[((1565, 1626), 'numpy.random.choice', 'np.random.choice', (['task_ids'], {'size': 'meta_batch_size', 'p': 'task2prob'}), '(task_ids, size=meta_batch_size, p=task2prob)\n', (1581, 1626), True, 'import numpy as np\n'), ((1382, 1444), 'numpy.random.randint', 'np.random.randint', (['(0)', 'mcmt_env.num_tasks'], {'size': '...
import deepspeech import wave import numpy as np import multiprocessing import time def speech_to_text(model_file_path, req_queue, return_dict): model = deepspeech.Model(model_file_path) while not req_queue.empty(): start = time.time() filename = req_queue.get() with wave.open(filename, 'r') as w: ...
[ "wave.open", "multiprocessing.current_process", "multiprocessing.Manager", "numpy.frombuffer", "time.time", "time.sleep", "multiprocessing.Queue", "multiprocessing.Process", "deepspeech.Model", "multiprocessing.cpu_count" ]
[((162, 195), 'deepspeech.Model', 'deepspeech.Model', (['model_file_path'], {}), '(model_file_path)\n', (178, 195), False, 'import deepspeech\n'), ((1145, 1172), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (1170, 1172), False, 'import multiprocessing\n'), ((1187, 1210), 'multiprocessing....
import os, sys import numpy as np from numpy import array import platform as pf import keras import tensorflow as tf from time import gmtime, strftime from keras.utils import to_categorical from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import OneHotEncoder from SupportMethods.Shuffler impor...
[ "platform.processor", "os.mkdir", "platform.python_version", "SupportMethods.ContentSupport.isNotNone", "os.path.isfile", "platform.release", "Json.Handler.Handler", "MachineLearning.ArtificialNeuralNetwork.NetworkModel.Model", "platform.architecture", "os.path.exists", "sklearn.preprocessing.La...
[((6982, 7022), 'Json.Handler.Handler', 'Handler', (['self._json_path', 'self.JSON_NAME'], {}), '(self._json_path, self.JSON_NAME)\n', (6989, 7022), False, 'from Json.Handler import Handler\n'), ((7750, 7772), 'Models.Samples.SampleGenerator', 'SampleGenerator', (['words'], {}), '(words)\n', (7765, 7772), False, 'from ...
#!/usr/bin/env python import rospy import numpy as np from nav_msgs.msg import Odometry from av_msgs.msg import States class State: def __init__(self): self.listener = rospy.Subscriber("/base_pose_ground_truth", Odometry, self.callback) self.states_pub = rospy.Publisher('/prius/states', States,...
[ "rospy.Subscriber", "rospy.get_rostime", "rospy.Publisher", "av_msgs.msg.States", "rospy.init_node", "rospy.spin", "numpy.sqrt", "rospy.Duration" ]
[((1154, 1184), 'rospy.init_node', 'rospy.init_node', (['"""states_node"""'], {}), "('states_node')\n", (1169, 1184), False, 'import rospy\n'), ((1209, 1221), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (1219, 1221), False, 'import rospy\n'), ((185, 253), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/base_pose_groun...
# -*- coding: utf-8 -*- import sys, os sys.path.insert(0, os.path.join(sys.path[0], '..')) # sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from public_function import self_print from sklearn.datasets import fetch_mldata import matplotlib import matplotlib.pyplot as plt import numpy as np ...
[ "sklearn.model_selection.cross_val_score", "sklearn.metrics.f1_score", "os.path.join", "sklearn.base.clone", "sklearn.linear_model.SGDClassifier", "matplotlib.pyplot.imshow", "sklearn.ensemble.RandomForestClassifier", "matplotlib.pyplot.show", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", ...
[((579, 637), 'sklearn.datasets.fetch_mldata', 'fetch_mldata', (['"""MNIST original"""'], {'data_home': 'custom_data_home'}), "('MNIST original', data_home=custom_data_home)\n", (591, 637), False, 'from sklearn.datasets import fetch_mldata\n'), ((676, 707), 'public_function.self_print', 'self_print', (['"""X shape & y ...
import IMLearn.learners.regressors.linear_regression from IMLearn.learners.regressors import PolynomialFitting from IMLearn.utils import split_train_test import numpy as np import pandas as pd import plotly.express as px import plotly.io as pio pio.templates.default = "simple_white" def load_data(filename: str) -> ...
[ "pandas.DataFrame", "numpy.random.seed", "pandas.read_csv", "plotly.express.line", "IMLearn.learners.regressors.PolynomialFitting", "plotly.express.bar", "IMLearn.utils.split_train_test", "plotly.express.scatter" ]
[((575, 618), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'parse_dates': "['Date']"}), "(filename, parse_dates=['Date'])\n", (586, 618), True, 'import pandas as pd\n'), ((818, 835), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (832, 835), True, 'import numpy as np\n'), ((1193, 1361), 'plotly.exp...
#!/usr/bin/env python3 import time import math import numpy import platform, sys, select from pyctrl.client import Controller import pyctrl.block as block import pyctrl.block.logger as logger # initialize controller HOST, PORT = "192.168.10.105", 9999 print(72 * '*') print('*' + 29 * ' ' + 'COSMOS SETUP' + 29 * ' '...
[ "pyctrl.block.Printer", "pyctrl.client.Controller", "numpy.zeros", "time.sleep", "numpy.max", "numpy.mean", "select.select", "numpy.argwhere", "sys.stdin.readline", "sys.exit", "pyctrl.block.logger.Logger" ]
[((579, 611), 'pyctrl.client.Controller', 'Controller', ([], {'host': 'HOST', 'port': 'PORT'}), '(host=HOST, port=PORT)\n', (589, 611), False, 'from pyctrl.client import Controller\n'), ((659, 674), 'pyctrl.block.logger.Logger', 'logger.Logger', ([], {}), '()\n', (672, 674), True, 'import pyctrl.block.logger as logger\...
import os import warnings import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns warnings.filterwarnings('ignore') class PlotProgression: def __init__(self, data = None, max_years = 3, color_map = None, cumulative = False, save_path = "plots/"): """ :param...
[ "pandas.DataFrame", "seaborn.lineplot", "matplotlib.pyplot.savefig", "os.makedirs", "warnings.filterwarnings", "matplotlib.pyplot.figure", "matplotlib.pyplot.xticks", "matplotlib.pyplot.grid", "numpy.unique" ]
[((121, 154), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (144, 154), False, 'import warnings\n'), ((1052, 1094), 'os.makedirs', 'os.makedirs', (['self.save_path'], {'exist_ok': '(True)'}), '(self.save_path, exist_ok=True)\n', (1063, 1094), False, 'import os\n'), ((1564...
import transforms import numpy as np import torch import torch.nn.functional as F import torchvision.transforms.functional as vis_F import random import math from typing import Tuple from cv2 import cv2 class RandomHorizontalFlip(torch.nn.Module): """Horizontally flip the given image randomly with a given probabil...
[ "transforms.ColorJitter", "transforms.Resize", "torchvision.transforms.functional.rotate", "random.uniform", "math.radians", "numpy.empty", "torchvision.transforms.functional.hflip", "math.sin", "transforms.ToPILImage", "numpy.array", "math.cos", "torch.rand", "transforms.ToTensor", "trans...
[((4032, 4072), 'numpy.empty', 'np.empty', (['points.shape'], {'dtype': 'np.float32'}), '(points.shape, dtype=np.float32)\n', (4040, 4072), True, 'import numpy as np\n'), ((4186, 4206), 'math.radians', 'math.radians', (['degree'], {}), '(degree)\n', (4198, 4206), False, 'import math\n'), ((3003, 3041), 'random.uniform'...
from __future__ import print_function from builtins import str import glob import lsst.afw.image as afwImage import pair_stats as ps import numpy as np datafile = 'ptctest.txt' outfile = 'ptcfit.txt' amps = [2] n = 50 data = np.recfromtxt(datafile, names=True) #open output file f = open(outfile, 'w+') f.write('\t'....
[ "numpy.recfromtxt", "builtins.str", "numpy.where", "numpy.polyfit" ]
[((228, 263), 'numpy.recfromtxt', 'np.recfromtxt', (['datafile'], {'names': '(True)'}), '(datafile, names=True)\n', (241, 263), True, 'import numpy as np\n'), ((733, 767), 'numpy.polyfit', 'np.polyfit', (['fmean[:n]', 'fvar[:n]', '(1)'], {}), '(fmean[:n], fvar[:n], 1)\n', (743, 767), True, 'import numpy as np\n'), ((49...
# demo for image noise estimation (processed, signal-dependent and AWGN) import numpy as np from imnest_ivhc import imnest_ivhc import skimage.io import skimage.filters import matplotlib.pyplot as plt def bilateral_flt(img_in, var_n, radius, sigma_s): img_or = img_in i_out = 0 P = 0 (rows, cols) = ...
[ "numpy.pad", "numpy.meshgrid", "numpy.random.seed", "imnest_ivhc.imnest_ivhc", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.std", "numpy.abs", "numpy.random.randn", "numpy.float32", "numpy.uint8", "numpy.mean", "numpy.arange", "numpy.exp", "numpy.int32", "numpy.sqrt" ]
[((346, 389), 'numpy.pad', 'np.pad', (['img_in', '(radius, radius)', '"""reflect"""'], {}), "(img_in, (radius, radius), 'reflect')\n", (352, 389), True, 'import numpy as np\n'), ((398, 431), 'numpy.arange', 'np.arange', (['(-radius)', '(radius + 1)', '(1)'], {}), '(-radius, radius + 1, 1)\n', (407, 431), True, 'import ...
""" This module provides functionality to gather and store information about a demographic model (as defined by a demographic model function), and to use this information to generate a visual representation of the model. Just two functions are used for generating and plotting models. For example, the following is all ...
[ "matplotlib.offsetbox.HPacker", "matplotlib.colors.LinearSegmentedColormap.from_list", "matplotlib.pyplot.savefig", "numpy.count_nonzero", "matplotlib.pyplot.show", "matplotlib.patches.Rectangle", "matplotlib.pyplot.close", "matplotlib.ticker.FixedLocator", "numpy.amax", "matplotlib.offsetbox.AuxT...
[((5652, 5676), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '(**fig_kwargs)\n', (5662, 5676), True, 'import matplotlib.pyplot as plt\n'), ((6596, 6618), 'numpy.amax', 'np.amax', (['tp.migrations'], {}), '(tp.migrations)\n', (6603, 6618), True, 'import numpy as np\n'), ((7065, 7093), 'matplotlib.ticker.FixedLoca...
# coding=utf-8 # Copyright 2021 The Uncertainty Baselines Authors. # # 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 ap...
[ "copy.deepcopy", "json.load", "tensorflow.zeros_like", "tensorflow.sign", "tensorflow.data.Dataset.from_tensor_slices", "tensorflow.stack", "numpy.array", "tensorflow.gfile.GFile", "tensorflow.greater", "tensorflow.equal" ]
[((5274, 5296), 'copy.deepcopy', 'copy.deepcopy', (['dialogs'], {}), '(dialogs)\n', (5287, 5296), False, 'import copy\n'), ((10805, 10825), 'tensorflow.sign', 'tf.sign', (['has_keyword'], {}), '(has_keyword)\n', (10812, 10825), True, 'import tensorflow as tf\n'), ((12412, 12439), 'tensorflow.stack', 'tf.stack', (['feat...
import copy import warnings from collections.abc import Iterable import numpy as np from astropy.table import Table from .gti import (generate_indices_of_segment_boundaries_binned, generate_indices_of_segment_boundaries_unbinned) from .utils import histogram, show_progress, sum_if_not_none_or_initia...
[ "scipy.fft.fft", "numpy.conj", "astropy.table.Table", "numpy.vectorize", "numpy.abs", "numpy.sum", "numpy.isclose", "numpy.diff", "numpy.array", "scipy.fft.fftfreq", "numpy.rint", "numpy.mean", "pyfftw.interfaces.cache.enable", "warnings.warn", "numpy.all", "numpy.sqrt" ]
[((19714, 19764), 'numpy.vectorize', 'np.vectorize', (['_estimate_intrinsic_coherence_single'], {}), '(_estimate_intrinsic_coherence_single)\n', (19726, 19764), True, 'import numpy as np\n'), ((411, 443), 'pyfftw.interfaces.cache.enable', 'pyfftw.interfaces.cache.enable', ([], {}), '()\n', (441, 443), False, 'import py...
import cv2 import torch from torch.utils.data import Dataset from torchvision import transforms import numpy as np import matplotlib.pyplot as plt import random from albumentations import ( HueSaturationValue, RandomBrightnessContrast, Compose, ) augmentation_pixel_techniques_pool = { "RandomBrightnes...
[ "torch.ones", "albumentations.Compose", "matplotlib.pyplot.show", "torch.stack", "torch.utils.data.DataLoader", "matplotlib.pyplot.imshow", "numpy.asarray", "torchvision.transforms.ToPILImage", "torch.nn.functional.pad", "albumentations.HueSaturationValue", "albumentations.RandomBrightnessContra...
[((332, 421), 'albumentations.RandomBrightnessContrast', 'RandomBrightnessContrast', ([], {'brightness_limit': '(0.005, 0.01)', 'contrast_limit': '(0.01)', 'p': '(0.3)'}), '(brightness_limit=(0.005, 0.01), contrast_limit=\n 0.01, p=0.3)\n', (356, 421), False, 'from albumentations import HueSaturationValue, RandomBri...
""" Parts of the code are adapted from https://github.com/akanazawa/hmr """ import numpy as np def compute_similarity_transform(S1, S2): """ Computes a similarity transform (R, t) that takes a set of 3D points S1 (3 x N) closest to a set of 3D points S2, where R is an 3x3 rotation matrix, t 3x1 transla...
[ "numpy.eye", "numpy.linalg.svd" ]
[((823, 839), 'numpy.linalg.svd', 'np.linalg.svd', (['K'], {}), '(K)\n', (836, 839), True, 'import numpy as np\n'), ((928, 946), 'numpy.eye', 'np.eye', (['U.shape[0]'], {}), '(U.shape[0])\n', (934, 946), True, 'import numpy as np\n')]
import numpy as np import matplotlib.pyplot as plt import pyfits as pf import scipy.ndimage.filters as sc import scipy.ndimage.filters as med import scipy.signal as cp def MAD(x,n=3): ##DESCRIPTION: ## Estimates the noise standard deviation from Median Absolute Deviation ## ##INPUTS: ## -x: a 2D ...
[ "numpy.abs", "numpy.shape", "scipy.ndimage.filters.convolve1d", "numpy.copy", "scipy.signal.convolve2d", "matplotlib.pyplot.imshow", "matplotlib.pyplot.colorbar", "numpy.reshape", "numpy.linspace", "scipy.ndimage.filters.median_filter", "numpy.size", "numpy.median", "numpy.log2", "numpy.mi...
[((644, 677), 'scipy.ndimage.filters.median_filter', 'med.median_filter', (['x'], {'size': '(n, n)'}), '(x, size=(n, n))\n', (661, 677), True, 'import scipy.ndimage.filters as med\n'), ((691, 707), 'numpy.abs', 'np.abs', (['(x - meda)'], {}), '(x - meda)\n', (697, 707), True, 'import numpy as np\n'), ((715, 726), 'nump...
""" Para esta implementacion, cada worker: 1.Calcula la distancia del todos los puntos a un centroide 2.Agrupa los puntos segun un vector de tags dado y con este agrupamiento calcula la nueva posicion del centroide """ import zmq import argparse from scipy.spatial import distance import numpy as np fr...
[ "numpy.average", "argparse.ArgumentParser", "scipy.spatial.distance.euclidean", "sklearn.datasets.make_blobs", "numpy.ndarray.tolist", "zmq.Context" ]
[((3662, 3687), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3685, 3687), False, 'import argparse\n'), ((1268, 1386), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': 'self.n_data', 'n_features': 'self.n_features', 'centers': 'self.n_clusters', 'random_state': 'random_state'})...
import shutil import time from pathlib import Path from functools import wraps import logging import random,os import numpy as np import torch import yaml from easydict import EasyDict as edict import warnings from pprint import pprint from collections import Counter def clock(fn): @wraps(fn) def wrapper(*ar...
[ "yaml.load", "numpy.random.seed", "logging.basicConfig", "torch.manual_seed", "collections.Counter", "torch.cuda.manual_seed", "time.time", "pathlib.Path", "random.seed", "functools.wraps", "easydict.EasyDict", "shutil.rmtree", "warnings.warn", "time.localtime" ]
[((291, 300), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (296, 300), False, 'from functools import wraps\n'), ((1337, 1524), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'level', 'filename': 'f"""output/{timestamp}/train_logs.log"""', 'filemode': '"""w+"""', 'format': '"""%(asctime)s - %(pathna...
''' Get PanSTARRS image cutout for our event candidates. ** For compatibility issues, please run this script under python2 190506: Download FITS files. ''' import os, sys, time import warnings import logging import json from collections import OrderedDict import numpy as np from astropy.coordinates i...
[ "json.dump", "json.load", "logging.basicConfig", "panstamps.image.image", "numpy.random.randn", "os.rename", "os.path.isfile", "panstamps.downloader.downloader", "collections.OrderedDict", "os.path.split", "astropy.coordinates.SkyCoord", "logging.getLogger" ]
[((749, 770), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (768, 770), False, 'import logging\n'), ((781, 800), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (798, 800), False, 'import logging\n'), ((1094, 1133), 'os.path.isfile', 'os.path.isfile', (['"""image-cutout-ps1.json"""'], {}),...
import wave import pyaudio import numpy as np def open_stream(fs): p = pyaudio.PyAudio() stream = p.open(format=pyaudio.paFloat32, channels=1, rate=fs, output=True) return p, stream def generate_tone(fs, freq, duration): npsin = np.sin(2 * n...
[ "numpy.arange", "pyaudio.PyAudio" ]
[((76, 93), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (91, 93), False, 'import pyaudio\n'), ((327, 351), 'numpy.arange', 'np.arange', (['(fs * duration)'], {}), '(fs * duration)\n', (336, 351), True, 'import numpy as np\n')]
""" This wingbox is a simplified version of the one of the University of Michigan uCRM-9. We use a couple of pyTACS load generating methods to model various wing loads under cruise. The script runs the structural analysis, evaluates the wing mass and von misses failure index and computes sensitivities with respect to w...
[ "tacs.elements.Tri3Shell", "tacs.constitutive.IsoShellConstitutive", "tacs.pyTACS", "os.path.dirname", "tacs.problems.StaticProblem", "numpy.sin", "numpy.array", "pprint.pprint", "numpy.cos", "tacs.constitutive.MaterialProperties", "tacs.elements.Quad4Shell", "tacs.elements.ShellRefAxisTransfo...
[((1286, 1335), 'tacs.pyTACS', 'pyTACS', (['bdfFile'], {'options': 'structOptions', 'comm': 'comm'}), '(bdfFile, options=structOptions, comm=comm)\n', (1292, 1335), False, 'from tacs import functions, constitutive, elements, pyTACS, problems\n'), ((3465, 3537), 'tacs.problems.StaticProblem', 'problems.StaticProblem', (...
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
[ "paddle.fluid.io.save_inference_model", "utils.init.init_pretraining_params", "argparse.ArgumentParser", "paddle.enable_static", "paddle.fluid.program_guard", "os.path.join", "multiprocessing.cpu_count", "paddle.fluid.Executor", "numpy.set_printoptions", "utils.args.ArgumentGroup", "sys.setdefau...
[((1228, 1260), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['__doc__'], {}), '(__doc__)\n', (1251, 1260), False, 'import argparse\n'), ((1271, 1344), 'utils.args.ArgumentGroup', 'ArgumentGroup', (['parser', '"""model"""', '"""options to init, resume and save model."""'], {}), "(parser, 'model', 'options to ...
# Encoding:UTF-8 # # The MIT License (MIT) # # Copyright (c) 2016-2017 yutiansut/QUANTAXIS # # 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 ...
[ "pandas.DataFrame", "math.sqrt", "numpy.std", "pandas.to_datetime", "numpy.cov" ]
[((2544, 2572), 'pandas.to_datetime', 'pd.to_datetime', (["data['time']"], {}), "(data['time'])\n", (2558, 2572), True, 'import pandas as pd\n'), ((6853, 6877), 'numpy.std', 'numpy.std', (['assest_profit'], {}), '(assest_profit)\n', (6862, 6877), False, 'import numpy\n'), ((6087, 6129), 'numpy.cov', 'numpy.cov', (['ass...
# $Id$ # # Copyright (C) 2001-2006 <NAME> and Rational Discovery LLC # # @@ All Rights Reserved @@ # This file is part of the RDKit. # The contents are covered by the terms of the BSD license # which is included in the file license.txt, found at the root # of the RDKit source tree. # """Cluster tree visualizatio...
[ "rdkit.sping.SVG.pidSVG.SVGCanvas", "numpy.log", "rdkit.sping.PDF.pidPDF.PDFCanvas", "rdkit.piddle.piddle.Color", "rdkit.sping.PIL.pidPIL.PILCanvas" ]
[((859, 880), 'rdkit.piddle.piddle.Color', 'piddle.Color', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (871, 880), False, 'from rdkit.piddle import piddle\n'), ((895, 922), 'rdkit.piddle.piddle.Color', 'piddle.Color', (['(0.8)', '(0.8)', '(0.8)'], {}), '(0.8, 0.8, 0.8)\n', (907, 922), False, 'from rdkit.piddle import p...
import numpy as np import cv2 import os import utils.blob as blob_utils import utils.opencv_transforms as cv_transforms import roi_data.rpn from core.config import cfg from utils.ImageIO import load_16bit_png, load_multislice_16bit_png from utils.ImageIO import get_dicom_image_blob, get_double_image_blob, get_a_img ...
[ "utils.opencv_transforms.ColorJitter", "utils.ImageIO.load_multislice_16bit_png", "cv2.imread", "utils.blob.im_list_to_blob", "numpy.array", "utils.blob.prep_im_for_blob", "utils.ImageIO.get_a_img", "utils.ImageIO.get_double_image_blob" ]
[((4116, 4157), 'utils.blob.im_list_to_blob', 'blob_utils.im_list_to_blob', (['processed_ims'], {}), '(processed_ims)\n', (4142, 4157), True, 'import utils.blob as blob_utils\n'), ((1410, 1438), 'utils.ImageIO.get_double_image_blob', 'get_double_image_blob', (['roidb'], {}), '(roidb)\n', (1431, 1438), False, 'from util...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 21 15:04:27 2019 @author: ghosh128 """ import sys sys.path.append("../../") import os import config import numpy as np import tensorflow as tf tf.set_random_seed(1) # %% print("LOAD DATA") train_data_fine = np.load(os.path.join(config.NUMPY_DIR, "s...
[ "tensorflow.contrib.layers.xavier_initializer", "tensorflow.reset_default_graph", "tensorflow.local_variables_initializer", "tensorflow.matmul", "tensorflow.Variable", "os.path.join", "sys.path.append", "tensorflow.variable_scope", "tensorflow.set_random_seed", "tensorflow.placeholder", "numpy.r...
[((122, 147), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (137, 147), False, 'import sys\n'), ((215, 236), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(1)'], {}), '(1)\n', (233, 236), True, 'import tensorflow as tf\n'), ((701, 725), 'tensorflow.reset_default_graph', 'tf.rese...
#Author: <NAME> #Email: <EMAIL> """ Calculates evaluation metrics for 2D signal filtering. """ import numpy as np import matplotlib.pyplot as plt from signal_2D import Add_Noise2D import seaborn as sns from scipy.ndimage import convolve import os import SimpleITK as sitk def SNR_Measure(I,Ihat): """Measure of sign...
[ "numpy.sum", "matplotlib.pyplot.clf", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "os.chdir", "SimpleITK.GetArrayViewFromImage", "os.path.abspath", "numpy.multiply", "numpy.std", "numpy.power", "SimpleITK.ReadImage", "numpy.max", "signal_2D.Add_Noise2D", "numpy.loadtxt", ...
[((1056, 1076), 'numpy.subtract', 'np.subtract', (['I', 'Ihat'], {}), '(I, Ihat)\n', (1067, 1076), True, 'import numpy as np\n'), ((1949, 1959), 'numpy.mean', 'np.mean', (['I'], {}), '(I)\n', (1956, 1959), True, 'import numpy as np\n'), ((1975, 1988), 'numpy.mean', 'np.mean', (['Ihat'], {}), '(Ihat)\n', (1982, 1988), T...
# -*- coding: utf-8 -*- """ Created on Tue Jun 1 2021 @author: <NAME> """ import numpy as np import matplotlib.pyplot as plt import cv2 import time from glob import glob from display import display_clusters import sklearn.metrics def k_means_pp(X, k): ''' Compute initial custer for k-means arguments: ...
[ "display.display_clusters", "matplotlib.pyplot.show", "numpy.concatenate", "cv2.cvtColor", "cv2.imwrite", "numpy.zeros", "numpy.expand_dims", "numpy.argmin", "time.time", "cv2.imread", "numpy.array", "numpy.linalg.norm", "numpy.random.choice", "glob.glob", "numpy.var", "cv2.resize" ]
[((3865, 3900), 'glob.glob', 'glob', (['"""images_for_test/*_image.jpg"""'], {}), "('images_for_test/*_image.jpg')\n", (3869, 3900), False, 'from glob import glob\n'), ((621, 645), 'numpy.random.choice', 'np.random.choice', (['n_data'], {}), '(n_data)\n', (637, 645), True, 'import numpy as np\n'), ((959, 978), 'numpy.a...
import copy from typing import List import logging import numpy as np import gunpowder as gp logger = logging.getLogger(__name__) class Squeeze(gp.BatchFilter): """Squeeze a batch at a given axis Args: arrays (List[gp.ArrayKey]): ArrayKeys to squeeze. axis: Position of the single-dimensiona...
[ "gunpowder.BatchRequest", "copy.deepcopy", "gunpowder.Batch", "numpy.squeeze", "logging.getLogger" ]
[((104, 131), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (121, 131), False, 'import logging\n'), ((805, 822), 'gunpowder.BatchRequest', 'gp.BatchRequest', ([], {}), '()\n', (820, 822), True, 'import gunpowder as gp\n'), ((983, 993), 'gunpowder.Batch', 'gp.Batch', ([], {}), '()\n', (99...
from typing import List import numpy as np from ..base import BaseVideoEncoder from ...helper import batching, get_first_available_gpu class YouTube8MEncoder(BaseVideoEncoder): batch_size = 64 def __init__(self, model_dir: str, model_name: str, *args, **kwargs): su...
[ "tensorflow.train.import_meta_graph", "tensorflow.get_collection", "tensorflow.Session", "numpy.zeros", "tensorflow.ConfigProto", "numpy.array", "tensorflow.Graph", "os.path.join" ]
[((658, 668), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (666, 668), True, 'import tensorflow as tf\n'), ((728, 792), 'os.path.join', 'os.path.join', (['self.model_dir', 'self.model_name', '"""inference_model"""'], {}), "(self.model_dir, self.model_name, 'inference_model')\n", (740, 792), False, 'import os\n'), ...
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "numpy.count_nonzero", "numpy.sum", "numpy.argmax", "numpy.zeros", "numpy.where", "numpy.diag", "numpy.nanmean" ]
[((976, 989), 'numpy.diag', 'np.diag', (['hist'], {}), '(hist)\n', (983, 989), True, 'import numpy as np\n'), ((1000, 1013), 'numpy.diag', 'np.diag', (['hist'], {}), '(hist)\n', (1007, 1013), True, 'import numpy as np\n'), ((1016, 1057), 'numpy.where', 'np.where', (['(denominator > 0)', 'denominator', '(1)'], {}), '(de...