input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
+ '_sign_expl' + str(
sim_counter) + '.' + args.format)
fig, ax = plt.subplots(4, 4, figsize=(10, 5))
for i in range(0, 4):
for j in range(0, 4):
h, bins = np.histogram(minmax_expl[:, 4 * i + j], bins=15)
ax[i, j].bar(bins[:-1], h , width=0.05, color='b', alpha=0.6)
ax[i, j].spines['top'].set_color('none')
ax[... | |
<filename>code/ARAX/test/test_ARAX_resultify.py
#!/usr/bin/env python3
# Usage: python3 ARAX_resultify_testcases.py
# python3 ARAX_resultify_testcases.py test_issue692
import os
import sys
import pytest
sys.path.append(os.path.dirname(os.path.abspath(__file__))+"/../ARAXQuery")
from response import Response
from typi... | |
<reponame>SvobodaJakub/WoolnoteAndroid
# University of Illinois/NCSA Open Source License
# Copyright (c) 2018, <NAME>.
# TODO: docstring for the file
import os
import copy
import zipfile
from woolnote import config
from woolnote import util
from woolnote.task_store import Task, TaskStore, MARKUP, PLAIN
# UI backend
... | |
"CC_OXYGEN_SENSOR": {
"EPC_MEASURE_OXYGEN_CONCENTRATION_VALUE": "0xE0"
},
"CC_ILLUMINANCE_SENSOR": {
"EPC_MEASURE_ILLUMINANCE_LUX_VALUE": "0xE0",
"EPC_MEASURE_ILLUMINANCE_KILOLUX_VALUE": "0xE1"
},
"CC_SOUND_SENSOR": {
"EPC_DETECTION_THRESHOLD_LEVEL": "0xB0",
"EPC_SOUND_DETECTION_STATUS": "0xB1",
"EPC_SOUND_DET... | |
<gh_stars>1-10
#Standard python libraries
import numpy as np
import os
import itertools
from scipy.sparse import csr_matrix, kron, identity
from .eigen_generator import EigenGenerator
class CalculateCartesianDipoleOperatorLowMemory(EigenGenerator):
"""This class calculates the dipole operator in the eigenbasis of
t... | |
- 'prev', 'next' as count
# - Sequence-Negation option
all = self.listmessages()
# Observed behavior: test for empty folder is done first
if not all:
raise Error, "no messages in %s" % self.name
# Common case first: all is frequently the default
if seq == 'all':
return all
# Test for X:Y before X-Y because 'se... | |
#!/usr/bin/env python
#pylint: skip-file
# This source code is licensed under the Apache license found in the
# LICENSE file in the root directory of this project.
import sys
import os
import urllib.request, urllib.parse, urllib.error
from .models import *
class GroupApi(object):
def __init__(self, apiClient):
... | |
.. seealso:: `flatten`, `insert_dimension`, `transpose`
:Parameters:
axes: (sequence of) `int`, optional
The positions of the size one axes to be removed. By
default all size one axes are removed.
{{axes int examples}}
inplace: `bool`, optional
If True then do the operation in-place and return `None`.
:Ret... | |
<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, timeit
import numpy as np
import matplotlib.pyplot as plt
from bmpProcessing.utils.Utils import get_int_from_bytes
class BmpProcessing:
'''
Implementation of an BMP format image
'''
def __init__(self, img, verbose):
'''
Initialisation BmpPr... | |
{}
header_parameters['Content-Type'] = 'application/json-patch+json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)
# Construct body
body_content = self._serialize.body(request, 'HistoryReadNextRequestApiModel')
# Construct and send request
request = self._client.post(url, query_par... | |
dictionaryCreationThreshold: int)
"""
pass
def __reduce_ex__(self, *args): #cannot find CLR method
pass
def __setitem__(self, *args): #cannot find CLR method
""" x.__setitem__(i, y) <==> x[i]= """
pass
Comparer = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
... | |
import sys
import os
import unittest
import shutil
import copy
from io import StringIO
sys.path.append(".")
from mock_gff3 import Create_generator
from mock_helper import import_data, gen_file
import annogesiclib.sORF_detection as sd
from mock_args_container import MockClass
get_coverage = copy.deepcopy(sd.get_covera... | |
postcode.
'''
return (elem.attrib['k'] == 'addr:postcode')
def audit(self, audit_file):
'''
Iterates over XML tag elements in order to find all of the addresses
of type street.
Evaluates the tag 'v' attributes to determine if the street suffixes
are within the expected street suffix list.
@return: Defau... | |
#MenuTitle: Vertical Metrics Manager
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
try:
from builtins import str
except Exception as e:
print("Warning: 'future' module not installed. Run 'sudo pip install future' in Terminal.")
__doc__="""
Manage and sync ascender, descende... | |
self.c.close()
def testPutline(self):
putline = self.c.putline
query = self.c.query
data = list(enumerate("apple pear plum cherry banana".split()))
query("copy test from stdin")
try:
for i, v in data:
putline("%d\t%s\n" % (i, v))
putline("\\.\n")
finally:
self.c.endcopy()
r = query("select * from test").ge... | |
<reponame>baitsanape/saleor
import graphene
from saleor.app.error_codes import AppErrorCode
from saleor.app.models import App, AppToken
from saleor.graphql.core.enums import PermissionEnum
from .utils import assert_no_permission, get_graphql_content
APP_CREATE_MUTATION = """
mutation AppCreate(
$name: String, $is_... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Mapping reads to reference genome
1. to spike-in genome
2. to repbase
3. to rRNA, tRNA, MT
4. to genome
Note:
1. filtering unique mapped reads
STAR --outFilterMultimapNmax 1
"""
__author__ = "<NAME> <<EMAIL>>"
__copyright__ = "2018 by <NAME> <<EMAIL>>"
__license__ =... | |
# -*- coding: utf-8 -*-
import os
import json
import tccli.options_define as OptionsDefine
import tccli.format_output as FormatOutput
from tccli import __version__
from tccli.utils import Utils
from tccli.exceptions import ConfigurationError
from tencentcloud.common import credential
from tencentcloud.common.profile.ht... | |
"NeckChamferOffset": 0.0000000000,
"Orientation": "NormalToPlacementPlane",
"Size": "1/2",
"Standard": "ANSI Inch - PT",
"StartChamferAngle": 45.0000000000,
"StartChamferOffset": 0.0300000000,
"Start_Taper_Location": "TaperDimAtBottom",
"Subtype": "General Screw Clearance",
"Taper_Angle_L_Value": 12.0000000000,... | |
3:
for unused_repeatCounter in range(repeatTimes):
self.addSignatures(symbols['repeat'])
elif repeatTimes >= 3: # 17.3 -- repeat plus number.
self.addSignatures(symbols['repeat'] + basic.numberToBraille(repeatTimes))
# noinspection PyAttributeOutsideInit
self.lastNote = None # this is set up to force an octave sy... | |
Note that for HTTP health checks, a single 503 immediately makes endpoint unhealthy.
"""
return pulumi.get(self, "unhealthy_threshold")
@unhealthy_threshold.setter
def unhealthy_threshold(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "unhealthy_threshold", value)
@pulumi.input_type
class AlbBacken... | |
settings, the " + \
"requested trigger period must be increased to " + \
str(requested_trigger_period - internal_delay_period) + \
" s minimum. Should the settings change, this minimum "+ \
"value may increase. It is thus good practice to add " + \
"some additional time to the updated value.")
elif self.... | |
<gh_stars>0
#!/usr/bin/env python
"""
Grapical User Interface for inspecting images.
Author: <NAME>, 16 Jan 2009 - 29 Jun 2017
"""
import wx
from math import sqrt,atan2,sin,cos,pi,log10
from numpy import *
__version__ = "4.2.2" # show_image
class ImageViewer_Window (wx.Frame):
image_timestamp = 0
def __init__(se... | |
import scipy as sp
import scipy.ndimage as spim
import scipy.sparse as sprs
import warnings
import porespy as ps
from scipy.sparse import csgraph
from openpnm.utils import PrintableDict, logging, Workspace
ws = Workspace()
logger = logging.getLogger(__name__)
def find_neighbor_sites(sites, am, flatten=True, include_i... | |
<gh_stars>10-100
# Copyright 2022 Amazon.com, Inc. or its affiliates. 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
#
# U... | |
import numpy as np
from dlbeamformer_utilities import compute_mvdr_tf_beamformers, check_distortless_constraint, compute_steering_vectors,\
compute_null_controlling_tf_beamformers, compute_null_controlling_minibatch_tf_beamformers,\
compute_null_controlling_tf_beamformers_2
from tqdm import tnrange, tqdm
from sklearn.l... | |
Constraint(expr=m.x126*m.x2512 + m.x751*m.x2518 + m.x1376*m.x2524 + m.x2001*m.x2530 <= 8)
m.c145 = Constraint(expr=m.x127*m.x2512 + m.x752*m.x2518 + m.x1377*m.x2524 + m.x2002*m.x2530 <= 8)
m.c146 = Constraint(expr=m.x128*m.x2512 + m.x753*m.x2518 + m.x1378*m.x2524 + m.x2003*m.x2530 <= 8)
m.c147 = Constraint(expr=m.x1... | |
accelerator_types=[
cloud_tpu.AcceleratorType(),
cloud_tpu.AcceleratorType(),
cloud_tpu.AcceleratorType(),
],
next_page_token="abc",
),
cloud_tpu.ListAcceleratorTypesResponse(
accelerator_types=[], next_page_token="def",
),
cloud_tpu.ListAcceleratorTypesResponse(
accelerator_types=[cloud_tpu.AcceleratorType(... | |
import math
import gym
import numpy as np
from PIL import Image
from gym.utils import seeding
from guidance_flight_env.pid.pid_controller import PidController
from guidance_flight_env.services.map_plotter_old import MapPlotter
from guidance_flight_env.simulation_old import Simulation
from guidance_flight_env.utils impo... | |
If :attr:``df`` is available, it will be used to sum values
from labels in ``label_ids`` found in the data frame
rather than re-measuring values from images.
Args:
label_ids: Integer of the label or sequence of multiple labels
in :attr:``labels_img_np`` for which to measure variation.
Returns:
Tuple of the ... | |
})
))
class TestITrueDivide(
math_utils.InplaceBinaryMathTestBase, op_utils.NumpyOpTest):
skip_backward_test = True
skip_double_backward_test = True
def generate_inputs(self):
a, b = super().generate_inputs()
if self.input_lhs == 'random':
with math_utils.IgnoreNumpyFloatingPointError():
b[numpy.logical_and(-... | |
self._typed_ops[type_]
del self.types[type_]
def __contains__(self, type_):
type_ = _normalize_type(type_)
return type_ in self._typed_ops
@classmethod
def _remove_nesting(cls, funcname, *, module=None, modname=None, strict=True):
if module is None:
module = cls._module
if modname is None:
modname = cls._mo... | |
<filename>acsm/utils/bird_vis.py
"""
Code borrowed from
https://github.com/akanazawa/cmr/blob/master/utils/bird_vis.py
Visualization helpers specific to birds.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
from torch.autograd import Vari... | |
out["energy_total"]
scc.energy_total = out["energy_total"]
forces = out["forces"]
if forces is not None:
scc.atom_forces = forces[:, 2:].astype(float) * ureg.hartree / ureg.bohr
scc.single_configuration_calculation_to_system_ref = system
scc.single_configuration_to_calculation_method_ref = method
# Band structu... | |
return val == 'no', None
Restriction = namedtuple('Restriction', 'kind parse')
restrictions = {
'maxwidth': Restriction('width', _metres),
'maxlength': Restriction('length', _metres),
'maxheight': Restriction('height', _metres),
'maxweight': Restriction('weight', _tonnes),
'maxaxleload': Restriction('wpa', _to... | |
<filename>ansys/dpf/core/server.py
"""
Server
======
Contains the directives necessary to start the DPF server.
"""
from threading import Thread
import io
import platform
import logging
import time
import os
import socket
import subprocess
import grpc
import psutil
import weakref
import atexit
import copy
from ansys i... | |
import numpy as np
from numpy.linalg import norm
from functools import lru_cache
from tqdm import tqdm
from scipy.optimize import linprog
from sklearn.metrics import accuracy_score, f1_score
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams.update({'errorbar.capsize': 2})
def sq(a):
return np.dot... | |
<filename>code/python/Vermilion/v1/fds/sdk/Vermilion/api/report_instance_api.py
"""
VRS API documentation
Documentation on all available end points in the VRSAPI # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
... | |
#!/bin/env python3
# Compress binary data with RLE-like format
import argparse
import os
import sys
def array2data(arr):
formatted_output = ""
counter = 0
for a in arr:
if counter == 0:
formatted_output += "\n\t"
formatted_output += "{0}, ".format(a)
counter = (counter + 1) % 16
return formatted_output[1:] + "... | |
see if IP is in a network, but /32 can be used in network.overlaps() method to accomplish the same thing
if isinstance(network, ipaddress.IPv4Network):
iptype = 4
else:
iptype = 6
import codecs
# func to highlight matches on screen
def findmatch(o, network, ippath):
global iptype
if isinstance(ippath[o], list)... | |
eine Zeile
nr += 1
aus.write(str(nr).rjust(i1)) # 1. Item
aus.write(str(neu3_gh[z][0]).rjust(i2))# 2. Item
aus.write(str(neu3_gh[z][1]).rjust(i3))# 3. Item
zwi3 = neu3_gh[z][1]
if zwi3 > gesmodus[1]:
gesmodus = (neu3_gh[z][0], zwi3)
gessumme += zwi3
aus.write(str(neu3_gh[z][2]).rjust(i4))# 4. Item
for f i... | |
"""Imagniary time analytic continuation kernel routines."""
"""
Copyright 2021 <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 ... | |
virtual machine "
"{0}".format(label))
# Check state.
self._wait_status(label, self.RUNNING)
def stop(self, label):
"""Stops a virtual machine. Kill them all.
@param label: virtual machine name.
@raise CuckooMachineError: if unable to stop virtual machine.
"""
log.debug("Stopping machine %s", label)
if sel... | |
OoOoOO00 / oO0o / Ii1I * ooOoO0o
if 51 - 51: oO0o
if 34 - 34: OoOoOO00 . i11iIiiIii * OOooOOo . ooOoO0o * O0 * OoO0O00
if 27 - 27: Ii1I . o0oOOo0O0Ooo - OoOoOO00 . II111iiii % Oo0Ooo
if 83 - 83: I11i + oO0o - iIii1I11I1II1 + II111iiii . iII111i
oOO0 = 56 if ( self . outer_version == 6 ) else 36
IiI11II = IIii1i [... | |
threat_weight = getThreatWeight()
bobot_aset = getBobotAssets()
data_app_threat = getAppThreat()
data_vulnerability_avg = getVulnerabilityAVG()
data_hitung_avg = hitungAVG(data_vulnerability_avg)
data_app_threat_vulnerability = hitungVulnerability(data_app_threat, data_hitung_avg)
data_threat = getThreat()
nila... | |
import json
import math as m
from abc import ABC, abstractmethod
try:
from webots.controller import Robot
except Exception:
Robot = object
TIME_STEP = 32
MAX_WHEEL_SPEED = 15.0
WHEEL_SPEED = {
'max': MAX_WHEEL_SPEED,
'half': MAX_WHEEL_SPEED / 2.0,
'quarter': MAX_WHEEL_SPEED / 4.0,
'eigth': MAX_WHEEL_SPEED / 8.0,... | |
frame of data, such as on reloading the state vector
assert (self._gen_index == 0
and self._update_index == 0
and self._thin_index == 0)
assert (self.generation == self.Ngen
and self._update_count == self.Nupdate
and self._thin_count == self.Nthin)
self.thinning = thinning
if Ngen > self.Ngen:
self._gen_inde... | |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | |
<filename>pyrobolearn/utils/converter.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Provide converter classes which allows to convert from one certain data type to another.
"""
from abc import ABCMeta, abstractmethod
import numpy as np
import torch
import quaternion
import collections
__copyright__ = "Copyright... | |
!= len(eids):
msg = 'eids=%s len(eids)=%s delta_eid=%s must be continuous' % (
eids, len(eids), delta_eid)
raise RuntimeError(msg)
#list_fields += eids
list_fields += [eids[0], 'THRU', eids[-1]]
return list_fields
def repr_fields(self):
return self.raw_fields()
def write_card(self, size: int=8, is_double: bo... | |
<gh_stars>10-100
"""
This module contains the classes :class:`hyvr.input.option_parsing.Section` and
:class:`hyvr.input.option_parsing.Option` to simplify parsing and validating
input-files (``*.ini``).
Every HyVR option should have a corresponding instance of an
:class:`~hyvr.input.option_parsing.Option`, which is de... | |
other._succ)
def __ne__(self, other):
r"""
Tests difference.
TEST::
sage: iet.RauzyDiagram('a b','b a') != iet.RauzyDiagram('a b c','c b a')
True
sage: r = iet.RauzyDiagram('a b c','c b a')
sage: r1 = iet.RauzyDiagram('a c b','c b a', alphabet='abc')
sage: r2 = iet.RauzyDiagram('a b c','c a b', alphabet='a... | |
thetas
theta_cand = cov_theta_cand.gen_cand(theta, m)
for i in range(setup.nexp):
# Find new candidate values for theta
theta_eval_mat[i][:] = theta[i][m-1].reshape(setup.ntemps * setup.ntheta[i], setup.p)
#theta_cand[i][:] = chol_sample_1per(theta[i][m-1], S[i])
theta_cand_mat[i][:] = theta_cand[i].reshape(set... | |
#!/usr/bin/env python
#
# Copyright 2016 - The Android Open Source 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | |
out
def _reencode(self, items):
"""Erase & rebuild the OSCMessage contents from the given
list of (typehint, value) tuples"""
self.clearData()
for item in items:
self.append(item[1], item[0])
def values(self):
"""Returns a list of the arguments appended so far
"""
return decodeOSC(self.getBinary... | |
- mu ** 2) # use simple trig identity
# Sort the projected radii and corresponding intensity spectra into ascending
# order (i.e. from disk center to the limb), which is equivalent to sorting
# MU in descending order.
isort = np.argsort(rmu)
rmu = rmu[isort] # reorder projected radii
nmu = np.size(mu) # number o... | |
#!/bin/python3
#*##############################| OREGON TRAIL by KLUTCH |################################
#?################################## DEVELOPMENT LIST ####################################
### TODO:
# Difficulty setting
## Easy, Normal, Hard
## Adjust modifiers and starting values for each difficulty level
... | |
with value 7.
"""
assert_bindings(
schema="nistData/list/ID/Schema+Instance/NISTSchema-SV-IV-list-ID-minLength-3.xsd",
instance="nistData/list/ID/Schema+Instance/NISTXML-SV-IV-list-ID-minLength-3-4.xml",
class_name="Out",
version="1.1",
mode=mode,
save_output=save_output,
output_format=output_format,
structur... | |
<gh_stars>10-100
import numpy as np
import pandas as pd
import torch
import torch.utils.data
import torchvision
import os.path
import time
import PIL
import matplotlib.pyplot as plt
import copy
# import skimage
# import skimage.io
MEAN = [0.485, 0.456, 0.406] # expected by pretrained resnet18
STD = [0.229, 0.224, 0.... | |
m.b1007
<= 0.690184503917672)
m.e1050 = Constraint(expr= m.x804 + 0.690184503917672 * m.b1008
<= 0.690184503917672)
m.e1051 = Constraint(expr= m.x865 - 0.367386387824208 * m.b1006 <= 0)
m.e1052 = Constraint(expr= m.x866 - 0.367386387824208 * m.b1007 <= 0)
m.e1053 = Constraint(expr= m.x867 - 0.367386387824208 * m.b100... | |
<reponame>linuxaddict89/luminos
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2019 <NAME> (The Compiler) <<EMAIL>>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#... | |
'lines': Id,
'branch': Branch,
'dcache': DcacheAccess,
'counts': Counts
}
indexed_decoder_element_classes = {
'indexedCounts' : Counts
}
def find_colour_decoder(stripSpace, decoderName, dataName, picPairs):
"""Make a colour decoder from some picture file blob attributes"""
if decoderName == 'frame':
return F... | |
#! /usr/local/bin/python
import sys
from numpy import *
import numpy.linalg as LA
from decimal import *
from copy import deepcopy
from itertools import permutations
from ClassesFunctions import *
# S.J. 07/09/2018 - changes to use the functions defined in ClassesFunctions file to avoid redundancy
vertexOrd... | |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THI... | |
<filename>results/display_results.py<gh_stars>1-10
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import sys
sys.path.append('..')
sys.path.append(... | |
31), inst.date_de)
self.assertEqual(None, inst.date_en)
inst.date = datetime.date(1999, 1, 1)
inst.save()
self.assertEqual(datetime.date(1999, 1, 1), inst.date)
self.assertEqual(datetime.date(1999, 1, 1), inst.date_de)
self.assertEqual(None, inst.date_en)
qs = models.OtherFieldsModel.objects.filter(date='1999-... | |
just the sequence of past states of length delay + sequence_length + 1.
action : single action dependent on action space
Action magnitudes are penalised immediately in the case of continuous spaces and, in effect, play no role for discrete spaces as the reward in that case only depends on sequences of states. We say ... | |
* nbar + 1) * hbar / 2
res1 = symplectic.reduced_state(mu, cov, 1)
assert np.allclose(res0[0], expected0[0], atol=tol, rtol=0)
assert np.allclose(res0[1], expected0[1], atol=tol, rtol=0)
assert np.allclose(res1[0], expected1[0], atol=tol, rtol=0)
assert np.allclose(res1[1], expected1[1], atol=tol, rtol=0)
def ... | |
= None
try:
mgr = MockMgr()
config_template = Template('/tmp/config.$pid')
config_file = config_template.substitute(pid=os.getpid())
handler = bigipconfigdriver.ConfigHandler(config_file, mgr, 30)
obj = {"global": {"log-level": 55, "verify-interval": 100}}
with open(config_file, 'w+') as f:
def fin():
os.un... | |
<gh_stars>1-10
"""
Copyright (C) 2016-2019 <NAME>
Licensed under Illinois Open Source License (see the file LICENSE). For more information
about the license, see http://otm.illinois.edu/disclose-protect/illinois-open-source-license.
Contain optimization benchmark problems.
"""
import numpy as np
from .problem import ... | |
"""
batch_propagation_results.py
"""
import enum
import io
import json
import time
import urllib
from typing import List, Optional, Dict
import numpy as np
import pandas as pd
import requests
from dateutil import parser as dateparser
from adam import stk, ApsRestServiceResultsProcessor, AuthenticatingRestProxy, Rest... | |
# Copyright 2017 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 applicable ... | |
scene list.
merge_lists(source.chapters[chId].srtScenes, self.chapters[chId].srtScenes)
#--- Merge project attributes.
if source.title:
# avoids deleting the title, if it is empty by accident
self.title = source.title
if source.desc is not None:
self.desc = source.desc
if source.authorName is not None... | |
if(stride_size.is_integer() and stride_size > 0):
padding_size = p
padding_depth = padding_size
stride_depth = stride_size
find = True
break
else:
kernel_size = self.prob_random([1,2,3,4,5,6,7],[1/7 for i in range(7)])
kernel_size_depth = kernel_size
# print(in_channels,'in_channels')
return [int(i) for i i... | |
@type {number} */
var fixedDim = (horz ? height : width) / valueLength;
if (horz) {
if (value.x < x || (value.x > x + width || (value.y > y + height || value.y < y))) {
return false;
}
} else {
if (value.x < x || (value.x > x + width || (value.y > y || value.y < y - height))) {
return false;
}
}
/** @type {n... | |
<filename>xbout/tests/test_load.py
from pathlib import Path
import re
import pytest
import numpy as np
from xarray import DataArray, Dataset, concat
from xarray.tests.test_dataset import create_test_data
import xarray.testing as xrt
from natsort import natsorted
from xbout.load import (_check_filetype, _expand_wil... | |
<filename>trainer.py
from __future__ import print_function
from six.moves import range
import torch.backends.cudnn as cudnn
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
import torchvision.utils as vutils
import numpy as np
import os
import time
from PIL import Imag... | |
row_start
if isinstance(key[1], int):
st1 = col_inds[key[1]] - col_start
sp1 = col_inds[key[1] + 1] - col_start
elif isinstance(key[1], slice):
start = col_inds[key[1].start] if key[1].start is not None else 0
stop = col_inds[key[1].stop] if key[1].stop is not None else col_inds[-1]
st1, sp1 = start - col_start,... | |
<gh_stars>1-10
from __future__ import print_function
__author__ = 'jeremy'
import sys
import os
import cv2
import logging
import time
logging.basicConfig(level=logging.INFO) #debug is actually lower than info: critical/error/warning/info/debug
import shutil
# So this file can be imported on servers where joblib is no... | |
<gh_stars>0
#!/usr/bin/python3
"""
http://gitlab.naktuinbouw.net/bioinformatics/gt-seq/issues/18
adding a Sam RG tag to each read containing the flowcell ID, flowcell lane and Sample ID
`RG:Z:C5M8DANXX_3_Mini_Stars_2`
Input is
1: fastq file coming from a GT_seq run
2: xlsx file with barcodes and correspon... | |
0, imh - h))
# insert the crop into src.data[0]
src.data[0].copy_(torch.Tensor(image[:, ox:ox + w, oy:oy + h]))
else:
ox = int((imw - w) / 2)
oy = int((imh - h) / 2)
src.data[0].copy_(torch.Tensor(image[:, ox:ox + w, oy:oy + h]))
else:
ox = 0
oy = 0
src.data[0].copy_(torch.Tensor(image))
sigma = o['start_si... | |
#8683 in Alexa global
'http://www.record.com.mx/',
# Why: #8684 in Alexa global
'http://www.121ware.com/',
# Why: #8685 in Alexa global
'http://www.inkfrog.com/',
# Why: #8686 in Alexa global
'http://cnstock.com/',
# Why: #8687 in Alexa global
'http://www.marineaquariumfree.com/',
# Why: #8688 in Alexa global... | |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/charts/piecharts.py
# experimental pie chart script. Two types of pie - one is a monolithic
#widget with all top-level properties, the oth... | |
matrices
run_test(3, 2, 2)
run_test(3, 3, 3)
run_test(3, 4, 4)
run_test(3, 5, 5)
# large batch of matrices
run_test(3, 3, 2, 2)
run_test(3, 3, 3, 3)
run_test(3, 3, 4, 4)
run_test(3, 3, 5, 5)
@skipCUDAIfNoMagma
@skipCPUIfNoLapack
@dtypes(*floating_and_complex_types())
@precisionOverride({torch.float32: 1e... | |
cons2,
cons3,
cons8,
cons682,
cons228,
cons150,
cons20,
cons697,
)
rule1148 = ReplacementRule(pattern1148, replacement1148)
pattern1149 = Pattern(
Integral(
(x_ * WC("d", S(1))) ** m_
/ (a_ + x_ ** n_ * WC("b", S(1)) + x_ ** WC("n2", S(1)) * WC("c", S(1))),
x_,
),
cons2,
cons3,
cons8,
cons29,
cons6... | |
data_frame if header.find(" Value ") >= 0
]
# Removes the columns for properties which are not of interest.
for header in property_headers:
property_type = header.split(" ")[0]
if property_type in schema.property_types:
continue
data_frame = data_frame.drop(header, axis=1)
uncertainty_header = header.repla... | |
<gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright SAS Institute
#
# 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 requ... | |
showdate = False, prefix = '', suffix = ''):
return plog('<I> ', msg, showtime, showdate, prefix, suffix, TermColor.Green)
def pdbg(msg, showtime = True, showdate = False, prefix = '', suffix = ''):
return plog('<D> ', msg, showtime, showdate, prefix, suffix, TermColor.Cyan)
def askc(msg, enter = True):
pr(msg)
i... | |
"""
Definitions:
A Python module is a Python file ending in .py, which is imported into another script to be used there.
These are used to bring in functions, classes, etc. that are in the module. This allows for organizing of classes
and functions into files, and then used in your main script. Note that if you do this... | |
<reponame>seckcoder/lang-learn
# -*- coding: utf-8 -*-
"""
The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These
are supervised learning methods based on applying Bayes' theorem with strong
(naive) feature independence assumptions.
"""
# Author: <NAME> <<EMAIL>>
# Minor fixes by <NAME>
# <NAM... | |
<reponame>jd-jones/seqtools<gh_stars>1-10
import torch
from mathtools import utils
def log_prob(data_scores, y, max_segs, pw=None):
# Scores has shape (num_segs, num_samples, num_classes),
# so marginalizing over number of segments and number of classes at the last
# frame should give us the data likelihood... I ... | |
<reponame>yuzeming/angr-management<filename>angrmanagement/ui/widgets/qoperand.py<gh_stars>1-10
from typing import Optional
import logging
from PySide2.QtWidgets import QApplication, QGraphicsSimpleTextItem
from PySide2.QtCore import Qt, QRectF, QPointF
from angr.analyses.disassembly import ConstantOperand, RegisterO... | |
<filename>test/test_nnapi.py
#!/usr/bin/env python3
# Owner(s): ["oncall: mobile"]
import os
import ctypes
import torch
from typing import Tuple
from torch.backends._nnapi.prepare import convert_model_to_nnapi
from torch.testing._internal.common_utils import TestCase, run_tests
def qpt(t, scale, zero_point, dtype=to... | |
<filename>google/appengine/ext/analytics/stats.py
#!/usr/bin/env python
#
# Copyright 2007 Google 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/LICEN... | |
<gh_stars>1-10
'''
Created on Dec 20, 2010
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
import math, re, sre_constants
from arelle.ModelObject import ModelObject, ModelAttribute
from arelle.ModelValue import (qname, dateTime, DateTime, DATE, DATETIME, dayTimeDurat... | |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from zzz_cognition_msgs/RoadObstacle.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import zzz_driver_msgs.msg
import zzz_perception_msgs.msg
import geometry_msgs.msg
cl... | |
# https://github.com/kusaanko/Blender_XFileSupport_BVE
#
# Copyright (c) 2021 kusaanko
# This is licensed under the Apache License 2.0
# see https://github.com/kusaanko/Blender_XFileSupport_BVE/blob/main/LICENSE
import os
import re
import bpy
from bpy.props import StringProperty, BoolProperty, FloatProperty, EnumPrope... | |
# Copyright 2017 The Bazel 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 o... | |
this
variable from initial population generation) is the new Tree to be insertd into 'tree', replacing 'branch'.
The end result is a Tree with a mutated branch. Pretty cool, huh?
Called by: fx_evolve_grow_mutate, fx_evolve_grow_crossover
Arguments required: tree, branch
'''
# *_branch_top_copy... | |
grid components X and Y must either have the
same shape as Z or fulfill the requirement len(X)==n and len(Y)==m,
where m,n=shape(Z). The color is determined by the array C which must
have the same shape as Z. If the color array C is not given, Z is used
as the color array (i.e., C=Z).
Calling::
mesh(Z[, C])
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.