sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
69906f953359dcc637d8e50cdea658eb329568b537aee0410c5a391617d1c457 | Python | 3,384 | 69 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
import torch
from ultralytics.engine.predictor import BasePredictor
from ultralytics.engine.results import Results
from ultralytics.utils import ops
class RTDETRPredictor(BasePredictor):
"""RT-DETR (Real-Time Detection Transformer) Predictor ex... |
41f0a3702a5b3970333fa0157b7813f5c8019af4e8f10b0f5fbffef9da33327c | Python | 3,385 | 104 | # Copyright 2022 Deepfold Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
64e4b36bb03792a67d9f1504cfa920b358c7e24d911cea6437c77c341dba2417 | Python | 3,385 | 91 | import importlib.resources
import numpy as np
from PyQt6 import uic, QtCore, QtWidgets
from .. import units
from .mpl_edelta import MPLEDelta
class TabEdelta(QtWidgets.QWidget):
def __init__(self, *args, **kwargs):
super(TabEdelta, self).__init__(*args, **kwargs)
ref = importlib.resources.files(... |
6e0d3892ad3d94b4c6ee86024d50676a040b99aed69740560eda884e57c2a0e3 | Python | 3,385 | 75 | """W4A16 weight-only quantization (packed int4 weights).
The mode is one strategy assembled from one handler class per geometry
family: `projection` (`Dense`, `EinsumDense`) and `lookup` (`Embedding`,
`ReversibleEmbedding`). `Int4Strategy` itself holds what is shared: the
policy-string codec and the block-size resolut... |
a9732cff1ca5ee0420bc5f656df105c32cea32389033742c8f46dffab3b435cd | Python | 3,386 | 101 | import packaging.version
from pallets_sphinx_themes import get_version
from pallets_sphinx_themes import ProjectLink
# Project --------------------------------------------------------------
project = "Flask"
copyright = "2010 Pallets"
author = "Pallets"
release, version = get_version("Flask")
# General -------------... |
bb3adfbcaf0aa46bbb8d34996dac9617d97df57f5ffdedb5db10a8c7cb638fee | Python | 3,387 | 106 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Selected(_BaseTraceHierarchyType):
_parent_path_str = "scatterpolar"
_pat... |
e1c54ea883bbbf0c29f0ec2abb2bd57a13fa539eaf3ab4ab5e9e226eb45853b7 | Python | 3,387 | 106 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Selected(_BaseTraceHierarchyType):
_parent_path_str = "scattersmith"
_pat... |
f8a656f788a6b3fb6d0f9f808365fb473df30d6d75199b2631867447c98ffbc8 | Python | 3,387 | 97 | from pytorch_lightning.utilities import cli as CLI
import pytorch_lightning as pl
from lib.utils.log import log_system_info
from pytorch_lightning.callbacks import (
EarlyStopping,
LearningRateMonitor,
)
import logging
from time import time, sleep
import torch
logger = logging.getLogger(__name__)
class Cus... |
6de48f5192d396f36703db222c7cfb091e98274209ad855d53d29612cfe22344 | Python | 3,388 | 94 | from typing import List, Tuple, Iterable
import tensorflow as tf
import keras
try:
from mpi4py import MPI
except ImportError:
MPI = None
try:
ADAM_BASE = keras.optimizers.legacy.Adam
except:
ADAM_BASE = keras.optimizers.Adam
class AdamSynchronizationError(Exception):
pass
class MpiAdam(ADAM_B... |
d33dfb730aeca8e3c73a64a90c698240a63719cff2b924a2fe1e591c13e27296 | Python | 3,388 | 113 | #!/usr/bin/env python3
import argparse
import sys
import os.path
import csv
from collections import namedtuple
import pandas as pd
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score, calinski_harabaz_score
import numpy as np
import pylab
Clustering = namedtuple('Clustering', ['n_clusters'... |
388adc050b5997bb005864ec830058e68f492cd64c7728e8a2d5049033076043 | Python | 3,389 | 92 | # coding=utf-8
# Copyright 2022-2023 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 app... |
1b87d50e00a6ac45dac9cd7978fd18fa5a32a4c4d7d40606392f6d974fc8dd1b | Python | 3,390 | 91 | import sys
sys.path = ['/autofs/cluster/freesurfer/python/fsmodule'] + sys.path
import nitorch as ni
import freesurfer as fs # Needs python 3.6 or 3.8
from sklearn.metrics import pairwise_distances_argmin_min
import glob
import torch
import os
root = '.'
odir = root + '/warp2surf'
sdir = root + '/mri/samseg/surf'
... |
9682150e33105279104678f2f6e01f73efa92543eefeda6da53b71103efc3adb | Python | 3,390 | 109 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Line(_BaseTraceHierarchyType):
_parent_path_str = "box"
_path_str = "box.... |
19c6c8c1b9e2d736d1ef0cc7a0d2f70049705e42ef2d0ac297634747e9aeb43f | Python | 3,391 | 99 | """
File Management API Module
Handles file management operations including browsing, downloading, and file removal.
"""
import datetime
import fnmatch
import os
import subprocess
import zipfile
import bottle
from .base import BaseAPI, error_decorator
class FileAPI(BaseAPI):
"""API endpoints for file manageme... |
2674954223b82748c3b61095e0401646b57ca37bfa98819d48615732aa6e8a0f | Python | 3,391 | 117 | from collections import OrderedDict
from xml.etree import ElementTree
import numpy as np
import czifile
from skimage.color import rgb2hsv
from ..util import hashobj
def load_czi(path):
"""Load .czi files
Please see :func:`impose.formats.load` for more information.
"""
czi = czifile.CziFile(path)
... |
39b4cdde9bad3931bc34e8df1507630e4a439dea36fd0a79372e3e0dffffce0a | Python | 3,391 | 110 | import torch
import numpy as np
import torch.nn as nn
import torch.optim as optim
import torch.utils.data as data
import torch
import numpy as np
import torch.nn as nn
from sklearn.model_selection import train_test_split
import torch.optim as optim
import torch.utils.data as data
from sklearn.metrics import r2_score
... |
39e1e80606fdafcbdfa18d7e833704a414d27161ea3b47838ef7ee5e38b7071a | Python | 3,391 | 60 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
7515dde0727a3792bb25ce41596adcde909dc016db204b23fffd3668eeee4489 | Python | 3,391 | 98 | # Demonstrate the difference in 2D environment between intrinsic (asymmetric recurrence) and extrinsic (STD) model
from os.path import join
import numpy as np
import os
import pandas as pd
from library.comput_utils import cal_hd_np
from library.shared_vars import sim_results_dir
from library.utils import save_pickle, l... |
b5939b7ccc64252a9c634ad872ea48b2856424718e5816b79a953efb3ae7f7f1 | Python | 3,391 | 125 | """Tests for specparam.utils.checks."""
from pytest import raises
from collections.abc import Iterable
from itertools import repeat
import numpy as np
from specparam.utils.checks import *
###################################################################################################
###########################... |
ee1c7688f381a77606ed53c15926dbc618b025f20697acf56a900841cc733b8d | Python | 3,391 | 104 | """MobileNet variants with DUC upsampling layers for CenterNet object detection."""
# pylint: disable=unused-argument
from __future__ import absolute_import
import warnings
from mxnet.context import cpu
from mxnet.gluon import nn
from .. model_zoo import get_model
from ...nn.block import DUC
__all__ = ['DUCMobilenet... |
08c039b6bf051f822eac192fd88d6aeb1aea187d6389b09090ad2de716b2d87b | Python | 3,392 | 95 | import os
import glob
import argparse
from concurrent import futures
from functools import partial
import numpy as np
import numpy.linalg as LA
from scipy.spatial import distance_matrix
def generate_contact_graph(chain_file, cmap_thresh, save_dir):
# print('In generate')
save_dir += f'/{cmap_thresh:02d}'
... |
6c53637618a808ca485ecb6709eca2a0d675a3391de528811192f26effde274e | Python | 3,392 | 100 | import os
import numpy as np
import pickle as pkl
import nibabel as nib
from os.path import join as pjoin
from magicbox.io.io import CiftiReader, GiftiReader
from magicbox.graph.triangular_mesh import get_n_ring_neighbor
from cxy_visual_dev.lib.predefine import proj_dir,\
Hemi2stru, mmp_map_file, s1200_midthicknes... |
1d5b33e73001b9df1996b209205b8028fe8dee6bb60a5ad36a57996cf846391d | Python | 3,393 | 75 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""tests for base gnn"""
import unittest
import numpy as np
from sknetwork.data.test_graphs import test_graph
from sknetwork.gnn.base import BaseGNN
from sknetwork.gnn.gnn_classifier import GNNClassifier
from sknetwork.gnn.layer import Convolution
from sknetwork.gnn.opt... |
3e82923b63ec32632f6ca91e0ab9499a32580e130d0de179cae62d4c6d559ed9 | Python | 3,393 | 106 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Unselected(_BaseTraceHierarchyType):
_parent_path_str = "scattergeo"
_pat... |
5d1e0e9198d098b92837fea0d002f116e2d0e2df9d9ee16775e519c45c171011 | Python | 3,393 | 121 | def NAME_TO_WIDTH(name):
mn_map = {
'mn01': 0.1,
'mn02': 0.2,
'mn04': 0.4,
'mn05': 0.5,
'mn06': 0.6,
'mn08': 0.8,
'mn10': 1.0,
'mn12': 1.2,
'mn14': 1.4,
'mn16': 1.6,
'mn20': 2.0,
'mn30': 3.0,
'mn40': 4.0,
}
... |
6df63ebf2b52c3d6c29c8be7cbf8ef30912bc14123ff3a326cd91f7bb5df9096 | Python | 3,393 | 98 | from typing import Dict, List, Tuple
from lightly.transforms.gaussian_blur import GaussianBlur
from lightly.transforms.multi_view_transform import MultiViewTransform
from lightly.transforms.torchvision_v2_compatibility import torchvision_transforms as T
from lightly.transforms.utils import IMAGENET_NORMALIZE
class W... |
45f0fcefe194dbce37362bbefffad0581032d3aa2fe4868d6375388c5e661b8c | Python | 3,394 | 76 | import argparse
import numpy as np
import pandas as pd
from sklearn.model_selection import RepeatedStratifiedKFold
from pathlib import Path
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Create CV folds')
parser.add_argument('--folds', type=int, default=5,
he... |
0ade60103e3736e782649c2bf5dc80a53d37778414e3ac904aefab2398e343cf | Python | 3,395 | 74 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
0c4b0dcf0cc3ca7652187ad5bd48dadcfa4befc92374fe8f48aebc502372a15d | Python | 3,396 | 106 | # LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this software except in compl... |
1ae0cce05b795a841d01dd1379cb193eae3b2acf97c0e0b84bb8889903b16ea0 | Python | 3,396 | 105 | # -*- coding: utf-8 -*-
import itertools as it
import numpy as np
from sklearn.cluster import KMeans
from .circle_detector import CircleDetector, DetectionType
CIRCLE_DETECTOR = CircleDetector()
class Spots:
"""Holds the spot data. These spots are stored with positions relative
to the originally-uploaded... |
6a7e71345850785f9897c5f55d508acff90c58e7a8c9e3f56d79aa1aa4db8530 | Python | 3,396 | 84 |
'''
Prerequisite: check instructions in cython_code/setup.py
Note: reference frames in numpy and opencv2
[x,y] in numpy array:
x = row; y = col
***********************************
* [0,0] → increasing y → [0,ncol] *
* ↓ *
* increasing x *
* ↓ ... |
7fbdfc9af4acb68d5c3a5129810d30b315c2dd131d5bc967096d708b247127f9 | Python | 3,396 | 102 |
#%% Packages
import torch
import numpy as np
import utils
import torch.nn.functional as F
import copy
# Load data
def get_data(file_dir1,file_dir2): #np.array(N, T, D)
data1 = np.load(file_dir1)
data_raw = copy.deepcopy(data1["od_county_matrix"])
train_masking_matrix_ = copy.deepcopy(data1["train_m_matrix... |
fad962f619704a0e6ea357dd8c429560bf15f3a86b0e6628d31bb42809485bc5 | Python | 3,397 | 105 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 10 16:46:24 2020
@author: sc
"""
import torch
from torch_geometric.nn.conv import MessagePassing
from scene_graph_prediction.scene_graph_helpers.model.pointnets.networks_base import mySequential
def MLP(channels: list, do_bn=False, on_last=False,... |
02b08c0dc6994f9713055bb196254bde7e341fdba6f4ba2586990da18cd50645 | Python | 3,398 | 103 | import importlib.util
import ntpath
import os
from typing import Optional
__all__ = ['CONFIGS', 'OpenCC', '__version__']
_this_dir = os.path.dirname(os.path.abspath(__file__))
_opencc_share_dir = os.path.join(_this_dir, 'clib', 'share', 'opencc')
_opencc_rootdir = os.path.abspath(os.path.join(_this_dir, '..', '..'))
... |
0fe69ab42395cb9a9572f9217b0c7544a974229fcc6e5d6fea19ef0b277d82f5 | Python | 3,398 | 97 | # coding=utf-8
# Copyright 2024 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... |
58af198ea6e95d3fbc8f749c81a10ebc3646ff6cc0784659d3c69383fe2f9b64 | Python | 3,398 | 88 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# Some parts of the code were referenced from or inspired by below
# - Tristan Bepler's code (https://github.com/tbepler/protein-sequence-embedding-iclr2019)
""" Biological sequence encoding functions """
import numpy as np
class Alphabet:
... |
6191e8e3a90b32cb131567f6b668ba6900ce3168cc5c7ad72a733043f1c5157b | Python | 3,398 | 87 | """Shared ``ToolSource`` lookup-or-create helper.
A ``ToolSource`` row is content+identity-addressable: the same persisted tool
source (XML, or JSON for CWL) under the same parser class and execution
identity corresponds to one row. Distinct dynamic-tool rows can therefore carry
identical source text without one reque... |
bb098f740854f7f54b851e68e9ac3a1af79a19e29de04684a3cbc636604140d7 | Python | 3,398 | 90 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in tfep.nn.transformers.moebius.
"""
# =============================================... |
e51643894b364db9c1772b20b94bef3ab88afc69e736000e329de03751f64fc0 | Python | 3,398 | 98 | """Geometry-over-reduced-payloads oracles (F20, brainpipe memo D-19).
The composition reduce-then-geometry was broken: repgeom collectors read
``.out`` only, so the exact traces the brain-benchmarking sweep produces
(transform retained, raw dropped) refused every geometry verb. Collectors
now fall back to the transfor... |
fef126eab6bacf5661dab9d97aa4126b91ff6dce7701bb36feea5a2304427ba9 | Python | 3,398 | 100 | """Annotation blobs must not survive trace derivation (fork/rerun).
``Trace._annotation_blobs`` holds render-time payloads (feature maps, RDM,
MDS, scree) derived from the CAPTURED activations of one specific run. Any
operation that derives a trace with different run-state — ``fork()`` (a
mutation target) or ``run()``... |
af60f95e65f04d3b3727d89ccc8e6e88089a0f931df18f35036945aedcf1782b | Python | 3,400 | 106 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Selected(_BaseTraceHierarchyType):
_parent_path_str = "scattercarpet"
_pa... |
b38784a2cd4e888ce67b017ccd8164eb748eed2bdc473109648d7280c1061136 | Python | 3,400 | 123 | import pytest
from celery.utils.text import (abbr, abbrtask, ensure_newlines, indent, pretty, remove_repeating_from_task,
simple_format, truncate)
RANDTEXT = """\
The quick brown
fox jumps
over the
lazy dog\
"""
RANDTEXT_RES = """\
The quick brown
fox jumps
over the
laz... |
8d66b821455f1bbd7464cde461e443bb721d9cf7b4e1be783a647ad3893e1323 | Python | 3,401 | 88 | """Provocation tests for the checks-kit vocabulary (the S-17 provocation ratchet).
Every code the kit declares must be provoked by a real failing input, not
merely documented -- an unprovoked tripwire is indistinguishable from a dead
one. Each test here drives the REAL surface to the exact refusal/finding and
asserts ... |
91d060beb649603d484287d9bacd52fd0648486a7d55b49ada9ac5a44937ce40 | Python | 3,401 | 85 | from typing import Optional, Union
import numpy as np
import pandas as pd
from anndata import AnnData
from dynamo.vectorfield.scVectorField import SparseVFC
from numpy import ndarray
from scipy.sparse import issparse
from ...logging import logger_manager as lm
def kernel_interpolation(
source_adata: AnnData,
... |
b05a76e4da8c17d601dc53ef3eb9df9469485ae15ef23d53535172fe721f8576 | Python | 3,401 | 76 | import torch
import torch.nn.functional as F
from torch.distributions import NegativeBinomial
from torch.distributions.gamma import Gamma
import math
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split,cross_validate,KFold
from sklearn.neighbors import KNeighborsClassifier
from s... |
ce0b7b85813946e8e710fe144004ba5bd2bb3b956a17e6e737ce2622df931404 | Python | 3,401 | 104 | # Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... |
139b7344ab239d118f0d7e8ca562c7002bac731f0c7b06b7e92de936576a978f | Python | 3,402 | 93 | """SplitBatchNorm Implementation"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from __future__ import annotations
from typing import Any
import torch
import torch.nn as nn
from torch import Tensor
class SplitBatchNorm(nn.BatchNorm2d):
"""Simulates multi-gpu behaviour of BatchNo... |
a418d1724bb2bce71c8f2ceaf6efeb71287b902ddcb3c4c8895ad2f0d0d6640c | Python | 3,402 | 101 | import torch
def cox_log_likelihood(labels, risk,
reduction_fn=torch.sum,
average_over_events_only=True):
"""
labels: torch.tensor (B x 2)
First column have to be event times, second column the binary event
indicators where 1 specifies occ... |
b25d632991a599a26f124c42b60cf8239c40c8e8e7fa6ef4a9a22fc3ffe75df3 | Python | 3,402 | 98 | """
Unit tests for debug utilities.
Tests custom exception and debug display functions.
"""
import unittest
from unittest.mock import patch
import numpy as np
from ethoscope.utils.debug import EthoscopeException, show
class TestEthoscopeException(unittest.TestCase):
"""Test suite for EthoscopeException."""
... |
0ade6d68b6054f27a313c37cdcfa965a29069d0f8e7e4c667bed538005e4124e | Python | 3,403 | 83 | #!/usr/bin/env python3
"""Re-run extras extraction with FOOOF features included.
Writes new JSONs with '_fooof' suffix, leaving the original ones intact
so we can compare. Processes all 4 cohorts: ds004504, brainlat, ds006036,
ds003775.
"""
from __future__ import annotations
import os, sys, json, time
HERE = os.path.... |
79b1294cfa765a3a8cb2df8744bb22f48e194ab68757b4458b80f8a2703a9678 | Python | 3,403 | 111 | #!/usr/bin/python
import time
import os
import subprocess
import sys
import re
import pandas as pd
import numpy as np
import tabix
import glob
import ConfigParser
from bisect import bisect_left
##### Return index of a1 which do not exist in a2 #####
def ArrayNotIn(a1, a2):
tmp = np.where(np.in1d(a1, a2))[0]
re... |
9e3261e2781bf611843f6bb21244d4ab405dc22de7876ea4d47ec7071ffc1fd7 | Python | 3,403 | 114 | import numpy as np
from numpy.random import default_rng, SeedSequence
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from tqdm import tqdm
import multiprocessing
from multiprocessing import Pool, freeze_support, current_process, RLock
from functools import partial
import pathlib
from causal_... |
00a209470567b3b5c1651fb08d7f7a374c36f8fbab65eacfdef4c7a8071208cb | Python | 3,404 | 81 | import logging
from typing_extensions import Protocol
log = logging.getLogger(__name__)
# protocols for things that look like Galaxy model HDCAs and collections for this module
class CollectionLike(Protocol):
collection_type: str
class HdcaLike(Protocol):
collection: CollectionLike
class DataCollectionP... |
7eac38b3a666d3743c4ef5c96259e832d9ad836b32e402d4b00f888cddaa0208 | Python | 3,404 | 83 | """Eager FP64/low-precision attention references and tolerance checks for varlen tests.
Shared by the hd256 scheduler tests and the hd256 backward shape grid.
"""
from itertools import accumulate
import torch
def make_cu_seqlens(lengths):
return torch.tensor((0, *accumulate(lengths)), dtype=torch.int32, device... |
872bde2252845cdf5e62f4f01e8fe2fcfe9e3dd82e974ea133d80a027648032b | Python | 3,405 | 96 | # LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this software except in compl... |
88c7b8d9c5ef7c94d21551db5dc4e0e87122c899e764a4f898caff74c6e7753a | Python | 3,405 | 102 | import os
import requests
from rdkit import Chem
from rdkit.Chem import Mol
from typing import Dict
from bioconfpred.data.preprocessing import MolStandardizer
from bioconfpred.params import (LIGANDEXPO_FILEPATH,
LIGANDEXPO_URL)
class LigandNameNotInLigandExpo(Exception):
def __init__(self... |
5e2f9cbca7140903f9f5e1f5cc464de8905f120b0eda534851b1bc7aa4457c5e | Python | 3,406 | 120 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from typing import Any, Literal, Union
import matplotlib.axes
import matplotlib.patches
from .._stats import test
def figure_outline(color='k', figure=None, **kwargs):
"""Draw the outline of the current figure
Mainly for fine-tuning the figure layout... |
78432d88988453c60d5d0225c5febbd68132dbaad27a1f5a8de00133395bb2fd | Python | 3,406 | 114 | import torch
from torch.nn import Module, Parameter
from torch.nn import Linear
from torch.nn.init import uniform_
from ..base import Base
class DiagLinear(Module):
def __init__(self, in_size):
super().__init__()
self._weight = Parameter(torch.empty(in_size))
self._bias = Parameter(tor... |
7ba54f115850a812a12c970d39582b797fbd97df53260d51688da807c8eb7261 | Python | 3,408 | 89 | import torch
from torch import Tensor
# code for kNN prediction from here:
# https://colab.research.google.com/github/facebookresearch/moco/blob/colab-notebook/colab/moco_cifar10_demo.ipynb
def knn_predict(
feature: Tensor,
feature_bank: Tensor,
feature_labels: Tensor,
num_classes: int,
knn_k: in... |
cc50dc1d6c16d23a856771327ba88a621395f5bfec9cff88066f4f38aa53aaaf | Python | 3,408 | 117 | """
====================================================================
Multiclass MEG ERP Decoding
====================================================================
Decoding applied to MEG data in sensor space decomposed using Xdawn.
After spatial filtering, covariances matrices are estimated and
classified by th... |
d5143f6844ffe4e20782a4e66a919072b073f69e92fd0d09884133b540dd5cae | Python | 3,408 | 124 | import os
import random as python_random
import numpy as np
import tensorflow as tf
import tensorflow_datasets as tfds
from tensorflow.keras.models import load_model
from gradient_accumulator import GradientAccumulateModel
from gradient_accumulator.layers import AccumBatchNormalization
from .utils import normalize_i... |
f2920a744889844f2b2c2434bb15790f2c8b50ff02ce94931e7ae8ab8a660718 | Python | 3,409 | 118 | """
====================================================================
Multiclass MEG ERP Decoding
====================================================================
Decoding applied to MEG data in sensor space decomposed using Xdawn.
After spatial filtering, covariances matrices are estimated and
classified by th... |
12bad399318d051d090c6b092ea65d3ade47a5572acb9e876c5fdd70dc47bdc4 | Python | 3,410 | 119 |
import torch
import numpy as np
from time import time
dtype=torch.complex64
def Project_inf(x, c):
# torch.cuda.synchronize()
# start1 = time()
# x_max = torch.maximum((abs(x)/c), torch.ones(x.shape).to(x.device))
x_max = torch.maximum((abs(x) / c), torch.tensor(1))
x_max = x_max.to(d... |
2df45f6a7af69619719462597f82abd294469d61c7f83d8a833a41e471f4d9bd | Python | 3,410 | 106 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ------------------------------------------------------------------------------
from __future__ import division
import torch
def unfold_came... |
a16bc51d9a22217bf4cc785ee245070bdf2b5ca46d783b30770438ef30373ddc | Python | 3,412 | 93 | import numpy as np
import tensorflow as tf
from model_multicaps import Multicaps
from Bio import SeqIO
import os
os.environ["CUDA_VISIBLE_DEVICES"]='6'
#os.environ['TF_CPP_MIN_LOG_LEVEL'] = '4'
# tf.config.threading.set_intra_op_parallelism_threads(5)
#tf.config.threading.set_inter_op_parallelism_threads(16)
#tf.confi... |
e76dc95ffef7add726f1e6091cab102f5b453c54ced809b8930c152f6f92238c | Python | 3,412 | 108 | # encoding=utf-8
import numpy as np
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
import os
# from config import config_info
from sklearn.preprocessing import StandardScaler
# This is for parsing the X data, you can ignore it if you do not need preprocessing
def format_data_x(da... |
58bd9c38970934515d9231bc149a68773b5a0745a401467370a8d7a980e9bfa9 | Python | 3,413 | 97 | ### Run SPIN-CGraph to design sequence for given PDB ###
from data_preprocess import from_pdb, append_cgraph, aa_decode
from model import SPIN_CGNN
from cath_data import preprocess
import torch
import argparse
import pathlib
import numpy as np
import os
import pickle
parser = argparse.ArgumentParser()
pa... |
5f165038ab53c22da3081a9359b08c6fc25322910a33c767e9118e6e47992252 | Python | 3,413 | 110 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Line(_BaseTraceHierarchyType):
_parent_path_str = "violin.box"
_path_str ... |
6c6e3c04b713033bfea10d2915545ec35ea150c6699a35edb96fd871a433d059 | Python | 3,413 | 106 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Selected(_BaseTraceHierarchyType):
_parent_path_str = "scatterternary"
_p... |
d5e8c301d93a0551da2d411bb5f96d9aa11ccf52b1ede21ae3a3c517b6221482 | Python | 3,413 | 106 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Selected(_BaseTraceHierarchyType):
_parent_path_str = "scatterpolargl"
_p... |
d61183a39535f99c47096d75532dab6994cb3bce6067e9cce21bca24dbf3d10e | Python | 3,413 | 92 | # Based on https://github.com/pytorch/examples/blob/master/dcgan/main.py
from torch import Tensor, nn
class DCGANGenerator(nn.Module):
def __init__(self, latent_dim: int, feature_maps: int, image_channels: int) -> None:
"""
Args:
latent_dim: Dimension of the latent space
fe... |
2407ccce8ea4ed5dc15e6b9cb51350914755a327acbfd0b1528bbe9c58858e14 | Python | 3,414 | 114 | import torch
import torch.nn as nn
from modular_splicing.utils.construct import construct
from modular_splicing.models.modules.sparsity.sparsity import sparse_layer_types
from .presparse_normalizer import (
BasicPresparseNormalizer,
NoPresparseNormalizer,
)
class SparsityEnforcer(nn.Module):
"""
En... |
684421844aba374c4d276f3a686ed6e2a6c4877aaa336563d39604a1f9d1b279 | Python | 3,414 | 94 | import numpy as np
import pandas as pd
from sklearn.metrics import roc_auc_score, auc, precision_score, precision_recall_curve, log_loss
from tqdm import tqdm
tqdm.pandas()
def calc_mrr(df):
grouped_test = df.groupby('Drug1_ID')
mrr = []
for (_, dg) in tqdm(grouped_test, leave=False):
dg['binary'] ... |
dedfa64ed785713d7fc72f80167a672348fb280726ffe5f523438578e281de37 | Python | 3,415 | 91 | """This script tests when we train an Emb-GAM model
on ngrams of one order (e.g. bigrams) and test on another order (e.g. trigrams)
"""
import os
import itertools
# from slurmpy import Slurm
# slurm params
partition = 'high'
# s = Slurm("fit_logistic", {"partition": partition, "time": "1-0"})
# python ../02_fit_logi... |
597c3fec0784add165e3576d9b66630d523f47d3bb0eae8591b46b60e53b15db | Python | 3,417 | 104 | import os
import pg8000
class CredentialsException(Exception):
pass
def get_db_credentials(
env_prefix="LIMS_", host='limsdb2',
database='lims2', port=5432) -> dict:
"""Get DB credentials from environment variables and keyword
args. Environment variables must be in the format `{env_prefi... |
8bcc5a5e69ef2d7779dcca719aca1ba931a199cdd8c1b52ed46a2c34dcac57a4 | Python | 3,417 | 75 | import torch
from torch import Tensor
def iou(preds: Tensor, target: Tensor) -> Tensor:
"""Calculates the intersection over union.
Args:
preds: an Nx4 batch of prediction bounding boxes with representation ``[x_min, y_min, x_max, y_max]``
target: an Mx4 batch of target bounding boxes with rep... |
c3dde0bd20301a2baea401cf3002125a11780e579ccfa76bd13bdb9f8af0872e | Python | 3,417 | 109 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Line(_BaseTraceHierarchyType):
_parent_path_str = "violin"
_path_str = "v... |
84c17daccec447598987059d93bd7b29f7949ae6abb0b20a0d601e15e2a49377 | Python | 3,418 | 96 | import numpy as np
from CEST.src.WASSR import WASSR
from CEST.src.cest_correction import cest_correction
class CEST:
def __init__(
self,
cest_data: np.ndarray,
wassr_data: np.ndarray,
mask: np.ndarray,
cest_range: float,
wassr_range: float,
interpolation_st... |
0c96543cebed4e141ad6acb2deba823dd24da47b03b8af1cd288b2bb4efff13e | Python | 3,419 | 91 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... |
14a5114cd3d598606860f7c226bb20b437119e4a2b5c2c39182f536bb3390cf3 | Python | 3,419 | 104 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
3df82b43380b845efb073dec8d10eb547634470a0f68495f5a51ee5938ea2b16 | Python | 3,419 | 95 | import argparse
import re
import sys
import pandas as pd
import plotly
import plotly.graph_objs as go
def main(infile, col_dimensions, categorized, col_color, dimension_mode="by_index"):
"""
Produce an interactive paracords plotting html
Args:
infile: str, tabular file
col_dimensions: str... |
785f26c9a03979a33775dab8c4b0cca40f2e93a7f21c1ef70d036028e039e64e | Python | 3,419 | 95 | from typing import List
import numpy as np
import torch
from pytorch_lightning import LightningModule, Trainer
from pytorch_lightning.callbacks import Callback
from torch import Tensor
from pl_bolts.utils import _TORCHVISION_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _TORCHVISION_AVAILABLE:
... |
9e412a226c8c09ccc1c1522909b17b0819f989e1582bc672983da164ce8963ca | Python | 3,419 | 106 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Unselected(_BaseTraceHierarchyType):
_parent_path_str = "scatterpolar"
_p... |
bfa0c0b66f49872d9095a4bc523e28b95f66df6638ef768ff17220080b641a61 | Python | 3,419 | 106 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Unselected(_BaseTraceHierarchyType):
_parent_path_str = "scattersmith"
_p... |
d436bee2327cb7646208e8e814f8050564fd47074e1e1ceab6c0ee8dcc9e83df | Python | 3,419 | 87 | import unittest
from types import SimpleNamespace
import networkx
import numpy
import pandas
from stlearn.spatial.trajectory.pseudotime import (
node_pseudotime_summary,
orient_by_pseudotime,
)
class TestPseudotime(unittest.TestCase):
@staticmethod
def new_graph(edges, n):
graph = networkx.... |
31558a4d9ab06f266819d2c44f654116d50b0b00e54e47ecc7da53f16eccf0fd | Python | 3,420 | 122 | import numpy as np
import pytest
from pyriemann.utils.test import (
is_square, is_sym, is_skew_sym, is_real, is_hermitian,
is_pos_def, is_pos_semi_def,
is_sym_pos_def, is_sym_pos_semi_def,
is_herm_pos_def, is_herm_pos_semi_def,
)
n = 3
def test_is_square():
assert is_square(np.eye(n))
asser... |
7369f13e3c2da0ce99f0c1d8d471dca2faf37f9481635f0346b3c0b6384e5bc5 | Python | 3,420 | 86 | import argparse
import torch
import librosa
import numpy as np
from torch import autocast
from contextlib import nullcontext
from models.mn.model import get_model as get_mobilenet
from models.dymn.model import get_model as get_dymn
from models.ensemble import get_ensemble_model
from models.preprocess import AugmentMel... |
ed54bfbd0c64d4c84e2ccc8348fdfd9d6536f831b3b6220bd361bb4afbeb638f | Python | 3,420 | 111 | from typing import Tuple
import torch
import torch.distributed as dist
from torch import Tensor
from torch.nn import Module
class Center(Module):
"""Center module to compute and store the center of a feature tensor as used
in DINO [0].
- [0]: DINO, 2021, https://arxiv.org/abs/2104.14294
Attributes:... |
23c62cb45f2690864f27ac8f90e845219b2295c091ac548fe1ca1d7f51d22871 | Python | 3,421 | 120 | """Worker name utilities."""
from __future__ import annotations
import os
import socket
from functools import partial
from kombu.entity import Exchange, Queue
from .functional import memoize
from .text import simple_format
#: Exchange for worker direct queues.
WORKER_DIRECT_EXCHANGE = Exchange('C.dq2')
#: Format f... |
ffc3125e5f9ca44a9ef25b3f436f2eb1d62d3be9aecd4baa582e168a432494ce | Python | 3,422 | 115 | import typing
from abc import ABC, abstractmethod
import numpy as np
from hobj.learning_models.linear_learning_model.representation import (
RepresentationalModel,
)
from hobj.learning_models.linear_learning_model.update_rules import UpdateRule
from hobj.types import ImageId
# %%
class BinaryLearningModel(ABC):... |
999f3a425bf4ec4a3394bfc1f93c36c48d6c344dda14602923a1cae54385db8d | Python | 3,423 | 110 | from logging import getLogger
from galaxy.util import parse_xml_string
from . import (
BaseJobExec,
job_states,
)
log = getLogger(__name__)
argmap = {
"destination": "-q",
"Execution_Time": "-a",
"Account_Name": "-A",
"Checkpoint": "-c",
"Error_Path": "-e",
"Group_List": "-g",
"H... |
69a1e1e3c79081a2217eb710f3282ea5ab463cfe28eae9a3497831171d9d9877 | Python | 3,424 | 117 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Simulate EEG data"""
import numpy as np
import scipy.signal
import scipy.spatial
from .._data_obj import Dataset, Factor, Var, NDVar, Sensor, UTS
from .._ndvar import gaussian, powerlaw_noise
from .. import _info
def _topo(sensor, center, falloff=1):
i ... |
624d2fd65eed410565e4419984daf34b8830bb417c139b6d4f4f7d07ae68cf00 | Python | 3,425 | 105 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
a7e5dc7da5b7ca9081b33a589facb43d4f617bed60e8cd9a2d37c783c452af26 | Python | 3,425 | 74 | """Hash-seed-independent metadata pickling for portable bundles (B3R4-R21-2).
Split out of ``scrub.py`` under the R43 file-size ratchet: this is the
byte-determinism seam for ``metadata.pkl``, consumed by the bundle and
streaming writers, independent of the scrub walk itself.
"""
import pickle
import struct
from typi... |
3e30044d60613dd75b7c92b3a9b9d83bba3bfdd136644d4ac233da25d1c6c431 | Python | 3,426 | 81 | import pytest
import numpy as np
from pyriemann.datasets.sampling import (sample_gaussian_spd,
generate_random_spd_matrix)
from pyriemann.utils.distance import distance_riemann
from pyriemann.utils.test import is_sym_pos_def as is_spd
@pytest.mark.parametrize("n_jobs", [1, -1... |
dd6dfebf7ebf95a32f74bf737fe19be2afefdac30ce79bfb96473df19cedd46d | Python | 3,426 | 93 | """
Gregory Way 2017
PanCancer Classifier
scripts/visualize_decisions.py
Usage: Run in command line with required command argument:
python visualize_decisions.py --scores $prediction_file
Where prediction_file is a string pointing to the location of sample scores
Output:
.tsv file of classifier scores and o... |
6821ddc6700a30ee2d32fe947fd97fbb77fc42bf6415299c15f4d56862139b29 | Python | 3,427 | 80 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Merge various metadata files into one database.
@author: mikkel
For information about NatMEG-PD please refer to the data descriptor:
Vinding, M. C., Eriksson, A., Comarovschii, I., Waldthaler, J., Manting, C. L.,
Oostenveld, R., Ingvar, M., Svenningsson, P., & Lund... |
7cc3faf4b2087f9305d0bacdc68f3b7a8ae824039e291bae07490ca0d5da5041 | Python | 3,427 | 96 | """Benchmarking module for AlignmentFile functionality"""
import os
import pytest
from TestUtils import BAM_DATADIR
from AlignmentFileFetchTestUtils import *
def test_build_fetch_from_bam_with_samtoolsshell(benchmark):
result = benchmark(build_fetch_with_samtoolsshell,
os.path.join(BAM_DA... |
9fa0d86169c79a69ebfe82c2456a87d6a5a6ccf86b72dbd96a55304c5df7f876 | Python | 3,427 | 109 | from pathlib import Path
import numpy as np
from pymatgen.core.structure import Molecule
from instance_mongodb import instance_mongodb_sei
def generate_potential_energy_scan(
molecule: Molecule,
index_fixed: int,
index_move: int,
distance: float,
):
"""Generate a potential energy scan along a b... |
cc629cd2e17eb264f70f4d20be133f83c1d1a09787625f490eca47094e96157c | Python | 3,427 | 117 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 20 14:08:55 2022
@author: fcheng
"""
import numpy as np
from statsmodels.stats.weightstats import ttest_ind
from statsmodels.stats.proportion import proportions_ztest
def compare_two_weight_samples(df, figtype, rois, sbjs_dict):
sbjs =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.