code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from __future__ import print_function import sys import random import numpy as np def set_random_seed(seed): """Sets the random seed. :param seed: new random seed >>> set_random_seed(19) >>> random.randint(0, 10000) 708 >>> np.random.rand(3, 2) array([[0.6356515 , 0.15946741], ...
[ "numpy.random.randn", "random.randint", "random.seed", "numpy.linalg.norm" ]
[((398, 415), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (409, 415), False, 'import random\n'), ((1395, 1416), 'numpy.random.randn', 'np.random.randn', (['n', 'd'], {}), '(n, d)\n', (1410, 1416), True, 'import numpy as np\n'), ((435, 465), 'random.randint', 'random.randint', (['(0)', '(100000000.0)'], {}...
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
[ "pyscf.cc.gintermediates.Wvvvo", "pyscf.cc.gintermediates.Foo", "pyscf.lib.logger.timer", "time.clock", "numpy.array", "numpy.einsum", "pyscf.cc.gintermediates.Fvv", "pyscf.cc.gintermediates.Wvvvv", "pyscf.scf.UHF", "pyscf.cc.gccsd.GCCSD", "numpy.dot", "pyscf.cc.gintermediates.Fov", "numpy.t...
[((1025, 1073), 'numpy.zeros', 'np.zeros', (['(nocc, nocc, nvir)'], {'dtype': 'vector.dtype'}), '((nocc, nocc, nvir), dtype=vector.dtype)\n', (1033, 1073), True, 'import numpy as np\n'), ((1087, 1112), 'numpy.tril_indices', 'np.tril_indices', (['nocc', '(-1)'], {}), '(nocc, -1)\n', (1102, 1112), True, 'import numpy as ...
# coding=utf-8 import numpy as np import scipy as sp import scipy.sparse as sparse import scipy.sparse.linalg as sparse_alg from time import time import IEEE_cdf as cdf from jacobian import jacobian from P_Q import P_Q class powerflow: ''' ''' def __init__(self, filename=''): n, mat_admitancia, lo...
[ "P_Q.P_Q", "numpy.linalg.solve", "numpy.ones", "numpy.delete", "jacobian.jacobian", "scipy.sparse.issparse", "numpy.append", "IEEE_cdf.read", "scipy.sparse.coo_matrix", "matplotlib.pyplot.matshow", "time.time", "matplotlib.pyplot.show" ]
[((2972, 2978), 'time.time', 'time', ([], {}), '()\n', (2976, 2978), False, 'from time import time\n'), ((3022, 3028), 'time.time', 'time', ([], {}), '()\n', (3026, 3028), False, 'from time import time\n'), ((373, 391), 'IEEE_cdf.read', 'cdf.read', (['filename'], {}), '(filename)\n', (381, 391), True, 'import IEEE_cdf ...
import numpy import scipy.interpolate import scipy.ndimage import matplotlib.pyplot import matplotlib.patches import logging def parseSpeedFlowsToCongestions(speeds, flows, speedThreshold, flowThreshold): logging.debug("Starting parseSpeedFlowsToCongestions()") congestions = speeds / speedThreshold ...
[ "numpy.ma.masked_invalid", "numpy.meshgrid", "logging.debug", "numpy.arange" ]
[((220, 276), 'logging.debug', 'logging.debug', (['"""Starting parseSpeedFlowsToCongestions()"""'], {}), "('Starting parseSpeedFlowsToCongestions()')\n", (233, 276), False, 'import logging\n'), ((352, 406), 'logging.debug', 'logging.debug', (['"""Ending parseSpeedFlowsToCongestions()"""'], {}), "('Ending parseSpeedFlow...
from CubeSolver import CubeSolver import numpy as np # disposition = np.array([[['U', 'G', 'Y'], # ['U', 'W', 'O'], # ['R', 'Y', 'W']], # [['G', 'G', 'U'], # ['Y', 'R', 'G'], # ['O', 'Y', 'U']], ...
[ "numpy.array", "CubeSolver.CubeSolver" ]
[((895, 1239), 'numpy.array', 'np.array', (["[[['G', 'U', 'W'], ['Y', 'W', 'Y'], ['U', 'G', 'Y']], [['R', 'R', 'O'], [\n 'O', 'R', 'U'], ['O', 'O', 'O']], [['G', 'G', 'Y'], ['Y', 'G', 'W'], [\n 'U', 'O', 'R']], [['R', 'O', 'U'], ['U', 'O', 'R'], ['U', 'R', 'R']], [\n ['Y', 'G', 'G'], ['U', 'U', 'G'], ['W', 'R'...
import matplotlib matplotlib.use('Agg') #display backend import matplotlib.pyplot as plt import numpy as np import os from scipy.spatial import KDTree import scipy.stats as st from scipy.optimize import curve_fit as cu from astropy.io import fits import astropy.cosmology as co from legacyanalysis.pathnames import get_...
[ "matplotlib.pyplot.grid", "numpy.log10", "matplotlib.pyplot.ylabel", "astropy.io.fits.open", "legacyanalysis.pathnames.get_outdir", "numpy.arange", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.ylim", "matplotlib.use", "legacyanalysis.pathnames.get_indir", "matplotlib.pyplot.axes", "scipy.sta...
[((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((353, 372), 'legacyanalysis.pathnames.get_indir', 'get_indir', (['"""cosmos"""'], {}), "('cosmos')\n", (362, 372), False, 'from legacyanalysis.pathnames import get_indir, get_outdir, make_dir\n'),...
import glob import os from typing import List, Callable import cv2 import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import to_rgb from scipy.stats import wasserstein_distance from sklearn.cluster import KMeans from sklearn.decomposition import PCA from sklearn.pipeline import Pipeline from im...
[ "sklearn.cluster.KMeans", "matplotlib.pyplot.imshow", "numpy.histogram", "os.listdir", "os.makedirs", "numpy.hstack", "sklearn.decomposition.PCA", "numpy.random.choice", "numpy.sum", "scipy.stats.wasserstein_distance", "image_clustering.tiler.GridTiler", "os.path.basename", "numpy.linalg.nor...
[((4043, 4078), 'os.makedirs', 'os.makedirs', (['dataset'], {'exist_ok': '(True)'}), '(dataset, exist_ok=True)\n', (4054, 4078), False, 'import os\n'), ((678, 708), 'image_clustering.tiler.GridTiler', 'GridTiler', ([], {'tile_size': 'tile_size'}), '(tile_size=tile_size)\n', (687, 708), False, 'from image_clustering.til...
"""Functions for reading and writing XDMF files.""" import logging import os from copy import deepcopy import h5py import lxml.etree as etree import numpy as np from mocmg.mesh import GridMesh, Mesh module_log = logging.getLogger(__name__) numpy_to_xdmf_dtype = { "int32": ("Int", "4"), "int64": ("Int", "8")...
[ "logging.getLogger", "lxml.etree.Element", "lxml.etree.SubElement", "lxml.etree.ElementTree", "os.path.splitext", "h5py.File", "numpy.stack", "numpy.zeros", "os.path.basename", "numpy.concatenate", "copy.deepcopy" ]
[((215, 242), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (232, 242), False, 'import logging\n'), ((4712, 4780), 'lxml.etree.SubElement', 'etree.SubElement', (['xml_element', '"""Grid"""'], {'Name': 'name', 'GridType': '"""Uniform"""'}), "(xml_element, 'Grid', Name=name, GridType='Unif...
import math import numpy as np # # line segment intersection using vectors # see Computer Graphics by <NAME> # def segPerp(a) : b = np.empty_like(a) b[0] = -a[1] b[1] = a[0] return b # line segment a given by endpoints a1, a2 # line segment b given by endpoints b1, b2 # return def seg_intersect(a1,a2,...
[ "math.sqrt", "numpy.dot", "numpy.empty_like" ]
[((137, 153), 'numpy.empty_like', 'np.empty_like', (['a'], {}), '(a)\n', (150, 153), True, 'import numpy as np\n'), ((408, 423), 'numpy.dot', 'np.dot', (['dap', 'db'], {}), '(dap, db)\n', (414, 423), True, 'import numpy as np\n'), ((435, 450), 'numpy.dot', 'np.dot', (['dap', 'dp'], {}), '(dap, dp)\n', (441, 450), True,...
import numpy as np import matplotlib.pyplot as plt from sklearn import svm, datasets # import some data to play with iris = datasets.load_iris() X = iris.data[:, :2] # we only take the first two features. We could y = iris.target C = 1.0 # SVM regularization parameter svc = svm.SVC(kernel='linear', C=1,gamma=0).fit(X,...
[ "sklearn.datasets.load_iris", "matplotlib.pyplot.contourf", "sklearn.svm.SVC", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.scatter", "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "numpy.arange", "matplotlib.pyplot.show" ]
[((125, 145), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (143, 145), False, 'from sklearn import svm, datasets\n'), ((559, 579), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(1)', '(1)'], {}), '(1, 1, 1)\n', (570, 579), True, 'import matplotlib.pyplot as plt\n'), ((651, 705), 'matplo...
# -*- coding: utf-8 -*- # Copyright (c) 2019 <NAME> # wwdtm_scoreimage is relased under the terms of the Apache License 2.0 """Generate PNG image file based on WWDTM show score totals""" import json import math import os from typing import List import mysql.connector from mysql.connector.errors import DatabaseError, P...
[ "PIL.Image.fromarray", "os.getenv", "math.floor", "numpy.array", "json.load" ]
[((1450, 1471), 'math.floor', 'math.floor', (['new_value'], {}), '(new_value)\n', (1460, 1471), False, 'import math\n'), ((2275, 2313), 'numpy.array', 'numpy.array', (['values'], {'dtype': 'numpy.uint8'}), '(values, dtype=numpy.uint8)\n', (2286, 2313), False, 'import numpy\n'), ((2326, 2348), 'PIL.Image.fromarray', 'Im...
import numpy as np class Perceptron: @staticmethod def step(z): return 1 if z >= 0 else 0 def __init__(self, lr=0.01, epochs=100): self.lr = lr self.epochs = epochs self.W = None self.errors = None @staticmethod def weight_init(x): a = 1 + x.shape[1] sigma = np.sqrt(2/(a+1)) return np.random.n...
[ "numpy.random.normal", "numpy.shape", "numpy.dot", "numpy.sqrt" ]
[((283, 303), 'numpy.sqrt', 'np.sqrt', (['(2 / (a + 1))'], {}), '(2 / (a + 1))\n', (290, 303), True, 'import numpy as np\n'), ((309, 343), 'numpy.random.normal', 'np.random.normal', (['(0)', 'sigma'], {'size': 'a'}), '(0, sigma, size=a)\n', (325, 343), True, 'import numpy as np\n'), ((379, 400), 'numpy.dot', 'np.dot', ...
# + import numpy as np import tensorflow as tf from gpflow import set_trainable from gpflow.ci_utils import ci_niter from gpflow.kernels import RBF from gpflow.likelihoods import Gaussian from matplotlib import pyplot as plt from markovflow.kernels import Matern32 from markovflow.models import SparseSpatioTemporalVaria...
[ "gpflow.ci_utils.ci_niter", "matplotlib.pyplot.savefig", "numpy.random.rand", "markovflow.ssm_natgrad.SSMNaturalGradient", "markovflow.kernels.Matern32", "numpy.linspace", "numpy.random.randn", "tensorflow.optimizers.Adam", "numpy.random.seed", "numpy.concatenate", "gpflow.kernels.RBF", "numpy...
[((382, 400), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (396, 400), True, 'import numpy as np\n'), ((473, 508), 'gpflow.kernels.RBF', 'RBF', ([], {'variance': '(1.0)', 'lengthscales': '(0.2)'}), '(variance=1.0, lengthscales=0.2)\n', (476, 508), False, 'from gpflow.kernels import RBF\n'), ((523, 5...
import h5py import numpy as np import torch import cv2 from torch.utils.data import DataLoader, TensorDataset def get_data(batch_size=64): train_dataset = h5py.File('datasets/train_signs.h5', "r") x_train = np.array(train_dataset["train_set_x"][:]) # your train set features x_train = np.transpose(x_train,...
[ "torch.utils.data.TensorDataset", "h5py.File", "numpy.array", "torch.tensor", "torch.utils.data.DataLoader", "cv2.resize", "numpy.transpose", "cv2.imread" ]
[((161, 202), 'h5py.File', 'h5py.File', (['"""datasets/train_signs.h5"""', '"""r"""'], {}), "('datasets/train_signs.h5', 'r')\n", (170, 202), False, 'import h5py\n'), ((217, 258), 'numpy.array', 'np.array', (["train_dataset['train_set_x'][:]"], {}), "(train_dataset['train_set_x'][:])\n", (225, 258), True, 'import numpy...
import app.ai.model as model from app.ai.genetic import Genetic import app.ai.plot as plot import time import datetime import numpy as np import torch as t import threading import sys class Service(): def __init__(self, inputs=1, outputs=1, main_service=False): self.main_service = main_serv...
[ "numpy.float", "torch.stack", "datetime.datetime.now", "numpy.array", "app.ai.plot.linear", "app.ai.genetic.Genetic", "app.ai.model.Model_deep", "numpy.int", "torch.FloatTensor" ]
[((960, 1003), 'app.ai.model.Model_deep', 'model.Model_deep', (['self.inputs', 'self.outputs'], {}), '(self.inputs, self.outputs)\n', (976, 1003), True, 'import app.ai.model as model\n'), ((1271, 1295), 'app.ai.plot.linear', 'plot.linear', (['self.losses'], {}), '(self.losses)\n', (1282, 1295), True, 'import app.ai.plo...
""" Reinforcement Learning Using Q-learning, Double Q-learning, and Dyna-Q. Copyright (c) 2020 <NAME> References ---------- - Based on project 7 in the Georgia Tech Spring 2020 course "Machine Learning for Trading" by Prof. <NAME>. - Course: http://quantsoftware.gatech.edu/CS7646_Spring_2020 - Project: http://quant...
[ "numpy.mean", "numpy.median", "QLearner.QLearner", "robot.robot", "numpy.std", "numpy.array", "numpy.random.seed", "sys.exit", "numpy.loadtxt" ]
[((4817, 4859), 'numpy.array', 'np.array', (['[-1.0, -1.0, -1.0, +1.0, -100.0]'], {}), '([-1.0, -1.0, -1.0, +1.0, -100.0])\n', (4825, 4859), True, 'import numpy as np\n'), ((5097, 5143), 'numpy.array', 'np.array', (['[[-1, 0], [0, +1], [+1, 0], [0, -1]]'], {}), '([[-1, 0], [0, +1], [+1, 0], [0, -1]])\n', (5105, 5143), ...
import torch from torch.utils.data import Dataset import os from PIL import Image import numpy as np import PIL import torch.nn as nn from config import opt import pandas as pd import matplotlib.pyplot as plt from pathlib import Path import random import math class TextureDataset(Dataset): """Dataset wrapping ima...
[ "torch.nn.ReLU", "pandas.read_csv", "torch.nn.Sequential", "torch.sin", "numpy.array", "torch.cuda.is_available", "torch.arange", "os.listdir", "pathlib.Path", "torch.nn.Flatten", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "matplotlib.pyplot.title", ...
[((6041, 6067), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 5)'}), '(figsize=(5, 5))\n', (6051, 6067), True, 'import matplotlib.pyplot as plt\n'), ((6153, 6190), 'pandas.read_csv', 'pd.read_csv', (['csv_path'], {'index_col': 'None'}), '(csv_path, index_col=None)\n', (6164, 6190), True, 'import panda...
from PIL import Image, ImageDraw import sys import math, random from itertools import product from utils.ufarray import * import numpy as np def perform_dws(dws_energy, class_map, bbox_map,cutoff=0,min_ccoponent_size=0, return_ccomp_img = False): bbox_list = [] dws_energy = np.squeeze(dws_energy) class_m...
[ "numpy.amax", "numpy.average", "PIL.Image.new", "numpy.asanyarray", "numpy.squeeze", "numpy.transpose", "numpy.bincount", "random.randint", "numpy.round" ]
[((286, 308), 'numpy.squeeze', 'np.squeeze', (['dws_energy'], {}), '(dws_energy)\n', (296, 308), True, 'import numpy as np\n'), ((325, 346), 'numpy.squeeze', 'np.squeeze', (['class_map'], {}), '(class_map)\n', (335, 346), True, 'import numpy as np\n'), ((362, 382), 'numpy.squeeze', 'np.squeeze', (['bbox_map'], {}), '(b...
""" Code to extract a box-like region, typically for another modeler to use as a boundary contition. In cases where it gets velocity in addition to the rho-grid variables the grid limits mimic the standard ROMS organization, with the outermost corners being on the rho-grid. Job definitions are in LO_user/extract/box/...
[ "sys.exit", "job_definitions.get_box", "lo_tools.Lfun.make_dir", "numpy.mod", "lo_tools.Lfun.Lstart", "lo_tools.zrfun.get_z", "argparse.ArgumentParser", "subprocess.Popen", "os.getpid", "sys.stdout.flush", "lo_tools.Lfun.get_fn_list", "numpy.ones", "numpy.isnan", "xarray.open_dataset", "...
[((1163, 1174), 'os.getpid', 'os.getpid', ([], {}), '()\n', (1172, 1174), False, 'import os\n'), ((1288, 1313), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1311, 1313), False, 'import argparse\n'), ((2719, 2775), 'lo_tools.Lfun.Lstart', 'Lfun.Lstart', ([], {'gridname': 'gridname', 'tag': 't...
import argparse import os import random from envs import MappingEnvironment, LocalISM import numpy as np parser = argparse.ArgumentParser() # General Stuff parser.add_argument('--experiment', default='runs/myopic', help='folder to put results of experiment in') # Environment parser.add_argument('--N', type=int, de...
[ "numpy.ones", "os.makedirs", "argparse.ArgumentParser", "envs.LocalISM", "os.path.join", "random.seed", "envs.MappingEnvironment", "numpy.sum", "numpy.random.seed", "random.random", "random.randint" ]
[((117, 142), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (140, 142), False, 'import argparse\n'), ((1040, 1061), 'random.seed', 'random.seed', (['opt.seed'], {}), '(opt.seed)\n', (1051, 1061), False, 'import random\n'), ((1062, 1086), 'numpy.random.seed', 'np.random.seed', (['opt.seed'], {}...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Meeko hydrate molecule # import numpy as np from .utils import geomutils from .utils import obutils class HydrateMoleculeLegacy: def __init__(self, distance=3.0, charge=0, atom_type="W"): """Initialize the legacy hydrate typer for AutoDock 4.2.x ...
[ "numpy.radians", "numpy.array" ]
[((1867, 1887), 'numpy.array', 'np.array', (['[position]'], {}), '([position])\n', (1875, 1887), True, 'import numpy as np\n'), ((2190, 2210), 'numpy.array', 'np.array', (['[position]'], {}), '([position])\n', (2198, 2210), True, 'import numpy as np\n'), ((2993, 3012), 'numpy.array', 'np.array', (['positions'], {}), '(...
import streamlit as st import json from joblib import dump, load import numpy as np import glob with open('params.json') as f: config = json.load(f) features = config['feature_names'] models = glob.glob('artifacts/*.joblib')+glob.glob('artifacts/*.pkl') if len(models)>0: model = load(models[0]) st.title('Welcome ...
[ "numpy.array", "joblib.load", "json.load", "glob.glob", "streamlit.title" ]
[((302, 324), 'streamlit.title', 'st.title', (['"""Welcome to"""'], {}), "('Welcome to')\n", (310, 324), True, 'import streamlit as st\n'), ((325, 355), 'streamlit.title', 'st.title', (["config['model_name']"], {}), "(config['model_name'])\n", (333, 355), True, 'import streamlit as st\n'), ((138, 150), 'json.load', 'js...
import numpy as np import requests import random import pandas as pd import time import multiprocessing url = 'https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt' existingWords = requests.get(url) existingWords = existingWords.text.split() existingWords = [word for word in existingWo...
[ "random.choice", "pandas.DataFrame", "multiprocessing.Process", "requests.get", "numpy.array", "multiprocessing.Manager", "time.time" ]
[((213, 230), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (225, 230), False, 'import requests\n'), ((460, 483), 'random.choice', 'random.choice', (['alphabet'], {}), '(alphabet)\n', (473, 483), False, 'import random\n'), ((4981, 4992), 'time.time', 'time.time', ([], {}), '()\n', (4990, 4992), False, 'impo...
# # Progression of infection within individuals # import random import numpy as np import pyEpiabm as pe from pyEpiabm.core import Person from pyEpiabm.property import InfectionStatus from pyEpiabm.utility import StateTransitionMatrix, TransitionTimeMatrix from .abstract_sweep import AbstractSweep class HostProgre...
[ "pyEpiabm.Parameters.instance", "pyEpiabm.property.InfectionStatus", "pyEpiabm.utility.TransitionTimeMatrix", "numpy.floor", "random.choices", "numpy.random.gamma", "pyEpiabm.utility.StateTransitionMatrix" ]
[((1116, 1139), 'pyEpiabm.utility.StateTransitionMatrix', 'StateTransitionMatrix', ([], {}), '()\n', (1137, 1139), False, 'from pyEpiabm.utility import StateTransitionMatrix, TransitionTimeMatrix\n'), ((1555, 1577), 'pyEpiabm.utility.TransitionTimeMatrix', 'TransitionTimeMatrix', ([], {}), '()\n', (1575, 1577), False, ...
#!/usr/bin/env python3 import numpy as np ############################################################# class Person(): def __init__(self, _id, pos, moveinterval, destiny): self.id = _id self.destiny = destiny self.pos = pos self.moveinterval = moveinterval self.path = np....
[ "numpy.array" ]
[((317, 345), 'numpy.array', 'np.array', (['[]'], {'dtype': 'np.int64'}), '([], dtype=np.int64)\n', (325, 345), True, 'import numpy as np\n')]
import numpy as np import cv2 import operator import numpy as np from matplotlib import pyplot as plt def plot_many_images(images, titles, rows=1, columns=2): """Plots each image in a given list as a grid structure. using Matplotlib.""" for i, image in enumerate(images): plt.subplot(rows, columns, i+1) plt.imsh...
[ "numpy.sqrt", "numpy.array", "operator.itemgetter", "matplotlib.pyplot.imshow", "cv2.__version__.split", "numpy.mean", "matplotlib.pyplot.yticks", "numpy.concatenate", "cv2.drawContours", "matplotlib.pyplot.xticks", "cv2.getPerspectiveTransform", "cv2.floodFill", "cv2.cvtColor", "matplotli...
[((414, 424), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (422, 424), True, 'from matplotlib import pyplot as plt\n'), ((2470, 2524), 'cv2.drawContours', 'cv2.drawContours', (['img', 'contours', '(-1)', 'colour', 'thickness'], {}), '(img, contours, -1, colour, thickness)\n', (2486, 2524), False, 'import cv2...
from ..tools.velocity_embedding import quiver_autoscale, velocity_embedding from ..tools.utils import groups_to_bool from .utils import * from .scatter import scatter from .docs import doc_scatter, doc_params from sklearn.neighbors import NearestNeighbors from scipy.stats import norm as normal from matplotlib import r...
[ "numpy.mean", "numpy.abs", "numpy.unique", "matplotlib.pyplot.plot", "numpy.max", "numpy.array", "matplotlib.pyplot.figure", "scipy.stats.norm.pdf", "numpy.vstack", "sklearn.neighbors.NearestNeighbors", "numpy.min", "numpy.percentile", "numpy.meshgrid", "numpy.maximum", "matplotlib.pyplo...
[((1146, 1163), 'numpy.meshgrid', 'np.meshgrid', (['*grs'], {}), '(*grs)\n', (1157, 1163), True, 'import numpy as np\n'), ((1328, 1380), 'sklearn.neighbors.NearestNeighbors', 'NearestNeighbors', ([], {'n_neighbors': 'n_neighbors', 'n_jobs': '(-1)'}), '(n_neighbors=n_neighbors, n_jobs=-1)\n', (1344, 1380), False, 'from ...
import numpy as np np.random.seed(0) import torch torch.manual_seed(0) from torch.utils.data import Dataset, DataLoader, ConcatDataset, RandomSampler import torchvision import imageio import importlib import random import glob import os import transforms_3d class patch_DS(Dataset): """Implementation of torch...
[ "torch.utils.data.ConcatDataset", "torch.manual_seed", "numpy.mean", "importlib.import_module", "numpy.std", "random.seed", "numpy.max", "numpy.array", "numpy.zeros", "numpy.random.seed", "numpy.min", "imageio.imread", "torchvision.transforms.ToTensor", "transforms_3d.get_transformer", "...
[((19, 36), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (33, 36), True, 'import numpy as np\n'), ((50, 70), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (67, 70), False, 'import torch\n'), ((8191, 8228), 'importlib.import_module', 'importlib.import_module', (['"""dataloader"""'],...
import numpy as np import pandas as pd import pytest from pandas.testing import assert_index_equal from evalml.pipelines import RegressionPipeline def test_regression_init(): clf = RegressionPipeline( component_graph=["Imputer", "One Hot Encoder", "Random Forest Regressor"] ) assert clf.parameter...
[ "pandas.Series", "evalml.pipelines.RegressionPipeline", "numpy.arange", "pandas.testing.assert_index_equal", "pytest.mark.parametrize", "pytest.raises", "pandas.date_range" ]
[((1943, 2013), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""target_type"""', "['category', 'string', 'bool']"], {}), "('target_type', ['category', 'string', 'bool'])\n", (1966, 2013), False, 'import pytest\n'), ((188, 285), 'evalml.pipelines.RegressionPipeline', 'RegressionPipeline', ([], {'component_gr...
import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation from mpl_toolkits.mplot3d import Axes3D import numpy as np from RK_Driver import dcm_from_q # Make a 2D plot of the results for the angular velocity # Inputs: # - Time array (time[ N ]) [sec] # - Angular rate array (om_arr[ N ][ 3 ]) [rad/s...
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "RK_Driver.dcm_from_q", "numpy.array", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.matmul", "matplotlib.pyplot.pause", "matplotlib.pyplot.title", "numpy.transpose", "matplotlib.pyplot.cla", "matplotlib.py...
[((496, 510), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (508, 510), True, 'import matplotlib.pyplot as plt\n'), ((799, 821), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Time (s)"""'], {}), "('Time (s)')\n", (809, 821), True, 'import matplotlib.pyplot as plt\n'), ((828, 862), 'matplotlib.pyplot...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 8 20:58:20 2021 @author: <NAME> @email: <EMAIL> Conjunto básico de testes de unidade para avaliar as instâncias utilizadas. """ from unittest import TestCase, main import os import numpy as np import pandas as pd class BasicTests(TestCase): ...
[ "unittest.main", "numpy.array", "os.path.join", "pandas.read_csv" ]
[((3205, 3211), 'unittest.main', 'main', ([], {}), '()\n', (3209, 3211), False, 'from unittest import TestCase, main\n'), ((410, 461), 'os.path.join', 'os.path.join', (['"""data"""', '"""instances"""', '"""instance-1.csv"""'], {}), "('data', 'instances', 'instance-1.csv')\n", (422, 461), False, 'import os\n'), ((475, 5...
import numpy as np import matplotlib.pyplot as plt import math from pynverse import inversefunc from IPython import get_ipython get_ipython().magic('reset -sf') import pandas as pd from scipy.optimize import leastsq, least_squares, curve_fit import os from scipy import interpolate import scipy.integrate as ...
[ "IPython.get_ipython", "numpy.abs", "scipy.integrate.quad", "numpy.arcsin", "numpy.asarray", "scipy.interpolate.interp1d", "numpy.exp", "pynverse.inversefunc", "numpy.sin" ]
[((3502, 3528), 'scipy.interpolate.interp1d', 'interpolate.interp1d', (['x', 'y'], {}), '(x, y)\n', (3522, 3528), False, 'from scipy import interpolate\n'), ((3587, 3613), 'scipy.interpolate.interp1d', 'interpolate.interp1d', (['x', 'y'], {}), '(x, y)\n', (3607, 3613), False, 'from scipy import interpolate\n'), ((3623,...
import json import os.path import time import numpy as np import matplotlib.pyplot as plt from collections import OrderedDict import torch from torch import nn, optim import torch.nn.functional as F from torchvision import datasets, transforms, models from PIL import Image # TODO: Fix bug with the epoch print in the ...
[ "numpy.clip", "torch.nn.ReLU", "torch.nn.Dropout", "torch.nn.CrossEntropyLoss", "torch.nn.Sequential", "torch.max", "torch.from_numpy", "numpy.array", "torch.cuda.is_available", "numpy.arange", "matplotlib.pyplot.plot", "numpy.max", "torchvision.datasets.ImageFolder", "torchvision.models.v...
[((646, 665), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (658, 665), False, 'import torch\n'), ((1694, 1715), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (1713, 1715), False, 'from torch import nn, optim\n'), ((1742, 1759), 'torch.nn.Softmax', 'nn.Softmax', ([], {'dim': ...
import numpy.testing as npt from handyspark import * # boolean returns def test_between(sdf, pdf): hdf = sdf.toHandy() hdf = hdf.assign(newcol=hdf.pandas['Age'].between(left=20, right=40)) hres = hdf.cols['newcol'][:20] res = pdf['Age'].between(left=20, right=40)[:20] npt.assert_array_equal(hres, r...
[ "numpy.testing.assert_array_equal" ]
[((290, 323), 'numpy.testing.assert_array_equal', 'npt.assert_array_equal', (['hres', 'res'], {}), '(hres, res)\n', (312, 323), True, 'import numpy.testing as npt\n'), ((530, 563), 'numpy.testing.assert_array_equal', 'npt.assert_array_equal', (['hres', 'res'], {}), '(hres, res)\n', (552, 563), True, 'import numpy.testi...
################################################################################################################# #### GUI Interface for users ################################################################################################################# from tkinter import * import tkinter as tk import tkinter.messa...
[ "sklearn.preprocessing.StandardScaler", "numpy.array", "tkinter.messagebox.showinfo", "keras.models.load_model" ]
[((11493, 11615), 'numpy.array', 'np.array', (['[[i2, i1, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16,\n i17, i18, i19, i20, i21, i22, i23]]'], {}), '([[i2, i1, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15,\n i16, i17, i18, i19, i20, i21, i22, i23]])\n', (11501, 11615), True, 'import...
''' BSD 3-Clause License Copyright (c) 2020, <NAME>, <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of con...
[ "PIL.Image.open", "numpy.sqrt", "numpy.power", "os.path.join", "cv2.filter2D", "numpy.squeeze", "numpy.array", "numpy.linspace", "numpy.outer", "numpy.zeros", "numpy.dot", "numpy.rot90", "numpy.zeros_like" ]
[((4385, 4427), 'numpy.linspace', 'np.linspace', (['(-(size // 2))', '(size // 2)', 'size'], {}), '(-(size // 2), size // 2, size)\n', (4396, 4427), True, 'import numpy as np\n'), ((4669, 4711), 'numpy.outer', 'np.outer', (['self.kernel_1d.T', 'self.kernel_1d'], {}), '(self.kernel_1d.T, self.kernel_1d)\n', (4677, 4711)...
# 어휘 사전과 워드 임베딩을 만들고, 학습을 위해 대화 데이터를 읽어들이는 유틸리티들의 모음 import tensorflow as tf import numpy as np import re import codecs from config import FLAGS class Dialog(): _PAD_ = "_PAD_" # 빈칸 채우는 심볼 _STA_ = "_STA_" # 디코드 입력 시퀀스의 시작 심볼 _EOS_ = "_EOS_" # 디코드 입출력 시퀀스의 종료 심볼 _UNK_ = "_UNK_" # 사전에 없는 단어를 나타내는 ...
[ "numpy.eye", "re.compile", "tensorflow.app.run" ]
[((6255, 6267), 'tensorflow.app.run', 'tf.app.run', ([], {}), '()\n', (6265, 6267), True, 'import tensorflow as tf\n'), ((4594, 4623), 're.compile', 're.compile', (['"""([.,!?"\':;)(])"""'], {}), '(\'([.,!?"\\\':;)(])\')\n', (4604, 4623), False, 'import re\n'), ((2543, 2566), 'numpy.eye', 'np.eye', (['self.vocab_size']...
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under ...
[ "models.encode_inputs", "os.path.exists", "nnabla.functions.randn", "models.SpadeGenerator", "nnabla.functions.one_hot", "nnabla.functions.transpose", "argparse.ArgumentParser", "os.makedirs", "nnabla.utils.image_utils.imsave", "os.path.join", "nnabla.load_parameters", "nnabla.functions.concat...
[((846, 871), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (869, 871), False, 'import argparse\n'), ((1407, 1440), 'os.path.dirname', 'os.path.dirname', (['args.load_params'], {}), '(args.load_params)\n', (1422, 1440), False, 'import os\n'), ((3193, 3219), 'numpy.random.RandomState', 'np.rand...
""" Goal - Calculate distance travelled by each fish Date - Mar 11 2021 """ import os import pathlib from pprint import pprint import numpy as np from scipy import stats from scipy.spatial import distance import matplotlib.pyplot as plt from matplotlib.pyplot import figure import trajectorytools as tt import trajec...
[ "pandas.read_csv", "csv.writer", "numpy.nanmean", "numpy.linalg.norm", "trajectorytools.Trajectories.from_idtrackerai" ]
[((2854, 2919), 'pandas.read_csv', 'pd.read_csv', (['"""../../data/temp_collective/roi/metadata_w_loom.csv"""'], {}), "('../../data/temp_collective/roi/metadata_w_loom.csv')\n", (2865, 2919), True, 'import pandas as pd\n'), ((687, 713), 'numpy.linalg.norm', 'np.linalg.norm', (['v'], {'axis': '(-1)'}), '(v, axis=-1)\n',...
# in this tutorial, you will learn how to use for loop statement in python import numpy as np # Aim: We want to print "Hello" 10 times: # np.arange creates a sequence from 0-9. # in each loop i is given a number in the sequence (in order) # the ":" is the beginning of the loop" # The moment you press enter after t...
[ "numpy.arange" ]
[((774, 790), 'numpy.arange', 'np.arange', (['(0)', '(10)'], {}), '(0, 10)\n', (783, 790), True, 'import numpy as np\n')]
################################################################################# # The Institute for the Design of Advanced Energy Systems Integrated Platform # Framework (IDAES IP) was produced under the DOE Institute for the # Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021 # by the softwar...
[ "logging.getLogger", "pandas.DataFrame", "numpy.array", "json.load", "csv.reader" ]
[((1314, 1341), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1331, 1341), False, 'import logging\n'), ((3757, 3770), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (3766, 3770), False, 'import json\n'), ((9668, 9699), 'pandas.DataFrame', 'pd.DataFrame', (['a2'], {'columns': 'names'}...
import csv import librosa import numpy as np import soundfile as sf import torch from torch import Tensor from torch.utils.data import Dataset import torchvision.transforms as transforms from typing import Tuple from src import constants from src.model.config import Config, Input from src.utils.split import Split from...
[ "torchvision.transforms.CenterCrop", "torch.load", "librosa.to_mono", "torch.from_numpy", "src.utils.full_path.full_path", "librosa.resample", "soundfile.read", "csv.reader", "numpy.float32", "src.constants.get_dataset" ]
[((587, 600), 'soundfile.read', 'sf.read', (['file'], {}), '(file)\n', (594, 600), True, 'import soundfile as sf\n'), ((633, 655), 'librosa.to_mono', 'librosa.to_mono', (['array'], {}), '(array)\n', (648, 655), False, 'import librosa\n'), ((1074, 1091), 'numpy.float32', 'np.float32', (['array'], {}), '(array)\n', (1084...
import numpy as np import matplotlib.pyplot as plt import pandas as pd import math import warnings warnings.filterwarnings(action='once') data = None; matData = None; def initData(csvName): data = pd.read_csv(csvName) matData = pd.DataFrame(columns=['Name','Diameter','Length','Reduced Diamter','Area','Reduce...
[ "matplotlib.pyplot.savefig", "pandas.read_csv", "numpy.polyfit", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.linspace", "pandas.DataFrame", "matplotlib.pyplot.title", "warnings.filterwarnings", "matplotlib.pyplot.legend" ]
[((100, 138), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""once"""'}), "(action='once')\n", (123, 138), False, 'import warnings\n'), ((204, 224), 'pandas.read_csv', 'pd.read_csv', (['csvName'], {}), '(csvName)\n', (215, 224), True, 'import pandas as pd\n'), ((239, 451), 'pandas.DataFrame', ...
import numpy as np def _check_inverse(coeffs): det = np.linalg.det(coeffs) #import ipdb; ipdb.set_trace() if np.isclose(det, 0.0): raise ZeroDivisionError def _matrix_sanity(coeffs): assert(coeffs.ndim == 2)#, 'Input matrix must be 2 dimensional') assert(coeffs.shape[0]+1 == coeffs.shape[...
[ "numpy.matrix", "numpy.isclose", "numpy.genfromtxt", "numpy.linalg.det" ]
[((59, 80), 'numpy.linalg.det', 'np.linalg.det', (['coeffs'], {}), '(coeffs)\n', (72, 80), True, 'import numpy as np\n'), ((123, 143), 'numpy.isclose', 'np.isclose', (['det', '(0.0)'], {}), '(det, 0.0)\n', (133, 143), True, 'import numpy as np\n'), ((381, 424), 'numpy.genfromtxt', 'np.genfromtxt', (['coefficients_file'...
''' SVM2+ ''' # Author: <NAME> <<EMAIL>> import numpy as np import utils from sklearn.base import BaseEstimator from sklearn.svm import SVC from sklearn.metrics.pairwise import (rbf_kernel, linear_kernel, polynomial_kernel, ...
[ "numpy.identity", "sklearn.metrics.pairwise.sigmoid_kernel", "sklearn.metrics.pairwise.rbf_kernel", "sklearn.metrics.pairwise.polynomial_kernel", "utils.unbinarize_targets", "numpy.dot", "numpy.outer", "numpy.sign", "sklearn.metrics.pairwise.linear_kernel", "utils.binarize_targets", "sklearn.svm...
[((3514, 3539), 'utils.binarize_targets', 'utils.binarize_targets', (['y'], {}), '(y)\n', (3536, 3539), False, 'import utils\n'), ((6224, 6249), 'utils.binarize_targets', 'utils.binarize_targets', (['y'], {}), '(y)\n', (6246, 6249), False, 'import utils\n'), ((6548, 6863), 'sklearn.svm.SVC', 'SVC', ([], {'C': 'self.C',...
import prona2019Mod.utils as utils import itertools as it from six import iteritems, string_types, PY2, next import numpy as np import sys def _is_single(obj): """ Check whether `obj` is a single document or an entire corpus. Returns (is_single, new) 2-tuple, where `new` yields the same sequence as `o...
[ "itertools.chain", "prona2019Mod.utils.to_unicode", "numpy.array", "prona2019Mod.utils.any2utf8", "sys.exit", "six.next" ]
[((527, 541), 'six.next', 'next', (['obj_iter'], {}), '(obj_iter)\n', (531, 541), False, 'from six import iteritems, string_types, PY2, next\n'), ((561, 587), 'itertools.chain', 'it.chain', (['[peek]', 'obj_iter'], {}), '([peek], obj_iter)\n', (569, 587), True, 'import itertools as it\n'), ((2215, 2232), 'prona2019Mod....
""" Judge suit: 最好的一组5张牌 cards: 手牌 Card: size=2数组表示(kind, digit) """ from collections import defaultdict import enum import numpy as np from .poker import PokerDigit, PokerKind, PokerCard class TexasLevel(enum.IntEnum): # 皇家同花顺 和 同花顺 可以一起比较 straight_flush = 9 # 同花顺 four = 8 # 4条 full_h...
[ "numpy.argsort", "collections.defaultdict" ]
[((2997, 3023), 'numpy.argsort', 'np.argsort', (['packed_results'], {}), '(packed_results)\n', (3007, 3023), True, 'import numpy as np\n'), ((7192, 7208), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (7203, 7208), False, 'from collections import defaultdict\n')]
import sys import os; os.umask(7) # group permisions but that's all import os.path as osp import pdb import json import tqdm import numpy as np import torch import torch.nn.functional as F from dirtorch.utils.convenient import mkdir from dirtorch.utils import common from dirtorch.utils.pytorch_loader import get_load...
[ "dirtorch.utils.common.load_checkpoint", "dirtorch.nets.create_model", "dirtorch.utils.common.torch_set_gpu", "numpy.save", "os.path.exists", "argparse.ArgumentParser", "dirtorch.datasets.create", "torch.mean", "os.umask", "hashlib.md5", "os.path.splitext", "torch.sign", "pickle.load", "di...
[((22, 33), 'os.umask', 'os.umask', (['(7)'], {}), '(7)\n', (30, 33), False, 'import os\n'), ((482, 495), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (493, 495), False, 'import hashlib\n'), ((798, 819), 'torch.stack', 'torch.stack', (['x'], {'dim': '(0)'}), '(x, dim=0)\n', (809, 819), False, 'import torch\n'), ((25...
# Copyright (c) 2019-2022, NVIDIA CORPORATION. import warnings from collections import defaultdict from contextlib import ExitStack from typing import Dict, List, Tuple from uuid import uuid4 import numpy as np from pyarrow import dataset as ds, parquet as pq import cudf from cudf._lib import parquet as libparquet f...
[ "cudf.utils.ioutils._get_filesystem_and_paths", "cudf.utils.ioutils.stringify_pathlike", "cudf.api.types.is_list_like", "cudf.utils.ioutils.doc_to_parquet", "pyarrow.parquet._filters_to_expression", "cudf.utils.ioutils.get_filepath_or_buffer", "pyarrow.parquet.write_to_dataset", "cudf.utils.ioutils.ge...
[((5122, 5157), 'cudf.utils.ioutils.doc_read_parquet_metadata', 'ioutils.doc_read_parquet_metadata', ([], {}), '()\n', (5155, 5157), False, 'from cudf.utils import ioutils\n'), ((10517, 10543), 'cudf.utils.ioutils.doc_read_parquet', 'ioutils.doc_read_parquet', ([], {}), '()\n', (10541, 10543), False, 'from cudf.utils i...
""" Benchmarks for QuickBundles Run all benchmarks with:: import dipy.segment as dipysegment dipysegment.bench() With Pytest, Run this benchmark with: pytest -svv -c bench.ini /path/to/bench_quickbundles.py """ import numpy as np import nibabel as nib from dipy.data import get_fnames import dipy.trac...
[ "dipy.segment.quickbundles.QuickBundles", "numpy.testing.measure", "dipy.segment.clustering.QuickBundles", "numpy.testing.assert_equal", "dipy.data.get_fnames", "dipy.testing.assert_arrays_equal", "dipy.tracking.streamline.set_number_of_points", "numpy.sum", "numpy.array" ]
[((1139, 1195), 'dipy.tracking.streamline.set_number_of_points', 'streamline_utils.set_number_of_points', (['fornix', 'nb_points'], {}), '(fornix, nb_points)\n', (1176, 1195), True, 'import dipy.tracking.streamline as streamline_utils\n'), ((2087, 2127), 'dipy.segment.quickbundles.QuickBundles', 'QB_Old', (['streamline...
import datetime import os import copy import json import numpy as np from pytz import timezone from gamified_squad import GamifiedSquad from agent import CustomAgent import generic import evaluate SAVE_CHECKPOINT = 100000 def train(): time_1 = datetime.datetime.now() config = generic.load_config() env =...
[ "generic.HistoryScoreCache", "os.path.exists", "agent.CustomAgent", "numpy.mean", "pytz.timezone", "generic.to_np", "datetime.datetime.now", "numpy.array", "generic.to_pt", "numpy.sum", "numpy.random.seed", "gamified_squad.GamifiedSquad", "copy.deepcopy", "evaluate.evaluate", "generic.lo...
[((252, 275), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (273, 275), False, 'import datetime\n'), ((289, 310), 'generic.load_config', 'generic.load_config', ([], {}), '()\n', (308, 310), False, 'import generic\n'), ((321, 342), 'gamified_squad.GamifiedSquad', 'GamifiedSquad', (['config'], {}), ...
import argparse import os import traceback import matplotlib.pyplot as plt from matplotlib.pyplot import imshow import scipy.io import scipy.misc import numpy as np import pandas as pd import PIL from cv2 import cv2 import time import tensorflow as tf from keras import backend as K from keras.layers import Input, Lambd...
[ "cv2.cv2.VideoCapture", "keras.models.load_model", "ObjectDetection.Preprocessing.GenerateColors", "keras.backend.learning_phase", "cv2.cv2.waitKey", "ObjectDetection.Preprocessing.DrawBoxes", "numpy.asarray", "cv2.cv2.destroyAllWindows", "traceback.print_exc", "ObjectDetection.Preprocessing.Prepr...
[((3303, 3334), 'cv2.cv2.VideoCapture', 'cv2.VideoCapture', (['cv2.CAP_DSHOW'], {}), '(cv2.CAP_DSHOW)\n', (3319, 3334), False, 'from cv2 import cv2\n'), ((1563, 1618), 'ObjectDetection.Preprocessing.PreprocessImageHybrid', 'PreprocessImageHybrid', (['image'], {'modelImageSize': '(608, 608)'}), '(image, modelImageSize=(...
import numpy as np from phonopy import Phonopy from phonopy.interface.vasp import read_vasp from phonopy.file_IO import parse_FORCE_SETS, parse_BORN from phonopy.structure.atoms import PhonopyAtoms def append_band(bands, q_start, q_end): band = [] for i in range(51): band.append(np.array(q_start) + ...
[ "phonopy.file_IO.parse_BORN", "phonopy.Phonopy", "phonopy.interface.vasp.read_vasp", "numpy.array", "phonopy.file_IO.parse_FORCE_SETS" ]
[((467, 486), 'phonopy.interface.vasp.read_vasp', 'read_vasp', (['"""POSCAR"""'], {}), "('POSCAR')\n", (476, 486), False, 'from phonopy.interface.vasp import read_vasp\n'), ((1145, 1266), 'phonopy.Phonopy', 'Phonopy', (['unitcell', '[[2, 0, 0], [0, 2, 0], [0, 0, 2]]'], {'primitive_matrix': '[[0, 0.5, 0.5], [0.5, 0, 0.5...
import numpy as np import matplotlib.pyplot as plt from matplotlib import patches from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter from matplotlib.figure import Figure from matplotlib import rcParams def dBofHz(inputHz): '''...
[ "matplotlib.pyplot.grid", "numpy.sqrt", "matplotlib.pyplot.savefig", "numpy.log10", "matplotlib.ticker.LinearLocator", "numpy.real", "numpy.linspace", "matplotlib.pyplot.figure", "matplotlib.ticker.FormatStrFormatter", "matplotlib.pyplot.subplots", "numpy.cos", "numpy.sin", "numpy.meshgrid",...
[((1293, 1325), 'numpy.sqrt', 'np.sqrt', (['(summR ** 2 + summI ** 2)'], {}), '(summR ** 2 + summI ** 2)\n', (1300, 1325), True, 'import numpy as np\n'), ((1609, 1630), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(50)'], {}), '(0, 1, 50)\n', (1620, 1630), True, 'import numpy as np\n'), ((1648, 1678), 'numpy.linsp...
#!/usr/bin/env python import numpy as np from numpy import cos, sin, tanh, pi # generate random synthetic 2D field def deterministic_field(i, j, X, Y): r = (i*2*pi)/X t = (j*2*pi)/Y return sin(r)*sin(t) + sin(2.1*r)*sin(2.1*t) \ + sin(3.1*r)*sin(3.1*t) + tanh(r)*cos(t) \ + tanh(2*r)*cos(2....
[ "numpy.tanh", "numpy.zeros", "numpy.linspace", "numpy.cos", "numpy.sin" ]
[((502, 523), 'numpy.zeros', 'np.zeros', (['(obs, time)'], {}), '((obs, time))\n', (510, 523), True, 'import numpy as np\n'), ((763, 779), 'numpy.zeros', 'np.zeros', (['(m, n)'], {}), '((m, n))\n', (771, 779), True, 'import numpy as np\n'), ((409, 424), 'numpy.tanh', 'tanh', (['(r + 2 * t)'], {}), '(r + 2 * t)\n', (413...
# Copyright 2019 The FastEstimator Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
[ "numpy.mean", "tensorflow.is_tensor", "torch.mean", "numpy.std", "torch.tensor", "tensorflow.maximum", "tensorflow.reduce_mean", "tensorflow.cast", "torch.std", "tensorflow.keras.backend.std", "typing.TypeVar" ]
[((786, 840), 'typing.TypeVar', 'TypeVar', (['"""Tensor"""', 'tf.Tensor', 'torch.Tensor', 'np.ndarray'], {}), "('Tensor', tf.Tensor, torch.Tensor, np.ndarray)\n", (793, 840), False, 'from typing import TypeVar\n'), ((1767, 1785), 'tensorflow.is_tensor', 'tf.is_tensor', (['data'], {}), '(data)\n', (1779, 1785), True, 'i...
# -*- coding: utf-8 -*- # @Author: yulidong # @Date: 2018-04-25 23:06:40 # @Last Modified by: yulidong # @Last Modified time: 2018-11-20 00:11:31 import os import torch import numpy as np import scipy.misc as m import cv2 from torch.utils import data from python_pfm import * import torchvision.transforms as trans...
[ "numpy.mean", "os.listdir", "os.path.join", "numpy.max", "numpy.min" ]
[((378, 436), 'os.path.join', 'os.path.join', (['"""/home/dataset/datasets/nyu2_depth/npy_data"""'], {}), "('/home/dataset/datasets/nyu2_depth/npy_data')\n", (390, 436), False, 'import os\n'), ((443, 459), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (453, 459), False, 'import os\n'), ((536, 564), 'os.path.j...
#!/usr/bin/env python """Write out the KL distance between two kmer models """ from __future__ import print_function import os, sys import numpy as np from vis_kmer_distributions import * from scipy.stats import entropy from scipy.spatial.distance import euclidean from itertools import product from argparse import Argu...
[ "os.path.exists", "scipy.stats.entropy", "numpy.sqrt", "argparse.ArgumentParser", "itertools.product", "numpy.linspace" ]
[((795, 805), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (802, 805), True, 'import numpy as np\n'), ((364, 399), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (378, 399), False, 'from argparse import ArgumentParser\n'), ((1099, 1134), 'os.path.exists', '...
import sys sys.path.insert(0, '../../../src_python') import nmpccodegen as nmpc import nmpccodegen.tools as tools import nmpccodegen.models as models import nmpccodegen.controller as controller import nmpccodegen.controller.obstacles as obstacles import nmpccodegen.Cfunctions as cfunctions import nmpccodegen.example_mo...
[ "sys.path.insert", "numpy.reshape", "nmpccodegen.example_models.get_trailer_model", "matplotlib.pyplot.xlim", "matplotlib.pyplot.ylim", "nmpccodegen.Cfunctions.IndicatorBoxFunction", "nmpccodegen.controller.Stage_cost_QR", "numpy.diag", "numpy.array", "numpy.zeros", "matplotlib.pyplot.figure", ...
[((11, 52), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../../src_python"""'], {}), "(0, '../../../src_python')\n", (26, 52), False, 'import sys\n'), ((685, 770), 'nmpccodegen.tools.Bootstrapper.bootstrap', 'tools.Bootstrapper.bootstrap', (['trailer_controller_location'], {'simulation_tools': '(True)'}), '(tr...
import torch from torch import nn from torch.nn import functional as F from torch import optim from torch.autograd import Variable import numpy as np class ConcreteDropout(nn.Module): def __init__(self, weight_regularizer=1e-7, dropout_regularizer=1e-6, init_min=0.1, init_max=0.1): super(C...
[ "torch.mul", "torch.log", "torch.rand_like", "numpy.log", "torch.sigmoid", "torch.pow", "torch.empty" ]
[((712, 739), 'torch.sigmoid', 'torch.sigmoid', (['self.p_logit'], {}), '(self.p_logit)\n', (725, 739), False, 'import torch\n'), ((1525, 1543), 'torch.rand_like', 'torch.rand_like', (['x'], {}), '(x)\n', (1540, 1543), False, 'import torch\n'), ((1756, 1787), 'torch.sigmoid', 'torch.sigmoid', (['(drop_prob / temp)'], {...
# Streng kopi af tds artikel import numpy as np import pandas as pd import datetime import matplotlib.pyplot as plt import ipywidgets as widgets import scipy.stats as scs import scipy.optimize as sco import statsmodels.api as sm import scipy.interpolate as sci from pandas_datareader import data as pdr import yfinance ...
[ "datetime.datetime", "numpy.sqrt", "matplotlib.pyplot.ylabel", "numpy.random.random", "matplotlib.pyplot.plot", "numpy.argmax", "numpy.sum", "matplotlib.pyplot.figure", "numpy.zeros", "numpy.dot", "numpy.argmin", "pandas.DataFrame", "matplotlib.pyplot.legend", "pandas_datareader.data.get_d...
[((363, 392), 'datetime.datetime', 'datetime.datetime', (['(2010)', '(1)', '(1)'], {}), '(2010, 1, 1)\n', (380, 392), False, 'import datetime\n'), ((402, 431), 'datetime.datetime', 'datetime.datetime', (['(2020)', '(1)', '(1)'], {}), '(2020, 1, 1)\n', (419, 431), False, 'import datetime\n'), ((619, 646), 'matplotlib.py...
""" Here, the code to get the heatmap of individual channels is present. It assumes that a pretrained model of type GazeStaticSineAndCosineModel is passed on. One has the option to choose the layer of which the heatmap is desired. """ from typing import List, Tuple import matplotlib.pyplot as plt import numpy as np im...
[ "numpy.ceil", "torch.nn.Sequential", "PIL.Image.blend", "eye_model.data_loader_static_sinecosine.remove_eyeless_imgs", "eye_model.data_loader_static_sinecosine.DictEyeImgLoader", "numpy.quantile", "pandas.DataFrame", "torch.no_grad", "matplotlib.pyplot.subplots", "numpy.arange" ]
[((2458, 2488), 'PIL.Image.blend', 'Image.blend', (['img', 'h_img', 'alpha'], {}), '(img, h_img, alpha)\n', (2469, 2488), False, 'from PIL import Image\n'), ((3300, 3363), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(20, 3 * nrows)', 'nrows': 'nrows', 'ncols': 'ncols'}), '(figsize=(20, 3 * nrows), n...
import torch import matplotlib.pyplot as plt from torch.nn import functional as F import numpy as np from seqwise_cont_skillspace.algo.algo_cont_skillspace import \ SeqwiseAlgoRevisedContSkills import self_supervised.utils.typed_dicts as td from self_supervised.base.replay_buffer.env_replay_buffer import \ No...
[ "torch.nn.functional.mse_loss", "matplotlib.pyplot.gcf", "matplotlib.pyplot.clf", "seqwise_cont_skillspace.utils.get_colors.get_colors", "matplotlib.pyplot.close", "rlkit.torch.pytorch_util.from_numpy", "rlkit.torch.pytorch_util.get_numpy", "numpy.stack", "matplotlib.pyplot.interactive", "torch.no...
[((539, 554), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (552, 554), False, 'import torch\n'), ((2175, 2190), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2188, 2190), False, 'import torch\n'), ((1950, 1996), 'torch.nn.functional.mse_loss', 'F.mse_loss', (['pred_skill_dist_seq', 'mode[:, 0, :]'], {}), ...
import os, pickle, re, subprocess, itertools import numpy as np, pandas as pd, matplotlib.pyplot as plt import matplotlib.colors as colors from mpl_toolkits.axes_grid1 import make_axes_locatable from matplotlib import cm from matplotlib.colors import ListedColormap, LinearSegmentedColormap from datetime import datetim...
[ "matplotlib.cm.get_cmap", "datetime.datetime.utcnow", "os.path.join", "matplotlib.colors.ListedColormap", "matplotlib.pyplot.close", "numpy.zeros", "numpy.linspace", "os.path.basename", "mpl_toolkits.axes_grid1.make_axes_locatable", "astropy.io.fits.open", "matplotlib.colors.SymLogNorm", "matp...
[((541, 561), 'astropy.io.fits.open', 'fits.open', (['fits_file'], {}), '(fits_file)\n', (550, 561), False, 'from astropy.io import fits\n'), ((1266, 1282), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (1275, 1282), True, 'import numpy as np, pandas as pd, matplotlib.pyplot as plt\n'), ((13...
#!/usr/bin/env python """ Show distribution after a change of variables with y = x^(1/2), where the pdf for x is Gaussian """ import matplotlib.pyplot as pl from scipy.stats import norm import numpy as np # normal distribution mu = 5. # the mean, mu sigma = 1 # standard deviations, sigma x = np.linspace(0, 10, 1000...
[ "matplotlib.pyplot.savefig", "numpy.sqrt", "matplotlib.pyplot.gca", "numpy.linspace", "matplotlib.pyplot.figure", "scipy.stats.norm.pdf", "matplotlib.pyplot.rc", "matplotlib.pyplot.show" ]
[((297, 321), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(1000)'], {}), '(0, 10, 1000)\n', (308, 321), True, 'import numpy as np\n'), ((367, 393), 'matplotlib.pyplot.rc', 'pl.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (372, 393), True, 'import matplotlib.pyplot as pl\n'), ((394, 423...
from scipy.stats.stats import pearsonr import matplotlib.pyplot as plt import numpy as np # compute correlation between features def compute_correlation(Xtrain): for i in range(0, Xtrain.shape[1]): for j in range(i+1, Xtrain.shape[1]): correlation = pearsonr(Xtrain[:, i], Xtrain[:, j])[0] ...
[ "matplotlib.pyplot.plot", "numpy.exp", "numpy.argsort", "scipy.stats.stats.pearsonr", "numpy.min", "matplotlib.pyplot.title", "matplotlib.pyplot.show" ]
[((550, 559), 'numpy.exp', 'np.exp', (['Y'], {}), '(Y)\n', (556, 559), True, 'import numpy as np\n'), ((572, 593), 'numpy.argsort', 'np.argsort', (['Y'], {'axis': '(0)'}), '(Y, axis=0)\n', (582, 593), True, 'import numpy as np\n'), ((598, 612), 'matplotlib.pyplot.title', 'plt.title', (['"""Y"""'], {}), "('Y')\n", (607,...
#贪心法 import pandas as pd import numpy as np import math import torch import time def getset(citynumber,samples): torch.manual_seed(66) data_set = [] for l in range(samples): #生成在坐标在0 1 之间的 x = torch.FloatTensor(2, citynumber*2).uniform_(0, 1) data_set.append(x) retur...
[ "torch.manual_seed", "time.clock", "math.sqrt", "numpy.array", "numpy.zeros", "torch.FloatTensor" ]
[((482, 500), 'numpy.zeros', 'np.zeros', (['(10, 10)'], {}), '((10, 10))\n', (490, 500), True, 'import numpy as np\n'), ((124, 145), 'torch.manual_seed', 'torch.manual_seed', (['(66)'], {}), '(66)\n', (141, 145), False, 'import torch\n'), ((785, 797), 'time.clock', 'time.clock', ([], {}), '()\n', (795, 797), False, 'im...
# -*- coding: utf-8 -*- """Generating the training data. This script generates the training data according to the config specifications. Example ------- To run this script, pass in the desired config file as argument:: $ generate baobab/configs/tdlmc_diagonal_config.py --n_data 1000 """ import os, sys import r...
[ "lenstronomy.LensModel.Solver.lens_equation_solver.LensEquationSolver", "numpy.save", "os.path.exists", "baobab.sim_utils.get_PSF_model", "argparse.ArgumentParser", "lenstronomy.LensModel.lens_model.LensModel", "numpy.random.seed", "pandas.DataFrame", "lenstronomy.SimulationAPI.data_api.DataAPI", ...
[((1177, 1202), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1200, 1202), False, 'import argparse\n'), ((1695, 1730), 'baobab.configs.BaobabConfig.from_file', 'BaobabConfig.from_file', (['args.config'], {}), '(args.config)\n', (1717, 1730), False, 'from baobab.configs import BaobabConfig\n')...
"""The entrance tank of an AguaClara water treatment plant #. removes large grit particles using plate settlers, #. contains the :ref:`design-lfom`, which maintains a linear relation between flow and water level, and #. introduces chemical dosing through the CDC <add link> using the water level set by the :ref:`design...
[ "numpy.ceil", "aguaclara.design.pipeline.Pipe", "aguaclara.core.physchem.viscosity_kinematic_water", "aguaclara.core.physchem.diam_pipe" ]
[((3005, 3011), 'aguaclara.design.pipeline.Pipe', 'Pipe', ([], {}), '()\n', (3009, 3011), False, 'from aguaclara.design.pipeline import Pipe\n'), ((3383, 3422), 'aguaclara.core.physchem.viscosity_kinematic_water', 'pc.viscosity_kinematic_water', (['self.temp'], {}), '(self.temp)\n', (3411, 3422), True, 'import aguaclar...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jul 1 21:33:40 2018 @author: ivan """ import os import numpy as np import scipy import matplotlib.pyplot as plt class time_series(): """ Create a time series object. """ def __init__(self, file_path): """ data is requ...
[ "matplotlib.pyplot.figure", "scipy.io.wavfile.read", "os.path.basename", "numpy.loadtxt", "matplotlib.pyplot.show" ]
[((1005, 1017), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1015, 1017), True, 'import matplotlib.pyplot as plt\n'), ((1082, 1092), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1090, 1092), True, 'import matplotlib.pyplot as plt\n'), ((456, 483), 'os.path.basename', 'os.path.basename', (['f...
''' This script is to get anchors and pos/neg weights ''' import os import h5py import json import math import numpy as np import h5py import random import time import threading from sklearn.cluster import KMeans sample_ratio = 1.0 c3d_resolution = 16 stride = 4 sample_num = 1 n_anchors = 128 tiou_...
[ "sklearn.cluster.KMeans", "threading.Thread.__init__", "math.ceil", "os.path.join", "h5py.File", "numpy.array", "random.randint", "json.dump" ]
[((445, 468), 'h5py.File', 'h5py.File', (['feature_path'], {}), '(feature_path)\n', (454, 468), False, 'import h5py\n'), ((6046, 6069), 'numpy.array', 'np.array', (['count_anchors'], {}), '(count_anchors)\n', (6054, 6069), True, 'import numpy as np\n'), ((6392, 6415), 'json.dump', 'json.dump', (['weights', 'fid'], {}),...
"""lake/utils.py""" import os import math import random import datetime import torch import numpy as np import matplotlib.pyplot as plt def get_summary_dir(): now = datetime.datetime.now() summary_dir = os.path.join('.', 'runs', now.strftime("%Y%m%d-%H%M%S")) return summary_dir def set_seed(seed): random....
[ "numpy.clip", "math.sqrt", "torch.sum", "matplotlib.pyplot.switch_backend", "numpy.reshape", "numpy.where", "numpy.random.seed", "numpy.argmin", "matplotlib.pyplot.savefig", "numpy.argmax", "numpy.square", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.show", "torch.manual_seed", ...
[((171, 194), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (192, 194), False, 'import datetime\n'), ((313, 330), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (324, 330), False, 'import random\n'), ((333, 353), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (347, 3...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2019 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions a...
[ "improver.spotdata.neighbour_finding.NeighbourSelection", "cartopy.crs.Mercator", "numpy.sqrt", "improver.utilities.cube_metadata.create_coordinate_hash", "numpy.array", "numpy.zeros", "numpy.stack", "numpy.linspace", "iris.coord_systems.GeogCS", "numpy.nonzero", "unittest.main", "numpy.full",...
[((11680, 11707), 'improver.utilities.warnings_handler.ManageWarnings', 'ManageWarnings', ([], {'record': '(True)'}), '(record=True)\n', (11694, 11707), False, 'from improver.utilities.warnings_handler import ManageWarnings\n'), ((13118, 13145), 'improver.utilities.warnings_handler.ManageWarnings', 'ManageWarnings', ([...
from rdkit import Chem from rdkit.Chem import AllChem import numpy as np def reset_ids(mol): for i, conf in enumerate(mol.GetConformers()): conf.SetId(i) class EnergyFilter: def __init__(self, energy_diff): self.energy_diff = energy_diff def filter(self, mol, energies, min_energy=None...
[ "numpy.argmin", "rdkit.Chem.RemoveHs", "numpy.min" ]
[((379, 395), 'numpy.min', 'np.min', (['energies'], {}), '(energies)\n', (385, 395), True, 'import numpy as np\n'), ((751, 769), 'rdkit.Chem.RemoveHs', 'Chem.RemoveHs', (['mol'], {}), '(mol)\n', (764, 769), False, 'from rdkit import Chem\n'), ((3011, 3038), 'numpy.argmin', 'np.argmin', (['similar_energies'], {}), '(sim...
import numpy as np from utils.bit_tools import parity, int_to_bin class eigenstate: """Class for constructing the n-th +1-eigenstate of A Attributes ---------- A : dict Dictionary containg two items A = \{P_1:r_1, P_2:r_2\}} n : int The eigenstate index num_qubits : int ...
[ "utils.bit_tools.int_to_bin", "numpy.array", "numpy.cos", "utils.bit_tools.parity", "numpy.sin", "numpy.arctan" ]
[((1932, 1967), 'utils.bit_tools.int_to_bin', 'int_to_bin', (['self.n', 'self.num_qubits'], {}), '(self.n, self.num_qubits)\n', (1942, 1967), False, 'from utils.bit_tools import parity, int_to_bin\n'), ((3114, 3149), 'utils.bit_tools.int_to_bin', 'int_to_bin', (['self.n', 'self.num_qubits'], {}), '(self.n, self.num_qub...
import numpy as np import torch import torch.nn.functional as F from tqdm import trange from torch import nn from ..metrics import Metric, MultipleMetrics from ..wdtypes import * use_cuda = torch.cuda.is_available() class WarmUp(object): r""" 'Warm up' methods to be applied to the individual models before t...
[ "torch.nn.functional.softmax", "numpy.sqrt", "torch.sigmoid", "torch.optim.lr_scheduler.CyclicLR", "torch.cuda.is_available", "tqdm.trange", "torch.optim.AdamW" ]
[((192, 217), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (215, 217), False, 'import torch\n'), ((3245, 3416), 'torch.optim.lr_scheduler.CyclicLR', 'torch.optim.lr_scheduler.CyclicLR', (['optimizer'], {'base_lr': '(max_lr / 10.0)', 'max_lr': 'max_lr', 'step_size_up': 'step_size_up', 'step_si...
import numpy as np import scipy.integrate import sys import Functional from scipy import signal class MFA1d(Functional.Functional): def __init__(self, fluid, system): super(MFA1d, self).__init__(fluid, system) # ============ init DCF ============ # self.DCF = np.zeros((self.maxNum*2+1,...
[ "matplotlib.pyplot.savefig", "matplotlib.pyplot.xlim", "numpy.sqrt", "matplotlib.pyplot.plot", "numpy.array", "matplotlib.pyplot.figure", "numpy.zeros", "numpy.linspace", "matplotlib.pyplot.scatter", "matplotlib.pyplot.ylim", "numpy.loadtxt" ]
[((3477, 3492), 'numpy.array', 'np.array', (['[1.0]'], {}), '([1.0])\n', (3485, 3492), True, 'import numpy as np\n'), ((3516, 3531), 'numpy.array', 'np.array', (['[1.0]'], {}), '([1.0])\n', (3524, 3531), True, 'import numpy as np\n'), ((3556, 3571), 'numpy.array', 'np.array', (['[1.0]'], {}), '([1.0])\n', (3564, 3571),...
import numpy as np import matplotlib.pyplot as plt import pandas as pd from scipy.constants import k,h,c from scipy.optimize import curve_fit from numba import njit,jit import emcee @njit def Planck(lamb,T): """ Black-body radiation; Bnu. Args: lam: (float) wavelength [m] T: (float) te...
[ "numpy.log10", "numpy.average", "numpy.asarray", "numpy.exp", "numpy.linspace" ]
[((2274, 2329), 'numpy.average', 'np.average', (['(mag_obs - mag_fit)'], {'weights': '(1 / mag_err ** 2)'}), '(mag_obs - mag_fit, weights=1 / mag_err ** 2)\n', (2284, 2329), True, 'import numpy as np\n'), ((4364, 4382), 'numpy.asarray', 'np.asarray', (['loglik'], {}), '(loglik)\n', (4374, 4382), True, 'import numpy as ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This script saves bid and ask data for specified ETFs to files for each day during market open hours. It assumes the computer is at US East Coast Time. @author: mark """ import os import pandas as pd import numpy as np from itertools import product import streaml...
[ "pandas.read_pickle", "bokeh.models.DatetimeTickFormatter", "numpy.log10", "pandas.read_csv", "streamlit_metrics.metric_row", "bokeh.models.VBar", "itertools.product", "streamlit.write", "bokeh.models.Rect", "pandas.to_datetime", "pandas.Timedelta", "bokeh.models.tools.HoverTool", "bokeh.mod...
[((17120, 17175), 'streamlit.write', 'st.write', (['"""# Bid-Ask spreads. Does time of day matter?"""'], {}), "('# Bid-Ask spreads. Does time of day matter?')\n", (17128, 17175), True, 'import streamlit as st\n'), ((17176, 17202), 'streamlit.write', 'st.write', (['"""#### By <NAME>"""'], {}), "('#### By <NAME>')\n", (1...
from scipy.io import loadmat import numpy as np import pyfftw from scipy.special import erf np.set_string_function(lambda a: str(a.shape), repr=False) def mat_to_npy(file_name): return loadmat(file_name + '.mat')[file_name] def mat_to_npy_vec(file_name): a = mat_to_npy(file_name) return a.reshape(a.sha...
[ "numpy.mean", "numpy.prod", "pyfftw.interfaces.numpy_fft.fftn", "scipy.io.loadmat", "numpy.floor", "numpy.square", "numpy.array", "numpy.zeros", "numpy.linspace", "pyfftw.interfaces.numpy_fft.ifftn", "scipy.special.erf", "numpy.expand_dims", "numpy.std", "numpy.shape", "numpy.transpose",...
[((502, 513), 'numpy.floor', 'np.floor', (['n'], {}), '(n)\n', (510, 513), True, 'import numpy as np\n'), ((1526, 1541), 'numpy.floor', 'np.floor', (['(n / 2)'], {}), '(n / 2)\n', (1534, 1541), True, 'import numpy as np\n'), ((1798, 1816), 'numpy.zeros', 'np.zeros', (['n_images'], {}), '(n_images)\n', (1806, 1816), Tru...
import pandas as pd import torch import numpy as np import torch.nn as nn import Pre_processing df = pd.read_csv(r'C:data/coords.csv') df.drop(df.tail(10).index,inplace=True) print(df.shape) df_model = Pre_processing.Pre_process(df) x = df_model.iloc[:,4:].to_numpy() X = np.reshape(x,(-1,50,66)).astype(np.float) ...
[ "numpy.reshape", "pandas.read_csv", "Pre_processing.Pre_process", "torch.nn.LSTM", "torch.load", "torch.nn.BatchNorm1d", "torch.cuda.is_available", "torch.nn.Linear", "torch.device" ]
[((103, 135), 'pandas.read_csv', 'pd.read_csv', (['"""C:data/coords.csv"""'], {}), "('C:data/coords.csv')\n", (114, 135), True, 'import pandas as pd\n'), ((206, 236), 'Pre_processing.Pre_process', 'Pre_processing.Pre_process', (['df'], {}), '(df)\n', (232, 236), False, 'import Pre_processing\n'), ((964, 989), 'torch.cu...
from sklearn.metrics import mean_squared_error import numpy as np def mse(A, B): return (np.square(A - B)).mean(axis=None) from scipy.stats import spearmanr def spearman_rank(A, B): result = 0.0 for i in range(len(A)): result += spearmanr(A[i], B[i], axis=None)[0] return result / len(A)
[ "scipy.stats.spearmanr", "numpy.square" ]
[((94, 110), 'numpy.square', 'np.square', (['(A - B)'], {}), '(A - B)\n', (103, 110), True, 'import numpy as np\n'), ((252, 284), 'scipy.stats.spearmanr', 'spearmanr', (['A[i]', 'B[i]'], {'axis': 'None'}), '(A[i], B[i], axis=None)\n', (261, 284), False, 'from scipy.stats import spearmanr\n')]
# -*- coding: utf-8 -*- """ Created on Tue Dec 5 06:36:36 2017 @author: Salem This script takes the resulting mesh and spring constants from the design process and tests it by applying forces and checking if the desired mode comes out. The energy used here does not assume linear displacements so we only expect agr...
[ "numpy.random.rand", "numpy.average", "numpy.sum", "numpy.dot", "LatticeMaking.get_complement_space", "importlib.reload", "numpy.linalg.eigh", "Many_Triangles.wave_changer", "LatticeMaking.get_rigid_transformations", "LatticeMaking.makeDynamicalMat" ]
[((593, 613), 'importlib.reload', 'importlib.reload', (['LM'], {}), '(LM)\n', (609, 613), False, 'import importlib\n'), ((614, 634), 'importlib.reload', 'importlib.reload', (['MT'], {}), '(MT)\n', (630, 634), False, 'import importlib\n'), ((2833, 2901), 'numpy.sum', 'np.sum', (['((vertices[edges[:, 1]] - vertices[edges...
import sys cmd_folder = "../../../vis" if cmd_folder not in sys.path: sys.path.insert(0, cmd_folder) from get_hdf5_data import ReadHDF5 import numpy as np from scipy import fftpack from scipy import signal import pylab as plt from matplotlib.image import NonUniformImage from multiprocessing import Pool #==...
[ "get_hdf5_data.ReadHDF5.get_files", "sys.path.insert", "numpy.sqrt", "scipy.signal.welch", "get_hdf5_data.ReadHDF5", "numpy.argmax", "pylab.close", "pylab.figure", "numpy.sum", "numpy.zeros", "pylab.colorbar", "numpy.ravel" ]
[((617, 736), 'get_hdf5_data.ReadHDF5.get_files', 'ReadHDF5.get_files', (['"""."""'], {'include': '[plt_file]', 'exclude': "['temp', '.png', 'inputs']", 'times': '[]', 'tol': '(0.0001)', 'get_all': '(True)'}), "('.', include=[plt_file], exclude=['temp', '.png',\n 'inputs'], times=[], tol=0.0001, get_all=True)\n", (6...
import datetime import os from datetime import timedelta import numpy from esdl.cube_provider import NetCDFCubeSourceProvider all_vars_descr = {'E': { 'evaporation': { 'source_name': 'E', 'data_type': numpy.float32, 'fill_value': numpy.nan, 'units': 'mm/day', 'long_name': ...
[ "datetime.datetime", "os.listdir", "os.path.join", "numpy.rot90", "datetime.timedelta", "os.walk" ]
[((8232, 8254), 'os.walk', 'os.walk', (['self.dir_path'], {}), '(self.dir_path)\n', (8239, 8254), False, 'import os\n'), ((9837, 9865), 'numpy.rot90', 'numpy.rot90', (['source_image', '(3)'], {}), '(source_image, 3)\n', (9848, 9865), False, 'import numpy\n'), ((8473, 8509), 'os.path.join', 'os.path.join', (['self.dir_p...
#!/usr/bin/env python ########################################################################## # Copyright 2018 Kata.ai # # 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.ap...
[ "numpy.mean", "argparse.ArgumentParser", "math.floor", "json.dumps", "numpy.std", "numpy.percentile" ]
[((1019, 1048), 'numpy.percentile', 'np.percentile', (['data', '(25, 75)'], {}), '(data, (25, 75))\n', (1032, 1048), True, 'import numpy as np\n'), ((2244, 2391), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Preprocess outliers in a given JSONL file."""', 'formatter_class': 'argparse.A...
import h5py import random import numpy as np import pdb import torch class DataLoaderSimple(object): """ DataLoader class for abstracting the reading, batching and shuffling operations Does not use expert rewards. """ def __init__(self, opts): """ Loads the dataset and saves settin...
[ "numpy.array", "torch.load", "random.shuffle", "h5py.File" ]
[((605, 633), 'h5py.File', 'h5py.File', (['opts.h5_path', '"""r"""'], {}), "(opts.h5_path, 'r')\n", (614, 633), False, 'import h5py\n'), ((686, 717), 'numpy.array', 'np.array', (["self.h5_file['train']"], {}), "(self.h5_file['train'])\n", (694, 717), True, 'import numpy as np\n'), ((745, 774), 'numpy.array', 'np.array'...
import numpy as np import cv2 import os import random from skimage.transform import resize from skimage.color import rgb2gray import pickle import tensorflow as tf from keras.utils import np_utils from PIL import Image import threading from concurrent.futures import ThreadPoolExecutor #from flask import session # imag...
[ "numpy.iinfo", "numpy.array", "numpy.linalg.norm", "tensorflow.gfile.Exists", "threading.Lock", "numpy.asarray", "numpy.max", "numpy.concatenate", "numpy.min", "random.randint", "numpy.arctan", "numpy.random.normal", "skimage.color.rgb2gray", "cv2.warpAffine", "random.shuffle", "numpy....
[((3485, 3520), 'tensorflow.gfile.Exists', 'tf.gfile.Exists', (['self.datalist_file'], {}), '(self.datalist_file)\n', (3500, 3520), True, 'import tensorflow as tf\n'), ((4351, 4367), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (4365, 4367), False, 'import threading\n'), ((6302, 6313), 'os.getcwd', 'os.getcwd'...
import sys import numpy as np import torch import torch.nn as nn import torch.optim as optim import random from Model import model from utils import init_model import torch.backends.cudnn as cudnn cudnn.benchmark = True def project_tsne(params, dataset, pairs_x, pairs_y, dist, P_joint, device): print("-------------...
[ "torch.log", "utils.init_model", "torch.pow", "torch.transpose", "numpy.max", "torch.nn.MSELoss", "numpy.array", "numpy.random.randint", "torch.sum", "numpy.matmul", "torch.from_numpy", "Model.model", "torch.zeros" ]
[((394, 430), 'Model.model', 'model', (['params.col', 'params.output_dim'], {}), '(params.col, params.output_dim)\n', (399, 430), False, 'from Model import model\n'), ((446, 483), 'utils.init_model', 'init_model', (['net', 'device'], {'restore': 'None'}), '(net, device, restore=None)\n', (456, 483), False, 'from utils ...
import cv2 import numpy as np import ImageLoader as il from pprint import pprint FACE_CASCADE = cv2.CascadeClassifier('haar_cascade.xml') SIDE_CASCADE = cv2.CascadeClassifier('lbpcascade_sideface.xml') def detect_faces(img): """ Method for detecting all faces in a given image. """ gray = cv2.cvtColor(...
[ "numpy.concatenate", "cv2.CascadeClassifier", "cv2.rectangle", "cv2.cvtColor" ]
[((97, 138), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haar_cascade.xml"""'], {}), "('haar_cascade.xml')\n", (118, 138), False, 'import cv2\n'), ((154, 202), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""lbpcascade_sideface.xml"""'], {}), "('lbpcascade_sideface.xml')\n", (175, 202), False, 'impo...
from __future__ import division import pywt import numpy as np import itertools as itt from scipy.interpolate import interp1d from functools import partial from .common import * class SimpleWaveletDensityEstimator(object): def __init__(self, wave_name, j0=1, j1=None, thresholding=None): self.wave = pywt.Wa...
[ "numpy.amin", "pywt.Wavelet", "numpy.zeros", "functools.partial", "numpy.amax" ]
[((313, 336), 'pywt.Wavelet', 'pywt.Wavelet', (['wave_name'], {}), '(wave_name)\n', (325, 336), False, 'import pywt\n'), ((889, 908), 'numpy.amin', 'np.amin', (['xs'], {'axis': '(0)'}), '(xs, axis=0)\n', (896, 908), True, 'import numpy as np\n'), ((929, 948), 'numpy.amax', 'np.amax', (['xs'], {'axis': '(0)'}), '(xs, ax...
#Coded by <NAME> #02/09/2018 latest version. #Copyright (c) <2018> <<NAME>> #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal #in the Software without restriction, including without limitation the rights #to use...
[ "tensorflow.shape", "tensorflow.transpose", "tensorflow.contrib.distributions.Normal", "tensorflow.reduce_mean", "tensorflow.log", "numpy.arange", "numpy.mean", "tensorflow.random_normal", "seaborn.distplot", "tensorflow.placeholder", "matplotlib.pyplot.plot", "tensorflow.square", "tensorflo...
[((1405, 1451), 'tensorflow.contrib.distributions.Exponential', 'tf.contrib.distributions.Exponential', ([], {'rate': '(1.0)'}), '(rate=1.0)\n', (1441, 1451), True, 'import tensorflow as tf\n'), ((1460, 1512), 'tensorflow.contrib.distributions.Normal', 'tf.contrib.distributions.Normal', ([], {'loc': '(-2.0)', 'scale': ...
import sys import argparse import os.path import math as m import cv2 import numpy as np import yaml import traceback try: import quaternion except: print('Install numpy-quaternion %s (%s) (which also requires scipy and optionally numba)' % ("pip3 install numpy-quaternion", "https://github.com/moble/qua...
[ "cv2.initUndistortRectifyMap", "math.acos", "math.sqrt", "cv2.remap", "yaml.load", "numpy.array", "cv2.destroyAllWindows", "sys.exit", "argparse.ArgumentParser", "numpy.dot", "pandas.DataFrame", "cv2.waitKey", "numpy.identity", "numpy.eye", "numpy.size", "cv2.getOptimalNewCameraMatrix"...
[((1036, 1128), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Project 3d points from ply file back onto image."""'}), "(description=\n 'Project 3d points from ply file back onto image.')\n", (1059, 1128), False, 'import argparse\n'), ((2250, 2317), 'numpy.array', 'np.array', (["[[y['...
import flask from flask import json , request import numpy as np import base64 from io import BytesIO import re from PIL import Image from flask import jsonify from flask_cors import CORS from numpy.lib.type_check import imag import cv2 from tensorflow.keras.models import load_model rev_class_map = {0: 'apple', 1: '...
[ "re.search", "flask_cors.CORS", "flask.Flask", "cv2.threshold", "cv2.boundingRect", "numpy.argmax", "numpy.array", "tensorflow.keras.models.load_model", "cv2.cvtColor", "cv2.findContours", "cv2.resize", "flask.jsonify" ]
[((1050, 1092), 'tensorflow.keras.models.load_model', 'load_model', (['"""server//v5.h5"""'], {'compile': '(False)'}), "('server//v5.h5', compile=False)\n", (1060, 1092), False, 'from tensorflow.keras.models import load_model\n'), ((1102, 1123), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (1113, 1...
from __future__ import print_function, division, absolute_import import unittest import numpy as np from numpy.testing import assert_almost_equal from openmdao.api import Problem, Group, IndepVarComp from openmdao.utils.assert_utils import assert_check_partials from dymos.transcriptions.pseudospectral.components imp...
[ "dymos.transcriptions.grid_data.GridData", "dymos.transcriptions.pseudospectral.components.StateInterpComp", "openmdao.utils.assert_utils.assert_check_partials", "openmdao.api.IndepVarComp", "openmdao.api.Group", "numpy.array", "dymos.utils.lgr.lgr", "numpy.testing.assert_almost_equal", "numpy.linsp...
[((15473, 15488), 'unittest.main', 'unittest.main', ([], {}), '()\n', (15486, 15488), False, 'import unittest\n'), ((844, 870), 'numpy.array', 'np.array', (['[0.0, 3.0, 10.0]'], {}), '([0.0, 3.0, 10.0])\n', (852, 870), True, 'import numpy as np\n'), ((885, 989), 'dymos.transcriptions.grid_data.GridData', 'GridData', ([...
import sys import math import numpy as np from datetime import datetime import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence def ortho_weight(ndim): """ Random orthogonal weights Used...
[ "torch.nn.ReLU", "torch.nn.Dropout", "torch.LongTensor", "torch.max", "torch.from_numpy", "numpy.array", "torch.cuda.is_available", "torch.nn.functional.softmax", "torch.mean", "torch.nn.functional.cosine_similarity", "torch.unsqueeze", "torch.nn.functional.tanh", "torch.nn.functional.log_so...
[((506, 533), 'numpy.random.randn', 'np.random.randn', (['ndim', 'ndim'], {}), '(ndim, ndim)\n', (521, 533), True, 'import numpy as np\n'), ((548, 564), 'numpy.linalg.svd', 'np.linalg.svd', (['W'], {}), '(W)\n', (561, 564), True, 'import numpy as np\n'), ((2682, 2707), 'torch.cuda.is_available', 'torch.cuda.is_availabl...
from abc import ABC, abstractmethod import numpy as np class StochasticProcess(ABC): """ ABC for stochastic process generators """ def __init__(self, t_init, x_init, random_state): self.rs = np.random.RandomState(random_state) self.x = np.copy(x_init) self.t = t_init def sample...
[ "numpy.copy", "numpy.sqrt", "numpy.ones", "numpy.array", "numpy.zeros", "numpy.random.RandomState" ]
[((208, 243), 'numpy.random.RandomState', 'np.random.RandomState', (['random_state'], {}), '(random_state)\n', (229, 243), True, 'import numpy as np\n'), ((261, 276), 'numpy.copy', 'np.copy', (['x_init'], {}), '(x_init)\n', (268, 276), True, 'import numpy as np\n'), ((963, 975), 'numpy.array', 'np.array', (['mu'], {}),...
# <NAME> 2014-2020 # mlxtend Machine Learning Library Extensions # Author: <NAME> <<EMAIL>> # # License: BSD 3 clause import numpy as np from mlxtend.plotting import plot_learning_curves from sklearn import datasets from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split ...
[ "sklearn.datasets.load_iris", "mlxtend.plotting.plot_learning_curves", "sklearn.model_selection.train_test_split", "sklearn.tree.DecisionTreeClassifier", "numpy.testing.assert_almost_equal", "numpy.array" ]
[((358, 378), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (376, 378), False, 'from sklearn import datasets\n'), ((457, 510), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.4)', 'random_state': '(2)'}), '(X, y, test_size=0.4, random_state=2)\n', (...
import matplotlib.pyplot as plt from sklearn.manifold import MDS import numpy as np def accuracy(acc): max_acc = [max(acc[:i+1]) for i in range(len(acc))] plt.figure(figsize=(16, 4), dpi=100) plt.plot(acc, color="grey", linewidth=2.5, label="Accuracy") plt.plot(max_acc, color="g", linewidth=2.5, labe...
[ "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.colorbar", "numpy.sum", "matplotlib.pyplot.figure", "matplotlib.pyplot.cm.get_cmap", "matplotlib.pyplot.title", "sklearn.manifold.MDS", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((165, 201), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(16, 4)', 'dpi': '(100)'}), '(figsize=(16, 4), dpi=100)\n', (175, 201), True, 'import matplotlib.pyplot as plt\n'), ((207, 267), 'matplotlib.pyplot.plot', 'plt.plot', (['acc'], {'color': '"""grey"""', 'linewidth': '(2.5)', 'label': '"""Accuracy""...
# -*- mode: python; coding: utf-8 -*- # Copyright (c) 2018 Radio Astronomy Software Group # Licensed under the 2-clause BSD License """Tests for calfits object """ import pytest import os import numpy as np from astropy.io import fits from pyuvdata import UVCal import pyuvdata.tests as uvtest from pyuvdata.data impo...
[ "numpy.mean", "pyuvdata.UVCal", "numpy.int64", "pytest.mark.filterwarnings", "astropy.io.fits.PrimaryHDU", "astropy.io.fits.HDUList", "numpy.arange", "astropy.io.fits.ImageHDU", "os.path.join", "numpy.diff", "pytest.mark.parametrize", "numpy.array", "pyuvdata.utils._fits_indexhdus", "pytes...
[((380, 534), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:telescope_location is not set. Using known values"""', '"""ignore:antenna_positions is not set. Using known values"""'], {}), "(\n 'ignore:telescope_location is not set. Using known values',\n 'ignore:antenna_positions is not s...