input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<reponame>MWATelescope/eda1
#!/usr/bin/env python
"""
Runs on the Raspberry Pi connected to the Kaelus beamformer via USB, to send pointing commands, etc.
"""
import os
import logging
from logging import handlers
import random
import sys
import time
import astropy
import astropy.time
import astropy.units
from astrop... | |
dest1d_min) / 2
mean_src_y = (src1d_max + src1d_min) / 2
# Tx = (dest1d_max + dest1d_min)/2 - (src1d_max + src1d_min)/2
Sy = (dest1d_max - dest1d_min + 1) / float(src1d_max - src1d_min + 1)
# apply forward transformation (in pixel space)
# below: only for debugging purpose
# coord_src2d_scaleX = np.copy(coord_src... | |
'''
This class implements a 3D FCN for the task of generating CT from MRI
By <NAME> and <NAME>
Oct., 2016
'''
from __future__ import division
import os
import time
from glob import glob
import tensorflow as tf
import numpy as np
from six.moves import xrange
from utils import *
from loss_functions import *
from scip... | |
= []
for i, (model_group, models_g) in enumerate(model_struct.items()):
logging.info(
f"-- Group {i} ({model_group}) out of {len(model_struct)}")
# Take metadata information about the group from the group name
groups.append(model_group)
metadata_i = model_group.split('_')
n_topics.append(metadata_i[2])
alpha... | |
from __future__ import division
import tensorflow as tf
import numpy as np
import os
import matplotlib.pyplot as mp
from .ops import *
from .util import *
from progressbar import ETA, Bar, Percentage, ProgressBar
class STGConvnet(object):
def __init__(self, sess, config):
self.sess = sess
self.net_t... | |
#!BPY
"""
Name: 'TikZ (.tex)...'
Blender: 245
Group: 'Export'
Tooltip: 'Export selected curves as TikZ paths for use with (La)TeX'
"""
__author__ = '<NAME>'
__version__ = "1.0"
__url__ = ("Documentation, http://www.fauskes.net/code/blend2tikz/documentation/",
"Author's homepage, http://www.fauskes.net/",
"TikZ examp... | |
doesn't hang things up later...
del self.callback_event
self.callback_stop = True
self.notify_event.set()
ct.join()
class VirtualTimeBase(object):
"""Tests for virtual time functions when virtualtime is enabled"""
def test_datetime_init(self):
"""tests the basic instantiation of datetime objects."""
datetime.d... | |
<gh_stars>1-10
from copy import deepcopy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn.bricks import (NORM_LAYERS, PLUGIN_LAYERS, ConvModule,
build_activation_layer, build_norm_layer,
build_upsample_layer)
from mmcv.cnn.utils import normal_init
from torch.nn.init... | |
<filename>script-InvestmentFundamentalsAndDataAnalytics.py
# one stock -> simple return is common but not for many
# $$
# \frac{P_1 - P_0}{P_0} = \frac{P_1}{P_0} - 1
# $$
import numpy as np
import pandas as pd
from pandas_datareader import data as wb
import matplotlib.pyplot as plt
'''from AssetTypes.BaseAsset import B... | |
<filename>Arkanoid.py
#!/usr/bin/python3.9
# Setup Python ----------------------------------------------- #
import sys
import os
import pygame
from random import randrange as rnd
import time
import threading
from threading import Timer
import pyperclip
import twitch_bot
import Audio_assistant as aa
import webbrowser
... | |
<gh_stars>1-10
#!/usr/bin/env python
# Stock Python modules.
import os
import os.path
import shutil
import sys
import tempfile
# cdf extension modules.
from .. import interface as cdf
from .. import internal
from .. import typing
###
# TODO: The complex interactions of the various strategies are not well
# documente... | |
<filename>bayesalpha/dists.py<gh_stars>10-100
import theano.tensor as tt
import theano
import theano.tensor.extra_ops
import theano.sparse
import theano.scalar
import pymc3 as pm
import numpy as np
from scipy import sparse, interpolate
from pymc3.distributions.distribution import draw_values
from pymc3.distributions.di... | |
<gh_stars>1000+
# Copyright 2021 DeepMind Technologies Limited. 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 ... | |
city, New Mexico",2539),
("Los Alamos CDP, New Mexico",12373),
("Los Cerrillos CDP, New Mexico",260),
("Los Chaves CDP, New Mexico",5890),
("Los Luceros CDP, New Mexico",483),
("Los Lunas village, New Mexico",15428),
("Los Ojos CDP, New Mexico",52),
("Los Ranchos de Albuquerque village, New Mexico",6131),
("Loving vill... | |
auto_download=auto_download,
),
WikidatedV1_0EntityStreamsFile(
archive_path=dataset_dir / (prefix + "p36039269-p36053267.7z"),
page_ids=range(36039269, 36053268),
darus_id=93466,
sha1="4a65b307703e63be8947a07ec6e2792325c31e7e",
size=68744982,
auto_download=auto_download,
),
WikidatedV1_0EntityStreamsFile(
a... | |
<filename>Week 3 PA 1 Your first CNN on CIFAR-10/week3_task1_first_cnn_cifar10_clean.py
# coding: utf-8
# # Your first CNN on CIFAR-10
#
# In this task you will:
# * define your first CNN architecture for CIFAR-10 dataset
# * train it from scratch
# * visualize learnt filters
#
# CIFAR-10 dataset contains 32x32 co... | |
<reponame>tweak-com-public/tweak-api-client-python
# coding: utf-8
"""
tweak-api
Tweak API to integrate with all the Tweak services. You can find out more about Tweak at <a href='https://www.tweak.com'>https://www.tweak.com</a>, #tweak.
OpenAPI spec version: 1.0.8-beta.0
Generated by: https://github.com/swagge... | |
<gh_stars>1-10
# -*- coding: utf-8 -*-
import datetime
from .client import ETGClient
from .models import (
GuestData,
)
class ETGHotelsClient(ETGClient):
def autocomplete(self, query,
language=None):
"""Finds regions and hotels by a part of their names.
:param query: part of hotel or region name.
:type query:... | |
based on `K.learning_phase`.
"""
return in_train_phase(alt, x, training=training)
# NN OPERATIONS
def _assert_has_capability(module, func):
if not hasattr(module, func):
raise EnvironmentError(
'It looks like like your version of '
'Theano is out of date. '
'Install the latest version with:\n'
'pip install g... | |
<filename>tellet/handlers.py
import tornado.web
import json
import difflib
import pandas as pd
from datetime import datetime
import os.path as op
class BaseHandler(tornado.web.RequestHandler):
def get_current_user(self):
return self.get_secure_cookie("user")
def set_current_user(self, user):
if user:
self.set_s... | |
<reponame>huaxz1986/lingvo
# Lint as: python3
# Copyright 2021 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/... | |
# FST functionality tests
# Copyright (c) 2015, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import struct
import subprocess
import time
import os
import re
import hwsim_utils
from hwsim impor... | |
child_node_set
# #print "parent_loop", parent_loop, "parent", node.parent
# if (parent_loop is not None and
# not parent_loop.loop_variant_set.intersection(child_node_set)):
# #print "pull up loop invariant", assign_alias
# parent_loop.parent.insert_before(parent_loop, assign_alias)
# else:
# insert_block, insert_marke... | |
<reponame>MichaelHopwood/HopML
# Source
import itertools
from sklearn.linear_model import LinearRegression, RANSACRegressor
import numpy as np
from sklearn.metrics import mean_squared_error, r2_score
import pandas as pd
from scipy import stats
from statsmodels.stats.outliers_influence import variance_inflation_factor
i... | |
from typing import Dict, Iterator, Optional, Tuple, Union
import enum
import pathlib
import time
import warnings
from ctypes import CDLL, c_int
from wyzecam.api_models import WyzeAccount, WyzeCamera
try:
import av
import av.video.frame
except ImportError:
av = None
try:
import cv2
except ImportError:
cv2 = Non... | |
11.0 * 10 ** (-0.4 * (25 - 23.9)))
def test_token_user_cannot_update_unowned_photometry(
upload_data_token, manage_sources_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux'... | |
in asynchronous
mode.
"""
# ----------------------------------------------------------------------
def __init__(self, ip_address: str, host: str = None, daisy: DAISY = 'auto',
montage: Optional[Union[list, dict]] = None,
streaming_package_size: int = 250,
capture_stream: Optional[bool] = False,
board_id: str =... | |
# Copyright (c) 1999-2008 <NAME>; All Rights Reserved.
#
# 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 the rights
# to use, copy, modify, m... | |
= ['userId', 'fileId', 'version', 'body']
params = locals()
for (key, val) in params['kwargs'].iteritems():
if key not in allParams:
raise TypeError("Got an unexpected keyword argument '%s' to method SetAnnotationCollaborators" % key)
params[key] = val
del params['kwargs']
resourcePath = '/ant/{userId}/files/{... | |
= pool_shape
rs, cs = pool_stride
assert pr > 0
assert pc > 0
assert pr <= r
assert pc <= c
# Compute index in pooled space of last needed pool
# (needed = each input pixel must appear in at least one pool)
def last_pool(im_shp, p_shp, p_strd):
rval = int(np.ceil(float(im_shp - p_shp) / p_strd))
assert p_str... | |
# 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"); you may not use... | |
<reponame>vaporydev/ddht
import itertools
import logging
import secrets
import time
from typing import List, Optional, Tuple
from async_service import Service
from eth_enr import ENRAPI, ENRDatabaseAPI
from eth_enr.exceptions import OldSequenceNumber
from eth_typing import NodeID
from eth_utils import encode_hex
from ... | |
OoO0O00
if 58 - 58: O0
II1IIiiI1 = II1IIiiI1 . split ( "\n" ) [ 0 ]
OoO0o0OOOO = II1IIiiI1 . split ( ) [ - 1 ]
if 91 - 91: iII111i / I1ii11iIi11i . iII111i - o0oOOo0O0Ooo + I1ii11iIi11i
IiiIIi1 = ""
O00 = lisp_is_macos ( )
if ( O00 ) :
II1IIiiI1 = commands . getoutput ( "ifconfig {} | egrep 'inet '" . format ( ... | |
[variable for key in var_dict.keys() for variable in model_name.variables() if key == variable.name.split("_")[0]]
for var in selected_variables:
# Temporal dataframe in loop
temp_df = pd.DataFrame(columns=[
'SCENARIO',
'VAR_NAME',
'VAR_VALUE',
'REGION',
'REGION2',
'DAYTYPE',
'EMISSION',
'FUEL... | |
#ATS:test(SELF, "--graphics False --testSPH False --nx1 10 --nx2 100 --testDim 1d --testCase linear", label="RK linear interpolation test -- 1D (serial)")
#ATS:test(SELF, "--graphics False --testSPH False --nx1 10 --nx2 20 --testDim 2d --testCase linear", label="RK linear interpolation test -- 2D (serial)")
#ATS:test(S... | |
# Copyright [2020] [Toyota Research 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 required by applicable law or agreed t... | |
##########################################
# Semiconductor Calculations Package
# Author: <NAME>
# Date: 10/10/2021
##########################################
# Changelog:
# 4/25/2021 - Started Package
# 10/10/2021 - Started periodic table of elements (materials.py)
# 10/19/2021 - Added more functionality
#############... | |
<reponame>kraupn3r/intranet<gh_stars>0
from django.test import TestCase, Client, override_settings
from django.urls import reverse
from django.http import HttpResponseForbidden
from django.contrib.auth.models import Permission, Group, User
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils ... | |
0.7596159994793779,
0.7597883706231141,
0.7597948488066834,
0.8688173538580035,
0.9187403328725916,
0.9608491069399443,
0.9684692578819227,
0.9813240682601707,
0.9921667766998682,
0.9927483395545365,
0.9942199403686246,
0.99670245673367,
0.9987963966947381,
0.9988238582873724,
0.9989172273011664,
0.99915... | |
None)
_ElementMap.update({
__Value.name() : __Value
})
_AttributeMap.update({
__ID.name() : __ID,
__Notes.name() : __Notes,
__XPosition.name() : __XPosition,
__YPosition.name() : __YPosition
})
Namespace.addCategoryObject('typeBinding', u'DomainModelMetric', DomainModelMetric_)
# Complex type ... | |
<reponame>OverLordGoldDragon/dummy<filename>keras_adamw/optimizers_225tf.py
from tensorflow.python.framework import ops
from tensorflow.python.keras import backend_config
from tensorflow.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2
from tensorflow.python.keras.optimizer_v2 import learning_rate_schedule
fro... | |
reason why the rule was denied.
:param session: The database session in use.
:raises: RuleNotFound if no Rule can be found.
"""
try:
rule = session.query(models.ReplicationRule).filter_by(id=rule_id).one()
if rule.state == RuleState.WAITING_APPROVAL:
with open('%s/rule_denied_user.tmpl' % config_get('common', '... | |
<gh_stars>0
import numpy as np
import torch
from mmcv.parallel import collate, scatter
from mmpose.datasets.pipelines import Compose
from .inference import LoadImage, _box2cs, _xywh2xyxy, _xyxy2xywh
def extract_pose_sequence(pose_results, frame_idx, causal, seq_len, step=1):
"""Extract the target frame from 2D pose... | |
bool odd { _ind.size() & 1 }; \
const int bend = odd ? \
static_cast<int>( 0.5 * ( _ind.size() + 1 ) ) : \
static_cast<int>( 0.5 * _ind.size() );",
)
def hilbert(x, N=None, axis=-1):
"""
Compute the analytic signal, using the Hilbert transform.
The transformation is done along the last axis by default.
Param... | |
#!/usr/bin/env pythonw
# -*- coding: utf-8 -*-
from __future__ import print_function
from builtins import str
from builtins import range
import wx
import sys
import os
import scipy
from scipy import *
#------------------------------------------------------------------------
# def main():
#----------------------------... | |
<reponame>bokulich-lab/q2-fondue
# ----------------------------------------------------------------------------
# Copyright (c) 2022, Bokulich Laboratories.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------... | |
<gh_stars>0
"""
This module constrains instructions for binary circuits. Unlike
arithmetic instructions, they generally do not use the vector size in
the instruction code field. Instead the number of bits affected is
given as an extra argument. Also note that a register holds 64 values
instead of just one as is the cas... | |
<reponame>dev-gmmahs/block-vote-service<gh_stars>1-10
# flask
# pymysql
# flask_jwt_extended
from flask import Flask, request, render_template, send_from_directory, jsonify, redirect
from database import database_manager
from flask_jwt_extended import JWTManager, jwt_required, create_access_token, get_jwt_identity
imp... | |
"""_unquote_to_bytes('abc%20def') -> b'abc def'."""
# Note: strings are encoded as UTF-8. This is only an issue if it contains
# unescaped non-ASCII characters, which URIs should not.
if not s:
# Is it a string-like object?
s.split
return b''
if isinstance(s, str):
s = s.encode('utf-8')
bits = s.split(b'%')
i... | |
<reponame>BPDanek/DeepLearningFlappyBird_stage
#!/usr/bin/env python
#*
# distinction between dqn (vanilla) and this:
# we want to formulate an addition to state, s, called "delta s", ds, which will cause the Q value of s+ds and a
# target action, a^t, to be higher than the q value for s+ds and any other action. The i... | |
on the PCI bus and a
SCSI bus (scsi.0) is created.
During hotplug we could query QEMU via info qtree HMP command but parsing
the result is too complicated. Instead we use the info stored in runtime
files. We parse NIC and disk entries and based on their hvinfo we reserve
the corresponding slots.
The runtime arg... | |
from phi.api import *
class TestExamples(object):
"""docstring for TestExamples."""
def test_example_1(self):
text = "a bb ccc"
avg_word_length = P.Pipe(
text,
Obj.split(" "), #['a', 'bb', 'ccc']
P.map(len), #[1, 2, 3]
list, # python 3 only
P.sum() / len #6 / 3 == 2
)
assert 2 == avg_word_length
text ... | |
<filename>src/pyrin/core/structs.py
# -*- coding: utf-8 -*-
"""
core structs module.
"""
from collections import deque
from threading import Lock
from abc import abstractmethod
from werkzeug.datastructures import MultiDict, ImmutableMultiDict, ImmutableDict, Headers
import pyrin.utils.misc as misc_utils
from pyrin.... | |
170:
return '~'
if table2Version == 174 and indicatorOfParameter == 168:
return '~'
if table2Version == 174 and indicatorOfParameter == 167:
return '~'
if table2Version == 174 and indicatorOfParameter == 164:
return '~'
if table2Version == 174 and indicatorOfParameter == 139:
return '~'
if table2Version ... | |
import py, pytest, sys, os, textwrap, types
from pypy.interpreter.gateway import app2interp_temp
from pypy.interpreter.error import OperationError
from pypy.interpreter.function import Method
from pypy.tool.pytest import appsupport
from pypy.tool.option import make_config, make_objspace
from pypy.config.config import C... | |
<reponame>arunnthevapalan/great_expectations<gh_stars>0
import copy
import json
import logging
import uuid
from dataclasses import asdict, dataclass
from enum import Enum
from typing import Any, Dict, List, Optional, Set, Union
import great_expectations.exceptions as ge_exceptions
from great_expectations.core.batch im... | |
from civicboom.lib.base import *
from cbutils.misc import make_username
from civicboom.controllers.account import AccountController
set_persona = AccountController().set_persona
from civicboom.model.member import Group, GroupMembership, group_member_roles, group_join_mode, group_member_visibility, group_content_visib... | |
<gh_stars>1-10
from collections import namedtuple
H4 = 'html4' # only in html4
H5 = 'html5' # only in html5
HB = 'both' # allowed in both
N = 'normal' # has a closing tag
E = 'empty' # doesn't have a closing tag
ES = namedtuple('ES', 'tag, standard, type_, info')
ER = namedtuple('ES', 'tag, info')
HTML_ELEMENTS = [
... | |
type checking removes much of the power of using a
## dynamic language like Python.
## src = EventProcessorParameter(default=None,constant=True,precedence=0.10,doc=
## """The EventProcessor from which messages originate.""")
## dest = EventProcessorParameter(default=None,constant=True,precedence=0.11,doc=
## """The E... | |
only one of new_left and new_right will necessarily be a
bracket, but index_of_bracket_char will definitely be a bracket.
"""
expanded = False
orig_left = left
orig_right = right
while (s[left] not in self.brackets or expand and not expanded) and \
(s[right] not in self.brackets or expand and not expanded) and \... | |
#!/usr/bin/python
# Author: <NAME> <<EMAIL>>
# Imports
import os
import optparse
import rospkg
from yamlUtils import *
from termcolor import colored
from collections import namedtuple
# Setup
rospack = rospkg.RosPack()
# Types
ConfigVar = namedtuple("ConfigVar", "path name value")
ConfigDiff = namedtuple("ConfigDiff... | |
<reponame>isi-vista/adam
from itertools import chain
from typing import Sequence, Optional, Iterable
from immutablecollections import immutableset
from more_itertools import flatten
from adam.language.language_generator import LanguageGenerator
from adam.language.dependency import LinearizedDependencyTree
from adam.ont... | |
return as two integer arrays of some_length, and an ntheta*some_length array of theta power
if not os.path.isfile(xyt_filename):
# Fast Failure Case - This file does not exist.
if match_only:
return False
else:
raise ValueError('Input xyt_filename in getXYT matches no existing file')
else:
# Attempts to extrac... | |
a list of data dictionary with given pair, (length=1)
Otherwise, a list of data dictionaries of all pairs.
Example of Response Format
.. code-block:: python
[
{
'pairSymbol': '<Requested pair symbol>',
'pairSymbolNormalized': '<Requested pair symbol with "_" in between.>',
'timestamp': '<Current Unix time in... | |
"""All assumptions are either loaded in this file or definied here
"""
import os
from datetime import date
from energy_demand.read_write import read_data
from energy_demand.technologies import technologies_related
from energy_demand.technologies import dummy_technologies
from energy_demand.basic import testing_function... | |
<filename>ivadomed/evaluation.py
import nibabel as nib
import numpy as np
import pandas as pd
from loguru import logger
from scipy.ndimage import label, generate_binary_structure
from tqdm import tqdm
from pathlib import Path
from ivadomed import inference as imed_inference
from ivadomed import metrics as imed_metrics... | |
import calendar
import datetime
import numpy as np
import pandas as pd
from pandas.util.testing import (assert_frame_equal, assert_series_equal,
assert_index_equal)
from numpy.testing import assert_allclose
import pytest
from pvlib.location import Location
from pvlib import solarposition, spa
from conftest import ... | |
# Bottom left diagonal
diagBRRange = [-7, -14, -21, -28, -35, -42, -49] # Bottom right diagonal
diagTLRange = [7, 14, 21, 28, 35, 42, 49] # Top left diagonal
diagTRRange = [9, 18, 27, 36, 45, 54, 63] # Top right diagonal
# Conditions:
# If I'm at or one space from an edge, consider me safe unless I spot an enemy.... | |
#!/usr/bin/env python3
import board
import copy
DEBUG = False
class Empty:
def __str__(self):
return "#"
class Player:
def __init__(self, name, email):
self.name = name
assert (len(str(name)) >= 1), "name must be one or more character"
self.email = email
# Unit
# name: One or more character
# symbol: One sin... | |
<gh_stars>10-100
import functools
import json
import sys
import uuid
from dataclasses import dataclass
from datetime import date, datetime
from pathlib import Path
from typing import Dict, Generator, Iterable, List, Optional
import datacube.drivers.postgres._api as postgres_api
import fiona
import shapely.ops
import s... | |
= []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_c... | |
aVal, newVal, newAVal, True)
return False
def doNop(cpu, instruction):
return False
def doOra(cpu, instruction):
value = GetValue(cpu, instruction)
aVal = cpu.get_register('A')
newVal = aVal | value
cpu.set_register('A', newVal)
cpu.ctrl_update_flags(instruction.flags, aVal, value, newVal, False)
return Fals... | |
Address = 0x5680, Length = 128
0x5680,0x80,
0x40,0x5,0xbe,0x6b,0xd5,0x62,0x21,0x4d,0x6a,0x4,0x2d,0x13,0x59,0xf3,0x32,0x6f,
0x2d,0x6a,0xc7,0x56,0xed,0x99,0x64,0xdb,0x4a,0xdb,0x64,0x21,0x2f,0x9b,0x30,0xd0,
0x5b,0xb8,0x2,0x5,0x61,0xb0,0x1e,0x1f,0xe0,0x68,0x3d,0xca,0xa4,0x2e,0x81,0x78,
0x67,0x23,0x51,0xbc,0x3c,0x... | |
% (len(set(compliment_cute)), max(compliment_cute)))
print ("DEBUG: compliment_funny Cnt: %d and max value %f" % (len(set(compliment_funny)), max(compliment_funny)))
print ("DEBUG: compliment_hot Cnt: %d and max value %f" % (len(set(compliment_hot)), max(compliment_hot)))
print ("DEBUG: compliment_list Cnt: %d and m... | |
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
from typing import Iterable, List, Mapping, Optional, Tuple, Union
import popart._internal.ir as _ir
from popart.ir.context import get_current_context, op_debug_context
from popart.ir.graph import Graph
from popart.ir.tensor import Tensor
from .utils import che... | |
0xab, 0x94, 0x53,
0xb1, 0x4a, 0x79, 0x24, 0xf8, 0x4a, 0xb1, 0x43,
0xf3, 0x42, 0xb1, 0x47, 0x83, 0x2d, 0x91, 0x4f,
0x82, 0xc4, 0x91, 0x4f, 0xa2, 0xc4, 0x81, 0x4f,
0xa2, 0x64, 0x15, 0x4f, 0xa2, 0x64, 0x19, 0x2e,
0x4a, 0x9e, 0x25, 0x2e, 0x5a, 0x9e, 0x24, 0x2e,
0x4a, 0x1f, 0x49, 0xe2, 0x22, 0xf5, 0x91, 0x24,
0x87, 0... | |
<filename>feature_encoders/utils.py<gh_stars>0
# -*- coding: utf-8 -*-
# Copyright (c) Hebes Intelligence Private Company
# This source code is licensed under the Apache License, Version 2.0 found in the
# LICENSE file in the root directory of this source tree.
import glob
from typing import Any, Union
import numpy ... | |
has the ability to swing around an axis arranged perpendicularly relative
to the direction of the deflection of the actuating element ( 1 ). '''
expected = ['valve', 'deflectable', 'actuating element', 'sealing', 'contour', 'elastic', 'deflection', 'force',
'piezoelectric', 'transducer', 'perpendicularly']
idx = s... | |
<reponame>peterwilliams97/spaCy_practice<filename>vanishing_grad_example.py
"""
coding: utf-8
Vanishing Gradients
We will demonstrate the difference between using sigmoid and ReLU nonlinearities in a simple
neural network with two hidden layers. This notebook is built off of a minimal net demo done
by <NAME> for... | |
import inspect
import os
import sys
from gettext import gettext as _
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
Optional,
Sequence,
Tuple,
Union,
cast,
)
import click
import click.core
import click.formatting
import click.parser
import click.types
from .utils import _get_click_major
if ... | |
= ArgumentDescriptor(name='unicodestring1', n=
TAKEN_FROM_ARGUMENT1, reader=read_unicodestring1, doc=
"""A counted Unicode string.
The first argument is a 1-byte little-endian signed int
giving the number of bytes in the string, and the second
argument-- the UTF-8 encoding of the Unicode string --
contains that ... | |
t0 = 1.0 - 2.0*H_D
t1 = acos(t0)
t2 = 2.0*(t0)
t3 = (H_D - H_D*H_D)**0.5
t4 = t1 - t2*t3
return (1./pi*t4)**0.5
def C_wedge_meter_Miller(D, H):
r'''Calculates the coefficient of discharge of an wedge flow meter
used for measuring flow rate of fluid, based on the geometry of the
differential pressure flow met... | |
"""Utility to provide submission and comment statistics in a subreddit."""
from __future__ import print_function
from collections import defaultdict
from datetime import datetime
from tempfile import mkstemp
import codecs
import gc
import logging
import os
import re
import time
from praw import Reddit
from prawcore.e... | |
def test_current_pers_r1_notr2(self):
c1 = self._fixture(False, True, True, False)
self._assert_is_orphan(c1)
def test_leg_pers_notr1_notr2(self):
c1 = self._fixture(True, True, False, False)
self._assert_is_orphan(c1)
def test_current_pers_notr1_notr2(self):
c1 = self._fixture(False, True, True, False)
se... | |
noqa: E501
collection_formats = {}
path_params = {}
if 'entity_set_name' in local_var_params:
path_params['entitySetName'] = local_var_params['entity_set_name'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_param... | |
# coding: utf-8
# ====================================
# import
# ====================================
# import from std
import os
import sys
sys.path.append('./')
import time
import traceback
# import from pypi
import datetime
from plyer import notification
import PyQt5.QtWidgets as qw
import PyQt5.QtGui as qg
import... | |
import contextlib
import os
import tempfile
import warnings
from enum import Enum
import mip
class IISFinderAlgorithm(Enum):
DELETION_FILTER = 1
ADDITIVE_ALGORITHM = 2
class SubRelaxationInfeasible(Exception):
pass
class NonRelaxableModel(Exception):
pass
class ConflictFinder:
"""This class groups some II... | |
self.vm4_macvlan_ip, int(vm1_vrf_id))
output = self.inputs.run_cmd_on_server(
vm1_node_ip, stitched_mac_cmd).split("(")[0]
assert not output, "Stitched mac address is present."
cmd = ['ip link delete macvlan1']
self.vm4_fixture.run_cmd_on_vm(cmd, as_sudo=True)
# end test_health_check_failure
@preposttest_wrappe... | |
#publishBirth()
elif metric.name == "output/Device Metric4" or metric.alias == AliasMap.Device_Metric4:
# This is a metric we declared in our DBIRTH message and we're emulating an output.
# So, on incoming 'writes' to the output we must publish a DDATA with the new output
# value. If this were a real output we'd ... | |
<gh_stars>1-10
#!/usr/bin/env python
import numpy as np
import pandas as pd
import sys, os
import argparse as ap
import glob
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.lines as mlines
import matplotlib.gridspec as gridspec
import... | |
<filename>src/vehicleDynamics_drifter.py<gh_stars>0
import logging
from commonroad.steeringConstraints import steeringConstraints
from commonroad.accelerationConstraints import accelerationConstraints
from commonroad.vehicleDynamics_KS import vehicleDynamics_KS
from commonroad import vehicleParameters
from commonroad ... | |
2541], [4413, 677], [1966, 3412],
[2108, 796], [1516, 1715], [3760, 2349], [3275, 4385], [2910, 3629], [2176, 2622], [3927, 3298],
[3804, 3377], [3266, 3507], [3812, 1680], [2368, 1154], [3842, 817], [1364, 2415], [1470, 496],
[2620, 587], [3029, 4178], [2791, 4154], [3444, 3490], [4255, 2945], [878, 2019], [4206, 3... | |
def FloatValue(self, bFloat: 'double') -> "double":
return _gskernel.GsConfig_FloatValue(self, bFloat)
def Append(self, config: 'GsConfig') -> "void":
r""" 将另外的分支添加到这个GsConfig中"""
return _gskernel.GsConfig_Append(self, config)
def Clear(self) -> "void":
r""" 清空所有的子配置"""
return _gskernel.GsConfig_Clear... | |
is to record custom attributes that are
stored on individuals in certain kinds of experiments. Here's how you
would record the values of `ind.foo` and `ind.bar` for every individual
in the population. We write to a stream object this time to demonstrate
how to use the probe without a dataframe:
>>> import io
>>>... | |
import datetime
import io
import os
import shutil
import chardet
import regex
from chardet.universaldetector import UniversalDetector
from natsort import natsort_keygen, natsorted
nkey = natsort_keygen()
def execute_proper_function(function_number, path, error_file_path):
if function_number == 1:
move_wkt_files_t... | |
import os
import datetime
import hashlib
import hmac
import logging
import re
import uuid
from collections import namedtuple
from datetime import date, timedelta
from django.contrib.sites.models import Site
from django.core import validators
from django.core.urlresolvers import reverse
from django.conf import settings... | |
from onelang_core import *
import OneLang.One.Ast.Expressions as exprs
import OneLang.One.Ast.Statements as stats
import OneLang.One.Ast.Types as types
import OneLang.One.Ast.AstTypes as astTypes
import OneLang.One.Ast.References as refs
import OneLang.Generator.GeneratedFile as genFile
import OneLang.Generator.NameUti... | |
# Copyright (c) 2021 <NAME>.
# Model Adaptations for FFNNs
# Presumption: Model consists only of series of dense layers
# This class provides several options to build a new FFNN consisting only of dense layers
# based on a provided base model
# base assumption: the model will have one input and one output layer, that ... | |
you implement the `GRU` from scratch, we will give you the necessary methods from a build in package. You can use the following packages when constructing the model:
#
#
# - `tl.Serial`: Combinator that applies layers serially (by function composition). [docs](https://trax-ml.readthedocs.io/en/latest/trax.layers.htm... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=wrong-import-position, too-many-locals
"""
Create time- and DOM-independent (TDI) whole-detector Cartesian-binned Retro
table.
The generated table is useful for computing the total charge expected to be
deposited by a hypothesis across the entire detecto... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.