input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
length '2'",
"'a' is longer than maximum length '0'"
]}
]
)
def test_group_errors_true_returns_ok(self):
path = "/a/b"
dictionary = {
"a": {
"b": "hello"
}
}
@extract([Parameter(path, "event", validators=[Mandatory])], True)
def handler(event, context, b=None): # noqa
return b
response = handler(dicti... | |
name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CreateSegmentationTaskResponse(AbstractModel):
"""CreateSegmentationTask返回参数结构体
"""
def __init__(self):
r"""
:param TaskID: 任务标识ID,可以用与追溯任务状态,查看任务结果
:type TaskID: s... | |
<gh_stars>0
# Copyright 2016 Google Inc. 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 ... | |
<filename>pandas/tseries/tests/test_daterange.py<gh_stars>0
from datetime import datetime
from pandas.compat import range
import nose
import numpy as np
from pandas.core.index import Index
from pandas.tseries.index import DatetimeIndex
from pandas import Timestamp
from pandas.tseries.offsets import generate_range
fro... | |
def test_affine_transform_opencv(self, xp, dtype):
a = testing.shaped_random((100, 100), xp, dtype)
matrix = testing.shaped_random((2, 3), xp, dtype)
if xp == cupy:
return cupyx.scipy.ndimage.affine_transform(a, matrix, order=1,
mode='opencv')
else:
return cv2.warpAffine(a, matrix, (a.shape[1], a.shape[0]))
@t... | |
<reponame>jeremyko/let-me-test
#-*- coding: utf-8 -*-
#202007 kojh create
import sys
import os
import glob
import datetime
import subprocess
import traceback
import configparser
import shutil
import logging
from tspec_cmd_impl import *
from module_core import *
_g_runner_self = None # XXX
#////////////////////////... | |
QtWidgets.QPushButton(self.groupBox_28)
self.ss7i64in_9.setObjectName("ss7i64in_9")
self.gridLayout_70.addWidget(self.ss7i64in_9, 9, 1, 1, 1)
self.ss7i64in_10 = QtWidgets.QPushButton(self.groupBox_28)
self.ss7i64in_10.setObjectName("ss7i64in_10")
self.gridLayout_70.addWidget(self.ss7i64in_10, 10, 1, 1, 1)
self.ss... | |
<reponame>TuxML/tuxml
"""Management of the compiler
:author: <NAME>, <NAME>, <NAME>, <NAME>
:version: 2
"""
# @file compiler.py
import re
import subprocess
import shutil
import time
import os
import bz2
import threading
from compilation.logger import *
import compilation.settings as settings
## Compiler
# @author... | |
<filename>Packs/Rapid7_InsightIDR/Integrations/Rapid7_InsightIDR/Rapid7_InsightIDR.py
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import dateparser
import json
import urllib3
from datetime import datetime, timedelta
from typing import Dict, Tuple
from requests im... | |
msg = "At line {0} column {1}: {2}".format(lineno, colno, msg)
raise Exception(msg)
err = StringIO()
lineno = ctx.line(ctx.pos) + 1
colno = ctx.col(ctx.pos) + 1
msg = "At line {0} column {1}:"
print(msg.format(lineno, colno, ctx.lines), file=err)
for parsers, msg in ctx.errors:
names = " -> ".join([p.name for... | |
<gh_stars>0
# Copyright 2021 University College London. 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... | |
# imports to make app work correctly
from flask import Flask, render_template, flash, redirect, url_for, session, request, logging , send_from_directory, send_file
from flask_mysqldb import MySQL
from wtforms import Form, StringField, TextAreaField, PasswordField, validators
from passlib.hash import sha256_crypt
from ... | |
items2search:
item_search += '&type={}'.format(item)
for status in stati2search:
item_search += '&status={}'.format(status)
if id_list:
itemids = re.split(',|\s+', id_list)
itemids = [id for id in itemids if id]
else:
itemres = ff_utils.search_metadata(item_search, key=connection.ff_keys, page_limit=500)
item... | |
<filename>cupy/_core/_gufuncs.py<gh_stars>1000+
import re
import numpy
import cupy
import cupy._core._routines_manipulation as _manipulation
from cupy._core._dtype import get_dtype
from cupy._core import internal
# Signature parsing code and dimension accessing has been borrowed
# from dask
# https://github.com/dask... | |
ListShares(self, video_id: str, account_id: str='') -> Response
Lists the existing shares for an account.
ShareVideo(self, video_id: str, json_body: Union[str, dict], account_id: str='') -> Response
Shares a video to one or more affiliates.
GetShare(self, video_id: str, affiliate_account_id: str, account_id: str=... | |
-0.045, -0.047, -0.048, -0.049, -0.045, -0.033, -0.016],
[10, -0.043, -0.044, -0.041, -0.041, -0.040, -0.038, -0.034, -0.035, -0.035, -0.029, -0.022, -0.009],
[20, -0.052, -0.034, -0.036, -0.036, -0.035, -0.028, -0.024, -0.023, -0.020, -0.016, -0.010, -0.014],
[30, -0.062, -0.034, -0.027, -0.028, -0.027, -0.027, -0.... | |
1.33500106673234)
m.c12 = Constraint(expr= m.x6 - m.x2509 >= 0.741937344729377)
m.c13 = Constraint(expr= m.x7 - m.x2509 >= 0.916290731874155)
m.c14 = Constraint(expr= m.x2 - m.x2510 >= -0.356674943938732)
m.c15 = Constraint(expr= m.x3 - m.x2510 >= 0.955511445027436)
m.c16 = Constraint(expr= m.x4 - m.x2510 >= 0.470... | |
<gh_stars>1-10
'''
A simple implementation of the material design colors in python
- currently only supports 'rgb' format; more will be added soon
Usage:
from material_colors import MaterialColors
Colors = MaterialColors('rgb')
my_red_color = Colors.red()
my_purple_color = Colors.purple(300)
'''
class M... | |
# Copyright 2020 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | |
:param str id: The unique identifier for the rule.
:param str prefix: The object key prefix identifying one or more objects to which the rule applies.
"""
pulumi.set(__self__, "enabled", enabled)
if abort_incomplete_multipart_upload_days is not None:
pulumi.set(__self__, "abort_incomplete_multipart_upload_days", a... | |
import base64
import json
import os
import pathlib
import sys
import time
from test.utils import HERE, SIMPLE_PATH
from urllib.parse import urljoin
import hypothesis
import pytest
import requests
import yaml
from _pytest.main import ExitCode
from hypothesis import HealthCheck, Phase, Verbosity
from schemathesis impor... | |
m.x866*m.b634 <= 0)
m.c868 = Constraint(expr=m.x217*m.x217 - m.x867*m.b634 <= 0)
m.c869 = Constraint(expr=m.x218*m.x218 - m.x868*m.b634 <= 0)
m.c870 = Constraint(expr=m.x219*m.x219 - m.x869*m.b634 <= 0)
m.c871 = Constraint(expr=m.x220*m.x220 - m.x870*m.b634 <= 0)
m.c872 = Constraint(expr=m.x221*m.x221 - m.x871*m.b... | |
<filename>teek/_widgets/base.py<gh_stars>0
import collections.abc
import contextlib
import functools
import keyword
import operator
import re
import teek
from teek._tcl_calls import counts, from_tcl, make_thread_safe
from teek._structures import ConfigDict, CgetConfigureConfigDict, after_quit
_widgets = {}
_class_bin... | |
<filename>lib/devops/supervisor.py
import fcntl
import os
import random
import select
import signal
import sys
import time
import traceback
from devops.file_and_dir_helpers import *
from angel.util.pidfile import *
from devops.unix_helpers import set_proc_title
from angel.stats.disk_stats import disk_stats_get_usage_f... | |
instrumentId
request = {
'instrument_id': market['id'],
# 'client_oid': 'abcdef12345', # optional, [a-z0-9]{1,32}
# 'order_id': id,
}
clientOid = self.safe_string(params, 'client_oid')
if clientOid is not None:
method += 'ClientOid'
request['client_oid'] = clientOid
else:
method += 'OrderId'
request['order_... | |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | |
# coding: utf-8
# # Two-dimensional flows: vorticity and stream function method
# v3.80, 14 April 2018, by <NAME>
#
# $\newcommand{\V}[1]{\vec{\boldsymbol{#1}}}$
# $\newcommand{\I}[1]{\widehat{\boldsymbol{\mathrm{#1}}}}$
# $\newcommand{\pd}[2]{\frac{\partial#1}{\partial#2}}$
# $\newcommand{\pdt}[1]{\frac{\partial#1}... | |
<gh_stars>0
import locale
import logging
from django.db import connection
from django.core.exceptions import FieldError
from django.db.models import Q, Count, Min, Max
import lfs.catalog.models
from lfs.catalog.settings import CONFIGURABLE_PRODUCT
from lfs.catalog.settings import PRODUCT_WITH_VARIANTS
from lfs.catalo... | |
APIEndpointUser = None
tempSubscription = classes.Subscription() # parent=targetUser.key leads to error down the stream
tempSubscription.url = url
success, endpoint = tempSubscription.rawSubscription().APIEndpoint()
if not success:
responses["response"] = endpoint
responses[
"explanation"
] = "Error while ret... | |
<filename>atoMEC/check_inputs.py
"""
The check_inputs module checks the validity of all user-defined inputs.
If inputs are invalid, InputError exceptions are raised. It also assigns
appropriate default inputs where none are supplied.
Classes
-------
* :class:`Atom` : Check the inputs from the :class:`atoMEC.Atom` obj... | |
is None:
if row._table.is_root:
operations.append({"op": "delete",
"table": row._table.name,
"where": _where_uuid_equals(row.uuid)})
any_updates = True
else:
# Let ovsdb-server decide whether to really delete it.
pass
elif row._changes:
op = {"table": row._table.name}
if row._data is None:
op["op"] = "inser... | |
# spese/views.py
''' app spese views:
- toggle(id), change amount sign
- add, create new expense
- transfer_funds, create new transfer fund
- index, list all expenses summary
- detail(id), show expense detail
- change(id), change expense
- delete(id), delete expense
- balance, reports by accounts, tags, ...
- ... | |
<filename>benchmarks/SimResults/combinations_spec_ml_fulltrained/cmp_bwavesGemsFDTDastaromnetpp/power.py
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage wi... | |
(FB weights)
'deit_tiny_patch16_224': _cfg(
url='https://dl.fbaipublicfiles.com/deit/deit_tiny_patch16_224-a1311bcf.pth',
mean=IMAGENET_DEFAULT_MEAN, std=IMAGENET_DEFAULT_STD),
'deit_small_patch16_224': _cfg(
url='https://dl.fbaipublicfiles.com/deit/deit_small_patch16_224-cd65a155.pth',
mean=IMAGENET_DEFAULT_MEAN... | |
dt
elif ':' in dt:
self.scenes[scId].time = dt
else:
if scn.find('Day') is not None:
self.scenes[scId].day = scn.find('Day').text
if scn.find('Hour') is not None:
self.scenes[scId].hour = scn.find('Hour').text
if scn.find('Minute') is not None:
self.scenes[scId].minute = scn.find('Minute').text
... | |
import pytest
# import unittest
import numpy as np
import femnurbs.SplineUsefulFunctions as SUF
def test_isValidU():
with pytest.raises(TypeError):
SUF.isValidU()
assert SUF.isValidU(0) is False
assert SUF.isValidU(1.2) is False
assert SUF.isValidU({}) is False
assert SUF.isValidU(-1) is False
a... | |
c-c//8]))#input_tensor[:, :, :, c//8:]
shift_buffer = tf.get_default_graph().get_tensor_by_name(shift_buffer_name)
shift_concat = tf.concat((shift_buffer, x2), axis=3, name='shift_concat')
### END SHIFT CHANGES ###
### SHIFT CHANGES ###
# If splitting, (concat, input_tensor) are fed to DPU. Insert new placeholder... | |
save in self.estimators
if self.estimators is not None:
self.estimators.append(estimator_)
def _score_estimator(self, estimator_, X_val, y_val):
# Use multi-metric scorer here - handles not repeating calls to
# predict / predict proba, ect... - can safely wrap even single metrics
scorers = _MultimetricScorer(... | |
-0.00461 0.00928 2005.001413
IGS_7587 4117361.7199 2517077.0399 4157679.2708 -0.01531 0.01213 0.01113 2005.001413
IGS_7589 4121934.2496 2652189.6210 4069034.4082 0.00106 -0.01590 -0.04446 2005.001413
IGS_7593 4075572.5569 931755.2587 4801584.4442 -0.01601 0.01710 0.01008 2005.001413
IGS_7596 4075582.2884 931837.4121 48... | |
columns [b * k : b * k + b],
# where b is the dimension of box representation (4 or 5)
# Note that compared to Detectron1,
# we do not perform bounding box regression for background
# classes.
gt_class_cols = box_dim * fg_gt_classes[:, None] + torch.arange(
box_dim, device=device
)
gt_covar_class_cols = self.bb... | |
<reponame>Ishma59/molo<gh_stars>0
from molo.core.tests.constants import TEST_IMAGE_HASH
AVAILABLE_ARTICLES = {
"meta": {
"total_count": 3
},
"items": [
{
"id": 10,
"meta": {
"type": "core.ArticlePage",
"detail_url": "http://localhost:8000/api/v2/pages/10/",
},
"title": "Test article 1",
"subtitle": "Sub fo... | |
<reponame>jjlee0802cu/pylol
# MIT License
#
# Copyright (c) 2020 MiscellaneousStuff
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation... | |
BERT paper for more details).
`attention_mask`: an optional torch.LongTensor of shape [batch_size, sequence_length] with indices
selected in [0, 1]. It's a mask to be used if the input sequence length is smaller than the max
input sequence length in the current batch. It's the mask that we typically use for attentio... | |
# DETECT OPERATIONS ON CONSTANTS, like x = y * 1024.23
# DETECT OPERATIONS ON UNKNOWN VARIABLES
if left_token and not left_units and (not left_token.isDimensionless): #and right_units:
if left_token.isNumber: # TRUE FOR EITHER INT OR FLOAT
self.is_unit_propagation_based_on_constants = True
token.is_unit_propagatio... | |
= self._check_feature_params()
num_frames = len(self.x)
self.STFT = P.zeros((self.nfft/2+1, num_frames), dtype='complex')
self.win = P.ones(self.wfft) if self.window=='rect' else P.np.sqrt(P.hanning(self.wfft))
x = P.zeros(self.wfft)
buf_frames = 0
for k, nex in enumerate(self.x):
x = self._shift_insert(x, nex, ... | |
self.display_message('capturing background image')
def OnLoadBgImage(self,event):
widget = event.GetEventObject()
cam_id = self.widget2cam_id[widget]
per_cam_panel = self.per_cam_panel[cam_id]
ctrl = xrc.XRCCTRL(per_cam_panel,"TAKE_BG_IMAGE_ALLOW_WHEN_SAVING")
if not ctrl.GetValue() and cam_id in self.trx_write... | |
<gh_stars>0
# -*- coding: utf-8 -*-
from urllib.parse import quote_plus, urlencode
from plexapi import media, utils
from plexapi.exceptions import NotFound
class ArtUrlMixin(object):
""" Mixin for Plex objects that can have a background artwork url. """
@property
def artUrl(self):
""" Return the art url for th... | |
optional, default is
None
column 0 is 'labelID'
column 1 is 'labelName'
Returns
-------
table : dataframe (Pandas)
The table contains all the features extracted from the spectrogram.
Keys are {'labelID', 'labelName, 'cyear', 'cmonth', 'cday', 'chour',
'cmin','csecond','cfreq','shp1,'shp2',...'shpn... | |
<filename>Python/python3_version/klampt/math/symbolic_io.py
from .symbolic import *
from .symbolic import _infix_operators,_prefix_operators,_builtin_functions
from ..io import loader
import json
from json import encoder
import weakref
import sys
VAR_PREFIX = ''
USER_DATA_PREFIX = '$'
NAMED_EXPRESSION_TAG = '#'
NAMED_... | |
now self.barsData have all the needed info :)
# barsData structure
# 0 bar center
# 1 perymeter
# 2 bar Current
# 3 cross section
# 4 Q power losses value
# 5 Ghtc to air thermal conductance
# 6 Gt 1/2lenght thermal conductance
# 7 phase number
# 8 New Thermal model DT - this one will calculated later below... | |
reg0, pos1),
(position_set_x, pos1, 12000),
(position_set_y, pos1, 1000),
(overlay_set_size, reg0, pos1),
(try_end),
(str_store_player_username, s1, ":player_no"),
(create_text_overlay, reg0, s1, 0),
(overlay_set_color, reg0, ":font_color"),
(position_set_x, pos1, 750),
(position_set_y, pos1, 750),
(overlay_... | |
input, output,
calc_latency=calc_latency,
func_real_latency=estim_net,
func_accum_latency=estim_accum_by_graph
)
mobile_net.save_modules_nnp(
OUTPUT_DIR + 'mn' + str(i), active_only=True,
calc_latency=calc_latency,
func_latency=estim_accum_by_graph
)
if onnx:
mobile_net.convert_npp_to_onnx(OUTPU... | |
# Copyright 2015 TellApart, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
# Copyright 2012 NEC 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 law or agreed to in writing, ... | |
TO FIND THIS MAPPING NOW
C = self.InferPolynomialDegree() - 1
node_arranger = NodeArrangementTet(C)[0]
# WE NEED TO DO THIS DUMMY RECONSTRUCTION OF FACES BASED ON ELEMENTS
faces = self.elements[boundary_face_to_element[:,0][:,None],
node_arranger[boundary_face_to_element[:,1],:]].astype(self.faces.dtype)
# CHE... | |
<reponame>lweydemann/ascat
# Copyright (c) 2020, TU Wien, Department of Geodesy and Geoinformation
# 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... | |
import numpy as np
import torch as tr
import itertools as it
from abstract_machine import make_abstract_machine, memorize_env
from neural_virtual_machine import NeuralVirtualMachine as NVMNet
def hadamard_matrix(N):
H = tr.tensor([[1.]])
while H.shape[0] < N:
H = tr.cat((
tr.cat((H, H), dim=1),
tr.cat((H, -H), di... | |
iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method portals_id_portal_members_post" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params) or (params['id'] is None):
raise Valu... | |
sha1="a2e319eb7cfaa630efc5ceb69e6f8f081e90abae",
size=274561130,
auto_download=auto_download,
),
WikidatedV1_0EntityStreamsFile(
archive_path=dataset_dir / (prefix + "p75798894-p76057549.7z"),
page_ids=range(75798894, 76057550),
darus_id=93997,
sha1="7fbc055c4867916d2eb3d714ab0bd3a8fdc7757c",
size=492816562,
... | |
#!/usr/bin/env python
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] tags will be kept. #
###########################################################
impo... | |
<filename>workflows/cloudify_system_workflows/snapshots/snapshot_restore.py<gh_stars>0
import re
import os
import json
import time
import uuid
import base64
import shutil
import zipfile
import tempfile
import threading
import subprocess
from contextlib import contextmanager
from cloudify.workflows import ctx
from clou... | |
#!/usr/bin/env python
import random
import os_ident
import uncrc32
try: import pcap as pcapy
except: import pcapy
from impacket import ImpactPacket
from impacket import ImpactDecoder
from impacket.ImpactPacket import TCPOption
from impacket.examples import logger
#defaults
MAC = "01:02:03:04:05:06"
IP = "192.168.6... | |
Blade 2, Node 7
self.B2N8Alpha = False #Angle of attack at Blade 2, Node 8
self.B2N9Alpha = False #Angle of attack at Blade 2, Node 9
self.B3N1Alpha = False #Angle of attack at Blade 3, Node 1
self.B3N2Alpha = False #Angle of attack at Blade 3, Node 2
self.B3N3Alpha = False #Angle of attack at Blade 3, Node 3... | |
# -*- coding: utf-8 -*-
import time
from operator import itemgetter
from os import path, listdir, stat
from bisect import bisect_left
from sys import getsizeof
import shutil
aa_monoisotopic_masses = {'A': 71.037113805,
'C': 103.009184505 + 57.021463735,
'D': 115.026943065,
'E': 129.042593135,
'F': 147.068413945,
... | |
<reponame>amalrkrishna/virtualnav-mpu6050<filename>maze.py<gh_stars>1-10
from __future__ import division
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.error import *
from OpenGL.GL import *
from PIL import Image
from scipy import integrate
from operator import add, mul, div
from copy import deepcopy
fr... | |
<reponame>CubeSkyy/ILU-RL<gh_stars>0
import os
import json
import pandas as pd
import argparse
import numpy as np
from pathlib import Path
from scipy import stats
import configparser
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import seaborn as sns
from analysis.utils import str2bool, get... | |
from django.http.response import HttpResponse, JsonResponse
from django.urls import reverse
from django.shortcuts import redirect, render, get_object_or_404
from django.views.decorators.csrf import csrf_exempt ######## csrf token 오류 날 경우 추가!
from django.db.models import Q
from django.core.paginator import Paginator
fro... | |
or quadratic. In general it sends M_k(chi) to M_k(1/chi)
"""
return self.modular_symbols(sign=1).atkin_lehner_operator(d).matrix()[0,0]
def twist(self, chi, level=None, check=True):
r"""
Return the twist of the newform ``self`` by the Dirichlet
character ``chi``.
If ``self`` is a newform `f` with character `\e... | |
n) * s, s))
>>> node_groups = [ut.lmap(str, range(*o)) for o in ut.itertwo(offsets)]
>>> edge_groups = [ut.combinations(nodes, 2) for nodes in node_groups]
>>> graph = nx.Graph()
>>> [graph.add_nodes_from(nodes) for nodes in node_groups]
>>> [graph.add_edges_from(edges) for edges in edge_groups]
>>> for count, no... | |
<filename>src/MSI/optimization/opt_runner.py
import MSI.simulations as sim
import re
import MSI.cti_core.cti_processor as pr
import MSI.optimization.matrix_loader as ml
import MSI.simulations.absorbance.curve_superimpose as csp
import MSI.simulations.yaml_parser as yp
import MSI.simulations.instruments.shock_tube as st... | |
# Copyright 2017 Battelle Energy Alliance, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | |
<filename>recsim_ng/lib/tensorflow/log_probability.py
# coding=utf-8
# Copyright 2021 The RecSim Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | |
not app_created:
for app in created_apps:
assert app["id"] != context.current_application_id
return
found_app = False
for app in created_apps:
found_app = found_app or app["id"] == context.current_application_id
assert found_app
# If there is no key to check, we're done.
if state_key is None or state_key == ... | |
the convex hull of 8 vertices
sage: P.is_combinatorially_isomorphic(polytopes.cube())
True
The SEP of a complete graph on `4` vertices is a cuboctahedron::
sage: G = graphs.CompleteGraph(4)
sage: P = G.symmetric_edge_polytope(); P
A 3-dimensional polyhedron in ZZ^4 defined as the convex hull of 12 vertices
sag... | |
<reponame>stormtheh4ck3r/python-for-android
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module contains tests for L{twisted.internet.task.Cooperator} and
related functionality.
"""
from twisted.internet import reactor, defer, task
from twisted.trial import unittest
cl... | |
# Copyright 2015, 2018 IBM Corp.
#
# 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 ... | |
# select colors
col = ''
if '5' in nm: col='orange'
if 'f_s001' in nm: col='black'
if nm == 'f_s1_neg': col='blue'
if nm == 'i_s1': col='red'
if nm == 'i_s01': col='green'
if '3' in nm: col = 'darkgreen'
if '7' in nm: col = 'darkorange'
if nm=='M0' or nm =='K0': col='black'
if nm=='M01_c' or nm=='K01_c': col=... | |
<filename>src/cuisine.py<gh_stars>0
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Project : Cuisine - Functions to write Fabric recipies
# -----------------------------------------------------------------------------
# Author : <NAME> <<EMAIL>>
# Author : <NAM... | |
_V: See the literature
"""
""" Initialize surrogate GP and related quantities, namely
_gp
_N, _Mx, _L,: GP training data dimensions N = dataset rows (datapoints), Mx = input columns, L = input columns
_lengthscale: ARD lengthscale vector
all of which are private and invariant.
"""
self._gp = gp
self._N, self... | |
in a 0. * `single-period` /
`climatology-period`: A single period of arbitrary length
:return: A data cube with the same dimensions. The dimension properties (name, type, labels, reference
system and resolution) remain unchanged.
"""
return anomaly(data=self, normals=normals, period=period)
def any(self, ignore... | |
<reponame>Hugo1991/TFM
import networkx as nx
import random as rnd
import matplotlib.pyplot as plt
import numpy as np
import multiprocessing as mp
from numpy import sqrt
from enum import Enum
class execution_type(Enum):
static_part1 = 0
static_part2 = 1
static = 2
dynamic = 3
class weight_edges(Enum):
linear = ... | |
2. * norm(c1 - c2)
return abs(volume)
#return volume4(n1, n2, n3, n4) + volume4(n2, n3, n4, n5) + volume4(n2, n4, n5, n6)
def raw_fields(self):
list_fields = ['CPENTA', self.eid, self.Pid()] + self.node_ids
return list_fields
@property
def node_ids(self):
nids = self._node_ids(nodes=self.nodes_ref, allow_empt... | |
time has passed
# since the last update.
time_since_stored = datetime.datetime.max - datetime.datetime.now()
counter_modify = 0
chat_request_action_on_receiver = None
if time_since_stored > datetime.timedelta(seconds = 1) or override_minimum_delay: # only process if X seconds have passed
# update the initiate_c... | |
== new_york_s.identifier
assert "7" == seven.subject.identifier
assert 100 == seven.weight
assert Subject.AGE_RANGE == seven.subject.type
from core.classifier import Classifier
classifier = Classifier.classifiers.get(seven.subject.type, None)
classifier.classify(seven.subject)
# If we import the same file aga... | |
<reponame>xpdAcq/pdffitx
import inspect
import math
import pathlib
import typing
import typing as tp
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
import tqdm.notebook as tqdm
import xarray as xr
from diffpy.srfit.fitbase import FitResults
from diffpy.srfit.fitbase.fitresult... | |
in schema and schema['default'] is not None:
print(wrapper.fill('Default: %s' % schema['default']))
print('')
@staticmethod
def _get_params_types(runner, action):
runner_params = runner.runner_parameters
action_params = action.parameters
parameters = copy.copy(runner_params)
parameters.update(copy.copy(action_... | |
from math import sin, cos, pi, sqrt, log
from numpy import log as clog
from numpy import exp as cexp
from numpy import ceil
# http://stackoverflow.com/questions/14132789/python-relative-imports-for-the-billionth-time
# Leaves me with only one choice ... :(
# Since I don't want to modify shell variables
import os, sys
... | |
<gh_stars>1000+
# ----------------------------------------------------------------------------
# - Open3D: www.open3d.org -
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, ... | |
4',
u'95tChNVzodY',
u'completing-the-square-4'),
(u'Quadratic Formula 1',
u'iulx0z1lz8M',
u'quadratic-formula-1'),
(u'Quadratic Formula 2',
u'CLrImGKeuEI',
u'quadratic-formula-2'),
(u'Quadratic Formula 3',
u'XUvKjC21fYU',
u'quadratic-formula-3'),
(u'Applying Quadratic Functions 1',
u'Zoa485PqK_M',
u'apply... | |
way works, but need more work
names = ['libswipl.dylib', 'libpl.dylib']
path = os.environ.get('SWI_HOME_DIR')
if path is None:
path = os.environ.get('SWI_LIB_DIR')
if path is None:
path = os.environ.get('PLBASE')
if path is None:
swi_ver = get_swi_ver()
path = '/Applications/SWI-Prolog.app/Contents/swipl-' + ... | |
Encoding.SIGNED]:
raise ValueError("{} is not a recognised encoding.".format(encoding))
self.encoding = encoding
if self.verbose:
print(f"\tHilbert encoding: {Encoding.BINARY}")
if self.verbose:
print(f"\tPreparing basis information", end="...")
if not make_basis:
raise NotImplementedError("_HilbertRestricte... | |
<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 4 18:23:35 2018
This script contains the core for the linear Kramer-Kronig analysis
@author: <NAME> (<EMAIL> / <EMAIL>)
"""
import numpy as np
from lmfit import minimize, Minimizer, Parameters, Parameter, report_fit
### Simulation F... | |
<reponame>dalessan/qm-bootloader
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of sou... | |
<reponame>amyhxqin/heartbit
# -*- coding: utf-8 -*-
"""Utilities for preprocessing sequence data.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import random
from six.moves import range
from . import get_keras_submodule
keras_utils... | |
y) <==> x[i:j]=y
Use of negative indices is not supported.
"""
pass
def __str__(*args, **kwargs):
"""
x.__str__() <==> str(x)
"""
pass
def append(*args, **kwargs):
"""
Add a value to the end of the array.
"""
pass
def clear(*args, **kwargs):
"""
Remove all elements from the array.
"... | |
keep = cepca_fft(OGD, OGB, xcoords, ycoords,
zcoords, cm, debug=0)
if debug==1:
print("Calculated Jbhelper and sbsbt with FFT.\n"
+ "Current Runtime: " + str(time.time() - starttime))
#set the values where we'd divide by zero to zero
sbsbt[:,:,rmv[0],rmv[1],rmv[2]]=0
#sbsbt[:,:,keep[0],keep[1],keep[2]]/=V... | |
<reponame>n644dc/spacewaveTx
# Version: 5.1
# Architecture: i386
import vstruct
from vstruct.primitives import *
DEVICE_RELATION_TYPE = v_enum()
DEVICE_RELATION_TYPE.BusRelations = 0
DEVICE_RELATION_TYPE.EjectionRelations = 1
DEVICE_RELATION_TYPE.PowerRelations = 2
DEVICE_RELATION_TYPE.RemovalRelations = 3
D... | |
<reponame>buildbuddy-io/rules_xcodeproj<gh_stars>10-100
"""Functions for creating `XcodeProjInfo` providers."""
load("@bazel_skylib//lib:paths.bzl", "paths")
load(
"@build_bazel_rules_apple//apple:providers.bzl",
"AppleBundleInfo",
"AppleResourceBundleInfo",
)
load("@build_bazel_rules_swift//swift:swift.bzl", "Swif... | |
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.257922,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 3.97331,
'S... | |
<reponame>FNNDSC/pl-fshack
#!/usr/bin/env python
#
# fshack DS ChRIS plugin app
#
# (c) 2016-2020 Fetal-Neonatal Neuroimaging & Developmental Science Center
# Boston Children's Hospital
#
# http://childrenshospital.org/FNNDSC/
# <EMAIL>
#
import os
import sys
import subprocess
import glob
sys.path.append(os.path.dir... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.