text stringlengths 6.04k 39.5k |
|---|
def warp_image_test(image, transform, dsize=None):
"""
from kwimage.transform import Affine
import kwimage
image = kwimage.grab_test_image('checkerboard', dsize=(2048, 2048)).astype(np.float32)
image = kwimage.grab_test_image('astro', dsize=(2048, 2048))
transform = Affine.random() @ Affine.s... |
import json
import os
import sys
from collections import defaultdict
from typing import Union, List, Any, Callable, Type, Dict, Set
from pytconf.color_utils import (
print_highlight,
color_hi,
print_title,
color_ok,
color_warn,
print_error,
)
from pytconf.errors_collector import ErrorsCollector... |
# Copyright 2015 The TensorFlow 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 applica... |
#! /usr/env/bin python
import os
import linecache
import numpy as np
from collections import OrderedDict
from CP2K_kit.tools import call
from CP2K_kit.tools import log_info
from CP2K_kit.tools import data_op
from CP2K_kit.tools import read_lmp
from CP2K_kit.tools import file_tools
from CP2K_kit.analyze import check_an... |
import tensorflow as tf
import numpy as np
import os
import skimage
import cv2
from math import cos, sin
from imgaug import augmenters as iaa
import imgaug as ia
from tensorflow.contrib import slim
def restore_ckpt(sess: tf.Session, var_list: list, ckptdir: str):
if ckptdir == '' or ckptdir == None:
pass
... |
import copy
import os
import math
import json
import random
from operator import itemgetter
from orderedset import OrderedSet
from collections import defaultdict
import pickle
from parlai.utils.misc import warn_once, str_to_msg
from parlai.core.message import Message
from parlai.core.torch_agent import TorchAgent
from... |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015, 2016, 2017 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... |
# -- coding: utf-8 --
'''
the shape of sparsetensor is a tuuple, like this
(array([[ 0, 297],
[ 0, 296],
[ 0, 295],
...,
[161, 2],
[161, 1],
[161, 0]], dtype=int32), array([0.00323625, 0.00485437, 0.00323625, ..., 0.00646204, 0.00161551,
0.00161551], dtype=float... |
#!/usr/local/bin/python
import sys, getopt
import requests
import json
import sys
import os
import time
import math
import os.path as path
# Import getopt module
import getopt
MAAP_ENV_TYPE = os.getenv("MAAP_ENV_TYPE")
CLIENT_ID = os.getenv("CLIENT_ID")
BEARER=""
#if windows we take the current folder
if sys.platform... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists o... |
# The MIT License (MIT)
# Copyright © 2021 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 30 13:57:07 2020
@author: Ozan
"""
import numpy as np
import os
##############################################################################
def applyRule(termSummary, geneSetsDict, maxRepresentativeTermSize, process):
"""
This function ap... |
import discord
from discord.ext import commands, tasks
from discord.utils import get
import random
import asyncio
import os
from imgurpython import ImgurClient
import giphy_client
from giphy_client.rest import ApiException
from datetime import datetime
import pytz
from utils.lists import *
import matplotlib.pyplot as p... |
#!/usr/bin/env python3
# -"- encoding: utf-8 -"-
import re
import pickle
from tgen.data import DA
from tgen.tfclassif import Reranker
from tgen.logf import log_info
from tgen.futil import file_stream, read_das
# ----
# BEGIN code copied over from e2e-cleaning -- TODO dependency?
# ----
REALIZATIONS = {
'area': ... |
"""
Runs interactive minesweeper game in standard out
"""
import copy
import os
from minesweeper.cursor import *
from minesweeper.game import Minesweeper, WON, LOST
from minesweeper.read import controls, Keys
from minesweeper._text import *
class PlayMinesweeper:
# unicode constants
_RIGHT_ARROW = u'\u25b6'
... |
#!/usr/bin/env python
# coding: utf-8
# In[3]:
import rebound
import reboundx
import numpy as np
### DEFINITIONS
radeg = np.pi/180
def add_L4(sim, number):
a_rand = np.random.normal(38,2,size=number)
a_rand = a_rand/100 + 5
e_rand = np.random.normal(9,2,size=number)
e_rand = e_rand/100
w_rand ... |
##-*****************************************************************************
##
## Copyright (c) 2009-2011,
## Sony Pictures Imageworks, Inc. and
## Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
##
## All rights reserved.
##
## Redistribution and use in source and binary forms, with... |
#!/usr/bin/env python
# created by <EMAIL>
# see instructions at http://www.drumminhands.com/2014/06/15/raspberry-pi-photo-booth/
import os
import glob
import time
import traceback
from time import sleep
#import RPi.GPIO as GPIO
from gpiozero import LED, Button
import picamera # http://picamera.readthedocs.org/en/rele... |
import math
from random import randint
from abc import ABC, abstractmethod
from enum import Enum
import pygame
import config
import colors
pygame.init()
screen = pygame.display.set_mode((config.SCREEN_WIDTH, config.SCREEN_HEIGHT))
screen.fill(colors.SKY_BLUE)
class GameObject(ABC):
def __init__(self, x0, y0):
... |
import argparse
import csv
import json
import logging
import os
import random
from datetime import datetime as dt
from datetime import timedelta
from os import listdir
import boto3
# -------------------------------------------
# Constants / Mappings
# -------------------------------------------
reading_types_map = [... |
# -*- coding: utf-8 -*-
"""
Created on 8/6/17
Author: <NAME>
"""
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import Ridge
from sklearn.linear_model import ElasticNet
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import ExtraTreesRegressor
from xgboost import X... |
#!/usr/bin/env python3
import sys
import itertools
from mine_field import mine_field, RESULT
def open(r, c):
if RESULT[r][c] == 'x':
print("error! can't open: {} {}".format(r, c), file=sys.stderr)
sys.exit(1)
return int(RESULT[r][c])
# END ANSWER PREP
# BEGIN ACTUAL SOLUTION
class MineSwee... |
#!/usr/bin/env python3
# jfreg: Joint fMRI Registration
#
# Copyright (c) 2019, <NAME>
#
# jfreg is released under the revised (3-clause) BSD license.
# For details, see LICENSE.txt
#
import sys
import os
import shutil
import re
import argparse
import datetime
import tempfile
import subprocess
class FuncDset:
"""... |
# Ω*
# ■ ■■■■■
# ■ ■■ ■■
# ■ ■■ ■
# ■ ■■
# ■■■■■ ■ ■■■
# ■■ ■■ ■ ■■■
# ■■ ■■ ■ ■■■■
# ■■ ■■ ■ ■■■■
# ■■■■■■■■■ ■ ■■■
... |
# Módulo com diversas funções utilitárias
import bisect
import collections
import collections.abc
import functools
import operator
import os.path
import random
import math
# Funções de iterações
def sequence(iterable):
"Coerce iterable to sequence, if it is not already one."
return (
iterable if is... |
#!/usr/bin/env python
u"""
convert_ILVIS2_elevation.py
Written by <NAME> (11/2021)
Reads IceBridge Geolocated LVIS Elevation Product datafiles and
outputs to HDF5
CALLING SEQUENCE:
python convert_ILVIS2_elevation.py input_file
INPUTS:
input Level-2 LVIS elevation file
COMMAND LINE OPTIONS:
--help: l... |
"""This backend now only support lidar. camera is no longer supported.
"""
import base64
import datetime
import io as sysio
import json
import pickle
import time
from pathlib import Path
import fire
import torch
import numpy as np
import skimage
from flask import Flask, jsonify, request
from flask_cors import CORS
fr... |
import numpy as np
def score_component(fields, maps, fn, length):
accumulated = np.zeros(length, np.int32)
for mk, mv in maps.items():
if mk in fields and mv is not None:
accumulated = accumulated + mv[fields[mk]]
return fn(accumulated)
def gut_friendly_score(fields: dict):
"""
... |
# Copyright 2021 The TensorFlow Ranking Authors.
#
# 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... |
#!/usr/bin/python
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
"""
Data-Bundle for Aplhavantage
Usage: set api-key with 'export ALPHAVANTAGE_API_KEY=yourkey'
Limitations: free-accounts can have 5 calls per minute and 500 calls a day.
tolerance is used to wait some small additional time, otherwise sometimes
we will still hit the limit if we want to squeeze out as much calls as
... |
# -*- coding: utf-8 -*-
import logging
import struct
import math
import time
from sdeux.exceptions import (S2InvalidVoltageError, S2InvalidPulseParamsError, S2UndervoltageError,
S2OvercurrentError)
from sdeux.communication import S2Payload, S2Base, create_packet
from sdeux.defs import S2... |
import rq_album
import env
import util
import random
import string
import rq_studies
def test_init():
env.initialize()
print()
def test_get_token():
print()
token = util.get_token(username="titi", password="<PASSWORD>")
env.env_var["USER_1_TOKEN"] = token
token = util.get_token(username="toto"... |
# _________________________________________________________________________
#
# Coopr: A COmmon Optimization Python Repository
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the BSD License.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Governm... |
import abc
import asyncio
import errno
import logging
from dataclasses import dataclass
from pathlib import Path
from typing import AbstractSet, AsyncIterator, Generic, Optional, Tuple, TypeVar
from yarl import URL
from neuro_sdk import AbstractFileProgress
from neuro_sdk.abc import (
AbstractDeleteProgress,
... |
import argparse
import torch.distributed as dist
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
from tensorboardX import SummaryWriter
from terminaltables import AsciiTable
from models import *
from utils.datasets import *
from utils.utils import *
import sys
from utils.torch_utils import... |
"""Functionality pertaining to the geometry of objects."""
import math
from abc import ABC, abstractmethod
from typing import Tuple, TypeVar, Generic, Callable, Type, Iterator, Iterable, Union
__all__ = ['GeometricObject', 'Point', 'Edge', 'PolygonalSurface', 'PolygonalShape',
'make_table', 'make_box', 'm... |
import pickle, random
import math, time, platform
from pathlib import Path
import cv2
import torch
import numpy as np
from PIL import Image
from skimage import color
from torchvision import transforms, datasets
from torchvision.transforms import functional as tvF
from torch.utils.data import DataLoader
from torch.ut... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: songhongwei
@ceate_time: 2017/10/11 18:18
@brief: find_multi_word
"""
import sys
import os
import logging
logging.basicConfig(format='%(asctime)s:%(levelname)s:%(message)s', level=logging.INFO)
logger = logging.getLogger(__file__)
import argparse
import re
de... |
from enum import Enum
import pandas as pd
import numpy as np
from matplotlib import (
pyplot as plt,
patches as mp,
)
DEFAULT_BOUNDS = (0, 1, 10, 100, 1000, 10000, 100000)
def get_aggregate(data, dimensions, measures=('cnt', 'revenue'), aggregator='sum', relation_field='price', add_x=-1):
result = data.... |
import numpy as np
def J_integral(ue,ve,xe,ye,qe,xcenter,ycenter,E,mu,G,kapa):
ue=np.matrix(ue); # element 1 direction displacement (1x4)
ve=np.matrix(ve); # element 2 direction displacement (1x4)
xe=np.matrix(xe); # element 1 direction coordinates (1x4)
ye=np.matrix(ye); # element 2 direction coordinates ... |
# -*- coding: utf-8 -*
import sys
import unicodedata
#reload(sys)
#sys.setdefaultencoding("utf-8")
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[... |
# This is the library that handles the unit conversion itself.
# The unit conversion library was originally created by ficolas2, https://github.com/ficolas2, 2018/01/21
# The unit conversion library has been modified and updated by ficolas2 and Wendelstein7, https://github.com/Wendelstein7
# The unit conversion libr... |
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
import PIL
from PIL import Image
from collections.abc import Iterable
def Nancheck(x):
if (x != x).any():
print('NaN')
else:
print("No NaN")
"""
Usage example:
fro... |
"""
Pathfinding algorithms local to this repository
"""
import logging
from itertools import islice, product
from typing import (
Any,
Callable,
Dict,
Generator,
Iterator,
List,
Optional,
Set,
Tuple,
Union,
)
from depmap_analysis.network_functions.famplex_functions import (
... |
import requests
from bs4 import BeautifulSoup
import json
import string
from time import sleep
import re
import random
INTERVAL = 0.5
USER_AGENT_LIST = [
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; AcooBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
"Mozilla/4.0 (compatible; MSIE 7.0;... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2020, empress development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
import tensorflow as tf
from lib.ops import *
import collections, os, math
import numpy as np
import json
def make_vel_data_set(FLAGS, isVal=False, isSeq=False, noShuffle=False):
json_tmp = {}
flag_tmp = {"a":None}
frame_str = "_%04d.npz" if FLAGS.is2D else "_%04d.f16.npz"
def gather_data(d... |
import logging
from collections import ChainMap
from copy import copy, deepcopy
from functools import lru_cache
from pathlib import Path
import ixmp.model.gams
from ixmp import config
from .macro import MACRO_ITEMS
log = logging.getLogger(__name__)
#: Solver options used by :meth:`message_ix.Scenario.solve`.
DEFAUL... |
# -*- coding: utf-8 -*-
"""Tests for field serialization."""
import datetime as dt
from collections import namedtuple
import pytest
from marshmallow import Schema, fields, utils
from marshmallow.exceptions import MarshallingError
from marshmallow.compat import total_seconds, text_type, OrderedDict
from tests.base im... |
'''MobileNetV2 in PyTorch.
Fetched from https://github.com/kuangliu/pytorch-cifar/blob/master/models/mobilenetv2.py
See the paper "Inverted Residuals and Linear Bottlenecks:
Mobile Networks for Classification, Detection and Segmentation" for more details.
'''
import math
import copy
import torch
import torch.nn as n... |
#!/usr/bin/env python
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker, relationship
"""
incrementation auto des ids, pas d'unicité par contre... pour les accessions
ou alors mettre son identifiant en ... |
# Copyright 2019 The FastEstimator 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 appl... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Module to provide Athena CTAS input materialization Glue ETL script
"""
from typing import ClassVar, Optional, Set
from intelliflow.core.platform.definitions.aws.athena.common import ATHENA_RESERVED_DDL_KEYW... |
import math
from datetime import datetime
import requests
from rich.progress import Progress
from depscan.lib import config as config
from depscan.lib.logger import LOG, console
def get_lookup_url(registry_type, pkg):
vendor = None
if isinstance(pkg, dict):
vendor = pkg.get("vendor")
name = ... |
"""
Populate bus route and timetable data from TNDS.
"""
import collections
import ftplib
import glob
import os
import re
from importlib.resources import open_binary
from flask import current_app
import lxml.etree as et
from nextbus import db, models
from nextbus.populate import file_ops, utils
TNDS_URL = r"ftp.tnd... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
year: 2019 - 2021
This script is used to calculate the averaged ocean temperature in CESM2 and NorESM2 (LM and MM) south of 50S
for the CMIP experiments piControl and abrupt-4xCO2 after 150 and 500 years
the average time is 30 years
The result is used i... |
import os
import numpy as np
import random
from matplotlib import pyplot as plt
plt.switch_backend('agg')
import keras.backend as K
import scipy.misc
import seaborn as sns
from itertools import cycle
from sklearn.manifold import TSNE
import csv
from scipy.stats import entropy as scipy_entropy
from scipy.spatial import ... |
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
from utils_oracle_with_target import oracle_setup
from ego.vectorize import hash_graph
from ego.decomposition.paired_neighborhoods import decompose_paired_neighborhoods, decompose_neighborhood
import random
from collections import defaultdict
from... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 15:08:53 2018
@author: huwei
Project 3 Natural Language Processing with Women’s Clothing E-Commerce dataset
Data source: https://www.kaggle.com/nicapotato/womens-ecommerce-clothing-reviews
"""
# General
import pandas as pd
import numpy as np
... |
import os
import subprocess
import sys
import traceback
from array import array
from collections import deque
from shutil import get_terminal_size
from threading import Thread
import asyncio
import audioop
from enum import Enum
from musicbot.config import static_config
from musicbot.entry import RadioSongEntry, Stream... |
"""
Function :net_present_value.py
Title : Net present value
Author : <NAME>
Email : <EMAIL>
Date : September/2020
Last edit : September/2020
Language : Python 3.8 or >
Aeronautical Institute of Technology - Airbus Brazil
Description:
- This functions calculates the net present value. Methodology... |
# -*- coding: utf-8 -*-
"""Interactive interface."""
import curses
import threading
import formatter
import executor
import functools
import i18n
_ = i18n.translate
# TODO: i18n
# TODO: refactoring with Formatter + separate UI class
HELP_MESSAGE = """
PVCHECK automatic verification of computer programs
========... |
#Pluginname="Facebook Newsfeed (Android)"
#Filename=""
#Type=App
import struct
import os
import sys
import tempfile
from Library import flatbuffer
def convertdata(filenames):
row=0
oldpos=0
kk=0
zfields=[]
for fsname in filenames:
filename=tempfile.gettempdir()+"/"+fsname[f... |
#Import different modules to build the app
from tkinter import *
import math
import tkinter.messagebox
# layout for calculator
root = Tk()
# sets the name on top
root.title("Codecodix scientific calculator")
# background color of calculator as white
root.configure(background = 'white')
#width and heig... |
#!/usr/bin/env python
# Copyright 2019 <NAME> & <NAME>
#
# This file is part of OBStools.
#
# 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 ... |
# -*- coding: utf-8 -*-
#
# Software License Agreement (BSD License)
#
# Copyright (c) 2010-2011, <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:
#
# * Redistributions of source code mu... |
import os
import itertools
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from sklearn import svm
from sklearn import linear_model as lm
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.neural... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 27 09:27:46 2022
@author: matthijs
"""
import numpy as np
from typing import Sequence, Tuple, List, Optional, Callable, Dict
import grid2op
import torch
from grid2op.dtypes import dt_int
import math
import auxiliary.util as util
from auxiliary.confi... |
import numpy as np
from pathlib import Path
import codecs
import pysrt
from matplotlib import pyplot as plt
"""
All thresholds
"""
TRANSCRIPT_DELAY = 0 # 6 for unaligned videos
MIN_TRANSCRIPT = 0.3
MIN_BLACKFRAME = 0.99
MIN_BLACKWINDOW = 1
MIN_BLANKWINDOW = 30
MAX_BLANKWINDOW = 270
MIN_LOWERTEXT = 0.5
MIN_LOWERWI... |
# coding: utf-8
# # Quora Question Pairs (Kaggle)
# In[1]:
import numpy as np
import pandas as pd
import re
from nltk.corpus import stopwords
from nltk.stem.wordnet import WordNetLemmatizer
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
MAX_NB... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Name: csv_text_solr_search.py
# Description:
#
# Author: m.akei
# Copyright: (c) 2021 by m.na.akei
# Time-stamp: <2021-07-30 18:42:37>
# Licence:
# --------------------------------... |
import sys
import pathlib
import shutil
import zipfile
import py_compile
import os
import json
import site
import subprocess
class IniFileMissing(Exception):
pass
if len(sys.argv) == 1:
print(
"""
usage: pypacker
-a <module> -- analyze module
-f <function> -- function to run in module for en... |
#!/usr/bin/env python3
"""Funcs (gen 3)
A collection of support functions for simplifying writing tool scripts.
Functions:
setuplogging - Set up default logger
funcs3_min_version_check - Checker for funcs3 module min version
loadconfig, JAM, getcfg - Config file handlers
requestlock, relea... |
# baselineTeam.py
# ---------------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# <NAME> (<EMAIL>) and <NAME> (<EMAIL>).
# For more i... |
import copy
import logging
from unittest import mock
import numpy as np
import pyhf
from cabinetry import model_utils
from cabinetry.fit.results_containers import FitResults
def test_ModelPrediction(example_spec):
model = pyhf.Workspace(example_spec).model()
model_yields = [[[10.0]]]
total_stdev_model_b... |
#!/usr/bin/env python2.6
"""
Tue Dec 4 11:54:18 PST 2012
Parse Blast XML output file and cluster sequences using greedy approach.
Input: Blast xml file
Output: Text file, each line = 1 cluster, each element of a cluster is space-separated
Algorithm summary:
Sorted sequences by descending in size
Start with the large... |
import logging
import numpy as np
import scipy.linalg
import scipy.optimize as opt
from pySDC.core.Errors import ParameterError
from pySDC.core.Level import level
from pySDC.helpers.pysdc_helper import FrozenClass
from pySDC.implementations.collocation_classes.equidistant_right import EquidistantNoLeft
from pySDC.imp... |
# Based on code by <NAME>.
import flipper
from itertools import combinations
def LP(genus, num_punctures):
g = int(genus)
n = int(num_punctures)
# The following functions make edge labelling easier.
# In the picture of the triangulation in documentation, some edges are labelled with colored numb... |
#!/usr/bin/python -Wall
# ================================================================
# Please see LICENSE.txt in the same directory as this file.
# <NAME>
# <EMAIL>
# 2007-05-31
# ================================================================
# Type module for permutations with image-map I/O.
import re
impor... |
from __future__ import print_function
import argparse
import sys
import time
import copy
import numpy as np
from sklearn.metrics import mean_absolute_error
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
from torch.autograd import Variable
import panda... |
import warnings
import torch
import torch.nn as nn
import math
import numpy as np
import random
import time
from pytorch_wavelets import DWT1D
def _get_module(x):
if torch.is_tensor(x):
return torch
else:
return np
def _build_generator(module, seed=None, device="cpu"):
if module == np:
... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import ite... |
#!/usr/bin/python
# @file orvibo.py
# @author <EMAIL>
__version__ = "1.1"
from contextlib import contextmanager
import logging
import struct
import select
import random
import socket
import binascii
import time
PORT = 10000
MAGIC = b'\x68\x64'
SPACES_6 = b'\x20\x20\x20\x20\x20\x20'
ZEROS_4 = b'\x00\x00\x00\x00'
ON... |
"""
Parse
"""
import platform
import pprint
import re
import shlex
from pathlib import Path, PurePath
import colorama
from colorama import Back, Fore, Style
# from MKVBatchMultiplex.utils import adjustSources
from vsutillib.macos import isMacDarkMode
from vsutillib.mkv import (
IVerifyStructure,
generateComm... |
""" command line options, ini-file and conftest.py processing. """
import py
import sys, os
from _pytest.core import PluginManager
import pytest
def pytest_cmdline_parse(pluginmanager, args):
config = Config(pluginmanager)
config.parse(args)
return config
def pytest_unconfigure(config):
while 1:
... |
import argparse
import tensorflow as tf
import h5py
import sys
import numpy as np
import pickle as pkl
import cv2
import tqdm
import os
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
config.gpu_options.per_process_gpu_memory_fraction = 0.33
def quantize_tensor(x,s):
x = tf.divide(x, s)
x = t... |
import logging
import typing
from ConfigSpace.conditions import InCondition
from ConfigSpace.configuration_space import ConfigurationSpace
from ConfigSpace.hyperparameters import CategoricalHyperparameter, UniformIntegerHyperparameter
from tensorflow.python.keras import backend as K, Input, Model
from tensorflow.pytho... |
"""Stacking classifier and regressor."""
# Copied from https://github.com/scikit-learn/scikit-learn/pull/11047
# Should be deleted when the pull request above is accepted
# Authors: <NAME> <<EMAIL>>
# License: BSD 3 clause
from abc import ABCMeta, abstractmethod
from copy import deepcopy
import numpy as np
from skle... |
import json
import pathlib
import socket
import sqlite3
import telnetlib
import time
import uuid
from threading import Thread
from typing import Dict
import docker.api.container
import os
from ansi2html import Ansi2HTMLConverter
from enum import Enum
from websockify import LibProxyServer
parentdir = os.path.dirname(o... |
# -*- coding: utf-8 -*-
import _io
import logging
import tracemalloc
import sys
import warnings
from time import time
from datetime import datetime
from contextlib import ContextDecorator, redirect_stdout
from operator import methodcaller
from textwrap import wrap
from typing import Optional, Tuple, Union
from .os_utl... |
import torch
import torch.nn as nn
from torch.nn import init
class LSTM(nn.Module):
def __init__(self, input_dim, hidden_dim, forget_bias=1.0, dropout=0, layer_norm=False, batch_first=False):
super(LSTM, self).__init__()
self.input_dim = input_dim
self.hidden_dim = hidden_dim
... |
# coding=utf-8
"""
methods for analyzing and visualizing Tweets which have been pre-processed.
includes tf-idf calculation: there are variants to deriving both the tf and idf components
for a word, for determining overall tf*idf for word, and for applying it to a corpus such
as in determining threshold for unimportant... |
from concurrent.futures import (
ThreadPoolExecutor,
wait,
)
from datetime import (
datetime,
)
import hashlib
import hmac
from queue import Queue
import re
from struct import (
Struct,
)
import urllib.parse
from xml.etree import (
ElementTree as ET,
)
from xml.sax.saxutils import (
escape as es... |
"""
Series of tools for autocorrelation analysis.
"""
import matplotlib.pyplot as plt
import numpy as np
from numpy import conj, real
from numpy.fft import fft2, fftshift, ifft2
from scipy.signal import find_peaks
from min_analysis_tools.clean_kymograph import clean_kymograph
cm = 1 / 2.54 # centimeters in inches (... |
import pandas as pd
import numpy as np
import streamlit as st
import folium
from streamlit_folium import folium_static
from folium.plugins import MarkerCluster
import geopandas
import plotly.express as px
from datetime import datetime
st.set_page_config( layout='wide' )
@st.cache(allow_output_mutation = Tru... |
import pandas as pd
import numpy as np
from skmultiflow.drift_detection import ADWIN
from sklearn.cluster import MiniBatchKMeans
from yellowbrick.cluster import KElbowVisualizer
from sklearn.model_selection import train_test_split
from sklearn.utils import resample
import weightedstats as ws
from warnings impor... |
'''
TODO: transfer this code into the libs/models
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import sys
import os
# BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# ROOT_DIR = os.path.dirname(BASE_DIR)
# sys.path.append(ROOT_DIR)
# sys.path.append(os.path.join(... |
""" Methods for training the Model"""
#!python
"""
0. Update all methods to TF 2.1 including using tf.Dataset
"""
import numpy as np
import math
import re, os, traceback, sys, json
import argparse
import tensorflow as tf
import os
from pathlib import Path
from tensorflow.python.framework import ops
ops.reset_default_... |
# coding=utf-8
# Copyright (c) <NAME>
import ctypes
import logging
import string
import sys
import warnings
from os import path
from pathlib import Path
import numpy as np
import SimpleITK as sitk
from xdrt.utils import DATATYPES, camel_to_snake, make_integer
nki_decompression_available = False
try:
EXT = {"linu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.