text stringlengths 6.04k 39.5k |
|---|
import base64
import os
from operator import itemgetter
import jwt
import datetime
from base64 import b64decode
import structlog
from passlib.context import CryptContext
from urllib.parse import urlencode, urlparse
from pyramid.authentication import (
BasicAuthAuthenticationPolicy as _BasicAuthAuthenticationPolicy... |
# coding=utf-8
from __future__ import unicode_literals
from decimal import InvalidOperation, Decimal
from api_x import db
from api_x.zyt.biz.commons import is_duplicated_notify
from api_x.zyt.biz.transaction.dba import get_tx_by_id
from api_x.zyt.vas.bookkeep import bookkeeping
from api_x.zyt.user_mapping import get_s... |
# author: dstamoulis
#
# This code extends codebase from the "MNasNet on TPU" GitHub repo:
# https://github.com/tensorflow/tpu/tree/master/models/official/mnasnet
#
# This project incorporates material from the project listed above, and it
# is accessible under their original license terms (Apache License 2.0)
# ======... |
#!/usr/bin/env python3
import os
import sys
import time
import csv
import argparse
import subprocess
import requests
import json
import shutil
import quo
wdir = os.getcwd()
cc = quo.Console()
quo.echo(f"[+]", fg="vgreen", bold=True, nl=False)
quo.echo(f" Checking Dependencies", fg="vcyan", nl=False)
quo.echo(f".",... |
"""This module defines magic IPython functions to run pyslave from the IPython shell."""
import time, os, logging, inspect, logging.handlers, sys, io
from collections import OrderedDict
import configparser
import traceback
import sys
from matplotlib.pyplot import figure
from IPython.core.magic import register_line_mag... |
import pycecream
import astropy_stark.myfake as mf
import astropy_stark.myedlum as eddington
import matplotlib.pylab as plt
import os
import numpy as np
import pickle
from matplotlib.backends.backend_pdf import PdfPages
import corner
import pandas as pd
import itertools
import multiprocessing as mp
class test_pc:
... |
import csv
import random
from concurrent.futures import ThreadPoolExecutor
from slack_sdk.web import SlackResponse
import slack_utils as su
import os
import boto3
from typing import List, Dict
from datetime import date
from datetime import datetime as dt
from os import path
from slack_sdk import WebClient
from botoco... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patheffects as mpe
import utils
from sklearn.metrics import precision_score, recall_score, roc_auc_score, label_ranking_average_precision_score
from sklearn.metrics import label_ranking_loss, confusion_matrix, average_precision_score, auc, precision... |
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import mrcnn.score_columns as sc
def intialize_results(dim, NUM_CLASSES, X, Y):
agg_hm_shape = (dim,dim,NUM_CLASSES)
results = {}
results['X'] = X
results['Y'] = Y
... |
"""Page processors for hs_core app."""
from dateutil import parser
from functools import partial, wraps
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.forms.models import formset_factory
from mezzanine.pages.page_processors import processor_for
from hs_core.models i... |
"""
Filename: plot_interhemispheric_heat_difference_timeseries.py
Author: <NAME>, <EMAIL>
Description: Plot ensemble interhemispheric difference timeseries
"""
# Import general Python modules
import sys, os, pdb, re
import argparse
import numpy
import iris
from iris.experimental.equalise_cubes import equa... |
# standard library imports
import os
import sys
# package imports
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
try:
import GPy
except:
print("Unable to import GPy, but only needed for RBF toy")
try:
import autograd.numpy as np
from autograd import grad, jacobian
except:
... |
import requests
import os
from datetime import date, datetime, timedelta as td
import matplotlib.dates as mdates
import pandas as pd
import numpy as np
import random
############ Data Munging ############
def time_dataframe_prep(df, start_date, end_date, start_date_column, end_date_column, category_column):
"""... |
import os, sys, time
sys.path.append(os.getcwd())
import torch
import torchvision
from torch import nn
from torch import autograd
from torch import optim
import torch.nn.functional as F
import time
import tflib as lib
import tflib.save_images
import tflib.mnist
import tflib.cifar10
import tflib.plot
#import tflib.in... |
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
import io
import os
from collections import defaultdict
from typing import List, Optional
import numpy as np
import torch
from mmcv.utils import ConfigDict
from segmentation_tasks.apis.segmentation.config_utils import remove_from_config
fr... |
from itertools import product
import skimage.morphology as morph
from skimage.filters import threshold_otsu
import scipy.ndimage as ndi
from scipy.stats import itemfreq
from skimage.color import label2rgb
import numpy as np
import cv2
import skfmm
def sigmoid(x):
return 1. / (1 + np.exp(-x))
def watershed_center... |
# -*- coding: utf-8 -*-
from builtins import float
from typing import Union, Tuple, List, Any, SupportsFloat
import numpy as np
import dill
import os
import struct
import warnings
from enum import Enum
import PIL.Image
import scipy.stats
from scipy import signal
class Band(Enum):
P = 'P'
L = 'L'
class ReadM... |
# -*- coding:utf-8 -*-
# Copyright 2018 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... |
"""Tests for template tags in the projectroles app"""
from importlib import import_module
import mistune
import uuid
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.test import override_settings, RequestFactory
from django.urls import reverse
from test_plus.test impo... |
from frasco import (Feature, action, Blueprint, View, render_template,\
current_context, command, hook, current_app, signal)
from frasco.utils import remove_yaml_frontmatter
from frasco.templating import get_template_source
import os
import json
import re
import hashlib
import uuid
import json
from ... |
#!/usr/bin/env python3
#
# File:
# pydocmk.py
#
# Usage:
# pydocmk.py [OPTIONS] [VAR=VAL [VAR=VAL...]] PYDOC_ROOT SETUP_PY
# pydocmk.py --help
#
# Description:
# Make python documentation for python [sub]package.
#
# /*! \file */
# /*! \cond RNMAKE_DOXY*/
import sys
import os
import time
import importlib
impor... |
# -*- 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 following conditions a... |
from meta_dataset import MetaBatch
import os
import json
import numpy as np
from utils import get_device_name
import torch
from torch.utils.data.dataset import TensorDataset
from transformers.data import DataProcessor, InputExample, InputFeatures
from transformers.data.processors.glue import glue_convert_examples_to_fe... |
import base64
import json
import logging
from datetime import datetime, timedelta, time
from hashlib import sha1
from operator import itemgetter
from random import choice, random
from timeit import default_timer as timer
from typing import Optional, Tuple
import requests
from pymongo.collection import Collection
from ... |
from flask import Flask, jsonify, request, send_file, render_template, Response, send_from_directory
from werkzeug import secure_filename
from ruamel import yaml
import logging
import logging.config
import opt_config
import opt_utils
import opt_trainer
import opt_advisor
import pandas as pd
import numpy as np
import... |
import torch
import numpy as np
from copy import deepcopy
from warnings import warn
#def read_vocabulary(file_path):
# with open(file_path) as fid:
# index2word = {
# index: line.split()[0]
# for index, line in enumerate(fid.readlines())
# }
# return index2word
# FONT_COLOROR... |
from __future__ import print_function, division
import sys
import os
import torch
import numpy as np
import random
import csv
import itertools
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
from torch.utils.data.sampler import Sampler
from pycocotools.coco import COCO
impo... |
import ustruct
from micropython import const
from microbit import sleep, i2c
# # Constants
# _COMMAND_BIT = 0x80
# _ENABLE = 0x00
# _ENABLE_AIEN = 0x10 # RGBC Interrupt Enable
# _ENABLE_WEN = 0x08 # Wait enable - Writing 1 activates the wait timer
# _ENABLE_AEN = 0x02 # RGBC Enable - Wri... |
import wx
import time
import threading
import cv2
import numpy as np
import time
from sakuvid import SakuVid, VidFile
import utils
class RenderThread(threading.Thread):
def __init__(self, func, fps=24.):
threading.Thread.__init__(self)
self.func = func
self._fps = fps
self._flag_st... |
#!/usr/bin/env python -tt
import unittest, sys, os
import operator
import time
d = os.path.dirname
pth = d(d(os.path.abspath(__file__)))
sys.path.insert(0, pth)
from pycond import pycond, state_get, dbg_get, OPS, COMB_OPS
from pycond import parse_cond, State as S
from pycond import run_all_ops_thru
keys = []
eq = ... |
# -*- coding: utf-8 -*-
# @Date : 2020/7/17
# @Author : mingming.xu
# @Email : <EMAIL>
# @File : tokenizers.py
import six
import unicodedata
import json
import re
_open_ = open
is_py2 = six.PY2
if not is_py2:
basestring = str
def convert_to_str(text, encoding='utf-8', errors='ignore'):
"""字符串转换为str格... |
from unittest import TestCase
import time
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from multiprocessing import cpu_count
from traits.testing.unittest_tools import UnittestTools
from app_common.encore.simple_async_job_manager import \
RAN_FAILED_STATUS, RESULT_KEY, RESULT_SUCCESSFUL_I... |
from atsim.potentials import potentialfunctions, potentialforms, num_deriv, plus, gradient
import pytest
import inspect
import math
import types
def testBuck():
r = 0.5
a = 1388.773
rho = 2.76
c = 175.0
potfunc = potentialforms.buck(a,rho,c)
pytest.approx(-10041.34343) == potfunc(r)
def testExponentia... |
# -*- coding: utf-8 -*-
"""
Simulate Back EMF Voltage for Toyota Prius Motor at different Speed
Pizza Model = only part of the model is simulated and results are extrapolated
Multiprocessing disabled = One instance of simulation is enabled as flux linkage
is constant wrt to speed
Author: <NAME>
"""
"""
Number of worke... |
"""
Copyright (c) 2006-2011, NIPY Developers
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the... |
"""
Interface for configuring and submitting jobs on a computing cluster.
Do not use this class directly. Instead use one of the implementations
that inherit from this class.
"""
import os
import sys
import random
import math
import logging
import time
from copy import deepcopy
from io import BytesIO
from datetime imp... |
import string
import random
import time
from flask import Flask, render_template, session, flash, redirect, url_for, g, request
from flask_bootstrap import Bootstrap
from flask.ext.wtf import FlaskForm
from flask.ext.login import LoginManager
from wtforms import StringField, SubmitField
from wtforms.validators import ... |
import os.path as osp
import os
import torch
import numpy as np
import pandas as pd
import math
from torch_geometric.data import Data
from torch_geometric.data import InMemoryDataset
import torch_geometric.transforms as T
from ..bin.BaseDataset import BaseDataset, ElectroNegativityDiff, Complete
from ..bin.Label2Idx i... |
# @file test_image_validation.py
# This contains unit tests for the image validation tool.
##
# Copyright (c) Microsoft Corporation
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
import unittest
import edk2toolext.image_validation as IV
class Section:
def __init__(self, name, characteristics=None):
s... |
import codecs
import os.path
from collections import OrderedDict
from datetime import date, timedelta
from io import StringIO
from tempfile import NamedTemporaryFile, TemporaryDirectory
from unittest.mock import Mock, patch
from dateutil.relativedelta import relativedelta
from django.conf import settings
from django.... |
#!/usr/bin/env python
import copy
from datetime import date, datetime, timedelta
from operator import attrgetter
from os import path
import re
import sys
from pybtex.database.input import bibtex as bibtex_in
from pybtex.database.output import bibtex as bibtex_out
# error/warning display helpers
def print_error(msg):... |
"""ADT proxy for ABAP Unit"""
import os
import re
import sys
from collections import defaultdict
from enum import Enum
from xml.sax.saxutils import escape, quoteattr
from itertools import islice
import sap
import sap.adt
import sap.adt.aunit
import sap.adt.objects
import sap.adt.cts
import sap.cli.core
import sap.ad... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 7 23:19:42 2021
@author: kylei
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import copy
import time
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import ... |
from nlingua.stemmers.base import BaseStemmer
from nlingua.constants import ENGLISH_STOPWORDS, GERMAN_STOPWORDS
class SnowballStemmer(BaseStemmer):
def __init__(self, language = 'en'):
self.language = language
self.VOWELS = {}
def _find_longest_suffix_of(self, s, suffixes):
su... |
import pygame
import cv2
import numpy as np
import sys
# MAIN CLASS
class drumsCV(object):
def __init__(self,width,height):
self.width = width
self.height = height
(self.startScreen, self.freePlay, self.openWindow) = (True, False, False)
def initAnimation(self):
pygame.init()
self.window... |
import pymortar
import pandas as pd
import pendulum
import toml
from flask import Flask
from flask import jsonify, send_from_directory
from flask import request
from flask import current_app
from flask import make_response
from flask import render_template
from collections import defaultdict
from functools import updat... |
import torch
import gpytorch.utils.fft as fft
import gpytorch.utils as utils
from . import bdsmm
def index_coef_to_sparse(index_matrix, value_matrix, row_length):
"""
Converts a sparse matrix stored densely in an index matrix and a value matrix
to a torch sparse matrix.
Args:
- index_matrix (M... |
import os
import json
import urllib3
from threading import Thread
import signal
import websocket
import time
#import zlib
from enum import IntEnum
from dataclasses import dataclass
#import io
import re
from simplediscord.utils import mylogger
# Discord opcodes
class Op_Code(IntEnum):
DISPATCH = 0
... |
#!/usr/bin/env python
'''
Cornell University ASTR 1102 Lab: Star Clusters and Galactic Nebulae
Original Java Applet by <NAME> et al.
Written by <NAME>
'''
import random
import glob
import matplotlib
matplotlib.use('TkAgg')
import numpy as np
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationT... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""CatSystem encryption utility
Provides the Blowfish cipher and MersenneTwister PRNG classes, functions for
V_CODE extraction, and data encryption used by CatSystem
"""
__version__ = '1.0.0'
__date__ = '2020-09-17'
__author__ = '<NAME>'
__all__ = ['MersenneTwister', 'mt... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
# Visualization code
def init_mpl(global_dpi,labelsize = 15.5,legendsize = 11.40, fontsize = 13,mat_settings = False): # 13
if mat_settings:
fontsize = 10
labelsize = 13
mpl.rcParams['figure.dpi']= global_dpi
mpl.rc(... |
import os
import io
from itertools import chain, groupby
from tempfile import NamedTemporaryFile
import pprint as pp
import numpy as np
import PIL.Image
from IPython.display import HTML, Image, display
import cv2
from tf.core.helpers import rangesFromList, specFromRanges, setFromSpec
PP = pp.PrettyPrinter(indent=2... |
#*----------------------------------------------------------------------------*
#* Copyright (C) 2021 Politecnico di Torino, Italy *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
import constants
from random import randint
import copy
import drawval
import entity as ec
class Tile:
def __init__(self,block_m,block_j,block_s,char,fg,bg,type,falloff_exp):
self.block_m = block_m
if block_s is None:
block_s = block_m
self.block_s = block_s
self.block_j = block_j
self.cha... |
# coding: utf-8
import os
import sys
import json
import threading
import traceback
import subprocess
import urllib2
import webbrowser
import sublime_plugin
import sublime
from floo import api
from floo import AgentConnection
from floo.listener import Listener
from floo import msg
from floo import shared as G
from flo... |
bl_info = {
"name": "MultiBrush Material Brush Painter",
"author": "<NAME>",
"blender": (2, 7, 7),
"location": "View3D - Texture Paint mode",
"description": "Paint all texture layers of materials simultaneously",
"category": "Image Paint",
}
import bpy
import mathutils
import math
import random... |
"""
Binding to `libsodium <https://libsodium.org/>`_ to use `Ristretto255 <https://ristretto.group/>`_ for group operations.
"""
from __future__ import annotations
import ctypes
import ctypes.util
import hmac
from dataclasses import dataclass
from fractions import Fraction
from os import environ
from secrets import r... |
"""Indigo - Project RADON version
Copyright 2019 University of Liverpool
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 l... |
"""
Classes used by Damage page.
"""
from tkinter import (StringVar, IntVar, OptionMenu, Button, ttk,
Checkbutton, VERTICAL, N, W)
from magus_kalkulator.sebzes import return_penalty
from magus_kalkulator.random_body import pick_sub_parts
from magus_kalkulator.validate import validate_integer, Fie... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 2 16:00:36 2019
@author: Stefan
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing import MinMaxScaler
from sklearn.ensemble import RandomForestRegressor
from ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 1 12:06:39 2019
@author: alankar
pressure-driven cooling flow in cylindrical, spherical geometry
12 Jan 2021: added magnetic fields
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from scipy.integrat... |
"""Classes used to represent features internally."""
import copy
import re
import six
from collections import OrderedDict
class _FeatureAttrsMixin:
"""
A mixin class designed to simplify the handling of attributes used
internally by `mensor` to manage the state of features used in
MeasureProvider sub... |
#!/usr/bin/env python3
### IMPORTS ###
import os
import sys
import shutil
import glob
import json
import time
import re
import uuid
from argparse import ArgumentParser
from PyPDF2 import PdfFileReader
sys.path.append("..") # Adds higher directory to python modules path.
# needs imagemagick, pdftk
__prog_name__ = "sy... |
'''Malis.py
==============
Utility functions for working with multiple multiple alignments.
'''
import os
import sys
import re
import random
import collections
import CGAT.Experiment as E
import CGAT.IOTools as IOTools
import CGAT.Intervals as Intervals
import CGAT.Mali as Mali
def addOptions(parser):
"""add o... |
"""
Perturbed free induction decay
==============================
Here we shortly derive the perturbed free induction decay using a simple model
and implement the analytic solutions. So first, what is the PFID? The PFID is a
coherent signal contribution arising in the mid-IR. It manifests as a signal
occurring for neg... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 12 12:35:01 2018
@author: abhijay
"""
import numpy as np
import pandas as pd
#import os
#import pickle
import copy
from sklearn import preprocessing
from sklearn import tree
#os.chdir('/home/abhijay/Documents/ML/hw_2/Q10')
class tree_node():
... |
import os
import subprocess
import json
import pickle
import argparse
import logging
import numpy as np
import torch
from pytorch_pretrained_bert import BertTokenizer, BertModel
from sklearn.model_selection import train_test_split
from torch.nn.init import xavier_uniform_
import numpy as np
import random
import torc... |
import itertools
import subprocess
import uuid
import insalata.builder.Builder
import os, sys
from insalata.Insalata import CONF_FILE
from insalata.model.DhcpService import DhcpService
from insalata.model.DnsService import DnsService
from insalata.model.Disk import Disk
from insalata.planning.FastDownwardParser import ... |
# -*- coding: utf-8 -*-
"""
hdf_sorter.py
@author <NAME>
<EMAIL>
Program Description:
Contains some useful methods for qualifier.py
These are all memory conservative sorting and normalizing functions using
pandas DataFrames - they all utilize chunking, and thus the performance is
slower, but the memory use is... |
import numpy as np
import time
import contextlib
import importlib
import typing
import os
import logging
import pyalign.io.alignment
from cached_property import cached_property
from functools import lru_cache
from pathlib import Path
from collections.abc import Sequence
from .gaps import GapCost, ConstantGapCost
from... |
import datetime
import os
import numpy as np
import torch
import torch.nn as nn
from pytorch_pretrained_bert import BertModel
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
from tqdm import tqdm
import torchvision.transforms as transforms
from arguments import init_config
from custom_incepti... |
# Copyright 2014 The Bazel 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 applicable la... |
#!/usr/bin/env python2
# coding: UTF-8
import rospy
import math
import sys,os
from consai2_msgs.msg import BallInfo, RobotInfo
from consai2_msgs.msg import ControlTarget
from geometry_msgs.msg import Pose2D
import tool
import normal
import offense
sys.path.append(os.pardir)
from field import Field
from observer imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Define the `Env` class which defines the world, states, and possible rewards. This is the main object
a policy interacts with.
Dependencies:
- `pyrobolearn.worlds`
- `pyrobolearn.states`
- `pyrobolearn.actions`
- (`pyrobolearn.rewards`)
- (`pyrobolearn.envs.terminal_con... |
import functools
import os
from pathlib import Path
from .. import FileBuilder
from .. import FileComparison
from .file_builder_test import FileBuilderTest
class MyDict(dict):
pass
class MyList(list):
pass
class MyTuple(tuple):
pass
class MyStr(str):
pass
class MyInt(int):
pass
class My... |
import matplotlib.pyplot as plt
import numpy as np
from scipy import optimize, signal
import csv
import cv2
import os
from astropy.io.fits import getheader
# =============== global variables ===============
# filenames for this session
SOLVEPHT_OUT = 'solvepht_11.out'
SOLVEPHT_IMG = 'solvepht_11.img'
SOLVEPHT_SIG = ... |
# SPDX-License-Identifier: MIT
"""
.. module:: impactgen
:platform: Windows
:synopsis: Main impactgen module which carries out scenario generation and
coordinating output creation.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import copy
import hashlib
import json
import logging as log
import random
... |
"""
Inspired by:
1. RLKit: https://github.com/rail-berkeley/rlkit [X]
2. StabelBaselines: https://github.com/hill-a/stable-baselines
3. SpinningUp OpenAI: https://github.com/openai/spinningup
4. CleanRL: https://github.com/vwxyzjn/cleanrl
"""
import os, subprocess, sys
import argparse
import importli... |
# -*- coding: utf-8 -*-
import re
from unidecode import unidecode
import Levenshtein
from brewerynamematcher import strip_punctuation
BEER_TYPES = [
u'American Pale Ale',
u'Abbey Brown Ale',
u'Barleywine',
u'Imperial Wheat Stout',
u'Imperial Coffee Stout',
u'Imperial Stout',
u'Imperial P... |
# system
from io import StringIO
from enum import Enum
from typing import List
from collections import defaultdict
from itertools import permutations, chain
# 3rd party
# internal
from .day import Day
"""
===============================================================================
Day 7 Puzzle 1
Based on the nav... |
"""Plate analysis."""
from contextlib import suppress
from functools import lru_cache
import matplotlib.pyplot as plt
from matplotlib import colors
import numpy as np
from scipy.signal import argrelmin, argrelmax
from . import conf, error, field, phyvars
from ._helpers import saveplot, list_of_vars
from ._step impor... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 ts=4 sts=4 sw=4 et tw=80 :
#
# Fetch Spitzer Heritage Archive data relevant to specified object.
#
# <NAME>
# Created: 2019-08-27
# Last modified: 2021-07-20
#--------------------------------------------------------------------------
#***************************... |
from datetime import datetime, timedelta
from dateutil import parser
from typing import Dict
from django.utils import timezone
from django.contrib.auth.decorators import login_required
from django.urls import reverse_lazy
from django.db.models import Q
from django.http import HttpRequest, HttpResponse, HttpResponseRedi... |
#
# Copyright 2018 National Renewable Energy Laboratory
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import torch
import numpy as np
import torch.nn.functional as F
from models.losses import FocalLoss, L1Loss, CrossLoss, SmoothL1Loss
from models.decode import ddd_decode
from models.utils import _s... |
# pylint: disable=too-many-lines
import os
import random
import sys
from collections import defaultdict
import filelock
import gevent
from gevent.event import AsyncResult, Event
from coincurve import PrivateKey
import structlog
from eth_utils import is_binary_address
from raiden.network.blockchain_service import Bloc... |
"""Module for homework 5. This is some of the crappiest code I've
written in recent memory. Oh well.
"""
import cmath
import numpy as np
from hw1 import implicit_trapezoidal_integration, newton
import pandas as pd
def get_dq_matrix(delta):
"""Given delta in radians, get the dq matrix which transforms from
the... |
# -*- coding: utf-8 -*-
import numpy as np
from .esat import svp
from ..fun.constants import eps
#
# common problem with missing values
#
np.seterr(invalid='ignore')
__all__ = ['sh2ppmv', 'sh2vap', 'vap2sh', 'ppmv2pa', 'rh2vap', 'rh2ppmv', 'dewpoint', 'frostpoint']
def vap2ppmv(e, p):
""" Convert water vapor pr... |
#%%
"""
Created on August 25 2021
The Heston Hull-White model used for pricing of European type of FX options using
the COS method and comparisons with the Monte Carlo simulation.
This code is purely educational and comes from "Financial Engineering" course by <NAME>
The course is based on the book “Mathematic... |
'''
Aggregate data from each Aagos run.
For each run, collect information from both phase 1 and 2 of evolution (last update for each)
Gene stats info (prepend 'pop_'):
- update,evo_phase,
- mean_neutral_sites,min_neutral_sites,max_neutral_sites,variance_neutral_sites,mean_single_gene_sites,min_single_gene_sites,max_si... |
import torch
import torch.nn as nn
from .dropout import VariationalNormalEpanechnikovDropout
from .activations import get_activation
from .utils import get_min_value
from ..models.config import AttentionType
class BertSelfAttention(nn.Module):
def __init__(self,
hidden_size,
num... |
"""
Copyright (c) 2019. Maskopy 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 agreed to in writing, s... |
import os
from random import shuffle
import numpy as np
import torch
import time
from carle.env import CARLE
from carle.mcl import CornerBonus, SpeedDetector, PufferDetector, AE2D, RND2D
from game_of_carle.agents.harli import HARLI
import bokeh
import bokeh.io as bio
from bokeh.io import output_notebook, show, curd... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import *
from torch.nn.utils.rnn import PackedSequence, pack_padded_sequence, pad_packed_sequence
from .BasicModel import ... |
import telebot
import binance
from kucoin.client import Client
import asyncio
from urllib.request import urlopen
import json
from requests import Request, Session
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
from operator import itemgetter
from telebot import types
import re
import configp... |
# This file is part of GridCal.
#
# GridCal is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GridCal is distributed in the hope that... |
"""Probabilistic autoregressive model."""
import logging
import numpy as np
import pandas as pd
import torch
from tqdm import tqdm
from deepecho.models.base import DeepEcho
LOGGER = logging.getLogger(__name__)
class PARNet(torch.nn.Module):
"""PARModel ANN model."""
def __init__(self, data_size, context_... |
#This file contains the additional functions to support training
import logging
import math
import numpy as np
from data_objects import HardwareObject, SAResult_Inflayer, SIMDResult_Inflayer
from layer_object import LayerObject
def common_SIMD_backward_model(Hardware_param, LayerObj, SIMDResult_inflayer):
# This... |
# !/usr/bin/env python
#============================ 导入所需的库 ===========================================
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Conv2D, Activation, MaxPool2D, Flatten, Dense,Dropout
# import cv2
import sys
import random
import numpy as np
... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author : HuJi <<EMAIL>>
# Datetime : 2021/12/20 3:41 下午
# User : huji
# Product : PyCharm
# Project : link
import logging
import os
import threading
from typing import Optional, Union, Dict, Collection
import _frida
import frida
from colorama import Fore
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.