code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import unittest from sys import argv import numpy as np import torch from objective.logistic import Logistic_Gradient from .utils import Container, assert_all_close, assert_all_close_dict class TestObj_Logistic_Gradient(unittest.TestCase): def setUp(self): np.random.seed(1234) torch.manual_seed(...
[ "torch.manual_seed", "objective.logistic.Logistic_Gradient", "torch.tensor", "numpy.random.seed", "unittest.main", "torch.randn" ]
[((1628, 1652), 'unittest.main', 'unittest.main', ([], {'argv': 'argv'}), '(argv=argv)\n', (1641, 1652), False, 'import unittest\n'), ((273, 293), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (287, 293), True, 'import numpy as np\n'), ((302, 325), 'torch.manual_seed', 'torch.manual_seed', (['(12...
from datasets.dataset_processors import ExtendedDataset from models.model import IdentificationModel, ResNet50 from models.siamese import SiameseNet, MssNet from base import BaseExecutor from utils.utilities import type_error_msg, value_error_msg, timer, load_model import torch from torch.utils.data import DataLoader f...
[ "scipy.io.savemat", "models.siamese.MssNet", "numpy.linalg.norm", "utils.utilities.load_model", "os.path.exists", "numpy.mean", "numpy.repeat", "numpy.flatnonzero", "numpy.asarray", "torchvision.transforms.ToTensor", "os.path.dirname", "torch.norm", "models.model.ResNet50", "torchvision.tr...
[((5047, 5142), 'utils.utilities.load_model', 'load_model', (['self.model', "(self.config[self.name.value]['model_format'] % (model_name, epoch))"], {}), "(self.model, self.config[self.name.value]['model_format'] % (\n model_name, epoch))\n", (5057, 5142), False, 'from utils.utilities import type_error_msg, value_er...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 29 20:53:21 2020 @author: asherhensley """ import dash import dash_core_components as dcc import dash_html_components as html import plotly.express as px import pandas as pd import yulesimon as ys from plotly.subplots import make_subplots import plo...
[ "dash_html_components.Button", "dash.dependencies.Input", "numpy.arange", "dash_html_components.Div", "yulesimon.TimeSeries", "numpy.mean", "numpy.histogram", "dash.Dash", "dash.dependencies.Output", "dash_html_components.Br", "plotly.graph_objects.Scatter", "yulesimon.GetYahooFeed", "dash_h...
[((545, 607), 'dash.Dash', 'dash.Dash', (['__name__'], {'external_stylesheets': 'external_stylesheets'}), '(__name__, external_stylesheets=external_stylesheets)\n', (554, 607), False, 'import dash\n'), ((681, 696), 'plotly.subplots.make_subplots', 'make_subplots', ([], {}), '()\n', (694, 696), False, 'from plotly.subpl...
import argparse import os import sys import time import warnings from ast import literal_eval warnings.filterwarnings("ignore") import IPython import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch import context from context import utils import uti...
[ "utils.db.upload_directory", "time.sleep", "numpy.equal", "utils.plotting.timeseries_median", "utils.misc.get_equal_dicts", "os.path.exists", "utils.filesystem.get_parent", "argparse.ArgumentParser", "utils.plotting.timeseries_mean_grouped", "numpy.where", "data_analysis.invert_signs", "matplo...
[((94, 127), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (117, 127), False, 'import warnings\n'), ((169, 183), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (176, 183), True, 'import matplotlib as mpl\n'), ((7860, 7894), 'data_analysis.get_checkpoint_di...
# analyzing each point forecast and selecting the best, day by day, saving forecasts and making final forecast import os import sys import datetime import logging import logging.handlers as handlers import json import itertools as it import pandas as pd import numpy as np # open local settings with open('./settings.js...
[ "logging.basicConfig", "logging.getLogger", "numpy.shape", "sys.path.insert", "numpy.abs", "numpy.dtype", "logging.handlers.RotatingFileHandler", "stochastic_model_obtain_results.stochastic_simulation_results_analysis", "numpy.array", "datetime.datetime.now", "os.path.basename", "save_forecast...
[((612, 742), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': 'log_path_filename', 'level': 'logging.DEBUG', 'format': '"""%(asctime)s %(levelname)s %(name)s %(message)s"""'}), "(filename=log_path_filename, level=logging.DEBUG, format\n ='%(asctime)s %(levelname)s %(name)s %(message)s')\n", (631, 742...
""" Utility functions for running NEB calculations """ import numpy as np from aiida.orm import StructureData from aiida.engine import calcfunction from ase.neb import NEB @calcfunction def neb_interpolate(init_structure, final_strucrture, nimages): """ Interplate NEB frames using the starting and the final s...
[ "numpy.argmin", "aiida.orm.StructureData", "numpy.asarray" ]
[((828, 845), 'numpy.asarray', 'np.asarray', (['disps'], {}), '(disps)\n', (838, 845), True, 'import numpy as np\n'), ((1098, 1130), 'aiida.orm.StructureData', 'StructureData', ([], {'ase': 'neb.images[0]'}), '(ase=neb.images[0])\n', (1111, 1130), False, 'from aiida.orm import StructureData\n'), ((1199, 1232), 'aiida.o...
# -*- coding: utf-8 -*- # @Author: TD21forever # @Date: 2019-05-26 12:14:07 # @Last Modified by: TD21forever # @Last Modified time: 2019-06-17 23:11:15 import numpy as np ''' dp[item][cap]的意思是 从前item个物品中拿东西 放到容量为cap 的背包中 能拿到的最大价值 ''' def solution(num,waste,value,capacity): dp = np.zeros([num+5,capacity+...
[ "numpy.zeros" ]
[((295, 328), 'numpy.zeros', 'np.zeros', (['[num + 5, capacity + 2]'], {}), '([num + 5, capacity + 2])\n', (303, 328), True, 'import numpy as np\n')]
# coding=utf-8 # Copyright 2018 The DisentanglementLib 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 # # Un...
[ "matplotlib.pyplot.ylabel", "seaborn.set_style", "matplotlib.pyplot.GridSpec", "seaborn.color_palette", "pathlib.Path", "matplotlib.pyplot.xlabel", "numpy.max", "numpy.linspace", "os.path.isdir", "pandas.DataFrame", "matplotlib.use", "seaborn.set_context", "numpy.around", "matplotlib.pyplo...
[((838, 859), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (852, 859), False, 'import matplotlib\n'), ((1703, 1773), 'seaborn.set_context', 'sns.set_context', (['"""notebook"""'], {'font_scale': '(1.5)', 'rc': "{'lines.linewidth': 2}"}), "('notebook', font_scale=1.5, rc={'lines.linewidth': 2})\...
import argparse import cv2 import numpy as np from inference import Network from openvino.inference_engine import IENetwork, IECore import pylab as plt import math import matplotlib from scipy.ndimage.filters import gaussian_filter INPUT_STREAM = "emotion.mp4" CPU_EXTENSION = "C:\\Program Files (x86)\\IntelSWTools\\o...
[ "numpy.dstack", "argparse.ArgumentParser", "numpy.argmax", "cv2.VideoWriter", "numpy.sum", "numpy.zeros", "cv2.destroyAllWindows", "cv2.VideoCapture", "inference.Network", "cv2.resize", "cv2.waitKey" ]
[((1115, 1173), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Run inference on an input video"""'], {}), "('Run inference on an input video')\n", (1138, 1173), False, 'import argparse\n'), ((2370, 2410), 'cv2.resize', 'cv2.resize', (['input_image', '(width, height)'], {}), '(input_image, (width, height))\...
# Copyright FMR LLC <<EMAIL>> # SPDX-License-Identifier: Apache-2.0 """ The script generates variations for the parameters using configuration file and stores them in respective named tuple """ import math import random from collections import namedtuple import numpy as np # configuration parameters scene_options = [...
[ "random.choices", "random.choice", "math.radians", "numpy.random.uniform" ]
[((1896, 1992), 'numpy.random.uniform', 'np.random.uniform', (["configs[variable]['range'][0]", "configs[variable]['range'][1]", 'variations'], {}), "(configs[variable]['range'][0], configs[variable]['range']\n [1], variations)\n", (1913, 1992), True, 'import numpy as np\n'), ((2421, 2500), 'random.choices', 'random...
import torch import torchvision import torch.nn as nn import numpy as np import torchvision.transforms as transforms # ================================================================== # # 目录 # # ===========================================================...
[ "torch.load", "torchvision.models.resnet18", "torch.from_numpy", "numpy.array", "torch.tensor", "torch.nn.MSELoss", "torch.nn.Linear", "torch.utils.data.DataLoader", "torch.save", "torchvision.transforms.ToTensor", "torch.randn" ]
[((953, 990), 'torch.tensor', 'torch.tensor', (['(1.0)'], {'requires_grad': '(True)'}), '(1.0, requires_grad=True)\n', (965, 990), False, 'import torch\n'), ((994, 1031), 'torch.tensor', 'torch.tensor', (['(2.0)'], {'requires_grad': '(True)'}), '(2.0, requires_grad=True)\n', (1006, 1031), False, 'import torch\n'), ((10...
import astropy.units as u import numpy as np from ..utils import cone_solid_angle #: Unit of the background rate IRF BACKGROUND_UNIT = u.Unit('s-1 TeV-1 sr-1') def background_2d(events, reco_energy_bins, fov_offset_bins, t_obs): """ Calculate background rates in radially symmetric bins in the field of view....
[ "numpy.diff", "astropy.units.Unit" ]
[((137, 161), 'astropy.units.Unit', 'u.Unit', (['"""s-1 TeV-1 sr-1"""'], {}), "('s-1 TeV-1 sr-1')\n", (143, 161), True, 'import astropy.units as u\n'), ((1738, 1763), 'numpy.diff', 'np.diff', (['reco_energy_bins'], {}), '(reco_energy_bins)\n', (1745, 1763), True, 'import numpy as np\n')]
#!/usr/bin/env pythonw import numpy as np import matplotlib.pyplot as plt def flip_coins(flips = 1000000, bins=100): # Uninformative prior prior = np.ones(bins, dtype='float')/bins likelihood_heads = np.arange(bins)/float(bins) likelihood_tails = 1-likelihood_heads flips = np.random.choice(a=[True...
[ "numpy.ones", "numpy.random.choice", "matplotlib.pyplot.legend", "numpy.sum", "numpy.arange", "matplotlib.pyplot.show" ]
[((954, 996), 'matplotlib.pyplot.legend', 'plt.legend', (['[10, 100, 1000, 10000, 100000]'], {}), '([10, 100, 1000, 10000, 100000])\n', (964, 996), True, 'import matplotlib.pyplot as plt\n'), ((997, 1007), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1005, 1007), True, 'import matplotlib.pyplot as plt\n'), ...
import numpy as np import pandas as pd def batch_df2batch(df, evaluate_ids=(), n_obs=-1, tform=np.eye(3), is_vehicles_evaluated=False): """ Convert dataframe to SGAN input :param df: :param evaluate_ids: :param n_obs: number of timesteps observed :param tform: :param is_vehicles_evaluat...
[ "numpy.eye", "numpy.unique", "numpy.ones", "numpy.sort", "numpy.stack", "numpy.zeros", "numpy.isnan", "numpy.vstack", "numpy.zeros_like", "numpy.arange" ]
[((97, 106), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (103, 106), True, 'import numpy as np\n'), ((707, 761), 'numpy.zeros', 'np.zeros', (['(n_obs, agent_ids.size, 2)'], {'dtype': 'np.float32'}), '((n_obs, agent_ids.size, 2), dtype=np.float32)\n', (715, 761), True, 'import numpy as np\n'), ((775, 796), 'numpy.zer...
import numpy as npy def convert(num): if num < 0: # num = -num num *= 1024 # num += 32768 num = int(num - 0.5) num = 65535 + num n_str = str(hex(num))[2:] if len(n_str) == 1: n_str = 'fff' + n_str elif len(n_str) == 2: n_str = ...
[ "numpy.load" ]
[((849, 879), 'numpy.load', 'npy.load', (['"""dense_kernel_0.npy"""'], {}), "('dense_kernel_0.npy')\n", (857, 879), True, 'import numpy as npy\n'), ((1175, 1203), 'numpy.load', 'npy.load', (['"""dense_bias_0.npy"""'], {}), "('dense_bias_0.npy')\n", (1183, 1203), True, 'import numpy as npy\n'), ((1330, 1362), 'numpy.loa...
import numpy as np import queue import cv2 import os import datetime SIZE = 32 SCALE = 0.007874015748031496 def quantized_np(array,scale,data_width=8): quantized_array= np.round(array/scale) quantized_array = np.maximum(quantized_array, -2**(data_width-1)) quantized_array = np.minimum(quantized_array, 2**...
[ "os.listdir", "numpy.reshape", "numpy.minimum", "cv2.resize", "numpy.size", "os.path.join", "queue.Queue", "datetime.datetime.now", "numpy.maximum", "cv2.imread", "numpy.round" ]
[((175, 198), 'numpy.round', 'np.round', (['(array / scale)'], {}), '(array / scale)\n', (183, 198), True, 'import numpy as np\n'), ((219, 270), 'numpy.maximum', 'np.maximum', (['quantized_array', '(-2 ** (data_width - 1))'], {}), '(quantized_array, -2 ** (data_width - 1))\n', (229, 270), True, 'import numpy as np\n'),...
import numpy as np import time def max_subsequence_sum(sequence): max_sum = 0 for i in range(0, len(sequence)): for j in range(i, len(sequence)): this_sum = 0 for k in range(i, j+1): this_sum += sequence[k] if this_sum > max_sum: ...
[ "numpy.random.randint", "time.time" ]
[((372, 417), 'numpy.random.randint', 'np.random.randint', (['(-100000)', '(100000)'], {'size': '(1000)'}), '(-100000, 100000, size=1000)\n', (389, 417), True, 'import numpy as np\n'), ((424, 435), 'time.time', 'time.time', ([], {}), '()\n', (433, 435), False, 'import time\n'), ((476, 487), 'time.time', 'time.time', ([...
import numpy as np from pyFAI.multi_geometry import MultiGeometry from pyFAI.ext import splitBBox def inpaint_saxs(imgs, ais, masks): """ Inpaint the 2D image collected by the pixel detector to remove artifacts in later data reduction Parameters: ----------- :param imgs: List of 2D image in pixel...
[ "numpy.mean", "numpy.shape", "numpy.ones_like", "numpy.sqrt", "numpy.asarray", "numpy.ma.masked_where", "numpy.max", "numpy.deg2rad", "numpy.linspace", "numpy.arctan2", "numpy.min", "numpy.meshgrid", "pyFAI.multi_geometry.MultiGeometry", "numpy.rad2deg", "numpy.ma.masked_array" ]
[((1972, 2108), 'pyFAI.multi_geometry.MultiGeometry', 'MultiGeometry', (['ais'], {'unit': '"""q_A^-1"""', 'radial_range': 'radial_range', 'azimuth_range': 'azimuth_range', 'wavelength': 'None', 'empty': '(0.0)', 'chi_disc': '(180)'}), "(ais, unit='q_A^-1', radial_range=radial_range, azimuth_range=\n azimuth_range, w...
import numpy as np from typing import Tuple import plotly.io from IMLearn.metalearners.adaboost import AdaBoost from IMLearn.learners.classifiers import DecisionStump from IMLearn.metrics import accuracy from utils import * import plotly.graph_objects as go from plotly.subplots import make_subplots plotly.io.rendere...
[ "numpy.ones", "numpy.random.rand", "plotly.graph_objects.Layout", "IMLearn.metalearners.adaboost.AdaBoost", "numpy.max", "numpy.array", "numpy.sum", "numpy.random.seed" ]
[((3011, 3047), 'numpy.array', 'np.array', (["['circle', 'x', 'diamond']"], {}), "(['circle', 'x', 'diamond'])\n", (3019, 3047), True, 'import numpy as np\n'), ((6267, 6284), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (6281, 6284), True, 'import numpy as np\n'), ((1056, 1066), 'numpy.ones', 'np.ones...
# -*- coding: utf-8 -*- # # Author: <NAME> <<EMAIL>> # # Setup the SMRT module from __future__ import print_function, absolute_import, division from distutils.command.clean import clean # from setuptools import setup # DO NOT use setuptools!!!!!! import shutil import os import sys if sys.version_info[0] < 3: imp...
[ "os.path.exists", "distutils.command.clean.clean.run", "distutils.core.setup", "os.path.join", "numpy.distutils.misc_util.Configuration", "os.path.splitext", "os.path.dirname", "os.unlink", "shutil.rmtree", "os.walk" ]
[((3093, 3138), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['None', 'parent_package', 'top_path'], {}), '(None, parent_package, top_path)\n', (3106, 3138), False, 'from numpy.distutils.misc_util import Configuration\n'), ((5720, 5737), 'distutils.core.setup', 'setup', ([], {}), '(**metadata)\n', (5725...
import numpy as np import tensorflow as tf import unittest hungarian_module = tf.load_op_library("hungarian.so") class HungarianTests(unittest.TestCase): def test_min_weighted_bp_cover_1(self): W = np.array([[3, 2, 2], [1, 2, 0], [2, 2, 1]]) M, c_0, c_1 = hungarian_module.hungarian(W) with tf.Session()...
[ "tensorflow.load_op_library", "numpy.round", "tensorflow.Session", "numpy.array", "unittest.TextTestRunner", "unittest.TestLoader" ]
[((78, 112), 'tensorflow.load_op_library', 'tf.load_op_library', (['"""hungarian.so"""'], {}), "('hungarian.so')\n", (96, 112), True, 'import tensorflow as tf\n'), ((207, 250), 'numpy.array', 'np.array', (['[[3, 2, 2], [1, 2, 0], [2, 2, 1]]'], {}), '([[3, 2, 2], [1, 2, 0], [2, 2, 1]])\n', (215, 250), True, 'import nump...
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import xarray as xr sns.set() def plot_range(xlabel, ylabel, title, x, values): """x and values should have the same size""" plt.plot(x, values, 'r-', linewidth=2) plt.gcf().set_size_inches(8, 2) plt.title(title) plt.xlabel(...
[ "seaborn.set", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.gcf", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "matplotlib.pyplot.title", "xarray.open_dataset", "numpy.arange", "matplotlib.pyplot.show" ]
[((93, 102), 'seaborn.set', 'sns.set', ([], {}), '()\n', (100, 102), True, 'import seaborn as sns\n'), ((209, 247), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'values', '"""r-"""'], {'linewidth': '(2)'}), "(x, values, 'r-', linewidth=2)\n", (217, 247), True, 'import matplotlib.pyplot as plt\n'), ((288, 304), 'matplot...
# -*- coding: utf-8 -*- """ Created on Mon Nov 28 10:47:38 2016 @author: ahefny Policies are BLIND to the representation of states, which could be (1) observation, (2) original latent state or (3) predictive state. Policies takes the "state" dimension x_dim, the number of actions/dim of action as input. """ impo...
[ "numpy.sin", "numpy.prod", "numpy.dot" ]
[((2094, 2116), 'numpy.dot', 'np.dot', (['self._K', 'state'], {}), '(self._K, state)\n', (2100, 2116), True, 'import numpy as np\n'), ((1598, 1629), 'numpy.prod', 'np.prod', (['(self._high - self._low)'], {}), '(self._high - self._low)\n', (1605, 1629), True, 'import numpy as np\n'), ((2612, 2657), 'numpy.sin', 'np.sin...
import torch import numpy as np from torch.utils.data import Dataset import torchvision.transforms as transforms import skimage.io as io from path import Path import cv2 import torch.nn.functional as F class ETH_LFB(Dataset): def __init__(self, configs): """ dataset for eth local feature benchmark ...
[ "torch.from_numpy", "numpy.array", "path.Path", "cv2.SIFT_create", "skimage.io.imread", "cv2.cvtColor", "torchvision.transforms.Normalize", "torchvision.transforms.ToTensor" ]
[((752, 769), 'cv2.SIFT_create', 'cv2.SIFT_create', ([], {}), '()\n', (767, 769), False, 'import cv2\n'), ((786, 817), 'path.Path', 'Path', (["self.configs['data_path']"], {}), "(self.configs['data_path'])\n", (790, 817), False, 'from path import Path\n'), ((1075, 1089), 'skimage.io.imread', 'io.imread', (['imf'], {}),...
"""This file contains functions for processing image""" import cv2 import math import copy import numpy as np import matplotlib.pyplot as plt def binarize_image(image): """Binarize image pixel values to 0 and 255.""" unique_values = np.unique(image) if len(unique_values) == 2: if (un...
[ "matplotlib.pyplot.imshow", "cv2.imwrite", "numpy.unique", "numpy.ones", "numpy.where", "numpy.zeros_like", "numpy.count_nonzero", "numpy.sum", "numpy.stack", "numpy.array", "copy.deepcopy", "cv2.imread", "matplotlib.pyplot.show" ]
[((255, 271), 'numpy.unique', 'np.unique', (['image'], {}), '(image)\n', (264, 271), True, 'import numpy as np\n'), ((580, 599), 'cv2.imread', 'cv2.imread', (['path', '(0)'], {}), '(path, 0)\n', (590, 599), False, 'import cv2\n'), ((692, 708), 'cv2.imread', 'cv2.imread', (['path'], {}), '(path)\n', (702, 708), False, '...
#!/usr/bin/env python # coding: utf-8 # In[1]: #import bibliotek from keras.applications.resnet50 import ResNet50, decode_predictions,preprocess_input from keras.preprocessing import image import numpy as np import requests from io import BytesIO from PIL import Image # In[2]: #podbranie modelu ResNet50 model...
[ "keras.preprocessing.image.img_to_array", "keras.applications.resnet50.decode_predictions", "io.BytesIO", "requests.get", "numpy.expand_dims", "keras.applications.resnet50.ResNet50" ]
[((323, 351), 'keras.applications.resnet50.ResNet50', 'ResNet50', ([], {'weights': '"""imagenet"""'}), "(weights='imagenet')\n", (331, 351), False, 'from keras.applications.resnet50 import ResNet50, decode_predictions, preprocess_input\n'), ((1204, 1225), 'requests.get', 'requests.get', (['url_img'], {}), '(url_img)\n'...
# -*- coding: utf-8 -*- """ Plot comparisons of IHME projections to actual data for US states. IHME data per IHME: https://covid19.healthdata.org/united-states-of-america IHME data stored here in the "..\data\ihme" directory for each release that was obtained. State-level data per Covid trackin...
[ "read_data.get_data_ctrack", "os.path.join", "read_data.format_date_ihme", "numpy.diff", "read_data.get_data_ihme", "numpy.array", "scipy.signal.medfilt", "datetime.date.today", "matplotlib.pyplot.subplots" ]
[((2462, 2474), 'datetime.date.today', 'date.today', ([], {}), '()\n', (2472, 2474), False, 'from datetime import date\n'), ((2506, 2543), 'read_data.get_data_ctrack', 'get_data_ctrack', (['state', 'data_filename'], {}), '(state, data_filename)\n', (2521, 2543), False, 'from read_data import get_data_ctrack, get_data_i...
from feature import Feature from itertools import product import numpy as np import random class Node: def __init__(self, K, Cweights, Dweights, seed): self.K = K self.seed = seed self.Kd = int(K*2/3) self.Kc = int(K*1/3) self.Cfeatures = [Feature(False, seed) for k in range(...
[ "numpy.random.rand", "itertools.product", "feature.Feature", "numpy.exp", "numpy.array", "numpy.random.randint", "random.random", "numpy.arange" ]
[((1003, 1019), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (1017, 1019), True, 'import numpy as np\n'), ((1220, 1233), 'numpy.exp', 'np.exp', (['alpha'], {}), '(alpha)\n', (1226, 1233), True, 'import numpy as np\n'), ((1451, 1463), 'numpy.exp', 'np.exp', (['beta'], {}), '(beta)\n', (1457, 1463), True, 'im...
#https://github.com/Newmu/Theano-Tutorials/blob/master/1_linear_regression.py import theano from theano import tensor as T import numpy as np trX = np.linspace(-1, 1, 101) trY = 2 * trX + np.random.randn(*trX.shape) * 0.33 X = T.scalar() Y = T.scalar() def model(X, w): return X * w w = theano.shared(np.asarray...
[ "theano.tensor.nnet.categorical_crossentropy", "theano.function", "matplotlib.pyplot.show", "theano.tensor.dot", "numpy.asarray", "numpy.argmax", "theano.tensor.sqr", "numpy.linspace", "theano.tensor.fmatrix", "theano.tensor.argmax", "theano.tensor.scalar", "numpy.random.randn", "fuel.datase...
[((150, 173), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(101)'], {}), '(-1, 1, 101)\n', (161, 173), True, 'import numpy as np\n'), ((230, 240), 'theano.tensor.scalar', 'T.scalar', ([], {}), '()\n', (238, 240), True, 'from theano import tensor as T\n'), ((245, 255), 'theano.tensor.scalar', 'T.scalar', ([], {}),...
# -*- coding: utf-8 -*- """Make the double periodic shear test grid""" import matplotlib.pyplot as plt from configparser import ConfigParser import numpy as np import sys import os sys.path.append(os.path.abspath("../../..")) from pycato import * # Make the empty grid domain = make_uniform_grid( n_cells=(256, 25...
[ "numpy.sin", "numpy.tanh", "os.path.abspath", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((1174, 1221), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(18, 8)', 'nrows': '(1)', 'ncols': '(2)'}), '(figsize=(18, 8), nrows=1, ncols=2)\n', (1186, 1221), True, 'import matplotlib.pyplot as plt\n'), ((1735, 1745), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1743, 1745), True, 'impor...
import numpy as np from keras.layers import * from keras.models import * from keras.activations import * from keras.callbacks import ModelCheckpoint,ReduceLROnPlateau def keras_model(): model=Sequential() model.add(Conv2D(32,(3,3),padding="same")) model.add(Conv2D(32,(3,3),padding="same")) mo...
[ "keras.callbacks.ModelCheckpoint", "sklearn.model_selection.train_test_split", "keras.callbacks.ReduceLROnPlateau", "numpy.append", "numpy.load" ]
[((1030, 1059), 'numpy.load', 'np.load', (['"""features_40x40.npy"""'], {}), "('features_40x40.npy')\n", (1037, 1059), True, 'import numpy as np\n'), ((1068, 1095), 'numpy.load', 'np.load', (['"""labels_40x40.npy"""'], {}), "('labels_40x40.npy')\n", (1075, 1095), True, 'import numpy as np\n'), ((1125, 1174), 'numpy.app...
#encoding=utf8 import time import numpy as np import tensorflow as tf from tensorflow.contrib import crf import cws.BiLSTM as modelDef from cws.data import Data tf.app.flags.DEFINE_string('dict_path', 'data/your_dict.pkl', 'dict path') tf.app.flags.DEFINE_string('train_data', 'data/your_train_data.pkl', 'tr...
[ "tensorflow.app.flags.DEFINE_float", "cws.data.Data", "tensorflow.app.flags.DEFINE_integer", "tensorflow.Session", "tensorflow.train.Saver", "tensorflow.app.flags.DEFINE_string", "numpy.equal", "tensorflow.global_variables_initializer", "tensorflow.ConfigProto", "tensorflow.contrib.crf.viterbi_dec...
[((172, 246), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""dict_path"""', '"""data/your_dict.pkl"""', '"""dict path"""'], {}), "('dict_path', 'data/your_dict.pkl', 'dict path')\n", (198, 246), True, 'import tensorflow as tf\n'), ((248, 339), 'tensorflow.app.flags.DEFINE_string', 'tf.app.fla...
""" Implements MissSVM """ from __future__ import print_function, division import numpy as np import scipy.sparse as sp from random import uniform import inspect from misvm.quadprog import IterativeQP, Objective from misvm.util import BagSplitter, spdiag, slices from misvm.kernel import by_name as kernel_by_name from m...
[ "misvm.quadprog.IterativeQP", "numpy.hstack", "numpy.asmatrix", "numpy.multiply", "misvm.util.spdiag", "misvm.quadprog.Objective", "scipy.sparse.eye", "numpy.vstack", "misvm.mica.MICA", "scipy.sparse.coo_matrix", "misvm.util.slices", "misvm.kernel.by_name", "random.uniform", "numpy.ones", ...
[((2143, 2231), 'numpy.vstack', 'np.vstack', (['[bs.pos_instances, bs.pos_instances, bs.pos_instances, bs.neg_instances]'], {}), '([bs.pos_instances, bs.pos_instances, bs.pos_instances, bs.\n neg_instances])\n', (2152, 2231), True, 'import numpy as np\n'), ((2909, 2924), 'misvm.util.spdiag', 'spdiag', (['self._y'], ...
import numpy as np def trapezoidal_rule(f, a, b, tol=1e-8): """ The trapezoidal rule is known to be very accurate for oscillatory integrals integrated over their period. See papers on spectral integration (it's just the composite trapezoidal rule....) TODO (aaron): f is memoized to get the alrea...
[ "numpy.real", "numpy.linspace", "numpy.imag" ]
[((599, 617), 'numpy.real', 'np.real', (['delta_res'], {}), '(delta_res)\n', (606, 617), True, 'import numpy as np\n'), ((639, 657), 'numpy.imag', 'np.imag', (['delta_res'], {}), '(delta_res)\n', (646, 657), True, 'import numpy as np\n'), ((778, 804), 'numpy.linspace', 'np.linspace', (['a', 'b'], {'num': 'num'}), '(a, ...
""" January 13th 2020 Author T.Mizumoto """ #! python 3 # ver.x1.00 # Integral-Scale_function.py - this program calculate integral-scale and correlation. import numpy as np from scipy.integrate import simps from scipy.stats import pearsonr import pandas as pd # index_basepoint = 0 (defult) def fun_Cros...
[ "numpy.where", "scipy.integrate.simps", "graph.Graph", "scipy.stats.pearsonr", "pandas.DataFrame", "numpy.loadtxt" ]
[((660, 712), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['CrossCorrelation', 'Pvalue']"}), "(columns=['CrossCorrelation', 'Pvalue'])\n", (672, 712), True, 'import pandas as pd\n'), ((906, 931), 'numpy.where', 'np.where', (['(correlation < 0)'], {}), '(correlation < 0)\n', (914, 931), True, 'import numpy as ...
import numpy as np import matplotlib.pyplot as plt from utils import get_state_vowel class HopfieldNetwork: """ Creates a Hopfield Network. """ def __init__(self, patterns): """ Initializes the network. Args: patterns (np.array): Group of states to be memorized by ...
[ "numpy.reshape", "numpy.random.choice", "numpy.random.random", "matplotlib.pyplot.plot", "utils.get_state_vowel", "numpy.fill_diagonal", "matplotlib.pyplot.figure", "numpy.zeros", "numpy.dot", "numpy.random.seed", "matplotlib.pyplot.title", "numpy.transpose", "matplotlib.pyplot.subplot", "...
[((1840, 1860), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (1854, 1860), True, 'import numpy as np\n'), ((2183, 2228), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 3)', 'tight_layout': '(True)'}), '(figsize=(6, 3), tight_layout=True)\n', (2193, 2228), True, 'import matplotli...
#!/usr/bin/env python # coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -----------------------------------------------...
[ "onnx.helper.make_graph", "onnxruntime.quantization.quantize_static", "numpy.random.normal", "onnx.save", "onnx.helper.make_node", "onnx.numpy_helper.from_array", "onnx.helper.make_tensor_value_info", "numpy.random.randint", "numpy.random.seed", "op_test_utils.TestDataFeeds", "unittest.main", ...
[((7923, 7938), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7936, 7938), False, 'import unittest\n'), ((984, 1014), 'op_test_utils.TestDataFeeds', 'TestDataFeeds', (['input_data_list'], {}), '(input_data_list)\n', (997, 1014), False, 'from op_test_utils import TestDataFeeds, check_model_correctness, check_op_t...
from model import * from dataloader import * from utils import * from torch.utils.tensorboard import SummaryWriter import torch.optim as optim import time import gc from tqdm import tqdm import matplotlib.pyplot as plt import torch.nn as nn import numpy as np import warnings as wn wn.filterwarnings('ignore') #load eit...
[ "torch.optim.Adam", "torch.utils.tensorboard.SummaryWriter", "numpy.mean", "torch.nn.CrossEntropyLoss", "matplotlib.pyplot.figure", "time.time", "warnings.filterwarnings" ]
[((282, 309), 'warnings.filterwarnings', 'wn.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (299, 309), True, 'import warnings as wn\n'), ((1375, 1390), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', ([], {}), '()\n', (1388, 1390), False, 'from torch.utils.tensorboard import SummaryWriter\n'), ((17...
import os import csv import numpy as np from pathlib import Path from tqdm import tqdm from sklearn.utils import shuffle from sklearn.model_selection import train_test_split seed = 3535999445 def imdb(path=Path("data/aclImdb/")): import pickle try: return pickle.load((path / "train-test.p").open("r...
[ "pathlib.Path", "sklearn.model_selection.train_test_split", "os.path.join", "numpy.asarray", "csv.reader" ]
[((210, 231), 'pathlib.Path', 'Path', (['"""data/aclImdb/"""'], {}), "('data/aclImdb/')\n", (214, 231), False, 'from pathlib import Path\n'), ((1932, 2018), 'sklearn.model_selection.train_test_split', 'train_test_split', (['storys', 'comps1', 'comps2', 'ys'], {'test_size': 'n_valid', 'random_state': 'seed'}), '(storys,...
''' @date: 31/03/2015 @author: <NAME> Tests for generator ''' import unittest import numpy as np import scipy.constants as constants from PyHEADTAIL.trackers.longitudinal_tracking import RFSystems import PyHEADTAIL.particles.generators as gf from PyHEADTAIL.general.printers import SilentPrinter class TestParticle...
[ "PyHEADTAIL.trackers.longitudinal_tracking.RFSystems", "PyHEADTAIL.general.printers.SilentPrinter", "PyHEADTAIL.particles.generators.gaussian2D", "PyHEADTAIL.particles.generators.import_distribution2D", "PyHEADTAIL.particles.generators.uniform2D", "numpy.linspace", "numpy.random.seed", "unittest.main"...
[((7430, 7445), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7443, 7445), False, 'import unittest\n'), ((457, 474), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (471, 474), True, 'import numpy as np\n'), ((3136, 3154), 'PyHEADTAIL.particles.generators.gaussian2D', 'gf.gaussian2D', (['(0.1)'], ...
import numpy as np import matplotlib.pyplot as plt def filter_rms_error(filter_object, to_filter_data_lambda, desired_filter_data_lambda, dt=0.01, start_time=0.0, end_time=10.0, skip_initial=0...
[ "numpy.full_like", "numpy.square", "numpy.array", "matplotlib.pyplot.subplots", "numpy.arange", "matplotlib.pyplot.show" ]
[((3339, 3374), 'numpy.arange', 'np.arange', (['start_time', 'end_time', 'dt'], {}), '(start_time, end_time, dt)\n', (3348, 3374), True, 'import numpy as np\n'), ((3477, 3489), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (3485, 3489), True, 'import numpy as np\n'), ((3789, 3803), 'matplotlib.pyplot.subplots', 'p...
import numpy as np import matplotlib.pyplot as plt from matplotlib import patches from matplotlib.legend_handler import HandlerTuple from scipy.integrate import quad, simps from math import * #lets the user enter complicated functions easily, eg: exp(3*sin(x**2)) import pyinputplus as pyip # makes taking inputs ...
[ "matplotlib.legend_handler.HandlerTuple", "numpy.polyfit", "scipy.integrate.quad", "scipy.integrate.simps", "numpy.linspace", "pyinputplus.inputInt", "numpy.polyval", "matplotlib.patches.Patch", "numpy.concatenate", "matplotlib.pyplot.figure", "matplotlib.pyplot.draw", "warnings.filterwarnings...
[((710, 759), 'warnings.filterwarnings', 'filterwarnings', (['"""ignore"""'], {'category': 'np.RankWarning'}), "('ignore', category=np.RankWarning)\n", (724, 759), False, 'from warnings import filterwarnings\n'), ((1070, 1108), 'numpy.linspace', 'np.linspace', (['xmin', 'xmax', 'lenContinuous'], {}), '(xmin, xmax, lenC...
import os import trimesh import unittest import pocketing import numpy as np def get_model(file_name): """ Load a model from the models directory by expanding paths out. Parameters ------------ file_name : str Name of file in `models` Returns ------------ mesh : trimesh.Geomet...
[ "numpy.allclose", "pocketing.contour.contour_parallel", "numpy.isclose", "os.path.join", "pocketing.spiral.archimedean", "pocketing.trochoidal.toolpath", "unittest.main", "pocketing.spiral.helix", "trimesh.util.is_shape", "os.path.expanduser" ]
[((2261, 2305), 'trimesh.util.is_shape', 'trimesh.util.is_shape', (['arcs', '(-1, 3, (3, 2))'], {}), '(arcs, (-1, 3, (3, 2)))\n', (2282, 2305), False, 'import trimesh\n'), ((2473, 2488), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2486, 2488), False, 'import unittest\n'), ((732, 778), 'pocketing.contour.contou...
import gym import random import numpy as np import tflearn from tflearn.layers.core import input_data, dropout, fully_connected from tflearn.layers.estimator import regression from statistics import median, mean from collections import Counter LR = 1e-3 env = gym.make('CartPole-v0') env.reset() goal_steps = 500 score...
[ "statistics.mean", "tflearn.layers.core.dropout", "tflearn.layers.core.fully_connected", "random.randrange", "tflearn.DNN", "statistics.median", "numpy.array", "collections.Counter", "tflearn.layers.core.input_data", "tflearn.layers.estimator.regression", "gym.make", "numpy.save" ]
[((261, 284), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (269, 284), False, 'import gym\n'), ((1632, 1655), 'numpy.array', 'np.array', (['training_data'], {}), '(training_data)\n', (1640, 1655), True, 'import numpy as np\n'), ((1660, 1700), 'numpy.save', 'np.save', (['"""saved.npy"""', 't...
import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates import seaborn as sns sns.set(style='ticks', context='paper', palette='colorblind') try: import cmocean.cm as cmo cmocean_flag = True except: cmocean_flag = False class pltClass: def __init__(self): self.__i...
[ "matplotlib.dates.num2date", "seaborn.set", "matplotlib.dates.MonthLocator", "matplotlib.dates.DateFormatter", "matplotlib.pyplot.colorbar", "numpy.nanmean", "matplotlib.pyplot.subplots" ]
[((109, 170), 'seaborn.set', 'sns.set', ([], {'style': '"""ticks"""', 'context': '"""paper"""', 'palette': '"""colorblind"""'}), "(style='ticks', context='paper', palette='colorblind')\n", (116, 170), True, 'import seaborn as sns\n'), ((666, 697), 'matplotlib.dates.MonthLocator', 'mdates.MonthLocator', ([], {'interval'...
# -*- coding: utf-8 -*- """ P-spline versions of Whittaker functions ---------------------------------------- pybaselines contains penalized spline (P-spline) versions of all of the Whittaker-smoothing-based algorithms implemented in pybaselines. The reason for doing so was that P-splines offer additional user flexibi...
[ "itertools.cycle", "numpy.log10", "example_helpers.make_data", "matplotlib.pyplot.plot", "example_helpers.optimize_lam", "matplotlib.pyplot.figure", "numpy.empty_like", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((2171, 2188), 'itertools.cycle', 'cycle', (["['o', 's']"], {}), "(['o', 's'])\n", (2176, 2188), False, 'from itertools import cycle\n'), ((2197, 2211), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (2209, 2211), True, 'import matplotlib.pyplot as plt\n'), ((3388, 3398), 'matplotlib.pyplot.show', 'pl...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ # CODE NAME HERE # CODE DESCRIPTION HERE Created on 2021-07-08 @author: cook """ from astropy.io import fits from astropy.table import Table import matplotlib.pyplot as plt import numpy as np import os import sys # ==================================================...
[ "astropy.io.fits.diff.ImageDataDiff", "os.listdir", "os.path.join", "astropy.io.fits.diff.TableDataDiff", "numpy.argsort", "matplotlib.pyplot.close", "astropy.io.fits.open", "os.path.getmtime", "numpy.nansum", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((2454, 2479), 'numpy.argsort', 'np.argsort', (['last_modified'], {}), '(last_modified)\n', (2464, 2479), True, 'import numpy as np\n'), ((809, 829), 'astropy.io.fits.open', 'fits.open', (['imagename'], {}), '(imagename)\n', (818, 829), False, 'from astropy.io import fits\n'), ((2249, 2264), 'os.listdir', 'os.listdir'...
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np from matplotlib.patches import Rectangle,Circle import mpl_toolkits.mplot3d.art3d as art3d fig = plt.figure() # ax = fig.add_subplot(111, projection='3d') ax = plt.axes(projection='3d') x,y,z = 10,0,0 dx,dy,dz = 12,12,10 ...
[ "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.pyplot.axes", "mpl_toolkits.mplot3d.art3d.pathpatch_2d_to_3d", "numpy.cos", "numpy.sin", "numpy.meshgrid", "matplotlib.patches.Circle", "matplotlib.pyplot.show" ]
[((192, 204), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (202, 204), True, 'import matplotlib.pyplot as plt\n'), ((257, 282), 'matplotlib.pyplot.axes', 'plt.axes', ([], {'projection': '"""3d"""'}), "(projection='3d')\n", (265, 282), True, 'import matplotlib.pyplot as plt\n'), ((325, 365), 'matplotlib.p...
import argparse import datetime import sys import threading import time import matplotlib.pyplot as plt import numpy import yaml from .__about__ import __copyright__, __version__ from .main import ( cooldown, measure_temp, measure_core_frequency, measure_ambient_temperature, test, ) def _get_ver...
[ "argparse.FileType", "matplotlib.pyplot.savefig", "argparse.ArgumentParser", "yaml.dump", "matplotlib.pyplot.twinx", "yaml.load", "numpy.subtract", "datetime.datetime.now", "matplotlib.pyplot.figure", "time.time", "matplotlib.pyplot.show" ]
[((665, 741), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run stress test for the Raspberry Pi."""'}), "(description='Run stress test for the Raspberry Pi.')\n", (688, 741), False, 'import argparse\n'), ((4974, 5103), 'yaml.dump', 'yaml.dump', (["{'name': args.name, 'time': times, 'te...
#!/usr/bin/env python3 import json import argparse import os from collections import OrderedDict from utils import normalize from utils import exact_match_score, regex_match_score, get_rank from utils import slugify, aggregate, aggregate_ans from utils import Tokenizer from multiprocessing import Pool as ProcessPool #...
[ "os.path.exists", "json.loads", "numpy.mean", "collections.OrderedDict", "pickle.dump", "utils.slugify", "argparse.ArgumentParser", "utils.normalize", "utils.aggregate", "utils.aggregate_ans", "os.makedirs", "os.path.join", "utils.get_rank", "multiprocessing.Pool", "numpy.std", "sys.st...
[((885, 907), 'json.loads', 'json.loads', (['data_line_'], {}), '(data_line_)\n', (895, 907), False, 'import json\n'), ((951, 968), 'utils.slugify', 'slugify', (['question'], {}), '(question)\n', (958, 968), False, 'from utils import slugify, aggregate, aggregate_ans\n'), ((982, 1026), 'os.path.join', 'os.path.join', (...
#!/usr/bin/env python3 import layers import cv2 from os.path import join import numpy as np # import tensorflow as tf import Augmentor vw = 320 vh = 320 class Augment: def __init__(self): self.w = 2 * 640 self.h = 2 * 480 self.canvas = np.zeros((self.h, self.w, 3), dtype=np.uint8) d...
[ "os.path.join", "cv2.imshow", "cv2.putText", "numpy.zeros", "cv2.waitKey" ]
[((268, 313), 'numpy.zeros', 'np.zeros', (['(self.h, self.w, 3)'], {'dtype': 'np.uint8'}), '((self.h, self.w, 3), dtype=np.uint8)\n', (276, 313), True, 'import numpy as np\n'), ((576, 673), 'cv2.putText', 'cv2.putText', (['self.canvas', '"""Original"""', '(0, 50)', 'cv2.FONT_HERSHEY_COMPLEX', '(1.0)', '(255, 255, 255)'...
from qtpy import QtWidgets, QtCore from pyqtgraph.widgets.SpinBox import SpinBox from pyqtgraph.parametertree.parameterTypes.basetypes import WidgetParameterItem from pymodaq.daq_utils.daq_utils import scroll_log, scroll_linear import numpy as np class SliderSpinBox(QtWidgets.QWidget): def __init__(self, *args, s...
[ "numpy.log10", "qtpy.QtWidgets.QVBoxLayout", "pymodaq.daq_utils.daq_utils.scroll_log", "qtpy.QtCore.QSize", "pymodaq.daq_utils.daq_utils.scroll_linear", "pyqtgraph.widgets.SpinBox.SpinBox", "qtpy.QtWidgets.QSlider" ]
[((1283, 1306), 'qtpy.QtWidgets.QVBoxLayout', 'QtWidgets.QVBoxLayout', ([], {}), '()\n', (1304, 1306), False, 'from qtpy import QtWidgets, QtCore\n'), ((1329, 1368), 'qtpy.QtWidgets.QSlider', 'QtWidgets.QSlider', (['QtCore.Qt.Horizontal'], {}), '(QtCore.Qt.Horizontal)\n', (1346, 1368), False, 'from qtpy import QtWidget...
""" Copyright (c) 2018 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...
[ "numpy.array", "numpy.zeros", "logging.error", "numpy.squeeze" ]
[((1582, 1626), 'numpy.array', 'np.array', (['output.value.shape'], {'dtype': 'np.int64'}), '(output.value.shape, dtype=np.int64)\n', (1590, 1626), True, 'import numpy as np\n'), ((3177, 3196), 'numpy.array', 'np.array', (['slice_idx'], {}), '(slice_idx)\n', (3185, 3196), True, 'import numpy as np\n'), ((3228, 3254), '...
#!/usr/bin/python; import sys import ast import json import math as m import numpy as np # from scipy.interpolate import interp1d # from scipy.optimize import fsolve # Version Controller sTitle = 'DNVGL RP F103 Cathodic protection of submarine pipelines' sVersion = 'Version 1.0.0' # Define constants pi = m.pi e = m....
[ "numpy.array", "json.dumps" ]
[((402, 508), 'numpy.array', 'np.array', (['[[25, 0.05, 0.02], [50, 0.06, 0.03], [80, 0.075, 0.04], [120, 0.1, 0.06], [\n 200, 0.13, 0.08]]'], {}), '([[25, 0.05, 0.02], [50, 0.06, 0.03], [80, 0.075, 0.04], [120, 0.1,\n 0.06], [200, 0.13, 0.08]])\n', (410, 508), True, 'import numpy as np\n'), ((550, 767), 'numpy.a...
""" Getting started with The Cannon and APOGEE """ import os import numpy as np from astropy.table import Table import AnniesLasso as tc # Load in the data. PATH, CATALOG, FILE_FORMAT = ("/Users/arc/research/apogee/", "apogee-rg.fits", "apogee-rg-custom-normalization-{}.memmap") labelled_set = Table.read(os.pa...
[ "numpy.abs", "numpy.mean", "AnniesLasso.vectorizer.polynomial.terminator", "os.path.join", "AnniesLasso.L1RegularizedCannonModel", "numpy.random.seed" ]
[((840, 859), 'numpy.random.seed', 'np.random.seed', (['(888)'], {}), '(888)\n', (854, 859), True, 'import numpy as np\n'), ((1055, 1203), 'AnniesLasso.L1RegularizedCannonModel', 'tc.L1RegularizedCannonModel', (['labelled_set[train_set]', 'normalized_flux[train_set]', 'normalized_ivar[train_set]'], {'dispersion': 'disp...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ :mod:`fit` ================== .. module:: fit :synopsis: .. moduleauthor:: hbldh <<EMAIL>> Created on 2015-09-24, 07:18:22 """ from __future__ import division from __future__ import print_function from __future__ import unicode_literals from __future__ import a...
[ "b2ac.eigenmethods.inverse_iteration.inverse_iteration_for_eigenvector_double", "b2ac.matrix.matrix_operations.inverse_symmetric_3by3_double", "numpy.array", "numpy.dot", "b2ac.eigenmethods.qr_algorithm.QR_algorithm_shift_Givens_double" ]
[((1195, 1220), 'numpy.array', 'np.array', (['points', '"""float"""'], {}), "(points, 'float')\n", (1203, 1220), True, 'import numpy as np\n'), ((2502, 2566), 'numpy.array', 'np.array', (['[S[3, 3], S[3, 4], S[3, 5], S[4, 4], S[4, 5], S[5, 5]]'], {}), '([S[3, 3], S[3, 4], S[3, 5], S[4, 4], S[4, 5], S[5, 5]])\n', (2510,...
import logging import multiprocessing import os import pickle as pkl import numpy as np import tensorflow as tf from gensim.models import word2vec from gensim.models.word2vec import PathLineSentences logger = logging.getLogger('Word2Vec') logger.setLevel(logging.INFO) formatter = logging.Formatter('%(asctime)s - %(nam...
[ "logging.getLogger", "numpy.random.normal", "logging.StreamHandler", "pickle.dump", "tensorflow.app.flags.DEFINE_integer", "logging.Formatter", "os.path.join", "numpy.asarray", "tensorflow.app.flags.DEFINE_string", "multiprocessing.cpu_count", "numpy.stack", "numpy.concatenate", "gensim.mode...
[((210, 239), 'logging.getLogger', 'logging.getLogger', (['"""Word2Vec"""'], {}), "('Word2Vec')\n", (227, 239), False, 'import logging\n'), ((282, 355), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'], {}), "('%(asctime)s - %(name)s - %(levelname)s - %(message)s...
import struct import numpy from math import floor class HeightMap: def __init__(self, width, length, heightData=None, max_val=0): self.heightData = ( heightData if heightData != None else [0 for n in range(width * length)] ) self.width = width self.length = length ...
[ "numpy.mean", "numpy.median", "numpy.average", "struct.pack", "struct.unpack" ]
[((4669, 4706), 'numpy.average', 'numpy.average', (['hdata'], {'weights': 'weights'}), '(hdata, weights=weights)\n', (4682, 4706), False, 'import numpy\n'), ((4318, 4355), 'numpy.average', 'numpy.average', (['hdata'], {'weights': 'weights'}), '(hdata, weights=weights)\n', (4331, 4355), False, 'import numpy\n'), ((4357,...
from ctypes import * from typing import * from pathlib import Path from numpy import array, cos, ndarray, pi, random, sin, zeros, tan try: lib = cdll.LoadLibrary(str(Path(__file__).with_name("libkmeans.so"))) except Exception as E: print(f"Cannot load DLL") print(E) class observation_2d(Structure): ...
[ "numpy.tan", "pathlib.Path", "numpy.random.random", "numpy.array", "numpy.zeros", "numpy.cos", "numpy.random.seed", "numpy.sin" ]
[((2541, 2580), 'numpy.zeros', 'zeros', (['[k, 2]'], {'dtype': 'observations.dtype'}), '([k, 2], dtype=observations.dtype)\n', (2546, 2580), False, 'from numpy import array, cos, ndarray, pi, random, sin, zeros, tan\n'), ((2593, 2612), 'numpy.zeros', 'zeros', (['k'], {'dtype': 'int'}), '(k, dtype=int)\n', (2598, 2612),...
from collections import Counter, defaultdict import matplotlib as mpl import networkx as nx import numba import numpy as np import pandas as pd import plotly.graph_objects as go import seaborn as sns from fa2 import ForceAtlas2 from scipy import sparse def to_adjacency_matrix(net): if sparse.issparse(net): ...
[ "numpy.argsort", "networkx.draw_networkx_nodes", "networkx.draw_networkx_labels", "numpy.arange", "seaborn.color_palette", "networkx.spring_layout", "networkx.from_scipy_sparse_matrix", "numpy.linspace", "networkx.from_numpy_array", "pandas.DataFrame", "scipy.sparse.csr_matrix", "networkx.adja...
[((293, 313), 'scipy.sparse.issparse', 'sparse.issparse', (['net'], {}), '(net)\n', (308, 313), False, 'from scipy import sparse\n'), ((792, 812), 'scipy.sparse.issparse', 'sparse.issparse', (['net'], {}), '(net)\n', (807, 812), False, 'from scipy import sparse\n'), ((1070, 1102), 'collections.defaultdict', 'defaultdic...
""" A sampler defines a method to sample random data from certain distribution. """ from typing import List import numpy as np class BaseSampler(object): def __init__(self): pass def sample(self, shape, *args): raise NotImplementedError class IntSampler(BaseSampler): def __init__(self...
[ "numpy.random.normal", "numpy.array", "numpy.random.randint", "numpy.sum", "numpy.random.uniform", "numpy.random.randn" ]
[((582, 657), 'numpy.random.randint', 'np.random.randint', ([], {'low': 'self.low', 'high': 'self.high', 'size': 'shape', 'dtype': 'np.int64'}), '(low=self.low, high=self.high, size=shape, dtype=np.int64)\n', (599, 657), True, 'import numpy as np\n'), ((796, 809), 'numpy.array', 'np.array', (['low'], {}), '(low)\n', (8...
import numpy as np class StandardDeviation(): @staticmethod def standardDeviation(data): return np.std(data)
[ "numpy.std" ]
[((113, 125), 'numpy.std', 'np.std', (['data'], {}), '(data)\n', (119, 125), True, 'import numpy as np\n')]
import numpy as np def bowl(vs, v_ref=1.0, scale=.1): def normal(v, loc, scale): return 1 / np.sqrt(2 * np.pi * scale**2) * np.exp( - 0.5 * np.square(v - loc) / scale**2 ) def _bowl(v): if np.abs(v-v_ref) > 0.05: return 2 * np.abs(v-v_ref) - 0.095 else: return ...
[ "numpy.abs", "numpy.sqrt", "numpy.square" ]
[((216, 233), 'numpy.abs', 'np.abs', (['(v - v_ref)'], {}), '(v - v_ref)\n', (222, 233), True, 'import numpy as np\n'), ((107, 138), 'numpy.sqrt', 'np.sqrt', (['(2 * np.pi * scale ** 2)'], {}), '(2 * np.pi * scale ** 2)\n', (114, 138), True, 'import numpy as np\n'), ((263, 280), 'numpy.abs', 'np.abs', (['(v - v_ref)'],...
# -*- coding: utf-8 -*- """ Created on Sun Feb 7 13:43:01 2016 @author: fergal A series of metrics to quantify the noise in a lightcurve: Includes: x sgCdpp x Marshall's noise estimate o An FT based estimate of 6 hour artifact strength. o A per thruster firing estimate of 6 hour artifact strength. $Id$ $URL$ """ ...
[ "numpy.convolve", "matplotlib.pyplot.hist", "numpy.sqrt", "scipy.signal.savgol_filter", "numpy.nanmean", "numpy.isfinite", "fft.computeFft", "numpy.mean", "matplotlib.pyplot.plot", "numpy.diff", "numpy.linspace", "numpy.nanstd", "numpy.ones", "numpy.std", "matplotlib.pyplot.xlim", "num...
[((1197, 1228), 'fft.computeFft', 'fft.computeFft', (['y', 'expTime_days'], {}), '(y, expTime_days)\n', (1211, 1228), False, 'import fft\n'), ((3608, 3667), 'scipy.signal.savgol_filter', 'savgol_filter', (['y'], {'window_length': 'window', 'polyorder': 'polyorder'}), '(y, window_length=window, polyorder=polyorder)\n', ...
# Notes from this experiment: # 1. adapt() is way slower than np.unique -- takes forever for 1M, hangs for 10M # 2. TF returns error if adapt is inside tf.function. adapt uses graph inside anyway # 3. OOM in batch mode during sparse_to_dense despite of seting sparse in keras # 4. Mini-batch works but 15x(g)/20x slower ...
[ "tensorflow.keras.layers.Concatenate", "pandas.read_csv", "tensorflow.keras.layers.StringLookup", "numpy.array", "tensorflow.keras.Input", "tensorflow.keras.Model", "time.time", "warnings.filterwarnings", "tensorflow.stack", "numpy.set_printoptions" ]
[((1020, 1067), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)', 'suppress': '(True)'}), '(precision=3, suppress=True)\n', (1039, 1067), True, 'import numpy as np\n'), ((1068, 1101), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1091, 1101), Fal...
import warnings import numpy as np import scipy.sparse as sp from joblib import Parallel, delayed from scipy.special import expit from sklearn.exceptions import ConvergenceWarning from sklearn.utils import check_array, check_random_state from sklearn.linear_model import LogisticRegression from tqdm import tqdm from ...
[ "numpy.tile", "numpy.eye", "sklearn.utils.check_random_state", "numpy.ones", "numpy.add", "numpy.asarray", "numpy.iinfo", "joblib.Parallel", "numpy.zeros", "numpy.dot", "sklearn.utils.check_array", "warnings.warn", "joblib.delayed" ]
[((1275, 1307), 'sklearn.utils.check_random_state', 'check_random_state', (['random_state'], {}), '(random_state)\n', (1293, 1307), False, 'from sklearn.utils import check_array, check_random_state\n'), ((1415, 1457), 'numpy.zeros', 'np.zeros', (['(n_time_steps, n_nodes, n_nodes)'], {}), '((n_time_steps, n_nodes, n_nod...
#!/usr/bin/env python __author__ = "<NAME>" __license__ = "MIT" __email__ = "<EMAIL>" __credits__ = "<NAME> -- An amazing Linear Algebra Professor" import cvxopt import numpy as np class SupportVectorClassification: """ Support Vector Machine classification model """ def __init__(self): """ ...
[ "numpy.ones", "numpy.array", "numpy.zeros", "numpy.outer", "numpy.dot", "cvxopt.matrix", "numpy.ravel", "cvxopt.solvers.qp" ]
[((407, 419), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (415, 419), True, 'import numpy as np\n'), ((444, 456), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (452, 456), True, 'import numpy as np\n'), ((1843, 1881), 'cvxopt.matrix', 'cvxopt.matrix', (['expected_values', '(1, m)'], {}), '(expected_values, ...
""" MIT License Copyright 2021 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute...
[ "hans.tools.abort", "numpy.array", "numpy.sin", "numpy.arange", "os.path.exists", "os.listdir", "netCDF4.Dataset", "numpy.linspace", "numpy.meshgrid", "pkg_resources.get_distribution", "os.path.relpath", "os.path.splitext", "shutil.copy", "hans.plottools.adaptiveLimits", "hans.material.M...
[((3950, 4078), 'hans.integrate.ConservedField', 'ConservedField', (['self.disc', 'self.bc', 'self.geometry', 'self.material', 'self.numerics', 'self.surface'], {'q_init': 'q_init', 't_init': 't_init'}), '(self.disc, self.bc, self.geometry, self.material, self.\n numerics, self.surface, q_init=q_init, t_init=t_init)...
""" Script to make nucleosome occupancy track! @author: <NAME> """ ##### IMPORT MODULES ##### # import necessary python modules #import matplotlib as mpl #mpl.use('PS') import matplotlib.pyplot as plt import multiprocessing as mp import numpy as np import traceback import itertools import pysam from pyatac.utils impo...
[ "pysam.tabix_compress", "multiprocessing.JoinableQueue", "nucleoatac.Occupancy.OccChunk", "matplotlib.pyplot.ylabel", "multiprocessing.Process", "itertools.repeat", "pyatac.utils.read_chrom_sizes_from_fasta", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.close", "pysam.tabix_index", "traceback....
[((2492, 2510), 'pyatac.bias.PWM.open', 'PWM.open', (['args.pwm'], {}), '(args.pwm)\n', (2500, 2510), False, 'from pyatac.bias import PWM\n'), ((2789, 2833), 'nucleoatac.Occupancy.FragmentMixDistribution', 'FragmentMixDistribution', (['(0)'], {'upper': 'args.upper'}), '(0, upper=args.upper)\n', (2812, 2833), False, 'fr...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import import sys, os from soma import aims, aimsalgo import numpy import optparse parser = optparse.OptionParser( description='Voronoi diagram of the sulci ' \ 'nodes regions, in the grey matter, an...
[ "soma.aims.write", "soma.aims.FastMarching", "optparse.OptionParser", "numpy.array", "soma.aims.RawConverter_BucketMap_VOID_rc_ptr_Volume_S16", "soma.aims.read" ]
[((211, 357), 'optparse.OptionParser', 'optparse.OptionParser', ([], {'description': '"""Voronoi diagram of the sulci nodes regions, in the grey matter, and extending to the whole 3D space"""'}), "(description=\n 'Voronoi diagram of the sulci nodes regions, in the grey matter, and extending to the whole 3D space'\n ...
#!/usr/bin/env python3 import numpy as np import copy import itertools import sys import ete3 import numpy as np from Bio import AlignIO # import CIAlign.cropSeq as cropSeq # from AlignmentStats import find_removed_cialign def writeOutfile(outfile, arr, nams, rmfile=None): ''' Writes an alignment stored in ...
[ "numpy.char.upper", "numpy.where", "numpy.append", "numpy.array", "numpy.sum", "numpy.vstack", "copy.copy" ]
[((7324, 7342), 'numpy.char.upper', 'np.char.upper', (['arr'], {}), '(arr)\n', (7337, 7342), True, 'import numpy as np\n'), ((2403, 2421), 'numpy.array', 'np.array', (['seqs[1:]'], {}), '(seqs[1:])\n', (2411, 2421), True, 'import numpy as np\n'), ((5606, 5621), 'copy.copy', 'copy.copy', (['nams'], {}), '(nams)\n', (561...
""" Contacts between nucleotides in a tetracycline aptamer ====================================================== This example reproduces a figure from the publication *"StreAM-Tg: algorithms for analyzing coarse grained RNA dynamics based on Markov models of connectivity-graphs"* [1]_. The figure displays a coarse g...
[ "ammolite.PyMOLObject.from_structure", "biotite.database.rcsb.fetch", "numpy.where", "biotite.structure.io.mmtf.get_structure", "numpy.stack", "biotite.structure.CellList", "ammolite.show", "biotite.structure.filter_nucleotides", "ammolite.cmd.set", "ammolite.cmd.rotate", "ammolite.cmd.bg_color"...
[((998, 1036), 'biotite.structure.io.mmtf.get_structure', 'mmtf.get_structure', (['mmtf_file'], {'model': '(1)'}), '(mmtf_file, model=1)\n', (1016, 1036), True, 'import biotite.structure.io.mmtf as mmtf\n'), ((1409, 1453), 'ammolite.PyMOLObject.from_structure', 'ammolite.PyMOLObject.from_structure', (['aptamer'], {}), ...
import numpy as np class DOM: """ Object representing a discretized observation model. Comprised primarily by the DOM.edges and DOM.chi vectors, which represent the discrete mask and state-dependent emission probabilities, respectively. """ def __init__(self): self.k = None se...
[ "numpy.flip", "numpy.searchsorted", "numpy.array2string", "numpy.sum", "numpy.zeros", "numpy.linspace", "numpy.array", "numpy.vstack", "numpy.interp", "numpy.arange" ]
[((1282, 1348), 'numpy.interp', 'np.interp', (['qbin_edges', "stats['quantile_basis']", "stats['quantiles']"], {}), "(qbin_edges, stats['quantile_basis'], stats['quantiles'])\n", (1291, 1348), True, 'import numpy as np\n'), ((1544, 1574), 'numpy.zeros', 'np.zeros', (['(2, self.n_bins + 1)'], {}), '((2, self.n_bins + 1)...
"""Calculate the partial derivatives of the source coordinates Description: ------------ Calculate the partial derivatives of the source coordinates. This is done according to equations (2.47) - (2.50) in Teke [2]_. References: ----------- .. [1] <NAME>. and <NAME>. (eds.), IERS Conventions (2010), IERS Technical...
[ "numpy.hstack", "numpy.logical_not", "where.apriori.get", "numpy.logical_or", "numpy.array" ]
[((1179, 1213), 'where.apriori.get', 'apriori.get', (['"""crf"""'], {'time': 'dset.time'}), "('crf', time=dset.time)\n", (1190, 1213), False, 'from where import apriori\n'), ((1371, 1488), 'numpy.logical_or', 'np.logical_or', (['[(icrf[src].meta[group] if group in icrf[src].meta else src == group) for\n src in sourc...
#!/usr/bin/env python # # fsl_ents.py - Extract ICA component time courses from a MELODIC directory. # # Author: <NAME> <<EMAIL>> # """This module defines the ``fsl_ents`` script, for extracting component time series from a MELODIC ``.ica`` directory. """ import os.path as op import sys import a...
[ "os.path.exists", "numpy.atleast_2d", "argparse.ArgumentParser", "numpy.hstack", "warnings.catch_warnings", "numpy.zeros", "fsl.data.fixlabels.loadLabelFile", "numpy.savetxt", "sys.exit", "os.path.abspath", "numpy.loadtxt", "warnings.filterwarnings", "fsl.data.melodicanalysis.getComponentTim...
[((415, 440), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (438, 440), False, 'import warnings\n'), ((446, 503), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarning'}), "('ignore', category=FutureWarning)\n", (469, 503), False, 'import warnings...
import collections import io import numpy as np import tensorflow as tf hidden_dim = 1000 input_size = 28 * 28 output_size = 10 train_data_file = "/home/harper/dataset/mnist/train-images.idx3-ubyte" train_label_file = "/home/harper/dataset/mnist/train-labels.idx1-ubyte" test_data_file = "/home/harper/dataset/mnist/t...
[ "tensorflow.equal", "io.open", "tensorflow.nn.sparse_softmax_cross_entropy_with_logits", "tensorflow.reduce_mean", "tensorflow.cast", "tensorflow.placeholder", "tensorflow.Session", "tensorflow.matmul", "numpy.frombuffer", "tensorflow.summary.scalar", "tensorflow.train.AdamOptimizer", "numpy.d...
[((425, 478), 'collections.namedtuple', 'collections.namedtuple', (['"""Datasets"""', "['train', 'test']"], {}), "('Datasets', ['train', 'test'])\n", (447, 478), False, 'import collections\n'), ((2192, 2248), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, input_size]'], {'name': '"""x"""'}), "(tf.f...
import json import tempfile from collections import OrderedDict import os import numpy as np from pycocotools.coco import COCO from pycocotools.cocoeval import COCOeval from utils import BoxList #from utils.pycocotools_rotation import Rotation_COCOeval def evaluate(dataset, predictions, result_file, score_...
[ "collections.OrderedDict", "numpy.round", "utils.BoxList", "pycocotools.coco.COCO", "numpy.linspace", "numpy.maximum", "json.dump" ]
[((1758, 1799), 'numpy.linspace', 'np.linspace', (['(0)', '(1)'], {'num': 'precision.shape[0]'}), '(0, 1, num=precision.shape[0])\n', (1769, 1799), True, 'import numpy as np\n'), ((1082, 1103), 'json.dump', 'json.dump', (['results', 'f'], {}), '(results, f)\n', (1091, 1103), False, 'import json\n'), ((1171, 1177), 'pyc...
#! /usr/env/bin python import os import linecache import numpy as np from collections import OrderedDict from CP2K_kit.tools import call from CP2K_kit.tools import data_op from CP2K_kit.tools import file_tools from CP2K_kit.tools import read_input from CP2K_kit.tools import traj_info from CP2K_kit.deepff import load_d...
[ "CP2K_kit.deepff.gen_lammps_task.get_box_coord", "CP2K_kit.tools.data_op.list_replicate", "numpy.array", "CP2K_kit.tools.data_op.gen_list", "CP2K_kit.tools.data_op.add_2d_list", "os.path.exists", "CP2K_kit.deepff.load_data.load_data_from_dir", "CP2K_kit.tools.data_op.eval_str", "CP2K_kit.tools.data_...
[((1413, 1450), 'CP2K_kit.tools.call.call_returns_shell', 'call.call_returns_shell', (['exe_dir', 'cmd'], {}), '(exe_dir, cmd)\n', (1436, 1450), False, 'from CP2K_kit.tools import call\n'), ((3556, 3603), 'CP2K_kit.tools.read_input.dump_info', 'read_input.dump_info', (['work_dir', 'inp_file', 'f_key'], {}), '(work_dir,...
import time import numpy as np import utils.measurement_subs as measurement_subs import utils.socket_subs as socket_subs from .do_fridge_sweep import do_fridge_sweep from .do_device_sweep import do_device_sweep def device_fridge_2d( graph_proc, rpg, data_file, read_inst, sweep_inst=[], set_inst=[], ...
[ "numpy.arange", "time.sleep", "utils.socket_subs.SockClient", "utils.measurement_subs.generate_device_sweep", "utils.measurement_subs.socket_write" ]
[((7004, 7046), 'utils.socket_subs.SockClient', 'socket_subs.SockClient', (['"""localhost"""', '(18861)'], {}), "('localhost', 18861)\n", (7026, 7046), True, 'import utils.socket_subs as socket_subs\n'), ((7051, 7064), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (7061, 7064), False, 'import time\n'), ((7069, 71...
import re import numpy as np import sympy as sp import random as rd from functools import reduce NORMAL_VECTOR_ID = 'hyperplane_normal_vector_%s_%i' NUM_NORMAL_VECS_ID = 'num_normal_vectors_%s' CHAMBER_ID = 'chamber_%s_%s' FVECTOR_ID = 'feature_vector_%s' FVEC_ID_EX = re.compile(r'feature_vector_([\S]*)') class Hype...
[ "re.compile", "numpy.binary_repr", "numpy.dot", "sympy.binomial_coefficients_list", "random.random" ]
[((270, 307), 're.compile', 're.compile', (['"""feature_vector_([\\\\S]*)"""'], {}), "('feature_vector_([\\\\S]*)')\n", (280, 307), False, 'import re\n'), ((1551, 1583), 'sympy.binomial_coefficients_list', 'sp.binomial_coefficients_list', (['n'], {}), '(n)\n', (1580, 1583), True, 'import sympy as sp\n'), ((7996, 8041),...
""" Set of programs and tools to read the outputs from RH (Han's version) """ import os import sys import io import xdrlib import numpy as np class Rhout: """ Reads outputs from RH. Currently the reading the following output files is supported: - input.out - geometry.out - atmos.out -...
[ "xdrlib.Unpacker", "numpy.prod", "numpy.fromfile", "numpy.sqrt", "numpy.arccos", "io.open", "os.path.isfile", "xdrlib.Packer", "numpy.zeros", "numpy.sum", "numpy.exp", "numpy.loadtxt", "numpy.transpose", "numpy.arctan" ]
[((24930, 24951), 'xdrlib.Unpacker', 'xdrlib.Unpacker', (['data'], {}), '(data)\n', (24945, 24951), False, 'import xdrlib\n'), ((28119, 28136), 'numpy.transpose', 'np.transpose', (['chi'], {}), '(chi)\n', (28131, 28136), True, 'import numpy as np\n'), ((28147, 28168), 'numpy.zeros', 'np.zeros', (['chi_t.shape'], {}), '...
import logging, tqdm import numpy as np import rawpy import colour_demosaicing as cd import HDRutils.io as io from HDRutils.utils import * logger = logging.getLogger(__name__) def merge(files, do_align=False, demosaic_first=True, normalize=False, color_space='sRGB', wb=None, saturation_percent=0.98, black_leve...
[ "logging.getLogger", "numpy.ones_like", "numpy.eye", "HDRutils.io.imread", "numpy.ones", "tqdm.tqdm", "numpy.argsort", "numpy.array", "numpy.zeros", "numpy.linalg.inv", "HDRutils.io.imread_libraw", "numpy.argmin", "rawpy.imread", "colour_demosaicing.demosaicing_CFA_Bayer_bilinear" ]
[((151, 178), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (168, 178), False, 'import logging, tqdm\n'), ((3835, 3903), 'numpy.argmin', 'np.argmin', (["(metadata['exp'] * metadata['gain'] * metadata['aperture'])"], {}), "(metadata['exp'] * metadata['gain'] * metadata['aperture'])\n", (3...
import pickle import numpy as np import sys def eigen(num, split_num, layer_num): prefix = 'min_' layer_num = int(layer_num) num = str(num) #cur = [8, 8, 8, 8, 16, 16, 24, 24, 24, 24, 24, 24, 32, 32] #cur = [10, 12, 13, 13, 21, 29, 35, 37, 35, 25, 28, 28, 37, 32] #cur = [12, 12, 18, 17, 28, 54...
[ "numpy.mean", "numpy.reshape", "numpy.ones", "numpy.sqrt", "numpy.squeeze", "numpy.argsort", "numpy.array", "numpy.zeros", "numpy.argwhere", "numpy.concatenate" ]
[((2128, 2141), 'numpy.ones', 'np.ones', (['[14]'], {}), '([14])\n', (2135, 2141), True, 'import numpy as np\n'), ((2887, 2900), 'numpy.argsort', 'np.argsort', (['W'], {}), '(W)\n', (2897, 2900), True, 'import numpy as np\n'), ((4491, 4503), 'numpy.array', 'np.array', (['DL'], {}), '(DL)\n', (4499, 4503), True, 'import...
import numpy as np import open3d as o3d import pickle import torch import ipdb st = ipdb.set_trace def apply_4x4(RT, xyz): B, N, _ = list(xyz.shape) ones = torch.ones_like(xyz[:,:,0:1]) xyz1 = torch.cat([xyz, ones], 2) xyz1_t = torch.transpose(xyz1, 1, 2) # this is B x 4 x N xyz2_t = torch.ma...
[ "torch.ones_like", "torch.transpose", "numpy.max", "open3d.utility.Vector3dVector", "open3d.visualization.draw_geometries", "torch.matmul", "open3d.geometry.PointCloud", "numpy.min", "open3d.geometry.TriangleMesh.create_coordinate_frame", "numpy.load", "torch.cat" ]
[((760, 835), 'open3d.geometry.TriangleMesh.create_coordinate_frame', 'o3d.geometry.TriangleMesh.create_coordinate_frame', ([], {'size': '(1)', 'origin': '[0, 0, 0]'}), '(size=1, origin=[0, 0, 0])\n', (809, 835), True, 'import open3d as o3d\n'), ((1315, 1358), 'open3d.visualization.draw_geometries', 'o3d.visualization....
""" Helper functions for image processing The color space conversion functions are modified from functions of the Python package scikit-image, https://github.com/scikit-image/scikit-image. scikit-image has the following license. Copyright (C) 2019, the scikit-image team All rights reserved. Redistribution and use in...
[ "numpy.clip", "io.BytesIO", "numpy.array", "sklearn.cluster.AgglomerativeClustering", "numpy.asarray", "dotenv.load_dotenv", "numpy.empty", "numpy.concatenate", "numpy.tile", "numpy.any", "requests.get", "numpy.nonzero", "numpy.transpose", "numpy.vectorize", "sklearn.cluster.KMeans", "...
[((1918, 1931), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (1929, 1931), False, 'from dotenv import load_dotenv\n'), ((1945, 1967), 'os.getenv', 'os.getenv', (['"""SLS_STAGE"""'], {}), "('SLS_STAGE')\n", (1954, 1967), False, 'import os\n'), ((2064, 2099), 'numpy.asarray', 'np.asarray', (['(0.95047, 1.0, 1.0...
""" TopView is the main Widget with the related ControllerTopView Class There are several SliceView windows (sagittal, coronal, possibly tilted etc...) that each have a SliceController object The underlying data model object is an ibllib.atlas.AllenAtlas object TopView(QMainWindow) ControllerTopView(PgImageCon...
[ "numpy.insert", "PyQt5.QtWidgets.QApplication.instance", "PyQt5.QtGui.QTransform", "matplotlib.cm.get_cmap", "pathlib.Path", "pyqtgraph.ScatterPlotItem", "pyqtgraph.InfiniteLine", "numpy.array", "ibllib.atlas.AllenAtlas", "numpy.zeros", "numpy.isnan", "pyqtgraph.mkPen", "numpy.nanmin", "qt...
[((14373, 14408), 'dataclasses.field', 'field', ([], {'default_factory': 'pg.ImageItem'}), '(default_factory=pg.ImageItem)\n', (14378, 14408), False, 'from dataclasses import dataclass, field\n'), ((14431, 14465), 'dataclasses.field', 'field', ([], {'default_factory': '(lambda : {})'}), '(default_factory=lambda : {})\n...
import os import numpy as np import numpy.random as rnd import matplotlib.pyplot as plt import logging from pandas import DataFrame from common.gen_samples import * from common.data_plotter import * from aad.aad_globals import * from aad.aad_support import * from aad.forest_description import * from aad.anomaly_data...
[ "logging.getLogger", "numpy.argsort", "numpy.array", "numpy.sin", "numpy.reshape", "numpy.where", "numpy.max", "matplotlib.pyplot.axhline", "matplotlib.pyplot.yticks", "numpy.vstack", "numpy.random.seed", "numpy.min", "matplotlib.pyplot.ylim", "numpy.arctan", "numpy.ones", "matplotlib....
[((481, 495), 'numpy.argsort', 'np.argsort', (['(-v)'], {}), '(-v)\n', (491, 495), True, 'import numpy as np\n'), ((3499, 3525), 'numpy.random.uniform', 'rnd.uniform', (['(0.0)', '(1.0)', '(500)'], {}), '(0.0, 1.0, 500)\n', (3510, 3525), True, 'import numpy.random as rnd\n'), ((3538, 3577), 'numpy.reshape', 'np.reshape...
# -*- coding: utf-8 -*- """ Barycenters =========== This example shows three methods to compute barycenters of time series. For an overview over the available methods see the :mod:`tslearn.barycenters` module. *tslearn* provides three methods for calculating barycenters for a given set of time series: * *Euclidean b...
[ "tslearn.barycenters.dtw_barycenter_averaging", "tslearn.barycenters.dtw_barycenter_averaging_subgradient", "tslearn.barycenters.euclidean_barycenter", "tslearn.datasets.CachedDatasets", "numpy.random.seed", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "t...
[((2102, 2122), 'numpy.random.seed', 'numpy.random.seed', (['(0)'], {}), '(0)\n', (2119, 2122), False, 'import numpy\n'), ((2587, 2607), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(4)', '(1)', '(1)'], {}), '(4, 1, 1)\n', (2598, 2607), True, 'import matplotlib.pyplot as plt\n'), ((2608, 2641), 'matplotlib.pyplot.tit...
import numpy as np import pandas as pd import pandas.api.types as pdtypes from ..utils import resolution from ..doctools import document from .stat import stat @document class stat_boxplot(stat): """ Compute boxplot statistics {usage} Parameters ---------- {common_parameters} coef : flo...
[ "numpy.ptp", "numpy.sqrt", "numpy.unique", "numpy.average", "numpy.asarray", "numpy.max", "numpy.argsort", "numpy.sum", "pandas.api.types.is_categorical_dtype", "numpy.percentile", "numpy.interp", "numpy.min", "pandas.DataFrame", "numpy.cumsum" ]
[((3580, 3599), 'numpy.asarray', 'np.asarray', (['weights'], {}), '(weights)\n', (3590, 3599), True, 'import numpy as np\n'), ((3608, 3621), 'numpy.asarray', 'np.asarray', (['q'], {}), '(q)\n', (3618, 3621), True, 'import numpy as np\n'), ((3645, 3658), 'numpy.argsort', 'np.argsort', (['a'], {}), '(a)\n', (3655, 3658),...
# -*- coding: utf-8 -*- import math import numpy as np import matplotlib.pyplot as plt #Constants GNa = 120 #Maximal conductance(Na+) ms/cm2 Gk = 36 #Maximal condectance(K+) ms/cm2 Gleak = 0.3 #Maximal conductance(leak) ms/cm2 cm = 1 #Cell capacitance uF/cm2 delta = 0.01 #Axon condectivity ms2 ENa = 50 #Nernst poten...
[ "math.pow", "matplotlib.pyplot.clf", "numpy.argmax", "matplotlib.pyplot.figure", "math.exp", "numpy.arange", "matplotlib.pyplot.show" ]
[((518, 549), 'numpy.arange', 'np.arange', (['(0)', 'domain_length', 'dx'], {}), '(0, domain_length, dx)\n', (527, 549), True, 'import numpy as np\n'), ((555, 588), 'numpy.arange', 'np.arange', (['(0)', 'simulation_time', 'dt'], {}), '(0, simulation_time, dt)\n', (564, 588), True, 'import numpy as np\n'), ((2350, 2368)...
# Copyright (c) 2016-present, Facebook, Inc. # # 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...
[ "numpy.random.rand", "numpy.log", "hypothesis.strategies.integers", "caffe2.python.core.CreateOperator" ]
[((1536, 1590), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""BernoulliJSD"""', "['p', 'q']", "['l']"], {}), "('BernoulliJSD', ['p', 'q'], ['l'])\n", (1555, 1590), False, 'from caffe2.python import core\n'), ((1031, 1040), 'numpy.log', 'np.log', (['p'], {}), '(p)\n', (1037, 1040), True, 'import nump...
from collections import deque import networkx as nx import numpy as np def random_subtree(T, alpha, beta, subtree_mark): """ Random subtree of T according to Algorithm X in [1]. Args: alpha (float): probability of continuing to a neighbor beta (float): probability of non empty subtree ...
[ "numpy.float", "collections.deque", "numpy.power", "networkx.Graph", "numpy.random.multinomial", "numpy.random.randint" ]
[((937, 946), 'collections.deque', 'deque', (['[]'], {}), '([])\n', (942, 946), False, 'from collections import deque\n'), ((959, 979), 'numpy.random.randint', 'np.random.randint', (['n'], {}), '(n)\n', (976, 979), True, 'import numpy as np\n'), ((2194, 2216), 'numpy.power', 'np.power', (['(1 - alpha)', 'w'], {}), '(1 ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Constants parameter functions DRS Import Rules: - only from apero.lang and apero.core.constants Created on 2019-01-17 at 15:24 @author: cook """ from collections import OrderedDict import copy import numpy as np import os import pkg_resources import shutil import sy...
[ "ctypes.create_string_buffer", "copy.deepcopy", "sys.exit", "numpy.nanmin", "os.remove", "os.path.exists", "ctypes.windll.kernel32.GetConsoleScreenBufferInfo", "os.listdir", "apero.core.constants.constant_functions.generate_consts", "os.path.normpath", "apero.core.constants.constant_functions.Di...
[((44313, 44368), 'apero.core.constants.constant_functions.import_module', 'constant_functions.import_module', (['func_name', 'modules[0]'], {}), '(func_name, modules[0])\n', (44345, 44368), False, 'from apero.core.constants import constant_functions\n'), ((61893, 61925), 'apero.core.constants.constant_functions.Displa...
import matplotlib.pyplot as plt import matplotlib from matplotlib import animation import seaborn as sns import numpy as np import cmocean import os from mpl_toolkits.axes_grid1 import AxesGrid from mpl_toolkits.axes_grid1 import make_axes_locatable import scipy import scipy.ndimage from scipy.stats import norm import ...
[ "matplotlib.pyplot.pcolormesh", "numpy.array", "scipy.ndimage.gaussian_filter", "numpy.sin", "matplotlib.pyplot.imshow", "matplotlib.pyplot.contourf", "seaborn.set", "matplotlib.pyplot.close", "matplotlib.pyplot.contour", "numpy.linspace", "os.path.isdir", "matplotlib.pyplot.clabel", "numpy....
[((2947, 2993), 'scipy.ndimage.gaussian_filter', 'scipy.ndimage.gaussian_filter', (['V'], {'sigma': 'sigVal'}), '(V, sigma=sigVal)\n', (2976, 2993), False, 'import scipy\n'), ((3053, 3099), 'scipy.ndimage.gaussian_filter', 'scipy.ndimage.gaussian_filter', (['W'], {'sigma': 'sigVal'}), '(W, sigma=sigVal)\n', (3082, 3099...
#!/usr/bin/env python3 """ ROS component that implement a ball detector """ # Import of libraries import sys import time import numpy as np from scipy.ndimage import filters import imutils import cv2 import roslib import rospy from sensor_msgs.msg import CompressedImage from sensoring.srv import DetectImage,Dete...
[ "rospy.init_node", "cv2.imshow", "cv2.destroyAllWindows", "cv2.imdecode", "cv2.erode", "rospy.Service", "imutils.grab_contours", "rospy.spin", "numpy.fromstring", "rospy.Subscriber", "cv2.waitKey", "cv2.minEnclosingCircle", "sensoring.srv.DetectImageResponse", "cv2.circle", "cv2.cvtColor...
[((5511, 5534), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (5532, 5534), False, 'import cv2\n'), ((1227, 1276), 'rospy.init_node', 'rospy.init_node', (['"""image_detector"""'], {'anonymous': '(True)'}), "('image_detector', anonymous=True)\n", (1242, 1276), False, 'import rospy\n'), ((1361, 1466...
import numpy as np import openpnm as op from porespy.filters import trim_nonpercolating_paths import collections def tortuosity(im, axis, return_im=False, **kwargs): r""" Calculates tortuosity of given image in specified direction Parameters ---------- im : ND-image The binary image to an...
[ "numpy.prod", "openpnm.utils.toc", "openpnm.phases.Water", "openpnm.utils.tic", "collections.namedtuple", "numpy.allclose", "numpy.reshape", "porespy.filters.trim_nonpercolating_paths", "numpy.zeros", "openpnm.algorithms.FickianDiffusion", "openpnm.network.CubicTemplate" ]
[((1416, 1480), 'porespy.filters.trim_nonpercolating_paths', 'trim_nonpercolating_paths', (['im'], {'inlet_axis': 'axis', 'outlet_axis': 'axis'}), '(im, inlet_axis=axis, outlet_axis=axis)\n', (1441, 1480), False, 'from porespy.filters import trim_nonpercolating_paths\n'), ((1819, 1867), 'openpnm.network.CubicTemplate',...
import unittest import numpy from oo_trees.dataset import * from oo_trees.decision_tree import * from oo_trees.attribute import * class TestDecisionTree(unittest.TestCase): def test_classification(self): X = numpy.array([[0, 1], [0, 0], [1, 0], [1, 1]]) y = numpy.array(['H', 'H', 'H', 'T']) ...
[ "numpy.array" ]
[((221, 266), 'numpy.array', 'numpy.array', (['[[0, 1], [0, 0], [1, 0], [1, 1]]'], {}), '([[0, 1], [0, 0], [1, 0], [1, 1]])\n', (232, 266), False, 'import numpy\n'), ((279, 312), 'numpy.array', 'numpy.array', (["['H', 'H', 'H', 'T']"], {}), "(['H', 'H', 'H', 'T'])\n", (290, 312), False, 'import numpy\n'), ((1039, 1067)...
import numpy as np k_i = np.array([0.20, 0.22, 0.78, 0.80, 0.30, 0.32, 0.96, 1.00, 1.20, 1.43, 1.80, 1.88, 0.40, 0.50, 3.24, 3.50, 0.38, 0.43, 2.24, 4.90, 0.40, 0.44, 1.22, 4.00, 0.39, 0.44, 0.96, 1.80, 0.39...
[ "numpy.linalg.solve", "numpy.sqrt", "numpy.array", "numpy.linspace", "numpy.zeros" ]
[((26, 255), 'numpy.array', 'np.array', (['[0.2, 0.22, 0.78, 0.8, 0.3, 0.32, 0.96, 1.0, 1.2, 1.43, 1.8, 1.88, 0.4, 0.5,\n 3.24, 3.5, 0.38, 0.43, 2.24, 4.9, 0.4, 0.44, 1.22, 4.0, 0.39, 0.44, \n 0.96, 1.8, 0.39, 0.45, 0.8, 1.6, 0.4, 0.47, 0.6, 1.6]'], {'dtype': 'float'}), '([0.2, 0.22, 0.78, 0.8, 0.3, 0.32, 0.96, 1...
import numpy as np def fit_MRF_pseudolikelihood(adj_exc,adj_inh,y): ''' Fit a Markov random field using maximum pseudolikelihood estimation, also known as logistic regression. The conditional probabilities follow y_i ~ Logistic(B[0] + B[1] A1_{ij} y_j + A1[2] X_{ij} (1-y_j) + B[...
[ "numpy.random.rand", "numpy.column_stack", "numpy.array", "networkx.closeness_centrality", "networkx.betweenness_centrality", "numpy.arange", "networkx.eigenvector_centrality_numpy", "numpy.mean", "numpy.multiply", "networkx.clustering", "networkx.DiGraph", "numpy.exp", "numpy.dot", "netwo...
[((2585, 2605), 'numpy.random.rand', 'np.random.rand', (['N', '(1)'], {}), '(N, 1)\n', (2599, 2605), True, 'import numpy as np\n'), ((2617, 2637), 'numpy.zeros', 'np.zeros', (['(N, steps)'], {}), '((N, steps))\n', (2625, 2637), True, 'import numpy as np\n'), ((2684, 2712), 'numpy.fill_diagonal', 'np.fill_diagonal', (['...
from __future__ import print_function import numpy as np import treegp from treegp_test_helper import timer from treegp_test_helper import get_correlation_length_matrix from treegp_test_helper import make_1d_grf from treegp_test_helper import make_2d_grf @timer def test_hyperparameter_search_1d(): optimizer = ['l...
[ "numpy.mean", "treegp.GPInterpolation", "treegp.eval_kernel", "numpy.sqrt", "numpy.ones_like", "numpy.testing.assert_allclose", "treegp_test_helper.make_1d_grf", "numpy.diag", "numpy.exp", "treegp_test_helper.get_correlation_length_matrix", "numpy.array", "numpy.linalg.inv", "numpy.max", "...
[((3968, 4014), 'treegp_test_helper.get_correlation_length_matrix', 'get_correlation_length_matrix', (['size[n]', 'g1', 'g2'], {}), '(size[n], g1, g2)\n', (3997, 4014), False, 'from treegp_test_helper import get_correlation_length_matrix\n'), ((4030, 4046), 'numpy.linalg.inv', 'np.linalg.inv', (['L'], {}), '(L)\n', (40...