sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
9635bc139048437f374578ef7424e8349c1d5a4ee4375499c62958fca5b9987c
Python
11,418
278
# 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 Optional, Tuple import torch from torch import Tensor from torch.nn.functional import ( linear, softmax, dropout, pad, ...
6d08dde879db4bf6699e4dd893f273c432a459c7eca5c736402b49a9539347ed
Python
11,424
285
from __future__ import annotations import logging import os import warnings from collections.abc import Callable from datetime import datetime from shutil import rmtree from typing import TYPE_CHECKING import pyro import torch from lightning.pytorch.callbacks import Callback, ModelCheckpoint from lightning.pytorch.ca...
ce277356d4ee81c3ff73454584ca82d50ac2bfbaac95ddd647724edd503b59fc
Python
11,425
234
from TrainingAlgos import * from GenerativeModel import * from data_funcs import * import collections class VIMCO(TrainingAlgo): """ Unsupervised training using the VIMCO algorithm to reduce variance in the gradient estimations. """ def __init__(self, init_params, # dictionary of gene...
e6a4f52457220c9b73fb01ae504f66feb29a122425ae29aaddff26232a412a76
Python
11,425
391
import functools import json import logging import os from pathlib import Path import random import subprocess from typing import Dict, List, Optional, Tuple, Union import numpy as np import torch import pandas as pd from anndata import AnnData import scib from matplotlib import pyplot as plt from matplotlib import ax...
1cb2e6266a4028bd69551d8969990aa181d3e65665337397834e2fde92a4caa7
Python
11,432
629
import logging import anndata import numpy as np import pandas as pd import scanpy as sc from anndata import AnnData from ...utils import spatial_neighbors log = logging.getLogger(__name__) def toy_dataset( n_panels: int = 3, n_domains: int = 4, n_slides_per_panel: int = 1, xmax: int = 500, n_v...
21adece197914a37445a4eecaf9c7e278ff6429716c5d6340cd225ce057e62b9
Python
11,432
391
#!/usr/bin/env python """ Setuptools bootstrapping installer. Run this script to install or upgrade setuptools. """ import os import shutil import sys import tempfile import zipfile import optparse import subprocess import platform import textwrap import contextlib import warnings from distutils import log try: ...
a58d40d4989b51ac0ddffd7ce513732df499cf367eb73c13d4841966eaa8e4b3
Python
11,440
329
import os from pathlib import Path import numpy as np import pandas as pd from typing import Dict, Tuple, List from numpy.typing import NDArray from cachecache import Cacher, distributed_cacher __cachedir__ = "~/.bombcell" global_bc_cacher = Cacher(__cachedir__) def path_handler(path: str) -> None: path = Path(...
d6df512bb6fa2e1aaf811f266d310180b7f1c831256695c5c2c99ab5192929d0
Python
11,444
371
"""Utility functions for plotting.""" # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause from itertools import product as iter_prod import collections from collections import namedtuple import numpy as np class PTuple(collections.abc.Sequence): def __init__(self, *args): sel...
22c9f5a990f80fa2603c148ca7c3da8d753e812b4f86596ae8f867cac1ab55df
Python
11,448
318
# 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 copy import math import re import torch from fairseq.data import data_utils from fairseq.data.language_pair_dataset import LanguagePa...
9ca50c2a7ccded890ec2a84f4c3b65992ae9c9cab92d3aec43d01e08be28d5d2
Python
11,451
291
"""Select stimuli from the COCO overlap dataset.""" import copy import io import os import click import networkx as nx import numpy as np import pandas as pd from datasets import Dataset, load_from_disk from loguru import logger from PIL import Image from psmpy import PsmPy from scipy.stats import ttest_ind from com...
2bd3d479162696188a9e62533bac439d2ac075182be4954b2c4a4659cff1a1aa
Python
11,452
299
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for GCPNet-EMA (https://github.com/BioinfoMachineLearning/GCPNet-EMA): # --------------------------------------------------------------------------------------...
488e4166c2005e7f2dfed06395b2587c65610da5586f5e1922419f77527880a5
Python
11,455
296
import os import json import numpy as np import copy import torch import random from tqdm import tqdm from utils import UnionFindSet, get_bfs_sub_graph, get_dfs_sub_graph from torch_geometric.data import Data, Dataset, InMemoryDataset, DataLoader class GNN_DATA: def __init__(self, ppi_path, exclude_protein_path=...
1eb0f9b7f1a6991d8960b98647594a35ebba3c6e509a12359c8fbeafe09f7615
Python
11,464
358
import torch import torch.nn.functional as F import torch.nn as nn from torch.optim import Adam from torch.optim.lr_scheduler import LinearLR import lightning.pytorch as pl from lightning.pytorch.loggers.wandb import WandbLogger from lightning.pytorch.callbacks.lr_monitor import LearningRateMonitor from lightning.pyt...
3dc2efaa654c256fd5c0110c991869b131e4ec44edeb9bff4eb6dd4dbf1b0060
Python
11,465
317
#!/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 raw text with a trained model. Batches data on-the-fly. """ import ast import fileinput import logging...
e857bc4d6d551915a375116208f7f74b286e7fc88d0d54f54b2746b2fb02e1ca
Python
11,467
304
import logging import typing import torch import torch.nn as nn import torch.nn.functional as F from .modeling_utils import ProteinConfig from .modeling_utils import ProteinModel from .modeling_utils import ValuePredictionHead from .modeling_utils import SequenceClassificationHead from .modeling_utils import SequenceT...
817a5e7d0cc287eaea313f0cd993f7884ac7d88733cad43c95fa7f9efdc3e6f6
Python
11,468
408
import math from typing import List, Optional import haiku as hk import jax from einops import rearrange from jax import numpy as jnp from nucleotide_transformer.borzoi.layers import get_positional_embed_borzoi def get_positional_features_exponential( positions: jnp.ndarray, features: int, seq_len: int, min_hal...
c95dfd7610d7eba229090bd605caa3929f33dd0379eb0048b9ff2eb467a1e1a1
Python
11,474
268
"""Phase 8 — bond percolation universality test (C and Si). Repeats phase 5 (C-AIREBO) and phase 6 (Si-Tersoff) with **bond** percolation instead of site percolation, on the same 3 lattices: honeycomb bond p_c = 1 − 2 sin(π/18) ≈ 0.6527036 square bond p_c = 0.5 exact (Kesten 1980) tria...
e157fdb5d36300a8e222c2f3936d4e06b0b8df6261418dd1f0814c56ca5cf946
Python
11,474
321
# analysis script for the results from the BEM simulation with realistic sensor noise #%% Imports import numpy as np import matplotlib.pyplot as plt import mne import functions font = { 'size' : 20} plt.rc('font', **font) #%% Plot parameters legendfontsize = 15 linewidth = 2.5 #%% The parameters used in the simu...
3ed193d5d5d9782b359b7bec41e7569c9b49b576b374d22c9217ca2696829f86
Python
11,480
297
import itertools from pgmpy.factors.discrete import DiscreteFactor from pgmpy.models import DiscreteBayesianNetwork, DynamicBayesianNetwork from pgmpy.utils import compat_fns class ApproxInference: """ Initializes the Approximate Inference class. Parameters ---------- model: Instance of pgmpy.mo...
aa8f67e0104ce4e55f3b42a13211fc3745465420ec8c2d5add308ddd7fa8b342
Python
11,485
378
def set_defaults_explain(args): if args.project == "stad_pglcn": # set seed args.seed = 666666 # dataset & method args.dataset = args.project.split("_")[0] args.method = args.project.split("_")[1] # io utils args.ckptdir = "log/" + args.dataset + "_explain...
569907c5af8b5460787d62c55b44d86315e715fec847e41335eb554c973f887e
Python
11,491
322
import math from functools import partial import haiku as hk import jax import jax.numpy as jnp import optax from .device_utils import DEVICE_AXIS, rng_iterator_on_devices, split_rng_key_on_devices from .types import ModelDimensions, MolecularConfiguration, RandomKey, ScfParams from .wf.base import init_wf_params fro...
bba7318bddf7b9207a98c42ca5f0a0e86f010e1bde85422e29d4376def7af889
Python
11,491
224
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...
413267ffb764e70d6a91af15d1d05980e04616d6bf12425abab72f0618d9e6e9
Python
11,494
216
# -*- coding: utf-8 -*- import pandas as pd import numpy as np from datetime import datetime import pickle import os import multiprocessing from tqdm import tqdm from sklearn.svm import SVC from sklearn.linear_model import SGDClassifier from sklearn.model_selection import cross_val_predict, KFold from skmultilearn.pro...
94e6bdc088cfc89048d4b8b124f98cecb5960c31c769e84f8ec2f496522e0fa7
Python
11,498
308
"""The compile A/B is only worth reading if its two arms really are two arms. Wall-clock timing is the easiest measurement to get confidently wrong: nothing crashes when a second variable drifts between the arms, when every epoch's timing is flattened onto the last one, when the arm that died is quietly dropped and th...
5b57c9cfe69d0793770755d129d0f215e3df2399aee1f87a620284f3dd70026b
Python
11,500
196
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'MainWindow.ui' # # Created by: PyQt5 UI code generator 5.10.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MapsVisualizer(object): def setupUi(self, MapsVisualizer): ...
e150d243a31dd2979d7fa43f939f7c90caf76e567865d5253e11e106c4a62907
Python
11,503
313
import os import h5py import numpy as np import surfa as sf import tensorflow as tf import voxelmorph as vxm # set model dir import synthmorph_models models_home = synthmorph_models.models_dir # Settings. weights = { 'joint': ('synthmorph.affine.2.h5', 'synthmorph.deform.3.h5',), 'deform': ('synthmorph.deform...
0c121c6896dd5fa9eedd1e9301a071a039ea18571f4a8c3f3b96c8aeb2102ac0
Python
11,508
277
import joblib import numpy as np from pathlib import Path from sklearn.random_projection import SparseRandomProjection from sklearn.metrics.pairwise import cosine_similarity, cosine_distances import pandas as pd import warnings from sklearn.decomposition import PCA from numpy.testing import assert_allclose ### This sc...
d53efd0430b73a8af5b771a180724d8909df1c905c7d512b25aee76fa50d155c
Python
11,508
333
# Copyright 2015 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...
4ed132872b888dbb6a2ceaaf92f61761aaf1b7d9f112e49f373d3fb506473a86
Python
11,510
315
# 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 copy import logging from fairseq.models import ( FairseqEncoderModel, FairseqLanguageModel, register_model, register_m...
ab6e7ac3e9dd11b44d52bce28c49bab97c0e15068219875da1ebb15d8aefd1eb
Python
11,511
310
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from pathlib import Path from typing import Dict, Tuple, Callable from einops import rearrange from torch.utils.data import DataLoader import pytorch_lightning as L from datasets import load_dataset, load_from_disk, DatasetDict from k...
507f95682fd74d37f32a2d627ca76ca835994e22a0823764d08d33fe72e153cf
Python
11,523
297
#!/usr/bin/env python3 """ Fix Benchmark Figure - Adjust radar plot and spacing """ import numpy as np import pandas as pd import networkx as nx import matplotlib.pyplot as plt import matplotlib.patches as mpatches from matplotlib.gridspec import GridSpec from sklearn.metrics import silhouette_score, roc_auc_score, av...
6442c32584c2cfce338955b3b9295a3c6dbbdcba623bcbe7261ff5da55b1562b
Python
11,526
282
""" Sophisticated label update with territory expansion, morphological cleanup, attribution-aware filtering, and hole filling. When ``attributions`` is None (default), the attribution filtering step is skipped and the function behaves as a prediction-only updater -- backward compatible with the previous simple v...
6aeb311e2893f0fa6f95678a6c4df341ffa56b887a2263aa2a96c6831623f8a1
Python
11,530
281
# # 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 sys import numpy as np sys.path.append("..") from simulator import CrossSimParameters def ...
0a2e420febd88fb4978a7f06e2b7559bf1cc55c8f8b7cd3a8c4dcd57aa7d47c1
Python
11,538
282
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from typing import Callable import torch import torch.nn as nn from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.data.types import PropertySourceId from mattergen.common.utils.globals import MAX_ATOMIC_NUM, SELECTED_AT...
733986c3339aa9d54c074ca5a9043765fe35dadb78fb22548565169a4bc1d9ba
Python
11,543
273
from mot.lib.cl_function import SimpleCLFunctionParameter from .parameter_functions.numdiff_info import SimpleNumDiffInfo from .parameter_functions.priors import UniformWithinBoundsPrior from .parameter_functions.transformations import IdentityTransform import numpy as np __author__ = 'Robbert Harms' __date__ = "2016-...
e5cb60e77e3ceb9ae5a58d8a1f63c000abd1048aa66c250cd5424840ecabb14b
Python
11,543
325
from abc import abstractmethod from typing import List, Tuple, Union import torch from torch import nn, autocast from dynamic_network_architectures.architectures.primus import Primus from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer from nnunetv2.training.nnUNetTrainer.variants.lr_schedule.nnUNetT...
0d91531891e82cac5f6a1c4ed64c1fa353ab1d3deab42ba5bcafd0cea7d04e64
Python
11,549
324
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...
7cde3d56b88f8288b096a9a8e2d170fd3639f519a05ec4378babf5e868f66de2
Python
11,550
371
# _ _ # | | | | # ___ __ _ __ _ ___| |_ ___ ___ | |___ # / __/ _` |/ _` / __| __/ _ \ / _ \| / __| # | (_| (_| | (_| \__ \ || (_) | (_) | \__ \ # \___\__,_|\__,_|___/\__\___/ \___/|_|___/ ''' A Convergent Amino Acid Substitution identif...
e96d5258f4f1d427e5035502e80bfe31224cc833e858988af775210bd05f5933
Python
11,560
319
""" This module contains generic base model functionalities, added as a Mixin to the NicheCompass model. """ import inspect import os from copy import deepcopy import warnings from typing import Optional import numpy as np # import pickle import scipy.sparse as sp import torch from anndata import AnnData from .util...
fae72596953189da0d80a650359463b203bd01105fe97c99c43d2fe39d6e987c
Python
11,560
306
#!/usr/bin/env python import argparse import itertools import logging import pathlib from d3text import ( checkpoint, data, encodings_store, factory, linking_corpora, runtime, token_labels, tracking, ) from d3text.cli.args import non_negative_limit from d3text.datasets.brenda import BR...
4272a6cd5e63cd015fcabade62be1dbee2fbb09554aa87d2fe13d9c7361dcd7c
Python
11,563
199
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...
207d680581d174f13e1cce02b18cf7001394292d7ec30562fdddaa799bbb95fb
Python
11,565
347
import argparse from datetime import datetime from pathlib import Path import h5py import nibabel.freesurfer.mghformat as mgh import numpy as np import scipy.io from scipy.optimize import linear_sum_assignment from sklearn.mixture import GaussianMixture from spacestream.core.paths import DATA_PATH, RESULTS_PATH from ...
23719537f613d180833d1ddd558d85406af8649dc048fe25095e9ac51bcf411a
Python
11,570
291
#!/usr/bin/env python3 import argparse import shutil import os import sys import numpy as np import pandas as pd from tqdm import tqdm from sklearn.metrics import roc_auc_score, f1_score import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader,...
a4875c06784aa5a91ba6346314a39fcbcb1df6cb01e50b88252990cc300090f1
Python
11,578
220
#!/usr/bin/env python3 """run_pseudobulk_reanalysis.py — donor-level pseudobulk MS-vs-HC for Tier 1 candidates. Addresses verdict critical issue #1: cell-level Wilcoxon FDR magnitudes (10⁻¹⁵⁶) inflated by pseudo-replication. This script: 1. Aggregates per-cell log-normalised expression to DONOR-level means per...
0bcf895422605eb2782cb7c645bb798f5d35d5751e9698021be76850d4612aa5
Python
11,585
330
# %% import os import pickle import torch import numpy as np from config import CONFIG from model_config import MODEL_CONFIG import torchvision.transforms as T from torch.utils.data import Dataset TARGET_SF = 256 # make sz_table sz_table = CONFIG.sz_times.copy() sz_table.index = sz_table.index.map(CONFIG.hup_to_ri...
4093fd8dddc3cfd6fe33655e6e2c99c06f29cadb1104c92f74b110ed9dc70fc9
Python
11,585
269
import torch import torch.nn as nn class Predictor(nn.Module): r""" Implements a predictor module. Predictors generate predictions via the given `pmodule` from input representations. A Predictor contains three main attributes: * :attr:`pmodule` is a callable module inherited from `torch.nn.Module` wit...
0b1b6f4e6e54b4233ce2d0127ffa110bd4aa5f2c6f907e03e85e9eeeb2bca07d
Python
11,587
378
import torch import torch.nn.functional as F from math import pi as PI # import geomstats.backend as gs # from geomstats.geometry.hypersphere import Hypersphere, HypersphereMetric # from geomstats.geometry.product_manifold import ProductManifold, ProductRiemannianMetric class BaseManifold: def __init__(self): ...
10bd5c9b4a0d829b3494dde403008978fc4ba2c0c400faa7c541c41a1870b972
Python
11,591
282
__author__ = 'heroico' import weakref from Tkinter import * from ttk import * from Utilities import TS RHW = 70 LHW = 20 class MainScreenView(Frame): def __init__(self, root, controller): Frame.__init__(self, root) self.pack(fill=BOTH, expand=1) self.controller = weakref.ref(controller) ...
a1d90a7bb53190a2f6876668f071a69bde534a8160aea4c29330d84c44088b11
Python
11,593
319
from __future__ import annotations import itertools import json import logging from importlib import metadata from pathlib import Path from typing import TYPE_CHECKING from packaging.utils import canonicalize_name from poetry.core.packages.package import Package from poetry.core.packages.utils.utils import is_python...
ef9e4c6f888cbc29a3ad12967365f7b79065e40d901eabeeb1ada449463e50a9
Python
11,598
212
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from os.path import join from importlib.resources import files, as_file from tqdm import tqdm from tractseg.libs import img_utils def reorient_to_std_space(input_file, bvals, bvecs, brain_mask, ou...
1ad9e5c413aa71548c3f13e7ad83f2b58adc97d05ed5f64b3ae70251ec1eede1
Python
11,600
243
import torch import os import toml import warnings def imports_str(is_3d=False, p_imports=None, same_hp=False, gscale=False, indent=""): if gscale: imports = indent + "from predify.modules import PCoderN" + os.linesep else: imports = indent + "from predify.modules import PCoder" + os.linesep ...
0200ee9bd96b5da3789f0efe3b17530a4300cbb6b253c478ac3cec8a997a2b82
Python
11,601
246
#!/usr/bin/env python3 """ ═══════════════════════════════════════════════════════════════════════════════ EIF2S1 R3 REVISION — PIPELINE 1: TCF25 + ASC-1 COMPLEX EXTENSION ═══════════════════════════════════════════════════════════════════════════════ Author: Drake H. Harbert (D.H.H.) | ORCID: 0009-0007-7740-3616 Affi...
f1db06d7d89026bd88711d2e8304d83c2d1d790e7312a72255ad08492a299179
Python
11,603
308
# # 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 .wrapper_core import WrapperCore from simulator.parameters.core_parameters...
09510d8f8e9c8e96aa4724f6e3fd2ebf7929d67bf3f9dc9f4ce96bae7a877289
Python
11,613
293
"""Plot a GODagSmall.""" __copyright__ = "Copyright (C) 2016-2018, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" import sys import os import collections as cx from collections import OrderedDict from goatools.godag_obosm import OboToGoDagSmall def plot_gos(fout_png, goids, obo_dag, *a...
57a7fe6647eb5dd60a66816177d174373b7a90b5724c0499dd98b5787a3c9460
Python
11,619
284
import unittest import os import subprocess import tempfile import medaka.common import medaka.tandem.tandem import medaka.medaka import pysam import gzip def decompress_gz_file(input_path, output_path): """ Decompress a gzipped file to a specified output file using the gzip command. Args: input_p...
af339ec4896fb3efb75f0e9b8bc5336307537e6bac667356444d653990e08528
Python
11,622
428
# _ _ # | | | | # ___ __ _ __ _ ___| |_ ___ ___ | |___ # / __/ _` |/ _` / __| __/ _ \ / _ \| / __| # | (_| (_| | (_| \__ \ || (_) | (_) | \__ \ # \___\__,_|\__,_|___/\__\___/ \___/|_|___/ ''' A Convergent Amino Acid Substitution identif...
1b37543fb33292a40456bb70f9862f73f2e5fc7d23b361b0b12cfb9f4fa4b599
Python
11,629
370
#!/usr/bin/env python3 """ Simulate tree sequences and parameters for posterior analysis. This script simulates data using msprime directly (without popgen-npe simulator classes) and outputs: 1. A tree sequence file (.trees) 2. A parameters file (.yaml) compatible with plot-variable-popsize-posterior.py Available mod...
8b9ccbbe8548e55b7d2f1ede87f99a92f952a0aa7775292e0a608b1133d797ae
Python
11,633
319
#!/usr/bin/env python # @license # Copyright 2018 Google Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
51e8602a58e7c52c27a8f8cbe59e53d3d361f23ab68c58c904d1be3cee7318c6
Python
11,643
303
""" Usage: python /path/to/genome_gibson_assembly.py Requirements: - Input CSV with a column 'sequence' containing genome sequences to be split into Gibson assembly fragments - Path to save an updated CSV with Gibson assembly data """ from Bio.Seq import Seq from Bio.SeqUtils import MeltingTemp as mt from typing imp...
8f0301125bfd6bd0d0b2e0bfcbc8ec2b2b5d98d7f5389fbed130357c575b9f5e
Python
11,644
291
import unittest import numpy as np import pandas as pd from pgmpy.estimators import K2, ExpertKnowledge, HillClimbSearch from pgmpy.models import DiscreteBayesianNetwork class TestHillClimbEstimatorDiscrete(unittest.TestCase): def setUp(self): self.rand_data = pd.DataFrame( np.random.randint...
9ad246a98ce3078e6392bdcb58d154c1ba7d8ec9e5b948b1281de13a3558b6c2
Python
11,645
281
import os import shutil from PIL import Image import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Button import matplotlib.gridspec as gridspec from ..utils.decorators import error_handler @error_handler(cluster=False) def process_images_and_masks(DIR: str, N_classes: int, debug: bool=Fal...
054372f27b6aea4750c71958573c4d377c181aba3667cbf6b317284b53dd700f
Python
11,650
314
# Copyright (c) 2025, Shenghao Cao & Ye Yuan. Shanghai Jiao Tong University, Shanghai 200240, China # The classes and functions are modified from scGPT (https://github.com/bowang-lab/scGPT), copyright (c) 2022 suber import sys import os os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True' from typing imp...
2e9b6d892f237bc137d2db74f2ca25caa4f1887e09d02ebb6cc0ef75ee1f99dc
Python
11,650
228
"""tests for vak.config.eval module""" import pytest import vak.config class TestEval: @pytest.mark.parametrize( 'config_dict', [ { 'checkpoint_path': '~/Documents/repos/coding/birdsong/TweetyNet/results/BFSongRepository/gy6or6/results_200620_165308/Tw...
cae8fcb3de5f80dc083ee307a608cd3410460f0cf9fc9f877faf15dcc87e9e47
Python
11,652
361
""" Utility functions for distillation training """ import inspect import math from pathlib import Path from typing import Dict, Callable, Optional, Tuple, List import torch import torch.nn as nn from nnunetv2.utilities.plans_handling.plans_handler import PlansManager from nnunetv2.utilities.get_network_from_plans im...
4f4581b8fad7d8fe6d94b6d15c86ccd0ded85c9a05a87c77204c99b03c4a21f4
Python
11,654
365
"""A dataset class used to train Parametric UMAP models.""" from __future__ import annotations import pathlib import warnings import numpy as np import numpy.typing as npt import pandas as pd import scipy.sparse._coo import torchvision.transforms from pynndescent import NNDescent from sklearn.utils import check_rand...
4d00d4371eddedec12eeeea09aec8830ff58689c33a4a2d5875ca5d8249bd950
Python
11,657
341
#!/usr/bin/env python # Author_and_contribution: Niklas Mueller-Boetticher; created template # Author_and_contribution: Florian Heyl (heylf); created code import argparse import os import json ###### Template arguments ################################################## parser = argparse.ArgumentParser(description="c...
e5eef0e7b38fd57c0636a010aef17b1e314e54a963dd31de418c70179e3df208
Python
11,657
383
# 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...
13abf770279059bce3c83fb7c4f27606f8e355672c73163cd995d65c6fe40422
Python
11,667
267
# (C) Copyright 2015 Frankfurt Institute for Advanced Studies # (C) Copyright 2016 Max-Planck Institute for Brain Research # # Author: Philipp Huelsdunk <huelsdunk@fias.uni-frankfurt.de> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following con...
655929240716ff2ba910178a6b7e54e06a3210eb26515893fd95de1f8f1fa06c
Python
11,672
256
"""Controller for telemetry cluster compute orchestration.""" from __future__ import annotations import logging import re logger = logging.getLogger(__name__) from src.processing.cluster_detection import ( find_longest_cluster_times, group_clusters_by_time_period, select_peak_clusters, ) from src.process...
a07c7dd05a82bd77b70e778bdd56dbd63ec531704e93a56181c41b97f7d06ec1
Python
11,673
288
from pathlib import Path from typing import Dict, Set, Tuple import pandas as pd from BLEval.evaluator import Evaluator from BLEval.data import EvaluationData def _load_signed_ground_truth( gt_path: Path, ) -> Tuple[Set[Tuple[str, str]], Set[Tuple[str, str]]]: """ Load a ground truth network and split e...
1773472c654d29a8b69fa9c89aa1eb44909310d1a9f1eb1abdb6e8c2734f6c64
Python
11,674
268
import matplotlib.pyplot as plt import glob, os from pathlib import Path import pathlib import numpy as np from matplotlib.lines import Line2D import matplotlib.patches as mpatches # from scipy.interpolate import make_interp_spline, BSpline import matplotlib.lines as mlines import pandas as pd import scipy as sp import...
7583f426d49885c4b702964f35fc11500f7bcc595b968922c1760078f18c86c5
Python
11,678
347
import argparse import os import random from concurrent.futures import ProcessPoolExecutor from copy import deepcopy import h5py import numpy as np import torch import torch.nn as nn import torch.optim as optim from sklearn.model_selection import KFold from torch.utils.data import DataLoader, Dataset from torchdiffeq ...
9d8272815206c1c0e14f6bb1664cb4f2af4cb99aadaf68b06ddcf08b77805be5
Python
11,684
308
"""Numerical-vs-analytic gradient tests for :mod:`oce.forces`. These tests fix the *interface* and the success criterion before the actual derivatives are implemented. In v0.1.0 the analytic gradient routines return zero (mock); the cross-checks against central differences are therefore expected to fail and are decor...
0cc3df962e89c65c4a400f901842994a29835d98a8cc2c17ab0c0a0c5a66bbdf
Python
11,687
321
import boto3 import ujson as json from tqdm import tqdm from concurrent.futures import ThreadPoolExecutor from tempfile import NamedTemporaryFile, TemporaryDirectory from pybloof import StringBloomFilter from collections import defaultdict import random import os import re from boto3.s3.transfer import TransferConfig i...
b151204bffb62b0c4b6a94c7a54172e34306a3efeca65f5862ae78fa6729abfd
Python
11,689
294
# utils/syllable_utils.py import numpy as np import os from matplotlib.patches import Rectangle def add_new_segment(event, app_state): """Add a new segment based on user input from a mouse event.""" from moove.utils.plot_utils import update_ax2_ax3 from moove.utils import save_notmat displ...
28c44db28b6098bbf653db6c5e9799424ebd0820a8266efb2be733ee41089263
Python
11,691
205
##主要功能:对esd处理过的图像序列进行后处理,计算一个(后续开发多个)ROI内的像素平均值; ## 对相同条件实验条件不同实验对象的数据叠加平均 ##20211009,增加对多个roi处理的功能 ##20240122 修改了处理顺序(先组间平均再时间窗平均)改变后的代码逻辑,只限于电刺激 from PyQt5.QtWidgets import * import os from PyQt5.QtGui import * from PyQt5.QtCore import * import sys import cv2 as cv import numpy as np class Dat...
7ba05cc2d7a966d5102ad66fe1efd61dff0a3bd52dcb9a9e1cb073f14157d816
Python
11,696
296
# 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...
360757eaeff6ba1e1c831c93fcd9ae246e3d035f9b2360c7e024a8e5a0f644d7
Python
11,699
261
"""Controller for telemetry peak/cluster label settings popup.""" from __future__ import annotations from PySide6.QtWidgets import ( QColorDialog, QComboBox, QDialog, QFrame, QGridLayout, QLabel, QPushButton, QWidget, ) from src.gui.framework.tk_compat_controls import LineEditControl,...
a52d4420aafb61ef760d38e50261dbb08173351e77332ceb9e1d626e576d9b9d
Python
11,703
272
"""Reads an NCBI Gene tsv file.""" from __future__ import print_function import sys import re from collections import namedtuple from collections import OrderedDict __copyright__ = "Copyright (C) 2016-present, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" #pylint: disable=line-too-l...
6267dff936a08299900b0120e2373ff75a4bc1458471ecdfae51d4e94671b74b
Python
11,704
283
from datetime import datetime import argparse import getpass import glob import itertools import ntpath import numpy as np import os import os.path import pandas as pd import random import scipy import scipy.io as sio import scipy.linalg import shutil import six import socket import subprocess import sys import sys, tr...
ff2dd93ce11ca21f9b309c8df1b2fa75b289f581c4a9f18a73f502ff4b37c2a3
Python
11,711
398
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...
481b94a96edd0354b0d84d7769de26adbb495a090ef2a9883efb85fa58ab7285
Python
11,715
228
import csv import json import unittest from pathlib import Path from tempfile import TemporaryDirectory from types import SimpleNamespace from unittest.mock import patch from GMXMMPBSA.exceptions import PrmtopError from GMXMMPBSA.parm_setup import MMPBSA_System, Residue from GMXMMPBSA.radii import (_log_advisories, _r...
5bfa092ce3a87f9474216ee8e2a0964d46b1ea8a7ecd87c4efc6e22d16ecfe7c
Python
11,715
325
import mdtraj as md import numpy as np import os import sys import re from pathlib import Path HERE = Path(__file__).resolve() EXAMPLES_DIR = HERE.parent.parent SOURCE_DIR = EXAMPLES_DIR.parent file_path = SOURCE_DIR / "data/1e8l.mr" def find_missing_atoms(traj, noe_restraints): """ Given an mdtraj.Trajectory...
8a82153ba8d8d5d8e01855e1d8a1f772ed8145e9f347a78085ca3f4495e61dcb
Python
11,718
370
# 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. """ Utilities for working with the local dataset cache. This file is adapted from `AllenNLP <https://github.com/allenai/allennlp>`_. and `hugg...
885c6e97f2dc6943bff9b79e612d099505b314d7a6550a1896f4d85781adf948
Python
11,720
271
# 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...
8b3b85cf7b6f98047b7770336878e9d3a468af3523c47811ca835fe253bd13e0
Python
11,722
398
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...
91b1da3ecbfaaa937095758a89f33bb63d628eae6acb2f71722bc6507e5b0143
Python
11,724
257
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)) ...
f03638077b8c3a3a19cd0a067e6a98f5168961b463732e4669ee8530e9d8d013
Python
11,740
206
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'UI/MainWindow.ui' # # Created by: PyQt5 UI code generator 5.15.9 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore...
bfd6f17c8833ec0c4e21cf22d2d2cb46ade0c1f96194bf4aac089bc918b2753f
Python
11,743
334
""" 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...
9f6888ea76a906cd8bed9132d1d0861338059d7deb0cfd308651abeeb968df50
Python
11,747
326
#!/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. import argparse import copy import logging import os from typing import Any, Dict, Iterator, List import torch from...
469ddeb3e51709dc2820c237703a4ea1f3887c824ff5c004dfec19648cb4a61a
Python
11,754
400
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...
c1cc122dbc5915a47cf2b148cf0be886d77547a6b24d611ae1c91d2e979a805f
Python
11,759
399
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...
05d6c6dcc975c9fa8ca51fabada00c8199b48eb03a997fd5bcb73218aa43205b
Python
11,760
402
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...
010f6a09a53624439309a87d6498946c4e033ffd2453cf8047f60756d5ccfa41
Python
11,769
351
import math from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, Iterator, List, Tuple import matplotlib.pyplot as plt import pandas as pd import seaborn as sns def get_algo_ids(config: dict) -> List[str]: """ Return the list of enabled algorithm IDs from the config. Para...
0722b581d1467f5e49475ee480ee3dedddc573959f068b5e4594c66cdced23f8
Python
11,779
328
# Copyright (c) 2025, Shenghao Cao & Ye Yuan. Shanghai Jiao Tong University, Shanghai 200240, China # The classes and functions are modified from scGPT (https://github.com/bowang-lab/scGPT), copyright (c) 2022 suber import sys import os os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True' from typing imp...
c5c46b01f9b38fb503443394751167ce79ca46b58291b3de9cba90669dcd42e7
Python
11,779
309
import os import csv import copy import json import logging from dataclasses import dataclass, field from typing import Any, Optional, Dict, Sequence, Tuple, List, Union import torch import transformers import sklearn import numpy as np from torch.utils.data import Dataset from peft import ( LoraConfig, get_p...
48102f5da72ea82a0076a7e08e284d2b6204b9d5a476ecd7776a8a8fb3914fa3
Python
11,781
325
import glob import gzip import os import copy import nibabel as nib import numpy as np import shutil from mdt.lib.deferred_mappings import DeferredActionDict __author__ = 'Robbert Harms' __date__ = "2014-08-28" __license__ = "LGPL v3" __maintainer__ = "Robbert Harms" __email__ = "robbert@xkls.nl" def load_nifti(nif...
abd938a1d998bd19fb73660fc86e8f01d74272d7dc60f2387810a304351a121b
Python
11,792
261
from pathlib import Path from types import SimpleNamespace import json import sys import unittest import nibabel as nib import numpy as np MODULE_DIR = Path(__file__).resolve().parents[1] if str(MODULE_DIR) not in sys.path: sys.path.insert(0, str(MODULE_DIR)) from volume_geometry import ( # noqa: E402 Volu...
ff6095804943b8a3fd6c1bb9520f5d2b5f46e9d0673fabcd9fe30ff40d99aa62
Python
11,794
287
"""Coordinate-mirror axis equivalence test. Does reflecting a structure along the **Y** or **Z** axis — instead of the **X** axis used by the production pipeline — change the results? This script provides the *empirical* answer that complements the group-theoretic argument in the manuscript: * reflecting along any si...
c4336a3b379446453a524f78ec7684f0f16c5dec0cfb4a62bf60f1529fad39ae
Python
11,797
304
# utils/file_utils.py import evfuncs import os import re import pickle from scipy.io import wavfile as wav from scipy.signal import spectrogram from moove.qt_helpers import invoke_in_main_thread, show_info from moove.utils.audio_utils import decibel def get_directories(path): """Return a list of directories in t...