sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
2427d89727dde745643a2123d69fcaff43004e71e8779a3cdd084c626855302b | Python | 11,798 | 309 | """Creation of contiguous consensus sequences from chunked network outputs."""
import collections
import concurrent.futures
import functools
import itertools
import logging
import operator
import intervaltree
import pysam
import medaka.common
import medaka.datastore
def write_fastx_segment(fh, contig, qualities=Tru... |
7a44356f0b6638aa94b06d08832e33bc95a4a2a93362b8208084d913a686903b | Python | 11,798 | 345 | import argparse
import os
import sys
import time
import Bio
import Bio.PDB
# import Bio.PDB.Vector
import numpy as np
import simtk
import simtk.openmm
import simtk.openmm.app
import simtk.unit
from Bio.PDB.DSSP import DSSP
basepath = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(1, basepath)
import grid... |
f7217e4d425ac87fe50e03bca87f72313a5fb6fdea30d02f6215c5c25dd968a7 | Python | 11,804 | 389 | """
n>2 CDCI Gillespie model, EXACT n=2 behaviour
Author: Original by A. Reina
"""
import numpy as np
import sys
import os
import copy
import random
DEBUG = True
TYPE = 1
####################################################
# GILLESPIE STEP
####################################################
def gillespieStep(stat... |
aded5b0e322e0bdf75d1d9d916429b640e4d75a649a0d519d83a7936d442916f | Python | 11,817 | 335 | from neuron import h
import sys
import numpy as np
h('objref nil')
modpath = 'simulator/model/density_mechs'
h.nrn_load_dll(modpath + '\\nrnmech.dll')
def init_activeCA1(model):
model.soma.insert('nax')
model.soma.gbar_nax = model.gna_soma
model.soma.insert('kdr')
model.soma.gkdrbar_kdr = model.gkdr... |
41e93c9c8aa7d90ba8fbf3c71329588c16d2aa13af7ccc40d3417b68a1d3ac47 | Python | 11,827 | 428 | # ##############################################################################
# GPLv3 LICENSE INFO #
# #
# Copyright (C) 2020 Mario S. Valdés-Tresanco and Mario E. Valdés-Tresanco ... |
f14977b04edd4b09b101938e790b9c72aaa5880c6711afc00b67b5ee324117c1 | Python | 11,842 | 381 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import re
from collections import ... |
4ae2862fe701c3ef25dee541488119a044e32ce8825b94062430350ed1622a02 | Python | 11,849 | 248 | # coding=utf-8
import os
import sys
sys.path.append("..")
sys.path.append("../utils")
import numpy as np
import cv2
import random
import glob
import torch
from torch.utils.data import Dataset
import config.cfg_lodet as cfg
import dataload.augmentations as DataAug
import utils.utils_basic as tools
class Meta_Construc... |
7062ac1e415c18d7516718b4f9c1c4c35f5e717fe67a6961f4cdaa3b2ec7633c | Python | 11,850 | 306 | from __future__ import annotations
from typing import TYPE_CHECKING
from poetry.core.constraints.version import parse_constraint
from poetry.mixology.incompatibility_cause import ConflictCauseError
from poetry.mixology.incompatibility_cause import PythonCauseError
if TYPE_CHECKING:
from poetry.mixology.incompa... |
d4f0139932415560a2ec0cc1c18bc338b368f50f22a466b75480560e2acbeea6 | Python | 11,852 | 221 | import torch
import torch.nn as nn
import math
import random
import warnings
import numpy as np
from .SubLayer import PoswiseFeedForwardNet
random.seed(1234)
warnings.filterwarnings("ignore")
class DualInterAttention(nn.Module):
def __init__(self, d_model, d, n_heads, sigma, window_threshold, device):
sup... |
dcc3e262edb5126dd84a2c7aa1f01b8390320d3de658434638f1b66b0ac75e26 | Python | 11,865 | 335 | import os
import torch
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import seaborn as sns
from torch_geometric.loader import DataLoader
from sklearn.model_selection import KFold
from sklearn.metrics import mean_absolute_error, mean_squared_error
from scipy.stats import pe... |
d93ef4892a3c78c2b19d7e11261064ac910ea00503f7d0f646d2858652628ebf | Python | 11,867 | 337 | """
Replace Split a sub-dataset from the training/test set based on the values of a specified column.
This is a general-purpose script for splitting a dataset based on any column's values.
Examples of usage:
# 1. Split by cell_class
python scripts/split_by_column.py \
--input path/to/data/IMC_melanoma_test_data.cs... |
c5a2ea36a2cc1e012fdee9e60eb1651690628d15fc79771d1b520ba7311ffceb | Python | 11,900 | 368 | import numpy as np
import pandas as pd
import pytest
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LinearRegression
from sklearn.utils.estimator_checks import parametrize_with_checks
from pgmpy.base.DAG import DAG
from pgmpy.prediction.DoubleMLRegressor import DoubleMLRegressor
... |
7ac39ebea8e825a94ae15148fcdc299690b05efbff61a053c258529eb20d70c8 | Python | 11,902 | 327 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import torch
import torch.nn as nn
def save_checkpoint(path, **kwargs):
for key, value in list(kwargs.items()):
if isinstance(value, torch.nn.Module) or isinstance(value, torch... |
409dcedd62c4d4394d374075aac574f01288e76c6b14915c76c4014d84010147 | Python | 11,904 | 334 | """Pure telemetry cluster detection and window extraction helpers."""
from __future__ import annotations
import re
import numpy as np
import pandas as pd
from scipy.signal import find_peaks
from src.processing.telemetry_processing import get_universal_times
def _parse_optional_float(value) -> float | None:
if... |
9535dd1104fc9774097818d4c10733850991204cbc1b309d32ad2f1e82376f0a | Python | 11,911 | 344 | """Pipeline for VTK filters."""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
from .decorators import wrap_input
from .wrappers.algorithm import BSAlgorithm
from .wrappers.data_object import BSDataObject
# From https://vtk.org/Wiki/VTK/Tutorials/New_Pipeline
# Outputs are referred t... |
d9ca7cc88c7c96630b7b38df721a1c7414dab7f86c750a36dd1fa2fd9a3f8339 | Python | 11,917 | 302 | """
registerWangFunctional.py
==================
Transfers the Wang2021AgeCommon fine-grained functional parcellation (~430
parcels per hemisphere) from the UNC 4D Infant Cortical Surface Atlas V1.11
into the same NeuroDev volumetric space, producing a label NIfTI:
{age}mo_WangFunctional_Reg_Head.nii.gz
This is a ... |
5bc169f20df87cf94474c13c21b760a059211485aab5582983b01a085a1113de | Python | 11,919 | 203 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
import nibabel as nib
import numpy as np
import pandas as pd
from tractseg.data import dataset_specific_utils
from tractseg.libs import data_utils
def transform_to_output_space(data):
tr... |
cfb461451a6fa6d0e762121e3c586920e313f782acd8dd59953246dee3d0fcc1 | Python | 11,928 | 318 | # Copyright (c) 2022 The Google Research Authors
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# from https://github.com/google-research/google-research/blob/master/d3pm/text/diffusion_test.py
# Keeping the original copyright notice
# Changes
# * adapt code style
# * Jax -> PyTorch
# * Remov... |
32091da1f6e096ff4c25a906e3e1274fd610208cf27b83dd559d511975d7dc58 | Python | 11,929 | 357 | """Variant calling in tandem repeats."""
import importlib.metadata
import logging
import os
import re
import sys
from packaging.version import Version
import pysam
from medaka import abpoa
import medaka.common
import medaka.medaka
import medaka.models
from medaka.tandem.consensus_generator import (
ConsensusGene... |
8b298ad9556d00f84f16d72b1306aa6302a5368eb484f4c726d7dfeac702461e | Python | 11,931 | 343 | """
Source: https://github.com/zbmed-semtec/medline-preprocessing/blob/main/code/Distribution_Analysis/ROC_curve.py
"""
import sys
import math
import pandas as pd
import logging
import numpy as np
from matplotlib import pyplot as plt
from typing import List
import counting_table as ct
__version__ = "0.2.1"
__autho... |
6ace87e66fcdec7c661c2140ae0d6f8a3c64b58ae1dc2358c993f079277f54c2 | Python | 11,934 | 209 | import multiprocessing
import os
from time import sleep
from typing import List, Type, Union
import numpy as np
from batchgenerators.utilities.file_and_folder_operations import load_json, join, save_json, isfile, maybe_mkdir_p
from tqdm import tqdm
from nnunetv2.imageio.base_reader_writer import BaseReaderWriter
from... |
ef7d1558cd3742fa0c19008d72b5f2d2e07a4ae1f8e562a127194ba3187680e7 | Python | 11,934 | 302 | import itertools
from typing import TYPE_CHECKING
import networkx as nx
from pgmpy import logger
from pgmpy.base._base import _CoreGraph
from pgmpy.utils._warnings import _warn_external
if TYPE_CHECKING:
from pgmpy.base import DAG
class PDAG(_CoreGraph):
"""
Class for representing PDAGs (also known as ... |
7566975ccfc2d85419819fe6739b4dc82ab5bcf796d3a36ab9c1c647e99d3087 | Python | 11,935 | 344 | import os
os.environ["OMP_NUM_THREADS"] = "20" # export OMP_NUM_THREADS=4
os.environ["OPENBLAS_NUM_THREADS"] = "20" # export OPENBLAS_NUM_THREADS=4
os.environ["MKL_NUM_THREADS"] = "20" # export MKL_NUM_THREADS=6
os.environ["VECLIB_MAXIMUM_THREADS"] = "20" # export VECLIB_MAXIMUM_THREADS=4
os.environ["NUMEXPR_NUM_THREA... |
32ae2acdf2cabd1c402192f9ab2c3fe355af46f0d8620bdc821ed13a497565b4 | Python | 11,936 | 292 | """
This module contains the implementation of the schedule widgets. If a new trial
sequence is needed, then a new schedule widget is also needed. The new schedule
must be also implemented in DAQ.py and ExperimentControl.py in NoSeMazeControl.
All classes defined here will be shown in the schedule widget combo box in ... |
731ec95d9942201c0f488ce3f17892b8be848ba69c34d303c64a2727a1a5223f | Python | 11,937 | 334 | import tqdm
import gensim
import logging
import numpy as np
import pandas as pd
from typing import Union, List
from gensim.models import FastText
from scipy.spatial.distance import cosine
from gensim.models.fasttext import load_facebook_model
def process_data_from_npy(file_path_in: str = None) -> Union[List[str], Lis... |
13d88122e337f650cc716307ff66dbe68541cfebe9e08895659743b6471b301b | Python | 11,947 | 354 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import Any, Dict, List, Optional
from torch import Tensor
import torch
import torch.nn as nn
from fairseq.models... |
738ed2ab92194b54838c243a0116894ce379aa5ed212a69817af15f764ef9c15 | Python | 11,953 | 275 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
2be0800a04eb92794aab62a0a0e6c544ff942dfc5ea2ad428c331d5cc0eb41ec | Python | 11,958 | 261 | # -*- coding: utf-8 -*-
import os
import gc
import argparse
import json
import random
import math
import random
from functools import reduce
import numpy as np
import pandas as pd
from scipy import sparse
from sklearn.model_selection import train_test_split
import torch
from torch import nn
from torch.optim import Ada... |
f96a232a406d65ed614db18bc0e3fc5e14835a8b49be073db57fa69ac2f2d5c1 | Python | 11,959 | 300 | import os
import shutil
import nibabel as nb
import numpy as np
import pandas as pd
import ants
import subprocess
from nipype.interfaces.fsl import RobustFOV
from nipype.interfaces.base import CommandLine
from nipype.interfaces.ants import Registration
from scipy.stats import gaussian_kde
from scipy.optimize import min... |
e7bbe5275c40905ec5b9a442f76bf991795eddebc2fdb205961d5e906ce55377 | Python | 11,960 | 347 | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Evaluate the perplexity of a trained language model.
"""
import logging
import math
import os
import sys
from a... |
3fde770e7e895a4e96215b16516047232504299ee40e27bde950f7a36da5ed1a | Python | 11,976 | 298 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# modified by Guipeng Li
from functools import lru_cache
import numpy as np
import torch
from fairseq.data import Dictionary, data_utils
fro... |
98b57632911535a70b9238bcc1d7c4c3ae96ee5d6dcf34af7d5f089deaa9d749 | Python | 11,979 | 228 | import os
import warnings
from typing import Union, Tuple, List
import numpy as np
import torch
from batchgenerators.dataloading.data_loader import DataLoader
from batchgenerators.utilities.file_and_folder_operations import join, load_json
from threadpoolctl import threadpool_limits
from nnunetv2.paths import nnUNet_... |
6ef8efaead33cef68d4735926f3e6addc7f0c4ca1cba0641ad326abc6ecebdb7 | Python | 11,990 | 370 | import os
import argparse
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import torch
import numpy as np
import pandas as pd
from Bio import SeqIO
from torch import cuda
from torch.utils.data import DataLoader, Dataset
from transformers import BertTokenizer, BertModel, BertConfig
from keras.utils import pad_sequences
def... |
05977062b18ac977d7e5be482a1be00bd29bef6ef46dd66b2d5cc7c71f73caae | Python | 11,999 | 362 | from __future__ import annotations
from pathlib import Path
import pandas as pd
from st_risk.reporting.gallery import (
abundance_heatmap_table,
GalleryEntry,
build_abundance_heatmap_summary,
build_dominant_celltype_summary,
build_gallery_metadata_rows,
build_top1_margin_summary,
dominant... |
cf0dc1979572d94450a5e611b44f3fdb88d9cd980d669a723f0ed63057b5e2c4 | Python | 12,005 | 335 | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
9ec4afc68a19f54869a26b7f9f11836cc9a698c6057516fc7d1c95bfbf0deaa3 | Python | 12,007 | 406 | from scipy.spatial import KDTree
import numpy as np
from matplotlib.lines import Line2D
from matplotlib.patches import Patch
import jax
import jax.numpy as jnp
from graph_tool.all import Graph
from graph_tool.topology import max_cardinality_matching
from .figure_Tools import point_value_PMF_1darray
def nn_PMFs(ax, g... |
59998c65dd3f3357abfa0aa869eb923335f237a53ddb7d816222053beca3a85f | Python | 12,008 | 345 | import torch
from torch import nn
from ..downstream_module import DownStreamModule
from collections import OrderedDict
class Lin2D(nn.Module):
def __init__(self, in_feat, out_feat):
super().__init__()
self.linear = nn.Linear(in_feat, 256)
self.relu = nn.ReLU()
self.linear2 = nn.Li... |
7b868652a6f50e8108eab6fa74ab6eaf747a761c405c3d0679b74b18e7fbf42f | Python | 12,008 | 313 | """`EmbeddingsStore`: reading back what `precompute-embeddings` wrote.
The write half is pinned by `test_embeddings_store.py`. What is new here is the
store's *refusals* — a document it does not hold, one whose row count disagrees
with the encodings, and, at the constructor, a store the run's own base model
did not wr... |
bbed606eaf69b222fbc3b79a4fed6c6ed635a193d6b930b92262e53ea5b05975 | Python | 12,023 | 322 | """
This version of the model is inspired by a VIT model. The model is a transformer model that takes in a 3D input and flattens and concatenates each channel
"""
# %%
import torch
import torch.nn as nn
from dataset import SzDatasetRegs
from einops import rearrange, repeat
from torch.utils.data import DataLoader
from... |
c991c263015842ad16210b8e0b45f7ad990b042556ec246bd80ca05c916c7a97 | Python | 12,030 | 328 | import csv
import os
import time
import numpy as np
import pandas as pd
import torch
from torch import optim, nn
from sklearn import metrics
from tqdm import tqdm
from utils import io_utils
def train_pglcn_iteration(model, args, dataset=None):
torch.save(
{
"model_state": model.state_dict... |
7d1369e8c828ded791fdddf35ccbbe416dd67aa0780e7e05e49a5ee849e54f05 | Python | 12,039 | 407 | from scipy.spatial import KDTree
import numpy as np
improt matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from matplotlib.patches import Patch
import jax
import jax.numpy as jnp
from graph_tool.all import Graph
from graph_tool.topology import max_cardinality_matching
from .figure_Tools import point_valu... |
bd1552a7f04a3335ed3fb2747b66189ec7ce3326a382d2a8104dd6e6273f1ae7 | Python | 12,039 | 407 | from scipy.spatial import KDTree
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from matplotlib.patches import Patch
import jax
import jax.numpy as jnp
from graph_tool.all import Graph
from graph_tool.topology import max_cardinality_matching
from .figure_Tools import point_valu... |
95ce6d2387863a2a1e8835a43f70de9a951cb55b925c37a835fa9aeb8e9b6644 | Python | 12,040 | 273 | import tensorflow as tf
import tensorflow_model_optimization as tfmot
from tensorflow import keras
from tensorflow.keras.utils import to_categorical
import keras_infmodules as kq
import os
import numpy as np
from keras import backend as K
from keras import activations
def relu_advanced(x):
# weight clipping for Re... |
89a0a2ecd8a6545253aa9f1f297a8816704a620664471543ac9c485661349828 | Python | 12,047 | 359 | """Post-hoc univariate analysis focusing on the image_high - image_low contrast inside a pre-defined mask."""
from __future__ import annotations
import os
from pathlib import Path
from typing import Dict, List, Sequence, Tuple
import click
import numpy as np
import pandas as pd
from loguru import logger
from nilearn... |
a4ce297d37a5538a56334ff705e641574646f2a1664ba2ca61d3e3a1254d9dd6 | Python | 12,053 | 278 | from __future__ import annotations
import subprocess
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any
import numpy as np
import pandas as pd
from scipy import sparse
from scipy.io import mmwrite
from st_risk.data.harmonize import choose_reference_celltype_column, intersect_gene... |
abe2276cb023f72c85bf0ca77a6435684fbefc2b25560078d78895f07ba08ea0 | Python | 12,060 | 304 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
import numpy as np
import os, sys, pickle
#To import parameters
sys.path.append("../../.... |
921fdc4208a71d940fd86c4bc0db63f762b656cbdc7450684de643315249314b | Python | 12,065 | 279 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import annotations
from typing import Generic, Mapping, Tuple, TypeVar
import torch
from tqdm.auto import tqdm
from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply
from mattergen.diffusion.data.bat... |
44ef12174877c5784eb96a0dc8e6fa3ce1e58f2e066cdd9a15c0e9bce0069d87 | Python | 12,066 | 338 | """
This module contains the decoder used by the Garfield model.
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.data import Data
from torch_geometric.nn import GCNConv, GATConv, GATv2Conv
from .utils import DSBatchNorm, compute_cosine_similarity
class GATDecoder(nn.Module... |
064b6b19c397c3d4bf6ba087ecc4b88a85c3e3f12447d457a61bed8d78371058 | Python | 12,067 | 308 | import io
import math
import sys
import tempfile
import types
import unittest
from unittest.mock import patch
import numpy as np
if 'pandas' not in sys.modules:
pandas = types.ModuleType('pandas')
pandas.MultiIndex = type('MultiIndex', (), {})
pandas.Index = type('Index', (), {})
sys.modules['pandas']... |
1c104329c9fe8517d1e0215553b6611a3ad3244cef8cb2153f2838cc689efa73 | Python | 12,070 | 279 | from typing import Callable, List, Optional, Tuple
import cv2
import numpy as np
import torch
from torchvision.transforms.functional import resize
from pytorch_grad_cam.grad_cam import GradCAM
from pytorch_grad_cam.utils.image import scale_cam_image
from pytorch_grad_cam.utils.model_targets import ClassifierOutputTar... |
25647884d0b74f3dea3907eb9c2926875ba46895726c74cc91eb59e7496bdcc2 | Python | 12,071 | 408 | from scipy.spatial import KDTree
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from matplotlib.patches import Patch
from collections import Counter
import jax
import jax.numpy as jnp
from graph_tool.all import Graph
from graph_tool.topology import max_cardinality_matching
from... |
ceca0876e7c612f6b20c6df39949c71efcbb70a8641cfc384f49a4e1931e1665 | Python | 12,071 | 347 | import logging
import pandas
import os
import numpy
from scipy import stats
from .. import Constants
from .. import Utilities
from .. import MatrixManager
from ..PredictionModel import WDBQF, WDBEQF, load_model, dataframe_from_weight_data
from ..misc import DataFrameStreamer
from . import AssociationCalculation
class... |
ee1fb6812d171c107382ca67d7dbfa614f6d87eda416866fec76df5ba55c0c3e | Python | 12,076 | 277 | """
process_GSE127969_beltran_csf.py
--------------------------
MS CSF + PBMC scRNA-seq — Beltrán et al. 2019 (Brain).
Single-cell RNA-seq in monozygotic twins discordant for multiple sclerosis
plus auto-immune encephalitis (Anti-LGI1, Anti-NMDA) controls.
GEO: GSE127969 ships:
- GSE127969_counts_TPM_ALL.csv.gz ... |
c0a6bf7c6a052f46890c4cda390d89275b8d7ed143cf93b060f26f31d15d2e5c | Python | 12,079 | 348 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
import logging
from argparse import Namespace
from dataclasses import dataclass, field
from typing import Any, Optional
imp... |
596129fffff03aa9b15415cdc7bc9b1e425a8e165bcf51188a21d1021fb5e0ae | Python | 12,080 | 279 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
481cc99d665f0540db3925a80443f5f9b89613288919302caa3db0053c1ab187 | Python | 12,084 | 230 | # Copyright 2021 HIP Applied Computer Vision Lab, Division of Medical Image Computing, German Cancer Research Center
# (DKFZ), Heidelberg, Germany
#
# 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... |
ccf19a0f0395dbafe4ebbe999315bfb19c0e32d2721eb49f1912e1d80cbc2292 | Python | 12,086 | 357 | """Regenerate published-model numerical baselines from immutable Hub revisions.
This intentionally downloads model artifacts but reads the MSA only from the tiny
checked-in fixture. It writes a review candidate and never overwrites the canonical
baseline in place.
"""
from __future__ import annotations
import argpar... |
f74b0249f16c59215c8341e4ac569274ea37a16e4e777e2eebbfb45bba38c61a | Python | 12,091 | 270 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
def _make_divisible(v, divisor, min_value=None):#确保通道可除
"""
This function is taken from the original tf repo.
It ensures that all layers have a channel number that is divisible by 8
It can be seen here:
https:/... |
a661fac36de1221a057a9e5bc4732250d8adbe56297945c8800d3e992a0de980 | Python | 12,093 | 331 | #!/usr/bin/env python3
"""
Profile nnUNet architectures for params/FLOPs/peak memory.
Examples:
# Profile teacher + student from a distillation config
python profile_models.py \
--config ../configs/logit_kd_half_width.yaml \
--dataset DatasetXXX_Name --configuration 3d_fullres
# Profile explicit archite... |
72ec1ef9755b92a1a2bfdfd692c69ca2dfc06fb9512f791c892f20f2fdcfc3b0 | Python | 12,097 | 268 | import shutil
import time
from tqdm import tqdm
from dataloadR.augmentations import *
from evalR import voc_eval
from utils.utils_basic import *
from utils.visualize import *
from utils.heatmap import Show_Heatmap
import config.cfg_lodet as cfg
current_milli_time = lambda: int(round(time.time() * 1000))
class Evaluato... |
0cdd70731f0668dd99fad8ce9a757a94c88f64e5f9b3a8da64489397dbd4c190 | Python | 12,107 | 265 | import argparse, os, random
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim import lr_scheduler
from tensorboardX import SummaryWriter
from sklearn import metrics
import numpy as np
import prismnet.model as arch
from prismnet import train, validate, inf... |
2c72738a7f7748e6b3420dd3a69a4ff932653cce58d00c8eab0c7dd64ed2c896 | Python | 12,111 | 249 | # -*- coding: utf-8 -*-
"""
Created on Fri May 29 12:11:41 2020
@author: scaling algorithms by A.Andree, parallelization by K.Butenko
"""
import os
import nibabel as nib
import matplotlib.pyplot as plt
from multiprocessing import sharedctypes, cpu_count, Pool
from functools import partial
import numpy as np
import i... |
aaf42c216924ac3c66bfb7f51466269825b6260750fe9cc67bff1abc30ce08f3 | Python | 12,111 | 404 | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import butter, filtfilt, medfilt
from .utils import (get_spike_depths,
get_spike_amplitudes,
load_kilosort_data,
rms)
def plotKsTemplates(ks_directory, raw_data_file, sample_rate = 300... |
def893d3fadddb92f72f4320ef0854ef8fe530ef7de275b69b322537157b814c | Python | 12,117 | 285 | from .activations import *
from modelR.plugandplay.DynamicConv import Dynamic_conv2d
from modelR.plugandplay.CondConv import CondConv2d, route_func
from modelR.layers.deform_conv_v2 import DeformConv2d
norm_name = {"bn": nn.BatchNorm2d}
activate_name = {
"relu": nn.ReLU,
"leaky": nn.LeakyReLU,
"relu6": nn.... |
5e1aa41b4ffaf1bebca292322619ed367b0584b142a08e55ff92ac78ef36da60 | Python | 12,120 | 323 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import seaborn as sns
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
from tensorflow.keras.models import Sequential, load_model
f... |
7836c23b0c3845d61d550a1c12ad6274c4843f3b04ee2f28f5d4627094180b10 | Python | 12,125 | 413 | """
This is a modified version of the code present in:
https://github.com/nanoporetech/pipeline-umi-amplicon/blob/master/lib/umi_amplicon_tools/filter_reads.py
"""
import argparse
import logging
import os
import sys
import pysam
def parse_args(argv):
"""
Commandline parser
:param argv: Command line argu... |
369a1b728cfeef90b0b41606dcabad0da0d493e4b4a981fc802808453b52a084 | Python | 12,129 | 281 | import scanpy as sc
import sys
sys.path.append('./scctools')
from scctools import *
# # Load and check data
#monkey
ad=sc.read('data/Figure/FM27_cell_133454_wk.h5')
glut = ad[ad.obs['class']=='Exc',:]
#human
adhu=sc.read("./glut_huMK_500Marker1.h5")
#match .obs
adhu.obs['class'] = adhu.obs['class_label']
adhu.obs[... |
ae4c7b20e2352ff39994f0f1ae60d64104cf2ea77974b5a6d1530753c87bf4da | Python | 12,130 | 408 | from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING
from unittest.mock import MagicMock
import pytest
from poetry.utils.password_manager import HTTPAuthCredential
from poetry.utils.password_manager import PasswordManager
from poetry.utils.password_manager import PoetryKeyrin... |
2f4f981d61dc648fd568722fd0364cf8ad0e073a7177359e13689a94a8c32d9d | Python | 12,132 | 258 | from glob import glob
import argparse
from collections import defaultdict, Counter
from itertools import combinations, product, groupby
from pathlib import Path
import os
from sklearn.utils import shuffle
import numpy as np
import random
from shutil import copy
from subprocess import check_call
np.random.seed(42)
rand... |
54cf610c5090d189872e4aae9d9d33da0b10d17bb640712c16524cab5acf7b90 | Python | 12,139 | 281 | __author__ = 'heroico'
import gzip
import os
import io
import logging
from . import DataSetSNP
from . import Utilities
class ILTF:
"""IMPUTE legend file format"""
ID = 0
POSITION = 1
A0 = 2
A1 = 3
TYPE = 4
AFR = 5
AMR = 6
EAS = 7
EUR = 8
SAS = 9
ALL = 10
class LEGENDLo... |
e0928ef5cbbdbe5012869cf890740d972c4faa6852e22006ac8dc52846fd5c84 | Python | 12,140 | 303 | from typing import Dict, Optional, Union
import numpy as np
import torch
from scipy.sparse import issparse
import scanpy as sc
from scanpy.get import _get_obs_rep, _set_obs_rep
from anndata import AnnData
from scgpt import logger
class Preprocessor:
"""
Prepare data into training, valid and test split. Norm... |
022003d769efee9312426df509ff91c3d234f1d727d2a643d5bc9b4ac3e2f2a6 | Python | 12,144 | 338 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
import torch
from fairseq import utils
from fairseq.data import (
ConcatDataset,
Diction... |
144c764919aea8eebc050310cc7854ec0a2f47ac33dc9728fe57a273e059db63 | Python | 12,150 | 287 | """Function that generates results for a learning curve for frame classification models."""
from __future__ import annotations
import logging
import pathlib
import pandas as pd
from .. import common, datapipes
from ..common.converters import expanded_user_path
from ..eval.frame_classification import eval_frame_clas... |
f86412dc5befe552a3762a1372714e05f7ca75f9313837b97f08a52e24be062b | Python | 12,151 | 267 | # ==============================================================================
# Script: extra_linear_to_hyperbolic.py
# Manuscript relevance: 2.3.i, Fig. S1
# ==============================================================================
# PURPOSE:
# Generate a conceptual figure illustrating the mathematical trans... |
f1c83f0250f2b713771f7f17da3dcd2b14ff79e39099cd7b6e0201c2a3ba1d39 | Python | 12,160 | 314 | import math
from typing import Tuple
import numpy as np
import torch
import torch.nn.functional as F
def compute_vdm_from_b0(field_map_hz: np.ndarray,
dwell_time: float = 2.2266e-4,
tramp: float = 200.0,
gamma: float = 42.56,
... |
37860afbb1febc904832c997ed0759032a38160f4a2a7967e283ec1a2f745fb1 | Python | 12,161 | 253 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
For each subject, session, run: read in image, event file, confounds file; then
generate and convolve regressors; create nuisance matrix based on denoise method;
create 1st-level design and contrast files.
"""
import nibabel
import os
import glob
import numpy as np
im... |
262f6c9446d386970685553d94a51f0dd2bb8fdd7b72c0da3f0cabfcd83878be | Python | 12,165 | 230 | import logging
import argparse
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
import dataload.datasets as data
import utils.gpu as gpu
from utils import cosine_lr_scheduler
from utils.log import Logger
from modelR.lodet_hbb import LODet,CAT_LODet,Head3_LODet
f... |
71cc8b73d443c5cecb8549f2725d07ae29e45cd85a1b657c3093f37cfed67e21 | Python | 12,165 | 343 | """synthetic_structsim.py
Utilities for generating certain graph shapes.
"""
import math
import networkx as nx
import numpy as np
# Following GraphWave's representation of structural similarity
def clique(start, nb_nodes, nb_to_remove=0, role_start=0):
""" Defines a clique (complete graph on nb_nodes nodes... |
f7523557c4beacaeefc22c663a53efb69916b4a6cf96f8f660e623c2b2d2e17b | Python | 12,168 | 303 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from typing import Dict, List, Tuple
import numpy as np
import torch
from fairseq.data import Dictionary, FairseqDataset, data_ut... |
c2a54e0bf09a3ab04c5beb19a31c50848c8560f2ad1098944a6a1b4c09164b04 | Python | 12,169 | 388 | """
Tests for the sklearn-compatible HillClimbSearch class in pgmpy.causal_discovery.
"""
import numpy as np
import pandas as pd
import pytest
from sklearn.exceptions import NotFittedError
from sklearn.utils.estimator_checks import parametrize_with_checks
from pgmpy.causal_discovery import ExpertKnowledge, HillClimbS... |
cb7f50297c617cd20d71e87cb61d7ac2a860bedb7fd738017e7478e434bec211 | Python | 12,169 | 338 | """Best-effort support bundle creation for failed calculations."""
import json
import os
import platform
import re
import shutil
import subprocess
import sys
import tempfile
import traceback
import uuid
import zipfile
from datetime import datetime
from pathlib import Path
from GMXMMPBSA import __version__
MAX_REGUL... |
cdeba42c787b858db00250366fadf84191f7557569771ab3d5c6b61aa8bbb83f | Python | 12,171 | 352 | import threading
import time
import RPi.GPIO as GPIO
from rotary_classv2 import RotaryEncoder
from testvariables import test_vary
class mainprogram:
#Main while loop condition
keepalive = True
#Variables that may need tweaking
calibrationsteps = 4000
backoff = 150
# setup GPIO
GPIO.setw... |
a2abe551dbcecaa6e6a36463fef7a737d38ae9dc8ceaba0336e477e6c2c69201 | Python | 12,172 | 365 | #!/usr/bin/env python
"""Time training with `torch.compile` on and off, interleaving the arms.
Both arms train the same model on the same data from one generated config and
differ in exactly one thing: whether `D3TEXT_COMPILE` is set. What they
cannot share is the machine's thermal state, and a card throttles under a
... |
e4cc561e36f351bca79120eb97c80c7e59a7d71409191b754d8b926be497c8e5 | Python | 12,175 | 375 | """Utility functions for parcellations/labelings."""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
# Last modifications:
# Sara Lariviere <Aug2020>
import os
import numpy as np
from scipy.stats import mode
from scipy.optimize import linear_sum_assignment
from sklearn.utils.extmath ... |
e2a106831444e7198bd3ad3073834b8159bcfee3d0bdb0eaf661c7aa96f4717d | Python | 12,177 | 340 | from __future__ import annotations
import os
from dataclasses import asdict, dataclass
from pathlib import Path
import numpy as np
import pandas as pd
@dataclass(frozen=True)
class GalleryEntry:
model_key: str
display_name: str
sample_id: str
run_id: str
figure_path: Path
rationale: str
... |
5a979d1f97550f4e0f2646e748d66ce4d2fbe174e00f648a1279b1e81d8d3bfc | Python | 12,183 | 292 | from collections.abc import Hashable
from itertools import chain
import pandas as pd
from joblib import Parallel, delayed
from pgmpy.base import DAG
from pgmpy.estimators import ParameterEstimator
from pgmpy.factors import FactorDict
from pgmpy.factors.discrete import TabularCPD
from pgmpy.models import DiscreteBayes... |
c94fe02be6047b59fdecbd21f9882fa784608e2e36a7c2b2b98bc10425d28aa5 | Python | 12,184 | 322 | import itertools
import re
from typing import List, Tuple
import networkx as nx
import numpy as np
import pandas as pd
def _subset_mapping(
input_data: List[str], mapping: List[Tuple[str, str]]
) -> List[Tuple[str, str]]:
return [m for m in mapping if m[0] in input_data]
def _subset_pathways_on_idx(
pat... |
5a1bb53251527c3a21b6796279b6e1c7326f856785ae99332ac64289c5355585 | Python | 12,189 | 252 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 24 15:31:07 2025
@author: mayc06
"""
from extract_trajectories_from_orcoflashStupski import *
from scipy.stats import kstest
import pycircstat2
from pycircstat2.hypothesis import circ_anova
ann65_train = np.load('ANN65_trainperformance_absval_errorpeaks.npy'... |
cb8366d85d08254858ecc5f83cc8c162bd43cc5e6fd238574e05d8317f96cf99 | Python | 12,193 | 363 | import math
import os
import json
import numpy as np
import torch
import torchaudio.compliance.kaldi as kaldi
import yaml
from fairseq import checkpoint_utils, tasks
from fairseq.file_io import PathManager
try:
from simuleval import READ_ACTION, WRITE_ACTION, DEFAULT_EOS
from simuleval.agents import SpeechAgen... |
d73148451646b9d6d57de1a52d1ea0fcb7535f9d68fee34c45fd1d14c9429237 | Python | 12,197 | 301 | import os, argparse, re, json, copy, math
from collections import OrderedDict
import numpy as np
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('base', help='base log path')
parser.add_argument('--file_name', default='train.log', help='the log file name')
parser.add_argument... |
74a82ae6c8368e150b3cf5f9bb6cea513e311c641bf4543c5ae42990a674aaa8 | Python | 12,199 | 350 | """Gradio-free SegAnything backend using the proven SAM2 video predictor API."""
from __future__ import annotations
import json
import os
from pathlib import Path
import shutil
import zipfile
import numpy as np
from PIL import Image
from segmentation_job import (
MANIFEST_NAME,
make_result_manifest,
saf... |
d6d05b98e5cf7d008ded8e58a622f1dbca889bcdb0588970aa82a0249b1bad0f | Python | 12,199 | 335 | from __future__ import annotations
import math
from dataclasses import dataclass
from typing import Dict, Tuple, Optional
import numpy as np
try:
from scipy.special import lpmv
except Exception as _e: # pragma: no cover
lpmv = None
try:
from scipy.ndimage import gaussian_filter
except Exception as _e: ... |
0143452138bf2cf2bc6f6c69f2f462d00af4f12df78226bd76249965aa9fd419 | Python | 12,202 | 327 | """
knudsen_calculator_app.py
====================================
Knudsen-Corrected Helium Relaxation Time Calculator
Streamlit Web UI — pure NumPy / SciPy / Matplotlib
Physics:
- Load 3D porosity field (phi_total.npy)
- Extract one Z slice → binarize → distance transform
- Compute local pore radius R_pore(x,y)... |
6cbdc9445bf6244a78c1a53eb09c2a494c57b151bf1653c167c154203fc143c8 | Python | 12,204 | 227 | #三个头0414
import logging
import argparse
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
import dataload.datasets as data
import utils.gpu as gpu
from utils import cosine_lr_scheduler
from utils.log import Logger
from modelR.Three_Head_lodet_hbb import... |
741521e17664f53cd75951cba07d336c0292ebfc22124ed1d31a54576d7a7191 | Python | 12,216 | 363 | # -*- coding: utf-8 -*-
"""
@Time:Created on 2019/5/20 19:40
@author: LiFan Chen
@Filename: model_glu.py
@Software: PyCharm
"""
# -*- coding: utf-8 -*-
"""
@Time:Created on 2019/5/7 13:40
@author: LiFan Chen
@Filename: model.py
@Software: PyCharm
"""
import torch
import torch.nn as nn
import torch.optim as optim
import... |
35eab3b0fa5f9c0a10d0981d1c285781e4c1ef4f32a9b60d13279970ed52f0f8 | Python | 12,218 | 337 | """
Run ESMFold multimer + pDockQ scoring on toxin-antitoxin protein pairs.
Usage: python pipelines/t2ta_cofold.py --config path/to/config.yaml
"""
import argparse
import hashlib
import os
import sys
from collections import OrderedDict, defaultdict
from dataclasses import dataclass, field
from pathlib import Path
fro... |
989aa8fb0d2d426294e09cb43b33efb48607d49751cbb4e8296acad35e5b0c4a | Python | 12,218 | 393 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Data pre-processing: build vocabularies and binarize training data.
"""
import logging
import os
import shutil
impo... |
6f8d09d8de6e854e9f89b1dc354df17b6bb8280fd201ab31580113bd9c08ae59 | Python | 12,223 | 305 |
import scipy.signal as signal
import numpy as np
from signal_processing import *
import pandas as pd
def extrema_detection(trace_array,trace_filtered,sampling_rate,minAmplitude=0.06,max_time=0.5,min_time=30):
#for breathing signals only. look for other versions for other purposes
#trace_array_nospi... |
b6de713bc8f2b928d60f6c0660db590109b71cf354d71eb808387d8f7aeab4a5 | Python | 12,226 | 249 | # coding=utf-8
import os
import sys
sys.path.append("..")
sys.path.append("../utils")
import numpy as np
import cv2
import random
import glob
import torch
from torch.utils.data import Dataset
import config.cfg_lodet as cfg
import dataload.augmentations as DataAug
import utils.utils_basic as tools
cl... |
d192e441c3460f49129afc48898165a465337e3b3758b49e34d498f018ffb627 | Python | 12,227 | 234 | # Copyright 2021 HIP Applied Computer Vision Lab, Division of Medical Image Computing, German Cancer Research Center
# (DKFZ), Heidelberg, Germany
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.