text stringlengths 3.07k 12.6k |
|---|
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import PySimpleGUI as sg
#----------------------------Setup---------------------------------------------#
# Lets make our plots pretty, we are not hooligans.
CB91_Blue = '#2CBDFE'
CB91_Green = '#47DBCD'
CB91_Pink = '#F3A0F2'
CB... |
"""preactresnet in pytorch
[1] <NAME>, <NAME>, <NAME>, <NAME>
Identity Mappings in Deep Residual Networks
https://arxiv.org/abs/1603.05027
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
class SepConv(nn.Module):
def __init__(self, channel_in, channel_out, kernel_size=3, stride=2... |
#
#The MIT License (MIT)
#
#Copyright (c) 2014 ishidourou
#
#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, me... |
import os
import numpy as np
import random
from math import isclose
from modelZoo.DyanOF import creatRealDictionary
import torch
import matplotlib.pyplot as plt
from modelZoo.DyanOF import OFModel, fista
from torch.autograd import Variable
import torch.nn
def gridRing(N):
# epsilon_low = 0.25
# epsilon_high =... |
from typing import Union
import arcade
from arcade import View, Window, SpriteSolidColor
from arcade.gui import UILabel, UIElement, UIFlatButton
from arcade.gui.layouts import UILayout
from arcade.gui.layouts.box import UIBoxLayout
from arcade.gui.layouts.manager import UILayoutManager
from arcade.gui.layouts.utils im... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import os
import datetime
import argparse
import numpy as np
import h5py
import cv2
import turret
import turret.caffe
import turret.layers as L
MAX_BATCH_SIZE = 128
WORKSPACE_SIZE = ... |
from django.db import models
# Create your models here.
YEAR = (
('Second', 'Second'),
('Third', 'Third'),
('Fourth', 'Fourth'),
)
MODE = (
('Online', 'Online'),
('Offline', 'Offline'),
)
STATUS = (
('Upcoming', 'Upcoming'),
('Past', 'Past'),
('Live', 'Live'),
)
ASTAT = (
('Pendi... |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
import requests
from .models import Member, Marker
REST_API_KEY = '' #์ฑ์ REST API ํค๋ฅผ ์
๋ ฅํ์ธ์.
REDIRECT_URL = 'http://127.0.0.1:8000/login_request'
def index(request):
session_id = ''
if request.session... |
#!/usr/bin/env python
from __future__ import print_function
import io
import json
import os
from .resource_wrapper import AbstractResourceWrapper
from .util import OutFile
import logging
_LOG = logging.getLogger(__name__)
def read_resource_file(fp):
try:
with io.open(fp, 'rU', encoding='utf-8') as inp:
... |
import os
import socket
from OpenSSL import crypto, SSL
# OpenVPN is fairly simple since it works on OpenSSL. The OpenVPN server contains
# a root certificate authority that can sign sub-certificates. The certificates
# have very little or no information on who they belong to besides a filename
# and any required info... |
import graphviz
import itertools
import json
from itertools import chain, product
from typing import Dict, NamedTuple, Optional, Set, Tuple
Symbol = str
State = str
class DFA(NamedTuple):
alphabet: Set[Symbol]
states: Set[State]
initial_state: State
transitions: Dict[Tuple[Symbol, State], State]
... |
"""CSC110 Fall 2020 Assignment 2, Part 2: Conditional Execution
Instructions (READ THIS FIRST!)
===============================
This Python module contains your work for Part 2, Question 3. We have provided the functions
from the handout already, and you must NOT change these. Below them, we've provided one
sample (i... |
import os
from abc import abstractmethod
from urllib.parse import urlparse
from bs4 import BeautifulSoup
from flask import g
from flask.testing import FlaskClient
from flask_dance.consumer.storage import MemoryStorage
from requests import Response
from sentiment.classify.sentiment import Sentiment
from sentiment.web ... |
#!/usr/bin/env python3
import os
import time
import timeit
import numpy as np
from numba import njit
import matplotlib.pyplot as plt
from scipy.optimize import bisect
import pandas as pd
def main():
"""
goal: define a new operation on a 2d numpy ndarray of waveforms
"""
# example_1()
# example_2()
... |
# Builin
import os
import sys
import subprocess
import logging.handlers
import json
import socket
if sys.version_info[0] == 2:
from SocketServer import ThreadingMixIn
from SimpleXMLRPCServer import SimpleXMLRPCServer
else:
from socketserver import ThreadingMixIn
from xmlrpc.server import SimpleXMLRPCS... |
from django.shortcuts import render,HttpResponse
from mp.models import Notices,Config,Navigate,About,Countdown
import json
import time,datetime
from pytz import timezone
import requests
cst_tz = timezone('Asia/Shanghai')
def index(request):
return HttpResponse('mp_index here')
def importantNotice():
if Notic... |
"""Generate the Go code to parse and serialize a mapry object graph."""
import collections
import re
from typing import List, Set
import icontract
from icontract import ensure
import mapry
import mapry.naming
WARNING = "// File automatically generated by mapry. DO NOT EDIT OR APPEND!"
def comment(text: str) -> str... |
import pandas as pd
import numpy as np
import requests
import json
'''
Author: <NAME>
Purpose: This program will geocode address in downtown detroit to specific x,y coordinates
Input: an excel table with address column(s)
ADDITIONAL FIELDS:
1. x,y: longitude and latitude OF the GEOCODing result(came from Google API)
... |
import HDPython as hdp
from HDPython.v_entity import rising_edge
from HDPython.v_record import v_record
from HDPython.base import v_copy, architecture, end_architecture
import HDPython.examples as hdp_ex
from .helpers import Folders_isSame, vhdl_conversion, do_simulation,printf, printff
from HDPython.test_handler ... |
import configparser
import os
import sys
import png
import math
import shutil
import string
import random
config = configparser.ConfigParser()
config.read(os.path.join(os.path.dirname(__file__), 'config.ini'))
MODELS_DIRECTORY = os.path.join(config['DIRECTORIES']['LOGIC'], config['DIRECTORIES']['MODELS'],
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 1 13:22:21 2021
@author: mike
"""
import numpy as np
import pandas as pd
############################################
### Parameters
############################################
### Functions
def grp_ts_agg(df, grp_col, ts_col, freq_code, agg... |
import re
from typing import Any, Dict, List
from loguru import logger
from spacy.language import Language
from spacy.tokens import Doc, Span
from edsnlp.matchers.utils import get_text
from edsnlp.pipelines.core.matcher import GenericMatcher
from edsnlp.utils.filter import filter_spans
class AdvancedRegex(GenericMa... |
#!/usr/bin/python
#
# This examines antenna requested and actual position values
# to determine Stats .
#
# <NAME>
# 7 December 2017
#
import optparse
import pickle
import numpy as np
import katdal
def haversine(az1, el1, az2, el2):
"""
Calculate the great circle distance between two points
(az1, el1) ... |
import os
import sys
import numpy as np
import torch
import argparse
from tqdm import tqdm
BASEPATH = os.path.dirname(__file__)
from os.path import join as pjoin
sys.path.insert(0, BASEPATH)
sys.path.insert(0, pjoin(BASEPATH, '..'))
import foot_sliding.BVH as BVH
from foot_sliding.InverseKinematics import JacobianInve... |
# Copyright 2021 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, ... |
# uncompyle6 version 3.3.5
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
# Embedded file name: c:\Jenkins\live\output\win_64_static\Release\python-bundle\MIDI Remote Scripts\Push2\drum_pad_parameter_component.py
# Compiled at: 2019-04-23 16:19... |
import logging
import re
import sys
from utterance_aligner import UtteranceAligner
def get_indexs(utterance, span):
tokens = re.split('\s+', utterance)
span_tokens = re.split('\s+', span)
for i in range(len(tokens) - len(span_tokens) + 1):
match = True
for j, span_token in enumerate(span_... |
import numpy as np
import miccs.miccs as mx
def _generate_lambda_glasso(bin_num, lambda_glasso, offset, lambda_diag=None):
lambda_glasso_out = np.full((bin_num, bin_num), -1) + (1+lambda_glasso) * \
(np.abs(np.arange(bin_num) - np.arange(bin_num)[:,np.newaxis]) <= offset)
if lambda_diag:
lam... |
#!/usr/bin/env python
''' py.test configuration and fixtures file.
Tells application she's running in a test environment.
Creates a complete web2py environment, similar to web2py shell.
Creates a WebClient instance to browse your application, similar to a real
web browser.
Propagates some application data to test case... |
#! /usr/bin/env python
"""This module contains utility functions related to source catalogs
"""
import os
from astropy.io import ascii
import numpy as np
from mirage.utils.constants import IMAGING_ALLOWED_CATALOGS, WFSS_ALLOWED_CATALOGS, \
TS_IMAGING_ALLOWED_CATALOGS, TS_GRISM_ALLOW... |
from flask_sqlalchemy import model
from . import db
from flask_login import UserMixin
from sqlalchemy.orm import validates
import datetime, string, random, requests
import os
TXN_MESSAGES = dict(
ADD='Money added to Wallet',
WITHDRAW='Money withdrawn from Wallet',
PAID_TO='Money transfer to',
RECEIVED_... |
_debug=True
_debug=False
_normal_file=True
import os
import re
from time import sleep as slp
import json
import base64
def logw(pth:str,s:str):
return open(pth,'ab').write(s.encode('utf8','backslashreplace')+b'\n')
sh_log=None
def sh(od:str,o_log:str=None)->int:
od+=' 1>register_1.log 2>register... |
import os
from typing import Tuple, Optional
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as nnf
import torchvision
from pytorch_lightning.utilities.types import TRAIN_DATALOADERS, EVAL_DATALOADERS
from torch.utils.data import random_split, DataLoader
from torchvision.mo... |
"""
@ Author: ryanreadbooks
@ Time: 9/4/2020, 19:51
@ File name: metrics.py
@ File description: some metric functions for calculating the scores
"""
import math
from typing import Tuple
import numpy as np
from utils import project_3d_2d, transform_pts
import scipy.spatial as scipy_spatial
def mask_iou(pred: np.ndar... |
"""
Here will go the routines that are used to visualize the
clustering in time
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from mpl_toolkits.axes_grid1 import make_axes_locatable
from .aux import linear_to_matrix_pairs
def visualize_time_cluster_matrix(nexa_object,... |
# Copyright 2012-2013 OpenStack Foundation
#
# 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 la... |
#!/usr/bin/env python3
#
# Script to teach the basics of linux to someone who has never used it before
#
# Author: <NAME>
#
# www.github.com/sebrink/intro2linux
#
import sys,os,signal
from subprocess import check_output
# Color codes
redStart = "\033[91m"
redEnd = "\033[00m\u001b[0m"
greenStart = "\033[92m"
greenEnd ... |
import numpy as np
import torch
from nmtg.data.dataset import Dataset
from nmtg.data.text_lookup_dataset import TextLookupDataset
class ParallelDataset(Dataset):
def __init__(self, src_data: TextLookupDataset, tgt_data: TextLookupDataset=None, src_lang=None, tgt_lang=None):
self.src_data = src_data # te... |
from tkinter import *
from get_extra_info import *
root = Tk()
# create window for my program
root.geometry('600x650')
# save spinbox to have access to them from diff funcs
spinbox_dict = {}
# save blocks (for matrix) object to be able destroy it in future
blocks = []
# main matrix (array in array in array)
matrix =... |
__author__ = "<NAME>"
__email__ = "<EMAIL>"
# TODO: Optimise Imports
import os
import sys
import shutil
import tarfile
from gevent.pool import Pool
from tempfile import TemporaryFile
import warnings
import traceback
warnings.filterwarnings('ignore')
from spleeter.separator import Separator
from spleeter.model.provide... |
#################################################################
# falcon-player-controller-uploadr #
# Copyright (c) 2017 atomicnumber1 #
#################################################################
import os
import subprocess
import logging
import logg... |
# Sticky Hands, by <NAME> <EMAIL>
# A jewel-stealing, movement puzzle game.
# Inspired by Herding Cats https://w.itch.io/herding-cats
# TODO - Enter R to reset the entire level.
import copy, os, sys
# Setup the constants:
WALL = chr(9608)
FACE = chr(9786)
DIAMOND = chr(9830)
CHAR_MAP = {'#': WALL, '@': FACE, '$': DI... |
'''
code for preparing and loading dataset for the SET game
'''
### imports
import os
import numpy as np
import pandas as pd
import logging
from pathlib import Path
from tensorflow.keras.preprocessing.image import ImageDataGenerator
# dataset path
dataset_path = Path(os.path.dirname(os.path.abspath(__file__))) / "d... |
#
# ARCADIA Mocks
#
# Copyright (C) 2017 SINTEF Digital
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
#
from arcadiamock import __VERSION__, __SERVICE_NAME__, __LICENSE__
class Store(object):
def __init__(self, ... |
import tensorflow as tf
from MemNN.output import g_q_single_question, candidate_generation
import random
def normalize_vector(vector_to_normalize):
norm = tf.sqrt(tf.reduce_sum(tf.square(vector_to_normalize), 1, keep_dims=True))
normalized_vector = vector_to_normalize/norm
return normalized_vector
def cos... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 23 22:16:49 2020
@author: bing
Entangled two-photon absorption
"""
import numpy as np
from numpy import exp, pi, sqrt
from lime.phys import lorentzian
from lime.units import au2ev, au2angstrom
def ETPA(omegap, E, edip, Te, g_idx=[0], e_idx=[],... |
#!/usr/bin/env python
# Copyright (c) 2012 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.
""" Source file for floating builder testcases."""
import calendar
import datetime
import itertools
import os
import time
import u... |
#!/usr/bin/env python
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
import renderapi
from asap.module.render_module import SparkModule
from asap.pointmatch.schemas import (
PointMatchClientParametersSpark, PointMatchClientOutputSchema)
if __name__ == "__main__" a... |
import os
import matplotlib.pyplot as plt
import numpy as np
import serpentTools as st
def reactivity(keff, keffError):
reactivityArray = (keff - 1) / keff * 1e5
reactivityArray_error = keffError / keff * 1e5
return [reactivityArray, reactivityArray_error]
def OLSfit(x, y, dy=None):
"""Find the best... |
import byt2str
import unittest
from test import support
class ConvertTest(unittest.TestCase):
def test_min(self):
# Check that the "convert" min range is correct.
self.assertEqual(byt2str.convert(1), '1 Byte')
with self.assertRaises(AssertionError):
byt2str.convert(0)
def ... |
#!/usr/bin/env python
# filename: stash_repo_builder.py
#
# desc: First run, it will generate repo template as initial template,
# after this it will generate latest repo template. and then it will compare
# initial repo template and latest repo template and write differences into html.
#
import os
import sys
import d... |
from tensorflow.keras.layers import Input, Dense, Dropout, Activation, Concatenate, BatchNormalization
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Conv2D, GlobalAveragePooling2D, AveragePooling2D
from tensorflow.keras.regularizers import l2
def DenseNet(input_shape=None, dens... |
# -*- coding: utf-8 -*-
"""
Convert a Cellebrite Reader UFDR file to it's original directory structure.
MIT License.
"""
# Imports
import argparse
import logging
import re, io, os
import signal
import platform
import shutil
from pathlib import Path
from pathlib import PurePath
from zipfile import ZipFile
__software... |
from scripts.usefullFunctions import *
import ssp.models as t
import json
import os
import shutil
import sys
added_nist_controls = 0
updated_nist_controls = 0
control_baseline = t.control_baseline
def break_up_catalog(file_path, file_name):
"""
Takes an OSCAL Catalog file and breaks it into seperate json file... |
# -*- coding: utf-8 -*-
#
# Webbib
#
"""
:copyright: (c) 2010-2012 by <NAME>.
"""
from flask import Flask, render_template, url_for, request, Response
from flask import session, abort
from flaskext.babel import gettext
from webbib import app, babel, set_source
from lxml import etree
import codecs
import bibmod
impo... |
#!/usr/bin/python
import os,sys
import pathlib
import shutil
from os.path import expanduser
columns = shutil.get_terminal_size().columns
reduced_size = 0
dirty_dirs = {"่ฟ
้ทไธ่ฝฝ":r"C:\ProgramData\Thunder Network\XLLiveUD\Download",
"Pycharm":os.path.join(expanduser("~"), "AppData\Local\JetBrains\PyCharm2... |
import logging
import re
from flatten_json import flatten
import archiver.ena
from archiver import biostudies, ena, biosamples
from archiver.dsp_post_process import dsp_attribute, fixed_dsp_attribute
from archiver.instrument_model import to_dsp_name
from conversion.json_mapper import JsonMapper, json_array, json_obje... |
import glob
import os
import lxml.etree as ET
import pandas as pd
import collatex
from collatex.core_functions import export_alignment_table_as_tei
from datetime import datetime
from acdh_xml_pyutils.xml import XMLReader
from . chunks import get_chunks
from . collatex_patch import visualize_table_vertically_with_colo... |
import sys
from matplotlib import axes
from matplotlib.figure import Figure
from PyQt5 import QtCore, QtWidgets
from scipy import constants as Cn
from Solver import Projectile
from ui import Ui
# Constants
#yapf: disable
t : float = 0
dt : float = 0.005
A : float = 4e-5
B ... |
import category_encoders
from category_encoders.one_hot import OneHotEncoder
class Preprocess:
def __init__(self, dataframe):
self.df = dataframe
def initial_column_drop(self, dataframe):
dr_columns = [
'release_pos_x', 'release_pos_z',
#might want to keep bb_type an... |
import arcade
# Constants
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 650
SCREEN_TITLE = "Platformer"
CHARACTER_SCALING = 2.0
TILE_SCALING = 2.0
COIN_SCALING = 2.0
PLAYER_MOVEMENT_SPEED = 5
PLAYER_JUMP_SPEED = 15
GRAVITY_CONSTANT = 0.5
LEFT_VIEWPORT_MARGIN = 250
RIGHT_VIEWPORT_MARGIN = 250
BOTTOM_VIEWPORT_MARGIN = 50
TOP_... |
from discord.ext import commands
import asyncio, discord
from modules import paylak
class PayLak(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.music_guilds = {}
def find_objects(self):
guilds = self.bot.guilds
for guild in guilds:
self.music_guilds[guild.id] = paylak.MusicGuild... |
#!/usr/bin/env/python
"""
This is a fork from sphinx-execute-code
Available options:
'linenos': directives.flag,
'output_language': directives.unchanged,
'hide_code': directives.flag,
'hide_headers': directives.flag,
'filename': directives.path,
'hide_filename': directiv... |
import gzip
import json
from utils import datautils
VALUE_UNKNOWN = 'UNKNOWN'
def get_value_of_language(value_dict, language='en'):
lan_val = value_dict.get(language, None)
if type(lan_val) == list:
all_vals = list()
for lv in lan_val:
v = lv.get('value')
if v is not N... |
# -*- coding: utf-8 -*-
"""Tests for imfusion.expression.test module."""
# pylint: disable=wildcard-import,redefined-builtin,unused-wildcard-import
from __future__ import absolute_import, division, print_function
from builtins import *
# pylint: enable=wildcard-import,redefined-builtin,unused-wildcard-import
import p... |
import json
import numpy as np
import pickle
import random
import tensorflow as tf
import tensorflow_datasets as tfds
from tensorflow import keras
from tensorflow.keras.models import Sequential, Model
from tqdm import tqdm
from PIL import Image
# model_path = "/home/ec2-user/gan_submission_1/mnist/mnist_v2/model_k... |
# 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... |
# -*- coding: utf-8 -*-
from fenics import *
import numpy as np
import matplotlib.pyplot as plt
import time
#Mesh, Function space, solver initilization
mesh = UnitSquareMesh(128, 128)
V = FunctionSpace(mesh, "CG", 1)
#V = FunctionSpace(mesh, 'P', 1)
#Dirichlet boundary condition
yb = Constant(0)
def Boun... |
# Copyright (C) 2021 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... |
"""Module for generating reports on the results of input files.
.. important::
While this should work generally, autojob is currently tested on the
following types of code: FEFF 9.9.1, VASP 6.2.1, and the default CONFIG
assumes these code versions.
"""
from collections import Counter
from pathlib import ... |
from pathlib import Path
from random import choice
from statistics import mean
from typing import Any, Counter
import typer
from click import Choice as click_Choice
from tqdm import tqdm # type: ignore
from typer import echo as typer_echo
from typer import prompt as typer_prompt
from typer import secho as typer_secho... |
import numpy as np
import pandas as pd
import gensim
import re
from sklearn.model_selection import train_test_split
from keras.models import load_model
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
filename = 'tweet_global_warming.csv'
df = pd.read_csv(filename,... |
# Copyright (c) 2020 DDN. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
import logging
import operator
from django.db import models, transaction
from polymorphic.models import DowncastManager
from polymorphic.models import PolymorphicMetacl... |
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.db.models import DecimalField, Sum
from django.db.models.functions import Coalesce
from django.utils.translation import ugettext as _
from mptt.admin import TreeRelatedFieldListFilter
from rangefilter.filter import Date... |
import sys
import numpy as np
import matplotlib.pyplot as plt
from collections import namedtuple
def get_size(obj, seen=None):
"""Recursively finds size of objects"""
# this is old code
# size = sys.getsizeof(obj)
# this is modified to properly work with ndarray views
size = 0
if not isinstan... |
import argparse
import json
import os
import shutil
import sys
import logging
import zipfile
import uuid
from zipfile import ZIP_DEFLATED
from urllib.parse import quote
parser = argparse.ArgumentParser("Take a directory of bdio files, copy and unzip each file,"
"update the project and ... |
from itertools import product
import numpy as np
from numpy.linalg import lstsq
from numpy.testing import assert_allclose
import pandas as pd
import pytest
from linearmodels.panel.data import PanelData
from linearmodels.panel.model import FamaMacBeth
from linearmodels.shared.exceptions import (
InferenceUnavailab... |
import inspect
import traceback
from enum import Enum
from functools import wraps
from http import HTTPStatus
from flask import abort, jsonify, make_response, request
from flask_sqlalchemy.model import Model, camel_to_snake_case
from werkzeug.exceptions import HTTPException
from backend.utils import was_decorated_wit... |
import h5py
import numpy as np
import yaml
import warnings
from os import path
class Parameters:
"""
==================================================================================
==================================================================================
>> @AUTHOR: <NAME>, Lanwrence L... |
# BioPandas
# Author: <NAME> <<EMAIL>>
# License: BSD 3 clause
# Project Website: http://rasbt.github.io/biopandas/
# Code Repository: https://github.com/rasbt/biopandas
import numpy as np
from biopandas.pdb import PandasPdb
import os
def test_defaults():
TESTDATA_1t48 = os.path.join(os.path.dirname(__file__), '... |
#! /usr/bin/env python3
import functools
import itertools
import kak_socket
import os
import queue
import re
import select
import shutil
import signal
import sys
import textwrap
import threading
import time
import traceback
class KakException(Exception):
pass
def _gen_read_cmd(cmd, cmds):
print('def -hidde... |
import json
import time
from twisted.internet import reactor
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import protocol
from django.conf import settings
from evennia.server.session import Session
from twisted.application import internet
from evennia.utils.utils import to_str, mod_impo... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from util import calc_diffusion_step_embedding
def swish(x):
return x * torch.sigmoid(x)
# dilated conv layer with kaiming_normal initialization
# from https://github.com/ksw0306/FloWaveNet/blob/master/modules.py
class Conv(nn.Modu... |
from datetime import datetime
from onegov.core.orm.mixins import content_property, meta_property
from onegov.form import Form
from onegov.org import _
from onegov.org.forms import LinkForm, PageForm
from onegov.org.models.atoz import AtoZ
from onegov.org.models.extensions import (
ContactExtension, NewsletterExtens... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 28 14:40:35 2021
@author: utente
"""
#Functions that calculate the variance and the entropy, both phenotypic and genotypic
from random import sample, uniform
from scipy.spatial.distance import euclidean
import math
import numpy as np
def phen_variance(pop):
... |
#!/usr/bin/env python
# (c) <NAME>, 2016-2017
DESC="""Plot an IRIG-B signal read from stdin. Assumes that the timeseries
is a sequence of newline-delimited float literals."""
FAST_CHANNEL_BITRATE = 16384 # for IRIG-B, DuoTone, etc.
# THE REST OF THE IMPORTS ARE AFTER THIS IF STATEMENT.
# Quits immediately on --help ... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
"""
quantitize_weights.py - simple script to quantitize weights (not the model) to 8 bits.
"""
from __future__ import division
from __future__ import print_function
import argparse
import logging
import numpy as np
from onn... |
import enum
try:
# 2022.04 available starting Python 3.11. We're within a try/except
# with an alternative, ignore type.
from enum import StrEnum # type: ignore
except ImportError:
# Exists only starting Python 3.11
# Reimplement what we need from it here.
class StrEnum(str, enum.Enum): # typ... |
from django.shortcuts import render
from django.shortcuts import redirect
from django.template import RequestContext
from .forms import CaseForm
from cases.models import Case
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.shortcuts import get_object_or_404
fr... |
import torch.utils.data as utils
import torch.nn.functional as F
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn.parameter import Parameter
import math
import numpy as np
import pandas as pd
import time
class FilterMatrix(nn.Module):
def __init__(self, in_features, out_features... |
#!/usr/env/python3
# coding: utf-8
# ยฉ <NAME>
r""" Combines a tex file hierarchy into a single document file for arXiv.
The root tex file is read and all files included using '\input' tex commands are
inserted recursively.
During the process, all comments are stripped in a way that lines ending with
comments continu... |
import matplotlib.pyplot as plt
import altair as alt
alt.data_transformers.disable_max_rows()
import pandas as pd
import numpy as np
import os
from scipy.ndimage import gaussian_filter
def smooth_chrom(xs=[], ys=[], smooth_factor=1, source=None, filename=None, save_as=None):
'''
Function to smooth chromatogr... |
# -*- coding: ascii -*-
#
# Util/PEM.py : Privacy Enhanced Mail utilities
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, pe... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@file : metrics/ner.py
@author: <NAME>
@contact : <EMAIL>
@date : 2021/01/14 16:13
@version: 1.0
@desc :
"""
import torch
from typing import Any, List
from pytorch_lightning.metrics.metric import TensorMetric
class SpanF1ForNER(TensorMetric):
"""
compute ... |
#!/usr/bin/env python
#
# (C) Copyright 2012 Enthought, Inc., Austin, TX
# All right reserved.
#
# This file is open source software distributed according to the terms in
# LICENSE.txt
#
"""
To-Do List Example
------------------
This is a simple to-do list example illustrating the usage of encore.storage.
This example... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy as np
from functools import partial
from tqdm import tqdm
from utils import build_knns, knns2ordered_nbrs, Timer
"""
paper: https://arxiv.org/pdf/1604.00989.pdf
original code https://github.com/varun-suresh/Clustering
To run `aro`:
1. pip install p... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
# Copyright 2019 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License")
import time
import os
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class ScheduledOptim():
'''A simple wrapper class for learning rate scheduling'''
def __in... |
##########################################################################
#
# Taken with modifications from
# https://github.com/wjmaddox/swa_gaussian/
#
##########################################################################
import torch
from torch import nn, optim, autograd
from torch.nn import functional as ... |
import base64
from ....text.textstyle import TextStyle
from ....utils.geom import Rect, find_centroid
from .utils import apply_rotation
def set_font_from_style(xml, style):
if style.font is not None:
xml.set("font-family", style.font)
if style.size is not None:
xml.set("font-size", style.size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.