text stringlengths 6.04k 39.5k |
|---|
"""This module defines classes aid interfaces for X-Ray fluorescence."""
import copy
import time
import os
import numpy
import json
from datetime import datetime
import pytz
from mxdc.engines.chooch import AutoChooch
from mxdc.engines.scanning import BasicScan
from mxdc.utils import converter
from mxdc.utils import s... |
#!/usr/bin/env python
import rospy
import tf.transformations
from .utils import quaternion_from_euler, PID
import tf2_ros
import std_msgs.msg
from std_msgs.msg import Float64, Int32
from geometry_msgs.msg import Twist, TransformStamped
from nav_msgs.msg import Odometry
from sensor_msgs.msg import JointState
import st... |
#!/usr/bin/env python
# Force Python 2 to use float division even for ints
from __future__ import division
from __future__ import print_function
from time import sleep
import logging
import os
import re
import subprocess
import sys
import stacktrain.config.general as conf
import stacktrain.core.helpers as hf
impor... |
# Visualize streamflow time series and fill missing data
# Script written in Python 3.7
import config as config
import numpy as np
import pandas as pd
import tempfile
import datetime
from sklearn.svm import SVR
import geopandas as gpd
from sklearn.metrics import mean_squared_error as mse
from matplotlib.font_manager i... |
from keras.callbacks import EarlyStopping, ModelCheckpoint, TensorBoard, LearningRateScheduler
from keras.layers import Reshape, Dense, Convolution1D, Dropout, Input, Activation, Flatten,MaxPool1D,add, AveragePooling1D, Bidirectional,GRU,LSTM,Multiply, MaxPooling1D,TimeDistributed,AvgPool1D
from keras.layers.merge impo... |
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2009 <NAME> <http://filipwasilewski.pl/>
# See COPYING for license details.
# $Id: wavelet_packets.py 134 2009-05-10 21:45:10Z filipw $
"""1D and 2D Wavelet packet transform module."""
__all__ = ["BaseNode", "Node", "WaveletPacket", "Node2D", "WaveletPacket2D"]
import n... |
COPYRIGHT = '''
/*
* Copyright 2015-2019 Advanced Micro Devices, Inc.
*
* 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
* on the rights... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
VMware Inventory Script
=======================
Retrieve information about virtual machines from a vCenter server or
standalone ESX host. When `group_by=false` (in the INI file), host systems
are also returned in addition to VMs.
This script will attempt to read conf... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Functions to make figures.
@author: <NAME> (<EMAIL>)
"""
import logging, os, matplotlib.pyplot as plt, numpy as np
try:
from osgeo import gdal
except:
import gdal
mpl_logger = logging.getLogger('matplotlib')
mpl_logger.setLevel(logging.WARNING)
logger = logg... |
from basicgeo import P2, P3, Along
from math import sqrt
def PlotVBpath(vbdrivegeometry, bar, rc, rcmax):
if bar.cellmarkright is None or bar.cellmarkleft is None:
return [ ]
izoneleft = bar.cellmarkleft.cellcolour
izoneright = bar.cellmarkright.cellcolour
isegleft = vbdrivegeometry.GetI... |
#! /usr/bin/env python
"""robot lop-level controller"""
import math
import json
from threading import Lock
import os
# third party imports
import rospy
from std_msgs.msg import Float64
from actionlib_msgs.msg import *
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
from geometry_msgs.msg import *
from gaz... |
# -*- coding: utf-8 -*-
"""
Created on Saturday, April 24th 2018
@author: <NAME>
Kivy screen that allows for adding new words as well as deleting
and viewing existing words in the selected Word Database.
"""
from word import Word
from kivy.uix.screenmanager import Screen
from kivy.uix.button import Button
from kivy.... |
from typing import List, Optional, Dict
import numpy as np
import tensorflow as tf
from docqa.configurable import Configurable
from docqa.data_processing.qa_training_data import ParagraphAndQuestionSpec, ContextAndQuestion
from docqa.data_processing.span_data import ParagraphSpans, TokenSpans
from docqa.data_processi... |
from pathlib import Path
import shutil
import logging
from tqdm import tqdm
from send2trash import send2trash
from .file_comparison import is_file_text, compare_file_contents_buffered
from .args_parsing import prepare_args_parser
from .serialization import serialize_directsync, deserialize_directsync,\
... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
#!/usr/bin/env python
import os
import shutil
import platform
import xml.etree.ElementTree as ET
from SCons.Script import Scanner
# ----------------------------------------------------------------------------------------------- #
# Paths in which the 32 bit version of MSBuild can be found on Windows systems
_windows... |
'''
Single-GPU training code
'''
import argparse
from datetime import datetime
import numpy as np
import tensorflow as tf
import importlib
import os
import sys
import kitti_dataset
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
parser = argparse.ArgumentParser()
parser.add_argum... |
"""
The :py:class:`Consumer`, :py:class:`PublishingConsumer`,
:py:class:`SmartConsumer`, and :py:class:`SmartPublishingConsumer` provide base
classes to extend for consumer applications.
While the :py:class:`Consumer` class provides all the structure required for
implementing a rejected consumer, the :py:class:`SmartC... |
#!/usr/bin/env python
import sys
import math
import numpy as np
import ast
from scipy.signal import butter, lfilter, freqz, lfilter_zi, filtfilt
#from sympy import Derivative
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from timeit import default_timer as timer
import smoother
import Vec3D
i... |
# Copyright (c) 2020, NVIDIA CORPORATION. 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 applic... |
import torch
import world
import time
import os
import shutil
import faulthandler
from torch import nn
faulthandler.enable()
import numpy as np
import cv2 as cv
import matplotlib as mpl
mpl.use("TkAgg")
import matplotlib.pyplot as plt
from PIL import Image
# ===========================tranformers===================... |
import requests
from flask import current_app as app
from requests.cookies import cookiejar_from_dict, merge_cookies
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util import Retry
from requests.exceptions import MissingSchema, URLRequired
from requests.packages.urllib3.exceptions import Inse... |
# std
import os
import json
# 3rd party
import nvdiffrast.torch as dr
import numpy as np
import torch
import imageio
from PIL import Image
import cv2 as cv2
# local
import src.torch.utils as utils
import src.torch.data as data
import src.torch.camera as camera
# ------------------------------------------------------... |
# Copyright 2021-2022 The DADApy 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 applic... |
# 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.
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import options, utils
from fairseq.models import (
Fairse... |
# -*- coding: utf-8 -*-
"""Main module."""
import re
import sys
from enum import Enum
from telnetlib import Telnet
from typing import Any, List, Match, MutableMapping, Optional, Pattern, Tuple, Type
from twisted.conch.telnet import StatefulTelnetProtocol
from twisted.internet import defer, reactor
from twisted.inte... |
from numpy import *
from scipy.optimize import brenth
from scipy.integrate import quad
from readtxtfile import readtxtfile
import leastsq
pixelscale = .2 #arcsec / pixel
v_c = 299792.458 #km/s
Omega_m = .27
Omega_l = .73
h = .71
H0 = 100*h #km/s/Mpc
hubble_length = v_c/H0
rho_c0 = 2.775e11 * h**2 # M_sol Mpc^-3
##... |
import sys
import os
import json
import math
import subprocess
import numpy as np
import logging
#import pyld
#import rdflib
import essentia
import uuid
essentia.log.infoActive = False
essentia.log.warningActive = False
from essentia.standard import MusicExtractor, FreesoundExtractor, MonoLoader, MonoWriter
#from rdfli... |
import os
from kedro.config import MissingConfigException
DEFAULT_CONFIG_TEMPLATE = """
# Base url of the Apache Airflow, should include the schema (http/https)
host: {url}
# Directory from where Apache Airflow is reading DAGs definitions
output: {output}
# Configuration used to run the pipeline
run_config:
# ... |
import csv
import glob
import logging
import operator
import os
import re
from collections import OrderedDict
from copy import deepcopy
import numpy as np
import torch
import torch.nn as nn
import torchvision
from torch import distributed as dist
from external.distributed_manager import DistributedManager
def unwra... |
import sys
from PySide2 import QtWidgets, QtCore, QtGui
from cornflow_client import CornFlow, group_variables_by_name, CornFlowApiError
from urllib.parse import urlparse
import os
import logging
import gui
import model as md
import logging as log
import pandas as pd
import json
REFERENCE_ID_CODE = 256
EXECUTIONS_COD... |
import functools
import logging
import multiprocessing as mp
import re
import attrdict
import numpy as np
import tensorflow as tf
import util
_IS_TRAINING = None
_DATA_FORMAT = None
_DTYPE = None
_COUNTERS = {}
TRAIN = 0
VALID = 1
TEST = 2
def expand_dims(arr, axes):
"""Inserts new dimensions of size 1 into ... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import sys
import os
import inspect
import json
import urllib
import datetime
import shlex
import logging
import logging.config
# Insert our lib directory into the module search path
current_file = inspect.getfile(inspect.currentframe())
base_path = os.path.dirname(os.path.... |
import unittest
import unittest.mock
import tempfile
import os
import stat
import warnings
import time
import re
import subprocess
from multiprocessing import cpu_count
from contextlib import contextmanager
from canine.backends.dummy import DummySlurmBackend
from canine.orchestrator import Orchestrator, version
from ti... |
# Third experiment
# Copyright holders: <NAME>, <NAME>
# 2021
#
# Choose fineLevel=9, coarseLevel=3, and maxIt=8 for the experiment in the paper.
# This will take time since the algorithm below does not exploit the potential
# parallelization and computes the different approximations one after the other.
# To obtain a ... |
import re
import subprocess
import os
import datetime
import requests
import logging
from collections import defaultdict
from lxml import html
from .tracks import Track, Sample
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHandler())
USERAGENT = 'Mozilla/5.0 (M... |
import prof
import numpy as np
eager_i = 6
eager = 4*2**eager_i
rend_i = 12
rend = 4* 2 ** rend_i
class Model():
alpha = 0
beta = 0
sizes = ""
def __init__(self, times, start = 0):
self.sizes = [4*2**(i+start) for i in range(len(times))]
mat = list()
t = list()
for... |
import numpy as np
from tqdm import tqdm
import sys
import os
import re
from mpl_toolkits.mplot3d import axes3d
lib_path = os.getcwd()
sys.path.append(f'{lib_path}')
class MyAxes3D(axes3d.Axes3D):
def __init__(self, baseObject, sides_to_draw):
self.__class__ = type(baseObject.__class__.__name__,
... |
# Copyright (C) 2018-2020 JCT
#
# 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, distribut... |
import argparse
from os import path, makedirs, listdir, environ
import abc
import cv2
import numpy as np
import tensorflow as tf
from tqdm import tqdm
# tf INFO and WARNING messages are not printed
environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
from converter.helpers import check_np_array, check_type, int64_feature, float_fe... |
###########################
# Script to analyze the microsphere's dipole response to a fixed
# voltage on the cantilver which is driven toward and away from
# the bead
###########################
import os, fnmatch, sys
import dill as pickle
import scipy.interpolate as interp
import scipy.optimize as opti
from scipy... |
from logging import addLevelName
import os
import time
from selenium import webdriver
import pandas as pd
import requests
from requests_html import HTML
# from selenium.webdriver.remote.errorhandler import ErrorCode
import json
from scraper.scrap import get_page
THIS_FILE = os.path.dirname(__file__)
def getHeadlessD... |
from typing import Union, Tuple, Optional, Iterable, TYPE_CHECKING
from .common_pb2 import Empty, Metadata
from .init_pb2 import ValInit
from .name_pb2 import *
from .impl_pb2 import *
from .type_pb2 import *
from .ref_pb2 import LibraryPath, LocalPath, LocalStep, CONNECTED_LINK, IS_CONNECTED, ALLOCATE, LENGTH, NAME
f... |
'''
Base view class; View helpers
'''
import operator
import re
from collections import OrderedDict
from functools import reduce
from django import forms
from django.conf import settings
from django.contrib import messages
from django.contrib.admin import helpers
from django.contrib.admin.templatetags.admin_static im... |
#!/usr/bin/env python3
import codecs
import datetime
import http
import json
import logging
import os
import re
import subprocess
import textwrap
import time
import urllib.error
import urllib.parse
import urllib.request
import github
import yaml
logging.basicConfig(format='%(levelname)s: %(message)s')
_LOGGER = log... |
import datetime
from collections import OrderedDict
from django.core.cache import cache
from django.db.models import (
Q,
Count
)
from django.contrib.contenttypes.models import ContentType
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.viewsets import ModelVi... |
# run in pydro38_test env
import os, sys, glob, logging, configparser
from datetime import datetime
import numpy as np
from scipy.interpolate import griddata
import pyproj
from pyproj import Transformer
from pyproj.crs import CompoundCRS
import gdal
from gdal import ogr
import rasterio
gdal.UseExceptions()
LOGGER = lo... |
################################ Reference #######################################
#Open Source Code come from:
#https://github.com/MicrocontrollersAndMore/OpenCV_3_License_Plate_Recognition_Python
import os
import cv2
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.multiclass i... |
# coding: utf-8
from os import path
import typing
import toml
from rolling.action.base import ActionDescriptionModel
from rolling.game.stuff import StuffManager
from rolling.game.world import WorldManager
from rolling.map.type.world import WorldMapTileType
from rolling.map.type.zone import ZoneMapTileType
from rollin... |
# -*- coding: utf-8 -*-
###############################################################################
# This file is part of metalibm (https://github.com/kalray/metalibm)
###############################################################################
# MIT License
#
# Copyright (c) 2018 Kalray
#
# Permission is here... |
### REFERENCE: This code is written mainly based on https://github.com/AlexiaJM/RelativisticGAN . Thanks !
import os
import numpy
import torch
from torch.autograd import Variable
import torchvision
import torchvision.datasets as dset
import torchvision.transforms as transf
import torchvision.models as models
import tor... |
# TODO: write logics for raids and dungeons
import logging
from aiogram import Bot, Dispatcher, executor, types
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from aiogram.dispatcher.filters.state import StatesGroup, State
from aiogram.dispatcher.filters import Text
from aiogram.dispatcher import FSMCon... |
import collections
import functools
import itertools
import logging
import random
import threading
from typing import (
Collection,
Deque,
Dict,
FrozenSet,
Iterator,
KeysView,
Mapping,
Optional,
Set,
Tuple,
)
from eth_utils import encode_hex, to_tuple
from eth_utils.toolz import... |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 3 15:55:21 2017
@author: Dominic
"""
import glob
import os
import sys
import subprocess
VERSION = 0.15
fileName = "FinancePyManualV_" + str(VERSION)
userGuideFileName = "./" + fileName + ".tex"
headFile = "./head.tex"
tailFile = "./tail.tex"
verbose = False
########... |
"""Music Player for partial loop and partial save."""
# %% Import
# Standard library imports
import sys
import json
import os.path as osp
import sqlite3
import io
import webbrowser
from datetime import datetime
from bisect import bisect_right
# Third party imports
import qdarkstyle
import qtawesome as qta
import webvt... |
# coding=utf-8
# 使用自己数据,输入300*16矩阵数据,加传统分类器
import tensorflow as tf
import numpy as np
import os
import scipy.io as sio
import string
import math
from sklearn import svm
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.neighbors import KNeighborsClassifier
path1 = 'F:/CCC/人工智能/moead/... |
import logging
import operator
from collections import OrderedDict
from decimal import Decimal
from django.core import validators
from django.db import models
from rest_framework import serializers
from rest_framework.settings import api_settings as rest_framework_settings
from .. import openapi
from ..errors import ... |
""" Cisco_IOS_XR_lpts_pre_ifib_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR lpts\-pre\-ifib package configuration.
This YANG module augments the
Cisco\-IOS\-XR\-lpts\-lib\-cfg
Cisco\-IOS\-XR\-config\-mda\-cfg
modules with configuration data.
Copyright (c) 2013\-2018 by Cisco Syste... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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 o... |
from collections import OrderedDict
import csv
from typing import Tuple
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import BaseUserManager, Group, User
from django.core.mail import EmailMultiAlternatives
... |
"""@xvdp
Set of tests to understand DDPM workings
"""
import math
import sys
import os.path as osp
import random
from pprint import pprint
import torch
from koreto import ObjDict
from denoising_diffusion_pytorch.util import to_image, open_image
from denoising_diffusion_pytorch import Unet, GaussianDiffusion, Trainer
... |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2021 <NAME>. 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
#
# Unles... |
import abc
import numpy as np
import scipy.linalg as linalg
import tensorflow as tf
LOGGER = tf.get_logger()
def _memoize(f):
""" Memoization decorator for a function taking a single argument """
class memodict(dict):
def __missing__(self, key):
ret = self[key] = f(key)
retu... |
#!/usr/bin/env python
from __future__ import print_function
import logging
import logging.handlers
import os
import re
import sys
import six
if sys.version_info >= (3, 0):
print("version 3.x")
else:
print("version 2.x")
LIB_DIR = os.path.join(os.path.join(os.path.dirname(__file__), ".."), "lib")
if LIB_DIR ... |
import datetime
import io
import os
import shutil
import time
import warnings
from time import time
from typing import TYPE_CHECKING, Iterable, List, Tuple, Union, Type
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import toolz
from timeout_decorator import timeout_decorator
from tqdm import t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
CODE DESCRIPTION HERE
Created on 2020-07-2020-07-15 17:56
@author: cook
"""
import numpy as np
from apero import core
from apero.core import constants
from apero.core import math as mp
from apero import lang
from apero.core.core import drs_log
from apero.core.core im... |
# coding: utf8
"""
Created on 22/10/2018
@author: baptiste
Définition de classes d'objets géométriques et de fonctions permettant de créer un modèle géométrique de RVE dans gmsh.
Outils pour controler la partie maillage dans gmsh, en complément des outils utiles pour la construction du modèle géoémtrique.
Deux foncti... |
################################################ Formatting ##########################################################
# based on: https://stackoverflow.com/a/62001539
def flatten_dict(input_node: dict, key_: str = '', output_dict: dict = {}):
if isinstance(input_node, dict):
for key, val in input_node.i... |
"""
Implementation of LabelInspector engine class to run label quality analysis.
"""
from typing import Optional, Union
from pandas import DataFrame, Series
from src.ydata_quality.core.warnings import Priority
from ..core import QualityEngine, QualityWarning
from ..utils.auxiliary import infer_dtypes
from ..utils.mo... |
'data engineering'
#%%
import numpy as np
import matplotlib.pyplot as pyplot
import seaborn as sns
import pandas as pd
# import xgboost as xgb
from scipy.stats import skew
from sklearn.preprocessing import Imputer
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestRegressor, Grad... |
from timsconvert.constants import *
from timsconvert.init_bruker_dll import *
import numpy as np
import sys
import logging
# Get either quasi-profile or centroid spectrum.
def extract_lcms_baf_spectrum_arrays(baf_data, frame_dict, mode, profile_bins, encoding):
if encoding == 32:
encoding_dtype = np.float... |
#from POPS_lib.fileIO import read_Calibration_fromFile,read_Calibration_fromString,save_Calibration
#import fileIO
from scipy import interpolate, optimize
import numpy as np
import pylab as plt
from io import StringIO as io
import pandas as pd
import warnings
from atmPy.aerosols.instruments.POPS import mie
#read_from... |
from haversine import haversine
from collections import defaultdict
import overpy
import pandas as pd
import networkx as nx
from networkx.algorithms.shortest_paths.generic import shortest_path
import matplotlib.pyplot as plt
from postman_problems.solver import cpp
def compute_road_length(road_nodes):
total_distanc... |
import xml.etree.ElementTree as Xml
import pandas as pd
import re
LINK_REGEX = r'(?<=\[#\]\(#)\w+(?=\))'
"""Regex used to retrieve the link ID"""
LINK_REPLACE = r'\[#\]\(#\w+\)'
"""Regex used to match the ENTIRE link text for replacement"""
LINK_LENGTH = 6 # 0 to fit all lengths (becomes O(n))
"""The length of lin... |
"""
Copyright 2020 <NAME>
The MIT License(MIT)
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, d... |
import numpy as np
from astropy.tests.helper import pytest
import warnings
import os
import matplotlib.pyplot as plt
from stingray import Lightcurve
from stingray.exceptions import StingrayError
np.random.seed(20150907)
_H5PY_INSTALLED = True
try:
import h5py
except ImportError:
_H5PY_INSTALLED = False
c... |
#!/usr/bin/python
# todo:
# full-file navigation
# - cbtv_events logs can last for hours, but only a minute at a time is
# sensibly viewable
# - bookmarks window, just a list of <timestamp> <bookmark text>, double
# click to go there
# mark lock claim / release
# - seeing what is locking software is good
# demo mo... |
from collections import defaultdict, Counter
from copy import deepcopy
import csv
import itertools
import functools
import os
import sys
import csv
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
import walker.pushdown
from walker.pushdown import PushDown
from gensim.models.... |
from genie.testbed import load
from genie.metaparser.util.exceptions import SchemaEmptyParserError, SchemaMissingKeyError
import toolbox.database as db
import json
from prettytable import PrettyTable
###
### CHECKING
###
# Returns True if the target OS is copied on the device, else False
def os_copied(hostname, os_ta... |
# Copyright 2010 New Relic, 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 writ... |
# The detail shows in below supplementaly.
# https://openaccess.thecvf.com/content_CVPR_2020/supplemental/Lee_Reference-Based_Sketch_Image_CVPR_2020_supplemental.pdf
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from torch.nn.utils import spectral_norm
class ResidualBlock(nn.Mo... |
import ezdxf
import svgwrite
import numpy as np
# https://www.desmos.com/calculator/rtkn6udxmy
# r=-\ 0.0\cdot\cos\left(2\cdot\theta\right)\ -\ \ 0.02\cdot\cos\left(4\cdot\theta\ \right)\ \ +\ 0.0\ \cos\ \left(6\cdot\theta\right)\ +\ 0.1\cos\left(8\cdot\left(\theta\right)\right)\ +\frac{5}{\left|\cos\left(\theta+\fr... |
"""
prep
==================
Functions to prepare files and directories needed for other functions
"""
import os
import logging
from fancylog import fancylog
from pathlib import Path
from imlib.general.system import ensure_directory_exists, get_num_processes
from imlib.image.metadata import define_pixel_sizes
from im... |
from __future__ import print_function
from six import string_types, PY2
import argparse
import jinja2
import json
import netCDF4
import numpy
import os
import re
import sys
import pprint
import traceback
def parseArgs(args):
'''
Parse the command line arguments into a dictionary object.
args [in] A ... |
#!/usr/bin/env python3
import math
import random
import sys
from copy import deepcopy
try:
from tqdm import tqdm
except ImportError:
tqdm = list
random.seed(0x3133731337)
def log(*args, x='*'):
print(f'[{x}] {" ".join(str(s) for s in args)}', file=sys.stderr)
if len(sys.argv) < 2:
log(f'Usage: ./... |
# The trial logic and analysis
RAND_SEED = 42
import numpy as np
np.random.seed(RAND_SEED)
np.seterr(all='raise')
import copy
import gym
import traceback
from os import environ, makedirs
from rl.util import *
from rl.agent import *
from rl.analytics import *
from rl.hyperoptimizer import *
from rl.memory import *
from ... |
import pymongo
from pymongo import MongoClient
import re
import datetime
import math
import sopel
from sopel.module import commands
from sopel.config.types import StaticSection, ValidatedAttribute
yes_answers = ["on", "yes", "+", "yep", "yup", "yeah"]
no_answers = ["off", "no", "nope", "nop", "no way", "nein"]
for... |
"""
Copyright 2021 Objectiv B.V.
"""
from collections import deque
from typing import NamedTuple, List, Dict, Set, Tuple, Optional, Callable, Deque, Hashable, Mapping,\
TypeVar, Union
from sql_models.model import SqlModel, RefPath
TSqlModel = TypeVar('TSqlModel', bound='SqlModel')
T2SqlModel = TypeVar('T2SqlMod... |
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PRO... |
#!/usr/bin/env python3
import numpy as np
from scipy.optimize import curve_fit
import pandas as pd
import datetime
import matplotlib.pyplot as plt
import os
import json
import subprocess
import argparse
import time
import re
def make_name(text): return ''.join(re.findall(r'\w+', text.lower()))
def r_curve(day, par0... |
##
## Create GeoNames Wordnet
##
## first download geonames data to gndata
##
## then run geo2wn.py
## maybe change the list of languages you want
from collections import defaultdict as dd
from xml.sax.saxutils import escape
from iso639 import languages
import argparse
parser = argparse.ArgumentParser()
parser.add_a... |
import random # seed generation
import time # Making sure tings are based on time not loops
from tkinter import *
from tkinter import colorchooser, simpledialog
import winSize
import infoWindow
import enemyCtrl
import shopCtrl
pygameInstalled = True
try:
from pygame import mixer
except ModuleNotFoundError as er:... |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 18 11:45:32 2018
Empirical Wavelet Transform implementation for 1D signals
Original paper:
<NAME>., 2013. Empirical Wavelet Transform. IEEE Transactions on Signal Processing, 61(16), pp.3999–4010.
Available at: http://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?a... |
# -*- coding: utf-8 -*-
# Cell 1
import tensorflow as tf, numpy as np
import math
from datetime import datetime
import time, pickle
# Cell 2
class StandardDeviationInit(tf.keras.initializers.Initializer):
def __init__(self, minval=0, maxval=1):
self.minval = minval
self.maxval = maxval
d... |
#!/usr/bin/env python3
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
"""Command-line interface.
Use 'gas' + COMMAND in terminal to operate on datasets.
Use 'gas config' to configure environment.
Use 'gas create' to create a dataset.
Use 'gas delete' to delete a dataset.
Use 'gas ls' to list data.
Us... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
r"""
Multi-output extensions of the risk measures, implemented as Monte-Carlo
objectives. Except for MVaR, the risk m... |
import telebot, requests, qrcode, os
from time import sleep
from telebot.types import InlineKeyboardButton as ikb
from telebot.types import InlineKeyboardMarkup as ikm
from alive import keep_alive
from telebot.types import InlineQueryResultArticle as search
from telebot.types import InputTextMessageContent as MSG... |
# -*- coding: utf-8 -*-
"""
thomson_scattering.py
@author: <NAME>
This module contains code for the analysis of Thomson scattering spectra
from plasmas with multiple ion species.
This function was adapted from a program provided in the book
"Plasma Scattering of Electromagnetic Radiation" by Froula et... |
#!/usr/bin/python
import numpy as np
import json
from pathlib import Path
from tqdm import tqdm
from skimage import measure, io
from shapely.geometry import Polygon, MultiPolygon
from PIL import Image
import os
import glob
import sys
class InfoJsonUtils():
""" Creates an info object to describe a COCO dataset
... |
from typing import Tuple
import numpy as np
class Solver:
"""
Abstract class for solver. Override to implement a Solver.
"""
def __init__(
self
) -> None:
pass
def predict(
self
) -> None:
pass
def fit(
self
) ->... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.