sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
398fef64aedaf1361ed18dcbad923bf83e7427f3e8b4de6877c6054888f41456
Python
4,518
118
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """Export a project's tasks individually, without images, to local zips AND to a registered cloud storage. By default every task in the project is exported; pass --task-id to export only a specific subset. This is the SDK-only stand-in for what coul...
575554cfe3fdddfe28f03a7858ad84c34994a8d0d58e7407a8951a20e17aa30a
Python
4,518
133
# -*- coding: utf-8 -*- """ Analysis of experimental ocular dominance columns The purpose of the following script is to analysis ocular dominance columns and estimate their column width and column spacing. To do so, the power spectrum and the normalized autocorrelation (NAC) map are computed and evaluated along diffe...
6785c10add2482187cd1a64b425e81f8a29b97fa9d3792984898b5e525bddded
Python
4,518
115
import torch import yaml import torchvision.transforms as transforms import pandas as pd from data_loader import load_and_split_data, get_dataloaders from DLmodels import create_model, train_model, evaluate_model from sklearn.metrics import accuracy_score, f1_score, confusion_matrix, roc_auc_score from ML_models import...
b64c5de4e98a0d3fe2ff806c397ce5da48e2caae262e85968216c60f8ca30bec
Python
4,518
128
"""Apply machine learning metrics to causal models for evaluation.""" import warnings import numpy as np import pandas as pd from sklearn import metrics NUMERICAL_CLASSIFICATION_METRICS = { "accuracy": metrics.accuracy_score, "precision": metrics.precision_score, "recall": metrics.recall_score, "f1":...
77a2d4e65f4b40c9d65bcaebbca5afb48591ae1e2511828b0ab8e177ed379ad4
Python
4,519
151
from __future__ import annotations from collections.abc import Callable from pathlib import Path import pytest from PySide6 import QtCore from PySide6 import QtGui from PySide6 import QtWidgets from pytestqt.qtbot import QtBot from labelme._app import MainWindow from labelme._utils import apply_color_theme from .co...
65e88438869450f02fdbdadeb068c625f072369ded288dd382dc0c9bf17561bd
Python
4,520
137
import unittest from deepgo.models import DeepGOModel, DeepGOGATModel import torch as th class TestDeepGOModel(unittest.TestCase): @classmethod def setUpClass(self): self.batch_size = 4 self.input_length = 32 self.nb_gos = 32 self.nb_zero_gos = 32 self.nb_rels = 5 ...
0c2b2ad8206832b78dfdf57b66008720e9cf7358c0745fe93d3446a1245af0eb
Python
4,521
169
import os import subprocess import numpy as np import pandas as pd import abm as abm from output_paths import artifact_dir from bckground_distribution import ( get_interaction_matrix, get_significant_lr_pairs, pvalues_threshold, save, ) def _ensure_output_dir(path): os.makedirs(path, exist_ok=Tr...
c6023dbcc4e199ccc1cd6bbc21df1072d2d7dab50ecfafda27ba208a3cec8a80
Python
4,521
140
"""Abstract base class for pyment datasets.""" from __future__ import annotations import logging from abc import abstractmethod from typing import Any, Callable import numpy as np import pandas as pd import tensorflow as tf from numpy.typing import ArrayLike from sklearn.utils.class_weight import compute_class_weigh...
05007c19bbfc124d3caf9212c7407ec43fb42c71986cadfe08a57c370a577b9f
Python
4,524
154
# -*- coding: utf-8 -*- """ usage example: python MedSAM_Inference.py -i assets/img_demo.png -o ./ --box "[95,255,190,350]" """ # %% load environment import numpy as np import matplotlib.pyplot as plt import os join = os.path.join import torch from segment_anything import sam_model_registry from skimage import io, ...
ec96b8ae6e47922715ef51a7ede3ec42fa0e90f99032614ae92cc2f62a0774c5
Python
4,524
95
#encoding=utf-8 from __future__ import print_function import sys sys.path.append("../../") import jieba jieba.enable_parallel(4) def cuttest(test_sent): result = jieba.cut(test_sent, HMM=False) for word in result: print(word, "/", end=' ') print("") if __name__ == "__main__": cuttest("这是一个伸手不...
15217e96b3a478765529a847fa51ce22b0442f7b8fe90184c9d57931eb15ed48
Python
4,525
117
import matplotlib.pyplot as plt from matplotlib.patches import Rectangle, ConnectionPatch import figure_properties as fp import numpy as np seed = 11 c2_poi_fn = str(seed) + '_longer_100_poi_2Hz_7_Control.npz' l2_poi_fn = str(seed) + '_longer_100_poi_2Hz_20_Letm1.npz' #p2_poi_fn = str(seed) + '_PDP_slower_100_poi_2Hz_...
3ae7597747b52a1d92a60f7e5046cc632999c56f468d62d99f4b7cf456e41bd8
Python
4,525
95
#encoding=utf-8 from __future__ import print_function import sys sys.path.append("../../") import jieba jieba.enable_parallel(4) def cuttest(test_sent): result = jieba.cut_for_search(test_sent) for word in result: print(word, "/", end=' ') print("") if __name__ == "__main__": cuttest("这是一个伸手...
311eb8a730f31cc53d5598b3ca2d10e2f2a1cbd8f7bf8b509ddb375835837fe0
Python
4,526
168
# -*- coding: utf-8 -*- """ANA <-> ORIG registration The purpose of the following script is to compute the deformation field for the registration between antomy in conformed freesurfer space and native anatomical space. The transformation can be computed from the headers of source and target images. The script needs a...
374a202ab01bf9973f070608da2f77a9bcd32498ff9df7ef8a5067e7c83a70dc
Python
4,527
85
"""A module that contains core CoRelAy classes, such as :py:class:`~corelay.base.Param`.""" import typing from corelay.plugboard import Slot from corelay.utils import get_fully_qualified_name class Param(Slot): """A single parameter slot, which can be used to parameterize implementations of :py:class:`~corelay....
446891459e0c871fb3887f5cf36603e5aae2fd20243907da5c43127f83482041
Python
4,527
124
""" EventClassifier_numUnit @ 2022 Knowblesse Modified Version of EventClassifier. This script output accuracy when only a subset of units are used in the classification. - Description - .mat dataset must have two variable, X and y. (mind the case of the variable name) - using the sklearn SVC class, build and t...
4472e50154c988430cc41559c465ef113e2beeffbd3c8b5953d0bca6745c7408
Python
4,527
95
#encoding=utf-8 from __future__ import print_function import sys sys.path.append("../../") import jieba jieba.enable_parallel(4) def cuttest(test_sent): result = jieba.cut(test_sent,cut_all=True) for word in result: print(word, "/", end=' ') print("") if __name__ == "__main__": cuttest("这是一个...
7c47ab46ad9218644bc3e8e65bb3dbbf63485d621641d6551fea41841a47d639
Python
4,527
144
import os import json import numpy as np import nibabel as nib from scipy import ndimage def count_shells(dwi_json_path): ''' Count the number of shells in the DWI data ''' f = open(dwi_json_path) dw_head = json.load(f) shell_list = [] for enc in dw_head["keyval"]["dw_scheme"]: sh...
8ae1a7b8c7825b5aefdd8dd737e28ab625c48b90b2221c596a0ed812d7272221
Python
4,527
136
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 ...
c580cbcf4965318596b2db5ddbc56ccef9b7b3784650d2a408121b053e56b15d
Python
4,527
164
"""Example script for running inference on simulated MDyn_HMM_MVN data. - Multi-dynamic version for dynemo_hmm-mvn.py - Should achieve a dice of ~0.99 for alpha and ~0.99 for beta. """ print("Setting up") import os import numpy as np from osl_dynamics import data, simulation from osl_dynamics.inference import metrics...
f152be057229d63a4917bb98de0e16d204c845f2dcd18c053b547aa3e9b5a512
Python
4,527
149
import src.contour as con import nibabel as nib import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib.animation as animation import cv2 import gc from pylab import * import src.finElFit as fe def ani_frame(dataset,filename): #creates mp4 file of dataset formated like the e...
ddf70b9f2595f38801753fc40305db4d32b491f3fadc6ceccc5fff6ce00f37b9
Python
4,528
134
import numpy as np import itertools def get_phase(rdm, phase): assert phase in ["pre", "gray", "post", "pre-post", "pre-gray", "post-gray", "all"] if phase == "pre": res = rdm[:33, :33] elif phase == "post": res = rdm[33:66, 33:66] elif phase == "gray": res = rdm[66:, 66:] e...
ab40af7ec6eed17629c8b1d11abfda12fc29d0008ca1b9430ce024e9035626fd
Python
4,530
123
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Computes the endpoints maps of a bundle (head and tail). The endpoints maps are a count of the number of streamlines that start or end in each voxel. Note: If the streamlines are not ordered, the head/tail are random and not really two coherent groups. - To get a ...
37dfe542eccab07889ba42861f54f6f23d80c0ad86965c085395d960eed7fa14
Python
4,531
74
#!/usr/bin/env python3 # scripts/export_fold_stats.py import sys from pathlib import Path import numpy as np import pandas as pd # ────────────────────────────────────────────────────────────────────────────── # 1. 将项目根目录加入模块搜索路径(假设本文件在 PROJECT_ROOT/scripts/ 下) # ─────────────────────────────────────────────────────...
d03bba1447919908b0feaa730b33ba3b1755f446db441f2bd8ef190ef96a16ee
Python
4,533
156
# -*- coding: utf-8 -*- """ Plots for autocorrelation analysis (simulation) The purpose of the following script is to generate exemplary plots for the autocorrelation analysis of ODC data (averaged over 1000 iterations). The following plots are produced: 1. phi vs. fwhm 2. phi vs. k_fft 3. phi vs. P_fft ...
402b9510c50784657f1e2d727c9dfffb3da08f97f60e321570dd48f66d522198
Python
4,534
127
import os import logging import numpy as np import mne import xml.etree.ElementTree as ET def load_eeg_data(base_path): """ Load EEG data (EDF files), sleep stage labels, and artifact indicators from a structured directory. The function reads EEG recordings in EDF format along with their corresponding sl...
5f533ea78726b202f8c7eb1298e5071d3128ef21ae1b1e7097f24c09badd9819
Python
4,534
147
# Copyright (C) 2020-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from datumaro.components.errors import AnnotationExportError from datumaro.components.project import Environment from cvat.apps.dataset_manager.bindings import CvatExportError from cvat.apps.engine.models i...
78fe5fa307dda35f15b3a413550236887af1447a61beefd9990e565be545e819
Python
4,535
143
# -*- coding: utf-8 -*- # external inputs import numpy as np from scipy.signal import find_peaks # local inputs from ..utils import get_fft def analyze_fft(arr, fovx, fovy, xv, yv, f_cut=0.05, p_min=None, p_max=None, nsample=1000): """Analyze FFT. This function computes the peak frequen...
bff8f891723cfcdbd6c3dfc51363f9ebc703bf7f7d5802f567df49b63f9fdc8c
Python
4,535
156
from __future__ import annotations import base64 import io import json import subprocess import sys from pathlib import Path from typing import Final import numpy as np import PIL.Image import pytest _REPO_ROOT: Final = Path(__file__).resolve().parents[3] def _write_annotation(directory: Path, /) -> None: img ...
b2aee6db789bca9268fb6c8ef164d8d32c266aaa49b75540397c0188f441285e
Python
4,538
146
#!/usr/bin/python # # Active X based Coherent CUBE 405 laser control. # # Hazen 8/09 # from PyQt5 import QtCore, QtGui, QAxContainer import sys import time class Cube405(QAxContainer.QAxWidget): def __init__(self, parent = None): QAxContainer.QAxWidget.__init__(self, parent) se...
4777ca21fc154f4fdeab61acbdfc7a8718aba2f48fdba66bfe467f9b1f99f143
Python
4,539
112
import pandas as pd import torch as th import numpy as np import dgl import os def get_data(df, features_dict, terms_dict, features_length, features_column): """ Converts dataframe file with protein information and returns PyTorch tensors """ data = th.zeros((len(df), features_length), dtype=th.fl...
c021947d8c28d46248214dce104d5dcc10d410a2ba571f76c7484b86ee2c05cf
Python
4,539
123
from __future__ import annotations import argparse import json import subprocess from pathlib import Path import pytest # Skip when the optional 'academy' extra is absent. pytest.importorskip("academy") from chemgraph.academy.runtime import dashboard_launcher from chemgraph.academy.runtime.profiles.system import Sy...
8b5627f6e130694d56644f2e66345253dcbe198d77c0fbe71c6dce1dacb43dfd
Python
4,540
109
#!/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=['plot.zip']) tmp_dir = tempfile.Tempora...
8ccf04d9ca2019105e295e7fbb11855ca64413905152a70f73c9cf79603eac8c
Python
4,541
94
#!/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 fetch_data(get_testing_files_dict(), keys=['btensor_testdata.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ...
ace99532de25cfbbe30f201796dad76a8ff6547f34919f1b1f792b76e05bd36c
Python
4,541
93
#@String(value="<HTML>This script runs Convex Hull Analysis on an entire directory of reconstruction files.<br>Processing log is shown in Console.", visibility="MESSAGE") msg #@File(label="Input directory:", style="directory", description="Input folder containing reconstruction files (.traces, .swc, json) to be analyze...
c29f02a563a55213ce4248e66286bd206fdcd68305a35bf70f7520fc32c68714
Python
4,542
128
from pathlib import Path from unittest.mock import patch, Mock import pytest from stack_corr.definitions import StackCorrConfig, InferParams, STACK_CORR_CONFIG from stack_corr.stack_corr import load_model class TestStackCorrConfig: """Test the StackCorrConfig dataclass.""" def test_default_config(self): ...
dda09b23a6d9ccd0ebedd67643b5a62473d6a2e362a927a2383c76126286ed06
Python
4,543
111
from typing import Optional from torch import Tensor from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.conv.gcn_conv import gcn_norm from torch_geometric.nn.dense.linear import Linear from torch_geometric.typing import Adj, OptTensor, SparseTensor from torch_geometric.utils import spmm clas...
8915a0ad4568027e360e954f1348d97252c1e8eb54380aca979767e775a609ce
Python
4,545
114
import logging from typing import List, Optional, Union import torch from torch import Tensor from torch_geometric.explain import Explanation from torch_geometric.explain.algorithm import ExplainerAlgorithm from torch_geometric.explain.config import ExplanationType, ModelTaskLevel from torch_geometric.nn.conv.message...
4f9f9330dc9ff33452e5692f0d2d678cf2ed2655a71009ca008f13f6305c18d6
Python
4,546
125
import pandas as pd from scipy.stats import mannwhitneyu, chi2_contingency def excel_column_letter_to_index(letter): letter = letter.upper() index = 0 for char in letter: index = index * 26 + (ord(char) - ord('A')) + 1 return index - 1 def load_data_from_excel(file_path, ages_col1, ages_col2,...
bca21fed2905850565057d4d55fbd2bc9cea6e3a47074812235bf8028ba658f9
Python
4,546
181
# -*- coding: utf-8 -*- # external inputs import numpy as np from gbb.neighbor import nn_2d # internal inputs from ..io.affine import vox2ras_tkr from ..utils.apply_affine_chunked import apply_affine_chunked __all__ = ['label_border', 'label_dilation', 'label_erosion', 'roi_fov', 'roi_sphere'] def label_border(arr...
a694137f828af1ba5eca57a28f8d8c59c5932b5361bd86b33a241c3cd0013c32
Python
4,548
155
'''RegNet in PyTorch. Paper: "Designing Network Design Spaces". Reference: https://github.com/keras-team/keras-applications/blob/master/keras_applications/efficientnet.py ''' import torch import torch.nn as nn import torch.nn.functional as F class SE(nn.Module): '''Squeeze-and-Excitation block.''' def __in...
cf409dfec24561451e3c3b616164303ed3057d797f8b2b4228112a3239f7c937
Python
4,548
130
# Copyright (c) OpenMMLab. All rights reserved. """Modified from https://github.com/open- mmlab/mmdetection/blob/master/tools/analysis_tools/analyze_logs.py.""" import argparse import json from collections import defaultdict import matplotlib.pyplot as plt import seaborn as sns def plot_curve(log_dicts, args): i...
f908b3fd18c3e41067cf937d5b5a66b4534a5090deda549ea0de553788b56a23
Python
4,548
119
from collections.abc import Mapping from functools import reduce from bx.misc.binary_file import ( BinaryFileReader, BinaryFileWriter, ) def cdbhash(s): return reduce(lambda h, c: (((h << 5) + h) ^ ord(c)) & 0xFFFFFFFF, s, 5381) class FileCDBDict(Mapping): """ For accessing a CDB structure on d...
3e55da077e45a39e1b0df88ec09b4da1151c8203709b50e4ad8b2cd614cb979b
Python
4,549
144
# -*- coding: utf-8 -*- # @Author : LG import os from xml.etree import ElementTree as ET import tqdm from ISAT.formats.isat import ISAT class VOCDetect(ISAT): """ VOC format for object detection Attributes: keep_crowd (bool): keep the crowded objects """ def __init__(self): s...
423ba3e6abcca23198d8168e106056cbe06d33d270668d316394d9bd3c9baedf
Python
4,549
122
#!/usr/bin/env python3 import os import math import tensorflow as tf import pandas as pd import keras from keras import layers from tensorflow import data as tf_data import random import numpy as np import autoAnalysis from sklearn.preprocessing import StandardScaler from sklearn.metrics import classification_report, ...
4861d85d79fd2d2948dee622692e80c70267ed2407dbf7ed302f5d9d95010474
Python
4,549
140
#!/usr/bin/python3 # import os import sys import argparse from sklearn.neighbors import NearestNeighbors from uac import utils # Create the parser my_parser = argparse.ArgumentParser(description="Calculation of old atrial coordinates") # Add the arguments my_parser.add_argument("target_path", metavar="path", type=st...
edd7c7e9a939c3d2d4dbae36e79894be5c2d77fbbdb1ab7726754c2c31fd0449
Python
4,550
146
#!/usr/bin/env python # # collect.py renames files from subdirectories # # Copyright F. Nedelec, 2007--2021 """ Synopsis: Rename files or folders following a pattern containing an integer index, as in 'image0001.png'. The file will be moved in the current directory The number in the file name is...
1db6c3d8b02d8459628f9557a478ad461213fa63281678e60c483c14ebe8d6fa
Python
4,551
123
#!/usr/bin/env python """ Voltage controlled Z stage functionality. Hazen 05/17 George 02/18 - Abstracted from mclVoltageZModule.py """ from PyQt5 import QtCore import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.daqModule as daqModule import storm_control.sc_h...
763cee033533594baa7506b8d8cce33ef8be17aa4bf3ea6c4f33ab152b650dff
Python
4,552
132
import ttach as tta import multiprocessing.pool as mpp import multiprocessing as mp import time from train_supervision import * import argparse from pathlib import Path import cv2 import numpy as np import torch from torch import nn from torch.utils.data import DataLoader from tqdm import tqdm def seed_everything(se...
542f1a9459b768dc2a64ca02c272046a1454704f35055116899f748b9350aea6
Python
4,553
124
from k_means_constrained import KMeansConstrained import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import h5py import shapely def get_clusters(X,NperPatch=100,frac_range=[0.8,1.2]): n_clusters = int(len(X) / NperPatch) minsize = NperPatch*frac_range[0] maxsize = NperPatch*frac_r...
02d6d82843157aa1689ea5caabe6b783fa74e708a6ac139871e04127cd66ddb8
Python
4,555
141
from pathlib import Path import pytest from magicgui.widgets import Image _mpl_image = pytest.importorskip("magicgui._mpl_image") np = pytest.importorskip("numpy") pilImage = pytest.importorskip("PIL.Image") def test_image_widget(): # png works image = Image(value=Path(__file__).parent / "_test.png") a...
5a0f670fe1d28047195c30aaab8f2ba156684222cd113906c791498213e38e94
Python
4,555
107
#!/usr/bin/env python """Warp HArtMuT artefact sources into an individual head. Python port of the HArtMuT individualwarp routine (project_points.jl, https://github.com/harmening/HArtMuT/tree/main/individualwarp). The original uses Julia + VTK ray casting. This version uses trimesh, which PCAwarp already depends on, s...
67cb6fedfd638b79c92add80d55deeb357478022e0557386d07da3e5146ddd98
Python
4,555
158
#!/usr/bin/python # ## @file # # Communicates with the Newport SMC100 motor controller. # # Hazen 2/11 # import time import storm_control.sc_hardware.serial.RS232 as RS232 ## SMC100 # # Encapsulates control of Newport SMC100 motor controller using RS-232. # class SMC100(RS232.RS232): ## __ini...
b548bfce459a39865532ed389ec588a18909e31a542f8cec134c1079b330afd1
Python
4,555
119
# This file is part of Mooney computational modeling project. # # Mooney computational modeling project 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 # (at your option) an...
f74cbf2873887e6b2b1064bd22c7a0475b329bf006f8bc31f1a4138edee3b8ef
Python
4,555
126
###################################################################### # Copyright (C) 2020-2026 MEmilio # # Authors: # # 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 compliance with the License. # You may obtain...
b29026e3b59d59451f0686d037d75d21a8ac5dad4d944724ca491bbe0adbf585
Python
4,556
156
# -*- coding: utf-8 -*- import logging import numpy as np def create_acqparams(readout, encoding_direction, synb0=False, nb_b0s=1, nb_rev_b0s=1): """ Create acqparams for Topup and Eddy Parameters ---------- readout: float Readout time encoding_direction: string...
ab9438c2d672f9967f0cf5626da56507f4139f578253e44b014952b14b2dab6a
Python
4,558
154
""" Train and compare DLIM (Deep Latent Interaction Model) models on *simulated data* for different data types (cascade, bio, tgaus). This script: 1. Generates simulated data using the specified model type. 2. Trains multiple DLIM models (with and without spectral regularization). 3. Collects learned embeddings from ...
b86a4258985f9f51563e734ca2f27d0f0cf9316aa4b1b8b672ed4a7d3247c409
Python
4,558
133
import json from pathlib import Path from argparse import ArgumentParser import numpy as np import xarray as xr from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly import brainscore_core.supported_data_standards.brainio.packaging as _brainio_pkg from brainscore_core.supported_data_...
70a03042a79f72e00477d6be4d2a324710812e93828f93961a03097edd95bd95
Python
4,559
125
from __future__ import annotations from collections.abc import Callable from typing import TYPE_CHECKING from magicgui.types import Undefined, _Undefined from ._mixins import _OrientationMixin from ._ranged_widget import MultiValueRangedWidget, RangedWidget, T if TYPE_CHECKING: from typing_extensions import Unp...
87472fa1341c697e1f4445daa735cd628b9552c9fdc8962450001346c2ace256
Python
4,559
116
import os import h5py import numpy as np import pandas as pd import scipy.misc import scipy.misc import scipy.misc import xarray as xr from result_caching import store from tqdm import tqdm from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly from brainscore_core.supported_data_standar...
bc399401230a7c9ddffcc9cea360c551e96b01b5a940cfe9bfbab9c4ecdbbfd5
Python
4,560
143
import math from dataclasses import dataclass from typing import TYPE_CHECKING, Literal from torch import Tensor, nn from eir.models.input.array.models_locally_connected import FlattenFunc from eir.models.input.sequence.transformer_models import ( get_positional_representation_class, parse_dim_feedforward, ) ...
2c42983fa406f7beaf53e10a0a5adba6e82d28d87f7bda175704641ca589d859
Python
4,561
134
import ttach as tta import multiprocessing.pool as mpp import multiprocessing as mp import time from train_supervision import * import argparse from pathlib import Path import cv2 import numpy as np import torch from torch import nn from torch.utils.data import DataLoader from tqdm import tqdm def seed_everything(se...
7cd8edc3b144ca5fe84e42f522574ee474eeb38030bdbbfd123729a2bfcee714
Python
4,561
140
import torch from torch import nn import torch_geometric.nn as gnn from sklearn.metrics import average_precision_score, roc_auc_score class GNNEncoder(nn.Module): def __init__(self, n_input, n_hidden, n_heads, n_batch=0): super().__init__() self.n_batch = n_batch # n_batch= -1: no batch norm, 0: ...
2fad2d217f7be2013228d3586c170be06b70fa9b382642e9f781480536ed9bec
Python
4,562
162
from __future__ import annotations from pathlib import Path import pytest from PySide6.QtCore import QMimeData from PySide6.QtCore import QPoint from PySide6.QtCore import QPointF from PySide6.QtCore import Qt from PySide6.QtCore import QUrl from PySide6.QtGui import QDragEnterEvent from PySide6.QtGui import QDropEve...
0c9795336fc83f5f67e774790808c06e63541b13719125e18803c54ffd538613
Python
4,563
91
import numpy as np from brainscore_core import Score from brainscore_vision import load_metric, load_ceiling, load_dataset from brainscore_vision.benchmarks import BenchmarkBase from brainscore_vision.benchmark_helpers.neural_common import NeuralBenchmark, average_repetition VISUAL_DEGREES = 11.2 NUMBER_OF_TRIALS = 1...
8f867a5d16560d93f5a6788d284504b4649b35c1a143e295e05cc595d8a18d75
Python
4,565
113
from src.wrappers.OsipiBase import OsipiBase import warnings import numpy as np import matlab.engine class OJ_GU_bayesMATLAB(OsipiBase): """ Bi-exponential fitting algorithm by Oscar Jalnefjord, University of Gothenburg """ # I'm thinking that we define default attributes for each submission like thi...
b05cf134f3ac878d77e3e0c6f228b5a9111cdd2c1f13b31f0fce6fefdc02dd33
Python
4,565
134
"""interp_wrapper """ import numpy as np from scipy.ndimage import map_coordinates from nsdcode.utils import isnotfinite __all__ = ["interp_wrapper"] def interp_wrapper(vol, coords, interptype='cubic'): """ interp_wrapper(vol, coords, interptype) <vol> is a 3D matrix (can be complex-valued) <coor...
d258720c9779c40f08cc84c943d807de978932969234ee4a0384a2ecc210d839
Python
4,565
155
""" A DeepReg Demo for classical nonrigid iterative pairwise registration algorithms """ import argparse import os import shutil import h5py import tensorflow as tf import deepreg.model.layer as layer import deepreg.util as util from deepreg.registry import REGISTRY # parser is used to simplify testing # please run ...
e709907aeacfcc4c62935ad5982d8013dcc094802afc33266d1e2fcbeab8818d
Python
4,566
137
import pathlib import re from typing import Union, List, Dict, Optional, Tuple from napari_dmc_brainmap.utils.params_utils import load_params def split_strings_layers(s: str, atlas_name: str, return_str: bool = False) -> Tuple[str, Union[str, int]]: """ Split a string into its head and tail components based ...
f6a53c6c64dd3bcdf1ffe78abed6af9a666dc03575bf1d92aae07b81cb9c0fa0
Python
4,566
162
import numpy as np from scipy.constants import epsilon_0 as e0 import impedancefitter as ifit from impedancefitter.single_shell import eps_cell_single_shell from impedancefitter.suspensionmodels import bh_eps_model, bhcubic_eps_model, eps_sus_MW em = 6.5 Rc = 3.8e-6 / 2.0 dm = 5e-9 km = 0.0 kcp = 0.25 ecp = 50 kmed =...
870961c930e889ae3e24078c905eea1b45a680a164dc974a1bd3d50e11814347
Python
4,568
90
from brainvoice.visualization import plot_spectrogram_on_axis, save_borderless, gen_spectrogram_cmap from brainvoice.spectrogram_utils import inv_linear_spectrogram, get_better_synth_hparams from brainvoice.waveform_utils import apply_raised_cosine_window, rms_normalize_audio from brainvoice.models.utils import load_mo...
d4668b610ec191a51579aaf56d7cf78eaf5091647dc4cc34eb7b7dfb9b6afd03
Python
4,568
129
# Keywords and parameters obtained from https://wiki.fysik.dtu.dk/ase/_modules/ase/calculators/orca.html#ORCA # Orca parameters for CompChemAgent from typing import Optional from pydantic import BaseModel, Field from ase.calculators.orca import ORCA, OrcaProfile import warnings import os import shutil class OrcaCalc...
7cf7663c6f82a5afeb81afc1b2cd4f0842e6a37091da1df808817d09757d3f6b
Python
4,570
135
import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from typing import Optional, List, Union def soft_erode(img: Tensor) -> Tensor: """ approximates morphological operations through max_pooling for 2D and 3D """ if len(img.shape) == 4: p1 = -F.max_pool2d(-img, (3...
f9e14c608c9c3c0d46255b32837cb9aa22a2408380acd82642839af7e4962319
Python
4,571
148
"""Unit tests for the segmentation metrics in histo_miner.evaluations. Values here are hand-computed. get_fast_pq requires contiguous instance ids (1..N), which every fixture below respects. """ import numpy as np import pytest from histo_miner.evaluations import get_fast_pq, remap_label # --------------------------...
c9c20c80751a20f6ee29135c28484d74bc6b886c32647ff6766ea85ba6517710
Python
4,573
141
# 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, sof...
3b67623e1e09d44a159825e776331a348d58aa383638f633be02f7fe4c99f29d
Python
4,574
121
from numpy.typing import NDArray from tqdm import tqdm import h5py import numpy as np import os class CentroidLabel: """ A class to generate centroid labels for datasets. Args: dataset_path (str): Path to the dataset directory. """ def __init__(self, dataset_path: str): self.dataset_path...
3c27d24d618473cd4dafa70703941419ef1ee2155ad819bc2c8e83e942003223
Python
4,574
148
# 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 numpy as np logger = logging.getLogger(__name__) # pylint: disable=invalid-name class ...
434244cb141934128b5e417d59cd0a2e4c6ada7e325f8e7db31b0511898bb5b0
Python
4,574
143
from pathlib import Path from typing import Callable, Optional import dolfin as df import nibabel import numpy as np import pyvista as pv import scipy import simple_mri as sm from dolfin import inner from panta_rhei import FenicsStorage from gmri2fem.utils import apply_affine, nan_filter_gaussian from i2m.vtk2mri imp...
17d007ef3a6fc31619c6a59b031a627b4efb344fe44d50a28f781d7d0f695631
Python
4,575
125
from ..qt import * from .. import thalamus_pb2 import json import asyncio import logging LOGGER = logging.getLogger(__name__) class OculomaticWidget(QWidget): def __init__(self, config, stub): super().__init__() self.config = config self.stub = stub if 'Computing' not in config: config['Comp...
709804b3d483b94b6e4e28d53d68b5bb7a87c2526d0e5bc863cbeb94ebe5b2a3
Python
4,575
140
import os import sys sys.path.append('.') import click as ck import numpy as np import pandas as pd from collections import Counter, deque from deepgo.utils import ( Ontology, FUNC_DICT, NAMESPACES, MOLECULAR_FUNCTION, BIOLOGICAL_PROCESS, CELLULAR_COMPONENT, HAS_FUNCTION) @ck.command() @ck.option( '--go-...
ddc8f22c50b1afa085735efc8754b8d65fa12bb216a2ac0ca16c65d346b9c077
Python
4,577
142
# The ImpedanceFitter is a package to fit impedance spectra to # equivalent-circuit models using open-source software. # # Copyright (C) 2023 Julius Zimmermann, # julius.zimmermann[AT]uni-rostock.de # # This program is free software: you can redistribute it and/or modify # ...
584869ff6542954a82c53484199d10488e51cf1d2f9962c910a23bba639a16f1
Python
4,579
146
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 17 14:30:31 2022 @author: moritz """ import os import sys import h5py import pytz import numpy as np from datetime import datetime import matplotlib.pyplot as plt from scipy.constants import speed_of_light # Get time zone object for time calculatio...
0679d1d24cee7ef632f6e57d3370713257293584750435bd3daaf914feab5561
Python
4,580
121
from argparse import ArgumentParser import numpy as np import time import torch import torch.nn as nn from torch.utils.data import DataLoader, Dataset from model import SATAR from tqdm import tqdm import json class MyDataset(Dataset): def __init__(self, data, padding_value, max_tweet_count=128, m...
36ebc36fc554e6a6eccb4dbd36c188e5c2bc0655fdecc2dc437e2ee1dbfa13c2
Python
4,580
128
import unittest import logging import numpy as np import pandas as pd import scipy.stats as stats import diffxpy.api as de class _TestSingleSfNull: def _test_null_distribution_wald( self, n_cells: int, n_genes: int, noise_model: str ): """ Test...
3e0e6142dd9e6df0a197005391802b875cfbc17d954e37eb02664e4d7b5586d2
Python
4,580
90
import os import subprocess import nibabel as nib import numpy as np from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory from traits.api import Bool, Int, Str class MirrorMaskInputSpec(BaseInterfaceInputSpec): in_file = File(mandatory=True, desc='Input mask file t...
72ce8793f1f19d27fba8be54837df20c8b0ff8d13b3f0d9180dea1568f59d2f6
Python
4,580
135
import logging from typing import List, Tuple import pandas as pd import scikit_posthocs as sp import statsmodels.api as sm from statsmodels.formula.api import ols from statsmodels.sandbox.stats.multicomp import multipletests def calculate_contrast( results_df: pd.DataFrame, condition_col: str, values_co...
9c9cb45b6c4db94913ce707498e0c53301a53c4a91a3e457043782911e87df90
Python
4,580
144
import torch.nn from utils.dataset import ijgiDataset as Dataset from models.sequenceencoder import LSTMSequentialEncoder from utils.logger import Logger, Printer, VisdomLogger import argparse from utils.snapshot import save, resume import os def parse_args(): parser = argparse.ArgumentParser() parser.add_argu...
498fd032f6b237266fb130ece182aae61864f3f3e508763d74ecef51aa5e7c91
Python
4,581
111
from src.wrappers.OsipiBase import OsipiBase import warnings import numpy as np import matlab.engine class ASD_MemorialSloanKettering_QAMPER_IVIM(OsipiBase): """ Bi-exponential fitting algorithm by Eve LoCastro and Amita Shukla-Dave, Memorial Sloan Kettering """ # I'm thinking that we define default ...
ecac1bd0e8b40aa742d34c90384f82f1ecadc58cd398505ec36d5181dbfee061
Python
4,582
110
""" 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...
f8ae4d8e37ef8ca60a250de45e03480d1ee5c0c27f186212238e5be7420632f6
Python
4,582
136
from typing import Optional, Tuple import torch from torch import Tensor from torch_geometric.experimental import ( disable_dynamic_shapes, is_experimental_mode_enabled, ) from torch_geometric.utils import cumsum, scatter @disable_dynamic_shapes(required_args=['batch_size', 'max_num_nodes']) def to_dense_ba...
00396f719421783148c959244582a56499964943b6a44fc94bb5c80c9e404269
Python
4,583
101
import functools import dill from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from robustness.model_utils import DummyModel from robustness.attacker import AttackerModel from robustness.datasets import D...
ae9a7fa26f7c41ddce0d1b90519a87b37a6d9ef99585d39e7ed3f37eb1e2957d
Python
4,583
134
from yacs.config import CfgNode as CN # ----------------------------------------------------------------------------- # Training config definition # ----------------------------------------------------------------------------- _C = CN() # ----------------------------------------------------------------------------- #...
bdd2dc302d07afe4dd8e0a6b93b81369e4410bf16f0dde637c198636021a130b
Python
4,583
111
import os from importlib import import_module from pathlib import Path cell_graph_config = { "cell_f_list": [ 'fourier', 15, True, [ 'area', 'r_equiv', 'r_maj', 'r_min', 'angel', 'ecc', 'maj_x', 'maj_y', 'min_x'...
cb29181e2f4d0d533c7030cd29346dde2417a556d447316c8291533d4df25ab8
Python
4,583
154
#!/usr/bin/python # ## @file # # Gooch and Housego AOTF control. # # Hazen 02/14 # import storm_control.sc_hardware.serial.RS232 as RS232 import time ## AOTF # # Class for controlling a Gooch and Housego AOTF using RS-232 communication. # class AOTF(RS232.RS232): ## __init__ # # Create the control objec...
0a6ec7480329361a89d5a1b97525860405e3ff147446399612b7e339852329e0
Python
4,584
100
import numpy as np from rsatoolbox.util.searchlight import get_volume_searchlight from rsatoolbox.data.dataset import Dataset from nilearn.image import load_img from nilearn.masking import compute_brain_mask from rsatoolbox.rdm.calc import calc_rdm from rsatoolbox.rdm import RDMs import pickle from rich.progress import...
d6b944768cbcc5565d7a7a79e3f95fec2e432fc51be53d4556fbe440a0954ab5
Python
4,585
119
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set, load_ceiling from brainscore_core.supported_data_standards.brainio.s3 import load_stimulus_set_from_s3, load_assembly_from_s3 from brains...
2ce2334489f3b3ab7e1ae071c44ba3eadb365d8b33ab94d5374576ebee6544a9
Python
4,586
75
from torch.utils.data import SubsetRandomSampler from slide.slide_helper import * from slide.data_loader import * from utils.detection_helper import create_anchors from object_detection_fastai.loss.RetinaNetFocalLoss import RetinaNetFocalLoss from object_detection_fastai.models.RetinaNet import RetinaNet from utils.cal...
5d0dbdab84e6f21a4e762f0d9e031e540ab3753160fc101a4e2310f33951cc1b
Python
4,586
157
import torch import torch.nn as nn from eir.models.tensor_broker.tensor_broker import ( CachedTensor, attach_tensor_broker_module_injection, ) class SimpleFusionModule(nn.Module): def forward(self, x: torch.Tensor, cached: torch.Tensor) -> torch.Tensor: return x + cached def test_cache_dropout_...
c428f9899db7bc472881056c29ce380f1b521431cbf3ef3ef30c33244f60f569
Python
4,588
121
import pytest import numpy as np import SimpleITK as sitk import torch from fireants.io.image import BatchedImages, Image from fireants.io.imagemask import apply_mask_to_image, generate_image_mask_allones from fireants.registration.greedy import GreedyRegistration import logging logger = logging.getLogger(__name__) l...
2966dcc63a7106645058ea397e167ff907294b841204f8fcbd2d91ed09b8ec80
Python
4,590
123
import re import os import pandas as pd import numpy as np class TaxaLevel: def __init__(self, taxa_dir:str): self.names = None self.nodes = None self.taxa_dir = taxa_dir def parse_files(self): """ Parses the files in the given directory and places the names a...
72fac15b4ef227d93debb606aad664515b0ef79a33369e3eb824b9ee2e4b0dcf
Python
4,590
158
""" Reading and writing delimited data files (with headers and comments). """ from itertools import count FIRST_LINE_IS_HEADER = object() class ParseError(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args) self.linenum = kwargs.get("linenum", None) def __str__(...