sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
e44185d5df07025b5f3d075b5f0afd94952a1b0e21ab2ddeec2b8c31d645ef52 | Python | 14,822 | 437 | from __future__ import annotations
import pathlib
import numpy as np
import pandas as pd
from ..common import constants
from ..common.validators import column_or_1d
from . import functional as F
__all__ = [
"AddChannel",
"PadToWindow",
"FramesStandardizer",
"ToFloatTensor",
"ToLongTensor",
"... |
c8cb0f5adf4be391896b920420279174d063709af6c8fc50fc851860e4fd0fa4 | Python | 14,823 | 402 | """Byte pair encoding utilities
Some functions are adapted from OpenAI but with modifications
https://github.com/openai/gpt-2
"""
import os
import json
import regex as re
from functools import lru_cache
import tensorflow as tf
import random
import numpy as np
@lru_cache()
def bytes_to_unicode():
"""
Return... |
5c1d41390002bf17da2067053d6f5b7bae65ae0afb58273d9e95efa04f02e40d | Python | 14,828 | 313 | from __future__ import annotations
import math
from typing import TYPE_CHECKING
import torch
from torch import nn
from scvi.external.drvi._utils import StackedLinearLayer
from scvi.nn import FCLayers
if TYPE_CHECKING:
from collections.abc import Sequence
from typing import Literal
class SplitFCLayers(FCLa... |
30c1b5e371a18d176e8281e9661774e0ec56fc0b9bbb9ddf41ad0e0fbb7d5022 | Python | 14,836 | 348 | """Creates and manages edges from one GO term to another GO term."""
__copyright__ = "Copyright (C) 2016-2018, DV Klopfenstein, H Tang, All rights reserved."
__author__ = "DV Klopfenstein"
from collections import defaultdict
def get_edgesobj(gosubdag, **kws):
"""Return specfied GoSubDag initialization object.""... |
1796e574367cc5977ed062e5aea129bf1e890222b6e81daec4c86d981c451aeb | Python | 14,841 | 442 | import networkx as nx
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from pgmpy.base import DAG
from pgmpy.estimators import ExpertInLoop, ExpertKnowledge
@pytest.fixture
def adult_df():
df = pd.read_csv("pgmpy/tests/test_estimators/testdata/adult_proc.csv", inde... |
fcb999dc08dde7198b8bcf7cedea9275a5db6181dfe93551f84e9dd3732816b3 | Python | 14,844 | 253 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import warnings
import importlib
import time
import os
from os.path import join
import numpy as np
from tractseg.libs.system_config import SystemConfig as C
from tractseg.libs.system_config import get_config_... |
a76733c56d1a815e6c74c6cb4dc0017d07212f15bb0f410d60fd91124d2b5bb9 | Python | 14,854 | 375 | import datetime
import logging
import math
import os
import numpy as np
import pandas as pd
from keras import backend as K
from keras.callbacks import ModelCheckpoint, ReduceLROnPlateau, LearningRateScheduler
from sklearn import metrics
from sklearn.base import BaseEstimator
from sklearn.metrics import accuracy_score
... |
72848fe6cbedfa2691c770e61357e07b3a5ab9c75f7b10f30cb6d02d7795c018 | Python | 14,870 | 433 | #!/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.
import gc
import os.path as osp
import warnings
from collections import deque, namedtuple
from typing import Any, Dict... |
e71d027e213726eec5c3bb6cfb17ffbe26d11e7c5b94657c569dab6ad9dc0817 | Python | 14,872 | 461 | from enum import IntFlag
from typing import Any, Callable, NamedTuple, Protocol, TypeAlias, TypeVar
import jax
import jax.numpy as jnp
import numpy as np
import numpy.typing as npt
from jaxtyping import Array, PyTree
T = TypeVar('T', bound=PyTree[Array])
R = TypeVar('R', bound=PyTree[Array])
ExtraArgs = tuple[Array,... |
a2302b46b3952d1a3772369874d4092d26753f35c6352d47cdf20f5bbc664d8b | Python | 14,876 | 315 | import torch
import os
import sys
from .model.model import MulanConfig, scMulanModel
from .model.model_kvcache import scMulanModel_kv
import torch.nn.functional as F
from .utils.hf_tokenizer import scMulanTokenizer
import scipy.sparse
import numpy as np
from tqdm import tqdm
from anndata import AnnData
from typing impo... |
4cd776f4f913e53750bf5eec68841dc61c4c871a245734598b552a2828156d66 | Python | 14,899 | 290 | """Publication figures for the revision (MDPI Foods, foods-4481855).
Fig_1_spectra_panels (a)(b)(c) mean RAW spectra + diagnostic band annotations [R2-C3, R2-C4, R3-C5]
Fig_3b_parity_cvpooled olive-oil parity from POOLED out-of-fold predictions, all 11 levels [R3-C6]
Fig_4_robustness_panels (a)(b)(c) hold-o... |
c0df69871c5b0fc1d943ee28e774b170857dbddc08e96a1331f26fea1249cd2b | Python | 14,915 | 464 | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from poetry.factory import Factory
from poetry.packages import Locker
from poetry.toml import TOMLFile
if TYPE_CHECKING:
from collections.abc import Iterator
from pathlib import Path
from cleo.testers.command_tester impo... |
315096a6854ef1b360419d7ef52ddb129e9018ec780fe9893bca4ed972d430c4 | Python | 14,919 | 440 | #!/usr/bin/env python
"""Fetch a microbiology candidate pool from PMC, in the noise pool's shape.
The candidates a hard-negative pool is screened from: PMC Open Access articles
carrying a bacteriology MeSH heading, minus every article BRENDA already
curates. Nothing here decides whether a document is a negative — that... |
d2945b1ac6b96cf0107d2cfb5fdac575c2bb3a8621d34f64d468019ec22ea427 | Python | 14,921 | 401 | #!/usr/bin/env python3
"""
Generate Figure 4: DDR1 Subnetwork Visualization with RAG-GNN Embeddings
Uses proper RAG-GNN embeddings from corrected analysis
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import networkx as nx
from sklearn.preprocessing im... |
0f66fe0785b3193b0ce60f75d9396cde372e16350286512a14f616ae1639da4a | Python | 14,924 | 453 | from __future__ import annotations
import contextlib
import sys
import tarfile
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from poetry.utils._compat import WINDOWS
from poetry.utils.download import Downloader
from poetry.utils.download import HTTPRangeRequestSupportedError
from poetry.ut... |
659cdf7c5651e699436510b6af5c9c93efa7b6203f44825e63e78b434c3aafc7 | Python | 14,925 | 337 | """
Counterfactual prediction workflow
"""
from typing import List, Optional, Union
import torch
import numpy as np
import random
from utils.data.dataholder import DataHolder
from utils.data.load import remove_mean_with_mask
from utils.diffusion_model.diffusion.noise_model import NoiseModel
from utils.concept_discover... |
f6e5e1225dad0dd36a585b0cb155abdd53ef906e07f5e43258b8bf340f0f88ab | Python | 14,925 | 322 | from __future__ import annotations
from time import time
from typing import Union, List, Tuple, Type
import numpy as np
import torch
from acvl_utils.cropping_and_padding.bounding_boxes import bounding_box_to_slice
from batchgenerators.utilities.file_and_folder_operations import join
import nnunetv2
from nnunetv2.util... |
99531d9d6970bf3ec193c9e4673579c859f664164b46242f7d617a815d5d5139 | Python | 14,930 | 343 | import argparse
import gc
import os
from pathlib import Path
from queue import Queue
from threading import Thread
from typing import Union, Tuple
import nnunetv2
import numpy as np
import torch
from acvl_utils.cropping_and_padding.bounding_boxes import bounding_box_to_slice
from acvl_utils.cropping_and_padding.padding... |
1291916e1108d718f7d9950e533538a17282b16f716912b9b1206e5c676ebab5 | Python | 14,938 | 339 | import unittest
from skbase.utils.dependencies import _check_soft_dependencies
from pgmpy import config
from pgmpy.example_models import load_model
from pgmpy.factors.discrete import DiscreteFactor, TabularCPD
from pgmpy.inference import ApproxInference, VariableElimination
from pgmpy.models import DynamicBayesianNet... |
dd14be9548904ae72a556ee651c104a3dd1fc3a3c27df9df63621f8ae020a0fc | Python | 14,938 | 429 | from dataclasses import dataclass
from typing import Callable, Dict, Optional
import haiku as hk
import jax
import jax.numpy as jnp
import jmp
from typing_extensions import TypeAlias
from nucleotide_transformer.enformer.layers import (
Attention,
AttentionPool,
ConvBlock,
ResidualConvBlock,
expone... |
ef0b0421f2301d54797662876feeaf331b3ca78e0aebb0ddada9769d58af7488 | Python | 14,938 | 400 | """
Preprocessing Cache Management
This module provides utilities for building and managing preprocessed data caches.
It handles conversion from raw medical images to preprocessed PyTorch tensors,
with special handling for CT (multiple windows) and MRI (normalized) data.
Example Usage:
>>> from neurovfm.data.cach... |
9ac590d86b39faeb65ff55192bdef2a61e5a97638c4a2e5647c8c5871b1a2a31 | Python | 14,944 | 335 | """Figure 5 supplementary diagnostics — cross-species transfer.
Per-class diagnostics for the Lisberger ↔ Hull transfer setting:
1. Per-class recall heatmaps across all HIPPIE variants × both directions
2. GoC out-of-class prediction rate (the four shared cell types do not
include GoC; this panel summarises h... |
3406ffe9e9135b7f8c596b7d5ed055fc73f9e5fbc18be0bdc575de6f28878076 | Python | 14,953 | 389 | import collections
import numpy as np
import PIL.Image as Image
import PIL.ImageColor as ImageColor
import PIL.ImageDraw as ImageDraw
import PIL.ImageFont as ImageFont
_TITLE_LEFT_MARGIN = 10
_TITLE_TOP_MARGIN = 10
STANDARD_COLORS = [
'red','orangered','tomato','lightcoral',
'silver','gold','orange','khaki',
'limegre... |
4fdd22249738c1dae51d7700afb64a66647b45e42913fda6fbb41fcbdade9e33 | Python | 14,955 | 424 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import warnings
from typing import Any, Callable, Iterable, Iterator, Sequence, TypeVar, overload
from torch import Tensor
from torch_geometric.data import Batch, Data
from typing_extensions import TypeGuard
warnings.filterwarnings(
"ignor... |
50e14d530dbd2376e4587cc4d61c13f68d700d24ba63dc0f333040c107172641 | Python | 14,966 | 489 | import pandas as pd
import pdb
# sys.path.append("../../corecode/")
from build import *
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.stats import gaussian_kde
import matplotlib.colors as colors
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from pathlib import Path
impo... |
a5d8232de7b85433939ad9e8ad7a0ee9ea39704b1b87059e2e02328001a4d21d | Python | 14,967 | 439 | import logging
from dataclasses import dataclass
from typing import Callable, Dict, List, Optional
import haiku as hk
import jax
import jax.numpy as jnp
import jmp
from typing_extensions import TypeAlias
from nucleotide_transformer.borzoi.layers import ConvBlock, UNetConvBlock
from nucleotide_transformer.enformer.lay... |
f908e041dac2ce3f6ec64fc512cf3ac84ad403f70f83a72bb713216acc262207 | Python | 14,967 | 343 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from pathlib import Path
import tifffile as tiff
import numpy as np
import pandas as pd
import math
from skimage import filters, util
from skimage.measure import label as sk_label, regionprops_table
from skimage.morphology import remove_small_objects, disk, white... |
b51cfc149bb0cbea55e756e747061659ef30b17faba6092aae8254f53fc5f9f8 | Python | 14,995 | 398 | # 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 torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.models import (
... |
a9e59d83ad610052d29fcdc0e706bf020e9f32e19ef91008dc3992c7a6353750 | Python | 15,005 | 382 | """Process-wide runtime configuration.
TF32, the matmul precision, the caching allocator, tokenizer parallelism, the
RNG seed and the log handler are all process-global and sticky, so setting them
at import time makes a run's numerics depend on import order. `configure()` is
called from a script's `main()`; everything... |
d3872096c6f82be9f537a707905845c00b27e23675a1bca04c5c7b06fcb3a7e5 | Python | 15,012 | 387 | import unittest
import warnings
import numpy as np
import pandas as pd
from joblib.externals.loky import get_reusable_executor
from skbase.utils.dependencies import _check_soft_dependencies
from pgmpy import config
from pgmpy.example_models import load_model
from pgmpy.factors.discrete import TabularCPD
from pgmpy.mo... |
c036781f911cc77d86ff0a993b2d92f7312b4ee2d4a3fbca140b64d60fe18b35 | Python | 15,025 | 411 | import json
import os
import random
import sys
sys.path.insert(0, '..') # find dglgcn.py when run from OUTPUTS/
import numpy as np
import pandas as pd
from scipy.stats import spearmanr
from sklearn.model_selection import train_test_split
import torch
from dglgcn import (
Config,
GCN,
Xnoised_dataset,
... |
0b71657d026ad8ab08d062ef8c96158a8b436a2708bbaea2b2bbdc29f9ac4ea9 | Python | 15,036 | 408 | """Extended tests for src/processing/telemetry_processing.py — targeting uncovered branches."""
from __future__ import annotations
from datetime import datetime, time
from types import SimpleNamespace
import numpy as np
import pandas as pd
import pytest
from src.processing.telemetry_processing import (
_parse_cl... |
d9eb3078299d18c2bb7c6dc5de604f5c5118819b62cc20a84a26d87f21138d1c | Python | 15,036 | 399 | # Copyright (c) 2021 Tian Xie, Xiang Fu
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# Adapted from https://github.com/txie-93/cdvae/blob/main/cdvae/common/data_utils.py
from functools import lru_cache
import numpy as np
import torch
from pymatgen.core import Element
from mattergen.common... |
88e5c5343fd9edb3f6e97afeaebf143cec4e7295cf16f19adc9616e3db254299 | Python | 15,038 | 398 | import subprocess
import shutil
import os
import time
from pprint import pprint
from collections import namedtuple
import glob
import datetime
import psutil
npx_paramstup = namedtuple('npx_paramstup',['backup_location','start_module','end_module'])
backup_drive = r'T:'
default_start = 'copy_raw_data'
default_end = 'c... |
773de4e6ddfccd1114cb1a1c3b06e278147ed8bff962c3919045c9e35b409543 | Python | 15,041 | 380 | # 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 torch
from torch import nn
from torch.nn import functional as F
from fairseq.models import (
FairseqEncoder,
F... |
a3bdb71b4ab95ecb57f224287afbf8b12242416266ea36cfcf6f76c4234081d9 | Python | 15,046 | 330 | from pathlib import Path
import joblib
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from scipy.stats import pearsonr
from sklearn.linear_model import Ridge
from sklearn.model_selection import KFold
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScale... |
dfcd89f2d7f0e6ebd79e9c8e850491de6e70db7194d5c70df76a6ae0bb366380 | Python | 15,053 | 372 | """Function that prepares datasets for neural network models
that perform the frame classification task."""
from __future__ import annotations
import json
import logging
import pathlib
import warnings
import crowsetta.formats.seq
import pandas as pd
from ... import datapipes
from ...common import labels
from ...com... |
9e0b87ed418e3766735064710e15487a42bb209370358050fa1ab6436b264a4b | Python | 15,067 | 433 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Compute semantic similarities between GO terms. Borrowed from book chapter from
Alex Warwick Vesztrocy and Christophe Dessimoz (thanks). For details, please
check out:
notebooks/semantic_similarity.ipynb
"""
import sys
from collections import Counter, defaultdict, dequ... |
f26fa7338d1aa4e03257746ad2bce6bbbf694f897efcf965caef6ea472b342b5 | Python | 15,070 | 407 | """
This module contains the encoder used by the Garfield model.
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.utils import dropout_adj
from torch_geometric.data import Data
from torch_geometric.nn import GCNConv, GATConv, GATv2Conv
from .utils import DSBatchNorm, drop_fe... |
a79a7d00d5774ec6cb7693bcf77be422769ae5e57663a4900dd7a1095bd68514 | Python | 15,081 | 388 | """ Tools to track the isotropic expansion of chromatophores. """
from pathlib import Path
import time
import click
import numpy as np
import pandas as pd
import dask.array as da
import xarray as xr
import zarr
import matplotlib.pyplot as plt
import cv2
from skimage.segmentation import mark_boundaries
from typing impo... |
fb618afcfd3219fa6c90c4e71f6de18fd5a5c0554dc83333d303b59374823bbd | Python | 15,088 | 452 | from sklearn.svm import SVC, SVR
from sklearn.preprocessing import LabelEncoder, OrdinalEncoder, MinMaxScaler
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.experimental import enable_iterative_imputer
from sklearn.impute import IterativeImputer, SimpleImputer
f... |
df598a453718383bf2c931e2c8f626c582f404fa5309695f86340138eb194f40 | Python | 15,106 | 362 | import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
import math
def random_transform(input, target, rng, is_rotate=True):
"""
Randomly rotate/flip the image
Arguments:
input: input image stack (Pytorch Tensor with dimension [b, T, X, Y])
target: targer image s... |
36794e2781c19b971721c043a2ca14078ba80384e636bf1dc9539bd70bdaa250 | Python | 15,113 | 432 | #!/usr/bin/env python3
"""
Author: Ken Chen
Email: chenkenbio@gmail.com
"""
import os
import torch
import warnings
import numpy as np
import gzip
from tqdm import tqdm
from collections import defaultdict
from transformers import BertForMaskedLM, BertTokenizer
from torch.utils.data import DataLoader, Dataset
from torch... |
fdd7955f1fc3ef4e0a0ccbfb761128b5b269ad09f50423428f77aee12a53480c | Python | 15,131 | 377 | '''
1. Normalize features of shape (N, sphere_basis, C),
with sphere_basis = (lmax + 1) ** 2.
2. The difference from `layer_norm.py` is that all type-L vectors have
the same number of channels and input features are of shape (N, sphere_basis, C).
'''
import torch
import torch.nn as nn
def get_... |
e446d97a4c69187400e6de9f1b7b16b5c6b8dccab1676a9d9a1a656930fc59d2 | Python | 15,143 | 404 | import theano.tensor as T
from .base import MergeLayer
__all__ = [
"autocrop",
"autocrop_array_shapes",
"ConcatLayer",
"concat",
"ElemwiseMergeLayer",
"ElemwiseSumLayer",
]
def autocrop(inputs, cropping):
"""
Crops the given input arrays.
Cropping takes a sequence of inputs and... |
81fefd10cb56fc93a2d2f7aebd1f6ea38d4ede14c877e5001627cb4777c0a76a | Python | 15,152 | 376 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Calculate the eigenmodes of a volume
Updated to lapy 1.0.1
Original authors: James Pang and Kevin Aquino, Monash University, 2022
@author: James Pang, Monash University, 2025
"""
# Import all the libraries
from lapy import Solver, TetMesh
import nibabel as nib
import... |
eb52f51951c449cc588b1b5209c8ce8d4eda3e876585b4fcac644b57a2535d93 | Python | 15,153 | 356 | """Builtin package uninstaller.
Entry point is the ``uninstall_distribution`` function.
Adapted from pip's ``pip._internal.req.req_uninstall`` so Poetry can uninstall
packages without invoking ``pip uninstall`` as a subprocess. The module is
self-contained and does not import from pip.
Most methods and classes are b... |
fce2995057fb6494aa37b2695758ee9346f4e7f4b0e22cc2893066d9a9ca4c88 | Python | 15,163 | 402 | import unittest
import warnings
import numpy as np
import pandas as pd
from joblib.externals.loky import get_reusable_executor
from skbase.utils.dependencies import _check_soft_dependencies
from pgmpy import config
from pgmpy.estimators import ExpectationMaximization as EM
from pgmpy.example_models import load_model
... |
f4e071535e2e028eae628ef6dd6119d7d5cf97242b31e42059fa03afafcb43b7 | Python | 15,164 | 397 | import numpy as np
import theano.tensor as T
from lasagne.theano_extensions import padding
from .base import Layer
__all__ = [
"FlattenLayer",
"flatten",
"ReshapeLayer",
"reshape",
"DimshuffleLayer",
"dimshuffle",
"PadLayer",
"pad",
"SliceLayer"
]
class FlattenLayer(Layer):
... |
ccc015bf528838ff6e947e7180d174477364f74f19c06b9d9d48186f92dd0edd | Python | 15,172 | 388 | """
Array Preprocessing Module for Model Inference
This module provides functions to convert loaded SimpleITK images into
properly formatted numpy arrays ready for model inference. It handles
modality-specific preprocessing (CT windowing, MRI normalization) and
background mask generation.
The main entry point is `pre... |
bd33f233b3f90c7a4625df853cf0591c8b0da822c8d2ff4e3def7f3046c91a9d | Python | 15,173 | 384 | ### Model training and testing
import os
import pickle
import sys
import time
import matplotlib
import matplotlib.pyplot as plt
import h5py
import numpy as np
import torch
from torchvision import datasets, transforms
import torchvision.models as models
from torch import sigmoid
from lucent.util import set_seed
from ... |
87b201de9329827f3893947888c87ac9595308eae38367e5eb5ebdaac06faf41 | Python | 15,195 | 396 | import warnings
warnings.filterwarnings('ignore')
from typing import Callable, Tuple, Union
import math
import torch
from torch import Tensor
import torch.nn as nn
import torch_geometric.nn as gnn
import torch.nn.functional as F
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.nn.dense.linear im... |
4646f4a7890d45ef09e7d6d5389c55fc18215b0e15c98ef78322d7f576a97112 | Python | 15,199 | 423 | # 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
import torch
import torch.nn as nn
import torch.nn.functional as F
from .modules import (
TransformerLayer,
AxialTransfo... |
e06e3c0934112dd05589e5d2aa142ce54fbaa4dc74f82f168e8d9b301e707832 | Python | 15,205 | 432 | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
dd5b0e6d207fa28472adb79761e37c452d7818a7347f3abd9e8345d7212ece7a | Python | 15,208 | 434 | """STDP kernels, spike correlation utilities, and the STDPRuler rule container."""
from typing import Callable
import numba
import numpy as np
import numpy.typing as npt
def get_first_order_stds(
ordered_spikes: npt.NDArray, num_neurons: int
) -> list[list[list[float]]]:
"""Return nearest-neighbor spike tim... |
c47c5d26815c5bc9a7c7d8115a05afbcff3b240e36da52679eab4a7046384d93 | Python | 15,213 | 459 | import math
from functools import partial
import jax
import jax.numpy as jnp
import pytest
from folx.api import FwdJacobian, FwdLaplArray
from folx.experimental.pallas.attention import custom_vjp_mhsa, custom_vjp_mhsea
from folx.experimental.pallas.attention.forward_laplacian import (
mhsa_forward_laplacian,
... |
a5ee6a47f8ec9cefc158f46ad0898fe19673e7277f318e48bfe29a1de42dd6a7 | Python | 15,215 | 378 | # 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... |
a2ac1bb2218b31d96de72c19cfb26ad2ac4bf8d016f45cb8b4647d687335b968 | Python | 15,224 | 523 | """Basic functions on surface meshes."""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import warnings
from itertools import combinations
import scipy.sparse as ssp
from scipy.spatial.distance import cdist
from scipy.sparse import csgraph as csg
import numpy as np
from vtk import (vt... |
0bf5565263ce4f3bcaf9bbd78ab98d9c10f21585dcd90971fcd4aae796578e41 | Python | 15,233 | 385 | """Read an Association File and store the data in a Python object."""
import sys
import timeit
import datetime
import collections as cx
import logging
from ..anno.opts import AnnoOptions
from ..base import logger
from ..evidence_codes import EvidenceCodes
from ..godag.consts import NAMESPACE2NS
from ..gosubdag.go_tas... |
4a6db95d22416fb72718eafbbffea2811deaf2ac218d9569ba29fab9acc00b77 | Python | 15,233 | 358 | #!/usr/bin/env python3
"""
export_tables.py — Export all response-letter tables as CSV files.
Usage:
python export_tables.py
Output: ../../revision/tables/table_*.csv
"""
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from scipy.stats import wilcoxon
SCRIPT_DIR = Path(__file__).parent... |
a38a6964ec0f3464bbffca6d19a17ae8c2ff153572bdf0df3c0b00daa0c727ac | Python | 15,239 | 436 | import abc
import os
import time
import sys
from tqdm import tqdm
from math import ceil
class MultipleProcessRunner:
"""
Abstarct class for running tasks with multiple process
There are three abstract methods that should be implemented:
1. __len__() : return the length of data
2. _target... |
2ff6a9ff1bbb566cd85b2a3ac2474d918a351ab58f4e1b148aff58ed55735483 | Python | 15,279 | 389 | # 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 types
import torch
def get_fused_adam_class():
"""
Look for the FusedAdam optimizer from apex. We first try to load the
... |
a66bf5d995be7970a7b459a1175fae429020bd334821a2142f4229fb4d41e3e7 | Python | 15,311 | 318 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from batchgenerators.transforms.abstract_transforms import AbstractTransform
from batchgenerators.augmentations.utils import create_zero_centered_coordinate_mesh
from batchgenerators.augmen... |
011668985d6c133966bb37a230239ba0ac706a99d3c5e1b40f7e7a2425f324a8 | Python | 15,324 | 448 | """tests for ``vak.prep.spectrogram_dataset.audio_helper`` module"""
from pathlib import Path
import numpy as np
import pytest
import vak.prep.spectrogram_dataset.audio_helper
def expected_spect_files_returned(
spect_files_returned,
source_audio_files_expected,
source_audio_files_not_expected=None,
... |
0dc6410c197493bc325f7b254083151603f1464230abbf3d8f383b3e91d17b61 | Python | 15,343 | 402 | from .. import options as opts
from .. import types
from ..charts.base import Base
from ..globals import RenderType, ThemeType, ToolTipFormatterType
from ..types import Optional, Sequence
class Chart(Base):
def __init__(
self,
init_opts: types.Init = opts.InitOpts(),
render_opts... |
929f746d388d9bff1d47f7e746cfd1ed47704f17783fff4214d39e4b24a299be | Python | 15,343 | 460 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 10 01:10:07 2023
@author: Peter Rupprecht, ptrrupprecht+celldetection@gmail.com
Code to read in training data for cell classification (cell vs. non-cell) from a 3D local volume (31x31x91 pixels)
Code for the 2D CNN architecture was inspired by thi... |
ef0b9dbecb2b83dadb3c525f63af83e3e147ceb92c6d24af3bc12d7070e9f0d2 | Python | 15,353 | 415 | #
# Renzo Comolatti (renzo.com@gmail.com) and Adenauer G. Casali
#
# Please cite this paper if you use this code:
# Comolatti R et al., "A fast and general method to empirically estimate the complexity of brain responses
# to transcranial and intracranial stimulations" Brain Stimulation (2019)
# https://doi.org/10.1016... |
e856c214baceeae441b77456b1e744829d2426ccbd077e1ce4da4ff391be1c7f | Python | 15,359 | 444 | import csv
import logging
import math
import os
import typing
from collections.abc import Iterable, Iterator
from functools import reduce
from itertools import chain, dropwhile, groupby, islice
from typing import NamedTuple, Optional
import torch
import transformers
from jaxtyping import Float, Integer, Num
from pydan... |
8a129b25e9c6dc5a6748e4f50212f8565cfcbfb1546f48a22480fabb58ab7035 | Python | 15,360 | 348 | """Handy functions for dealing with slurm."""
import os
from stat import S_IREAD, S_IWRITE, S_IEXEC, S_IRGRP, S_IROTH
DEFAULT_MODULES = ("bedtools", "meme", "bedops", "ucsc", "bowtie2", "samtools",
"sratoolkit")
def configSlurm(shellRcFiles: list[str] | str, envName: str, workingDirectory: str,
... |
8942e3d4f1734429e1206f81ac36c6218fe49e5e20f2806c238784cc2261fc6a | Python | 15,376 | 303 | import os
import socket
from typing import Union, Optional
import argparse
import nnunetv2
import torch.cuda
import torch.distributed as dist
import torch.multiprocessing as mp
from batchgenerators.utilities.file_and_folder_operations import join, isfile, load_json
from nnunetv2.paths import nnUNet_preprocessed
from nn... |
e0f48a99e780c3a0663723d6deebd6040c98e003ff9fe7ff4ff1fe8f441bef11 | Python | 15,386 | 315 | """
Pipeline 4: Layer 2H Pairing-Family Decomposition Applied to EIF2S1-PELO
Author: Drake H. Harbert (D.H.H.)
Affiliation: Inner Architecture LLC, Canton, OH
ORCID: 0009-0007-7740-3616
Date: 2026-04-29
Description:
Applies the principled-pairing criterion (Layer 2H, validated 2026-04-29 across
4 substrates) t... |
8ef53c7d177237cc303364a432ee36e8498b478177d783ff3d4e171e9cf14dcd | Python | 15,393 | 259 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tempfile
import shutil
import subprocess
import nibabel as nib
import numpy as np
from tractseg.libs import fiber_utils
from tractseg.libs import img_utils
from tractseg.libs import tractseg_prob_trac... |
ec5cadc5651644162210c8699c27f499bc163c0e7c8b8924cb2acdf71a6f34f9 | Python | 15,394 | 344 | import io
import json
import os
from pathlib import Path
import sys
import tempfile
import unittest
from unittest.mock import patch
import zipfile
from segjob_image_fixtures import make_series
import numpy as np
from PIL import Image
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
os.environ.setdefault("SEGREF... |
329c490a41dfd95ad1a52e6a52b8bd12a6128336150dcbd3ca4bf5f5e156543a | Python | 15,400 | 449 | from __future__ import annotations
from typing import TYPE_CHECKING
from poetry.mixology.incompatibility_cause import ConflictCauseError
from poetry.mixology.incompatibility_cause import DependencyCauseError
from poetry.mixology.incompatibility_cause import NoVersionsCauseError
from poetry.mixology.incompatibility_ca... |
8bd2adc06c890347e03cf483e48a9fa0ddbbdb46a9bd07f9c8096ac36a7fb781 | Python | 15,406 | 385 | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
import torch
from torch.distributions.multinomial import Multinomial
from scvi import REGISTRY_KEYS
from scvi.data import AnnDataManager
from scvi.data.fields import CategoricalObsField, LayerFie... |
4df5ba356018ae96cbd17bc84179189c049ce6a3a939cbadfc446a30467fc0b1 | Python | 15,415 | 450 | import torch
import torch.nn as nn
from model.convhole import ConvHole2D
class SUPPORT(nn.Module):
"""
Blindspot network
Arguments:
in_channels: the number of input channels (int)
mid_channels: the number of middle channels ([int])
"""
def __init__(self, in_channels, mid_channels=... |
ac1712b7b6d5f449ebf1d539295e291aa9d7167864a09bf9d0d397bb467e7be1 | Python | 15,418 | 416 | # ##############################################################################
# GPLv3 LICENSE INFO #
# #
# Copyright (C) 2020 Mario S. Valdés-Tresanco and Mario E. Valdés-Tresanco ... |
46ca6458f06f88cb559fd7b468e53bbb4573401305ad70d90ce4d36d486e63bb | Python | 15,419 | 411 | """Telemetry recording ingestion, time alignment, and window extraction helpers."""
from __future__ import annotations
import logging
import re
from collections.abc import Callable
from datetime import datetime, timedelta
from pathlib import Path
import numpy as np
import pandas as pd
logger = logging.getLogger(__n... |
820773633e56353ec3cfb11757e2e8ff3e971a18a20e35dec2a84c063f6746c7 | Python | 15,427 | 403 | #!/usr/bin/env python
# ENCODE DCC common functions
# Author: Jin Lee (leepc12@gmail.com)
import os
from encode_common import *
def samtools_index(bam, out_dir=''):
bai = '{}.bai'.format(bam)
cmd = 'samtools index {}'.format(bam)
run_shell_cmd(cmd)
if os.path.abspath(out_dir)!= \
os.path.absp... |
f088f6a50d543ce6a0bad88db601dc52e527904d11e27dd73ffe89f80c548863 | Python | 15,429 | 423 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 28 22:43:03 2023
@author: Peter Rupprecht, ptrrupprecht+celldetection@gmail.com
# ============================================================================
# Script for merging (elimination of splitter cells)
#
# The script takes each detecte... |
7d0173f1d6009f605e5df57d6fdcefcd5b8cdf56d5a32ee831670e410e253eeb | Python | 15,432 | 415 | """
Integration test: multi-column export.
Runs DataProcessingSingleInstance end-to-end with two signal columns ticked
(dFoF_465 + dFoF_405 — a real dual-wavelength scenario) and checks the
produced workbook has distinct, correctly suffixed sheets per column.
"""
import matplotlib
matplotlib.use("Agg") # must be se... |
07b58344614ad4e56c34a12f3d8f5fb807c47bb4821885a29469d554501bc776 | Python | 15,440 | 355 | import pandas as pd
import numpy as np
from pathlib import Path
import os
import zarr
from tqdm import tqdm
from tangle_tracer.annot_conversion.WSIAnnotation import load_annot
from nft_datasets import ROIDataModule
import torchvision.ops.boxes as bops
import torch
from histomicstk.annotations_and_masks.masks_to_annota... |
9dab74785d9ec996b670bcaeda8b647766b5db8e3757a17b76bb757a9159df39 | Python | 15,440 | 413 | # 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 argparse
from pathlib import Path
from typing import Callable, List, Optional, Union
import torch
from fairseq import utils
from fairs... |
79ed555e92fb27247ffa57d0caccdef9cb04fbfdb79172c6d58538d36c26b354 | Python | 15,449 | 441 | # #pip install thop thop==0.0.31.post2005241907
# from modelR.lodet_hbb import LODet
# import torch
# from thop import profile
# import utils.gpu as gpu
#
# net_model = LODet()
# device = gpu.select_device(0)
# model = net_model.to(device) ## Single GPU
#
# net = model() # 定义好的网络模型
# input = torch.randn(1,... |
ced4e6ff15972eeda0630db66eb381f70fdc529a90408fde9f21c1a77af2dc08 | Python | 15,449 | 395 | """Forward laplacian of ``slogdet``.
The jacobian and the hessian trace of ``log|det A|`` both follow from the
inverse of ``A``. If the jacobian of ``A`` is sparse, the hessian trace also
decomposes over the input coordinates, which ``sparse_slogdet`` exploits; the
dense contraction is in ``dense_slogdet``.
"""
from ... |
7f28f6465bebfeec85ab8b0eaf0e1ec78b8cf12f4542ae794a09ffa397c683bf | Python | 15,463 | 284 | #!/usr/bin/env python3
"""figure6_intersection_heatmap.py — POSTER-STYLE 4-layer × tissue
intersection matrix with Inverse-concordant Tier-1 highlighting.
Same data as v5_poster but with:
• Rows fixed in four evidence blocks (Tier-1 / suggestive / Tier-2 auxiliary / proteomic anchor)
• Horizontal separator lines b... |
2faafea3bc6b1e5abc7bf1958da4a002ab89e0416222e9cbcbf128e91605189e | Python | 15,468 | 475 | import networkx as nx
import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from pgmpy.base import PDAG
from pgmpy.estimators import PC, ExpertKnowledge
from pgmpy.example_models import load_model
from pgmpy.independencies import Independencies
from pgmpy.s... |
75ef0d538d6d438ed12b02adf79e8de93dd8d93a925c00721f8e990a9db2434d | Python | 15,471 | 429 | # 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 os
import numpy as np
import pickle
import time
try:
import faiss
except ImportError:
pass
from collections import defaultdict... |
b9d9a94ac5d0c7e465b065b76c91bbd21d1ce41dcfc8b5052fc06a7c2a957607 | Python | 15,479 | 321 | # encoding: utf-8
"""
@author: Jiayang Chen
@contact: yjcmydkzgj@gmail.com
"""
import torch
from .backbones import choose_backbone
from .pairwise_predictor import choose_pairwise_predictor
from .weights_init import *
from ptflops import get_model_complexity_info
from torch.cuda.amp import autocast
class Baseline(n... |
ac4b9c13ef76c92fa024f9efd0c077745e4c6dc855560bc2654bea9b42e24a25 | Python | 15,494 | 471 | import inspect
from collections.abc import Callable
from collections.abc import Iterable as IterableClass
import numpy as np
import pandas as pd
import torch
from scvi.model.base._differential import (
describe_continuous_distrib,
estimate_delta,
estimate_pseudocounts_offset,
pairs_sampler,
)
from scv... |
d544f599482fffed6fd998b69e5b4a9f24af8390268431a132c6a09856866b00 | Python | 15,495 | 470 | import os
import voluseg
from voluseg._tools import download_sample_data
import pytest
from pathlib import Path
import numpy as np
import h5py
from dask.distributed import Client
# # To run tests locally, set these environment variables:
# os.environ["GITHUB_ACTIONS"] = "false"
# os.environ["SAMPLE_DATA_PATH_H5"] = (... |
a135b46d317993e82996330ec906cba4b4ecbacfa0b03422a436344e6e64d596 | Python | 15,518 | 305 | import numpy as np
from mdt import CompartmentTemplate, CompositeModelTemplate, FreeParameterTemplate, ProtocolParameterTemplate, \
LibraryFunctionTemplate
from mdt.model_building.parameter_functions.transformations import ScaleTransform
from mdt.utils import voxelwise_vector_matrix_vector_product, create_covarianc... |
7ba9a25f1be14dbe6ece56f9c8b577a98ed7ebb74b0a0f049706f935c1066a88 | Python | 15,521 | 474 | import jax
import brainpy as bp
import brainpy.math as bm
import numpy as np
from tqdm import trange
class HD_cell_L1(bp.DynamicalSystem):
def __init__(
self,
num: int,
noise_strength: float = 0.01,
tau: float = 1.0,
tau_v: float = 10.0,
k: float = 1.0,
mba... |
7467d2e0a97422f6724991e15e9c36ff1305d768ca37c433eca0c5ef135ed6fb | Python | 15,522 | 406 | #!/usr/bin/env python
# ENCODE DCC common functions
# Author: Jin Lee (leepc12@gmail.com)
import os
from encode_common import *
def samtools_index(bam, out_dir=''):
bai = '{}.bai'.format(bam)
cmd = 'samtools index {}'.format(bam)
run_shell_cmd(cmd)
if os.path.abspath(out_dir)!= \
os.path.absp... |
d5f76d85e141b127edb2c1069e513c562be8a6d6c4c02b3925519d0ce395d245 | Python | 15,528 | 493 | #!/usr/bin/env python3
# MIT License
#
# Copyright 2024 Broad Institute
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use... |
d599832008176273c159d98660117f3d136e341a0844309e27bc7b5d99b427cc | Python | 15,529 | 503 | from collections import Counter
class _TreeNode:
"""
Private base class for all expression tree nodes.
Not part of the public API. Provides the shared interface that makes uniform tree traversal
possible: every node exposes ``children`` (list of _TreeNode), ``to_latex()`` (str), and
``__repr__()`... |
905d106d4ff9b287382a39b5095b4e8f7a662349dc8a3097ee4d3475731ac680 | Python | 15,538 | 321 | """GO Grouper Plotting objects."""
import sys
import os
import collections as cx
from goatools.gosubdag.plot.gosubdag_plot import GoSubDagPlot
from goatools.gosubdag.gosubdag import GoSubDag
from goatools.gosubdag.go_tasks import get_go2parents_go2obj
from goatools.grouper.colors import GrouperColors
__copyright__ = ... |
89eb72b419fb3562751e8bb0267042857ad0cd72cad6f1fd3e80be48633fa96e | Python | 15,550 | 447 | # 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 itertools
import logging
import os
import re
import numpy as np
import torch
from examples.speech_text_joint_to_text.data.pair_denois... |
ab1f8bbe2244fee0acff40571f6324782d192af9b10e067516cb79843d3d1fa6 | Python | 15,550 | 381 | from __future__ import annotations
from itertools import combinations, pairwise
import networkx as nx
import pandas as pd
from sklearn.base import clone
from pgmpy import config
from pgmpy.base import DAG
from pgmpy.causal_discovery._base import BaseCausalDiscovery
from pgmpy.ci_tests import get_ci_test
from pgmpy.g... |
2150f21e730b18bf08fa963081c479e91ddfa9c02866a7eea92a4965242aea57 | Python | 15,555 | 409 | import numpy as np
def FNN(data, tau, MaxDim, Rtol, Atol, speed):
"""
data - column oriented time series
tau - time delay
MaxDim - maximum embedding dimension
Rtol - threshold for the first criterion
Atol - threshold for teh second criterion
speed - a 0 for the code to calculate to the MaxDim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.