sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
a6b1a7eb70a81f8f6d440c39a41bad5a17b7be31f8b608356794f1db1896cbd2
Python
15,574
470
from __future__ import annotations import contextlib import logging import shutil from datetime import datetime from datetime import timedelta from datetime import timezone from pathlib import Path from typing import TYPE_CHECKING from typing import Any from zipfile import ZipFile import pytest from packaging.metad...
949b136edab521d797e28bb065650a3f7cd5fd7e594a8ba8ebabfe590d04673d
Python
15,577
304
#三个头0414 import logging import argparse import torch.optim as optim from torch.utils.data import DataLoader from tensorboardX import SummaryWriter import dataload.meta_datasets as data import utils.gpu as gpu from utils import cosine_lr_scheduler from utils.log import Logger #from modelR.meta_lodet_hbb import...
5252cbf94f1335ead21ba74d1e196f56614434e4ee8f1ea9a5e86e94f9eea7f7
Python
15,579
384
import itertools import json import re import shutil import typing import webbrowser from pathlib import Path from typing import Literal, Union import networkx from pyvis.network import Network from rnalysis import __version__ from rnalysis.exceptions import InvalidValueError from rnalysis.gui import gui_windows from...
28e7defb67ee37ccf4a7acf888510f0c6be46144851f0a5c76f13666c0e1bc21
Python
15,584
333
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, insert_crop_into_image from batchgenerators.utilities.file_and_folder_operations import join import nnu...
b6806bb81913116ef915887d9e0edccd77dc17fb806ede17256bbca0a844910f
Python
15,584
476
import random import numpy as np from deap import base, creator, tools, algorithms from scipy.optimize import newton from scipy.optimize import minimize import pandas as pd from numba import jit import datetime import time import os import multiprocessing as mp from functools import partial Lr = 0.013 gr = 1. # =====...
4deb69ddad3cb222d8ac2263580c0a2795681a251cea2a15977a502f811cb6cd
Python
15,589
497
#!/usr/bin/env python3 """ Allen NWB Data Loader for NEMO Benchmark Provides utilities to load spike times, waveforms, and metadata from Allen Brain Observatory NWB files. Supports both local NWB files and remote S3 access (when S3_BUCKET / S3_PREFIX / S3_ENDPOINT are set). Usage: # Local NWB file (default workfl...
27af7b3513e422748bfafc8b44c5019e77231ce376e81143ac3ceb1240010f4d
Python
15,593
529
import unittest import numpy as np from skbase.utils.dependencies import _check_soft_dependencies from pgmpy import config from pgmpy.factors.discrete import DiscreteFactor, TabularCPD from pgmpy.models import DiscreteBayesianNetwork, DiscreteMarkovNetwork from pgmpy.readwrite import UAIReader, UAIWriter class Test...
4f950a343e6c73cb780e6c6643ba289fe5c9c04ce70186b8890c533dfebb0a94
Python
15,596
406
#!/usr/bin/env python3 """Copy and simplify code form original repo.""" import numpy as np import numpy.typing as npt from tqdm import tqdm, trange #################################### # FROM simulator.py #################################### def correlated_poisson_spike_train( num_neurons: int, firing_rate...
afe81faab1fa88556b8665953f27598e6ab17c5b8dabd1e25fb16b79b0786649
Python
15,619
355
from typing import Dict, Tuple, Optional import math import torch import torch.nn as nn import torch.nn.functional as F from dgr.models.phc_net import ( ModalityEncoder, CrossModalFuse, B0SpatialAttention, ) class ResidualBlock(nn.Module): def __init__(self, ch: int) -> None: super().__init_...
34a6946f3c9aa9109f66d6fe737a41049689328e56cc4aae57d12069367c8471
Python
15,626
478
import torch import torch.nn as nn import timm import numpy as np class ResidualBlock(nn.Module): def __init__(self, in_planes, planes, norm_fn='group', stride=1): super(ResidualBlock, self).__init__() self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=3, padding=1, stride=stride) sel...
0718bbc74474932a3fca2b3669b71548cc94ffbd78f5392ca774e34a85523179
Python
15,629
350
import xarray as xr import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm import os from skimage.segmentation import mark_boundaries from matplotlib.patches import Wedge import matplotlib.collections as collections import decord import click import matplotlib import zarr from ..utils.decorators impor...
196816b5c825e88cd9b82127880d631ea0ae63aee73e9acc4f188afb44e0e1c9
Python
15,640
434
import collections from os.path import basename, dirname from os.path import join import numpy as np import pandas as pd import seaborn as sns from matplotlib import gridspec from matplotlib import pyplot as plt from matplotlib.ticker import FormatStrFormatter from sklearn import metrics from config_path import PROST...
239b35097ac93dea27dfd4be4af364474c86b3f8229d2a05ed3a8da761e3a1b2
Python
15,640
397
import numpy as np import torch from torch import nn import torch.nn.functional as F # TODO: # - make this "exchangeable" by shuffling all columns but the last (requires handling packed_sequence separately) class RNN(nn.Module): def __init__(self, input_size, output_size, num_layers=2, dropout=0.0): """ ...
0d995c2bbc2bda017fb449130d1a6b099ad6ee94aa1364489d870209e8b4ff66
Python
15,648
434
import collections from os.path import basename, dirname from os.path import join import numpy as np import pandas as pd import seaborn as sns from matplotlib import gridspec from matplotlib import pyplot as plt from matplotlib.ticker import FormatStrFormatter from sklearn import metrics from config_path import PROST...
83f5d3293b23baad2ea9ba7b07c2cc0a5c75d2629c883e77f15215a79925cff1
Python
15,655
423
"""Creation and loading of models.""" import abc import importlib import itertools import os import pathlib import tempfile import pysam import requests import torch import medaka.common import medaka.datastore import medaka.options logger = medaka.common.get_named_logger('ModelLoad') class DownloadError(ValueEr...
f32ad24e0651fcc265bea950890e3da6666164ce53b4fae5937e6d5bf8adf379
Python
15,657
464
from typing import Optional, Dict, Any, List, Tuple import numpy as np import matplotlib.pyplot as plt from scipy.ndimage import gaussian_filter1d from scipy.interpolate import splprep from matplotlib.patches import Wedge from matplotlib.colors import LinearSegmentedColormap from matplotlib.collections import LineCol...
457f636ad85d3b5c0979f6b8d7bddfbb4bf0b6ae502a09cbc781f746cba5524f
Python
15,658
452
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. from dataclasses import dataclass,...
e9ebdd79ae56bcab01d3f6844d6e5a43f8d599fed21fcab1f4ab7fded722bdc6
Python
15,660
411
#!/usr/bin/env python import argparse import logging import os import pathlib import warnings from collections.abc import Mapping from typing import cast import h5py from d3text import ( checkpoint, data, encodings_store, factory, linking_corpora, runtime, token_labels, tracking, ) fr...
4b871cc675bd45424a7561292443f6f20a6f2c4d194cbb44a9d27931b675f6ee
Python
15,681
532
""" This is a modified version of the code present in: https://github.com/nanoporetech/pipeline-umi-amplicon/blob/master/lib/umi_amplicon_tools/extract_umis.py """ import argparse import logging import os import edlib import pysam import sys def parse_args(argv): """ Commandline parser :param argv: Com...
161791690e02b68b74bef6c8b4b87503120c058650ce3ac43dfe3888d9dc142d
Python
15,685
443
# 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 numpy as np import torch from . import FairseqDataset, data_utils def collate( samples, pad_idx, eos_idx, ...
45553ea1c66b02dbc7b54854325ef94dd1eb740f1e37b51ba418d0c2841456e0
Python
15,692
361
import matplotlib.pyplot as plt import numpy as np import igraph as ig import networkx as nx import os import sys import seaborn as sns abspath = os.path.abspath(__file__) dname = os.path.dirname(abspath) os.chdir(dname) os.chdir('..\\src\\') sys.path.append(os.getcwd()) from read_graph import read_graph # datapath = ...
82e99edaf1548da0acf5ae58f7e23f4c5ffc31819f75b069e03bd5bdf4a6bb87
Python
15,710
481
import numpy as np import pandas as pd import statsmodels.formula.api as smf from .paper_ANOVA import ANOVAModel # Colours and types Types = np.array(["T4", "T5"]) Type_colours = np.array(["#17becf", "#ff7f0e"]) Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"]) Subtype_colours = np.array( ...
8da3b1004683e02f305aa49e404bf4a1fb4d7f93e68b6aea72d501fe0bcf85c3
Python
15,718
448
# 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 fairseq import utils from fairseq.data.data_utils import lengths_to_padding_mask from ...
1873a85fc801a4318ddc12984d55b3605191ed9fbcd84ee6d057191fb11404c2
Python
15,720
413
""" Visualization script for weight parameter (ω) ablation study results. This script generates publication-quality figures showing: - Performance vs weight value - Spatial coherence vs weight value - Graph connectivity statistics vs weight value - Trade-offs between spatial and expression contributions """ import os...
f25f4b2f329db51508ddf0dafd5abed5fc52a89bd1673470cace3abed9665fd5
Python
15,732
332
import unittest from pathlib import Path import copy import re import tempfile from GMXMMPBSA.input_parser import input_file ROOT = Path(__file__).resolve().parents[1] class LoggingDocumentationTest(unittest.TestCase): def test_logging_guide_documents_supported_modes_and_cluster_monitoring(self): guide...
750fda6f531801239391aaadd866d51bf817d6b4b4b3b641deb8a8c534074466
Python
15,746
482
import numpy as np import pandas as pd from matplotlib.lines import Line2D import statsmodels.formula.api as smf from .paper_ANOVA import ANOVAModel # Colours and types Types = np.array(["T4", "T5"]) Type_colours = np.array(["#17becf", "#ff7f0e"]) Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", ...
568d0c761483b4f2b41fad3d7a9305c30da151ac41fe911c7d136d9585eda1a8
Python
15,757
473
import numpy as np import pandas as pd import pytest from joblib.externals.loky import get_reusable_executor from skbase.utils.dependencies import _check_soft_dependencies from pgmpy import config from pgmpy.base import DAG from pgmpy.factors.discrete import TabularCPD from pgmpy.models import DiscreteBayesianNetwork ...
15379accfe4618707c76ea5752ed00dc15e2da4f5b5253a77dc1edf03dc9170e
Python
15,762
450
""" Utility functions for matching """ import pandas as pd import numpy as np import pynndescent from scipy.optimize import linear_sum_assignment from . import _utils as utils # modify from Maxfuse: https://github.com/shuxiaoc/maxfuse/blob/main/maxfuse/match_utils.py#L273 def match_cells(arr1, arr2, base_d...
1606ebd24bb63c63ae4a81c6e6caf79041e45b98868b0388449fabb73100121f
Python
15,768
403
import re import os import sys import argparse import numpy as np import pandas as pd import pprint from pprint import pprint from scipy import stats from sklearn.preprocessing import StandardScaler from sklearn.metrics import r2_score sys.path.append('/scratch/l.lexi/WAPIAW2024/Source_Code/utils_py') import utils_py ...
fd845db1fca2a81d942b7f72340eeaf21ee9e7fe6ab4109f87232bd1b5e8de59
Python
15,781
389
# Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors import argparse import yaml import logging from Simulator_calibration import (ForcefieldBuilder, SimulationBuilder, ReporterAdder, SimulationRunner, AmpConfigurator, SystemBuilder, ...
946db64eb1305557a49e2f3ac11ab28fd9ff857bfb16909675dce238ef81c2e7
Python
15,805
417
#!/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. """ Translate pre-processed data with a trained model. """ import ast import logging import math import os import sy...
7e290933acf164f6e20f27f13493c68f188c8a8f3f28a3c8e8f3240191b0a5c2
Python
15,807
373
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from dataclasses import dataclass from functools import cached_property, lru_cache from typing import Literal import numpy as np import numpy.typing from pandas import DataFrame from pymatgen.analysis.phase_diagram import PhaseDiagram from pymat...
e69ddc3a4da2ad9d9570a485ef335b2d6b15e8a870c6ac025fbd2a72ac3a7fea
Python
15,815
399
import os import torch import copy import numpy as np import matplotlib.pyplot as plt import seaborn as sns from ProteinMPNN.vanilla_proteinmpnn import protein_mpnn_utils as utils from dotenv import load_dotenv load_dotenv() device = torch.device("cuda" if torch.cuda.is_available() else "cpu") DEFAULT_PROTEIN_MPNN_C...
acba98377ad088545ec62366d39143bc025558cc416d14577b6f58138700405e
Python
15,824
476
import matplotlib from rnalysis.utils.ontology import * matplotlib.use('Agg') def _stub_graphviz_binary(monkeypatch): """Stub out the real GraphViz binary probe so these unit tests stay hermetic. ``render_graphviz_plot`` calls ``graphviz.version()`` - a real subprocess probe of the ``dot`` executable -...
fd0d690f4cad50b12514f96cacea4d031aa894dc4f98f7aff95bbb33dcaa6f20
Python
15,837
557
# -*- coding: utf-8 -*- """ Created on Sun Mar 2 21:29:32 2025 @author: hanna """ import os import pickle import numpy as np import pandas as pd from tqdm import tqdm import seaborn as sb import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.lines import Line2D # from scipy.optimize import cur...
4014cb69170b366049e7a390e080ec1afcb14907d98f3ef819be651a8fd22577
Python
15,841
363
'''Unit tests for core.py.''' from __future__ import division from datetime import datetime import random import os, os.path import shutil import unittest import numpy as np from .base_test import BaseTestCase from .. import core from .. import datahandler class TestExperimentA(BaseTestCase): '''Test Experime...
ad45c08beec823377f0584a2fef8ff413bb730653986de785e7d2afce0e50273
Python
15,845
488
# 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 random import unittest import pytest import torch from fairseq.modules.multihead_attention import MultiheadAttention, _mask_for_xform...
40b9c62cc642e524f663d99677805c1dca397035615cc09653106cf9e122c7f8
Python
15,867
406
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 imp...
1ebbe9eccbf7d3174e42a86ff42de80a9593891fc30ea5f6ff90507d3d1f2014
Python
15,873
390
# code adapted from # https://nipype.readthedocs.io/en/latest/users/examples/fmri_fsl.html # # This is supposed to simulate a FEAT run, but it doesn't actually use # FEAT, it uses direct calls to all the constituent functions FEAT otherwise # calls. Constructing this requires careful comparison with feat output # logs ...
c909ab036d4fb6e8215d239501682fd77bd6c13eba76026f2e1ffd25bb3cb678
Python
15,877
352
#!/usr/bin/env python3 """A script to generate importance scores in the style of the original BPNet. BNF --- .. highlight:: none .. literalinclude:: ../../doc/bnf/interpretFlat.bnf Parameter Notes --------------- genome, bed-file If you specify these two parameters in the configuration, then this program ...
9d7573c456dc99bec157baf3f8119adb8efb5cf21aa507ee5e2a6233b66bd7b1
Python
15,881
436
import logging import numpy as np import pandas as pd from config_path import * data_path = DATA_PATH processed_path = join(PROSTATE_DATA_PATH, 'processed') # use this one gene_final_no_silent_no_intron = 'P1000_final_analysis_set_cross__no_silent_no_introns_not_from_the_paper.csv' cnv_filename = 'P1000_data_CNA_pa...
f52e1f3342fb80310500e2c656802989b03881ae581a1f2a857f01875cfb2a8c
Python
15,907
429
#!/usr/bin/env python # -*- coding: utf-8 -*- """Counts cells""" import os import traceback from pathlib import Path from datetime import datetime from typing import Literal, Optional import numpy as np import matplotlib.pyplot as plt from matplotlib.figure import Figure from tqdm import tqdm from apply_prev_rdf_mo...
32829dfd1ef8d94e76416373e6c644c36c300e7942dca1d936cb391f67112424
Python
15,908
506
from __future__ import annotations from pathlib import Path import numpy as np import pandas as pd from matplotlib.figure import Figure from .bokeh_html_plots import render_html from .df_common import ( analysis_option_from_frame, read_analysis_output, set_axis_labels, ) # ------------------------------...
0191a84232ad310ec29032931140cd049454bf02a8d45821c7929957a5dea08e
Python
15,921
413
from typing import Tuple, List import string import itertools from Bio import SeqIO import numpy as np import os import random import pickle import pandas as pd class DataReader(object): def __init__(self, theme, data_type="seq", use_cache=0, cache_dir=None, pss_type=3): """ :param theme: "protein"...
caca05af2223d39f1b20b47b764587a6f441dd22a9a8c3a5d6b914757a4d71fa
Python
15,929
395
# # 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 from ...cores.analog_core import AnalogCore from ...backend import ComputeBacke...
b6220dc986682ecff0d89bdeabe488feec2b8ced090ce1a737a388f797fc2689
Python
15,937
375
""" This is a module that contains functions responsible for mutating the trajectory file for alanine scanning in gmx_MMPBSA. It must be included with gmx_MMPBSA to insure proper functioning of alanine scanning. """ # ############################################################################## # ...
fe2b961e31a79c5889c19d500a8e8c85beeba15facd2237779a873aff943f3e4
Python
15,939
404
"""Inference program and ancilliary functions.""" import os import queue import threading from timeit import default_timer as now from medaka.architectures.base_classes import ReadLevelFeaturesModel import medaka.common import medaka.datastore import medaka.features import medaka.models import medaka.torch_ext def r...
5e7c4d7dcbea2228869d92ab6e95344cde0dabf00feef8aa11acecf9fee969c1
Python
15,951
411
import copy from typing import Optional, Any from collections import defaultdict from tqdm import tqdm import torch from torch import nn from torch.utils.data import DataLoader from simulation_encoder.logger import Logger from simulation_encoder.loaders.loader import Loader from simulation_encoder.models.rbm import R...
efcc80a7b00f0e44341742650b379c6df8ead57947aab03a2aa0a5fbf9e4919f
Python
15,959
452
from __future__ import annotations import io import re from dataclasses import dataclass from typing import Any import numpy as np import pandas as pd from skbase.base import BaseObject from skbase.lookup import all_objects from pgmpy.base import ADMG, DAG, MAG, PDAG from pgmpy.causal_discovery import ExpertKnowledg...
abd1c3a86941e37c187d2abb0034b7b9723b8a0523b827fec0cd9cdc64b00c01
Python
15,972
342
#!/usr/bin/env python3 # 13_perstudy_scRNA_validation_py — generated from notebook spec # ============================================================ # # 13 — Per-study scRNA validation (tissue + cell-type aware) # # Re-runs the inverse-concordant + CO7 panel **inside each study's own # proper context**: # # - *...
724424dd53d9f3d76aa695f93ddcf13d4598e21f097925f10ef73935ea82d623
Python
15,981
354
"""Between-participant neural pattern similarity (R4, R4b, R5, R5b). Faithful port of `pattern_similarity/utils.py` and the four `pattern_sim_between_subjects*_loop*.py` entry scripts. Dead variants in the original utils (within-subject, group-level, off-diagonal null, `old_*`) are not carried over — the reported resu...
32221dd0c7336105a3bc02750f5651caf0f0fb41552996ed972c2061333afc0b
Python
15,998
394
# 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. """ BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension """ import logging from t...
fd41216d15c3aeeebd440f1af54a463a73c252ff96f7f307fb6e1568d3cbfeba
Python
16,024
435
import numpy as np import theano import theano.tensor as T def floatX(arr): """Converts data to a numpy array of dtype ``theano.config.floatX``. Parameters ---------- arr : array_like The data to be converted. Returns ------- numpy ndarray The input array in the ``floatX``...
5e2835752b5ceeffad77ebbfe9be86bd4d6395c94172ce31d174352429c3a59b
Python
16,046
487
# 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 typing import List, Tuple import torch import torch.nn.functional as F from torch import Tensor, nn from fairseq.models import FairseqE...
8a60602ea27fe2c4056f80de226b7231640db00a8f6aea17be27d366556b3604
Python
16,078
348
from __future__ import annotations from typing import TYPE_CHECKING import torch from torch import nn from torch.nn.functional import linear, one_hot from scvi import REGISTRY_KEYS from scvi.distributions import ( NegativeBinomial, Normal, Poisson, ZeroInflatedNegativeBinomial, ) from scvi.external.d...
8db55e9557863b6d586e8f7dfa7a5abf989a89e520ca0b61016a48ea91aa16d3
Python
16,090
421
""" Utiltiy functions to manipulate video data. """ import os from pathlib import Path import subprocess from typing import Optional, Dict, Tuple import click import decord import matplotlib.pyplot as plt from matplotlib.widgets import RectangleSelector import numpy as np from tqdm import tqdm from PIL import Image d...
a9411540b57bd6f231153b69322b1f9b699bd3990fde8021570f2aa983af135a
Python
16,092
427
import time import argparse import torch import numpy as np import os from tqdm import tqdm from pathlib import Path from omegaconf import OmegaConf from types import SimpleNamespace from torch_geometric.data import Batch from ..common.eval_utils import load_model, load_control, load_classifier from ..common.model_ut...
fdf00ab726a36abbccb9fc84a03911f31358fd76540ce1ee742f32cece12eaf0
Python
16,093
464
# 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 from typing import Sequence, Tuple, List, Union import pickle import re import shutil import torch from pathlib import Path from .co...
6ed8bb0cd48c83fbbda70fecdd2fb65d2d9a18b4f2a7faa8884abe585a303955
Python
16,096
414
#!/usr/bin/env python3 """ Combined LRS transcript calling comparison figure (5 panels). Row 1 — Venn diagrams comparing Bambu and IsoSeq transcript models by intron chain. A: Novel transcripts B: Known transcripts Row 2 — Multi-omic validation of expressed long-read transcript models. C: SR splice junction supp...
19c31cf0c8c380605d29fe723a19e3d264c80457f05191b647a780898e84da78
Python
16,103
469
import copy import logging import shlex import sys from pathlib import Path from unittest.mock import patch import pytest from gsMap.config import RunAllModeConfig from gsMap.main import main def parse_bash_command(command: str) -> list[str]: """Convert multi-line bash command to argument list for sys.argv""" ...
53ea1d700c1d7c88660c6b34fd73a4227cf2ca9ff111e3f31413aeb088056f8f
Python
16,117
372
import json import os import pandas as pd import gzip from Bio import SeqIO from Bio import pairwise2 from binnd.core.utils.logger import setup_logger logger = setup_logger(__name__) class SequenceFilterStats: """ Class to store statistics about the sequence filtering process. It includes methods to increment va...
9fde8b8d658b9f974b89f3cba87358e7056cc69793f16e4cfd055292ebeb8c7c
Python
16,122
388
import numpy as np import seaborn as sns import matplotlib.pyplot as plt import os from scipy.stats import f_oneway from collections import defaultdict import pickle import pingouin as pg import pandas as pd def get_plot_group_order(n_components): if n_components == 2: plot_group_order = [2, 1] elif n_...
64569cbb9ac8c18a4447a8bb7ccb9bcf69e0c44675b0b1069b3581d34d725e78
Python
16,125
374
from typing import Sequence import torch import torch.nn as nn import copy from ..modules import PCoder class PNetSameHP(nn.Module): r""" Implements the base class for adding Predicitive Coding Dynamics to an existing network with shared hyperparameters for all PCoders. Assume that there are :math:`n` PCod...
d0545ab2717b2cc7f8fa447c221bd5ba4332616c517e0c8e024faeb5ed5964b4
Python
16,126
470
"""This module is adapted from https://github.com/Open-Catalyst-Project/ocp/tree/master/ocpmodels/models """ import torch import torch.nn as nn from torch_scatter import scatter # # from torch_geometric.nn.acts import swish # from torch.nn.functional import silu as swish # from torch_geometric.nn.inits import glorot_o...
1f164a49d91064f552c076a9207482592c36dbc1451450d080ee2668002f1243
Python
16,141
446
from os.path import join import matplotlib import numpy as np import pandas as pd import seaborn as sns from adjustText import adjust_text from matplotlib import pyplot as plt, gridspec from mpl_toolkits.axes_grid1 import make_axes_locatable from upsetplot import from_memberships from upsetplot import plot from confi...
279cbce08b95ec03ff5980c925c9af7b75132fb7d456dfc2120295e828d25d23
Python
16,152
400
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import io import os import random from dataclasses import dataclass from pathlib import Path from zipfile import ZipFile import ase.io import hydra import numpy as np import torch from hydra.utils import instantiate from omegaconf import DictCon...
1ecc28d7b025e1a94146210c10b19c49c9843232f9b9a700913e6edb816bbb09
Python
16,154
501
import numpy as np import pandas as pd import statsmodels.formula.api as smf from .paper_ANOVA import ANOVAModel # Colours and types Types = np.array(["T4", "T5"]) Type_colours = np.array(["#17becf", "#ff7f0e"]) Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"]) Subtype_colours = np.array( ...
9947d4b1ce74a5f653c289f5e61b78f992fc9d28ee090e50b791494eb1e57231
Python
16,154
541
#!/usr/bin/env python """ This is a modified version of the code present in: https://github.com/nanoporetech/pipeline-umi-amplicon/blob/master/lib/umi_amplicon_tools/parse_clusters.py In this version, we check that reads within each input cluster are “similar” by clustering them based on their pairwise edit distances....
6bc977ccf2171acecc3bb3ead493c7445342e9986d3b023b8cd1c3b9cf16148d
Python
16,155
483
import numpy as np # Colours and types Types = np.array(["T4", "T5"]) Type_colours = np.array(["#17becf", "#ff7f0e"]) Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"]) Subtype_colours = np.array( [ "#1f77b4", "#9edae5", "#98df8a", "#bcbd22", "#d6...
6b3a615016b08a0dc11dad4e33c43a73240a20f32ac098533c9b61a822953c41
Python
16,164
499
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os, sys, h5py import numpy as np from copy import deepcopy def make_directory(path, foldername, verbose=1): """make a directory""" if not os.path.isdir(path): os.mkdir(path) p...
a81d73ebd8d7c71d03da87f138b53ad576f993925f41ea37de6e85962a77b2c4
Python
16,171
354
import torch import torch.nn as nn import numpy as np import random import os import copy import pandas as pd from tqdm import tqdm from sklearn.metrics import roc_auc_score from sklearn.model_selection import StratifiedKFold import sys import warnings warnings.filterwarnings('ignore') import yaml import wandb from s...
0acff46ca571dbaa423e95907874753a6c77df6997a5eeeb02c2cc89e25d62b5
Python
16,178
502
"""Plotting functionality based on VTK.""" # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause import os import warnings from collections import defaultdict import numpy as np from numpy.lib.stride_tricks import as_strided from vtk import vtkCommand import vtk.qt as vtk_qt from enigmatoo...
67163b8ed0e884c84d9b780068e8ebfb5050c054e08ced957449bf11eb791798
Python
16,185
370
from itertools import chain, combinations, permutations from sklearn.base import BaseEstimator from pgmpy.base import PDAG from pgmpy.ci_tests import get_ci_test from pgmpy.utils._warnings import _warn_external class ExpertKnowledge(BaseEstimator): """ Class to specify expert knowledge for causal discovery ...
8bb2cf300b9f80ea2ccb7e2709aa69f9c31224ac50c5f88f916e9435348fa4de
Python
16,188
441
import numpy as np from ClusterWrap.decorator import cluster import bigstream.utility as ut from bigstream.align import affine_align from bigstream.transform import apply_transform from scipy.ndimage import zoom import zarr from zarr import blosc from aicsimageio.readers import CziReader from xml.etree import ElementTr...
6b1bdfe61cff898a1e50f6a79477c4238ace4d12eb8621c7c93e2f64b56d7bea
Python
16,189
461
""" Visualization script for Garfield ablation study results. This script generates publication-quality figures showing: - Performance comparison: SVD vs Dropout augmentation - Impact of GNN iteration steps on performance and runtime - Effect of SVD rank (svd_q) on denoising quality - Trade-offs between performance an...
3313f9dd60345ff85c5dec3d345009b46b7f9cc0b9f0343501382c16878c9a99
Python
16,192
504
#!/usr/bin/env python3 import pyro import torch import numpy as np import muon as mu from muon import MuData from sklearn.preprocessing import LabelEncoder from anndata import AnnData from ..models.SOFA import SOFA import pandas as pd import scanpy as sc from typing import Union import numpy as np from sklearn.preproce...
eec1eec2b5140df2dc07f062d8ffd0b75e4f831350457e240f2055f626bbdcc8
Python
16,201
423
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 6 09:54:13 2025 @author: vbp Reward-magnitude analysis for Figure 4. Fig 4A, 4B - example session raster + average traces, per region x reward size (0.3, 1, 2.5, 5, 10 uL) Fig 4C - GRAB-DA amplitude vs. reward size, p...
737aa6958efe5178be3564f722279a7132951cf42063dca3fc07d59a2f9275ad
Python
16,203
296
# 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...
d7fd613b6aa483a82a8ce9adedc8a13f83020a7e90d4d0c47e32ac0c2479a62e
Python
16,204
316
import multiprocessing import queue from torch.multiprocessing import Event, Process, Queue, Manager from time import sleep from typing import Union, List import numpy as np import torch from batchgenerators.dataloading.data_loader import DataLoader from nnunetv2.preprocessing.preprocessors.default_preprocessor impo...
40ae4f3725c1a43a865eaa8855a7337bc7fe6d232d6319b599ccec633bb6ab13
Python
16,212
401
import collections import os import tempfile from datetime import datetime from functools import partial from pathlib import Path import numpy as np import pandas as pd import torch import torch.distributed as torch_dist import torch.nn as nn import torch_geometric.transforms as T import torchmetrics from beartype im...
dfb1e6c4dcb635b04d2fad3cd444a7314f917ac8e8022dcc08764fc6eb8e2c6c
Python
16,214
455
# -*- coding: utf-8 -*- """ @Time:Created on 2019/9/17 8:36 @author: LiFan Chen @Filename: model_v2.py @Software: PyCharm """ import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import math import numpy as np from sklearn.metrics import roc_auc_score, precision_score, recall_...
d092c9f5ada999bca8a87d53e12e2ca7cd43a6d12fc117063ea67d46962fb189
Python
16,222
369
from collections.abc import Callable, Hashable from itertools import combinations import pandas as pd from sklearn.base import clone from pgmpy.base import PDAG from pgmpy.causal_discovery import ExpertKnowledge from pgmpy.causal_discovery._base import BaseCausalDiscovery, _ConstraintMixin from pgmpy.ci_tests import ...
484e9be2b79d42ba2bee20a030ed7a65cffe87417396f17d80579db43cc1316c
Python
16,224
453
import argparse __all__ = ["add_density_args", "add_observable_args", "add_transferable_args"] def _add_only_density_and_observable_and_transferable_args(parser): parser.add_argument( "--ansatz", "-a", choices=[ "psiformer", "psiformer-new", "envnet", ...
efce8e108bd764c59f8ae78a7256fd79a9e2ebb7dcff900d92c1da560dd4e311
Python
16,226
371
#!/usr/bin/env python3 r"""Calculates quantile values for seqlets and called motif instances. This little helper program calculates quantile values for seqlets and called motif instances. For each pattern (patterns in different metaclusters are distinct), it looks at the seqlets and determines where that seqlet's impo...
46aa97aa931827c2b0422e45d7ea338962589120fc96e2beabc393614ccc5e24
Python
16,229
427
import logging import os import warnings from collections.abc import Iterable as IterableClass from collections.abc import Sequence from typing import Literal import numpy as np import scipy.sparse as sp_sparse import torch from lightning.pytorch.strategies import DDPStrategy, Strategy from lightning.pytorch.trainer.c...
de64646bfefe907824286a361a90dcd11e04f7e80b808bb740f870dce3fe1bb6
Python
16,248
460
from __future__ import annotations from typing import List, Optional, Sequence, Tuple, Type, Union import torch import torch.nn as nn import torch.nn.functional as F def _infer_ndim(kernel_sizes: Sequence[Sequence[int]], strides: Sequence[Sequence[int]]) -> int: if kernel_sizes: return len(kernel_sizes[...
27bf26364bc3a7857f5b6fabff11fa8803a5265e6f493fd6f0c6ceed796cfda0
Python
16,269
315
import multiprocessing import queue from torch.multiprocessing import Event, Queue, Manager from time import sleep from typing import Union, List import numpy as np import torch from batchgenerators.dataloading.data_loader import DataLoader from nnunetv2.preprocessing.preprocessors.default_preprocessor import Defaul...
5162b40060185d545c1005a895265b25b8234a8a2488291d70da891a720dd086
Python
16,272
473
"""Summary sheet helpers for telemetry workbook exports.""" from __future__ import annotations from datetime import datetime from pathlib import Path from src.features.telemetry_alignment.exporters.export_frames import ( get_standardized_native_window_bounds, ) def populate_summary_sheet(exporter, writer, sort...
6cc196956f97967e61e604582ad59d0479c22a8cbff9049089c111f025d89006
Python
16,275
408
import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.spatial import distance_matrix from scipy.sparse.csgraph import minimum_spanning_tree from matplotlib.patches import Wedge from collections import defaultdict from matplotlib.image import imread from scipy.spatial import ConvexHull from s...
7a922d4e7e5cf424036e08bd2216c6ce443a9d54f1955176f2da24715a5342fc
Python
16,281
614
# -*- coding: utf-8 -*- """ Created on Mon Feb 10 12:28:19 2025 @author: hanna """ """ Figure 6: relationships between behavior and neural activity """ #%% import os import pickle import numpy as np import pandas as pd from tqdm import tqdm import seaborn as sb import matplotlib as mpl import matplotlib.p...
20347128dd5042597d823ecef18f542dc72f654687cfe150f551c16248e0a6c1
Python
16,295
372
import logging import operator import os import time from functools import partial from typing import Callable, Iterable, Optional, Sequence, Union import jax import jax.numpy as jnp import optax from jax import tree_util from tqdm.auto import tqdm, trange from uncertainties import ufloat from .data import DataLoader...
4b0129968c09bdf0c9c77ff46337a86e365620d21dbd7059037b0cb9c202e67f
Python
16,299
427
# 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 numpy as np import torch from fairseq.data.audio.speech_to_text_dataset import S2TDataConfig class SpeechGenerator(object): def ...
a0cefd0cc497b3f27c49b472318ff8cf9ece88817b0f555782c898e4dfbed8b2
Python
16,314
427
from neuron import h, gui import math import time import random import numpy class cell() : def __init__(self, verbose=True): #random.seed(1) #use the same seed to get same number in every run random.seed(time.time()) cellspec = dict() cellspec["soma_diam"] = 17 c...
e96d3ec10eec3cd9f7136104a393f560bd58223de52e4deef53f41fd912e9440
Python
16,314
378
# This script is used to build the index for similarity search using faiss. It supports loading embeddings and meta labels from directories and add to faiss index. The index is saved to disk for later use. # Options can be set to custom the building process, including: # - embedding_dir: the directory to the embedd...
f683595891a1f2afdfd8e4e66f9a4045465734a36aaa3c9d22f148de1e76f371
Python
16,319
345
import pandas as pd import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm from datetime import datetime import os from scipy.stats import gaussian_kde from sklearn.neighbors import KernelDensity import matplotlib.colors as mcolors from scipy.ndimage import gaussian_filter import matplotlib.pyplot as ...
ec59b810d35117490cafff4486c2790bf6174d11eab194eeaa9cebe99c2b7bf8
Python
16,330
359
"""Shared SegCT/MRI ZIP protocol for the desktop application and Colab.""" from __future__ import annotations import hashlib import json import os import sys import uuid import zipfile from pathlib import Path, PurePosixPath import nibabel as nib import numpy as np BRIDGE_SCHEMA = "segref3d-segct-mri-bridge" LEGAC...
b775b39d7e3f6b43bbf6c58c0c1015e799e50810d2c51d7898e0efe4eb02f1fd
Python
16,332
411
import itertools import math import pathlib import random import warnings from collections.abc import Collection, Iterator from typing import Annotated, Any, Literal import tomlkit import torch from pydantic import ( BaseModel, ConfigDict, Field, NonNegativeFloat, NonNegativeInt, PositiveFloat,...
31faaa07403b16723c0be22394d4054ead31392f42bd7e8bf3a3db90ecec1438
Python
16,337
443
# 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 math from typing import Dict, List, Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F ...
c9ae4db66240a498e005fa2688868e8bfc4d297d89ef6713a56a6d0f9c2dbb73
Python
16,348
420
"""`pool_token_dim`: the memory-lean pooling of the token dimension. `_pool_logits` used to open with `logits.float()` — a float32 copy of the largest tensor in a training step, held by autograd until backward had run. These pin the two things the replacement must get right: it must not save a float32 copy, and it mus...
d7b87d3f8a2eff7663633cf0a55576d46f6d8de637cac7f70aefd8022c61d52d
Python
16,366
251
# Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors import yaml import argparse import json from typing import Dict, List def read_molecules_file(path:str)->List[str]: with open(path, "r") as file: all_lines = file.readlines() molecule_definitions ...