input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<filename>cotengra/path_greedy.py
import math
import heapq
import random
import functools
import itertools
import collections
from opt_einsum.paths import (
ssa_greedy_optimize,
register_path_fn,
ssa_to_linear,
)
from opt_einsum.path_random import thermal_chooser
from .core import (
jitter_dict,
ContractionTree,... | |
<filename>experiments/2_incident_points_6_ambo/amboworld/environment.py<gh_stars>1-10
import gym
from gym import spaces
import matplotlib.pyplot as plt
import numpy as np
import random
import simpy
from amboworld.ambulance import Ambulance
from amboworld.patient import Patient
from amboworld.utils import get_distance
... | |
# Copyright 2015 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | |
<reponame>KarrLab/schema
""" Chemistry attributes
:Author: <NAME> <<EMAIL>>
:Date: 2017-05-10
:Copyright: 2017, Karr Lab
:License: MIT
"""
from .. import core
from wc_utils.util import chem
from wc_utils.util.enumerate import CaseInsensitiveEnum
import wc_utils.workbook.io
import bcforms
import bpforms
import bpforms... | |
8287 5.35613932168486974801385239922774E-4990 2.67806966084243487400692619961387E-4990
8288 1.339034830421217437003463099806935E-4990 6.695174152106087185017315499034675E-4991
8289 3.347587076053043592508657749517338E-4991 1.673793538026521796254328874758669E-4991
8290 8.368967690132608981271644373793345E-4992 4.... | |
= 1
# self.ship_status = ShipStatus.backhome
# self.back_home()
# if self.low_dump_energy_warnning:
# # 记录是因为按了低电量判断为返航
# self.back_home()
#
# def back_home(self):
# """
# 紧急情况下返航
# :return:
# """
# # 有返航点下情况下返回返航点,没有则停止
# if self.home_lng_lat is None:
# if not config.home_debug:
# self.pi_main_obj.stop()
# else:
# pri... | |
<gh_stars>1-10
# MINLP written by GAMS Convert at 04/21/18 13:54:18
#
# Equation counts
# Total E G L N X C B
# 1051 51 0 1000 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc si
# Total cont binary integer sos1 sos2 scont sint
# 1021 1001 20 0 0 0 0 0
# FX 0 0 0 0 0 0 0 0
#
# Nonzero counts
# Total const NL DLL
# 402... | |
+ ... + b_(n-1)*xn + bn*xn^2 ))")
temporalRow = []
temporalRow.append(predictionAcurracy)
temporalRow.append(currentCoefficients)
temporalRow.append(self.x_samplesList)
allAccuracies.append(temporalRow)
# ------------------------------------------------------------------ #
# -----------------------------------... | |
<gh_stars>10-100
import json
import time
import pytest
from amqp.exceptions import NotFound
from kombu import Connection
from kombu.messaging import Exchange, Queue
from kombu.pools import connections
from kombu.serialization import register, unregister
from mock import ANY, patch
from nameko.amqp.publish import Undel... | |
'charisma':16,
},
'class_features':{
'Feat_Inspiring_Leader':True,
'Feat_Mounted_Combatant':True,
'Fighting_Style_Protection':True,
'Second_Wind':True,
'Action_Surge':True,
'Martial_Archetype_Champion':True,
'Champion_Improved_Critical':True,
'Feat_Heavy_Armor_Master':True,
'Extra_Attack':True,
'Remarkable_... | |
from aiomysql import Pool, DictCursor
from utils.db_api.sql import db_pool
import json, io
class DBCommands:
pool: Pool = db_pool
#885533024
TG_USER_ACTIVATE = "UPDATE crudapp_telegramuser SET mfo_id = {0}, status = 1 WHERE uid = {1}"
MFO_LIST = "select * from crudapp_mfostruct"
GET_ATMS = "SELECT crudapp_atm.i... | |
<reponame>chenbinghui1/DSL<filename>mmdet/runner/hooks/unlabel_pred_hook.py<gh_stars>1-10
import os
import time
import json
import math
import copy
import mmcv
import torch
import numpy as np
from mmcv.runner import Hook, HOOKS
from mmdet.datasets.pipelines import Compose
from mmcv.parallel import collate, scatter
#fr... | |
#example X arrays and how its formatted:
# X = [423 30 10 0 ] read from left to right theres a ribosome in position 423 30 and 10, with a 0 kept as a buffer for simulation
t = t_array[0] #time point
Nt = len(t_array) #number of time points to record over
tf = t_array[-1] #final time point
N_rib = 200 #Maximum num... | |
'm/s' and 'ft/s'.
The altitude may be in feet ('ft'), metres ('m'), kilometres ('km'),
statute miles, ('sm') or nautical miles ('nm').
The temperature may be in deg C, F, K or R.
If the units are not specified, the units in default_units.py are used.
This first version only works for TAS < 661.48 kt.
"""
... | |
except KeyError:
involved = oset.union(*self.node_to_terms(node))
keep = self.get_keep(node)
legs = involved & keep
self.info[node]['legs'] = legs
return legs
def get_involved(self, node):
"""Get all the indices involved in the formation of subgraph ``node``.
"""
try:
involved = self.info[node]['i... | |
id):
"""寻找指定id的网格"""
if id == EMPTY_STRING or len(id) <1:
return
if direction == DIRECTION_LONG:
for x in self.dnGrids[:]:
if x.id == id:
self.writeCtaLog(u'找到下网格[open={},close={},stop={},volume={}]'.format(x.openPrice,x.closePrice,x.stopPrice,x.volume))
return x
if direction == DIRECTION_SHORT:
for x in sel... | |
<reponame>par2/lamana<gh_stars>1-10
#------------------------------------------------------------------------------
'''Confirm output of general models.'''
import logging
import itertools as it
import matplotlib as mpl
mpl.use('Agg') # required to prevent DISPLAY error; must be before pyplot (REF 050)
import matplotl... | |
dataset.set_filelist(filelist)
dataset.load_into_memory()
dataset.preprocess_instance()
"""
self.dataset.preprocess_instance()
def set_current_phase(self, current_phase):
"""
Set current phase in train. It is useful for untest.
current_phase : 1 for join, 0 for update.
Examples:
.. code-block:: python
im... | |
4.20927452889608*m.b555 >= -1.90668943590203)
m.c555 = Constraint(expr= - m.x93 + m.x285 - 4.20927452889608*m.b556 >= -1.90668943590203)
m.c556 = Constraint(expr= - m.x94 + m.x286 - 4.20927452889608*m.b557 >= -1.90668943590203)
m.c557 = Constraint(expr= - m.x95 + m.x287 - 4.20927452889608*m.b558 >= -1.90668943590203... | |
old_y = self.program.last_y
if self.state == DRIVER_STATE_PROGRAM:
if cut:
self.program.cut_abs(x, y)
else:
self.program.move_abs(x, y)
else:
# DRIVER_STATE_RASTER
if x == self.current_x and y == self.current_y:
return
if cut:
if x == self.current_x:
self.program.cut_vertical_abs(y=y)
if y == self.current... | |
barcodes to quickly recognize high quality barcodes which fill almost whole image. Mode helps to quickly recognize generated barcodes from Internet. # noqa: E501
:return: The allow_one_d_fast_barcodes_detector of this ReaderParams. # noqa: E501
:rtype: bool
"""
return self._allow_one_d_fast_barcodes_detector
@al... | |
<gh_stars>0
# Copyright 2018-2020 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicabl... | |
"""Control functions for WFSC."""
import numpy as np
# import multiprocessing
# from astropy.io import fits
# import matplotlib.pyplot as plt
import falco
def wrapper(mp, cvar, jacStruct):
"""
Outermost wrapper function for all the controller functions.
Parameters
----------
mp : ModelParameters
Structure con... | |
<reponame>ddr95070/RMIsaac<gh_stars>0
'''
Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribu... | |
#!/usr/bin/python
#
# Copyright 2002-2021 Barcelona Supercomputing Center (www.bsc.es)
#
# 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
#
# Unles... | |
<gh_stars>1-10
import os
import json
import logging
import itertools
import hglib
import re
import requests
from datetime import datetime
from django.db import transaction
from django.db import models
from django.utils import timezone
from django.utils.six import with_metaclass
from django.utils import timezone
from d... | |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import hashlib
from ccxt.base.errors import ExchangeError
from ccxt.base.errors impor... | |
<filename>tensorflow/python/eager/def_function_xla_jit_test.py
# Copyright 2019 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.apa... | |
<reponame>hboshnak/python_toolbox
# Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
import operator
import heapq
import itertools
import numbers
import collections
import functools
import copy
from python_toolbox import misc_tools
from python_toolbox import math_tools
from python_tool... | |
bl_info = {
"name": "export",
"description": "Export to N64 Display List",
"author": "WadeMalone",
"version": (1, 0, 1),
"blender": (2, 70, 0),
"warning": "",
"location": "View3D > Tool",
"wiki_url": "",
"tracker_url": "",
"support": "COMMUNITY",
"category": "N64 Model Editing" }
import bpy
im... | |
<filename>warehouse/migrations/versions/283c68f2ab2_initial_migration.py<gh_stars>1000+
# 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... | |
<gh_stars>0
import re
from pathlib import Path
from typing import Optional
import pytest
from eth_utils import is_checksum_address
from ethpm_types import ContractType
from hexbytes import HexBytes
from ape import Contract
from ape.api import Address, ReceiptAPI
from ape.exceptions import DecodingError
from ape.types... | |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging
from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED,
STOPPED, FINISHED, PRESSED, RELEASED, FOREVER)
import numpy as np # w... | |
only populated by the server, and will be ignored when
sending a request.
:ivar id: Fully qualified resource Id for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
:vartype id: str
:ivar name: The name of the... | |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from collections import defaultdict
from itertools import chain, product
from logging import getLogger
from limpyd.contrib.collection import ExtendedCollectionManager
from limpyd.exceptions import ImplementationError
from limpyd.fields import SingleValue... | |
<reponame>tvorogme/dataops
"""
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... | |
<filename>tf_verify/optimizer.py
'''
@author: <NAME>
'''
from deepzono_nodes import *
from deeppoly_nodes import *
from functools import reduce
import numpy as np
operations_for_neuron_count = ["Relu", "Sigmoid", "Tanh", "MaxPool"]
class Optimizer:
def __init__(self, operations, resources):
"""
Arguments
------... | |
""" Renames the instance.
Args:
new_name: the new name of the instance
"""
if not self.writability:
raise FSError("current file is not writable, check the permission")
if os.path.exists(os.path.join(os.path.dirname(self._path), new_name)):
raise FSError("file exists cannot use same name.")
new_name = os.path.j... | |
# -*- coding: utf-8 -*-
"""
Functions for transforming between color spaces.
Change log:
2015/10/09 -- compand, inverse_compand added; <EMAIL>
"""
import copy
import numpy
import imageutils
import whitepoint
#
# module constants
#
_lab_epsilon = 0.008856
_lab_kappa = 903.3
#
# module utilities
#
def _safe_divide... | |
permutation refer.
Examples
========
>>> from sympy.combinatorics import Permutation
>>> Permutation.print_cyclic = True
>>> from sympy.combinatorics.permutations import Cycle
>>> from sympy.combinatorics.polyhedron import Polyhedron
>>> from sympy.combinatorics.perm_groups import PermutationGroup
The permut... | |
),
flag_set(
actions = [
ACTION_NAMES.assemble,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.lto_backend,
ACTION_NAMES.clif_m... | |
import sys
import os
from .constants import VERSION, DEFAULT_PROCESSES, CONFIG_FILE_NAMES, PROJECT_BOUNDARIES
from .backports import Backports
from .features import Features
from .config import Config
from .printing import nprint
from . import formats
class Arguments:
def __init__(self, args):
self.__args = args
... | |
self.strategy.fetch_for_product(line.product)
if info.availability.is_available_to_buy:
raise
pass
return total
# ==========
# Properties
# ==========
@property
def is_empty(self):
"""
Test if this basket is empty
"""
return self.id is None or self.num_lines == 0
@property
def is_tax_known(self):
"""... | |
# Code for initialization of NMF, copied with little modification from scikit-learn
# Original source: https://github.com/scikit-learn/scikit-learn/blob/7e1e6d09bcc2eaeba98f7e737aac2ac782f0e5f1/sklearn/decomposition/_nmf.py#L229
import numpy as np
from scipy import linalg
import warnings
from math import sqrt
import nu... | |
<gh_stars>1-10
"""
=============
python-timely
=============
Operations on time vectors with variable calendar definitions.
Notes
-----
The terminology and structure is inspired by the shapely package and was
motivated by the need to deal with various time representation in the
climate modelling community.
The notio... | |
#!/usr/bin/env python3
#Copyright 2021 <NAME>
#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, merge, publish, d... | |
channel_matcher:
# skip url in canonical str if channel already included
continue
value = text_type(self._match_components[key])
if any(s in value for s in ', ='):
brackets.append("%s='%s'" % (key, value))
else:
brackets.append("%s=%s" % (key, value))
if brackets:
builder.append('[%s]' % ','.join(brackets))
... | |
int
Updated list of indices of flagged antennas
"""
# get nsamples and check for small auto ants
if correct_van_vleck:
self.history += " Applied Van Vleck correction."
# calculate number of samples going into real or imaginary part
# factor of two comes from variables being circularly-symmetric
nsamples = self... | |
counting of the number of annotated FOVs from dragonfly-automation datasets
# (the 'dad' appendix stands for dragonfly-automation datasets)
dad_pmls = ['PML%04d' % ind for ind in range(196, 999)]
fov_counts_query = fov_counts_query.filter(models.MicroscopyFOV.pml_id == sa.any_(dad_pmls))
fov_counts_dad = pd.DataFra... | |
import datetime
import traceback
from SmartAPI.common.RESOURCE import RESOURCE
from SmartAPI.common.PROPERTY import PROPERTY
from SmartAPI.common.Tools import Tools
from SmartAPI.rdf.Resource import Resource
from SmartAPI.rdf.Statement import Statement
from SmartAPI.common.SERIALIZATION import SERIALIZATION
from Smar... | |
<filename>tests/test_kubernetes_tools.py
import unittest
from typing import Sequence
import mock
import pytest
from kubernetes.client import V1AWSElasticBlockStoreVolumeSource
from kubernetes.client import V1Container
from kubernetes.client import V1ContainerPort
from kubernetes.client import V1Deployment
from kuberne... | |
command=self._restraint_by_mvz)
self.mvz_box.config(width=40)
# self.mvz_sap_label = tk.Label(row1_cf, text='SAPmvz', padx=10)
# self.mvz_sap = tk.Label(row1_cf, padx=10, bg='lightgray', width=11)
self.menubutton = tk.Menubutton(row1_cf, text="Выбрать адреса договора",
indicatoron=True, borderwidth=1,
relief="ra... | |
# -*- test-case-name: vumi.transports.smpp.tests.test_smpp -*-
from datetime import datetime
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, returnValue
from vumi import log
from vumi.utils import get_operator_number
from vumi.transports.base import Transport
from vumi.transp... | |
<reponame>mclark58/coexpression
#!/usr/bin/env python
# standard library imports
import os
import sys
import traceback
import argparse
import json
import logging
import time
import pprint
import string
import subprocess
from os import environ
from ConfigParser import ConfigParser
import re
# 3rd party imports
import... | |
<filename>ucs_data/ucs_main.py<gh_stars>0
from ucsmsdk.ucshandle import UcsHandle
from colorama import Fore, Back, Style, init
from ucsmsdk.ucsexception import UcsException
import argparse
import sys
init(autoreset=True)
parser = argparse.ArgumentParser(description='Configure UCS from spreadsheet')
parser.add_argument... | |
<filename>lightautoml/tasks/gpu/common_metric_gpu.py
"""Bunch of metrics with unified interface (GPU version)."""
from functools import partial
from typing import Optional, Callable
import dask_cudf
import cudf
import dask.array as da
import cupy as cp
from cuml.metrics import roc_auc_score
from cuml.metrics import ... | |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2020 Fetch.AI Limited
#
# 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 ... | |
= temp_df.astype(float)
return temp_df
# 金十数据中心-经济指标-中国-金融指标-M2货币供应年率
def macro_china_m2_yearly():
"""
中国年度M2数据, 数据区间从19980201-至今
https://datacenter.jin10.com/reportType/dc_chinese_m2_money_supply_yoy
https://cdn.jin10.com/dc/reports/dc_chinese_m2_money_supply_yoy_all.js?v=1578818474
:return: pandas.Series
199... | |
import os
import ast
from collections import namedtuple
#from tensorflow.python import debug as tf_debug
from shutil import copy, copytree
from tqdm import trange
import csv
import random
import tensorflow as tf
import numpy as np
from data import get_dataset
from models import Generator, Discriminator, MappingNetwor... | |
# -*- coding: utf-8 -*-
"""System operating cost plots.
This module plots figures related to the cost of operating the power system.
Plots can be broken down by cost categories, generator types etc.
@author: <NAME>
"""
import logging
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
impo... | |
routine_name: str,
routine_parameter: dict = None,
function_version: str = None,
function_async: bool = False
) -> object:
'''
Invoke given the specified routine of the cloud function.
Args:
region_id: Data center unique identifier.
namespace_name: Namespace name.
function_name: Serverless cloud function nam... | |
<reponame>StannisZhou/capacity_hopping<filename>golf_course/estimate/capacity.py
import multiprocessing as mp
import numpy as np
from scipy.cluster.vq import kmeans2
from scipy.optimize import linear_sum_assignment
from scipy.spatial.distance import cdist
import golf_course.estimate.numba as nestimate
from golf_cours... | |
<filename>src/xlsxwriter_celldsl/ops/classes.py
import itertools
from io import BytesIO
from pathlib import Path
from typing import Any, ClassVar, Deque, Dict, Generic, List, Mapping, Optional, Tuple, TypeVar, Union
from attr import Factory, attrib, attrs, evolve
from xlsxwriter.utility import xl_range_formula
from .... | |
"""
Module to execute the simulation for a given instance.
"""
""" import packages """
import logging
from importlib import import_module
import numpy.random as rdm
import copy
import numpy as np
""" import project configurations """
import configurations.settings_simulation as config
""" import project librar... | |
actual_mem = self._get_mem_usage_values(reset=True)
status_format = " | ".join(["%%%ss" % len(header) for header in self._status_headers])
print(status_format % (
self._num_queries_finished.value,
self._num_queries_started.value - self._num_queries_finished.value,
self._num_queries_exceeded_mem_limit.value,
self.... | |
import numpy as np
import scipy as sp
import logging
import doctest
from pysnptools.snpreader import Bed
from pysnptools.snpreader import SnpHdf5
from pysnptools.snpreader import Dat
from pysnptools.snpreader import Dense
from pysnptools.snpreader import Pheno
from pysnptools.snpreader import Ped
from pysnptools.stand... | |
B 3 46.550 -68.560 64.661 1.00 25.93 N
ATOM 17 CA GLN B 3 46.391 -69.970 64.997 1.00 24.46 C
ATOM 18 C GLN B 3 44.959 -70.433 64.750 1.00 23.33 C
ATOM 19 O GLN B 3 44.010 -69.863 65.287 1.00 20.10 O
ATOM 20 CB GLN B 3 46.782 -70.222 66.455 1.00 29.74 C
ATOM 21 CG GLN B 3 46.646 -71.671 66.893 1.00 39.72 C
ATOM 22 CD GL... | |
# This file populates the database
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from database_setup import Base, Genre, Movie
"""
SQLAlchemy executes CRUD operations via an interface called a session
Sessions allow us to write down all commands we want to execute but not
send to the da... | |
"121243": ("Distance from skin", [6165]),
},
"DistancePupillaryDistance": {
"111679": ("Distance Pupillary Distance", []),
},
"DistanceSourceToDetector": {
"113750": ("Distance Source to Detector", [10008]),
},
"DistanceSourceToIsocenter": {
"113748": ("Distance Source to Isocenter", [10008]),
},
"DistanceSo... | |
<filename>tag_to_header.py
#!/usr/bin/env python3
#
# Tag To Header
# Version 2.0.1
# By <NAME>, <NAME>(1), <NAME> (1) and <NAME>(1)
# (1) Department of Pathology, University of Washington School of
# Medicine, Seattle, WA 98195
# March 24, 2014
#
"""
BERKELEY SOFTWARE DISTRIBUTION LICENSE
Copyright (c) 20... | |
<filename>wbia/web/apis_microsoft.py<gh_stars>0
# -*- coding: utf-8 -*-
"""Dependencies: flask, tornado."""
import logging
from wbia.control import controller_inject
from flask_swagger import swagger
import wbia.constants as const
from flask import current_app
from flask import jsonify
from flask import url_for
import ... | |
# MIT License
#
# Copyright (c) 2020 <NAME> (Talendar)
#
# 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... | |
'')
elif 'access_token' in request.headers:
token = request.headers['access_token']
if secret and token:
# ENV variables sometimes don't pass newlines, spec says white space
# doesn't matter, but pyjwt cares about it, so fix it
secret = secret.replace(' PUBLIC ', '_PLACEHOLDER_')
secret = secret.replace(' ', '\n... | |
= 2**len(qubits) # e.g., 00, 01 ,10 and 11 in the case of 2q
# nr_shots = nr_shots_per_case*nr_cases
# off and on, not including post selection init measurements yet
nr_cases = 2 ** len(qubits) # e.g., 00, 01 ,10 and 11 in the case of 2q
if initialize:
nr_shots = 2 * nr_shots_per_case * nr_cases
else:
nr_shots... | |
= sys.exc_info()
print "ERROR checkMergeGenerationStatus : %s %s" % (type,value)
return EC_Failed,None
# get full job status
def getFullJobStatus(ids,verbose):
# serialize
strIDs = pickle.dumps(ids)
# instantiate curl
curl = _Curl()
curl.sslCert = _x509()
curl.sslKey = _x509()
curl.verbose = verbose
# execu... | |
21168 * uk_138
+ 1500282 * uk_139
+ 8949717 * uk_14
+ 1722546 * uk_140
+ 333396 * uk_141
+ 1977738 * uk_142
+ 382788 * uk_143
+ 74088 * uk_144
+ 1728 * uk_145
+ 27216 * uk_146
+ 31248 * uk_147
+ 6048 * uk_148
+ 428652 * uk_149
+ 10275601 * uk_15
+ 492156 * uk_150
+ 95256 * uk_151
+ 565068 * uk_152
+ 10... | |
###
# Copyright (c) 2002-2005, <NAME>
# Copyright (c) 2008-2009,2011, <NAME>
# 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... | |
<reponame>SomiAfiuni/CPplugins
# coding=utf-8
"""
ColorToGray
===========
**ColorToGray** converts an image with multiple color channels to one or more
grayscale images.
This module converts color and channel-stacked
images to grayscale. All channels can be merged into one grayscale image
(*Combine*), or each channe... | |
None:
transform = Matrix3()
result = dll.pixie_path_compute_bounds(self, transform)
if check_error():
raise PixieError(take_error())
return result
def fill_overlaps(self, test, transform = None, winding_rule = WR_NON_ZERO):
"""
Returns whether or not the specified point is contained in the current path.
"""
... | |
<reponame>guochaoxu2019/POVME3.0
#!python
# POVME 3.0 is released under the GNU General Public License (see http://www.gnu.org/licenses/gpl.html).
# If you have any questions, comments, or suggestions, please don't hesitate to contact me,
# <NAME>, at j5wagner [at] ucsd [dot] edu.
#
# If you use POVME in your work, pl... | |
<filename>question_generation/generate_questions.py
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file ... | |
self.master_map = self.reference_map.deep_copy()
if self.model.ncs_constraints_present():
# here we are negating non-master part of the model
# self.master_sel=master_sel
# self.master_map = self.reference_map.deep_copy()
mask = maptbx.mask(
xray_structure=xrs.select(self.model.get_master_selection()),
n_real=se... | |
'attribute_map': {
'month': 'month',
},
'location_map': {
'month': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json;datetime-format=rfc3339'
],
'content_type': [],
},
api_client=api_client,
callable=__get_usage_billable_summary
)
def __get_usage_fargate(
self,
... | |
match
raise: NullArgument - ``grade_id`` is ``null``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.resource.ResourceQuery.match_avatar_id
self._add_match('gradeId', str(grade_id), match)
def clear_grade_id_terms(self):
"""Clears the grade ``Id`` terms.
*... | |
from __future__ import annotations
from typing import Union, Tuple, List
import warnings
import numpy as np
class Question:
"""Question is a thershold/matching concept for splitting the node of the Decision Tree
Args:
column_index (int): Column index to be chosen from the array passed at the matching time.
value... | |
> 0 and Day_1N.iloc[c,7] > 0 and Day_4N.iloc[c,0] == Day_1N.iloc[c,0]:
if Kit_PM_4N_24hr.iloc[c, 6] > 0 and Kit_PM_1N_24hr.iloc[c, 6] > 0 and Kit_PM_4N_24hr.iloc[c, 0] == \
Kit_PM_1N_24hr.iloc[c, 0]:
Kit_per_day_4N_1N.append(Kit_PM_per_day_4N[c]/Kit_PM_per_day_1N[c])
K_PM_D_4N_1N.append(Day_1N.iloc[c,0])
if (... | |
<filename>main_superpixels_graph_classification_ipynb.py
"""
IMPORTING LIBS
"""
import dgl
import numpy as np
import os
import socket
import time
import random
import glob
import argparse, json
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tor... | |
<filename>coralie/coraliepipe.py
import sys
base = '../'
sys.path.append(base+"utils/Continuum")
sys.path.append(base+"utils/Correlation")
sys.path.append(base+"utils/GLOBALutils")
sys.path.append(base+"utils/OptExtract")
baryc_dir= base+'utils/SSEphem/'
sys.path.append(baryc_dir)
ephemeris='DEc403'
import matplotli... | |
#!/usr/bin/env python3
# vim: set expandtab tabstop=4 shiftwidth=4:
#
# Python Starbound Mapper (pystarboundmap)
# Copyright (C) 2018 <NAME>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of sourc... | |
"Colombia"},
"zho": {"official": "\u54E5\u4F26\u6BD4\u4E9A\u5171\u548C\u56FD", "common": "\u54E5\u4F26\u6BD4\u4E9A"}
},
"latlng": [4, -72],
"demonym": "Colombian",
"landlocked": False,
"borders": ["BRA", "ECU", "PAN", "PER", "VEN"],
"area": 1141748,
"flag": "\ud83c\udde8\ud83c\uddf4"
},
{
"name": {... | |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013--2014, <NAME>
# 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 notice, this
# lis... | |
<reponame>psneo/Pesidious<filename>extract_features.py<gh_stars>10-100
import argparse
import glob
from logging import basicConfig, exception, debug, error, info, warning, getLogger
import os
import pickle
import re
import sys
import time
import traceback
# from handlers import TimedRotatingFileHandler
from p... | |
#!/usr/bin/env python
# coding: utf-8
"""
Utilities and functions for working with ALC, other datasets. Includes functions
for reading .Align xml scaling files saved during LA-ICP-MS analysis and
calculating scale factors for images from .Align data.
"""
import os
import operator
import json
from urllib.request impo... | |
from collections import OrderedDict
import dolfin as df
from pathlib import Path
import numpy as np
from fenics_helpers import boundary
from fenics_helpers.timestepping import TimeStepper
import constitutive as c
TEST = True
class MechanicsSpaces:
def __init__(self, mesh, constraint, mesh_function=None):
self.mesh ... | |
north < 0 or north > 360:
srfCornerPtsLL = srfCentroidL = srfCentroid = contextMeshJoined = northRad = northVec = scale = outputGeometryIndex = workingSubFolderPath = horizonFileType = horizonFileTypeLabel = unitConversionFactor = None
validInputData = False
printMsg = "Please input north angle value from 0 to 36... | |
import random
import constants as C
import exceptions as e
class Booster:
def __init__(self, img, income1=False, income2=False,
special=False, vp=False):
self.img = img
self.income1 = income1
self.income2 = income2
self.special = special
self.vp = vp
self.used = False # Only used on boosters with special ac... | |
approximated value
if N_sma >= 5:
step_size = math.sqrt((1 - beta2_t) * (N_sma - 4) / (N_sma_max - 4) * (N_sma - 2) / N_sma * N_sma_max / (N_sma_max - 2)) / (1 - beta1 ** state['step'])
else:
step_size = 1.0 / (1 - beta1 ** state['step'])
buffered[2] = step_size
if group['weight_decay'] != 0:
p_data_fp32.add_(-... | |
numpy.random.SeedSequence or numpy.random.RandomState, optional
Old name for parameter `seed`.
Its usage will not yet cause a deprecation warning,
but it is still recommended to use `seed` now.
Outdated since 0.4.0.
deterministic : bool, optional
Deprecated since 0.4.0.
See method ``to_deterministic()`` for an ... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C): 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Requirements
# - pyvmomi >= 6.0.0.2016.4
# TODO:
# * more jq examples
# * optional folder hierarchy
"""
$ jq '._meta.hostvars[].config'... | |
<gh_stars>0
# Copyright (c) 2013, Preferred Infrastructure, Inc.
# 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 notice,
# this... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.