input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<reponame>sarah-hanus/massbalance-sandbox
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 24 12:28:37 2020
@author: lilianschuster
different temperature index mass balance types added that are working with the Huss flowlines
this is the faster version
"""
# jax_true = True
# if jax_true:
# impo... | |
False]
[ True True True True True True True True]
[ True True True True True True True True]],
fill_value = 1e+20)
>>> img['IMG'].data[4]
Out[10]:
masked_BaseColumn(data =
[[-- -- -- -- -- -- -- --]
[-- -- -- -- -- -- -- --]
[-- -- -- -- -- -- -- --]
[-- -- -- -- -- -- -- --]
[-- -- -- -- -- -- -- --]
[-- ... | |
3.1.1 ) Age
# Note that Age is a continuous quantity and therefore we can plot it against the Attrition using a boxplot.
# In[ ]:
sns.factorplot(data=df,y='Age',x='Attrition',size=5,aspect=1,kind='box')
# Note that the median as well the maximum age of the peole with 'No' attrition is higher than that of the 'Yes... | |
= weight
self.name = name
@property
def asset_id(self) -> str:
"""Marquee unique identifier"""
return self.__asset_id
@asset_id.setter
def asset_id(self, value: str):
self._property_changed('asset_id')
self.__asset_id = value
@property
def weight(self) -> float:
"""Relative net weight of the given posit... | |
= osxmetadata.OSXMetaData(f)
for attr, value in attributes.items():
islist = osxmetadata.ATTRIBUTES[attr].list
if value:
value = ", ".join(value) if not islist else sorted(value)
file_value = md.get_attribute(attr)
if file_value and islist:
file_value = sorted(file_value)
if (not file_value and not value) or ... | |
import tkinter as tk
import tkinter.font as tkf
import tkinter.tix as tkx
import threading as th
from random import shuffle
from time import sleep
from webbrowser import open_new_tab
# Creates the highest-level tkinter widget, a canvas of sorts.
root = tkx.Tk()
# Immediately places focus on the application, as if it ... | |
import concurrent.futures
import datetime
import hashlib
import mimetypes
import re
from dataclasses import dataclass
from functools import cached_property
from itertools import chain
from pathlib import Path
import boto3
import click
from boto3.s3.transfer import S3TransferConfig
from dateutil.tz import UTC
from .co... | |
<filename>paper/mnist.py
import warnings
warnings.filterwarnings('ignore')
warnings.filterwarnings('ignore', category=DeprecationWarning)
warnings.filterwarnings('ignore', category=FutureWarning)
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
import torch
import numpy as np
from... | |
source collection + postfix.
destination_parent_collection_name -- name of the destination parent collection (default None).
This is the collection that would have the copied collection as a child.
use 'Root' for the root collection.
destination_parent_collection_id -- id of the destination parent collection (defa... | |
and iEra <= iRenaissance:
return "TXT_KEY_CIV_MOORS_ALMOHAD"
if not utils.isPlotInArea(tCapitalCoords, vic.tIberiaTL, vic.tIberiaBR):
return "TXT_KEY_CIV_MOORS_MOROCCAN"
elif iPlayer == iSpain:
bSpain = not pMoors.isAlive() or not utils.isPlotInArea(capitalCoords(iMoors), vic.tIberiaTL, vic.tIberiaBR... | |
freq_max=params_dict["freq_max"], unit_ids=unit_ids,
duration_in_frames=None, verbose=params_dict['verbose'])
md.compute_pca_scores(**kwargs)
d_prime = DPrime(metric_data=md)
d_primes = d_prime.compute_metric(num_channels_to_compare, max_spikes_per_cluster, **kwargs)
return d_primes
def compute_l_ratios(
sort... | |
str,
select: Optional[dict] = None,
) -> "ListservList":
"""
Args:
name: Name of the list of messages, e.g. '3GPP_TSG_SA_WG2_UPCON'.
directorypaths: List of directory paths where LISTSERV formatted
messages are.
filedsc: A description of the relevant files, e.g. *.LOG?????
select: Selection criteria that can f... | |
<reponame>ColinKennedy/tk-config-default2-respawn
"""
Filesystem-related utilities.
"""
from threading import Lock
from tempfile import mkdtemp
from contextlib import contextmanager
import weakref
import atexit
import posixpath
import ntpath
import os.path
import shutil
import os
import re
import stat
class TempDirs(... | |
<reponame>eoinjordan/thefeck
import pytest
from io import BytesIO
from thefeck.types import Command
from thefeck.rules.docker_not_command import get_new_command, match
_DOCKER_SWARM_OUTPUT = '''
Usage: docker swarm COMMAND
Manage Swarm
Commands:
ca Display and rotate the root CA
init Initialize a swarm
join Join... | |
keyword argument '%s'"
" to method get_conversations_messaging_integrations_whatsapp_integration_id" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'integration_id' is set
if ('integration_id' not in params) or (params['integration_id'] is None):
raise ValueError("Missing the req... | |
<reponame>aguilerapy/kingfisher-process
import datetime
import os
import sqlalchemy as sa
from ocdskingfisherprocess.store import Store
from tests.base import BaseDataBaseTest
from ocdskingfisherprocess.checks import Checks
class TestDefaultsOff(BaseDataBaseTest):
def alter_config(self):
self.config.default_value_... | |
# Copyright 2016 <NAME>
# Governed by the license described in LICENSE.txt
import libtcodpy as libtcod
import cProfile
import scipy.spatial.kdtree
import config
import algebra
import map
import log
from components import *
import miscellany
import bestiary
import ai
import actions
import spells
import quest
import co... | |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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... | |
import numpy as np
from extra_data.components import AGIPD1M
import dask.array as da
import xarray as xr
from dask.distributed import Client, progress
import warnings
import h5py as h5
import bottleneck as bn
import pdb
class Calibrator:
"""Calibrate AGIPD dataset"""
adu_per_photon = 66
mask = np.ones((16, 512, ... | |
from datetime import datetime
from calendar import monthrange
import logging
from flask import Flask, Response, request
from entites.BaseEntity import BaseApiResponse
from validation.http_api_validation import isValidationError, validateIsNumber, validateIsmatchDateFormat, validationErrMessage
from usecases.CovidTestUs... | |
1
nfreq = 100
freq = np.linspace(1, 10.0, nfreq)
rng = np.random.RandomState(100) # set the seed for the random number generator
noise = rng.exponential(size=nfreq)
cls.model = models.Lorentz1D() + models.Const1D()
cls.x_0_0 = 2.0
cls.fwhm_0 = 0.05
cls.amplitude_0 = 1000.0
cls.amplitude_1 = 2.0
cls.model.... | |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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://w... | |
# Databricks notebook source
slides_html="""
<iframe src="https://docs.google.com/presentation/d/1yR3oBKg8vvwKjvj4WWezf5ygJweo8rWuklD7IF4uVX0/embed?start=true&loop=true&delayms=4000" frameborder="0" width="900" height="560" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
"""
dis... | |
"""This module contains the classes used for constructing and conducting an Experiment (most notably,
:class:`CrossValidationExperiment`). Any class contained herein whose name starts with 'Base' should not be used directly.
:class:`CrossValidationExperiment` is the preferred means of conducting one-off experimentation... | |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... | |
"""Finite-dimensional linear operators."""
from typing import Callable, Optional, Tuple, Union
import numpy as np
import scipy.linalg
import scipy.sparse.linalg
import probnum.utils
from probnum import config
from probnum.typing import DTypeArgType, ScalarArgType, ShapeArgType
BinaryOperandType = Union[
"LinearOpe... | |
"""
Class for processing FITS files processed by DECam Community Pipelines.
These pipelines will bundle entire focal planes into a single file, which can
be successfully processed by the MultiExtensionFits class, but for which we can
create better visualisations.
Note that the focusing and guiding chips are not proce... | |
flag set to 0, sigma clipped,
timegroups selected based on `mingap` day gaps, then fit vs time by a
legendre polynomial of lowish degree".
Args:
lcd (dict): the lightcurvedictionary returned by
astrokep.read_kepler_fitslc.
detrend (str): method by which to detrend the LC. 'legendre' is the
only thing implement... | |
<reponame>BenWiederhake/hangchat<gh_stars>0
#!/usr/bin/env python3
from datetime import datetime
# from telegram import ParseMode
from telegram.ext import CommandHandler, MessageHandler, Filters, CallbackQueryHandler
from telegram.ext.dispatcher import run_async
# from shared_vars import gm, updater, dispatcher
#fro... | |
# -*- coding: utf-8 -*-
import re
import copy
import os
import string
import xlrd
import pickle
from .get_tokens import *
keywords_0 = ('auto', 'typedf', 'const', 'extern', 'register', 'static', 'volatile', 'continue', 'break',
'default', 'return', 'goto', 'else', 'case')
keywords_1 = ('catch', 'sizeof', 'if', 'swi... | |
.align_to(pos, RIGHT)
self.play(Write(text1), run_time=2)
self.wait()
self.play(Write(text2), run_time=2)
self.wait()
self.play(ShowCreation(line1))
self.wait()
multi = TexMobject("\\times").scale(1.5).next_to(text2, LEFT).align_to(text2, DOWN).shift(LEFT*0.5)
self.play(DrawBorderThenFill(multi))
self.pla... | |
coverage = 1
try:
xs = re.sequni()
except self.mod.RE.InfiniteError:
print('Infinitely long args example for %s' % self.srcfullname)
print(
'Limiting by expanding each Cleene closure 0 up to %d times.' % coverage)
re = re.limited(coverage)
xs = re.sequni()
examples = [ArgsExample(self, tuple(
x), mapname, top... | |
update(self, emitted):
round_dec = 6
# drawing the individual signals
if not pause:
x_index = emitted[-1]
# round is crucial here since int will make 199.99 as 199. Want to remove round off errors by rounding
# to the nearest
x_index_wrapped = wrap_around(x_index, round(self.max_t / self.dt))
if debug:
print(... | |
r"""
Base class for polyhedra
"""
# ****************************************************************************
# Copyright (C) 2008 <NAME> <<EMAIL>>
# Copyright (C) 2011 <NAME> <<EMAIL>>
# Copyright (C) 2015 <NAME> <labbe at math.huji.ac.il>
# Copyright (C) 2020 <NAME> <<EMAIL>>
#
# This program is free software: yo... | |
# -*- coding: utf-8 -*-
# (C) 2016 <NAME>
#
data = {
u"\u0b83": 11172,
u"\u0b85": 73738,
u"\u0b86": 32690,
u"\u0b87": 61948,
u"\u0b88": 4622,
u"\u0b89": 35756,
u"\u0b8a": 4101,
u"\u0b8e": 35429,
u"\u0b8f": 9073,
u"\u0b90": 4730,
u"\u0b92": 14445,
u"\u0b93": 5639,
u"\u0b94": 171,
u"\u0b95": 369818,
u"\u0b... | |
<reponame>GyChou/ray_elegant_carla
from ray_elegantrl.interaction import make_env
from ray_elegantrl.net import *
import torch
import numpy as np
import os
import time
# os.environ["DISPLAY"] = "localhost:13.0"
os.environ["SDL_VIDEODRIVER"] = "dummy"
RENDER = False
ENV_ID = "carla-v2"
STATE_DIM = 50
ACTION_DIM = 2
RE... | |
import argparse
import logging
from keras.models import Sequential
from keras.layers import Conv3D, Dense
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.preprocessing import MinMaxScaler
import xarray as xr
# ----------------------------------------------------------------------------------... | |
password: IQFeed subscriber's pwd
The user of the app must have a subscription to IQFeed. Pass the user's
password either here or in cmd line options when IQFeed is started.
process_current_password called on listeners on success.
"""
self._send_cmd("S,SET PASSWORD,%<PASSWORD>" % password)
def set_autoconnect... | |
from logging import getLogger
from os.path import dirname, isfile, splitext, basename
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import (
FigureCanvasQTAgg,
NavigationToolbar2QT as NavigationToolbar,
)
from ezdxf import readfile
from numpy import angle as np_angle
from numpy import array,... | |
<filename>FactorToConvertUnits.py
# <NAME>, Apr 2013, ISC RAS, Ivanovo, Russia
#
# Copyright 2013 <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/LIC... | |
#!/usr/bin/env python
from bs4 import BeautifulSoup
import codecs
from collections import defaultdict, OrderedDict
import copy
import glob
from le_utils.constants import licenses, content_kinds, file_formats
import hashlib
import json
import logging
import ntpath
import os
from pathlib import Path
import re
import req... | |
value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set), Warning)
class IpFreqLimit(AbstractModel):
"""IP限频配置。
"""
def __init__(self):
"""
:param Switch: IP限频配置开关,on或off。
:type Switch: str
:par... | |
if vdom:
LOG.debug("vdom is: %s", vdom)
if vdom == "global":
url_postfix += '?global=1'
else:
url_postfix += '?vdom=' + vdom
url = self.url_prefix + url_postfix
LOG.debug("urlbuild is %s with crsf: %s", url, self._session.headers)
return url
def mon_url(self, path, name, vdom=None, mkey=None):
self.check_ses... | |
<reponame>CLARIAH/DANE-util
# Copyright 2020-present, Netherlands Institute for Sound and Vision (Nanne van Noord)
#
# 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/... | |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | |
<filename>tests/test_node_flood.py
import time
import common.ttypes
import constants
import encoding.ttypes
import node
import packet_common
import timer
# pylint: disable=line-too-long
MY_NAME = "name"
MY_SYSTEM_ID = 999
MY_LEVEL = 9
SOUTH = constants.DIR_SOUTH
NORTH = constants.DIR_NORTH
EW = constants.DIR_EAST_W... | |
a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.archive_run(owner, entity, uuid, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str owner: Owner of the namespace (required)
:param str ... | |
between min and
max.
Args:
min: the minimum acceptable value
max: the maximum acceptable value
sigma: the number of standard deviations between the center and min or max
Returns:
a value chosen randomly between min and max
"""
center = (max+min)*0.5
delta = math.fabs(max-min)*0.5
ratio = delta/sigma
while... | |
if DEBUG:
raise
# print(self.ui.openglview.width()-30, self.ui.openglview.height()-50)
content = write_html.write(mol, self.ui.openglview.width() - 30, self.ui.openglview.height() - 50)
p2 = Path(os.path.join(application_path, "./displaymol/jsmol.htm"))
p2.write_text(data=content, encoding="utf-8", errors='ignore'... | |
#!/usr/bin/env python3
#Test suite for Problem Set 4 (Drug Simulation)
import sys
import unittest
import numpy as np
import ps4
population = [[100, 115, 122, 129, 134, 138, 151, 167, 174, 183, 196, 208, 215, 223, 233,
240, 253, 268, 284, 294, 306, 316, 325, 338, 360, 372, 378, 388, 399, 415, 414, 431, 456,
477, 485,... | |
http://hl7.org/fhir/ValueSet/ucum-common in valuesets.xml
"""
GramPer6Hour = CommonUCUMUnitsCode("g/(6.h)")
"""
From: http://hl7.org/fhir/ValueSet/ucum-common in valuesets.xml
"""
GramPer72Hour = CommonUCUMUnitsCode("g/(72.h)")
"""
From: http://hl7.org/fhir/ValueSet/ucum-common in valuesets.xml
"""
Gram_8_Hou... | |
"""SNR Project GUI Module.
Classes to create widgets for SNR program.
Authors: <NAME>, <NAME>, <NAME>
Version: April 1st, 2019
"""
import tkinter as tk
from tkinter import ttk
import platform
OS = platform.system()
########################################################################################... | |
= data['i'][()]
if group == True:
sex_mask = data['sex'][()]
class_mask = data['Binge'][()]
self.ho_Other = [y, ID, sex_mask, class_mask]
else:
self.ho_Other = [y, ID]
X.shape, len(X_col_names)
return self.ho_X, self.ho_X_col_names, self.ho_Other
# def __str__(self):
# pass
class RUN_loader:
def __init__... | |
+ "/C6_RL_8col_agg_rough_270K.dat", False)
data_path = os.path.join(os.path.dirname(__file__), 'bulk_c6_tables')
self.bulk_table["E3_ice"] = load_bulk_scat_file(
data_path + "/bulk_RL_C6PSD_c6_8col_ice_agg_rough_270K.dat")
self.bulk_table["E3_liq"] = load_bulk_scat_file(data_path + "/bulk_RL_C6PSD_mie_liq.dat")
se... | |
not t[1].isalpha():
symb = t[0]
else:
symb = t[0:2]
for i in range(1, 100):
name = f'{symb}{i}'
if name in type_translator.values():
continue
else:
type_translator[t] = name
break
return type_translator
def _cell_section(self, cell):
cell_section = (
'\ncell\n'
f"{round(cell.a, 6)} "
f"{round(cell.b, ... | |
that processName's"\
# # "daughter nodes.")
# #Use a method to get the list of potential samples from the packedEventID -> Probably method that calls a common dictionarymethod.
# #Return std::vector<std::string> to iterate through, will include such things as ttbb_DL-GF, ttbbJets, ttll_DL, ttcc_SL, etc... fully comp... | |
<reponame>TugberkArkose/MLScheduler
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 Dyna... | |
from datetime import timedelta
from typing import Any, List, Optional, Dict, Union
import subprocess
from uuid import UUID
import time
from subprocess import run
from sys import platform
import gc
import uuid
import logging
from pathlib import Path
import os
import requests_cache
import responses
from sqlalchemy impo... | |
index):
if (index < self.get_count()):
return self.get_item(index)
else:
raise IndexError("The index (" + str(index) + ") is out of range")
def __nonzero__(self): return True
__swig_destroy__ = _gui.delete_GuiFilenameFieldSet
__del__ = lambda self: None
GuiFilenameFieldSet_swigregister = _gui.GuiFilenameFieldSe... | |
n = re.subn('''^\s*SHOWERKT\s*=\s*[default\de\+\-\.]*\s*$''',
''' SHOWERKT = %s ''' % args[1].upper(), \
p_card, flags=(re.M+re.I))
if n==0:
p_card = '%s \n SHOWERKT= %s' % (p_card, args[1].upper())
with open(pythia_path, 'w') as fsock:
fsock.write(p_card)
return
card = '' #store which card need to be modify ... | |
#!/usr/bin/env python
"""Utililies for modifying the GRR server configuration."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import getpass
import os
import re
import socket
import subprocess
import sys
import ti... | |
#
# Note on 'chunks_len' values used in tests:
# -----------------------------------------
# The BTC app tx parser requires the tx data to be sent in chunks. For some tx fields
# it doesn't matter where the field is cut but for others it does and the rule is unclear.
#
# Until I get a simple to use and working Tx par... | |
'CalibrationAngleCranCaud', False, 'CalibrationAngleCranCaud'),
"0019xx60" : ('SL', '1', 'CalibrationAngleRAOLAO', False, 'CalibrationAngleRAOLAO'),
"0019xx62" : ('SL', '1', 'CalibrationTableToFloorDist', False, 'CalibrationTableToFloorDist'),
"0019xx64" : ('SL', '1', 'CalibrationIsocenterToFloorDist', False, 'Calib... | |
> 0:
return rz
return {'return': 0}
##############################################################################
# received from web (if needed) and unzip archive
def get_and_unzip_archive(i):
"""
Input: {
zip - zip filename or URL
path - path to extract
(overwrite) - if 'yes', overwrite files when unarchi... | |
= ssl_ca_certs
# Keep track of resets, so we notice sockets created before the most
# recent reset and close them.
self.pool_id = 0
if HAS_SSL and use_ssl and not ssl_cert_reqs:
self.ssl_cert_reqs = ssl.CERT_NONE
self.motor_sock_counter = 0
self.queue = collections.deque()
# Timeout handles to expire waiter... | |
rho, n.in_units("kg/m**3", equivalence="number_density", mu=0.75)
)
rho.convert_to_units("cm**-3", "number_density", mu=0.75)
assert rho.units == (1 / u.cm ** 3).units
assert n.units == (1 / u.m ** 3).units
assert_allclose_units(n, rho)
rho.convert_to_units("kg/m**3", "number_density", mu=0.75)
assert_allclose_u... | |
<reponame>WagnerNils/MMSplice_MTSplice
# import tensorflow as tf
import numpy as np
import tensorflow.keras.backend as K
from tensorflow.keras.layers import Layer
from tensorflow.keras.layers import Conv1D
from tensorflow.keras.regularizers import Regularizer
from tensorflow.keras import initializers
import scipy.inter... | |
import os
from os import system as sys
from socket import socket
import idna
from flask import Flask, request, redirect, render_template, jsonify
from backend import vtscan, certcheck, httpscheck,checkReditect,checkTrustedCert
import config
app = Flask(__name__)
app.secret_key = "secret key";
app.config['MAX_CONTENT... | |
else:
RiskyDstn = self.RiskyDstn
temp_f = lambda s : -((1.-self.CRRA)**-1)*np.dot((self.Rfree + s*(RiskyDstn.X-self.Rfree))**(1.-self.CRRA), RiskyDstn.pmf)
SharePF = minimize_scalar(temp_f, bounds=(0.0, 1.0), method='bounded').x
self.ShareLimit = SharePF
self.addToTimeInv('ShareLimit')
def getRisky(self):
''... | |
# 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... | |
#!/usr/bin/python
import scipy as sp
import numpy as np
import string
import timeit
import os,sys
# Set other analysis parameters
overlap_length = 15
primer_length = 40
# Get input files
r1_file = sys.argv[1]
r2_file = sys.argv[2]
regions_file = sys.argv[3]
output_file = sys.argv[4]
stats_file = sys.argv[5]
# Make s... | |
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import torch
import torch.autograd as autograd
import torch.optim as optim
from torch.distributions import constraints, transform_to
import sobol_seq
import pyDOE
import pyro
import pyro.contrib.gp as gp
import copy
from torch.distributions.multivar... | |
<filename>chroma-manager/chroma_agent_comms/views.py
# Copyright (c) 2017 Intel Corporation. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
import Queue
import json
import traceback
import time
from django.db import transaction
from django.h... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' Class for plotting an XZ- , an RZ and an YZ-axis in the same plot.
See PlotterXZ for general info.
'''
# General imports
from matplotlib.figure import Figure
from matplotlib.gridspec import GridSpec
import numpy as np
import logging
# Import from project files
from... | |
<reponame>tinyclues/ipython
# -*- coding: utf-8 -*-
"""Classes for handling input/output prompts.
Authors:
* <NAME>
* <NAME>
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2010 The IPython Development Team
# Copyright (C) 2001-2007 <NAME> <<EMAIL>>
#
# Distrib... | |
"""
domonic.d3.selection
====================================
https://github.com/d3/d3-selection/tree/main/src/selection
"""
# from domonic.html import *
from domonic.dom import document # bring in the global
from domonic.javascript import *
xhtml = "http://www.w3.org/1999/xhtml"
namespaces = {
"svg": "http:/... | |
the geo interiors most likely could not be isolated with this tool so we
# abandon the whole isolation for this geo and add this geo to the not_isolated_geo
if nr_pass == 0 and forced_rest is True:
if geo.interiors:
len_interiors = len(geo.interiors)
if len_interiors > 1:
total_poly_len = 1 + len_interiors # one ... | |
= "none", Rowv = F, Colv = F, margins = c(15,15),
distfun = function(x) dist(x, method = "manhattan"),
hclustfun = function(x) hclust(x, method = "ward.D2"))''')
R["dev.off"]()
#########################################
#########################################
#########################################
@follows(mk... | |
<filename>ai/Algorithm/influence_map.py<gh_stars>0
# Under MIT License, see LICENSE.txt
from math import ceil, sqrt
import numpy
from RULEngine.Util.constant import *
from RULEngine.Util.Position import Position
from ai.Algorithm.IntelligentModule import IntelligentModule
__author__ = 'RoboCupULaval'
class Influe... | |
1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0],
[1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1],
[0, 1... | |
<filename>_MOM/Selector.py
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Mag. <NAME> All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. <EMAIL>
# #*** <License> ************************************************************#
# This module is part of the package MOM.
#
# This module is free software: you can re... | |
= out
else:
out = self.fit_at_z(z=zi[i], templates=t_complex, fitter=fitter)
ci[i], bg, full, coeffs, err = out
# out = self.fit_at_z(z=zi[i], templates=t_complex,
# fitter=fitter)
#
# ci[i], bg, full, coeffs, err = out
if verbose:
print('{0:.4f} - {1:10.1f}'.format(zi[i], ci[i]))
z = np.append(z, zi)... | |
#!/usr/bin/env python3
"""Read boot.bin and src.elf and produce debug.bin."""
import os
import sys
import struct
from enum import IntEnum, IntFlag
def printf(fmt, *args, **kwargs):
print(fmt % args, end='', **kwargs)
def readStruct(fmt, file, offset=None):
"""Read struct from file."""
if offset is not None: file... | |
"""Create lmdb files for [General images (291 images/DIV2K) | Vimeo90K | REDS] training datasets"""
import os, sys
import os.path as osp
import glob
import pickle
from multiprocessing import Pool
import numpy as np
import lmdb
import cv2
import argparse
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))... | |
# -*- coding: utf-8 -*-
u"""
Mayaラッパーオブジェクトの抽象基底クラス。
"""
import sys
import types
from ...common import *
from ..typeinfo import isDerivedNodeType as _isDerivedNodeType
from ..typeregistry import nodetypes
from ._api2mplug import (
_1_mpath, _1_mnode,
makePlugTypeInfo,
)
import maya.api.OpenMaya as _api2
import maya.O... | |
''' Automate populating element properties for QUAD4M analyses
DESCRIPTION:
This module contains functions that help populate element properties for QUAD4M
analysis, generally adding columns to the dataframe "elems" that then gets
exported to a ".q4r" file.
'''
import llgeo.props_nonlinear.darendeli_2011 as q4m_dara... | |
<gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import print_function
import nose
from datetime import datetime
from pandas import date_range
from pandas.core.index import MultiIndex
from pandas.core.api import DataFrame
from pandas.core.series import Series
from pandas.util.testing import (assert_frame_equa... | |
<reponame>khramtsova/federated<gh_stars>1-10
# Lint as: python3
# Copyright 2019, The TensorFlow Federated 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/l... | |
Test that second iteration is possible
act_values_list2 = list(act_values)
# Test __contained__() of the returned view
for value in act_values_list:
assert value in act_values
# Ensure that exceptions raised in the remainder of this function
# are not mistaken as expected exceptions
assert testcase.exp_exc_typ... | |
<filename>S4_FaceRecognition/models/utils/detect_face.py
mport torch
from torch.nn.functional import interpolate
from torchvision.transforms import functional as F
from torchvision.ops.boxes import batched_nms
from PIL import Image
import numpy as np
import os
import math
# OpenCV is optional, but required if using nu... | |
<reponame>jtyuan/racetrack<filename>src/arch/isa_parser.py
# Copyright (c) 2003-2005 The Regents of The University of Michigan
# Copyright (c) 2013 Advanced Micro Devices, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the f... | |
AssertionError is raised in this scenario.
Why is this so important? The ``DropoutLayer`` and ``PoolLayer`` (in
the case of stochastic pooling) are sensitive to this parameter and
results are very different for the two settings.
:param shuffle: bool.
If set to True, shuffle the training data every epoch. The test... | |
from __future__ import division
from datetime import datetime
import collect_ncs_files
import cPickle as pickle
import unittest
import get_mtz
import shutil
import sys
import os
__author__ = 'Youval'
# control if temp folder will be deleted after test
DEBUG_MODE = False
class TestNCSDataCollection(unittest.TestCase)... | |
self.domain_name = kwargs.get('domain_name', None)
self.organization_unit = kwargs.get('organization_unit', None)
self.domain_username = kwargs.get('domain_username', None)
self.domain_password = kwargs.get('domain_password', None)
class NetworkConnectionUpdateProperties(msrest.serialization.Model):
"""Properties... | |
item, and provide the user with feedback if it's not. The possible cases
# are captured by this next enumeration, and the following helper function
# assesses the current status and returns additional info (as multiple values).
class Status(Enum):
NOT_READY = auto() # Item.ready is False
NO_COPIES_LEFT = auto() # No... | |
from_dict(cls, _dict: Dict) -> 'Rule':
"""Initialize a Rule object from a json dictionary."""
args = {}
if 'account_id' in _dict:
args['account_id'] = _dict.get('account_id')
if 'name' in _dict:
args['name'] = _dict.get('name')
else:
raise ValueError('Required property \'name\' not present in Rule JSON')
if 'd... | |
mask[2, 2] = True
mask_resized = mask.resized_mask_from(new_shape=(3, 3))
mask_resized_manual = np.full(fill_value=False, shape=(3, 3))
mask_resized_manual[1, 1] = True
assert (mask_resized == mask_resized_manual).all()
def test__rescaled_mask_from__compare_to_manual_mask(self):
mask = aa.Mask2D.u... | |
from concat.level0.lex import to_tokens
# The newlines in each example are important.
examples = {
'None\n': to_tokens(
('ENCODING', 'utf-8', (0, 0), (0, 0)),
('NONE', 'None', (1, 0), (1, 4)),
('NEWLINE', '\n', (1, 4), (1, 5)),
('ENDMARKER', '', (2, 0), (2, 0))
),
'NotImplemented\n': to_tokens(
('ENCODING', '... | |
#!/usr/bin/env python3
r"""Full workflow that converts RetroPath2.0 output to a list of pathways.
Copyright (C) 2017 <NAME> research group, INRA
Use of this source code is governed by the MIT license that can be found in the
LICENSE.txt file.
Command line example:
python RP2paths.py all results.csv --outdir pathways... | |
train_test_switch == "test":
#DEFINING TEST DATA LOADER FOR TESTINGs
testDatasetSaveplace = FileParentPath + "/Datasets/test"
testDataset = self.Dataset(testDatasetSaveplace)
testDataLoader = DataLoader(testDataset, batch_size=opt.batch_size, shuffle=True, num_workers=opt.n_cpu, drop_last=True )
#This will create... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.