code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import random from random import choice import numpy as np import pandas as pd from pyspark.sql import SparkSession from ydot.spark import smatrices random.seed(37) np.random.seed(37) def get_spark_dataframe(spark): n = 100 data = { 'a': [choice(['left', 'right']) for _ in range(n)], 'b': [...
[ "numpy.random.normal", "random.choice", "pyspark.sql.SparkSession.builder.master", "ydot.spark.smatrices", "random.seed", "numpy.random.seed", "pandas.DataFrame" ]
[((152, 167), 'random.seed', 'random.seed', (['(37)'], {}), '(37)\n', (163, 167), False, 'import random\n'), ((168, 186), 'numpy.random.seed', 'np.random.seed', (['(37)'], {}), '(37)\n', (182, 186), True, 'import numpy as np\n'), ((522, 540), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (534, 540), T...
from typing import List import numpy as np from scores.scoreutils import simple_normalization from scores import weightsmodel def _attentive_pool_with_weights(encoded, weights): weights = simple_normalization(np.expand_dims(weights, axis=-1), axis=1) # [B,L,1] weight_encoded = weights * encoded # [B,L,D] ...
[ "numpy.sum", "numpy.array", "scores.weightsmodel.SentenceWeightModel", "numpy.expand_dims" ]
[((333, 363), 'numpy.sum', 'np.sum', (['weight_encoded'], {'axis': '(1)'}), '(weight_encoded, axis=1)\n', (339, 363), True, 'import numpy as np\n'), ((217, 249), 'numpy.expand_dims', 'np.expand_dims', (['weights'], {'axis': '(-1)'}), '(weights, axis=-1)\n', (231, 249), True, 'import numpy as np\n'), ((519, 553), 'score...
''' Author: <NAME> Miscellaneous data related utilities used by the main.py file in the scripts folder. ''' import numpy as np import logging from collections import Counter import collections import pickle import re import networkx as nx import spacy from spacy.tokens import Doc import nltk nltk.download('wordnet')...
[ "numpy.mean", "collections.OrderedDict", "json.loads", "numpy.amax", "numpy.amin", "nltk.download", "numpy.arange", "json.dumps", "pickle.load", "h5py.File", "collections.Counter", "numpy.array", "numpy.zeros", "numpy.append", "numpy.std", "re.findall", "pandas.concat", "numpy.rand...
[((296, 320), 'nltk.download', 'nltk.download', (['"""wordnet"""'], {}), "('wordnet')\n", (309, 320), False, 'import nltk\n'), ((6470, 6479), 'collections.Counter', 'Counter', ([], {}), '()\n', (6477, 6479), False, 'from collections import Counter\n'), ((9899, 9912), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n',...
"""Mean-scale hyperprior model (no context model), as described in "Joint Autoregressive and Hierarchical Priors for Learned Image Compression", NeurIPS2018, by Minnen, Ballé, and Toderici (https://arxiv.org/abs/1809.02736 Also see <NAME>, <NAME>, <NAME>: "Improving Inference for Neural Image Compression", NeurIPS 202...
[ "numpy.prod", "tf_boilerplate.train", "tensorflow.compat.v1.exp", "utils.write_png", "tensorflow_compression.GaussianConditional", "tensorflow.compat.v1.shape", "numpy.log", "tensorflow.compat.v1.train.AdamOptimizer", "nn_models.AnalysisTransform", "tensorflow.compat.v1.squared_difference", "ten...
[((1130, 1150), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1144, 1150), True, 'import numpy as np\n'), ((1151, 1175), 'tensorflow.compat.v1.set_random_seed', 'tf.set_random_seed', (['seed'], {}), '(seed)\n', (1169, 1175), True, 'import tensorflow.compat.v1 as tf\n'), ((1964, 1999), 'nn_models.A...
""" Support functions for BIDS MRI fieldmap handling MIT License Copyright (c) 2017-2022 <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 th...
[ "numpy.abs", "numpy.unique", "bids.layout.parse_file_entities", "json.dump", "os.path.join", "os.path.splitext", "os.path.isfile", "os.path.dirname", "json.load", "os.path.basename", "numpy.argmin", "numpy.int", "os.walk" ]
[((3069, 3084), 'numpy.unique', 'np.unique', (['dirs'], {}), '(dirs)\n', (3078, 3084), True, 'import numpy as np\n'), ((5602, 5624), 'os.path.basename', 'os.path.basename', (['tmp1'], {}), '(tmp1)\n', (5618, 5624), False, 'import os\n'), ((5637, 5658), 'os.path.dirname', 'os.path.dirname', (['tmp1'], {}), '(tmp1)\n', (...
from vizdoom import * import numpy as np import itertools as it class DoomEnvironment: def __init__(self, scenario='defend_the_center', window=False): self.game = DoomGame() print(scenario) self.game.load_config("ViZDoom/scenarios/" + scenario + ".cfg") self.game.set_doom_scenario_...
[ "numpy.identity", "numpy.zeros", "numpy.transpose" ]
[((1507, 1537), 'numpy.transpose', 'np.transpose', (['state', '[1, 2, 0]'], {}), '(state, [1, 2, 0])\n', (1519, 1537), True, 'import numpy as np\n'), ((1608, 1646), 'numpy.zeros', 'np.zeros', (['(480, 640, 3)'], {'dtype': '"""uint8"""'}), "((480, 640, 3), dtype='uint8')\n", (1616, 1646), True, 'import numpy as np\n'), ...
import numpy as np import cv2 as cv import time # OpenCV Facial Capture Test _cap = cv.VideoCapture(0) _cap.set(cv.CAP_PROP_FRAME_WIDTH, 512) _cap.set(cv.CAP_PROP_FRAME_HEIGHT, 512) _cap.set(cv.CAP_PROP_BUFFERSIZE, 1) time.sleep(0.5) facemark = cv.face.createFacemarkLBF() try: # Download the trained model lbfmo...
[ "cv2.rectangle", "cv2.face.createFacemarkLBF", "time.sleep", "cv2.imshow", "numpy.zeros", "cv2.circle", "cv2.VideoCapture", "cv2.CascadeClassifier", "cv2.waitKey" ]
[((87, 105), 'cv2.VideoCapture', 'cv.VideoCapture', (['(0)'], {}), '(0)\n', (102, 105), True, 'import cv2 as cv\n'), ((221, 236), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (231, 236), False, 'import time\n'), ((249, 276), 'cv2.face.createFacemarkLBF', 'cv.face.createFacemarkLBF', ([], {}), '()\n', (274, 2...
import streamlit as st import datetime import time import pandas as pd import numpy as np # title st.title('Streamlit Basics') # header st.header('header') st.subheader('subheader') # text st.text('regular text') # markdown st.markdown('## markdown text') # color text st.success('Success!') # misc st.info('Info'...
[ "streamlit.table", "matplotlib.pyplot.hist", "streamlit.echo", "time.sleep", "streamlit.code", "streamlit.multiselect", "streamlit.text_input", "streamlit.header", "streamlit.title", "datetime.time", "streamlit.warning", "streamlit.sidebar.header", "numpy.random.normal", "streamlit.markdow...
[((100, 128), 'streamlit.title', 'st.title', (['"""Streamlit Basics"""'], {}), "('Streamlit Basics')\n", (108, 128), True, 'import streamlit as st\n'), ((139, 158), 'streamlit.header', 'st.header', (['"""header"""'], {}), "('header')\n", (148, 158), True, 'import streamlit as st\n'), ((159, 184), 'streamlit.subheader',...
# run a BWM search for a fixed source orientation (theta, phi, psi, t0) import numpy as np import argparse, os import pickle from enterprise.pulsar import Pulsar from enterprise.signals import parameter from enterprise.signals import selections from enterprise.signals import utils from enterprise.signals import signal...
[ "enterprise.signals.selections.Selection", "enterprise.signals.white_signals.MeasurementNoise", "enterprise.signals.gp_signals.FourierBasisGP", "enterprise.signals.utils.powerlaw", "utils.sample_utils.JupOrb_KDE_Draw", "os.path.exists", "enterprise.signals.gp_signals.TimingModel", "argparse.ArgumentPa...
[((626, 701), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""run the BWM analysis with enterprise"""'}), "(description='run the BWM analysis with enterprise')\n", (649, 701), False, 'import argparse, os\n'), ((3491, 3519), 'os.path.abspath', 'os.path.abspath', (['args.outdir'], {}), '(ar...
#!/usr/bin/env python # coding: utf-8 # In[426]: import PIL import cv2 import numpy as np import os from PIL import Image #newly added modules : import natsort from typing import Tuple, Union import math from deskew import determine_skew # In[412]: def Setting_image_to_300DPI(img, img_ref) : length_x, widt...
[ "numpy.array", "cv2.bitwise_or", "numpy.sin", "os.remove", "numpy.mean", "os.listdir", "cv2.threshold", "cv2.medianBlur", "deskew.determine_skew", "numpy.round", "cv2.fillPoly", "cv2.merge", "numpy.ones", "math.radians", "numpy.cos", "cv2.cvtColor", "cv2.split", "cv2.getRotationMat...
[((752, 767), 'cv2.imread', 'cv2.imread', (['img'], {}), '(img)\n', (762, 767), False, 'import cv2\n'), ((780, 825), 'cv2.cvtColor', 'cv2.cvtColor', (['im', 'cv2.COLOR_BGR2GRAY'], {'dstCn': '(2)'}), '(im, cv2.COLOR_BGR2GRAY, dstCn=2)\n', (792, 825), False, 'import cv2\n'), ((840, 861), 'deskew.determine_skew', 'determi...
from __future__ import print_function import unittest import numpy as np import scipy.sparse as sp import discretize from SimPEG import maps, utils from SimPEG import data_misfit, simulation, survey np.random.seed(17) class DataMisfitTest(unittest.TestCase): def setUp(self): mesh = discretize.TensorMe...
[ "discretize.TensorMesh", "numpy.ones", "SimPEG.survey.BaseSrc", "numpy.random.rand", "SimPEG.maps.ExpMap", "numpy.log", "SimPEG.utils.Identity", "SimPEG.survey.BaseSurvey", "SimPEG.survey.BaseRx", "numpy.random.seed", "unittest.main", "SimPEG.data_misfit.L2DataMisfit" ]
[((203, 221), 'numpy.random.seed', 'np.random.seed', (['(17)'], {}), '(17)\n', (217, 221), True, 'import numpy as np\n'), ((2453, 2468), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2466, 2468), False, 'import unittest\n'), ((301, 328), 'discretize.TensorMesh', 'discretize.TensorMesh', (['[30]'], {}), '([30])\n...
import numpy as np import cv2 import copy from polygon import Polygon def draw_polygon(img, polygon): # Create result image from input image ret = img.copy() # Create polygon image poly = img.copy() # Get image size h, w = poly.shape[:2] # Draw polygon vertices = polygon.vertices.copy...
[ "numpy.random.rand", "polygon.Polygon", "numpy.array", "cv2.addWeighted", "copy.deepcopy" ]
[((425, 455), 'numpy.array', 'np.array', (['[vertices]', 'np.int32'], {}), '([vertices], np.int32)\n', (433, 455), True, 'import numpy as np\n'), ((469, 515), 'numpy.array', 'np.array', (['(polygon.color * 255 + 0.5)'], {'dtype': 'int'}), '(polygon.color * 255 + 0.5, dtype=int)\n', (477, 515), True, 'import numpy as np...
from pyabc import ABCSMC, Distribution from pyabc.sampler import MulticoreEvalParallelSampler, SingleCoreSampler import scipy.stats as st import numpy as np from datetime import datetime, timedelta set_acc_rate = 0.2 pop_size = 10 def model(x): """Some model""" return {"par": x["par"] + np.random.randn()} ...
[ "pyabc.sampler.MulticoreEvalParallelSampler", "scipy.stats.uniform", "datetime.datetime.now", "datetime.timedelta", "numpy.random.randn", "pyabc.sampler.SingleCoreSampler" ]
[((1042, 1091), 'pyabc.sampler.MulticoreEvalParallelSampler', 'MulticoreEvalParallelSampler', ([], {'check_max_eval': '(True)'}), '(check_max_eval=True)\n', (1070, 1091), False, 'from pyabc.sampler import MulticoreEvalParallelSampler, SingleCoreSampler\n'), ((1109, 1147), 'pyabc.sampler.SingleCoreSampler', 'SingleCoreS...
import os, random, sys, time, csv, pickle, re, pkg_resources os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide" from tkinter import StringVar, DoubleVar, Tk, Label, Entry, Button, OptionMenu, Checkbutton, Message, Menu, IntVar, Scale, HORIZONTAL, simpledialog, messagebox, Toplevel from tkinter.ttk import Progressbar, Se...
[ "tkinter.filedialog.askdirectory", "scipy.io.savemat", "git.Repo.clone_from", "pkg_resources.require", "scipy.io.loadmat", "matplotlib.pyplot.Figure", "tkinter.Button", "scipy.interpolate.interp1d", "scipy.optimize.nnls", "numpy.nanmean", "numpy.argsort", "tkinter.Label", "sys.exit", "tkin...
[((2443, 2447), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (2445, 2447), False, 'from tkinter import StringVar, DoubleVar, Tk, Label, Entry, Button, OptionMenu, Checkbutton, Message, Menu, IntVar, Scale, HORIZONTAL, simpledialog, messagebox, Toplevel\n'), ((1392, 1414), 'os.path.isdir', 'os.path.isdir', (['sf_path'], {}), '...
from typing import Any, List, Mapping import numpy as np from scipy.interpolate import LinearNDInterpolator from skimage.color import rgb2gray from skimage.filters import gaussian, threshold_otsu from skimage.morphology import binary_dilation, binary_erosion, dilation, disk from morphocut import Node, Output, RawOrVa...
[ "morphocut.Output", "skimage.color.rgb2gray", "scipy.interpolate.LinearNDInterpolator", "skimage.filters.threshold_otsu", "numpy.isnan", "numpy.nonzero", "numpy.bitwise_not", "skimage.morphology.disk", "skimage.filters.gaussian" ]
[((360, 376), 'morphocut.Output', 'Output', (['"""result"""'], {}), "('result')\n", (366, 376), False, 'from morphocut import Node, Output, RawOrVariable, ReturnOutputs\n'), ((1387, 1403), 'skimage.filters.gaussian', 'gaussian', (['img', '(3)'], {}), '(img, 3)\n', (1395, 1403), False, 'from skimage.filters import gauss...
import numpy as np import warnings from stingray.base import StingrayObject from stingray.gti import check_separate, cross_two_gtis from stingray.lightcurve import Lightcurve from stingray.utils import assign_value_if_none, simon, excess_variance, show_progress from stingray.fourier import avg_cs_from_events, avg_pds...
[ "numpy.log10", "numpy.sqrt", "stingray.gti.cross_two_gtis", "numpy.count_nonzero", "stingray.utils.excess_variance", "stingray.lightcurve.Lightcurve.make_lightcurve", "stingray.utils.show_progress", "numpy.mean", "stingray.fourier.error_on_averaged_cross_spectrum", "numpy.asarray", "numpy.max", ...
[((1897, 1921), 'numpy.asarray', 'np.asarray', (['channel_band'], {}), '(channel_band)\n', (1907, 1921), True, 'import numpy as np\n'), ((1937, 1957), 'numpy.asarray', 'np.asarray', (['ref_band'], {}), '(ref_band)\n', (1947, 1957), True, 'import numpy as np\n'), ((2040, 2080), 'stingray.gti.check_separate', 'check_sepa...
# -*- coding: utf-8 -*- """ Created on Tue Oct 20 22:35:02 2020 @author: hp """ import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split import pickle from sklearn.utils import resample from sklearn import tree fro...
[ "pandas.read_csv", "sklearn.metrics.precision_score", "numpy.argsort", "sklearn.metrics.recall_score", "sklearn.metrics.roc_auc_score", "pandas.read_pickle", "sklearn.ensemble.RandomForestRegressor", "matplotlib.pyplot.xlabel", "sklearn.tree.DecisionTreeClassifier", "sklearn.utils.resample", "pa...
[((945, 975), 'pandas.read_pickle', 'pd.read_pickle', (['"""Cleaned_data"""'], {}), "('Cleaned_data')\n", (959, 975), True, 'import pandas as pd\n'), ((980, 1004), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (991, 1004), True, 'import pandas as pd\n'), ((1122, 1190), 'sklearn.utils.r...
import habitat import cv2 import os import time import git import magnum as mn import matplotlib.pyplot as plt import numpy as np import math import habitat_sim from habitat_sim.utils import viz_utils as vut # import quadruped_wrapper from habitat_sim.robots import AntV2Robot repo = git.Repo(".", search_parent_dir...
[ "habitat_sim.SimulatorConfiguration", "habitat_sim.Configuration", "habitat_sim.Simulator", "habitat_sim.CameraSensorSpec", "habitat_sim.robots.AntV2Robot", "os.path.join", "numpy.array", "habitat_sim.utils.viz_utils.make_video", "git.Repo", "numpy.quaternion", "habitat_sim.AgentState", "habit...
[((289, 334), 'git.Repo', 'git.Repo', (['"""."""'], {'search_parent_directories': '(True)'}), "('.', search_parent_directories=True)\n", (297, 334), False, 'import git\n'), ((380, 425), 'os.path.join', 'os.path.join', (['dir_path', '"""../habitat-sim/data"""'], {}), "(dir_path, '../habitat-sim/data')\n", (392, 425), Fa...
# MIT License # # Copyright (c) 2017-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, merg...
[ "numpy.genfromtxt", "numpy.argmax", "numpy.max" ]
[((1224, 1323), 'numpy.genfromtxt', 'np.genfromtxt', (['"""xenon_ne_vs_x_do-0.76mm_Id-2.3A.csv"""'], {'delimiter': '""","""', 'skip_header': '(13)', 'names': '(True)'}), "('xenon_ne_vs_x_do-0.76mm_Id-2.3A.csv', delimiter=',',\n skip_header=13, names=True)\n", (1237, 1323), True, 'import numpy as np\n'), ((1554, 1569...
#!/usr/bin/env python # coding: utf-8 # # The Boundary Element Method (BEM) # # # You can run this code directly in your browser by clicking on the rocket logo ( <i class="fas fa-rocket"></i> ) at the top of the page, and clicking 'Binder'. This will open a Jupyter Notebook in a [Binder](https://mybinder.org/) envir...
[ "numpy.linalg.solve", "matplotlib.pyplot.title", "numpy.sqrt", "matplotlib.pyplot.colorbar", "numpy.log", "numpy.array", "numpy.linspace", "numpy.zeros", "numpy.real", "numpy.cos", "numpy.dot", "numpy.sin", "numpy.meshgrid" ]
[((3635, 3661), 'numpy.linspace', 'np.linspace', (['(-50)', '(50)', '(1000)'], {}), '(-50, 50, 1000)\n', (3646, 3661), True, 'import numpy as np\n'), ((3666, 3683), 'numpy.meshgrid', 'np.meshgrid', (['t', 't'], {}), '(t, t)\n', (3677, 3683), True, 'import numpy as np\n'), ((3784, 3805), 'matplotlib.pyplot.colorbar', 'p...
# A collection of common functions used in the creation and manipulation of the data for this project. from approaches.approach import Multiclass_Logistic_Regression, Perceptron, Sklearn_SVM import comp_vis.img_tools as it import numpy as np import sys def images_to_data(images, label, already_cropped=True): '''...
[ "approaches.approach.Multiclass_Logistic_Regression", "numpy.shape", "comp_vis.img_tools.average_color", "approaches.approach.Sklearn_SVM", "comp_vis.img_tools.crop_image", "sys.stderr.write", "numpy.array", "comp_vis.img_tools.get_images_dimensions", "approaches.approach.Perceptron", "numpy.rando...
[((1276, 1330), 'comp_vis.img_tools.get_images_dimensions', 'it.get_images_dimensions', (['cropped_images'], {'ordered': '(True)'}), '(cropped_images, ordered=True)\n', (1300, 1330), True, 'import comp_vis.img_tools as it\n'), ((2353, 2376), 'numpy.random.shuffle', 'np.random.shuffle', (['data'], {}), '(data)\n', (2370...
# encoding: utf-8 # USE : # python setup_project.py build_ext --inplace # from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext import numpy import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) warnings.filterwarnings("ign...
[ "numpy.get_include", "warnings.filterwarnings", "distutils.core.setup" ]
[((228, 290), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (251, 290), False, 'import warnings\n'), ((292, 349), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarn...
import numpy as np jit = lambda x: x # Make things faster? volume() certainly become faster, but ensure_closed, # which is more critical, does not. # import numba # jit = numba.jit # Interesting methods: # - remove unused vertices, but can be obtained by m = Mesh(m.get_flat_vertices()) # - split the different conne...
[ "numpy.zeros", "numpy.asarray" ]
[((17750, 17778), 'numpy.zeros', 'np.zeros', (['(0, 3)', 'np.float32'], {}), '((0, 3), np.float32)\n', (17758, 17778), True, 'import numpy as np\n'), ((18598, 18626), 'numpy.zeros', 'np.zeros', (['(0, 3)', 'np.float32'], {}), '((0, 3), np.float32)\n', (18606, 18626), True, 'import numpy as np\n'), ((19589, 19617), 'num...
from __future__ import print_function import tensorflow as tf import tensorflow.contrib.slim as slim # try out sonnet instead? from tensorflow.python.client import timeline from tensorflow.examples.tutorials.mnist import input_data from sklearn.utils import shuffle import numpy as np import os from utils import * ...
[ "tensorflow.examples.tutorials.mnist.input_data.read_data_sets", "tensorflow.RunMetadata", "tensorflow.log", "tensorflow.app.run", "numpy.reshape", "tensorflow.placeholder", "tensorflow.Session", "tensorflow.RunOptions", "tensorflow.python.client.timeline.Timeline", "tensorflow.train.AdamOptimizer...
[((320, 406), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""logdir"""', '"""/tmp/test"""', '"""location for saved embeedings"""'], {}), "('logdir', '/tmp/test',\n 'location for saved embeedings')\n", (346, 406), True, 'import tensorflow as tf\n'), ((403, 475), 'tensorflow.app.flags.DEFINE...
"""Run parallel shallow water domain. run using command like: mpiexec -np m python run_parallel_sw_merimbula.py where m is the number of processors to be used. Will produce sww files with names domain_Pn_m.sww where m is number of processors and n in [0, m-1] refers to specific processor that own...
[ "anuga.Domain", "unittest.makeSuite", "anuga.parallel.finalize", "builtins.str", "past.utils.old_div", "anuga.parallel.barrier", "builtins.range", "numpy.array", "anuga.coordinate_transforms.redfearn.redfearn", "unittest.TextTestRunner", "numpy.arange", "os.remove", "anuga.File_boundary", ...
[((20979, 21037), 'unittest.makeSuite', 'unittest.makeSuite', (['Test_urs2sts_parallel', '"""parallel_test"""'], {}), "(Test_urs2sts_parallel, 'parallel_test')\n", (20997, 21037), False, 'import unittest\n'), ((21123, 21148), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (21146, 21148), False,...
import numpy as np from algorithms.ddpg.replay_buffer import ReplayBuffer class PDSReplayBuffer(ReplayBuffer): """ Replay buffer for PDS-DDPG, just add some extra information to the basic replay buffer """ def __init__(self, state_dim, action_dim, length, batch_size): super().__init__...
[ "numpy.zeros" ]
[((451, 490), 'numpy.zeros', 'np.zeros', (['[length, 1]'], {'dtype': 'np.float32'}), '([length, 1], dtype=np.float32)\n', (459, 490), True, 'import numpy as np\n'), ((577, 616), 'numpy.zeros', 'np.zeros', (['[length, 1]'], {'dtype': 'np.float32'}), '([length, 1], dtype=np.float32)\n', (585, 616), True, 'import numpy as...
from socketserver import StreamRequestHandler, TCPServer from socket import error as SocketError import errno import datetime import time import os import base64 import numpy as np import cv2 from scipy import misc from warpgan import WarpGAN from align.detect_align import detect_align class GANnetworks: def __in...
[ "numpy.random.normal", "numpy.tile", "cv2.imwrite", "socketserver.TCPServer", "warpgan.WarpGAN", "align.detect_align.detect_align", "numpy.ones", "cv2.imencode", "os.path.join", "numpy.array", "datetime.datetime.now", "cv2.imdecode", "threading.Thread", "time.time" ]
[((586, 595), 'warpgan.WarpGAN', 'WarpGAN', ([], {}), '()\n', (593, 595), False, 'from warpgan import WarpGAN\n'), ((1032, 1078), 'numpy.tile', 'np.tile', (['img[None]', '[self.num_styles, 1, 1, 1]'], {}), '(img[None], [self.num_styles, 1, 1, 1])\n', (1039, 1078), True, 'import numpy as np\n'), ((1146, 1237), 'numpy.ra...
import numpy as np import pandas as pd def sma(series: pd.Series, short_period: int, long_period: int) -> pd.Series: short_series = series.rolling(short_period).mean() long_series = series.rolling(long_period).mean() sma_positions = pd.Series( np.where(short_series > long_series, 1, -1), index=ser...
[ "numpy.where" ]
[((266, 309), 'numpy.where', 'np.where', (['(short_series > long_series)', '(1)', '(-1)'], {}), '(short_series > long_series, 1, -1)\n', (274, 309), True, 'import numpy as np\n')]
import numpy as np import cv2 def img_clahe(img): clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8)) img = clahe.apply(img) return img def img_clahe_cm(img): b,g,r = cv2.split(img) clahe = cv2.createCLAHE(clipLimit=1.0, tileGridSize=(8,8)) b = clahe.apply(b) g = clahe.apply(g) ...
[ "numpy.mean", "cv2.merge", "numpy.abs", "numpy.min", "cv2.createCLAHE", "numpy.max", "cv2.addWeighted", "cv2.split", "numpy.std", "cv2.Sobel" ]
[((63, 114), 'cv2.createCLAHE', 'cv2.createCLAHE', ([], {'clipLimit': '(2.0)', 'tileGridSize': '(8, 8)'}), '(clipLimit=2.0, tileGridSize=(8, 8))\n', (78, 114), False, 'import cv2\n'), ((192, 206), 'cv2.split', 'cv2.split', (['img'], {}), '(img)\n', (201, 206), False, 'import cv2\n'), ((219, 270), 'cv2.createCLAHE', 'cv...
# call this script with `python -m evaluation.evaluate_poselines_globalaction` import numpy as np from numpy.core.fromnumeric import sort import pandas as pd import datetime import torch import pickle from torch.functional import norm from tqdm import tqdm from . import eval_utils from compoelem.config import config f...
[ "compoelem.compare.pose_line.compare_pose_lines_3", "compoelem.generate.global_action.get_global_action_lines", "numpy.array", "numpy.lexsort", "datetime.datetime.now", "compoelem.compare.pose_line.filter_pose_line_ga_result", "compoelem.compare.normalize.norm_by_global_action", "compoelem.generate.po...
[((1072, 1200), 'compoelem.compare.normalize.norm_by_global_action', 'norm_by_global_action', (["query_data['compoelem']['pose_lines']", "query_data['compoelem']['global_action_lines']"], {'fallback': '(True)'}), "(query_data['compoelem']['pose_lines'], query_data[\n 'compoelem']['global_action_lines'], fallback=Tru...
"""Rfs Module. Uncompleted/Cancelled RFS Journal Implementation (Journal 2). """ from datetime import datetime import numpy as np from baseStation import Transmitter from helpers import CoordinateConverter from snapshot import * class RfsAnalog: def __init__(self, n_of_cell_per_ec, n_of_ec, n_of_ue_per_ec, tr...
[ "datetime.datetime.now", "numpy.sqrt", "baseStation.Transmitter" ]
[((2787, 2844), 'baseStation.Transmitter', 'Transmitter', (['CoordinateConverter.GRID_WIDTH', 'BSType.MACRO'], {}), '(CoordinateConverter.GRID_WIDTH, BSType.MACRO)\n', (2798, 2844), False, 'from baseStation import Transmitter\n'), ((2909, 2966), 'baseStation.Transmitter', 'Transmitter', (['CoordinateConverter.GRID_WIDT...
# # Copyright 2021 Budapest Quantum Computing Group # # 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...
[ "piquasso.Config", "piquasso.Q", "numpy.sqrt", "piquasso.PureFockSimulator", "piquasso.Program", "piquasso.ParticleNumberMeasurement", "piquasso.StateVector" ]
[((963, 988), 'piquasso.PureFockSimulator', 'pq.PureFockSimulator', ([], {'d': '(3)'}), '(d=3)\n', (983, 988), True, 'import piquasso as pq\n'), ((2096, 2121), 'piquasso.PureFockSimulator', 'pq.PureFockSimulator', ([], {'d': '(3)'}), '(d=3)\n', (2116, 2121), True, 'import piquasso as pq\n'), ((3086, 3105), 'piquasso.Co...
import time import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras.layers import Layer from tensorflow.python.keras.utils import tf_utils from common import utils from common.ops import ops as custom_ops from common.ops import transformation from common.ops.em_routing import em_...
[ "tensorflow.tile", "numpy.prod", "numpy.sqrt", "tensorflow.transpose", "tensorflow.reduce_sum", "tensorflow.nn.moments", "tensorflow.split", "tensorflow.multiply", "tensorflow.keras.regularizers.l2", "tensorflow.keras.layers.BatchNormalization", "tensorflow.keras.layers.Dense", "common.utils.k...
[((22707, 22749), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['inputs', 'axis'], {'keepdims': '(True)'}), '(inputs, axis, keepdims=True)\n', (22720, 22749), True, 'import tensorflow as tf\n'), ((22786, 22799), 'tensorflow.square', 'tf.square', (['x1'], {}), '(x1)\n', (22795, 22799), True, 'import tensorflow as tf\n'), ...
# Undergraduate Student: <NAME> # Professor: <NAME> # Federal University of Uberlândia - UFU, Fluid Mechanics Laboratory - MFLab, Block 5P, Uberlândia, MG, Brazil # Third exercise: Fibonacci sequence - by a common loop import numpy as np import time n = int(input("Enter the n indices: ")) Fbn=0 # Value of the first...
[ "numpy.array", "time.time" ]
[((648, 659), 'time.time', 'time.time', ([], {}), '()\n', (657, 659), False, 'import time\n'), ((971, 987), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (979, 987), True, 'import numpy as np\n'), ((1167, 1178), 'time.time', 'time.time', ([], {}), '()\n', (1176, 1178), False, 'import time\n'), ((735, 746),...
import numpy as np import helper import tensorflow as tf from tensorflow.python.layers.core import Dense from datetime import datetime # Build the Neural Network # Components necessary to build a Sequence-to-Sequence model by implementing the following functions below: # # - model_inputs # - process_decoder_input # -...
[ "tensorflow.shape", "numpy.equal", "tensorflow.truncated_normal_initializer", "tensorflow.contrib.seq2seq.BasicDecoder", "tensorflow.Graph", "tensorflow.nn.embedding_lookup", "tensorflow.contrib.seq2seq.sequence_loss", "tensorflow.placeholder", "tensorflow.Session", "tensorflow.nn.dynamic_rnn", ...
[((13606, 13630), 'helper.load_preprocess', 'helper.load_preprocess', ([], {}), '()\n', (13628, 13630), False, 'import helper\n'), ((13728, 13738), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (13736, 13738), True, 'import tensorflow as tf\n'), ((15813, 15861), 'tensorflow.summary.FileWriter', 'tf.summary.FileWrit...
import os import json import shutil import tempfile import contextlib import functools from collections import OrderedDict import numpy as np import h5py from quilted.h5blockstore import H5BlockStore @contextlib.contextmanager def autocleaned_tmpdir(): tmpdir = tempfile.mkdtemp() yield tmpdir shutil.rmtr...
[ "logging.getLogger", "os.path.exists", "logging.StreamHandler", "sys.argv.append", "functools.wraps", "h5py.File", "numpy.array", "tempfile.mkdtemp", "shutil.rmtree", "json.load", "quilted.h5blockstore.H5BlockStore", "nose.run" ]
[((269, 287), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (285, 287), False, 'import tempfile\n'), ((309, 330), 'shutil.rmtree', 'shutil.rmtree', (['tmpdir'], {}), '(tmpdir)\n', (322, 330), False, 'import shutil\n'), ((370, 388), 'functools.wraps', 'functools.wraps', (['f'], {}), '(f)\n', (385, 388), Fals...
import numpy as np from numba import njit @njit(cache=True) def calculate_goodness_of_fit(table): n = table.shape[0] m = table.sum() row_sum = table.sum(axis=0).astype(np.float64) col_sum = table.sum(axis=1).astype(np.float64) e = np.dot(col_sum.reshape(n, 1), row_sum.reshape(1, 2)) / m s = np...
[ "numpy.random.choice", "numpy.zeros_like", "numba.njit", "numpy.arange" ]
[((45, 61), 'numba.njit', 'njit', ([], {'cache': '(True)'}), '(cache=True)\n', (49, 61), False, 'from numba import njit\n'), ((376, 392), 'numba.njit', 'njit', ([], {'cache': '(True)'}), '(cache=True)\n', (380, 392), False, 'from numba import njit\n'), ((645, 661), 'numba.njit', 'njit', ([], {'cache': '(True)'}), '(cac...
import numpy as np def trust_region_solver(M, g, d_max, max_iter=2000, stepsize=1.0e-3): """Solves trust region problem with gradient descent maximize 1/2 * x^T M x + g^T x s.t. |x|_2 <= d_max initialize x = g / |g| * d_max """ x = g / np.linalg.norm(g) * d_max for _ in range(max_iter): ...
[ "numpy.linalg.norm" ]
[((261, 278), 'numpy.linalg.norm', 'np.linalg.norm', (['g'], {}), '(g)\n', (275, 278), True, 'import numpy as np\n'), ((429, 446), 'numpy.linalg.norm', 'np.linalg.norm', (['x'], {}), '(x)\n', (443, 446), True, 'import numpy as np\n')]
''' DLRM Facebookresearch Debloating author: sjoon-oh @ Github source: dlrm/dlrm_s_pytorch.py ''' from __future__ import absolute_import, division, print_function, unicode_literals import argparse # miscellaneous import builtins import datetime import json import sys import time # data generation import dlrm_data a...
[ "torch.cuda.device_count", "torch.cuda.synchronize", "numpy.array", "torch.cuda.is_available", "sys.exit", "torch.set_printoptions", "argparse.ArgumentParser", "numpy.asarray", "numpy.random.seed", "numpy.fromstring", "numpy.round", "argparse.ArgumentTypeError", "torch.save", "time.time", ...
[((711, 722), 'time.time', 'time.time', ([], {}), '()\n', (720, 722), False, 'import time\n'), ((3571, 3662), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train Deep Learning Recommendation Model (DLRM)"""'}), "(description=\n 'Train Deep Learning Recommendation Model (DLRM)')\n", (...
import torch import torch.nn.functional as F from torch.autograd import Variable import numpy as np from PIL import Image import matplotlib.cm as Pltcolormap from . import utils class GradCAM: """ Gradient-weighted Class Activation Mapping (Grad-CAM) Get a coarse heatmap of activation highlighting import...
[ "numpy.uint8", "PIL.Image.fromarray", "numpy.asarray", "torch.autograd.Variable", "matplotlib.cm.get_cmap", "torch.clamp" ]
[((1738, 1758), 'torch.autograd.Variable', 'Variable', (['img_tensor'], {}), '(img_tensor)\n', (1746, 1758), False, 'from torch.autograd import Variable\n'), ((4300, 4315), 'numpy.asarray', 'np.asarray', (['pil'], {}), '(pil)\n', (4310, 4315), True, 'import numpy as np\n'), ((4381, 4408), 'matplotlib.cm.get_cmap', 'Plt...
# -*- coding: utf-8 -*- import numpy as np import sys class LabelPath: def __init__(self, label_inds, labels): self._labels = labels self._label_num = len(label_inds) self._label_inds = label_inds self._hit_count = 0.0 self._label2rank = dict() for label_ind in lab...
[ "numpy.argsort", "numpy.array" ]
[((1613, 1634), 'numpy.array', 'np.array', (['index2label'], {}), '(index2label)\n', (1621, 1634), True, 'import numpy as np\n'), ((1923, 1941), 'numpy.argsort', 'np.argsort', (['scores'], {}), '(scores)\n', (1933, 1941), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- ## @package som_cm.som # # Implementation of SOM. # @author tody # @date 2015/08/14 import os import numpy as np import matplotlib.pyplot as plt from som_cm.np.norm import normVectors ## SOM parameter. class SOMParam: # @param h image grid size. # @param L0...
[ "matplotlib.pyplot.imshow", "matplotlib.pyplot.text", "numpy.random.rand", "numpy.exp", "numpy.array", "numpy.zeros", "numpy.linspace", "numpy.argmin", "numpy.meshgrid", "som_cm.np.norm.normVectors", "numpy.arange" ]
[((2326, 2345), 'numpy.zeros', 'np.zeros', (['(h, w, 3)'], {}), '((h, w, 3))\n', (2334, 2345), True, 'import numpy as np\n'), ((2774, 2794), 'numpy.random.rand', 'np.random.rand', (['h', '(3)'], {}), '(h, 3)\n', (2788, 2794), True, 'import numpy as np\n'), ((3128, 3140), 'numpy.arange', 'np.arange', (['h'], {}), '(h)\n...
import unittest import numpy.testing as testing import numpy as np import healpy as hp from numpy import random import healsparse class GetSetTestCase(unittest.TestCase): def test_getitem_single(self): """ Test __getitem__ single value """ random.seed(12345) nside_coverag...
[ "numpy.testing.assert_array_almost_equal", "numpy.ones", "healsparse.HealSparseMap", "numpy.testing.assert_equal", "numpy.random.random", "numpy.testing.assert_array_equal", "numpy.testing.assert_almost_equal", "healsparse.HealSparseMap.make_empty", "numpy.array", "numpy.zeros", "numpy.random.se...
[((13788, 13803), 'unittest.main', 'unittest.main', ([], {}), '()\n', (13801, 13803), False, 'import unittest\n'), ((279, 297), 'numpy.random.seed', 'random.seed', (['(12345)'], {}), '(12345)\n', (290, 297), False, 'from numpy import random\n'), ((446, 470), 'numpy.random.random', 'random.random', ([], {'size': '(5000)...
import numpy as np import matplotlib.pyplot as plt def m2d( m=1.0, a=1.0, b=1.0 ): return( a * np.power( m, b ) ) def get_v( mmin=0.0, mmax=0.1, minc=0.1, alpha=40.0, beta=0.230, gamma=1/2, rho_0=1.0, rho=1.0 ): m_l = np.arange( mmin, mmax+minc, minc ) v_l = np.zeros( m_l.shape )...
[ "numpy.power", "numpy.zeros", "matplotlib.pyplot.subplots", "numpy.arange", "matplotlib.pyplot.show" ]
[((1105, 1141), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(8, 6.5)'}), '(1, 1, figsize=(8, 6.5))\n', (1117, 1141), True, 'import matplotlib.pyplot as plt\n'), ((1623, 1633), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1631, 1633), True, 'import matplotlib.pyplot as plt\n')...
import numpy as np n1 = np.array([10,20]) n2 = np.array([30,40]) print("Sum of n1 and n2:-") new = np.sum([n1,n2]) print(new) print("Sum of n1 and n2 row wise :-") new_2 = np.sum([n1,n2],axis = 0) #axis = 0 (Row / Vertically adding), axis = 1 (Colunm / horizontally adding). print(new_2) #Basic adding,substracting,m...
[ "numpy.array", "numpy.mean", "numpy.sum", "numpy.std" ]
[((25, 43), 'numpy.array', 'np.array', (['[10, 20]'], {}), '([10, 20])\n', (33, 43), True, 'import numpy as np\n'), ((48, 66), 'numpy.array', 'np.array', (['[30, 40]'], {}), '([30, 40])\n', (56, 66), True, 'import numpy as np\n'), ((101, 117), 'numpy.sum', 'np.sum', (['[n1, n2]'], {}), '([n1, n2])\n', (107, 117), True,...
# Copyright 2020 Open Climate Tech Contributors # # 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...
[ "math.ceil", "numpy.asarray", "os.path.splitext", "numpy.subtract", "os.path.join", "pathlib.PurePath", "numpy.array" ]
[((1653, 1703), 'math.ceil', 'math.ceil', (['(flexSize / (segmentSize / overlapRatio))'], {}), '(flexSize / (segmentSize / overlapRatio))\n', (1662, 1703), False, 'import math\n'), ((6639, 6676), 'numpy.asarray', 'np.asarray', (['imgOrig'], {'dtype': 'np.float32'}), '(imgOrig, dtype=np.float32)\n', (6649, 6676), True, ...
#!/usr/bin/env python # coding: utf-8 # In[1]: import re import numpy as np import pandas as pd from gensim.models.doc2vec import Doc2Vec, TaggedDocument from nltk.stem import PorterStemmer from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.preproc...
[ "sklearn.preprocessing.LabelEncoder", "pandas.read_csv", "sklearn.metrics.precision_score", "sklearn.metrics.recall_score", "gensim.models.doc2vec.TaggedDocument", "numpy.asarray", "nltk.stem.PorterStemmer", "gensim.models.doc2vec.Doc2Vec", "matplotlib.pyplot.savefig", "sklearn.model_selection.tra...
[((451, 489), 'pandas.read_csv', 'pd.read_csv', (['"""../data/pr-newswire.csv"""'], {}), "('../data/pr-newswire.csv')\n", (462, 489), True, 'import pandas as pd\n'), ((1295, 1342), 'gensim.models.doc2vec.Doc2Vec', 'Doc2Vec', ([], {'vector_size': '(40)', 'min_count': '(2)', 'epochs': '(30)'}), '(vector_size=40, min_coun...
import numpy as np import scipy.special def powder_isotropic(omega, pas): """ Frequency domain calculation over an isotropic powder for CSA tensor. The expressions are evaluated using complete elliptic integrals of the first kind. Parameters ---------- omega : array frequency pas...
[ "numpy.convolve", "numpy.sqrt", "numpy.log", "numpy.zeros_like", "numpy.arange" ]
[((592, 612), 'numpy.zeros_like', 'np.zeros_like', (['omega'], {}), '(omega)\n', (605, 612), True, 'import numpy as np\n'), ((3408, 3443), 'numpy.convolve', 'np.convolve', (['y', 'kernel'], {'mode': '"""same"""'}), "(y, kernel, mode='same')\n", (3419, 3443), True, 'import numpy as np\n'), ((837, 889), 'numpy.sqrt', 'np...
# # radarbeam.py # # module for calculating geometry parameters and magnetic aspect # angle of radar targets monitored by any radar # # use aspect_elaz or aspect_txty to calculate aspect angles of targets # specified by (el,az) or (tx,ty) angles # # Created by <NAME> on 11/29/08 as jrobeam.py # Copyright (c) 2008 EC...
[ "numpy.sqrt", "numpy.cross", "numpy.sin", "pyigrf.igrf.igrf_B", "numpy.array", "numpy.dot", "numpy.arctan2", "numpy.cos", "numpy.finfo", "numpy.arctan" ]
[((1506, 1534), 'numpy.sqrt', 'np.sqrt', (['(x ** 2.0 + y ** 2.0)'], {}), '(x ** 2.0 + y ** 2.0)\n', (1513, 1534), True, 'import numpy as np\n'), ((1535, 1551), 'numpy.arctan2', 'np.arctan2', (['y', 'x'], {}), '(y, x)\n', (1545, 1551), True, 'import numpy as np\n'), ((1559, 1575), 'numpy.arctan2', 'np.arctan2', (['z', ...
#!/usr/bin/env python import logging import numpy as np import pandas as pd from library import Imputation as iptt SAMPLING = np.array([2, 4, 4, 4, 5, 5, 7, 9]) BENIGN = np.array([4., 28., 1., 1., 3.]) MALIGNANT = np.array([5., 60., 2., 4., 3.]) BENIGN_COUNT = np.array([1., 1., 1., 1., 1.]) MALIGNANT_COUNT = np....
[ "numpy.array", "logging.warning", "pandas.read_csv", "library.Imputation" ]
[((131, 165), 'numpy.array', 'np.array', (['[2, 4, 4, 4, 5, 5, 7, 9]'], {}), '([2, 4, 4, 4, 5, 5, 7, 9])\n', (139, 165), True, 'import numpy as np\n'), ((176, 212), 'numpy.array', 'np.array', (['[4.0, 28.0, 1.0, 1.0, 3.0]'], {}), '([4.0, 28.0, 1.0, 1.0, 3.0])\n', (184, 212), True, 'import numpy as np\n'), ((220, 256), ...
""" Posterior predictions 1. Load data 2. Run simulations - First experiment: - With perseveration (3 cycles) - Without perseveration (3 cycles) - With perseveration (1 cycle) to plot single-trial updates and predictions - Follow-up experiment: - With perseveration (3 cycles) ...
[ "pandas.read_pickle", "al_simulation.simulation_loop", "numpy.random.seed" ]
[((544, 563), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (558, 563), True, 'import numpy as np\n'), ((645, 687), 'pandas.read_pickle', 'pd.read_pickle', (['"""al_data/data_prepr_1.pkl"""'], {}), "('al_data/data_prepr_1.pkl')\n", (659, 687), True, 'import pandas as pd\n'), ((727, 769), 'pandas.re...
# coding: utf-8 # # Project: X-ray image reader # https://github.com/silx-kit/fabio # # Copyright (C) 2016 Univeristy Köln, Germany # # Principal author: <NAME> (<EMAIL>) # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated docum...
[ "logging.getLogger", "numpy.float", "datetime.datetime.strptime", "xml.dom.minidom.parseString", "numpy.polynomial.polynomial.polyval", "numpy.dtype", "numpy.fromstring", "numpy.arange" ]
[((1579, 1606), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1596, 1606), False, 'import logging\n'), ((5062, 5114), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['str_date', '"""%d%b%Y%H%M%S"""'], {}), "(str_date, '%d%b%Y%H%M%S')\n", (5088, 5114), False, 'import dateti...
#!/usr/bin/env python # Cartopy implementation of TEC plotting in polar coordinates # author: @mrinalghosh import matplotlib.pyplot as plt import matplotlib.path as mpath import numpy as np import cartopy.feature as cfeature import cartopy.crs as ccrs import h5py from argparse import ArgumentParser from datetime impo...
[ "numpy.nanmean", "numpy.sin", "cartopy.crs.NorthPolarStereo", "matplotlib.path.Path", "numpy.reshape", "argparse.ArgumentParser", "os.path.split", "matplotlib.pyplot.close", "numpy.linspace", "cartopy.crs.Mercator", "cartopy.crs.NearsidePerspective", "matplotlib.pyplot.gcf", "os.path.splitex...
[((874, 889), 'matplotlib.pyplot.colormaps', 'plt.colormaps', ([], {}), '()\n', (887, 889), True, 'import matplotlib.pyplot as plt\n'), ((1095, 1115), 'h5py.File', 'h5py.File', (['root', '"""r"""'], {}), "(root, 'r')\n", (1104, 1115), False, 'import h5py\n'), ((11042, 11058), 'argparse.ArgumentParser', 'ArgumentParser'...
#!/usr/bin/env python """Make big QUOCKA cubes""" from IPython import embed import schwimmbad import sys from glob import glob from tqdm import tqdm import matplotlib.pyplot as plt from radio_beam import Beam, Beams from radio_beam.utils import BeamError from astropy import units as u from astropy.io import fits from ...
[ "matplotlib.pyplot.ylabel", "radio_beam.Beam.from_fits_header", "numpy.isfinite", "sys.exit", "astropy.io.fits.open", "schwimmbad.choose_pool", "argparse.ArgumentParser", "radio_beam.Beams", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.diff", "numpy.vstack", "numpy.concatenat...
[((515, 571), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {'category': 'AstropyWarning'}), "('ignore', category=AstropyWarning)\n", (536, 571), False, 'import warnings\n'), ((1153, 1200), 'numpy.round', 'np.round', (['(a + 0.5 * 10 ** -precision)', 'precision'], {}), '(a + 0.5 * 10 ** -precisio...
from argparse import ArgumentParser from collections import defaultdict import numpy as np import torch import h5py from tqdm import tqdm from pytorch_pretrained_bert import BertTokenizer LAYER_NUM = 12 FEATURE_DIM = 768 def match_tokenized_to_untokenized(tokenized_sent, untokenized_sent): '''Aligns tokenized an...
[ "numpy.mean", "pytorch_pretrained_bert.BertTokenizer.from_pretrained", "numpy.savez", "argparse.ArgumentParser", "h5py.File", "numpy.zeros", "collections.defaultdict" ]
[((915, 932), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (926, 932), False, 'from collections import defaultdict\n'), ((1561, 1577), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (1575, 1577), False, 'from argparse import ArgumentParser\n'), ((1747, 1808), 'pytorch_pretrained...
import numpy as np from optlang import Constraint from scipy import stats from ..util.constraints import * from ..util.linalg_fun import * from ..util.thermo_constants import * def generate_n_sphere_sample(n_variables): """Generates unit n-sphere sample. Works by picking random sample from normal distribution an...
[ "numpy.random.normal", "scipy.stats.genextreme.fit", "numpy.insert", "numpy.sqrt", "scipy.stats.genextreme.interval", "numpy.any", "numpy.square", "numpy.diag", "numpy.zeros", "numpy.nonzero", "scipy.stats.chi2.isf" ]
[((608, 660), 'numpy.random.normal', 'np.random.normal', ([], {'loc': '(0)', 'scale': '(1.0)', 'size': 'n_variables'}), '(loc=0, scale=1.0, size=n_variables)\n', (624, 660), True, 'import numpy as np\n'), ((8997, 9027), 'scipy.stats.genextreme.fit', 'stats.genextreme.fit', (['data_set'], {}), '(data_set)\n', (9017, 902...
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import os import xarray as xr from ooi_data_explorations.common import inputs, m2m_collect, m2m_request, get_deployment_dates, \ get_vocabulary, dt64_epoch, update_dataset, ENCODINGS from ooi_data_explorations.uncabled.process_phsen import ATTRS, qua...
[ "ooi_data_explorations.common.get_vocabulary", "ooi_data_explorations.common.get_deployment_dates", "numpy.reshape", "ooi_data_explorations.common.inputs", "ooi_data_explorations.uncabled.process_phsen.ATTRS.items", "ooi_data_explorations.common.dt64_epoch", "ooi_data_explorations.common.m2m_collect", ...
[((3068, 3088), 'numpy.atleast_3d', 'np.atleast_3d', (['light'], {}), '(light)\n', (3081, 3088), True, 'import numpy as np\n'), ((3101, 3133), 'numpy.reshape', 'np.reshape', (['light', '(nrec, 23, 4)'], {}), '(light, (nrec, 23, 4))\n', (3111, 3133), True, 'import numpy as np\n'), ((3593, 3613), 'numpy.atleast_3d', 'np....
# -*- coding: utf-8 -*- #!/usr/bin/env python __author__ = """Prof. <NAME>, Ph.D. <<EMAIL>>""" import os os.system('clear') print('.-------------------------------.') print('| |#') print('| By.: Prof. <NAME> |#') print('| |#') print('| ...
[ "matplotlib.pyplot.imshow", "numpy.average", "numpy.append", "numpy.array", "numpy.zeros", "numpy.linspace", "random.choices", "numpy.exp", "os.system", "random.random", "matplotlib.pyplot.show" ]
[((108, 126), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (117, 126), False, 'import os\n'), ((961, 977), 'numpy.zeros', 'np.zeros', (['(N, N)'], {}), '((N, N))\n', (969, 977), True, 'import numpy as np\n'), ((982, 998), 'numpy.zeros', 'np.zeros', (['(N, N)'], {}), '((N, N))\n', (990, 998), True, 'i...
# -*- coding: utf-8 -*- # Imports import numpy as np import torch import gpytorch from gpytorch.priors import GammaPrior from copy import deepcopy # Disctionary of distributions for randomm initialization def build_dist_dict(noise_prior, outputscale_prior, lengthscale_prior): """ Build a dictionary of dist...
[ "torch.manual_seed", "gpytorch.mlls.ExactMarginalLogLikelihood", "gpytorch.priors.GammaPrior", "copy.deepcopy", "numpy.argmin" ]
[((1249, 1269), 'copy.deepcopy', 'deepcopy', (['dictionary'], {}), '(dictionary)\n', (1257, 1269), False, 'from copy import deepcopy\n'), ((2266, 2325), 'gpytorch.mlls.ExactMarginalLogLikelihood', 'gpytorch.mlls.ExactMarginalLogLikelihood', (['likelihood', 'model'], {}), '(likelihood, model)\n', (2306, 2325), False, 'i...
# -*- coding: utf-8 -*- """ Created on Wed Jul 1 23:04:56 2020 @author: dhruv """ from os import listdir from xml.etree import ElementTree from numpy import zeros from numpy import asarray from mrcnn.utils import Dataset from mrcnn.config import Config from mrcnn.model import MaskRCNN from os import listdir from xml...
[ "mrcnn.model.MaskRCNN", "numpy.asarray", "os.listdir", "xml.etree.ElementTree.parse" ]
[((4429, 4485), 'mrcnn.model.MaskRCNN', 'MaskRCNN', ([], {'mode': '"""training"""', 'model_dir': '"""./"""', 'config': 'config'}), "(mode='training', model_dir='./', config=config)\n", (4437, 4485), False, 'from mrcnn.model import MaskRCNN\n'), ((1005, 1024), 'os.listdir', 'listdir', (['images_dir'], {}), '(images_dir)...
import aoc import numpy as np coorddata, folddata = aoc.get_data(13) coordlist = [] for e in coorddata: coordlist.append(np.array(e.split(",")).astype(int)) coords = np.array(coordlist) size = (np.max(coords[:, 1]) + 1, np.max(coords[:, 0]) + 1) print(f"{size}") board = np.zeros(shape=size, dtype=np.uint8) for...
[ "aoc.get_data", "numpy.max", "numpy.count_nonzero", "numpy.array", "numpy.zeros", "numpy.set_printoptions" ]
[((53, 69), 'aoc.get_data', 'aoc.get_data', (['(13)'], {}), '(13)\n', (65, 69), False, 'import aoc\n'), ((172, 191), 'numpy.array', 'np.array', (['coordlist'], {}), '(coordlist)\n', (180, 191), True, 'import numpy as np\n'), ((279, 315), 'numpy.zeros', 'np.zeros', ([], {'shape': 'size', 'dtype': 'np.uint8'}), '(shape=s...
import os import sys import numpy as np from pycocotools import mask as maskUtils import imgaug import skimage from matplotlib import pyplot as plt import cv2 import time from pycocotools.cocoeval import COCOeval from pycocotools.coco import COCO ROOT_DIR = os.path.abspath("../") # Import Mask RCNN sys.path.append(...
[ "mrcnn.model.MaskRCNN", "imgaug.augmenters.PiecewiseAffine", "pycocotools.cocoeval.COCOeval", "angiodataset.AngioDataset", "tensorflow.config.experimental.list_logical_devices", "numpy.array", "imgaug.augmenters.Fliplr", "sys.path.append", "os.walk", "argparse.ArgumentParser", "imgaug.augmenters...
[((261, 283), 'os.path.abspath', 'os.path.abspath', (['"""../"""'], {}), "('../')\n", (276, 283), False, 'import os\n'), ((304, 329), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (319, 329), False, 'import sys\n'), ((366, 409), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""mask_rcnn_coc...
import numpy as np import SimpleITK as sitk from napari_imsmicrolink.data.image_transform import ImageTransform def test_ImageTransform_add_points(): test_pts = np.array([[50.75, 100.0], [20.0, 10.0], [10.0, 50.0], [60.0, 20.0]]) itfm = ImageTransform() itfm.output_spacing = (1, 1) itfm.add_points(t...
[ "SimpleITK.AffineTransform", "napari_imsmicrolink.data.image_transform.ImageTransform.apply_transform_to_pts", "numpy.array", "napari_imsmicrolink.data.image_transform.ImageTransform", "numpy.testing.assert_array_equal" ]
[((168, 236), 'numpy.array', 'np.array', (['[[50.75, 100.0], [20.0, 10.0], [10.0, 50.0], [60.0, 20.0]]'], {}), '([[50.75, 100.0], [20.0, 10.0], [10.0, 50.0], [60.0, 20.0]])\n', (176, 236), True, 'import numpy as np\n'), ((249, 265), 'napari_imsmicrolink.data.image_transform.ImageTransform', 'ImageTransform', ([], {}), ...
#!/usr/bin/python from __future__ import division from __future__ import print_function """ This file serves as an example of how to a) select a problem to be solved b) select a network type c) train the network to minimize recovery MSE """ import numpy as np import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # BE ...
[ "numpy.log10", "tools.problems.bernoulli_gaussian_trial", "tools.networks.build_LAMP", "tensorflow.Session", "tensorflow.nn.l2_loss", "tensorflow.global_variables_initializer", "numpy.random.seed", "tensorflow.reduce_mean", "tensorflow.set_random_seed" ]
[((397, 414), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (411, 414), True, 'import numpy as np\n'), ((462, 483), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(1)'], {}), '(1)\n', (480, 483), True, 'import tensorflow as tf\n'), ((754, 832), 'tools.problems.bernoulli_gaussian_trial', 'proble...
#!/usr/bin/env python3 import sys import numpy as np from config import Config from base import Connect4Base from random_agent import RandomAgent from simple_agent import SimpleAgent from one_step_lookahead_agent import OneStepLookaheadAgent from n_steps_lookahead_agent import NStepsLookaheadAgent from cnn_agent impor...
[ "n_steps_lookahead_agent.NStepsLookaheadAgent", "config.Config", "numpy.full", "network_128x4_64_64.Network1" ]
[((1325, 1340), 'config.Config', 'Config', (['(6)', '(7)', '(4)'], {}), '(6, 7, 4)\n', (1331, 1340), False, 'from config import Config\n'), ((1728, 1759), 'n_steps_lookahead_agent.NStepsLookaheadAgent', 'NStepsLookaheadAgent', (['config', '(3)'], {}), '(config, 3)\n', (1748, 1759), False, 'from n_steps_lookahead_agent ...
#! /g/kreshuk/pape/Work/software/conda/miniconda3/envs/cluster-new/bin/python import os import json from concurrent import futures import numpy as np import luigi import z5py import skeletor.io from cluster_tools.skeletons import SkeletonWorkflow def check_scale(scale): path = '/g/kreshuk/data/FIB25/data.n5' ...
[ "luigi.build", "os.makedirs", "cluster_tools.skeletons.SkeletonWorkflow", "concurrent.futures.ThreadPoolExecutor", "os.path.join", "cluster_tools.skeletons.SkeletonWorkflow.get_config", "z5py.File", "numpy.array", "numpy.zeros", "json.dump" ]
[((388, 403), 'z5py.File', 'z5py.File', (['path'], {}), '(path)\n', (397, 403), False, 'import z5py\n'), ((734, 772), 'os.makedirs', 'os.makedirs', (['config_dir'], {'exist_ok': '(True)'}), '(config_dir, exist_ok=True)\n', (745, 772), False, 'import os\n'), ((787, 816), 'cluster_tools.skeletons.SkeletonWorkflow.get_con...
import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 2 * np.pi, 50) y = np.sin(x) # plt.plot(x, y) # plt.show() # plt.plot(x, y) # plt.plot(x, y * 2) # plt.title("sin(x) & 2sin(x)") # plt.show() plt.plot(x, y, label="sin(x)") plt.plot(x, y * 2, label="2sin(x)") # plt.legend() plt.legend(loc='best b...
[ "matplotlib.pyplot.plot", "numpy.linspace", "numpy.sin", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((57, 86), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(50)'], {}), '(0, 2 * np.pi, 50)\n', (68, 86), True, 'import numpy as np\n'), ((91, 100), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (97, 100), True, 'import numpy as np\n'), ((216, 246), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {'label':...
import numpy as np import time import torch import torch.nn as nn import os from tqdm import tqdm as tqdm import sys; import math import skimage.io as io import cv2 from skimage import filters from skimage.measure import label, moments import glob from model_arch import UnetVggMultihead from my_dataloader_w_kfunc impo...
[ "torch.nn.L1Loss", "numpy.array", "torch.nn.Sigmoid", "os.path.exists", "numpy.where", "os.mkdir", "skimage.measure.moments", "sys.stdout.flush", "my_dataloader.CellsDataset", "my_dataloader_w_kfunc.CellsDataset", "cv2.moments", "time.time", "model_arch.UnetVggMultihead", "torch.device", ...
[((1393, 1452), 'os.path.join', 'os.path.join', (['checkpoints_root_dir', 'checkpoints_folder_name'], {}), '(checkpoints_root_dir, checkpoints_folder_name)\n', (1405, 1452), False, 'import os\n'), ((1483, 1547), 'os.path.join', 'os.path.join', (['clustering_pseudo_gt_root', 'checkpoints_folder_name'], {}), '(clustering...
import sys import warnings from copy import deepcopy import itertools import numpy as np from scipy.stats import entropy, multivariate_normal from sklearn.cluster import KMeans from sklearn.mixture import GaussianMixture from sklearn.mixture.gaussian_mixture import _compute_precision_cholesky,\ _check_precision_mat...
[ "numpy.linalg.matrix_rank", "numpy.linalg.pinv", "numpy.random.rand", "numpy.log", "numpy.array", "copy.deepcopy", "numpy.linalg.norm", "numpy.cov", "numpy.save", "sklearn.mixture.gaussian_mixture._check_precision_matrix", "numpy.delete", "pandas.DataFrame", "numpy.identity", "sklearn.mixt...
[((932, 952), 'numpy.zeros', 'np.zeros', (['covs.shape'], {}), '(covs.shape)\n', (940, 952), True, 'import numpy as np\n'), ((1411, 1559), 'sklearn.mixture.GaussianMixture', 'GaussianMixture', ([], {'n_components': 'k', 'weights_init': 'weights', 'means_init': 'means', 'reg_covar': '(0.01)', 'precisions_init': 'precisi...
import requests from urllib import request, parse import io import dnnlib import dnnlib.tflib as tflib import pickle import numpy as np from projector import Projector from PIL import Image import re import base64 from io import BytesIO import boto3 import uuid img_res = 256 def find_nearest(arr, val): "Element ...
[ "boto3.client", "PIL.Image.new", "urllib.request.Request", "base64.b64encode", "io.BytesIO", "numpy.array", "urllib.parse.urlencode", "urllib.request.urlopen", "numpy.abs", "projector.Projector", "dnnlib.util.open_url", "boto3.Session", "pickle.load", "requests.get", "dnnlib.tflib.init_t...
[((552, 569), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (564, 569), False, 'import requests\n'), ((640, 676), 'PIL.Image.new', 'Image.new', (['"""RGBA"""', 'img.size', '"""WHITE"""'], {}), "('RGBA', img.size, 'WHITE')\n", (649, 676), False, 'from PIL import Image\n'), ((960, 1008), 're.sub', 're.sub', (...
from distributions.distribution_factory import create_distribution from objectives.objective_factory import create_objective from samplers.sampler_factory import create_sampler from algorithms.algo_factory import create_algorithm import os import argparse import pprint as pp import json import tensorflow as tf import ...
[ "samplers.sampler_factory.create_sampler", "tensorflow.reset_default_graph", "argparse.ArgumentParser", "os.makedirs", "tensorflow.Session", "json.dump", "os.path.join", "algorithms.algo_factory.create_algorithm", "tensorflow.global_variables_initializer", "os.path.isdir", "numpy.random.seed", ...
[((1139, 1159), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1153, 1159), True, 'import numpy as np\n'), ((1164, 1188), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (1186, 1188), True, 'import tensorflow as tf\n'), ((1193, 1217), 'tensorflow.set_random_seed', 'tf....
import torch import torch.backends.cudnn as cudnn import numpy as np import os import argparse import time from tqdm import tqdm from utils.setup import get_model,get_data_loader parser = argparse.ArgumentParser() parser.add_argument("--model_dir",default='checkpoints',type=str,help="directory of checkpoints") pa...
[ "argparse.ArgumentParser", "tqdm.tqdm", "os.path.join", "numpy.sum", "utils.setup.get_model", "utils.setup.get_data_loader", "time.time", "torch.argmax" ]
[((193, 218), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (216, 218), False, 'import argparse\n'), ((847, 880), 'os.path.join', 'os.path.join', (['"""."""', 'args.model_dir'], {}), "('.', args.model_dir)\n", (859, 880), False, 'import os\n'), ((889, 925), 'os.path.join', 'os.path.join', (['a...
import matplotlib.pyplot as plt import numpy as np from keras.datasets import mnist from keras.layers import BatchNormalization, Input, Dense, Reshape, Flatten from keras.layers.advanced_activations import LeakyReLU from keras.models import Sequential, Model from keras.optimizers import Adam def build_generator(laten...
[ "numpy.prod", "keras.layers.Dense", "matplotlib.pyplot.imshow", "numpy.reshape", "keras.datasets.mnist.load_data", "keras.models.Model", "keras.layers.advanced_activations.LeakyReLU", "matplotlib.pyplot.axis", "numpy.random.normal", "keras.optimizers.Adam", "numpy.ones", "keras.layers.Flatten"...
[((939, 965), 'keras.layers.Input', 'Input', ([], {'shape': '(latent_dim,)'}), '(shape=(latent_dim,))\n', (944, 965), False, 'from keras.layers import BatchNormalization, Input, Dense, Reshape, Flatten\n'), ((1047, 1066), 'keras.models.Model', 'Model', (['z', 'generated'], {}), '(z, generated)\n', (1052, 1066), False, ...
"""Generate plots for the annotations of the blame verifier.""" import abc import logging import typing as tp import matplotlib.pyplot as plt import matplotlib.ticker as mtick import numpy as np import pandas as pd from matplotlib import style from sklearn import preprocessing import varats.paper_mgmt.paper_config as...
[ "logging.getLogger", "numpy.unique", "varats.data.databases.blame_verifier_report_database.BlameVerifierReportDatabase.get_data_for_project", "matplotlib.ticker.PercentFormatter", "matplotlib.pyplot.figure", "matplotlib.style.use", "varats.paper_mgmt.paper_config.get_paper_config", "matplotlib.pyplot....
[((717, 744), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (734, 744), False, 'import logging\n'), ((949, 977), 'varats.mapping.commit_map.get_commit_map', 'get_commit_map', (['project_name'], {}), '(project_name)\n', (963, 977), False, 'from varats.mapping.commit_map import get_commit_...
# -*- coding: utf-8 -*- """ Created on Wed Mar 01 10:00:09 2017 @author: <NAME> Translation of NS's InterX for Matlab into Python. Original Available at: https://www.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections/content/InterX.m Python translation (c) 2017, <NAME> Original Matlab cod...
[ "numpy.mat", "numpy.multiply", "numpy.hstack", "numpy.diff", "numpy.vstack", "pandas.DataFrame", "numpy.divide" ]
[((4439, 4460), 'numpy.hstack', 'np.hstack', (['[L1x, L1y]'], {}), '([L1x, L1y])\n', (4448, 4460), True, 'import numpy as np\n'), ((4470, 4491), 'numpy.vstack', 'np.vstack', (['[L2x, L2y]'], {}), '([L2x, L2y])\n', (4479, 4491), True, 'import numpy as np\n'), ((4816, 4835), 'numpy.diff', 'np.diff', (['x1'], {'axis': '(0...
import setuptools from numpy.distutils.core import setup from numpy.distutils.extension import Extension from setuptools import find_packages import versioneer with open("README.rst") as readme_file: readme = readme_file.read() compile_opts = { "extra_f90_compile_args": [ "-fopenmp", "-ffree-...
[ "versioneer.get_version", "versioneer.get_cmdclass", "setuptools.find_packages", "numpy.distutils.extension.Extension" ]
[((517, 667), 'numpy.distutils.extension.Extension', 'Extension', ([], {'name': '"""pspy.mcm_fortran.mcm_fortran"""', 'sources': "['pspy/mcm_fortran/mcm_fortran.f90', 'pspy/wigner3j/wigner3j_sub.f']"}), "(name='pspy.mcm_fortran.mcm_fortran', sources=[\n 'pspy/mcm_fortran/mcm_fortran.f90', 'pspy/wigner3j/wigner3j_sub...
import numpy as np import cv2 as cv import imageio import torch import torch.nn as nn import torch.nn.functional as F inputName = "../bin/outlow_000.exr" outputName1 = "../bin/outlow_001_warpedNumpy.exr" outputName2 = "../bin/outlow_001_warpedTorch.exr" flowName = "../bin/outlowf_000.exr" flowTest1 = "../bin/outlowf_0...
[ "numpy.clip", "torch.nn.functional.grid_sample", "numpy.uint8", "imageio.imwrite", "numpy.arange", "torch.unsqueeze", "torch.broadcast_tensors", "torch.from_numpy", "numpy.zeros", "imageio.imread", "numpy.float32", "torch.linspace" ]
[((1515, 1540), 'imageio.imread', 'imageio.imread', (['inputName'], {}), '(inputName)\n', (1529, 1540), False, 'import imageio\n'), ((1789, 1854), 'imageio.imwrite', 'imageio.imwrite', (['"""../bin/outlowf_000_t3.png"""', 'inputImage[:, :, 3]'], {}), "('../bin/outlowf_000_t3.png', inputImage[:, :, 3])\n", (1804, 1854),...
import cv2 import os import numpy as np import av from torchvision.transforms import Compose, Resize, ToTensor from PIL import Image import matplotlib.pyplot as plt import torch from torch.utils.data import DataLoader from dataset import MaskDataset, get_img_files, get_img_files_eval from nets.MobileNetV2_unet import M...
[ "av.open", "dataset.MaskDataset", "torch.cuda.is_available", "os.path.exists", "nets.MobileNetV2_unet.MobileNetV2_unet", "cv2.addWeighted", "cv2.VideoWriter_fourcc", "torchvision.transforms.ToTensor", "numpy.abs", "cv2.warpAffine", "cv2.cvtColor", "torchvision.transforms.Resize", "cv2.getRot...
[((1816, 1862), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['(cX, cY)', '(-angle)', '(1.0)'], {}), '((cX, cY), -angle, 1.0)\n', (1839, 1862), False, 'import cv2\n'), ((1873, 1888), 'numpy.abs', 'np.abs', (['M[0, 0]'], {}), '(M[0, 0])\n', (1879, 1888), True, 'import numpy as np\n'), ((1899, 1914), 'numpy.abs...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Jan 2018 hacer calib extrisneca con pymc3 @author: sebalander """ # %% # import glob import os import corner import time import seaborn as sns import scipy as sc import scipy.stats as sts import matplotlib.pyplot as plt from copy import deepcopy as dc imp...
[ "numpy.prod", "calibration.calibrator.errorCuadraticoImagen", "numpy.sqrt", "matplotlib.pyplot.ylabel", "numpy.polyfit", "numpy.log", "time.sleep", "numpy.array", "pymc3.sample", "sys.path.append", "numpy.arange", "calibration.calibrator.points2linearised", "numpy.save", "numpy.mean", "t...
[((549, 597), 'sys.path.append', 'sys.path.append', (['"""/home/sebalander/Code/sebaPhD"""'], {}), "('/home/sebalander/Code/sebaPhD')\n", (564, 597), False, 'import sys\n'), ((2996, 3008), 'numpy.sqrt', 'np.sqrt', (['pi2'], {}), '(pi2)\n', (3003, 3008), True, 'import numpy as np\n'), ((4852, 4875), 'numdifftools.Hessia...
import pyqtgraph as pg from pyqtgraph import GraphicsLayoutWidget from Utilities.IO import IOHelper from PyQt5.QtCore import * from PyQt5.QtWidgets import * from Utilities.Helper import settings from pathlib import Path import numpy as np from PIL import Image import datetime from queue import Queue from PyQt5 import Q...
[ "PIL.Image.fromarray", "pathlib.Path", "pyqtgraph.GraphicsLayout", "pyqtgraph.ImageItem", "numpy.log", "pyqtgraph.setConfigOptions", "PyQt5.QtGui.QDesktopWidget", "numpy.array", "numpy.zeros", "datetime.datetime.now", "Utilities.IO.IOHelper.get_config_setting", "pyqtgraph.GraphicsLayoutWidget"...
[((1552, 1593), 'pyqtgraph.GraphicsLayout', 'pg.GraphicsLayout', ([], {'border': '(100, 100, 100)'}), '(border=(100, 100, 100))\n', (1569, 1593), True, 'import pyqtgraph as pg\n'), ((1609, 1634), 'pyqtgraph.GraphicsLayoutWidget', 'pg.GraphicsLayoutWidget', ([], {}), '()\n', (1632, 1634), True, 'import pyqtgraph as pg\n...
# -*- coding: utf-8 -*- """ Created on Sat Feb 23 16:16:12 2019 @author: Nate """ from scipy import random import numpy as np import matplotlib.pyplot as plt a = 0 b = 1 N = 10000 xrand = random.uniform(a,b,N) to_plot = [] to_plot_scatter = [] def my_func(x): return(4/(1+x**2)) plotting3 = [] integral = ...
[ "numpy.zeros", "scipy.random.uniform", "numpy.full", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((194, 217), 'scipy.random.uniform', 'random.uniform', (['a', 'b', 'N'], {}), '(a, b, N)\n', (208, 217), False, 'from scipy import random\n'), ((567, 581), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (579, 581), True, 'import matplotlib.pyplot as plt\n'), ((886, 900), 'matplotlib.pyplot.subplots', ...
import liquepy as lq import numpy as np import eqsig import pysra import sfsimodels as sm class EqlinStockwellAnalysis(object): def __init__(self, soil_profile, in_sig, rus=None, wave_field='outcrop', store='surface', gibbs=0, t_inc=1.0, t_win=3.0, strain_at_incs=True, strain_ratio=0.9): """ Equi...
[ "numpy.clip", "numpy.sqrt", "pysra.motion.TimeSeriesMotion", "numpy.array", "pysra.propagation.LinearElasticCalculator", "numpy.arange", "numpy.mean", "liquepy.sra.sm_profile_to_pysra", "numpy.where", "numpy.linspace", "pysra.site.SoilType", "numpy.concatenate", "pysra.output.OutputLocation"...
[((12000, 12123), 'pysra.motion.TimeSeriesMotion', 'pysra.motion.TimeSeriesMotion', ([], {'filename': 'in_sig.label', 'description': 'None', 'time_step': 'in_sig.dt', 'accels': '(in_sig.values / 9.8)'}), '(filename=in_sig.label, description=None,\n time_step=in_sig.dt, accels=in_sig.values / 9.8)\n', (12029, 12123),...
import matplotlib.pyplot as plt import pysan.core as pysan_core import itertools, math import numpy as np import pandas as pd from sklearn import cluster import scipy def generate_sequences(count, length, alphabet): """ Generates a number of sequences of a given length, with elements uniformly distributed using a ...
[ "pysan.core.get_entropy", "matplotlib.pyplot.ylabel", "numpy.column_stack", "pysan.core.get_subsequences", "numpy.array", "pysan.core.plot_sequence", "sklearn.cluster.AgglomerativeClustering", "pysan.core.generate_sequence", "numpy.where", "matplotlib.pyplot.xlabel", "pysan.core.get_transitions"...
[((10410, 10439), 'numpy.zeros', 'np.zeros', (['(m, n)'], {'dtype': 'float'}), '((m, n), dtype=float)\n', (10418, 10439), True, 'import numpy as np\n'), ((10495, 10522), 'numpy.zeros', 'np.zeros', (['(m, n)'], {'dtype': 'str'}), '((m, n), dtype=str)\n', (10503, 10522), True, 'import numpy as np\n'), ((14171, 14202), 'p...
from image_to_ascii import image_to_ascii import cv2,os,numpy as np import concurrent.futures from threading import Thread from time import perf_counter,sleep as nap import argparse # may add sound later .\ class ascii_video : """ working of class extract image and yield convert into asc...
[ "numpy.copy", "os.path.exists", "argparse.ArgumentParser", "time.perf_counter", "cv2.putText", "numpy.zeros", "cv2.VideoCapture", "cv2.VideoWriter_fourcc", "cv2.cvtColor", "numpy.full", "threading.Thread" ]
[((7255, 7280), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (7278, 7280), False, 'import argparse\n'), ((1539, 1572), 'cv2.VideoCapture', 'cv2.VideoCapture', (['self.video_name'], {}), '(self.video_name)\n', (1555, 1572), False, 'import cv2, os, numpy as np\n'), ((2380, 2428), 'numpy.zeros',...
import json import time from pathlib import Path import numpy as np import torch from sklearn.model_selection import train_test_split from .ingestion import ingest_session, EpisodeDataset from .models import FeatureExtractor1d, Model class EEGDrive: @staticmethod def ingest(data_path: str, output_dir: str) ...
[ "torch.manual_seed", "pathlib.Path", "sklearn.model_selection.train_test_split", "numpy.random.seed", "time.time", "json.dump" ]
[((1027, 1050), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (1044, 1050), False, 'import torch\n'), ((1059, 1079), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1073, 1079), True, 'import numpy as np\n'), ((1592, 1661), 'sklearn.model_selection.train_test_split', 'train_t...
#!/usr/bin/env python """ outline to create combination EUV/CHD maps using ML Algorithm 1. Select images 2. Apply pre-processing corrections a. Limb-Brightening b. Inter-Instrument Transformation 3. Coronal Hole Detection using ML Algorithm 4. Convert to Map 5. Combine Maps and Save to DB """ import os impor...
[ "chmap.maps.image2map.create_singles_maps_2", "chmap.maps.synchronic.synch_utils.select_synchronic_images", "numpy.log", "datetime.timedelta", "datetime.datetime", "numpy.where", "chmap.data.corrections.apply_lbc_iit.apply_ipp_2", "numpy.max", "numpy.linspace", "chmap.utilities.plotting.psi_plotti...
[((841, 880), 'datetime.datetime', 'datetime.datetime', (['(2011)', '(8)', '(16)', '(0)', '(0)', '(0)'], {}), '(2011, 8, 16, 0, 0, 0)\n', (858, 880), False, 'import datetime\n'), ((898, 937), 'datetime.datetime', 'datetime.datetime', (['(2011)', '(8)', '(18)', '(0)', '(0)', '(0)'], {}), '(2011, 8, 18, 0, 0, 0)\n', (915...
# import some data to play with from sklearn.metrics import accuracy_score from predict import * import pandas as pd import numpy as np from sklearn.model_selection import train_test_split, GridSearchCV X_D= pd.read_csv('dataset1.csv').as_matrix() Y = X_D[:,0] X = np.delete(X_D, 0, 1) #split test and train X_train, X_t...
[ "sklearn.model_selection.train_test_split", "numpy.delete", "sklearn.metrics.accuracy_score", "pandas.read_csv" ]
[((265, 285), 'numpy.delete', 'np.delete', (['X_D', '(0)', '(1)'], {}), '(X_D, 0, 1)\n', (274, 285), True, 'import numpy as np\n'), ((343, 409), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'Y'], {'stratify': 'Y', 'test_size': '(0.3)', 'random_state': '(42)'}), '(X, Y, stratify=Y, test_size=0....
import logging import sys from os.path import isfile import numpy as np from phi import math from phi.field import Scene class SceneLog: def __init__(self, scene: Scene): self.scene = scene self._scalars = {} # name -> (frame, value) self._scalar_streams = {} root_logger = logg...
[ "logging.getLogger", "logging.StreamHandler", "logging.Formatter", "os.path.isfile", "numpy.array", "logging.FileHandler", "logging.Logger", "phi.math.mean" ]
[((316, 335), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (333, 335), False, 'import logging\n'), ((404, 440), 'logging.Logger', 'logging.Logger', (['"""vis"""', 'logging.DEBUG'], {}), "('vis', logging.DEBUG)\n", (418, 440), False, 'import logging\n'), ((490, 523), 'logging.StreamHandler', 'logging.Stre...
#=============================================================================# # # # <NAME> # # CS 3150 # # ...
[ "math.sqrt", "matplotlib.pyplot.imshow", "cv2.threshold", "cv2.erode", "cv2.blur", "numpy.ones", "cv2.minEnclosingCircle", "cv2.morphologyEx", "cv2.split", "cv2.cvtColor", "matplotlib.colors.Normalize", "numpy.shape", "cv2.imread", "matplotlib.pyplot.show", "cv2.inRange", "cv2.bitwise_...
[((2869, 2894), 'cv2.imread', 'cv2.imread', (['"""./test2.jpg"""'], {}), "('./test2.jpg')\n", (2879, 2894), False, 'import cv2\n'), ((2983, 3020), 'cv2.cvtColor', 'cv2.cvtColor', (['wall', 'cv2.COLOR_BGR2RGB'], {}), '(wall, cv2.COLOR_BGR2RGB)\n', (2995, 3020), False, 'import cv2\n'), ((3083, 3121), 'cv2.cvtColor', 'cv2...
import numpy as np def R_P(take_off_angle, strike, dip, rake, az): """ Radiation pattern for P""" inc = np.deg2rad(take_off_angle) SR = Fault_geom_SR(dip, rake) QR = Fault_geom_QR(strike, dip, rake, az) PR = Fault_geom_PR(strike, dip, rake, az) RP = SR * (3 * np.cos(inc) ** 2 - 1) - QR * np.s...
[ "numpy.sin", "numpy.deg2rad", "numpy.cos" ]
[((114, 140), 'numpy.deg2rad', 'np.deg2rad', (['take_off_angle'], {}), '(take_off_angle)\n', (124, 140), True, 'import numpy as np\n'), ((467, 493), 'numpy.deg2rad', 'np.deg2rad', (['take_off_angle'], {}), '(take_off_angle)\n', (477, 493), True, 'import numpy as np\n'), ((830, 856), 'numpy.deg2rad', 'np.deg2rad', (['ta...
import random import json import gym from gym import spaces import pandas as pd import numpy as np MAX_ACCOUNT_BALANCE = 2147483647 MAX_NUM_SHARES = 2147483647 MAX_SHARE_PRICE = 5000 MAX_OPEN_POSITIONS = 5 MAX_STEPS = 20000 COMMISSION_FEE = 0.008 INITIAL_ACCOUNT_BALANCE = 10000 class StockTradingEnv(gym.Env): ...
[ "numpy.intersect1d", "random.uniform", "numpy.reshape", "numpy.floor", "gym.spaces.Box", "numpy.max", "numpy.array", "numpy.stack", "numpy.append", "numpy.sum", "numpy.isnan", "numpy.min", "pandas.isna", "numpy.nansum", "numpy.isinf", "numpy.zeros_like", "random.randint", "numpy.na...
[((867, 895), 'numpy.min', 'np.min', (['self.intersect_dates'], {}), '(self.intersect_dates)\n', (873, 895), True, 'import numpy as np\n'), ((920, 948), 'numpy.max', 'np.max', (['self.intersect_dates'], {}), '(self.intersect_dates)\n', (926, 948), True, 'import numpy as np\n'), ((1253, 1273), 'numpy.array', 'np.array',...
import gc import numpy as np import pandas as pd def drop_duplicates_pharma(df): """ df: long-format dataframe of a patient varref: variable reference table that contain the mean and standard deviation of values for a subset of variables """ df_dup = df[df.duplicated(["givenat", "pharmaid", "infu...
[ "numpy.timedelta64", "pandas.concat", "gc.collect", "ipdb.set_trace" ]
[((7930, 7942), 'gc.collect', 'gc.collect', ([], {}), '()\n', (7940, 7942), False, 'import gc\n'), ((1965, 1999), 'numpy.timedelta64', 'np.timedelta64', (['acting_period', '"""m"""'], {}), "(acting_period, 'm')\n", (1979, 1999), True, 'import numpy as np\n'), ((2401, 2418), 'pandas.concat', 'pd.concat', (['df_new'], {}...
from __future__ import division import numpy as np import covariance as cov from gp import GaussianProcess #import com.ntraft.covariance as cov #from com.ntraft.gp import GaussianProcess import matplotlib # The 'MacOSX' backend appears to have some issues on Mavericks. import sys if sys.platform.startswith('darwin'): ...
[ "matplotlib.use", "matplotlib.pyplot.plot", "sys.platform.startswith", "gp.GaussianProcess", "numpy.exp", "numpy.linspace", "matplotlib.pyplot.figure", "matplotlib.pyplot.title", "numpy.random.randn", "matplotlib.pyplot.show" ]
[((284, 317), 'sys.platform.startswith', 'sys.platform.startswith', (['"""darwin"""'], {}), "('darwin')\n", (307, 317), False, 'import sys\n'), ((836, 859), 'numpy.linspace', 'np.linspace', (['(-10)', '(-5)', 'N'], {}), '(-10, -5, N)\n', (847, 859), True, 'import numpy as np\n'), ((1077, 1099), 'numpy.linspace', 'np.li...
#!/usr/bin/python import rospy import numpy as np from operator import itemgetter from sensor_msgs.msg import LaserScan from geometry_msgs.msg import PointStamped from geometry_msgs.msg import Point from std_msgs.msg import Float32 from std_msgs.msg import Float64 import tf class ConeDetector: def __init__(self...
[ "numpy.mean", "sensor_msgs.msg.LaserScan", "rospy.Subscriber", "rospy.init_node", "numpy.sin", "geometry_msgs.msg.PointStamped", "rospy.Time.now", "geometry_msgs.msg.Point", "rospy.spin", "numpy.cos", "rospy.Duration", "rospy.Publisher" ]
[((4300, 4331), 'rospy.init_node', 'rospy.init_node', (['"""ConeDetector"""'], {}), "('ConeDetector')\n", (4315, 4331), False, 'import rospy\n'), ((4360, 4372), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (4370, 4372), False, 'import rospy\n'), ((435, 491), 'rospy.Publisher', 'rospy.Publisher', (['"""laser_window"""'...
import torch from torch.utils.data import Dataset import glob import tifffile as T from libtiff import TIFF import numpy as np def range_normalize(v): v = (v - v.mean(axis=(1, 2), keepdims=True)) / (v.std(axis=(1, 2), keepdims=True) + 1e-12) v_min, v_max = v.min(axis=(1, 2), keepdims=True), v.max(axis=(1, 2),...
[ "tifffile.imread", "numpy.floor", "torch.Tensor", "numpy.stack", "numpy.random.randint", "numpy.unravel_index", "libtiff.TIFF.open", "numpy.pad", "glob.glob" ]
[((506, 591), 'numpy.pad', 'np.pad', (['img', '((0, data_shape[0] - img.shape[0]), (0, 0), (0, 0))'], {'mode': '"""reflect"""'}), "(img, ((0, data_shape[0] - img.shape[0]), (0, 0), (0, 0)), mode='reflect'\n )\n", (512, 591), True, 'import numpy as np\n'), ((638, 723), 'numpy.pad', 'np.pad', (['img', '((0, 0), (0, da...
import glob from os.path import join, split def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration, get_mathlibs config = Configuration('random',parent_package,top_path) source_files = [join('mtrand', i) for i in ['mtrand.c', ...
[ "numpy.distutils.core.setup", "os.path.join", "numpy.distutils.misc_util.Configuration" ]
[((180, 229), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""random"""', 'parent_package', 'top_path'], {}), "('random', parent_package, top_path)\n", (193, 229), False, 'from numpy.distutils.misc_util import Configuration, get_mathlibs\n'), ((1349, 1383), 'numpy.distutils.core.setup', 'setup', ([], ...
# -*- coding: utf-8 -*- """ This module contains the classes for testing the model module of mpcpy. """ import unittest from mpcpy import models from mpcpy import exodata from mpcpy import utility from mpcpy import systems from mpcpy import units from mpcpy import variables from testing import TestCaseMPCPy import pan...
[ "mpcpy.exodata.ControlFromCSV", "pickle.dump", "pandas.DataFrame", "pandas.read_csv", "mpcpy.models.Occupancy", "mpcpy.systems.EmulationFromFMU", "mpcpy.exodata.ParameterFromCSV", "os.environ.get", "pickle.load", "mpcpy.models.Modelica", "mpcpy.exodata.WeatherFromEPW", "mpcpy.exodata.InternalF...
[((46885, 46900), 'unittest.main', 'unittest.main', ([], {}), '()\n', (46898, 46900), False, 'import unittest\n'), ((1334, 1392), 'mpcpy.exodata.ControlFromCSV', 'exodata.ControlFromCSV', (['control_csv_filepath', 'variable_map'], {}), '(control_csv_filepath, variable_map)\n', (1356, 1392), False, 'from mpcpy import ex...
from layer import Layer import numpy as np class FCLayer(Layer): def __init__(self,input_size,output_size): self.weights = np.random.rand(input_size,output_size)-0.5 self.bias = np.random.rand(1,output_size)-0.5 def forward_propagation(self,input_data): self.input = input_data ...
[ "numpy.dot", "numpy.random.rand" ]
[((490, 526), 'numpy.dot', 'np.dot', (['output_error', 'self.weights.T'], {}), '(output_error, self.weights.T)\n', (496, 526), True, 'import numpy as np\n'), ((550, 584), 'numpy.dot', 'np.dot', (['self.input.T', 'output_error'], {}), '(self.input.T, output_error)\n', (556, 584), True, 'import numpy as np\n'), ((136, 17...
import cv2 import numpy as np from .image_processor import ImageProcessor from .thermal_image import ThermalImage from .util import save_image, VideoCreator class OpenCvImageProcessor(ImageProcessor): def __init__(self): self.video_creator = VideoCreator() self.recording = False def on_imag...
[ "cv2.drawContours", "cv2.inpaint", "numpy.where", "cv2.imshow", "numpy.array", "cv2.findContours", "cv2.Canny", "cv2.waitKey" ]
[((508, 530), 'numpy.where', 'np.where', (['mask', '(255)', '(0)'], {}), '(mask, 255, 0)\n', (516, 530), True, 'import numpy as np\n'), ((639, 663), 'cv2.Canny', 'cv2.Canny', (['mask', '(30)', '(200)'], {}), '(mask, 30, 200)\n', (648, 663), False, 'import cv2\n'), ((694, 759), 'cv2.findContours', 'cv2.findContours', ([...
import argparse import numpy as np import torch import os, sys import math from subspace_inference import models, losses, posteriors, utils # from swag.posteriors import SWAG, EllipticalSliceSampling, BenchmarkPyro, BenchmarkVIModel from regression import run from bayesian_benchmarks.data import get_regression_data fr...
[ "torch.manual_seed", "bayesian_benchmarks.data.get_regression_data", "numpy.ceil", "os.makedirs", "argparse.ArgumentParser", "os.path.join", "regression.run", "torch.cuda.is_available", "argparse.Namespace", "torch.cuda.manual_seed", "torch.device" ]
[((405, 430), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (428, 430), False, 'import argparse\n'), ((2033, 2061), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (2050, 2061), False, 'import torch\n'), ((2062, 2095), 'torch.cuda.manual_seed', 'torch.cuda.manua...