sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
4e2fea7bcc3b5f18f20ad8de70ad25e72c97f6bc1f5542b57eec8831fd4c8994
Python
6,755
284
"""This tests the CLI functionality of training and predicting a regression model on a single molecule. """ import pytest from chemprop.cli.main import main from chemprop.models.model import MPNN pytestmark = pytest.mark.CLI @pytest.fixture def data_path(data_dir): return str(data_dir / "classification" / "mol...
e171c3426d01749a105410bf6bdd064eb5f42e25d9cd66b7319b3a18d3a8eab6
Python
6,757
177
#!/usr/bin/env python3 """Rebuild aggregate dashboard PNG + per-panel PDFs from a saved ``ALL_FOLDERS_MASTER_RESULTS*.csv``. Does not re-read CZI files. Panel 6 (Friedman / zone densities) needs per-image columns ``File``, ``Density_early_NMJ_like``, ``Density_Muscle_associated``, ``Density_Neuron_associated``, ``Dens...
4e4f8e84286e9b5ab36755b92b388120ec3df09388661396febd0625b4ddcfb6
Python
6,762
235
from config import ALGORITHMS, COUNTRIES from data import load_modeling_data from evaluation import ( heldout_bootstrap_summary, metric_row, permutation_importance_rows, positive_scores, ) from results import make_result_tables from selection import select_model_by_cv_auprc, select_model_by_optimism_cor...
a9d4d0aa5856efe2279d4dff4e9be91bf2bda4fb9da0e74eba81942b42299ba8
Python
6,765
140
import logging from typing import List, Optional logger = logging.getLogger('IsoQuant') class FusionMetadata: def __init__(self, detector) -> None: self.detector = detector def process_all(self, min_support: int = 1) -> None: """Iterate over fusion candidates and apply gating, gene assignmen...
637b85cd0cd47b43a08717b5edd6a7e64c5157d47495033d5f410d518a15ad1d
Python
6,767
167
############################################################################ # Copyright (c) 2025-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ import pytest from isoquant_lib.barcode_calling.umi_filtering ...
d269508b5aea98075fa8cf0b261449af0319817f8201812a92b88a413c0ab31d
Python
6,769
173
from __future__ import annotations from dataclasses import dataclass, field from typing import Any from rdkit import Chem from src.protonation.base import ProtonationError @dataclass(slots=True) class DimorphiteProtonator: """Protonation backend using Dimorphite-DL. Dimorphite-DL applies SMARTS-based pKa ...
8729c3c5688f9769f31236541d3c96717cf51b3e1d08ceb831d291aee4ce5961
Python
6,770
181
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
cff9fcaa1a846f5786e38d3f2cc0db93c73aa2ad6ba6f865d4833130bcbc3fcf
Python
6,771
160
# Copyright (c) Facebook, Inc. and its affiliates. import numpy as np import unittest from copy import deepcopy from typing import Dict import torch from detectron2.config import CfgNode as CfgNode_ from detectron2.config import instantiate from detectron2.structures import Boxes, Instances from detectron2.tracking.ba...
e7c78c7e5e80ec9b92863f53d47cced50826f8278968c3e94a8a3f3a59668c36
Python
6,771
212
""" Created on Tue Aug 27 16:25:15 2024 @author: dcupolillo """ from PyQt5.QtWidgets import QPushButton from PyQt5.QtCore import Qt, pyqtSignal from PyQt5.QtWidgets import ( QMainWindow, QGridLayout, QFrame, QLabel) class CustomToggleButton(QPushButton): def __init__( self, text:...
4b3ae8e4d4d03c46a2dab8355ca68779dad0574ad97ce3d4906405313552890d
Python
6,783
236
from functools import partial import composer.utils.dist as comp_dist from omegaconf import DictConfig import os import pandas as pd import torch from torch.utils.data import Dataset, DataLoader from transformers import PreTrainedTokenizer, AutoTokenizer, BatchEncoding from typing import Optional, Dict def build_toke...
04e73a75c6e05e1c0d847c072d84f6e1b653e820603f2ba8fe1ac597f2db3e37
Python
6,789
155
import os import glob import random from itertools import product from .AttackCNN.utils.condition import Condition def init_conditions(user, config_cond): # make conditions from yaml config user.list_conditions_name, user.list_convergence = make_conditions_from_lists(config_cond) random.shuffle(user.lis...
153f3550c1cae8cd8580d8b847173e7964d39d13159e56739065685a0415ea24
Python
6,790
152
#!/usr/bin/env python # Copyright 2016-2024 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
6aa44f5dd55e07701f8258c35b0a1ca87c01f84a81a643fefe20399c356701d3
Python
6,792
211
from functools import partial import logging import multiprocessing as mp import os import pandas as pd import re from tqdm import tqdm from typing import Optional logger = logging.getLogger("no_interpolation_ds") def filter_seqs( recs: pd.DataFrame, min_len: Optional[float] = 0.5, max_len: Optional[flo...
46669a427ffdc5a84219423130059e02b9bb71c47b9ef11b5c61bb754e32bf4e
Python
6,794
171
#>python compareDDAnDIA.py intensity_IBAQ "Z:\Download\nDDA\nDDA_quantified_protein_fdr.tsv" "Z:\Download\nDDA\nDIA_quantified_protein_fdr.tsv" import os import sys import pandas as pd import numpy as np import matplotlib.pyplot as plt intensity_col = 'intensity_IBAQ' dda_path = r'L:\promec\TIMSTOF\LARS\2026\260518_So...
365e15525ef4ce8e68ddc53384203af417c49ac82d6337dcecef7be3d4079b74
Python
6,800
178
import torch import torch.nn as nn import numpy as np import modules from util import aa_sequences_to_padded_onehot, pad_feature_matrices device = torch.device("cuda" if torch.cuda.is_available() else "cpu") class BaselineRINAMI(nn.Module): def __init__( self, device=device, dropout=0...
96f04a332ba8b7996482de54f340b98e9a5c91654e80be65e719f29aa36d5bdf
Python
6,801
174
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import random from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple import torch from torch import nn SampledData = Any ModelOutput = Any def _grouper(iterable: Iterable[Any], n: int, fillvalue=None) -> Iterator[Tuple[Any]...
2cafd2e0242414d57c260428ab4ede2c5f1bb4ae2b1ad78700e313c3f4e46a61
Python
6,802
210
"""Exceptions for the scenarios module.""" from __future__ import annotations from dataclasses import dataclass from enum import Enum from typing import TYPE_CHECKING, Any from mesa.exceptions import MesaException if TYPE_CHECKING: from mesa.experimental.scenarios.scenario import Scenario from mesa.experime...
5c58db5b72d99090be38f21acdf591da0ccbbac569a6bcced05dd6d1ffde01e5
Python
6,805
185
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pathlib import numpy as np import pytest from gufe.protocols import execute_DAG from numpy.testing import assert_allclose from openff.units import unit import openfe from openfe.prot...
24265e64cfb7f7ad16e23aa280e5284aef0328e45d2c446999224579667cc33f
Python
6,806
167
""" Label Propagation ================= <!-- difficulty: intermediate --> Spread a sparse set of labels across a neuron using its topology. One of the most intuitive applications for this is to try to label the axon and dendrite of a neuron based on the distribution of pre- and postsynapses alone. ## Background The...
9a28fd5c91aec266f1c38f1cba0827eae67ba29b7f0662a601edc412ee034f56
Python
6,812
135
from __future__ import annotations import argparse import json import os import time from concurrent.futures import ProcessPoolExecutor, as_completed from pathlib import Path import numpy as np import pandas as pd from pipeline_core import fit_base_imputer, fit_preprocessor, make_group_split from screening import we...
9fbb7550a44f409bf97ab8375b0ef9268852e9cbcf4e8d1ae7d19ead4ee59a42
Python
6,830
124
import zipfile from nnunetv2.utilities.file_path_utilities import * def export_pretrained_model(dataset_name_or_id: Union[int, str], output_file: str, configurations: Tuple[str] = ("2d", "3d_lowres", "3d_fullres", "3d_cascade_fullres"), trainer: str = 'nnUNetTr...
833e66ac964eed2022b93b9fbf3f9c407d092663a2179e662794d265d00b109a
Python
6,832
171
#!/usr/bin/env python # Copyright 2016-2020 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
cf65f50213603c34874705230828c3fe1edba72c669b18c77794f07f8a4f0e67
Python
6,841
188
# -*- coding: utf-8 -*- from sklearn.preprocessing import MinMaxScaler from tqdm import tqdm import scanpy as sc import torch.optim as optim import os from torch.backends import cudnn import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F def fix_seed(seed): ...
13a35a1f4cf74a4c0bec6264f1beb605d0dd334b9f3cc53675301c469bbc8d78
Python
6,848
190
#!/usr/bin/env python # # Copyright (c) 2022 10X Genomics, Inc. All rights reserved. # from __future__ import annotations import json import os import shutil from typing import TYPE_CHECKING import martian import cellranger.report as cr_report import cellranger.webshim.common as cr_webshim import cellranger.websumma...
2397da69d095fb614321d2ccd509324c830f70a427c84ec1463029d059a167bf
Python
6,860
195
"""Tests for closing the holes cut into a mesh. Entry points, with deliberately different scope: - `navis.fill_holes` closes every opening the mesh has. - `subset_neuron(..., cap_holes=True)` closes only the ones that call made, which means it has to leave pre-existing openings alone. - `Volume.fill_holes` is `navi...
a68d6edb2f58706f910e72678c49aeab8f9af7bff38ec73a4a575771faa895ec
Python
6,860
148
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2020-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. ############################################################################ ...
9b9982b325208e3ac329d8532db5e328599f64b8cf63c4abc8a1e65c2dd8e535
Python
6,863
196
""" This script crawls the package space and generates .md files in the references directory of the mkdocs site. For example: ``` # side/reference/connectivity/adjacency.md ::: connectivity.adjacency ``` It also generates a SUMMARY.MD file that contains the navigation structure of the generated .md files. We then use...
af126f268be34661bd7e13561325186e2d7d975879f5c976a7b088220635e4c3
Python
6,872
202
import torch import torch.nn as nn from functools import partial import clip from einops import rearrange, repeat import kornia from ldm.modules.x_transformer import Encoder, TransformerWrapper # TODO: can we directly rely on lucidrains code and simply add this as a reuirement? --> test class AbstractEncoder(nn.Mo...
4ccad100cd585b3f4344eec08df6e0d93bdc85885d2909b606263860fb285f85
Python
6,874
170
import torch as tc import numpy as np def gmm_mse(X: tc.Tensor, gmm_weights: tc.Tensor, means: tc.Tensor, scaling: tc.Tensor = None) -> tc.Tensor: if scaling is not None: means = means * scaling X = X * scaling n_components = gmm_weights.shape[0] diff = 0 for i in range(n_components):...
4ed1ba4d471d2124617c34e3b2a098a7e645d073d20e91c8a2e91320a1d6eb81
Python
6,881
216
""" Created on Tue Jan 23 11:02:59 2024 @author: dcupolillo """ import numpy as np import matplotlib.pyplot as plt def modify_frames( frames: np.ndarray, deviating_rows_dict: dict ) -> np.ndarray: """ Apply interpolation by averaging neighboring frames to the frames showing deviating ...
523ca2fee57c2855ff39b2226d8be1bb24670596f1d4c2b33189ad38134bfb39
Python
6,881
194
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
52c9da9ec49b936801efc65d9c4a1e9a512f4fc0d44924f15cbfe2d4ab65d392
Python
6,881
185
import os import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from loguru import logger logger.info('Import OK') input_folder = 'results/super-res/measurements/' output_folder = 'results/super-res/summary/' if not os.path.exists(output_folder): os.makedirs(output_folder) ...
4e644a7324b3a6eb793a4086b90c239292bc849c89a48c394efea2c536fa9a88
Python
6,883
203
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import logging from typing import List, Optional, Sequence, Tuple import torch from detectron2.layers.nms import batched_nms from detectron2.structures.instances import Instances from densepose.converters import ToChartResultConverterWithConfidences fr...
4232c70b1cc3a4f64b865a748fada43190aa5467a33e864ff40db9e5bd693447
Python
6,891
190
import pandas as pd import matplotlib.pyplot as plt import numpy as np from scipy import stats import re import os import subprocess import sys def download_file(url, filename): if os.path.exists(filename): print(f"{filename} already exists. Skipping download.") return print(f"Downloading ...
7bb7a5fc9a4fc0a66242baed8489d45c85d308be2a87129c603a179ed9c8c1d4
Python
6,892
223
# ruff: noqa: PLR2004 from __future__ import annotations import argparse from typing import Any import pytest from pytest_mock import MockerFixture from snakebids import bidsapp, plugins from snakebids.bidsapp.args import ArgumentGroups class TestRunner: def setup_method(self): self.hooks_run = 0 ...
30fa66b4d5e8bce10aea074a0be272861c8e1384437b17dfb8c2a6ab72a69cc5
Python
6,895
222
""" utils/inspect_file.py --------------------- Tools for inspecting unknown MEA data files. Designed for new users who want to: 1. See the full internal structure of any HDF5 or BXR file before writing a loader for a new manufacturer. 2. Compare two files side by side (e.g. two manufacturers) to find wh...
8f1343c81bd1f749c670eb0a12bd675355d70592166d8e14d0087d670a2eced1
Python
6,895
225
""" Functions to handle padding and unpadding of images for batch processing of the various analysis backends. Ensures that images are padded to the required dimensions for neural network models and that predictions are unpadded to restore original dimensions. Also includes utility functions for saving padded images to...
007f8eb0c34d9c3c66ac341d130258668ae043d10cf7e3f0d415c523a56c8bf2
Python
6,901
216
import torch import torch.utils.data from torch import nn, optim from torch.nn import functional as F # from torchvision import datasets, transforms import collections import sys from torch.utils.data import TensorDataset, DataLoader from sklearn.model_selection import train_test_split from AE.utility import create_act...
8022a6e5d8aa9e86569e2acf02a69e217a92f8cbbea1d3f2566344045b96af48
Python
6,908
152
from __future__ import annotations import argparse import json import time from pathlib import Path import numpy as np import pandas as pd import torch from bpnn_batch import fit_predict_pvs_batched from bpnn_training import BPNNTrainingConfig, SingleHiddenBPNN, flatten_model_parameters from gpu_metaheuristics impor...
496ac1212ee304620496bf49f3ad52173faa6b2beecf1d375ff4b1b45715b4ba
Python
6,923
200
import torch import torch.nn as nn from einops import rearrange import torch.nn.functional as F from torchvision.models import resnet18 from self_attention_cv import TransformerEncoder class ViT(nn.Module): def __init__( self, img_dim, in_channels=1, patch_dim=16, num_class...
60928ced0b0898f365118b517e8ebcb3ebe8458ac4e5c296299dfe22b0e0fcc8
Python
6,925
227
#!/usr/bin/env python3 # # Copyright (c) 2016 10x Genomics, Inc. All rights reserved. """Diagnostic tar file uploader.""" from __future__ import annotations import json import math import os import ssl import sys import time import xml.etree.ElementTree as ET from http.client import HTTPSConnection from typing import...
4561905fd6821bc339102d9d4d0fa8bfe71a2369ddb46004402612e034795d08
Python
6,929
202
import logging import os import torch import tarfile from torch.nn.utils.rnn import pad_sequence charge_dict = {'H': 1, 'C': 6, 'N': 7, 'O': 8, 'F': 9} def split_dataset(data, split_idxs): """ Splits a dataset according to the indices given. Parameters ---------- data : dict Dictionary t...
4e687e61668f201fb789dd55d89b810b6b0aa69afa5ec30a25594e08d8cf5efc
Python
6,931
170
import numpy as np import parasail from concurrent.futures import ProcessPoolExecutor, as_completed import logging from math import sqrt logging.basicConfig(filename='parasail_0_all.log', level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') def read_sequences(file_path): l...
4c0781e20d83701579e9a0dfe147f7ce3b3ac8d43c3aec17e7097aef739f6749
Python
6,938
180
#!/usr/bin/env python # Copyright 2016-2021 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
ac4202bdd98486e8eca88f9d25b294697eecd3bc4d9d0032ba7a4322e5b2b069
Python
6,938
224
from typing import Tuple from os.path import join import gym import numpy as np import torch from torch import nn, optim from torch.distributions import Beta from torch.utils.data import DataLoader from os import path from time import sleep from memory import Memory device = torch.device("cuda" if torch.cuda.is_avail...
d3bcb33d81e8b27f9535e3714367cf5237da8fe64c38c88c7f22e1eae15b1b92
Python
6,939
210
""" Module to perform CARE denoising using CSBDeep backend. This module provides a modular denoising pipeline that separates workflow logic from orchestration, similar to the segmentation pipeline structure. The main function is `denoising_pipeline()`, which handles: 1) Image collection and padding 2) Backend executi...
2d999e6ac3c05800c9746c649ebe422be62529f196226b9d3a044ddd1d91cc70
Python
6,944
162
import os import sys import pytest from unittest.mock import patch, MagicMock import subprocess # Import the CLI main function from micaflow.cli import main as cli_main # List of all available commands in the micaflow CLI COMMANDS = [ "pipeline", "apply_warp", "bet", "bias_correction", "calculate_d...
a092b006f30314465398e578a13b80f59de7c9fd3c8d8ff7b826bad693f6d1a9
Python
6,944
197
import numpy as np import pytest from neuroHarmonize import harmonizationLearn class TestRandomSeedDeterminism: """ Tests to verify that the random seed parameter works correctly. This tests the bug fix where seed logic was inverted. """ def test_same_seed_produces_identical_results( self...
8230052bd20880ad7476ee4b3f58135df39e781d5e40d2c86b9d1d7838d1225a
Python
6,951
162
import os import numpy as np import torch as tc from torch.utils.data import Dataset import os from analyses.analysis_utils import data_path def load_data(args, test_trials=False): assert os.path.exists(os.path.join(data_path, args.data_path)) data = np.load(os.path.join(data_path, args.data_path), ...
70724336ed17b3761bcde5f0ebeb92b5eda39bc34083852d5069e4f82b54a7f0
Python
6,958
217
"""some summary""" import os from pathlib import Path import torch import pandas as pd from eeg_visual_classification.utils.lib import ( create_parser, extract_model_options, get_dataloaders, get_model_hash, save_checkpoint, load_checkpoint, ) from ..models import MODEL_REGISTRY torch.utils....
bfe657ad0fb8f12a4ee0ef5e478f0984085f9039ac540d7aa642a41fe97c0a90
Python
6,959
295
"""This tests the CLI functionality of training and predicting a regression model on a multi-molecule. """ import json import sys import pytest from chemprop.cli.main import main pytestmark = pytest.mark.CLI @pytest.fixture def data_path(data_dir): return ( str(data_dir / "regression" / "mol+mol" / "m...
e4c411140f636eec5099ee74487854030452228103db3269056e0a707ba32468
Python
6,971
186
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from dataclasses import dataclass from typing import Any, Optional, Tuple import torch @dataclass class DensePoseChartResult: """ DensePose results for chart-based methods represented by labels and inner coordinates (U, V) of individual ch...
087493d12fbed3315765a550e5416df9b6b35789e0e28e671c08e6e55feaee55
Python
6,973
176
# Copyright (c) Facebook, Inc. and its affiliates. import copy import numpy as np import os import unittest import pycocotools.mask as mask_util from detectron2.data import MetadataCatalog, detection_utils from detectron2.data import transforms as T from detectron2.structures import BitMasks, BoxMode from detectron2....
bf95d463c38c8e7bcd247930c179aab0d21d9a544eded7d047af8cd0d8fe5e2e
Python
6,980
205
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
76a5096c7e76da397fc1de8378d6a0a186f2cc3d04dea83efc5b5d61ff96a084
Python
6,987
196
"""Hit vs miss PSTHs with cluster-based permutation test. Median +/- IQR traces, gold cluster shading, red onset line. """ import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import ...
3eeb04fe0ce51cba80bfd173979781f7aa21a4eb06f1bb420bf0516b55a405f5
Python
6,989
205
import numpy as np from matplotlib import pyplot as plt from scipy import signal from sklearn.cluster import KMeans, DBSCAN from copy import copy as cp def flip(zeros_and_ones): return -(zeros_and_ones - 0.5) + 0.5 def relabel(raw_labels, lookup_table): return [cp(lookup_table[int(raw_label)]) for raw_label i...
0deeab524020e4a6987c9d84cc46b3d3ac8e06c71df0c47cd9f9de7d2f3f56c6
Python
6,993
200
""" Graph conv blocks. Implementation based on https://github.com/cvlab-epfl/voxel2mesh. """ __author__ = "Fabi Bongratz" __email__ = "fabi.bongratz@gmail.com" import torch import torch.nn as nn import torch.nn.functional as F import torch_geometric.nn as gnn import pytorch3d.ops as py3dnn from torch_sparse import ...
df5eecd88836ca92e4c278b5fd02d954fc3d1c187703dcc18da4031ec1f9c3f4
Python
7,005
148
############################################## # ---------- NBS Wrapper Function ---------- # ############################################## from pyNBS import pyNBS_core as core from pyNBS import network_propagation as prop import networkx as nx import numpy as np import pandas as pd import random # Wrapper function ...
d0ebd195a2f68b134d16ad68e5de5b64383bc951d37635aacddb2595f7c00d02
Python
7,011
209
""" Loss Functions for Axon Segmentation Implements three loss functions suited for binary segmentation with class imbalance, plus a comprehensive metrics function for evaluation. Loss functions: DiceLoss — overlap-based loss robust to class imbalance TverskyLoss — Dice variant with separate FP...
9d7b60ea65aec4b70f5a9434bd44a639073eaa8862ea76dd1ec02cc706cbf6d2
Python
7,014
203
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Settings for adding restraints. TODO ---- * Rename from host/guest to molA/molB? * Add all the restraint settings entries. """ from typing import Annotated, Literal, Optional, TypeAlias...
40ffbee67f3526d197a9cdc5e81fcf3b8a1d802a4d10c1ca8c9cda75fc970957
Python
7,018
181
import torch from torch import nn class AttentionUnet(nn.Module): """ Neural network for semantic image segmentation U-Net (PyTorch), with attention mechanism during decoding Parameters ---------- n_filter : int Number of convolutional filters (commonly 16, 32, or 64) """ def __in...
fa142fedc12c27a96a93d4ca2b9e6474477acda787366b26da7c2cb7d2c7568a
Python
7,019
154
""" loaders/cl1_loader.py --------------------- Loader for Cortical Labs CL1 .h5 files. Both the standard recording and the game recording are supported. The game recording contains additional /data_stream/ groups (ball position, paddle, motor regions, etc.) which are silently ignored — only /spikes is used. HDF5 str...
705b57b53bb0a3a1333b2811bdcef66618e939c466141f313eeb1fbf372eb3fa
Python
7,020
150
""" Meshes ====== <!-- difficulty: intermediate --> Light mesh neurons properly - which is what a real renderer is for. A [`Mesh`][navis.Mesh] is a surface, and a surface is where 3D earns its keep: the renderer does occlusion and lighting for you, so none of the [2D machinery](../1b_plotting_2d/tutorial_plotting_2d_...
e1dd3853b831ee75f3b2c26b4ba08912e83bcb2edb6236bb2bd68448b6cc5a10
Python
7,020
200
#!../venv/bin/python import os import psutil #edited by Caleb to monitor memory used by Python process import logging import argparse import csv import yaml import psycopg2 import psql_wrapper as psql from datetime import datetime from tqdm import tqdm CURR_DIR = os.path.dirname(os.path.realpath(__file__)) CURR_...
8a60e34a331cbb848398bda1c1f4238903e1fdb8d55d91b23c91384e515c71b0
Python
7,032
221
""" Created on Wed Jun 25 13:45:20 2025 @author: dcupolillo """ import sys from PyQt5 import QtWidgets from PyQt5.QtWidgets import ( QMainWindow, QGridLayout, QWidget, QMessageBox, QMenu, QAction, QPushButton) from spyne.core.imaging.imagingdataset import ImagingDataset from spyne.GUI.load import LoadFiles...
467a338c242658840d3af03d6832303364ffdf440023a0a8942296e52fc6de54
Python
7,033
207
#!/usr/bin/env python # # Copyright (c) 2016 10X Genomics, Inc. All rights reserved. # from __future__ import annotations import os import shlex import shutil import socket import martian from six import ensure_str import tenkit.bcl as tk_bcl import tenkit.log_subprocess as tk_proc __MRO__ = """ stage BCL2FASTQ_WI...
4a3e66e6e8f337db613eebdd4e927d2e984181b89d81df2ac3a43c6500dd063a
Python
7,038
171
# Copyright (c) Facebook, Inc. and its affiliates. import logging import unittest import torch from detectron2.layers import ShapeSpec from detectron2.modeling.box_regression import Box2BoxTransform, Box2BoxTransformRotated from detectron2.modeling.roi_heads.fast_rcnn import FastRCNNOutputLayers from detectron2.modeli...
eb01f3d909772f2b2794b5e5b48ec841f98f87bf9bfe942c31b395661e23acbc
Python
7,045
206
# # Copyright (c) 2019 10X Genomics, Inc. All rights reserved. # """Compute extra metrics for multiplexing from the uber molecule info. and the sets of multiplet and singlet barcodes - median CMO UMIs over all singlets - fraction of CMO reads lost to multiplets - fraction reads in cells on a per-tag basis """ from ...
29a076c73def7d9eb5c269fa88b4929ae25008b50b9e40f5b1d3ebcce021f8d4
Python
7,046
226
"""This integration test is designed to ensure that the chemprop model can _overfit_ the training data. A small enough dataset should be memorizable by even a moderately sized model, so this test should generally pass.""" from lightning import pytorch as pl import numpy as np import pytest import torch from torch.util...
1635d7b9df11a990e99a2fb1faf4d6a47a0a8fa95175549f8e7ba8044a58538b
Python
7,049
256
from pathlib import Path import click import click_log import pandas as pd from ... import io from ..._cli.utils import ( OrderedClickGroup, SteinbockCLIException, catch_exception, logger, ) from ..._steinbock import SteinbockException from ..._steinbock import logger as steinbock_logger from .. impor...
5849979a6736a51cb76bdd1055fc988362ad5579c7febb45ac49786563da46b5
Python
7,066
275
"""Tests for Model public event scheduling and time advancement API.""" # ruff: noqa: D101 D102 D107 import gc from functools import partial import pytest from mesa import Agent, Model from mesa.time import Schedule class StepAgent(Agent): def __init__(self, model): super().__init__(model) self...
97e1f9eefbbdc5889199d87b263cf75903e896fe0e4977bf81a0bbe0fc686f79
Python
7,069
207
import numpy as np from scipy import ndimage from tqdm.auto import trange from .. import core, config from .base import TransformSequence, BaseTransform from .h5reg import H5transform from . import registry logger = config.get_logger(__name__) class ImageXformer: """Class to render images from a source to a ta...
5c887f63e82b2099d060fce0d072979a9778ac8becd464a2b9d4f1f6f02fa2b6
Python
7,079
192
import numpy as np import pandas as pd import pytest from neuroHarmonize import harmonizationLearn, harmonizationApply from neuroHarmonize.harmonizationApply import applyModelOne class TestApplyModelOneConsistency: """ Tests to verify applyModelOne produces identical results to harmonizationApply for sing...
1df56a000861640ea2e95c77215380a372b3bd3700a6f99c4409f61f4c2fa2c5
Python
7,084
171
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import copy import logging from typing import Any, Dict, List, Tuple import torch from detectron2.data import MetadataCatalog from detectron2.data import detection_utils as utils from detectron2.data import transforms as T from ...
07579d5eecf5eb875519460c441befeff90365d2e3fc3c7acbd9e4637764edd6
Python
7,086
209
"""Test the spatial lookups and physical positioning of different discrete spaces.""" import math import random from unittest.mock import patch import networkx as nx import numpy as np import pytest from mesa.discrete_space import ( Cell, HexGrid, Network, OrthogonalMooreGrid, VoronoiGrid, ) de...
12b411fba1899290d31c1532c05334eda8ea0e47132761976258a00be59d251c
Python
7,088
234
from typing import Optional, Sequence import numpy as np import pandas as pd from . import _utils from .base import PNG, Refine __all__ = [ "Compose", "DropRepeating", "Merge", "FilterBySpan", "FilterLayers", "FilterIndex", "Match", "FilterMinOcc", "Structural", "Connected", ...
85e6b3d34844ad1362cf5334818332c25445ca00e013e8ba132fc86b50bf4d6f
Python
7,091
192
import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import pandas as pd import os from elephant.statistics import isi, cv import quantities as q import string from network_simulations.utils.nest_utils import convert_spikes_df2neo from matplotlib.ticker import LinearLocator, MaxNLocator from n...
adb10d8b745dc4e56a8b2e2fee7b3c327795e06d6fd6724272231bbc292b2e3e
Python
7,091
222
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.init import uniform_ from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.conv.gcn_conv import gcn_norm from torch_geometric.utils import add_remaining_self_loops from torch_scatter import scatter_add from math imp...
f3dd7be07f14215cf42d60c629123205c30bf7fbdecf4f58a9eb2545edc6a6d3
Python
7,092
185
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe """ MIT License Copyright (c) 2019 Microsoft 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...
a70700c6ea3c5e14630ca49bea85ee1f737038a584eb90467e6f9fffae584f29
Python
7,093
248
import torch import torch.nn as nn import numpy as np class AbstractPermuter(nn.Module): def __init__(self, *args, **kwargs): super().__init__() def forward(self, x, reverse=False): raise NotImplementedError class Identity(AbstractPermuter): def __init__(self): super().__init__()...
46703e92635e90349073de38733c120065c6fdd4d3fdff17f0f6b33781462d87
Python
7,103
182
#!/usr/bin/env python # Copyright 2016-2022 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
8350be7f94695345f0c81fbbd25ca78fc2b9f38a53ddf107b594a48c6d142883
Python
7,105
220
from composer.core import DataSpec from composer.models import HuggingFaceModel, ComposerModel from composer.utils import dist import gc from omegaconf import DictConfig from transformers import PreTrainedTokenizer, AutoModel import torch from torch.utils.data import DataLoader import build_datasets as data_module imp...
126e808f648919311abc7f38d46395fb9a3949bcda578ca3686cd2ef77e3124d
Python
7,115
244
"""Model configuration dataclasses for serialisation and loading. Replaces filename-based regex parsing with proper JSON config files. """ import json from dataclasses import asdict, dataclass, field from pathlib import Path from typing import Any, Dict, List, Optional, Union @dataclass class GNNConfig: """Confi...
17d981314001243114925dd8247087fa0aedec4330aaa361cd3e68e3d1447a40
Python
7,122
176
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
1b445cb356512814880fa3bffc188cf45e08f1d5c93022ac66dc16327282f1ac
Python
7,125
188
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
54e7bf0d83d95a88d448872bda7a92fa0c620d14d9e23d74638ac8a2adeffef8
Python
7,126
239
import warnings from typing import Dict, Iterable, Optional, Tuple, Union import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import rgb2hex from numpy.typing import NDArray from rdkit import Chem from rdkit.Geometry.rdGeometry import Point3D try: import py3Dmol except ImportError: ...
8a6a0c7983b7b2c1cabcd37bfe7eb2e4782e9967252bda12b6538340677d6de0
Python
7,128
181
from dataclasses import dataclass import math import json from typing import Callable import random import yaml from pathlib import Path from tqdm import tqdm import numpy as np from .. import config from .pgd_attack import AttackParams from .pca import PCAHandler from .ica import ICAHandler from .decomposition_handl...
3dbdb4a28a8c8e9fcad9378c43792fc3f6e229828f4cafe4ac6e0e646070167d
Python
7,131
187
"""Speaker clustering: silhouette scoring and speaker-count estimation. Regression cover for two shipped bugs: * a fixed Ward distance cut made the speaker count grow with recording length (20 min -> 2 speakers, the same audio at 2 h -> 8); * singleton clusters scored a perfect silhouette, so 11 segments were ...
5cae616071a407c2a683ebb58f72343c2da6b31e41113092ed27e62d531ad7af
Python
7,133
158
''' Created on May 22, 2025 @author: voodoocode ''' import bpy import addon_utils import numpy as np STRUCTURES = ["/mnt/data/Professional/LMU/code/Beta_prevalence/spatial/stn.obj"] VOLUMES = ["/mnt/data/Professional/LMU/code/Beta_prevalence/spatial/heatmap.vdb"] def load_scene(structures, volumes): bpy.ops.obj...
846eeef0446ea2d662465aeac984e59f6a6e8371f09cff29892e4b5e92a493a1
Python
7,137
211
"""Tests for `navis.patch_caveclient`. `caveclient` is an optional dependency and the skeleton service needs both a network connection and an auth token, so everything here runs against a stub client that returns the payloads the real service does. Note this module must stay free of doctests - pytest runs with `--doc...
64eba7f1c01c8f3e1ed2ae2c40214791fe4e6c473f5e2aecbab1beab8984c161
Python
7,140
206
"""Tests for error messages that tell the caller how to fix the problem. These pin *repair signals*: each message names the way out, not just the symptom. Three of them exist because the underlying failure used to surface as a raw third-party exception (pint, pandas, scipy) that mentioned neither navis nor the paramet...
0c059425c36efda4572defb5ff2576e2d21a65ba08bb7ad6fcc5c6a811fec60c
Python
7,149
973
#https://github.com/animesh/scripts/commit/8fd66822b7b85409b88983328ae97d608bc78b4b#diff-d592612aef70515362d5ab69e30a1b7ddff49ae376d5afbba0b286c04ac2452f #https://api.platform.opentargets.org/api/v4/graphql/browser?operationName=assocs&query=query%20assocs%20%7B%0A%20%20search%28queryString%3A%20%22EIF3C%22%2C%20entity...
a966f0ba6092a276cb5466ff7198dba08411c9d1647cbc16cf9c29cf522803a5
Python
7,149
139
import pandas as pd import numpy as np import os import h5py from scipy.signal import find_peaks class AnalysisDataLoader: def __init__(self): pass def load_data(self, database, signal_sampling_rate, start_time, end_time, baseline_correction, peak_detection_width=1, use_zscore=False): processe...
ca8e4aea31984683d85c4ccd05a4145c02257660d6ebef1bb0b87c91422cd0fe
Python
7,153
219
import torch import torch.nn as nn def count_params(model): total_params = sum(p.numel() for p in model.parameters()) return total_params class ActNorm3D(nn.Module): def __init__(self, num_features, logdet=False, affine=True, allow_reverse_init=False): assert affine super(ActNorm3D, self)...
5b7f46b4e4b454804348d3b4558922cac0741d7fef7d179fc1578eec3383c385
Python
7,169
177
from os import listdir from os.path import join from PIL import Image from torch.utils.data.dataset import Dataset import torchvision.transforms as T import torchvision.transforms.functional as TF import random from data_loader import utils import numpy as np import torchvision import yaml from torch.utils...
ccaa53cec5a440a5175ff77826103a8d72d91126b00306e5390c983486af9558
Python
7,169
135
#!/usr/bin/env python3 """Optional expensive checkpoint and synthetic I/O checks for bundle release.""" from __future__ import annotations import argparse import json from pathlib import Path import tempfile CHECKPOINTS = ( "logs/2025-06-18T01-31-51_raven_f2_nfg64_nfd64_dw1e-1_lpw2.0_l1w0.0_lrgtod0.5_3dlpips_AE...
8e93309042ff66fac208182db4539095cfd8a4b97990d5caf5e431846957ea5f
Python
7,173
175
# -*- coding: utf-8 -*- """ Created on Sun May 9 18:06:56 2021 @author: araba """ import numpy as np from scipy.spatial import Delaunay from scipy.spatial import Voronoi import math from itertools import compress from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection im...
a775f326ebc16216726b7af29badca3df1c92888ed61350951cdd7ea7e34c164
Python
7,175
201
#!/usr/bin/env python # # Copyright (c) 2022 10X Genomics, Inc. All rights reserved. # """For a single sample, generate the gene expression clustering/umap plots, antibody clustering/umap plots,. and sample-level rank plots as plotly JSON, so that they can be passed forward to the WRITE_MULTI_WEB_SUMMARY stage and ins...
308473d524de8940dcc881b6c02a1352ab0f8fcb1ca40f95e8d3e2267c65d71f
Python
7,178
219
from pathlib import Path pathmura = Path('C:/Users/animeshs/OneDrive - NTNU/MURA-v1.1/MURA-v1.1') trainlist=list(pathmura.glob('train/*/*/*/*.png')) import numpy as np import cv2 from matplotlib import pyplot as plt img = cv2.imread(str(trainlist[-1]),0) plt.imshow(img, cmap = 'gray', interpolation = 'bicubic') ...
cbf124bcfb093516b8066942959a45a1e3bfbcee5b96cc5de369330ee31cdbd2
Python
7,178
200
from typing import Callable import torch from torch import nn from torch._dynamo import disable from nnunetv2.utilities.ddp import AllReduceGrad @disable # collectives do not belong in a compiled graph def global_sum(x: torch.Tensor) -> torch.Tensor: """Sum x across all DDP ranks, differentiably. Every rank ge...