code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""
Supervised Reptile learning and evaluation on arbitrary
datasets.
"""
import random
import tensorflow as tf
import numpy as np
from variables import (interpolate_vars, average_vars, subtract_vars, add_vars, scale_vars,
VariableState)
class Reptile:
"""
A meta-learning session.
... | [
"variables.interpolate_vars",
"tensorflow.trainable_variables",
"tensorflow.Summary",
"tensorflow.get_collection",
"random.shuffle",
"variables.average_vars",
"numpy.mean",
"variables.scale_vars",
"variables.VariableState",
"numpy.concatenate"
] | [((11474, 11498), 'random.shuffle', 'random.shuffle', (['shuffled'], {}), '(shuffled)\n', (11488, 11498), False, 'import random\n'), ((12088, 12112), 'random.shuffle', 'random.shuffle', (['shuffled'], {}), '(shuffled)\n', (12102, 12112), False, 'import random\n'), ((929, 977), 'tensorflow.get_collection', 'tf.get_colle... |
# -*- coding: utf-8 -*-
"""
repair for disorientation and contiguity
- repair_diso_contig_from_outside_sym
attempts at repairing the stacking sequence to satisfy the disorientation
and contiguity rule for symmetric laminates with swaps performed inwardly
in the laminates
"""
__version__ = '1.0'
__author__ ... | [
"sys.path.append",
"numpy.delete",
"numpy.flip",
"src.disorientation.is_diso_ss",
"numpy.empty",
"src.repair_diso_contig_tools.initialise_repair_diso_contig",
"src.contiguity.is_contig",
"numpy.hstack",
"src.disorientation.is_diso",
"numpy.array",
"src.repair_diso_contig_tools.order_plies_to_tes... | [((380, 408), 'sys.path.append', 'sys.path.append', (['"""C:\\\\RELAY"""'], {}), "('C:\\\\RELAY')\n", (395, 408), False, 'import sys\n'), ((1390, 1466), 'src.repair_diso_contig_tools.initialise_repair_diso_contig', 'initialise_repair_diso_contig', (['ss', 'constraints'], {'from_inside': '(False)', 'n_D1': 'n_D1'}), '(s... |
import numpy as np
from random import randint, shuffle
from constants import *
from state import State
from mid import Mid
from card import Card
from hand import Hand
class Player:
def __init__(self, type=0, probability=0.5):
self.set_type(type)
self.set_probability(probability)
def set_type(s... | [
"random.shuffle",
"numpy.random.binomial",
"hand.Hand"
] | [((2533, 2551), 'random.shuffle', 'shuffle', (['to_choose'], {}), '(to_choose)\n', (2540, 2551), False, 'from random import randint, shuffle\n'), ((2251, 2283), 'numpy.random.binomial', 'np.random.binomial', (['(1)', 'self.p', '(1)'], {}), '(1, self.p, 1)\n', (2269, 2283), True, 'import numpy as np\n'), ((2828, 2839), ... |
"""
Copyright 2020 The OneFlow 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 applicable law or agr... | [
"numpy.abs",
"oneflow._C.one_embedding_id_shuffle",
"oneflow._C.identity",
"numpy.floor",
"numpy.allclose",
"numpy.ones",
"numpy.random.randint",
"oneflow.test_utils.test_util.GenArgDict",
"numpy.unique",
"unittest.main",
"numpy.full",
"numpy.random.rand",
"oneflow.unittest.skip_unless_1n2d"... | [((13125, 13157), 'oneflow.unittest.skip_unless_1n2d', 'flow.unittest.skip_unless_1n2d', ([], {}), '()\n', (13155, 13157), True, 'import oneflow as flow\n'), ((953, 1023), 'numpy.random.randint', 'np.random.randint', (['(0)', 'max_id', '(batch_size, num_tables)'], {'dtype': 'np.int64'}), '(0, max_id, (batch_size, num_t... |
# Lint as: python3
# Copyright 2021 The CARFAC Authors. All Rights Reserved.
#
# This file is part of an implementation of Lyon's cochlear model:
# "Cascade of Asymmetric Resonators with Fast-Acting Compression"
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | [
"numpy.abs",
"tensorflow.math.real",
"tensorflow.concat",
"tensorflow.constant",
"matplotlib.patches.Circle",
"tensorflow.cast",
"numpy.arange",
"tensorflow.TensorArray",
"numpy.linspace",
"tensorflow.math.divide_no_nan",
"tensorflow.math.maximum",
"tensorflow.math.imag",
"matplotlib.pyplot.... | [((2098, 2112), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (2110, 2112), True, 'import matplotlib.pyplot as plt\n'), ((2801, 2830), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (2813, 2830), True, 'import matplotlib.pyplot as plt\n'), ((4535, 45... |
import argparse
import os
import time
import re
from multiprocessing import cpu_count, Pool
from multiprocessing.pool import ThreadPool
from threading import Thread, Lock, Event
import socket
from io import BytesIO
import math
import ast
import traceback
import chainer
try:
import cupy as cp
from chainer.back... | [
"numpy.load",
"os.remove",
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.sum",
"numpy.triu",
"socket.socket",
"numpy.ones",
"cupy.random.normal",
"numpy.argsort",
"numpy.savez_compressed",
"numpy.mean",
"numpy.arange",
"numpy.linalg.norm",
"MC_auxiliary.transform_to_weights",
... | [((1129, 1135), 'threading.Lock', 'Lock', ([], {}), '()\n', (1133, 1135), False, 'from threading import Thread, Lock, Event\n'), ((6331, 6367), 'MC_auxiliary.transform_to_weights', 'transform_to_weights', (['args', 'mutation'], {}), '(args, mutation)\n', (6351, 6367), False, 'from MC_auxiliary import transform_to_weigh... |
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import MinMaxScaler
import numpy as np
import mahotas
import cv2
import os
import h5py
images_per_class = 80
train_path = "dataset/train"
h5_data = 'output/data.h5'
h5_labels = 'output/labels.h5'
bins = 8
# fea... | [
"h5py.File",
"mahotas.features.haralick",
"cv2.cvtColor",
"cv2.calcHist",
"numpy.unique",
"sklearn.preprocessing.MinMaxScaler",
"cv2.moments",
"sklearn.preprocessing.LabelEncoder",
"numpy.hstack",
"cv2.imread",
"numpy.array",
"cv2.normalize",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((1270, 1292), 'os.listdir', 'os.listdir', (['train_path'], {}), '(train_path)\n', (1280, 1292), False, 'import os\n'), ((388, 427), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (400, 427), False, 'import cv2\n'), ((619, 658), 'cv2.cvtColor', 'cv2.cvtColor', (... |
from ftplib import FTP
import sys
import os
import glob
import numpy as np
import re
import xarray as xr
import datetime as dt
def get_ftp_files():
server_url = 'ftp.remss.com'
ftp = FTP(server_url)
ftp.login(user=r'<EMAIL>')#, passwd=r'<EMAIL>')
for year in ['2014', '2016']:
ftp.cwd(f'/ascat/m... | [
"os.path.basename",
"ssmi_proc.ssmi_daily_v7.SSMIdaily",
"numpy.allclose",
"ascat_daily.ASCATDaily",
"re.match",
"xarray.Dataset",
"amsr_proc.amsr2_daily.AMSR2daily",
"datetime.datetime.utcnow",
"numpy.arange",
"numpy.array",
"ftplib.FTP",
"os.path.join",
"os.listdir",
"sys.exit"
] | [((192, 207), 'ftplib.FTP', 'FTP', (['server_url'], {}), '(server_url)\n', (195, 207), False, 'from ftplib import FTP\n'), ((1279, 1291), 'xarray.Dataset', 'xr.Dataset', ([], {}), '()\n', (1289, 1291), True, 'import xarray as xr\n'), ((1469, 1481), 'numpy.arange', 'np.arange', (['(2)'], {}), '(2)\n', (1478, 1481), True... |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 10:34:34 2019
@author: Toonw
"""
import gaze_data_analyzer as gda
import numpy as np
# Run analyse on
type_of_cal = "default"
#type_of_cal = "custom_2p"
#type_of_cal = "custom_5p"
session_folders = ["ctrl_group_2_lasse", "ctrl_group_3_lukas", "ctrl_group_3_seb", ... | [
"gaze_data_analyzer.GazeDataAnalyzer",
"matplotlib.pyplot.figure",
"numpy.average",
"numpy.array"
] | [((630, 652), 'gaze_data_analyzer.GazeDataAnalyzer', 'gda.GazeDataAnalyzer', ([], {}), '()\n', (650, 652), True, 'import gaze_data_analyzer as gda\n'), ((1609, 1627), 'numpy.array', 'np.array', (['all_rmse'], {}), '(all_rmse)\n', (1617, 1627), True, 'import numpy as np\n'), ((1989, 2019), 'matplotlib.pyplot.figure', 'p... |
#
# summarize assignment variables (Mono, Fact-combined)
#
import sys, os
from argparse import ArgumentParser
import codecs
import numpy as np
sys.path.insert(1, os.path.join(sys.path[0], os.path.pardir))
from json_utils import load_json_file, load_json_stream
def fix_order(abc):
# NOTE: data order: R, L, S and... | [
"sys.stdout.write",
"argparse.ArgumentParser",
"numpy.zeros",
"numpy.array",
"os.path.join"
] | [((163, 204), 'os.path.join', 'os.path.join', (['sys.path[0]', 'os.path.pardir'], {}), '(sys.path[0], os.path.pardir)\n', (175, 204), False, 'import sys, os\n'), ((352, 386), 'numpy.array', 'np.array', (['[abc[1], abc[2], abc[0]]'], {}), '([abc[1], abc[2], abc[0]])\n', (360, 386), True, 'import numpy as np\n'), ((413, ... |
"""Maximally mixed state."""
import numpy as np
from scipy import sparse
def max_mixed(dim: int, is_sparse: bool = False) -> [np.ndarray, sparse.dia.dia_matrix]:
r"""
Produce the maximally mixed state [AAR6]_.
Produces the maximally mixed state on of :code:`dim` dimensions. The maximally mixed state is
... | [
"numpy.eye",
"scipy.sparse.eye"
] | [((2098, 2109), 'numpy.eye', 'np.eye', (['dim'], {}), '(dim)\n', (2104, 2109), True, 'import numpy as np\n'), ((2061, 2076), 'scipy.sparse.eye', 'sparse.eye', (['dim'], {}), '(dim)\n', (2071, 2076), False, 'from scipy import sparse\n')] |
#!/usr/bin/env python
import open3d as o3d
import sys
import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
import torch
import imageio
path = "../ros_ws/src/gradslam_ros/data/explorer_x1_rgbd_traj/living_room_traj1_frei_png/"
ind = np.random.randint(575)
# ind = 12
color_img = imageio.imread(path... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"numpy.load",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"imageio.imread",
"open3d.visualization.draw_geometries",
"matplotlib.pyplot.figure",
"numpy.random.randint",
"open3d.geometry.PointCloud.create_from_rgbd_image",
"open3d.g... | [((255, 277), 'numpy.random.randint', 'np.random.randint', (['(575)'], {}), '(575)\n', (272, 277), True, 'import numpy as np\n'), ((301, 340), 'imageio.imread', 'imageio.imread', (["(path + f'rgb/{ind}.png')"], {}), "(path + f'rgb/{ind}.png')\n", (315, 340), False, 'import imageio\n'), ((399, 441), 'open3d.io.read_imag... |
import os
import open3d
import numpy as np
from dataset.semantic_dataset import SemanticFileData, SemanticDataset
import pykitti
class KittiFileData(SemanticFileData):
def __init__(self, points, box_size_x, box_size_y):
self.box_size_x = box_size_x
self.box_size_y = box_size_y
# Crop the ... | [
"numpy.zeros_like",
"open3d.crop_point_cloud",
"pykitti.raw",
"numpy.asarray",
"open3d.Vector3dVector",
"numpy.expand_dims",
"numpy.argsort",
"open3d.PointCloud"
] | [((618, 637), 'open3d.PointCloud', 'open3d.PointCloud', ([], {}), '()\n', (635, 637), False, 'import open3d\n'), ((659, 688), 'open3d.Vector3dVector', 'open3d.Vector3dVector', (['points'], {}), '(points)\n', (680, 688), False, 'import open3d\n'), ((710, 784), 'open3d.crop_point_cloud', 'open3d.crop_point_cloud', (['pcd... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class LinearRegressionClassifier(object):
def __init__(self):
self.alpha = 1e-2
self.iterations = 1000
self.losses = []
self.weights = None
self.bias = None
def forward(self, x):
retu... | [
"numpy.random.uniform",
"matplotlib.pyplot.show",
"numpy.sum",
"pandas.read_csv",
"numpy.square",
"numpy.array",
"numpy.dot",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((1755, 1819), 'pandas.read_csv', 'pd.read_csv', (['"""./data/iris.csv"""'], {'skiprows': '(1)', 'header': '(0)', 'names': 'cols'}), "('./data/iris.csv', skiprows=1, header=0, names=cols)\n", (1766, 1819), True, 'import pandas as pd\n'), ((2169, 2180), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (2177, 2180), Tru... |
import matplotlib.pyplot as plt
from PIL import Image
import segmentation
from os import path
import numpy as np
# read image
# ------------------------------------------------------- #
img = Image.open( path.join('test','test_image.png') )
pixels = img.load()
width, height = img.size
data = np.zeros((width,height),d... | [
"segmentation.run",
"numpy.zeros",
"os.path.join",
"matplotlib.pyplot.subplots"
] | [((295, 335), 'numpy.zeros', 'np.zeros', (['(width, height)'], {'dtype': '"""uint8"""'}), "((width, height), dtype='uint8')\n", (303, 335), True, 'import numpy as np\n'), ((434, 448), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (446, 448), True, 'import matplotlib.pyplot as plt\n'), ((695, 732), 'se... |
import unittest
from unittest import TestCase
from operator import le, gt
import pandas as pd
import numpy as np
from bartpy.data import Data, format_covariate_matrix
from bartpy.mutation import TreeMutation, PruneMutation
from bartpy.node import split_node, LeafNode, DecisionNode
from bartpy.tree import mutate, Tree... | [
"unittest.main",
"pandas.DataFrame",
"bartpy.tree.mutate",
"bartpy.split.Split",
"bartpy.node.LeafNode",
"bartpy.tree.Tree",
"bartpy.mutation.TreeMutation",
"numpy.array",
"bartpy.mutation.PruneMutation",
"bartpy.split.SplitCondition"
] | [((5665, 5680), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5678, 5680), False, 'import unittest\n'), ((598, 609), 'bartpy.split.Split', 'Split', (['data'], {}), '(data)\n', (603, 609), False, 'from bartpy.split import Split, SplitCondition\n'), ((625, 640), 'bartpy.node.LeafNode', 'LeafNode', (['split'], {}),... |
from time import sleep
from serial import Serial
import numpy as np
from math import fabs, radians
_MAX_DISTANCE_MM = 10000 # Maximum distance in mm
# Serial settings
_COM_PORT = "/dev/lidar"
_BAUDRATE = 115200
_SERIAL_TIMEOUT = 1
_READ_BATCH = 7944 # 360+1 degrees * 22 bytes per package
ser = Serial(_COM_PORT, b... | [
"serial.Serial",
"numpy.median",
"time.sleep"
] | [((301, 363), 'serial.Serial', 'Serial', (['_COM_PORT'], {'baudrate': '_BAUDRATE', 'timeout': '_SERIAL_TIMEOUT'}), '(_COM_PORT, baudrate=_BAUDRATE, timeout=_SERIAL_TIMEOUT)\n', (307, 363), False, 'from serial import Serial\n'), ((620, 631), 'time.sleep', 'sleep', (['(0.25)'], {}), '(0.25)\n', (625, 631), False, 'from t... |
import numpy as np
import gym
import gin
JOINT_LOWER_BOUND = -0.15
JOINT_UPPER_BOUND = 0.15
@gin.configurable
class JointOffsetWrapperEnv(gym.Wrapper):
"""A wrapped LocomotionGymEnv with a built-in trajectory generator."""
def __init__(self,
gym_env,
joint_lower_bound=JOINT_LOWER_BOUND,... | [
"numpy.random.uniform"
] | [((606, 703), 'numpy.random.uniform', 'np.random.uniform', (['self.joint_lower_bound', 'self.joint_upper_bound', 'self.env.robot.num_motors'], {}), '(self.joint_lower_bound, self.joint_upper_bound, self.env.\n robot.num_motors)\n', (623, 703), True, 'import numpy as np\n')] |
#!/usr/bin/env python
__author__ = '<NAME>'
__date__ = '2020-03-13'
__version__ = '0.0.1'
import argparse
import os
import csv
import random
import numpy as np
import pandas as pd
import scanpy as sc
import matplotlib as mpl
import matplotlib.pyplot as plt
# Set seed for reproducibility
seed_value = 0
# 0. Set `PYT... | [
"pandas.DataFrame",
"numpy.meshgrid",
"numpy.random.seed",
"argparse.ArgumentParser",
"matplotlib.lines.Line2D",
"scanpy.tl.dendrogram",
"os.getcwd",
"numpy.invert",
"numpy.asarray",
"scanpy.read_h5ad",
"numpy.where",
"random.seed",
"scanpy.tl.rank_genes_groups",
"pandas.concat"
] | [((486, 509), 'random.seed', 'random.seed', (['seed_value'], {}), '(seed_value)\n', (497, 509), False, 'import random\n'), ((568, 594), 'numpy.random.seed', 'np.random.seed', (['seed_value'], {}), '(seed_value)\n', (582, 594), True, 'import numpy as np\n'), ((1786, 1809), 'numpy.meshgrid', 'np.meshgrid', (['xidx', 'yid... |
import matplotlib.pyplot as plt
import numpy as np
from .._compat import Literal
from anndata import AnnData
from .. import tl
from . import base
from typing import Union, List, Collection, Callable
from .styling import _get_colors
from ..io._util import _check_upgrade_schema
@_check_upgrade_schema()
def spectratype(... | [
"numpy.zeros",
"numpy.repeat"
] | [((2676, 2712), 'numpy.repeat', 'np.repeat', (['data.index.values', 'counts'], {}), '(data.index.values, counts)\n', (2685, 2712), True, 'import numpy as np\n'), ((2763, 2775), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (2771, 2775), True, 'import numpy as np\n')] |
import numpy as np
from astropy import coordinates, table, units
import pandas as pd
try:
from cfod import catalog
data = catalog.as_dataframe()
except ImportError:
try:
data = pd.read_csv("/home/ubuntu/chimefrbcat1.csv")
print("read cfod catalog from disk")
except:
print("cfod ... | [
"cfod.catalog.as_dataframe",
"numpy.where",
"pandas.concat",
"pandas.read_csv"
] | [((131, 153), 'cfod.catalog.as_dataframe', 'catalog.as_dataframe', ([], {}), '()\n', (151, 153), False, 'from cfod import catalog\n'), ((1013, 1066), 'pandas.concat', 'pd.concat', (['[data_close, df_sep]'], {'join': '"""outer"""', 'axis': '(1)'}), "([data_close, df_sep], join='outer', axis=1)\n", (1022, 1066), True, 'i... |
"""
This module contains many scripts to do analysis on trajectories.
"""
def mda_janin_with_CSTV(u, selection):
"""
Takes in a MDAnalysis universe and a selection of that universe that contains
one or several aminoacids sharing resid and resname. It calculates the regular
Janin angles but if it is a ... | [
"matplotlib.pyplot.FuncFormatter",
"mdtraj.compute_dssp",
"numpy.zeros",
"numpy.split",
"MDAnalysis.Universe",
"os.path.isfile",
"numpy.array",
"numpy.linalg.norm",
"numpy.linspace",
"MDAnalysis.analysis.dihedrals.Janin",
"matplotlib.pyplot.subplots",
"numpy.unique",
"MDAnalysis.analysis.ali... | [((929, 958), 'numpy.unique', 'np.unique', (['selection.resnames'], {}), '(selection.resnames)\n', (938, 958), True, 'import numpy as np\n'), ((971, 998), 'numpy.unique', 'np.unique', (['selection.resids'], {}), '(selection.resids)\n', (980, 998), True, 'import numpy as np\n'), ((5327, 5347), 'os.path.isfile', 'os.path... |
'''
datecreated: 191119
objective: use naive bayes classifier to ID flowers in iris dataset based on 4
parameters. for more information see iris_nn.py. as a note, there are
three main kinds of naive bayes (NB) classifiers (esp used in scikit-learn):
- Gaussian NB
- binary (Bernoulli) NB
- multinomia... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.copy",
"numpy.argmax",
"numpy.zeros",
"numpy.array",
"numpy.exp",
"sklearn.metrics.confusion_matrix",
"numpy.random.shuffle"
] | [((1173, 1187), 'numpy.copy', 'np.copy', (['nparr'], {}), '(nparr)\n', (1180, 1187), True, 'import numpy as np\n'), ((1192, 1215), 'numpy.random.shuffle', 'np.random.shuffle', (['npa2'], {}), '(npa2)\n', (1209, 1215), True, 'import numpy as np\n'), ((4152, 4231), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([... |
import os
import time
import pandas as pd
import platform
import subprocess
import argparse
import sklearn
from sklearn import __version__ as sklearnver
from sklearn import metrics
import joblib
from sklearn.linear_model import LogisticRegression
import numpy as np
from fedml_azure import DbConnection
from sklearn.mo... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"os.makedirs",
"sklearn.model_selection.cross_val_score",
"joblib.dump",
"numpy.shape",
"sklearn.linear_model.LogisticRegression",
"fedml_azure.DbConnection",
"pandas.concat"
] | [((2471, 2496), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2494, 2496), False, 'import argparse\n'), ((3487, 3524), 'pandas.concat', 'pd.concat', (['[X_train, y_train]'], {'axis': '(1)'}), '([X_train, y_train], axis=1)\n', (3496, 3524), True, 'import pandas as pd\n'), ((3637, 3672), 'panda... |
"""
Ecotaxa Export
"""
import copy
import zipfile
import numpy as np
import pandas as pd
from skimage import img_as_ubyte
import os
import json
from morphocut.pipeline import NodeBase
def dtype_to_ecotaxa(dtype):
try:
if np.issubdtype(dtype, np.number):
return "[f]"
except TypeError:
... | [
"pandas.DataFrame",
"zipfile.ZipFile",
"copy.copy",
"skimage.img_as_ubyte",
"json.dumps",
"numpy.issubdtype"
] | [((237, 268), 'numpy.issubdtype', 'np.issubdtype', (['dtype', 'np.number'], {}), '(dtype, np.number)\n', (250, 268), True, 'import numpy as np\n'), ((1262, 1321), 'zipfile.ZipFile', 'zipfile.ZipFile', (['self.archive_fn', '"""w"""', 'zipfile.ZIP_DEFLATED'], {}), "(self.archive_fn, 'w', zipfile.ZIP_DEFLATED)\n", (1277, ... |
"""
Created on Sun Nov 10 16:25:58 2019
@author: <NAME>
"""
import argparse
import cProfile
from io import StringIO
import numpy as np
import pathlib
from peridynamics import OpenCLProbabilistic
from peridynamics.model import initial_crack_helper
from peridynamics.integrators import EulerStochastic
from pstats import ... | [
"os.mkdir",
"random_process.RandomProcess",
"peridynamics.integrators.EulerStochastic",
"numpy.sum",
"numpy.double",
"shutil.rmtree",
"numpy.power",
"numpy.zeros",
"peridynamics.OpenCLProbabilistic",
"numpy.intc",
"numpy.max",
"numpy.array",
"mcmc.get_fast_likelihood",
"pathlib.Path",
"n... | [((2872, 2934), 'numpy.zeros', 'np.zeros', (['(model.nnodes, model.degrees_freedom)'], {'dtype': 'np.intc'}), '((model.nnodes, model.degrees_freedom), dtype=np.intc)\n', (2880, 2934), True, 'import numpy as np\n'), ((2957, 3022), 'numpy.zeros', 'np.zeros', (['(model.nnodes, model.degrees_freedom)'], {'dtype': 'np.float... |
import gzip
import PIL
import numpy as np
import requests
from PIL import Image
from tensorflow.python.platform.gfile import GFile
from vae_ld.data import util, logger
from vae_ld.data.dataset import Data
class SmallNORB(Data):
"""SmallNORB dataset. Based on Locatello et al. [1] implementation
(https://gith... | [
"tensorflow.python.platform.gfile.GFile",
"numpy.frombuffer",
"numpy.zeros",
"vae_ld.data.util.StateSpaceAtomIndex",
"vae_ld.data.util.SplitDiscreteStateSpace",
"requests.get",
"numpy.column_stack",
"PIL.Image.fromarray",
"numpy.concatenate",
"vae_ld.data.logger.info"
] | [((1778, 1833), 'vae_ld.data.util.StateSpaceAtomIndex', 'util.StateSpaceAtomIndex', (['self._factors_shape', 'features'], {}), '(self._factors_shape, features)\n', (1802, 1833), False, 'from vae_ld.data import util, logger\n'), ((1861, 1938), 'vae_ld.data.util.SplitDiscreteStateSpace', 'util.SplitDiscreteStateSpace', (... |
import numpy as np
import pybri17
if __name__ == "__main__":
dim = 2
sym = (dim * (dim + 1)) // 2
shape = dim * (256,)
L = dim * (1.0,)
h = tuple(L_i / n_i for L_i, n_i in zip(L, shape))
patch_ratio = dim * (0.125,)
grid = pybri17.CartesianGrid2f64(shape, L)
μ = 1.0
ν = 0.3
hoo... | [
"numpy.zeros_like",
"pybri17.CartesianGrid2f64",
"pybri17.Hooke2f64",
"numpy.empty",
"numpy.zeros",
"numpy.sqrt"
] | [((253, 288), 'pybri17.CartesianGrid2f64', 'pybri17.CartesianGrid2f64', (['shape', 'L'], {}), '(shape, L)\n', (278, 288), False, 'import pybri17\n'), ((325, 354), 'pybri17.Hooke2f64', 'pybri17.Hooke2f64', (['μ', 'ν', 'grid'], {}), '(μ, ν, grid)\n', (342, 354), False, 'import pybri17\n'), ((367, 401), 'numpy.zeros', 'np... |
import numpy as np
import pytest
import torch
from mmcv.ops import boxes_iou_bev, nms_bev, nms_normal_bev
@pytest.mark.skipif(
not torch.cuda.is_available(), reason='requires CUDA support')
def test_boxes_iou_bev():
np_boxes1 = np.asarray(
[[1.0, 1.0, 3.0, 4.0, 0.5], [2.0, 2.0, 3.0, 4.0, 0.6],
... | [
"mmcv.ops.boxes_iou_bev",
"numpy.asarray",
"torch.cuda.is_available",
"numpy.array",
"torch.from_numpy"
] | [((239, 354), 'numpy.asarray', 'np.asarray', (['[[1.0, 1.0, 3.0, 4.0, 0.5], [2.0, 2.0, 3.0, 4.0, 0.6], [7.0, 7.0, 8.0, 8.0,\n 0.4]]'], {'dtype': 'np.float32'}), '([[1.0, 1.0, 3.0, 4.0, 0.5], [2.0, 2.0, 3.0, 4.0, 0.6], [7.0, 7.0,\n 8.0, 8.0, 0.4]], dtype=np.float32)\n', (249, 354), True, 'import numpy as np\n'), (... |
import os
import numpy as np
import cv2
root_path = "/home/liweiliang/project/pytorch-cifar/data/v/train/off/"
save_path = "/home/liweiliang/project/pytorch-cifar/data/h/train/off/"
if not os.path.exists(save_path):
os.makedirs(save_path)
for file_name in os.listdir(root_path):
image = cv2.imread(root_path +f... | [
"os.makedirs",
"cv2.imwrite",
"os.path.exists",
"cv2.imread",
"numpy.rot90",
"os.listdir"
] | [((262, 283), 'os.listdir', 'os.listdir', (['root_path'], {}), '(root_path)\n', (272, 283), False, 'import os\n'), ((191, 216), 'os.path.exists', 'os.path.exists', (['save_path'], {}), '(save_path)\n', (205, 216), False, 'import os\n'), ((222, 244), 'os.makedirs', 'os.makedirs', (['save_path'], {}), '(save_path)\n', (2... |
"""
Batch processing
"""
from __future__ import division
import logging
from os import path
import numpy as np
class BatchProcessorFactory(object):
"""Object to create BatchProcessor objects
Parameters
----------
path_to_file: str
Location of the binary file you want to process
dtype: st... | [
"numpy.concatenate",
"os.path.getsize",
"numpy.floor",
"numpy.dtype",
"numpy.zeros",
"numpy.append",
"numpy.fromstring",
"logging.getLogger"
] | [((2658, 2685), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2675, 2685), False, 'import logging\n'), ((3163, 3189), 'os.path.getsize', 'path.getsize', (['path_to_file'], {}), '(path_to_file)\n', (3175, 3189), False, 'from os import path\n'), ((5800, 5830), 'numpy.zeros', 'np.zeros', (... |
import json
import os
from pathlib import Path
import crowsetta
import joblib
import numpy as np
import pandas as pd
from tqdm import tqdm
import torch.utils.data
from .. import files
from .. import io
from .. import labeled_timebins
from ..logging import log_or_print
from .. import models
from .. import transforms
f... | [
"tqdm.tqdm",
"json.load",
"crowsetta.Sequence.from_keyword",
"crowsetta.csv.annot2csv",
"pandas.read_csv",
"os.getcwd",
"crowsetta.Annotation",
"pathlib.Path",
"numpy.squeeze",
"joblib.load"
] | [((6044, 6065), 'pandas.read_csv', 'pd.read_csv', (['csv_path'], {}), '(csv_path)\n', (6055, 6065), True, 'import pandas as pd\n'), ((3521, 3537), 'pathlib.Path', 'Path', (['output_dir'], {}), '(output_dir)\n', (3525, 3537), False, 'from pathlib import Path\n'), ((4052, 4082), 'joblib.load', 'joblib.load', (['spect_sca... |
r"""This module currently provides ample room for the Lorentz factor,
as it turned out we didn't really have much else of the relativistic
variety to add just yet! This is expected to change in the future.
"""
__all__ = [
"Lorentz_factor",
]
import numpy as np
from astropy import units as u
from astropy.constants... | [
"plasmapy.utils.decorators.validate_quantities",
"numpy.zeros_like",
"numpy.abs",
"plasmapy.utils.RelativityError"
] | [((418, 466), 'plasmapy.utils.decorators.validate_quantities', 'validate_quantities', ([], {'V': "{'can_be_negative': True}"}), "(V={'can_be_negative': True})\n", (437, 466), False, 'from plasmapy.utils.decorators import validate_quantities\n'), ((1796, 1914), 'plasmapy.utils.RelativityError', 'utils.RelativityError', ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 4 16:19:48 2020
@author: ggruszczynski
"""
import os
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
def fun(x):
return np.sin(x)
def f_prim_analytical(x):
return np.cos(x)
def central_fd(f,x,h):
f_prim = (f... | [
"matplotlib.pyplot.show",
"os.makedirs",
"numpy.logspace",
"matplotlib.pyplot.close",
"os.path.exists",
"matplotlib.pyplot.subplots",
"numpy.sin",
"matplotlib.pyplot.pause",
"numpy.cos",
"os.path.join",
"numpy.sqrt"
] | [((689, 713), 'numpy.logspace', 'np.logspace', (['(-10)', '(-1)', '(11)'], {}), '(-10, -1, 11)\n', (700, 713), True, 'import numpy as np\n'), ((1334, 1388), 'os.path.join', 'os.path.join', (['plot_dir', 'f"""calc_derivative_with_fd.png"""'], {}), "(plot_dir, f'calc_derivative_with_fd.png')\n", (1346, 1388), False, 'imp... |
########################################################################################################################
# importing stuff
########################################################################################################################
import numpy as np
import random
import logging
from myV... | [
"numpy.random.choice",
"matplotlib.pyplot.subplot",
"numpy.random.uniform",
"numpy.random.seed",
"matplotlib.pyplot.close",
"numpy.zeros",
"numpy.ones",
"logging.info",
"matplotlib.pyplot.figure",
"random.seed",
"numpy.exp",
"numpy.linspace",
"numpy.arange",
"matplotlib.pyplot.tight_layout... | [((2099, 2120), 'numpy.zeros', 'np.zeros', (['x1[0].shape'], {}), '(x1[0].shape)\n', (2107, 2120), True, 'import numpy as np\n'), ((2131, 2152), 'numpy.exp', 'np.exp', (['(x1[0] * alpha)'], {}), '(x1[0] * alpha)\n', (2137, 2152), True, 'import numpy as np\n'), ((2379, 2393), 'random.seed', 'random.seed', (['(0)'], {}),... |
import chess
import chess.pgn
import chess.svg
import cairosvg
from flask import Flask, Response, flash, request, redirect, url_for, send_file
from werkzeug.utils import secure_filename
import os
import io
#import tempfile
import cv2
import uuid
import numpy as np
UPLOAD_FOLDER = 'tmp'
ALLOWED_EXTENSIONS = {'pgn' }
... | [
"flask.flash",
"uuid.uuid4",
"chess.pgn.read_game",
"cv2.VideoWriter_fourcc",
"flask.redirect",
"os.path.join",
"flask.Flask",
"chess.svg.board",
"cv2.imdecode",
"werkzeug.utils.secure_filename",
"chess.Board",
"flask.send_file",
"flask.Response",
"numpy.fromstring",
"cairosvg.svg2png"
] | [((328, 343), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (333, 343), False, 'from flask import Flask, Response, flash, request, redirect, url_for, send_file\n'), ((558, 575), 'chess.Board', 'chess.Board', (['path'], {}), '(path)\n', (569, 575), False, 'import chess\n'), ((583, 611), 'chess.svg.board', ... |
"""
This file defines a class MicrogridEnv that wraps the Simulator in this package, so that it follows the
OpenAI gym (https://github.com/openai/gym) format.
"""
import gym
import numpy as np
from gym import spaces
from gym.utils import seeding
from microgridRLsimulator.simulate.simulator import Simulator
from micr... | [
"copy.deepcopy",
"numpy.random.seed",
"microgridRLsimulator.simulate.simulator.Simulator",
"numpy.array",
"gym.spaces.Box",
"gym.utils.seeding.np_random"
] | [((2386, 2428), 'gym.spaces.Box', 'spaces.Box', (['lower', 'upper'], {'dtype': 'np.float32'}), '(lower, upper, dtype=np.float32)\n', (2396, 2428), False, 'from gym import spaces\n'), ((2579, 2621), 'gym.spaces.Box', 'spaces.Box', (['lower', 'upper'], {'dtype': 'np.float32'}), '(lower, upper, dtype=np.float32)\n', (2589... |
from collections import OrderedDict
import numpy as np
import torch
from torch import nn
from lib.models.transformer import LeanTransformer, LeanTransformerConfig
class LayerNorm(nn.LayerNorm):
"""Subclass torch's LayerNorm to handle fp16."""
def forward(self, x: torch.Tensor):
orig_type = x.dtype
... | [
"torch.ones",
"numpy.log",
"torch.nn.Embedding",
"torch.nn.Conv2d",
"torch.empty",
"lib.models.transformer.LeanTransformer",
"torch.randn",
"torch.nn.init.normal_",
"torch.arange",
"torch.zeros"
] | [((727, 831), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': '(3)', 'out_channels': 'width', 'kernel_size': 'patch_size', 'stride': 'patch_size', 'bias': '(False)'}), '(in_channels=3, out_channels=width, kernel_size=patch_size, stride\n =patch_size, bias=False)\n', (736, 831), False, 'from torch import nn\n'),... |
# Exercise 5.10
# Author: <NAME>
import numpy as np
import matplotlib.pyplot as plt
import sys
g = 9.81
def y(t, v0):
return v0 * t - 0.5 * g * t ** 2
ax = plt.subplot(111)
plt.hold(1)
def plot_trajectory(v0):
tlist = np.linspace(0, 2 * v0 / g, 100)
ax.plot(tlist, y(tlist, v0))
ax.set_xlabel('time (... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.hold",
"matplotlib.pyplot.legend",
"numpy.array",
"numpy.linspace"
] | [((165, 181), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (176, 181), True, 'import matplotlib.pyplot as plt\n'), ((182, 193), 'matplotlib.pyplot.hold', 'plt.hold', (['(1)'], {}), '(1)\n', (190, 193), True, 'import matplotlib.pyplot as plt\n'), ((367, 405), 'numpy.array', 'np.array', (['sys.... |
import torch
from torch import nn
from torch.autograd import Variable
import numpy as np
import math
from common.arguments.basic_args import parse_args
from common.common_pytorch.model.srnet_utils.global_module import With_all_joints, With_other_joints
args = parse_args()
class FlexGroupLayer(nn.Module):
def __i... | [
"torch.nn.ModuleList",
"torch.autograd.Variable",
"torch.nn.Conv1d",
"torch.cat",
"common.common_pytorch.model.srnet_utils.global_module.With_all_joints",
"common.arguments.basic_args.parse_args",
"common.common_pytorch.model.srnet_utils.global_module.With_other_joints",
"numpy.array",
"numpy.reshap... | [((262, 274), 'common.arguments.basic_args.parse_args', 'parse_args', ([], {}), '()\n', (272, 274), False, 'from common.arguments.basic_args import parse_args\n'), ((3266, 3291), 'torch.nn.ModuleList', 'nn.ModuleList', (['group_conv'], {}), '(group_conv)\n', (3279, 3291), False, 'from torch import nn\n'), ((8210, 8233)... |
from typing import Dict
import torch
import pretty_midi as pm
import music21 as m21
import numpy as np
from datatypes import Chord, Pattern, Song
import chords
from device import device
from config import HuggingFaceConfig
import data
from preprocess_wikifonia import process_m21_part
def get_predict_mask(mask, mask_... | [
"numpy.sum",
"datatypes.Song",
"data.song_to_arrays",
"pretty_midi.drum_name_to_note_number",
"numpy.random.randint",
"pretty_midi.Note",
"pretty_midi.PrettyMIDI",
"numpy.random.choice",
"torch.zeros",
"pretty_midi.Instrument",
"music21.pitch.Pitch",
"numpy.ceil",
"pretty_midi.instrument_nam... | [((549, 569), 'torch.argsort', 'torch.argsort', (['(-vals)'], {}), '(-vals)\n', (562, 569), False, 'import torch\n'), ((6652, 6699), 'torch.zeros', 'torch.zeros', ([], {'size': '[num_beats]', 'dtype': 'torch.long'}), '(size=[num_beats], dtype=torch.long)\n', (6663, 6699), False, 'import torch\n'), ((11166, 11243), 'dat... |
# Copyright 2020 KCL-BMEIS - King's College London
# 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... | [
"h5py.special_dtype",
"exetera.core.operations.get_spans_for_field",
"numpy.argsort",
"exetera.core.data_writer.DataWriter.write",
"exetera.core.data_writer.DataWriter.flush",
"exetera.core.operations.apply_filter_to_index_values",
"exetera.core.validation.validate_and_normalize_categorical_key",
"exe... | [((41492, 41540), 'exetera.core.data_writer.DataWriter.write', 'DataWriter.write', (['field', '"""index"""', '[]', '(0)', '"""int64"""'], {}), "(field, 'index', [], 0, 'int64')\n", (41508, 41540), False, 'from exetera.core.data_writer import DataWriter\n'), ((41546, 41595), 'exetera.core.data_writer.DataWriter.write', ... |
import numpy as np
from scipy.special import binom
import pyqtgraph as pg
from PyQt5 import QtCore
from acconeer_utils.clients import SocketClient, SPIClient, UARTClient
from acconeer_utils.clients import configs
from acconeer_utils import example_utils
from acconeer_utils.pg_process import PGProcess, PGProccessDiedEx... | [
"numpy.abs",
"numpy.argmax",
"pyqtgraph.mkColor",
"numpy.ones",
"numpy.arange",
"numpy.exp",
"numpy.correlate",
"acconeer_utils.example_utils.SmoothMax",
"numpy.tile",
"numpy.sqrt",
"acconeer_utils.example_utils.config_logging",
"acconeer_utils.clients.configs.SparseServiceConfig",
"pyqtgrap... | [((457, 491), 'acconeer_utils.example_utils.config_logging', 'example_utils.config_logging', (['args'], {}), '(args)\n', (485, 491), False, 'from acconeer_utils import example_utils\n'), ((981, 1002), 'acconeer_utils.pg_process.PGProcess', 'PGProcess', (['pg_updater'], {}), '(pg_updater)\n', (990, 1002), False, 'from a... |
# Copyright 2019 MobiledgeX, Inc. All rights and licenses reserved.
# MobiledgeX, Inc. 156 2nd Street #408, San Francisco, CA 94105
#
# 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
#
# htt... | [
"os.remove",
"time.ctime",
"time.strftime",
"glob.glob",
"shutil.rmtree",
"cv2.cvtColor",
"os.path.exists",
"trainer.models.Owner.objects.get_or_create",
"trainer.models.Subject.objects.get_or_create",
"os.path.realpath",
"time.sleep",
"redis.StrictRedis",
"os.listdir",
"sys.exit",
"cv2.... | [((1249, 1276), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1266, 1276), False, 'import logging\n'), ((2423, 2516), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (["(self.working_dir + '/opencv-files/haarcascade_frontalface_alt.xml')"], {}), "(self.working_dir +\n '/opencv-file... |
"""
Email: <EMAIL>
Date: 2018/9/28
"""
import numpy as np
import pandas as pd
import torch
from torch.utils.data import DataLoader, Dataset
def get_json_data(file_name):
import ujson
return ujson.load(open(file_name, 'r'))
def get_yaml_data(file_name):
import yaml
return yaml.load(open(file_name, '... | [
"sklearn.preprocessing.StandardScaler",
"numpy.ceil",
"torch.utils.data.DataLoader",
"scipy.io.loadmat",
"pandas.read_csv",
"pandas.read_excel",
"numpy.array",
"numpy.loadtxt",
"torch.from_numpy"
] | [((612, 634), 'scipy.io.loadmat', 'sio.loadmat', (['file_name'], {}), '(file_name)\n', (623, 634), True, 'import scipy.io as sio\n'), ((757, 820), 'pandas.read_csv', 'pd.read_csv', (['file_name'], {'sep': 'sep', 'skiprows': 'skiprows', 'dtype': 'dtype'}), '(file_name, sep=sep, skiprows=skiprows, dtype=dtype)\n', (768, ... |
"""
Version: 1.0
Last modified on: 17 November, 2014
Developers: <NAME>, <NAME>.
email: eduardo_(DOT)_luis_(AT)_aluno_(DOT)_ufabc_(DOT)_edu_(DOT)_br
: folivetti_(AT)_ufabc_(DOT)_edu_(DOT)_br
Based on source-code by <NAME> and <NAME>
available at http://goanna.cs.rmit.edu.au/~xiaodong/cec15-niching... | [
"numpy.array"
] | [((519, 537), 'numpy.array', 'np.array', (['[-6, -6]'], {}), '([-6, -6])\n', (527, 537), True, 'import numpy as np\n'), ((554, 570), 'numpy.array', 'np.array', (['[6, 6]'], {}), '([6, 6])\n', (562, 570), True, 'import numpy as np\n')] |
from AList.AListReader import AListReader
from LDPC.EncoderLDPCFromH import EncoderLDPCFromH
from LDPC.DecoderLDPCProb import DecoderLDPCProb
from Channel.AWGN import AWGN
import numpy as np
import pdb
def simulation():
alist_text = ["7 3",
"3 4",
"1 1 2 2 3 2 1",
... | [
"AList.AListReader.AListReader",
"Channel.AWGN.AWGN.add_noise",
"numpy.random.binomial",
"LDPC.EncoderLDPCFromH.EncoderLDPCFromH",
"numpy.arange",
"LDPC.DecoderLDPCProb.DecoderLDPCProb",
"Channel.AWGN.AWGN.ebn0_to_sigma"
] | [((624, 637), 'AList.AListReader.AListReader', 'AListReader', ([], {}), '()\n', (635, 637), False, 'from AList.AListReader import AListReader\n'), ((969, 1000), 'LDPC.EncoderLDPCFromH.EncoderLDPCFromH', 'EncoderLDPCFromH', (['reader.matrix'], {}), '(reader.matrix)\n', (985, 1000), False, 'from LDPC.EncoderLDPCFromH imp... |
'''
Created on 26. 2. 2014
@author: Vancikv
'''
from traits.api import \
Float, Property, cached_property
import numpy as np
from .reinf_law_base import \
ReinfLawBase
class ReinfLawSteel(ReinfLawBase):
f_yk = Float(500., enter_set=True, auto_set=False, input=True)
E_s = Float(200000., enter_set=Tr... | [
"traits.api.Float",
"numpy.array",
"traits.api.Property"
] | [((227, 283), 'traits.api.Float', 'Float', (['(500.0)'], {'enter_set': '(True)', 'auto_set': '(False)', 'input': '(True)'}), '(500.0, enter_set=True, auto_set=False, input=True)\n', (232, 283), False, 'from traits.api import Float, Property, cached_property\n'), ((293, 352), 'traits.api.Float', 'Float', (['(200000.0)']... |
# Copyright (c) 2020 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 applic... | [
"utils.pearson",
"os.mkdir",
"numpy.random.seed",
"argparse.ArgumentParser",
"utils.mae",
"os.path.join",
"utils.sd",
"paddle.no_grad",
"paddle.optimizer.lr.PiecewiseDecay",
"random.seed",
"paddle.seed",
"paddle.set_device",
"tqdm.tqdm",
"dataset.ComplexDataset",
"pgl.utils.data.Dataload... | [((1004, 1020), 'paddle.seed', 'paddle.seed', (['(123)'], {}), '(123)\n', (1015, 1020), False, 'import paddle\n'), ((1117, 1133), 'paddle.no_grad', 'paddle.no_grad', ([], {}), '()\n', (1131, 1133), False, 'import paddle\n'), ((1072, 1092), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1086, 1092),... |
"""Implementation of dominant scale analysis techniques for python.
Loosely based on Matlab tool DSSRT. This module is incomplete and is
still a work in progress! See my publications on this subject for further
details.
<NAME>, 2009
"""
from __future__ import division, absolute_import, print_function
from PyDSTool ... | [
"numpy.argmax",
"numpy.allclose",
"PyDSTool.common.intersect",
"numpy.argmin",
"PyDSTool.parseUtils.symbolMapClass",
"numpy.argsort",
"six.moves.zip_longest",
"PyDSTool.common.invertMap",
"numpy.mean",
"PyDSTool.common.args",
"PyDSTool.Points.Pointset",
"PyDSTool.Symbolic.expr2fun",
"numpy.u... | [((23703, 23735), 'numpy.allclose', 'np.allclose', (['rat', 'eps'], {'atol': 'atol'}), '(rat, eps, atol=atol)\n', (23714, 23735), True, 'import numpy as np\n'), ((26355, 26370), 'numpy.argmax', 'np.argmax', (['slow'], {}), '(slow)\n', (26364, 26370), True, 'import numpy as np\n'), ((26384, 26399), 'numpy.argmin', 'np.a... |
from __future__ import print_function
import numpy as np, time
from . import utils
try: from . import _interpol_32, _interpol_64
except ImportError: pass
def map_coordinates(idata, points, odata=None, mode="spline", order=3, border="cyclic", trans=False, deriv=False,
prefilter=True):
"""An alternative implementatio... | [
"numpy.abs",
"numpy.empty",
"numpy.asfarray",
"numpy.asarray",
"numpy.zeros",
"numpy.unravel_index",
"numpy.floor",
"time.time",
"numpy.isnan",
"numpy.max",
"numpy.product",
"numpy.array",
"numpy.eye"
] | [((2601, 2618), 'numpy.asarray', 'np.asarray', (['idata'], {}), '(idata)\n', (2611, 2618), True, 'import numpy as np, time\n'), ((2630, 2648), 'numpy.asarray', 'np.asarray', (['points'], {}), '(points)\n', (2640, 2648), True, 'import numpy as np, time\n'), ((4942, 4956), 'numpy.array', 'np.array', (['data'], {}), '(dat... |
#
# extract and plot GMSL rate vs T values from AR5 and SROCC
#
# <NAME> 2021
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import hadcrut5
import pickle
from scipy.stats.stats import pearsonr
#--------------read google sheet:
sheet_id = '1b2CXW2D9ZFfJ4HDD42WpccF8xSzGVzzsEGie5yZBHCw'
shee... | [
"pandas.DataFrame",
"matplotlib.pyplot.annotate",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"numpy.polyfit",
"pandas.read_excel",
"matplotlib.pyplot.text",
"pickle.load",
"numpy.array",
"hadcrut5.getTstats",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabe... | [((494, 533), 'pandas.read_csv', 'pd.read_csv', (['url'], {'error_bad_lines': '(False)'}), '(url, error_bad_lines=False)\n', (505, 533), True, 'import pandas as pd\n'), ((581, 640), 'matplotlib.pyplot.scatter', 'plt.scatter', (["dfend['dT (GCM)']", "(dfend['Totals'] / 10)"], {'c': '"""k"""'}), "(dfend['dT (GCM)'], dfen... |
from logs import logDecorator as lD
import jsonref, os
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow import keras
from pathlib import Path
import cv2
config = jsonref.load(open("../config/config.json"))
logBase = config["logging"]["logBase"] + ".modules.predictClassifier.predictClassif... | [
"tensorflow.random.set_seed",
"numpy.stack",
"tensorflow.keras.models.load_model",
"pandas.read_csv",
"cv2.imread",
"pathlib.Path",
"logs.logDecorator.log",
"os.path.join",
"cv2.resize"
] | [((425, 450), 'logs.logDecorator.log', 'lD.log', (["(logBase + '.main')"], {}), "(logBase + '.main')\n", (431, 450), True, 'from logs import logDecorator as lD\n'), ((1578, 1631), 'pathlib.Path', 'Path', (["config_predictClassifier['to_predict_csv_path']"], {}), "(config_predictClassifier['to_predict_csv_path'])\n", (1... |
#! /bin/sh
""":"
exec ipython -i $0 ${1+"$@"}
"""
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import flow_load as fll
import matplotlib.cm as cm
from matplotlib.colors import LinearSegmentedColormap
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from scipy.signal import argrelextrem... | [
"numpy.load",
"numpy.maximum",
"cv2.VideoWriter_fourcc",
"matplotlib.cm.get_cmap",
"numpy.abs",
"numpy.argmax",
"numpy.logspace",
"numpy.floor",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.random.normal",
"cv2.VideoWriter",
"matplotlib.pyplot.tight_layout",
"numpy.nd... | [((809, 857), 'seaborn.color_palette', 'sns.color_palette', (['"""Set1"""'], {'n_colors': '(9)', 'desat': '(0.8)'}), "('Set1', n_colors=9, desat=0.8)\n", (826, 857), True, 'import seaborn as sns\n'), ((881, 927), 'seaborn.set_palette', 'sns.set_palette', (['"""Set1"""'], {'n_colors': '(9)', 'desat': '(0.8)'}), "('Set1'... |
# -*- coding: utf-8 -*-
"""
<NAME>
18/07/2018
Analysis of .mat Files of numerical vs analytical surface forces.
"""
import scipy.io as sio
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
plt.rc('text', usetex=True)
plt.rc('font', family='serif', size = 25)
plt.rcParams['text.latex.preamb... | [
"matplotlib.pyplot.tight_layout",
"numpy.abs",
"scipy.io.loadmat",
"matplotlib.pyplot.close",
"numpy.zeros",
"numpy.all",
"matplotlib.pyplot.colorbar",
"numpy.max",
"numpy.mean",
"numpy.arange",
"matplotlib.pyplot.rc",
"numpy.reshape",
"numpy.min",
"matplotlib.pyplot.subplots",
"matplotl... | [((219, 246), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (225, 246), True, 'import matplotlib.pyplot as plt\n'), ((247, 286), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""serif"""', 'size': '(25)'}), "('font', family='serif', size=25)\n", (2... |
#! /usr/bin/env python3
# -*- coding: utf8 -*-
from __future__ import division, print_function
"""
Base class for the openRetina
See https://github.com/laurentperrinet/openRetina
"""
__author__ = "(c) <NAME>, <NAME> & <NAME> INT - CNRS (2017-2018)"
import numpy as np
import zmq
import time
import sys
class PhotoRe... | [
"vispy.gloo.set_viewport",
"vispy.app.Timer",
"vispy.gloo.Program",
"numpy.frombuffer",
"numpy.empty",
"zmq.Context",
"openRetina.Canvas",
"vispy.app.run",
"time.sleep",
"time.time",
"vispy.gloo.clear",
"numpy.fliplr",
"cv2.VideoCapture",
"numpy.array",
"numpy.random.randint",
"vispy.a... | [((11949, 11960), 'time.time', 'time.time', ([], {}), '()\n', (11958, 11960), False, 'import time\n'), ((12277, 12287), 'sys.exit', 'sys.exit', ([], {}), '()\n', (12285, 12287), False, 'import sys\n'), ((14198, 14229), 'numpy.frombuffer', 'np.frombuffer', (['msg'], {'dtype': 'dtype'}), '(msg, dtype=dtype)\n', (14211, 1... |
import os
import pdb
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import seaborn.apionly as seaborn
from wqio import utils
def savefig(fig, figname, extra=None, asPNG=True, asPDF=False, load=False):
"""
Helper function to effectively save a figure.
Parameters
---------... | [
"wqio.utils.figutils.categorical_histogram",
"seaborn.apionly.factorplot",
"matplotlib.pyplot.close",
"numpy.hstack",
"scipy.stats.probplot",
"scipy.stats.norm.cdf",
"seaborn.apionly.pairplot",
"numpy.arange",
"matplotlib.pyplot.gca",
"wqio.utils.figutils.jointplot",
"os.path.join"
] | [((1087, 1116), 'os.path.join', 'os.path.join', (['"""output"""', '"""img"""'], {}), "('output', 'img')\n", (1099, 1116), False, 'import os\n'), ((1209, 1239), 'os.path.join', 'os.path.join', (['figpath', 'figname'], {}), '(figpath, figname)\n', (1221, 1239), False, 'import os\n'), ((1448, 1462), 'matplotlib.pyplot.clo... |
from PySide.QtCore import*
from PySide.QtGui import*
import pyaudio
import wave
import time
import numpy as np
from collections import OrderedDict
from filters import FilterType, Filter, FilterChain
from utility import byteToPCM, floatToPCM, pcmToFloat, sosfreqz, toPixelCords, fromPixelCords
filterTypes = OrderedDict(... | [
"wave.open",
"utility.byteToPCM",
"utility.sosfreqz",
"numpy.fft.rfft",
"utility.toPixelCords",
"numpy.abs",
"filters.FilterChain",
"numpy.int",
"pyaudio.PyAudio",
"filters.Filter",
"collections.OrderedDict",
"numpy.linspace",
"numpy.log10",
"utility.floatToPCM"
] | [((308, 607), 'collections.OrderedDict', 'OrderedDict', (["{FilterType.LPButter: 'Low Pass (Flat)', FilterType.LPBrickwall:\n 'Low Pass (Brickwall)', FilterType.HPButter: 'High Pass (Flat)',\n FilterType.HPBrickwall: 'High Pass (Brickwall)', FilterType.LShelving:\n 'Low Shelf', FilterType.HShelving: 'High Shel... |
import numpy as np
from ..metrics.cl_metrics import get_arr_multiseed
colors = ['#000000', '#696969', '#556b2f', '#8b4513',
'#483d8b', '#008000', '#000080', '#9acd32',
'#20b2aa', '#8b008b', '#ff0000', '#ffa500',
'#aaaa00', '#7cfc00', '#deb887', '#8a2be2',
'#00ff7f', '#dc143c'... | [
"numpy.arange"
] | [((706, 729), 'numpy.arange', 'np.arange', (['i', 'num_tasks'], {}), '(i, num_tasks)\n', (715, 729), True, 'import numpy as np\n'), ((1266, 1286), 'numpy.arange', 'np.arange', (['num_tasks'], {}), '(num_tasks)\n', (1275, 1286), True, 'import numpy as np\n')] |
from typing import Any
import numpy
from scipy.stats import skewnorm
from .PropertyGenerator import PropertyGenerator
class NormalNumberGenerator(PropertyGenerator):
def __init__(self, mean: float, deviation: float, skew: float = 0, return_int: bool = False):
"""
Init a NumberGenerator which wil... | [
"scipy.stats.skewnorm.rvs",
"numpy.asscalar"
] | [((894, 954), 'scipy.stats.skewnorm.rvs', 'skewnorm.rvs', (['self.skew'], {'loc': 'self.mean', 'scale': 'self.deviation'}), '(self.skew, loc=self.mean, scale=self.deviation)\n', (906, 954), False, 'from scipy.stats import skewnorm\n'), ((1069, 1094), 'numpy.asscalar', 'numpy.asscalar', (['generated'], {}), '(generated)... |
import numpy as np
import heapq
def fmm(f,x0,bmin,bmax,h):
"""Uses the Fast Marching Method to solve for the shortest paths from point
x0 to all points in a domain [bmin,bmax] under the incremental cost function
f(x).
The resulting cost field V(x) is the value function for the cost
$\min_y \int_0^... | [
"numpy.average",
"numpy.ceil",
"heapq.heappush",
"numpy.sum",
"numpy.floor",
"heapq.heappop",
"numpy.linalg.norm",
"numpy.array",
"numpy.dot"
] | [((1063, 1089), 'heapq.heappush', 'heapq.heappush', (['Q', '(0, i0)'], {}), '(Q, (0, i0))\n', (1077, 1089), False, 'import heapq\n'), ((1013, 1044), 'numpy.linalg.norm', 'np.linalg.norm', (['(x0 - x0_closest)'], {}), '(x0 - x0_closest)\n', (1027, 1044), True, 'import numpy as np\n'), ((1167, 1183), 'heapq.heappop', 'he... |
import pytest
import pandas as pd
import numpy as np
from nnaps.mesa import evolution_phases, fileio
class TestParametersProcessing:
def test_decompose_parameter(self):
pname, phase, func = evolution_phases.decompose_parameter('star_1_mass__init')
assert pname == 'star_1_mass'
assert p... | [
"nnaps.mesa.evolution_phases._return_function",
"nnaps.mesa.fileio.read_compressed_track",
"nnaps.mesa.evolution_phases.ML",
"pytest.raises",
"nnaps.mesa.evolution_phases.get_all_phases",
"numpy.array",
"numpy.arange",
"numpy.random.normal",
"nnaps.mesa.evolution_phases.MLstart",
"pytest.approx",
... | [((208, 265), 'nnaps.mesa.evolution_phases.decompose_parameter', 'evolution_phases.decompose_parameter', (['"""star_1_mass__init"""'], {}), "('star_1_mass__init')\n", (244, 265), False, 'from nnaps.mesa import evolution_phases, fileio\n'), ((404, 462), 'nnaps.mesa.evolution_phases.decompose_parameter', 'evolution_phase... |
import time
import logging
import os
import numpy as np
import torch
import torchvision
from torch import nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
import torch.distributed as dist
from tensorboardX import SummaryWriter
from collections import OrderedDict
import os.path as... | [
"torch.distributed.is_initialized",
"os.path.isfile",
"torch.distributed.get_world_size",
"logging.FileHandler",
"torch.distributed.get_rank",
"torch.load",
"os.path.dirname",
"os.path.exists",
"time.localtime",
"time.sleep",
"os.makedirs",
"logging.basicConfig",
"torch.save",
"torchvision... | [((1143, 1190), 'torch.load', 'torch.load', (['filename'], {'map_location': 'map_location'}), '(filename, map_location=map_location)\n', (1153, 1190), False, 'import torch\n'), ((2103, 2116), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2114, 2116), False, 'from collections import OrderedDict\n'), ((321... |
from tsetlinmachinecuda.tm import MultiClassConvolutionalTsetlinMachine2D
import numpy as np
from time import time
from keras.datasets import mnist
(X_train, Y_train), (X_test, Y_test) = mnist.load_data()
X_train = np.where(X_train >= 75, 1, 0)
X_test = np.where(X_test >= 75, 1, 0)
tm = MultiClassConvolutionalTse... | [
"keras.datasets.mnist.load_data",
"tsetlinmachinecuda.tm.MultiClassConvolutionalTsetlinMachine2D",
"time.time",
"numpy.savez_compressed",
"numpy.where"
] | [((189, 206), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (204, 206), False, 'from keras.datasets import mnist\n'), ((218, 247), 'numpy.where', 'np.where', (['(X_train >= 75)', '(1)', '(0)'], {}), '(X_train >= 75, 1, 0)\n', (226, 247), True, 'import numpy as np\n'), ((258, 286), 'numpy.where'... |
import deepchem as dc
from rdkit import Chem
import numpy as np
import pickle
import pandas as pd
def adj_list_to_adj_matrix(adj_list: list, max_num: int):
matrix = np.zeros(shape=(max_num, max_num), dtype=bool) # Minimizing data storage requirements.
for row in range(len(adj_list)):
for col in adj_l... | [
"numpy.pad",
"pickle.dump",
"pandas.read_csv",
"deepchem.feat.ConvMolFeaturizer",
"numpy.zeros",
"numpy.array",
"deepchem.feat.rdkit_grid_featurizer.compute_ecfp_features",
"rdkit.Chem.MolFromSmiles"
] | [((171, 217), 'numpy.zeros', 'np.zeros', ([], {'shape': '(max_num, max_num)', 'dtype': 'bool'}), '(shape=(max_num, max_num), dtype=bool)\n', (179, 217), True, 'import numpy as np\n'), ((426, 456), 'pandas.read_csv', 'pd.read_csv', (['"""../data/HIV.csv"""'], {}), "('../data/HIV.csv')\n", (437, 456), True, 'import panda... |
import numpy as np
import scipy as sp
from scipy import stats
from sklearn.neighbors import NearestNeighbors
class Density_Peaks_clustering:
def __init__(self,distances=None,indices=None,dens_type="eps",dc=None,percent=2.0):
self.distances = distances
self.indices = indices
self.dens_type=d... | [
"numpy.average",
"numpy.copy",
"numpy.zeros",
"numpy.transpose",
"numpy.argmin",
"numpy.argsort",
"numpy.max",
"numpy.min",
"numpy.arange",
"sklearn.neighbors.NearestNeighbors",
"numpy.exp"
] | [((972, 1010), 'numpy.average', 'np.average', (['self.distances[:, n_neigh]'], {}), '(self.distances[:, n_neigh])\n', (982, 1010), True, 'import numpy as np\n'), ((1023, 1046), 'numpy.zeros', 'np.zeros', (['data.shape[0]'], {}), '(data.shape[0])\n', (1031, 1046), True, 'import numpy as np\n'), ((1564, 1578), 'numpy.zer... |
# Python Packages
import json
# External Packages
import numpy as np
# Custom Packages
import tools
def gen_initial():
# Generate a random initial condition within limits
theta1, theta2 = np.random.uniform(-3*np.pi/2, 3*np.pi/2, 2)
v1, v2 = np.random.uniform(-0.2, 0.2, 2)
return [theta... | [
"json.dump",
"numpy.random.uniform",
"tools.load_config"
] | [((212, 263), 'numpy.random.uniform', 'np.random.uniform', (['(-3 * np.pi / 2)', '(3 * np.pi / 2)', '(2)'], {}), '(-3 * np.pi / 2, 3 * np.pi / 2, 2)\n', (229, 263), True, 'import numpy as np\n'), ((270, 301), 'numpy.random.uniform', 'np.random.uniform', (['(-0.2)', '(0.2)', '(2)'], {}), '(-0.2, 0.2, 2)\n', (287, 301), ... |
from skimage.color import rgb2lab, lab2rgb
from imageio import imread, imwrite
from CNN import FullNetwork
from PIL import Image
import tensorflow as tf
import numpy as np
import json
import sys
import os
def main(filename):
d = json.load(open('mapping.json'))
d = {v: k for k, v in d.items()}
print('Mapp... | [
"PIL.Image.new",
"numpy.argmax",
"imageio.imread",
"os.path.exists",
"numpy.expand_dims",
"numpy.clip",
"PIL.Image.open",
"skimage.color.lab2rgb",
"CNN.FullNetwork.model",
"numpy.array"
] | [((509, 535), 'PIL.Image.new', 'Image.new', (['"""L"""', '(224, 224)'], {}), "('L', (224, 224))\n", (518, 535), False, 'from PIL import Image\n'), ((632, 646), 'numpy.array', 'np.array', (['img1'], {}), '(img1)\n', (640, 646), True, 'import numpy as np\n'), ((797, 816), 'CNN.FullNetwork.model', 'FullNetwork.model', ([]... |
import face_model
import argparse
import cv2
import json
import sys
import numpy as np
parser = argparse.ArgumentParser(description='face model test')
# general
parser.add_argument('--image-size', default='112,112', help='')
parser.add_argument('--model', default='E:\insightface-master\models\model,00', help='path to ... | [
"argparse.ArgumentParser",
"numpy.square",
"json.dumps",
"cv2.imread",
"numpy.dot",
"face_model.FaceModel"
] | [((97, 151), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""face model test"""'}), "(description='face model test')\n", (120, 151), False, 'import argparse\n'), ((799, 825), 'face_model.FaceModel', 'face_model.FaceModel', (['args'], {}), '(args)\n', (819, 825), False, 'import face_model\... |
# Copyright 2020 Max Planck Institute for Software Systems
# 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 ... | [
"numpy.zeros_like",
"numpy.abs",
"numpy.logical_not",
"numpy.zeros",
"numpy.ones",
"numpy.clip",
"numpy.any",
"numpy.max",
"numpy.exp",
"numpy.random.normal",
"numpy.sign"
] | [((1233, 1254), 'numpy.zeros_like', 'np.zeros_like', (['images'], {}), '(images)\n', (1246, 1254), True, 'import numpy as np\n'), ((1598, 1618), 'numpy.zeros', 'np.zeros', (['imshape[0]'], {}), '(imshape[0])\n', (1606, 1618), True, 'import numpy as np\n'), ((712, 726), 'numpy.exp', 'np.exp', (['(lr * g)'], {}), '(lr * ... |
import numpy as np
import itertools
from pulp import LpMaximize, LpProblem, LpStatus, lpSum, LpVariable, LpMinimize
from pulp import GLPK
from pulp.apis import PULP_CBC_CMD
from sklearn.covariance import empirical_covariance
from scipy.stats import multivariate_normal
from sklearn.model_selection import train_test_... | [
"pulp.apis.PULP_CBC_CMD",
"sklearn.covariance.empirical_covariance",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"numpy.power",
"numpy.zeros",
"numpy.ma.masked_invalid",
"numpy.mean",
"ast.literal_eval",
"pulp.LpProblem",
"numpy.ascontiguousarray",
"numpy.sqrt"
] | [((802, 848), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X'], {'train_size': 'm', 'test_size': 'n'}), '(X, train_size=m, test_size=n)\n', (818, 848), False, 'from sklearn.model_selection import train_test_split\n'), ((7347, 7392), 'sklearn.covariance.empirical_covariance', 'empirical_covariance'... |
from itertools import product
import mltk
import numpy as np
import tensorkit as tk
from tensorkit import tensor as T
from tests.helper import *
class TensorStreamTestCase(TestCase):
def test_TensorStream(self):
x = np.random.randn(17, 3, 4)
y = np.random.randn(17, 5)
source = mltk.DataS... | [
"numpy.random.randn",
"numpy.random.RandomState",
"tensorkit.tensor.current_device",
"tensorkit.utils.as_tensor_stream",
"tensorkit.tensor.get_device"
] | [((232, 257), 'numpy.random.randn', 'np.random.randn', (['(17)', '(3)', '(4)'], {}), '(17, 3, 4)\n', (247, 257), True, 'import numpy as np\n'), ((270, 292), 'numpy.random.randn', 'np.random.randn', (['(17)', '(5)'], {}), '(17, 5)\n', (285, 292), True, 'import numpy as np\n'), ((1770, 1815), 'tensorkit.utils.as_tensor_s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/7/4 18:04
# @Author : dy
# @contact : <EMAIL>
# @File : test_pyvc_function.py
# @Desc :
import talib
from numpy import log, sqrt, double, isclose, ndarray, power
from pandas import read_excel
from pyflow.model import pyvc
data = read_excel("HS300.x... | [
"pyflow.model.pyvc.calc_hv_gk",
"talib.EMA",
"numpy.log",
"numpy.double",
"pandas.read_excel",
"pyflow.model.pyvc.calc_hv_pk",
"pyflow.model.pyvc.calc_hv_yz",
"pyflow.model.pyvc.calc_hv_rs",
"pyflow.model.pyvc.calc_hv_gkyz",
"pyflow.model.pyvc.calc_hv_cc_ema",
"numpy.sqrt"
] | [((301, 349), 'pandas.read_excel', 'read_excel', (['"""HS300.xlsx"""'], {'index_col': '"""Unnamed: 0"""'}), "('HS300.xlsx', index_col='Unnamed: 0')\n", (311, 349), False, 'from pandas import read_excel\n'), ((718, 768), 'numpy.log', 'log', (['(close[-shift_num:] / close[-shift_num - 1:-1])'], {}), '(close[-shift_num:] ... |
import unittest
import numpy as np
import pandas as pd
from hardy.arbitrage import transformations as tforms
class TestSimulationTools(unittest.TestCase):
def test_exp(self):
test_array = [1, 2, 3, 4, 5]
result = tforms.exp(test_array)
assert len(test_array) == len(result), "The return... | [
"pandas.DataFrame",
"hardy.arbitrage.transformations.derivative_2d",
"numpy.allclose",
"hardy.arbitrage.transformations.cumsum",
"hardy.arbitrage.transformations.reciprocal",
"hardy.arbitrage.transformations.log10",
"numpy.sin",
"numpy.linspace",
"hardy.arbitrage.transformations.cwt_1d",
"hardy.ar... | [((238, 260), 'hardy.arbitrage.transformations.exp', 'tforms.exp', (['test_array'], {}), '(test_array)\n', (248, 260), True, 'from hardy.arbitrage import transformations as tforms\n'), ((451, 475), 'hardy.arbitrage.transformations.log10', 'tforms.log10', (['test_array'], {}), '(test_array)\n', (463, 475), True, 'from h... |
"""
Demo 4: illustrate how to do a vertical interpolation, from sigma
coordinates to specified depths
"""
import numpy as np
import nctools as nct
import giga_tools as giga
import giga_subdomains as gs
import croco as croco
import vinterp
import matplotlib.pyplot as plt
import matplotlib.colorbar as cb
rc = plt.rc
fo... | [
"matplotlib.pyplot.title",
"croco.ncread",
"giga_subdomains.get_subds_from_block",
"matplotlib.colorbar.ColorbarBase.set_label",
"giga_tools.mount",
"numpy.asarray",
"croco.sigma2z",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.ion",
"croco.load_grid",
"matplotlib.pyplot.figure",
"vinterp.... | [((393, 402), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (400, 402), True, 'import matplotlib.pyplot as plt\n'), ((587, 617), 'giga_subdomains.get_subds_from_block', 'gs.get_subds_from_block', (['block'], {}), '(block)\n', (610, 617), True, 'import giga_subdomains as gs\n'), ((678, 755), 'croco.load_grid', '... |
"""
Author - <NAME>
This module provides various custom Bayesian
network topologies using the PyAgrum library.
"""
from abc import ABC, abstractmethod
import numpy as np
import pandas as pd
import pyAgrum as gum
from imblearn.metrics import classification_report_imbalanced
from sklearn.metrics import roc_auc_score
f... | [
"imblearn.metrics.classification_report_imbalanced",
"pyAgrum.BayesNet",
"pandas.read_csv",
"pyAgrum.BNLearner",
"sklearn.metrics.roc_auc_score",
"numpy.argsort",
"pyAgrum.lib.bn2roc.__computepoints",
"numpy.array"
] | [((902, 932), 'pyAgrum.BayesNet', 'gum.BayesNet', (['"""CustomBayesNet"""'], {}), "('CustomBayesNet')\n", (914, 932), True, 'import pyAgrum as gum\n'), ((1715, 1745), 'pyAgrum.BayesNet', 'gum.BayesNet', (['"""CustomBayesNet"""'], {}), "('CustomBayesNet')\n", (1727, 1745), True, 'import pyAgrum as gum\n'), ((3398, 3464)... |
import time
import contextlib
import numpy as np
import picamera
from picamera.array import PiRGBArray
RESOLUTION_WIDTH = 1280
RESOLUTION_HEIGHT = 720
FRAMERATE = 30
RESOLUTION = (RESOLUTION_WIDTH, RESOLUTION_HEIGHT)
class CameraImageWrapper:
def __init__(self, camera):
self.camera = camera
def get_... | [
"numpy.empty",
"time.sleep",
"picamera.array.PiRGBArray",
"picamera.PiCamera"
] | [((349, 418), 'numpy.empty', 'np.empty', (['(RESOLUTION_HEIGHT * RESOLUTION_WIDTH * 3,)'], {'dtype': 'np.uint8'}), '((RESOLUTION_HEIGHT * RESOLUTION_WIDTH * 3,), dtype=np.uint8)\n', (357, 418), True, 'import numpy as np\n'), ((647, 666), 'picamera.PiCamera', 'picamera.PiCamera', ([], {}), '()\n', (664, 666), False, 'im... |
# Libraries
import Levenshtein as lv
from difflib import SequenceMatcher
import string
import random
import pandas as pd
import numpy as np
import rdkit
from rdkit import Chem
from torch import matmul, rand, sspaddmm
import pandas as pd
import numpy as np
import seaborn as sns
from multiprocessing import Pool
from tabu... | [
"pandas.DataFrame",
"h5py.File",
"h5py.special_dtype",
"pandas.read_csv",
"rdkit.Chem.RenumberAtoms",
"numpy.shape",
"pandas.Series",
"Levenshtein.ratio",
"rdkit.Chem.MolToSmiles",
"pandas.concat",
"rdkit.Chem.MolFromSmiles",
"numpy.random.shuffle"
] | [((754, 775), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (765, 775), True, 'import pandas as pd\n'), ((916, 944), 'h5py.special_dtype', 'h5py.special_dtype', ([], {'vlen': 'str'}), '(vlen=str)\n', (934, 944), False, 'import h5py\n'), ((1278, 1291), 'pandas.Series', 'pd.Series', (['[]'], {}), ... |
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import math
################################################################################
def convert_to_gray_scale_arr(filename):
image_gray = Image.open(filename).convert('RGB').convert('L')
gray_scale = np.array(image_gray)
ret... | [
"matplotlib.pyplot.show",
"math.sqrt",
"numpy.zeros",
"PIL.Image.open",
"matplotlib.pyplot.figure",
"numpy.array"
] | [((292, 312), 'numpy.array', 'np.array', (['image_gray'], {}), '(image_gray)\n', (300, 312), True, 'import numpy as np\n'), ((523, 562), 'numpy.zeros', 'np.zeros', (['(height, width, 3)'], {'dtype': 'int'}), '((height, width, 3), dtype=int)\n', (531, 562), True, 'import numpy as np\n'), ((875, 908), 'numpy.zeros', 'np.... |
import os
import sys
import yaml
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
from gssl import DATA_DIR
from gssl.datasets import load_dataset
from gssl.transductive_model import Model
from gssl.transductive_model_arxiv import ArxivModel
from gssl.tasks import evaluate_node_classification
from g... | [
"gssl.datasets.load_dataset",
"os.path.dirname",
"gssl.utils.seed",
"tqdm.auto.tqdm",
"numpy.arange",
"yaml.safe_load",
"pandas.DataFrame.from_records",
"gssl.tasks.evaluate_node_classification",
"os.path.join"
] | [((360, 366), 'gssl.utils.seed', 'seed', ([], {}), '()\n', (364, 366), False, 'from gssl.utils import seed\n'), ((667, 698), 'gssl.datasets.load_dataset', 'load_dataset', ([], {'name': 'dataset_name'}), '(name=dataset_name)\n', (679, 698), False, 'from gssl.datasets import load_dataset\n'), ((715, 780), 'os.path.join',... |
import numpy as NP
# Stoer - Wagner minimal graph cut algorithm class.
# Reference: https://en.wikipedia.org/wiki/Stoer%E2%80%93Wagner_algorithm
class GRAPH_CUT_CLASS():
def __init__(self, i_matrix):
# super(GRAPH_CUT_CLASS, self).__init__() # No need, no parent.
# Checking that the graph matr... | [
"numpy.zeros"
] | [((10202, 10234), 'numpy.zeros', 'NP.zeros', (['(8, 8)'], {'dtype': 'NP.float'}), '((8, 8), dtype=NP.float)\n', (10210, 10234), True, 'import numpy as NP\n')] |
from __future__ import absolute_import, print_function
import codecs
import glob
import os
import os.path
import random as pyr
import re
from builtins import range, zip
import numpy as np
#import pylab
from . import paths, utils
# Copyright (c) 2017 NVIDIA CORPORATION. All rights reserved.
# See the LICENSE file fo... | [
"pylab.imread",
"os.path.abspath",
"codecs.open",
"os.path.join",
"numpy.amin",
"os.path.isdir",
"random.shuffle",
"os.path.dirname",
"os.path.exists",
"numpy.amax",
"numpy.mean",
"os.path.splitext",
"builtins.zip",
"glob.glob",
"builtins.range",
"re.sub"
] | [((866, 881), 'builtins.range', 'range', (['nrepeats'], {}), '(nrepeats)\n', (871, 881), False, 'from builtins import range, zip\n'), ((2409, 2427), 'os.path.isdir', 'os.path.isdir', (['top'], {}), '(top)\n', (2422, 2427), False, 'import os\n'), ((2599, 2612), 'builtins.range', 'range', (['epochs'], {}), '(epochs)\n', ... |
############################################################################
# This Python file is part of PyFEM, the code that accompanies the book: #
# #
# 'Non-Linear Finite Element Analysis of Solids and Structures' #
# <NA... | [
"scipy.special.orthogonal.p_roots",
"numpy.zeros",
"numpy.cross",
"scipy.linalg.inv",
"numpy.sin",
"numpy.linalg.norm",
"numpy.linalg.det",
"pyfem.util.shapeFunctions.getElemShapeData",
"numpy.cos",
"numpy.dot"
] | [((2518, 2532), 'numpy.linalg.norm', 'linalg.norm', (['a'], {}), '(a)\n', (2529, 2532), False, 'from numpy import zeros, dot, outer, ones, eye, sqrt, absolute, linalg, cos, sin, cross, nditer\n'), ((3474, 3493), 'numpy.zeros', 'zeros', ([], {'shape': '(4, 2)'}), '(shape=(4, 2))\n', (3479, 3493), False, 'from numpy impo... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.units import Quantity
import astropy.units as u
from ...utils.testing import assert_q... | [
"astropy.units.Quantity",
"uncertainties.unumpy.uarray",
"scipy.stats.gmean",
"astropy.units.Unit",
"numpy.logspace",
"uncertainties.unumpy.nominal_values",
"numpy.testing.assert_allclose",
"uncertainties.unumpy.std_devs",
"pytest.mark.xfail"
] | [((2408, 2481), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'reason': '"""Spectral models cannot handle ufuncs properly"""'}), "(reason='Spectral models cannot handle ufuncs properly')\n", (2425, 2481), False, 'import pytest\n'), ((772, 801), 'astropy.units.Quantity', 'Quantity', (['[1, 10, 100]', '"""TeV"""'], {})... |
import unittest
class TestRecommenderSystem(unittest.TestCase):
def test_consistency_neighborhood_based_with_random_data(self):
from datming.recommender import ItemBasedCF, UserBasedCF
from pyspark import SparkContext
import numpy as np
train_data = list(set([
tuple(np... | [
"unittest.main",
"pyspark.SparkContext.getOrCreate",
"datming.recommender.UserBasedCF.evaluate",
"numpy.random.randint",
"datming.recommender.ItemBasedCF.evaluate",
"datming.recommender.ItemBasedCF"
] | [((2033, 2048), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2046, 2048), False, 'import unittest\n'), ((1306, 1344), 'datming.recommender.UserBasedCF.evaluate', 'UserBasedCF.evaluate', (['result1', 'result2'], {}), '(result1, result2)\n', (1326, 1344), False, 'from datming.recommender import ItemBasedCF, UserB... |
# This file was forked and heavily modified from the file here:
# https://github.com/deepmind/spriteworld/blob/master/spriteworld/sprite.py
# Here is the license header for that file:
# Copyright 2019 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use t... | [
"numpy.array_equal",
"matplotlib.path.Path.intersects_path",
"numpy.square",
"numpy.cross",
"matplotlib.path.Path",
"numpy.array",
"numpy.linalg.norm",
"numpy.argwhere",
"collections.OrderedDict",
"numpy.concatenate",
"matplotlib.transforms.Affine2D"
] | [((7534, 7556), 'numpy.argwhere', 'np.argwhere', (['crossings'], {}), '(crossings)\n', (7545, 7556), True, 'import numpy as np\n'), ((7660, 7780), 'numpy.array', 'np.array', (['[(start_0[ind_0] + A[ind_0, ind_1] * (end_0[ind_0] - start_0[ind_0])) for \n ind_0, ind_1 in inds_crossings]'], {}), '([(start_0[ind_0] + A[... |
import os.path as op
from config import opts
from glob import glob
import pykitti
import cv2
import numpy as np
'''
References
https://github.com/opencv/opencv/blob/master/samples/python/opt_flow.py
def draw_flow(img, flow, step=16):
...
https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_vide... | [
"cv2.circle",
"numpy.count_nonzero",
"cv2.polylines",
"cv2.cvtColor",
"numpy.square",
"cv2.imread",
"numpy.int32",
"glob.glob",
"cv2.calcOpticalFlowFarneback",
"os.path.join",
"numpy.vstack",
"numpy.sqrt"
] | [((2983, 3004), 'numpy.int32', 'np.int32', (['(lines + 0.5)'], {}), '(lines + 0.5)\n', (2991, 3004), True, 'import numpy as np\n'), ((3015, 3052), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_GRAY2BGR'], {}), '(img, cv2.COLOR_GRAY2BGR)\n', (3027, 3052), False, 'import cv2\n'), ((3057, 3098), 'cv2.polylines', 'cv... |
# standard imports
from landsat_metadata import landsat_metadata
from dnppy import solar
import arcpy
import datetime
import numpy as np
import math
import os
__all__ = ['surface_reflectance']
def surface_reflectance(meta_path, toa_folder, dem_path, dew_point, outdir = False, kt = 1.0):
"""
This function wi... | [
"os.path.abspath",
"math.exp",
"arcpy.sa.Exp",
"landsat_metadata.landsat_metadata",
"math.sin",
"dnppy.solar.solar",
"numpy.mean",
"math.cos",
"math.degrees",
"arcpy.sa.Raster",
"os.listdir"
] | [((3159, 3185), 'os.path.abspath', 'os.path.abspath', (['meta_path'], {}), '(meta_path)\n', (3174, 3185), False, 'import os\n'), ((3203, 3230), 'os.path.abspath', 'os.path.abspath', (['toa_folder'], {}), '(toa_folder)\n', (3218, 3230), False, 'import os\n'), ((3246, 3271), 'os.path.abspath', 'os.path.abspath', (['dem_p... |
import numpy as np
import os.path
#------- save the array into file -------
def savedata(M,filename):
np.save(filename+'.npy', M)
return 0
#------- load the array from the file -------
def loaddata(filename):
M = np.load(filename+'.npy',allow_pickle=True)
return M
#-------- check if the file exists... | [
"numpy.load",
"numpy.save"
] | [((108, 137), 'numpy.save', 'np.save', (["(filename + '.npy')", 'M'], {}), "(filename + '.npy', M)\n", (115, 137), True, 'import numpy as np\n'), ((229, 274), 'numpy.load', 'np.load', (["(filename + '.npy')"], {'allow_pickle': '(True)'}), "(filename + '.npy', allow_pickle=True)\n", (236, 274), True, 'import numpy as np... |
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QMainWindow, QMenu, QVBoxLayout, QSizePolicy, QMessageBox, QWidget, QPushButton
from PyQt5.QtWidgets import QAction
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
import matplot... | [
"matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg.setSizePolicy",
"PyQt5.QtWidgets.QLabel",
"numpy.sum",
"PyQt5.QtWidgets.QWidget",
"sklearn.cluster.KMeans",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QInputDialog.getInt",
"PyQt5.QtWidgets.QLineEdit",
"matplotlib.backends.backend_qt5agg.Fig... | [((1447, 1460), 'PyQt5.QtWidgets.QWidget', 'QWidget', (['self'], {}), '(self)\n', (1454, 1460), False, 'from PyQt5.QtWidgets import QWidget\n'), ((1511, 1524), 'PyQt5.QtWidgets.QHBoxLayout', 'QHBoxLayout', ([], {}), '()\n', (1522, 1524), False, 'from PyQt5.QtWidgets import QHBoxLayout\n'), ((1859, 1883), 'PyQt5.QtWidge... |
# coding: utf-8
"""
Name: meteotool.py
functions.
Usage:
Author: <NAME>
Date: 2021/12/15
"""
import math
import numpy as np
import xarray as xr
import metpy.constants
import metpy.interpolate
from metpy.units import units
import metpy.calc as mpcalc
from ncmagics import readnc_world
class MeteoTools(readnc_world.C... | [
"metpy.calc.wet_bulb_temperature",
"metpy.calc.equivalent_potential_temperature",
"numpy.meshgrid",
"metpy.calc.gradient",
"math.radians",
"metpy.calc.height_to_pressure_std",
"numpy.zeros",
"metpy.calc.coriolis_parameter",
"metpy.calc.potential_temperature",
"metpy.calc.mixing_ratio_from_relative... | [((1415, 1433), 'numpy.array', 'np.array', (['ptl_temp'], {}), '(ptl_temp)\n', (1423, 1433), True, 'import numpy as np\n'), ((1913, 2034), 'metpy.calc.mixing_ratio_from_relative_humidity', 'mpcalc.mixing_ratio_from_relative_humidity', (['(isobaric_surface * units.hPa)', '(temp_c * units.celsius)', '(rh * units.percent)... |
import os
import sys
import time
import torch
import torch.nn as nn
import random
import numpy as np
import abc
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
DATA_ROOT = os.path.join(FILE_DIR, '../../data')
from .misc import Partition, get_all_losses, savefig
from .logger import AverageMeter, Logger
from .eval... | [
"os.path.abspath",
"numpy.random.seed",
"torch.manual_seed",
"torch.nn.CrossEntropyLoss",
"torch.set_default_tensor_type",
"time.time",
"torch.multiprocessing.set_start_method",
"torch.cuda.manual_seed_all",
"random.seed",
"torch.cuda.is_available",
"torch.device",
"torch.no_grad",
"os.path.... | [((179, 215), 'os.path.join', 'os.path.join', (['FILE_DIR', '"""../../data"""'], {}), "(FILE_DIR, '../../data')\n", (191, 215), False, 'import os\n'), ((140, 165), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (155, 165), False, 'import os\n'), ((951, 976), 'torch.cuda.is_available', 'torch.... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2022 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | [
"nicos_ess.devices.datasinks.imagesink.ImageKafkaDataSinkHandler.putResults",
"nicos.utils.byteBuffer",
"numpy.prod",
"time.time"
] | [((1893, 1953), 'nicos_ess.devices.datasinks.imagesink.ImageKafkaDataSinkHandler.putResults', 'ImageKafkaDataSinkHandler.putResults', (['self', 'quality', 'results'], {}), '(self, quality, results)\n', (1929, 1953), False, 'from nicos_ess.devices.datasinks.imagesink import ImageKafkaDataSink, ImageKafkaDataSinkHandler\... |
import numpy as np
from stats import neg_binomial
from model.tasks import RevLearn
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import seaborn as sns
sns.set(context = 'talk', style = 'ticks', color_codes=True)
flatui = ["#9b59b6", "#3498db", "#95a5a6", "#e74c3c", "#34495e", "#2ecc71"]
fr... | [
"plotting.plot_between_reversal_interval_distribution",
"model.tasks.RevLearn",
"numpy.zeros",
"numpy.ones",
"matplotlib.gridspec.GridSpec",
"matplotlib.pyplot.figure",
"numpy.arange",
"stats.neg_binomial",
"numpy.eye",
"seaborn.set_palette",
"seaborn.set"
] | [((179, 235), 'seaborn.set', 'sns.set', ([], {'context': '"""talk"""', 'style': '"""ticks"""', 'color_codes': '(True)'}), "(context='talk', style='ticks', color_codes=True)\n", (186, 235), True, 'import seaborn as sns\n'), ((1403, 1438), 'matplotlib.gridspec.GridSpec', 'gridspec.GridSpec', ([], {'nrows': '(2)', 'ncols'... |
#Ref: <NAME>
"""
https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_watershed/py_watershed.html
This code performs grain size distribution analysis and dumps results into a csv file.
It uses watershed segmentation for better segmentation.
Compare results to regular segmentation.
For ... | [
"numpy.uint8",
"cv2.subtract",
"skimage.color.label2rgb",
"cv2.dilate",
"cv2.cvtColor",
"cv2.morphologyEx",
"cv2.threshold",
"cv2.waitKey",
"numpy.ones",
"cv2.watershed",
"cv2.connectedComponents",
"cv2.imread",
"glob.glob",
"cv2.imshow",
"cv2.distanceTransform",
"skimage.measure.regio... | [((1667, 1682), 'glob.glob', 'glob.glob', (['path'], {}), '(path)\n', (1676, 1682), False, 'import glob\n'), ((1760, 1776), 'cv2.imread', 'cv2.imread', (['file'], {}), '(file)\n', (1770, 1776), False, 'import cv2\n'), ((1845, 1883), 'cv2.cvtColor', 'cv2.cvtColor', (['img1', 'cv2.COLOR_BGR2GRAY'], {}), '(img1, cv2.COLOR... |
import numpy as np
from math import floor,ceil
from numpy.ma import median
from numpy import mean,std
import os
from rectangle import generate_N_ractangles
#Calculates the maximun height in a strip
def max_height(elements,rectangles,rotation_list,it_rotates):
heigts = []
for i in elements:
height = re... | [
"rectangle.generate_N_ractangles",
"numpy.ma.median",
"numpy.random.seed",
"math.ceil",
"os.getcwd",
"numpy.std",
"numpy.zeros",
"numpy.mean",
"numpy.char.strip",
"os.chdir",
"numpy.random.shuffle"
] | [((678, 698), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (692, 698), True, 'import numpy as np\n'), ((843, 870), 'numpy.zeros', 'np.zeros', (['chromosome_length'], {}), '(chromosome_length)\n', (851, 870), True, 'import numpy as np\n'), ((976, 1006), 'numpy.random.shuffle', 'np.random.shuffle', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This code is based on https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/mixture/gmm.py code
# which is distributed under the new BSD license.
import numpy as np
import cPickle as pickle
from sklearn.utils.extmath import logsumexp
EPS = np.finfo(float).e... | [
"numpy.sum",
"numpy.log",
"sklearn.utils.extmath.logsumexp",
"numpy.argmax",
"numpy.zeros",
"numpy.ones",
"cPickle.load",
"numpy.finfo",
"cPickle.dump",
"numpy.append",
"numpy.exp",
"numpy.dot",
"numpy.delete",
"numpy.diag"
] | [((303, 318), 'numpy.finfo', 'np.finfo', (['float'], {}), '(float)\n', (311, 318), True, 'import numpy as np\n'), ((974, 1020), 'numpy.zeros', 'np.zeros', (['(self.n_components, self.n_features)'], {}), '((self.n_components, self.n_features))\n', (982, 1020), True, 'import numpy as np\n'), ((1043, 1088), 'numpy.ones', ... |
"""Different useful metrics."""
from typing import Sequence, Union
import numpy as np
def mrr_score(y_true: Sequence[Union[float, int]], y_score: Sequence[Union[float, int]]) -> float:
"""Compute the MRR score.
Args:
y_true (Sequence[Union[float, int]]): labels.
y_score (Sequence[Union[floa... | [
"numpy.argsort",
"numpy.take",
"numpy.sum"
] | [((454, 476), 'numpy.take', 'np.take', (['y_true', 'order'], {}), '(y_true, order)\n', (461, 476), True, 'import numpy as np\n'), ((415, 434), 'numpy.argsort', 'np.argsort', (['y_score'], {}), '(y_score)\n', (425, 434), True, 'import numpy as np\n'), ((547, 563), 'numpy.sum', 'np.sum', (['rr_score'], {}), '(rr_score)\n... |
from collections import namedtuple
from HUGOFilter import HUGOFilter
import numpy as np
import os
import shutil
import subprocess
import tarfile
def GetCopyNumber(Output, FirehosePath, Disease, GisticQ=0.25,
FilterGenes=None):
"""Generates variables containing gene-level and arm-level... | [
"os.mkdir",
"subprocess.Popen",
"os.remove",
"os.path.basename",
"os.path.isdir",
"os.walk",
"numpy.nonzero",
"numpy.array",
"collections.namedtuple",
"tarfile.open",
"shutil.rmtree"
] | [((3258, 3350), 'subprocess.Popen', 'subprocess.Popen', (["[FirehosePath + 'firehose_get -r']"], {'stdout': 'subprocess.PIPE', 'shell': '(True)'}), "([FirehosePath + 'firehose_get -r'], stdout=subprocess.PIPE,\n shell=True)\n", (3274, 3350), False, 'import subprocess\n'), ((3579, 3770), 'subprocess.Popen', 'subproce... |
import os.path
import typing as tp
import numpy as np
# import pandas as pd
class MeasMCA:
def __init__(self, path: str, diff_nonlin: float = None, int_nonlin: float = None):
"""A multichannel analyzer (MCA) measurement
For the nonlinearities, please see
https://en.wikipedia.org/wiki/Dif... | [
"numpy.array",
"numpy.arange"
] | [((2828, 2857), 'numpy.array', 'np.array', (['data'], {'dtype': 'np.int_'}), '(data, dtype=np.int_)\n', (2836, 2857), True, 'import numpy as np\n'), ((2882, 2912), 'numpy.arange', 'np.arange', (['(0)', 'self.counts.size'], {}), '(0, self.counts.size)\n', (2891, 2912), True, 'import numpy as np\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.