text stringlengths 3.07k 22.1k |
|---|
from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
import numpy as np
from scipy import stats
from ..utils import _raise, backend_channels_last
from keras.layers import Dropout, Activation, BatchNormalization
from keras.layers impor... |
import base64
import string
import json
from random import SystemRandom
import bcrypt
import resumablehashlib
from peewee import TextField, CharField, SmallIntegerField
from data.text import prefix_search
def random_string(length=16):
random = SystemRandom()
return "".join([random.choice(string.ascii_upper... |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Unit tests for ChromeScaledImage.'''
from __future__ import print_function
import os
import sys
if __name__ == '__main__':
s... |
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 <NAME> <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import collections
import functools
import os
import re
# CONSTANTS
# categorization of a ru... |
"""NHES Optimization"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import utils
from default_config import config
from scipy.optimize import minimize
from scipy.integrate import odeint
# Makes matplotlib happy plotting pandas data arrays
pd.plotting.register_matplotlib_converters()
def th... |
# -*- coding: utf-8 -*-
# videobox \utils
# Provides utils for various things.
'''Utils File'''
import os
import re
import uuid
import asyncio
import discord
import filetype
import functools
from concurrent.futures import ThreadPoolExecutor
from aiohttp import ClientTimeout, ServerTimeoutError
class FindMediaRespon... |
import numpy as np
import os
import matplotlib.pyplot as plt
from pathlib import Path
from brainbox.singlecell import peths
from oneibl.one import ONE
import alf.io as ioalf
def get_session_path(sess_data_info):
"""
Return local session path given output of one.search
Example usage:
one = ONE()
... |
import numpy as np
from baselayer.app.access import auth_or_token
from ..base import BaseHandler
from ...models import (
Obj,
Annotation,
)
def normalize_key(str):
# convert the string to lowercase and remove underscores
return str.lower().replace('_', '')
def get_color_mag(annotations, **kwargs):
... |
"""____________________________________________________________________________
Script Name: _12_XSWatershedArea.py
Description: Adds watershed area to each cross section.
Date: 10/24/2019
Usage:
Calculates the watershed area upstream of the input cross section. Writes the
value to a ... |
from __future__ import unicode_literals
import base64
import datetime
from django.db import models
from django.utils import timezone
from ckeditor.fields import RichTextField
# SAMPLE DATA
PLATFORM_BRAND_POSITION = (
('0', 'Luxury'),
('1', 'mid'),
('2', 'discount')
)
# SAMPLE DATA
# Pulled from https://... |
#
# CV is a framework for continuous verification.
#
# Copyright (c) 2018-2019 ISP RAS (http://www.ispras.ru)
# Ivannikov Institute for System Programming of the Russian Academy of Sciences
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
#!/usr/bin/env python3
import os
import json
import numpy as np
import argparse
import pandas as pd
from pprint import pprint
from collections import OrderedDict
from pygama import DataGroup
from pygama.io.daq_to_raw import daq_to_raw
from pygama.io.raw_to_dsp import raw_to_dsp
from pygama.io.ch_group import *
def m... |
# -*- coding: utf-8 -*-
"""The main file for the FLAME algorithm"""
# author: <NAME>, Duke University
# Copyright Duke University 2020
# License: MIT
import pandas as pd
import numpy as np
from . import grouped_mr
from . import dame_algorithm
from . import flame_dame_helpers
def decide_drop(all_covs, consider_dropp... |
# Torch autograd Jacobians, Hessians and related
#
# <EMAIL>, 2021
import numpy as np
import torch
from torch import nn
from torch.autograd import Variable
from torch.autograd.functional import jacobian
def get_gradient(inputs, func, **kwargs):
"""
Return derivative df(x)/dx or gradient vectors
for f: R... |
'''
IteratorUtils.py
Classes/functions that provide additional iterator functionality beyond what is provided by the
standard python library
Copyright (C) 2013 <NAME>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
... |
# Copyright 2013 Google Inc. All Rights Reserved.
"""Utilities for determining the current platform and architecture."""
import os
import platform
import sys
class Error(Exception):
"""Base class for exceptions in the platforms moudle."""
pass
class InvalidEnumValue(Error):
"""Exception for when a string co... |
"""
Audit Utility
A module that contains logic for running an audit, grouping images \
by series, and running homogeneity/linearity calculations.
"""
# Imports
import pydicom
import numpy as np
from . import profileutil
from . import auditmethods
from . import phantomcenter as phantom
from . import notifications
impo... |
"""
qcodes_dataset.py
Dealing with qcodes dataset (the database) data in plottr.
"""
import os
from itertools import chain
from operator import attrgetter
from typing import Dict, List, Set, Union, TYPE_CHECKING, Any, Tuple, Optional, cast
import pandas as pd
from qcodes.dataset.data_set import load_by_id
from qcode... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 12 15:47:52 2021
@author: ShiningStone
"""
import numpy as np
import copy
import warnings
class CStimuliVectors():
'''
An array-like list
'''
def __init__(self,nFeat):
self.nFeat = nFeat
self._list = list()
def _forceSlice... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
__metaclass__ = type
# (c) 2017, Ansible by Red Hat, inc
#
# This file is part of Ansible by Red Hat
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pu... |
#!/usr/bin/env python3
import argparse
import os
import numpy as np
import math
import pathlib
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
import torch.nn as nn
import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of the SCICO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
# with the package.
r"""
Deconvolution Microscopy
========================
This example partially replicates a [GlobalBioIm example](ht... |
"""Analog log report object."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from collections import Counter, defaultdict, OrderedDict
import time
from analog.renderers import Renderer
from analog.utils import PrefixMatchingCounter
try:
from statisti... |
import numpy as np
import os
import yaml
# ==DOSE TIME CONSTRAINT UTILS==========================================================================================
def assign_dose_within_time_constraint(
doses_time_steps: list,
time_steps: np.ndarray = np.arange(0, 24*5*600, 300),
time_interval_steps: int =... |
import os
import math
import biosppy
import numpy as np
import pandas as pd
import datetime.datetime
from scipy.signal import butter, lfilter
from hrvanalysis import remove_ectopic_beats, interpolate_nan_values
def convert_disp_to_volt(data):
"""
Converts the PZT (% of displacement of the piezo-electric sensor... |
import random
from robot.api import logger
import shutil
from os import makedirs
import sys
from os.path import exists, dirname
CONF_DIR = "/etc/centreon-engine"
ENGINE_HOME = "/var/lib/centreon-engine"
SCRIPT_DIR: str = dirname(__file__) + "/engine-scripts/"
class EngineInstance:
def __init__(self, count: int):
... |
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
"""
Support for reading and writing genomic intervals from delimited text files.
"""
from __future__ import print_function
from bx.bitset import (
BinnedBitSet,
MAX
)
from bx.tabular.io import (
ParseError,
TableReader,
TableRow,
)
class MissingFieldError(ParseError):
pass
class FieldFormat... |
# Purpose: Concatenate all the windows' fepout files, but only take last bit from each.
# Usage: python convergedfep.py -d [/path/to/FEP-F/and/FEP-R] -n [num_blocks]
# Example: python convergedfep.py -d ../../../ -n 10
# Where: /beegfs/DATA/mobley/limvt/hv1/04_fep/analysis/1_dG/convergedfep.py
#
# Notes:
# - If... |
#/bin/bash
from Bio import SeqIO
import gzip,sys,os,subprocess,time,platform
import pandas as pd
import numpy as np
import itertools
from tempfile import *
from tqdm import *
import subprocess,sys, getopt,os,time,datetime
from multiprocessing import Process,Pool,Manager,Value
#set default parameters
mutant1,mutant2,wil... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
#!/usr/bin/python3
from collections import defaultdict
from numbers import Number
import re
import sys
import math
class ParseError(Exception):
def __init__(self, string):
super().__init__(string)
class SemanticError(Exception):
def __init__(self, string):
super().__init__(string)
class BCS... |
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2020 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""`reana-dev`'s release commands."""
import os
import sys
import tempfile
from shutil import... |
"""Visualization functions."""
import numpy as np
import logging
logger = logging.getLogger('tensorpac')
class _PacVisual(object):
"""Main PAC plotting class."""
def __init__(self):
"""Init."""
self._autovmM = True
def pacplot(self, pac, xvec, yvec, xlabel='', ylabel='', cblabel='',
... |
import numpy as np
import argparse
import os,sys
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.path import Path
from matplotlib.gridspec import GridSpec
from PIL import Image
class detectionInfo(object):
def __init__(self, line):
self.name = line[0]
self.trun... |
from django.db import models
from applications.globals.models import ExtraInfo
from applications.programme_curriculum.models import Batch
class Constants:
HOLIDAY_TYPE = (
('restricted', 'restricted'),
('closed', 'closed'),
('vacation', 'vacation')
)
ATTEND_CHOICES = (
('... |
# A test implementation of a 1D convolutional net using tensorflow.
# Author: <NAME>
# More sophisticated examples can be found here:
# https://github.com/tensorflow/models/tree/master/inception/inception
# or here:
# https://github.com/tensorflow/models/tree/master/tutorials/image/cifar10
import numpy as np
im... |
import unittest
from unittest.mock import patch
from tmc import points
from tmc.utils import load, load_module, reload_module, get_stdout
from functools import reduce
import os
import textwrap
from random import choice, randint
exercise = 'src.course_grading_part_4'
def f(d):
return '\n'.join(d)
datafile1 = 're... |
from flask import Flask
from flask import render_template, redirect, url_for,flash
from flask import request, Response
import cv2
import os
import time
import imutils
import numpy as np
from imutils.video import VideoStream
app = Flask(__name__)
faceClassif = cv2.CascadeClassifier(cv2.data.haarcascades+'haarcascad... |
# Copyright 2018 The trfl Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
"""The command-line interface for Karp."""
import logging
import logging.handlers
import os
import click
import karp5
from karp5.application.actions import mode_actions
from karp5.cli import create_metadata as metadata
from karp5.cli import upload_offline as upload
from karp5.cli import getmapping as gm
from karp5.co... |
import numpy as np
import sys
import warnings
warnings.filterwarnings('ignore')
import george
from george import kernels
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF,WhiteKernel, ConstantKernel as C, DotProduct, RationalQuadratic, Matern
from scipy.op... |
from behave import *
import json
from agent_backchannel_client import agent_backchannel_POST, expected_agent_state
from agent_test_utils import get_relative_timestamp_to_epoch, amend_presentation_definition_with_runtime_data
@given('"{prover}" has an issued credential with formats from {issuer} with {credential_data}... |
from django.core.urlresolvers import NoReverseMatch
from django.utils import html
from corehq.apps.api.es import ReportCaseES, ReportXFormES
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn
from corehq.apps.reports.filters.base import BaseSingleOptionFilter
from corehq.apps.users.models i... |
import numpy as np
import json
from parser import data_parser
def set_func1(cap,attr,attr_list,attr_dict):
if attr[13]:
cap = cap.replace('13',attr_dict[attr_list[13]])
else:
cap = cap.replace('13 ','')
if attr[14]:
cap = cap.replace('14',attr_dict[attr_list[14]])
... |
# Copyright 2021 DeepMind Technologies Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Created by jianbing on 2017-10-30
"""
import functools
import time
import unittest
from utx.setting import setting
from . import log
from .case_tag import Tag
CASE_TAG_FLAG = "__case_tag__"
CASE_DATA_FLAG = "__case_data__"
CASE_DATA_UNPACK_FLAG = "__case_data_unpack__... |
# coding: utf-8
# Word2vec from Manaus
# =============
from __future__ import print_function
from __future__ import division
import itertools
import collections
import math
import numpy as np
from scipy.spatial.distance import cosine
import os
import random
import tensorflow as tf
import re
import json
from matplot... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# W100 challenge for Pixels Camp CTF 2016
#
# Copyright (c) 2016, <NAME>
#
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
import sys
import os
import logging
import ha... |
#!/usr/bin/env python
# coding=utf-8
from __future__ import division, print_function, unicode_literals
import os
import os.path
import numpy as np
import h5py
from fuel.converters.base import fill_hdf5_file
np.random.seed(104174)
# update to local for easy debugging
data_dir = './'
square = np.array(
[[1, 1, 1, ... |
import models
import nndata
import numpy as np
import riemannian
import tensorflow as tf
from tensorflow.keras import layers, optimizers, Sequential, metrics
from tensorflow import keras
from keras.utils.np_utils import *
import os
import tensorflow as tf
from tensorflow.keras import layers, optimi... |
import uuid
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone, formats
from django.contrib.sites.models import Site
from django.urls import reverse
from django.db.models import (
Model,
CASCADE,
CharField,
DateTimeField,
TextField,
ForeignKey,
EmailFie... |
"""
N-body integration of N particles with a Salpeter initial mass
function between Mmin and Mmax and with stellar evolution with
metallicity z.
"""
import sys
import numpy
from optparse import OptionParser
from prepare_figure import single_frame
from distinct_colours import get_distinct
from amuse.units imp... |
# 2018-9-13
import cv2
import numpy as np
def center(points):
"""
[[768 242]
[784 384]
[673 397]
[657 255]]
"""
# x1 = (points[0][0] + points[1][0]) / 2
# x2 = (points[2][0] + points[3][0]) / 2
# x = (x1 + x2) / 2
x = (points[0][0] + points[1][0] + points[2][0] + points[3][0])... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL scripts
# Purpose: Perform a pansharpening operation
# Author: <NAME> <even.rouault at spatialys.com>
#
#########################################################... |
"""
Copyright (c) 2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... |
# -*- coding: utf-8 -*-
# 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”)
#
# 除非遵守当前许可,否则不得使用本软件。
#
# * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件):
# 遵守 Apache License 2.0(下称“Apache 2.0 许可”),
# 您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。
# 除非法律有要求或以书面形式达成协议,否则本软件分发时... |
# The following code is largely borrowed from:
# https://github.com/ikostrikov/pytorch-a2c-ppo-acktr-gail/blob/master/a2c_ppo_acktr/storage.py
from collections import namedtuple
# from multiprocessing import Pool
import numpy as np
import torch
from torch.utils.data.sampler import BatchSampler, SubsetRandomSampler
... |
#!/usr/bin/env python3
'''
Polychora: Python animation of uniform polychora in 4 and higher dimensions
Author: <NAME>
Email: <EMAIL>
Last Updated: 12-9-2020
'''
from itertools import product, permutations
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
from matplo... |
# -*- coding: utf-8 -*-
import numpy as np
from numpy.matlib import repmat
# from pprint import pprint as pp
# from Utils.ReadMat import loadCheckboard
__author__ = 'spacegoing'
# initialize random number generator
np.random.seed(0)
class Options:
# Image Configs
gridStep = 16 # grid size for defining cli... |
import struct
import json
import os
import csv
class DataFile:
def traverse_init(self,format,ret):
for key in format:
if isinstance(format[key], dict):
ret[key] = []
else:
ret[key] = 0
def __init__(self,format,filename=None):
self.fil... |
"""
Script to processes basic data from all query
files to notebooks1.csv. After notebooks1.csv is created, files
can be downloaded with download.py.
"""
import time
import os
import datetime
import json
import sys
import argparse
import requests
import pandas as pd
from consts import (
URL,
COUNT_TRIGGER,... |
"""Assets represent Financial Assets, these are claims based on a contract.
These are often referred to as Securities or Products in other libraries.
"""
from __future__ import absolute_import, division, print_function
import pandas as pd
from pandas import DataFrame
from numbers import Number
from pandas.tseries.o... |
"""
Prepares PUMS Data-Dict CVS for use as panda data frames.
todo: review function comments for accuracy
"""
# %%
import pandas as pd
import json
from _constants import recent_years
# dict.column.value
zero_prefix_rules = {
'DetailedAncestryRecode1': 3,
'DetailedAncestryRecode2': 3,
'DetailedHispanicOrigi... |
import hydra
import numpy as np
from omegaconf import DictConfig, OmegaConf
import torch
import os
import schnetpack as spk
from torch.utils.data.sampler import RandomSampler
import logging
from field_schnet.utils.script_utils import evaluate_dataset
from field_schnet.utils import compute_shielding_scaling
def get_r... |
import ctypes
import time
try:
from memory_profiler import memory_usage
except ImportError:
memory_usage = None
from pytest import mark
from wand.color import Color
from wand.compat import xrange
from wand.version import QUANTUM_DEPTH, MAGICK_VERSION_INFO # noqa
def test_equals():
"""Equality test."""
... |
"""Validate Modbus configuration."""
from __future__ import annotations
from collections import namedtuple
import logging
import struct
from typing import Any
import voluptuous as vol
from homeassistant.const import (
CONF_ADDRESS,
CONF_COMMAND_OFF,
CONF_COMMAND_ON,
CONF_COUNT,
CONF_HOST,
CON... |
from __future__ import unicode_literals
import sys
import os
import optparse
import json
from pip.log import logger
from pip.index import PackageFinder
from pip.req import RequirementSet, InstallRequirement, parse_requirements
from pip.locations import build_prefix, src_prefix
from dependency import trace_... |
#===============================================================================
# Copyright 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... |
import numpy as np
from scipy.cluster.vq import vq, kmeans, whiten
from scipy.optimize import lsq_linear
import tqdm
limit = 1000
def rigidRegister(source, target):
# Normalize the data
v = target
p = source
pMean = np.mean(p,0)
vMean = np.mean(v,0)
pp = p - pMean
vp = v - vMean
# Co... |
import os
import sys
import torch
import torch.utils.data
import pickle
import numpy as np
import random
import time
import timeit
import argparse
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from try_model import CNNTrajNet, reshape_output, displ... |
import argparse
import copy
from os import path
from pathlib import Path
import torch
torch.set_default_tensor_type('torch.cuda.FloatTensor')
from torchvision.utils import save_image
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
# import ssl # enable if downloading models gives CERTIFI... |
import math, re;
gbDebugOutput = False;
rDateDuration = re.compile(
"^\\s*" +
"(?:([+-]?\\d+)\\s*y(?:ears?)?\\s*,?\\s*)?" +
"(?:([+-]?\\d+)\\s*m(?:onths?)?\\s*,?\\s*)?" +
"(?:([+-]?\\d+)\\s*d(?:ays?)?)?" +
"\\s*$"
);
def fbIsValidInteger(uValue):
return isinstance(uValue, (int, float)) and uValue % 1 == 0... |
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.core.exceptions import FieldError
import re
UNCONFIRMED = "UN"
ACTIVE = "AC"
OPTOUT = "OP"
REMOVED = "RE"
NON_SUBSCRIBER = "NO"
HIDDEN = 'HI'
STATUS_CHOICES = (
(UNCONFIRMED, "Unconfirmed"),
(ACTIVE, "Active"),
(... |
import abc
import re
from copy import copy
from typing import Any, Dict, List, Optional, Tuple, Union
from transformers import PreTrainedTokenizerBase
PROMPT_TOKEN = "<|P|>"
PROMPT_TOKEN_FOR_KEY = "<|[{key}]P|>"
PROMPT_TOKEN_SERIAL = "<|P[{serial}]|>"
PROMPT_TOKEN_SERIAL_FOR_KEY = "<|[{key}]P[{serial}]|>"
PROMPT_TOKE... |
import os
import brevitas.nn as qnn
import torch
import torch.nn as nn
from pact import PACTReLU
from torchvision import datasets, models
from torchvision.transforms import Compose, Normalize, Pad, RandomCrop, RandomHorizontalFlip, ToTensor
train_transform = Compose(
[
Pad(4),
RandomCrop(32, fill=... |
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utilities for standard operations on URIs of different kinds."""
from __future__ import print_function
import re
import sys
import urllib
import ... |
"""
Finite Difference Check
-----------------------
This module provides functions to automatically check correctness of amici
computed sensitivities using finite difference approximations
"""
from . import (
runAmiciSimulation, SensitivityOrder, AMICI_SUCCESS, SensitivityMethod,
Model, Solver, ExpData, Return... |
"""
Copyright (c) 2016 <NAME> <<EMAIL>>
Experiment in btree walking
*-------->[00]
*------>[02]---+ [01]
root ->[08]---+ [05]-+ |
[17]-+ | | +--->[03]
| | | [04]
| | |
| | +----->[06]
| | ... |
'''Train CIFAR10 with PyTorch.'''
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import torchvision
import torchvision.transforms as transforms
import os
import argparse
import numpy as np
from models import *
parser = argparse.A... |
from patroller_policy import PatrollerPolicy
from patroller_value_network import PatrollerValue
from poacher_rule import Poacher
from env import Env
import numpy as np
import argparse
import sys
import tensorflow as tf
import os
from maps import generate_map
def test(poacher, patroller, env, sess, args):
ret_tota... |
from __future__ import print_function
import os
import time
import imageio
import numpy as np
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from model import CRW
from data import vos, jhmdb
from data.video import SingleVideoDataset
from collections import OrderedDict
import utils_test
impo... |
import os, sys, signal, time
import threading, collections, copy
import pyaudio, wave, pvporcupine
from log import Log
TOP_DIR = os.path.dirname(os.path.realpath(__file__))
RESOURCE_FILE = os.path.join(TOP_DIR, "resources/common.res")
class RingBuffer(object):
_total_length=0
_length=0
"""
Ring buffer to hold a... |
'''
Utilities functions for plotting and visualization.
'''
import matplotlib
from matplotlib.ticker import FormatStrFormatter
matplotlib.use('agg')
import matplotlib.pyplot as plt
import seaborn as sns
import json
import pandas as pd
import numpy as np
import utils
import os
import os.path as osp
i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
import sys
import pygimli as pg
import pygimli.solver as solver
from pygimli.meshtools import polyCreateDefaultEdges_
from pygimli.meshtools import createMesh
import matplotlib.pyplot as plt
import numpy as np
#from solverFVM import solveStokes_NEEDNAME
def mo... |
import hashlib
import itertools
import re
import string
from multiprocessing import freeze_support
from os import urandom
from time import time, sleep
from crypto_commons.brute.brute import brute
from crypto_commons.generic import xor_hex
from crypto_commons.netcat.netcat_commons import nc, receive_until_match, send, ... |
#!/usr/bin/env python3
from argparse import ArgumentParser
import inspect
import importlib
import pickle
import re
import string
import numpy as np
import sklearn
import sklearn.base
import sklearn.compose
import sklearn.datasets
import sklearn.exceptions
import sklearn.dummy
import sklearn.inspection
import sklearn.m... |
#!/usr/bin/env python
# -=- encoding: utf-8 -=-
"""
# InkSlides
This script generates a PDF presentation out of a single inkscape
document.
"""
import argparse
import copy
import hashlib
import multiprocessing
import os
import shutil
import subprocess
import sys
import tempfile
import time
from multiprocessing impor... |
""" ****************************************** IMUs + STRETCH SENSORS ******************************************
- This is a draft of Deep learning based HAR models using IMUs and Stretch sensors
- Testing the model with 2 datasets: 1) our lab dataset, 2) w-HAR dataset
"""
import numpy as np
from dataclasses import... |
"""
Implementation of hooks and APIs for outputting log messages.
"""
import sys
import traceback
import inspect
import json as pyjson
from threading import Lock
from functools import wraps
from io import IOBase
from pyrsistent import PClass, field
from . import _bytesjson as bytesjson
from zope.interface import Int... |
import pyodbc
import traceback
import sys
import re
from types import SimpleNamespace
from textwrap import dedent
from typing import List, Dict, Iterable
from sql_runner.db import Query, DB, FakeCursor
class AzureDwhQuery(Query):
@property
def distribution(self) -> str:
""" Distribution statement, pa... |
import torch
import torch.nn.functional as F
import numpy as np
class Intrinsics:
def __init__(self, width, height, fu, fv, cu=0, cv=0):
self.height, self.width = height, width
self.fu, self.fv = fu, fv # fu, fv: focal length along the horizontal and vertical axes
# cu, cv: optical center ... |
# coding: utf-8
import os,platform
import numpy as np
from copy import deepcopy
from utmLib.clses import MyObject
from utmLib.utils import notin, halfprod
import networkx as nx
import networkx.algorithms as nxalg
class Node(MyObject):
def __init__(self,desc = '?'):
self.desc = desc
def __... |
#!/usr/bin/env python3
"""
plots loadtest results produced by gatling
"""
# standard library modules
import argparse
import csv
import glob
import json
import logging
import math
import os
import re
import sys
import warnings
# third-party modules
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as... |
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.core.urlresolvers import reverse, reverse_lazy
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect, rende... |
# coding:utf-8
import base64
import configparser
import json
import os
import urllib
import future
import asyncio
import pandas as pd
import requests
import datetime
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from QUANTAXIS.QAE... |
# Copyright 2011,2012,2013,2017 <NAME>
#
# 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 i... |
# pylint: disable=wrong-or-nonexistent-copyright-notice
import warnings
from typing import Sequence, TYPE_CHECKING, List
from itertools import product
from cirq import ops, protocols, devices
import numpy as np
if TYPE_CHECKING:
from typing import Iterable
import cirq
class NoiseProperties:
def __init__(... |
import numpy as np
import random
import torch
import networkx as nx
class KG():
def __init__(self, path='./EnhancedKGQA_main/ComplEx_MetaQA_full/'):
self.r_em_path = path + 'R.npy'
self.e_em_path = path + 'E.npy'
self.r_dict_path = path + 'relations.dict'
self.e_dict_path ... |
# coding=utf-8
# Copyright 2018 The Dopamine Authors.
# Modifications copyright 2019 <NAME>
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.