input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
#!/usr/bin/env python
import numpy as np
import scipy.io as io
import matplotlib.pyplot as plt
from scipy.stats import norm
import argparse
import copy
import tqdm
from hdphmm.utils import timeseries as ts
def initialize():
parser = argparse.ArgumentParser(description='Generate timeseries with different underlying... | |
:param async_req bool
:param str id: (required)
:param list[ApiParameter] parameters:
:param str run_name: name to identify the run on the Kubeflow Pipelines UI, defaults to component name
:return: ApiRunCodeResponse
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'p... | |
9 * m.b1400)
m.e1 = Constraint(expr= m.x1 - 0.2 * m.x141 == 0)
m.e2 = Constraint(expr= m.x2 - 0.2 * m.x142 == 0)
m.e3 = Constraint(expr= m.x3 - 0.2 * m.x143 == 0)
m.e4 = Constraint(expr= m.x4 - 0.2 * m.x144 == 0)
m.e5 = Constraint(expr= m.x5 - 0.2 * m.x145 == 0)
m.e6 = Constraint(expr= m.x6 - 0.2 * m.x146 == 0)
m.e7 =... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | |
EMPTY_BOARD = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... | |
j, k, m)*y(m, n, p)
answer(i, j, k, n, p, z)
self.failUnless(isEqual(result, answer, tol=tol), "Mismatch: %s != %s" % (result, answer))
return
#---------------------------------------------------------------------------
# thirdranktensor . fourthranktensor
#-------------------------------------------------------... | |
<reponame>ark0015/DetectorDesignSensitivities<filename>Functions/waveform_Wphase.py
import numpy as np
def Get_Waveform(source,pct_of_peak=0.01):
"""Uses Mass Ratio (q <= 18), aligned spins (abs(a/m)~0.85 or when q=1 abs(a/m)<0.98),
fitting coefficients for QNM type, and sampling rate
Returns the frequency, the Phe... | |
# -*- coding: utf-8 -*-
"""
featherpmm.py: Extends feather file format with a paired file
that contains extra metadata. If the feather file is /path/to/foo.feather,
the metadata file is /path/to/foo.pmm.
"""
from __future__ import division
import os
import datetime
import numpy as np
import sys
try:
import pyarrow.... | |
<reponame>PrivateStorageio/SecureAccessTokenAuthorizer
# Copyright 2022 PrivateStorage.io, LLC
#
# 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
#... | |
<filename>src/FinFET.py<gh_stars>1-10
#BSD 3-Clause License
#
#Copyright (c) 2019, The Regents of the University of Minnesota
#
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
#
#* Redistributions of... | |
"""
script to ease construction of CSDGM2-style metadata for an GeMS-style geodatabase.
To use,
Run ValidateDatabase to make sure that the database is complete and there are
no missing DMU, Glossary, or DataSources entries
In ArcCatalog, go to Customize>Options>Metadata and set Metadata Style to
"FGDC CSDGM Metada... | |
**type**\: str
**pattern:** ((\:\|[0\-9a\-fA\-F]{0,4})\:)([0\-9a\-fA\-F]{0,4}\:){0,5}((([0\-9a\-fA\-F]{0,4}\:)?(\:\|[0\-9a\-fA\-F]{0,4}))\|(((25[0\-5]\|2[0\-4][0\-9]\|[01]?[0\-9]?[0\-9])\\.){3}(25[0\-5]\|2[0\-4][0\-9]\|[01]?[0\-9]?[0\-9])))(%[\\p{N}\\p{L}]+)?
.. attribute:: metric_type (key)
Metric type
... | |
K.cast(K.less(inputs, 0), 'float32') * (K.exp(inputs - 1) * K.maximum(K.cast_to_floatx(0.0), K.minimum(K.cast_to_floatx(1.0), (inputs + 1.0)/2.0)))
def get_config(self):
base_config = super(HardElish, self).get_config()
return dict(list(base_config.items())
def compute_output_shape(self, input_shape):
return in... | |
expected result (raised from the pexpect module).
"""
reporter.step('Getting device information...')
self.__access_priv_exec_mode(child, eol, enable_password)
try:
# Get the name of the default drive. Depending on the device, it may be bootflash,
# flash, slot (for linear memory cards), or disk (for CompactFlash... | |
<gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
# In[1]:
"""
Module containng custom Keras models and layers required for FlowNet architecture.
"""
try:
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import backend as K
except Exception as e:
raise Exception... | |
next_case_line_number: int = 0
for line in code_except_decorator:
# print(f'{line_number} : {line}')
if "case " in line:
next_case_line_number = line_number
next_case = line.strip()
if "done()" in line:
match_obligations.add(line_number, next_case_line_number, next_case)
line_number += 1
# print(match_obligati... | |
is visible. When the last pending initializer is removed,
and no failing result is set, the initializers struct will be
set to nil and the object is considered as initialized and visible
to all clients.
type: list
contains:
name:
description:
- name of the process that is responsible for initializing this
obje... | |
<reponame>misakadam97/cell_mrcnn
from os import listdir, mkdir, path
from os.path import join, isdir, basename, split
from glob import glob
import numpy as np
import skimage.draw
from skimage.io import imread
from cell_mrcnn.utils import correct_central_brightness, subtract_bg, convert_to_bit8, \
get_cell_mrcnn_path_f... | |
<gh_stars>1-10
from __future__ import print_function, division, absolute_import
import numpy as np
import scipy
from scipy.misc import imsave, imread, imresize
from sklearn.feature_extraction.image import reconstruct_from_patches_2d, extract_patches_2d
from scipy.ndimage.filters import gaussian_filter
from skimage.uti... | |
import logging
import pickle
from typing import Dict, List, Optional, Set, Union
import click
import hail as hl
from gnomad.resources.grch38.gnomad import (
COHORTS_WITH_POP_STORED_AS_SUBPOP,
HGDP_POPS,
TGP_POPS,
TGP_POP_NAMES,
POPS,
SEXES,
SUBSETS,
)
from gnomad.sample_qc.ancestry import POP_NAMES
from gnomad... | |
<reponame>jeffvan-netsia/voltha_doc<filename>voltha/coordinator.py
#
# Copyright 2017 the original author or 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... | |
# -*- coding: utf-8 -*-
#
# Copyright © Simphony Project Contributors
# Licensed under the terms of the MIT License
# (see simphony/__init__.py for details)
import pytest
import os
from simphony.plugins.siepic.parser import load_spi
#==============================================================================
# T... | |
"resource_field_ref")
@property
@pulumi.getter(name="secretKeyRef")
def secret_key_ref(self) -> Optional['outputs.SeldonDeploymentSpecPredictorsSvcOrchSpecEnvValueFromSecretKeyRef']:
"""
Selects a key of a secret in the pod's namespace
"""
return pulumi.get(self, "secret_key_ref")
def _translate_property(self... | |
# importando a biblioteca PySimpleGUI para a interface
import PySimpleGUI as sg
# Procurando brechas sobre como os usuários podem responder as perguntas.
yes = ["S", "s", "sim"]
no = ["N", "n", "nao", "não"]
# Objetos
espada = 0
flor = 0
# Primeira janela
def janela_inicial():
sg.theme('Reddit')
... | |
+ m.x94 == 0)
m.c49 = Constraint(expr= - 40*m.x24 + m.x96 == 0)
m.c50 = Constraint(expr= - 40*m.x25 + m.x98 == 0)
m.c51 = Constraint(expr= - 40*m.x26 + m.x100 == 0)
m.c52 = Constraint(expr= - 40*m.x2 + m.x53 == 0)
m.c53 = Constraint(expr= - 40*m.x3 + m.x55 == 0)
m.c54 = Constraint(expr= - 40*m.x4 + m.x57 == 0)
m... | |
<filename>scripts/addons/uvpackmaster2/panel_base.py<gh_stars>1-10
# ##### 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 (... | |
from collections import namedtuple
from itertools import islice
import numpy as np
import pandas as pd
from dataclasses import dataclass
@dataclass
class BinningInfo(object):
"""Docstring for BinningInfo."""
variable_extents: tuple
step: float
num_bins: int
bin_indicies: np.ndarray
def build_spanning_grid_ma... | |
import random
import pygame
import constants
import utils
from graphics_environment import Environment, Triggers
import os, sys
import time
from graphics_fauna import Player, Npcs
from dialogs import DialogFight, DialogText, DialogPlayerInventory, \
DialogInput, DialogPlayerInfo, DialogText, DialogGoodbye, \
DialogUs... | |
<filename>leiaapi/generated/api/application_admin_api.py<gh_stars>0
# coding: utf-8
"""
LEIA RESTful API for AI
Leia API # noqa: E501
OpenAPI spec version: 1.0.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
... | |
"""Library implementing convolutional neural networks.
Authors
* <NAME> 2020
* <NAME> 2020
* <NAME> 2021
* <NAME> 2021
"""
import math
import torch
import logging
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple
logger = logging.getLogger(__name__)
class SincCon... | |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import torch
import numpy as np
import matplotlib.pyplot as plt
import csv
from PIL import Image
import matplotlib as mpl
from tqdm import tqdm
from sklearn.manifold import TSNE
import umap
from sklearn.metrics import silhouette_score , silhouette_samples
from sklearn.... | |
# -*- coding: utf-8 -*-
"""
This module
"""
import attr
import typing
from ..core.model import (
Property, Resource, Tag, GetAtt, TypeHint, TypeCheck,
)
from ..core.constant import AttrMeta
#--- Property declaration ---
@attr.s
class PropDeliveryStreamAmazonopensearchserviceRetryOptions(Property):
"""
AWS Objec... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 10 15:51:15 2021
@author: rosariouceda-sosa
"""
###########################################
# Extraction of Propbank, Verbnet and mappings
# It requires verbnet3.4, verbnet3.3 and verbnet3.2 in nltk_data directory,
# as well as the latest version ... | |
#
"""handle input Text for Larch -- inclides translation to Python text
"""
from __future__ import print_function
from utils import isValidName, isNumber, isLiteralStr, strip_comments, find_delims
def get_DefVar(text):
"""
looks for defined variable statement, of the form
>> def varname = exression
returns (varna... | |
"""
This is the core file in the `gradio` package, and defines the Interface class, including methods for constructing the
interface using the input and output types.
"""
import copy
import csv
import getpass
import inspect
import markdown2
import numpy as np
import os
import pkg_resources
import requests
import rando... | |
<filename>src/app/services/plot_service.py
# MIT License
#
# Copyright (c) 2020 OdinLabs IO
#
# 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... | |
<filename>catkit/hardware/boston/BostonDmController.py
import os
import sys
import threading
import numpy as np
from catkit.interfaces.DeformableMirrorController import DeformableMirrorController
from catkit.hardware.boston.DmCommand import DmCommand, convert_dm_image_to_command
from catkit.multiprocessing import Sha... | |
<reponame>wenting-zhao/sgnmt
# -*- coding: utf-8 -*-
# coding=utf-8
# Copyright 2019 The SGNMT 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/LICE... | |
"""
Authors: <NAME>, <NAME>
TUM, 2020
In order to guarantee transferability of models, Network models should follow the following conventions.
Classes should be called
Node
Edge
Network
in order to guarantee correct import in other modules.
"""
# ------------------------------------------------------------------------... | |
<filename>embiggen/pipelines/compute_node_embedding.py
"""Sub-module with methods to compute node-embedding with a one-liner."""
import inspect
import warnings
from typing import Dict, List, Tuple, Union
import pandas as pd
import tensorflow as tf
from cache_decorator import Cache
from ensmallen import Graph
from ..e... | |
<reponame>joaopbicalho/CodingInPython
def get_cur_hedons():
global cur_hedons
return cur_hedons
def get_cur_health():
global cur_health
return cur_health
def offer_star(activity):
global cur_star
global star_counter
global time_since_curstar
global time_since_star
global star_break
global time_since_star1
gl... | |
memory if it is a valid point
if np.isnan(y0).any():
self.mem_ban.add(x0, y0)
else:
self.mem_med.add(x0, y0)
if self.verbose:
print(" y = %s" % np.array_str(y0))
return y0
def feasible_moves(self, x0, dx):
"""Starting from x0, all moves within constraints and not tabu."""
# Generate candidate moves
X = hj... | |
__version__)
models = MODELS_MAP[g_param[OptionsDefine.Version]]
model = models.ModifyLivePlayAuthKeyRequest()
model.from_json_string(json.dumps(args))
rsp = client.ModifyLivePlayAuthKey(model)
result = rsp.to_json_string()
try:
json_obj = json.loads(result)
except TypeError as e:
json_obj = json.loads(result.... | |
if jBase.createDatabase(val) == 0:
bd = TS.SimboloBase(val, None, nodo.mode)
tablaSimbolos.put(val, bd)
consola += "Base de datos " + val + " creada. \n"
else:
consola += "Error al crear la base de datos \n"
elif nodo.owner != False and nodo.mode == False:
if jBase.createDatabase(val) == 0:
bd = TS.SimboloBase(... | |
<reponame>FiskFan1999/ergochat_irctest
#
# (C) Copyright 2011 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License Version
# 2.1 as published by the Free Software Foundation.
#
# This program is distributed in the hope th... | |
<filename>gpsTime.py<gh_stars>0
import numpy as np
from math import modf
import datetime as dt
import calendar
def cal2jd(yr,mn,dy) :
"""
CAL2JD Converts calendar date to Julian date using algorithm
from "Practical Ephemeris Calculations" by <NAME>
(Springer-Verlag, 1989). Uses astronomical year for B.C. dates
(... | |
import numpy as np
import pandas as pd
import re
import warnings
import scipy.optimize as opt
from scipy.stats import norm, f, chi2, ncf, ncx2, binom
from scipy.special import ncfdtrinc, chndtrinc
import matplotlib.pyplot as plt
import seaborn as sns
from poibin import PoiBin
warnings.filterwarnings("ignore")
def... | |
self.cmdForms['loadMacro'].descr.entryByName
ebn['loadMacro']['widget'].configure(state='disabled')
def __call__(self, macroName, macroFile, menuBar='menuRoot',
menuButton='Macros', menuEntry=None, cascade=None, **kw):
"""None<---loadMacro(macroName, macroFile, menuBar='menuRoot',
menuButton='Macros', menuEntry=N... | |
<reponame>rahul2393/python-spanner<filename>samples/samples/snippets_test.py
# Copyright 2016 Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | |
from dg_db.db_write import write_countries, write_skews, write_platforms
def populate_accounts():
countries = [
("Germany", "DE", "Central", "Gat"),
("Austria", "AT", "Central", "Gat"),
("Switzerland", "CH", "Central", "None"),
("France", "FR", "South", "None"),
("Italy", "IT", "South", "None"),
("Spain", "ES... | |
<reponame>mydevice/python-openstackclient
#
# 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 ... | |
in range(maxmajorticks):
if axis == xaxis:
self.majorticks[axis][axissign].append(label(display=self.display, yoffset=-tmajor,
font=graphfont, height=fontheight, border=0,
linecolor=grey, visible=False, box=False, opacity=0))
else:
self.majorticks[axis][axissign].append(label(display=self.display, xoffset... | |
from pypipe import formats
class Bcftools:
@staticmethod
def view():
return {
'cmd': 'bcftools view',
'type': None,
'log': 'log',
'out': {
'redirect': True,
'return': [
{'arg': 'out', 'type': {'b': formats.Bcf, '': formats.Vcf}, 'suffix': ''},
]
},
'args': {
'named': {
'-A': bool,
'-b': bool,
'-D': ... | |
hmn_dhcp_bootstrap = self.sls_networks["HMN"].subnets()["bootstrap_dhcp"]
for name, reservation in hmn_dhcp_bootstrap.reservations().items():
if str(bmc_ip) == str(reservation.ipv4_address()):
reservation_found = True
action_log(action, f'Removing existing IP Reservation for {self.bmc_alias} in the bootstrap_dhcp s... | |
2;
# break;
# BIT instructions
if instruction == 0x24: # $24/36 BIT zp
self.BIT(OperandRef(LOC_VAL, self.zeropage()))
self.pc += 1
return 1
if instruction == 0x2c: # $2C/44 BIT abs
self.BIT(OperandRef(LOC_VAL, self.absolute()))
self.pc += 2
return 1
# case 0x30:
# if (flags & FN) BRANCH()
# else pc++;
... | |
#If gate.qubits is None, gate is assumed to be single-qubit gate
#acting in parallel on all qubits. If the gate is a global idle, then
#Pragma blocks are inserted (for tests like idle tomography) even
#if block_between_layers==False. Set block_idles=False to disable this as well.
if gate.qubits is None:
if quil_fo... | |
:type DnsQueryType: str
:param UserName: 登录服务器的账号
:type UserName: str
:param PassWord: 登录服务器的密码
:type PassWord: str
:param UseSecConn: 是否使用安全链接SSL, 0 不使用,1 使用
:type UseSecConn: int
:param NeedAuth: FTP登录验证方式 0 不验证 1 匿名登录 2 需要身份验证
:type NeedAuth: int
:param ReqDataType: 请求数据类型。0 表示请求为字符串类型。1表示为二进制类型
:type ReqD... | |
<filename>likeyoubot_kaiser.py
import likeyoubot_game as lybgame
import likeyoubot_kaiser_scene as lybscene
from likeyoubot_configure import LYBConstant as lybconstant
import time
import sys
import tkinter
from tkinter import ttk
from tkinter import font
import copy
class LYBKaiser(lybgame.LYBGame):
work_list = [
... | |
<filename>Bucket 1.0/Bucket Interpreter.py<gh_stars>0
#_Bucket Compiler by Pixet Bits {Version : 1.0.0.0}_---------------------------#
import random as rand
#Libraries
LibCtrls = {"[B]" : False, "[F]" : False, "[C]" : False}
#Objects
SfSystVr = {"FLCnt" : 0}
ActivInt = {}
ActivStr = {}
ActivBol = {}
... | |
in self.interface_stp_cfg:
self.cur_cfg["bpdu_filter"] = "enable"
self.existing["bpdu_filter"] = "enable"
else:
self.cur_cfg["bpdu_filter"] = "disable"
self.existing["bpdu_filter"] = "disable"
if self.bpdu_protection:
if "stp bpdu-protection" in self.stp_cfg:
self.cur_cfg["bpdu_protection"] = "enable"
self.ex... | |
inverse=False, init=init, hparams=self._fparams,
disable_dropout=disable_dropout, **kwargs)
if self.is_evaluating and check_invertibility:
z_inv_inv, _, _, _ = glow.glow(
"glow", z_inv, targets_mask, decoder_self_attention_bias,
inverse=True, split_zs=zs, init=False, hparams=self._fparams,
disable_dropout=True, *... | |
<gh_stars>0
import os
import re
import ast
import sys
import json
import uuid
import MySQLdb
import functools
import threading
import subprocess
import unicodedata
import flask, flask.views
app = flask.Flask(__name__)
# Don't do this!
app.secret_key = "bacon"
#get app directory
loc = os.getcwd()+"/"
#variables for r... | |
<gh_stars>0
import sys
import time
import stat
from typing import Any
import random
import subprocess
import glob
import os
import pandas as pd # type: ignore
from pathlib import Path
from typing import List
from sys import platform
import pathlib
import shutil
import traceback
from pylpg.lpgdata import *
from pylpg.lp... | |
# 1972 article
n = int(n)
d = len(A)
if len(set(a%d for a in A)) == d:
return [i*d for i in range(n//d)]
# next, we consider an exhaustive search
from sage.combinat.dlx import DLXMatrix
rows = []
for i in range(n):
rows.append([i+1, [(i+a)%n+1 for a in A]])
M = DLXMatrix(rows)
for c in M:
return [i-1 for ... | |
isinstance(o.rvalue, CallExpr):
call_expr = o.rvalue
if self._IsInstantiation(call_expr):
temp_name = 'gobj%d' % self.unique_id
self.unique_id += 1
self.log('INSTANCE lval %s rval %s', lval, call_expr)
self.write('%s %s', call_expr.callee.name, temp_name)
# C c;, not C c(); which is most vexing parse
if call_... | |
= Var(within=Reals,bounds=(0,1),initialize=0)
m.x598 = Var(within=Reals,bounds=(0,1),initialize=0)
m.x599 = Var(within=Reals,bounds=(0,1),initialize=0)
m.x600 = Var(within=Reals,bounds=(0,1),initialize=0)
m.x601 = Var(within=Reals,bounds=(0,1),initialize=0)
m.x602 = Var(within=Reals,bounds=(0,1),initialize=0)
m.x603 = ... | |
from django.contrib import admin
from parler.admin import TranslatableAdmin
from django.utils.html import format_html
from django.forms import BaseInlineFormSet
from django.shortcuts import redirect
from django import forms
import data_wizard # Solution to data import madness that had refused to go
from django.conf imp... | |
<gh_stars>1-10
"""Core async functions."""
import asyncio
from pathlib import Path
from ssl import SSLContext
from typing import Any, Awaitable, Dict, List, Optional, Sequence, Tuple, Union
import cytoolz as tlz
import ujson as json
from aiohttp import TCPConnector
from aiohttp.typedefs import StrOrURL
from aiohttp_cl... | |
<reponame>ssalonen/pandas<filename>pandas/io/html.py<gh_stars>0
""":mod:`pandas.io.html` is a module containing functionality for dealing with
HTML IO.
"""
import os
import re
import numbers
import collections
from distutils.version import LooseVersion
import numpy as np
from pandas import DataFrame, MultiIndex, i... | |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | |
import pandas as pd
import sys
import numpy as np
import scipy as sp
import json
import os
from decimal import Decimal
import scipy.optimize as opt
from scipy.optimize import minimize, curve_fit
from scipy.special import erfc
from scipy.stats import crystalball
from scipy.signal import medfilt, find_peaks
import pygama... | |
condition(self):
""" Return a non-numerical health status """
status = "unknown"
if self.getHitPoints() <= 0:
status = "dead"
elif self.getHitPoints() < self.getMaxHP() * 0.10:
# Less than 10% of health remains
status = "desperate"
elif self.getHitPoints() < self.getMaxHP() * 0.25:
# 11-25% of health remains
... | |
:class:`int`
:param invite_link: If user has joined the chat using an invite link, the invite link; may be null, defaults to None
:type invite_link: :class:`ChatInviteLink`, optional
:param old_chat_member: Previous chat member
:type old_chat_member: :class:`ChatMember`
:param new_chat_member: New chat membe... | |
nav_only["NAV_fx"][0]) * 100
nav_only["NAV_ret"] = nav_only["NAV_norm"].pct_change()
table = {}
table["meta"] = {}
table["meta"]["start_date"] = (nav_only.index[0]).strftime("%m-%d-%Y")
table["meta"]["end_date"] = nav_only.index[-1].strftime("%m-%d-%Y")
table["meta"]["number_of_days"] = (
(nav_only.index[-1] - n... | |
return not (self == other)
class EndMaintenanceResult:
"""
Attributes:
- statuses
"""
thrift_spec = (
None, # 0
(1, TType.SET, 'statuses', (TType.STRUCT,(HostStatus, HostStatus.thrift_spec)), None, ), # 1
)
def __init__(self, statuses=None,):
self.statuses = statuses
def read(self, iprot):
if iprot.__cl... | |
#!/usr/bin/env python3
#
# Copyright (c) <NAME> and the University of Texas MD Anderson Cancer Center
# Distributed under the terms of the 3-clause BSD License.
import contextlib
import logging
import os
import subprocess
import sys
import time
from collections import OrderedDict, defaultdict
from textwrap import dede... | |
<filename>venv/Lib/site-packages/dash/testing/browser.py
# pylint: disable=missing-docstring
import os
import sys
import time
import logging
import warnings
import percy
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from sele... | |
#!/usr/bin/env python
"""Web server for the NDVI Time Series Tool application.
The code in this file runs on App Engine. It's called when the user loads the
web page, requests a map or chart and if he wants to export an image.
The App Engine code does most of the communication with EE. It uses the
EE Python library a... | |
# Copyright 2018 Jetperch LLC
#
# 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, sof... | |
<reponame>kustodian/google-cloud-sdk
"""Generated client library for cloudbuild version v1."""
# NOTE: This file is autogenerated and should not be edited by hand.
from apitools.base.py import base_api
from googlecloudsdk.third_party.apis.cloudbuild.v1 import cloudbuild_v1_messages as messages
class CloudbuildV1(base... | |
method
PARAMS:
name: str
A name/alias given to the model by the user
layers: list of integers
List of neuron size for each layer
dropout: float
Level of dropout
recurrentDropout: float
Level of recurrent dropout
alpha: float
Alpha of the leaky relu function
training: boolean
Whether dropout should be use... | |
1: ['a', 'e'],
2: ['b', 'c'],
3: ['d'],
}
"""
key_to_vals = defaultdict(list)
for key, val in zip(key_list, val_list):
key_to_vals[key].append(val)
return key_to_vals
def assert_keys_are_subset(dict1, dict2):
"""
Example:
>>> # DISABLE_DOCTEST
>>> dict1 = {1:1, 2:2, 3:3}
>>> dict2 = {2:3, 3:3}
>>> asser... | |
and try to find the biggest space for the segment
segments = [
segment.seg
for segment
in sorted(self._machoCtx.segmentsI, key=lambda x: x.seg.vmaddr)
]
# check to make that __TEXT and __LINKEDIT segments are at the edges
if segments[0].segname != b"__TEXT":
raise _ObjCFixerError("MachO file does n... | |
import os
from typing import Dict, Optional, Union
import geopandas as gpd
import numpy as np
import pandas as pd
from geopandas import GeoDataFrame
from shapely.geometry import Point
from pyproj import CRS
from .logger import RanchLogger
from .osm import add_two_way_osm, highway_attribute_list_to_value
from .paramet... | |
<filename>server/src/weblab/admin/script/creation.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consi... | |
<filename>frb/dlas.py
""" Module for assessing impact of intervening galaxies
(DLAs) on FRB measurements
Based on calclations presented in Prochaska & Neeleman 2017
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
from scipy.interpolate import inte... | |
<==> x<=y
"""
pass
def __len__(*args, **kwargs):
"""
x.__len__() <==> len(x)
"""
pass
def __lt__(*args, **kwargs):
"""
x.__lt__(y) <==> x<y
"""
pass
def __mul__(*args, **kwargs):
"""
x.__mul__(y) <==> x*y
"""
pass
def __ne__(*args, **kwargs):
"""
x.__ne__(y) <==> x!=y
"""
... | |
<gh_stars>1-10
import os
import matplotlib as mpl
if os.environ.get('DISPLAY','') == '':
print('no display found. Using non-interactive Agg backend')
mpl.use('Agg')
import sys
import json
import re
import matplotlib.pyplot as plt
sys.path.insert(0, './include')
from plot_utils import *
from common import *
from uti... | |
<filename>cartopy_fun.py
# Having fun with Cartopy.
# inspired by the work of @pythonmaps on Twitter
# eg. https://twitter.com/PythonMaps/status/1391056641546768388
# <NAME>, 10th of May 2021, MIT-License
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from numpy import genfromtxt
imp... | |
# and does not need any further processing
return p
else:
return ctypes.c_void_p(p)
else:
error = yami4py.yami4_get_error(result)
yami4py.yami4_destroy_result(result)
raise YAMIError(str(error))
def _string(result):
"""Extracts the string result from underlying library."""
if result == None:
raise YAMIError... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#****************************************************************************************************************************************************
# Copyright 2017 NXP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifi... | |
start:
self.quiet += 1
else:
self.quiet -= 1
if tag == "style":
if start:
self.style += 1
else:
self.style -= 1
if tag in ["body"]:
self.quiet = 0 # sites like 9rules.com never close <head>
if tag == "blockquote":
if start:
self.p()
self.o("> ", force=True)
self.start = True
self.blockquote += 1
els... | |
os.getcwd()
self.run_dir = os.path.join(cwd, self.run_dir)
print(self.run_dir)
if os.path.isdir(self.run_dir):
shutil.rmtree(self.run_dir, ignore_errors=True)
if pgm_dir:
shutil.copytree(pgm_dir, self.run_dir)
if pgm_files:
os.makedirs(self.run_dir)
for f in pgm_files:
shutil.copy(f, self.run_dir)
# pre_pass... | |
for signature in signature_solutions_aggregate:
if signature['ss_id'] not in signature_list and signature['percentage'] != 0:
signature_list.append(signature['ss_id'])
signature_aggregate.append(signature)
if others['percentage'] != 0:
signature_aggregate.append(others)
project_mapping = get_project_aggregate(yea... | |
#!/usr/bin/env python
#
# Copyright (C) 2017 ShadowMan
#
"""
A high-level overview of the framing is given in the following figure.
B 0 * * * * * * * 1 * * * * * * * 2 * * * * * * * 3 * * * * * * * -
| | | | |
0 | 1 | 2 | 3 |
i 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
+-+-+-+-+-------+-+---... | |
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)
brush = QtGui.QBrush(QtGui.QColor(127, 255, 127))
br... | |
that are present in both.
The Jaccard distance is a simple measure of the
dissimilarity between two StructureGraphs (ignoring
edge weights), and is defined by 1 - (size of the
intersection / size of the union) of the sets of
edges. This is returned with key 'dist'.
Important note: all node indices are in terms
... | |
hight, n_vertical, n_horizental)
# details = [0,0,0]
# details[0] = node_index
# details[1] = parent_index
# details[2] = hight
# details[3] = n_vertical
# details[4] = n_horizental
# p_sym = 1
# return p_sym, details
# def do_vertical_stretching(self, neuron):
# """
# In one of the segments that coming out from a bra... | |
#!/opt/anaconda/bin/python
# -*- coding: utf-8 -*-
# Unfortunately the `which` way of calling python can't accept command-line arguments.
"""
Created on Mon Nov 03 16:13:48 2014
@author: <NAME>
@email: <EMAIL> OR <EMAIL>
A selection of alignment routines designed for registering and summing stacks
of image... | |
__all__ = ('Embed',)
from ...backend.utils import copy_docs
from ..utils import parse_time
from .embed_base import (
EmbedBase,
EmbedFooter,
EmbedImage,
EmbedThumbnail,
EmbedVideo,
EmbedProvider,
EmbedAuthor,
EmbedField,
)
class Embed(EmbedBase):
"""
Represents Discord embedded content. There are two def... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.