text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import sys
import math
import random
import matplotlib.pyplot as plt
import numpy as np
from numpy.linalg import inv
import scipy.constants as spy_constants
from scipy.optimize import fsolve
class Sim2DCord(object):
def __init__(self, x, y):
self.x = x
... |
# Copyright 2021 The WAX-ML Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
# -*- coding: utf-8 -*-
import os
import json
from datetime import datetime
import random
import hashlib
from flask import render_template, session, redirect, url_for, current_app, \
abort, flash, request, make_response, g, Response
from flask_login import login_required, login_user, logout_user, current_user
f... |
#!/usr/bin/python3
import subprocess
import os
import tarfile
import shutil
import argparse
import tempfile
import re
import configparser
import itertools
import datetime;
from urllib.parse import urlparse
def updateEnv(instDir):
env = os.environ.copy();
env["ANNIS_HOME"] = instDir;
return env
def getversion(ins... |
# Manta Python
# Manta Protocol Implementation for Python
# Copyright (C) 2018-2019 <NAME>
# Cryptography library generates UserWarning with latest CFFI libraries
import warnings
warnings.filterwarnings("ignore", message="Global variable")
import base64
from decimal import Decimal
from enum import Enum
from typing i... |
#!/home/mcollier/miniconda3/bin/python
# -*- coding: utf-8 -*-
# Typical use cases:
#hf> /media/mcollier/ONYX/ONYX/W/portfolio/scripts/make_metrics.py -v
#hf> /media/mcollier/ONYX/ONYX/W/portfolio/scripts/make_metrics.py -s WMT
#hf> /media/mcollier/ONYX/ONYX/W/portfolio/scripts/make_metrics.py -h
###################... |
import meraki
import PySimpleGUI as sg
import credentials
import functions
def gather_templates(api_client):
orgs = api_client.organizations.getOrganizations()
temps = []
non_api = []
j = 0
for org in orgs:
try:
temp = dashboard.organizations.getOrganizationConfigTemplates(orga... |
#!/usr/bin/python3.9
import os, sys, h5py, numpy, json, math, pickle
from pandas import DataFrame
from os import path
from matplotlib import pyplot
from osgeo import gdal
def main():
print("Starting %s..." % sys.argv[0])
data_dir = path.join('data')
'''
biome_map_file = path.join(data_dir, 'MCD12C1.A2015001.006.2... |
from model import Stanje, Kategorija, Nakup, Izdelek
from datetime import date
IME_DATOTEKE = "stanje.json"
try:
moj_model = Stanje.preberi_iz_datoteke(IME_DATOTEKE)
except FileNotFoundError:
moj_model = Stanje()
DODAJ_KATEGORIJO = 1
POBRISI_KATEGORIJO = 2
ZAMENJAJ_KATEGORIJO = 3
ZAMENJAJ_NAKUP = 4
DODAJ_IZD... |
#
#
# voice-skill-sdk
#
# (C) 2021, Deutsche Telekom AG
#
# This file is distributed under the terms of the MIT license.
# For details see the file LICENSE in the top directory.
#
"""Utility functions"""
import re
import sys
import time
import asyncio
import inspect
import datetime
import threading
import contextlib
... |
import abc
import itertools
import numbers
import operator
import random
import util
from typing import Union, List, TypeVar, Type, Callable, Text, Iterable, Tuple
from util import MatBaseType, MatType, MatProxyType, RowType, ColType, Number
class MatrixBase(abc.ABC):
# Should be defined in derived class
... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import pprint
import stringcase
from jinja2 import Environment
from jinja2.loaders import PackageLoader
from prompt_toolkit import prompt
from prompt_toolkit.completion import WordCompleter
from prompt_toolkit.validation import Validat... |
#!/usr/bin/env python
"""
::
ipython -i G4Cerenkov_modifiedTest.py
"""
import os, logging, numpy as np
import matplotlib.pyplot as plt
from collections import OrderedDict as odict
log = logging.getLogger(__name__)
#np.set_printoptions(suppress=False, precision=8)
np.set_printoptions(suppress=True, precision=... |
import pickle
import string
import numpy as np
from nltk import Tree
from spacy.tokens import Doc, Span
from nltk.stem import SnowballStemmer
from sentence_transformers import SentenceTransformer, models
from recap_am.model.config import Config
config = Config.get_instance()
lang = config["nlp"]["language"]
auxdir = ... |
import math
from typing import Optional, Union
import cupy as cp # type: ignore[import]
import torch
import numpy as np
from torch.nn.common_types import _size_any_t
from halutmatmul.decision_tree_and_pq import halut_encode_pq_tensor
MAX_THREADS = 1024
SHARED_MEM_PER_BLOCK = 49152
READ_ACC_LUT_KERNEL_SPLIT_FACTOR ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 12:14:02 2019
@author: gerhard
"""
from __future__ import print_function, division
from keras.datasets import mnist
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D, Max... |
import pandas as pd
from IPython.display import display
# TODO CUR report will be read from AWS, not from a local file
#CUR_FILE = '2021Sept_CUR.parquet'
#CUR_FILE = '2021Oct_CUR.parquet'
#CUR_FILE = '2021Nov_CUR.parquet'
CUR_FILE = '2021Dec18_PARTIAL_CUR.parquet'
# These are the accounts that require special handlin... |
#!/usr/bin/env python
# Copyright (c) 2016 <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, mo... |
# Created by: <NAME>
# 5 October 2017
from .serial_link import SerialLink
from .serial_link import Revolute
from math import pi
import numpy as np
from . import transforms as tr
from . import graphics
from .common import ishomog
class Puma560(SerialLink):
def __init__(self, base=None):
self.qn = np.matri... |
#
# 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 License, Version 2.0 (the
# "License"); you may not... |
import torch
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch.nn.functional as F
import logging
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.... |
# Copyright 2021 DeepMind Technologies Limited. 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 ... |
import os
import sys
import math
def env_integer(key, default):
if key in os.environ:
val = os.environ[key]
if val == "inf":
return sys.maxsize
else:
return int(val)
return default
def env_bool(key, default):
if key in os.environ:
return True if os... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
#! /usr/bin/env python
# encoding: utf-8
import argparse
import errno
import logging
import os
import platform
import re
import sys
import subprocess
import tempfile
try:
import winreg
except ImportError:
import _winreg as winreg
try:
import urllib.request as request
except ImportError:
import urllib ... |
import os
import vtk
import numpy as np
from PIL import Image
from vtk.util import numpy_support
from fury.utils import set_input
def load_image(filename, as_vtktype=False, use_pillow=True):
"""Load an image.
Parameters
----------
filename: str
should be png, bmp, jpeg or jpg files
as_vtk... |
from struct import pack, unpack
import cStringIO as StringIO
from StringOps import utf8Dec, utf8Enc, strToBool, base64BlockEncode, \
base64BlockDecode
from WikiExceptions import *
# ---------- Support for serializing values into binary data (and back) ----------
# Especially used in SearchAndRep... |
from werkzeug.security import check_password_hash, generate_password_hash
import mysql.connector, random
# Connect to database
db = mysql.connector.connect(
host="localhost",
user="root",
password="password",
database="testing",
auth_plugin="mysql_native_password",
charset="utf8mb4"
)
cursor =... |
# Copyright 2020, Red Hat, 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 to in writin... |
import asyncio
import math
import time
from collections import defaultdict
import aiohttp
from tabulate import tabulate
def wrap_line(s, line_width=120, sep='\n'):
ls = s.split(sep)
outs = []
for line in ls:
while len(line) > line_width:
outs.append(line[:line_width])
line... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import talib
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 30)
pd.set_option('precision', 7)
pd.options.display.float_format = '{:,... |
# coding: utf-8
######################################################################################
#
##################Out of distribution detection using InFlow##########################
# This notebook will demonstrate the training mechanism for InFlow
#
#####################################################... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
import datetime
import json
import logging
import os
import traceback
import pandas as pd
from flask import current_app
from invenio_db import db
from invenio_pidstore.resolver import Resolver
from cuor.harvester.general import insert_in_cuor
from cuor.organizations.api import OrganizationRecord
from cuor.organizatio... |
# -*- coding: utf-8 -*-
# File: resnet_model.py
import tensorflow as tf
from tensorpack.models import BatchNorm, BNReLU, Conv2D, FullyConnected, GlobalAvgPooling, MaxPooling
from tensorpack.tfutils.argscope import argscope, get_arg_scope
from tensorpack.tfutils.common import get_global_step_var
from dropblock import ... |
#!/usr/bin/env python
#
# Copyright 2012 eNovance <<EMAIL>>
#
# Author: <NAME> <<EMAIL>>
#
# 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
#
... |
"""Common utilities for creating J2CL targets and providers."""
load(":j2cl_js_common.bzl", "J2CL_JS_TOOLCHAIN_ATTRS", "create_js_lib_struct", "j2cl_js_provider")
load("//build_defs/internal_do_not_use:provider.bzl", _J2clInfo = "J2clInfo")
# TODO(b/183965899): Update references to skip this re-export and remove it.
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, <NAME> <<EMAIL>>
# Copyright: (c) 2018, <NAME> <<EMAIL>>
# 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_METADAT... |
from random import randint, choice, random, shuffle
from modules.sequence_generation import peptides
from math import ceil
from copy import deepcopy
####################################################################
# PRIVATE FUNCTIONS
###############################################################... |
#!/usr/bin/env python3
# stdlib modules
import itertools as it
import copy
# third party imports
import numpy as np
from openquake.hazardlib.geo.utils import OrthographicProjection
from openquake.hazardlib.geo import geodetic
# local imports
from impactutils.vectorutils.vector import Vector
from .utils import revers... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import OrderedDict
import os
import torch
from fairseq import options, utils
from fairseq.data import (
Dictionary,
... |
# Copyright 2017 Google 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 to in writing, ... |
"""
Custom Chaikin
https://www.investopedia.com/terms/c/chaikinoscillator.asp
https://www.investopedia.com/articles/active-trading/
031914/understanding-chaikin-oscillator.asp
Volume
**Supported environment variables**
::
# to show debug, trace logging please export ``SHARED_LOG_CFG``
# to a debug logger j... |
#!/usr/bin/env python
"""
Post-processes WormPose results by interpolating over missing frames and smoothing
"""
import glob
import logging
import os
import tempfile
from argparse import Namespace
from typing import Sequence
import h5py
import numpy as np
import numpy.ma as ma
from scipy.interpolate import interp1d
... |
#!/usr/bin/env python3
"""ROS has a parameter server, we have files.
The parameter store is a persistent key value store, implemented as a directory with a writer lock.
On Android, we store params under params_dir = /data/params. The writer lock is a file
"<params_dir>/.lock" taken using flock(), and data is stored in... |
# 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, soft... |
"""
An interface to output the data in various format
"""
import numpy
import os
import sys
from pysph.base.particle_array import ParticleArray
from pysph.base.utils import get_particles_info, get_particle_array
from pysph import has_h5py
output_formats = ('hdf5', 'npz')
COMPRESSION_LEVEL = 6
def _to_str(s):
i... |
"""Collection of functions to process mini batches."""
import numpy as np
from sklearn.preprocessing import OneHotEncoder
def invert_full_matrix_np(full_adjacency):
full_adjacency = np.squeeze(full_adjacency)
n_nodes = full_adjacency.shape[1]
full_adjacency = np.append(np.zeros([1, n_nodes]), full_adjace... |
import sys
import os
import urllib
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import pickle
from Network import nmt_model,SplitIUPAC
import unicodedata
import re
import selfies
import subprocess
import urllib.request
os.environ["CUDA_VISIBLE_DEVICES"]="2"
def main():
# Declaration of Glob... |
import os
import json
import re
#import sys
#os.chdir('recipes')
recipedir = 'recipes\\'
items = os.listdir(recipedir)
tagdir = 'tags\\items\\'
tags = os.listdir(tagdir)
def getItemName(item):
index = item.find('_from_')
if index != -1:
itemname = item[:index]
else:
itemnam... |
import argparse
import os
import random
import torch
from torch import nn, optim
from torch.optim import lr_scheduler
from torchvision import models
import load
# Create argparser
parser = argparse.ArgumentParser(description="Train a model to recognize 102 flower types")
parser.add_argument("data_dir", ... |
"""
cards
~~~~~
The module contains the basic classes used by blackjack for handling
cards.
:copyright: (c) 2020 by <NAME>
:license: MIT, see LICENSE for more details.
"""
from collections import OrderedDict
from collections.abc import MutableSequence
from copy import copy, deepcopy
from itertools import product
from... |
"""Currently, this is only a sanity-check (runnable) of spaces provided in hub."""
import random
from torchvision import transforms
from torchvision.datasets import FakeData
import pytest
import pytorch_lightning
import nni
import nni.runtime.platform.test
import nni.retiarii.evaluator.pytorch.lightning as pl
impo... |
# -*- coding: utf-8 -*-
"""
This module contains the class Population.
Created on Tue Sep 17 14:29:43 2019
@author: <NAME> (jcrvz.github.io), e-mail: <EMAIL>
"""
import numpy as np
from itertools import product as cartesian_product
from itertools import islice
__all__ = ['Population']
__selectors__ = ['all', 'greed... |
import numpy as np
from .utils import right_inverse
def linear_hermite_interpolator(locs, vals, hermite_vals):
""" Linear Hermite interpolation for regularisation.
Linear interpolation using the average of values and derivatives.
Parameters
----------
locs : (n+1)-D array-like
Location... |
#from dataloaders.DALI_video_loader import DALILoader
#from dataloaders.video_classification_dataset import VideoClassificationDataset
#from dataloaders.video_sparsesample_dataset import VideoSparsesampleDataset
#from dataloaders.frames_sparsesample_dataset import FramesSparsesampleDataset
import argparse
from pyvideo... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import subprocess
fr... |
#!/usr/bin/python
# encoding: utf-8
import re
import nltk
import sys
import getopt
import time
import math
import heapq
from Postings import get_postings
from ast import literal_eval
from nltk.stem import PorterStemmer
from Synonym import query2syn_query
from Positional import get_positional_posts
ps = PorterStemmer()... |
import inspect
import operator as op
from typing import AbstractSet, Callable, Mapping, Sequence, Tuple
import pytest
import numpy
from .. import expressions, logic
from ..expression_walker import (
ExpressionBasicEvaluator,
TypedSymbolTableEvaluator,
)
from ..expressions import Expression, Unknown, expressio... |
"""
We took the code from DC examples repository and made changes to some of the parameters and add code to store the
tensors for the fake data
https://github.com/pytorch/examples/tree/master/dcgan
"""
from __future__ import print_function
import argparse
import os
import random
import string
import torch
import torc... |
import click
import os
import platform
import json
import progressbar
from subprocess import call
from lb.classes.curl import CURLDownloadFileList
from lb.helpers.config import pass_config
from lb.helpers import file as file_helpers
"""
HELPER FUNCTIONS
"""
# make_required_folders
# Handles making the required fo... |
import time
from tqdm import tqdm
def follow(self, user_id, check_user):
user_id = self.convert_to_user_id(user_id)
if self.log_follow_unfollow:
msg = "Going to follow `user_id` {}.".format(user_id)
self.logger.info(msg)
else:
msg = " ===> Going to follow `user_id`: {}.".format(use... |
import numpy as np
from buzzard import _tools
from buzzard._footprint import Footprint
from buzzard._a_stored import AStored, ABackStored
from buzzard._a_source_raster import ASourceRaster, ABackSourceRaster
class AStoredRaster(AStored, ASourceRaster):
"""Base abstract class defining the common behavior of all ra... |
import logging
from django.conf import settings
import unicodecsv
PROJECT_ROOT = settings.PROJECT_ROOT
FIPS_DATA_PATH = (
"{}/data_research/data".format(PROJECT_ROOT))
# We have minimal data for smaller territories, so we exclude them.
# For project launch, we also excluded Puerto Rico (72) as out of scope.
NO... |
# Copyright (C) 2019 Intel Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
import board_cfg_lib
PLATFORM_HEADER = r"""/* DO NOT MODIFY THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
*/
#ifndef PLATFORM_ACPI_INFO_H
#define PLATFORM_ACPI_INFO_H
"""
PLATFORM_END_HEADER = "\n#endif /* PLAT... |
# -*- coding: UTF-8 -*-
import datetime
import github
import re
import time
import logging
class GithubOperator:
_token = ""
_client = None
admin_list = None
write_interval = 1
def __init__(self, token):
self._token = token
self._client = github.Github(self._token)
def get_r... |
# 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.
import collections
import copy
import itertools
import threading
import time
from infra_libs.ts_mon.common import errors
"""A light-weight representation ... |
import traceback
from os.path import join
from conans.client.generators.cmake_find_package import CMakeFindPackageGenerator
from conans.client.generators.cmake_find_package_multi import CMakeFindPackageMultiGenerator
from conans.client.generators.compiler_args import CompilerArgsGenerator
from conans.client.generators... |
from numpy_ringbuffer import RingBuffer
from fuzzywuzzy import process
import numpy as np
import cv2
from helpers import Singleton
from neural_network import NeuralNetwork
import sudoku_solving
@Singleton
class Sudoku:
def __init__(self):
size = (9, 9)
self.already_solved = {}
self.alread... |
# Copyright (c) 2016 by <NAME> and the other collaborators on GitHub at
# https://github.com/rmjarvis/Piff All rights reserved.
#
# Piff is free software: Redistribution and use in source and binary forms
# with or without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistribut... |
from typing import List, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
import copy
# from util.paconv_util import weight_init, assign_score, get_ed, assign_kernel_withoutk
from mani_skill_learn.paconv_all_util.paconv_util import weight_init, assign_score, get_ed, assign_kernel_withoutk
# fr... |
import logging
import os
import shutil
import warnings
from types import TracebackType
from typing import Any, Callable, Dict, List, Optional, Text, Type, Collection
import rasa.core.utils
import rasa.utils.io
from rasa.cli import utils
from rasa.cli.utils import bcolors
from rasa.constants import (
DEFAULT_LOG_LE... |
import socket
import json
from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse
from rest_framework.test import APIClient
from rest_framework import status
from rest_framework.test import APITestCase
from hs_core.hydroshare import users
from hs_core.hydroshare import resource
fro... |
# Copyright (c) 2020 <NAME>
from qtpy.QtCore import Qt
from qtpy.QtGui import QBrush, QPen
from qtpy.QtWidgets import QGraphicsRectItem
class Cell(QGraphicsRectItem):
# Receptor cell that can be used to indicate a valid target area.
def __init__(self, parent_item=None, width=10, height=10, sensitive=True):
... |
# Copyright (c) 2020 Horizon Robotics and ALF Contributors. 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... |
# Copyright (c) 2020 PaddlePaddle 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 app... |
from __future__ import absolute_import, division, print_function
import warnings
import torch
import torch.nn as nn
from torch.nn import functional as F
def sample_mask_indices(input_dim, hidden_dim, simple=True):
"""
Samples the indices assigned to hidden units during the construction of MADE masks
:p... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 13 22:45:00 2018
@author: benmo
"""
import pandas as pd, numpy as np, dask.dataframe as ddf
import quandl
import sys, os, socket
import pickle
from dask import delayed
from difflib import SequenceMatcher
from matplotlib.dates import bytespdate2num, num2date
from matplotl... |
from __future__ import absolute_import
from __future__ import unicode_literals
import json
import logging
import os
import re
import sys
import six
from docker.utils.ports import split_port
from jsonschema import Draft4Validator
from jsonschema import FormatChecker
from jsonschema import RefResolver
from jsonschema i... |
import torch
import torch.nn as nn
from torch.distributions.categorical import Categorical
from torch.optim import Adam
import numpy as np
import gym
from gym.spaces import Discrete, Box
import time
def mlp(sizes, activation=nn.Tanh, output_activation=nn.Identity):
# Build a feedforward neural network.
layers ... |
import imio
import tifffile
import logging
import numpy as np
import pandas as pd
import bg_space as bgs
from pathlib import Path
from imlib.IO.cells import get_cells
from imlib.pandas.misc import sanitise_df
from imlib.general.system import ensure_directory_exists
from cellfinder.export.to_brainrender import export... |
#!/usr/bin/python
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
Element Software Account Manager
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
#
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD.
# See https://nomad-lab.eu for further info.
#
# 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/lic... |
#!/usr/bin/env python
"""Sample script of recurrent neural network language model.
This code is ported from the following implementation written in Torch.
https://github.com/tomsercu/lstm
"""
from __future__ import division
from __future__ import print_function
import argparse
import json
import warnings
import nump... |
# 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
# distributed under th... |
# Import required libraries
import argparse
import sys
import os
sys.path.append('../')
sys.path.append('../source_code')
import gi
import configparser
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
from gi.repository import GLib
from ctypes import *
import time
import sys
import math
import p... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
"""Methods to extract the data for the given usernames profile"""
import math
from time import sleep
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from insgraph.util.extractor_posts import extract_post_info
from .exceptions import PageNotFound404, NoInst... |
from contextlib import contextmanager
import textwrap
from . import batch
from . import schemaobj
from .. import util
from ..util import sqla_compat
from ..util.compat import exec_
from ..util.compat import inspect_formatargspec
from ..util.compat import inspect_getargspec
__all__ = ("Operations", "BatchOperations")
... |
from fathom import Point, ORIGIN
from fathom.tikz import Canvas
import fathom.geometry as geo
import fathom.layout as layout
import fathom.tikz.colors as colors
from itertools import *
BRANCH = 3
class Inner:
SEG_WIDTH = 0.5
LEFTMOST_WIDTH = 0.3
KEY_HEIGHT = 0.5
PTR_HEIGHT = 0.3
def __init__(self... |
import os
import numpy as np
import tensorflow as tf
from cuda import custom_ops
def _get_plugin():
loc = os.path.dirname(os.path.abspath(__file__))
cu_fn = 'upfirdn_2d.cu'
return custom_ops.get_plugin(os.path.join(loc, cu_fn))
def _setup_kernel(k):
k = np.asarray(k, dtype=np.float32)
if k.ndim ... |
# -*- coding: utf-8 -*-
import gensim
from copy import deepcopy
from gensim.models.word2vec import Word2Vec, train_sentence_sg, Vocab
from numpy import exp, dot, zeros, outer, random, dtype, float32 as REAL,\
uint32, seterr, array, uint8, vstack, argsort, fromstring, sqrt, newaxis,\
ndarray, empty, sum as np_su... |
import director.vtkAll as vtk
import director.objectmodel as om
from director import lcmUtils
#------ Individual Collections To Be Rendered--------------------
class CollectionInfo():
def __init__(self, collectionId, collectionName, collectionType, collectionShow):
self.id = collectionId
self.na... |
''' changed from the initial input file
to represent a simplified model for the FHR core
The simulation has 3 stages:
- initial temperature without feedback
- turn on feedback
- turn on external reactivity
'''
from pyrk.utilities.ur import units
from pyrk import th_component as th
import math
from pyrk.materials.mater... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import get_datetime, flt
from erpnext.accounts.doctype.pos_closing_entry.pos_closing_entry import POSClosingEntry
from datetime import datetime
from frappe.utils import time_diff_in_hours, add_to_date,get_time,get_date_str, get... |
import itertools
example = '''--- scanner 0 ---
404,-588,-901
528,-643,409
-838,591,734
390,-675,-793
-537,-823,-458
-485,-357,347
-345,-311,381
-661,-816,-575
-876,649,763
-618,-824,-621
553,345,-567
474,580,667
-447,-329,318
-584,868,-557
544,-627,-890
564,392,-477
455,729,728
-892,524,684
-689,845,-530
423,-701,434... |
from pathlib import Path
from networkx.algorithms.operators.unary import reverse
import numpy as np
import napari
import pickle
import networkx as nx
from tqdm import tqdm
import os
from napari_animation import AnimationWidget
from brainlit.utils.Neuron_trace import NeuronTrace
import zarr
scale = [0.3, 0.3, 1]
num = ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: expreplay.py
# Author: <NAME> <<EMAIL>>
# Modified: <NAME> <<EMAIL>>
import six
import copy
import threading
import numpy as np
from six.moves import queue, range
from collections import deque, namedtuple
from tensorpack.utils import logger
from tensorpack.dataflo... |
import numpy as np
import os.path as osp
from rllab import spaces
from rllab.envs.base import Env
from rllab.misc.overrides import overrides
from rllab.mujoco_py import MjModel, MjViewer
from rllab.misc import autoargs
from rllab.misc import logger
import theano
import tempfile
import os
import mako.template
import ma... |
import datetime
import json
from StringIO import StringIO
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.serializers import json as djson
from django.utils.encoding import force_unicode
from tastypie.bundle import Bundle
from tastypie.exceptions import Unsuppor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.