text stringlengths 6.04k 39.5k |
|---|
#!/usr/bin/env python
# coding: utf-8
# Copyright 2022 by Leipzig University Library, http://ub.uni-leipzig.de
# <NAME>, <<EMAIL>>
#
# This file is part of the Spcht.
#
# This program is free software: you can redistribute
# it and/or modify it under the terms of the GNU General Public
# License as p... |
from typing import Dict, Optional, Any
import numpy as np
import scipy
import pandas as pd
import threading
def black_scholes(S, K, T, rf: float, iv, option_type) -> pd.DataFrame:
"""
Black Scholes modeling function.
* https://www.newyorkfed.org/medialibrary/media/research/staff_reports/sr677.pdf
... |
from __future__ import annotations
import socket
import logging
import re
import threading
import pyaudio
import array
from typing import List, Optional, Tuple, Union
logging.basicConfig(filename='audiostream_logs.log', level=logging.INFO)
_MSG_PREFIX = b'PRE'
_MSG_SUFIX = b'SUF'
def _compose_message(message: byt... |
"""
Distributed under the terms of the BSD 3-Clause License.
The full license is in the file BSD_LICENSE, distributed with this software.
Author: <NAME> <<EMAIL>>
Copyright (C) European X-Ray Free-Electron Laser Facility GmbH.
All rights reserved.
Modified from https://github.com/European-XFEL/EXtra-foam, version 1.... |
#
# Copyright (C) 2019 <NAME>
# University of Siena - Artificial Intelligence Laboratory - SAILab
#
#
# USienaRL is licensed under a BSD 3-Clause.
#
# You should have received a copy of the license along with this
# work. If not, see <https://opensource.org/licenses/BSD-3-Clause>.
# Import packages
import os
import n... |
"""
This file contains various methods for learning the mixing weights, globally, per user etc.
It uses multi-processing to learn them, so the code can be lengthy at times.
The horsepower of this file is the method _learn_global_mixture_weights which implements the EM algorithm on the data.
Equation 4 from the paper Pr... |
#!/usr/bin/env python
u"""
jpl_ecco_v4_sync.py
Written by <NAME> (10/2021)
Syncs ECCO Version 4 model outputs from the NASA JPL ECCO Drive server:
https://ecco.jpl.nasa.gov/drive/files/Version4/Release4/interp_monthly/README
https://ecco-group.org/products-ECCO-V4r4.htm
https://ecco-group.org/user-guide-v4r4.htm
http... |
# -----------------------------------------------------------------------------
# WARNING: GAME WILL NOT WORK UNLESS LSL STREAM IS ACTIVE
# OpenBCI EEG Pong
# Language - Python
# Modules - pygame, sys, random, math, pyqtgraph
#
# Controls - Arrow Keys for Right Paddle and WASD Keys for Left Paddle
#
# Modified by <NAME... |
import cv2
import random
import winsound
import math
import mediapipe as mp
import numpy as np
cap = cv2.VideoCapture(0)
# cap.set(cv2.CAP_PROP_AUTO_EXPOSURE, 9)
# cap.set(cv2.CAP_PROP_EXPOSURE, -7.0)
mpHands = mp.solutions.hands
hands = mpHands.Hands()
mpDraw = mp.solutions.drawing_utils
dotX = 50
dot... |
from flask import Flask, render_template, url_for, request, redirect, \
session, jsonify, send_file, Blueprint, stream_with_context, Response
from models.models import *
from mongoengine.queryset.visitor import Q
from zipfile import ZipFile
from config import API_URI, API_URI_SR, URL
from controllers.similarity_che... |
import sys
import os
import traceback
import tempfile
import shutil
import shlex
import subprocess
from threading import Thread
import nibabel as nib
import wx
from wx.lib.pubsub import pub
class OptionError(RuntimeError):
pass
class Mkdir:
def __init__(self, dirname):
self.dirname = dirname
de... |
"""
Created on Sat Sep 18 23:11:22 2021
@author: datakind
"""
import logging
import os
import sys
import typing as T
from functools import reduce
from pathlib import Path
import pandas as pd
import requests
from matplotlib import collections
from matplotlib import pyplot as plt
from analysis.acs_correlation import c... |
#
# Copyright (c) 2020 Xilinx, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
import os
import sys
import yaml
import shlex
import shutil
import inspect
import argparse
import subprocess
import logging
from roast.utils import * # pylint: disable=unused-wildcard-import
from roast.component.basebuild import... |
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
import requests, time, json, re
import os, logging, tweepy
from typing import Tuple, List, Dict
from sqlalchemy import create_engine, Table, Column, Integer, String, MetaData, select, insert, update, func
from app.scraper import DB
import a... |
# Plot CAV1 transcript/ratio eQTL
try:
import configparser
except ImportError:
import ConfigParser as configparser
import sys
import timeit
from collections import defaultdict
#from interval import Interval, IntervalSet
import re
import pandas as pd
from sklearn.decomposition import PCA
import matplotlib
impo... |
from __future__ import print_function, division
import numpy as np
from scipy.interpolate import RegularGridInterpolator, interpn
import scipy.ndimage.interpolation as spinterp
import scipy.ndimage.filters as spfilter
from geometry import gencoords, gencoords_centermask
import pyximport; pyximport.install(setup_args... |
import torch
import torch.nn as nn
class DoubleConv(nn.Module):
"""(convolution => [BN] => ReLU) * 2"""
def __init__(self, in_channels, out_channels, mid_channels=None, activation_function=nn.ReLU):
super().__init__()
if not mid_channels:
mid_channels = out_channels
self.dou... |
import logging
from datetime import datetime
import pytz
import psutil
import os
import atexit
from io import StringIO
import boto3
from botocore.exceptions import ClientError
import base64
import json
import pickle
import pathlib
import pandas
# Allow for asyncio to be run from within Jupyter notebooks
# and other p... |
"""
Overview
--------
general info about this module
Classes and Inheritance Structure
----------------------------------------------
.. inheritance-diagram::
Summary
---------
.. autosummary::
list of the module you want
Module API
----------
"""
from __future__ import absolute_import, division, print... |
import General, Colors
import Structure
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import scipy
import scipy.stats
import os, sys, re, math
assert sys.version[0] == '3'
################################
#### read SHAPE
################################
def read_shape... |
#!/usr/bin/env python3
"""
stegosaurus.py
Encode hidden messages into image files.
"""
import argparse
import hashlib
import logging
import os
import zlib
from collections import Counter
from datetime import datetime
import coloredlogs
import numpy as np
from PIL import Image
from tqdm import tqdm
log = logging.ge... |
import cv2
import numpy
from cimbar.util.geometry import calculate_midpoints
def next_power_of_two_plus_one(x):
return 2**((x - 1).bit_length()) + 1
# should be thought of as a line, not an area
class Anchor:
__slots__ = 'x', 'xmax', 'y', 'ymax'
def __init__(self, x, y, xmax=None, ymax=None):
... |
import numpy as np
import argparse
import cv2
import subprocess
import time
import os
import pprint
import math
def show_image(img):
cv2.imshow("Image", img)
cv2.waitKey(0)
def draw_labels_and_boxes(img, boxes, confidences, classids, idxs, colors, labels):
# If there are any detections
if len(idxs) > ... |
"""
Trains an image segmentation model with SGD.
python joint_train.py --seperate_background_channel --data_dir joint_fewshot_shards_uint8_background_channel --augment --epochs 10 --steps_per_epoch 2 --batch_size 3 --val_batches 2 --sgd --l2 --final_layer_dropout_rate 0.2 --rsd 2 --restore_efficient_net_weights_from m... |
import re
import cv2
import time
from copy import deepcopy
from src.utils.utils import *
class Station:
def __init__(self):
self.station_index = 0
self.station_box = 0
self.station_node = 0
self.processing_count = 1000
self.is_free = 1
self.counter = 0
self.... |
#!/usr/bin/env python
# coding: utf-8
# ## GMLS-Nets: 1D Regression of Linear and Non-linear Operators $L[u]$.
#
# __<NAME>__, __<NAME>__ <br>
# http://atzberger.org/
#
# Examples showing how GMLS-Nets can be used to perform regression for some basic linear and non-linear differential operators in 1D.
#
# __Param... |
from __future__ import print_function
# -*- coding: utf-8 -*-
# %run py_eddy_tracker_property_classes.py
"""
===========================================================================
This file is part of py-eddy-tracker.
py-eddy-tracker is free software: you can redistribute it and/or modify
it under the te... |
#Import libraries and functions
from itertools import combinations
from math import sqrt
from copy import deepcopy
from numpy.linalg import solve, LinAlgError
from fractions import Fraction
#Define algebra toolbox
#Define method to solve system of two linear equations
#left = [row1, row2]
#right = [num... |
import os
import struct
import logging
_logger = logging.getLogger(__name__)
class UTFFile(object):
def __init__(self, utf_file=None):
self._file = os.path.abspath(utf_file) if utf_file else None
if utf_file and os.path.isfile(self._file):
self._load_file()
else:
... |
#!/usr/bin/env python
try:
from gpiozero import DigitalOutputDevice
from gpiozero import DigitalInputDevice, Button
RPI_OK = True
except:
RPI_OK = False
pass
import webapp
from signal import pause
EXPLODE_TIME = 18
EXPLODE_TRACK = 3
DIM1_INTRO = 50
DIM2_INTRO = 40
DIM1_TRAIN = 35
DIM2_TRAI... |
# coding=utf-8
'''
Created on 2018年3月21日
@author: heguofeng
'''
import unittest
from pp_file import Filer
import logging
import shutil
import os
import time
import struct
import threading
from _thread import start_new_thread
from pp_link import NAT_TYPE, PP_APPID, BroadCastId
from pp_control import PPNetApp, PPSt... |
import random
VERBOSE=False
OWN_NAMESPACE="http://jackjansen.nl/igor/owner" # Shoulnd't be here, really...
class CannotFix(Exception):
pass
class StructuralConsistency:
def __init__(self, igor, fix, namespaces, token, extended=False):
self.igor = igor
self.database = self.igor.database
... |
"""
Author: <NAME>
Creates an icosphere by repeated subdivision of an icosahedron.
I have naively built it from:
1 - defining vertex locations
2 - finding their neighbouring vertices from a nearest-neighbour search
3 - interpolating half way between vertices and their neighbours to identify the new vertic... |
#!/usr/bin/env python
from __future__ import print_function, division
import argparse
import os
if 'MPLBACKEND' not in os.environ: os.environ['MPLBACKEND'] = 'Qt4Agg'
import quod
import numpy as np
import sys
import subprocess
import re
import shlex
class Protein(object):
fasta = ''
entities = {}
def __init__(s... |
import pandas as pd
import numpy as np
import random
import string
import time
supply_center_country = {
'Eastern China': ['China'],
'Europe': ['France', 'Germany', 'Italy', 'Spain', 'Sweden', 'United Kingdom', 'Netherlands'],
'America': ['Canada', 'Mexico', 'United States'],
'Southern China': ['China'... |
from repo import Repo
import sys
import os
import types
sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from inflector import Inflector, English
inflector = Inflector(English)
def does_not_mutate(func):
"""Prevents methods from mutating the receiver"""
def wrapper(self, *args, ... |
import globus_sdk
import os
from pathlib import Path
import copy
from enum import Enum
import sys
import json
import datetime
from dataverse import xferjob
from typing import List, Dict
class GResultType(Enum):
SUCCESS = 1
REDIRECT = 2
NOT_LOGGED_IN = 3
ERROR = 4
NOT_COMPLETE = 5
class GResult:
... |
# encoding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: <NAME> (<EMAIL>)
#
import re
from mo_future import string_types, text, first... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
from scene import *
from random import randint, random, choice
from sound import play_effect
from colorsys import hsv_to_rgb
from math import sin
from functools import partial
from copy import copy
class Star (object):
def __init__(self):
self.x = randint(0, 768)
self.y = randint(0, 1024)
self.v = random() * 5 ... |
#!/usr/bin/env python
#################################################################
#
# qcVCF
# <NAME>
# Harvard Medical School
# <EMAIL>
#
#################################################################
#################################################################
#
# LIBRARIES
... |
#!/usr/bin/env python2
"""analyze.py: Reads and analyzes ecfs metadata db dump."""
__author__ = "<NAME>"
__status__ = "Production"
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot
from matplotlib import dates
import numpy as np
import sys
import os
import gzip
import time
import calendar
impo... |
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt,QMimeData
import datetime
import time
import pytz
from csv import reader,writer,DictReader,DictWriter
from utils import *
from Actions import *
from FilterMenu import *
from JAWSDialog import *
#The Preferences Dialog widget.
#The dialog is made up of individu... |
#!/usr/bin/env python
import time
from re import sub
from sys import exit
import cPickle as pickle
from condor import classad,htcondor
from Misc import PInfo,PDebug,PWarning,PError
from os import getenv,getuid,system,path,environ
# Module was partitioned to facilitate reading job configs
# on nodes that do not have h... |
# -*- coding: utf-8 -*
from pathlib import Path
import ujson as json
import numpy as np
from . import _deck
from . import _utils
_BONUS_CARDS = {_deck.Card(c) for c in ["Qh", "Kh"]}
class DefaultPlayer: # pylint: disable=too-many-instance-attributes
"""Player which selects one card randomly at each round.
... |
import numpy as np
import matplotlib.pyplot as pl
import seaborn as sb
from scipy.stats import norm
from seaborn.palettes import get_color_cycle
from numpy import asarray, zeros, linspace, diff, sqrt
from .core import *
def wavelength_to_rgb(wavelength, gamma=0.8):
'''This converts a given wavelength of light to... |
#
# Copyright (c) SAS Institute 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/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
# !pip install segmentation-models
import keras
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from PIL import Image
from segmentation_models import Unet
from segmentation_models.backbones import get_preprocessing
from keras.models import load_model
batch_s... |
#coding=utf-8
"""
Visualisations for the input-output function of neurons over time.
"""
import logging
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import cm, colors, pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from src.config import settings
from src.io_time_heatmap import f... |
import time,calendar,os,json,sys,datetime,csv,random
from math import log,sqrt
from requests import get
from subprocess import Popen,PIPE
def datetoday(x):
t=time.strptime(x+'UTC','%Y-%m-%d%Z')
return calendar.timegm(t)//86400
def daytodate(r):
t=time.gmtime(r*86400)
return time.strftime('%Y-%m-%d',t)
def ge... |
"""
Mostly copy-paste from DINO and timm library:
https://github.com/facebookresearch/dino
https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/vision_transformer.py
"""
import warnings
import math
import torch
import torch.nn as nn
import torch.utils.checkpoint as checkpoint
from timm.models.laye... |
import numpy as np
import pdb
from .base import StructuredModel
from ..inference import inference_dispatch, get_installed
from ..inference import saddle_point_sum_product as spsp
from .utils import loss_augment_unaries
import numpy as np
from .graph_crf import GraphCRF
import numpy as np
from .crf import CRF
fro... |
import sys
sys.path.append("../")
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import patches
import random
import os
import IPython.html.widgets as w
import cv2
import matplotlib.animation as animation
from mpl_toolkits.axes_grid1 import make_axes_locatable
from IPython.display import clear_outp... |
#!/usr/bin/env python3
# Copyright (c) 2008-10 Qtrac Ltd. All rights reserved.
# This program or module 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
# version 3 of the Li... |
try:
import cPickle as pickle
except:
import pickle
import os
import numpy as np
import pandas as pd
import copy
from scipy import spatial
from utils.utils_date import *
from tqdm import tqdm
def yes_or_no(question):
"""
Ask to the user a question. Possible answer y (yes) or n (no)
... |
# Imports packages
from gensim.models import KeyedVectors
import numpy as np
import os
import pickle as pk
import re
import sklearn as sk
from sklearn.preprocessing import LabelEncoder
import sys
import tensorflow as tf
# Declares paths
# Location where all data is stored
DATA_PATH = "/home/accts/gfs22/DiachronicP... |
from pyb import SPI, Pin
from pyb import delay, millis, elapsed_millis
class RadioException(Exception):
pass
class PacketWaitTimeout(RadioException):
pass
class SpiCommError(RadioException):
pass
class PacketOverrunError(RadioException):
pass
#class ShortPacket(RadioException):
# pass
#class Bad... |
import os
import shutil
import datetime
import random
from pathlib import Path
from midiutil import MIDIFile
class FileHandler(object):
"""
Note Notation:
List of lists of lists, each inner-most list in the form (Midi Note Number, Duration as 'beat').
The next inner-most lists are considered 'NoteUn... |
# version 21 --- <NAME>
# level 1
"""
Provide useful functions dealing with lists and strings.
If a function ends with "I", it returns an iterator, "D" for dictionary,
and "L" for list.
"""
import re
def toList(qvar):
""" Make qvar a list if not... |
# -*- coding: utf-8 -*-
# author: <NAME> (16 Jan 2019)
# <NAME>, <NAME>, <NAME>, "Scalable Learning with a
# Structural Recurrent Neural Network for Short-Term Traffic Prediction", \
# IEEE Sensors Journal, Aug 2019
# main script
import argparse
import os
import time
import torch
from torch.autograd ... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2020-2021 sistemicorp
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 limitatio... |
from unicodedata import category
import numpy as np
# import matplotlib.pyplot as plt
import os
# import sys
# import torch
import torchvision.transforms as transforms
import cv2
# sys.path.append(os.path.abspath("."))
# import pclpyd as pcl
import random
import os
import torch.optim as optim
# from visualizer.OpencvVi... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Klimaat
import os
import time
import numpy as np
import calendar
import shutil
import requests
from email.utils import parsedate_tz, mktime_tz
from urllib.parse import urlencode
from rnlyss.dataset import Dataset
from rnlyss.grid import Grid
from rnlyss.util import syslog_el... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 21 16:29:34 2020
@author: <NAME>
"""
#%%
from .platooning_energy import Car
import gym
from gym import spaces
import numpy as np
import matplotlib.pyplot as plt
#%%
class PlatoonEnv(gym.Env):
def __init__(self, sim_length_max = 200, difficulty = 1, rewards = ... |
import sys
sys.path.append('../')
import pytest
import spacexpython
from spacexpython.exceptions import *
from spacexpython.utils import *
from .tutils import *
import subprocess
from time import gmtime, strftime
from datetime import timedelta, datetime
# Conversion factors:
# Kilometers to Miles
# Astronomical Units ... |
import time
import pyautogui
import sys
from imagesearch import *
from datetime import datetime
import os
import random
import logging
import cv2
import numpy as np
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'.\hello tess\tesseract.exe'
#----- DEBUG METHODS --------
def quizSearch(image_directo... |
from typing import Any
import numpy as np
import numpy.linalg as la
import scipy, scipy.integrate
from PIL import Image as PILImage
import argparse
import os
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import scipy.interpolate
import json
from functools import reduce
from deepracing.path_uti... |
import re
import collections
import random
import os.path
from _config_parser import _return_configs
from _config_parser import _return_single_config
from _config_parser import ConfigError
file_directory = os.path.dirname(os.path.realpath(__file__))
### Templates for aggregation ####
TEMPlATE_AGGREGATION = """
{{cre... |
import _pickle as pickle
import argparse
import math
import os
import random
import sys
import time
from pprint import pprint
import matplotlib.pyplot as plt
import numpy as np
import torch
import yaml
from sklearn.metrics import accuracy_score as accuracy
from sklearn.metrics import f1_score as f1
from sklearn.metric... |
import os
import sys
import torch
import torchvision
import argparse
import torch.utils.data as Data
from PIL import Image
import models.networks as nets
import torchvision.utils as vutils
import os.path as osp
import numpy as np
import cv2
from modules.keypoint_detector_heatmap import KPDetector
from util import visu... |
from os import path
import shutil
import time
import datetime
import numpy as np
import pandas as pd
from sklearn.utils.class_weight import compute_class_weight
import torch
import torch.nn as nn
from torch.utils.data import TensorDataset, random_split, DataLoader, RandomSampler, SequentialSampler
import transformers
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
# | - Import Modules
import os
import re
import numpy as np
import pandas as pd
from pathlib import Path
import matplotlib.pyplot as plt
# __|
class PDOS_Plotting():
"""
"""
# | - PDOS_Plotting ***********************************
def __ini... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
---------------------------------------------... |
from __future__ import print_function
from __future__ import division
import os
import sys
import time
import datetime
import argparse
import os.path as osp
import numpy as np
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.utils.data import DataLoader
from torch.optim import lr_sch... |
import builtins
import importlib
import inspect
import io
import linecache
import os.path
import types
from pathlib import Path
from typing import Any, BinaryIO, Callable, Dict, List, Optional, Union
from weakref import WeakValueDictionary
import torch
from torch.serialization import _get_restore_location, _maybe_deco... |
'''
MFEM Example 18 - Serial/Parallel Shared Code
This is a python translation of ex18.hpp
note: following variabls are set from ex18 or ex18p
problem
num_equation
max_char_speed
specific_heat_ratio;
gas_constant;
'''
import numpy as np
from mfem import mfem_m... |
import os
import numpy as np
from sklearn.impute import SimpleImputer
from sklearn.metrics import f1_score
from sklearn.model_selection import cross_val_predict
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import confusion_matrix
from tpot.export_utils import generate_pipeline_code, expr_to_tre... |
import numpy as np
from scipy.optimize import minimize
import math
def isRotationMatrix(R: np.array):
tag = False
I = np.identity(R.shape[0])
if np.all(np.matmul(R, R.T) - I < 1e-6) and np.linalg.det(R) - 1 < 1e-6:
tag = True
return tag
class W300():
def W300_GetInitGuess(self, l_vec,... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
'''
R2R-style dataset
'''
import os
import json
import jsonlines
import numpy as np
import h5py
import math
import networkx as nx
def angle_feature(heading, elevation, angle_feat_size):
return np.array([math.sin(heading), math.cos(heading),
math.sin(elevation), math.cos(elevation)] * (angle_... |
"""Core definition of a VASP task document."""
import logging
import re
from collections import OrderedDict
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar, Union
import numpy as np
from monty.serialization import loadfn
from pydantic import BaseModel, Field
from pymatgen.an... |
import numpy as np
import tensorflow as tf
from numbers import Number
import gym
import time
from spinup.algos.sac1 import core
from spinup.algos.sac1.core import get_vars
from spinup.utils.logx import EpochLogger
class ReplayBuffer:
"""
A simple FIFO experience replay buffer for SAC agents.
"""
def ... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import itertools
import json
import logging
import os
from argparse import Namespace
import numpy as np
from fairseq import metrics, options,... |
from __future__ import unicode_literals
from django.test import TestCase
from django.db import connections
from django.test import tag
import time
from django_postgres_extensions.models.functions import ArrayAppend, ArrayCat
from .models import Traditional, NumberArray, NumberTraditional, Array
@tag('benchmark')
class... |
# -*- coding: utf-8 -*-
# This tool exports a Nipype interface in the Boutiques
# (https://github.com/boutiques) JSON format. Boutiques tools
# can be imported in CBRAIN (https://github.com/aces/cbrain)
# among other platforms.
#
# Limitations:
# * Optional outputs, i.e. outputs that not always produced, may not be
... |
from __future__ import absolute_import, division, print_function
from scitbx.array_family import flex
from libtbx import group_args
from libtbx.utils import user_plus_sys_time
from mmtbx.refinement.real_space import individual_sites, flipbase
import mmtbx
import iotbx
from libtbx.test_utils import approx_equal
from six... |
# geodata/join_goes_merra2.py
# Read GOES and MERRA-2 files, spatiotemporally join bands 3, 4, and 5 with TPQ. Write to hdf5 if requested.
import h5py as h5
from netCDF4 import Dataset
import numpy as np
import pystare as ps
import json
from sortedcontainers import SortedDict, SortedList
import geodata as gd
try:
... |
#! /usr/bin/env python3
"""
Sherlock: Find Usernames Across Social Networks Module
This module contains the main logic to search for usernames at social
networks.
"""
import csv
import os
import platform
import re
import sys
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from time import monotonic
... |
import requests
import os
import logging
import pylast as pyl
from typing import List, Tuple, Optional, Dict, Union, Set, Generator
from yaml import safe_load
from fuzzywuzzy.fuzz import UWRatio
from fuzzywuzzy.process import extractOne
from .configuration import config
from .state import GenreDataState
log = loggin... |
import math
from enum import Enum
import cv2
cv2.ocl.setUseOpenCL(False)
import numpy as np
THRESHOLD_FACTOR = 6
ROTATION_PATTERNS = [
[1, 2, 3,
4, 5, 6,
7, 8, 9],
[4, 1, 2,
7, 5, 3,
8, 9, 6],
[7, 4, 1,
8, 5, 2,
9, 6, 3],
[8, 7, 4,
9, 5, 1,
6, 3, 2],
[... |
'''
PRÁCTICA 3 Clasificación
<NAME>
'''
#############################
####### BIBLIOTECAS #######
#############################
# Biblioteca lectura de datos
# ==========================
import pandas as pd
# matemáticas
# ==========================
import numpy as np
# Modelos lineales a usar
# ============... |
"""
This file contains all image database (imdb) functionality,
such as loading and reading information from a dataset.
Generally, this file is meant to read in a dataset from disk into a
simple custom format for the detetive framework.
"""
# -----------------------------------------
# modules
# ---------------------... |
from prompt_toolkit.application.current import get_app
from prompt_toolkit.layout import DynamicContainer, HorizontalAlign, HSplit, ScrollablePane, VSplit
from prompt_toolkit.widgets.base import Button
from prompt_toolkit.widgets.toolbars import ValidationToolbar
from pepys_admin.maintenance.widgets.custom_text_area i... |
# Copyright 2010 <NAME>
# Copyright 2011 OpenStack Foundation
# Copyright 2012 Grid Dynamics
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a cop... |
from __future__ import print_function
import datetime
import calendar
import requests
import collections
import os
import json
import argparse
import logging
try:
# Python 3
import http.client as http_client
except ImportError:
# Python 2
import httplib as http_client
if os.environ.get("DEBUG", "0") !=... |
import os
import pprint
import pytest
import time
import logging
import tech_support_cmds as cmds
from random import randint
from tests.common.helpers.assertions import pytest_assert, pytest_require
from tests.common.plugins.loganalyzer.loganalyzer import LogAnalyzer, LogAnalyzerError
from tests.common.utilities impo... |
from pyflamegpu import *
import sys, random, math
"""
FLAME GPU 2 implementation of the Boids model, using spatial3D messaging.
This is based on the FLAME GPU 1 implementation, but with dynamic generation of agents.
Agents are also clamped to be within the environment bounds, rather than wrapped as in FLAME GPU... |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merg... |
"""
Author: Wudi
"""
import hashlib
import hmac
import sys
import time
import uuid
from copy import copy
from datetime import datetime, timedelta
from urllib.parse import urlencode
from typing import Dict
import pytz
import requests
from vnpy.api.rest import Request, RestClient, RequestStatus
from vnpy.api.websocket... |
# Copyright 2018 Orange
#
# 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 t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.