sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e842abe5a02bbf1328403dfb9344a1d5ae535a29b529212b2ac7c53fbfa288e1 | Python | 542 | 26 | # -*- coding: utf-8 -*-
#
# test_identifiers.py
import unittest
import arbor as arb
"""
all tests for identifiers, indexes, kinds
"""
class TestCellMembers(unittest.TestCase):
def test_gid_index_ctor_cell_member(self):
cm = arb.cell_member(17, 42)
self.assertEqual(cm.gid, 17)
self.asse... |
1ef34ab9d03216a552b30448aa0558248fe4e516142f10fa65c283863633827e | Python | 543 | 19 | import unittest
from ogo.calib.internal_calibration import InternalCalibration
class Test_InternalCalibration(unittest.TestCase):
def setUp(self) -> None:
""" Use this method to prep data or files for other tests, if necessary. """
pass
def tearDown(self) -> None:
""" Use this metho... |
3450e68af08a0adbd507ef4d0426c4568f42837ae58c0a11387607fd91138f12 | Python | 543 | 19 | import unittest
from ogo.calib.mindways_calibration import MindwaysCalibration
class Test_MindwaysCalibration(unittest.TestCase):
def setUp(self) -> None:
""" Use this method to prep data or files for other tests, if necessary. """
pass
def tearDown(self) -> None:
""" Use this metho... |
527b3fedf06bc6b33405bbd3fac4396cc6bc0929460f75c1db5b97d1335b9da2 | Python | 543 | 19 | import unittest
from ogo.calib.standard_calibration import StandardCalibration
class Test_StandardCalibration(unittest.TestCase):
def setUp(self) -> None:
""" Use this method to prep data or files for other tests, if necessary. """
pass
def tearDown(self) -> None:
""" Use this metho... |
6f69e405f1ab243aac250ee858b5cebb7a73524058c1433123707b45e9bfc3a5 | Python | 543 | 18 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="pyvisascope",
version="0.0.1",
author="Julius Zimmermann",
author_email="julius.zimmermann@uni-rostock.de",
description="PyVISAScope provides an interface to different scopes.",
long_d... |
2f270802c6ad5345c137be39abc077aab7e3da7bb09c99083eb206b2180aa665 | Python | 544 | 22 | '''Test the ogo command line interface exists'''
import unittest
import subprocess
class TestCLIExists(unittest.TestCase):
'''Test the ogo command line interface exists'''
def test_can_call_ogo(self):
'''Can call `ogo`'''
command = ['ogo']
self.assertTrue(subprocess.check_output(comm... |
47be62e2a1fadd9e06339f52d1c6ff34145a8e3c37adaf6efc706c611748be9a | Python | 544 | 15 | def format_nums_to_string(numbers_list):
"""
Format a list of numbers into a string, for display purposes.
Every element is separated with a comma, except for the last one.
:param numbers_list: List with numbers.
:type numbers_list: list
:return: String with the list's elements separated by a ... |
516cd5c0254f2680a7be0a6f31ced09848a70e84e249b1bfdf937665fa85d493 | Python | 544 | 21 | #!/usr/bin/env python3
"""
=============================================================================
Austin Dibble
University of Glasgow
2026
NeuroFM: Foundation model for individualized brain health estimation from T1w MRI.
Basic usage:
from neurofm import NeuroFM
model = NeuroFM(variant="neurofm-s", de... |
6038720c333d0ca4fe5fdbb09200224ccafbbe6f9c85fbe20f8a904df3f8c125 | Python | 544 | 25 | """
T="/Users/james/cache/hg18/align/multiz28way/chr10.maf"
def test():
s = os.stat( T ).st_size
real_f = open( T )
f = filecache.FileCache( real_f, s )
for i in range( 1000 ):
f.readline()
def test_random_seeking():
s = os.stat( T ).st_size
raw = open( T )
f = filecache.FileCache(... |
9361fb2e31b3a902de3e61685280e1685d5cdc402d8f79e38e65be725d6ce12c | Python | 544 | 18 | import torch
import torch.nn as nn
def euclidean_dist(x, y):
"""
Args:
x: pytorch Variable, with shape [m, d]
y: pytorch Variable, with shape [n, d]
Returns:
dist: pytorch Variable, with shape [m, n]
"""
m, n = x.size(0), y.size(0)
xx = torch.pow(x, 2).sum(1, keepd... |
ceb6443be1e45607a6ace18ba8c52627fdec7820c005465aa4ce5cf521861618 | Python | 544 | 5 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
model_registry['effnetb1_cutmixpatch_SAM_robust32_avge6e8e9e10_manylayers_324x288'] = lambda: ModelCommitment(identifier='effnetb1_cutmixpatch_SAM_robus... |
73627235c5c7e540c2e5f049d211785f6d640ff935ae1cf3cb249b9ca4fc7f23 | Python | 545 | 20 | import os
import numpy as np
from scipy.ndimage import morphology
from nibabel import load, save, Nifti1Image
# Load data
nii = load('/home/sebastian/Desktop/patchFlatten/sub-02_done/upsampled/seg_rim_polished_perimeter_chunk.nii.gz')
basename = nii.get_filename().split(os.extsep, 1)[0]
dirname = os.path.dirname(nii... |
e77f0b64f50a2af737242320890e152c6a913766406952c57106de34d1c59040 | Python | 545 | 27 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from .tasks import (
BaseModel,
ClassificationModel,
DetectionModel,
SegmentationModel,
guess_model_scale,
guess_model_task,
load_checkpoint,
parse_model,
torch_safe_load,
yaml_model_load,
)
__all__ = (
"Ba... |
ff210b8e587fd9ad4da1543f58da7868d8892a119cb04eb91934828e3e89a529 | Python | 545 | 19 | # -*- coding: utf-8 -*-
# @Author : LG
from PyQt5 import QtCore, QtWidgets
from ISAT.ui.about_dialog import Ui_Dialog
class AboutDialog(QtWidgets.QDialog, Ui_Dialog):
def __init__(self, parent):
super(AboutDialog, self).__init__(parent)
self.setupUi(self)
self.setWindowModality(QtCore.Q... |
c102f628d3efc601ba356b7635cd8e47dea6a5ad23d9f513aa32a4ed9a78b10e | Python | 546 | 17 | # test.py - hk_model_1 테스트
import pytest
import brainscore_vision
def test_hk_model_1_has_identifier():
model = brainscore_vision.load_model('hk_model_1')
assert model.identifier == 'hk_model_1'
def test_hk_model_1_has_activations_model():
model = brainscore_vision.load_model('hk_model_1')
assert hasa... |
cd4b223b7e726d071786b2bcba6ee6448b3190e9203efbdca9fda3d140d71099 | Python | 547 | 19 | import functools
def extract_modify_dict(modify_config):
if modify_config is None:
return {}
# Flatten
modify_config = functools.reduce(lambda x,y: x+y, modify_config)
even_list, odd_list = modify_config[::2], modify_config[1::2]
if any(v.lower() == 'none' for v in odd_list):
rai... |
9afcadbd456f5ab0c3ef9c3837f689a11b3678880d9dec6f444946d952ee5026 | Python | 548 | 21 | import yaml
class ConfigNode:
def __init__(self, data):
for key, value in data.items():
if isinstance(value, dict):
value = ConfigNode(value)
setattr(self, key, value)
def __getitem__(self, item):
return getattr(self, item)
def __repr__(self):
... |
e49b3ff2f6ee71b11ace7d4387666f84898458c218679c0b7f0712be50e4162f | Python | 549 | 22 | import os
import numpy as np
from typing import Callable, List, Any, Literal, Tuple
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import napari
DataType = Any
LayerAttributes = dict
LayerName = Literal["image"]
FullLayerData = Tuple[DataType, LayerAttributes, LayerName]
NpzFileWriter = Callable[[str, FullLa... |
0657acc24d64b3b6de82c3aaf6c556a6e2b20f015d5c485a3946e6e401097e8a | Python | 550 | 24 | """
Download the demo data
"""
import os
import shutil
from tensorflow.keras.utils import get_file
MAIN_PATH = os.getcwd()
PROJECT_DIR = "demos/classical_ct_headneck_affine"
os.chdir(PROJECT_DIR)
DATA_PATH = "dataset"
FILE_PATH = os.path.abspath(os.path.join(DATA_PATH, "demo.h5"))
ORIGIN = "https://github.com/Yipeng... |
98e2b129381bfeb021071e276342b3b54f9dcb61b1a1ebd57a82989b03b19c3a | Python | 550 | 18 | # -*- coding: utf-8 -*-
"""
Created on %(date)s
@author: %(PV)s
"""
import pandas as pd
pd.options.display.max_columns = None
pd.options.display.max_colwidth = None
pd.options.display.max_rows = None
df = pd.read_csv('csvs/oddball_dataset.csv')
df1=pd.read_csv('csvs/df_aver_with_S_D_AD.csv')
df2=pd.read_csv('csvs/odd_... |
d66835cbc07912c55dcc42399995794196176b4d5a02f0305f24d693c93b6b21 | Python | 550 | 34 | import sys
sys.path.append('../../')
import jieba
jieba.enable_parallel(4)
import jieba.analyse
from optparse import OptionParser
USAGE ="usage: python extract_tags.py [file name] -k [top k]"
parser = OptionParser(USAGE)
parser.add_option("-k",dest="topK")
opt, args = parser.parse_args()
if len(args) <1:
pr... |
e34450b4cfb69bad910d57b7505b428f712f263963a37ac1c4b0c74e7e931b54 | Python | 550 | 28 | # /usr/bin/env python
"""This script contains some handy functions."""
import ruamel_yaml as yaml
import numpy as np
def load_configuration(filepath):
with open(filepath, "r") as f:
config = yaml.safe_load(f)
return config
def write_configuration(filepath, config):
with open(filepath, "w") as... |
ff1fa313c4881d9d997925ed62f0012db20a99b3821cf81eee087f14199665a1 | Python | 550 | 18 | import timm # type: ignore[import-untyped]
import torch
from torch import nn
class SiameseBackbone(nn.Module):
def __init__(self, model_name: str, pretrained: bool) -> None:
super().__init__()
self._model = timm.create_model(
model_name=model_name, pretrained=pretrained, features_only... |
2820958b69ccfeb646bc950e4ce0280a7829d929dd44db9a2c3fe1358fcdfac5 | Python | 551 | 13 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_behavioral_readout_layer, get_layers, get_model
model_registry["deepeisnn_cifar10_vgg19_lif"] = lambda: ModelCommitment(
identifier="deepeisnn_cifar10_vgg19_lif",
... |
7c7526123c8f0c23cc98ef8e56ee8d172bae1e31d3aaa03e557c76a1d6184a4e | Python | 551 | 15 | import pytest
from pytest import approx
from brainscore_vision import score
@pytest.mark.private_access
@pytest.mark.memory_intense
@pytest.mark.parametrize("model_identifier, benchmark_identifier, expected_score", [
("alexnet", "MajajHong2015.IT-pls", approx(0.417, abs=0.001)),
])
def test_score(model_identifie... |
91ad2ed350cde410eb14c82297c2887e411964f37b0287ee40fbc670d861e3b5 | Python | 551 | 14 | from tests.utils import pytest_importorskip
def test_qtbluetooth():
"""Test the qtpy.QtBluetooth namespace"""
QtBluetooth = pytest_importorskip("qtpy.QtBluetooth")
assert QtBluetooth.QBluetooth is not None
assert QtBluetooth.QBluetoothDeviceInfo is not None
assert QtBluetooth.QBluetoothServer is ... |
73185cbbb175c9e264d88438b6baa087b01a444e2f7c093b9a6a8d2f6a21d421 | Python | 552 | 15 | import pytest
from pytest import approx
from brainscore_vision import score
@pytest.mark.private_access
@pytest.mark.memory_intense
@pytest.mark.parametrize("model_identifier, benchmark_identifier, expected_score", [
("alexnet", "MajajHong2015.IT-pls", approx(0.508, abs=0.0005)),
])
def test_score(model_identifi... |
d0b6ea21744bd1e3d03d01fa47e9d87c091695e9236ec38ec850df23e6995eea | Python | 552 | 23 | """Preprocessing modules for DHG-LGB framework."""
from .similarity import (
compute_tanimoto_similarity,
compute_blast_similarity,
compute_go_semantic_similarity,
)
from .negative_sampling import (
load_associations,
build_indirect_associations,
generate_negative_samples,
save_samples,
)
... |
8f7c61cab33186e8c01163c62a9a088c45b5b16e0066e1f9f039046f4547d8cf | Python | 554 | 24 | """
Download the demo data
"""
import os
import shutil
from tensorflow.keras.utils import get_file
MAIN_PATH = os.getcwd()
PROJECT_DIR = "demos/classical_mr_prostate_nonrigid"
os.chdir(PROJECT_DIR)
DATA_PATH = "dataset"
FILE_PATH = os.path.abspath(os.path.join(DATA_PATH, "demo2.h5"))
ORIGIN = "https://github.com/Yip... |
f0465620b7906da9a192eb047f3e8ebf0f686007f918717e0a047757b031fb65 | Python | 554 | 20 | # 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.
from .build_sam import (
build_sam,
build_sam_vit_h,
build_sam_vit_l,
build_sam_vit_b,
sam_model_regis... |
c7eefceadbf9760346b16982aca131057b1d2b4cb9bffb4bef4e33634a1f3f86 | Python | 555 | 19 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtSvg classes and f... |
43c50a0f68a3f2324b686eb5ad6f2d2868fd74bf65665b0e5d59a890cc60dae6 | Python | 556 | 14 | from scipy.io import savemat, loadmat
import teneto
import numpy as np
wd = "/home/mibur/comet/tests/MATLAB"
ts = np.loadtxt(f"{wd}/time_series.txt")
sd = teneto.timeseries.derive_temporalnetwork(ts[:,:5].T, params={"method": "distance", "distance": "euclidean"})
dcc = loadmat(f"{wd}/dcc.mat")["dcc"]
fls = loadmat(f"... |
ac47b6e5c6cf48b700bc88708e4c68882a8f9b624090f5bacf8788f04a233479 | Python | 556 | 13 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_behavioral_readout_layer, get_layers, get_model
model_registry["deepeisnn_cifar10_vgg19_full"] = lambda: ModelCommitment(
identifier="deepeisnn_cifar10_vgg19_full",... |
8cc1c10cc325070e30a0abfedc68652f2bf7acd0949bb0b19ad4aa1f8668811a | Python | 557 | 28 | #!/usr/bin/env python
"""
Read a wiggle track and print out a series of lines containing
"chrom position score". Ignores track lines, handles bed, variableStep
and fixedStep wiggle lines.
"""
import sys
from typing import TextIO
import bx.wiggle
if len(sys.argv) > 1:
in_file: TextIO = open(sys.argv[1])
else:
... |
18a033296a8ec341f6b7eb005f3993bdcb24e3b827881a79c81272806a2de44c | Python | 558 | 15 | from .ui_add_behavior_dialog import Ui_AddBehaviorDialog
from .ui_add_stream_dialog import Ui_AddStreamDialog
from .ui_delete_behavior_dialog import Ui_DeleteBehaviorDialog
from .ui_delete_stream_dialog import Ui_DeleteStreamDialog
from .ui_new_annotation_dialog import Ui_NewAnnotationDialog
from .ui_truncate_annotatio... |
3017d9fd04a95ef156e5334e0016ae1726f4eef58934120f875a66487feba294 | Python | 559 | 9 | from brainscore_vision import benchmark_registry
from brainscore_vision.benchmarks.baker2022.benchmark import Baker2022AccuracyDeltaFrankenstein, \
Baker2022AccuracyDeltaFragmented, Baker2022InvertedAccuracyDelta
DATASETS = ['normal', 'inverted']
benchmark_registry['Baker2022frankenstein-accuracy_delta'] = lambda... |
61a6a4b5e00684911ce01ec496df921774234371c328d5570e4e84ee114cff0d | Python | 559 | 21 | """
DeepReg package init.
We set tensorflow log level environment variable here before importing it.
- 0 = all messages are logged (default behavior)
- 1 = INFO messages are not printed
- 2 = INFO and WARNING messages are not printed
- 3 = INFO, WARNING, and ERROR messages are not printed
"""
# flake8: noqa
import o... |
c026aa0ef5f17c5e2dd38b431c665189d691fc1e457a7476d8bb93e3778318d6 | Python | 559 | 16 | # Copyright (C) 2020-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
# Inherit parent config
from cvat.settings.production import * # pylint: disable=wildcard-import
# https://github.com/pennersr/django-allauth
ACCOUNT_LOGIN_METHODS = {"username", "email"}
ACCOUNT_CONFIRM_... |
1f894e024689e941816620c07cbb4076247df2b5010b39d020b660c3df4725fd | Python | 560 | 21 | """
Constants used throughout the mcmlnet package.
"""
import os
from dotenv import load_dotenv
load_dotenv()
# Unit conversion constants
NM_TO_M = 1e-9 # Convert nanometers to meters
CM_INV_TO_M_INV = 1e2 # Convert cm^-1 to m^-1
REFERENCE_WAVELENGTH_M = 500e-9 # Reference wavelength for scattering calculations... |
88c09cd1764bff6b324f20f5aec81ec75f0cd870e1ac9052b072fafdd68196cc | Python | 560 | 26 | """
ChemGraph Memory Module
Provides persistent session storage for ChemGraph conversations,
enabling users to review past sessions and resume from previous context.
"""
from chemgraph.memory.store import SessionStore
from chemgraph.memory.schemas import (
MainAgentGraphConfig,
MainAgentSessionMetadata,
S... |
1702847c50a90ee06a18839f6aeed8230d80194a3e70b32f1eefefd6f7a5df61 | Python | 561 | 15 | from fancyimpute import MatrixFactorization
from low_rank_data import XY, XY_incomplete, missing_mask
from common import reconstruction_error
def test_matrix_factorization_with_low_rank_random_matrix():
solver = MatrixFactorization(learning_rate=0.02, rank=5)
XY_completed = solver.fit_transform(XY_incomplete... |
f4e13b075206bab6dafba6203d3f87140cf465b0b19018bd948d6d158dcc7bdf | Python | 561 | 18 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers, LAYER_NAME
_REGION_LAYER_MAP = {
'V1': LAYER_NAME,
'V2': LAYER_NAME,
'V4': LAYER_NAME,
'IT': LAYER_NAME,
}
model_registry['gabor_fil... |
3a40114572b3b84fd88da050507a6fb666eb9bb3191a1a23111344606d1cdccc | Python | 562 | 20 | # main.py
import yaml
import argparse
from chemembed.chemembed_single_file import run
def load_config(config_path):
with open(config_path, 'r') as file:
config = yaml.safe_load(file)
return config
def main():
parser = argparse.ArgumentParser(description='Process and predict mass spectrometry data.... |
b2bf0402adbcf0c3ed548b349d3c0dd8b8beb6e90cd3135d0785d93de2234a4e | Python | 562 | 25 | """Defines functions for ADMET-AI models."""
from admet_ai import ADMETModel
from admet_ai.web.app import app
ADMET_MODEL: ADMETModel | None = None
def load_admet_model() -> None:
"""Loads the models into memory."""
global ADMET_MODEL
ADMET_MODEL = ADMETModel(
models_dir=app.config["MODELS_DIR"... |
e8897329b15503279e9b399ac97ff9c7fc4b71aa255e9c8b838272a251286212 | Python | 562 | 14 | # coding=utf-8
#
# 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
# dis... |
4ec1a21cf326be59e22234bf8dc478e7782a65967f9831ac53739a87a888d4fc | Python | 563 | 24 | #!/usr/bin/env python
"""
A very simple test of Steve.
"""
import pytestqt
import storm_control.sc_library.hdebug as hdebug
import storm_control.sc_library.parameters as params
import storm_control.test as test
import storm_control.steve.steve as steve
def test_steve_starts(qtbot):
parameters = params.parameter... |
1238084337eec27c7ed4b8665ac79bb1049ce8c6143b0317e1efda52e0ec4529 | Python | 564 | 25 | """
This submodule contains model definitions and common modules.
"""
from .commons import *
from .unet import *
from .resnet import *
from .cpn import *
from .fpn import *
from .inference import *
from .mobilenetv3 import *
from .normalization import *
from .filters import *
from .features import *
from .ppm import *
... |
b4b8eb3f4607adf08d025f0da53fc4413e42f2ec0089ef48c92544bf799d1ba3 | Python | 564 | 21 | from .nodes import NestedNode, NestedMapNode
from .workflow import NestedWorkflow
from .pipelines import AnatPipeline, FuncPipeline, GroupPipeline, QcPipeline, PumiPipeline, BidsPipeline
from .apps import BidsApp
from .reproducibility import get_interface_version, create_dataset_description
__all__ = [
'NestedNod... |
1f708d248c5357f9370c87fff8055a0ff4066db4f23baee977ba722664822af4 | Python | 565 | 22 | import sys
import os
import torch
from torchviz import make_dot
from MixerUnet import ConvMixer_UNET_down
# Create a dummy input tensor with the same dimensions as your model's input
dummy_input = torch.randn(1, 3, 256, 256)
# Instantiate your model
model = ConvMixer_UNET_down(2)
# Pass the dummy input through the ... |
3d5a0452776c6a3702ab8bfee65a2cfe78c1df9ebe9dcf8df4b3e01363e80757 | Python | 565 | 13 | from eir.models.output.array.array_output_modules import ArrayOutputWrapperModule
from eir.models.output.sequence.sequence_output_modules import SequenceOutputModule
from eir.models.output.tabular.linear import LinearOutputModule
from eir.models.output.tabular.mlp_residual import ResidualMLPOutputModule
from eir.models... |
455fef344e9435c474782ab2ba8eb50a9ae4fdf2fdeb97079851571cc7512ae0 | Python | 565 | 22 | from __future__ import annotations
import json
from pathlib import Path
from typing import Any
import numpy as np
from numpy.typing import NDArray
from labelme._utils import _image as image_module
here = Path(__file__).parent
data_dir = here.parent.parent / "data"
def get_img_and_data() -> tuple[NDArray[np.uint8]... |
77c530208fea201d2f1905419bc26aa666d5e44be2d242231160d35eedbd5c21 | Python | 565 | 23 | # Generated by Django 4.2.26 on 2026-04-24 17:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("engine", "0099_remove_chunk_type_list"),
]
operations = [
migrations.AlterField(
model_name="task",
name="mode",
... |
121aa6428e990d1011ed7dca963bfaec63c4f082432a198b5195ac8e29453696 | Python | 566 | 11 | from brainscore_vision import benchmark_registry
from .benchmark import Papale2025
benchmark_registry['Papale2025.V1-ridge'] = lambda: Papale2025('V1', 'ridge')
benchmark_registry['Papale2025.V4-ridge'] = lambda: Papale2025('V4', 'ridge')
benchmark_registry['Papale2025.IT-ridge'] = lambda: Papale2025('IT', 'ridge')
b... |
290ee30653ca2dc1c051603627a3cedd823dbe67f726c7444312473505850ca6 | Python | 566 | 19 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import django_rq
from django.conf import settings
from rq_scheduler import Scheduler
from cvat.apps.redis_handler.redis_migrations import BaseMigration
class Migration(BaseMigration):
def run(self):
scheduler: Scheduler = django_rq.get... |
75954fd1119b862c87196d315f4de6a25c55254a54d096dfcefbe081a2b7cea5 | Python | 566 | 25 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
class CvatSdkException(Exception):
"""Base class for SDK exceptions"""
class InvalidHostException(CvatSdkException):
"""Indicates an invalid hostname error"""
class IncompatibleVersionException(CvatSdkException):
"""Indicates server ... |
b63e3a91e79a38aacc1459f1be901a386d81018d69288cb1f47a7d7b3a98ddfc | Python | 566 | 13 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_behavioral_readout_layer, get_layers, get_model
model_registry["deepeisnn_cifar10_resnet18_lif"] = lambda: ModelCommitment(
identifier="deepeisnn_cifar10_resnet18_l... |
fb3300e052c3f85bc390bbff6d6a38cddb70322bed425c74e14e2aaea0609d47 | Python | 566 | 14 | import pandas as pd
import geopandas as gpd
import os
# We make relevant datasets contained in this folder available across the project, for easier integration and plotting.
# The base directory points to the folder containing this file:
base_dir = os.path.dirname(__file__)
# Make the ISO code lookup table available ... |
0ba886a51e353ce2cbb08115f92b3bc2d6dd1e4ba33f9af25b06030049234867 | Python | 567 | 11 | import os
import ClearMap.Settings as settings
filename = os.path.join(settings.ClearMapPath, 'Test/Data/ImageAnalysis/cfos-substack.tif');
import ClearMap.Visualization.Plot as plt
import ClearMap.IO as io
data = io.readData(filename, z = (0,26));
import ClearMap.ImageProcessing.BackgroundRemoval as bgr
dataBGR = bgr.... |
1271612a7a924c71aeed17d811a2aff12e0b1f54d544d95e4c028ba262bb3deb | Python | 567 | 51 | # -*- coding: utf-8 -*-
def test_py_fspecial_gauss():
# toDO
pass
def test_process_contrast_map():
# toDO
pass
def test_compute_saturation_map():
# toDO
pass
def test_compute_ratio_map():
# toDO
pass
def test_threshold_map():
# toDO
pass
def test_adjust_B1_map_intensi... |
28ba60391ce202b90d1a07e81f3f579b51d92e18bb64457deb3e3db7c8109622 | Python | 567 | 17 | """Causal Survival Analysis Models"""
from .univariate_curve_fitter import UnivariateCurveFitter
from .regression_curve_fitter import RegressionCurveFitter
from .marginal_survival import MarginalSurvival
from .weighted_survival import WeightedSurvival
from .standardized_survival import StandardizedSurvival
from .weigh... |
2ac2cffc7d6fd1f56db54c1eb23c97cca1f55b5760b401d682393c1b03ce90b8 | Python | 567 | 20 | #!/usr/local/bin/python3
from pipeline import pupil, experiment
import logging
import time
import datajoint as dj
## database logging code
logging.basicConfig(level=logging.ERROR)
logging.getLogger('datajoint.connection').setLevel(logging.DEBUG)
if hasattr(dj.connection, 'query_log_max_length'):
dj.connection.q... |
bc498f68da2d5a6e3c22fe0738d3197b6219a79fc8d3c6a3d0f66ee449a8cb65 | Python | 567 | 28 | #!/usr/bin/env python
"""
Takes a list of maf filenames on the command line and prints a comma separated
list of the species that occur in all of the mafs.
usage %prog maf1 maf2 ...
"""
import operator
import sys
from functools import reduce
import bx.align.maf
files = sys.argv[1:]
sets = []
for file in files:
... |
3a4702ad86dcf3eabcb7216c2db53f6ff34c20803d1636d644db15dbe656c1d9 | Python | 568 | 19 | # -*- coding: utf-8 -*-
import torch
# %% convert medsam model checkpoint to sam checkpoint format for convenient inference
sam_ckpt_path = ""
medsam_ckpt_path = ""
save_path = ""
multi_gpu_ckpt = True # set as True if the model is trained with multi-gpu
sam_ckpt = torch.load(sam_ckpt_path)
medsam_ckpt = torch.load(... |
893345b42538a8cb9639fdfb81570f4e78e128d5069248f2bdde5aafb877ad71 | Python | 568 | 17 | """The only production construction site for ``ChatOpenAI``.
Every OpenAI-compatible endpoint (OpenAI direct, both Argo variants, all three
ALCF clusters, OpenRouter, and vLLM/custom endpoints) reaches this builder. It
receives fully prepared kwargs and applies no endpoint-specific conditions.
"""
from __future__ imp... |
a79578e7c5cff33712e94074b3bbcc00a548c0291471dcf772292aa7b76c37d6 | Python | 568 | 27 | #
# A very simple test of Dave.
#
from PyQt5 import QtCore
import time
import pytestqt
import storm_control.sc_library.hdebug as hdebug
import storm_control.sc_library.parameters as params
import storm_control.test as test
import storm_control.dave.dave as dave
def test_dave_starts(qtbot):
parameters = params... |
6ca40fd1bbf8e92f53771010eb3578580459d7ebf0ff28f37b84b959e9ab54d9 | Python | 569 | 17 | import torch
from torch import nn
class LocalChannelAttention(nn.Module):
def __init__(self, feature_map_size, kernel_size):
super().__init__()
assert (kernel_size%2 == 1), "Kernel size must be odd"
self.conv = nn.Conv1d(1, 1, kernel_size, 1, padding=(kernel_size-1)//2)
sel... |
894b63e3f229990ff2800758a85fe4f6a13e0779825ec3ad19f71b10053e40de | Python | 569 | 15 | import pytest
from pytest import approx
from brainscore_vision import score
@pytest.mark.private_access
@pytest.mark.memory_intense
@pytest.mark.parametrize("model_identifier, benchmark_identifier, expected_score", [
("alexnet_workflow_trigger", "MajajHong2015.IT-pls", approx(0.508, abs=0.0005)),
])
def test_sco... |
cfd5aa3212da27481203518bf251e06adc3456db1e5eb46ebbb5de11aa8a18c6 | Python | 570 | 15 | import pytest
from pytest import approx
from brainscore_vision import score
@pytest.mark.private_access
@pytest.mark.memory_intense
@pytest.mark.parametrize("model_identifier, benchmark_identifier, expected_score", [
("alexnet_pipeline_test_v1", "MajajHong2015.IT-pls", approx(0.4175, abs=0.0005)),
])
def test_sc... |
f4f10ba1f687a35131296a546fde0531adf7e6565edbccdd9a6165e984df3664 | Python | 570 | 12 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
# region_layer_map omitted -> framework auto-selects best layer per region.
model_registry['convnext_large_in22k_supervised'] = lambda: ModelCommitment(... |
ff76e47abf39a76004b8ba44e9f5274fb67c6ce8ac6495f6be34697fbf02c3c4 | Python | 570 | 26 | import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
import os
def ddp_setup():
"""
Function to setup the Distributed Data Parallel (DDP) Environment
"""
dist.init_process_group(backend="nccl")
def ddp_cleanup():
"""
Function to cleanup the D... |
ce425d494b2d8b1e3ad826c1abe61131cc68dfdade1487a79b770491e6b1eff1 | Python | 571 | 13 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_behavioral_readout_layer, get_layers, get_model
model_registry["deepeisnn_cifar10_resnet18_full"] = lambda: ModelCommitment(
identifier="deepeisnn_cifar10_resnet18_... |
df207e64f7bb3ad457d07d16cd7607ce7f73fb3587973e54ad36d39f9cf1bd8b | Python | 571 | 15 | import pytest
from pytest import approx
from brainscore_vision import score
@pytest.mark.private_access
@pytest.mark.memory_intense
@pytest.mark.parametrize("model_identifier, benchmark_identifier, expected_score", [
("alexnet_private_submission", "MajajHong2015.IT-pls", approx(0.508, abs=0.0005)),
])
def test_s... |
e91672a41321c665bfa847069d6e8f16c3729e52eb2e3a5023d6d5badcee3a76 | Python | 571 | 13 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_behavioral_readout_layer, get_layers, get_model
model_registry["deepeisnn_imagenet_resnet18_lif"] = lambda: ModelCommitment(
identifier="deepeisnn_imagenet_resnet18... |
fb94ec89f62ad354410db812909f437e5f8405eaf6728a7181a7deaaba982ce6 | Python | 571 | 15 | import pytest
from pytest import approx
from brainscore_vision import score
@pytest.mark.private_access
@pytest.mark.memory_intense
@pytest.mark.parametrize("model_identifier, benchmark_identifier, expected_score", [
("alexnet_gated_submission", "MajajHong2015.IT-pls", approx(0.41748, abs=0.0005)),
])
def test_s... |
6f1226a91add6c72c35125b5bd595707b4dacdda3fc6b52140c3d8238c6e0399 | Python | 572 | 16 | #!/usr/bin/env python
"""DEPRECATED shim -> `morphometrics distances_orientations`.
This script has moved into the installable `surface_morphometrics` package and is
now invoked as `morphometrics distances_orientations ...`. This thin wrapper forwards to that
command and will be removed in a future release.
"""
import... |
bbe7f1c19faed3f15d17e455e25937235f54a6d609a03dde05db47a0f3fd40af | Python | 572 | 15 | import pytest
from pytest import approx
from brainscore_vision import score
@pytest.mark.private_access
@pytest.mark.memory_intense
@pytest.mark.parametrize("model_identifier, benchmark_identifier, expected_score", [
("alexnet_gated_submission2", "MajajHong2015.IT-pls", approx(0.41748, abs=0.0005)),
])
def test_... |
dec6601cd91309a46f0ad4f16896e33229f2fea404ad52da5500278851983358 | Python | 572 | 13 | # 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... |
2f421b4088439b83f8a15aad6a22ddd8335460f4f3e574d916290f416a186956 | Python | 573 | 26 | #!/usr/bin/env python3
# coding: utf-8
import json
import nrn_validation as V
V.override_defaults_from_args()
# dendrite geometry: all 100 µm long, 1 µm diameter.
geom = [(0, 1), (100, 1)]
model = V.VModel()
model.add_soma(12.6157)
model.add_dendrite("dend1", geom)
model.add_dendrite("dend2", geom, to="dend1")
mode... |
853f3429b58e69236d2581650bbe5cccc78b4b18f99c1468c6bf2b6fb7b18818 | Python | 573 | 19 | import pytest
from brainscore_vision import load_benchmark, load_model
@pytest.mark.private_access
def test_ceiling():
benchmark = load_benchmark('Hebart2023-match')
ceiling = benchmark.ceiling
assert ceiling == pytest.approx(0.6767, abs=0.0001)
@pytest.mark.private_access
def test_alexnet_consistency(... |
023511de2956d7568da5c8d884d58a7d7c2d817a8cc62825f8bf175a4ddbb38b | Python | 574 | 23 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides access to sip."""
... |
057d89badaf9a1fbaf08f7e518c3da6a63d10a910acdde656061a37008b5d603 | Python | 574 | 22 | from click.testing import CliRunner
from drop import cli
from .common import *
def test_Help_isShown():
runner = CliRunner()
result = runner.invoke(cli.main)
assert result.exit_code == 0
help_result = runner.invoke(cli.main, ['--help'])
assert help_result.exit_code == 0
assert '--help' in help... |
e130d059536b9e9e00022316140685b36015afbdf4acbb2e9d257f2b9e6030ce | Python | 574 | 17 | import os
import shutil
import time
def main():
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
data_dir = os.path.join(root_dir, 'data')
for subfolder_name in os.listdir(data_dir):
subfolder_path = os.path.join(data_dir, subfolder_name)
if os.path.isdir(subfolder_pa... |
e53b45aef03d9a2813b8bf5dae512e1cdd67c2d944f703d2a62cd7cae669326f | Python | 574 | 20 | '''Test ogo setup version is correct'''
import unittest
from ogo.util.echo_arguments import echo_arguments
import os
class TestEchoArguments(unittest.TestCase):
'''Test the ogo version is PEP compliant'''
def test_empty_dictionary(self):
expected = 'title:'+os.linesep
self.assertEqual(echo_a... |
48f7a19bd6a76fe36f78b0d43722d29928fa5c044c7b0ac33429a79ca0e088d6 | Python | 575 | 19 | from conans import ConanFile, CMake
import os
channel = os.getenv("CONAN_CHANNEL", "testing")
username = os.getenv("CONAN_USERNAME", "g-truc")
class TestGlm(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "glm/master@%s/%s" % (username, channel)
generators = "cmake"
def build... |
f46244ac3d448c86e2aac256debf81d1a5732c57ac0bfa579c899c588b4618c0 | Python | 575 | 22 | """Test QDesktopServices split in Qt5."""
import pytest
def test_qstandarpath():
"""Test the qtpy.QStandardPaths namespace"""
from qtpy.QtCore import QStandardPaths
assert QStandardPaths.StandardLocation is not None
# Attributes from QDesktopServices shouldn't be in QStandardPaths
with pytest.... |
26416ef2e6a77e71215e825dc4d50e6f837ff5b5c5e213b78aaf6e1feaef1480 | Python | 576 | 13 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_behavioral_readout_layer, get_layers, get_model
model_registry["deepeisnn_imagenet_resnet18_full"] = lambda: ModelCommitment(
identifier="deepeisnn_imagenet_resnet1... |
93567948e7a71f11f8f84e603119a5017a5d20dd2af85e28a6c9880b0a47dfe4 | Python | 576 | 25 | from __future__ import annotations
import numpy as np
from brainways.transforms.base import BrainwaysTransform
from brainways.utils.image import ImageSizeHW
class IdentityTransform(BrainwaysTransform):
def __init__(self):
pass
def transform_image(
self,
image: np.ndarray,
ou... |
27a8e4aca019315aa6fcb5da25309405e4e41f30eac8a80e371dca6f8e106c15 | Python | 577 | 18 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers, LAYER_NAME
_REGION_LAYER_MAP = {
'V1': LAYER_NAME,
'V2': LAYER_NAME,
'V4': LAYER_NAME,
'IT': LAYER_NAME,
}
model_registry['gabor_fil... |
363c2e0c33e61c940df0cd55fa79bf9bba1630f6d2063525eb39dccd4b76eed4 | Python | 577 | 20 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 14 11:25:41 2023
@author: axthi
"""
import sys
# --------------------------------------------------
# NOTE: Update this path to fit to your installation
path_to_utils = 'C:/Users/axthi/simnibs/memoslap_utils/'
sys.path.append(path_to_utils)
from simnibs_memoslap_utils.ut... |
c2138fcc653c99798e9fd2f9ec2dd27a0ccd772a299978b55ab1a591fd08efa7 | Python | 578 | 27 | #
# A very simple test of Steve.
#
from PyQt5 import QtCore
import time
import pytestqt
import storm_control.sc_library.hdebug as hdebug
import storm_control.sc_library.parameters as params
import storm_control.test as test
import storm_control.steve.steve as steve
def test_steve_starts(qtbot):
parameters = p... |
a716b36f854bcc882c1509fd6c61db323b91d8e02cb65f71d3c3d85ac95581e9 | Python | 579 | 21 | import pytest
from qtpy import PYQT5, PYQT_VERSION, PYSIDE2, _parse_version
@pytest.mark.skipif(
not (
(PYQT5 and _parse_version(PYQT_VERSION) >= _parse_version("5.15.1"))
or PYSIDE2
),
reason="Only available in Qt5 bindings (PyQt5 >= 5.15.1 or PySide2)",
)
def test_qttexttospeech():
... |
2ced48b04795e393e0b75a21f72cc371010ddefddd19b79421335308de3d2690 | Python | 580 | 17 | from typing import Union
from pathlib import Path
class Stimulus:
def from_path(self, path):
raise NotImplementedError("Choose a concrete Stimulus type to use.")
@staticmethod
def is_video_path(path: Union[str, Path]) -> bool:
extension = path.split('.')[-1].lower()
return ext... |
97e0fd5bdb407a1e761ddc1042ede79f9df0add63d495cbdf654ed61ea5bd8d7 | Python | 580 | 19 | import pandas as pd
def get_user_list():
data = pd.read_csv('./user_post.csv')
length = len(data)
all_user = data.loc[0:length-1]
all_user = list(all_user['id'])
return all_user
if __name__ == '__main__':
user_list = get_user_list()
label = pd.read_csv("/data2/whr/czl/TwiBot22-baseline... |
275d8d6d50e45fac9b59c41fb8aa6bd7650de3d3835077684b63dc3a1c7dcdb5 | Python | 582 | 23 | """SFCN with a single sigmoid output for binary classification."""
from tensorflow import Tensor
from tensorflow.keras.layers import Dense
from .sfcn import SFCN
class BinarySFCN(SFCN):
"""SFCN for binary classification tasks.
The prediction head is a single Dense unit with sigmoid activation,
producin... |
44520cfdc1a711968421655beb8e07d54213a184732325dd64d2a210245a4d16 | Python | 582 | 19 | import scanpy as sc
from scipy import io
adata = sc.read_h5ad('/path/to/RNA.E.MATRIX.h5ad')
with open('/path/to/RNA.E.MATRIX.barcodes.tsv', 'w') as f:
for item in adata.obs_names:
f.write(item + '\n')
print('Barcodes file processing complete')
with open('/path/to/RNA.E.MATRIX.features.tsv', 'w'... |
16615f7e35204073576954974c887f01d3495cad867c5d3b8dfc796e9ad56654 | Python | 583 | 22 | '''Test the ogo command line interface for img exists'''
import unittest
import subprocess
class TestCLIForImag(unittest.TestCase):
'''Test the ogo command line interface for img exists'''
def test_can_call_img(self):
'''Can call `ogo img`'''
command = ['ogo', 'img']
self.assertTrue(... |
42fe09269341ef2c64018757fd7e69832c1758cba953554d5aa50a7ad0cd49d8 | Python | 584 | 23 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides access to shiboken.... |
e539dba206f10a834e6f71faa752707b46af48c495cca9f202310026f8429dfe | Python | 584 | 14 | import tensorflow as tf
import tensorflow_probability as tfp
def multinomial_nll(true_counts, logits):
"""Compute the multinomial negative log-likelihood
Args:
true_counts: observed count values [B x L]
logits: predicted logit values [B x L]
"""
counts_per_example = tf.reduce_sum(true_count... |
0ce724b8c7618fea7b9d35643ea21539e7976183a522f1b59ff07d7c0bcb5654 | Python | 586 | 28 | from setuptools import setup, find_packages
import os
requires = [
"pandas",
"scikit-image",
"numpy",
"scipy",
"scikit-learn",
"tables",
"umap-learn"
]
DESCRIPTION = "De-noising Spatial Transcriptomics Data Based on Position and Image Information"
setup(
name="sprod",
version=1.0,... |
4958d5ef69b83df328169571b1878a7a390554b792ceaa6b5ab5e4b4e949887a | Python | 586 | 23 | # Generated by Django 5.2.14 on 2026-06-01 11:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("webhooks", "0004_alter_webhook_target_url"),
]
operations = [
migrations.AddField(
model_name="webhookdelivery",
na... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.