text stringlengths 6.04k 39.5k |
|---|
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import re
import numpy as np
import warnings
from functools import partial
from mmgroup.structures.abstract_mm_group import AbstractMMGroupWord
from mmgroup.structures.abstract_mm_group import AbstractMMGroup
f... |
# Copyright 2022 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""!/usr/bin/env python3.8"""
import io
import os
import tempfile
from typing import List, Optional
import unittest
from assembly import AssemblyInputBundle,... |
#!/usr/bin/env python
from google.protobuf.empty_pb2 import Empty
import grpc
from kama.acl import DEFAULT_ACLS
from kama import kama_pb2
from kama import kama_pb2_grpc
import kama.env
import kama.log
import collections
import argparse
log = kama.log.get_logger('kama.client')
KamaClientConfig = collections.namedt... |
#!/usr/bin/python
# Classification (U)
"""Program: mongo_db_data.py
Description: Program to either take a external JSON document and insert
into a Mongo database, delete a document from a Mongo database
collection based on passed key(s) and value(s), or truncate a
collection within a Mon... |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 22 20:26 2018
@author: Ryan
"""
# IMPORTS
# import tkinter
# from tkinter import *
# from tkinter import ttk
# import jsonpickle
class colEntry:
# Container for a single data unit
# (dataType string and dataValue, Value can be Table...)
def __init__(self):
... |
"""Contains a set of misc. useful tools for the compressive learning toolbox"""
import numpy as np
from scipy.stats import multivariate_normal
import matplotlib.pyplot as plt
############################
# DATASET GENERATION TOOLS #
############################
def generatedataset_GMM(d,K,n,output_required='dataset'... |
# https://pypi.org/project/cykooz.heif/
# Modified by <NAME> from https://shuangz.com/projects/materialgan-sa20/
import sys
import numpy as np
from matplotlib import pyplot as plt
import shutil
import cv2
import os
import pickle
import glob
import obj_points
from PIL import Image
sys.path.insert(1, 'materialGAN/src/')... |
#!/usr/bin/env python3
# Script to control LimitlessLED DualWhite, RGB+W and RGBWW/CW bulbs through v6 WiFi Bridge.
#
# <NAME>'s work for Domoticz has been a huge influence while making this script,
# which is tailored to be a CLI tool for integration with HA-bridge and Amazon Echo (Alexa).
#
# Requires Python 3.
#
# ... |
import sys
import os
import time
import importlib
import argparse
import numpy as np
import torch
from torch import nn, optim
from data import MonoTextData, VocabEntry
from modules import VAEIAF as VAE
from modules import VariationalFlow, LSTMDecoder
from logger import Logger
from utils import calc_mi, calc_au
clip_gr... |
from __future__ import print_function
import os
import subprocess
import time
import socket
import argparse
import random
import uuid
import base64
import hashlib
import urllib
import tornado.web
import tornado.websocket
import tornado.ioloop
import tornado.options
import tornado.httpserver
import tornado.gen
import ... |
import six
import numpy as np
import flops_counter
import flops_counter.nn.functional as F
import flops_counter.nn as nn
class Conv_Block(nn.Module):
def __init__(self, in_channels, out_channels, kernel_sizes, strides=None, paddings=None, with_pool=True):
super(Conv_Block, self).__init__()
assert ... |
# Group 3
# 03/04/2021
# screens.edit_player.py - the actual game of tetris. the game screen and all of the games features. basically the
# items that happen when you click play
# -- game() -- the game of tetris when X is hit the pause() function is called, when the game is lost the game
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Dell EMC OpenManage Ansible Modules
# Version 3.4.0
# Copyright (C) 2019-2021 Dell Inc. or its subsidiaries. All Rights Reserved.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
from __future__ import (absolute_import, divi... |
import os
import random
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
import torchvision.transforms as T
import torchvision
from torchvision import datasets, transforms
from stylegan_model import Generator, Encoder
from view_generator import VGGLoss
from functools import partia... |
import tensorflow as tf
import numpy as np
def positional_encoding(position, d_model):
"""Function that calculates the positional encoding.
Args:
position (int): Maximum position encoding (input or output).
d_model (int): Dimension of the model.
Returns:
tf.Tensor: Positional encoding ... |
from sys import platform
import os,sys
msg_help_column = "Written by junying, 2019-05-09 \
\nUsage: column [index] \
\nUsage2: column [index] [filename] \
\nEx1: cat a.txt | column [index] \
\nEx2: column 1 a.txt "
def column():
if len(sys.ar... |
import base64
import collections
import json
import warnings
from collections import defaultdict
import numpy as np
import torch
from PIL import Image, ImageDraw, ImageFont
from six import iteritems, iterkeys # pylint: disable=unused-import
import goalrepresent as gr
def save(object_instance, filepath="saved_objec... |
# Author: <NAME>
# Email:
# Code Adapted from <NAME>'s subject verb extract
#
## Instructions
# 1. download the large scispacy model for NER: https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.2.4/en_core_sci_lg-0.2.4.tar.gz
# 2. download en_core_web_sm model for POS
# !python -m spacy download en_core_w... |
import numpy as np
import time
from matplotlib.pylab import *
def generateSudoku():
attemptsIx = 0
isValid = False
while not isValid:
attemptsIx += 1
# print 'Generating Sudoku...'
template = np.zeros((9,9))
# loop over column
for columnIx in np.arange(0,9):
... |
import os
import time
import json
import uuid
from sqlite3 import connect
# Configuration
DATABASE_FILE = "database.db"
FILE_PATH = os.path.dirname(os.path.realpath(__file__)) + "/" + DATABASE_FILE
ROOT_ID = "root"
## Testing
RECREATE_ENTRIES = True
RECREATE_ENTRIES = False
# # # # # # #
# Interface #
# # # # # # #... |
#!/usr/bin/env python
# pyroute2 - ss2
# Copyright (C) 2018 <NAME>
#
# ss2 is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CTSegNet is more than a 2D CNN model - it's a 3D Segmenter that uses 2D CNNs. The set_utils.py defines the Segmenter class that wraps over a keras U-net-like model (defined by models.py), integrating 3D slicing and 2D patching functions to enable the 3D-2D-3D conversat... |
'''
tensorflow version r1.4
created by <NAME>, 2018.05.26
Copyright (c) 2018 DSPL Sungkyunkwan Univ
'''
import cv2 as cv
import os
import glob
from sklearn.utils import shuffle
import numpy as np
import random
import json
class tData:
def __init__(self, frame=-1, obj_type="unset", occlusion=-1, \
... |
import base64
import json
import os
import pytest
from cryptojwt import JWT
from cryptojwt import as_unicode
from cryptojwt.key_jar import build_keyjar
from cryptojwt.utils import as_bytes
from oidcmsg.oauth2 import TokenIntrospectionRequest
from oidcmsg.oidc import AccessTokenRequest
from oidcmsg.oidc import Authoriz... |
import copy
import os
from multiprocessing import Pool
from pathlib import Path
from typing import List
import fire
import numpy as np
COLOR_PALETTE = np.vstack(
[
np.array([0.8, 0.8, 0.8]),
np.array([0.6, 0.6, 0.6]),
np.array([0.31, 0.51, 0.74]),
np.array([0.75, 0.31, 0.30]),
... |
import tensorflow as tf
from tensorflow.math import unsorted_segment_sum as tf_scatter_add
from .graph_neural_features_base import _NeuralFeaturesBase
def coalesce(indices, values):
r""" It is basically scatter_add with bi-dimensional batch=indices """
max_idx = tf.reduce_max(indices)
tf.debugging.assert_l... |
import itertools as it
import math
import numpy as np
import os
import pandas as pd
from bokeh.models import ColorBar, ColumnDataSource, HoverTool, LabelSet, Legend
from bokeh.models import LinearColorMapper, FactorRange
from bokeh.palettes import Magma, d3
from bokeh.plotting import figure, output_file, show
from skl... |
#!/usr/bin/env python
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
import glob
import os
import sys
try:
sys.path.append(glob.glob('../carl... |
# System libs
import os
import time
# import math
import random
import argparse
from distutils.version import LooseVersion
# Numerical libs
import torch
import torch.nn as nn
# Our libs
from mit_semseg.config import cfg
from eval import evaluate
from mit_semseg.dataset import ValDataset
from mit_semseg.dataset import T... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams["font.family"] = "serif"
from utils import acquire as ac
from utils import DATA_COLLECTIONS
import datetime
import diskcache as dc
cache = dc.Cache("cache/")
# def memoize(f):
# global cache
# def inner(*args, **kwargs):
# ... |
from dash import Dash, html, dcc, Input, Output
import plotly.express as px
import pandas as pd
import plotly.graph_objects as go
df = pd.read_excel('Definitivo.xlsx')
df_array = df.values
######################################################### PRIMEIRO ###################################################
Tudo = [... |
import os
import pymongo
import boto3
import redis
from typing import List, Optional
from requests_toolbelt.sessions import BaseUrlSession
class User(object):
def __init__(self, user_id):
self.user_id = user_id
self.sess = BaseUrlSession(base_url='http://localhost:5000')
def res_hook(r, *... |
import os
import subprocess
from subprocess import PIPE
from multiprocessing import Pool, cpu_count
import shutil
import re
import pandas as pd
from multiprocessing import Lock
import hashlib
import math
import xarray as xr
import numpy as np
import time
import pickle
class SpiceAnalysis():
def __init__(self):
... |
import numpy as np
import pycqed.measurement.sweep_functions as swf
import pycqed.measurement.pulse_sequences.multi_qubit_tek_seq_elts as sqs2
import time
from pycqed.analysis_v2 import tomography_qudev as tomo
class n_qubit_seq_sweep(swf.Hard_Sweep):
"""
Allows an arbitrary sequence.
"""
def __init_... |
#
# This file is part of PyFOPPL, an implementation of a First Order Probabilistic Programming Language in Python.
#
# License: MIT (see LICENSE.txt)
#
# 16. Jan 2018, <NAME>
# 06. Feb 2018, <NAME>
#
from . import Config
from .graphs import *
from .code_types import *
##################################################... |
import os
import fasttext
class MyFastTexter():
"""
This one is for the version installed via
https://github.com/facebookresearch/fastText
Re multi-label
https://github.com/facebookresearch/fastText/issues/478
"""
def __init__(self, multi_label=False, multi_treshold=0.05):
"""
... |
#!/usr/bin/env python
import argcomplete
import argparse
import atexit
import coloredlogs
import functools
import gc
import json
import katcp
import logging
import os
import ipaddress
import socket
import sys
import time
import threading
from collections import OrderedDict
from itertools import izip_longest
from ast ... |
import sys
import symtable
import parser
import types
import tokenize
import token
import symbol
import random
class LambdaSymTable:
def __init__(self, symtabs, argnames):
self.symtabs = symtabs
self.mysymbs = {}
for argname in argnames:
self.mysymbs[argname] = symtable.Symbol(a... |
from .production import Production
from .grammar import Grammar
from .context import Context
from ..lex import Token
from motor_typing import TYPE_CHECKING, TypeVar
import os
import sys
import re
import hashlib
import zlib
import base64
try:
import cPickle as pickle
except ImportError:
import pickle # type: ig... |
# Copyright INRIM (https://www.inrim.eu)
# See LICENSE file for full licensing details.
import sys
from typing import Optional
from fastapi import FastAPI, Request, Header, HTTPException, Depends, Form
from fastapi.responses import RedirectResponse, JSONResponse
from .ContentService import ContentService
from .main.bas... |
import os
import warnings
import numpy as np
from astropy.convolution import Gaussian1DKernel, Gaussian2DKernel
from astropy.io import fits
from astropy import wcs
import astropy
import multiprocessing
from .. import cubes, Cube, CubeStack
from ...spectrum.models import n2hp, ammonia_constants
from ...spectrum.models.... |
import os
import time
import numpy as np
import configparser
from PIL import Image
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
# Puzzles Type
puz = "Houses"
config = configparser.ConfigParser()
config.read(puz + '/Cards/Cards.ini')
num_of_cards = len(config.sections())
# Create Tiles
sides =... |
# -*- coding: utf8 -*-
from django.conf import settings
from django.contrib import auth
from django.contrib.auth.models import Group
from django.core import mail
from django.core.exceptions import ValidationError
from django.shortcuts import reverse
from django.test import TransactionTestCase, TestCase, Client
from l... |
# -*- coding: UTF-8 -*-
'''
输入输出函数
其他脚本中的进入的字符串参数和输出到屏幕的字符串参数都需要经过转换
进入的字符串需要转为 unicode (为了支持路径中的中文)
输出到屏幕的字符串需要从 unicode 转为 str (为了兼容重定向符号 > ,某些时候我们需要把脚本运行结果重定向到文件)
兼容 python 2.6, 2.7, 3
scandir.walk benchmark :
# 7w files
for e in io_iter_files_from_arg(sys.argv[1::]) :
pass
os.walk - 1.169... |
# -*- coding: utf-8 -*-
"""
This is the main python script containing the training loop.
Input hyperparameters can be set up through argparse.
Based on the work:
Deep Flow Prediction - <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME> (TUM)
@author: <NAME> - <EMAIL>
"""
import os, random, argparse, numpy as np, pan... |
# -*- coding: utf-8 -*-
"""
The :mod:`parsimony.utils.utils` module includes common functions and
constants.
Please add anything useful or that you need throughout the whole package to
this module.
Created on Thu Feb 8 09:22:00 2013
Copyright (c) 2013-2014, CEA/DSV/I2BM/Neurospin. All rights reserved.
@author: <NA... |
"""
The code in this file was copied from
https://github.com/fasiha/array_range
https://github.com/fasiha/nextprod-py
https://github.com/fasiha/overlap_save-py
Thanks to <NAME> for releasing this to the larger public with the
Unlicense.
# Fast-convolution via overlap-save: a partial drop-in replacement for scipy.sign... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
from abc import ABC
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Tuple
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.http import HttpStream
from ... |
# Copyright (c) 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import csv
import json
from itertools import tee
import numpy as np
from Bio import SeqIO
import pysam
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def extract_lanl_genome(lanl_input, lanl_id, fasta_output):
records = SeqIO.to_dict(SeqIO.parse(lanl_input, 'fasta'))
record = records[l... |
#!/usr/bin/env python3
# coding: utf-8
__author__ = 'Yee_172'
__date__ = '2017/9/26'
__all__ = ['ALPHABET', 'terminal_version_old', 'MainWin', 'app', 'sys']
import os
import sys
import platform
import pandas as pd
from PyQt5 import QtGui, QtWidgets, QtCore
from PyQt5.QtCore import Qt, QCoreApplication, QUrl
from PyQt5... |
#!/usr/bin/env python
################################################################################
# Created by <NAME> #
# <EMAIL> #
################################################################################... |
import numpy as np
import multiprocessing
from . import sources
_ncpu = multiprocessing.cpu_count()
"""Rotation functions"""
def rotate_around_z(theta):
"""Calculcate the rotation matrix to rotate around the Z-axis by angle theta
(radians)
Parameters
----------
theta: float
Rotati... |
__all__ = ["TrackCaloMatchType","SummaryType","TrackParticle"]
from Gaugi import EDM
from kepler.core import Dataframe as DataframeEnum
from Gaugi import StatusCode, EnumStringification
from Gaugi import stdvector_to_list
class TrackCaloMatchType(EnumStringification):
# brief difference between the cluster et... |
import io
import os
from enum import Enum
from math import ceil
from struct import unpack
from typing import IO, NamedTuple, TypeVar, Generic, Any
import lz4.block
import lz4.frame
import lz4.stream
import zipfile
from utils import read_string_end_with_nil
from catalog import Catalog
COMMON_STRINGS = {
0: 'AAB... |
import discord
import datetime
import requests
import typing as t
from typing import Optional
from discord.ext import commands
from discord import Member
class Info(commands.Cog):
def __init__(self, client):
self.client = client
@commands.cooldown(1, 5, commands.BucketType.user)
@comm... |
"""
Coplanar joint orient tool 0.9.0
<NAME> 2015
TODO (known issues):
-Preview plane size setting (Width and Height)
-Handle when scene is closed while window open to reset things if possible
-Make the preview plane creation somehow not contribute to the undo history if possible or find a different way to display a pr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
import sys
import json
import serial
import logging
import struct
import collections
import datetime
import argparse
#format = '%(asctime)-15s %(filename)s:%(funcName)s:%(lineno)s [%(levelname)s] %(message)s'
format = '%(asctime)-15s [%(levelname)s] %(message... |
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Unit-e developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
This simulation script has been created to see how some settings/variables could
affect the chain forks di... |
from einops import rearrange
import numpy as np
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch_scatter
"""
Code adapted from https://github.com/saimwani/multiON
"""
def get_grid(pose, grid_size, device):
"""
Input:
`pose` FloatTensor(bs, 3)
`grid_si... |
from __future__ import print_function
# This file generates KiCad netlist (.net) files directly from a
# Python script, that specifies all parts, connections, and
# footprints.
import csv
import os
import re
import types
class PCB:
def __init__(self):
self.nets = {}
self.components = {}
@cla... |
from time import time
import autograd.numpy as np
import autograd.numpy.random as npr
import scipy
import ssm
def test_sample(T=10, K=4, D=3, M=2):
"""
Test that we can construct and sample an HMM
with or withou, prefixes, noise, and noise.
"""
transition_names = [
"standard",
"s... |
import sys
import os
import re
from ply import yacc, lex
from ply.lex import TOKEN
from Utils.data_objects.aerodynamics_placeholders import *
class Parser(object):
"""
Base class for a lexer/parser that has the rules defined as methods
"""
tokens = ()
precedence = ()
def __init__(self, file... |
from __future__ import absolute_import
from __future__ import print_function
import sys, os, yaml, glob
import subprocess
import string
import sys
import gzip
import pandas as pd
from nougat import common
def _align_reads(global_config, sample_config, sorted_libraries_by_insert):
reference = build_reference_bwa(... |
from ngsolve import *
from netgen.csg import *
from ngsolve.internal import *
import numpy as np
from time import time
pi=4.*atan(1.)
Ocross=lambda a,b: (a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],
a[0]*b[1]-b[0]*a[1]) # just gives a tuple
cross=lambda a,b: CoefficientFunction((a[1]*b[2]-a[... |
"""
Python 2-3 Tree implementation
2-3 Tree is a balanced tree each node of which may contain 2 elements
and 3 references on its children.
Element lookup speed is log2(N) < x < log3(N)
Insertion and deletion is about 2 * log2(N)
See http://en.wikipedia.org/wiki/2-3_tree for more info
20... |
#!/usr/bin/env python
__author__ = 'Branko'
import rospy
from tic_tac_drone.msg import CustomPose
from geometry_msgs.msg import Point
from math import *
import time
class Poruke:
def __init__(self):
self.pub = rospy.Publisher("signal", CustomPose, queue_size=1)
self.pub1 = rospy.Publisher("cur... |
"""
Code adapted from Transformer model for language understanding example:
https://www.tensorflow.org/tutorials/text/transformer
"""
import tensorflow as tf
import tensorflow_datasets as tfds
import nltk
import matplotlib.pyplot as plt
import numpy as np
import time
import re
import random
nltk.download('punkt')
# ... |
#-*- coding: latin-1 -*-
### this is external server's app.py
### and below is the first flag
### fiesta{ok_y0u_g0t_the_ext_server's_code!_lets_dig_the_2nd_flag!}
import flask_socketio
import flask
import datetime, uuid, socket, json, threading, os, base64, re, time, signal, errno
from functools import wraps
im... |
#!/usr/bin/python
#
# Perform optical character recognition, usage:
# python3 ./image2text.py train-image-file.png train-text.txt test-image-file.png
#
# Authors: <NAME> (aagond), <NAME> (hatha), <NAME> (saimorap)
# (based on skeleton code by D. Crandall, Oct 2020)
#
from PIL import Image, ImageDraw, ImageFont
im... |
#!/usr/bin/python
##
## Copyright (c) 2017, 2018 RockNSM.
##
## This file is part of RockNSM
## (see http://rocknsm.io).
##
## 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://... |
#----------------------------------------------------------------------------#
# Imports
#----------------------------------------------------------------------------#
import json
import dateutil.parser
import babel
from flask import Flask, render_template, request, Response, flash, redirect, url_for, abort
from flask... |
# standard libraries
import copy
import ctypes
import gettext
import numpy
import threading
import typing
# third party libraries
# local libraries
from nion.swift.model import HardwareSource
from nion.utils import Registry
from .orsayscan import orsayScan, LOCKERFUNC, UNLOCKERFUNC, UNLOCKERFUNCA
from . ConfigDialog ... |
import math, sys, pdb, os
import matplotlib.pyplot as plt, numpy as np
import cvxpy as cp
import header
from implicit.interface import init
jaxm = init(dtype=np.float64, device="cpu")
from implicit.diff import JACOBIAN, HESSIAN_DIAG
from implicit.implicit import implicit_jacobian, implicit_hessian, generate_fns
fro... |
"""Module for parsing REAXFF input files.
Note: this module is copied directly from aiida-crystal17 v0.10.0b5
"""
import copy
import re
from aiida_lammps.validation import validate_against_schema
INDEX_SEP = "-"
KEYS_GLOBAL = (
"reaxff0_boc1",
"reaxff0_boc2",
"reaxff3_coa2",
"Triple bond stabilisati... |
import logging
from hmac import new
logging.basicConfig(level=logging.INFO)
import argparse
import numpy as np
import cv2
from collections import defaultdict
from pytorch3d import transforms
import torch
import json
import time
from scipy import signal, spatial
def parseargs():
parser = argparse.ArgumentParser(... |
# -*- coding: utf-8 -*-
""" contest models: Contest, Contestant, Donor, and Founder
:copyright: Copyright (c) 2014 Bivio Software, Inc. All Rights Reserved.
:license: Apache, see LICENSE for more details.
"""
import datetime
import decimal
import math
import pytz
import random
import re
import flask
import ... |
"""Work with healpix data
In this case for the QA plots Aaron creates. e.g. PS1 minus tractor flux"""
import numpy as np
import os
import healpy as hp
import fitsio
import matplotlib.pyplot as plt
from scipy.stats import sigmaclip
from collections import defaultdict
from astropy.coordinates import Galactic,ICRS
from... |
import os
from time import time
import numpy as np
from scipy import optimize
import sys
from matplotlib import pyplot as plt
import cv2
import math
import cmath
from sklearn.utils import check_random_state
_delta = 1e-9
def ImgInt2Float(img, dtype=np.float):
return img.astype(dtype) / 255.0
def ImgFloat2Int(img... |
## dea_datahandling.py
'''
Description: This file contains a set of python functions for handling
Digital Earth Australia data.
License: The code in this notebook is licensed under the Apache License,
Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0). Digital Earth
Australia data is licensed under the Creati... |
#!/usr/bin/env python3
"""Assemble Mbed TLS change log entries into the change log file.
Add changelog entries to the first level-2 section.
Create a new level-2 section for unreleased changes if needed.
Remove the input files unless --keep-entries is specified.
In each level-3 section, entries are sorted in chronol... |
# stdlib
import asyncio
import base64
import hashlib
import json
import logging
import os
#import pprint
import ssl as ssl2 # ugh
import sys
import traceback
# pypi
import pynetstring
# based on https://www.jsonrpc.org/specification
NOT_NOTIFICATION = -32000
METHOD_ERROR = -32001
INVALID_REQUEST = -32600
ME... |
import json
import numpy as np
import funcy
import os
from pyleaves.utils import ensure_dir_exists
from pyleaves.utils.csv_utils import gather_experiment_data
from toolz import diff
class BaseConfig(dict):
def __init__(self,*args, **kwargs):
'''
Base class for storing experiment configuration pa... |
import sys, itertools, os
from collections import deque
ACCEPT = 'aceita'
STATES = 'estados'
INITIAL = 'inicial'
TRANSITIONS = 'transicoes'
operations = ['-u','-i','-d','-s','-c','-m']
OP_UNION = operations[0]
OP_INTERSECTION = operations[1]
OP_DFACONVERSION = operations[2]
OP_STAR = operations[3]
OP_CO... |
# Hamiltonian Neural Networks | 2019
# <NAME>, <NAME>, <NAME>
import torch, argparse
import numpy as np
import os, sys
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
PARENT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(PARENT_DIR)
from nn_models import MLP, MLP_sgp4
from hn... |
# Copyright 2014, 2017 IBM Corp.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
"""
Portable Executable (PE) 32 bit, little endian
Used on MSWindows systems (including DOS) for EXEs and DLLs
1999 paper:
http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/pecoff.doc
2006 with updates relevant for .NET:
http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9... |
from hashlib import new
from typing import List, Set, Dict, Tuple, Optional
import string
from .multi_line_view import MultiLineView2
#
# TODO - there is still more cleanup of this code to be done
# TODO - the handling of the APPEND mode is poor
# TODO - should display self.width characters in edit mode only need the... |
import contextlib
import sys
from PySide6 import QtCore, QtWidgets
from PySide6.QtWidgets import QSizePolicy, QListView
from matplotlib.axes import Axes
from .mainwindow import Ui_MainWindow
print(rf'''
python is run by {sys.executable}
''')
import sys
import typing
import ismrmrd
import numpy as np
import PySide6... |
#!/usr/bin/python
"""
game.py - main in-game scene classes
"""
import os
import pygame
from pygame.locals import *
from gamedirector import *
import random
from math import *
import resources
from common import FadeInOut
import subprocess
from wii_balance_board import Wiiboard, BoardEvent
import Queue
global boar... |
import torch
import torch.nn as nn
from examples.BaseSegLightning import BaseSegmentationModule
from examples.str2bool import str2bool
from examples.utils import interpolate_grid_feats, interpolate_sparsegrid_feats, save_pc
import numpy as np
from examples.basic_blocks import MLP, norm_layer
import importlib
import ... |
#!/usr/bin/env python3
import errno
import os.path
import re
import shlex
import stat
import string
import sys
from typing import IO
from typing import List
from typing import Optional
from typing import Set
from typing import Tuple
EXTENSIONS = {
'adoc': {'text', 'asciidoc'},
'asciidoc': {'text', 'asciidoc'}... |
import numpy as np
#np.random.seed(11)
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics import r2_score, mean_absolute_error, mean_squared_error
from sklearn.preprocessing import StandardScaler
import h5py
import os.path as osp
import os
from scipy import ndimage
from glob import glob
from tqdm ... |
import pandas as pd
import numpy as np
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
from matplotlib import pyplot as plt
from matplotlib import style
from fpdf import FPDF
import math
import io
import base64
import xlsxwriter
def uploadToPSQL(host, username, password, database, port, tab... |
import math
import shutil
import subprocess
import numpy as np
import pandas as pd
from pathlib import Path
from function.utilities import seq_aa_check
from function.utilities import fasta_to_seqlist
from function.utilities import find_human_sequence
from function.utilities import get_fasta_seq_info
from selenium imp... |
import os
import math
from math import sqrt
import ctypes
from datetime import datetime
import random
from psychopy import visual
from psychopy.visual import circle
from PIL import Image
from PIL import ImageFilter
import numpy as np
from numpy.random import randint, normal, shuffle
from numpy import (mod, sin, cos, t... |
# -*- coding: utf-8 -*-
'''The stages of the experiment.
'''
from functools import partial
import traceback
from time import clock, strftime, sleep
from re import match, compile
from os.path import join, isfile
import csv
from random import randint, shuffle
from moa.stage import MoaStage
from moa.threads import Sched... |
# @Created Date: 2019-11-24 11:03:59 pm
# @Filename: Run.py
# @Email: <EMAIL>
# @Author: <NAME>
# @Last Modified: 2019-12-23 04:21:04 pm
# @Copyright (c) 2019 MinghuiGroup, Soochow University
import click
import configparser
import os
import json
from pandas import read_csv, merge, Series
from numpy import nan
from .c... |
'''
choose_probes.py
Choose probes across target sets, as evenly spaced as possible.
Check for heterodimer clashes when adding probes to the set.
'''
import sys
import numpy as np
from Bio import SeqIO
import pandas as pd
import os
import math
import primer3
import matplotlib.pyplot as plt
import logging
from scipy imp... |
import os
import cv2
import numpy as np
import csv
import random
from imgaug import augmenters as iaa
def main():
# 更改旗子名字
country = 'zhongguo'
video_path = './video/' + country + '.avi' # 视频路径
background_path = 'I:\\coco\\test2017\\' # 背景路径
# 定义保存路径
saveBoundRect_pat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.