text stringlengths 3.07k 22.1k |
|---|
import torch
class HMM(torch.nn.Module):
"""
Hidden Markov Model.
(For now, discrete observations only.)
- forward(): computes the log probability of an observation sequence.
- viterbi(): computes the most likely state sequence.
- sample(): draws a sample from p(x).
"""
def __init__(sel... |
from bottle_utils.common import basestring, unicode
try:
from bottle_utils.i18n import lazy_gettext as _
except ImportError:
_ = lambda x: x
from .exceptions import ValidationError
from .validators import DateValidator
class ErrorMixin(object):
"""
Mixin class used to provide error rendering functio... |
from functools import lru_cache
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import numpy as np
import plotly.graph_objs as go
from app import app
from db import session
from models import SingleAgentWellResult, WellResu... |
""" Extra questions for Lab 08 """
from lab08 import *
# OOP
class Keyboard:
"""A Keyboard takes in an arbitrary amount of buttons, and has a
dictionary of positions as keys, and values as Buttons.
>>> b1 = Button(0, "H")
>>> b2 = Button(1, "I")
>>> k = Keyboard(b1, b2)
>>> k.buttons[0].key
... |
import argparse
import json
import logging
import sys
from pathlib import Path
from typing import Dict, List, Optional
from annofabapi.models import InputData, TaskStatus
from annofabapi.parser import SimpleAnnotationParser
import annofabcli
import annofabcli.common.cli
from annofabcli.common.cli import ArgumentParse... |
# models.py
# <NAME> (mh999), <NAME> (jet253)
# December 3rd, 2016
"""Models module for Breakout
This module contains the model classes for the Breakout game. That is anything that you
interact with on the screen is model: the paddle, the ball, and any of the bricks.
Technically, just because something is a model doe... |
"""X-Carve Microscope Tool Video Library"""
import logging
import math
import cv2
MAX_CROSSHAIR_THICKNESS = 5
MAX_VIDEO_WIDTH = (4 * 1024)
MAX_VIDEO_HEIGHT = (2 * 1024)
# scale = 1, thickness = 1
FONT_FACE_0 = cv2.FONT_HERSHEY_SIMPLEX # 27 close to fixed
FONT_FACE_1 = cv2.FONT_HERSHEY_PLAIN # 15 ... |
# -*- coding: utf-8 -*-
import argparse
import json
import time
from sklearn.model_selection import train_test_split
from delft.sequenceLabelling import Sequence
from delft.sequenceLabelling.models import *
from delft.sequenceLabelling.reader import load_data_and_labels_crf_file
from delft.sequenceLabelling.reader i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import json
import cloudpickle
from flask import Blueprint, request
from flask_restful import Api, Resource, fields, marshal_with, abort, reqparse
from eth_utils import is_same_address, to_checksum_address
import logging
from werkzeug.utils import secure_filename
... |
# -*- coding: utf-8 -*-
from __future__ import division, unicode_literals
import collections
from . import config
from . import lexers
from .messages import *
from .htmlhelpers import *
from .widlparser.widlparser import parser
ColoredText = collections.namedtuple('ColoredText', ['text', 'color'])
class IDLUI(object)... |
# Cloudera Airflow Provider
# (C) Cloudera, Inc. 2021-2021
# All rights reserved.
# Applicable Open Source License: Apache License Version 2.0
#
# NOTE: Cloudera open source products are modular software products
# made up of hundreds of individual components, each of which was
# individually copyrighted. Each ... |
import logging
import os
import sys
import numpy as np
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler, MessageHandler, Filters
from telegram.ext.dispatcher import run_async
from botdb import BotDB
from config import Conf... |
import random
import numpy as np
import pandas as pd
def create_final_df():
match_df, team_df = get_pro_match_df()
player_stats_df = get_prepared_player_stats_df()
# radiant_df, dire_df = get_radiant_dire_df_with_account_columns(match_df, team_df)
match_df = prepare_match_df(match_df)
match_df.dr... |
#!/usr/bin/env python
''' A log aggregator, parser and forwarder'''
import os
import sys
import asyncore
import socket
import logging
import json
from time import sleep
from flask import Flask
from Queue import Queue
from threading import Thread
from numbers import Number
from collections import Set, Mapping, deque
im... |
# Copyright 2019 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from .image import get_blurred_image
from .color import *
from pyqtgraph.Qt import QtCore, QtWidgets
import pyqtgraph.opengl as gl
import pyqtgraph as pg
from pyqtgraph import Vector
import numpy as np
import sys
class PyQtVisualizer():
"""Parent class for the visualizers using PyQt5.
"""
def __init__(se... |
"""Implements a PuzzleTester class for tracking the performance of solvers.
The idea is to have a few different algorithms for solving puzzles (e.g.
Sudoku puzzles), and to evaluate their performance against a set of test
cases.
Classes:
PuzzleTester: Track puzzle solver benchmarking stats.
Functions:
from_f... |
#! /usr/bin/python
import sys
import time
import os
import traceback
import argparse
from biokbase.probabilistic_annotation.DataParser import DataParser
from biokbase.probabilistic_annotation.Helpers import get_config, now
from biokbase.probabilistic_annotation.DataExtractor import *
desc1 = '''
NAME
pa-gendata... |
'''
This file contains the Deep Q Learning Neural Net (DQN) class, as well as a class containing methods used by the DQN model.
'''
import pandas as pd
import matplotlib.pyplot as plt
import geopandas as gpd
import math
import networkx as nx
import random
import torch
import torch.nn as nn
import numpy as np... |
from ... import util
class Params:
def __init__(self, kabko=None, tanggal=None, sampai=None):
self.kabko = kabko
self.tanggal = tanggal
self.sampai = sampai
def tanggal_after(self, after):
return util.filter_dates_after(self.tanggal, after)
class RawData:
d... |
#-*- coding: utf-8 -*-
import os
import site
from functools import reduce
site.addsitedir(os.path.dirname(os.path.dirname(__file__)))
from .parse import *
from sklearn.decomposition import PCA
from sklearn.preprocessing import Imputer
import logging
import dash
from dash.dependencies import Input, Output, State
import ... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
From:
https://github.com/flying-sheep/bcode/blob/master/bcoding.py
Main change made here is to explicitly safeguard against encoding bools as they derive from int.
Formatting and linting changes were also applied.
Original License:
Copyright (c) 2013 <NAME>
P... |
"""Python analytics interface executes Python function as Kestrel analytics.
Use a Python Analytics
----------------------
Create a profile for each analytics in the python analytics interface config
file (YAML):
- Default path: ``~/.config/kestrel/pythonanalytics.yaml``.
- A customized path specified in the environ... |
import numpy as np
from scipy.optimize import minimize
from scipy.io import loadmat
from numpy.linalg import det, inv
from math import sqrt, pi
import scipy.io
import matplotlib.pyplot as plt
import pickle
import sys
def ldaLearn(X,y):
# Inputs
# X - a N x d matrix with each row corresponding to a trainin... |
import gym
import random
import collections
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import sys
sys.path.append(".")
from args.config import ddpg_params as params
class ReplayBuffer():
def __init__(self, buffer_limit):
self.buffer_... |
#%%
import os
import sys
import numpy as np
import argparse
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description='')
parser.add_argument('--s_dataset', type=str, choices=['AMAZON_RO', 'AMAZON_PA', 'CERRADO_MA'], default='AMAZON_RO', help='source dataset')
parser.add_argument('--t_dataset', ty... |
import geom
import os
POSITION_COLOUR = 'ff70ff'
def MakeCurveFromD(d, group_name):
curve = geom.Curve()
mode = 'x' # x y h v cx1 cx2 cy1 cy2
nums = ''
curp = geom.Point(0,0)
absolute = True
move = True
d += ' '
for c in d:
if c == 'm':
absolute = False
... |
# Copyright (c) 2013, Cornell University
# 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 of source code must retain the above copyright notice,
# this list of condi... |
import warnings
from typing import Union
import numpy as np
import pandas as pd
import xarray as xr
from regime_switching.generate.base import CanRandomInstance, SeriesGenerator
from regime_switching.utils.rng import AnyRandomState
class ChainGenerator(SeriesGenerator):
"""Base object for chain generators."""
... |
import struct
import json
import logging
import mmap
from edk2toolext.versioninfo.versioninfo_helper import validate_version_number, version_str_to_int, hex_to_version_str
class VersionRecordCert(object):
'''
Version record cert object.
'''
NO_FILEVERSION = 0
EQUAL = 0b00000001
NOT_EQUAL = 0b00... |
#%%
import os
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
print(os.getcwd())
except:
pass
#%%
import sys
sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/")
import pandas as pd
import numpy as np
import connectome_tools.process_matrix as promat... |
"""Convenience classes for Graphvy"""
from random import random
from graph_tool import Graph
from kivy.graphics import Color, Line
from .arrow import Arrow
from ..constants import *
from ..ui.ui_widgets import AdjacencyListItem
class Node(Line):
__slots__ = 'color', 'vertex', 'canvas', 'group_name', 'list_item'... |
#!/usr/bin/env python
# coding: utf-8
"""
Converts a Python dictionary or other native data type into a valid XML string.
Supports item (`int`, `float`, `long`, `decimal.Decimal`, `bool`, `str`,
`unicode`, `datetime`, `none` and other number-like objects) and collection
(`list`, `set`, `tuple` and `dict`, as well as ... |
#importing necessary modules
import pandas as pd
import numpy as np
import os
import glob
from fuzzywuzzy import process, fuzz
from copy import deepcopy
from utils.constants import *
#creating a function to do some initial data preprocessing
def preprocess_tournament_results(cfg):
#start by reading in the data fr... |
import logging
from typing import Dict, Iterable, Optional, Callable, overload, Union
from .abstracts import AbstractKnowledgeBase
from .concept_generator import ConceptGenerator
from .core.owl.utils import OWLClassExpressionLengthMetric
from .core.utils import BitSet
from owlapy import IRI
from owlapy.model import OW... |
"""Entity namespace classes."""
# Copyright (c) 2001-2009 ElevenCraft Inc.
# See LICENSE for details.
import sys
from schevo.lib import optimize
from functools import wraps
import inspect
from string import digits, ascii_letters
from schevo import base
from schevo.constant import UNASSIGNED
from schevo.decorator im... |
import requests
import os
from urllib.request import urlretrieve
import json
from multiprocessing import Pool
from tqdm import tqdm
from itertools import repeat
from ml4vision.utils import mask_utils
from PIL import Image
import numpy as np
class MLModel:
def __init__(self, client, **kwargs):
self.cli... |
#!/usr/bin/env python
"""
Copyright (c) 2012, CCL Forensics
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 of source code must retain the above copyright
notice, this list o... |
""" Tests for the random_cut_forest module """
import numpy as np
from random_cut_forest import random_cut_forest
from utils.assertion import assert_equals_list
from utils.logging import dump_node_data
class TestRandomCutForest(object):
"""Test the RandomCutForestClass"""
@classmethod
def setup_class(cl... |
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import datetime, time
import argparse
import os
from models.vae import Vae
from utils.utilities import preprocess_images
from utils.sys_utils import make_directories, pickle_save
from utils.plot_utils import plot_embedding, plot_reconstructed
i... |
#!/usr/bin/env python3
import cgi
import hashlib
import io
import json
import multiprocessing.pool
import time
import zlib
from urllib import parse
from wsgiref import util
from wsgiref.simple_server import WSGIRequestHandler, WSGIServer
from passlib import hash
def application(env, start_response):
request_u... |
# USAGE : python text_detection.py --image images/lebron_james.jpg --east frozen_east_text_detection.pb
# IMPORTING NECESSARY PACKAGES
import imutils
from imutils import contours
from imutils.object_detection import non_max_suppression
from skimage.transform import resize
from skimage import measure
from... |
from typing import Any
from typing_extensions import Literal
from enum import auto
from anndata import AnnData
from cellrank import logging as logg
from cellrank._key import Key
from cellrank.tl._enum import ModeEnum
from cellrank.ul._docs import d, inject_docs
from cellrank.tl._utils import _correlation_test_helper
... |
import os
import time
import csv
import numpy as np
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
cudnn.benchmark = True
import models
from metrics import AverageMeter, Result
import utils
from torchvision import datasets, transforms
from torchvision.transforms impor... |
import os
import numpy as np
from PIL import Image
import cv2
import _pickle as cPickle
import numpngw
import open3d as o3d
import matplotlib.pyplot as plt
data_list_file = '/home/pwl/Work/Dataset/NOCS/nocs/Real/test_list_all.txt'
data_path = '/home/pwl/Work/Dataset/NOCS/nocs/Real/'
result_path = '/home/pwl/Work/Dat... |
#!/usr/bin/env python3
# QEMU Guest Agent Client
#
# Copyright (C) 2012 <NAME> <<EMAIL>>
#
# This work is licensed under the terms of the GNU GPL, version 2. See
# the COPYING file in the top-level directory.
#
# Usage:
#
# Start QEMU with:
#
# # qemu [...] -chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 \
#... |
# Objective: list game releases ; for each game, analyze the sales during the first week after release
import ast
import pathlib
def load_json_data(json_filename):
# Load the content of a JSON data file
import json
# Data folder
data_path = "data/"
if not (json_filename.endswith(".json")):
... |
import sys
import ns.wifi
import ns.internet
import ns.mobility
import ns.point_to_point
import ns.propagation
import ns.distributedml as dml
from node import Agent
from base import __Base, _Base, _Iter
from base import parse_yaml
class MobilityRandomWalk2d(_Base):
def __init__(self, ap, sta, attributes=dict(), ... |
from __future__ import absolute_import
from itertools import product
from six.moves import map
from functools import total_ordering
cnfClass = None
@total_ordering
class Variable(object):
def __init__(self, name, inverted=False):
self.name = name
self.inverted = inverted
def __neg__(self):
... |
## A good reference is also available at
# https://www.geeksforgeeks.org/binary-search-tree-set-2-delete/
class Node:
def __init__(self, data=None, left_ref=None, right_ref=None):
self.data = data
self.left_child = left_ref
self.right_child = right_ref
class BinarySearchTree:
def __init__(self, data=None):... |
#!/usr/bin/env python3
# Little Less Protocol Suite - yaml converter
# Copyright (C) 2020 <NAME>
#
# SPDX-License-Identifier: MIT
#
# This tool converts a Little Less Protocol yaml file to an other format.
# The following output formatas are supported:
# - markdown file
#
# To run this tool you will need python3 with ... |
import os
import sys
import time
import types
import multiprocessing
import cv2
from tqdm import tqdm
try:
import IPython #if success we are in colab
from IPython.display import display, clear_output
import PIL
import matplotlib.pyplot as plt
is_colab = True
except:
is_colab = False
class Inte... |
import random
import numpy as np
import cv2
from PIL import Image
from PIL import ImageFilter
import PIL
import tifffile
def cv_rotate(image, angle, borderValue):
"""
rot angle, fill with borderValue
"""
# grab the dimensions of the image and then determine the
# center
(h, w) = image.shape[:... |
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
"""Train for CONLL 2017 UD treebank evaluation. Takes .conllu files, writes
.conllu format for development data, allowing the official scorer to be used.
"""
from __future__ import unicode_literals
import plac
import attr
from pathlib import Path
import re
import json
import spacy
import spacy.util
from spacy.tokens i... |
import os
os.environ["OMP_NUM_THREADS"] = "1"
from utils.multiprocess_utils import chunked_multiprocess_run
import random
import traceback
import json
from resemblyzer import VoiceEncoder
from tqdm import tqdm
from data_gen.tts.data_gen_utils import get_mel2ph, get_pitch, build_phone_encoder
from utils.hparams import ... |
# Copyright (C) 2010, 2011 <NAME> (<EMAIL>) and contributors
#
# This module is part of GitDB and is released under
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
import binascii
import os
import mmap
import sys
import time
import errno
from io import BytesIO
from smmap import (
StaticW... |
# Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: Apache License 2.0
import logging
import os
import copy
import sys
from gss_parser import parser
from avi.migrationtools.gss_convertor.gss_utils import printProgressBar,\
excel_dict_create, set_total_stats
file_loc = os.path.split(os.path.abspath(__file__))... |
import warnings
warnings.filterwarnings('ignore')
import cv2
import audioread
import logging
import os
import random
import time
import warnings
import librosa
import librosa.display as display
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import soundfile as sf
import torch
import torch.nn a... |
import glob
import csv
import matplotlib.pyplot as plt
import numpy
import os
import scipy.io.wavfile as wavfile
import scipy.spatial.distance
import shutil
import sys
from six.moves import cPickle
import audioBasicIO
import audioSegmentation as aS
import audioTrainTest as aT
minDuration = 7
def classifyFolderWrap... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Copyright (c) Megvii, Inc. and its affiliates.
#import argparse
import os
import time
from loguru import logger
import cv2
import torch
import json
from pathlib import Path
from yolox.data.data_augment import ValTransform
from yolox.data.datasets import COCO_CLASSES
fr... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
def rsp_findpeaks(rsp_cleaned, sampling_rate=1000, method="khodadad2018", amplitude_min=0.3):
"""Extract extrema in a respiration (RSP) signal.
Low-level function used by `rsp_peaks()` to identify inhalation peaks and exhalation troughs in
a ... |
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render
from rango.forms import CategoryForm, PageForm, User... |
import pandas as pd
import os
import json
from collections.abc import Iterable
import matplotlib.pyplot as plt
import statsmodels
import plotly.graph_objects as go
import plotly as py
import plotly.express as px
def read_json(path_to_json = 'Inż/'):
"""
Reads jsons in the specified dir
Parameters
... |
# pylint: disable=invalid-name,too-many-arguments,too-many-locals
import concurrent
import itertools
import zipfile
import random
import glob
import json
import os
import tqdm
import numpy as np
from . import tools
def _read_born_digital_labels_file(labels_filepath, image_folder):
"""Read a labels file and retu... |
# New concepts and differences from Theano:
# - stride is the interval at which to apply the convolution
# - unlike previous course, we use constant-size input to the network
# since not doing that caused us to start swapping
# - the output after convpool is a different size (8,8) here, (5,5) in Theano
# https://dee... |
from functools import reduce
import numpy
import numpy.core.multiarray # important this comes before cv!
import cv2
from hydrus.client import ClientConstants as CC
from hydrus.core import HydrusData
from hydrus.core import HydrusImageHandling
from hydrus.core import HydrusGlobals as HG
cv_interpolation_enum_lookup ... |
from ..registers import Register, RegisterClass
from ... import ir
# pylint: disable=invalid-name
class RiscvRegister(Register):
bitsize = 32
def __repr__(self):
if self.is_colored:
return get_register(self.color).name
return '{}={}'.format(self.name, self.color)
e... |
# 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 applic... |
#!/usr/bin/python3
"""Copyright 2021 Advanced Micro Devices, Inc.
Run tests on build"""
import re
import os
import sys
import subprocess
import shlex
import argparse
import pathlib
import platform
from genericpath import exists
from fnmatch import fnmatchcase
from xml.dom import minidom
import multiprocessing
import t... |
import py, sys
from pypy.rlib.rarithmetic import r_longlong, intmask, is_valid_int
from pypy.objspace.flow.model import SpaceOperation, Variable, Constant
from pypy.objspace.flow.model import Block, Link
from pypy.translator.unsimplify import varoftype
from pypy.rpython.lltypesystem import lltype, rffi
from pypy.jit.c... |
from panda3d import core
import struct
import pytest
from _pytest.outcomes import Failed
# This is the template for the compute shader that is used by run_glsl_test.
# It defines an assert() macro that writes failures to a buffer, indexed by
# line number.
# The reset() function serves to prevent the _triggered varia... |
from __future__ import division
import re
from collections import OrderedDict
import torch
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import DistSamplerSeedHook, Runner, obj_from_dict
from mmdet import datasets
from mmdet.core import (CocoDistEvalmAPHook, CocoDistEvalRecallHo... |
# Copyright 2018 The Cirq Developers
#
# 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 ... |
import os
import sys
import argparse
import traceback
import numpy as np
import h5py
import time
import sklearn.preprocessing
'''
SquigglePull
<NAME> (<EMAIL>)
Genomic Technologies
Garvan Institute
Copyright 2017
Pull squiggle data from fast5 files given some targetting method
input:
... |
"""
filebrowser.views
"""
import logging
import re
import json
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.loader import get_template
from django.conf import settings
from .utils import get_rucio_file, get_... |
import torch
import torch.nn as nn
from torchvision import datasets, transforms
from rlkit.torch import pytorch_util as ptu
from rlkit.util.io import load_local_or_remote_file
from os import path as osp
from sklearn import neighbors
import numpy as np
from torchvision.utils import save_image
from tqdm import tqdm
impor... |
#distribution.py
#Downloads OpenSim, moves it, and packs in the files we need it to have
# module gridtogo.client.opensim.distribution
if __name__ == "__main__":
from twisted.internet import gtk3reactor
gtk3reactor.install()
from gi.repository import Gtk
import os.path
import shutil
import socket
import string
impo... |
import collections
import dataclasses
import functools
import inspect
from typing import Dict
from typing import List
from .. import variables
from ..bytecode_transformation import create_instruction
from ..eval_frame import skip_code
from ..exc import unimplemented
from ..source import AttrSource
from .base import Va... |
import sys, os
cur_file_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(cur_file_path, '..'))
import importlib, time
import traceback
import numpy as np
import torch
import torch.optim as optim
from torch.optim.lr_scheduler import MultiStepLR
from torch.utils.data import DataLoader
f... |
#===============================================================================
# Imports
#===============================================================================
import os
import sys
import shutil
import inspect
import unittest
from os.path import (
isdir,
abspath,
dirname,
basename,
)
from ... |
'''
This script includes two functionalities: chain2vcf and chain2bed
chain2vcf: Converts a chain file to a VCF file.
This conversion is not capble of handling translocations and inversions. Users should specify
a list of "chain ids" that contain only indels.
Example:
# This output VCF is used to... |
import pdb
import os
import time
import numpy as np
import torch
from . import Algorithm
def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import numpy as np
from domainbed.lib import misc
def _define_hparam(hparams, hparam_name, default_val, random_val_fn):
hparams[hparam_name] = (hparams, hparam_name, default_val, random_val_fn)
def _hparams(algorithm, dataset, random_seed, h... |
import pytest
import rlp
from plasma_core.transaction import Transaction, UnsignedTransaction
from plasma_core.utils.merkle.fixed_merkle import FixedMerkle
from plasma_core.utils.utils import confirm_tx, get_deposit_hash
from plasma_core.constants import NULL_ADDRESS, NULL_ADDRESS_HEX
@pytest.fixture
def root_chain(t... |
import argparse
import json
import os
import glob
import time
import shutil
import random
import uuid
import string
from multiprocessing import Pool
from math import ceil
import pandas as pd
import numpy as np
from faker import Faker
def main():
parser = argparse.ArgumentParser()
parser.add_... |
# -*- coding: utf-8 -*-
"""Utility and helper methods for tmuxp.
tmuxp.util
~~~~~~~~~~
"""
from __future__ import absolute_import, division, print_function, \
with_statement, unicode_literals
import unittest
import collections
import subprocess
import re
import os
import sys
import logging
from distutils.versio... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# generic imports
import logging
import os
import shutil
import uuid
# django imports
from django.conf import settings
from django.contrib.auth import signals
from django.db import models
from django.dispatch import receiver
from core.es import es_hand... |
# Copyright 2018 Intel Corporation
#
# 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 wri... |
"""
The IME experiment MAIN for GERMAN.
"""
import warnings
warnings.filterwarnings('ignore')
from adversarial_models import *
from utils import *
from get_data import *
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import numpy as np
import pandas as pd
imp... |
import os
import tensorflow as tf
from tensorflow.python.client import device_lib
from functools import lru_cache
from collections import namedtuple
# CONSTANTS
PAD_TOKEN = '<PAD>'
@lru_cache()
def all_gpus():
"""
Get integer ids of all available GPUs
"""
local_device_protos = device_lib.list_local_... |
"""Manages Git."""
import logging
import os
import re
from collections.abc import Mapping
from contextlib import contextmanager
from functools import partialmethod
from typing import Dict, Iterable, Optional, Tuple, Type, Union
from funcy import cached_property, first
from pathspec.patterns import GitWildMatchPattern... |
"""
Prometheus collecters for Proxmox VE cluster.
"""
# pylint: disable=too-few-public-methods
import itertools
from proxmoxer import ProxmoxAPI
from prometheus_client import CollectorRegistry, generate_latest
from prometheus_client.core import GaugeMetricFamily
class StatusCollector(object):
"""
Collects Pr... |
"""
Copyright 2019 Samsung SDS
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 ... |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) <NAME> <<EMAIL>>
## This program is published under a GPLv2 license
import socket,struct
from scapy.packet import *
from scapy.fields import *
from scapy.ansmachine import *
from scapy.layers.inet import U... |
#!/usr/bin/env python3
import numpy as np
import sympy as sp
from selfdrive.locationd.kalman.helpers import ObservationKind
from selfdrive.locationd.kalman.helpers.ekf_sym import EKF_sym, gen_code
from selfdrive.locationd.kalman.models.loc_kf import parse_pr, parse_prr
class States():
ECEF_POS = slice(0,3) # x, y... |
#
# 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 applicable law or agreed to ... |
# 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 ... |
"""
1. read edf
. read edf returns raw: a list of lists
. read .tse_bi, returns label_array: time array with labels.
. take label_array and raw, returns dataset and label_array : a list of
data, each block is 1 second, with fixed size. width is number of
channels in certain standard order.
2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.