text stringlengths 8.04k 46.5k |
|---|
import sys, time, random, argparse
from copy import deepcopy
import torch
from pathlib import Path
import numpy as np
import torch.nn as nn
import math
import os
import torch.nn.init as init
import torch.nn.functional as F
import warnings
warnings.filterwarnings("ignore")
lib_dir = (Path(__file__).parent / ".." / ".."... |
import numpy as np
import random
from kmc.particles import *
import sys
# Personalized errors
class randomized_error(Exception):
def __init__(self,number):
self.message="We were not able to include the " + str(number) + " particle(s) into the lattice. Loosen up the spacial restrictions for particle cr... |
import argparse
import csv
import numpy as np
import os
import pandas as pd
# Still not sure what version is used for
VERSION = 12345
def get_script_args():
parser = argparse.ArgumentParser(
description='Convert synthetic population file to CEF formatted person and unit files'
)
parser.add_argumen... |
# from transformers import BertTokenizer
import json
from pathlib import Path
import time
import torch
import numpy as np
import random
import pandas as pd
import re
import itertools
from pandas.io.json._json import JsonReader
from typing import Callable, Dict, List, Generator, Tuple
from multiprocessing import Pool
im... |
"""
@authors <NAME> and <NAME>
@date June 7, 2019
Stanford Universtiy CS230 Final Project
"""
import math
import argparse
import numpy as np
import random
import tensorflow as tf
from matplotlib.image import imread
from tensorflow.keras.applications.resnet50 import preprocess_input
from tensorflow.keras.preprocessing.... |
import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# from torch.utils.tensorboard import SummaryWriter
import torchvision
import math
import mobifacenet
import vgg
Norm = nn.InstanceNorm2d
# Norm = nn.BatchNorm2d
# Generator
def conv3x3(in_planes, out_planes, stride=1,... |
import numpy as np
from collections import namedtuple
import warnings
import torch
from torch import nn, Tensor
import torch.nn.functional as F
from torchvision.models.utils import load_state_dict_from_url
from typing import Callable, Any, Optional, Tuple, List
from modules.bcosconv2d import BcosConv2d
__all__ = ['In... |
#coding=UTF-8
'''
Handles SLAM (SLAsh Markup), an inline format for annotating (single or multi-word)
tokens with tags. E.g.
We/{PRP 1pl} the/DT people/NNS of/IN the/DT {United States}/NNP
is equivalent to
We PRP 1pl
the DT
people NNS
of IN
the DT
United States NNP
See http://www.ar... |
import torch
import torch.nn as nn
from torch import einsum
from einops import rearrange, repeat, reduce
from einops.layers.torch import Rearrange
from torch.utils.data import Dataset, DataLoader, random_split
from torchvision import transforms
import rasterio
from sklearn.model_selection import train_test_split
# i... |
# Master Dictionary
# Translations
# 0: English
# 1: Chinese
# 2: Dutch
# 3: French
# 4: Italian
# 5: Japanese
# 6: Korean
# 7: Portuguese
# 8: Russian
# 9: Spanish
class MD_F:
# Master Dictionary Functions
def get_languages_list():
languages = []
languages.append("English")
languag... |
# coding: utf-8
#cython: boundscheck=False
#cython: wraparound=False
#cython: nonecheck=False
#cython: language_level=3
#cython: embedsignature=True
# The MIT License (MIT)
#
# Copyright (c) <2011-2015> <<NAME>, szport at gmail dot com>
#
# Permission is hereby granted, free of charge, to any person obtaining a cop... |
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non... |
# -*- coding: UTF-8 -*-
# Copyright 2013-2018 <NAME>
# License: BSD (see file COPYING for details)
from builtins import str
from builtins import object
import logging
logger = logging.getLogger(__name__)
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation... |
#This is the code used to create the plots for our paper
# https://arxiv.org/abs/2004.00010
#This code is not meant to be re-usable.
# - <NAME> <EMAIL> 2020
import math
import matplotlib.pyplot as plt
dpi=300
scal=0.4 #scale size of images. Both should have same height, but different width
#compute 1-cdf of ... |
import tensorflow as tf
import numpy as np
import sys
# input_dim : [224, 224, 3]
class ResNet50(object):
def __init__(self, x, keep_prob, num_classes, skip_layer,
weights_path, name):
# Parse input arguments into class variables
self.X = x
self.NUM_CLASSES = num_classes
... |
import sys
import pytz
import hashlib
import numpy as np
import pandas as pd
from datetime import datetime
def edit_form_link(link_text='Submit edits'):
"""Return HTML for link to form for edits"""
return f'<a href="https://docs.google.com/forms/d/e/1FAIpQLScw8EUGIOtUj994IYEM1W7PfBGV0anXjEmz_YKiKJc4fm-tTg/... |
#!/usr/bin/env python
# -*- coding: utf8
# Standard python imports
import os
import glob
from collections import defaultdict
from copy import deepcopy
import codecs
def open_utf8(filename, *args, **kwargs):
logger.debug('open(%s, %s, %s)', filename, args, kwargs)
return codecs.open(filename, *args, encoding="... |
# %% import packages
import numpy as np
import pandas as pd
import itertools
import warnings
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.colors import Normalize
from statsmodels.tsa.arima_model import ARIMA
from statsmodels.tsa.stattools import acf, pacf
from statsmodels.tsa.stattools i... |
# 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 t... |
import matplotlib.pylab as plt
import numpy as np
import pickle,os
from mpl_toolkits.mplot3d import Axes3D
from scipy.spatial.distance import pdist,cdist,squareform
from sklearn.cluster import DBSCAN
def rg_med(zxy):
zxy_ = np.array(zxy)
zxy_ = zxy_[~np.isnan(zxy_[:,0])]
zxy_ = zxy_ - np.median(zxy_,0)
... |
import numpy as np
from numba import njit
@njit(cache=True)
def states(idir, ng, dx, dt,
ih, iu, iv, ix, nspec,
g,
qv, dqv):
r"""
predict the cell-centered state to the edges in one-dimension
using the reconstructed, limited slopes.
We follow the convection here that ... |
import numpy as np
import matplotlib.pyplot as pls
import pandas as pd
from IPython.display import display, HTML
import seaborn as sns
from .eda_core import *
from .eda_core import cramer_v_corr,plot_cramer_v_corr
from .eda_pairwise import pairwise_report
from .eda_anova import anova,two_way_anova,turkeyHSD
import... |
#!/usr/bin/env python3
import os
import sys
import threading
try:
# Python 2.x imports
import Tkinter as tk
import ttk
import tkMessageBox as messagebox
import tkFileDialog as filedialog
import tkFont
except ImportError:
# Python 3.x imports
import tkint... |
# On importe et initialise Pygame, les classes que l'on utilisera, et les modules de random
import pygame
from fourmi import Fourmi
from Obstacle import Obstacle
from nourriture import Nourriture
from random import *
import Menu_Accueil
pygame.init()
def fin_Simulation(tour, nourriture, fourmis): #Cette fo... |
import os
import json
import glob
from io import StringIO, BytesIO
import discord
from discord import app_commands
from discord.ext import commands
from cogs.utils import Cog, command, group, Command, Group, OriginalCommand, OriginalGroup
class Maps(Cog, emoji='<:maps:970725022538805258>'):
"""
Gets info on... |
"""Upload static files to a directory or CDN, using content-based hashing.
Run "python cdnupload.py -h" for command line help, or see README.rst for
full documentation.
Released under a permissive MIT license (see LICENSE.txt).
Visit the project's website for more details:
https://github.com/benhoyt/cdnupload
"""
... |
# -*- coding: UTF-8 -*-
"""
base class and functions for image processing
"""
import cv2
import csv
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import multiprocessing
from collections import deque
from itertools import repeat
from multiprocessing import Process, Pool
from datetime... |
import humans
import random as rd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
import matplotlib.patches as patches
# To plot the humans
# TODO: expand for multiple communities
fig = plt.figure(figsize=(10,10))
ax = plt.axes()
ims=[]
# class for the whole world
class World():
d... |
from operator import itemgetter
from collections import OrderedDict
from itertools import repeat
from functools import partial, reduce
from time import sleep
import re
import math
from functools import cmp_to_key
import urwid
from vit import util
from vit.base_list_box import BaseListBox
from vit.list_batcher import ... |
"""
Management of Docker networks
.. versionadded:: 2017.7.0
:depends: docker_ Python module
.. note::
Older releases of the Python bindings for Docker were called docker-py_ in
PyPI. All releases of docker_, and releases of docker-py_ >= 1.6.0 are
supported. These python bindings can easily be installed... |
## @file
#
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full text of the license may be found at
# http://open... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# -*- coding: UTF-8 -*-
#addonHandler.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2012-2018 <NAME>, NV Access Limited, <NAME>, <NAME>, Babbage B.V.
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
import sys
import os.path
import gettext
import... |
import cv2
import numpy as np
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
from ..utils import (
bbox2distance,
distance2bbox,
images_to_levels,
multi_apply,
overlay_bbox_cv,
)
from ...datasets.pipelines.warp import warp_boxes
from ..losses.gfo... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests models.parameters
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import itertools
import pytest
import numpy as np
from . import irafutil
from .. import models, fitting
from ..... |
r"""
:mod:`~matplotlib.gridspec` contains classes that help to layout multiple
`~.axes.Axes` in a grid-like pattern within a figure.
The `GridSpec` specifies the overall grid structure. Individual cells within
the grid are referenced by `SubplotSpec`\s.
See the tutorial :doc:`/tutorials/intermediate/gridspec` for a c... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, scrub
from erpnext.stock.utils import get_incoming_rate
from erpnext.controllers.queries import get_match_cond
from ... |
"""Session implementation for CherryPy.
We use cherrypy.request to store some convenient variables as
well as data about the session for the current request. Instead of
polluting cherrypy.request we use a Session object bound to
cherrypy.session to store these variables.
"""
import datetime
import os
try:
import ... |
import json
import os
from collections import defaultdict
from datetime import datetime
from os import environ
from typing import Dict, List, Set, Optional, Any, Union
import pandas as pd
import v3io
from mlrun.config import config
from mlrun.run import MLClientCtx
from mlrun.utils import logger
from mlrun.utils.model... |
import copy as cp
import pickle
import numpy as np
from mmcv.fileio import FileClient
from scipy.stats import mode
from ..builder import PIPELINES
from .augmentations import Flip
@PIPELINES.register_module()
class UniformSampleFrames:
"""Uniformly sample frames from the video.
To sample an n-frame clip fro... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import json
import typing
import ort_flatbuffers_py.fbs as fbs
from abc import ABC, abstractmethod
from .types import FbsTypeInfo, value_name_to_typestr
def _create_op_key(domain: str, optype: str):
return '{}:{}'.form... |
# Copyright (c) 2020 PaddlePaddle 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 appli... |
#!/usr/bin/python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility class to generate a Dart-specific BuildFactory.
Based on gclient_factory.py.
"""
import random
from buildbot.changes import g... |
# -*- coding: UTF-8 -*-
# Copyright 2020 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""
Demo data specific for :mod:`lino_book.projects.ivo`.
"""
from lino.utils.instantiator import Instantiator, i2d
from lino.utils import Cycler
from django.conf import settings
from lino.utils import date_offset
fr... |
# Copyright 2014-2018 Open Source Robotics Foundation, 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 applicabl... |
# Code based on the linalg module from mpmath by <NAME>:
##################################################################################################
# module for the eigenvalue problem
# Copyright 2013 <NAME> (th<EMAIL> at g<EMAIL>)
#
# todo:
# - implement balancing
# - agressive early deflation
#
#... |
#!/usr/bin/env python
import gzip
import logging
import os.path
import time
from typing import List, Tuple
import anndata
import numpy as np
import pandas as pd
import tables
from scipy.io import mmread
from scipy.sparse import csr_matrix, issparse
from . import Array2D, MemData
logger = logging.getLogger("pegasus"... |
# Copyright 2020-2022 AIBharata Emerging Technologies Pvt. 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 re... |
from TEST_local_base import *
# clean the database environment before running lecacy cases
# in case that pytest run legacy in different order when new files are merged and that may lead case fail
runfile(mkpath('setup.sql'))
@prepare_before_test(num=1)
def test_01_gpload_formatOpts_delimiter():
"1 gpload format... |
import os
import sys
import traceback
import time as time_module
import numpy as np
from qtpy.compat import getopenfilename
#from qtpy.QtWidgets import QFileDialog
from pyNastran.bdf.patran_utils.read_patran_custom_results import load_patran_nod
from pyNastran.utils import print_bad_path
from pyNastran.gui.utils.load... |
import codecs
import dataclasses
import inspect
import json
import os
import warnings
from argparse import ArgumentParser, Action
from dataclasses import dataclass, is_dataclass
from typing import *
import yaml
from .utils import *
__all__ = [
'ConfigValidationError', 'PatternType',
'field_checker', 'root_ch... |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import gzip
import os
import pickle
from itertools import groupby, repeat
from subprocess import check_output, call
from os.path import dirname
import forgi.graph.bulge_graph as fgb
import numpy as np
from shutil import which, move
from... |
"""
IMC RestAPI availability needed!
functions to be used with:
- netmiko
- textfsm
- ntc-templates
device_type is set to: 'hp_comware'
please get the ntc-templates in a different folder via git clone and set
the environment variable: "NET_TEXTFSM" to the templates folder (where the index file is located)
"""
from co... |
import os
import _pickle as pickle
from e2efold.common.config import process_config
from e2efold.common.utils import get_args
args = get_args()
config_file = args.config
config = process_config(config_file)
print("#####Stage 3#####")
print('Here is the configuration of this run: ')
print(config)
os.environ["CUDA_VI... |
#!/usr/bin/env python3
# Copyright 2019 <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 agree... |
"""Test sidebar, coverage 85%"""
from textwrap import dedent
import sys
from itertools import chain
import unittest
import unittest.mock
from test.support import requires, swap_attr
import tkinter as tk
from idlelib.idle_test.tkinter_testing_utils import run_in_tk_mainloop
from idlelib.delegator import Delegator
from... |
import sounddevice as sd
from scipy.signal import istft
from scipy.signal import stft
import librosa
import librosa.display
import midi
import skimage.transform
import numpy as np
import os
import h5py
import time
import matplotlib.pyplot as plt
import random
start_time = time.time()
def seperate_sets(... |
#!/usr/bin/env python3
# Copyright 2020 <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... |
# Copyright 2019 the ProGraML authors.
#
# Contact <NAME> <<EMAIL>>.
#
# 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 a... |
"""
insights.parsr.query defines a common data model and query language for parsers
created with ``insights.parsr`` to target.
The model allows duplicate keys, and it allows values with *unnamed* attributes
and recursive substructure. This is a common model for many kinds of
configuration.
Simple key/value pairs can ... |
"""
.. note::
It currently works for Google and Numpy docstrings, but it's still a bit of a WIP.
It tries its best to preserve the surrounding whitespace, and it will separate out
whitespace, below, above, and to the left (common indentation) of the text block, so
you can edit the content of the block and t... |
from .model import PFNetTransformer, PFNetDense
import tensorflow as tf
import tensorflow_addons as tfa
import pickle
import numpy as np
import os
from sklearn.model_selection import train_test_split
import sys
import glob
import io
import os
import yaml
import uuid
import matplotlib
import matplotlib.pyplot as plt
im... |
"""
Describes subdomains of a scaffold with attached names and terms.
"""
import sys
from opencmiss.utils.zinc.general import ChangeManager
from opencmiss.utils.zinc.field import find_or_create_field_coordinates, find_or_create_field_group, \
find_or_create_field_stored_mesh_location, find_or_create_field_stored_s... |
import pytz
import os
from python.form_handler.config import Config
import python.common.vips_api as vips
from datetime import datetime
import python.common.middleware as middleware
from python.common.helper import load_json_into_dict, load_xml_to_string, localize_timezone
import pytest
import flask
import json
from py... |
import pickle
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import glob
############################## CAMERA CALIBRATION ##############################
# prepare object points
nx = 9
ny = 6
# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)
o... |
import json
from .constants import *
from .logging import Log
from .exceptions import *
from .login import *
import os
from datetime import timedelta, date
from typing import Tuple, Optional
from time import sleep
from datetime import datetime,date
from selenium.webdriver.remote.webelement import WebElement
from selen... |
# -*- coding: utf-8 -*-
'''
Copyright 2020, Ainstein Inc. All Rights Reserved
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... |
# Copyright 2017 <NAME> and <NAME>
'''Functions to read data into pyseer and iterate over instances'''
import sys
from .utils import set_env
import re
import gzip
# avoid numpy taking up more than one thread
with set_env(MKL_NUM_THREADS='1',
NUMEXPR_NUM_THREADS='1',
OMP_NUM_THREADS='1'):
... |
import time
from ipywidgets import HBox, VBox, Layout, HTML, Accordion
from .ipython.customwidgets import TinyLoading, RichLabel, TimerLabel, LogView, LogToolBar, VSpace, HSpace
from .ipython.import_js import import_display
from .collections import Tree
from tqdm import tqdm
import threading
from threading import Threa... |
import datetime
import decimal
import enum
import pathlib
import uuid
import warnings
from abc import ABCMeta
from collections.abc import Callable as abcCallable
from types import FunctionType
from typing import (
TYPE_CHECKING,
Any,
Callable,
ClassVar,
Dict,
FrozenSet,
Iterable,
List,
... |
import sys
import os
import math
import time
from datetime import datetime
import numpy as np
import tensorflow as tf
from modules import metrics
import logging
from tensorflow.python.ops import variables
from tensorflow.python.training import saver as tf_saver
from tensorflow.python.platform import resource_loader
i... |
import seaborn as sns
import matplotlib.pyplot as plt
import json
import numpy as np
from data_processing import load_power_data, reduce_toi_power
from data_processing import baseline_normalize
from data_processing import reduce_band_power, reduce_array_power
from statistics import simple_bootstrap
# main effects
# ... |
# -*- coding: utf-8 -*-
"""
This software is an implementation of
Deep MRI brain extraction: A 3D convolutional neural network for skull stripping
You can download the paper at http://dx.doi.org/10.1016/j.neuroimage.2016.01.024
If you use this software for your projects please cite:
Kleesiek and Urban et al, Deep M... |
#
# Copyright 2013 Quantopian, 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 wr... |
import numpy as np
import sys
import csv
import re
# This function returns a string that contains
# the value of the function with its error formatted
# to the same exponent.
# e.g. f(0.00302, 4.52e-5, 2) = 3.020e-5 +- 0.045e-5
# The precision argument N sets the number of decimal points
# such at most N+1 sig. figs. a... |
###############################################################################
# general utilities for Sentinel-1
# Copyright (c) 2016-2020, the pyroSAR Developers.
# This file is part of the pyroSAR Project. It is subject to the
# license terms in the LICENSE.txt file found in the top-level
# directory of this dist... |
# Parallel implementation for sampling a multi-order echelle spectrum. Because the likelihood
# calculation is independent for each order, the runtime is essentially constant regardless
# of how large a spectral range is used.
# Additionally, one could use this to fit multiple stars at once.
import argparse
parser = ... |
import re
from shapely.geometry import Point, Polygon, LineString
def generateTopologyJSONfromSVG(svgContents, pdbID, chainID, entityID):
'''Generates topology JSON from ProOrigami svg output'''
helices = []
coils = []
strands = []
terms = []
extents = []
non_printable_data_map = {}
max... |
"""Benchmark problems for nonlinear least squares."""
from collections import OrderedDict
import inspect
import sys
import numpy as np
from numpy.polynomial.chebyshev import Chebyshev
from scipy.integrate import odeint
class LSQBenchmarkProblem(object):
"""Template class for nonlinear least squares benchmark pro... |
#
# eChronos Real-Time Operating System
# Copyright (c) 2017, Commonwealth Scientific and Industrial Research
# Organisation (CSIRO) ABN 41 687 119 230.
#
# All rights reserved. CSIRO is willing to grant you a licence to the eChronos
# real-time operating system under the terms of the CSIRO_BSD_MIT license. See
# the f... |
import cv2
import numpy as np
import torch
import torch.nn as nn
from torch.nn import functional as F
# TODO: add flake8 check
CHANNELS_FIRST = True
def shape_as_list(t):
"""Return shape of tensor as list."""
return list(t.shape)
def spatial_softmax(features):
r"""Apply softmax on flattened spatial dim... |
from __future__ import annotations
import asyncio
import base64
from copy import copy
from functools import reduce
import logging
from time import time, sleep
from typing import (
cast,
List,
Dict,
Any,
Optional,
Set,
Sequence,
Tuple,
TypeVar,
Iterator,
)
from typing_extensions i... |
import numpy as np
from math import sqrt
import os
import random
import pickle
from sklearn.preprocessing import normalize
'''
calculate temporal intersection over union
'''
def calculate_IoU(i0, i1):
union = (min(i0[0], i1[0]), max(i0[1], i1[1]))
inter = (max(i0[0], i1[0]), min(i0[1], i1[1]))
iou = 1.0*... |
# -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we as... |
# coding=utf-8
# Copyright 2020 The Google Research Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
"""
Profile-related data controllers.
:class:`ProfileDataManager` controls the profile data itself.
- This class does not care about who has the profile.
- This class cares the properties of a profile, such as name and color.
:class:`UserProfileManager` controls the connection between the profile data and t... |
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import time
import os
import random
import math
import json
from collections import OrderedDict
import config_srd as config
import sys
sys.path.append("../models/")
def print_cz(str, f=None):
if f is not None:
print... |
CHECKSUM = 362321825193530482965387145477461219351887081732030285389523173718579890738236
import cython
def p0x88_to_tuple(position):
return (col(position), rank(position))
def tuple_to_0x88(position):
icol = position[0]
irow = position[1]
return (7 - irow) * 16 + icol
def chess_notation_to_0x88(... |
"""
These classes hold methods to apply general filters to any data type.
By inherritting these classes into the wrapped VTK data structures, a user
can easily apply common filters in an intuitive manner.
Example
-------
>>> import vtki
>>> from vtki import examples
>>> dataset = examples.load_uniform()
>>> # Thresh... |
"""
Objects for storing ionization state data for a single element or for
a single ionization level.
"""
__all__ = ["IonicLevel", "IonizationState"]
import numpy as np
import warnings
from astropy import units as u
from numbers import Integral, Real
from typing import List, Optional, Union
from plasmapy.particles.d... |
"""
A collection of functions for modifying the source code
"""
import os
import re
import tokenize
import importlib
import inspect
import sqlite3
import subprocess
import tempfile
from six import StringIO, PY3
from redbaron import RedBaron
sqlite_file = 'feature_docs_unit_test_db.sqlite' # name of the sqlite da... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import numpy as np
import copy
from local.pso.pso_atoms import PsoAtoms
from local.pso.Pre_Relax import PreRelax
from scipy.optimize import linear_sum_assignment
class Pso(object):
"""Pso object.
The Pso object contains the main process of PSO.
It m... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from . import box_utils
from . import center_utils
try:
from itertools import ifilterfalse
except ImportError: # py3k
from itertools import filterfalse as ifilterfalse
class SigmoidFo... |
#!/usr/bin/env python3
import os
import argparse
import sys
import pickle
import asyncio
import time
import numpy as np
import zmq
import pytao
from p4p.nt import NTTable
from p4p.server import Server as PVAServer
from p4p.server.asyncio import SharedPV
from zmq.asyncio import Context
import simulacrum
model_service_... |
#!/usr/bin/env python
import functools
import os
import multiprocessing as mp
import glob
import time
import itertools
import sys
import pickle
import numpy as np
import scipy as sci
import pandas as pd
import subprocess
import pybedtools
from plotly import tools
import glob
#from Bio import SeqIO
import re
import gzi... |
#---------------------------------------------------------------------
# IDAPython - Python plugin for Interactive Disassembler
#
# Copyright (c) 2004-2010 <NAME> <<EMAIL>>
#
# All rights reserved.
#
# For detailed copyright information see the file COPYING in
# the root of the distribution archive.
#------------------... |
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import argparse
import csv
import math
import rosbag
import rospy
from sensor_msgs.msg import Image
from sensor_msgs.msg import Imu
import cv2
import utility_functions
# case 1 create a rosbag from a folder as specified by the kalibr ... |
import sys
sys.path.append(".")
import py
from sympy import *
from sympy.core.basic import S # Use Singleton comparisons.
Pi = pi
## sympy/modules/polynomials/base.py
def test_Polynomial():
x = Symbol("x")
y = Symbol("y")
z = Symbol('z')
f = Polynomial(x+2)
g = Polynomial(y**2-1)
h = f + g
... |
# Differentiable plasticity: maze exploration task.
#
# Copyright (c) 2018 Uber 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/LICE... |
"""
Declaratively defining then:
- constructing and
- serializing
fixed sized records that are composed of:
- typed
- fixed sized
fields. This might look e.g. like:
.. code:: python
import datetime
import bryl
class MyRecord(bryl.Record):
a = bryl.Alphanumeric(length=20)
b = bryl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.