text
stringlengths
6.04k
39.5k
#!/usr/bin/env python #=========================================================================== # # Produce plots for ZDR bias by volume # #=========================================================================== from __future__ import print_function import os import sys import subprocess from optparse import ...
"""Utilities for computing active and inactive subspaces.""" import numpy as np from .utils.misc import process_inputs, process_inputs_outputs from .utils.response_surfaces import PolynomialApproximation from .gradients import local_linear_gradients SQRTEPS = np.sqrt(np.finfo(float).eps) class Subspaces(): """A ...
#!/usr/local/bin/python3 # -*- coding: utf-8 -*- import pygame import os import random # from pprint import pprint # import numpy as np WIDTH = 720 HEIGHT = 720 GRID_WIDTH = WIDTH // 20 FPS = 30 # define colors WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) pygam...
#!/usr/bin/env python3 import os,sys,matplotlib,argparse,string # from io import StringIO matplotlib.use('Agg') from pylab import * from lefse.lefse import * import numpy as np colors = ['r','g','b','m','c',[1.0,0.5,0.0],[0.0,1.0,0.0],[0.33,0.125,0.0],[0.75,0.75,0.75],'k'] dark_colors = [[0.4,0.0,0.0],[0.0,0.2,0.0],[...
import datetime from logging import getLogger from django.conf import settings from django.contrib import messages from django.shortcuts import redirect from django.urls import reverse, reverse_lazy from django.utils import timezone from django.views.generic import TemplateView from s3chunkuploader.file_handler impor...
from io import BytesIO import copy, math, struct from Catalog.Identifiers import TupleId class PageHeader: """ A base class for page headers, storing bookkeeping information on a page. Page headers implement structural equality over their component fields. This includes the page's flags (e.g., whether the p...
'''Bed2table.py - annotate intervals ================================= :Tags: Genomics Intervals Summary Purpose ------- This script takes a bed-formatted file as input and annotates each interval. Possible annotators are (see option '--counter'): overlap compute overlap with intervals in other bed file. If th...
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
import random from datetime import date from django.shortcuts import redirect from django.templatetags.static import static from django.views.generic import TemplateView from recipients.models import MealRequest, GroceryRequest def logo(request): return redirect(static('logo-black.png')) class IndexView(Templa...
import net_symbols as syms import mxnet as mx def create_CRP(data, num_filter, name, workspace=512, lr_type="alex10"): relu1 = syms.relu(data) c1 = syms.conv(relu1, kernel=3, pad=1, num_filter=num_filter, name=name+"_conv1", no_bias=True, workspace=workspace, lr_type=lr_type) p1 = syms.maxpool(c1, kernel=5...
""" Doubly-linked list ordered by time :Author: <NAME> <<EMAIL>> :Date: 2019-11-20 :Copyright: 2019, Karr Lab :License: MIT """ import math class DoublyLinkedNode(object): """ Node in doubly-linked list that stores timestamped data Attributes: _time (:obj:`Rational`): time value _data (:obj...
from Animator.consolidation_api import BoundingBox, CharacterDetectionOutput, CharacterBoundingBox from Animator.utils import eprint, to_json import xml.etree.cElementTree as etree from EvaluationUtils.vision_metrics import CVMetrics import os from shutil import copyfile, rmtree import shutil import cv2 import numpy as...
import time from multiprocessing import Pool import ode import torch from .engines import PdipmEngine from . import contacts as contacts_module from .utils import Indices, Defaults, cross_2d, get_instance, left_orthogonal X, Y = Indices.X, Indices.Y DIM = Defaults.DIM class World: """A physics simulation worl...
""" @Fire https://github.com/fire717 """ from PIL import Image import numpy as np import pandas as pd import os import torch from torch.utils.data.dataset import Dataset import random import cv2 import albumentations as A import json import platform import math from lib.data.data_augment import DataAug from lib.uti...
import pandas as pd import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d, Axes3D import math from sklearn.metrics import roc_curve, auc import numpy as np import itertools import dask.dataframe as dd def getWorkingDir(): return '/mnt/home/jbielecki1/MultiphotonClassification/Classification/NemaS...
def fix(name): return name.replace("_", "") def convert_bool(b): return "True" if b else "False" class Function(object): def __init__(self, name): self.name = name self.cases = [] def addcase(self, case): case_name, code = case self.cases.append((fix(cas...
import pandas as pd import numpy as np import pickle import os import random import great_expectations as ge from scipy.optimize import minimize, curve_fit def curve(x : float, a : float, b : float) -> float: # pragma: no cover, basic curve """ Usage: The power function used in this package. ...
import logging import time import os import sys import click import click_log import tqdm import pysam from construct import * import longbow.utils.constants from ..utils import bam_utils from ..utils import model as LongbowModel from ..utils.model import LibraryModel from ..utils.bam_utils import SegmentInfo from...
# coding: utf-8 # pylint: skip-file """ Tests for django-rest-easy. """ from __future__ import unicode_literals import six from django.conf import settings from django.http import Http404 from django.test import TestCase from rest_easy.exceptions import RestEasyException from rest_easy.models import deserialize_data ...
# Copyright 2014-2019 Dr. <NAME>. See LICENSE file for details. """A generic command line interface testing framework. In contrast to other CLI test runners, here each test is a shell script (which is created dynamically). Therefore, the tests are as close to actual usage as possible. """ from __future__ import un...
""" Reports are used to define a view into your data. At a basic level, reports are used to process a data set, format the data, and return tabular results. But reports can define many options, including: * The name of the report * The category of the report * How long to cache the report * What source data to pull * ...
import warnings; warnings.filterwarnings("ignore") from hyperopt import fmin, tpe, hp, STATUS_OK, STATUS_FAIL, Trials, space_eval # For surpressing print import os, sys print (sys.version) class HiddenPrints: def __enter__(self): self._original_stdout = sys.stdout sys.stdout = open(os.devnull, 'w...
""" The MIT License (MIT) Copyright (c) 2017-2021 TwitchIO Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge...
#!/usr/bin/env python3 """ Produces raw, note, and (if desired) expressionized MIDI files (written to subfolders of midi/), as well as a hole analysis output file (written to the txt/ folder) for each specified piano roll. Rolls to be processed can be specified by DRUID on the command line (separated by spaces) or in ...
from __future__ import print_function from lxml import etree import click import os import sys from io import BytesIO import logging from premailer import Premailer from premailer.premailer import _cache_parse_css_string # From Premailer import cssutils import re cssutils.log.setLevel(logging.CRITICAL) _element_select...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of CbM (https://github.com/ec-jrc/cbm). # Author : <NAME> # Credits : GTCAP Team # Copyright : 2021 European Commission, Joint Research Centre # License : 3-Clause BSD from ipywidgets import (Text, VBox, HBox, Label, Password, RadioButtons, ...
# Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = [ 'read_label', 'read_ascii_table', 'read_image', 'read_table' ] from warnings import warn from collections import OrderedDict try: from ply import lex, yacc except ImportError: raise ImportError("pds3 requires the PLY ...
''' Main functionality of raster tracer. ''' from enum import Enum from collections import namedtuple import numpy as np from qgis.core import QgsPointXY, QgsPoint, QgsGeometry, QgsFeature, \ QgsVectorLayer, QgsProject, QgsWkbTypes, QgsApplication, \ QgsRectangle, QgsSpatia...
# Copyright 2018 The Defense-GAN 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 applic...
from tkinter import * from tkinter import filedialog import os as os from datetime import datetime import datetime as dt import shutil from shutil import copyfile import time as time import math import ffmpeg import subprocess import numpy as np # A function to allow the user to select the folder contianing the subf...
""" This module contains utility functions for interpolation, filtering and inspection. <NAME> """ import numpy as np def interp2(x, y, X, Y, U): """ Interpolate field U(X,Y) to u(x,y). All grids are required to be plaid and 2D """ if is_plaid(x) and is_plaid(y) and is_plaid(Y) and is_plaid(Y): ...
#!/usr/bin/env python3 import subprocess import shlex from Bio import Phylo from Bio import SeqIO from Bio.Seq import Seq import matplotlib.pyplot as plt import treetime as tt from treetime import TreeTime from treetime import wrappers from treetime.utils import numeric_date import pandas as pd import argparse import a...
"""An action graph game with additive function nodes""" import itertools import numpy as np import scipy.stats as spt from gameanalysis import rsgame from gameanalysis import utils class _AgfnGame(rsgame._CompleteGame): # pylint: disable=too-many-instance-attributes,protected-access """Action graph with functio...
''' Utilities for setting up and running simulations with Gizmo or CART. @author: <NAME> Units: unless otherwise noted, all quantities are in (combinations of): mass [M_sun] position [kpc comoving] distance, radius [kpc physical] velocity [km / s] time [Gyr] ''' # system ---- from __future__ impo...
# coding:utf-8 import sys import threading import multiprocessing import queue import re import json import cv2 import numpy as np # import os # import subprocess import pytesseract import psutil # from matplotlib import pyplot as plt from PIL import Image, ExifTags from pypinyin import pinyin, lazy_pinyin import pyp...
# !/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: huangjunjie @file: sigat.py @time: 2018/12/10 """ import os import sys import time import math import random import subprocess import logging import argparse from collections import defaultdict import numpy as np import scipy import scipy.sparse as sp impo...
import os import shutil from pathlib import Path from copy import copy import magma as m import fault import hwtypes from fault.target import Target from fault.spice import SpiceNetlist from fault.real_type import RealInOut from fault.result_parse import nut_parse, hspice_parse, psf_parse from fault.subprocess_run impo...
import argparse import collections import copy import json import os import pprint import re import pandas as pd import plotly import plotly.graph_objs as go from docopt import docopt from matplotlib import cm from matplotlib.colors import rgb2hex from munkres import Munkres from operator import itemgetter import com...
import json import shutil import natsort import numpy as np import os import pandas as pd import pytest import tempfile import xarray as xr from pytest_cases import parametrize_with_cases from ark.utils import test_utils, load_utils, io_utils from toffy import normalize import toffy.normalize_test_cases as test_case...
import numpy as np import pandas as pd import fiona import io from shapely import geometry import click from wit_tooling import query_wit_data def shape_list(key, values, shapefile): """ Get a generator of shapes from the given shapefile key: the key to match in 'properties' in the shape file ...
import os import glob import binascii import datetime import shutil import mmap import hashlib import json import gc import logging import datetime #from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException import sys logging.basicConfig(filename='run.log',level=logging.DEBUG) start_time = str(datetime.date...
""" consists of functions to get a and c weighting information (DIN EN 61672-1) in different forms: as weighting values for a given frequency numpy array as a weighting vector (numpy array) for typical fft proecessing as a weighting vector (numpy array) for a third-octave filterbank as a weighting vector (numpy array)...
import sys import gc import copy import shlex import os import tables import numpy as np from functools import partial from clair3.task.main import * from shared.interval_tree import bed_tree_from, is_region_in from shared.utils import subprocess_popen, IUPAC_base_to_ACGT_base_dict as BASE2BASE, IUPAC_base_to_num_dict...
""" This is a subfile for IsyClass.py These funtions are accessable via the Isy class opj """ from __future__ import print_function __author__ = '<NAME> <<EMAIL>>' __copyright__ = "Copyright (C) 2017 <NAME>" __license__ = "BSD" import sys # from .IsyNodeClass import IsyNode, IsyScene, IsyNodeFolder#, _IsyNodeBase ...
# -*- coding: utf-8 -*- """ Work with result files from the EIT-40/160 tomograph (also called medusa). Data structure of .mat files: EMD(n).fm frequency EMD(n).Time point of time of this measurement EMD(n).ni number of the two excitation electrodes (not the channel number) EMD(n).nu number of the two ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 19 10:30:02 2019 @author: <NAME> Based on https://openreview.net/forum?id=H1T2hmZAb """ import torch from torch.nn import Module, Parameter, init, Sequential from torch.nn import Conv2d, Linear, BatchNorm1d, BatchNorm2d from torch.nn import ConvT...
""" adding additional functionalities for centralized trianing and decentralized execution """ import numpy as np from copy import deepcopy from functools import partial from collections import defaultdict import torch from torch.autograd import Variable from runners.base_runner import BaseRunner from runners.sa...
# -*- coding: utf-8 -*- import hmac import zipfile import uuid import os import hashlib import json import re import time import requests import threading import subprocess import sys from modules.control import run_rclone from config import App_title from pyrogram.types import InlineKeyboardMarkup,InlineKeyboardButton...
# noqa # -*- coding: utf-8 -*- import logging import os from os.path import join, exists, basename import json import shutil import zipfile import traceback import django from django.apps import apps from django.conf import settings from django import db if not apps.ready and not settings.configured: django.setu...
#!/usr/bin/python """This script applies parsed BLAST results from a CSV file (produced by parseblast.pl) to a series of GenBank files. Oct 26, 2009 by <NAME> Changed the method of outputting statistics. """ try: import optparse, csv, re, sys from os import path import logging.handlers from li...
import json import win32com.client as win32 SOURCE_JSON = "CRB" PAGE = 0 PARSED = [] def RGB_to_color_number(R, G, B): return R + G * 256 + B * 65536 def color_number_to_RGB(num): R = num % 256 G = (num // 256) % 256 B = (num // 65536) % 256 return R, G, B class Style: def __init__(self, factory, options):...
#! coding=utf-8 import warnings import pandas as pd import numpy as np import first_clustering import Levenshtein import autopep8 import lightgbm as lgb import read_data from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.model_selection import train_test_split, StratifiedKFold, GridSearchCV from...
import numpy as np from circleguard import ReplayPath, Mod, Circleguard, order, ReplayMap from tests.utils import CGTestCase, DELTA, UR_DELTA, RES, FRAMETIME_LIMIT class TestSnaps(CGTestCase): @classmethod def setUpClass(cls): super().setUpClass() cls.r1 = ReplayPath(RES / "corrected_replay1....
import numpy as np def error_array(traj0, traj1, name='energy'): assert len(traj0) == len(traj1) n0l = [len(atoms) for atoms in traj0] n1l = [len(atoms) for atoms in traj1] assert np.allclose(n0l, n1l) dyl = [( atoms0.get_calculator().results[name]- atoms1.get_calculator().results[name] ) for ato...
# -*- coding: utf-8 -*- """ Created on Mon 11 January 2022 Modified by <EMAIL> on 21/10/2021 @author: <NAME> @contact: <EMAIL> @license: / """ import mmap import os import sys import numpy as np import pandas as pd from io import StringIO from configparser import ConfigParser class CustomParser(Confi...
import threading import time from collections import deque import numpy as np import imutils import cv2 import time import serial import math import RPi.GPIO as GPIO DRIVER_ID=1 FW_VERSION=2 RUNNING_TIME=3 GET_SPEED=4 SET_SPEED=5 GET_STEPS=6 SET_STEPS=7 GET_POSITION=8 SET_POSITION=9 GET_STATE=10 STOP=11 RESTART=12 ...
# coding=utf-8 from __future__ import absolute_import, division, print_function import logging import argparse import os import random import numpy as np from datetime import timedelta import torch import torch.nn as nn import torch.distributed as dist from tqdm import tqdm from torch.utils.tensorboard import Summa...
"""This is a unfinished runscript that explores how to set up a simulation for multiphase multicomponent systems (geochemistry to be included). The implementation is an attempt to follow Kala and Voskov, Element balance formulation in reactive compositional flow and transport with parameterization technique, ...
import pygame from pygame.locals import * from random import randint class Spielfigur(pygame.sprite.Sprite): def __init__(self, initial_position, size): global overall_speed global ground_height global screen_height pygame.sprite.Sprite.__init__(self) self.go_state = 1 ...
import logging import numbers import os import sys import traceback from xml.sax.saxutils import escape from concurrent.futures import ( ThreadPoolExecutor, Future, ) # pylint: disable=unused-import from types import SimpleNamespace from typing import Optional, Dict, Tuple, List # pylint: disable=unused-imp...
import datetime import json import logging from event_stream.models.model import * from sqlalchemy import Table, Column, MetaData, create_engine, inspect, text, bindparam, desc import os import urllib from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import sessionmaker, scoped_session def save_newest_di...
"""Utilities for testing the dataset fetchers Unit tests should not depend on an internet connection nor on external resources such as the servers from which we download datasets. Otherwise, tests can fail spuriously when a web service is unavailable, and tests are slow because downloading data takes a lot of time. T...
"""Missing batteries from `torch.utils.data`.""" import itertools from typing import ( Any, Callable, Dict, Iterable, Iterator, Optional, Tuple, TypeVar, Union, ) import numpy as np import torch from torch.utils.data import DataLoader, Dataset, TensorDataset T = TypeVar('T') cla...
import time from time import sleep import json import os, sys, shutil import urllib from urllib import request global totalSent interactive_mode = not len(sys.argv) > 1 def wait_for_response(): input("Press ENTER to continue...") def check_py(): verMgr = sys.version_info mjrVr = str(verMgr...
#!/usr/bin/env python import os.path import sys import cv2 import numpy as np import math import scipy.ndimage # NOTE(danny): these are pretty much the same because the colors are blown out # on the webcam, and with a filter it doesn't really matter what hue things are THEORETICAL_GREEN_HUE = 84 # if we believe in ...
# coding=utf-8 from inspect import isfunction import logging import platform from jinja2.loaders import ChoiceLoader import pytz import shelve import times import yaml from datetime import datetime from jinja2 import Environment, FileSystemLoader, FileSystemBytecodeCache from typogrify.templatetags.jinja2_filters impor...
import pickle from unittest import TestCase from pathlib import Path import pytest import numpy as np from numpy.testing import (assert_allclose, assert_almost_equal, assert_array_equal) from skfem import BilinearForm, LinearForm, asm, solve, condense, projection from skfem.mesh import (Mes...
import sys from utils import startupLoggingCharacteristics import logging import praw import nltk import datetime import time import os import argparse, textwrap # Logging Info import traceback from utils import archiveAndUpdateReddit from utils import botHelperFunctions from utils import botMetrics ...
# -*- coding: utf-8 -*- """Line and points construction functions for the brain visualization """ import numpy as np def get_center(data_matrix): """Returns the centroid of a matrix. :param data_matrix: a coordinate matrix where each column is a single observation :type data_matrix: numpy array :r...
import inspect class Pokedex(dict): # Enum pokemonIds MISSINGNO = 0 BULBASAUR = 1 IVYSAUR = 2 VENUSAUR = 3 CHARMANDER = 4 CHARMELEON = 5 CHARIZARD = 6 SQUIRTLE = 7 WARTORTLE = 8 BLASTOISE = 9 CATERPIE = 10 METAPOD = 11 BUTTERFREE = 12 WEEDLE = 13 KAKUNA...
"""odmlImportDatacite Convenience script to parse a datacite XML file or whole directories containing datacite XML files and create odML files with the parsed information. Usage: odmlimportdatacite [-f FORMAT] [-o OUT] [-n NAMESPACE ...] [-r] [-p] INPUT Arguments: INPUT Path and filename of the datacite XML f...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 11 15:15:42 2018 @author: bursaliogluozgun """ import pandas as pd import numpy as np import keras as ke import keras.backend as K from keras.layers import Input, Dense, Dropout from keras.models import Model from keras.models import load_model # ...
# pylint: disable-msg=W0703 # pylint: disable-msg=E1103 import logging import sys from google.appengine.ext import ndb from google.appengine.api import users from app_dashboard_helper import AppDashboardHelper from app_dashboard_helper import AppHelperException class DashboardDataRoot(ndb.Model): """ A Datastore M...
import json import sys import hvac import socket from prometheus_client import CollectorRegistry, Gauge, push_to_gateway class Metrics: def __init__(self, registry, pushgateway_addr, labelnames, labelvalues): self.registry = registry self.pushgateway_addr = pushgateway_addr self.grouping_...
# -*- coding: utf-8 -*- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Copyright 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 restr...
#!/usr/bin/python3 -OO # Copyright 2007-2019 The SABnzbd-Team <<EMAIL>> # # 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 2 # of the License, or (at your option) any later version...
import bisect import pickle import random from collections import defaultdict from datetime import datetime import time import numpy as np import pandas as pd from scipy.stats import binom from tqdm import tqdm from bootstrapping.infected_dataset import get_patient_data, get_elderly_patient_data, \ get_index_case...
# -*- coding: utf-8 -*- import operator import pytest import numpy as np from pandas.compat import range import pandas as pd import pandas.util.testing as tm from pandas.tests.frame.common import _check_mixed_float, _check_mixed_int # ------------------------------------------------------------------- # Compariso...
from tytus.parser.fase2.team21.Analisis_Ascendente.Instrucciones.Expresiones.Expresion import Expresion from tytus.parser.fase2.team21.Analisis_Ascendente.Instrucciones.expresion import Primitivo from tytus.parser.fase2.team21.Analisis_Ascendente.Instrucciones.instruccion import Instruccion from tytus.parser.fase2....
""" Parts of this code were provided by RadboudUMC for the ExaMode consortium. See README file for credits. """ import skimage.color from skimage.color import rgb2gray import numpy as np import numpy as np import copy import pylab as plt from PIL import Image from stainlib.utils.excepts import InvalidRangeError from s...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sympy as sp import numpy as np import matplotlib.pyplot as plt # from mpl_toolkits.mplot3d import Axes3D from fractions import Fraction def plot_sto(sto_file, plots_per_row, pattern=None, save=False, fig_format='.pdf'): """Plots the .sto ...
## Copyright 2015-2019 <NAME>, <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 i...
import copy import numpy as np from circuits.vogit_1 import Vogit_3 from IS.IS import IS_0 from smoothAlg.SavitzkyGolay import savitzkyGolay as SG from ny_onePoint_AD import load_EIS, getMaxAndIndex from utils.file_utils.pickle_utils import load_pickle_file from utils.statistic.quartile import cal_quartile from util...
from sys import stderr from typing import Union, Iterable, Tuple, Dict, Callable, Any class NoValue: def __lt__(self, other): return False def __gt__(self, other): return False def __le__(self, other): return False def __ge__(self, other): return False def __eq_...
from collections import namedtuple from datetime import date, datetime, timedelta from logging import DEBUG, INFO from pathlib import Path from typing import Callable, Dict, Iterable, List, Tuple, TypeVar import click import pytz from sqlalchemy.orm import Session import weather.db as db import weather.domain as wd i...
"""An example of how to use your own dataset to train a classifier that recognizes people. """ # MIT License # # Copyright (c) 2016 <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 wi...
import re import bmesh from ..arch import fill_arch, create_arch, add_arch_depth from ..door.door_types import add_door_depth from ..fill.fill_types import fill_face from ..frame import add_frame_depth from ..array import ( spread_array, clamp_array_count, get_array_split_edges ) from ..facemap...
################################################################################ # # Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors # # This file is a part of the MadGraph5_aMC@NLO project, an application which # automatically generates Feynman diagrams and matrix elements for arbitrary # hi...
import os import numpy as np import torch from torch.utils.data.sampler import BatchSampler, SubsetRandomSampler from a2c_ppo_acktr.multi_agent.utils import jointplot, mkdir2 def _flatten_helper(T, N, _tensor): return _tensor.view(T * N, *_tensor.size()[2:]) class RolloutStorage(object): def __init__(self, ...
import torch, numpy as np import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.module import Module from torch.nn.parameter import Parameter import math from torch.autograd import Variable from components import * class GraphConvolution(Module): """ Simple GCN layer, similar to https://...
# General import numpy as np import random import argparse import tqdm import pickle import json import joblib import os import time import sys import pathlib import random import string # Pytorch import torch from torch.utils.data import DataLoader from torch.nn.functional import one_hot import pytorch_lightning as p...
# Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file ex...
from sudoku.grid import Grid from collections.abc import Iterable from unittest.mock import Mock def test_grid_iterator(): assert isinstance(Grid.grid_iterator(), Iterable) act_grid = set([c for c in Grid.grid_iterator()]) exp_grid = {'A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', '...
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "<NAME> @leonardoarcari" from networkx.relabel import convert_node_labels_to_integers import networkx as nx from pathlib import Path from osgeo import ogr from osgeo import osr from math import cos, sin, asin, sqrt, radians import random ## Modules # Element...
from datetime import date, datetime, timedelta, time from types import FunctionType from collections import Iterable from openpyxl.cell import WriteOnlyCell from openpyxl.formatting import Rule from openpyxl.utils import get_column_letter from openpyxl.worksheet.datavalidation import DataValidation from openpyxl_temp...
# Copyright 2014 Juniper Networks. 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...
import numpy as np import tensorflow as tf from .base import Layer from .inits import glorot,zeros,init_vars,ones,normal,constant from .functional import sparse_dropout,dot from .functional import gru_unit class Embedding(Layer): def __init__(self,placeholders,vocab_nums=None,embedding_dim=None,embedding=None,drop...
""" RAMSES frontend tests """ #----------------------------------------------------------------------------- # Copyright (c) 2013, yt Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #--------------------...
"""Generic Sliders with internal python-based models This module reimplements most of the logic from qslider.cpp in python: https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qslider.cpp.html This probably looks like tremendous overkill at first (and it may be!), since a it's possible to acheive a very reasonable ...
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Access to bucket configurations. Stores bucket list in datastore, synchronizes it with bucket configs in project repositories: `projects/<project_id>:<bu...