text stringlengths 6.04k 39.5k |
|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#############################################################################
## PyAlsaCap
## inspired from alsacap written by <NAME>
## http://www.volkerschatz.com/noise/alsacap.c
##
## Author:<NAME>
## Last edit: 20130310
## Licence: ISC
##
## Copyright (c) 2013 <NAME> ... |
from LambdaQuery.expr import *
from LambdaQuery.do_notation import *
class Query(Table, Monad):
alias = 'query'
def __init__(self, columns, joincond=AndExpr(), groupbys=L(), leftjoin=False):
self.columns = columns
self.joincond = joincond
self.groupbys = groupbys
self.... |
############################################################################################
#Copyright 2021 Google 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
#
# https://www.a... |
############################################
# EE635 Final Project
# Integration of V2G for Renewables
# Collaborators: <NAME>;
# <NAME>;
# Sahara, <NAME>.;
# two models? one accounting for generation,
# one with curtail data
############################################
from p... |
# * Copyright 2020-2021 <NAME>.
# *
# * Use of this source code is governed by an MIT-style
# * licence that can be found in the LICENSE file.
from copy import deepcopy
from math import floor
import datetime
G11Scale = {
'A': [90, 100],
'A-': [85, 89],
'B+': [80, 84],
'B':... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2010-2018 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... |
'Python script for creating a 2D model of interacting spins'
import pyomo.environ
from pyomo.opt import SolverFactory
import time
import scipy.optimize
import numpy as np
import pyOpt
from spin_plot import plot_spins
class Vector(object):
'Class for a 2D vector in Cartesian space'
def __init__(self, x, y):
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 18 11:42:01 2019
Some general rules of testing:
# A testing unit should focus on one tiny bit of functionality and prove it
correct.
# Each test unit must be fully independent.
Each test must be able to run alone, and also within ... |
from typing import *
import numpy as np
import pandas as pd
import scipy.stats as stats
from scipy import sparse as sp
import torch
class Graph(object):
def __init__(self, num_nodes: int, edges: np.ndarray, flow: np.ndarray = None):
self._verify(num_nodes, edges, flow)
self._num_nodes = num_node... |
"""
AWS client-side authentication: standard credentials providers and signing.
"""
# Copyright 2010-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 Licen... |
"""
Base classes for collections of samples.
| Copyright 2017-2020, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import inspect
import logging
import os
import eta.core.serial as etas
import eta.core.utils as etau
import fiftyone.core.fields as fof
import fiftyone.core.labels as fol
import fiftyone.co... |
import pygame
import os
import random
import pyautogui
from Ky_Game import color
from pygame import mixer
pygame.font.init()
pygame.mixer.init()
# GENERAL CONSTANTS
WIDTH, HEIGHT = pyautogui.size()
FPS = 90
ORIGIN = (0, 0)
# adding music
pygame.mixer.music.load( "assets/bgm.wav" )
laser_Sound = pygame... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# Modified by: <NAME>
from __future__ import absolute_import, division, print_function
import colorsys
import math
from typing import Optional, Sequence, Tuple, Union
import cv2
import matplotlib as mpl
import matplotlib.colors as mplc
import ma... |
import datetime
import re
from collections import namedtuple
from enum import Enum
import geopy.distance
import polar_rcx5_datalink.utils as utils
from .exceptions import ParserError
from .utils import bcd_to_int
class SampleFields(Enum):
HR = 'hr'
LON = 'lon'
LAT = 'lat'
DISTANCE = 'distance'
S... |
"""labtool/src/classes.py"""
# dunders
__author__ = "<NAME>"
__all__ = ["CDContxt", "CurveFit", "Interpolate", "Student", "StudentArray"]
# std library
from os import chdir, getcwd
from typing import Callable, Union
# 3rd party
from matplotlib import pyplot as plt
from matplotlib.figure import Figure
from numpy impo... |
import json
from ddipy.constants import BAD_DATASET_OBJECT
from ddipy.ddi_utils import BadRequest
PUBLICATION_DATE = 'publication'
SUBMISSION_DATE = 'submission'
UPDATE_DATE = 'update'
CITATION_COUNT = 'citationCount'
REANALYSIS_COUNT = 'reanalysisCount'
SEARCH_COUNT = 'searchCount'
VIEW_COUNT = 'viewCount'
CONNECTI... |
"""
Copyright (c) 2018 Intel Corporation
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,... |
# -*- coding: utf-8 -*-
#
# keyboard.py - a module from ruautogui package that simulates human-like
# typing.
# Features:
# - simulates typing by using the so-called virtual keys;
# - cyrillic (russian) alphabet is supported;
# - tuned typing speed;
# - hotkeys are supported.
import logging
log... |
import warnings
from scipy import stats
from sklearn.preprocessing import PolynomialFeatures, PowerTransformer
import pandas as pd
import numpy as np
from typing import List, Union, Tuple, Set
#_____________________________________________________________________________________________________________________________... |
"""The Vegas train line from Auntie's Christmas display:
- Departing Announcement (relay so sound goes in to correct speaker)
- Accelerate towards left platform
- Turn on Wigwag and sound (2 relays one for wigwag one for sound)
- Decelerate (probably same start timing as Wigwag)
- Stop at platf... |
"""
Collection of sampling schemes for the sphere
"""
import os
import urllib3
import numpy as np
from spharpy.samplings.coordinates import Coordinates, SamplingSphere
import spharpy
from ._eqsp import point_set as eq_point_set
def cube_equidistant(n_points):
"""Create a cuboid sampling with equidistant spacings ... |
# Copyright 2018 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://www.apache.org/licenses/LICENSE-2.0
#
# or in th... |
# -*- coding: utf-8 -*-
"""
Here are a collection of examples of how this module can be used.
See the README or the natsort homepage for more details.
>>> a = ['a2', 'a5', 'a9', 'a1', 'a4', 'a10', 'a6']
>>> sorted(a)
[{u}'a1', {u}'a10', {u}'a2', {u}'a4', {u}'a5', {u}'a6', {u}'a9']
>>> natsorted(a)
... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 <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 ... |
import discord
import aiohttp
import asyncpg
from Utilities import Checks, Vars
class Association:
"""The association (guild/brotherhood/college) object. Changing the object
attributes are not permanent but siotable for cases in which temporary
changes can be advantageous in some commands. Ge... |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 21 12:58:54 2018
@author: khaahti
"""
import numpy as np
eps = np.finfo(float).eps
from scipy.interpolate import interp1d
apply_vectorized = np.vectorize(lambda f, x: f(x))
class SoilGrid(object):
"""
Soil profile model for gridded uses (inputs as arrays)
Si... |
import matplotlib.pyplot as plt
from matplotlib.path import Path
import matplotlib.patches as patches
import numpy as np
import math
import time
import vrep
RRobot = 17.7
Clearance = 12.3
extra_sum = RRobot + Clearance
vrep.simxFinish(-1)
clientID = vrep.simxStart('127.0.0.1', 19997, True, True, 1700, ... |
import brachiosaurus as bs # heartbreakingly, python won't accept 🦕 as an alias
import math
import random
𝕣 = random.random
τ = 2 * math.pi
def spiral_mountain(c):
"""
First shot at implementing spirals, looks a bit like an inverted mountain.
"""
cx = 0
cy = 0
w = 10
j = 1
detail ... |
"""utils.py: Utility functions for MAVE-NN."""
# Standard imports
import numpy as np
import pandas as pd
import mavenn
import random
import pdb
import pickle
import time
import os
# Import Tensorflow
import tensorflow as tf
# Imports from MAVE-NN
from mavenn.src.error_handling import handle_errors, check
from mavenn... |
# This file contains the networking backend of the teacher program
# it should not be run directly, it is for the teacher program to import
# Created by <NAME>
import teacher_test_manager as tm
import queue, json, random, datetime
from PyQt5 import QtCore, QtNetwork, QtGui
def lockMethod(fn):
'''Takes and releas... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
import argparse
import torch
import pickle
import cv2
import matplotlib.pyplot as plt
import sys
import os
import numpy as np
import os
from parse_3d import get_poses, get_cam_poses
from scipy.optimize import least_squares
# from parse_alphapose_results import parse_alphapose
from utils import initialize, construct_pos... |
__author__ = "<NAME>"
__email__ = "<EMAIL>"
"""
Various indexing techniques
"""
import heapq
from .labeling import Spec
class Index(object):
def insert(self, key, value):
assert False
def get_subsets(self, key):
assert False
def remove_subset(self, key):
assert False
cla... |
import torch
from torch import nn
import torch.nn.functional as F
def pad_tensor(input):
height_org, width_org = input.shape[2], input.shape[3]
divide = 16
if width_org % divide != 0 or height_org % divide != 0:
width_res = width_org % divide
height_res = height_org % divide
... |
import random
import re
import serial
from props import getNode
import props_json
from comms import aura_messages
import comms.events
from comms.packer import packer
import comms.serial_parser
import survey.survey
status_node = getNode( '/status', True)
route_node = getNode( '/task/route', True )
task_node = getNode... |
"""Functions for generating interesting polynomials, e.g. for benchmarking. """
from __future__ import print_function, division
from sympy.core import Add, Mul, Symbol, sympify, Dummy, symbols
from sympy.core.containers import Tuple
from sympy.core.singleton import S
from sympy.functions.elementary.miscellaneous impo... |
# -*- coding: utf-8 -*-
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from gluon import current
from gluon.html import A, URL, TR, TD
from gluon.storage import Storage
from s3 import s3_fullname, S3Represent, S... |
from pathlib import Path
from os import system, name
from library.download import downloadFile
from time import sleep
import subprocess
try:
import requests
except ModuleNotFoundError:
subprocess.run(["pip install requests"])
import os
import shutil
import sys
binDir = "./bin"
scriptsDir = "./scripts"
tempD... |
import sys
import time
from datetime import timedelta, datetime as dt
from monthdelta import monthdelta
import holidays
import re
import threading
import inspect
from contextlib import contextmanager
import traceback
import logging
# default logging configuration
# logging.captureWarnings(True)
LOG_FORMATTER = loggin... |
"""
Various helping functions. Plotting, saving/loading results, creating synt
cubes, image processing.
"""
from __future__ import division
from __future__ import print_function
__all__ = ['plot_traindata',
'save_res',
'load_res',
'load_model',
'svd_decomp',
'ge... |
# -*- coding: utf-8 -*-
"""
@author: hkaneko
"""
import random
import sys
import matplotlib.figure as figure
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import structure_generator
from deap import base
from deap import creator
from deap import tools
from rdkit import Chem
f... |
# Copyright (c) 2016-2017 Intel Corporation
#
# 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... |
import os
import sys
import yaml
import logging
from optparse import OptionParser
from lib.api import DataverseApi
from lib.database import DataverseDatabase
from lib.output import Output
from lib.email import Email
from reports.dataverse import DataverseReports
from reports.dataset import DatasetReports
from reports... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019-2020 CERN.
# Copyright (C) 2019-2020 Northwestern University.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""JSON Schemas."""
import time
from datetime import d... |
# -*- coding: utf-8 -*-
from __future__ import division, unicode_literals
import os.path
import io
import re
from collections import defaultdict
from functools import total_ordering
from .messages import *
force = True
quiet = True
dryRun = False
printMode = "console"
scriptPath = os.path.dirname(os.path.realpath(__fi... |
"""Symbolic routines
Author: Dr.-Ing. <NAME>
This module offers a collection of tensor routines in sympy.
"""
# %% Import
import sympy as spy
import numpy as np
from itertools import permutations
import tensor_routines as tr
# %% Generate tensors
def t(n: int, s: str = "a", dims: list = None) -> spy.Array:
... |
from torch.autograd import Variable
from lib.distributions import Normal
from util.misc import reduce_mean
import numpy as np
global epoch
epoch = 0
def train(data, model, optimizers, train_config, data_config):
"""
Function to train the model on data.
"""
return run(data, model, train_config, data_c... |
from GtBurst.my_fits_io import pyfits
import sys
import os, glob
import shlex, subprocess, shutil
import numpy
from GtBurst.dataHandling import create_from_columns
#The RSP2 matrix for the GBM are computed by interpolating a grid of
#responses containing Montecarlo-generated rsp for different position of
... |
import rasterio
from rasterio.plot import adjust_band
import matplotlib.pyplot as plt
from rasterio.plot import reshape_as_raster, reshape_as_image
from rasterio.plot import show
from rasterio.windows import Window
import rasterio.features
import rasterio.warp
import rasterio.mask
from shapely.geometry import Polygon
f... |
"""Console script to print and save system information. (:mod:`fluiddyn.util.info`)
===================================================================================
Displays all important information related to software and hardware. It also
includes detailed information such as currently installed FluidDyn packages... |
"""多带Hubbard模型用的流方程"""
#pylint: disable=pointless-string-statement, global-statement
import multiprocessing
import numpy
from basics import Point, get_procs_num
from fermi.patches import find_patch_mode2, find_patch_mode3, find_patch
from fermi.multiband_bubble import pi_ab_plus_tf, pi_ab_minus_tf
U = None
def uin... |
"""PyTorch dataset for HDF5 files generated with `get_data.py`."""
import os
import random
from rotation import rotate_point
import cv2
import h5py
from PIL import Image
from scipy.ndimage.filters import gaussian_filter
from skimage.feature.peak import peak_local_max
import torch
import numpy as np
from torch.utils.da... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
import numpy as np
import os
import yaml
import logging
from datetime import datetime
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch ... |
#!/usr/bin/env python3
import ipaddress
from genconfig.parser import *
class IPTables:
BUILTIN_CHAINS = {
'filter': [ 'INPUT', 'FORWARD', 'OUTPUT'],
'nat': [ 'PREROUTING', 'INPUT', 'OUTPUT', 'POSTROUTING' ],
'mangle': [ 'PREROUTING', 'INPUT', 'FORWARD', 'OUTPUT', 'POSTROUTING' ],
... |
import re
import requests
import sys
import pandas as pd
import numpy as np
from bs4 import BeautifulSoup
from pdb import set_trace as pb
max_fallback = 2
class Currency:
def __init__(self):
self.data = {}
self.data_hist = {}
def get(self, currency_pair):
... |
from sqlalchemy import ForeignKey, Table, Column, Integer, String, Float
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
# initiates a base sqlalchemy class that handles python<>SQLite "translation"
Base = declarative_base()
# join tables
kinases_inhibitors_table = Ta... |
# -*- coding: utf-8 -*-
'''
Read data from JSON files,
in the meantime, we do preprocess like capitalize the first character of a sentence or normalize digits
'''
import os
import json
from collections import Counter
import numpy as np
import argparse
from io_utils import read_yaml, read_lines, read_json_line... |
# -*- coding: utf-8 -*-
"""Shared GUI classes and functions."""
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import os
import os.path as op
import numpy as np
from functools import partial
from qtpy import QtCore
from qtpy.QtCore import Slot
from qtpy.QtWidgets import (QMainWindow, QGridLayout,
... |
"""
Created on 10/15/17.
@author: <NAME>, <NAME>
"""
import logging
logging.getLogger('tensorflow').setLevel(logging.ERROR)
import tensorflow as tf
import numpy as np
import argparse
import json
import time
import sys
import os
import copy
import subprocess, shlex
import shutil
import contextlib
import itertools
import... |
# -*- coding: UTF-8 -*-
# Copyright (C) 2016 <NAME> at Chongqing University
# of Posts and Telecommunications, Chongqing, China.
#
# 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... |
import numpy as np
import tensorflow as tf
import cv2
import time
import sys,os
# opencv2 have problem in read video from file, imageio do better.
import imageio
class YOLO_VIDEO:
rules = []
rule_imgs=[]
fromvideo = None
MaxFrameNum = 0
writer = None
ftxt = None
tofile_video = '../test/outp... |
from logging import error
import os
import time as tt
import argparse
from matplotlib import pyplot as plt
import numpy as np
import tensorflow as tf
from datetime import datetime
from tensorflow import keras
from tensorflow.keras.optimizers import Adam
from folder import check_folders
from utils.datasetGenerator i... |
import logging
from datetime import datetime, timezone
import pandas as pd
from django.contrib.auth.models import User
from django.db import transaction
from django.db.transaction import atomic
from django.utils.translation import gettext_lazy as _
from gspread.exceptions import APIError
from rest_framework import exc... |
from __future__ import absolute_import
from __future__ import print_function
import sys, os, yaml, glob
from yaml import YAMLError
import subprocess
import argparse
import itertools
import re
import shutil
from nougat import common, align, pdf
from nougat.pdf.theme import colors, DefaultTheme
from nougat.pdf.peakdetect... |
from django.shortcuts import render
from collageApp.models import Students,Marks,Carryover
from django.db import IntegrityError
from collections import defaultdict as dfd
#############################
from selenium import webdriver
import time
from selenium.webdriver.support.ui import Select
from selenium.webdr... |
#!/usr/bin/python
__author__ = 'Randall'
# system imports
from datetime import datetime
import sqlite3
import logging
import os
import traceback
import configparser
# opml and feedparser
import feedparser
import opml
# email imports
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.tex... |
#!/usr/bin/python
"""
Data Models for books.service
All classes can be instantiated from an xml string using their FromString
class method.
Notes:
* Book.title displays the first dc:title because the returned XML
repeats that datum as atom:title.
There is an undocumented gbs:ope... |
import pygame
import math
from common import View, Controller
class DotFont:
def __init__(self) -> None:
self.segmap = {
'0': [[0, 1, 1, 0], [1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1], [0, 1, 1, 0]],
'1': [[0, 0, 1, 0], [0, 1, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0], [1, 1, 1, 1]],
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Training wheel extractor from Pybpod output.
"""
import os
import logging
import numpy as np
from scipy import interpolate
import ibllib.io.raw_data_loaders as raw
from ibllib.misc import structarr
import brainbox.behavior.wheel as wheel
logger_ = logging.getLogger('i... |
import json
import mysql.connector # Connect to SQL database
from mysql.connector import errorcode # SQL database error management
from measurement.utils import guess # To guess a measure: for example guess(2, 'cm') -> Distance(m=0.02)
from measurement.base import MeasureBase # To create custom mea... |
from __future__ import print_function, division
from sklearn.metrics import confusion_matrix
from scipy.linalg import eig
from scipy import sqrt
import scipy.signal as sig
import numpy as np
import socket
import logging
import pickle
import os
import gc
OVTK_StimulationLabel_Base = 0x00008100
commands = ['1', '2', '3'... |
import tkinter
from tkinter import messagebox
import math
import sys
import os
import numpy as np
import pandas as pd
import datetime
c = 1
r = 1
color = "Green"
class ConfigurationError(Exception):
pass
class CPUException(Exception):
pass
class MemoryOutOfRange(CPUException):
pass
class InvalidOpe... |
from kivy import graphics
from kivy.core.image import Texture
from kivy.uix.widget import Widget
from kivy.graphics import (
RenderContext, BindTexture, Rectangle, Color
)
from kivy.graphics.scissor_instructions import ScissorPush, ScissorPop
from kivy.uix.image import Image as kiImage
from kivy.core.image import I... |
import logging
import os
import random
import sys
from dataclasses import dataclass, field
from typing import Optional
import numpy as np
import wandb
from datasets import load_dataset, load_metric, load_from_disk
import transformers
from transformers import (
AutoConfig,
AutoModelForSequenceClassification,
... |
# *****************************COPYRIGHT******************************
# (C) Crown copyright Met Office. All rights reserved.
# For further details please refer to the file LICENCE.txt
# which you should have received as part of this distribution.
# *****************************COPYRIGHT******************************
#... |
from flask import Flask, flash, redirect, render_template, render_template_string, request, session, abort, send_from_directory
from flask import jsonify
from libra import AccountConfig, Address
import werkzeug
from flask_babel import Babel
from flask_babel import _
import json
import os
import requests
from v... |
import numpy as np
from scipy.integrate import odeint
import locale
import z_l_v
# Theorie und Aufstellung der Gleichungen:
# https://git.io/fdKBI
namen = ['CO', 'CO2', 'H2', 'H2O', 'MeOH',
'CH4', 'N2', 'EthOH', 'PrOH', 'METHF']
mm = np.array([
28.01, 44.01, 2.016,
18.015, 32.042, 16.043,
28.014,... |
#!/usr/bin/env python3
#
# SPDX-FileCopyrightText: 2018-2020 <NAME> <<EMAIL>>
# SPDX-FileCopyrightText: 2019-2020 <NAME> <<EMAIL>>
# SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Generates fastlane metadata for Android apps from appstream files.
#
import argparse
impor... |
import math
import time
import cv2
import numpy as np
## ---------------Object Detection -----------------##
def str2bool(v):
return v.lower() in ("yes", "true", "t", "1")
def is_moving(obj,thresh):
obj_mov=False
if (len(obj)>1):
x,y,w,h = obj[-1][2]
x_old,y_old,w_old,h_old = obj[-2][2]
... |
#!/usr/bin/python -u
"""Module for reading the TinyG config.
"""
from __future__ import print_function
import argparse
from argparse import RawDescriptionHelpFormatter
import json
import re
import serial
import sys
import time
CONFIG_STR = {
'sys' : (
( 'fb', 'firmware build', '{:.2f}... |
# -*- coding: utf-8 -*-
"""
Random Network Distillation (RND) with Proximal Policy Optimization (PPO) implentation in Tensorflow.
This is a continuous action version which solves the mountain car continuous problem (MountainCarContinuous-v0).
The RND helps learning with curiosity driven exploration.
"""
import tensorf... |
import asyncio
import copy
import datetime
import io
import pickle
import aiohttp
import discord
import pytz
from discord.ext import commands
from discord_slash import cog_ext, SlashContext
from discord_slash.utils.manage_commands import create_option, create_choice
from ElevatorBot.backendNetworking.destinyPlayer im... |
"""
To make this file run on mac, do the following:
1. Create an account at https://cds.climate.copernicus.eu/user/register?destination=%2F%23!%2Fhome
2. Log in to CDS at https://cds.climate.copernicus.eu/user/login
3. Copy the url and key at https://cds.climate.copernicus.eu/api-how-to
4. Create the file .cdsapirc at ... |
import csv
from pathlib import Path
from rest_framework import status
from parameterized import parameterized
from core.models.enums import LevelType
from .base_test_class import BasePermissionTest
from .expected_permission_list import ExpectedPermission, ExpectedPermissionList, PermissionListSimulator
PERMISSON_ADD... |
#!/usr/bin/python
"""psize
Get dimensions and other information from a PQR file.
Authors: <NAME>, <NAME>, <NAME>, <NAME>
"""
from math import log
import logging
import argparse
CFAC = 1.7
FADD = 20.0
SPACE = 0.50
GMEMFAC = 200
GMEMCEIL = 400
OFRAC = 0.1
REDFAC = 0.25
_LOGGER = logging.getLogger(__name__)
class P... |
#!/usr/bin/env python
# coding: utf-8
# ## Data fields
# ### N - ratio of Nitrogen content in soil - kg/ha
# ### P - ratio of Phosphorous content in soil - kg/ha
# ### K - ratio of Potassium content in soil - kg/ha
# ### temperature - temperature in degree Celsius
# ### humidity - relative humidity in %
# ### ph - ph ... |
# lattices.py - build FCA concepts lattice from context
"""Formal Concept Analysis concept lattices."""
import heapq
from ._compat import py3_unicode_to_str
from . import tools, visualize
__all__ = ['Lattice']
@py3_unicode_to_str
class Lattice(object):
"""Formal concept lattice as directed acyclic graph of c... |
from __future__ import division
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import os
p, fr, _lw, w, fs, sz = 2, 0.75, 0.5, 1, 6, 0.5
minS = 1.2
minN = 0
mydir = os.path.expanduser('~/GitHub/residence-time2/Emergence')
tools = os.path.expanduser(mydir + "/tools")
df = pd.read_csv(mydir +... |
#
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: BSD-3-Clause
#
import cv2
import torch
import kornia
import numpy as np
import matplotlib.pyplot as plt
from detectron2.data import detection_utils as utils
from detectron2.config import get_cfg
from detectron2.modeling import build_model
from dete... |
#!/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... |
"""The widgets are the heart of jupyanno package and bring together
tasks as task panels (with images) and answer panels (with buttons
and multiple choice options)"""
import json
import os
import warnings
from collections import namedtuple, defaultdict
from io import BytesIO
from time import time
from typing import Opt... |
# Copyright (C) 2011 Google Inc. All rights reserved.
# Copyright (C) 2018 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above ... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import os
import json
import re
import time
import cfnresponse
import boto3
# Media file suffixes must match one of the supported file types
SUPPORTED_MEDIA_TYPES = ["mp3","mp4","wav","flac","ogg","amr","webm"]
from ... |
#!/usr/bin/env python3
"""
Created on Friday November 24 17:08:18 2021
@author: <NAME>
Calculates atmospheic energy transport (dry static, latent, kinetic)
The atmospheric energy transport functions can be used to calculate e.g.
- zonal mean values
- timeseries of transport across a given latitude
- seasonal average... |
# create_mixinfo.py
# -- This script works for up to 6 sources
# This script
# -- makes pairs of two utterances
# -- avoiding (A.) same speaker's utterances are mixed
# (B.) same pair (e.g. A-B / B-A) is made
# -- decides offset of shorter utterance
# -- decides SNR
# -- decides parameters su... |
import argparse
import time
import os
import sys
import multiprocessing
import pickle
import h5py
import numpy as np
from tqdm import tqdm
from modules.core.CandidateFinder import CandidateFinder
from modules.core.ImageGenerator import ImageGenerator
from modules.handlers.BamHandler import BamHandler
from modules.hand... |
"""
Copyright 2017 <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... |
# -*- coding: utf-8 -*-
"""Embedding modules."""
from __future__ import annotations
import functools
import logging
import warnings
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Any, Callable, Mapping, Optional, Sequence, TYPE_CHECKING, Tuple, TypeVar, Union, cast
import n... |
# -*- coding: utf-8 -*-
"""
network_down_detectors_on_tcp_conn_v1.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A fully-functional connection-observer using configured concurrency variant.
This is Layer_3 example:
- shows configuration phase and usage phase
- configuration via python code
- uses Moler provided TCP co... |
# -*- coding: iso-8859-15 -*-
"""
Reads output from WVSR post-processing to make spectroscopy datasets
The columns in the .fft files are::
freq - frequency in Hz
IF1-ps - pol 1 power
IF2-ps - pol 2 power
IF1-phase - pol 1 voltage phase
IF2-phase - pol 2 voltage phase
I - Stokes I, which ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.