text stringlengths 6.04k 39.5k |
|---|
#!/usr/bin/env python
# This document is part of CrowdProjects
# https://github.com/skytruth/CrowdProjects
# =========================================================================== #
#
# Copyright (c) 2014, SkyTruth
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without... |
from lxml import etree as ET
import os, shutil
import logging
import tempfile
import git
from . import static, utils
from . import build as builder
from .static.pretext import pretext as core
from pathlib import Path
log = logging.getLogger('ptxlogger')
class Target():
def __init__(self,
xml_elem... |
import sys
import os
import getpass
import grp
import traceback
import pudb
from SSHAgent import SSHAgent
from Tools import Tools
from RedisTools import RedisTools
from LogHandler import LogHandler
from BaseInstaller import BaseInstaller
from OSXInstaller import OSXInstaller
from UbuntuInstaller import UbuntuInstaller... |
import operator
from types import MethodType
from collections import UserList
import copy
import numpy as np
from refnx._lib import flatten, unique as f_unique
from refnx.analysis import Interval, PDF, Bounds
# Functions for making Functors
def MAKE_BINARY(opfn):
return lambda self, other: (_BinaryOp(self, asMa... |
#!/usr/bin/env python3
# Internal Libraries
import os
import sys
import tempfile
# Included Libraries
import auto_editor
import auto_editor.vanparse as vanparse
import auto_editor.utils.func as usefulfunctions
from auto_editor.utils.progressbar import ProgressBar
from auto_editor.utils.log import Log, Timer
from aut... |
from django.shortcuts import render, redirect
from django.http import HttpResponse, JsonResponse
import numpy as np
import pandas as pd
import matplotlib.colors as colors
import matplotlib.pyplot as plt
import scipy
from scipy.interpolate import griddata
from geopandas import GeoDataFrame
from shapely.geometry import P... |
# Provisions Custom Config Rule for CloudKnox PCI
# - Invokes CloudKnox REST APIs for authenticate and Identity Usage
# - Retrieves CloudKnox Credentials from Secrets Manager
# - Implements 'EvaluateCompliance' to return Non Compliant IAM Users (users with High CloudKnox
# 'Privilege Creep Index')
# @kmmahaj
#
# ... |
"""molting main."""
import argparse
import re
import sys
from datetime import datetime
from functools import partial
from pathlib import Path
from subprocess import CalledProcessError, run
from typing import List
from loguru import logger
RE_REPOSITORY = re.compile(
r'^repository = (["\'])(?P<repository>.*)(["\']... |
# Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... |
__all__ = ["FileInfo", "VersionInfo"]
_version_root = "storage/version"
_fileinfo_root = "storage/file"
_file_root = "storage/file"
class VersionInfo:
"""This class holds specific info about a version of a file"""
def __init__(
self,
filesize=None,
checksum=None,
aclrules=N... |
import logging
from pathlib import Path
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
from datasets import EpicVideoDataset
... |
# Copyright (c) 2006-2009 <NAME> http://garnaat.org/
#
# 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, mer... |
from xml_reflection.basics import *
import xml_reflection as xmlr
# Add a 'namespace' for names so that things don't conflict between URDF and SDF?
# A type registry? How to scope that? Just make a 'global' type pointer?
# Or just qualify names? urdf.geometric, sdf.geometric
xmlr.start_namespace('urdf')
xmlr.add_typ... |
import os
import weakref
import numpy as np
from yt.data_objects.index_subobjects.grid_patch import AMRGridPatch
from yt.data_objects.static_output import Dataset, ParticleFile, validate_index_order
from yt.funcs import mylog, setdefaultattr
from yt.geometry.grid_geometry_handler import GridIndex
from yt.geometry.par... |
# -*- coding: utf-8 -*-
from dbmodel.utils.singleton import Singleton
import re
"""
inflector.py
Created by Jonathan on 2011-07-13.
Copyright (c) 2011 Visure. All rights reserved.
"""
class Base:
'''Locale inflectors must inherit from this base class inorder to provide
the basic Inflector fu... |
#! /usr/bin/env python
# coding=utf-8
#================================================================
# Copyright (C) 2019 * Ltd. All rights reserved.
#
# Editor : VIM
# File name : utils.py
# Author : YunYang1994
# Created date: 2020-02-21 01:18:15
# Description :
#
#=========================... |
# -*- coding: utf-8 -*-
"""
@file
@brief Quelques constructions classiques pour éviter de recoder des variantes d'algorithmes.
classiques.
"""
from functools import reduce
def recherche(li, c):
"""
Retourne l'index d'un élément ou -1 si non trouvé.
@param li liste
@param c éléme... |
#!/usr/bin/python
# Copyright (C) 2015 LogicMonitor
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['previ... |
#
# CatalogsBase.py -- Catalogs plugin for Ginga fits viewer
#
# <NAME> (<EMAIL>)
#
# Copyright (c) <NAME>. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import os
import math
import numpy
from ginga.misc import Bunch
from ginga impo... |
# -*- coding: utf-8 -*-
# This work is part of the Core Imaging Library (CIL) developed by CCPi
# (Collaborative Computational Project in Tomographic Imaging), with
# substantial contributions by UKRI-STFC and University of Manchester.
# Licensed under the Apache License, Version 2.0 (the "License");
# you... |
import pygame
import sys
import random
import time
class Snake():
def __init__(self):
self.position = [100,50]
self.body=[[100,50],[90,50],[80,50]]
self.direction="RIGHT"
self.changeDirectonTo = self.direction
def changeDirTo(self,dir):
if dir=="RIGHT" and not self.dire... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
[path]
/Users/brunoflaven/Documents/01_work/blog_articles/extending_streamlit_usage/005_other_nlp_attempts/
[file]
python example_text_classification_6.py
"""
## SOURCE :: https://towardsdatascience.com/text-analysis-feature-engineering-with-nlp-502d6ea9225d
## SOURCE :... |
# Copyright 2021 The T5 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
"""Unit test the POTCAR AiiDA data structures."""
# pylint: disable=unused-import,unused-argument,redefined-outer-name
import tarfile
import subprocess as sp
from pathlib import Path
import pytest
from pymatgen.io.vasp import PotcarSingle
from aiida.common.exceptions import UniquenessError, NotExistent
from aiida_vas... |
import email, smtplib, ssl
import sys
import pandas as pd
import numpy as np
import os
import time
import csv
import shutil
from datetime import datetime
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from ... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
import mufa_constants as mc
import mufadisplay as mdisplay
import mufadb as db
import discord
import math
def copyItem(item_list, id_of_item_to_grab, character_to_give):
character_to_give.inventory.append(db.Item.objects.get(item_id =item_list[id_of_item_to_grab].item_id))
return character_to_give
def storeIt... |
from .base import AlgoBase
from .torch.bcq_impl import BCQImpl, DiscreteBCQImpl
from ..optimizers import AdamFactory
from ..argument_utils import check_encoder, check_use_gpu, check_augmentation
class BCQ(AlgoBase):
""" Batch-Constrained Q-learning algorithm.
BCQ is the very first practical data-driven deep ... |
# -*- coding: utf-8 -*-
# flake8: NOQA W605
"""Helper methods and mixins.
libtmux.common
~~~~~~~~~~~~~~
"""
import collections
import logging
import os
import re
import subprocess
import sys
from distutils.version import LooseVersion
from . import exc
from ._compat import MutableMapping, console_to_str, str_from_con... |
#!/usr/bin/env python
# encoding: utf-8
'''
genRSS -- generate a RSS 2 feed from media files in a directory.
@author: <NAME>
@copyright: 2014-2017 <NAME>
@license: MIT
@contact: amine.sehili <AT> gmail.com
@deffield updated: April 8th 2017
'''
import sys
import os
import glob
import fnmatch
import time
... |
# ------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# -------------------------------------------------------------------... |
import argparse
import json
import os
import sys
import io
import faulthandler
# used for debugging to time steps
from datetime import datetime
# to run the solution files we're using a timing based approach
import signal
import numpy as np
# for capturing the stdout
from io import StringIO
from typing import get_... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 23 15:09:02 2019
This code can be used to assess the spatial resolution of SEM images (and
potentially also for STEM, HAADF STEM, TEM, and optical images), using a
Fourier based algorithm. The procedure used in the script is described
in detail in the paper: "Assessing R... |
"""
This is a boilerplate pipeline 'data_preprocessing'
generated using Kedro 0.17.7
"""
from lxml import etree
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from statsmodels.stats import inter_rater as ir
import nltk
import numpy as np
import pandas as... |
from __future__ import print_function
from __future__ import division
import sys
import math
import numpy as np
from scipy.ndimage.filters import gaussian_filter1d
from time import time
from base_classes import *
import pyaudio
import config
import dsp
SPECTRUM_PIXELS = 64
# variants (visualization)
# 0 = spectrum... |
# Copyright [2020] [Toyota Research Institute]
#
# 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 agre... |
from __future__ import division
import numpy as np
from neupy import init
from neupy.utils import format_data
from neupy.exceptions import NotTrained
from neupy.algorithms.base import BaseNetwork
from neupy.core.properties import (IntProperty, Property, TypedListProperty,
NumberProp... |
import datetime
import pytest
from django.test.utils import override_settings
from django.urls import reverse
from parler.utils.context import switch_language
from guardian.shortcuts import assign_perm
from resources.tests.utils import assert_response_objects, check_disallowed_methods, check_keys
from resources.models ... |
import tkinter as tk
import tkinter.font as tkFont
import tkinter.ttk as ttk
import tkinter.messagebox as tkMessageBox
import pymysql.cursors
## Model Class ###############################################################
class Model:
"""
Right now the only options for variables in the url are:
{domain}
... |
"""This script is for preprocessing HMDB51 dataset.
"""
import argparse
import sys
import os
import os.path as osp
import glob
import fnmatch
import random
from pipes import quote
from multiprocessing import Pool, current_process
def dump_frames(vid_item):
from gluoncv.utils.filesystem import try_import_mmcv
... |
import pandas as pd
import numpy as np
from scipy.integrate import odeint
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_absolute_error, mean_squared_error
def logistic_R0(t, R_0_start, k, x0, R_0_end):
"""
R0 moduled as logistic function
"""
return (R_0_start - R... |
import os
import json
import numpy as np
import pandas as pd
import FeaturesStack as FS
def calculate_gmdh_model(img_f):
if task_type == "1":
if sensor_type == "convex":
prob = (
-0.946477
+ img_f["std_vert"] * np.cbrt(img_f["P95(1)_vert"]) * 0.01712... |
"""Module for using the Raspberry Pi Pico in the course NB2211 Electronic Instrumentation
By: <NAME> & <NAME>
"""
# ___ __ .______ ___ ______ ___
# / \ | | | _ \ / \ / | / \
# / ^ \ | | | |_) | / ^ \ | ,----' / ^ \
# / ... |
import argparse
import json
import math
import os
import pprint
import string
from collections import Counter
from math import floor
import numpy as np
from tqdm import tqdm
import utils
def preprocess_object_labels(data, alias_dict={}):
for img in data:
for obj in img["objects"]:
obj["ids"]... |
#!/usr/bin/env python3
'''
A driver script for CCA/EBT container image
Copyright 2013-2018 RIKEN
Copyright 2018-2020 Chiba Institute of Technology
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 ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache Lice... |
import numpy as np
import warnings
import torch
from sklearn.metrics import balanced_accuracy_score, accuracy_score
from sklearn.metrics import cohen_kappa_score, mean_squared_error, roc_auc_score, average_precision_score
from collagen.core import Callback
from collagen.core.utils import to_cpu
__all__ = ["AccuracyMe... |
import numpy as np
import vrep
import cv2
import time
import sys
import torch
from torch.utils.data import Dataset, DataLoader
from torchvision.transforms import transforms
from PIL import Image
import torch.nn as nn
from skimage.measure import compare_ssim as ssim
#import sim
from tensorboardX import Summa... |
from matplotlib import pyplot as plt
import numpy as np
import math
import random
import matplotlib.ticker as plticker
from PIL import Image
from PIL import ImageColor
from PIL import ImageOps
import pickle
import pandas
with open('guitarShape.pkl','rb') as inFile:
guitarShape = pickle.load(inFile)
... |
import collections
import operator
from Bio.Seq import Seq
VariantEffect = collections.namedtuple(
"VariantEffect",
(
"effect",
"impact",
"chrom",
"pos",
"ref",
"alt",
"vlen",
"ref_start",
"ref_stop",
"strand",
"ref_codon"... |
import math
from typing import List, Dict
import torch
from torch import nn
from torch.nn import functional as F
from detectron2.modeling.backbone import build_backbone
from detectron2.layers import ShapeSpec, NaiveSyncBatchNorm
from detectron2.modeling.meta_arch.build import META_ARCH_REGISTRY
from detectron2.structu... |
import cv2
import numpy as np
import geolocation
import backend
import math
import PIL.ImageOps
# all rectangles are parallel to the xy axis
class Rectangle:
current_id = 0
# do rectangles try to merge with neighboring rectangles?
merge_mode = False
# list of all rectangles in existence
all_rect... |
from ..core.trajectorydataframe import *
from RADGIS.preprocessing import clustering
from ..utils import constants
import pandas as pd
import numpy as np
from collections import namedtuple
from datetime import datetime
"""
Co-occurence
------------------------
This module completes the crucial task of co-occurence -... |
#!/usr/bin/env python3
##
## wgcore.py
##
# Handle basic operations of loading and saving YAML files.
# Basic Objects for managing site-specific and location specific settings.
import os
import re
import sys
import ast
import click
import base64
import loguru
import ifaddr
import pprint
import socket
import ipaddress... |
import pandas as pd
from datetime import datetime, timedelta, time
from transx2gtfs.calendar import get_weekday_info, get_service_operative_days_info
from transx2gtfs.calendar_dates import get_calendar_dates_exceptions, get_service_calendar_dates_exceptions
from transx2gtfs.stop_times import generate_service_id, get_di... |
import io
import json
import os
from typing import DefaultDict
import pandas as pd
from veneer.actions import get_big_data_source
import veneer
from string import Template
import logging
logger = logging.getLogger(__name__)
def _BEFORE_BATCH_NOP(slf,x,y):
pass
STANDARD_SOURCE_ELEMENTS=[
'Downstream Flow Volum... |
import ast
import json
import os
import unittest
from datetime import datetime, timezone, date
from decimal import Decimal
import boto3
from dotenv import load_dotenv
from data_api_mapper.appsync import AppsyncEvent, CamelSnakeConverter
from data_api_mapper.converters import TimestampzToDatetimeUTC
from data_api_mapp... |
# -*- coding: utf-8 -*-
"""Code to read in data files from Bio-Logic instruments"""
# created by <NAME>
# downloaded from
# https://github.com/chatcannon/galvani/blob/master/galvani/BioLogic.py
import sys
import re
import csv
from os import SEEK_SET
import time
from datetime import date, datetime, timedelta
from c... |
from ....universal import (
get_number_and_suffix,
time_suffix_to_scientic_str,
scientific_notation,
frequency_suffix_to_scientific_str,
scientific_str_to_time_suffix,
voltage_suffix_to_scientic_str,
)
import time
import numpy as np
__all__ = (
"get_R_theta",
"set_harmonic",
"set_ti... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import random
import numpy as np
from keras import backend as K
from keras.preprocessing.image import ImageDataGenerator, Iterator, img_to_array
import h5py
try:
from PIL import Image as pil_image
except ImportError:
pil_image = None
if pil_image is not None:
_PIL_INTERPO... |
from .base import Integrator
import numpy as np
import time
import hashlib
def extend_dim(array, size, axis=0, value=0.0):
target_shape = list(array.shape)
target_shape[axis] = size
extented_array = np.ones(target_shape, dtype=array.dtype)*value
return np.concatenate([array, extented_array], axis=axis... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Custom frame class to support memmapping."""
# Important: We reimplemented and renamed astropy's frame to better
# handle disk memmap and an easier unit/uncertainty workflow
import os
import numpy as np
import copy as cp
from tempfile import mkdtemp, ... |
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
import datetime as dt
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import h5py
import scipy
from astropy.time import Time
from icepyx import icesat2data as ipd
def getATL03(f,beam):
# height of each received phot... |
from copy import copy
from typing import Callable, Dict, Iterable, List, Tuple, cast
import aesara
import aesara.tensor as at
import numpy as np
from aesara.graph.basic import Variable
from aesara.graph.fg import FunctionGraph
from aesara.graph.op import compute_test_value
from aesara.graph.opt import local_optimizer,... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 shmilee
'''
Contains multiprocess processor class.
'''
import os
import multiprocessing
from .processor import Processor, plog
from ._mp_rwlock import MP_RWLock
from ..glogger import LogWorkInitializer
from ..loaders import get_pckloader
from ..utils import inherit_... |
import torch
import torch.nn as nn
from .embeddings import *
from .softmax import *
from .initializer import *
from .layers import *
class Att_Base(nn.Module):
def __init__(self, hidden_dim:int, n_head:int, head_dim:int,
dropout_rate:float, dropatt_rate:float=0.0, pre_lnorm=False):
super(... |
import time
import os
import os.path as path
import sys
import yaml
import json
import numpy as np
from getting_data import load_sample
try:
from ranker_helper import get_scores
except ModuleNotFoundError as e:
print(f's2search_score_pdp', e)
model_dir = './s2search_data'
data_dir = str(path.join(os.getcwd(), 'pip... |
#!/usr/bin/env python
import torch
import numpy as np
from torch import nn
from torch import optim
from torch.utils.data import DataLoader
from torch.utils.data.dataset import TensorDataset
class Dataset(TensorDataset):
'Characterizes a dataset for PyTorch'
def __init__(self, cat_all=None, con_all=None, con_shap... |
import os
import sys
import shutil
from gpiozero import LED, Button
import time
from datetime import datetime
import threading
from transitions import Machine, State
import soundfile as sf
import sounddevice as sd
import numpy as np
import daemons
import logging
from tempfile import gettempprefix
from copy import deepc... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 30 16:40:47 2019
@author: aimachine
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 30 14:38:04 2019
@author: aimachine
"""
import numpy as np
import os
#from IPython.display import clear_output
from stardist.models impo... |
# This is fourth rewrite of the MiniTeX that I wrote 4 years ago.
# There's a blogpost about that one in my blog.
class Box(object):
def __init__(self, width, height, depth, paint=None):
self.paint = paint
self.width = width
self.height = height
self.depth = depth
self.shift... |
from aguaclara.research.procoda_parser import *
from aguaclara.core.units import u
import aguaclara.core.utility as ut
import pandas as pd
import numpy as np
from scipy import special
from scipy.optimize import curve_fit
import collections
# Carbonates
# The following code defines the carbonate system and provides fu... |
"""The data structure for the factor is referenced from Prof. <NAME>'s coursera course "Probabilistic Graphical Models"
"""
import numpy as np
def ismember(a, b):
bind = {}
for index, value in enumerate(b):
if value not in bind:
bind[value] = index
return [bind.get(value, None) for va... |
# Copyright (c) 2016 Dell Inc. or its subsidiaries.
# 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 requi... |
import json
import numpy as np
from skimage.draw import circle
import matplotlib.pyplot as plt
import random
from math import sqrt, ceil
import argparse
from copy import deepcopy
from collections import deque
from math import pi
class Sprinkler:
"""
Definition of the prinkler
center :param: tuple coordina... |
import json
import copy
from sklearn.tree._tree import TREE_LEAF
from math import sqrt
import numpy as np
import math
def rules(clf, features, node_index=0):
"""Structure of rules in a fit decision tree classifier
Parameters
----------
clf : DecisionTreeClassifier
A tree that has already been ... |
from __future__ import absolute_import, division, print_function
import pytest
import platform
pymongo = pytest.importorskip('pymongo')
from datetime import datetime
from toolz import pluck, reduceby, groupby
from datashape import Record
from blaze import into, compute, compute_up, discover, dshape, data
from blaze... |
from dataclasses import dataclass
from typing import Any, List, Optional, cast
import pytest
from types_linq import Enumerable, InvalidOperationError
from types_linq.more import MoreEnumerable
@dataclass
class Tree:
val: int
left: 'Optional[Tree]' = None
right: 'Optional[Tree]' = None
class TestAsMore... |
"""
interface for classes (network, runner, dataset, method, cells, ...) to define + parse their args via argparse
"""
import os
import json
from typing import Union
from collections import defaultdict
from argparse import ArgumentParser, Namespace
from uninas.utils.paths import standard_paths, replace_standard_paths
... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
import os
import glob
import numpy as np
from monty.json import jsanitize
from monty.json import MSONable
scipy_old_piecewisepolynomial = True
try:
from s... |
import numpy as np
import sys
import pandas as pd
sys.path.append("..")
from misc.utils import to_labels
from tqdm import tqdm
tqdm.pandas()
from predictors.markov import MarkovChain
from sklearn.model_selection import TimeSeriesSplit
import itertools
from sklearn.metrics import accuracy_score, confusion_matrix
from ... |
import json
import os
from typing import List, Sequence, Tuple, Union, cast
import pytest
from ethereum.frontier import rlp
from ethereum.frontier.eth_types import U256, Bytes, Uint
from ethereum.frontier.rlp import RLP
from ethereum.utils import hex_to_bytes
#
# Tests for RLP encode
#
#
# Testing bytes encoding
#
... |
#!/usr/bin/env python
"""``analyze_agreement.py`` is a script that analyzes the agreement between two
annotations of the same file. The script measures:
* Object counts: are they the same?
* Object assignment: given the least-squares mapping of objects
onto each other, to what extent do they differ?
For an overview... |
#! /usr/bin/env python3
"""Read and write ImageJ Roi files.
For file syntax, see:
https://github.com/imagej/imagej1/blob/master/ij/io/RoiDecoder.java
"""
import codecs
from contextlib import ExitStack
from collections import OrderedDict
import os
import struct
import zipfile as zf
import numpy as np
# Constants
TARGET... |
"""The GraphUpdate layer and its pieces."""
import sys
from typing import Any, Callable, Mapping, Optional, Sequence
import tensorflow as tf
from tensorflow_gnn.graph import graph_constants as const
from tensorflow_gnn.graph import graph_tensor as gt
from tensorflow_gnn.graph import graph_tensor_ops as ops
from tens... |
"""
From raw fastq to over-represented read filtered fastq files.
This script does error correction with Rcorrector,
filters the unfixable reads after Rcorrector,
remove adapter and low quality sequences with Trimmomatic,
filter organelle reads (cp, mt or both) with Bowtie2
runs FastQC to ckeck quality and detect over-... |
# -*- coding: utf-8 -*-
"""
SOD 333 : filtrage bayésian
@author: <NAME>
<NAME>
<NAME>
"""
# Import des bibliothéques
import numpy as np # calcul numerique
import numpy.random as rnd # fonctions pseudo-aleatoires
import matplotlib.pyplot as plt # fonctions graphiques a la MATLAB
import ma... |
import tensorflow as tf
import pickle as pkl
import numpy as np
from sklearn.tree import DecisionTreeRegressor
from multiprocessing import Pool
import lightgbm as lgb
class BaseModel(object):
def __init__(self, eb_dim, feature_size, itm_spar_fnum, itm_dens_fnum, user_fnum, num_item):
# reset graph
... |
""" This module contains various implementations of trajectory estimators and necessary helper functions. """
import numpy as np
import pandas as pd
from scipy.spatial.transform import Rotation as rot
from event_detection.imu_event_detection import gyro_threshold_stance
def gyro_to_euler(orientation, gyro):
"""
... |
import os
import uuid
import json
import time
import glob
import boto.swf
import boto.s3
from boto.s3.connection import S3Connection
import provider.article as articlelib
from provider import (
article_processing,
email_provider,
lax_provider,
outbox_provider,
s3lib,
utils,
)
from activity.obj... |
# -*- coding: utf-8 -*-
# Copyright StateOfTheArt.quant.
#
# * Commercial Usage: please contact <EMAIL>
# * Non-Commercial Usage:
# 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
#
... |
#!/usr/bin/env python3.5
# -*- coding: utf-8 -*-
import copy
import random
import errno
import json
import os
import re
from collections import OrderedDict
from collections import Counter
from matplotlib import pyplot as plt
from matplotlib import rcParams
def silentremove(filename):
# http://stackoverflow.com/... |
#
# Copyright (c) 2017 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 required by applicable law or agreed to... |
# std
from collections import namedtuple
import heapq
# 3p
import numpy as np
## Function to learn and plot piecewise regressions.
def piecewise(t, v, min_stop_frac=0.03):
""" Fits a piecewise (aka "segmented") regression.
Params:
t (listlike of ints or floats): independent/predictor variable value... |
import pygame, sys, math, time
from Tank import Tank
from maps import Map
from random import randrange
from shot import Shot
from sounds import SoundsController
# The status bar (bottom bar) height
STATUS_BAR_HEIGHT = 120
#Other status bar information
STATUS_BAR_COLOR = (155,155,155)
OUTLINE_COLOR = (55,55,55)
COLUMN_... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
# Copyright 2015 IBM Corp.
#
# 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, sof... |
from __future__ import print_function
from builtins import str
from builtins import object
import h5py
import numpy
import mpi4py
import mpi4py.MPI
# This code is very fragile. I really don't recommend
# modifying it - a complete re-write would be a much
# better idea.
#
# Refactoring it is on my todo list, but if you... |
from cnf_util import *
import numpy as np
from typing import List
# utilities for single-threaded MCTS
class Node(object):
def __init__(self, prior: float, parent=None):
self.visit_count = 0
self.to_play = None
self.prior = prior
self.value_sum = 0
self.parent = parent
self.children = {}
... |
# Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
"""Implement Box."""
import numpy as np
from functools import partial
import hoomd._hoomd as _hoomd
def _make_vec3(vec, vec_factory, scalar_type):
"""Conv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.