text stringlengths 3.07k 22.1k |
|---|
# -*- coding: utf-8 -*-
"""
The project implements Reinforcement Learning
(specifically, Finite Action-set Learning Automata)
to tune the PID controller gains of a simulated Quadcopter
+ multi-vehicle
+ obstacle avoidance using potential fields
+ plus an improvement on potential fields using shifting planar inequalit... |
from __future__ import annotations
from abc import ABC, abstractmethod
from async_ga.chromosome import Chromosome, Population
from async_ga.crosser import Crosser, SinglePointCrosser
from async_ga.filter import Filter, EliteFilter
from async_ga.fitness.function import FitnessFunction
from async_ga.fitness.maturity impo... |
import io
import logging
import os
import re
import shutil
import subprocess
import sys
import time
import zipfile
from urllib.request import urlopen
import click
logging.basicConfig(
format="%(levelname)-7s %(asctime)s: %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
level=logging.DEBUG,
)
__version__ = "0.0... |
from layers.input import Input
from layers.output import Output
from layers.dense import Dense
from layers.conv2d import Conv2d
from layers.max_pool2d import MaxPool2d
from layers.flatten import Flatten
from losses import l2_loss, softmax_cross_entropy
from session import Session
from activations import relu, sigmoid, ... |
import json, cgi, os, sys, requests, hashlib, time, tempfile, time, timeit
from pymongo import *
from urllib import *
import urllib
from datetime import datetime, timedelta
from libs.contents.contents import *
from core.core import *
# from core.lang import *
# avpath = ''
avpath = '/home/user/workspace/2/avconv/... |
# Assembly Image Encoder FredHappyface
"""
Encodes a custom set of assembly style instructions into an image. Syntax has
been inspired by the Little Man Computer (LMC) created by <NAME> in
1965. An online model of this can be found at https://peterhigginson.co.uk/LMC/
and the idea of executing a program from and i... |
import math
import threading
import time
import mido
import numpy as np
from modules.midiplayer import instruments_map, drum_set, mcsparser
from static import ref_strings
from modules.__init__ import Command, FileIOModule
from utils import downloader, message_utils
palette = 'ca1edb62574398ff'
insts = [
'note.h... |
# coding=utf-8
import argparse
import gc
import os.path
import signal
import sys
import time
from threading import Thread
import torch
from torch.utils.data import DataLoader
from src.adversarial import AdversarialAE, AdversarialAEUni
from src.bombarelli import BombarelliAE
from src.datareader import SMILESReader, On... |
# ------------------------------------------------------------------------------
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
# -----------------------------------------
import cfnresponse
import boto3
import os
import sys
import json
from urllib.request import ... |
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import torch
import torch.nn as nn
import numpy as np
import cv2
import os
import json
# from decord import VideoReader
# from decord import cpu, gpu
import glob
from icecream import ic
# Ignore warnings
import warnings
warning... |
import sympy
from qibo import gates, K
from qibo.config import raise_error
class HamiltonianTerm:
"""Term of a :class:`qibo.core.hamiltonians.SymbolicHamiltonian`.
Symbolic Hamiltonians are represented by a list of
:class:`qibo.core.terms.HamiltonianTerm` objects storred in the
``SymbolicHamiltonian.... |
from __future__ import print_function
import reportlab.pdfgen.canvas as canvas
from reportlab.lib.pagesizes import LETTER, A4
from reportlab.lib.units import cm
from reportlab.lib.utils import ImageReader
import numpy as np
from numpy.linalg import norm
import PIL
import math
class ChitBoxGenerator:
def __init... |
import logging
import os, atexit, shutil
from collections import defaultdict
import numpy as np
import tensorflow as tf
from utility.utils import isscalar
from utility.display import pwc
from utility.graph import image_summary, video_summary
from utility import yaml_op
logger = logging.getLogger(__name__)
""" Loggi... |
#!/usr/bin/env python3
import atddm
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pytz
# from datetime import time
from constants import COLORS, TZONES, CODES, BEGDT, ENDDT
import rpy2.robjects as robjects
from rpy2.robjects.packages import importr
from rpy2.robje... |
# Copyright 2022 The Balsa Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import urllib.request
import zipfile
import six.moves.cPickle as pickle
import numpy as np
import logging
import cv2
from PIL import Image
import matplotlib.pyplot as plt
import tensorflow as tf
# ====================
# Helper functions
# ==========... |
from torch.utils.data import Dataset
import torch
import pickle
import os
import numpy as np
class TSP(object):
NAME = 'tsp' # Travelling Salesman Problem
def __init__(self, p_size, init_val_met = 'greedy', with_assert = False, step_method = '2_opt', P = 10, DUMMY_RATE = 0):
self.size =... |
###############################################################################
# CUSTOM MODULE FOR GEC
###############################################################################
#!/usr/bin/env python3 -u
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under th... |
from termcolor import colored
import time
from src.feed_dicts import *
import sys
def export_predictions(sess, model, FLAGS, positive_test_batcher, negative_test_batcher,
string_int_maps, out_file, threshold_map=None):
'''
export hard decisions based on thresholds
'''
print('Eval... |
# Copyright 2014 MongoDB, 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 writing, so... |
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
from types import MethodType, FunctionType
import os
import io
import sys
from codecs import open
from itertools import count
from typing import List, Union, Optional
from six import PY2, string_types, StringIO
if PY2:
FileNotFoundErro... |
import logging
import os
import time
import json
import requests
import azure.functions as func
from typing import Optional
from pydantic import BaseModel, ValidationError
from telegram import Bot
logging.basicConfig(level=logging.INFO)
TESLA_API_BASE = "https://owner-api.teslamotors.com/api/1/vehicles"... |
import numpy as np
import sklearn.datasets as skdata
import sklearn.metrics as skmetrics
from sklearn.linear_model import LinearRegression
'''
Name: kanagaraj, kanimozhi
Summary:
I considered alpha as 0.5 and 1.0 and steps as 100 and 100
Results on diabetes dataset using scikit-learn Linear Regression mod... |
from lightweaver.fal import Falc82
from lightweaver.rh_atoms import H_6_atom, H_6_CRD_atom, H_3_atom, C_atom, O_atom, OI_ord_atom, Si_atom, Al_atom, CaII_atom, Fe_atom, FeI_atom, He_9_atom, He_atom, He_large_atom, MgII_atom, N_atom, Na_atom, S_atom
import lightweaver as lw
import numpy as np
import scipy.interpolate as... |
import cv2
import numpy as np
import random
import random
key_point_number1 = 7
def _rand_crop(image, boxes, labels, landm, img_dim,rand_ratio=0.1):
height, width, _ = image.shape
rand_h=int(height*rand_ratio)
rand_w=int(width*rand_ratio)
for i in range(boxes.shape[1]):
if i % 2 == 0:
... |
# -*- coding: utf-8 -*-
import sys
import requests
class View(object):
def __init__(self, type=None, url=None):
self.type,self.url=type,url
def read(self, map_array):
try: self.type = map_array.get('type',None); self.url = map_array.get('url', None)
except: self.type,self.url=type,url
... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
"""
FPU instructions.
"""
import logging
import operator
from .. import utils
from ..cpu_context import ProcessorContext
from ..instruction import Instruction
from .opcodes import opcode
logger = logging.getLogger(__name__)
# TODO: Handle stack fault exceptions.
# TODO: Handle overflow and division by zero except... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 26 16:21:29 2017
@author: <NAME>
Python 3
Run the pre-built classifier on two csv files
(Lancashire_geotag_tweets.csv and Lancashire_towns_tweets.csv)
"""
import pandas as pd
import re
import string
import pickle
import numpy as np
import nltk
nltk... |
# Hysteresis model
# http://eprints.lancs.ac.uk/1375/1/MFI_10c.pdf
# Identification of Hysteresis Functions Using a Multiple Model Approach
# Mihaylova, Lampaert et al
import numpy as npy
from scipy.optimize import root
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import copy
#%%
plt.close(... |
import pprint
import svn.remote
import svn.exception
import platform
import struct
import os
import curses
import time
import sys
import signal
import argparse
import tempfile
from subprocess import call
import logging
parser = argparse.ArgumentParser()
parser.add_argument('-url', dest = 'svn_url', help = 'input svn r... |
# -------- BEGIN LICENSE BLOCK --------
# Copyright 2022 FZI Forschungszentrum Informatik
#
# 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
# n... |
import pickle
import numpy as np
from get_attribution import generate_testcases, get_top_sentence
import os, sys
import codecs
def backup_data_dir(data_dir):
dir_name = data_dir[data_dir.rfind('/') + 1:]
tmp_dir = 'tmp' + dir_name[0].upper() + dir_name[1:]
import shutil, os
if not os.path.exists(tmp_d... |
import logging
import os
import re
from enum import Enum, auto
from tinydb import where
from updot import _db, exceptions
# TODO: at end of program...
# 1. find all unused but managed links and warn (atexit)
# - ask user per link if should delete from hdd too (could imply a ln we don't want any more from a previo... |
"""
FiftyOne config.
| Copyright 2017-2021, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import logging
import os
try:
from importlib import metadata as importlib_metadata # Python 3.8
except ImportError:
import importlib_metadata # Python < 3.8
import eta
import eta.core.config as etac
imp... |
# Copyright 2021 <NAME> (KRR-Oxford). 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 applicable la... |
import cv2 as cv
import mediapipe as mp
import numpy as np
import time
import matplotlib.pyplot as plt
import seaborn as sns
import mapping
import csv
import imageio
class poseDetector():
# def __init__(self, mode=False, upBody = False, smooth = True, detectionCon = 0.5, trackCon = 0.5):
def __init... |
# file_content = """
# # # # import datetime
# # # #
# # # #
# # # # if __name__ == '__main__':
# # # # name = input("Enter your name: ")
# # # # age = int(input("Enter your age: "))
# # # # birth = datetime.datetime.utcnow().year - age
# # # # print("{}; you were born in {}".format(name, birth))
# # # ... |
# ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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/LICENS... |
# -*- coding: utf-8 -*-
"""Main script.
SPDX-FileCopyrightText: 2016-2021 <NAME> <<EMAIL>>
SPDX-License-Identifier: MIT
"""
__copyright__ = "<NAME> <<EMAIL>>"
__license__ = "MIT"
import logging
import multiprocessing
import os
import traceback
from collections import namedtuple
from datetime import datetime
impor... |
# coding:utf-8
"""
Time: 2021/9/7 16:37
Author: eightyninth
File: dataset_load.py
"""
import sys
sys.path.append("../..")
import csv
import os
import imghdr
import cv2
import json
import torch
import networkx as nx
from PIL import Image
import numpy as np
from torch.utils.data import Dataset, DataLoader
from torchvis... |
# -*- coding: utf-8 -*-
"""
Olaf
~~~~~~~~~
Commandline utility for creating post/page
:copyright: (c) 2015 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from datetime import datetime
import click
from olaf import contents_dir, posts_dir, pages_dir, get_current_dir, \
conten... |
import os
import traceback
from typing import Tuple, Callable, NamedTuple, List, Optional
import defopt
import numpy as np
import tensorflow as tf
from framework.common import parameters
from framework.dataset import io
from framework.trackers.aggregator import Aggregation, Statistic
from framework.trackers.metrics i... |
import deepspeed
import torch
from apex.optimizers import FusedAdam as Adam
from torch import distributed as dist
import mpu
from fp16 import FP16_Module, FP16_Optimizer
from learning_rates import AnnealingLR
from model import GLMModel, glm_get_params_for_weight_decay_optimization
from model import GLMForMultiTokenClo... |
import pygame
import numpy as np
import math
class World:
def __init__(self,width=700,height=500,name="My Game"):
pygame.init()
self.pygame_window = pygame.display.set_mode((width,height))
pygame.display.set_caption(name)
self.views = {"blank":pygame.Surface((self.pygame_wi... |
import sys
import numpy as np
import pandas as pd
import pmdarima as pm
from timeseries.transform.transformer import Transformer
class IHSTransformer(Transformer):
def __init__(self, ts, interval=None, d="auto", lmb="auto",
difference_first=True,
save_loglikelihood_deriv=False,... |
import ctypes
import numbers
import warnings
from io import BytesIO
from typing import List, Optional, Sequence, Tuple
import cv2
import numpy as np
import ocrodeg
import scipy.ndimage as ndi
import torch
import torchvision.transforms.functional as F
from matplotlib import pyplot as plt
from PIL import Image as PILIma... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 29 22:11:47 2020
@author: my-python
http://pyode.sourceforge.net/tutorials/tutorial3.html
http://www.codebind.com/linux-tutorials/install-opengl-ubuntu-linux/
"""
# pyODE example 3: Collision detection
# Originally by <NAME>.
# Updated by <NAME>... |
# -*- coding: utf-8 -*-
"""
Support function for net handling
"""
import time
import numpy as np
import scipy.sparse as sp
############## return cor list (raw) with integer values ( = float * 1000)
def return_net_list(Z_cor_mat):
t2 = time.time()
print(Z_cor_mat.shape)
x_sig,y_sig = np.wh... |
#
# MansOS web server - server-side session
#
from __future__ import print_function
import datetime, random, md5
alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.,!?() '_-=+*/@$:%^#;~{}[]|`"
#nevar but simbols:"&<>"
lalphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@... |
from collections import OrderedDict, namedtuple, defaultdict
from itertools import product
from operator import attrgetter
from cached_property import cached_property
from frozendict import frozendict
from devito.data import LEFT, CENTER, RIGHT
from devito.ir.support import Scope
from devito.tools import Tag, as_mapp... |
import re
import warnings
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from seleniumbase.config import settings
from seleniumbase.config import proxy_list
from seleniumbase.core import download_hel... |
from .. import vk
from .utils import check_ctypes_members, array, array_pointer, sequence_to_array
from .images import image_subresource_range
from ctypes import byref, pointer, c_uint32, c_int32
def command_pool_create_info(**kwargs):
check_ctypes_members(vk.CommandPoolCreateInfo, ('queue_family_index',)... |
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import datetime
import httplib
import mock
impo... |
def psi0_psi1(lhi, rh_rt, zft):
zfh = rh_rt * zft
if lhi in psi0.index.values: # use calculated data.
# psi0
psi0i = psi0.loc[lhi] * rh_rt
psi0i_use = interp_psi(psi0i, zfh, kind='quadratic')
# psi1
psi1i = psi1.loc[lhi] * rh_rt ** 3
psi1i_use = interp_psi(psi1i,... |
"""*Returns weather forecast for a location.*
This module can search weather reports using Wunderground API.
Weather reports consist of a current weather in observation location,
a 3 day weather forecast and distance from observation location to
the requested location. Module also features an interactive mode where us... |
import copy
import os
from train_detectron2_deeplabv3plus import update_path, deeplabutils
from ikomia import core, dataprocess
from ikomia.dnn import datasetio, dnntrain
from ikomia.core.task import TaskParam
from detectron2.config import get_cfg, CfgNode
from detectron2.projects.deeplab import add_deeplab_config
from... |
#!/bin/env/python
import itertools
import copy
from collections import defaultdict
from sklearn.pipeline import Pipeline
from sklearn.grid_search import GridSearchCV, ParameterGrid
from sklearn.cross_validation import StratifiedKFold
from sklearn.base import BaseEstimator, TransformerMixin, clone
from pandas import D... |
#!/usr/bin/env py50n
""" $lic$
Copyright (C) 2019-2020 by The Board of Trustees of Stanford University
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it will... |
import torch
import pandas as pd
import itertools
from time import time,time_ns
import matplotlib.pyplot as plt
PARAMS = {
"nll": 1, # number of linear layers composing the affine members
"ncl": 3, # number of affince compling layers, must be larger then 3!
"dim": [48,60,72,84,96], # dimension of system, f... |
# container-service-extension
# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
"""Utilities to manage CSE metadata on Ovdcs."""
from collections import namedtuple
import pyvcloud.vcd.client as vcd_client
import pyvcloud.vcd.utils as pyvcd_utils
from pyvcloud.vcd.vdc impo... |
import math
import numpy as np
from glycopeptidepy.structure.fragment import IonSeries
from .base import ModelTreeNode
from .precursor_mass_accuracy import MassAccuracyMixin
from .simple_score import SignatureAwareCoverageScorer
class LogIntensityScorer(SignatureAwareCoverageScorer, MassAccuracyMixin):
_peptid... |
#!/usr/bin/env python
# coding=utf-8
"""
profile base class.
generates a test profile.
history:
see git commits
todo:
~ all fine :-)
"""
# import sys
import time
import ansi_escape_code as terminal
import load_modules
##########################################
# modul handling
def ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 18 11:55:58 2021
@author: rringuet
Instead of writing individual wrappers for each model, this file is used to
do anything model-specific, such as importing the right readers.
Help on coordinate systems:
The resource information on SpacePy's coordinate c... |
import subprocess
import sys
import json
import yaml
import os
"""
Example: GET
python -m gnmi get -target_addr 10.11.97.10:8080 -alsologtostderr -insecure -xpath "/openconfig-interfaces:interfaces/interface[name=Ethernet0]/config/" -username admin -password <PASSWORD> -display
python -m gnmi get -va... |
from Gates import *
from Adder import *
WRITE = 1
READ = 0
HIGH = 1
LOW = 0
ACC_index = 0
PC_index = 1
IR_index = 2
UNKNOWN = -1
REG_NUM = 3
REG_BIT_SIZE = 16
reg_volt_outputs = [[0 for col in range(REG_BIT_SIZE)] for row in range(REG_NUM)]
reg_acc_data = 0
reg_ir_data = 0
reg_pc_data = 0
def d_flip_flop(da... |
# Python
from http.client import TEMPORARY_REDIRECT, BAD_REQUEST, FORBIDDEN
# 3rd party
from bread.bread import Bread, EditView, AddView, DeleteView, ReadView
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import r... |
# Copyright (c) 2015-2016 OpenStack Foundation
#
# 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 agree... |
#needed by visual studio
#import django.test.utils
#django.setup()
#django.test.utils.setup_test_environment()
#django.test.utils.setup_databases()
from django.conf import settings
from django.test.utils import get_runner
# import unittest
# from unittest import TestCase
# if __name__ == "__main__":
# os.environ... |
'''
Copyright(C) 2016 Engineering Department, University of Cambridge, UK.
License
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
Unles... |
from elasticsearch import Elasticsearch
from elasticsearch_dsl import *
import pandas as pd
from string import Template
from flatten_json import flatten
import json
import re
def connect_es(cid, creds):
try:
es = Elasticsearch(cloud_id=cid,http_auth=(creds))
except :
print ("Could... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
### Require Anaconda3
### ============================
### 3D FSC Software Wrapper
### Written by <NAME>
### Edited by <NAME> and <NAME>
### Anaconda environment by <NAME>
### Downloaded from https://github.com/nysbc/Anisotropy
### git clone -b carl_dev_v2.3 https://github... |
# -*- coding: utf-8 -*-
# (c) Copyright IBM Corp. 2010, 2018. All Rights Reserved.
# pragma pylint: disable=unused-argument, no-self-use
"""
Function utilities_excel_query receives attachment information and two additional fields -
list of excel style ranges and comma separated list of names for defined ranges.... |
import numpy as np
import xarray as xr
import sys
from netCDF4 import date2num, num2date
import pandas as pd
import time
"""
AUTHOR <NAME>
This file containts functions for processing data for working with FLEXDUST and FLEXPART model output
"""
def process_per_pointspec(dset,flexdust_ds, x0,x1,y0,y1, height=None):... |
import sys
import collections
import synapse.cores.xact as s_xact
import synapse.cores.common as s_cores_common
import synapse.cores.storage as s_cores_storage
def initRamCortex(link, conf=None, storconf=None):
'''
Initialize a RAM based Cortex from a link tufo.
The path element of the link tufo, if pres... |
# encoding: utf-8
__author__ = '<NAME> <<EMAIL>>'
__date__ = '06/2012'
"""Module to convert frame representation as output by kinect recording
to angle and/or angle velocity histogram representations.
"""
import numpy as np
from scipy.cluster.vq import kmeans, whiten
from ..lib.transformations import (quaternion... |
#!/usr/bin/env python3
import math
import cv2
import shm
from mission.constants.config import wire as constants
from vision.modules.base import ModuleBase
from vision import options
options = [
options.IntOption('adaptive_thresh_block_size', constants.block_size, 1, 2500),
options.IntOption('adaptive... |
# -*- coding: utf-8 -*-
"""
sphinx.util.smartypants
~~~~~~~~~~~~~~~~~~~~~~~
This code is copied from docutils’ docutils/utils/smartquotes.py
version 1.7.1 (from 2017-03-19). It should be removed in the future.
:copyright: © 2010 <NAME>,
original `SmartyPants`_: © 2003 <NAME>
... |
# ##### 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... |
"""gdsfactory loads a configuration from 3 files, high priority overwrites low priority:
1. A config.yml found in the current working directory (highest priority)
2. ~/.gdsfactory/config.yml specific for the machine
3. the yamlpath_default in gdsfactory.tech.yml (lowest priority)
`CONFIG` has all your computer specif... |
import time
import json
import pytest
from django.conf import settings
from elasticsearch import Elasticsearch
from hoover.search import models, signals
from .fixtures import listen
from django.contrib.auth import get_user_model
import responses
pytestmark = pytest.mark.django_db
es = Elasticsearch(settings.HOOVER_E... |
import torch.nn as nn
import torch.nn.functional as F
import torch
from torch.autograd import Variable
from config import config as cfg
# conv2d + bn + relu
class Conv2d(nn.Module):
def __init__(self,in_channels,out_channels,k,s,p, activation=True, batch_norm=True):
super(Conv2d, self).__init__()
... |
from tkinter import *
import tkinter as tk
import time
import os.path
import sys
import random
class GraphException(Exception):
def __init__(self, string):
Exception.__init__(self, string)
class Graph(Canvas):
def __init__(self, master, **options):
Canvas.__init__(self, master, **option... |
# coding=utf-8
# Copyright 2019 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
"""
# Mobius Software LTD
# Copyright 2015-2018, Mobius Software LTD
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later ve... |
import websocket
import socket
try:
import thread
except ImportError:
import _thread as thread
import time
import json
import serial
import serial.tools.list_ports
import _thread
import logging
import time
import datetime
import serial
import serial.tools.list_ports
class MicroControllerConnection:
"""... |
#!/usr/bin/python
import numpy as np
import os
from functools import partial
import json
import argparse
from sklearn.model_selection import train_test_split
try:
import bnnbench
except:
import sys
sys.path.append(os.path.expandvars('$BNNBENCHPATH'))
import bnnbench.utils.data_utils
from bnnbench.models ... |
"""
The file is under no license. See LICENSE.txt for more details.
"""
import unittest, shutil, sys
from pathlib import Path
from maildir2mbox import convert
class TestMaildir2Mbox(unittest.TestCase):
def setUp(self):
self.mbox_path = Path('test_data/mbox_toto')
self.mbox_dir ... |
import random
import time
from typing import List, Optional, Dict
import fim
import pandas as pd
from pyarc.data_structures.antecedent import Antecedent
from pyarc.data_structures.consequent import Consequent
from pyarc.data_structures.item import Item
from pyarc.data_structures.car import ClassAssocationRule
from p... |
import argparse
import math
import random
from reportlab.lib.colors import black, white, Color, yellow
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.units import inch, cm
from reportlab.pdfbase.ttfonts import TTFont
FONT_NAME = "AnglicanText"
pdfmetrics.registe... |
import pytest
import os
import numpy as np
from autode.wrappers.G09 import G09, print_custom_basis, get_keywords, n_ecp_elements
from autode.wrappers.G16 import G16
from autode.calculation import Calculation, CalculationInput, Constraints
from autode.species.molecule import Molecule
from autode.wrappers import keywords... |
from typing import Optional, Dict, List, Callable, Any
import torch.optim
import torch.optim
import torch.utils.data
import torch.utils.data
from torch import nn
import labml.utils.pytorch as pytorch_utils
from labml import tracker, monit
from labml.configs import option, meta_config
from .device import DeviceConfigs... |
"""
Calculate the intermolecular native contacts of each 2KOD monomer residue.
Eventually have options to output per-residue time series and pdb file with b-factor or occupancy replaced.
TODO:
Using MDAnalysis, calculate native/non-native contacts.
Map residue pairs involved onto a scatter or heatmap.
"""
import nump... |
#coding=utf-8
import sys
assert sys.version[0]!='2', 'Please Use Python3'
import OJInterface as interface
import json
ojs=interface.valid_ojs
killed=False
known_turns=[]
known_bytes=[]
current_mode=None
dataver='log4'
NORM='0123456789 \nX+-*/=.ABCDEF'
def cpp_encode(s):
return json.dumps(s)
class OJWrapper:
... |
import logging
import numpy as np
from astropy import units as u
from astropy.io import fits
from astropy import wcs
from astropy import coordinates
import katbeam
_cosine_taper = katbeam.jimbeam._cosine_taper
# Mapping from 'BANDCODE' to katbeam model name
BAND_MAP = {'L': 'MKAT-AA-L-JIM-2020',
'UHF':... |
# -*- coding: utf-8 -*-
"""
Simple Detection Code
"""
import matplotlib
matplotlib.use('agg')
import glob
import sys
import numpy as np
import os.path as op
import fitsio
import argparse as ap
from astropy.io import fits
from astropy.convolution import convolve, Gaussian1DKernel, interpolate_replace_nans
from input_u... |
import ctypes
import numpy
import os
import time
from scipy.linalg.blas import daxpy, saxpy
import functools
from numba import jit, prange, njit
import sys
n_axpby = numpy.frompyfunc(lambda x,y,a,b: a*x + b*y, 4,1)
print ("current dir ", os.path.abspath(__file__))
N = 1048
if len(sys.argv) > 1:
N = int(sys.argv[... |
import random
import time
import pyautogui
from .platform import windowMP
from .mouse_utils import mouse_random_movement, move_mouse_and_click, move_mouse
from .debug import debug
from .constants import UIElement, Button, Action
from .image_utils import find_ellement
from .settings import settings_dict
from .game im... |
"""Tests the methods in network.py
"""
import numpy as np
import torch
import pytest
from external.bazel_python.pytest_helper import main
from pysyrenn.frontend.network import Network
from pysyrenn.frontend.conv2d_layer import Conv2DLayer
from pysyrenn.frontend.fullyconnected_layer import FullyConnectedLayer
from pysyr... |
import importlib
import json
from json import JSONDecodeError
import sys
import time
import logging
from dataclasses import dataclass, field
from datetime import datetime
from enum import Enum
from typing import TypeVar, List, Optional, Tuple, Type, Dict
import pytz
from aio_pika import Message, IncomingMessage
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.