text stringlengths 6.04k 39.5k |
|---|
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 15 08:40:18 2020
@author: xie(508)
"""
# Electronic band structures and optiacal properities of type-2 superlattice photodectors with interfacial effect. Optical Express. Vol,20,No,2(2012).PengFei Qiao.
import re
import sys
import csv
import numpy as np
###############... |
#!/usr/bin/env python3
# Annotate PDF files based on their logical structure.
import sys
import re
import json
import uuid
from collections import defaultdict
from argparse import ArgumentParser
from pdfminer.layout import LTLine, LTRect
from PyPDF2 import PdfFileWriter, PdfFileReader
from taggedpdf import TaggedP... |
# -*- coding: utf-8 -*-
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple
from typing import Union
from poke_env.data import GEN_TO_POKEDEX, UNKNOWN_ITEM
from poke_env.environment.effect import Effect
from poke_env.environment.pokemon_gender imp... |
"""
Formal sums
AUTHORS:
- <NAME> (2006-09-20): changed FormalSum not to derive from
"list" anymore, because that breaks new Element interface
- <NAME> (2006-12-06): added test cases.
- <NAME> (2006, 2009): wrote the first version in 2006, documented it in 2009.
- <NAME> (2010-07-19): new-style coercions, d... |
import sys
import os
import copy
import numpy as np
import DataProcessingTools as DPT
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.uic import loadUiType
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import (
FigureCanvasQTAgg as FigureCanvas,
NavigationToolbar2QT as Navig... |
from tkinter import filedialog
from tkinter import *
import copy
import shutil
import sys
import os
import locg
import comicvine
import comicutil
import archiveutil
import imageutil
import config
import comixology
import comicdb
from comicapi import comicinfoxml, filenameparser
SETTINGS = config.get_config()
REMOVE_S... |
import os
import sys
import pyNastran
from pyNastran.utils import check_path
from pyNastran.utils.arg_handling import argparse_to_dict, swap_key, update_message
#from gui.formats import format_string
if sys.version_info < (3, 7): # pragma: no cover
sys.exit("requires Python 3.7+...")
SUPPORT_MULTIMODEL = False... |
from invoke import task
# from ..config import ()
import os
import os.path as osp
from pathlib import Path
import shutil as sh
from warnings import warn
## Paths for the different things
DOCS_TEST_DIR = "tests/test_docs/_tangled_docs"
DOCS_EXAMPLES_DIR = "tests/test_docs/_examples"
DOCS_TUTORIALS_DIR = "tests/test_... |
# pylint: disable-msg=W0703
# pylint: disable-msg=E1103
import datetime
import logging
from google.appengine.ext import ndb
from google.appengine.api import users
from app_dashboard_helper import AppDashboardHelper
class DashboardDataRoot(ndb.Model):
""" A Datastore Model that contains information about the AppSca... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module prvoides the tools used to internally run the astropy test suite
from the installed astropy. It makes use of the `pytest` testing framework.
"""
from __future__ import (absolute_import, division, print_function,
uni... |
# coding: utf-8
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for XML reports from coverage.py."""
import os
import os.path
import re
import coverage
from coverage.backward import import_local_file
f... |
"""This module provides convenience functions to calculate curved-sky responses and reconstruction noise curve for lensing or other estimators
In plancklens a QE is often described by a short string.
For example 'ptt' stands for lensing (or lensing gradient mode) from temperature x temperature.
Anisotrop... |
"""Python utilities to load and wrap SEGGER JLink library."""
# The MIT License (MIT)
# Copyright (c) 2019 ezflash
#
# 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, incl... |
"""
"wheel" copyright (c) 2012-2017 <NAME> <<EMAIL>> and
contributors.
The MIT License
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... |
#-------------------------------------------------------------------------------
# Name: CvStrategyOverlay.py
# Purpose: Draws the strategy overlay itself.
# CvOverlayScreen.py does the editing.
# Contains:
# -Dot Mapper
# -Categorized signs
#
# Aut... |
# coding: utf-8
from __future__ import unicode_literals
from subprocess import CalledProcessError
from textwrap import dedent
import pytest
from johnnydep.lib import JohnnyDist
from johnnydep.lib import flatten_deps
def test_version_nonexisting(make_dist):
# v0.404 does not exist in index
make_dist()
w... |
#!/usr/bin/env python
# coding: utf-8
# ##### Set up the environment
# In[1]:
import matplotlib.pyplot as plt
import numpy as np
import random
import math
from collections import namedtuple
get_ipython().run_line_magic('matplotlib', 'inline')
# In[2]:
# Optimization for mathplotlib
import matplotlib as mpl
impo... |
# -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2012 <NAME>, Opera Software ASA
#
# 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
#
# Unl... |
#!/usr/bin/env python
# Jupiter IRC Botnet
# Developed by acidvegas in Python
# https://git.acid.vegas/jupiter
# jupiter.py
import random
import re
import socket
import ssl
import time
import threading
# Connection
servers = (
'efnet.port80.se', # IPv6
'efnet.portlane.se', # IPv6
'irc.choopa.net', ... |
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: 2020-07-16 10:10:07
# @Last Modified by: <NAME>
# A unified tool for updating CNN JSON with network prediction results
import copy
import sys
import numpy as np
from tqdm import tqdm
from enum import Enum
from .id_related import create_uuid
from .coding_related i... |
"""
These routines are not well-tested. They are also old.
OB says that it is not important to test them well because Scalar Ops
are rarely used by themselves, instead they are the basis for Tensor Ops
(which should be checked thoroughly). Moreover, Scalar will be changed
to use numpy's scalar routines.
If you do want ... |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import math
import os
import xml.dom.minidom
from xia2.Decorators.DecoratorFactory import DecoratorFactory
from xia2.Driver.DriverFactory import DriverFactory
from xia2.Handlers.Phil import PhilIndex
from xia2.Handlers.Streams imp... |
#!/usr/bin/env python3
###############################################################################
# #
# RMG - Reaction Mechanism Generator #
# ... |
import numpy as np
from numpy import mean
import math
import random
import functools
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy import optimize
from scipy.optimize import curve_fit
from fitEllipse import fit_ellipse
graphWidth = 800 # units are pixels
graphHeight = 600 # units ... |
# <<BEGIN-copyright>>
# Copyright 2021, Lawrence Livermore National Security, LLC.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>
import os
from pqu import PQU as PQUModule
from PoPs import IDs as IDsPoPsModule
from PoPs.groups import misc as miscGroups... |
import numpy as np
from scipy.optimize import fsolve
from numpy.random import uniform
from numpy import vectorize
#Gamma: 0.5625
#gamma: 2.0
#Aggragate Labor Good 0.9505050505050505
#Aggragate Labor Good 0.908080808080808
@vectorize
def U(c,n, Gam,gam):
if c<=0 or n<0 or n>1:
u = -np.inf
... |
# -*- coding: utf-8 -*-
# A WordPress compiler plugin for Nikola
#
# Copyright (C) 2014-2015 by <NAME>
# Copyright (C) by the WordPress contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Founda... |
#!/usr/bin/env python
# Exploitation of CVE-2014-0160 Heartbeat for the client
# Author: <NAME> <<EMAIL>>
# Licensed under the MIT license <http://opensource.org/licenses/MIT>.
# Python 2.6 compatibility
from __future__ import unicode_literals
try:
import socketserver
except:
import SocketServer as socketserv... |
# -*- encoding: utf-8 -*-
'''
@File : CluORegAddKD.py
@Contact : <EMAIL>
@Modify Time @Author @Version @Desciption
------------ ----------- -------- -----------
2021/1/3 21:52 guzhouweihu 1.0 None
'''
import os
import sys
import csv
import time
import datetime
from... |
# -*- coding: utf-8 -*-
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2008, <NAME> <<EMAIL>>
# Copyright 2018, <NAME> <<EMAIL>>
'''
Basics
======
This module contains two classes which will be used as a base classes which
will be useful to create our device classes: M... |
# HACK ignore warnings
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
import os
import sys
import json
import h5py
import torch
import argparse
import numpy as np
from tqdm import tqdm
from copy import deepcopy
from torch.utils.data import DataLoader
from plyfile import PlyData, PlyElement... |
# -*- encoding: utf-8 -*-
'''
@Author : lance
@Email : <EMAIL>
'''
from skimage import io,transform,exposure
import numpy as np
import os
imgpath="./data/test/C3F/C3F_blockId#32756.bmp"
img=io.imread(imgpath)
io.imshow(img)
print(type(img)) #显示类型
print(img.shape) #显示尺寸 #height/weight/channel
print(img.... |
"""A set of stream oriented parsers for http requests and responses, inline
with the current draft recommendations from the http working group.
http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-17
Unlike other libraries, this is for clients, servers and proxies.
Missing:
comma parsing/header folding
""... |
# Copyright (C) 2019-2022, Pyronear.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
import json
import numpy as np
import pandas as pd
import cv2
import os
from functools import partial
__all__ = ['Ann... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
from tqdm import tqdm
from models import utils
class Model(object):
def __init__(self,
cfg,
model_arch,
restore_vars... |
import numpy as np
import scipy.stats as stats
import aesara
from aesara.tensor.basic import as_tensor_variable
from aesara.tensor.random.op import RandomVariable, default_shape_from_params
from aesara.tensor.random.utils import broadcast_params
try:
from pypolyagamma import PyPolyaGamma
except ImportError: # p... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Webonyx and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import json
import frappe
from frappe import _
from erpnext.stock.utils import get_stock_balance
from erpnext_biotrack.biotrackthc import call as biotrackthc_... |
"""
Some common utilities for interacting with discord.
"""
from __future__ import annotations
import asyncio
import re
import math
import discord
import discord.abc
import discord.ext.commands
import string
import logging
from typing import (Any, List, Sequence, Callable, Iterable, Optional, Union, Coroutine, AsyncCon... |
"""Test functions in the h5io module
These tests copy extensively from deepdish.io to test the io functions that
were modified from the same library. Below is the entire text of deepdish's
BSD-3 license:
---
Copyright (c) 2014, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or w... |
#!/usr/bin/env python3
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2015-2019 <NAME> <<EMAIL>>
# Copyright (c) 2020-2022 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: BSD-2-Clause
import os
import argparse
from migen import *
from litex_boards.targets.digilent_arty import BaseSoC
from litex.bui... |
from __future__ import print_function
"""dataClay Tool code for Python.
The code in this package is intended to be used by the "dataClay Tool", for all
the Python specific stuff.
"""
# TODO The below code should be deprecated as soon as the dclayTool.sh is done
from dataclay.api import init_connection, finish
from d... |
import numpy as np
from coremltools.proto import NeuralNetwork_pb2 as _NeuralNetwork_pb2
def _evaluate_slice(layer, x, shape):
params = layer.slice
start_index = params.startIndex
end_index = params.endIndex
strides = params.stride
axis = _NeuralNetwork_pb2.SliceLayerParams.SliceAxis.Name(params.axis)
x = ... |
# -*- coding: utf-8 -*-
"""Spectral peak search using convolutions."""
import matplotlib.pyplot as plt
import numpy as np
import warnings
from .spectrum import Spectrum
class PeakFilterError(Exception):
"""Base class for errors in PeakFilter."""
pass
class PeakFilter(object):
"""An energy-dependent k... |
import argparse
import json
import os
import random
import time
from flow_sdk.client import FlowClient
home_dir = os.path.split(os.path.realpath(__file__))[0]
# Hetero-lr task
hetero_lr_config_file = home_dir + "/config/test_hetero_lr_train_job_conf.json"
hetero_lr_dsl_file = home_dir + "/config/test_hetero_lr_train... |
from __future__ import absolute_import, division, print_function
import collections
import logging
from math import sqrt
import matplotlib
from iotbx.reflection_file_reader import any_reflection_file
from libtbx.phil import parse
import dials.util
from dials.algorithms.statistics.delta_cchalf import PerImageCChalfStati... |
# filename
#
# Using parsed data in a gc_event_dataframe, creates heatmaps to visually
# show latency during runtime.
#
import matplotlib
from matplotlib import pyplot as plt
import numpy as np
# TODO: Most of this code is borrowed. Read and update documentation
# to be consistent to my personal style.
# #... |
import os
import string
import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import multiprocessing as mp
import numpy as np
import pandas as pd
from palettable.colorbrewer.qualitative import Paired_12
import seaborn as sns
import scipy.stats as stats
mpl.rcPara... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'download.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
import threading
from multiprocessing.pool import ThreadPool
import os
import time, gc
import urllib.request
imp... |
from functools import singledispatchmethod
from contextlib import contextmanager
from itertools import islice
import ir
import type_resolution as tr
# https://docs.python.org/3/reference/expressions.html#operator-precedence
binop_ordering = {"**": 1, "*": 3, "@": 3, "/": 3, "//": 3, "%": 3, "+": 4, "-": 4, "<<"... |
# coding: utf-8
# # Model McGee
# ## The model
#
#
# We assume that $y_t$ follows the following model:
#
# $$y_t = \beta x_t +\epsilon_t$$ (1)
#
# where
#
# $y_t$, total sales in month t
#
# $x_t$, IHS vehicle line or segment quarterly sales in month t
#
# We assume that $\epsilon_t$ follows an SARIMA proc... |
""" Quick n Simple Image Folder, Tarfile based DataSet
Hacked together by / Copyright 2020 <NAME>
"""
import torch.utils.data as data
import os
import logging
import math
import collections
import tqdm
import cv2
import torch
import pandas as pd
from glob import glob
from PIL import Image
from .parsers import create... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from tensorflow.keras.losses import binary_crossentropy
import tensorflow.keras.backend as K
import tensorflow as tf
import numpy as np
from sklearn.metrics import precision_score, recall_score
from tensorflow.python.types.core import Value
epsilon = 1e-5
smooth = 1
def... |
import matplotlib
matplotlib.use('Agg')
import pylab as plt
import math
import os
import logging
import warnings
import multiprocessing as mp
import numpy as np
from sklearn import cluster
from scipy.optimize import curve_fit
from scipy.signal import argrelextrema, savgol_filter
import seaborn as sb
from . import ut... |
# -*- test-case-name: nevow.test.test_url -*-
# Copyright (c) 2004-2007 Divmod.
# See LICENSE for details.
"""
URL parsing, construction and rendering.
"""
import weakref
import urllib.parse
import urllib.request, urllib.parse, urllib.error
from zope.interface import implementer
from twisted.web.util import redirec... |
#setup
states=[]
haveMod=True
strict=True #maintains opponent's "01" or "10" value, does not support haveMod==False
def tostr(i,j,k,l): #convert digits into a state
return str(i)+str(j)+str(k)+str(l)
def Overflow(v): #handle >5 condition under haveMod
if haveMod==True:
return v % 5
else:
if... |
# Copyright (C) 2021 ServiceNow, Inc.
# Preprocessing/cleaning script
#
import nrcan_p2.data_processing.preprocessing_dfcol as preprocessing_dfcol
import nrcan_p2.data_processing.preprocessing_dfcol as preprocessing_str
import nrcan_p2.data_processing.pipelines as pipelines
from typing import Callable, List, Tuple, Di... |
from __future__ import print_function
from __future__ import division
import argparse
import json
import os
import sys
import platform
import subprocess
import time
import shutil
import re
from copy import deepcopy
from multiprocessing import cpu_count
import r2g
from r2g import errors
from r2g.utils.dryrun import Dr... |
from django.db import transaction
import json
import jmespath
import re
from tqdm import tqdm
from time import sleep
from django.utils.text import slugify
from django.conf import settings
from core.services.deck_codes import parse_deckstring
from core.services.api_workers import HsApiConnection
from core.services.ima... |
"""Test the pypfilt.examples.predation module."""
import datetime
import numpy as np
import os
import os.path
import pypfilt
import pypfilt.examples
import pypfilt.examples.predation
import pypfilt.sweep
import pytest
def make_params(time_scale, max_days=14):
"""Define the default simulation parameters for this ... |
from KafNafParserPy import *
from xml.etree.ElementTree import ElementTree
from collections import defaultdict
import sys
import os
version = "0.1"
pid = 0
sid = 0
missed_rels = 0
class cDependent():
'''
Class that captures structure of dependents for multiword descriptions
'''
def __init__(self,... |
from msdm.core.algorithmclasses import Result
from msdm.core.algorithmclasses import Learns
from msdm.core.problemclasses.stochasticgame.tabularstochasticgame import TabularStochasticGame
from msdm.core.problemclasses.stochasticgame.policy.tabularpolicy import TabularMultiAgentPolicy, SingleAgentPolicy
from msdm.core.a... |
# inference.py
# ------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to
# http://inst.eecs.b... |
import niGraphParser
import niGraph
import csv
from collections import deque
import sys
import glob
import os
import random
import time
import re
from matplotlib import pyplot
import networkx as nx
import networkx.algorithms.shortest_paths.dense as dense
import xml.etree.ElementTree as ET
import networkx.algorithms.si... |
import os
import pandas as pd
import numpy as np
from autumn.settings import PROJECTS_PATH
from autumn.settings import INPUT_DATA_PATH
from autumn.tools.utils.utils import update_timeseries
from autumn.models.covid_19.constants import COVID_BASE_DATETIME
from autumn.tools.utils.utils import create_date_index
from autu... |
# -*- coding: utf-8 -*-
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import data_tools as dt
import json
from tqdm import tqdm
app = Flask(__name__)
class Config(object):
"""配置参数"""
# 设置连接数据库的URL
user = 'tyang'
password = '<PASSWORD>'
database = 'codedb'
app.config['SQLALCH... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 16th February, 2017:
File containing all useful functions for the different executables.
@author: <NAME>, Electrical Engineering, Vanderbilt University
'''
import logging
import os
import sys
from .errors import XnatToolsError, XnatToolsUserError
LENGTH... |
from configparser import RawConfigParser
from binascii import hexlify
from itertools import islice
import errno
import os
import shutil
import struct
import sys
from zlib import crc32
from .hashindex import NSIndex
from .helpers import Error, IntegrityError, read_msgpack, write_msgpack, unhexlify, UpgradableLock
from ... |
'''
control.py: human interface controller for Martian
After trying alternatives and failing to get things to work, I settled on the
following approach that works on both Mac and Windows 10 in my testing.
The constrol structure of Martian is somewhat inverted from a typical
WxPython application. The typical applicat... |
#!/usr/bin/python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import time
import functools
import tempfile
import platform
import configparser
import gdb
import pwngef.config
from pwngef.color import Color
from pwngef.color import m... |
# --------------------------------------------------------
# ROSITA
# Licensed under The Apache License 2.0 [see LICENSE for details]
# Written by <NAME> and <NAME>
# --------------------------------------------------------
import torch, datetime, logging, random, copy
import torch.nn as nn
import torch.optim ... |
from __future__ import print_function, division, absolute_import
import os
os.environ['ODIN'] = 'float32,gpu'
import pickle
from collections import OrderedDict, defaultdict
import numpy as np
from scipy.io import savemat
from scipy import stats
import tensorflow as tf
from sklearn.decomposition import PCA
from skle... |
"""
MIT License
Copyright (c) 2020 GamingGeek
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publi... |
#import datetime
import os
import glob
import sys
import re
import json
from config import *
from collections import Counter
#this = sys.modules[__name__]
def mut_to_string(mut):
return '-'.join([mut['operatorDescription'], mut['class'], mut['operatorClass'], mut['method'], str(mut['mutationStart']), str(mut['mut... |
from problem1 import *
import numpy as np
import sys
from sklearn.datasets import make_classification
'''
Unit test 1:
This file includes unit tests for problem1.py.
You could test the correctness of your code by typing `nosetests -v test1.py` in the terminal.
'''
#-----------------------------------------... |
#!/usr/bin/env python
# ClusterShell.Gateway test suite
import logging
import os
import re
import unittest
import xml.sax
from ClusterShell import __version__
from ClusterShell.Communication import ConfigurationMessage, ControlMessage, \
StdOutMessage, StdErrMessage, RetcodeMessage, ACKMessage, ErrorMessage, \
... |
#!/usr/bin/env python
# coding: utf-8
import argparse
import pickle
from multiprocessing import Pool
from pathlib import Path
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from tqdm import tqdm
sns.set_theme("paper", "white")
df_users = pd.read_... |
# import the necessary packages
from multiprocessing import Process
from multiprocessing import Queue
import os
import threading
import argparse
import time
import logging
import cv2
import json
import db
from classifier import Detection
from flask import Flask, render_template, Response, request, redirect, jsonify,... |
import numpy as np
import pandas as pd
import os
import sys
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import scipy
import json
from scipy.cluster import hierarchy
import seaborn as sns
from functools import reduce
import matplotlib.patches as patches
import warnings
# Create a nest... |
import numpy as np
import tensorflow as tf
from gym.spaces import Box, Discrete
from safe_rl.pg.utils import combined_shape, EPS
from nnv_py import DNN, Asterism, halfspace_gaussian_cdfs
"""
Network utils
"""
STEP_TIME_LIMIT = 10000
def placeholder(dim=None):
return tf.placeholder(dtype=tf.float32, shape=combine... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
"""
Copyright 2017-2018 Fizyr (https://fizyr.com)
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 w... |
import numpy as np
from numpy.random import default_rng
def random_normal_data(tr_no, voxel_no):
"""
Helper function generating random standard normal data with given TR and voxel numbers.
Output is a 2D numpy ndarray with shape (tr_no, voxel_no)
"""
mu, sigma = 0, 1
data = default_rng().norm... |
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, ARM Limited and 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
#
# ... |
import json
import textwrap
import typing as t
from collections import defaultdict
from contextlib import suppress
from discord import Color, Embed, Member, TextChannel, Forbidden
from discord.errors import HTTPException
from discord.ext.commands import Cog, ColourConverter, Context, group
from bot.core.bot import Bo... |
from __future__ import annotations
from typing import Tuple, List, Dict, Any, TYPE_CHECKING
import numpy as np
from cpylog import properties as log_properties
from pyNastran.bdf.cards.elements.shell import ShellElement
if TYPE_CHECKING: # pragma: no cover
from pyNastran.bdf.bdf import BDF
def get_shell_material_... |
"""
Test JobQ
"""
import os, unittest
import six
from six.moves import range
from hubstorage.jobq import DuplicateJobError
from hubstorage.utils import apipoll
from .hstestcase import HSTestCase
EXCLUSIVE = os.environ.get('EXCLUSIVE_STORAGE')
class JobqTest(HSTestCase):
def test_push(self):
jobq = self... |
# Copyright 2014 Big Switch Networks, Inc.
# 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... |
"""
This module provides PKCS#11 integration for pyHanko, by providing a wrapper
for `python-pkcs11 <https://github.com/danni/python-pkcs11>`_ that can be
seamlessly plugged into a :class:`~.signers.PdfSigner`.
"""
import asyncio
import binascii
import logging
from typing import Optional, Set
from asn1crypto import x5... |
# ew2vm.py Copyright (c) 2021 <NAME>
# https://github.com/mikenor/ew2vm
#
# MIT License
#
# 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 t... |
"""
python train_RAP.py -m GoogLeNet -b 64 -g 1 -w ../models/imagenet_models/GoogLeNet_RAP
python train_RAP.py -m GoogLeNet -c 51 -b 64 -g 1 -w ../models/imagenet_models/GoogLeNet_RAP
python train_RAP.py -m GoogLeNet -c 51 -b 32 -g 0 -w ../models/imagenet_models/GoogLeNet_RAP
python train_RAP.py -m GoogLeNet -c 51 -b 3... |
#!/usr/bin/env python3
# coding=utf-8
import argparse
import glob
import os
import random
import math
from datetime import datetime
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
import torchvision.utils as vutils
import numpy as np
import vgg_m_face_bn_dag... |
''' train_fns.py
Functions for the main loop of training different conditional image models
'''
import os
from itertools import repeat
import torch
import torch.nn as nn
import torchvision
import torch.nn.functional as F
import utils
import losses
from plot_inter_activation import plot_channel_activation
# Dummy tr... |
#!/usr/bin/env python3
#
# Copyright (c) 2020 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
"""
Dictionary-based Logging Database Generator
This takes the built Zephyr ELF binary and produces a JSON database
file for dictionary-based logging. This database is used together
with the parser to decode binary... |
"""
Implements endpoints which are required by the Json plugin for Grafana.
"""
import asyncio
import json
import logging
from datetime import datetime
from http import HTTPStatus
from io import BytesIO
from typing import Dict, List, Optional
import numpy as np
import pandas as pd
from azure.core.exceptions import Res... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
#!/usr/bin/python
# -*- coding: utf-8 -*-###
# Copyright (2018) Hewlett Packard Enterprise Development LP
#
# 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/LI... |
"""
This file contains functions used by both calc_emp_ds.py and calculate_emp_flt.py
"""
import os
import time
import multiprocessing as mp
import numpy as np
import pandas as pd
from empirical.util import empirical_factory, classdef
from empirical.util.classdef import Site, Fault
from qcore import formats
from gmha... |
# File: main.py
# File Created: Tuesday, 7th July 2020 9:43:48 am
# Author: <NAME> (<EMAIL>)
"""
Finite difference solver for wave equation
"""
import abc
import json
import os
from argparse import ArgumentParser
from collections import namedtuple
from time import time
from celluloid import Camera
im... |
# Copyright (c) Hikvision Research Institute. All rights reserved.
import math
import cv2
import numpy as np
from numpy import random
import mmcv
from mmdet.datasets.pipelines import Resize as MMDetResize
from mmdet.datasets.pipelines import RandomFlip as MMDetRandomFlip
from mmdet.datasets.pipelines import RandomCrop... |
# -*- encoding: utf-8 -*-
# @Author: <NAME>
# @Time: 2021/08/29 11:11:07
# @File: rnn_decoder.py
import torch
from torch import nn
from mwptoolkit.module.Attention.seq_attention import SeqAttention,Attention,MaskedRelevantScore
from mwptoolkit.module.Layer.layers import Transformer
from mwptoolkit.module.Environment... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.