sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0021b3051e790de2c07a26ef1a72c7f3d8c20c0367f444f4bc315d82ab73544b
Python
6,639
179
from typing import Callable, List, Optional, Tuple import torch from torch import Tensor from torch_geometric.nn.aggr import Aggregation from torch_geometric.nn.inits import reset from torch_geometric.utils import scatter class ResNetPotential(torch.nn.Module): def __init__(self, in_channels: int, out_channels:...
9dbb600c61088c0c9e033af33ac4f00748ef3a85c8a9b0732f426ad36a92b08f
Python
6,640
186
import json import subprocess from pathlib import Path from typing import Optional import click import nibabel import numpy as np import pydicom import simple_mri as sm from loguru import logger VOLUME_LABELS = [ "IR-modulus", "IR-real", "IR-corrected-real", "SE-modulus", "SE-real", "T1map-sca...
82fd990685a10fa80e26133d437c4d7f8cc531fea13819a8c7ed4ad0f449266f
Python
6,641
187
import cupy as cp import numpy as np import cupyx.scipy.ndimage as ndimage import logging logger = logging.getLogger(__name__) def find_center_vo(tomo, dark, flat, ind=None, smin=-50, smax=50, srad=6, step=0.25, ratio=0.5, drop=20): """ Find rotation axis location using Nghia Vo's method. :...
c5e470d39b3031c5bc466ae354e5fcf919c1a366e82c9e9b7dbf1215e3237929
Python
6,641
130
import json from pathlib import Path import logging from brainscore_vision.utils import fullname from brainscore_core.plugin_management import import_plugin from brainscore_vision import load_benchmark from brainscore_vision.model_helpers.brain_transformation.temporal import TemporalAligned from brainscore_vision.model...
d8d8eb36541a1208936a87cdf9ce6a78b53e482149bc13c2f78b060d9ce50ae4
Python
6,642
178
#! /usr/bin/env python3 import subprocess import os import sys os.environ["SUBJECTS_DIR"] = "/media/miplab-nas2/Data/Karolis/huppi_high_res_resting/derivatives/freesurfer/" script_dir = "/home/degutis/dynamicConnectivityMovieWatching_2025/src/preprocessing/fmri-analysis/library" os.environ["PATH"] += os.pathsep + scri...
ac0dd63364bcd8af470580519e16602f6ebdbdd29a1c4a5912fc010b7e64cc36
Python
6,643
205
#!/usr/bin/env python # -*- coding: utf-8 -*- """This contains the psychological models that work on images """ import pickle from itertools import product import os from progress.bar import Bar import numpy as np import torch import torchvision import cornet.cornet_s as cornet_s import resnet.resnet as resnet import...
48f470dc72d3618a37d446ef569333824016f32ab74ab4b5c202e42a73235fef
Python
6,645
219
import pandas as pd import numpy as np import torch import torch.nn as nn from torch.utils.data import DataLoader from torchvision.transforms import Compose import pytorch_lightning as pl from pytorch_lightning.loggers.neptune import NeptuneLogger from pytorch_lightning.callbacks import ModelCheckpoint from sklearn...
5da2d8221775279b3797962e9f9c1f5d18170c1b8e6cb6854d044c8a61287eac
Python
6,645
194
import torch import numpy as np from scipy.stats import rankdata from einops import reduce, rearrange from sklearn.feature_extraction.image import grid_to_graph import rootutils rootutils.setup_root(__file__, indicator=".project-root", pythonpath=True) from src.rsa import get_phase_img def batched_pearsonr(x, y): ...
70143712d1c1d6ce9d0a9077dd5e26900169d7e07613e50607bc80f7d0101927
Python
6,646
156
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ Re-order one or many connectivity matrices' rows and columns. The connectivity matrices can come, for instance, from scil_connectivity_computes_matrices. To state the new order, use a text file with the following formatting: The first row are the new x order and the ...
7dd8a4ad8b21a10ad17cbf7058568d7845f67c2dc1c3284629321547341ee261
Python
6,647
119
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'mosaic_dialog.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_Dialog(object): def setupUi(self, Dialog): Dialog.set...
e1aaff4833c47a34249e6012fc2536714c96bd172a0a841a08ff0ccc8e1db9d0
Python
6,647
152
import os import fnmatch import json import math import pandas as pd # from pandas import DataFrame def find_and_remove_substring(s, a, b): start = s.find(a) + len(a) end = s.find(b) substring = s[start:end] return substring # 批量打开JSON文件 outputfiles_path = f'outputs/snnresnet18_split32c_b64_sn...
4ba75742757406e6fa03653b23aaa8e32f13cc53c1e5d24bc97c58fc7b116184
Python
6,648
167
# /------------------------------------------------------------------------------+ # | 09-MAR-2023 | # | Copyright (c) Bone Imaging Laboratory | # | All rights reserved ...
8509048dbbfc7f4a35c6a4b3ccebb7395facb17d470782dbdb46d6b595386ae6
Python
6,651
140
import os import itertools import pandas as pd import numpy as np def extract_benchmark_data(input_file): ''' Extracts the essential information (parameters, specific runtimes) from log file. Parameters ---------- input_file : str Name of the log file. Returns ------- extrac...
fc18221c8852b03479451a4fde2c5fc18427a4ef44afa903d666e4a35086a6b3
Python
6,651
113
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'steve.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_MainWindow(object): def setupUi(self, MainWindow): MainWindow...
d9a02e9df06191ca55012f6491b1c17b42a320745f5a9e12401222de69d34618
Python
6,652
169
# We reuse a fraction of code in http://bitbucket.org/omerlevy/hyperwords. # Using the numpy and similarity matrix largely speed up the evaluation process, # compared with evaluation scripts in word2vec and GloVe import numpy as np import argparse import random from scipy.sparse import dok_matrix, csr_matrix ...
dbc95f97be41f355a9f7a528bc06e5f68815cf60812230f5b4f02fda8e2c0ac3
Python
6,652
177
# 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, ...
6b6d717f91564f98d24c2ecc6f5c026812ae82439a10d6bbd3ae3fe8b7207ee1
Python
6,655
183
import subprocess import os from pathlib import Path import shutil import numpy as np import ase from ase.io import read as ase_read from chemgraph.models.graspa_input import GRASPAInputSchema from langchain_core.tools import tool _file_dir = Path(__file__).parent / "files" / "template" @tool def run_graspa(graspa_i...
466c9d9a5ab2f0860c075447d893278f61059b432dae99cdee08ee0e5bce8207
Python
6,656
176
# -*- coding: utf-8 -*- """Decoding tools for functional magnetic resonance imaging data. Execute via the command line with python -m fmri_decoder <args>.""" import argparse import os from pathlib import Path import numpy as np import fmri_decoder from fmri_decoder.data import DataConfig, ModelConfig, SurfaceData, T...
dfc50ee7229df541b128b1ab3c56d87c2a57bc7a250499ab9efb6c5894b717c9
Python
6,656
185
from typing import TYPE_CHECKING, Literal, NewType, cast import torch from torch import nn from eir.models.fusion import ( fusion_attention, fusion_default, fusion_identity, fusion_mgmoe, ) from eir.models.fusion.fusion_default import al_features, default_fuse_features from eir.models.fusion.fusion_id...
d99549c1f32131ce388cf05bbaae33a520f4b4e5f60f4cc06e8fb78cacd15bb7
Python
6,657
140
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['filtering.zip', 'tractogram...
4637726cfb9371e605aa93ea372cf68dca0b3e06aa152a366f8ca1a8054f192c
Python
6,659
166
"""Stop scrolling *past* a settings field from changing what it says. A spin box or a combo box takes the wheel whenever the pointer happens to be over it. On a tab that is itself a scrolling column of settings — which is most of them — rolling the wheel to get further down the page silently retunes whichever field th...
9449a531b89ebd8288a136129252c69268d25c00b0ee084c5b3e4750af8d790a
Python
6,659
205
from __future__ import annotations import importlib import json import os import shutil import threading from collections.abc import Callable from collections.abc import Iterator from http.server import BaseHTTPRequestHandler from http.server import ThreadingHTTPServer from pathlib import Path import imgviz import py...
516de958850d02b5e229b16ddb83a02b2fac3c6966d19fade6136c736b2b2a18
Python
6,661
195
import os import shlex from app.project_e.image_processing.utilities.utils import eleSubprocess from flask_socketio import SocketIO def ants_registrator( fixed_image, moving_image, outputmat, transformationalgorithm="rigid" ): # ants call parameters dimensionality = "-d 3" initial_moving_transform = ...
53e9c3fc3577ffdd1a1dab2b79a99270e9ff63a03ee66542983731c533c7b705
Python
6,666
212
#!/usr/bin/env python # ## @file # # GUI for control of Holoeye SLM. # # Hazen 07/14 # import numpy import sys from PyQt5 import QtCore, QtGui import storm_control.sc_library.parameters as parameters import storm_control.sc_hardware.holoeye.holoeyeSLM as holoeyeSLM import storm_control.sc_hardware.holoeye.holoeye_u...
cc3a161e71f1716b5fa5172163563d65dc2e4443c48a75d6dd30ebbe331dc06f
Python
6,667
172
# Copyright (C) 2021-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import json from http import HTTPStatus from typing import Literal import pytest from cvat_sdk.api_client import models from cvat_sdk.api_client.api_client import ApiClient, Endpoint from cvat_sdk.core.hel...
3b98e2324cdd252a5fbe4a6afc8fc77f977bc24542c6e6bfa318d54fb9dc6e0e
Python
6,668
216
""" Collect subject amounts for the splits used during evaluations. This script analyzes data splits to collect statistics about: - Subject amounts per label - Camera IDs used - Pixel amounts per label - Pixel amounts per subject and label """ from typing import Any import numpy as np import pandas as pd from htc im...
6e56e8ec558a4174354d61f9e989dd2e987e537af05e2e99c1c3f020ff6d3b41
Python
6,669
166
""" Classes and functions for fitting ivim model """ import numpy as np from scipy.optimize import curve_fit from dipy.reconst.base import ReconstModel from dipy.reconst.multi_voxel import multi_voxel_fit from dipy.utils.optpkg import optional_package class IvimModelSubtracted(ReconstModel): def __in...
7c58ee723d3f1f81a292d240e80fcf0160a8dbe76f9e194c95ee1c787ed51cb7
Python
6,669
234
import numpy as np import polars as pl from eir.data_load.storage_engine import NULL_STRINGS, HybridStorage, is_null_value def test_nan_preservation_in_numeric_data(): df = pl.DataFrame( { "ID": ["sample1", "sample2", "sample3"], "float_col": [1.5, np.nan, 3.5], "int_c...
f5064fd7ee1625951536990f32aa2c89720ca670a9dc0b5b45922ae5626ce1a9
Python
6,669
184
from PUMI.engine import NestedNode as Node, QcPipeline from PUMI.engine import FuncPipeline # To extract voxels 10 to 12 inclusive you would specify 10 and 3 (not 10 and 12). @FuncPipeline(inputspec_fields=['in_file'], outputspec_fields=['out_file']) def pick_volume(wf, volume='middle', sink=True, **kw...
18de04c22d20b3aa621d505fc8e522345acbf7baa2cd79a908cd77ab8fe1ec8e
Python
6,670
146
# -*- coding: utf-8 -*- """ Created on Fri Jun 25 16:58:13 2021 @author: Yoshi """ import os import shutil import numpy as np import matplotlib.pyplot as plt import scipy.stats as stats import math from PIL import ImageColor def correlation_matrix(path,data,cell_flags,framerate_information,extra_flag,mode=0): ...
d3a12c2cbe336865cf4678f10057a16ab76c99dbaf9c3c9d044c5893da957bf9
Python
6,670
164
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Projects maps extracted from a map onto the points of streamlines. The default options will take data from a nifti image (3D or 4D) and project it onto the points of streamlines. If the image is 4D, the data is stored as a list of 1D arrays per streamline. If the imag...
4c02ee31ecd1990367e97f0017bcc54ac170bbd0e34332eef2f3aaf7dcbffd57
Python
6,672
198
#Lucas Sancéré - """ Here we will add the functions from classic_image_processing from Misc_Utils othat are needed (probably downsampling code and so on) and are not present anywhere on this repo """ import glob import os import PIL from PIL import Image from tqdm import tqdm PIL.Image.MAX_IMAGE_PIXELS = 1000000000...
86ded150909a2a131df51fd6c624187884e96e786146daad27c5224f1c6ce0d4
Python
6,672
186
"""Deep Agent action-review cards for the Streamlit chat. The CLI renders each pending tool action (shell command, file write, file edit, ...) as a panel and asks for approve/reject. This module gives the chat the same information as cards with buttons. ``action_preview`` is pure and mirrors ``chemgraph.cli.formatti...
fcb7677fbb5794a2e931fc8d249af3df356bae7ac5dc4e39424ca0ed37f2db78
Python
6,672
184
# -*- coding: utf-8 -*- # @Author : LG import os from json import dump, load from typing import List, Union import numpy as np from PIL import Image from ISAT.utils.dicom import load_dcm_as_image __all__ = ["Object", "Annotation"] class Object: r"""A class to represent an annotation object. Arguments: ...
839f0c8b1dfb8d36f2a214d8beaeb9630b41c7fafa86539356d707c92c49abf3
Python
6,674
120
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/media/lg/disk2/PycharmProjects/ISAT_with_segment_anything/ISAT/ui/category_setting_dialog.ui' # # Created by: PyQt5 UI code generator 5.15.10 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not...
66df4523466d2a40b3e0ebd5367efee1f7fedea2eddcce05e659a2922bfcb762
Python
6,676
138
import numpy as np from result_caching import store from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly from brainscore_vision import load_dataset, load_metric from brainscore_vision.benchmark_helpers.properties_common import PropertiesBenchmark, _assert_texture_activations from brains...
937ccd3e6ac4d1f5e4e82d0d0233335c9185737e483cd08a547ddeb5ac926717
Python
6,676
189
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Maximilian Betz, Daniel Richter # # 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 compli...
3f10ac62582fd471b2792d1abcebc44c68cd75ccfc1975d5fe8791ac67188ab7
Python
6,677
151
# 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...
a6f5213b05d0e9e955d972afb599601be00f31cccec0eea4bafe671c8546c01b
Python
6,677
154
#!/usr/bin/env python # coding: utf-8 ''' Dependencies: pip install pandas numpy voxcell matplotlib scipy External dependencies: calculate_density_mm3(), get_all_filenames(), get_csv_filenames(), extract_prefix_from_filenames() chmod +x script.py In this code we're going to improve region coverage which is already b...
22148d9d175ba7228e6755b03d1e68ba403ad5009f1865954ee034b11adea01b
Python
6,680
197
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import json from collections.abc import Callable, Mapping from typing import Any, TypeAlias __all__ = ["Condition", "F", "Field", "Filter", "JsonLogicExpression", "all_", "any_", "not_"] JsonLogicExpression: Type...
511233a039e2e311c0b7feae2f6e92c350328520b9f4267bab0015e8d51be5f5
Python
6,682
179
# adapted from mtbatchgen by Zahoor import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import os from collections import OrderedDict import deepdish import modisco.visualization from modisco.visualization import viz_sequence import h5py import numpy as np import modisco #import modisco.backend #im...
b448886b41128a06b99ab8b2ab321aa93c00ecbf3c17321de1114589a70d2e85
Python
6,682
150
# ============================================================================== # Binaries and/or source for the following packages or projects are presented under one or more of the following open # source licenses: # MinCostFlow.py The OpenLane Dataset Authors Apache License, Version 2.0 # # Contact sim...
b344d0903cd54d3e1f2aff572372abae6a34dce44a07ffefe285d4315144e994
Python
6,683
158
# Copyright (c) 2022, Kwanhyung Lee. All rights reserved. # # Licensed under the MIT License; # you may not use this file except in compliance with the License. # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTI...
64d955ea491c58893c3bab671f33b9d8f9fa750f3f84bbebc952acea70b416e8
Python
6,685
178
# 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 from torch import nn from torch.nn import functional as F from typing import List, Tuple, Type from .common...
613864e7e917536e39e7a36ea6439139ad71c9fde8476dd27854ed5e722df02c
Python
6,686
201
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import math from typing import Tuple import torch import torch.nn as nn import torch.nn.functional as F try: from timm.layers import DropPath except ModuleNotFoundError: # compatibility for older timm versions from timm.models.layer...
7b7c69a2b8857f2533cd0462f55490efc78c960cb45417b534c6f4d043ebaa9d
Python
6,686
202
#!/usr/bin/env python # 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 ...
d182c8e83bff7b175e83f755f39560073b15923766e19eee803725ccb68052c4
Python
6,687
221
import torch, torch.nn as nn, torch.utils.data as data, torchvision as tv, torch.nn.functional as F import pytorch_lightning as L import numpy as np from torch.utils.data import Dataset, DataLoader from sklearn.metrics import roc_auc_score from pytorch_lightning.callbacks import ModelCheckpoint class modulerNetwork2...
1a47e6a3a116f9f9d9d24bd4a8303312fc62aaa14c7d3bc221036018b0d9696b
Python
6,691
216
import torch import torch.nn.functional as F from torch.utils.data import Dataset import polars as pl import numpy as np from random import randrange, random from pathlib import Path from pyfaidx import Fasta # helper functions def exists(val): return val is not None def identity(t): return t def cast_list...
4d588e13d32e2b7bf2ecc18348c385c99b410c07ac764eb1e856c0ff10de1020
Python
6,691
214
from itertools import chain from pathlib import Path from typing import TYPE_CHECKING import pytest from eir import train from eir.train_utils.utils import seed_everything from tests.conftest import should_skip_in_gha_macos from tests.setup_tests.setup_modelling_test_data.setup_sequence_test_data import ( get_con...
6861430d377f68b70d3f9ed9f951a0b3d84988804cbddbde2e50b1da5ac08ed9
Python
6,691
229
#!/usr/bin/env python # A script to run simulations sequentially. # Copyright F. Nedelec, 2010--2018 # Using multiprocessing thanks to Adolfo Alsina and Serge Dmitrieff, March 2016 """ Synopsis: Run simulations sequentially. For each config file, a simulation is started in a separate 'run' directory. ...
8d910888fc8974f1f57c181cac4849780120c9012fa9763086cd54dd5d265fc8
Python
6,691
213
import pandas as pd import numpy as np import argparse import os import argparse import os import os.path as osp import matplotlib.pyplot as plt print("calculating the branching angles!!") # cf.: https://arxiv.org/pdf/1803.09340.pdf # cos(phi_l) = rp^⁴ # cf. https://stackoverflow.com/questions/62888678/saving-a-3d-...
cef1b19646ad5397a9610fc2bfc20598b3a9316732acbb096904a6e4c105f1cb
Python
6,691
155
import os import os.path as op import sys import numpy as np import pandas as pd 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.append('/imaging/hauk/rl...
fce415c6bd9e932bad5550b803e27aabec1473a5365a8247415137c0f56263d1
Python
6,696
150
"""Stimulation-analysis step of the pipeline (MEA-Stim). Runs right after spike detection (step 1) when ``params.stimulation_mode`` is set, mirroring MATLAB's ``MEApipeline.m`` — where ``batchDetectStim`` + ``batchProcessSpikesFromStim`` run at the end of step 1 and ``stimActivityAnalysis`` + ``saveEphysStatsStim`` at...
1210995f725cf80a3a5c317a4a1b3c4337ac1d31c7fca6a65764fb1c66962d26
Python
6,697
191
# 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 torch from unicore import utils class UnicoreOptimizer(object): def __init__(self, args): s...
843e2600630e0ad655e2a7a5adc681c70d2d4a91d546056bf0e3331f512b64a5
Python
6,697
187
from typing import List, Union, Dict, Tuple import numpy as np from napari.utils.notifications import show_info from bg_atlasapi import BrainGlobeAtlas def get_bregma(atlas_id: str) -> List[int]: """ Definition of bregma coordinates for different atlases. Parameters: atlas_id (str): The atlas ID...
8d4fc6343d37e7978024cbe84ce449dbb7313c7b55730a615117f03f0eeda0fa
Python
6,698
184
from __future__ import division from enum import IntEnum class ElementTags(IntEnum): TH_START = 0 WM = 1 GM = 2 CSF = 3 BONE = 4 SCALP = 5 EYE_BALLS = 6 COMPACT_BONE = 7 SPONGY_BONE = 8 BLOOD = 9 MUSCLE = 10 ELECTRODE_RUBBER_START = 100 ELECTRODE_RUBBER = 100 EL...
aa32f2f2836bf4aac9bcf02482cd36c68b5805785dfdbda284797ae3cf98d1e6
Python
6,699
290
import torch import numpy as np import pandas as pd from datetime import datetime as dt from dataset import fast_merge,df_to_mask from tqdm import tqdm dataset_names = [ 'botometer-feedback-2019', 'botwiki-2019', 'celebrity-2019', 'cresci-2015', 'cresci-2017', 'cresci-rtbust-2019', 'cresci-stock-2018', 'gilani-2017...
d4510794a730565c293d0b8e734854c25aad9b00cb787a9f0f45e02bb0c65fe2
Python
6,700
205
import torch from typing import Optional def initialize_tensor_like( src: torch.Tensor, shape: int, fill_value: float = 0.0 ) -> torch.Tensor: """ Initialize a tensor with provided shape and same dtype and device as src. By default initializes with zeros. """ out = torch.full( shape, ...
2a4ec9052f13225556b0513ca3d88580def427320e24d989a97ad65af0b1a5bd
Python
6,701
146
from typing import Optional import torch from torch import nn from torch import nn, Tensor from torch.nn.modules.transformer import _get_activation_fn def add_ml_decoder_head(model): if hasattr(model, 'global_pool') and hasattr(model, 'fc'): # most CNN models, like Resnet50 model.global_pool = nn.Identi...
a92db89f95c9af67e9b6753b5b80f460b39d7f3c9626cc4a45d2725a5a801133
Python
6,705
255
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import warnings import re import fnmatch import psutil import pandas as pd import numpy as np import ants from aicsimageio import AICSImage from glob import glob from tqdm import tqdm from readlif.reader import LifFile import mbflim.shared as sha def has_han...
d9f701357ad1dbc056addf9a44a4d29114380417c73b87cbbd0b24f521113a19
Python
6,705
151
import numpy as np import xarray as xr from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly, array_is_element, walk_coords from brainscore_vision.metric_helpers import Defaults from brainscore_vision.metrics import Score class XarrayRegression: """ Adds alignment-checking, ...
1f094217c00eca801afc3de0a02b12c63d53ec731263dcaf6b6d6bff024b6a1e
Python
6,706
155
# -*- coding: utf-8 -*- # python standard library inputs import os import shutil as sh # external inputs from nipype.interfaces.fsl import FLIRT from nipype.interfaces.fsl.preprocess import ApplyXFM from nipype.interfaces.freesurfer.preprocess import MRIConvert from nighres.registration import apply_coordinate_mappin...
5fa76758040f4eacadce46aefef48436ecd05488506bd52a71883a04c3384f5f
Python
6,707
183
import warnings import numpy as np def minmax(x, floor=1e-6, warn_on_nan=True, inplace=False): """Normalize array `x` within each output channel to have min 0 and max 1. For array `x` with `x.ndim == m` and `x.shape == (d_1, d_2, ..., d_m)`, the first `m-1` dimensions of `x` will be flattened. Minim...
6d913321af27e6da06645d03d1bce9bbacbaaa67d4c18443bd98d14e4a64ca87
Python
6,707
199
#!/usr/bin/python3 # import os import sys import argparse import shutil from copy import deepcopy import numpy as np from sklearn.neighbors import NearestNeighbors from uac import utils # Create the parser my_parser = argparse.ArgumentParser(description="UAC fibre mapping") # Add the arguments my_parser.add_argument...
2958d5d9bba749f14700f4927091a79578d2ef83415f4bdc9d32c8f7c4892032
Python
6,708
197
import numpy as np from pandas import DataFrame from collections import defaultdict from scipy.spatial.distance import cdist from . import plot_utils from . import data_utils import matplotlib.pyplot as plt def insulation_mask(h=1): mask = np.zeros((32,128)) h = int(32*h) for i in range(h): ...
1a3f7eb499e9c903ccca2c6383bb0d70a6637b52f7045324f88f582173a72d01
Python
6,709
224
from collections.abc import MutableMapping import numpy as np import scipy.io as sio from ..structures import PLSResults _result_mapping = ( ("u", "x_weights"), ("s", "singvals"), ("v", "y_weights"), ("usc", "x_scores"), ("vsc", "y_scores"), ("lvcorrs", "y_loadings"), # permres ("perm...
4a47f07ea0ffd41e3e61a9f632f30d1a3f7e046fe7335e795a8311a43ed61005
Python
6,709
153
def calculate_movement_directions(kymo, movement_threshold, time_threshold): left={}; right={}; stat={}; reversals={}; # Initialising result dictionary for track in kymo.keys(): left[track] = []; right[track] = []; stat[track] = []; reversals[track] = []; ...
3653ea29144c822d7eb4b6633d155082c88b35c384a58ba7654939e22adb4e49
Python
6,712
220
import functools import json from abc import ABC, abstractmethod from contextlib import ExitStack from http import HTTPStatus from time import sleep from typing import Any, TypeVar import pytest T = TypeVar("T") from shared.utils.config import get_method, post_method FILENAME_TEMPLATE = "cvat/{}/{}.zip" EXPORT_FORM...
8b897ddb523a49430f12844e83b12e25f82a2b8ee8be618eee8f8661aadc9a80
Python
6,712
175
# -*- coding: utf-8 -*- """ Created on Fri Oct 20 09:06:04 2023 @author: lcmmichielsen """ import numpy as np from tqdm.notebook import tqdm import seaborn as sns from matplotlib import pyplot as plt def plot_peaks_RBP(RBP, exons_info, peaks, PSI_glia, PSI_neur, lowthres=0.5, highthres=0.5, save=...
45e2c726371c8108331ee7484c7d5960f74cf7daf8128feb68c400afb55d734d
Python
6,713
169
# Kai Sandbrink # 2022-10-18 # Script that loads configuration options and runs training loop # %% LIBRARY IMPORTS import torch import numpy as np import torch.multiprocessing as mp import copy, time from utils import Config from trainers import train # %% PARAMETERS n_runs = 5 # %% CONFIG OPTIONS config = Conf...
a7a2e02cb8a876e4be9d98322eeea5dfd4e15cf53a5cd3fc59b620d6c541bfd1
Python
6,713
145
import os from nipype.interfaces.base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec, BaseInterface, BaseInterfaceInputSpec, File) from traits.api import Directory, Str, List, Bool, Enum, Int, Float, TraitError, Either from nipype.utils.filemanip import split_filename from nipype.interfaces.base import ...
d5c449c30bfde92457b9c1feb9d871c61bce43bc85bc6d13e478630b05018024
Python
6,713
158
import numpy as np import torch from torch import nn class CNNRNN(nn.Module): """ Maybe further ideas: https://www.kaggle.com/c/rsna-intracranial-hemorrhage-detection/discussion/117210 https://www.kaggle.com/c/rsna-str-pulmonary-embolism-detection/discussion/194145 For this to train properly need...
5a4fbbdcd38852e35cfec4ec71ea2ae0243960b9cfd1b98f95992382558d5709
Python
6,714
162
# Copyright (C) 2021-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import functools from allauth.account import app_settings as allauth_settings from allauth.account.internal.flows.email_verification import send_verification_email_for_user from allauth.account.models impo...
0f2e2e1199533194b4fa5374a4186a12d573ac7767a31581121edab5e85e6efa
Python
6,715
148
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL """Synapse removal module.""" import numpy as np from scipy.sparse import csc_matrix from connectome_manipulator import log, profiler from connectome_manipulator.access_functions impor...
ed989b7f9d52289b398fa3fb8b23e7a09c4d92e3612566c1e669d2ff57092a8e
Python
6,715
181
from argparse import ArgumentParser from dataset import SATARDataset import numpy as np import time import torch import torch.nn as nn from torch.utils.data import DataLoader from model import SATAR, FollowersClassifier from tqdm import tqdm from utils import null_metrics, calc_metrics, is_better device = torch.device...
f904ecc72c3f1cfcf93828c6ea626de1aa9c891f290a20a304264711ea0f967e
Python
6,715
218
# -*- coding: utf-8 -*- """ Interface to write points to VTK files Notes: - points are assumed to be in [x,y,z] coordinates as standard in ClearMap - reading of points not supported at the moment! """ #:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City #:license: GNU, see...
8043124d1d494817175e7d3b1664d34f80dbb3a3328f7908bdf94516f39db9d9
Python
6,716
196
from collections.abc import Callable from dataclasses import dataclass from functools import partial, update_wrapper from pathlib import Path from typing import Any import numpy as np import polars as pl import torch from PIL.Image import Image from eir.data_load.data_preparation_modules.input_preparation_wrappers im...
97924d854794ab9bd6c232d87d473a34693c3d121865ca043d7c4973a914ecb9
Python
6,716
139
import pandas as pd import numpy as np import os ## Read in data # cd ./reproduce/synleth/ # Define threshold and directory name THR = 0.90 DIR_NAME = "KR4SL_thr0{}".format(str(THR).replace('.', '').lstrip('0')) # Define input and output directories input_dir = f"./{DIR_NAME}/data/transductive/original/" output_dir...
0193c83d8131030b328b85879e0b2f67fb3e3abe67a42265c185492350005f88
Python
6,717
217
#!/usr/bin/env python """ These classes render the graph / image for the spot counter. Hazen 05/17 """ import numpy from PyQt5 import QtGui, QtWidgets class SpotWidget(QtWidgets.QWidget): """ Spot graph / display base class. """ def __init__(self, shutters_info = None, **kwds): super().__ini...
7f5c97b196b537d3d2655a082f78978d94de38d0ebd6cbead5dd1fb8590b60f3
Python
6,720
148
from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import torch import torch.nn as nn import torch.nn.functional a...
9ea265fcd1e3277209a1c7604d571e3ac6f6d87f63e63bedc3d4195ccf023d4d
Python
6,723
206
from __future__ import annotations from collections.abc import Iterator from pathlib import Path import pytest from PySide6.QtCore import QTimer from PySide6.QtWidgets import QApplication from PySide6.QtWidgets import QMessageBox from pytestqt.qtbot import QtBot from labelme._app import MainWindow from ..conftest i...
f064e9b56c93e05dcd70f5298d1f57a6a66b80cf2e5406108712e3de40a5068c
Python
6,723
192
"""Network initialization utilities.""" from typing import Any import torch import torch.nn as nn from mcmlnet.utils.logging import setup_logging logger = setup_logging(level="info", logger_name=__name__) def matmul_precision(precision: str) -> None: """ Set the precision for matrix multiplication based o...
2c45dfaa19f5e6b27f9ffca22c5492a1c5135876381f2fe9ebf22dbc09816bb2
Python
6,727
149
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from typing import Any import numpy as np from ultralytics.solutions.solutions import BaseSolution, SolutionAnnotator, SolutionResults from ultralytics.utils.plotting import colors class RegionCounter(BaseSoluti...
c9349e38a349e46550fefcfc13b6581a0c944b8a7f8d0a5fbcd6e58804d537da
Python
6,727
147
from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import torch import torch.nn as nn import torch.nn.functional a...
be9e7bc3e597a589ef7baacc5d39e9bac848a5102465b6c0ee013df2b31048e3
Python
6,728
172
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Generation of priors and enhanced-FOD from an example/template bundle. The bundle must have been cleaned thorougly before use. The E-FOD can then be used for bundle-specific tractography, but not for FOD metrics. -------------------------------------------------------...
bf049086a305a7bd1387afce3f832f2cd4b4336ca5fb1b43ae20ada216fe653b
Python
6,728
231
""" Various functions related to calculations with arbirary gradient waveforms. """ import numpy as np import numpy.typing as npt from ivim.constants import y def q_from_g(g: npt.NDArray[np.float64], dt: float) -> npt.NDArray[np.float64]: """ Calculate the dephasing vector for gradient waveform g. Argume...
323f8df06b51983c1032a0a1ca3a5b2ab9b8c34cccdc82c8925ec9288c4bc590
Python
6,729
169
#New: from __future__ import print_function, absolute_import import os.path as osp import glob import re from ..utils.data import BaseImageDataset class Market1501(BaseImageDataset): """ Market1501 Reference: Zheng et al. Scalable Person Re-identification: A Benchmark. ICCV 2015. URL: http://www...
81a2364d0fdedbf7351ec3055cdff11f0da0d5cf16b9afb3f0fad51e526f4ae7
Python
6,729
232
import distinctipy def is_valid_color(color): """Returns True is color is length 3 (r,g,b) with each element between 0 and 1.""" return len(color) == 3 and all([x >= 0 and x <= 1 for x in color]) def test_get_random_color(): """Assert all r,g,b components are between 0 and 1""" color = distincti...
1c81d26fd67996cab2cb4fb0869b2e15268b944a217c545f2eb8eb5dffa44398
Python
6,730
172
import os from typing import List, Tuple, Union import nibabel as nib import numpy as np from deepreg.dataset.loader.interface import FileLoader from deepreg.dataset.util import get_sorted_file_paths_in_dir_with_suffix from deepreg.registry import REGISTRY DATA_FILE_SUFFIX = ["nii.gz", "nii"] def load_nifti_file(f...
c13298fab0f1cfb683fbd43289402645c26228d2f0e9c0a4f2da9099c2c64895
Python
6,730
147
from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import torch import torch.nn as nn import torch.nn.functional a...
d17c36ba820c896757fcf5146a2b1c8f759f7ceb6e880c9ed5c64a79d9857408
Python
6,730
179
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """Watch a project for newly created tasks via a webhook: register the webhook pointing at this machine, receive the deliveries with a local HTTP server, and tally each 'create:task' event. The server signs every delivery with the webhook secret (HM...
71986a4b54cdf142858b3635472b3c79edd88cd8724f1d6c98213cbdf508a0fe
Python
6,733
168
import os import math import tqdm import numpy as np import pandas as pd import tensorflow as tf from collections import Counter from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.utils import Sequence class AccelerometerDataGenerator(Sequence): def __init__(self, subject_fi...
dbc8b9e763ed4567afacd5329d2fae419c6aa3d2949a5e18982e36ad770e556f
Python
6,733
193
import glob import numpy as np import staintools import pandas as pd from PIL import Image import tensorflow as tf from tensorflow import keras from tensorflow.keras.models import Model from tensorflow.keras.layers import Flatten, Dense, Dropout, GlobalAveragePooling2D from tensorflow.keras.applications.mobilenet impor...
2f92b5c41278338b4d68dbd44ee4376e1c28af0f98b6bd427c537c3f0d529f61
Python
6,734
219
import os import time import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from torchvision.transforms import v2 from torch.utils.tensorboard import SummaryWriter """ IMPORT CONFIG """ import V1_5_train_cfg # cfg appends working directory to sys.path, so...
57650df356e971f2aa8526c84d3fa6ddcb32b87a5fb85b0e068930b173bacd31
Python
6,735
179
""" 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...
6e6255e1ee4febf2e63833791afaa27fcd6ec1bcf366ace25ec9990e110c66cb
Python
6,735
148
from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import torch import torch.nn as nn import torch.nn.functional a...
71549beccb199122eff1253a6ae0e39a2cdbe788bfbb4959c6750f487cce4e9c
Python
6,736
152
#!/usr/bin/env python """ Provides the time base for a film. Hazen 04/17 """ from PyQt5 import QtCore import storm_control.sc_library.parameters as params import storm_control.hal4000.film.filmSettings as filmSettings import storm_control.hal4000.halLib.halFunctionality as halFunctionality import storm_control.hal4...
a60a9ce8ec63295593c760bffe6af9f6d34501c77af0d410eba7e0807b08b8a0
Python
6,736
167
import argparse import json import jax import jax.numpy as jnp from model import ( FullConfig, HyperParams, TrainingConfig, LoggingConfig, initialize_p, initialize_training_state, make_constant_gammas, closure_draw_cs_data_driven, train_natural_gradient_scan_over_epochs, linear_...
dc0e311793c8790ce9c1221e44255a83f71054d3517748d5904ac834c2fec155
Python
6,736
148
from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import torch import torch.nn as nn import torch.nn.functional a...
86e1c91c0327204b060dbf5c104d29c5b992799b44e17c1fca922b61ef9562a9
Python
6,738
147
from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import torch import torch.nn as nn import torch.nn.functional a...