text
stringlengths
3.07k
22.1k
import inspect import functools import asyncio import typing as t import contextlib import types from .module import Module from .util import isasync FuncType = t.Callable[..., t.Any] Decorator = t.Callable[[FuncType], FuncType] UNSET = inspect.Parameter.empty class NoProvider(RuntimeError): pass class Inje...
# -*- coding: utf-8 -*- from functools import reduce import logging from operator import mul from os.path import join as pjoin import numpy as np from africanus.rime.predict import (PREDICT_DOCS, predict_checks) from africanus.util.code import format_code, memoize_on_key from africanus.util.cuda import cuda_type, g...
# -*- coding: utf-8 -*- # (c) 2018 <NAME> <<EMAIL>> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type import socket from ansible.module_utils.six import StringIO from ansible.module_utils....
import numpy as np import matplotlib.pyplot as plt from math import cos, sin, tan, pi import math import time class DHparam: """DHパラメータ""" def __init__(self, alpha, a, d, theta): self.alpha = alpha self.a = a self.d = d self.theta = theta class Homogeneous...
import os.path from html import escape from types import GeneratorType from typing import Union from ovld import ovld from .textgen import Breakable, Context, Text # CSS for hrepr styledir = f"{os.path.dirname(__file__)}/style" css_nbreset = open(f"{styledir}/nbreset.css", encoding="utf-8").read() # These tags are...
from turtle import * from math import * from time import sleep setup() up() #speed('normal') #probably redundant at this stage if using delay(0) #set to middle of the screen I think. I'm commenting a lot of this code more than a year after writing it / learning turtle&python home() tracer(0, 0) # make drawing faster...
# Copyright 2017 The AI Safety Gridworlds 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 b...
import os from cs50 import SQL from flask import Flask, flash, jsonify, redirect, render_template, request, session from flask_session import Session from tempfile import mkdtemp from werkzeug.exceptions import default_exceptions, HTTPException, InternalServerError from werkzeug.security import check_password_hash, ge...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Convert the *DECOW14X* corpus into a plain text file. Is used as pre-processing step for the `word2vec <https://code.google.com/archive/p/word2vec/>`_ training. To make this this more feasible (decow is a **huge** corpus), python's :mod:`multiprocessing` is used, s.t. every...
# This file is part of the MapProxy project. # Copyright (C) 2011 Omniscale <http://omniscale.de> # # 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...
import tensorflow as tf from tensorflow.python.ops.gradients_impl import _hessian_vector_product import numpy as np from dps import cfg from dps.rl.optimizer import Optimizer from dps.utils.tf import lst_to_vec, vec_to_lst, masked_mean, build_scheduled_value class TrustRegionOptimizer(Optimizer): def __init__(se...
from __future__ import absolute_import from copy import copy import numpy as nm from sfepy.base.testing import TestCommon from sfepy.base.base import ordered_iteritems from sfepy import data_dir filename_meshes = [data_dir + '/meshes/elements/%s_2.mesh' % geom for geom in ['1_2', '2_3', '2_4', '3_...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright 2015-2018 by Exopy Authors, see AUTHORS for more details. # # Distributed under the terms of the BSD license. # # The full license is in the file LICENCE, distributed with this software. # ---------------...
#!/usr/bin/env python # coding=utf-8 import numbers from . import trit from . import integer class Register(trit.Trits): """A fixed-length, mutable, ordered sequence of trits. A Register's length is set when it is created, and is fixed for the lifetime of the Register. The contents of the Register with...
# (c) 2017 <NAME> """common interface for all pore geometries should behave as follows: -) defines default parameters for the geometry -) provides function that takes geoname, geo params (including dim) plus small additional number of non-geo (solver) params (h, reconstruct, subs), and returns ge...
import os.path as osp import cv2 as cv import numpy as np from torch.utils.data import Dataset from PIL import Image from sklearn.model_selection import StratifiedKFold class FivePointsAligner(): """This class performs face alignmet by five reference points""" ref_landmarks = np.array([30.2946 / 96, 51.6963 ...
import json from django.shortcuts import render from django.views.generic import View from django.http.response import JsonResponse, HttpResponseBadRequest, HttpResponseNotFound from .models import Meeting, ShareholderInfo,OnSiteMeeting,GB from django.contrib.auth import login from rest_framework_jwt.settings import ap...
from discord.ext import commands import discord import functions as fnc import psycopg2 import os from cogs.help import get_help_match # 本番用テキストチャンネル CHANNEL_ID = int(os.environ["PERFORMANCE_CHANNEL"]) # ログ管理用クローズドチャンネル TEST_ID = int(os.environ["TEST_CHANNEL"]) # 投稿権限を持つユーザー SCORER_USER = int(os.environ["SCORER"]) c...
from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, Qt from PyQt5.QtWidgets import QLineEdit, QTextBrowser from PyQt5.QtGui import QTextCursor # from MyPyQtGUI import MainApp from queue import Queue import logging import datetime import tqdm import time import sys import tqdm.auto as t_AUTO IS_SETUP_DONE = 'is_s...
# -*- coding: utf-8 -*- """DPKT tools :mod:`pcapkit.toolkit.dpkt` contains all you need for :mod:`pcapkit` handy usage with `DPKT`_ engine. All reforming functions returns with a flag to indicate if usable for its caller. .. _DPKT: https://dpkt.readthedocs.io """ import ipaddress from pcapkit.const.reg.transtype im...
#!/usr/bin/env python3 import argparse import curses import fcntl import os import re import signal import subprocess import sys import time from datetime import datetime RUN_CMD = "foo" RUN_DIR = "./build/" OPTION_TYPE_1 = ["-o", "-i", "-s"] OPTIMUM = ["fib", "gra", "ann", "par", "gen"] INTEGRAL = ["tra", "sim", "ro...
################################################################################ # Copyright (C) 2019 drinfernoo # # # # This Program is free software; you can redistribute it and/or modify ...
import os import pandas as pd from numpy import testing as npt import pandas.util.testing as pdt import ixmp import pytest from ixmp.default_path_constants import CONFIG_PATH from testing_utils import ( test_mp, test_mp_props, test_mp_use_default_dbprops_file, test_mp_use_db_config_path, ) test_args ...
"""Wave equation propagator. """ import numpy as np from smii.modeling.propagators import (libscalar1d, libscalar2d) class ScalarPropagator(object): """A scalar wave equation propagator object.""" def __init__(self, model, dx, source_dt, sources, pad_width, pml_width=None): """A scalar...
# -*- coding: utf-8 -*- """ Character Codes """ import sys from mathics.builtin.base import Builtin from mathics.core.expression import Expression from mathics.core.atoms import ( Integer, Integer1, String, ) from mathics.core.symbols import SymbolList from mathics.builtin.strings import to_python_enco...
from django import forms from django.forms.widgets import RadioSelect from crits.campaigns.campaign import Campaign from crits.core import form_consts from crits.core.forms import add_bucketlist_to_form, add_ticket_to_form from crits.core.handlers import get_source_names, get_item_names from crits.backdoors.handlers i...
from __future__ import ( annotations, ) import logging from datetime import ( datetime, ) from typing import ( AsyncIterator, Optional, Type, TypeVar, ) from uuid import ( UUID, uuid4, ) from dependency_injector.wiring import ( Provide, inject, ) from minos.aggregate.events im...
import torch from torch.functional import norm import torch.nn.functional as F import os from ProcessData.lafan1.extract import * from ProcessData.Skeleton import * from ProcessData.Utils import * from numpy import pi from typing import Tuple import Format def unwrap(x): """From https://discuss.pytorch.org/t/np-un...
from re import split from datetime import datetime from random import randint class Node(): tot_palavras=0 palavras_distintas=0 numero_rotacoes=0 def __init__(self, palavra, linha): self.palavra=palavra self.linha=[linha] self.fator_equi=0 self.altura=1 self.meno...
__all__ = [ "Mecha", "MechaOptions", "AstCacheBackend", ] import logging import os import pickle import sys from contextlib import contextmanager from dataclasses import InitVar, dataclass from io import BufferedReader, BufferedWriter from pathlib import Path from typing import ( Any, Dict, It...
"""Module containing utilities.""" import math import numpy as np import geopandas as gpd import shapely import pycountry import pyproj from renewablepotentialslib.conversion import transform_bounds, eu_country_code_to_iso3 from renewablepotentialslib import EPSG_3035, EPSG_3035_PROJ4, WGS84, WGS84_PROJ4 def determ...
""" Support routines for subprocess and multiprocess module. Currently, this extension module is only required when using the modules on Windows. """ import sys if sys.platform != 'win32': raise ImportError("The '_winapi' module is only available on Windows") # Declare external Win32 functions from _pypy_winbase...
import pytest import logging import numpy as np import pandas as pd from pyam import check_aggregate, IamDataFrame, IAMC_IDX from pyam.testing import assert_iamframe_equal from conftest import DTS_MAPPING LONG_IDX = IAMC_IDX + ['year'] PE_MAX_DF = pd.DataFrame([ ['model_a', 'scen_a', 'World', 'Primary Energy', ...
#!/usr/bin/env python3 from timfuz import Benchmark, A_di2ds import glob import math import json import sys from collections import OrderedDict # Speed index: some sort of special value SI_NONE = 0xFFFF # prefix to make easier to track # models do not overlap between PIPs and WIREs PREFIX_W = 'WIRE_' PREFIX_P = 'PIP...
import torch import torchvision import os import re import time import zipfile import shutil import tqdm import random from torch.utils.data import sampler from PIL import Image from itertools import cycle, islice # ======================================================== # Dataset-related functions and classes # ===...
from meross_iot.cloud.abilities import * from meross_iot.cloud.device import AbstractMerossDevice from meross_iot.logger import BULBS_LOGGER as l from meross_iot.meross_event import BulbSwitchStateChangeEvent, BulbLightStateChangeEvent MODE_LUMINANCE = 4 MODE_TEMPERATURE = 2 MODE_RGB = 1 MODE_RGB_LUMINANCE = 5 MODE_T...
## ------------------------------------------------------------------------------------------------------------------ ## ## ------------------------------------------------------------------------------------------------------------------ ## ## ___ ___ ________ ________ ______ _...
from .basic_callbacks import Callback, CancelTrainException from ..hook import Hooks from ..utils import ToolBox as tbox import torch import torch.nn as nn import math from functools import partial import matplotlib.pyplot as plt class LR_Find(Callback): _order = 1 def __init__(self, max_iter=100, min_lr=1e-...
import os import numpy as np import json import pytest from django.utils.datastructures import MultiValueDict from pytest_mock import mocker import torch from capreolus.collection import Collection from capreolus.demo_app.views import ConfigsView, NeuralQueryView, QueryDictParserMixin, CompareNeuralQueryView, BM25Vi...
import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit def model_line_func(t, a, b): return a * t + b class Percolation: def __init__(self, length): self.length = length self.grid = np.zeros((length + 2, length + 2), dtype=int) self.p = 0 self...
import pandas as pd import matplotlib.pyplot as plt from os import path from src.utils.logger import Logger from src.utils.path import PATH_DOCS, PATH_DATA_OUTPUT import src.utils.input_output as io from sklearn.model_selection import train_test_split from sklearn.preprocessing import MinMaxScaler import tensorflow fr...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import re import copy import mistune from .parsers.poll import PollParser class BlockGrammar(mistune.BlockGrammar): block_math = re.compile( r'^ *\$\$([\s\S]+?)\$\$ *(?:\n+|$)' ) block_math_brackets = re.compile( r'^ *\\\...
"""Train a model on SQuAD. Author: <NAME> (<EMAIL>) """ import chunk import numpy as np import random import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.optim.lr_scheduler as sched import torch.utils.data as data import util from args import get_train_args...
# # Copyright 2019 Xilinx 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 writi...
# 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, software # distributed under the Li...
import warnings import unittest import numpy as np import io from genomvar.test import MyTestCase from genomvar import variant from genomvar.vcf import VCFReader, BCFReader, VCFWriter, \ RESERVED_FORMAT, RESERVED_INFO from genomvar.vcf_utils import header as vcf_header from pkg_resources import resource_filename as...
#!/usr/bin/env python # # Refer to LICENSE file and README file for licensing information. # #pylint: disable-msg=broad-except,global-statement import os import sys import time import random from datetime import datetime as dt from datetime import timedelta as td import requests import bs4 from tickerplot.sql.sqlalc...
import matplotlib matplotlib.use("Agg") import matplotlib.pylab as plt import os import librosa import numpy as np import torch from torch.utils.data import DataLoader import sys if os.path.isdir(os.path.join(os.getcwd(),'pre-train')): sys.path.append('pre-train') from reader import TextMelIDLoader, TextMelIDCol...
import tensorflow as tf from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau from datetime import datetime import numpy as np import argparse from rdkit import Chem import time import csv import os # import modeuls from current directory from dataset import * import model as m from callback i...
import numpy as np import scipy as sp import scipy.spatial import scipy.signal import numexpr as ne import warnings import os from ...misc.basic_functions import rowsum, differentiation_matrix, differentiate from ...kernels.high_level.laplace import Laplace_Layer_Form, Laplace_Layer_Apply from ...kernels.high_level.ca...
from nhlscrapi.scrapr.teamnameparser import team_abbr_parser # default parser does nothing def default_desc_parser(event): pass ############################# ## ## helper funcs ## ############################# # get int distance from 'num ft.' def get_ft(s, def_dist = -1): sd = s.split(" ")[0] ...
# Copyright (c) 2019 fortiss GmbH # # This software is released under the MIT License. # https://opensource.org/licenses/MIT import os import pickle import pandas as pd import logging import copy import time logging.basicConfig() logging.getLogger().setLevel(logging.INFO) from modules.runtime.commons.parameters impor...
from pyridge.util import metric_dict, prepare_data from pyridge.util.cross import get_best_param, product_dict from pyridge import algorithm_dict import numpy as np import logging import os from time import perf_counter logger = logging.getLogger('pyridge') def check_algorithm(folder, dataset, ...
import sys whether_set_yml = ['configs_yml' in input_arg for input_arg in sys.argv] if sum(whether_set_yml)==0: default_webcam_configs_yml = "--configs_yml=configs/video.yml" print('No configs_yml is set, set it to the default {}'.format(default_webcam_configs_yml)) sys.argv.append(default_webcam_configs_y...
# -*- encoding: utf-8 -*- ''' @File : main.py @Time : 2020/11/19 18:30:11 @Author : KingofCode @Version : 1.0 @Contact : <EMAIL> @Desc : 文件完成MPI的启动,配置初始化,数据集加载,启动打包过程 ''' # here put the import lib from setting import settings from nest import Nester from nest import find_fitness from tools.calcu...
from features.git_commit_features import GitCommitFeatures from copy import deepcopy from git_analysis.analyze_git_logs import retrieve_git_logs from object.features import HistoryFeatures as HistoryFeaturesObj class HistoryFeatures(GitCommitFeatures): def __init__(self, rgcm): super(HistoryFeatures, self...
# -*- coding: utf-8 -*- # cython: language_level=3 # BSD 3-Clause License # # Copyright (c) 2020-2021, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code m...
# -*- coding: utf8 -*- # # 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...
import json, sqlite3 conn = sqlite3.connect('dbmemovira.sqlite3') c = conn.cursor() COLORS = {"beige": "#f5f5dc", "brown": "#a52a2a", "crimson red": "#990000", "cyber yellow": "#ffd300", "dark orange": "#ff8c00", "forest green": "#228B22", "fuchsia": "#ff00f...
import os import argparse import numpy as np from tqdm import tqdm import pandas as pd import joblib from collections import OrderedDict from datetime import datetime import matplotlib.pyplot as plt import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.optim as optim import torchvision.t...
''' Created on January 30, 2018 @author: khoi.ngo All SDK users can change their own verkey. (https://docs.google.com/spreadsheets/d/1TWXF7NtBjSOaUIBeIH77SyZnawfo91cJ_ns4TR-wsq4/edit#gid=0) This script will setup an environment with a pool (from genesis_txn file), a wallet inside that pool and get the default Steward...
from __future__ import print_function import logging import os import random import numpy as np from tqdm import tqdm, trange from transformers_config import * import torch from torch.utils.data import DataLoader, RandomSampler ## Optimization from transformers import ( WEIGHTS_NAME, AdamW, get_linear_s...
''' Functions: type_fixer: auto convert the input object to a python data type. Works recursivley through lists and tuples. Great function for strings or lists of strings parsed from files. extract_floats: pareses discreet real numbers (type = float) out of a ...
#!/usr/bin/python # -*- coding: UTF-8 -*- # copyright <NAME> 2012-2013 from __future__ import division import numpy import sys import brukerIO import math # gestion des arguments import argparse try: from multiprocessing import Pool except: from processing import Pool parser = argparse.ArgumentParser(descr...
#Copyright (c) 2018-2020 <NAME> # #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal #in the Software without restriction, including without limitation the rights #to use, copy, modify, merge, publish, distribute, ...
import numpy as np from scipy.stats import norm, truncnorm class TransitionKernel(): ''' A transition kernel on a random variable (or a set of RVs) stores the current value of the RV, propose() will propose a new RV by setting the value attribute, and return forward and backward transition log probability. reve...
import enum import numpy import scipy import time from AIToolbox import MDP, POMDP from matplotlib import pyplot as plt from matplotlib.lines import Line2D from sklearn.metrics import roc_curve, auc class Action(enum.Enum): ANALIZE = 0 BLOCK = 1 PASS = 2 class Observe(enum.Enum): OK = 0 ...
"""Contains classes for a standard deck of playing cards, plus one joker.""" class Suit: """The Suit class, for suits. Includes the no-trump suit. """ _suits_short = ['N', 'C', 'D', 'H', 'S'] _suits_long = ['no-suit', 'Clubs', 'Diamonds', 'Hearts', 'Spades'] def __init__(self, val...
import tensorflow as tf from tensorflow.keras import layers, Model import numpy as np from collections.abc import Iterable from dl_playground.networks.utils import ( config_to_regularizer, ActivityMonitor, activation_function, ) class MLP(layers.Layer): """Multi-layer perceptron. Parameters ...
# -*- coding: utf-8 -*- """ The format of font.bin: [File Header][Glyphs Table][Glyphs Data] File Header: BF [2 bytes] VersionNumber [1 byte] FontHeight [ 1 byte] FontWidthMinimum [1 byte] FontWidthMaximum [1 byte] Glyph Count [2 bytes] Glyphs Table: [ data position[2 bytes], width [1 byte] ] x G...
# # Copyright (c) 2015-2018 Canonical, Ltd. # # This file is part of Talisker # (see http://github.com/canonical-ols/talisker). # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regardin...
# Copyright 2018 <NAME> # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software ...
from __future__ import annotations from typing import List import numpy as np from nncg.allocation import Allocation from nncg.nodes.expressions import Variable from nncg.nodes.misc import Node from nncg.writer import Writer class CHeaderNode(Node): """ Class for writing everything in a C file that is above t...
# # @cond ___LICENSE___ # # Copyright (c) 2017 <NAME> and individual contributors. # # 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 rig...
# Subject to the foregoing terms and conditions, Ubiq hereby grants to You, at # no cost, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable # (except as stated herein) license to the Software, including all right to # reproduce, prepare derivative works of, sublicense, and distribute the same. # In the e...
from typing import Dict, Any, Tuple, Union from collections import namedtuple import pathlib import logging import attr from attr.validators import instance_of import numpy as np import pandas as pd import zarr from numcodecs import Zstd def trunc_end_of_file(name) -> str: """ Take only the start of the file...
# -*- coding: utf-8 -*- """ Purpose: Word level Natural Language Generation (NLG). a. This file trains a word based NLG model. b. Model training has early stopping to prevent over-training. c. Save the best performing models during training. d. Metrics from each trained epoch are...
# IMPORT STATEMENTS import streamlit as st import pandas as pd from PIL import Image import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from pandas_profiling import ProfileReport from streamlit_pandas_profiling import st_pro...
import pandas as pd import numpy as np # import matplotlib.pyplot as plt # import seaborn as sns # from scipy import stats from ast import literal_eval from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.metrics.pairwise import linear_kernel, cosine_similarity from nltk.stem.snowba...
# -*- coding: utf-8 -*- """ Azure Resource Manager (ARM) Compute SSH Public Key State Module .. versionadded:: 4.0.0 :maintainer: <<EMAIL>> :configuration: This module requires Azure Resource Manager credentials to be passed via acct. Note that the authentication parameters are case sensitive. Required provi...
""" BioSimulators-compliant command-line interface to the `XPP <http://www.math.pitt.edu/~bard/xpp/xpp.html>`_ simulation program. :Author: <NAME> <<EMAIL>> :Date: 2021-08-06 :Copyright: 2021, Center for Reproducible Biomedical Modeling :License: MIT """ from .utils import validate_variables, apply_model_changes, set...
__all__ = [ 'generate_mat_stub', 'generate_mat_typevars', 'generate_mat_unions' ] import textwrap from itertools import product from matrixtype import get_matrix_types, inspect_matrix from stub import matrix_name, matrix_union, union, vector_name, vector_union def generate_mat_unions(): for data_ty...
# -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import os import logging import json SEP = "[SEP]" CLS = "[CLS]" MASK = "[MASK]" UNK = "[UNK]" def _parse_text(file_name: str, word_dict: dict, label_dict: dict, w...
#!/usr/bin/env python3 # Copyright (c) 2019, 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 # # U...
import datetime import decimal import enum import inspect import re import typing import uuid import dataclasses from dateutil import parser from .convert_exception import ConvertException from ..type_utils import get_origin_type from ..type_utils import is_optional _converters = {} Item = typing.TypeVar('Item') uui...
#-*- coding:utf-8 -*- from __future__ import print_function import cv2 import glob import os import shutil import sys sys.path.append(os.getcwd()) from lib.fast_rcnn.config import cfg def resize_im(im, scale, max_scale=None): f = float(scale) / min(im.shape[0], im.shape[1]) if max_scale != None and f * m...
#!/usr/bin/env python nyan = ["""r-0-32 g-5-2 a-5-2 e-5-1 e-5-2 c-5-1 d#5-1 d-5-1 c-5-2 c-5-2 d-5-2 d#5-2 d#5-1 d-5-1 c-5-1 d-5-1 e-5-1 g-5-1 a-5-1 e-5-1 g-5-1 d-5-1 e-5-1 c-5-1 d-5-1 c-5-1 e-5-2 g-5-2 a-5-1 e-5-1 g-5-1 d-5-1 e-5-1 c-5-1 d#5-1 e-5-1 d#5-1 d-5-1 c-5-1 d-5-1 d#5-2 c-5-1 d-5-1 e-5-1 g-5-1 d-5-1 e-5-1 d-...
from hashlib import blake2b import math import random import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np # Some global parameters # Further fine-tuning of these will improve shell quality. minFloatParam = 2.0**-3 maxFloatParam = 2.0**3 minFrequency = 2.0...
from collections import defaultdict from typing import TYPE_CHECKING, DefaultDict, Dict, List import graphene from django.core.exceptions import ValidationError from ....core.permissions import ShippingPermissions from ....core.tracing import traced_atomic_transaction from ....shipping.error_codes import ShippingErro...
import os import os.path as osp from tqdm import tqdm from pathlib import Path from collections import defaultdict import numpy as np from pyquaternion import Quaternion from scipy.spatial.transform import Rotation as R from nuscenes.nuscenes import NuScenes from nuscenes.utils import splits from nuscenes.utils.geome...
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 """ Top-down Model ============== This script gives an example on how to use Pyro forecast module to backtest and make a submission for M5 accuracy/uncertainty competition. Using the top-down approach in [1], we first construct a mod...
# Copyright (c) 2019, IRIS-HEP # 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 foll...
# Copyright 2018-2021 Xanadu Quantum Technologies 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...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from typing import TypeVar, Generic, List, Any S = TypeVar('S') # Generic Sequence I = TypeVar('I') # Generic Item class SubSeq(Generic[S]): """ Represents a SubSequence """ def __init__(self): pass class CommonSubSeq(Generic[S],...
import pytest from conftest import quoted_object, run_setup_sql from pgbedrock import ownerships as own from pgbedrock import attributes, privileges from pgbedrock.context import ObjectInfo Q_CREATE_SEQUENCE = 'SET ROLE {}; CREATE SEQUENCE {}.{}; RESET ROLE;' Q_SCHEMA_EXISTS = "SELECT schema_name FROM information_sch...
import argparse import csv import os import pickle import re import sys import time import Constants as c from abroad_traffic_analysis import abroad_analysis as abr_ana from abroad_traffic_analysis import visualization_abroad as vis_abr from dst_characterize import identify_party as idtpt from party_analysis import vi...
#!/usr/bin/env python """Standard pipelines for white matter electron microscopy segmentation. """ import os from wmem import utils from wmem.series2stack import series2stack from wmem.downsample_slices import downsample_slices from wmem.stack2stack import stack2stack from wmem.prob2mask import prob2mask from wmem.c...
# -*- coding: utf-8 -*- u""" Copyright 2021 Telefónica Investigación y Desarrollo, S.A.U. This file is part of Toolium. 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/lic...
import h5py import mpi_init import subfind_data import cosmology import tree_build import numpy as np from scipy.interpolate import interp1d def compute_accretion_rates(mpi, path, datasets, data, snap=99, mcut=1.0e12): """ Compute the accretion rate based on different mass estimates """ if not mpi.Ra...
from PySimpleGUI import PySimpleGUI as sg from docx import Document from docx.shared import Inches from datetime import datetime from docx.shared import Pt from docx.enum.text import WD_ALIGN_PARAGRAPH import os def doc(cliente, img=0): now = datetime.today() today = f'{now.day}{now.month}{now.year}--{now.hou...