code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" The metastats module contains functions for analysis of the graphs in the Neo4j database. These analytical methods involve metadata, such as taxonomy. Since the edge agglomeration requires the pair list to be updated in between steps, this is one of the few larger queries that cannot be carried out as a batch oper...
[ "mako.scripts.utils._read_config", "uuid.uuid4", "scipy.stats.hypergeom.cdf", "mako.scripts.utils._create_logger", "scipy.stats.spearmanr", "mako.scripts.utils._get_unique", "numpy.round" ]
[((1237, 1265), 'mako.scripts.utils._create_logger', '_create_logger', (["inputs['fp']"], {}), "(inputs['fp'])\n", (1251, 1265), False, 'from mako.scripts.utils import ParentDriver, _get_unique, _create_logger, _read_config\n'), ((1314, 1334), 'mako.scripts.utils._read_config', '_read_config', (['inputs'], {}), '(input...
""" Pyfk is the python version of FK used to calculate the Green's function and the synthetic waveforms for the 1D Earth model. The frequency-Wavenumber (FK) is a synthetic seismogram package used to calculate the Green’s function and the synthetic waveforms of the 1D Earth model. The first version of FK is developed b...
[ "Cython.Build.cythonize", "setuptools.setup", "os.path.dirname", "os.walk", "sys.argv.remove", "numpy.get_include", "inspect.currentframe", "os.path.join", "os.getenv", "setuptools.find_packages" ]
[((1099, 1129), 'os.getenv', 'os.getenv', (['"""PYFK_USE_MPI"""', '"""0"""'], {}), "('PYFK_USE_MPI', '0')\n", (1108, 1129), False, 'import os\n'), ((1404, 1437), 'sys.argv.remove', 'sys.argv.remove', (['"""--CYTHON_TRACE"""'], {}), "('--CYTHON_TRACE')\n", (1419, 1437), False, 'import sys\n'), ((4905, 4926), 'setuptools...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Laon-CRF : Easy-to-use Linear Chain Conditional Random Fields Author: <NAME> License: MIT License Version: 0.0 Email: <EMAIL> Created: May 13, 2015 Copyright (c) 2015 <NAME> """ from read_corpus import read_conll_corpus from feature import FeatureSet, STARTING_...
[ "json.dump", "json.load", "os.getcwd", "numpy.asarray", "numpy.zeros", "datetime.datetime.now", "time.time", "numpy.exp", "feature.FeatureSet", "numpy.dot", "math.log", "read_corpus.read_conll_corpus" ]
[((2364, 2399), 'numpy.zeros', 'np.zeros', (['(time_length, num_labels)'], {}), '((time_length, num_labels))\n', (2372, 2399), True, 'import numpy as np\n'), ((3516, 3551), 'numpy.zeros', 'np.zeros', (['(time_length, num_labels)'], {}), '((time_length, num_labels))\n', (3524, 3551), True, 'import numpy as np\n'), ((116...
# -*- coding: utf-8 -*- from config import * import os import time import torch import numpy as np import torch.nn as nn from torchvision import transforms import torch.nn.functional as F def dump_model(model, epoch, batch_idx="final"): dump_folder = os.path.join(DATASET_BASE, 'models') if not os.path.isdir(...
[ "torch.mean", "os.mkdir", "numpy.load", "numpy.save", "torchvision.transforms.Scale", "os.path.isdir", "torch.load", "time.time", "numpy.argpartition", "os.path.isfile", "torch.clamp", "torch.nn.functional.cosine_similarity", "torchvision.transforms.CenterCrop", "torchvision.transforms.Nor...
[((258, 294), 'os.path.join', 'os.path.join', (['DATASET_BASE', '"""models"""'], {}), "(DATASET_BASE, 'models')\n", (270, 294), False, 'import os\n'), ((598, 640), 'os.path.join', 'os.path.join', (['DATASET_BASE', '"""models"""', 'path'], {}), "(DATASET_BASE, 'models', path)\n", (610, 640), False, 'import os\n'), ((801...
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import geometria_analitica as ga import matplotlib.animation as animation plt.rcParams['figure.figsize'] = (8,6) ax = plt.axes(projection='3d'); ax.set(xlim3d=(-3, 3), xlabel='X') ax.set(ylim3d=(-3, 3), ylabel='Y') ax.set(zlim3...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.axes", "geometria_analitica.reta", "numpy.sin", "numpy.arange", "numpy.array", "numpy.cos", "matplotlib.pyplot.pause" ]
[((211, 236), 'matplotlib.pyplot.axes', 'plt.axes', ([], {'projection': '"""3d"""'}), "(projection='3d')\n", (219, 236), True, 'import matplotlib.pyplot as plt\n'), ((4770, 4798), 'numpy.arange', 'np.arange', (['(0)', '(2 * np.pi)', '(0.1)'], {}), '(0, 2 * np.pi, 0.1)\n', (4779, 4798), True, 'import numpy as np\n'), ((...
from random import random from random import randint from numpy import array from numpy import zeros from keras.models import Sequential from keras.layers import Conv2D from keras.layers import MaxPooling2D from keras.layers import LSTM from keras.layers import Dense from keras.layers import Flatten from keras.layers i...
[ "random.randint", "keras.layers.LSTM", "numpy.zeros", "keras.layers.Flatten", "random.random", "keras.layers.Dense", "keras.layers.Conv2D", "numpy.array", "keras.models.Sequential", "keras.layers.MaxPooling2D" ]
[((1715, 1727), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1725, 1727), False, 'from keras.models import Sequential\n'), ((597, 618), 'random.randint', 'randint', (['lower', 'upper'], {}), '(lower, upper)\n', (604, 618), False, 'from random import randint\n'), ((876, 895), 'numpy.zeros', 'zeros', (['(s...
def example(Simulator): from csdl import Model import csdl import numpy as np class ErrorWrongAxis(Model): def define(self): m = 3 n = 4 p = 5 # Shape of the tensors ten_shape1 = (m, n, p) ten_shape2 = (m, n, ...
[ "csdl.dot", "numpy.arange", "numpy.prod" ]
[((408, 427), 'numpy.prod', 'np.prod', (['ten_shape1'], {}), '(ten_shape1)\n', (415, 427), True, 'import numpy as np\n'), ((460, 479), 'numpy.prod', 'np.prod', (['ten_shape2'], {}), '(ten_shape2)\n', (467, 479), True, 'import numpy as np\n'), ((959, 987), 'csdl.dot', 'csdl.dot', (['ten1', 'ten2'], {'axis': '(1)'}), '(t...
import numpy import chainerx # TODO(sonots): Implement in C++, especially in CUDA def normal(*args, **kwargs): """normal(*args, **kwargs, device=None) Draws random samples from a normal (Gaussian) distribution. This is currently equivalent to :func:`numpy.random.normal` wrapped by :func:`chainerx.a...
[ "numpy.random.uniform", "chainerx.array", "numpy.random.normal" ]
[((457, 493), 'numpy.random.normal', 'numpy.random.normal', (['*args'], {}), '(*args, **kwargs)\n', (476, 493), False, 'import numpy\n'), ((505, 549), 'chainerx.array', 'chainerx.array', (['a'], {'device': 'device', 'copy': '(False)'}), '(a, device=device, copy=False)\n', (519, 549), False, 'import chainerx\n'), ((963,...
import pickle,copy from collections import deque import numpy as np from scipy import constants import xfields as xf from PyPLINE.PyPLINEDElement import PyPLINEDElement from PyHEADTAIL.impedances.wakes import WakeField from PyHEADTAIL.particles.slicing import SliceSet class PyPLINEDWakeField(WakeField,PyPLINEDElemen...
[ "numpy.copy", "PyHEADTAIL.particles.slicing.SliceSet", "numpy.zeros", "PyHEADTAIL.impedances.wakes.WakeField.__init__", "PyPLINE.PyPLINEDElement.PyPLINEDElement.__init__" ]
[((403, 447), 'PyPLINE.PyPLINEDElement.PyPLINEDElement.__init__', 'PyPLINEDElement.__init__', (['self', 'name', 'number'], {}), '(self, name, number)\n', (427, 447), False, 'from PyPLINE.PyPLINEDElement import PyPLINEDElement\n'), ((454, 501), 'PyHEADTAIL.impedances.wakes.WakeField.__init__', 'WakeField.__init__', (['s...
#!/usr/bin/env python3 import pandas as pd import socket import stars import numpy as np from angle import angle_between HOST = "myspace.satellitesabove.me" PORT = 5016 TICKET = 'ticket{golf97715papa:___a bunch of unguessable stuff___}' # Known from previous tries. # The output of this script is deliberately unstabl...
[ "pandas.DataFrame", "stars.find_by_angles", "socket.socket", "numpy.array", "angle.angle_between" ]
[((1077, 1126), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (1090, 1126), False, 'import socket\n'), ((2132, 2160), 'pandas.DataFrame', 'pd.DataFrame', (['data_dict_list'], {}), '(data_dict_list)\n', (2144, 2160), True, 'import pandas as pd...
import numpy def zscore(X, m=None, s=None, in_place=False, limit_memory=False): if (m is not None) and (s is not None): if in_place: for i in range(X.shape[0]): for j in range(X.shape[1]): X[i, j] = (X[i, j] - m[j]) / s[j] return (X, m, s) return ((X - m)/s, m, s) if limit_memory: m, s = compute_...
[ "numpy.std", "numpy.mean", "numpy.zeros_like", "numpy.sqrt" ]
[((483, 504), 'numpy.mean', 'numpy.mean', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (493, 504), False, 'import numpy\n'), ((510, 529), 'numpy.zeros_like', 'numpy.zeros_like', (['m'], {}), '(m)\n', (526, 529), False, 'import numpy\n'), ((648, 661), 'numpy.sqrt', 'numpy.sqrt', (['s'], {}), '(s)\n', (658, 661), False, 'i...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Main module of pySADCP.""" import numpy as np import os import re from pycurrents.data.navcalc import lonlat_inside_km_radius from pycurrents.data.navcalc import great_circle_distance from pycurrents.codas import get_txy def read_meta_from_bft(bftfile): ''' R...
[ "numpy.abs", "pycurrents.codas.get_txy", "numpy.logical_and", "numpy.isscalar", "numpy.asarray", "os.path.exists", "numpy.genfromtxt", "pycurrents.data.navcalc.great_circle_distance", "numpy.rec.fromarrays", "numpy.any", "numpy.diff", "numpy.array", "pycurrents.data.navcalc.lonlat_inside_km_...
[((446, 486), 're.compile', 're.compile', (['"""CRUISE_NAME"""', 're.IGNORECASE'], {}), "('CRUISE_NAME', re.IGNORECASE)\n", (456, 486), False, 'import re\n'), ((505, 547), 're.compile', 're.compile', (['"""SAC_CRUISE_ID"""', 're.IGNORECASE'], {}), "('SAC_CRUISE_ID', re.IGNORECASE)\n", (515, 547), False, 'import re\n'),...
# -*- coding: utf-8 -*- """ Created on Thu Mar 5 09:51:35 2020 @author: Berk """ #Libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.linear_model import Ridge from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRe...
[ "matplotlib.pyplot.title", "sklearn.model_selection.train_test_split", "pandas_profiling.ProfileReport", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.mean", "folium.Map", "seaborn.pairplot", "sklearn.tree.DecisionTreeRegressor", "time.process_time", "sklearn.linear_model.Ridge", "matplo...
[((2762, 2781), 'pandas.read_excel', 'pd.read_excel', (['path'], {}), '(path)\n', (2775, 2781), True, 'import pandas as pd\n'), ((10591, 10610), 'time.process_time', 'time.process_time', ([], {}), '()\n', (10608, 10610), False, 'import time\n'), ((1590, 1678), 'pandas.read_excel', 'pd.read_excel', (['"""D:\\\\Documents...
import numpy as np from ripser import ripser from scipy.spatial.distance import pdist, squareform from gudhi.clustering.tomato import Tomato from umap import UMAP import pandas as pd from tqdm import tqdm from cosine_hack import umap_hack def calculate_persistence( cluster, num_of_neurons, maxdim=1, coeff=47, num...
[ "numpy.load", "ripser.ripser", "pandas.DataFrame.from_dict", "numpy.isinf", "numpy.argsort", "umap.UMAP", "scipy.spatial.distance.pdist", "numpy.array", "gudhi.clustering.tomato.Tomato", "cosine_hack.umap_hack", "numpy.unique" ]
[((1634, 1743), 'cosine_hack.umap_hack', 'umap_hack', ([], {'activity': 'activity', 'n_components': 'activity.shape[1]', 'verbose': '(True)', 'n_neighbors': '(15)', 'min_dist': '(0.01)'}), '(activity=activity, n_components=activity.shape[1], verbose=True,\n n_neighbors=15, min_dist=0.01)\n', (1643, 1743), False, 'fr...
import glob import cv2 import os from random import sample import torch from torch.utils.data import Dataset from torchvision.datasets import CocoDetection import torchvision.transforms as transforms from pycocotools.coco import COCO from PIL import Image import matplotlib.pyplot as plt import matplotlib.patches as...
[ "cv2.cvtColor", "numpy.ones", "PIL.Image.open", "cv2.imread", "numpy.min", "numpy.where", "numpy.array", "numpy.max", "torch.zeros", "torch.as_tensor", "torch.tensor", "os.path.join", "numpy.unique" ]
[((933, 955), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (943, 955), False, 'import cv2\n'), ((970, 1006), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BGR2RGB)\n', (982, 1006), False, 'import cv2\n'), ((1061, 1082), 'PIL.Image.open', 'Image.open', (['mas...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import re import tensorflow as tf import numpy as np import iris_input from iris_flags import * INPUT_SIZE = iris_input.INPUT_SIZE NUM_CLASSES = iris_input.NUM_CLASSES NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN = iris...
[ "tensorflow.contrib.layers.xavier_initializer", "numpy.load", "tensorflow.nn.zero_fraction", "numpy.abs", "tensorflow.get_collection", "numpy.ones", "tensorflow.multiply", "tensorflow.matmul", "tensorflow.nn.conv2d", "tensorflow.get_variable", "tensorflow.train.ExponentialMovingAverage", "tens...
[((1922, 1954), 'numpy.array', 'np.array', (['prob'], {'dtype': 'np.float32'}), '(prob, dtype=np.float32)\n', (1930, 1954), True, 'import numpy as np\n'), ((2048, 2081), 'numpy.log', 'np.log', (['(init_val / (1 - init_val))'], {}), '(init_val / (1 - init_val))\n', (2054, 2081), True, 'import numpy as np\n'), ((7157, 72...
import pandas as pd import numpy as np import glob def df_anno_bool(csv_path,header= False): # Lädt CSV als Dataframe ein und ändert Annotation in True/False if header: df = pd.read_csv(csv_path, sep=";", header=0, engine="python") else: headline = ["Page","txtlen","url","sitename", "d...
[ "pandas.read_csv", "numpy.select", "glob.glob" ]
[((2467, 2563), 'glob.glob', 'glob.glob', (['"""/home/dsturm/Desktop/litblogs/Austauschordner/Skripts/test/ev_text/**.csv"""'], {}), "(\n '/home/dsturm/Desktop/litblogs/Austauschordner/Skripts/test/ev_text/**.csv'\n )\n", (2476, 2563), False, 'import glob\n'), ((954, 1011), 'pandas.read_csv', 'pd.read_csv', (['cs...
import matplotlib.pyplot as plt import numpy as np from keras.callbacks import ReduceLROnPlateau from keras.datasets import fashion_mnist from keras.models import Sequential from keras.layers import Activation, Dense, Flatten, LeakyReLU, Conv2D, MaxPooling2D, BatchNormalization from keras.optimizers import Adam...
[ "keras.preprocessing.image.ImageDataGenerator", "keras.layers.LeakyReLU", "numpy.random.seed", "matplotlib.pyplot.show", "keras.layers.Activation", "keras.callbacks.ReduceLROnPlateau", "keras.layers.Flatten", "numpy.expand_dims", "keras.optimizers.Adam", "keras.utils.to_categorical", "keras.laye...
[((463, 483), 'numpy.random.seed', 'np.random.seed', (['(1000)'], {}), '(1000)\n', (477, 483), True, 'import numpy as np\n'), ((693, 718), 'keras.datasets.fashion_mnist.load_data', 'fashion_mnist.load_data', ([], {}), '()\n', (716, 718), False, 'from keras.datasets import fashion_mnist\n'), ((782, 975), 'keras.preproce...
# -*- coding: utf-8 -*- """ Created on Tue Oct 2 10:59:59 2018 @author: <NAME> """ import pytest import numpy as np import pandas as pd import scipy.sparse as sps from sklearn.exceptions import NotFittedError try: from sklearn.model_selection._validation import safe_indexing except ImportError: from sklear...
[ "aikit.transformers.block_selector.BlockSelector", "numpy.may_share_memory", "numpy.random.seed", "numpy.random.randn", "scipy.sparse.coo_matrix", "pytest.raises", "numpy.array", "numpy.arange", "aikit.transformers.block_selector.BlockManager" ]
[((515, 534), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (529, 534), True, 'import numpy as np\n'), ((632, 663), 'numpy.random.randn', 'np.random.randn', (['df.shape[0]', '(5)'], {}), '(df.shape[0], 5)\n', (647, 663), True, 'import numpy as np\n'), ((799, 818), 'aikit.transformers.block_selector...
# CS771 ASSIGNMENT-3 BY GROUP-21 # TEAM MEMBERS: <NAME> (170765), <NAME> (170039), <NAME> (170195), <NAME> (170722), <NAME> (170236) import numpy as np from tensorflow import keras import Preprocessor dim = 30 mypreprocessor = Preprocessor.Preprocessor() model = keras.models.load_model('model.h5') def decaptcha(file...
[ "tensorflow.keras.models.load_model", "numpy.argmax", "Preprocessor.Preprocessor", "numpy.amax", "numpy.array" ]
[((229, 256), 'Preprocessor.Preprocessor', 'Preprocessor.Preprocessor', ([], {}), '()\n', (254, 256), False, 'import Preprocessor\n'), ((265, 300), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (['"""model.h5"""'], {}), "('model.h5')\n", (288, 300), False, 'from tensorflow import keras\n'), ((487, 52...
# packages import numpy as np import pandas as pd import scipy as sy from scipy import signal def load_data(filename: str, label: int): ''' filename - is the file to load data from label - what to label windows from this file as an int 0:'move_up', 1:'move_down', ...
[ "pandas.DataFrame", "numpy.load", "numpy.save", "scipy.signal.sosfilt", "pandas.TimedeltaIndex", "scipy.signal.butter" ]
[((379, 401), 'numpy.load', 'np.load', (['f"""{filename}"""'], {}), "(f'{filename}')\n", (386, 401), True, 'import numpy as np\n'), ((436, 535), 'pandas.DataFrame', 'pd.DataFrame', (["{'time': data[:, 0], 'emg1': data[:, 1], 'emg2': data[:, 2], 'pos_v': data[\n :, 3]}"], {}), "({'time': data[:, 0], 'emg1': data[:, 1...
import model as M import tensorflow as tf import numpy as np # ------ START data generator --------- max_digit = 6 int2binary = {} largest_num = pow(2,max_digit) binary = np.unpackbits(np.array([range(largest_num)],dtype=np.uint8).T,axis=1) for i in range(largest_num): int2binary[i] = binary[i] def getInputVecto...
[ "model.SimpleLSTM", "model.Model", "tensorflow.Session", "tensorflow.nn.sigmoid_cross_entropy_with_logits", "tensorflow.variable_scope", "tensorflow.placeholder", "numpy.random.randint", "numpy.array", "numpy.int32", "tensorflow.train.AdamOptimizer", "model.loadSess" ]
[((982, 1022), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, 6, 2]'], {}), '(tf.float32, [None, 6, 2])\n', (996, 1022), True, 'import tensorflow as tf\n'), ((1028, 1057), 'model.SimpleLSTM', 'M.SimpleLSTM', (['(5)'], {'out_func': 'mod'}), '(5, out_func=mod)\n', (1040, 1057), True, 'import model as...
from PIL import Image , ImageDraw from tqdm import tqdm import numpy as np import glob import sys import cv2 import psutil from keras.models import model_from_json print("Getting model") json_file = open('model\car_detection.json', 'r') loaded_model_json = json_file.read() json_file.close() model = model_...
[ "cv2.resize", "psutil.virtual_memory", "cv2.VideoWriter", "cv2.VideoWriter_fourcc", "numpy.asarray", "numpy.expand_dims", "PIL.Image.open", "cv2.VideoCapture", "keras.models.model_from_json", "glob.glob", "PIL.ImageDraw.Draw", "sys.exit" ]
[((314, 348), 'keras.models.model_from_json', 'model_from_json', (['loaded_model_json'], {}), '(loaded_model_json)\n', (329, 348), False, 'from keras.models import model_from_json\n'), ((660, 676), 'PIL.Image.open', 'Image.open', (['path'], {}), '(path)\n', (670, 676), False, 'from PIL import Image, ImageDraw\n'), ((78...
import tensorflow as tf import lasagne import theano import time import numpy as np import cPickle as cp #serializing and de-serializing a Python object structure import theano.tensor as T from sliding_window import sliding_window # Hardcoded number of sensor channels employed in the OPPORTUNITY challenge NB_SENSOR_...
[ "numpy.argmax", "tensorflow.reshape", "tensorflow.train.RMSPropOptimizer", "cPickle.load", "tensorflow.matmul", "tensorflow.ConfigProto", "tensorflow.contrib.rnn.static_rnn", "tensorflow.nn.conv2d", "tensorflow.split", "tensorflow.nn.softmax_cross_entropy_with_logits", "tensorflow.placeholder", ...
[((5694, 5737), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[None, 24, 113, 1]'], {}), "('float', [None, 24, 113, 1])\n", (5708, 5737), True, 'import tensorflow as tf\n'), ((5742, 5777), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[None, 18]'], {}), "('float', [None, 18])\n", (5756, ...
""" Module for the data loading pipeline for the model to train """ from torchvision.datasets.vision import VisionDataset from PIL import Image import cv2 import numpy as np import os import random class imgdataset(VisionDataset): def __init__(self, rootlist, process=None, transform=None, randomdrop=0):...
[ "random.shuffle", "PIL.Image.open", "numpy.array", "PIL.Image.fromarray", "os.path.join", "os.listdir", "cv2.resize" ]
[((853, 881), 'random.shuffle', 'random.shuffle', (['self.dataset'], {}), '(self.dataset)\n', (867, 881), False, 'import random\n'), ((1210, 1225), 'PIL.Image.open', 'Image.open', (['img'], {}), '(img)\n', (1220, 1225), False, 'from PIL import Image\n'), ((1241, 1254), 'numpy.array', 'np.array', (['img'], {}), '(img)\n...
import numpy as np import matplotlib.pyplot as plt from PIL import Image from scipy.spatial import distance from skimage.feature import peak_local_max from scipy import stats,ndimage import os #import seaborn as sns files_per_batch = 18 tresh_mov = 0.3 tresh_gat = 0.25 tresh_glut1 = 0.3 min_dist = 5 de...
[ "skimage.feature.peak_local_max", "matplotlib.pyplot.boxplot", "matplotlib.pyplot.figure", "matplotlib.pyplot.gca", "os.path.join", "scipy.ndimage.center_of_mass", "scipy.stats.mannwhitneyu", "matplotlib.pyplot.imshow", "matplotlib.pyplot.subplots", "scipy.spatial.distance.cdist", "scipy.stats.n...
[((1761, 1777), 'os.listdir', 'os.listdir', (['root'], {}), '(root)\n', (1771, 1777), False, 'import os\n'), ((4530, 4552), 'numpy.array', 'np.array', (['min_dist_gat'], {}), '(min_dist_gat)\n', (4538, 4552), True, 'import numpy as np\n'), ((4571, 4595), 'numpy.array', 'np.array', (['min_dist_glut1'], {}), '(min_dist_g...
from __future__ import division, print_function import numpy as np import os from scipy.stats import multivariate_normal import sys import struct try: import sounddevice as sd have_sounddevice = True except: have_sounddevice = False from .stft import stft from .acoustics import mfcc class CircularGauss...
[ "matplotlib.pyplot.title", "numpy.sum", "numpy.abs", "os.walk", "numpy.ones", "numpy.mean", "numpy.arange", "numpy.random.normal", "matplotlib.pyplot.tick_params", "numpy.diag", "os.path.join", "matplotlib.pyplot.axvline", "matplotlib.pyplot.imshow", "matplotlib.pyplot.yticks", "os.path....
[((14073, 14130), 'numpy.frombuffer', 'np.frombuffer', (['data'], {'dtype': '_byte_format[bytes_per_sample]'}), '(data, dtype=_byte_format[bytes_per_sample])\n', (14086, 14130), True, 'import numpy as np\n'), ((1163, 1192), 'numpy.concatenate', 'np.concatenate', (['gamma'], {'axis': '(0)'}), '(gamma, axis=0)\n', (1177,...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import torch import torch.nn as nn from torch import optim import json import numpy as np import pandas as pd from tqdm import tqdm import confidence_interval with open('modules/config.txt', 'r') as f: args = json.load(f) if args["mechanism"] == "dot": fro...
[ "pandas.DataFrame", "json.load", "numpy.random.seed", "modules.model_components_bc.encoder.Encoder", "torch.manual_seed", "torch.load", "modules.model_components_bc.classifier.train", "torch.nn.CrossEntropyLoss", "modules.model_components_bc.classifier.Model", "modules.model_components_bc.classifi...
[((263, 275), 'json.load', 'json.load', (['f'], {}), '(f)\n', (272, 275), False, 'import json\n'), ((5846, 5886), 'glob.glob', 'glob.glob', (["(args['save_path'] + '*.model')"], {}), "(args['save_path'] + '*.model')\n", (5855, 5886), False, 'import glob\n'), ((8066, 8124), 'confidence_interval.confidence_interval', 'co...
import numpy as np from simulations_X import options, produce_synthetic_data def formula(x, n=None): if n is None: n = x.shape[0] x1 = x[:, 0] x2 = x[:, 1] x3 = x[:, 2] x4 = x[:, 3] x1 = 3 * x1 x2 = 3 * x2 ** 3 x3 = 3 * x3 ** -1 x4 = 5 * (x4 > 0).astype(int) eps = np...
[ "simulations_X.produce_synthetic_data", "simulations_X.options", "numpy.random.normal" ]
[((318, 362), 'numpy.random.normal', 'np.random.normal', ([], {'loc': '(0.0)', 'scale': '(1.0)', 'size': 'n'}), '(loc=0.0, scale=1.0, size=n)\n', (334, 362), True, 'import numpy as np\n'), ((433, 442), 'simulations_X.options', 'options', ([], {}), '()\n', (440, 442), False, 'from simulations_X import options, produce_s...
# Implemented by <NAME> following https://arxiv.org/abs/1909.12892 # with the help of https://drive.google.com/drive/folders/1yjhztFeX67tHEImXCiP_UAQfQ-wFvV4Y import numpy as np import tensorflow as tf from TeachMyAgent.teachers.algos.AbstractTeacher import AbstractTeacher from TeachMyAgent.teachers.utils.setter_solve...
[ "tensorflow.global_variables_initializer", "tensorflow.Session", "tensorflow.set_random_seed", "tensorflow.ConfigProto", "TeachMyAgent.teachers.algos.AbstractTeacher.AbstractTeacher.__init__", "numpy.array", "TeachMyAgent.teachers.utils.setter_solver_utils.FlatRnvp", "TeachMyAgent.teachers.utils.sette...
[((2007, 2085), 'TeachMyAgent.teachers.algos.AbstractTeacher.AbstractTeacher.__init__', 'AbstractTeacher.__init__', (['self', 'mins', 'maxs', 'env_reward_lb', 'env_reward_ub', 'seed'], {}), '(self, mins, maxs, env_reward_lb, env_reward_ub, seed)\n', (2031, 2085), False, 'from TeachMyAgent.teachers.algos.AbstractTeacher...
#!/usr/bin/env python3 import os import pyimgur import numpy as np import matplotlib.pyplot as plt import webbrowser def getCost(file_name: str): ret = [] merge = 4 with open(file_name, "r") as inputFile: for line in inputFile.readlines(): ret += [list(map(int, line.split()[1:]))] ...
[ "webbrowser.open", "matplotlib.pyplot.show", "os.cpu_count", "numpy.array", "pyimgur.Imgur", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((463, 477), 'os.cpu_count', 'os.cpu_count', ([], {}), '()\n', (475, 477), False, 'import os\n'), ((575, 593), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(3)'], {}), '(1, 3)\n', (587, 593), True, 'import matplotlib.pyplot as plt\n'), ((1552, 1591), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""/tmp/re...
# Functions for loading and processing features. # # 1. load_and_proc_feats - Load features on which VAD have already been applied. Produces idx. # 2. load_and_proc_feats_segm - As 1. but allows for uniformly sampled lenght between min_len and max_len # 3. load_and_proc_feats_expand - Loa...
[ "numpy.sum", "numpy.concatenate", "numpy.hamming", "numpy.fromfile", "numpy.genfromtxt", "numpy.insert", "numpy.hstack", "pytel.htk.readhtk", "numpy.min", "os.path.isfile", "numpy.random.randint", "numpy.cumsum", "pytel.htk.readhtk_segment", "utils.misc.get_logger", "re.sub", "numpy.vs...
[((1785, 1797), 'utils.misc.get_logger', 'get_logger', ([], {}), '()\n', (1795, 1797), False, 'from utils.misc import get_logger\n'), ((2481, 2500), 're.compile', 're.compile', (['"""-\\\\d+"""'], {}), "('-\\\\d+')\n", (2491, 2500), False, 'import re\n'), ((2205, 2225), 'numpy.insert', 'np.insert', (['idx', '(0)', '(0)...
# -*- coding: utf-8 -*- """ Created on Sat Mar 16 17:51:36 2019 @author: <NAME> <NAME> <EMAIL> """ import geopandas as gpd import numpy as np import special_dataset as sd def get_list_of_codes(): norway_set = gpd.read_file('Basisdata_0000_Norge_25833_Postnummeromrader_SOSI_Postnummerområde_FLATE.shp') n...
[ "numpy.sort", "special_dataset.make_df", "geopandas.read_file" ]
[((221, 324), 'geopandas.read_file', 'gpd.read_file', (['"""Basisdata_0000_Norge_25833_Postnummeromrader_SOSI_Postnummerområde_FLATE.shp"""'], {}), "(\n 'Basisdata_0000_Norge_25833_Postnummeromrader_SOSI_Postnummerområde_FLATE.shp'\n )\n", (234, 324), True, 'import geopandas as gpd\n'), ((700, 737), 'numpy.sort',...
import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, auc from sklearn.metrics import roc_auc_score import csv import sys import pandas as pd import numpy as np import seaborn as sns def ro_curve(y_pred, y_label, method_name): ''' y_pred is a list of length n. (0,1) y_label is...
[ "matplotlib.pyplot.title", "seaborn.lineplot", "matplotlib.pyplot.xlim", "sklearn.metrics.roc_curve", "matplotlib.pyplot.ylim", "pandas.read_csv", "matplotlib.pyplot.legend", "sklearn.metrics.auc", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel...
[((507, 524), 'numpy.array', 'np.array', (['y_label'], {}), '(y_label)\n', (515, 524), True, 'import numpy as np\n'), ((538, 554), 'numpy.array', 'np.array', (['y_pred'], {}), '(y_pred)\n', (546, 554), True, 'import numpy as np\n'), ((635, 661), 'sklearn.metrics.roc_curve', 'roc_curve', (['y_label', 'y_pred'], {}), '(y...
"""Dataset loader and utilities for D4RL.""" from acme import types import numpy as np import reverb import tensorflow as tf import tree def normalize_obs(dataset, eps=1e-3): mean = dataset["observations"].mean(axis=0) std = dataset["observations"].std(axis=0) + eps o_t = (dataset["observations"] - mean) ...
[ "tensorflow.constant", "reverb.ReplaySample", "tensorflow.cast", "numpy.random.randint", "tensorflow.data.Dataset.from_generator", "tree.map_structure" ]
[((1164, 1195), 'reverb.ReplaySample', 'reverb.ReplaySample', (['info', 'data'], {}), '(info, data)\n', (1183, 1195), False, 'import reverb\n'), ((1261, 1304), 'tree.map_structure', 'tree.map_structure', (['(lambda x: x.dtype)', 'data'], {}), '(lambda x: x.dtype, data)\n', (1279, 1304), False, 'import tree\n'), ((1318,...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 8 14:51:16 2019 @author: zoescrewvala """ import os #import cartopy import matplotlib.pyplot as plt #from matplotlib.lines import Line2D import numpy as np import pandas as pd import xarray as xr from datetime import datetime import time #%% X-Y PL...
[ "time.strptime", "numpy.sum", "pandas.date_range", "os.makedirs", "os.getcwd", "os.path.exists", "numpy.ones", "matplotlib.pyplot.subplots" ]
[((919, 978), 'pandas.date_range', 'pd.date_range', ([], {'start': '"""10/1/1979"""', 'end': '"""9/1/2017"""', 'freq': '"""MS"""'}), "(start='10/1/1979', end='9/1/2017', freq='MS')\n", (932, 978), True, 'import pandas as pd\n'), ((1129, 1159), 'numpy.ones', 'np.ones', (['(116, 456)'], {'dtype': 'int'}), '((116, 456), d...
import sys from typing import List, Union from datetime import datetime import subprocess import shlex import inspect from pathlib import Path from tqdm import tqdm import cv2 import numpy as np import torch import torch.nn as nn def most(l: List[bool], factor=0.67): ''' Like List.all(), but not 'all' of the...
[ "numpy.stack", "cv2.resize", "inspect.isroutine", "cv2.cvtColor", "cv2.VideoCapture", "urllib.request.urlretrieve", "datetime.datetime.now", "subprocess.check_call" ]
[((638, 680), 'subprocess.check_call', 'subprocess.check_call', (['command'], {'shell': '(True)'}), '(command, shell=True)\n', (659, 680), False, 'import subprocess\n'), ((4425, 4445), 'cv2.VideoCapture', 'cv2.VideoCapture', (['fp'], {}), '(fp)\n', (4441, 4445), False, 'import cv2\n'), ((5045, 5079), 'numpy.stack', 'np...
from __future__ import absolute_import from collections import defaultdict import numpy as np import torch from torch.utils.data.sampler import Sampler class RandomIdentitySampler(Sampler): """ Randomly sample P identities, then for each identity, randomly sample K instances, therefore batch size ...
[ "collections.defaultdict", "torch.randperm", "numpy.random.choice" ]
[((901, 918), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (912, 918), False, 'from collections import defaultdict\n'), ((1409, 1444), 'torch.randperm', 'torch.randperm', (['self.num_identities'], {}), '(self.num_identities)\n', (1423, 1444), False, 'import torch\n'), ((1962, 2023), 'numpy.rand...
import sys import os sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),'../'))) import tensorflow as tf import numpy as np from transformers import DistilBertTokenizerFast from transformers import TFDistilBertMainLayer from shared.attention import AttentionWithContext class SQPBuilder(): """ ...
[ "numpy.array", "os.path.dirname", "tensorflow.keras.models.load_model", "transformers.DistilBertTokenizerFast.from_pretrained" ]
[((1649, 1806), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['modelPath'], {'custom_objects': "{'AttentionWithContext': AttentionWithContext, 'TFDistilBertMainLayer':\n TFDistilBertMainLayer}"}), "(modelPath, custom_objects={\n 'AttentionWithContext': AttentionWithContext, 'TFDistilBertMa...
#!/usr/bin/env python3 '''Viewer functions for Jupyter notebooks.''' import numpy as np from numpy.linalg import norm try: from nglview import NGLWidget, TextStructure from vispy import scene except ImportError: print('ERROR: Necessary addon dependencies not found. To use this module,\n' ' i...
[ "vispy.scene.visuals.Markers", "numpy.mean", "numpy.linalg.norm", "nglview.NGLWidget", "vispy.scene.SceneCanvas" ]
[((984, 1003), 'nglview.NGLWidget', 'NGLWidget', ([], {}), '(**kwargs)\n', (993, 1003), False, 'from nglview import NGLWidget, TextStructure\n'), ((3202, 3267), 'vispy.scene.SceneCanvas', 'scene.SceneCanvas', ([], {'keys': '"""interactive"""', 'show': '(True)', 'size': '(400, 400)'}), "(keys='interactive', show=True, s...
from os import truncate import matplotlib from floodsystem.analysis import polyfit from floodsystem.datafetcher import fetch_measure_levels import datetime import numpy as np from floodsystem.plot import plot_water_level_with_fit from floodsystem.utils import sorted_by_key def categorise_town_flood_risk(stations, dt, ...
[ "floodsystem.utils.sorted_by_key", "numpy.std", "floodsystem.analysis.polyfit", "floodsystem.plot.plot_water_level_with_fit", "numpy.mean", "datetime.timedelta", "matplotlib.dates.date2num" ]
[((3747, 3767), 'numpy.mean', 'np.mean', (['total_risks'], {}), '(total_risks)\n', (3754, 3767), True, 'import numpy as np\n'), ((4026, 4045), 'numpy.std', 'np.std', (['total_risks'], {}), '(total_risks)\n', (4032, 4045), True, 'import numpy as np\n'), ((4936, 4981), 'floodsystem.utils.sorted_by_key', 'sorted_by_key', ...
import os.path as osp import time import torch import torch.nn.functional as F from torch_geometric.datasets import Reddit from torch_geometric.data import NeighborSampler from torch_geometric.nn import SAGEConv, GATConv, SAGELafConv from torch.nn import Linear import numpy as np import math from sklearn.metrics import...
[ "sklearn.metrics.accuracy_score", "torch_geometric.datasets.Reddit", "torch.nn.functional.dropout", "sklearn.metrics.classification_report", "sklearn.metrics.f1_score", "numpy.mean", "numpy.unique", "torch_geometric.data.NeighborSampler", "numpy.random.RandomState", "torch.nn.functional.log_softma...
[((1445, 1470), 'math.ceil', 'math.ceil', (['(n_data / folds)'], {}), '(n_data / folds)\n', (1454, 1470), False, 'import math\n'), ((3827, 3850), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (3844, 3850), False, 'import torch\n'), ((3971, 3983), 'torch_geometric.datasets.Reddit', 'Reddit', (['p...
import cv2 import os import numpy as np from Normalize_and_crop import normalize_crop from P3_par_contornos import main_par path = "database_files/exams/NM7510_P3_B_2019_2/NM7510_P3_pacote_B_2_sem_2019-54.png" template = cv2.imread('database_files/track_markers/template.png',cv2.IMREAD_GRAYSCALE) template2 = cv2.imre...
[ "cv2.boundingRect", "cv2.bitwise_not", "cv2.dilate", "cv2.cvtColor", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.threshold", "numpy.zeros", "numpy.ones", "P3_par_contornos.main_par", "cv2.imread", "cv2.connectedComponentsWithStats", "Normalize_and_crop.normalize_crop", "cv2.imshow", "cv...
[((223, 300), 'cv2.imread', 'cv2.imread', (['"""database_files/track_markers/template.png"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('database_files/track_markers/template.png', cv2.IMREAD_GRAYSCALE)\n", (233, 300), False, 'import cv2\n'), ((312, 390), 'cv2.imread', 'cv2.imread', (['"""database_files/track_markers/template2....
import numpy as np # ResNet-18, 5 classes, 25,000 images, 100 linear probing epochs, classical def results(): accs = np.array( [(31.26, (0, 0)), (36.82, (0, 13)), (38.36, (0, 26)), (38.92, (0, 39)), (40.38, (0, 52)), (40.44, (0, 65)), (40.46, (0, 78)), (39.36, (0, 91)), (37.32, (1, 0)), (41.32, (...
[ "numpy.array" ]
[((123, 436), 'numpy.array', 'np.array', (['[(31.26, (0, 0)), (36.82, (0, 13)), (38.36, (0, 26)), (38.92, (0, 39)), (\n 40.38, (0, 52)), (40.44, (0, 65)), (40.46, (0, 78)), (39.36, (0, 91)),\n (37.32, (1, 0)), (41.32, (1, 13)), (41.44, (1, 26)), (43.14, (1, 39)),\n (44.3, (1, 52)), (45.88, (1, 65)), (44.7, (1,...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 16 19:32:55 2020 @author: sugarkhuu """ # Ensemble of Multiple Regression and CatBoost # Air pollution prediction Mongolia s_dir = '/home/sugarkhuu/Documents/python/airPollutionMongolia' #s_dir = "C:\\Users\\sugar\\Documents\\my\\py\\airPollutionM...
[ "pandas.read_csv", "numpy.exp", "pandas.set_option", "os.chdir", "sklearn.metrics.mean_squared_error" ]
[((435, 473), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(500)'], {}), "('display.max_rows', 500)\n", (448, 473), True, 'import pandas as pd\n'), ((474, 515), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(500)'], {}), "('display.max_columns', 500)\n", (487, 515), True, '...
import numpy as np import cv2 import glob import pickle import matplotlib.pyplot as plt def main(): # Load calibration images images = glob.glob('camera_cal/*.jpg') mtx, dist = calib_cam(images, num_checker_pts=(9, 6)) # Save the camera calibration result for later use dist_pickle = {} dist_p...
[ "cv2.findChessboardCorners", "matplotlib.pyplot.show", "cv2.cvtColor", "cv2.imwrite", "numpy.zeros", "cv2.imread", "cv2.calibrateCamera", "glob.glob", "matplotlib.pyplot.subplots", "cv2.undistort" ]
[((145, 174), 'glob.glob', 'glob.glob', (['"""camera_cal/*.jpg"""'], {}), "('camera_cal/*.jpg')\n", (154, 174), False, 'import glob\n'), ((948, 986), 'numpy.zeros', 'np.zeros', (['(n_px * n_py, 3)', 'np.float32'], {}), '((n_px * n_py, 3), np.float32)\n', (956, 986), True, 'import numpy as np\n'), ((1752, 1815), 'cv2.ca...
import cog import cv2 import tempfile import torch import numpy as np import os from pathlib import Path from utils import Preprocess from models import ResnetGenerator class Predictor(cog.Predictor): def setup(self): pass @cog.input("photo", type=Path, help="portrait photo (size < 1M)") def pred...
[ "cv2.cvtColor", "torch.load", "cog.input", "os.path.exists", "numpy.transpose", "tempfile.mkdtemp", "torch.cuda.is_available", "models.ResnetGenerator", "utils.Preprocess", "torch.no_grad", "cv2.resize", "torch.from_numpy" ]
[((243, 307), 'cog.input', 'cog.input', (['"""photo"""'], {'type': 'Path', 'help': '"""portrait photo (size < 1M)"""'}), "('photo', type=Path, help='portrait photo (size < 1M)')\n", (252, 307), False, 'import cog\n'), ((502, 514), 'utils.Preprocess', 'Preprocess', ([], {}), '()\n', (512, 514), False, 'from utils import...
#!/usr/bin/env python3 import rospy import tf2_ros import numpy as np from copy import deepcopy from sensor_msgs.msg import CameraInfo from tf2_geometry_msgs import PoseStamped from gazebo_msgs.msg import ModelStates, ModelState from humanoid_league_msgs.msg import PoseWithCertainty, PoseWithCertaintyArray rospy.init...
[ "rospy.logwarn", "copy.deepcopy", "rospy.Subscriber", "rospy.Time.now", "tf2_geometry_msgs.PoseStamped", "tf2_ros.TransformListener", "rospy.Publisher", "rospy.Time", "rospy.is_shutdown", "rospy.Duration", "rospy.init_node", "numpy.reshape", "numpy.matmul", "rospy.spin", "humanoid_league...
[((310, 344), 'rospy.init_node', 'rospy.init_node', (['"""fake_vis_in_sim"""'], {}), "('fake_vis_in_sim')\n", (325, 344), False, 'import rospy\n'), ((407, 443), 'tf2_ros.TransformListener', 'tf2_ros.TransformListener', (['tf_buffer'], {}), '(tf_buffer)\n', (432, 443), False, 'import tf2_ros\n'), ((373, 391), 'rospy.Dur...
import xarray as xr import numpy as np import cv2 import scipy.interpolate def fillmiss(x): if x.ndim != 2: raise ValueError("X have only 2 dimensions.") mask = ~np.isnan(x) xx, yy = np.meshgrid(np.arange(x.shape[1]), np.arange(x.shape[0])) xym = np.vstack( (np.ravel(xx[mask]), np.ravel(yy[mas...
[ "numpy.ravel", "numpy.empty", "numpy.isnan", "numpy.arange", "xarray.DataArray", "numpy.linspace", "cv2.resize" ]
[((341, 358), 'numpy.ravel', 'np.ravel', (['x[mask]'], {}), '(x[mask])\n', (349, 358), True, 'import numpy as np\n'), ((611, 664), 'numpy.linspace', 'np.linspace', (['x0', 'xlast'], {'num': 'newlength', 'endpoint': '(False)'}), '(x0, xlast, num=newlength, endpoint=False)\n', (622, 664), True, 'import numpy as np\n'), (...
from random import randrange as rand import multiprocessing import numpy as np from multiprocessing import shared_memory import torch import math import random from torchvision import transforms import time import copy import os import sys episodes = 25000 load_previous = False evaluation = False make_trial = True ...
[ "os.mkdir", "torch.argmax", "numpy.mean", "numpy.linalg.norm", "torch.device", "multiprocessing.shared_memory.SharedMemory", "random.randint", "torchvision.transforms.ToPILImage", "torch.nn.Linear", "torch.zeros", "copy.deepcopy", "time.sleep", "random.random", "torch.cuda.is_available", ...
[((3181, 3200), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (3193, 3200), False, 'import torch\n'), ((4025, 4073), 'multiprocessing.shared_memory.SharedMemory', 'shared_memory.SharedMemory', ([], {'name': 'shm_screen_name'}), '(name=shm_screen_name)\n', (4051, 4073), False, 'from multiprocessing i...
''' Created on 19.10.2019 @author: MBizm ''' import math import numpy as np def calculateHue(share, index): # define angle by position in grid defined by share and index value arcAlpha = math.atan2(index, share) # math lib will return negative arc if in quadrant 3 or 4 if(arcAlpha < 0): ...
[ "numpy.degrees", "math.atan2" ]
[((207, 231), 'math.atan2', 'math.atan2', (['index', 'share'], {}), '(index, share)\n', (217, 231), False, 'import math\n'), ((379, 399), 'numpy.degrees', 'np.degrees', (['arcAlpha'], {}), '(arcAlpha)\n', (389, 399), True, 'import numpy as np\n')]
import numpy as np from PIL import Image rollout = np.load("data/rollouts/ClothFold_rollout_0.npz") print(f"Shape: {rollout['observations'].shape}") print(rollout['observations'][0]) # save an observations pil_img = Image.fromarray(rollout['observations'][0]) pil_img.show()
[ "PIL.Image.fromarray", "numpy.load" ]
[((52, 100), 'numpy.load', 'np.load', (['"""data/rollouts/ClothFold_rollout_0.npz"""'], {}), "('data/rollouts/ClothFold_rollout_0.npz')\n", (59, 100), True, 'import numpy as np\n'), ((220, 263), 'PIL.Image.fromarray', 'Image.fromarray', (["rollout['observations'][0]"], {}), "(rollout['observations'][0])\n", (235, 263),...
from __future__ import annotations from typing import Tuple, List import nvector as nv import numpy as np import pymongo def find_closest_top(latitude: float, longitude: float, collection: pymongo.collection.Collection, chunk_size: int) -> Tuple[float, float]: xyz = convert_latlong_to_xyz(latitude, longitude) ...
[ "numpy.empty", "numpy.array", "numpy.linalg.norm", "numpy.int", "nvector.FrameE", "numpy.vstack" ]
[((2035, 2051), 'numpy.empty', 'np.empty', (['(0, 3)'], {}), '((0, 3))\n', (2043, 2051), True, 'import numpy as np\n'), ((3246, 3267), 'numpy.linalg.norm', 'np.linalg.norm', (['(a - b)'], {}), '(a - b)\n', (3260, 3267), True, 'import numpy as np\n'), ((4208, 4243), 'numpy.vstack', 'np.vstack', (['(xyz[0], xyz[1], xyz[2...
import numpy as np from datasets.dataset import Dataset from utils import AttrDict def build_mapping_pairs(ids): mirror_pairs = list() mapped = set() for name, join_id in ids.items(): if name in mapped: continue if name.startswith('r_'): joint1 = join_id ...
[ "numpy.where" ]
[((2135, 2155), 'numpy.where', 'np.where', (['(coords < 0)'], {}), '(coords < 0)\n', (2143, 2155), True, 'import numpy as np\n'), ((2223, 2243), 'numpy.where', 'np.where', (['(coords > 1)'], {}), '(coords > 1)\n', (2231, 2243), True, 'import numpy as np\n')]
import json import numpy as np import re from collections import Counter from glob import glob from os import walk, mkdir from os.path import dirname, join, basename, isdir, isfile def main(): train_npzs = glob(f"*/train.npz") valid_npzs = glob(f"*/valid.npz") test_npzs = glob(f"*/test.npz") fout = ...
[ "numpy.load", "json.load", "os.path.dirname", "numpy.zeros", "numpy.hstack", "glob.glob" ]
[((213, 233), 'glob.glob', 'glob', (['f"""*/train.npz"""'], {}), "(f'*/train.npz')\n", (217, 233), False, 'from glob import glob\n'), ((251, 271), 'glob.glob', 'glob', (['f"""*/valid.npz"""'], {}), "(f'*/valid.npz')\n", (255, 271), False, 'from glob import glob\n'), ((288, 307), 'glob.glob', 'glob', (['f"""*/test.npz""...
import numpy as np import pylab as plt from popstar import reddening from popstar import evolution from popstar import atmospheres as atm from popstar import filters from scipy import interpolate from scipy import stats from scipy.special import erf from pysynphot import spectrum from pysynphot import ObsBandpass from...
[ "matplotlib.pyplot.loglog", "popstar.atmospheres.get_kurucz_atmosphere", "popstar.filters.get_nirc2_filt", "pysynphot.spectrum.CompositeSourceSpectrum.tabulate", "numpy.sum", "numpy.abs", "pysynphot.spectrum.ArraySourceSpectrum", "numpy.nan_to_num", "matplotlib.pyplot.clf", "popstar.imf.imf.genera...
[((788, 806), 'popstar.evolution.MISTv1', 'evolution.MISTv1', ([], {}), '()\n', (804, 806), False, 'from popstar import evolution\n'), ((825, 854), 'popstar.reddening.RedLawNishiyama09', 'reddening.RedLawNishiyama09', ([], {}), '()\n', (852, 854), False, 'from popstar import reddening\n'), ((1091, 1166), 'popstar.atmos...
# coding: utf-8 # Distributed under the terms of the MIT License. """ This submodule defines some useful chemical functions and constants, with a focus on battery materials. """ import copy import warnings from typing import Dict, Tuple, Any, List import numpy as np from matador.data.constants import * # noqa EP...
[ "copy.deepcopy", "numpy.sum", "numpy.linalg.lstsq", "re.split", "numpy.abs", "numpy.asarray", "math.gcd", "collections.defaultdict", "numpy.array", "matador.utils.cursor_utils.recursive_get", "numpy.sign", "re.search" ]
[((4822, 4833), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (4830, 4833), True, 'import numpy as np\n'), ((5101, 5127), 'numpy.array', 'np.array', (['concs'], {'copy': '(True)'}), '(concs, copy=True)\n', (5109, 5127), True, 'import numpy as np\n'), ((12431, 12449), 'collections.defaultdict', 'defaultdict', (['floa...
from ess.imaging import mantid import tempfile import os import pytest import scipp as sc import numpy as np def mantid_is_available(): try: import mantid # noqa: F401 return True except ModuleNotFoundError: return False with_mantid_only = pytest.mark.skipif(not mantid_is_available(...
[ "os.remove", "mantid.simpleapi.CreateSampleWorkspace", "mantid.simpleapi.SaveNexusGeometry", "pytest.fixture", "mantid.load_component_info_to_2d", "tempfile.gettempdir", "os.path.isfile", "pytest.raises", "numpy.arange" ]
[((406, 436), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (420, 436), False, 'import pytest\n'), ((537, 635), 'mantid.simpleapi.CreateSampleWorkspace', 'sapi.CreateSampleWorkspace', ([], {'NumBanks': '(1)', 'BankPixelWidth': '(10)', 'PixelSpacing': '(0.01)', 'StoreInADS': ...
# -*- coding: utf-8 -*- """ Fucntions to plot permittivity and permeability results and S-parameters. """ # File input import tkinter as tk from tkinter.filedialog import askdirectory # Array math import numpy as np from uncertainties import unumpy as unp # System import os import datetime # Plotting import matplotlib ...
[ "numpy.logspace", "numpy.isnan", "matplotlib.pyplot.style.use", "matplotlib.pyplot.figure", "numpy.arange", "os.path.join", "matplotlib.ticker.EngFormatter", "matplotlib.ticker.LogFormatter", "matplotlib.ticker.FixedLocator", "seaborn.cubehelix_palette", "numpy.log10", "matplotlib.pyplot.subpl...
[((655, 678), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (668, 678), True, 'from matplotlib import pyplot as plt\n'), ((712, 733), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (731, 733), False, 'import datetime\n'), ((779, 786), 'tkinter.Tk', 'tk.Tk', ([]...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jan 14 23:50:27 2021 @author: <NAME> """ import matplotlib matplotlib.rcParams.update(matplotlib.rcParamsDefault) import matplotlib.pyplot as plt from matplotlib.dates import MO, TU, WE, TH, FR, SA, SU import matp...
[ "matplotlib.pyplot.title", "seaborn.lineplot", "matplotlib.dates.WeekdayLocator", "matplotlib.pyplot.gca", "matplotlib.rcParams.update", "matplotlib.dates.DateFormatter", "matplotlib.pyplot.rc", "numpy.int64", "matplotlib.ticker.MultipleLocator", "pandas.qcut", "matplotlib.pyplot.subplots", "m...
[((165, 219), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (['matplotlib.rcParamsDefault'], {}), '(matplotlib.rcParamsDefault)\n', (191, 219), False, 'import matplotlib\n'), ((648, 679), 'matplotlib.pyplot.rc', 'plt.rc', (['"""xtick"""'], {'labelsize': '(14.5)'}), "('xtick', labelsize=14.5)\n", (654, 679...
import arcade import numpy as np import cargame.globals as g import numpy as np def invlerp(a, b, v): """ Inverse lerp. a: left range b: right range v: value Will give a fraction of where v is between a and b. """ try: return (v - a) / (b - a) except ZeroDivisionError: ...
[ "arcade.ShapeElementList", "numpy.radians", "arcade.create_rectangle_filled", "arcade.create_ellipse", "numpy.sin", "numpy.cos" ]
[((481, 506), 'arcade.ShapeElementList', 'arcade.ShapeElementList', ([], {}), '()\n', (504, 506), False, 'import arcade\n'), ((558, 647), 'arcade.create_rectangle_filled', 'arcade.create_rectangle_filled', (['center_x', 'center_y', 'width', '(height - radius * 2)', 'color'], {}), '(center_x, center_y, width, height - r...
# -*- coding: utf-8 -*- """ Stain normalization inspired by method of: <NAME>., ‘Structure-Preserving Color Normalization and Sparse Stain Separation for Histological Images’, IEEE Transactions on Medical Imaging, vol. 35, no. 8, pp. 1962–1971, Aug. 2016. Uses the spams package: http://spams-devel.gforge.inr...
[ "stain_utils.RGB_to_OD", "cv2.cvtColor", "stain_utils.get_concentrations", "stain_utils.OD_to_RGB", "numpy.exp", "stain_utils.notwhite_mask", "spams.trainDL", "stain_utils.standardize_brightness", "numpy.dot", "stain_utils.normalize_rows", "os.path.join", "stain_utils.read_image" ]
[((1085, 1114), 'stain_utils.normalize_rows', 'ut.normalize_rows', (['dictionary'], {}), '(dictionary)\n', (1102, 1114), True, 'import stain_utils as ut\n'), ((2547, 2571), 'stain_utils.read_image', 'ut.read_image', (['file_name'], {}), '(file_name)\n', (2560, 2571), True, 'import stain_utils as ut\n'), ((2690, 2731), ...
from __future__ import print_function import numpy as np from model import createHierarchicalAttentionModel from keras.preprocessing import sequence from keras.datasets import imdb from keras.callbacks import TensorBoard np.random.seed(1337) # for reproducibility '''Trains a Hierarchical Attention Model on the IMDB ...
[ "numpy.random.seed", "keras.preprocessing.sequence.pad_sequences", "model.createHierarchicalAttentionModel", "numpy.expand_dims", "keras.callbacks.TensorBoard", "keras.datasets.imdb.load_data" ]
[((222, 242), 'numpy.random.seed', 'np.random.seed', (['(1337)'], {}), '(1337)\n', (236, 242), True, 'import numpy as np\n'), ((598, 636), 'keras.datasets.imdb.load_data', 'imdb.load_data', ([], {'num_words': 'max_features'}), '(num_words=max_features)\n', (612, 636), False, 'from keras.datasets import imdb\n'), ((764,...
import pathlib import numpy as np from scipy.constants import c as c_light, e as qe, m_p from scipy.stats import linregress from scipy.signal import hilbert from PyHEADTAIL.feedback.transverse_damper import TransverseDamper from PyHEADTAIL.impedances.wakes import WakeTable, WakeField from PyHEADTAIL.machines.synchrot...
[ "numpy.log", "PyHEADTAIL.feedback.transverse_damper.TransverseDamper", "PyHEADTAIL.impedances.wakes.WakeTable", "numpy.zeros", "numpy.isclose", "pathlib.Path", "PyHEADTAIL.particles.slicing.UniformBinSlicer", "PyHEADTAIL.impedances.wakes.WakeField", "numpy.arange", "scipy.signal.hilbert", "PyHEA...
[((795, 822), 'numpy.sqrt', 'np.sqrt', (['(1 - 1 / gamma ** 2)'], {}), '(1 - 1 / gamma ** 2)\n', (802, 822), True, 'import numpy as np\n'), ((1053, 1121), 'numpy.sqrt', 'np.sqrt', (['(qe * voltage * eta * h / (2 * np.pi * betar * c_light * p0))'], {}), '(qe * voltage * eta * h / (2 * np.pi * betar * c_light * p0))\n', ...
import numpy as np from matplotlib import pyplot from astropy import wcs from astropy.io import fits def Info2WCS(naxis, cdelt, crval, ctype=['RA---TAN', 'DEC--TAN']): """ """ # Setup 2D wcs object w = wcs.WCS(naxis=2) w.wcs.crpix = [naxis[0]/2.+1, naxis[1]/2.+1] w.wcs.cdelt = np.array([-cde...
[ "astropy.wcs.WCS", "numpy.array" ]
[((220, 236), 'astropy.wcs.WCS', 'wcs.WCS', ([], {'naxis': '(2)'}), '(naxis=2)\n', (227, 236), False, 'from astropy import wcs\n'), ((306, 337), 'numpy.array', 'np.array', (['[-cdelt[0], cdelt[1]]'], {}), '([-cdelt[0], cdelt[1]])\n', (314, 337), True, 'import numpy as np\n')]
import pytest import numpy as np from Linear_Regression.regression import LinearRegression, LinearRegressionGD @pytest.fixture def train_test_data(): """ Provides the training and test sets """ X_train = 2 * np.random.rand(100, 1) y_train = 4 + 3 * X_train + np.random.randn(100, 1) X_test = np...
[ "numpy.random.randn", "Linear_Regression.regression.LinearRegression", "numpy.array", "Linear_Regression.regression.LinearRegressionGD", "numpy.random.rand" ]
[((318, 338), 'numpy.array', 'np.array', (['[[0], [2]]'], {}), '([[0], [2]])\n', (326, 338), True, 'import numpy as np\n'), ((537, 555), 'Linear_Regression.regression.LinearRegression', 'LinearRegression', ([], {}), '()\n', (553, 555), False, 'from Linear_Regression.regression import LinearRegression, LinearRegressionG...
import argparse import sys import os import subprocess import numpy as np import tempfile from ase.db import connect from ase.io import write from utility_classes import IndexProvider def get_parser(): """ Setup parser for command line arguments """ main_parser = argparse.ArgumentParser() main_parser.add...
[ "os.remove", "numpy.load", "argparse.ArgumentParser", "os.makedirs", "os.path.isdir", "utility_classes.IndexProvider", "os.path.isfile", "tempfile.mkdtemp", "ase.db.connect", "os.path.splitext", "ase.io.write", "os.rmdir", "os.path.join", "sys.exit" ]
[((275, 300), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (298, 300), False, 'import argparse\n'), ((5418, 5462), 'tempfile.mkdtemp', 'tempfile.mkdtemp', (['""""""', '"""generated_molecules_"""'], {}), "('', 'generated_molecules_')\n", (5434, 5462), False, 'import tempfile\n'), ((5506, 5529)...
#!/usr/bin/python3 # This script performs some simple benchmarking for some of the shortest path algorithm # implementations provided by NetworkX. I was mostly interested in comparing the standard # deviation between the different algorithms to see how consistent they performed. import networkx as nx import multiproc...
[ "numpy.sum", "networkx.nodes", "random.sample", "numpy.std", "numpy.median", "time.time", "numpy.mean", "multiprocessing.Pool", "networkx.read_gexf", "numpy.var" ]
[((468, 504), 'random.sample', 'random.sample', (['elements', 'num_samples'], {}), '(elements, num_samples)\n', (481, 504), False, 'import random\n'), ((688, 703), 'numpy.sum', 'np.sum', (['numbers'], {}), '(numbers)\n', (694, 703), True, 'import numpy as np\n'), ((714, 730), 'numpy.mean', 'np.mean', (['numbers'], {}),...
#!/usr/bin/env python __author__ = "XXX" __email__ = "XXX" # Define static variables import shutil import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import wandb import tensorflow as tf from datasets.implemented_datasets import * import argparse from constants import * from evaluation.topk_eval...
[ "seaborn.lineplot", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.show", "argparse.ArgumentParser", "igccf_experiments.best_models.restore_models", "numpy.abs", "matplotlib.pyplot.gca", "seaborn.barplot", "numpy.split", "igccf_experiments.best_models.get_wandb_project_dict", "numpy.cumsum...
[((930, 946), 'numpy.cumsum', 'np.cumsum', (['count'], {}), '(count)\n', (939, 946), True, 'import numpy as np\n'), ((1279, 1307), 'numpy.split', 'np.split', (['user_id', 'split_ids'], {}), '(user_id, split_ids)\n', (1287, 1307), True, 'import numpy as np\n'), ((1579, 1634), 'utils.plot_utils.setup_plot', 'setup_plot',...
import numpy as np def thresh_x(x: np.array) -> (int, int): print(f"x:{x}") x_i = 0 found = False for i, v in enumerate(np.nditer(x)): print(f"i v:{i} {v}") if v > 0.0 and not found: x_i = i found = True x_j = 0 found = False y = np.flip(x) prin...
[ "numpy.nditer", "numpy.array", "numpy.flip" ]
[((515, 550), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.5, 0.1, 0.2]'], {}), '([0.0, 0.0, 0.5, 0.1, 0.2])\n', (523, 550), True, 'import numpy as np\n'), ((301, 311), 'numpy.flip', 'np.flip', (['x'], {}), '(x)\n', (308, 311), True, 'import numpy as np\n'), ((138, 150), 'numpy.nditer', 'np.nditer', (['x'], {}), '(x)\n',...
import os import cv2 import gdown import torch import numpy as np import torch.nn.functional as f import torchvision.transforms as transforms from PIL import Image from typing import List, TypeVar, Optional from .utils import load_checkpoint_mgpu, NormalizeImage from .u2net import U2NET PillowImage = TypeVar("Pillo...
[ "numpy.sum", "cv2.bitwise_and", "gdown.download", "torch.cuda.is_available", "torch.max", "torch.nn.functional.log_softmax", "numpy.array", "numpy.repeat", "typing.TypeVar", "os.path.join", "torchvision.transforms.ToTensor" ]
[((306, 328), 'typing.TypeVar', 'TypeVar', (['"""PillowImage"""'], {}), "('PillowImage')\n", (313, 328), False, 'from typing import List, TypeVar, Optional\n'), ((1602, 1648), 'gdown.download', 'gdown.download', (['cls.URL', 'cls.NAME'], {'quiet': '(False)'}), '(cls.URL, cls.NAME, quiet=False)\n', (1616, 1648), False, ...
import base64 import io import textwrap import dash import dash_core_components as dcc import dash_html_components as html import gunicorn import plotly.graph_objs as go from dash.dependencies import Input, Output, State import flask import pandas as pd import urllib.parse from sklearn.preprocessing import StandardSca...
[ "numpy.abs", "sklearn.preprocessing.StandardScaler", "dash_html_components.H2", "textwrap.wrap", "base64.b64decode", "numpy.interp", "pandas.DataFrame", "dash_html_components.H3", "dash.Dash", "dash_table.Format.Format", "dash_html_components.Div", "dash_html_components.Label", "dash.depende...
[((914, 976), 'dash.Dash', 'dash.Dash', (['__name__'], {'external_stylesheets': 'external_stylesheets'}), '(__name__, external_stylesheets=external_stylesheets)\n', (923, 976), False, 'import dash\n'), ((1721, 2750), 'textwrap.wrap', 'textwrap.wrap', (['""" These tools aim to provide a reproducible and consistent data ...
""" This benchmark is intended to test the time for which the arx method from the prediction error method peforms the tasks. """ # Imports import numpy as np import scipy.signal as sig try: from pysid import arx except ImportError: pass # Define the class to be tested class Arx: params = [ ...
[ "numpy.random.randn", "numpy.poly", "scipy.signal.lfilter", "pysid.arx", "numpy.complex" ]
[((579, 595), 'numpy.complex', 'np.complex', (['(0)', '(1)'], {}), '(0, 1)\n', (589, 595), True, 'import numpy as np\n'), ((632, 695), 'numpy.poly', 'np.poly', (['[0.88, 0.99, 0.6 + 0.5 * j, 0.6 - 0.5 * j, 0.77, 0.87]'], {}), '([0.88, 0.99, 0.6 + 0.5 * j, 0.6 - 0.5 * j, 0.77, 0.87])\n', (639, 695), True, 'import numpy ...
from matplotlib.colors import LinearSegmentedColormap from matplotlib.collections import PatchCollection from matplotlib.patches import Circle import matplotlib.pyplot as plt from matplotlib import colors from matplotlib import cm import numpy as np # heatmap with text def heatmap_visualization(resolution_i...
[ "matplotlib.colors.LinearSegmentedColormap.from_list", "numpy.zeros_like", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.colors.Normalize", "matplotlib.pyplot.scatter", "numpy.power", "matplotlib.patches.Circle", "numpy.arange", "matplotlib.pyplot.Circle", "matplotlib.collectio...
[((369, 383), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (381, 383), True, 'import matplotlib.pyplot as plt\n'), ((1593, 1623), 'numpy.arange', 'np.arange', (['(x - r)', '(x + r)', '(1e-06)'], {}), '(x - r, x + r, 1e-06)\n', (1602, 1623), True, 'import numpy as np\n'), ((1703, 1747), 'matplotlib.py...
import numpy as np import pandas as pd # def estimate_sbm( # graph, # n_communities, # n_components=None, # directed=False, # method="gc", # metric=None, # rank="full", # ): # if n_communities == 1: # estimator = EREstimator(directed=directed, loops=False) # estimator.fi...
[ "graspy.embed.AdjacencySpectralEmbed", "graspy.models.RDPGEstimator", "graspy.cluster.GaussianCluster", "graspy.models.SBMEstimator", "graspy.utils.is_symmetric", "numpy.concatenate", "graspy.models.DCSBMEstimator" ]
[((3114, 3167), 'graspy.models.RDPGEstimator', 'RDPGEstimator', ([], {'loops': '(False)', 'n_components': 'n_components'}), '(loops=False, n_components=n_components)\n', (3127, 3167), False, 'from graspy.models import DCSBMEstimator, EREstimator, RDPGEstimator, SBMEstimator\n'), ((4155, 4249), 'graspy.models.SBMEstimat...
import numpy as onp import legate.numpy as np import timeit import durbin_numpy as np_impl def kernel(r): y = np.empty_like(r) alpha = -r[0] beta = 1.0 y[0] = -r[0] for k in range(1, r.shape[0]): beta *= 1.0 - alpha * alpha alpha = -(r[k] + np.dot(np.flip(r[:k]), y[:k])) / beta ...
[ "numpy.empty", "legate.numpy.allclose", "legate.numpy.flip", "legate.numpy.empty_like", "durbin_numpy.kernel", "legate.numpy.median" ]
[((118, 134), 'legate.numpy.empty_like', 'np.empty_like', (['r'], {}), '(r)\n', (131, 134), True, 'import legate.numpy as np\n'), ((494, 525), 'numpy.empty', 'onp.empty', (['(N,)'], {'dtype': 'datatype'}), '((N,), dtype=datatype)\n', (503, 525), True, 'import numpy as onp\n'), ((535, 566), 'numpy.empty', 'onp.empty', (...
import numpy as np # noinspection PyUnresolvedReferences from primer3.thermoanalysis import ThermoAnalysis from copy import deepcopy # noinspection PyPackageRequirements from Bio import SeqUtils import primer3 from os.path import join import os # noinspection PyPackageRequirements from Bio.Seq import Seq from . import...
[ "primer3.bindings.designPrimers", "copy.deepcopy", "os.remove", "Bio.Seq.Seq", "Bio.SeqUtils.GC", "numpy.argsort", "numpy.max", "numpy.where", "numpy.arange", "primer3.thermoanalysis.ThermoAnalysis", "numpy.array", "numpy.min", "primer3.setP3Globals", "numpy.unique" ]
[((18039, 18087), 'primer3.bindings.designPrimers', 'primer3.bindings.designPrimers', (['primer3_seq_args'], {}), '(primer3_seq_args)\n', (18069, 18087), False, 'import primer3\n'), ((20130, 20167), 'primer3.setP3Globals', 'primer3.setP3Globals', (['PRIMER3_GLOBALS'], {}), '(PRIMER3_GLOBALS)\n', (20150, 20167), False, ...
import numpy as np ''' for definition see abbott, rajan, sompolinsky, 2011 ''' def calc_dimension(array, inp='covariance',output=0): if inp=='covariance': w = np.linalg.eigvalsh(array) # eigenvalues in ascending order elif inp=='patterns': array = array.reshape(array.shape[0],np.prod(array.shape[1:])) array[...
[ "numpy.sum", "numpy.isfinite", "numpy.linalg.eigvalsh", "numpy.linalg.svd", "numpy.prod", "numpy.nanmean" ]
[((164, 189), 'numpy.linalg.eigvalsh', 'np.linalg.eigvalsh', (['array'], {}), '(array)\n', (182, 189), True, 'import numpy as np\n'), ((657, 671), 'numpy.sum', 'np.sum', (['(w ** 2)'], {}), '(w ** 2)\n', (663, 671), True, 'import numpy as np\n'), ((487, 530), 'numpy.linalg.svd', 'np.linalg.svd', (['array_norm'], {'comp...
import time import click import yaml from tqdm import tqdm import logging import numpy as np from sklearn.decomposition import PCA from sklearn.manifold import TSNE import torch import torchvision from torch.utils.tensorboard import SummaryWriter from matplotlib import pyplot as plt from dataset import HCSData from...
[ "yaml.load", "torch.nn.MSELoss", "logging.debug", "logging.basicConfig", "torch.utils.data.DataLoader", "models.VAE_fm", "click.option", "torch.optim.lr_scheduler.ReduceLROnPlateau", "time.strftime", "click.command", "torch.cuda.device_count", "dataset.HCSData.from_csv", "numpy.mean", "tor...
[((404, 443), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (423, 443), False, 'import logging\n'), ((1002, 1017), 'click.command', 'click.command', ([], {}), '()\n', (1015, 1017), False, 'import click\n'), ((1019, 1063), 'click.option', 'click.option', (['"""-...
import abc import math import numbers from typing import List, Union import numpy as np from scipy.special import logsumexp, softmax from scipy.stats import cauchy, laplace, norm, rv_continuous, uniform from utils import check_random_state def update_truncnorm(loc, params): params['a'] = (params['a'] - loc) / p...
[ "numpy.abs", "numpy.sum", "numpy.isnan", "numpy.argpartition", "numpy.arange", "numpy.tile", "scipy.special.logsumexp", "scipy.stats.laplace.ppf", "scipy.stats.uniform.ppf", "scipy.stats.cauchy.ppf", "scipy.stats.cauchy.logpdf", "math.log", "scipy.stats.norm.ppf", "numpy.isinf", "scipy.s...
[((2858, 2890), 'utils.check_random_state', 'check_random_state', (['random_state'], {}), '(random_state)\n', (2876, 2890), False, 'from utils import check_random_state\n'), ((3378, 3439), 'numpy.zeros', 'np.zeros', ([], {'shape': '(self.n_samples, theta.shape[0])', 'dtype': 'float'}), '(shape=(self.n_samples, theta.sh...
# Copyright 2022 <NAME>. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, soft...
[ "torch.manual_seed", "random.seed", "numpy.random.seed" ]
[((2469, 2489), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (2483, 2489), True, 'import numpy as np\n'), ((2498, 2521), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (2515, 2521), False, 'import torch\n'), ((2530, 2547), 'random.seed', 'random.seed', (['seed'], {}), '(seed...
import numpy as np import lensfunpy as lensfun import gc from numpy.testing.utils import assert_equal # the following strings were taken from the lensfun xml files cam_maker = 'NIKON CORPORATION' cam_model = 'NIKON D3S' lens_maker = 'Nikon' lens_model = 'Nikon AI-S Nikkor 28mm f/2.8' def testDatabaseLoading(): db...
[ "numpy.dstack", "lensfunpy.Modifier", "numpy.testing.utils.assert_equal", "numpy.zeros", "numpy.any", "gc.collect", "lensfunpy.Database" ]
[((323, 341), 'lensfunpy.Database', 'lensfun.Database', ([], {}), '()\n', (339, 341), True, 'import lensfunpy as lensfun\n'), ((1975, 2039), 'lensfunpy.Database', 'lensfun.Database', ([], {'xml': 'xml', 'load_common': '(False)', 'load_bundled': '(False)'}), '(xml=xml, load_common=False, load_bundled=False)\n', (1991, 2...
import numpy as np import chainer import chainer.functions as F from src.function.spectral_norm_exact import spectral_norm_exact from src.function.normalize import normalize from src.function.l2_norm import l2_norm from src.hook.power_iteration import register_power_iter class Linear(chainer.links.Linear): """Ove...
[ "src.function.normalize.normalize", "chainer.Parameter", "src.hook.power_iteration.register_power_iter", "src.function.l2_norm.l2_norm", "src.function.spectral_norm_exact.spectral_norm_exact", "chainer.functions.linear", "numpy.random.normal", "chainer.cuda._get_device" ]
[((1866, 1889), 'src.function.normalize.normalize', 'normalize', (['self.u.array'], {}), '(self.u.array)\n', (1875, 1889), False, 'from src.function.normalize import normalize\n'), ((1910, 1934), 'chainer.functions.linear', 'F.linear', (['self.u', 'self.W'], {}), '(self.u, self.W)\n', (1918, 1934), True, 'import chaine...
"""Utils for ASR functions.""" import numpy as np from scipy.special import gamma, gammaincinv from numpy import linalg from numpy.matlib import repmat from scipy import signal from scipy.linalg import toeplitz def fit_eeg_distribution(X, min_clean_fraction=0.25, max_dropout_fraction=0.1, ...
[ "numpy.roots", "numpy.sum", "numpy.abs", "numpy.poly", "numpy.ones", "numpy.argmin", "numpy.imag", "numpy.arange", "numpy.linalg.norm", "numpy.round", "numpy.int_", "scipy.signal.lfilter", "numpy.transpose", "numpy.cumsum", "numpy.max", "numpy.reshape", "numpy.linspace", "numpy.rea...
[((448, 473), 'numpy.linspace', 'np.linspace', (['(1.7)', '(3.5)', '(13)'], {}), '(1.7, 3.5, 13)\n', (459, 473), True, 'import numpy as np\n'), ((3676, 3686), 'numpy.sort', 'np.sort', (['X'], {}), '(X)\n', (3683, 3686), True, 'import numpy as np\n'), ((3816, 3839), 'numpy.array', 'np.array', (['fit_quantiles'], {}), '(...
from imutils.video import VideoStream import numpy as np import argparse import imutils import time import cv2 # https://towardsdatascience.com/yolo-object-detection-with-opencv-and-python-21e50ac599e9 def get_output_layers(net): layer_names = net.getLayerNames() output_layers = [layer_names[i[0] - 1] for...
[ "imutils.video.VideoStream", "cv2.putText", "argparse.ArgumentParser", "cv2.dnn.NMSBoxes", "numpy.argmax", "cv2.waitKey", "cv2.dnn.blobFromImage", "cv2.imshow", "time.sleep", "cv2.dnn.readNet", "time.time", "cv2.rectangle", "imutils.resize", "cv2.destroyAllWindows" ]
[((812, 837), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (835, 837), False, 'import argparse\n'), ((1499, 1547), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (["args['weights']", "args['config']"], {}), "(args['weights'], args['config'])\n", (1514, 1547), False, 'import cv2\n'), ((1737, 1752), 'ti...
""" Module to calculate robustness of a brain's graph """ import random import networkx as nx import numpy as np def robustness(brain, iter_len=500, window_size=50): """ A function to calculate robustness based on "Error and attack tolerance of complex networks" Albert et al. Nature 2000 406:378-382 ...
[ "networkx.is_connected", "random.shuffle", "numpy.zeros", "numpy.ones", "numpy.argmin", "networkx.connected_components", "numpy.diff", "numpy.mean", "numpy.gradient" ]
[((952, 970), 'numpy.zeros', 'np.zeros', (['iter_len'], {}), '(iter_len)\n', (960, 970), True, 'import numpy as np\n'), ((1156, 1178), 'random.shuffle', 'random.shuffle', (['n_list'], {}), '(n_list)\n', (1170, 1178), False, 'import random\n'), ((1820, 1836), 'numpy.gradient', 'np.gradient', (['mat'], {}), '(mat)\n', (1...
###------Network Simulator------### ###------<NAME>------### ###------CMRG, UC San Diego------### ###import packages### import pandas as pd import collections import timeit from scipy.integrate import odeint import matplotlib.pyplot as plt import networkx as nx import matplotlib.mlab as mlab import statistics import r...
[ "scipy.integrate.odeint", "pandas.read_excel", "collections.defaultdict", "numpy.arange", "seaborn.set" ]
[((513, 522), 'seaborn.set', 'sns.set', ([], {}), '()\n', (520, 522), True, 'import seaborn as sns\n'), ((2350, 2445), 'pandas.read_excel', 'pd.read_excel', (['"""MTv29-philip-20170921-for-network.xlsx"""'], {'sheet_name': '(1)', 'skiprows': '(1)', 'header': '(0)'}), "('MTv29-philip-20170921-for-network.xlsx', sheet_na...
# OpenGym CartPole-v0 # ------------------- # # This code demonstrates use of a basic Q-network (without target network) # to solve OpenGym CartPole-v0 problem. # # Made as part of blog series Let's make a DQN, available at: # https://jaromiru.com/2016/10/03/lets-make-a-dqn-implementation/ # # author: <NAME>, 2016 ...
[ "math.exp", "gym.make", "random.randint", "random.sample", "numpy.zeros", "numpy.amax", "random.random", "numpy.array", "keras.models.Sequential" ]
[((881, 893), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (891, 893), False, 'from keras.models import Sequential\n'), ((1850, 1880), 'random.sample', 'random.sample', (['self.samples', 'n'], {}), '(self.samples, n)\n', (1863, 1880), False, 'import random, numpy, math, gym\n'), ((2933, 2959), 'numpy.zero...
from pyscipopt import Model from localbranching import addLBConstraint from repairlp import repairlp import ecole import numpy import pathlib import matplotlib.pyplot as plt from geco.mips.loading.miplib import Loader modes = ['repair-slackvars', 'repair-supportbinvars', 'repair-binvars'] mode = modes[1] directory = ...
[ "geco.mips.loading.miplib.Loader", "numpy.load", "repairlp.repairlp", "pathlib.Path" ]
[((419, 476), 'numpy.load', 'numpy.load', (['"""./result/miplib2017/miplib2017_binary39.npz"""'], {}), "('./result/miplib2017/miplib2017_binary39.npz')\n", (429, 476), False, 'import numpy\n'), ((710, 746), 'repairlp.repairlp', 'repairlp', (['MIP_model', 'directory', 'mode'], {}), '(MIP_model, directory, mode)\n', (718...
import sys import torch from torch.utils.data import dataloader from torch.multiprocessing import reductions from multiprocessing.reduction import ForkingPickler default_collate_func = dataloader.default_collate def default_collate_override(batch): dataloader._use_shared_memory = False return default_collate_fun...
[ "edit_model.encdec.SequentialDecoder.populate_gen_and_copy_index_and_mask", "edit_model.edit_encoder.GraphChangeEncoder.compute_change_edges", "functools.partial", "json.loads", "edit_components.change_entry.ChangeExample", "multiprocessing.Pool", "edit_model.edit_encoder.SequentialChangeEncoder.populat...
[((1470, 1490), 'json.loads', 'json.loads', (['json_str'], {}), '(json_str)\n', (1480, 1490), False, 'import json\n'), ((2059, 2328), 'edit_components.change_entry.ChangeExample', 'ChangeExample', ([], {'id': "entry['Id']", 'prev_data': 'previous_code_chunk', 'updated_data': 'updated_code_chunk', 'raw_prev_data': "entr...
#!/home/loris/anaconda3/envs/py3/bin/python # #%% utile per plottare una finestra di debug from mpl_toolkits import mplot3d import numpy as np import math import matplotlib.pyplot as plt import cv2 as cv import rospy from std_msgs.msg import String from beginner_tutorials.msg import o3d_coord_msg from beginner_tutori...
[ "numpy.matrix", "rospy.wait_for_message", "cv2.ppf_match_3d.loadPLYSimple", "rospy.Publisher", "rospy.sleep", "beginner_tutorials.msg.o3d_coord_msg", "rospy.loginfo", "rospy.is_shutdown", "numpy.sin", "numpy.arange", "rospy.init_node", "numpy.cos", "scipy.spatial.transform.Rotation.from_matr...
[((2035, 2078), 'cv2.ppf_match_3d.loadPLYSimple', 'cv.ppf_match_3d.loadPLYSimple', (['modelname', '(1)'], {}), '(modelname, 1)\n', (2064, 2078), True, 'import cv2 as cv\n'), ((2316, 2353), 'numpy.arange', 'np.arange', (['lat_min_r', 'lat_max_r', 'n_df'], {}), '(lat_min_r, lat_max_r, n_df)\n', (2325, 2353), True, 'impor...
import numpy as np from rtree import index class RtreePoint(): def __init__(self, dimension): p = index.Property() p.dimension = dimension p.storage= index.RT_Memory self._idx_rtp = index.Index(properties = p) self._dimension = dimension def insert(self, id, point): ...
[ "rtree.index.Property", "rtree.index.Index", "numpy.hstack" ]
[((112, 128), 'rtree.index.Property', 'index.Property', ([], {}), '()\n', (126, 128), False, 'from rtree import index\n'), ((220, 245), 'rtree.index.Index', 'index.Index', ([], {'properties': 'p'}), '(properties=p)\n', (231, 245), False, 'from rtree import index\n'), ((608, 633), 'numpy.hstack', 'np.hstack', (['(point,...
import numpy # A model is a structure with two operations. # "score" which takes a transaction and scores it. # "update" which takes a transaction and updates the model. # The base class provides generic implememtations of these operations. # Score returns 1 while update maintains counts of the frequencies of attribu...
[ "numpy.log2" ]
[((3553, 3579), 'numpy.log2', 'numpy.log2', (['(self.n / total)'], {}), '(self.n / total)\n', (3563, 3579), False, 'import numpy\n'), ((4232, 4264), 'numpy.log2', 'numpy.log2', (['((self.n + 1) / total)'], {}), '((self.n + 1) / total)\n', (4242, 4264), False, 'import numpy\n'), ((2643, 2660), 'numpy.log2', 'numpy.log2'...
################################################################################ # # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License...
[ "numpy.min", "numpy.minimum", "numpy.max", "numpy.maximum" ]
[((1954, 1984), 'numpy.min', 'np.min', (['x_np'], {'axis': 'reduce_axis'}), '(x_np, axis=reduce_axis)\n', (1960, 1984), True, 'import numpy as np\n'), ((2001, 2031), 'numpy.max', 'np.max', (['x_np'], {'axis': 'reduce_axis'}), '(x_np, axis=reduce_axis)\n', (2007, 2031), True, 'import numpy as np\n'), ((2349, 2387), 'num...
"""Unit tests for `pysatModels.utils.compare`.""" import logging import numpy as np import pytest import xarray as xr import pysatModels.utils.compare as compare class TestUtilsCompare(object): """Unit tests for utils.compare.""" def setup(self): """Set up the unit test environment for each method....
[ "xarray.Dataset", "pytest.raises", "numpy.arange", "pytest.mark.parametrize", "pysatModels.utils.compare.compare_model_and_inst", "numpy.floating" ]
[((2906, 3209), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input_ind,input_val,err_tst"""', "[(0, None, 'must provide Dataset of paired'), (1, [],\n 'must provide equal number of instr'), (1, ['Ti'],\n 'unknown instrument data value'), (2, ['Ti'],\n 'unknown model data value'), (3, ['nada'], '...
#!/usr/bin/env python import numpy import random import sys from sklearn import neighbors from sklearn.metrics import accuracy_score fileNameMatrix = sys.argv[1] fileNameLabels = sys.argv[2] M = numpy.loadtxt(fileNameMatrix) L = numpy.genfromtxt(fileNameLabels, dtype='str') knn = neighbors.KNeighborsClassifier(...
[ "sklearn.neighbors.KNeighborsClassifier", "numpy.genfromtxt", "numpy.loadtxt", "sklearn.metrics.accuracy_score" ]
[((201, 230), 'numpy.loadtxt', 'numpy.loadtxt', (['fileNameMatrix'], {}), '(fileNameMatrix)\n', (214, 230), False, 'import numpy\n'), ((237, 282), 'numpy.genfromtxt', 'numpy.genfromtxt', (['fileNameLabels'], {'dtype': '"""str"""'}), "(fileNameLabels, dtype='str')\n", (253, 282), False, 'import numpy\n'), ((289, 356), '...
''' Created on 2014-6-21 @author: xiajie ''' import numpy as np import SimulateData as sd import matplotlib.pyplot as plt def ave(predictor, X, Y): knn = X[:30].tolist() knny = Y[:30].tolist() for i in range(30, len(X)): distance = np.abs(X[i] - predictor) if distance < np.abs(knn[0] - pre...
[ "SimulateData.simulate", "matplotlib.pyplot.show", "numpy.abs", "matplotlib.pyplot.plot", "numpy.zeros", "numpy.sin", "numpy.arange" ]
[((526, 552), 'numpy.arange', 'np.arange', (['(0.0)', '(1.0)', '(0.002)'], {}), '(0.0, 1.0, 0.002)\n', (535, 552), True, 'import numpy as np\n'), ((567, 580), 'numpy.zeros', 'np.zeros', (['(500)'], {}), '(500)\n', (575, 580), True, 'import numpy as np\n'), ((670, 701), 'matplotlib.pyplot.plot', 'plt.plot', (['predictor...
""" **Description** A log instance formats and writes log entries with a specified level and stream using the loguru package. Log entries contain an ISO-8601 datetime and level. Dynamic stream redirection and level specification are supported. Log uses lazy initialization to co...
[ "numpy.set_printoptions", "loguru.logger.level", "loguru.logger.add", "loguru.logger.log", "threading.RLock", "loguru.logger.remove", "sys.exc_info" ]
[((2985, 3045), 'numpy.set_printoptions', 'numpy.set_printoptions', ([], {'formatter': "{'float': '{:.6f}'.format}"}), "(formatter={'float': '{:.6f}'.format})\n", (3007, 3045), False, 'import numpy\n'), ((3116, 3123), 'threading.RLock', 'RLock', ([], {}), '()\n', (3121, 3123), False, 'from threading import RLock\n'), (...
import datetime import json from typing import Optional, Union from urllib.parse import urljoin import numpy as np import pandas as pd import requests Timestamp = Union[str, float, datetime.datetime] # RFC-3339 string or as a Unix timestamp in seconds Duration = Union[str, datetime.timedelta] # Prometheus duration ...
[ "pandas.Timestamp", "urllib.parse.urljoin", "requests.Session", "json.dumps", "numpy.float64" ]
[((706, 724), 'requests.Session', 'requests.Session', ([], {}), '()\n', (722, 724), False, 'import requests\n'), ((2491, 2518), 'urllib.parse.urljoin', 'urljoin', (['self.api_url', 'path'], {}), '(self.api_url, path)\n', (2498, 2518), False, 'from urllib.parse import urljoin\n'), ((3032, 3057), 'numpy.float64', 'np.flo...
""" This saves figures showing the clustering results of HGMM on simulated dataset. It outputs the 4 subplots of Figure 8 in the paper. """ #%% import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from joblib import Parallel, delayed from sklearn.metrics import adjusted_rand_sc...
[ "numpy.random.seed", "numpy.empty", "numpy.arange", "numpy.tile", "numpy.random.normal", "sklearn.metrics.adjusted_rand_score", "matplotlib.pyplot.tight_layout", "numpy.round", "numpy.unique", "pandas.DataFrame", "graspologic.cluster.DivisiveCluster", "matplotlib.pyplot.subplots", "pandas.co...
[((1415, 1432), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1429, 1432), True, 'import numpy as np\n'), ((1847, 1867), 'numpy.tile', 'np.tile', (['y', 'n_trials'], {}), '(y, n_trials)\n', (1854, 1867), True, 'import numpy as np\n'), ((1879, 1911), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)...