sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
82bdb8acfe276a605867b48870816e8ed3c57af898fc13907450a2c2f98d4e8e
Python
10,532
326
import warnings from collections.abc import Iterable, Sequence from dataclasses import dataclass from pathlib import Path import pytest from torch import nn from torch.utils.data import DataLoader import eir.models.models_utils import eir.train_utils.accelerator from eir import train from eir.experiment_io.input_obje...
b8cebe285f4b3a23f32298efa722c2002e1009c5db70e64586019a04d8383d62
Python
10,533
222
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Agatha Schmidt, Henrik Zunker # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complian...
3499e482168647cdaa7255d5d9cc70bf885a0375807004d98e0d1acc8e98ad28
Python
10,535
252
#!/usr/bin/env python3 """code2_dvh_plot_and_summary_fixed.py – rev 2025‑07‑13‑b ======================================================== Complete, runnable version after truncation issues. Highlights (compared with 07‑12 build) -------------------------------------- * **No‑overlap cDVH labels** for D̄, Dₘₐₓ, D...
c93e95a4048b9c69816413bf01b724992a5c676d99a95b2a20fb1419c193f809
Python
10,537
254
""" Supplementary Figure S6: Myelin water fraction dependence in SpinWalk simulations Investigating the effect of myelin compartment proton density weighting on bSSFP signals and qMRI estimates: - (A) Magnitude profiles at θ=90° for different myelin weights (0, 0.25, 0.5, 1.0, 2.0, 5.0) - (B) Phase profiles at θ=90° ...
5c21d79f90825a451fdb0d6a0ca3e99b481096d7501f06ddebd172306ac55439
Python
10,538
250
# /------------------------------------------------------------------------------+ # | 24-OCT-2022 | # | Copyright (c) Bone Imaging Laboratory | # | All rights reserved ...
fdcfec254b1b3fbfe7885e705b9fcaaba72fa07156bfdc42470fb74b05faef26
Python
10,543
310
from copy import deepcopy from typing import Any, Callable, Dict, Optional BACKBONE_CLASS = "backbone_class" LOSS_CLASS = "loss_class" METRIC_CLASS = "metric_class" MODEL_CLASS = "model_class" DATA_AUGMENTATION_CLASS = "da_class" DATA_LOADER_CLASS = "data_loader_class" FILE_LOADER_CLASS = "file_loader_class" KNOWN_CA...
1a07025a12cb7cc473459c95f09a9c0fca5bd2e6c5c7efaa52c7060091e7f858
Python
10,544
279
from typing import Any import numpy as np import torch import torch.nn as nn import seisbench.util as sbu from .base import WaveformModel class Skynet(WaveformModel): """ Skynet is a phase picker with a U-Net architecture with a focus on regional phases and a long receptive field. The model offers firs...
7bd5e0c7ffc200902512368e271ff09c49bcbac1752b75f3dd9e581edd47930f
Python
10,547
214
#!/usr/bin/env python """ Camera control specialized for a Hamamatsu camera. Hazen 09/15 """ from PyQt5 import QtCore import storm_control.sc_hardware.hamamatsu.hamamatsu_camera as hcam import storm_control.sc_library.parameters as params import storm_control.hal4000.camera.cameraControl as cameraControl ...
f9f90d8cd25c3e371f20d9503138257caae316472c9e0394385b933870f76c2b
Python
10,548
298
import argparse import torch import torch.nn.functional as F from torch.utils.data import DataLoader from torch_sparse import SparseTensor import torch_geometric.transforms as T from torch_geometric.nn import GCNConv, SAGEConv from ogb.linkproppred import PygLinkPropPredDataset, Evaluator from logger import Logger ...
5ef98e085eef2bf937cba80033483d8a4677846c4b74cf19e381c5e2dc955e36
Python
10,550
322
#!/usr/env/bin python # -*- coding: utf-8 -*- # Author: Torbjørn Ness <torbjorn.ness@nmbu.no> """ NEURON and Python - Creating a multi-compartment model with synaptic input with randomized activation times """ # Import modules for plotting and NEURON itself import matplotlib.pyplot as plt import neuron import numpy as...
9b3020e24835e4f289b413d516b1be0df69766ffb331be050ad3b1a8e9e1cd61
Python
10,551
245
import os import time import numpy as np import Utils.config_stomach as CONFIG from argparse import ArgumentParser from torch.utils.data import DataLoader from prefetch_generator import BackgroundGenerator from sklearn.metrics import confusion_matrix from sklearn.metrics import roc_curve, auc, f1_score from tensorboard...
d9ab2a89bc2ac929449c489241b0a0cdede25b20285315d261592855214163ec
Python
10,551
288
from __future__ import division import os import nipype.pipeline.engine as pe from nipype import SelectFiles import nipype.interfaces.utility as util from nipype import IdentityInterface from .utils import * def create_bullseye_pipeline( scans_dir, work_dir, outputdir, subject_ids, name='bullseye...
d47e7a1b875339fa0f4277f1ae9c642404a424bf58b1061dafea272b0f4f8b0e
Python
10,553
254
# -*- coding: utf-8 -*- """ Analyses of the EMPRISE data set by Joram Soch <soch@cbs.mpg.de> """ # import modules import os import time import EMPRISE import NumpRF import numpy as np import scipy as sp import pandas as pd import nibabel as nib import matplotlib.pyplot as plt ### Simulation C: NumpRF/popeye results...
9c9fc7d1838c6a71056561202fafb2286536e51388a15c17a3af5b4f624878ec
Python
10,559
196
import pandas as pd from skimage import io as skio from skimage.morphology import closing, cube, label from sklearn.metrics import jaccard_score from napari_simpleitk_image_processing import label_statistics from tqdm import tqdm import numpy as np import os from glob import glob import json from natsort import natsort...
d99693b46806730a7f68d64830474c01a09164c4a9386bdf4288a64d56102627
Python
10,561
320
#!/usr/bin/env python3 """ Script to identify inheritance Usage: ./process_DC_output.py --merge_map --disc_curve variants_bg_ALL-sv_insdel.tsv.gz -t 10 Author: Mei Wu https://github.com/projectoriented """ import pandas as pd import numpy as np import re from itertools import groupby, repeat import argparse import sys...
84a95a285fee19eace9cad43b7df2351804565c118631acd9342fea7aa5d3bda
Python
10,563
317
import os import sys from os.path import ( dirname, isdir, isfile, pathsep, realpath, ) from os.path import ( join as pjoin, ) import dipy.core.gradients as dpg import dipy.data as dpd import dipy.io as dio import nibabel as nib import numpy as np import numpy.testing as npt from dipy.sims.voxe...
5e24cfecec02e8732eb9c0c70d05e9d53d659bbd9454aee8a3a9f50eb18fa593
Python
10,564
273
import os from time import time import numpy as np import torch.nn as nn import torch.nn.functional as F import torch import torch.backends.cudnn as cudnn #from torch.utils.data import DataLoader from monai.data import DataLoader from dataset.kidney_dataset import KidneyData from dataset import transforms #from tqdm im...
6a6c4c8bff25458e5bf9c94df16dcd7bfc446d663b89e64941cdb6cbb497a382
Python
10,571
334
import itertools import numpy as np import torch import hydra from scipy.spatial.distance import pdist from scipy.spatial.distance import cdist from hydra.experimental import compose from hydra import initialize_config_dir from pathlib import Path import smact from smact.screening import pauling_test import sys sys....
0a58befb76bd261ff7baa1f992d8e96eb06be46cea33120e83f56f82dd9a61fa
Python
10,574
221
import os import numpy as np import h5py import yaml import sys import matplotlib.pyplot as plt from glob import glob pathpath = 'PATHS/filepaths_IBLTuning.yml'# myrun = 'runIBLTuning_utypeP' dset = 'IBL' fformat = 'svg' dsdir = 'IBLPATH' dstdir = '/results/paper/tuningIBL/pfcOnly/%s'%myrun with open(pathpath, ...
6fb8490b6b472f2495e9033f5a03c2e006b6882174baf679902fec2746c02f88
Python
10,574
214
from bread.algo.tracking import AssignmentDataset from skorch import NeuralNetClassifier from torch_geometric.loader import DataLoader from torch_geometric.data import Data import numpy as np, scipy.optimize, scipy.sparse from typing import List, Union import torch __all__ = ['AssignmentClassifier', 'GraphLoader','see...
77eb602c43ccc2e06f4a55040c1485fdeaf8e2578ef772c6fe76edc432e71aad
Python
10,576
261
import os import numpy as np import pandas as pd from nipype.interfaces.base import ( BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, traits, ) from cvdproc.pipelines.network.network_measures import ( load_connectivity_matrix, compute_global_efficiency, compute_local_efficien...
ad364ecb75c6e7c738ff9a2a048c0b5d8f7536951c3849dd50b52a8d0aabf77c
Python
10,579
285
""" Encodes data in different formats """ from os.path import join import argparse import numpy as np import pandas as pd from sklearn.preprocessing import OneHotEncoder import constants def enc_aa_index(int_seqs): """ encodes data in aa index properties format param: int_seqs: integer encoded se...
76ff51cbe7d2431f898c9e097d107ca271f1916ef121adc46a016181460f21ee
Python
10,582
286
"""Tests for mcmlnet.training.data_loading.sota_data_classes module.""" from itertools import product import pytest import torch from mcmlnet.training.data_loading.sota_data_classes import ( SOTADataset, SOTAPreprocessor, ) class TestSOTAPreprocessor: """Test cases for SOTAPreprocessor class.""" @...
9a2c449ea45b9b50bf5f326e9e732b95d196a1e5495559ea94201593306491a3
Python
10,583
296
"""Build Academy action tools and attach configured science tools.""" from __future__ import annotations import pathlib import time import asyncio from collections.abc import Callable, Mapping, Sequence from typing import Any from academy.handle import Handle from langchain_core.tools import BaseTool, StructuredTool...
57c070572be0a40f16c2547d0a66a3ddc496640130ad00e7aeff255634c96d3d
Python
10,585
321
from typing import Any, Callable, Dict, List, Optional, Tuple, Union import matplotlib.pyplot as plt # type: ignore import numpy as np from adjustText import adjust_text # type: ignore from anndata import AnnData # type: ignore from matplotlib.axes import Axes # type: ignore from mpl_toolkits.axes_grid1 import mak...
83192b2135c68c23ab33d2186aa5cee4de3787573ea31130f41a64b1845a0593
Python
10,586
299
import pickle from pathlib import Path from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np import pandas as pd import scipy.ndimage import tifffile from tqdm import tqdm from brainways.pipeline.brainways_pipeline import PipelineStep from brainways.utils.io_utils.image_path import ImagePath if ...
8d05dd20a04c87b158aca6d4dd968450f39b3bafb374652afbc24067f9b4638a
Python
10,586
235
from qtpy.QtWidgets import QPushButton, QWidget, QVBoxLayout from magicgui import magicgui from magicgui.widgets import FunctionGui from napari.qt.threading import thread_worker import numpy as np import pandas as pd import json from natsort import natsorted from skspatial.objects import Line, Points # scikit...
4d1df19774d557d27027c29e5beb9c1343f46c9cf20154bb25e4ca7b17bf0c9b
Python
10,590
332
import asyncio import json from types import SimpleNamespace from unittest.mock import Mock, patch import pytest from langchain_core.messages import AIMessage from chemgraph.agent.events import SUBAGENT_METADATA_KEY from chemgraph.agent.llm_agent import ChemGraph from chemgraph.agent.turn import _TurnEventCallback fro...
6649cde7fa6c4cbc13a2d71f8c1293e85a358e1d18022ce1b9d39056067f0b3e
Python
10,590
207
from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, roc_auc_score from torch_geometric.nn import HGTConv import pytorch_lightning as pl from torch import nn import torch from Dataset import BotDataset from torch.utils.data import DataLoader import argparse from torch.optim.lr_scheduler ...
497e2fe818c2870a0141031a89efcf4d86a3e2aac96a7bd7557611020f588e57
Python
10,601
262
from graph_tool import load_graph import numpy as np from pycurv import TriangleGraph, io from scipy.spatial import cKDTree from scipy.spatial.distance import cdist import time import pandas import vtk from sys import argv from os import path from time import sleep folder = "/gpfs/group/grotjahn/bbarad/Final_Dataset...
cf0bc718517d8f2e6e697b3a6f55fdf41413a1f5a39702c884bffd28df2d6146
Python
10,601
292
import sys import os import pandas as pd import pyreadr import torch import glob import functools from torch_geometric.loader import DataLoader import torch.nn.functional as F from torch.nn import Linear from torch_geometric.nn import GCNConv from torch_geometric.nn import global_mean_pool from torch_geometric.data imp...
20f4c114ce2bfdfda50fdaf78be31dcb521af66964e59a29aa032628b091cbaa
Python
10,604
311
from unittest.mock import create_autospec, patch import pytest from torch import nn from torch.optim import SGD from torch.optim.adamw import AdamW from torch.utils.data import RandomSampler, SequentialSampler, WeightedRandomSampler from eir import train from eir.data_load.data_utils import get_finite_train_sampler f...
912669b64df77ebc78231e42ec341d7495007290ebec34213d28da919ab33558
Python
10,604
228
# Kai Sandbrink # 2023-10-07 # This script is used to simulate data corresponding to perturbed participants # %% LIBRARY IMPORT import numpy as np import pandas as pd import pickle import os, copy from tqdm import tqdm from utils import get_timestamp, Config from utils_project import load_config_files from test_case...
d5d1be901dfd0ded0c8c55b329453f4306adc3913abd4771bde4120ae8fae160
Python
10,605
311
from unittest.mock import create_autospec, patch import pytest from torch import nn from torch.optim import SGD from torch.optim.adamw import AdamW from torch.utils.data import RandomSampler, SequentialSampler, WeightedRandomSampler from eir import train from eir.data_load.data_utils import get_finite_train_sampler f...
698aca8bd5368e9b02a996b18599301730adab9da87470dd39a6b4e60fdda48a
Python
10,611
303
# This file is part of Zennit # Copyright (C) 2019-2021 Christopher J. Anders # # zennit/cmap.py # # Zennit is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at your o...
23e4f0b740866989259d4f38878cca8acb82a6c21231cc46d237388dfd071856
Python
10,613
334
import unittest import logging import numpy as np import diffxpy.api as de class _TestSingleDe: def _prepare_data( self, n_cells: int, n_genes: int, noise_model: str ): """ :param n_cells: Number of cells to simulate (number of observations pe...
683113738f248f6b4290ae95cb8df9c4d57560a11b1ce0ec83ccaf824a15cd31
Python
10,615
265
import os from time import time import numpy as np import torch.nn as nn import torch.nn.functional as F import torch import torch.backends.cudnn as cudnn #from torch.utils.data import DataLoader from monai.data import DataLoader from dataset.kidney_dataset import KidneyData from dataset import transforms #f...
3882a873d2e4e125e2d79ca2a929c5bd3ac65c42ce7a4ba37a864c7fe58e19c8
Python
10,619
309
import scanpy as sc import numpy as np from sklearn.utils.extmath import randomized_svd from scipy.sparse import csc_matrix, csr_matrix from typing import List import anndata def set_seed(seed): random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.backen...
a298b6eb7d75aae56a21d15822092dc646b6e054859d706c9c060cb5b9d37498
Python
10,620
219
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from typing import Any import numpy as np from .basetrack import TrackState from .byte_tracker import BYTETracker, STrack from .utils import matching from .utils.gmc import GMC from .utils.kalman_filter import Kal...
d01e172f99a9cc94b4d5f8e592d52429ec15e8c9e2c1f1a736a3b3a064e01cf2
Python
10,624
294
import numpy as np import bisect def select_neg_pairs(fold, chrom_pairs, curr_counts): selected_pairs = [] shortage = [0 for _ in curr_counts] for k in range(len(chrom_pairs)): chrom_pairs[k] = list(chrom_pairs[k]) if len(chrom_pairs[k]) <= 0: continue if curr_counts[k]...
2f40491719b4f8164ae7226cdd4bdaaf45c1b205e1fbeeafb35c1e8326d9dd3e
Python
10,627
345
"""Extracting ERAs from ROIs""" import nibabel as nb import numpy as np import os import glob from nilearn import signal import pandas as pd import seaborn as sns import matplotlib.pyplot as plt ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti/derivatives' # Set subjects to work on subs = ['sub-05', 'sub-06', ...
4a5adf04c5f9c1f3e969855d6db2feaaa9314a9b3eca932170d2347e6c2189bc
Python
10,629
264
""" This script converts the output from predict_DANNCE into a predescribed structured data format, with meta data, that can be used easily by our downstream analysis pipeline Usage: python path_to_file/makeStructuredData.py path_to_config [cross_corr?] the optional boolean argument cross_corr indicates whether a cro...
a6c8b36218d70a5d0323a36e9c7aa823b0834bf4224c8263ae33542bce2df1a3
Python
10,629
313
from __future__ import annotations import importlib import multiprocessing import os import shutil import tempfile from multiprocessing.connection import Connection from multiprocessing.process import BaseProcess from multiprocessing.synchronize import Event from pathlib import Path import osam from PySide6 import Qt...
25b5b21eac15057dafec0ba9ad2cce1870642cbd4d6916ef531d6565718bc123
Python
10,630
359
""" Practical Examples ------------------ In the example below a ``server`` distributes ``data`` to ``workers``. The workers process each data item individually and send results back to the server. After all data has been processed and send back, the server has all results in correct order. >>> from celldetection imp...
29560bfce95c972258e3ea4e00651f00a18bf84121e2b5be049890290d9ad9ab
Python
10,632
275
# fmt: off # flake8: noqa import copy import os import pickle import time import traceback from functools import partial from multiprocessing.pool import Pool import numpy as np from . import _timing, utils from .config import get_default_eval_config, init_config from .utils import TrackEvalException class Evaluat...
1a34df86e8bcfbe1a3a3c940ab86fdb5d585eff86bb0806e59a7e5af69350496
Python
10,633
293
# Copyright 2024 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
1b91064ed4a8dd5c2df53e89f0c47f51c43ae7833b9a2a8d2f018d11fc96a15a
Python
10,633
249
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Projects metrics onto the underlying voxels of a streamlines. This script can project data from data_per_point (dpp) or data_per_streamline (dps) to maps. Projection in a given voxel is done by averaging the value of all streamlines with a point in that voxel. Optional...
cdaf282a3ce2e77335015d30674e0fe6b86ba15da7b350e505ba7a18e3cc0b0e
Python
10,633
253
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to estimate the diameter of bundle(s) along their length. See also scil_bundle_shape_measures, which prints a quick estimate of the diameter (volume / length). The computation here is more complex and done for each section of the bundle. The script expects: - b...
911fe7ce00352d68c4091340ed8d75269acccc7e139c1d86c3a7b54f2af4d9b2
Python
10,636
242
# -*- coding: utf-8 -*- """ Functions to detect spots in images The main routine :func:`detectCells` uses a difference of gaussian filter (see :mod:`~ClearMap.ImageProcessing.Filter`) followed by a peak detection step. Example: >>> import os >>> import ClearMap.IO as io >>> import ClearMap.Settings as...
463c39fd473ef537cf78d17d8d8e38fa748f9a6c06dfa9e595472ec0df744535
Python
10,637
250
# -*- coding: utf-8 -*- """ EPI <-> EPI <-> ANA registration The purpose of the following script is to compute the deformation field for the registration between antomy and EPI in native space via a registration between two EPIs and application of an already existing EPI <-> ANA deformation. The mask should be in ana ...
c9674623e9fe1be9b3ebe6246d67480f294c0dee94786a80b3774adb5306d128
Python
10,639
173
import pandas as pd import glob2 import matplotlib.pyplot as plt import matplotlib matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 from matplotlib_venn import venn3, venn3_circles import os import numpy as np import seaborn as sns import argparse """ python src/plot_encoding_venn_exte...
851afe4679e5ddf7bbaf132b8d1f30864a232ec217e1c10fcc5f18e7440a62d4
Python
10,640
285
"""Pure-Python molecular docking helpers (no LangChain / MCP decorators). Docks a small-molecule candidate into a receptor with AutoDock Vina and returns the predicted binding affinity and poses. Used by the LangChain ``@tool`` wrapper in :mod:`chemgraph.tools.docking_tools`. Heavy/optional dependencies (``vina``, ``...
a6e1b24c8fce9d20ef9b04b4cd60f51d725024d71a564e1e1d2c2fb97c8982a2
Python
10,645
299
# -*- coding: utf-8 -*- """Volume utilities.""" import os import nibabel as nb import numpy as np from scipy.ndimage import distance_transform_edt from .. import execute_command from ..io.filename import get_filename __all__ = [ "remove_bias_ants", "robust_combination", "include_pial_correction", "e...
ac4684498bc1660088d4ca8c7748fa78b87a2aada2b3004f8c4819f9c5384ed4
Python
10,645
326
"""Hidden Markov Model (HMM) with a Possion observation model.""" import logging from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import tensorflow as tf from tensorflow.keras import layers from osl_dynamics.inference.layers import ( VectorsLayer, SeparatePoisson...
2e05b90601af73f9dc4136f3ccc1f5a551fe6b99029a3373f032cb888c3697a0
Python
10,646
297
import pytest import numpy as np import SimpleITK as sitk import torch from pathlib import Path import logging # Import FireANTs components from fireants.registration.moments import MomentsRegistration from fireants.io.image import Image, BatchedImages try: from .conftest import dice_loss except ImportError: ...
05321af2f710248c70bb5092b5d32971cbfbea12519517036e34f70d103fab5e
Python
10,647
206
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import plotting_related_functions import KC_population_calcium_rate_model_functions as mdl import os import pandas as pd from tqdm import tqdm import itertools as it rng = np.random.default_rng(420) # Set random seed ext...
c53a005ca58f98bfd8c3a624baedbecfb1481c657a5ab9bddc2dfb37b7b094b9
Python
10,648
296
import numpy as np import matplotlib.pyplot as plt import json import os import pandas as pd import matplotlib as mpl # PDF font settings: Use TrueType fonts to prevent font conversion issues mpl.rcParams['pdf.fonttype'] = 42 # Font configuration - Ensure proper font embedding in PDF mpl.rcParams['font.family'] = 'sa...
f11a5d1286099893c406bd119721029a49fe9c100823ea26f0b844f7193a29ff
Python
10,649
301
import json import argparse from chemgraph.tools.ase_tools import ( run_ase, save_atomsdata_to_file, ) from chemgraph.tools.cheminformatics_tools import molecule_name_to_smiles, smiles_to_atomsdata from chemgraph.models.ase_input import ASEInputSchema import datetime import subprocess import os def get_smiles...
2348f94fc989975a4f2fb0a694346e346b0eb73f94a43fce99325e3ba45b651b
Python
10,650
322
#!/usr/bin/env python from __future__ import print_function import defopt import sys import os import logging from pathlib import Path from typing import Optional import mokapot # version 0.9 from xgboost import XGBClassifier # version 0.82 # required for rust package import pandas as pd import numpy as np import xgb...
745e2029fe92bda6f5631cfe4f7acff1243f1b1f460a5c0dd1a8f122a40d9cb3
Python
10,658
200
from qtpy.QtWidgets import QLabel,QGraphicsScene,QFrame, QGraphicsItemGroup, QGraphicsPixmapItem, QGraphicsEllipseItem from qtpy.QtGui import QColor, QPen from qtpy.QtCore import Qt from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.view.QGraphicsViewerMT import QGraphicsViewMT from napari_dmc_brainmap.reg...
382deacbe86f229c8c0ce1e697c36cbe9d3213edd233b7cbe9e8e93f3d868d0e
Python
10,660
203
import nighres import os import nibabel import numpy import glob import scipy.ndimage inpath = '/home/pilou/Projects/Cerebellum/Cerebellar-segmentation-ABC/' in_sfx = 'nighres/coreg/' out_sfx = 'nighres/tissues/' t1map_sfx = '_anat_inv1_s2c10_lcpca-den_qt1map-t1_cr_def-img.nii.gz' cbprior_sfx = '_anat_inv1_s2c10_lcp...
ae4aac65f246f0dc5ffa359f502a714a27c7dc9eb9713fcfc35d56f6737638ce
Python
10,664
243
import json import logging import nrrd import numpy as np import argschema as ags import skeleton_keys.full_morph as full_morph import skeleton_keys.drawings as drawings from neuron_morphology.swc_io import morphology_from_swc, morphology_to_swc from allensdk.core.reference_space_cache import ReferenceSpaceCa...
f11ab48706fad2307aab36815d9ea5fce3316211d1c7791981585d30e8e75d9b
Python
10,666
245
import numpy as np import importlib.metadata from datetime import datetime from concurrent.futures import ProcessPoolExecutor, as_completed from encore.utils.metrics import compute_similarity_matrix def run_single_session( args: tuple[str, str, dict[str, np.ndarray], dict[str, str], dict, bool, list[str]], ) -> t...
f3f3594e6953e163bd4602b1a5251046ddeb6d5c055111796d258e3e57ce2e30
Python
10,667
273
import warnings from typing import Any, Dict, Optional, Union import torch from torch import Tensor from torch_geometric.explain import ( ExplainerAlgorithm, Explanation, HeteroExplanation, ) from torch_geometric.explain.algorithm.utils import ( clear_masks, set_hetero_masks, set_masks, ) from...
62d0d37ec2b2e62496aa9ca98a33509297aa8b1ce15f0bc625c0f0f8eddc9c68
Python
10,675
235
import pickle import tkinter as tk from tkinter import * from PIL import Image, ImageTk from tkinter import Button import pandas as pd from tkinter import filedialog import cv2 import os import numpy as np import random import glob import json from tkinter import simpledialog from SelectionObject import SelectionObject...
075d4b6e9ce19b457c85703ace90322239160f4b082037f5686b8b063c8b95e6
Python
10,676
289
import torch from torch import nn import torch.nn.functional as F import pytorch_lightning as pl from torch_geometric.nn import GATConv from transformers import AutoModel from sklearn import metrics from sklearn.metrics import f1_score, precision_score, recall_score import numpy as np # cuda = torch.device('cuda') cl...
2baf297d6d49b14289a009b39be3a41cfb5291a67cda2660c3c356fd72ac8b8a
Python
10,679
242
import argparse from argparse import Namespace import torch import torch.utils.data from tqdm import tqdm from mdanalysis.dataset import MDAnalysisDataset, collate_mda from model.eghn import EGHN import os from torch import nn, optim import json import random import numpy as np parser = argparse.ArgumentParser(descri...
42255f8154ba5d1834c65c064f2afec758176de9c0eed924b7db2ce1f98c1c5d
Python
10,679
206
''' NaH2 ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for NaH2: P: potential energy, G: Gradient, D: Nonadiabatic coupling vector U: diabatic potential energy matrix UG: gradient of diabatic potential energy matrix This is listed at the end...
c4efd6f3a1aed89a60925eaae1815762829ea636a0b2162bd85117bd3c7f580f
Python
10,680
278
from typing import Optional, Tuple, List, Callable, Dict, Any, Union import os from collections import namedtuple import math import random import torch from torch.utils.data import DataLoader, Dataset import torch.nn.functional as F import numpy as np from atlaslib.io import stage_split_hdf5 from atlaslib.files im...
c1d74caf2f2f93fd390d42135617c961752557f0fc233e7468c05f2b84c408d4
Python
10,681
285
# /------------------------------------------------------------------------------+ # | 06-JUL-2022 | # | Copyright (c) Bone Imaging Laboratory | # | All rights reserved ...
0177ff1cf9f5fd94aea566a79f5c05c0fff8967c01e8fbe49021668eefe3d2d8
Python
10,687
261
# Copyright (c) 2026 Rohit Jena. All rightmss reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, ...
c28ce52546606379218673c75cf71f760ec29103f1750a0fa6246b82a9da0227
Python
10,688
257
import json import numpy as np import pandas as pd from typing import Dict, List, Tuple, Union from pathlib import Path from napari.utils.notifications import show_info from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.model.calculation import fitGeoTrans, mapPointTransform from napari_dmc_brainmap.utils...
038083716a0831c332caa6a000a7d979ee5dd071a7d053765c2a106d76e90c1f
Python
10,693
271
""" M/EEG: Sign Flipping ==================== Source reconstruction leaves the sign of each parcel (channel) time course arbitrary: the same parcel can have opposite polarity in different sessions. This is an identifiability problem in the source reconstruction of M/EEG that cannot be avoided. This matters when we po...
25ad360c0029951998f772ecfb18529cc5e1ae01739d3aa76ef4ac94dfcb83cb
Python
10,693
234
import os import h5py import numpy as np import math import csv from datetime import datetime def find_files_by_type(main_path, file_type='.h5', start_date=None, end_date=None, sort_dates=None): type_files = [] if start_date is not None and end_date is not None: # Get a list of all folders in the cu...
f7b6ef6c7a8d6727b70d442ef539472f2859d5b6ef91bb831f8dcdbba1f7668a
Python
10,699
302
import torch from torch import Tensor import numpy as np import glob import os.path import skimage.io as io from typing import Dict, List, Union from torch.utils.data import Dataset from tqdm import tqdm from typing import Tuple, Callable, List, Union, Optional # basically just skoots Transform = Callable[[Dict[str, ...
c9dabc409d20112da000126b90737e5f11d92ebe0936ea9793394494f8ef15bb
Python
10,703
307
import h5py import bisect import numpy as np import time CHANNELS_FIRST = "channels_first" CHANNELS_LAST = "channels_last" def get_point(values, pct): """ Pass in array values and return the point at the specified top percent :param values: array: float :param pct: float, top percent :return: flo...
0c9fc63ad9f03e643c1a92915300527f1d63d25361cec9dc42911fcc03e092aa
Python
10,705
335
import numpy as np from tqdm import tqdm import infomap import faiss import math import multiprocessing as mp from clustercontrast.utils.infomap_utils import Timer import torch def l2norm(vec): """ 归一化 :param vec: :return: """ vec /= np.linalg.norm(vec, axis=1).reshape(-1, 1) return vec ...
61a4bf68e05ca58be77b3787e4c0820375063e884366fec6114b88d9b72a634a
Python
10,708
260
import torch from .preprocess import preprocess_adj, preprocess_adj_sparse, preprocess, construct_interaction, \ construct_interaction_KNN, add_contrastive_label, get_feature, permutation, fix_seed import time import random import numpy as np from .model import Encoder, Encoder_sparse from tqdm import tqdm from tor...
dcb4e39c8b7883161eb5086bf47f019463a8a71ccde0023f30a1f2f98ca4a987
Python
10,712
365
# -*- coding: utf-8 -*- import logging from dipy.io.stateful_tractogram import StatefulTractogram from fury import colormap import matplotlib.pyplot as plt from matplotlib import colors as mcolors import numpy as np from scipy.spatial import KDTree from scilpy.viz.backends.vtk import get_color_by_name, lut_from_color...
04619ce6a3f06bc76799a9b3c9eb4f8093183c43c7cda8515da18930d945ad92
Python
10,714
242
import os import subprocess import shutil import nibabel as nib import time import numpy as np import pandas as pd from nipype import Node, Workflow from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory, traits, CommandLineInputSpec, File, TraitedSpec, CommandLine, Direc...
95f280dec12f02a80530d6cbe2fca0c87d9d9a27de9185033738093110b22704
Python
10,715
327
"""Globus authentication for ALCF inference endpoints, usable from the UI. Implements the same Native App OAuth flow as ALCF's official ``inference_auth_token.py`` helper (see https://github.com/argonne-lcf/inference-endpoints) so users can log in from the browser UI instead of running a script and pasting tokens: - ...
a1ac1b8c4ce4e28c1c2cdfec55867e8903f49a03df11bba53d92a962f1010a0d
Python
10,720
349
import collections from typing import NamedTuple, NewType, Final import numpy as np import polars as pl import scipy from scipy.interpolate import interp1d from typing_extensions import Self from neuralib.util.verbose import fprint from rscvp.util.cli.cli_io import get_headers_from_code, CELLULAR_IO from rscvp.util.c...
c60c89636f7186ffe42194cc670ffcc84c8dd5662cb80db417418e9715601365
Python
10,722
294
import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from typing import List, Union, Tuple, Optional kernel_size = 3 """ The Native Implementation of CPnet from Cellpose! Refactored for clarity and best coding style Will re-implement later... as of right now, its kinda hard to r...
94f2a14f08056512fe9d2f4caaeb66bc023d7ed2d1927e6f037f6fcfd55b8a85
Python
10,723
345
import json import random import torch import numpy as np import pandas as pd from jarvis.core.graphs import Graph from jarvis.core.atoms import Atoms from pymatgen.io.jarvis import JarvisAtomsAdaptor from pymatgen.core import Structure #from alignn.models.alignn import ALIGNN from alignn_multi import ALIGNN_ft #f...
8a8d72c672ec748a4e7a56fb42cf37ca684660496a6753976d4ad816c6ecdc5d
Python
10,727
291
import torch import torch.nn as nn import torch.nn.functional as F import math from torch_scatter import scatter from torch_scatter.composite import scatter_softmax from torch_geometric.utils import to_dense_adj, dense_to_sparse from einops import rearrange, repeat from xrdsol.common.data_utils import lattice_params_...
007e3818e9620b9f8263359e55a87dc3838bbf909fb5df156112f63b7136838a
Python
10,732
240
"""Solve a per-session offset for each chain, and stage the shifted ROIs. ROICaT cannot register this data itself (see the package docstring), so the offsets are solved here from the ROI footprints and applied before ROICaT sees anything. Three things about this are not obvious and each of them cost a full dataset run...
29f0a4c1fb51f20bd2e215b0409c4f65fd1393e75f189b7e1be68d6fe6b5b802
Python
10,735
279
#!/usr/bin/env python3 import sys import getopt import numpy as np import pandas as pd from skimage import io as skio ######################################################## # main logic function # def get_blastema(sample,prefix,ll,lr,rl,rr,exponential_number,wound_only): base_file = f'{sample}_masked.tif' l...
b4faf2d757fde9f11b8578a749efd438dbb99dffa6a621b4fc9ea7fbb948e918
Python
10,736
350
import os import gzip import numpy as np import nibabel as nib from scipy.io import loadmat from nibabel.streamlines import Tractogram, TckFile from nipype.interfaces.base import ( BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, ) from traits.api import Bool, Str # -------------------------...
5bed7fc1a4bf8003427781423b1f017aee79cda0ebba5332fc2993e6b93d47ae
Python
10,740
322
'''Configuration and fixtures for testing''' import random from itertools import product, groupby from collections import OrderedDict import pytest import torch from torch.nn import Conv1d, ConvTranspose1d, Linear from torch.nn import Conv2d, ConvTranspose2d from torch.nn import Conv3d, ConvTranspose3d from torch.nn i...
68e2b0fb282ef16221432c224bab4578daef3ded56ebbb258421daf772770a14
Python
10,742
260
from typing import List, Optional, Tuple import torch from torch import Tensor from torch.nn import Parameter from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.conv.gcn_conv import gcn_norm from torch_geometric.nn.dense.linear import Linear from torch_geometric.nn.inits import zeros from torc...
276e5579badb0dc6c4f900a74d679756b49e1b87f6df132861056802f0e75ca8
Python
10,743
292
import colorsys import random from pathlib import Path import matplotlib import matplotlib.colors as mcolors import numpy as np import polars as pl from matplotlib.axes import Axes from matplotlib.lines import Line2D from argclz import AbstractParser, str_tuple_type, as_argument, argument from neuralib.atlas.map impo...
a4d319076ebdce57c202237610c9f33a0ea9a38e1a40f5db1b7d0af43002fc51
Python
10,745
277
import pandas as pd import matplotlib.pyplot as plt from scipy.stats import spearmanr, kendalltau, linregress, rankdata from rpy2 import robjects from rpy2.robjects.packages import importr import rpy2.robjects.packages as rpackages utils = rpackages.importr("utils") # R's utils package utils.chooseCRANmirror(ind...
3133f0c613adbab433ecc950f7115167531f70df1eac159f41c538429fa24331
Python
10,751
299
""" Copyright 1999 Illinois Institute of Technology Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...
8efa20e5598af912e4670f0d937323718767e214261a1a9149141243a1b65ed8
Python
10,752
286
from typing import Any, List, Sequence, Union import torch from torch import nn from .utils import random_tensor # ---------------------------------------------------------------------------------------------------------------------- # -- NN utility functions ---------------------------------------------------------...
2746cc3860db993aa80dcb4baae80fcd16de75d4ff5b0465983307e77355b1ef
Python
10,753
262
# pytorch verison of mean field variational inference for sequence labeling # Author: Xinyu Wang # Email: wangxy1@shanghaitech.edu.cn import copy import numpy as np from enum import Enum import torch import torch.nn as nn import torch.nn.functional as F import pdb from .linear_functions import * import flair.nn class...
2882d7b02134dbe4606b66c3dd813953862140766a1464defc75a3f8a9222ac0
Python
10,756
264
# pytorch verison of mean field variational inference for sequence labeling # Author: Xinyu Wang # Email: wangxy1@shanghaitech.edu.cn import copy import numpy as np from enum import Enum import torch import torch.nn as nn import torch.nn.functional as F import pdb from .linear_functions import * import flair.nn class...
69b3bd70738f3b04303cfd6445f0d400fe897a63fbc11945dc51802eca6e6de9
Python
10,760
258
import re from scipy.io import savemat from sklearn.model_selection import StratifiedKFold from tqdm import tqdm from LocationRegressionHelper import * import time from numpy.random import default_rng import argparse import platform import numpy as np from pathlib import Path import requests print("Code is running o...
ac7cf235df41000b46b152534af574e7120f2548e5d016d2fe39a75fc4b04440
Python
10,760
283
# 1. Standard library imports import os import shutil import time import json # 2. Third-party imports import torch from torch import nn import numpy as np import pandas as pd from sklearn.model_selection import train_test_split import torch.utils.data as Data import torch.optim as optim import GP_WAITER as gp def l...
2f466e32b7d23603e804aa411caab93c40b125771ddfe294b16acdcf7fcc658b
Python
10,762
251
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 5 14:07:38 2024 This script was originally developed as part of Nagehan Demirci's Ph.D. thesis under the copyright CC-BY-NC-SA-4.0 at the University of Notre Dame in the CoMMaND lab under the supervision of Maria Holland. If you use this script in ...
7e025b0be3591c2e2cd79b7a6af7313d28583e4336e79a1d2b5c1180241d8d00
Python
10,762
277
import torch from torch import nn from torch.nn import functional as F from torch.nn import init from .pooling import build_pooling_layer class SeparableConv2d(nn.Module): def __init__(self,in_channels,out_channels,kernel_size=1,stride=1,padding=0,groups =1, dilation=1,bias=False): super(SeparableConv2d,se...