sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ae92bb5d1333cd266ac4bc4e539b905d42d1fe2eb85d533501bc171247813b4c | Python | 5,798 | 112 | from typing import Tuple
import numpy as np
from batchgenerators.utilities.file_and_folder_operations import *
from nnunetv2.evaluation.evaluate_predictions import load_summary_json
from nnunetv2.paths import nnUNet_results
from nnunetv2.utilities.dataset_name_id_conversion import maybe_convert_to_dataset_name, conve... |
b293ea157d8f8635179088b5a7dbab93d4e1a4f328fef7e9cd541a820bfa381f | Python | 5,798 | 161 | """
Tests functionality of the PairedDataLoader
"""
from os.path import join
import numpy as np
import pytest
from deepreg.dataset.loader.h5_loader import H5FileLoader
from deepreg.dataset.loader.nifti_loader import NiftiFileLoader
from deepreg.dataset.loader.paired_loader import PairedDataLoader
# assign values to ... |
bf00f3a5b9843222a06b1516737b65faf4020a27c6f0d7daf14b5208ec2cc193 | Python | 5,799 | 120 | import torch
import torch.nn as nn
from timm.models.layers import trunc_normal_
# 论文:Agent Attention: On the Integration of Softmax and Linear Attention
# 论文地址:https://arxiv.org/pdf/2312.08874
# 微信公众号:AI缝合术
"""
2024年全网最全即插即用模块,全部免费!包含各种卷积变种、最新注意力机制、特征融合模块、上下采样模块,
适用于人工智能(AI)、深度学习、计算机视觉(CV)领域,适用于图像分类、目标检测、实例分割、语义分割、
单目... |
2f900195292edf35ac3e824b007ddefce975b45a1aa3ac1bfae188ce92102da9 | Python | 5,800 | 173 | #!/usr/bin/env python
"""Agent + MCP + Globus Compute demo: 5-molecule thermo screen on remote HPC.
LLM agent on the laptop, MCP server (``mace_mcp_hpc``) as a local
subprocess, work dispatched to a Globus Compute endpoint on Polaris /
Aurora. Mirrors ``scripts/globus_compute_example/run_agent_mcp_remote.py``
but with... |
884bbb14db669b940d201c73bed8e68bf0506c824e74c6b20c7a63e417781adf | Python | 5,800 | 160 | import os
import glob
import numpy as np
import pandas as pd
import scanpy as sc
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.stats import ttest_ind
from statsmodels.stats.multitest import fdrcorrection
def pval_to_stars(pval):
if pval < 1e-4:
return '****'
elif pval < 1e-3:
return '***'
el... |
d68eead2cbd97c638f60c65e314b2037c37644634da03dceba7d29f4984914f8 | Python | 5,802 | 134 | from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly
from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set
from brainscore_core.supported_data_standards.brainio.s3 import load_stimulus_set_from_s3, load_assembly_from_s3
BIBTEX = """@article{fr... |
ca4090909d50a53c8d978e0e7b22ae0758ff7f1516c8d2d58c5859aa6f82b0fa | Python | 5,803 | 137 | from dipy.io.streamline import load_trk
from fury.colormap import create_colormap
from fury import actor, window, colormap as cmap
import matplotlib.pyplot as plt
import nibabel as nib
import numpy as np
from os.path import join as ospj
import pandas as pd
from scipy.ndimage import gaussian_filter, zoom
from matplotli... |
71bc3bdd174f768e4da77c2264bb160aeaa811d93beac891e600e8cdee634880 | Python | 5,805 | 178 | #!/usr/bin/env python3
"""Download public study data from GEO and Zenodo.
Examples
--------
List everything without downloading:
python scripts/download_public_data.py --dry-run
Download all GEO series matrix/supplementary files plus the Zenodo record:
python scripts/download_public_data.py --dest data/public... |
cf72b68346d4e800beee725f47cdf43437203e601ebaf4df220b2fef8056a7ea | Python | 5,805 | 199 | import os
import sys
from typing import Dict, Any, Optional, Tuple
import re
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
from src.llm_orchestrator.base_llm import BaseLLM
from src.llm_orchestrator.prompt_templates import (
get_code_generation_prompt,
get_system_prompt
)
from s... |
0650f88564f399ea2431c53fb507f1c506689df48d669a8e49bcfa6a9c56eea7 | Python | 5,812 | 149 | #!/usr/bin/env python
import pdb
import math
import numpy as np
import torch
from torch import nn
from .utils import build_montage, normalize
class SineLayer(nn.Module):
'''
See paper sec. 3.2, final paragraph, and supplement Sec. 1.5 for
discussion of omega_0.
If is_first=True, om... |
b4410ac1dc9a7bb3a09827520fa08454f9b397608775e2fe4ebfb7c8dbb02666 | Python | 5,812 | 144 | # 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 torch
import torch.nn as nn
from torch.nn import functional as F
from typing import Tuple
from ..modeling import ... |
0ef530a32c6601715104ab20214b51b5221257ce6c03e14e26311ad358370aff | Python | 5,813 | 149 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
# external inputs
import numpy as np
import nibabel as nb
def robust_combination(fileUNI, fileINV1, fileINV2, regularisation,
path_output):
"""Robust combination.
This script implements the regularisation proposed in ... |
57194d982a02ae8e3c96653a7f5892f34798b79c080e8d7521ce537fd8552568 | Python | 5,813 | 139 | import glob
import json
import nibabel as nib
from nilearn import surface, datasets, plotting
from nilearn.plotting import show
import numpy as np
import os
from os.path import join as ospj
import re
import sys
"""
This script uses nilearn vol_to_surf to sample the binarized TDI map (in LAS+ orientation, native acpc s... |
9b8dcf229ce81e54908850af25403bb6e65abcb46990531df0f5eba612ae3294 | Python | 5,813 | 202 | # Train a Linear Regressor
# Imports
import copy
import numpy as np
import numpy.typing as npt
from sklearn.model_selection import train_test_split
import torch
import torch.nn as nn
import torch.optim as optim
from modules.tools.types_abbrv import MLP_REG_TYPE
def train(
X: npt.NDArray[float], y: npt.NDArr... |
f12e66985c8ee2a68d1ee962910d6530390aa2acb9a4d3c9a5d08abc7895ee4d | Python | 5,813 | 160 | """Data-loading utilities."""
from __future__ import annotations
from pathlib import Path
from typing import Literal, Sequence
import numpy as np
import numpy.typing as npt
import torch
from torch.utils.data import Dataset
from tqdm.contrib.concurrent import thread_map
class WSIBagDataset(Dataset):
"""
A P... |
b862e60047120817a265ced6c9afbfc48c707d6f4cf10b6b5998755a2bac5d6d | Python | 5,814 | 209 | import pytest
import torch
from flair.embeddings import (
WordEmbeddings,
TokenEmbeddings,
StackedEmbeddings,
DocumentPoolEmbeddings,
FlairEmbeddings,
DocumentRNNEmbeddings,
DocumentLMEmbeddings,
)
from flair.data import Sentence, Dictionary
from flair.models import LanguageModel
def tes... |
b7fca96cf2971eb3eac59e78776b5b44159c09fe955513ca1a22971a2ee319c3 | Python | 5,815 | 156 | """
Load paired image data.
Supported formats: h5 and Nifti.
Image data can be labeled or unlabeled.
"""
import random
import tensorflow as tf
from typing import List, Tuple, Union
from deepreg.dataset.loader.interface import (
AbstractPairedDataLoader,
GeneratorDataLoader,
)
from deepreg.dataset.util import c... |
c72a3a2feb553149299fbf00587d2ca99574c212fed6d7993693681f54aac491 | Python | 5,815 | 129 | import os
from pathlib import Path
import json
import numpy as np
import xarray as xr
import pandas as pd
import scipy.io as sio
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly
from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet
from brainsc... |
242a78fcea0fc31994630bdc1c62ecb17dd28b1c95c1dad33d7c4e90f30a858f | Python | 5,816 | 176 | from collections.abc import Callable
from dataclasses import dataclass
from typing import TYPE_CHECKING, Literal, cast
import torch
import torch.nn.functional as F
from torch import nn
from eir.models.layers.attention_layers import Transformer
from eir.models.tensor_broker.tensor_broker_projection_layers import (
... |
a35b987f2d12f74d9772d3e7a1caef5a131c4dccb5ab2c154bfe7caccb7c30e5 | Python | 5,816 | 169 | """Magicgui application object, wrapping a backend application."""
from __future__ import annotations
import signal
from collections.abc import Callable
from contextlib import contextmanager
from importlib import import_module
from typing import TYPE_CHECKING, Any, Union
from magicgui.backends import BACKENDS
if TY... |
41101963bf1288f48b5ba05f7d386c5c4662fcb36e71ede2b9ad66486dd2b947 | Python | 5,818 | 186 | """
BIDS physiological file output function
AUTHOR : Mike Tyszka
PLACE : Caltech Brain Imaging Center
DATES : 2024-12-13 JMT Consolidate BIDS physio handling here
"""
import json
import os
import os.path as op
def save_bids_physio(bids_outdir, bids_stub, physio_df):
"""
:param bids_outdir: str, Path-like... |
600081da82762a5b046417ab7fb05dd6b822e2a2b36f30ac4939beda46da7f12 | Python | 5,818 | 208 | # Copyright 2022 Calico 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, ... |
86464c2ff2c6843446183393421261077014b82de1e5df78fe0a6be961cdd329 | Python | 5,819 | 205 | #!/usr/bin/python
#
## @file
#
# For testing how to write 2048 x 2048 pixels at 100fps.
#
# Hazen 10/13
#
import ctypes
import ctypes.util
import numpy
import time
import hamamatsu_camera as hc
print "camera 0 model:", hc.getModelInfo(0)
hcam = hc.HamamatsuCameraMR(0)
# Set camera parameters.
... |
29af75e597c366c7c340f43a98385e84ec3726bcf7ad35a4955913b44c8fbe7d | Python | 5,820 | 47 | corpus_map={'ner':{'eng':'CONLL_03_ENGLISH','en':'CONLL_03','nl':'CONLL_03_DUTCH','es':'CONLL_03_SPANISH','de':'CONLL_03_GERMAN'},
'newner':{'en':'CONLL_03_NEW','nl':'CONLL_03_DUTCH_NEW','es':'CONLL_03_SPANISH_NEW','de':'CONLL_03_GERMAN_NEW'},
'docner':{'en':'CONLL_03_ENGLISH_DOC'},
'ner_dp':{'en':'CONLL_03_DP... |
4d72a32e0c3e93b50066887dc87573cd00f1b94f86e72b9b9a5f0aa3b77dcc36 | Python | 5,823 | 182 | import argparse
import os
import os.path as osp
import time
import numpy as np
import torch
import torch.nn.functional as F
from sklearn.metrics import f1_score
import pandas
import json
import torch_geometric.transforms as T
from torch_geometric.nn import ChebConv, GCNConv, Linear # noqa
from tqdm import tqdm
from sk... |
a73d1550b715e2917a22551cd7deb42cd89414abfbce1ed3ebee0f5fd3fb8b6a | Python | 5,823 | 144 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Transform tractogram(s) contained in the hdf5 output from a connectivity
script, using an affine/rigid transformation and nonlinear deformation
(optional).
See scil_tractogram_apply_transformto apply directly to a tractogram.
For more information on how to use the re... |
b22e97c2d20665292ff981276f4d8e7662738e05b72684d5f39433d4651826fc | Python | 5,823 | 143 | '''
CH4F
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for CH4F:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy and... |
cc287acd50b8b28011d38c55b6d85f6525ca6844a54079047d2c39a08919b6f3 | Python | 5,824 | 166 | from typing import Any
import numpy as np
import torch
import torch.nn as nn
import seisbench.util as sbu
from .base import WaveformModel
class BasicPhaseAE(WaveformModel):
"""
Simple AutoEncoder network architecture to pick P-/S-phases,
from Woollam et al., (2019).
.. document_args:: seisbench.mo... |
f0a626676e32f6c2ed834ac6d93a82d247c62fbfadf63c93543ec4223044888d | Python | 5,827 | 168 | from typing import Any
import pyro # type: ignore
import torch
from pyro import deterministic, param, plate, sample
from pyro.distributions import Exponential, Gamma, GammaPoisson, Normal # type: ignore
from pyro.distributions import TransformedDistribution as TD
from pyro.distributions.constraints import positive ... |
42d85bcd8e4d38f42c4e2dd07e1236be0a6937a441e8bcd0d01bf8d969efdb9e | Python | 5,828 | 181 | """Run a processing function over multiple items in parallel."""
from __future__ import annotations
import importlib
import importlib.abc
import multiprocessing as mp
import os
import sys
import traceback
from collections.abc import Callable
from pathlib import Path
from typing import Any
from . import report
from o... |
13d01466710aebf551f8fefa82a85b4cc4b9f080939b1c60e4e7053eb2323244 | Python | 5,830 | 178 | import torch
import torch.nn as nn
import numpy as np
import ase
from ase.io import read
# utils imports
from utils.plot_corr import plot_corr
from utils.neuralnets.FFNet import FFNet
'''
Calculator for the atomic simulation environment (ASE)
that evaluates energies and forces using a neural network
'''
class KerNNCa... |
7d94a55ca4242744dcecdc7e1404dde5cb313b7f99fae1e1120860f9da2090e0 | Python | 5,830 | 212 |
###############################################################################
#################### Boilerplate ########################
###############################################################################
import pandas as pd
import matplotlib.pyplot as plt
import os
import matplotli... |
cee5b898e2eddf23ffcb8278644f340337bfe91d65dadd412fc9604c9002b5c7 | Python | 5,830 | 177 | import argparse
import torch
import torch.nn.functional as F
import torch_geometric.transforms as T
from torch_geometric.nn import GCNConv, SAGEConv
from ogb.nodeproppred import PygNodePropPredDataset, Evaluator
from logger import Logger
class GCN(torch.nn.Module):
def __init__(self, in_channels, hidden_chann... |
277d69b9b906591188b042a82fc64046c7c041de7792aa2bfa75727a94825514 | Python | 5,831 | 156 | import torch
from torch import nn
from torch.nn import functional as F
from transformers import BeitModel, BeitConfig
from torch.nn import init
class ChannelPool(nn.Module):
def forward(self, x):
return torch.cat((torch.max(x, 1)[0].unsqueeze(1), torch.mean(x, 1).unsqueeze(1)), dim=1)
class SpatialGate(nn... |
7f090116b2a5ead7e2e6b34ec2149c9ca1786ba2889e06a7ab3972c0374758e1 | Python | 5,832 | 166 | import rootutils
rootutils.setup_root(__file__, indicator=".project-root", pythonpath=True)
from typing import Any, Optional
import lightning as L
from src.model.perceiver_model import (
ConditionedPerceiverConfig,
TopDownPerceiverClassifier
)
import torch
import torch.nn as nn
import torchmetrics as tm
c... |
5046320d9a36508e9c45a91b9358eec54b0c5d3e5ae49c80d025a3deb6117d31 | Python | 5,835 | 152 | #!/usr/bin/python
#
## @file
#
# Code for loading legacy mosaic file formats. This is not currently used,
# nor would it actually work. It is preserved here for reference purposes.
#
# Hazen 07/13
#
def loadLegacyMosaicFile(self, filename):
self.filename = filename
fp = open(filename,... |
855a23b2eb1e6eb4fda667df6e2c2437dd9f5ab5418a454bed144e9c061fe4b9 | Python | 5,835 | 146 | import os
import os.path as osp
import sys
from pathlib import Path
sys.path.append(str(Path(os.path.abspath(__file__)).parents[2]))
import torch
import numpy as np
import pandas as pd
import scipy
import argparse
import networkx as nx
import torch_geometric.transforms as T
from pytorch_dataset.node_dataset import No... |
5c842d3a694648de555883d36f289b995cb816832c7aa64c08693728aac1ffd7 | Python | 5,836 | 168 | """
Intersects ... faster. Suports GenomicInterval datatype and multiple
chromosomes.
"""
import math
import random
from time import process_time
class IntervalTree:
def __init__(self):
self.chroms = {}
def insert(self, interval, linenum=0, other=None):
chrom = interval.chrom
start ... |
0afe643995c5f25f2faf73c6ddd179f7ee37a60e1c648d41d59319bc966161ee | Python | 5,837 | 173 | import math
from collections.abc import Callable
import torch
from torch import nn
from eir.models.layers.attention_layers import SwiGLU
class Transpose(nn.Module):
def __init__(self, dim0, dim1):
super().__init__()
self.dim0 = dim0
self.dim1 = dim1
def forward(self, x):
ret... |
8ceb2ffb1c505c8874973f8a325528aade100af98b2ca0a3d3b8208a93f5b20b | Python | 5,837 | 159 | import brainpy as bp
import brainpy.math as bm
import matplotlib.pyplot as plt
import numpy as np
from scipy import optimize
import math
bm.set_platform('cpu')
class CANN2D(bp.dyn.NeuGroup):
def __init__(self, length, tau=1, tau_v=144, m_0=1., k=8.1, a=0.2, A=10., J0=4., sigma_u=0., sigma_m=0.,
z_min... |
9b031ee77beca2f760ad9b9ab1aa48580f7d25cd29821055a83a4fe5dddb31e7 | Python | 5,838 | 132 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from typing import Any
import cv2
import numpy as np
import torch
from ultralytics.solutions.object_counter import ObjectCounter
from ultralytics.solutions.solutions import SolutionAnnotator, SolutionResults
cla... |
6ed53a001e1bcadb40567f8f7665358ebbba32967d509c2660ac0f2196ac6119 | Python | 5,839 | 120 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
import numpy as np
import torch
from ultralytics.data.augment import LoadVisualPrompt
from ultralytics.models.yolo.detect import DetectionPredictor
from ultralytics.models.yolo.segment import SegmentationPredictor
class YOLOEVPDetectPredictor(Detec... |
8e0b4c8bcf347f70ce6ef17f2e07562bd4a9a4b6fb044fe5872e06f56758df3c | Python | 5,843 | 143 | import numpy as np
from scipy.ndimage import gaussian_filter1d
from tqdm import tqdm
from typing import Literal
from argclz import AbstractParser, argument
from neuralib.io import csv_header
from neuralib.plot import plot_figure
from neuralib.suite2p import dff_signal, sync_s2p_rigevent
from neuralib.typing import Axe... |
8066502674d6f1ee65773b27f609e30cbdc00fa7b76da7d816f0b3665046669b | Python | 5,846 | 119 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# *************************************************************************** #
# Copyright © 2022, UChicago Argonne, LLC #
# All Rights Reserved #
# Softwar... |
1f189ec02540ae38a401b3621e9034b85e64caa48da9b10e2a810ecd3b3550da | Python | 5,847 | 143 | import numpy as np
import os
os.environ["OPENCV_IO_ENABLE_OPENEXR"] = "1"
import cv2
import matplotlib.pyplot as plt
from os.path import join
def CCI(pred, illushift, D65_chrom):
CCI = np.linalg.norm(pred - D65_chrom, axis = -1)
CCI = 1 - CCI/np.linalg.norm(illushift, axis = -1)
return CCI
def BR(pred, il... |
93baaa116d078a6bbc93a133e757c6d6e9f3059ec1b94fb4c2bc4e88c475bb51 | Python | 5,847 | 152 | import glob
import os
import torch
import glob
import os
import torch
import numpy as np
import random
import matplotlib.pyplot as plt
from skimage.transform import resize
from torch.utils.data import Dataset
from monai.transforms import (Compose,LoadImaged,Rand3DElasticd,NormalizeIntensityd, Spacingd, SpatialPadd,Rand... |
a782b0e79ecddec91981792e016f1bf0e33dbc8c14fc997350c79f14cad094ee | Python | 5,847 | 152 | import glob
import os
import torch
import glob
import os
import torch
import numpy as np
import random
import matplotlib.pyplot as plt
from skimage.transform import resize
from torch.utils.data import Dataset
from monai.transforms import (Compose,LoadImaged,Rand3DElasticd,NormalizeIntensityd, Spacingd, SpatialPadd,Rand... |
53fc43143108487d164d1f2d200d05b238f73ae3b17193f11df5d66411287c50 | Python | 5,848 | 167 | import os
import numpy as np
import tensorflow as tf
import torch
import glob
import utils
import models
import metrics
from generators import encode_onehot
from tensorflow.keras.utils import Progbar
def validate_dti_segs(subject_list,
path_label_list,
path_group_list,
... |
b35423ce1d3a0dfcc1fed8c62f03dc4f4a213b5d3473f406e66be618f474c6d0 | Python | 5,852 | 161 | from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file
import torch
import torch.nn as nn
import math
class Bottle2neck(nn.Module):
expansion = 4
def __init__(self, inplanes, planes, stride=1, downsample=None, baseWidth=26, scale=4, stype='normal'):
""" Constructor
A... |
abd1d6441b7a4ef36f09f254fe06f2f97ecd47fd691bee0b5c99ba431306af52 | Python | 5,853 | 157 | import numpy as np
from collections import defaultdict
#***************************************************************
class Tarjan:
"""
Computes Tarjan's algorithm for finding strongly connected components (cycles) of a graph
Attributes:
edges: dictionary of edges such that edges[dep] = head
... |
f55d9753bda9a08e78dc12339272f06096ad7a5f5b87c1d3f6229d855a4a7a5c | Python | 5,853 | 135 | import os
import os.path as op
import sys
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.gridspec import GridSpec
import seaborn as sns
sys.path.append('/imaging/hauk/rl05/fake_diamond/scripts/preprocessing')
sys.path... |
8864959cacc1b874c81f34baf759168a88bc06595640774b467f238a28387c82 | Python | 5,854 | 168 | """Script to get the names and SMILES for approved drugs from the DrugBank database."""
import xml.etree.ElementTree as ET
from pathlib import Path
import pandas as pd
from rdkit import Chem
from tqdm import tqdm
from admet_ai.constants import (
DRUGBANK_ATC_CODE_COLUMN,
DRUGBANK_ATC_NAME_PREFIX,
DRUGBAN... |
6658989d216fed35071daff8ed974b622493d231a2e76d2e8d5c5c7e98b27a77 | Python | 5,855 | 190 | import argparse
import os
import os.path as osp
import time
import numpy as np
import torch
import torch.nn.functional as F
from sklearn.metrics import f1_score
import pandas
import json
import random
import torch_geometric.transforms as T
from torch_geometric.nn import ChebConv, GCNConv, Linear # noqa
from tqdm impor... |
ae486a583ecb8885bea85378da00eaf52e35afca6a5741bd8c87f1dc7591235d | Python | 5,857 | 215 | import torch.utils.data
import os
import rasterio
import torch
import numpy as np
import torch.nn.functional as F
import random
from utils.progressbar import ProgressBar
LABEL_FILENAME="y.tif"
def read(file):
with rasterio.open(file) as src:
return src.read(), src.profile
class RandomDataset(torch.utils.... |
050b6b7a0fc86ef99b237438f1506f2868a442833d963cfe03efa3419e60d365 | Python | 5,862 | 175 | import argparse
import torch
import torch.nn.functional as F
import torch_geometric.transforms as T
from torch_geometric.nn import GCNConv, SAGEConv
from ogb.nodeproppred import PygNodePropPredDataset, Evaluator
from logger import Logger
class GCN(torch.nn.Module):
def __init__(self, in_channels, hidden_chann... |
455d6bc2661b35aabd5dee1f9f4e7c03c4d1ee556e01c906c616a643d8bd113f | Python | 5,862 | 285 | #!/usr/bin/python3
#
import os
import sys
import argparse
import numpy as np
from sklearn.neighbors import NearestNeighbors
from uac import utils
# Create the parser
my_parser = argparse.ArgumentParser(description="Calculation of old atrial coordinates")
# Add the arguments
my_parser.add_argument("target_path", meta... |
e8f9d37783ada9e603ea501c936f968870852288b5f8e635d0b6b5fcc2977cd5 | Python | 5,862 | 171 | import os
os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"] = "0.5"
os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"] = "false"
import jax
import jax.numpy as jnp
from jax.scipy.stats import norm
import matplotlib.pyplot as plt
import argparse
import json
import numpy as np
import matplotlib.pyplot as plt
import jax.numpy as ... |
02ca1af55b2e8fc569ef01a6a546f53aac58341b01821778ad9e8dacb4b1edca | Python | 5,865 | 47 | corpus_map={'ner':{'eng':'CONLL_03_ENGLISH','en':'CONLL_03','nl':'CONLL_03_DUTCH','es':'CONLL_03_SPANISH','de':'CONLL_03_GERMAN'},
'newner':{'en':'CONLL_03_NEW','nl':'CONLL_03_DUTCH_NEW','es':'CONLL_03_SPANISH_NEW','de':'CONLL_03_GERMAN_NEW'},
'docner':{'en':'CONLL_03_ENGLISH_DOC'},
'ner_dp':{'en':'CONLL_03_DP... |
68f5e280ab455ac5603d6d05a2fc1e4795fc4cb58973110c06baad217331c87c | Python | 5,868 | 178 | from pathlib import Path
import cv2
import numpy as np
from matplotlib import pyplot as plt
from typing import Literal, ClassVar
from argclz import argument, try_int_type
from neuralib.suite2p import SIGNAL_TYPE, Suite2PResult
from neuralib.typing import PathLike
from .cli_core import CommonOptions
__all__ = [
'... |
710bbb24d5cb5936db9d1bdb0cecaa38699acd21a84e6d811474f77351d66576 | Python | 5,870 | 192 | #!/usr/bin/env python3
"""
Note: This would look so much better replaced by XML or at least JSON. But
is not worth to do it for now.
"""
import os
import gzip
import urllib.request, urllib.error, urllib.parse
import logging
class LargeTestsData(object):
"""
Large index tests use quite big datasets. Mak... |
a63bfba097437d6d80ad40771c06a2154b1e031f3c858898e9c009b3d6f7c6aa | Python | 5,871 | 107 | import os
from pathlib import Path
import json
import numpy as np
import xarray as xr
import pandas as pd
from brainscore_core.supported_data_standards.brainio.fetch import get_stimulus_set
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly
from brainscore_core.supported_d... |
2215b9656fd58db4ef653074d19423ca9dc5615d461034ab06fb20cb5f3ca164 | Python | 5,872 | 124 | import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
import numpy as np
from sklearn.manifold import TSNE
import umap
import seaborn as sns
import pandas as pd
import matplotlib.colors as mcolors
from mpl_toolkits.mplot3d import Axes3D
import torch
#data_type = 'test'
data_type = 'val'
ed... |
d7e21a051f20cddefe4e85b9043419c3b8554a5a299651440f5be77f3a86c6eb | Python | 5,872 | 146 | """Train classification model.
Usage:
train.py [options] <patient-id> <train-dir>
train.py -h | --help
train.py --version
Arguments:
<patient-id> Patient ID folder with train, validation, test split files.
Note, we do not check if train/valid/test overlap.
<train-dir> ... |
1a4a6a62318fde9b38ac9b833482ef1909498eeac7d19401f7aa376f75a22df7 | Python | 5,873 | 187 | import argparse
import os
import os.path as osp
import time
import numpy as np
import torch
import torch.nn.functional as F
from sklearn.metrics import f1_score
import pandas
import json
import torch_geometric.transforms as T
from torch_geometric.nn import ChebConv, GCNConv, Linear # noqa
from tqdm import tqdm
from sk... |
35f2ebbfe5065a993d899da57bf84d6f1594eb145fb33b21479d53716745f122 | Python | 5,873 | 162 | # data_loader.py
import os
import pickle
import torch
import numpy as np
import scanpy as sc
from tqdm import tqdm
import logging
import scipy.sparse
from torch.utils.data import Dataset
from scipy.sparse import csr_matrix
logger = logging.getLogger(__name__)
def load_data(config):
path_cfg = config['path_param... |
4fdbb787b78cc3ff0225a058d4180caa6427616cab1f4bb984c86c07e007bc3b | Python | 5,873 | 168 | import os
import re
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from mc_analysis.examples.get_brain_sensitivity_and_equivalent_tofs import PARQUET_FILEPATH
from mc_analysis.fitting.loaders import load_pickle
from mc_analysis.utils.plotting import save_fig, set_default_fontsizes
set_de... |
2f32d9ac53367b422807c4e67f8768bf82f833e196dbc55e4acfbfafbcb3eaae | Python | 5,875 | 126 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import os
import shutil
import sysconfig
import tempfile
import threading
from collections.abc import Callable
from pathlib import Path
from typing import Any
import numpy as np
import torch
from ultralytics.utils... |
1da433c7807fe90d0773e41655113ae644b71e884aa04b24a228ce9b4b6665c1 | Python | 5,876 | 142 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
import argparse
import cv2
from sahi import AutoDetectionModel
from sahi.predict import get_sliced_prediction
from ultralytics.utils.files import increment_path
class SAHIInference:
"""Runs Ultralytics YOLO26 and SAHI for object detection on v... |
6bbafb9ebe83f6a9ec19d24b57175b242672cb3576aafea6cbde13242b1b7c04 | Python | 5,876 | 151 | # TODO: This entire document
import matplotlib.pyplot as plt
import numpy as np
import nems
from nems import Model, Model_List
from nems.layers import WeightChannels, FiniteImpulseResponse, RectifiedLinear
from nems import visualization
# Setting up Demo Data with cells
training_dict, test_dict = nems.load_demo("TAR0... |
8b54ab89e863e601ae123e18210ba54cbe507ab674894aff6cc527c3f1e84507 | Python | 5,876 | 182 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import csv
import json
import os
import random
import sys
from itertools import product
NAME = "users"
def read_rules(name):
rules = []
with open(os.path.join(sys.argv[1], f"{name}.csv")) as f:
reader = csv.DictReader(f)
fo... |
1061761a94acc42b9a6e9846150f96f5d802ed00e67c4dabe6a5146c836a25d0 | Python | 5,877 | 130 | # noinspection PyUnresolvedReferences
import math
# noinspection PyUnresolvedReferences
import pathlib
# noinspection PyUnresolvedReferences
from neuron import h
# noinspection PyUnresolvedReferences
import neuron_interface.neurosim
from .cell_modification_parameters.cell_modification_parameters import (
CellMod... |
5544d391d4e448b1f825dca8ae76308d3fe61ed6f49406a6e56ad3637a57de50 | Python | 5,877 | 196 | # -*- coding: utf-8 -*-
"""Mesh data saved in Hierarchical Data Format version 5 (HDF5)."""
import os
from pathlib import Path
import h5py
import numpy as np
from nibabel.freesurfer.mghformat import MGHHeader
from .filename import get_filename
from .surf import write_mgh
__all__ = ["read_hdf5", "write_hdf5", "extra... |
10985c0c262e2500181cd5511d15c48be4346a4e8e7c2704a82f2d1749f344bb | Python | 5,880 | 167 | from __future__ import annotations
import logging
from typing import Any, Callable
from langchain_core.callbacks import BaseCallbackHandler
from chemgraph.agent.usage import response_usage
logger = logging.getLogger(__name__)
EventCallback = Callable[[str, dict], None]
SUBAGENT_METADATA_KEY = "chemgraph_subagent"
... |
19c2a8d8a36df73e49c2bba609c68855113599eb1dbf984cbac2f9ee83ee5838 | Python | 5,880 | 118 | import os
from pathlib import Path
import json
import numpy as np
import xarray as xr
import pandas as pd
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly
from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet
from brainscore_core.supported_data... |
6c17a945a2b412b65ab5c7d4c123bcd06392b58cd7bf0165727708d125c1c929 | Python | 5,880 | 118 | import os
from pathlib import Path
import json
import numpy as np
import xarray as xr
import pandas as pd
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly
from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet
from brainscore_core.supported_data... |
7acaab0769f53ca7c5b40ec52a05e9cf871303ed7d2ae3c79fd4a77f74942df5 | Python | 5,880 | 131 | from train_gtex import *
from pl_models import LitModelHeadAdapterWrapperRandom
def load_model(random_weights,config,train_ds,train_genes,valid_genes,test_genes,eval_test_gene_during_validation):
if random_weights:
if hasattr(config,'weight_decay'):
weight_decay = float(config.weight_decay... |
7decbef79e4fc824171817944cd3d6c14e6e2b73c9384bda635fdf0edd52c577 | Python | 5,880 | 230 | # flake8: noqa
from .karate import KarateClub
from .tu_dataset import TUDataset
from .gnn_benchmark_dataset import GNNBenchmarkDataset
from .planetoid import Planetoid
from .nell import NELL
from .citation_full import CitationFull, CoraFull
from .coauthor import Coauthor
from .amazon import Amazon
from .ppi import PPI... |
1a52a807e98323627a8ad60de17141acb4bca97492544ebfd91c88ab1d7e679e | Python | 5,881 | 161 | import torch.nn as nn
import torch
from torch_geometric.nn.conv.gat_conv import GATConv
from torch_geometric.nn.conv.gcn_conv import GCNConv
from torch_geometric.nn.conv.rgcn_conv import RGCNConv
class BotGAT(nn.Module):
def __init__(self, hidden_dim, des_size=768, tweet_size=768, num_prop_size=5, cat_pro... |
69b6da25490f8ffc06af3df15c97e0b390b7f2ce67705504c464a0587a28ac22 | Python | 5,881 | 146 | """Create the MEA-NAP output folder tree, mirroring ``CreateOutputFolders.m``.
Also decides *where* that tree goes. The default folder name is today's date,
so a second run on the same day lands exactly on the first one and — until this
— overwrote it silently, results, figures, bundle and all. Naming a run
``…_v2`` i... |
92669bfbf354ac683736fc5bd9da30118bd442d6f47435de2f20b8b12eb96f5e | Python | 5,881 | 266 | # pyned.py contains often used python subroutines
# it is not executable by itself
# Copyright F. Nedelec, 2017--2019
import os, subprocess, math, copy;
def random_color():
R=random.random()
G=random.random()
B=random.random()
return (R, G, B)
def sqr(x):
return x * x;
def uncode(arg):
tr... |
4d9111a3821b2cb34488cdbec3aaaa8803e8c89768708ef8e553ba42a04ba2e3 | Python | 5,882 | 133 | import logging
import os
from typing import Dict, Any, Union, Callable
from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly
from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet
from brainscore_core.benchmarks import Benchmark
from brainscore_core.metrics imp... |
356ad309b7aa58def4c048898202f316d9f59905f74bf337562458d01091da7a | Python | 5,883 | 130 | # noinspection PyUnresolvedReferences
import math
# noinspection PyUnresolvedReferences
import pathlib
# noinspection PyUnresolvedReferences
from neuron import h
# noinspection PyUnresolvedReferences
import neuron_interface.neurosim
from .cell_modification_parameters.cell_modification_parameters import (
CellMod... |
58518aa7bd0fae28407c54014cfa733fd98188a080c4830c11233be49638171d | Python | 5,883 | 165 | #!/usr/bin/env python3
"""
=============================================================================
Austin Dibble
University of Glasgow
2026
neurofm/weights.py
Variant registry and automatic weight download from HuggingFace.
Zenodo is the canonical archive for citation; HuggingFace is used
for programmatic acces... |
cb5fb8cd5e4cdf2c4ba199c4aeb32db7601510a9eb813817a9ee634e6e0a0de7 | Python | 5,883 | 161 | import os
import glob
import shutil
from nipype.interfaces.base import (
File,
Str,
CommandLine,
CommandLineInputSpec,
TraitedSpec,
traits,
)
from cvdproc.config.paths import get_package_path
# dsi_studio_path = get_package_path(
# "data", "lqt", "extdata", "DSI_studio", "dsi-studio", "ds... |
1a3a9cfc1e4e68aa68a42c20749d4aa8524b5196711b9039318565e977e8607f | Python | 5,884 | 182 | import logging
import os
import vtk
import slicer
from slicer.ScriptedLoadableModule import *
from slicer.util import VTKObservationMixin
#
# ImportACPCAutodetect
#
class ImportACPCAutodetect(ScriptedLoadableModule):
"""Uses ScriptedLoadableModule base class, available at:
https://github.com/Slicer/Slicer/... |
a46e05c10ae4b9d07de0452bb4c245ae3af5cefb9994c2cb187bd6c86194994c | Python | 5,884 | 170 | import numpy as np # TODO remove dependency
import conlleval
from collections import namedtuple
from itertools import chain
from util import unique
from logging import warn
BinaryClassificationCounts = namedtuple('BinaryClassificationCounts',
'tp tn fp fn')
BinaryClassifi... |
82036741e75d04782f374ccd5fbd97bd99c48a65715e97c01bf8453d974820ba | Python | 5,886 | 130 | # noinspection PyUnresolvedReferences
import math
# noinspection PyUnresolvedReferences
import pathlib
# noinspection PyUnresolvedReferences
from neuron import h
# noinspection PyUnresolvedReferences
import neuron_interface.neurosim
from .cell_modification_parameters.cell_modification_parameters import (
CellMod... |
1385361165aaaecfa68d6b9949fb5f138737ec7588e96e7e53cddb394b78fbc9 | Python | 5,895 | 122 | import os
from importlib import import_module
from pathlib import Path
cell_graph_config = {
"cell_f_list": [
'area',
'r_equiv',
'r_maj',
'r_min',
'angel',
'ecc',
'maj_x',
'maj_y',
'min_x',
'min_y',
],
"edge_f_list": [
... |
656bfda3240fdfdecbed72de74e076b19577274cd9e3f4f4ed8394e5f355a6c9 | Python | 5,895 | 175 | """
Support for creating dictionaries of `Bitset`s / `BinnedBitset`s from text
files containg sets of "covered" intervals in sequences (e.g. `BED`_ files).
.. BED: http://genome.ucsc.edu/FAQ/FAQformat.html#format1
"""
import re
from warnings import warn
from bx.bitset import (
BinnedBitSet,
MAX,
)
def binn... |
7ff221f6b7811f3844b4b89d0fa748cc945459ef3c8e7aab29958c953ecb696e | Python | 5,895 | 138 | import numpy as np
import pandas as pd
import pyBigWig
import pyfaidx
from . import one_hot
NARROWPEAK_SCHEMA = ["chr", "start", "end", "1", "2", "3", "4", "5", "6", "summit"]
def get_cts(peaks_df, bw, width):
"""
Fetches values from a bigwig bw, given a df with minimally
chr, start and summit columns. Su... |
86f826fa1bb97c8e631a8a1ade1c6564d67c3d1197211b6c9873d86817999151 | Python | 5,895 | 147 | from PyQt5.QtWidgets import QSlider,QWidget,QGridLayout,QLabel,QGraphicsItemGroup
from PyQt5.QtCore import Qt
from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.view.GraphicViewers import ViewerLeft,ViewerRight
from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.view.ModeToggle import ModeToggl... |
c8a04e94f959c3870cfc7d761d19ade0dc7e81f1ba4b4641fd3d4815d72f8972 | Python | 5,895 | 176 | import numpy as np
from skimage import morphology
import cv2
from .misc import rgb_to_scalar
__all__ = ['remove_partials_', 'fill_label_gaps_', 'filter_instances_', 'relabel_', 'stack_labels',
'unary_masks2labels', 'boxes2masks', 'fill_padding_', 'remove_padding']
def remove_partials_(label_stack, border=... |
e7fd72435700ab647842a6dc763317e8d91c174f28a5dbf254a844ca49f01033 | Python | 5,896 | 180 | import pytest
from chemgraph.tools.ase_tools import (
run_ase,
get_symmetry_number,
is_linear_molecule,
)
from chemgraph.tools.cheminformatics_tools import (
smiles_to_atomsdata,
molecule_name_to_smiles,
)
from chemgraph.models.atomsdata import AtomsData
from chemgraph.models.ase_input import ASEOut... |
0b41cb523f2dc7298abaa439b39a3a9b533e4c65e0225f0053912bc9534f1c49 | Python | 5,897 | 184 | from collections.abc import Sequence
from pathlib import Path
from docs.doc_modules.e_pretraining.utils import get_content_root
from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save
from docs.doc_modules.utils import get_saved_model_path
CONTENT_ROOT = CR = get_content_root()
TUTORIAL_N... |
5c798b45db7cbcacc3edf15a8cb4d6a634ab131337aaf512ca5de6fda366e368 | Python | 5,898 | 237 | def test_svd():
import numpy as np
from encore.runners.encore import run_svd
# Dummy data
neurons = 100
timepoints = 2000
# Dummy raster
raster = np.random.rand(neurons, timepoints)
raster = (raster > 0.9).astype(np.int_)
# Parameters
parameters = {
"pks": 3,
"... |
a4afcf2fc1c48cdd2ef45cb3408fdfee703aa166e8dfb536d6b6297688d70359 | Python | 5,898 | 120 | #!/usr/bin/env python
import common
import chromatics
import os
import pandas as pd
import sys
from glob import glob
config_fn = sys.argv[1]
cell_line = config_fn.split('/')[0]
config = common.parse_config(config_fn)
os.chdir(os.path.expanduser(config['working_dir']))
distance_bin_count = 5
negatives_per_bin = 20
l... |
5f9902aaa7244b4e302f71b50c649f7c8f498c8fd002dfe99180e149d2eef6ee | Python | 5,899 | 166 | # usage: trendsurf.py [-h] -i FILENAME -r MASKFILE -o OUTDIR
# [-b <int> BASIS]
#
# Developed at DCCN (Donders Centre for Cognitive Neuroimaging), Donders Institute
# for Brain, Cognition and Behaviour. Radboud University, Nijmegen, The Netherlands
#
# Authors: KV Haak, AF Marquand, CF Beckmann.
#
... |
27762069ca08a3e9f86974f65ef205baf9b035d3a25b68a402f165be90202cb6 | Python | 5,901 | 168 | import itertools
import multiprocessing
import numpy as np
from dipy.io.streamline import load_tractogram
from scilpy.tractanalysis.voxel_boundary_intersection import\
subdivide_streamlines_at_voxel_faces
def _fixel_density_parallel(args):
(peaks, max_theta, dps_key, bundle) = args
return _fixel_density... |
1731872b1324b7507e2655897fd05167040040e9c0fd507ec2ba44d7c8a46933 | Python | 5,902 | 122 | import os
from importlib import import_module
from pathlib import Path
cell_graph_config = {
"cell_f_list": [
'area',
'r_equiv',
'r_maj',
'r_min',
'angel',
'ecc',
'maj_x',
'maj_y',
'min_x',
'min_y',
],
"edge_f_list": [
... |
1e0f9c4ea5d24ea05d4d4044080f7db2bd812364a53520bc6d9fc3ac351cd9ec | Python | 5,902 | 175 | #!/usr/bin/env python
import numpy as np
def load_elecs_txt(fn):
with open(fn, 'r') as f:
elecs = [[float(i) for i in line.split()] for line in f.readlines()]
return np.array(elecs)
def load_tri(filename, print_warnings=False):
""" Loads mesh from tri-file
Parameters
----------
file... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.