sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
f7f83b328368e013e81e6e44fc099808044e1a96a4c42e656ddfd5510501aa44
Python
12,872
297
# patched from https://github.com/shap/shap/blob/master/shap/plots/_beeswarm.py # to support multiple colormaps and specifying feature columns. # Summary plots of SHAP values across a whole dataset. from __future__ import division import warnings import numpy as np import scipy as sp from scipy.stats import ga...
013839745b4c36fbc3216a97e9161851a33233de95a1b63ef80309c54bf93c8c
Python
12,876
326
from typing import Optional, Tuple import torch import torch.nn.functional as F from torch.nn import Linear,LayerNorm from torch_geometric.loader import DataLoader from torch_geometric.nn import GraphConv from torch_geometric.data import InMemoryDataset # from torch.optim.lr_scheduler import StepLR import torch_geometr...
dfa033ccb2769c11e3f0b36590d6882f8a9448da6991625efa9eae902acac688
Python
12,879
238
from typing import Tuple import numpy as np import brainscore_vision from brainscore_core.supported_data_standards.brainio.assemblies import PropertyAssembly from brainscore_vision.benchmarks import BenchmarkBase from brainscore_vision.benchmark_helpers.screen import place_on_screen from brainscore_vision import load_...
fc958ebeec89018ffa20b690a4125bb31ab6608f11947196457d67e5fff28016
Python
12,879
277
#!/usr/bin/env python # author: Jannes Spangenberg # github: https://github.com/JannesSP # website: https://jannessp.github.io import numpy as np import multiprocessing as mp import pysam import sys from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace from os.path import exists, join, dirname,...
7020ae498f95557fe8f196631b7bdc1433c41520067f4b56826a51605564b8fd
Python
12,882
331
import os os.environ["CUDA_VISIBLE_DEVICES"] = "1" import argparse import torch import numpy as np import torchvision from backbones.synpoc_gen import SynPoC from dataset import CreateDatasetSynthesis from skimage.metrics import structural_similarity as ssim from skimage.metrics import peak_signal_noise_ratio as psnr ...
8e5f35905d38af6be51b13f90af94d8d35193ef6396194a6fd225ba22cd4a563
Python
12,883
432
from collections.abc import Generator, Iterable, Sequence from dataclasses import dataclass from functools import lru_cache, partial from typing import ( TYPE_CHECKING, Any, Protocol, ) import numpy as np import torch from timm.data.mixup import rand_bbox from eir.data_load.data_utils import Batch, get_ou...
00451da9fd9b75771a0fb9ef2db4775c2443a70e621af1724b4675de30216ead
Python
12,886
200
import os, collections import numpy as np from dataclasses import dataclass from typing import Any, Union, Callable, Dict # enum definitions SEX_MALE: str = 'm' SEX_FEMALE: str = 'f' SEX_NONBINARY: str = 'nb' SEX_UNDISCLOSED: int = '-' # enum definitions TYPE_PILOT: int = 0 TYPE_REGULAR: int = 1 # enum definitions ...
f2602544d375954f3f8b7d63ec93a0f6d11dcb60026c6a2b929ef434c75b628b
Python
12,886
380
#!/usr/bin/env python3 """ Robustness analysis for laminar gradients: - Vary number of gradients (n_components) from 5 to 25 - Recompute D_inter, D_Deep, D_Mid, D_Sup for each - Compute correlation matrices across gradient counts - Correlate D_inter/D_Deep/D_Mid/D_Sup with Margulies G1 and G2 to check how stable the ...
0caa8a4ea3acbb6a6b74953aa5a2aff7eb2eadc5b579762b290e9cedc4169345
Python
12,891
321
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved from __future__ import annotations from collections import OrderedDict from typing import Callable import torch from torch import nn from torch.utils.checkpoint import checkpo...
b12cbf15675d257641707a9a33cb72dba7878b1c2e9aed26ff609edce1006e1d
Python
12,901
338
# -*- coding: utf-8 -*- # modified from: https://github.com/jc2852/QQ-NET, # https://wcm.box.com/s/v1thrs0ezuuhb13cdho1xaoiu3bd9h5j, # the 'QQ_NET_test_simul.ipynb' file # Youjie Wang, 2025-08-24 import torch import os import torch.nn as nn from torch.autograd import Variable import matplotlib.pylab as plt import ma...
db9c55d65004808ce5e4f8065234123ec2c438546e9519ceb345b908fea51f77
Python
12,904
303
from pathlib import Path import json from typing import List, Union import pandas as pd from natsort import natsorted from napari_dmc_brainmap.utils.path_utils import get_info from napari_dmc_brainmap.utils.atlas_utils import ( analysis_ml_from_atlas_coordinate, coord_mm_transform, get_bregma, hemispher...
ceccad276a0a09b43fdaf84c45fbf42ff3e61795cc0fe02e8496c03f960ebb8e
Python
12,905
364
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import contextlib import math import warnings from functools import partial from typing import Tuple, Type import torch i...
c4f85c5d3ffbc5321e600d27a03a615a5e24643ebc7bb08b7c60de0f33c68d61
Python
12,908
242
# @thread_worker(progress={'total': 100}) # def do_presegmentation(input_path, params_dict, channels, single_channel, regi_bool, regi_chan, preseg_params, # start_end_im, mask_folder, output_folder, seg_type='cells'): # """ # Perform pre-segmentation on the provided image data. # # Pa...
81fc88122a0d4046382ef3c7752b40223a4eaf79b525dc508aecf3e4478293c6
Python
12,912
359
import json from copy import copy from dataclasses import asdict from pathlib import Path from typing import TYPE_CHECKING, Any import numpy as np from aislib.misc_utils import ensure_path_exists from eir.experiment_io.input_object_io_modules.array_input_io import ( load_array_input_object, ) from eir.experiment_...
35650f1b71f81710e074dd7957d902a5841b68d2ea7e0f6c3f450003fd678139
Python
12,915
283
# %% import numpy as np import pandas as pd import argparse from sklearn.linear_model import LinearRegression,Ridge,Lasso from sklearn.ensemble import RandomForestRegressor from sklearn.tree import DecisionTreeRegressor import numpy as np import matplotlib.pyplot as plt from scipy.stats import spearmanr,mannwhitneyu,pe...
bd02333201b73802e73eb117802ebcbcf12911cf5cbf37e323392e7c1bd0dce0
Python
12,915
344
#!/usr/bin/env python """ Postprocessing of MRI segmentation masks. Source: Harmening, N., & Miklody, D. (2022): MRIsegmentation, doi:10.5281/zenodo.7357674 (https://github.com/harmening/MRIsegmentation) and Andy's tools: Yu Huang, Jacek Dmochowski, Yuzhuo Su, Abhishek Datta, Chris Rorden, Lucas Parra: "Automated MRI...
d4833b4b39c3cba87041a9e8297761b017e0c2093df9c3ffafec8a02cadd1ec1
Python
12,920
362
import os import sys import time import json import numpy as np import pandas as pd from typing import Dict, List, Tuple, Any from dataclasses import dataclass, field sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) from src.llm_orchestrator.base_llm import BaseLLM from src.physics_validat...
7131bf6fa7b2314fd51908f5c8a6942bee9ced512ac5c93559658d11f5ecce54
Python
12,922
426
import os import random import sys from datetime import datetime import numpy as np import pandas as pd # camera recording import win32gui from psychopy import core, event, visual from psychopy.constants import FINISHED from psychopy.hardware.emulator import launchScan from pywinauto.application import Application ...
dde1a2a347819a57d8c28ef13609cc4b9ab39be8a75580b329583c856618a0b2
Python
12,926
332
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from subprocess import check_output,Popen,PIPE,STDOUT from .utils import * from tqdm import tqdm def get_archived_list(pref = labdata_preferences): preffolder = os.path.dirname(LABDATA_FILE) archived_files = [] if 'archives' in pref.keys(): if not pref...
87bc6eac330fc7f88d20c5b0049fddf5f3d1b60c1c50196e364fe91fc1d407b6
Python
12,930
275
import nighres import os import nibabel import numpy import glob import scipy.ndimage import ants indir = '/home/pilou/Projects/Cerebellum/Cerebellar-segmentation-ABC/ahead2/coreg/' outdir = '/home/pilou/Projects/Cerebellum/Cerebellar-segmentation-ABC/ahead2/tissues/' #bfimg = indir+'Ahead_brain_122017_blockface-imag...
9faabe01a860cb21edcd02b00aca9b5bdd43ad07db1195340f52b9ed5f588385
Python
12,938
306
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Register bundle to a template for screenshots using a reference. The template can be any MNI152 (any resolution, cropped or not) If your in_anat has a skull, select a MNI152 template with a skull and vice-versa. If the bundle is already in MNI152 space, do not use --t...
9ce37e473f829c6915c0b1d5c6cee8dcd4018c1092bbb114f2ba2ab21b172a2d
Python
12,940
319
""" MSI H&E Overlay & Tissue Annotation Tool ───────────────────────────────────────── Interactive tool for overlaying MSI heatmaps onto H&E images, drawing polygon ROIs, and saving tissue masks into AnnData objects. Workflow: 1. Load processed h5ad and generate an m/z heatmap 2. Load the matching H&E image 3. I...
154b1c787365d52927a83cf6869fc26ca04a833117f46f5baaaf9d08839fd895
Python
12,941
332
import reprlib from collections.abc import Sequence from pathlib import Path from typing import TYPE_CHECKING import polars as pl from eir.setup import schemas from eir.setup.schema_modules.output_schemas_array import ( ArrayOutputSamplingConfig, ArrayOutputTypeConfig, ) from eir.setup.schema_modules.output_s...
f63308487f0ce1237a81cf5e5a0d4803f4e8b4039c9082650d32ab29a930022f
Python
12,942
366
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from functools import partial import torch from ult...
d2962b928cc9d375d9118ea97962ec76389114b55b6908f9e766e98fb0fd7d54
Python
12,950
253
""" DMC-BrainMap widget for stitching .tif and .czi files 2024 - FJ, XC """ # import modules from qtpy.QtWidgets import QPushButton, QWidget, QVBoxLayout, QMessageBox from napari import Viewer from napari.qt.threading import thread_worker from magicgui import magicgui from magicgui.widgets import FunctionGui from nat...
528a4ff30f1ac2c3183fc93882dbf3b4d944ee258e2e4551b54b495e0a59510d
Python
12,951
275
"""The styling controls a viewer exposes, and how a request maps onto them. One declaration, used three ways: the page builds its form from it, the server coerces and validates query parameters against it, and the tests check that every knob is reachable. Keeping those in one place is what stops a control from existin...
adb3149bc17c16eefce0ac6a678aed6544b12970161c8bc5b47d690e4a30f37c
Python
12,955
405
"""LLM-as-judge evaluator for ChemGraph answer and tool-call correctness. Compares the agent's tool-call sequence and final answer against the ground-truth tool calls and final result using a binary scoring scheme (1 = correct, 0 = wrong). The judge receives the original query, expected and actual tool calls, and exp...
97db53e723861b943b2503bdcf8715adbc8b54936c6e561f11a1ddd3c83eebd4
Python
12,957
351
import torch import os import json import datetime import matplotlib.pyplot as plt import numpy as np from infopath.config import load_training_opt, save_opt def get_log_path(opt, model_path=""): if hasattr(opt, "log_path"): return opt.log_path root_path = "log_dir" curr_commit = get_commit_path(...
be6c2fe4ebe972d90f9e5e50c6f76ad1d5540a42b1197a09964c42f53f52fd14
Python
12,961
343
import torch import os import sys import re import glob from pathlib import Path import argparse from collections import defaultdict # Add the parent directory to sys.path script_dir = Path(__file__).parent project_root = script_dir while not (project_root / 'Deps').exists() and project_root.parent != project_root: ...
af7af32a31b0ca1928e22ebf769058232cfc09b694145eff368b3027b6b7379a
Python
12,962
367
# Copyright (C) 2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import csv import json import uuid from collections import Counter from datetime import datetime, timedelta, timezone from http import HTTPStatus from io import StringIO from time import sleep import pytest fro...
04f5546a91698db19856b37f2e5022275d7fe1ba289d8cbdb154198678456863
Python
12,964
366
# -*- coding: utf-8 -*- import numpy as np from nibabel.streamlines.array_sequence import ArraySequence from scilpy.viz.color import clip_and_normalize_data_for_cmap def add_data_as_color_dpp(sft, cmap, data, clip_outliers=False, min_range=None, max_range=None, min_cmap=None, max_cmap=None,...
8b76e932f41bfbadbce79f947dfc4b78cf4ca307fa3ed0b1a1b32e7f7ab69f74
Python
12,966
267
from typing import Dict, Any import numpy as np import pandas as pd import optuna import torch import torch.nn as nn import torch.optim as optim import torch.utils.data as data_utils from sklearn.model_selection import KFold from src.model import Net from src.trainer import ModelTrainer, DatasetLoader from src.preproce...
e7eaa03071fbbf74676852373e511a8bbafa51bc27c1fede3dd0fc546dac47a0
Python
12,967
330
import matplotlib.pyplot as plt import matplotlib.ticker as ticker import jax.numpy as jnp import jax import os import json import sys import glob import matplotlib.colors as mcolors from matplotlib.colors import to_rgba from scipy.stats import spearmanr, kendalltau import numpy as np jax.config.update("jax_default_m...
b52d4c7544e793182c4c364e714a4b9c198b966165730df7e6350b452bfb90d8
Python
12,976
337
import sys sys.path.insert(0, '../') sys.path.insert(0, '../../') sys.path.insert(0, '../../../') sys.path.insert(0, '../../../ogb') import os import argparse import time from shutil import copy import torch import torch.nn.functional as F from torch.utils.data import DataLoader from ogb.linkproppred import PygLinkPr...
b559d305ecc3bb856e5f90ac3ccefdcd65c0c61986f9f9cbe23e4c416426eadd
Python
12,976
291
import os, json, sys, shutil sys.path.insert( 0, os.path.join( os.sep, 'usr', 'share', 'gkg', 'python' ) ) import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt from CopyFileDirectoryRm import * from MWF_Preprocessing import * from VBM_Preprocessing import * from NODDI_Preprocessing import...
a6880a0ed7d04b1bd6883b37602b8948e4a50bdf9a14c2ad0164d3bffdf88a92
Python
12,977
408
import logging import os import pickle from pathlib import Path from typing import Literal from unittest.mock import MagicMock, patch import numpy as np import obspy import pandas as pd import pytest import requests import scipy.signal import torch from obspy.clients.fdsn.header import FDSNException import seisbench ...
33992897a1b4128511bb5f25499379182a29de1626a5017784d71b95de8e83d2
Python
12,980
320
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL """Collection of function for flexible nodes/edges access, to be used by model building and manipulation operations""" import numpy as np import pandas as pd import libsonata from bluep...
5c0dc3455a105c591d84fb4d3d608dcb0f57fa6380855c7b046bc248b6984905
Python
12,981
341
# script for the second part of figure 1. Single contrast vs multi-task localization in real data using the language dataset. import numpy as np import matplotlib.pyplot as plt import OptimalBattery.evaluate as ev import Functional_Fusion.atlas_map as am import OptimalBattery.estimate as es import OptimalBattery.util ...
6c7c527523d4cb057fd596fda852a9ec61ed38a0217906a593ab9209c3145e5a
Python
12,985
339
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import logging import os import random import sys import traceback from argparse import ArgumentParser from copy import deepcopy import submitit import torch from hydra import compose, initialize_config_module from hydra.utils import instantiat...
9a08e61b0225e333c9ad2317cfcb41bce90e1d045c2c941f02ed2b6db0941abb
Python
12,985
223
from PyQt5.QtWidgets import QSlider,QWidget,QGridLayout,QHBoxLayout,QVBoxLayout,QLabel,QCheckBox,QRadioButton,QSizePolicy from PyQt5.QtCore import Qt from PyQt5.QtGui import QPixmap,QImage from napari_dmc_brainmap.probe_visualizer.probe_vis.probe_vis.view.QLabelMT import QLabelMT import cv2 import numpy as np imp...
9f9df389884f87cc92fabd9c9c4c6d9c54c0a8c968f6c8ab55ec8b4f7ff1e721
Python
12,997
309
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...
499c19570ba257c9b8f4af9b9a3d9825145abb5732d36b833315415125227c37
Python
12,998
380
# -*- coding: utf-8 -*- import nibabel as nib import numpy as np import scipy.io import scipy.ndimage from scilpy.io.image import get_data_as_mask def py_fspecial_gauss(shape, sigma): """ Function to mimic the 'fspecial gaussian' MATLAB function Returns a rotationally symmetric Gaussian lowpass filter o...
a28bf8f6acfe535e553b096a5117f5f85432a89d94206355c65826c6161cd97e
Python
13,014
353
# -*- coding: utf-8 -*- """ Created on Thu Apr 6 20:23:41 2023 @author: axthi """ import numpy as np import os from copy import deepcopy from scipy.spatial.transform import Rotation as R from simnibs import mesh_io, sim_struct from simnibs.utils.file_finder import SubjectFiles from simnibs.utils.simnibs_logger impo...
be350fd10623a1e715ffb34f40032738b7281d16385ab77355954d056d70645a
Python
13,014
293
''' Script to run a relatively bare preprocessing procedure for a given subject. Essentially, this will read the raw data, set the relevant info, apply a notch filter for line noise (and harmonics), apply demeaning to channels, remove excessively noisy single trials that might poorly condition the ICA, apply a bandpass...
9154c30470970deb7572ef96ed0f1eb0b9257e83cc090d55e6159a596e1b0d5f
Python
13,015
367
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # Python standard library from __future__ import print_function from shutil import copytree import os, sys, hashlib import subprocess, json def md5sum(filename, first_block_only = False, blocksize = 65536): """Gets md5checksum of a file in memory-safe manner. Th...
5a4990fe0126870db0f7c714ef2386c1e4a2e5b37e8a03df4c40ae527f93dd36
Python
13,016
319
import torch import os import argparse import datetime import numpy as np from torchsummary import summary from monai.networks.nets import AttentionUnet, BasicUNetPlusPlus # , UNet from brainCT.networks.unets import UNet, UNet3d_AG, UNet_PlusPlus4 #from torchProject.unet.unet_model import UNetModel #from pytorch_bcnn...
fa8e97f646e22c9ac88ca870ca98c594cd1b75fd33338efc2b5a0957b1cd416b
Python
13,020
257
#!/usr/bin/python #----------------------------------------------------------------------- # File : patspec.py # Contents: pattern spectrum functions # Author : Christian Borgelt # History : 2013.12.03 file created # 2013.12.06 function psp2bdr added, pspfilter adapted # 2013.12.14 fixed a probl...
4c44f397e9a287c9d738c807a9b1d11e1eefc7f4163ddd2482b30af9d2f3a4d7
Python
13,026
353
"""``Isocortex2dProjector``: construction, aggregation, and hemispheres. Built from mini-CCF files through the public constructor, so this exercises the loading code as well as the projection -- and the loading code is where a substantial share of the known defects live. """ import numpy as np import pytest from ccf...
4eb510bd161b87a42a6399bf4e32453a735e5fef64788658a0581c819d26e40a
Python
13,030
405
# -*- coding: utf-8 -*- import os import gc import numpy as np from time import time import matplotlib.pyplot as plt from collections import defaultdict from scipy import stats from . import latent import torch def reshape_for_metric(y, per_fragment, distance): n, h, w = y.shape if distance ...
24414e7f1293b6a784f55d24d20bec8ea8b6c40d9eb2178de18f403adb5c03b1
Python
13,037
226
import cv2 import numpy as np import functools import distinctipy as dc from PyQt5.QtWidgets import QSlider,QWidget,QGridLayout,QHBoxLayout,QVBoxLayout,QLabel,QCheckBox,QRadioButton,QSizePolicy from PyQt5.QtCore import Qt from PyQt5.QtGui import QPixmap,QImage from napari.utils.notifications import show_info ...
964e641bf6e8552f9101d8be0133f40ddb592b0ab7df1c387add22b57b976c88
Python
13,039
342
#!/usr/bin/env python3 # general imports import numpy as np import sys import matplotlib.pyplot as plt from tqdm import tqdm import time # torch imports import torch import torch.nn as nn # PyTorch TensorBoard support from torch.utils.tensorboard import SummaryWriter from datetime import datetime # utils imports fr...
c069363125252b5217bbb8baf7aeabbff8cf3b7e87be70a91d7a3e89425a68bc
Python
13,040
352
# -*- coding: utf-8 -*- # cifar100_resnet50_td_vs_baseline.py import copy, random, os import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader, random_split from torchvision import datasets, transforms import matplotlib.pyplot as plt # ===...
397338086955553ed60e6133fa1002648fb65a5af14b4825f0c6162ba82da64b
Python
13,043
386
# -*- coding: utf-8 -*- """Rigid registration.""" import os import shutil as sh from pathlib import Path import nibabel as nb import numpy as np from .. import execute_command from ..io.affine import apply_affine_chunked, read_vox2vox from ..io.vol import copy_header, mri_convert from ..segmentation.vol import remov...
db9ead8976ba1d59787bac42850cd8fe986591c5ee84e05e590b16c65485e240
Python
13,044
373
#!/usr/bin/env python """ The core functionality for a HAL module. All modules should be a sub-class of this module. Hazen 01/17 """ import faulthandler import traceback from collections import deque from PyQt5 import QtCore, QtWidgets import storm_control.sc_library.halExceptions as halExceptions import storm_co...
80794e4db0a11d8eb308011aadf0b9ea58904e6a0499afaea07ef06eec8a3351
Python
13,051
259
from pathlib import Path from snakemake.logging import logger import numpy as np import pandas as pd import os import shutil pd.set_option("future.no_silent_downcasting", True) class ParamHelper: def __init__(self,include,sampleAnnotationColumns,group,path): """ include: boolean. True-include th...
559a61d864a2ca05ab8f9a2a646ba2ea90acd6ee74e79c063e3d013dee358764
Python
13,055
266
# Copyright (c) 2026 Rohit Jena. All rights 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, or...
a7d00dab1dfe0bb0201ee84178d7d8cb410fe9dc418cb11b9be9aecbe7dbd66e
Python
13,058
227
from PyQt5.QtWidgets import QSlider,QWidget,QGridLayout,QHBoxLayout,QVBoxLayout,QLabel,QCheckBox,QRadioButton,QSizePolicy from PyQt5.QtCore import Qt from PyQt5.QtGui import QPixmap,QImage from napari_dmc_brainmap.probe_visualizer.probe_vis.probe_vis.view.QLabelMT import QLabelMT import cv2 import numpy as np imp...
ddfe13326fbec668c43a378e6e5eb952e41ba6d1fcd87cf0c493262779119b9e
Python
13,063
337
# -*- coding: utf-8 -*- # svhn_td_vs_baseline.py import copy, random, os, sys import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader, ConcatDataset from torchvision import datasets, transforms import matplotlib.pyplot as plt # ==========...
00c68d1f7447a50a069604e79f610fcc307e2bd340de1f3e090cbb807419e365
Python
13,066
406
# coding=utf-8 """ Tests for deepreg/model/loss/label.py in pytest style """ from test.unit.util import is_equal_tf from typing import Tuple import numpy as np import pytest import tensorflow as tf import deepreg.loss.label as label from deepreg.constant import EPS class TestSumSquaredDistance: @pytest.mark.p...
492d8196e95d4bb148bca44a940530b2a03bd6a03dbfd557eccefcdc4bbfe3a4
Python
13,067
353
from pathlib import Path from typing import Any import cv2 import numpy as np VALIDATED_IMAGE_SHAPE = (800, 1140) CORNER_ORDER = np.float32( [ [0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], ] ) def offsets_to_homography(offsets: Any, image_shape: tuple[int, ...]) -> np.nd...
3d068d9850190c2553baa653ac8496d81a164c51731bd7a50921ef05307ea153
Python
13,070
416
# from functools import wraps # import numpy as np # # return real part of a vector # def real_vector(vector): # return map(lambda x: x.real, vector) # # return imaginary part of a vector # def imag_vector(vector): # return map(lambda x: x.imag, vector) # class EpochSignalSlicer(object): # def __init__...
e259aad74268fd4f83a58e7e7f8923fb6aa99ef9e18cace8b9fe7c97dd0bc2f3
Python
13,071
439
''' Auxiliary functions for common math operations for RSAs. Typically, these are reimplementations of things found in scipy or numpy, but for higher dimensional arrays. ''' import numpy as np from scipy.stats import rankdata from typing import Any, Union, Callable from . import math_torch as torch def euclidean_1d(...
65d46bd58692f4d012f8249064c835cf242a178c9cdca4c29a910cb7eb350a81
Python
13,080
338
import numpy as np import pandas as pd import os from sklearn.model_selection import KFold from sklearn.metrics import accuracy_score, recall_score, f1_score, roc_auc_score, matthews_corrcoef, roc_curve from sklearn.utils.class_weight import compute_class_weight import tensorflow as tf from tensorflow.keras.mode...
1f9098dce48b13faec54654666da4696fd0b9761f3ad95d4ccdd353e3420aec5
Python
13,087
333
import numpy as np import pandas as pd import Functional_Fusion.dataset as ds import OptimalBattery.util as ut import nibabel as nb import Functional_Fusion.atlas_map as am from OptimalBattery.global_config import repo_dir, data_dir import os from collections import OrderedDict def make_task_library(base_dir, sessions...
ae2e5b6ab0d0227face474196206ec93ccb308683c4fde2394834682e2014f44
Python
13,090
264
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from itertools import cycle from typing import Any import cv2 import numpy as np from ultralytics.solutions.solutions import BaseSolution, SolutionResults # Import a parent class from ultralytics.utils import plt...
d20ca9a1902549344dfb68bfbfb6210b996841e620e8e51a51c7d836045909b5
Python
13,091
261
import numpy as np import random import time from scipy.stats import spearmanr from scipy.spatial.distance import squareform import pandas as pd import pathlib import argparse import matplotlib.pyplot as plt def corr_spearman(a, b): return spearmanr(a, b)[0] def corr(A, B, method='spearman'): all_correlation...
1624748d79b111e6245eecc738265851464e8d5cb460069977c36f275ac46594
Python
13,092
351
from torch import nn, autograd import torch import torch.nn.functional as F class MLP(nn.Module): """ a simple 4-layer MLP """ def __init__(self, nin, nout, nh): super().__init__() self.net = nn.Sequential( nn.Linear(nin, nh), nn.LeakyReLU(0.2), nn.Linear(n...
1f596270b27a1d982d7b2275681e4b1eeb8fb7340f5331f331ae9ec6f2cffb9b
Python
13,095
412
"""Script to correct resting state matrices with null-matrix""" import nibabel as nb import numpy as np import glob from nilearn.connectome import ConnectivityMeasure from nilearn import plotting import matplotlib.pyplot as plt import pandas as pd import seaborn as sns plt.style.use('dark_background') ROOT = '/User...
e158c8113874774ae38490e14d5da34fb4808eec6d7e1b2397377859c2c51fd8
Python
13,097
394
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved from __future__ import annotations from torch import nn from ultralytics.nn.modules.transformer import MLP from ultralytics.utils.patches import torch_load from .modules.bloc...
61a39eae97eabaf33f39e6716b0fff551c75f2e9c9d30a773bc86f5314a581a1
Python
13,101
230
import cv2 import numpy as np import functools import distinctipy as dc from qtpy.QtWidgets import QSlider,QWidget,QGridLayout,QHBoxLayout,QVBoxLayout,QLabel,QCheckBox,QRadioButton,QSizePolicy from qtpy.QtCore import Qt from qtpy.QtGui import QPixmap,QImage from napari.utils.notifications import show_info from...
59b7fb7dd6af2f22c55c037ed26c1329158845d03e9b5c02a7d28fc73c50b52a
Python
13,104
368
"""Tests for provider readiness detection and ALCF token handling.""" import json import pytest from ui import alcf_auth, codex_auth, providers @pytest.fixture() def clean_env(monkeypatch, tmp_path): """Remove provider credentials and isolate token caches.""" for var in ( "OPENAI_API_KEY", ...
e1ccf67c41dd8cf25747455c336de2f89d19152c1056e51c83b8489010f24be8
Python
13,104
315
""" EEG Signal Processing Script Read BDF, extract events at original sampling rate Optionally downsample and check event timing alignment Bandpass filter, standard montage, average reference ICA (Picard extended) + ICLabel automatic artifact rejection Interpolate bad channels, narrow-band filter Epoch, ...
a0c3ca7df060ecf925d9aa3e55ce77bf331ea8d5bf299aeceeb92a78ba4456da
Python
13,106
228
# Tests of the BIDS discovery and the batch planning of dmriprep (no processing): # python -m unittest discover -s tests import json import tempfile import unittest from pathlib import Path import nibabel as nib import numpy as np import yaml from dtiplayground.dmri.common import bids from dtiplayground.dmri...
3b6bed9f1a2c290ea762bdb571ab9c87d202695ec420cf2de6408ff2102ec893
Python
13,123
349
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import warnings from threading import Thread import numpy as np import torch from PIL import Image from tqdm im...
2ff2b5f1acf6b7b2a72795ba36cae7ceb11b2f418fc91cdd30383056c0b388db
Python
13,127
365
# -*- coding: utf-8 -*- """ Collection of routines to detect maxima Used for finding cells or intensity peaks. """ #:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City #:license: GNU, see LICENSE.txt for details. import sys import numpy #from scipy.ndimage import maximum_filter ...
bf97a70fbc616394f4ee545bfbbd3b617b2358fce1e79f0fa87e981d3d89e52e
Python
13,129
278
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from copy import copy, deepcopy from pathlib import Path import torch from ultralytics.data import YOLOConcatDataset, build_yolo_dataset from ultralytics.data.augment import LoadVisualPrompt from ultralytics.model...
13cc07d600e71e569ec7dabc696bf8202c309c1d95b50c3516a390c33cdd028e
Python
13,130
340
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Rene Schmieding # # 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 compliance with the Li...
536ab72c5462992a6856526218200a1868968c2ed8d8903f1b9acc987db84dec
Python
13,131
363
import numpy as np import pandas as pd import random import torch import esm import torch.nn.functional as F import torch.nn as nn from sklearn.metrics import mean_squared_error from scipy.stats import pearsonr, spearmanr import random from sklearn.metrics import root_mean_squared_error,mean_absolute_error, accuracy_sc...
bf4a687aea0bdf2896dc8cca6035743b9351c199cba61869cf237886416c2c07
Python
13,133
259
from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, roc_auc_score from layer import SimpleHGN import pytorch_lightning as pl from torch import nn import torch import argparse from torch.optim.lr_scheduler import CosineAnnealingLR from pytorch_lightning.callbacks import ModelCheckpoint f...
ebca1051106630a5ecf383a23814e2f60f5713a9c3b393bf01185fe01fd4d759
Python
13,133
334
import numpy as np import torch import re try: from rdkit import Chem print("Found rdkit, all good") except ModuleNotFoundError as e: use_rdkit = False from warnings import warn warn("Didn't find rdkit, this will fail") assert use_rdkit, "Didn't find rdkit" allowed_bonds = {'H': 1, 'C': 4, 'N'...
d37d7ab62390737412685bfbff1b673fce746f09796028b5214feba72d5d52fa
Python
13,135
386
from collections import Counter from math import isclose from statistics import mean import numpy as np import polars as pl import pytest import torch from hypothesis import given, settings from hypothesis.strategies import integers, lists from eir.data_load import data_loading_funcs from eir.data_load.datasets impor...
ef87394ba95c2bc35c5265a0f6aba83e22b6a6f95f113ae76bc1ebdddcd4e1da
Python
13,136
391
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 23 10:29:55 2023 @author: mgruenig """ BATCH_SIZE = 8192 RUN_VERSION = 'v17_2' # name of the run in tensorboard GPU = '1' ## cuda_visible_device -> which gpu to train on CACHE = '/home/mgruenig/tmp/tf_cache/' # prefix of the cache fi...
97b531b6005acd8f8ad7b26e126fa8418db4a28d2f32ef981e4706191560e3cf
Python
13,137
274
#!/usr/bin/env python3 # -*- coding: utf-8 """ Script that evaluates model on simulated data. Created on 2020/02/03 @author romain_lopez """ import os import click import numpy as np from utils import get_mean_normal, find_location_index_cell_type, metrics_vector, discrete_histogram import scanpy as sc import matpl...
323a32d643b68ffcabc59015d05784ed63db0208a79ec98991e2732734a5802a
Python
13,139
382
# cec2017.hybrid # Author: Duncan Tilley # Hybrid function definitions, f11 to f20 from . import basic from . import transforms import numpy as np def _shuffle_and_partition(x, shuffle, partitions): """ First applies the given permutation, then splits x into partitions given the percentages. Args: ...
cc8b6adfa963a243bc554b08e3bf9115bd05367caac49cd0ed2716487a0a3248
Python
13,143
299
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Feb 4 12:05:56 2024 @author: rl05 """ import sys import os.path as op import numpy as np import matplotlib.pyplot as plt from scipy.stats import t from mne.stats import permutation_cluster_1samp_test, spatio_temporal_cluster_1samp_test sys.path.appe...
5bcde2c99afb272520db132f19176fc2c1cffdaad00c23c77e1666ceb054fc44
Python
13,146
328
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import json from collections.abc import Generator from contextlib import contextmanager from http import HTTPStatus from unittest import mock import pytest from cvat_sdk.api_client import ApiClient, Configuration, models from shared.utils.config im...
5bae6bc3f104b81336922374eecd93b67e6b77fedd481917fcd13f21d242d7d0
Python
13,147
342
# ============================================================================== # Binaries and/or source for the following packages or projects are presented under one or more of the following open # source licenses: # adapter.py The OpenLane Dataset Authors Apache License, Version 2.0 # # See: # https:/...
c63c3a47ab60887bd6da1279b2fd8e61b4fe25b047e4709dc8f881eda5799b7d
Python
13,149
375
# -*- coding: utf-8 -*- """ train the image encoder and mask decoder freeze prompt image encoder """ # %% setup environment import numpy as np import matplotlib.pyplot as plt import os join = os.path.join from tqdm import tqdm from skimage import transform import torch import torch.nn as nn from torch.utils.data impo...
c8e67260a495ddac609ce3d384f820da8b6242a3a4094d9fd8e1a82b6d649f1e
Python
13,158
433
import numpy as np import pandas as pd from typing import Dict, List, Tuple, Optional import sys import os sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) from config.physics_constants import ( F, R, T_STD, VRFBParams, NoiseParams, celsius_to_kelvin, nernst_potential_...
a9dc842796ca36e7029cdd3de6c6daa02878c84346984a6987b27825eb41f841
Python
13,162
274
#!/usr/bin/env python3 -u # Copyright (c) DP Technology. # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from torch.utils import cpp_extension from torch.utils.cpp_extension impo...
95050c2b9be03a76361a515f9e547475e27556fb1b3b4c8f367ee8f43477f507
Python
13,164
188
### COPIED FROM https://github.com/cpilab/group-bayesian-model-comparison/blob/master/groupBMC.py ON 06/04/2024 to allow debugging ## This script was originally published under teh MIT License ''' MIT License Copyright (c) 2020 cpilab Permission is hereby granted, free of charge, to any person obtaining a copy of th...
21ade0dfdb5fc57907c951ab584d89bedaff8b7d822ca06d3720fb66ac42059f
Python
13,165
321
from sklearn.metrics import roc_auc_score, average_precision_score import pandas as pd import os import numpy as np try: import torch except ImportError: torch = None ### Evaluator for graph classification class Evaluator: def __init__(self, name): self.name = name meta_info = pd.read_csv...
de7c29bfac2c27b94ae99a95b4fae53d18d74bdaec325affe38f8187d86d3baa
Python
13,169
373
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 29 15:54:00 2017 @author: ajaver """ import numpy as np import cv2 import pandas as pd from scipy.interpolate import interp1d from .curvatures import curvature_grad from .postures import get_length from .helper import DataPartition, get_n_worms_est...
e360efedd4391e238ea94d08404a7b26c8946f38512a909406cba8ac32f35634
Python
13,169
191
# -*- coding: utf-8 -*- """ Created on Fri Nov 19 01:23:18 2021 @author: Yoshi """ import warnings warnings.simplefilter(action="ignore",category=FutureWarning) import os program_path = os.getcwd() os.chdir(f"{program_path}/motion_corrector") from motion_corrector import * os.chdir(f"{program_path}/data_extracto...
09709d347141f475b99560cad8dc6cf9d971ddf22a14c21f31e6147b0db17d5c
Python
13,170
323
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import copy from typing import Tuple import numpy as np import torch import torch.nn as nn import torch.nn.functional as...
31968ad2c5848cf4418cef84ff76b007fad5b036800d9cf81422dec346b48ae0
Python
13,173
283
# # fiberprofile/analysis/impute.py (from FiberProfileAnalysis/impute_profiles.py) # # Impute missing values in along-tract profile tables (the output of gather) with a per-dataset SIREN implicit neural # representation (INR). # # For each dataset (one column identifier, e.g. <subject>_<session>_<prefix>) all ...
a20dc210174597e6b818e723e3392b7c5249e19fcf78fb56beeeef7ef7b97842
Python
13,173
339
from torch_geometric.nn import GCNConv from sklearn.neighbors import kneighbors_graph import torch import numpy as np #from ..utils.helpers import calc_gex # define the number of neighbors (six for visium) n_neighbors = 6 # define the simcomen class class simcomen(torch.nn.Module): """ A k-hop Graph Neural Net...
ea32ed4ec02a8a5880938f9e6f0ec6e04ca426206288e3643b04e4f1435ebc12
Python
13,175
450
"""usage: {} --cell <cell_mask> --tissue <tissue_mask> --blur <blur_mask> --image <orig_img.tif> """ import os import sys import getopt import copy from collections import Counter import numpy as np import pandas as pd import cv2 def getfootprint(struc, a, b=None): from skimage.morphology import ( s...
76ea8379543aee81891e84a52afa731717146ad4052ed8e4b98c5e7b0aacda79
Python
13,181
310
"""Independent reproduction of LAION-fMRI's published 12-rep noise ceiling. We use the per-session single-trial betas (`SingletrialBetas_statmap.nii.gz`) and the trial→image TSVs from `derivatives/glmsingle-tedana/<sub>/<ses>/func/`, then implement the NSD variance-based estimator (Allen et al., 2022) that the LAION-f...
104f5a12ad80b92e7cb30a3b1a798f8f94295b835005d5ac896db40961b3a2c0
Python
13,182
392
import os from os.path import join import pyvista as pv import numpy as np import re import matplotlib.pyplot as plt import pickle import nibabel as nib from simnibs.utils.file_finder import SubjectFiles def _pvmesh_from_skin_geo(infile): # make pyvista mesh out of a skin geo file with open(infile, "rt") as...