sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
234d8ff3b6b194862c57e836c2fd180adc20dd9a0fa2e1ac4b1319703bd0fb4c
Python
7,568
159
# -*- coding: utf-8 -*- """ Created on Sun Dec 15 19:12:11 2019 @author: Yoshi """ import os import shutil import pandas as pd import matplotlib.pyplot as plt from PIL import Image from average_radius_calculator import * from color_key_generator import * from scale_calculator import * from cell_number_mapper impor...
cc957a83517141beb66ba7640e527e2da47f04c1f7242a4ea936a536145f7c94
Python
7,569
180
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Segment a single bundle by computing a simple Recobundles (single-atlas & single-parameters). For multiple bundles segmentation (using RecobundlesX / BundleSeg), see instead >>> scil_tractogram_segment_with_bundleseg Hints: - The model needs to be cleaned and lightwe...
bc6b8fae1a0d5759a1b99c52ba59b44fa6c9ae161e6f03f4f6ca0079d70380a5
Python
7,570
228
import torch import torch.nn as nn from torch_geometric.utils import to_dense_batch from torch_geometric.nn import ( JumpingKnowledge, global_add_pool ) from layers import ( GATLayer, cross_attention_block ) from activation import get_activation class GATMod(nn.Module): de...
e42d52ede296d8c4f4ab9feb27ea91ce512d0905fa76aa78576d91614e1c83cc
Python
7,571
175
from typing import Generator, Any, Tuple from zigzag.classes.stages.Stage import Stage from zigzag.classes.cost_model.cost_model import CostModelEvaluation import os import pickle import json import numpy as np import logging logger = logging.getLogger(__name__) class MPICompleteSaveStage(Stage): """ Class ...
0a378842a85cb3452e5acc11c15366ddc7f4c3b1198983791b71adf64381a554
Python
7,572
173
import tensornetwork as tn from my_tensornetwork import MyFiniteMPS import numpy as np import json import os import re from tqdm import tqdm class OPPollmann: def __init__(self, n_qubits): self.n_qubits = n_qubits # train1 read_data = self._dataset_Pollmann("train1") ...
9d13653adee53eee35b6a192773ca50094812ba7612293f8b8460f1a76576a72
Python
7,572
207
import argparse import torch import torch.nn.functional as F from torch.utils.data import DataLoader from ogb.linkproppred import PygLinkPropPredDataset, Evaluator from logger import Logger class LinkPredictor(torch.nn.Module): def __init__(self, in_channels, hidden_channels, out_channels, num_layers, ...
ba0b6c520648dc4bf2f5038689ac6e3e62b1f3171255d003b61ba73cdefd5aeb
Python
7,572
211
# -*- coding: utf-8 -*- import logging import numpy as np class RAP: def __init__(self, rap_volume, propagator, max_nbr_pts): """ rap_volume: DataVolume HRegion-Adaptive Propagation tractography volume. """ self.rap_volume = rap_volume self.propagator = propaga...
17bd821462ef5d6dec7570a3eea51fedf41a3468215465517a5ad823faebae66
Python
7,574
221
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from drf_spectacular.types import OpenApiTypes from drf_spectacular.utils import OpenApiParameter, OpenApiResponse, extend_schema from rest_framework import serializers, status, viewsets from rest_framework.decorators import action from rest_framewor...
2a0b089a3bf2942a016f8f8ab3ad5669eb32f9031b05733d115cb929c8ef6bfb
Python
7,575
230
from __future__ import annotations import warnings import matplotlib.colors as mcolors import matplotlib.pyplot as plt import pandas as pd import pytest from napari_dmc_brainmap.utils.color_manager import ColorManager from napari_dmc_brainmap.visualization.vis_plots.barplot_visualization import ( BarplotVisualiz...
2525429b3041932b9d70b0e0ce384b60310c4542876bbd25205f2039d98b10cb
Python
7,576
120
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'sections.ui' # # Created by: PyQt5 UI code generator 5.11.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjectName(...
dfbdcf159dc1a33c48f618bb160f4cd5b4d1f8389892bbb27f5a1899268412b1
Python
7,577
209
import argparse import torch import torch.nn.functional as F from torch.utils.data import DataLoader from torch_geometric.utils import negative_sampling from ogb.linkproppred import PygLinkPropPredDataset, Evaluator from logger import Logger class LinkPredictor(torch.nn.Module): def __init__(self, in_channels,...
817a345e224405f8cdac834562397aed3a3928938c8b56381593b9d66113fcc2
Python
7,579
182
import h5py import hashlib import validators import json import sys import os import time import uuid #log is the same as standard_sdks log from mmsdk.mmdatasdk import log from mmsdk.mmdatasdk.configurations.metadataconfigs import * from mmsdk.mmdatasdk.computational_sequence.integrity_check import * from mmsdk.mmdat...
c2581833df8b0bba9d7b640ec88696644d4ff85d8f897545217d01bee5d7278b
Python
7,580
208
import torch from torch_geometric.data import DataLoader import torch.optim as optim import torch.nn.functional as F from torch.utils.tensorboard import SummaryWriter from torch.optim.lr_scheduler import StepLR from gnn import GNN import os from tqdm import tqdm import argparse import time import numpy as np import r...
c48c795375359f50081cee31bd26287ef5094079a29e15d5a4ceae08b2a59b75
Python
7,581
249
# -*- coding: utf-8 -*- """ Created on Wed Mar 25 17:09:55 2020 Functions that deal with timeline .mat (matlab) files @author: Samuel Failor """ from os.path import join from os.path import exists import scipy.io as sio import scipy.signal as ss from sklearn.cluster import KMeans import numpy as np from . import cor...
21917f0db9f8d230bd64240f7d01a50de42d0d31070747f939142cc68d3755de
Python
7,582
203
DESC =""" Script to randomly generate a kitchen scene USAGE: python random_kitchen.py -m kitchen3.xml """ import os import click import numpy as np import time import re try: import mujoco_py from mujoco_py import load_model_from_path, MjSim, MjViewer, load_model_from_xml, functions except ImportError as e...
2c631e8f53036f5e159da5598206fc82ae36c5b4b719f4c69a0f84c4553875c9
Python
7,582
171
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """ SAM model interface. This module provides an interface to the Segment Anything Model (SAM) from Ultralytics, designed for real-time image segmentation tasks. The SAM model allows for promptable segmentation with unparalleled versatility in image a...
33bd61fc77a5eed27706ff15291441008e82492092e8f935da1171c1724f5eb9
Python
7,582
200
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image from torch import nn import pytorch_lightning as pl import torchvision.models as models import ...
49bf7db494f70caa60dcf3e3afa9b1ab020334dc5206c0a282e092578ab79d96
Python
7,582
181
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations from datetime import timedelta, timezone from decimal import Decimal from typing import Any from uuid import UUID import rq.defaults as rq_defaults from django.db.models import TextChoices from drf_spectacular.uti...
6594f8d682bfb32650884627f61ee03c1883ddeb04d9058e2c4f57fedecff377
Python
7,582
227
import re from typing import Any, Dict, List, Optional, Union, Literal from pydantic import RootModel, BaseModel, field_validator, model_validator import matplotlib.colors as mcolors ALGO_NAME_REGEX = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*$") NEEDED_DATA = { 'data_neuronal_activity': 'Binary Neuronal Activity', ...
fa771cb62d22bc439ffc4f55f0289ab49353046b9a97130eba51ed2eae9682a6
Python
7,582
193
from pathlib import Path import datetime from multiprocessing import Pool, Lock import time from benedict import benedict import numpy as np import os import shutil import random # set seeds random.seed(42) np.random.seed(42) os.environ['PYTHONHASHSEED'] = '42' os.environ['TF_DETERMINISTIC_OPS'] = '1' def adjust_t...
6741bccc393247a29f4dbb0ae95287f75590221231c682b623c18ca5e7274302
Python
7,583
192
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: LY 2024 Compute SVD of videos via labdata tools: currently can compute SVD of original full video, and can create a motion energy video and then compute the SVD. Sample usage: labdata run videosvd -a LY018 -s 20231109_141923 -d chipmunk -- compute_video_svd ...
882433236fd96dc56dad6b9eb0a10e12956cdea25067f856c0c1b8b9e90c8b31
Python
7,584
243
import src.contour as con import numpy as np import src.pureCont as pc import nibabel as nib import pickle import src.finElFit as fe def thresh(DirectOfFile,percentage): #loads the dataset found within 'DirectOfFile' and uses a histogram to calculate #the threshhold at which 'percentage' of all pixels not dee...
7699e17c50597503cb484991893d04d0b959b0ade7de2efb865b23bffac7f4af
Python
7,585
199
"""Test the encoding model's prediction accuracy independently for each NSD-synthetic image class. Parameters ---------- subjects : list List of the used NSD subjects. nsdsynthetic_image_class : int Integer indicating the NSD-synthetic image class used. 0 for chromatic noise. 1 for contrast modulation. 2 for mani...
620d8bff833595a1810cbc271e0a6cd387feff81147bdf3aecf7852097b4663b
Python
7,586
74
import argparse def ArgParserPatch(commandline,do_exit,flag=0): parser = argparse.ArgumentParser() exp=['experiment','--exper'] parser.add_argument(exp[flag], type=str, help = 'give name of h5 file, for example: ') parser.add_argument('-headstages', type=str, nargs="+", help='which headstage to analyze...
da376d1025ec7c4b1e43bdc333a6f58649fe98f3f3546ace703469972db64f2a
Python
7,586
179
#!/usr/bin/env python """ Camera control specialized for a Photometrics camera. FIXME? This never calls pvcam.uninitPVCAM() to close the PVCAM library. Not sure if this matters. Hazen 1/18 """ from PyQt5 import QtCore import storm_control.sc_hardware.photometrics.pvcam as pvcam import storm_control.sc_librar...
5c096201d4575adc5192c44e2012c0d98b71cc9341448b1c94b9c813b2946f80
Python
7,587
572
import numpy as np ### Main Experiment TIME_BLOCK = 11 # 11 TIME_WAIT = 4 # 4 N_BLOCKS = 20 # 20 N_RUNS = 5 # 5 -> indicates runs per condition WARM_UP_TIME = 0 COOL_DOWN_TIME = 20 ITI = 0.5 JITTER = 0.2 # Screen Specification SCREEN = 0 FULLSCREEN = True MONITOR_DISTANCE = 123 #office=50, eye_tracker=60, PROPix...
e6827b4133f52e6ba087d89e86510807ce7a9d251ec3082af577623f2ff37396
Python
7,588
206
"""Convolution layers.""" from typing import Any, Union import numpy as np import torch from torch import nn __all__ = [ 'SpikingConv2d', 'SpikingEiConv2d' ] class SpikingConv2d(nn.Module): """2D convolution wrapper.""" def __init__(self, in_channels: int, out_channels: int, kernel_si...
a4f5b7f47a9d6bcc00ff3bf167cf630089a2861b2435ccf957f6bf638db99872
Python
7,589
223
# -*- coding: utf-8 -*- # python standard library inputs import sys # external inputs import numpy as np from numpy.fft import fft, ifft, fft2, ifft2 # local inputs from ..simulation.get_white import get_white_2d, get_white_1d from ..simulation.filter_bold import filter_bold_2d, filter_bold_1d from ..simulation.mask...
7ddd85e9ca14f913a0a7a676a033a98919baa91092c139e8118a00d50913a94a
Python
7,590
211
"""Filename containers for M/EEG processing pipelines.""" import os from typing import Optional class SurfaceFilenames: """Container for surface extraction file paths. Parameters ---------- root : str Root directory for surface files. """ def __init__(self, root: str): self....
5b83b6f66f973c6570676b48b53133b35444ee15a5f14a45810f5e6c23188c99
Python
7,591
209
""" AVPENet: Audio-Visual Pain Estimation Network. Main model class that assembles all four components: 1. AudioEncoder — ResNet-34 on mel-spectrograms 2. VisualEncoder — ResNet-50 + spatial attention on face images 3. CrossModalFusion — Bidirectional cross-attention 4. RegressionHead — FC layers → ...
c5f17de2b1919f7d371472330606cf798716bd8b51fe9eb66074b9c72487acd1
Python
7,591
211
import itertools from collections.abc import Callable from typing import Any import torch from eir.train_utils.ignite_port.engine import Engine from eir.train_utils.ignite_port.metrics.metric import ( EpochWise, Metric, MetricUsage, reinit__is_reduced, ) __all__ = ["MetricsLambda"] class MetricsLam...
788004685cece7d9ec8b763c57ed2db1fd2b9d384067e94b2499d9dd503ad531
Python
7,593
168
# -*- coding: utf-8 -*- """ Simulation study for EMPRISE fMRI data Joram Soch, MPI Leipzig <soch@cbs.mpg.de> 2023-06-29, 17:07: first version 2023-07-03, 10:27: adapted parameters 2023-08-17, 11:35: saved results """ ### Step 1: specify settings ################################################## # import modules im...
d0c82863a0b32909ab283857d2fe3c24512f9256f8bb91ac2843438910afbffd
Python
7,593
167
#!/usr/bin/env python """ Provides the (software) time base for a film. Hazen 04/17 """ from PyQt5 import QtCore import storm_control.sc_library.parameters as params import storm_control.hal4000.halLib.halFunctionality as halFunctionality import storm_control.hal4000.halLib.halMessage as halMessage import storm_con...
996571b33d07d84f0a340dbf74986ee2bf7ffe52f84b185358e6a3d53bcd80c4
Python
7,594
180
# 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...
2222b3eaabfb008466a3904646039368794e50009f0a3c134684a1d4f289c530
Python
7,595
252
from unittest.mock import ANY, MagicMock, call, create_autospec, patch import pytest import torch from lightning.fabric import Fabric from torch import nn from eir.train_utils import step_logic from eir.train_utils.optim import AttrDelegatedSWAWrapper @pytest.mark.parametrize( "create_test_data", [ ...
11216d2aea7d8941846c0c075ce73cfff48c20f84a95315b9a50db1d5695bfed
Python
7,596
195
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from datetime import timedelta from unittest import mock from django.contrib.auth.models import Group from django.test import override_settings from django.utils import timezone from rest_framework import status from cvat.apps.access_tokens.cron i...
90e5f912402475d727915746b3cbb0b93e43e2c4a60f0c9d145f4763c8ac668f
Python
7,598
236
#!/usr/bin/env python # author: Jannes Spangenberg # e-mail: jannes.spangenberg@uni-jena.de # github: https://github.com/JannesSP # website: https://jannessp.github.io from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace import pysam from pathlib import Path from statistics import median impor...
56b52613bba9d07ec973e573a068ac8f40c74d4ecca0f8d1adff93e85d9507a1
Python
7,600
175
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """Depth estimation trainer for YOLO models.""" from __future__ import annotations from copy import copy from pathlib import Path from typing import Any import torch from ultralytics.models import yolo from ultralytics.models.yolo.detect import Det...
a5588bf980fb4f3cb6c2dc37ec46e0c150627f60a7caec64bc37afbbc77ab504
Python
7,603
196
############################################################################# # Copyright (C) 2020-2025 MEmilio # # Authors: Agatha Schmidt, Henrik Zunker # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complian...
f369308fcb2388f22cf7dbc4c24fc6a66a1cf5bd13c2f4feef48609781dc720d
Python
7,604
140
import numpy as np from cebra import CEBRA import cebra from pathlib import Path import matplotlib.pyplot as plt from stimulus_mode_functions.plot_functions import plot_embedding_cross_validation from stimulus_mode_functions.utils import set_seed # define cebra model def cebra_model_function(arglist: object, lr: obje...
9e604481ecd52098dbe0178c3039a35442efdb17e5e5a552b63a26d82270c307
Python
7,605
253
from __future__ import annotations import json from functools import partial from pathlib import Path from typing import Final import pytest from PySide6.QtCore import Qt from PySide6.QtWidgets import QCheckBox from pytestqt.qtbot import QtBot from labelme._widgets._label_dialog import LabelDialog from ..conftest i...
bdb0009aaae1b6ffd706d3ffcd040b7f773079fd8fea1ccea347d8784dd732ee
Python
7,606
219
import hashlib import requests from pathlib import Path import zipfile from collections import OrderedDict from warnings import warn import json import torch import zipfile _MODELS = {} _ALIASES = {} def get_file(fname, origin, file_hash=None, cache_dir=".cache", cache_subdir="datasets", extract=True): """ D...
ee6b00c34e830311c5e6efe1d797d2222797887bb7ec708f1b72ae5908a013d7
Python
7,607
172
import tkinter as tk from tkinter import ttk from tkinter import messagebox from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from .base_window import BaseWindow from .result_window import ResultWindow import matplotlib.pyplot as plt import numpy as np import h5py from scipy.signal import decimate clas...
9dbebeac085932db5c58b111ba5cc09606dbb7013be092ff92083a7cf65d0060
Python
7,608
223
from functools import partial from typing import TYPE_CHECKING import torch from eir.models.input.array.models_locally_connected import FlattenFunc, LCLModel from eir.models.model_setup_modules.output_model_setup_modules import al_output_modules from eir.models.output.array.array_output_modules import ( ArrayOutp...
c9bd9ba9413b1b60c81e15abcd0a0835678c8b23154851fe9c23529a5841e82b
Python
7,609
210
import numpy as np import pandas as pd def mask_data_in_dict(data, mask, mask_priority=None): masked_data = {} assert isinstance(data, dict), "data should be a dictionary" for k, v in data.items(): if isinstance(v, np.ndarray): match_dim = np.nonzero(np.array(v.shape) == mask.size)[0] ...
306f52a28c248d8630e86152c66087e8078df839e105c82ead238c311e5e774f
Python
7,614
200
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image from torch import nn import pytorch_lightning as pl import torchvision.models as models import ...
86ef5a3afa8bb3228cf629e7f252e35634dec967f1a2ad4cc1f76ce26a0155f7
Python
7,614
196
import argparse import networkx as nx import matplotlib.pyplot as plt import random import numpy as np import math from scipy import stats from scipy import spatial from gensim.models import Word2Vec ''' use existing matrix to run edge2vec ''' def parse_args(): ''' Parses the node2vec arguments. ''' ...
951ba6a3baf672e88a38a0d7e7343645e61acd9835a3504a0204868b53871902
Python
7,614
200
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image from torch import nn import pytorch_lightning as pl import torchvision.models as models import ...
b077119dfdf301062295d6d9d112dceff05466e75aa56e004f84802c5e80bc4d
Python
7,615
187
"""The optimised inner loops must agree with the references they replaced. Run from the repo root:: uv run python python/test_pipeline_fast_paths.py Three routines were rewritten for speed after profiling showed a 270-cell calcium recording spending ~960s on a single lag (``null_model_und_sign`` and ``efficiency...
7431ffdb8a6b50276718c2f6d180f4fc47f5fad22dbeb39d1114badd5e63a5bc
Python
7,618
241
import io import os.path as osp import pickle import re import sys import warnings from typing import Any, Dict, List, Literal, Optional, Union, overload from uuid import uuid4 import fsspec import torch import torch_geometric DEFAULT_CACHE_PATH = '/tmp/pyg_simplecache' def get_fs(path: str) -> fsspec.AbstractFile...
72cc66f9a71c571460274eb66e98d9097f94c2db6f8eb5c02b99cd4a6846f866
Python
7,620
207
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ PCA-based Feature Selection Pipeline This module provides a function to identify connections (features) associated with a target variable using Principal Component Analysis (PCA). The pipeline: 1. Performs PCA on the input feature matrix (df_X_train) 2. Identifies pr...
96e1ab0393433b207f419be99e3a1ce1dcfab6f90e1f4c07c9df8caae64468ec
Python
7,620
174
""" (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 ...
1665e8e4348e414ac353d23954b8460671afec9a664e9250ef1e4293aa9ba547
Python
7,625
140
import numpy as np from cebra import CEBRA import cebra from pathlib import Path import matplotlib.pyplot as plt from choice_mode_functions.plot_functions import plot_embedding_cross_validation from choice_mode_functions.utils import set_seed # define cebra model def cebra_model_function(arglist: object, lr: object, ...
1d5190f7b539f8782f495dbc84339a84a5ead4474b5acd6dd8761631eb8d76fc
Python
7,625
239
from pathlib import Path from PySide6.QtCore import Qt from PySide6.QtWidgets import ( QDialog, QDialogButtonBox, QFileDialog, QHBoxLayout, QLabel, QListWidget, QListWidgetItem, QPushButton, QStyle, QTreeWidget, QTreeWidgetItem, QVBoxLayout, ) class BatchFolderSelectio...
9d039db405e495aa5eed5913b358b04e434a31d4224657a40eaec8e67a88629b
Python
7,625
177
import pandas as pd from pathlib import Path from pkg_resources import resource_filename from natsort import natsorted from tifffile import tifffile from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.model.calculation import fitGeoTrans, mapPointTransform from napari_dmc_brainmap.utils import get_bregma, ...
f45eca5fa592d76d1aa4c5ed57aded714203a8917f773b0f235504df63190b2d
Python
7,628
173
#!/usr/bin/env python """ Handles a single camera. Notes: 1. There is one of these per camera. 2. The name of the camera is the name of the module. Responsibilities: 1. Operate the camera. 2. Return the camera configuration when requested. This includes things like the camera maximum value, whether it ...
ffd7093274d3558eb317ea3dacbfe69e699ee72b2933a98d97187f4951f17941
Python
7,629
140
import numpy as np from cebra import CEBRA import cebra from pathlib import Path import matplotlib.pyplot as plt from stimulus_mode_functions.plot_functions import plot_embedding_cross_validation from stimulus_mode_functions.utils import set_seed # define cebra model def cebra_model_function(arglist: object, lr: obje...
4e70fbd7b7af53f1db72fa1b96388dbd3763837c690ee84ed187e39d96ab1ec6
Python
7,630
230
import os import sys import json import tqdm import glob import numpy as np import torch from torchvision.transforms import v2 # Filepaths to change if run on different machine. CWD = r"" DATA_DIR = r"D:\Askivit Daten\ASKIVIT_1_5" DIR_MODELS = r"C:\Users\" ## ****************************************...
6fc2a74dd87ae4175789097b4e8f660a76c7d9472a6c48c07b376c5804a38e67
Python
7,630
200
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image from torch import nn import pytorch_lightning as pl import torchvision.models as models import ...
721cfe97852cc7085db0e7930d4fa844c231b55637c0e009b753c0138dd61504
Python
7,630
168
"""Fold-symmetry scoring used by both QuadrantFolder and the image-alignment UI. This module lives under ``musclex.utils`` (instead of ``musclex.ui.widgets``) so the core/headless QuadrantFolder pipeline can call it without dragging in PySide6 — importing anything under ``musclex.ui.widgets`` runs that package's ``__i...
72be70e72fe4ae2645521f293a0ea096b2542d3914e8891c45ed32bf05dfc6a9
Python
7,630
140
import functools import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image import numpy as np import timm from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform import torch.nn as nn from albumentations import ( Com...
849fbaec9fcbfbe40df990e09110a84f9632441b05ee008035759ad8f0e16325
Python
7,630
184
import pandas as pd import shutil, os import os.path as osp from ogb.utils.url import decide_download, download_url, extract_zip from ogb.io.read_graph_raw import read_csv_graph_raw, read_csv_heterograph_raw, read_binary_graph_raw, read_binary_heterograph_raw import torch import numpy as np class LinkPropPredDataset(o...
c56cf67a3b0d0cdf27d9dcec1ddef6b86930e148c4ad14480b9f58b4d66ead2e
Python
7,630
200
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image from torch import nn import pytorch_lightning as pl import torchvision.models as models import ...
f9ab453b8801d72c1c912c4924f0e52073db4b5b1b70c355d015dc617991fcc7
Python
7,630
199
"""Temporal backbones: TCN, GRU, LSTM, Transformer -- and the RG-NFT model.""" from __future__ import annotations import math import torch import torch.nn as nn import torch.nn.functional as F # --------------------------------------------------------------------- TCN class Chomp(nn.Module): """Trim the right p...
8c0ac22b0e2c400afbb249c1f7e915aeb4d205d3e35fd669a98f853b52041220
Python
7,631
212
# This is the model definition of RepLKNet-31B + Cascade Mask R-CNN model = dict( type='CascadeRCNN', backbone=dict( type='RepLKNet', large_kernel_sizes=[31,29,27,13], layers=[2,2,18,2], channels=[128,256,512,1024], drop_path_rate=0.6, small_kernel=5, d...
d212f136524ea759ed9a23ba37479e9a5050aa0e6c9233208ecfe5829f06ecb3
Python
7,631
205
"""A module that contains unit tests for the :py:mod:`corelay.tracker` module.""" import pytest from corelay.base import Param from corelay.plugboard import Slot from corelay.tracker import Tracker @pytest.fixture(name='tracker_type', scope='module') def get_tracker_type_fixture() -> type[Tracker]: """Creates a...
4219dfa0a4f3d5617df1162aadd824ff065f9cf463d2d75bcc948843701af4f5
Python
7,633
163
import numpy as np import os import tempfile from ivim.io.base import read_im, read_bval, read_bvec, read_cval, write_im, write_bval, write_bvec, write_cval from ivim.preproc.base import average, combine, extract # Paths to data temp_folder = tempfile.gettempdir() # Test functions def test_average(): bval_file = ...
e885902bd3a5c78156f2d799905273a320a133d4c9a5141251d2f331ba20006e
Python
7,633
219
from psychopy import core, visual, monitors, iohub from psychopy.iohub import launchHubServer from psychopy.iohub.util import hideWindow, showWindow from psychopy.iohub.client.eyetracker.validation import TargetStim from const import FULLSCREEN, SCREEN, MONITOR_RESOLUTION, MONITOR_DISTANCE, MONITOR_WIDTH class EyeTrac...
52d1b6bf05bb3367b004f9811e82b7fb04aa65a3ded661c26be5d0ed79407fec
Python
7,634
209
""" GMA (General Movements Assessment) dataset loader. Pose format: per-video JSON files with naming convention: {infant_id}_{session}_{age_code}.json e.g. 73_2_1.json (age_code: 0=term, 1=3-4 month fidgety window) Filters applied: - age_code == 1 (3-4 month fidgety window only) - For infants with multiple ...
5724c4d93189a4b272ae37beb39fc0f7098b0623b8ef473254964f76e7fab0c9
Python
7,635
149
# Denoising of the DWI with DIPY: Marchenko-Pastur PCA (MP-PCA, Veraart et al. 2016) or Patch2Self (Fadnavis et al. # 2020). Both assume noise that is independent between voxels: use this module first, on the raw images, before # any interpolation (eddy, susceptibility correction, baseline averaging) and before G...
b9ffd032c7734665e6c79eec484587a03f933d3d534cd568aa917869a6bd85f4
Python
7,636
212
"""Combined 3D-viewer + IR-spectrum component with hover linking. Streamlit widgets cannot forward hover events to Python, so linking "hover a peak" to "animate that normal mode" requires both panels in one HTML component: a 3Dmol.js viewer (left) and a Plotly.js spectrum (right) wired together in JavaScript. Hovering...
3ee5788207cd0c2a4ea32f80e568d09822e07a65bd9240d2ff277133f8a96958
Python
7,637
187
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 23 18:33:22 2020 @author: mheinzinger """ import argparse import time from pathlib import Path import torch import h5py from transformers import T5EncoderModel, T5Tokenizer device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') p...
8d4c406eeac771f56dbc01c3d35676e31a68e79436a88b497f8b16ccbc146369
Python
7,638
211
#!/usr/bin/env python """ This file contains the various XML parsing functions. Hazen 04/17 """ import numpy import xml.etree.ElementTree as ElementTree import storm_control.sc_library.halExceptions as halExceptions class ShutterXMLException(halExceptions.HalException): pass class ShuttersInfo(object): ...
0a1bc63c31f6c839d54826df9f3a08bd897c5764c9a87b2542acfe4d45962e13
Python
7,642
252
import functools import inspect import logging import warnings __all__ = [ "keyword_deprecation", "keyword_equivalence", "add_method_to_instance", "add_method_to_class", "add_prop_to_instance", "add_prop_to_class", "deprecated", ] def keyword_equivalence(func=None, *, this_or_that): "...
d4e61c88470034acb079e201f447fe3b527bfd4055a96003db5028f38036378e
Python
7,643
190
import os import re import warnings import numpy as np from pandas import DataFrame import Utils.config_stomach as CONFIG from argparse import ArgumentParser import torch.nn.functional as F import gc from glob import glob import seaborn as sns import torch from torch.utils.data import DataLoader from prefetch_generator...
c183a338a3713b10c2b8772650661b6e6c2662634dcdde74113bb4436a42552c
Python
7,645
181
# -*- coding: utf-8 -*- """ Cell shape and size detection routines The cell shape detection is based on a seeded and masked watershed. """ #:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City #:license: GNU, see LICENSE.txt for details. import sys import numpy #from scipy.ndimag...
2155af599233c80073bc7361028edb5c6a49a5fb39ae764e3436432a34f09bfe
Python
7,646
200
from brainscore_vision.model_helpers.check_submission import check_models import functools import numpy as np import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image from torch import nn import pytorch_lightning as pl import torchvision.models as models import ...
35d3916f19d2d7a386315a1d34fde3fcff1f416ce17e0d51611f8f2cf88860fb
Python
7,647
165
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
2e3ba1eb2cddeb34fe58eea4bf18875ed0d2d8e217e82bd688dc57917f18c163
Python
7,651
152
# import libraries # general import numpy as np import pandas as pd import xarray as xr import tqdm as tqdm # brain-score specific import brainscore from brainscore_core.supported_data_standards import brainio from brainscore.benchmarks._neural_common import average_repetition from brainscore_core.supported_data_st...
65e2467e3ecd84f571c3aa26dce391bac5873b7f6471ad8ee51763b50cb877b7
Python
7,651
203
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import datumaro as dm from django.conf import settings from django.db import transaction from rest_framework import serializers from cvat.apps.consensus.intersect_merge import IntersectMerge from cvat.apps.consensus.models import ConsensusSettings f...
692bac3b3d6ed29bd1f5c6e909a58aeb3e2af65334d1b3fda52dbdafc255771f
Python
7,651
214
# Copyright (C) 2025 Paolo Vincenzo Fioretti, Michela Roccuzzo, Enrico Saccon, # Maria Pennuto, Manuela Basso # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or...
69d596f5d4a82e580b9ee7617855792af845b780df9cd030c11c70683628ce70
Python
7,651
214
import tifffile import numpy as np import json import cv2 import tifffile as tiff from skimage.exposure import rescale_intensity def load_meta(section_dir): path_to_tiff = section_dir.joinpath([f.parts[-1] for f in section_dir.glob('*.tif')][0]) with tifffile.TiffFile(path_to_tiff) as tif: meta_data =...
76f73ebaa4d9fcb9e2a2dc60f69e9fa25a6f3a1b58e1f0a3f3107db36261eab3
Python
7,656
215
#!/usr/bin/python2.4 import sys import bx.pwm.position_weight_matrix as pwmx from bx.align import maf as align_maf from bx.pwm.position_weight_matrix import isnan NaN = float("nan") def main(): pwm_file = sys.argv[1] splist = sys.argv[2] if len(sys.argv) == 4: inmaf = open(sys.argv[3]) else...
824c6996698a188bce4bf51f0bf4fba50dcc0f3bfbd7e26e1528de214b9d1644
Python
7,657
185
from typing import Dict from math import prod from typing import TYPE_CHECKING if TYPE_CHECKING: from zigzag.classes.workload.layer_node import LayerNode import zigzag.classes.mapping.mapping_assist_funcs as mapping_assist_funcs class SpatialMapping: """ Class that collect all the info related to spatial...
d76ab7a760143af1578fa5327a270f090edb3cba41d2ce383e17ac1532f84905
Python
7,657
243
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations from collections.abc import Callable, Iterator, Mapping from functools import cached_property from types import MappingProxyType from typing import Any, cast import datumaro as dm from cvat.apps.dataset_manager i...
88b7894723f640a670ce1e26a98079683f4d623f5bc9366c587f0882f947a0b2
Python
7,660
208
"""Normalization layers for 1D inputs.""" from typing import Any, Union import numpy as np import torch from torch import nn __all__ = [ 'SpikingBatchNorm1d', 'SpikingEiNorm1d' ] class SpikingBatchNorm1d(nn.Module): """Batch normalization wrapper.""" def __init__(self, num_features: int, eps: float = 1...
a2c60183e9e1d7ec8f5244aa18f113f014753c44acf4b3c31eac95381f2c828d
Python
7,660
231
""" Diagnose why ``LmfitTRFAdapter`` fails on the m6 case under init perturbation. Strategy: * Load the captured m6 case. * For ``n_seeds`` independent perturbations of size ``perturb``, run TRF. * Print summary lines for every fit, full diagnostic dump for any failure (success=False or aborted at the lmfit nfev ca...
6ca3ffc477dfa4a3025693e6ebfb1a2da6bba1ec2f5c71b3a230abc4e7ea94ef
Python
7,661
201
import nibabel as nb import numpy as np import json import csv import os import glob import subprocess import sys from datetime import datetime from nilearn import plotting as nip from nilearn import image from argparse import ArgumentParser def get_centers(brain, orig_labs): """ Get coordinate centers given ...
7d554e6b7f10d25c24f6304bda83336f617512bb5ccc1349714123c4dde6e79a
Python
7,661
229
""" Calculate the reconstruction """ import os import sys import argparse from collections import defaultdict from pathlib import Path from tqdm import tqdm import numpy as np import pandas as pd import torch from neuralcompress_v3.models import BiModel from neuralcompress_v3.utils import (Checkpointer, ...
5652b6fa217ac06f5b69af8aa071f658135e369f286d6ae33b82eef4896ef295
Python
7,662
170
"""A module that contains unit tests for the :py:mod:`corelay.processor.clustering` module.""" from io import BytesIO import os import typing from importlib import import_module import numpy import pytest from sklearn.datasets import make_blobs from sklearn.metrics.pairwise import euclidean_distances from corelay.ba...
539583d662b1dfd7dbfce9ac7f3eb30f5c6782223bcc98813eee75d16ab41ca0
Python
7,664
211
#!/usr/bin/env python """ Converts .tri files to .nifti segmentation masks """ import os import nibabel as nib import nilearn, nilearn.image import numpy as np import argparse from tqdm import tqdm from src.tri_io import load_tri import tempfile import trimesh import vtk import scipy.io as sio def is_inside(points,...
53e561265bede654fe252845ac5e6d37ce3008faa856e7ed2d53723955ecd0e5
Python
7,664
192
from typing import List, Optional, Tuple, Union import torch from torch import Tensor from torch.nn import Embedding from torch.utils.data import DataLoader from torch_geometric.index import index2ptr from torch_geometric.typing import WITH_PYG_LIB, WITH_TORCH_CLUSTER from torch_geometric.utils import sort_edge_index...
e76b2e564a82d4f85eca193c3a653a0bc79c3ee7f34b8ebc3e6a8f1f01ef31f4
Python
7,665
187
# -*- coding: utf-8 -*- import os import re import sys def find_reference_pcr_file(pcr_file_path): current_dir = os.path.dirname(pcr_file_path) for i in range(5): # Try up to 5 levels up ref_path = os.path.join(current_dir, 'dat_vestacif_files', 'reference_pcr_format', 'tbbaco_noise_percent_10....
163b5484b92802178499186b3f08db0457adc7d59b97640f3f9acbe80717e8be
Python
7,667
234
#!/usr/bin/python3 # import os import sys import argparse import numpy as np from uac import utils # Create the parser my_parser = argparse.ArgumentParser(description="Calculation of old atrial coordinates for RA") # Add the arguments my_parser.add_argument("target_path", metavar="path", type=str, help="Path for the...
900e0c1c73ab174437a9ece64cec6550c9028c5911f0e997aaf5123f4de6475d
Python
7,667
196
"""Perform MDS on the trial-average fMRI responses, or on the DDN features, for the NSD-core images. # !!! Remove DNN Parameters ---------- subject : str String indicating the number of the subject used. If 'all', then use all subjects. data_ood_selection : str If 'fmri', the ID/OD splits are defined based on fMRI ...
0576714768d487bfc061f29b08d400b3846161412efff0d830527a4b7c4510d7
Python
7,670
237
from julia.api import Julia from scipy import ndimage from typing import Any, Dict, Tuple import SimpleITK as sitk import argparse import glob import json import numpy as np import os jl = Julia(compiled_modules=False) jl.eval('include("adjust.jl")') ADJUST_IMAGE_SIZE = jl.eval("adjust_image_cm") def write_to_json( ...
d077b5dea18a485f545ba90b5bff8d756a5c3b114894a317d01f83caf79361c7
Python
7,671
184
import torch from torch_geometric.nn import to_hetero,GeneralConv from torch.nn import Linear import torch.nn.functional as F from sklearn.metrics import roc_auc_score,average_precision_score import numpy as np import random import pandas as pd SEED = 666 random.seed(SEED) np.random.seed(SEED) torch....
6e9a1308fedda18ba1ec44fe975f5b1634fc924ee0b9c3a14e9023502d4fd664
Python
7,672
237
from julia.api import Julia from scipy import ndimage from typing import Any, Dict, Tuple import SimpleITK as sitk import argparse import glob import json import numpy as np import os jl = Julia(compiled_modules=False) jl.eval('include("adjust.jl")') ADJUST_IMAGE_SIZE = jl.eval("adjust_image_cm") def write_to_json( ...
ecd557b014e5a0824906845e789bc52cdeed64f58ec3f124e6142c8d7fd9f52a
Python
7,674
211
#!/usr/bin/python # -*- coding: latin-1 -*- # ============================================================================================= # Librairies importation import numpy as np import nrrd import sys import os import multiprocessing as mp from voxcell import RegionMap import voxcell # =====================...
542e568f1800953bea5b8d6e0640b0f9816b11aea4dcfba1eca98ebadc652c8d
Python
7,675
145
from torch import nn from torchvision.models import convnext_base, efficientnet_b0, vgg16, resnet50 from model.GFNet import GFNet from model.GhostNetV3 import ghostnetv3 from model.MobileNetV3_Tea_0MB import MobileNetV3_Tea_0MB from model.MobileNetV3_Tea_1MB import MobileNetV3_Tea_1MB from model.MobileNetV3_Tea_2MB im...