text stringlengths 6.04k 39.5k |
|---|
# coding: utf-8
from __future__ import print_function
from __future__ import division
from torch.nn.utils.rnn import pad_sequence
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import TransformerEncoderLayer, TransformerEncoder
from libcity.model.abstract_model import AbstractModel
im... |
from tehbot.plugins import *
import random
import os.path
import time
import datetime
import irc.client
from pony.orm import *
from functools import reduce
class SlapwarzPlugin(StandardCommand):
def __init__(self, db):
StandardCommand.__init__(self, db)
self.parser.add_argument("victim")
def c... |
import os, sys
sys.path.insert(1, os.path.join(sys.path[0], '../app'))
import frontend.stock_analytics as salib
import numpy as np
import scipy.optimize
from bson import ObjectId
import analysis_lib as al
import json
import numba as nb
import traceback
from numba import jit
import task_lib as tl
class NumpyEncoder(js... |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
try:
import ROL
from ROL.numpy_vector import NumpyVector
has_ROL = True
except:
has_ROL = False
from scipy.optimize import LinearConstraint, NonlinearConstraint, Bounds, \
OptimizeResult, BFGS
from scipy.optimize import minimiz... |
"""
Space Robotics Challenge 2
"""
import math
from random import Random
from datetime import timedelta
from osgar.node import Node
from osgar.bus import BusShutdownException
from osgar.lib import quaternion
from osgar.lib.mathex import normalizeAnglePIPI
from osgar.lib.virtual_bumper import VirtualBumper
from subt... |
# -*- conding: utf-8 -*-
import time
import unittest
from src.cache import LRUCache, MRUCache, LFUCache, SLRUCache, ARCache
class TestLRUCache(unittest.TestCase):
def test_write_evicts_the_oldest_elem_when_cache_is_full(self):
lru = LRUCache(2)
lru.write('a', 10)
lru.write('b', 20)
... |
#!/usr/bin/env python
"""
Unit tests for the bitarray module.
"""
import unittest
import bitstring
from bitstring import BitArray
class All(unittest.TestCase):
def testCreationFromUint(self):
s = BitArray(uint=15, length=6)
self.assertEqual(s.bin, "001111")
s = BitArray(uint=0, length=1)... |
# -*- coding: utf-8 -*-
"""CBV helper classes.
"""
import inspect
import sys
from django import http
from django.db import connection
from django.views.generic import View
from . import grid
from dkjason import jason
class CORSView(View):
"""CBV that understands CORS preflight rules.
"""
# CORS paramete... |
'''
---------------------------
Licensing and Distribution
---------------------------
Program name: TorsiFlex
Version : 2021.3
License : MIT/x11
Copyright (c) 2021, <NAME> (<EMAIL>) and
<NAME> (<EMAIL>)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Pre-whiten data with ARIMA model before cross-correlation
Created on Wed Mar 17 11:45:37 2021
@author: lizz
"""
from netCDF4 import Dataset
from scipy import interpolate
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as... |
# Copyright (c) 2018, Nordic Semiconductor ASA
# Copyright 2018, 2019 Foundries.io Ltd
#
# SPDX-License-Identifier: Apache-2.0
'''Parser and abstract data types for west manifests.
The main class is Manifest. The recommended method for creating a
Manifest instance is via its from_file() or from_data() helper
methods.... |
import tempfile
import urllib.request
from datetime import date, timedelta
from enum import Enum, unique
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.gis.db.models.functions import Distance
from django.contrib.postgres.fields import JSONField
from django.core.except... |
# Copyright 2015 Rackspace
# 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 writing, sof... |
import torch
import argparse
from math import ceil as ceil
import os
import numpy as np
import torch.nn.functional as F
import cv2
import pydensecrf.densecrf as dcrf
from utils.utils import to_cuda
from torch.backends import cudnn
from solver.solver import Solver as Solver
#from model import model as model
from model ... |
"""Unit tests for OMMBV core vector basis functions."""
import datetime as dt
import functools
import itertools
import numpy as np
import pandas as pds
import pytest
import warnings
import OMMBV
from OMMBV import tests
import OMMBV.tests.test_deprecation as testing
import OMMBV.trace
import OMMBV.trans
import OMMBV.v... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
import nidm.experiment.Navigate
from nidm.experiment import Project, Session, AssessmentAcquisition, AssessmentObject, Acquisition, AcquisitionObject, \
Query
from nidm.core import Constants
from rdflib import Namespace, URIRef
import prov.model as pm
from os import remove, path, environ
import tempfile
import pyte... |
'''Javascript fetch code snippets generator.'''
import os
from collections import OrderedDict
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
from http_request_codegen.generators.javascript._utils import (
DEFAULT_INDENT,
DEFAULT_QUOTE_CHAR,
DEFAULT_WRAP,... |
from sklearn.datasets import make_blobs
from cytopy.data.experiment import *
from cytopy.data.errors import *
from cytopy.tests.conftest import create_example_populations
from cytopy.tests import assets
import pandas as pd
import pytest
import h5py
import os
def test_check_excel_template():
mappings, nomenclature... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
## @file ostap/fitting/minuit.py
# Module with decoration of some (T)Minuit functions for efficient use in python
#
# @author <NAME> <EMAIL>
# @date 2011-06-07
#
# =========================... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in complianc... |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
import re
import json
import execjs
import random
import logging
import requests
import datetime
from copy import deepcopy
import scrapy
from scrapy i... |
import sympy as smp
import scipy.stats as sss
import scipy.optimize as sop
import numpy as np
import pandas as pd
from datetime import datetime, date, timedelta
import matplotlib.pyplot as plt
from fh_tools.fh_utils import get_cache_file_path, date_2_str
from scipy.stats import norm
import json
from config_fh... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# TEST_UNICODE_LITERALS
import operator
import numpy as np
from ...tests.helper import pytest, assert_follows_unicode_guidelines
from ... import table
from ... import units as u
from ...extern import six
from ...utils.compat import NUMPY_LT_1_8
class... |
__author__ = 'mangalbhaskar'
__version__ = '2.0'
"""
Credits:
Code adopted from:
* mrcnn/visualize.py
* color_splash from the blog post:
* https://engineering.matterport.com/splash-of-color-instance-segmentation-with-mask-r-cnn-and-tensorflow-7c761e238b46
---
Mask R-CNN
Display and Visualization Functions.
Copyrig... |
### This is run when you want to select the parameters from the parameters file
import transformers
import torch
import neptune
from knockknock import slack_sender
from transformers import *
import glob
from transformers import BertTokenizer
from transformers import BertForSequenceClassification, AdamW, BertConfig
im... |
"""Save campaigns parameters : map oar job ids, dates, frequencies ...
Usage:
On remote server (i.e. where simulations have been run, probably Luke):
* first, create pkl file, e.g.
from simulation_campaigns import post_process_simus
camp, running = post_process_simus('./', '/nfs_scratch/perignon/Music', './Results_... |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Title : local waveform viewer for the LZTS digitizer
#-----------------------------------------------------------------------------
# File : lztsViewer.py
# Author : <NAME>
# Created : 2017-25-07
# L... |
"""
Creado el 31-01-2020
@author: <NAME>
"""
import pandas as pd
import numpy as np
import datetime as dt
import xlwings as xw
import os
import random
import locale
from copy import copy
import unidecode
import timeit
from math import isnan
from sqlalchemy import create_engine, types
import math
from libreria_fdo ... |
#!/usr/bin/env ipython
# This script is for performing specific analyses/generating figures
# It relies on e.g. statistics computed across experiments - "derived results"
import numpy as np
import test_private_model
import derived_results as dr
import experiment_metadata as em
import vis_utils
import matplotlib.pyplot... |
# -*- coding: utf-8 -*-
import bisect
import threading
import time
import traceback
from bisect import insort
from collections import deque
from discord import utils
from discord.opus import Decoder
from .rtp import *
from .rtp import FECPacket, log
class BufferedDecoder(threading.Thread):
DELAY = Decoder.FRAM... |
from binascii import unhexlify, a2b_hex as _a2b_hex
from lux.utils import test
from lux.utils.crypt.pbkdf2 import (_0xffffffffL, algorithms,
isbytes, isinteger, callable, binxor,
b64encode, verify, b2a_hex, PBKDF2,
... |
import json
from hashlib import md5, sha256, sha512
from time import time, ctime
from os import listdir, mkdir, system
import os.path as path
from copy import deepcopy
from random import randint
from terminaltables import AsciiTable
from codecs import encode, decode
colors = {
"DONE": '\033[0;30;42m',
'INFO': ... |
# -*- coding: utf-8 -*-
"""
MT_VMAT_0.1
MT_VMAT_0.2 PicketFence statisch
MT_VMAT_1.1 PicketFence mit rot
MT_VMAT_1.2:error PicketFence mit rot und absichtlichen Fehler
MT_VMAT_2 Variationen von DoseRate und Gantry Speed
MT_VMAT_3 MLC Speed
"""
__author__ = "<NAME>"
__copyright__ = "MedPhyDO - Machbarkeitsstudien de... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from keras import backend as K
from keras import activations
from keras import initializers
from keras import regularizers
from keras import constraints
from keras.layers.recurrent import Recurrent
import numpy as np
from keras.engine import InputSpec
fro... |
from __future__ import print_function
import json
import math
import os
import cdms2
import cdutil
import numpy
import scipy.stats
import e3sm_diags
from e3sm_diags.derivations import default_regions
from e3sm_diags.driver import utils
from e3sm_diags.metrics import corr, max_cdms, mean, min_cdms, rmse, std
from e3s... |
#!/usr/bin/env python
# -*- python -*-
# <NAME> <<EMAIL>>
#BEGIN_LEGAL
#
#Copyright (c) 2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.or... |
import argparse
import json
from collections import Counter
from functools import partial
from typing import List, Dict
import sys
import os
import logging
import nltk
import numpy as np
import torch
import random
from multiprocessing import Pool
from tqdm import tqdm
from transformers import PreTrained... |
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import List
from queue import SimpleQueue, LifoQueue
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def get_next_char(char, union):
next_char = chr(ord(char) + 1)
syms = [x.mark for x in union]
while next_... |
import argparse
import os
import numpy as np
from tqdm import tqdm
from mypath import Path
from dataloaders import make_data_loader
from modeling.sync_batchnorm.replicate import patch_replication_callback
from modeling.deeplab import *
from utils.loss import SegmentationLosses
from utils.calculate_weights import calcul... |
from abc import ABC, abstractmethod
import collections
import numpy as np
import random as rand
rand.seed(0.1)
import matplotlib.pylab as plt
import timeit
class BaseLearner(ABC):
def __init__(self, alpha, gamma, epsilon=0.1):
# parameters
self.alpha = alpha
self.gamma = gamma
... |
#! -*- coding: utf-8 -*-
""" Text word segmentation tool and Tokenizer
"""
# Author: DengBoCong <<EMAIL>>
#
# License: Apache-2.0 License
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import math
import numpy as np
import os
from collections ... |
LED_RED = 1
LED_GREEN = 2
LED_YELLOW = 3
LED_BLUE = 4
RIGHT_RANGE_PIN = 'C1'
LEFT_RANGE_PIN = 'A1'
FRONT_RANGE_PIN = 'C3'
RIGHT_PROX_PIN = 'C0'
LEFT_PROX_PIN = 'A0'
FRONT_PROX_PIN = 'C2'
LEFT_MOTOR_DIRECTION_PIN = 'B15'
LEFT_MOTOR_PWM_CHANNEL = 2
RIGHT_MOTOR_DIRECTION_PIN = 'A4'
RIGHT_MOTOR_PWM_CHA... |
from collections import defaultdict, deque, namedtuple
from enum import Enum
from fractions import Fraction
from re import Pattern, compile
from typing import DefaultDict, Deque, Iterable, Mapping, Sequence, Tuple, Union, List
from pytest import mark, raises
from records import (Annotated, CallCoercion, ClassMethodCo... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 18 00:38:17 2019
@author: yifan
"""
'''
Energy Evaulation function given a super cell
'''
import os
import json
import pickle
import random
import numpy as np
from ase import Atom, Atoms
from ase.build import surface
from ase.data import covalent_radii
from ase.io impor... |
#!/usr/bin/env python3
"""
Copyright (c) 2019 Antmicro
Renode platform definition (repl) and script (resc) generator for LiteX SoC.
This script parses LiteX 'csr.csv' file and generates scripts for Renode
necessary to emulate the given configuration of the LiteX SoC.
"""
import sys
import csv
import zlib
import argp... |
import os
import numpy as np
import cv2
import random
import math
from train_config import config as cfg
######May wrong, when use it check it
def Rotate_aug(src,angle,label=None,center=None,scale=1.0):
'''
:param src: src image
:param label: label should be numpy array with [[x1,y1],
... |
import argparse
import bisect
import bz2
import calendar
from datetime import datetime
from glob import glob
import gzip
import logging
import netCDF4
import numpy as np
import os
import shutil
import urllib.request
import warnings
#-----------------------------------------------------------------------... |
import os
import sys
import unittest
sys.path.insert(1, os.path.join(sys.path[0], '..'))
from misc import remove_file, copy_file, which
print(sys.version)
# @unittest.skip("skipping dsr_complete_runs_Test ")
class dsr_complete_runs_ffit_Test(unittest.TestCase):
def setUp(self):
self.maxDiff = 20
... |
import nextcord as discord
from nextcord.ext import commands
from requests.models import PreparedRequest
from requests.exceptions import MissingSchema
from compile import filter_graves
from yaml import safe_load, safe_dump
import traceback
import asyncio
import External_functions as ef
SUPER_AUTHOR_ID = 4328011631262... |
#!/usr/bin/env python
VERSION_STR = 'v0.1'
import os
import shutil
import re
import wx
import wx.grid as grid
import pyfits
DEFAULT_TOKENS = ['OBJECT', 'FILTER', 'EXPTIME', 'DATE-OBS', 'FOCUSPOS', 'AIRMASS']
TOKENS_LIST = ['OBJECT', 'FILTER', 'EXPTIME', 'DATE-OBS', 'ORIGIN', 'TELESCOP', 'COMMENT', 'OBSERVER', 'PRIO... |
import torch
import torch.nn as nn
import utils
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
########################################################################
# models
########################################################################
class Encoder(nn.Module):
"""
the ... |
import os
import sys
import time
import codecs
import lyrebird
import threading
import subprocess
from pathlib import Path
from . import config
from lyrebird.log import get_logger
"""
Android Debug Bridge command helper
Basic ADB command for device_service and API
"""
logger = get_logger()
here = os.path.dirname(__... |
"""Test the cross_validation module"""
import numpy as np
from scipy.sparse import coo_matrix
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import ... |
# 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 writing, software
# distributed under th... |
import math
import random
import numpy as np
from PIL import Image
from utils.bbox_tools import calc_iou1
from .base_internode import BaseInternode
__all__ = ['RandomCrop', 'AdaptiveRandomCrop', 'AdaptiveRandomTranslate', 'MinIOUCrop', 'MinIOGCrop', 'CenterCrop', 'RandomAreaCrop']
class RandomCrop(BaseInternode):
... |
import numpy as np
import numpy_indexed as npi
from collections import namedtuple
from scipy.stats import f
from mathpy._lib import _create_array
from mathpy.stats.summary import var
def anova_oneway(group, x, *args):
r"""
Performs one-way analysis of variance (ANOVA) of one measurement and a ... |
#!/usr/bin/python3
"""
Date: 23/02/2021
Based on Marcely's EPAC_slicer
Author: Marcely
Adaptation: <NAME>
1. retrieves the metadata sentence information
2. load the corresponding audio
3. slice the audio into sentences
4. updates the corpus json file
"""
import glob, argparse
import xml.dom.minidom
#requires pip3 i... |
# -*- mode: Python; indent-tabs-mode: t; tab-width: 4 -*-
# vim: noet:ci:pi:sts=0:sw=4:ts=4
#!/usr/bin/env python
#
# author: <NAME>
# date: 2019.5.3
# ver2.0
import os
import sys
import re
import math
import numpy as np
import pickle
import string
from nltk.stem import WordNetLemmatizer
from nltk.stem.snowball im... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""Read the SEDRA database
The files of the SEDRA database have been are no longer
available from bethmardutho.org, but a copy is available
in the sedrajs project of <NAME> on github.com/peshitta.
It contains the following files:
SEDRA3.DOC - documentation of the databas... |
import os,sys,logging
try:
caffe_root = '../../../caffe_train/'
sys.path.insert(0, caffe_root + 'python')
import caffe
except ImportError:
logging.fatal("block_lib.py Cannot find caffe!")
from caffe import layers as L
from caffe import params as P
from caffe.proto import caffe_pb2
from caffe.utils impor... |
#!/usr/bin/env python3
#
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP.
# Licensed under the Apache v2.0 license.
#
import os
import re
import sys
import copy
import json
import pprint
# =================================================================================================================... |
import re
import json
from copy import copy
from typing import Union, List
from pathlib import Path
import logging
from traitlets.config import Config
from nbconvert import HTMLExporter, PDFExporter
import nbformat
from nbformat.v4 import new_notebook, new_code_cell, new_markdown_cell, new_raw_cell
from .tools import ... |
"""Provides tools for interactive visualizations.
Example use
-----------
The functions in this module are used to create Bokeh-based visualization
widgets. For example, the following code will create an interactive
visualization widget showing the pixel data and a lightcurve::
from lightkurve import KeplerTarge... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 10:59:02 2020
@author: cheritie
"""
import inspect
import numpy as np
from AO_modules.phaseStats import makeCovarianceMatrix,ft_phase_screen
from AO_modules.tools.tools import emptyClass,translationImageMatrix,globalTransformation, createFolder
im... |
#coding:utf-8
"""
python 3.6
tensorflow 1.3
By LiWenDi
"""
#使用DCGAN网络架构,卷积/逆卷积成64x64x3的图像
#使用了学习率指数下降
import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
import os.path
import cv2
import random
import time
toTrain = True #训练模式
toTest = False #输出模式
toContinueTrain = True #训练模式下继续上次的训练
toShuffle =... |
#
# Sudoku Game
# by <NAME>
# 31 October 2021
# This program uses Sudoku_solver.py and pygame to make a Sudoku game with various features
#
import copy
import datetime
from Sudoku_solver import Sudoku
from Sudoku_solver import get_square_coors
import pygame
import sys
import time
import random
# Pygame window setup
p... |
# -*- coding: utf-8 -*-
from pathlib import Path
import os
import argparse
import logging
from camel_tools.utils.charsets import UNICODE_PUNCT_CHARSET
import pandas as pd
import re
from funcy import log_durations
from camel_tools.utils.normalize import normalize_unicode
# punctuation set used in tokenize_hyph, which s... |
"""
Copyright 2018 IBM 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 ag... |
# [https://forum.11l-lang.org/threads/supported-modules.10/#post-20]
""" EXS24 to SFZ sample library metadata converter.
Might work. Might awaken some forgotten trickster goddess and lure her to your computer. Enjoy.
Copyright (c) 2013, vonred
Permission to use, copy, modify, and/or distribute this softw... |
from __future__ import annotations
import math
import pathlib
from dataclasses import field
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
import apischema
import lark
from . import transformer
from .common import (DatabaseDevice, DatabaseMenu, LinterError, LinterWarning,
PV... |
"""
specter.util.pixspline
======================
Pixel-integrated spline utilities.
Written by <NAME>, <NAME>, 2010-2013.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import numbers
import numpy as np
from scipy import linalg as la
from scipy import sparse as sp
from scipy ... |
# -*- coding: utf-8 -*-
# public api to export
__all__ = [
'camel_case_to_snake',
'snake_case_to_camel',
'reverse',
'shuffle',
'strip_html',
'prettify',
'asciify',
'slugify',
'booleanize',
'strip_margin',
'compress',
'decompress',
'roman_encode',
'roman_decode',
... |
from mxnet.symbol import _internal
from mxnet import symbol as _sym
from mxnet import ndarray as nd
import mxnet as mx
import nnvm
import logging
import json
import math
INT32_MIN, INT32_MAX = -2147483647, 2147483647
INT8_MIN, INT8_MAX = -127, 127
INT8_TYPE, INT32_TYPE= ('int8', 'int32')
def is_op(sym, params):
... |
# Copyright 2007 <NAME>
# Portions Copyright 2007 Google 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 applic... |
#
# GitHub3Helper.py
#
#
# TODO: User, Organization, Repository instead of user, org, repo
# TODO: totally remove "repo"
"""
package oompa.tracking.github
"""
import json
import os
import sys # XXX use logging system, instead of sys.stderr
import time
# for readme-cleaning
import re
import github3
fro... |
# -*- coding: utf-8 -*-
# Copyright 2018 <NAME> and Check Point Software Technologies, Ltd. 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.or... |
import copy
import json
import os
import random
import re
import requests
import serial
import sys
import time
import urllib3
import logging
logging.basicConfig(
format="%(asctime)-15s %(levelname)-8s : %(message)s",
level=logging.WARNING
)
logger = logging.getLogger()
############
#
# CONFIGURABLES
#
#UR... |
import os
import os.path as op
from ..externals.six.moves import cPickle as pickle
import glob
import warnings
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from nose.tools import assert_true, assert_raises
from mne.datasets import sample
from mne import (label_time_course... |
from django.shortcuts import render,HttpResponse
from all_models.models import *
from apps.common.func.WebFunc import *
import openpyxl,xlrd,json,platform
from django.http import StreamingHttpResponse
from urllib import parse
from apps.ui_task.services.PageObjectService import PageObjectService
from apps.version_mana... |
#!/usr/bin/env python
from peyotl.utility.tokenizer import NewickEvents
from peyotl.utility import get_logger
import sys
_LOG = get_logger(__name__)
def _write_node_info_newick(out, node, **kwargs): # TODO
"""writes a label other info (e.g. branch lengths) based on
kwargs:
#TODO
"""
out.writ... |
"""This script explore StyleGAN inversion of real photoes
And photo editting using it"""
import os
from os.path import join
import torch, numpy as np
from torch.optim import Adam, SGD
import torch.nn.functional as F
from torchvision.transforms import Resize, ToTensor
import matplotlib.pylab as plt
from GAN_utils import... |
# -*- coding: utf-8 -*-
import numpy as np
# import scipy.ndimage
from scipy.stats import rv_continuous
from ..types import transformationType
def makeGaussian(x, y, x0, y0, sx, sy, rho, A):
num = (
(x - x0) ** 2 / sx ** 2
- 2 * rho / (sx * sy) * (x - x0) * (y - y0)
+ (y - y0) ** 2 / sy... |
# Copyright (c) 2012-2013 <NAME> http://garnaat.org/
# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# 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 r... |
import json
import os
from datetime import datetime
from no_known_allergies import no_known_allergies
from general_observation import GeneralObservation
from docs import fetch_document
from patient import Patient
from vitals import VitalSigns
from encounter ... |
from django.conf import settings
from django.shortcuts import redirect, render
from django.contrib.auth import login, authenticate
from django.contrib.auth.views import PasswordChangeView, PasswordResetView
from django.utils.translation import gettext as _
from django.utils.translation import get_language
from django.u... |
import enum
import io
import os
from minikerberos.protocol.constants import EncryptionType
from minikerberos.protocol import encryption
from minikerberos.crypto.hashing import md5, hmac_md5
from minikerberos.crypto.RC4 import RC4
#TODO: RC4 support!
# https://tools.ietf.org/html/draft-raeburn-krb-rijndael-krb-05
# h... |
# Copyright (C) 2019-2020, TomTom (http://tomtom.com).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os.path
import random
from io import BytesIO
import cv2
import numpy as np
import torchvision.transforms as transforms
from PIL import Image
from data.Load_Bigfile import BigFileMemoryLoader
from data.base_dataset import BaseDataset, get_... |
# General Imports
import numpy as np
from pathlib import Path
import typing
from PIL import Image
# Project Modules
from torchvision.transforms import transforms
from src.model.FaceNet import FaceNet
# Streamlit Imports
import streamlit as st
import load_css
# Pytorch
import torch
load_css.local_css("style.css")... |
"""
This script originates from another StyleGAN2 PyTorch implementation:
https://github.com/Tetratrio/stylegan2_pytorch/
Some parts were modified or adapted to work with the current implementation, others are
direct copies of the original code.
Original files:
- run_convert_from_tf.py,
- stylegan2/utils.py
Copyr... |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 14 13:26:12 2018
@author: klowell
"""
#%%
#############################################################################
# This program gets the spatial deviation of a set of points from a flight
# path. It gets the direction of a flight path and provides metri... |
# Copyright 2020 <NAME>. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the follow... |
"""
Created on April, 2018
@author: <NAME>
pytorch network utils
"""
import torch
import torch.nn as nn
import numpy as np
import copy
PI = 3.141592653589793
def conv(in_plane, out_plane, kernel_size, stride):
"""
conv2d layer with same padding
:param in_plane:
:param out_plane:
:param kernel_... |
# Lottery was created by Redjumpman for Redbot
# This will create 2 data folders with 1 JSON file
import os
import asyncio
import random
import discord
from discord.ext import commands
from .utils.dataIO import dataIO
from .utils import checks
from __main__ import send_cmd_help
class Lottery:
"""Ho... |
from functools import reduce
from collections import OrderedDict
from .modmass import ModifiedPeptideMassCalculator, ModInfo, ModSite
from .pepmass import FragmentTypeInfo
class GlycanNode:
def __init__(self, monosaccharide, children=None):
self.monosaccharide = monosaccharide
self.children = chil... |
from re import X
from dash import Dash, dcc, html, Input, Output
import dash_bootstrap_components as dbc
import pandas as pd
import altair as alt
import os
alt.data_transformers.disable_max_rows()
# import data
# absolute path to this file
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
# absolute path to this ... |
import sys
import torch
import torch.nn as nn
from torch.optim import Adam
# from torch.autograd import Variable
import torch.nn.functional as F
import numpy as np
import os
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
device2 = torch.device("cuda:0" if torch.cuda.is_available() else "cpu"... |
#!/usr/bin/python3
"""The file contains helpers for lowering code
Lowering refers to local rewrites that affect individual instruction
with the purpose of making code generation easier or improve
the performance of code.
Examples:
* classical strength reductions, replaces complex instructions by
simple one... |
import geopandas as gpd
import pandas as pd
import time
import os
from simpledbf import Dbf5
from datetime import datetime
import colorama
colorama.init()
start_time = time.time()
last_time = time.time()
def timer():
global start_time
old_time = start_time
start_time=time.time()
return start_time-old_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.