text stringlengths 6.04k 39.5k |
|---|
import configparser
import dataclasses
import glob
import json
import math
import os
from argparse import Namespace
from collections import defaultdict
from dataclasses import dataclass
from pathlib import Path
from typing import Callable, Generator, List, Optional, Tuple
import cv2
import numpy as np
import torch
imp... |
#!/usr/bin/env python
'''Shape submodule for dGraph scene description module
<NAME>
Jan 2017 - created by splitting off from dGraph
ALL UNITS ARE IN METRIC
ie 1 cm = .01
www.qenops.com
'''
__author__ = ('<NAME>')
__version__ = '1.6'
__all__ = ["Shape", "PolySurface"]
import dGraph as dg
import dGraph.material... |
import pyttsx3
import speech_recognition as sr
import datetime
import os
import cv2
import random
from requests import get
import wikipedia
import webbrowser
import pywhatkit as kit
import smtplib
import sys
import time
import pyjokes
import pyautogui
import subprocess
from selenium import webdriver
fr... |
import numpy as np
import sys
import scipy
from glob import glob
from time import time, sleep
import pickle
from joblib import Parallel, delayed
from tqdm import tqdm
from tools21cm.usefuls import *
from tools21cm import cosmology as cm
from tools21cm import conv
from tools21cm.telescope_functions import *
import tools... |
# encoding: utf-8
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from xmuda.models.LMSCNet import SegmentationHead
from xmuda.models.context_prior import ContextPrior3D
from xmuda.models.context_prior_v2 import ContextPrior3Dv2
from xmuda.models.CP_baseline import CPBaseline
from... |
# -*- coding: utf-8 -*- #
# Copyright 2014 Google 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
import re
import torch
import importlib
import numpy as np
from collections import Counter
from TTS.utils.generic_utils import check_argument
def split_dataset(items):
speakers = [item[-1] for item in items]
is_multi_speaker = len(set(speakers)) > 1
eval_split_size = min(500, int(len(items) * 0.01))
... |
from PyQt5 import QtGui, QtWidgets, QtCore
import sys, glob, os, functools, exifread, re, shutil, sqlite3
DIRECTION_PREV = "prev"
DIRECTION_NEXT = "next"
DIRECTION_FIRST = "first"
DIRECTION_LAST = "last"
class App(QtWidgets.QMainWindow):
image_config = None
image_id = None
action = None
app_width = ... |
# -*- coding: utf-8 -*-
from aiida.orm.calculation.job import JobCalculation
from aiida.orm.data.parameter import ParameterData
from aiida.orm.data.structure import StructureData
from aiida.common.utils import classproperty
from aiida.common.exceptions import InputValidationError
from aiida.common.datastructures impor... |
import glob
import math
import os
from abc import ABC
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
import torch.nn as nn
from mlflow.utils.mlflow_tags import MLFLOW_RUN_NAME
from torch.cuda.amp import autocast
from tqdm import tqdm
from nntools.dataset.utils import concat_datasets_... |
#!/usr/bin/env python
# coding: utf-8
# # Pyomo Model of the Double Pipe Heat Exchanger
#
# This is additional material regarding the modeling and analysis of the double pipe heat exchanger. If you are using this notebook in Google Colab, run the following cell to import needed libraries to run the notebook code.
# ... |
import bpy
from mathutils import *
from math import *
import bmesh
import time, random, sys, os, io, imp
def facto(n):
prod = 1
for i in range(1, n+1):
prod *= i
return prod
class Vector1 (object):
def __init__(self, vec=None):
self.vec = [0.0, 0.0, 0.0]
if vec !... |
# mypy: allow-any-expr, warn-unused-configs
"""
https://leetcode.com/problems/number-of-islands/
Given an m x n 2D binary grid grid which represents a map of '1's (land) and
'0's (water), return the number of islands.
An island is surrounded by water and is formed by connecting adjacent lands
horizontally or vertical... |
# ICE Revision: $Id$
"""Run a OpenFOAM command"""
import sys
import string
import gzip
from os import path
from platform import uname
from threading import Timer
from time import time,asctime
from PyFoam.FoamInformation import oldAppConvention as oldApp
from PyFoam.ThirdParty.six import print_
import PyFoam.Basics.F... |
import os
import socket
import sys
import tempfile
from collections import OrderedDict
from typing import List, Tuple
import click
import click_spinner
from src import settings
from src.cli import console
from src.graphql import GraphQL
from src.local.providers.helper import get_cluster_or_exit
from src.local.system ... |
import sys, os, re, time
import matplotlib.pyplot as plt
import matplotlib
import pandas as pd
import numpy as np
from scipy.interpolate import InterpolatedUnivariateSpline as InterFun
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
# Define folder path for csvs
FOLDER_PATH... |
# Copyright (C) 2011-2012 Canonical Services Ltd
#
# 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, ... |
"""
Contains the derived saveable search from GridSearchCV
"""
import numpy as np
import pickle
import os.path
import six
import time
import numbers
import warnings
from collections import defaultdict
from functools import partial
from joblib import Parallel, delayed, logger
from itertools import product
from scipy.sta... |
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import zip
from builtins import range
import os
import shutil
import re
import logging
import numpy as np
from unidecode import unidecode
from nltk.corpus import wordnet as wn
from vsm.extensio... |
import shortuuid
from tga_models.ta import TGA, pyuppaal
class ControlLoop(TGA):
"""
A Control Loop class to generate a TGA for the control loop
model developed for my thesis.
Original author: <NAME>
"""
# constants
to_region_decl = 'to_region'
from_region_decl = 'from_region'
... |
import argparse
import collections
import multiprocessing
import os
import numpy as np
import six
if six.PY2:
import cPickle as pickle
else:
import pickle
import gzip
import random
import json
import time
import torch.utils.data
from program_synthesis.algolisp.dataset import data
Schema = collections.named... |
from __future__ import print_function
import array, os, struct
from base64 import b32encode
from pyutil import fileutil
from pyutil.mathutil import pad_size, log_ceil
import zfec
from zfec import easyfec
CHUNKSIZE = 4096
def ab(x): # debuggery
if len(x) >= 3:
return "%s:%s" % (len(x), b32encode(x[-3:]),)... |
#!/usr/bin/env python
"""
Visualize sequence features
"""
import dnaplotlib as dpl
import matplotlib.pyplot as plt
from matplotlib import gridspec
# Required for drawing shapes
from matplotlib.patches import Polygon
from matplotlib.lines import Line2D
from matplotlib.patheffects import Stroke
import matplotlib.patch... |
from math import sqrt
from collections import deque
# Physical constraints (* 20cm is the actual size)
HOLD_RANGE = 10
HUMAN_SIZE = 8.5
# Size of the Moon Board(+ Foot Hold)
HEIGHT_NUM = 20
WIDTH_NUM = 11
culc_dist_map = {}
# Parameters
D_ATTACH = 50
D_FREE = 200
D_TOO_CLOSE = 50
D_UNSTABLE = 95
C_2LIMBS = 120
C_UNS... |
import time
import subprocess
import re
import threading
import calendar
import random
import datetime
from urllib.request import urlopen
import io
import wolframalpha
import speech_recognition as sr
class SarahAI():
def __init__(self, class_, witaiKey="<KEY>", wolframalphaKey="TKRT9H-AV9W8WRR8V"):
self.WolframCli... |
"""-----------------------------------------------------------------------------
Name: thematic_accuracy.py
Purpose: Creates the themtic accuracy score from the feature level metadata.
Description: This tool scores the thematic accuracy of a TDS 6.1 curve feature
class. The tool uses global population data to i... |
# encoding: utf-8
import preprocess_functions as process
import read_files as read
import os
from nltk.tokenize import sent_tokenize
from nltk.tokenize.util import regexp_span_tokenize
import numpy as np
from collections import defaultdict
from random import randint
import argparse
import configparser
import warnings
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import os.path as op
import sys
import logging
import re
from pyfaidx import Fasta, Sequence
import pybedtools
def locate(args):
kmers, fd, fo = args.kmer, args.db, args.out
fg = args.fg
db = Fasta(fd)
#
kseqs = kmers.split(',')
kseqs2 =... |
import concurrent.futures
import fnmatch
import logging
import os
import requests
import sys
import time
import traceback
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timedelta
from functools import partial
from plumbum import local, BG
from watchdog.observers import Observer
from wa... |
import os
import sys
import torch
import random
import numpy as np
from scipy.sparse import csr_matrix
import torch.nn as nn
import torch.nn.functional as F
class Classification(nn.Module):
def __init__(self, emb_size, num_classes):
super(Classification, self).__init__()
self.fc1 = nn.Linear(emb... |
from __future__ import absolute_import
import numbers
import numpy as np
import pandas as pd
import xarray as xr
import warnings
from collections import defaultdict
from seqtables.core.utils.alphabets import dna_alphabet, aa_alphabet, all_dna, all_aa
from seqtables.core.internals.sam_to_arr import df_to_algn_arr
import... |
import os
import sys
import traceback
from typing import Callable, Generator, List, Tuple
import pandas as pd
import seaborn as sns
from PySide2.QtCore import QEvent, QObject, QRunnable, QThreadPool, Qt, Signal, Slot
from PySide2.QtGui import QIcon, QPixmap
from PySide2.QtWidgets import (QApplication, QCheckBox, QComb... |
import argparse
import datetime
import os
import pathlib
import re
import signal
import subprocess
import time
import docker
import docker.errors
import docker.types
import toml
from pprint import pprint
WORLDS = dict(
# TUNNEL
tq = "tunnel_qual_ign",
ts1 = "simple_tunnel_01",
ts2 = "simple_tunnel_0... |
import itertools
import os.path
from abc import ABC, abstractmethod
import torch
import torch_scatter
import torch_geometric as torch_g
import torchinfo
from src.NN_modules import ResidualMultilayerMPNN, MultilayerGatedGCN
from src.constants import MODEL_WEIGHTS_FOLDER
class WalkUpdater:
@staticmethod
def b... |
"""
..
---------------------------------------------------------------------
___ __ __ __ ___
/ | \ | \ | \ / the automatic
\__ |__/ |__/ |___| \__ annotation and
\ | | | | \ analysis
___/... |
"""Module containing the sklearn pipelines for time series forecasting
This module contains the sklearn pipelines for the different levels of forecast
'difficulty'. Three will be proposed, a fast, a balanced and a slow prediction,
each sacrificing processing time for forecasting accuracy.
"""
import numpy as np
fro... |
#Import modules
import random
#Define species, causes of death, and genders
different_species = ["ant", "ape", "bear", "cat", "dog", "wolf"]
ant_deaths = ["you got crushed.", "you carried a little more than 50\ntimes your own weight.", "you forgot your way to the hill.", "you recieved the death sentence from\... |
from math import exp
import os, sys # string, # noqa: E401
current_location = os.path.dirname(__file__)
#####################################################################################
# get parameter file name, with installed path
def getDreidingParamFile():
datadir = os.path.join(current_location, "..",... |
#!/usr/bin/env python3
"""
Compute the embeddings for every task and store to disk.
Since many tasks might be too large to store in GPU memory (or even
CPU memory), and because Wavenet-like models will be expensive at
inference time, we cache all embeddings to disk.
One benefit of this approach is that since all embe... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 <NAME>, zju-ufhb
# This module is part of the WATex core package, which is released under a
# MIT- licence.
"""
.. Synopsis: Module features collects geo-electricals features computed from
:class:`watex.core.erp.ERP` and :class:`watex.core.ves.VES` and keeps
on... |
# Copyright (c) 2021 Institute for Quantum Computing, Baidu 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
#
# Un... |
from datetime import datetime, time, timedelta
from enum import Enum
from time import sleep
from typing import List, Optional, Union
from tealprint import TealPrint
from .core.entities.color import Color
from .data.network import GuestOf, Network
from .smart_interfaces.devices import Devices
from .smart_interfaces.gr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import socket
import os
import select
import time
import json
import threading
MYDIR = os.path.dirname(__file__)
print("Module [socketClient] path: {} __package__: {} __name__: {} __file__: {}".format(
sys.pa... |
# PyGame library to create the game board and redraw when the board needs to be updated -- event listener
import pygame
pygame.init()
# Reference https://realpython.com/pygame-a-primer/
pygame.display.set_caption('Tic Tac Toe')
# Define constants for the screen width and height
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 60... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
from collections import Counter
from datetime import datetime
import logging
import re, sys
import os, pycurl, tarfile, zipfile, gzip, shutil
from pkg_resources import resource_filename
from sistr.version import __version__
from sistr.src.bl... |
#!/usr/bin/env python2 --
import math, os, random, time
import pygame
pygame.init()
#music = pygame.mixer.music.load("dat/music.ogg")
WIDTH = 320
HEIGHT = 200
SCALE = 3
FPS = 60.0
SPF = 1.0/FPS
CAMBORDER = 64
real_camx = WIDTH//2
real_camy = HEIGHT//2
# Set up display
pygame.display.set_caption("Portal DAGger")
s... |
"""将一个正三角形或者正六边形切分成小三角形"""
import numpy
from basics import Eqtriangle, Point, Hexagon, Segment
from basics.point import middle_point
#from .drawer import draw_components
def eqtriangle_split(eqt: Eqtriangle, nps):
'''将一个正三角形切分成nps个块'''
#从两个边开始计算
#nps条分界线,包含本来的底边
btmlines = []
for idx in range(np... |
# Copyright 2013 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... |
import numbers
import random
import math
import warnings
import numpy as np
from PIL import Image, ImageEnhance, ImageOps
class ShearX(object):
def __init__(self, fillcolor=(128, 128, 128)):
self.fillcolor = fillcolor
def __call__(self, x, magnitude):
return x.transform(
x.size, I... |
import os
import sys
import time
import torch
import numpy as np
import multiprocessing as mp
from elegantrl.envs.Gym import build_env, build_eval_env
from elegantrl.train.replay_buffer import ReplayBufferMP
from elegantrl.train.evaluator import Evaluator
def train_and_evaluate_mp(args, agent_id=0):
args.init_bef... |
"""
I/O for Nastran bulk data.
"""
from __future__ import annotations
import numpy as np
from ..__about__ import __version__
from .._common import num_nodes_per_cell, warn
from .._exceptions import ReadError
from .._files import open_file
from .._helpers import register_format
from .._mesh import CellBlock, Mesh
nas... |
""" IBM based speech recognition service """
import time
import json
import collections
import os
import os.path
import asyncio
import base64
import websockets
import pyaudio
import webrtcvad
from dotenv import load_dotenv
from MqttService import MqttService
from io_buffer import BytesLoop
# ibm
CHUNK = 1024
FORMAT = ... |
#!/usr/bin/env python
# %%
import os
from datetime import datetime, timedelta, date
import pandas as pd
import numpy as np
from functools import reduce
import colorcet as cc
from bokeh.plotting import figure, output_file, show, save, ColumnDataSource
from bokeh.models import ColumnDataSource, Range1d, HoverTool, Div
f... |
# Copyright 2008-2018 Univa Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %%
from __future__ import annotations
from MetaQA import (Extractive_QA_Dataset,
SIQA_Dataset,
BoolQ_Dataset,
HellaSWAG_Dataset,
CommonSenseQA_Dataset... |
"""
Created by: <NAME> (@e-bug)
Date created: 9/4/2019
Date last modified: 9/4/2019
"""
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import options
from fairseq import utils
from fairseq.modules import (
AdaptiveInput, AdaptiveSoftm... |
from binascii import unhexlify
import pytest
from cose.algorithms import Es256
from cose.keys.curves import P521, P384, P256
from cose.exceptions import CoseInvalidKey, CoseIllegalKeyType, CoseException, CoseUnsupportedCurve
from cose.keys import EC2Key, CoseKey
from cose.keys.keyops import SignOp
from cose.keys.keyp... |
#!/usr/bin/python3
# We want inmates to have access to optical media.
# They are useful for:
# * education;
# * accessing legal libraries;
# * entertainment (DVD movies, CDDA music); &
# * personal data (e.g. family photo album).
#
# Unlike USB keys, they are (mostly) read-only,
# and harder to smuggle in body cavitie... |
# -*- coding: utf-8 -*-
import os
import unittest
from numpy.testing import *
from ep.evalplatform.parsers_image import *
class TestCellImageParser(unittest.TestCase):
def setUp(self):
self.parser = MaskImageParser()
self.to_clear = []
self.image_1 = np.zeros((20, 15), dtype=np.uint8)
... |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 0.8.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# lang... |
import numpy as np
import scipy.sparse as sp
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as pl
import algorithms as al
import os.path
def shape(p, q, C0, C1, nel0, P, W, intpoints0, intpoints1):
"""
Shape function routine.
"""
# set up bernstein basis and derivative values
B0 =... |
import json
from datetime import datetime
import torch
import wandb
import numpy as np
from maml_rl.metalearner import MetaLearner
from maml_rl.policies import NormalMLPPolicy
from maml_rl.baseline import LinearFeatureBaseline
from maml_rl.sampler import BatchSampler
def get_date_str():
d = datetime.now()
... |
from __future__ import division
from __future__ import print_function
from builtins import str
from past.utils import old_div
import numpy as np
from pandas import DataFrame, crosstab
def STDO(obs, mod, axis=None):
""" Standard deviation of Observations """
return np.ma.std(obs, axis=axis)
def STDP(obs, mod... |
# -*- coding: utf-8 -*-
# Most code for this implementation is borrowed from transformers
import math
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers.utils import logging
from transformers.models.mbart.modeling_mbart import (
MBartEncoderLayer, _expand_mask, MB... |
#!/opt/libreoffice5.2/program/python
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET
import os
import sys
from config import getConfig
import types
from helper import Elem
class MenuItem(Elem):
'''
oor:node-type="MenuItem"を作成するメソッドをもつElemの派生クラス。
'''
def createNodes(self, c, xdic):
'''... |
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import gc
import cv2
# gc.set_threshold(100, 10, 10)
from lib.model.config import cfg
from lib.rpn.generate_anchors_global import generate_anchors_global
from lib.rpn.... |
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2019 <NAME>
#
# See LICENSE at the root of this project for more info.
import pytest
from emnes.ppu import PPU
zero_ppu_ctrl = {
"base_nametable_address": 0x2000,
"vram_io_addr_inc": 1,
"sprite_table_addr": 0,
"bg_table_addr": 0,
"sprite_hei... |
#! /usr/bin/python
import os, sys, subprocess
from config import GLOBAL_LOAD_LIST, GLOBAL_STORE_LIST
from config_gen import X_threads, Y_threads, Invoc_count
##########################
src_name = sys.argv[1]
##########################
storeMaskingDic = {} # All stores executed, results here too.
profileMemLinesList... |
from __future__ import absolute_import, division, print_function
import numpy as np
import theano
import theano.tensor as T
from theano.tensor.nnet import conv2d
from theano.tensor.signal.pool import pool_2d
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from .normalization import Batc... |
import json
import logging
import traceback
from collections import OrderedDict
from django.conf import settings
from ievv_opensource.utils.singleton import Singleton
class ActionResult(object):
def __init__(self, actionclass):
self.actionclass = actionclass
self.failed = False
self.succ... |
import torch
import torch.nn as nn
import time
import numpy as np
from adabound import AdaBound
import sys
def pre_processing(data: 'Px value', power=4):
return 1-data**power
class HPC(nn.Module):
def __init__(self, input_features, out_features):
super(HPC, self).__init__()
self.linear1 = nn.... |
import argparse
import datetime
import json
import os
import string
import tensorflow as tf
import tensorflow.keras as K
import tqdm
import losses
import utils.augment_images as aug
from seg_visualizer import get_images_custom
from model_provider import get_model
from utils.create_seg_tfrecords import TFRecordsSeg
fr... |
"""
tools used for the experiments
Based on <NAME> implementation https://github.com/hfawaz/dl-4-tsc
Author:
<NAME> 2019.25.04
"""
import numpy as np
import os
import random
from joblib import Parallel, delayed
from multiprocessing import Pool
from functools import partial
import scipy.sparse as sp
from sklearn.me... |
import argparse
from PyQt5.QtCore import qChecksum
from numpy.core.numeric import False_
import finplot as fplt
import pandas as pd
import numpy as np
from collections import defaultdict
from matplotlib.markers import MarkerStyle as MS
import datetime
from functools import lru_cache
import pandas as pd
from PyQt5.QtWid... |
import sys
import requests
from PySide2.QtUiTools import QUiLoader
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtWidgets import QApplication, QMainWindow, QWidget, QTableWidgetItem
from PySide2.QtCore import QObject, Signal, Slot, QFile
from shioaji.constant import *
import shioaji as sj
import asyncio
im... |
import os
import random
from typing import Dict, Optional, List
import arcade
import pyglet
from arcade.gui import UIManager
from pyglet.gl import GL_NEAREST
import assets
from map_creator import MapCreator, LoadMapButton
WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720
WINDOW_NAME = "Binary Defense"
SCALE = 4
TPS_NORMAL =... |
import string
import curses
try:
import _curses
except ImportError:
_curses = curses
# import os
# import os.path
# import posixpath
# import string
# import sys
import time
# import traceback
# import glob
# import json
# import string
# import math
# import re
# from subprocess import Popen
# sys.path.append... |
import yaml
import os
import logging
from os.path import relpath
from dc_exceptions import DcException
from copy import deepcopy
class DcMixer(object):
"""
Main class for dc-mixer
"""
__MIXER_FILE = 'docker-compose-mixer.yml'
""":type : string"""
__EXIT_STATUS_INPUT_FILE_NOT_EXISTS = 2
""... |
import os
import argparse
import datetime
import platform
import random as rn
import numpy as np
import tensorflow as tf
from data_generator import DataGenerator
from utils import get_version
import models
import metrics
class Training:
def __init__(self
, data_dir=None
, ckpt_dir... |
# Copyright (c) 2020: <NAME> (<EMAIL>).
#
# This file is modified from <https://github.com/philip-huang/PIXOR>:
# Copyright (c) [2019] [<NAME>]
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""Utils for PIXOR detection."""
from __future__ import... |
"""
network_hotspot
~~~~~~~~~~~~~~~
Implements, to a good approximation, the "network prospective hotspot"
algorithm as described in:
- Rosser et al. "Predictive Crime Mapping: Arbitrary Grids or Street Networks?"
Journal of Quantitative Criminology 33 (2017) 569--594,
DOI: 10.1007/s10940-016-9321-x
By setting t... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 10 11:36:21 2020
@author: <NAME>, https://github.com/zhaofenqiang
Contact: <EMAIL>
"""
import numpy as np
import itertools
from sklearn.neighbors import KDTree
from utils import get_neighs_order
import math, multiprocessing, os
abspath = os.path.... |
import databaseCalls as dbc
import BlizzApiCalls as bac
import infoRefinement as ir
import sys
import time
def scanServer(id): #fetches charname and realm for the selected server via the auction api (getAllChars) and writes them in to the corresponding staging tabe
print("Fetching Data for Server ID {}".format(i... |
# #!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as pyplot
import numpy as np
import pylab
import os
import sys
import glob
import json
import csv
import re
from collections import defaultdict
import datetime
class TestResult():
_cache_sizes = [
"tiny",
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""\
"""
import select
import socket
import sys
import errno
import random
import time
import os
import logging
import guild
from guild.actor import *
debug = False
for actor_class_name in ["Selector", "TCPServer", "RawConnectionHandler","EchoServer"]:
logger = logging... |
import os
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import cv2
import h5py
import PIL.ImageFile
from PIL import Image
import torchvision.transforms as transforms
import time
import types
from numpy import random
from pycocotools.coco import COCO
from datasets.... |
"""A pull parser for parsing JSON streams"""
# The MIT License (MIT)
#
# Copyright (c) 2015 by Teradata
#
# 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 witho... |
"""
A dimod composite_ that uses the D-Wave virtual graph feature for improved minor-embedding_.
D-Wave *virtual graphs* simplify the process of minor-embedding by enabling you to more
easily create, optimize, use, and reuse an embedding for a given working graph. When you submit an
embedding and specify a chain stren... |
import torch
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
# @neelabh17 implementation
class CCELoss(torch.nn.Module):
def __init__(self, n_classes, n_bins = 10, mode = "eval"):
'''
output = [n_Class, h , w] np array: The complete probability vector of an image
targ... |
"""Histogram Index computes a index for numerical values by
maintaining multiple bitmaps for value ranges, each bitmap corresponds
to a value bin. The first bin corresponds to half infinite values
lower than the first specifid value, and the last bin corresponds to
half infinite values higher than the last specified v... |
# Copyright (c) 2006-2013 Regents of the University of Minnesota.
# For licensing terms, see the file LICENSE.
'''This file is the main script for building a multimodal graph. '''
import math
import sys
import time
import traceback
from pkg_resources import require
require("Graphserver>=1.0.0")
from graphserver.comp... |
"""
Name:bcp_loader.py
Purpose: This is a python wrapper for MS SQL Server Bulk Copy Program (BCP) utility.
It allows automating and scripting for loading tables into SQL server.
Dependencies:
-BCP needs to be downloaded as a separate EXE file, obtainable at:
https://docs.microsoft.com/... |
from Pieces import *
from copy import deepcopy
import os
import pygame
class game():
def __init__(self):
path = os.path.dirname(os.path.realpath(__file__))
path = path + r"\sound\nes"
self.capture_sound = pygame.mixer.Sound(str(path) + r"\Berserk.ogg")
self.move_sound = ... |
###########################################
# Author : <NAME>, <NAME>, <NAME>, <NAME>
# Date : 26.04.2018
# Course : Applications in Object-oriented Programming and Databases
# Teachers : <NAME>, <NAME>
# Project : Bibliotek
# Goal : Book management system
# Libraries : scrapy, bibtexparser, datetime, req... |
from __future__ import division
from __future__ import print_function
import copy
import numpy as np
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgl.nn.pytorch import GraphConv, SAGEConv
import networkx as nx
from utils.common_tools import get_first_element, get... |
import warnings
from collections import defaultdict
import h5py
import numpy as np
from scipy.interpolate import InterpolatedUnivariateSpline as iu_spline
#from pipeline import PipelineException
import matplotlib
import pandas as pd
matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy as np
try:
im... |
#!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Generates an Android Studio project from a GN target."""
import argparse
import codecs
import logging
import os
import re
import sh... |
import PIL
from PIL import ImageEnhance, Image, ImageFilter, ImageChops
import PIL.ImageOps
import numpy as np
randint = np.random.randint
def get_array_color_mode(x):
""" Given a numpy array representing a single image, it returns the
PIL color mode that will most likely work with it """
x = x.squeeze... |
import argparse
import os
import numpy as np
from tqdm import tqdm
import torch
from dataloaders import make_data_loader
from modeling import build_model, build_transfer_learning_model
from utils.loss import SegmentationLosses
from utils.lr_scheduler import LR_Scheduler
from utils.metrics import Evaluator
from utils.s... |
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
# from celluloid import Camera
from skmultiflow.core import BaseSKMObject, ClassifierMixin
from sklearn.cluster import KMeans
class Minas(BaseSKMObject, ClassifierMixin):
def __init__(self,
kini=3,
clu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.