code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import os
import tempfile
import numpy as np
import numpy.testing as npt
import pandas as pd
import h5py
import pytest
from paat import io, features
def test_calculate_actigraph_counts(load_gt3x_file, test_root_path):
data, sample_freq = load_gt3x_file
# Test 1sec count processing
counts_1s = features.... | [
"numpy.testing.assert_almost_equal",
"paat.features.calculate_brond_counts",
"os.path.join",
"paat.features.calculate_actigraph_counts"
] | [((311, 371), 'paat.features.calculate_actigraph_counts', 'features.calculate_actigraph_counts', (['data', 'sample_freq', '"""1s"""'], {}), "(data, sample_freq, '1s')\n", (346, 371), False, 'from paat import io, features\n'), ((552, 646), 'numpy.testing.assert_almost_equal', 'npt.assert_almost_equal', (["counts_1s[['X'... |
# -*- coding: utf-8 -*-
"""
field_filtering.py
/field_filtering/ module in the /egp/ package.
Filter Fields using convolution kernels.
Created by <NAME> <NAME>.
Copyright (c) 2012-2018. All rights reserved.
"""
import numpy as np
import numbers
import egp.basic_types
import egp.toolbox
def gaussian_3d_kernel(gridsi... | [
"numpy.nan_to_num",
"numpy.sin",
"numpy.exp",
"numpy.cos",
"numpy.sqrt"
] | [((4481, 4511), 'numpy.exp', 'np.exp', (['(-k * k * r_g * r_g / 2)'], {}), '(-k * k * r_g * r_g / 2)\n', (4487, 4511), True, 'import numpy as np\n'), ((4622, 4643), 'numpy.nan_to_num', 'np.nan_to_num', (['kernel'], {}), '(kernel)\n', (4635, 4643), True, 'import numpy as np\n'), ((1149, 1193), 'numpy.exp', 'np.exp', (['... |
import sys
import math
import pandas as pd
import numpy as np
def calculate_initial_compass_bearing(pointA, pointB):
if (type(pointA) != tuple) or (type(pointB) != tuple):
raise TypeError("Only tuples are supported as arguments")
lat1 = math.radians(pointA[0])
lat2 = math.radians(pointB[0])... | [
"math.sqrt",
"math.atan2",
"math.radians",
"pandas.read_csv",
"math.sin",
"math.cos",
"math.degrees",
"numpy.delete",
"numpy.vstack"
] | [((261, 284), 'math.radians', 'math.radians', (['pointA[0]'], {}), '(pointA[0])\n', (273, 284), False, 'import math\n'), ((297, 320), 'math.radians', 'math.radians', (['pointB[0]'], {}), '(pointB[0])\n', (309, 320), False, 'import math\n'), ((337, 372), 'math.radians', 'math.radians', (['(pointB[1] - pointA[1])'], {}),... |
from collections import deque
import gym
import numpy as np
from gym import spaces
from PIL import Image
class NoopResetEnv(gym.Wrapper):
def __init__(self, env, noop_max=30):
"""Sample initial states by taking random number of no-ops on reset.
No-op is assumed to be action 0.
"""
... | [
"gym.Wrapper.__init__",
"numpy.stack",
"numpy.concatenate",
"numpy.isscalar",
"numpy.asarray",
"gym.ObservationWrapper.__init__",
"numpy.shape",
"numpy.array",
"gym.spaces.Box",
"numpy.sign",
"PIL.Image.fromarray",
"collections.deque"
] | [((321, 352), 'gym.Wrapper.__init__', 'gym.Wrapper.__init__', (['self', 'env'], {}), '(self, env)\n', (341, 352), False, 'import gym\n'), ((1184, 1215), 'gym.Wrapper.__init__', 'gym.Wrapper.__init__', (['self', 'env'], {}), '(self, env)\n', (1204, 1215), False, 'import gym\n'), ((1831, 1862), 'gym.Wrapper.__init__', 'g... |
import os
from glob import glob
from sklearn.model_selection import train_test_split
import random
import numpy as np
# set seed, make result reporducable
SEED = 1234
random.seed(SEED)
np.random.seed(SEED)
def get_label(name):
labels = {'Joy': 1, 'Surprise': 2, 'Anger': 3, 'Sadness': 4, 'Fear': 5, 'Disgust': 6, ... | [
"numpy.random.seed",
"sklearn.model_selection.train_test_split",
"random.seed",
"os.path.normpath",
"glob.glob",
"os.path.join"
] | [((168, 185), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (179, 185), False, 'import random\n'), ((186, 206), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (200, 206), True, 'import numpy as np\n'), ((570, 596), 'glob.glob', 'glob', (["(frame_root + '/*/*/')"], {}), "(frame_root + '/*... |
import random
from argparse import ArgumentParser
from collections import deque
import gym
from gym.wrappers import RescaleAction
import numpy as np
import torch
from torch.utils.tensorboard import SummaryWriter
import yaml
from agents import TD3_Agent, SAC_Agent, TDS_Agent, MEPG_Agent
from utils import MeanStdevFilt... | [
"utils.make_checkpoint",
"agents.MEPG_Agent",
"yaml.load",
"numpy.random.seed",
"argparse.ArgumentParser",
"gym.make",
"utils.Transition",
"torch.manual_seed",
"agents.TDS_Agent",
"utils.make_gif",
"gym.wrappers.RescaleAction",
"numpy.array",
"random.seed",
"torch.utils.tensorboard.Summary... | [((1346, 1363), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1357, 1363), False, 'import random\n'), ((1368, 1391), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (1385, 1391), False, 'import torch\n'), ((1396, 1416), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n'... |
import cmsisdsp.fixedpoint as f
import numpy as np
F64 = 64
F32 = 32
F16 = 16
Q31 = 31
Q15 = 15
Q7 = 7
class UnknownCMSISDSPDataType(Exception):
pass
def convert(samples,format):
if format==Q31:
return(f.toQ31(np.array(samples)))
if format==Q15:
return(f.toQ15(np.array(samples)))
if f... | [
"numpy.array"
] | [((230, 247), 'numpy.array', 'np.array', (['samples'], {}), '(samples)\n', (238, 247), True, 'import numpy as np\n'), ((292, 309), 'numpy.array', 'np.array', (['samples'], {}), '(samples)\n', (300, 309), True, 'import numpy as np\n'), ((352, 369), 'numpy.array', 'np.array', (['samples'], {}), '(samples)\n', (360, 369),... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""tomoprocer
morph: legacy data support
convert tiff|binary to HDF5 archive for subsequent analysis
prep: preprocessing tomography data
----------------
|avaiable modes|
-... | [
"tomoproc.prep.detection.detect_rotation_center",
"docopt.docopt",
"tomoproc.prep.correction.correct_detector_tilt",
"concurrent.futures.ProcessPoolExecutor",
"numpy.isnan",
"os.path.join",
"multiprocessing.cpu_count",
"tomoproc.util.file.load_yaml",
"tomoproc.prep.correction.correct_detector_drifti... | [((2448, 2457), 'graphviz.Digraph', 'Digraph', ([], {}), '()\n', (2455, 2457), False, 'from graphviz import Digraph\n'), ((2814, 2907), 'os.path.join', 'join', (["cfg['output']['filepath']", 'f"""{cfg[\'output\'][\'fileprefix\']}.{cfg[\'output\'][\'type\']}"""'], {}), '(cfg[\'output\'][\'filepath\'],\n f"{cfg[\'outp... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright 2019/12/18 MitsutaYuki
#
# Distributed under terms of the MIT license.
import os, glob, shutil, sys, re
import copy
import subprocess as sp
import numpy as np
import functions
from mpi4py import MPI
def main():
"""
"""
co... | [
"numpy.average",
"copy.copy",
"os.path.exists",
"numpy.linalg.norm",
"numpy.array",
"glob.glob",
"numpy.dot",
"numpy.sqrt"
] | [((1567, 1612), 'glob.glob', 'glob.glob', (['"""../cpu_7D400nsTRJ*/run*/COLVAR.*"""'], {}), "('../cpu_7D400nsTRJ*/run*/COLVAR.*')\n", (1576, 1612), False, 'import os, glob, shutil, sys, re\n'), ((665, 698), 'numpy.array', 'np.array', (['line[1:-1]'], {'dtype': 'float'}), '(line[1:-1], dtype=float)\n', (673, 698), True,... |
#!/usr/bin/env python3
""" Adjust converter for faceswap.py
Based on the original https://www.reddit.com/r/deepfakes/ code sample
Adjust code made by https://github.com/yangchen8710 """
import cv2
import numpy as np
from lib.utils import add_alpha_channel
class Convert():
""" Adjust Converter """
d... | [
"cv2.GaussianBlur",
"numpy.zeros_like",
"numpy.zeros",
"numpy.expand_dims",
"lib.utils.add_alpha_channel",
"numpy.clip",
"cv2.warpAffine",
"cv2.resize"
] | [((1175, 1243), 'cv2.resize', 'cv2.resize', (['process_face', '(size, size)'], {'interpolation': 'cv2.INTER_AREA'}), '(process_face, (size, size), interpolation=cv2.INTER_AREA)\n', (1185, 1243), False, 'import cv2\n'), ((1335, 1366), 'numpy.expand_dims', 'np.expand_dims', (['process_face', '(0)'], {}), '(process_face, ... |
"""
Utility for logging blobs detected in an image
(Specifically OpenCV blob detector keypoints)
"""
import cv2
import numpy as np
def plot_blobs(keypoints, image):
"""
Show opencv blob detector keypoints on image.
- Use box_plotter instead.
Parameters
----------
keypoints: list[Keypoint]
... | [
"cv2.waitKey",
"cv2.imshow",
"numpy.array"
] | [((1277, 1315), 'cv2.imshow', 'cv2.imshow', (['"""Blobs"""', 'im_with_keypoints'], {}), "('Blobs', im_with_keypoints)\n", (1287, 1315), False, 'import cv2\n'), ((1320, 1334), 'cv2.waitKey', 'cv2.waitKey', (['(1)'], {}), '(1)\n', (1331, 1334), False, 'import cv2\n'), ((871, 883), 'numpy.array', 'np.array', (['[]'], {}),... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
import graphviz
from sklearn import tree
import itertools
from sklearn.metrics import classification_report, confusion_matrix
####################... | [
"matplotlib.pyplot.title",
"numpy.mean",
"matplotlib.pyplot.tight_layout",
"numpy.set_printoptions",
"numpy.std",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.colorbar",
"graphviz.Source",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.show",
"matplotlib.pyplot.le... | [((658, 674), 'numpy.zeros', 'np.zeros', (['(Ks - 1)'], {}), '(Ks - 1)\n', (666, 674), True, 'import numpy as np\n'), ((691, 707), 'numpy.zeros', 'np.zeros', (['(Ks - 1)'], {}), '(Ks - 1)\n', (699, 707), True, 'import numpy as np\n'), ((1451, 1488), 'matplotlib.pyplot.legend', 'plt.legend', (["('Accuracy ', '+/- 3std')... |
import h5py as h5
from ccl_marker_stack import ccl_marker_stack, imshow_components
from stopwatch import sw_timer
import numpy as np
import cv2
from ccl_marker_stack import ccl_marker_stack
import matplotlib as mpl
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import ca... | [
"h5py.File",
"matplotlib.pyplot.show",
"numpy.amin",
"stopwatch.sw_timer.report_all",
"cv2.threshold",
"matplotlib.pyplot.subplots",
"numpy.amax",
"ccl_marker_stack.ccl_marker_stack",
"numpy.where",
"numpy.array",
"ccl_marker_stack.imshow_components",
"stopwatch.sw_timer.stamp",
"numpy.nanma... | [((594, 636), 'ccl_marker_stack.ccl_marker_stack', 'ccl_marker_stack', ([], {'global_latlon_grid': '(False)'}), '(global_latlon_grid=False)\n', (610, 636), False, 'from ccl_marker_stack import ccl_marker_stack\n'), ((653, 693), 'stopwatch.sw_timer.stamp', 'sw_timer.stamp', (['"""starting datafile loop"""'], {}), "('sta... |
# script file for thermal solver
import matplotlib.pyplot as plt #to biblioteka pozwalajaca nam wykreslać wykresy
import numpy as np
from thermalModelLibrary import tntObjects as tntO
from thermalModelLibrary import tntSolver as tntS
# Defining some materials
Cu = tntO.Material(alpha=0)
alteredCu = tntO.Material(the... | [
"matplotlib.pyplot.show",
"thermalModelLibrary.tntObjects.Material",
"thermalModelLibrary.tntObjects.pipe",
"matplotlib.pyplot.figure",
"numpy.array",
"thermalModelLibrary.tntObjects.shape",
"thermalModelLibrary.tntSolver.Solver",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib... | [((268, 290), 'thermalModelLibrary.tntObjects.Material', 'tntO.Material', ([], {'alpha': '(0)'}), '(alpha=0)\n', (281, 290), True, 'from thermalModelLibrary import tntObjects as tntO\n'), ((303, 347), 'thermalModelLibrary.tntObjects.Material', 'tntO.Material', ([], {'thermalConductivity': '(1000000.0)'}), '(thermalCond... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# and the Talkowski Laboratory
# Distributed under terms of the MIT license.
"""
Compute Bayes factors and false discovery probabilties given assumed effect sizes
"""
from os import path
import numpy as np
import pandas as pd
from... | [
"scipy.stats.norm.cdf",
"pandas.read_csv",
"argparse.ArgumentParser",
"numpy.sqrt"
] | [((1583, 1609), 'scipy.stats.norm.cdf', 'norm.cdf', (['lnOR', 'theta1', 'se'], {}), '(lnOR, theta1, se)\n', (1591, 1609), False, 'from scipy.stats import norm\n'), ((2881, 2984), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.RawDescriptionHelpFormatte... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 16 11:42:01 2021
@author: altair
"""
import pandas as pd
df = pd.read_csv('Reviews.csv')
#df = df.applymap(str)
print(df.head())
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
df.hist('Score')
plt.xlabel('Score')
plt.yla... | [
"matplotlib.pyplot.title",
"sklearn.metrics.confusion_matrix",
"sklearn.feature_extraction.text.CountVectorizer",
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.imshow",
"nltk.corpus.stopwords.update",
"numpy.asarray",
"wordcloud.WordCloud",
"matplotlib.pyplot.axis",
"sklearn.me... | [((134, 160), 'pandas.read_csv', 'pd.read_csv', (['"""Reviews.csv"""'], {}), "('Reviews.csv')\n", (145, 160), True, 'import pandas as pd\n'), ((293, 312), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Score"""'], {}), "('Score')\n", (303, 312), True, 'import matplotlib.pyplot as plt\n'), ((313, 332), 'matplotlib.pypl... |
import numpy as np
import matplotlib.pyplot as plt
from apogee.tools import toApStarGrid,pix2wv
from matplotlib.ticker import MultipleLocator, AutoMinorLocator
def get_alt_colors(n,cmap='plasma',maxval=0.7):
"""
Find n alternating colours from a colour map.
n: Number of colours to get
cmap: C... | [
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.xlim",
"matplotlib.ticker.MultipleLocator",
"apogee.tools.toApStarGrid",
"matplotlib.pyplot.get_cmap",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.twinx",
"numpy.empty",
"matplotlib.pyplot.yticks",
"numpy.zeros",
"ma... | [((570, 586), 'numpy.empty', 'np.empty', (['(n, 4)'], {}), '((n, 4))\n', (578, 586), True, 'import numpy as np\n'), ((1475, 1500), 'numpy.zeros', 'np.zeros', (['n'], {'dtype': '"""S500"""'}), "(n, dtype='S500')\n", (1483, 1500), True, 'import numpy as np\n'), ((1516, 1527), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\... |
from __future__ import annotations
import csv
import numpy as np
from typing import Dict, TextIO, Optional, Iterator
class Building:
def __init__(
self,
bldg_id: int,
center_x: float,
center_y: float,
area: float,
bbox_east: float,
bbox_west: float,
... | [
"csv.reader",
"numpy.array"
] | [((452, 482), 'numpy.array', 'np.array', (['[center_x, center_y]'], {}), '([center_x, center_y])\n', (460, 482), True, 'import numpy as np\n'), ((676, 790), 'numpy.array', 'np.array', (['[[bbox_east, bbox_north], [bbox_west, bbox_north], [bbox_west, bbox_south],\n [bbox_east, bbox_south]]'], {}), '([[bbox_east, bbox... |
import numpy as np
from scipy.stats import skewnorm, truncnorm
from random import choice, randint
import random
from json_logic import jsonLogic
import libpysal.weights as weights
from infection_functions.infect_init import Infectioninit
class Infection(Infectioninit):
"""
Infection object defines the nature... | [
"infection_functions.infect_init.Infectioninit",
"random.choice",
"random.random",
"numpy.timedelta64",
"numpy.array",
"json_logic.jsonLogic",
"scipy.stats.truncnorm.rvs",
"libpysal.weights.distance.DistanceBand",
"numpy.prod",
"numpy.in1d"
] | [((2044, 2137), 'libpysal.weights.distance.DistanceBand', 'weights.distance.DistanceBand', (['current_points'], {'threshold': 'infection_distance', 'binary': '(False)'}), '(current_points, threshold=infection_distance,\n binary=False)\n', (2073, 2137), True, 'import libpysal.weights as weights\n'), ((4329, 4414), 's... |
# Computations
import pandas as pd
import numpy as np
from factor_analyzer import FactorAnalyzer
from factor_analyzer.utils import impute_values, corr
from typing import List, Tuple, Union, Mapping, Any
POSSIBLE_IMPUTATIONS = ['mean', 'median', 'drop']
# This options are to alling with factor_analyzer package
POSSIBLE... | [
"pandas.DataFrame",
"numpy.diag",
"numpy.abs",
"factor_analyzer.FactorAnalyzer",
"numpy.eye",
"factor_analyzer.utils.impute_values",
"pandas.merge",
"numpy.zeros",
"numpy.isnan",
"factor_analyzer.utils.corr",
"numpy.dot",
"doctest.testmod"
] | [((12766, 12795), 'doctest.testmod', 'doctest.testmod', ([], {'verbose': '(True)'}), '(verbose=True)\n', (12781, 12795), False, 'import doctest\n'), ((8928, 9021), 'factor_analyzer.FactorAnalyzer', 'FactorAnalyzer', ([], {'rotation': 'self.rotation_fa_f', 'method': 'self.method_fa_f', 'is_corr_matrix': '(True)'}), '(ro... |
"""
"""
# Import Libraries
import os
import sys
import argparse
import numpy as np
import matplotlib
import configparser
matplotlib.use('TkAgg')
from matplotlib import pyplot as plt
path = os.path.abspath('../../')
if not path in sys.path:
sys.path.append(path)
import mmwsdr
def main():
"""
:return:
... | [
"sys.path.append",
"os.path.abspath",
"mmwsdr.sdr.Sivers60GHz",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.ylim",
"mmwsdr.utils.XYTable",
"numpy.fft.fft",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.xlabel",
"matplotlib.use",
"numpy.fft.fftshift",
"numpy.linspac... | [((124, 147), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (138, 147), False, 'import matplotlib\n'), ((193, 218), 'os.path.abspath', 'os.path.abspath', (['"""../../"""'], {}), "('../../')\n", (208, 218), False, 'import os\n'), ((248, 269), 'sys.path.append', 'sys.path.append', (['path'], {... |
"""
@author: KhanhLQ
Goals:
- Rotate an image theta radius and in different positions
"""
import cv2
import numpy as np
import math
from __utils__.general import show_image
def manual_rotate(image):
height = image.shape[0]
width = image.shape[1]
# clone origin image
out = image.copy()
theta... | [
"math.radians",
"math.sin",
"cv2.warpAffine",
"cv2.imread",
"__utils__.general.show_image",
"numpy.array",
"math.cos",
"cv2.getRotationMatrix2D"
] | [((1171, 1230), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['(rows / 2, cols / 2)', 'angle', 'scale'], {}), '((rows / 2, cols / 2), angle, scale)\n', (1194, 1230), False, 'import cv2\n'), ((1241, 1287), 'cv2.warpAffine', 'cv2.warpAffine', (['image', 'M', '(cols * 2, rows * 2)'], {}), '(image, M, (cols * 2, ... |
"""
A wxPython backend for matplotlib, based (very heavily) on
backend_template.py and backend_gtk.py
Author: <NAME> (<EMAIL>)
Derived from original copyright work by <NAME>
(<EMAIL>)
Copyright (C) <NAME> & <NAME>, 2003-4
License: This work is licensed under a PSF compatible license. A copy
should be includ... | [
"matplotlib.backend_bases.GraphicsContextBase.set_linewidth",
"wx.TheClipboard.Close",
"matplotlib.backend_bases.FigureCanvasBase.resize_event",
"weakref.WeakKeyDictionary",
"wx.NewId",
"wx.Panel.Destroy",
"matplotlib.backend_bases.FigureCanvasBase.key_press_event",
"matplotlib.backend_bases.FigureCan... | [((50732, 50742), 'wx.NewId', 'wx.NewId', ([], {}), '()\n', (50740, 50742), False, 'import wx\n'), ((50765, 50775), 'wx.NewId', 'wx.NewId', ([], {}), '()\n', (50773, 50775), False, 'import wx\n'), ((50798, 50808), 'wx.NewId', 'wx.NewId', ([], {}), '()\n', (50806, 50808), False, 'import wx\n'), ((50831, 50841), 'wx.NewI... |
"""gRPC specific class and methods for the MAPDL gRPC client """
import re
from warnings import warn
import shutil
import threading
import weakref
import io
import time
import os
import socket
from functools import wraps
import tempfile
import subprocess
import grpc
import numpy as np
from tqdm import tqdm
from grpc.... | [
"os.remove",
"ansys.grpc.mapdl.mapdl_pb2.VariableRequest",
"ansys.mapdl.core.misc.last_created",
"grpc.insecure_channel",
"ansys.grpc.mapdl.mapdl_pb2_grpc.MapdlServiceStub",
"os.path.isfile",
"ansys.mapdl.core.errors.MapdlExitedError",
"shutil.rmtree",
"os.path.join",
"ansys.mapdl.core.check_versi... | [((1096, 1120), 'ansys.grpc.mapdl.ansys_kernel_pb2.EmptyRequest', 'anskernel.EmptyRequest', ([], {}), '()\n', (1118, 1120), True, 'from ansys.grpc.mapdl import ansys_kernel_pb2 as anskernel\n'), ((1179, 1240), 'os.environ.get', 'os.environ.get', (['"""PYMAPDL_MAX_MESSAGE_LENGTH"""', '(256 * 1024 ** 2)'], {}), "('PYMAPD... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases()
import itertools
import numpy as np
def _sample_n_k(n, k):
""... | [
"future.standard_library.install_aliases",
"numpy.random.choice"
] | [((216, 250), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (248, 250), False, 'from future import standard_library\n'), ((507, 544), 'numpy.random.choice', 'np.random.choice', (['n', 'k'], {'replace': '(False)'}), '(n, k, replace=False)\n', (523, 544), True, 'import n... |
"""Tests for SignalViewer node"""
import pytest
from cognigraph.nodes.outputs import SignalViewer
from cognigraph.nodes.sources import FileSource
from cognigraph.nodes.tests.prepare_tests_data import info, data_path # noqa
import numpy as np
@pytest.fixture # noqa
def signal_viewer(info, data_path): # noqa
si... | [
"numpy.random.rand",
"cognigraph.nodes.sources.FileSource",
"cognigraph.nodes.outputs.SignalViewer"
] | [((334, 348), 'cognigraph.nodes.outputs.SignalViewer', 'SignalViewer', ([], {}), '()\n', (346, 348), False, 'from cognigraph.nodes.outputs import SignalViewer\n'), ((443, 464), 'numpy.random.rand', 'np.random.rand', (['N_SEN'], {}), '(N_SEN)\n', (457, 464), True, 'import numpy as np\n'), ((478, 499), 'cognigraph.nodes.... |
"""
https://valerolab.org/
PID control of an inverted pendulum actuated by strings.
"""
import pybullet as p
import time
import math as m
import numpy as np
import pybullet_data
import matplotlib.pyplot as plt
p.connect(p.GUI)
plane = p.loadURDF("plane.urdf")
"""____________________________________________________... | [
"matplotlib.pyplot.title",
"pybullet.setJointMotorControl2",
"pybullet.connect",
"pybullet.getQuaternionFromEuler",
"pybullet.setGravity",
"pybullet.createConstraint",
"numpy.append",
"matplotlib.pyplot.subplots",
"pybullet.getJointInfo",
"pybullet.getJointState",
"matplotlib.pyplot.show",
"ma... | [((214, 230), 'pybullet.connect', 'p.connect', (['p.GUI'], {}), '(p.GUI)\n', (223, 230), True, 'import pybullet as p\n'), ((239, 263), 'pybullet.loadURDF', 'p.loadURDF', (['"""plane.urdf"""'], {}), "('plane.urdf')\n", (249, 263), True, 'import pybullet as p\n'), ((773, 801), 'numpy.array', 'np.array', (['[[1000, -1000,... |
"""Network rerouting loss maps
"""
import os
import sys
from collections import OrderedDict
import numpy as np
import geopandas as gpd
import pandas as pd
import cartopy.crs as ccrs
import matplotlib as mpl
import cartopy.io.shapereader as shpreader
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches... | [
"matplotlib.pyplot.title",
"matplotlib.style.use",
"numpy.arange",
"matplotlib.patches.Patch",
"matplotlib.pyplot.tight_layout",
"os.path.join",
"matplotlib.pyplot.close",
"pandas.merge",
"matplotlib.pyplot.yticks",
"shapely.geometry.LineString",
"numpy.linspace",
"matplotlib.pyplot.subplots",... | [((387, 410), 'matplotlib.style.use', 'mpl.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (400, 410), True, 'import matplotlib as mpl\n'), ((757, 785), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(8, 4)'}), '(figsize=(8, 4))\n', (769, 785), True, 'import matplotlib.pyplot as plt\n'), ((2287, 23... |
#!/usr/bin/env python
"""
Author: <NAME>, <NAME>
"""
import pysal
import numpy as np
class Simulation(object):
def __init__(self, src_filename):
"create a bidirectional network with its total length and total number of links"
self.nw = pysal.open(src_filename, 'r')
self.G = {} # {edge... | [
"numpy.random.random_sample",
"pysal.open",
"pysal.cg.Chain",
"numpy.random.randint",
"numpy.digitize",
"pysal.cg.Point"
] | [((263, 292), 'pysal.open', 'pysal.open', (['src_filename', '"""r"""'], {}), "(src_filename, 'r')\n", (273, 292), False, 'import pysal\n'), ((2292, 2318), 'numpy.random.random_sample', 'np.random.random_sample', (['n'], {}), '(n)\n', (2315, 2318), True, 'import numpy as np\n'), ((2481, 2516), 'numpy.digitize', 'np.digi... |
# Copyright (c) 2021 PaddlePaddle 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 ap... | [
"unittest.main",
"paddle.fluid.Executor",
"paddle.linalg.matrix_rank",
"paddle.fluid.CUDAPlace",
"numpy.random.seed",
"paddle.fluid.data",
"paddle.fluid.default_main_program",
"paddle.enable_static",
"numpy.allclose",
"numpy.linalg.matrix_rank",
"numpy.random.random",
"paddle.disable_static",
... | [((961, 983), 'paddle.enable_static', 'paddle.enable_static', ([], {}), '()\n', (981, 983), False, 'import paddle\n'), ((996, 1016), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (1010, 1016), True, 'import numpy as np\n'), ((7252, 7267), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7265, 7... |
import numpy as np
import moderngl
from manimlib.constants import GREY_C
from manimlib.constants import YELLOW
from manimlib.constants import ORIGIN
from manimlib.mobject.types.point_cloud_mobject import PMobject
from manimlib.utils.iterables import resize_preserving_order
DEFAULT_DOT_RADIUS = 0.05
DEFAULT_GLOW_DOT_... | [
"numpy.full",
"numpy.zeros",
"numpy.array",
"manimlib.utils.iterables.resize_preserving_order"
] | [((1070, 1086), 'numpy.zeros', 'np.zeros', (['(1, 1)'], {}), '((1, 1))\n', (1078, 1086), True, 'import numpy as np\n'), ((2664, 2704), 'manimlib.utils.iterables.resize_preserving_order', 'resize_preserving_order', (['radii', 'n_points'], {}), '(radii, n_points)\n', (2687, 2704), False, 'from manimlib.utils.iterables im... |
from numpy_nn import Neuron
from numpy_nn.losses import MAE
from numpy_nn.optimizers import SGD
from numpy_nn.models import Model
import numpy as np
# we will try to implment 2x + 1
elems = [x for x in range(0,100)]
x = np.array(elems).reshape((-1,1))
y = np.array([x + 1 for x in elems]).reshape((-1,1))
model = Mode... | [
"numpy_nn.losses.MAE",
"numpy.array",
"numpy_nn.optimizers.SGD",
"numpy_nn.Neuron"
] | [((349, 354), 'numpy_nn.losses.MAE', 'MAE', ([], {}), '()\n', (352, 354), False, 'from numpy_nn.losses import MAE\n'), ((361, 374), 'numpy_nn.optimizers.SGD', 'SGD', ([], {'lr': '(9e-05)'}), '(lr=9e-05)\n', (364, 374), False, 'from numpy_nn.optimizers import SGD\n'), ((222, 237), 'numpy.array', 'np.array', (['elems'], ... |
# 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... | [
"fastestimator.util.util.to_list",
"tensorflow.distribute.get_strategy",
"fastestimator.backend.to_tensor.to_tensor",
"torch.optim.Adadelta",
"fastestimator.schedule.schedule.get_current_items",
"torch.cuda.device_count",
"gc.collect",
"torch.no_grad",
"os.path.join",
"numpy.pad",
"torch.cuda.am... | [((1696, 1745), 'typing.TypeVar', 'TypeVar', (['"""Model"""', 'tf.keras.Model', 'torch.nn.Module'], {}), "('Model', tf.keras.Model, torch.nn.Module)\n", (1703, 1745), False, 'from typing import Any, Callable, Dict, Iterable, List, MutableMapping, Optional, Set, Tuple, TypeVar, Union\n'), ((1750, 1762), 'typing.TypeVar'... |
# coding=utf-8
# Copyright 2020 The Tensor2Tensor 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 applicable... | [
"tensor2tensor.utils.decoding._interactive_input_tensor_to_features_dict",
"os.makedirs",
"os.path.join",
"tensor2tensor.bin.t2t_trainer.create_run_config",
"tensorflow.python.debug.DebugDumpDir",
"tensorflow.python.debug.WatchOptions",
"tensor2tensor.utils.decoding.decode_hparams",
"tensorflow.compat... | [((1495, 1630), 'tensorflow.python.debug.WatchOptions', 'tfdbg.WatchOptions', ([], {'node_name_regex_whitelist': '""".*grow_(finished|alive)_(topk_scores|topk_seq).*"""', 'debug_ops': "['DebugIdentity']"}), "(node_name_regex_whitelist=\n '.*grow_(finished|alive)_(topk_scores|topk_seq).*', debug_ops=[\n 'DebugIden... |
from typing import Dict, List # isort:skip
import gc
import logging
import os
from pathlib import Path
import shutil
import time
import numpy as np
from torch.utils.data import DataLoader
from catalyst import utils
from catalyst.utils.seed import set_global_seed
from catalyst.utils.tools.seeder import Seeder
from ... | [
"wandb.log",
"catalyst.utils.tools.seeder.Seeder",
"os.makedirs",
"catalyst.utils.get_utcnow_time",
"catalyst.utils.make_tuple",
"catalyst.utils.seed.set_global_seed",
"os.environ.get",
"time.time",
"pathlib.Path",
"gc.collect",
"wandb.init",
"numpy.iinfo",
"shutil.rmtree",
"catalyst.utils... | [((485, 512), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (502, 512), False, 'import logging\n'), ((517, 549), 'os.environ.get', 'os.environ.get', (['"""USE_WANDB"""', '"""1"""'], {}), "('USE_WANDB', '1')\n", (531, 549), False, 'import os\n'), ((1559, 1581), 'catalyst.utils.tools.seede... |
import shutil
import numpy as np
import iric
from . import util
def case_GridRead():
shutil.copy("data/case_init_hdf5.cgn", "data/case_grid.cgn")
fid = iric.cg_iRIC_Open("data/case_grid.cgn", iric.IRIC_MODE_MODIFY)
util.verify_log("cg_iRIC_Open() fid != 0", fid != 0)
isize, jsize = iric.cg_iRIC_Rea... | [
"iric.cg_iRIC_Read_Grid_Real_Cell",
"iric.cg_iRIC_Read_Grid2d_Close",
"iric.cg_iRIC_Read_Grid_FunctionalTime",
"iric.cg_iRIC_Read_Grid2d_CellArea",
"iric.cg_iRIC_Read_Grid_TriangleElementsSize",
"iric.cg_iRIC_Read_Grid2d_Interpolate",
"shutil.copy",
"iric.cg_iRIC_Read_Grid2d_Open",
"iric.cg_iRIC_Rea... | [((92, 152), 'shutil.copy', 'shutil.copy', (['"""data/case_init_hdf5.cgn"""', '"""data/case_grid.cgn"""'], {}), "('data/case_init_hdf5.cgn', 'data/case_grid.cgn')\n", (103, 152), False, 'import shutil\n'), ((164, 226), 'iric.cg_iRIC_Open', 'iric.cg_iRIC_Open', (['"""data/case_grid.cgn"""', 'iric.IRIC_MODE_MODIFY'], {})... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, imageio contributors
# imageio is distributed under the terms of the (new) BSD License.
#
""" Lytro Illum Plugin.
Plugin to read Lytro Illum .lfr and .raw files as produced
by the Lytro Illum light field camera.
"""
#
#
# This code is based on work by
# <NAME> and ... | [
"numpy.divide",
"numpy.left_shift",
"numpy.frombuffer",
"numpy.zeros",
"os.path.isfile",
"numpy.bitwise_and",
"logging.getLogger"
] | [((699, 726), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (716, 726), False, 'import logging\n'), ((3524, 3573), 'numpy.zeros', 'np.zeros', (['LYTRO_ILLUM_IMAGE_SIZE'], {'dtype': 'np.uint16'}), '(LYTRO_ILLUM_IMAGE_SIZE, dtype=np.uint16)\n', (3532, 3573), True, 'import numpy as np\n'), ... |
import math
import numpy as np
import gym
import gym_fishing.envs.base_fishing_env
from gym_fishing.envs.base_fishing_env import BaseFishingEnv
class FishingModelError(BaseFishingEnv):
metadata = {'render.modes': ['human']}
def __init__(self,
K_mean = 1.0,
r_mean = 0.3,
... | [
"numpy.array",
"numpy.random.normal"
] | [((1407, 1434), 'numpy.array', 'np.array', (['[self.init_state]'], {}), '([self.init_state])\n', (1415, 1434), True, 'import numpy as np\n'), ((1066, 1099), 'numpy.random.normal', 'np.random.normal', (['K_mean', 'sigma_p'], {}), '(K_mean, sigma_p)\n', (1082, 1099), True, 'import numpy as np\n'), ((1134, 1167), 'numpy.r... |
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | [
"torch.LongTensor",
"os.path.dirname",
"PIL.Image.open",
"numpy.array",
"collections.namedtuple",
"warnings.warn",
"os.path.join"
] | [((746, 887), 'collections.namedtuple', 'namedtuple', (['"""return_type"""', "['vertices', 'faces', 'uvs', 'face_uvs_idx', 'materials', 'materials_order',\n 'vertex_normals', 'face_normals']"], {}), "('return_type', ['vertices', 'faces', 'uvs', 'face_uvs_idx',\n 'materials', 'materials_order', 'vertex_normals', '... |
# %% codecell
# create some x and y date
from matplotlib import pyplot as plt
x_list = [-4.0, -2.0, 3.0, 4.0, 5.0, 6.0]
y_list = list()
m = 2
b = 4
for x in x_list:
y = (m*x) + b
y_list.append(y)
plt.plot(x_list, y_list)
# %% codecell
def lin_model_single_ele(m, x, b):
""" Returns a single y for a given... | [
"sklearn.linear_model.LinearRegression",
"numpy.array",
"statistics.mean",
"matplotlib.pyplot.plot"
] | [((207, 231), 'matplotlib.pyplot.plot', 'plt.plot', (['x_list', 'y_list'], {}), '(x_list, y_list)\n', (215, 231), True, 'from matplotlib import pyplot as plt\n'), ((2665, 2696), 'sklearn.linear_model.LinearRegression', 'linear_model.LinearRegression', ([], {}), '()\n', (2694, 2696), False, 'from sklearn import linear_m... |
import argparse
import os
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from matplotlib.ticker import FuncFormatter
import json
from rl_baselines.visualize import movingAverage, loadCsv, loadData
from replay.aggregate_plots import lightcolors, darkcolors, Y_LIM_SHAPED_REWARD, Y_LIM_SPARSE_R... | [
"matplotlib.pyplot.title",
"rl_baselines.visualize.loadCsv",
"argparse.ArgumentParser",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.std",
"os.path.exists",
"numpy.max",
"rl_baselines.visualize.movingAverage",
"seaborn.set",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib... | [((412, 421), 'seaborn.set', 'sns.set', ([], {}), '()\n', (419, 421), True, 'import seaborn as sns\n'), ((645, 660), 'rl_baselines.visualize.loadCsv', 'loadCsv', (['folder'], {}), '(folder)\n', (652, 660), False, 'from rl_baselines.visualize import movingAverage, loadCsv, loadData\n'), ((1198, 1225), 'numpy.array', 'np... |
"""
Helper utilities for working with time series arrays.
This module is intended to have no dependencies on the rest of
the package
"""
import numpy as np
from numpy.fft import rfft, irfft
import warnings
from scipy.integrate import odeint, solve_ivp
from scipy.signal import blackmanharris, fftconvolve, resample
fr... | [
"numpy.fft.rfft",
"numpy.arctan2",
"numpy.random.seed",
"scipy.ndimage.gaussian_filter1d",
"numpy.argmax",
"numpy.sum",
"numpy.abs",
"numpy.argsort",
"numpy.sin",
"numpy.arange",
"numpy.linalg.norm",
"numpy.correlate",
"numpy.random.normal",
"numpy.mean",
"numpy.diag",
"numpy.copy",
... | [((796, 812), 'numpy.arctan2', 'np.arctan2', (['y', 'x'], {}), '(y, x)\n', (806, 812), True, 'import numpy as np\n'), ((821, 845), 'numpy.sqrt', 'np.sqrt', (['(x ** 2 + y ** 2)'], {}), '(x ** 2 + y ** 2)\n', (828, 845), True, 'import numpy as np\n'), ((1926, 1959), 'numpy.std', 'np.std', (['a'], {'axis': '(-2)', 'keepd... |
import pytest
import numpy as np
from flaremodel import eDist
G_STEPS = 40
def gamma_logspace(g_min, g_max, g_steps):
return np.logspace(np.log10(g_min), np.log10(g_max), np.int(np.log10(g_max/g_min)*g_steps))
class TestEDistsNorm:
@pytest.mark.parametrize("thetaE", [10., 20., 30.])
def test_thermal(sel... | [
"flaremodel.eDist",
"numpy.trapz",
"numpy.abs",
"numpy.exp",
"pytest.mark.parametrize",
"numpy.log10"
] | [((245, 298), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""thetaE"""', '[10.0, 20.0, 30.0]'], {}), "('thetaE', [10.0, 20.0, 30.0])\n", (268, 298), False, 'import pytest\n'), ((561, 608), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""kappa"""', '[2.5, 3.5, 4]'], {}), "('kappa', [2.5, 3.5, 4]... |
"""
@author: mkowalska
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import range
import numpy as np
from kcsd import csd_profile as CSD
from kcsd import ValidateKCSD2D
from figure_properties impor... | [
"numpy.linalg.norm",
"numpy.array",
"numpy.linspace",
"joblib.Parallel",
"numpy.savez",
"builtins.range",
"kcsd.ValidateKCSD2D",
"joblib.delayed",
"multiprocessing.cpu_count"
] | [((3304, 3331), 'numpy.linspace', 'np.linspace', (['(0.01)', '(0.15)', '(15)'], {}), '(0.01, 0.15, 15)\n', (3315, 3331), True, 'import numpy as np\n'), ((3387, 3500), 'kcsd.ValidateKCSD2D', 'ValidateKCSD2D', (['CSD_SEED'], {'h': '(50.0)', 'sigma': '(1.0)', 'n_src_init': '(1000)', 'est_xres': '(0.01)', 'est_yres': '(0.0... |
import math
import multiprocessing
import time
from functools import partial
import numpy as np
from sklearn.metrics import pairwise_distances_chunked
from dadapy.utils_.utils import compute_nn_distances, from_all_distances_to_nndistances
cores = multiprocessing.cpu_count()
rng = np.random.default_rng()
class Base... | [
"numpy.full",
"functools.partial",
"time.time",
"numpy.random.default_rng",
"numpy.argpartition",
"numpy.finfo",
"sklearn.metrics.pairwise_distances_chunked",
"numpy.array",
"numpy.arange",
"numpy.vstack",
"dadapy.utils_.utils.from_all_distances_to_nndistances",
"numpy.argsort",
"dadapy.util... | [((250, 277), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (275, 277), False, 'import multiprocessing\n'), ((284, 307), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (305, 307), True, 'import numpy as np\n'), ((9961, 9975), 'numpy.random.default_rng', 'default_rng... |
import numpy as np
import io
import pyedflib
def load_edf_signals(path):
try:
sig = pyedflib.EdfReader(path)
n = sig.signals_in_file
signal_labels = sig.getSignalLabels()
sigbuf = np.zeros((n, sig.getNSamples()[0]))
for j in np.arange(n):
sigbuf[j, :] = sig.readS... | [
"numpy.arctan2",
"numpy.zeros",
"numpy.hypot",
"numpy.random.randint",
"numpy.arange",
"numpy.sin",
"numpy.cos",
"io.open",
"pyedflib.EdfReader"
] | [((1610, 1654), 'numpy.zeros', 'np.zeros', (['(n_runs, RUN_LENGTH, EEG_CHANNELS)'], {}), '((n_runs, RUN_LENGTH, EEG_CHANNELS))\n', (1618, 1654), True, 'import numpy as np\n'), ((2962, 3026), 'numpy.zeros', 'np.zeros', (['(NUM_TRIALS, TRIAL_LENGTH * SAMPLE_RATE, EEG_CHANNELS)'], {}), '((NUM_TRIALS, TRIAL_LENGTH * SAMPLE... |
# Copyright (c) 2021 PaddlePaddle 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 appli... | [
"os.mkdir",
"numpy.random.seed",
"program_config.OpConfig",
"paddle.enable_static",
"numpy.allclose",
"paddle.inference.create_predictor",
"paddle.static.deserialize_program",
"paddle.static.load_from_file",
"time.strftime",
"program_config.create_quant_model",
"shutil.rmtree",
"os.path.join",... | [((1260, 1321), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(message)s"""'}), "(level=logging.INFO, format='%(message)s')\n", (1279, 1321), False, 'import logging\n'), ((1874, 1901), 'hypothesis.settings.load_profile', 'settings.load_profile', (['"""ci"""'], {}), "('ci')\... |
"""
Copyright (c) 2010-2018 CNRS / Centre de Recherche Astrophysique de Lyon
Copyright (c) 2019 <NAME> <<EMAIL>>
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 m... | [
"mpdaf.sdetect.create_masks_from_segmap",
"numpy.max",
"pytest.mark.skipif",
"numpy.arange",
"mpdaf.sdetect.Segmap",
"mpdaf.tests.utils.get_data_file",
"mpdaf.obj.Image",
"numpy.unique"
] | [((3048, 3108), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not HAS_JOBLIB)'], {'reason': '"""requires joblib"""'}), "(not HAS_JOBLIB, reason='requires joblib')\n", (3066, 3108), False, 'import pytest\n'), ((1986, 2024), 'mpdaf.tests.utils.get_data_file', 'get_data_file', (['"""segmap"""', '"""segmap.fits"""'], {})... |
import numpy as np
import matplotlib.pyplot as plt
fig,ax =plt.subplots(2,2)
x = np.linspace(0,8,1000)
ax[0,0].plot(x,np.sin(x),'g') #row=0, col=0
ax[1,0].plot(x,np.tan(x),'k') #row=1, col=0
ax[0,1].plot(range(100),'b') #row=0, col=1
ax[1,1].plot(x,np.cos(x),'r') #row=1, col=1
plt.show() | [
"matplotlib.pyplot.show",
"numpy.tan",
"numpy.sin",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.subplots"
] | [((60, 78), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {}), '(2, 2)\n', (72, 78), True, 'import matplotlib.pyplot as plt\n'), ((82, 105), 'numpy.linspace', 'np.linspace', (['(0)', '(8)', '(1000)'], {}), '(0, 8, 1000)\n', (93, 105), True, 'import numpy as np\n'), ((279, 289), 'matplotlib.pyplot.show'... |
from datetime import datetime
from dataloader.outdoor_data import ActionsDataLoader
from models.multimodal import FuseDecoder
from models.unet_sound2 import UNetSound
from models.unet_architecture_energy import UNetE
from models.unet_noconc import UNetAc
from models.unet_architecture_noconc import UNet
import numpy as ... | [
"models.unet_sound2.UNetSound",
"models.unet_noconc.UNetAc",
"tensorflow.reduce_min",
"os.makedirs",
"tensorflow.train.Saver",
"tensorflow.data.Iterator.from_string_handle",
"tensorflow.reshape",
"os.path.exists",
"numpy.zeros",
"tensorflow.device",
"dataloader.outdoor_data.ActionsDataLoader",
... | [((3315, 3350), 'tensorflow.placeholder', 'tf.placeholder', (['tf.string'], {'shape': '()'}), '(tf.string, shape=())\n', (3329, 3350), True, 'import tensorflow as tf\n'), ((3366, 3474), 'tensorflow.data.Iterator.from_string_handle', 'tf.data.Iterator.from_string_handle', (['handle', 'train_data.data.output_types', 'tra... |
import os
import sys
import logging
from datetime import datetime
from argparse import Namespace
import pandas as pd
import numpy as np
import torch
import h5py
import chemprop.utils
from absl import app
from absl import flags
DELQSAR_ROOT = os.path.abspath(__file__ + '/../../')
sys.path += [os.path.dirname(DELQSAR_R... | [
"del_qsar.splitters.OneCycleSplitter",
"os.mkdir",
"del_qsar.splitters.ThreeCycleSplitter",
"numpy.sum",
"del_qsar.featurizers.OneHotFeaturizer",
"os.path.isfile",
"numpy.mean",
"del_qsar.splitters.TwoCycleSplitter",
"numpy.exp",
"del_qsar.splitters.RandomSplitter",
"torch.device",
"del_qsar.f... | [((244, 281), 'os.path.abspath', 'os.path.abspath', (["(__file__ + '/../../')"], {}), "(__file__ + '/../../')\n", (259, 281), False, 'import os\n'), ((342, 402), 'os.path.join', 'os.path.join', (['DELQSAR_ROOT', '"""experiments"""', '"""all_results.csv"""'], {}), "(DELQSAR_ROOT, 'experiments', 'all_results.csv')\n", (3... |
import tensorflow as tf
import sys, os
import numpy as np
import cv2
import itertools
import tqdm
import utils.kitti_object as kitti_object
import utils.kitti_util as kitti_util
import utils.box_3d_utils as box_3d_utils
import dataset.maps_dict as maps_dict
from core.config import cfg
from builder.data_augmentor impo... | [
"numpy.load",
"numpy.sum",
"numpy.argmax",
"ipdb.set_trace",
"utils.box_3d_utils.get_box3d_corners_helper_np",
"numpy.ones",
"numpy.arange",
"os.path.join",
"numpy.unique",
"cv2.cvtColor",
"utils.tf_ops.evaluation.tf_evaluate.calc_iou",
"os.path.exists",
"numpy.max",
"numpy.reshape",
"nu... | [((1061, 1120), 'os.path.join', 'os.path.join', (['cfg.ROOT_DIR', 'cfg.DATASET.KITTI.BASE_DIR_PATH'], {}), '(cfg.ROOT_DIR, cfg.DATASET.KITTI.BASE_DIR_PATH)\n', (1073, 1120), False, 'import sys, os\n'), ((1146, 1209), 'os.path.join', 'os.path.join', (['cfg.DATASET.KITTI.BASE_DIR_PATH', 'split', '"""label_2"""'], {}), "(... |
from sklearn.manifold import MDS
import numpy as np
import matplotlib.pyplot as plt
class MetricMDS:
def __init__(self, D, P_dimensions):
self.cities = list(D.columns)
self.D = D.to_numpy()
self.P = P_dimensions
self.N = len(self.D)
self.X_hat = self.compute_x_hat()
de... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.annotate",
"matplotlib.pyplot.scatter",
"numpy.array",
"sklearn.manifold.MDS",
"matplotlib.pyplot.savefig",
"numpy.sqrt"
] | [((363, 459), 'sklearn.manifold.MDS', 'MDS', ([], {'n_components': 'self.P', 'dissimilarity': '"""precomputed"""', 'n_init': '(400)', 'max_iter': '(1000)', 'eps': '(1e-05)'}), "(n_components=self.P, dissimilarity='precomputed', n_init=400, max_iter=\n 1000, eps=1e-05)\n", (366, 459), False, 'from sklearn.manifold im... |
"""
Driver of graph construction, optimization, and linking.
"""
import copy
import copyreg
import logging
import time
import warnings
from itertools import chain
from typing import TYPE_CHECKING, List, Optional, Tuple, Type
import numpy as np
import aesara
import aesara.compile.profiling
from aesara.compile.io imp... | [
"aesara.compile.profiling.ProfileStats",
"aesara.compile.ops.view_op",
"aesara.compile.io.SymbolicOutput",
"aesara.link.c.basic.get_module_cache",
"aesara.configdefaults.config.change_flags",
"aesara.graph.destroyhandler.DestroyHandler",
"numpy.may_share_memory",
"aesara.compile.mode.get_mode",
"aes... | [((1019, 1069), 'logging.getLogger', 'logging.getLogger', (['"""aesara.compile.function.types"""'], {}), "('aesara.compile.function.types')\n", (1036, 1069), False, 'import logging\n'), ((43767, 43809), 'copyreg.pickle', 'copyreg.pickle', (['Function', '_pickle_Function'], {}), '(Function, _pickle_Function)\n', (43781,... |
# Copyright (c) 2019 fortiss GmbH
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
import numpy as np
import time
import os
from bark.world.agent import *
from bark.models.behavior import *
from bark.world import *
from bark.world.goal_definition import GoalDefinitionPolygon
f... | [
"os.path.abspath",
"modules.runtime.commons.parameters.ParameterServer",
"modules.runtime.commons.xodr_parser.XodrParser",
"time.sleep",
"bark.world.goal_definition.GoalDefinitionPolygon",
"numpy.array",
"modules.runtime.viewer.matplotlib_viewer.MPViewer"
] | [((842, 859), 'modules.runtime.commons.parameters.ParameterServer', 'ParameterServer', ([], {}), '()\n', (857, 859), False, 'from modules.runtime.commons.parameters import ParameterServer\n'), ((1287, 1348), 'modules.runtime.commons.xodr_parser.XodrParser', 'XodrParser', (['"""modules/runtime/tests/data/Crossing8Course... |
import numpy as np
import slippy
if slippy.CUDA:
import cupy as cp
from slippy.core import _SubModelABC # noqa: E402
from slippy.core.influence_matrix_utils import plan_convolve, bccg # noqa: E402
from slippy.core.materials import _IMMaterial # noqa: E402
class ResultContactStiffness(_SubModelABC):
"""A s... | [
"numpy.zeros_like",
"numpy.sum",
"numpy.logical_and",
"slippy.core.influence_matrix_utils.plan_convolve",
"numpy.ones",
"numpy.mean",
"cupy.asnumpy",
"slippy.core.influence_matrix_utils.bccg"
] | [((5274, 5302), 'numpy.ones', 'np.ones', (['contact_nodes.shape'], {}), '(contact_nodes.shape)\n', (5281, 5302), True, 'import numpy as np\n'), ((6414, 6562), 'slippy.core.influence_matrix_utils.bccg', 'bccg', (['convolution_func', 'displacement[contact_nodes]', 'self.tol', 'self.max_it'], {'x0': 'initial_guess[contact... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import random
import logging
import sys
import numbers
import math
import sklearn
import datetime
import numpy as np
import cv2
from PIL import Image
from io import BytesIO
import mxnet as mx
from mx... | [
"mxnet.ndarray.array",
"mxnet.recordio.MXIndexedRecordIO",
"random.shuffle",
"mxnet.ndarray.transpose",
"mxnet.image.imdecode",
"mxnet.image.resize_short",
"mxnet.io.DataBatch",
"os.path.join",
"random.randint",
"io.BytesIO",
"numpy.asarray",
"numpy.fliplr",
"mxnet.ndarray.sum",
"mxnet.nd.... | [((403, 422), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (420, 422), False, 'import logging\n'), ((3008, 3052), 'mxnet.image.ColorJitterAug', 'mx.image.ColorJitterAug', (['(0.125)', '(0.125)', '(0.125)'], {}), '(0.125, 0.125, 0.125)\n', (3031, 3052), True, 'import mxnet as mx\n'), ((4811, 4846), 'mxnet... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from ray.rllib.agents.trainer import Trainer, with_common_config
from ray.rllib.utils.annotations import override
# yapf: disable
# __sphinx_doc_begin__
class RandomAgent(Trainer):
"""P... | [
"ray.init",
"numpy.absolute",
"ray.rllib.models.ModelCatalog.register_custom_preprocessor",
"ray.rllib.utils.annotations.override",
"numpy.zeros",
"time.time",
"numpy.mean",
"ray.tune.function",
"rl_toy.envs.RLToyEnv",
"ray.rllib.agents.trainer.with_common_config"
] | [((4506, 4574), 'ray.rllib.models.ModelCatalog.register_custom_preprocessor', 'ModelCatalog.register_custom_preprocessor', (['"""ohe"""', 'OneHotPreprocessor'], {}), "('ohe', OneHotPreprocessor)\n", (4547, 4574), False, 'from ray.rllib.models import ModelCatalog\n'), ((4672, 4682), 'ray.init', 'ray.init', ([], {}), '()... |
from __future__ import print_function
import argparse
import skimage
import skimage.io
import skimage.transform
from PIL import Image
from math import log10
import sys
import shutil
import os
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
fr... | [
"torch.cuda.synchronize",
"utils.multadds_count.comp_multadds",
"retrain.LEAStereo.LEAStereo",
"numpy.ones",
"numpy.shape",
"utils.multadds_count.count_parameters_in_MB",
"os.path.isfile",
"numpy.mean",
"matplotlib.pyplot.imsave",
"utils.colorize.get_color_map",
"torch.no_grad",
"matplotlib.py... | [((825, 846), 'config_utils.predict_args.obtain_predict_args', 'obtain_predict_args', ([], {}), '()\n', (844, 846), False, 'from config_utils.predict_args import obtain_predict_args\n'), ((1068, 1082), 'retrain.LEAStereo.LEAStereo', 'LEAStereo', (['opt'], {}), '(opt)\n', (1077, 1082), False, 'from retrain.LEAStereo imp... |
# _*_ coding:utf-8 _*_
'''
新增功能:读入有标签但在一个文件夹里的数据,按正、中、负分好类
@Author: <NAME>
@Date: 2018.12.9
@Purpose: 文本情感分析(positive,negative,neutral)
@Reference: https://github.com/Edward1Chou/SentimentAnalysis
@算法:Bi_LSTM
@需要有事先标准好的数据集
@positive: [1,0,0]
@neutral: [0,1,0]
@negative:[0,0,1]
'''
import logging
logging.basicConfig(fo... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"pandas.read_csv",
"codecs.open",
"datetime.datetime.now",
"keras.layers.Dropout",
"matplotlib.pyplot.legend",
"numpy.asarray",
"matplotlib.pyplot.ylabel",
"tensorflow.contrib.learn.preprocessing.VocabularyProcessor",
"numpy.random.uniform",
"log... | [((298, 393), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s : %(levelname)s : %(message)s',\n level=logging.INFO)\n", (317, 393), False, 'import logging\n'), ((503, 526), 'datetime.datetime.now', 'date... |
from time import time
import argparse
import glob
import numpy as np
import os
import shutil
import skimage.io
from config import TEST_DETECTIONS_PATH, MODELS_DIR, TEST_IMAGES_PATH, TEST_GROUND_TRUTH_PATH
from utils import LOOKUP
from model_utils import parse_classes_file, parse_info_file, list_difference, get_model_... | [
"os.makedirs",
"argparse.ArgumentParser",
"os.path.basename",
"os.path.exists",
"model_utils.parse_classes_file",
"time.time",
"model.ssd_openvino_detector.BinDetectorOpenVino",
"model_utils.get_model_hash",
"model_utils.parse_info_file",
"numpy.array",
"shutil.rmtree",
"model_utils.list_diffe... | [((340, 368), 'os.path.join', 'os.path.join', (['MODELS_DIR', '""""""'], {}), "(MODELS_DIR, '')\n", (352, 368), False, 'import os\n'), ((440, 490), 'os.path.join', 'os.path.join', (['MODELS_PATH', '"""ssd-tf"""', '"""detector.pb"""'], {}), "(MODELS_PATH, 'ssd-tf', 'detector.pb')\n", (452, 490), False, 'import os\n'), (... |
import numpy as np
from itertools import product
from math import sqrt
import cv2
from hailo_model_zoo.core.datasets.datasets_info import get_dataset_info
COLORS = ((244, 67, 54),
(233, 30, 99),
(156, 39, 176),
(103, 58, 183),
(63, 81, 181),
(33, 150, 243),
... | [
"numpy.maximum",
"numpy.triu",
"numpy.sum",
"numpy.clip",
"numpy.argsort",
"numpy.arange",
"numpy.exp",
"hailo_model_zoo.core.datasets.datasets_info.get_dataset_info",
"numpy.prod",
"numpy.cumprod",
"numpy.transpose",
"numpy.reshape",
"cv2.resize",
"numpy.repeat",
"numpy.minimum",
"mat... | [((864, 884), 'numpy.minimum', 'np.minimum', (['_x1', '_x2'], {}), '(_x1, _x2)\n', (874, 884), True, 'import numpy as np\n'), ((894, 914), 'numpy.maximum', 'np.maximum', (['_x1', '_x2'], {}), '(_x1, _x2)\n', (904, 914), True, 'import numpy as np\n'), ((924, 966), 'numpy.clip', 'np.clip', (['(x1 - padding)'], {'a_min': ... |
import os
import numpy as np
import pandas as pd
from scipy.spatial.distance import pdist, squareform
'''
Generate files for pairwise operation tests
'''
BASEDIR = os.path.abspath(os.path.join(os.path.basename(__file__), '../../../..'))
def proj_path(path):
return os.path.join(BASEDIR, path)
def pwdist(met... | [
"numpy.tril_indices",
"numpy.minimum",
"numpy.random.seed",
"os.path.basename",
"numpy.zeros",
"numpy.random.randint",
"scipy.spatial.distance.pdist",
"pandas.DataFrame.from_records",
"os.path.join"
] | [((1069, 1087), 'numpy.random.seed', 'np.random.seed', (['(13)'], {}), '(13)\n', (1083, 1087), True, 'import numpy as np\n'), ((1099, 1138), 'numpy.random.randint', 'np.random.randint', (['(3)'], {'size': '(100, 10000)'}), '(3, size=(100, 10000))\n', (1116, 1138), True, 'import numpy as np\n'), ((1157, 1194), 'pandas.D... |
#### For plotting from reawrd values stored in files
import numpy as np
import matplotlib.pyplot as plt
import sys
run=sys.argv[1]
window_size=int(sys.argv[2])
y = np.loadtxt('episode_reward_run_'+run+'.txt', unpack=True)
y_new=[y_ for y_ in y if y_!=0]
x=range(len(y_new))
plt.figure(1)
plt.plot(x,y_new)
plt.titl... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"numpy.loadtxt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((169, 230), 'numpy.loadtxt', 'np.loadtxt', (["('episode_reward_run_' + run + '.txt')"], {'unpack': '(True)'}), "('episode_reward_run_' + run + '.txt', unpack=True)\n", (179, 230), True, 'import numpy as np\n'), ((280, 293), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (290, 293), True, 'import ma... |
import os
import sys
import time
import math
from datetime import datetime
import random
import logging
from collections import OrderedDict
import numpy as np
import cv2
import torch
from torchvision.utils import make_grid
from shutil import get_terminal_size
import yaml
try:
from yaml import CLoader as Loader, CD... | [
"sys.stdout.write",
"numpy.random.seed",
"logging.Formatter",
"numpy.mean",
"sys.stdout.flush",
"logging.FileHandler",
"cv2.filter2D",
"cv2.imwrite",
"shutil.get_terminal_size",
"os.path.exists",
"numpy.transpose",
"random.seed",
"datetime.datetime.now",
"math.sqrt",
"torch.manual_seed",... | [((709, 762), 'yaml.Dumper.add_representer', 'Dumper.add_representer', (['OrderedDict', 'dict_representer'], {}), '(OrderedDict, dict_representer)\n', (731, 762), False, 'from yaml import Loader, Dumper\n'), ((767, 821), 'yaml.Loader.add_constructor', 'Loader.add_constructor', (['_mapping_tag', 'dict_constructor'], {})... |
import shutil
import subprocess
import glob
from tqdm import tqdm
import numpy as np
import os
import argparse
import torch
from torch import nn
import torch.nn.functional as F
import pretrainedmodels
from pretrainedmodels import utils
C, H, W = 3, 224, 224
def extract_frames(video, dst):
with open(os.devnull, ... | [
"pretrainedmodels.inceptionv3",
"os.mkdir",
"tqdm.tqdm",
"numpy.save",
"argparse.ArgumentParser",
"os.makedirs",
"pretrainedmodels.utils.LoadTransformImage",
"os.path.isdir",
"pretrainedmodels.resnet152",
"os.path.exists",
"pretrainedmodels.utils.Identity",
"subprocess.call",
"pretrainedmode... | [((1340, 1356), 'tqdm.tqdm', 'tqdm', (['video_list'], {}), '(video_list)\n', (1344, 1356), False, 'from tqdm import tqdm\n'), ((2258, 2283), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2281, 2283), False, 'import argparse\n'), ((3890, 3906), 'pretrainedmodels.utils.Identity', 'utils.Identit... |
from pydesim import Atomic, Content, INF, NEG_INF, Port, Errors
from . import WeightInitializers, Ports, ActionPotential as AP
import numpy as np
class Sv3(Atomic):
class States:
RESTING = "RESTING"
PROPAGATING = "PROPAGATING"
def __init__(
self, name, parent, pos, d,
... | [
"pydesim.Port",
"pydesim.Content",
"pydesim.Errors.StateError",
"numpy.array"
] | [((4933, 4959), 'pydesim.Port', 'Port', (['target', 'synapse.name'], {}), '(target, synapse.name)\n', (4937, 4959), False, 'from pydesim import Atomic, Content, INF, NEG_INF, Port, Errors\n'), ((4089, 4149), 'pydesim.Content', 'Content', (['self.out_ports[Ports.STIMULI]', 'arrived_AP.amplitude'], {}), '(self.out_ports[... |
from __future__ import division
from __future__ import print_function
from builtins import range
import numpy as np
# extended official code from http://www.semantic3d.net/scripts/metric.py
class ConfusionMatrix:
"""Streaming interface to allow for any source of predictions. Initialize it, count predictions... | [
"numpy.sum",
"numpy.zeros",
"builtins.range"
] | [((513, 575), 'numpy.zeros', 'np.zeros', ([], {'shape': '(self.number_of_labels, self.number_of_labels)'}), '(shape=(self.number_of_labels, self.number_of_labels))\n', (521, 575), True, 'import numpy as np\n'), ((827, 859), 'builtins.range', 'range', (['ground_truth_vec.shape[0]'], {}), '(ground_truth_vec.shape[0])\n',... |
from __future__ import print_function
import numpy
import theano.tensor as T
from theano.misc import strutil
import theano
from six.moves import xrange
from theano.tensor.nnet.ConvTransp3D import ConvTransp3D
from theano.gof import local_optimizer
from theano.sandbox.cuda.basic_ops import as_cuda_ndarray_variable
fr... | [
"theano.tensor.as_tensor_variable",
"theano.sandbox.cuda.opt.gpu_optimizer.register",
"theano.sandbox.cuda.basic_ops.as_cuda_ndarray_variable",
"numpy.zeros",
"theano.gof.local_optimizer",
"six.moves.xrange",
"theano.sandbox.cuda.CudaNdarrayType",
"numpy.dot",
"numpy.all"
] | [((13847, 13878), 'theano.gof.local_optimizer', 'local_optimizer', (['[ConvTransp3D]'], {}), '([ConvTransp3D])\n', (13862, 13878), False, 'from theano.gof import local_optimizer\n'), ((14335, 14409), 'theano.sandbox.cuda.opt.gpu_optimizer.register', 'gpu_optimizer.register', (['"""local_gpu_conv_transp3d"""', 'local_gp... |
# Copyright (c) 2018-2021, NVIDIA CORPORATION.
import gzip
import os
import re
import shutil
from collections import OrderedDict
from io import BytesIO, StringIO
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
import cudf
from cudf import read_csv
from cudf.tests.utils import assert_eq,... | [
"numpy.bool_",
"cudf.read_csv",
"numpy.random.seed",
"cudf.datasets.timeseries",
"pandas.read_csv",
"numpy.iinfo",
"pathlib.Path",
"numpy.random.randint",
"numpy.arange",
"pytest.mark.parametrize",
"pandas.DataFrame",
"cudf.Index",
"os.path.exists",
"re.escape",
"cudf.tests.utils.assert_... | [((5292, 5332), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dtype"""', 'dtypes'], {}), "('dtype', dtypes)\n", (5315, 5332), False, 'import pytest\n'), ((5334, 5373), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""nelem"""', 'nelem'], {}), "('nelem', nelem)\n", (5357, 5373), False, 'import p... |
import pytest
import numpy as np
from numpy.testing import assert_almost_equal, assert_warns, assert_raises
from .. import DiscrimOneSample
class TestOneSample:
def test_same_one(self):
# matches test calculated statistics and p-value for indiscriminable subjects
x = np.ones((100, 2), dtype=float)... | [
"numpy.random.seed",
"numpy.testing.assert_almost_equal",
"numpy.zeros",
"numpy.ones",
"numpy.arange",
"pytest.mark.parametrize"
] | [((1710, 1752), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""reps"""', "[-1, '1']"], {}), "('reps', [-1, '1'])\n", (1733, 1752), False, 'import pytest\n'), ((290, 320), 'numpy.ones', 'np.ones', (['(100, 2)'], {'dtype': 'float'}), '((100, 2), dtype=float)\n', (297, 320), True, 'import numpy as np\n'), ((3... |
import dgl
import sys
import os
import numpy as np
from scipy import sparse as spsp
from numpy.testing import assert_array_equal
from dgl.heterograph_index import create_unitgraph_from_coo
from dgl.distributed import partition_graph, load_partition
from dgl import function as fn
import backend as F
import unittest
impo... | [
"backend.asnumpy",
"backend.cat",
"backend.boolean_mask",
"numpy.ones",
"numpy.arange",
"unittest.skipIf",
"backend.astype",
"dgl.distributed.load_partition",
"backend.dtype",
"backend.gather_row",
"dgl.heterograph",
"dgl.function.copy_src",
"backend.shape",
"numpy.concatenate",
"backend... | [((17601, 17670), 'unittest.skipIf', 'unittest.skipIf', (["(os.name == 'nt')"], {'reason': '"""Do not support windows yet"""'}), "(os.name == 'nt', reason='Do not support windows yet')\n", (17616, 17670), False, 'import unittest\n'), ((17885, 17954), 'unittest.skipIf', 'unittest.skipIf', (["(os.name == 'nt')"], {'reaso... |
# coding=utf-8
import numpy
from tests import NumpyAwareTestCase
from pypint.problems.i_problem import IProblem
from pypint.problems.transient_problem_mixin import TransientProblemMixin, problem_is_transient
class TransientProblemMixinTest(NumpyAwareTestCase):
class ExampleProblem(IProblem, TransientProblemMixin... | [
"unittest.main",
"pypint.problems.transient_problem_mixin.TransientProblemMixin.print_lines_for_log",
"pypint.problems.transient_problem_mixin.TransientProblemMixin.__init__",
"numpy.array",
"pypint.problems.transient_problem_mixin.TransientProblemMixin.__str__",
"pypint.problems.transient_problem_mixin.p... | [((2898, 2913), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2911, 2913), False, 'import unittest\n'), ((1790, 1813), 'numpy.array', 'numpy.array', (['[0.5, 0.6]'], {}), '([0.5, 0.6])\n', (1801, 1813), False, 'import numpy\n'), ((472, 525), 'pypint.problems.transient_problem_mixin.TransientProblemMixin.__init__... |
# -*- coding: utf-8 -*-
"""
This module provide utilities for converting from any complex format that we can
read to SICD or SIO format. The same conversion utility can be used to subset data.
"""
import os
import sys
import pkgutil
from importlib import import_module
import numpy
import logging
from typing import Uni... | [
"pkgutil.walk_packages",
"importlib.import_module",
"os.path.isdir",
"os.path.exists",
"numpy.array",
"os.path.splitext",
"os.path.split",
"os.path.join"
] | [((1556, 1579), 'importlib.import_module', 'import_module', (['mod_name'], {}), '(mod_name)\n', (1569, 1579), False, 'from importlib import import_module\n'), ((1863, 1893), 'os.path.split', 'os.path.split', (['module.__file__'], {}), '(module.__file__)\n', (1876, 1893), False, 'import os\n'), ((2024, 2053), 'pkgutil.w... |
# ==============================================================================
# Team Dark Mirror used this code for our Final AI project in CS 3793 at UTSA
#
# Team Dark Mirror is:
# De<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
#
# This code originated as a copy of the labe_image.py code from the TensorFlow p... | [
"webbrowser.open_new",
"argparse.ArgumentParser",
"tensorflow.image.decode_png",
"cv2.imshow",
"tensorflow.subtract",
"cv2.imwrite",
"tensorflow.cast",
"tensorflow.GraphDef",
"tensorflow.image.decode_gif",
"tensorflow.Session",
"tensorflow.gfile.GFile",
"tensorflow.Graph",
"numpy.squeeze",
... | [((1793, 1803), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (1801, 1803), True, 'import tensorflow as tf\n'), ((1818, 1831), 'tensorflow.GraphDef', 'tf.GraphDef', ([], {}), '()\n', (1829, 1831), True, 'import tensorflow as tf\n'), ((2017, 2036), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (203... |
# Copyright (c) OpenMMLab. All rights reserved.
import os
import warnings
from collections import OrderedDict
import numpy as np
from mmcv import Config
from ...builder import DATASETS
from ..base import Kpt2dSviewRgbImgTopDownDataset
@DATASETS.register_module()
class AnimalFlyDataset(Kpt2dSviewRgbImgTopDownDataset... | [
"numpy.minimum",
"numpy.zeros",
"mmcv.Config.fromfile",
"numpy.array",
"collections.OrderedDict",
"warnings.warn",
"os.path.join"
] | [((5879, 5928), 'os.path.join', 'os.path.join', (['res_folder', '"""result_keypoints.json"""'], {}), "(res_folder, 'result_keypoints.json')\n", (5891, 5928), False, 'import os\n'), ((6877, 6898), 'collections.OrderedDict', 'OrderedDict', (['info_str'], {}), '(info_str)\n', (6888, 6898), False, 'from collections import ... |
"""
Transform classes compatible with FlowJo 10
"""
import numpy as np
from scipy import interpolate
from ._base_transform import Transform
def _log_root(b, w):
x_lo = 0
x_hi = b
d = (x_lo + x_hi) / 2
dx = abs(int(x_lo - x_hi))
dx_last = dx
fb = -2 * np.log(b) + w * b
f = 2. * np.log(d) + ... | [
"numpy.log",
"numpy.copy",
"numpy.min",
"numpy.max",
"numpy.arange",
"numpy.exp",
"numpy.log10"
] | [((1800, 1812), 'numpy.log', 'np.log', (['(10.0)'], {}), '(10.0)\n', (1806, 1812), True, 'import numpy as np\n'), ((1871, 1891), 'numpy.log10', 'np.log10', (['(-low_scale)'], {}), '(-low_scale)\n', (1879, 1891), True, 'import numpy as np\n'), ((2563, 2582), 'numpy.arange', 'np.arange', (['n_points'], {}), '(n_points)\n... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"jax.experimental.sparse.todense",
"jax.util.split_list",
"jax.experimental.sparse.random_bcoo",
"jax.experimental.sparse.bcoo_fromdense",
"jax.experimental.sparse.csr_matvec",
"jax.experimental.sparse.coo_matmat",
"jax.experimental.sparse.bcoo._bcoo_nse",
"jax.random.PRNGKey",
"jax.numpy.empty",
... | [((1280, 1310), 'jax.config.parse_flags_with_absl', 'config.parse_flags_with_absl', ([], {}), '()\n', (1308, 1310), False, 'from jax import config\n'), ((2180, 2196), 'random.Random', 'random.Random', (['(0)'], {}), '(0)\n', (2193, 2196), False, 'import random\n'), ((4289, 4313), 'contextlib.nullcontext', 'contextlib.n... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# Dependencies
import numpy as np
import warnings
# Project
from .. import units as u
from ..utils.exceptions import AstropyDeprecationWarning
from ..utils import OrderedDescriptor, ShapedLikeNDArray
__all__ = ['Attribute', 'Tim... | [
"warnings.warn",
"numpy.broadcast_to",
"numpy.zeros",
"numpy.all"
] | [((17313, 17406), 'warnings.warn', 'warnings.warn', (['"""FrameAttribute has been renamed to Attribute."""', 'AstropyDeprecationWarning'], {}), "('FrameAttribute has been renamed to Attribute.',\n AstropyDeprecationWarning)\n", (17326, 17406), False, 'import warnings\n'), ((17559, 17660), 'warnings.warn', 'warnings.... |
'''
This module defines the base class for all FFT calculators.
Subclasses must define:
_forward - takes image and returns fft
_reverse - takes fft and returns image
make_full - takes output of _forward and returns full fft
make_half - takes output of _forward and returns half fft
'''
import numpy
import pyami.... | [
"numpy.absolute",
"numpy.log"
] | [((2341, 2366), 'numpy.absolute', 'numpy.absolute', (['fft_array'], {}), '(fft_array)\n', (2355, 2366), False, 'import numpy\n'), ((2509, 2534), 'numpy.absolute', 'numpy.absolute', (['fft_array'], {}), '(fft_array)\n', (2523, 2534), False, 'import numpy\n'), ((2383, 2397), 'numpy.log', 'numpy.log', (['pow'], {}), '(pow... |
import logging
import networkx as nx
import numpy as np
class PAHomophily:
def __init__(self, G, k, small_value, h_aa, h_bb, log_name=None):
self.logger = logging.getLogger(log_name)
self.G = G
self.small_value = small_value
self.h_aa = h_aa
self.h_bb = h_bb
self.nu... | [
"numpy.sum",
"numpy.count_nonzero",
"networkx.non_neighbors",
"numpy.random.choice",
"numpy.random.permutation",
"logging.getLogger"
] | [((169, 196), 'logging.getLogger', 'logging.getLogger', (['log_name'], {}), '(log_name)\n', (186, 196), False, 'import logging\n'), ((1121, 1147), 'numpy.sum', 'np.sum', (['conn_probabilities'], {}), '(conn_probabilities)\n', (1127, 1147), True, 'import numpy as np\n'), ((1566, 1659), 'numpy.random.permutation', 'np.ra... |
"""
Communicability and centrality measures.
"""
# Copyright (C) 2011 by
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# All rights reserved.
# BSD license.
import networkx_mod as nx
from networkx_mod.utils import *
__author__ = "\n".join(['<NAME> (<EMAIL>)',
'<NAME>... | [
"scipy.linalg.expm",
"nose.SkipTest",
"networkx_mod.to_numpy_matrix",
"scipy.diag",
"numpy.linalg.eigh",
"numpy.array",
"numpy.exp",
"numpy.dot"
] | [((2296, 2327), 'networkx_mod.to_numpy_matrix', 'nx.to_numpy_matrix', (['G', 'nodelist'], {}), '(G, nodelist)\n', (2314, 2327), True, 'import networkx_mod as nx\n'), ((2384, 2404), 'scipy.linalg.expm', 'scipy.linalg.expm', (['A'], {}), '(A)\n', (2401, 2404), False, 'import scipy\n'), ((4363, 4394), 'networkx_mod.to_num... |
import gym
import numpy as np
import os
from .image_task import ImageTask
class MiniHackObsWrapper(gym.ObservationWrapper):
def __init__(self, env):
super().__init__(env)
self.observation_space = gym.spaces.Box(low=0, high=255, dtype=np.uint8, shape=(84, 84, 3))
def observation(self, obs):
... | [
"numpy.pad",
"gym.make",
"os.getcwd",
"gym.spaces.Box",
"os.chdir"
] | [((2026, 2283), 'gym.make', 'gym.make', (['f"""MiniHack-{env_name}"""'], {'observation_keys': 'observation_keys', 'reward_win': 'reward_win', 'reward_lose': 'reward_lose', 'penalty_time': 'penalty_time', 'penalty_step': 'penalty_step', 'penalty_mode': 'penalty_mode', 'character': 'character', 'savedir': 'savedir'}), "(... |
import os
import numpy as np
import json
import torch
from torch import nn
from torch.utils.data import Dataset, DataLoader
from transformers import BertModel, BertTokenizerFast
from .model import GlobalPointer
from .utils import rematch
__all__=['load_NER']
class _CustomDataset4test(Dataset):
def ... | [
"numpy.triu",
"os.makedirs",
"torch.utils.data.DataLoader",
"torch.hub.download_url_to_file",
"torch.load",
"os.path.dirname",
"os.path.exists",
"transformers.BertTokenizerFast.from_pretrained",
"numpy.where",
"torch.cuda.is_available",
"torch.device",
"torch.zeros",
"transformers.BertModel.... | [((6313, 6358), 'transformers.BertTokenizerFast.from_pretrained', 'BertTokenizerFast.from_pretrained', (['model_name'], {}), '(model_name)\n', (6346, 6358), False, 'from transformers import BertModel, BertTokenizerFast\n'), ((6986, 7034), 'torch.load', 'torch.load', (['model_save_path'], {'map_location': 'device'}), '(... |
from base.base_trainer import BaseTrainer
from base.base_dataset import BaseADDataset
from base.base_net import BaseNet
from torch.utils.data.dataloader import DataLoader
from sklearn.metrics import roc_auc_score, precision_recall_curve, auc
from torch.utils.tensorboard import SummaryWriter
from torch.nn import BCEWith... | [
"torch.nn.BCEWithLogitsLoss",
"time.time",
"numpy.array",
"torch.no_grad",
"logging.getLogger",
"torch.optim.lr_scheduler.MultiStepLR"
] | [((1953, 2046), 'torch.optim.lr_scheduler.MultiStepLR', 'optim.lr_scheduler.MultiStepLR', (['self.optimizer'], {'milestones': 'self.lr_milestones', 'gamma': '(0.1)'}), '(self.optimizer, milestones=self.\n lr_milestones, gamma=0.1)\n', (1983, 2046), True, 'import torch.optim as optim\n'), ((2109, 2128), 'torch.nn.BCE... |
import os
import string
import chainer
import numpy as np
import skimage.io
def load_mtl(filename_mtl):
# load color (Kd) and filename of textures from *.mtl
texture_filenames = {}
colors = {}
material_name = ''
for line in open(filename_mtl).readlines():
if len(line.split()) != 0:
... | [
"numpy.abs",
"os.path.dirname",
"numpy.zeros",
"string.Template",
"numpy.array",
"chainer.cuda.to_gpu",
"numpy.arange",
"numpy.vstack"
] | [((2027, 2053), 'chainer.cuda.to_gpu', 'chainer.cuda.to_gpu', (['faces'], {}), '(faces)\n', (2046, 2053), False, 'import chainer\n'), ((2280, 2309), 'chainer.cuda.to_gpu', 'chainer.cuda.to_gpu', (['textures'], {}), '(textures)\n', (2299, 2309), False, 'import chainer\n'), ((2176, 2262), 'numpy.zeros', 'np.zeros', (['(f... |
#/usr/bin/env python
#coding=utf-8
"""
定义特征抽取相关的util function
"""
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../")
from sklearn.feature_extraction.text import CountVectorizer
import math
import numpy as np
from mt_metrics.bleu import compute_bleu
from mt_metric... | [
"os.path.abspath",
"mt_metrics.ter.ter",
"mt_metrics.meteor.Meteor",
"numpy.argsort",
"numpy.sort",
"math.log1p",
"mt_metrics.bleu.compute_bleu",
"mt_metrics.nist.NISTScore",
"mt_metrics.rouge.rouge"
] | [((950, 971), 'math.log1p', 'math.log1p', (['sent_diff'], {}), '(sent_diff)\n', (960, 971), False, 'import math\n'), ((6188, 6196), 'mt_metrics.meteor.Meteor', 'Meteor', ([], {}), '()\n', (6194, 6196), False, 'from mt_metrics.meteor import Meteor\n'), ((6844, 6863), 'mt_metrics.ter.ter', 'ter', (['sent_1', 'sent_2'], {... |
# Copyright (c) 2020 Sony Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | [
"nnabla.Variable",
"nnabla_nas.module.parameter.Parameter",
"numpy.array",
"nnabla_nas.module.static.Join"
] | [((895, 916), 'nnabla_nas.module.parameter.Parameter', 'Parameter', ([], {'shape': '(2,)'}), '(shape=(2,))\n', (904, 916), False, 'from nnabla_nas.module.parameter import Parameter\n'), ((931, 947), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (939, 947), True, 'import numpy as np\n'), ((967, 1033), 'nnab... |
import os
import json
import pickle
import numpy as np
import matplotlib.pyplot as plt
def append_or_create_list_for_key(dict, key, ele):
if key in dict:
dict[key].append(ele)
else:
dict[key] = [ele]
def running_avg(list_to_avg, avg_steps=100):
array_to_avg = np.asarray(list_to_avg)
ar... | [
"os.mkdir",
"matplotlib.pyplot.figure",
"pickle.load",
"numpy.mean",
"os.path.join",
"numpy.copy",
"os.path.exists",
"matplotlib.pyplot.show",
"numpy.asarray",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.grid",
"os.listdir",
"matplotlib.pyplot.xlim",
"json.... | [((290, 313), 'numpy.asarray', 'np.asarray', (['list_to_avg'], {}), '(list_to_avg)\n', (300, 313), True, 'import numpy as np\n'), ((401, 422), 'numpy.copy', 'np.copy', (['array_to_avg'], {}), '(array_to_avg)\n', (408, 422), True, 'import numpy as np\n'), ((1053, 1072), 'os.listdir', 'os.listdir', (['"""rslts"""'], {}),... |
import os
import shutil
import numpy as np
import pytest
from jina.executors import BaseExecutor
from jina.types.document import UniqueId
cur_dir = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture()
def test_workspace(tmpdir):
os.environ['JINA_TEST_WORKSPACE'] = str(tmpdir)
os.environ['JINA_TEST_... | [
"os.path.abspath",
"shutil.copytree",
"shutil.rmtree",
"pytest.fixture",
"os.path.exists",
"jina.types.document.UniqueId",
"numpy.random.random",
"pytest.mark.parametrize",
"os.path.join",
"numpy.concatenate"
] | [((197, 213), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (211, 213), False, 'import pytest\n'), ((619, 670), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""pea_id"""', '[-1, 0, 1, 2, 3]'], {}), "('pea_id', [-1, 0, 1, 2, 3])\n", (642, 670), False, 'import pytest\n'), ((1350, 1405), 'pytest.mark.p... |
import cv2
import numpy as np
import onnx
import onnxruntime as ort
from onnx_tf.backend import prepare
import requests
import json
import argparse
import grequests
def parse_args():
parser = argparse.ArgumentParser(prog="Video Recognition - Multithreaded",
description="This program recognices the faces in a v... | [
"numpy.maximum",
"argparse.ArgumentParser",
"numpy.clip",
"onnxruntime.InferenceSession",
"numpy.argsort",
"cv2.__version__.split",
"cv2.rectangle",
"cv2.imencode",
"requests.post",
"cv2.imshow",
"json.loads",
"grequests.post",
"cv2.cvtColor",
"numpy.transpose",
"onnx_tf.backend.prepare"... | [((6187, 6222), 'cv2.VideoCapture', 'cv2.VideoCapture', (['args.video_source'], {}), '(args.video_source)\n', (6203, 6222), False, 'import cv2\n'), ((6272, 6292), 'onnx.load', 'onnx.load', (['onnx_path'], {}), '(onnx_path)\n', (6281, 6292), False, 'import onnx\n'), ((6305, 6324), 'onnx_tf.backend.prepare', 'prepare', (... |
"""
Plots the Wasserstein-2 distance as a function of translational distance.
"""
import pysdot as ot
import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
xbnds = [0.0,1.0] # minimum and maximum x values
circle_radius = 0.1
ybnds = [0.5-2*circle_radius,0.5+2*circle_radius] # minimum and maxim... | [
"pysdot.BoundingBox",
"numpy.sum",
"pysdot.SemidiscreteGHK",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.linalg.norm",
"numpy.prod",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.close",
"numpy.max",
"pysdot.DiscretizedDistribution",
"numpy.linspace",
"pysdot.RegularGrid",
"matplotli... | [((402, 456), 'pysdot.BoundingBox', 'ot.BoundingBox', (['xbnds[0]', 'xbnds[1]', 'ybnds[0]', 'ybnds[1]'], {}), '(xbnds[0], xbnds[1], ybnds[0], ybnds[1])\n', (416, 456), True, 'import pysdot as ot\n'), ((461, 495), 'pysdot.RegularGrid', 'ot.RegularGrid', (['bbox', 'Ns[0]', 'Ns[1]'], {}), '(bbox, Ns[0], Ns[1])\n', (475, 4... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"singa.tensor.to_numpy",
"argparse.ArgumentParser",
"numpy.asarray",
"os.path.exists",
"builtins.input",
"PIL.Image.open",
"singa.device.get_default_device",
"numpy.argsort",
"numpy.swapaxes",
"builtins.range",
"singa.converter.CaffeConverter"
] | [((1215, 1282), 'singa.converter.CaffeConverter', 'converter.CaffeConverter', ([], {'net_proto': 'prototxt', 'param_path': 'caffemodel'}), '(net_proto=prototxt, param_path=caffemodel)\n', (1239, 1282), False, 'from singa import converter\n'), ((1394, 1414), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n'... |
import pandas as pd
import numpy as np
import time
from src.QDT import QdtClassifier
if __name__ == '__main__':
####################################################
### Section B: Please do not change this section ###
####################################################
# load problems to predict (in th... | [
"src.QDT.QdtClassifier",
"pandas.read_csv",
"numpy.savetxt",
"numpy.zeros",
"time.time",
"numpy.mean"
] | [((372, 403), 'pandas.read_csv', 'pd.read_csv', (['"""CPC18_EstSet.csv"""'], {}), "('CPC18_EstSet.csv')\n", (383, 403), True, 'import pandas as pd\n'), ((476, 506), 'numpy.zeros', 'np.zeros', ([], {'shape': '(nProblems, 5)'}), '(shape=(nProblems, 5))\n', (484, 506), True, 'import numpy as np\n'), ((2232, 2249), 'numpy.... |
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
import sys
import os
import unittest
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from lava.lib.dl.slayer.neuron import rf, sigma_delta
verbose = True if (('-v' in sys.argv) or ('--verbo... | [
"lava.lib.dl.slayer.neuron.rf.Neuron",
"numpy.random.seed",
"matplotlib.pyplot.show",
"torch.var",
"torch.autograd.Variable",
"matplotlib.pyplot.legend",
"torch.nn.functional.mse_loss",
"torch.norm",
"os.environ.get",
"matplotlib.pyplot.figure",
"numpy.random.randint",
"torch.cuda.is_available... | [((357, 380), 'numpy.random.randint', 'np.random.randint', (['(1000)'], {}), '(1000)\n', (374, 380), True, 'import numpy as np\n'), ((394, 414), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (408, 414), True, 'import numpy as np\n'), ((453, 478), 'torch.cuda.is_available', 'torch.cuda.is_available'... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import time
import pytest
import numpy as np
from . import FitsTestCase
from .test_table import comparerecords
from astropy.io import fits
class TestGroupsFunctions(FitsTestCase):
def test_open(self):
with fits.open(self.data('ra... | [
"astropy.io.fits.hdu.groups.GroupData",
"astropy.io.fits.GroupsHDU",
"time.sleep",
"pytest.raises",
"numpy.arange",
"numpy.all"
] | [((1898, 1911), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1908, 1911), False, 'import time\n'), ((5156, 5172), 'numpy.arange', 'np.arange', (['(100.0)'], {}), '(100.0)\n', (5165, 5172), True, 'import numpy as np\n'), ((5302, 5402), 'astropy.io.fits.hdu.groups.GroupData', 'fits.hdu.groups.GroupData', (['imdat... |
from . import VISAInstrumentDriver
import numpy as np
from lightlab.util.data import Spectrum
import visa
import time
import logging
WIDEST_WLRANGE = [1525, 1565]
# create logger
log = logging.getLogger(__name__)
if(len(log.handlers) == 0): # check if the logger already exists
# create logger
log.setLevel(lo... | [
"logging.StreamHandler",
"numpy.clip",
"logging.Formatter",
"numpy.any",
"numpy.max",
"numpy.min",
"numpy.array",
"visa.ResourceManager",
"logging.getLogger",
"lightlab.util.data.Spectrum"
] | [((187, 214), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (204, 214), False, 'import logging\n'), ((393, 416), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (414, 416), False, 'import logging\n'), ((487, 560), 'logging.Formatter', 'logging.Formatter', (['"""%(asct... |
import numpy as np
import PIL.Image as image
import matplotlib.pyplot as plt
F=image.open('test.png')
F = np.array(F)
N=F.shape[-1]
y=np.arange(N)
fft=1j*np.zeros((N,N))
for i in range(N):
for j in range(N):
P = np.exp(-1j * y / N * i * 2 * np.pi)
Q = np.exp(-1j * y / N * j * 2 * np.pi)
fft[... | [
"matplotlib.pyplot.show",
"numpy.zeros",
"PIL.Image.open",
"numpy.array",
"numpy.arange",
"numpy.exp"
] | [((79, 101), 'PIL.Image.open', 'image.open', (['"""test.png"""'], {}), "('test.png')\n", (89, 101), True, 'import PIL.Image as image\n'), ((106, 117), 'numpy.array', 'np.array', (['F'], {}), '(F)\n', (114, 117), True, 'import numpy as np\n'), ((134, 146), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (143, 146), T... |
# Import modules
import os
os.environ["OMP_NUM_THREADS"] = "1"
import numpy as np
import argparse
import warnings
warnings.filterwarnings('ignore')
np.set_printoptions(threshold=np.inf)
# Define function for reading emig.csv
def read_emig(emig_file):
data = np.loadtxt(emig_file,dtype="str",delimiter=",",comments="#"... | [
"numpy.set_printoptions",
"argparse.ArgumentParser",
"warnings.filterwarnings",
"numpy.arange",
"numpy.loadtxt",
"numpy.exp",
"numpy.concatenate"
] | [((114, 147), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (137, 147), False, 'import warnings\n'), ((148, 185), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (167, 185), True, 'import numpy as np\n'), ((261, 324)... |
# coding=utf8
"""
Label propagation in the context of this module refers to a set of
semisupervised classification algorithms. In the high level, these algorithms
work by forming a fully-connected graph between all points given and solving
for the steady-state distribution of labels at each point.
These algorithms per... | [
"numpy.sum",
"numpy.abs",
"numpy.copy",
"numpy.argmax",
"numpy.multiply",
"numpy.asarray",
"numpy.zeros",
"numpy.ones",
"numpy.array",
"numpy.dot",
"scipy.sparse.isspmatrix",
"numpy.unique"
] | [((7964, 7976), 'numpy.unique', 'np.unique', (['y'], {}), '(y)\n', (7973, 7976), True, 'import numpy as np\n'), ((8118, 8131), 'numpy.asarray', 'np.asarray', (['y'], {}), '(y)\n', (8128, 8131), True, 'import numpy as np\n'), ((8184, 8207), 'numpy.ones', 'np.ones', (['(n_samples, 1)'], {}), '((n_samples, 1))\n', (8191, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.