sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
b6d7d8ef674cc50a3a877e53f489377828beea575177cd42130a44009a358f13
Python
11,588
324
# 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...
c0b2398c00df7408ad3d053fd4a091ca2065aec4016e7458007dc5bd5accba0a
Python
11,589
337
import numpy as np import random import torch import pandas as pd import dgl import networkx as nx from sklearn.model_selection import StratifiedKFold import copy torch.manual_seed(123) random.seed(123) def get_adj(edges, size): edges_tensor = torch.LongTensor(edges).t() values = torch.ones(len(edges)) a...
494cbe329caf8568205f1aed284308df7dcdb9ffa243111d0a5617fa2fbd354e
Python
11,590
317
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Restraint Geometry classes TODO ---- * Add relevant duecredit entries. """ from typing import Annotated, Literal, Optional, TypeAlias import MDAnalysis as mda from gufe.settings.typing...
620fe603521b8c8c039fc7f9f280cad4e01a007657232e205b0ade9c4959bcae
Python
11,594
394
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Common utility functions for patent data preprocessing pipeline. """ import os import json import logging from pathlib import Path from datetime import datetime import numpy as np def setup_logging(log_dir=None, log_level=logging.INFO): """ Setup logging conf...
a0727462d035fda3e8426fef94648af7d13cadc73d58bf8cffb3475f1e1db8bf
Python
11,611
291
from itertools import combinations, product from typing import Any, Optional, Sequence import matplotlib.pyplot as plt import numpy as np import numpy.typing as npt import pandas as pd from matplotlib.axes import Axes from matplotlib.patches import Patch, Ellipse, Rectangle from .base import setup_axes, set_figsize f...
dae6b7ef03fd332fba5d15c9b5b003de373dc18e0eb3ae55fa605fe7722e580c
Python
11,628
388
# Copyright (c) 2015 10X Genomics, Inc. All rights reserved. """Assorted grab-bag of miscellaneous helper methods. Do not add to this module. Instead, find or create a module with a name that indicates to a potential user what sorts of methods they might find in that module. """ from __future__ import annotations ...
7c531ca8db97ac348405c33fbabdaf3cff3db8fa643368bd227edbe77f442bd0
Python
11,630
307
# 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...
e7a9d36c6ba1de8382e2e0c77c378b06ab4501c66ba93c4be6a26b15d3e7eb19
Python
11,633
235
import copy import pandas as pd import matplotlib.pyplot as plt from fafbseg import flywire import pymaid import navis as nv import numpy as np import seaborn as sns import scipy.stats as stats import statsmodels import scikit_posthocs as sp import sys import scipy import random import string def multi_comparisons_...
c9096e45ebb250f58a632e6e2a0fee43d52b41c427c18df32b1fb52f245907fd
Python
11,640
361
import numpy as np import matplotlib.pyplot as plt from scipy.linalg import eigh from functools import reduce import seaborn as sns # Helper: Kronecker product def kron(oplist): return reduce(np.kron, oplist) # ------------------ # Constants # ------------------ gamma_e = 1.76086e8 # rad/(s·mT) ...
2c8cb9a4fb9826d2d2244689f1f921ded2dd3930d74015ed77f1726956d7671c
Python
11,644
356
# %% from __future__ import annotations import mne import numpy as np from joblib import delayed from joblib import Parallel from scipy.spatial.distance import cdist from tqdm.autonotebook import tqdm from tqdm_joblib import tqdm_joblib from wasabi import msg from ..utils import get_soi_picks # %% class Epo2Rdm: ...
686dbb945641609abd13bc8e72eba4a7a6e197604872eafc5710dccd7129dcfc
Python
11,646
322
""" Created on Mon Oct 23 12:23:47 2023 @author: dcupolillo """ import numpy as np from spyne.core.spines.analysis.segmentation.post_processing_utils import ( threshold_prediction, remove_corner_joints, remove_distant_spines, remove_small_labels, calculate_centroid, transform) from skimage import morph...
18d9393d631bab8a152b3999a401d18deda6146cc824ede47d4a6bc7f5c39a8e
Python
11,652
332
""" Configuration File for MorphoScope - Structural Plasticity Analyzer This module centralizes all application configuration constants and settings, making it easy to modify behavior without changing core code. Usage ----- Import at the start of your main application: from config import Config, setup_lo...
28f7214e82c6ab74eb565ab5662ae753886f067875fe96ea1ff07d7ccacd04e7
Python
11,678
231
from collections import OrderedDict from copy import deepcopy from typing import Union, Tuple, List import numpy as np import pandas as pd import torch from batchgenerators.augmentations.utils import resize_segmentation from scipy.ndimage import map_coordinates from skimage.transform import resize from nnunetv2.config...
1a4e20f731ecc7816d60ae0d68392fcc7f30950128beb2404b6289b533fdcdac
Python
11,680
252
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...
97a407ac864da7bf5c9989c42e90beb4ee22ea8f68e88fc0789e28d9c27e8630
Python
11,681
247
#!/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...
c71ceefabf1fcf5beaa05a4a9438a1bb2f251d2f47ea31dc068a40727a77bb8d
Python
11,681
365
""" Graph (sub-)networks """ __author__ = "Fabi Bongratz" __email__ = "fabi.bongratz@gmail.com" from typing import Union, Tuple, Sequence import torch from torch import nn from torch.cuda.amp import autocast from pytorch3d.structures import MeshesXD import logger from utils.graph_conv import Features2FeaturesResid...
aecf5e5182f96688790c78e529bd7a1c5d768fa4001d11727aa484cbea0b4e67
Python
11,686
304
import torch import torch.nn as nn import torch.nn.functional as F import dgl import dgl.function as fn import numpy as np class FreqEncoLayer(nn.Module): def __init__(self, in_dim, out_dim, num_heads, dropout=0.0, layer_norm=False, batch_norm=True, residual=True, use_bias=False, freq_enhance_rat...
f9be2654289d1c02f5d105fff603ef7b1f463df64c5b34c4ee0a1d040c52ad25
Python
11,691
351
# -*- coding: utf-8 -*- """ Spyder Editor """ import os import pandas as pd # === Folder containing your CSV files === folder = "/Users/u0135006/Desktop/Rabies_sum" # === Find all CSV files in the folder === csv_files = [f for f in os.listdir(folder) if f.lower().endswith(".csv")] if not csv_files: raise Syst...
81f16bc695110dd45575bb64d8b1d84efbed4d13ab1acb44d2b0d00e88f2daae
Python
11,707
259
# Copyright (c) Facebook, Inc. and its affiliates. import torch from torch.nn import functional as F from detectron2.layers import cat, shapes_to_tensor from detectron2.structures import BitMasks, Boxes """ Shape shorthand in this module: N: minibatch dimension size, i.e. the number of RoIs for instance segmena...
e79f5e560cda401a94006df85fa18626d7e2ca375782682ef02589b80327531c
Python
11,708
312
#!/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...
0d69d567250277d334ae9bafb743f3acd0eccdc6d4e42486e9ec6ef2b198d704
Python
11,709
276
import os import numpy as np import nibabel as nib import os.path as op from glob import glob from time import time import pandas as pd from scipy.spatial import cKDTree import matplotlib.colors as mcolors import matplotlib.pyplot as plt import nibabel as nib import nipype.interfaces.freesurfer as fs from nipype.int...
ac2e60f8102a64d18aaae6f291e26abd6352f4b4dab7eae18de3059ee4d6d973
Python
11,710
294
# gene 方向に p, u, s を concat して解析しようとした script import os import numpy as np import pandas as pd import umap import matplotlib.pyplot as plt import anndata as ad import scanpy as sc import scvelo as scv import cellrank as cr import scanpy.external as sce from scipy.io import mmwrite, mmread import statsmodels.api as sm ...
9476b6b86ea8e6e160ebf6e5b6e3b5364fca14e556e08709cb9b9a174ffcd11c
Python
11,726
302
# ------------------------------------------------------------------------------ # Title: Maturation Model for CM Data # Author: Yiran Song # Date: March 18, 2025 # Description: # This script trains a machine learning model to predict CM (cardiomyocyte) maturation # using multiple datasets. It includes data preprocess...
24a4fb696f44ff457c225c4bc37dd4dafae7de0d9591dfe7a28e6e2aea3c55db
Python
11,727
239
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ import subprocess import pytest import os import shutil de...
ff3ab3d65a499302ed12237a2d69cbddf9418ff0473be2a40e897afb1d7f5549
Python
11,749
236
import os import numpy as np import pandas as pd import umap import matplotlib.pyplot as plt import anndata as ad import scanpy as sc import scvelo as scv import scanpy.external as sce np.random.seed(42) # load anndata dir_path = "/home/nomura/Proj/mmvelo/experiments/multiome_brain_rep_wo_IN/2023-05-07T15:19:02_s43_k...
57144c9ce7e223a75b37653a963a5047bd63611150879d36edbfa9ac0fe993fc
Python
11,753
322
import tensorflow as tf import numpy as np import math from sklearn import preprocessing from scipy.linalg import toeplitz dim=3000 eta=0.2 elimination_rate=1 def data(dim): t=[pow(0.5,i) for i in range(dim)] Sigmainv=toeplitz(t) Sigma=np.linalg.inv(Sigmainv) X=np.random.multivariate_normal(np.zeros(...
18830ab1788661168a442a4c50d8e3e1445f717c57a7f713e8415fa778103b34
Python
11,759
332
""" NEURON simulator ================ <!-- difficulty: advanced --> Run compartment-model simulations of neurons and networks via the NEURON simulator. [NEURON](https://neuron.yale.edu/neuron/) is a simulation environment for modeling neurons and networks. It's powerful but fairly low-level, so building models tends ...
b6b4db66f92c2470c20ad6fefe2a58ae8589c154e37f74162201b11a948551d3
Python
11,759
257
''' Created on 29.09.2020 Author: Michael Diedenhofen Max Planck Institute for Metabolism Research, Cologne ''' from __future__ import print_function import csv import os import sys import numpy as np import nibabel as nib from calendar import month_name from datetime import datetime from zoneinfo import ZoneInfo ...
4b42a617632fad5f9f703c74da55c74dd506c7452e1cae377f767b84c7a52c28
Python
11,769
334
""" Configuration File for MorphoScope - Structural Plasticity Analyzer This module centralizes all application configuration constants and settings, making it easy to modify behavior without changing core code. Usage ----- Import at the start of your main application: from config import Config, setup_lo...
757f746e23839004b227536818170a71bd78de9ac4a9cce8d9b4de0ae19b4634
Python
11,769
213
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2020-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. ############################################################################ ...
b86648878dfc1d8ef7bdf20c051ef0c6ae5f1710521c9b67c1b9469a58bb39a4
Python
11,775
323
import tensorflow as tf import numpy as np import math from sklearn import preprocessing from scipy.linalg import toeplitz dim=2000 eta=0.2 elimination_rate=1 def data(dim): t=[pow(0.5,i) for i in range(dim)] Sigmainv=toeplitz(t) Sigma=np.linalg.inv(Sigmainv) X=np.random.multivariate_normal(np.zeros(...
096a6e043dc7cb3dd79dc9140bb22092d37689ac30671436b8e88c2345a62907
Python
11,785
290
# 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...
ae4053ca6d61c31563ef4be2301dc2dc8a16c198d1aee0a587de9082cd975420
Python
11,790
375
# -*- coding: utf-8 -*- # pyNBS_stability.py # Python 2.7-compatible stability metrics for pyNBS consensus clustering import os import numpy as np import pandas as pd try: from sklearn.metrics import silhouette_samples, silhouette_score SKLEARN_SILHOUETTE_AVAILABLE = True except ImportError: SKLEARN_SILH...
8dd0c69807c70ab27332345533ca798ffa9e864648e64f65e27a77e3036df388
Python
11,791
260
import glob import os import shutil from skimage import morphology from albumentations import ( ShiftScaleRotate, GaussNoise, RandomBrightnessContrast, Compose, RandomRotate90) import numpy as np import tifffile import torch from torch.utils.data import Dataset class DataProcess(Dataset): """ Class f...
b281d488392060d076773c69b6778cafd14ba47418e4c062027331454b24608e
Python
11,797
265
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 ...
23b9795d05a9f9b7e53854739bfa08594250234de8f980da0eb5b34ca596278a
Python
11,799
345
import copy import os import pickle from pathlib import Path from typing import Optional import lightning import numpy as np import pandas as pd import torch from loguru import logger from torch_geometric.data import Dataset from torch_geometric.loader import DataLoader from torch_geometric.utils.convert import from_n...
7eac886d229a3a4ef7b47a559baf29c1bf471e62cf087a5e18b26cde9d8571e7
Python
11,807
354
"""Tests for `navis.connected_components` - the one primitive everything else in the component family now goes through. The properties worth pinning down are the ones the API *promises*: the labels are a partition of the elements, they are sorted largest-first (so `== 0` is always the biggest piece), `element` decides...
f398a7ec3b1ab92257a7472548b2ab3f66e2566f26981dc160129a20eab0d5fa
Python
11,807
330
# Copyright (c) Facebook, Inc. and its affiliates. import collections from dataclasses import dataclass from typing import Callable, List, Optional, Tuple import torch from torch import nn from detectron2.structures import Boxes, Instances, ROIMasks from detectron2.utils.registry import _convert_target_to_string, loca...
5939ac2e677db96be4a77a4f5d4acb0c1cdd2fd0819b36f0c9a07d16bcdd44da
Python
11,811
289
from abc import abstractmethod from lightning.pytorch.core.mixins import HyperparametersMixin import torch from torch import Tensor, nn from chemprop.conf import DEFAULT_ATOM_FDIM, DEFAULT_BOND_FDIM, DEFAULT_HIDDEN_DIM from chemprop.data import BatchMolGraph from chemprop.exceptions import InvalidShapeError from chem...
b6614f4fff5b0c628147848616f4dce981fe2fbe7b9867e91370cc6fe34aea6c
Python
11,814
332
""" core/criticality.py ------------------- Criticality metrics: power-law exponents, DCC, branching ratio, shape collapse. References ---------- Habibollahi et al. (2022) – tplfit MLE method, DCC definition Beggs & Plenz (2003) – neuronal avalanche framework Wilting & Priesemann (2018)– branching ratio estimat...
afdee60cd0473fc3baf4ef77de574c6caacc62e1b7b72935529a9a2828c85228
Python
11,826
263
import numpy as np import sigpy from .mtypes import DatBasics from .utils import scalingArray, saveImage import os ## RMSE coil combine def coil_combine(dat_basics : DatBasics, data : np.ndarray, var : str, working_path : str, no_reacq: bool) -> None: Coils_im = np.abs(np.sqrt(np.sum(np.abs(data * np.conj(da...
4ae972b0e57281d263c2978236c95489d6f4c96410c5b937d6a29ba5f25a9ea7
Python
11,828
469
""" Logging a single experiment. This module is designed to handle a single experiment at a time.""" __author__ = "Fabi Bongratz" __email__ = "fabi.bongratz@gmail.com" import os import time import logging import functools import copy import collections import inspect import json import torch import wandb import pan...
fcb2c5e8d68f0f5169c8389d821768162fbc62f8da75c86ec597d40a37c4db17
Python
11,838
237
############################################################################ # Copyright (c) 2022-2024 University of Helsinki # # All Rights Reserved # See file LICENSE for details. ############################################################################ # Splice-site error correction for constructed transcript mo...
07fef880ec349ee3b5b69ac0e815f72d0fb89387ed3a64db8541878290c57c46
Python
11,848
374
# noqa: D100 import base64 import playwright.sync_api import pytest from IPython.display import display from mesa.examples import ( BoidFlockers, BoltzmannWealth, ConwaysGameOfLife, EpsteinCivilViolence, PdGrid, Schelling, SugarscapeG1mt, VirusOnNetwork, WolfSheep, ) from mesa.exam...
5b18ed9775c63905e64b398449badcd6dbf50e544a55b0a6663e3f4fef75a828
Python
11,848
294
import numpy as np from typing import Dict, List, Optional, Tuple import torch from torch import Tensor, nn from detectron2.data.detection_utils import convert_image_to_rgb from detectron2.layers import move_device_like from detectron2.modeling import Backbone from detectron2.structures import Boxes, ImageList, Instan...
cbfbf004e26a1272cd2db48bc5c89c1c41df06c082498f9501984f3c08334aef
Python
11,855
312
"""Cell spaces based on Voronoi tessellation around seed points. Creates irregular spatial divisions by building cells around seed points, where each cell contains the area closer to its seed than any other. Features: - Organic-looking spaces from point sets - Automatic neighbor determination - Area-based cell capacit...
ef685c12ae587848895f18a54dac0340a250a8851820520b68a731ea8c022a63
Python
11,858
276
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import copy import numpy as np from typing import List import torch from detectron2.config import configurable from detectron2.structures import Boxes, Instances from detectron2.structures.boxes import pairwise_iou from ..config.config imp...
7559c1086a7d04b534999893bd84509f9f30334cb7672640eeb8d0b1e0931e63
Python
11,860
310
"""Tests for dotprops construction (tangent vectors + alpha). `make_dotprops` and `Dotprops.recalculate_tangents` compute these via `navis_fastcore.dotprops` when it is available and fall back to `scipy.spatial.cKDTree` + numpy SVDs otherwise. Both paths are exercised here. Note the two backends are *not* expected to...
c28d507291d1544cd6919bffbec44622c7591807465b1a849f03a317a1f1204a
Python
11,868
226
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 def split_data(adata, val_ratio=0.1, test_ratio=0.1): total_num = adata.shape[0] val_num = int(tot...
8b33c76c8022cf64f81d6f5f2f45d506e648b5493ec201d79c82f52c95ceba5c
Python
11,881
346
""" Created on Wed Sep 6 11:31:57 2023 @author: dcupolillo Visualization and export functions for imaging data. This module handles frame visualization, video creation, and image export. Data persistence functions have been moved to dataloader.py for better separation of concerns. ""...
8056722eb046dd8e777209dbf0595bcd2444179b4081ce691fa583e7df53a45b
Python
11,883
322
#!/usr/bin/env python # # Copyright (c) 2021 10X Genomics, Inc. All rights reserved # """Assigns tags to cells.""" from __future__ import annotations import pickle from typing import TYPE_CHECKING import martian import numpy as np import pandas as pd import cellranger.feature.multiplexing.metrics_utils as multi_met...
2577440feffb5620299bc5a3c716cae6d340c56fd64bab44567961c5f0389a4d
Python
11,888
232
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2020-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. ############################################################################ ...
cac2914729bddacfdc1c604fd0d861e4eb143c51bf1a9f74b7705e5b9085fa20
Python
11,892
341
# 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...
6f35e60da43c9c7c3aa2fd71c52e451ac898265b6c9b1ccf72f9b90d3b0506e4
Python
11,919
217
import os import warnings from typing import Union, Tuple, List import numpy as np import torch from batchgenerators.dataloading.data_loader import DataLoader from batchgenerators.utilities.file_and_folder_operations import join, load_json from threadpoolctl import threadpool_limits from nnunetv2.paths import nnUNet_...
f910ae89250bfde555d43d5dd51e86a6fc83a2c99f66d43c453ab4e57dff4a15
Python
11,920
352
""" Pipeline for VTK filters. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause from .decorators import wrap_input from .wrappers.algorithm import BSAlgorithm from .wrappers.data_object import BSDataObject from .wrappers.utils import get_vtk_name # From https://vtk.org/Wiki/VTK/Tuto...
dba5285de7349da62bd89d87761089a9fd1598ddd7f13c5819f6478cdab1f4d0
Python
11,930
282
# Copyright (c) Facebook, Inc. and its affiliates. import numpy as np import fvcore.nn.weight_init as weight_init import torch from torch import nn from torch.nn import functional as F from detectron2.layers import ShapeSpec, cat from detectron2.utils.events import get_event_storage from detectron2.utils.registry impo...
4006946592212d64aab8cf69097c16b6ed1421c21b38de03401e69556fb3da9b
Python
11,932
316
from __future__ import annotations import argparse import glob import json import os import tkinter as tk from tkinter import filedialog from tkinter import messagebox from tkinter import simpledialog from tkinter import ttk from PIL import Image from PIL import ImageTk parser = argparse.ArgumentParser(description='...
5aadc689ba46faa774d68f5c6c04fa47652f1d9b4e675986b55dc8a20b264fac
Python
11,943
294
# 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...
c250eedcf5f48c75ff9c3e2f5e1a30e778f24fb1ae1e6ace4b38f0206e31e8cf
Python
11,946
344
""" Created on 10/08/2017 @author: Niklas Pallast Neuroimaging & Neuroengineering Department of Neurology University Hospital Cologne """ from __future__ import print_function import os,sys import numpy as np from dict2xml import createXML # from string import split def parsePV(filename): """ Parser fo...
d615633915b62310204d1e1773644798f7517bfc522e0bbd5dd280e56a47b23a
Python
11,965
356
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2017 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 o...
5fde24d3b05ff4bc782906582003ecb0cdb7100d688218a6b10de4e4a2f694ea
Python
11,981
320
import numpy as np import pandas as pd from typing import Tuple, List from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import Matern, WhiteKernel, ConstantKernel from scipy.stats import qmc import warnings warnings.filterwarnings('ignore') import os # Find the project...
84f518aed801db3762911a8c203e52534dba1206bc9b2cad19f064729fb75f43
Python
11,983
279
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://w...
2a8497e8f52347e201a3b143289b7a9c671ddcaa0790fd7e81b2edf8d5a137c6
Python
11,987
259
from . nets import * import torch from torch import nn, optim from . utils import calculate_affinity,target_distribution import numpy as np from sklearn.cluster import KMeans from scipy.sparse import coo_matrix from sklearn.preprocessing import StandardScaler from itertools import combinations from sklearn.decompositio...
538c8fffc35fdddc7b1a843ae145cf7c11a7c63024d891f47a72acb1b348f3ff
Python
11,989
330
import os import glob import time from collections import defaultdict import openai import PyPDF2 import pandas as pd import docx from pptx import Presentation from PIL import Image import pytesseract from openai import error as openai_error import json from openai.error import RateLimitError from dotenv import load_do...
30522f8a4142986e4b17574b724da855bc89e924c68cbc11476f48b3ed5ee93a
Python
11,999
327
# 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...
b645bf7832b19981e77f8f63fdfd833e3586c292f0ec67641ebed7a8d0f8a611
Python
12,003
329
#%% from os import listdir from os.path import join import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import joblib import sys sys.path.append('/mnt/obob/staff/fschmidt/cardiac_1_f') from utils.plot_utils import plot_ridge from utils.trf_utils import do_boosting, trf2pandas,...
27519366d7be45d92bf7209389e352321abe4111f5a1bead1151fb2c5ea3517d
Python
12,017
245
"""Shape and dtype round-trips through the multi-output predictors. These use tiny randomly-initialised checkpoints rather than trained weights: the point is that every input shape survives tiling, prediction and stitching, in particular shapes smaller than the patch, which used to reach the network with sizes the dec...
1ee6b1942204ddac777aad978c6b17df67b6d02be588760ea1d392df4a60f2ea
Python
12,026
382
import os import matplotlib.patches as mpatches import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from src.chem import compute_motif_enrichment_table, motifs from src.graphs import style_violins, violin_prune_outliers from src.io import BenchmarkResults from src.stats import...
7d3cb320bc862d9bd18d43c90d14b75f7b5f6e09c233dd735bba26d45a9341aa
Python
12,036
305
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import csv import logging import numpy as np from typing import Any, Callable, Dict, List, Optional, Union import av import torch from torch.utils.data.dataset import Dataset from detectron2.utils.file_io import PathManager fro...
ebe0af29e8a77da247e05842de39d1e6e144846dbd486ed34500d7c71fd0e363
Python
12,038
328
import pyqtgraph as pg from pyqtgraph.Qt import QtWidgets from pyqtgraph.Qt import QtCore from pyqtgraph.console import ConsoleWidget from pyqtgraph.dockarea.Dock import Dock from pyqtgraph.dockarea.DockArea import DockArea from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * import pandas...
5d2e4f592a795da4a7f549ad2db446057391be150939029649bcd9e7285364c2
Python
12,050
294
#!/usr/bin/env python # # Copyright (c) 2019 10x Genomics, Inc. All rights reserved. # import math import os import martian import cellranger.analysis.constants as analysis_constants import cellranger.rna.library as rna_library from cellranger.matrix import CountMatrix from cellranger.molecule_counter import Molecul...
3c02d290f45c06b3d517f866ae4b9fc4e7fe39155ce8efc6ed1eafa8525e5900
Python
12,058
211
import multiprocessing import os from time import sleep from typing import List, Type, Union import numpy as np from batchgenerators.utilities.file_and_folder_operations import load_json, join, save_json, isfile, maybe_mkdir_p from tqdm import tqdm from nnunetv2.imageio.base_reader_writer import BaseReaderWriter from...
f80bc8f92f173b0ee216137ca23cc1d7c0dfc23184985ca8dcba7ec44f5793c2
Python
12,074
335
""" Population coupling analysis for control animals. Adapted from pop_coupling_v2.py for experimental animals. Computes STPR (spike-triggered population rate) and shuffle-normalized population coupling (pc_norm) — matching the experimental pipeline output. Uses session_responses.pkl for PL/NPL classification ...
fe11b8241028d0561bbaf2f55a9b1ec88bef516daf839a3f416080b9b922a1df
Python
12,121
278
#python diffExprDIANN.py F:\promec\TIMSTOF\LARS\2025\250107_Hela_Coli\DDAreport.parquet_Ms1_Area_pivot_all.csv #python diffExprDIANN.py F:\promec\TIMSTOF\LARS\2025\250107_Hela_Coli\reportDDA.parquet_Ms1_Area_pivot_all.csv import sys import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn a...
a72b57b46503be12ad615a832fcaac50c32a8f2aaaef9c6c673ff9feb1a5cbac
Python
12,141
266
import glob import os import shutil from skimage import morphology from albumentations import ( ShiftScaleRotate, Blur, MultiplicativeNoise, RandomBrightnessContrast, Compose, RandomRotate90) import numpy as np import tifffile import torch from torch.utils.data import Dataset class DataProcess(Dataset): ...
ff01cf8d53cac005c77ff543aac2779cc80cb34838423241eadaea2e8eca260f
Python
12,145
267
''' Created on Nov 7, 2024 @author: voodoocode ''' import os import numpy as np import scrubber.core import csv IN_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/database6/original/" OUT_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/database6/scrubbed/" COLLECTION_META_PATH = "/mnt/data/Professio...
ac4602b2983ef73c6e6ada8ef5eb5de69a93391b23ed938d95b2ce88f02104a0
Python
12,146
400
""" Utility functions for plotting. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause from itertools import product as iter_prod import collections from collections import namedtuple import numpy as np class PTuple(collections.abc.Sequence): def __init__(self, *args): s...
0ec700eadd2fd43cc7b7e5994c8118f3c80525f14d2ed40aced16e138168fe44
Python
12,155
289
import numpy as np import torch as tc import torch.nn as nn from argparse import Namespace import os class RNN_Model(nn.Module): def __init__(self, args: Namespace = None): super(RNN_Model, self).__init__() if args is not None: self.args = args tc.manual_seed(args.run) ...
f3f25c4febf64d01ef42f967dc5cf10f6856bf3aa92d26f09803ad408169da9b
Python
12,164
284
import argparse from pkg_resources import resource_filename from pangolin.model import * import vcf import gffutils import pandas as pd import pyfastx # import time # startTime = time.time() IN_MAP = np.asarray([[0, 0, 0, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0...
703ddd7ca318d8de48bfb353e5f81f3578ef4d08ebdd7be6580f260ec5049217
Python
12,166
347
""" Implementation of Spin permutations. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause import numpy as np from scipy.optimize import linear_sum_assignment from scipy.spatial.distance import cdist from scipy.spatial import KDTree from sklearn.utils import check_random_state from s...
3bd9ee948e8d4638e6171fbc97c22757e428ff05c86ae36a7cd7bffd9eb5914f
Python
12,171
344
"""Base Scenario class.""" from __future__ import annotations import warnings from collections import defaultdict from collections.abc import Sequence from functools import partial from itertools import count from typing import Any, ClassVar import numpy as np import pandas as pd SeedLike = int | np.integer | Seque...
4370a06a7fef79ba00780f7e5d0f9854cccf70b26bf8168e36a21be09ac1cf2d
Python
12,185
298
# Copyright (c) Facebook, Inc. and its affiliates. from typing import List import fvcore.nn.weight_init as weight_init import torch from torch import nn from torch.nn import functional as F from detectron2.config import configurable from detectron2.layers import Conv2d, ConvTranspose2d, ShapeSpec, cat, get_norm from d...
dcbfbc4760dcc5ffadc4a7ea32bb1f1800f8f42ecc31feed68417c9c0267d362
Python
12,195
351
# 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...
5aff7fd59a4d721b805dbd7d5b75a05ec2844094adcb63a53ef77dc1909c0a02
Python
12,198
358
from __future__ import division import munge_sumstats as munge import unittest import numpy as np import pandas as pd import nose from pandas.util.testing import assert_series_equal from pandas.util.testing import assert_frame_equal from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_allclos...
c5ce73743ba8be141e2cbe0b065f0852275365f0265380ce46531c0fb454e33a
Python
12,199
287
# Copyright (c) Facebook, Inc. and its affiliates. import itertools import logging import math from collections import defaultdict from typing import Optional import torch from torch.utils.data.sampler import Sampler from detectron2.utils import comm logger = logging.getLogger(__name__) class TrainingSampler(Sample...
c0f65b5b8e871fb6b65996d301213e636bd7993614b91ed6a9706a4acb959c1f
Python
12,232
275
from __future__ import annotations from time import sleep from typing import Optional import logging import numpy as np from concurrent.futures import ThreadPoolExecutor, Future, wait from queue import Queue from threading import Thread from .data_io import load_dat_basics from .motion import prepare_tcl_data from .ut...
c788495d09a957f5b8e07d424af8dbffdebde191618146af1ec641b9b667bb0d
Python
12,260
383
"""Data loading and I/O operations for imaging datasets. Created on January 21, 2026 @author: dcupolillo """ from __future__ import annotations from pathlib import Path import numpy as np import flammkuchen as fl from spyne.core.imaging.load import ( load_metadata_from_tiff, load_imaging_data_from_tiff) class I...
d94bfc818bffd42f391bbde687212c64c9e40030731d87d0c98e530de2e8200d
Python
12,269
274
import os import numpy as np import pandas as pd import umap import matplotlib.pyplot as plt import anndata as ad import scanpy as sc import scvelo as scv import scanpy.external as sce from scipy.io import mmwrite, mmread np.random.seed(42) # peak-gene linkage matrix dir_path = "/home/nomura/Proj/mmvelo/data/10x_mult...
9d27d729b771edc3bc57f2d0140fffd0d314896638b0560aa6d0bc5b43031748
Python
12,283
200
import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt import anndata as ad import scanpy as sc import scvelo as scv 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_...
e3c592d36851dca5f76ad363b2229b406b5ddd29c07d048566dd36c03b53506a
Python
12,305
381
from __future__ import annotations import platform import re import subprocess as sp import sys import tempfile from pathlib import Path from typing import Any, Final, Literal, TypedDict import copier import more_itertools as itx import pathvalidate import pytest import requests_mock from hypothesis import HealthChec...
02cfdd25ecdb895a4ffe055418af04449107518fc65764dfbd04d6d9614e800a
Python
12,307
341
#!/usr/bin/env python # Copyright 2016-2019 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...
0f8b1aa40bfb0f4a35283701259315a549ff5bba9ad3d273499ca1fd67c89709
Python
12,310
345
""" Created on 10/08/2017 @author: Niklas Pallast Neuroimaging & Neuroengineering Department of Neurology University Hospital Cologne """ import sys,os import nibabel as nii import numpy as np import nipype.interfaces.fsl as fsl import glob import shutil #makes sure to import bet.py sys.path.insert(0, os.path.abspat...
ba3aac23bf471967ad77535ee6c51bed2b0b93083a0a64d83789a8e279116bb0
Python
12,330
325
"""Tests for the per-worker thread cap in `navis.compute.threads`. navis spreads work over processes; navis-fastcore (and BLAS, and OpenMP) spread it over threads. Nothing tells a worker that it is one of twenty, so without a cap the two multiply - 20 workers x 224 threads over 224 cores, which measured *slower* than ...
9c00fcc7d3951382d67b54ec25803a667174a10afa04272eea42e94eb724fefb
Python
12,336
337
from copy import deepcopy import navis import numpy as np import pandas as pd import pytest def test_deepcopy(): nrn = navis.core.BaseNeuron() deepcopy(nrn) @pytest.mark.parametrize("op", ["mul", "truediv", "add", "sub"]) def test_mesh_math_connectors(op): """Arithmetic must not choke on integer conne...
40f63bb6c982a96e4978b679bb52efbf21782bddc52eea306c1eb2325da51eba
Python
12,353
184
# AUTOGENERATED! DO NOT EDIT! File to edit: 44_inference_summaries.ipynb (unless otherwise specified). __all__ = ['posterior_dict_to_table', 'invert_dict', 'construct_summary_dict', 'model_fit_summary_to_table', 'construct_target_summary'] # Cell from ..utilities import progbar from arviz import psislw imp...
98f7731353faeab501a05d6b6a5c676cf40a195fe7e2563be605e287dda2a7ce
Python
12,376
349
"""Tests for `Mesh.extra_edges` - edges that are not part of any face. These express connectivity that the mesh surface itself does not have (e.g. bridges between disconnected fragments). Two things need testing: that the edges survive the things we do to neurons (storage/invariants), and that the code deriving connec...
ba67411882aa6ebe580049d5f6d3246368060aee8d87e2639870e47a56fcf963
Python
12,378
314
import numpy as np from sklearn.linear_model import Lasso, LogisticRegression class ALasso(Lasso): """Implementation of the adaptive lasso algorithm (ALasso). This weighted Lasso updated weights iteratively. The implementation structure is inspired by the sklearn implementation of the Lasso algorithm. ...
826072899229a95042adb024eca3fb2b11f2e5c58c8286237bd6d67047a77264
Python
12,382
321
# 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...
35ce2b03d6d4490a58dbce04de24cfa1051cf7218e78446c447ff66e28d9fd9e
Python
12,384
286
""" calculate_dice - Segmentation Overlap Measurement Tool Part of the micaflow processing pipeline for neuroimaging data. This module calculates the DICE coefficient (Sørensen-Dice coefficient) between two segmentation volumes. The DICE score is a statistic used for comparing the similarity and diversity of s...
f30ff521b0ddb06679d131a64189ac0889d2a89bc247d4cd4dc722969bbac44e
Python
12,397
336
# # Copyright (c) 2023 10X Genomics, Inc. All rights reserved. # """Code to make a VDJ reference.""" from __future__ import annotations import collections import hashlib import os import shutil from typing import AnyStr import pysam from six import ensure_binary from cellranger import constants as cr_constants from...