code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
### EXPERIMENT FLAGS ITERATION
flags = {'SC4', 'EPI1', '!AV'}
### EXPERIMENT EXECUTION STUB
import sys
sys.path.append('../../../../PatchSim/')
sys.path.append('../../../../school_closures/')
import patchsim as sim
import pandas as pd
import numpy as np
import multiprocessing
import sc_variants as sc
from copy imp... | [
"sys.path.append",
"copy.deepcopy",
"numpy.random.seed",
"patchsim.load_params",
"patchsim.run_disease_simulation",
"numpy.where",
"patchsim.load_Theta",
"sc_variants.NetInterventionAdaptive",
"multiprocessing.Pool",
"numpy.random.normal",
"patchsim.read_config",
"sc_variants.NetIntervention",... | [((106, 146), 'sys.path.append', 'sys.path.append', (['"""../../../../PatchSim/"""'], {}), "('../../../../PatchSim/')\n", (121, 146), False, 'import sys\n'), ((147, 194), 'sys.path.append', 'sys.path.append', (['"""../../../../school_closures/"""'], {}), "('../../../../school_closures/')\n", (162, 194), False, 'import ... |
"""
numpy.ma : a package to handle missing or invalid values.
This package was initially written for numarray by <NAME>
at Lawrence Livermore National Laboratory.
In 2006, the package was completely rewritten by <NAME>
(University of Georgia) to make the MaskedArray class a subclass of ndarray,
and to improve s... | [
"numpy.core.umath.power",
"numpy.core.umath.less",
"numpy.split",
"numpy.void",
"numpy.resize",
"numpy.empty",
"numpy.ones",
"builtins.all",
"numpy.AxisError",
"numpy.shape",
"numpy.isclose",
"numpy.core.umath.less_equal",
"numpy.inner",
"numpy.diag",
"numpy.core.arrayprint.dtype_is_impl... | [((6685, 6708), 'numpy.datetime64', 'np.datetime64', (['"""NaT"""', 'v'], {}), "('NaT', v)\n", (6698, 6708), True, 'import numpy as np\n'), ((6748, 6772), 'numpy.timedelta64', 'np.timedelta64', (['"""NaT"""', 'v'], {}), "('NaT', v)\n", (6762, 6772), True, 'import numpy as np\n'), ((13864, 13880), 'numpy.dtype', 'np.dty... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Various retriever utilities.
"""
import regex
import unicodedata
import numpy as np
import scipy.sparse as sp
from ... | [
"unicodedata.normalize",
"numpy.load",
"torch.load",
"torch.save",
"scipy.sparse.csr_matrix",
"regex.match",
"numpy.savez",
"torch.sparse.FloatTensor",
"sklearn.utils.murmurhash3_32"
] | [((908, 934), 'numpy.savez', 'np.savez', (['filename'], {}), '(filename, **data)\n', (916, 934), True, 'import numpy as np\n'), ((1152, 1178), 'torch.save', 'torch.save', (['data', 'filename'], {}), '(data, filename)\n', (1162, 1178), False, 'import torch\n'), ((1225, 1270), 'numpy.load', 'np.load', (["(filename + '.np... |
# Copyright 2020 <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... | [
"pyrfu.pyrf.optimize_nbins_2d",
"numpy.corrcoef",
"pyrfu.pyrf.gradient",
"scipy.optimize.curve_fit",
"xarray.Dataset",
"numpy.max",
"pyrfu.pyrf.histogram2d",
"numpy.linspace"
] | [((1150, 1171), 'pyrfu.pyrf.gradient', 'gradient', (['b_xyz[:, 0]'], {}), '(b_xyz[:, 0])\n', (1158, 1171), False, 'from pyrfu.pyrf import gradient, histogram2d, optimize_nbins_2d\n'), ((1186, 1224), 'pyrfu.pyrf.optimize_nbins_2d', 'optimize_nbins_2d', (['dbl_dt', 'j_xyz[:, 2]'], {}), '(dbl_dt, j_xyz[:, 2])\n', (1203, 1... |
#!/usr/bin/env python
######################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, Rice University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that t... | [
"matplotlib.backends.backend_pdf.PdfPages",
"os.remove",
"numpy.sum",
"optparse.OptionParser",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.boxplot",
"matplotlib.pyplot.bar",
"numpy.mean",
"matplotlib.pyplot.gca",
"matplotlib.font_manager.FontProperties",
"numpy.std",
"os.path.exists",
"matpl... | [((1977, 1998), 'matplotlib.use', 'matplotlib.use', (['"""pdf"""'], {}), "('pdf')\n", (1991, 1998), False, 'import matplotlib\n'), ((4389, 4412), 'sqlite3.connect', 'sqlite3.connect', (['dbname'], {}), '(dbname)\n', (4404, 4412), False, 'import sqlite3\n'), ((15219, 15228), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}),... |
import os
import numpy as np
from wavedata.tools.core import calib_utils
class ObjectLabel:
"""Object Label Class
1 type Describes the type of object: 'Car', 'Van', 'Truck',
'Pedestrian', 'Person_sitting', 'Cyclist', 'Tram',
'Misc' or 'DontCare'
1 ... | [
"wavedata.tools.core.calib_utils.project_to_image",
"wavedata.tools.core.calib_utils.read_calibration",
"numpy.logical_and",
"os.stat",
"numpy.asarray",
"numpy.zeros",
"numpy.ones",
"numpy.sin",
"wavedata.tools.core.calib_utils.lidar_to_cam_frame",
"numpy.arange",
"wavedata.tools.core.calib_util... | [((3056, 3076), 'numpy.arange', 'np.arange', (['label_num'], {}), '(label_num)\n', (3065, 3076), True, 'import numpy as np\n'), ((6754, 6777), 'numpy.zeros', 'np.zeros', (['(num_objs, 4)'], {}), '((num_objs, 4))\n', (6762, 6777), True, 'import numpy as np\n'), ((6793, 6816), 'numpy.zeros', 'np.zeros', (['(num_objs, 7)'... |
from options import opt
import os
from pathlib import Path
import json
import numpy as np
from dataset import NoteDataset, get_loader
import torch
from model import Rnn, BiRNN, NeuralNet, NeuralNetWithRNN
import torch.nn as nn
import copy
from tqdm import tqdm
from torch.optim.lr_scheduler import ReduceLROnPlateau
from... | [
"tqdm.tqdm",
"torch.narrow",
"dataset.NoteDataset",
"torch.nn.BCEWithLogitsLoss",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"torch.FloatTensor",
"model.NeuralNetWithRNN",
"pathlib.Path",
"dataset.get_loader",
"numpy.array",
"numpy.loadtxt",
"torch.nn.SmoothL1Loss",
"visual.visualization"... | [((1566, 1594), 'dataset.NoteDataset', 'NoteDataset', (['data_seq', 'label'], {}), '(data_seq, label)\n', (1577, 1594), False, 'from dataset import NoteDataset, get_loader\n'), ((1628, 1648), 'dataset.get_loader', 'get_loader', (['data_set'], {}), '(data_set)\n', (1638, 1648), False, 'from dataset import NoteDataset, g... |
from typing import Any, List, Dict, Union, Optional
import time
import gym
import gym_hybrid
import copy
import numpy as np
from easydict import EasyDict
from ding.envs import BaseEnv, BaseEnvTimestep, BaseEnvInfo
from ding.envs.common import EnvElementInfo, affine_transform
from ding.torch_utils import to_ndarray, to_... | [
"numpy.random.seed",
"gym.make",
"ding.torch_utils.to_ndarray",
"gym.wrappers.Monitor",
"ding.envs.BaseEnvTimestep",
"numpy.random.randint",
"numpy.array",
"ding.utils.ENV_REGISTRY.register",
"numpy.concatenate",
"ding.envs.common.affine_transform"
] | [((364, 399), 'ding.utils.ENV_REGISTRY.register', 'ENV_REGISTRY.register', (['"""gym_hybrid"""'], {}), "('gym_hybrid')\n", (385, 399), False, 'from ding.utils import ENV_REGISTRY\n'), ((1853, 1879), 'numpy.random.seed', 'np.random.seed', (['self._seed'], {}), '(self._seed)\n', (1867, 1879), True, 'import numpy as np\n'... |
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
import cv2 as cv
import numpy as np
def sharpen(image):
kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]], np.float32) #銳化
dst = cv.filter2D(image, -1, kernel=kernel)
cv.imwrite("output00000000_sharpen.png",dst)
for i in range(1):
for j in range(1):
... | [
"cv2.imwrite",
"numpy.array",
"cv2.imread",
"cv2.filter2D"
] | [((114, 173), 'numpy.array', 'np.array', (['[[0, -1, 0], [-1, 5, -1], [0, -1, 0]]', 'np.float32'], {}), '([[0, -1, 0], [-1, 5, -1], [0, -1, 0]], np.float32)\n', (122, 173), True, 'import numpy as np\n'), ((188, 225), 'cv2.filter2D', 'cv.filter2D', (['image', '(-1)'], {'kernel': 'kernel'}), '(image, -1, kernel=kernel)\n... |
"""Update a SQLite database in real time. Requires Grafana and Python >3.6.
```
python -m pip install numpy tqdm
python create_grafana_sample_db.py
```
See discussion context: https://github.com/fr-ser/grafana-sqlite-datasource/issues/21
"""
import sqlite3
import time
from contextlib import ContextDecorator
from pa... | [
"time.time",
"time.sleep",
"pathlib.Path",
"sqlite3.connect",
"numpy.random.normal"
] | [((926, 955), 'sqlite3.connect', 'sqlite3.connect', (['self.path_db'], {}), '(self.path_db)\n', (941, 955), False, 'import sqlite3\n'), ((1949, 1984), 'numpy.random.normal', 'np.random.normal', (['mu', 'sigma', 'points'], {}), '(mu, sigma, points)\n', (1965, 1984), True, 'import numpy as np\n'), ((2296, 2309), 'time.sl... |
from __future__ import annotations
from typing import TYPE_CHECKING, Union
from warnings import filterwarnings
import pyopencl as cl
import pyopencl.array as cla
import numpy as np
from gpyfft.fft import FFT
from ._util import get_context
filterwarnings("ignore", module="pyopencl")
if TYPE_CHECKING:
from rei... | [
"pyopencl.array.empty_like",
"gpyfft.fft.FFT",
"numpy.iscomplexobj",
"warnings.filterwarnings",
"numpy.isscalar",
"pyopencl.CommandQueue",
"pyopencl.array.to_device"
] | [((244, 287), 'warnings.filterwarnings', 'filterwarnings', (['"""ignore"""'], {'module': '"""pyopencl"""'}), "('ignore', module='pyopencl')\n", (258, 287), False, 'from warnings import filterwarnings\n'), ((485, 509), 'pyopencl.CommandQueue', 'cl.CommandQueue', (['context'], {}), '(context)\n', (500, 509), True, 'impor... |
import cv2
import numpy as np
import scipy.fftpack
import scipy.signal
from matplotlib import pyplot
# from eulerian_magnification.io import play_vid_data
from eulerian_magnification.pyramid import create_laplacian_video_pyramid, collapse_laplacian_video_pyramid
from eulerian_magnification.transforms import temporal_b... | [
"matplotlib.pyplot.title",
"cv2.VideoWriter_fourcc",
"eulerian_magnification.pyramid.create_laplacian_video_pyramid",
"numpy.argsort",
"matplotlib.pyplot.figure",
"cv2.VideoWriter",
"cv2.pyrDown",
"numpy.ndarray",
"cv2.convertScaleAbs",
"matplotlib.pyplot.show",
"eulerian_magnification.transform... | [((473, 544), 'eulerian_magnification.pyramid.create_laplacian_video_pyramid', 'create_laplacian_video_pyramid', (['vid_data'], {'pyramid_levels': 'pyramid_levels'}), '(vid_data, pyramid_levels=pyramid_levels)\n', (503, 544), False, 'from eulerian_magnification.pyramid import create_laplacian_video_pyramid, collapse_la... |
"""Tests for module gromov """
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: MIT License
import numpy as np
import ot
def test_gromov():
n_samples = 50 # nb samples
mu_s = np.array([0, 0])
cov_s = np.array([[1, 0], [0, 1]])
xs = o... | [
"ot.unif",
"numpy.random.seed",
"numpy.eye",
"ot.datasets.make_data_classif",
"numpy.random.randn",
"ot.dist",
"ot.gromov.entropic_gromov_wasserstein",
"numpy.testing.assert_allclose",
"ot.gromov.fused_gromov_wasserstein",
"ot.gromov.fused_gromov_wasserstein2",
"numpy.flipud",
"ot.gromov.entro... | [((250, 266), 'numpy.array', 'np.array', (['[0, 0]'], {}), '([0, 0])\n', (258, 266), True, 'import numpy as np\n'), ((280, 306), 'numpy.array', 'np.array', (['[[1, 0], [0, 1]]'], {}), '([[1, 0], [0, 1]])\n', (288, 306), True, 'import numpy as np\n'), ((319, 392), 'ot.datasets.make_2D_samples_gauss', 'ot.datasets.make_2... |
import docker
import os
import glob
import json
import datetime
import numpy
client = docker.APIClient(base_url='unix://var/run/docker.sock')
def mem_stats(container_id):
docker_stats = client.stats(container_id, decode=True, stream=False)
mem_stats = docker_stats['memory_stats']
wanted_keys = ['usage', ... | [
"json.dump",
"os.path.abspath",
"docker.APIClient",
"datetime.datetime.now",
"numpy.mean",
"glob.glob",
"os.path.join",
"os.chdir"
] | [((87, 142), 'docker.APIClient', 'docker.APIClient', ([], {'base_url': '"""unix://var/run/docker.sock"""'}), "(base_url='unix://var/run/docker.sock')\n", (103, 142), False, 'import docker\n'), ((4274, 4296), 'os.chdir', 'os.chdir', (['sockshop_dir'], {}), '(sockshop_dir)\n', (4282, 4296), False, 'import os\n'), ((4316,... |
from telewavesim import utils as ut
from telewavesim.rmat_f import plane as pw_f
from telewavesim import conf as cf
import numpy as np
import pyfftw
from conftest import load_params
def test_plane_obs(load_params):
yx, yy, yz = pw_f.plane_obs(cf.nt, cf.nlay, np.array(cf.wvtype, dtype='c'))
ux = np.real(pyfft... | [
"numpy.abs",
"telewavesim.utils.get_trxyz",
"pyfftw.interfaces.numpy_fft.fft",
"telewavesim.utils.tf_from_xyz",
"numpy.array"
] | [((1404, 1428), 'telewavesim.utils.get_trxyz', 'ut.get_trxyz', (['ux', 'uy', 'uz'], {}), '(ux, uy, uz)\n', (1416, 1428), True, 'from telewavesim import utils as ut\n'), ((1439, 1460), 'telewavesim.utils.tf_from_xyz', 'ut.tf_from_xyz', (['trxyz'], {}), '(trxyz)\n', (1453, 1460), True, 'from telewavesim import utils as u... |
import base64
import os
import re
import random
import threading
import cv2
import numpy as np
from flask import *
from auth.Auth import Auth
from dao.FollowDAO import FollowDAO
from dao.FollowerDAO import FollowerDAO
from dao.FollowingDAO import FollowingDAO
from dao.ImageDAO import WorkDAO
from dao.InformationDAO ... | [
"cv2.imdecode",
"pojo.User.User",
"pojo.Image.Work",
"auth.Auth.Auth.identify",
"random.randint",
"dao.addressDAO.AddressDAO",
"cv2.cvtColor",
"cv2.imwrite",
"os.path.exists",
"base64.urlsafe_b64decode",
"pojo.Information.Information",
"re.sub",
"numpy.fromstring",
"dao.FollowerDAO.Followe... | [((1059, 1065), 'pojo.User.User', 'User', ([], {}), '()\n', (1063, 1065), False, 'from pojo.User import User\n'), ((1342, 1362), 'auth.Auth.Auth.authorize', 'Auth.authorize', (['user'], {}), '(user)\n', (1356, 1362), False, 'from auth.Auth import Auth\n'), ((2141, 2147), 'pojo.User.User', 'User', ([], {}), '()\n', (214... |
# ------------------------------------------------------------------------
# Copyright (c) 2021 4669 (for eccv submission only). All Rights Reserved.
# ------------------------------------------------------------------------
# Modified from Deformable DETR (https://github.com/fundamentalvision/Deformable-DETR)
# Copyri... | [
"numpy.random.seed",
"torchvision.transforms.functional.to_tensor",
"numpy.empty",
"pathlib.Path",
"cv2.rectangle",
"torch.device",
"os.path.join",
"random.randint",
"cv2.cvtColor",
"cv2.imwrite",
"torch.load",
"os.path.exists",
"numpy.loadtxt",
"util.tool.load_model",
"models.build_mode... | [((1980, 2000), 'numpy.random.seed', 'np.random.seed', (['(2020)'], {}), '(2020)\n', (1994, 2000), True, 'import numpy as np\n'), ((3804, 3851), 'cv2.rectangle', 'cv2.rectangle', (['img', 'c1', 'c2', 'color'], {'thickness': 'tl'}), '(img, c1, c2, color, thickness=tl)\n', (3817, 3851), False, 'import cv2\n'), ((10835, 1... |
import os, sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.optimize
from pyddem.volint_tools import neff_circ, std_err
import functools
import matplotlib.ticker as mtick
from mpl_toolkits.axes_grid.inset_locator import inset_axes
plt.rcParams.update({'font.size': 5})
plt.rcPara... | [
"numpy.abs",
"numpy.nanmedian",
"pandas.read_csv",
"numpy.isnan",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"numpy.sin",
"pyddem.volint_tools.neff_circ",
"numpy.sqrt",
"numpy.round",
"numpy.nanmean",
"pandas.DataFrame",
"matplotlib.pyplot.rcParams.update",
"matplotlib.tic... | [((272, 309), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 5}"], {}), "({'font.size': 5})\n", (291, 309), True, 'import matplotlib.pyplot as plt\n'), ((310, 356), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'lines.linewidth': 0.35}"], {}), "({'lines.linewidth': 0.35})... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
plt.figure(figsize=(6.6, 3), dpi=90)
x = np.linspace(-2*np.pi, 2*np.pi, 1e3)
plt.plot(x, np.sin(x), label="$\sin(x)$")
plt.plot(x, np.cos(x), label="$\sin(x)$")
plt.xlim((np.min(x), np.max(x)))
plt.ylim((-1.1, 1.1))
plt.x... | [
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.min",
"numpy.max",
"numpy.linspace",
"numpy.random.normal",
"numpy.cos",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((96, 132), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6.6, 3)', 'dpi': '(90)'}), '(figsize=(6.6, 3), dpi=90)\n', (106, 132), True, 'import matplotlib.pyplot as plt\n'), ((137, 179), 'numpy.linspace', 'np.linspace', (['(-2 * np.pi)', '(2 * np.pi)', '(1000.0)'], {}), '(-2 * np.pi, 2 * np.pi, 1000.0)\n... |
"""
This module provides utility methods.
"""
import datetime
import os
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from plotnine import *
from statsmodels.tsa.statespace.kalman_smoother import SmootherResults
from statsmodels.tsa.statespace.mlemodel import MLEResults, MLEResultsWrapper... | [
"numpy.abs",
"numpy.argmax",
"matplotlib.pyplot.suptitle",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.mean",
"os.path.join",
"pandas.DataFrame",
"numpy.multiply",
"numpy.transpose",
"datetime.timedelta",
"matplotlib.pyplot.show",
"numpy.median",
"datetime.datetime",
"datetime.dat... | [((7666, 7680), 'numpy.mean', 'np.mean', (['mases'], {}), '(mases)\n', (7673, 7680), True, 'import numpy as np\n'), ((7696, 7712), 'numpy.median', 'np.median', (['mases'], {}), '(mases)\n', (7705, 7712), True, 'import numpy as np\n'), ((7730, 7745), 'numpy.mean', 'np.mean', (['mdases'], {}), '(mdases)\n', (7737, 7745),... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 5 22:43:38 2019
@author: anhtu
"""
from __future__ import division
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import cv2
from util import *
class EmptyLayer(nn.Module):
... | [
"torch.nn.Sequential",
"numpy.fromfile",
"torch.nn.ModuleList",
"torch.nn.Conv2d",
"torch.cat",
"cv2.imread",
"torch.nn.BatchNorm2d",
"torch.nn.Upsample",
"torch.nn.LeakyReLU",
"cv2.resize",
"torch.from_numpy"
] | [((1369, 1384), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (1382, 1384), True, 'import torch.nn as nn\n'), ((9441, 9472), 'cv2.imread', 'cv2.imread', (['"""dog-cycle-car.png"""'], {}), "('dog-cycle-car.png')\n", (9451, 9472), False, 'import cv2\n'), ((9483, 9510), 'cv2.resize', 'cv2.resize', (['img', '(4... |
from __future__ import division, print_function
import pickle
import pdb
import os
import time
from sklearn.cross_validation import StratifiedKFold
from sklearn import svm
from sklearn import metrics
import gensim
import random
from learners import SK_SVM,SK_KNN,SK_MLP
from tuner import DE_Tune_ML
from model import Pap... | [
"numpy.random.seed",
"numpy.random.random_sample",
"sklearn.metrics.v_measure_score",
"sklearn.metrics.classification_report",
"os.path.isfile",
"pickle.load",
"numpy.mean",
"sklearn.neural_network.MLPClassifier",
"sklearn.svm.SVC",
"multiprocessing.Queue",
"sklearn.metrics.adjusted_rand_score",... | [((1916, 1950), 'os.path.sep.join', 'os.path.sep.join', (["['20171103.txt']"], {}), "(['20171103.txt'])\n", (1932, 1950), False, 'import os\n'), ((2141, 2175), 'results.results_process.reports', 'results_process.reports', (['file_name'], {}), '(file_name)\n', (2164, 2175), False, 'from results import results_process\n'... |
def transform_scalars(dataset):
"""
Normalize tilt series so that each tilt image has the same total intensity.
"""
from tomviz import utils
import numpy as np
data = utils.get_array(dataset) # Get data as numpy array
if data is None: # Check if data exists
raise RuntimeError("No ... | [
"numpy.average",
"tomviz.utils.get_array",
"numpy.sum",
"tomviz.utils.set_array"
] | [((193, 217), 'tomviz.utils.get_array', 'utils.get_array', (['dataset'], {}), '(dataset)\n', (208, 217), False, 'from tomviz import utils\n'), ((662, 692), 'tomviz.utils.set_array', 'utils.set_array', (['dataset', 'data'], {}), '(dataset, data)\n', (677, 692), False, 'from tomviz import utils\n'), ((486, 505), 'numpy.a... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from matplotlib import pyplot as plt
from torch import nn as nn
from torch.nn import fun... | [
"torch.ones_like",
"torch.relu",
"torch.zeros_like",
"torch.sqrt",
"torch.norm",
"torch.nn.Conv2d",
"numpy.zeros",
"torch.FloatTensor",
"torch.clamp",
"numpy.array",
"torch.nn.functional.max_pool2d",
"torch.max",
"torch.device",
"torch.min",
"matplotlib.pyplot.subplots",
"torch.round",... | [((752, 800), 'numpy.zeros', 'np.zeros', (['(ks * ks, 1, ks, ks)'], {'dtype': 'np.float32'}), '((ks * ks, 1, ks, ks), dtype=np.float32)\n', (760, 800), True, 'import numpy as np\n'), ((2026, 2045), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (2038, 2045), False, 'import torch\n'), ((2491, 2538), '... |
import math
import numpy as np
import re
class bitstream:
def __init__(self,array = None):
if(str(locals()['array']) == 'None'):
self.array_unit_size = 8
self.array_type = 'uint'
self.valid = True
self.read_index = 0
self.r_bit_... | [
"math.log",
"numpy.zeros",
"math.ceil"
] | [((11166, 11209), 'math.ceil', 'math.ceil', (['(self.size / self.array_unit_size)'], {}), '(self.size / self.array_unit_size)\n', (11175, 11209), False, 'import math\n'), ((438, 464), 'numpy.zeros', 'np.zeros', (['(8)'], {'dtype': '"""uint8"""'}), "(8, dtype='uint8')\n", (446, 464), True, 'import numpy as np\n'), ((144... |
import sys
import csv
import time
import cvxopt
import numpy as np
import pandas as pd
from svmutil import *
import matplotlib.pyplot as plt
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
# reading data from csv files
def get_data(data_path,issubset,digit1,digit2):
train_data = np.a... | [
"matplotlib.pyplot.title",
"numpy.ravel",
"numpy.argmax",
"pandas.read_csv",
"numpy.ones",
"numpy.exp",
"numpy.multiply",
"matplotlib.pyplot.imshow",
"numpy.savetxt",
"numpy.identity",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.set_cmap",
"cvxopt.solvers.qp",
"matplotlib.pyplot.show"... | [((396, 428), 'numpy.array', 'np.array', (['train_data[:, 784:785]'], {}), '(train_data[:, 784:785])\n', (404, 428), True, 'import numpy as np\n'), ((951, 972), 'matplotlib.pyplot.imshow', 'plt.imshow', (['confatrix'], {}), '(confatrix)\n', (961, 972), True, 'import matplotlib.pyplot as plt\n'), ((974, 1003), 'matplotl... |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
'''Correction for gaseous absorption based on SMAC method (Rahman and Dedieu, 1994)
'''
from math import *
import numpy as np
# =============================================================================================
def PdeZ(Z):
"""
PdeZ : Atmospher... | [
"numpy.exp"
] | [((8207, 8225), 'numpy.exp', 'np.exp', (['(-taup / us)'], {}), '(-taup / us)\n', (8213, 8225), True, 'import numpy as np\n'), ((14032, 14050), 'numpy.exp', 'np.exp', (['(-taup / us)'], {}), '(-taup / us)\n', (14038, 14050), True, 'import numpy as np\n'), ((8722, 8741), 'numpy.exp', 'np.exp', (['(-taup / aa1)'], {}), '(... |
import numpy as np
import tensorflow as tf
import math
import os
import glob
import scipy.io
#=======================================================================================================================
#Helper functions to load pretrained weights
#=========================================================... | [
"numpy.load",
"os.path.basename",
"numpy.transpose",
"tensorflow.variable_scope",
"tensorflow.transpose",
"tensorflow.matmul",
"os.path.join",
"tensorflow.get_variable"
] | [((2376, 2410), 'tensorflow.transpose', 'tf.transpose', (['tensor', '[0, 2, 1, 3]'], {}), '(tensor, [0, 2, 1, 3])\n', (2388, 2410), True, 'import tensorflow as tf\n'), ((2497, 2534), 'tensorflow.transpose', 'tf.transpose', (['tensor', '[0, 2, 1, 3, 4]'], {}), '(tensor, [0, 2, 1, 3, 4])\n', (2509, 2534), True, 'import t... |
import copy
import pytest
import numpy as np
from cotk.dataloader import LanguageGeneration, MSCOCO
from cotk.metric import MetricBase
from cotk.wordvector.wordvector import WordVector
from cotk.wordvector.gloves import Glove
import logging
def setup_module():
import random
random.seed(0)
import numpy as np
np.ra... | [
"numpy.random.seed",
"cotk.wordvector.wordvector.WordVector.load_class",
"pytest.raises",
"cotk.wordvector.wordvector.WordVector.get_all_subclasses",
"random.seed",
"cotk.wordvector.gloves.Glove",
"cotk.wordvector.wordvector.WordVector.load"
] | [((279, 293), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (290, 293), False, 'import random\n'), ((315, 332), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (329, 332), True, 'import numpy as np\n'), ((497, 528), 'cotk.wordvector.wordvector.WordVector.get_all_subclasses', 'WordVector.get_all_s... |
"""
CEASIOMpy: Conceptual Aircraft Design Software.
Developed for CFS ENGINEERING, 1015 Lausanne, Switzerland
Functions to create the dictionnary of geometric variables needed
for the optimnization routine.
Python version: >=3.6
| Author : <NAME>
| Creation: 2020-03-24
| Last modification: 2020-06-02
TODO
----
... | [
"ceasiompy.utils.apmfunctions.get_aeromap",
"ceasiompy.CPACSUpdater.cpacsupdater.get_aircraft",
"ceasiompy.utils.cpacsfunctions.open_tigl",
"sys.exit",
"numpy.repeat"
] | [((2873, 2908), 'ceasiompy.utils.apmfunctions.get_aeromap', 'apmf.get_aeromap', (['tixi', 'aeromap_uid'], {}), '(tixi, aeromap_uid)\n', (2889, 2908), True, 'import ceasiompy.utils.apmfunctions as apmf\n'), ((10398, 10418), 'ceasiompy.utils.cpacsfunctions.open_tigl', 'cpsf.open_tigl', (['tixi'], {}), '(tixi)\n', (10412,... |
# Copyright 2018 The CapsLayer 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 applicab... | [
"os.path.expanduser",
"numpy.random.seed",
"tensorflow.python_io.TFRecordWriter",
"os.makedirs",
"tensorflow.python.keras.utils.data_utils.get_file",
"os.path.exists",
"capslayer.data.utils.TFRecordHelper.bytes_feature",
"tensorflow.python.keras.datasets.cifar.load_batch",
"numpy.reshape",
"capsla... | [((3092, 3137), 'os.path.join', 'os.path.join', (['path', '"""train_cifar100.tfrecord"""'], {}), "(path, 'train_cifar100.tfrecord')\n", (3104, 3137), False, 'import os\n'), ((3161, 3205), 'os.path.join', 'os.path.join', (['path', '"""eval_cifar100.tfrecord"""'], {}), "(path, 'eval_cifar100.tfrecord')\n", (3173, 3205), ... |
import torch
import numpy as np
import torch.nn as nn
from math import ceil
from torch.autograd import Variable
from ptsemseg import caffe_pb2
from ptsemseg.models.utils import *
from ptsemseg.loss import *
pspnet_specs = {
'pascalvoc':
{
'n_classes': 21,
'input_size': (473, 473),
... | [
"os.mkdir",
"torch.nn.Dropout2d",
"numpy.copy",
"numpy.argmax",
"torch.autograd.Variable",
"torch.nn.Conv2d",
"numpy.zeros",
"ptsemseg.loader.cityscapes_loader.cityscapesLoader",
"os.path.exists",
"torch.cuda.device_count",
"ptsemseg.caffe_pb2.NetParameter",
"numpy.array",
"scipy.misc.imsave... | [((14241, 14266), 'ptsemseg.loader.cityscapes_loader.cityscapesLoader', 'cl', ([], {'root': 'dataset_root_dir'}), '(root=dataset_root_dir)\n', (14243, 14266), True, 'from ptsemseg.loader.cityscapes_loader import cityscapesLoader as cl\n'), ((14403, 14431), 'scipy.misc.imsave', 'm.imsave', (['"""cropped.png"""', 'img'],... |
import pyOcean_cpu as ocean
import numpy as np
import pyOceanNumpy
a = np.arange(24).reshape([3,2,4])
print(a)
b = ocean.asTensor(a).reverseAxes2()
print(b)
b.fill(3)
b.sync()
print(a)
| [
"numpy.arange",
"pyOcean_cpu.asTensor"
] | [((72, 85), 'numpy.arange', 'np.arange', (['(24)'], {}), '(24)\n', (81, 85), True, 'import numpy as np\n'), ((116, 133), 'pyOcean_cpu.asTensor', 'ocean.asTensor', (['a'], {}), '(a)\n', (130, 133), True, 'import pyOcean_cpu as ocean\n')] |
##############################################
##### Predicting EUR/USD pair using LSTM #####
##############################################
###################################
### Part 1 - Data Preprocessing ###
###################################
### Importing the libraries ###
import numpy as np
import pandas as p... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.MinMaxScaler",
"numpy.append",
"numpy.reshape",
"sklearn.metrics.mean_squared_error",
"matplotlib.pyplot.show",
"keras.layers.Dropout",
"matplotlib.pyplot.legend",
"keras.optimizers.Adam",
"datetime.datetime.st... | [((364, 390), 'pandas.read_csv', 'pd.read_csv', (['"""dataset.csv"""'], {}), "('dataset.csv')\n", (375, 390), True, 'import pandas as pd\n'), ((1746, 1780), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(0, 1)'}), '(feature_range=(0, 1))\n', (1758, 1780), False, 'from sklearn.preprocessi... |
#!/usr/bin/python3
import serial # pip3 install pyserial
import argparse
import time
import scipy.signal
from rtlsdr import RtlSdr # pip3 install pyrtlsdr
import numpy as np
import matplotlib.pyplot as plt
import csv
def isFloat(string):
try:
float(string)
return True
except ValueError:
... | [
"serial.Serial",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"csv.reader",
"rtlsdr.RtlSdr",
"matplotlib.pyplot.legend",
"time.sleep",
"numpy.min",
"numpy.mean",
"numpy.arange",
"rtlsdr.RtlSdr.get_device_serial_addresses",
"matplo... | [((2287, 2366), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""EMI mapping with 3D-printer and RTL-SDR."""'}), "(description='EMI mapping with 3D-printer and RTL-SDR.')\n", (2310, 2366), False, 'import argparse\n'), ((3565, 3611), 'numpy.arange', 'np.arange', (['freq_lbound', 'freq_uboun... |
import numpy
from copy import deepcopy
from barracuda.neurontype import neuron_type
import json
class _Neuron(object):
def __init__(self):
self.input = None
self.output = None
def forward(self,input_data):
raise NotImplementedError
def backward(self,output_error, learning_rate):
... | [
"numpy.dot",
"numpy.random.uniform",
"numpy.array",
"json.dumps"
] | [((609, 677), 'numpy.random.uniform', 'numpy.random.uniform', ([], {'low': '(-1)', 'high': '(1)', 'size': '(input_size, output_size)'}), '(low=-1, high=1, size=(input_size, output_size))\n', (629, 677), False, 'import numpy\n'), ((709, 768), 'numpy.random.uniform', 'numpy.random.uniform', ([], {'low': '(-1)', 'high': '... |
import imp, glob, numpy
imp.load_source('common_functions','common_functions.py')
import common_functions as cf
def dirty_cont_image(config,config_raw,config_file,logger):
"""
Generates a dirty image of each science target including the continuum emission.
Checks that the pixel size and image size are set ... | [
"common_functions.read_config",
"common_functions.diff_pipeline_params",
"common_functions.makedir",
"imp.load_source",
"numpy.array",
"common_functions.check_casaversion",
"glob.glob",
"common_functions.check_casalog",
"common_functions.rmdir",
"common_functions.backup_pipeline_params"
] | [((24, 82), 'imp.load_source', 'imp.load_source', (['"""common_functions"""', '"""common_functions.py"""'], {}), "('common_functions', 'common_functions.py')\n", (39, 82), False, 'import imp, glob, numpy\n'), ((7308, 7335), 'common_functions.read_config', 'cf.read_config', (['config_file'], {}), '(config_file)\n', (732... |
import logging
from pathlib import Path
import numpy as np
import pandas as pd
import plotly.express as px
import pyarrow.parquet as pq
from scipy.stats import betabinom as sp_betabinom
# import dashboard
from remade import dashboard as dashboard
def clip_df(df, column):
if column in df.columns:
df["_" ... | [
"pandas.wide_to_long",
"numpy.abs",
"remade.dashboard.utils.log_transform_slider",
"numpy.clip",
"pathlib.Path",
"numpy.max",
"remade.dashboard.utils.is_log_transform_column",
"pyarrow.parquet.read_table",
"numpy.log10",
"pandas.concat",
"scipy.stats.betabinom"
] | [((1080, 1131), 'pandas.concat', 'pd.concat', (['[group_long_forward, group_long_reverse]'], {}), '([group_long_forward, group_long_reverse])\n', (1089, 1131), True, 'import pandas as pd\n'), ((11801, 11823), 'pathlib.Path', 'Path', (['"""./data/results"""'], {}), "('./data/results')\n", (11805, 11823), False, 'from pa... |
from padertorch.data.segment import Segmenter
import numpy as np
import torch
def test_simple_case():
segmenter = Segmenter(length=32000, include_keys=('x', 'y'),
shift=16000)
ex = {'x': np.arange(65000), 'y': np.arange(65000),
'num_samples': 65000, 'gender': 'm'}
segme... | [
"numpy.random.randn",
"padertorch.data.segment.Segmenter",
"numpy.arange",
"numpy.testing.assert_equal",
"torch.tensor"
] | [((120, 181), 'padertorch.data.segment.Segmenter', 'Segmenter', ([], {'length': '(32000)', 'include_keys': "('x', 'y')", 'shift': '(16000)'}), "(length=32000, include_keys=('x', 'y'), shift=16000)\n", (129, 181), False, 'from padertorch.data.segment import Segmenter\n'), ((701, 773), 'padertorch.data.segment.Segmenter'... |
#python3
#steven 05/04/2020 Sierpiński triangle
#random start random points polygon
#ratio of getRatioPoint() indicate the division of line
import matplotlib.pyplot as plt
import numpy as np
import math
def plotXY(x,y,color='k',ax=None):
c=color
if ax:
ax.plot(x,y,color=c)
else:
plt.plot(x,... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axes",
"math.sin",
"numpy.random.random",
"numpy.array",
"math.cos",
"numpy.linspace",
"numpy.sqrt"
] | [((598, 636), 'numpy.linspace', 'np.linspace', (['startPt[0]', 'stopPt[0]', '(30)'], {}), '(startPt[0], stopPt[0], 30)\n', (609, 636), True, 'import numpy as np\n'), ((2171, 2195), 'numpy.sqrt', 'np.sqrt', (['(r ** 2 - x ** 2)'], {}), '(r ** 2 - x ** 2)\n', (2178, 2195), True, 'import numpy as np\n'), ((2334, 2368), 'n... |
# https://deeplearningcourses.com/c/artificial-intelligence-reinforcement-learning-in-python
# https://www.udemy.com/artificial-intelligence-reinforcement-learning-in-python
from __future__ import print_function, division
from builtins import range
# Note: you may need to update your version of future
# sudo pip instal... | [
"numpy.abs",
"grid_world.windy_grid",
"builtins.range"
] | [((487, 500), 'builtins.range', 'range', (['g.rows'], {}), '(g.rows)\n', (492, 500), False, 'from builtins import range\n'), ((783, 796), 'builtins.range', 'range', (['g.rows'], {}), '(g.rows)\n', (788, 796), False, 'from builtins import range\n'), ((1553, 1565), 'grid_world.windy_grid', 'windy_grid', ([], {}), '()\n',... |
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
from get_radar_loc_gt import yaw, rotToYawPitchRoll
def getRotDiff(r1, r2):
C1 = yaw(r1)
C2 = yaw(r2)
C_err = np.matmul(C2.transpose(), C1)
yaw_err, _, _ = rotToYawPitchRoll(C_err)
return abs(yaw_err)
if __name__ == "__main__":
... | [
"matplotlib.pyplot.hist",
"numpy.median",
"matplotlib.rcParams.update",
"numpy.savetxt",
"get_radar_loc_gt.rotToYawPitchRoll",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"get_radar_loc_gt.yaw",
"matplotlib.pyplot.grid",
... | [((155, 162), 'get_radar_loc_gt.yaw', 'yaw', (['r1'], {}), '(r1)\n', (158, 162), False, 'from get_radar_loc_gt import yaw, rotToYawPitchRoll\n'), ((172, 179), 'get_radar_loc_gt.yaw', 'yaw', (['r2'], {}), '(r2)\n', (175, 179), False, 'from get_radar_loc_gt import yaw, rotToYawPitchRoll\n'), ((242, 266), 'get_radar_loc_g... |
r"""
Support for embedded TeX expressions in Matplotlib.
Requirements:
* LaTeX.
* \*Agg backends: dvipng>=1.6.
* PS backend: PSfrag, dvips, and Ghostscript>=9.0.
* PDF and SVG backends: if LuaTeX is present, it will be used to speed up some
post-processing steps, but note that it is not used to parse the T... | [
"matplotlib.get_cachedir",
"matplotlib.cbook._pformat_subprocess",
"matplotlib.dviread.Dvi",
"hashlib.md5",
"numpy.empty",
"subprocess.check_output",
"packaging.version.parse",
"os.path.exists",
"matplotlib.colors.to_rgb",
"pathlib.Path",
"matplotlib._api.deprecate_privatize_attribute",
"funct... | [((996, 1023), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1013, 1023), False, 'import logging\n'), ((3660, 3701), 'matplotlib._api.deprecate_privatize_attribute', '_api.deprecate_privatize_attribute', (['"""3.5"""'], {}), "('3.5')\n", (3694, 3701), False, 'from matplotlib import _api... |
from flask import Flask, render_template, redirect, url_for, request, session, flash, Markup
import os
from collections import defaultdict
import inspect
import pandas as pd
import numpy as np
from scipy import stats
import re
from graphviz import Digraph
import plotly
from plotly.subplots import make_subplots
import p... | [
"json.dump",
"flask.flash",
"flask.session.pop",
"flask.request.args.get",
"warnings.filterwarnings",
"flask.Flask",
"os.system",
"werkzeug.utils.secure_filename",
"uuid.uuid1",
"flask.url_for",
"flask.request.form.to_dict",
"numpy.array",
"functools.wraps",
"flask.render_template",
"os.... | [((924, 957), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (947, 957), False, 'import warnings\n'), ((965, 980), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (970, 980), False, 'from flask import Flask, render_template, redirect, url_for, request, session,... |
# Computes expected results for `testGRU()` in `Tests/TensorFlowTests/LayerTests.swift`.
# Requires 'tensorflow>=2.0.0a0' (e.g. "pip install tensorflow==2.2.0").
import sys
import numpy
import tensorflow as tf
# Set random seed for repetable results
tf.random.set_seed(0)
def indented(s):
return '\n'.join([' '... | [
"tensorflow.random.set_seed",
"tensorflow.reduce_sum",
"numpy.format_float_positional",
"tensorflow.keras.layers.GRU",
"tensorflow.keras.Input",
"numpy.array2string",
"tensorflow.keras.Model",
"tensorflow.keras.initializers.GlorotUniform",
"tensorflow.GradientTape"
] | [((252, 273), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(0)'], {}), '(0)\n', (270, 273), True, 'import tensorflow as tf\n'), ((973, 1155), 'tensorflow.keras.layers.GRU', 'tf.keras.layers.GRU', ([], {'input_dim': 'input_dim', 'units': 'units', 'activation': '"""tanh"""', 'recurrent_activation': '"""sigmoid"... |
import matplotlib.pyplot as plt
from skimage import exposure
import numpy as np
def plot_img_and_mask(img, mask):
img = np.array(img)
img = (img - img.min()) / (img.max() - img.min())
img = exposure.equalize_adapthist(img)
fig, ax = plt.subplots(1, 1, figsize=(10, 10))
ax.set_title('Input image')... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.yticks",
"numpy.array",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.subplots",
"skimage.exposure.equalize_adapthist"
] | [((126, 139), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (134, 139), True, 'import numpy as np\n'), ((204, 236), 'skimage.exposure.equalize_adapthist', 'exposure.equalize_adapthist', (['img'], {}), '(img)\n', (231, 236), False, 'from skimage import exposure\n'), ((252, 288), 'matplotlib.pyplot.subplots', 'plt... |
import sys
import os
import glob
import numpy as np
import pytest
from pyDeltaRCM.model import DeltaModel
from pyDeltaRCM import shared_tools
# utilities for file writing
def create_temporary_file(tmp_path, file_name):
d = tmp_path / 'configs'
d.mkdir(parents=True, exist_ok=True)
p = d / file_name
... | [
"pyDeltaRCM.model.DeltaModel",
"numpy.zeros",
"pytest.fixture",
"pyDeltaRCM.shared_tools.get_random_uniform",
"os.path.join"
] | [((1390, 1422), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (1404, 1422), False, 'import pytest\n'), ((3169, 3193), 'pyDeltaRCM.model.DeltaModel', 'DeltaModel', ([], {'input_file': 'p'}), '(input_file=p)\n', (3179, 3193), False, 'from pyDeltaRCM.model import DeltaModel... |
#!/usr/bin/env python
# coding: utf-8
# Many thanks for <EMAIL> & <EMAIL> for their orginal work and allowing me to share!
import argparse
import numpy as np
import torch
import torch.nn as nn
import joblib
from sklearn.metrics import roc_auc_score
from sklearn.preprocessing import RobustScaler
from torch.utils.data i... | [
"numpy.load",
"uda_model.UDAModel",
"argparse.ArgumentParser",
"numpy.argmax",
"joblib.dump",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.exp",
"uproot3.newtree",
"torch.no_grad",
"argparse.ArgumentTypeError",
"matplotlib.rcParams.update",
"torch.optim.lr_scheduler.Red... | [((631, 682), 'numpy.where', 'np.where', (['(pred_tags > 0.5)', '(1 - pred_tags)', 'pred_tags'], {}), '(pred_tags > 0.5, 1 - pred_tags, pred_tags)\n', (639, 682), True, 'import numpy as np\n'), ((2200, 2227), 'torch.manual_seed', 'torch.manual_seed', (['(25031992)'], {}), '(25031992)\n', (2217, 2227), False, 'import to... |
"""
The ComputationalBasisPOVMEffect class and supporting functionality.
"""
#***************************************************************************************************
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
# Under the terms of Contract DE-NA0003525 with NTE... | [
"pygsti.modelmembers.povms.effect.POVMEffect.__init__",
"numpy.empty",
"numpy.allclose",
"pygsti.baseobjs.basis.Basis.cast",
"pygsti.baseobjs.polynomial.Polynomial",
"pygsti.evotypes.Evotype.cast",
"pygsti.baseobjs.statespace.StateSpace.cast",
"numpy.array",
"pygsti.modelmembers.term.RankOnePolynomi... | [((3858, 3899), 'itertools.product', '_itertools.product', (['*([(0, 1)] * nqubits)'], {}), '(*([(0, 1)] * nqubits))\n', (3876, 3899), True, 'import itertools as _itertools\n'), ((5581, 5622), 'itertools.product', '_itertools.product', (['*([(0, 1)] * nqubits)'], {}), '(*([(0, 1)] * nqubits))\n', (5599, 5622), True, 'i... |
import numpy as np
import torch.nn as nn
from .layer_ops import ModuleOperation
from .simple_model import SimpleModel, SimpleModelOperation
from src.utils import param_sizes, weight_vector
class ElbowModel(ModuleOperation):
def __init__(self, w_1=None, w_2=None, w_3=None):
self.w_1 = w_1 if not w_1 is No... | [
"numpy.random.random"
] | [((601, 619), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (617, 619), True, 'import numpy as np\n'), ((635, 653), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (651, 653), True, 'import numpy as np\n')] |
"""
Title: Making new layers and models via subclassing
Author: [fchollet](https://twitter.com/fchollet)
Date created: 2019/03/01
Last modified: 2020/04/13
Description: Complete guide to writing `Layer` and `Model` objects from scratch.
"""
"""
## Setup
"""
import tensorflow as tf
from tensorflow import keras
"""
## ... | [
"tensorflow.reduce_sum",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.metrics.Mean",
"tensorflow.keras.backend.random_normal",
"tensorflow.matmul",
"tensorflow.keras.metrics.BinaryAccuracy",
"tensorflow.keras.regularizers.l2",
"tensorflow.nn.softmax",
"tensorflow.nn.relu",
"tensorflow.keras.... | [((1342, 1357), 'tensorflow.ones', 'tf.ones', (['(2, 2)'], {}), '((2, 2))\n', (1349, 1357), True, 'import tensorflow as tf\n'), ((2132, 2147), 'tensorflow.ones', 'tf.ones', (['(2, 2)'], {}), '((2, 2))\n', (2139, 2147), True, 'import tensorflow as tf\n'), ((2825, 2840), 'tensorflow.ones', 'tf.ones', (['(2, 2)'], {}), '(... |
import numpy as np
import os
import pandas as pd
from ..utils import (drop_tseconds_volume, read_ndata,
write_ndata,compute_FD,generate_mask,interpolate_masked_data)
from nipype.interfaces.base import (traits, TraitedSpec, BaseInterfaceInputSpec, File,
SimpleInterface )
from nipype import loggin... | [
"pandas.DataFrame",
"numpy.divide",
"numpy.sum",
"pandas.read_csv",
"nipype.interfaces.base.traits.Float",
"os.getcwd",
"numpy.savetxt",
"nipype.interfaces.base.File",
"numpy.where",
"numpy.loadtxt",
"nipype.interfaces.base.traits.Either"
] | [((441, 505), 'nipype.interfaces.base.File', 'File', ([], {'exists': '(True)', 'mandatory': '(True)', 'desc': '""" either bold or nifti """'}), "(exists=True, mandatory=True, desc=' either bold or nifti ')\n", (445, 505), False, 'from nipype.interfaces.base import traits, TraitedSpec, BaseInterfaceInputSpec, File, Simp... |
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... | [
"megengine.data.transform.vision.functional.pad",
"megengine.data.transform.vision.functional.resize",
"numpy.clip",
"numpy.random.randint",
"numpy.random.normal",
"cv2.cvtColor",
"cv2.split",
"numpy.rollaxis",
"numpy.random.choice",
"math.log",
"numpy.uint8",
"math.sqrt",
"numpy.asarray",
... | [((5400, 5438), 'numpy.concatenate', 'np.concatenate', (['(minxy, maxxy)'], {'axis': '(1)'}), '((minxy, maxxy), axis=1)\n', (5414, 5438), True, 'import numpy as np\n'), ((5724, 5775), 'numpy.concatenate', 'np.concatenate', (['(trans_coords, visibility)'], {'axis': '(-1)'}), '((trans_coords, visibility), axis=-1)\n', (5... |
import torch
import numpy as np
from tqdm import tqdm
from torch.utils.data import DataLoader
class TrainingConfig:
lr=3e-4
betas=(0.9,0.995)
weight_decay=5e-4
num_workers=0
max_epochs=10
batch_size=64
ckpt_path=None #Specify a model path here. Ex: "./Model.pt"
shuf... | [
"torch.utils.data.DataLoader",
"torch.argmax",
"numpy.mean",
"torch.cuda.is_available",
"torch.set_grad_enabled",
"torch.cuda.current_device",
"torch.no_grad"
] | [((907, 932), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (930, 932), False, 'import torch\n'), ((961, 988), 'torch.cuda.current_device', 'torch.cuda.current_device', ([], {}), '()\n', (986, 988), False, 'import torch\n'), ((1846, 1982), 'torch.utils.data.DataLoader', 'DataLoader', (['data']... |
import json
import re
import argparse
from difflib import SequenceMatcher
from pprint import pprint
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
from terminaltables import AsciiTable
from transformers import AutoTokenizer
import stanza
import udon2
... | [
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"scipy.stats.mode",
"numpy.std",
"numpy.median",
"terminaltables.AsciiTable",
"udon2.kernels.ConvPartialTreeKernel",
"difflib.SequenceMatcher",
"collections.defaultdict",
"transformers.AutoTokenizer.from_pretrained",
"numpy.mean",
"stanza.Pi... | [((2553, 2578), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2576, 2578), False, 'import argparse\n'), ((2815, 2874), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['"""KB/bert-base-swedish-cased"""'], {}), "('KB/bert-base-swedish-cased')\n", (2844, 2874), F... |
'''
From https://github.com/tsc2017/Frechet-Inception-Distance
Code derived from https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/gan/python/eval/python/classifier_metrics_impl.py
Usage:
Call get_fid(images1, images2)
Args:
images1, images2: Numpy arrays with values ranging from 0 to 255... | [
"functools.partial",
"numpy.zeros",
"tensorflow.transpose",
"time.time",
"tensorflow.placeholder",
"tensorflow.python.ops.array_ops.split",
"numpy.min",
"numpy.max",
"tensorflow.python.ops.array_ops.unstack",
"tensorflow.InteractiveSession",
"tensorflow.python.ops.array_ops.stack",
"tensorflow... | [((780, 803), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (801, 803), True, 'import tensorflow as tf\n'), ((959, 1014), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[BATCH_SIZE, 3, None, None]'], {}), '(tf.float32, [BATCH_SIZE, 3, None, None])\n', (973, 1014), True, 'impo... |
#!/usr/bin/python3.6
import os
import re
import sys
import yaml
from glob import glob
from collections import OrderedDict
from typing import List
import numpy as np
import pandas as pd
from tqdm import tqdm
from metrics import F_score
from debug import dprint
IN_KERNEL = os.environ.get('KAGGLE_WORKING_DIR') is not... | [
"numpy.load",
"numpy.zeros_like",
"metrics.F_score",
"pandas.read_csv",
"os.path.basename",
"yaml.dump",
"numpy.zeros",
"re.match",
"os.environ.get",
"debug.dprint",
"glob.glob",
"sys.exit"
] | [((277, 313), 'os.environ.get', 'os.environ.get', (['"""KAGGLE_WORKING_DIR"""'], {}), "('KAGGLE_WORKING_DIR')\n", (291, 313), False, 'import os\n'), ((781, 801), 'numpy.load', 'np.load', (['"""folds.npy"""'], {}), "('folds.npy')\n", (788, 801), True, 'import numpy as np\n'), ((817, 854), 'pandas.read_csv', 'pd.read_csv... |
from __future__ import print_function, absolute_import, division
import numpy as np
from distutils.version import LooseVersion
def allbadtonan(function):
"""
Wrapper of numpy's nansum etc.: for <=1.8, just return the function's
results. For >=1.9, any axes with all-nan values will have all-nan outputs
... | [
"distutils.version.LooseVersion",
"numpy.isnan"
] | [((565, 593), 'distutils.version.LooseVersion', 'LooseVersion', (['np.__version__'], {}), '(np.__version__)\n', (577, 593), False, 'from distutils.version import LooseVersion\n'), ((597, 618), 'distutils.version.LooseVersion', 'LooseVersion', (['"""1.9.0"""'], {}), "('1.9.0')\n", (609, 618), False, 'from distutils.vers... |
import numpy as np
def calc_mass(m, l_rod):
M = np.array([[m, 0., 0.], [0., m, 0.], [0., 0., (1. / 12.) * m * l_rod * l_rod]])
return M
def calc_rot(q):
theta = q[2][0]
c, s = np.cos(theta), np.sin(theta)
R = np.array(((c, -s, 0.), (s, c, 0.), (0., 0., 1.)))
return R
# Location of the rev jo... | [
"numpy.zeros",
"numpy.sin",
"numpy.array",
"numpy.cos",
"numpy.matmul",
"numpy.linalg.solve"
] | [((53, 141), 'numpy.array', 'np.array', (['[[m, 0.0, 0.0], [0.0, m, 0.0], [0.0, 0.0, 1.0 / 12.0 * m * l_rod * l_rod]]'], {}), '([[m, 0.0, 0.0], [0.0, m, 0.0], [0.0, 0.0, 1.0 / 12.0 * m * l_rod *\n l_rod]])\n', (61, 141), True, 'import numpy as np\n'), ((232, 286), 'numpy.array', 'np.array', (['((c, -s, 0.0), (s, c, ... |
import numpy as np
import astropy.units as u
import classes
dist = classes.Distribution('planets3_bottomup/')
ms = np.round(np.logspace(np.log10(0.1), np.log10(13*u.Mjup.to('Mearth')),100),3)
aas = np.round(np.logspace(np.log10(0.1), np.log10(10),100), 3)[::-1]
aas2 = np.round(np.logspace(np.log10(0.04), np.log10(10),... | [
"numpy.append",
"numpy.log10",
"astropy.units.Mjup.to",
"classes.Distribution"
] | [((68, 110), 'classes.Distribution', 'classes.Distribution', (['"""planets3_bottomup/"""'], {}), "('planets3_bottomup/')\n", (88, 110), False, 'import classes\n'), ((349, 383), 'numpy.append', 'np.append', (['aas[:-51]', 'aas2[43:-13]'], {}), '(aas[:-51], aas2[43:-13])\n', (358, 383), True, 'import numpy as np\n'), ((3... |
r"""Postprocessing Laplace equation.
A basic postprocessing step in finite element analysis is evaluating linear
forms over the solution. For the Poisson equation, the integral
of the solution (normalized by the area) is the 'Boussinesq k-factor'; for
the square it's roughly 0.03514, for the circle 1/Pi/8 = 0.03979. L... | [
"skfem.visuals.matplotlib.show",
"skfem.visuals.matplotlib.plot",
"numpy.zeros"
] | [((1669, 1683), 'skfem.visuals.matplotlib.plot', 'plot', (['basis', 'x'], {}), '(basis, x)\n', (1673, 1683), False, 'from skfem.visuals.matplotlib import plot, show\n'), ((1688, 1694), 'skfem.visuals.matplotlib.show', 'show', ([], {}), '()\n', (1692, 1694), False, 'from skfem.visuals.matplotlib import plot, show\n'), (... |
"""
This benchmark compares the performance of different models in
predicting tissue based on gene expression
"""
import argparse
import os
import numpy as np
import pandas as pd
import sklearn.metrics
import yaml
from sklearn.preprocessing import MinMaxScaler
from saged import utils, datasets, models
AVAILABLE_TISS... | [
"saged.utils.load_recount_data",
"pandas.DataFrame",
"argparse.ArgumentParser",
"saged.utils.initialize_neptune",
"sklearn.preprocessing.MinMaxScaler",
"saged.datasets.correct_batch_effects",
"numpy.ones",
"saged.datasets.RefineBioMixedDataset",
"saged.utils.subset_to_equal_ratio",
"yaml.safe_load... | [((1267, 1292), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1290, 1292), False, 'import argparse\n'), ((3451, 3495), 'saged.utils.load_recount_data', 'utils.load_recount_data', (['args.dataset_config'], {}), '(args.dataset_config)\n', (3474, 3495), False, 'from saged import utils, datasets,... |
import numpy as np
import aesara
import aesara.tensor as tt
class Mlp:
def __init__(self, nfeatures=100, noutputs=10, nhiddens=50, rng=None):
if rng is None:
rng = 0
if isinstance(rng, int):
rng = np.random.RandomState(rng)
self.rng = rng
self.nfeatures = n... | [
"aesara.tensor.dmatrix",
"aesara.tensor.nnet.sigmoid",
"aesara.tensor.dot",
"numpy.zeros",
"numpy.random.RandomState",
"aesara.OpFromGraph",
"aesara.tensor.scalars"
] | [((408, 423), 'aesara.tensor.dmatrix', 'tt.dmatrix', (['"""x"""'], {}), "('x')\n", (418, 423), True, 'import aesara.tensor as tt\n'), ((914, 931), 'aesara.tensor.scalars', 'tt.scalars', (['"""xyz"""'], {}), "('xyz')\n", (924, 931), True, 'import aesara.tensor as tt\n'), ((963, 994), 'aesara.OpFromGraph', 'aesara.OpFrom... |
'''
HOW TO RUN THIS CODE (if tests are within the assignment 1 root):
python -m py.test tests/test_sigmoid_to_solutions.py -vv -s -q
python -m py.test tests/test_sigmoid_to_solutions.py -vv -s -q --cov
py.test.exe --cov=cs224d/ tests/test_sigmoid_to_solutions.py --cov-report html
(if the tests are within the subfolde... | [
"q2_sigmoid_sol.sigmoid_grad_sol",
"numpy.random.uniform",
"numpy.abs",
"numpy.copy",
"q2_sigmoid.sigmoid",
"q2_sigmoid_sol.sigmoid_sol",
"numpy.argsort",
"q2_sigmoid.sigmoid_grad",
"numpy.random.standard_normal",
"numpy.array",
"numpy.random.randint",
"numpy.random.normal",
"numpy.random.pe... | [((831, 891), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""sigmoid_f"""', '[sigmoid, sigmoid_sol]'], {}), "('sigmoid_f', [sigmoid, sigmoid_sol])\n", (854, 891), False, 'import pytest\n'), ((1145, 1205), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""sigmoid_f"""', '[sigmoid, sigmoid_sol]'], ... |
# Copyright 2020 <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, softwa... | [
"numpy.dot",
"functools.partial",
"logging.getLogger"
] | [((767, 794), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (784, 794), False, 'import logging\n'), ((2413, 2474), 'functools.partial', 'functools.partial', (['imagecat.color.linear_map'], {'palette': 'palette'}), '(imagecat.color.linear_map, palette=palette)\n', (2430, 2474), False, 'im... |
import itertools
import os
import shutil
import tempfile
import unittest
import numpy as np
import pytest
from coremltools._deps import _HAS_KERAS2_TF
from coremltools.models import _MLMODEL_FULL_PRECISION, _MLMODEL_HALF_PRECISION
from coremltools.models.utils import _macos_version, _is_macos
if _HAS_KERAS2_TF:
... | [
"numpy.random.seed",
"distutils.version.StrictVersion",
"keras.layers.dot",
"keras.layers.Cropping2D",
"numpy.ones",
"keras.models.Model",
"numpy.product",
"keras.layers.ZeroPadding1D",
"keras.layers.ZeroPadding2D",
"keras.layers.Input",
"keras.layers.Cropping1D",
"keras.layers.concatenate",
... | [((3825, 3894), 'unittest.skipIf', 'unittest.skipIf', (['(not _HAS_KERAS2_TF)', '"""Missing keras. Skipping tests."""'], {}), "(not _HAS_KERAS2_TF, 'Missing keras. Skipping tests.')\n", (3840, 3894), False, 'import unittest\n'), ((8791, 8860), 'unittest.skipIf', 'unittest.skipIf', (['(not _HAS_KERAS2_TF)', '"""Missing ... |
# -*- coding: utf-8 -*-
# Looks for scenes in arbitrary video
# python -W ignore video_to_scenes.py -in media/sample/LivingSt1958.mp4 -overwrite 1 -threshold 24 -fade 1 -plot 800
# python -W ignore video_to_scenes.py -in "media/downloads/ia_politicaladarchive/*.mp4" -threshold 24 -out "tmp/ia_politicaladarchive_scenes... | [
"sys.stdout.write",
"os.remove",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"scenedetect.stats_manager.StatsManager",
"os.path.basename",
"scenedetect.scene_manager.SceneManager",
"scenedetect.detectors.content_detector.ContentDetector",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatt... | [((807, 832), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (830, 832), False, 'import argparse\n'), ((2547, 2574), 'os.path.isfile', 'os.path.isfile', (['OUTPUT_FILE'], {}), '(OUTPUT_FILE)\n', (2561, 2574), False, 'import os\n'), ((2654, 2664), 'sys.exit', 'sys.exit', ([], {}), '()\n', (2662,... |
# MIT License
#
# Copyright (c) 2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... | [
"tensorflow.train.Coordinator",
"argparse.ArgumentParser",
"tensorflow.trainable_variables",
"tensorflow.train.batch_join",
"tensorflow.local_variables_initializer",
"tensorflow.ConfigProto",
"numpy.mean",
"tensorflow.image.resize_image_with_crop_or_pad",
"tensorflow.GPUOptions",
"six.iteritems",
... | [((1538, 1589), 'numpy.array', 'np.array', (['[134.10714722, 102.52040863, 87.15436554]'], {}), '([134.10714722, 102.52040863, 87.15436554])\n', (1546, 1589), True, 'import numpy as np\n'), ((1694, 1733), 'os.path.expanduser', 'os.path.expanduser', (['args.vae_checkpoint'], {}), '(args.vae_checkpoint)\n', (1712, 1733),... |
#!/usr/bin/env python3
# This is a script that analyses the simulation results from
# the script `PICMI_inputs_2d`.
import sys
import matplotlib
matplotlib.use('Agg')
import yt
yt.funcs.mylog.setLevel(50)
import numpy as np
sys.path.insert(1, '../../../../warpx/Regression/Checksum/')
import checksum
# this will be ... | [
"yt.funcs.mylog.setLevel",
"sys.path.insert",
"numpy.isclose",
"matplotlib.use",
"checksum.Checksum",
"sys.exit"
] | [((147, 168), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (161, 168), False, 'import matplotlib\n'), ((179, 206), 'yt.funcs.mylog.setLevel', 'yt.funcs.mylog.setLevel', (['(50)'], {}), '(50)\n', (202, 206), False, 'import yt\n'), ((226, 286), 'sys.path.insert', 'sys.path.insert', (['(1)', '""".... |
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
from collections import defaultdict
import pytest
import numpy as np
import mne
import mne_nirs
from mne.datasets import testing
from mne.utils import catch_logging, check_version
from mne_nirs.experimental_design.tests.test_experimental_design import \
_l... | [
"mne.channels.make_standard_montage",
"mne_nirs.visualisation.plot_glm_contrast_topo",
"mne.preprocessing.nirs.beer_lambert_law",
"collections.defaultdict",
"pyvista.close_all",
"numpy.arange",
"mne_nirs.visualisation.plot_glm_topo",
"mne.utils.catch_logging",
"pytest.warns",
"mne_nirs.viz.plot_3d... | [((578, 611), 'mne.datasets.testing.data_path', 'testing.data_path', ([], {'download': '(False)'}), '(download=False)\n', (595, 611), False, 'from mne.datasets import testing\n'), ((1572, 1647), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:"plot_glm_topo" has been deprecated.*:"""'], {}), '(... |
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"copy.deepcopy",
"os.makedirs",
"ipdb.set_trace",
"random.choice",
"json.dumps",
"parlai.core.worlds.validate",
"random.seed",
"numpy.array",
"parlai.core.message.Message",
"os.path.join"
] | [((2913, 2954), 'os.path.join', 'os.path.join', (['jsons_path', '"""dev_data.json"""'], {}), "(jsons_path, 'dev_data.json')\n", (2925, 2954), False, 'import os\n'), ((2969, 3008), 'os.path.join', 'os.path.join', (['jsons_path', '"""dev_kb.json"""'], {}), "(jsons_path, 'dev_kb.json')\n", (2981, 3008), False, 'import os\... |
"""
General Setup and Imports
"""
get_ipython().run_line_magic('matplotlib', 'tk')
import matplotlib.pyplot as plt
from bluesky import RunEngine
from bluesky.callbacks.best_effort import BestEffortCallback
from bluesky.plans import *
from bluesky.preprocessors import run_wrapper
from bluesky.utils import install_nb_kic... | [
"bluesky.utils.install_nb_kicker",
"bluesky.plan_stubs.close_run",
"ophyd.signal.EpicsSignalRO",
"functools.partial",
"argparse.ArgumentParser",
"bluesky.plan_stubs.unsubscribe",
"bluesky.callbacks.LivePlot",
"bluesky.callbacks.best_effort.BestEffortCallback",
"pswalker.plans.walk_to_pixel",
"matp... | [((997, 1032), 'numpy.random.normal', 'np.random.normal', ([], {'scale': 'noise_scale'}), '(scale=noise_scale)\n', (1013, 1032), True, 'import numpy as np\n'), ((2125, 2153), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 10)'}), '(figsize=(15, 10))\n', (2135, 2153), True, 'import matplotlib.pyplot as... |
import emcee
import numpy as np
from astropy.io import fits
from pylinear.utilities import indices,pool
def mp_mcmcUncertainty(A,bi,func,conf):
if A is None or bi is None:
return None,None,None
ndim=1
p0=[]
nwalkers=conf['nwalkers']
for i in range(nwalkers):
p0.append(np.ar... | [
"numpy.sum",
"numpy.random.randn",
"emcee.EnsembleSampler",
"numpy.std",
"numpy.percentile",
"pylinear.utilities.pool.Pool",
"numpy.array"
] | [((388, 447), 'emcee.EnsembleSampler', 'emcee.EnsembleSampler', (['nwalkers', 'ndim', 'lnlike'], {'args': '(A, bi)'}), '(nwalkers, ndim, lnlike, args=(A, bi))\n', (409, 447), False, 'import emcee\n'), ((662, 685), 'numpy.std', 'np.std', (['samples'], {'axis': '(0)'}), '(samples, axis=0)\n', (668, 685), True, 'import nu... |
import numpy as np
import heapq
import tensorflow as tf
from sklearn.metrics import roc_auc_score
from layers import Dense, CrossCompressUnit
import metrics
def test_one_user(x, train_items, test_items, item_num, Ks):
rating, u = x[0], x[1]
training_items = train_items[u] if u in train_items else []
user_... | [
"tensorflow.reduce_sum",
"tensorflow.nn.sigmoid_cross_entropy_with_logits",
"tensorflow.get_variable",
"metrics.ndcg_at_k",
"metrics.auc",
"tensorflow.concat",
"heapq.nlargest",
"numpy.equal",
"tensorflow.placeholder",
"numpy.max",
"tensorflow.nn.embedding_lookup",
"sklearn.metrics.roc_auc_sco... | [((749, 802), 'heapq.nlargest', 'heapq.nlargest', (['K_max', 'item_score'], {'key': 'item_score.get'}), '(K_max, item_score, key=item_score.get)\n', (763, 802), False, 'import heapq\n'), ((1857, 1906), 'metrics.auc', 'metrics.auc', ([], {'ground_truth': 'r', 'prediction': 'posterior'}), '(ground_truth=r, prediction=pos... |
__author__ = "<NAME>"
__copyright__ = "Copyright, 2021, <NAME>"
__license__ = "3-Clause BSD License"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMIT... | [
"numpy.divide",
"numpy.sum",
"numpy.abs",
"numpy.empty",
"numpy.square",
"numpy.ones",
"numpy.arange"
] | [((1709, 1755), 'numpy.empty', 'np.empty', (['(degree, theta.size)'], {'dtype': 'np.float'}), '((degree, theta.size), dtype=np.float)\n', (1717, 1755), True, 'import numpy as np\n'), ((1772, 1796), 'numpy.ones', 'np.ones', (['(1, theta.size)'], {}), '((1, theta.size))\n', (1779, 1796), True, 'import numpy as np\n'), ((... |
from __future__ import absolute_import, print_function, division
import os
import shutil
import unittest
from tempfile import mkdtemp
import numpy as np
import theano
from theano.sandbox.rng_mrg import MRG_RandomStreams
from theano.misc.pkl_utils import dump, load, StripPickler
class T_dump_load(unittest.TestCase)... | [
"numpy.load",
"os.getcwd",
"theano.misc.pkl_utils.dump",
"theano.misc.pkl_utils.load",
"theano.sandbox.rng_mrg.MRG_RandomStreams",
"tempfile.mkdtemp",
"theano.shared",
"numpy.array",
"theano.misc.pkl_utils.StripPickler",
"shutil.rmtree",
"os.chdir",
"theano.tensor.matrix"
] | [((441, 452), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (450, 452), False, 'import os\n'), ((475, 484), 'tempfile.mkdtemp', 'mkdtemp', ([], {}), '()\n', (482, 484), False, 'from tempfile import mkdtemp\n'), ((493, 514), 'os.chdir', 'os.chdir', (['self.tmpdir'], {}), '(self.tmpdir)\n', (501, 514), False, 'import os\n'... |
from __future__ import (print_function, absolute_import)
import numpy as np
from .profiles import get_profiles
def interpolate_profile(nlower, nupper, nelec, temp, with_doppler=False):
"""
Interpolate profile tables of Lemke 1997 to get a Stark broadened line profile
Parameters
----------
nlowe... | [
"numpy.log10",
"numpy.arange",
"numpy.ceil",
"numpy.floor"
] | [((871, 886), 'numpy.log10', 'np.log10', (['nelec'], {}), '(nelec)\n', (879, 886), True, 'import numpy as np\n'), ((899, 913), 'numpy.log10', 'np.log10', (['temp'], {}), '(temp)\n', (907, 913), True, 'import numpy as np\n'), ((1074, 1096), 'numpy.floor', 'np.floor', (['log_ne_index'], {}), '(log_ne_index)\n', (1082, 10... |
# Copyright (c) OpenMMLab. All rights reserved.
import logging
from typing import Any, Dict, Optional, Sequence, Tuple, Union
import mmcv
import numpy as np
import torch
from torch.utils.data import Dataset
from mmdeploy.codebase.base import BaseTask
from mmdeploy.utils import Task, get_root_logger
from mmdeploy.util... | [
"mmcv.utils.get_logger",
"numpy.argmax",
"mmcv.parallel.scatter",
"mmdeploy.utils.config_utils.get_input_shape",
"mmcls.datasets.pipelines.Compose",
"numpy.max",
"mmcv.dump",
"mmdeploy.utils.get_root_logger",
"warnings.warn",
"mmcls.apis.init_model",
"mmcv.parallel.collate",
"mmcv.imread",
"... | [((3527, 3597), 'mmcls.apis.init_model', 'init_model', (['self.model_cfg', 'model_checkpoint', 'self.device', 'cfg_options'], {}), '(self.model_cfg, model_checkpoint, self.device, cfg_options)\n', (3537, 3597), False, 'from mmcls.apis import init_model\n'), ((4615, 4646), 'mmcls.datasets.pipelines.Compose', 'Compose', ... |
import argparse
import numpy as np
import pandas as pd
import os
from tqdm import tqdm
import torch.nn as nn
from torch import optim
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
import torch
#from apex import amp
from torch.utils.data import DataLoader, RandomSampler, SequentialSampl... | [
"torch.nn.Dropout",
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.sum",
"random.shuffle",
"transformers.BertModel",
"numpy.ones",
"torch.device",
"json.loads",
"torch.utils.data.DataLoader",
"torch.nn.parallel.DistributedDataParallel",
"os.path.exists",
"torch.utils.data.distributed... | [((9488, 9506), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (9504, 9506), True, 'import numpy as np\n'), ((9689, 9714), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (9712, 9714), False, 'import argparse\n'), ((9867, 9905), 'torch.cuda.set_device', 'torch.cuda.set_device', (['... |
# Copyright (C) 2014 <NAME>
# All rights reserved.
#
# This file is part of phonopy.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, thi... | [
"numpy.maximum",
"numpy.abs",
"phonopy.structure.snf.SNF3x3",
"spglib.relocate_BZ_grid_address",
"phonopy.structure.cells.determinant",
"numpy.unique",
"numpy.prod",
"phonopy.structure.symmetry.get_pointgroup_operations",
"numpy.zeros_like",
"numpy.multiply",
"numpy.extract",
"numpy.logical_xo... | [((3043, 3065), 'numpy.linalg.inv', 'np.linalg.inv', (['lattice'], {}), '(lattice)\n', (3056, 3065), True, 'import numpy as np\n'), ((3595, 3630), 'numpy.maximum', 'np.maximum', (['mesh_numbers', '[1, 1, 1]'], {}), '(mesh_numbers, [1, 1, 1])\n', (3605, 3630), True, 'import numpy as np\n'), ((4596, 4629), 'numpy.zeros_l... |
#!/usr/bin/env python
# Distributed under the MIT License.
# See LICENSE.txt for details.
from spectre.Visualization.Render1D import (find_extrema_over_data_set,
render_single_time)
import unittest
import os
import numpy as np
import matplotlib as mpl
mpl.use('agg')
clas... | [
"unittest.main",
"os.remove",
"spectre.Visualization.Render1D.find_extrema_over_data_set",
"os.path.isfile",
"matplotlib.use",
"numpy.array",
"spectre.Visualization.Render1D.render_single_time"
] | [((299, 313), 'matplotlib.use', 'mpl.use', (['"""agg"""'], {}), "('agg')\n", (306, 313), True, 'import matplotlib as mpl\n'), ((1168, 1194), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (1181, 1194), False, 'import unittest\n'), ((423, 455), 'numpy.array', 'np.array', (['[1.1, 6.45, ... |
import os
import sys
import numpy as np
import flopy
import matplotlib.pyplot as plt
# --modify default matplotlib settings
updates = {
"font.family": ["Univers 57 Condensed", "Arial"],
"mathtext.default": "regular",
"pdf.compression": 0,
"pdf.fonttype": 42,
"legend.fontsize": 7,
"axes.label... | [
"os.remove",
"flopy.modflow.ModflowOc",
"numpy.empty",
"numpy.ones",
"matplotlib.pyplot.figure",
"flopy.modflow.ModflowBcf",
"numpy.arange",
"flopy.modflow.ModflowSwi2",
"os.path.join",
"flopy.utils.CellBudgetFile",
"flopy.modflow.ModflowPcg",
"numpy.copy",
"flopy.modflow.ModflowGhb",
"mat... | [((384, 412), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (['updates'], {}), '(updates)\n', (403, 412), True, 'import matplotlib.pyplot as plt\n'), ((470, 491), 'numpy.empty', 'np.empty', (['ndim', 'float'], {}), '(ndim, float)\n', (478, 491), True, 'import numpy as np\n'), ((526, 546), 'numpy.empty', '... |
#- Python 3 source code
#- qq-wait-times-dormant-bin5.py ~~
#
# This program creates a Quantile-Quantile plot (or more accurately here, a
# Percentile-Percentile plot) of the distributions for the wait times of
# bin 5 jobs submitted by non-CSC108 projects during the two weeks prior to
# the "dormant" period... | [
"matplotlib.pyplot.plot",
"os.path.basename",
"os.getcwd",
"os.path.isdir",
"numpy.percentile",
"matplotlib.pyplot.figure",
"sqlite3.connect",
"os.path.splitext",
"os.path.join"
] | [((2761, 2804), 'numpy.percentile', 'numpy.percentile', (['with_csc108', 'marks_to_use'], {}), '(with_csc108, marks_to_use)\n', (2777, 2804), False, 'import numpy\n'), ((2820, 2861), 'numpy.percentile', 'numpy.percentile', (['wo_csc108', 'marks_to_use'], {}), '(wo_csc108, marks_to_use)\n', (2836, 2861), False, 'import ... |
import os
import ctypes
import numpy
from algopy.base_type import Ring
_ctps = numpy.ctypeslib.load_library('libctps', os.path.dirname(__file__))
double_ptr = ctypes.POINTER(ctypes.c_double)
argtypes1 = [ctypes.c_int, double_ptr, double_ptr, double_ptr]
_ctps.ctps_add.argtypes = argtypes1
_ctps.ctps_sub.argtypes =... | [
"os.path.dirname",
"numpy.zeros_like",
"numpy.array",
"ctypes.POINTER"
] | [((163, 194), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_double'], {}), '(ctypes.c_double)\n', (177, 194), False, 'import ctypes\n'), ((121, 146), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (136, 146), False, 'import os\n'), ((721, 738), 'numpy.array', 'numpy.array', (['data'], {}), ... |
from __future__ import print_function
import argparse
import os
import h5py
import numpy as np
import sys
from molecules.model import MoleculeVAE
from molecules.utils import one_hot_array, one_hot_index, from_one_hot_array, \
decode_smiles_from_indexes, load_dataset
from pylab import figure, axes, scatter, title... | [
"h5py.File",
"argparse.ArgumentParser",
"molecules.model.MoleculeVAE",
"numpy.savetxt",
"molecules.utils.decode_smiles_from_indexes",
"os.path.isfile",
"molecules.utils.load_dataset"
] | [((455, 523), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Molecular autoencoder network"""'}), "(description='Molecular autoencoder network')\n", (478, 523), False, 'import argparse\n'), ((1186, 1210), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (1195... |
import os
import numpy as np
from libyana.meshutils import meshio
def load_objects(obj_root):
object_names = [obj_name for obj_name in os.listdir(obj_root) if ".tgz" not in obj_name]
objects = {}
for obj_name in object_names:
# obj_path = os.path.join(obj_root, obj_name, "textured_simple_2000.obj... | [
"numpy.stack",
"numpy.load",
"numpy.array",
"libyana.meshutils.meshio.fast_load_obj",
"os.path.join",
"os.listdir"
] | [((679, 702), 'os.listdir', 'os.listdir', (['corner_root'], {}), '(corner_root)\n', (689, 702), False, 'import os\n'), ((2559, 2638), 'numpy.array', 'np.array', (['[[1.0, 0.0, 0.0], [0, -1.0, 0.0], [0.0, 0.0, -1.0]]'], {'dtype': 'np.float32'}), '([[1.0, 0.0, 0.0], [0, -1.0, 0.0], [0.0, 0.0, -1.0]], dtype=np.float32)\n'... |
"""
Create a flat plate of length 1.0 with aspect ratio 2.0 and a 40-degree
inclination.
The plate is discretized with spacing 0.04 in the x-y plane and with spacing
0.04 along the z-direction.
"""
import math
import pathlib
import numpy
# Flat-plate's parameters.
L = 1.0 # chord length
AR = 2.0 # aspect ratio
xc,... | [
"numpy.radians",
"math.ceil",
"numpy.ones",
"pathlib.Path",
"numpy.linspace"
] | [((544, 561), 'math.ceil', 'math.ceil', (['(L / ds)'], {}), '(L / ds)\n', (553, 561), False, 'import math\n'), ((566, 615), 'numpy.linspace', 'numpy.linspace', (['(xc - L / 2)', '(xc + L / 2)'], {'num': '(n + 1)'}), '(xc - L / 2, xc + L / 2, num=n + 1)\n', (580, 615), False, 'import numpy\n'), ((711, 733), 'math.ceil',... |
"""well_utils.py: functions used by the classes in resqpy.well"""
version = '10th November 2021'
# Nexus is a registered trademark of the Halliburton Company
# RMS and ROXAR are registered trademarks of Roxar Software Solutions AS, an Emerson company
import logging
log = logging.getLogger(__name__)
import numpy as... | [
"resqpy.olio.xml_et.citation_title_for_node",
"numpy.zeros",
"resqpy.olio.keyword_files.skip_blank_lines_and_comments",
"numpy.isnan",
"resqpy.olio.grid_functions.triangles_for_cell_faces",
"resqpy.olio.keyword_files.blank_line",
"numpy.mean",
"numpy.array",
"resqpy.olio.xml_et.node_type",
"resqpy... | [((276, 303), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (293, 303), False, 'import logging\n'), ((1616, 1627), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (1624, 1627), True, 'import numpy as np\n'), ((2738, 2765), 'numpy.mean', 'np.mean', (['cp'], {'axis': '(0, 1, 2)'}), '(cp... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import sys
import time
from math import ceil
from typing import List, Tuple
from unittest.mock import patch... | [
"ax.storage.sqa_store.encoder.Encoder",
"ax.core.metric.Metric",
"ax.metrics.branin.branin",
"ax.storage.sqa_store.decoder.Decoder",
"ax.core.parameter.ChoiceParameter",
"ax.utils.common.typeutils.not_none",
"ax.service.ax_client.AxClient.from_json_snapshot",
"ax.core.parameter.FixedParameter",
"num... | [((4809, 4931), 'unittest.mock.patch', 'patch', (['"""ax.modelbridge.random.RandomModelBridge.feature_importances"""'], {'autospec': '(True)', 'return_value': "{'x': 0.9, 'y': 1.1}"}), "('ax.modelbridge.random.RandomModelBridge.feature_importances',\n autospec=True, return_value={'x': 0.9, 'y': 1.1})\n", (4814, 4931... |
"""
main.py
@author: ksuchak1990
Python script for running experiments with the enkf.
"""
# Imports
import numpy as np
from experiment_utils import Modeller, Visualiser
np.random.seed(42)
# Functions
# def testing():
# """
# Testing function
# Overall function that wraps around what we want to run at an... | [
"experiment_utils.Modeller.run_model_collisions",
"numpy.random.seed"
] | [((171, 189), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (185, 189), True, 'import numpy as np\n'), ((1036, 1067), 'experiment_utils.Modeller.run_model_collisions', 'Modeller.run_model_collisions', ([], {}), '()\n', (1065, 1067), False, 'from experiment_utils import Modeller, Visualiser\n')] |
from base.base_train import BaseTrain
from tqdm import tqdm
import numpy as np
class ExampleTrainer(BaseTrain):
def __init__(self, sess, model, data, config,logger):
super(ExampleTrainer, self).__init__(sess, model, data, config,logger)
def train_epoch(self):
loop = tqdm(range(self.config.num... | [
"numpy.mean"
] | [((518, 533), 'numpy.mean', 'np.mean', (['losses'], {}), '(losses)\n', (525, 533), True, 'import numpy as np\n'), ((568, 581), 'numpy.mean', 'np.mean', (['accs'], {}), '(accs)\n', (575, 581), True, 'import numpy as np\n')] |
#! /usr/bin/env python
"""Author: <NAME>
Helper functions to prepare and process data
Email: <EMAIL>
"""
from __future__ import division
import glob
import math
import errno
import os
import shutil
import numpy as np
import multiprocessing as mp
import insar.sario
from insar.log import get_log, log_runtime
logger = g... | [
"numpy.abs",
"numpy.iscomplexobj",
"os.makedirs",
"numpy.sum",
"numpy.ceil",
"os.path.isdir",
"math.floor",
"os.path.isfile",
"insar.log.get_log",
"shutil.move",
"multiprocessing.Pool",
"glob.glob",
"numpy.log10",
"os.path.split",
"os.path.join",
"os.access",
"numpy.vstack",
"multi... | [((319, 328), 'insar.log.get_log', 'get_log', ([], {}), '()\n', (326, 328), False, 'from insar.log import get_log, log_runtime\n'), ((830, 852), 'os.path.split', 'os.path.split', (['program'], {}), '(program)\n', (843, 852), False, 'import os\n'), ((2022, 2044), 'numpy.iscomplexobj', 'np.iscomplexobj', (['image'], {}),... |
#!/usr/bin/env python
from constants import *
import numpy as np
def regrid(self):
'''
Called in both firn_density_spin and firn_density_nospin
There are 3 subgrids in the regrid module. Grid 1 is the high resolution grid near the surface. Grid 2 is the lower resolution grid at greater depths; a user-defi... | [
"numpy.sum",
"numpy.ones",
"numpy.append",
"numpy.cumsum",
"numpy.mean",
"numpy.array",
"numpy.diff",
"numpy.where",
"numpy.concatenate"
] | [((1191, 1214), 'numpy.sum', 'np.sum', (['self.mass[ind1]'], {}), '(self.mass[ind1])\n', (1197, 1214), True, 'import numpy as np\n'), ((1255, 1294), 'numpy.sum', 'np.sum', (['(self.Tz[ind1] * self.mass[ind1])'], {}), '(self.Tz[ind1] * self.mass[ind1])\n', (1261, 1294), True, 'import numpy as np\n'), ((1307, 1333), 'num... |
"""
Misc Utility functions
"""
import os
import logging
import datetime
import numpy as np
from collections import OrderedDict
def recursive_glob(rootdir=".", suffix=""):
"""Performs recursive glob with given suffix and rootdir
:param rootdir is the root directory
:param suffix is the suffix to b... | [
"logging.FileHandler",
"os.walk",
"numpy.zeros",
"datetime.datetime.now",
"logging.Formatter",
"collections.OrderedDict",
"os.path.join",
"logging.getLogger"
] | [((838, 882), 'numpy.zeros', 'np.zeros', (['input_image.size'], {'dtype': 'np.float32'}), '(input_image.size, dtype=np.float32)\n', (846, 882), True, 'import numpy as np\n'), ((1295, 1308), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1306, 1308), False, 'from collections import OrderedDict\n'), ((1484,... |
import numpy as np
import os
import torch
import subprocess
import matplotlib.pyplot as plt
import time
import pickle
import re
def save_pickle(features, labels, path, name):
features, labels = np.array(features).astype(np.float32), np.array(labels).astype(np.float32)
x = time.asctime()
filenam... | [
"torch.cuda.synchronize",
"matplotlib.pyplot.savefig",
"pickle.dump",
"matplotlib.pyplot.clf",
"numpy.isnan",
"matplotlib.pyplot.figure",
"torch.no_grad",
"os.path.join",
"time.asctime",
"numpy.histogram2d",
"matplotlib.pyplot.imshow",
"os.path.dirname",
"torch.load",
"matplotlib.pyplot.cl... | [((293, 307), 'time.asctime', 'time.asctime', ([], {}), '()\n', (305, 307), False, 'import time\n'), ((384, 412), 'os.path.join', 'os.path.join', (['path', 'filename'], {}), '(path, filename)\n', (396, 412), False, 'import os\n'), ((593, 624), 'numpy.histogram2d', 'np.histogram2d', (['x1', 'x2'], {'bins': '(50)'}), '(x... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hilbert
from src import XMitt
plt.ion()
exper_file = 'src/experiments/canope_setup.toml'
xmitt = XMitt(exper_file, 1.)
p_sca = []
#for i in range(3):
xmitt.generate_realization()
xmitt.surface_realization()
p_sca.append(xmitt.ping_surface()... | [
"src.XMitt",
"matplotlib.pyplot.ion",
"numpy.array",
"scipy.signal.hilbert",
"matplotlib.pyplot.subplots"
] | [((108, 117), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (115, 117), True, 'import matplotlib.pyplot as plt\n'), ((176, 198), 'src.XMitt', 'XMitt', (['exper_file', '(1.0)'], {}), '(exper_file, 1.0)\n', (181, 198), False, 'from src import XMitt\n'), ((331, 346), 'numpy.array', 'np.array', (['p_sca'], {}), '(p... |
#!/usr/bin/env python3
import argparse
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='calculation radius of gyration using MDAnalysis')
## args
parser.add_argument('-i', '--input', default='traj.trr', nargs='?',
help='input trajectory file')
parser.... | [
"sys.path.append",
"hjung.time.init",
"numpy.save",
"argparse.ArgumentParser",
"hjung.time.end_print",
"numpy.std",
"hjung.time.process_init",
"numpy.zeros",
"MDAnalysis.Universe",
"hjung.time.process_print",
"numpy.mean"
] | [((52, 204), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'description': '"""calculation radius of gyration using MDAnalysis"""'}), "(formatter_class=argparse.\n ArgumentDefaultsHelpFormatter, description=\n 'calculation radius of gyratio... |
"""
Various tensorflow utilities
"""
import numpy as np
import tensorflow as tf
from tensorflow.contrib.framework.python.ops import add_arg_scope
from tensorflow.python.ops import variables
import functools
def passthrough(obj, value): return value
try:
variables.Variable._build_initializer_expr=passt... | [
"tensorflow.reduce_sum",
"tensorflow.matrix_band_part",
"tensorflow.square",
"tensorflow.nn.tanh",
"tensorflow.maximum",
"tensorflow.reshape",
"tensorflow.nn.l2_normalize",
"tensorflow.get_variable_scope",
"tensorflow.matmul",
"tensorflow.Variable",
"tensorflow.nn.conv2d",
"tensorflow.reduce_m... | [((21746, 21777), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(32)'}), '(maxsize=32)\n', (21765, 21777), False, 'import functools\n'), ((797, 819), 'tensorflow.reduce_max', 'tf.reduce_max', (['x', 'axis'], {}), '(x, axis)\n', (810, 819), True, 'import tensorflow as tf\n'), ((830, 868), 'tensorflow.r... |
"""
NCL_proj_3.py
=============
This script illustrates the following concepts:
- Drawing filled contours over an orthographic map
- Changing the center latitude and longitude for an orthographic projection
- Turning off map fill
See following URLs to see the reproduced NCL plot & script:
- Original NCL ... | [
"matplotlib.pyplot.show",
"geocat.viz.util.set_titles_and_labels",
"geocat.viz.util.xr_add_cyclic_longitudes",
"geocat.datafiles.get",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"numpy.arange",
"cartopy.crs.PlateCarree",
"cartopy.crs.Orthographic"
] | [((1184, 1225), 'geocat.viz.util.xr_add_cyclic_longitudes', 'gvutil.xr_add_cyclic_longitudes', (['t', '"""lon"""'], {}), "(t, 'lon')\n", (1215, 1225), True, 'from geocat.viz import util as gvutil\n'), ((1380, 1408), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 10)'}), '(figsize=(10, 10))\n', (1390, ... |
from __future__ import print_function
import os
import re
from glob import glob
import numpy as np
import tensorflow as tf
from keras.utils.data_utils import get_file
def get_filename(key):
"""Rename tensor name to the corresponding Keras layer weight name.
# Arguments
key: tensor name in TF (determi... | [
"numpy.save",
"os.makedirs",
"os.path.exists",
"keras.utils.data_utils.get_file",
"tensorflow.train.NewCheckpointReader",
"os.path.join"
] | [((2059, 2181), 'keras.utils.data_utils.get_file', 'get_file', (['"""deeplabv3_pascal_trainval_2018_01_04.tar.gz"""', 'CKPT_URL'], {'extract': '(True)', 'cache_subdir': '""""""', 'cache_dir': 'MODEL_DIR'}), "('deeplabv3_pascal_trainval_2018_01_04.tar.gz', CKPT_URL, extract=\n True, cache_subdir='', cache_dir=MODEL_D... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.