input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
= 1
start_found = False
for line_num, line in enumerate(csv_reader):
line.remove("")
# Check if data points are continuous and sequential
if not line_num == 0:
try:
if not int(line[self.data_point_col]) == (int(prev_line[self.data_point_col]) + 1):
rais... | |
import numpy as np
from random import choice
## Note: Non-smooth surfaces or bad triangulations may lead to non-spiral orderings of the vertices.
## Common issue in badly triangulated surfaces is that there exist some edges that belong to more than two triangles. In this
## case the mathematical definition of the spir... | |
"content-type": "application/json",
"if-match": kwargs.get("if_match", missing),
"opc-request-id": kwargs.get("opc_request_id", missing)
}
header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing and v is not None}
retry_strategy = self.retry_strategy
if kwargs.get('retry_strategy'):
... | |
return examples
def get_dev_examples(self, data_dir):
"""See base class."""
examples = []
lines = self._read_tsv(os.path.join(data_dir, "dev.txt"))
examples = self._create_examples(lines, "dev")
return examples
def get_test_examples(self, data_dir):
"""See base class."""
examples = []
lines = self._read_tsv... | |
]
way_part2 = way.way[idx:]
break
if idx > 0 and way.way[idx-1].dist > p.dist:
# ref_way.way[0] point doesn't exist, insert it
way_part1 = way.way[:idx] + [ ref_way.way[-1] ]
way_part2 = [ ref_way.way[0] ] + way.way[idx:]
break
way2 = way.make_copy_new_way(way_part2)
way.way = way_part1
r1, w1 = self._adapt_... | |
cell in neuronDict[neuron]["class.ids"].split(","):
specificTissue, generalTissue, classTissue, matchTissue = annotationDict[cell]["specific.tissue"], annotationDict[cell]["general.tissue"], annotationDict[cell]["class.tissue"], annotationDict[cell]["match.tissue"]
if not cell in cellMatrix[neuron]:
c... | |
<gh_stars>0
# MINLP written by GAMS Convert at 01/15/21 11:37:33
#
# Equation counts
# Total E G L N X C B
# 1486 571 111 804 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc si
# Total cont binary integer sos1 sos2 scont sint
# 865 685 180 0 0 0 0 0
# FX 0 0 0 0 0 0 0 0
#
# Nonzero counts
# Total const NL DLL
# 3373 ... | |
"""Test selecting shapes."""
data = 20 * np.random.random((10, 4, 2))
np.random.seed(0)
layer = Shapes(data)
layer.selected_data = {0, 1}
assert layer.selected_data == {0, 1}
layer.selected_data = {9}
assert layer.selected_data == {9}
layer.selected_data = set()
assert layer.selected_data == set()
def test... | |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_bbox_canvas.ipynb (unless otherwise specified).
__all__ = ['points2bbox_coords', 'coords_scaled', 'BBoxCanvas', 'BBoxVideoCanvas']
# Internal Cell
import io
import attr
from math import log
from pubsub import pub
from attr import asdict
from pathlib import Path
from ... | |
index: int
:rtype: ndarray
"""
return self.__GetDataList()[index].Y
def GetXY(self, index: int) -> Tuple[ndarray, ndarray]:
"""Returns the data of spectrum for a specified index.
:type index: int
:rtype: Tuple[ndarray, ndarray]
"""
return self.__GetDataList()[index].XY
def GetBackground(self, index: int) -... | |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | |
<filename>NC_optical_properties_v_alt_variable_coating.py<gh_stars>1-10
from pymiecoated import Mie
import sys
import os
import numpy as np
from pprint import pprint
from datetime import datetime
import mysql.connector
import math
import matplotlib.pyplot as plt
import matplotlib.colors
import calendar
from scipy.optim... | |
a non existing folder %s from %s.' % (
foldername, id_number)
log.warning(log_msg)
return HttpResponseForbidden(
'There is no such folder in %s' % escape(
revision.package.full_name))
revision, removed_attachments, removed_emptydirs = response
return render_json(request,
'json/%s_rmdir.json' % root, {
'revisio... | |
import numpy as np
from ...external.qt.QtGui import (QAction, QLabel, QCursor, QMainWindow,
QToolButton, QIcon, QMessageBox,
QMdiSubWindow)
from ...external.qt.QtCore import Qt, QRect
from .data_viewer import DataViewer
from ... import core
from ... import config
from ...clients.image_client import ImageClient
fr... | |
# -*- coding: utf-8 -*-
import pprint
import sys
import re
import hashlib
import BaseThreadedModule
import Utils
import Decorators
@Decorators.ModuleDocstringParser
class ModifyFields(BaseThreadedModule.BaseThreadedModule):
"""
Simple module to insert/delete/change field values.
Configuration templates:
# Keep ... | |
"required": "number_b",
},
"number_d": {
"name": "The fourth parameter",
"about": "About the fourth parameter",
"type": "number",
"required": "number_b | number_c",
},
"number_e": {
"name": "The fifth parameter",
"about": "About the fifth parameter",
"type": "number",
"required": "number_b & number_d"
},
... | |
in the nodes
graph = {}
for i in nodes_list:
bound = []
for j in range(len(distance_matrix)):
if (not j in exclusion_list) and (not i == j):
if distance_matrix[i][j] < cutoff:
bound.append(j)
graph[i] = bound
return graph # { i : [ a,b,c...], ... }
# vector stuff # TODO use numpy?
def makeCircleOnPlane(ce... | |
<gh_stars>10-100
# Copyright (c) 2020 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
"""
Like gen_kconfig_rest.py, but for generating an index of existing
devicetree bindings.
"""
import argparse
from collections import defaultdict
import glob
import io
import logging
import os
from pathlib import Pat... | |
**kwargs):
return self._call_func("empty_recycle_bin", *args, **kwargs)
def generate_tsig_key(self, *args, **kwargs):
return self._call_func("generate_tsig_key", *args, **kwargs)
def get_all_template_vendor_id(self, *args, **kwargs):
return self._call_func("get_all_template_vendor_id", *args, **kwargs)
def get... | |
<reponame>avrumnoor/NewsSummarizer<filename>venv/lib/python3.8/site-packages/jieba/posseg/prob_trans.py
P={('B', 'a'): {('E', 'a'): -0.0050648453069648755,
('M', 'a'): -5.287963037107507},
('B', 'ad'): {('E', 'ad'): -0.0007479013978476627,
('M', 'ad'): -7.198613337130562},
('B', 'ag'): {},
('B', 'an'): {('E', 'an'... | |
+ m.x915 - m.x936 - m.x943
+ m.x985 + m.x999 + m.x1013 - m.x1034 - m.x1041 + m.x1083 + m.x1097 + m.x1111 - m.x1132
- m.x1139 + m.x1181 + m.x1195 + m.x1209 - m.x1230 - m.x1237 + m.x1279 + m.x1293 + m.x1307
- m.x1328 - m.x1335 >= 0)
m.c3897 = Constraint(expr= m.x594 + m.x608 + m.x622 - m.x643 - m.x650 + m.x692 + m.x7... | |
'매도미체결수량', '매수미체결수량',
'공시', '정보제공', '언론사', '제목']:
item = QtWidgets.QTableWidgetItem(str(df[column][index]))
elif gubun in [ui_num['재무년도'], ui_num['재무분기'], ui_num['동업종비교']]:
try:
item = QtWidgets.QTableWidgetItem(str(df[column][index]))
except KeyError:
continue
elif column not in ['수익률', '등락율', '고저평균대비등락율', '체결... | |
0": {
"image_ver": "Cisco IOS Software, IOSv Software (VIOS-ADVENTERPRISEK9-M), Version 15.6(3)M2, RELEASE SOFTWARE (fc2)",
"uptime_in_curr_state": "1 day, 16 hours, 42 minutes",
"config_register": "0x0",
"curr_sw_state": "ACTIVE"
}
}
}
golden_output_iosv = {'execute.return_value': '''\
Redundant System Infor... | |
<reponame>RahulSajnani/DRACO-Weakly-Supervised-Dense-Reconstruction-And-Canonicalization-of-Objects
'''
Adapted from https://github.com/weiaicunzai/blender_shapenet_render
Author: <NAME>
'''
import sys
import os
import random
import pickle
import bpy
import mathutils
import numpy as np
import json
import glob
from mat... | |
"""
Module for managing container and VM images
.. versionadded:: 2014.7.0
"""
import logging
import os
import pprint
import shlex
import uuid
import salt.syspaths
import salt.utils.kickstart
import salt.utils.path
import salt.utils.preseed
import salt.utils.stringutils
import salt.utils.validate.path
import salt.ut... | |
from bs4 import BeautifulSoup
import requests
import os.path
import re
import pandas as pd
import numpy as np
import csv
import json
from datetime import datetime
from tqdm import tqdm
from collections import defaultdict
from collections import Counter
from IPython.core.display import HTML
import time
import nltk
impor... | |
from math import e, pi, sqrt
from numpy import cos, sin
from numpy import arcsin as asin
from numpy import arccos as acos
from numpy import log as ln
import tensorflow as tf
import random
from OperatorChecker import *
# this is an example of how quantum operator rotations can be mapped to rotations on the bloch sphere
... | |
<reponame>Qu4tro/i3expo
#!/usr/bin/env python3
from xdg.BaseDirectory import xdg_config_home
from PIL import Image, ImageDraw
from threading import Thread
from i3expo.debounce import Debounce
from i3expo.geometry import Geometry, Dimension
import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import logging
im... | |
51], # Was too bright yellow
[166, 86, 40],
[247, 129, 191],
[153, 153, 153],
])/255.
# Steal Kelly's colors from https://gist.github.com/ollieglass/f6ddd781eeae1d24e391265432297538, removing
# black: '222222', off-white: 'F2F3F4', mid-grey: '848482',
kellycolors = ['F3C300', '875692', 'F38400', 'A1CAF1', 'BE00... | |
import datetime as dtm
from profile_plot import profile_plot
import matplotlib.pyplot as plt
from matplotlib.font_manager import fontManager, FontProperties
from matplotlib import ticker, cm
import sys
import pandas as pd
import numpy as np
import os
import re
from dateutil import parser
import errno
from shutil import... | |
# External Dependencies
from re import L
from PIL import ImageDraw, Image
from PIL.ImageOps import autocontrast
import hashlib
import math
import os
import time
# Internal file class dependencies
from . import View
from seedsigner.helpers import B, QR, Keyboard, TextEntryDisplay, mnemonic_generation
from seedsigner.m... | |
import math
import cv2
import numpy as np
import scipy.ndimage.morphology as sc_morph
import skimage.color as sk_color
import skimage.exposure as sk_exposure
import skimage.feature as sk_feature
import skimage.filters as sk_filters
import skimage.morphology as sk_morphology
def rgb_to_grayscale(np_img):
"""
Convert... | |
<reponame>sflis/plms
import os
import sys
import atexit
from subprocess import call
import subprocess
from multiprocessing import Process
import zmq
import time
from time import gmtime, strftime
from datetime import datetime
import inspect
import math
import collections
import pickle
from daemon import Daemon
impo... | |
<reponame>SidneyCodes/textgames
#importing the time module
import time
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("\tA JOURNEY OF OPTIONS")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
coin = 0
life = 7
briefcase = []
line = ""
def intro(): #defining a function with name intro
print("What is your first name?... | |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may ... | |
<reponame>pmassolino/hw-sike
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Implementation by <NAME>,
# hereby denoted as "the implementer".
#
# To the extent possible under law, the implementer has waived all copyright
# and related or neighboring rights to the source code in this file.
# http://creativecommons.org/pub... | |
<reponame>AnnieL01/pike<gh_stars>0
#
# Copyright (c) 2013, EMC Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright not... | |
<reponame>IbHansen/ModelFlow
# -*- coding: utf-8 -*-
"""
This is a module for testing new features of the model class, but in a smaler file.
Created on Sat Sep 29 06:03:35 2018
@author: hanseni
"""
import sys
import time
import matplotlib.pyplot as plt
import matplotlib as mpl
import pa... | |
<reponame>vnguyen7/watchmaker
# -*- coding: utf-8 -*-
"""Watchmaker salt worker."""
from __future__ import (absolute_import, division, print_function,
unicode_literals, with_statement)
import ast
import codecs
import json
import os
import shutil
import yaml
import watchmaker.utils
from watchmaker import static
from... | |
<reponame>hunterluepke/Learn-Python-for-Stats-and-Econ<gh_stars>10-100
import copy
import random
import numpy as np
from scipy.stats.mstats import gmean
from Patch import *
#Agent.py
class Agent():
# **inheritance are the inherited
def __init__(self, model, row, col, ID, parent = None):
def selectParameters(mutat... | |
else:
rec_bet = 'Avoid'
# Test Recommended bet
if total_diff >= 0:
percentage_chance = total_diff
if 60 > percentage_chance >= 0:
test_rec_bet = '1x'
else:
test_rec_bet = '1'
else:
percentage_chance = abs(total_diff)
if 60 > percentage_chance > 0:
test_rec_bet = '2x'
else:
test_rec_bet = '... | |
types=frozenset(['length']),
const=empty_list),
'title': SVGAttribute('title', anim=False,
types=frozenset(['string']),
const=empty_list),
'to': SVGAttribute('to', anim=False,
types=frozenset(['string']),
const=empty_list),
'transform': SVGAttribute('transform', anim=True,
types=frozenset(['transform-lis... | |
#!/usr/bin/env python3
import pickle
import os
import numpy as np
def get_sweep_parameters(parameters, env_config, index):
"""
Gets the parameters for the hyperparameter sweep defined by the index.
Each hyperparameter setting has a specific index number, and this function
will get the appropriate parameters for ... | |
return pulumi.get(self, "deploy_stage_id")
@deploy_stage_id.setter
def deploy_stage_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "deploy_stage_id", value)
@property
@pulumi.getter(name="deploymentArguments")
def deployment_arguments(self) -> Optional[pulumi.Input['DeploymentDeploymentArguments... | |
<reponame>City-of-Helsinki/hauki
import datetime
from operator import itemgetter
from typing import Tuple
import pytz
from dateutil.relativedelta import relativedelta
from django.conf import settings
from django.db import transaction
from django.db.models import Exists, OuterRef, Q
from django.http import Http404
from... | |
expected = 201
received = response.status_code
self.assertEqual(
expected,
received,
msg=STATUS_CODE_MSG.format(
method=method, expected=expected, received=str(received)))
response = self.client.get_object(
container_name,
object_name)
method = 'object retrieval'
expected = 200
received = response.status... | |
obj_attr_list["cloud_vv_type"], \
availability_zone = None, \
imageRef = _imageid)
self.annotate_time_breakdown(obj_attr_list, "create_volume_time", _mark_a)
sleep(int(obj_attr_list["update_frequency"]))
obj_attr_list["cloud_vv_uuid"] = '{0}'.format(_instance.id)
_mark_a = time()
_wait_for_volume = 180
for... | |
"VALUES (%s, %s);", (name, owner))
conn.commit()
cursor.close()
conn.close()
return flask.redirect(flask.url_for('album'))
# retrieve album name from id
def getAlbumName(id):
db = getMysqlConnection()
conn = db['conn']
cursor = db['cursor']
cursor.execute("SELECT name FROM albums WHERE id=%s;", id)
name =... | |
is not None:
for k, v in metrics.items():
self.tb_writer.add_scalar('metrics/{}'.format(k), v, step)
if heavy_logging:
max_B = 16
self.tb_writer.add_video('obs/input',
self.unnormalize(batch['obs_image']).transpose(0, 1)[:max_B], step)
if self.observation_model.decoder is not None:
self.tb_writer.add_video('obs... | |
<reponame>danmichaeljones/blendz
try:
from mpi4py import MPI
MPI_RANK = MPI.COMM_WORLD.Get_rank()
except:
MPI_RANK = 0
from builtins import *
import sys
import os
import warnings
from math import ceil
from multiprocessing import cpu_count
import itertools as itr
import numpy as np
from scipy.integrate import simps
... | |
<filename>testing/databaseTest.py
"""
This scripts runs tests on the database
"""
import os.path
import logging
from external.wip import work_in_progress
from rmgpy import settings
from rmgpy.data.rmg import RMGDatabase
from copy import copy, deepcopy
from rmgpy.data.base import LogicOr
from rmgpy.molecule import Grou... | |
<reponame>syrte/halotools
""" Common functions used to rotate three dimensional vectors
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
__all__ = ('elementwise_dot', 'elementwise_norm', 'normalized_vectors',
'angles_between_list_of_vectors', 'vectors_normal_... | |
constant node types
__slots__ = ("value",)
class Num(Constant):
# inherited class for all numeric constant node types
__slots__ = ()
_translated_fields = {"n": "value"}
@property
def n(self):
# TODO phase out use of Num.n and remove this
return self.value
def validate(self):
if self.value < SizeLimits.MIN... | |
import sys
import cPickle
import warnings
import numpy as np
from scipy.stats import pearsonr
from matplotlib import pyplot as plt
import emcee
from emcee.utils import MPIPool
from pysb.integrate import Solver
from bax_insertion.models import multiconf
def posterior(position, gf):
"""A generic log posterior function.... | |
for reserved instances,
and at least equal to a given value for on-demand instances.
This is used mainly in phase II to ensure that reserved instances
are fixed, or to allow to keep at least some number of on-demand
instances running from previous timeslots, when using "guided"
strategies"."""
if self.fixed_vms ... | |
short_domain = short_domain[:-1]
short_domain = short_domain + "_"
ctr = 0
found = 0
for t in port_types:
if t.startswith(short_domain):
found = ctr
iter = self.network_port_type_combolist.append()
self.network_port_type_combolist.set_value(iter, 0, t)
ctr += 1
self.network_port_type_combobox.set_active(found... | |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.... | |
0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.192298,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic':... | |
<reponame>yuxiang-zhou/menpo
from warnings import warn
import numpy as np
from menpo.base import Vectorizable, MenpoDeprecationWarning
from menpo.transform.base import (Alignment, ComposableTransform,
VComposable, VInvertible)
class HomogFamilyAlignment(Alignment):
r"""
Simple subclass of Alignment that adds the... | |
<reponame>johnathanlouie/PyAeonDB
from typing import List, Set, Dict, Tuple
import csv
import os
import json
import time
import datetime
Table = List[str]
Index = Dict[str, List[int]]
Fuzzy = Dict[str, List[str]]
ROOT_PATH = "C:/Arcology/AeonDB"
TABLE_DIR = "C:/Arcology/AeonDB/%s"
TABLE_PATH = "C:/Arcology/AeonDB/%s/... | |
- m.b756 <= 0)
m.c805 = Constraint(expr= - m.b276 + m.b277 - m.b757 <= 0)
m.c806 = Constraint(expr= - m.b277 + m.b278 - m.b758 <= 0)
m.c807 = Constraint(expr= - m.b278 + m.b279 - m.b759 <= 0)
m.c808 = Constraint(expr= - m.b279 + m.b280 - m.b760 <= 0)
m.c809 = Constraint(expr= - m.b280 + m.b281 - m.b761 <= 0)
m.c8... | |
"""Plot Offline RL."""
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.style.use('seaborn')
import seaborn as sns # Daniel: not sure if needed
# https://stackoverflow.com/questions/43080259/
# no-outlines-on-bins-of-matplotlib-histograms-or-seaborn-distplots/43080772
plt.rcParams["patch.forc... | |
#!/usr/bin/env python
from io import StringIO
import unittest
import numpy as np
from weblogo import data
from weblogo.matrix import AlphabeticArray, Motif, SubMatrix
from weblogo.seq import protein_alphabet, Alphabet, unambiguous_protein_alphabet
from . import data_stream
class test_AlphabeticArray(unittest.TestC... | |
NaN
image N string NaN
imagescale N boolstring NaN
orientation N double NaN
regular N bool NaN
samplepoints N int NaN
shape N shape NaN
shapefile N string NaN
sides N int NaN
skew N double NaN
width N double NaN
z N double NaN
"""
# TODO: make a gridsearchable config for layouts
@staticmethod
def get_pa... | |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# <NAME>
# California Institute of Technology
# (C) 1998-2003 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
import journal
class ... | |
<filename>tefla/core/special_layers.py
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import ops
import pydensecrf.densecrf as dcrf
from .layers import conv2d, depthwise_conv2d, avg_pool_2d, \
max_pool, relu, crelu, batch_norm_tf as batch_norm
from ..utils import util
from . import initial... | |
input_file_name = string_input_file.get()
string_cam_file.set(input_file_name[0:-4]+'.sbp')
cad.cam = 'sbp'
cam_pack_forget()
cam_file_frame.pack()
cam_vector_frame.pack()
cam_dia_frame.pack()
cam_contour_frame.pack()
jog_frame.pack()
speed_frame.pack()
string_tool_dia.set("0.125")
string_xy_speed.set("1.1")... | |
#!/usr/bin/python
row_0 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]
row_m1 = [24, 26, 31, 32, 38, 42]
row_m2 = [2, 6, 8, 16, 36, 48]
row_m3 = [6, 7, 9, 18, 27, 46]
row_m4 = ... | |
"""
.. module: historical.tests.test_proxy
:platform: Unix
:copyright: (c) 2017 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. author:: <NAME> <<EMAIL>>
"""
import json
import math
import os
import sys
import time
from datetime import datetime
import boto3
import pytest # p... | |
import numpy as np
import matplotlib.pyplot as plt
from math import pi
import math, os, datetime
class data_manipulation_module:
def __init__(self):
self.a = 1
self.list_x = None
self.list_y = None
def init_graph_list(self):
self.list_x = []
self.list_y = []
def add_graph_list(self, element_x, element_y):
... | |
<gh_stars>0
#!/usr/bin/env python2
import sys
import os
import pickle
import errno
import random
class RenPyArchive:
file = None
handle = None
files = {}
indexes = {}
version = None
padlength = 0
key = None
verbose = False
RPA2_MAGIC = 'RPA-2.0 '
RPA3_MAGIC = 'RPA-3.0 '
def __init__(self, file = Non... | |
fnodes = global_mesh.nodes[ends[0]].get('far')
dmask = mask + 0
did = 0
while True:
did += 1
dmask = cv2.dilate(dmask, np.ones((3, 3)), iterations=1)
if did > 3:
break
ffnode = [fnode for fnode in fnodes if (dmask[fnode[0], fnode[1]] > 0 and mask[fnode[0], fnode[1]] == 0 and\
global_mesh.nodes[fnode].get('inpa... | |
<reponame>m1griffin/arrayfunc
#!/usr/bin/env python3
##############################################################################
# Project: arrayfunc
# Purpose: Generate the C code for math operations.
# Language: Python 3.4
# Date: 30-Dec-2017
#
#####################################################################... | |
4 , int , 0 , 255 )
PlotBg = ThemeElementTData( 1 , 0 , 6 , 4 , int , 0 , 255 )
PlotBorder = ThemeElementTData( 1 , 0 , 7 , 4 , int , 0 , 255 )
LegendBg = ThemeElementTData( 1 , 0 , 8 , 4 , int , 0 , 255 )
LegendBorder = ThemeElementTData( 1 , 0 , 9 , 4 , int , 0 , 255 )
LegendText = ThemeElementTData( 1 , 0 , 10 ... | |
siz} = {1, 1, 1})
def test_wo_zp_stk_relative_indirect_word(self):
stdout = StringIO()
mon = Monitor(stdout = stdout)
mpu = mon._mpu
mpu.osx = True; mpu.ind = True; mpu.siz = True;
# write kernel stack relative indirect byte
mpu.p = mpu.p | 0x20 # set Mode bit
mpu.pc = 0x200
mpu.sp[1] = 0x1FD
self.outV... | |
spins
that.S1 = R( this.S1, start_index ); that.S2 = R( this.S2, start_index )
that.X1 = R( this.X1, start_index ); that.X2 = R( this.X2, start_index )
# * initial angular momenta
that.L1 = R( this.L1, start_index ); that.L2 = R( this.L2, start_index )
# * initial positions / position time series / maybe velocitie... | |
<filename>qiskit/chemistry/aqua_extensions/components/variational_forms/uccsd.py
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root director... | |
to solve at point",um
return None
solver.setBiasConfig([])
d1 = robot.distance(n.qa,qm)
d2 = robot.distance(qm,n.qb)
#print d1,d2
#print qm,"->",robot.getConfig()
qm = robot.getConfig()
d1 = robot.distance(n.qa,qm)
d2 = robot.distance(qm,n.qb)
dtotal += d1+d2 - d0
if dtotal > dorig*growthTol or (d1 > scalec... | |
# Copyright 2019-2020 QuantumBlack Visual Analytics Limited
#
# The methods found in this file are adapted from a repository under Apache 2.0:
# eBay's Pythonic Bayesian Belief Network Framework.
# @online{
# author = {<NAME>,<NAME>},
# title = {bayesian-belief-networks},
# organisation = {eBay},
# codebase = {https://... | |
initialized from pretrained model` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.
The warning `Weights from XXX not used in YYY` means that the layer XXX is not used by YYY, therefore those
weights are disc... | |
= 0.17 )
########################################################################
# Plotting funcitons that dont have supported dependencies
########################################################################
def get_power_spectrum_RProfile(yprof_path, rprof_path, r0, t_lim=None, t_res=None, l_max=6):
'''
Calc... | |
ract in replayactions:
item = getitem(ract, "addChatItemAction", "item", "liveChatTextMessageRenderer")
if item:
addchatitem(item)
item = getitem(act, "addChatItemAction", "item", "liveChatTextMessageRenderer")
if item:
addchatitem(item)
return cmtlist, ms
def monitorchat(self, js):
while True:
cont = geti... | |
<filename>weak_strong_convergence_revision.py
from l96 import l96
from l96 import l96_jacobian
from l96 import alpha
from l96 import rho
import numpy as np
import pickle
import ipdb
import sys
########################################################################################################################
# Eul... | |
<filename>CMS/calibration_rhod.py<gh_stars>0
#! /usr/bin/env python3
from argparse import ArgumentParser
import csv
from datetime import datetime
import logging
import json
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
from pathlib import Path
import optuna
import cmsmodel
import hatmode... | |
u'AA', u'AE', u'AF', u'AG', u'AO', u'CI',
u'E8', u'IA', u'MA'])
),
Element(
u'AAA04', Properties(
desc=u'Follow-up Action Code', req_sit=u'R',
data_type=(u'ID', u'1', u'1'), position=4,
codes=[u'C', u'N', u'R', u'W', u'X', u'Y'])
),
),
parsed_271_2115D,
Segment(
u'MSG', Properties(
syntax=u'C0302', positio... | |
import logging
from collections import Counter
from pathlib import Path
from typing import Dict, List, Optional, Set, Union
import jsonschema
import pyam
import pydantic
import yaml
from nomenclature.codelist import PYAM_AGG_KWARGS
from nomenclature.definition import DataStructureDefinition
from nomenclature.error.reg... | |
os.path.exists(fig_path)):
os.makedirs(fig_path)
plt.savefig(os.path.join(fig_path, fig_name),
pad_inches=1,
bbox_inches='tight')
plt.close(fig)
def variable_genes(adata,
show_texts=False,
n_texts=10,
size=8,
text_size=10,
pad=1.08,
w_pad=None,
h_pad=None,
fig_size=(4, 4),
save_fig=None,
fig_path=None,... | |
<filename>plugins/levelops-gcloud.py
#!/usr/bin/env python
##################################################################
# Copyright (C) 2019-2020 LevelOps Inc <<EMAIL>>
#
# This file is part of the LevelOps Inc Tools.
#
# This tool is licensed under Apache License, Version 2.0
#################################... | |
if realAddr not in self.goTo:
self.goTo.append(realAddr)
unknown.add(realAddr)
return unknown
HIGHLIGHT_OPS = {'Yield': '#ff00ff',
'Gosub': '#ff00ff',
'Return': '#ff00ff'}
INVOC_THRESHOLDS = [0, 1, 2, 10, 100, 1000]
PAGE_THRESHOLDS = [0, 1, 2, 8, 64, 256]
def graphStr(self, schemaInfo):
def bar(count, thresh... | |
<gh_stars>10-100
from collections import namedtuple
import numpy as np
from os.path import join, dirname
import pandas as pd
from scipy.interpolate import splrep, splev
from scipy.stats import norm
from ...util import ResError
_P = namedtuple('PowerCurve', 'ws cf')
_synthetic_power_curve_data = None
def synthetic_p... | |
""" models of Generators, Endoders and Discriminators at various image sizes
following deep convolutionnal model of DCGAN
cf https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html
and https://github.com/pytorch/examples/tree/master/dcgan
the final non linearity of the generator should be tanh ( positive and ... | |
:data:`False` or a string).
:returns: A dynamically constructed subclass of
:class:`custom_property` with the given options.
To construct an instance:
:param args: The first positional argument is the function that's
called to compute the value of the property.
:returns: A :class:`custom_property` instance corr... | |
<filename>mapss/static/packages/arches/tests/importer/jsonld_import_tests.py
import os
import json
import csv
import base64
import datetime
from io import BytesIO
from tests import test_settings
from operator import itemgetter
from django.core import management
from django.test.client import RequestFactory, Client
from... | |
Path being processed
3. segment_index (int) Segment index of the YAML Path to process
Keyword Arguments:
* parent (ruamel.yaml node) The parent node from which this query
originates
* parentref (Any) The Index or Key of data within parent
* traverse_lists (Boolean) Indicate whether KEY searches against lists
ar... | |
#!/usr/bin/env python3
import os
import time
import scipy
import mnist
import pickle
import matplotlib
import numpy as np
import itertools as it
from numpy import random
matplotlib.use("agg")
from matplotlib import pyplot as plt
from scipy.special import softmax
mnist_data_directory = os.path.join(os.path.dirname(__f... | |
name,
mode,
rule_type,
platform,
compiler.get_compiler_for_current_buildfile(),
)
)
passthrough_args.append(
"--build-info-build-mode=" + info.build_mode,
)
passthrough_args.append("--build-info-build-tool=buck")
if info.package_name != None:
passthrough_args.append(
"--build-info-package-name=" + info.pac... | |
# Copyright 2016 Dravetech AB. All rights reserved.
#
# The contents of this file are 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 req... | |
<gh_stars>1-10
import concurrent.futures
from copy import deepcopy, copy
from functools import partial
import json
import math
import os
from os.path import join
from time import time, sleep
from pathos.multiprocessing import ProcessPool, ThreadPool
from threading import Lock
from cloudvolume import Storage
from clou... | |
{1:7 , 2:6, 3:5, 4:4, 5:3, 6:2, 7:1 }
for i in items_recoded:
df[i] = df[i].map(recoder).astype('float64')
#Calculate total score as the sum of Item 1-28.
cols = ['BPS_1','BPS_2','BPS_3',
'BPS_4','BPS_5','BPS_6',
'BPS_7','BPS_8','BPS_9',
'BPS_10','BPS_11','BPS_12',
'BPS_13','BPS_14','BPS_15',
'BPS_16','BPS_17... | |
('pad_xx', c_char * 100) )
plist.append( ('rhi_user25', c_float) )
plist.append( ('rhi_user26', c_float) )
plist.append( ('rhi_user27', c_float) )
plist.append( ('rhi_user28', c_float) )
plist.append( ('rhi_user29', c_float) )
plist.append( ('rhi_user30', c_float) )
plist.append( ('rhi_user31', c_float) )
plist... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.