text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python
"""Utilites for loading and processing results for the paper."""
import nestcheck.data_processing
import nestcheck.ns_run_utils
import bsr.likelihoods
import bsr.priors
import bsr.data
import bsr.basis_functions as bf
import bsr.neural_networks as nn
def load_data(problem_tups, method_tups, inds... |
from pathlib import Path
from typing import Any, List, Optional, Sequence, Union
import numpy as np
import pytest
import tensorflow as tf
from _pytest.capture import CaptureFixture
from matplotlib.axes import Axes
from matplotlib.figure import Figure
import gpflow
from gpflow.models import GPR, GPModel
from gpflow.mo... |
import glob
import os
import math
import re
import random
import imageio
import numpy as np
import time
from PIL import Image
import tensorflow as tf
from io import BytesIO
from multiprocessing import Pool, Queue
import queue
# Parameters
alignments = ['_homography'] # '_OF',
inputDir = '/home/omnisky/Desktop/zc/DeepV... |
# unit-based calculator: dc_unitscalc.py
import sys
import traceback
# sys.path.append("/usr/local/dataguzzler/python")
import lm_units
from dc_value import numericunitsvalue as nuv
import math
import pygram
#sys.stderr.write("imported pygram\n");
#sys.stderr.flush()
try :
import dc_dbus_paramclient as dcp... |
import unittest
# noinspection PyProtectedMember
from ukmodulus import (validate_number, _clean_input, _get_weightings,
ModulusWeight, _run_check, _sc_subs,
_normalize_account_number_and_code)
class SimpleValidationTests(unittest.TestCase):
def test_clean_input(self):... |
# Name: <NAME>
# Software Project: Designing a CAD Tool for Logic Minimization
# funQM.py
# Purpose: This module does the bulk of the Quine-McCluskey algorithm,
# which are placed into functions because these functions can be reused
# for both the SOP and POS expressions.
#
import re
fro... |
import json
import common_utils as cu
# python参数校验模式
IS_PYTHON_SCHEMA = False
# 添加cookie字段到header中
COOKIE_IN_HEADER_MODEL = {
"default": "",
"description": "",
"in": "header",
"name": "Cookie",
"required": False,
"type": "string"
}
def prompt():
"""提示信息"""
print('示例: python3 apidoc2sw... |
#!/usr/bin/env python3
import sys
from collections import Counter
import json
from memoize import memoize
import pinyin
import jyutping
# import pycantonese
# corpus = pycantonese.hkcancor()
#from hanziconv import HanziConv
# from opencc import OpenCC
# s2hk = OpenCC('s2hk').convert
from mkdict import pinyin_to_zhuy... |
from django.http.response import HttpResponseRedirect, JsonResponse
from django.shortcuts import get_object_or_404, render,redirect
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate,login,logout
from django.contrib.auth.models imp... |
import json
import logging
import os
import time
import pdb
import numpy as np
import torch
from torch.optim.lr_scheduler import LambdaLR
from sklearn.metrics import f1_score, confusion_matrix, accuracy_score, classification_report
from torch.utils.data import RandomSampler, DataLoader, SequentialSampler, dataloader
fr... |
import discord
from discord.ext import commands, menus
import difflib
import textwrap
from utilities import checks
from utilities.menu import Menu
def setup(bot):
bot.add_cog(Blobs(bot))
class Blobs(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.menus = []
self.bot.loop.create_task(self.init... |
"""[summary]
Define the component in this project
"""
import abc
import logging
from pathlib import Path
from subprocess import call
import cv2
import numpy as np
from tqdm import tqdm
class InternalInputObject(abc.ABC):
"""internal class for input source
Attributes:
src: source data
src_pa... |
import tensorflow as tf
from tensorflow.python.client import device_lib
import logging
import itertools
import pickle
import os
import time
import numpy as np
from collections import namedtuple
from cibi import utils
logger = logging.getLogger(f'cibi.{__file__}')
Reinforcement = namedtuple(
'Reinforcement',
... |
from assistant.subgraph.config import subgraph_config
from brownie import interface
from rich.console import Console
from gql import gql, Client
from gql.transport.aiohttp import AIOHTTPTransport
from decimal import *
import json
from functools import lru_cache
getcontext().prec = 20
console = Console()
tokens_subgra... |
import cv2
import numpy as np
import os
from pycocotools import mask as maskUtils
import torch
# transpose
FLIP_LEFT_RIGHT = 0
FLIP_TOP_BOTTOM = 1
class SemanticSegmentation(object):
"""
This class handles semantic segmentation for all objects in the image
"""
FLIP_MAP = ()
def __init__(self, se... |
#Description:
# - This file retrieves new issue data from github or Jira for the libraries in the DB.
# - Assumes that addlibraries was already run to add any new libraries in the LibraryData.json file.
# - It first checks the last issue stored in the DB and retrieves new issues since then
#
#Requirements:
# - You wi... |
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
from pyiron_feal.utils import HasProject, bfs
import numpy as np
from functools import lru_cache
from pyiron_base import... |
from django.db import models, transaction, IntegrityError
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.utils import timezone
from .utils import classproperty, get_duration, get_natural_duration
def _get_or_create(klass, **kwargs):
"Mimic lo... |
import numpy as np
import pandas as pd
import numba
from vtools.functions.filter import cosine_lanczos
def get_smoothed_resampled(df, cutoff_period='2H', resample_period='1T', interpolate_method='pchip'):
"""Resample the dataframe (indexed by time) to the regular period of resample_period using the interpolate me... |
"""
Denoise an image with the FFDNet denoising method
Copyright (C) 2018, <NAME> <<EMAIL>>
This program is free software: you can use, modify and/or
redistribute it under the terms of the GNU General Public
License as published by the Free Software Foundation, either
version 3 of the License, or (at your option) any ... |
import pytest
import numpy as np
from phidl import Device, Group, Path
import phidl.geometry as pg
import phidl.routing as pr
import phidl.path as pp
# import phidl.utilities as pu
def test_route_quad():
D = Device()
port1 = D.add_port(name = 1, midpoint = (30, 30), width = 20, orientation = 270)
port2 = ... |
"""
MODEL DRIVEN REGISTRATION for quantitative renal MRI
@<NAME>
2021
Test script for T1 sequence registration using Model driven registration Library
"""
import sys
import glob
import os
import numpy as np
import itk
import SimpleITK as sitk
import pydicom
from pathlib import Path
import time
from PIL import Im... |
#! /usr/bin/env python
from __future__ import division
import argparse
import logging
import os
import matplotlib.pyplot as plt
import cv2 as cv
from skimage import io as skio
from tqdm import tqdm
from tools import background_modeling, foreground_improving, detection, visualization, traffic_parameters
from tools.... |
__author__ = "songjiangshan"
__copyright__ = "Copyright (C) 2021 songjiangshan \n All Rights Reserved."
__license__ = ""
__version__ = "1.0"
import json
from django.shortcuts import render
from rest_framework.response import Response
from rest_framework import viewsets
from rest_framework import serializers
from rest_... |
# -*- coding: utf-8 -*-
import abc
class Translatable(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def translate(self, translator):
pass
@abc.abstractmethod
def __str__(self):
return str()
class QueryStatement(Translatable):
__metaclass__ = abc.ABCMeta
class S... |
import calendar
import datetime as dt
import os
from datetime import datetime
import collections
import requests
from cryptography.fernet import Fernet
from flask import (Blueprint, abort, flash, jsonify, redirect, render_template,
request, session, url_for)
from flask_login import current_user, logi... |
# Benchmark suites from the Fast Downward benchmark collection.
def suite_alternative_formulations():
return ['airport-adl', 'no-mprime', 'no-mystery']
def suite_ipc98_to_ipc04_adl():
return [
'assembly', 'miconic-fulladl', 'miconic-simpleadl',
'optical-telegraphs', 'philosophers', 'psr-large... |
#!/usr/bin/python3
#
#
# pihole-status
# https://github.com/bkolin/pihole-status
#
# This script shows various status data about the connected pi-hole on
# an attached 13-6-based OLED screen:
#
# System information:
# - IP address
# - CPU utilization
# - Memory in use / Total memory
# - Disk space used / Total disk s... |
from datetime import datetime
import json
import os
import sys
import logging
import errno
import time
import pyfuse3
import pyfuse3_asyncio
from cacheout import Cache
from . import node
from osfclient.models.file import File
log = logging.getLogger(__name__)
def fromisoformat(datestr):
datestr = datestr.replace(... |
from typing import Union, Dict
from dataclasses import dataclass
import numpy as np
import torch
import torchmetrics
from torchmetrics import MetricCollection
@dataclass
class RunningStats():
# Inspired by:
# https://www.johndcook.com/blog/standard_deviation/
N: int = 0
mean: int = 0.0
pseudo_v... |
import numpy as np
from scipy.special import wofz as wofz_scipy
import xobjects as xo
from xobjects.context import available
from xfields.general import _pkg_root
def test_cerrf_q1():
ctx = xo.ContextCpu(omp_num_threads=2)
xx = np.logspace(-8, +8, 51, dtype=np.float64)
yy = np.logspace(-8, +8, 51, dtype... |
# Copyright © 2014-2018 <NAME> <<EMAIL>>
#
# 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, publish,... |
from __future__ import annotations
import random
from typing import Optional, Tuple, Union
from django.db import models
from django.db.models import Manager, Q, QuerySet
from telegram import Update
from telegram.ext import CallbackContext
from dtb.settings import DEBUG
from tgbot.handlers.utils.info import extract_u... |
import os
import re
import shutil
from collections import namedtuple
from itertools import chain
from string import Formatter
import click
from salmon import config
from salmon.constants import (
ARROWS,
BLACKLISTED_CHARS,
BLACKLISTED_FULLWIDTH_REPLACEMENTS,
)
from salmon.tagger.tagfile import TagFile
Ch... |
from __future__ import print_function, division, absolute_import
import pickle
import numpy as np
import pytest
from crick import TDigest
# -- Distributions for testing --
N = 100000
# A highly skewed gamma distribution
gamma = np.random.gamma(0.1, 0.1, N)
# Uniform from [0, 1]
uniform = np.random.uniform(0, 1, ... |
import numpy as np
import argparse
from time import time, strftime
import pygame
import go
import playmodel
import cProfile
parser = argparse.ArgumentParser()
parser.add_argument("--epochs", "-e", default=10000, type=int)
parser.add_argument("--output-intv", "-o", dest="output_intv", default=1000, type=int)
parser.add... |
import sys
import click
from taskmgr.lib.logger import AppLogger
from taskmgr.lib.model.database_manager import DatabaseManager
from taskmgr.lib.presenter.file_manager import FileManager
from taskmgr.lib.presenter.task_sync import CsvFileImporter
from taskmgr.lib.variables import CommonVariables
from taskmgr.lib.view... |
####line scab
def run_gi_sweden_SAXS(tim=0.5, sample='Test', ti_sl = 60):
# Slowest cycle:
name = 'TP'
num = 2
x_interface = [piezo.x.position]
x_surface = x_interface[0]-1500
piezo_y_range = [-20, 20, 41]
samples = [sample + '_interface']
surface_sample = sample + '_sur... |
#!/usr/bin/env python
import argparse
import fileinput
import logging
import math
import os
import shutil
import subprocess
import sys
import tempfile
from glob import glob
def stop_err(logger, msg):
logger.critical(msg)
sys.exit(1)
def log_subprocess_output(logger, pipe):
for line in iter(pipe.readlin... |
"""The cnapy yield optimization dialog"""
import io
import re
import traceback
from qtpy.QtCore import Qt, Signal
from qtpy.QtWidgets import (QCompleter, QDialog, QHBoxLayout, QLabel,
QLineEdit, QMessageBox, QPushButton, QVBoxLayout)
from cnapy.appdata import AppData
from cnapy.gui_elemen... |
import zmq
import subprocess
import multiprocessing
import imp
import os
import numpy as np
import time
import logging
import pickle
import threading
import sys
URI_process_to_host = "tcp://127.0.0.1:5533"
URI_host_to_process = "tcp://127.0.0.1:5534"
# each message is sent via send_multipart( type, content ). if
# ... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from .cnn_encoder import LightweightConv1d
from ..scale_mix import ScalarMix
from ..layers import Dropout
# PE(pos, 2i) = sin(pos/10000^(2i/d_model))
# PE(pos, 2i+1) = cos(pos/10000^(2i/d_model))
def PositionEncoding(max_len, d_mode... |
import pdb
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as tmodels
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
paddi... |
import tkinter as tk
import random
import webbrowser as wb
from collections import defaultdict as dd
import threading
import time
import json
import wikipedia as wiki
#path to sprites
im_path = "temp_sprites/"
root = tk.Tk() #Main window widget
root.title('<NAME>')
root.wm_attributes('-transparentcolo... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Anaconda, Inc. All rights reserved.
#
# Licensed under the terms of the BSD 3-Clause License.
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------... |
#!/usr/bin/env python2
##
## app.py
##
## Copyright (C) 2011 - <NAME>
##
## This 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 3 of the License, or
## (at your option) any later version.
##
... |
#!/usr/bin/env python3
# Copyright (c) 2021 Grumpy Cat Software S.L.
#
# This Source Code is licensed under the MIT 2.0 license.
# the terms can be found in LICENSE.md at the root of
# this project, or at http://mozilla.org/MPL/2.0/.
"""
Shapelets run-time tools
"""
import warnings
warnings.filterwarnings("ignor... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class BaseNetwork(nn.Module):
def __init__(self):
super(BaseNetwork, self).__init__()
def init_weights(self, init_type='normal', gain=0.02):
'''
initialize network's weights
init_type: normal | xavier | kaiming... |
from collections import defaultdict
import json
import matplotlib.pyplot as plt
from matplotlib.ticker import PercentFormatter
import mplleaflet
import networkx as nx
import numpy as np
from operator import itemgetter
import pandas as pd
from scipy.spatial import distance
from scipy import stats
from shapely.geometry i... |
from collections import namedtuple
import numpy as np
import torch
import torch.nn as nn
from torchvision import models
from torch.autograd import Variable
def var(x, dim=0):
"""
Calculates variance.
"""
x_zero_mean = x - x.mean(dim).expand_as(x)
return x_zero_mean.pow(2).mean(dim)
class Multip... |
"""
Test:
#############
#...........#
###B#C#B#D###
#A#D#C#A#
#########
Puzzle:
#############
#...........#
###B#C#A#B###
#C#D#D#A#
#########
We'll define the graph positions (in hex digits), total of 15 valid slots:
89 A B C DE
0 2 4 6
1 3 5 7
The weight of 9-A, A-B, B-C, C-D, 0-{9,A}, 2-{A,B}, 4-{... |
import cv2
import numpy as np
import math
from collections import defaultdict
from scipy.ndimage.filters import maximum_filter
import itertools
CocoPairs = [
(1, 2), (1, 5), (2, 3), (3, 4), (5, 6), (6, 7), (1, 8), (8, 9),
(9, 10), (1, 11), (11, 12), (12, 13), (1, 0), (0, 14), (14, 16),
(0, 15), (15, 17), (... |
############################################################
# -*- coding: utf-8 -*-
#
# # # # # # #
# ## ## # ## # #
# # # # # # # # # # #
# # ## # ## ## ######
# # # # # # #
#
# Python-based Tool for interaction with the 10micron mounts
# GUI with PyQT5 fo... |
# Copyright(c) 2014, The LIMIX developers (<NAME>, <NAME>, <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 app... |
import numpy as np
def calculate_crop_number(image, crop_height, crop_width, oc):
'''
Calculate how many sub images a nuclei image can be cropped
Args:
image: original image
crop_height: the expected height of output sub images
crop_width: the expected width of output sub images
... |
# -*- coding: utf-8 -*-
"""
Created on Aug 29, 2015
Looper that only shows visible elements
@author: jrm
"""
from atom.api import Instance,ContainerList,List
from enaml.core.looper import Looper, sortedmap, new_scope, recursive_expand
from enaml.core.declarative import d_
from atom.api import observe
from enaml_data... |
from sqlite3 import IntegrityError
from src.Helper import returnError, returnJSON, returnMessage, returnJSONText
from flask import render_template, make_response, send_from_directory, send_file, request, Flask, g
from src.Settings import validSettings as validSettingValues
import re
import json
import jwt
import time
f... |
import tensorflow as tf
import numpy as np
import copy
from tensorflow.python.platform import gfile
from video_prediction.vpred_model_interface import VPred_Model_Interface
from video_prediction.logger import Logger
from video_prediction.checkpoint_matcher import variable_checkpoint_matcher
import re
from tenso... |
import os
import random
import re
import traceback
from datetime import datetime
import discord
import psycopg2
import qrcode
import requests
from discord import Embed
from discord.ext import commands
SQLpath = os.environ["DATABASE_URL"]
db = psycopg2.connect(SQLpath) # sqlに接続
cur = db.cursor() # なんか... |
""" This script execute the group VM backup and restore scenario. """
## The script can be run with Python 3.6 or higher version.
## The script requires 'requests' library to make the API calls.
import argparse
import common
import vm_backup
import vm_restore
PARSER = argparse.ArgumentParser(description="Group VM b... |
"""
Implements setuptools 'bdist_wotmod' command.
The command builds python files, installs them to a temp dir and creates a
wotmod package of them.
"""
from distutils import log
from distutils.dir_util import mkpath, remove_tree
from distutils.file_util import copy_file
import distutils.util
from setuptools import Co... |
"""
Helper functions to calculate error metrics.
Paper:
"ForecastNet: A Time-Variant Deep Feed-Forward Neural Network Architecture for Multi-Step-Ahead Time-Series Forecasting"
by <NAME>, <NAME>, and <NAME>
Link to the paper: https://arxiv.org/abs/2002.04155
"""
import numpy as np
import warnings
def calculate_error... |
from __future__ import absolute_import, division, print_function
import math
import copy
import mmtbx.model
from numpy import NaN
from libtbx.utils import null_out
from collections import OrderedDict
from scitbx.array_family import flex
from mmtbx.secondary_structure.build import ss_idealization as ssb
def format_HELI... |
import math
import sys
import struct
import json
from fractions import Fraction
from collections import Counter
from . import *
PREFIXES = {
'Y': (24,'yotta'),
'Z': (21,'zetta'),
'E': (18,'exa'),
'P': (15,'peta'),
'T': (12,'tera'),
'G': (9,'giga'),
'M': (6,'mega'),
'k': (3,'kilo'),
'h': (2,'hecto'),
'da': (... |
import logging, os
import argparse
import torch, re
def parse_str_list(input_):
if input_ == None:
return []
return list(map(str, input_.split(',')))
# class MyLogger:
# def __init__(self, output_path):
# self.output_path = output_path
# with open(output_path, 'w') as f:
# ... |
#!/usr/bin/python3
# -*- coding: utf8 -*-
import re
from urllib.parse import urlparse, unquote
import requests
from bs4 import BeautifulSoup
from medium.model import User, Post, Publication, Tag, Image, OutputFormat, to_dict
from medium.constant import ROOT_URL, HTML_PARSER
from medium.file_handler import IpfsHandler... |
# -*- coding: utf-8 -*-
from nomenclator.vendor.Qt import QtWidgets, QtCore, QtGui
class EditableList(QtWidgets.QWidget):
"""Widget representing a list with editable items."""
#: :term:`Qt Signal` emitted when items have changed.
updated = QtCore.Signal(tuple)
def __init__(self, parent=None):
... |
#
# __COPYRIGHT__
#
# 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, publish,
# distribute, sublicen... |
from functools import partial
from typing import Callable, Optional, Sequence, Tuple
import jax.numpy as jnp
from flax import linen as nn
from .common import ConvBlock, ModuleDef, Sequential
from .splat import SplAtConv2d
STAGE_SIZES = {
18: [2, 2, 2, 2],
34: [3, 4, 6, 3],
50: [3, 4, 6, 3],
101: [3, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of the
# Pyedra Project (https://github.com/milicolazo/Pyedra/).
# Copyright (c) 2020, <NAME>
# License: MIT
# Full Text: https://github.com/milicolazo/Pyedra/blob/master/LICENSE
# ===================================================================... |
''' Data classes that help to support smooth calculations in a 2D world '''
from math import sqrt
from enum import IntEnum
from dataclasses import dataclass
from collections import OrderedDict
def normalize(number):
""" Clamps a number to be -1, 0, or 1. """
if number == 0:
return int(number)
retu... |
import maya.cmds as m
import pymel.core as pm
SCRIPT_NAME = 'FX Reorient'
WIN_NAME = 'fx_reorientWin'
BUTTON_WIDTH = 150
MAIN_BUTTONS_HEIGHT = 30
LOCATOR_FLY_AWAY_DISTANCE = 100
win = None
# noinspection PyAttributeOutsideInit
# noinspection PyMethodMayBeStatic
# noinspection PyUnusedLocal
class ReorientUI(object... |
#!/usr/bin/python3
# number of output figures = 2
import matplotlib as mpl
#import mpl_toolkits.mplot3d.art3d
import numpy as np
import scipy.interpolate
from helper.figure import Figure
import helper.plot
def plotFigure1():
largeMargin = 0.5
smallMargin = 0
largeArrowWidth = 0.4
smallArrowWidth = 0.2
ba... |
import argparse
from converting.make_json import *
from utils.datasets import *
from utils.utils import *
from utils.torch_utils import *
from utils.layers import *
from model.models import *
fps_count_g = []
bbox_list = []
conf_list = []
def init(out, device):
device_2 = torch_utils.select_device(device='cpu' ... |
from functools import partial
import numpy as np
from jax import core, dtypes, lax
import jax.numpy as jnp
from jax.interpreters import xla, ad, batching
from jax.abstract_arrays import ShapedArray
from jax.lib import xla_client
from jax.api import jit, vmap
from jax.api import jacfwd, device_put
from jax.lib import xl... |
"""
watch.py
Manages the watch cursor.
"""
import time
import typing
import pymongo.change_stream
import pymongo.collection
import pymongo.database
import pymongo.mongo_client
OperationType = typing.Literal["insert", "update", "delete", "replace", "drop", "rename", "dropDatabase", "invalidate"]
class Operation()... |
# NOTE: This changes a/b to produce a floating point approximation of that
# ratio, not the integer quotient. For integer quotient, use a//b instead.
from __future__ import division
import dis
import itertools
import numpy as np # TEMP
import sympy
# NOTE: This is used so that array, cos, sin, etc are present in thi... |
# Copyright 2021 The KubeEdge 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 agreed to in... |
#-------------------------------
# Cross section definition
#-------------------------------
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import interp1d
from scipy.optimize import curve_fit
#--------------------------
# Inverse Beta Decay (IBD)
#--------------------------
# IBD cross se... |
"""Binary that evaluates a GRAF model conditioned on an input sketch-like image.
The code in this file is based on eval.py and modified to condition on
a sketch.
"""
import argparse
import os
from os import path
import numpy as np
import time
import copy
import csv
import cv2
import torch
torch.set_default_tensor_type... |
from typing import Tuple, Callable, Union
from tensorflow.keras import backend as K
import tensorflow as tf
from models.metrics import MetricBase
_EPS = K.epsilon()
_SMOOTH = 1.0
LIST_AVAIL_METRICS = ['MeanSquaredError',
'MeanSquaredErrorLogarithmic',
'BinaryCrossEntropy... |
#!/usr/bin/env python
#
# Copyright (C) 2019 The Android Open Source Project
#
# 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 req... |
# Copyright 2018 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.
import collections
import itertools
import logging
from dashboard.pinpoint.models import attempt as attempt_module
from dashboard.pinpoint.models import cha... |
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.utils.model_zoo
import numpy as np
from dataloaders import CaffeValPipe
from collections import OrderedDict
import argparse
class CaffeBNAlexNet(nn.Module):
def __in... |
"""
HPO view - Human Phenotype Ontology
"""
from flask import jsonify, session
from psycopg2 import sql
from db.helpers import cursor2dict, query_user_config
from views import MAX_PAGE_SIZE, application
from views.auth import USER, requires_auth
from views.exceptions import PhenopolisException
from views.general impor... |
import torch
import torch.nn as nn
from pyro.nn import ConditionalAutoRegressiveNN
class BatchNormFlow(torch.nn.Module):
"""Implements the batch normalization flow described in MAF paper,
1705.07057, appendix B.
Code adapted from pyro and
https://github.com/kamenbliznashki/normalizing_flows
The ... |
# -*- coding:UTF-8 -*-
import talib
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.widgets import Widget
from matplotlib import ticker as tk
from mplfinance.original_flavor import candlestick_ohlc
indicators = ["kama", "mavol", "macd"]
data_path = "data/01-chart-01"
file_name = ... |
from Maix import I2S, GPIO
import audio
from Maix import GPIO
from fpioa_manager import *
from machine import I2C
import uos
import time
# mpu6886 用レジスタアドレスの定義
class MPU6886_regmap:
#SLAVE ADDLESS
SL_ADD = 104
#REGISTER ADDLESS
XG_OFFS_TC_H = 4
XG_OFFS_TC_L = 5
YG_OFFS_TC_H = 7
YG_OFFS... |
from django import forms
from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.core.urlresolvers import reverse
from django.forms import widgets
from django.utils.html import escape
from crispy_forms.helper import FormHelper
from crispy_forms.lay... |
"""
MIT License
Copyright (c) 2021 isaa-ctaylor
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, publish, ... |
import re
from openpecha.core.layer import LayerEnum
from openpecha.utils import load_yaml
from .serialize import Serialize
from .epub import TsadraTemplateCSSClasses
class AnnotationTemplate:
span_EP = "</span>"
para_EP = "</p>"
book_title_SP = '<p><span class="book-title"'
sub_title_SP = '<p><span... |
import os
import tensorflow as tf
import numpy as np
from tensorflow import keras
class Downsample(keras.Model):
def __init__(self, filters, size, apply_batchnorm=True):
super(Downsample, self).__init__()
self.apply_batchnorm = apply_batchnorm
initializer = tf.random_norm... |
import pickle
import mnist
import seaborn as sns
import mpmath as mp
import numpy as np
from numpy.testing import assert_array_almost_equal as aae
from matplotlib import pyplot as plt
from scipy.spatial.distance import cdist
from scipy.stats import norm
from scipy.stats import multivariate_normal as mn
import sklearn... |
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import cv2
import numpy as np
import gripit.edgelib.util as util
global window_size
glob... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
base module for idiota
"""
__author__ = "prakashsellathurai"
__copyright__ = "Copyright 2021"
__version__ = "1.0.1"
__email__ = "<EMAIL>"
import itertools
import operator
import os
import string
from collections import deque, namedtuple
from . import data
from . imp... |
import traceback
from fastNLP.core.const import Const
from fastNLP.io.data_bundle import DataBundle
from fastNLP.io.loader import THUCNewsLoader
from fastNLP.io.pipe import Pipe
from fastNLP.io.pipe.utils import get_tokenizer
from fastNLP.io.pipe.utils import _indexize
from myClue.core import logger
def... |
import os
import sys
import json
import datetime
import numpy as np
import skimage.draw
"""
Usage: import the module (see Jupyter notebooks for examples), or run from
the command line as such:
# Train a new model starting from pre-trained COCO weights
python postit.py train --dataset=/path/to/postit/dat... |
import functools
import typing
import attr
import numpy as np
from robogym.envs.dactyl.observation.reach import (
GoalFingertipPosObservation,
GoalIsAchievedObservation,
)
from robogym.envs.dactyl.observation.shadow_hand import (
MujocoShadowhandAbsoluteFingertipsObservation,
MujocoShadowHandJointPosO... |
import abc
from dataclasses import dataclass, asdict
from typing import Sequence, Tuple, Optional, Union
import torch
from torch import nn
from torch.distributions import MultivariateNormal
from models.base_gls import (
BaseGaussianLinearSystem,
Latents,
Prediction,
ControlInputs,
)
from models.gls_pa... |
import os, os.path, re, subprocess, time, shutil
import csv, json
import xml.etree.ElementTree as ET
import urllib.request
from progressbar import ProgressBar
from Bio import Entrez, SeqIO
from fasta_parser import FastaParser
from utils import extract_gene_name
Entrez.email = "<EMAIL>"
class DefParser(object):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.