sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
401f5adad2e4ea1bcd6e822eecdaf5d06d3bd8c5f14dee48a44234e66406be29 | Python | 10,043 | 328 | """
Wrappers for VTK actors.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
from .base import BSVTKObjectWrapper, wrap_vtk
from .property import BSProperty, BSProperty2D, BSTextProperty
from .algorithm import (BSPolyDataMapper, BSDataSetMapper,
BSLabeledCont... |
397db8ebac6c25a9f08c5dcc4a4dfd0734c8d79c5946afc2f2289debef9a011b | Python | 10,046 | 268 | import math
from functools import partial
import torch
import torch.nn as nn
def softmax(x, dim, inplace=False):
if inplace:
torch.exp(x, out=x)
else:
x = torch.exp(x)
s = torch.sum(x, dim=dim, keepdim=True)
x /= s
return x
def _no_grad_trunc_normal_(tensor, mean, std, a, b):
... |
d7607f697b4a15a0a06474b15e4390b1bed58d50e3503d9adb8a2cf6a535a8ab | Python | 10,054 | 252 | """
Skeletons from light-level data
===============================
<!-- difficulty: advanced -->
Extract skeletons from confocal microscopy image stacks.
!!! important "This example is not executed"
In contrast to almost all other tutorials, this one is not executed when the documentation is built.
Consequen... |
14f6f9c8725a66265fa9a4f9ad2c59f1fe112393980d19e21dd20748d16d6947 | Python | 10,064 | 263 |
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
import os
import matplotlib.pyplot as plt
import matplotlib.t... |
607a4472c1f1b7d1b6da0cb8cfc4c77586a562fe47f1f6c2da2a745454f825e3 | Python | 10,068 | 230 | # -*- coding: utf-8 -*-
"""Functionality for parcellating data."""
import nibabel as nib
from nilearn.maskers import NiftiLabelsMasker
from nilearn.image import new_img_like
from nilearn.masking import compute_background_mask
import numpy as np
from neuromaps.datasets import ALIAS, DENSITIES, fetch_atlas
from neuroma... |
8f40eed2d12902487e1c1b756c2b1d9556e4e0ee63a4316d4b62d50368e94529 | Python | 10,070 | 225 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
"""Unit tests for alternative-end NIC discovery in
``graph_b... |
69505384ddce4c5ee285c504a5e135bfc143e40582cae3971f606800a0a3dc61 | Python | 10,075 | 220 | import os,argparse,numpy as np,pandas as pd,matplotlib.pyplot as plt,scanpy as sc
from scipy.optimize import nnls
from scipy.spatial.distance import pdist,squareform
from scipy.stats import spearmanr
from sklearn.decomposition import PCA
from sklearn.neighbors import NearestNeighbors
from sklearn.metrics import roc_auc... |
d46fa9d7de22287df246bdb33572de7f0fca4f38f914fced937809162d0e2d1b | Python | 10,080 | 252 | import time
import argparse
import pickle
import os
import datetime
import torch
import torch.optim as optim
from torch.optim import lr_scheduler
from utils import *
from modules import *
torch.cuda.empty_cache()
parser = argparse.ArgumentParser(
'Neural relational inference for molecular dynamics simul... |
d8792294781d99b0be9960d75c38471710e3d5d52cceef3d6e92c53b22cadf5a | Python | 10,084 | 268 | import numpy as np
import pytest
import torch
from chemprop.data.collate import BatchMolGraph, collate_batch, collate_mol_atom_bond_batch
from chemprop.data.datasets import Datum, MolAtomBondDatum
from chemprop.data.molgraph import MolGraph
@pytest.fixture
def datum_1():
mol_graph1 = MolGraph(
V=np.array... |
165584409a4024514ad8dc7245d12b0dffae0f14687752244c281ceb6006e251 | Python | 10,088 | 338 | from __future__ import annotations
import functools as ft
import json
import os
import re
import textwrap
from collections.abc import Callable, Iterable, Sequence
from os import PathLike
from pathlib import Path
from typing import Any, Protocol, TypeAlias, TypeVar
import attrs
import importlib_resources as impr
impor... |
5d5cb4135f1f55b7d24ab843cdbe36e31575937d1280e6caeb1be29f629755c8 | Python | 10,089 | 263 | from concurrent.futures import ProcessPoolExecutor
from functools import partial
from typing import Optional, Sequence
import numpy as np
import numpy.typing as npt
import pandas as pd
import xarray as xr
from ... import ops
from .._types import RatesArray
from .. import measures
from .base import PNG
__all__ = [
... |
7cff5d7cee03c50dd5f48f91c7322be1a300a5f8f9c619ff0a4509a071729a8c | Python | 10,099 | 242 | # 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... |
5609adb1410fc4c8430768d233b65837e1f92379e2c822eab67844bc86e26840 | Python | 10,100 | 322 | import os
import numpy as np
from vtk import vtkPolyDataNormals
from ..mesh.mesh_io import read_surface
from ..mesh.mesh_operations import combine_surfaces
from ..utils.parcellation import reduce_by_labels
from ..vtk_interface import wrap_vtk, serial_connect
def load_group_fc(parcellation, scale=400, group='main'):... |
3eaeb96c0029b2d849745e6691ccb0d85361bed9cf9953b7ceaed8dc948a6d83 | Python | 10,101 | 241 |
from __future__ import absolute_import
import torch
import torch.nn as nn
import torch.nn.init as init
from torch.autograd import Variable
import numpy as np
from . import pretrained_networks as pn
import torch.nn
import lpips
def spatial_average(in_tens, keepdim=True):
return in_tens.mean([2,3],keepdim=keepdim... |
7fb9b04d7fdb16675a75b72b1ef5af151aa8f7aebb6e59db521d85d24d95a7b6 | Python | 10,109 | 311 | #
# Copyright (c) 2024 10X Genomics, Inc. All rights reserved.
#
"""Generate cell types interactive barchart."""
import json
import textwrap
import altair as alt
import martian
import polars as pl
from cellranger.altair_utils import chart_to_json
from cellranger.cell_typing.broad_tenx.cas_postprocessing import LOW_... |
e411f4694461f5ae986c3d9cabe6fa2c5e3ee43231110b1ca77dc0b0cc383166 | Python | 10,112 | 321 | #!/usr/bin/env python
#
# Copyright (c) 2015 10X Genomics, Inc. All rights reserved.
#
from __future__ import annotations
import errno
import gzip
import io
import os
import shutil
import sys
from collections.abc import Iterable, Sequence
from typing import IO, TYPE_CHECKING, Any, Literal, TextIO, overload
import lz... |
0f3fbaee51b628e0411fc3e6c70a6f220b16f0e798632eec4e9047b54daabe0f | Python | 10,113 | 279 | #!/usr/bin/env python
#
# Copyright (c) 2021 10X Genomics, Inc. All rights reserved.
#
import martian
import numpy as np
import cellranger.csv_io as cr_csv_io
import cellranger.h5_constants as h5_constants
import cellranger.matrix as cr_matrix
from cellranger import cell_calling_helpers
from cellranger.library_consta... |
6dc7c67ada511bdd7c39a0b663b91801be04df17834041f3f020ded697c00fd8 | Python | 10,119 | 234 | #!/usr/bin/python3
##################################################################################
#
# MIT License
#
# Copyright (c) 2025 Kevin Rockenbach, Agnieszka Golicz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "So... |
29955254c3542bf723bcf16ab85e85270120618581a6f49fc52fbb2042e7ca43 | Python | 10,120 | 188 | import sys
import os
from torch.utils.data import Dataset
from argparse import Namespace
import time
import torch.nn as nn
import numpy as np
from sklearn.metrics import accuracy_score
import torch as tc
sys.path.append(os.path.abspath(
os.path.join(os.path.dirname(__file__), '../../')))
from src.plot import *
from... |
2555f72fbfd4fc8513e102ae32b02482a00f7cd94d1f1d2bf85d86b8f6407f7d | Python | 10,131 | 313 | """ Test brainspace.utils.parcellation """
import pytest
import numpy as np
from brainspace.utils import parcellation as parc
parametrize = pytest.mark.parametrize
testdata_consecutive = [
# default start_from = 0 and dtype
(np.array([1, 3, 3, 2, 2, 2], dtype=np.int64),
{},
np.array([0, 2, 2, ... |
650e759cbeffa120422637733b0db813af33566e4cd74644b69d4e1bbc860867 | Python | 10,135 | 213 | #python genPRM.py --msms "L:/promec/TIMSTOF/LARS/2026/260507_sonali/combined/txt/msms.txt" --scans "L:/promec/TIMSTOF/LARS/2026/260507_sonali/combined/txt/accumulatedMsmsScans.txt" --out prm_relaxed.tsv --pep 0.05 --top_n 5 --min_score 0
import argparse, re
from itertools import zip_longest
import numpy as np
import... |
d5420feaa0a9d27db88f3bbebf52d3dc7645f8d2f7b88df0fffa241a2c3c47d2 | Python | 10,142 | 197 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2020-2022 Saint Petersburg State University
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
... |
b1db175b9e189ea39a329295a3e70c70602b3d35862dcce5725945320058d84e | Python | 10,148 | 278 | import os
import warnings
# Check if 'R_HOME' environment variable exists
if "R_HOME" not in os.environ:
os.environ["R_HOME"] = r"D:/opt/R/R-4.3.1"
print("R_HOME was not set")
else:
print("R_HOME is already set to:", os.environ["R_HOME"])
import torch.utils.data
import scanpy as sc
import scip... |
c8ac162892bfcc7861e88238044d8a1d7a672d7e05fbd7fce3721976330532b0 | Python | 10,153 | 231 | from pathlib import Path
import json
from datetime import datetime
import matplotlib.pyplot as plt
import shutil
import numpy as np
import torch
import torch.nn as nn
from tqdm import tqdm
from torch.utils.tensorboard import SummaryWriter
from model import MultiModalTransformer, MultiModalConv
from data2 import dataloa... |
88314d1e183de9c071373bce0b199c2fddd8559dee3e2f81f385191bccfa2335 | Python | 10,154 | 188 | import os
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
from tristan_pipeline.utils.plotting_utils import *
from tristan_pipeline.utils.analysis_utils import *
from tristan_pipeline.io.params import *
from nilearn.glm import threshold_stats_img
from nilearn import surface, plotting, datasets
... |
c3e0d59f08f3e10c37f3fe7099ecaca5a8d16e831390aff4e72a3a453561bd29 | Python | 10,167 | 307 | import warnings
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from tqdm import trange
from torch_geometric.utils import k_hop_subgraph, index_to_mask
from datasets import DataLoader
from models import *
import argparse
import numpy as np
import pandas as pd
import ran... |
46fbca9631d6bec94ebd6e98906d0c6aac498497f4d9b2ee95057085f53dd914 | Python | 10,172 | 171 | from typing import List, Type, Optional, Tuple, Union
from batchgenerators.utilities.file_and_folder_operations import join, maybe_mkdir_p, load_json
import nnunetv2
from nnunetv2.configuration import default_num_processes
from nnunetv2.experiment_planning.dataset_fingerprint.fingerprint_extractor import DatasetFinge... |
c7a61fd9cd6df91524e6ccf1db8e67045d0a983e7014312ca6482474b66b8978 | Python | 10,174 | 259 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
"""
This file registers pre-defined datasets at hard-coded paths, and their metadata.
We hard-code metadata for common datasets. This will enable:
1. Consistency check when loading the datasets
2. Use models on these standard datasets directl... |
15fffb8a91393e5fa4789b1df726f6d4978cbb5a964d35ff278a19dc61299552 | Python | 10,185 | 309 | import copy
import os
from pathlib import Path
import numpy as np
import time
import random
from datetime import datetime
from multiprocessing import Process, set_start_method
import yaml
from django.contrib.auth import get_user_model, login, logout
from django.contrib.auth.decorators import login_required
from django.... |
bb3a73c069e79b31a171685fc24ff0540e20955d100248323d535398c94f94b9 | Python | 10,185 | 212 | import os
import pandas as pd
import matplotlib.pyplot as plt
import anndata as ad
import numpy as np
import scanpy as sc
import scipy
import time
ZERO = 0.02
def geneid_symbol(adata):
import mygene
import anndata as ad
mg = mygene.MyGeneInfo()
ensg_ids = adata.var_names.tolist()
results = mg.quer... |
305229eb0859a7ff56180bdb2202bd9113ad7d37c8798885459506c5afd75955 | Python | 10,194 | 287 | #!/usr/bin/env python3
"""Computes ranked F1 scores from PNG detections.
This script takes PNG detection databases and computes F1 scores for each PNG's
ability to classify specific boundary elements (convex/concave), outputting
serialised results organised by architecture (for a post-trained state).
This computes ei... |
189c91a233c9c056ae83709d271d69befdfe3de5a1c5c0de0e58e4cb96e480ff | Python | 10,202 | 325 | from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from spikeinterface import full as si
from batch_process.util.ppt_image_inserter import PPTImageInserter
# from batch_process.util.ppt_image_inserter import PPTImageInserter
de... |
71f729f35d4e3a3802ae0c3a5cd53ba60aef1b71d5acb641df6f35a41597370b | Python | 10,202 | 210 | #!/usr/bin/python3
##################################################################################
#
# MIT License
#
# Copyright (c) 2025 Kevin Rockenbach, Agnieszka Golicz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "So... |
3450cd98e98fc0129c8f61f7f057eef1ee9561c1be0ed5f6db0e2fc1135ab731 | Python | 10,208 | 240 | import nibabel as nib
import numpy as np
import matplotlib.pyplot as plt
from nibabel import processing as nibp
import pandas as pd
import os
def load_image_masked(img_filename, im_threshold = 15):
orig = nib.load(img_filename)
shape = orig.shape
zoom = orig.header.get_zooms()
print("Reshaping to stand... |
2b1e9f4f94242458bbebc9b03df828d4044f8523c55bc60e68aafde7d21c71d4 | Python | 10,210 | 315 | """ Created on Tue Jul 8 14:46:08 2025
@author: dcupolillo """
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.utils.data import DataLoader
import torch.nn as nn
import copy
import time
from tqdm import tqdm
from sklearn.metrics import (
f1_score, precision_recall_curve, average... |
d4c0c8f18971a2fec7382b441fade2c7848a3ae970afe2b07ef9816ed83f201c | Python | 10,215 | 277 | import numpy as np
import pandas as pd
from rdkit import Chem
from scipy.stats import fisher_exact
motifs = {
# --- Carbonyl-containing groups ---
"aldehyde" : Chem.MolFromSmarts("[CH1](=O)[#6]"),
"ketone" : Chem.MolFromSmarts("[#6]C(=O)[#6]"),
"carboxylic_acid" : Chem.MolFromSmarts("[... |
5b6eb978ae314d62caa43947e0069336a6f2fe9a7e9e4ff8f49c3810f26689b5 | Python | 10,226 | 218 | from pathlib import Path
from typing import Optional, List, Callable, Dict, Any, Union
import warnings
import PIL.Image as pil_image
from torch import Tensor
from torch.utils.data import Dataset
from torchvision import transforms
from taming.data.conditional_builder.objects_bbox import ObjectsBoundingBoxConditionalBu... |
8d56a2182a003f2105b87a69dd6d45313c6b90e8dd50d1dda880ad5070219e13 | Python | 10,242 | 301 | """
Created on 10/08/2017
Modified on 04/23/2021
Updated on 02/19/2026
@author: Niklas Pallast and Markus Aswendt
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
#!/usr/bin/env python3
getAtlasRegionSize_BIDS.py
Process ALL annotation versions found recursively under the input fo... |
e08a571c6498c82be34f42a44a2fbf3c0b2aa2f6db47e6bc0d8aa34f2b921a2a | Python | 10,246 | 308 | """
Implementation of Moran spectral randomization.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import numpy as np
import scipy.sparse as ssp
from scipy.spatial.distance import cdist
from sklearn.utils import check_random_state
from sklearn.base import BaseEstimator
from ..mes... |
b84a1bd36b83ddd13c36f92d865b025b6556f11efe4a0321fd5a85fffe9fdf7e | Python | 10,276 | 267 | import os
import torch
import pytorch_lightning as pl
from omegaconf import OmegaConf
from torch.nn import functional as F
from torch.optim import AdamW
from torch.optim.lr_scheduler import LambdaLR
from copy import deepcopy
from einops import rearrange
from glob import glob
from natsort import natsorted
from ldm.modu... |
0b826a3afe640736fbdfb3e98efef27844563f2852c0f00f524d1db348622494 | Python | 10,294 | 294 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
import nipype.interfaces.fsl as fsl
import os,sys
import nibabel as nib
import numpy as np
import nipype.interfaces.ants as ants
import shutil
#makes sure to import bet.py
sys.p... |
51bcf4e39ac9ec55087f6f02b476713d7b42d850f1907fc2b659f98628f77923 | Python | 10,297 | 267 | """
viz_human_brain.py
------------------
Visualization helpers for Tutorial 2 (human cortical development, missing
modality inference). Keeping complex boilerplate out of the notebook.
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import anndata as ad
import scanpy ... |
fe0295914cf41d45f69068dfd9832069eed3e8423ad6383bf27510edd08d71a7 | Python | 10,324 | 249 | #python proteinGroupsMQtesorAIcombine.py /mnt/z/Download/MQ/ /mnt/z/Download/tesorAI/ "Protein IDs" protein_group_id iBAQ intensity_IBAQ
#python proteinGroupsMQtesorAIcombine.py /mnt/z/Download/MQ/ /mnt/z/Download/tesorAI/ "Protein IDs" protein_group_id Top3 intensity_top3
"""
Arguments:
dir_with_proteinGroups Direc... |
673e11d6f714c6bd34d5c6f74f450f27f04ef9f3bffafc2434be001f54a12a1f | Python | 10,337 | 266 | # --- Python 标准库 ---
import os
import gc
import random
import warnings
# --- 第三方核心科学计算库 ---
import numpy as np
import pandas as pd
import scipy.stats # 只导入需要的子模块
import torch
import torch.nn as nn
import torch.nn.functional as F
# --- 脚本级别的设置 ---
warnings.filterwarnings("ignore")
gc.collect()
def setup_seed(seed)... |
330c036962941e61ab6d9f93409c5c0167141428ce4e93210cc58dad69f680ae | Python | 10,341 | 244 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2019-2022 Saint Petersburg State University
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
... |
d260a3ebf7a5b3eaee68873a6628bbf81cbe4be35de9487e188bc4d30647ce44 | Python | 10,344 | 322 | """ UNet architecture """
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils.custom_layers import IdLayer
class ResidualBlock(nn.Module):
""" Residual Block of https://arxiv.org/abs/1908.02182,
implementation at https://github.com/MIC-DKFZ/nnUNet
"""
def __init__(self, num... |
bbc82882c6c1e4500a193c803f931e77c99ce8e3abba9df5dfb8cf391c7b952b | Python | 10,360 | 268 | # Copyright (c) Facebook, Inc. and its affiliates.
import math
import fvcore.nn.weight_init as weight_init
import torch
import torch.nn.functional as F
from torch import nn
from detectron2.layers import Conv2d, ShapeSpec, get_norm
from .backbone import Backbone
from .build import BACKBONE_REGISTRY
from .resnet import... |
d78543d38067f4207aa2fbc89ba9d85dc1fd8546cda46c1d0af7da95392da5d7 | Python | 10,360 | 196 | import sys
import os
from torch.utils.data import Dataset
from argparse import Namespace
import time
import torch.nn as nn
import torch as tc
import numpy as np
sys.path.append("..")
from plot import *
from control_utils import gmm_log_likelihood
from training import Training_Base_Class
import pickle
class BPTT_cont(... |
eb71b869a35457faa88f081227fa121a5d8a0f3cfa16440bd4e56c65b986bf37 | Python | 10,360 | 287 | import numpy as np
from scipy.spatial import cKDTree
from functools import partial
def linearize(X, path_points):
"""
This is a wrapper function to linearize the trajectory.
It takes the original trajectory and a set of path points,
and returns the linearized trajectory in 1D space.
The linearizati... |
89167232e9f99798f994522dfd0e80a933f76b07f57633bfbed0c7f35a81cc8e | Python | 10,361 | 181 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2020-2022 Saint Petersburg State University
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
... |
24bc95f7b9430e931752b7aaf6b1ac9fd86680245e16b8ee682025fe257de45b | Python | 10,370 | 361 | """ Documentation of project-wide parameters and default values
Ideally, all occurring parameters should be documented here.
"""
__author__ = "Fabi Bongratz"
__email__ = "fabi.bongratz@gmail.com"
from enum import Enum
import torch
import logger
from utils.losses import *
from utils.graph_conv import (
GraphCon... |
66fbfd04948863346a40e4e6cf9becd8740ee205bfe5979960b74ead53cfe89c | Python | 10,388 | 225 | # Copyright (c) Facebook, Inc. and its affiliates.
import copy
import numpy as np
import unittest
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.base_tracker imp... |
b515b1c8b482b6d89e4946510cc27ba16e426a2ac37339194820c00592d5f1ce | Python | 10,391 | 211 | #!/usr/bin/env python
# Copyright 2016-2026 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... |
780a1dbc9a828b25baa6bccdb10145dc6c8d7e8372c916e56bfbbc72048021b0 | Python | 10,393 | 364 | """
Lists of Neurons
================
<!-- difficulty: beginner -->
Work with many neurons at once using NeuronLists: indexing, filtering and batch operations.
!!! note
If you haven't please check out the [neuron types tutorial](../tutorial_basic_01_neurons) first.
{{ navis }} will typically collect multiple neu... |
c6f2a6e6690bd0ab51aed809fe5ad04a48e7b62959604fa2a8b5a0e063bf6c6c | Python | 10,394 | 260 | # 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... |
361524e7beaa650892dbfacd37fc2f3e28655d922f6aa56be4a9d7915bfb3bb9 | Python | 10,407 | 269 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
import logging
from typing import Dict, List
import torch
from torch import nn
from detectron2.config import configurable
from detectron2.structures import ImageList
from ..postprocessing import detector_postprocess, sem_seg_postprocess
from ... |
fc4a249180654b2e6bd7d648a999f9d617c8c6a3a7346a95014c09f82c0545bb | Python | 10,418 | 217 | import os
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
from nilearn.image import math_img
from nilearn.masking import apply_mask
from nilearn.glm import threshold_stats_img
from tristan_pipeline.io.params import *
from tristan_pipeline.utils.loading_utils import *
from tristan_pipeline.util... |
a8d3ee52fa684138f775e9be37ce0974e6491a61ba9751a536170291ed28aa47 | Python | 10,422 | 263 | # 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... |
c9e89f2ae029891d712dded801a23722a435117895f17b3e48fd3ff07a749b86 | Python | 10,432 | 103 |
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
import pytest
import os
from isoquant_lib.assignment.illumin... |
5d8878f6a8ae08f2008b787c33066fb67cd3e190deb0c0071ea1d05aeb6c2268 | Python | 10,433 | 239 | '''
Created on Nov 28, 2025
@author: voodoocode
'''
import csv
import numpy as np
import finnpy.file_io.data_manager as dm
DB4_IN_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/data_collection_db4.csv"
DB4_OUT_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/data_collection_db4x.csv"
DB4_DATA_PATH ... |
91999068cb6ca326d8b4344d6dc3324b5a8dfe3fc46a72565abfd87e0bc13040 | Python | 10,435 | 238 | #!/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... |
4c7902f222e696aac30635fedc2d1f5772822af3d3e45ff55fab46834ee4bc55 | Python | 10,445 | 236 | """
06_velocity_uncertainty.py
訓練済み DREG_DYN モデルから RNA velocity / chromatin velocity の
不確実性を3層に分解して定量し、結果を loom ファイルおよび UMAP プロットとして保存する。
3層の分解:
1. State-estimation uncertainty : q(z|a,s,u) から z をサンプリング (d を posterior mean 固定)
2. Dynamics fluctuation uncertainty : q(d|z_hat) から d をサンプリング (z を posterior mean 固定)
... |
e522c582caba2010548d59c92ff7b6ebd00f4b4bb37872418dd93547bfb07ed3 | Python | 10,445 | 206 | # ------------------------------------------------------------------------------
# Title: SCENIC Transcription Factor Moran's I Analysis
# Author: Yiran Song
# Date: March 18, 2025
# Description:
# This script calculates Moran's I scores for individual transcription factors (TFs)
# using spatial transcriptomics (Xenium... |
2ee37019e2711714429e8efe2017c51b142e886265bb7c999810aff407bc0925 | Python | 10,454 | 278 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
import os
import tempfile
import unittest
import cv2
import torch
from detectron2.data import MetadataCatalog
from detectron2.structures import BoxMode, Instances, RotatedBoxes
from detectron2.utils.visualizer import ColorMo... |
8a5847c247b78aee9eaa0cc1858843ac279ab720a2a6bcb63fe96b4189d9d3cf | Python | 10,467 | 252 | import argparse
from functools import partial
from typing import Union
import nnunetv2
import torch
from batchgenerators.utilities.file_and_folder_operations import join, load_json
from nnunetv2.paths import nnUNet_preprocessed
from nnunetv2.run.run_training import TrainingRunOptions, launch_training
from nnunetv2.tra... |
99ba785f4763c8227a83b1edf78755940431b952161a9bc1529d4086a0445a4f | Python | 10,474 | 336 | from __future__ import annotations
from dataclasses import dataclass, field
from pathlib import Path
import time
import numpy as np
import tifffile
import flammkuchen as fl
from spyne.core.spines.analysis.backends.base_backend import (
BaseBackend, InferenceJob, InferenceResult)
from spyne.core.spines.analysis.p... |
b8e877f18107572336e088694a67aa331a875fff1cd24692fa431a86af7b2ddb | Python | 10,481 | 258 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 4 12:21:16 2025
@author: anni
"""
from . import transformations, simulations
from ..snr import snr_func
from tqdm import tqdm
import numpy as np
import matplotlib.pyplot as plt
import os
import pandas as pd
import pickle
def test_estimators(base... |
7709a70e56453e93648e1a1f23bda828827d3fecc11048bc5debac2fd0c352dd | Python | 10,483 | 317 | # -*- coding: utf-8 -*-
"""Functions for comparing data."""
import nibabel as nib
import numpy as np
from neuromaps import transforms
from neuromaps.datasets import ALIAS, DENSITIES
from neuromaps.images import load_gifti, load_nifti
_resampling_docs = dict(
resample_in="""\
src, trg : str or os.PathLike or nii... |
21c038d90840061a39b8e56a3195cc7e3ea8709b3d2e52a2f96f98f20ede965c | Python | 10,492 | 292 | '''
(c) 2014 Brendan Bulik-Sullivan and Hilary Finucane
This module contains functions for parsing various ldsc-defined file formats.
'''
from __future__ import division
import numpy as np
import pandas as pd
import os
import glob
def series_eq(x, y):
'''Compare series, return False if lengths not equal.'''
... |
7142885581f37298b0bb7e4b4834a3ceb6187eda7f4499d1faee18f9e2fdd628 | Python | 10,495 | 297 | import pint
import numpy as np
import matplotlib as mpl
from dataclasses import dataclass, field, fields
from typing import Union, List, Tuple, Optional
from typing_extensions import Literal
# Global flag whether to validate settings
VALIDATE_SETTINGS = True
@dataclass
class Settings:
"""Class that works a bit... |
6d6540646c5b0bccd1bfd7046277854cd4ffc8350af540209a91ab72a141591a | Python | 10,496 | 225 | # Copyright (c) Facebook, Inc. and its affiliates.
import copy
import numpy as np
import unittest
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.base_tracker imp... |
50d38e2707b7f4525458e8a4d9994c534b581acc0b20442e54b1c0f5300da016 | Python | 10,506 | 279 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Optimizers for Harder Open Race
This module provides the same optimizers used in the Open Race setting, but
with more robust versions for the BO methods to better handle:
- Higher noise levels
- Heteroscedastic noise (spatially varying)
- Non-smoothness/non-stationari... |
3383ec09c8fea60922c512b78d496d153b9461ef951b46f198a245216b4308e0 | Python | 10,524 | 281 | """
Training Script — Axon Segmentation
Full training pipeline for the single-task attention U-Net using
PyTorch Lightning and Weights & Biases for experiment tracking.
Usage:
python train.py --config model_config.yaml
python train.py --config model_config.yaml --batch_size 32 --max_epochs 50
Author: UNet Ax... |
69299f5edee3039477fb2ae6f2cdcb97077f49cd5b1f66e4502c01cc4277d8fd | Python | 10,531 | 245 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
import numpy as np
import torch
from torch.nn import functional as F
from densepose.data.meshes.catalog import MeshCatalog
from densepose.structures.mesh import load_mesh_symmetry
from densepose.structures.transform_data import DensePoseTransformData
... |
07fb7d7d28ec6c0c3a2542e74e23c5fd2463b647af70c482778b4117ed5a403c | Python | 10,532 | 275 | # -*- coding: utf-8 -*-
"""Functions for statistical analyses."""
from functools import partial
import numpy as np
from scipy import special, stats as sstats
from neuromaps.utils import _chk2_asarray
from sklearn.utils.validation import check_random_state
from neuromaps.images import load_data
def compare_images(s... |
83cf6772f47b759559e2b766e60fdbe6ec2ce6c9d16bfab26022a101afb33347 | Python | 10,549 | 299 | """Command-line interface for protein stoichiometry prediction.
Usage:
stoic_predict_stoichiometry --sequences SEQ1 SEQ2 ... [--model MODEL] [--top-n N] [--device DEVICE]
Or as a Python API:
from stoic.predict_stoichiometry import predict_stoichiometry
results = predict_stoichiometry(["MKTL...", "MGSS..."... |
5c31ec935fa06d1af090e60146525ffc86d0a3671ee3b155583fa4fe693cf5c5 | Python | 10,565 | 346 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import itertools
import math
import lomap
import numpy as np
import pytest
from numpy.testing import assert_allclose
from rdkit import Chem
from rdkit.Chem.AllChem import Compute2DCoords
i... |
845be56748e0120ddeab72999488de7db85a5084361b0427a531f65146e27800 | Python | 10,572 | 231 | from typing import Union
import numpy as np
import tifffile
import torch
from ..progress import ProgressNotifier
from .unet import Unet
from .unet_v0 import Unet_v0
from .attention_unet import AttentionUnet
from ..utils import save_as_tif, get_device
class Predict:
"""
Class for prediction of movies and ima... |
12d88ec551622575db9191ac89c42e27e6b5b23943d71a8b7a71915a9a435fe5 | Python | 10,587 | 273 | # 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... |
d91400929ef0a63e72bf23960a46180a30c86a907fa515d2ce40a7b5334a8783 | Python | 10,603 | 328 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Classical Cox Proportional Hazards Model Training
This script trains a classical Cox proportional hazards model using scikit-survival.
Features:
- Linear Cox model with L2 regularization (Ridge)
- Standard survival analysis implementation
- Baseline model for comparis... |
4e20fadc30294ccffe475e340c73cddff10ed8d6e7de62d4822bb23fde41aeb6 | Python | 10,609 | 273 | #!/usr/bin/env python3
"""
Module: predict_large.py
Description:
- Perform inference on large CSV files using batch processing and streaming.
- Memory-efficient version of predict.py for handling large datasets.
- Saves predictions incrementally to avoid memory overflow.
"""
import os
import argparse
import pand... |
8bbaff6826684a7c0e81e37d179147689b71608009a8821a101600d4782196f8 | Python | 10,613 | 303 | """BaseDataRecorder for the Custom Data Recorders.
Subclasses must implement:
- _store_dataset_snapshot: Store a single dataset snapshot
- _get_dataset_dataframe: Retrieve stored data as DataFrame
- clear: Clear stored data
- summary: Return collection status summary
The base class handles:
- Obse... |
b16fedba3cb8c794d54ad2e67415f48689359f510812f857169509b5f35afe0b | Python | 10,618 | 224 | import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import anndata as ad
import scanpy as sc
from scipy.io import mmwrite, mmread
import seaborn as sns
import scipy
np.random.seed(42)
dir_path = "/home/nomura/Proj/mmvelo/experiments/Greenleaf_multiome_Cond_merged_all_missing/2024-01-19T11... |
f622cbfcb65199c2744e6e2f4892e984c7f9071f779ff1b6a633e07648bcab51 | Python | 10,622 | 303 | """Convenience wrappers for using pipeline components standalone."""
import os
import shutil
from pathlib import Path
import librosa
import numpy as np
import torch
from .config import TAPAConfig
class Models:
"""Shared model cache for efficient multi-file processing.
Loads models once on first use, then ... |
ffae5dfc0c935e61f6516798b488c4d77bf9647a3baf6c374e93e5b1c52ff89d | Python | 10,623 | 307 | #
# Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
#
"""Utilities designed to help create the web summary used in Spatial."""
from __future__ import annotations
from typing import TYPE_CHECKING, NamedTuple
import martian
import pandas as pd
import cellranger.rna.library as rna_library
import cellranger.... |
4aa6f666710331d1eef1a053622ba895ff02234bee99e3c65da4c87ce8224ae0 | Python | 10,642 | 329 | import glob
import os
import numpy as np
import pandas as pd
MODELS = ("OpenFF", "Espaloma", "MACE-OFF", "Garnet")
TIERS = ("best_1_percent", "worst_1_percent")
def _write_text_file(filename, lines):
with open(filename, "w", encoding="utf-8") as f:
f.write("\n".join(lines))
def calculate_cis_and_forma... |
2e75f69b561cc7d5bf22a593cfc1ef39913edb0ab79354622f134679db261fcd | Python | 10,654 | 264 | # Copyright (c) Facebook, Inc. and its affiliates.
import json
import math
import os
import tempfile
import time
import unittest
from unittest import mock
import torch
from fvcore.common.checkpoint import Checkpointer
from torch import nn
from detectron2 import model_zoo
from detectron2.config import configurable, ge... |
e5452d584a4edae0b3da4ff30578aa25ea4be106f84cc6e1c93f09a305220e71 | Python | 10,656 | 304 | import os
from unittest import mock
import pytest
from gufe.storage.externalresource import MemoryStorage
from gufe.tokenization import TOKENIZABLE_REGISTRY
from openfe.storage.resultclient import (
CloneResult,
ExtensionResult,
ResultClient,
TransformationResult,
)
@pytest.fixture
def result_client... |
a9314e31f17a4b0f0abe2203d54222e58f86731c87f062f15b7c7545f3f968c4 | Python | 10,657 | 276 | #!/usr/bin/env python3
#
# Copyright (c) 2017 10x Genomics, Inc. All rights reserved.
#
from __future__ import annotations
import math
from collections.abc import Iterable
from typing import TYPE_CHECKING
import martian
import numpy as np
from six import ensure_binary
import cellranger.constants as cr_constants
impo... |
cc286075d2ef9857bf9548b233d61e246749727359d46caeb17ae9367de589ec | Python | 10,667 | 266 | #!/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... |
3c4ef15046cb91abad90d435b9c8fee5abd9489e4ce5ec2320e81d6cacb8aa7a | Python | 10,671 | 304 | #!/usr/bin/python3
##################################################################################
#
# MIT License
#
# Copyright (c) 2025 Kevin Rockenbach, Agnieszka Golicz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "So... |
331d804fa7056223d72a16d6dc46f87dfddb92c2a62b632b9f58a99238c76999 | Python | 10,686 | 262 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# pyre-unsafe
import logging
import os
from collections import OrderedDict
from typing import List, Optional, Union
import torch
from torch import nn
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import CfgNode
fr... |
ba20987df460788f15315c4153af0d9fa45a798da1abf862c07b76abafcbf1a5 | Python | 10,696 | 298 | """A Continuous Space class."""
import warnings
from collections.abc import Iterable
from itertools import compress
from random import Random
import numpy as np
from numpy.typing import ArrayLike
from scipy.spatial.distance import cdist
from mesa.agent import Agent, AgentSet
class ContinuousSpace:
"""Continuou... |
403ee266700260d2933e9d778ae696356d15965f6cec8acb3a8a9cb1074f2799 | Python | 10,697 | 241 | """
Created on 11/09/2023
@author: Marc Schneider
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
Documentation preface, added 23/05/09 by Victor Vera Frazao:
This document is currently in revision for improvement and fixing.
Specifically changes are made to allow compatibility of... |
ce36528fa30ec8bc9e6bea52f65573559e8a0437cad2e13dea0deb14fd9f5ad1 | Python | 10,718 | 263 | # 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... |
aa72a2576cad8033d114a0a5b187f796a88ebb19c64dfb68bbf1c9e3a3ad6d42 | Python | 10,720 | 294 | ## below code is to run the ASW and NMI evaluation metrics
import numpy as np
import pandas as pd
import matplotlib.pyplot as pl
from matplotlib import rcParams
import time
from datetime import timedelta
import scanpy as sc
sc.settings.verbosity = 3 # verbosity: errors (0), warnings (1), info (2), hints (3)
print(sc.l... |
ef5afaf725119faa01256f385724c51d0b2ab2fd68551d669f49533229c1fab8 | Python | 10,739 | 234 | # Copyright 2021 HIP Applied Computer Vision Lab, Division of Medical Image Computing, German Cancer Research Center
# (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy... |
f8d4ac42e7cf4aefff4209eeb5808bda143c029e684b603b46971bda0d75e5f1 | Python | 10,775 | 357 | """ Created on Wed Aug 16 14:49:17 2023
@author: dcupolillo """
from __future__ import annotations
from pathlib import Path
import json
import secrets
import re
import numpy as np
from ROIpy.core.components import Roi
from json import JSONEncoder
def generate_roi_uuid(
n_bytes: int = 8,
hex_lengt... |
27137835fe9ec98f83eff37b06641aafc6c320b8f161792c7f2fbd4f676d5c7b | Python | 10,784 | 230 | ################################################################
# ---------- Network Gene Name Conversion Functions ---------- #
################################################################
import requests
import re
import time
import pandas as pd
# Determine if id to be input is a valid gene name (does not conta... |
72c03227d2b5c5992a2c2e7e0d30531ef3d21d19f50039a0895dc49d898c1b0e | Python | 10,798 | 288 | import navis
import numpy as np
import pandas as pd
import pytest
#: Backends that need no optional dependency and so always run here. `pathos`
#: and `joblib` are added via `importorskip` in the parity test below.
LOCAL_BACKENDS = ['serial', 'threads', 'processes']
def test_parallel():
# Load example neurons
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.