code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import copy
import math
try:
from transformers.modeling_bert import BertConfig, BertEncoder, BertModel
except:
from transformers.models.bert.modeling_bert import BertConfig, BertEncoder, BertModel
class LSTM(nn.M... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.sin",
"torch.from_numpy",
"math.log",
"torch.nn.BatchNorm1d",
"torch.cos",
"torch.arange",
"torch.nn.Sigmoid",
"transformers.models.bert.modeling_bert.BertModel",
"torch.nn.LSTM",
"torch.nn.LayerNorm",
"transformers.models.bert.modeling_bert.BertCo... | [((12488, 12517), 'torch.from_numpy', 'torch.from_numpy', (['future_mask'], {}), '(future_mask)\n', (12504, 12517), False, 'import torch\n'), ((675, 712), 'torch.nn.Embedding', 'nn.Embedding', (['(3)', '(self.hidden_dim // 3)'], {}), '(3, self.hidden_dim // 3)\n', (687, 712), True, 'import torch.nn as nn\n'), ((741, 79... |
# Copyright 2016, 2017 California Institute of Technology
# Users must agree to abide by the restrictions listed in the
# file "LegalStuff.txt" in the PROPER library directory.
#
# PROPER developed at Jet Propulsion Laboratory/California Inst. Technology
# Original IDL version by <NAME>
# Python translation... | [
"numpy.ones"
] | [((1332, 1376), 'numpy.ones', 'np.ones', (['[ngrid, ngrid]'], {'dtype': 'np.complex128'}), '([ngrid, ngrid], dtype=np.complex128)\n', (1339, 1376), True, 'import numpy as np\n')] |
from __future__ import print_function
from scipy import misc
import numpy as np
import os
def to_npy(paths,dir):
m = len(paths)
npdata = np.zeros([m,224,224,3])
for i,name in enumerate(paths):
name = dir+paths[i]
temp = misc.imread(name,mode='RGB')
temp = misc.imresize(temp,[224,224... | [
"os.listdir",
"numpy.delete",
"numpy.array",
"numpy.zeros",
"scipy.misc.imread",
"numpy.concatenate",
"scipy.misc.imresize",
"numpy.expand_dims",
"numpy.save",
"numpy.divide"
] | [((146, 172), 'numpy.zeros', 'np.zeros', (['[m, 224, 224, 3]'], {}), '([m, 224, 224, 3])\n', (154, 172), True, 'import numpy as np\n'), ((473, 488), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (483, 488), False, 'import os\n'), ((998, 1016), 'numpy.zeros', 'np.zeros', (['(num, 4)'], {}), '((num, 4))\n', (1006... |
import argparse
import os
import shutil
import random
from datetime import datetime
import numpy as np
from mediaio.audio_io import AudioSignal, AudioMixer
from mediaio.dsp.spectrogram import MelConverter
from dataset import AudioVisualDataset
def enhance_speech(speaker_file_path, noise_file_path, speech_prediction... | [
"mediaio.audio_io.AudioMixer.mix",
"os.listdir",
"random.shuffle",
"argparse.ArgumentParser",
"dataset.AudioVisualDataset",
"os.path.join",
"datetime.datetime.now",
"numpy.zeros",
"os.mkdir",
"numpy.concatenate",
"mediaio.audio_io.AudioSignal.concat",
"os.path.basename",
"numpy.percentile",
... | [((443, 487), 'mediaio.audio_io.AudioSignal.from_wav_file', 'AudioSignal.from_wav_file', (['speaker_file_path'], {}), '(speaker_file_path)\n', (468, 487), False, 'from mediaio.audio_io import AudioSignal, AudioMixer\n'), ((511, 553), 'mediaio.audio_io.AudioSignal.from_wav_file', 'AudioSignal.from_wav_file', (['noise_fi... |
import os
import matplotlib.pyplot as plt
import numpy as np
IMG_PATH = os.path.dirname(os.path.abspath(__file__))
def plot_function(
input_signal: np.ndarray,
output_signal: np.ndarray,
name: str = None
) -> None:
plt.step(input_signal, output_signal)
plt.xlabel('a')
plt.ylabel('f(a)')
p... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.max",
"numpy.exp",
"numpy.linspace",
"numpy.min",
"os.path.abspath",
"matplotlib.pyplot.title",
"matplotlib.pyplot.step",
"matplotlib.pyplot.show"
] | [((89, 114), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (104, 114), False, 'import os\n'), ((234, 271), 'matplotlib.pyplot.step', 'plt.step', (['input_signal', 'output_signal'], {}), '(input_signal, output_signal)\n', (242, 271), True, 'import matplotlib.pyplot as plt\n'), ((276, 291), 'm... |
# -*- coding: utf-8 -*-
import os
import numpy as np
def _import_networkx():
try:
import networkx as nx
except Exception as e:
raise ImportError('Cannot import networkx. Use graph-tool or try to '
'install it with pip (or conda) install networkx. '
... | [
"graph_tool.load_graph",
"networkx.DiGraph",
"os.path.splitext",
"networkx.Graph",
"numpy.stack",
"networkx.to_scipy_sparse_matrix",
"graph_tool.spectral.adjacency",
"numpy.full",
"graph_tool._gt_type"
] | [((9779, 9826), 'networkx.to_scipy_sparse_matrix', 'nx.to_scipy_sparse_matrix', (['graph'], {'weight': 'weight'}), '(graph, weight=weight)\n', (9804, 9826), True, 'import networkx as nx\n'), ((12595, 12638), 'graph_tool.spectral.adjacency', 'gt.spectral.adjacency', (['graph'], {'weight': 'weight'}), '(graph, weight=wei... |
import time
import cv2
import numpy as np
import tensorflow as tf
from keras import Model
def vgg16_cnn(df, h = 800, w = 800, c = 3):
'''
This function uses pre-trained vgg16 model to extract the feature map of the passed images.
Params: df with
0: image path
Returns:
- output model of vgg16
- fea... | [
"tensorflow.keras.applications.VGG16",
"keras.Model",
"numpy.array",
"numpy.expand_dims",
"time.time"
] | [((523, 534), 'time.time', 'time.time', ([], {}), '()\n', (532, 534), False, 'import time\n'), ((598, 691), 'tensorflow.keras.applications.VGG16', 'tf.keras.applications.VGG16', ([], {'include_top': '(False)', 'weights': '"""imagenet"""', 'input_shape': '(w, h, c)'}), "(include_top=False, weights='imagenet',\n input... |
"""
This module implements training and evaluation of a Convolutional Neural Network in PyTorch.
You should fill in code into indicated sections.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import numpy as np
import os
# import cifar1... | [
"numpy.prod",
"torch.nn.CrossEntropyLoss",
"torch.from_numpy",
"torch.cuda.is_available",
"torch.sum",
"os.path.exists",
"argparse.ArgumentParser",
"numpy.random.seed",
"torch.argmax",
"time.time",
"matplotlib.pyplot.show",
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"torch.device",... | [((1611, 1658), 'torch.sum', 'torch.sum', (['(predictions_argmax == targets_argmax)'], {}), '(predictions_argmax == targets_argmax)\n', (1620, 1658), False, 'import torch\n'), ((2130, 2148), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (2144, 2148), True, 'import numpy as np\n'), ((2153, 2174), 'tor... |
from sklearn.decomposition import TruncatedSVD
from sklearn.decomposition import PCA
from sklearn.decomposition import LatentDirichletAllocation
import numpy as np
class Math:
def svd(self, data, k):
s = TruncatedSVD(n_components=k, n_iter=7, random_state=42)
d = s.fit(data)
components = d.components_
ev = d... | [
"sklearn.decomposition.PCA",
"numpy.zeros",
"sklearn.decomposition.LatentDirichletAllocation",
"sklearn.decomposition.TruncatedSVD"
] | [((209, 264), 'sklearn.decomposition.TruncatedSVD', 'TruncatedSVD', ([], {'n_components': 'k', 'n_iter': '(7)', 'random_state': '(42)'}), '(n_components=k, n_iter=7, random_state=42)\n', (221, 264), False, 'from sklearn.decomposition import TruncatedSVD\n'), ((437, 456), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_com... |
import numpy as np
import rospy
from ros_rl.msg import EnvAct, EnvObs, EnvDescMsg
from ros_rl.srv import GetEnvDesc, GetEnvDescResponse
from std_srvs.srv import Empty, EmptyResponse
from ros_rl.utils.thing import ThingDesc, ThingfromDesc, ThingDescfromMsg, ThingfromMsg
INACTIVE = 0
ACTIVE = 1
FINISHED = 2
state_map =... | [
"numpy.clip",
"ros_rl.srv.GetEnvDescResponse",
"std_srvs.srv.EmptyResponse",
"rospy.Subscriber",
"ros_rl.msg.EnvObs",
"rospy.Service",
"rospy.sleep",
"rospy.Time.now",
"rospy.Rate",
"ros_rl.utils.thing.ThingfromDesc",
"ros_rl.msg.EnvDescMsg",
"ros_rl.utils.thing.ThingfromMsg",
"ros_rl.utils.... | [((2261, 2290), 'ros_rl.utils.thing.ThingDescfromMsg', 'ThingDescfromMsg', (['msg.actDesc'], {}), '(msg.actDesc)\n', (2277, 2290), False, 'from ros_rl.utils.thing import ThingDesc, ThingfromDesc, ThingDescfromMsg, ThingfromMsg\n'), ((2310, 2339), 'ros_rl.utils.thing.ThingDescfromMsg', 'ThingDescfromMsg', (['msg.obsDesc... |
# encoding: utf-8
"""Unit test suite for `cr.cube.stripe.assembler` module."""
import numpy as np
import pytest
from cr.cube.cube import Cube
from cr.cube.dimension import Dimension, _Element, _OrderSpec, _Subtotal
from cr.cube.enums import COLLATION_METHOD as CM
from cr.cube.stripe.assembler import (
StripeAsse... | [
"cr.cube.stripe.assembler._SortByLabelHelper",
"cr.cube.stripe.assembler._BaseOrderHelper.display_order",
"cr.cube.stripe.assembler._OrderHelper",
"cr.cube.stripe.assembler.StripeAssembler",
"cr.cube.stripe.assembler._SortByMeasureHelper",
"cr.cube.stripe.assembler._BaseSortByValueHelper",
"pytest.mark.... | [((994, 1529), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""measure_prop_name, MeasureCls"""', "(('means', _Means), ('population_proportions', _PopulationProportions), (\n 'population_proportion_stderrs', _PopulationProportionStderrs), (\n 'table_proportion_stddevs', _TableProportionStddevs), (\n ... |
import os
import subprocess
from Chaos import Chaos
import random
from numba.core.decorators import jit
import numpy as np
from anim import *
from numba import njit
from functools import partial
OUTPUT_DIR = "gifs"
def randomCoef():
c = round(random.random() * 3, 6)
return random.choice([ -c, c, 0, 0, 0 ])
d... | [
"random.choice",
"numpy.sum",
"numpy.linspace",
"os.path.isdir",
"numpy.zeros",
"os.mkdir",
"numpy.array",
"random.random"
] | [((284, 315), 'random.choice', 'random.choice', (['[-c, c, 0, 0, 0]'], {}), '([-c, c, 0, 0, 0])\n', (297, 315), False, 'import random\n'), ((407, 420), 'numpy.sum', 'np.sum', (['coefs'], {}), '(coefs)\n', (413, 420), True, 'import numpy as np\n'), ((2277, 2300), 'numpy.linspace', 'np.linspace', (['x0', 'x1', 'dt'], {})... |
from mlpractice.stats.stats_utils import print_stats, _update_stats
from mlpractice.utils import ExceptionInterception
try:
from mlpractice_solutions.\
mlpractice_solutions.linear_classifier_solution import softmax
except ImportError:
softmax = None
from scipy.special import softmax as softmax_sample
... | [
"numpy.abs",
"numpy.random.rand",
"mlpractice.utils.ExceptionInterception",
"mlpractice_solutions.mlpractice_solutions.linear_classifier_solution.softmax",
"numpy.array",
"mlpractice.stats.stats_utils.print_stats",
"mlpractice.stats.stats_utils._update_stats",
"numpy.random.seed",
"scipy.special.sof... | [((548, 593), 'mlpractice.stats.stats_utils._update_stats', '_update_stats', (['"""linear_classifier"""', '"""softmax"""'], {}), "('linear_classifier', 'softmax')\n", (561, 593), False, 'from mlpractice.stats.stats_utils import print_stats, _update_stats\n'), ((598, 630), 'mlpractice.stats.stats_utils.print_stats', 'pr... |
import numpy as np
def mortality_lognormal(r, s):
'''Calculate mortality from cumulative log-normal distribution
Keyword arguments:
:param r: ratio of body burdens to cbr, summed (dimensionless)
:param s: dose-response slope (dimensionless)
:returns: mortality fraction (fraction)
'''
if r>... | [
"numpy.log10",
"numpy.sqrt"
] | [((355, 366), 'numpy.log10', 'np.log10', (['r'], {}), '(r)\n', (363, 366), True, 'import numpy as np\n'), ((382, 392), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (389, 392), True, 'import numpy as np\n')] |
import pygame
import random
from enum import Enum
from collections import namedtuple
import numpy as np
pygame.init()
font = pygame.font.Font('arial.ttf', 25)
#font = pygame.font.SysFont('arial', 25)
class Direction(Enum):
RIGHT = 1
LEFT = 2
UP = 3
DOWN = 4
Point = namedtuple('Point', 'x, y')
# rgb colors
WHITE... | [
"collections.namedtuple",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.time.Clock",
"pygame.Rect",
"numpy.array_equal",
"pygame.display.set_caption",
"pygame.font.Font",
"random.randint"
] | [((105, 118), 'pygame.init', 'pygame.init', ([], {}), '()\n', (116, 118), False, 'import pygame\n'), ((126, 159), 'pygame.font.Font', 'pygame.font.Font', (['"""arial.ttf"""', '(25)'], {}), "('arial.ttf', 25)\n", (142, 159), False, 'import pygame\n'), ((273, 300), 'collections.namedtuple', 'namedtuple', (['"""Point"""',... |
"""
File Name: UnoPytorch/drug_qed_func.py
Author: <NAME> (xduan7)
Email: <EMAIL>
Date: 9/4/18
Python Version: 3.6.6
File Description:
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.... | [
"torch.nn.functional.mse_loss",
"torch.nn.functional.l1_loss",
"numpy.array",
"torch.no_grad",
"sklearn.metrics.r2_score"
] | [((1491, 1503), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1499, 1503), True, 'import numpy as np\n'), ((1505, 1517), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1513, 1517), True, 'import numpy as np\n'), ((1528, 1543), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1541, 1543), False, 'import t... |
#!/usr/bin/env python
import numpy as np
from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error
from scipy.stats import pearsonr, spearmanr
#===============================================================================
#=======================================================================... | [
"numpy.amin",
"numpy.argmax",
"sklearn.metrics.mean_squared_error",
"numpy.squeeze",
"scipy.stats.pearsonr",
"numpy.argmin",
"sklearn.metrics.mean_absolute_error",
"scipy.stats.spearmanr",
"sklearn.metrics.r2_score",
"numpy.amax"
] | [((407, 427), 'sklearn.metrics.r2_score', 'r2_score', (['true', 'pred'], {}), '(true, pred)\n', (415, 427), False, 'from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error\n'), ((595, 626), 'sklearn.metrics.mean_absolute_error', 'mean_absolute_error', (['true', 'pred'], {}), '(true, pred)\n', (614... |
import tensorflow as tf
import numpy as np
from typing import Text, List, Dict, Any, Union, Optional, Tuple, Callable
from rasa.shared.nlu.constants import TEXT
from rasa.utils.tensorflow.model_data import FeatureSignature
from rasa.utils.tensorflow.constants import (
REGULARIZATION_CONSTANT,
CONNECTION_DENSIT... | [
"tensorflow.pad",
"rasa.utils.tensorflow.layers.Ffnn",
"rasa.utils.tensorflow.layers.InputMask",
"numpy.mean",
"rasa.utils.tensorflow.exceptions.TFLayerConfigException",
"tensorflow.concat",
"numpy.vstack",
"rasa.utils.tensorflow.layers.DenseForSparse",
"tensorflow.zeros",
"numpy.random.normal",
... | [((47773, 47825), 'tensorflow.sequence_mask', 'tf.sequence_mask', (['sequence_lengths'], {'dtype': 'tf.float32'}), '(sequence_lengths, dtype=tf.float32)\n', (47789, 47825), True, 'import tensorflow as tf\n'), ((47837, 47861), 'tensorflow.expand_dims', 'tf.expand_dims', (['mask', '(-1)'], {}), '(mask, -1)\n', (47851, 47... |
'''
Created on Aug 28, 2015
@author: wirkert
'''
import numpy as np
def collapse_image(img):
""" helper method which transorms the n x m x nrWavelengths image to a
(n*m) x nrWavelength image.
note that this function doesn't take an object of class Msi but
msi.get_image() """
return img.reshape(... | [
"numpy.reshape",
"numpy.where",
"numpy.delete",
"numpy.setdiff1d",
"numpy.arange",
"numpy.random.permutation"
] | [((1098, 1145), 'numpy.random.permutation', 'np.random.permutation', (['collapsed_image.shape[0]'], {}), '(collapsed_image.shape[0])\n', (1119, 1145), True, 'import numpy as np\n'), ((1770, 1802), 'numpy.reshape', 'np.reshape', (['img_bands', 'new_shape'], {}), '(img_bands, new_shape)\n', (1780, 1802), True, 'import nu... |
"""MHD rotor test script
"""
import numpy as np
from scipy.constants import pi as PI
from gawain.main import run_gawain
run_name = "mhd_rotor"
output_dir = "."
cfl = 0.25
with_mhd = True
t_max = 0.15
integrator = "euler"
# "base", "lax-wendroff", "lax-friedrichs", "vanleer", "hll"
fluxer = "hll"
################ ... | [
"numpy.sqrt",
"numpy.ones",
"numpy.logical_and",
"numpy.where",
"gawain.main.run_gawain",
"numpy.array",
"numpy.linspace",
"numpy.zeros",
"numpy.meshgrid"
] | [((474, 502), 'numpy.linspace', 'np.linspace', (['(0.0)', 'lx'], {'num': 'nx'}), '(0.0, lx, num=nx)\n', (485, 502), True, 'import numpy as np\n'), ((507, 535), 'numpy.linspace', 'np.linspace', (['(0.0)', 'ly'], {'num': 'ny'}), '(0.0, ly, num=ny)\n', (518, 535), True, 'import numpy as np\n'), ((540, 568), 'numpy.linspac... |
import itertools
import numba as nb
import numpy as np
import pandas as pd
import pytest
from sid.contacts import _consolidate_reason_of_infection
from sid.contacts import _numpy_replace
from sid.contacts import calculate_infections_by_contacts
from sid.contacts import create_group_indexer
@pytest.mark.unit
@pytest.... | [
"pandas.Series",
"sid.contacts._consolidate_reason_of_infection",
"numpy.ones",
"pandas.DataFrame",
"numba.typed.List",
"numpy.any",
"sid.contacts.create_group_indexer",
"pandas.Categorical",
"numpy.array",
"numpy.zeros",
"itertools.count",
"pytest.fixture",
"pandas.MultiIndex.from_tuples",
... | [((1059, 1075), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1073, 1075), False, 'import pytest\n'), ((938, 983), 'sid.contacts.create_group_indexer', 'create_group_indexer', (['states', 'group_code_name'], {}), '(states, group_code_name)\n', (958, 983), False, 'from sid.contacts import create_group_indexer\n... |
# -*- coding: utf-8 -*-
"""
This module allows to convert standard data representations
(e.g., a spike train stored as Neo SpikeTrain object)
into other representations useful to perform calculations on the data.
An example is the representation of a spike train as a sequence of 0-1 values
(binned spike train).
.. au... | [
"numpy.hstack",
"quantities.Quantity",
"numpy.iinfo",
"elephant.utils.is_time_quantity",
"elephant.utils.is_binary",
"numpy.arange",
"numpy.histogram",
"numpy.repeat",
"numpy.isscalar",
"numpy.asarray",
"numpy.max",
"numpy.linspace",
"warnings.warn",
"scipy.sparse.csr_matrix",
"numpy.dty... | [((7770, 7865), 'numpy.arange', 'np.arange', (['(t_start - sampling_period / 2)', '(t_stop + sampling_period * 3 / 2)', 'sampling_period'], {}), '(t_start - sampling_period / 2, t_stop + sampling_period * 3 / 2,\n sampling_period)\n', (7779, 7865), True, 'import numpy as np\n'), ((12604, 12659), 'elephant.utils.depr... |
import numpy as np
import skimage
from skimage import transform
from PIL import Image
from constants import scale_fact
def float_im(img):
return np.divide(img, 255.)
# Adapted from: https://stackoverflow.com/a/39382475/9768291
def crop_center(img, crop_x, crop_y):
"""
To crop the center of an image
... | [
"PIL.Image.fromarray",
"skimage.transform.resize",
"numpy.multiply",
"numpy.divide"
] | [((153, 174), 'numpy.divide', 'np.divide', (['img', '(255.0)'], {}), '(img, 255.0)\n', (162, 174), True, 'import numpy as np\n'), ((1864, 1887), 'PIL.Image.fromarray', 'Image.fromarray', (['np_img'], {}), '(np_img)\n', (1879, 1887), False, 'from PIL import Image\n'), ((2338, 2452), 'skimage.transform.resize', 'skimage.... |
from multimds import compartment_analysis as ca
from multimds import data_tools as dt
from scipy import stats as st
from matplotlib import pyplot as plt
import numpy as np
from multimds import linear_algebra as la
from scipy import signal as sg
from multimds import multimds as mm
path1 = "hic_data/GM12878_combined_19_... | [
"numpy.abs",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.plot",
"multimds.multimds.full_mds",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.scatter",
"sci... | [((388, 429), 'multimds.multimds.full_mds', 'mm.full_mds', (['path1', 'path2'], {'prefix': '"""test_"""'}), "(path1, path2, prefix='test_')\n", (399, 429), True, 'from multimds import multimds as mm\n'), ((533, 567), 'multimds.compartment_analysis.get_compartments', 'ca.get_compartments', (['mat1', 'struct1'], {}), '(m... |
import os.path as op
import subprocess
import sys
import numpy as np
import pandas as pd
def test_compartment_cli(request, tmpdir):
in_cool = op.join(request.fspath.dirname, 'data/sin_eigs_mat.cool')
out_eig_prefix = op.join(tmpdir, 'test.eigs')
try:
result = subprocess.check_output(
... | [
"subprocess.check_output",
"numpy.corrcoef",
"os.path.join",
"sys.exc_info",
"numpy.isfinite",
"pandas.read_table",
"numpy.sin",
"numpy.log2",
"numpy.load"
] | [((149, 206), 'os.path.join', 'op.join', (['request.fspath.dirname', '"""data/sin_eigs_mat.cool"""'], {}), "(request.fspath.dirname, 'data/sin_eigs_mat.cool')\n", (156, 206), True, 'import os.path as op\n'), ((228, 256), 'os.path.join', 'op.join', (['tmpdir', '"""test.eigs"""'], {}), "(tmpdir, 'test.eigs')\n", (235, 25... |
#!/usr/bin/env python
import rospy
from cv_bridge import CvBridge, CvBridgeError
import cv2
import numpy as np
from sensor_msgs.msg import CompressedImage,Image
import time
class ImageAverageNode(object):
def __init__(self):
self.bridge = CvBridge()
self.publisher = rospy.Publisher("~topic_out",Im... | [
"rospy.Subscriber",
"rospy.init_node",
"numpy.fromstring",
"cv_bridge.CvBridge",
"cv2.addWeighted",
"rospy.spin",
"cv2.imdecode",
"rospy.Publisher"
] | [((1204, 1241), 'rospy.init_node', 'rospy.init_node', (['"""image_average_node"""'], {}), "('image_average_node')\n", (1219, 1241), False, 'import rospy\n'), ((1318, 1330), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (1328, 1330), False, 'import rospy\n'), ((253, 263), 'cv_bridge.CvBridge', 'CvBridge', ([], {}), '()\... |
# For GUI
import tkinter as tk
# To delay time between blocks while visualizing
import time
# For handling arrays in more efficient manner
import numpy as np
# Node for each block containing values to help calculate the shortest path
class Node:
def __init__(self, parent=None, position=None):
# The Node's... | [
"tkinter.IntVar",
"tkinter.Checkbutton",
"numpy.delete",
"tkinter.Button",
"time.sleep",
"numpy.append",
"tkinter.Canvas",
"numpy.array",
"tkinter.Tk",
"tkinter.Label",
"tkinter.DoubleVar"
] | [((836, 843), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (841, 843), True, 'import tkinter as tk\n'), ((1441, 1530), 'tkinter.Canvas', 'tk.Canvas', (['self.root'], {'width': 'self.canvas_width', 'height': 'self.canvas_height', 'bg': '"""white"""'}), "(self.root, width=self.canvas_width, height=self.canvas_height, bg\n ... |
import os
import sys
import csv
import numpy as np
from __main__ import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import CompareVolumes
moduleDir = os.path.dirname(__file__)
codeDir = os.path.abspath(os.path.join(moduleDir, os.pardir))
sys.path.insert(0, codeDir) # So that it comes first in the... | [
"sys.path.insert",
"CompareVolumes.LayerReveal",
"__main__.slicer.mrmlScene.GetNodesByClass",
"atlaslabels.AtlasReader",
"__main__.qt.QFormLayout",
"numpy.array",
"SurfaceToolbox.numericInputFrame",
"__main__.qt.QHBoxLayout",
"__main__.qt.QFileDialog.getExistingDirectory",
"os.path.exists",
"__m... | [((172, 197), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (187, 197), False, 'import os\n'), ((260, 287), 'sys.path.insert', 'sys.path.insert', (['(0)', 'codeDir'], {}), '(0, codeDir)\n', (275, 287), False, 'import sys\n'), ((224, 258), 'os.path.join', 'os.path.join', (['moduleDir', 'os.pa... |
import numpy as np
import os, glob
from matplotlib import pyplot as plt
import stat_tools as st
from PIL import Image
deg2rad=np.pi/180
camera='HD20'
day='20180310'
coordinate = {'HD815_1': [40.87203321, -72.87348295],
'HD815_2': [40.87189059, -72.873687],
'HD490' : [40.865968816, -7... | [
"numpy.sqrt",
"numpy.roots",
"numpy.arctan2",
"numpy.sin",
"numpy.arange",
"numpy.cross",
"os.chmod",
"numpy.linspace",
"os.path.isdir",
"numpy.dot",
"numpy.meshgrid",
"glob.glob",
"numpy.isnan",
"numpy.cos",
"numpy.interp",
"numpy.transpose",
"numpy.tan",
"os.makedirs",
"matplot... | [((2742, 2759), 'numpy.tan', 'np.tan', (['max_theta'], {}), '(max_theta)\n', (2748, 2759), True, 'import numpy as np\n'), ((3055, 3078), 'numpy.meshgrid', 'np.meshgrid', (['xbin', 'ybin'], {}), '(xbin, ybin)\n', (3066, 3078), True, 'import numpy as np\n'), ((3605, 3617), 'numpy.zeros', 'np.zeros', (['(51)'], {}), '(51)... |
from numpy import log, sqrt, sin, arctan2, pi
# define a posterior with multiple separate peaks
def multimodal_posterior(theta):
x,y = theta
r = sqrt(x**2 + y**2)
phi = arctan2(y,x)
z = ((r - (0.5 + pi - phi*0.5))/0.1)
return -0.5*z**2 + 4*log(sin(phi*2.)**2)
# required for multi-process code w... | [
"numpy.sqrt",
"inference.mcmc.GibbsChain",
"numpy.arctan2",
"numpy.sin",
"inference.mcmc.ParallelTempering"
] | [((155, 176), 'numpy.sqrt', 'sqrt', (['(x ** 2 + y ** 2)'], {}), '(x ** 2 + y ** 2)\n', (159, 176), False, 'from numpy import log, sqrt, sin, arctan2, pi\n'), ((183, 196), 'numpy.arctan2', 'arctan2', (['y', 'x'], {}), '(y, x)\n', (190, 196), False, 'from numpy import log, sqrt, sin, arctan2, pi\n'), ((1015, 1047), 'inf... |
# import glob
import numpy as np
import os.path as osp
from PIL import Image
import random
import struct
from torch.utils import data
import scipy.ndimage as ndimage
import cv2
from skimage.measure import block_reduce
import h5py
import scipy.ndimage as ndimage
import torch
from tqdm import tqdm
import torchvision.tra... | [
"torch.DoubleTensor",
"pathlib.Path",
"torch.LongTensor",
"cv2.copyMakeBorder",
"numpy.asarray",
"torch.from_numpy",
"numpy.array",
"torch.is_tensor",
"numpy.zeros",
"torch.cat",
"torch.zeros",
"cv2.resize",
"warnings.filterwarnings",
"numpy.arange"
] | [((1288, 1321), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1311, 1321), False, 'import warnings\n'), ((14466, 14487), 'torch.is_tensor', 'torch.is_tensor', (['elem'], {}), '(elem)\n', (14481, 14487), False, 'import torch\n'), ((4187, 4258), 'numpy.zeros', 'np.zeros', ... |
# This file is part of OpenCV Zoo project.
# It is subject to the license terms in the LICENSE file found in the same directory.
#
# Copyright (C) 2021, Shenzhen Institute of Artificial Intelligence and Robotics for Society, all rights reserved.
# Third party copyrights are property of their respective owners.
import ... | [
"numpy.dstack",
"pphumanseg.PPHumanSeg",
"cv2.imwrite",
"argparse.ArgumentParser",
"cv2.imshow",
"cv2.addWeighted",
"cv2.TickMeter",
"numpy.array",
"cv2.waitKey",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.resize",
"cv2.LUT",
"cv2.namedWindow",
"cv2.imread"
] | [((623, 763), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PPHumanSeg (https://github.com/PaddlePaddle/PaddleSeg/tree/release/2.2/contrib/PP-HumanSeg)"""'}), "(description=\n 'PPHumanSeg (https://github.com/PaddlePaddle/PaddleSeg/tree/release/2.2/contrib/PP-HumanSeg)'\n )\n", (64... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data as utils
import torchvision.transforms as transforms
from scipy import io
import numpy as np
import mathematical_operations as mo
def clustering_kmeans(the_image, my_net, shape, im... | [
"matplotlib.pyplot.imshow",
"sklearn.cluster.KMeans",
"matplotlib.pyplot.savefig",
"torch.Tensor",
"pandas.DataFrame",
"numpy.shape",
"matplotlib.pyplot.show"
] | [((1159, 1192), 'pandas.DataFrame', 'DataFrame', ([], {'data': 'image_autoencoded'}), '(data=image_autoencoded)\n', (1168, 1192), False, 'from pandas import DataFrame\n'), ((1787, 1813), 'matplotlib.pyplot.imshow', 'plt.imshow', (['clastered_data'], {}), '(clastered_data)\n', (1797, 1813), True, 'import matplotlib.pypl... |
from functools import partial
import numpy as np
import matplotlib.pyplot as plt
from vznncv.signal.generator.onedim import create_process_realization
def f_psd_gaussian(f, f_0, alpha):
"""
One side gaussian psd function
.. math::
s = \sqrt{\frac{1}{4 \pi \alpha}} \left(
e^{-\frac{\left( ... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"vznncv.signal.generator.onedim.create_process_realization",
"numpy.exp",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((732, 834), 'vznncv.signal.generator.onedim.create_process_realization', 'create_process_realization', ([], {'size': 't.size', 'f_psd': 'f_psd', 'f_m': '(0.0)', 'f_std': 'f_std', 'fs': '(2.0)', 'window_size': '(64)'}), '(size=t.size, f_psd=f_psd, f_m=0.0, f_std=f_std,\n fs=2.0, window_size=64)\n', (758, 834), Fals... |
import numpy as np
import pdb
from scipy.spatial import ConvexHull
class system(object):
"""docstring for system"""
def __init__(self, A, B, w_inf, x0):
self.A = A
self.B = B
self.w_inf = w_inf
self.x = [x0]
self.u = []
self.w = []
self.w_v = []
self.w_v.append(w_inf*np.array([ 1 ,1]))
self.w_v.a... | [
"scipy.spatial.ConvexHull",
"numpy.array",
"numpy.dot"
] | [((1078, 1098), 'scipy.spatial.ConvexHull', 'ConvexHull', (['vertices'], {}), '(vertices)\n', (1088, 1098), False, 'from scipy.spatial import ConvexHull\n'), ((534, 550), 'numpy.array', 'np.array', (['[0, 0]'], {}), '([0, 0])\n', (542, 550), True, 'import numpy as np\n'), ((700, 716), 'numpy.array', 'np.array', (['[0, ... |
# Copyright 2018, The TensorFlow Federated 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 law o... | [
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow_federated.python.common_libs.py_typecheck.check_type",
"tensorflow_federated.python.common_libs.py_typecheck.check_callable",
"absl.logging.warning",
"tensorflow_federated.python.core.api.computations.tf_computation",
"numpy.random.RandomState"
] | [((8253, 8299), 'tensorflow.data.Dataset.from_tensor_slices', 'tf.data.Dataset.from_tensor_slices', (['client_ids'], {}), '(client_ids)\n', (8287, 8299), True, 'import tensorflow as tf\n'), ((9137, 9179), 'tensorflow_federated.python.common_libs.py_typecheck.check_callable', 'py_typecheck.check_callable', (['preprocess... |
# the phenotyping problem is annoying since you end up with 25 binary tasks; assuming that all of your prediction csv's
# are properly prefixed with the name of the task and reside within a test results folder, then this script will
# will evaluate model performance on each task, and aggregate performance
# python2 -u... | [
"mimic3models.metrics.print_metrics_multilabel",
"os.listdir",
"os.path.join",
"numpy.array",
"numpy.expand_dims",
"mimic3models.metrics.print_metrics_binary"
] | [((2384, 2401), 'os.listdir', 'os.listdir', (['indir'], {}), '(indir)\n', (2394, 2401), False, 'import os\n'), ((3495, 3554), 'mimic3models.metrics.print_metrics_multilabel', 'metrics.print_metrics_multilabel', (['merged_Y.T', 'merged_pred.T'], {}), '(merged_Y.T, merged_pred.T)\n', (3527, 3554), False, 'from mimic3mode... |
#----------
# build the dataset
#----------
import numpy as np, math
import matplotlib.pyplot as plt
from pybrain.datasets import SupervisedDataSet
from pybrain.structure import SigmoidLayer, LinearLayer
from pybrain.tools.shortcuts import buildNetwork
from pybrain.supervised.trainers import BackpropTrainer
def get_... | [
"numpy.amax",
"numpy.amin",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.linspace",
"pybrain.tools.shortcuts.buildNetwork",
"pybrain.supervised.trainers.BackpropTrainer",
"matplotlib.pyplot.title",
"pybrain.datasets.SupervisedDataSet",
"matplotlib.pyplot.subplots"
] | [((578, 646), 'numpy.linspace', 'np.linspace', (['new_x_min', 'new_x_max', '(density * (new_x_max - new_x_min))'], {}), '(new_x_min, new_x_max, density * (new_x_max - new_x_min))\n', (589, 646), True, 'import numpy as np, math\n'), ((1207, 1230), 'pybrain.datasets.SupervisedDataSet', 'SupervisedDataSet', (['(1)', '(1)'... |
import numpy as np
from plico.utils.decorator import override, returns
from plico_dm.client.abstract_deformable_mirror_client import \
AbstractDeformableMirrorClient
from plico_dm.utils.timeout import Timeout
import time
from plico_dm.types.deformable_mirror_status import DeformableMirrorStatus
class SimulatedDef... | [
"plico.utils.decorator.returns",
"numpy.zeros",
"plico_dm.types.deformable_mirror_status.DeformableMirrorStatus"
] | [((2955, 2986), 'plico.utils.decorator.returns', 'returns', (['DeformableMirrorStatus'], {}), '(DeformableMirrorStatus)\n', (2962, 2986), False, 'from plico.utils.decorator import override, returns\n'), ((489, 511), 'numpy.zeros', 'np.zeros', (['self.N_MODES'], {}), '(self.N_MODES)\n', (497, 511), True, 'import numpy a... |
from arg_parser import UserArgs
from collections import Counter
from dataset_handler.dataset import CUB_Xian, SUN_Xian, AWA1_Xian
from dataset_handler.transfer_task_split import ZSLsplit, GZSLsplit, ImbalancedDataSplit, DragonSplit, GFSLSplit
from attribute_expert.model import AttributeExpert
from keras.utils import to... | [
"dataset_handler.transfer_task_split.GFSLSplit",
"numpy.where",
"dataset_handler.transfer_task_split.DragonSplit",
"dataset_handler.transfer_task_split.ZSLsplit",
"keras.utils.to_categorical",
"collections.Counter",
"numpy.array",
"numpy.append",
"attribute_expert.model.AttributeExpert.prepare_data_... | [((1779, 1828), 'attribute_expert.model.AttributeExpert.prepare_data_for_model', 'AttributeExpert.prepare_data_for_model', (['self.data'], {}), '(self.data)\n', (1817, 1828), False, 'from attribute_expert.model import AttributeExpert\n'), ((1890, 1951), 'keras.utils.to_categorical', 'to_categorical', (['self.Y_train'],... |
""" Domain of parameters to generate configs. """
from itertools import product, islice
from collections import OrderedDict
from copy import copy, deepcopy
from pprint import pformat
import numpy as np
from .utils import must_execute, to_list
from .. import Config, Sampler, make_rng
from ..named_expr import eval_expr... | [
"numpy.product",
"numpy.where",
"numpy.delete",
"itertools.product",
"numpy.nanprod",
"numpy.array",
"numpy.stack",
"numpy.isnan",
"numpy.concatenate",
"copy.deepcopy",
"copy.copy"
] | [((21409, 21441), 'numpy.concatenate', 'np.concatenate', (['([0], incl[:-1])'], {}), '(([0], incl[:-1]))\n', (21423, 21441), True, 'import numpy as np\n'), ((5288, 5310), 'copy.deepcopy', 'deepcopy', (['self._config'], {}), '(self._config)\n', (5296, 5310), False, 'from copy import copy, deepcopy\n'), ((5313, 5336), 'c... |
"""Transforms
* :func:`.quantile_transform`
"""
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator
from sklearn.base import TransformerMixin
def quantile_transform(v, res=101):
"""Quantile-transform a vector to lie between 0 and 1"""
x = np.linspace(0, 100, res)
prcs = np.... | [
"numpy.linspace",
"numpy.nanpercentile",
"numpy.interp"
] | [((281, 305), 'numpy.linspace', 'np.linspace', (['(0)', '(100)', 'res'], {}), '(0, 100, res)\n', (292, 305), True, 'import numpy as np\n'), ((317, 339), 'numpy.nanpercentile', 'np.nanpercentile', (['v', 'x'], {}), '(v, x)\n', (333, 339), True, 'import numpy as np\n'), ((351, 380), 'numpy.interp', 'np.interp', (['v', 'p... |
__author__ = '<NAME>'
import numpy as np
import cv2
import logicFunctions as lf
def myMasking(myImage, myMask):
if myImage.__class__ == np.ndarray and myMask.__class__ == np.ndarray:
Dim = myImage.shape
if len(Dim) == 2:
a, b = myMask.shape
m, n = Dim[0], Dim[1... | [
"cv2.merge",
"numpy.int64",
"numpy.float64",
"numpy.max",
"numpy.zeros",
"cv2.split",
"numpy.min",
"numpy.mod"
] | [((1691, 1706), 'numpy.max', 'np.max', (['myImage'], {}), '(myImage)\n', (1697, 1706), True, 'import numpy as np\n'), ((1725, 1740), 'numpy.min', 'np.min', (['myImage'], {}), '(myImage)\n', (1731, 1740), True, 'import numpy as np\n'), ((1759, 1788), 'numpy.zeros', 'np.zeros', (['(256)'], {'dtype': 'np.int64'}), '(256, ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
sbpy Activity Core Module
Core module functions and classes, especially for handling coma
geometries.
created on June 23, 2017
"""
__all__ = [
'Aperture',
'CircularAperture',
'AnnularAperture',
'RectangularAperture',
'GaussianAp... | [
"numpy.exp",
"astropy.units.UnitTypeError",
"numpy.sqrt"
] | [((8026, 8063), 'numpy.exp', 'np.exp', (['(-x ** 2 / self.sigma ** 2 / 2)'], {}), '(-x ** 2 / self.sigma ** 2 / 2)\n', (8032, 8063), True, 'import numpy as np\n'), ((832, 899), 'astropy.units.UnitTypeError', 'u.UnitTypeError', (['"""aperture must be defined with angles or lengths."""'], {}), "('aperture must be defined... |
import numpy
class Complex:
def __init__(self, a, b):
self.real = a
self.imag = b
def multiply(this, that):
term1 = this.real*that.real
term2 = this.real*that.imag + this.imag*that.real
term3 = this.imag*that.imag*-1
return Complex(term1 + term3, term2)
def generate_fractal():
... | [
"numpy.linspace"
] | [((328, 352), 'numpy.linspace', 'numpy.linspace', (['(0)', '(5)', '(10)'], {}), '(0, 5, 10)\n', (342, 352), False, 'import numpy\n')] |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import argparse
import os
import os.path as osp
from chainer import cuda
import chainer.serializers as S
from chainer import Variable
import numpy as np
from scipy.misc import imread
fro... | [
"fcn.models.FCN16s",
"numpy.hstack",
"fcn.models.FCN8s",
"numpy.array",
"os.path.exists",
"fcn.util.resize_img_with_max_size",
"argparse.ArgumentParser",
"scipy.misc.imsave",
"chainer.cuda.to_cpu",
"scipy.misc.imread",
"numpy.vstack",
"chainer.cuda.to_gpu",
"fcn.util.draw_label",
"numpy.on... | [((3895, 3920), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3918, 3920), False, 'import argparse\n'), ((4281, 4318), 'os.path.join', 'osp.join', (['fcn.data_dir', '"""forward_out"""'], {}), "(fcn.data_dir, 'forward_out')\n", (4289, 4318), True, 'import os.path as osp\n'), ((1572, 1609), 'ch... |
import numpy as np
import cv2 as cv
import utils
from table import Table
from PIL import Image
import xlsxwriter
import sys
from pdf2image import convert_from_path
# =====================================================
# IMAGE LOADING
# =====================================================
if len(sys.argv) < 2:
p... | [
"utils.run_textcleaner",
"sys.exit",
"numpy.asarray",
"utils.verify_table",
"xlsxwriter.Workbook",
"cv2.cvtColor",
"cv2.resize",
"cv2.imread",
"cv2.imwrite",
"table.Table",
"PIL.Image.open",
"utils.isolate_lines",
"cv2.bitwise_and",
"numpy.lexsort",
"cv2.adaptiveThreshold",
"utils.mkdi... | [((689, 717), 'cv2.imread', 'cv.imread', (['"""data/target.jpg"""'], {}), "('data/target.jpg')\n", (698, 717), True, 'import cv2 as cv\n'), ((1804, 1939), 'cv2.adaptiveThreshold', 'cv.adaptiveThreshold', (['(~grayscale)', 'MAX_THRESHOLD_VALUE', 'cv.ADAPTIVE_THRESH_MEAN_C', 'cv.THRESH_BINARY', 'BLOCK_SIZE', 'THRESHOLD_C... |
import os
import sys
import csv
import json
import random
import requests
from typing import Any, List, Optional
from datetime import datetime, timedelta, date
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, Blueprint, jsonify
from jinja2 import TemplateNotFound
from sq... | [
"flask.render_template",
"numpy.random.default_rng",
"logging.debug",
"flask.Flask",
"filelock.FileLock",
"flask.session.delete",
"numpy.array",
"numpy.argsort",
"datetime.datetime.today",
"sklearn.gaussian_process.kernels.WhiteKernel",
"logging.info",
"sqlalchemy.orm.sessionmaker",
"flask.f... | [((841, 879), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stderr'}), '(stream=sys.stderr)\n', (860, 879), False, 'import logging\n'), ((887, 902), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (892, 902), False, 'from flask import Flask, request, session, g, redirect, url_for, abort... |
import math
import numpy as np
from scipy.sparse import csc_matrix
def lag(mat, lagged, N, lag_number, fill=np.NaN):
height = int(mat.shape[0] / N)
for i in range(N):
start_row = i * height
end_row = start_row + height
mat_i = mat[start_row:end_row, :]
lagged_i = l... | [
"numpy.multiply",
"numpy.linalg.multi_dot",
"math.sqrt",
"numpy.zeros",
"numpy.empty",
"numpy.matmul",
"numpy.vstack",
"scipy.sparse.csc_matrix"
] | [((643, 690), 'numpy.zeros', 'np.zeros', (['(num_rows, num_cols)'], {'dtype': '"""float64"""'}), "((num_rows, num_cols), dtype='float64')\n", (651, 690), True, 'import numpy as np\n'), ((706, 753), 'numpy.zeros', 'np.zeros', (['(num_rows, num_cols)'], {'dtype': '"""float64"""'}), "((num_rows, num_cols), dtype='float64'... |
from __future__ import division
import os
import numpy as np
from fdint import fdk, ifd1h
from ifg.units_converter import SiAtomicConverter
from ifg.utils import dump_to_csv
THRESHOLD = 1e10
def _1d_call(func, array, *args, **kwargs):
return func(array.reshape(-1), *args, **kwargs).reshape(array.shape)
def ... | [
"numpy.sqrt",
"fdint.fdk",
"os.getcwd",
"ifg.units_converter.SiAtomicConverter",
"numpy.array",
"numpy.concatenate",
"numpy.meshgrid"
] | [((347, 360), 'fdint.fdk', 'fdk', (['k', 'array'], {}), '(k, array)\n', (350, 360), False, 'from fdint import fdk, ifd1h\n'), ((14594, 14625), 'ifg.units_converter.SiAtomicConverter', 'SiAtomicConverter', ([], {'from_si': '(True)'}), '(from_si=True)\n', (14611, 14625), False, 'from ifg.units_converter import SiAtomicCo... |
"""
Tests of neo.io.hdf5io_new
"""
import unittest
import sys
import numpy as np
from numpy.testing import assert_array_equal
from quantities import kHz, mV, ms, second, nA
try:
import h5py
HAVE_H5PY = True
except ImportError:
HAVE_H5PY = False
from neo.io.hdf5io import NeoHdf5IO
from neo.test.iotest.co... | [
"neo.io.hdf5io.NeoHdf5IO",
"numpy.arange",
"numpy.testing.assert_array_equal",
"unittest.skipUnless",
"numpy.array",
"neo.test.iotest.tools.get_test_file_full_path"
] | [((412, 459), 'unittest.skipUnless', 'unittest.skipUnless', (['HAVE_H5PY', '"""requires h5py"""'], {}), "(HAVE_H5PY, 'requires h5py')\n", (431, 459), False, 'import unittest\n'), ((789, 906), 'neo.test.iotest.tools.get_test_file_full_path', 'get_test_file_full_path', (['self.ioclass'], {'filename': 'self.files_to_test[... |
#!/usr/bin/env python
import numpy as np
import vtk
def mandelbrot_set(X, Y, maxiter, horizon=2.0):
C = X + Y[:, None]*1j
N = np.zeros(C.shape, dtype=int)
Z = np.zeros(C.shape, np.complex64)
for n in range(maxiter):
if n % (maxiter / 10) == 0:
print('progress: %d/%d' % (n, maxiter))
I = np.less(... | [
"vtk.vtkXMLPolyDataWriter",
"vtk.vtkCellArray",
"vtk.vtkPolyData",
"vtk.vtkPoints",
"numpy.linspace",
"numpy.zeros",
"vtk.vtkFloatArray",
"vtk.vtkDelaunay2D"
] | [((461, 507), 'numpy.linspace', 'np.linspace', (['(-2.25)', '(0.75)', 'nx'], {'dtype': 'np.float32'}), '(-2.25, 0.75, nx, dtype=np.float32)\n', (472, 507), True, 'import numpy as np\n'), ((512, 558), 'numpy.linspace', 'np.linspace', (['(-1.25)', '(1.25)', 'ny'], {'dtype': 'np.float32'}), '(-1.25, 1.25, ny, dtype=np.flo... |
import numpy as np
import pandas as pd
from scipy.special import boxcox1p, boxcox
"""
load data
"""
train = pd.read_csv('./data/train.csv')
test = pd.read_csv('./data/test.csv')
"""
fix salePrice skewness
"""
train["SalePrice"] = np.log1p(train["SalePrice"])
y_train_values = train.SalePrice.values
all_features_d... | [
"sklearn.preprocessing.LabelEncoder",
"scipy.special.boxcox1p",
"pandas.read_csv",
"sklearn.linear_model.Lasso",
"numpy.expm1",
"sklearn.metrics.mean_squared_error",
"pandas.get_dummies",
"numpy.log1p"
] | [((110, 141), 'pandas.read_csv', 'pd.read_csv', (['"""./data/train.csv"""'], {}), "('./data/train.csv')\n", (121, 141), True, 'import pandas as pd\n'), ((150, 180), 'pandas.read_csv', 'pd.read_csv', (['"""./data/test.csv"""'], {}), "('./data/test.csv')\n", (161, 180), True, 'import pandas as pd\n'), ((233, 261), 'numpy... |
# Copyright (C) 2021 Intel Corporation
#
# 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 wri... | [
"mmdet.apis.ote.apis.detection.ote_utils.get_task_class",
"mmcv.utils.get_logger",
"ote_sdk.entities.datasets.DatasetEntity",
"ote_sdk.entities.task_environment.TaskEnvironment",
"argparse.ArgumentParser",
"ote_sdk.entities.label_schema.LabelSchemaEntity.from_labels",
"ote_sdk.entities.image.Image",
"... | [((1535, 1560), 'mmcv.utils.get_logger', 'get_logger', ([], {'name': '"""sample"""'}), "(name='sample')\n", (1545, 1560), False, 'from mmcv.utils import get_logger\n'), ((1594, 1662), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Sample showcasing the new API"""'}), "(description='Sampl... |
import os
import numpy as np
import cv2 as cv
import random
import math
def read_image(img_path="", img_h=128, img_w=128):
image = cv.imread(img_path)
i_height = np.size(image, 0)
i_width = np.size(image, 1)
file_data = np.array(cv.imread(img_path))
if (file_data.any() != None):
... | [
"math.ceil",
"random.shuffle",
"numpy.size",
"os.path.join",
"numpy.array",
"os.path.basename",
"cv2.resize",
"cv2.imread",
"os.walk"
] | [((145, 164), 'cv2.imread', 'cv.imread', (['img_path'], {}), '(img_path)\n', (154, 164), True, 'import cv2 as cv\n'), ((181, 198), 'numpy.size', 'np.size', (['image', '(0)'], {}), '(image, 0)\n', (188, 198), True, 'import numpy as np\n'), ((214, 231), 'numpy.size', 'np.size', (['image', '(1)'], {}), '(image, 1)\n', (22... |
import pandas as pd
from flask import Flask, jsonify, request, Response
import pickle
import base64
import jsonpickle
import numpy as np
import cv2
import json
from PIL import Image
# app
app = Flask(__name__)
prototxt = 'model/bvlc_googlenet.prototxt'
model = 'model/bvlc_googlenet.caffemodel'
labels = 'model/synset... | [
"cv2.dnn.blobFromImage",
"cv2.imwrite",
"PIL.Image.open",
"flask.Flask",
"cv2.dnn.readNetFromCaffe",
"cv2.putText",
"numpy.argsort",
"numpy.array",
"flask.Response",
"jsonpickle.encode"
] | [((195, 210), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (200, 210), False, 'from flask import Flask, jsonify, request, Response\n'), ((518, 559), 'cv2.dnn.readNetFromCaffe', 'cv2.dnn.readNetFromCaffe', (['prototxt', 'model'], {}), '(prototxt, model)\n', (542, 559), False, 'import cv2\n'), ((811, 844),... |
# coding=utf-8
"""
This python script trains a ConvNet on CIFAR-10 with BinaryNet.
It should run for about 15 hours on a GeForce GTX 980 Ti GPU.
The final test error should be around 11.40%.
Source:
https://github.com/MatthieuCourbariaux/BinaryNet
"""
from __future__ import print_function
import lasagne
# spec... | [
"snntoolbox.datasets.utils.save_parameters",
"numpy.hstack",
"scripts.ann_architectures.BinaryConnect.binary_net.train",
"theano.tensor.argmax",
"lasagne.layers.MaxPool2DLayer",
"lasagne.layers.get_all_params",
"lasagne.updates.adam",
"numpy.multiply",
"theano.function",
"pylearn2.datasets.cifar10... | [((434, 465), 'theano.sandbox.cuda.use', 'theano.sandbox.cuda.use', (['"""gpu0"""'], {}), "('gpu0')\n", (457, 465), False, 'import theano\n'), ((1335, 1354), 'theano.tensor.tensor4', 't.tensor4', (['"""inputs"""'], {}), "('inputs')\n", (1344, 1354), True, 'import theano.tensor as t\n'), ((1368, 1387), 'theano.tensor.ma... |
# -*- coding: utf-8 -*-
import numpy as np
from ..signal import signal_merge
from ..signal import signal_distort
def eda_simulate(duration=10, length=None, sampling_rate=1000, noise=0.01,
scr_number=1, drift=-0.01, random_state=None):
"""Simulate Electrodermal Activity (EDA) signal.
Generat... | [
"numpy.random.normal",
"numpy.abs",
"numpy.convolve",
"numpy.round",
"numpy.max",
"numpy.exp",
"numpy.sum",
"numpy.linspace",
"numpy.random.seed",
"numpy.full",
"numpy.arange"
] | [((1570, 1598), 'numpy.random.seed', 'np.random.seed', (['random_state'], {}), '(random_state)\n', (1584, 1598), True, 'import numpy as np\n'), ((1748, 1768), 'numpy.full', 'np.full', (['length', '(1.0)'], {}), '(length, 1.0)\n', (1755, 1768), True, 'import numpy as np\n'), ((1867, 1919), 'numpy.linspace', 'np.linspace... |
"""
The module provides a convenient function to train CFPD model given right parameters
"""
from collections import defaultdict
import copy
import os
import sys
import time
from matplotlib import pyplot as plt
import numpy as np
import torch
from utils import makedir
def train_model(model, data_loaders, dataset_si... | [
"numpy.mean",
"matplotlib.pyplot.savefig",
"torch.set_grad_enabled",
"matplotlib.pyplot.plot",
"os.path.join",
"matplotlib.pyplot.clf",
"utils.makedir",
"numpy.max",
"os.path.dirname",
"collections.defaultdict",
"numpy.savetxt",
"torch.no_grad",
"time.time",
"matplotlib.pyplot.legend"
] | [((474, 498), 'utils.makedir', 'makedir', (['model_save_path'], {}), '(model_save_path)\n', (481, 498), False, 'from utils import makedir\n'), ((690, 701), 'time.time', 'time.time', ([], {}), '()\n', (699, 701), False, 'import time\n'), ((2669, 2680), 'time.time', 'time.time', ([], {}), '()\n', (2678, 2680), False, 'im... |
# File to plot the reconstruction error of the vaes in comparison to
# the mean of the slice values/ the intensity of the slices
import os
import numpy as np
import torch
import utils
from utils import tonp
import torch.distributions as dist
import matplotlib.pyplot as plt
import seaborn as sns
import yaml... | [
"yaml.full_load",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"os.path.join",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"torch.FloatTensor",
"torch.flatten",
"torch.device"
] | [((359, 437), 'os.path.join', 'os.path.join', (['""".."""', '""".."""', '"""small-results"""', '"""7.10.2021"""', '"""recon vs mean of vae"""'], {}), "('..', '..', 'small-results', '7.10.2021', 'recon vs mean of vae')\n", (371, 437), False, 'import os\n'), ((457, 507), 'os.path.join', 'os.path.join', (['"""logs"""', '"... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Implementation for Single Image Haze Removal Using Dark Channel Prior.
Reference:
http://research.microsoft.com/en-us/um/people/kahe/cvpr09/
http://research.microsoft.com/en-us/um/people/kahe/eccv10/
"""
import numpy as np
from PIL import Image
from guidedfilter impo... | [
"guidedfilter.guided_filter",
"PIL.Image.fromarray",
"numpy.minimum",
"numpy.full_like",
"numpy.asarray",
"numpy.ndindex",
"numpy.pad",
"numpy.zeros",
"numpy.min",
"numpy.maximum",
"numpy.zeros_like"
] | [((823, 882), 'numpy.pad', 'np.pad', (['I', '((w / 2, w / 2), (w / 2, w / 2), (0, 0))', '"""edge"""'], {}), "(I, ((w / 2, w / 2), (w / 2, w / 2), (0, 0)), 'edge')\n", (829, 882), True, 'import numpy as np\n'), ((896, 912), 'numpy.zeros', 'np.zeros', (['(M, N)'], {}), '((M, N))\n', (904, 912), True, 'import numpy as np\... |
import pandas as pd
import numpy as np
import scipy
from scipy.stats import laplace
def estimate_precsion(max, min ):
diff= 1/max
precision=(diff - min) / (max - min)
return precision
def match_vals(row, cumsum, precision):
cdf=float(cumsum[cumsum.index==row['relative_time']])
#cdf plus
v... | [
"pandas.Series",
"scipy.stats.laplace.rvs",
"pandas.DataFrame.from_records",
"numpy.unique",
"numpy.log"
] | [((2741, 2781), 'numpy.unique', 'np.unique', (['norm_vals'], {'return_counts': '(True)'}), '(norm_vals, return_counts=True)\n', (2750, 2781), True, 'import numpy as np\n'), ((2795, 2826), 'pandas.Series', 'pd.Series', ([], {'data': 'counts', 'index': 'x'}), '(data=counts, index=x)\n', (2804, 2826), True, 'import pandas... |
from astropy.io import fits
from imageCoCenter import imageCoCenter
from PoissonSolverFFT import PoissonSolverFFT
from PoissonSolverExp import PoissonSolverExp
from compensate import compensate
from ZernikeEval import ZernikeEval
from ZernikeAnnularEval import ZernikeAnnularEval
import copy
import numpy as np
from wcs... | [
"PoissonSolverFFT.PoissonSolverFFT",
"wcsSetup.wcsSetup",
"imageCoCenter.imageCoCenter",
"numpy.sum",
"numpy.zeros",
"PoissonSolverExp.PoissonSolverExp",
"numpy.rot90",
"copy.deepcopy",
"astropy.io.fits.open",
"numpy.concatenate",
"numpy.loadtxt",
"compensate.compensate"
] | [((1522, 1592), 'wcsSetup.wcsSetup', 'wcsSetup', (['I1', 'I1fldx', 'I1fldy', 'I2', 'I2fldx', 'I2fldy', 'instruFile', 'algoFile'], {}), '(I1, I1fldx, I1fldy, I2, I2fldx, I2fldy, instruFile, algoFile)\n', (1530, 1592), False, 'from wcsSetup import wcsSetup\n'), ((1611, 1649), 'numpy.zeros', 'np.zeros', (['(m.numTerms, m.... |
""" File with callback functions for NN training and testing """
import os
import json
import cv2
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.callbacks import Callback
from tools.images import postprocess_img, write_to_img
from tools.metrics import sigmoid_np
class LoggingCallback(Ca... | [
"numpy.clip",
"matplotlib.pyplot.imshow",
"numpy.abs",
"tools.images.write_to_img",
"json.dumps",
"os.path.join",
"tools.images.postprocess_img",
"numpy.squeeze",
"numpy.square",
"numpy.zeros",
"numpy.concatenate",
"cv2.cvtColor"
] | [((2537, 2589), 'numpy.zeros', 'np.zeros', ([], {'shape': '(*input_y.shape[:2], 3)', 'dtype': 'float'}), '(shape=(*input_y.shape[:2], 3), dtype=float)\n', (2545, 2589), True, 'import numpy as np\n'), ((2619, 2638), 'numpy.squeeze', 'np.squeeze', (['input_y'], {}), '(input_y)\n', (2629, 2638), True, 'import numpy as np\... |
""" Implementation of Cosmic RIM estimator"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
physical_devices = tf.config.experimental.list_physical_devices('GPU')
print(physical_devices)
assert len(physical_devices) > 0, "Not enough... | [
"tools.power",
"tensorflow.GradientTape",
"sys.path.append",
"tensorflow.random.normal",
"argparse.ArgumentParser",
"tensorflow.data.Dataset.from_tensor_slices",
"matplotlib.pyplot.plot",
"rim_utils.build_rim_parallel_single",
"numpy.linspace",
"tools.fftk",
"flowpm.linear_field",
"matplotlib.... | [((199, 250), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (243, 250), True, 'import tensorflow as tf\n'), ((362, 429), 'tensorflow.config.experimental.set_memory_growth', 'tf.config.experimental.set_memory_growth', (['physical... |
#!/usr/bin/env python3
import numpy as np
import os, os.path
import subprocess
def string_label_to_label_vector(label_string, outcome_maps):
label_vec = []
for label_val in label_string.split('#'):
(label, val) = label_val.split('=')
cur_map = outcome_maps[label]
label_ind = ... | [
"subprocess.check_output",
"numpy.zeros",
"os.path.join"
] | [((453, 495), 'subprocess.check_output', 'subprocess.check_output', (["['wc', data_file]"], {}), "(['wc', data_file])\n", (476, 495), False, 'import subprocess\n'), ((1400, 1433), 'numpy.zeros', 'np.zeros', (['(Y.shape[0], reqd_dims)'], {}), '((Y.shape[0], reqd_dims))\n', (1408, 1433), True, 'import numpy as np\n'), ((... |
import cv2
import os
import sys
import pickle
import numpy as np
from PIL import Image
sys.path.insert(0, '/Workspace-Github/face_recognition/code')
import opencv_tools
import keras
from keras.callbacks import ModelCheckpoint
from keras.models import Sequential
from keras.layers import Dense, Conv2D, MaxPooling2D, Drop... | [
"opencv_tools.detect_face_CV2",
"PIL.Image.fromarray",
"sys.path.insert",
"keras.layers.Conv2D",
"keras.layers.Flatten",
"keras.callbacks.ModelCheckpoint",
"keras.layers.MaxPooling2D",
"pickle.load",
"opencv_tools.draw_rectangle",
"keras.models.Sequential",
"keras.utils.to_categorical",
"openc... | [((87, 148), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/Workspace-Github/face_recognition/code"""'], {}), "(0, '/Workspace-Github/face_recognition/code')\n", (102, 148), False, 'import sys\n'), ((585, 599), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (596, 599), False, 'import pickle\n'), ((1190, 1242)... |
# coding=utf-8
"""
PYOPENGL-TOOLBOX FIGURES
Utilitary functions to draw figures in PyOpenGL.
MIT License
Copyright (c) 2015-2019 <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 re... | [
"OpenGL.GL.glDisable",
"OpenGL.GLUT.glutSolidOctahedron",
"OpenGL.GLUT.glutSolidCube",
"OpenGL.GL.glTranslate",
"math.sqrt",
"numpy.array",
"OpenGL.GL.glColor4fv",
"PyOpenGLtoolbox.geometry.draw_vertex_list_create_normal",
"OpenGL.GL.glEnableClientState",
"OpenGL.GL.glPushMatrix",
"OpenGL.GL.glV... | [((17113, 17137), 'PyOpenGLtoolbox.mathlib.Point3', 'Point3', (['(-1.0)', '(-1.0)', '(-1.0)'], {}), '(-1.0, -1.0, -1.0)\n', (17119, 17137), False, 'from PyOpenGLtoolbox.mathlib import Point3, _cos, _sin, Point2\n'), ((17146, 17169), 'PyOpenGLtoolbox.mathlib.Point3', 'Point3', (['(1.0)', '(-1.0)', '(-1.0)'], {}), '(1.0,... |
#!/usr/bin/env python
"""
This module provides classes to create phase diagrams.
"""
from __future__ import division
__author__ = "<NAME>"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "2.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Production"
__date__ = "Nov 25, 2012"
i... | [
"pymatgen.core.composition.Composition",
"pyhull.convex_hull.ConvexHull",
"collections.OrderedDict",
"numpy.where",
"pymatgen.phasediagram.entries.GrandPotPDEntry",
"numpy.linalg.det",
"numpy.array",
"numpy.dot",
"pymatgen.analysis.reaction_calculator.Reaction"
] | [((4092, 4106), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (4100, 4106), True, 'import numpy as np\n'), ((12583, 12608), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (12606, 12608), False, 'import collections\n'), ((4338, 4355), 'numpy.dot', 'np.dot', (['data', 'vec'], {}), '(data... |
import datetime
import pandas as pd
import numpy as np
import re
import os
def remove_blanks(df, col_name):
ctr = 0
working_df = pd.DataFrame(df)
# remove any blanks from the run
try:
while True:
value = working_df.at[ctr, col_name].lower()
if re.search("^blank\d*.*$", ... | [
"pandas.isnull",
"os.path.exists",
"datetime.datetime.strptime",
"datetime.datetime.today",
"numpy.isnan",
"pandas.DataFrame",
"pandas.isna",
"re.search"
] | [((138, 154), 'pandas.DataFrame', 'pd.DataFrame', (['df'], {}), '(df)\n', (150, 154), True, 'import pandas as pd\n'), ((650, 666), 'pandas.DataFrame', 'pd.DataFrame', (['df'], {}), '(df)\n', (662, 666), True, 'import pandas as pd\n'), ((1128, 1166), 'pandas.DataFrame', 'pd.DataFrame', (['new_row'], {'columns': 'col_lst... |
#!/usr/bin/env python
"""
Dispersion analysis of a heterogeneous finite scale periodic cell.
The periodic cell mesh has to contain two subdomains Y1 (with the cell ids 1),
Y2 (with the cell ids 2), so that different material properties can be defined
in each of the subdomains (see ``--pars`` option). The command line ... | [
"numpy.sqrt",
"sfepy.base.conf.dict_from_string",
"sfepy.solvers.ts.TimeStepper",
"sfepy.linalg.utils.output_array_stats",
"numpy.array",
"numpy.isfinite",
"sfepy.base.ioutils.remove_files_patterns",
"sfepy.base.base.Struct.__init__",
"sfepy.base.ioutils.ensure_path",
"numpy.linalg.norm",
"copy.... | [((4031, 4051), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (4046, 4051), False, 'import sys\n'), ((5102, 5210), 'sfepy.mechanics.units.apply_unit_multipliers', 'apply_unit_multipliers', (['pars', "['stress', 'one', 'density', 'stress', 'one', 'density']", 'unit_multipliers'], {}), "(pars, ['str... |
# export OPENBLAS_CORETYPE=ARMV8
import enum
import os
from re import X
from sre_constants import SUCCESS
import sys
import cv2
import math
import networktables
import torch
import torch.backends.cudnn as cudnn
import numpy as np
import time
from PIL import Image
from threading import Thread
from networktables import ... | [
"models.common.DetectMultiBackend",
"cv2.rectangle",
"sys.path.insert",
"flask.Flask",
"utils.general.check_img_size",
"math.sqrt",
"torch.from_numpy",
"numpy.array",
"networktables.NetworkTables.initialize",
"cv2.waitKey",
"math.isfinite",
"threading.Thread.sleep",
"networktables.NetworkTab... | [((459, 489), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./yolov5"""'], {}), "(0, './yolov5')\n", (474, 489), False, 'import sys\n'), ((665, 684), 'flask.Flask', 'Flask', (['"""frc vision"""'], {}), "('frc vision')\n", (670, 684), False, 'from flask import Flask, render_template, Response\n'), ((5538, 5573), 'n... |
""" Code generation for PyTorch C++ dispatched operators. """
import copy
import dataclasses
import itertools
import logging
import operator
import os
from typing import List, Tuple, Callable, Optional, Dict, Union
import dace.library
import numpy as np
import torch
from dace import dtypes as dt, data
from dace.codege... | [
"logging.getLogger",
"dace.codegen.prettycode.CodeIOStream",
"daceml.pytorch.dispatchers.common.get_arglist",
"itertools.chain",
"daceml.pytorch.environments.PyTorch.full_class_path",
"daceml.util.is_cuda",
"dace.dtypes.can_access",
"daceml.util.platform_library_name",
"copy.deepcopy",
"dace.codeg... | [((801, 828), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (818, 828), False, 'import logging\n'), ((7814, 7869), 'dace.dtypes.can_access', 'dt.can_access', (['dt.ScheduleType.GPU_Device', 'desc.storage'], {}), '(dt.ScheduleType.GPU_Device, desc.storage)\n', (7827, 7869), True, 'from da... |
from __future__ import division
import os,time,cv2
import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np
def lrelu(x):
return tf.maximum(x*0.2,x)
def identity_initializer():
def _initializer(shape, dtype=tf.float32, partition_info=None):
array = np.zeros(shape, dtype=float)... | [
"numpy.uint8",
"numpy.where",
"tensorflow.placeholder",
"tensorflow.Session",
"os.path.isdir",
"numpy.concatenate",
"tensorflow.maximum",
"tensorflow.square",
"tensorflow.train.AdamOptimizer",
"numpy.maximum",
"tensorflow.trainable_variables",
"numpy.tile",
"tensorflow.contrib.slim.batch_nor... | [((3477, 3542), 'os.system', 'os.system', (['"""nvidia-smi -q -d Memory |grep -A4 GPU|grep Free >tmp"""'], {}), "('nvidia-smi -q -d Memory |grep -A4 GPU|grep Free >tmp')\n", (3486, 3542), False, 'import os, time, cv2\n'), ((3651, 3670), 'os.system', 'os.system', (['"""rm tmp"""'], {}), "('rm tmp')\n", (3660, 3670), Fal... |
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import os
import glob
from scipy.stats import zscore
import importlib
import zipfile
import math
import utils
import scipy as sp
from scipy import io
import scipy.signal
from scipy.sparse.linalg import eigsh
import csv
impor... | [
"numpy.random.standard_normal",
"numpy.convolve",
"numpy.sqrt",
"numpy.log10",
"matplotlib.pyplot.ylabel",
"numpy.log",
"numpy.argsort",
"numpy.arange",
"matplotlib.pyplot.imshow",
"numpy.mean",
"matplotlib.pyplot.loglog",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.exp",
... | [((417, 440), 'cycler.cycler', 'cycler', ([], {'color': '"""bgrcmyk"""'}), "(color='bgrcmyk')\n", (423, 440), False, 'from cycler import cycler\n'), ((485, 527), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': myfont}"], {}), "({'font.size': myfont})\n", (504, 527), True, 'from matplotlib i... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
import cv2
from scipy.stats import special_ortho_group as sog
##########################################################
dim = 20
N = 1000
alpha_vectors = np.zeros((N, dim))
for i in range(N):
alpha_vectors[i] = np.random.nor... | [
"matplotlib.pyplot.imshow",
"numpy.dstack",
"numpy.random.normal",
"sklearn.decomposition.PCA",
"scipy.stats.special_ortho_group.rvs",
"numpy.sum",
"numpy.zeros",
"numpy.matmul",
"cv2.cvtColor",
"cv2.imread",
"matplotlib.pyplot.show"
] | [((245, 263), 'numpy.zeros', 'np.zeros', (['(N, dim)'], {}), '((N, dim))\n', (253, 263), True, 'import numpy as np\n'), ((344, 356), 'scipy.stats.special_ortho_group.rvs', 'sog.rvs', (['dim'], {}), '(dim)\n', (351, 356), True, 'from scipy.stats import special_ortho_group as sog\n'), ((367, 394), 'numpy.matmul', 'np.mat... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for the mask module.
"""
import astropy.units as u
import numpy as np
from numpy.testing import assert_allclose, assert_almost_equal
import pytest
from ..bounding_box import BoundingBox
from ..circle import CircularAperture, CircularAnnulus
fro... | [
"numpy.ones",
"numpy.testing.assert_allclose",
"numpy.count_nonzero",
"pytest.mark.parametrize",
"numpy.array",
"numpy.zeros",
"pytest.raises",
"numpy.sum",
"numpy.isfinite",
"numpy.isnan",
"numpy.arange"
] | [((1832, 1878), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""position"""', 'POSITIONS'], {}), "('position', POSITIONS)\n", (1855, 1878), False, 'import pytest\n'), ((2221, 2267), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""position"""', 'POSITIONS'], {}), "('position', POSITIONS)\n", (224... |
# Thirdparty
import numpy as np
class Optimizer():
def __init__(self, **kwargs):
return
def update_weights(self, *args):
return
def update_bias(self, *args):
return
class MinibatchSgd(Optimizer):
def __init__(self, **kwargs):
super().__init__(**kwargs)
return... | [
"numpy.sqrt"
] | [((4167, 4187), 'numpy.sqrt', 'np.sqrt', (['v_corrected'], {}), '(v_corrected)\n', (4174, 4187), True, 'import numpy as np\n'), ((4663, 4683), 'numpy.sqrt', 'np.sqrt', (['v_corrected'], {}), '(v_corrected)\n', (4670, 4683), True, 'import numpy as np\n'), ((2524, 2543), 'numpy.sqrt', 'np.sqrt', (['self.cache'], {}), '(s... |
#!/user/bin/env python
'''tictactoe_ai.py: Implement an ai for the game of Tic-Tac-Toe.'''
################################################################################
from copy import deepcopy as copy
from numpy import random
import numpy as np
def random_ai(game):
return random.choice(game.get_action_list... | [
"numpy.random.choice",
"numpy.sum",
"copy.deepcopy",
"ultimate_tictactoe.Ultimate_TicTacToe"
] | [((433, 470), 'numpy.sum', 'np.sum', (['game.superboard[p_turn, :, :]'], {}), '(game.superboard[p_turn, :, :])\n', (439, 470), True, 'import numpy as np\n'), ((1019, 1039), 'ultimate_tictactoe.Ultimate_TicTacToe', 'Ultimate_TicTacToe', ([], {}), '()\n', (1037, 1039), False, 'from ultimate_tictactoe import Ultimate_TicT... |
#!/usr/bin/env python3
"""Postprocess for the example galaxy.
The PostBlobby3D class is very simple. However, it is useful for organisational
purposes of the Blobby3D output. In this script, I created a PostBlobby3D
object and plotted a handful of sample attributes.
@author: <NAME>
"""
import numpy as np
import mat... | [
"numpy.log10",
"pyblobby3d.PostBlobby3D",
"pyblobby3d.SpectralModel",
"dnest4.postprocess",
"matplotlib.pyplot.subplots"
] | [((438, 455), 'dnest4.postprocess', 'dn4.postprocess', ([], {}), '()\n', (453, 455), True, 'import dnest4 as dn4\n'), ((468, 603), 'pyblobby3d.PostBlobby3D', 'PostBlobby3D', ([], {'samples_path': '"""posterior_sample.txt"""', 'data_path': '"""data.txt"""', 'var_path': '"""var.txt"""', 'metadata_path': '"""metadata.txt"... |
import pickle
import re
import numpy as np
from matplotlib import pyplot as plt
from nltk import word_tokenize
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.linear_model import SGDClassifier
from s... | [
"numpy.mean",
"sklearn.feature_extraction.text.TfidfTransformer",
"sklearn.linear_model.SGDClassifier",
"nltk.corpus.stopwords.words",
"sklearn.feature_extraction.text.CountVectorizer",
"sklearn.naive_bayes.MultinomialNB",
"re.sub"
] | [((1364, 1399), 'numpy.mean', 'np.mean', (['(predictedNB == YtestVector)'], {}), '(predictedNB == YtestVector)\n', (1371, 1399), True, 'import numpy as np\n'), ((1977, 2013), 'numpy.mean', 'np.mean', (['(predictedSVM == YtestVector)'], {}), '(predictedSVM == YtestVector)\n', (1984, 2013), True, 'import numpy as np\n'),... |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# #### Hi al... | [
"numpy.abs",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.log",
"sklearn.preprocessing.PowerTransformer",
"pandas.set_option",
"sklearn.preprocessing.StandardScaler",
"plotly.graph_objects.Figure",
"seaborn.boxplot",
"seaborn.kdeplot",
"sklearn.preprocessing.QuantileTran... | [((1139, 1169), 'pandas.read_csv', 'pd.read_csv', (['"""input/train.csv"""'], {}), "('input/train.csv')\n", (1150, 1169), True, 'import pandas as pd\n'), ((1205, 1247), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (1218, 1247), True, 'import panda... |
import sys
import cv2
import numpy as np
from PyQt4 import QtGui, QtCore, Qt
from mainWindow_view import Ui_FaceDetector
from settings_view import Ui_Settings
import facenet
class Video():
def __init__(self,capture, facenet):
self.capture = capture
self.currentFrame=np.array([])
self.facene... | [
"PyQt4.QtGui.QImage",
"PyQt4.QtGui.QApplication",
"facenet.Facenet",
"PyQt4.QtCore.QTimer",
"PyQt4.QtGui.QFileDialog.getOpenFileName",
"numpy.array",
"PyQt4.QtGui.QPixmap.fromImage",
"PyQt4.QtGui.QWidget.__init__",
"cv2.VideoCapture",
"cv2.cvtColor",
"mainWindow_view.Ui_FaceDetector",
"cv2.imr... | [((4996, 5024), 'PyQt4.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (5014, 5024), False, 'from PyQt4 import QtGui, QtCore, Qt\n'), ((288, 300), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (296, 300), True, 'import numpy as np\n'), ((2194, 2216), 'cv2.imread', 'cv2.imread', (['""... |
#!/usr/bin/env python
# Copyright (c) 2014-2018 <NAME>, Ph.D.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the fo... | [
"numpy.atleast_2d",
"astropy.coordinates.ICRS",
"astropy.coordinates.EarthLocation",
"math.tan",
"astropy.coordinates.Angle",
"math.degrees",
"numpy.column_stack",
"math.radians",
"math.cos",
"astropy.time.Time",
"numpy.empty_like",
"math.atan2",
"copy.deepcopy",
"math.hypot",
"math.sin"... | [((4744, 4755), 'math.hypot', 'hypot', (['e', 'n'], {}), '(e, n)\n', (4749, 4755), False, 'from math import sin, cos, tan, sqrt, radians, hypot, degrees\n'), ((4773, 4784), 'math.hypot', 'hypot', (['r', 'u'], {}), '(r, u)\n', (4778, 4784), False, 'from math import sin, cos, tan, sqrt, radians, hypot, degrees\n'), ((479... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Functions to calculate frequency spectra."""
import copy
import warnings
import contextlib
import os
from stingray.gti import cross_gtis
from stingray.crossspectrum import AveragedCrossspectrum
from stingray.powerspectrum import AveragedPowerspectrum
f... | [
"numpy.log10",
"numpy.sqrt",
"stingray.utils.show_progress",
"copy.copy",
"os.path.exists",
"astropy.log.setLevel",
"argparse.ArgumentParser",
"numpy.searchsorted",
"numpy.asarray",
"numpy.max",
"stingray.gti.cross_gtis",
"numpy.rint",
"numpy.min",
"warnings.warn",
"numpy.size",
"os.pa... | [((3815, 3845), 'stingray.gti.cross_gtis', 'cross_gtis', (['[lc1.gti, lc2.gti]'], {}), '([lc1.gti, lc2.gti])\n', (3825, 3845), False, 'from stingray.gti import cross_gtis\n'), ((5697, 5740), 'stingray.gti.time_intervals_from_gtis', 'time_intervals_from_gtis', (['gti', 'chunk_length'], {}), '(gti, chunk_length)\n', (572... |
import theano
import theano.tensor as tensor
from util import ortho_weight, norm_weight, tanh, rectifier, linear
import numpy
from utils import _p
# LSTM layer
def param_init_lstm(options, params, prefix='lstm', nin=None, dim=None):
if nin is None:
nin = options['dim_proj']
if dim is None:
dim ... | [
"util.norm_weight",
"numpy.zeros",
"theano.tensor.alloc",
"utils._p",
"theano.tensor.tanh",
"util.ortho_weight"
] | [((701, 716), 'utils._p', '_p', (['prefix', '"""W"""'], {}), "(prefix, 'W')\n", (703, 716), False, 'from utils import _p\n'), ((966, 981), 'utils._p', '_p', (['prefix', '"""U"""'], {}), "(prefix, 'U')\n", (968, 981), False, 'from utils import _p\n'), ((997, 1012), 'utils._p', '_p', (['prefix', '"""b"""'], {}), "(prefix... |
# @author: <NAME>
import math
import numpy as np
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
class OpenGLManager:
""" General parameters """
display_size = (1400, 800) # Tamanho da janela a abrir
sphere_slices = 10 # Div... | [
"pygame.init",
"pygame.display.set_mode",
"pygame.display.flip",
"numpy.array",
"pygame.display.gl_set_attribute",
"pygame.display.set_caption"
] | [((2087, 2105), 'numpy.array', 'np.array', (['bg_color'], {}), '(bg_color)\n', (2095, 2105), True, 'import numpy as np\n'), ((2410, 2423), 'pygame.init', 'pygame.init', ([], {}), '()\n', (2421, 2423), False, 'import pygame\n'), ((2432, 2501), 'pygame.display.set_mode', 'pygame.display.set_mode', (['self.display_size', ... |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from uncertainties import ufloat
import uncertainties
from uncertainties.unumpy import uarray
from scipy.optimize import curve_fit
import os
# print("Cwd:", os.getcwd())
# print("Using matplotlibrc from ", mpl.matplotlib_fname())
fig = plt.f... | [
"scipy.optimize.curve_fit",
"numpy.isscalar",
"matplotlib.pyplot.errorbar",
"numpy.asarray",
"numpy.diag",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"sys.exit",
"uncertainties.unumpy.uarray"
] | [((315, 327), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (325, 327), True, 'import matplotlib.pyplot as plt\n'), ((336, 347), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (345, 347), True, 'import matplotlib.pyplot as plt\n'), ((633, 644), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (... |
'''
Define the function related with the Markov Chain Monter Carlo (MCMC) process.
'''
import numpy as np
import emcee
import time
import os
import git
path_git = git.Repo('.', search_parent_directories=True).working_tree_dir
path_datos_global = os.path.dirname(path_git)
def MCMC_sampler(log_probability, initial_val... | [
"numpy.abs",
"emcee.EnsembleSampler",
"os.chdir",
"os.path.dirname",
"emcee.backends.HDFBackend",
"git.Repo",
"numpy.all",
"time.time"
] | [((248, 273), 'os.path.dirname', 'os.path.dirname', (['path_git'], {}), '(path_git)\n', (263, 273), False, 'import os\n'), ((165, 210), 'git.Repo', 'git.Repo', (['"""."""'], {'search_parent_directories': '(True)'}), "('.', search_parent_directories=True)\n", (173, 210), False, 'import git\n'), ((1281, 1300), 'os.chdir'... |
import cv2
import numpy as np
def get_center_of_poly(pts):
# try:
# M = cv2.moments(pts)
# except:
M = cv2.moments(np.array([pts]))
centX = int(M["m10"] / M["m00"])
centY = int(M["m01"] / M["m00"])
return (centX, centY) | [
"numpy.array"
] | [((151, 166), 'numpy.array', 'np.array', (['[pts]'], {}), '([pts])\n', (159, 166), True, 'import numpy as np\n')] |
# ------------------------------------------------------------------------------
# Copyright (c) ETRI. All rights reserved.
# Licensed under the BSD 3-Clause License.
# This file is part of Youtube-Gesture-Dataset, a sub-project of AIR(AI for Robots) project.
# You can refer to details of AIR project at https://aiforro... | [
"numpy.sqrt",
"scipy.signal.savgol_filter",
"numpy.squeeze",
"numpy.array",
"numpy.sum",
"numpy.arctan2",
"numpy.isnan",
"numpy.rad2deg",
"scipy.stats.circvar"
] | [((638, 678), 'numpy.sqrt', 'np.sqrt', (['((x1 - x2) ** 2 + (y1 - y2) ** 2)'], {}), '((x1 - x2) ** 2 + (y1 - y2) ** 2)\n', (645, 678), True, 'import numpy as np\n'), ((1605, 1624), 'numpy.array', 'np.array', (['skeletons'], {}), '(skeletons)\n', (1613, 1624), True, 'import numpy as np\n'), ((4991, 5053), 'numpy.squeeze... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 28 11:04:08 2018
@author: antony
"""
import pandas as pd
import phenograph
import collections
import os
from sklearn.manifold import TSNE
from sklearn.cluster import KMeans
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
i... | [
"sklearn.cluster.KMeans",
"libcluster.make_figure",
"phenograph.cluster",
"pandas.read_csv",
"numpy.where",
"libcluster.format_simple_axes",
"matplotlib.colorbar.ColorbarBase",
"libcluster.invisible_axes",
"sklearn.manifold.TSNE",
"numpy.max",
"os.path.isfile",
"numpy.take",
"numpy.argsort",... | [((2005, 2096), 'pandas.DataFrame', 'pd.DataFrame', (["{'Barcode': headers, 'Cluster': labels, 'cluster_one_based': labels + 1}"], {}), "({'Barcode': headers, 'Cluster': labels, 'cluster_one_based': \n labels + 1})\n", (2017, 2096), True, 'import pandas as pd\n'), ((2607, 2660), 'pandas.DataFrame', 'pd.DataFrame', (... |
import sys
import numpy as np
import theano.tensor as T
from keras.layers import Input, Conv2D, Activation, Lambda, UpSampling2D, merge
from keras.models import Model
from keras.engine.topology import Layer
from neural_style.utils import floatX
class InstanceNormalization(Layer):
def __init__(self, **kwargs):
... | [
"keras.layers.Conv2D",
"sys.exit",
"keras.layers.UpSampling2D",
"keras.layers.Lambda",
"keras.layers.merge",
"numpy.floor",
"theano.tensor.cast",
"keras.layers.Input",
"theano.tensor.zeros",
"keras.models.Model",
"theano.tensor.set_subtensor",
"keras.layers.Activation",
"theano.tensor.square... | [((2957, 2986), 'keras.layers.merge', 'merge', (['[out, in_]'], {'mode': '"""sum"""'}), "([out, in_], mode='sum')\n", (2962, 2986), False, 'from keras.layers import Input, Conv2D, Activation, Lambda, UpSampling2D, merge\n'), ((3044, 3080), 'keras.layers.Input', 'Input', ([], {'tensor': 'X', 'shape': '(3, 256, 256)'}), ... |
import numpy as np
# With a Q-learning algorithm returns how good is each response.
def player0(data, Q, player, valid, learning_rate, feedback):
actual = Q[data[player][0]][data[player][1]][data[player][2] - 1][data[player][3]][
int(np.log2(data[player][4]))] # How much it weights the actual state.
... | [
"numpy.random.random",
"numpy.array",
"numpy.log2"
] | [((1902, 1920), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (1918, 1920), True, 'import numpy as np\n'), ((1847, 1873), 'numpy.array', 'np.array', (['[p0, p1, p2, p3]'], {}), '([p0, p1, p2, p3])\n', (1855, 1873), True, 'import numpy as np\n'), ((248, 272), 'numpy.log2', 'np.log2', (['data[player][4]'],... |
import matplotlib.pyplot as plot
import matplotlib.dates as md
from matplotlib.dates import date2num
import datetime
# from pylab import *
from numpy import polyfit
import numpy as np
f = open("deviations.csv")
values = []
timestamps = []
for (i, line) in enumerate(f):
if i >= 1:
lineArray = line.split(",... | [
"matplotlib.dates.date2num",
"matplotlib.pyplot.xticks",
"numpy.polyfit",
"datetime.datetime.strptime",
"matplotlib.pyplot.gca",
"matplotlib.dates.DateFormatter",
"numpy.poly1d",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.show"
] | [((541, 573), 'matplotlib.pyplot.subplots_adjust', 'plot.subplots_adjust', ([], {'bottom': '(0.2)'}), '(bottom=0.2)\n', (561, 573), True, 'import matplotlib.pyplot as plot\n'), ((574, 598), 'matplotlib.pyplot.xticks', 'plot.xticks', ([], {'rotation': '(25)'}), '(rotation=25)\n', (585, 598), True, 'import matplotlib.pyp... |
import abc
import typing
import numpy as np
class IResidualCalculator(metaclass=abc.ABCMeta):
@abc.abstractmethod
def calc(self, x: np.ndarray, y: np.ndarray, beta: np.ndarray) -> np.ndarray:
pass
class IJacobiMatElemCalculator(metaclass=abc.ABCMeta):
@abc.abstractmethod
def calc(self, x: n... | [
"numpy.identity",
"numpy.matmul"
] | [((4077, 4112), 'numpy.matmul', 'np.matmul', (['jacobi_mat_t', 'jacobi_mat'], {}), '(jacobi_mat_t, jacobi_mat)\n', (4086, 4112), True, 'import numpy as np\n'), ((4371, 4397), 'numpy.identity', 'np.identity', (['beta.shape[0]'], {}), '(beta.shape[0])\n', (4382, 4397), True, 'import numpy as np\n')] |
from datetime import datetime, timedelta
import numpy as np
import os
import matplotlib.pyplot as plt
import seaborn as sns
import sys
from os.path import dirname, abspath
sys.path.insert(0,dirname(dirname(dirname(abspath(__file__)))))
from fleet_request import FleetRequest
from grid_info import GridInfo
from fleets... | [
"datetime.datetime",
"os.path.join",
"numpy.fill_diagonal",
"seaborn.heatmap",
"numpy.multiply.outer",
"os.path.dirname",
"fleets.electric_vehicles_fleet.electric_vehicles_fleet.ElectricVehiclesFleet",
"fleet_request.FleetRequest",
"grid_info.GridInfo",
"datetime.timedelta",
"os.path.abspath",
... | [((509, 540), 'fleets.electric_vehicles_fleet.electric_vehicles_fleet.ElectricVehiclesFleet', 'ElectricVehiclesFleet', (['grid', 'ts'], {}), '(grid, ts)\n', (530, 540), False, 'from fleets.electric_vehicles_fleet.electric_vehicles_fleet import ElectricVehiclesFleet\n'), ((598, 619), 'datetime.timedelta', 'timedelta', (... |
# in shell
import os, sys
simfempypath = os.path.abspath(os.path.join(__file__, os.path.pardir, os.path.pardir, os.path.pardir, os.path.pardir,'simfempy'))
sys.path.insert(0,simfempypath)
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import pygmsh
from simfempy.applications.... | [
"pygmsh.geo.Geometry",
"sys.path.insert",
"simfempy.applications.navierstokes.NavierStokes",
"simfempy.applications.problemdata.ProblemData",
"os.path.join",
"simfempy.meshes.plotmesh.meshWithBoundaries",
"simfempy.meshes.plotmesh.meshWithData",
"simfempy.applications.stokes.Stokes",
"matplotlib.pyp... | [((156, 188), 'sys.path.insert', 'sys.path.insert', (['(0)', 'simfempypath'], {}), '(0, simfempypath)\n', (171, 188), False, 'import os, sys\n'), ((57, 160), 'os.path.join', 'os.path.join', (['__file__', 'os.path.pardir', 'os.path.pardir', 'os.path.pardir', 'os.path.pardir', '"""simfempy"""'], {}), "(__file__, os.path.... |
"""Module that contains the command line app."""
import click
import importlib
import numpy as np
import toml
from astropy.units import Quantity
from pathlib import Path
from rich import box
from rich.console import Console
from rich.panel import Panel
from rich.rule import Rule
from rich.table import Table
from time i... | [
"rich.table.Table.grid",
"importlib.import_module",
"pathlib.Path",
"click.option",
"rich.panel.Panel",
"rich.rule.Rule",
"rich.console.Console",
"click.Path",
"toml.load",
"numpy.savetxt",
"toml.TomlNumpyEncoder",
"click.Group",
"time.time",
"astropy.units.Quantity"
] | [((447, 465), 'rich.console.Console', 'Console', ([], {'width': '(100)'}), '(width=100)\n', (454, 465), False, 'from rich.console import Console\n'), ((1738, 1751), 'click.Group', 'click.Group', ([], {}), '()\n', (1749, 1751), False, 'import click\n'), ((2169, 2223), 'click.option', 'click.option', (['"""-l"""', '"""--... |
import random
import unittest
import numpy as np
import torch
from code_soup.common.utils import Seeding
class TestSeeding(unittest.TestCase):
"""Test the seed function."""
def test_seed(self):
"""Test that the seed is set."""
random.seed(42)
initial_state = random.getstate()
... | [
"numpy.random.get_state",
"random.seed",
"random.getstate",
"torch.get_rng_state",
"code_soup.common.utils.Seeding.seed"
] | [((256, 271), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (267, 271), False, 'import random\n'), ((296, 313), 'random.getstate', 'random.getstate', ([], {}), '()\n', (311, 313), False, 'import random\n'), ((322, 338), 'code_soup.common.utils.Seeding.seed', 'Seeding.seed', (['(42)'], {}), '(42)\n', (334, 338... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.