text stringlengths 3.07k 22.1k |
|---|
# Created by fw at 10/9/20
# modify from https://github.com/qubvel/segmentation_models.pytorch
from typing import Optional, Union, List
from .decoder import UnetDecoder, SCSEModule
import torch
import torch.nn as nn
import torch.nn.functional as F
from segmentation_models_pytorch.encoders import get_encoder
class Ar... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 12 14:18:30 2018
@author: <NAME>, https://github.com/zhaofenqiang
Contact: <EMAIL>
"""
import torch
import torch.nn as nn
from .utils.utils import Get_neighs_order, Get_upconv_index
from .layers import onering_conv_layer, pool_layer, upconv_layer... |
import os
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.multiprocessing as mp
import numpy as np
os.environ['OMP_NUM_THREADS'] = '1'
def preprocess_state(obs):
from PIL import Image
x = obs.transpose(1, 2, 0).mean(2)
x = np.uint8(x * 255)
x = Image.froma... |
"""
This script runs a geoscreens detector against videos from a given location and saves the
results.The script supports parallel runs in a very basic way -- by using the 1--device1 and
1--num_devices` parameters a script launched with device=N will only process videos where the video
index MOD num_devices == device_i... |
#!/usr/bin/env python
#! -*- coding: utf-8 -*-
"""Statistics and metrics retrieval for bitlinks."""
from __future__ import unicode_literals
import click
import ecstasy
import time
from collections import namedtuple
import lnk.abstract
import lnk.beauty
import lnk.bitly.info
import lnk.countries
import lnk.errors
... |
# solves the SME workflow #1: drug repurposing based on rare diseases
import os
import sys
import argparse
# PyCharm doesn't play well with relative imports + python console + terminal
try:
from code.reasoningtool import ReasoningUtilities as RU
except ImportError:
sys.path.append(os.path.dirname(os.path.dirname(os.... |
# Show local files, navigate folders.
# Options to delete files/folders and start print jobs
import time
import humanize
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from octopyclient.common import CommonPanel, Singleton
from octopyclient.igtk import *
from octopyclient.utils import *
@d... |
import os
import sys
import re
from powerline.lib.shell import run_cmd
# XXX Warning: module name must not be equal to the segment name as long as this
# segment is imported into powerline.segments.common module.
show_original=False
capacity_full_design=-1
base_dir = '/sys/class/power_supply'
def _file_exists(path,... |
"""
A simple scraper to retrieve data from www.ufc.com
in a predictable/easily machine readable format
Copyright (c) 2016, <NAME>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and... |
import sys;
import datetime;
import random;
import pygame;
from Bullet import Bullet;
from Wall import Wall;
def loadGameLevel(fileName, screen, settings, walls, astronautBlue, astronautOrange):
# Open the file.
inputFile = open(fileName, "r");
# Read the background color.
backgroundColor ... |
from operator import itemgetter
from flask import (
render_template,
url_for,
session,
request,
redirect,
jsonify,
g,
flash
)
from flask_oauthlib.client import OAuthException
from flask.ext.login import (
login_user,
logout_user,
login_required,
current_user
)
f... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import glob
def find_lane_pixels(binary_warped):
"""
find lane in a binary_warped image
input: binary_warped image
output: left/right lane pixel poistion and a drawed search image
"""
# Take a histogram of the bott... |
# 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 to in writing, software... |
from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, antecedents, out_attributes, user_options, num_cores,
out_path):
import os
from genomicode import filelib
from genomicode im... |
# Summary class and helper methods
# Used for summarising VASP calculations as YAML
from pymatgen.io.vasp.outputs import Vasprun # type: ignore
from pymatgen.analysis.transition_state import NEBAnalysis # type: ignore
from vasppy.vaspmeta import VASPMeta
from vasppy.outcar import final_energy_from_outcar, vasp_versi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Performance testing bootstrap script.
"""
from __future__ import absolute_import, print_function, unicode_literals
import os
import shutil
import subprocess
import tempfile
from datetime import datetime
from filelock import FileLock
try:
from settings import co... |
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.org/models/r... |
import operator as op
import sys
from re import sub
from typing import List, Union, Callable, Dict, TypeVar, Any
from project.langs.forth import wordimpl
def partial_kw(**kwargs):
def decorator(fun):
def inner(*args, **kwargs2):
return fun(*args, **{**kwargs, **kwargs2})
return inner... |
import tkinter as tk
import click
from PIL import ImageTk, Image
from exercises import *
class Monster:
def __init__(self, root, exercise, **kwargs):
self._root = root
self._handicap = kwargs.get('handicap', 500)
self._exercise = exercise
self.game_state = None
self._rese... |
from alsaaudio import Mixer
from datetime import datetime
import i3ipc
import re
import socket
import struct
import subprocess
from time import time
import gi
gi.require_version('Playerctl', '1.0')
from gi.repository import Playerctl
import sys
class Base:
is_callback_block = False
display = True
def _... |
import sys
# Importar las dependencias de flask
from flask import Blueprint, request, render_template, flash, g, session, redirect, url_for
# importar flask login
from app import login_manager
from flask_login import (current_user, login_required, login_user, logout_user, confirm_login, fresh_login_required)
# Import... |
# coding: utf-8
# In[1]:
from db_schema import engine, Incident, Category, Participant, Statistics, StatisticsValue
from sqlalchemy.orm import sessionmaker
from sqlalchemy import func, extract
# In[2]:
Session = sessionmaker(bind=engine)
# In[3]:
participant_pivots = { 'victimAge', 'victimGender', 'suspectA... |
# -*- coding: utf-8 -*-
"""The parser.
"""
from itertools import chain
from . import assertion
from .action import Action, ActType
from .story import Story
from .chapter import Chapter
from .episode import Episode
from .scene import Scene, ScenarioType
from .action import Action, ActType, TagAction, TagType
from .who i... |
# Copyright 2017 University of Maryland.
#
# This file is part of Sesame. It is subject to the license terms in the file
# LICENSE.rst found in the top-level directory of this distribution.
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import os
import sys
import numpy as np
imp... |
# Copyright 2018 The TensorFlow 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 applica... |
# Copyright (c): <NAME> 2017-2019.
# Author: <NAME>
# Email: <EMAIL>
# Update Date: 2019 - 3 - 22
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def optical_flow_warp(image, image_optical_flow):
"""
Arguments
image_ref: referenc... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from __future__ import print_function
import copy
import os
import sys
import llnl.util.tty as tty
import llnl.util.tty.... |
# Copyright 2019 Mobvoi Inc. All Rights Reserved.
# Author: <EMAIL> (<NAME>)
import argparse
import logging
import random
import sys
import codecs
import math
import numpy as np
import torch
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data import Dataset, DataLoader
from PIL import Image
from PIL.Ima... |
import glob, os
import random
import numpy as np
import cv2
import const
EXT = '.png'
def read_data(file_path, ext):
if not os.path.exists(file_path + '.txt'):
return -1
img = cv2.imread(file_path + ext)
ret = []
with open(file_path + '.txt') as f:
lines = [s.strip() for s in f.readlines()]
for line in lin... |
import torch
from functools import partial
from ASR.src.text import load_text_encoder
from ASR.src.audio import create_transform
from torch.utils.data import DataLoader
from torch.nn.utils.rnn import pad_sequence
# Batch size will be halfed if the longest wavefile surpasses threshold
HALF_BATCHSIZE_AUDIO_LEN = 800
# N... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020 The Regents of the University of California.
# 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 copy... |
"""
Python <-> Objective-C bridge (PyObjC)
This module defines the core interfaces of the Python<->Objective-C bridge.
"""
__all__ = [
"IBOutlet",
"IBAction",
"accessor",
"Accessor",
"typedAccessor",
"callbackFor",
"selectorFor",
"synthesize",
"namedselector",
"typedSelector",
... |
# tests grabbed from:
# https://github.com/tidyverse/dplyr/blob/master/tests/testthat/test-filter.r
from datar.core.backends.pandas import Series
import pytest
from datar import f
from datar.datasets import iris, mtcars
from datar.tibble import tibble
from datar.dplyr import (
group_by,
filter,
rowwise,
... |
################################################################################
# Copyright (c) 2017. <NAME>. All rights reserved. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. #
# ... |
import torch
from torch import nn
import torch.optim as optim
import pandas as pd
import os
from map_to_id_80 import IDMapping
from rnn_prediction_81 import seed_everything, FeatureExtractor, RNN
from torch.utils.data import Dataset, DataLoader
import time
from gensim.models.keyedvectors import KeyedVectors
import nump... |
import sys
import os
import csv
import argparse
import random
from pathlib import Path
import numpy as np
import torch
import pandas as pd
try:
import wandb
except Exception as e:
pass
def update_average(prev_avg, prev_counts, curr_avg, curr_counts):
denom = prev_counts + curr_counts
if isinstance(cur... |
##########################################################################
#
# Copyright (c) 2011-2012, <NAME>. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... |
from __future__ import annotations
import dataclasses
import logging
import os
import shlex
import typing as t
from pathlib import Path
import typing_extensions as te
from databind.core.settings import Alias, ExtraKeys
from slap.application import Application, Command, option
from slap.configuration import Configura... |
import random
import json
from urllib import request
import shutil
import matplotlib.pyplot as plt
import pickle
from twython import Twython
import glob
import time
import string
import oauth2 as oauth
import logging
import resnext
import confidence
logger = logging.getLogger('image bot')
logger.setLevel(logging.DEBUG... |
import sys
import pandas as pd
import numpy as np
from tqdm import tqdm
import pickle
from scipy import sparse
import torch
import torch.nn.functional as F
from datetime import date, timedelta
import torch.optim as optim
import torch.nn as nn
from torch_geometric.nn import Sequential, MessagePassing, Linear
from torch_... |
import itertools
import json
import re
import click
import pytest
from redash_toolbelt import Redash
def find_table_names(url, key, data_source_id):
client = Redash(url, key)
schema_tables = [
token.get("name")
for token in client._get(f"api/data_sources/{data_source_id}/schema")
.... |
from typing import List, Dict, Any, Optional, Callable, Tuple
from collections import namedtuple, deque
from easydict import EasyDict
from functools import reduce
import copy
import numpy as np
import torch
from ding.utils import build_logger, EasyTimer, deep_merge_dicts, lists_to_dicts, dicts_to_lists, \
SERIAL_E... |
# -*- coding: utf-8 -*-
""" HDL description specific formats (for RTL and signals) """
###############################################################################
# This file is part of metalibm (https://github.com/kalray/metalibm)
###############################################################################
# ... |
"""Support for Nest devices."""
from datetime import datetime, timedelta
import logging
import threading
from nest import Nest
from nest.nest import APIError, AuthorizationError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigEntry
from homeassistant.c... |
# Image classifier application
# python image_classifier_project.py
#Basic usage: python train.py data_directory
#Prints out training loss, validation loss, and validation accuracy as the network trains
#Options:
# Set directory to save checkpoints: python train.py data_dir --save_dir save_directory
# Choose... |
#!/usr/bin/env python3
# Copyright (c) the JPEG XL Project Authors. All rights reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""build_cleaner.py: Update build files.
This tool keeps certain parts of the build files up to date.
"""
import argparse
i... |
from __future__ import annotations
import logging
from pathlib import Path
from typing import Dict, Literal, Union
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.urls import reverse
from django.utils.functional import cached_property
from CreeDictionary.API.schema... |
import collections
import functools
import os
import random
import re
import sys
import threading
import time
import traceback
import typing
from concurrent.futures import ThreadPoolExecutor, TimeoutError
import chalice
import nestedcontext
import requests
from flask import json
pkg_root = os.path.abspath(os.path.joi... |
#!/usr/bin/env python
from os import environ
import os
import requests
import boto3
def get_verified_env(env_var, exit_on_fail=True):
"""try to make sure environment variables are set up correctly"""
if not environ.get(env_var, "NOT SET").startswith("NOT"):
return environ[env_var]
else:
if... |
import os
import cv2
import time
import argparse
import torch
import warnings
import numpy as np
from detector import build_detector
from deep_sort import build_tracker
from utils.draw import draw_boxes
from utils.parser import get_config
from utils.log import get_logger
from utils.io import write_results
import glob
... |
###########################################################################
# Created by: <NAME>
# Email: <EMAIL>
# Copyright (c) 2019
###########################################################################
import os
import os.path as osp
import logging
import copy
import time
import numpy as np
impo... |
r"""
Interpolate (:mod:`compmech.interpolate`)
==================================================
.. currentmodule:: compmech.interpolate
This module includes some interpolation utilities that will be used in other
modules.
.. autofunction:: inv_weighted
.. autofunction:: interp
"""
from collections import Iterabl... |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, unicode_literals
import copy
import os
import json
from flexmock import flexmock
from atomic_reacto... |
import os
import numpy as np
import cntk
from cntk import input_variable, Axis
from utils.nms_wrapper import apply_nms_to_single_image_results
from utils.rpn.bbox_transform import regress_rois
from utils.plot_helpers import resize_and_pad
from utils.map_helpers import evaluate_detections
from utils.od_mb_source import ... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017-2020 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
"""
Operations to mount container filesystems and run commands against them
"""
import hashlib
import logging
import os
import shutil
import subprocess # nosec
import pkg_resources
from tern.... |
"""
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
# **************************************************************************************************************
#
# Copyright 2020-2022 <NAME> GmbH
#
# 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 L... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Low-level grid state machines. These are state machines that perform GET or
POST requests involving Haystack ZINC grids.
"""
import hszinc
import fysom
import shlex
from ...util import state
from ...exception import HaystackError, AuthenticationProblem
from ...util.... |
# Lint as: python2, python3
# Copyright 2019 The TensorFlow 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
#
... |
# -*- coding: utf-8 -*-
"""Group management package."""
import sys
from flask import g, current_app
from collections import namedtuple
from .accounts import (create_user, get_user, update_user,
make_username_unique, delete_user,
upsert_pseudo_user)
from .constants.emoj... |
#!/usr/bin/env python3
from __future__ import print_function
from webrelay.device.base import WebRelay_Page
from webrelay.device.base import WebRelay_Base
from webrelay.device.settings import Setting_IP
from webrelay.device.settings import Setting_Text
from webrelay.device.settings import Setting_Netspeed
from webre... |
import abc
import warnings
from copy import copy, deepcopy
from typing import Callable, Dict, List, Tuple
import numpy as np
from collections import defaultdict
from openfermion import IsingOperator, QubitOperator
from openfermion.utils import count_qubits
from zquantum.core.history.recorder import HistoryEntry, recor... |
import random
import os
from utils import *
from network_features import *
from NetworkRepresentation import topology, routers
from NetworkRepresentation.Cisco7200 import Cisco7200Router
from NetworkRepresentation.topology import Topology
def get_random_network():
"""
Generate a random network
:return: N... |
# being a bit too dynamic
from math import ceil
from typing import TYPE_CHECKING, Iterable, List, Sequence, Tuple, Union
import warnings
import matplotlib.table
import matplotlib.ticker as ticker
import numpy as np
from pandas._typing import FrameOrSeriesUnion
from pandas.core.dtypes.common import is_list_like
from ... |
import os
import sys
import time
import math
import random
import argparse
import tensorflow as tf
import torch
from model import Model
from data_util.data import UNKNOWN_TOKEN
from torch.nn.utils import clip_grad_norm_
from torch.optim import Adagrad
sys.path.append(os.path.join(os.getcwd(), 'data_util'))
from data... |
import hashlib
import json
import os
import unicodedata
import uuid
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.urlresolvers import reverse
from django.db import models
from django.dispatch import receiver
from django.template.defaultfilters import... |
#!/usr/bin/env python
import rospy
import math
import numpy as np
import scipy
from scipy import interpolate
from scipy.interpolate import CubicHermiteSpline
from nav_msgs.msg import Path
from hybrid_astar.srv import *
from std_msgs.msg import *
import pylab as pl
import numpy as np
import matplotlib.pyplot as plt
imp... |
import numpy as np
import cartopy.crs as ccrs
import cartopy.geodesic as cgeo
import matplotlib.pyplot as plt
import warnings
from . import core
def _axes_to_lonlat(ax, coords):
"""(lon, lat) from axes coordinates."""
display = ax.transAxes.transform(coords)
data = ax.transData.inverted().transform(displa... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
from __future__ import print_function
import re
import os
import subprocess
import errno
shortcuts = {}
# regex matching on key, replacement of groups on value
# implement any other shortcuts that you want to use
#sources
shortcuts["mp([0-9]*)"] = "sqlite_file:/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/MP/MPproduc... |
import requests
import streamlit as st
import numpy as np
import pandas as pd
from PIL import Image
from keras.models import load_model
import cv2
import time
from io import BytesIO
from base64 import decodebytes, encodebytes
from datetime import timedelta, datetime
import pathlib
#import keras model-- the retinal ... |
import os
import dgl
import dgl.ops as OPS
import backend as F
import unittest
import torch
from torch.utils.data import DataLoader
from collections import defaultdict
from collections.abc import Iterator
from itertools import product
import pytest
def test_graph_dataloader():
batch_size = 16
num_batches = 2
... |
import gzip
import pickle
import numpy as np
import torch
from torch import nn
import random
from tqdm import tqdm
import os
import subprocess
import collections
import igraph
import argparse
import pdb
import pygraphviz as pgv
import sys
from PIL import Image
# create a parser to save graph arguments
cmd_opt = argpar... |
# Written by <NAME>
import collections
import numpy as np
import torch
from sklearn.cluster import DBSCAN
from sklearn.cluster import KMeans
from .compute_dist import build_dist
#__all__ = ["label_generator_dbscan_context_single", "label_generator_context_dbscan"]
def to_torch(ndarray):
if type(ndarray).__modu... |
'''
This module provides functionality for doing dimensional stacking of
uncertain factors in order to reveal patterns in the values for a single
outcome of interests. It is inspired by the work reported `here <https://www.onepetro.org/conference-paper/SPE-174774-MS>`_
with one deviation.
Rather than using association... |
import mayavi.mlab as mlab
import numpy as np
import torch
box_colormap = [
[1, 1, 1],
[0, 1, 0],
[0, 1, 1],
[1, 1, 0],
]
def check_numpy_to_torch(x):
if isinstance(x, np.ndarray):
return torch.from_numpy(x).float(), True
return x, False
def rotate_points_along_z(points, angle):
... |
# -*- coding: utf-8 -*-
import os, sys
from collections import OrderedDict
import numpy as np
sys.path.append("..")
from flask_restful import Resource
from flask import request
from resources.S3Image import get_image_from_s3
class ClassificateImage(Resource):
def get(self):
imName = request.args.get('imNa... |
"""Single-scale inference script for predicting segmentations using SegSort."""
from __future__ import print_function
import argparse
import math
import os
import time
import scipy.io
import network.segsort.common_utils as common_utils
import network.segsort.eval_utils as eval_utils
import tensorflow as tf
import nu... |
'''
This script uses the following driver for the Rohde and Schwarz VNA:
https://github.com/Terrabits/rohdeschwarz
'''
from __future__ import print_function
from P13pt.mascril.measurement import MeasurementBase
from P13pt.mascril.parameter import Sweep, String, Folder, Boolean
from P13pt.drivers.bilt import Bilt, ... |
#!/usr/bin/env python
from __future__ import print_function
from flask import Flask, request, render_template
from db import *
from flask import g
import hashlib, uuid
import random
import json
import sys
from time import sleep
from geventwebsocket import WebSocketError
_USER_TOKEN_MIN_ = 1000
_USER_TOKEN_MAX_ = 10000... |
""" Module defining Agent class and related methods
"""
import asyncio
import base64
import json
import struct
import time
import traceback
from typing import Optional
import aiohttp
import socket
from indy import wallet, did, error, crypto, pairwise
import indy_sdk_utils as utils
from python_agent_utils.messages.mes... |
r"""Preprocessing module for TIMIT data. Defines functions for loading individual phonemes from TIMIT.
Run this command to convert the LDC sphere files to .wav:
find . -name '*.WAV' -exec sph2pipe -f wav {} {}.wav \;
sph2pipe is available online from the LDC.
<NAME>. 2019-02-05.
"""
from os import path, maked... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018 MIT Probabilistic Computing Project.
# Released under Apache 2.0; refer to LICENSE.txt.
import numpy as np
import pytest
from cgpm.utils.general import get_prng
from cgpm2.categorical import Categorical
from cgpm2.crp import CRP
from cgpm2.normal import Normal
from cgpm... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import logging
import numpy as np
from gammapy.utils.scripts import make_path
from .map import MapDataset, MapDatasetOnOff
from .utils import get_axes, get_figure
__all__ = ["SpectrumDatasetOnOff", "SpectrumDataset"]
log = logging.getLogger(__name__)
c... |
import hashlib
from typing import Tuple
from bech32 import bech32_encode, bech32_decode, convertbits
from bip32 import BIP32
from ecdsa import SigningKey, VerifyingKey, SECP256k1, BadSignatureError
from ecdsa.util import sigencode_string_canonize
from mnemonic import Mnemonic
BECH32_PUBKEY_ACC_PREFIX = "bandpub"
BECH... |
#!/usr/bin/env python3
import numpy as np
from PIL import Image, ImageFilter, ImageDraw
import sys
import json
## the traces function is used to find the traces of an image around the pixel
def traces(im, image, i, j):
up,down,right,left = 0,0,0,0
##this for loop is used to traverse 40 pixels to down and get th... |
"""
Internal mechanisms for experiment logging.
"""
from typing import Optional, List, Set, Dict, Any
from abc import ABC, abstractmethod
import sys
import atexit
import warnings
import os
import subprocess
import tempfile
import platform
import inspect
import shutil
import tarfile
import time
import datetime
import u... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Copyright (c) 2021, One Identity LLC
# File: get_local_unix_groups.py
# Desc: Ansible module for local_unix_groups role that reads, filters and
# returns data from /etc/group.
# Auth: <NAM... |
import numpy as np
import pandas as pd
import os
import random
from deap import base
from deap import creator
from deap import tools
class material_screen_fitness():
def __init__(self, model, material_descriptor, virtual_screen_setting):
self.model, self.normalizer, self.scaler = model
self.mater... |
"""
This module is preparing simulation for the PyQT5 GUI.
Theoretically it can be used anywhere, because it just takes an arbitrary plot,
and calls it's plot() method with the calculated data.
It is now written to support connection with PySide2 GUI in the sense of:
a) the plot which to update
b) the queu... |
"""
This module provides the RPC server that provides communication services to the experiment script.
Note: When using services local to the projectServer, RPCs call do one hop, client --> rpyc server (method)
When using remote services RPC calls traverse two links, client --> rpyc server --> (via websockets) remote s... |
"""
pyserde core module.
"""
import dataclasses
import datetime
import decimal
import ipaddress
import logging
import pathlib
import re
import uuid
from dataclasses import dataclass, field
from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, Type, TypeVar, Union
import stringcase
from .compat im... |
from __future__ import absolute_import
import re
import six
from functools import partial
from copy import deepcopy
from rest_framework import serializers
from rest_framework.response import Response
from sentry.api.serializers.rest_framework import ListField
from sentry.api.bases.organization import OrganizationPer... |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Modified by BaseDetection, Inc. and its affiliates. All Rights Reserved
import torch
from torch import nn
from cvpods.layers import ShapeSpec
from cvpods.structures import ImageList
from ..postprocessing import detector_... |
# -*- coding: utf-8 -*-
"""
This is the Layers module. There are five layers in a SimKit model:
* Data
* Formulas
* Calculations
* Outputs
* Simulations
Layers are used to assemble the model. For example, the data layer assembles
all of the :ref:`data-sources`, calling the :ref:`data-readers` and putting all
of the d... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn.utils.rnn import PackedSequence
from typing import Optional, Tuple
from lib.fpn.box_utils import nms_overlaps
from lib.word_vectors import obj_edge_vectors
from lib.sparse_targets import Freque... |
import os
import h5py
import random
import pydicom
import argparse
import numpy as np
from types import SimpleNamespace
from barbell2.utils import Logger
from barbell2.lib.dicom import is_dicom_file
from barbell2.lib.dicom import Dcm2Numpy, Tag2NumPy
from sklearn.model_selection import train_test_split
class Creat... |
# Copyright (c) MONAI Consortium
# 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, so... |
import string, re, sys, datetime
from .core import TomlError
if sys.version_info[0] == 2:
_chr = unichr
else:
_chr = chr
def load(fin, translate=lambda t, x, v: v):
return loads(fin.read(), translate=translate, filename=fin.name)
def loads(s, filename='<string>', translate=lambda t, x, v: v):
... |
# encoding: utf-8
"""
Shader and ShaderProgram wrapper classes for vertex and fragment shaders used
in Interactive Data Visualization
"""
# ----------------------------------------------------------------------------
# Copyright (c) 2016, yt Development Team.
#
# Distributed under the terms of the Modified BSD Licens... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.