text stringlengths 3.07k 22.1k |
|---|
import numpy as np
from .utils import memo, validate_tuple
__all__ = ['binary_mask', 'r_squared_mask', 'cosmask', 'sinmask',
'theta_mask']
@memo
def binary_mask(radius, ndim):
"Elliptical mask in a rectangular array"
radius = validate_tuple(radius, ndim)
points = [np.arange(-rad, rad + 1) for ... |
# pulse_sequence.py
# <NAME>
# <EMAIL>
# Last Edited: Mon 28 Feb 2022 11:17:58 GMT
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import numpy as np
PULSE_WIDTH = 1
PULSE_HEIGHT = 0.3 # fraction of height of figure
TAU_WIDTH = 0.05
HORIZOTAL_PADS = (0.05, 0.01)
# --- horizontal dimensions... |
#!/usr/bin/python3
# test_numpy.py
# testing script for writing various numpy tensors to QG8 files using
# python -m pytest -rP tests/test_numpy.py
#
# Author : <NAME> <<EMAIL>>
# Date created : 18 July 2021
#
# Copyright 2021 University of Strasbourg
#
# Licensed under the Apache License, Version 2.0 (the "Lice... |
#!/usr/bin/env python3
""" Run the gear: set up for and call command-line code """
import json
import os
import subprocess as sp
import sys
import shutil
import psutil
import glob
import flywheel
from utils import args
from utils.bids.download_bids import *
from utils.bids.validate_bids import *
from utils.fly.custom... |
import torch
import numpy as np
import pandas as pd
import torch.nn as nn
from sklearn.neighbors import KernelDensity
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestRegressor
# Estimate the distribusion of P{A|Y}
def density_estimation(Y, A, Y_test=[]):
bandwidth = np.sq... |
"""
Imports meetings in 'caldendar/calendar.yaml' to the Kubeflow Community Calendar
For modifications please refer to the Google Calendar Python API:
https://developers.google.com/resources/api-libraries/documentation/calendar/v3/python/latest/calendar_v3.events.html#insert
Requires the following packages: oauth2clie... |
# External dependencies
from sanic.response import text, json
from sanic.log import logger
from sanic import response as sanic_response
import asyncio
import copy
import time
import subprocess
import socket
import time
from sanic_openapi import doc
import logging
logging.basicConfig(filename='logs.txt',level=logging.W... |
import os
import utils
import datetime
import pickle as pkl
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision
import transforms as T
from torch.optim import lr_scheduler
from torchvision import datasets, models, transforms
from engine import train_one_epoch, evaluate
from custom_datase... |
import shelve
import os
import re
from resource_api.interfaces import Resource as BaseResource, Link as BaseLink, AbstractUriPolicy
from resource_api.schema import StringField, DateTimeField, IntegerField
from resource_api.service import Service
from resource_api.errors import ValidationError
RE_SHA1 = re.compile("^... |
import time
import math
import datetime
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter, date2num
import numpy as np
import subprocess as sp
import time
import sys
import os
from itertools import groupby
from sklearn.neighbors import KernelDensity
from ... |
'''
Copyright 2022 Airbus SAS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... |
"""Task generation for split resmoke tasks."""
from typing import Any, Dict, List, NamedTuple, Optional, Set
import inject
import structlog
from shrub.v2 import FunctionCall, Task, TaskDependency
from buildscripts.ciconfig.evergreen import EvergreenProjectConfig
from buildscripts.resmokelib.multiversionconstants impo... |
# Copyright (c) 2013 OpenStack Foundation.
# Copyright 2015 Rackspace
#
# 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 ... |
"""
MOST OF THIS CODE IS NOT USED
ITS COPY/PASTED AND LEFT HERE FOR CONVENIENCE
"""
import os
import sys
# in case our module isn't installed (running from this folder)
thisPath=os.path.abspath('../../../')
print(thisPath)
if not thisPath in sys.path:
sys.path.append(thisPath)
import swhlab
import matplotlib.pyp... |
from __future__ import print_function
from rasahub import RasahubPlugin
from flask import Flask, render_template, session, request, redirect, url_for, abort, jsonify
from authlib.client import OAuth2Session
import json
import sys
is_py2 = sys.version[0] == '2'
if is_py2:
import thread as thread
else:
import ... |
import wx
from ogreyEntity import *
from FoldPanelBar import *
from ogreyScriptEditor import *
import ogre.renderer.OGRE as ogre
class ogreyLevelAttributesPanel(wx.Panel):
def __init__(self, parent, window, resourceInformation, middle):
wx.Panel.__init__(self, parent, -1, style = wx.FULL_REPAINT_ON_RESIZE... |
import math
import os
import random
import time
from pathlib import Path
import json
from mt import DATASETS_PATH, DATASET_EVAL_NAME, DATASET_SUMMARY_NAME
from mt import helpers, utils
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
def get_metrics(datapath, sr... |
def coding_problem_16(length):
"""
You run a sneaker website and want to record the last N order ids in a log. Implement a data structure to
accomplish this, with the following API:
record(order_id): adds the order_id to the log
get_last(i): gets the ith last element from the log. i is guar... |
import os
import time
import os.path
import logging
from piecrust.chefutil import format_timed
logger = logging.getLogger(__name__)
STATE_UNKNOWN = 0
STATE_DIRTY = 1
STATE_CLEAN = 2
FORCE_BUILD = object()
class ProcessingTreeError(Exception):
pass
class ProcessorNotFoundError(ProcessingTreeError):
pas... |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2020 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... |
from moduls import *
from oredictnames import *
from Inventorys import *
import Item
import crafting as cb
import config
from Inventorys import *
from Inventorys.Inventory import Slot, handler as invhandler, InventoryHandler
import EventHandler
import entity
class player:
def __init__(self, window):
... |
import itertools
import time
import regex
import sh
from nlstruct.core.cache import yaml_load, yaml_dump
from nlstruct.core.collections import set_deep_attr
from nlstruct.core.logging import TrainingLogger
from nlstruct.core.random import seed_all
from nlstruct.core.schedule import ConcatSchedule
from nlstruct.core.t... |
import datetime
import sys
import zipfile
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, get_object_or_404, get_list_or_404
from django.urls import reverse
from django.views.generic impor... |
# coding=utf-8
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLE 2
Game menu with 3 difficulty options.
License:
-------------------------------------------------------------------------------
The MIT License (MIT)
Copyright 2017-2019 <NAME>. @ppizarror
Permission is hereby granted, free of charge, to... |
'''
This software is the ground station GUI software that will
be used to view and analyze flight data while also be able
to configure the custom flight computer built by the
students of SEDS@IIT.
The goal is to make the software compatable with multiple
OS enviroments with minimal additional packages and easy
to use ... |
import torch.nn as nn
import math
import torch
from collections import namedtuple
from maskrcnn_benchmark.layers import FrozenBatchNorm2d
# s0 = top layer idx
# name = sub op name
# s1 = sub layer idx
GraphPath = namedtuple("GraphPath", ['s0', 'name', 's1']) #
def conv_bn(inp, oup, stride, norm_func):
return nn.S... |
import argparse
import deepspeed
import torch.nn as nn
import torch.nn.functional as F
import torch
import torchvision
dataset_dir = r"test_frames"
parser = argparse.ArgumentParser()
parser.add_argument('deepspeed_config')
args = parser.parse_args()
class Decoder(nn.Module):
def __init__(self, dim, depth=6, ... |
# -*-coding:utf-8-*-
from moviepy.editor import VideoFileClip, CompositeVideoClip
import os
import argparse
import sys
import time
from os.path import join, getsize
import logging
parser = argparse.ArgumentParser(description='Classify some images.')
# parser.add_argument('--mov', help='father path of mov', default="/m... |
# NewLst : creates a new lst. If already exists return a error.
# IsALst : checks if the input is an int. Return true or false.
# CToLst : converts a value to int. If can not, return a error.
# fin() : returns the key of a item in a list or a string.
# add() : adds a value in a list or string.
# del() : dels a ... |
from torch import nn as nn
from torch.nn import functional as F
from torch.nn.utils import spectral_norm
import torch
from torch import nn as nn
from torch.nn import functional as F
from torch.nn.utils import spectral_norm
from basicsr.utils.registry import ARCH_REGISTRY
import torch
class add_attn(nn.Module):
... |
"""
Runs a model on a single node across N-gpus.
"""
import os
from argparse import ArgumentParser
import pathlib
import numpy as np
import torch
import pytorch_lightning as pl
from lightning_models import LightningModel
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import EarlyStopping, Mode... |
import json
import os
from time import time, sleep
import stat
from subprocess import check_call, check_output, call, Popen, DEVNULL
import shutil
import traceback
import docker
class ProfileStrategy(object):
'''A strategy for profiling the performance of PE problems.'''
name = 'PROFILE'
extensions = {}
... |
from dcmn_seq2seq.utils import parse_mc, select_field
import logging
import os
import torch
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from tqdm import tqdm
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
datefmt='%m... |
"""
-*- coding: utf-8 -*-
Time : 2019/7/15 21:49
Author : Hansybx
"""
import re
from bs4 import BeautifulSoup
from flask import jsonify
from app.models import db
from app.models.class_schedule import ClassSchedule
from app.models.error import AuthFailed, PasswordFailed
from app.utils.common_utils import sql_to... |
"""A module that carry out the utility's used by the AI algorithms
"""
import pickle
from collections import deque
from typing import Deque
import numpy as np
import tensorflow.keras as tk
import tensorflow as tf
from sklearn.preprocessing import LabelEncoder
import ai.config as config
from model.action import Action... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This module implements the handler for sound mode of Denon AVR receivers.
:copyright: (c) 2021 by <NAME>.
:license: MIT, see LICENSE for more details.
"""
from copy import deepcopy
import logging
from collections import OrderedDict
from typing import Dict, Hashable,... |
import json
import requests
import sys, getopt
from fasp.loc import crdcDRSClient, bdcDRSClient, Gen3DRSClient, anvilDRSClient
from fasp.loc import kfDRSClient
from fasp.loc import sdlDRSClient, SRADRSClient
from fasp.loc import sbcgcDRSClient, cavaticaDRSClient, sbbdcDRSClient
from fasp.loc import DRSClient
from fasp... |
"""
This module provides the main entry point to any simulation task.
"""
from __future__ import annotations
__all__ = ['Organisation', 'Simulator']
import datetime as dt
import json
from pathlib import Path
from typing import List, Optional, Tuple, Deque
import dill as pickle
import pandas as pd
import tqdm
from ... |
import Globals
import main
import Conversions
class Empty:
""" Empty square - place holder object. Has colour and location.
It is possible that these are almost entirely redundant and that, with small change to a small number of
functions they could be entirely removed from the game.
"""
... |
from keras.models import *
from keras.callbacks import *
import keras.backend as K
from model import *
from data import *
import cv2
import argparse
import pydot, graphviz
from keras.utils import np_utils, plot_model
def visualize_class_activation_map(model_path, img_path, output_path, run_count, write_to_file, post_... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
"""
Fake data generator.
"""
import datetime
import os
from typing import Dict
import collections
import numpy as np
import pandas as pd
# Generic type definitions.
ndist_params = collections.namedtuple('ndist_params', ('mu', 'sigma', 'derives_from', 'decimals'))
#
# Generator settings
#
# Base paths.
BASE_DIR = ... |
"""eatiht v2 - <NAME> - Copyright 2014"""
from lxml.html import builder as E
from lxml.html import tostring as htmltostring
class TextNodeSubTree(object):
""" This class can be described in a few different ways. A proper
explanation requires a brief definition of terms.
There's two W3C-spec'd ... |
"""
File description.
Background management page for regular users and editors to view their articles, comments, favorites and other functions
encoding: utf-8
@author: <NAME>
@contact: <EMAIL>
@software: Pycharm
@time: 2022/1/12
@gituhb: sanxiadaba/pythonBlog
"""
import base64
import os
import time
import traceback
f... |
"""
Cloudless is a python library to provide a basic set of easy to use primitive operations that can
work with many different cloud providers.
These primitives are:
- Create a "Network" (also known as VPC, Network, Environment). e.g. "dev".
- Create a "Service" within that network. e.g. "apache-public".
- Easily c... |
"""Implementation of a subset of the NumPy API using SymPy primitives."""
from collections import Iterable as _Iterable
import sympy as _sym
import numpy as _np
from symnum.array import (
SymbolicArray as _SymbolicArray, is_sympy_array as _is_sympy_array,
unary_elementwise_func as _unary_elementwise_func,
... |
#
# Shared methods for tests
#
from __future__ import absolute_import, division
from __future__ import print_function, unicode_literals
import os
import pytest
import re
from lxml import etree
import check
# Regex to find the CellML 1.0 namespace
r1_0 = re.compile(re.escape('{' + check.CELLML_1_0_NS + '}'))
def l... |
import os
import re
from django.template.base import Template
from django.template.context import Context
from dbgate import DBA
from parser import PlSqlParser
import settings
"""
Oracle user_objects column identifiers
"""
PACKAGE_NAME = 0
"""
Ditionary with dependences between Oracle types and cx_Oracle types
"""
OR... |
""" This module will handle the text generation with beam search. """
import torch
import copy
import torch.nn.functional as F
from src.rtransformer.recursive_caption_dataset import RecursiveCaptionDataset as RCDataset
import logging
logger = logging.getLogger(__name__)
def mask_tokens_after_eos(input_ids, input_m... |
import numpy as np
import os,sys,time
import torch
import torch.nn.functional as torch_F
from easydict import EasyDict as edict
from . import base
import camera
import util
# ============================ main engine for training and evaluation ============================
class Model(base.Model):
def __init__(s... |
import glob
import numpy as np
import pandas as pd
from collections import OrderedDict
#from . import metrics
import metrics
from .csv_reader import csv_node
__all__ = ['tune_threshold',
'assemble_node',
'assemble_dev_threshold',
'metric_reading',
'Ensemble']
def tune_thres... |
from flask import Flask, request
from flask import render_template
import numpy as np
import pickle
import os
import matplotlib.pyplot as plt
app = Flask(__name__)
## function to check whether board is its terminal state
def check_winner(game):
winner = ''
checkfor = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6... |
import os
import sys
import spacy
import string
import json
import numpy as np
from Levenshtein import distance
from collections import defaultdict
from argparse import ArgumentParser
def lev_dist(source, target):
if source == target:
return 0
# Prepare a matrix
slen, tlen = len(source), len(targ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2022 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import pytest
import gc
import copy
import numpy as np
import pandas as pd
try:
import geopandas as gpd
import shapely.geo... |
import datetime
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.contrib.operators.aws_athena_operator import AWSAthenaOperator
import googleapiclient.discovery
from jinja2 import PackageLoader
from kite_airflow.plugins.google import GoogleSheetsRangeOperator
from kite... |
import torch.utils.data as data
import torch
import numpy as np
import os
from os import listdir
from os.path import join
from PIL import Image, ImageOps, ImageEnhance
import random
import re
import json
import math
import torch.nn.functional as F
def is_image_file(filename):
return any(filename.endswith(extension... |
#!/usr/bin/env python
"""detector.py: module is dedicated to all detector functions."""
__author__ = "<NAME>."
__copyright__ = "Copyright 2020, SuperDARN@VT"
__credits__ = []
__license__ = "MIT"
__version__ = "1.0."
__maintainer__ = "<NAME>."
__email__ = "<EMAIL>"
__status__ = "Research"
import os
import datetime as... |
import os
import torch
import shutil
import numpy as np
from torch import nn
import pytorch_lightning as pl
import torch.nn.functional as F
from torchvision import transforms
import torchvision.models as models
from collections import OrderedDict
from torch.utils.data import DataLoader
from torchvision.utils import sa... |
import functools
import random, logging, os
from biostar.accounts.tasks import create_messages
from biostar.emailer.tasks import send_email
from django.conf import settings
import time, random
from biostar.utils.decorators import task, timer
from biostar.forum.auth import db_logger
from django.db.models import Q
logg... |
#!/usr/bin/python3
import dearpygui.dearpygui as ui
import serial.tools.list_ports
import json
import threading
import time
from enum import Enum
from img102_UART import *
baudrate_list = ('500000', '1000000', '2000000', '4000000')
dithering_list = ('None', 'Floyd-Steinberg', 'Atkinson', 'Burkes', 'Sierra', 'Two-Row S... |
# setupPly.py ---
#
# Description:
# Author: <NAME>
# Date: 28 Jun 2019
# https://arxiv.org/abs/1904.01701
#
# Instituto Superior Técnico (IST)
# Code:
import open3d as o3d
import argparse
import os
from glob import glob
import pickle
from global_registration import preprocess_point_cloud, execute_global_registratio... |
# pip install pycocotools opencv-python opencv-contrib-python
# wget https://github.com/opencv/opencv_extra/raw/master/testdata/cv/ximgproc/model.yml.gz
import os
import copy
import time
import argparse
import contextlib
import multiprocessing
import numpy as np
import cv2
import cv2.ximgproc
import matplotlib.patc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Matlab to Python Code Converter
"""
import re
#print re.sub(r"\[((\S)\s*)+\]", "\[ \2 \]", txt)
function_template = \
"""
def {functioname}({arguments}):
{code}
return {outputs}
"""
def tralaste_general(text):
text= text.replace(';', '') # Remove s... |
r"""Distributedly evaluate language model checkpoints on multiple processes / nodes by data parallism.
This script is distributed data parallel version of :doc:`lmp.script.eval_dset_ppl </script/eval_dset_ppl>`. Other
than distributed evaluation setup CLI arguments, the rest arguments are the same as
:doc:`lmp.script... |
# MIT License
#
# Copyright (c) 2017-2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... |
import warnings
import time
import numpy as np
# Scipy
try:
import scipy.linalg as spa
except:
warnings.warn("You don't have scipy package installed. You may get error while using some feautures.")
#pycdd
try:
from cdd import Polyhedron,Matrix,RepType
except:
warnings.warn("You don't have CDD... |
import argparse
import configparser
import os
import sys
import ast
import logging
import numpy as np
from contextlib import suppress
from glob import glob
from collections import namedtuple
from mtsv.utils import(error, warn, specfile_read)
from mtsv.argutils import (read, export)
from mtsv import (DEFAULT_LOG_FNAME... |
# Copyright 2017-2019 <NAME>, <NAME>, <NAME>
# Copyright 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
kAFL Slave Implementation.
Request fuzz input from Master and process it through various fuzzing stages/mutations.
Each Slave is associated with a single Qemu instance for executing ... |
#!/usr/bin/env python3
# Copyright (c) 2019 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 appli... |
# _ __
# | |/ /___ ___ _ __ ___ _ _ ®
# | ' </ -_) -_) '_ \/ -_) '_|
# |_|\_\___\___| .__/\___|_|
# |_|
#
# <NAME>
# Copyright 2018 Keeper Security Inc.
# Contact: <EMAIL>
#
import argparse
import collections
import shlex
import logging
import json
import os
import re
import csv
import sys
import abc
... |
import logging
import json
import pprint
import os
import re
import glob
import pandas as pd
import rcs_csv_row_helper_functions as csv_helper
CACHED_SESSIONS_FILE_PATH = './database_jsons/cached_sessions.json'
DATABASE_BOOLEAN_PATH = './database_jsons/database_boolean.json'
PROJECT_SESSIONTYPES_PATH = './database_jso... |
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import time
import math
import random
import numpy as np
import scipy as sp
from scipy.spatial import distance as scipydistance
# from numba import jit, njit, vectorize, float64, int64
from sc2.position import Point2
import pytest
from hy... |
"""
Solves the incompressible Navier Stokes equations using "Stable Fluids" by <NAME>
in a closed box with a forcing that creates a bloom.
Momentum: ∂u/∂t + (u ⋅ ∇) u = − 1/ρ ∇p + ν ∇²u + f
Incompressibility: ∇ ⋅ u = 0
u: Velocity (2d vector)
p: Pressure
f: Forcing
ν: Kinematic Viscosity
ρ: Densit... |
import numpy as np
import torch
import gym
import argparse
import os
from collections import deque
import utils
import TD3
import OurDDPG
import DDPG
import TD3_ad
import robosuite as suite
from torch.utils.tensorboard import SummaryWriter
import time
import multiprocessing as mp
from functools import partial
def c... |
import datetime
import discord
from discord.ext import commands
import random
import time
import json
import sqlite3
#region globals (config, token and database)
# Config
config_file = open("config.json", "r").read()
config = json.loads(config_file)
token = config["token"]
bot = commands.Bot(command_prefix="/")
# ... |
import sys
from datetime import datetime
from io import BytesIO
import pytest
import requests_mock
from flask import current_app, request, url_for, json
from flask_login import current_user
from marshmallow import pprint
from benwaonline import mappers
from benwaonline import entities
from benwaonline.gallery import ... |
import numpy as np
from pmesh.pm import ParticleMesh
from nbodykit.lab import BigFileCatalog, BigFileMesh, FFTPower
from nbodykit.source.mesh.field import FieldMesh
from nbodykit.lab import SimulationBox2PCF, FFTCorr
import os
import sys
sys.path.append('./utils')
import tools, dohod #
from time import ti... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
"""Basic tests for the ``rs3`` module"""
import logging
import os
from tempfile import NamedTemporaryFile
import pytest
import discoursegraphs as dg
from discoursegraphs.corpora import pcc
from discoursegraphs.readwrite.rst.rs3 import RS3FileW... |
import tensorflow as tf
from tensorflow.keras.layers import Activation, SpatialDropout1D, Lambda, UpSampling2D, AveragePooling2D
from tensorflow.keras.layers import Conv1D, BatchNormalization, LayerNormalization
class ResidualBlock(tf.keras.layers.Layer):
""" Code taken from keras-tcn implementation on available... |
"""
MIT License
Copyright (c) 2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
#(c) 2016 by Authors
#This file is a part of ABruijn program.
#Released under the BSD license (see LICENSE file)
"""
Runs Minimap2 and parses its output
"""
import os
import re
import sys
from collections import namedtuple, defaultdict
import subprocess
import logging
import multiprocessing
import ctypes
import abru... |
""" Module containing classes that interfaces neural network policies
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
from aizynthfinder.chem import RetroReaction
from aizynthfinder.utils.models import load_model
from aizynthfinder.context.collection impo... |
import os
import matplotlib.pyplot as plt
import numpy as np
def load_data(fpath=''):
if len(fpath) == 0:
fpaths = ['data/BF_CTU.csv', 'data/BF_V.csv', 'data/BF_OU.csv']
else:
fpaths = fpath
honest_data = []
dishonest_data = []
for fpath in fpaths:
header = True
f... |
import pandas as pd
import numpy as np
import glob
import sys
import re
from astropy.cosmology import Planck15 as cosmo
import rate_functions as functions ### Mike's code
import astropy.units as u
import scipy
#---------------------------------------------------------------... |
#!/usr/bin/env python3
import numpy as np
import copy as cp
from tqdm import tqdm
import lib.metrics as metrics
import sklearn.model_selection as sk_modsel
import sklearn.metrics as sk_metrics
import sklearn.utils as sk_utils
def sk_learn_k_fold_cv(x, y, z, kf_reg, design_matrix, k_splits=4,
... |
from restit.exception.http_error import HttpError
class BadRequest(HttpError):
STATUS_CODE = 400
TITLE = "Bad Request"
DEFAULT_DESCRIPTION = \
"This response means that server could not understand the request due to invalid syntax."
DEFAULT_RFC7807_TYPE = "https://developer.mozilla.org/de/docs... |
import impedance as imp
import math
from sympy.physics import units as u
from sympy import sqrt, re, im, I
from constants import constants as c
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import matplotlib as mpl
from helper_functions import indep_array
rc('text', usetex=True)
mpl.rcPar... |
import numpy as np
import torchvision.transforms as T
from labels import *
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import random
def preprocess(images):
images = [img.convert('RGB').resize([400, 600]) for img in images]
return images
def get_transform(normalize = False)... |
""" This module defines the chi-squared and related functions
Module author: <NAME>
Year: 2020
Email: <EMAIL>
"""
import numpy as np
import model
def chi2_no_soliton(c, Rs, ups_disk, ups_bulg, gal, DM_profile="NFW"):
"""chi2 for an NFW fit (c, Rs; ups_disk, ups_bulg). Runs over a single galaxy
:param c: co... |
from Foundation import *
from AppKit import *
from PyObjCTools import AppHelper
from collections import deque
import contextlib
from enum import Enum
import os
from pathlib import Path
import shutil
import subprocess
import sys
from . import ezntfs
from . import __version__
def create_icon(symbol, description, fall... |
# The MIT License
# Copyright (c) 2018 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... |
# -*- coding: utf-8 -*-
# Owlready
# Copyright (C) 2013-2019 <NAME>
# LIMICS (Laboratoire d'informatique médicale et d'ingénierie des connaissances en santé), UMR_S 1142
# University Paris 13, Sorbonne paris-Cité, Bobigny, France
# This program is free software: you can redistribute it and/or modify
# it under the ter... |
'''stride'''
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 time
from roglick.lib import libtcod
from roglick.dungeon.utils import PerlinNoise2D, smootherstep, smoothstep, lerp
from roglick.utils import clamp
from roglick.engine import random,colors
width=180
height=100
font='data/fonts/arial10x10.png'
libtcod.console_set_custom_font(font.encode('UTF-8'), libtcod.FON... |
try:
from http.server import SimpleHTTPRequestHandler
import socketserver
except:
from SimpleHTTPServer import SimpleHTTPRequestHandler
import SocketServer as socketserver
import matplotlib as mpl
mpl.use('agg')
from PIL import Image
import sys, os, inspect
current_dir = os.path.dirname(inspect.getfile(inspect.cur... |
"""
This module provides helpers that describe some aspect of a layout.
The two public classes are:
* BasisBladeOrder
* BasisVectorIds
"""
from typing import TypeVar, Generic, Sequence, Tuple, List, Optional
import numpy as np
import functools
import operator
from . import _numba_utils
from ._bit_helpers import co... |
# -*- coding: utf-8 -*-
# Time : 2021/7/30 4:01
# Author : QIN2DIM
# Github : https://github.com/QIN2DIM
# Description: Adaptive acquisition framework
import csv
import json
import os
import time
from datetime import datetime
from selenium.common.exceptions import (
ElementClickInterceptedException,
... |
"""URBAN-SED Dataset Loader
.. admonition:: Dataset Info
:class: dropdown
URBAN-SED
=========
URBAN-SED (c) by <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>.
URBAN-SED is licensed under a Creative Commons Attribution 4.0 International License (CC BY 4.0).
You should have received a copy of the l... |
import os
import sys
import numpy as np
def get_malware_dataset(valid=False):
def get_monthly_data(file_path, num_feature=483):
'''Each row of `x_mat` is a datapoint.
It adds a constant one for another dimension at the end for the bias term.
Returns:
two numpy arrays, one... |
import math
import os
import torch
import numpy as np
## Code taken from https://github.com/hassony2/kinetics_i3d_pytorch/blob/master/src/i3dpt.py
def get_padding_shape(filter_shape, stride, mod=0):
"""Fetch a tuple describing the input padding shape.
NOTES: To replicate "TF SAME" style padding, the padding ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.