input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<filename>networks/multiscale/MSnetworks.py
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 04 15:53:28 2018
@author: cyf
All the network models about multiscale
"""
import numpy as np
import keras
from keras.models import Sequential, Model
from keras.layers import Input
from keras.layers.core import Dense, Activatio... | |
<filename>misc/openflow/nicira_ext.py<gh_stars>10-100
'''
Created on 2015/8/3
:author: hubo
'''
'''
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, 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 ob... | |
<reponame>Lachimax/FRB
""" Methods related to galaxy photometry """
import os
import warnings
import numpy as np
from pkg_resources import resource_filename
from IPython import embed
from astropy.io import fits
from astropy.table import Table, hstack, vstack, join
from astropy.coordinates import SkyCoord
from astro... | |
<filename>BattleRoyaleGame.py
import os
import neat
import pygame, sys
from pygame.locals import *
import random
import math
import matplotlib.pyplot as plt
import CareagaAstar
import numpy
# integer static values
EMPTY = 0
WALL = 1
LAVA = 2
HEALTH = 3
AMMO = 4
# sizes #
screen_width = 1440
screen_height = 900
cam... | |
<gh_stars>0
from __future__ import absolute_import
from __future__ import print_function
from io import open
import os
import os.path
import hashlib
import errno
# import psutil
from tqdm import tqdm
import imp
import six
import pickle
import glob
import os
import sys
import subprocess
from subprocess import Popen, PI... | |
(or columns and indexes)" \
"corresponding to (year, value) in the output_data table."
else:
raise ValueError('Output data frame is expected to have either two or three columns')
unit = df.columns[-1]
cfg.cur.execute("""INSERT INTO public_runs.outputs (scenario_run_id, output_type_id, unit)
VALUES (%s, %s, %s) R... | |
if self.params.refiner.refldata_trusted=="allValid":
sb_trust = mask > 0
elif self.params.refiner.refldata_trusted=="fg":
sb_trust = mask==fg_code
else:
sb_trust = np.logical_or(mask==fg_code, mask==bg_code)
below_zero = sb_bkgrnd <= 0
if np.any(below_zero):
nbelow = np.sum(below_zero)
ntot = sb_bkgrnd.size
... | |
897, 608, 755,
74, 367, 853, 407, 865, 168, 644, 477, 73, 166,
822],
[428, 985, 729, 790, 40, 290, 549, 491, 160,
429, 113, 379, 704, 432, 225, 713, 634, 879,
837, 958],
[803, 796, 762, 778, 917, 794, 792, 752, 325,
953, 986, 867, 35, 957, 623, 662, 916, 513,
324, 185],
[190, 680, 689, 189, 78, 591, 532, 174, ... | |
<gh_stars>1-10
# office/controllers.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .models import ContestOfficeListManager, ContestOfficeManager, CONTEST_OFFICE_UNIQUE_IDENTIFIERS, ContestOffice
from ballot.controllers import move_ballot_items_to_another_office
from ballot.models import OFFICE
f... | |
Constraint(expr= - 0.975737*m.x215 - 0.990512*m.x231 - 0.976952*m.x247 + m.x455 == 0)
m.c547 = Constraint(expr= - 0.975737*m.x216 - 0.990512*m.x232 - 0.976952*m.x248 + m.x456 == 0)
m.c548 = Constraint(expr= - 0.975737*m.x217 - 0.990512*m.x233 - 0.976952*m.x249 + m.x457 == 0)
m.c549 = Constraint(expr= - 0.975737*m.x2... | |
plt.show()
@decorate_as_node_property((('name', '(str) name of the profile'),
('aa', '(:py:class:`str`) amino-acid sequence'), # noqa: E501
('profile', '(:class:`~numpy:numpy.ndarray`) secondary structure assignment'), # noqa: E501
('errors', '(:class:`~numpy:numpy.ndarray`) assignment undeterminacy'))) # noqa: E5... | |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://genshi.edgewall.org/wiki/License.
#
# This software consist... | |
<filename>numba/array_analysis.py
#
# Copyright (c) 2017 Intel Corporation
# SPDX-License-Identifier: BSD-2-Clause
#
from __future__ import print_function, division, absolute_import
import types as pytypes # avoid confusion with numba.types
import numpy
import operator
from numba import ir, analysis, types, config, cg... | |
<reponame>kavish-p/youtube-search-dashboard<gh_stars>1-10
import json
from json.decoder import JSONDecodeError
import xml.etree.ElementTree as ET
import isodate
import re
from .common import (
Chat,
BaseChatDownloader,
Remapper as r
)
from requests.exceptions import RequestException
from ..utils import (
remove_... | |
<reponame>JetStarBlues/Nand-2-Tetris
# ========================================================================================
#
# Description:
#
# Compiles Hack VM (virtual machine) code to Hack ASM (assembly) code
#
# Attribution:
#
# Code by www.jk-quantized.com
#
# Design is based on:
#
# Lecture notes from th... | |
<reponame>vbnmmnbv/PyKMIP<gh_stars>1-10
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
# 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
#
#... | |
accepted
only if they are supported by the base query strategy.
queried_indices : array-like of shape (n_samples,)
Indicates which instances from X_cand have been queried.
budget_manager_param_dict : kwargs
Optional kwargs for budget_manager.
Returns
-------
self : VariableUncertainty
The VariableUncertaint... | |
reserve_build=reserve_build,
ssl_certs_dir='/' if ssl_certs else None,
krb_principal=principal,
krb_keytab=keytab)
workflow.exit_plugins_conf = plugins_conf
runner = ExitPluginsRunner(workflow, plugins_conf)
return runner
@pytest.mark.usefixtures('user_params')
class TestKojiImport(object):
def test_koji_impo... | |
<reponame>xiasnocap/mobflex
'''
┏━━━━━━━━━━━━━━━━━
┣ 𐀀 HΞLLTΞRHΞΛD ᴄᴏʀᴘ.
┣ © 2020 ᴍᴏ-ʙᴀɴᴢᴜ
┗━━━━━━━━━━━━━━━━━
'''
from liff.ttypes import LiffChatContext, LiffContext, LiffSquareChatContext, LiffNoneContext, LiffViewRequest
import requests, threading, json
class Mobanzu(threading.Thread):
def __init__(self, client)... | |
<reponame>Leonardo-Maciel/PSO_Maciel
"""
Module for creating Sankey diagrams using Matplotlib.
"""
import logging
from types import SimpleNamespace
import numpy as np
import matplotlib as mpl
from matplotlib.path import Path
from matplotlib.patches import PathPatch
from matplotlib.transforms import Affine2D
from mat... | |
is used with the following.
- os_ken.lib.packet.sctp.chunk_abort
- os_ken.lib.packet.sctp.chunk_error
An instance has the following attributes at least.
Most of them are same to the on-wire counterparts but in host byte order.
__init__ takes the corresponding args in this order.
.. tabularcolumns:: |l|L|
===... | |
# -*- coding: utf-8 -*-
"""Models for the Signbank dictionary/corpus."""
from __future__ import unicode_literals
import re
import json
import reversion
from itertools import groupby
from collections import OrderedDict
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import u... | |
<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011 <NAME>.
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any ... | |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Generates C++ source files from a mojom.Module."""
import os
import mojom.generate.generator as generator
import mojom.generate.module as mojom
import moj... | |
"""
TEM: ABEM WalkTEM
=================
The modeller ``empymod`` models the electromagnetic (EM) full wavefield Greens
function for electric and magnetic point sources and receivers. As such, it can
model any EM method from DC to GPR. However, how to actually implement a
particular EM method and survey layout can be t... | |
<reponame>csiro-hydroinformatics/hydroDL
import torch
import numpy as np
import math
class SigmaLoss(torch.nn.Module):
def __init__(self, prior='gauss'):
super(SigmaLoss, self).__init__()
self.reduction = 'elementwise_mean'
if prior == '':
self.prior = None
else:
self.prior = prior.split('+')
def forward(sel... | |
= 0xFFFFFFFE;
var FREESECT = 0xFFFFFFFF;
/* 2.2 Compound File Header */
var HEADER_SIGNATURE = 'd0cf11e0a1b11ae1';
var HEADER_MINOR_VERSION = '3e00';
var MAXREGSID = 0xFFFFFFFA;
var NOSTREAM = 0xFFFFFFFF;
var HEADER_CLSID = '00000000000000000000000000000000';
/* 2.6.1 Compound File Directory Entry */
var Entry... | |
{"statusCode": 200})
@patch("aws_lambda_decorators.decorators.LOGGER")
def test_handle_all_exceptions(self, mock_logger):
@handle_all_exceptions()
def handler():
raise KeyError("blank")
response = handler() # noqa
self.assertEqual(400, response["statusCode"])
self.assertTrue("blank" in response["body"])
m... | |
<filename>tools/batch_create_project.py
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: ryan
# Created on 2019-09-26 00:16:35
import inspect
import json
import optparse
import click
import sys
import time
from urllib import parse
import datetime
import reques... | |
hash_ids[:]
require_hash_ids = []
if parent_hash_id is not None:
query_hash_ids.append(parent_hash_id)
require_hash_ids.append(parent_hash_id)
# ========================================
# Fetch and check
# ========================================
files = self.get_nondeleted_recycled_files(Files.hash_id.in_(q... | |
from typing import List
from pyhcl.ir.low_ir import *
from pyhcl.ir.low_prim import *
from pyhcl.passes._pass import Pass, PassException, Error
from pyhcl.passes.utils import ModuleGraph, to_flow, flow, create_exps, get_info, has_flip
from pyhcl.passes.wir import *
# ScopeView
class ScopeView:
def __init__(self, mod... | |
call StopCapturingVideo to stop it.
The example of usage:
chameleon.StartCapturingVideo(hdmi_input)
time.sleep(2)
chameleon.StopCapturingVideo()
for i in xrange(chameleon.GetCapturedFrameCount()):
frame = chameleon.ReadCapturedFrame(i, *area).data
CompareFrame(frame, golden_frames[i])
Args:
port_id: The ID o... | |
until the URL is availale"""
if not timeout:
timeout = URL_TIMEOUT
end_time = time.time() + timeout
while (end_time - time.time()) > 0:
if is_url(monitor_url, status_code):
return True
time.sleep(1)
LOG.error('URL %s could not be reached after %s seconds', monitor_url,
timeout)
return False
def dhcp_lease_d... | |
== 0]
odd_ranks = [rk for rk in range(0, size) if rk % 2 == 1]
even_set = hvd.add_process_set(even_ranks)
odd_set = hvd.add_process_set(odd_ranks)
dtypes = self.filter_supported_types(['int32', 'int64',
'float32', 'float64'])
dims = [1, 2, 3]
ctx = self._current_context()
count = 0
shapes = [(), (17), (17, 17... | |
<reponame>anirudhmaheshwari/OCIR
# coding: utf-8
# # Training: Extended Sequence to Sequence Model - Word Classification
# Training extended sequence to sequnce model for recognition of words. This is my personal experimental model, which should improve accuracy of regular sequence to sequence model
# ## TODO
# ```
#... | |
= OnnxReduceMin('X', output_names=['Y'], axes=[1],
op_version=get_opset_number_from_onnx())
model_def = onx.to_onnx({'X': X.astype(numpy.float32)},
target_opset=get_opset_number_from_onnx())
oinf = OnnxInference(model_def)
got = oinf.run({'X': X})
self.assertEqual(list(sorted(got)), ['Y'])
self.assertEqualArray(... | |
required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `symbol_assign_volume_group_ownership`")
resource_path = '/storage-systems/{system-id}/symbol/assignVolumeGroupOwnership'.replace('{format}', 'json... | |
self.assertEqual(u'Z', formatted_string)
formatted_string = dates.format_datetime(dt, 'XXXXX', locale='en')
self.assertEqual(u'Z', formatted_string)
formatted_string = dates.format_datetime(dt, 'x', locale='en')
self.assertEqual(u'+00', formatted_string)
formatted_string = dates.format_datetime(dt, 'xx', locale='e... | |
<reponame>ready-robotics/robotiq<gh_stars>0
# Copyright 2018 by READY Robotics Corporation.
# All rights reserved. No person may copy, distribute, publicly display, create derivative works from or otherwise
# use or modify this software without first obtaining a license from the READY Robotics Corporation.
import ready... | |
import sys
import numpy
from PyQt5.QtWidgets import QApplication, QMessageBox, QSizePolicy
from PyQt5.QtGui import QIntValidator, QDoubleValidator
from orangewidget import gui
from orangewidget.settings import Setting
from oasys.widgets import gui as oasysgui, congruence
from oasys.widgets.exchange import DataExchange... | |
tega\
r_ID 3 4 3 4 4 6 1 tegar_ID 6 1 1 1 1 tegar_ID 5 1 1 tegar_ID \
4 tegar_ID 1 tegar_ID 9 9 7 1 1 2 4 tegar_ID 9 9 1 tegar_ID 4 1\
1 4 4 4 9 1 1 tegar_ID 5 1 1 tegar_ID 1 1 6 4 tegar_ID 3 4 3 \
4 4 6 1 tegar_ID 6 1 1 1 1 tegar_ID 5 1 1 tegar_ID 4 tegar_ID 1\
1 5 1 1 6 1 1 4 4 tegar_ID 1 2 3 1 2 5 9 1 1 tegar_ID 5... | |
module_id))
# id_ is now a parent of module_id.
for id_ in added:
if module_id not in nodeid2parents:
nodeid2parents[module_id] = []
if id_ not in nodeid2parents[module_id]:
nodeid2parents[module_id].append(id_)
# Module and all its descendents inherit the ancestors of all
# the added nodes (including the add... | |
from __future__ import generators
import os, time, sys
import pygame
from pygame.locals import *
from drawgraph import GraphRenderer, FIXEDFONT
from drawgraph import Node, Edge
from drawgraph import EventQueue, wait_for_events
METAKEYS = dict([
(ident[len('KMOD_'):].lower(), getattr(pygame.locals, ident))
for ident... | |
<gh_stars>1-10
import functools
import torch
import torch.nn as nn
def get_norm_layer(norm_layer_type):
if norm_layer_type == 'batch':
layer = functools.partial(nn.BatchNorm2d, affine=True, track_running_stats=True)
elif norm_layer_type == 'instance':
layer = functools.partial(nn.InstanceNorm2d, affine... | |
<reponame>d3centr0z/trustlines-blockchain<filename>contracts/tests/test_validator_auction.py
#! pytest
import time
from enum import Enum
from typing import Any, Optional
import attr
import eth_tester.exceptions
import pytest
# Keep AUCTION_DURATION_IN_DAYS and AUCTION_START_PRICE in sync with
# conftest.py fixtures ... | |
1
self.model.testField4 = 21
self.model.testField5 = '212'
self.assertTrue(self.model.is_modified())
self.model.flat_data()
self.assertFalse(self.model.is_modified())
self.model.testField4 = 21
self.assertFalse(self.model.is_modified())
del self.model.testField1
del self.model.testField4
self.assertTrue(self... | |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
# imports for getting the path
from pathlib import Path
# imports for plotting the results, handling arrays and images
import matplotlib.pyplot as plt
import numpy as np
import cv2 as cv
# # General Approach:
#
# 1. Get the input image.
# 2. Pass it to the Canny edg... | |
<reponame>deisemaia/Higra
############################################################################
# Copyright ESIEE Paris (2018) #
# #
# Contributor(s) : <NAME> #
# #
# Distributed under the terms of the CECILL-B License. #
# #
# The full license is in the file LICENSE, distributed with this software. #
##########... | |
= self.__predict_only(data, _mask)
return result if in_log_format else torch.exp(result)
def predict(self, dataset, mask: _typing.Optional[str] = None) -> torch.Tensor:
"""
The function of predicting on the given dataset.
Parameters
----------
dataset:
The dataset containing conventional data of integral grap... | |
# The MIT License (MIT)
# Copyright (c) 2019 <NAME> (github.com/imposter)
#
# 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 u... | |
<reponame>voletiv/torchdiffeq<filename>examples/latent_ode_moving_mnist.py
import argparse
import datetime
import gc
import imageio
import logging
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy as np
import numpy.random as npr
import os
import random
import time
import torch
import... | |
# Copyright
# (c) 2009-2019, <NAME>, <NAME>, Pivotal Software, Inc and others.
# 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 above copyright no... | |
cc1 = Pipe()
cp2, cc2 = Pipe()
p1 = Process(target=loop, args=(cc1,))
p2 = Process(target=loop, args=(cc2,))
p1.start()
p2.start()
p1.join(1)
p2.join(1)
p1.terminate()
p2.terminate()
p1.join()
p2.join()
cc1.close()
cc2.close()
# recv will only have data if the subprocess failed
try:
cp1.recv()
s... | |
<filename>tests/test_htmlgenerator.py
# coding: utf-8
from __future__ import unicode_literals
import unittest
import io
import os
from tempfile import NamedTemporaryFile
from lxml import etree
from packtools import domain
def setup_tmpfile(method):
def wrapper(self):
valid_tmpfile = NamedTemporaryFile()
valid_tmp... | |
from __future__ import unicode_literals
import collections
import os
import unittest
import spotify
from spotify.playlist_container import _PlaylistContainerCallbacks
import tests
from tests import mock
@mock.patch('spotify.playlist_container.lib', spec=spotify.lib)
class PlaylistContainerTest(unittest.TestCase):
... | |
r in rlsj }
except CalledProcessError as e:
print("No helm releases found.")
return rls
def helmWhichChartInstalled(module: str) -> Optional[str]:
chart = None
release = releases[module] # Get release name for module name
installed = helmGetReleases()
if release in installed:
chart = installed[release] # Get c... | |
from io import FileIO
import numpy as np
from scipy import ndimage
from matplotlib import pyplot as plt
import yaml
import csv
from PIL import Image
import ReferenceModification.LibFunctions as lib
class TrackMap:
def __init__(self, map_name) -> None:
self.map_name = map_name
# map info
self.resolution = None
... | |
(AVP Code 274) is of type Enumerated.
"""
code = AUTH_REQUEST_TYPE_AVP_CODE
vendor_id = None
values = [
AUTH_REQUEST_TYPE_AUTHENTICATE_ONLY,
AUTH_REQUEST_TYPE_AUTHORIZE_ONLY,
AUTH_REQUEST_TYPE_AUTHORIZE_AUTHENTICATE
]
def __init__(self, data):
DiameterAVP.__init__(self, AuthRequestTypeAVP.code)
DiameterAV... | |
self.assertTrue(js["@id"] == "http://localhost:8000/resources/7fffffff-faa1-11e9-84de-3af9d3b32b71")
self.assertTrue("http://www.cidoc-crm.org/cidoc-crm/P67i_is_referred_to_by" in js)
feats = js["http://www.cidoc-crm.org/cidoc-crm/P67i_is_referred_to_by"]["http://www.cidoc-crm.org/cidoc-crm/P128i_is_carried_by"]
sel... | |
"""
A module that provides functions for manipulating bit masks and data quality
(DQ) arrays.
"""
import sys
import warnings
import numbers
import numpy as np
__all__ = ['bitfield_to_boolean_mask', 'interpret_bit_flags']
_MAX_UINT_TYPE = np.maximum_sctype(np.uint)
_SUPPORTED_FLAGS = int(np.bitwise_not(
0, dtype=... | |
<reponame>JochenHinz/nutils<gh_stars>0
from nutils.testing import *
import nutils.types
import inspect, pickle, itertools, ctypes
import numpy
class apply_annotations(TestCase):
def test_without_annotations(self):
@nutils.types.apply_annotations
def f(a, b):
return a, b
a, b = f(1, 2)
self.assertEqual(a, 1)
se... | |
respect handle truth variants, as the interval is entirely
# determined by truth variants here.
dict(
candidates=[
_test_variant(start=15, alleles=['A', 'C']),
],
truths=[
_test_variant(start=10, alleles=['A', 'C']),
_test_variant(start=20, alleles=['AAA', 'C']),
],
expected_start=9,
expected_end=23,
bufsiz... | |
<filename>Assignment_3/Q1_SMDP_Intra/RESULT/gym_gridworld/envs/GridWorld.py<gh_stars>0
# The code red reference is given below:
# Some GridWorld environments for OpenAI Gym by <NAME>.
# Source : https://github.com/opocaj92/GridWorldEnvs
# Four room gird world environment is taken from Aharutyu git
# Source : https://... | |
uk_43
+ 16900 * uk_44
+ 106179944855977 * uk_45
+ 141265316367 * uk_46
+ 42603825571 * uk_47
+ 291499859170 * uk_48
+ 26907679308 * uk_49
+ 12 * uk_5
+ 361011364049 * uk_50
+ 486580534153 * uk_51
+ 291499859170 * uk_52
+ 187944057 * uk_53
+ 56681541 * uk_54
+ 387821070 * uk_55
+ 35798868 * uk_56
+ 480301... | |
<filename>frustum_pointnet/kitti/utils_vox.py<gh_stars>10-100
import torch
# import hyperparams as hyp
import numpy as np
import utils_geom
import utils_samp
import utils_improc
import torch.nn.functional as F
from utils_basic import *
import utils_basic
# if hyp.dataset_name == "mujoco_offline":
# XMIN = -0.5 # right... | |
<reponame>BlakeDerbin/dask-jobqueue
from contextlib import contextmanager, suppress
import logging
import math
import os
import re
import shlex
import subprocess
import sys
import weakref
import abc
import dask
from dask.utils import format_bytes, parse_bytes
from distributed.core import Status
from distributed.depl... | |
# -*- coding: utf-8 -*-
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# 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... | |
native compile-host for platform=%s",
platform )
return False
for platform in xcmpPlatforms:
checkbox = QCheckBox( platform )
compileHost = CrossCompilation.getCrossCompileHost(platform)
xcmp = 'Cross-compile for "%s" on "%s"' % ( platform, compileHost )
checkbox.setToolTip( xcmp )
checkbox.setChecked( platfo... | |
module purge
module load pandas
pyspark --packages com.databricks:spark-csv_2.11:1.5.0 --executor-memory 4g
# read the crime data types into the dataframe
typedf = sqlContext.read.format('com.databricks.spark.csv').options(header = False, inferschema='true').load('types.csv')
header = ['id','CMPLNT_NUM','CMPLNT_FR_D... | |
<gh_stars>1-10
import numpy as np
import random
def shift(x: np.ndarray, offset: int, fill_val=np.nan):
if abs(offset) > len(x):
raise ValueError('Offset should be less or equal than length of x')
if offset >= 0:
return np.concatenate((np.full(offset, fill_val, dtype=x.dtype), x[:-offset]))
else:
return np.conc... | |
<gh_stars>0
from __future__ import annotations
import datetime as dt
from dataclasses import asdict, is_dataclass
from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryDirectory
from typing import Any, Optional, Union
import dbt.flags as flags
from airflow import AirflowException
from airflow.mod... | |
<filename>skywalker/gui.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from os import path
from functools import partial
from threading import RLock
import simplejson as json
from bluesky import RunEngine
from bluesky.utils import install_qt_kicker
from bluesky.preprocessors import run_wrapper, stage... | |
:math:`Y^{\\otimes d}`.
Maps: \|0⟩ -> `i` \|1⟩, \|1⟩ -> -`i` \|0⟩.
Parameters
----------
d : int
The number of qubits described by the state vector on which
the produced operator will act.
Returns
-------
Operator
A rank `2d` tensor describing the operator.
See Also
--------
Identity, PauliX, PauliZ, Ha... | |
import os
import sys
import uuid
import traceback
import json
try:
from StringIO import StringIO
except:
from io import StringIO
import param
from ._version import __version__
HERE = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(HERE, 'labextension', 'package.json')) as fid:
data = json.load... | |
import os, datetime, time
#import GISDataSets_10_v4
#from GISDataSets_10_v4 import * #local modules
import arcpy
# Class Definitions
###
#######################################################################
class GISDataSet:
def __init__(self,fullpath,arcpy):
objDataSet = arcpy.Describe(fullPath)
self.name = obj... | |
params = {}
params['alpha'] = sp.stats.uniform(scale=1)
params['max_iter'] = sp.stats.randint(100,5000)
else:
scv = StratifiedKFold(n_splits=n_splits, shuffle=True, random_state=seed)
model_name = 'Multinomial Naive Bayes'
nlp_model = MultinomialNB()
params = {}
params['alpha'] = sp.stats.uniform(scale=... | |
embed_init_std: float = 2048 ** -0.5,
layer_norm_eps: float = 1e-12,
init_std: float = 0.02,
bos_index: int = 0,
eos_index: int = 1,
pad_index: int = 2,
unk_index: int = 3,
mask_index: int = 5,
is_encoder: bool = True,
start_n_top: int = 5,
end_n_top: int = 5,
mask_token_id: int = 0,
lang_id: int = 0,
pad_... | |
<reponame>binarybana/samcnet<gh_stars>10-100
from __future__ import division
import sys
import numpy as np
import tables as t
import matplotlib as mpl
import random
from math import log, exp, pi, lgamma
import scipy.stats as st
import scipy.stats.distributions as di
import scipy
from scipy.special import betaln
from... | |
<gh_stars>0
# -*- coding: utf-8 -*-
import numpy as onp
import jax
from jax import partial, jit
import jax.numpy as np
from gasp.pca_utils_jx import *
from gasp.marginallikelihoods_jx import *
from jax.nn import sigmoid
from jax.scipy.special import logsumexp
def batch_indices(start_indices, n_components, npix):
... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Filename: trigger.py
# Purpose: Python trigger/picker routines for seismology.
# Author: <NAME>, <NAME>
# Email: <EMAIL>
#
# Copyright (C) 2008-2012 <NAME>, <NAME>
# ------------------------------------... | |
import os
import subprocess
import numpy as np
import re
from collections import OrderedDict
from example.cbnu.utils import get_interval
data_source_classes = OrderedDict()
possible_modes = ['one-file', 'multi-file', 'one-dir', 'multi-dir', 'other']
import neo
class DataSourceBase:
gui_params = None
def __in... | |
this case, the bracket of a config only
determines the initial grace period, i.e. the first milestone at which
it starts competing with others.
The concept of brackets in Hyperband is meant to hedge against overly
aggressive filtering in successive halving, based on low fidelity
criteria. In practice, successive h... | |
id0, el0 = self._parseVariable(id)
if el0 is not None:
# If they are asking for the special name (_, _id)
if el0 in AdvancedNamespace._variable_name_str:
# return the variable name itself, no markdown.
self.dbgPrint('Returning {} for getValue("{}")'.format(id0, el0))
return id0
if el0 in VariableStore._special_... | |
import csv
import html
import json
import logging
import os
import re
import tempfile
from collections import OrderedDict
from datetime import timedelta
from decimal import Decimal
import subprocess
from io import StringIO
from typing import List, Any, Optional, Union, Dict, Sequence, Tuple, TypeVar
from django.conf im... | |
import likeyoubot_resource as lybrsc
import likeyoubot_message
import cv2
import sys
import numpy as np
from matplotlib import pyplot as plt
import pyautogui
import operator
import random
import likeyoubot_game as lybgame
import likeyoubot_lineage2revolution as lybgamelin2rev
from likeyoubot_configure import LYBConstan... | |
how=how, speed=-1, plugorigin="rss", **{'headlines': True}) ; nritems += 1
except Exception, ex: handle_exception()
logging.warn("DELIVERED %s %s items on: %s" % (nritems, name, str(loopover)))
return nritems
except Exception, ex: handle_exception(txt=name) ; return str(ex)
def makeresponse(self, name, type, res,... | |
<reponame>philliphelms/cyclopeps<filename>cyclopeps/algs/tebd.py
from cyclopeps.tools.params import *
from cyclopeps.tools.utils import *
from cyclopeps.tools.mps_tools import *
from cyclopeps.tools.peps_tools import *
from cyclopeps.tools.ops_tools import *
from cyclopeps.algs.simple_update import run_tebd as su
from ... | |
pulumi.set(__self__, "sse_kms_encrypted_objects", sse_kms_encrypted_objects)
@property
@pulumi.getter(name="sseKmsEncryptedObjects")
def sse_kms_encrypted_objects(self) -> Optional[Sequence['outputs.BucketV2ReplicationConfigurationRuleSourceSelectionCriteriaSseKmsEncryptedObject']]:
"""
Matched SSE-KMS encrypted ... | |
# Copyright 2018 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" fi... | |
17.780, 25.172, 27.244,
VERTEX, 17.846, 25.192, 27.425,
VERTEX, 17.911, 25.209, 27.607,
VERTEX, 17.974, 25.223, 27.790,
VERTEX, 18.018, 25.232, 27.830,
VERTEX, 18.167, 25.259, 27.962,
VERTEX, 18.318, 25.283, 28.092,
VERTEX, 18.470, 25.305, 28.221,
VERTEX, 18.624, 25.324, 28.349,
VERTEX, 18.780, 25.341, 28.474,
VERTEX, ... | |
import os
from pathlib import Path
from resolwe.flow.models import Data
from resolwe.test import tag_process, with_resolwe_host
from resolwe_bio.models import Sample
from resolwe_bio.utils.test import KBBioProcessTestCase
class AlignmentProcessorTestCase(KBBioProcessTestCase):
@tag_process("bowtie-index", "alignme... | |
import operator
import pickle
from types import SimpleNamespace
import numpy as np
import pandas
import pytest
from pandas.testing import assert_frame_equal, assert_series_equal
import dask
import dask.array
from dask.dataframe.core import has_parallel_type
from dask.sizeof import sizeof
from distributed import Clien... | |
<reponame>ouyang-w-19/decogo
# MINLP written by GAMS Convert at 04/21/18 13:54:22
#
# Equation counts
# Total E G L N X C B
# 58 30 0 28 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc si
# Total cont binary integer sos1 sos2 scont sint
# 129 17 112 0 0 0 0 0
# FX 0 0 0 0 0 0 0 0
#
# Nonzero counts
# Total const NL D... | |
"""
# # Public Function set_man_ref_siz_lock(fta_infra_setting_att)
# # Dim iLocked (2)
# # fta_infra_setting_att.SetManRefSizLock iLocked
# # set_man_ref_siz_lock = iLocked
# # End Function
# # """
# # system_service = SystemService(self.application.SystemService)
# # return system_service.evaluate(vba_code, ... | |
<gh_stars>0
# This script is used to demonstrate MobileNet-SSD network using OpenCV deep learning module.
#
# It works with model taken from https://github.com/chuanqi305/MobileNet-SSD/ that
# was trained in Caffe-SSD framework, https://github.com/weiliu89/caffe/tree/ssd.
# Model detects objects from 20 classes.
#
# Al... | |
be printed in JSON format to stdout.
Nonempty string if results should be printed in JSON format to file. The string has to be a valid path.
None if the results should be printed as human-readable plaintext.
field_filter : int, optional
Indicates format for displaying bookmarks. Default is 0.
chatty : bool, option... | |
# coding: utf-8
# In[1]:
#!/usr/bin/env python2
#Inspire du fichier train_fcn8.py
import os
import argparse
import time
from getpass import getuser
from distutils.dir_util import copy_tree
import pickle
import numpy as np
import random
import theano
import theano.tensor as T
from theano import config
import lasa... | |
#!/usr/bin/env python3
"""
Slithering Fading Snakes
I think the title is self explanatory.
....................
Functions:
- slithering_fading_snake_12: Lights up then fades the LEDs on arms 1 and 2
- slithering_fading_snake_13: Lights up then fades the LEDs on arms 1 and 3
- slithering_fading_snake_21: Lights up th... | |
<reponame>fredstro/sage<filename>src/sage/schemes/projective/projective_rational_point.py<gh_stars>1-10
r"""
Enumeration of rational points on projective schemes
Naive algorithms for enumerating rational points over `\QQ` or finite fields
over for general schemes.
.. WARNING::
Incorrect results and infinite loops m... | |
<gh_stars>1-10
from . import consts, console
from .ui import orientation
from . import direction
from . import strutils as su
from .moduletype import ModuleType
from .Panel import Panel
from .MainWindow import MainWindow
from .MenuBar import MenuBar
from .Layout import Layout
from .Tab import Tab
from .TabPanel impor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.