text stringlengths 6.04k 39.5k |
|---|
from collections import namedtuple
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
def post_process_context(token_ids, reader, merge=True):
"""Post-process the context sequence."""
context = []
utt = []
for tok_id in token_ids[1:]:
if tok_id == reader.eos_id:
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Code for the article "Monte Carlo Methods for the Neutron Transport Equation.
By <NAME>, <NAME>, <NAME>, <NAME>.
Thi sfile contains the code to produce the plots in the case of the 2D version
of the NTE.
MIT License
Copyright (c) <NAME>, 2020.
Permission is hereby... |
#!/usr/bin/env python
#------------------------------
"""
DEPRICATED: LEGACY OF LCLS1 BUT STILL SHOULD WORK
class :py:class:`CalibFileFinder` is a python version of CalibFileFinder.cpp - finds calibration file
=====================================================================================================
Usage... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 6 14:13:56 2018
@author: <NAME>
"""
from sklearn.base import BaseEstimator, TransformerMixin
import pandas as pd
import numpy as np
try:
import category_encoders
except ImportError:
category_encoders = None
from collections import defaultdict
from aikit.enum... |
#!/usr/bin/env python3
"""
Created: March 10th, 2020
@author: <NAME>
PlotDecomposition works with matrix formats SigProfiler SBS-96, SBS-1536, DBS-78,
and ID-83. This program is intended to take two matrices.
(1) Sample matrix - A SigProfiler formatted SBS-96, SBS-1536, DBS-78, or ID-83
matrix.
(2) Basis matrix - A ... |
#!/usr/bin/env python
# coding=utf-8
"""This is part of [pyspaces](https://github.com/Friz-zy/pyspaces)
License: MIT or BSD or Apache 2.0
Copyright (c) 2014 <NAME> aka Frizzy <<EMAIL>>
"""
import os
import sys
from .setns import setns
from . import cloning as cl
if sys.version_info >= (3,0):
from inspect import... |
import time
import hid
# from the C driver
# http://ww1.microchip.com/downloads/en/DeviceDoc/mcp2221_0_1.tar.gz
# others (???) determined during driver developement
# pylint: disable=bad-whitespace
RESP_ERR_NOERR = 0x00
RESP_ADDR_NACK = 0x25
RESP_READ_ERR = 0x7F
RESP_READ_COMPL ... |
#
# Copyright 2014 Infoxchange Australia
#
# 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (C) 2018-2020 University of Dundee. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public... |
# TODO: update the readme with new parameters
# TODO: restoring a model without recreating it (use constants / op names in the code?)
# TODO: move all the training parameters inside the training parser
# TODO: switch to https://www.tensorflow.org/api_docs/python/tf/nn/dynamic_rnn instead of buckets
from __future__ imp... |
#!/usr/bin/python3
"""
Canonicalize the C source
Transforms the ast into a simpler one using few node classes. etc.
This will simplify code generation.
The new ast can be re=emitted as working C code to test the correctness
of the transformations.
However, we play at little fast and loose with Sequence Points
(h... |
from functools import partial
import logging
from os.path import join, exists
from typing import List, Tuple
import transformers
import pandas as pd
from sklearn.model_selection import KFold, train_test_split
from sklearn.preprocessing import PowerTransformer, QuantileTransformer
from .tabular_torch_dataset import Tor... |
#!/usr/bin/python
import os, sys
import json
import numpy as np
import re
import copy
import collections
import itertools
### YOUR CODE HERE: write at least three functions which solve
### specific tasks by transforming the input x and returning the
### result. Name them according to the task ID as in the three
### ex... |
#
# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
import os
import stat
import pathlib
import json
import platform
import tempfile
import tarfile
import hash... |
# -*- coding: utf-8 -*-
"""Routines to solve for circumstances like sunrise, sunset, and moon phase."""
from __future__ import print_function, division
from numpy import (arange, argwhere, array, ceil, concatenate, cos, diff,
flatnonzero, linspace, multiply, pi, sign, zeros_like)
from scipy import ... |
import re
import yaml
import uuid
import subprocess
from subprocess import Popen, PIPE
from enum import Enum
from glob import glob
import openpyxl
from openpyxl import load_workbook
from openpyxl import Workbook
from openpyxl.utils import FORMULAE
# Helpful for debugging
import pprint as _pp
pp = _pp.PrettyPrinter(in... |
"""
python test.py -m ./weights/ --cfg_file
"""
from __future__ import print_function
import os
import argparse
import torch
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import numpy as np
from utils.anchor.prior_box import PriorBox
from utils.ops.nms.nms_wrapper import nms
import cv2
from utils... |
import os
import numpy as np
from tqdm import tqdm
import tensorflow as tf
epochs = 25
batch_size = 4
data_zh = "data/zh.tsv"
# 数据处理&读取数据
class DealData(object):
# 初始化
def __init__(self, filename=data_zh):
with open(filename, 'r', encoding='utf-8') as fout:
data = fout.readlines()[:100... |
import argparse
import os
import time
import h5py
import numpy as np
import pymesh
import trimesh
from joblib import Parallel, delayed
from scipy.interpolate import RegularGridInterpolator
import create_file_lst
CUR_PATH = os.path.dirname(os.path.realpath(__file__))
parser = argparse.ArgumentParser()
parser.add_arg... |
import argparse
import csv
import os
from typing import Dict, List, Tuple, Union
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from common.utils import pcc_aurora_reward
from simulator.network_simulator.constants import BITS_PER_BYTE, BYTES_PER_PACKET
from simulator.trace ... |
import numpy as np
import pandas as pd
import sys
from g2_death_signal_simulation import (run_heterotypic_model_2_exponential_test,
run_heterotypic_model_2_uniform_test)
from well_mixed_death_clock import normalised_g2_death_signal_heterotypic
def heterotypic_model_2_parameter_sweep(beta_As, tG_As, eta_As, c... |
from rest_framework import serializers
from olympia import amo
from olympia.accounts.serializers import BaseUserSerializer
from olympia.addons.models import (
Addon, AddonFeatureCompatibility, attach_tags, Persona, Preview)
from olympia.amo.templatetags.jinja_helpers import absolutify
from olympia.amo.urlresolvers... |
"""Black box predictor of probability of pedestrian in a vehicle's grid cell using a rules based agent"""
from copy import copy
import numpy as np
try: from ray.rllib.agents.agent import get_agent_class
except ImportError: from ray.rllib.agents.registry import get_agent_class
pp = 14516 / (107 + 14516)
pno = 107 / (... |
# Copyright 2018 Google LLC
#
# 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 writing, ... |
"""
Configuration related stuff
@note: Don't place code with gettext or dependencies to other wxGlade
parts here!
@see: L{preferencesdialog}
@copyright: 2007 <NAME>
@copyright: 2013-2016 <NAME>
@copyright: 2017-2018 <NAME>
@license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY
"""
import os, sy... |
"""
Translate the given datalog rules into sql query mapping info -
which can later be used to generate the corresponding sql queries
"""
import collections
from copy import deepcopy
def extract_comparison_map(body, body_atom_list):
""" Extract and store the information of comparison in the body
Args:
... |
# -*- coding: utf-8 -*-
from LoliBot import checks
import discord
import asyncio
import requests
import datetime
from html import unescape
from random import shuffle
from collections import OrderedDict
from discord.ext import commands
class Trivia:
"""
Trivia is based off the lovely https://opentdb.com made by Pix... |
import pytest
import collections
import os
# tag a parameter for full testing
def tag_full(value):
return pytest.param(value, marks=pytest.mark.full)
ADF_LIST = (
tag_full("amiga-os-100-workbench.adf"),
tag_full("amiga-os-110-workbench.adf"),
tag_full("amiga-os-120-workbench.adf"),
tag_full("ami... |
# QCA stands for qualitative causal agent whose task is to
# identify causal paths within
import json
import logging
import requests
import functools
import ndex2.client as nc
from enum import Enum
from bioagents import BioagentException
logger = logging.getLogger('QCA')
class PathNotFoundException(BioagentExcepti... |
# -*- coding: utf-8 -*-
import re
from tkinter.messagebox import showerror
from bs4 import BeautifulSoup
from torequests import Async, threads, tPool
from torequests.utils import Counts, Saver, countdown, find_one, md5, ttime
def refresh_proxy():
req = tPool()
r = req.get(
'https://ip.ihuan.me/today... |
"""
Mozilla Common Voice ASR dataset.
"""
__all__ = ['McvDataset', 'McvMetaInfo']
import os
import re
import numpy as np
import pandas as pd
from .dataset_metainfo import DatasetMetaInfo
from .asr_dataset import AsrDataset, asr_test_transform
class McvDataset(AsrDataset):
"""
Mozilla Common Voice datase... |
# -*- coding: utf-8 -*-
'''
script containing helper utility functions and classes
'''
import tqdm
import numpy as np
import torch
class ObservationBuffer:
'''
Helper class implementing a circular buffer that discards older observation (data) as newer
ones are added when buffer is full
'''
def __init__(self, size... |
# Copyright (c) 2020, eQualit.ie inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import json
import traceback
from datetime import timedelta, datetime
import math
from baskerville.models.base_spark import ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** <NAME>
**Copyright(c):** MakeHuman Team 2001-2019
**Licensing:** A... |
import argparse
import glob
import json
import os
import re
from difflib import SequenceMatcher
from pprint import pprint
from collections import defaultdict
from normalize import normalize, render
from latex_tokenizer import *
from align_eq_bb import tokens_to_string
NO_DESC = "<<NO_DESC>>"
NO_LATEX = "<<NO_LATEX>>"
... |
#!/usr/bin/python3 -i
#
# Copyright (c) 2021 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... |
"""
Copyright (c) 2019 The Cereja Project
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
#!/usr/bin/env python
import openmm
from openmm import unit
from openmm import app
from openmm.app.internal.unitcell import computePeriodicBoxVectors, computeLengthsAndAngles
import numpy as np
from scipy import optimize
from .utils import Logger
def parse_arguments():
"""
Parse command line arguments.
"... |
"""
This code is adapted from the matlab code "LP Bathymetry" by <NAME> (http://drobilica.irb.hr/~mathieu/Bathymetry/index.html).
For a description of the method, see
<NAME>, <NAME>, <NAME>, A new approach to bathymetry
smoothing in sigma-coordinate ocean models, Ocean Modelling 29 (2009)
128--136.
*** Some modificat... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy
import logging
import csv
import os
from skimage.feature import peak_local_max
from skimage.morphology import label, closing, disk, watershed
from skimage.measure import regionprops
from skimage.filters import gaussian
from skimage.restoration import denoise_... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Dell EMC OpenManage Ansible Modules
# Version 1.2
# Copyright (C) 2019 Dell Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# All rights reserved. Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidia... |
import io
import struct
import zlib
import itertools
import datetime
import copy
import os
from rft import RFT,BitCount
from decrypt import GZipStream, GetSettings, DecryptImage, GetEncrAlgos, DecrStream, TimeKey, EncrAlgos, DotNetGetByName, GetFiles
import gz_recover
class EncodedData:
def __init__(self, V):
... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 14 14:54:35 2013
Stores for EPAC
@author: <EMAIL>
"""
import os
import shutil
import sys
import joblib
import json
import inspect
import numpy as np
from abc import abstractmethod
from epac.configuration import conf
from epac.map_reduce.results import ResultSet
class T... |
#!/usr/bin/env python
"""
SHRDLURN - Community & Logging Server
# Instructions
You can run the server by running ```./server.py --port <PORT_NUMBER>```
"""
import json
import sys
import time
import os
import random
import eventlet
import glob
from optparse import OptionParser
from flask import Flask, request, sessi... |
# ----------------------------------------------------------------------------
# Copyright (C) 2017 Verizon. 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
#
# ... |
# Top-down RvNN implementation based on the model of Jing Ma et al.
# (https://github.com/majingCUHK/Rumor_RvNN ; state: 10.09.2019)
# to improve the results of the rumor verification accomplished by the CLEARumor approach by Ipek Baris et al.
# (https://github.com/Institute-Web-Science-and-Technologies/CLEARumor ; ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicab... |
# ---------------------------------------------------------
# dependencies
import pygame
import random
from itertools import cycle
from pygame.locals import *
# ---------------------------------------------------------
# module objects
__all__ = [
'gethitmask',
'FlappyBird',
'PLAYER_HEIGHT',
'PIPEGAPS... |
#!/usr/bin/env python
import atexit
import os
import sys
import socket
from queue import Queue
import argparse
import time
import threading
from m3_logging import get_logger
logger = get_logger(__name__)
logger.debug('Got m3_common.py logger')
from ice import ICE
# Do this after ICE since ICE prints a nice help i... |
from IP import *
from queue import Queue
from socket import socket, AF_INET, SOCK_STREAM, getfqdn
from threading import Thread, Lock
from time import time, sleep
from os import path, makedirs
from urllib.request import urlopen
from urllib.error import *
from bs4 import BeautifulSoup
import subprocess
prin... |
import requests
import urllib.request
from bs4 import BeautifulSoup
from urllib.error import HTTPError
from selenium import webdriver
import time
import json
import csv
import re
from math import ceil
cook='thw=cn; cna=h9/yEVZzcBsCAXrNB8OEFnAP; t=958b680ed770b65bab4bb2b433356b70; hng=CN%7Czh-CN%7CCNY%7C156;... |
import numpy as np
from astropy.io import fits
from astropy.table import Table
import os
from numba import jit, njit, prange
import argparse
import healpy as hp
from StructFunc import get_full_struct_manager
from Materials import PB, TA, SN, CU, CZT
from StructClasses import Swift_Structure_Shield, Swift_Structure, Sw... |
# (c) Copyright 2022 <NAME>
"""
Breakpoint tracking, set/disable, and single-step management.
Supports repl commands:
breakpoint create <addr> -- creates a new hardware (dynamic) breakpoint.
breakpoint list - list known breakpoints
breakpoint enable #n - enable breakpoint by id. If at a breakpo... |
# -*- coding: utf-8 -*-
from auth import *
import requests
import json
import hashlib
from itertools import product
import states
import trait
from collections.abc import Mapping
from config import (DOMOTICZ_GET_ALL_DEVICES_URL, U_NAME_DOMOTICZ, U_PASSWD_DOMOTICZ, DOMOTICZ_GET_SETTINGS_URL,
DOMOTICZ_G... |
# Ultroid - UserBot
# Copyright (C) 2021-2022 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.
import base64
import os
import random
import re
import string
from logg... |
import unittest
import os
import shutil
import sys
import math
import numpy as np
import matplotlib.pyplot as plt
import acpc_python_client as acpc
from tools.constants import Action
from weak_agents.action_tilted_agent import create_agent_strategy_from_trained_strategy, TiltType
from tools.io_util import read_strate... |
import os, sys
import os.path as osp
import numpy as np
import torch
import argparse
from datetime import datetime
import pickle as pkl
import shutil
import networkx as nx
import time
import utils
import matplotlib.pyplot as plt
from models import vcn, autoreg_base, factorised_base, bge_model
from data import erdos_re... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import os
import numpy as np
import pandas as pd
import logging
import pickle
import time
# In[ ]:
# Choose the model and customise only the full_pipeline,
# the model and param_grid in training.ipynb if needed
#MODEL_NAME = "DecisionTreeClassifier"
#MODEL_NAME = "... |
#!/usr/bin/env python3
import os
import kenl380.pylib as pylib
"""
The EncryptedVault class is configured to (hard-coded for now), to use things like:
local_dir = ~/vaults
dropbox_dir = ~/Dropbox/system/vaults
The caller just passes in the outer name, such as cv4gb, allowing the class to abstract
the local and remo... |
# covidpatientzero
####### VIRUS START #######
import io
from pathlib import Path
import hashlib
import base64
import random
import os
import sys
# change this value to define the path depth (all the directories in the current directory including the .. parent directory) to which files will be infected starting from ... |
# -*- encoding: utf-8 -*-
"""Slicer tool
For more information run: slicer --help
Author: <NAME> <<EMAIL>>
Date: 2011-01
"""
from __future__ import absolute_import
from __future__ import print_function
from .. import compat
import json
import argparse
import sys
import cubes
import os
from collections... |
# --*-- coding: utf-8 --*--
import argparse
import multiprocessing
from sklearn.utils import shuffle
import data_loader
import pandas as pd
import os
import numpy as np
from calc_scaffold_smilarity import process_one_protein, calc_scaffold_similarity
TASKS = ['CHEMBL1075104', 'CHEMBL1075126', 'CHEMBL1075167', 'CHEM... |
import csv
import os
from google_drive_downloader import GoogleDriveDownloader as gdd
def normalize_string(string):
replacements = (
("á", "a"),
("é", "e"),
("í", "i"),
("ó", "o"),
("ú", "u"),
("ñ", "n"),
)
for a, b in replacements:
string = string.... |
import collections.abc
import copy
import datetime
import logging
from typing import List, Dict, Tuple
import pytz
from dateutil import parser
from firecloud import api as fapi
from firecloud.errors import FireCloudServerError
from ..table_utils import add_one_set
####################################################... |
'''An inlet boundary condition process for KratosMultiphysics
license: license.txt
'''
__all__ = ['Factory', 'ImposeWindInletProcess']
from collections import namedtuple
from collections import Mapping
#from math import isclose
def isclose(a, b, rel_tol=1e-9, abs_tol=0.):
return abs(a-b) <= max(rel_tol * max(abs... |
#!/usr/bin/python3
"""
mapcyclefile - a utility to modify SRCDS mapcycle files
(a.k.a. "to make up for Valve not supporting subscription ids in TF2, how terrible of them")
Sample usage to do a dry run of syncing maps from collection 454128334 (Pikachu's CSRD Maps):
mapcyclefile.py --dry-run -c 454128334 "/path/to/tf/... |
# To run:
# python3 hq.py
#
# To profile:
# python3 -m cProfile -s cumulative hq.py > hq-profile.txt
from hq_gen import (
edges, expandQuadrant, genExpr2, genExpr3, genExpr4,
permuteCase, simplifyWeights
)
from collections import defaultdict
from itertools import count
from math import sqrt
import sys
# Varia... |
import numpy as np
from ase.neighborlist import NeighborList
from pymatgen.analysis.structure_matcher import StructureMatcher
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen.core.operations import SymmOp
from pymatgen.io.ase import AseAtomsAdaptor
from .structures import get_covalent_radii_arra... |
# -*- coding: UTF-8 -*-
#
# Copyright 2015-2020 <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 ... |
"""多维多时间序列神经网络滚动训练的数据工具.
version: 0.0.19
author: <NAME>
date: 2021-08-26
"""
import numpy as np
import tensorflow as _tf
import numpy as _np
from numba import njit
from typing import List as _List
__all__ = ["TimeSeriesData", "TrainValData"]
class TimeSeriesData:
"""单个时间序列信息.
Notes:
用于储存个股的数据信息及预... |
__author__ = "<NAME>, <NAME>"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
import numpy as np
from scipy import stats
# RiBuild Modules
# --------------------------------------------------------------... |
import wx
import os
import sys
import six
import time
from datetime import datetime, timedelta
import sqlite3
import CVUtil
from collections import defaultdict
from six.moves.queue import Queue, Empty
import unicodedata
def removeDiacritic( s ):
return unicodedata.normalize('NFKD', u'{}'.format(s)).encode('ascii', '... |
"""
Simple text utilities.
- SimpleTable
- WordFreq (moved to wordfreq.py)
Note that this module depends only on the Python standard library.
You can "install" it just by dropping it into your working directory.
:contact: alan dot is<EMAIL> at gmail dot com
:requires: Python 2.5.1+
:note: HTML data format currently s... |
import numpy as np
from numpy.polynomial.legendre import leggauss
from scipy.special import eval_genlaguerre, gammaln
from scipy.integrate import quadrature
from .constants import hbar_c, pi
def leggauss_shifted(deg, a=-1, b=1):
"""Obtain the Gaussian quadrature points and weights when the limits of integration ... |
import html
import json
import uuid
import sys
import os
import datetime
from flask import Flask, request, redirect, render_template, send_file, session, send_from_directory
from werkzeug.exceptions import abort
import facebook
from accounts.users import UserJobs, JobDates
from communities import merge_similar
from ... |
#
# Copyright (c) 2019 Expert System Iberia
#
"""
Provides functionality to search and predict claim credibility based on a
database of claims/sentences
"""
import logging
import time
import requests
import json
from acredapi import config, cache
import numpy as np
from acredapi.InvalidUsage import InvalidUsage
from a... |
from __future__ import absolute_import, print_function, division
import logging
import sys
logging.basicConfig(
stream=sys.stdout,
level=logging.DEBUG,
format='%(asctime)s %(name)s-%(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
from colvars import *
from utils.helpfunc import *
import util... |
import os
import time
from datetime import datetime
import webbrowser
import check_update
from functools import partial
from tkinter import *
from tkinter import filedialog
from tkinter import simpledialog
from tkinter import messagebox
import serial.tools.list_ports
import serial
import urllib.request
wash_count_look... |
# coding=utf-8
# Copyright 2021 The OneFlow 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... |
"""
Helper for CFC computation.
"""
from copy import deepcopy
from functools import partial
from multiprocessing import cpu_count
import numpy as np
import xarray as xr
from neurolib.utils.signal import Signal
from pathos.multiprocessing import Pool
from scipy.spatial import cKDTree
from scipy.special import digamma... |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
from grove.i2c import Bus
import logging
import time
import signal
#Registers,Parameters and commands
# commands
SI114X_QUERY = 0x80
SI114X_SET = 0xA0
SI114X_NOP = 0x0
SI114X_RESET = 0x01
SI114X_BUSADDR = 0x02
SI114X_PS_FORCE = 0x05
SI114X_GET_CAL = 0x12
SI114X_AL... |
# sequence to 12 model
import torch as torch
import torch.nn as nn
import torch.nn.functional as functional
import torch.optim as optim
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence, pad_sequence
from torch.utils.data import Dataset, DataLoader
from torch.utils.tensorboard import SummaryWrit... |
#!/usr/bin/env python
'''
Generates a report for standard products covering the input AOI
'''
from builtins import str
from builtins import range
import os
import re
import json
import requests
from datetime import datetime
import dateutil.parser
import urllib3
#import gantt
import coverage_chart
import excel
from hys... |
# SPDX-FileCopyrightText: 2021 Genome Research Ltd.
#
# SPDX-License-Identifier: MIT
import dateutil.parser
import json
from datetime import datetime
from sqlalchemy import and_
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.exc import IntegrityError
from sqlalchemy.inspection import inspect
PAGE_SIZE = 20... |
"""Contains test cases implemented using the pytest framework"""
import pytest
import pandas as pd
import re
import logging
from geopy.distance import geodesic
import requests
import argparse
import sys
logging.basicConfig(format='%(asctime)s: %(levelname)s:%(message)s',
filemode='w', filename='log... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
from django.db import models, router
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError, ImproperlyConfigured
from django.db.models.fields.subclassing import Creator
from django.utils.text import capfir... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from celluloid import Camera
from matplotlib import dates
from matplotlib.patches import Rectangle
from ..preprocessing.corrections import _calculate_raman_peak_area
from .base import _get_subplot_dims, eem_plot
def preprocessing_routine_plot(
... |
#!/usr/bin/env python
"""
Copyright (c) 2017, <NAME>
Copyright (c) 2017, <NAME>
Copyright (c) 2017, <NAME>
Copyright (c) 2017, <NAME>
Copyright (c) 2017, <NAME>
Copyright (c) 2017, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that t... |
from http import HTTPStatus
from typing import Dict, Any, Set, List, Union, Tuple, Generator
from apispec import APISpec
from apispec.exceptions import APISpecError
from apispec.ext.marshmallow import MarshmallowPlugin, OpenAPIConverter, make_schema_key, resolve_schema_instance
from marshmallow import fields, Schema
f... |
import os
from PIL import Image
import torch
import cv2
import json
import numpy as np
import sqlite3
import uuid
from PIL import Image
import glob
import shutil
import pandas as pd
from maskrcnn_benchmark.structures.bounding_box import BoxList
def fp16tojpeg(img_path, width=960, height=604):
data = np.fromfile(... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Create new Gratisdata items for gratispaideia articles and categories
# <NAME> 03-Jan-2021 v1 - start
# <NAME> 05-Jan-2021 v2 - expand based on newitem.py
# <NAME> 14-Jan-2021 v3 - expand biographies
import pywikibot
from pywikibot import page... |
from torchvision.models.squeezenet import Fire
from scripts.python import parse
from scripts.python import image
from scripts.python import histo
from torch import nn
import itertools
import torch
import numpy
import math
import copy
import csv
import sys
import os
class Histogram_Matches(torch.utils.data.Dataset):
'... |
from copy import deepcopy
def potion(alc_a, alc_b):
"""
Determines the result of mixing two alchemics
Args:
alc_a (str): the first alchemic being mixed
alc_b (str): the second alchemic being mixed
Returns:
str: the potion created, which will be of the form [color]... |
import os
import json
import shutil
from collections import defaultdict
from keras import backend as K
from keras.models import load_model
from math import ceil
import numpy as np
from matplotlib import pyplot as plt
from models.keras_ssd300 import ssd_300
from keras_loss_function.keras_ssd_loss import SSDLoss
from k... |
from fractions import Fraction
from typing import List, Tuple, Dict, Set, TypeVar, Generic
from enum import Enum, auto
from collections import deque
from random import sample, choice, randint, shuffle
from fracgeometry import V2d, V2dList, VSegment, VPath, FractionList
from dalmatianmedia import DlmtBrushstroke
T = T... |
# The implementation of FaSNet in
# <NAME>, et al. “FaSNet: Low-Latency Adaptive Beamforming
# for Multi-Microphone Audio Processing”
# The implementation is based on:
# https://github.com/yluo42/TAC
# Licensed under CC BY-NC-SA 3.0 US.
#
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functiona... |
#############################################################################
# NOTICE #
# #
# This software (or technical data) was produced for the U.S. Government #
# under ... |
'''
Models to serialize between MongoDB and Python
'''
# to make the recursive MenuItemModel work
from __future__ import annotations
from typing import Optional, List
from mongoengine import signals, Document, EmbeddedDocument, EmbeddedDocumentListField, ReferenceField, StringField, ListField, IntField, DateTimeField... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def no_op(apps, schema_editor):
# Do nothing on reversal
pass
# The following data was downloaded from the world bank dataset
# http://databank.worldbank.org/data/views/reports/metadataview.aspx
# Latit... |
import sys
if __name__ == "__main__":
sys.path.append("../pyscatwave")
from os.path import join
from math import sqrt
import numpy as np
import scipy as sp
import scipy.optimize as opt
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable, grad
from termcolor import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.