sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
bce06ca813a3647f4bef07d6293b4c8ae3a19b59702c7cd4440fe98c11907629
Python
11,402
341
from __future__ import annotations import asyncio import json import pathlib import shutil import time from collections import Counter from typing import Any from chemgraph.academy.observability.event_log import CampaignEvent from chemgraph.academy.observability.event_log import read_events from chemgraph.academy.obs...
116c84221ed9526bf2823b0ba94da692cb66785c3b7e650a3b16fff784887b57
Python
11,403
372
import itertools from typing import Any import obspy import torch import torch.nn as nn import torch.nn.functional as F from .base import GroupingHelper, WaveformModel class PhaseTEAM(WaveformModel): """ A multi-station phase picking model, based on a combination of the PhaseNet and the TEAM architecture. ...
139f1d8639529b16f830c868c0485c47daf6ed579ed38672727a20df9ad9f11c
Python
11,403
300
import torch import numpy as np import matplotlib.pyplot as plt from scipy import signal import os from tqdm import tqdm from config import Config from model import SMoE_DOA_Estimator from data_generator import DataGenerator class Evaluator: def __init__(self, config, model_path): self.config...
be256a6e4dc6b27e6eae8c7ec853a2421b61b849231e83a181d5619cd3ed42bd
Python
11,404
303
from __future__ import annotations import argparse import os import random from typing import Dict, List, Tuple import numpy as np import torch import torch.nn as nn from torch.utils.data import DataLoader, random_split from torchvision import datasets, transforms from tqdm import tqdm from mps.utils import set_seed...
4a112c79ad6594e3370c4e0e3add9c98af67a54adc85a15294590d2b2036798c
Python
11,406
430
# Copyright 2017 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, ...
5e2ef4000cd0b6bf8b9f02e9de8098d8668e62d0a000b925157ecf4dbd618640
Python
11,407
355
from copy import deepcopy import pytest import torch from torch import nn from eir.models import model_training_utils from eir.models.input.array import models_cnn from eir.models.input.array.models_cnn import ConvParamSuggestion @pytest.fixture def create_test_util_model(): class TestModel(nn.Module): ...
1aef1ff3604511775fab651d1f4f2dbd2d77aa69f9aca9dfaeaf13273be1b649
Python
11,408
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 ...
8a1a85f09124bd30e9af75fcce2a28a9d80fd4f63bb16d7794b219b633e67a18
Python
11,408
268
import logging import nibabel as nib import numpy as np import pandas as pd from brainsmash.mapgen import Base from joblib import Parallel, delayed from neuromaps.images import load_gifti, load_nifti from neuromaps.nulls.nulls import _get_distmat from scipy.spatial.distance import cdist from tqdm.auto import tqdm fro...
b1c15ad8b3bd12a298f97287dd6570dcc9289910c886b63fe319d1093edbcd59
Python
11,408
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 ...
a9451071d87fdc9751d6fef616ad0559919c91d21f7a6891e67ca95452ecd3cb
Python
11,409
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 ...
0b0dcfc27cfe96fb98a48b5f50090e7ad1fc83bd48ebffdb6e811de76acddbeb
Python
11,411
346
#!/usr/bin/env python3 """ Early & Late Integration (Majority Vote) Runner - Early integration: concatenate all modality features and train a single model. - Late integration: train one model per modality and combine hard predictions (0/1) by majority vote. Models included: - L1 Logistic Regression (L1) - Linear ...
6f185ba6041eec79c0507b2dd08a5a2e261f461a8621022db45945666c66ddb1
Python
11,412
317
"""Argo endpoints for its Anthropic-native and OpenAI-compatible protocols. Claude-prefixed Argo models use Anthropic Messages. Other Argo models use the OpenAI-compatible chat-completions interface. This module owns their shared wire-name mapping, credential resolution, base URLs, and endpoint quirks. """ from __fut...
dd2ea0eb83db7e7654d3398c7dea9f7bc8c36c333135a5bb825839795fcdded5
Python
11,414
211
import os import warnings import matplotlib.pyplot as plt import mlflow import yaml import numpy as np import torch import torch.nn as nn from utils.models import WindTurbineModel from utils.env_config import path_check_and_join, path_dissect_and_join from utils.metrics import prediction_refactoring from captum.attr im...
ad002e80927e11fb39eb24c064a798e4e0fcf1619f40779f79c5c88462361e1e
Python
11,415
253
import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import LightSource import matplotlib.patheffects as PathEffects from mpl_toolkits.mplot3d import Axes3D import matplotlib.patches as mpatches from matplotlib.collections import PatchCollection import matplotlib from . import plot_utils ...
2f625d42c589e4d2da9c0864aafdf13ee34f82a386a57d8a03ce9b8448d9968c
Python
11,416
245
#!/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...
820d2b0e70f814bbc168a4a82c0919c1588041f9612de7c99bafcc8eee5d990b
Python
11,416
294
from typing import Optional, Tuple import torch from torch import Tensor import torch_geometric.typing from torch_geometric import is_compiling from torch_geometric.deprecation import deprecated from torch_geometric.typing import OptTensor from torch_geometric.utils import cumsum, degree, sort_edge_index, subgraph fr...
bf19bc5a6ffbc9a706a2c7c0eeafafcdd170aa6b44869f3f1326641e25cd10c0
Python
11,418
323
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import math from typing import Dict, List, Optional import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as checkpoint from .model_misc import MLP class LinearPresenceHead(nn.Sequential): def __...
dae77214754de1f4b4ec16256da784cbad4234bdd2290706e2be748742e96454
Python
11,423
342
"""Atomistic LIne Graph Neural Network. A prototype crystal line graph network dgl implementation. """ from typing import Tuple, Union, List import dgl import dgl.function as fn import numpy as np import torch from dgl.nn import AvgPooling # from dgl.nn.functional import edge_softmax from pydantic.typing import Lite...
4176d577b6f5e587a4182fe771872e4a4fa61327196514699065c61e7a8639c8
Python
11,424
258
import argparse import torch import torch.utils.data from motion.dataset import MotionDataset from model.eghn import EGHN import os from torch import nn, optim import json import random import numpy as np parser = argparse.ArgumentParser(description='VAE MNIST Example') parser.add_argument('--exp_name', type=str, def...
0787e3edfca90019e60749a3d83a1cc6eb0c5574a2ec513e7855c82308fb4710
Python
11,425
261
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Mar 30 19:47:48 2021 @author: laurayoung """ import numpy import sys from PIL import Image from ERICA import aberration_rendering, ERICA_toolkit def createPinhole(psf_size, pinhole_add, oversampling, ph_scale_up = 10.): '''Creates a pinhole ma...
feb8789863d8c1c47d62a911a9a273b9f1147602acddf0117abea8324542590a
Python
11,425
278
#!/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...
9700b395126b836d37b7bdb2012bc92d6a97ab8739a91afda7bd21c268062a07
Python
11,429
316
""" 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...
71f51528e86b1bfb66d62855f8e20b63353b05c9cbda3ec194a9b1577070867a
Python
11,433
342
import torch import torch.nn as nn from einops import rearrange from einops.layers.torch import Rearrange import torch.nn.functional as F class SoftPooling2D(torch.nn.Module): def __init__(self, kernel_size, stride=None, padding=0): super(SoftPooling2D, self).__init__() self.avgpool = torch.nn.Avg...
48eea3267ac89c231095e121386d8b8a8fe340e4295656c6524f75d62265a946
Python
11,436
385
# FetMRQC: Quality control for fetal brain MRI # # Copyright 2023 Medical Image Analysis Laboratory (MIAL) # # # 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/lice...
728f34f3926bc0796af3d1f79057f953d8f8ce24a9b61f2c8f1c8c9fdc638f4d
Python
11,437
292
import jax.numpy as jnp import numpy as np import json import glob import sys import matplotlib.pyplot as plt from matplotlib.ticker import LogLocator import matplotlib.ticker as ticker import argparse import plot_utils import os import matplotlib as mpl import re plt.rcParams["font.sans-serif"] = ["DejaVu Sans"]...
5597fbc6efef42e05c5d3d009e2767dff09b4936de7c50b7f18c80cc00f72e06
Python
11,438
352
import os import re import numpy as np import pandas as pd import nibabel as nib import matplotlib.pyplot as plt from matplotlib.colors import Normalize from matplotlib.cm import ScalarMappable try: from nilearn.image import resample_to_img except Exception: resample_to_img = None # =========================...
53bfd6df3d9cb2360db5d5b5799b207ea00c9c3b4326652e7684392a96d7814f
Python
11,439
322
import pytest import pathlib import json import csv # import datetime import numpy as np from phantoms.MR_XCAT_qMRI.sim_ivim_sig import phantom import warnings from tests.IVIMmodels.unit_tests.test_ivim_fit import PerformanceWarning warnings.simplefilter("always", PerformanceWarning) def pytest_addoption(parser): ...
b11c4d0a6b4066d9331e5a09f0b19c8c0c7b16d03a31e4efd4f4bdcb6564ba0b
Python
11,440
334
#!/usr/bin/env python # # A file transfer utility specialized for storm-control. It's # primary difference is that it waits until HAL has finished # acquiring a movie before transferring. The finished state # is indicated by the presence of the corresponding XML file # for the movie. # # Hazen 08/16 # import datetime ...
d688b2590ba4d52a8752be9d22a94e864efe406813d326f50fecb97b2611b21c
Python
11,442
299
#!/usr/bin/env python3 # coding=utf-8 # amalgamate.py - Amalgamate C source and header files. # Copyright (c) 2012, Erik Edlund <erik.edlund@32767.se> # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # * Redistribu...
b25668bd716a89bbd07571bad3bb2dc04c1f893149520d74dec717441071f695
Python
11,447
330
from typing import List, Final import torch from mlcg.nn import MLP from mlcg.geometry import compute_distance_vectors from mlcg.nn.angular_basis.spherical_harmonics import SphericalHarmonics from .base import RANGE from ..blocks import ( RANGEInteractionBlock, AggregationBlock, BroadcastBlock, So3kr...
2639ed509c629008159aecd1994345300adab8755633ce6d3aca5ea7a65cb8b5
Python
11,449
255
import torch import torch.nn as nn from torch_geometric.nn import radius_graph from torch_geometric.nn import global_mean_pool, global_add_pool from ocpmodels.common.registry import registry from ocpmodels.models.base import BaseModel from ocpmodels.common.utils import ( get_pbc_distances, radius_graph_pbc, ) ...
7bfb559e90823b8b56a59deeab14e1cbe61eee581a8e0e415806564fa5613c7d
Python
11,450
329
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 Data, GraphSAINTRandomWalkSam...
f416375304510d3bc9fc3ea8a4966a304c6d34f584d539592d6258f6901e46b1
Python
11,450
350
# 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, ...
3226908dd469356c901e986973ee2ce36a3b7a08c5892f3f39f9c507202970d2
Python
11,451
229
""" If you use this code, please the SynthSR paper in: https://github.com/BBillot/SynthSR/blob/master/bibtex.bib Copyright 2020 Benjamin Billot 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:...
0856d3b2b16e5897466def784219fd7da0c10fb9d34050247ac82eebeedc1340
Python
11,454
355
import argparse import h5py import os import numpy as np import sigpy as sp import torchvision.transforms as T from sigpy.mri import retro, app, sms, muse, mussels from os.path import exists DIR = os.path.dirname(os.path.realpath(__file__)) HOME_DIR = DIR.rsplit('/', 1)[0] print('> HOME: ', HOME_DIR) DATA_DIR = HO...
a9979dd5827e49e985e90455bdbe8598e38a4f10facf1d4050ac084d1ca7184c
Python
11,455
341
from abc import abstractmethod from typing import Optional, List import warnings from PySide6.QtWidgets import QWidget, QMenuBar, QMainWindow, QFormLayout, QVBoxLayout, QLabel, QHBoxLayout, QGridLayout, QPushButton, QCheckBox, QSlider, QTableWidget, QTableWidgetItem, QTabWidget, QGroupBox, QSpinBox, QDoubleSpinBox, QFi...
5da8f5efa34c734f67f69e81c443445f86f20e08bcc5247690bc77f4706460db
Python
11,457
109
from train_AE import init_from_config from brainvoice.configuration.configuration import Configuration from brainvoice.models.utils import load_model_checkpoint import argparse import torch from torch.autograd import Variable import os import pathlib import numpy as np from tqdm import tqdm """ python ...
9cf1d8f33bc784bf8a44dc58a78576c859c1b2411a237b553646c20e2c8ccb9a
Python
11,457
350
# 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, ...
eb74c73e0441fe771358e663eb4af2ddd67635efe1e18b1331c7e3ed7ae7d3cf
Python
11,461
272
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license import os from itertools import product from pathlib import Path import pytest import torch from tests import CUDA_DEVICE_COUNT, CUDA_IS_AVAILABLE, MODEL, SOURCE from ultralytics import YOLO from ultralytics.cfg import TASK2DATA, TASK2MODEL, TASKS f...
33ba2d06d26b6887a40cb95e291bd5efc0d21bbbff96e7290074e1dec5bbdad9
Python
11,463
283
## #Load Modules import numpy as np from numba import njit import pdb from EPGMotion import * @njit() def Jacobian_MotionCorrection(theta, opt): # Cache frequently used values nTR = opt["nTR"].astype(np.int32)[0] steadyStateTR = opt["SteadyStateTR"].astype(np.int32)[0] nDummy = opt['nDummy'].astype(np....
39c120db21fe6b5923ec97decc68f1edeafa42b6b33b540e5d49fe85b575c987
Python
11,467
299
"""Classes for simulating a soft mixture of modes.""" from typing import List, Optional, Union import numpy as np from scipy.special import softmax from osl_dynamics.simulation.obs_mod import MVN, MSess_MVN from osl_dynamics.simulation.base import Simulation class MixedSine: """Simulates sinusoidal oscilations...
3b682ed1ebb236189f1a1f6be6de06b37a3bf46cb37e647d22fe3166ca3442bb
Python
11,471
331
""" Unified metrics for multi-label classification (8 surgical decisions) and multi-output regression (8 surgical doses). **2025-06-09 更新** ------------------- * 修复 `masked_*` 系列函数在 **numpy.ndarray × torch.Tensor** 相乘时的类型冲突:现在会自动把 `mask` 也转换为 NumPy;兼容 CPU/GPU。 * 其他逻辑保持一致(分类指标、整体回归指标)。 """ from __future__ import annot...
422f2f926f23a60d20be860ee47acd6c42774905b933f4785e079c2acf8d42ca
Python
11,471
332
""" Dual-modality fusion experiment: FLAIR + T2 Late Fusion Uses two trained single-modality models for late fusion """ import numpy as np import pandas as pd import os def _roc_auc_score_binary(y_true, y_score): """Compute binary classification AUC""" if len(np.unique(y_true)) < 2: return 0.0 pos_...
9634792c00d511a2dc0794becc96d5a449c7945baf723b68c512d6b881ebd890
Python
11,471
258
from PUMI.engine import AnatPipeline, QcPipeline from PUMI.engine import NestedNode as Node from PUMI.pipelines.multimodal.image_manipulation import vol2png from PUMI.utils import get_reference, get_config, registration_ants_hardcoded from nipype.interfaces import fsl from nipype.interfaces.ants import Registration, Ap...
11088ae693e33d73386330bdb6b0824702137fc89abf3f062d3d872f5ff8e71e
Python
11,472
260
from copy import deepcopy import numpy as np from time import time import torch from skimage.data import camera from torch.nn.functional import pad, conv3d, conv1d, conv2d from batchgeneratorsv2.helpers.scalar_type import RandomScalar, sample_scalar from batchgeneratorsv2.transforms.base.basic_transform import ImageO...
a3bb40ad63dc0eec29ab2a798c6db5fa772047b95c9627c32eccb3e80a3e3701
Python
11,479
284
import colorsys import os import pathlib import h5py import numpy as np import matplotlib from matplotlib.collections import LineCollection from matplotlib import colors as mcolors from mpl_toolkits.axes_grid1 import make_axes_locatable from neuron import h from neuron.units import ms, mV import json from neuron_inter...
2734b8d1030ecd4bd988c74464105d20b337a57f766f841542fde7e6b496cd7c
Python
11,480
385
# 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, ...
44f9e63c041936018699b97d171fab549734fa376fba1c99221cd80842669675
Python
11,485
325
############################################################################# # Copyright (C) 2020-2025 MEmilio # # Authors: Agatha Schmidt, Henrik Zunker, Manuel Heger # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file exce...
0573d5248ae255122b3947b5861f117f814d0f980677fe3cb50ea4d489f3a606
Python
11,489
306
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import warnings from typing import Dict, List import numpy as np # Check if Numba is available HAS_NUMBA = False try: import numba as nb HAS_NUMBA = True except ImportError: warnings.warn( "Numba not found. Using slower pure...
0119a614bee81c16bd694f70923218afea5c20251366d87e2c925a596f588744
Python
11,492
229
import torch import torch.nn as nn import numpy as np from datetime import datetime import MixDataLoader, SeparatedDataLoader # import data device = 'cuda' if torch.cuda.is_available() else 'cpu' batch_size_train = 100 batch_size_test = 100 worker = 0 num_class = 100 target_extend = torch.arange(num_class)...
d4f0777158e48011f862264fbe6a14bd056842c4af57de8b2fb0be2786c28b35
Python
11,495
317
# -*- coding: utf-8 -*- import numpy as np from fury import window from scilpy.utils.spatial import get_axis_index from scilpy.viz.backends.fury import (create_scene, set_display_extent, set_viewport, sna...
b3eedffd716c30a59dd79bb8008b8830692aaa6b7d41f58cef44353cac3af565
Python
11,500
319
"""Social reversal learning task for MWorks. """ ################################################################################ #### Determine whether on laptop or on rig and update sys.path accordingly ################################################################################ _PYTHON_SITE_PACKAGES = getvar(...
c2fd82dcaaf9dd94c98bd657db593f525d6759b828cbbacb464c7947700c4001
Python
11,501
298
import torch from torch import nn from torch.nn import init import torch.nn.functional as F class LayerNorm(nn.Module): def __init__(self, normalized_shape, eps=1e-6, data_format="channels_last"): super().__init__() # 创建权重参数,初始化为1 self.weight = nn.Parameter(torch.ones(normalized_shape)) ...
23235ed63e0804ae56ec87c1daadbb4fbc4316b3d5382b295962530018b557a2
Python
11,503
368
from pathlib import Path import torch.nn as nn import torch import math from typing import Union, Tuple from typing import List from torch.optim import Optimizer import flair from flair.data import Dictionary class LanguageModel(nn.Module): """Container module with an encoder, a recurrent module, and a decoder...
bd599d8b9f8304c99fb98b90d6ff73d5421acdd53b4cc6826d1c5b4c4f8faa12
Python
11,503
312
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
7ea390539291aa5cbc4679b1209dd8f7774f807090b2a2fa8fd927b1565c6620
Python
11,504
311
""" 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...
6a0097a4e4c29ea75f90b1aa6481926d4a5d5c24877850c71b78d6a9f41f9ac6
Python
11,506
436
""" Utilities for nd (n-dimensional) arrays Tested on Python 3.5 Contact: adalca@csail.mit.edu """ import builtins import numpy as np import scipy as sp import scipy.ndimage from scipy.spatial import ConvexHull def boundingbox(bwvol): """ bounding box coordinates of a nd volume Parameters ---------...
dca0b035f984cb6bc9c609763bfac3d94f3ed6a450f524e9b4a2114eae5f3845
Python
11,506
335
# Code Reference : https://github.com/d-li14/mobilenetv3.pytorch # @InProceedings{Howard_2019_ICCV, # author = {Howard, Andrew and Sandler, Mark and Chu, Grace and Chen, Liang-Chieh and Chen, Bo and Tan, Mingxing and Wang, Weijun and Zhu, Yukun and Pang, Ruoming and Vasudevan, Vijay and Le, Quoc V. and Adam, Hartwig},...
c05ac375de4ba60f4b0f71cbb14dd25c7b0fc168182c8b753c05def0dcdc10a9
Python
11,509
282
"""The optional steps: a checkbox each, and each one actually does something. Run from the repo root:: uv run python python/test_optional_steps.py ``Params.optional_steps_to_run`` used to be a multi-select list box holding one inert entry — ``generateCSV`` was written into the parameter file and read by nothing....
dea07df6f3474acdee9ddb51337c2b876e95cc90a013c5aa17cb098d420213b6
Python
11,513
239
import argparse from os.path import join import pickle import keras from keras.optimizers import Adam from keras.callbacks import EarlyStopping, ReduceLROnPlateau import utils from model_zoo import lentiMPRA import plotting import pandas as pd import wandb from wandb.keras import WandbMetricsLogger import yaml import n...
40cd904d88a6c6e3c5ee53f7247e77defa25974c11ad33f4f5d1e559a4df2cf1
Python
11,515
251
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ The script uses scalars from an anatomy, data_per_point or data_per_streamline (e.g. commit_weights) to visualize them on the streamlines. Saves the RGB values in the data_per_point 'color' with 3 values per point: (color_x, color_y, color_z). If called with .tck, the...
d9a8c64131fa9df7bda0996f3d98b6e5a6b4a50045785e654da7421f7f61e248
Python
11,518
332
# 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, ...
c50c5e8b174605dfcbae7a14e846ae5d24ef9d78dbafc61d9eace47d9e60ab71
Python
11,519
240
""" (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, software ...
217cd58129b8e6c34bece3c2c7fe72f3471e9d79e4c1bbb41a2a99430a342b70
Python
11,522
268
from typing import Optional from bread.data import * from bread.algo.tracking import AssignmentDataset, GNNTracker, AssignmentClassifier, GraphLoader, accuracy_assignment, f1_assignment from glob import glob from pathlib import Path import datetime, json, argparse import torch, os from pprint import pprint from sklear...
2d194f7ee7d153e408cf7f02ac63da2076cf8e05ce05c6e7990aac28f4dbf7cb
Python
11,524
198
#!/usr/bin/env python3 """ Main training script for RoBep model. This script provides comprehensive argument parsing and training functionality. """ import argparse import torch from pathlib import Path from bce.utils.trainer import Trainer from bce.utils.tools import set_seed from bce.utils.results import evaluate_m...
8465d2c54f59503c9dd6b69ec8b638b2fd7f7ee95f5776f1733671bbfc2e04ca
Python
11,524
337
"""Utilities for visualizing the model fitting process.""" import numpy as np import matplotlib.pyplot as plt from .model import input_heatmap from .tools import standardize_axes def prediction_vs_target(input, target, model, ax=None, sampling_rate=None, show_input=False, xlim=None, title=N...
0a2edf7605ed3bcb11750c373cb2dafae05f804f6db87b36fbffb090d6c884a7
Python
11,525
334
import math, copy import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from typing import Any, Dict import hydra import omegaconf import pytorch_lightning as pl from torch_scatter import scatter from torch_scatter.composite import scatter_softmax ...
936ed6fba4cccf9c7fdaea8c866cc6f5b17c57690741b3f12ba15bbe9aff2cd7
Python
11,531
321
import os import numpy as np import cv2 import torch import yaml import csv import argparse from argparse import Namespace from monai.transforms import ( Compose, ToTensord, ScaleIntensityd, AsDiscrete ) from monai.networks.nets import UNet from torchmetrics import Dice, JaccardIndex from monai.metrics ...
27fa0d34e78874ad312fd9c9c1320cce8eb2e83ca102d040b30084f4ab7fdca2
Python
11,532
302
#!/usr/bin/env python # author: Jannes Spangenberg # e-mail: jannes.spangenberg@uni-jena.de # github: https://github.com/JannesSP # website: https://jannessp.github.io import read5_ont import multiprocessing as mp import pysam import psutil from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace ...
917e911f9b0753af96d04e12bb6ddc7817331670a2dc908f575bfdca32dcda34
Python
11,533
299
#!/usr/bin/env python """ Draw the parameter with the correct style. Provide widgets for editing parameters. Hazen 04/17 """ import os from PyQt5 import QtCore, QtGui, QtWidgets import storm_control.sc_library.parameters as params def truncateString(a_string): max_len = 25 if (len(a_strin...
556c73f87c3be67fefbdb2a03e87fa88b2862da7cca61ffb31e5d08c82ff5ac3
Python
11,535
344
import subprocess import tempfile import time from pathlib import Path from typing import Literal, Optional import dolfin as df import numpy as np import pymeshfix import pyvista as pv import simple_mri as sm import skimage import SVMTK as svmtk from loguru import logger from scipy.spatial import KDTree from gmri2fem...
52d9fe216a55f2f82b49a75cd175f05cfbe4db3c2dd7485eee3e26da0e4a5298
Python
11,541
214
import sys import os sys.path.append(os.path.dirname(os.path.dirname(__file__))) import argparse import os import pandas as pd import torch import numpy as np from txgnn import TxData def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--seed", help="seed for random split") parser.a...
e0b1424d14ca92f7522b10d4e47299752c219ce8dcc6cc9e2ef0b9fb877530c6
Python
11,543
342
import torch import torch.nn as nn from einops import rearrange from einops.layers.torch import Rearrange import torch.nn.functional as F class SoftPooling2D(torch.nn.Module): def __init__(self, kernel_size, stride=None, padding=0): super(SoftPooling2D, self).__init__() self.avgpool = torch.nn.Avg...
66021bf2f758674ed85891972783d3e161c21134c3b71e9a47330bb68300a798
Python
11,546
231
import argparse from os.path import join import pickle import keras from keras.optimizers import Adam from keras.callbacks import EarlyStopping, ReduceLROnPlateau import utils from model_zoo import lentiMPRA_v2 import plotting import pandas as pd import wandb from wandb.keras import WandbMetricsLogger import yaml impor...
20dfa2684e1f44e114e0ab1939555baae80285d2d0e0c37340c103d54d7cefd1
Python
11,547
311
from logging import raiseExceptions import os.path as osp import warnings from collections import OrderedDict from functools import reduce import mmcv import numpy as np from mmcv.utils import print_log from prettytable import PrettyTable from torch.utils.data import Dataset from depth.core import pre_eval_to_metrics...
07a7a83c5eae3e186e9b9577ca52751453c5f9246995f5747c9fe01efa27008b
Python
11,548
293
import sys import yaml import os import numpy as np import re import matplotlib.pyplot as plt import matplotlib as mpl import h5py pathpath,myrun,ncluststr,cmethod = sys.argv[1:] ''' pathpath = 'PATHS/filepaths_carlen.yml' myrun = 'runCrespZP_brain' cmethod = 'ward' ncluststr = '8' ''' with open(pathpath, 'r') as my...
8a0c0264592344337c5e326d99e10a26f9e95070fb0c2ff330250d9ee263c23c
Python
11,548
278
""" Main manuscript - Figure 3: Field strength differences in orientation-dependent qMRI Left column: Absolute differences between 9.4T and 3T qMRI parameters, including lower and higher FA bins. Right column: Subject-specific absolute difference maps for R1, R2, and AI between 9.4T and 3T for one exemplary subject. ...
827a7b3b0ccf58677ceb3a528815eec0d8533e827523a0cb0b7c212fe5ff5667
Python
11,551
278
""" Attention Pool 2D Implementations of 2D spatial feature pooling using multi-head attention instead of average pool. Based on idea in CLIP by OpenAI, licensed Apache 2.0 https://github.com/openai/CLIP/blob/3b473b0e682c091a9e53623eebc1ca1657385717/clip/model.py Hacked together by / Copyright 2021 Ross Wightman """...
91545201e4d191ace4ba3ff5c8c528893f366541935a798a446dd2d7157e105c
Python
11,553
242
############################################################################################## ### Script to average data from the same columns in data files stored in different folders ### ### -- v1.2 -- ### ###################################...
e39b89c38eeb658046bdbdbf2f7d022437195f5af8542bac3185ab2070ce0888
Python
11,553
342
# 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, ...
251a24813252ed627f90b0a19b0edb8354ce43f487a42d721ef65c4e9a7444c6
Python
11,555
242
############################################################################################## ### Script to average data from the same columns in data files stored in different folders ### ### -- v1.2 -- ### ###################################...
1bea370d369fe77444e93a76489d131a2c919321637b1f08ae8aa19a70dfe683
Python
11,562
382
import numpy as np from dataclasses import dataclass, field from typing import Any, Union from trigger import Port # import psychopy and set hardware specs from psychopy import visual, misc, core, prefs prefs.hardware['audioLib'] = ['ptb', 'pyo'] prefs.hardware['audioLatencyMode'] = 3 from psychopy import sound from ...
368e169c4ee8a09f05a70aedcaa8bd3ebc315f685bad78e473d6becfe3ca2872
Python
11,567
350
"""1D per-sector cone-background model (Chebyshev polynomial + optional physical tails) used by the step-0 projection background pass. Vendored verbatim from the bg-optimization research repo (``src/bg_removal/gen_bg_fit/fit_sector_var_model.py``). Depends only on numpy/scipy, so it is self-contained. """ import nump...
c0b8cfb4ccb1bbf84a22891ef94dae941013935033c154b87abec6ac2f637267
Python
11,567
330
# 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 logging import os import warnings from argparse import Namespace from typing import Any, Callable, Dict,...
7a05f64a41be312528f6bdef366ab4ee789ef3e8264936975bdf91205ece50b4
Python
11,569
311
import os import nibabel as nib import pytest from unittest.mock import patch, MagicMock import subprocess from conftest import load_data from pydesigner.preprocessing import mrpreproc, mrinfoutil from pydesigner.system.errors import MRTrixError DATA = load_data(type="hifi") PATH_DWI = DATA["nifti"] PATH_DWI_NO_JSON ...
06f4b6d89690457b02bebbb284fd3340c4fe52325087e439eb5970f3309357ce
Python
11,570
315
# -*- coding: utf-8 -*- import itertools import logging import multiprocessing import numpy as np from dipy.data import get_sphere from dipy.reconst.mcsd import MSDeconvFit from dipy.reconst.multi_voxel import MultiVoxelFit from dipy.reconst.shm import sh_to_sf_matrix from scilpy.reconst.utils import find_order_from_...
677b35230b9ddecc3e387c7d93764a21d9e5ea445e5d7e162dcb196a13e1473b
Python
11,570
260
''' Modified from https://raw.githubusercontent.com/DingXiaoH/RepVGG/main/repvgg.py MIT License Copyright (c) 2020 DingXiaoH 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, ...
04cd72dbb682367de3b8d5d48670ec876d1f455df589a217ae53685128107707
Python
11,572
250
# Copyright (c) Ankush Kesri/Yangming Ou, Boston Children's Hospital/Harvard Medical School, 2024 # email: Ankush.Kesri@childrens.harvard.edu, Yangming.Ou@childrens.harvard.edu # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Sof...
e64f44fe78ffc37cb565662278f653699a491783ccee5bbfaadd1f84c88a957a
Python
11,572
360
"""3-D molecular structure visualisation components for the Streamlit UI.""" import json import re as _re import numpy as np import pandas as pd import streamlit as st from ase.data import chemical_symbols from chemgraph.tools.ase_core import create_ase_atoms, create_xyz_string # -----------------------------------...
e042b5263e5d070c30cdd4795572baed563b4f31b9e0f87f59895af2163c03dd
Python
11,579
267
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Script to compute multi-encoding multi-shell multi-tissue (memsmt) Constrained Spherical Deconvolution ODFs. In order to operate, the script only needs the data from one type of b-tensor encoding. However, giving only a spherical one will not produce good fODFs, as it...
52e7c3833aa8376a495218f04292b8bedd9a0c04513170d7ff0427849de21856
Python
11,580
274
'''A quick example to generate heatmaps for vgg16.''' import os from functools import partial import click import torch import numpy as np from torch.utils.data import DataLoader, Subset from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor from torchvision.datasets import ImageFolder from torchvisi...
4f279f9406488fe34e98f2b5efe2ff9e81ec1ecebdaa8c359432a1a6d039e5e4
Python
11,581
319
"""Plot semantic cluster flatmaps, % match between languages, tuning shift per cluster. Note: Cluster numbers in the paper are flipped and 1-indexed. Figure 3B, 3C, 5A. """ import matplotlib.pyplot as plt import numpy as np import os import pickle from matplotlib.colors import ListedColormap from scipy.stats import t...
6ec33e2260acb9f9853bffd31354497d221c0d1a3f2b74fb470fb1ba1c35c96a
Python
11,583
284
import matplotlib.pyplot as plt import matplotlib.ticker as ticker import jax.numpy as jnp import jax import os import json import sys import glob import matplotlib.colors as mcolors from matplotlib.colors import to_rgba from collections import Counter from scipy.stats import gaussian_kde plt.rcParams["font.sans-s...
b6d22a2db05fc3fa7db66c24501d6fbc10ed59e32b757734ab2b841caa4a476b
Python
11,584
296
""" MSI Delocalization Visualisation Tool ───────────────────────────────────── Reads a scored h5ad file (produced by the scoring pipeline) and provides interactive visualisation of individual m/z features: • Heatmap view – spatial intensity map with tissue contour overlay • Distance map – arrows from nonzero ...
872f0d4dbd1bcab4bc911c761a2fc74bd8f1e512abe20bd6db1aa2053617030f
Python
11,587
281
"""Tests pinning the two open contributions. Each open pull request claims to fix a specific defect. The tests here assert the *fixed* behaviour and are marked ``xfail(strict=True)``, so: - on the default branch they xfail, the suite stays green, and CI remains a useful gate on unrelated work; - merging the contrib...
1483670fb8295b48556eba3f10f9457580184ae18032750a5abc78d8e0b0b966
Python
11,591
314
import math import pathlib from enum import Enum from typing import Type import numpy as np import numpy.typing as npt from neuron import h from scipy.io import loadmat from neuron.units import ms, mV import neuron_interface.neurosim from ...spherical_cartesian_conversion import norm_spherical_to_cartesian from ..ce...
53e079d2af1b7924c526fcb68bf746c077f7df1d013ae2d853fb2b70caa9d064
Python
11,591
279
import numpy as np import os import sys import gc import cooler from collections import defaultdict import matplotlib.pyplot as plt from scipy.ndimage import zoom import torch from . import plot_utils def get_region(matrix, chrom_name, start, end): '''Get Hi-C map by genome position''' block = m...
6d70bf799e3ef17f9507e72b262d21990860fafea47b3f0bca34b9649b2cbfbb
Python
11,591
275
from math import factorial import operator from tqdm import tqdm import numpy as np from sympy.ntheory import factorint import logging from zigzag.classes.hardware.architecture.memory_hierarchy import MemoryHierarchy from zigzag.classes.opt.temporal.loma.multipermute import permutations from zigzag.classes.opt.tempora...
001812b8eabfbc33c398e6f5ae2f81a8c35641f93a18483d3371969b18cba7db
Python
11,595
298
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # MRC CBU PYTHON SCANNING SYNC # # This library is intended to allow for easy communication between Python # experiments and the MEG and MRI scanners at the MRC Cognition and Brain # Sciences Unit (CBU). The implementation is intended for the CBU setup only, # and interf...
f7127f9e7f8e25677daf9180fa37cd889098d3c2e9933870db9a3ee48a68097d
Python
11,604
358
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import contextlib import fnmatch import logging from typing import ( Any, Callable, Dict, List, Mapping, Optional, Sequence, Set, Tuple, Union, ) import numpy as np import torch import torch.nn as nn from...