text stringlengths 3.07k 12.6k |
|---|
import numpy as np
from collections import Counter
from lidar_interpolate_toolbox import *
from path import Path
from PIL import Image
from imageio import imread
from visdom import Visdom
from color_utils import *
vis = Visdom()
def read_raw_calib_file(filepath):
# From https://github.com/utiasSTARS/pykitti/blob... |
import time
import dns
import dns.exception
import dns.name
import dns.query
import dns.resolver
from dyn.tm.errors import DynectCreateError, DynectGetError
from dyn.tm.session import DynectSession
from dyn.tm.zones import Node, Zone, get_all_zones
from flask import current_app
def get_dynect_session():
dynect_s... |
"""This module contains the general information for SyntheticFile ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class SyntheticFileConsts():
pass
class SyntheticFile(ManagedObject):
"""Thi... |
from django.contrib.gis.db import models
from django.urls import reverse
from django_extensions.db.models import TimeStampedModel
from model_utils import Choices
from .mixins import DateConstraintMixin, DateDisplayMixin
class OrganisationManager(models.QuerySet):
def get_date_filter(self, date):
return ... |
# remove warning message
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# required library
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from local_utils import detect_lp
from os.path import splitext,basename
from keras.models import model_from_json... |
#/*---------------------------------------------------------------------
#This file has been adapted from the implementation
#(available at, Public Domain https://github.com/pq-crystals/kyber)
#of "CRYSTALS - Kyber: a CCA-secure module-lattice-based KEM"
#by : <NAME>, <NAME>, <NAME>, <NAME>,
#<NAME>, <NAME>, <NAME> & <... |
import os
import json
import csv
import shutil
from ..utils.core import flatten_json
class CW:
"""
Base class for continuous file writers.
Can be used as a context manager (using the `with` keyword).
Otherwise, the writer can be explicitly closed.
"""
def __init__(self, file_name, overwrite... |
#! /usr/bin/env python
"""
Module with pixel and frame subsampling functions.
"""
__author__ = '<NAME>, <NAME>'
__all__ = ['cube_collapse',
'cube_subsample',
'cube_subsample_trimmean']
import numpy as np
def cube_collapse(cube, mode='median', n=50, w=None):
""" Collapses a cube into a fra... |
#! /usr/bin/env python
"""Graph server.
From the command-line it's easier to use sshgraphserver.py instead of this.
"""
from __future__ import print_function, absolute_import
import os, sys
PARENTDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# make dotviewer importable
sys.path.insert(0, PARENT... |
import numpy as np
import pandas.compat as compat
import pandas as pd
class TablePlotter(object):
"""
Layout some DataFrames in vertical/horizontal layout for explanation.
Used in merging.rst
"""
def __init__(self, cell_width=0.37, cell_height=0.25, font_size=7.5):
self.cell_width = cel... |
"""
Copyright 2020 Cartesi Pte. Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software d... |
import random
from typing import List, Union
class InvalidAction(Exception):
pass
class Round:
def __init__(self) -> None:
self.dice = [
None,
None,
None,
None,
None,
]
self.rolls = 0
self.roll()
def roll(
... |
#!/usr/bin/env python
# coding: utf-8
# # Hill Cipher
# Below is the code to implement the Hill Cipher, which is an example of a **polyalphabetic cryptosystem**, that is, it does
# not assign a single ciphertext letter to a single plaintext letter, but rather a ciphertext letter may represent more than
# one plaint... |
#!/Users/farnoosh/Projects/PyradiomicsExample/myenv/bin/python3
"""
Execute a graph cut on a region image based on some foreground and background markers.
Copyright (C) 2013 <NAME>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published b... |
import sys
from typing import Tuple
import numpy as np
import pandas as pd
class DummyTkinterFrame:
...
class DummyTkinter:
Frame = DummyTkinterFrame
sys.modules["Tkinter"] = DummyTkinter # Magellan imports Tkinter, but we don't need it for our use case
import py_entitymatching as em
import py_entityma... |
"""
@FileName: lsb.py
@Description: Implement lsb
@Author: Ryuk
@CreateDate: 2021/06/27
@LastEditTime: 2021/06/27
@LastEditors: Please set LastEditors
@Version: v0.1
"""
import scipy.io.wavfile as wav
import numpy as np
np.random.seed(2020)
stop_mark = np.random.randint(0, 2, 128)
class LSBEmbedder:
def __init_... |
from builtins import str
from builtins import object
from adminsortable.models import SortableMixin
from django.db import models
from django.db.models import Sum
from django.utils.functional import lazy
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.fields import CreationDateTimeField... |
import datetime
from xml.dom import minidom
import xml.etree.ElementTree as ET
def element_tree_to_file(tree, outfile):
with open(outfile, 'w') as f:
print(minidom.parseString(ET.tostring(tree)).toprettyxml(indent=" "), end='', file=f)
def make_add_submission_xml(outfile, submission_alias, center_name,... |
#!/usr/bin/env python
# coding=utf-8
"""Message Handler.
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# License: BSD 3 clause
Plays the server role in communication_node
Relations
----------
subscribes from /message_server topic,
publishes on corresponding nodes /ns/message_status topic
"""
import os
... |
"""Views for creating, editing and viewing site-specific user profiles."""
from datetime import timedelta
from allauth.account.views import LoginView as AllAuthLoginView
from allauth.account.views import LogoutView as AllAuthLogoutView
from django.conf import settings
from django.contrib import messages
from django.c... |
# coding: utf-8
from __future__ import unicode_literals
import json
import re
from ..utils import (clean_podcast_url, float_or_none, int_or_none,
strip_or_none, try_get, unified_strdate)
from .common import InfoExtractor
class SpotifyBaseIE(InfoExtractor):
_ACCESS_TOKEN = None
_OPERATIO... |
# -*- coding: utf-8 -*-
from scipy import misc
from scipy import ndimage
import numpy as np
import util
import os
oriDir = '../data/'
tgtDir = '../processedData/'
imgLength = 512
compressRatio = 0.2
compressLen = int(imgLength * compressRatio)
def flipImageMatrix(img):
flipped_img = np.ndarray... |
#!/usr/bin/env python3
from __future__ import division
import sys
import time
import curses
import curses.textpad
import Adafruit_PCA9685
pwm = Adafruit_PCA9685.PCA9685()
servo_min = 150 # Min pulse length out of 4096
servo_max = 600 # Max pulse length out of 4096
pwm.set_pwm_freq(60)
servo_delay = .15
loop_delay =... |
# Copyright 2018 Google LLC. 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 applicable law or a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 <NAME> ( <EMAIL> )
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""
Function for simple sequence analysis (reduced part of Trseeker).
- get_... |
##########################################################################
#
# Copyright (c) 2007-2010, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Define some basic robot costs used in reinforcement learning and optimization.
Dependencies:
- `pyrobolearn.states`
- `pyrobolearn.actions`
"""
from abc import ABCMeta
import numpy as np
import pyrobolearn as prl
from pyrobolearn.robots.robot import Robot
from pyrobol... |
import torch
import torch.utils.data
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from torchvision import datasets, transforms
import torch.nn.functional as F
import numpy as np
from dataset.data_loader_kitti_reimpl import KITTIReader_traj
from models.vgg_warper_weak_short... |
# 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... |
import torch
import shapely
from shapely.geometry import Polygon
import numpy as np
from .transformer_obb import poly2bbox
from .bbox_overlaps_cython import bbox_overlaps_cython
import DOTA_devkit.polyiou as polyiou
def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False):
"""Calculate overlap between tw... |
import math
import sys
import time
import torch
import torchvision
import pandas as pd
import networkx
from networkx.algorithms.components.connected import connected_components
import utils
from coco_utils import get_coco_api_from_dataset
from coco_eval import CocoEvaluator
def train_one_epoch(model, optimizer, data... |
"""
Module: tfrecords
Tfrecords creation and reader for improved performance across multi-gpu
There were a tradeoffs made in this repo. It would be natural to save the generated prepreprocessed image to tfrecord from the generator. This results in enormous (100x) files.
"""
import tensorflow as tf
import os
import cs... |
from fnmatch import fnmatch
import regex as re
from dbcog.models.enum_types import AwokenSkills
from dbcog.models.monster_model import MonsterModel
from dbcog.token_mappings import AWAKENING_TOKENS, AWOKEN_SKILL_MAP, BOOL_MONSTER_ATTRIBUTE_ALIASES, \
BOOL_MONSTER_ATTRIBUTE_NAMES, \
NUMERIC_MONSTER_ATTRIBUTE_A... |
import numpy as np
import pytest
from vispy.color import Colormap as VispyColormap
from napari.utils.colormaps import Colormap
from napari.utils.colormaps.colormap_utils import (
_MATPLOTLIB_COLORMAP_NAMES,
_VISPY_COLORMAPS_ORIGINAL,
_VISPY_COLORMAPS_TRANSLATIONS,
AVAILABLE_COLORMAPS,
_increment_un... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 21 10:43:03 2020
@author: danish
"""
import cv2 # for capturing videos
import math # for mathematical operations
import pandas as pd
from keras.preprocessing import image # for preprocessing the images
from glob import glob
from tqdm import tqdm
import os
import ... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... |
# python-libjit, Copyright 2014 <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... |
from logging import getLogger
from urllib.parse import urlencode
from flask import Blueprint, abort, g, jsonify, request
from flask.views import MethodView
from flask_api.status import HTTP_404_NOT_FOUND
from flask_login import current_user
from flask_security.decorators import http_auth_required
from core import db
... |
import copy
import os
import tempfile
import tarfile
import pytest
import torch
from allennlp.version import _MAJOR, _MINOR
from allennlp.commands.train import train_model
from allennlp.common import Params
from allennlp.common.meta import Meta
from allennlp.common.checks import ConfigurationError
from allennlp.commo... |
#!/usr/bin/env python
# coding=utf-8
'''
@Author: John
@Email: <EMAIL>
@Date: 2020-06-12 00:50:49
@LastEditor: John
LastEditTime: 2021-12-22 14:01:37
@Discription:
@Environment: python 3.7.7
'''
'''off-policy
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import ran... |
"""Piece classes."""
from abc import ABC
from .coords import Coords, coords_to_loc
from .moves import KingSideCastling, Move, QueenSideCastling, is_move_valid
from .utils import staticproperty
class Piece(ABC, Coords):
MOVES = []
def __init__(self, coords, color, has_moved=False):
self.color = colo... |
import pandas as pd
import numpy as np
from PIL import Image, ImageDraw, ImageFont
import h5py
import os
from sortedcontainers import SortedDict
from scipy.ndimage.filters import gaussian_filter
import scipy.spatial
from itertools import islice
def generate_gaussian_kernels(round_decimals=3, sigma_threshold=4, sigma_... |
import os
import cv2
import matplotlib.pyplot as plt
import numpy as np
import pykitti
import torch
import torchvision.transforms.functional as F
from torch import hub
from torchvision.datasets import Cityscapes
from autolabeling import autolabel
from autolabeling.classes import get_lidar_colormap
from lilanet.utils ... |
from __future__ import absolute_import, division, print_function
import cctbx.xray.targets
from cctbx.array_family import flex
from libtbx.test_utils import approx_equal
from six.moves import range
def calc_k(f_obs, i_calc):
fc = flex.sqrt(i_calc)
num = flex.sum(f_obs * fc)
den = flex.sum(fc * fc)
assert den !... |
'''Build the Bilinear CNN model.'''
from tensorflow.python.keras import backend as keras_backend
from tensorflow.python.keras.layers import Input, Reshape, Dense, Lambda, Activation
from tensorflow.python.keras.optimizers import adam, RMSprop, SGD
from tensorflow.python.keras.models import Model
from tensorflow.python... |
##########################################################################
# NSAp - Copyright (C) CEA, 2013
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for details.
##########... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2017-2018 Red Hat, Inc.
# Copyright © 2014-2015 eNovance
#
# 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... |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2021 BigML
#
# 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 ... |
import discord
from discord.ext import commands
from Kiraro import bot
import json
import asyncio
@bot.command(aliases=['del_rank', 'delrank', 'remove_rank'])
@commands.has_permissions(administrator=True)
async def deleterank(ctx, ranking):
def check(m):
return m.author == ctx.author
if ranking.low... |
import time
import os
import pandas as pd
import re
# %a 星期的简写。如 星期三为Web
# %A 星期的全写。如 星期三为Wednesday
# %b 月份的简写。如4月份为Apr
# %B 月份的全写。如4月份为April
# %c: 日期时间的字符串表示。(如: 04/07/10 10:43:39)
# %d: 日在这个月中的天数(是这个月的第几天)
# %f: 微秒(范围[0,999999])
# %H: 小时(24小时制,[0, 23])
# %I: 小时(12小时制,[0, 11])
# %j: 日在年中的天数 [001,366](是当年的第几天)
# ... |
from __future__ import division
import numpy as np
from dolo.algos.dtcscc.simulations import simulate
from dolo.numeric.discretization.quadrature import gauss_hermite_nodes
from dolo.numeric.misc import mlinspace
class EulerErrors(dict):
@property
def max_errors(self):
return self['max_errors']
... |
"""
Utility functions for zipteedo.
"""
import csv
import numpy
import logging
import json
import gzip
import argparse
from collections import namedtuple, Counter
import tqdm
def GzipFileType(*args, **kwargs):
def _ret(path):
try:
if path.endswith('.gz'):
return gzip.open(path,... |
#!/usr/bin/env python3
import argparse
import itertools
import signal
import sys
import os
import subprocess
import time
from pathlib import Path
from threading import Lock
def main():
parser = argparse.ArgumentParser(description="A latent motif discovery algorithm.")
parser.add_argument("window", type=int, h... |
# This file contains all the training functionality including
# dataset parsing and snapshot export
# Author: <NAME>, 2018, Chemnitz University of Technology
import os
import operator
import time
import numpy as np
from sklearn.utils import shuffle
import config as cfg
from model import lasagne_net as birdnet
from m... |
#!/usr/bin/python
"""Example of a guild - Qt hybrid system.
This example shows three ways to connect guild pipelines to Qt
objects. Version 1 (preferred) uses a normal guild pipeline with a
hybrid (guild/Qt) display object. Version 2 uses a hybrid source and a
standard Qt display, which is what you'd do if you don't ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
# built-in modules
import logging
import argparse
# Standard modules
import cv2
import numpy as np
import skimage
import skimage.measure
import skimage.segmentation
# Custom modules
import scripts
logger = logging.getLogger('main')
def get_masks(im... |
"""
head develop/mip_references/grch37_scout_exons_-2017-01-.bed
13 22255179 22255286 13-22255181-22255284 NM_002010 3687 FGF9
1 154306977 154307069 1-154306979-154307067 NM_001005855,NM_020452 13534,13534 ATP8B2,ATP8B2
6 20739748 20739848 6-20739750-20739846 NM_017774,XM_005249202 21050,21050 CDKAL1,CDKAL1
2 228169699... |
import rpyc
import copy
import unittest
from rpyc.utils.server import ThreadedServer
class MyClass(object):
def __add__(self, other):
return self.foo() + str(other)
def foo(self):
return "foo"
def bar(self):
return "bar"
def spam(self):
return "spam"
def _privy(... |
#!/usr/bin/env python3
# -> Use this script to upload .wav files on your CUCM Cluster.
# -> MoH Files cannot contain spaces in the file names.
# -> Use the template YaML file to provide CUCM Cluster details.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.u... |
"""
Functions for running Monte Carlo simulation.
"""
import math
import random
import os
import matplotlib.pyplot as plt
def calculate_LJ(r_ij):
"""
The LJ interaction energy between two particles.
Computes the pairwise Lennard-Jones interaction energy based on the separation distance in reduced uni... |
from functools import partial, reduce
import copy
from collections import namedtuple
from functools import partial
import sys
sys.setrecursionlimit(10**3)
#helpers
def curry(f):
arg_num = f.func_code.co_argcount
def wrap(*args):
_f = partial(f, *args)
if hasattr(f, 't'):
_f.t = f... |
import numpy as np
def l2_regularization(W, reg_strength):
'''
Computes L2 regularization loss on weights and its gradient
Arguments:
W, np array - weights
reg_strength - float value
Returns:
loss, single value - l2 regularization loss
gradient, np.array same shape as W - gra... |
# -*- coding: utf-8 -*-
import argparse
import logging
from array import array
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
from pylab import contour, contourf
from il2fb.maps.heightmaps.constants import HEIGHT_PACK_FORMAT
from i... |
#!/usr/bin/env python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# from tensor2tensor.bin import t2t_trainer
# from tensor2tensor.bin import t2t_decoder
import sys
sys.path.append('..')
sys.path.append('../model/')
#import tensorflow as tf
import ar... |
'''
Created by <NAME> 2020
# Read in WAV file into Python Class
sound1 = AudioProcessing('input.wav')
# Set the speed of the audio
sound1.set_audio_speed(0.5)
# Set the pitch of the audio
sound1.set_audio_pitch(2)
# Reverse the content of the audio
sound1.set_reverse()
# Add an echo to the audio
sound1.... |
from collections import defaultdict
class node:
def __init__(self, data = None):
self.left = None
self.right = None
self.data = data
class BST:
root = None
def insert(self, root, data):
if root == None:
root = node(data)
return root
... |
from utl import utility
from re import findall, match
from praw.models.reddit.removal_reasons import RemovalReason, \
SubredditRemovalReasons
from praw.reddit import Comment, Submission
config = utility.get_json("config.json")
flair_tiers: list[str] = config["USER_FLAIRS"]
thread_path = "current-thread.json"
cur... |
from collections import OrderedDict
from daops.utils import fixer, is_characterised
from daops.utils.normalise import ResultSet
from pywps.app.exceptions import ProcessError
from roocs_utils.project_utils import get_project_name
from roocs_utils.utils.file_utils import FileMapper
from rook import CONFIG
from roocs_ut... |
# Libraries
import json
import logging
import _thread
# Relative imports
from src.bot.bot import bot
from res.public.explorer import EXPLORER
from src.ws.ws import send, rcv
# Constants
LOGGER = logging.getLogger(__name__)
# GLOBALS
ADDR_SUBS, BLOCK_SUBS, LOOP = {}, [], False
def recv_loop():
"""
Maintain... |
from photons_protocol.packets import dictobj
from photons_protocol.messages import T
from delfick_project.norms import sb
from bitarray import bitarray
import binascii
emptybt = bitarray("0000000000000000000000000000000000000000000000000000000000000000")
target_cache = {}
def look_at_target(pkt, value):
if valu... |
import asyncio
import logging
import aiohttp.web
from aioredis.pubsub import Receiver
from grpc.experimental import aio as aiogrpc
import ray.gcs_utils
import ray.new_dashboard.modules.stats_collector.stats_collector_consts \
as stats_collector_consts
import ray.new_dashboard.utils as dashboard_utils
from ray.new... |
import logging
from dataclasses import dataclass, field
from typing import TypedDict
import dearpygui.dearpygui as dpg
@dataclass
class SplitUIWidgets():
def __init__(self):
pass
main_window: int
left: int
center: int
right: int
menu_bar: int
class SplitUi:
"""
Creates a dea... |
#
# Copyright (c) 2013-2018 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http:... |
"""
Code for processing operations for numpy arrays of tif stacks
"""
#Import packages
#Dependences
import numpy as np
from numpy.fft import fft2, ifft2, fftshift
from scipy.ndimage import median_filter, gaussian_filter, shift
import itertools
import gc
def doMedianFilter(imgstack, med_fsize=3):
'''
Median F... |
# 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... |
# rrs-web - admin interface definitions
#
# Copyright (C) 2014 Intel Corporation
#
# Licensed under the MIT license, see COPYING.MIT for details
#
# SPDX-License-Identifier: MIT
from django.utils.functional import curry
from django.contrib import admin
from django.contrib.admin import DateFieldListFilter
from django ... |
# coding: utf-8
# pylint: disable=invalid-name, no-member, too-many-arguments
""" wrapper function of distmesh for EIT """
# Copyright (c) <NAME>. All rights reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
from __future__ import division, absolute_import, print_function
import numpy... |
import cupy
from cupy._core import internal
def take(a, indices, axis=None, out=None):
"""Takes elements of an array at specified indices along an axis.
This is an implementation of "fancy indexing" at single axis.
This function does not support ``mode`` option.
Args:
a (cupy.ndarray): Arra... |
"""
Test smd0 and eventbuilder for handling step dgrams.
See https://docs.google.com/spreadsheets/d/1VlVCwEVGahab3omAFJLaF8DJWFcz-faI9Q9aHa7QTUw/edit?usp=sharing for test setup.
"""
import os, time, glob, sys
from psana.smdreader import SmdReader
from psana.dgram import Dgram
from setup_input_files import setup_input_... |
import json
import os
from nmfamv2.graphics import MetaboliteGraphic, MixtureGraphic, ScaledGraphic
class RunLog:
def __init__(self, user_dir):
self.user_dir = user_dir
self.top_dirname = os.path.join(user_dir, "logs")
self.mixture_dir = os.path.join(self.top_dirname, "mixtures")
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from misc.utils import initialize_weights
class BasicConv(nn.Module):
def __init__(self, in_channels, out_channels, use_bn=False, **kwargs):
super(BasicConv, self).__init__()
self.use_bn = use_bn
self.conv = nn.Conv2d(in_ch... |
from flask_restplus import Namespace, Resource, reqparse
from flask_login import login_required, current_user
from werkzeug.datastructures import FileStorage
from flask import send_file
from ..util import query_util, coco_util
from database import (
ImageModel,
DatasetModel,
AnnotationModel
)
from PIL imp... |
import machine
import network
import time
import ugfx
import util
from home.launcher import ButtonGroup, Button, Display
class ConfigManager(Display):
def __init__(self, parent=None):
self.parent = parent
super().__init__()
def reload(self):
if self.parent:
self.parent... |
from typing import Any, Callable, Dict, List, Optional, Union, Tuple
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.components.light import (
LightEntity,
SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_WHITE_VAL... |
# import twythonaccess to be able to make twitter requests
from . import twythonaccess
# import apikeys
from . import apikeys
# import twythonstreamer for the SwedishMiner down below
from twython import TwythonStreamer
# import threading
from threading import Thread
# import time
import time
# this class provides Swed... |
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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... |
import PixelBotData.supportingFunctions as supportingFunctions
import configparser
from logging import warning
import sys
from random import randint
import sys
import discord
from discord.ext import commands
import platform
import logging
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelnam... |
#!../manage/exec-in-virtualenv.sh
# -*- coding: UTF-8 -*-
# File: queryhandler.py
# Date: Thu Jun 18 22:52:39 2015 +0800
# Author: <NAME> <<EMAIL>>
from bson.binary import Binary
from threading import Thread
from multiprocessing import Pool
from ukdbconn import get_mongo, global_counter, new_paper
from uklogger impor... |
import connexion, flask
import json
import os, sys, signal
import resource
import logging
import traceback
from typing import Iterable, Callable
rlimit_child_process_bytes = 34359738368 # 32 GiB
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../../../../../ARAX/ARAXQuery")
import ARAX_query
sys.path... |
"""
sphinx.domains.math
~~~~~~~~~~~~~~~~~~~
The math domain.
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import warnings
from typing import Any, Dict, Iterable, List, Tuple
from docutils import nodes
from docutils.nodes import Elem... |
import itertools
import time
import numpy as np
import scipy.ndimage as ndi
import pytest
from mrrt.utils import ImageGeometry, ellipse_im
from mrrt.mri import mri_exp_approx
__all__ = ["test_mri_exp_approx"]
def _test_mri_exp_approx1(
segments=4,
nx=64,
tmax=25e-3,
dt=5e-6,
autocorr=False,
... |
'''
PointGroup train.py
Written by <NAME>
'''
import torch
import torch.nn.functional as F
import torch.optim as optim
import time, sys, os, random
from tensorboardX import SummaryWriter
import numpy as np
from util.config import cfg
from util.log import logger
import util.utils as utils
device = torch.device("cuda:... |
# -*- coding: utf-8 -*-
import re
from .affixes import split_prefixes, split_suffixes
# List of compound prefixes adapted from
# http://code.google.com/p/php-name-parser/
_compound_prefixes = ['vere', 'von', 'van', 'de', 'del', 'della', 'di', 'da',
'pietro', 'vanden', 'du', r'st\.', 'st', 'la', ... |
from __future__ import annotations
from babi.screen import VERSION_STR
from testing.runner import and_exit
def test_window_height_2(run, tmpdir):
# 2 tall:
# - header is hidden, otherwise behaviour is normal
f = tmpdir.join("f.txt")
f.write("hello world")
with run(str(f)) as h, and_exit(h):
... |
# coding: utf-8
# Create input features for the boosted decision tree model.
import os
import sys
import math
import datetime
import pandas as pd
from sklearn.pipeline import Pipeline
from common.features.lag import LagFeaturizer
from common.features.rolling_window import RollingWindowFeaturizer
from common.features... |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import types
from typing import Sequence, Callable
from inspect import Parameter, Signature
import logging
from azure.ai.ml.entities._job.p... |
#!/usr/bin/env python3
# Contains some unnecessary imports
import sys
import argparse
import json, base64
import socket
import os
import subprocess
import csv
import datetime
import time
import sys
import itertools
from tqdm import tqdm
import json
# Logging
import logging
import logging.config
logging.config.fileConfi... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
from unittest.mock import MagicMock
import pytest
import requests
from airbyte_cdk.models.airbyte_protocol import SyncMode
from source_linnworks.streams import LinnworksStream, Location, ProcessedOrderDetails, ProcessedOrders, StockItems, StockLocations
@... |
from collections import Counter
import random
import numpy as np
def matches(vector, a):
"""
Returns indices where the elements of a vector match some value.
Args:
vector (ndarray(int)): A 1D numpy array describing a vector.
a (int): The value to match.
Returns:
list(int): A l... |
import tensorflow as tf
import math
def arcface_loss(embedding, labels, out_num, w_init=None, s=64., m=0.5):
'''
:param embedding: the input embedding vectors
:param labels: the input labels, the shape should be eg: (batch_size, 1)
:param s: scalar value default is 64
:param out_num: output class... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.