text stringlengths 3.07k 22.1k |
|---|
"""
Run integration tests from pixsim through redshifts
python -m lvmspec.test.integration_test
"""
from __future__ import absolute_import, print_function
import sys
import os
import random
import time
import subprocess as sp
import glob
import numpy as np
from astropy.io import fits
from lvmspec.util import runcmd
... |
#!/usr/bin/env python
"""
Command line entrypoint. This module declares the Copier CLI applications.
Basically, there are 3 different commands you can run:
- [`copier`][copier.cli.CopierApp], the main app, which is a shortcut for the
`copy` and `update` subapps.
If the destination project is found and has ... |
import os
import cv2
import torch
from mmcv.runner import auto_fp16
from ..builder import build_loss
from ..registry import MODELS
from .base_mattor import BaseMattor
# For RGB !
group_norm_std = [0.229, 0.224, 0.225]
group_norm_mean = [0.485, 0.456, 0.406]
def np2torch(x):
# to nchw
return torch.from_nump... |
#!/usr/bin/env python3
from __future__ import absolute_import, unicode_literals
import contextlib
import json
import os
import sys
import time
from datetime import datetime
from socket import socket
from time import sleep
from scapy.layers.dns import DNS
from scapy.layers.inet import ICMP, IP, TCP, UDP
from scapy.sen... |
from re import DEBUG, S
from hklearn_genetic.utils import ProblemUtils
from hklearn_genetic.Evaluators.FunctionEvaluators import DTLZ1, DTLZ2, DTLZ12D
from hklearn_genetic.Problems import RealGAProblem, BaseGAProblem, RealBGAProblem, BinaryGAProblem
from hklearn_genetic.NSGAIII import NSGAIII
from hklearn_genetic.NSGAI... |
# -*- coding: utf-8 -*-
# @author: edgardeng (https://github.com/edgardeng)
# @date: 2021-02-08
# @file: 使用cv2操作图片
import cv2
import numpy as np
from matplotlib import pyplot as plt
def get_image(path_img):
""" 读入一张图片 """
img = cv2.imread(path_img) # 打开图片
print(f'Type: {type(img)}')
print(f'Image... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import pydicom
import os
# Function
def ShowImage(title,img,ctype):
plt.figure(figsize=(9, 9))
if ctype=='gray':
plt.imshow(img,cmap='gray')
elif ctype=='rgb':
plt.imshow(img)
else:
raise Exception("Unknown colour type")
plt.axis('off'... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# encoding: utf-8
# Copyright 2014 Orange
#
# 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
#
# Un... |
# /usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Class definition for GraspModel
"""
import errno
import os
import os.path
import time
from copy import deepcopy as c... |
import logging
import numpy as np
import paddle
from paddle import fluid
from paddle.fluid import dygraph
from modules.util import Hourglass, AntiAliasInterpolation2d, kp2gaussian, \
make_coordinate_grid_cpu
# ====================
TEST_MODE = False
if TEST_MODE:
logging.warning('TEST MODE: dense_motion.py')
#... |
from enum import Enum, IntEnum
from homeassistant.components.climate.const import \
HVAC_MODE_COOL, HVAC_MODE_FAN_ONLY, HVAC_MODE_HEAT, HVAC_MODE_DRY, HVAC_MODE_AUTO, HVAC_MODE_HEAT_COOL
class EnumCmdType(IntEnum):
# 返回指令
SYS_ACK = 1
SYS_CMD_RSP = 2
SYS_TIME_SYNC = 5
SYS_ERR_CODE = 6
SYS_... |
#import Our Packages
import pygame as pg
import time
import random
#initialize all imported pygame modules
pg.init()
#Our Colors
white = (255, 255, 255)
black = (0, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
red = (255, 0, 0)
ceil = (19, 229, 240)
yellow = (255, 255, 25)
red2 = (219.3,2.6,14.27)
#Size of Display ... |
from django.test import TestCase, SimpleTestCase, Client
from .models import Donation, Volunteer, Profile
from django.contrib.auth.models import User
from .forms import DonationForm, VolunteerForm, UpdateDonationForm, UpdateVolunteerForm
from django.urls import reverse, resolve
from .views import donation_make, volunte... |
"""
"""
# Tensorflow mandates these.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import namedtuple
import functools
import tensorflow as tf
slim = tf.contrib.slim
# Conv and DepthSepConv namedtuple define layers of the MobileNet arch... |
def select_N_random_races(N_FILTERED_RACES):
import pickle
import random
import numpy as np
from context import datasources_path, pickles_path
races_path = datasources_path+"Images\\"
dict_race_pictures_train = pickle.load(open(pickles_path+"dict_race_pictures_train.p", "rb" ))
dict_race_pi... |
from argparse import ArgumentParser
import os
import time
import random
import numpy as np
import torch
import torch.nn as nn
from torchvision import datasets
import albumentations
import albumentations.pytorch
def set_seed(seed):
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(s... |
# --*-- coding : utf-8 --*--
"""Author: Trinity Core Team
MIT License
Copyright (c) 2018 Trinity
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 -*-
import struct
from unmasked_message import UnmaskedMessage
"""
indx 0 1 2 3
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------... |
#encoding: utf-8
from __future__ import print_function
import numpy as np
import os
from config import config as cfg
from training import init_env
init_env('0')
from proc.data import load_train_csv, split_train_val, load_test_csv
from model.resnet import ResNet50, preprocess_input
from proc.gennerator import BaseTestGe... |
"""
Binary Search Tree
relies on the property (called bst property) that values less than the parent are found in the
left subtree, and values larger than the parent are found in the right subtree.
10
8 20 --> [10... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from posixpath import join
import boto3
import botocore
import glob
import json
import logging
import os
import pwd
import subprocess
import shutil
from urllib.parse import unquote_plus
from aws_lambda_powertools... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2016-2018 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... |
import datetime as dt
from functools import cached_property
from itertools import product
from typing import Dict, List, Sequence, Union
import pandas as pd
from . import DateUtils
from .config import get_db_interface
from .DBInterface import DBInterface
from .Factor import CompactFactor, CompactRecordFactor, Industr... |
# Copyright (c) 2009-2010 Six Apart Ltd.
# 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 must retain the above copyright notice,
# this list of conditions an... |
import json
import re
from collections import namedtuple
from picraft.connection import Connection
from .vector import Vector
from .exc import CommandError, EntityMethodNotFoundWarning, WorldMethodNotFoundWarning, BlockMethodNotFoundWarning, \
MinecraftMethodNotFoundWarning, MinecraftMethodNotFound, EntityMethodNo... |
"""pose objects"""
class PoseEuler(object):
"""Struct containing all variables needed for instantaneous pose."""
__slots__ = [
"x",
"y",
"z",
"vel_x",
"vel_y",
"vel_z",
"acc_x",
"acc_y",
"acc_z",
"ang_x",
"ang_y",
... |
#############################################################
#
# Robust Synthetic Control Tests (based on ALS)
#
# You need to ensure that this script is called from
# the tslib/ parent directory or tslib/tests/ directory:
#
# 1. python tests/testScriptSynthControlALS.py
# 2. python testScriptSynthControlALS.p... |
#!/usr/bin/python3
"""
Pytorch Variational Autoendoder Network Implementation
"""
from itertools import chain
import time
import json
import pickle
import numpy as np
import torch
from torch.autograd import Variable
from torch import nn
from torch import optim
from torch.nn import functional as F
from sklearn.metrics i... |
import re
import logging
from contextlib import contextmanager
import six
import inflection
log = logging.getLogger(__name__)
class ContentTypes(object):
""" ContentType values.
"""
JSON = 'application/json'
TEXT_XML = 'text/xml'
MULTIPART_FORMDATA = 'multipart/form-data'
FORM_URLENCODED =... |
"""
PychessGame class and unittest implementation for main module Pychess.
Initialized from either PychessTUI (terminal User Interace)
or from the PychessGUI (Graphical User Interface).
Run this program as main to perform unittest of local functions.
Author: <NAME>, <EMAIL>
Last edited: 12-10-2021
"""
import time
imp... |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 <NAME> http://almostobsolete.net/
# Copyright (c) 2012 <NAME> <<EMAIL>>
# Tree hash implementation from <NAME> <EMAIL>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), t... |
import urllib.request
import string
import os, sys
from datetime import date
from pathlib import Path
def getBibTeX(bibref,tag_suf,outFile):
"""
Function to retrieve BibTex entry from NASA ADS,
given a bibref. The tag is amended so that it follows
author last name + year + 'tag_suf'.
"""
if bi... |
# -*- coding: utf-8 -*-
import os
import argparse
import torch
from torch import nn, optim
import torch.utils.data as data
import numpy as np
from model import pearson_coefficient, neural_network
torch.manual_seed(2)
def item(x):
return x.cpu().data.item() if args.device == 'cuda' else x.item()
def to_numpy(x):... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 26 14:07:06 2020
@author: vmaarten
"""
# This function was adapted from: https://lucehe.github.io/differentiable-argmax/
def prob2oneHot(x):
import tensorflow as tf
a = K.pow(x, 10)
out_sum = tf.reduce_sum(a,axis=3,keepdims=True)
out_div = tf.... |
import numpy as np
import softposit as sp
from tensorflow.keras.datasets import mnist
import sys
import os
import pickle
import csv
import time
from collections import OrderedDict
from common.layers import *
from common.matmul_quire import *
from common.read_weights import *
import multiprocessing as mp
from multiproce... |
# Copyright 2016, Google Inc.
# 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 must retain the above copyright
# notice, this list of conditions and the f... |
import networkx as nx
from bitcoin import *
import random
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
from Crypto.Signature import pkcs1_15
import os
from bokeh.models import Circle, MultiLine
from bokeh.plotting import figure, from_networkx, show
from bokeh.layouts import row
satoshi = Agent(na... |
import os
from io import StringIO
from pathlib import Path
import numpy as np
import pandas as pd
from timeeval import Datasets, DatasetManager
from timeeval.datasets import DatasetRecord, DatasetMetadata, AnomalyLength, Stationarity
CUSTOM_DATASET_PATH = Path("tests/example_data/datasets.json")
custom_dataset_name... |
import argparse
import os
import sys
import cv2
import numpy as np
import tensorflow as tf
# Root directory of the project
ROOT_DIR = os.path.abspath("../")
# Import Mask RCNN
sys.path.append(ROOT_DIR) # To find local version of the library
from mrcnn import utils
import mrcnn.model as modellib
i... |
import re
from uuid import uuid4
from threedigrid.orm.base.datasource import DataSource
try:
import asyncio_rpc # noqa
except ImportError:
raise Exception(
"asyncio_rpc needs to be installed when using this module,"
"install it with: pip install asyncio_rpc")
from asyncio_rpc.models import RPC... |
import tensorflow as tf
from tensorflow.contrib import predictor
from abc import abstractmethod
import numpy as np
import os
import matplotlib.pyplot as plt
import zipfile
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix
import itertools
from sklearn.metrics import roc_c... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
"""
An experimental simulator for a TOF neutron reflectometer
"""
__author__ = '<NAME>'
__copyright__ = "Copyright 2019, <NAME>"
__license__ = "3 clause BSD"
import numpy as np
from scipy.integrate import simps
from scipy.interpolate import InterpolatedUnivariateSpline as IUS
from scipy.stats import rv_continuous, tra... |
# PuyoTikZ package for LaTeX.
# Created by amosborne (GitHub) / terramyst (Twitter).
# MIT License
import numpy as np
import itertools
import string
import re
# Wraps a function which returns a string. Prints the result with a ";".
def print_tikz(func):
def wrapper(*args, **kwargs):
print(func(*args, **k... |
__author__ = 'thorwhalen'
import ut.parse.google as google
import pandas as pd
import re
from bs4.element import Tag
import ut.semantics.text_processors as semantics_text_processors
import ut.util.ulist as util_ulist
import ut.daf.manip as daf_manip
import ut.coll.order_conserving as colloc
#### Utilsxw
LOCATION_LOC... |
from abc import ABC, abstractmethod
import serial
import socket
import constants
class FoenixDebugPort:
"""Provide the connection to a C256 Foenix debug port."""
connection = None
status0 = 0
status1 = 0
def open(self, port):
"""Open a connection to the C256 Foenix."""
if ':' in po... |
from enum import Enum
from os import path
from typing import Dict, List
from pygame import Surface, image, transform, SRCALPHA
from enums import PlayerState, ButtonState, EnemyState, WindDirection, ProjectileState, TornadoProjectileState
def scaling_repeat(surface: Surface, size: (int, int)):
return_surface = S... |
#!/usr/bin/env python
"""Author: <NAME>
Copyright (C) 2020 ACK CYFRONET AGH
This software is released under the MIT license cited in 'LICENSE.txt'
Runs integration tests, providing Erlang's ct_run with every
environmental argument it needs for successful run. The output is put into
'test_distributed/logs'. The (init|... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import tensorflow as tf
from number import Number
from all_numbers_video import All_numbers
import linija as linija
# keras
from keras.models import Sequential
from keras.layers import Dense, Conv2D, Dropout, Flatten, MaxPooling2D
import test as testiranje
... |
import unittest
import os
import sys
import responses
current_dir = (os.path.abspath(os.path.dirname(__file__)))
sys.path.insert(0, os.path.join(current_dir, '..', '..'))
from processes.get_itunes import RequestAPI, iTunesFilm, Main, ChooseBest
class TestMain(unittest.TestCase):
"""Testing RequestAPI"""
@cl... |
from time import sleep
import usb_midi
import adafruit_midi
from adafruit_midi.note_off import NoteOff
from adafruit_midi.note_on import NoteOn
import board
import busio
from digitalio import DigitalInOut, Direction, Pull
from adafruit_neotrellis.neotrellis import NeoTrellis
from adafruit_neotrellis.multitrellis imp... |
from argparse import ArgumentParser
from datetime import datetime, timezone
import os
import sys
import csv
import subprocess
import yaml
#import numpy as np
#import scipy.sparse as ss
from collections import defaultdict
import config_utilities as cf
import redis_utilities as ru
import mysql_utilities as mu
import san... |
import os
from django.conf import settings
from django.core.management import BaseCommand
from django_test_tools.generators.crud_generator import GenericTemplateWriter
from django_test_tools.generators.model_generator import FactoryBoyGenerator
from ...app_manager import DjangoAppManager
PRINT_IMPORTS = """
import s... |
# -*- coding: utf-8 -*-
import time
from abc import ABCMeta, abstractmethod
from collections import namedtuple
from time import sleep
# from typing import Optional
from threading import Timer
from datetime import datetime
from threading import RLock, Thread
from futuquant.common.utils import *
from futuquant.common.ha... |
from common import *
from bms import *
from configure import *
from patch import *
#from torch.nn.utils.rnn import pad_sequence, pack_padded_sequence
#(2424186, 6)
#Index(['image_id', 'InChI', 'formula', 'text', 'sequence', 'length'], dtype='object')
def make_fold(mode='train-1'):
if 'train' in mode:
df = ... |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import time
import sys
from subprocess import Popen, PIPE
import traceback
import json
import argparse
import datetime
import signal
impor... |
# -*- coding: utf-8 -*-
import tkinter as tk
from tkinter import ttk
from model import HachiUtil
from view import Common
from controller import TxController
# =================================
# == グローバル変数
# =================================
txWidgets = {}
# =================================
# == 送信領域表示設定
# =======... |
import taichi as ti
import taichi_glsl as ts
from .common import *
from .transform import *
import math
@ti.data_oriented
class Camera:
ORTHO = 'Orthogonal'
TAN_FOV = 'Tangent Perspective' # rectilinear perspective
COS_FOV = 'Cosine Perspective' # curvilinear perspective, see en.wikipedia.org/wiki/Curvili... |
## Copyright 2017 Knossos authors, see NOTICE file
##
## 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... |
#%%
import numpy as np
import math
from scipy.stats import norm
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
def Exp_re(x):
return np.log(1/(1-x))
# 回帰式
def func(x, a):
f = a*x
return f
# データの読み込み
Qin=np.loadtxt('./Data.csv', delimiter=',',usecols=[0])
# 0以下の削除
Qin = Qin[Qin > 0]
... |
import pytest
from parsimonious.exceptions import ParseError
from ke.parser import (
Parser,
Concat as C,
Either as E,
Def as D,
Operator,
Macro as M,
Range as R,
Literal as L,
Nothing as N,
)
O = lambda name, sub: Operator(name, None, sub)
v = Parser()
def test_outer_literal():
... |
#!/usr/bin/env python
from datetime import date
from data.composers import Beethoven
from database_design.sonata_data_classes import PieceDataClass, SonataDataClass
from database_design.sonata_table_specs import *
from enums.key_enums import Key
from enums.measure_enums import *
from enums.sonata_enums import *
from g... |
import numpy as np
import os
import pickle
import torch
import json
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import math
import utils
from data.data_utils import *
from data.dataloader_detection import load_dataset_detection
from data.dataloader_classification import load_datase... |
import os
import argparse
import logging
import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import torchvision.datasets as datasets
import torchvision.transforms as transforms
import math
import matplotlib.pyplot as plt
if __name__ != ... |
from ..lc_archive import LcArchive
from ...from_json import from_json
import os
import json
from shutil import rmtree
import unittest
from datetime import datetime
work_dir = os.path.join(os.path.dirname(__file__), 'scratch')
test_file = os.path.join(os.path.dirname(__file__), 'test_json.json')
test_json = {
'dataR... |
import pygame
import random
import time
pygame.init()
win = pygame.display.set_mode((650,600))
pygame.display.set_caption("Rock-Paper-Scissors")
clock = pygame.time.Clock()
player_area = (0,0)
comp_area = (395,0)
bg = pygame.image.load("resources/main.jpg")
poster = pygame.image.load("resources/poster.jpg")
rock = p... |
#!/usr/bin/env python
import sys
import os
import glob
import time
import getpass
import time
from mars_utils import *
LIBRARIES_PATH = os.path.split(os.path.realpath(__file__))[0]
class Project:
def __init__(self, path, platform, platform_folders, des_lib_name, framework_name, other_cflags):
self.path... |
"""
Utility functions to support data generation etc.
Copyright, 2009 - 2022, <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 ... |
""" calculates energies for channels
"""
from phydat import phycon
import thermfit
from mechlib.amech_io import printer as ioprinter
from mechroutines import thermo as thmroutines
# Functions to handle energies for a channel
def set_reference_ene(rxn_lst, spc_dct,
pes_model_dct_i, spc_model_dct... |
# Copyright 2019 Baidu Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
import numpy as np
import datajoint as dj
from . import (lab, experiment, ephys, foraging_model, foraging_analysis)
def _get_units_hemisphere(units):
"""
Return the hemisphere ("left" or "right") that the specified units belong to,
based on the targeted insertion location - "ephys.ProbeInsertion.Insertio... |
import torch
from torch.autograd import Variable
import os
import json
import time
class History:
def __init__(self):
self.meta = {}
self.epoch_history = {}
self.iter_history = {}
def get_dict(self):
hist = {
'meta': self.meta,
'epoch_h... |
"""
-------------------------------------------------------------------------------
DESCRIPTION
-------------------------------------------------------------------------------
Define globally required variables, lists, and functions
"""
#------------------------------------------------------------------------------... |
from pathlib import Path
import cv2
import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial import distance
def match_keypoints(featuresA, featuresB):
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=False)
# ? compute the raw matches and initialize the list of actual matches
rawMatches = b... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
#!/usr/bin/python3
#-*-coding:utf-8-*-
import json
import sys
import functools
import math
import numpy as np
import matplotlib.pyplot as plt
import csv
import os
from tablet import *
from bootstrap import *
from plot import *
#Parse all the files
pairData = {}
files = []
outputDir = os.getcwd()
argv = sys.ar... |
from __future__ import absolute_import
import errno
import os
import shutil
import stat
import time
from mercurial.i18n import _
from mercurial.node import bin, hex
from mercurial.pycompat import open
from mercurial import (
error,
pycompat,
util,
)
from mercurial.utils import hashutil
from . import (
... |
from abc import abstractmethod
import functools as ft
import inspect
import types
from .bit_vector_abc import InconsistentSizeError
from .bit_vector_abc import BitVectorMeta, AbstractBitVector, AbstractBit
# needed to define isinstance(..., BitVectorProtocolMeta)
class _BitVectorProtocolMetaMeta(type):
def __ins... |
import numpy as np
import numpy.testing as npt
import pytest
from pyfar import FrequencyData
def test_data_frequency_init_with_defaults():
"""
Test to init without optional parameters.
Test getter for domain, freq, frequencies, and n_bins.
"""
data = [1, 0, -1]
freqs = [0, .1, .3]
freq = ... |
import torch
import os
from scipy.stats import pearsonr
import torch.optim as optim
import torch.nn.functional as F
from tqdm import trange
import torch
from torchtext import data, datasets
from torch.nn import init
from S_lstm.SModel import SModel
from data_utils.load_uds import S_get_g_data_loader_split
from data_u... |
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import copy
from mplfinance._arg_validators import _process_kwargs, _validate_vkwargs_dict
from mplfinance._styledata import _styles
def _get_mpfstyle(style):
'''
Return a copy of the specified pre-defined mpfstyle. We return
... |
#!/usr/bin/env python
# coding: utf-8
# In[17]:
#using https://github.com/markadivalerio/audio-classifier-project/blob/master as a reference
#using https://medium.com/@anonyomous.ut.grad.student/building-an-audio-classifier-f7c4603aa989 as reference
#using https://towardsdatascience.com/tagged/audio-classification?p... |
import math
from layout import datatypes
from . import root
class SimpleGridLM(root.GroupLayoutManager):
"""
A simple grid takes a number of elements and arranges them
in rows and columns so that each element is the same size.
"""
def __init__(self, columns=1, rows=1, margin=0, elements=[]):
... |
#!/usr/bin/env python3
import datetime
import json
import logging
import os
import sys
import time
import traceback
import unicodedata
from logging.handlers import RotatingFileHandler
from threading import Lock
import fire
import numpy as np
import tensorflow as tf
from flask import Flask, request
from flask.logging i... |
# coding: utf-8
import yt
import numpy as np
from yt.fields.api import ValidateParameter
from mpl_toolkits.axes_grid1 import AxesGrid
from yt.utilities.physical_constants import mp, kb
from yt import derived_field
from yt.units.yt_array import YTQuantity
from yt.funcs import just_one
from scipy.spatial.distance import ... |
import argparse
import numpy as np
from PIL import Image, ImageDraw
#from keras.preprocessing import image
#from keras.applications.vgg16 import preprocess_input
import tensorflow as tf
from tensorflow.keras.preprocessing import image
from tensorflow.keras.applications.vgg16 import preprocess_input
import cfg
from la... |
#
# Copyright (c) 2018 - 2018 <NAME> (<EMAIL>)
# Institute for High Voltage Technology
# RWTH Aachen University
#
# This module is part of cimpyorm.
#
# cimpyorm is licensed under the BSD-3-Clause license.
# For further information see LICENSE in the project's root directory.
#
import json
from argparse import N... |
# from selenium.webdriver.support import expected_conditions as EC
# from selenium.webdriver.common.by import By
# from selenium.webdriver.support.ui import WebDriverWait
#
import time
from utils import get_exceptions_args, cleanup
from cradle import Producer
# import time
import os
import subprocess
import random
imp... |
from trac.versioncontrol import diff
import unittest
class DiffTestCase(unittest.TestCase):
def test_get_change_extent(self):
self.assertEqual((3, 0), diff._get_change_extent('xxx', 'xxx'))
self.assertEqual((0, 0), diff._get_change_extent('', 'xxx'))
self.assertEqual((0, 0), di... |
import argparse
import datetime
import os
import traceback
import kornia
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from torch.utils.data import DataLoader
from tqdm.autonotebook import tqdm
import models
from datasets import LowLightFDataset, LowLightFDatasetEval
from models... |
# The plastic U-Net implementation with infusion of ResNet
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class UNetpRes(nn.Module):
def __init__(self, n_channels, n_classes, device, neurons=16, dropout_ratio=0.5, alfa_type='free', rule='hebb', nbf=128, bat... |
# -*- coding: utf-8 -*-
"""
============================================================
Cubelets Plotting GUI
============================================================
Author: <NAME>, <NAME>
Copyright: dGB Beheer BV
Date: May 2020
License: GPL v3
@author: paul
"""
from functools import partial
imp... |
import argparse
import wandb
import torch.nn as nn
import torch.nn.functional as F
import torch
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torch.nn.utils.spectral_norm as spectral_norm
import torchvision.utils as vutils
import torch.optim as optim
... |
# Tree code is based on Taichi's example repository.
# N-body gravity simulation in 300 lines of Taichi, tree method, no multipole, O(N log N)
# Author: archibate <<EMAIL>>, all left reserved
trash_particle_id = ti.field(ti.i32)
trash_base_parent = ti.field(ti.i32)
trash_base_geo_center = ti.Vector.field(kDim, ti.f32)... |
# pip install pycocotools
import ipdb
st = ipdb.set_trace
import pycocotools
import torch, torchvision
from torchvision.utils import save_image
import detectron2
from detectron2.utils.logger import setup_logger
setup_logger()
import glob
import os
import ntpath
import numpy as np
import cv2
import random
import ite... |
from flask import Response
from os import environ as osenviron
from json import loads as jsonloads
from base64 import b64decode
from gzip import decompress as gzipdecompress
from binascii import Error as binasciiError
from functools import wraps as functoolswraps
from zlib import error as zliberror
authKey='autho... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ******************************************************************************
#
# Project: GDAL
# Purpose: rectangle class (x, y, width, height)
# Author: <NAME>, <<EMAIL>>
#
# ******************************************************************************
# Copy... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import os
import sys
import random
import math
import multiprocessing
import h5py
import json
import numpy as np
import tensorflow as tf
import keras as K
import keras.backend.tensorflow_backend as KTF
from keras.models import Model
from keras.callbacks import ModelChec... |
#
# Copyright © 2022 <NAME>, <NAME>, <NAME>,
# <NAME>, <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 t... |
import dash
from dash.dependencies import Input,Output,State
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import plotly.graph_objs as go
import flask
from random import randint
import os
import os
from steem import Steem
from pick import pick
import ppri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.