text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python
"""
Calculates er/dr and ee/de.
Supported filetypes:
* MacroModel conformational search .log files. NOTE: Use MacroModel's redundant
conformer elimination before using this. For whatever reason, the energies
reported by MacroModel's conformational search are inaccurate.
* Schrodinger .mae... |
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import math
import globals
def grayscale(img):
"""Applies the Grayscale transform
This will return an image with only one color channel
but NOTE: to see the returned image as grayscale
(assuming your graysca... |
import json
import re
import sys
from ISO_model.scripts.lib.util import re_match_nonoverlap
from ISO_model.scripts.parsers.parser import Parser
class EmfModelParser(Parser):
re_annotation = re.compile('@(\w+)\s*')
re_namespace = re.compile(r'@namespace\(.*\)')
re_comment_block = re.compile(r'/\*(?:(?:[^... |
import pandas as pd
import sqlalchemy as sa
import sqlalchemy.dialects.mysql as mysql
from ibis.sql.alchemy import (unary, fixed_arity, infix_op,
_variance_reduction)
import ibis.common as com
import ibis.expr.types as ir
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops... |
import os
import sys
import statistics
import csv
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.ArgumentTypeError('Boole... |
from .testutils import eq_
from unittest import TestCase
import pytest
from rdflib import BNode, Graph, Literal, Namespace, RDFS, XSD
from rdflib.plugins.sparql.operators import (
register_custom_function,
unregister_custom_function,
)
EX = Namespace("http://example.org/")
G = Graph()
G.add((BNode(), RDFS.lab... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 4 10:31:47 2018
@author: arndt
"""
import numpy as np
import pandas as pd
from sklearn.ensemble import BaggingClassifier
import sklearn.metrics as skm
from os import chdir
chdir("/home/arndt/git-reps/hatespeech/")
df_test = pd.merge(pd.read_csv("... |
import argparse
import matplotlib
import matplotlib.pyplot as plt
plt.rcParams["font.family"] = "serif"
# plt.rcParams["text.usetex"] = True
# plt.rcParams.update({
# "text.usetex": True,
# "font.family": "serif",
# "font.sans-serif": ["Palatino"]})
import matplotlib.cm as cm
import matplotlib.ticker as ... |
"""
Copyright (c) 2020 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublic... |
"""Code for training and testing UW-Net.
Author: <NAME> (<EMAIL>)
"""
import os
import csv
import json
import click
import random
import numpy as np
import tensorflow as tf
import skimage.io as io
from random import shuffle
from datetime import datetime
from skimage.io import imsave
os.environ["CUDA_DEVICE_ORDER"]="... |
import re
import logging
from dbt.api.object import APIObject
from dbt.contracts.project import VERSION_SPECIFICATION_CONTRACT
from dbt.exceptions import VersionsNotCompatibleException
import dbt.utils
logger = logging.getLogger(__name__)
_MATCHERS = r"(?P<matcher>\>=|\>|\<|\<=|=)?"
_NUM_NO_LEADING_ZEROS = r"(0|[1-9... |
# ====================================================
# メイン処理
# ====================================================
package_path = './FMix-master'
import sys; sys.path.append(package_path)
"""
import sys
package_path = '../input/pytorch-image-models/pytorch-image-models-master' #'../input/efficientnet-pytorch-07/ef... |
"""
Record field data functions to support entity data testing
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
__author__ = "<NAME> (<EMAIL>)"
__copyright__ = "Copyright 2014, <NAME>"
__license__ = "MIT (http://opensource.org/licenses/MIT)"
impo... |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
"""
Example: 2d toy distribution with SteinVI
===================================================
In this example we infer a 2d star distribution with the different kernels available for SteinVI.
"""
import argparse
from functools impo... |
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import torch
import torch.nn as nn
import torch.optim as optim
from kaldi_fft_dataset import FftDataloader, FrameDataset
#from speech_utils import print_with_time
import hashlib
import numpy as np
from tensorboardX import SummaryWriter
import torchvision.utils as vuti... |
import os
import base64
from unittest import TestCase
import eventlet
eventlet.monkey_patch()
import psycopg2
import psycopg2.extensions
import requests
from pyinfraboxutils.db import DB, connect_db
from pyinfraboxutils.token import encode_project_token
from pyinfraboxutils.ibopa import opa_push_all
conn = connect_... |
from django.shortcuts import render
from django.http import HttpResponse,HttpResponseRedirect
from django.template import loader
from .models import *
import json
from django.contrib.auth.decorators import login_required
# import datetime
from django.utils import timezone
from django.views.decorators.csrf import csrf_e... |
from __future__ import annotations
import numpy as np
import torch
import torch.nn.functional as F
from dnnv.nn import Operation, OperationGraph, OperationVisitor, operations
def convert(op_graph: OperationGraph) -> PytorchModel:
converter = PytorchConverter()
for op in op_graph.output_operations:
_ ... |
from urllib.request import urlopen
import json
from . import util
import random
import io
import mutagen
from concurrent import futures
from ssl import SSLContext
ssl_verify=True
def get_ssl_setting():
if ssl_verify:
return None
else:
return SSLContext()
def get_url(url):
return urlopen(u... |
import sys
import numpy
import pandas as pd
import constants as kk
from pyswarm import pso
import os
import input
import datetime as dt
def preparation():
project_path = 'C:\\Users\\FrancescoBaldi\\switchdrive\\Work in progress\\Paper 0\\Ecos2015PaperExtension\\'
path_files = project_path + os.sep
sys.pat... |
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import TensorDataset, DataLoader, Dataset, WeightedRandomSampler
from torch.optim.lr_scheduler import St... |
# -*- coding: utf-8 -*-
#
# Copyright (C)2005-2009 Edgewall Software
# Copyright (C) 2005 <NAME> <<EMAIL>>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki... |
"""
Copyright (c) 2022 <NAME>, <NAME>, <NAME>, <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publ... |
#!/usr/bin/env python
# coding: utf-8
"""
Utilities to generate channels defined by their Kraus operators,
and convert them to Choi state matrix if needed.
Output format is systematically an array of shape (r, d, d),
where r is the rank of the channel, d is the dimension of the underlying
Hilbert space and each (d, ... |
"""Imports covidcast CSVs and stores them in the epidata database."""
# standard library
import argparse
import os
# first party
from delphi.epidata.acquisition.covidcast.csv_importer import CsvImporter
from delphi.epidata.acquisition.covidcast.database import Database, CovidcastRow
from delphi.epidata.acquisition.co... |
HW_SOURCE_FILE = 'hw03.py'
#############
# Questions #
#############
def has_seven(k):
"""Returns True if at least one of the digits of k is a 7, False otherwise.
>>> has_seven(3)
False
>>> has_seven(7)
True
>>> has_seven(2734)
True
>>> has_seven(2634)
False
>>> has_seven(734)... |
"""Implementation of sample attack."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import numpy as np
from scipy.misc import imread
from scipy.misc import imsave
import tensorflow as tf
from nets import inception_v3, inception_v4... |
#
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and r... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2021 <NAME> | Epistasis Lab | University of Pennsylvania
DIGEN was developed at the University of Pennsylvania by <NAME> (<EMAIL>)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"... |
from typing import List
class Item:
name: str
pattern: str
expected: int
index: int
offset: int
def __init__(self, pattern: str, name: str = '', expected: int = 1, index: int = 0, offset: int = 0) -> None:
self.name = name
self.pattern = pattern
self.expected = expected... |
# -*- coding: utf-8 -*-
import os
import sys
import time
import numpy
import random
import pickle
import tensorflow as tf
from pre import prepare_data
from settings import *
from model import *
from utils import *
from data_iterator import DataIterator
best_auc = 0.0
def eval(sess, test_data, model, model_path):
... |
# 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.
import math
import torch
import torch.optim
from ncc.optimizers import register_optimizer
from ncc.optimizers.ncc_optimizer import NccOptimiz... |
# _*_ coding:utf-8 _*_
from keras.applications.resnet50 import ResNet50
from keras import layers
from keras.layers import Dense
from keras import utils
from keras.models import Model
from keras import backend as K
from .attention_module import attach_attention_module
# from . import get_submodules_from_kwargs
# from... |
from __future__ import annotations
import asyncio
import threading
from anytree import NodeMixin
from blox_old.core.block.base import Port, _Block, _BlockPortsSection
from blox_old.utils import maybe_error, maybe_raise
import uuid
import typing as T
from itertools import chain
from more_itertools import prepend
from sc... |
import math
import os
import random
import re
import cv2
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data
from torch.autograd import Variable
from torchvision import transforms
import imutils
import utils
from base_class import Bas... |
from apex import amp
import logging, imp
import random
import os
import sys
import warnings
import argparse
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
import gtg
import net
import data_utility
import utils
from RAdam import RAdam
import argparse
import random
def rnd(low... |
"""
This file serves as a playground for understanding some of the concepts used
in the development of the DeepDream algorithm.
"""
import time
import os
import numpy as np
import scipy.ndimage as nd
import matplotlib.pyplot as plt
import torch
import cv2 as cv
from torchvision import transforms
from utils... |
# Copyright (c) 2019, <NAME>ATION.
# 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... |
#!/usr/bin/env python3
import argparse
import operator
import threading
import numpy as np
from time import sleep
import cv2
import depthai as dai
import socket
from common.config import NN_IMG_SIZE
from common.cscore_stream import CsCoreStream
from pipelines import goal_edge_depth_detection, object_edge_detection
i... |
from __future__ import unicode_literals, print_function
import json
import re
from arpeggio import EOF, Optional, OneOrMore, OrderedChoice, ParserPython, PTNodeVisitor, visit_parse_tree, RegExMatch, UnorderedGroup, ZeroOrMore
from datetime import datetime
from ..utils import toStr, Utils
# For windows
lineSep = '\\r... |
"""Maintenance related commands."""
from sqlalchemy import distinct
from telegram.ext import run_async
from datetime import datetime, timedelta
from stickerfinder.helper.sticker_set import refresh_stickers
from stickerfinder.helper.keyboard import admin_keyboard
from stickerfinder.helper.session import session_wrapper... |
"""
File: evaluate.py
Project: analysis
Last Modified: 2021-8-2
Created Date: 2021-8-2
Copyright (c) 2021
Author: AHMA project (Univ Rennes, CNRS, Inria, IRISA)
"""
################################################################################
import sys, os, glob
import logging
import numpy ... |
import yaml
import pandas as pd
import numpy as np
from numpy import nan
import os, sys
import re
import json
from EDL.dialogue.MatEngine_object import eng1
from EDL.dialogue.func_helpers import CalculateFuncs
eng1.addpath('/Volumes/Encrypted/Mars2020/mars2020/MATLAB/', nargout=0)
eng1.addpath('/Users/ssantini/Code/E... |
from datetime import datetime
from itertools import chain
from _sha256 import sha224
from uuid import uuid4
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from django.core.exceptions import ObjectDoesNotExist
from django.db import models, transaction
from ngnotifier.utils import hash_over, p... |
#-------------------------------------------------------------------------------
# Name: logger.py
# Purpose: ロガー生成用モジュール.
#
# Author: shikano.takeki
#
# Created: 13/12/2017
# Copyright: (c) shikano.takeki 2017
# Licence: <your licence>
#--------------------------------------------------------... |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... |
import os
import datetime
import argparse
import torch
import numpy as np
import torch.utils.data as data
from torch.utils.tensorboard import SummaryWriter
from cmu_mosei import CMUMOSEIDataset
from networks import *
from main_utils import train, validation
from torch.optim.lr_scheduler import ReduceLROnPlateau
import ... |
import pandas as pd
import numpy as np
import networkx as nx
from random import randint
from tqdm import tqdm
class MultibindDriver(object):
def __init__(self, multibind):
if not type(multibind.states) is None and not type(multibind.graph) is None:
self.multibind = multibind
else:
... |
# for localized messages
from . import _
# GUI (Screens)
from Components.ConfigList import ConfigListScreen
from Screens.MessageBox import MessageBox
from Screens.Screen import Screen
from Plugins.SystemPlugins.Toolkit.NTIVirtualKeyBoard import NTIVirtualKeyBoard
# GUI (Summary)
from Screens.Setup import SetupSummary... |
# Copyright (c) 2019 <NAME>
#
# This file is part of the bamboo library. It is currently hosted at
# https://github.com/mvilim/bamboo
#
# 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
#
# ... |
#test.py
import sys
import maya.cmds as cmds
import numpy as np
import scipy as sp
import functools
from scipy.spatial import Voronoi, voronoi_plot_2d
from scipy.spatial import Delaunay
import math
from anytree import Node, RenderTree, NodeMixin
def createUI( pWindowTitle, pApplyCallback) :
windowID = 'myWi... |
from __future__ import absolute_import, division, print_function
from collections import defaultdict, namedtuple
import logging
import os
import pytest
import torch
from torch.autograd import Variable
import pyro
import pyro.distributions as dist
from pyro.infer.mcmc.hmc import HMC
from pyro.infer.mcmc.mcmc import M... |
'''IOSXE execute functions for platform'''
# Python
import re
import logging
import time
# pyATS
from pyats.utils.fileutils import FileUtils
# Genie
from genie.utils import Dq
from genie.harness.utils import connect_device
from genie.utils.timeout import Timeout
from genie.metaparser.util.exceptions import SchemaEmp... |
#!/usr/bin/env python
"""
Example of a daemon listening for values from my main power-meter and resend them on a MQTT bus.
This example will not be able to run as it is - but it will hopefully give you some
ideas to how you can define DPT, and get their converted values, and even send them to MQTT
in a tested topic-fo... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
"""
Unit tests for evaluation operations, each operation is tested for
the forward ... |
"""
This application demonstrates how to create a Tag Template in Data Catalog,
loading its information from a CSV file.
"""
import argparse
import csv
import logging
import re
import stringcase
import unicodedata
from google.api_core import exceptions
from google.cloud import datacatalog
from google.cloud.datacatalog... |
import math
import torch
from torch.autograd import Variable
import torch.nn.functional as F
from torch import nn
from PIL import Image
from torchvision import transforms
from torchvision import utils as vutils
from MFCN.tools import extract_image_patches,\
reduce_mean, reduce_sum, same_padding
class DMFB(nn.Mod... |
"""Tests for the example_cmatools module.
Tests have been added to cover the code provided by the module used to illustrate
codestyle examples.
"""
import types
import pytest
from cmatools.examplesubpackage.example_cmatools import (
ExampleClassAnother,
ExampleCMAClass,
ExampleCMAError,
example_gen... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Importance sampling with the snowball proposition distribution in O(k_max x T).
Author: <NAME> <<EMAIL>>
"""
import networkx as nx
import numpy as np
# Global status dict
status = {"unexplored": 0,
"boundary": 1,
"explored": 2}
class History(ob... |
import json
import logging
from contextlib import suppress
from datetime import datetime, timedelta, timezone
from operator import attrgetter
from typing import Optional
from async_rediscache import RedisCache
from discord import TextChannel
from discord.ext import commands, tasks
from discord.ext.commands import Cont... |
from abc import ABC, abstractmethod
MISSING = object()
ADDR_NONE = 0
class Ref:
def __init__(self, addr=ADDR_NONE, target=MISSING):
assert isinstance(addr, int)
self.addr = addr
self.target = target
@classmethod
def transform(cls, current, data, key):
return cls(target=da... |
"""
These tools are probably there because I needed very quick test of relatively computationally expensive shits that will get ported to cpp when I'll have time to actually compile stuffs.
best,
Boris
"""
import numpy as np
import numba as nb
import math
M_PI = np.pi
# @nb.jit(nopython = True)
# def thin_perimeter_f... |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from functools import partial
from flask import request
from wtf... |
from program import *
from random import random, choice
# no-operations
def nop0(ind): ind.ip += 1
def nop1(ind): ind.ip += 1
# flip bit
def or1(ind): ind.cx ^= 1; ind.ip += 1; regcheck(ind)
# shift left
def sh1(ind): ind.cx <<= 1; ind.ip += 1; regcheck(ind)
# reset register
def zero(ind): ind.cx ^= ind.cx; ind.ip += ... |
# @file repo_resolver.py
# This module supports git operations (git repos).
##
# Copyright (c) Microsoft Corporation
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
import os
import logging
from edk2toolext import edk2_logging
from edk2toolext.edk2_git import Repo
from edk2toollib.utility_functions import RemoveTr... |
from scipy import stats
import os
import pandas as pd
"""
Preprocess PubMed abstracts or MIMIC-III reports
"""
import re
import json
from nltk import sent_tokenize, word_tokenize
SECTION_TITLES = re.compile(
r'('
r'ABDOMEN AND PELVIS|CLINICAL HISTORY|CLINICAL INDICATION|COMPARISON|COMPARISON STUDY DATE'
r... |
# 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, overload
from ... import _utilities
__... |
#coding:utf-8
#
# PROGRAM/MODULE: firebird-base
# FILE: firebird/base/logging.py
# DESCRIPTION: Context-based logging
# CREATED: 14.5.2020
#
# The contents of this file are subject to the MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software ... |
# octree的具体实现,包括构建和查找
import random
import math
import numpy as np
import time
from result_set import KNNResultSet, RadiusNNResultSet
# 节点,构成OCtree的基本元素
class Octant:
def __init__(self, children, center, extent, point_indices, is_leaf):
self.children = children
self.center = center
self.e... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
import copy
import numpy as np
from .problem import LpProblem
from .solve import LpSolve
from .solver import LpSolver
class SimplexMethod(LpSolver):
""" 单纯形(表)法
待解决应符合标准型,即:
<math>
max z = c^T * x
s.t. a*x = b, x >= 0, b > 0
</math>
单纯形算法参考:https://zh.wikipedia.org/zh-hans/单纯形法... |
# Copyright 2018 Google Inc.
#
# 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 the following disclaimer.
#
#... |
"""
This module hanles configuration related stuff
"""
from builtins import object
import os.path as op
from . import conf_endpoints as scmc
from . import data_input_endpoints as scmdi
from . import property_endpoints as scmp
from . import request as req
def conf_file2name(conf_file):
conf_name = op.basename(co... |
"""
Pre-train a CNN on the whole dataset for evaluation purpose
"""
import os
import argparse
import shutil
import timeit
import torch
import torchvision
import torchvision.transforms as transforms
import numpy as np
import torch.nn as nn
import torch.backends.cudnn as cudnn
import random
import matplotlib.pyplot as ... |
#======================================================
# Test transfer learning
#======================================================
'''
Info:
Version: 1.0
Author: <NAME>
Created: Sunday, 29 September 2019
'''
# Import modules
import argparse
import os
import sys
import threading
import time
from ... |
# coding: utf-8
# In[1]:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# In[2]:
# Import data
from tensorflow.examples.tutorials.mnist import input_data
# In[3]:
import tensorflow as tf
import numpy as np
import os
from PIL import Image
# In[4]:
... |
from .fields import ListField, SetField, DictField, EmbeddedModelField
from django.db import models, connections
from django.db.models import Q
from django.db.models.signals import post_save
from django.db.utils import DatabaseError
from django.dispatch.dispatcher import receiver
from django.test import TestCase
from d... |
import torch
from siamfc.fdsiamfc import TrackerFDSiamFC
import scipy.io as scio
def single_kernel_simplify(conv_weight, conv_bias, squeeze_weight, squeeze_bias):
# 在没有分组的情况下,使用如下部分代码可以实现压缩后的卷积层的转换。
sw = squeeze_weight.permute(2, 3, 0, 1)
cw = conv_weight.permute(2, 3, 0, 1)
weight = torch.ma... |
#!/usr/bin/env python
#
# Copyright (c) 2016 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... |
import numpy as np
import torch
from scipy import special as sp
from NVLL.util.util import GVar
class vMF(torch.nn.Module):
def __init__(self, lat_dim, kappa=0):
super().__init__()
self.lat_dim = lat_dim
self.func_mu = torch.nn.Linear(lat_dim, lat_dim)
self.kappa = kappa
s... |
# This file is part of CPAchecker,
# a tool for configurable software verification:
# https://cpachecker.sosy-lab.org
#
# SPDX-FileCopyrightText: 2007-2020 <NAME> <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import collections
import sys
sys.dont_write_bytecode = True # prevent creation of .pyc... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 25 04:20:00 CEST 2016
@authors: <NAME>, <NAME>
@email: juancarlos.entizne01[at]estudiant.upf.edu,
juanluis.trincado[at]upf.edu
"""
import os
import logging
from itertools import islice
from sklearn.cluster import DBSCAN
from collections import defaultdict
from sk... |
import numpy as np
from datayoink.coordconverter import get_axis_info, get_step, get_x_scale, pixel_to_coords, closest,\
unify_x, get_pixels_2d, create_pixel_dict, create_coordinate_dict, get_start_end
def test_get_axis_info():
"""
Tests the get_axis_info function
"""
... |
# Copyright (c) <2021> Side Effects Software Inc.
# 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,
# thi... |
# Copyright (c) 2018 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... |
# 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 the... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Script that contains 3 functions. These are to be used if we want to proceed to merging of thin layers of the firn column.
I suggest we specify in json input if merge is true/false and the thickness threshold ('merge_min'):
"merging": true,
"merge_min": 5e-3
merges... |
"""
SharedEmbeddings is inspired by the TabTransformer available in AutoGluon:
https://github.com/awslabs/autogluon/tree/master/tabular/src/autogluon/tabular/models/tab_transformer
"""
import math
import warnings
import torch
from torch import nn
from pytorch_widedeep.wdtypes import * # noqa: F403
from pytorch_wide... |
"""
MODFLOW 6 Autotest
Test the bmi which is used update to set the river stages to
the same values as they are in the non-bmi simulation.
"""
import os
import numpy as np
from modflowapi import ModflowApi
try:
import pymake
except:
msg = "Error. Pymake package is not available.\n"
msg += "Try installing u... |
# coding=utf-8
import codecs
import csv
import logging
from contextlib import closing
from datetime import timedelta, datetime
from decimal import Decimal
import requests
from dateutil.parser import parse
from django.contrib.gis.geos import GEOSGeometry
from django.db.utils import IntegrityError
from psycopg2.extras i... |
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from torch.autograd import Variable
from torch.nn import init
Tensor = torch.cuda.FloatTensor
def kl_loss(z_mean, z_stddev):
mean_sq = z_mean * z_mean
stddev_sq = z_stddev * z_stddev
return 0.5 * torch.mean(mean_sq + st... |
"""
produces a more generalised diagnostic over multiple runs using multiple
numbers of agents for arc_ukf.py only.
This produces a chloropleth style map showing the grand mean error
over both time and agents for various fixed numbers of agents
and proportions observed.
import data from arc with following in b... |
"""This program sets up and displays a puzzle based on the game
Ricochet Robots. The solve() method contains code to compute the solution to the puzzle."""
path_to_file_containing_puzzle = "test"
from Robot import Robot
from Robot import Node
import time
def solve():
"""This method will compute and return... |
# This is a script that analyses the multimode simulation results.
# This simulates a RZ multimode periodic plasma wave.
# The electric field from the simulation is compared to the analytic value
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from pywarpx import picmi
const... |
# WorldState.py
from Tools import *
import commonVar as common
import statistics
def checkHayekianPrices(a):
# list a not empty
if a!=[]: m = statistics.mean(a)
else: m = -100 # -100 will not appear in graphs
# and with at least one element
if len(a)>1: sd = statistics.stdev(a)
else: sd=-100 # ... |
from __future__ import unicode_literals
from django.db import models
from django.core.validators import *
from django.contrib.auth.models import User, Group
from django.contrib import admin
import base64
# Create your models here.
class Experiment(models.Model):
"""
This is a Experiment record for storing E... |
import unittest, responses, requests, json, mock
from urlparse import parse_qsl, parse_qs
from kong_plugin import KongPlugin, ModuleHelper, main
from ansible.module_utils.basic import *
mock_kong_admin_url = "http://192.168.99.100:8001"
class KongPluginTestCase(unittest.TestCase):
def setUp(self):
self.api = Ko... |
from sacred import Experiment
import logging
import sys
import os
from os.path import join
import pickle as pkl
import numpy as np
import matplotlib.pyplot as plt
import tqdm
from multiprocessing import Pool
from src.eval_utils import iou_numpy as iou
from configuration import CONFIG
from src.MetaSeg.functions.in_out ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.