text stringlengths 6.04k 39.5k |
|---|
import numpy as np
import operator
import argparse
from pathlib import Path
from scipy.io.wavfile import read as wavread
from scipy.io.wavfile import write as wavwrite
from scipy import signal
from world import main as world_main
from cut_vocoder import cut_speech
song_dict = {}
NOTE_DICT = {
"A0": 27.5,
"B... |
# -*- mode: Python; indent-tabs-mode: t; tab-width: 4 -*-
# vim: noet:ci:pi:sts=0:sw=4:ts=4
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# author: <NAME>
# date: 2019.5.3
# ver2.0
import os
from os import listdir
from os.path import isfile, join
import sqlite3
import sys, getopt
import re
import math
import st... |
""" write to a SQLite database with forms, templates
add new record, delete a record, edit/update a record
"""
from flask import Flask, render_template, request, flash, send_file, make_response, jsonify, abort, session, redirect, url_for
from flask_sqlalchemy import SQLAlchemy
from flask_bootstrap import Boots... |
'''
Use PyInstaller to bundle the python code into a standalone executable.
While it is unclear on how to use PyInstaller directly as a python
package, a specifications file can be generated here, and pyinstaller
called as a subprocess to run the compilation, and then the
expected output folders checked for files and ... |
import os
import sys
import argparse
import yaml
import time
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.optim as optim
import torchlight
from torchlight import str2bool
from torchlight import DictAction
from torchlight im... |
import cv2
import torch
import torchvision.transforms as transforms
import _init_paths
# changed from utils to utilities cause of yolo
from utillities.transforms import *
import numpy as np
import ipdb;pdb=ipdb.set_trace
joint_pairs = [[0, 1], [1, 3], [0, 2], [2, 4],
[5, 6], [5, 7], [7, 9], [6, 8], [8,... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 Zadara Storage, Inc.
# Copyright (c) 2012 OpenStack LLC.
# 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... |
import matplotlib
from matplotlib import pyplot as plt
import numpy as np
import pywt
from scipy.ndimage import uniform_filter
from scipy import ndimage as ndi
from skimage.feature import match_descriptors, ORB
from skimage.feature import hog, daisy, CENSURE
from skimage import color, exposure, transform
from skimage.t... |
import abc
import inspect
import logging
import os
import pathlib
from dataclasses import dataclass, field
from typing import List, Union, Type, Optional, Any
import apischema
import jsonpickle
import jsonpickle.ext.numpy as jsonpickle_numpy
import numpy as np
import pandas as pd
import sklearn
from apischema import d... |
#!/usr/bin/python3
import numpy as np
a = "a"
d = "d"
def word_indices(vec):
"""
Turn a document vector of size vocab_size to a sequence
of word indices. The word indices are between 0 and
vocab_size-1. The sequence length is equal to the document length.
"""
for index in vec.nonzero()[0]: # ... |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance ... |
from typing import List
import math
import torch
from torch import nn
import torch.nn.functional as F
from longformer.diagonaled_mm_tvm import diagonaled_mm as diagonaled_mm_tvm, mask_invalid_locations
from transformers.modeling_roberta import RobertaConfig, RobertaModel, RobertaForMaskedLM
class Longformer(RobertaMo... |
'''
This file contains module for tweets related capability only
Capabilities:
Fetch tweets and retweets by ID
Search tweets by search query
'''
'''
Built-in modules
'''
import pdb
import os
import traceback
import urllib.parse
import time
from datetime import datetime, timedelta
import json
import time
import a... |
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.nn.functional as F
from tensorboardX import SummaryWriter
import time
import os
import json
from torch.nn.parallel import DistributedDataParallel
from torchvision import transforms
from dataset.video_dataset import VideoRGBTrainDataset_... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division
from io import open
import unicodedata
import string
import re
import random
import time
import math
import matplotlib.pyplot as plt
plt.switch_backend('Agg')
import matplotlib.ticker as ticker
import numpy as np
import pandas as... |
import json
from django.contrib.auth.forms import AuthenticationForm
# from django.core.urlresolvers import reverse
from django.urls import reverse
from django.core.mail import EmailMessage
from ecommerce.utils import render_to_pdf
from django.views.generic.base import View
from django.conf import settings
from django.... |
# -*- coding: utf-8 -*-
import pygame, sys, random
from pygame.locals import *
import os
import pygame_textinput
pos_x = 100
pos_y = 100
os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (pos_x,pos_y) #设置窗口起始位置
pygame.init()
FPS = 500
fpsClock = pygame.time.Clock()
#设置颜色
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED ... |
import numpy as np
import math
import time
import datetime
from array import *
def initPyPref(prefs):
prefs['series']= array('i', [1])
prefs['sN'] = len(prefs['series'])
prefs['numberDigit'] = 6
prefs['NumWF1'] = 10; # Number of frames for the initial beam profile (white field)
prefs['NumPro... |
from PIL import Image, ImageDraw
from joblib import Parallel, delayed
import errno, os
import random
from collections import Counter
from math import pi, sin, tan, cos, radians
import json
distractor_count = 6
sample_count = 100
draw_att_map = False
image_width = 256
n_grid = 2 # n_grid on a side
max_n_obj_in_grid = ... |
# Copyright 2020 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 ... |
import math
import csv
class CNNParams:
def __init__(self, hyperparam_dict, conv_layers,
fully_connected_layers, transition_layer, side_info_layer,
param_file_line_number):
"""
Order:
learning_rate - float
layer_list - list
... |
from helpers.sett.strategy_registry import strategy_name_to_artifact
import json
import decouple
from brownie import *
from dotmap import DotMap
from scripts.systems.gnosis_safe_system import connect_gnosis_safe
from scripts.systems.uniswap_system import UniswapSystem
from helpers.proxy_utils import deploy_proxy, depl... |
#coding=utf-8
import tushare as ts
import pandas as pd
import CSZLUtils
import os
import random
import time
#装饰器用于catch 错误和计算函数执行时间
def decorator_catch_exception(origin_func):
def wrapper(*args, **kwargs):
try:
start = time.time()
print('function name :%s' % origin_func.__name__)
... |
import html
from datetime import date
from string import punctuation
from bs4 import BeautifulSoup
from django.core import serializers
from django.db.models import Prefetch
from django.http import HttpResponse
from django.shortcuts import render
from django.templatetags.static import static
from django.urls import rev... |
#IMPORTS.......................................................................
import pandas as pd
from numpy import log2 as log
from sklearn.metrics import confusion_matrix
import seaborn as sns
import os # accessing directory structure
import numpy as np
import matplotlib.pyplot as plt
import random
e... |
# ---------------------------------------------------------------------
# Network Segment
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules
... |
"""
fs.watch
========
Change notification support for FS.
This module defines a standard interface for FS subclasses that support change
notification callbacks. It also offers some WrapFS subclasses that can
simulate such an ability on top of an ordinary FS object.
An FS object that wants to be "watchable" must pr... |
# 未加入平仄规则
import random
import sys
import os
import numpy as np
from tensorflow import keras
# import plaidml.keras
# plaidml.keras.install_backend()
# import os
# os.environ["KERAS_BACKEND"] = "plaidml.keras.backend"
# import keras
import warnings
warnings.filterwarnings('ignore')
class Config_5(object):
poetry... |
from .constants import Enum
import xml.etree.ElementTree as ET
import re
CXX2RUST = {
'double': 'c_double',
'int': 'c_int',
'long': 'c_long',
'size_t': 'usize',
'wxByte': 'c_uchar',
'wxCoord': 'c_int',
'wxEllipsizeMode': 'c_int',
'wxItemKind': 'c_int',
'wxLayoutDirection': 'c_int',... |
# -*- coding: utf-8 -*-
"""
Created on June 20th 13:49 2019
@author: <NAME>
The difference between Prescripted_behaviour.py and this file is that in this file, we use TIME in the SIMULATOR
instead of the time in python.
"""
import time
import numpy as np
import math
class Node:
def __init__(self, sma_num, led_... |
"""
Extract client information from http user agent
The module does not try to detect all capabilities of browser in current form (it can easily be extended though).
Tries to
* be fast
* very easy to extend
* reliable enough for practical purposes
* assist python web apps to detect clients.
"""
__versi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Consensus tools
Contains functions that compute consensus sequences in small windows accross a given connected component (contig),
and then functions that merge together those consensus sequences to get a full contig-long consensus sequence.
The consensus sequences a... |
import math,sys
def calculatePurchaseReturn(S,R,F,E):
if F== 100:
return S*E/R
return S * ( math.pow(1.0 + float(E)/float(R), float(F)/100.0) - 1.0 )
def calculateSaleReturn(S,R,F,T):
"""
E = R(1 - ((1 - T / S) ^ (1 / F))
"""
if (T > S):
return 0
if F == 100:
... |
# #############################################################################
# func.py
# =======
# Author : <NAME> [<EMAIL>]
# #############################################################################
"""
1D functions not available in `SciPy <https://www.scipy.org/>`_.
"""
import warnings
import numpy as np
i... |
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__copyright__ = "2019, TU Wien, Department of Geodesy and Geoinformation"
__license__ = "mit"
"""
Contains an interface for opening QA4SM output files (*.nc),
loading certain parts as pandas.DataFrame
and producing plots using the dfplot module in this package.
namin... |
"""
A prototype demonstrating how we'd build a forward simulator that
outputs a tskit tree sequence but that doesn't use tskit's data structures
internally.
This version basically reproduces (but slightly simplifies) the approach
taken in tskit, where we periodically simplify.
"""
import random
import collections
impo... |
import dash
from dash import dcc
import dash_bootstrap_components as dbc
from dash import html
from dash.dependencies import Input, Output, State
import visdcc
import pandas as pd
import time
import sys
import json
import collections
import csv
import datetime
import requests
import os
import logging
logging.basicCon... |
import threading
import pygame
from baopig.pybao.objectutilities import TypedList
from .widget import debug_with_assert
from .layer import Layer
# TODO : many widgets in one cell ?
class Cell:
def __init__(self, grid, row_index, col_index):
self._grid = grid
self._col_index = col_index
... |
import configparser
import collections
import functools
import inspect
import os
import subprocess
import sys
import traceback
import django
from django.core.management import call_command
from django.core.management.color import supports_color
import pkg_resources
from .app import App
from .paths import FileSet
cl... |
# -*- coding: cp1252 -*-
#!/usr/bin/python
#Calculate distance and gravity/contour PT Accessibility
#Marcus September 2015; new Version December 2021
#Python 2.7.5
import arcpy
from datetime import date
import gc
import h5py
import numpy as np
import pandas
import time
import win32com.client.dynamic
start_time = time.... |
# vim: expandtab:ts=4:sw=4
import string
import os
import threading
import numpy as np
import tensorflow as tf
# import tensorflow
# import tensorflow.compat.v1 as tf
# tf.disable_eager_execution()
# tf.disable_v2_behavior()
# import tf_slim as slim
import tensorflow.contrib.slim as slim
def run_in_batches(f, data... |
import argparse
import string
from nltk.corpus import stopwords
from nltk.util import ngrams
from nltk.lm import NgramCounter
from sklearn.feature_extraction.text import CountVectorizer
import pandas as pd
import numpy as np
from tqdm import tqdm
import os, pickle, warnings
from multiprocessing import Pool
from itertoo... |
import pytest
import socket
from amqp import RecoverableConnectionError
from unittest.mock import Mock, patch
from case import ContextMock
from kombu import common
from kombu.common import (
Broadcast, maybe_declare,
send_reply, collect_replies,
declaration_cached, ignore_errors,
QoS, PREFETCH_COUNT_M... |
"""Tests for `pypesto.prediction.AmiciPredictor`."""
import os
import shutil
import sys
import amici
import libsbml
import numpy as np
import pandas as pd
import petab
import pytest
import pypesto
import pypesto.ensemble
import pypesto.petab
from pypesto.predict import AmiciPredictor
from pypesto.result import Predi... |
"""
Code to study groups of cells that activate together
"""
from tqdm.auto import tqdm as pbar
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from tctx.analysis import simbatch as sb
from tctx.util import spike_trains as spt, plot
from kmodes.kmodes import KModes
class Amat:
"""
... |
import functools
from os.path import join
import h5py
import numpy as np
import torch
import torch.nn as nn
from tomogram_utils.coordinates_toolbox.subtomos import get_coord_from_name, \
get_subtomo_corners, read_subtomo_names, get_subtomo_corner_and_side_lengths
from tomogram_utils.coordinates_toolbox.subtomos i... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""command shell for mini-project-1"""
import cmd
import sqlite3
from getpass import getpass
from logging import getLogger
import pendulum
from mini_project_1.book_member import get_book_member_parser, book_member
from mini_project_1.cancel_booking import get_cancel_booking... |
import logging
import time
import datetime
from django.utils import timezone
from django.db import transaction
from validr import T, asdict, modelclass, fields
from rssant_common.detail import Detail
from rssant_common.validator import compiler
from rssant_config import CONFIG
from .story import Story, StoryDetailSch... |
import sys
from machine import Pin,I2C,Timer,SPI,UART
import uctypes
import ustruct
import utime
##### REGISTER MAP #####
##### imu ####
ACCEL_CONFIG = 0x1C
ACCEL_CONFIG2 = 0x1D
GYRO_CONFIG = 0x1B
GYRO_CONFIG2 = 0x1A
SELF_TEST_X_ACCEL = 0x0D
SELF_TEST_Y_ACCEL = 0x0E
SELF_TEST_Z_ACCEL = 0x0F
SELF_T... |
"""
.. module:: CalibrationTools
:synopsis: Contains functions for generating calibration products applicable
at the image level, mostly when operating directly on the photon lists
(not the db), including exposure time and relative response. Not really
used elsewhere at present but possibly usef... |
import os
import numpy as np
import pandas as pd
import pickle
import matplotlib.pyplot as plt
from dtw import dtw
from scipy.cluster.hierarchy import dendrogram, linkage
from skimage.transform import resize
from scipy.spatial.distance import euclidean, cosine, sqeuclidean, cityblock, chebyshev
import cv2
from dtw i... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 17 11:09:30 2013
@author: <EMAIL>
@author: <EMAIL>
@author: <EMAIL>
"""
import os
import shutil
import multiprocessing
import tempfile
import numpy as np
import sys
import socket
from abc import ABCMeta, abstractmethod
from epac import StoreFs
from epac.errors import N... |
from ctypes import *
import math
import random
import os
import cv2
import numpy as np
import time
import darknet
import csv
import time
import matplotlib.pyplot as plt
import matplotlib.animation as animation
#plt.ion()
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
from sort import *
tracker = Sort()
memory = {}
counter = 0... |
#!/usr/bin/env python
import os
import sys
import argparse
import logging
import gzip
from pycellbase.cbclient import ConfigClient
from pycellbase.cbclient import CellBaseClient
_DEFAULT_HOST = 'bioinfo.hpc.cam.ac.uk:80/cellbase'
_DEFAULT_API_VERSION = 'v4'
_DEFAULT_SPECIES = 'hsapiens'
_DEFAULT_ASSEMBLY = 'GRCh38'
#... |
# -*- coding: utf-8 -*-
import logging
from os.path import split, splitext, join, exists, realpath
import datetime
import distutils
import utool as ut
(print, rrr, profile) = ut.inject2(__name__)
logger = logging.getLogger('wbia')
VERBOSE_SQL = ut.get_argflag(('--print-sql', '--verbose-sql', '--verb-sql', '--verbsql'... |
from abstract.semantics import Attribute
from abstract.semantics import Type as SemanticType
from cil.nodes import TypeNode
from cil.nodes import CilNode, FunctionNode
from mips import load_store
from mips.arithmetic import ADDU, SUBU
from mips.branch import JAL, JALR
import mips.instruction as instrNodes
import mips.a... |
#!/usr/bin/env python
# coding: utf-8
"""
Implementation of Deep Deterministic Policy Gradients (DDPG) network
using PyTorch.
See https://arxiv.org/abs/1509.02971 for algorithm details.
@author: <NAME> 2020 (<EMAIL>)
Project for CityLearn Competition.
Based on code from Mike Richardson (https://github.com/xkiwila... |
#!/usr/bin/env python
#
# Copyright 2013 cloudysunny14.
#
# 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... |
from __future__ import annotations
from abc import ABC
from typing import Any, Dict, List, Tuple, cast
from dataclasses import dataclass, field
import string
from copy import deepcopy
from enum import Enum
import re
import uuid
from .ModelBase import StrokeDefinition, TextEffects, FillType, rgb, BaseElement
import n... |
"""
Support for BSH Home Connect appliances.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/homeconnect/
"""
import logging
import voluptuous as vol
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.discovery import ... |
import re,time
import matplotlib.pyplot as plt, numpy as np, pandas as pd
def dosyadanOkuyorum(dosyaAdi):
dosyadanOkuma = time.time()
with open(dosyaAdi) as flowDosya:
flowHam = flowDosya.read()
dosyaOkurken = time.time() - dosyadanOkuma
print ('Dosyayı okurken geçen süre : ', str(dosyaOkurken)... |
from flask import jsonify
import pandas as pd
import random
import requests
import json
import numpy as np
import scipy.sparse.linalg as linalg
from sklearn.cluster import KMeans, AgglomerativeClustering
from sklearn.neighbors.kde import KernelDensity
from food_app.to_html import to_table, to_lists, to_list_of_lists
d... |
from __future__ import absolute_import, print_function
import logging, string
from sage.all import QQ, lcm, gcd, vector, prod, cartesian_product
from . import (
extremal_edges,
StabilizerGroup,
external_tensor_product,
c_candidates,
length_tuples,
antishuffles,
perm_action,
ressayre_test... |
import datetime
from django.conf import settings
from django.test.utils import override_settings
from dateutil.tz import tzutc
from mock import patch
from nose.tools import eq_, ok_
import mkt.site.tests
from mkt.site.fixtures import fixture
from mkt.site.middleware import lang_from_accept_header
from mkt.users.mode... |
import argparse
import os
import random
import shutil
import time
import warnings
import sys
import numpy as np
from datetime import datetime
from collections import OrderedDict
import pickle
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as di... |
import tensorflow.contrib.layers as layers
import sys
import copy,random
import inspect, os
sys.path.append('../')
os.environ['DATASETS_FOLDER'] = '../'
os.environ['EXPERIMENTS_FOLDER'] = '../'
from test_script.script_helper import *
import sklearn
from sklearn.metrics import f1_score
import boml as boml
import numpy ... |
import wandb
import numpy as np
import pickle
import math
from typing import Tuple
from math import sqrt, log, log2, exp, isclose
from config import ExperimentType, early_batches, params
api = wandb.Api()
project_names = ["rgm", "rgm_early_batches", "rgm_dropout"]
bad_runs = [(5, 0.3, 17), (5, 0.2, 17), (5, 0.4, 43)]
... |
import nate
from graph_tool.all import *
import matplotlib
import pandas as pd
import numpy as np
from collections import defaultdict
from numpy.random import *
import sys, os, os.path
import time
import datetime
from gi.repository import Gtk, Gdk, GdkPixbuf, GObject, GLib
from PIL import Image, ImageDraw, ImageFont
fr... |
#!/usr/bin/env python
# Image Alignment
# Takes in an image and AAM facial landmarks (68-pt model, provided with CK+)
# and aligns eyes and reformats image so that faces are aligned
import math
import cv
import cv2
import glob
import os
import numpy as np
from skimage.feature import local_binary_pattern
from PIL impor... |
import os
from datetime import datetime, timedelta
import netCDF4 as nc
import numpy as np
import statsmodels.api as sm
from osgeo import gdal, ogr, osr
from scipy import ndimage
from scipy.interpolate import interp1d
from statsmodels.tsa.seasonal import seasonal_decompose
from hyp3lib import GeometryError
from hyp3l... |
# sometimes the standard random is overwritten by numpy.random
# so random is renamed as std_random here
import numpy as np
from warp import *
import random as std_random
from scipy.constants import k, m_e
class ParticleReflector:
"""Class that handles particle reflection.
To use:
To define a particle... |
from __future__ import division
import numpy as np
import matplotlib.pyplot as pyplot
from matplotlib.pyplot import cm
import yoda
import os
import glob
from matplotlib import gridspec
from scipy.special import factorial
from scipy.special import gamma as gammafunc
from scipy.optimize import fmin
from scipy.optimize i... |
#!/usr/bin/env python
"""
Southern California Earthquake Center Broadband Platform
Copyright 2010-2016 Southern California Earthquake Center
Utilities converting PEER seismograms into bbp format, and bbp
into PEER format. Designed specifically for use on SCEC
validation study that needs to convert 6 header line PEER-... |
#! /usr/bin/python3
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
# Add functions more or less alphabetically
"""
.. _conf_00_lib_pdu:
Configuration API for PDUs and other power switching equipment
--------------------------------------------------------------
"""
import logging
i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ======================================================================
# AMBIANCE -- A full implementation of the ICAO standard atmosphere 1993
#
# Copyright 2019-2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this f... |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 <NAME>
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from . import base
import log
from xml.etree import cElementTree as ET
import copy
import logging
#TODO support item groups and results
log = logging.getLog... |
######################################
#######realsense plotting#############
######################################
'''
Working with
UBUNTU 16.04 LTS
OPENCV 4.0~
Python 3.6
pyrealsense2
matplotlib
numpy
for intel D435i
font
'''
import pyrealsense2 as rs
import numpy as np
import cv2
import ma... |
import collections
import gc
import sys
import os
from sklearn import clone, datasets
from sklearn.cluster import k_means, KMeans
from sklearn.datasets import make_circles, make_moons, make_blobs, make_classification, load_digits
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
fr... |
#!/usr/bin/env python
import numpy as np
import pandas as pd
from matplotlib import pyplot as pl
from mpl_toolkits.axes_grid1 import Grid
import glob
def load_performance_log(filename, skiprows=1):
raw = np.loadtxt(filename, skiprows=skiprows)
if len(raw) == 0:
raise Exception(filename + " has no entr... |
import os
import base64
import math
from typing import Callable
import cv2
import numpy as np
from scipy.ndimage.filters import gaussian_filter
class PadDownRight:
"""
Get padding images.
Args:
stride(int): Stride for calculate pad value for edges.
padValue(int): Initialization for new a... |
import types
from functools import wraps, partial
from django.conf import settings
from django.db import models
from django.db.models import Sum, Avg, Q
from django.db.models.fields.files import FieldFile
from django.db.models.signals import (
pre_save, post_save, post_delete, post_init, m2m_changed, Signal)
from... |
import os
import sys
sys.path.insert(0, '../../')
import time
import glob
import random
import numpy as np
import torch
import shutil
import nasbench201.utils as ig_utils
import logging
import argparse
import torch.nn as nn
import torch.utils
import torchvision.datasets as dset
import torch.backends.cudnn as cudnn
fro... |
#!/usr/bin/env python
import sys
import os
import logging
import numpy as np
import subprocess
from time import time
from matplotlib import pyplot as plt
from biseqt.blot import WordBlotLocalRef
from biseqt.sequence import Alphabet
from biseqt.stochastics import rand_seq, MutationProcess
from util import plot_with_sd... |
"""Tests for moog/physics/collisions.py.
To run this test, navigate to this directory and run
```bash
$ pytest test_collisions.py --capture=tee-sys
```
Note: The --capture=tee-sys routes print statements to stdout, which is useful
for debugging.
Alternatively, to run this test and any others, navigate to any parent ... |
"""Functions to store GRAFIMO analysis results.
The results are stored in three different files:
* TSV file report, table of results, containing for each retrieved motif
occurrence candidates the analysis informations, like log-odds score,
corresponding P-value and q-value, frequency in genome variation
... |
# 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... |
import deterministic_network
from collections import namedtuple, defaultdict
Proposal = namedtuple('Proposal', ['caller', 'cid', 'input'])
Ballot = namedtuple('Ballot', ['n', 'leader'])
ScoutId = namedtuple('ScoutId', ['address', 'ballot_num'])
CommanderId = namedtuple('CommanderId', ['address', 'slot', 'proposal'])
... |
import libsbml
import urllib
from os import replace
from biosimulators_utils.utils.identifiers_org import validate_identifiers_org_uri
def fixNanoMolar(file):
doc = libsbml.readSBMLFromFile(file)
model = doc.getModel()
for s in range(model.getNumSpecies()):
species = model.getSpecies(s)
if ... |
"""Objectron dataset parser module.
This module contains dataset parsers used to load the HDF5 archive of the Objectron dataset.
See https://github.com/google-research-datasets/Objectron for more info.
"""
import collections
import os
import typing
import time
import cv2 as cv
import h5py
import numpy as np
import p... |
import os
import io
import sys
import re
import pathlib
from plumbum import cli
from plumbum.cmd import rm
import json
import yaml
import logging
log = logging.getLogger()
deviceIds = [
"P2888",
"P2888-0060",
"P3310",
"P3489-0000",
"P3489-0080",
"P2180",
"P3448-0000",
"P3448-0020"
]
ig... |
#!/usr/bin/env python3
"""
Automate building and publishing helm charts and associated images.
This is used as part of the JupyterHub and Binder projects.
"""
"""
BSD 3-Clause License
Copyright (c) 2018, Project Jupyter Contributors
All rights reserved.
Redistribution and use in source and binary forms, with or wit... |
import asyncio
import discord
from discord.ext import commands
import ffmpeg
import media_cache
import os
import random
import re
import subprocess
from subprocess import Popen
import textwrap
import video_creator
import youtube_dl
class Fun(commands.Cog):
def __init__(self, bot):
self.bot = bot
se... |
# Scenario reporting.
#
# Implementation notes:
#
# The core design pattern uses dask graphs; see
# http://docs.dask.org/en/latest/spec.html
# - Reporter.graph is a dictionary where:
# - keys are strings or ixmp.reporting.key.Key objects (which compare/hash
# equal to their str() representation), and
# - values... |
#!/usr/bin/env python3
import re
import warnings
from pathlib import Path
from multiprocessing import Pool
from dataclasses import dataclass
import cchardet
import pandas as pd
from pandas import IndexSlice as idx
from ost_parser import OST_ROOT
from ost_parser.vci import (VCI, BaseBand, SubBand)
KNOWN_INVALID = [... |
# Copyright 2019 The Feast Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
#!/usr/bin/env python3
from __future__ import annotations
import glob
import os
import platform
import re
import sys
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Set, Tuple, Union
from cffi import FFI # type: ignore
sys.path.append(str(Path(__file__).parent)) # Allow importing l... |
# This program fits a 3 layer Deep Neural Network to the data produced by the
# solver.
'''
In lines 21 - 46 you will find my custom classes, craeted to raise some
error messages.
In lines 47 - 547 you will find my custom functions, used to speed up the
program and free some memory.
From line 54... |
# pylint: disable=broad-except, wrong-import-order
"""
Various utilities for Annalist common functions
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
__author__ = "<NAME> (<EMAIL>)"
__copyright__ = "Copyright 2014, <NAME>"
__license__ = "MIT (h... |
#!/usr/bin/env python
# +-----+ +----+
# +-+ SEE +-+ +-+ CE +--+
# | +-----+ | | +----+ |
# Ft+----+ +---+ +--+Ft
# | +-----+ | | +-----+ |
# +-+ SDE +-+ +-+ PEE +-+
# +-----+ +-----+
"""
If you are looking at this becaus... |
#!/usr/bin/env python
#
# Copyright Xilinx Inc. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
# This program gathers and summarizes peer statistics for a Fabric benchmark/experiment.
#
# Run this utility as:
# ./process_stats.py -m combinestats-perpeer
import argparse
from datetime import datetime
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.