text
stringlengths
6.04k
39.5k
from django.shortcuts import render, get_object_or_404, redirect from django.http import Http404, JsonResponse from django.urls import reverse from django.core import serializers from django.core.paginator import Paginator from django.contrib.auth.decorators import login_required from django.contrib.auth.models import ...
import numpy as np from gym import utils, spaces from gym.envs.mujoco import mujoco_env from gym.envs.robotics.rotations import quat2euler, euler2quat, mat2euler import os # import random from random import uniform, randint, randrange from mjremote import mjremote import time from doorenv2.envs.doorenv import DoorEnv ...
__copyright__ = """ Copyright (C) 2020 <NAME> Copyright (C) 2020 <NAME> """ __license__ = """ 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 ...
#!/usr/bin/python3 import sys import os import shutil import subprocess import re import chardet import itertools from functools import reduce from collections import defaultdict import argparse def get_max_common_beginning(sequences): if not sequences: return None max_beginning = sequences[0] for seq in sequence...
from copy import deepcopy from typing import List from rdkit import Chem from icolos.core.step_utils.obabel_structconvert import OBabelStructConvert from icolos.utils.enums.compound_enums import ( CompoundContainerEnum, EnumerationContainerEnum, ) from icolos.utils.enums.program_parameters import SchrodingerEx...
import sys import os import cv2 import numpy as np import json from PIL import Image, ImageFont, ImageDraw from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * from urllib.request import urlretrieve import requests from keras.mod...
# -*- coding: utf-8 -*- #单例测试导入路径 if __name__ == '__main__': import sys, os parent_path = os.path.dirname(os.getcwd()) sys.path.append(parent_path) from webparser.webparserbase import ParserBase from serializ.htmlfile import * from serializ.oracle import * from bean.urlbean import * from log.log...
""" Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. SPDX-License-Identifier: Apache-2.0 OR MIT """ class Tests: deferred_fog_creation = ( "Deferred Fog Entity successfully created", "P0: De...
from Textures import VOICE_MODULATION, DIALOGBOX_READOUT, NAMIKO, FRAMEBORDER __author__ = "<NAME>" __copyright__ = "Copyright 2007, Cobra Project" __credits__ = ["<NAME>"] __license__ = "GPL" __version__ = "1.0.0" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __status__ = "Demo" from numpy import lins...
# Copyright (c) 2019 Uber 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 agreed...
# # Collective Knowledge () # # # # # Developer: # cfg={} # Will be updated by CK (meta description of this module) work={} # Will be updated by CK (temporal data) ck=None # Will be updated by CK (initialized CK kernel) import os import sys import json import re import pandas as pd import numpy as np # Local s...
#!/usr/bin/python import os,sys import glob import json from collections import OrderedDict from Bio import SeqIO sys.path.insert(0, '/clusterCAD') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "clusterCAD.settings") import django django.setup() import pks.models def mibigSubtypes(filepath): '''Takes as input...
from ..util import cached, search, llist, WeakRefProperty, SourceError from ..containers.basereader import Track import threading import numpy from collections import OrderedDict from itertools import count from copy import deepcopy import weakref def notifyIterate(iterator, func): for item in iterator: f...
import hashlib from flask import request from assemblyline.common.isotime import now_as_iso from assemblyline.remote.datatypes.lock import Lock from assemblyline_ui.api.base import api_login, make_api_response, make_subapi_blueprint from assemblyline_ui.config import CLASSIFICATION, STORAGE SUB_API = 'safelist' safe...
from typing import Union, Optional, Dict import torch from falkon import sparse from falkon.kernels.diff_kernel import DiffKernel from falkon.la_helpers.square_norm_fn import square_norm_diff from falkon.options import FalkonOptions from falkon.sparse import SparseTensor SQRT3 = 1.7320508075688772 SQRT5 = 2.23606797...
#------------------------------------------------------------------------------- # This is the revision of pyelftools (for newer version of Construct) # # Encapsulation of Construct structs for parsing an ELF file, adjusted for # correct endianness and word-size. # # <NAME> (<EMAIL>) # This code is in the public domain...
import json import os import re import subprocess from functools import cached_property import requests import yaml # Changelog types PULL_REQUEST = 'pull_request' COMMIT = 'commit_message' class ChangelogCIBase: """Base Class for Changelog CI""" github_api_url = 'https://api.github.com' def __init__...
import astropy.units as u from astropy.coordinates import EarthLocation,SkyCoord from pytz import timezone import numpy as np from collections import Sequence import matplotlib.pyplot as plt from matplotlib import dates from astroplan import Observer from astroplan import FixedTarget from datetime import datetime, ...
import math from math import log, pi, sqrt from functools import partial import torch from torch import nn, einsum import torch.nn.functional as F from einops import rearrange, repeat # constants from network_swinir_v2 import SwinTransformerBlock List = nn.ModuleList # helpers def exists(val): return val is no...
# Copyright 2021 The TensorFlow 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 applica...
""" Tests of Tax-Calculator using puf.csv input. Note that the puf.csv file that is required to run this program has been constructed by the Tax-Calculator development team by merging information from the most recent publicly available IRS SOI PUF file and from the Census CPS file for the corresponding year. If you h...
# adapted from yolor/test.py import argparse import glob import json import os from pathlib import Path import numpy as np import torch import yaml from tqdm import tqdm from yolor.utils.google_utils import attempt_load from yolor.utils.datasets import create_dataloader from yolor.utils.general import coco80_to_coco9...
#!/usr/bin/env python # Needed to set seed for random generators for making reproducible experiments from numpy.random import seed seed(1) from tensorflow import set_random_seed set_random_seed(1) import numpy as np import tifffile as tiff import os import random import shutil from PIL import Image from ..utils impor...
import pandas as pd import numpy as np import seaborn as sb import base64 from io import BytesIO from flask import send_file from flask import request from napa import player_information as pi import matplotlib matplotlib.use('Agg') # required to solve multithreading issues with matplotlib within flask import matplotli...
import numpy as np from torch.utils.data import Dataset import sys import torch from ppo_and_friends.utils.mpi_utils import rank_print from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() num_procs = comm.Get_size() class EpisodeInfo(object): def __init__(self, starting_...
""" author: <NAME> """ import numpy as np import time import copy from numba import njit from numba.typed import List from gglasso.solver.ggl_helper import phiplus, prox_od_1norm, prox_2norm, prox_rank_norm from gglasso.helper.ext_admm_helper import check_G def ext_ADMM_MGL(S, lambda1, lambda2, reg , Omega_0, G,\...
from datetime import datetime from typing import List, Dict, Union import pytest from dataclasses import field from krake.data.config import HooksConfiguration from krake.data.core import Metadata, ListMetadata from krake.data.kubernetes import ClusterList from marshmallow import ValidationError from krake.data.serial...
"""High level add faults function.""" import logging log = logging.getLogger(__name__) import os import numpy as np import resqpy.crs as rqc import resqpy.grid as grr import resqpy.lines as rql import resqpy.model as rq import resqpy.olio.grid_functions as gf import resqpy.olio.simple_lines as sl import resqpy.olio...
import os import re import base64 import webbrowser import time import tempfile import numpy as np import matplotlib from numpy.testing import assert_warns, assert_no_warnings try: from lxml import etree LXML_INSTALLED = True except ImportError: LXML_INSTALLED = False from nilearn.plotting import js_plott...
#!/usr/bin/env python # Copyright 2018 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. # This script parses result of build/android/adb_profile_chrome_startup and # prints various information. from __future__ import print...
# Copyright 2018 ICON 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 # # Unless required by applicable law or agreed to in writi...
""" There are a few important sets of datastructures: dimensions * N - Size of the dstore. * K - Number of retrieved neighbors. * D - Size of the key vectors. dstore - This is the "ground truth" source of keys, values, and other important items created by the KNN-LM. ...
# © 2019 Nokia # Licensed under the BSD 3 Clause license # SPDX-License-Identifier: BSD-3-Clause import re from string import Template from radish_ext.sdk.l import Logging def dot_to_dict_notation(dot_notation): """ replace dot_notation to nested_python_dict_notation so that It can be later used in nested ...
from __future__ import absolute_import from __future__ import print_function import logging import numpy as np from numpy.lib.recfunctions import append_fields from sklearn.cluster import DBSCAN from lmatools.coordinateSystems import GeographicSystem from lmatools.flashsort.flash_stats import calculate_...
import math import json from colormath.color_objects import RGBColor from django.db import models from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from common.models import UserBase, ResultBase from common.utils import save_obj_attr_base64_image, get_content_...
# -*- coding: utf-8 -*- """Command Line Interface Module Module that contains the special command line tools """ import os import uuid from datetime import datetime, timedelta from app.threads import UpdatePipelineData def register(app): @app.cli.command('seed_aff_types_db') def seed_aff_types_db(): ...
"""Manipulate differences.""" import collections from arxpy.bitvector import core from arxpy.bitvector import operation from arxpy.bitvector import extraop def _tuplify(seq): if isinstance(seq, collections.abc.Sequence): return tuple(seq) else: return tuple([seq]) class Difference(object): ...
import numpy as np from igraph import * # Define some useful graph functions def plotGraph(g, name=None): '''Function that plots a graph. Requires the pycairo library.''' color_dict = {0: "blue", 1: "#008833"} visual_style = {} visual_style["vertex_label_dist"] = 2 visual_style["vertex_size"] = ...
""" Created on Apr 4, 2014 @author: <NAME> In this module you can find the :class:`MyStorage`. It inherits from :class:`base.base.Storage`. This class represents the base layer. It manages the project files, the data loading and the data writing. The data loading is called in the :class:`Task` which is a thread. ""...
#!/usr/bin/env python -W ignore::DeprecationWarning # -*- coding: utf-8 -*- """Adenine analyzer module.""" ###################################################################### # Copyright (C) 2016 <NAME>, <NAME>, <NAME> # # FreeBSD License ###################################################################### import...
# -*- coding: utf-8 -*- """ Main model architecture. reference: https://github.com/andy840314/QANet-pytorch- """ import math import torch import torch.nn as nn import torch.nn.functional as F from .modules.cnn import DepthwiseSeparableConv # revised two things: head set to 1, d_model set to 96 device = torch.device(...
# -*- coding: utf-8 -*- import datetime, json, logging, os, pprint, re # from operator import itemgetter import django, sqlalchemy from disa_app import models_sqlalchemy as models_alch from disa_app import settings_app from disa_app.lib import person_common from disa_app.models import MarkedForDeletion from django.co...
import os import sys import copy #import fcntl import pty import threading import subprocess from lxml import etree try: # py2.x from urllib import pathname2url from urllib import url2pathname from urllib import quote pass except ImportError: # py3.x from urllib.request import pathname2ur...
# Author: <NAME> 2020 (<EMAIL>) # Author: <NAME> 2020 (<EMAIL>) # Author: <NAME> 2020 (<EMAIL>) # Author: <NAME> 2020 (<EMAIL>) # Copyright (c) 2020- Max Planck Institute of Molecular Physiology # Permission is hereby granted, free of charge, to any person obtaining a copy # of this program and associated documentati...
import json import pytest import asyncio from api_test_utils.oauth_helper import OauthHelper from api_test_utils.apigee_api_apps import ApigeeApiDeveloperApps from api_test_utils.apigee_api_products import ApigeeApiProducts from e2e.scripts.generic_request import GenericRequest from time import time from e2e.scripts im...
import keras import numpy as np import pandas as pd import os from keras import backend as K from keras.layers import Input, Dense, Dropout, GaussianNoise, BatchNormalization, GaussianDropout import keras.backend as backend from keras.models import Model, Sequential from keras.callbacks import ModelCheckpoint, CSVLogg...
import numpy as np import torch.nn.functional as F import math from torchvision import transforms import torch import cv2 import matplotlib import matplotlib.pyplot as plt import matplotlib.patches as patches matplotlib.use('agg') MAPS = ['map3','map4'] Scales = [0.9, 1.1] MIN_HW = 384 MAX_HW = 1584 IM_NORM_MEAN = [0...
import numpy as np ''' REFERENCES <NAME>., <NAME>, <NAME>, and <NAME> (2001), Plants in water-controlled ecosystems Active role in hydrologic processes and response to water stress II. Probabilistic soil moisture dynamics, Adv. Water Resour., 24(7), 707-723, doi 10.1016/S0309-1708(01)00005-7. ...
from numchess import COLOR_NAMES, PIECE_NAMES from pygame.constants import ( MOUSEBUTTONDOWN, MOUSEBUTTONUP, QUIT, RESIZABLE) from pygame.display import flip as display_flip, set_caption, set_icon, set_mode from pygame.event import get as get_event from pygame.font import Font from pygame.image import load as loa...
__copyright__ = """ Copyright (C) 2020 University of Illinois Board of Trustees Copyright (C) 2021 <NAME> """ __license__ = """ 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,...
#!/usr/bin/env python """ Created on 2015-09-26T12:13:49 """ from __future__ import division, print_function import sys import argparse import re import time try: import numpy as np except ImportError: print('You need numpy installed') sys.exit(1) import pandas as pd from splinter.browser import Browser i...
import numpy as np from scipy import special as special from scipy.special import logsumexp from mimo.abstraction import MixtureDistribution from mimo.abstraction import BayesianMixtureDistribution from mimo.distributions.bayesian import CategoricalWithDirichlet from mimo.distributions.bayesian import CategoricalWith...
# -*- coding: utf-8 -*- #~ from __future__ import (unicode_literals, print_function, division, absolute_import) import numpy as np import scipy.fftpack import scipy.signal import matplotlib.cm import matplotlib.colors from .myqt import QT import pyqtgraph as pg from .base import BaseMultiChannelViewer, Base_MultiC...
#!/usr/bin/env python3 import argparse import json from os import listdir, mkdir, pardir from os.path import join, exists from sys import stderr, stdout import os, sys, inspect from random import shuffle import dynet as dy import re import numpy as np from time import time from math import isinf from random import ran...
AESEncryptParam = "Key (32 Hex characters)" S_BOX = ( 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import numpy as np from scipy.stats import entropy, normaltest, mode, kurtosis, skew, pearsonr, moment import pandas as pd from collections import OrderedDict from feature_extraction.helpers import * from feature_extraction.type_detection import detect_field_type, data_type_...
import argparse import json import math import matplotlib.pyplot import numpy import os import pandas import re import skimage.io import skimage.transform import torch import torch.utils.data import torch.utils.model_zoo import tqdm blurb = 'Fashion Brain: Library of trained deep learning models (D2.5)' def conv3x...
# Copyright (c) <NAME> (<EMAIL>). # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distri...
# Copyright 2018 <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 ...
#coding: utf-8 __author__ = '<NAME> <<EMAIL>>' __status__ = 'experimental' import re import sys import collections from _utilities import sort_uniq _BRANCH_OPES = frozenset([ "ifeq", "ifnull", "iflt", "ifle", "ifne", "ifnonnull", "ifgt", "ifge", "if_icmpeq", "if_icmpne", "if_icmplt", "if_icmpgt", "if_icmple...
from collections import defaultdict import numpy as np import pandas as pd from scipy.stats import chi2_contingency, fisher_exact, f_oneway from .simulations import classifier_posterior_probabilities from .utils.crosstabs import (crosstab_bayes_factor, crosstab_ztest, ...
from builtins import isinstance from copy import copy from math import ceil from typing import Union, Tuple from hwt.code import Switch, Concat from hwt.hdl.constants import INTF_DIRECTION from hwt.hdl.frameTmpl import FrameTmpl from hwt.hdl.transTmpl import TransTmpl from hwt.hdl.typeShortcuts import vec from hwt.hdl...
#!/usr/bin/env python import os, sys import pygrib import gdal import h5py import netCDF4 import re import logging from pyhdf.HDF import HDF from pyhdf.SD import SD from collections import OrderedDict #set path to the FLEXPART library flexpart_lib = os.path.dirname(os.path.realpath(__file__)) + '/../../pep.lib/lib/F...
"""Recipes application.""" import logging import os import time from pathlib import Path from zipfile import ZipFile, ZIP_DEFLATED, ZipInfo from io import BytesIO from base64 import b64encode, b64decode from json import loads, dumps from flask import Flask, flash, redirect, render_template, request, session, url_for fr...
#!/usr/bin/env python3 import re import os import json import math import time import logging import datetime import argparse import operator import itertools import concurrent.futures from typing import List, Optional import flask import jinja2 from flask import g, request from werkzeug.middleware.shared_data import ...
from .models import * from django.shortcuts import render from django.core.handlers.wsgi import WSGIRequest from django.http import JsonResponse, HttpResponse from django.db import connection from .utilities import reconstruct_params, post_request_to_dict_slicer, values_from_dict_by_keys, smart_int, \ null_check, r...
#!/usr/bin/env /usr/bin/python3 import sys import numpy as np import pymesh import matplotlib matplotlib.use('Qt5Agg') from matplotlib import cm from matplotlib import pyplot as plt from matplotlib.backends.backend_qt5agg import ( FigureCanvasQTAgg as FigureCanvas, NavigationToolbar2QT as NavigationToolb...
"""This file is part of matrix2latex. Python/MATLAB matrix to LaTeX table converter, originally by <NAME> https://code.google.com/p/matrix2latex/. Inspired by the work of koehler at in.tum.de who has written a similar package only for matlab http://www.mathworks.com/matlabcentral/fileexchange/4894-matrix2latex. This cu...
import tensorflow as tf from utils.bert import bert_utils from loss import loss_utils from utils.bert import albert_modules from metric import tf_metrics def classifier(config, seq_output, input_ids, sampled_ids, input_mask, num_labels, dropout_prob, **kargs): """ input_ids: origi...
""" eep_functions.py (C) <NAME> Institute for Astronomy University of Hawaiʻi 2019 July 1 Python utilities to convert stellar evolution tracks to downsampled tracks based on Equivalent Evolutionary Phases (EEPs) according to the method of Dotter (2016). """ from multiprocessing import Pool import numpy as np from sc...
import torch from torch.serialization import normalize_storage_type, location_tag, _should_read_directly import io import pickle import pickletools from .find_file_dependencies import find_files_source_depends_on from ._custom_import_pickler import CustomImportPickler from ._importlib import _normalize_path import type...
# -*- coding: utf-8 -*- # Copyright (c) 2018-2021, earthobservations developers. # Distributed under the MIT License. See LICENSE for more info. import logging from datetime import datetime, timezone from itertools import repeat from typing import Dict, List, Optional, Union import pandas as pd from pandas import Time...
import os import subprocess import sys import datetime import boto3 sys.path.append(os.path.dirname(__file__)) import configuration from ast import literal_eval def run_command(cmd, type): try: if type == "check_output": command = subprocess.check_output(cmd) return literal_eval(c...
from __future__ import print_function, division from argparse import ArgumentParser import yaml import logging import os import sys import time from subprocess import call from marmot.experiment.import_utils import build_objects, build_object, call_for_each_element, import_class from marmot.experiment.preprocessing_u...
import numpy as np import pandas as pd import pathlib import copy import sklearn from sklearn.model_selection import train_test_split import json import datetime import argparse parser = argparse.ArgumentParser(description='Preprocess data, choose datasets') parser.add_argument('--dataset', type=str, help="used datase...
import types import datetime from nose.tools import eq_ as orig_eq_ from unittest import skip from allmychanges.utils import first, html_document_fromstring from allmychanges.parsing.pipeline import ( get_markup, extract_metadata, group_by_path, strip_outer_tag, prerender_items, highlight_keywo...
"""This module contains njitted routines and data structures to: - Find the best possible split of a node. For a given node, a split is characterized by a feature and a bin. - Apply a split to a node, i.e. split the indices of the samples at the node into the newly created left and right childs. """ import numpy a...
import torch from torch import nn import torch.nn.functional as F import math import numpy as np import logging class BaseUCLoss(nn.Module): def __init__(self, margin=0, lm=0.05, um=0.25, lambda_g=1.0, la=10, ua=110, reg_type='exp_3', shift_margin=False, normalize=True, uc=True, metric='arc', *a...
import datetime import json import os import random import colorama import discord import requests from dotenv import load_dotenv colorama.init() load_dotenv() client = discord.Client() TOKEN = os.environ.get("TOKEN") # list of games which will be the playing status of the bot lista_giochi_bot ...
#! /usr/bin/env python # coding: utf-8 """ This is Ros node for pwm control rc car """ import RPi.GPIO as GPIO import pigpio import time import numpy as np import math import tf from enum import Enum import rospy from geometry_msgs.msg import Twist, TwistStamped, PoseStamped from ackermann_msgs.msg import AckermannDr...
import os import datetime import pytest import pandas as pd import geopandas as gpd from shapely.geometry import Point import trackintel as ti @pytest.fixture def testdata_sp_tpls_geolife_long(): """Generate sp and tpls sequences of the original pfs for subsequent testing.""" pfs, _ = ti.io.dataset_reader.r...
#!/usr/bin/env python3 import argparse import tempfile import logging import difflib import glob import json import sys import os import re from pprint import pformat from .counter import PapersForCount, SenateCounter from .aecdata import CandidateList, SenateATL, SenateBTL, FormalPreferences from .common import logge...
import random from esper.prelude import * from rekall.video_interval_collection import VideoIntervalCollection from rekall.temporal_predicates import * from esper.rekall import * import cv2 import pickle import multiprocessing as mp from query.models import Video, Shot from tqdm import tqdm import django import sys imp...
""" spectral.py Frequency domain analysis of neural signals: creating PSD, fitting 1/f, spectral histograms """ import numpy as np from scipy import signal import matplotlib.pylab as plt from sklearn import linear_model def psd(x, Fs, method='mean', window='hann', nperseg=None, noverlap=None, filtlen=1.): """ ...
##### Folder Cleaner ##### ##### © <NAME> - 2020 ##### for Python 3 ##### from subprocess import check_output # Using this import just to install the dependencies if not. # I will only use my two libraries filecenter and lifeeasy and will not import anything else after they are installed. #...
#!/usr/bin/env python3 import os import time import subprocess import random import inquirer import stat import wget from libsw import php, nginx, user, bind, cert, db, settings, input_util from getpass import getpass from mysql import connector from pwd import getpwnam def list_installations(): """ List all ...
""" Twin-delayed DDPG """ import numpy as np import tensorflow as tf from utils.logx import EpochLogger from utils.tf_utils import set_tf_allow_growth set_tf_allow_growth() import gym import time from tqdm.auto import tqdm def hard_update(target: tf.keras.Model, source: tf.keras.Model): target.set_weights(sour...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' surface2stations.py Extract synthetics at given stations from a NetCDF database of surface wavefield created by AxiSEM3D (named axisem3d_surface.nc by the solver) and save them into a NetCDF waveform database (same as the built-in NetCDF output axisem3d_synthetics.nc)...
from collections import defaultdict from copy import deepcopy import logging import math import os from typing import Tuple import matplotlib.pyplot as plt import numpy as np from omegaconf import DictConfig, OmegaConf import pytorch_lightning as pl try: from ray.tune.integration.pytorch_lightning import TuneRepor...
# The MIT License (MIT) # # Copyright (c) 2016 <NAME> & <NAME> for Adafruit Industries # # 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 ...
#python routines for estimating energy resolution and intensity #<NAME> #Updated 2-19-2013 to include tube efficiency import sys #sys.path.append('/SNS/users/19g/SEQUOIA/commissioning/python') from unit_convert import E2V,E2K import numpy as np from numpy import pi, log, exp, sqrt, tanh, linspace, radians, zeros from s...
""" Copyright (c) 2021 Graphcore Ltd. All rights reserved. """ """ # Efficient data loading with PopTorch """ """ This tutorial will present how PopTorch could help to efficiently load data to your model and how to avoid common sources of performance loss from the host. This will also cover the more general notion of...
__author__ = 'rogerjiang' ''' This file performs the training of a U-net convolutional neural network for pixel-wise classification (or segmentation) of satellite images. The model performs binary classification for each class. The model parameters is loaded from ./hypes/hypes.json and you can change "class_type" pa...
# Utilities for installing and selecting SSL certificates. import os, os.path, re, shutil from utils import shell, safe_domain_name def get_ssl_certificates(env): # Scan all of the installed SSL certificates and map every domain # that the certificates are good for to the best certificate for # the domain. from...
''' https://github.com/makifozkanoglu/MultiResUNet-PyTorch/blob/main/multiresunet.py ''' import jittor as jt from jittor import init from jittor import nn def Conv2dSame(in_channels, out_channels, kernel_size, use_bias=True, padding_layer=nn.ReflectionPad2d): ka = (kernel_size // 2) kb = ((ka - 1) if ((kernel...
# Copyright (c) 2018, Xilinx # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and th...
from __future__ import print_function import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data import torchvision.datasets as dset import torchvision.transforms as transforms import torchvision.utils as vutils from torchvision.u...
import functools import gc import itertools import logging import pathlib import shutil import hetnetpy.hetnet import hetnetpy.matrix import hetnetpy.permute import hetnetpy.readwrite import numpy import pandas import scipy.sparse import hetmatpy.degree_weight import hetmatpy.matrix def hetmat_from_graph( graph...
r""" ========================================================= Utilities Abaqus (:mod:`desicos.abaqus.abaqus_functions`) ========================================================= .. currentmodule:: desicos.abaqus.abaqus_functions Includes all utilities functions that must be executed from Abaqus. """ from __future__...
import numpy as np from typing import Iterable, Tuple, List, Union _lfsr_length = 16 _key_length = 128 // 8 _iv_length = 128 // 8 _d_table = [ 0b100010011010111, 0b010011010111100, 0b110001001101011, 0b001001101011110, 0b101011110001001, 0b011010111100010, 0b111000100110101, 0b000100110101111, 0b100110101111...