input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from deepracer_msgs/SetVisualColorRequest.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import std_msgs.msg
class SetVisualColorRequest(genpy.Message):
_... | |
468342 * uk_82
+ 369117 * uk_83
+ 79380 * uk_84
+ 559629 * uk_85
+ 861273 * uk_86
+ 369117 * uk_87
+ 877212 * uk_88
+ 691362 * uk_89
+ 2242306609 * uk_9
+ 148680 * uk_90
+ 1048194 * uk_91
+ 1613178 * uk_92
+ 691362 * uk_93
+ 544887 * uk_94
+ 117180 * uk_95
+ 826119 * uk_96
+ 1271403 * uk_97
+ 544887 * ... | |
#!/usr/bin/env python3
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
"""Class Client and method multithread_upload.
:class:`Client` can send POST, PUT, and GET requests to the TensorBay Dataset Open API.
:meth:`multithread_upload` creates a multi-thread framework for uploading.
"""
import logging
impor... | |
'''
Functions for loading and slicing data
'''
from datetime import datetime
from pkg_resources import resource_filename
import numpy as np
from scipy.io import loadmat
__all__ = ['get_data',
'get_samplerate_mstimer',
'get_samplerate_datetime',
'_sliding_window',
'rolling_mean',
'outliers_iqr_method',
'outlier... | |
the value of `layer_5_directional_back_absoptance_matrix_name` or None if not set
"""
return self["Layer 5 Directional Back Absoptance Matrix Name"]
@layer_5_directional_back_absoptance_matrix_name.setter
def layer_5_directional_back_absoptance_matrix_name(self, value=None):
"""Corresponds to IDD field `Layer 5 ... | |
won't get drawn until plot is drawn.
#
if(fill_x):
plot.polygon.append(add_polygon(wks,plot, \
polygon_y[0:ppts2+3], \
polygon_x[0:ppts2+3],gsres))
else:
plot.polygon.append(add_polygon(wks,plot, \
polygon_x[0:ppts2+3], \
polygon_y[0:ppts2+3],gsres))
#
# Advance polygon counter.
#
npoly = npoly + 1
bpt = -1 #... | |
<filename>stockgeist/client.py
from typing import Tuple, Dict, List
import pandas as pd
import requests
from tqdm import tqdm
from stockgeist.responses import ArticleMetricsResponse, MessageMetricsResponse, PriceMetricsResponse, \
RankingMetricsResponse, TopicMetricsResponse, SymbolsResponse, FundamentalsResponse
... | |
`__getitem__(kwargs)`,
- A list is returned, not a subspace.
- This list constains keys (coords), not values.
- The coords refer to the original space, not the subspace.
The last point is especially useful for
`SparseSpace.label_xSection`.
"""
def embed(coord): return {**kwargs, **coord._asdict()}
return [sel... | |
# PyGEP: Gene Expression Programming for Python
# Copyright (C) 2007 <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 2 of the License, or
# (at your option) any later ver... | |
from django import forms
class EmptyForm(forms.Form):
pass
class LoginForm(forms.Form):
username = forms.CharField(
max_length=50,
label='Username'
)
password = forms.CharField(
max_length=32,
label='Password',
widget=forms.PasswordInput(),
required=True
)
class DeleteForm(forms.Form):
verify = forms.Cha... | |
<reponame>joeedh/Fairing.blend
from . import util, shadow
from . import simplemesh
import bpy, bmesh, time, random
from bpy_extras import view3d_utils
from mathutils import *
from math import *
from bpy.props import *
import bgl
import blf
class AXES:
X = 1
Y = 2
Z = 4
colormap = [
Vector([0, 0, 1, 1]),
Vecto... | |
from math import sin, cos, pi
import os
import numpy as np
from math import cos, sin, sqrt, pi
import random
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use("TkAgg")
from numpy import arange, sin, pi
from matplotlib import cm, colors
import matplotlib.animation as animation
import sys
import matplotlib... | |
3: {
'sid': 16063,
'sid_type': 'Prefix-SID',
'local_address': '10.169.196.241',
},
},
},
},
},
},
},
'attributes': {
'binding_sid': {
15000: {
'allocation_mode': 'explicit',
'state': 'programmed',
},
},
},
'forwarding_id': '65536',
'stats': {
'packets': 44,
'bytes': 1748,
},
'event_history': {
... | |
contract where each key is a
``string`` of the year, such as '2017' and each value is a
``dictionary`` with the ``string`` key-value pairs of the player's age,
team name, and salary.
"""
return self._contract
@_int_property_decorator
def games(self):
"""
Returns an ``int`` of the number of games the player pa... | |
import sys
from pathlib import Path
import cv2
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset
import torchvision
from torchvision import transforms
import torchvision.transforms.functional as F
from skimage.util import random_noise
from dataloading.camera import Camera
cl... | |
pulumi.get(self, "names")
@pulumi.output_type
class AccessPolicyRequireSaml(dict):
@staticmethod
def __key_warning(key: str):
suggest = None
if key == "attributeName":
suggest = "attribute_name"
elif key == "attributeValue":
suggest = "attribute_value"
elif key == "identityProviderId":
suggest = "identity_pr... | |
<reponame>cuill/PyFVCOM<gh_stars>1-10
"""
A series of tools with which tidal data can be extracted from FVCOM NetCDF
model results. Also provides a number of tools to interrogate the SQLite
database of tidal data collated from a range of sources across the north-west
European continental shelf.
"""
from __future__ im... | |
= player.clear_votes
if not await self.is_dj(ctx):
mbrs = my_vc.members
settings = await SettingsDB.get_instance().get_guild_settings(ctx.guild.id)
percent = settings.vote
reqvotes = (
(len([1 for m in mbrs if not m.bot and not m.voice.self_deaf and not m.voice.deaf])) / (100 / percent))
voter = ctx.message.aut... | |
# Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | |
+ 2*m.b303*
m.b729 + 2*m.b304*m.b305 - 2*m.b304*m.b878 - 2*m.b304*m.b1005 - 2*m.b305*m.b729 + 2*m.b305*
m.b1006 + 2*m.b306*m.b307 - 2*m.b307 + 2*m.b307*m.b384 + 2*m.b307*m.b522 - 4*m.b522 - 2*m.b307*
m.b1007 + 2*m.b308*m.b309 - 4*m.b309 + 2*m.b308*m.b778 + 2*m.b309*m.b386 + 2*m.b386 + 2*m.b309*
m.b522 + 2*m.b309*m.... | |
n.replace(' ', ',').split(',') if x != ''])
# flatten result and remove dupes
return list(set([y for x in result for y in x]))
def filter_wip(n, d):
return d.get('mode', 'enabled') in ['wip', 'enabled']
def filter_enabled(n, d):
return d.get('mode', 'enabled') == 'enabled'
def filter_disabled(n, d):
return d... | |
<filename>network_library.py
"""This file implements a neural network library 'from scratch', i.e.
only using numpy to implement the matrix data structures used to construct
neural networks. Precisely, you can use this library to create
fully-connected neural networks; this library does not support the creation
of ... | |
= 'disconnect'
logging.debug('condition_disconnect() returning %s' % disconnect_ok)
return disconnect_ok
def handle_getstate(self, body):
logging.debug('handle_getstate()')
return create_msg(self.state, body=self.cmstate_levels())
# returns last transition plus current state
def handle_getstatus(self, body):
... | |
# Copyright (c) 2020 ING Bank N.V.
#
# 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, distr... | |
will be removed from the Inventory. This action CANNOT be undone!',
'Do you want to cancel this sent shipment? The items will be returned to the Inventory. This action CANNOT be undone!': 'Do you want to cancel this sent shipment? The items will be returned to the Inventory. This action CANNOT be undone!',
'Do you want... | |
+ 2 * Ad[3, 1] + Ad[3, 2]) * (t0 - 1) + (
Ad[3, 0] + Ad[3, 1] + Ad[3, 2] + Ad[3, 3]
)
else:
Phi0_0 = (
Ad[0, 0] * tp0_0
+ Ad[0, 1] * tp0_1
+ Ad[0, 2] * tp0_2
+ Ad[0, 3] * tp0_3
)
Phi0_1 = (
Ad[1, 0] * tp0_0
+ Ad[1, 1] * tp0_1
+ Ad[1, 2] * tp0_2
+ Ad[1, 3] * tp0_3
)
Phi0_2 = (
Ad[2, 0] * tp0_0
+ Ad[2, ... | |
--*
An object containing a set of identities and associated mappings.
- *(dict) --*
A description of the identity.
- **IdentityId** *(string) --*
A unique identifier in the format REGION:GUID.
- **Logins** *(list) --*
The provider names.
- *(string) --*
- **CreationDate** *(datetime) --*
Date on which t... | |
Y).
double_lb = find_lb(DX, DY)
double_ub = find_ub(
DX, DY, mapping_sample_size_order=mapping_sample_size_order, double_lb=double_lb)
return 0.5 * double_lb, 0.5 * double_ub
def find_lb(DX, DY):
"""
For X, Y metric spaces induced by simple unweighted graphs, find
lower bound of mGH(X, Y).
Parameters
-----... | |
<reponame>zhangym-7/QT4A
# -*- coding: UTF-8 -*-
#
# Tencent is pleased to support the open source community by making QTA available.
# Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may not use this
# file except in compliance w... | |
password
if account_type:
self.account_type = account_type
if service:
self.service = service
if source:
self.source = source
self.ProgrammaticLogin(captcha_token, captcha_response)
def GenerateAuthSubURL(self, next, scope, secure=False, session=True):
"""Generate a URL at which the user will login and be r... | |
<gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: <NAME>
# Note: Requires Python 3.3.x or higher
desc = "formatting template for all files"
# Color values from http://pathofexile.gamepedia.com/Item_filter_guide
color = {
"normal": "200 200 200",
"magic": "136 136 255",
"rare": "255 255 119",
"uniq... | |
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2021
#
# 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
# r... | |
Op.callsub, subroutine3),
TealOp(None, Op.retsub),
]
l1Label = LabelReference("l1")
mainOps = [
TealOp(None, Op.int, 1),
TealOp(None, Op.store, 255),
TealOp(None, Op.txn, "Fee"),
TealOp(None, Op.int, 0),
TealOp(None, Op.eq),
TealOp(None, Op.bz, l1Label),
TealOp(None, Op.int, 100),
TealOp(None, Op.callsub, ... | |
#############################################################################
#
#
# BF-Assist c7-branch
#
#
#############################################################################
""" This is the top/root module of bf-assist. A software that's supposed to assist with the administration and
maintenance of Battlefi... | |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate Leakage': 0.00662954,
'Peak Dynamic': 0.0,
'Runtime Dynamic': 0.0,
... | |
#-------------------------------------
# Project: Transductive Propagation Network for Few-shot Learning
# Date: 2019.1.11
# Author: <NAME>
# All Rights Reserved
#-------------------------------------
import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.autograd import Variable
import n... | |
dims=outdimnames, attrs=outattrs)
else:
outdata = outdata[:]
outarr = outdata
return outarr
def _get_numfiles(wrfseq):
"""Return the number of files in the sequence.
This function will first try to call the builtin :meth:`len` function, but
if that fails, the entire squence will be iterated over and co... | |
edge whose key we are getting
Returns:
The canonical edge key
"""
return self.canonical_edge_keys[edge]
def _add_edge_key(self, u_agent: Agent, v_agent: Agent):
"""Creates a canonical edge key for the pair of nodes.
Args:
u_agent: the u node agent
v_agent: the v node agent
"""
edge_key = (u_agent, v_agent)... | |
'id': not_id
})
not_check = Notifications_Model.query.filter_by(
title='{} liked your post'.format(user.name)).filter_by(body=post.title).first()
if not_check is not None:
not_check.checked = False
else:
db.session.add(notify)
user.liked_posts = like
db.session.commit()
return make_response(response, 200)
... | |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distributed ... | |
from your character's IC point of view. Descriptions
should be written in first person. Old relationships are never
erased - when they are changed, the old relationship notes are
stored with a timestamp to show how the relationship changed over
time. Dates of relationship changes will be noted in a character's
tim... | |
* phe[k][i] / 2.
xqi1[k] = xqi0[k] * rpower[k][la]
if rpower[k][lap] != 0.:
xqi2[k] = xqi0[k] / rpower[k][lap]
else:
xqi2[k] = 0.
xouti += xqi2[k]
xqj0[k] = dr[k] * phe[k][j] * phe[k][j] / 2.
xqj1[k] = xqj0[k] * rpower[k][la]
if rpower[k][lap] != 0.:
xqj2[k] = xqj0[k] / rpower[k][lap]
else:
xqj2[k] = 0.
... | |
# ___________________________________________________________________________
#
# Prescient
# Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
# This software is distri... | |
to reduce redundant features first
before comparing different clusters, or you could also interpret the
important features further after obtaining the important features.
For details about xgboost parameters, check the following links:
[1] https://www.analyticsvidhya.com/blog/2016/03/\
complete-guide-parameter-tu... | |
2210, 2220, 2229, 2237, 2244, 2250, 2255,
282, 2211, 2221, 2230, 2238, 2245, 2251, 2256,
1607, 283, 119, 120, 121, 122, 123, 124,
125, 126, 127, 20, 176, 2476, 188, 32,
176, 2567, 2688, 188, 2487, 2798, 2608, 200,
200, 44, 176, 2567, 2688, 188, 2568, 5526,
2689, 2798, 2799, 200, 2498, 2897, 2619, 2897,
2898, 272... | |
<gh_stars>0
import random
import string
from datetime import datetime
from lxml.etree import XML
import asyncio
import json
import os
import shutil
import tempfile
import unittest
import unittest.mock
import urllib.request
from cate.core.ds import DATA_STORE_REGISTRY, DataAccessError, DataStoreNotice
from cate.ds.esa_c... | |
#!/usr/bin/env python
import os
from grr.lib import access_control
from grr.lib import aff4
from grr.lib import config_lib
from grr.lib import data_store
from grr.lib import email_alerts
from grr.lib import flags
from grr.lib import flow
from grr.lib import hunts
from grr.lib import rdfvalue
from grr.lib import test... | |
<filename>backend/resources/packageManagement.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:jingtongyu
# datetime:2020/6/8 10:14 下午
# software: PyCharm
from flask import g
from models.packages import PackageModel
from models.carts import CartsModel
from flask_restful import Resource, inputs
from models.mall... | |
from lib.game_agent import GameAgent
from lib.machine_learning.context_classification.context_classifiers import CNNInceptionV3ContextClassifier
from lib.sprite import Sprite
import lib.cv
import lib.ocr
from .helpers.ocr import preprocess as ocr_preprocess
from .helpers.game import parse_game_board, generate_game_... | |
dense], axis=-1)
return x + x_init
def clown_conv(x, channels, opt, use_bias=True, scope='clown', z=None):
split_ch = channels//8
half_split_ch = split_ch//2
other_half_split_ch = split_ch - half_split_ch
rest_split = channels - split_ch*7
deconv4_ch = split_ch + rest_split
conv5_ch = split_ch
no_deconv2 =... | |
#!/usr/bin/python
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | |
'Uniprot']
sharma = sharma.drop(['Protein names', 'PEP', 'Sequence coverage [%]', 'Protein IDs'], axis=1)
sharma4o_df = pd.wide_to_long(sharma4o, stubnames='Log2LFQintensity',
i=['Uniprot', 'gene_names', 'molecular_weight_kDa'],
j='sample_id', sep='_', suffix=r'\w+')
sharma4o_df = sharma4o_df.reset_index()
sh... | |
params=params, timeout=300)
lock_status.raise_for_status()
if lock_status.json().get('data'):
if count == 0:
LOGGER.warning('Study %s has been locked', study)
LOGGER.warning('Lock info:\n%s', lock_status.json())
return True
return False
except (requests.exceptions.HTTPError,
requests.exceptions.ConnectionError... | |
def __init__(self, norm_df, paras, window_s=5.0, speed_range=(1,60),
plot_final=False, plot_progress=False, save_dir='./'):
"""
Initialize the algorithm
:param norm_df: the data used for detecting a vehicle. Columns are:
'pir_0x0', 'pir_1x0', ..., 'ultra', 'Tamb_1', 'Tamb_2'
:param paras: the parameters used for ... | |
ksize=20,
do_partition=False,
annotate_partitions=False,
stop_big_traverse=False):
script = 'load-graph.py'
args = ['-x', str(min_hashsize), '-N', str(n_hashes), '-k', str(ksize)]
outfile = utils.get_temp_filename('out')
infile = infilename
args.extend([outfile, infile])
utils.runscript(script, args)
ht_f... | |
#!/usr/bin/env python3
#Works on at least Python 3.6 from what I've tried, although most testing
#has been done on Python 3.7.
import sys
import os
#version string
#this changed significantly, but I've been standardizing them now
#X.Y-release will always be newer than X.Y-beta
#2.9 will always be earlier than 2.10
ezp... | |
x: len(x[:-1]) > 0, lines)
for line in lines:
data = re.split("\s+", line)
if data[0] == "//":
break
if line[0] == '#':
if data[0] == "#=GC":
id, fragment = data[1:3]
else:
self.mComments.append(line)
continue
if id not in annotations:
annotations[id] = []
annotations[id].append(fragment)
else:
if le... | |
<gh_stars>0
import pdb
import openmdao
import openmdao.api as om
import numpy as np
from typing import Dict, Any, Tuple
class Fan:
@staticmethod
def inlet_broadband(settings:Dict[str, Any], theta: np.float64, M_tip: np.float64, tsqem: np.float64, M_d_fan: np.float64, RSS_fan: np.float64) -> np.float64:
"""
Comp... | |
from pypy.conftest import gettestobjspace
import sys
import py
from pypy.tool.udir import udir
def setup_module(mod):
mod.space = gettestobjspace(usemodules=['_socket'])
global socket
import socket
mod.w_socket = space.appexec([], "(): import _socket as m; return m")
mod.path = udir.join('fd')
mod.path.write('fo... | |
exception_status(self) -> dict:
return self.__exception_status
@exception_status.setter
def exception_status(self, value: dict):
self._property_changed('exception_status')
self.__exception_status = value
@property
def sales_coverage(self) -> dict:
return self.__sales_coverage
@sales_coverage.setter
def sa... | |
<gh_stars>0
import asyncio
from typing import Callable, Iterable, Optional, Tuple, Union
import aiohttp
from discord.ext import commands
try:
import discord
import youtube_dl
has_voice = True
except ImportError:
has_voice = False
if has_voice:
youtube_dl.utils.bug_reports_message = lambda: ""
ydl = youtube_dl... | |
<reponame>byfilip/streamxmlwriter
#!/usr/bin/env python
"""
streamxmlwriter - A simple library for incrementally writing XML
files of arbitrary size. Supports pretty-printing and custom attribute
ordering. Experimental namespace support.
In development; poor documentation and tests; may eat your children.
The latest d... | |
# (c) Copyright [2018-2021] Micro Focus or one of its affiliates.
# 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... | |
verify=False)
if phantom.is_fail(ret_val):
return ret_val, None
phantom_base_url = resp_json.get('base_url')
if not phantom_base_url:
return action_result.set_status(phantom.APP_ERROR, status_message=MATTERMOST_BASE_URL_NOT_FOUND_MSG), None
return phantom.APP_SUCCESS, phantom_base_url
def _get_asset_name(self,... | |
<gh_stars>0
# Copyright (c) 2017-2019, <NAME>
# Copyright (c) 2014-2018, iocage
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyrig... | |
warmup_begin_lr=self.warmup_begin_lr, warmup_steps=self.warmup_steps,
),
'poly': mx.lr_scheduler.PolyScheduler(
max_update=self.cycle_length, base_lr=self.base_lr, pwr=2, final_lr=self.min_lr,
),
'cycle': CyclicalSchedule(
TriangularSchedule, min_lr=self.min_lr, max_lr=self.max_lr, cycle_length=self.cycle_length,... | |
#!/usr/bin/env python3
import os
from datetime import datetime, timedelta
import errno
import time
import USBKey
class Files():
import sys
import csv
from datetime import datetime, date, time, timedelta
import os
from os import path
import shutil
# import urllib # for python 3 : import urllib.request
import ... | |
-2, -2]
disaster -3.1 0.83066 [-2, -4, -4, -3, -3, -2, -4, -3, -2, -4]
disasters -2.6 0.8 [-2, -2, -3, -1, -3, -3, -2, -4, -3, -3]
disastrous -2.9 0.53852 [-2, -2, -3, -3, -3, -3, -4, -3, -3, -3]
disbelieve -1.2 0.87178 [-1, -2, -1, -2, -1, 0, 0, -1, -3, -1]
discard -1.0 0.44721 [-1, -1, -1, -1, 0, -1, -1, -1, -2, -1]
... | |
**self.directory._upload_lookup(conn, cur, object, self.job))
def upload_chunk_from_file(self, position, input, client_context, nbytes, metadata={}):
return self.directory.upload_chunk_from_file(self, position, input, client_context, nbytes, metadata)
def get_content(self, client_context, get_data=True):
self.enf... | |
<gh_stars>1-10
'''
Verify correct log retention behavior.
'''
# 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 ... | |
<filename>code_snippets/sort_example.py
import numbers
from selection_sort import *
from insertion_sort import *
from quick_sort import *
from merge_sort import *
from binary_radix_sort import *
from heap_sort import *
from bubble_sort import *
class StabilityUnit:
def __init__(self, value, stability_value):
self.va... | |
#!/usr/bin/env python
"""
Run tests
NOTE: Running these tests are confusing. The best way I currently have of adjusting parameters
during development is to adjust the parameters inside the DTO object
"""
import io
import os
import sys
import glob
import boto3
import shlex
import docker
import shutil
import pickle
imp... | |
the selected model.
occurrence_percent : float between [0, 1]
In how many percent of all initialization the word has to appear for printing. 1 means it has to appear in all and 0.5 in half of the initializations.
"""
model = self.models[model_id]
n_runs = len(model.samples[sample_id])
# print("Words per topic a... | |
import re
from itertools import count
from .tools import process_path
_conversions = {'atomicint': 'counter',
'str': 'text',
'bool': 'boolean',
'decimal': 'decimal',
'float': 'float',
'int': 'int',
'tuple': 'tuple',
'list': 'list',
'generator': 'list',
'frozenset': 'set',
'set': 'set',
'dict': 'map',
'lon... | |
# ##############################################################################
# This file is part of df_config #
# #
# Copyright (C) 2020 <NAME> <<EMAIL>> #
# All Rights Reserved #
# #
# You may use, distribute and modify this code under the #
# terms of the (BSD-like) CeCILL-B license. #
# #
# You should have recei... | |
<reponame>cosmicoder/isoclassify
#! /usr/bin/env python
# --------------------------------------------------------------
# The asfgrid is a python module to compute asteroseismic
# parameters for a star with given stellar parameters and vice versa.
# Copyright (C) 2015 <NAME>, <NAME>
# This program is free softwar... | |
0.45098039],
[0.59607843, 0.32156863, 0.4745098 ],
[0.57254902, 0.21960784, 0.42352941],
[0.49803922, 0.15686275, 0.36862745],
[0.36470588, 0.07058824, 0.3254902 ],
[0.31372549, 0.12156863, 0.34901961],
[0.36078431, 0.16470588, 0.44313725],
[0.32156863, 0.07058824, 0.37254902],
[0.6627451 , 0.44313725, 0.674509... | |
here that Euler's method doesn't give a stable orbit with for example $\Delta t =0.01$. It
means that we cannot trust Euler's method. Euler's method does not conserve energy. It is an
example of an integrator which is not
[symplectic](https://en.wikipedia.org/wiki/Symplectic_integrator).
Here we present thus two metho... | |
"""
Tests for the daemon.
Pyro - Python Remote Objects. Copyright by <NAME> (<EMAIL>).
"""
import time
import socket
import uuid
import pytest
import Pyro5.core
import Pyro5.client
import Pyro5.server
import Pyro5.nameserver
import Pyro5.protocol
import Pyro5.socketutil
import Pyro5.serializers
from Pyro5.errors impo... | |
<filename>microbepy/plot/mutation_plot.py
"""Provides plots of mutations for Isolates and Lines."""
from microbepy.common import constants as cn
from microbepy.common.dataframe_sorter import DataframeSorter
from microbepy.common.isolate import Isolate
from microbepy.common import util
from microbepy.correlation import... | |
<reponame>haybarry/micropython-radio
# async_radio_pickle
# A protocol for exchanging arbitrary Python objects between a pair of nRF24L01+ radios
# Uses uasyncio to achieve nonblocking behaviour (at the expense of speed).
import pyb
import pickle
import gc
import uasyncio as asyncio
from micropython import const
from ... | |
import pickle
import numpy as np
import networkx as nx
from sklearn.metrics import pairwise_distances
import sys
sys.path.append("...")
from models.circuit_generators import *
def read_pickle(x):
with (open(x, "rb")) as f:
data = pickle.load(f)
return data
X = np.load('al_synapses2.npy')
# al_res = np.load('res1_al... | |
# Copyright 2019 <NAME>. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | |
#!/usr/bin/python
# Copyright (c) 2006-2008 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.
# valgrind_test.py
"""Runs an exe through Valgrind and puts the intermediate files in a
directory.
"""
import datetime
import gl... | |
returned by the device
The str_ argument should be the device response to the <K221?>
command, for example '<K221,10,1>'
"""
match = re.match(cls.K_PATTERN, str_)
try:
number_before_output, decodes_before_output_mode = match.groups()
except (ValueError, AttributeError):
raise InvalidConfigString(
'Cannot deco... | |
0x233639: (0x8C94, 0), # East Asian ideograph
0x21363A: (0x54E5, 0), # East Asian ideograph
0x225E5F: (0x75D0, 0), # East Asian ideograph
0x21363C: (0x54F2, 0), # East Asian ideograph
0x21363D: (0x54E8, 0), # East Asian ideograph
0x21363E: (0x54E1, 0), # East Asian ideograph
0x22363F: (0x6555, 0), # East Asian id... | |
worksheet name check, additional check will be made as required.
4. If the batching information is passed to the object at instantiation, then merge this into a dictionary.
Error checking will be completed later.
5.
:param input_fp: The file path to the spreadsheet containing the data
:param data_worksheet: The na... | |
ckpt.get("train_config", None) or ckpt.get("config", None)
assert aux_config is not None, "input checkpoint has no sufficient data to recover a model"
model = ECG_UNET_CPSC2021(config=ckpt["model_config"])
model.load_state_dict(ckpt["model_state_dict"])
return model, aux_config
class ECG_SUBTRACT_UNET_CPSC2021(EC... | |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# from tensorflow.bitwise import bitwise_xor
from itertools import product
import hashlib
import numpy as np
import importlib
import re
import pdb
import tensorflow as tf
import sonnet as snt
from ..argoLogging import get_logger
import copy
... | |
time.clock()
self.scene.removeItem(self.map_point)
for path in paths:
self.scene.addPath(path)
t2 = time.clock()
if DEBUG:
self.logInteractive("Render time: %.4f s" % (t2 - t1))
self.scene.addItem(self.map_point)
if int(event.type()) == FILE_LOG_EVENT:
self.logF2F(event.msg)
if int(event.type()) == RETURN_COD... | |
<reponame>kakkotetsu/IxNetwork
# Copyright 1997 - 2018 by IXIA Keysight
#
# 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... | |
<reponame>telecombcn-dl/2017-dlai-team5
"""
PySC2_A3C_old.py
A script for training and running an A3C agent on the PySC2 environment, with reference to DeepMind's paper:
[1] Vinyals, Oriol, et al. "Starcraft II: A new challenge for reinforcement learning." arXiv preprint arXiv:1708.04782 (2017).
Advantage estimation us... | |
(NIR + RED + L)
# Change type to float32
L = 0.5
b3f = b3.astype(np.float32)
b6f = b6.astype(np.float32)
# Perform the calculations of the formula (SAVI values from -1.0 to 1.0)
savi = np.divide(np.multiply(
(1 + L), np.subtract(b6f, b3f)), np.add(np.add(b6f, b3f), L))
# Normalized SAVI values from 0.0 to 1.0
... | |
m.x1354 == 0)
m.c774 = Constraint(expr= m.x651 - 0.984106*m.x1115 - m.x1291 - m.x1323 - m.x1355 == 0)
m.c775 = Constraint(expr= m.x652 - 0.984106*m.x1116 - m.x1292 - m.x1324 - m.x1356 == 0)
m.c776 = Constraint(expr= m.x653 - 0.984106*m.x1117 - m.x1293 - m.x1325 - m.x1357 == 0)
m.c777 = Constraint(expr= m.x654 - 0.9... | |
'''
Created on 31 Jul 2009
@author: charanpal
'''
from __future__ import print_function
import sys
import os
import numpy
from contextlib import contextmanager
import numpy.random as rand
import logging
import scipy.linalg
import scipy.sparse as sparse
import scipy.special
import pickle
from apgl.util.Parameter imp... | |
import math
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#--------------------------GENERAL PROCESS CLASS-------------------------------
#-------------------------------------------------------------... | |
quantum_yield = np.array(a[1].data['YIELD'][0])
return(lba_um, quantum_yield)
def example_1(wave_micron, flux_W_m2_micron):
print('Beginning of example_1')
# Synthesize magnitudes
filterlist = ['WISE2','Johnson-U','MKO-J'] # keep as array, an array of name is expected
pathvega = '/Users/albert/NIRISS/SOSSpip... | |
score = Score(lives)
dispatcher.add('draw', score.draw)
return score
def start_game(self, click_event):
# if not yet started
if self.started is False:
# reset the lives
self.score.reset()
# hides the splash
self.splash.hide()
# starts the game
self.started = True
def check_game(self, game_event):
# if no m... | |
<filename>week_12_quantumChemistry1/utils2.py
import sys
version=sys.version_info.major
import os
import numpy as np
import scipy as sp
import scipy.linalg as spla
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import matplotlib as mpl
try:
from colorama import Fore,Back,Style
from colorama import ... | |
import collections
import os
from functools import partial
from itertools import product
from typing import Any, Callable, Iterable, Iterator, List, Mapping, MutableSequence, Optional, Sequence, Tuple, Union
import warnings
from copy import deepcopy
import numpy as np
import pandas as pd
from scipy.stats import scorea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.