text stringlengths 3.07k 22.1k |
|---|
import glm, gc, torch, math, os
import torchvision.transforms.functional as TF
import torch.nn.functional as F
from PIL import Image, ImageFilter
import numpy as np
from pytti import DEVICE, parametric_eval
from pytti.LossAug.DepthLoss import DepthLoss
from adabins.infer import InferenceHelper
TB_LOGDIR = "lo... |
# Copyright 2018 Google LLC.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
#... |
#!/usr/bin/env python3
"""aiodropbox dbx_logger -- Setup loguru logging with stderr and file with click."""
import collections
try: # python 3
from collections import abc
except ImportError: # python 2
import collections as abc
import concurrent.futures
from datetime import datetime
import functools
impor... |
import numpy as np
import pandas as pd
import csv
from collections import Counter
ds1_genuine_tweets = 'data/datasets_full.csv/genuine_accounts.csv/tweets.csv'
ds1_genuine_users = 'data/datasets_full.csv/genuine_accounts.csv/users.csv'
ds1_sb1_tweets = 'data/datasets_full.csv/social_spambots_1.csv/tweets.csv'
ds1_sb1... |
# coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
import cv2
def match(resultsfile, groundtruthfile, show_images):
"""
匹配检测框和标注框, 为每一个检测框得到一个最大交并比
:param resultsfile: 包含检测结果的.txt文件
:param groundtruthfile: 包含标准答案的.txt文件
:param show_images: 是否显示图片
:return maxiou_confidence: n... |
import uuid
from hashlib import sha3_256
from Crypto.Cipher import AES
from .config import *
import random
import string
import struct
from .results import SplunkResult
RANDOM_KEY = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(40))
class StoredSplunkResult(object):
DATA_KEY = None
... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 23 11:41:16 2018
This module is an implementation of the (S)ingle (O)bjective (B)inary (G)enetic
(A)lgorithm.
@author: sreimond
"""
import numpy as np
from copy import deepcopy
import itertools
class Population( object ):
"""
The `Population` class holds Indi... |
# Copyright (c) 2017, <NAME>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the foll... |
import tensorflow as tf
import numpy as np
import os
import argparse
import sys
import random
import logging
import librosa
from audio_utils import melspectrogram
from utils import char_to_ix
FLAGS = None
np.set_printoptions(edgeitems=12, linewidth=10000, precision=4, suppress=True)
logger = logging.getLogger('ten... |
import argparse
import pandas as pd
import plotly
import plotly.express as px
import plotly.graph_objects as go
import numpy as np
import os
from outliers import smirnov_grubbs as grubbs
store_plots = True
np.random.seed(1)
def createPlot(path, directory, title, warm_start):
"""
Creates plotly .html figure from th... |
#--------------------------------
# Name: nldas_ancillary.py
# Purpose: Process NLDAS ancillary data
#--------------------------------
import argparse
import datetime as dt
import logging
import os
import subprocess
import sys
import drigo
import numpy as np
import pandas as pd
import _utils
def main(... |
import copy
from datetime import datetime
from .base import BaseModel
import sys
if sys.version_info < (3, 9):
import typing
def _datetime_from_int(values: dict, key: str) -> datetime or None:
if key in values and values[key]:
return datetime.utcfromtimestamp(values[key])
return None
def _stri... |
"""Train a neuro-flight controller attitude control using the PPO RL
algorithm.
It is recommended before training for an extended period of time to set the
ckpt_freq and timestep arguments to small numbers and test everything is
functioning as expected.
The Tensorflow input tensor is named 'pi/ob:0', and the output... |
import numpy as np
from calculate_mdl import *
import argparse
import os
import pandas as pd
from sklearn import metrics as sk_metrics
def calculate_auc(curves):
aucs = []
for curve in curves:
curve = np.array(curve)
epochs = np.arange(len(curve))
aucs.append(sk_metrics.auc(epochs, curv... |
import tensorflow as tf
def gaussian_kinetic(r):
with tf.name_scope("K"):
return 0.5 * tf.reduce_sum(r ** 2, axis=-1)
def ham_energy(state, momentum, pot_fun, kin_fun):
with tf.name_scope("ham_energy"):
return pot_fun(state) + kin_fun(momentum)
def __leapfrog_step_pre(x, r, pot_fun, eps=0.1... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_minke
----------------------------------
Tests for `minke` module.
"""
import unittest
import minke
from minke import mdctools, sources
import numpy as np
class TestMinke(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
p... |
# Copyright 2017 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.
"""Traverse the source tree and update a cloud file with component mappings.
In each OWNERS file, a component and a team may be defined. This recipe calls
a... |
import os
# os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
# os.environ["CUDA_VISIBLE_DEVICES"] = "3"
from src.python.consts import *
from src.python.preprocess import *
from src.python.geneontology import *
from src.python.baselines import *
from pymongo import MongoClient
from tqdm import tqdm
import tensorflo... |
# ----------------------------------------------------------------------
# |
# | Builder.py
# |
# | <NAME> <<EMAIL>>
# | 2018-05-20 22:51:45
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2018-22.
# | Distributed under the Boost Software License,... |
import numpy as np
from matplotlib import pyplot as plt
import time
import utils as ut
def print_loss(iteration_results,final_results,n_chessboard):
'''
iteration_results: list of the list containg the value of the loss function at each iteration for every chessboard
final_results: list of the final loss f... |
import os
import sys
import logging
import csv
import re
import vcf
import argparse
import urllib2
import itertools
import pandas as pd
import numpy as np
import Fred2.Core.Generator as generator
import math
from collections import defaultdict
from Fred2.IO.MartsAdapter import MartsAdapter
from Fred2.Core.Variant impo... |
from bayes_filter.filters import FreeTransitionSAEM
import tensorflow as tf
import tensorflow_probability as tfp
import os
from bayes_filter.misc import load_array_file, get_screen_directions
from bayes_filter import float_type
from bayes_filter.datapack import DataPack
import sys
from bayes_filter.feeds import IndexFe... |
#==============================================================================
#
# $Id$
#
"""
Classes for reading and writing midifiles.
"""
#
# Copyright (C) 1999 <NAME>
#
# Permission is granted to use, modify and redistribute this code,
# providing that the following conditions are met:
#
# 1) This copyrigh... |
"""
Classes to serialize the RESTful representation of Drycc API models.
"""
import logging
import json
from django.contrib.auth.models import User
from django.utils import timezone
from rest_framework import serializers
from api import models
from api.utils import timestamp2datetime
logger = logging.getLogger(__nam... |
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import itertools
from sklearn.metrics import accuracy_score
from scipy.optimize import curve_fit
from sklearn.metrics import r2_score
from matplotlib.patches import Rectangle
def objective(x, a, b, c):
return a * np.exp(... |
import cv2
import time
class Colors:
def __init__(self):
self.blue = (255, 0, 0)
self.yellow = (0, 255, 255)
self.red = (0, 0, 255)
self.green = (0, 255, 0)
self.black = (0, 0, 0)
class Configs:
def __init__(self, img):
self.colors = Colors()
self... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class BaseMLP(nn.Module):
'''
Simple MLP on single task for benchmark evaluation
'''
def __init__(self, num_views, seq_len, sensor_dim, hidden_dim, output_dim, dropout_p=0.2):
super(BaseMLP, self).__init__()
self.num_vi... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 29 10:57:09 2021
@author: luis
"""
# Regresión lineal múltiple en Spyder con Python
# Cómo importar las librerías
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
print("LIBRERÍAS IMPORTADAS")
# Importar el data set
dataset = pd.read_csv('50_Start... |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
from plotly import tools
from dash.dependencies import Input, Output, State
from datetime import datetime as dt
from dateutil import parser
import pandas as pd
import sundial
import numpy as np
def get_ba... |
import json
import logging
import os
from django.apps import apps
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
logger = logging.getLogger(__name__)
INTEGRATION_ADMIN_ROLE_NAME = "Integration Admin"
# These functions get automatically passed "proposal"... |
import re
from grades.models import Course, Faculty, Department
from .feide import FeideClient
class TIAClient(FeideClient):
init_login_url = "https://api.ntnu.no/rest/v4"
base_url = "https://api.ntnu.no/rest/v4"
model = None
pk_field = None
resource_name = None
def get_detail_url(self, obj... |
import os
import json
import numpy as np
import open3d
from copy import deepcopy
from tqdm import tqdm
from modues.dataset import KittiDataset, sel_xyz_in_box3d, sel_xyz_in_box2d, Points
from modues.nms import boxes_3d_to_corners, overlapped_boxes_3d, overlapped_boxes_3d_fast_poly
from modues import preprocess
def s... |
from logzero import logger
import igraph as ig
import plotly.graph_objs as go
from BITS.plot.plotly import make_line, make_scatter, show_plot
from BITS.seq.utils import revcomp_seq
def convert_overlap(overlap):
"""Add overlap type after adjusting `g_[start|end]` so that `strand(g.seq[g_start:g_end])`
is the o... |
"""
MNIST - MNIST-M Domain Adaptation
"""
import tensorflow as tf
print(tf.__version__)
import numpy as np
from tensorflow.keras import Sequential, Model
from tensorflow.keras.layers import Dense, Flatten, Conv2D, Dropout, MaxPool2D, BatchNormalization, Dropout
import os
import shutil
import sys
import matplotlib.... |
import argparse
import json
import os
import pickle
import random
import shutil
import numpy as np
import torch
from loguru import logger
from sklearn.metrics import classification_report, f1_score, confusion_matrix
from torch.optim import Adam
from transformers import AutoTokenizer
from torch.nn import KLDivLoss, Log... |
import json
from queue import Queue
from collections.abc import Iterable
import _globals
import utils
def print_RaftServer_attributes(raft):
if raft is None:
print('raft == None')
print('Exiting from print_RaftServer_attributes')
return
raft_dict = None
if type(raft) == dict:
... |
# -*- coding: utf-8 -*-
# pylint: disable=bad-whitespace, too-few-public-methods
""" JMX Client Proxy.
See http://www.jolokia.org/reference/html/protocol.html for a
detailed description of the Jolokia protocol and different ways
to query for information. The client API methods only describe
the major p... |
import math
import numpy as np
import torch
import torch.nn as nn
import warnings
from typing import List, Optional, Union
from .base import Flow
from .rnn import SplineRNN
__all__ = [
'TransformedExponential'
]
class StandardExponential(nn.Module):
"""Standard exponential distribution with unit rate."""
... |
from collections import Counter, Iterable, OrderedDict, defaultdict
import csv
from django.contrib.auth.mixins import (
LoginRequiredMixin, PermissionRequiredMixin,
)
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from django.http import H... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2019 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the ... |
import rclpy
from rclpy.node import Node
from geometry_msgs.msg import Twist
from tf2_msgs.msg import TFMessage
from nav_msgs.msg import Path
from rosbot_controller.rosbot_2D import Goal, Rosbot, RobotState, RobotControl
from scipy.spatial.transform import Rotation
from nav_msgs.msg import Odometry
import numpy as np
... |
"""
Master Copy
Tron Remake
@author: <NAME> and <NAME>
Original copy of working code from MP 4 by Naomi and Hadleigh
Basis code for Tron game framework
"""
import pygame
from pygame.locals import*
import time
class PyGameWindowView(object):
"""View object containing the visual elements of the game.
Takes a g... |
import os
import argparse
import datetime
import re
import time
import torch
import numpy as np
import random
import wandb
import yaml
from transformers import AdamW, get_cosine_schedule_with_warmup, get_linear_schedule_with_warmup
from tqdm.auto import tqdm
from path import Path
from dataset.utils import fetch_datas... |
import numpy as np
import lightkurve as lk
import pandas as pd
import astropy.units as u
from tqdm import tqdm
import math
import glob
import matplotlib.pyplot as plt
import seaborn as sns
from astropy.io import ascii
from astropy.convolution import convolve, Box1DKernel
import corner
import matplotlib.gridspec as grid... |
#!/usr/bin/env python
"""
Map2KO
Genome library
Handle a KO search on a local machine (Blast-BBH) or online (KAAS)
"""
from Bio import SeqIO
from ductape.common.commonmultiprocess import CommonMultiProcess
from ductape.common.utils import slice_it
from ductape.genome.blast import Blaster, RunBBH
import sys
if sys.ver... |
#!/usr/bin/env python
# encoding: utf-8
"""\
Display sequences relevant to the sgRNA sensor project.
Usage:
sgrna_sensor [options] <names>...
Arguments:
<names>...
The name of one or more sequences to show. The name must correspond to
one of the functions in 'sgrna_sensor/design.py', which ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from flask_mistune import markdown
from quokka.core.db import db
from quokka.core.models.custom_values import HasCustomValue
from quokka.core.models.signature import (
Tagged, Publishable, LongSlugged, ContentFormat, TemplateType
)
from quokka.core.admi... |
import os
import time
import argparse
from datetime import datetime
import pdb
import math
import numpy as np
import pybullet as p
import pickle
import matplotlib.pyplot as plt
import gym
from gym import error, spaces, utils
from gym.utils import seeding
from gym.spaces import Box, Dict
import torch
import torch.nn as ... |
import pytest
import brownie
from operator import itemgetter
from brownie import interface, Contract, ZERO_ADDRESS
yfiVaultAddress = "0xE14d13d8B3b85aF791b2AADD661cDBd5E6097Db1"
yfiAddress = "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e"
usdcAddress = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
cyUsdcAddress = "0x76E... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Encoding required to deal with 'micro' character
"""
Create the _dicom_dict.py DICOM dictionary file from the Standard.
Reformat The DICOM dictionary PS3.6 and PS3.7 docbook xml files (from e.g.
standard docs) to Python syntax.
DicomDictionary
---------------
Write the ... |
__author__ = "<NAME>"
__copyright__ = "Copyright (C) 2022 appliedAIstudio LLC"
__version__ = "0.0.1"
# needed to make local variables behave like centralized ai_infrastructure
from ai_framework.singleton import Singleton
# needed for message queuing and validation
from jsonschema import validate, ValidationError
impo... |
########################################
# written for Python 3 #
# by <NAME> (<EMAIL>) #
########################################
'''
Module description...
kd, E, P = el.spaghetti(ax, bd, ct, El=(-2, 2), vbmRef=True)
******** still need to handle path break case, extremely short k-leg ca... |
#
# Copyright (c) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''programs.py: Contains methods for running GSLIB and CCG programs'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import absolut... |
import math
from pm4py.algo.conformance.alignments import algorithm as alignment_alg
from pyspark.sql import SparkSession, Row
from conformancechecking4spark import log_rdd, pnml_rdd
class DistributedAlignmentConfiguration:
"""
"""
def __init__(self, log_rdd, pm_rdd, log_slices, pm_slices, global_ti... |
import uuid
import random
import socket
import struct
import datetime
import time
def set_sourceIp():
sourceIp = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
# checking if 0.0.0.0 or 255.255.255.255. Still allows private IP addresses
if sourceIp == "0.0.0.0" or sourceIp == "255.255.2... |
import base64
import fnmatch
import os
import re
import time
from typing import Any, List, Optional, Tuple
from uuid import uuid4
import firebase_admin
import google.auth
import structlog
from data import create_data_objects, experience_object_to_row
from firebase_admin import credentials, firestore
from flask import ... |
import numpy as np
import copy
def decompose(X_raw, Y_raw, M_star):
"""
:param [in] X_raw: M-by-N matrix where each COL is a sample input
:param [in] Y_raw: L-by-N matrix where each COL is a sample output
:return (v, p, q, C_YY_history, C_XX_history)
"""
assert(X_raw.shape[1] == Y_raw.shape[1]... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 4 15:34:25 2020
@author: diego
"""
import pandas as pd
import os
import sqlite3
from pandas_datareader import DataReader
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from fuzzywuzzy import process
import update_db
pd.set_option('display.widt... |
import logging
import asyncio
import typing
import types
import json
import socket
import aiohttp
from .reports import Report
_lg = logging.getLogger("zergswarm")
async def _on_request_start(session: aiohttp.ClientSession, trace_config_ctx, params):
trace_config_ctx.start = asyncio.get_event_loop().time()
a... |
from coopihc.space.Space import Space
import numpy
import functools
import warnings
import gym
from coopihc.helpers import hard_flatten
def remove_prefix(text, prefix):
# from Python 3.9 use str.removeprefix() directly
# copied from https://stackoverflow.com/questions/16891340/remove-a-prefix-from-a-string
... |
import matplotlib.pyplot as plt
import h5py, argparse
import numpy as np
from matplotlib import cm
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
import matplotlib.colors as colors
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.ticker import MultipleLocator, FormatStrFormatt... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# <NAME>, September 2015
# Modified by <NAME>, 2015--2018
"""
Representation of text and annotations.
The hierarchy is fixed:
Collection
Article
Section
Sentence
Token (optional)
Matched entities are anchored at the sentence lev... |
import cmatrix as cmat
import qsim
from math import sqrt, cos, sin, pi
from cmath import exp
from copy import deepcopy
# bits
one = [[0],
[1]]
zero = [[1],
[0]]
# pauli operators
Sx = [[0, 1],
[1, 0]]
Sy = [[0, -1j],
[1j, 0]]
Sz = [[1, 0],
[0, -1]]
# S gate
... |
# coding: utf-8
import math
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from model import Encoder, Decoder, Seq2Seq
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
... |
# -*- encoding: utf-8 -*-
from pathlib import Path
from typing import List
from enum import IntEnum
from PyQt5.QtCore import Qt, QDir, QFileInfo
from PyQt5.QtWidgets import QLabel, QVBoxLayout, QWidget
import mobase
from ..basic_features.basic_save_game_info import (
BasicGameSaveGame,
BasicGameSaveGameInfo... |
import os
import platform
import time
import requests
import zipfile
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
macM1 = False
email = ''
password = ''
url = ''
# PROGRAM DON'T TOUCH PLEASE
links = []
def download_chromedriver():
if macM1:
url = 'https://chromed... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import random
import time
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import torch
import torchvision.transforms as T
from PIL import Image
import util.misc as utils
from models import build_model
t... |
import matplotlib.pyplot as plt
import numpy as np
import scipy.io as sio
from collections import namedtuple
from functools import partial
Model = namedtuple('SVMModelResult', ['X', 'y', 'kernelFunction', 'b', 'alphas', 'w'])
def svm_train(X, Y, C, kernelFunction, tol=0.001, max_passes=5):
m, n = X.s... |
# -*- coding: utf-8 -*-
import os
from common import globals as glob
import matplotlib.pyplot as plt
import numpy as np
from sklearn import linear_model
from sklearn.linear_model import Ridge
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import make_pipeline
from . import classification
im... |
"""
Title: io_helper.py
Author: <NAME>
Mail: <EMAIL>.tomko __at__ fmph.uniba.sk
"""
import gzip
import json
import numpy as np
import multiprocessing
import os
import pickle
def prepare_recording_vector(rec_vec, i):
"""
Prepares a recording vectors for saving.
Parameters
----------
rec_vec : neur... |
# -*- coding: utf-8 -*-
import re
import urllib
import subprocess
import time
import os
from mechanize import Browser
import bs4
import requests
import json
import utility
import string
# the interval time of British pronunciation and American pronunciation
pronunciation_interval = 0.7
basic_dict_file = os.path.join(... |
from flask import Flask
from flask import request
from flask import send_from_directory
import pyautogui
import matplotlib.pyplot as plt
import matplotlib
import requests
import shutil
import numpy as np
import cv2
import os
import math
import random
from datetime import datetime
import argparse
from keras.optimiz... |
# Additional comment, as a part of project(step b, section 3)
import time
import pandas as pd
import numpy as np
CITY_DATA = { 'chicago': 'chicago.csv',
'new york city': 'new_york_city.csv',
'washington': 'washington.csv' }
def get_filters():
"""
Asks user to specify a city, mont... |
import os
import subprocess
import numpy as np
import nibabel as nib
def nifty_reg_bspline(nifty_bin, nifty_reg_cmd, ref, flo, res=None, cpp=None, rmask=None, fmask=None, levels=None,aff= None):
"""
call bspline registration in niftyreg
:param nifty_bin: the path of niftyreg bin
:param nifty_reg_cmd:... |
#
# Copyright (C) 2014 The Regents of the University of California.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditi... |
##############################################################################
#
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and bin... |
import json
import pkg_resources
from celery.utils.log import get_task_logger
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.mail import EmailMessage, send_mail
from django.template.loader import render_to_string
from django.utils import timezone
from django.uti... |
import calendar
import datetime
import os
import subprocess
FIELDS = MINUTE, HOUR, DOM, MONTH, DOW = range(5)
MONTH_NAMES = 'jan feb mar apr may jun jul aug sep oct nov dec'.split()
DOW_NAMES = 'sun mon tue wed thu fri sat sun'.split()
MINUTE_INFO = 0, 59, None
HOUR_INFO = 0, 23, None
DOM_INFO = 1, 31, None
MONTH_I... |
hostname = 'localhost'
username = 'root'
password = '<PASSWORD>'
database = 'PRICEMODEL'
import os
import sys
import pymysql
from datetime import datetime
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
from statsmodels.tsa.stattools import acf, pacf
import statsmodels.tsa.stattool... |
"""
Low-level interfaces for sending and receiving SCSI command.
.. warning::
Uninformed usage of this library can result in data loss or even
physical destruction of devices. Use low-level commands at your own
risk, as they will not stop you from sending bad or harmful values.
"""
imp... |
import pytest
from pyepm import api
from helpers import COW_ADDRESS, config, mock_json_response
def test_api_exception_error_response(mocker):
instance = api.Api(config)
mocker.patch('requests.post', return_value=mock_json_response(error={'code': 31337, 'message': 'Too Elite'}))
with pytest.raises(api.Ap... |
import numpy as np
import sys
import os.path as op
from operator import add
import logging
from glob import glob
from .all_genes import all_genes as all_genes_default
from .paths import path_to_current_db_files
from functools import reduce
logger = logging.getLogger('tcr_rearrangement.py')
__all__ = ['get_alpha_tri... |
r"""Script to run train and eval for TF2.
For using the script run:
python object_detection/model_main_tf2_train_eval.py \
--model_dir PATH/TO/MODEL_DIR \
--pipeline_config_path PATH/TO/DIR/pipeline.config \
--num_train_steps <TRAIN_STEPS> \
--sample_1_of_n_eval_example... |
"""
ATOM representers.
This file is part of the everest project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on May 19, 2011.
"""
from everest.mime import AtomMime
from everest.mime import XmlMime
from everest.representers.base import MappingResourceRepresenter
from everest.re... |
# layout.py
# ---------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
... |
"""
Multiprocess tasks handling module
"""
import copy
import sys
import hashlib
import itertools
import multiprocessing as mp
from datetime import datetime
from multiprocessing import Manager
from time import gmtime, strftime, sleep, monotonic, perf_counter
from typing import Union, Dict, List, Tuple
import numpy a... |
# -*- coding: utf-8 -*-
# @Author: <NAME>, Design Research Lab, Universität der Künste Berlin
# @Date: 2016-10-18 11:30:39
# @Last Modified by: lutzer
# @Last Modified time: 2016-10-24 22:40:39
import pyglet
import sys
import logging
import random
from config import *
from utils.eventHandler import EventHandler
... |
# %%
import os
import glob
import sys
import cv2
# import pysptk
import torch
import numpy as np
import pandas as pd
# import librosa
import torchaudio
import matplotlib.pyplot as plt
import webrtcvad as wrtcvad
import speechbrain as sb
from pathlib import Path
from matplotlib import cm
from datetime import time, ti... |
# Copyright (c) 2016-2021 The Regents of the University of Michigan
# Part of fresnel, released under the BSD 3-Clause License.
"""Ray tracers process a `Scene` and render output images.
* `Preview` generates a quick approximate render.
* `Path` which provides soft shadows, reflections, and other effects.
See Also:
... |
#!/usr/bin/env python
#------------------------------------------------------------------------------
# plot_correlation_energy.py
#
# author: <NAME>
# version: 1.0.0
# date: Dec 6, 2016
#
# tested with Python v2.7
#
#------------------------------------------------------------------------------
import matp... |
import numpy as np
import scipy as sp
from scipy import ndimage
import matplotlib.pyplot as plt
from math import *
from cv2 import remap, INTER_LINEAR
# TODO instead of ret_cartesian use mode='polar' or cartesian
# https://github.com/scipy/scipy/blob/v0.19.1/scipy/signal/signaltools.py#L111-L269
# https://github.com/... |
from typing import List, Union
from collections import OrderedDict
import torch
from torch import nn, einsum
from einops import rearrange, repeat
from einops.layers.torch import Rearrange, Reduce
from comvex.utils import MBConvXd, MultiheadAttention, PathDropout, ProjectionHead
from comvex.utils.helpers import name_w... |
"""
Author: Darren
Date: 08/12/2021
Solving https://adventofcode.com/2021/day/8
0: 1: 2: 3: 4: 5: 6: 7: 8: 9:
aaaa .... aaaa aaaa .... aaaa aaaa aaaa aaaa aaaa
b c . c . c . c b c b . b . . c b c b c
b ... |
from numba import cuda, jit
import numpy as np
import math
from descriptools.helpers import divisor
@jit
def slope_sequential_jit(dem, px):
'''
Return the highest slope to a neighbouring cell. Sequential implementation
Parameters:
dem : Digital evelation model
px : Raster pixel dimen... |
"""
Trigger task with NI USB-6229 USB
"""
from __future__ import division
import ctypes
import numpy
nidaq = ctypes.windll.nicaiu # load the DLL
##############################
# Setup some typedefs and constants
# to correspond with values in
# C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDA... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import datetime
import time
import logging
import pandas as pd
import numpy as np
import os
from torch.optim.lr_scheduler import CosineAnnealingWarmRestarts
from tqdm import tqdm
class TimeTracker(object):
def __init__(self, length=100):
... |
"""
Tests for model training stage.
"""
from datetime import datetime
from subprocess import run
from unittest.mock import MagicMock, patch
from bodywork_pipeline_utils.aws import Dataset
from pandas import read_csv, DataFrame
from pytest import fixture, raises
from _pytest.logging import LogCaptureFixture
from sklear... |
# file: train_cnn.py
#
# A CNN implementation in TensorFlow
#
# First set the variable <dataset_root>
# It tells the Python script where your training and
# validation data is.
#
# Store your training images in a sub-folder for each
# class in <dataset_root>/train/
# e.g.
# <dataset_root>/train/bikes
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.