sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
72e0fd69b1abdfcbababd79d370d95b423932e1ded605a8c3977800db3b4ea7e
Python
11,166
259
import numpy as np from scipy.stats import rankdata import h5py import os def mann_whitney_u_shuf(x, y, shuf_labels): """ Compute Mann-Whitney U statistic efficiently using shuffled labels. Parameters: - x: array-like, spike counts for choice A (# shape: (nx,)) - y: array-like, spike counts for c...
66d98471b7663ff563a4ecb060a1884583ad07dbdd0ee354a5755df635a3d8c9
Python
11,178
347
""" Define multiple methods to compare different FLOP and MAC counting tools. Tools: - PyTorch Lightning FLOPs counter: https://lightning.ai/docs/pytorch/stable/api_references.html#lightning.pytorch.utilities.measure_flops - https://github.com/sovrasov/flops-counter.pytorch - https://github.com/facebookresearch/fvcore...
8897e81d719224fac73f9d46167eda6d10832b4264193fcaff7ed1d8e32657e9
Python
11,179
284
import json import logging import numpy as np import pandas as pd import argschema as ags from skeleton_keys.layer_alignment import ( layer_aligned_y_values_for_morph, cortex_thickness_aligned_y_values_for_morph, ) from neuron_morphology.swc_io import morphology_from_swc, morphology_to_swc from neuron_morpholog...
ff797c0e117d7d586169d9243ab43436feaa6e01e8ef3c9db34a2552cba7d696
Python
11,179
271
#!/usr/bin/env python """ 'Tile' the blocks of a maf file over each of a set of intervals. The highest scoring block that covers any part of a region will be used, and pieces not covered by any block filled with "-" or optionally "*". This version uses synteny annotation if found on the alignment blocks, and will att...
6741503065dc2b2b83534b2568bf9c42ea9cdb69f1305bb9e9d0926008633e7b
Python
11,181
243
#!/usr/bin/env python """ Handles the management of one or more camera / feed displays. Hazen 3/17 """ from PyQt5 import QtWidgets import storm_control.sc_library.parameters as params import storm_control.hal4000.camera.cameraControl as cameraControl import storm_control.hal4000.display.cameraViewers as cameraViewe...
6159aa8dfd98b932662bd810c41a7b931170cad4fb0b2158dd662c6c5ac5066e
Python
11,183
347
# This code is derived from the gammatone toolkit, licensed under the 3-clause # BSD license: https://github.com/detly/gammatone/blob/master/COPYING """Constructs sets of equivalent rectangular bandwidth gammatone filters.""" from __future__ import division import numpy as np from scipy import signal as sgn def er...
702566dad2b193aad0d79808ca6edf34f8279ad581ce9a0336ef92d6f6b12aee
Python
11,185
302
# Copyright (c) OpenMMLab. All rights reserved. import math import torch.nn.functional as F import torch.nn as nn from mmcv.cnn import build_conv_layer, build_norm_layer from mmcv.runner.base_module import BaseModule from torch.nn.modules.utils import _pair as to_2tuple class AdaptivePadding(nn.Module): """Appli...
fa81d3df9b6cf332391850644cd1583592eebff9434143fdb7f81199c5df5f1c
Python
11,192
275
# This file has been modified by [Qian Yin/Organization]. from inspect import CO_VARARGS import torch import torch.nn as nn from mmcv.cnn import ConvModule from torch.nn.functional import embedding from torch.nn.modules import conv from depth.models.builder import HEADS from .decode_head import DepthBaseDecodeHead imp...
d69e49d5bbec5e944bc8c08a4e6b009a7a2095ff9c7cd8669b449b7764063477
Python
11,194
305
from pathlib import Path import numpy as np import pandas as pd import h5py from tqdm import tqdm from typing import Any from scipy.signal import butter, sosfilt from seisbench import logger from .das_base import DASBenchmarkDataset, DASDataWriter class MLSubDAS(DASBenchmarkDataset): """ MLSubDAS dataset by...
2a06f5a7b8fa48253d1b99cd4987e3a18174205f914e05739c089a4917c2e97e
Python
11,197
336
#!/usr/bin/env python """ Convert Siemens physio DICOM files to BIDS tsv files and populate to correct subject/session folders directly AUTHOR : Mike Tyszka PLACE : Caltech DATES : 2021-08-02 JMT From scratch License ---- MIT License Copyright (c) 2021 Mike Tyszka Permission is hereby granted, free of charge, to a...
e151192636ce9b153ea35d7336734ebd46c079ca062673f1605b311f4e651370
Python
11,200
281
import torch import torch.nn as nn import torch.nn.functional as F import dgl class InfoNCE(nn.Module): def __init__(self, temperature): super().__init__() self.temperature = temperature def forward(self, query, pos, neg): query = F.normalize(query, dim=-1) pos = F.normalize(po...
4c8994c4c32f457895aa66161035cabf6490f364ec30ac313c2161bda3531a7d
Python
11,202
313
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL import glob import json import os from mock import patch, Mock from pathlib import Path import pytest from bluepysnap import Circuit from bluepysnap.nodes import NodePopulation, Nodes f...
e5e9d5be6beaacab2e526ac907f1edabed957869ac051b40ae47b7824745b1d9
Python
11,203
329
import os import tempfile import unittest import numpy import pandas import thalamus.dataframe from thalamus.record_reader2 import RecordReader from thalamus.dataframe import DataFrameBuilder from thalamus.thalamus_pb2 import StorageRecord, AnalogResponse, Text, Span from thalamus.record_writer import write_record c...
3f79df3e0a4eb6f8c4eea10b5af83037ec42466a00f9cd7024139e604083197f
Python
11,204
292
import os from typing import Any, List, Dict, Callable, Tuple import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from torchvision.utils import make_grid from torchvision.utils import save_image import torchvision.transforms.functional as T from py...
9455fd2aeaaf33b4d52dc40373de9e101b137beb394b0e9d3b7f9e359e0d2014
Python
11,204
257
import sys sys.path.append('..') import torch import torch.nn.functional as F from torch import nn from torch.nn import GRUCell, Linear import dgl from dgl import function as fn from dgl.nn.pytorch.conv import GATConv, EdgeGATConv, GINConv, GINEConv, GATv2Conv, HGTConv, EGNNConv from dgl.nn.functional import edge_soft...
c46df2b75dfaf3fe7d71b2091836bd5fe27508c9beb5d9b00c9c97fbd1e0bcaf
Python
11,205
252
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to denoise a dataset with the Non-Local Means algorithm (from Dipy's package). This method requires an estimate of the noise (sigma). There are three methods available: 1. Provide your own sigma value, if you already know it. 2. Estimate it through Dipy...
e9c2bc50dbb8f5f6a0f46fa3f02a65a306c7a164dfce80cbfd5d00169183cc90
Python
11,207
306
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
5b894c51a013f97c5d068d3d37a5ada1b1d88c86e5583b1ad001344453a208f6
Python
11,208
306
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
122c99056e9e7ae324dee3cf8bbd9d6988a883cf7c9615735c41ecd7f578f953
Python
11,211
264
import sys import pandas as pd import numpy as np import anndata from skimage import io as skio import getopt import json import scipy.ndimage as nd #Print Usage def apply_alignment_usage(): print(""" Usage : SEAM.py apply_alignment -i <input.json or input.csv> -o <output prefix> ...
2624d7656ea93fdd0e8fee2c83f0290757762c977698ca15014e3e13cde24edf
Python
11,212
335
""" TMS Explorer was developed to assist with the data preprocessing of transcranial magnetic stimulation (TMS) as part of the study "Transcranial direct current stimulation (tDCS) and mindfulness meditation in fibromyalgia" in the "Non- invasive brain stimulation lab" (NBS) at the university medicine Göttingen ...
96ba4a545e9f0ba8d0b0748e05b092db5b237a5bb8c9679cdb7e1c71c5a743a0
Python
11,216
369
# -*- coding: utf-8 -*- # python standard library inputs from math import prod # external inputs import numpy as np import nibabel as nb from numpy.fft import fft, ifft from scipy.ndimage import gaussian_filter from nilearn.signal import clean __all__ = ["ScaleTimeseries", "FilterTimeseries"] class ScaleTimeseries...
2795a2dd074d90dff84800740bb8a45eb705e4e113d36d902700653b896e7311
Python
11,219
208
plots - nc x h2 (obviously, the effect size drives power; also - PCOR MOSTest behaves as GCOR ) - dist x t (most is always better than minp; minp power is growing when t increases; cauchy distribution => minp has thesame power as mostest) - dist x T (more traits = better power; and too ma...
2cacf511e851e645db246a408636c7da38adb8ab1a88517cc16c35434d32b825
Python
11,220
307
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
39d646b59608b6e9fcd1c991d1da46ff326f067780b1a89dec34985929b0cb52
Python
11,220
314
# 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 ast import collections import logging import os import re import shutil import traceback from typing imp...
618fa4f94dac9db4c0c69adf8dd5d818de680d84d64e445324b3d98aa9ef312a
Python
11,226
283
""" Main manuscript - Figure 1: Overview of 3T and 9.4T subject matched datasets First column: Axial exemplary slice of 3T qMRI data: R1, R2, AI Second column: Axial exemplary slice of 9.4T qMRI data: R1, R2, AI Third column: Axial exemplary slice of DTI data: FA, color-coded FA, fiber-to-field angle theta Author: fl...
7e15dbfea842a5cbb8f37887e4c75c0ffff7035a927bd2b00460231fe57a190d
Python
11,226
341
# -*- coding: utf-8 -*- """ Illumination correction toolbox. The module provides a function to correct illumination/vignetting systematic variations in intensity. The intensity image :math:`I(x)` given a flat field :math:`F(x)` and a background :math:`B(x)` the image is corrected to :math:`C(x)` as: .. math: ...
e5a4342bbecd94d162bc5d2856ffc09b02c050af67d25649f18a94f1baf2dc84
Python
11,227
241
import os import os.path as osp import torch import random import numpy as np import pandas as pd from torch_geometric.data import (Data, InMemoryDataset, download_url, extract_gz, extract_tar, extract_zip) from torch_geometric.data.makedirs import makedirs from torch_geometric.utils ...
2ed2f72d50651e1024cae724a44db08b22914732fa36c9f339140dc98f61963a
Python
11,228
316
import logging import os import os.path as op import dipy.tracking.streamlinespeed as dps import numpy as np from dipy.io.stateful_tractogram import Space, StatefulTractogram from dipy.tracking.streamline import select_random_set_of_streamlines import AFQ.recognition.sparse_decisions as ars import AFQ.recognition.uti...
abaefa62351dd7317b71deaf7f22fdd6376699359d00cb0d46c59ed1bd67d240
Python
11,236
302
# -*- coding: utf-8 -*- import logging import os import numpy as np from scilpy.tractanalysis.streamlines_metrics import compute_tract_counts_map from scilpy.utils.filenames import split_name_with_nii def compute_lesion_stats(map_data, lesion_atlas, single_label=True, voxel_sizes=[1.0, 1.0...
f6318aa57e3509e86cb15f5619b2a8dd3a6f5a782ce4799eb840d0f21851e707
Python
11,237
394
from __future__ import annotations import functools from collections.abc import Callable from pathlib import Path from typing import TYPE_CHECKING from typing import Final from unittest.mock import MagicMock import numpy as np import osam.types import pytest from pytestqt.qtbot import QtBot from labelme._automation ...
f8ef8701928bc68d3af53fdf37709c78d11ac468c9bdb0b12055a3c561c9d123
Python
11,244
260
""" Exponential Moving Average (EMA) of model updates Hacked together by / Copyright 2020 Ross Wightman """ import logging from collections import OrderedDict from copy import deepcopy from typing import Optional import torch import torch.nn as nn _logger = logging.getLogger(__name__) class ModelEma: """ Model...
b2c3e4cb4a2bb285e261dbf2ca647815bb3b4ad759ad715b6d3efdd920d4d3f7
Python
11,246
277
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...
6da6dc49c0e00b950e3706c50c30e3ea4e23077fe48b92dd7df9e494b6dd1939
Python
11,247
291
""" Predict using trained EfficientNet3D models on validation set and full dataset """ import os import argparse import torch import torch.nn as nn import numpy as np import pandas as pd from torch.utils.data import DataLoader, Subset from data.dataset import MRIDataset from models.efficientnet3d_pretrained import make...
39f2acc64810c2cd12bd8bdd6b9f0882e4648b72c1f334bc30ffdc9e3be6a6b4
Python
11,256
300
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """Monkey patches to update/extend functionality of existing functions.""" from __future__ import annotations import time from contextlib import contextmanager from copy import copy from pathlib import Path from typing import Any import cv2 import n...
a65de313ec9b8ee5fc3b77c44f31ac59a6ee6eed3ea8560a074b73f697eef897
Python
11,257
281
import tqdm from natsort import natsorted import numpy as np from scipy.stats import qmc from skimage.morphology import closing, cube, label from napari_simpleitk_image_processing import label_statistics from tqdm import tqdm import numpy as np from natsort import natsorted import pandas as pd import os from glob impor...
8b72a73ca67e877fe7cd870c608f7863c51f2015b28c98518cc502233e05966a
Python
11,259
328
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved from collections import OrderedDict from typing import Callable, List, Optional, Tuple, Union import torch import torch.nn as nn from torch.utils.checkpoint import checkpoint from .model_misc import LayerScale class ResidualAttentionBlock(nn....
ed443443cb94711a50f998b54dff88c33750803f45f7e663a94bf312c9d13f7c
Python
11,259
338
import sys sys.path.append("./src") from napari_dmc_brainmap.utils.atlas_utils import xyz_atlas_transform from napari_dmc_brainmap.utils.atlas_utils import get_decimal from napari_dmc_brainmap.utils.atlas_utils import coord_mm_transform from napari_dmc_brainmap.utils.atlas_utils import sort_ap_dv_ml from napari...
84574866e077231fd846ba4d83bc0bfc6f14d32be436628157a2dd100feb0bde
Python
11,260
230
import os import subprocess import shutil import nibabel as nib import numpy as np import pandas as pd from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory, traits, CommandLineInputSpec, CommandLine, isdefined from nipype.interfaces.utility import IdentityInterface from...
1b4a5194105a89177ce0848911e673a23a430ada5c38aeae59e13b9e1b602acd
Python
11,261
385
# -*- coding: utf-8 -*- """ Label and annotation info from Allen Brain Atlas (v2) Notes: - The annotation file is assumed to be in './Data/Annotation/annotation_25_right.tif' but can be set in the constant :const:`DefaultLabeledImageFile` - The mapping between labels and brain area information is ...
c2c6f543ef764a28b07608c9ad49716eec322927a115b25136b19c6ab32ec052
Python
11,266
361
from __future__ import annotations import hashlib import socketserver import threading import time from collections.abc import Iterator from pathlib import Path import osam import pytest from pytestqt.qtbot import QtBot from labelme._model_manager import ModelManager @pytest.fixture def manager( *, qtbot: ...
3c407b571a097dcdaa236084fe5f388ed9c261dfa1fdf26e11537b8d7144a5d5
Python
11,268
251
""" this file describes a class that handles the axis behavior for the lasagna viewer """ import pyqtgraph as pg from lasagna.ingredients.imagestack import imagestack as lasagna_imagestack from lasagna.utils.lasagna_qt_helper_functions import find_pyqt_graph_object_name_in_plot_widget from lasagna.utils import prefe...
245f739d5e04dc0600d1b6e9b11b0a1c8897b9ef290f84ba5fc111112a74016d
Python
11,272
270
import torch from torch_geometric.data import DataLoader import torch.optim as optim import torch.nn.functional as F from torchvision import transforms from gnn import GNN from tqdm import tqdm import argparse import time import numpy as np import pandas as pd import os ### importing OGB from ogb.graphproppred import...
72020d8583b2102abfbc998044948ec142a6e1dc7dc08f3d0bb2ff987adc1c39
Python
11,273
311
'''Compute total motion energy from greyscale videos. ''' import numpy as np from .utils import (iterator_func, pointwise_square, ) # Make tqdm optional with_tqdm = True try: from tqdm import tqdm except ImportError: with_tqdm = False def process_motion_energy_from_fil...
a42a259adba1b07d3afbfd8ac308f536b9cd276e8d6ccb32794282c535f53598
Python
11,277
383
from contextlib import contextmanager import warnings from types import SimpleNamespace import pandas as pd from napari_dmc_brainmap.utils.data_loader import DataLoader from napari_dmc_brainmap.utils.dataframe_utils import clip_negative_first_row from napari_dmc_brainmap.visualization.vis_plots.brainsection_visualiza...
418738d450e116a65e4ba8440b1a5a1555378b0ec4e512b1b02205b6f3aeb959
Python
11,278
364
import logging import math import os import sys import time from typing import Any, Dict, Optional import torch from torch_geometric.graphgym import register from torch_geometric.graphgym.config import cfg from torch_geometric.graphgym.imports import Callback, pl from torch_geometric.graphgym.utils.device import get_...
28907d327316486d559b6e0051a00e780c0c78b61adbdf5802bd2784d9b5633a
Python
11,280
279
import os.path as op from typing import List, Self, Tuple, Union import matplotlib.pyplot as plt import nibabel as nib import numpy as np from scipy.interpolate import make_interp_spline from ..system.utils import vectorize minZero = 1e-8 np.seterr(all="ignore") class makesnr: """Class object that computes and...
350c5511b8a616aaf0c4844d101a4e61d6a90e674bae972ac605b3c52982ad06
Python
11,281
365
from collections import OrderedDict from collections.abc import Callable, Iterable, Sequence from copy import deepcopy from pathlib import Path from typing import ( TYPE_CHECKING, Any, Literal, ) import torch from torch import nn from torchview import draw_graph from transformers import PreTrainedModel fr...
0e579f8a6241e08844d8838d665be6f3d709eb5f005c63c87d7d995cee34efb9
Python
11,285
287
"""Functions that calculate curve data for cross validation plots.""" from typing import List import warnings import numpy as np import pandas as pd from sklearn import metrics def calculate_roc_curve(curve_data): """Calculates ROC curve on the folds Args: curve_data (dict) : dict of curves produced...
ae757acb1a173760c965830c143ab0004bdbae161e2441eb9a9a0923f692f4e5
Python
11,289
367
from itertools import chain from pathlib import Path from typing import TYPE_CHECKING import matplotlib import numpy as np import pandas as pd from matplotlib.axes import Axes from matplotlib.figure import Figure matplotlib.use("Agg") import matplotlib.pyplot as plt from aislib.misc_utils import ensure_path_exists fr...
052fdf1a09a0626a9573958349b0d5acc2c807fa722eafcd3ea9a8436673c503
Python
11,291
340
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL import numpy as np import os import pandas as pd import pytest from bluepysnap import Circuit from utils import TEST_DATA_DIR from connectome_manipulator.connectome_manipulation.manipul...
578707a758335a31f6e1825b08c2f7f01aec0707baa3c876874efcf4f7476a6a
Python
11,292
315
from __future__ import annotations import hashlib import threading import weakref from pathlib import Path import osam import pytest from PySide6 import QtCore from PySide6 import QtGui from PySide6 import QtWidgets from pytestqt.qtbot import QtBot from labelme import _automation from labelme._shape import Shape fro...
7dd1ac025983b44bc0863c0dcde171d63348486f619e3a3fdd0006eef802f26d
Python
11,295
394
import gzip import os, sys import pickle from tqdm import tqdm from multiprocessing import Pool import lmdb # '2022.09.3' from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem.rdMolAlign import GetBestAlignmentTransform import numpy as np import torch split_key = sys.argv[1] split = torch.load("split...
799607c26f184e72f52c2edade576ac76157bc06a101d19ac781842363440a1f
Python
11,298
355
import json import random import torch torch.manual_seed(123) 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_mult...
9feafa27242828f80f845a98da6c2001fd7b19cef9d3a4ae8ecfa65c1afceb95
Python
11,298
355
import json import random import torch torch.manual_seed(123) 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_mult...
cce78e441cb0f208702180ec0dd7abd44027a1231eedac1d4afdd8a574203a8b
Python
11,299
282
import os import functools import logging from collections import OrderedDict from multiprocessing.pool import ThreadPool from typing import List, Any, Callable import numpy as np from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet from brainscore_core.supported_data_standards.brainio.as...
6bf19d87619b2bc6b6560dcfa3a91e2917962fec73f87f5d9746a68b7c437a78
Python
11,303
253
## ------------------------------------------------------------ ## IMPORTS ## ------------------------------------------------------------ import torch import torch.nn as nn from LSTMConvCell import * ## ------------------------------------------------------------ ## Explain the block ## -----------------------------...
bbc037ecfd93befdfb2de5931e1f939401438ccd04dd60a9d15e065477baaa01
Python
11,303
359
from __future__ import annotations import os import re import pandas as pd from nipype.interfaces.base import CommandLineInputSpec, File, TraitedSpec, CommandLine, BaseInterfaceInputSpec, BaseInterface from traits.api import Str, Int, Directory from pathlib import Path from typing import Dict, List, Optional, Tuple, Un...
a9952221e71d668b0d2039e3b29873ab7857d3774640789e5e284fd28ba6700d
Python
11,306
288
import torch.nn as nn import torch from torch import Tensor from typing import List, Tuple, Optional from bism.modules.runet_block import RBlock2D, RBlock3D from bism.modules.layer_norm import LayerNorm from bism.modules.concat import ConcatConv2D, ConcatConv3D from bism.modules.upsample_layer import UpSampleLayer3D, ...
afcba40a8ddfb430ac2ba5e7b6f1509741452faa7843a65321dbc3e6e9bc9470
Python
11,307
326
""" 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...
077438866b23182831220619d7200061e7c42c792728562783d9351f09540236
Python
11,309
337
import argparse import logging import os import random import sys from datetime import datetime import torch import torchmetrics as tm from torch.utils.data import RandomSampler, WeightedRandomSampler, DataLoader from model import ProTact from utils.data import get_dataset from utils.utils import setCpu, Seed_everyt...
8d8f6336bdeb726d4858e68c7b68090c9bf200540e54c3e4b29595493d36d88a
Python
11,309
325
""" Negative sample generation with indirect association filtering. This module implements the negative sampling strategy described in Methods 2.2, which excludes metabolite-disease pairs that share proteins to avoid false negatives. Key Principle: -------------- If a metabolite M associates with protein P, and prote...
e63b59c5ad430c46feda2526da5562f0b868074706c1ea128198290742633034
Python
11,309
210
import numpy as np from brainscore_core import Metric from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet from tqdm import tqdm from typing import Dict import xarray as xr from brainscore_vision import load_dataset, load_stimulus_set, load_metric from brainscore_core.supported_data_standard...
54c8d02e0f02e9e03a8deb0ff2373786c0b1436ff28e4d7c2b0294e41deb41b8
Python
11,311
242
import logging from typing import Union import numpy as np from tqdm import tqdm from brainscore_vision.metric_helpers.xarray_utils import XarrayRegression from brainscore_vision.utils import fullname # do not import tensorflow at top level to avoid forcing users to install it if they don't use this metric def mask...
510efe765fb904b4c622c76aceb14e181d82d8c9cff11d985e7286c39814286f
Python
11,314
462
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Project on template and average """ import os import mbflim.utils as ut import mbflim.visualization as vis import mbflim.image.image_processing as pro import mbflim.image.image_set_processing as setpro import mbflim.flim.flim_visualization as fl_vis import mbflim.pa...
4f61ab21d7d3debe770b50dd5aca84274188775a85f5ddf563df426d7104c83f
Python
11,315
333
# 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...
788acb587f12b38479ed9eebd794a83a8b7978d929bdf7d4af9925f93bc62a22
Python
11,316
255
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['MT.zip']) tmp_dir = tempfile.Temporary...
e04430ffa34b3c0ad786924bedf89a0799debf907cb4ef44e4eb06b42206c17e
Python
11,316
371
''' Auxiliary functions to help with signal processing. ''' from typing import Any, Union, Callable, Dict import numpy as np import sklearn, scipy from .math import * def align_y_with_x(x: np.ndarray, y: np.ndarray, f: Callable = cosine, epsilon: float = 1e-27) -> int: ''' ''' # get parameters ...
1d00c9dfdeec1a72aa71a3f929c09e3b2307582381d0e2732dc1dbbf056df65f
Python
11,319
462
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Project on template and average """ import os import mbflim.utils as ut import mbflim.visualization as vis import mbflim.image.image_processing as pro import mbflim.image.image_set_processing as setpro import mbflim.flim.flim_visualization as fl_vis import mbflim.pa...
960b4c137aca58d6a88519cbb7a507bcfba1b3cee2b95c29c6c3c7d2e3791589
Python
11,321
230
#!/usr/bin/python3 # -*- coding: utf-8 -*- # from qtpy.QtPrintSupport import QPrintDialog from qtpy.QtGui import QAction from qtpy.QtWidgets import QMessageBox, QMainWindow, QMenu, QFileDialog, QApplication from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.view.ModeToggle import ModeToggle from napari_dm...
b6921faec60eb0ea5ffce4eb6505d70c245a0dfb642ba2b94198b9b6dbe53b07
Python
11,321
242
import pathlib import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import seaborn as sns import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras import backend from functions import * from the_model import * #fu...
10c7961e4109bfc7c54e6e35b4826d06a5f4dede5bfcce84503d1e34eec2349e
Python
11,325
335
import random from datetime import datetime import pandas as pd # camera recording import win32gui from psychopy import core, event, visual from psychopy.constants import FINISHED, NOT_STARTED, PAUSED, PLAYING from psychopy.hardware.emulator import launchScan from pywinauto.application import Application def run_vi...
d5a4a0c082e90a6d5b91e68bb08b8fb8ab8afd9e0fee4ee1982127f28b88a123
Python
11,326
265
"""Test the functions in the yasa/others.py file.""" import unittest from itertools import product import mne import numpy as np import pytest from mne.filter import filter_data from yasa.fetchers import fetch_sample from yasa.others import ( _index_to_events, _merge_close, _zerocrossings, get_center...
ff8fbbc709aac8e6a5e7e8b516e6680cb30f9f3647acf1f78f73e899d090350e
Python
11,328
249
#!/usr/bin/python # ---------------------------------------------------------------------------------------- # A wrapper class for the Hamilton MVP valve chain and the Widgets that display # their status. All interactions with the valve chain should go through this # class. # ------------------------------------------...
1dbafcdd5751f689b6443649e0a21628fb6782f9b1822b7d58d820aeb618d7a3
Python
11,343
332
from unittest.mock import Mock import numpy as np import pytest import torch from mcmlnet.training.data_loading.datasets import ( DatasetMCPred, DatasetMCPredDirect, mix_spectra_randomly, ) class TestDatasetMCPredDirect: """Test cases for DatasetMCPredDirect class.""" def setup_method(self) -> ...
7cd655d2ad80e25ce1650c9e3d12c74abb6e5a36f1431befdd5ee878dcc12d59
Python
11,343
327
import warnings from typing import NamedTuple, Optional import torch from torch import Tensor from torch_geometric.utils import cumsum, degree, to_dense_batch class KNNOutput(NamedTuple): score: Tensor index: Tensor class KNNIndex: r"""A base class to perform fast :math:`k`-nearest neighbor search ...
3c6cec4587b39f16e01ea92f6104cb3708db911b53f614729f5343bb5123bee3
Python
11,344
230
import os import tqdm from glob import glob import json import numpy as np import pandas as pd import skimage.io as skio from natsort import natsorted from metrics import generate_dice_scores, instance_dice from skimage.morphology import closing, cube, label, remove_small_holes from napari_simpleitk_image_processing im...
5394e4b7750c36629b95c7ccedd959aa090d3411bf07b7edec7f0ec98f3a308e
Python
11,346
368
from itertools import chain from pathlib import Path from typing import TYPE_CHECKING import matplotlib import numpy as np import pandas as pd from matplotlib.axes import Axes from matplotlib.figure import Figure matplotlib.use("Agg") import matplotlib.pyplot as plt from aislib.misc_utils import ensure_path_exists fr...
e718055203f2a553214fdc041ab7f2604f7dfed04f57cc147dec3c24bf4ece26
Python
11,355
207
"""Evaluate fixed OpenPlant splits and export metrics and per-image predictions.""" from __future__ import annotations import argparse import csv import json import math from pathlib import Path from .train_utils import (boolean, choose_device, create_model, file_sha256, load_checkpoint, loa...
1aff9045c1e1f16479164a203e576afa83f889e0c12ea30c7dca6600e91537a6
Python
11,356
312
"""Affine construction, nearest-streamline lookup, and streamline-plane angle. The angle cases are anchored at values that can be verified by inspection: a streamline perpendicular to the plane is 90 degrees, one lying in the plane is 0, and one at 45 degrees is 45. """ import numpy as np import pytest from ccf_stre...
eda5539d1ac238cc3b73b9681a762cc52c46266d5e599dc6b47b61ec2990844f
Python
11,358
338
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import base64 import json import shutil from abc import ABCMeta, abstractmethod from collections.abc import Callable, Mapping from enum import Enum, auto from pathlib import Path from typing import Any, TypeVar, cast from attrs import define import...
db57f5761062f5b797386b59c53599b38a1a02e2f381698157d66dc582eb8771
Python
11,361
436
""" Utility Functions for H-FNO This module provides helper functions for: - Reproducibility (seed setting) - Device management - Checkpoint loading/saving - Model analysis - Visualization """ import torch import torch.nn as nn import numpy as np import random from pathlib import Path from typing ...
3fea5812e69cd4324b7532bd370273c312fff9497f2b7eec1eefed7d4e253552
Python
11,366
333
from copy import copy import argparse from tqdm import tqdm import torch import torch.nn.functional as F from torch.nn import ModuleList, Linear, ParameterDict, Parameter from torch_sparse import SparseTensor from torch_geometric.utils import to_undirected from torch_geometric.data import NeighborSampler from torch_ge...
782e947ac718118278257a0413cb8c275971f97dad546e786893cb15085e59bb
Python
11,368
286
import argparse import numpy as np import fbpca import warnings from numpy.linalg import pinv from scipy.io import savemat from scipy.signal import hilbert from scipy.stats import zscore from utils.cpca_reconstruction import cpca_recon from utils.load_write import load_data, write_out from xmca.tools.rotation import v...
fbc53a81d79e794727aa82d6152030671f109dcbbc1ebaee8d75ee9fc4048885
Python
11,368
252
#!/usr/bin/python # ---------------------------------------------------------------------------------------- # A wrapper class for the custom valve widget defined in ui_layouts/ui_qt_valve. # This class provides the basic I/O required to set and read various valve # properties. # --------------------------------------...
ecd571eac9eab8c479e77291cfd977c8c872edae84d3b4ed270112425c0783f7
Python
11,373
324
from __future__ import annotations import builtins from abc import ABC, abstractmethod from collections.abc import Callable, Iterable from math import ceil, log10 from typing import TYPE_CHECKING, TypeVar, Union, cast from magicgui.types import Undefined, _Undefined from ._value_widget import BaseValueWidget, ValueW...
e8cf6e7e799e51f0dc321aecd994fbd92e29cd53e033ef32307c36d479e04098
Python
11,374
297
###1_Shiaelis_et_al # %% class SimpleCNN_RGB(nn.Module): #https://doi.org/10.1021/acsnano.2c10159 , input is of size 17*17*3 padded with 0 def __init__(self, attention_output_size, classifier_hidden_dim, dropout_prob=0.2): # def __init__(self, num_classes, attention_output_size ): super(SimpleCNN_...
7592dc32c46fe1116c7e87facc82f94c2f9e36914873cf439acd103764878642
Python
11,376
286
import h5py import sys import yaml import os import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from sklearn.metrics.pairwise import cosine_similarity import git import scipy.cluster.hierarchy as hac from scipy.spatial.distance import pdist import pandas as pd pathpath, myrun, ncluststr, cmeth...
7fbe72755170d1de2d48386b4019cf45588d42765dc6a9993b1c1dcf6eb53d6d
Python
11,376
243
import sys, os # os.environ['SDL_VIDEODRIVER'] = 'windows' import pygame import random import tkinter.font import numpy as np import pandas as pd import func_training_mrikey, func_MRI_mrikey, func_MRI_prac_mrikey config_name = 'myapp.cfg' if getattr(sys, 'frozen', False): application_path = os.path.dirname(sys.e...
6f5b6a1c62171c45f3a5643fbfdb85358b38755779a5be158e1f227178fcca8d
Python
11,386
266
import importlib import cv2 import math import numpy as np from skimage.exposure import rescale_intensity import tifffile as tiff from napari_dmc_brainmap.utils import get_info # todo warning for overwriting def create_dirs(params, input_path): save_dirs = {} for operation in params['operations']: i...
f3ccd2c91658ef16e0d340d6ba60619bf002054f3aee4d33bd1a4aece77003b3
Python
11,389
326
import pandas as pd import numpy as np import tensorflow as tf from tensorflow import keras import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import matplotlib.patches as patches import matplotlib.cm as cm from tqdm import tqdm from PIL import Image from skimage import measure, morphology # -----...
bd02df0750fab1b26a32ff3a87002999eba72812e51315f609257b48499094cc
Python
11,390
321
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved """Triton kernel for faster and memory efficient sigmoid focal loss""" import torch import triton import triton.language as tl from torch._inductor.runtime.triton_helpers import libdevice """ The sigmoid focal loss is defined as: prob = i...
ea10cfa41c1c738703b17c26f6eed627ed85989b753e6f2130c8576ec35cd27b
Python
11,394
289
""" Tests for deepreg/dataset/loader/grouped_loader.py in pytest style """ from os.path import join from typing import List import numpy as np import pytest from deepreg.dataset.loader.grouped_loader import GroupedDataLoader from deepreg.dataset.loader.h5_loader import H5FileLoader from deepreg.dataset.loader.nifti_l...
e25095e811415af89b1eeb1eae77364e4ee3bb389566199ba70a5e716a8e5321
Python
11,397
311
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
45f9948fa05209105f395ebfd532a1641d5d5de1ae9e768cc815855c4ba576cc
Python
11,398
311
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
fd4120006fdee1a9c7a1b2c5eabcc017c638070bf7b458937778969d7be0a90d
Python
11,399
342
#!/bin/python3 # adapted from Jannik Luboeinski's example here: https://github.com/jlubo/arbor_ou_lif_example import random import subprocess import arbor as A from arbor import units as U import numpy as np import matplotlib.pyplot as plt def make_catalogue(): # build a new catalogue out = subprocess.getou...
39e32c8c8fde386bd59e82c484f50ab240158bba99507cd57711af187b750f3d
Python
11,400
279
""" Mask classification functions. """ import numpy as np def classify_manual(masks, template): """ Opens a GUI that lets you manually classify masks into any of the valid types. :param np.array masks: 3-d array of masks (num_masks, image_height, image_width) :param np.array template: Image used as backg...
446dce8e57aab34646f08798932aed67413ec612f1e3e4e229a33e418781bd31
Python
11,400
324
#!/usr/bin/env python """ This module handles communicating with HAL to capture images. The captured images are directly added to the item store. Hazen 10/18 """ import contextlib import os import warnings from PyQt5 import QtCore, QtGui import storm_control.sc_library.parameters as params import storm_control.steve...
6b7ec4f9030ff8916700e2ee494138cec70e7ca3c9e4cbbb4aaa21648ba06f76
Python
11,400
270
"""Tests for HRTFGainLayerMLP and HRTFGainLayerMLPReg sample_from_priors behavior. Verifies that sample_from_priors correctly resamples MLP weights/biases and that JSON save/load does NOT resample (preserving fitted parameters). """ import pytest import numpy as np from nems import Model from nems.layers.state impor...
99fd59cd57abcebb89bf5345aff877f18edb4d47e1ee89b3e900adb5f02dd79b
Python
11,400
373
from collections.abc import Sequence from functools import partial from pathlib import Path from aislib.misc_utils import ensure_path_exists from docs.doc_modules.c_sequence_outputs.utils import get_content_root from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save from docs.doc_modules...
9c3730b469d14c930597c00275219d0167dddb701ad9ea006c9262be3fad1b7d
Python
11,402
195
import matplotlib matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 from brainvoice.data.brainvoice_loaders import load_data, load_labels import argparse import pandas as pd import rsatoolbox from rsatoolbox import rdm from rsatoolbox.vis.colors import rdm_colormap_classic as rdm_colorm...