text stringlengths 3.07k 22.1k |
|---|
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 21 09:10:11 2020
@author: Kamil
"""
import numpy as np
class FIR_filter:
def __init__( self, _coefficients ):
self.coeffFIR = _coefficients
self.nTaps = len(_coefficients)
self.ringbuffer = np.zeros(self.nTaps)
self.ringBufferOffset ... |
from pprint import pprint
import numpy as np
import cv2
import os
# CenterNet
import sys
CENTERNET_PATH = './CenterNet/src/lib'
sys.path.insert(0, CENTERNET_PATH)
from detectors.detector_factory import detector_factory
from opts import opts
MODEL_PATH = './CenterNet/models/ctdet_coco_dla_2x.pth'
ARCH = 'dla_34'
# M... |
#!/usr/bin/env python
# POMDP File Format: http://www.pomdp.org/code/pomdp-file-spec.html
# gym-pomdps: https://github.com/abaisero/gym-pomdps
import argparse
from copy import copy
import indextools # https://github.com/abaisero/one-to-one
def state_fmt(state):
"""
Formats the given state.
"""
ret... |
#!/usr/bin/env python3
# md_nve_hs.py
#------------------------------------------------------------------------------------------------#
# This software was written in 2016/17 #
# by <NAME> <<EMAIL>>/<<EMAIL>> #
# and <NAME> <<EMAIL>> ("t... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
'''
Arc detector
Input:
data - table of medial points and normal vectors, filtered after segment detection
Output:
arcs - dictionary of arcs detected, key is the label of the group after BIRCH
data_filtered - data which do not belong to groups
Algorithm:
1. Connect points... |
#!/usr/bin/python
# Copyright 2013 Google Inc. 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 ap... |
import json
import logging
import os
from programaker_bridge import \
CallbackBlockArgument # Needed for argument definition
from programaker_bridge import ProgramakerBridge # Import bridge functionality
from programaker_bridge import BlockContext, VariableBlockArgument
from request_cache import SimpleRequestCac... |
import numpy as np
from scipy import interpolate
class WindField:
"""
A class to find wind at a point given a wind field model and inlet
conditions.
...
Attributes
----------
wind_map_ang: n x 4 x m matrix of wind angles, where n is the number of x,y
points, m is the num... |
import pandas as pd
import csv
import json
import numpy as np
from tqdm import tqdm
import ast
import operator
import pickle
import spacy
import sys
import jsonlines
import spacy
nlp = spacy.load('en_core_web_lg',disable=["ner","parser","tagger"])
docmap = {}
def get_doc(docs):
if docs in docmap:
retur... |
from unittest import TestCase
from abconfig import ABConfig
from abconfig.common import Item, Dict, Type
class TestType(TestCase):
all_types = Type.__types__[0] + Type.__types__[1]
all_items = (1,1.5,'1',True,[1,2,3],(1,2,3),{1,2,3},frozenset([1,2,3]))
def test_is_type(self):
for t,i in zip(self... |
#
# 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... |
#!/usr/bin/env python3
# License: CC0 https://creativecommons.org/publicdomain/zero/1.0/
import csv
import re
import sys
# In the following two lists (US_STATES and US_STATE_ABBREVS), the indexes of
# the corresponding states must match. For example if 'California' is index 4
# in the former list, then 'CA' must al... |
import json
import requests
import requests.exceptions
import requests.packages.urllib3
from . import __version__ as version
class ThreadFixAPI(object):
"""An API wrapper to facilitate interactions to and from ThreadFix."""
def __init__(self, host, api_key, verify_ssl=True, timeout=30, user_agent=None, cert... |
#!/usr/bin/env python
# Copyright (c) 2002-2008 ActiveState Software Inc.
# License: MIT License (http://www.opensource.org/licenses/mit-license.php)
# This is modified to deal with C project, with preprocess command not in comment.
# Options are removed.
# The output is for call tree analysis, not to be built.
# How ... |
from hypothesis import example, given, settings
from hypothesis import strategies as st
import pytest
from ssz.constants import CHUNK_SIZE
from ddht.v5_1.alexandria.partials._utils import get_chunk_count_for_data_length
from ddht.v5_1.alexandria.partials.chunking import (
MissingSegment,
chunk_index_to_path,
... |
"""
Utilities module. Almost all **goldfinchsong** logic is handled by the
functions in this module. It's the workhorse of the package.
"""
import random
import re
from os import listdir
from os.path import isfile, join
import tweepy
def access_api(credentials):
"""
Arguments:
credentials (dict): Auth... |
# -*- coding: utf-8 -*-
import boto3
import docker
import argparse
from threading import Thread
import time
POOLING_TIMEOUT = 30
EC2 = 'ec2'
START_PORT = 6000
DOCKER_IMAGE_NAME = 'egorvas/appium-docker-android'
def stop(name, postfix, region, aws_secret, aws_key):
resource = boto3.resource(EC2, region_name=re... |
import platform
from celery.result import AsyncResult
from django.http import JsonResponse, HttpResponseRedirect, HttpResponse
from django.shortcuts import render
from django.urls import reverse
from django.views.decorators.csrf import ensure_csrf_cookie
from cocktail_engine.celery import app
from engine.forms import... |
'''ResNet in PyTorch.
For Pre-activation ResNet, see 'preact_resnet.py'.
Reference:
[1] <NAME>, <NAME>, <NAME>, <NAME>
Deep Residual Learning for Image Recognition. arXiv:1512.03385
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvNet_local(nn.Module):
def __init__(self, num_c... |
__all__ = [
'Mux', 'Stream', 'MediaStream', 'VideoStream', 'AudioStream', 'ChapterStream',
]
from abc import ABC
from pprint import pformat
from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, Union
from ..binary_path import BinaryPath
from ..config import FileInfo
from ..language import UNDEFINED... |
'''
module for measuring the observable of a galaxy catalog. Compile all the
different methods for measuring observables here.
'''
import numpy as np
from . import util as UT
# --- nbodykit ---
import nbodykit.lab as nblab
from nbodykit.algorithms.fftpower import FFTPower
from nbodykit.source.mesh.field import ... |
# seiyuusearch.py
import os
from dotenv import load_dotenv
from discord.ext import commands
from jikanpy import Jikan
from typing import Dict, List
jikan = Jikan()
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
# emojis 1 thru 10 that will be used to navigate search results, indexed from 0
emojis = ['1️⃣','2️⃣','3️... |
#!/usr/bin/env python3
import os
import sys
from clients.clients import IssueClient, ProjectClient, TimeEntryClient, UserClient, TrackerClient
from clients.utils import BadRequest, curry_with_filters, iterate_response
from credentials import get_credentials
from formatter import AgileFormatter, AgileFormatter, LinkFor... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
from numpy import inf
from controller import Robot, Keyboard
import math
from libraries import side_check as sc
MAX_SPEED = 0 ### maximum velocity of the turtlebot motors ( set to motors max velocity in setup() )
TURN_MULT = 0.45 ### constant to slow down turn speed ( too high and turning will be inaccurate)
MOVE_MU... |
#!/usr/bin/python3
import cv2 as cv
import numpy as np
import math
import tkinter as tk
#Setting the font to be standardized throughout
font = cv.FONT_HERSHEY_SIMPLEX
#Setting the coordinates for calibration line
center_x1 = 25
center_x2 = 175
center_y = 250
class App:
def __init__(self, window, window_title, ... |
#!/usr/bin/env python
# coding: utf-8
import wx
import wx.grid
from wx.lib.pubsub import pub
from sys import platform
from FontNameGenerator import *
if platform == 'win32':
ui_width = 264
ui_height = 290
else:
ui_width = 252
ui_height = 254
class FNGFrame(wx.Frame):
"""
The main frame
... |
"""
Created on 7/17/16 10:08 AM
@author: <NAME>, <NAME>
"""
from __future__ import division, print_function, absolute_import
import numpy as np
import psutil
import joblib
import time as tm
from ..io.hdf_utils import check_if_main, check_for_old, get_attributes
from ..io.pycro_data import PycroDataset
from ..io.io_u... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
def top1_pred(outputs, half=False):
max_logit, pred = torch.max(outputs, 1)
if half:
pred = pred.half()
return max_logit, pred
class EarlyExitInspector():
def __init__(self, Network, device, pr... |
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from optstoicpy.core.reaction import Reaction
from optstoicpy.core.pathway import Pathway, generate_kegg_model
from optstoicpy.core.drawpathway import *
import pickle as pickle
import os
import json
import pdb
i... |
import logging, os
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
from funfolding import binning, model, solution, pipeline
def generate_acceptance_correction(vec_f_truth,
binning,
... |
import os
import sys
import threading
import time
import periphery
from .test import ptest, pokay, passert, AssertRaises
if sys.version_info[0] == 3:
raw_input = input
import queue
else:
import Queue as queue
path = None
line_input = None
line_output = None
def test_arguments():
ptest()
# Inv... |
# First check the Python version
import sys
if sys.version_info < (3,4):
print('You are running an older version of Python!\n\n' \
'You should consider updating to Python 3.4.0 or ' \
'higher as the libraries built for this course ' \
'have only been tested in Python 3.4 and higher.\n'... |
######### Bot V0.4 created by <NAME> #########
### NOTE: This is not the main module. Please run main.py
# This is an extension of main.py
# This bot is for the intent to be used as a fun resource for Discord servers and is a work in progress
#
# In this section of code, you will find the following:
### Commands:
# .cl... |
#!/usr/bin/env python
"""
bcm.py
========
Attempt to parse the CMake/BCM tealeaves in order to
provide the config information that CMake would
without using CMake.
* hmm this works fine for the lib64/cmake exported targets,
but extracting things from the hand written cmake/Modules
which are "installed" by ok... |
import numpy as np
import torch
import torch.cuda
import random
import os
import warnings
import hashlib
import _pickle as pickle
import logging
from fastNLP.io import EmbedLoader
from fastNLP.core.metrics import MetricBase
from fastNLP import logger
import argparse
from torch import nn
from torch.optim import SGD, Ada... |
#!/usr/bin/env python
""" validate_mud_url.py
Use this script to find MUD URLs in LLDP and DHCP packets found in a pcap file.
FUTURE: If a MUD URL is not found, check the other TLVs or options or TLVs
to see if there is a malformed MUD URL in recognizable way.
Copyright (c) 2018 Cisco and/or its affiliates.
... |
#!/usr/bin/env python
# coding: utf-8
import os
from datetime import datetime, timedelta
import sys
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
# from arviz import hpd
from rakott.mpl import savefig_bbox
sns.set_context('paper', font_scale=1.3... |
import inspect
from argparse import ArgumentTypeError
from nose.tools import raises, assert_equal
from radula.rad import (Radula, RadulaLib, _gib, _gb, _mib, _mb, RadulaError,
human_size, from_human_size, calculate_chunks,
legacy_calculate_chunks, guess_target_name, must_... |
import sys
import json
import asyncio
from unittest import mock
from datetime import datetime
import logging
import time
from astool import ctx, iceapi
import models
def begin_session_2(context):
with open("border/tests/fetchBootstrap.json", "r") as ff:
bs_t, _1, _2, m_bootstrap, _3 = json.load(ff)
w... |
#
# openslide-python - Python bindings for the OpenSlide library
#
# Copyright (c) 2010-2014 Carnegie Mellon University
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of version 2.1 of the GNU Lesser General Public License
# as published by the Free Software Foundation.
#
... |
# Copyright 2021 QHAna plugin runner contributors.
#
# 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 ... |
#!/usr/bin/env python2.7
from __future__ import print_function
import imp
from importlib import import_module
from logging import info
from PIL.Image import ROTATE_270
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from utils.waypoints_class import Waypoints
from utils.b... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import grad, Variable
import numpy as np # 확인용으로 넣어둠 이따 지우세요
import time
from .constants import *
from utilities.device import get_device
from .lr_scheduling import get_lr
from dataset.e_piano import compute_epiano_accuracy
# t... |
'''Module for boilerplate code around the training loop.
Defines an abstract base class `Model` for Bayesian word embedding models, a
function `train()` that runs the training loop, and a function `add_cli_args()`
that adds command line arguments to control the training loop (e.g., the number
of training steps and the... |
#!/usr/bin/python3
# number of output figures = 16
import functools
#import multiprocessing
import matplotlib as mpl
import numpy as np
import scipy.io
from helper.figure import Figure
import helper.finance
import helper.plot
# [0.0799766874430739, 0.08072246694422885]
# => [0.07997, 0.08073]
# [-0.0001096208936... |
import rdflib
import requests
from idlib.utils import resolution_chain
from protcur import namespace_mappings as nm
from protcur.core import annoSync
from protcur.analysis import Hybrid, protc
from hyputils.hypothesis import HypothesisHelper, group_to_memfile
from orthauth.utils import QuietDict
from pysercomb.pyr impo... |
'''
JKS/JCEKS file format decoder.
Use in conjunction with PyOpenSSL to translate to PEM, or load private key and certs
directly into openssl structs and wrap sockets.
See http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/sun/security/provider/JavaKeyStore.java#JavaKeyStore.engineLoad%28java... |
from flask import Flask,render_template,request,session,redirect,url_for,flash
from flask_sqlalchemy import SQLAlchemy
from flask_login import UserMixin
from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import login_user,logout_user,login_manager,LoginManager
from flask_login imp... |
import argparse
import torch
from collections import OrderedDict
from os.path import isdir
from torch import nn
from torch import optim
from torchvision import datasets, transforms, models
def arg_parser():
parser = argparse.ArgumentParser(description="train.py")
parser.add_argument('--arch', dest="arch", a... |
import sys
from unittest import TestCase
from django import template
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.template import Template
try:
from django.test.client import RequestFactory
except ImportError:
from snippetscr... |
import geopandas
import numpy
import os
import pandas_profiling
from urllib import request, parse
import zipfile
import shapefile
import datetime
from json import dumps, loads
from mapbox import Uploader
from dotenv import load_dotenv
from time import sleep
from random import randint
load_dotenv()
import os
import su... |
"""
Test serac/index/models.py
"""
import grp
import pwd
from datetime import datetime, timedelta
from io import BytesIO
from pathlib import Path
import pytest
from pyfakefs import fake_filesystem
from serac import crypto
from serac.config import ArchiveConfig
from serac.index.models import (
Action,
Archived... |
import gym
import gym.spaces as spaces
import sys
import socket
from _thread import *
import os
import csv
import numpy as np
import pandas as pd
import math as m
import time
import random
class Interface:
def __init__(self, host='172.16.58.3', port=8123, act_dim=1, state_dim=1):
print('before')
self.s = sock... |
from asyncio import Protocol
import struct
from typing import Dict, Optional, Type, Final, Any
from alpyro_msgs import Duration, RosMessage, Time, Converter
from typing_extensions import Annotated, get_type_hints
from typing_extensions import get_args, get_origin # type: ignore[attr-defined]
class TCPROSConverter:
... |
# -------------------------------------------------------------------------------------------------
# Embroidery
# -------------------------------------------------------------------------------------------------
#
# The program is to design simple ornament matrices for ... |
from ops import *
from utils import *
import os
import time
import datetime
import mission_control as mc
from scipy.misc import imsave as ims
from tensorflow.contrib.layers import batch_norm
def discriminator(image, reuse=False):
"""
Used to distinguish between real and fake images.
:param image: Images f... |
from webhelpers2.html import tags, HTML
from blazeform import element
from blazeform.form import FormBase
from blazeform.util import StringIndentHelper, NotGiven, HtmlAttributeHolder
class FormRenderer(object):
def __init__(self, element):
self.element = element
self.output = StringIndentHelper()... |
'''
This is going to be the client Alice aka A for Cryptography and Network Security HW2 taught by Professor
Yener in F18. This will connect to the KDC and through Diffie-Hellman, gets a key Ka to use in N-S with
KDC and B.
'''
import random
import time
import socket
import sys
import toy_des
# remember you can ... |
#!/usr/bin/python3
'''
Example script to generate ftml document from glyph_data.csv and UFO.
To try this with the Harmattan font project:
1) clone and build Harmattan:
clone https://github.com/silnrsi/font-harmattan
cd font-harmattan
smith configure
smith build ftml
2) run psfge... |
from covid19_sfbayarea.news import scrapers
from covid19_sfbayarea.news.contra_costa import ContraCostaNews
from covid19_sfbayarea.news.feed import NewsItem
from covid19_sfbayarea.utils import PACIFIC_TIME
from datetime import datetime
import os
import pytest
from typing import List
from unittest.mock import patch
# ... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
from collections import namedtuple
import numpy as np
import pyframe3dd.pyframe3dd as frame3dd
import matplotlib.pyplot as plt
import math
gravity = 9.80633
RIGID = 1
FREE = 0
Material = namedtuple('Material', ['E', 'G', 'rho'])
Steel... |
"""
DGL-based AttentiveFP for graph property prediction.
"""
import torch.nn as nn
import torch.nn.functional as F
from deepchem.models.losses import Loss, L2Loss, SparseSoftmaxCrossEntropy
from deepchem.models.torch_models.torch_model import TorchModel
class AttentiveFP(nn.Module):
"""Model for Graph Property Pre... |
# -*- coding: utf-8 -*-
import librosa
import numpy as np
import math
def Extract_mfcc(filepath):
y, sr = librosa.load(filepath,sr=None) #sr:采样率
y = librosa.resample(y, sr, 16000) #把所有的音频采样率降到16000
mfccs = librosa.feature.mfcc(y=y, sr=sr,n_mfcc=24)
i = 0
print(np.shape(mfccs))
# 通过设定绝对阈值... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from .SPADE_Norm import SPADE
from .utils import register_model, unpack_feature, pack_feature
@register_model
def Plane(**kwargs):
model = Plane_Model(**kwargs)
return model
@register_model
def PurePlane(**kwargs):
model = PurePlaneMode... |
#! /usr/bin/env python
import os.path
import os
import argparse
import pickle
from util import *
from collections import defaultdict
import base64
import logging
import sys
import json
import shelve
#from FeatureExtraction import Tf_Idf
from LangProc import docTerms
# todo : remove this assumptions
# Indexer assumes th... |
import datetime
import numpy as np
import pandas as pd
from six import iteritems
from six.moves import zip
from zipline.utils.numpy_utils import NaTns
def next_event_frame(events_by_sid,
dates,
missing_value,
field_dtype,
event_date... |
from django.conf import settings
from django.contrib.auth import login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import UserCreationForm
from django.core.serializers import get_serializer
from django.views.generic import FormView
from django.shortcuts import render, redire... |
from torchvision.datasets import ImageFolder
from torchvision.datasets.folder import default_loader
from typing import Any, Callable, cast, Dict, List, Optional, Tuple
import numpy as np
class ImTinyImagenet(ImageFolder):
def __init__(self,
root: str,
imb_type='exp',
... |
import requests
import json
from datetime import datetime, timedelta
import tkinter as tk
import time
def getImageName(desc,icon):
imageName = ''
#clear
if icon == '01d':
return 'jclear_day.png'
if icon == '01n':
return 'jclear_night.png'
#clouds
if icon == '04d' or icon =='04n'... |
## WARNING :
##pip install bar_chart_race
##pip install pandas
## see https://www.dexplo.org/bar_chart_race/
import bar_chart_race as bcr
import pandas as pd
import csv
import os, sys
import numpy as np
import matplotlib.pyplot as plt
import subprocess
from matplotlib import ticker
import datetime
from utils import... |
# import packages
import numpy as np
import matplotlib.pyplot as plt
from reg_utils import sigmoid, relu, plot_decision_boundary, initialize_parameters, load_2D_dataset, predict_dec
from reg_utils import compute_cost, predict, forward_propagation, backward_propagation, update_parameters
import sklearn
import sklearn.da... |
import argparse
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch import optim
import torch.nn.functional as F
import os
import time
import numpy as np
import pandas as pd
from collections import defaultdict
from utils import read_vocab,write_vocab,build_vocab,Tokenizer,padding_idx,ti... |
# this file will be used as a singleton object in the explorer tile
import time
import requests
from types import SimpleNamespace
import re
from datetime import datetime
from planet import api
from ipyleaflet import TileLayer
from component.message import cm
from component import parameter as cp
planet = SimpleName... |
"""
CLI entrypoint to tenx etl commands.
Since the list of featureIds are the same for the entire file, we can take
advantage of this for parallelization.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
from celldb import client
impo... |
# Copyright: 2005-2012 <NAME> <<EMAIL>>
# License: GPL2/BSD
"""
restriction classes designed for package level matching
"""
from snakeoil.compatibility import is_py3k, IGNORED_EXCEPTIONS
from snakeoil.demandload import demandload
from snakeoil.klass import generic_equality, static_attrgetter
from pkgcore.restriction... |
# Copyright 2015 Ufora 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 i... |
import time
from django.shortcuts import redirect
from datetime import datetime
from rest_framework.views import APIView
from pay_demo.utils.alipay import AliPay, AlipayAuthorization
from config.settings.base import APP_PRIVATE_KEY, ALIPAY_PUBLIC_KEY, APP_NOTIFY_URL, RETURN_URL, APPID
from django.conf import settings
f... |
from __future__ import absolute_import
from __future__ import print_function
import signal, os, time, string, pickle, re, sys, glob
import traceback
# Get a list of ports
def serial_ports():
""" Lists serial port names
:raises EnvironmentError:
On unsupported or unknown platforms
:ret... |
import os
from .base_dataset import BaseDataset
from ltr.data.image_loader import default_image_loader
import numpy as np
import json
import cv2
from collections import OrderedDict
from ltr.admin.environment import env_settings
def get_target_to_image_ratio(seq):
anno = np.array(seq['anno'])
img_s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import dataclasses
import math
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.keras.callbacks import ModelCheckpoint, ReduceLROnPlateau
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.kera... |
"""Formatting and import functions.
Author: <NAME>
Date : 2/06/17
.. 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, i... |
"""Train face recognition baselines using ARCFace loss
To run copy and modify arcface_large_batch_sample_config.py in a new file (e.g. my_config.py) and run::
bob keras fit -vvv my_config.py src/bob.bio.face/cnn_training/arcface_large_batch.py
"""
import tensorflow as tf
import tensorflow_addons as tfa
from bob.b... |
# -*- coding: utf-8 -*-
"""UPnP base-profile module."""
import asyncio
import logging
import time
from datetime import timedelta
from ipaddress import IPv4Address
from typing import Any, Dict, FrozenSet, List, Optional, Sequence, Set, Union
from async_upnp_client.client import (
EventCallbackType,
UpnpAction,... |
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
img_size = 28
num_classes = 10
img_shape = (img_size, img_size)
img_size_flat = img_size*img_size
num_channels = 1
batch_size = 128
l2_regulizer = 0.001
filter_size1 = 3
num_filters1 = 128
filter_size2 = 3
num_filters2 = 12... |
import numpy as np
nodes = []
class Node:
value = None
d = None
prev_node_idx = None
def __init__(self, prev_node_idx):
self.prev_node_idx = prev_node_idx
def shape(self):
return self.value.shape
def init_d(self):
self.d = np.zeros(self.value.shape)
class Var(Node... |
import math
from scipy.optimize import minimize
from scipy import interpolate
try:
from numba import njit
NJIT = True
except ImportError:
NJIT = False
import numpy as np
# Define constants
A = [7.24032, -2.84383e-3, 2.75660e-5]
B = [8.63186, -3.31977e-3, 2.37170e-5]
# Gravitational constant
G = 0.052
# W... |
#!/usr/bin/env python3
###############
# Script to:
# 1) create a launchctl plist file for local environment for desired program.
# 2) copy it to ~/Library/LaunchAgents
# 3) launch the agent
#
###############
### Python3 Library documentation # https://docs.python.org/3/library
import time # https... |
#!/usr/bin/env python
import sys
sys.path.append('../common')
import os
import time
import logging
import argparse
from util import check_output, check_both, run_bg, strip_comments
from apache_setup import configure_apache, reset_apache, restart_apache, is_apache_configured
# click
CLICK_CONF = 'autogen.click'
CLICK... |
import sys
from PyQt4 import QtCore, QtGui, uic
import sqlite3
from PyQt4.QtGui import QApplication, QWidget, QLabel, QGroupBox, QVBoxLayout, QImage, QPixmap
from PyQt4.QtCore import QSize, QTimer
import cv2
#UI Files Connector
QLogin = uic.loadUiType("Login.ui")[0]
qtCo... |
""" Main .py for running autoML_plus """
from __future__ import print_function
import argparse
import numpy as np
import pickle
from tpot import TPOTRegressor
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
import sys
import config
LOWER_RMSE_THRESHOLD, UPPER_RMSE_THRESH... |
from typing import Optional
from django.db import DatabaseError
from django.db import models
from django.db.models import QuerySet
from django.utils.functional import cached_property
from core.globals import logger
from db.models import SoftDeletableBaseModel, SoftDeletableQS
from pyrogram import types
from telegram ... |
import argparse
def model_opts(parser):
"""
These options are passed to the construction of the model.
Be careful with these as they will be used during translation.
"""
# Model options
# Embedding Options
parser.add_argument('-word_vec_size', type=int, default=250,
... |
"""
This module contains all of the interaction with the SQLite database. It
doesnt hold a connection itself, rather, a connection is passed in as
an argument to all the functions and is maintained by CherryPy's threading
system. This is clunky but fuck it, it works (for now at least).
All post and thread data are sto... |
from PIL import Image,ImageTk
import tkinter.messagebox
import os
from set_black import setWallPaper
from ground import save_url,load_view,load_down,root_url
import tkinter
import datetime
y=datetime.datetime.today().year
m=datetime.datetime.today().month
def set_time(hour,minte,secends,day,month=str(m),year=str(y)... |
from .utils import *
from .indicator_calculator import IndicatorCalculator
from .current_ratio import CurrentRatio
from .liquidity_ratio import LiquidityRatio
from .current_debtors_collection_rate import CurrentDebtorsCollectionRate
from .cash_balance import CashBalance
from .cash_coverage import CashCoverage
from .ope... |
#Classes devoted to handling people, mostly students (TAs)
from mconfig import params
from mclasses import *
class Person:
def __init__(self, person_id, name):
self.id=person_id
self.name = name.encode('ascii', "ignore").decode()
def __repr__(self):
return self.name + '(jt:' + str(se... |
#! /usr/bin/python
import pickle
from .predict_binding import *
from .generate_mhc_list import get_dic_model_list
'''For each method, generate prediction score distributions for 1million randomly selected peptides.
These score distributions will be used by consensus predictor when combining scores.'''
def get_pe... |
# pylint: disable=redefined-outer-name # pragma: no cover
import os
import sys
import time
import typing as t
import urllib
import logging
import threading
import contextlib
import subprocess
import urllib.request
from typing import TYPE_CHECKING
from contextlib import contextmanager
from .._internal.utils import rese... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.