input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<PASSWORD>,
'enabled': True,
}
]
},
3: {
'as_name': 'Test 3',
'max_prefixes': 0,
'sessions': [
{
'ip_address': '2001:db8::3',
'password': <PASSWORD>,
'enabled': True,
}
]
},
4: {
'as_name': 'Test 4',
'max_prefixes': 0,
'sessions': [
{
'ip_address': '2001:db8::4',
'password': <PASSWORD>,
'enabled'... | |
= tf.cast(r * tf.cast(positive_count, tf.float32), tf.int32) - positive_count
negative_indices = tf.random_shuffle(negative_indices)[:negative_count]
# Gather selected ROIs
positive_rois = tf.gather(proposals, positive_indices)
negative_rois = tf.gather(proposals, negative_indices)
# Assign positive ROIs to GT bo... | |
>>> multi_dot((a, b, c))
tensor([[ 26, 49],
[ 80, 148]])
>>> multi_dot((a.to(torch.float), torch.empty(3, 0), torch.empty(0, 2)))
tensor([[0., 0.],
[0., 0.]])
""")
svd = _add_docstr(_linalg.linalg_svd, r"""
linalg.svd(A, full_matrices=True, *, out=None) -> (Tensor, Tensor, Tensor)
Computes the singular value de... | |
<reponame>kstough/Pyecobee
import json
import logging
import numbers
import pprint
import pytz
import requests
import sys
from datetime import date
from datetime import datetime
from datetime import timedelta
import six
from six import reraise as raise_
from . import utilities
from .ecobee_object import EcobeeObject
... | |
model_class = TensorboardJob
factory_class = TensorboardJobFactory
num_objects = 3
HAS_AUTH = True
def setUp(self):
super().setUp()
self.project = ProjectFactory(user=self.auth_client.user)
self.other_project = ProjectFactory()
self.url = '/{}/{}/{}/tensorboards/'.format(API_V1,
self.project.user.username,
s... | |
namespacedef_='', name_='ChartRegion', pretty_print=pretty_print)
for SeparatorRegion_ in self.SeparatorRegion:
namespaceprefix_ = self.SeparatorRegion_nsprefix_ + ':' if (UseCapturedNS_ and self.SeparatorRegion_nsprefix_) else ''
SeparatorRegion_.export(outfile, level, namespaceprefix_, namespacedef_='', name_='Sep... | |
= np.inf
self.x_tol = x_tol
self.x_rtol = x_rtol
self.f_tol = f_tol
self.f_rtol = f_rtol
if norm is None:
self.norm = maxnorm
else:
self.norm = norm
self.iter = iter
self.f0_norm = None
self.iteration = 0
def check(self, f, x, dx):
self.iteration += 1
f_norm = self.norm(f)
x_norm = self.norm(x)
dx_... | |
<reponame>akhilgeothom/neural-tangents
# Copyright 2019 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 appli... | |
<reponame>gyger/PICwriter
# -*- coding: utf-8 -*-
"""
Default MEEP launch-file for arbitrary PICwriter components.
MCTS = "Meep Compute Transmission Spectra"
Launches a MEEP simulation to compute the transmission/reflection spectra from each of the component's ports when light
enters at the input `port`.
How this fu... | |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.6.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# + [markdown] tags=["def"]
# # TESS Atlas fit fo... | |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_array_almost_equal_nulp
from astropy.convolution.convolve import convolve_fft, convolve
from astropy.utils.exceptions import AstropyUserWarning
from astr... | |
<filename>python/resq/run/__init__.py<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import division
import asyncio
import atexit
from collections import Iterable, defaultdict
import functools
import hashlib
import itertools as it
import numpy as np
import operator
from pprint import pf... | |
<filename>hummingbot/connector/exchange/bitmax/bitmax_exchange.py
import logging
from typing import (
Dict,
List,
Optional,
Any,
AsyncIterable,
)
from decimal import Decimal
import asyncio
import json
import aiohttp
import time
from collections import namedtuple
from hummingbot.core.network_iterator import Networ... | |
<gh_stars>1-10
import tensorflow as tf
import utils
epsilon = 1e-8
def log2(x):
numerator = tf.log(x)
denominator = tf.log(tf.constant(2, dtype=numerator.dtype))
return numerator / denominator
def compute_pairwise_kl_bin_loss(logits, labels):
pairwise_labels, pairwise_logits = _pairwise_kl_bin_loss(labels, lo... | |
# python3
# 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 wri... | |
###
#
# Given, in the data/output/parents/results directory:
#
# * pshtt.csv - domain-scan, based on pshtt
# * sslyze.csv - domain-scan, based on sslyze.
#
# And, in the data/output/subdomains directory:
#
# * gather/results/gathered.csv - all gathered .gov hostnames
# * scan/results/pshtt.csv - pshtt scan for all host... | |
<gh_stars>10-100
# -*- coding: utf-8 -*-
import re
from galaxy.utils import ontology
def my_clean_text(text):
text = re.sub(r'([a-zT]+)\.([a-z])', r'\1 . \2', text) # 'abc.xyz' -> 'abc . xyz'
text = re.sub(r'(\w+)\.\.? ', r'\1 . ', text) # if 'abc. ' -> 'abc . '
return text
def clean_text(text):
text = text.str... | |
<gh_stars>1-10
"""
********************************************
test_generator_modul_test_einstellungen.py
@digitalfellowship - Stand 07/2021
Autor: <NAME>
********************************************
Dieses Modul dient der Erstellung von Testeinstellungen für einen ILIAS-Test
Es sind nicht alle Einstellmöglichkeiten ... | |
# -*- coding: utf-8 -*-
# Python GUI code generated with wxFormBuilder (version Oct 26 2018)
# http://www.wxformbuilder.org/
import wx
class kb_test(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title="Keyboard Test Utility", pos=wx.DefaultPosition,
size=wx.Size(710, 370), s... | |
#!/usr/bin/env python
"""
Simple desktop dialogue box support for Python.
Copyright (C) 2007, 2009 <NAME> <<EMAIL>>
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the Li... | |
... 'L': [1, 1, 2, 2]
... })
... }
... )
>>> repartitioned_mp = mp.partition_on(['P', 'L'])
>>> assert [mp["label"] for mp in repartitioned_mp.metapartitions] == [
... "P=1/L=1/partition_label",
... "P=1/L=2/partition_label",
... "P=2/L=1/partition_label",
... "P=2/L=2/partition_label"
... ]
Parameters
---... | |
axis=2)[:config.num_encoding_dim_as_attention_weight]
for logit in list_of_logits:
# print(logit.get_shape().as_list())
logit_tmp = tf.expand_dims(logit, axis=2)
# print(logit_tmp.get_shape().as_list())
wgt_tmp = exp_mask(logit_tmp, mask)
# print(wgt_tmp.get_shape().as_list())
weighted_sum = tf.reduce_sum(tf.nn... | |
'v_8'), ('c_1', 't_2'), ('c_1', 'v_9'), ('t_2', 'v_5'), ('t_2', 'v_6'),
('v_6', 't_2'), ('v_4', 't_3'), ('v_7', 't_3'), ('c_1', 't_3')},
'>': {('c_1', 'v_5'), ('t_3', 'v_4'), ('t_3', 'v_8'), ('t_3', 'v_9'), ('t_2', 'v_5'), ('t_2', 'v_6'),
('t_2', 'v_7'), ('c_1', 'v_7'), ('c_1', 'v_6'), ('c_1', 't_3'), ('t_2', 'v_9')... | |
INTERFACE
- name: Create vPC interfaces
cisco.dcnm.dcnm_interface: &vpc_merge
fabric: mmudigon-fabric
state: merged # only choose from [merged, replaced, deleted, overridden, query]
config:
- name: vpc750 # should be of the form vpc<port-id>
type: vpc # choose from this list [pc, vpc, sub_int, lo, eth]
switch: ... | |
<reponame>attilabukor/kudu
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache Lice... | |
"""
======================================================
Monolayer (:mod:`graphene.monolayer`)
======================================================
Functions
=========
Band structure
--------------
.. toctree::
:maxdepth: 1
graphene.monolayer.Hamiltonian
graphene.monolayer.CarrierDispersion
graphene.monolay... | |
# (C) Copyright 2019-2021 Hewlett Packard Enterprise Development LP.
# Apache License 2.0
import json
import logging
import re
from random import randint
from pyaoscx.utils import util as utils
from pyaoscx.exceptions.response_error import ResponseError
from pyaoscx.exceptions.generic_op_error import GenericOperatio... | |
{function_with_interval_param(0,1, interval=pd.Interval(tstwodaysago, tstoday))}'
)
print('==== 3rd pass ===')
print("request for data from three days to yesterday")
print("expected split in two intervals")
print(f'Final result:\n {function_with_interval_param(0,1, interval=pd.Interval(tsthreedaysago, tsyesterday)... | |
# -*- coding: utf-8 -*-
"""
This Python 3.3 module implements the HEALPix map projection as described in [CaRo2007]_.
.. [CaRo2007] <NAME> and <NAME>, Mapping on the healpix grid, Monthly Notices of the Royal Astronomical Society 381 (2007), no. 2, 865--872.
CHANGELOG:
- <NAME> (AR), 2013-01-26: Refactored code ... | |
<reponame>anoppa/Proyecto-IA-Sim-Comp<gh_stars>1-10
from numpy import string_
from ..non_terminal import NonTerminal
from ..terminal import Terminal
from ..production import Production
from ..Node.declaration_nodes import *
from ..Node.expression_nodes import *
from ..Node.statement_nodes import *
from ..Node.program_n... | |
"""
Utility methods for data processing.
"""
import os
from glob import glob
import itertools
import csv
import pandas as pd
from constants import NUM, NUMBERREGEX, UNK, WORD_START, WORD_END, EMBEDS_FILES, FULL_LANG, LABELS, MODIFIED_LABELS
def print_task_labels(task_name, label2id, id_sequence, file):
#Convert labe... | |
the reference to the literature
"""
dir = os.environ["XUVTOP"]
ioneqdir = os.path.join(dir,'ioneq')
ioneqInfo = util.findFileTypes(ioneqdir, type = '*.ioneq')
ioneqNames = ioneqInfo['fileName']
shortNames = []
for aname in ioneqNames:
shortNames.append(os.path.splitext(aname)[0])
ioneqFullNames = ioneqInfo['f... | |
among_var == 60:
if not self.slice_from(u"na\u0161"):
return False
elif among_var == 61:
if not self.slice_from(u"ja\u0161"):
return False
elif among_var == 62:
if not self.slice_from(u"ka\u0161"):
return False
elif among_var == 63:
if not self.slice_from(u"ba\u0161"):
return False
elif among_var == 64:
if... | |
<gh_stars>0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------... | |
"https://discord.gg/3GvT66U",
"telegram": "",
"twitter": "",
"youtube": ""
}
},
"CLP": {
"symbol": "CLP",
"address": "0x7FCE2856899a6806eeEf70807985fc7554C66340",
"decimals": 9,
"name": "CryptoLending",
"ens_address": "",
"website": "https://cryptolending.org",
"logo": {
"src": "",
"width": "",
"height"... | |
<filename>brainbox/task/trials.py
from iblutil.numerical import ismember
from brainbox.processing import bincount2D
import numpy as np
def find_trial_ids(trials, side='all', choice='all', order='trial num', sort='idx',
contrast=(1, 0.5, 0.25, 0.125, 0.0625, 0), event=None):
"""
Finds trials that match crit... | |
import theano.tensor as T
from .base import MergeLayer
__all__ = [
"autocrop",
"autocrop_array_shapes",
"ConcatLayer",
"concat",
"ElemwiseMergeLayer",
"ElemwiseSumLayer",
]
def autocrop(inputs, cropping):
"""
Crops the given input arrays.
Cropping takes a sequence of inputs and crops them per-axis in ord... | |
models = MODELS_MAP[g_param[OptionsDefine.Version]]
model = models.DescribeAutoScalingInstancesRequest()
model.from_json_string(json.dumps(param))
rsp = client.DescribeAutoScalingInstances(model)
result = rsp.to_json_string()
jsonobj = None
try:
jsonobj = json.loads(result)
except TypeError as e:
jsonobj = jso... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 8 15:44:58 2018
@author: joachim
"""
import os
import re
import yaml
import logging
import warnings
from tunacell.io.text import (TextParsingError, MissingFileError,
MissingFolderError, MismatchFileError,
CorruptedFileError)
from tunacell.base.o... | |
= kwargs.get("flags", None)
self.stopwords = kwargs.get("stopwords", None)
def _to_generated(self):
if not self.flags:
flags = None
else:
flags = DELIMITER.join(self.flags)
return _PatternAnalyzer(
name=self.name,
lower_case_terms=self.lower_case_terms,
pattern=self.pattern,
flags=flags,
stopwords=self.sto... | |
= cand_indices[batch_idxs]
if prefix_tokens is not None:
prefix_tokens = prefix_tokens[batch_idxs]
src_lengths = src_lengths[batch_idxs]
ignorelist = ignorelist[batch_idxs]
scores = scores.view(bsz, -1)[batch_idxs].view(new_bsz * beam_size, -1)
aux_tokens = aux_tokens.view(bsz, -1)[batch_idxs].view(new_bsz * be... | |
initialize=0)
m.x302 = Var(within=Reals, bounds=(0,None), initialize=0)
m.x303 = Var(within=Reals, bounds=(0,None), initialize=0)
m.x304 = Var(within=Reals, bounds=(0,None), initialize=0)
m.x305 = Var(within=Reals, bounds=(0,None), initialize=0)
m.x306 = Var(within=Reals, bounds=(0,None), initialize=0)
m.x307 = Var(wit... | |
{POS: DET},
"<nil>|<dem>|<-sam>|DET|M|S|@>N": {POS: DET},
"<nil>|<sam->|PRP|@<ADVL": {POS: ADP},
"<nil>|ADV|@<ADVL": {POS: ADV},
"<nil>|ADV|@>N": {POS: ADV},
"<nil>|PERS|F|3S|ACC|@ACC>": {POS: PRON},
"<nil>|PRP|@ADVL>": {POS: ADP},
"<nil>|PRP|@N<": {POS: ADP},
"<nil>|PRP|@P<": {POS: ADP},
"<nil>|X|@X"... | |
<reponame>faradaymahe/VASP_band_plot<gh_stars>1-10
"""
This module contains standardized plots as well as more complex plots,
such as band structures and density of states put together, and spin
projected plots.
"""
from vaspvis.band import Band
from vaspvis.dos import Dos
import matplotlib.pyplot as plt
from matplot... | |
"guda": 29432,
"save": 29433,
"û": 29434,
"▁Alanya": 29435,
"▁HOME": 29436,
"▁Intens": 29437,
"▁Lyrics": 29438,
"▁Mogu": 29439,
"▁Oude": 29440,
"▁Presenta": 29441,
"▁Seminar": 29442,
"▁Zadar": 29443,
"▁construction": 29444,
"▁lini": 29445,
"▁pia": 29446,
"▁publish": 29447,
"▁roman": 29448,
"▁scene": 29... | |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import nlpregex.abs_graph.double_link
import nlpregex.abs_graph.node
import nlpregex.abs_graph.edge
import nlpregex.abs_graph.graph
from graphviz import Digraph
import re
import subprocess
import os
SYM_EPSILON = "<eps>"
# @class FA
#
# Represents a finite-state aut... | |
{variable}
return cls(variable, ctrl(typ=type_t))
class ConditionSet(BindingOp):
"""A set represented as a condition on a variable.
The body must be of type t."""
canonical_name = "Set"
op_name_uni="Set"
op_name_latex="Set"
def __init__(self, var_or_vtype, body, varname=None, assignment=None,
type_check=Tr... | |
train_data_list1[0], delta=3e-0, expect=train_data_list2[0])
# loss值与预期相符
self.check_data(
train_data_list1[1], delta=3e-0, expect=self.single_cpu_data)
@run_with_compatibility
def test_ctr_2ps_2tr_hasync_2thread_Fslice_Fdc_Fsm_Tsr_Fgeo_Twp_Fha_pn25(
self):
"""test_ctr_2ps_2tr_hasync_2thread_Fslice_Fdc_Fsm_Tsr_... | |
import atexit
import cPickle as pickle
import errno
import fnmatch
import io
import os
import os.path
import pygame
import stat
import threading
import time
import sys
import pytweening
from pygame.locals import *
from subprocess import call
# UI classes --------------------------------------------------------------... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 21 12:12:41 2021
@author: sjguo
"""
import pennylane as qml
import autograd.numpy as np
from time import time
import matplotlib.pyplot as plt
dev = qml.device('default.qubit', wires=2) # Define REAL noisy two-qubit device
sim = qml.device('default... | |
pipeline_manager.pipelines[0].publishers[1]
self.assertEqual(1, len(new_publisher.samples))
self.assertEqual('a_update',
getattr(new_publisher.samples[0], 'name'))
def test_multiple_counter_pipeline(self):
self._set_pipeline_cfg('counters', ['a', 'b'])
pipeline_manager = pipeline.PipelineManager(self.pipeline_cf... | |
<reponame>pedrocamargo/fast-trips
from __future__ import division
from builtins import str
from builtins import object
__copyright__ = "Copyright 2015 Contributing Entities"
__license__ = """
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the Licen... | |
(('species', ), )
ordering = ('species',)
frozen_columns = 1
def serialize(self):
""" Generate string representation
Returns:
:obj:`str`: value of primary attribute
"""
return 'CONC[{}]'.format(self.species.serialize())
class SpeciesTypeCoefficient(obj_tables.Model):
""" A tuple of a species type and a coef... | |
<reponame>lygztq/gomoku
import abc
import copy
import numpy as np
import six
from pygomoku.Board import Board
from pygomoku.mcts import policy_fn
from pygomoku.mcts.progressbar import ProgressBar
def softmax(x):
probs = np.exp(x - np.max(x)) # avoid overflow
probs /= np.sum(probs)
return probs
def action_prob_... | |
#
# Copyright 2019 The FATE 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 applicable law ... | |
#%%
import os
cwd = os.getcwd()
dir_path = os.path.dirname(os.path.realpath(__file__))
os.chdir(dir_path)
import argparse
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
import torchvision.utils
import numpy as np
i... | |
''' This module contains the program that runs the numerical experiments.'''
from bayescg_k import bayescg_k
from bayescg import bayescg, bayescg_post_cov
from cgqs import cgqs
from utilities import mv_normal
import numpy as np
from scipy import linalg
from scipy.special import erfinv
import matplotlib.pyplot as plt
... | |
<gh_stars>1-10
#FOUR Ultrasonic sensors (HC-SR04) FUNCTION
#Version 1
#Goal: Assign four sensors to the four directions depending on the configuration
#When turn occurs, the sensor that aligns with each direction will change = FOUR CONFIGURATIONS
#Four sensors: sensor_1, sensor_2, sensor_3, sensor_4
#Four directio... | |
match="in_port="+exp.VfsMatch["enp3s0f2"]+",ip,nw_dst=10.0.0.2"
action="mod_dl_dst:"+exp.GetMacByVf("enp3s0f4")+","+exp.VfsMatch["enp3s0f3"]
exp.addFlowRule("vswitch-vm" , exp.OVS_PATH, "br0", match, action)
#Flow Rules (2)
#---------------------------------------------------------
match="in_port="+exp.VfsMat... | |
<reponame>theNewFlesh/hidebound<filename>python/hidebound/core/database.py
from typing import Any, Dict, List, Union
from copy import deepcopy
from importlib import import_module
from pathlib import Path
import json
import os
import shutil
import sys
from pandas import DataFrame
import jsoncomment as jsonc
import num... | |
jspectra[:, freq_dc, :] = (
jspectra[:, ind_vel[1], :] + jspectra[:, ind_vel[2], :]) / 2 # CORRECCION
if jcspectraExist:
jcspectra[:, freq_dc, :] = (
jcspectra[:, ind_vel[1], :] + jcspectra[:, ind_vel[2], :]) / 2
if mode == 2:
vel = numpy.array([-2, -1, 1, 2])
xx = numpy.zeros([4, 4])
for fil in range(4):
... | |
# coding: utf-8
"""
Ed-Fi Operational Data Store API
The Ed-Fi ODS / API enables applications to read and write education data stored in an Ed-Fi ODS through a secure REST interface. *** > *Note: Consumers of ODS / API information should sanitize all data for display and storage. The ODS / API provides reasonable s... | |
self,
query,
options,
fetch_function=fetch_fn,
collection_link=database_or_container_link,
page_iterator_class=query_iterable.QueryIterable
)
def QueryItemsChangeFeed(self, collection_link, options=None, response_hook=None, **kwargs):
"""Queries documents change feed in a collection.
:param str collection_li... | |
If possible inspect the ordering on the data we were given and
# update the table to reflect that.
order_by = self.data.ordering
if order_by is not None:
self.order_by = order_by
else:
self.order_by = order_by
if template is not None:
self.template_name = template
warnings.warn('template argument to Table is d... | |
"dtype": dtype,
"strides": strides,
"padding": padding,
"dimension_numbers": dim_nums,
"precision": precision
}
for dtype in all_dtypes
for lhs_shape, filter_shape, strides, padding, dim_nums in [
((2, 5), (), (), [], ("NC", "OI", "CN")),
((2, 3, 4), (2,), (2,), [(0, 2)], ("CNH", "OHI", "HNC")),
((3, 1, 4, 5)... | |
<= 0)
m.c1309 = Constraint(expr= - m.b130 + m.b131 - m.b155 <= 0)
m.c1310 = Constraint(expr= - m.b130 + m.b132 - m.b156 <= 0)
m.c1311 = Constraint(expr= - m.b130 + m.b133 - m.b157 <= 0)
m.c1312 = Constraint(expr= - m.b130 + m.b134 - m.b158 <= 0)
m.c1313 = Constraint(expr= - m.b130 + m.b135 - m.b159 <= 0)
m.c1314 ... | |
<reponame>niravkin/pyCGM<filename>pyCGM_Single/pycgmKinetics.py
#pyCGM
# This module was contributed by <NAME>
# the CoM calculation is not an exact clone of PiG,
# but the differences are not clinically significant.
# We will add updates accordingly.
#
from __future__ import division
import os
import numpy as np
i... | |
S(3)/2), (1, 2, S(3)/2)) )/5 + \
sqrt(10)*JzKetCoupled(S(5)/2, -S(1)/2, (S(1)/2, 1, 1), ((1,
3, S(3)/2), (1, 2, S(5)/2)) )/10
assert couple(TensorProduct(JzKet(S(1)/2, S(-1)/2), JzKet(1, 0), JzKet(1, 1)), ((1, 3), (1, 2)) ) == \
-sqrt(2)*JzKetCoupled(S(1)/2, S(1)/2, (S(1)/2, 1, 1), ((1, 3, S(1)/2), (1, 2, S(1)/2)) ... | |
24.4, 0.8)
model.createNode(2540, 0, 24.4, 0.4)
model.createNode(2541, 0, 24, 2.4)
model.createNode(2542, 0, 24, 2)
model.createNode(2543, 0, 24, 1.6)
model.createNode(2544, 0, 24, 1.2)
model.createNode(2545, 0, 24, 0.8)
model.createNode(2546, 0, 24, 0.4)
model.createNode(2547, 0, 23.6, 2.4)
model.createNode(2548, 0, 2... | |
# -*- coding: utf-8 -*-
# Copyright 2015 Mirantis, 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 o... | |
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); ... | |
<gh_stars>1-10
import math
from functools import partial
from typing import Callable, Dict, List
import torch
from detectron2.config import configurable
from detectron2.data import MetadataCatalog
from detectron2.layers import ShapeSpec
from detectron2.modeling import (
META_ARCH_REGISTRY,
SEM_SEG_HEADS_REGISTRY,
B... | |
<filename>stats/utils.py<gh_stars>0
import argparse
from collections import Counter
import csv
import logging
import os
import math
import sqlite3
log = logging.getLogger()
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
np.random.seed(sum(map(ord, "aesthetics")))
import seaborn as sns
FONT_S... | |
# This file is auto-generated from a Python script that parses a PhysiCell configuration (.xml) file.
#
# Edit at your own risk.
#
import os
from ipywidgets import Label,Text,Checkbox,Button,HBox,VBox,FloatText,IntText,BoundedIntText,BoundedFloatText,Layout,Box
class UserTab(object):
def __init__(self):
micron_... | |
<filename>distil/utils/data_handler.py<gh_stars>1-10
from torch.utils.data import Dataset
import numpy as np
from PIL import Image
from torchvision import transforms
import torch
class DataHandler_Points(Dataset):
"""
Data Handler to load data points.
This class extends :class:`torch.utils.data.Dataset` to handle ... | |
<reponame>zhangzan1997/MNN
_Int = int
_Float = float
from _mnncengine._expr import *
import _mnncengine._expr as _F
_numpy_supported = False
try:
import numpy as np
_numpy_supported = True
except Exception:
print ("Numpy not found. Using MNN without numpy.")
def _to_var(x, to_float=True):
if _numpy_supported:
if... | |
pixels
bad_mask = is_dark_mask == 0
if im.mask is not None:
bad_mask = bad_mask | im.mask
# Flip bad mask around so we get only the dark pixels in the
# linear range
tim = im.data[bad_mask == 0]
std = np.std(tim)
#std = np.asscalar(std.data )
med = np.median(tim)
#med = np.asscalar(med.data )
mean = np.mean... | |
from krrt.utils import read_file
from krrt.sat import CNF
class Node:
def __init__(self, childs = []):
assert None not in childs, str(childs)
self.children = childs
self._count = -1
self._nnf_index = -1
self._replacement = None
@property
def usedvars(self):
if self._replacement is None:
se... | |
#!/usr/bin/python3
from flask import Flask, render_template
from bluepy import btle
from bluepy.btle import Scanner, DefaultDelegate
import sys
import time
import math
import os
import signal
###############################################################################
#
# Reverie Powerbase Control API - <NAME>
#
... | |
belongs
:param table: the wrapped table
"""
self._schema = schema
self._wrapped_table = table
self._name = table.name
self._uname = urlquote(table.name)
self._fqname = "%s:%s" % (urlquote(self._schema._name), self._uname)
self._instancename = '*'
self._projection_name = self._instancename
self._fromname = sel... | |
<reponame>oldarmyc/ae_preflight<filename>tests/tests_reporting.py
from __future__ import absolute_import
from .fixtures import reporting_returns
from system_profile import profile
import glob
import sys
import os
if sys.version_info[:2] >= (2, 7):
from unittest import TestCase
else:
from unittest2 import TestCas... | |
'LocalVertexPool'
newObject['NumberOfVertices'] = self._readUInt(fromChunk = True)
newObject['AttributeMask'] = self._readUInt(fromChunk = True)
mask = 0x01
Flags = [False] * 12
# Now process the attribute mask:
for idx in range(12):
if newObject['AttributeMask'] & mask > 0:
Flags[idx] = True
# Shift the... | |
to -1
stdout = chan.makefile('r', -1)
stderr = chan.makefile_stderr('r', -1)
try:
stdoutdata = stdout.read()
exit_status = stdin.channel.recv_exit_status()
if exit_status != 0:
if not allow_fail:
raise RemoteCommandError(self, cmd, exit_status, stderr.read())
else:
self._log(logging.DEBUG, "Running ssh comma... | |
return 'Using unknown version found on system.'
status, output = getstatusoutput("libpng-config --version")
if status == 0:
version = output
else:
version = None
try:
return self._check_for_pkg_config(
'libpng', 'png.h',
min_version='1.2', version=version)
except CheckFailed as e:
if has_include_file(get_i... | |
is then used by its `OutputPort(s) <Mechanism_OutputPorts>` to assign
items to its `output_values <Mechanism_Base.output_values>` attribute.
.. _Mechanism_Ports:
*Ports*
~~~~~~~~
Every Mechanism has one or more of each of three types of Ports: `InputPort(s) <InputPort>`,
`ParameterPort(s) <ParameterPort>`, `and Out... | |
<filename>phonology-augmented_transliterator/syl_splitter/syl_struct_generator/SylStructGenerator.py
# Generate all possible syllable structure hypothesis of the entries in an input file
import os
import sys
import time
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from LangAssets.LangAssets import La... | |
<gh_stars>10-100
""" SamplingVolume_Widget module. """
# ISC License
#
# Copyright (c) 2020–2021, <NAME>, <NAME>. <<EMAIL>>
#
# 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 this permission notice... | |
#!/usr/bin/python
##########################################################################
# Copyright (c) 2015, Salesforce.com, Inc.
# All rights reserved.
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary... | |
<gh_stars>1-10
import math
from collections import namedtuple
import AppKit
import defcon
from booleanOperations.booleanGlyph import BooleanGlyph
from lib.tools import bezierTools
from mojo.events import installTool, BaseEventTool, extractNSEvent, addObserver
from mojo.UI import getDefault
from mojo.extensions import g... | |
<reponame>hubo1016/vlcp
import logging
import copy
from uuid import uuid1
from vlcp.server.module import Module,depend,api,call_api
from vlcp.event.runnable import RoutineContainer
from vlcp.utils.networkmodel import *
from vlcp.utils.dataobject import watch_context,set_new,dump,ReferenceObject,\
request_context, cre... | |
i in range(0, self.number_of_directions):
offset = number_of_input_convolutions_per_direction * i
input_columns_for_direction = \
input_columns[offset:offset + number_of_input_convolutions_per_direction]
input_columns_lists.append(input_columns_for_direction)
return MultiDirectionalMultiDimensionalLSTMParametersP... | |
#/*
# * Copyright 2016 -- 2021 IBM Corporation
# *
# * 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... | |
<reponame>manliu1225/Facebook_crawler<filename>ven2/lib/python2.7/site-packages/persistent/picklecache.py
##############################################################################
#
# Copyright (c) 2009 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Z... | |
<reponame>dkn22/findatapy<filename>findatapy/timeseries/calculations.py
__author__ = 'saeedamen' # <NAME>
#
# Copyright 2016 Cuemacro
#
# 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... | |
#!/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 agreed to... | |
0.5 or min_consensus > 1:
raise ValueError(
"Minimal consensus should be above 0.5 and under 1")
# Get lineages in REVERSED order
lineages = [Lineage(self[str(txd)], ascending=False)
for txd in taxid_list]
# Extend lineages so that they all are same size
maxlen = max([len(lin) for lin in lineages])
for l... | |
= - model.ztilde[model.slayer - 1] / (4 * np.pi)
amp_tm_ez = (model.ry - model.sy) / (4 * np.pi \
* model.ytilde[model.rlayer - 1] * model.r)
amp_tm_hx_g_1 = (model.ry - model.sy) ** 2 \
/ (4 * np.pi * model.r ** 2)
amp_tm_hx_g_2 = - (2 * (model.ry - model.sy) ** 2 / model.r ** 3 \
- 1 / model.r) / (4 * np.pi)
a... | |
<gh_stars>0
import json
import numpy as np
from PyQt5 import QtCore, QtGui, QtWidgets
from sscanss.core.instrument import Link, circle_point_analysis, generate_description
from sscanss.core.math import clamp
from sscanss.core.util import create_scroll_area
from .widgets import ScriptWidget, JawsWidget, PositionerWidget... | |
HAIR_CURLY: 'CommonGameTag' = 314
HAIR_LENGTH_LONG: 'CommonGameTag' = 664
HAIR_LENGTH_MEDIUM: 'CommonGameTag' = 820
HAIR_LENGTH_SHORT: 'CommonGameTag' = 662
HAIR_LENGTH_UPDO: 'CommonGameTag' = 2173
HAIR_LONG: 'CommonGameTag' = 151
HAIR_MEDIUM: 'CommonGameTag' = 150
HAIR_SHORT: 'CommonGameTag' = 149
HAIR_STRAIGH... | |
"""
_prefix = 'l2vpn-cfg'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.name = None
self.bdac_storm_control_types = L2Vpn.Database.BridgeDomainGroups.BridgeDomainGroup.BridgeDomains.BridgeDomain.BdAttachmentCircuits.BdAttachmentCircuit.BdacStormControlTypes()
self.bdac_storm_control_type... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.