sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
30f296ed76bfc38c4ee55bcd49e1c64496460417adc2315475ac0481ea6f9760 | Python | 4,732 | 140 | import numpy as np
import pytest
from Bio.Align import MultipleSeqAlignment
from Bio.Phylo.BaseTree import Tree
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from clipkit.ambiguity import ambiguity_symbols
from clipkit.helpers import SeqType, get_seq_type
from clipkit.modes import AmbiguityHandling, Trim... |
a60aed27c5710b919625c1414c5d841821a38b41b30c7651c61d0469f8619c08 | Python | 4,736 | 147 | import json
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def get_state_dict(file):
try:
pretrain_state_dict = torch.load(file)
except AssertionError:
pretrain_state_dict = torch.load(file, map_location=lambda storage, location: storage)
return pret... |
a1339597fa0133c4293b219a791e7b3c340eb26d8bc936126548a49f34470154 | Python | 4,738 | 141 | from typing import Union, Any, Tuple, Generator
import eagerpy as ep
import numpy as np
from ..devutils import atleast_kd
from ..criteria import Criterion
from .base import Model
from .base import T
from .base import get_is_adversarial
from .base import get_criterion
from .base import Attack
from .spatial_attack_tra... |
b0130d1da6f5f8be95acb66a52f7a6f45e9b8c1ceab5c7c867c9167bc75c38c9 | Python | 4,739 | 116 | import argparse
import itertools
from typing import Dict
import pandas as pd
# noinspection PyUnresolvedReferences
import typing
import matplotlib_setup
# noinspection PyUnresolvedReferences
import osgeo_setup
import argparse_def
import reference_data_utils
from models.abstract import input_data
from scope_utils imp... |
a182ab428d6a735bc74c03da0fdd6c48e09893c8de7512398c31e64b82b90fae | Python | 4,740 | 116 | import argparse
import itertools
from typing import Dict
import pandas as pd
# noinspection PyUnresolvedReferences
import typing
import matplotlib_setup
# noinspection PyUnresolvedReferences
import osgeo_setup
import argparse_def
import reference_data_utils
from models.abstract import input_data
from scope_utils imp... |
9617f7356eb80491723b61a215facb2975f469a285fd84f0b1fe66107dcd1e66 | Python | 4,745 | 130 | import os.path
import h5py
from PIL import Image
from data.base_dataset import BaseDataset, get_params, get_transform
class NucleiDataset(BaseDataset):
"""A dataset class for paired image dataset.
It assumes that the directory '/path/to/data/train' contains image pairs in the form of {A,B}.
During test... |
8e1ca1fc8bdcad23bef671d28ffb302aea55c8c8e1c5fe5d9dc0320215394713 | Python | 4,749 | 144 | from functools import partial
from typing import Callable, Optional
from foolbox.attacks.gradient_descent_base import normalize_lp_norms
from .basic_iterative_method import (
Optimizer,
L1BasicIterativeAttack,
L2BasicIterativeAttack,
LinfBasicIterativeAttack,
)
import eagerpy as ep
class GDMOptimize... |
6fcab941296213dae15c97dc65311f20b9ac4a3a910ac0e2d809e26f1995375b | Python | 4,750 | 97 | import os, errno
import numpy as np
import torch.nn as nn
import torch.optim as optim
from torch.optim.lr_scheduler import ReduceLROnPlateau
from glob import glob
from PIL import Image
from torchvision import transforms, utils
from FOD.Loss import ScaleAndShiftInvariantLoss
from FOD.Custom_augmentation import ToMask
... |
7ad1cea37358d03cdb8bc451fb8735cb5a8a10ee12bae011df257196325acbf2 | Python | 4,752 | 165 | from math import sin, cos
from numbers import Number
import numpy as np
import os
import inspect
import flystim
def get_resource_path(resource_name):
path_to_resource = os.path.join(inspect.getfile(flystim).split('flystim')[0],
'flystim',
're... |
5bdf9eebd8fdb3304e9b999a10e5fc1ba51c713f004e9800f4066dfb4129ab19 | Python | 4,756 | 98 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 9 19:31:05 2021
@author: fhu14
Main driver file
"""
#%% Imports, definitions
from InputParser import parse_input_dictionaries, collapse_to_master_settings,\
inflate_to_dict
import argparse
from DataManager import load_gammas_per_fold, load_config_tracker_per_fold
fr... |
88b1970be2cfba1d5c8b8594938f78f9c25f9d9c469b8255afd8456e042ad663 | Python | 4,757 | 131 | #!/usr/bin/env python
"""
Standalone test for parallel processing functions without Bio dependency
"""
import numpy as np
import time
from multiprocessing import Pool
from enum import Enum
# Copy the SiteClassificationType enum
class SiteClassificationType(Enum):
parsimony_informative = "parsimony-informative"
... |
467897006b691917b64c9ef94299a042ab8f2071c95bee920509ccd943eaf24e | Python | 4,759 | 114 | import numpy as np
import torch
import torch.nn as nn
import timm
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
from FOD.Reassemble import Reassemble
from FOD.Fusion import Fusion
from FOD.Head import HeadDepth, HeadSeg
torch.manual_seed(0)
class FocusOnDepth(nn.Module):
def __in... |
ccb2c967db915cb6322e32d5032735cc5bf00f1317217c2524f5ff09eab3d0f4 | Python | 4,764 | 101 | # ***********************************************************************************
# * Copyright 2010 - 2016 Paulo A. Herrera. All rights reserved. *
# * *
# * Redistribution and use in source and binary forms, with o... |
9fe879a57d61abffd0932c65207df9c0e674e64a9db570bf809395f6a63086a6 | Python | 4,769 | 149 | import glob
import os
import shutil
import numpy as np
import scipy, scipy.io
import joblib
import h5py
import monai
import nibabel as nib
import skimage.transform, skimage.io
import sklearn.model_selection
import maths_new
import utils.helpers
CONFIG_PATH = './configs'
def centre_crop(dat... |
3f46bffb5535753c21b9a52aca99fa3711de3e409890eac52bdcbd4cbc5340a3 | Python | 4,774 | 136 | from typing import Any, List, NamedTuple, Set, Union
import warnings
from .util import UUID
def citation_key_constructor(loader, node) -> str:
"""
A constructor for !cite yaml tags, returning a bibtex key as a str.
All we need for now is a key string we can match in citations.bib,
so _we're not parsi... |
72b3311f33846c6c2ff2f9532e73757d1be93ce391eba4f824028f1ddf97b2ac | Python | 4,774 | 112 | # The default ``config.py``
# flake8: noqa
def set_prefs(prefs):
"""This function is called before opening the project"""
# Specify which files and folders to ignore in the project.
# Changes to ignored resources are not added to the history and
# VCSs. Also they are not returned in `Project.get_fil... |
00620373a76431db209030a3706048bbbe86c30bd92bb94025bc17f01ec18f81 | Python | 4,775 | 139 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import unittest
from unittest.mock import MagicMock, patch
import pytest
from mmdet.datasets import DATASETS
@patch('mmdet.datasets.CocoDataset.load_annotations', MagicMock())
@patch('mmdet.datasets.CustomDataset.load_annotations', MagicMock())
@patch('mmdet... |
2353506e89cb7d7cc27f879fbd0a83c2aa84ca83bec60d8614d9e54bbf619310 | Python | 4,775 | 97 | import logging, sys, os
import traceback
import time
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../../FedML")))
try:
from fedml_core.distributed.client.client_manager import ClientManager
from fedml_core.distri... |
c1160274a000796005468f88e8118f25a09d451b3d950da994827c284972d8a3 | Python | 4,775 | 97 | import logging, sys, os
import traceback
import time
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../../FedML")))
try:
from fedml_core.distributed.client.client_manager import ClientManager
from fedml_core.distri... |
9669ab24b36a994863f94b489a9b9617dbc9402ea6c98a26bc9de231b4eaf62a | Python | 4,776 | 120 | import torch
import torch.nn as nn
from src.models.time2vec import T2V
from src.models.rnn_encoder import Encoder, Attention
from src.utils.data_loader import ObjectDict
class MobilityEncoderNet(nn.Module):
"""
Recurrent neural network regression with self-attention.
Model description:
* T2V for ... |
9401bb05bf55db9f75209564a37c16ee03bffcf75c75c3a38acda6be5ddda44c | Python | 4,778 | 97 | import logging, sys, os
import traceback
import time
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../../FedML")))
try:
from fedml_core.distributed.client.client_manager import ClientManager
from fedml_core.distri... |
356a60f721c27030654e4c34ae159ef34d85aa219f1648e1061f62a9df280370 | Python | 4,781 | 152 | """
Variance partition for:
1) Syntactic vs Speech
2) Syntactic vs (Speech + SSS), per SSS layer
"""
#### ChatGPT was used to assist writing code. The authors reviewed, edited, and take full responsibility for the content.
import os
PODCAST_ROOT = os.environ.get("PODCAST_ROOT", "/engram/naplab/users/rs4613/Podca... |
b6273dc1ca2fccba24f53a60f545a5f77c6dc61b2d550822d57951195d3182fc | Python | 4,784 | 132 | """ scikit-learn metadata script """
import json
import os
import pydoc
import re
import sys
def _split_docstring(value):
headers = {}
current_header = ""
current_lines = []
lines = value.split("\n")
index = 0
while index < len(lines):
if index + 1 < len(lines) and len(lines[index + 1... |
b3da9309ecfe02599c6f1e8ead7d8e622d25d6d6e4d3e8deb1df07f146fc69e0 | Python | 4,785 | 163 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
f61666aa08fd0337828ba6f9edf4d7b7d29daf98144f62aeb0a9f768dde7c0a0 | Python | 4,785 | 163 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
a45f744e920a5c9b6100362e355020b2dec656869b144bf137a5eb2fcd5b5a3a | Python | 4,786 | 138 | import numpy as np
from scipy.spatial.distance import euclidean
from .ABCEnvironment import ABCEnvironment
from .Walls import LinearWall
from .methods import intersect, projection_rejection
class Rectangle(ABCEnvironment):
def __init__(self, boxsize=(2.2, 2.2), soft_boundary=0.3):
self.origo = np.array((... |
152310c98a582efcdbe015438d242c5427a5f91eb98108bd24b57b3ee1535c8c | Python | 4,788 | 133 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 26 23:00:31 2022
@author: fhu14
Module for parsing output text files into dictionaries for use by other
modules. The structure of output text files should remain constant
"""
#%% Imports, definitions
import os, json
from typing import Dict, Union
#%% Code behind
def sa... |
634f5c3ff753d8a4e433fec2dc5dac80244fcc289af449fbca652ffd86e79771 | Python | 4,790 | 113 |
import pandas as pd
from os.path import dirname, join
import numpy as np
from config_path import DATA_PATH
dir_path = dirname(dirname(__file__))
import logging
def read_file_gc(filename, fs):
with fs.open(filename) as f:
label_analysis = pd.read_csv(f)
return label_analysis
processed_dir = join(di... |
7534f5358853cc0db13e5917fa57d7202aec1f43c8884546a6171f9f1d763663 | Python | 4,795 | 148 | """
U-Sleep neural network architecture for sleep stage classification.
U-Sleep is a fully convolutional neural network based on the U-Net architecture,
adapted for 1D time-series data. It processes multi-channel EEG/EOG signals and
outputs sleep stage predictions for each 30-second epoch.
Architecture:
Input → E... |
3ea682aca580967dd9c4015eaa414caff0a6b63902f5bb467e7ad55e5bbe7077 | Python | 4,797 | 180 | # -*- coding: utf-8 -*-
#File Name : openvibe.py
#Created By : Aurelien Van Langhenhove
from StimulationsCodes import *
import sys, traceback, collections
from StringIO import StringIO
class NewStd(StringIO):
def __init__(self):
StringIO.__init__(self)
def flush(self):
self.buf = str()
def... |
c411f9021f269d0902d0108f585d64359c7ae60a2085031234650f16e7545839 | Python | 4,800 | 135 | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import torch
from mmdet.models.dense_heads import PAAHead, paa_head
from mmdet.models.dense_heads.paa_head import levels_to_images
def test_paa_head_loss():
"""Tests paa head loss when truth is empty and non-empty."""
class mock_... |
06fc5d8a9b6924f3e726dea1d72c114eeea2221333b8a5cba9a0391b73a7a1b5 | Python | 4,802 | 112 | ############################################
# imports
############################################
from oligo_designer_toolsuite.database import OligoDatabase
from oligo_designer_toolsuite.oligo_property_calculator import BaseProperty
from oligo_designer_toolsuite.utils import cast_to_list
from ._property_functions... |
94b661a234dc38261e6fb1be7138079dbccbb149e7f8b78191afdd3c837d778a | Python | 4,804 | 121 | import math
from basicstat import *
from studentC import student_table
def readwaic(runnames, min_ess = 10):
logl_idx = 1
var_idx = 2
loocv_idx = 3
essloocv_idx = 4
logpostmeanl_idx = 5
esspostmeanl_idx = 6
runs = []
for run in runnames:
with open(run, 'r') as infile:
... |
959fc252643ad057cc2f618421d013eb1a8b12e2433714e0caec7401902f4410 | Python | 4,804 | 124 | """test_layer_wrappers.py
This file is part of the test suite for keras2c
Implements tests for layer wrappers
"""
#!/usr/bin/env python3
from test_core_layers import build_and_run
import numpy as np
import os
import time
import subprocess
from keras2c import keras2c_main
import unittest
import tensorflow.keras as ker... |
c2bd6e72f974dda885a7d71fed87ec163a31dd6486117fec7990ba89749e4e36 | Python | 4,805 | 160 | # Copyright 2021 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""StyleMelGAN's TADEResBlock Modules."""
from functools import partial
import torch
class TADELayer(torch.nn.Module):
"""TADE Layer module."""
def __init__(
self,
in_channels=64,
aux_channels=80,
... |
0a8b93edf2d1537050791991ad7418a889b746cdaa1d222b4858c37639e27df1 | Python | 4,806 | 160 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
0ac32f70c527a1210309351c2503fbeb24c90e89bcbd0b15e2f08550b75e34a6 | Python | 4,806 | 160 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
2c430d44411e860a117368eafc7d95c90570e6657a602c27d9eee3c3a9605642 | Python | 4,806 | 168 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
3b2227e2b17b79e271d8214b32bf7c2a6ed912826c47d7196a78a50eb24cf34b | Python | 4,806 | 160 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
78e25aba2f08f746de32ed396ac5b715b53841135edd3fa6eacb9269697f96fa | Python | 4,806 | 165 | #format ERDS (vcf) output #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT <sample> <sample> <sample> <sample>
import os, sys, re
tags = {}
tag_pos = {}
tags_of_interest = ["FORMAT","INFO"]
for key in tags_of_interest:
tags[key] = {}
def print_tags():
for t in tags.keys():
print t, tags[t]
... |
9e36c67c593b4efea94cbcb660fc49a01c7870e573c432f5025e90c82dccb7bd | Python | 4,806 | 160 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
8b19e52a6fa0659ba03bd8e3cc612de0d3e276c5c53da96790fdc7ae3257576e | Python | 4,807 | 168 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='... |
c29bef785c7b3a7db8d604148075f42cd2aeb685a1c7c78b86d8f81216251456 | Python | 4,808 | 163 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import mmcv
import pytest
import torch
from mmdet import digit_version
from mmdet.models.necks import FPN, YOLOV3Neck
from .utils import ort_validate
if digit_version(torch.__version__) <= digit_version('1.5.0'):
pytest.skip(
'ort back... |
7e85e7fe3506c2f3b9deff4b979fe8ff896edb74ada706786679194efa9cc7e7 | Python | 4,809 | 107 | import unittest
import json
import pathlib
import os
import shutil
import responses
from deepdiff import DeepDiff
from exsclaim.pipeline import Pipeline
from exsclaim.tool import JournalScraper, CaptionDistributor
from exsclaim.figure import FigureSeparator
class TestNatureFull(unittest.TestCase):
def setUp(sel... |
c2f011bbd9b581e4fe77310e2f3e88ba45fe3acef6c6fb0e1760593f81a67a49 | Python | 4,809 | 97 | import argparse
import matplotlib.pyplot as plt
from my_tools import *
from matplotlib import rcParams
rcParams.update({'font.size': 17})
def compute_overlap(VTA_tracts, VTA_tracts_path, total_weights, sorted_codes):
overlap = {}
# for each VTA
for VTA in VTA_tracts:
overlap[VTA] = {}
# rea... |
49cc1a245b90f6f6d56325b25fab1af9aed639f3c24388d964f45309dd482ef0 | Python | 4,814 | 168 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
1400befa199a2e21f04a319ba9b72983aa0c8b9126702fa5eca4db276ed0533d | Python | 4,815 | 168 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='... |
6b295980233ff801d96b5053210014ff4f653b4d219f1b1f31ad8925d9558103 | Python | 4,815 | 168 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='... |
89c025eace423cf912f0f91d923f8bac17b1e656f2b283ca16ccddd7b1a8feca | Python | 4,819 | 144 | #!/usr/bin/python
"""
Some functions to read and compute spectral features on SITS
"""
import sys, os
import numpy as np
import pandas as pd
import math
import random
import itertools
from tensorflow.keras.utils import to_categorical
import csv
# ----------------------------------------------------------------... |
9768baac4ffb0a9acd632e40ef93e76355eb94c0c670bb2e141c8d782c91eead | Python | 4,823 | 135 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import warnings
from argparse import ArgumentParser, Namespace
from tempfile import TemporaryDirectory
import mmcv
import torch
from mmcv.runner import CheckpointLoader
try:
from model_archiver.model_packaging import package_model
from mode... |
a5eaf982cc6d5cc6cb6eb59f776e44c4beee6d41ff153322ef3a30216c1c460d | Python | 4,823 | 123 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
from .camera_base import CAMERAS, SingleCameraBase
@CAMERAS.register_module()
class SimpleCamera(SingleCameraBase):
"""Camera model to calculate coordinate transformation with given
intrinsic/extrinsic camera parameters.
Note:
Th... |
3a42cd986f6711eae79daed909380e07af7691fa41f5fa69da5af0cf65a326e6 | Python | 4,824 | 116 | ###############################################################
##### Touchscreen Windows Launcher #######
##### by: Daniel Palmer, PhD #######
###############################################################
#Imports#
from tkinter import N
from tkinter... |
773a57a9280a23b15c983c34c9f68f5d36b93136f56cfc4ec0758199ffb0f9b7 | Python | 4,829 | 115 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.runner import force_fp32
from mmdet.models.builder import ROI_EXTRACTORS
from .base_roi_extractor import BaseRoIExtractor
@ROI_EXTRACTORS.register_module()
class SingleRoIExtractor(BaseRoIExtractor):
"""Extract RoI features from a single leve... |
5f74e9a038e7a9128a154f9e3fef77b0bd0c9a8d6a3008556f211f3a9f8a6435 | Python | 4,831 | 116 | # Imports #
import kivy
import zipimport
import sys
import os
import configparser
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.dropdown import DropDown
from kivy.uix.floatlayout import Float... |
1c1ad5ebf9204b9d7e64759e6b7d2be705029ffbd4ee37e68e039a432d667065 | Python | 4,834 | 145 | theLongDescription = """P4 does Bayesian and maximum likelihood phylogenetic analyses on
molecular sequences. It's specialty is that you can use heterogeneous
models, where the model parameters can differ in different parts of
the tree, or over different parts of the data.
"""
# distutils is deprecated and removal is... |
fd468e967aeda62f2ba9f8affe1f50cbfb07af71451a02194b97c3451472ee49 | Python | 4,834 | 147 | import json
import os
from os.path import *
import numpy as np
from hydra.utils import to_absolute_path
from base.config import Config
from base.results.json_utils import NumpyEncoder, remove_empty_values
from base.utils import DelayedExecutor
class BaseResultTracker:
"""
Abstract base class for tracking an... |
b67943b502481b286ac5ef6400d689da5484abb1e02e7dc6256bfdfc311798c4 | Python | 4,836 | 134 | # Copyright (C) 2024-2025 ETH Zurich, Niels Maeder and other DASH contributors.
"""Functionality to obtain the DASH properties data from ETH research archive."""
import zipfile
from enum import Enum, auto
from pathlib import Path
from typing import Union
from urllib.request import urlretrieve
from serenityff.charge.... |
482b30bfa8e60f1453200315afcd5564fc9e9aa1d14aeb9710a58fd7a9f52658 | Python | 4,837 | 115 | import numpy as np
import warnings
from . import utils
# Constant definition
FS = 10000 # Sampling frequency
N_FRAME = 256 # Window support
NFFT = 512 # FFT Size
NUMBAND = 15 # Number of 13 octave band
MINFREQ = 150 ... |
d6dab0e1746cb84f537149b5032a72a92e54405491dfdc7799f22586f4c913c7 | Python | 4,837 | 162 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/cofw.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(interval=1, metric=['NME'], save_best='NME')
optimizer = dict(
type='Adam',
lr=2e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config =... |
abd45fadee2dc1df9660dd95af337988392eed52f6c9576d553326f38c510da0 | Python | 4,844 | 117 | # Imports #
import kivy
import zipimport
import sys
import os
import configparser
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.dropdown import DropDown
from kivy.uix.floatlayout import Float... |
b3129d0d18feb611243a1cbed5614deecc089c859b14e0332b041593994b6b7d | Python | 4,848 | 146 | from collections import Counter
from typing import Optional
from Bio.Align import MultipleSeqAlignment
import numpy as np
def smart_gap_threshold_determination(
alignment: MultipleSeqAlignment,
gap_chars: list,
seq_records: Optional[np.ndarray] = None,
gaps_dist: Optional[np.ndarray] = None,
) -> flo... |
76512089b3282362f668fe148acec1e1dc62497cf2b8cdde21fad10d50d4cbbe | Python | 4,854 | 133 | import time
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
from parse_config import ConfigParser
class dilated_conv(nn.Module):
""" same as original conv if dilation equals to 1 """
def __init__(self, in_channel, out_channel, kernel_size=3, dropout_rate=0.0, a... |
9cf085e63224f0c8a01770fca07e865351aabe35d353ce3581c5cda9e1781c0e | Python | 4,855 | 120 | """The AEV kernel gate must consult warp's CUDA availability, not only torch's.
A CUDA-enabled pytorch alongside a CPU-only warp-lang build is a solver-reachable
environment on conda-forge; the gate must fall back to the einsum path instead of
letting conv_sv_2d_sp raise inside forward.
"""
import io
import os
import... |
731bf1e3868365eed959abd1a69caf41dde132322f2abcf3e16b15a1cb71def4 | Python | 4,859 | 167 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
checkpoint_config = dict(interval=50)
evaluation = dict(interval=50, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=0.0015,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config ... |
1120c562839f951784384ec8b531212dea5ac447744ece3e16401377203b942d | Python | 4,860 | 162 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/cofw.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(interval=1, metric=['NME'], save_best='NME')
optimizer = dict(
type='Adam',
lr=2e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config =... |
870b1eb2f99b5702146ae4a2279101792c55e9d03bd245774939c6e1fb191868 | Python | 4,860 | 140 | """Functions for interacting with postgres database"""
import pathlib
import shutil
from configparser import ConfigParser
import psycopg2
from psycopg2 import sql
def initialize_database(configuration_file):
parser = ConfigParser()
parser.read(configuration_file)
# connect to default postgres database, c... |
89e72fdc8f48d07dad0d63906137752b057e51f3fb60de0e534657bdb5dce850 | Python | 4,863 | 111 | import os
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Dense, Lambda, Dot, Activation, Concatenate, Layer, RepeatVector, Add
# KERAS_ATTENTION_DEBUG: If set to 1. Will switch to debug mode.
# In debug mode, the class Attention is no longer a Keras layer.
# What it means in practice is... |
ec81e756f697f0872f6ae9c4c8fb91898bc6039c0d5b040138633a753c9f6c58 | Python | 4,863 | 115 | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 5 12:48:03 2021
@author: fhu14
Additional functions for DFTBPlus package
"""
#%% Imports, definitions
import pickle
from functools import reduce
from typing import List, Dict, Union
import os, re
import numpy as np
from statistics import mean, stdev
Array = np.ndarray... |
2adb8daf05dcbde23e057887736662b8e18eda62471f4357a9cd20a20ae3bcd6 | Python | 4,871 | 160 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/h36m.py'
]
evaluation = dict(interval=10, metric=['PCK', 'EPE'], save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
90e7256f2cde525c281e8e2be508ba1f346736e4397b8315e69c68c455a20822 | Python | 4,871 | 160 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/h36m.py'
]
evaluation = dict(interval=10, metric=['PCK', 'EPE'], save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
5c6f06e06e74abb723b88363f980207622404360201157301fbd5f78f4c1487b | Python | 4,873 | 127 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 27 17:13:13 2020
@author: bariskuru
"""
import os
import numpy as np
from scipy.stats import skewnorm
from skimage.measure import profile_line
time_sec = int(field_size_cm/speed_cm)
time_ms = time_sec*1000
start_cm = 75
dt = (time_sec)/arr_size ... |
215a03a5f96e30e844cfa34fcae364094fe43523e199377cb8ae4d7bcdff2449 | Python | 4,876 | 79 | """General-purpose training script for image-to-image translation.
This script works for various models (with option '--model': e.g., pix2pix, cyclegan, colorization) and
different datasets (with option '--dataset_mode': e.g., aligned, unaligned, single, colorization).
You need to specify the dataset ('--dataroot'), e... |
346a8ee277c4e4281e93329c642e2a7dbd0cdc4be842a51218603f3e22dc9b20 | Python | 4,880 | 162 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/aflw.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(interval=1, metric=['NME'], save_best='NME')
optimizer = dict(
type='Adam',
lr=2e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config =... |
39bf3752a506ffd4de3431b1d544ca2efbeec6cc6ab9ad13ab838526e4d7879d | Python | 4,880 | 162 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/wflw.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(interval=1, metric=['NME'], save_best='NME')
optimizer = dict(
type='Adam',
lr=2e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config =... |
63ac797205b8b9750c345013b48b2e569db574639433d3e22646581b45aa779d | Python | 4,881 | 144 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
"""Tests for the builder-pattern foundation types.
Covers ``ZScoreConfig``, ``ZScoreStats``, ``BuildContext``,
``compute_z_score_stats``, and the ``Condi... |
cfa352aa15dbd95007ea0e53c0c82c3096c333a9ac34df18f7a369f31cd687b6 | Python | 4,882 | 165 | import numpy as np
import os
import json
import collections
DEFAULT_WORD_COUNT_FILE = 'stackoverflow.word_count'
DEFAULT_TAG_COUNT_FILE = 'stackoverflow.tag_count'
word_count_file_path = None
tag_count_file_path = None
word_dict = None
tag_dict = None
'''
This code follows the steps of preprocessing in tff stackoverfl... |
2dc0bffbb6d3400c8c44064ea2da98e812c1c476d7aad697267e5f4b807e2aec | Python | 4,883 | 162 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/wflw.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(interval=1, metric=['NME'], save_best='NME')
optimizer = dict(
type='Adam',
lr=2e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config =... |
be8c83add93ce626a6e4b60803500dbb7a7138dcc102c999c0fa535eadcb2f10 | Python | 4,884 | 144 | import torch
torch.manual_seed(0)
import os
import pandas as pd
from os.path import dirname, join
import numpy as np
import time
from transformers import DataCollatorForLanguageModeling
from transformers import Trainer, TrainingArguments
from transformers import AutoModelForMaskedLM, AutoTokenizer
# model_name = '/... |
dcaa00edcfa629946793aab74c92f19f10ced25ef14dd496edccadeb3cbc46ab | Python | 4,884 | 162 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/300w.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(interval=1, metric=['NME'], save_best='NME')
optimizer = dict(
type='Adam',
lr=2e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config =... |
cd457e7bcbbb8f96b843914ddad8d6953b04694109370b5331b861bd00f53139 | Python | 4,885 | 126 | import networkx as nx
import numpy as np
from .base_topology_manager import BaseTopologyManager
class AsymmetricTopologyManager(BaseTopologyManager):
"""
The topology definition is determined by this initialization method.
Arguments:
n (int): number of nodes in the topology.
undirected_n... |
dad58235e4d3e50b17981a6f3e96fd4fe8fbfd724e615b7aee1d71ad76403e92 | Python | 4,885 | 135 | from copy import copy, deepcopy
from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN... |
28c5635bcd8ec917bea8f33088afb50ba51bc9b1f69540679fc70f7c933c0dbb | Python | 4,886 | 135 | from copy import copy, deepcopy
from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN... |
91dfd158b7172785fa8f7cb221d22d8a131787b185085f5ced58471bc75261ae | Python | 4,886 | 135 | from copy import copy, deepcopy
from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN... |
e625654f29c1078e1ea571b5b56a7ffb287d4492ec2aebea852b879c270e7e28 | Python | 4,886 | 135 | from copy import copy, deepcopy
from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN... |
8b00740cbc53c088ea2d23a32402f9f4694597fce6a3ff4f5f606edb25d9f866 | Python | 4,887 | 146 | import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
from scipy.stats.mstats import zscore
import utils.recruitmentCellBout as rct
import utils.import_data as load
import utils.createExpClass as createExpClass
import utils.createCellClass as createCellClass
def calc_dff(cells, f_corrected... |
007130974792e36b4859726f8e4e990cbc98714289ff3ec8cc06eddfb6294c98 | Python | 4,888 | 110 | import argparse
import math
import os
import pandas as pd
import numpy as np
import torch
from cleft_dataset import CleftDataset, CleftDataModule, TrainTransform, EvalTransform
from cleft_nets import CleftClassification
from cleft_logger import CleftImageLogger
from pytorch_lightning import Trainer
from pytorch_li... |
dd540538466afdd5917d20678296a3100b2e62e3ea6a71d25deee0d802aad884 | Python | 4,888 | 135 | from copy import copy, deepcopy
from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN... |
873cbb141704108d799631a46535b434468cc563b99e895f7e5edbfc862c3552 | Python | 4,889 | 135 | from copy import copy, deepcopy
from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN... |
9898920f3d43c768587ac11a89f9e6218b14d984288250b4820901d8a09296b4 | Python | 4,889 | 135 | from copy import copy, deepcopy
from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN... |
9ae988549063eddb2efe779a549e6341abdfbcf45f8f6a17639271aaffddd471 | Python | 4,889 | 135 | from copy import copy, deepcopy
from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN... |
9b3303be6b595f90ebd44fb8151ee1d1962e92f142c2dd47eb61d4376596f9c5 | Python | 4,889 | 146 | #!/usr/bin/env python
# -*- coding: UTF-8 -*
from collections import defaultdict
from sklearn.preprocessing import MinMaxScaler, StandardScaler, normalize
import logging
import networkx as nx
import numpy as np
import scipy.sparse as sp
import sys
from graph import Graph
import random
def read_graph(ctrl, file_path, d... |
c12bfba83b0a5038e42a3aa417150b21ec944752d180b0e37774c3c98d6abda8 | Python | 4,891 | 129 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from mmcv.runner import BaseModule
from ..builder import NECKS
@NECKS.register_module()
class SSDNeck(BaseModule):
"""Extra layers of SSD backbone to generate multi-sca... |
793fe8c0dbe4632594e7c3bf471098ce4352833f294c2a98866acc69531586a1 | Python | 4,893 | 110 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 7 19:47:44 2021
@author: fhu14
"""
#%% Imports, definitions
from .base_classes import LossModel
from .external_funcs import compute_charges
from typing import List, Dict
import numpy as np
Array = np.ndarray
import torch
Tensor = torch.Tensor
import torch.nn as nn
#%% C... |
087833ca0122deabb66e581e957b5bb8bf53c2d6292e2f50420fb1963b5bcb71 | Python | 4,896 | 159 | from typing import Union, Tuple, Optional, Any
import math
import eagerpy as ep
from ..models import Model
from ..criteria import Misclassification, TargetedMisclassification
from ..distances import l2
from ..devutils import atleast_kd, flatten
from .base import MinimizationAttack
from .base import get_criterion
f... |
a30eb9c30782ffc2c5f780b4c04da9363ba72a75b1ab6be33cdc9b00ae082307 | Python | 4,901 | 138 | import torch
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers import BertModel, PreTrainedModel, BertConfig, load_tf_weights_in_bert
from transformers.modeling_outputs import Seq2SeqSequenceClassifierOutput, SequenceClassifierOutput
class TorchDataset(torch.utils.data.Dataset):
... |
3fe7c25ba0919c19de16d6fa4b50a591e255af1f3cf92676bd66a4c7879c3036 | Python | 4,903 | 111 | """
Does the unique semantic variance survive the lexical control *in the IFG*?
(Reviewer 1, comment 1.3)
semantics_lexical_control.py answered this across all 1,268 electrodes, which is
Fig 5c. The reviewer's argument is specifically about the IFG ("the IFG strongly
tracks lexical predictability"), so the sharper tes... |
4a5d47b5724625f536d02401f084456fa81074f8dcd08c355710ab196c2eb326 | Python | 4,905 | 162 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/wflw.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(interval=1, metric=['NME'], save_best='NME')
optimizer = dict(
type='Adam',
lr=2e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config =... |
e0be140f7cf2894f50167e89126b03d64deaf956f7c4aa09f4add47ee1a70969 | Python | 4,905 | 162 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/aflw.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(interval=1, metric=['NME'], save_best='NME')
optimizer = dict(
type='Adam',
lr=2e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config =... |
1614b4cea4021beb790c76162ec57903a67675adab2ea33beff814b4500569ab | Python | 4,906 | 170 | import dataclasses
from typing import Optional
import haiku as hk
import jax
import jax.numpy as jnp
import numpy as np
import utils
def layer_norm(x: jnp.ndarray) -> jnp.ndarray:
'''add a LayerNorm layer and apply to x'''
ln = hk.LayerNorm(axis=-1, create_scale=True, create_offset=True)
return ln(x)
@datacl... |
1aff68dfa4478b5fc54121c66daccd2ebd518a19101ca5229e6b6be24594e12b | Python | 4,906 | 132 | """
author: mathildelpx
creationTime: 22/02/2022
goal: load calcium imaging data output from suite2p, behavior pre-processed data and compute map of recruitment and
regressor analysis.
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats.mstats import zsco... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.