text stringlengths 3.07k 22.1k |
|---|
from torchvision import datasets, transforms
from . import SEMI_DATASET_REGISTRY
from typing import Callable, Optional, Tuple, List, Union, Type
from torch.utils.data import Dataset, Subset, DataLoader
from torchvision.datasets import CIFAR10, SVHN, MNIST, ImageFolder
from torchvision import transforms as tf
from torch... |
import socket
import threading
import select
import time
from message import Message
from instructions import Instruction
from cards import Deck
class Server:
MAX_CONCURRENT_REQUESTS = 4
UPDATE_FREQUENCY = 1000
SEND_RATE = 50
class Flags:
SHUTDOWN_SERVER = 1
def __init__(self, address, v... |
# <NAME> RA:1901257
# <NAME> Trindade RA: 1901257
# <NAME> RA: 1902349
class Escola:
def __init__(self, nome):
self.nome = nome
self.casas = []
def incluir_casa(self, casa):
self.casas.append(casa)
class Casa:
def __init__(self, nome, animal):
self.nome = nome
se... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 18 19:25:17 2021
@author: kervi
"""
import numpy as np
import math
from scipy.optimize import fsolve
import matplotlib.pyplot as plt
import pandas as pd
from scipy.integrate import odeint
from scipy.optimize import minimize
from scipy.interpolate import interp1d
import ... |
"""
Defines some useful functions for the estimation of transfer functions
"""
import numpy as np
import matplotlib.pyplot as pl
import scipy.signal as sig
def tfe_sig(y, x, *args, **kwargs):
"""estimate transfer function from x to y,
see csd for calling convention"""
fxy, sxy = sig.csd(y, x, *args, *... |
###########################################################################
#
# Copyright 2020 Google LLC
#
# 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/l... |
from sympy.combinatorics.free_groups import free_group, FreeGroup
from sympy.core import Symbol
from sympy.testing.pytest import raises
from sympy import oo
F, x, y, z = free_group("x, y, z")
def test_FreeGroup__init__():
x, y, z = map(Symbol, "xyz")
assert len(FreeGroup("x, y, z").generators) == 3
asse... |
"""
Types for simulation constituents.
The simulation needs a few things with different combinations of some basic
capabilities. This module contains base classes for these:
- `Loadable` objects can be added to the simulation using their `load
<Loadable.load>` function, or equivalently `Simulation.load`. Thi... |
import re
import unicodedata
from nltk.stem.snowball import SnowballStemmer
from os.path import join, dirname
script_file_path = dirname(__file__)
__contractions_filename = join(script_file_path, "conf", "contractions.txt")
__abbreviations_filename = join(script_file_path, "conf", "abbreviations_wikipedia_pt_and_manu... |
#3 layer Neural Network: Input layer=1; Output layer:1; Hidden layers=1;
import numpy as np
def nonlin(x,deriv=False):
if(deriv==True):
return x*(1-x)
return 1/(1+np.exp(-x))#Computing g(x).
def J(theta,n,m,lamda,y,a3):
Sigma1=0
Sigma2=0
test=0
for i in range(m):
for k in rang... |
import logging
import nipype.pipeline.engine as pe
from pkg_resources import resource_filename as pkgr
from nipype.interfaces import ants, utility as niu
from nipype.utils.filemanip import split_filename
from qsiprep.interfaces import anatomical
from qsiprep.interfaces.bids import QsiReconIngress, ReconDerivativesDataS... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy
import logging
import torch
from torch.utils.data import TensorDataset, DataLoader, SequentialSampler
from pytorch_pretrained_bert.tokenization import BertTokenizer, BasicTokenizer
from pytorch_p... |
# encoding: utf-8
"""
@author: wuyiming
@contact: <EMAIL>
@function: Implementation of Self-paced Contrastive Learning with Hybrid Memory for Domain Adaptive Object Re-ID
"""
import logging
import os
import sys
sys.path.append('.')
import time
from fvcore.common.checkpoint import Checkpointer
import torch
from fast... |
import numpy as np
import utiltools.robotmath as rm
import trimesh.transformations as tf
from panda3d.core import *
class Rigidbody(object):
def __init__(self, name = 'generalrbdname', mass = 1.0, pos = np.array([0,0,0]), com = np.array([0,0,0]),
rotmat = np.identity(3), inertiatensor = np.identit... |
# -*- coding: utf-8 -*-#
# -------------------------------------------------------------------------------
# Name: monitor_engine
# Description:
# Author: Chenxiyuxiao
# Date: 2020/7/20
# -------------------------------------------------------------------------------
import datetime
import time
... |
#! /usr/bin/env python
"""OData core elements"""
import warnings
from .. import rfc4287 as atom
from ..http import grammar
from ..http import params
from ..pep8 import MigratedClass, old_method
from ..xml import namespace as xmlns
from . import csdl as edm
from . import edmx
from . import core
# Legacy name for co... |
import json
import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from PIL import ImageOps
from torchvision import datasets, transforms
import activations
import models
import visualize
AFS = list(activations.__class_dict__.keys())
MODELS = list(m... |
import json
import sys
import utils
import match
import refMaps
printAdlDetail = False
printAdlStr = False
lang = ""
matched1 = 0
matched2 = 0
adlStr1 = 0
adlStr2 = 0
adlDetail1 = 0
adlDetail2 = 0
unmatched1 = 0
unmatched2 = 0
'''
Given a node, mark it and all of its children recursivley, until we reach the leaves
'... |
# This be the place for yer fractal functions!
# <NAME> - 10/31/18
import simplejson as j
import codecs
import re
import utility as util
import random
def read_input_to_var(f):
with open(f, 'r') as my_file:
s = my_file.read()
my_in = j.loads(s)
return my_in
# Get the correct sequence given the st... |
import ast
import h5py
import numpy
import scipy.linalg
import sys
from pyscf import fci
from afqmctools.utils.io import to_qmcpack_complex, add_group, add_dataset
def write_wfn_mol(scf_data, ortho_ao, filename, wfn=None,
init=None, verbose=False):
"""Generate QMCPACK trial wavefunction.
Par... |
########################################################################################################################
# Module: ssm/linear_gaussian/linear_gaussian.py
# Description: Linear TemporalGaussian state-space models
#
# Web: https://github.com/SamDuffield/mocat
##############################################... |
#!/usr/bin/env python
from __future__ import unicode_literals, print_function
import sys, os
import pybindgen
from pybindgen import typehandlers
from pybindgen.typehandlers import codesink
from pybindgen.typehandlers.base import Parameter, ReturnValue
from pybindgen.function import Function
from pybindgen.module impo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 15 22:04:25 2020
@author: lukepinkel
"""
import numpy as np
import pandas as pd
from ..utilities.linalg_operations import vec, invec, vecl, vdg
from ..utilities.special_mats import kmat
def vgq_cf(L, gamma):
'''
VgQ subroutine for crawf... |
"""Pareto tail indices plot."""
import warnings
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.colors import to_rgba_array
import matplotlib.cm as cm
import numpy as np
from xarray import DataArray
from .plot_utils import (
_scale_fig_size,
get_coords,
color_from_dim,
format_c... |
import sys
from functools import partial
from typing import Callable
import qcelemental as qcel
from .exceptions import TestComparisonError, UpgradeHelper
__all__ = [
"compare",
"compare_integers",
"compare_strings",
"compare_values",
"compare_arrays",
"compare_recursive",
"compare_molrec... |
#IMPORTING REQUIREMENTS
from flask import Flask
from flask import render_template
import pandas as pd
import numpy as np
from flask import request
from flask import redirect
from flask import url_for
import os
import time
import FileWatch
from FileWatch import watch_file
import AnalysisHelper
#ASSINGNING APP AS__NAM... |
from typing import Any, List, NamedTuple, Optional, Set, Tuple, cast
import EoEfunc as eoe
import vapoursynth as vs
from havsfunc import LSFmod
from lvsfunc.kernels import Bicubic
from lvsfunc.types import Range
from lvsfunc.util import replace_ranges
from vardefunc.aa import Eedi3SR, Nnedi3SS, upscaled_sraa
from vard... |
import librosa
import numpy as np
import matplotlib.pyplot as plt
import time
#experimental: checking energy levels to see if the user actually mimics what they 'should' mimic
from check_energy_sim import check_energy, find_peaks_valleys
#analyses used to see if pitches are similar or not - this is how the similarity... |
# -*- coding: utf-8 -*-
"""\
Test the natsort command-line tool functions.
"""
from __future__ import print_function, unicode_literals
import re
import sys
import pytest
from hypothesis import given
from hypothesis.strategies import data, floats, integers, lists
from natsort.__main__ import (
check_filters,
k... |
"""pfeiffer_maxigauge
=====================
.. autoclass:: PfeifferMaxiGauge
:members:
:private-members:
"""
from functools import reduce
# from time import sleep
import numpy as np
from fluidlab.instruments.drivers import Driver
from fluidlab.interfaces import PhysicalInterfaceType
from fluidlab.instrumen... |
import json
import os
from flask import Flask, request, jsonify
from flask_cors import CORS
from labchain.util.cryptoHelper import CryptoHelper
from labchain.network.networking import ClientNetworkInterface, JsonRpcClient
from labchain.util.TransactionFactory import TransactionFactory
from labchain.util.TasksManager ... |
import logging
import gspread
import httplib2
from apiclient import discovery
from gspread.utils import rowcol_to_a1
from oauth2client.service_account import ServiceAccountCredentials
_GOOGLE_DRIVE_SCOPE = 'https://www.googleapis.com/auth/drive'
_GOOGLE_DRIVE_FILE_SCOPE = 'https://www.googleapis.com/auth/drive.file'
... |
import copy
import indp
from indputils import *
class INRGChoiceNode:
def __init__(self,owner,pred,iset_id,recovery_action=None):
self.owner=owner
self.pred=pred
self.succs=[]
self.iset_id=iset_id
self.best_utility=None
self.best_strategy=None
self.recovery_a... |
import pytest
import tensorflow as tf
from tensorflow.python.keras import layers, models
from barrage import model
def simple_net(dense_dim=5, input_dim=4, output_dim=3, **params):
net = models.Sequential()
net.add(layers.Input(shape=(input_dim,), name="input"))
net.add(layers.Dense(dense_dim, activatio... |
import frappe
from frappe.utils import cint, flt, get_fullname, cstr
from erpnext.shopping_cart.cart import update_cart as original_update_cart
from cart_extra.session import get_extra_cart_session
from cart_extra.utils import create_lead_if_needed
from erpnext.shopping_cart.doctype.shopping_cart_settings.\
shoppin... |
import os
import re
import shutil
from datetime import datetime
import argparse
import tarfile
import gzip
import traceback
from py_workdocs_prep import LogWrapper
L = LogWrapper()
VALID_NAME_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890-_.'
FULL_LENGTH_WARNING_THRESHOLD = 244
test_mode = ... |
# coding: utf-8
import requests
import sqlite3
import datetime
#from dbfunctions import *
token = '<KEY>'
yaToken = '<KEY>'
def tockenRefresh():
URL = "https://api.thetvdb.com/login"
HEADERS = {'Content-Type': 'application/json'}
DATA = {"apikey": "<KEY>", "userkey": "<KEY>", "username": "vlkootmni"}... |
#!/usr/bin/env python
# coding: utf-8
import os
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
import numpy as np
import tensorflow as tf # NOTE: This code runs with tensorflow version 2.0.0 # also may need to run conda update mkl
import tensorflow.keras.backend as K
from tensorflow.keras.layers import Input, Dense, LSTM, G... |
#!/usr/bin/env python3
import numpy
import sys
from datetime import datetime
#----------------------------------------
import arcade
import random
import math
import time
from itertools import cycle
# Constants
#SCREEN_WIDTH = 1800 #1000
#SCREEN_HEIGHT = 1000 #650
SCREEN_WIDTH = 400 #1000
SCREEN_HEIGHT = 400
SC... |
"""
Generate Fig.4 of the article
"""
import argparse
import datetime
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import os
import torch
from dcase19_dataset import TorchDataSet
from logging import Formatter, StreamHandler, getLogger, INFO
from models import get_model
logger = getLogger(__nam... |
# =============================================================================
# neighborhood.py
# -----------------------------------------------------------------------------
# Set of functions to perform neighborhood analyses on gridded fields. Follows
# methodology in Schwartz et al. (2017).
# --------------------... |
import copy
import math
import os
from io import BytesIO
import datetime
import numpy as np
import open3d as o3d
from flask import Flask, request, jsonify
from probreg import gmmtree
def quaternion_from_matrix(matrix, isprecise=False):
"""Return quaternion from rotation matrix.
If isprecise is True, the input ... |
from random import choice
from itertools import product
from enum import Enum
import json
import os
'''
GENERAL NOTE: In I Ching castings, lines are counted bottom-up, and that is
replicated here. A trigram of:
YANG
YANG
YIN
Will be stored as [YIN, YANG, YANG]. Everything will follow this order except
for printing t... |
import tempfile
import zipfile
import tarfile
import os
import gzip
import bz2
import unittest
from codalab.common import UsageError
from codalab.lib.zip_util import (
get_archive_ext,
strip_archive_ext,
path_is_archive,
pack_files_for_upload,
unpack,
)
from codalab.worker.file_util import tar_gzip... |
from flask_socketio import SocketIO, emit, join_room
from flask_login import current_user, login_required
from processing.user_role import authorized_groups
from processing import agent, agent_checkin, agent_task, command, console_message, \
error_message, faction_file, ioc, payload, transport
from processing.user... |
"""
Definition of a set of Numpy Helper classes.
(c) 2020 d373c7
"""
import unittest
import numpy as np
import d373c7.engines as en
import d373c7.features as ft
FILES_DIR = './files/'
class TestCreation(unittest.TestCase):
def test_creation_base(self):
x = np.arange(10)
y = np.arange(10)
... |
import asyncio
import json
from configparser import ConfigParser
from datetime import datetime
from os import getenv
from os.path import exists
from xml.dom import minidom
import aiohttp
from aiofiles import open
# -- CUSTOM ERROR CLASS -- #
class HoyolabError(Exception):
pass
# -- MAPPINGS -- #
def get_cate... |
import numpy as np
import netCDF4 as nc
import geokit as gk
from geokit import Location, LocationSet, Extent
import ogr
import osr
import pandas as pd
from collections import namedtuple, OrderedDict
from scipy.interpolate import splrep, splev
from scipy.stats import norm
from glob import glob
import re
from os.path imp... |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
import os
import warnings
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
warnings.filterwarnings("ignore")
matplotlib.use("Agg")
colors = {
"Car": "b",
"Tram": "r",
"Cyclist": "g",
"Van": "c",
"Truck": "m",
"Pedestrian": "y",
... |
"""Decide on interventions
"""
# pylint: disable=C0103
from digital_comms.mobile_network.model import PostcodeSector
import copy
import math
################################################################
# EXAMPLE COST LOOKUP TABLE
# - TODO come back to net present value or total cost of ownership for costs
#######... |
#!/usr/bin/env python3
"""MakeAppWorkDir.py
INTRODUCTION
This utility builds a directory tree that can be used as the current
working directory of an instance of your Webware application.
By using a separate directory tree like this, your application can run
without needing write access etc. to the Webware directory... |
"""Partially learned gradient descent scheme for ellipses."""
import os
import adler
adler.util.gpu.setup_one_gpu()
from adler.tensorflow import prelu, cosine_decay, reference_unet
from adler.odl.phantom import random_phantom
import tensorflow as tf
import numpy as np
import odl
import odl.contrib.tensor... |
"""Testing script for Cloudnet processing.
Creates similar directory structure and file names as the
Matlab processing environment.
"""
import os
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
import fnmatch
import gzip
import shutil
import importlib
import configpars... |
import torch
import random
import numpy as np
from pre_processing import *
import torch.nn as nn
from random import randint
from PIL import Image, ImageSequence
import glob
from torch.utils.data.dataset import Dataset
BATCH_SIZE = 2
IN_SIZE = 1024
OUT_SIZE = 1024
TRAIN_VALID_RATIO = 0.8
# train_index = random.sample(r... |
# coding=utf-8
# Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2020 - 2021 INTEL CORPORATION. All rights reserved.
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "Licens... |
import yaml
import numpy as np
import pandas as pd
from collections import defaultdict
from pathlib import Path
MAIN_DIR = Path(__file__).absolute().parent.parent.parent
DATA_DIR = MAIN_DIR / "data"
if __name__ == "__main__":
import sys
sys.path.append(str(MAIN_DIR))
import mudcod.utils.sutils as sutils... |
import os
import time
import torch
import bisect
import requests
import numpy as np
import pandas as pd
from .andet import kde, sr
from typing import List, Dict
import torch.utils.data as data
from sklearn.cluster import KMeans
from .transforms import paddingZeros
from typing import Callable, Optional, Tuple
def down... |
#%%
import tensorflow as tf
import tensorflow.keras as K
from tensorflow.keras import layers
print('TensorFlow version:', tf.__version__)
print('Eager Execution Mode:', tf.executing_eagerly())
print('available GPU:', tf.config.list_physical_devices('GPU'))
from tensorflow.python.client import device_lib
print('========... |
import getpass
import json
import os
from io import StringIO
from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryFile
import pytest
import yaml
from Pegasus.api.errors import PegasusError
from Pegasus.api.writable import Writable, _CustomEncoder, _filter_out_nones
@pytest.fixture(scope="funct... |
'''
"QLC+ File Ferret" - (C) 2019 <NAME>
---------------------------------------------
gui.py
- The main Graphical User Interface
'''
########
# One Day TODO:
# - Checking Fixtures as well when moving functions.
########
import sys
from os.path import basename, abspath, dirname, join... |
'''
Created on Feb 4, 2016
Decoding tables taken from https://github.com/typiconman/Perl-Lingua-CU
@author: <NAME>
'''
from __future__ import print_function, unicode_literals
import codecs
def ucs_decode(input_, errors='strict'):
return ''.join(decoding_table[x] for x in input_), len(input_)
def ucs_encode(in... |
import logging
import webbrowser
from datetime import datetime, timedelta, timezone
from typing import Dict, List, Tuple, Callable, Any
import dateutil.parser
import lightspeed_api
import matplotlib.pyplot as plt
import numpy as np
from datafeed import get_sale_items
from httpconnection import HttpConnectionBase
de... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from numpy.testing import assert_allclose
import astropy.units as u
from gammapy.irf import EffectiveAreaTable
from gammapy.modeling import Fit
from gammapy.modeling.models import (
ExpCutoffPowerLawSpectralModel,
P... |
import os, pygame, math, sys
import pygame._view
from pygame.locals import *
from levels import levels
from audio import *
# directory variables
#main_dir = os.path.split(os.path.abspath(__file__))[0]
#data_dir = os.path.join(main_dir, '')
# screen constants
SCREEN_X = 352
SCREEN_Y = 352
TILE_SIZE = 32
level_count =... |
from collections import namedtuple
import numpy as np
import parmed as pmd
import mbuild as mb
from mbuild.utils.sorting import natural_sort
from mbuild.utils.geometry import coord_shift
from mbuild.utils.io import import_
hoomd = import_("hoomd")
hoomd.data = import_("hoomd.data")
__all__ = ['to_hoomdsnapshot']
de... |
import datetime
import random
import tweepy
from top_tweets import config, get_tweets, twitter_auth
class Bot:
"""Quote Tweet or Retweet the top Tweets by other Twitter users.
Attributes:
usernames (list of str or None): a list of Twitter user screen names/handles (without "@")
whose to... |
# from JumpScale.core.System import System
import re
from JumpScale import j
class RegexTemplates_FindLines:
"""
regexexamples which find lines
"""
#@todo for all methods do input checking (id:20)
def findCommentlines(self):
return "^( *#).*"
def findClasslines(self):
r... |
#!/usr/bin/env python
#
# Azure Linux extension
#
# Copyright (c) Microsoft Corporation
# All rights reserved.
# MIT 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 restrictio... |
import numpy as np
import pandas as pd
from tabulate import tabulate
from .util import *
def key_adder(w2v_model, wordpairs):
"""Account for as many cases of british vs. american spelling as possible
in W2V vocabulary
Args:
w2v_model : standard Word2Vec 'KeyedVectors' data structure
wordps ... |
"""
E2EPipeline is a generalisation of sklearn Pipeline to allow for more flexible mapping of input and output parameters.
Sequentially apply a list of transforms and a final estimator. Intermediate steps of the pipeline must be ‘transforms’,
that is, they must implement fit and transform methods. The final estimator ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 31 17:12:41 2019
@author: qwang
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvNet(nn.Module):
def __init__(self, embedding_dim, n_filters, filter_sizes, output_dim, dropout):
super().__init... |
#!/usr/bin/env python3
# Copyright 2018 <NAME>
# Copyright 2018 <NAME>
# Apache 2.0
# minimum bounding box script is originally from
#https://github.com/BebeSparkelSparkel/MinimumBoundingBox
# dilate and erode script is inspired by
# https://stackoverflow.com/a/3897471
""" It is a collection of utility function... |
#!/usr/bin/env python3
""" Utility functions for the GUI """
import os
import sys
import tkinter as tk
from tkinter import filedialog, ttk
from PIL import Image, ImageTk
class Singleton(type):
""" Instigate a singleton.
From: https://stackoverflow.com/questions/6760685
Singletons are often frowned upon.... |
import uuid
from copy import deepcopy
import datetime as dt
from functools import reduce
import logging
from pyungo.io import Input, Output
logging.basicConfig()
LOGGER = logging.getLogger()
LOGGER.setLevel(logging.INFO)
try:
from multiprocess import Pool
except ImportError:
msg = 'multiprocess is not inst... |
import re
import subprocess
from argparse import ArgumentParser
from time import time
from typing import Optional
from pathlib2 import Path
from clearml import Task, Logger
from clearml.backend_api.utils import get_http_session_with_retry
from clearml_serving.serving_service import ServingService
class TritonHelper... |
import json
import datetime
import isodate
import boto3
# Create clients
sns = boto3.client('sns')
dynamodb = boto3.resource('dynamodb', region_name='eu-west-1')
roomTable = dynamodb.Table('myrecords')
# Check if is there any booking fot that day
def sessionEndedRequest(event):
return {
"version": "1.0"... |
import PIL.ImageDraw as ImageDraw
import PIL.Image as Image
import pickle
import numpy as np
from neuro_web import img_to_vec
import os
#This programm convert text on photo by simple text
#function for the search the connected component in photo. Algorinm:
# 1) is this pixel is black. No - end work
# 2) if yes, make ... |
# import necessary libraries
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib, random
import torch, torchvision
import torchvision.transforms as T
import numpy as np
import numpy.ma as ma
import cv2
from vision.faststyletransfer_eval import FasterStyleTransfer
import collections
# get the pretra... |
import logging
import random
from collections import defaultdict
from pathlib import Path
from typing import Iterable, List
import numpy as np
from ordered_set import OrderedSet
from saticl.datasets.base import DatasetBase
from saticl.logging.console import DistributedLogger
from saticl.tasks.agrivision import ICL_AG... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import h5py
import logging
import numpy as np
from .catalogs import Catalog, LocalCatalog, singleton
__all__ = ["WolfgangMRRelation"]
class WolfgangMRRelation(LocalCatalog):
filename = "wolfgang.csv"
def predict_mass(self, radius_sam... |
#
# Copyright 2021 GoPro Inc.
#
# 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 ... |
from flask import Flask, jsonify, session, send_file, make_response, send_from_directory, Response
import boto3
from botocore.exceptions import ClientError
import yaml
import os
import json
import uuid
import shutil
import glob
from bson import ObjectId
import datetime
import subprocess
CONFIGFILE = './config.yaml'
TE... |
import wx
import urllib.request
import json
import requests
import os
from threading import *
from wx.lib.pubsub import pub
import webbrowser
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
# 6012503895
ID_START = wx.NewId()
ID_STOP = wx.NewId()
EVT_RESULT_ID = wx.NewId()
path = ""
id ... |
from ..util import set_numpy_threads
set_numpy_threads(1)
import numpy as np
import vigra
try:
import hdbscan
except ImportError:
hdbscan = None
from scipy.ndimage import shift
from sklearn.cluster import MeanShift
from sklearn.decomposition import PCA
from .features import (compute_grid_graph,
... |
"""
File to parse studies on cBioPortal.
First, we want to extract the most mutated genes in the studies by their mutations/nucleotide values.
"""
import sys
import os
import numpy as np
def parse_mutation_file(file, gene_dict):
t_barcode_index = file[0].index('Tumor_Sample_Barcode')
visited_samples = set()
... |
import os
import json
import time
import sqlite3
import requests
import argparse
import pandas as pd
from lxml import etree
from selenium import webdriver
url = 'http://music.baidu.com'
headers = {
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-E... |
import pytest
import numpy as np
from ale.rotation import ConstantRotation, TimeDependentRotation
from ale.transformation import FrameNode
@pytest.fixture(scope='function')
def frame_tree(request):
"""
Test frame tree structure:
1
/ \
/ \
2 4
/
/
3
"... |
# The MIT License (MIT)
#
# 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... |
#Import turtle library
import turtle
#Class for connect objects. Have an x location, a y location, a value (0,1,2 for representing player who owns tiles), and count for debugging
class Bubble:
def __init__(self,x, y, value, count=0):
self.x = x
self.y = y
self.value = value
... |
# -*- coding: utf-8 -*-
import numpy as np
from pyfr.mpiutil import get_comm_rank_root, get_mpi
from pyfr.plugins.base import BasePlugin, init_csv
from pyfr.quadrules import get_quadrule
def _closest_pts_bf(epts, pts):
for p in pts:
# Compute the distances between each point and p
dists = [np.li... |
##########
#
# funcs.py
#
#
# Author: <NAME>
# Email: <EMAIL>
#
# Last Edit: 11/8/19
##########
import networkx as nx
from numba import jit
import math
from scipy.spatial import ConvexHull
from scipy.spatial import Delaunay
import numpy as np
from . import globals as const
basal_offset = const.basal_offset
def ... |
import torch
import torch.nn as nn
import pytorch_lightning as pl
import numpy as np
from scipy.stats import truncnorm
from pipeline.loss import EuclideanGMM
def truncated_normal(size, center, radius, dtype):
values = truncnorm.rvs(-1, 1, size=size) * radius + center
return torch.from_numpy(values.astype(dtyp... |
#! python 3
# -*- coding: utf_8 -*-
import os
import yaml
def process_setting(setting_str, language):
dict = {}
if not setting_str or setting_str == '':
return dict
setting = setting_str.replace('\n', '|')
settings = setting.split('|')
if len(settings) == 0:
return dict
for ... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
class GraphsNotIsomorphicError(RuntimeError):
pass
def _refine(s1, s2, mapping):
assert len(s1) <= len(s2)
changed = []
new_mapping = []
for i, (q1, q2) in enumerate(mapping):
if q1 <= s1:
if q2 <= s2:
continue
q2.intersection_update(s2)
i... |
"""
Module that generally controls operations with the drive. Almost all print()
statements in this and another modules is just for debug purposes because on the
end device there will be no sense in them (but you can try to transfer them on
the logging platform if you sure that the drive is in a presence at the moment
... |
import asyncio
import json
import re
import time
from copy import copy
from decimal import Decimal
from brick import validators
from brick.exceptions import ValidationError
from brick.hardware.i2c import i2c_manager
def import_device_modules():
from brick.device import base
from brick.device import i2c
fr... |
"""
This file contains the definition of the SMPL model
"""
from __future__ import division, print_function
import torch
import torch.nn as nn
import numpy as np
try:
import cPickle as pickle
except ImportError:
import pickle
from pyrender import PerspectiveCamera, \
DirectionalLight, SpotLight, PointLig... |
"""
complex plane functions and class for getting pixels in three different measuring systems
"""
import sys
import numpy as np
from zexhibit import get_aligned_dict_string
Zomm_factor_min = 1000 * sys.float_info.min
_zplain_dict = {'center_point': 0.0 + 0.0j,
'zoom_factor': 0.5,
'thet... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.