code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# -*- coding: UTF-8 -*- import cv2 import matplotlib.pyplot as plt import numpy as np class PROIE(): def __init__(self): ##### pass # PRIVATE METHODS def _threshold(self): ##### self.blur_img = cv2.GaussianBlur(self.in_img_g, (5, 5), 0) _, self.thresh_img = cv2....
[ "matplotlib.pyplot.title", "cv2.GaussianBlur", "numpy.fft.rfft", "numpy.arctan2", "numpy.argsort", "cv2.warpAffine", "matplotlib.pyplot.figure", "cv2.rectangle", "cv2.getRotationMatrix2D", "numpy.fft.irfft", "cv2.cvtColor", "cv2.imwrite", "matplotlib.pyplot.imshow", "cv2.drawContours", "...
[((244, 286), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['self.in_img_g', '(5, 5)', '(0)'], {}), '(self.in_img_g, (5, 5), 0)\n', (260, 286), False, 'import cv2\n'), ((316, 389), 'cv2.threshold', 'cv2.threshold', (['self.blur_img', '(0)', '(255)', '(cv2.THRESH_BINARY + cv2.THRESH_OTSU)'], {}), '(self.blur_img, 0, 255, cv...
import numpy as np from pandas.testing import assert_frame_equal import warnings from hdmf.backends.hdf5 import HDF5IO from hdmf.common import DynamicTable, VectorData, get_manager, AlignedDynamicTable from hdmf.testing import TestCase, remove_test_file class TestAlignedDynamicTableContainer(TestCase): """ T...
[ "pandas.testing.assert_frame_equal", "warnings.simplefilter", "hdmf.common.VectorData", "numpy.asarray", "hdmf.common.DynamicTable", "hdmf.common.AlignedDynamicTable", "numpy.arange", "hdmf.common.get_manager", "hdmf.testing.remove_test_file" ]
[((402, 433), 'warnings.simplefilter', 'warnings.simplefilter', (['"""always"""'], {}), "('always')\n", (423, 433), False, 'import warnings\n'), ((557, 584), 'hdmf.testing.remove_test_file', 'remove_test_file', (['self.path'], {}), '(self.path)\n', (573, 584), False, 'from hdmf.testing import TestCase, remove_test_file...
# importing necessary packages import pandas as pd import numpy as np from sklearn.preprocessing import LabelEncoder from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, confusion_matrix from sklearn.externals import joblib from sklearn.preprocessing import StandardScaler import os imp...
[ "os.makedirs", "argparse.ArgumentParser", "os.path.exists", "sklearn.externals.joblib.load", "numpy.delete", "numpy.unique" ]
[((368, 393), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (391, 393), False, 'import argparse\n'), ((1522, 1546), 'sklearn.externals.joblib.load', 'joblib.load', (['file_scalar'], {}), '(file_scalar)\n', (1533, 1546), False, 'from sklearn.externals import joblib\n'), ((1552, 1577), 'sklearn....
import scipy as sp import scipy.optimize from . import legops import tensorflow as tf import numpy as np import numpy.random as npr from . import constructions def fit_model_family(ts,xs,model_family,p_init,maxiter=100,use_tqdm_notebook=False): ''' Fits a custom LEG model Input: - ts: list of timesta...
[ "numpy.sum", "numpy.random.randn", "tensorflow.gather_nd", "tensorflow.convert_to_tensor", "tensorflow.reshape", "tensorflow.concat", "numpy.ones", "tensorflow.transpose", "numpy.where", "tensorflow.GradientTape", "numpy.tile", "tensorflow.function", "numpy.eye", "tensorflow.scatter_nd", ...
[((5309, 5337), 'tensorflow.function', 'tf.function', ([], {'autograph': '(False)'}), '(autograph=False)\n', (5320, 5337), True, 'import tensorflow as tf\n'), ((5665, 5693), 'tensorflow.function', 'tf.function', ([], {'autograph': '(False)'}), '(autograph=False)\n', (5676, 5693), True, 'import tensorflow as tf\n'), ((1...
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the ...
[ "vega.core.common.class_factory.ClassFactory.register", "copy.deepcopy", "numpy.asarray" ]
[((646, 684), 'vega.core.common.class_factory.ClassFactory.register', 'ClassFactory.register', (['ClassType.CODEC'], {}), '(ClassType.CODEC)\n', (667, 684), False, 'from vega.core.common.class_factory import ClassType, ClassFactory\n'), ((3053, 3080), 'copy.deepcopy', 'deepcopy', (['self.search_space'], {}), '(self.sea...
from __future__ import absolute_import, division, print_function import torch import warnings from tqdm import tqdm import pathlib from scipy import linalg import tensorflow as tf import numpy as np import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' def check_or_download_inception(inception_path): ''' Checks if t...
[ "numpy.trace", "numpy.load", "numpy.abs", "argparse.ArgumentParser", "numpy.empty", "pathlib.Path", "numpy.mean", "torchvision.transforms.Normalize", "os.path.join", "numpy.atleast_2d", "numpy.eye", "os.path.exists", "tensorflow.TensorShape", "numpy.isfinite", "torchvision.transforms.ToT...
[((600, 628), 'pathlib.Path', 'pathlib.Path', (['inception_path'], {}), '(inception_path)\n', (612, 628), False, 'import pathlib\n'), ((2414, 2434), 'numpy.mean', 'np.mean', (['act'], {'axis': '(0)'}), '(act, axis=0)\n', (2421, 2434), True, 'import numpy as np\n'), ((2447, 2472), 'numpy.cov', 'np.cov', (['act'], {'rowv...
import ast import json import pickle import ujson import collections import numpy as np from chord_labels import parse_chord from progressbar import ProgressBar, Bar, Percentage, AdaptiveETA, Counter print("Opening files") with open('dataset_chords.json', 'r') as values: formatted_chords = ujson.load(values) wit...
[ "ast.literal_eval", "progressbar.Counter", "ujson.dump", "ujson.load", "progressbar.Bar", "progressbar.Percentage", "progressbar.AdaptiveETA", "pickle.load", "numpy.array", "collections.OrderedDict" ]
[((576, 601), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (599, 601), False, 'import collections\n'), ((4438, 4454), 'numpy.array', 'np.array', (['hold_x'], {}), '(hold_x)\n', (4446, 4454), True, 'import numpy as np\n'), ((4467, 4483), 'numpy.array', 'np.array', (['hold_y'], {}), '(hold_y)\n...
# -*- coding: utf-8 -*- from layers.dynamic_rnn import DynamicLSTM from layers.shap import Distribution_SHAP, Map_SHAP import torch import torch.nn as nn import numpy as np class SHAP_LSTM(nn.Module): def __init__(self, embedding_matrix, opt): super(SHAP_LSTM, self).__init__() self.opt = opt ...
[ "layers.shap.Distribution_SHAP", "torch.sum", "layers.dynamic_rnn.DynamicLSTM", "numpy.where", "torch.nn.Linear", "layers.shap.Map_SHAP", "torch.tensor" ]
[((489, 563), 'layers.dynamic_rnn.DynamicLSTM', 'DynamicLSTM', (['opt.embed_dim', 'opt.hidden_dim'], {'num_layers': '(1)', 'batch_first': '(True)'}), '(opt.embed_dim, opt.hidden_dim, num_layers=1, batch_first=True)\n', (500, 563), False, 'from layers.dynamic_rnn import DynamicLSTM\n'), ((584, 653), 'layers.shap.Distrib...
import cv2 import numpy as np from scipy.ndimage.morphology import distance_transform_cdt import torch from skimage.io import imsave device = torch.device("cuda" if torch.cuda.is_available() else "cpu") def get_edge_mask(poly, mask): """ Generate edge mask """ h = mask.shape[0] w = mask.shape[1] ...
[ "scipy.ndimage.morphology.distance_transform_cdt", "numpy.sum", "numpy.asarray", "numpy.floor", "numpy.zeros", "numpy.clip", "numpy.append", "numpy.array", "torch.cuda.is_available", "numpy.int32", "numpy.reshape", "torch.zeros", "numpy.concatenate" ]
[((333, 383), 'numpy.zeros', 'np.zeros', (['(poly.shape[0], poly.shape[1])', 'np.int32'], {}), '((poly.shape[0], poly.shape[1]), np.int32)\n', (341, 383), True, 'import numpy as np\n'), ((401, 425), 'numpy.floor', 'np.floor', (['(poly[:, 0] * w)'], {}), '(poly[:, 0] * w)\n', (409, 425), True, 'import numpy as np\n'), (...
import numpy as np import torch from utils import plotsAnalysis import os from utils.helper_functions import load_flags def auto_swipe(mother_dir=None): """ This function swipes the parameter space of a folder and extract the varying hyper-parameters and make 2d heatmap w.r.t. all combinations of them """...
[ "utils.helper_functions.load_flags", "os.path.isdir", "utils.plotsAnalysis.HeatMapBVL", "os.path.join", "os.listdir", "numpy.unique" ]
[((1134, 1156), 'os.listdir', 'os.listdir', (['mother_dir'], {}), '(mother_dir)\n', (1144, 1156), False, 'import os\n'), ((1216, 1248), 'os.path.join', 'os.path.join', (['mother_dir', 'folder'], {}), '(mother_dir, folder)\n', (1228, 1248), False, 'import os\n'), ((1538, 1560), 'utils.helper_functions.load_flags', 'load...
#!/usr/bin/env python # Copyright 2019 <NAME> # # This file is part of RfPy. # # 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 # ...
[ "numpy.abs", "rfpy.arguments.get_ccp_arguments", "numpy.median", "rfpy.CCPimage", "pathlib.Path", "pickle.load", "obspy.core.Stream", "numpy.array", "numpy.var", "stdb.io.load_db" ]
[((1987, 2016), 'rfpy.arguments.get_ccp_arguments', 'arguments.get_ccp_arguments', ([], {}), '()\n', (2014, 2016), False, 'from rfpy import arguments, binning, plotting\n'), ((2047, 2079), 'stdb.io.load_db', 'stdb.io.load_db', ([], {'fname': 'args.indb'}), '(fname=args.indb)\n', (2062, 2079), False, 'import stdb\n'), (...
import pandas as pd import numpy as np from sklearn.metrics.pairwise import euclidean_distances, cosine_similarity, manhattan_distances def top_5(book, items, similarity_measure): """ This function extracts the top-five similar books for a given book and similarity measure. This function takes t...
[ "numpy.isin", "sklearn.metrics.pairwise.cosine_similarity", "sklearn.metrics.pairwise.manhattan_distances", "sklearn.metrics.pairwise.euclidean_distances", "numpy.argsort", "pandas.concat" ]
[((2284, 2315), 'sklearn.metrics.pairwise.euclidean_distances', 'euclidean_distances', (['items_temp'], {}), '(items_temp)\n', (2303, 2315), False, 'from sklearn.metrics.pairwise import euclidean_distances, cosine_similarity, manhattan_distances\n'), ((3588, 3631), 'numpy.isin', 'np.isin', (["items['itemID']", 'book_to...
# coding: utf8 # Copyright (c) <NAME>, University of Antwerp # Distributed under the terms of the MIT License import os import numpy as np from fireworks import Firework, LaunchPad, PyTask, Workflow from pymongo.errors import ServerSelectionTimeoutError from ruamel.yaml import YAML from pybat.cli.commands.define imp...
[ "numpy.sum", "fireworks.Workflow", "os.walk", "numpy.linalg.norm", "os.path.join", "os.path.abspath", "pybat.core.LiRichCathode.from_file", "os.path.exists", "ruamel.yaml.YAML", "pybat.cli.commands.setup.transition", "pybat.workflow.fireworks.RelaxFirework", "pybat.workflow.fireworks.NebFirewo...
[((1002, 1029), 'os.path.exists', 'os.path.exists', (['CONFIG_FILE'], {}), '(CONFIG_FILE)\n', (1016, 1029), False, 'import os\n'), ((948, 971), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (966, 971), False, 'import os\n'), ((4347, 4523), 'pybat.workflow.fireworks.ScfFirework', 'ScfFirework...
# -*- coding: utf-8 -*- """ .. invisible: _ _ _____ _ _____ _____ | | | | ___| | | ___/ ___| | | | | |__ | | | |__ \ `--. | | | | __|| | | __| `--. \ \ \_/ / |___| |___| |___/\__/ / \___/\____/\_____|____/\____/ Created on Jan 25, 2015 Loaders which get data from pickles ██...
[ "zope.interface.implementer", "veles.compat.from_none", "veles.error.BadFormatError", "numpy.array", "veles.loader.fullbatch_image.FullBatchImageLoader.load_data", "pickle.load", "veles.memory.interleave" ]
[((1713, 1742), 'zope.interface.implementer', 'implementer', (['IFullBatchLoader'], {}), '(IFullBatchLoader)\n', (1724, 1742), False, 'from zope.interface import implementer\n'), ((5966, 5991), 'zope.interface.implementer', 'implementer', (['IImageLoader'], {}), '(IImageLoader)\n', (5977, 5991), False, 'from zope.inter...
''' Unittests for pysal.model.spreg.error_sp_hom module ''' import unittest import pysal.lib from pysal.model.spreg import error_sp_hom as HOM import numpy as np from pysal.lib.common import RTOL import pysal.model.spreg class BaseGM_Error_Hom_Tester(unittest.TestCase): def setUp(self): db=pysal.lib.io.op...
[ "unittest.TextTestRunner", "unittest.TestSuite", "pysal.model.spreg.error_sp_hom.GM_Combo_Hom", "pysal.model.spreg.error_sp_hom.BaseGM_Error_Hom", "pysal.model.spreg.error_sp_hom.GM_Endog_Error_Hom", "pysal.model.spreg.error_sp_hom.BaseGM_Combo_Hom", "numpy.ones", "numpy.array", "numpy.reshape", "...
[((17068, 17088), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (17086, 17088), False, 'import unittest\n'), ((17414, 17439), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (17437, 17439), False, 'import unittest\n'), ((430, 452), 'numpy.reshape', 'np.reshape', (['y', '(49, 1)']...
''' The code is partially borrowed from: https://github.com/v-iashin/video_features/blob/861efaa4ed67/utils/utils.py and https://github.com/PeihaoChen/regnet/blob/199609/extract_audio_and_video.py ''' import os import shutil import subprocess from glob import glob from pathlib import Path from typing import Dict impor...
[ "os.remove", "train.instantiate_from_config", "omegaconf.omegaconf.OmegaConf.load", "torch.cat", "pathlib.Path", "numpy.tile", "feature_extraction.extract_mel_spectrogram.get_spectrogram", "torchvision.transforms.Normalize", "torch.no_grad", "os.path.join", "sample_visualization.load_vocoder", ...
[((1139, 1229), 'subprocess.run', 'subprocess.run', (["['which', 'ffmpeg']"], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT'}), "(['which', 'ffmpeg'], stdout=subprocess.PIPE, stderr=\n subprocess.STDOUT)\n", (1153, 1229), False, 'import subprocess\n'), ((1459, 1550), 'subprocess.run', 'subprocess.run', ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Author: <NAME> Description: This PySPark scripts maps geolocated mobility data for valid users to specific land use type where the activity occured and counts number of unique users within each land use type aggregated to 250m x 250m neighborhoods in New York City. "...
[ "math.sqrt", "math.radians", "pyspark.sql.functions.lit", "math.sin", "numpy.mean", "pyspark.sql.functions.col", "math.cos", "pyspark.sql.session.SparkSession.builder.getOrCreate", "pyspark.sql.functions.countDistinct" ]
[((610, 644), 'pyspark.sql.session.SparkSession.builder.getOrCreate', 'SparkSession.builder.getOrCreate', ([], {}), '()\n', (642, 644), False, 'from pyspark.sql.session import SparkSession\n'), ((736, 747), 'math.radians', 'radians', (['y1'], {}), '(y1)\n', (743, 747), False, 'from math import sin, cos, sqrt, atan2, ra...
import os import random import argparse import numpy as np from PIL import Image, ImageDraw, ImageFont def make_blank_placeholder(image_file, out_file): #print(out_file) image = np.asarray(Image.open(image_file)) blank = np.ones(image.shape)*255 blank = blank.astype(np.uint8) #print(blank.shape) im = Ima...
[ "argparse.ArgumentParser", "random.randint", "os.walk", "numpy.ones", "PIL.Image.open", "PIL.ImageFont.truetype", "PIL.Image.fromarray", "PIL.ImageDraw.Draw", "os.path.join" ]
[((317, 339), 'PIL.Image.fromarray', 'Image.fromarray', (['blank'], {}), '(blank)\n', (332, 339), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((349, 367), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['im'], {}), '(im)\n', (363, 367), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((483, 538), 'PIL.I...
import pickle import logging import hashlib import numpy as np import os from pathlib import Path import spacy import shutil import sys import tarfile import tempfile import torch from typing import Dict, List sys.path.append("nbsvm") from nltk import word_tokenize from nltk.stem import WordNetLemmatizer from nltk.ste...
[ "flask.jsonify", "pathlib.Path", "pickle.load", "shutil.rmtree", "torch.no_grad", "allennlp.data.Vocabulary.from_files", "flask.request.get_json", "nltk.word_tokenize", "sys.path.append", "nltk.stem.WordNetLemmatizer", "spacy.load", "tempfile.mkdtemp", "flask.render_template", "tarfile.ope...
[((210, 234), 'sys.path.append', 'sys.path.append', (['"""nbsvm"""'], {}), "('nbsvm')\n", (225, 234), False, 'import sys\n'), ((670, 709), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (689, 709), False, 'import logging\n'), ((721, 747), 'nltk.stem.snowball.Sno...
import numpy as np import matplotlib.pyplot as plt # 计算delta def calculate_delta(t, chosen_count, item): if chosen_count[item] == 0: return 1 else: return np.sqrt(2 * np.log(t) / chosen_count[item]) def choose_arm(upper_bound_probs): max = np.max(upper_bound_probs) idx = np.where(upp...
[ "numpy.random.uniform", "numpy.size", "numpy.random.seed", "numpy.random.binomial", "matplotlib.pyplot.plot", "numpy.argmax", "numpy.log", "numpy.zeros", "numpy.max", "numpy.where", "numpy.array", "numpy.random.choice", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib....
[((272, 297), 'numpy.max', 'np.max', (['upper_bound_probs'], {}), '(upper_bound_probs)\n', (278, 297), True, 'import numpy as np\n'), ((308, 342), 'numpy.where', 'np.where', (['(upper_bound_probs == max)'], {}), '(upper_bound_probs == max)\n', (316, 342), True, 'import numpy as np\n'), ((375, 391), 'numpy.array', 'np.a...
""" =============================================== Repair EEG artefacts caused by ocular movements =============================================== Identify "bad" components in ICA solution (e.g., components which are highly correlated the time course of the electrooculogram). Authors: <NAME> <<EMAIL>> License: BSD ...
[ "mne.io.read_raw_fif", "mne.events_from_annotations", "config.parser.parse_args", "mne.preprocessing.read_ica", "matplotlib.pyplot.close", "mne.preprocessing.corrmap", "mne.Epochs", "config.fname.report", "config.fname.output", "numpy.unique" ]
[((659, 678), 'config.parser.parse_args', 'parser.parse_args', ([], {}), '()\n', (676, 678), False, 'from config import fname, parser, LoggingFormat\n'), ((1002, 1088), 'config.fname.output', 'fname.output', ([], {'subject': 'subject', 'processing_step': '"""repair_bads"""', 'file_type': '"""raw.fif"""'}), "(subject=su...
# Copyright 2021 the Ithaca 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
[ "absl.logging.info", "jaxline.utils.double_buffer_on_gpu", "glob.glob", "os.path.join", "ithaca.util.loss.cross_entropy_loss", "jax.process_index", "jax.random.uniform", "jax.jit", "jax.numpy.mean", "jax.local_device_count", "ithaca.models.model.Model", "optax.apply_updates", "absl.flags.mar...
[((24646, 24683), 'absl.flags.mark_flag_as_required', 'flags.mark_flag_as_required', (['"""config"""'], {}), "('config')\n", (24673, 24683), False, 'from absl import flags\n'), ((2222, 2265), 'jaxline.utils.bcast_local_devices', 'jl_utils.bcast_local_devices', (['self.init_rng'], {}), '(self.init_rng)\n', (2250, 2265),...
""" Dataloaders for CUB200-2011, CARS196 and Stanford Online Products. """ """===================================================================================================""" ################### LIBRARIES ################### import warnings warnings.filterwarnings("ignore") import numpy as np, os, sys, pandas a...
[ "copy.deepcopy", "torch.utils.data.DataLoader", "warnings.filterwarnings", "torchvision.transforms.RandomHorizontalFlip", "torchvision.transforms.RandomResizedCrop", "PIL.Image.open", "torchvision.transforms.Compose", "numpy.array", "pandas.read_table", "torchvision.transforms.CenterCrop", "torc...
[((248, 281), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (271, 281), False, 'import warnings\n'), ((8460, 8550), 'pandas.read_table', 'pd.read_table', (["(opt.source_path + '/Info_Files/Ebay_train.txt')"], {'header': '(0)', 'delimiter': '""" """'}), "(opt.source_path +...
#!/usr/bin/env python #------------------------------------------------------------ # Purpose: Program finds best-fit pararameters of a model # a*sin(bx+c) with data with errors in both variables # x and y. It uses the effective variance method for # kmpfit and the results are compared with S...
[ "kapteyn.kmpfit.Fitter", "scipy.odr.ODR", "matplotlib.pyplot.show", "scipy.odr.Model", "scipy.odr.RealData", "matplotlib.pyplot.figure", "numpy.where", "numpy.sin", "matplotlib.pyplot.rc", "numpy.random.normal", "numpy.linspace", "numpy.cos" ]
[((1276, 1302), 'numpy.linspace', 'numpy.linspace', (['(-3)', '(7.0)', 'N'], {}), '(-3, 7.0, N)\n', (1290, 1302), False, 'import numpy\n'), ((1356, 1375), 'numpy.random.normal', 'normal', (['(0.1)', '(0.2)', 'N'], {}), '(0.1, 0.2, N)\n', (1362, 1375), False, 'from numpy.random import normal\n'), ((1384, 1403), 'numpy.r...
#-*- coding:utf-8 -*- """ Main class that provides SPC analysis. It detects SPC rules violations. It can draw charts using matplotlib. :arguments: data user data as flat array/list """ from utils import * import numpy as np import pandas as pd RULE_1_BEYOND_3SIGMA = '1个点落在A区以外' RULE_2_OF_3_BEYOND_2S...
[ "numpy.std", "numpy.mean" ]
[((2792, 2805), 'numpy.mean', 'np.mean', (['data'], {}), '(data)\n', (2799, 2805), True, 'import numpy as np\n'), ((2882, 2902), 'numpy.std', 'np.std', (['data'], {'ddof': '(1)'}), '(data, ddof=1)\n', (2888, 2902), True, 'import numpy as np\n')]
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/12/21 2:30 PM # @Author : zhangzhen # @Site : # @File : __init__.py # @Software: PyCharm import tensorflow as tf from numpy.random import RandomState as rdm import logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', leve...
[ "logging.basicConfig", "tensorflow.clip_by_value", "tensorflow.global_variables_initializer", "tensorflow.Session", "numpy.random.RandomState", "tensorflow.constant", "tensorflow.placeholder", "tensorflow.matmul", "tensorflow.random_normal", "tensorflow.train.AdamOptimizer" ]
[((244, 340), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.DEBUG'}), "(format='%(asctime)s : %(levelname)s : %(message)s',\n level=logging.DEBUG)\n", (263, 340), False, 'import logging\n'), ((1214, 1285), 'tensorflow.placeholder', ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 5 23:54:49 2018 @author: tyler """ import numpy as np #%% def postprocess_cut(supernodes_original,supernodes_f,supernode_nonempty_Q,not_loop_Q): ''' returns : partition of original vertices of $G$ and size of coresponding cut '''...
[ "numpy.load", "numpy.copy", "numpy.shape", "numpy.cumsum", "numpy.any", "numpy.random.randint", "numpy.where" ]
[((2949, 2970), 'numpy.load', 'np.load', (['"""b0_pre.npz"""'], {}), "('b0_pre.npz')\n", (2956, 2970), True, 'import numpy as np\n'), ((3117, 3137), 'numpy.copy', 'np.copy', (['supernodes_'], {}), '(supernodes_)\n', (3124, 3137), True, 'import numpy as np\n'), ((3138, 3168), 'numpy.copy', 'np.copy', (['supernode_nonemp...
import time from autocfr.worker import Worker, VecWorker, GroupVecWorker import numpy as np import ray class DiverContainer(Worker): @ray.remote def run(task): a = task["a"] b = task["b"] result = { "worker_index": task["worker_index"], "group_index": task["grou...
[ "ray.init", "time.sleep", "numpy.random.randint", "ray.shutdown", "autocfr.worker.VecWorker", "autocfr.worker.GroupVecWorker" ]
[((1315, 1325), 'ray.init', 'ray.init', ([], {}), '()\n', (1323, 1325), False, 'import ray\n'), ((1343, 1362), 'autocfr.worker.VecWorker', 'VecWorker', (['(3)', 'Diver'], {}), '(3, Diver)\n', (1352, 1362), False, 'from autocfr.worker import Worker, VecWorker, GroupVecWorker\n'), ((1656, 1670), 'ray.shutdown', 'ray.shut...
import pennylane as qml import numpy as np if __name__ != '__main__': from . encoder.encoding_circuits import EncodingCircuitsPennylane from . pqc.parametric_circuits import ParametricCircuitsPennylane from . measurement.measurement_circuits import MeasurementCircuitsPennylane class PennylaneQNNCi...
[ "measurement.measurement_circuits.MeasurementCircuitsPennylane", "pqc.parametric_circuits.ParametricCircuitsPennylane", "pennylane.device", "numpy.random.random", "pennylane.QNode", "encoder.encoding_circuits.EncodingCircuitsPennylane" ]
[((1949, 1979), 'numpy.random.random', 'np.random.random', (['input_length'], {}), '(input_length)\n', (1965, 1979), True, 'import numpy as np\n'), ((1991, 2028), 'pennylane.device', 'qml.device', (['"""default.qubit"""'], {'wires': '(10)'}), "('default.qubit', wires=10)\n", (2001, 2028), True, 'import pennylane as qml...
""" Train a speaker model on R2R """ import logging from typing import List, Tuple, Dict import copy import os import random import shutil import sys from datetime import datetime from tqdm import tqdm import numpy as np import torch import torch.distributed as dist import torch.nn.functional as F from torch import nn ...
[ "numpy.random.seed", "torch.utils.data.RandomSampler", "torch.cuda.device_count", "torch.distributed.get_world_size", "torch.device", "torch.no_grad", "os.path.join", "torch.ones", "torch.utils.data.DataLoader", "torch.distributed.get_rank", "os.path.exists", "vilbert.optimization.WarmupLinear...
[((892, 1054), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO', 'stream': 'sys.stdout'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt=\n '%m...
""" 5_costsTester.py Created by <NAME> at 18/02/2021, University of Milano-Bicocca. (<EMAIL>) All rights reserved. This file is part of the EcoFin-Library (https://github.com/LucaCamerani/EcoFin-Library), and is released under the "BSD Open Source License". """ """ 4_portfolioTester.py Created by <NAME> at 10/02/20...
[ "EcoFin.utils.utils.polarizeTable", "tqdm.tqdm", "matplotlib.pyplot.show", "numpy.log", "EcoFin.assetAllocation.allocation.Allocation", "pandas.to_datetime", "matplotlib.pyplot.subplots", "pandas.concat" ]
[((1762, 1802), 'tqdm.tqdm', 'tqdm', (['ticker_list'], {'desc': '"""Importing data"""'}), "(ticker_list, desc='Importing data')\n", (1766, 1802), False, 'from tqdm import tqdm\n'), ((4040, 4100), 'EcoFin.assetAllocation.allocation.Allocation', 'Allocation', (["data['signals']"], {'buyOnly': 'buy_only', 'limit': 'w_limi...
# -*- coding: utf-8 -*- import numpy as np import chainer from chainer import cuda, Function, Variable from chainer import Link, Chain, ChainList import chainer.functions as F import chainer.links as L from src.lib.loss import softmax_dice_loss class Model_L2(Chain): def __init__( self, nd...
[ "chainer.initializers.HeNormal", "chainer.functions.max_pooling_nd", "numpy.array", "chainer.functions.softmax", "chainer.links.BatchNormalization" ]
[((932, 963), 'chainer.initializers.HeNormal', 'chainer.initializers.HeNormal', ([], {}), '()\n', (961, 963), False, 'import chainer\n'), ((4333, 4387), 'chainer.functions.max_pooling_nd', 'F.max_pooling_nd', (['syn0', 'self.pool_size', 'self.pool_size'], {}), '(syn0, self.pool_size, self.pool_size)\n', (4349, 4387), T...
# pylint: disable-msg=E1101 """ Wrapper to lowess and stl routines. LOWESS: Initial Fortran code available at: http://netlib.bell-labs.com/netlib/go/lowess.f.gz initial author: <NAME>, 1979. Simple to double precision conversion of the Fortran code by Pierre Gerard-Marchant, 2007/03. STL: Initial Fortran code availa...
[ "numpy.any", "numpy.empty", "numpy.array" ]
[((6139, 6185), 'numpy.array', 'array', (['x'], {'copy': '(False)', 'subok': '(True)', 'dtype': 'float_'}), '(x, copy=False, subok=True, dtype=float_)\n', (6144, 6185), False, 'from numpy import array, recarray, empty, fromiter, logical_not\n'), ((6194, 6240), 'numpy.array', 'array', (['y'], {'copy': '(False)', 'subok'...
""" This code validates the performance of VGG16 after L-OBS prunning """ import torch import torch.backends.cudnn as cudnn import torchvision.datasets as datasets import torchvision.transforms as transforms from models.vgg import vgg16_bn from utils import validate, adjust_mean_var import numpy as np import os f...
[ "numpy.load", "torch.cuda.device_count", "torchvision.transforms.Normalize", "torch.utils.data.DataLoader", "torch.load", "os.path.exists", "utils.adjust_mean_var", "torch.FloatTensor", "torchvision.transforms.CenterCrop", "datetime.datetime.now", "models.vgg.vgg16_bn", "torchvision.transforms...
[((361, 386), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (384, 386), False, 'import torch\n'), ((1590, 1600), 'models.vgg.vgg16_bn', 'vgg16_bn', ([], {}), '()\n', (1598, 1600), False, 'from models.vgg import vgg16_bn\n'), ((1691, 1722), 'torch.load', 'torch.load', (['pretrain_model_path'], ...
from flask import Flask, render_template, jsonify, request, url_for from shapely.geometry import Point as Shapely_point, mapping from geojson import Point as Geoj_point, Polygon as Geoj_polygon, Feature, FeatureCollection from datetime import datetime from sqlalchemy import * import pandas as pd import geopandas as gpd...
[ "datetime.datetime.strftime", "pandas.DataFrame", "netCDF4.Dataset", "numpy.dstack", "flask.request.args.get", "flask.Flask", "numpy.append", "datetime.datetime.strptime", "flask.jsonify", "numpy.reshape", "flask.render_template", "pandas.concat", "os.listdir" ]
[((2025, 2082), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['updatedDtStr', '"""%Y%m%d_%H%M%S"""'], {}), "(updatedDtStr, '%Y%m%d_%H%M%S')\n", (2051, 2082), False, 'import datetime\n'), ((2101, 2157), 'datetime.datetime.strftime', 'datetime.datetime.strftime', (['updatedDt', '"""%Y-%m-%dT%H%M%S"""'], {...
# -*- coding: utf-8 -*- # Copyright (c) 2016-2022 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. import numpy as np import pandas as pd from pandapower.shortcircuit.idx_brch import IKSS_F, IKSS_T, IP_F, IP_T, ITH_F, ITH...
[ "pandas.MultiIndex.from_product", "numpy.nan_to_num" ]
[((5733, 5812), 'pandas.MultiIndex.from_product', 'pd.MultiIndex.from_product', (['[net.res_line_sc.index, bus]'], {'names': "['line', 'bus']"}), "([net.res_line_sc.index, bus], names=['line', 'bus'])\n", (5759, 5812), True, 'import pandas as pd\n'), ((7392, 7477), 'pandas.MultiIndex.from_product', 'pd.MultiIndex.from_...
import numpy as np import ipyvolume as ipv import h5py import os import matplotlib.pyplot as plt import sys from tqdm import tqdm kinect_dir = '../dataset/kinect/' dir = '../dataset/data/' kinect_files = os.listdir(kinect_dir) missing_file_count = 0 def get_vibe_dir(x): x1 = x[16,:] - x[0,:] x2 = x[17,:] - x...
[ "numpy.save", "numpy.sum", "numpy.zeros", "numpy.cross", "numpy.array", "os.path.join", "os.listdir" ]
[((206, 228), 'os.listdir', 'os.listdir', (['kinect_dir'], {}), '(kinect_dir)\n', (216, 228), False, 'import os\n'), ((337, 353), 'numpy.cross', 'np.cross', (['x1', 'x2'], {}), '(x1, x2)\n', (345, 353), True, 'import numpy as np\n'), ((439, 455), 'numpy.cross', 'np.cross', (['x1', 'x2'], {}), '(x1, x2)\n', (447, 455), ...
# %% [markdown] # # import os import pickle import warnings from operator import itemgetter from pathlib import Path from timeit import default_timer as timer import colorcet as cc import community as cm import matplotlib.colors as mplc import matplotlib.pyplot as plt import networkx as nx import numpy as np import p...
[ "os.remove", "numpy.random.seed", "src.io.savefig", "src.io.saveskels", "src.graph.MetaGraph", "igraph.Graph.Read_GraphML", "numpy.random.randint", "numpy.unique", "src.graph.preprocess", "matplotlib.pyplot.close", "seaborn.set_context", "numpy.vectorize", "os.path.basename", "src.visualiz...
[((1392, 1415), 'numpy.random.seed', 'np.random.seed', (['(9812343)'], {}), '(9812343)\n', (1406, 1415), True, 'import numpy as np\n'), ((1416, 1439), 'seaborn.set_context', 'sns.set_context', (['"""talk"""'], {}), "('talk')\n", (1431, 1439), True, 'import seaborn as sns\n'), ((2069, 2118), 'src.data.load_metagraph', '...
import numpy as np from Redbox_v2 import file_manager as fm import pandas as pd from scipy.fftpack import rfft, rfftfreq import matplotlib.pyplot as plt import os import math def rms_time_dom(signal): N = len(signal) return math.sqrt(np.sum(np.power(signal,2))/N) def rms_freq_dom(amplitude):...
[ "matplotlib.pyplot.title", "scipy.fftpack.rfft", "numpy.amin", "numpy.argmax", "numpy.logspace", "numpy.argmin", "matplotlib.pyplot.figure", "numpy.exp", "numpy.pad", "numpy.fft.fft", "numpy.power", "numpy.linspace", "numpy.fft.ifft", "numpy.trapz", "matplotlib.pyplot.show", "numpy.log...
[((701, 712), 'numpy.zeros', 'np.zeros', (['(1)'], {}), '(1)\n', (709, 712), True, 'import numpy as np\n'), ((1015, 1037), 'numpy.delete', 'np.delete', (['maximums', '(0)'], {}), '(maximums, 0)\n', (1024, 1037), True, 'import numpy as np\n'), ((1467, 1483), 'numpy.zeros', 'np.zeros', (['[1, 2]'], {}), '([1, 2])\n', (14...
import warnings import numpy as np import scipy.linalg as scplin import scipy.optimize as scpop import scipy.sparse as scpsp dfail = {} try: import sksparse as sksp except Exception as err: sksp = False dfail['sksparse'] = "For cholesk factorizations" try: import scikits.umfpack as skumf except E...
[ "scipy.linalg.solve", "scipy.optimize.minimize", "numpy.abs", "numpy.log", "numpy.sum", "scipy.linalg.cholesky", "scipy.sparse.linalg.cg", "scipy.linalg.cho_solve", "scipy.sparse.linalg.factorized", "sksparse.cholmod.cholesky", "numpy.argmin", "numpy.argsort", "numpy.append", "numpy.max", ...
[((603, 621), 'warnings.warn', 'warnings.warn', (['msg'], {}), '(msg)\n', (616, 621), False, 'import warnings\n'), ((16794, 16809), 'numpy.array', 'np.array', (['[mu0]'], {}), '([mu0])\n', (16802, 16809), True, 'import numpy as np\n'), ((16830, 16847), 'numpy.log', 'np.log', (['chi2n_obj'], {}), '(chi2n_obj)\n', (16836...
# 0702.py import cv2 import numpy as np src = cv2.imread('./data/rect.jpg') gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY) edges = cv2.Canny(gray, 50, 100) lines = cv2.HoughLines(edges, rho = 1, theta = np.pi/180.0, threshold = 100) print('lines.shape = ', lines.shape) for line in lines: rho, theta = l...
[ "cv2.line", "cv2.Canny", "cv2.cvtColor", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.imread", "numpy.sin", "cv2.HoughLines", "numpy.cos", "cv2.imshow" ]
[((53, 82), 'cv2.imread', 'cv2.imread', (['"""./data/rect.jpg"""'], {}), "('./data/rect.jpg')\n", (63, 82), False, 'import cv2\n'), ((91, 128), 'cv2.cvtColor', 'cv2.cvtColor', (['src', 'cv2.COLOR_BGR2GRAY'], {}), '(src, cv2.COLOR_BGR2GRAY)\n', (103, 128), False, 'import cv2\n'), ((138, 162), 'cv2.Canny', 'cv2.Canny', (...
import os from typing import Dict, Union import numpy as np def lenient_makedirs(path: str) -> None: """Simple wrapper around makedirs that first checks for existence. Args: path (str): path to be created """ if not os.path.exists(path): os.makedirs(path) def tile_overlapped(image:...
[ "numpy.moveaxis", "os.makedirs", "numpy.ceil", "numpy.empty", "numpy.zeros", "numpy.expand_dims", "os.path.exists", "numpy.all" ]
[((1779, 1867), 'numpy.empty', 'np.empty', (['(tile_count_h, tile_count_w, tile_h, tile_w, channels)'], {'dtype': 'image.dtype'}), '((tile_count_h, tile_count_w, tile_h, tile_w, channels), dtype=\n image.dtype)\n', (1787, 1867), True, 'import numpy as np\n'), ((3302, 3327), 'numpy.zeros', 'np.zeros', (['image.shape[...
import json import torch import numpy as np import random import torch.nn.functional as F import functools def cmp_time(a, b): a_num = int(a.split('_')[1]) b_num = int(b.split('_')[1]) return a_num - b_num def pad_tensor(vec, pad): """ pad tensor to fixed length :parameter vec: tensor...
[ "numpy.load", "json.load", "torch.FloatTensor", "torch.zeros", "torch.tensor" ]
[((824, 837), 'numpy.load', 'np.load', (['path'], {}), '(path)\n', (831, 837), True, 'import numpy as np\n'), ((859, 912), 'torch.tensor', 'torch.tensor', (["ori_data['pssm_arr']"], {'dtype': 'torch.float'}), "(ori_data['pssm_arr'], dtype=torch.float)\n", (871, 912), False, 'import torch\n'), ((945, 998), 'torch.tensor...
import sys import numpy as np import math from JMLUtils import dist2, eprint from StructureXYZ import StructXYZ from typing import Sequence TRIANGLE_TOL = 1E-4 Y_DENOM = 1.0 / math.sqrt(3) def water(infile: str = 'QM_REF.xyz', delta=4.0): delta = float(delta) xyzfi = StructXYZ(infile) assert len(xyzfi...
[ "numpy.dot", "StructureXYZ.StructXYZ", "JMLUtils.eprint", "math.sqrt" ]
[((179, 191), 'math.sqrt', 'math.sqrt', (['(3)'], {}), '(3)\n', (188, 191), False, 'import math\n'), ((282, 299), 'StructureXYZ.StructXYZ', 'StructXYZ', (['infile'], {}), '(infile)\n', (291, 299), False, 'from StructureXYZ import StructXYZ\n'), ((1575, 1615), 'numpy.dot', 'np.dot', (['bisector_vector', 'bisector_vector...
# Objective: learn a Doc2Vec model import logging import multiprocessing import random from time import time import numpy as np from gensim.models import doc2vec from benchmark_utils import load_benchmarked_app_ids, print_ranking from sentence_models import print_most_similar_sentences from universal_sentence_encode...
[ "benchmark_utils.load_benchmarked_app_ids", "random.shuffle", "word_model.compute_similarity_using_word2vec_model", "sentence_models.print_most_similar_sentences", "multiprocessing.cpu_count", "universal_sentence_encoder.prepare_knn_search", "universal_sentence_encoder.perform_knn_search_with_vectors_as...
[((2425, 2431), 'time.time', 'time', ([], {}), '()\n', (2429, 2431), False, 'from time import time\n'), ((4499, 4592), 'sentence_models.print_most_similar_sentences', 'print_most_similar_sentences', (['similarity_scores'], {'num_items_displayed': 'num_items_displayed'}), '(similarity_scores, num_items_displayed=\n n...
#!/usr/bin/env python # coding: utf-8 # # Navigation # # --- # # You are welcome to use this coding environment to train your agent for the project. Follow the instructions below to get started! # # ### 1. Start the Environment # # Run the next code cell to install a few packages. This line will take a few minut...
[ "numpy.random.randint", "unityagents.UnityEnvironment" ]
[((674, 742), 'unityagents.UnityEnvironment', 'UnityEnvironment', ([], {'file_name': '"""/data/Banana_Linux_NoVis/Banana.x86_64"""'}), "(file_name='/data/Banana_Linux_NoVis/Banana.x86_64')\n", (690, 742), False, 'from unityagents import UnityEnvironment\n'), ((2258, 2288), 'numpy.random.randint', 'np.random.randint', (...
import numpy as np import hierarchy as hrcy def get_stationary_distribution(capacities, r, lmbda, mu): assert capacities[-1] == 1 matrix = hrcy.transitions.get_transition_matrix( capacities=capacities, r=r, lmbda=lmbda, mu=mu ) dimension = matrix.shape[0] M = np.vstack((matrix.transpose(...
[ "numpy.linalg.lstsq", "hierarchy.transitions.get_transition_matrix", "numpy.zeros", "numpy.ones" ]
[((150, 241), 'hierarchy.transitions.get_transition_matrix', 'hrcy.transitions.get_transition_matrix', ([], {'capacities': 'capacities', 'r': 'r', 'lmbda': 'lmbda', 'mu': 'mu'}), '(capacities=capacities, r=r, lmbda=\n lmbda, mu=mu)\n', (188, 241), True, 'import hierarchy as hrcy\n'), ((323, 341), 'numpy.ones', 'np.o...
import numpy as np arr1 = np.array([1, 2, 3]) arr2 = np.array([1, 2, 3]) newarr = np.sum([arr1, arr2]) print(newarr)
[ "numpy.array", "numpy.sum" ]
[((27, 46), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (35, 46), True, 'import numpy as np\n'), ((54, 73), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (62, 73), True, 'import numpy as np\n'), ((84, 104), 'numpy.sum', 'np.sum', (['[arr1, arr2]'], {}), '([arr1, arr2])\n', (90, 1...
''' for i in predictions/test/*; do python visualize_predictions.py $i\/doc.json $i/pred_weights.npy prediction_dir/$i ; done; ''' import argparse import numpy as np import bipartite_utils import json import os import subprocess import matplotlib.pyplot as plt from sklearn.metrics import roc_auc_score def parse_args(...
[ "numpy.load", "argparse.ArgumentParser", "os.makedirs", "os.path.exists", "matplotlib.pyplot.axis", "numpy.clip", "matplotlib.pyplot.figure", "subprocess.call", "numpy.array", "bipartite_utils.generate_fast_hungarian_solving_function", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.savef...
[((336, 361), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (359, 361), False, 'import argparse\n'), ((571, 601), 'subprocess.call', 'subprocess.call', (['x'], {'shell': '(True)'}), '(x, shell=True)\n', (586, 601), False, 'import subprocess\n'), ((655, 680), 'numpy.load', 'np.load', (['args.pr...
"""Global settings and imports""" import sys sys.path.append("../../") import os import numpy as np import zipfile from tqdm import tqdm import scrapbook as sb from tempfile import TemporaryDirectory import tensorflow as tf tf.get_logger().setLevel('ERROR') # only show error messages from reco_utils.recommender.deepre...
[ "sys.path.append", "reco_utils.recommender.newsrec.newsrec_utils.get_mind_data_set", "tempfile.TemporaryDirectory", "os.makedirs", "scrapbook.glue", "os.path.exists", "numpy.argsort", "reco_utils.recommender.newsrec.models.nrms.NRMSModel", "os.path.join", "reco_utils.recommender.newsrec.newsrec_ut...
[((45, 70), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (60, 70), False, 'import sys\n'), ((912, 932), 'tempfile.TemporaryDirectory', 'TemporaryDirectory', ([], {}), '()\n', (930, 932), False, 'from tempfile import TemporaryDirectory\n'), ((976, 1020), 'os.path.join', 'os.path.join', (...
import os import os.path as osp import gym import time import datetime import joblib import logging import numpy as np import tensorflow as tf from baselines import logger from baselines.common import set_global_seeds, explained_variance from baselines.common.vec_env.subproc_vec_env import SubprocVecEnv from baselines...
[ "baselines.a2c.utils.Scheduler", "tensorflow.reset_default_graph", "tensorflow.train.RMSPropOptimizer", "joblib.dump", "baselines.a2c.utils.find_trainable_variables", "tensorflow.clip_by_global_norm", "numpy.copy", "tensorflow.placeholder", "tensorflow.summary.FileWriter", "tensorflow.squeeze", ...
[((9842, 9866), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (9864, 9866), True, 'import tensorflow as tf\n'), ((9871, 9893), 'baselines.common.set_global_seeds', 'set_global_seeds', (['seed'], {}), '(seed)\n', (9887, 9893), False, 'from baselines.common import set_global_seeds, explain...
import cv2 import sys import numpy as np import pyperclip as ppc from tkinter import filedialog from tkinter import * def record_click(event,x,y,flags,param): global mouseX,mouseY if event == cv2.EVENT_LBUTTONDBLCLK: mouseX,mouseY = x,y point = "[" + str(mouseX) + ", " + str(mouseY) + "]" cv2.d...
[ "cv2.putText", "cv2.waitKey", "numpy.zeros", "tkinter.filedialog.askopenfilename", "cv2.drawMarker", "cv2.imread", "cv2.setMouseCallback", "pyperclip.copy", "cv2.moveWindow", "cv2.imshow", "cv2.namedWindow" ]
[((1004, 1036), 'cv2.namedWindow', 'cv2.namedWindow', (['"""Select Points"""'], {}), "('Select Points')\n", (1019, 1036), False, 'import cv2\n'), ((1037, 1061), 'cv2.namedWindow', 'cv2.namedWindow', (['"""Point"""'], {}), "('Point')\n", (1052, 1061), False, 'import cv2\n'), ((1062, 1102), 'cv2.moveWindow', 'cv2.moveWin...
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D pW = 0.48 pL = 1-pW b_max = 500 #max bet ($) def total_losses(b0, f, num_losses): sum=0 for i in range(0, num_losses): sum += f**i return b0*sum def net_winnings(b0, f, num_games):...
[ "matplotlib.pyplot.title", "numpy.meshgrid", "matplotlib.pyplot.show", "numpy.log", "numpy.argmax", "numpy.asarray", "matplotlib.pyplot.figure", "numpy.arange", "numpy.reshape" ]
[((859, 879), 'numpy.arange', 'np.arange', (['(1)', '(500)', '(1)'], {}), '(1, 500, 1)\n', (868, 879), True, 'import numpy as np\n'), ((900, 923), 'numpy.arange', 'np.arange', (['(1.01)', '(5)', '(0.1)'], {}), '(1.01, 5, 0.1)\n', (909, 923), True, 'import numpy as np\n'), ((989, 1007), 'numpy.meshgrid', 'np.meshgrid', ...
import cv2 import numpy as np from skimage.segmentation import slic from skimage import color from skimage.measure import regionprops from PIL import Image, ImageDraw import moviepy.editor as mp import random import os class GifMaker(): def to_mosaic_gif(self, img_path, n_segments = 150, segments_per_frame = 3): ...
[ "numpy.uint8", "skimage.color.label2rgb", "moviepy.editor.VideoFileClip", "cv2.bitwise_and", "cv2.cvtColor", "numpy.zeros", "PIL.Image.fromarray", "cv2.imread", "cv2.normalize", "skimage.segmentation.slic", "os.path.split", "os.path.join", "numpy.unique" ]
[((326, 346), 'cv2.imread', 'cv2.imread', (['img_path'], {}), '(img_path)\n', (336, 346), False, 'import cv2\n'), ((385, 426), 'skimage.segmentation.slic', 'slic', (['img'], {'n_segments': 'n_segments', 'sigma': '(5)'}), '(img, n_segments=n_segments, sigma=5)\n', (389, 426), False, 'from skimage.segmentation import sli...
# conda activate pymesh import math import numpy as np import trimesh import cv2 import os import configs.config_loader as cfg_loader import NDF_combine as NDF def str2bool(inp): return inp.lower() in 'true' class Renderer(): def __init__(self): self.get_args() self.create_plane_points_from...
[ "numpy.ones", "cv2.transpose", "numpy.linalg.norm", "configs.config_loader.get_config", "os.path.join", "numpy.prod", "numpy.meshgrid", "numpy.multiply", "numpy.copy", "math.radians", "numpy.transpose", "numpy.insert", "NDF_combine.predictRotGradientNDF", "numpy.reshape", "numpy.linspace...
[((484, 507), 'configs.config_loader.get_config', 'cfg_loader.get_config', ([], {}), '()\n', (505, 507), True, 'import configs.config_loader as cfg_loader\n'), ((600, 644), 'os.makedirs', 'os.makedirs', (['self.args.folder'], {'exist_ok': '(True)'}), '(self.args.folder, exist_ok=True)\n', (611, 644), False, 'import os\...
import os, sys import numpy as np from copy import deepcopy from warnings import warn from .Mesh import Mesh from .GeometricPath import * from Florence.Tensor import totuple, unique2d __all__ = ['HarvesterPatch', 'SubdivisionArc', 'SubdivisionCircle', 'QuadBall', 'QuadBallSphericalArc'] """ A series of custom meshes...
[ "os.remove", "Florence.Tensor.totuple", "numpy.isclose", "numpy.sin", "numpy.linalg.norm", "Florence.LinearElastic", "Florence.Mesh", "numpy.unique", "Florence.BoundaryCondition", "Florence.Tensor.prime_number_factorisation", "numpy.zeros_like", "numpy.copy", "numpy.linspace", "copy.deepco...
[((700, 725), 'numpy.array', 'np.array', (['[30.6979, 20.5]'], {}), '([30.6979, 20.5])\n', (708, 725), True, 'import numpy as np\n'), ((738, 760), 'numpy.array', 'np.array', (['[30.0, 20.0]'], {}), '([30.0, 20.0])\n', (746, 760), True, 'import numpy as np\n'), ((771, 793), 'numpy.array', 'np.array', (['[30.0, 21.0]'], ...
import tensorflow as tf from PIL import Image import numpy as np import os from util import check_or_makedirs im = Image.open("1.jpg") print(im.mode, im.size) np_im = np.array(im) tf_im = tf.constant(np_im) print(tf_im.dtype) img = tf.image.grayscale_to_rgb(tf_im[:, :, tf.newaxis]) # scale image to fixed size fixed...
[ "tensorflow.image.grayscale_to_rgb", "os.path.join", "tensorflow.random.normal", "tensorflow.image.adjust_jpeg_quality", "tensorflow.image.adjust_hue", "tensorflow.pad", "tensorflow.constant", "PIL.Image.open", "tensorflow.cast", "tensorflow.shape", "numpy.array", "tensorflow.image.adjust_cont...
[((116, 135), 'PIL.Image.open', 'Image.open', (['"""1.jpg"""'], {}), "('1.jpg')\n", (126, 135), False, 'from PIL import Image\n'), ((169, 181), 'numpy.array', 'np.array', (['im'], {}), '(im)\n', (177, 181), True, 'import numpy as np\n'), ((190, 208), 'tensorflow.constant', 'tf.constant', (['np_im'], {}), '(np_im)\n', (...
import glob import random import os import numpy as np from torch.utils.data import Dataset from PIL import Image import torchvision.transforms as transforms class ImageDataset(Dataset): def __init__(self, root, transforms_=None, unaligned=False, mode='train', portion=None): self.transform = tran...
[ "numpy.uint8", "numpy.flip", "numpy.asarray", "numpy.floor", "torchvision.transforms.Compose", "glob.glob", "numpy.random.rand", "os.path.join" ]
[((316, 347), 'torchvision.transforms.Compose', 'transforms.Compose', (['transforms_'], {}), '(transforms_)\n', (334, 347), True, 'import torchvision.transforms as transforms\n'), ((2362, 2393), 'torchvision.transforms.Compose', 'transforms.Compose', (['transforms_'], {}), '(transforms_)\n', (2380, 2393), True, 'import...
import numpy as np from sas7bdat import SAS7BDAT import glob import pandas as pd from sklearn import preprocessing from sas7bdat import SAS7BDAT import glob import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt from sklearn import utils, model_selection, metrics, linear_model, neighbors, ensemble...
[ "pandas.read_csv", "sklearn.model_selection.train_test_split", "numpy.arange", "glob.glob", "numpy.round", "pandas.DataFrame", "matplotlib.patches.Rectangle", "sklearn.linear_model.ElasticNet", "pandas.merge", "matplotlib.pyplot.xticks", "matplotlib.pyplot.subplots", "pandas.concat", "sklear...
[((3880, 3914), 'pandas.read_csv', 'pd.read_csv', (['"""featureTableMap.csv"""'], {}), "('featureTableMap.csv')\n", (3891, 3914), True, 'import pandas as pd\n'), ((3926, 4000), 'pandas.read_csv', 'pd.read_csv', (['"""./data/subjectsWithBiomarkers.csv"""'], {'usecols': "['idind', 'Age']"}), "('./data/subjectsWithBiomark...
# Public python modules import numpy as np import pandas as pd import pickle import feature from os import path # If categories of test data = categories of the training data class load(): def __init__(self, data_path, batch_size): self.pointer = 0 self.dataframe = pickle.load(open(data_path,"rb"))...
[ "numpy.float32", "numpy.zeros" ]
[((1029, 1051), 'numpy.zeros', 'np.zeros', (['self.n_class'], {}), '(self.n_class)\n', (1037, 1051), True, 'import numpy as np\n'), ((929, 946), 'numpy.float32', 'np.float32', (['patch'], {}), '(patch)\n', (939, 946), True, 'import numpy as np\n'), ((2291, 2308), 'numpy.float32', 'np.float32', (['patch'], {}), '(patch)...
"""Main module.""" import itertools as it import numpy as np def read_data(filepath, sep=" "): """This function reads file containing Points Coordinates Arguments: filepath (str) -- Path to the file to be read Keyword Arguments: sep (str) -- Separator for columns in file (default: " ") ...
[ "numpy.std", "numpy.cross", "numpy.append", "numpy.mean", "numpy.array", "numpy.linalg.norm", "numpy.linspace", "numpy.linalg.inv", "numpy.matmul" ]
[((1264, 1282), 'numpy.cross', 'np.cross', (['y_1', 'y_2'], {}), '(y_1, y_2)\n', (1272, 1282), True, 'import numpy as np\n'), ((1345, 1373), 'numpy.cross', 'np.cross', (['x_versor', 'y_versor'], {}), '(x_versor, y_versor)\n', (1353, 1373), True, 'import numpy as np\n'), ((3134, 3152), 'numpy.array', 'np.array', (['poin...
import os import numpy as np import glob from sklearn.model_selection import StratifiedShuffleSplit import sys, os sys.path.insert(0, os.path.join( os.path.dirname(os.path.realpath(__file__)), "../../")) from deep_audio_features.bin import config import wave import contextlib def load(folders=None, test_val=[0.2,...
[ "wave.open", "os.path.realpath", "sklearn.model_selection.StratifiedShuffleSplit", "numpy.max", "os.path.join" ]
[((1898, 1966), 'sklearn.model_selection.StratifiedShuffleSplit', 'StratifiedShuffleSplit', ([], {'n_splits': '(1)', 'test_size': 'test_p', 'random_state': '(0)'}), '(n_splits=1, test_size=test_p, random_state=0)\n', (1920, 1966), False, 'from sklearn.model_selection import StratifiedShuffleSplit\n'), ((2437, 2504), 's...
#-*- coding: utf-8 -*- import numpy as np class GPSConverter(object): ''' GPS Converter class which is able to perform convertions between the CH1903 and WGS84 system. ''' # Convert CH y/x/h to WGS height def CHtoWGSheight(self, y, x, h): # Axiliary values (% Bern) y_aux = (y ...
[ "numpy.floor" ]
[((1645, 1674), 'numpy.floor', 'np.floor', (['((dec - degree) * 60)'], {}), '((dec - degree) * 60)\n', (1653, 1674), True, 'import numpy as np\n')]
import copy from typing import Tuple import numpy as np from odyssey.distribution import Distribution from iliad.integrators.info import SoftAbsLeapfrogInfo from iliad.integrators.states import SoftAbsLeapfrogState from iliad.integrators.terminal import cond from iliad.integrators.fields import riemannian, softabs ...
[ "numpy.abs", "iliad.integrators.info.SoftAbsLeapfrogInfo", "iliad.integrators.fields.softabs.decomposition", "iliad.integrators.fields.softabs.force", "copy.copy", "numpy.ones", "numpy.diag", "iliad.integrators.terminal.cond", "numpy.linalg.cholesky" ]
[((1270, 1462), 'iliad.integrators.fields.softabs.force', 'softabs.force', (['pmcand', 'state.grad_log_posterior', 'state.jac_hessian', 'state.hessian_eigenvals', 'state.softabs_eigenvals', 'state.softabs_inv_eigenvals', 'state.hessian_eigenvecs', 'state.alpha'], {}), '(pmcand, state.grad_log_posterior, state.jac_hessi...
import numpy as np def rank5_accuracy(predictions, labels): # initialize the rank-1 and rank-5 accuracies rank_1 = 0 rank_5 = 0 # new_predictions = [] # loop over the predictions and the ground-truth labels for (prediction_, ground_truth) in zip(predictions, labels): # sort the probab...
[ "numpy.argsort" ]
[((459, 482), 'numpy.argsort', 'np.argsort', (['prediction_'], {}), '(prediction_)\n', (469, 482), True, 'import numpy as np\n')]
import numpy as np from astropy.io import fits from astropy.table import Table from scipy.interpolate import InterpolatedUnivariateSpline import matplotlib.pyplot as plt #from scipy.signal import medfilt # Your input template template = 'Template_s1d_Gl699_sc1d_v_file_AB.fits' # template = 'Template_s1d_Gl15A_sc1d_v_f...
[ "numpy.polyfit", "numpy.ones", "numpy.argmin", "numpy.mean", "numpy.arange", "numpy.round", "numpy.zeros_like", "scipy.interpolate.InterpolatedUnivariateSpline", "astropy.io.fits.getdata", "numpy.isfinite", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "os.system", "astropy.table.T...
[((1107, 1149), 'astropy.io.fits.getdata', 'fits.getdata', (['template'], {'ext': '(1)', 'header': '(True)'}), '(template, ext=1, header=True)\n', (1119, 1149), False, 'from astropy.io import fits\n'), ((1801, 1825), 'astropy.io.fits.getdata', 'fits.getdata', (['model_file'], {}), '(model_file)\n', (1813, 1825), False,...
# This program displays a plot of the functions x, x2 and 2x in the range [0, 4] # <NAME> 2019-03-24 # I formulated this solution using the week 9 lectures as a starting point followed by further reading and research which is detailed further in the references section in the Readme file # Additional reading included th...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.arange", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid" ]
[((728, 754), 'numpy.arange', 'np.arange', ([], {'start': '(0)', 'stop': '(4)'}), '(start=0, stop=4)\n', (737, 754), True, 'import numpy as np\n'), ((924, 975), 'matplotlib.pyplot.xlabel', 'pl.xlabel', (['"""x axis"""'], {'fontsize': '(12)', 'fontweight': '"""bold"""'}), "('x axis', fontsize=12, fontweight='bold')\n", ...
import numpy as np from scipy.linalg import expm class Env( object): def __init__(self, action_space=[0,1,2], dt=0.1): super(Env, self).__init__() self.action_space = action_space self.n_actions = len(self.action_space) self.n_features = 4 self.state = np.arr...
[ "scipy.linalg.expm", "numpy.abs", "numpy.identity", "numpy.array", "numpy.mat" ]
[((314, 336), 'numpy.array', 'np.array', (['[1, 0, 0, 0]'], {}), '([1, 0, 0, 0])\n', (322, 336), True, 'import numpy as np\n'), ((419, 441), 'numpy.array', 'np.array', (['[1, 0, 0, 0]'], {}), '([1, 0, 0, 0])\n', (427, 441), True, 'import numpy as np\n'), ((683, 694), 'numpy.mat', 'np.mat', (['psi'], {}), '(psi)\n', (68...
# CSC 321, Assignment 4 # # This is the main training file for the vanilla GAN part of the assignment. # # Usage: # ====== # To train with the default hyperparamters (saves results to checkpoints_vanilla/ and samples_vanilla/): # python vanilla_gan.py import os import pdb import pickle import argparse import...
[ "models.WGANGenerator", "numpy.random.seed", "argparse.ArgumentParser", "torch.autograd.grad", "torch.device", "scipy.misc.imsave", "torch.no_grad", "os.path.join", "models.WGANDiscriminator", "utils.create_dir", "utils.to_data", "torch.manual_seed", "torch.cuda.manual_seed", "models.WGANG...
[((330, 363), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (353, 363), False, 'import warnings\n'), ((809, 829), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (823, 829), True, 'import numpy as np\n'), ((830, 853), 'torch.manual_seed', 'torch.manual_...
import tensorflow as tf import os import numpy as np import time def get_timestamp(name): timestamp = time.asctime().replace(' ', '_').replace(':', '') unique_name = f'{name}_at_{timestamp}' return unique_name def get_callbacks(config, X_train): logs = config['logs'] unique_dir_name = get_timest...
[ "time.asctime", "tensorflow.summary.image", "os.makedirs", "tensorflow.keras.callbacks.ModelCheckpoint", "numpy.reshape", "tensorflow.summary.create_file_writer", "tensorflow.keras.callbacks.TensorBoard", "os.path.join", "tensorflow.keras.callbacks.EarlyStopping" ]
[((366, 445), 'os.path.join', 'os.path.join', (["logs['logs_dir']", 'logs[TENSORBOARD_ROOT_LOG_DIR]', 'unique_dir_name'], {}), "(logs['logs_dir'], logs[TENSORBOARD_ROOT_LOG_DIR], unique_dir_name)\n", (378, 445), False, 'import os\n'), ((451, 503), 'os.makedirs', 'os.makedirs', (['TENSORBOARD_ROOT_LOG_DIR'], {'exist_ok'...
import pytest import numpy as np from spexxy.grid import GridAxis, ValuesGrid @pytest.fixture() def number_grid(): # define grid grid = np.array([ [1, 2, 3, 4, 5], [3, 4, 5, 6, 7], [2, 3, 4, 5, 6], [4, 5, 6, 7, 8] ]) # define axes ax1 = GridAxis(name='x', values=l...
[ "numpy.array", "spexxy.grid.ValuesGrid", "pytest.fixture" ]
[((82, 98), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (96, 98), False, 'import pytest\n'), ((147, 225), 'numpy.array', 'np.array', (['[[1, 2, 3, 4, 5], [3, 4, 5, 6, 7], [2, 3, 4, 5, 6], [4, 5, 6, 7, 8]]'], {}), '([[1, 2, 3, 4, 5], [3, 4, 5, 6, 7], [2, 3, 4, 5, 6], [4, 5, 6, 7, 8]])\n', (155, 225), True, 'im...
################################################### # # Script to: # - Load the images and extract the patches # - Define the neural network # - define the training # ################################################## import numpy as np import configparser from keras.utils import multi_gpu_model ...
[ "numpy.random.seed", "tensorflow.zeros_like", "keras.models.Model", "keras.layers.Input", "keras.callbacks.LearningRateScheduler", "keras.layers.concatenate", "sys.setrecursionlimit", "keras.layers.Reshape", "keras.backend.pow", "keras.optimizers.SGD", "keras.backend.flatten", "configparser.Ra...
[((759, 787), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./lib/"""'], {}), "(0, './lib/')\n", (774, 787), False, 'import sys\n'), ((1289, 1316), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(4000)'], {}), '(4000)\n', (1310, 1316), False, 'import sys\n'), ((18411, 18441), 'configparser.RawConfigParser', ...
import numpy as np from copy import copy from .base import Simplifier from ... import operations from ...analyzers import SplitAnalysis class ConvertBatchNorm(Simplifier): ANALYSES = {"is_split": SplitAnalysis} def visit_BatchNormalization(self, operation: operations.BatchNormalization): input_op =...
[ "numpy.zeros", "numpy.diag", "copy.copy", "numpy.sqrt" ]
[((481, 528), 'numpy.sqrt', 'np.sqrt', (['(operation.variance + operation.epsilon)'], {}), '(operation.variance + operation.epsilon)\n', (488, 528), True, 'import numpy as np\n'), ((941, 955), 'copy.copy', 'copy', (['input_op'], {}), '(input_op)\n', (945, 955), False, 'from copy import copy\n'), ((832, 879), 'numpy.zer...
import tensorflow as tf import numpy as np import chess #load the saved model model=tf.keras.models.load_model('openlock_model') #rest explained in nntest.py probmodel=tf.keras.Sequential([ model, tf.keras.layers.Softmax() ]) PieceNum={'p':'0','n':'1','b':'2','r':'3','q':'4','k':'5','.':'6'} def numreprgen(re...
[ "tensorflow.keras.models.load_model", "numpy.argmax", "tensorflow.keras.layers.Softmax", "chess.Board", "chess.BaseBoard" ]
[((85, 129), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""openlock_model"""'], {}), "('openlock_model')\n", (111, 129), True, 'import tensorflow as tf\n'), ((778, 791), 'chess.Board', 'chess.Board', ([], {}), '()\n', (789, 791), False, 'import chess\n'), ((820, 837), 'chess.BaseBoard', 'che...
import numpy as np import matplotlib.pyplot as plt import timeit import random import math def insertionSort(a): for i in range(1,len(a)): value = a[i] pos = i while (pos > 0 and value < a[pos-1]): a[pos] = a[pos-1] pos = pos-1 a[pos] = value def countingSort(a,max): m = max+1 co...
[ "matplotlib.pyplot.show", "random.randint", "matplotlib.pyplot.plot", "timeit.default_timer", "matplotlib.pyplot.axis", "numpy.append", "numpy.mean", "numpy.random.randint", "numpy.array" ]
[((1790, 1822), 'numpy.random.randint', 'np.random.randint', (['(101)'], {'size': '(128)'}), '(101, size=128)\n', (1807, 1822), True, 'import numpy as np\n'), ((1927, 1939), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1935, 1939), True, 'import numpy as np\n'), ((1945, 1957), 'numpy.array', 'np.array', (['[]'],...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf import numpy as np import PIL.Image as Image import time import cv2 from pyfirmata import Ar...
[ "tensorflow.train.import_meta_graph", "numpy.argmax", "cv2.waitKey", "tensorflow.Session", "time.sleep", "cv2.VideoCapture", "time.time", "pyfirmata.Arduino", "cv2.setMouseCallback", "cv2.destroyWindow", "PIL.Image.fromarray", "tensorflow.get_default_graph", "cv2.imshow", "cv2.namedWindow"...
[((334, 357), 'pyfirmata.Arduino', 'Arduino', (['"""/dev/ttyACM0"""'], {}), "('/dev/ttyACM0')\n", (341, 357), False, 'from pyfirmata import Arduino\n'), ((1122, 1141), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(2)'], {}), '(2)\n', (1138, 1141), False, 'import cv2\n'), ((1206, 1233), 'cv2.namedWindow', 'cv2.namedWindow...
from sg.StanfordGap import StanfordGap import numpy as np import matplotlib.pyplot as plt from sklearn.cluster import KMeans from sklearn import datasets class StanfordGapDemo(object): def run(self): """ Run the Stanford Gap Statistic Analysis on the iris data set presented in http://sciki...
[ "sklearn.datasets.load_iris", "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "sklearn.cluster.KMeans", "matplotlib.pyplot.legend", "numpy.zeros", "numpy.arange", "matplotlib.pyplot.xlabel", "sg.StanfordGap.StanfordGap" ]
[((473, 491), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (487, 491), True, 'import numpy as np\n'), ((507, 527), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (525, 527), False, 'from sklearn import datasets\n'), ((566, 583), 'numpy.zeros', 'np.zeros', (['(20, 1)'], {}), '(...
#!/usr/bin/python import numpy as np import pylab as plt import seaborn as sns sns.set_context("poster") #with open("traj.dat") as f: # data = f.read() # # data = data.split('\n') # # x = [row.split(' ')[0] for row in data] # y = [row.split(' ')[1] for row in data] # # fig = plt.figure() # # ax1 = f...
[ "pylab.show", "numpy.genfromtxt", "pylab.plot", "pylab.subplot", "pylab.savefig", "pylab.ylim", "pylab.xlabel", "pylab.legend", "seaborn.set_context" ]
[((81, 106), 'seaborn.set_context', 'sns.set_context', (['"""poster"""'], {}), "('poster')\n", (96, 106), True, 'import seaborn as sns\n'), ((551, 567), 'pylab.subplot', 'plt.subplot', (['(121)'], {}), '(121)\n', (562, 567), True, 'import pylab as plt\n'), ((591, 619), 'numpy.genfromtxt', 'np.genfromtxt', ([], {'fname'...
import os import sys import numpy as np import pytest from matchms import Spectrum from spec2vec import Spec2Vec from spec2vec import SpectrumDocument path_root = os.path.dirname(os.getcwd()) sys.path.insert(0, os.path.join(path_root, "matchmsextras")) from matchmsextras.library_search import library_matching def te...
[ "matchmsextras.library_search.library_matching", "os.getcwd", "spec2vec.SpectrumDocument", "numpy.array", "pytest.approx", "os.path.join", "numpy.all" ]
[((180, 191), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (189, 191), False, 'import os\n'), ((212, 252), 'os.path.join', 'os.path.join', (['path_root', '"""matchmsextras"""'], {}), "(path_root, 'matchmsextras')\n", (224, 252), False, 'import os\n'), ((1240, 1554), 'matchmsextras.library_search.library_matching', 'libr...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Unit Tests __author__: <NAME>, <NAME>, <NAME> """ import os import sys import unittest import numpy as np from scipy.io import loadmat sys.path.append(".") from inferactively.distributions import Categorical, Dirichlet # nopep8 class TestDirichlet(unittest.TestCa...
[ "sys.path.append", "unittest.main", "numpy.array_equal", "numpy.log", "scipy.io.loadmat", "inferactively.distributions.Dirichlet", "os.getcwd", "numpy.isclose", "numpy.array", "numpy.random.rand" ]
[((189, 209), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (204, 209), False, 'import sys\n'), ((5509, 5524), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5522, 5524), False, 'import unittest\n'), ((368, 379), 'inferactively.distributions.Dirichlet', 'Dirichlet', ([], {}), '()\n', (377, 3...
from glob import glob import cv2 import os import sys import yaml import matplotlib as mpl import numpy as np from skimage.io import imread import matplotlib.pyplot as plt from ellipses import LSqEllipse # The code is pulled from https://github.com/bdhammel/least-squares-ellipse-fitting import time # This annotation s...
[ "numpy.polyfit", "numpy.argmax", "numpy.argmin", "matplotlib.pyplot.figure", "yaml.safe_load", "os.path.join", "matplotlib.pyplot.close", "os.path.exists", "ellipses.LSqEllipse", "matplotlib.pyplot.subplots", "skimage.io.imread", "matplotlib.pyplot.show", "os.path.basename", "numpy.float",...
[((1337, 1365), 'os.path.basename', 'os.path.basename', (['image_path'], {}), '(image_path)\n', (1353, 1365), False, 'import os\n'), ((8092, 8104), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (8102, 8104), True, 'import matplotlib.pyplot as plt\n'), ((9034, 9045), 'sys.exit', 'sys.exit', (['(0)'], {}), ...
import numpy as np from math import log10 from math import sqrt import time import networkx as nx import matplotlib.pyplot as plt import pydot import csv class Graph(object): def __init__(self): self.root = None #root/source node is the start of the graph/tree and multicast source self.nodes = [] ...
[ "csv.writer", "numpy.zeros", "pydot.Dot", "math.log10", "pydot.Edge" ]
[((11302, 11331), 'pydot.Dot', 'pydot.Dot', ([], {'graph_type': '"""graph"""'}), "(graph_type='graph')\n", (11311, 11331), False, 'import pydot\n'), ((15441, 15472), 'numpy.zeros', 'np.zeros', (['(200, 200)'], {'dtype': '"""f"""'}), "((200, 200), dtype='f')\n", (15449, 15472), True, 'import numpy as np\n'), ((15965, 15...
import cv2 import matplotlib.pyplot as plt import numpy as np from functions_feat_extraction import image_to_features from project_5_utils import stitch_together def draw_labeled_bounding_boxes(img, labeled_frame, num_objects): """ Starting from labeled regions, draw enclosing rectangles in the original colo...
[ "cv2.rectangle", "functions_feat_extraction.image_to_features", "cv2.imshow", "project_5_utils.stitch_together", "numpy.copy", "cv2.cvtColor", "numpy.max", "numpy.int", "matplotlib.pyplot.subplots", "cv2.resize", "matplotlib.pyplot.show", "cv2.waitKey", "numpy.min", "numpy.concatenate", ...
[((1030, 1068), 'numpy.zeros', 'np.zeros', ([], {'shape': '(h, w)', 'dtype': 'np.uint8'}), '(shape=(h, w), dtype=np.uint8)\n', (1038, 1068), True, 'import numpy as np\n'), ((1393, 1455), 'cv2.threshold', 'cv2.threshold', (['heatmap', 'threshold', '(255)'], {'type': 'cv2.THRESH_BINARY'}), '(heatmap, threshold, 255, type...
from __future__ import annotations import threading import numpy as np from astropy.coordinates import SkyCoord import astropy.units as u from typing import Tuple, List import random from pyobs.object import Object from pyobs.utils.enums import MotionStatus class SimTelescope(Object): """A simulated telescope o...
[ "numpy.radians", "threading.RLock", "random.gauss", "astropy.coordinates.SkyCoord", "pyobs.object.Object.__init__", "numpy.sqrt" ]
[((1494, 1532), 'pyobs.object.Object.__init__', 'Object.__init__', (['self', '*args'], {}), '(self, *args, **kwargs)\n', (1509, 1532), False, 'from pyobs.object import Object\n'), ((2538, 2555), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (2553, 2555), False, 'import threading\n'), ((4115, 4153), 'astropy.c...
r""" Definition ---------- The scattering intensity $I(q)$ is calculated as .. math:: I(q) = \begin{cases} A q^{-m1} + \text{background} & q <= q_c \\ C q^{-m2} + \text{background} & q > q_c \end{cases} where $q_c$ = the location of the crossover from one slope to the other, $A$ = the scaling coeffi...
[ "numpy.empty", "numpy.errstate", "numpy.power" ]
[((2794, 2813), 'numpy.empty', 'empty', (['q.shape', '"""d"""'], {}), "(q.shape, 'd')\n", (2799, 2813), False, 'from numpy import inf, power, empty, errstate\n'), ((2852, 2877), 'numpy.errstate', 'errstate', ([], {'divide': '"""ignore"""'}), "(divide='ignore')\n", (2860, 2877), False, 'from numpy import inf, power, emp...
import pytest import reinas.queens as queens import numpy as np import models.consultas as consultas def test_numero_reinas(numero): n = int(numero) lista_soluciones = [] session = consultas.loadSession() tablero = np.zeros(shape=(n,n),dtype=int) queens.n_reinas(tablero,0,lista_soluciones) ...
[ "models.consultas.num_soluciones", "models.consultas.loadSession", "numpy.zeros", "reinas.queens.n_reinas" ]
[((194, 217), 'models.consultas.loadSession', 'consultas.loadSession', ([], {}), '()\n', (215, 217), True, 'import models.consultas as consultas\n'), ((232, 265), 'numpy.zeros', 'np.zeros', ([], {'shape': '(n, n)', 'dtype': 'int'}), '(shape=(n, n), dtype=int)\n', (240, 265), True, 'import numpy as np\n'), ((272, 317), ...
"""Align face images given landmarks.""" # MIT License # # Copyright (c) 2017 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the...
[ "align.matlab_cp2tform.get_similarity_transform_for_cv2", "numpy.argmax", "numpy.power", "numpy.ones", "align.mtcnntf.detector.detect", "cv2.warpAffine", "numpy.array", "numpy.matmul", "numpy.vstack" ]
[((1998, 2036), 'align.matlab_cp2tform.get_similarity_transform_for_cv2', 'get_similarity_transform_for_cv2', (['s', 'r'], {}), '(s, r)\n', (2030, 2036), False, 'from align.matlab_cp2tform import get_similarity_transform_for_cv2\n'), ((2051, 2091), 'cv2.warpAffine', 'cv2.warpAffine', (['src_img', 'tfm', 'image_size'], ...
import torch, numpy as np, glob, math, torch.utils.data, scipy.ndimage, multiprocessing as mp import math import MinkowskiEngine as ME from torch.utils.data.sampler import Sampler import os,sys MAX_POINTS=3000000 SEM_COLOR_MAP = { 0: (0., 0., 0.), 1: (174., 199., 232.), 2: (152., 223., 138.), 3: (31.,...
[ "torch.utils.data.DataLoader", "MinkowskiEngine.utils.sparse_quantize", "numpy.floor", "torch.load", "numpy.ones", "numpy.hstack", "multiprocessing.cpu_count", "numpy.cumsum", "torch.utils.data.Dataset.__init__", "torch.randperm", "glob.glob", "torch.zeros", "numpy.vstack", "torch.from_num...
[((1684, 1696), 'numpy.ones', 'np.ones', (['(150)'], {}), '(150)\n', (1691, 1696), True, 'import torch, numpy as np, glob, math, torch.utils.data, scipy.ndimage, multiprocessing as mp\n'), ((2012, 2023), 'numpy.ones', 'np.ones', (['(22)'], {}), '(22)\n', (2019, 2023), True, 'import torch, numpy as np, glob, math, torch...
import time from pathlib import Path import scipy.io import pandas as pd import numpy as np import matplotlib.pyplot as plt import nibabel as nib from nilearn import datasets from nilearn.input_data import MultiNiftiMasker from nilearn.image import get_data from nilearn.mass_univariate import permuted_ols from sklea...
[ "nilearn.input_data.MultiNiftiMasker", "numpy.concatenate", "pandas.DataFrame.from_dict", "pandas.read_csv", "nilearn.mass_univariate.permuted_ols", "time.perf_counter", "numpy.isnan", "nibabel.save", "pathlib.Path", "numpy.sign", "sklearn.feature_selection.VarianceThreshold" ]
[((459, 478), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (476, 478), False, 'import time\n'), ((531, 595), 'pathlib.Path', 'Path', (['"""/mnt/qdata/raheppt1/data/brainage/nako/interim/vbm/test4"""'], {}), "('/mnt/qdata/raheppt1/data/brainage/nako/interim/vbm/test4')\n", (535, 595), False, 'from pathlib...
import shutil from os import mkdir, remove from os.path import dirname, isdir, isfile, join import pytest from geoalchemy2.shape import to_shape from geoalchemy2.types import WKTElement from numpy.testing import assert_almost_equal from rasterio.crs import CRS from snowexsql.projection import * @pytest.mark.paramet...
[ "os.remove", "numpy.testing.assert_almost_equal", "os.path.dirname", "geoalchemy2.shape.to_shape", "pytest.mark.parametrize", "os.path.join", "rasterio.crs.CRS.from_epsg" ]
[((301, 876), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""info, expected"""', "[({'latitude': 39.039, 'longitude': -108.003}, {'easting': 759397.644,\n 'northing': 4325379.675, 'utm_zone': 12}), ({'easting': 759397.644,\n 'northing': 4325379.675, 'utm_zone': 12}, {'latitude': 39.039,\n 'longitu...
# USAGE # python mixed_training.py --dataset Houses-dataset/Houses\ Dataset/ # import the necessary packages from pyimagesearch import datasets from pyimagesearch import models from sklearn.model_selection import train_test_split from keras.layers.core import Dense from keras.models import Model from keras.optimizers ...
[ "keras.layers.core.Dense", "pyimagesearch.models.create_mlp", "numpy.abs", "argparse.ArgumentParser", "numpy.std", "sklearn.model_selection.train_test_split", "pyimagesearch.models.create_cnn", "keras.optimizers.Adam", "keras.models.Model", "pyimagesearch.datasets.process_house_attributes", "num...
[((490, 515), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (513, 515), False, 'import argparse\n'), ((836, 889), 'os.path.sep.join', 'os.path.sep.join', (["[args['dataset'], 'HousesInfo.txt']"], {}), "([args['dataset'], 'HousesInfo.txt'])\n", (852, 889), False, 'import os\n'), ((895, 936), 'p...
import numpy as np import tensorflow as tf from gym_ds3.schedulers.deepsocs.average_reward import AveragePerStepReward from gym_ds3.schedulers.deepsocs.compute_baselines import get_piecewise_linear_fit_baseline from gym_ds3.schedulers.deepsocs.deepsocs_scheduler import Deepsocs from gym_ds3.schedulers.models.deepsocs...
[ "gym_ds3.schedulers.deepsocs.average_reward.AveragePerStepReward", "gym_ds3.schedulers.deepsocs.compute_baselines.get_piecewise_linear_fit_baseline", "gym_ds3.schedulers.models.deepsocs_model.create_deepsocs_graph", "numpy.random.seed", "gym_ds3.schedulers.models.deepsocs_model.create_deepsocs_model", "te...
[((4083, 4143), 'gym_ds3.schedulers.deepsocs.compute_baselines.get_piecewise_linear_fit_baseline', 'get_piecewise_linear_fit_baseline', (['all_cum_reward', 'all_times'], {}), '(all_cum_reward, all_times)\n', (4116, 4143), False, 'from gym_ds3.schedulers.deepsocs.compute_baselines import get_piecewise_linear_fit_baselin...
#! /usr/bin/env python ################################################################################# # File Name : ./layer.py # Created By : yang # Creation Date : [2017-11-15 12:51] # Last Modified : [2017-11-15 13:09] # Description : s...
[ "theano.tensor.concatenate", "lasagne.init.GlorotUniform", "lasagne.init.Constant", "numpy.zeros", "theano.tensor.tensordot", "theano.shared", "theano.tensor.ones" ]
[((741, 775), 'theano.tensor.ones', 'T.ones', (['(1, max_size)'], {'dtype': 'DTYPE'}), '((1, max_size), dtype=DTYPE)\n', (747, 775), True, 'import theano.tensor as T\n'), ((1146, 1192), 'theano.tensor.tensordot', 'T.tensordot', (['feature1d_h', 'self.one', '[[3], [0]]'], {}), '(feature1d_h, self.one, [[3], [0]])\n', (1...
import os, cv2 import torch from torch import nn import numpy as np def weights_path(_file_, _root_num, dirname): basepath = os.path.dirname(_file_) backs = [".."]*_root_num model_dir = os.path.abspath(os.path.join(basepath, *backs, dirname)) return model_dir def _check_ins(name, val, cls, allow_none...
[ "torch.stack", "torch.nn.init.xavier_uniform_", "os.path.dirname", "numpy.expand_dims", "torch.nn.init.constant_", "torch.tensor", "os.path.join", "cv2.resize" ]
[((130, 153), 'os.path.dirname', 'os.path.dirname', (['_file_'], {}), '(_file_)\n', (145, 153), False, 'import os, cv2\n'), ((215, 254), 'os.path.join', 'os.path.join', (['basepath', '*backs', 'dirname'], {}), '(basepath, *backs, dirname)\n', (227, 254), False, 'import os, cv2\n'), ((6262, 6278), 'torch.stack', 'torch....
""" Parser for cechmate format of simplicial complex """ from itertools import chain, combinations from cechmate import Cech, Rips, Alpha import numpy as np from scipy.sparse import coo_matrix from dmt.morse_complex import MorseComplex from dmt.perseus import save_points_perseus_brips, load_points_perseus_brips def...
[ "cechmate.Rips", "cechmate.Cech", "dmt.perseus.load_points_perseus_brips", "scipy.sparse.coo_matrix", "numpy.array", "cechmate.Alpha", "dmt.perseus.save_points_perseus_brips" ]
[((1520, 1587), 'scipy.sparse.coo_matrix', 'coo_matrix', (['(data, (rows, columns))'], {'shape': '(size, size)', 'dtype': 'bool'}), '((data, (rows, columns)), shape=(size, size), dtype=bool)\n', (1530, 1587), False, 'from scipy.sparse import coo_matrix\n'), ((2007, 2023), 'numpy.array', 'np.array', (['points'], {}), '(...
# -*- coding: utf-8 -*- """ Created on Mon Aug 12 11:39:56 2019 @author: autol """ #%% import numpy as np import time from gfun import StepClass,ConvClass,JClass,Hessian from gupdate import UpdateClass #%% methodtion #@accepts(w=np.ndarray) def gradient_descent_f(var, X=0,y=0,w=0,n_iters=1,n...
[ "numpy.stack", "gfun.JClass", "gupdate.UpdateClass", "gfun.ConvClass", "numpy.zeros", "time.time", "gfun.Hessian", "gfun.StepClass" ]
[((651, 662), 'time.time', 'time.time', ([], {}), '()\n', (660, 662), False, 'import time\n'), ((673, 685), 'gfun.Hessian', 'Hessian', (['var'], {}), '(var)\n', (680, 685), False, 'from gfun import StepClass, ConvClass, JClass, Hessian\n'), ((735, 754), 'gfun.JClass', 'JClass', (['var', 'method'], {}), '(var, method)\n...
''' File: main.py Project: sketchKeras File Created: Sunday, 7th October 2018 5:51:22 pm Author: xiaofeng (<EMAIL>) ----- Last Modified: Sunday, 7th October 2018 7:09:45 pm Modified By: xiaofeng (<EMAIL>>) ----- Copyright 2018.06 - 2018 onion Math, onion Math ''' from keras.models import load_model import keras.backen...
[ "keras.models.load_model", "os.makedirs", "numpy.zeros", "os.path.exists", "numpy.amax", "cv2.imread", "os.path.isfile", "tensorflow.ConfigProto", "tensorflow.GPUOptions", "os.path.join" ]
[((1593, 1627), 'keras.models.load_model', 'load_model', (['"""./sketchKeras/mod.h5"""'], {}), "('./sketchKeras/mod.h5')\n", (1603, 1627), False, 'from keras.models import load_model\n'), ((1757, 1805), 'os.path.join', 'os.path.join', (['self.root', '"""line"""', "(id_str + '.png')"], {}), "(self.root, 'line', id_str +...
import pandas as pd import numpy as np from collections import namedtuple from xbbg import const from xbbg.io import logs, param Session = namedtuple('Session', ['start_time', 'end_time']) SessNA = Session(None, None) def get_interval(ticker, session) -> Session: """ Get interval from defined session ...
[ "xbbg.io.logs.get_logger", "pandas.Timestamp", "xbbg.io.param.to_hour", "collections.namedtuple", "numpy.sign", "xbbg.const.exch_info" ]
[((142, 191), 'collections.namedtuple', 'namedtuple', (['"""Session"""', "['start_time', 'end_time']"], {}), "('Session', ['start_time', 'end_time'])\n", (152, 191), False, 'from collections import namedtuple\n'), ((2358, 2382), 'pandas.Timestamp', 'pd.Timestamp', (['start_time'], {}), '(start_time)\n', (2370, 2382), T...
# Copyright (c) 2020 wngfra # Use of this source code is governed by the Apache-2.0 license, see LICENSE import socket from collections import deque import numpy as np import rclpy from rclpy.node import Node from tactile_interfaces.msg import TactileSignal from tactile_interfaces.srv import ChangeState STATE_LIST...
[ "rclpy.spin", "rclpy.init", "socket.socket", "numpy.zeros", "rclpy.shutdown", "numpy.mean", "tactile_interfaces.msg.TactileSignal", "collections.deque" ]
[((4306, 4327), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (4316, 4327), False, 'import rclpy\n'), ((4367, 4382), 'rclpy.spin', 'rclpy.spin', (['pub'], {}), '(pub)\n', (4377, 4382), False, 'import rclpy\n'), ((4387, 4403), 'rclpy.shutdown', 'rclpy.shutdown', ([], {}), '()\n', (4401, 4403), Fal...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Copyright (c) 2019 <NAME> This software is released under the MIT License. See the LICENSE file in the project root for more information. """ import numpy as np import os import six.moves.urllib as urllib import sys import tarfile import tensorflow as tf...
[ "distutils.version.StrictVersion", "cv2.getTickCount", "tensorflow.get_default_graph", "cv2.imshow", "os.path.join", "tensorflow.greater", "sys.path.append", "cv2.getTickFrequency", "cv2.cvtColor", "tensorflow.cast", "tensorflow.squeeze", "tensorflow.GraphDef", "cv2.destroyAllWindows", "cv...
[((873, 933), 'sys.path.append', 'sys.path.append', (['"""/home/pi/models/research/object_detection"""'], {}), "('/home/pi/models/research/object_detection')\n", (888, 933), False, 'import sys\n'), ((1234, 1287), 'os.path.join', 'os.path.join', (['MODEL_NAME', '"""frozen_inference_graph.pb"""'], {}), "(MODEL_NAME, 'fro...