sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
8ba30483454b431e0642c229f286fe387c60130c26516cd392594186f9b4a4e5 | Python | 17,619 | 443 | import torch
import pytorch_lightning as pl
import torch.nn.functional as F
from contextlib import contextmanager
from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer
from ldm.modules.diffusionmodules.model import Encoder, Decoder
from ldm.modules.distributions.distributions import DiagonalGa... |
ec7d033d9bb67c191f46928575b2ac82fe5b3e38d9888bf6437c32622130fce0 | Python | 17,634 | 443 | """
python reproduceFigure.py --mq-dda "L:\promec\Animesh\nDDA\MaxQuant\DDA\combined\txt\proteinGroups.txt" --mq-dia "L:\promec\Animesh\nDDA\MaxQuant\DIA\combined\txt\proteinGroups.txt" --diann-dda "L:\promec\Animesh\nDDA\DIANN\DDA\report.DDA9.2p6.pg_matrix.tsv" --diann-dia "L:\promec\Animesh\nDDA\DIANN\DIA\report.DIA9... |
a9b9a452a94ed43b959715add5f1b05533d694dd82e8504f00532979b9c1022e | Python | 17,638 | 390 | from typing import List, Union, Tuple
import numpy as np
import torch
from batchgeneratorsv2.helpers.scalar_type import RandomScalar
from batchgeneratorsv2.transforms.base.basic_transform import BasicTransform
from batchgeneratorsv2.transforms.intensity.brightness import BrightnessAdditiveTransform
from batchgenerator... |
2c94d1dafb0058a7ca326b1997d1a0a2e3b3074958fbb91b4e99dea197f0d2d4 | Python | 17,678 | 470 | from dataclasses import InitVar, dataclass, field
from enum import auto
import logging
from typing import Iterable, Literal, Sequence, TypeAlias
import cuik_molmaker
import numpy as np
from rdkit import Chem
from rdkit.Chem.rdchem import Bond, Mol
import torch
from chemprop.data.molgraph import MolGraph
from chemprop... |
fa00931a4a007829a8732f7b14a9ab0474fddfdea076cf7dc95c99bdf439b9b4 | Python | 17,680 | 445 | import os
import json
import numpy as np
import pandas as pd
from scipy.io import mmread
import scanpy as sc
import scvelo as scv
import matplotlib.pyplot as plt
import seaborn as sns
# load anndata
dir_path = "/home/nomura/Proj/mmvelo/experiments/multiome_brain_rep_wo_IN/2023-05-07T15:19:02_s43_k100_for_analysis/dow... |
54de354a2492a61e7fd15cb6c8130bfc60198695fd12ca095d3110c419a580e6 | Python | 17,696 | 429 | #!/usr/bin/env python3
"""
Generate TorchANI ANI-2x reference data for Molly.jl ML potential validation.
Tested with TorchANI 2.2.4 + PyTorch 2.8.0 + Python 3.9.
Outputs written to data/ani_reference/:
n2_dimer_ani2x.json energy, forces, coordinates for N₂ dimer at 1.1 Å
n2_aevs.json raw AEV vectors (2 ... |
d8f468250d6bc5b6a618efaa5143b1a28f4f4155999ff6217c150584c11849f6 | Python | 17,696 | 406 | # Copyright (c) Facebook, Inc. and its affiliates.
import copy
import logging
import re
from typing import Dict, List
import torch
def convert_basic_c2_names(original_keys):
"""
Apply some basic name conversion to names in C2 weights.
It only deals with typical backbone models.
Args:
original... |
9384669e906f2e99312c82bda6b43c0879338ea9eec18dde3e0343b91490cd0b | Python | 17,719 | 499 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""
Reusable utility methods to analyze results from multistate calculations.
"""
import warnings
from pathlib import Path
from typing import Optional, Union
import matplotlib.pyplot as plt... |
ced2ad44cdd065f9f93c233ce3df8ea93ac28735ca19ebda93ca29a9f8af4ddf | Python | 17,719 | 514 | '''
(c) 2014 Brendan Bulik-Sullivan and Hilary Finucane
Fast block jackknives.
Everything in this module deals with 2D numpy arrays. 1D data are represented as arrays
with dimension (N, 1) or (1, N), to avoid bugs arising from numpy treating (N, ) as
a fundamentally different shape from (N, 1). The convention in this... |
9d0cd61582c691a17ef20791e1ed99fd19be7d5d8f8e8e5372fc70eba0a10dee | Python | 17,736 | 428 | #!/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... |
0fa34d543bebcc885901935cc1405371282902b7f970c6f06145dbb8a289a70f | Python | 17,764 | 443 | from torch.nn.modules.module import Module
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch_geometric.nn import GCNConv
from torch_geometric.utils import dropout_adj
from numpy import linalg as LA
from sklearn.cluster import KMeans
from .data_process import *
class GCN_Encoder(torch... |
821361c246c7c6ecb121eaef44b4b328d91e96ac847ea3a5170b0971ba6fe42b | Python | 17,772 | 552 | from __future__ import annotations
import argparse
import csv
import shutil
import subprocess
import sys
import traceback
from pathlib import Path
from typing import Iterable, List, Optional
import numpy as np
import torch
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
SCRIPT_DIR = Path(_... |
601c4e3e39b0b9f72e18300654e1a5ba004879bff6b3b35dfcc3f69ab18adee2 | Python | 17,776 | 456 | r"""
NBLAST
======
<!-- difficulty: intermediate -->
Compare neuron morphology with NBLAST — the concepts and a first run.
## What is NBLAST?
A brief introduction (modified from Jefferis lab's [website](http://flybrain.mrc-lmb.cam.ac.uk/si/nblast/www/)):
NBLAST works by decomposing neurons into point and tangent ve... |
136bd02daf32e3489477e5fe2bcd9cbd3ca95d8c5e5276fab95e5fee97eb8b02 | Python | 17,808 | 536 | from __future__ import annotations
from dataclasses import dataclass, field
from pathlib import Path
import tempfile
import shutil
import json
import os
import time
import subprocess
import numpy as np
import tifffile
from spyne.core.spines.analysis.backends.base_backend import (
BaseBackend, InferenceJob, Infer... |
6a77eaaffb7059e28cd1ef46671362292f32ad34c7e43cbb05d7610e7f73d9e0 | Python | 17,814 | 488 | """
Refactored stimulus condition response classes with parameterized analysis windows.
Changes from v2:
- TrainResponse accepts window_config instead of hardcoded different_window_flag
- Hardcoded 700ms values replaced with window_config / timing_params references
- Constructor uses keyword arguments for clarity
"""
... |
03778106a86db4e0d30e07fa7ae468def9a4e8e1e57818024f4efd0d42fdeb57 | Python | 17,815 | 561 | """
Wrappers for VTK data objects.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import warnings
import numpy as np
from vtk.numpy_interface import dataset_adapter as dsa
from vtk.util.vtkConstants import (VTK_ID_TYPE, VTK_POLY_VERTEX, VTK_POLY_LINE,
... |
11c93c1be6af2af354d44a0d3e8981c92614d178b63bfbdea236a4b7a80f862d | Python | 17,840 | 464 | #!/usr/bin/env python
#
# Copyright (c) 2023 10X Genomics, Inc. All rights reserved.
#
"""Call cell types based on Broad Cell Annotation Service."""
__MRO__ = """
stage CALL_CLOUD_CELL_TYPES(
in string sample_id,
in string sample_desc,
in h5 filtered_matrix,
in strin... |
3f894cefadf2df1fa11068ca42b296d2f907a5871547f1054b3e033e487a85be | Python | 17,854 | 425 | """Figure S4 (S-PL) -- PL/NPL detailed supplementary characterization.
Panels:
A. Filtered traces (PL and NPL)
B. PL latency vs distance from stim (4/5/6 uA)
C. PL jitter vs distance from stim (4/5/6 uA)
D. NPL modulation over weeks
E. NPL time to max FR over weeks
Usage (from repo root):
python -m pyth... |
9f182d722c16dd5ee4dad0b44742061c020d01370b9c2d980c3493857cf91901 | Python | 17,878 | 545 | import logging
import os
import pathlib
import socket
import subprocess
import sys
from typing import Iterable, Optional
import psutil
from psutil._common import bytes2human
def _get_disk_usage(
paths: Optional[Iterable[pathlib.Path]] = None,
) -> dict[str, dict[str, str]]:
"""
Get disk usage information... |
686cf5f58521b2deb1de2be083d94eb9d917d40bdf3e843ad2a39e3910bb9d4f | Python | 17,879 | 512 | #%%
import joblib
from os.path import join
import numpy as np
import pandas as pd
import matplotlib as mpl
new_rc_params = {'text.usetex': False,
"svg.fonttype": 'none'
}
mpl.rcParams.update(new_rc_params)
import matplotlib.pyplot as plt
import seaborn as sns
import sys
sys.path.append('/mnt/obob/s... |
2054682d236beba443563d77c07edafb1c07d2a552087f78f5d0f75c4cd86a6b | Python | 17,884 | 477 | # Copyright (c) Facebook, Inc. and its affiliates.
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (leoxiaobin@gmail.com)
# Modified by Bowen Cheng (bcheng9@illinois.edu)
# Adapted from https://github.com/... |
685433ddfa12b37b66d3e0d741c1d9837bce3037b3b1b8d0f185246ba98c8018 | Python | 17,900 | 490 | #!/usr/bin/env python
#
# Copyright (c) 2016 10X Genomics, Inc. All rights reserved.
#
# Manage data used by the webshim
from __future__ import annotations
import collections
import json
import os
from collections.abc import Sequence
from itertools import pairwise
from typing import TYPE_CHECKING
import h5py
import... |
c269edee27e7df3f03b932c267f3e6f851741812dc69fab3e614171a5823a972 | Python | 17,933 | 310 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2019-2022 Saint Petersburg State University
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
... |
93bb96b470aee2f6ed34447257d84a25e8f0ca7a9311240fb5034fb72239aada | Python | 17,952 | 346 | import os
import sys
from argparse import ArgumentParser
import numpy as np
import scanpy as sc
import torch
import pytorch_lightning as pl
from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint
from pytorch_lightning import loggers as pl_loggers
sys.path.append("/home/nomura/Proj/mmvelo/src")
from m... |
e3444274c32cdf964613f58b8f41d7f26069a1f0050c993a90c582c43a088e06 | Python | 17,954 | 579 | from __future__ import annotations
import os
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import font_manager as fm
from matplotlib.patches import Patch
fr... |
53823ea90373c782781927570eb7ecc58e1c803694950fa9127c9ee3722a88b5 | Python | 17,965 | 514 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Deep Neural Pursuit (DNP) — Single-file PyTorch implementation + main()
Implements a DNP-style greedy feature selection for HDLSS data:
• Greedy addition by input-layer gradient group-norms (L2) averaged across dropout samples
• Keeps unselected input columns fixed ... |
eb01e31b38ed45f34fc1125bc8cbc224d7473e7bf85e6e372f17c8c5953fa98d | Python | 18,009 | 481 | from __future__ import annotations
import itertools as it
import os
import re
from collections.abc import Iterable
from pathlib import Path
import more_itertools as itx
import pytest
from hypothesis import assume, example, given
from hypothesis import strategies as st
from pathvalidate import Platform, is_valid_filen... |
a94d215b862049d24770d9bb751e356fcb85439f5ae3e885a9f0d9a53495a937 | Python | 18,041 | 373 | import os
import sys
import pytest
from unittest.mock import patch, MagicMock
import tempfile
import shutil
# filepath: /home/ian/GitHub/micaflow2.0/tests/test_util_bids_pathing.py
# Import the module to test
from micaflow.scripts.util_bids_pathing import (
print_note,
print_warning,
print_error,
c... |
8729cd71924b9e67ec186d0107b4cde0d65e9e6f7103fea4f292717ed16b51b7 | Python | 18,043 | 385 | import os
import numpy as np
import logging
from datetime import datetime
from scipy.spatial.transform import Rotation as R
from scipy.interpolate import griddata, interp1d
from scipy import signal
from .utils import plot_curves
from .mtypes import DatBasics
def file_reader(filename : str, path : str) -> list:
w... |
8eed8271bcb93197b63f8495b05b1e7f5025a085b15014f25f03ef3ddb0eceef | Python | 18,062 | 596 | """
Optuna-based hyperparameter optimisation for GNN and VAE models.
Replaces the grid search in the old ``train.py`` with Bayesian search.
The objective function runs inner k-fold CV with proper per-fold scaling.
"""
import gc
import logging
from typing import Any, Callable, Dict, List, Optional, Type, Union
import... |
eaef87494ccea7f40a72f5440f1d65588b90211d8853c68e2c894596913fe760 | Python | 18,127 | 385 | import os
import sys
import json
from typing import Optional
from argparse import ArgumentParser
import numpy as np
import pickle
from pathlib import Path
from tempfile import mkdtemp
import datetime
import scanpy as sc
import scvelo as scv
import umap
import matplotlib.pyplot as plt
import seaborn as sns
import torch
... |
eb331b95416e1d715417ebb73999d4829f32f8c9c02273919308f5ad434aee3e | Python | 18,167 | 484 | #!/usr/bin/env python3
#
# Copyright (c) 2023 10X Genomics, Inc. All rights reserved.
#
"""Calculate Cell Typing Metrics."""
import csv
import json
import os
import textwrap
from collections import defaultdict
import altair as alt
import h5py
import numpy as np
import pandas as pd
import cellranger.altair_utils as... |
fb22b94b44f845be9d9f0d2428c31517a45eccecc87b1eb49230b975c884e882 | Python | 18,198 | 527 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
import concurrent.futures
import logging
import numpy as np
import time
import weakref
from typing import List, Mapping, Optional
import torch
from torch.nn.parallel import DataParallel, DistributedDataParallel
import detectron2.utils.comm as c... |
8dcf6cd4b608f3bea00f104e37ff8bb6cbc07459b32fe28a0d34436666a544be | Python | 18,211 | 464 | # Copyright (c) Facebook, Inc. and its affiliates.
import io
import numpy as np
import os
import re
import tempfile
import unittest
from typing import Callable
import torch
import torch.onnx.symbolic_helper as sym_help
from torch._C import ListType
from torch.onnx import register_custom_op_symbolic
from detectron2 imp... |
b096b36988b64df088d993026d7063cf6cdc1e62902eed8425b63e53fbfc243b | Python | 18,214 | 423 | """
If you use this code, please cite one of the SynthSeg papers:
https://github.com/BBillot/SynthSeg/blob/master/bibtex.bib
Copyright 2020 Benjamin Billot
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 Lice... |
68f9423b9f9827a0397d7db68e49489ec0c86c82fb46ced7f5e96e75954be8e7 | Python | 18,216 | 541 | # 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... |
a98914e2200d689ca6349eccd1ac7e02503303532d81fe08dc2d53cb5bcba390 | Python | 18,222 | 446 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Tuple
import torch
from torch.nn import functional as F
from detectron2.structures import BoxMode, Instances
from densepose import Dens... |
f588c2a1f8f6832bbb60316a18f61b2cbdb4f8afeff3f59a90c18e4638cd1286 | Python | 18,228 | 450 | """Tile planning for patch-wise prediction.
Prediction splits an image or volume into patches, runs the network on each and
stitches the results back together. How the patches are placed decides how much
redundant work the network does: every pixel covered by two patches is predicted
twice.
The planner here places a ... |
fdb2a17e4c08e6a894881d7404ef7679793b5f47edca4ea64ab9448ba0572998 | Python | 18,266 | 439 | # Copyright (c) Facebook, Inc. and its affiliates.
import logging
import math
from typing import List, Tuple
import torch
from fvcore.nn import sigmoid_focal_loss_jit
from torch import Tensor, nn
from torch.nn import functional as F
from detectron2.config import configurable
from detectron2.layers import CycleBatchNor... |
0222867aed3816c5e3e31bcb0e60cdadd7e389194f459fcdcb7e4fe85b96af46 | Python | 18,303 | 466 | # 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... |
9be881a05354bf6f493e4dc3f1fa798ad61ecb9dde08f689884b7d2466332ad4 | Python | 18,310 | 496 | ############################################################################
# Copyright (c) 2023-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
"""
Base classes for barcode detection results.
Provides re... |
8b8d6416890ca588d5ae3ddb3c7f9014638864235485c2aa22f5c88b2f02dcc7 | Python | 18,311 | 395 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
import sys,os
import nibabel as nib
import numpy as np
import shutil
import glob
import subprocess
import shlex
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__... |
a4d2f8a5052895b7a18eb375ede381aed8575b02389392ccf56f5acd71e08ae8 | Python | 18,313 | 475 | import h5py
import numpy as np
from rdkit import Chem
from rdkit.Chem import rdMolAlign
from rdkit.Geometry import Point3D
def _mol_from_smiles_match_natoms(smiles: str, n_atoms: int) -> Chem.Mol:
"""
Build an RDKit Mol whose atom count matches n_atoms.
Tries AddHs first (common when coords ... |
00acd37c84a62d26a8a52a88b388061c6bc9c62f5f40d0a41f74bea70e8d59b0 | Python | 18,331 | 409 | #!/usr/bin/env python3
#
# ############################################################################
# Copyright (c) 2025-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
import sys
import os
import argpa... |
89dba1049e162158d9888c8bf007b5bdaba0d7561e1f2cc95ecfb8a60c426556 | Python | 18,345 | 553 | import ot
import os
import torch
import random
import scanpy as sc
import pandas as pd
import numpy as np
import torch.nn as nn
import scipy.sparse as sp
import anndata
import json
import h5py
from imageio import imread
from tqdm import tqdm
from scipy.sparse import csr_matrix, csc_matrix
from torch.backends import cud... |
19acdb20dd962427ee0cd4f3fe1930d1ab8b37375c2bbbfefa1711378578c883 | Python | 18,352 | 407 | import os
import random
import time
from typing import Union, Tuple
import torch.optim as optim
from matplotlib import pyplot as plt
from torch.utils.data import DataLoader, random_split
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
from .data import DataProcess
from .losses import *
from .m... |
4a7494421f94d288a71be97d31782899294cc1544b57fa6470e313e03d20b105 | Python | 18,392 | 498 |
""" Mesh representation """
__author__ = "Fabi Bongratz"
__email__ = "fabi.bongratz@gmail.com"
from typing import Union, Sequence
import numpy as np
import torch
import trimesh
import nibabel as nib
from skimage import measure
from trimesh import Trimesh
from pytorch3d.structures import Meshes, MeshesXD
from pytorc... |
29be2749495bc4aacb0223c1db4433295baa9d8981a4d13b60db8f7d3523d8d5 | Python | 18,401 | 351 | import inspect
import multiprocessing
import os
import socket
from dataclasses import dataclass
from functools import partial
from typing import Callable, Optional, Union
import torch.cuda
import torch.distributed as dist
import torch.multiprocessing as mp
from batchgenerators.utilities.file_and_folder_operations impo... |
8d5c7e7dd7ab2ab537c8ae28dfd8fe564222224c3090afc764c26678c20e8a3f | Python | 18,412 | 432 | """Phylogenetic code.
Everything is written to a phylogeny/ dir under the output dir, because dnapars writes
to fixed filenames in the working directory and so needs one of its own.
Outputs:
1. snv_tree_final.nwk.tree: the parsimony tree, from dnapars
2. snv_trees/*.tree: one tree per SNV, tips coloured by basecall (of... |
ce2eb5b2a4a5bae9fb705df2e9be40cb396761e41d3d30e5dc3cf4c54084a133 | Python | 18,415 | 552 | #!/usr/bin/env python
#
# Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
#
# pylint: disable=too-few-public-methods
from __future__ import annotations
import copy
from typing import TYPE_CHECKING
import cellranger.rna.library as rna_library
import cellranger.websummary.sample_properties as wsp
import ce... |
cd684bf6aa85f8de0c0f6e6c95fa7c4dd9631f38c551d620b49c025e0bc509e5 | Python | 18,434 | 488 | """Space rendering module for Mesa visualizations.
This module provides functionality to render Mesa model spaces with different
backends, supporting various space types and visualization components.
"""
from __future__ import annotations
import warnings
from collections.abc import Callable
from typing import TYPE_C... |
e5808f258e8409869d46a6392e6652abef328fd513da7b1e11d157cfab4d00c7 | Python | 18,444 | 356 | import os
import sys
from argparse import ArgumentParser
import numpy as np
import scanpy as sc
import torch
import pytorch_lightning as pl
from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint
from pytorch_lightning import loggers as pl_loggers
sys.path.append("/home/nomura/Proj/mmvelo/src")
from m... |
93c0db466d66ba911191bc90ce08873da5c90855b2c3605aca2a74ca68c76cf7 | Python | 18,468 | 380 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
import atexit
import sys,os
import glob
import shutil as sh
import subprocess
import shlex
import logging
from calendar import month_name
from datetime import datetime
from zonein... |
f8e20fd029fcad875a833dc86c2da4c7184ab80653d1c135d9d83820e405c5f8 | Python | 18,469 | 381 | """
If you use this code, please cite one of the SynthSeg papers:
https://github.com/BBillot/SynthSeg/blob/master/bibtex.bib
Copyright 2020 Benjamin Billot
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 Lice... |
fdb8229eef0fde832afc0e47f7e4cdf4efdcf095897d1a85b0e8bf38fbf36ad3 | Python | 18,469 | 500 | from batch_process.util.ppt_image_inserter import PPTImageInserter
import numpy as np
from spikeinterface import full as si
from pathlib import Path
from spikeinterface.postprocessing import compute_correlograms
# from batch_process.util.plotting import *
from batch_process.util.file_util import *
from batch_p... |
ab12250296a5b38f26c1f4a53c059a5ed9b46c6bea6c676bbed0cf09f06159ab | Python | 18,474 | 474 | """
Merge Suggestion Utility
========================
Computes pairwise merge candidates among good units using three criteria:
1. Template similarity (cosine on primary channel)
2. Cross-correlogram refractory dip
3. Channel proximity
Usage:
candidates = compute_merge_candidates(analyzer, good_ids)... |
9846286651b10b45bc2446aef1d854c8779893e5d9d90b52229cb9649d79d56d | Python | 18,520 | 572 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import json
import logging
import pathlib
import sys
from unittest import mock
import gufe
import pytest
from gufe import ChemicalSystem, SmallMoleculeComponent
from numpy.testing import ass... |
fcca6c2452a679717267c7c96b5e4e3c04b2240a7ae91c4934933c771dfbb517 | Python | 18,559 | 436 | from ij import IJ
from java.awt.event import KeyEvent
IJ.setKeyDown(KeyEvent.VK_SHIFT)
# Extract_Bouts_From_Tracks.py
# https://github.com/tferr/Scripts/
#
# Jython script for ImageJ1 that segregates videotracked paths into "Moving" and "Motionless"
# bouts according to predefined spatial and temporal constraints, pro... |
d8b7832c20b0ee27ff64f5ba100b0753199b92cee0e855ee429f3c9ef7ce7a40 | Python | 18,567 | 674 | """Tests for batch and suppress context managers and singledispatch aggregation."""
from unittest.mock import Mock
from mesa.experimental.mesa_signals import (
HasEmitters,
ListSignals,
Observable,
ObservableList,
ObservableSignals,
SignalType,
aggregate,
computed_property,
)
from mesa... |
137a6b14e30515ff379b5def94b0dee5ce0110e1ad844666bac28b97bf30ce1a | Python | 18,580 | 451 | #python plotPSM.py "L:\promec\HF\Lars\2026\260330_Essa\combined\txt\msms.txt" --protein alsS,ilvC,ilvD,kivD,yqhD
#needs Proteins, Sequence, Modified sequence, Raw file, Charge, Fragmentation, Mass analyzer, Masses2/Intensities2 (full spectrum), Masses/Intensities/Matches (annotated ions), Raw precursor m/z = m/z + isot... |
c1b9bd078f37ee885fb0fba9a11301c5f964d7e5afce3639b366fb5ca0396d76 | Python | 18,599 | 483 | ############################################################################
# Copyright (c) 2023-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
"""
Core barcode detection functionality.
This module conta... |
8c60f72318695e83da6d82780636579390cc71e4bb5b85d29c2416be5157cb4e | Python | 18,601 | 487 | import navis
import numpy as np
import pandas as pd
import pytest
@pytest.fixture
def neuron():
return navis.example_neurons(1)
def toy_neuron(coords, parents, **kwargs):
"""Build a Skeleton from explicit coordinates and parents."""
nodes = pd.DataFrame(np.asarray(coords, dtype=np.float32), columns=["x... |
a3945084dc3b24043e4086a628a61fc790b6a99fcb4104009fb57840fb7d26bf | Python | 18,662 | 441 | # Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import math
import random
import unittest
import torch
from fvcore.common.benchmark import benchmark
from detectron2.layers.rotated_boxes import pairwise_iou_rotated
from... |
860e334705b6afee2f02ced3f5008074d58b3a7f230727ca4a3db5cd3050c0aa | Python | 18,703 | 635 | """ Created on Mon Nov 6 14:22:55 2023
@author: dcupolillo """
from __future__ import annotations
import flammkuchen as fl
import numpy as np
import math
import matplotlib.pyplot as plt
from ROIpy.analysis.stats import (
calculate_total_length,
sholl_analysis, hull_volume)
from ROIpy.analysis.savejson imp... |
2d83164b5b1a1ebf5bff11f3db7284b13e78a069d6e776d37cafcfe18a61ab23 | Python | 18,713 | 429 | import numpy as np
import mne
import scipy.stats as scistats
from math import sqrt, atan2, pi, floor, exp
# global variables
ch_types = ['mag', 'grad', 'eeg']
chansel = {'mag': ['mag', False],'grad': ['grad', False],'grad1': ['planar1', False],'grad2': ['planar2', False],'eeg': [False, True]}
def complex_... |
1e20085dbd15563135f548f2751a9da0b1145d190c9fcc7793cf84a198550829 | Python | 18,721 | 643 | """Helper classes for collecting statistics."""
from __future__ import annotations
import abc
import operator
from contextlib import suppress
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
import numpy as np
from mesa.agent import Agent
from mesa.agentset import AbstractAgentSet
from mesa.experi... |
8a19b878a12fb6017cd5b7a2013499acd817ab41f6e220d2ac055b53c87c8571 | Python | 18,783 | 543 | # Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
from __future__ import annotations
import copy
from typing import TYPE_CHECKING
from six import ensure_binary
import cellranger.vdj.chain_types as chain_types
import cellranger.webshim.common as cr_webshim
import cellranger.webshim.constants.shared as sha... |
08d2910567719895166dc305f72e48ef038fb3d40f2851ae3a99d4e87bc7a620 | Python | 18,786 | 529 | """Altair based solara components for visualization mesa spaces."""
import warnings
from collections.abc import Callable
import altair as alt
import numpy as np
import pandas as pd
import solara
from matplotlib.colors import to_rgb
from mesa.discrete_space import DiscreteSpace, Grid
from mesa.experimental.continuous... |
dde35af71fc3d8dc0659da09e08b54301630cfbdb55d359aecab5c5f818c9077 | Python | 18,795 | 547 | """Tests for masking - temporarily restricting a neuron to part of itself.
Masking is a thin layer over `subset_neuron(track=True)` + `merge_subset`, so
most of the correctness lives in `test_schema.py`. What is tested here is the
layer itself: that a mask is undone exactly, that edits made through one are
carried bac... |
1981aa7c191062a47fae7004fe8a3b2ae0034419ce19f4ef3cf48bd76086a595 | Python | 18,841 | 532 | """
If you use this code, please cite one of the SynthSeg papers:
https://github.com/BBillot/SynthSeg/blob/master/bibtex.bib
Copyright 2020 Benjamin Billot
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 Lice... |
0e76f6f7e6d27bf5c1d4441ecc0a4e42cab5fd3bfa835c2cb2111de7214bf09e | Python | 18,848 | 235 | from nnunetv2.configuration import default_num_processes
from nnunetv2.experiment_planning.plan_and_preprocess_api import extract_fingerprints, plan_experiments, preprocess
from nnunetv2.preprocessing.sampling_locations.extract_sampling_locations import (
extract_sampling_locations_dataset)
def _add_logging_args(... |
1c1a22e352f4766a7a84d86ea3539f0e421afa4d76111b195305c36e0d1ab1f9 | Python | 18,850 | 401 | import os
import pickle
import numpy as np
import pandas as pd
from statsmodels.gam.api import GLMGam, BSplines
from .harmonizationApply import applyStandardizationAcrossFeatures
from neuroCombat.neuroCombat import make_design_matrix, find_parametric_adjustments, adjust_data_final, aprior, bprior
import copy
def harmo... |
310b425e0f935b34c903ff9fe07d35728266475df2d252a56b9753c29b619bc0 | Python | 18,857 | 624 | # -*- coding: utf-8 -*-
"""Functions for operating on images + surfaces."""
import gzip
import os
from pathlib import Path
from typing import Iterable
import nibabel as nib
from nibabel.filebasedimages import ImageFileError
import numpy as np
from scipy.interpolate import griddata
PARCIGNORE = [
'unknown', 'corp... |
ba098601ed75ba84772c1121b681dfeeb74213a4fde6dc2e9e13b4fe1267d1b0 | Python | 18,858 | 449 | """
texture_generation - MRI Texture Feature Extraction for Radiomics
Part of the micaflow processing pipeline for neuroimaging data.
This module computes advanced texture features from MRI data that can be used for
tissue characterization, lesion analysis, radiomics applications, and quantitative
imaging biom... |
8cb8ed77985cf8aefdb3aadd508244d031343d1d5d8db7e5d966101aec2b5a1d | Python | 18,861 | 470 | #!/usr/bin/env python3
#
# Copyright (c) 2015 10X Genomics, Inc. All rights reserved.
#
from __future__ import annotations
import csv
import math
import os
import shutil
import subprocess
import sys
import tempfile
from six import ensure_str
import cellranger.constants as cr_constants
import tenkit.log_subprocess as... |
f5c8f512a281a40977532547a0f19a4cf57632c0112dd6f918d1e71a03113de7 | Python | 18,864 | 571 | ############################################################################
# Copyright (c) 2025-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
import pytest
from isoquant_lib.barcode_calling.callers import... |
d3ca32d85413afa08d12e0ad92b0dd36726c893783b107a8d253f7f049701d20 | Python | 18,871 | 390 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
# SCRIPT_VERSION: 2.0 (fully commented, raw-data reproduction)
# =============================================================================
# RT-qPCR analysis for the manuscript
# "HIF-1 ... |
773a9083bd89606a7f680bfb0c22a72d1e66c60cdf024bf336cb6266f0ee4d3f | Python | 18,879 | 545 | #!/usr/bin/env python
#%%
import os
# 1. Enforce thread limits BEFORE importing numpy or torch
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["OPENBLAS_NUM_THREADS"] = "1"
import gc
import argparse
import multiprocessing as mp
import numpy as np
import qcportal
import matplotlib.p... |
b87bcf7adf60bdc29ede006f6684cfc566b1af389082a2baf24ca335476180e0 | Python | 18,887 | 471 | #!/usr/bin/env python
# Copyright 2016-2023 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... |
59cf665c440e508df99221f94210684cf0cc4b7860c3f04bbb5978baa8913b87 | Python | 18,948 | 339 | import argparse
import os.path
from copy import deepcopy
from typing import Union, List, Tuple
from batchgenerators.utilities.file_and_folder_operations import (
load_json, join, isdir, listdir, save_json
)
from nnunetv2.configuration import default_num_processes
from nnunetv2.ensembling.ensemble import ensemble_c... |
a35f604d2b218da3b52170be5b8e4ee4a3051b132a7176d1c21c4a83efb47ade | Python | 18,980 | 447 | #!/usr/bin/env python
"""
scanner.py
----------
CASCADE quick recording inspector.
Reports duration, total channels, and active electrodes for a MEA file.
Supports 3Brain (.bxr), Maxwell (.h5), and CASCADE spike CSV files.
The key feature is --start and --dur: you can inspect any time window inside
a recording. This ... |
31d4ba306c48eabbb3d827ca5ed6c6eb119ac0406a8cf891a527d5a16736af17 | Python | 18,985 | 441 | #
# Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
#
"""Simple methods that don't require a lot of dependencies.
For things which might be needed in things like preflights.
"""
from __future__ import annotations
import re
from pathlib import Path
from typing import TYPE_CHECKING
from six import ensure_b... |
d3714f9925806131b4c643ce161789f63e2f0e881a309a46ab00d5ac9cc6fae9 | Python | 18,988 | 513 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import TwoSlopeNorm
import matplotlib as mpl
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import pandas as pd
import sympy as sp
def plot_dwdt(dwdt, wmin, wmax, ax, fig, y_max=200, x_max=200,
cbartitle=r'$<dw/dt>$ ... |
57f4261309839b96e93adecb5b078fb556283aee4cc33e5361f3a0af622b67d0 | Python | 19,046 | 510 | #%% Imports
import pandas as pd
import bambi as bmb
import pymc as pm
import joblib
from pathlib import Path
import numpy as np#
import mne
from scipy.stats import zscore
import matplotlib.pyplot as plt
import seaborn as sns
import arviz as az
import matplotlib.patheffects as pe
import sys
sys.path.append('/mnt/obob/s... |
f19fa978aa9e1056b1c5e3798a5378d4f764efdba4684d998235ac6543675780 | Python | 19,048 | 417 | #python plotPSM_dash.py "L:\promec\HF\Lars\2026\260330_Essa\combined\txt\msms.txt"
#Raw precursor m/z = m/z + isotope_index * (1.003355 / charge)
import argparse, re, sys
from pathlib import Path
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from dash import Dash, dcc, html, Input, Output, c... |
83e96cacec8d9e5430e741ca074bc13d4c8beacb0ed5c3a61a4a03e60b2dd522 | Python | 19,054 | 468 | """
train_human_brain.py
--------------------
Three-stage training pipeline for Tutorial 2 (human cortical development,
missing modality inference).
Monitor keys are hardcoded here — NOT in the notebook — to prevent
misconfiguration:
- Stages 1a, 1b, 2 : DREG_PRE.validation_step logs "val_elbo_loss"
- Stage 3 ... |
fcd376e7017dbab79f292717512ca2d1a7cf37427700ccfa1916a10aab5e6301 | Python | 19,079 | 505 | # Copyright (c) Facebook, Inc. and its affiliates.
import math
from typing import List, Tuple
import torch
from detectron2.layers.rotated_boxes import pairwise_iou_rotated
from .boxes import Boxes
class RotatedBoxes(Boxes):
"""
This structure stores a list of rotated boxes as a Nx5 torch.Tensor.
It supp... |
b8bc05607e1a11c65c2a50be5b5f222c56eb6cb806cb7e907372ef7bd11df018 | Python | 19,095 | 584 | import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
import networkx as nx
from sklearn.cluster import KMeans
import matplotlib as mpl
from matplotlib.colors import TwoSlopeNorm
import seaborn as sns
import math
from matplotlib.patches import FancyArrowPatch
# Load data
def load_data(fname... |
ed44739d9c362986fd92a1252da2fa23469ac36a7a3e601c169004861062cbbf | Python | 19,134 | 498 | """Membership manager for meta-agents."""
from __future__ import annotations
import itertools
from collections import deque
from collections.abc import Callable, Hashable, Iterable
from dataclasses import dataclass
from typing import Any
from mesa.agent import Agent, AgentSet
from .backend import MembershipBackend,... |
c34b79dc500fe93abaa0ce51e758d409504d6bd5e6d54ac1e711d86ac3456ffd | Python | 19,179 | 507 | """ Created on Thu Sep 12 14:37:00 2024
@author: dcupolillo """
import sys
import numpy as np
from PyQt5.QtWidgets import (
QApplication, QMainWindow, QPushButton,
QVBoxLayout, QHBoxLayout, QWidget, QDialog,
QListWidget, QFileDialog, QLabel, QMessageBox)
from matplotlib.backends.backend_qt5agg import (... |
cc0d3b33588d78b922f7db4947dc36aaac75abd0f3d30aa78dcd9070017bdcab | Python | 19,186 | 364 | import numpy as np
import pandas as pd
import scanpy as sc
import scvelo as scv
import torch
import pytorch_lightning as pl
from scipy.sparse import csr_matrix
from scvelo.preprocessing.moments import get_moments
import copy
def load_greenleaf_missingmodal_data():
adata_rna = sc.read_h5ad("/mmVelo_tutorial_/data/h... |
b018d709726f0dd20674ca6b0e72011376455494582f83893eaa4140df8a57b2 | Python | 19,198 | 554 | import copy
import json
import math
import os
import sys
import matplotlib
matplotlib.use("Agg")
import numpy as np
import torch
import tqdm
from sklearn.metrics import average_precision_score, roc_auc_score
from transformers import get_cosine_schedule_with_warmup
from RINAMI_model_main import RINAMI
from util import... |
f5d33d871646822dbf6fae294472713fc3f389be8eb98aa9b0551c1ff3d0f4f3 | Python | 19,222 | 522 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from importlib import resources
from math import sqrt
from unittest import mock
import gufe
import mdtraj as mdt
import numpy as np
import pytest
from numpy.testing import assert_allclose
fr... |
0cd6f0677bd3b4d0eb5fa4d331bcf5947e05851f082074d7ecbe6493ac7aa54b | Python | 19,225 | 493 | ############################################################################
# Copyright (c) 2025-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
import os
import pytest
import tempfile
from isoquant_lib.ass... |
fbdec7cf105c78d8e74286a2fb030a9aa7e2e1bbae17d859b634a6e57389590d | Python | 19,393 | 548 | """
tensorflow/keras utilities for the neuron project
If you use this code, please cite
Dalca AV, Guttag J, Sabuncu MR
Anatomical Priors in Convolutional Networks for Unsupervised Biomedical Segmentation,
CVPR 2018
or for the transformation/interpolation related functions:
Unsupervised Learning for Fast Probabilis... |
3c27e5317677a62752694a95e7c95803de6ec43db3494ac979ae67f899ee7661 | Python | 19,396 | 522 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""
Reusable utilities for assigning partial charges to ChemicalComponents.
"""
import copy
import sys
import warnings
from typing import Callable, Literal, Optional, Union
import numpy as ... |
6165cbcea249c264ae31e873057522425bfe5c7088b875211f8bf3b0ea018fe6 | Python | 19,401 | 624 | """ Created on Mon Nov 6 14:11:21 2023
@author: dcupolillo """
from __future__ import annotations
import numpy as np
import random
import math
class Node:
"""
Representation of an individual node in a neuronal morphology.
This class encapsulates the attributes and transformations
associated wit... |
a5b870af30fb74b66c9e4020429083ab9bbf1d15c1e74f9d701ae6a95ac1bd8d | Python | 19,431 | 524 | import logging
import math
import fvcore.nn.weight_init as weight_init
import torch
import torch.nn as nn
from detectron2.layers import CNNBlockBase, Conv2d, get_norm
from detectron2.modeling.backbone.fpn import _assert_strides_are_log2_contiguous
from .backbone import Backbone
from .utils import (
PatchEmbed,
... |
05594d550677d9c449702ec6ae4e225d53305826eb2868b4a10b12df2f0db780 | Python | 19,440 | 534 | #!/usr/bin/env python
#
# Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
#
"""A helper stage to determine sample assignments based on tag assignments for multiplexed data.
The input is the assignments of barcodes to tags,
and also the assignments of tags to samples.
The output is the sample barcodes json, ... |
b021b4d0554c3e07960d9fccdad536496366c55242def75d85740855ff26e910 | Python | 19,450 | 283 | # AUTOGENERATED! DO NOT EDIT! File to edit: 60_CommandLineParsers.ipynb (unless otherwise specified).
__all__ = ['default_spec', 'parse_list', 'none2empty', 'MakeConfigCommandParser', 'UpdateConfigCommandParser']
# Cell
import sys
import os, argparse, sys, datetime
from os.path import abspath
import seaborn
from ma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.