text stringlengths 3.07k 22.1k |
|---|
# Copyright 2020 <NAME>
import logging
from logging import handlers as logging_handlers
import randmac
import random
import time
import uuid
from shakenfist import config
from shakenfist import etcd
from shakenfist import ipmanager
LOG = logging.getLogger(__file__)
LOG.setLevel(logging.INFO)
LOG.addHandler(logging... |
import pytest
import random
import importlib
module = importlib.import_module("13_mine_cart_madness")
parse = module.parse
carts_move_order = module.carts_move_order
Direction = module.Direction
Cart = module.Cart
Track = module.Track
detect_collisions = module.detect_collisions
simulator = module.simulator
simulator_... |
"""
This module contains an implementation of the PH fitting algorithm using a
mixture of two Erlang distribution with common order N by three moments match.
The method is defined in paper [1].
[1] <NAME> & <NAME> (1989) Matching moments to phase
distributions: Mixtures of erlang distributions of common order,
... |
"""Custom lark parser and transformer for dash behavior tests."""
import functools
import six
import lark
from selenium.webdriver.support.ui import WebDriverWait
from pytest_dash.wait_for import (
wait_for_element_by_id, wait_for_element_by_css_selector,
wait_for_elements_by_css_selector, wait_for_element_by_... |
"""Python ctypes wrapper for duktape JavaScript interpreter"""
from pathlib import Path
import ctypes
import sys
import typing
from hat import util
Data = typing.Union[None, bool, int, float, str,
typing.List['Data'], typing.Dict[str, 'Data'],
typing.Callable]
"""Supported da... |
#!/usr/bin/python
import os, sys
import json
import numpy as np
import re
### Name: <NAME>
### ID: 16339936
### github link:
### https://github.com/EoghanOGallchoir/ARC
def solve_4258a5f9(x):
'''
Task description:
Light blue squares must be surrounded by purple squares. (Unsure of exact colours, bit c... |
# -*- coding: utf-8 -*-
## Copyright 2015-2021 PyPSA Developers
## You can find the list of PyPSA Developers at
## https://pypsa.readthedocs.io/en/latest/developers.html
## PyPSA is released under the open source MIT License, see
## https://github.com/PyPSA/PyPSA/blob/master/LICENSE.txt
"""
Functionality for contin... |
import re
from dataclasses import dataclass, field
from os.path import dirname, join
from textwrap import wrap
from typing import Dict, List
import requests
from bs4 import BeautifulSoup # type: ignore[import]
@dataclass
class ElementData:
description: str = ""
is_empty: bool = False
global_attributes: ... |
# Copyright [2020] [Two Six Labs, LLC]
# Licensed under the Apache License, Version 2.0
from collections import defaultdict
from werkzeug.datastructures import ImmutableMultiDict
from utility.available_selectors import AVAILABLE_SELECTORS
from utility.constants import *
NUMERICAL_FILTER_DEFAULT = {
UPPER_INEQUA... |
# <NAME>, May 2017
import os, sys
import numpy as np
from PIL import Image
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
import json
from utils import imutils
from pylib import HumanPts, HumanAug
def sample_from_large_gaussian(x):
return max(-2*x, min(2*x, np.random.randn... |
import copy
import torch
import math
import torch.nn as nn
from torch.nn.parameter import Parameter
import torch.nn.functional as F
import pdb
import numpy as np
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3))))
class LayerNorm(nn.Module):
def __init__(... |
# -*- coding: utf-8 -*-
# -*- python 3 -*-
# -*- hongzhong Lu -*-
# note: the script is updated on MAC
#data_dir = "/home/luhongzhong/ortholog_343/cds_align_unify"
#all_file = os.listdir(data_dir)
#all_file = [x for x in all_file if "_code" in x]
# 03-07
# produce the sh file on mac for all cds files
from Bio impor... |
from django.db.models import Avg, Count, Q, Sum
from rest_framework.response import Response
from rest_framework.views import APIView
from ..contracts.models import Contract, Contractor, Entity, Service, ServiceGroup
from ..contracts.utils import get_current_fiscal_year, get_fiscal_year_range
from ..utils.aggregates i... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import stat
import shutil
import sys
import subprocess
import platform
from xbmc import Monitor, Player
from kodi_six import xbmc
CREATE_NO_WINDOW = 0x08000000
class SopCastPlayer(Player):
def __init__(self):
Player.__init__(self... |
from .math import *
from .math import math as math
__all__ = (
'Circle',
'Circle2P',
'Circle3P',
'Cross',
'Ellipse',
'Ngon',
'Rect',
'RectC',
'RectWH',
'Sector',
'SectorT',
'Shape',
'Square',
'Taper',
'TaperQ',
'Torus',
'Path',
'Text'
)
class Sha... |
"""Parser responsible for reading the ``*dep.m`` files"""
import re
from warnings import warn
from matplotlib import pyplot
from serpentTools.utils import (
magicPlotDocDecorator, formatPlot, DEPLETION_PLOT_LABELS,
convertVariableName, str2vec,
)
from ._collections import DEPLETION_VARIABLES
from serpentTools... |
#!/usr/bin/env python
# coding: utf-8
# In[211]:
import numpy as np
# TRAINING
from sklearn.ensemble import AdaBoostClassifier, RandomForestClassifier, ExtraTreesClassifier
# METRICS
from sklearn.metrics import classification_report, roc_auc_score, confusion_matrix, accuracy_score, recall_score, precision_recall_fs... |
import numpy as np
import pytest
import pyspherical as pysh
@pytest.fixture
def mw_sampling():
# MW sampling of a sphere
Nt = 701 # Number of samples in theta (must be odd)
Nf = 401 # Samples in phi
theta, phi = pysh.utils.get_grid_sampling(Nt=Nt, Nf=Nf)
gtheta, gphi = np.meshgrid(theta, phi)
... |
# -----------------------------------
# TRAINING OUR MODEL
# -----------------------------------
import h5py
import numpy as np
import os
import glob
# cv2 requires pip install opencv-python
import cv2
import warnings
from matplotlib import pyplot
from sklearn.model_selection import train_test_split, cross_val_score
fr... |
import time
import numpy as np
import scipy as sp
import theano
import theano.tensor as T
from tqdm import tqdm
import lasagne
from astropy.io import fits
from sklearn import cluster
from .patch import extract_patches, augment, nanomaggie_to_luptitude
from .params import save_params, load_params
from .models import bu... |
import os
import http.client as httplib
from datetime import datetime
from botocore.exceptions import ClientError
import boto3
s3 = boto3.resource('s3')
dynamodb = boto3.resource('dynamodb')
from certvalidator import CertificateValidator, ValidationContext
from certvalidator.errors import PathValidationError
from py... |
"""
-- vectorized pygama processors --
take big 2d blocks of waveforms (ndarrays)
with a waveform on every row, and apply
various transforms / calcsulations.
"""
import sys
import numpy as np
import pandas as pd
from abc import ABC
class VectorProcess:
"""
Handle vectorized calculators and transforms.
Keep... |
# -*- coding: utf-8 -*-
"""
Exposes device information using dojot's modelling
"""
import json
import base64
import re
import dateutil.parser
import falcon
import pymongo
import requests
from .. import conf, Logger
from . import response_util as ResponseUtil
logger = Logger.Log(conf.log_level).color_log()
class Aut... |
# -*- coding: utf-8 -*-
#
# This file is part of Django restlayer released under the MIT license.
# See the LICENSE for more information.
from __future__ import (print_function, division, absolute_import, unicode_literals)
import json
import pickle
from django.test import Client, TestCase
from django.test.client impo... |
#!/usr/bin/env python
# coding=utf-8
import sys
import copy
from src.gene_part import GenePart
from src.cds import CDS
from src.exon import Exon
from src.xrna import XRNA
from src.gene import Gene
def has_multiple_parents(attr):
split_attr = attr.split(";")
for attr in split_attr:
if "Parent" in attr... |
# /*******************************************************************************
# Copyright (C) 2021 Xilinx, 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.apa... |
"""Base tests for SynthHD object.
This module contains common unit-tests for the SynthHD object.
"""
from math import floor
from time import sleep
class SynthHDBaseTestCase:
DEVPATH = '/dev/ttyACM0'
NOMINAL_FREQUENCY = 1.e9
NOMINAL_POWER = -10.
## Device
def test_model_type(self):
mod... |
import pybinding as pb
__all__ = ['monolayer', 'monolayer_alt', 'monolayer_4atom', 'bilayer']
def monolayer(nearest_neighbors=1, onsite=(0, 0), **kwargs):
"""Monolayer graphene lattice up to `nearest_neighbors` hoppings
Parameters
----------
nearest_neighbors : int
Number of nearest neighbor... |
"""Implements a class for Latin Square puzzles.
A Latin Square is a square grid of numbers from 1..N, where a number may not
be repeated in the same row or column. Such squares form the basis of puzzles
like Sudoku, Kenken(tm), and their variants.
Classes:
LatinSquare: Implements a square puzzle constrained by no... |
from __future__ import annotations
import inspect
import os
import asyncio
import platform
import socket
import sys
from dataclasses import dataclass
from enum import Enum
from importlib import import_module
from multiprocessing.synchronize import Event as EventType
from pathlib import Path
import asyncio
import ssl
f... |
# Page for everything related to the security tab
# Import DataTable Libs
from kivy.metrics import dp
from deepdiff import DeepDiff
from pprint import pprint
# Import Netscaler Nitro libs for editing resources
from nssrc.com.citrix.netscaler.nitro.resource.config.lb.lbvserver import lbvserver
from nssrc.com.... |
from __future__ import absolute_import, division, print_function
import numpy as np
import shlex
import subprocess
import sys
import wave
import json
from deepspeech import Model, version
from timeit import default_timer as timer
import io
import soundfile as sf
import os
# Import libraries
from pydub import AudioSegm... |
# -*- coding: utf-8 -*-
import tensorflow as tf
import json
import time
import numpy as np
from tensorflow.python.ops import lookup_ops
tf.executing_eagerly()
def _build_dataset_from_files(files, config):
if isinstance(files, str):
dataset = tf.data.TextLineDataset(files).skip(config.get('skip_count', 0)... |
import itertools
import numpy as np
import torch
import hydra
from scipy.spatial.distance import pdist
from scipy.spatial.distance import cdist
from hydra.experimental import compose
from hydra import initialize_config_dir
from pathlib import Path
import smact
from smact.screening import pauling_test
from cdvae.comm... |
from __future__ import division, print_function, unicode_literals
from sacred import Experiment
from sacred.observers import FileStorageObserver
import os
import re
import numpy as np
import json
import joblib
import pandas as pd
from collections import Counter, OrderedDict
import logging
from tqdm import tqdm
imp... |
from collections import defaultdict
import io
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
from nn.graph import plot_assemblies
from mighty.monitor.accuracy import calc_accuracy
from mighty.monitor.monitor import MonitorEmbedding, ParamRecord
from mighty.utils.domain import Mo... |
from concurrent.futures import Future
import json
import time
import sys
import traceback
from AWSIoTDeviceDefenderAgentSDK import collector
from awscrt import io, mqtt
from awsiot import iotshadow, mqtt_connection_builder
# from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
from src.handlers.logging_handler impor... |
import pyglet
import os
import urllib.request
import json
import subprocess
import math
from pyglet.window import key
from pyglet.window import mouse
from enum import Enum
from io import BytesIO
class GameOptions(Enum):
PlayGame = 0
WineCFG = 1
Terminal = 2
Back = 3
optionsNN = {GameOptions.PlayGam... |
import torch
import torch.nn as nn
import numpy as np
from cnnseq import utils
from cnnseq.utils_models import set_optimizer, flatten_audio
from skimage.io import imsave
import json
import os
# Recurrent neural network (many-to-one)
class Seq2Seq(nn.Module):
def __init__(self, params, device=torch.device('cpu')):... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
## get Nico-Jikkyo-Log xml file ##
from __future__ import annotations # Python3.9以降では不要
import enum
import os
import datetime
# constants
url_api = 'https://jikkyo.tsukumijima.net/'
ts_offset = 18800000 # 100kパケット(約18MiB)
class NetType(enum.IntEnum):
Ot... |
#! /usr/bin/env python
"""
envelope.py
Written by <NAME>
Released on 18 March 2010
Licensed under MIT License
This module provides a basic interface to OpenSSL's EVP
envelope functions.
In a nutshell, these functions are designed to provide
the primary benefit of public key cryptography (the
ability to provide secr... |
import argparse
import json
import os
from matplotlib import pyplot as plt
import numpy as np
import seaborn
from sklearn import linear_model
seaborn.set()
seaborn.set_style("whitegrid")
def make_inference_latency_plot(result_dir, max_elapsed_time=2000):
token_counts = [] # x
inference_latencies = [] # y... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" test_requirementz.py
Unit tests for requirementz.py v. 0.0.1
-<NAME> 07-20-2015
"""
import os
import sys
import unittest
from urllib.error import HTTPError
from urllib.request import urlopen
from requirementz import (
__version__,
RequirementPlus,
... |
from common import *
from configure import *
from bms import *
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence, PackedSequence
#https://github.com/pytorch/pytorch/issues/1788
# https://stackoverflow.com/questions/51030782/why-do-we-pack-the-sequences-in-pytorch
from timm.models.vision_transfo... |
#!/usr/bin/env python3
# FIXME: Port this pipeline to 2.3.
# Copyright (c) 2015-2018 by the parties listed in the AUTHORS file.
# All rights reserved. Use of this source code is governed by
# a BSD-style license that can be found in the LICENSE file.
from toast.mpi import MPI, finalize
import os
import sys
impor... |
#!/usr/bin/env python3
from os import cpu_count
from queue import Queue, Empty
from threading import Thread, Event
from uuid import uuid4 as gen_uid
from warnings import warn
from enum import Enum, unique
from functools import partial
from debug import debug_method_info
@unique
class EventType(Enum):
"""
# p... |
from photons_messages_generator.helpers import camel_to_snake, valid_struct_types
from photons_messages_generator.src import struct_field_spec
from photons_messages_generator import field_types as ft
from photons_messages_generator import errors
from delfick_project.norms import Validator, BadSpecValue, dictobj, sb, M... |
###############################################################################
# AdiabaticContractionWrapperPotential.py: Wrapper to adiabatically
# contract a DM halo in response
# to the growth of a baryonic
# ... |
import abc
import torch
import torch.nn as nn
import torch.nn.functional as F
from roca.modeling.retrieval_head.retrieval_ops import mask_point_features
class STN3d(nn.Module):
def __init__(self, k=3):
super(STN3d, self).__init__()
self.conv1 = torch.nn.Conv1d(k, 64, 1)
self.conv2 = torc... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 25 19:34:11 2019
@author: mrich
"""
import argparse
import socket
import threading
import queue
import sys
import random
import os
import re
import random
import string
import time
def get_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DG... |
# MIT License
#
# Copyright (c) 2019 Red Hat, Inc.
# 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,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module wraps the error correction process and attaches readers to the process pipes.
The code for the error correction process can be found under:
https://github.com/kurtsiefer/qcrypto/tree/master/errorcorrection
Copyright (c) 2020 <NAME>, S-Fifteen Instruments... |
from __future__ import division
import os
import torch
import torch.nn as nn
import scipy.io as sio
import torchvision.utils as vutils
import numpy as np
def getInput(args, data):
input_list = [data['img']]
# print("getinput input_list:", len(input_list)) getinput input_list: 1
input_list.append(data['mas... |
import json
import os
from config import template
class BaseParser(object):
def __init__(self, config, path, case_file):
self.config = config
self.path = path
self.case_file = case_file
@staticmethod
def execute_env(cls, debug):
cls.debug = debug
class JsonParser(BasePar... |
# mesh.py: mesh utilities.
#--------------------------------------------------------------------------------------------------
# This file is a part of the KrxImpExp package.
# Author: <NAME>
# License: GPL
#--------------------------------------------------------------------------------------------------
imp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script that collects RAMD data and determines what extra Replicas/ensembles need to be run/rerun.
Created on Fri Jan 31 14:44:55 2020
@author: andrewpotterton
"""
###Libraries
import numpy as np
from os import path
import pandas as pd
###Functions
def get_end_point... |
from os import path
import random
from pyfinite import ffield # TODO Create our own implementation !
def multiply_galois_64(a: int, b: int):
"""
Multiplies a and b in a Galois Field of 2^64
:param a:
:param b:
:return:
"""
galois_128 = ffield.FField(64, 2**64 + 2**63 + 2**62 + 2**60 + 2**... |
"""
This module houses the main classes you will interact with,
:class:`.Cluster` and :class:`.Session`.
"""
from __future__ import absolute_import
from concurrent.futures import ThreadPoolExecutor
# default to gevent when we are monkey patched, otherwise if libev is available, use that as the
# default because it's... |
import calendar
import json
import os
import re
import requests
import subprocess
import time
from datetime import datetime
from datetime import date
# OAuth token for GitHub API calls
from config import get_auth_token
def create_file(filepath):
if not os.path.exists(os.path.dirname(filepath)):
try:
os.ma... |
from typing import Dict
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.template.defaultfilters import pluralize
from django.urls import reverse
from django.utils import... |
import json
import os
import uuid
import requests
from flask import Flask, render_template, session, request, redirect, url_for
from flask_session import Session
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import DataRequired, Length... |
from django.db import models
from django import forms
from django.utils.translation import gettext_lazy as _
from django.core.mail import send_mail
from django.core import serializers
from django.contrib import messages
from django.template.response import TemplateResponse
from django.urls import reverse
from django.ht... |
import json
import yaml
import os
from pathlib import Path
from glob import iglob, glob
from smart_open import open
import git
from concurrent.futures import ThreadPoolExecutor
from itertools import repeat, combinations
from Levenshtein import distance as levenshtein_distance
from patentcity.relationship import create... |
# coding=utf-8
from django.shortcuts import render
import json
import requests
from django.http import HttpResponse, HttpResponseRedirect
from models import *
from Home.models import *
from DIMCREATOR.public_function import *
import collections
import datetime
import os
import shutil
from django.core.paginator import P... |
import sys
import copy
def judge_str(a, b):
"""
:param a: 字符串a
:param b: 字符串b
:return: 数组
描述:比较字符串a和字符串b那些位是不同的
"""
dif_seq = []
for i in range(len(a)):
try:
if a[i] != b[i]:
dif_seq.append(i)
except IndexError:
print("invalid a:%... |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
import os
from django.db import models
from django.utils import timezone
from cie10_django.models import CIE10
from model_utils.models import TimeStampedModel
from core.signals import app_log
from core.models import private_file_storage
class TipoDocumentoAnexo(models.Model):
""" Cada uno de los documentos que s... |
import numpy as np
from . import het_compiled
from ...utilities.discretize import stationary as general_stationary
from ...utilities.interpolate import interpolate_coord_robust, interpolate_coord
from ...utilities.multidim import batch_multiply_ith_dimension, multiply_ith_dimension
from ...utilities.misc import logsum
... |
"""
Test submitting a VaspWorkChain.
This does not seem to work, for `submit` the daemon will not pick up the workchain
and `run` just seems to get stuck after a while.
"""
# pylint: disable=unused-import,wildcard-import,unused-wildcard-import,unused-argument,redefined-outer-name, import-outside-toplevel
from __future... |
####################################################################################
# Larabot Discord Bot
# MIT License
# Copyright (c) 2017 Devitgg
# 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 So... |
# Copyright 2022 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 or agreed to... |
import warnings
import numpy as np
from pycosmosac.utils import constants as const
#use loose convergence criteria
SOLVE_GAMMA_THRESH = 4e-4 # 1 J/mol accuracy at 298.15K
SOLVE_GAMMA_MAXITER = 250
def lngamma_c(mols, x, parameters):
'''
Staverman−Guggenheim combinatorial term
'''
r0 = parameters["r_0... |
import os
import sys
import PIL
import shutil
import pandas as pd
import numpy as np
from functools import partial
from sklearn.model_selection import KFold
import torch
import fastai
from fastai.core import is_tuple
from fastai.train import ShowGraph
from fastai.vision import Path, open_image, ImageBBox, ObjectItemL... |
#!/usr/bin/env python-sirius
# import remote_machine
import datetime
import socketserver
import struct
import threading
import signal
import pickle
import sys
import os
import socket
import pyjob
from pyjob import Address, VERSION, MAX_BLOCK_LEN, PICKLE_PROTOCOL, WAIT_TIME,\
SET_STRUCT_PARAM, STATUS, PROPERTIES, ... |
import numpy as np
def car2sph(vec, axis = 0):
"""transform a cartesian vector into spherical coordinates"""
result = np.zeros(vec.shape)
result[0,:] = np.linalg.norm(vec, axis = axis) # r component
#result[1,:] = np.arctan(vec[1,:] / vec[0,:]) # phi component
result[1,:] = np.arctan2(vec[1,:] , v... |
import ast
import numpy as np
from keras.preprocessing import sequence
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import StratifiedKFold
from keras.layers import Input, Flatten, Dense, Activation,Average
from keras.layers import Concatenate,Dropout,Conv1D,MaxPooling1D,BatchNormalization... |
# -*- coding:utf-8 -*-
from __future__ import division, absolute_import
import numpy as np
from numpy.linalg import norm
from collections import defaultdict
from simple_ml.base.base_enum import DisType
from simple_ml.base.base_error import *
from simple_ml.base.base_model import BaseModel
__all__ = ['KMeans', 'Hie... |
"""
File: encoders.py
Author: Team ohia.ai
Description: Generalized encoder classes with a consistent Sklearn-like API
"""
import time
import numpy as np
import pandas as pd
from statsmodels.distributions.empirical_distribution import ECDF
from sklearn.linear_model import Ridge
from scipy.stats import rankdata
def ru... |
import numpy as np
import torch
import warnings
from core import cfg
def camera_center(KRT, engine='numpy'):
"""
Args:
KRT: 3x4
"""
if engine == 'numpy':
invA = np.linalg.inv(KRT[:, :3])
return (-(np.dot(invA, KRT[:, 3]))), invA
elif engine == 'torch':
invA = torch... |
########
# Copyright (c) 2017 GigaSpaces Technologies Ltd. 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 requir... |
import logging
import sys
import threading
import time
import pytest
from ophyd import Component as Cpt
from ophyd import Device, Signal
from .. import utils
from ..device import GroupDevice
from ..utils import (move_subdevices_to_start, post_ophyds_to_elog,
reorder_components, set_standard_order... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : <NAME>
# @Site : http://github.com/TJCVRS
# @File : test_dvcnn.py
"""
Test the DVCNN network
"""
import tensorflow as tf
import sys
import time
import matplotlib.pyplot as plt
import os
import numpy as np
import shutil
import argparse
import cv2
try:
... |
import numpy as np
from scipy.optimize import minimize
from scipy.io import loadmat
from math import sqrt,exp
import pickle
import sys
from time import time
def initializeWeights(n_in, n_out):
"""
# initializeWeights return the random weights for Neural Network given the
# number of node in ... |
import os
import re
import sqlite3
from PySide2.QtWidgets import QApplication
from packages.dialogs.auxiliar_dialogs import selfCloseInterface
statusDB_name = 'appStatusDB.db'
cells_formats = {
'currency': lambda v__, __: '$ {:,.2f}'.format(return_float_or_zero(v__)),
'bool': lambda v__, key_word: '{}'.forma... |
import numpy as np
import pytest
from gym_quadrotor.dynamics.coordinates import *
def base():
x = np.array([1, 0, 0])
y = np.array([0, 1, 0])
z = np.array([0, 0, 1])
return x, y, z
##########################################################################################
# direction transf... |
from conftest import train_q
import json
from test_helpers import get_job
from uuid import UUID
from test_helpers import mock_model_collection, mock_queries_collection
from test_helpers import submit_post_query, submit_get_req, compare_dicts
def test_route_root(client):
""" Test if server info is in response.
... |
import pymel.core as pm
from math import pow,sqrt
def getDistance(objA, objB):
gObjA = pm.xform(objA, q=True, t=True, ws=True)
gObjB = pm.xform(objB, q=True, t=True, ws=True)
return sqrt(pow(gObjA[0]-gObjB[0],2)+pow(gObjA[1]-gObjB[1],2)+pow(gObjA[2]-gObjB[2],2))
def offsetCreator(list, name='offse... |
import json
import numpy as np
import pandas as pd
import time
from abc import ABC
# CV Methods
from sklearn.model_selection import RepeatedStratifiedKFold
from calour.training import RepeatedSortedStratifiedKFold
# Metrics
from sklearn.metrics import (
mean_absolute_error,
mean_squared_error,
r2_score,
... |
# Licensed under an MIT open source license - see LICENSE
import numpy as np
class saa(object):
"""
Stores all the information regarding individual spectral averaging areas
(SAA)
Parameters
----------
coordinates : array
The coordinates of the SAA in pixel units. In (x,y).
spectru... |
# 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
# distributed under the... |
#!/usr/bin/python
#
# Generate svn authorization files from the input configs.
#
# This script is run periodically via cron.
#
# For testing, it is helpful to create a directory structure like:
# ### fill this out
#
import sys
import os.path
import md5
import re
import ldap
import ldap.syncrepl
import ldap.controls... |
from geopy.geocoders import Nominatim
import osmnx as ox
import taxicab as tc
import matplotlib.pyplot as plt
import networkx as nx
import plotly.graph_objects as go
import numpy as np
def validating_street(address,all_the_streets_in_city,calling_for_location = True):
similar_streets = []
# all_the_streets_in_city... |
import os
import math
import numpy as np
import tensorflow as tf
from tensorflow import keras
from sklearn.metrics import roc_auc_score, average_precision_score, roc_curve
import matplotlib.pyplot as plt
from tensorflow.keras import Sequential
from tensorflow.keras.layers import Dense, Input, Lambda
from .utils import... |
# stdlib imports
from datetime import datetime, timedelta
import os.path
from functools import partial
import zipfile
from urllib import request
from urllib import parse
import shutil
# third party imports
from shapely.geometry import shape, Point
from fiona import collection
import pyproj
import numpy as np
from shap... |
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
from MrfTypes import BatchExamplesParser, Options
__author__ = 'spacegoing'
root_path = "./expData/batchPlots/"
def gen_plot_samples(theta, max_latent, K):
def intersect(a_1, b_1, a_2, b_2, func_idx, i):
if a_1 - a_2 == 0:
... |
from __future__ import annotations
import operator
from io import BytesIO
from itertools import chain
from pathlib import Path
from typing import Dict, Any, Final, Iterable, Tuple, AbstractSet, IO, Optional, TYPE_CHECKING, Mapping, Union, ClassVar
from uuid import uuid4
import attr
import toolz
from immutables import... |
# 6.0001/6.00 Problem Set 5 - RSS Feed Filter
# Name:
# Collaborators:
# Time:
import feedparser
import string
import time
import threading
from project_util import translate_html
from mtTkinter import *
from datetime import datetime
import pytz
#----------------------------------------------------------------------... |
# Copyright 2019 Xilinx 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, ... |
"""
@author: <NAME>
@since: 18/10/2017
"""
from collections import deque
from algorithms_datastructures.trees.tree_node import TreeNode
class BinaryTree:
def __init__(self):
self.root = None
def to_doubly_linked_list(self, node):
"""Flatten the binary tree into a doubly linked list based on... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Copyright 2020 University of Liege
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 requir... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.