code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""Classification methods."""
import numpy as np
from machine_learning.constants import N_CLASSES, FOLDS, MAX_K, RANDOM_SEED
from machine_learning.utilities import k_fold_split_indexes, get_k_nn
def classification(method, error_func, train, test, **kwargs):
"""Perform classification for data and return error.
... | [
"numpy.sum",
"numpy.log",
"numpy.argmax",
"machine_learning.utilities.k_fold_split_indexes",
"numpy.zeros",
"numpy.ones",
"numpy.random.RandomState",
"numpy.argsort",
"machine_learning.utilities.get_k_nn",
"numpy.concatenate"
] | [((3476, 3495), 'numpy.zeros', 'np.zeros', (['n_classes'], {}), '(n_classes)\n', (3484, 3495), True, 'import numpy as np\n'), ((3975, 4008), 'numpy.zeros', 'np.zeros', (['(n_classes, n_features)'], {}), '((n_classes, n_features))\n', (3983, 4008), True, 'import numpy as np\n'), ((4645, 4669), 'numpy.zeros', 'np.zeros',... |
import numpy as np
import pandas as pd
from . import ResError
def remove_leap_day(timeseries):
"""Removes leap days from a given timeseries
Parameters
----------
timeseries : array_like
The time series data to remove leap days from
* If something array_like is given, the length mus... | [
"numpy.array",
"pandas.date_range",
"numpy.logical_and"
] | [((1197, 1246), 'numpy.logical_and', 'np.logical_and', (['(times.day == 29)', '(times.month == 2)'], {}), '(times.day == 29, times.month == 2)\n', (1211, 1246), True, 'import numpy as np\n'), ((650, 719), 'pandas.date_range', 'pd.date_range', (['"""01-01-2000 00:00:00"""', '"""12-31-2000 23:00:00"""'], {'freq': '"""H""... |
from joblib import Memory
import math
import music21 as m21
import numpy as np
import os
from scipy.fftpack import fft, ifft
def get_composers():
return ["Haydn", "Mozart"]
def get_data_dir():
return "/scratch/vl1019/nemisig2018_data"
def get_dataset_name():
return "nemisig2018"
def concatenate_layer... | [
"numpy.sum",
"numpy.abs",
"numpy.zeros",
"numpy.expand_dims",
"scipy.fftpack.fft",
"scipy.fftpack.ifft",
"numpy.fft.fftshift",
"numpy.exp",
"numpy.reshape",
"numpy.dot",
"numpy.linalg.solve",
"numpy.concatenate"
] | [((429, 451), 'numpy.concatenate', 'np.concatenate', (['layers'], {}), '(layers)\n', (443, 451), True, 'import numpy as np\n'), ((546, 582), 'numpy.zeros', 'np.zeros', (['(N, 1, 2 * (J_fr - 2) + 1)'], {}), '((N, 1, 2 * (J_fr - 2) + 1))\n', (554, 582), True, 'import numpy as np\n'), ((1168, 1209), 'numpy.concatenate', '... |
## Comborbidities:
## Comborbidities:
## Asthma, Obesity, Smoking, Diabetes, Heart diseae, Hypertension
## Symptom list: Covid-Recovered, Covid-Positive, Taste, Fever, Headache,
# Pneumonia, Stomach, Myocarditis, Blood-Clots, Death
## Mild symptoms: Taste, Fever, Headache, Stomach
## Critical symptoms: Pneumonia, Myoc... | [
"pandas.DataFrame",
"numpy.random.uniform",
"numpy.matrix",
"policy.RandomPolicy",
"numpy.argmax",
"numpy.zeros",
"policy.get_action",
"numpy.random.gamma",
"numpy.array",
"numpy.random.choice",
"numpy.concatenate"
] | [((440, 477), 'numpy.random.choice', 'np.random.choice', (['(2)'], {'size': 'pop.n_genes'}), '(2, size=pop.n_genes)\n', (456, 477), True, 'import numpy as np\n'), ((500, 522), 'numpy.random.choice', 'np.random.choice', (['(2)', '(1)'], {}), '(2, 1)\n', (516, 522), True, 'import numpy as np\n'), ((542, 564), 'numpy.rand... |
# <NAME>
# <EMAIL>
# MIT License
# As-simple-as-possible training loop for an autoencoder.
import torch
import numpy as np
import torch.optim as optim
from torch import nn
from torch.utils.data import DataLoader, TensorDataset
from model.shallow_autoencoder import ConvAutoencoder
# load model definition
model = Co... | [
"torch.nn.MSELoss",
"torch.utils.data.DataLoader",
"numpy.random.random",
"model.shallow_autoencoder.ConvAutoencoder",
"torch.tensor"
] | [((318, 335), 'model.shallow_autoencoder.ConvAutoencoder', 'ConvAutoencoder', ([], {}), '()\n', (333, 335), False, 'from model.shallow_autoencoder import ConvAutoencoder\n'), ((424, 436), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (434, 436), False, 'from torch import nn\n'), ((649, 680), 'numpy.random.random'... |
import cv2
from PIL import Image
import numpy as np
import constants
import os
import math
import matplotlib.pyplot as plt
import time
def hammingDistance(v1, v2):
t = 0
for i in range(len(v1)):
if v1[i] != v2[i]:
t += 1
return t
# read thresholds from thresholds.txt and then store th... | [
"matplotlib.pyplot.title",
"PyQt5.QtWidgets.QMainWindow.__init__",
"PyQt5.QtWidgets.QVBoxLayout",
"matplotlib.pyplot.figure",
"matplotlib.backends.backend_qt5agg.NavigationToolbar2QT",
"PyQt5.QtWidgets.QApplication",
"os.path.join",
"PyQt5.QtWidgets.QWidget",
"matplotlib.backends.backend_qt5agg.Figu... | [((10253, 10277), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (10267, 10277), False, 'import matplotlib\n'), ((1118, 1142), 'cv2.imread', 'cv2.imread', (['imagePath', '(0)'], {}), '(imagePath, 0)\n', (1128, 1142), False, 'import cv2\n'), ((1343, 1364), 'PIL.Image.fromarray', 'Image.froma... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 21 15:39:43 2019
@author: Manu
"""
import mne
from mne import io
import sys
sys.path.append('C:/_MANU/_U821/Python_Dev/')
import scipy
from util import tools,asr,raw_asrcalibration
import numpy as np
import matplotlib.pyplot as plt
from mne.viz import plot_evoked_topo... | [
"mne.pick_types",
"util.asr.YW_filter",
"mne.io.read_raw_brainvision",
"util.raw_asrcalibration.raw_asrcalibration",
"numpy.arange",
"sys.path.append",
"mne.events_from_annotations",
"scipy.signal.lfilter",
"mne.channels.read_montage",
"scipy.signal.iirfilter",
"numpy.linspace",
"matplotlib.py... | [((126, 171), 'sys.path.append', 'sys.path.append', (['"""C:/_MANU/_U821/Python_Dev/"""'], {}), "('C:/_MANU/_U821/Python_Dev/')\n", (141, 171), False, 'import sys\n'), ((391, 436), 'mne.io.read_raw_brainvision', 'io.read_raw_brainvision', (['fname'], {'preload': '(False)'}), '(fname, preload=False)\n', (414, 436), Fals... |
import numpy as np
import string
import re
import nltk
nltk.download('stopwords')
stop_words = nltk.corpus.stopwords.words('english')
class word_inform():
def __init__(self):
self.inform = {}
def wordinput(self):
WI = input('문장을 입력해주세요 : ') # 문장 받아오기. WI = word input.... | [
"nltk.download",
"numpy.zeros_like",
"re.sub",
"nltk.corpus.stopwords.words"
] | [((55, 81), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (68, 81), False, 'import nltk\n'), ((95, 133), 'nltk.corpus.stopwords.words', 'nltk.corpus.stopwords.words', (['"""english"""'], {}), "('english')\n", (122, 133), False, 'import nltk\n'), ((2335, 2369), 're.sub', 're.sub', (['""... |
"""
==========================================================
Sample pipeline for text feature extraction and evaluation
==========================================================
The dataset used in this example is the 20 newsgroups dataset which will be
automatically downloaded and then cached and reused for the d... | [
"sklearn.model_selection.GridSearchCV",
"sklearn.feature_extraction.text.CountVectorizer",
"sklearn.preprocessing.StandardScaler",
"logging.basicConfig",
"warnings.filterwarnings",
"sklearn.linear_model.SGDClassifier",
"time.time",
"warnings.catch_warnings",
"pprint.pprint",
"numpy.array",
"skle... | [((2196, 2288), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s %(levelname)s %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s %(levelname)s %(message)s')\n", (2215, 2288), False, 'import logging\n'), ((2058, 2083), 'warnings.catch_warnings', 'war... |
"""!
All functions providing plotting functionalities.
"""
import matplotlib.pylab as plt
import matplotlib.dates as mdates
import matplotlib.image as image
import pandas as pd
import re
import argparse
import datetime as dt
import numpy as np
from pandas.plotting import register_matplotlib_converters
from datetime im... | [
"matplotlib.pylab.savefig",
"pandas.DataFrame.from_dict",
"argparse.ArgumentParser",
"numpy.datetime64",
"matplotlib.pylab.title",
"pandas.plotting.register_matplotlib_converters",
"matplotlib.pylab.ylabel",
"re.match",
"matplotlib.pylab.rcParams.update",
"matplotlib.dates.HourLocator",
"matplot... | [((336, 368), 'pandas.plotting.register_matplotlib_converters', 'register_matplotlib_converters', ([], {}), '()\n', (366, 368), False, 'from pandas.plotting import register_matplotlib_converters\n'), ((369, 407), 'matplotlib.pylab.rcParams.update', 'plt.rcParams.update', (["{'font.size': 22}"], {}), "({'font.size': 22}... |
# ******************************************************************************
# 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... | [
"caffe2.python.workspace.FetchBlob",
"caffe2.python.core.Net",
"numpy.allclose",
"caffe2.python.workspace.RunNetOnce",
"numpy.prod",
"ngraph.frontends.caffe2.c2_importer.importer.C2Importer",
"caffe2.python.workspace.ResetWorkspace",
"random.gauss",
"ngraph.testing.ExecutorFactory"
] | [((1256, 1282), 'caffe2.python.workspace.ResetWorkspace', 'workspace.ResetWorkspace', ([], {}), '()\n', (1280, 1282), False, 'from caffe2.python import core, workspace\n'), ((1429, 1444), 'caffe2.python.core.Net', 'core.Net', (['"""net"""'], {}), "('net')\n", (1437, 1444), False, 'from caffe2.python import core, worksp... |
# This is a module with functions that can be used to calculate the Froude
# number in a simple 2D system
# <NAME>, 2015
import numpy as np
import datetime
from salishsea_tools.nowcast import analyze
def find_mixed_depth_indices(n2, n2_thres=5e-6):
"""Finds the index of the mixed layer depth for each x-positio... | [
"numpy.abs",
"numpy.argmax",
"numpy.zeros",
"numpy.mean",
"numpy.arange",
"numpy.where",
"datetime.timedelta",
"numpy.rollaxis",
"salishsea_tools.nowcast.analyze.depth_average",
"numpy.sqrt"
] | [((1656, 1692), 'numpy.mean', 'np.mean', (['mixed_depths[xmin:xmax + 1]'], {}), '(mixed_depths[xmin:xmax + 1])\n', (1663, 1692), True, 'import numpy as np\n'), ((2228, 2250), 'numpy.arange', 'np.arange', (['n2.shape[0]'], {}), '(n2.shape[0])\n', (2237, 2250), True, 'import numpy as np\n'), ((3763, 3786), 'numpy.zeros',... |
import argparse
import torch
import sys
import os
import json
from collections import defaultdict
import h5py
from sentence_transformers import SentenceTransformer, util
import numpy
import tqdm
from itertools import zip_longest
from utils import grouper, load_sentences, load_bnids, load_visualsem_bnids
def retrieve_... | [
"utils.load_sentences",
"h5py.File",
"os.remove",
"os.makedirs",
"argparse.ArgumentParser",
"tqdm.trange",
"os.path.realpath",
"numpy.argsort",
"sentence_transformers.util.pytorch_cos_sim",
"os.path.isfile",
"utils.load_bnids",
"numpy.array",
"torch.cuda.is_available",
"utils.load_visualse... | [((1034, 1059), 'os.path.isfile', 'os.path.isfile', (['out_fname'], {}), '(out_fname)\n', (1048, 1059), False, 'import os\n'), ((1356, 1387), 'sentence_transformers.SentenceTransformer', 'SentenceTransformer', (['model_name'], {}), '(model_name)\n', (1375, 1387), False, 'from sentence_transformers import SentenceTransf... |
import hcat.lib.functional
import hcat.lib.functional as functional
from hcat.lib.utils import calculate_indexes, load, cochlea_to_xml, correct_pixel_size, scale_to_hair_cell_diameter
from hcat.lib.cell import Cell
from hcat.lib.cochlea import Cochlea
from hcat.backends.detection import FasterRCNN_from_url
from hcat.ba... | [
"hcat.lib.utils.correct_pixel_size",
"hcat.lib.utils.warn",
"hcat.lib.utils.scale_to_hair_cell_diameter",
"numpy.zeros",
"hcat.lib.explore_lif.get_xml",
"hcat.lib.utils.calculate_indexes",
"hcat.lib.cochlea.Cochlea",
"hcat.backends.detection.FasterRCNN_from_url",
"hcat.lib.utils.load",
"torch.cuda... | [((1374, 1438), 'hcat.lib.utils.warn', 'warn', (['"""ERROR: No File to Analyze... \nAborting."""'], {'color': '"""red"""'}), '("""ERROR: No File to Analyze... \nAborting.""", color=\'red\')\n', (1378, 1438), False, 'from hcat.lib.utils import warn\n'), ((1487, 1628), 'hcat.lib.utils.warn', 'warn', (['"""WARNING: Pixel ... |
import csv
import time
import numpy as np
import argparse
import warnings
warnings.filterwarnings('ignore')
from sklearn.preprocessing import scale
from sklearn.model_selection import GridSearchCV
from sklearn.neural_network import MLPRegressor
from sklearn.model_selection import train_test_split
from sklearn.feature_... | [
"argparse.ArgumentParser",
"sklearn.preprocessing.scale",
"warnings.filterwarnings",
"sklearn.model_selection.train_test_split",
"csv.DictReader",
"sklearn.neural_network.MLPRegressor",
"numpy.array",
"sklearn.feature_extraction.DictVectorizer",
"numpy.loadtxt"
] | [((74, 107), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (97, 107), False, 'import warnings\n'), ((449, 496), 'numpy.loadtxt', 'np.loadtxt', (['datafile'], {'skiprows': '(1)', 'delimiter': '""","""'}), "(datafile, skiprows=1, delimiter=',')\n", (459, 496), True, 'import... |
from nanoget import get_input
from argparse import ArgumentParser
from nanoplot import utils
from .version import __version__
from nanoplotter import check_valid_time_and_sort, Plot
from os import path
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
def main():
args = get_args()
merge... | [
"argparse.ArgumentParser",
"matplotlib.pyplot.close",
"nanoplotter.Plot",
"nanoplotter.check_valid_time_and_sort",
"numpy.log10",
"nanoget.get_input",
"os.path.join"
] | [((1081, 1229), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Get detection curve of nanopore experiment."""', 'epilog': 'epilog', 'formatter_class': 'utils.custom_formatter', 'add_help': '(False)'}), "(description='Get detection curve of nanopore experiment.',\n epilog=epilog, formatter_clas... |
import numpy as np
import matplotlib.pyplot as plt
from IPython.core.debugger import set_trace
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import glob
import os
from skimage.io import imread
from skimage.transform import resize
from torch.utils import data
import os... | [
"numpy.stack",
"utils.rotate_fcns.rotate_2d",
"pandas.read_csv",
"pandas.ExcelFile",
"numpy.zeros",
"pandas.read_excel",
"numpy.array",
"utils.rotate_fcns.flip_2d",
"torch.from_numpy"
] | [((599, 639), 'pandas.read_csv', 'pd.read_csv', (['"""utils/rot_dict_unique.csv"""'], {}), "('utils/rot_dict_unique.csv')\n", (610, 639), True, 'import pandas as pd\n'), ((717, 769), 'pandas.ExcelFile', 'pd.ExcelFile', (["(self.path + os.sep + 'ListOfData.xlsx')"], {}), "(self.path + os.sep + 'ListOfData.xlsx')\n", (72... |
# 多个文件中要用到的函数之类的统一写在这里
from skimage.measure import label
import numpy as np
import copy
# 如果最大连通域面积小于2000,直接认为分割错误,返回无分割结果,反之保留面积最大连通域,如果面积第二大连通域和最大差不多,则两个都保留
def refine_output(output):
refine = np.zeros((1280, 2440), dtype=np.uint8)
if len(np.where(output > 0)[0]) > 0:
output = label(output)
... | [
"copy.deepcopy",
"skimage.measure.label",
"numpy.where",
"numpy.zeros"
] | [((201, 239), 'numpy.zeros', 'np.zeros', (['(1280, 2440)'], {'dtype': 'np.uint8'}), '((1280, 2440), dtype=np.uint8)\n', (209, 239), True, 'import numpy as np\n'), ((298, 311), 'skimage.measure.label', 'label', (['output'], {}), '(output)\n', (303, 311), False, 'from skimage.measure import label\n'), ((251, 271), 'numpy... |
import bayesian_irl
import mdp_worlds
import utils
import mdp
import numpy as np
import scipy
import random
import generate_efficient_frontier
import matplotlib.pyplot as plt
def generate_reward_sample():
#rewards for no-op are gamma distributed
r_noop = []
locs = 1/2
scales = [20, 40, 80,190]
... | [
"numpy.random.seed",
"numpy.ones",
"numpy.random.gamma",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.linalg.norm",
"mdp.get_policy_expected_return",
"mdp.MachineReplacementMDP",
"matplotlib.pyplot.tight_layout",
"numpy.random.randn",
"matplotlib.pyplot.yticks",
"numpy.max",
"random.seed... | [((418, 434), 'numpy.array', 'np.array', (['r_noop'], {}), '(r_noop)\n', (426, 434), True, 'import numpy as np\n'), ((582, 616), 'numpy.concatenate', 'np.concatenate', (['(r_noop, r_repair)'], {}), '((r_noop, r_repair))\n', (596, 616), True, 'import numpy as np\n'), ((924, 945), 'numpy.array', 'np.array', (['all_sample... |
from SentimentAnalysis.creat_data.config import tencent
import pandas as pd
import numpy as np
import requests
import json
import time
import random
import hashlib
from urllib import parse
from collections import OrderedDict
AppID = tencent['account']['id_1']['APP_ID']
AppKey = tencent['account']['id_1']['AppKey']
de... | [
"pandas.DataFrame",
"json.loads",
"urllib.parse.urlencode",
"random.choice",
"time.time",
"numpy.where",
"collections.OrderedDict",
"requests.post"
] | [((776, 789), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (787, 789), False, 'from collections import OrderedDict\n'), ((906, 929), 'urllib.parse.urlencode', 'parse.urlencode', (['params'], {}), '(params)\n', (921, 929), False, 'from urllib import parse\n'), ((2557, 2643), 'pandas.DataFrame', 'pd.DataFr... |
# -*- coding: utf-8 -*-
'''
#-------------------------------------------------------------------------------
# NATIONAL UNIVERSITY OF SINGAPORE - NUS
# SINGAPORE INSTITUTE FOR NEUROTECHNOLOGY - SINAPSE
# Singapore
# URL: http://www.sinapseinstitute.org
#-----------------------------------------------------------... | [
"sys.path.append",
"numpy.size",
"sklearn.externals.joblib.dump",
"numpy.zeros",
"numpy.transpose",
"os.path.isfile",
"sklearn.externals.joblib.load",
"numpy.loadtxt",
"sklearn.svm.SVC",
"numpy.vstack"
] | [((1187, 1216), 'sys.path.append', 'sys.path.append', (['"""../general"""'], {}), "('../general')\n", (1202, 1216), False, 'import os, os.path, sys\n'), ((9841, 9877), 'numpy.loadtxt', 'np.loadtxt', (['"""NewData_BRC/BRC_B1.txt"""'], {}), "('NewData_BRC/BRC_B1.txt')\n", (9851, 9877), True, 'import numpy as np\n'), ((10... |
import pdb
import json
import numpy as np
file = 'benchmark_data.json'
with open(file, 'r') as f:
json_data = json.load(f)
print(json_data.keys()) # ['domains', 'version']
domains = json_data['domains']
print('domain length', len(domains))
corr_data = []
for domain in domains:
temp = {}
temp['long_description'... | [
"numpy.save",
"numpy.array",
"json.load"
] | [((719, 738), 'numpy.array', 'np.array', (['corr_data'], {}), '(corr_data)\n', (727, 738), True, 'import numpy as np\n'), ((739, 779), 'numpy.save', 'np.save', (['"""benchmark_data.npy"""', 'corr_data'], {}), "('benchmark_data.npy', corr_data)\n", (746, 779), True, 'import numpy as np\n'), ((113, 125), 'json.load', 'js... |
'''
Created on Feb 24, 2015
@author: <NAME> <<EMAIL>>
This module provides functions and classes for probability distributions, which
build upon the scipy.stats package and extend it.
'''
from __future__ import division
import numpy as np
from scipy import stats, special, linalg, optimize
from ..data_structures... | [
"numpy.sum",
"numpy.abs",
"scipy.special.ndtri",
"numpy.random.exponential",
"scipy.optimize.leastsq",
"numpy.histogram",
"scipy.optimize.newton",
"numpy.exp",
"numpy.diag",
"numpy.prod",
"numpy.unique",
"numpy.zeros_like",
"scipy.stats.lognorm.pdf",
"scipy.stats.norm.cdf",
"scipy.stats.... | [((2333, 2366), 'numpy.linspace', 'np.linspace', (['(0)', 'val_max', '(bins + 1)'], {}), '(0, val_max, bins + 1)\n', (2344, 2366), True, 'import numpy as np\n'), ((2420, 2483), 'numpy.histogram', 'np.histogram', (['vals'], {'bins': 'bins', 'range': '[0, val_max]', 'density': '(True)'}), '(vals, bins=bins, range=[0, val... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import torch
from torch.utils.data import Dataset
from sklearn.model_selection import train_test_split
# Define the class for the Meta-material dataset
class MetaMaterialDataSet(Dataset):
""" The Meta Material Dataset Class """
def __init__... | [
"numpy.random.shuffle",
"numpy.multiply",
"torch.utils.data.DataLoader",
"sklearn.model_selection.train_test_split",
"numpy.power",
"numpy.savetxt",
"numpy.zeros",
"numpy.arange",
"numpy.array",
"numpy.linspace",
"numpy.concatenate",
"numpy.sqrt"
] | [((1093, 1129), 'numpy.linspace', 'np.linspace', (['r_min', 'r_max', '(space + 1)'], {}), '(r_min, r_max, space + 1)\n', (1104, 1129), True, 'import numpy as np\n'), ((1144, 1180), 'numpy.linspace', 'np.linspace', (['h_min', 'h_max', '(space + 1)'], {}), '(h_min, h_max, space + 1)\n', (1155, 1180), True, 'import numpy ... |
import numpy as np
from ..colors import Color
from .widget import Widget, overlapping_region
from .widget_data_structures import Point, Size, Rect
class _Root(Widget):
"""
Root widget. Meant to be instantiated by the `App` class. Renders to terminal.
"""
def __init__(self, app, env_out, default_char,... | [
"numpy.full",
"numpy.full_like",
"numpy.zeros_like",
"numpy.not_equal",
"numpy.any",
"numpy.nonzero",
"numpy.logical_or"
] | [((775, 820), 'numpy.full', 'np.full', (['dim', 'self.default_char'], {'dtype': 'object'}), '(dim, self.default_char, dtype=object)\n', (782, 820), True, 'import numpy as np\n'), ((849, 903), 'numpy.full', 'np.full', (['(*dim, 6)', 'self.default_color'], {'dtype': 'np.uint8'}), '((*dim, 6), self.default_color, dtype=np... |
import logging
import numpy as np
from openpnm.utils import SettingsAttr, Docorator
from openpnm.integrators import ScipyRK45
from openpnm.algorithms import GenericAlgorithm
from openpnm.algorithms._solution import SolutionContainer, TransientSolution
logger = logging.getLogger(__name__)
docstr = Docorator()
@docstr.... | [
"openpnm.algorithms._solution.TransientSolution",
"numpy.isscalar",
"openpnm.utils.Docorator",
"numpy.ones",
"openpnm.algorithms._solution.SolutionContainer",
"numpy.hstack",
"numpy.cumsum",
"openpnm.integrators.ScipyRK45",
"numpy.arange",
"openpnm.utils.SettingsAttr",
"logging.getLogger"
] | [((261, 288), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (278, 288), False, 'import logging\n'), ((298, 309), 'openpnm.utils.Docorator', 'Docorator', ([], {}), '()\n', (307, 309), False, 'from openpnm.utils import SettingsAttr, Docorator\n'), ((797, 850), 'openpnm.utils.SettingsAttr',... |
__copyright__ = "Copyright (C) 2019 <NAME>"
__license__ = """
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, modif... | [
"pytest.mark.parametrize",
"numpy.sqrt",
"pytest.skip",
"common.parser.parse_args"
] | [((1284, 1330), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dtype"""', '[np.float64]'], {}), "('dtype', [np.float64])\n", (1307, 1330), False, 'import pytest\n'), ((1333, 1404), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""Stepper"""', '[ps.RungeKutta4, ps.LowStorageRK54]'], {}), "('Stepp... |
'''
Setup file for Operator and Hamiltonain Generators.
'''
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config=Configuration('hgen',parent_package,top_path)
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
se... | [
"numpy.distutils.core.setup",
"numpy.distutils.misc_util.Configuration"
] | [((179, 226), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""hgen"""', 'parent_package', 'top_path'], {}), "('hgen', parent_package, top_path)\n", (192, 226), False, 'from numpy.distutils.misc_util import Configuration\n'), ((318, 352), 'numpy.distutils.core.setup', 'setup', ([], {'configuration': 'c... |
from setuptools import setup
import numpy
setup(
name='CIGAN',
version='0.2dev',
packages=['vpa'],
license='MIT License',
include_dirs=[numpy.get_include(),],
) | [
"numpy.get_include"
] | [((157, 176), 'numpy.get_include', 'numpy.get_include', ([], {}), '()\n', (174, 176), False, 'import numpy\n')] |
#!/usr/bin/env python3
import re, argparse, numpy as np, glob, os
#from sklearn.neighbors.kde import KernelDensity
import matplotlib.pyplot as plt
from extractTargetFilesNonDim import epsNuFromRe
from extractTargetFilesNonDim import getAllData
from computeSpectraNonDim import readAllSpectra
colors = ['#1f78b4', '#3... | [
"matplotlib.pyplot.subplot",
"extractTargetFilesNonDim.epsNuFromRe",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"numpy.log",
"extractTargetFilesNonDim.getAllData",
"computeSpectraNonDim.readAllSpectra",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"glob.glob",
"matplotli... | [((982, 1008), 'glob.glob', 'glob.glob', (["(runspath + '/*')"], {}), "(runspath + '/*')\n", (991, 1008), False, 'import re, argparse, numpy as np, glob, os\n'), ((1277, 1318), 'numpy.arange', 'np.arange', (['(1)', '(nBins + 1)'], {'dtype': 'np.float64'}), '(1, nBins + 1, dtype=np.float64)\n', (1286, 1318), True, 'impo... |
import numpy as np
import pyvista as pv
from pylie import SE3
class Viewer3D:
"""Visualises the lab in 3D"""
def __init__(self):
"""Sets up the 3D viewer"""
self._plotter = pv.Plotter()
# Add scene origin and plane
scene_plane = pv.Plane(i_size=1000, j_size=1000)
self... | [
"numpy.zeros",
"pyvista.Plotter",
"pyvista.Pyramid",
"pyvista.numpy_to_texture",
"pyvista.Plane",
"numpy.array",
"pyvista.Rectangle",
"pyvista.Arrow",
"numpy.diag",
"pylie.SE3",
"pyvista.Sphere"
] | [((200, 212), 'pyvista.Plotter', 'pv.Plotter', ([], {}), '()\n', (210, 212), True, 'import pyvista as pv\n'), ((273, 307), 'pyvista.Plane', 'pv.Plane', ([], {'i_size': '(1000)', 'j_size': '(1000)'}), '(i_size=1000, j_size=1000)\n', (281, 307), True, 'import pyvista as pv\n'), ((1511, 1540), 'pyvista.Sphere', 'pv.Sphere... |
#Callbacks
"""Create training callbacks"""
import os
import numpy as np
import pandas as pd
from datetime import datetime
from DeepTreeAttention.utils import metrics
from DeepTreeAttention.visualization import visualize
from tensorflow.keras.callbacks import ReduceLROnPlateau
from tensorflow.keras.callbacks import Ca... | [
"numpy.concatenate",
"numpy.argmax",
"tensorflow.keras.callbacks.ReduceLROnPlateau",
"DeepTreeAttention.utils.metrics.f1_scores",
"DeepTreeAttention.utils.metrics.site_confusion",
"DeepTreeAttention.utils.metrics.genus_confusion",
"DeepTreeAttention.visualization.visualize.plot_prediction",
"tensorflo... | [((7816, 7923), 'tensorflow.keras.callbacks.ReduceLROnPlateau', 'ReduceLROnPlateau', ([], {'monitor': '"""val_loss"""', 'factor': '(0.5)', 'patience': '(10)', 'min_delta': '(0.1)', 'min_lr': '(1e-05)', 'verbose': '(1)'}), "(monitor='val_loss', factor=0.5, patience=10, min_delta=\n 0.1, min_lr=1e-05, verbose=1)\n", (... |
#!/usr/bin/env python
"""Remove embedded signalalign analyses from files"""
########################################################################
# File: remove_sa_analyses.py
# executable: remove_sa_analyses.py
#
# Author: <NAME>
# History: 02/06/19 Created
#########################################################... | [
"argparse.ArgumentParser",
"numpy.asarray",
"os.path.exists",
"signalalign.fast5.Fast5",
"os.path.join",
"py3helpers.utils.list_dir"
] | [((547, 582), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (561, 582), False, 'from argparse import ArgumentParser\n'), ((1720, 1741), 'os.path.exists', 'os.path.exists', (['fast5'], {}), '(fast5)\n', (1734, 1741), False, 'import os\n'), ((1794, 1817), 'signa... |
import matplotlib.pyplot as plt
import numpy as np
cnames = [
'#F0F8FF',
'#FAEBD7',
'#00FFFF',
'#7FFFD4',
'#F0FFFF',
'#F5F5DC',
'#FFE4C4',
'#000000',
'#FFEBCD',
'#0000FF',
'#8A2BE2',
'#A52A2A',
'#DEB887',
'#... | [
"matplotlib.pyplot.bar",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((5007, 5020), 'numpy.arange', 'np.arange', (['(12)'], {}), '(12)\n', (5016, 5020), True, 'import numpy as np\n'), ((6430, 6440), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (6438, 6440), True, 'import matplotlib.pyplot as plt\n'), ((6249, 6278), 'matplotlib.pyplot.bar', 'plt.bar', (['X', 'curOwl'], {'colo... |
# ------------------------------------------------------------------------------------------------ #
def ImportEssentialityData(fileName):
# Not yet ready for prime time
# Import a defined format essentiality data file
# Assumes that data is in the format: locus tag, gene name, essentiality
from .utils import ParseC... | [
"xml.etree.ElementTree.parse",
"numpy.std",
"scipy.intersect1d",
"numpy.mean",
"numpy.array",
"numpy.arange",
"numpy.exp",
"numpy.random.choice",
"pdb.set_trace",
"scipy.unique",
"re.compile"
] | [((3844, 3886), 'xml.etree.ElementTree.parse', 'ET.parse', (['transposonCoordToFeatureDictFile'], {}), '(transposonCoordToFeatureDictFile)\n', (3852, 3886), True, 'import xml.etree.ElementTree as ET\n'), ((4733, 4757), 'scipy.unique', 'unique', (['hittableFeatures'], {}), '(hittableFeatures)\n', (4739, 4757), False, 'f... |
from __future__ import print_function
import minpy.numpy as mp
import numpy as np
import minpy.dispatch.policy as policy
from minpy.core import convert_args, return_numpy, grad_and_loss, grad, minpy_to_numpy as mn, numpy_to_minpy as nm
import time
# mp.set_policy(policy.OnlyNumPyPolicy())
def test_autograd():
@c... | [
"numpy.abs",
"minpy.numpy.sum",
"numpy.random.randn",
"minpy.numpy.max",
"time.time",
"minpy.core.numpy_to_minpy",
"numpy.array",
"minpy.core.grad",
"minpy.numpy.min"
] | [((1681, 1702), 'numpy.random.randn', 'np.random.randn', (['N', 'D'], {}), '(N, D)\n', (1696, 1702), True, 'import numpy as np\n'), ((1711, 1732), 'numpy.random.randn', 'np.random.randn', (['N', 'H'], {}), '(N, H)\n', (1726, 1732), True, 'import numpy as np\n'), ((1742, 1763), 'numpy.random.randn', 'np.random.randn', (... |
import numpy as np
from krikos.nn.layer import BatchNorm, BatchNorm2d, Dropout
class Network(object):
def __init__(self):
super(Network, self).__init__()
self.diff = (BatchNorm, BatchNorm2d, Dropout)
def train(self, input, target):
raise NotImplementedError
def eval(self, input)... | [
"numpy.argmax"
] | [((1717, 1741), 'numpy.argmax', 'np.argmax', (['input'], {'axis': '(1)'}), '(input, axis=1)\n', (1726, 1741), True, 'import numpy as np\n'), ((1463, 1487), 'numpy.argmax', 'np.argmax', (['input'], {'axis': '(1)'}), '(input, axis=1)\n', (1472, 1487), True, 'import numpy as np\n')] |
import cv2
import numpy as np
from matplotlib import pyplot as plt
l: list = []
img = None
img_cp = None
def draw_circle(event, x, y, flags, param):
global l
global img
global img_cp
if event == cv2.EVENT_LBUTTONDOWN:
cv2.circle(img_cp, (x, y), 5, (255, 0, 0), -1)
l.append([x, y])
... | [
"cv2.resize",
"cv2.warpPerspective",
"cv2.circle",
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.float32",
"cv2.getPerspectiveTransform",
"cv2.imread",
"cv2.setMouseCallback",
"cv2.imshow",
"cv2.namedWindow"
] | [((787, 809), 'cv2.imread', 'cv2.imread', (['"""road.jpg"""'], {}), "('road.jpg')\n", (797, 809), False, 'import cv2\n'), ((820, 855), 'cv2.resize', 'cv2.resize', (['img'], {'dsize': '(1000, 1000)'}), '(img, dsize=(1000, 1000))\n', (830, 855), False, 'import cv2\n'), ((866, 940), 'cv2.resize', 'cv2.resize', (['img', '(... |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.patches import FancyBboxPatch
from matplotlib.colors import LinearSegmentedColormap
from mpl_toolkits.basemap import Basemap
import numpy as np
# Suppress matplotlib warnings
np.warnings.filterwarnings('ignore')
import ... | [
"matplotlib.colors.LinearSegmentedColormap",
"matplotlib.pyplot.subplot2grid",
"matplotlib.pyplot.figure",
"numpy.rot90",
"numpy.arange",
"os.path.isfile",
"matplotlib.pyplot.gca",
"os.path.join",
"numpy.round",
"numpy.nanmean",
"netCDF4.Dataset",
"numpy.meshgrid",
"ship_mapper.degrees_to_me... | [((19, 40), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (33, 40), False, 'import matplotlib\n'), ((273, 309), 'numpy.warnings.filterwarnings', 'np.warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (299, 309), True, 'import numpy as np\n'), ((1869, 1893), 'xarray.open_dataset', ... |
import itertools
from collections import OrderedDict
import numpy as np
import cv2
import torch
import torch.nn as nn
from torch.nn import Sequential as Seq, Linear, ReLU
import torch.nn.functional as F
from torch_geometric.data import Data, Batch
from . import base_networks
from . import graph_construction as gc
fr... | [
"torch.ones",
"numpy.ones",
"torch.cat",
"cv2.connectedComponents",
"torch.from_numpy"
] | [((1587, 1642), 'torch.cat', 'torch.cat', (['[encodings[key] for key in encodings]'], {'dim': '(1)'}), '([encodings[key] for key in encodings], dim=1)\n', (1596, 1642), False, 'import torch\n'), ((3169, 3217), 'cv2.connectedComponents', 'cv2.connectedComponents', (['fg_mask'], {'connectivity': '(8)'}), '(fg_mask, conne... |
# -*- coding: utf-8 -*-
"""Console script to generate goals for real_robots"""
import click
import numpy as np
from real_robots.envs import Goal
import gym
import math
basePosition = None
slow = False
render = False
def pairwise_distances(a):
b = a.reshape(a.shape[0], 1, a.shape[1])
return np.sqrt(np.einsu... | [
"matplotlib.pyplot.show",
"numpy.random.seed",
"numpy.random.rand",
"click.option",
"numpy.einsum",
"numpy.zeros",
"click.command",
"numpy.linalg.norm",
"numpy.array",
"numpy.random.permutation",
"numpy.vstack",
"real_robots.envs.Goal",
"numpy.unique"
] | [((13119, 13134), 'click.command', 'click.command', ([], {}), '()\n', (13132, 13134), False, 'import click\n'), ((13136, 13229), 'click.option', 'click.option', (['"""--seed"""'], {'type': 'int', 'help': '"""Generate goals using this SEED for numpy.random"""'}), "('--seed', type=int, help=\n 'Generate goals using th... |
import numpy as np
class Sersic:
def b(self,n):
return 1.9992*n - 0.3271 + 4*(405*n)**-1
def kappa(self,x, y, n_sersic, r_eff, k_eff, q, center_x=0, center_y=0):
bn = self.b(n_sersic)
r = (x**2+y**2*q**-2)**0.5
return k_eff*np.exp(-bn*((r*r_eff**-1)**(n_sersic**-1)-1))
| [
"numpy.exp"
] | [((270, 325), 'numpy.exp', 'np.exp', (['(-bn * ((r * r_eff ** -1) ** n_sersic ** -1 - 1))'], {}), '(-bn * ((r * r_eff ** -1) ** n_sersic ** -1 - 1))\n', (276, 325), True, 'import numpy as np\n')] |
import pandas as pd
import pdb
import requests
import numpy as np
import os, sys
import xarray as xr
from datetime import datetime, timedelta
import logging
from scipy.interpolate import PchipInterpolator
import argparse
from collections import OrderedDict, defaultdict
class PchipOceanSlices(object):
def __init__... | [
"pandas.DataFrame",
"scipy.interpolate.PchipInterpolator",
"logging.debug",
"argparse.ArgumentParser",
"logging.basicConfig",
"logging.warning",
"numpy.floor",
"xarray.open_dataset",
"numpy.isnan",
"collections.defaultdict",
"pandas.to_datetime",
"pdb.set_trace",
"requests.get",
"datetime.... | [((12241, 12337), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.RawTextHelpFormatter'}), '(description=__doc__, formatter_class=argparse.\n RawTextHelpFormatter)\n', (12264, 12337), False, 'import argparse\n'), ((13171, 13260), 'logging.basicConfig... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.widgets import Slider
import cv2 as cv
FILE_NAME = 'res/mountain-and-lake.jpg'
# https://matplotlib.org/3.3.1/gallery/widgets/slider_demo.html
# https://sodocumentation.net/matplotlib/topic/6983/animations-and-... | [
"matplotlib.pyplot.show",
"cv2.cvtColor",
"cv2.calcHist",
"matplotlib.pyplot.axes",
"matplotlib.widgets.Slider",
"numpy.clip",
"cv2.split",
"cv2.samples.findFile",
"cv2.merge",
"matplotlib.pyplot.subplots"
] | [((569, 585), 'cv2.split', 'cv.split', (['imghsv'], {}), '(imghsv)\n', (577, 585), True, 'import cv2 as cv\n'), ((607, 625), 'numpy.clip', 'np.clip', (['s', '(0)', '(255)'], {}), '(s, 0, 255)\n', (614, 625), True, 'import numpy as np\n'), ((634, 653), 'cv2.merge', 'cv.merge', (['[h, s, v]'], {}), '([h, s, v])\n', (642,... |
import numpy as np
from platformx.plat_tensorflow.tools.processor.np_utils import shape_utils, \
anchor_generator_builder, box_list_ops, box_list, box_coder_builder, post_processing_builder, \
visualization_utils as vis_util
from platformx.plat_tensorflow.tools.processor.np_utils import standard_fields as f... | [
"numpy.ones",
"scipy.misc.imsave",
"os.path.join",
"numpy.zeros_like",
"platformx.plat_tensorflow.tools.processor.np_utils.label_map_util.create_category_index",
"platformx.plat_tensorflow.tools.processor.np_utils.label_map_util.load_labelmap",
"numpy.reshape",
"platformx.plat_tensorflow.tools.process... | [((452, 473), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (466, 473), False, 'import matplotlib\n'), ((3544, 3618), 'numpy.array', 'np.array', (['[input_shape[1], input_shape[2], input_shape[3]]'], {'dtype': 'np.int32'}), '([input_shape[1], input_shape[2], input_shape[3]], dtype=np.int32)\n', ... |
# Copyright 2020 <NAME>. All rights reserved
# Created on Tue Feb 11 12:29:35 2020
# Author: <NAME>, Purdue University
#
#
# The original code came with the following disclaimer:
#
# This software is provided "as-is". There are no expressed or implied
# warranties of any kind, including, but not limited to, the warra... | [
"numpy.sum",
"numpy.unique",
"numpy.zeros",
"numpy.argsort",
"numpy.array",
"numpy.concatenate"
] | [((1662, 1679), 'numpy.argsort', 'np.argsort', (['label'], {}), '(label)\n', (1672, 1679), True, 'import numpy as np\n'), ((1771, 1796), 'numpy.zeros', 'np.zeros', (['(H.shape[0], 0)'], {}), '((H.shape[0], 0))\n', (1779, 1796), True, 'import numpy as np\n'), ((1860, 1876), 'numpy.unique', 'np.unique', (['label'], {}), ... |
import numpy as np
import tensorflow as tf
import tensorflow.contrib.distributions as tfd
from integrators import ODERK4, SDEEM
from kernels import OperatorKernel
from gpflow import transforms
from param import Param
float_type = tf.float64
jitter0 = 1e-6
class NPODE:
def __init__(self,Z0,U0,sn0,kern,jitter=jit... | [
"gpflow.transforms.Log1pe",
"kernels.OperatorKernel",
"numpy.asarray",
"tensorflow.reshape",
"integrators.SDEEM",
"tensorflow.eye",
"tensorflow.zeros_like",
"tensorflow.cholesky",
"tensorflow.transpose",
"tensorflow.matmul",
"tensorflow.shape",
"numpy.array",
"tensorflow.squeeze",
"tensorf... | [((2065, 2077), 'integrators.ODERK4', 'ODERK4', (['self'], {}), '(self)\n', (2071, 2077), False, 'from integrators import ODERK4, SDEEM\n'), ((2893, 2909), 'tensorflow.cholesky', 'tf.cholesky', (['Kzz'], {}), '(Kzz)\n', (2904, 2909), True, 'import tensorflow as tf\n'), ((2951, 2998), 'tensorflow.matrix_triangular_solve... |
"""
Some methods for kenetics.s
"""
import carla
import numpy as np
import math
def get_speed(vehicle):
"""
Get speed consider only 2D velocity.
"""
vel = vehicle.get_velocity()
return math.sqrt(vel.x ** 2 + vel.y ** 2) # + vel.z ** 2)
def set_vehicle_speed(vehicle, speed: float):
"""
... | [
"math.sqrt",
"numpy.array",
"numpy.sign",
"numpy.squeeze",
"numpy.dot",
"carla.Vector3D"
] | [((211, 245), 'math.sqrt', 'math.sqrt', (['(vel.x ** 2 + vel.y ** 2)'], {}), '(vel.x ** 2 + vel.y ** 2)\n', (220, 245), False, 'import math\n'), ((718, 751), 'numpy.array', 'np.array', (['[[speed], [0.0], [0.0]]'], {}), '([[speed], [0.0], [0.0]])\n', (726, 751), True, 'import numpy as np\n'), ((822, 854), 'numpy.dot', ... |
import numpy as np
from fluiddyn.clusters.legi import Calcul2 as Cluster
from critical_Ra_RB import Ra_c_RB as Ra_c_RB_tests
prandtl = 1.0
dim = 2
dt_max = 0.005
end_time = 30
nb_procs = 10
nx = 8
order = 10
stretch_factor = 0.0
Ra_vert = 1750
x_periodicity = False
z_periodicity = False
cluster = Cluster()
clu... | [
"fluiddyn.clusters.legi.Calcul2",
"numpy.log10",
"critical_Ra_RB.Ra_c_RB.items"
] | [((306, 315), 'fluiddyn.clusters.legi.Calcul2', 'Cluster', ([], {}), '()\n', (313, 315), True, 'from fluiddyn.clusters.legi import Calcul2 as Cluster\n'), ((718, 739), 'critical_Ra_RB.Ra_c_RB.items', 'Ra_c_RB_tests.items', ([], {}), '()\n', (737, 739), True, 'from critical_Ra_RB import Ra_c_RB as Ra_c_RB_tests\n'), ((8... |
#!/usr/bin/env python
import os
import sys
import numpy as np
import matplotlib
if matplotlib.get_backend() != "TKAgg":
matplotlib.use("TKAgg")
import pandas as pd
from matplotlib import pyplot as plt
import pmagpy.pmag as pmag
import pmagpy.pmagplotlib as pmagplotlib
from pmag_env import set_env
import operator
... | [
"matplotlib.pyplot.title",
"pandas.read_csv",
"pmagpy.pmag.fshdev",
"matplotlib.pyplot.figure",
"matplotlib.get_backend",
"pmagpy.pmagplotlib.plot_init",
"matplotlib.pyplot.axvline",
"pmagpy.pmag.pseudo",
"pmagpy.pmag.get_dictitem",
"pmagpy.pmagplotlib.draw_figs",
"pmagpy.pmag.dotilt_V",
"pmag... | [((83, 107), 'matplotlib.get_backend', 'matplotlib.get_backend', ([], {}), '()\n', (105, 107), False, 'import matplotlib\n'), ((124, 147), 'matplotlib.use', 'matplotlib.use', (['"""TKAgg"""'], {}), "('TKAgg')\n", (138, 147), False, 'import matplotlib\n'), ((2632, 2662), 'pmagpy.pmag.get_named_arg', 'pmag.get_named_arg'... |
# coding=utf-8
import numpy as np
import reikna.cluda as cluda
from reikna.fft import FFT, FFTShift
import pyopencl.array as clarray
from pyopencl import clmath
from reikna.core import Computation, Transformation, Parameter, Annotation, Type
from reikna.algorithms import PureParallel
from matplotlib import cm
... | [
"numpy.load",
"numpy.set_printoptions",
"statistic_functions4.logg10",
"matplotlib.pyplot.clf",
"reikna.fft.FFTShift",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.ylim",
"time.clock",
"statistic_functions4.stat",
"matplotlib.pyplot.figure",
"numpy.reshape",
"reikna.cluda.any_api",
"reikna... | [((430, 467), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (449, 467), True, 'import numpy as np\n'), ((500, 515), 'reikna.cluda.any_api', 'cluda.any_api', ([], {}), '()\n', (513, 515), True, 'import reikna.cluda as cluda\n'), ((555, 579), 'numpy.load', 'np.loa... |
import os
import argparse
import numpy as np
import tensorflow as tf
import tensorflow.keras as K
from sklearn.metrics import classification_report
from dataset import FLIRDataset
def grid_search(train_labels: str,
test_labels: str,
output:str,
res:tuple=(120, 160)... | [
"argparse.ArgumentParser",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.applications.resnet_v2.ResNet50V2",
"dataset.FLIRDataset",
"tensorflow.keras.Model",
"tensorflow.keras.layers.Input",
"os.path.join",
"numpy.concatenate",
"tensorflow.keras.layers.Flatten"
] | [((1006, 1063), 'dataset.FLIRDataset', 'FLIRDataset', (['train_labels'], {'res': 'res', 'batch_size': 'batch_size'}), '(train_labels, res=res, batch_size=batch_size)\n', (1017, 1063), False, 'from dataset import FLIRDataset\n'), ((1075, 1131), 'dataset.FLIRDataset', 'FLIRDataset', (['test_labels'], {'res': 'res', 'batc... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 4 09:33:16 2020
@author: jvergere
Ideas: Something similar to the Iridium Constellation:
66 Sats
781 km (7159 semimajor axis)
86.4 inclination
6 Orbit planes 30 degrees apart
11 in each plane
"""
import datetime as dt
import numpy as np
import os
#N... | [
"os.remove",
"numpy.argmax",
"os.path.exists",
"numpy.amax",
"datetime.datetime.strptime",
"comtypes.client.CreateObject"
] | [((433, 468), 'os.path.exists', 'os.path.exists', (['"""MaxOutageData.txt"""'], {}), "('MaxOutageData.txt')\n", (447, 468), False, 'import os\n'), ((763, 796), 'comtypes.client.CreateObject', 'CreateObject', (['"""STK12.Application"""'], {}), "('STK12.Application')\n", (775, 796), False, 'from comtypes.client import Cr... |
# -*- coding: utf-8 -*-
"""
test_parameter
~~~~~~~~~~~~~~~
Tests for `gagepy.parameter` class
:copyright: 2015 by <NAME>, see AUTHORS
:license: United States Geological Survey (USGS), see LICENSE file
"""
import pytest
import os
import numpy as np
from datetime import datetime
from gagepy.parame... | [
"numpy.array",
"datetime.datetime"
] | [((2211, 2237), 'datetime.datetime', 'datetime', (['(2015)', '(8)', '(5)', '(0)', '(0)'], {}), '(2015, 8, 5, 0, 0)\n', (2219, 2237), False, 'from datetime import datetime\n'), ((2271, 2297), 'datetime.datetime', 'datetime', (['(2015)', '(8)', '(1)', '(0)', '(0)'], {}), '(2015, 8, 1, 0, 0)\n', (2279, 2297), False, 'from... |
# -*- coding: utf-8 -*-
# @Time : 2020/2/12 15:47
# @Author : Chen
# @File : datasets.py
# @Software: PyCharm
import os, warnings
from mxnet.gluon.data import dataset, sampler
from mxnet import image
import numpy as np
class IdxSampler(sampler.Sampler):
"""Samples elements from [0, length) randomly without ... | [
"os.path.join",
"os.path.isdir",
"numpy.array",
"mxnet.image.imread",
"os.path.splitext",
"warnings.warn",
"os.path.expanduser",
"os.listdir",
"numpy.random.shuffle"
] | [((741, 767), 'numpy.random.shuffle', 'np.random.shuffle', (['indices'], {}), '(indices)\n', (758, 767), True, 'import numpy as np\n'), ((1879, 1903), 'os.path.expanduser', 'os.path.expanduser', (['root'], {}), '(root)\n', (1897, 1903), False, 'import os, warnings\n'), ((2991, 3035), 'mxnet.image.imread', 'image.imread... |
#!/usr/bin/env python
import copy
import glob
import logging
import os
import re
import numpy as np
from astropy.io import fits
from scipy import interpolate, ndimage, optimize, signal
try:
from charis.image import Image
except:
from image import Image
log = logging.getLogger('main')
class PSFLets:
""... | [
"numpy.arctan2",
"numpy.sum",
"numpy.amin",
"astropy.io.fits.PrimaryHDU",
"numpy.ones",
"numpy.sin",
"numpy.arange",
"numpy.exp",
"scipy.optimize.minimize",
"numpy.meshgrid",
"scipy.signal.convolve2d",
"numpy.isfinite",
"numpy.linspace",
"scipy.ndimage.interpolation.spline_filter",
"re.s... | [((271, 296), 'logging.getLogger', 'logging.getLogger', (['"""main"""'], {}), "('main')\n", (288, 296), False, 'import logging\n'), ((12613, 12634), 'numpy.arctan2', 'np.arctan2', (['(1.926)', '(-1)'], {}), '(1.926, -1)\n', (12623, 12634), True, 'import numpy as np\n'), ((13936, 13947), 'numpy.zeros', 'np.zeros', (['n'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Demo showing how km_dict and insegtannotator may be used together for
interactive segmentation.
@author: vand and abda
"""
import sys
import insegtannotator
import skimage.io
import skimage.data
import km_dict
import numpy as np
#%% EXAMPLE 1: glass fibres
## load... | [
"km_dict.build_km_tree",
"numpy.argmax",
"numpy.zeros",
"km_dict.dictprob_to_improb",
"km_dict.search_km_tree",
"numpy.max",
"insegtannotator.PyQt5.QtWidgets.QApplication",
"km_dict.improb_to_dictprob",
"sys.exit",
"insegtannotator.InSegtAnnotator"
] | [((753, 876), 'km_dict.build_km_tree', 'km_dict.build_km_tree', (['image_float', 'patch_size', 'branching_factor', 'number_training_patches', 'number_layers', 'normalization'], {}), '(image_float, patch_size, branching_factor,\n number_training_patches, number_layers, normalization)\n', (774, 876), False, 'import km... |
import argparse
import numpy as np
import matplotlib.pyplot as plt
from FAUSTPy import *
#######################################################
# set up command line arguments
#######################################################
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--faustfloat',
... | [
"numpy.absolute",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"numpy.fft.fft",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.linspace",
"numpy.log10"
] | [((244, 269), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (267, 269), False, 'import argparse\n'), ((1627, 1693), 'numpy.zeros', 'np.zeros', (['(dattorro.dsp.num_in, args.fs)'], {'dtype': 'dattorro.dsp.dtype'}), '((dattorro.dsp.num_in, args.fs), dtype=dattorro.dsp.dtype)\n', (1635, 1693), Tr... |
import numpy as np
from numpy import linalg as LA
class LDA():
def __init__(self, dim = 2):
self.dim = dim
self.matrixTransf = None
def fit_transform(self, X, labels):
positive = []
negative = []
for i in range(len(labels)):
if labels[i] == 1:
... | [
"numpy.mean",
"numpy.array",
"numpy.matmul",
"numpy.cov",
"numpy.linalg.pinv"
] | [((441, 459), 'numpy.array', 'np.array', (['positive'], {}), '(positive)\n', (449, 459), True, 'import numpy as np\n'), ((479, 497), 'numpy.array', 'np.array', (['negative'], {}), '(negative)\n', (487, 497), True, 'import numpy as np\n'), ((527, 552), 'numpy.mean', 'np.mean', (['positive'], {'axis': '(0)'}), '(positive... |
import tensorflow as tf
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from PIL import Image
import Network
import dataset
from Network import BATCH_SIZE
from dataset import DataSet
def output_predict(depths, images, depths_discretized, depths_reconstructed, output_dir):
... | [
"numpy.load",
"tensorflow.gfile.Exists",
"numpy.argmax",
"tensorflow.logging.warning",
"dataset.DataSet.filename_to_input_image",
"tensorflow.logging.set_verbosity",
"tensorflow.ConfigProto",
"matplotlib.pyplot.figure",
"numpy.exp",
"tensorflow.nn.softmax",
"tensorflow.data.TextLineDataset",
"... | [((61, 82), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (75, 82), False, 'import matplotlib\n'), ((2575, 2644), 'tensorflow.nn.softmax_cross_entropy_with_logits', 'tf.nn.softmax_cross_entropy_with_logits', ([], {'labels': 'labels', 'logits': 'logits'}), '(labels=labels, logits=logits)\n', (261... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.