text stringlengths 3.07k 22.1k |
|---|
import os
import types
import torch
import contextlib
import numpy as np
import torch.nn as nn
from torchvision import models
from torchvision.transforms import functional as F
from alfred.gen import constants
from alfred.nn.transforms import Transforms
from alfred.utils import data_util
class Resnet18(nn.Module):
... |
import re
import sublime
from .view import MdeTextCommand
class MdeBaseUnIndentListItemCommand(MdeTextCommand):
"""
This is an interanal text command class shared by `(un)indent_list_item` commands.
It is responsible to read settings and cycle through all selections to replace text.
"""
def run... |
from typing import Callable, Dict, List, Tuple, Union
import pygame
import math
from pygame.locals import QUIT
import pygame_widgets
from pygame_widgets.slider import Slider
from pygame_widgets.textbox import TextBox
from pygame_widgets.button import Button
from .data_structures.global_attributes import GlobalAttribute... |
from common.metrics import *
from loda.loda import *
"""
Methods in this file are closely tied to LODA.
"""
class HistogramPDFs(object):
def __init__(self, hpdfs, nlls):
self.hpdfs = hpdfs
self.nlls = nlls
def get_hpdfs_for_samples(allsamples, w, hists):
samples_hpdfs = []
for i in ran... |
"""
This module containts helper functions to load data and get meta deta.
"""
import numpy as np
import pandas as pd
import logging
import yaml
import sys
from dfencoder.scalers import GaussRankScaler
from sklearn import preprocessing
def features_setting(data):
"""
:param data:
:type data:
:return:... |
import jyotisha
from jyotisha import custom_transliteration
from jyotisha.panchaanga.temporal import time, names
def get_lagna_data_str(daily_panchaanga, scripts, time_format):
jd = daily_panchaanga.julian_day_start
lagna_data_str = jyotisha.custom_transliteration.tr('lagnAni—', scripts[0])
for lagna_ID, lagna_... |
#!/usr/bin/env python
############################################################################
# Copyright (c) 2015 Saint Petersburg State University
# Copyright (c) 2011-2014 Saint Petersburg Academic University
# All Rights Reserved
# See file LICENSE for details.
################################################... |
# torch
import torch
import torch.nn.functional as F
from torch.nn import BatchNorm1d, Dropout, LeakyReLU, Linear, Module, ReLU, Sequential
import torch.nn as nn
from torch import optim
# torch geometric
from torch_geometric.datasets import BitcoinOTC, Planetoid
from torch_geometric.data import Data, InMemoryDataset, D... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
#!/usr/bin/env python3
"""
Tools for working with pint quantities.
"""
import functools
import itertools
import re
import pint
import pint.util as putil
from ..unit import ureg
from . import docstring
__all__ = ['while_quantified', 'while_dequantified']
# Regex to find terms surrounded by curly braces that can be f... |
"""
cutaway.py
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from math import floor
import logging
from PySide import QtGui
from mcedit2.rendering import worldscene
from mcedit2.rendering.scenegraph import scenenode
from mcedit2.util import profiler
from mcedit2.widgets.la... |
"""
==========================================
Author: <NAME>
Username: /u/tylerbrockett
Description: Alert Bot
==========================================
"""
from utils import inbox, times
from bot_modules.sleep_handler import SleepHandler
from bot_modules.database_handler import Database... |
#!/usr/bin/env python
# coding=utf-8
# Copyright [2019] [Apache Software Foundation]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
from keras.layers import Input, Dense, Conv2D, MaxPool2D, Flatten, Dropout, BatchNormalization, Activation, Add
from keras.optimizers import Adam
from keras.models import Model
from keras.callbacks import ModelCheckpoint, EarlyStopping
import keras
import matplotlib.pyp... |
###############################################################################
# PyDial: Multi-domain Statistical Spoken Dialogue System Software
###############################################################################
#
# Copyright 2015 - 2019
# Cambridge University Engineering Department Dialogue Systems Grou... |
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.contrib.auth.models import Group
from autoslug import AutoSlugField
# from ckeditor.fields import RichTextField
from ckeditor_up... |
"""Pytorch implementation of Losses and tools.
.. 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, including without lim... |
import geopandas
import logging
from discrete_kit.configuration import config
import os
import json
import glob
_log = logging.getLogger('discrete_kit.shape_functions')
# ToDo : After bug fixed need to calculate the classification
def calculate_classification(resoultion):
return ""
def shape_to_geojson(path):
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
A neural distant supervision model based on <NAME>.,
<NAME>., & <NAME>. (2016). Automatic Detection and Categorization
of Election-Related Tweets. Computation and Language; Information
Theory; Information Theory. Retrieved from
http://arxiv.org/abs/1605.05150.
"""
from... |
"""
Copyright (c) 2012, <NAME> (<EMAIL>)
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... |
""" A simple genetic algorithm for parameter search """
import random
from collections import OrderedDict
import numpy as np
from kernel_tuner.strategies.minimize import _cost_func
from kernel_tuner import util
def tune(runner, kernel_options, device_options, tuning_options):
""" Find the best performing kernel ... |
# coding: utf-8
#
from __future__ import absolute_import, print_function
import argparse
import hashlib
import logging
import os
import re
import shutil
import tarfile
import json
import humanize
import progress.bar
import requests
from logzero import logger
from retry import retry
import uiautomator2 as u2
from ui... |
import sqlalchemy
import pandas as pd
from utils import utils
def create_engine(db_config: dict, db_name: str = None, db_type: str = "postgres"):
"""Creates a sqlalchemy engine, with specified connection information
Arguments
---------
db_config: a dictionary with configurations for a resource
d... |
"""Fixers for .NET projects"""
import logging
import os
import os.path
from string import Template
from typing import Iterable, List
import instarepo.fixers.context
import instarepo.git
import instarepo.github
import instarepo.xml_utils
from .base import ensure_directories
from .finders import is_file_of_extension
fro... |
import pytest
import sympy
import numpy as np
import scipy.linalg as la
from .. import kwant_rmt
from ..hamiltonian_generator import continuum_hamiltonian, check_symmetry, \
bloch_family, make_basis_pretty, constrain_family, continuum_variables, \
continuum_pairing, remove_duplicates, subtract_family, displa... |
# The MIT License (MIT)
#
# Copyright (c) 2018 OGS
#
# 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... |
import os
import numpy as np
import cudf
import torch
from torch.utils.dlpack import from_dlpack
import torch.nn as nn
import torch.nn.functional as F
# An extension of torch Datasets for lazy loading msms data
# To do:
# - Profile the heck out of things
# - `labels` in `__getitem__()` is currently hard coded to use `... |
from itertools import chain
import re
import datetime
import time
from django import forms, VERSION
from django.conf import settings
from django.template import loader
from django.utils.encoding import force_unicode
from django.utils.translation import ugettext, ugettext_lazy
from django.utils import datetime_safe
fro... |
# -*- coding: utf-8 -*-
"""
Objects representing objects used with ProofreadPage Extensions.
This module includes objects:
* ProofreadPage(Page)
* FullHeader
"""
#
# (C) Pywikibot team, 2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__version__ = '$Id: 4b0f1d370c1... |
# -*- coding: utf-8 -*-
from config import D
import tensorflow as tf
import multiprocessing as mt
import os
import glob
import re
import math
import shutil
import numpy as np
import datetime as dt
from model.log_configure import logger
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import colors
from... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2022 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... |
import torch
import pytest
import random
from molbart.tokeniser import MolEncTokeniser
regex = "\[[^\]]+]|Br?|Cl?|N|O|S|P|F|I|b|c|n|o|s|p|\(|\)|\.|=|#|-|\+|\\\\|\/|:|~|@|\?|>|\*|\$|\%[0-9]{2}|[0-9]"
# Use dummy SMILES strings
smiles_data = [
"CCO.Ccc",
"CCClCCl",
"C(=O)CBr"
]
example_tokens = [
["^... |
from typing import Any
import json
import logging
import requests
from simple_salesforce import Salesforce as SimpleSalesforce
from simple_salesforce import SFType
from RPA.Tables import Table
class SalesforceAuthenticationError(Exception):
"Error when authenticated Salesforce instance does not exist."
clas... |
#!/usr/bin/env python3
#
# This file is part of the GROMACS molecular simulation package.
#
# Copyright 2014- The GROMACS Authors
# and the project initiators <NAME>, <NAME> and <NAME>.
# Consult the AUTHORS/COPYING files and https://www.gromacs.org for details.
#
# GROMACS is free software; you can redistribute it and... |
import asyncio
import re
import aiofiles
import httpx
from bs4.element import PageElement
from markdownify import MarkdownConverter
URL_ROOT = "https://www.gov.uk/guidance/the-highway-code/"
class CustomMarkdownConverter(MarkdownConverter):
def convert_figcaption(self, el: PageElement, text: str, convert_as_inl... |
import boto3
import json
import csv
import os
import numpy as np
import scipy as sp
import scipy.sparse as sparse
import scipy.sparse.linalg
import pandas as pd
import zipfile
from netCDF4 import Dataset
#import asyncio
#import matplotlib.pyplot as plt
# uses np-mpl-pd-gpd layer
# arn:aws:lambda:us-west-2:510343621499... |
#!/usr/bin/env python3
#
# This file is part of https://github.com/martinruenz/maskfusion
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... |
#!/usr/bin/python
import dill as pickle
import itertools
import pandas as pd
import numpy as np
from scoop import futures
from scipy.stats import ortho_group
import time
dt = 0.025
number_of_models = 10
simulation_length = 200
ap_time = 150
v_init = -90
# Input parameters
feature_names = ['NMDA','GABA','Delay']
# i... |
#!/usr/bin/env python
# coding=utf-8
"""
This script will aid in generating a test coverage report for PFASST++ including its examples.
A standard CPython 3.3 compatible Python interpreter with standard library support is required.
No additional modules.
Run it with argument `-h` for usage instructions.
.. moduleaut... |
#!/usr/bin/env python3
"""
(C) 2019 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
Wrappers for spaCy to JSON-NLP output format.
Licensed under the Apache License 2.0, see the file LICENSE for more details.
Brought to you by the NLP-Lab.org (https://nlp-lab.org/)!
"""
import functools
import re
import os
from col... |
from typing import List, Dict, Optional
from tabulate import tabulate
import shutil
import os
import logging
def generate_openlane_files(
projects,
interface_definitions: Dict[str, Dict[str, int]],
target_user_project_wrapper_path: Optional[str],
target_user_project_includes_path: Optional[str],
t... |
from torch.utils.data import Dataset, DataLoader
from tqdm import tqdm
from collections import defaultdict
from naturalproofs.tokenize_pairwise import replace_links
import torch
import numpy as np
import json
import transformers
class SequenceRetrievalDataset(Dataset):
def __init__(
self, data, xpad, ... |
# coding: utf-8
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# <NAME> <<EMAIL>>,
# <<EMAIL>>
#
# Distributed under the terms of the 3-clause BSD license.
# The full license is in the LICENSE file, distributed with this software.
#
# ... |
import json
from collections import Counter
import numpy as np
from sentence_retrieval.sent_tfidf import OnlineTfidfDocRanker
from utils import fever_db, check_sentences, text_clean
import config
import drqa_yixin.tokenizers
from drqa_yixin.tokenizers import CoreNLPTokenizer
from tqdm import tqdm
from utils import c_s... |
import matplotlib.pyplot as plt
import numpy as np
from numpy.random import uniform
from filterpy.monte_carlo import systematic_resample
from numpy.linalg import norm
from numpy.random import randn
import scipy.stats
from numpy.random import uniform
from numpy.random import seed
import math
import socket
import ... |
#!/usr/bin/env python3
import json
import re
from datetime import datetime
import requests
from settings import dateformat, data_path
import dataclean
import util, api_util
import db_views
# from db import Organisation, Account, Transaction
import jurisdictions, banks, organisations
laundromat_json_url = 'https:... |
"""
Here a proposal for the futur Sorter with class approach.
The main idea is to decompose all intermediate steps to get more
flexibility:
* setup the recording (traces, output folder, and so...)
* set parameters
* run the sorter (with futur possibility to make it in separate env/container)
* get the result (... |
import trend_analysis as ta
import logging
import numpy as np
import pwlf
from sets import Set
import time
import matplotlib.pyplot as plt
import statsmodels.api as sm
from scipy import stats
class line:
def __init__(self, slope, intercept):
self.slope = slope
self.intercept = intercept
class rec... |
#
# Copyright (c) 2016 Nutanix Inc. All rights reserved.
#
# Adapted from ABNF definition given DMTF DSP0004:2.5.0, Annex C.
#
# NB: PLY lex, yacc have specific requirements on docstring formatting.
# pylint: disable=line-too-long
#
import ply.lex
import ply.yacc
from curie.curie_error_pb2 import CurieError
from curi... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""Compone... |
from copy import deepcopy
import os
import sqlite3
import imp
imp.load_source("PostProcessDbUtils", os.path.join(os.path.dirname(os.path.realpath(__file__)), "post-process-db-utils.py"))
from PostProcessDbUtils import *
imp.load_source("PostProcessAggUtils", os.path.join(os.path.dirname(os.path.realpath(__file__)), "p... |
##
#Filter groups by distance
def filter_groups_by_dist(groups, seedGroups, minDist):
'''
groups is a dict
seedGroups is a dict/list
'''
grpKeys = []
if type(seedGroups) is list:
itr = enumerate(seedGroups)
else:
itr = seedGroups.iteritems()
for (i,k) in enumerate(groups.keys()):
#print (i)
g ... |
import math
import random
from typing import Dict, List, Literal, Tuple, Union
def print_n_whitespaces(n: int) -> None:
print(" " * n, end="")
def print_n_newlines(n: int) -> None:
for _ in range(n):
print()
def determine_player_kills(
bull_quality: int,
player_type: Literal["TOREAD", "PIC... |
#!/usr/bin/env python3
# Imports
from os.path import abspath
import bpy
from blendernc.core.update_ui import (
UpdateImage,
update_colormap_interface,
update_nodes,
)
from blendernc.get_utils import (
get_blendernc_nodetrees,
get_default_material,
get_node,
get_var,
)
from blendernc.messag... |
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch import optim
from torchvision import datasets, models
import torchvision
import numpy as np
import math
import argparse
from copy import deepcopy
import torchvision.transforms as transforms
import torch.nn.functional as F
## train: two l... |
# coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
"""
This module contains functions for parameter extraction.
"""
import math
import numpy as np
from skimage.io import imread
from skimage.feature import blob_log
from sklearn.neighbors import KDTree
from sklearn.cluster import KMeans
from scipy import optimize
from instapipeline import util, clus
def get_sigma_list... |
# Copyright 2020 VAST Data 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 b... |
import csv #import module csv
import os #import module OS
pilih_menu = '' #menyimpan isi pilih_menu
indeks_terakhir = 1 #menyimpan data nomor indeks global
nama_file_jadi = '' #menympan nama file yang digunakan
def pilihan(): #fungsi bernama pilihan yang akan menentukan penggunaan fungsi sesuai input user
if pili... |
import pexpect
from pexpect import pxssh
import re
import requests
from influxdb import InfluxDBClient
import time
from datetime import datetime
import io
from pprint import pprint
from elasticsearch import Elasticsearch
import os
import sys
from subprocess import check_output, STDOUT
import logging
from pyfiglet imp... |
# Core Pkg
import streamlit as st
import streamlit.components.v1 as stc
# EDA Pkgs
import pandas as pd
# Data Vis Pkgs
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use("Agg")
# Opening Files/Forensic MetaData Extraction
# For Images
from PIL import Image
import exifread
import... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from cap_eval.cider.cider import Cider
from cap_eval.meteor.meteor import Meteor
from cap_eval.bleu.bleu import Bleu
import framework.configbase
import framework.ops
import numpy as np
import json
class LabelSmoothingLoss(nn.Module):
... |
from unit.conv import *
from unit.deconv import *
from unit.NN import *
from unit.loss import *
from unit.pool import *
from fcn_config import *
# the following is some graph *(for example, fcn), the config file is *_config.py
def fcn_graph():
'''
:return: the graph like the FCN paper in
<... |
# Note: Unlike in traditional robot libraries, this docstring will end
# up in output from the libdoc task. For that to happen, it must be
# before the imports.
"""
The following page objects are automatically included when
importing the PageObject library. You should not directly import this
file.
"""
import re
fro... |
import asyncio
import datetime
from typing import Dict, Callable, Optional
from pyee import AsyncIOEventEmitter
from ..data.db.tables.base import HEARTBEAT_THRESHOLD
from ..data.refiner import TaskRefiner
from .notify import resource_list
# interval for how often to check heartbeats. Use the heartbeat_threshold from... |
# from https://github.com/buyizhiyou/NRVQA/blob/master/piqe.py
# high score has low quality
import numpy as np
import cv2
from scipy.special import gamma
def calculate_mscn(dis_image):
dis_image = dis_image.astype(np.float32) # 类型转换十分重要
ux = cv2.GaussianBlur(dis_image, (7, 7), 7/6)
ux_sq = ux*ux
sigm... |
"""
Copyright 2021 <NAME>.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distribut... |
#!/usr/bin/python3
# Copyright 2019 Adobe. All rights reserved.
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
import sklearn.kernel_approximation as kernel_approx
from sklearn.ensemble import RandomForestRegressor
import scipy.linalg as linalg
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import TensorDataset, DataLoader
import numpy as np
from tqdm import tqdm
def solve_least_squares(X... |
import argparse
import datetime
import glob
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
import time
import random
from collections import OrderedDict
from tqdm import tqdm
from pycocotools.coco import COCO
from utils import *
def get_filepaths(directory, extensions):
ret = [... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
CommandLine:
python -m wbia.scripts.rsync_wbiadb
python -m wbia.scripts.rsync_wbiadb --dryrun
"""
import logging
import utool as ut
(print, rrr, profile) = ut.inject2(__name__)
logger = logging.getLogger('wbia')
def sync_wbiadb(remote_uri, dbname, mode='pull'... |
import csv
import logging
import json
import utils
import math
import random
import uuid
from math import sin, cos, radians, atan2, sqrt
def iata_code_to_airport(airports):
iata_code_map = {}
for airport in airports:
iata_code_map[airport["iata_code"]] = airport
return iata_code_map
def calculat... |
import pdb
import torch
import torch.nn as nn
import torch.nn.functional as F
import random
from torch.autograd import Variable as Var
import numpy as np
###################################################################################################################
# You do not have to use any of the classes in ... |
import vaex
import numpy as np
from common import *
# def test_count_multiple_selections():
def test_sum(df, ds_trimmed):
df.select("x < 5")
np.testing.assert_array_almost_equal(df.sum("x", selection=None), np.nansum(ds_trimmed.data.x))
np.testing.assert_array_almost_equal(df.sum("x", selection=True), np.... |
import unittest
import os
import functools
import trollius as asyncio
from trollius import From, Return
import sys
sys.path.append('../../')
#sys.path.append('..')
os.environ['PYTHONASYNCIODEBUG'] = '1'
from yieldfrom_t.urllib3.connectionpool import (
connection_from_url,
HTTPConnection,
HTTPConnectionPo... |
import tkinter as tk
import re
from tkinter import messagebox
import urllib
from urllib.error import HTTPError
import numpy
import matplotlib.dates as mDates
import matplotlib.pyplot as mPyplot
import matplotlib.ticker as mTicker
import datetime
from matplotlib.finance import candlestick_ohlc
LARGE_FONT = ("Verdana",... |
from PyQt5.QtWidgets import (QMainWindow, QMenu,
QApplication, QColorDialog,
QFontDialog, QDialog,
QTableView, QVBoxLayout)
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon, QPalette, QFont
from PyQt5 import QtSql
import des... |
#!/usr/bin/env python
# Copyright (c) 2015, Palo Alto Networks
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" A... |
import json
import logging
import typing as tp
from argparse import ArgumentParser
from pathlib import Path
import numpy as np
from .calibrate import calibrate
from .read import MetadataV8, RawFibsemData
logger = logging.getLogger(__name__)
CMAP = "gray_r"
def get_array(
fpath,
channel: tp.Optional[int],
... |
#!/usr/bin/python
# srglib: routines for manipulating FML/MCP's .srg, .csv, and .exc files
# Not all of the tools use this library yet
import re, os, csv, sys, pprint
EXC_RE = re.compile(r"^([^.]+)\.([^(]+)(\([^=]+)=([^|]*)\|(.*)")
# Get map from full descriptive method name + signature -> list of descriptive para... |
import gin
import tensorflow as tf
from tensorflow.python.keras import Model
from tensorflow.python.keras.initializers import VarianceScaling
from tensorflow.python.keras.layers import (
Input, Concatenate, Dense, Embedding,
Conv2D, Flatten, Lambda,
ConvLSTM2D, Conv2DTranspose,
)
from tensorflow.python.kera... |
import numpy as np
import sys
entrada = sys.argv[1]
try:
arquivo = open(entrada,'r')#abre o arquivo
except:
print("Arquivo não encontrado!")
exit(0)
linhas = arquivo.readlines()#le as linhas do arquivo e coloca na variavel linha
arquivo.close()#fecha o arquivo
processos = []#vetor de processos
'''
A ent... |
#!/usr/local/bin/env python
# ==============================================================================
# MODULE DOCSTRING
# ==============================================================================
"""
Multistate Utilities
====================
Sampling Utilities for the YANK Multistate Package. A collecti... |
#!/usr/bin/env python
# coding: utf-8
# In[7]:
# write a python class that defines a Tree and add child
class TreeNode:
def __init__(self, data):
self.data = data
self.parent = None
self.children =[]
def add_child(self, child):
child.parent = self
self.children.a... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 2 16:39:25 2019
@author: Shane
"""
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import scipy
import scipy.stats as stats
import glob
import statsmodels.stats.api as sms
#import matplotlib for plotting
import matplotlib.pyplo... |
#!/usr/bin/env python
"""
Python script for building documentation.
To build the docs you must have all optional dependencies for pandas
installed. See the installation instructions for a list of these.
Usage
-----
$ python make.py clean
$ python make.py html
$ python make.py latex
"""
import importlib
im... |
import torch
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
import scipy.io.wavfile as wave
import librosa
import generate_masking_threshold as generate_mask
import model
import random
import time
window_size = 2048
length = 16384
initial_bound = 1000
batch_size = 1
lr_stage1... |
__author__ = "<NAME>, <EMAIL>; <NAME>, <EMAIL>"
import os
import sys
import math
import numpy as np
import tensorflow as tf
_FLOATX = tf.float32
def get_weight_variable(name, shape=None, initializer=tf.contrib.layers.xavier_initializer_conv2d()):
if shape is None:
return tf.get_variable(name)
else: ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\大学\毕业设计\Emotion_Recognition\FER_test.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 UnitedStack 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.or... |
#@author: <NAME>
import re
import sys
import os
#rules: the rules are already present in the axioms.ax file
axiom_file = 'axioms.ax'
#type of relationship
inclusion = "\"Inclusion\""
redirection = "\"Redirection\""
#files
tmp_problem_input = "problem_tmp.p"
problem_input_no_dupl = "problem_no_dupl.p"
problem_input =... |
from django.http import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, render
from .models import Website, WebsiteCall, Publication, WebsiteStatus, CuratedWebsite
from collections import Counter, namedtuple, defaultdict
from django.core import serializers
from django.core.paginator import Pa... |
from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
from io import BytesIO
import io
import traceback
import os
from uuid import UUID, uuid4
import sys
import datetime
import weakref
from .utils import (
read_u8,
read_u16le,
read_u32le,
write_u8,
... |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import gaussian_kde
plt.rcParams["font.family"] = "serif"
def reflect(samps, othersamps = None, reflect_cut = 0.2):
the_min = min(samps)
the_max = max(samps)
inds = np.where((samps < the_min*(1. - re... |
import numpy as np
import scipy as sp
from numpy import random as random
from scipy import linalg as alg
from scipy import optimize as sp_opt
class VBMF2(object):
"""V = BA^T + sigma*Z"""
def __init__(self, V):
#TODO args A,B are only for debug
super(VBMF2, self).__init__()
self.V = V
... |
import logging
import threading
import subprocess
import numpy as np
import cv2
USB_GSTREAMER = True
def add_camera_args(parser):
"""Add parser augument for camera options."""
parser.add_argument('--rtsp', dest='use_rtsp',
help='use IP CAM (remember to also set --uri)',
... |
from random import randint
from json import load as json_load
from src.items import Key
from src.settings import *
from os import path
class Character:
def __init__(self, game, x, y, character_type, statistics):
self.game = game
self.type = character_type
self.rect = pg.Rect(x, y, TILE_SIZ... |
from abc import ABC, abstractmethod
from datetime import timedelta, timezone
from enum import Enum
from functools import lru_cache
import logging
import numpy as np
from pyschism.domain import ModelDomain
from pyschism.forcing.tides.tides import Tides
from pyschism.param.param import Param
_logger = logging.getLogge... |
"""
lantz.drivers.tektronix.awg5014c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drivers for the AWG5014C using RAW SOCKETS
Authors: <NAME>
Date: 20/04/2016
"""
import ftplib as _ftp
import os as _os
import re as _re
import time as _t
import numpy as _np
from lantz.core import Action, Feat, MessageBasedDriver
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.