sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
d663a33ae24d19749ddd3ed71069ccd5713034b5eddcd764e8659e7c0c07ae35
Python
8,948
243
import torch from torch_geometric.nn import MessagePassing import torch.nn.functional as F from torch_geometric.nn import global_mean_pool, global_add_pool from torch_geometric.utils import degree import math ### GIN convolution along the graph structure class GINConv(MessagePassing): def __init__(self, emb_dim):...
c06e36ad5a47109682db93f1c4d2cdff9379777df0c35d69bdb807d5c07e54aa
Python
8,952
237
import torch import torch.nn as nn from collections import OrderedDict import math from .Maxout_Conv2d import (Maxout_Conv2d,Maxout_Conv2d_BN) #eps=1e-03 #momentum=0.003 eps=1e-05 momentum=0.1 downsample=32 # branches=4 def conv_bn(inp, oup, stride): return nn.Sequential(OrderedDict([ ('1conv',nn.Conv2d(i...
16df6cab6ee1ab09b4d3919cbe62c6c271a82a860ac9609011a394faef186925
Python
8,954
255
# Benchmark script for LightGlue on real images import argparse import time from collections import defaultdict from pathlib import Path import matplotlib.pyplot as plt import numpy as np import torch import torch._dynamo from lightglue import LightGlue, SuperPoint from lightglue.utils import load_image torch.set_gr...
931aaf5ac05672807cb963e8d7a0704ad6ce08831f8903e8b4eb673e2e4ddfa4
Python
8,956
284
from typing import Any import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from .base import WaveformModel class DeepDenoiser(WaveformModel): """ .. document_args:: seisbench.models DeepDenoiser """ _annotate_args = WaveformModel._annotate_args.copy() _annotate...
9c76a52c2a01d17cc2a57efe18b5382c7d179aaeafa3ae47aa63687bf84218c8
Python
8,956
184
""" Test Generating Custom Conductance Inputs Author: Aaron Miller Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig Germany Brain Networks Group Generates synaptic conductance timeseries for AMPA, NMDA, GABAa, and GABAa synapses based on biexponential functions convolved with a crosscut of the Axon...
7e1f1128c5ea88f6ca1e06843ffb5c14c9ff91062dcf11fea76a7cc367d3db7e
Python
8,958
206
import glob import numpy as np import os.path import pandas as pd from PIL import Image from fuse.data.ops.op_base import OpReversibleBase from fuse.data.ops.ops_read import OpReadDataframe from fuse.utils.ndict import NDict from skimage.io import imread from skimage.transform import resize from typing import Optional,...
a3d739e7fbe35f102842f1d70c19c41fc68dd89006d9efc5d9b0f931d10ec238
Python
8,960
303
# -*- coding: utf-8 -*- from dipy.io.utils import get_reference_info import json import nibabel.orientations as ornt import numpy as np from numpy.lib.index_tricks import r_ as row import pickle RAS_AXES_NAMES = ["sagittal", "coronal", "axial"] RAS_AXES_COORDINATES = ["x", "y", "z"] RAS_AXES_BASIS_VECTORS = ["i", "j...
d55afd5eca25dc8a6ac07ddcd17d5a0338be4f424b2c9f9236c0a51d7e7da15f
Python
8,962
254
"""``Isocortex3dProjector``: slab geometry and the three thickness types.""" import numpy as np import pytest from ccf_streamlines.projection import Isocortex3dProjector def _projector(mini_ccf, **kwargs): kwargs.setdefault("hemisphere", "left") return Isocortex3dProjector( mini_ccf.view_lookup_file...
2c2a4cf81f443e9c982b07fd48a5014d105123a181b45bc88d856db0484f7024
Python
8,963
258
import math import numbers from PIL import Image, ImageOps, ImageEnhance import numpy as np import random from scipy.ndimage.morphology import generate_binary_structure, binary_erosion from scipy.ndimage import maximum_filter class Compose(object): def __init__(self, transforms): self.transforms = transfo...
06fc74ddc684f48b7225410315483ad2d39edbd76327942ed8031f9e42d262a3
Python
8,965
208
"""The toolbar, and what happens to it when the window is not wide. A QToolBar that does not fit folds its trailing items into an overflow chevron. That is fine for Tutorial. It was not fine for the Mode selector, which sat at the far end behind an expanding spacer and a logo: adding two actions during the GUI reorgan...
640219a4228a9b467fb349b1078a8e2a4cf8601e57d976b8e4d64089a0e09af3
Python
8,965
242
import copy import pickle import unittest from typing import TypeVar from cvat.apps.engine.lazy_list import LazyList T = TypeVar("T") class SliceGetter: def __class_getitem__(cls, slice_: slice) -> slice: if not isinstance(slice_, slice): raise TypeError("Use slice_getter only for slices") ...
81b1d1f7a99186d07266fb7f503f0af176fea506d8c877dcecefe5ebf2a376fb
Python
8,969
222
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import base64 from pathlib import Path from typing import Any import cv2 import numpy as np from PIL import Image from ultralytics.utils.checks import check_requirements class LLM: """OpenAI-compatible large...
abe85ed919da850dc027b069fb6b6b6fc8c59d284379cff1a717fc246cfafedb
Python
8,969
223
# Model validation metrics from pathlib import Path import matplotlib.pyplot as plt import numpy as np import torch from . import general def fitness(x): # Model fitness as a weighted combination of metrics w = [0.0, 0.0, 0.1, 0.9] # weights for [P, R, mAP@0.5, mAP@0.5:0.95] return (x[:, :4] * w).sum(...
dbc16946a97d16dfaabeba74fa99dc20fa5a32417525e722d6e8b265a2ceb0c3
Python
8,971
198
# (C) Copyright 2019 IBM Corp. # # 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 applicable law or agreed to in writing...
1b8a166e9d6e9ccde7ead215504645f93ff9b400b9f4dfa995538e9c53e3e7e1
Python
8,979
271
# -*- coding: utf-8 -*- """ Pleiotropy comparison with paper of 2024 """ #Study of genes from paper automated profiling of gene function during embryonic developmental import numpy as np import matplotlib.pyplot as plt import pandas as pd from scipy.cluster.hierarchy import dendrogram from matplotlib...
d1f9f4a9732adfa26b56a3196476373c6340f5faeedc46d84cab774e2e6631bd
Python
8,982
245
# Copyright (c) 2020, Soohwan Kim. 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 applicable la...
d2f058e0ba291d4383e9b7cf236a69f822b138a03ee6562b73638e9d630cf6ec
Python
8,983
274
# type: ignore # This file is adapted from external source and kept untyped """ Adapted from: https://github.com/Liuhong99/Sophia - Sophia: A Scalable Stochastic Second-order Optimizer for Language Model Pre-training Original Author: Liuhong99 Notes: This version may include modifications. License: MIT License C...
decb522d188d423cc0bda34d6dac8d87863f2806a8f31dcd0ce2ca892803d417
Python
8,985
267
""" Utilities for working with the local dataset cache. Copied from AllenNLP """ from pathlib import Path from typing import Tuple, Optional, Sequence, cast import os import base64 import logging import shutil import tempfile import re from urllib.parse import urlparse import mmap import requests import zipfile import...
11d0231456ace446977ccc9dea76349e0d8cc33afeeda32e5abb798d4225cc9e
Python
8,990
221
# -*- coding: utf-8 -*- """ Created on Thu Apr 4 02:30:50 2024 @author: aka2333 """ # In[] import numpy as np import scipy from scipy import stats from scipy.stats import vonmises # circular distribution from scipy import ndimage import pandas as pd # basic plot functions import matplotlib as mpl i...
02e05870266cc1d2c49f9fffec85d467980d865479e941616f16bc94bf990dd2
Python
8,994
218
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Martin J. Kuehn, Wadim Koslow, Annalena Lange, Khoa Nguyen # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use...
d74c28fc5b5011e6f6bffad89e1c235efee2faabdb0c21ec9f2cb4a3a1117906
Python
8,994
194
'''Set of functions to construct a graph as a combination of smaller subgraphs (of aparticular shape, defined in the shapes.py file) ''' import graphwave import math import networkx as nx import numpy as np from shapes import * from graphwave.utils.utils import * def build_structure(width_basis, basis_type, list_shap...
11de0e786792be3a813c26f83548a04f87072cb3fa28fb79a984cb3ff822fdfd
Python
8,995
260
import os import time import numpy as np import pandas as pd import matplotlib.pyplot as plt from typing import Dict, Tuple, Optional from dataclasses import dataclass import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) from src.solvers.pemfc_fitter import PEMFCFitter from src.solv...
5a1d58fac54de5aaa53936826a0df9a2b1d497da0ec82c5af0db6b7c7ac81f73
Python
8,996
275
# Kai Sandbrink # 2022-03-09 # Various utility functions import matplotlib.pyplot as plt import numpy as np import yaml, os, copy, math from datetime import datetime # %% GENERAL FUNCTIONS def sigmoid(x): return 1 / (1 + math.exp(-x)) def combine_tuples(tuples): ''' Arguments --------- tuple...
9e71dd39207b0c2c3a736f4d054fc8812d93d4bf1c856419baf2650d19936373
Python
8,997
188
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL """Module for alteration of synapse property values.""" import numpy as np from connectome_manipulator import log, profiler from connectome_manipulator.access_functions import get_node_...
097f3bce0bde06c5f0bf218421e843b5b20ffb54732f1729128392e96f7ed231
Python
8,998
217
from PyNite import FEModel3D import numpy as np from matplotlib import pyplot as plt import sys from time import time import pickle alp = 3.14/6 # needle tip angle E = 35*10**3 # Elastic Modulus of Needle (Nitinol, MPa) G = E/(2*(1+.33)) # Shear Modulus of Needle (Nitinol, MPa)< outer_diameter = 1.270 # mm inner_diame...
3452cd68849995526cab58c206bdf84d6529350890d7a3953f03769fbaece3e2
Python
9,004
320
import datetime import logging from pathlib import Path from typing import Tuple import hydra import numpy as np import pandas as pd from obspy.geodetics import gps2dist_azimuth from pyrocko.modelling import eikonal from tqdm import tqdm logger = logging.getLogger("benchmark") @hydra.main( version_base=None, co...
42dcc05ea9071b83d427f8db4398fbcf31bb2471eca8b9c2abca1d3df16fd4f8
Python
9,007
185
import numpy as np import sys import pandas as pd import glob import os print (os.getcwd()) from matplotlib import pyplot import argparse as argp from GrpPlotUtil2 import group_to_word, read_IDfile def ArgParserSyn(commandline,do_exit): parser = argp.ArgumentParser() parser.add_argument('IDfile', type=str) ...
1bc00c0ae559bbb210a9fba5dbedade87a02d1855f0ad35da3ea9750073594d5
Python
9,008
206
#!/usr/bin/env python # coding: utf-8 ''' Dependencies: pip install pandas numpy matplotlib scipy requests nrrd voxcell External dependencies: calculate_density_mm3(), get_all_filenames(), get_csv_filenames(), extract_prefix_from_filenames() chmod +x script.py In this code we estimate densities: - density1: official...
84ad1cc55a721c11a8b37e318ce25495e6b8a5cba733f30c5f02219ecebfd495
Python
9,013
220
#!/usr/bin/env python """ Interface to a Logitech gamepad 310 joystick. This will also work with some other Logitech joysticks. The joystick needs to be in "direct input" mode. This is done using the switch on the back of the joystick. Hazen 9/12 Jeff 9/12 """ import pywinusb.hid as hid class Gamepad3...
a7de43e944e2330bcb66d797e07e098c0ae8940b6eb94e7a65aee14ccb80f5ec
Python
9,016
215
# -*- coding: utf-8 -*- """TODO""" import numpy as np from scipy.special import expit from scipy.stats import logistic import core.core_global as core from core.core_definitions import simulation_timestep from core.connection import Connection from core.euler_trace_2d import EulerTrace2D class RewiringConnection(Co...
f42d2556e4a4f221e7726dee84b98bc3c00638324b53bd150772c88f255f84e9
Python
9,016
219
# to avoid cluttering: new functionsfile (many functions in functionsPCA are depricated) # contains less functions, more CPU friendly import numpy as np import pandas as pd import pywt from functions.algebra import unitvector, unitvector_space, angle2vec ### IMPORT ### def cwt_signal(signal, scales, dt=1/30, ...
cf2fb0fa7ca5488e7c53ccc85407863b82ac4fd948be88d9fe506c9dd5be3955
Python
9,018
183
#!/usr/bin/env python3 """Stage 3 -- metrics, participant-level inference, and manuscript tables. Reads the prediction files written by stage 2 and emits: tables/main_results.csv discrimination + calibration, with bootstrap CIs tables/operational.csv false alarms per hour and warning lead time ta...
e889d38bab75a7dff778523e60fa1945f623a282dbde399eb8511a4453df58cf
Python
9,023
216
import numpy as np import skimage.io as skio import glob import os from natsort import natsorted import skimage.io as skio import json import shutil from tqdm import tqdm def seed_everything(seed): np.random.seed(seed) def all_zero(lb_file): ''' Check if the label is all zero Args: lb_file: la...
e8c6e3251160a2ff76f322be8c6368e23b583dc9807372ecb7dce96efe355bfc
Python
9,023
163
import chromatics import numpy as np import pandas as pd import scipy.stats as stats def get_enrichment(a, b, c): a_with_c = chromatics.bedtools('intersect -sorted -u -f 1.0', a, c) b_with_c = chromatics.bedtools('intersect -sorted -u -f 1.0', b, c) ct = np.zeros([2, 2]) ct[0, 0] = len(b) - len(b_with...
ba4e03d0291a1acad3c38f178500efd8c40e3219300fbba7278008e20ae5205c
Python
9,025
258
import torch import torch.utils.data as Data import numpy as np import pandas as pd import os import matplotlib.pyplot as plt from sklearn.metrics import mean_squared_error, r2_score from train_model import SpectrumDataset, CONFIG, setup_seed from model.network_947331 import Network import model.network_947331 as netwo...
cf04784619fcadfdb0cb46e50eb25b07b034559a0743ed9dd9cef0a1eafd7f1c
Python
9,025
272
from __future__ import annotations import multiprocessing from typing import Optional, Tuple, Union import cv2 import kornia import numpy as np import torch from scipy import ndimage from sklearn.cluster import MiniBatchKMeans Box = Tuple[float, float, float, float] def normalize_min_max(image: Union[np.ndarray, t...
f8b10875e730267930fc35006ece1d83eaca78b3e81aa9c8d371db907bd70992
Python
9,026
124
""" This script investigates the features within the components of the trained neural network. This version's cropping tries to avoid the radar echo to be included. """ import os import argparse from utils.env_config import setup_environment import timm from data.dataloader import prepare_dataloaders from model_an...
aa3f7b479d7b57d494d59b52e90b5c1cf960b40a18ec16c39c1d62a70bc1c380
Python
9,028
148
"""Small synthetic checks; no OpenPlant images or downloaded weights are used.""" import csv import importlib.util import json import tempfile import unittest from pathlib import Path from openplant.train_utils import TrainConfig, config_dict, read_classes ML_AVAILABLE = all(importlib.util.find_spec(name) for name i...
d691628652d3ea9658b736d40c9cdc5af14fb1c21f4b881c60f340e131e95987
Python
9,029
201
import random import math from typing import List, Mapping, Optional, Union import scanpy as sc import numpy as np import pandas as pd from anndata import AnnData import matplotlib.pyplot as plt import plotly.graph_objects as go from GEASO.plot_utils.color import * def get_color(n=1, cmap: str = 'scanpy', seed: int...
9292db23d7af765086714d4c613d908d0c6df22395aedff7d5ff70140dd5213a
Python
9,030
212
"""CAT-NAP activity statistics. Ports: - ``calTwopActivityStats.m`` → :func:`calc_twop_activity_stats` - ``getCellTypeMatrix.m`` → :func:`get_cell_type_matrix` The stats are the calcium-imaging counterpart of the electrophysiology ``Ephys`` struct (see ``pipeline/step2.py``); they are returned as a dict keyed ...
c9c123c697318227a8f7b0b1cb1b7500c7f55ea63924d191a0e76aa5d568475d
Python
9,031
281
import json import os import sys import tempfile from time import time import numpy as np from pyrosetta import * from pyrosetta.rosetta.protocols.minimization_packing import MinMover from utils_ros.arguments import * #from utils_trX2dy.utils_data import read_fasta from utils_ros.utils_ros import * os.environ["OPENB...
c8e0905d5954d285467cbfaa3887cfb6b475f20eb5f8b563253203571bb727db
Python
9,032
235
import torch import torchvision from torchvision import models import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import os def upsize(x,scale_factor=2): #x = F.interpolate(x, size=e.shape[2:], mode='nearest') x = F.interpolate(x, scale_factor=scale_factor, mode='near...
ed90285d873b129d4d229aaae0274f453341af3240bfa8d9245a395fe74edaf4
Python
9,033
244
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved from typing import Any, List, Tuple, Union import numpy as np import torch from torch.nn import functional as F class Keypoints: """ Stores keypoint **annotation** data. GT Instances have a `gt_keypoints` property containing the x,...
1f5b0bcd4bb68800a495ca556c0c456338123875bba6f93f5174b9e47d538883
Python
9,034
219
import nipype.interfaces.utility as utility from PUMI.engine import FuncPipeline, NestedNode as Node, QcPipeline from PUMI.pipelines.multimodal.image_manipulation import vol2png, pick_volume from PUMI.plot.carpet_plot import plot_carpet from nipype.interfaces import fsl, ants from nipype.interfaces.c3 import C3dAffineT...
4fdf90c1b5f731daf01e564bb627e36b309eacd992e2560864c24a34b4d4945f
Python
9,037
260
# %% import os import glob import random from os import listdir, makedirs from os.path import join, isfile, isdir, basename from tqdm import tqdm import numpy as np import torch from torch._dynamo import OptimizedModule from torch import multiprocessing as mp from datetime import datetime import cv2 from skimage import...
0682863c550128057a4ae2a1272a99e5fd23be4231181506527cde64be5383d6
Python
9,038
219
from functools import partial from typing import List, Tuple, Callable, Union, OrderedDict, Optional, Dict import os.path import os import torch import torch.nn as nn from torch import Tensor import torch.optim.lr_scheduler from torch.utils.data import DataLoader, Dataset from torch.utils.tensorboard import SummaryWri...
9a3a1eea8ee563b043a5d6ecee5360a4284d93a93c46ea537296cfb9cf9fa707
Python
9,039
263
#Aidan Fike #July 21, 2019 # #Updated by Kevin Schult March-July 2020 with contribution from Tim Ling #File to create a chimera script which creates a random pdb structure # #Edited and revised #Minh N. Ho, August 2022 # #NOTE: Errors that are produced by Chimera are sent to a log file, not to #the console. Check every...
d4e9f46aba0badd65c8fb4338969b7c584866c6543c7fa0ac7e92fbcbde08bce
Python
9,039
226
import numpy as np from sklearn.model_selection import train_test_split import torch.utils.data as Data # from orin import GP_WAITER as gp from model import GP_WAITER as gp import shutil import os import torch from torch import nn import torch.optim as optim import pandas as pd from torch.utils.tensorboard import Summa...
06d16715402c53e5f7737679bedbc631112a977aa964f95ae4b8567742438f98
Python
9,046
295
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the PyMVPA package for the # copyright and license terms. # ### ### ### ### ###...
c22086845e283a3f9d249f610f5041081fb853fdd974288376a26194404abeca
Python
9,046
266
from functools import update_wrapper, wraps import torch from torch import Tensor from torch.optim.optimizer import Optimizer try: from torch.optim.optimizer import _use_grad_for_differentiable, _default_to_fused_or_foreach has_recent_pt = True except ImportError: has_recent_pt = False from typing import L...
4b138ee05ddb48d7ae80a2ba5fd25b4422f9030144295c145771afeffd889e86
Python
9,047
288
# coding=utf-8 """ Module to train a network using init files and a CLI. """ import argparse import os from typing import Dict, List, Tuple, Union import tensorflow as tf import deepreg.config.parser as config_parser import deepreg.model.optimizer as opt from deepreg import log from deepreg.callback import build_ch...
be55a555de3b6a1287f20d69cfd3ab62afc1644cdd155fbfc04ff9a2088c8701
Python
9,050
252
# -*- coding: utf-8 -*- # # test_domain_decomposition.py import unittest import arbor as arb # check Arbor's configuration of mpi and gpu gpu_enabled = arb.__config__["gpu"] """ all tests for non-distributed arb.domain_decomposition """ # Dummy recipe class homo_recipe(arb.recipe): def __init__(self, n=4): ...
4b2a11f339dc26b06b1e0f9ab9de8f3a4bb278f48398409a9eeabe85cc6cdb8a
Python
9,051
181
import logging import os from pathlib import Path import pytorch_lightning as pl import torch.nn as nn from pytorch_lightning.plugins import DDPPlugin from project.datasets.PICP.picp_dgl_data_module import PICPDGLDataModule from project.utils.deepinteract_constants import NODE_COUNT_LIMIT, RESIDUE_COUNT_LIMIT from pr...
3e22fcbbc79a2a833b382bf689303ffab7ecd67e037d6ea6245c445c08f2256e
Python
9,056
292
"""Brain-Score wrapper for DeepEISNN EI-SNN CIFAR10 VGG19.""" from __future__ import annotations import functools import json import sys from collections import OrderedDict from pathlib import Path from typing import Any, Iterable import numpy as np if not hasattr(np, "int"): np.int = np.int32 import torch fro...
ac619b6e2b3b8649168dea5aa30958a1a2c6a643f77c7bd2c74c10349294993e
Python
9,058
238
import collections import numpy as np from matplotlib.axes import Axes from scipy.signal import butter, lfilter from scipy.stats import pearsonr from typing import NamedTuple from argclz import AbstractParser from neuralib.io import csv_header from neuralib.plot import plot_figure from neuralib.plot.tools import Ancho...
ce9a2513116b0a7aad2f191f7fd26da064a1e0fa36a3273a63ab5d4b03b5784b
Python
9,061
190
# # Reference : https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3864968/ # # Written by SK Park , NIRAL, UNC # 2021-04-18 import dtiplayground.dmri.preprocessing as prep import yaml from pathlib import Path import os import markdown import numpy as np import time import os # import SLICE_Check.computations as c...
d56361948f814819e1910936fc20fc3aacde85c5e45d95d1ccaa04c614e50fd8
Python
9,063
299
#!/usr/bin/env python # -*- coding : utf-8 -*- """Adds utilities for preparing the data for eddy and analysis""" import os # mkdir import os.path as op # dirname, basename, join, splitext import re # regex substitution import shutil # rmtree import subprocess from ..preprocessing import util # preprocessing DW...
97b47441b806f869c44f9c2aed6e3979a54be951347e1fd4e55249d6ffafe4f6
Python
9,065
239
import typing from typing import Optional, Tuple, Union import torch.nn.functional as F from torch import Tensor 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.typing import PairTensor # ...
1a92e2a0d57365b00574b854524973ec183e0f5d7821e74c10bf108b1a58a2fe
Python
9,070
273
from typing import Literal import torch from torch import Tensor, nn from torch_geometric.nn.models import GAT, GCN from torch_geometric.nn.models.basic_gnn import BasicGNN from torch_geometric.nn.norm.layer_norm import LayerNorm class GNNModelSelector: """Helper class to select and configure GNN models.""" ...
c732662920f3f1345d813b174fc22fabf2743d3c0372887f25da26e77deb8b9a
Python
9,070
159
#!/usr/bin/env python3 from nipype.interfaces.fsl import Reorient2Std from PUMI.engine import BidsPipeline, NestedNode as Node, BidsApp, create_dataset_description from PUMI.pipelines.anat.anat_proc import anat_proc from PUMI.pipelines.func.compcor import anat_noise_roi from PUMI.pipelines.anat.func_to_anat import fun...
e110fd92fc5f17f2ea80e6b931d4e86d005d68274c9ea7b616c90791296bb2ab
Python
9,070
277
import os import sys import time from typing import Dict, Any, Optional, List, Tuple from dataclasses import dataclass, field sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) from src.llm_orchestrator.code_generator import CodeGenerator from src.llm_orchestrator.prompt_templates import get...
e8eb2d8cffb1a603406aaf6fb07f6997624758904e5f5d7916c41c79b9d0a043
Python
9,074
242
# -*- coding: utf-8 -*- """ Example script to set up the parameters for the image processing pipeline """ ######################### Import modules import os, numpy, math import ClearMap.Settings as settings import ClearMap.IO as io from ClearMap.Alignment.Resampling import resampleData; from ClearMap.Alignment.Elas...
502d09cbf69d76e142984037017592decca0533529d8c4e36737ded158f5891d
Python
9,077
243
from typing import Any, Optional, Type import numpy as np import torch import seisbench from .das_base import ( DASAnnotateCallback, DASModel, DASPickingCallback, PatchingStructure, ) from .base import WaveformModel class DASWaveformModelWrapper(DASModel): """ This class is a wrapper to allo...
ba8a3bb4e793108c1af0286fde5065b5c7ec87fdb04e37bc6290419dec546842
Python
9,078
255
# -*- coding: utf-8 -*- # @Author : LG import os from json import dump, load from typing import Dict, Tuple import imgviz import tqdm import yaml class ISAT: """ The ISAT format provides a structured approach for representing image annotations. File Naming: Each image has a corresponding .json file na...
92227f0e7eb7f94f7ea2510666fcdab660c1746aa839477cf03349ffa62ef216
Python
9,084
263
from typing import Literal, Iterable import numpy as np import pandas as pd import pingouin as pg import seaborn as sns from matplotlib import pyplot as plt from matplotlib.axes import Axes from argclz import AbstractParser, argument from argclz.dispatch import Dispatch, dispatch from neuralib.plot import plot_figure...
2e50fe1b4ec1780360d88a7d24d7997f29e89369964f6ed94e7aeea85cd3c9c6
Python
9,085
205
#-*-coding: utf-8 -*- from __future__ import unicode_literals, print_function import sys sys.path.append("../") import unittest import types import jieba if sys.version_info[0] > 2: from imp import reload jieba.initialize() test_contents = [ "这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。", "我不喜欢日本和服。", "雷猴回...
ecd413db9a6659d855c79f5eb5abf0e3391e416a8e1dfee44e0adac0580e3115
Python
9,085
182
import torch import argparse import h5py import numpy as np import xgboost as xgb from sklearn.externals import joblib from multiprocessing.pool import Pool import sys from chinn.common import check_chrom, chrom_to_int from chinn.data_preparation_helper import get_one_side_data_parallel, load_pairs from chinn.train imp...
de4fd8c68b3c901b843e72bd6c96af68a732e3107603fcf46a1fa9dab85df916
Python
9,088
279
""" Created on 2025.04.23 Updated on 2026.02.18 Author: Lina Jeantin Code used to train a random forest classifier to detect sleep stages from markers of iEEG complexity. Requirements: results: dict containing the results of spectral and complexity analysis (see get_complexity_results.py) Organised as...
2e0079df3c66ab9073f36f960ebe1bb297e8c067c3922154dda9bdd50f088831
Python
9,089
268
from collections.abc import Iterable, Sequence from dataclasses import asdict, dataclass from typing import TYPE_CHECKING, Any import eir.models.output.sequence.sequence_output_modules from eir.models.input.sequence.transformer_models import ( BasicTransformerFeatureExtractorModelConfig, SequenceModelConfig, )...
2eb5ae6cbcdcfe317e7f002159032494f39bfdded0935ebd60055207f19101d7
Python
9,089
242
""" 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...
44ac10bb7bbb3e22222c55133976472efe72bdf4d133ea55cc66ac2b925cdd0d
Python
9,089
239
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import time import cv2 from ultralytics import YOLO from ultralytics.utils import LOGGER from ultralytics.utils.plotting import Annotator, colors enable_gpu = False # Set True if running with CUDA model_file = "...
e64e025d4c61a3c73f92e58188fed115032b5cb21805dfd3c6424d5045abacec
Python
9,089
197
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 4 11:42:07 2025 By Guido Meijer """ import numpy as np import pandas as pd import json from pathlib import Path from spikeinterface import load_sorting_analyzer from spikeinterface.widgets import plot_sorting_summary def manual_curation(results_p...
7a73cc1a1289ee5ad4f4d9a307aa9f410e33d35f6de0eb6505669947bb5db864
Python
9,093
279
"""Initializers for TensorFlow layers.""" from typing import List, Optional, Tuple import numpy as np import tensorflow as tf import tensorflow_probability as tfp from tensorflow.keras import Model, layers, initializers from tensorflow.keras.initializers import Initializer tfb = tfp.bijectors class WeightInitializ...
aa4be77327fa7a30077aae9527bcfc083f47e766f30fc53688a9410c09f26c86
Python
9,093
256
import argparse import torch import numpy as np import torch.nn.functional as F from torch.utils.data import DataLoader from torch_sparse import SparseTensor from torch_geometric.data import GraphSAINTRandomWalkSampler from torch_geometric.nn import GCNConv from torch_geometric.utils import to_undirected from ogb.li...
f074926f0d3874d203cdbc385738053e62a11409b311bd8f234726f24be9ae9e
Python
9,093
285
# -*- coding: utf-8 -*- """ Plotting routines for overlaying labels, tilings, and sectioning of 3d data sets Supported functionality: * plot volumetric data as a sequence of tiles via :func:`plotTiling` * overlay points on images via :func:`overlayPoints` and :func:`plotOverlayPoints` * overlay lab...
490b13e60b7463b95fe445944b2e1d80809bfabfbfd6275d2370c2172c79fed3
Python
9,100
374
#!/usr/bin/env python # coding: utf-8 # In[88]: import torch import numpy as np import pandas as pd from torch_geometric.data import Data, HeteroData from datetime import datetime as dt from dataset import fast_merge,df_to_mask from tqdm import tqdm # In[89]: node=pd.read_json("/data2/whr/czl/TwiBot22-baselines/...
9074bda01eb9e9f53e22dfb11eb61435db26fb3a942e6478c70e9e0b1a00498d
Python
9,103
322
import json import numpy as np import pytest import tifffile from napari_dmc_brainmap.stitching.layout import ( layout_from_stage_positions, legacy_serpentine_index_grid, ) from napari_dmc_brainmap.stitching.stitching import ( iter_tile_pages, load_embedded_stage_positions, load_tile_section, ...
0b0456c7e50ddb034e9f98d9ac5c307f59e5382e8153601f385d31a007bbb63f
Python
9,106
182
import csv import os from os.path import join import matplotlib.pyplot as plt import numpy as np import torch import torch.nn.functional as F from PIL import Image def f_score(inputs, target, beta=1, smooth = 1e-5, threhold = 0.5): n, c, h, w = inputs.size() nt, ht, wt, ct = target.size() if h != ht and ...
dacfbe751e1a86635eff9c62b25fc48b16552d2170f162146bdfffcaa553d97d
Python
9,107
238
import numpy as np from glob import glob import os import pandas as pd import re ctx_regions = ['AUD','MO','SS','VIS']#append if you use more!!! runsets = {'wwspont':'runC00dMP3_brain','nwspont':'runC00dMI3_brain',\ 'wwresp':'runCrespZP_brain','nwresp':'runCrespZI_brain',\ 'wwIBL':'runIBLPasdMP3...
bcba3a6b55175e62fa8a32085c622a1f02fb304dbeef490c7af4dd63f03f560d
Python
9,109
297
import numpy as np import scipy.sparse import time def coarsen(A, levels, self_connections=False): """ Coarsen a graph, represented by its adjacency matrix A, at multiple levels. """ graphs, parents = metis(A, levels) perms = compute_perm(parents) # [print('perms len',len(x)) for x in perms...
132a090c6773c4e891c44d91d47ed0a1af3446b8d83bc91044ea128384dd9474
Python
9,110
268
from collections.abc import Iterable, Sequence from dataclasses import asdict, dataclass from typing import TYPE_CHECKING, Any import eir.models.output.sequence.sequence_output_modules from eir.models.input.sequence.transformer_models import ( BasicTransformerFeatureExtractorModelConfig, SequenceModelConfig, )...
b296cfe5972c438056f36b4973f09f53a0ccb3883beb872d4f0031593b5fa39e
Python
9,110
264
"""This file contains generic accessors to handle getting data from core objects""" import numpy as np from .. import core __all__ = ["SliceExtractor", "ItemGetterLoc", "ItemGetterIloc"] class SliceExtractor(object): """ Extracts and validates slice indices for interval, series, and event dimensions. ...
13f42e0a1ce0e0d1e9502a9808ea3c2469bc41a3deeb34d33e1086041c6033ef
Python
9,113
246
import click as ck import pandas as pd import torch as th import numpy as np from torch import nn from torch.nn import functional as F from torch import optim import copy from torch.utils.data import DataLoader, IterableDataset, TensorDataset from itertools import cycle import math from deepgo.torch_utils import FastTe...
5bc6cb493fe2ee059aef6b6552e42481b911c3e4e5b8cc04d56ae38b33ed00b8
Python
9,114
223
from collections import OrderedDict # pylint: disable=g-importing-member import torch import torch.nn as nn import torch.nn.functional as F import functools from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_vision.model_helpers.activations.pytorch import PytorchWrap...
9616221106c244b43ed436bc44aa5ec51c910f52f530bcd998d0b5d4bf891dc9
Python
9,114
224
"""The queue page of the Run tab: several saved analyses, run one after another. The Run tab's other page configures *one* run. This is for the other case — a few different analyses to get through, and nobody wanting to sit up for the handovers. Each entry is a parameter file saved from the toolbar, so building a queu...
a4ec63dc2f510b3d653cbc51a9f6ea675f39950444da096a58718f7cb7dcde94
Python
9,114
199
import logging from dipy.core.gradients import (gradient_table, unique_bvals_tolerance, get_bval_indices) from dipy.io.gradients import read_bvals_bvecs import nibabel as nib import numpy as np from scilpy.dwi.utils import extract_dwi_shell from scilpy.gradients.bvec_bval_tools import...
0cf09ba0d1724b1656be1beb3ebc2064545e8b677b64b1c36bbf36c7ba7f696d
Python
9,118
266
""" Methods for evaluating causal inference models. (C) Copyright 2019 IBM Corp. 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 ...
1756a6c59fa45f664d149c12711008821f9d697062aeb513cf721f68f7a92119
Python
9,119
270
# commonly used functions # updated to Python 3 import sys import subprocess ############################################################################### def read_fasta_file_to_list(fastaFile): myDict = {} inFile = open(fastaFile,'r') line = inFile.readline() line = line.rstrip() if line[0] != ...
db022685550649fca397e51accf59a808ec7789244cef755f9f7ff110dfd5c6a
Python
9,119
251
"tests for bx.align.epo" import random import unittest import numpy as np from bx.align._epo import ( bed_union, cummulative_intervals, ) from bx.align.epo import ( Chain, EPOitem, ) class TestBed(unittest.TestCase): def setUp(self): self.N = random.randint(1, 1000) def test_ci(sel...
cc44ae4c8da43892aaa201d480b7e6bb9aaa0c5da07caa852a5c9ad26fb106b2
Python
9,122
255
import numpy as np from collections import Counter from functools import reduce # Finding Traces # Saving SHAP of all layers def N_top_func(layer,c): percent = 0.1 positive = 0 N_tops = 0 temp = [] # to save and find the min N top among all N tops of training images # load SHAPs values for a layer across ...
cd11ef4bb37d3f56d23dd397f23f2f8e9ef10fb87448cb043737631c3b27cd13
Python
9,122
284
import os, sys, math, random, argparse, numpy as np import bpy import bmesh import blender_util as bu import json from math import radians from mathutils import Matrix obj_types = [0, 1, 2, 3, 4] textypes = [0, 1, 2, 3] pointangle = 3.5 def angle_rad(x): return np.dot(x, (np.pi/180)) ## check if an object exist ...
cd7b9947db2e8f51a57a2030aed4c8cfc8f703b4817a7d5aa96453f52c963819
Python
9,123
225
# In general_utils.py __all__ = ['get_transient_timestamps_mod', 'calculate_auROC', 'significant_modulation_proportion', 'generate_labels_from_cv', 'calculate_auROC_with_permutation'] import numpy as np import scipy.signal from scipy.signal import argrelextrema from sklearn.metrics import roc_auc_score from random imp...
0d95b7ee57a3f8acbdebd052f5ae0163affd966fa9e8e83b829537c6f769c684
Python
9,124
225
from collections import OrderedDict # pylint: disable=g-importing-member import torch import torch.nn as nn import torch.nn.functional as F import functools from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_vision.model_helpers.activations.pytorch import PytorchWrap...
9628224eb15791ff5e3aa9e2a02b24e8e2f06e314cf2973f19c0daf372bb1952
Python
9,124
291
from collections.abc import Sequence from pathlib import Path from typing import TYPE_CHECKING import numpy as np import pytest from eir import train from tests.conftest import should_skip_in_gha_macos from tests.test_modelling.test_modelling_utils import check_performance_result_wrapper if TYPE_CHECKING: pass ...
f6817417f92e1dc750098be0c46d6cbc4dde80d35bac48b1571a3fe16c9eb028
Python
9,124
296
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import hashlib import hmac import json from copy import copy from http import HTTPStatus from typing import TypeVar import requests import rq from crum import get_current_request from django.db.models import Model from django.http import HttpRequest...
97f2a9df84a4e1124774218a56aed689f23e545b6841946f10711295b2527b81
Python
9,126
236
"""Predictions from single folds. Predictions are generated by predictors for causal models. They contain the estimates for single folds and are combined in the EvaluationResults objects for further analysis. """ from collections import namedtuple from typing import Union import warnings import pandas as pd from ..ut...
b2080a55e58f4f1a8161af40f3168426917a86f314a32f5f740b290ec2110ce7
Python
9,126
198
#!/usr/bin/env python """ BundleParc: automatic tract labelling without tractography. This method takes as input fODF maps and outputs 71 bundle label maps. These maps can then be used to perform tractometry/tract profiling/radiomics. The bundle definitions follow TractSeg's minus the whole CC. **IMPORTANT**: fODF i...
2f03cdb8ec90a5fb90cee34f90d2f5f03e4a3b4ba07f39d09055952e55e363bf
Python
9,128
212
from .utils import * from .rclone import rclone_get_data,rclone_upload_data from .slurm import has_slurm, submit_slurm_job from .uge import has_uge, submit_uge_job def load_plugins(): an = dict(files = glob(pjoin( labdata_preferences['plugins_folder'],'analysis_*.py'))) an['names'] = [os.path.basename(...
47ede1dc595d19747e3c2aa5afa9cbcc5dfa8f5831f0cad26f219b42e8c5f607
Python
9,128
239
import importlib import pytest import numpy as np from nems import Model from nems.models.dataset import DataSet from nems.layers import WeightChannels, FiniteImpulseResponse, DoubleExponential from nems.layers.base import Layer def test_constructor(): # No required args model = Model() assert len(model...
89f1c5e4016006acd7ee0276c2e513e393e3d4b915a3d976184de3d36ea27b04
Python
9,130
181
""" Script to perform gene set enrichment analysis. Examples in run.py as thresh_loadings_and_gsea_*(.., do_gsea=True, ..) """ import numpy as np import pandas as pd from joblib import Parallel, delayed import gseapy as gp import os from end2endPLS import BasePLS, ThresholdPredictiveWeights, ThresholdPredictiveCompo...